Skip to content

armgit / ui

Public Imported from GitHub
0
TypeScript

Refine PDF editor controls and styling

Andrew Luofbda5b7e65cf
diff --git a/apps/v4/components/bounding-box-citations-docs.tsx b/apps/v4/components/bounding-box-citations-docs.tsx
index 65d514b..a8a864c 100644
--- a/apps/v4/components/bounding-box-citations-docs.tsx
+++ b/apps/v4/components/bounding-box-citations-docs.tsx
@@ -313,24 +313,24 @@ function ensureDarkThemeObserver() {
})
}
-function useIsDarkTheme() {
- const [isDark, setIsDark] = React.useState(readIsDarkTheme)
-
- React.useEffect(() => {
- ensureDarkThemeObserver()
- setIsDark(sharedIsDarkTheme)
- darkThemeListeners.add(setIsDark)
-
- return () => {
- darkThemeListeners.delete(setIsDark)
- if (darkThemeListeners.size === 0 && darkThemeObserver) {
- darkThemeObserver.disconnect()
- darkThemeObserver = null
- }
+function subscribeToDarkTheme(listener: () => void) {
+ ensureDarkThemeObserver()
+ darkThemeListeners.add(listener)
+ return () => {
+ darkThemeListeners.delete(listener)
+ if (darkThemeListeners.size === 0 && darkThemeObserver) {
+ darkThemeObserver.disconnect()
+ darkThemeObserver = null
}
- }, [])
+ }
+}
- return isDark
+function useIsDarkTheme() {
+ return React.useSyncExternalStore(
+ subscribeToDarkTheme,
+ readIsDarkTheme,
+ () => false
+ )
}
function useHumanReviewGridTheme() {
@@ -2659,9 +2659,13 @@ function HumanReviewPanel({
initialExpectedValues
)
- React.useEffect(() => {
+ const [previousInputs, setPreviousInputs] = React.useState({
+ initialExpectedValues,
+ })
+ if (previousInputs.initialExpectedValues !== initialExpectedValues) {
+ setPreviousInputs({ initialExpectedValues })
setExpected(initialExpectedValues)
- }, [initialExpectedValues])
+ }
const updateValue = React.useCallback((key: string, value: JsonValue) => {
setExpected((current) =>
diff --git a/apps/v4/components/command-menu.tsx b/apps/v4/components/command-menu.tsx
index a1893dd..dc77f72 100644
--- a/apps/v4/components/command-menu.tsx
+++ b/apps/v4/components/command-menu.tsx
@@ -122,6 +122,8 @@ export function CommandMenu({
[setSearch, trackSearchQuery]
)
+ if (!open && renderDelayedGroups) setRenderDelayedGroups(false)
+
// Cleanup timeout on unmount.
React.useEffect(() => {
if (open) {
@@ -133,8 +135,6 @@ export function CommandMenu({
cancelAnimationFrame(frame)
}
}
-
- setRenderDelayedGroups(false)
}, [open])
React.useEffect(() => {
diff --git a/apps/v4/components/document-splitter-docs.tsx b/apps/v4/components/document-splitter-docs.tsx
index d9d4b73..4cbe28f 100644
--- a/apps/v4/components/document-splitter-docs.tsx
+++ b/apps/v4/components/document-splitter-docs.tsx
@@ -702,9 +702,13 @@ function useWorkbookSheetThumbnailUrls(workbookIdentity: string) {
Record<number, string>
>({})
- React.useEffect(() => {
+ const [previousInputs, setPreviousInputs] = React.useState({
+ workbookIdentity,
+ })
+ if (previousInputs.workbookIdentity !== workbookIdentity) {
+ setPreviousInputs({ workbookIdentity })
setThumbnailUrls({})
- }, [workbookIdentity])
+ }
React.useEffect(() => {
thumbnails.forEach((thumbnail) => {
@@ -1114,9 +1118,11 @@ function usePdfThumbnailImages(documentKey: string, splits: SplitGroup[]) {
[splits]
)
- React.useEffect(() => {
+ const [previousInputs, setPreviousInputs] = React.useState({ documentKey })
+ if (previousInputs.documentKey !== documentKey) {
+ setPreviousInputs({ documentKey })
setThumbnailImages({})
- }, [documentKey])
+ }
React.useEffect(() => {
let isCurrent = true
@@ -1196,11 +1202,18 @@ function WorkbookSplitsPane({
[thumbnailUrls]
)
- React.useEffect(() => {
- if (sheets.length === 0) return
-
- setSplits(createInitialWorkbookSplits(sheets.length))
- }, [sheets.length, workbookIdentity])
+ const sheetCount = sheets.length
+ const [previousWorkbook, setPreviousWorkbook] = React.useState({
+ workbookIdentity,
+ sheetCount,
+ })
+ if (
+ previousWorkbook.workbookIdentity !== workbookIdentity ||
+ previousWorkbook.sheetCount !== sheetCount
+ ) {
+ setPreviousWorkbook({ workbookIdentity, sheetCount })
+ if (sheetCount > 0) setSplits(createInitialWorkbookSplits(sheetCount))
+ }
return (
<DocumentSplits
@@ -1292,9 +1305,17 @@ export function DocumentSplitsBlock({
}
}, [])
- React.useEffect(() => {
+ const [previousInputs, setPreviousInputs] = React.useState({
+ numPages,
+ pdfUrl,
+ })
+ if (
+ previousInputs.numPages !== numPages ||
+ previousInputs.pdfUrl !== pdfUrl
+ ) {
+ setPreviousInputs({ numPages, pdfUrl })
setSplits(createInitialGroups(numPages || DEFAULT_PREVIEW_PAGE_COUNT))
- }, [numPages, pdfUrl])
+ }
const handlePdfUpload = React.useCallback((file: File) => {
const nextUrl = URL.createObjectURL(file)
@@ -1441,9 +1462,14 @@ function DocumentSplitsPreview({ file }: { file: string }) {
}
}, [file])
- React.useEffect(() => {
+ const [previousInputs, setPreviousInputs] = React.useState({
+ file,
+ pageCount,
+ })
+ if (previousInputs.file !== file || previousInputs.pageCount !== pageCount) {
+ setPreviousInputs({ file, pageCount })
setSplits(createInitialGroups(pageCount || DEFAULT_PREVIEW_PAGE_COUNT))
- }, [file, pageCount])
+ }
return (
<DocumentSplits
diff --git a/apps/v4/components/e-signature-docs.tsx b/apps/v4/components/e-signature-docs.tsx
index 12fa1d6..cd6bd62 100644
--- a/apps/v4/components/e-signature-docs.tsx
+++ b/apps/v4/components/e-signature-docs.tsx
@@ -194,11 +194,22 @@ function SignatureDialog({
[fieldBbox]
)
- React.useEffect(() => {
+ const [previousOpen, setPreviousOpen] = React.useState(open)
+ if (previousOpen !== open) {
+ setPreviousOpen(open)
if (!open) {
setGuideSize(null)
- return
+ setIsReady(false)
+ setHasSignature(false)
}
+ }
+ const canInitialize = Boolean(
+ open && guideSize && guideSize.width > 1 && guideSize.height > 1
+ )
+ if (!canInitialize && isReady) setIsReady(false)
+
+ React.useEffect(() => {
+ if (!open) return
let frameId = 0
let resizeObserver: ResizeObserver | null = null
@@ -261,10 +272,6 @@ function SignatureDialog({
if (!open || !guideSize || guideSize.width <= 1 || guideSize.height <= 1) {
signaturePadRef.current?.off()
signaturePadRef.current = null
- setIsReady(false)
- if (!open) {
- setHasSignature(false)
- }
return
}
diff --git a/apps/v4/components/extend/bounding-box-citations.tsx b/apps/v4/components/extend/bounding-box-citations.tsx
index 0090f43..6eb0993 100644
--- a/apps/v4/components/extend/bounding-box-citations.tsx
+++ b/apps/v4/components/extend/bounding-box-citations.tsx
@@ -314,24 +314,24 @@ function ensureDarkThemeObserver() {
})
}
-function useIsDarkTheme() {
- const [isDark, setIsDark] = React.useState(readIsDarkTheme)
-
- React.useEffect(() => {
- ensureDarkThemeObserver()
- setIsDark(sharedIsDarkTheme)
- darkThemeListeners.add(setIsDark)
-
- return () => {
- darkThemeListeners.delete(setIsDark)
- if (darkThemeListeners.size === 0 && darkThemeObserver) {
- darkThemeObserver.disconnect()
- darkThemeObserver = null
- }
+function subscribeToDarkTheme(listener: () => void) {
+ ensureDarkThemeObserver()
+ darkThemeListeners.add(listener)
+ return () => {
+ darkThemeListeners.delete(listener)
+ if (darkThemeListeners.size === 0 && darkThemeObserver) {
+ darkThemeObserver.disconnect()
+ darkThemeObserver = null
}
- }, [])
+ }
+}
- return isDark
+function useIsDarkTheme() {
+ return React.useSyncExternalStore(
+ subscribeToDarkTheme,
+ readIsDarkTheme,
+ () => false
+ )
}
function useHumanReviewGridTheme() {
@@ -2344,9 +2344,13 @@ export function HumanReviewPanel({
initialExpectedValues
)
- React.useEffect(() => {
+ const [previousExpectedValues, setPreviousExpectedValues] = React.useState(
+ initialExpectedValues
+ )
+ if (!Object.is(previousExpectedValues, initialExpectedValues)) {
+ setPreviousExpectedValues(initialExpectedValues)
setExpected(initialExpectedValues)
- }, [initialExpectedValues])
+ }
const updateValue = React.useCallback((key: string, value: JsonValue) => {
setExpected((current) =>
diff --git a/apps/v4/components/extend/csv-viewer.tsx b/apps/v4/components/extend/csv-viewer.tsx
index 1bb3881..8f63fcb 100644
--- a/apps/v4/components/extend/csv-viewer.tsx
+++ b/apps/v4/components/extend/csv-viewer.tsx
@@ -340,14 +340,12 @@ function CsvSearchPopover({
headers,
rows,
gridRef,
- dataIdentity,
controlsDisabled,
onGridSelectionChange,
}: {
headers: string[]
rows: string[][]
gridRef: React.RefObject<DataEditorRef | null>
- dataIdentity: string
controlsDisabled: boolean
onGridSelectionChange: (selection: GridSelection) => void
}) {
@@ -407,14 +405,7 @@ function CsvSearchPopover({
)
React.useEffect(() => {
- const trimmedDraft = searchDraft.trim()
-
- if (!trimmedDraft) {
- runSearch("")
- return
- }
-
- setIsSearching(true)
+ if (!searchDraft.trim()) return
const timeoutId = window.setTimeout(() => {
runSearch(searchDraft)
}, CSV_SEARCH_DEBOUNCE_MS)
@@ -422,6 +413,16 @@ function CsvSearchPopover({
return () => window.clearTimeout(timeoutId)
}, [runSearch, searchDraft])
+ const handleSearchDraftChange = (nextDraft: string) => {
+ searchRequestIdRef.current += 1
+ setSearchDraft(nextDraft)
+ if (!nextDraft.trim()) {
+ runSearch("")
+ return
+ }
+ setIsSearching(true)
+ }
+
const clearSearch = React.useCallback(() => {
searchRequestIdRef.current += 1
setSearchDraft("")
@@ -448,15 +449,10 @@ function CsvSearchPopover({
)
React.useEffect(() => {
- searchRequestIdRef.current += 1
- setSearchDraft("")
- setSearchQuery("")
- setSearchResults([])
- setActiveResultIndex(0)
- setIsSearching(false)
- appliedResultKeyRef.current = ""
- onGridSelectionChange(emptyGridSelection)
- }, [dataIdentity, onGridSelectionChange])
+ return () => {
+ searchRequestIdRef.current += 1
+ }
+ }, [])
React.useEffect(() => {
if (!activeResult) return
@@ -511,7 +507,7 @@ function CsvSearchPopover({
<Input
placeholder="Search CSV"
value={searchDraft}
- onChange={(event) => setSearchDraft(event.target.value)}
+ onChange={(event) => handleSearchDraftChange(event.target.value)}
onKeyDown={(event) => {
if (event.key !== "Enter") return
@@ -606,28 +602,21 @@ function readIsDarkTheme() {
)
}
-function useIsDarkTheme() {
- const [isDark, setIsDark] = React.useState(readIsDarkTheme)
-
- React.useEffect(() => {
- if (typeof document === "undefined") return
-
- const updateTheme = () => setIsDark(readIsDarkTheme())
-
- updateTheme()
-
- if (typeof MutationObserver === "undefined") return
-
- const observer = new MutationObserver(updateTheme)
- observer.observe(document.documentElement, {
- attributes: true,
- attributeFilter: ["class"],
- })
-
- return () => observer.disconnect()
- }, [])
+function subscribeToDarkTheme(listener: () => void) {
+ const observer = new MutationObserver(listener)
+ observer.observe(document.documentElement, {
+ attributes: true,
+ attributeFilter: ["class"],
+ })
+ return () => observer.disconnect()
+}
- return isDark
+function useIsDarkTheme() {
+ return React.useSyncExternalStore(
+ subscribeToDarkTheme,
+ readIsDarkTheme,
+ () => false
+ )
}
export function CsvViewer({ className, data, search = false }: CsvViewerProps) {
@@ -660,19 +649,29 @@ export function CsvViewer({ className, data, search = false }: CsvViewerProps) {
[]
)
- React.useEffect(() => {
+ const [previousData, setPreviousData] = React.useState(data)
+ if (!Object.is(previousData, data)) {
+ setPreviousData(data)
if (data) {
setParsed(parseDelimitedText(data))
setUploadedFileName(null)
setDataRevision((revision) => revision + 1)
}
- }, [data])
+ }
- React.useEffect(() => {
- if (!search) {
+ const [selectionSource, setSelectionSource] = React.useState({
+ dataRevision,
+ search,
+ })
+ if (
+ selectionSource.dataRevision !== dataRevision ||
+ selectionSource.search !== search
+ ) {
+ setSelectionSource({ dataRevision, search })
+ if (selectionSource.dataRevision !== dataRevision || !search) {
setGridSelection(emptyGridSelection)
}
- }, [search])
+ }
React.useEffect(() => {
let mounted = true
@@ -878,7 +877,7 @@ export function CsvViewer({ className, data, search = false }: CsvViewerProps) {
headers={parsed.headers}
rows={parsed.rows}
gridRef={gridRef}
- dataIdentity={dataIdentity}
+ key={dataIdentity}
controlsDisabled={searchDisabled}
onGridSelectionChange={handleGridSelectionChange}
/>
diff --git a/apps/v4/components/extend/docx-editor.tsx b/apps/v4/components/extend/docx-editor.tsx
index fff1978..bef586c 100644
--- a/apps/v4/components/extend/docx-editor.tsx
+++ b/apps/v4/components/extend/docx-editor.tsx
@@ -486,12 +486,15 @@ function normalizeDocxZoomScale(value: number | undefined): number {
function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
const [showSpinner, setShowSpinner] = React.useState(false)
+ const [previousIsLoading, setPreviousIsLoading] = React.useState(isLoading)
+
+ if (previousIsLoading !== isLoading) {
+ setPreviousIsLoading(isLoading)
+ setShowSpinner(false)
+ }
React.useEffect(() => {
- if (!isLoading) {
- setShowSpinner(false)
- return
- }
+ if (!isLoading) return
const timeoutId = window.setTimeout(() => {
setShowSpinner(true)
@@ -500,7 +503,7 @@ function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
return () => window.clearTimeout(timeoutId)
}, [delayMs, isLoading])
- return showSpinner
+ return isLoading && showSpinner
}
function isDocxPaddingWarning(args: unknown[]) {
@@ -1773,6 +1776,7 @@ export function DocxEditorPreview({
}) {
return (
<DocxEditorContent
+ key={src}
className={className}
defaultZoomScale={defaultZoomScale}
effectiveIsDark={isDark}
@@ -1816,7 +1820,7 @@ function DocxEditorContent({
resolvedDefaultZoomScale
)
const [loadError, setLoadError] = React.useState<string>()
- const [isLoadingDocument, setIsLoadingDocument] = React.useState(true)
+ const [isLoadingDocument, setIsLoadingDocument] = React.useState(Boolean(url))
const [isReadOnly, setIsReadOnly] = React.useState(false)
const [linkEditorOpen, setLinkEditorOpen] = React.useState(false)
const [linkDraft, setLinkDraft] = React.useState("")
@@ -1908,9 +1912,16 @@ function DocxEditorContent({
useSuppressDocxPaddingWarning(!isLoadingDocument && !loadError)
- React.useEffect(() => {
+ const [previousDefaultZoom, setPreviousDefaultZoom] = React.useState(
+ resolvedDefaultZoomScale
+ )
+ if (previousDefaultZoom !== resolvedDefaultZoomScale) {
+ setPreviousDefaultZoom(resolvedDefaultZoomScale)
setZoomScale(resolvedDefaultZoomScale)
setActivePage(1)
+ }
+
+ React.useEffect(() => {
viewportRef.current?.scrollTo({ top: 0, left: 0 })
}, [resolvedDefaultZoomScale, url])
@@ -1918,7 +1929,9 @@ function DocxEditorContent({
setDocumentTheme(effectiveIsDark ? "dark" : "light")
}, [effectiveIsDark, setDocumentTheme])
- React.useEffect(() => {
+ const [previousStatus, setPreviousStatus] = React.useState(status)
+ if (previousStatus !== status) {
+ setPreviousStatus(status)
if (
status.startsWith("Failed to load file") ||
status === "Only .docx files are supported"
@@ -1926,22 +1939,13 @@ function DocxEditorContent({
setLoadError(status)
setIsLoadingDocument(false)
}
- }, [status])
+ }
React.useEffect(() => {
let isCurrent = true
async function load() {
- if (!uploadedDocxFile && !url) {
- setIsLoadingDocument(false)
- setLoadError(undefined)
- setReportedPageCount(0)
- return
- }
-
- setIsLoadingDocument(true)
- setLoadError(undefined)
- setReportedPageCount(0)
+ if (!uploadedDocxFile && !url) return
try {
const docxFile =
@@ -1972,12 +1976,6 @@ function DocxEditorContent({
}
}, [displayFileName, importDocxFile, uploadedDocxFile, url])
- React.useEffect(() => {
- if (url) {
- setUploadedDocxFile(null)
- }
- }, [url])
-
const updateActivePageFromViewport = React.useCallback(() => {
const viewport = viewportRef.current
if (!viewport || !pageCount) return
@@ -2074,6 +2072,8 @@ function DocxEditorContent({
setZoomScale(resolvedDefaultZoomScale)
setActivePage(1)
setReportedPageCount(0)
+ setIsLoadingDocument(true)
+ setLoadError(undefined)
setUploadedDocxFile({
file,
identity: `${file.name}-${file.size}-${file.lastModified}`,
diff --git a/apps/v4/components/extend/docx-viewer.tsx b/apps/v4/components/extend/docx-viewer.tsx
index 4d3d977..5b63dce 100644
--- a/apps/v4/components/extend/docx-viewer.tsx
+++ b/apps/v4/components/extend/docx-viewer.tsx
@@ -229,6 +229,12 @@ function normalizeDocxZoomScale(value: number | undefined): number {
function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
const [showSpinner, setShowSpinner] = React.useState(false)
+ const [previousIsLoading, setPreviousIsLoading] = React.useState(isLoading)
+
+ if (previousIsLoading !== isLoading) {
+ setPreviousIsLoading(isLoading)
+ setShowSpinner(false)
+ }
React.useEffect(() => {
if (!isLoading) return
@@ -237,10 +243,7 @@ function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
setShowSpinner(true)
}, delayMs)
- return () => {
- window.clearTimeout(timeoutId)
- setShowSpinner(false)
- }
+ return () => window.clearTimeout(timeoutId)
}, [delayMs, isLoading])
return isLoading && showSpinner
@@ -478,12 +481,6 @@ function DocxPageNumberControl({
const [isEditing, setIsEditing] = React.useState(false)
const [draftPage, setDraftPage] = React.useState(() => String(displayPage))
- React.useEffect(() => {
- if (!isEditing) {
- setDraftPage(String(displayPage))
- }
- }, [displayPage, isEditing])
-
React.useEffect(() => {
if (!isEditing) return
@@ -1166,7 +1163,7 @@ function DocxViewerContent({
const [uploadedDocxFile, setUploadedDocxFile] =
React.useState<UploadedDocxFile | null>(null)
const [sidebarOpen, setSidebarOpen] = React.useState(false)
- const activePageStore = React.useMemo(createDocxActivePageStore, [])
+ const activePageStore = React.useMemo(() => createDocxActivePageStore(), [])
const resolvedDefaultZoomScale = normalizeDocxZoomScale(defaultZoom)
const activeUploadedDocxFile =
uploadedDocxFile?.sourceUrl === url ? uploadedDocxFile : null
diff --git a/apps/v4/components/extend/file-system.tsx b/apps/v4/components/extend/file-system.tsx
index c5ca43a..70ba720 100644
--- a/apps/v4/components/extend/file-system.tsx
+++ b/apps/v4/components/extend/file-system.tsx
@@ -1312,10 +1312,12 @@ function FileVisual({
fileRef.current = file
})
- React.useEffect(() => {
+ const [previousFilePath, setPreviousFilePath] = React.useState(file.path)
+ if (!Object.is(previousFilePath, file.path)) {
+ setPreviousFilePath(file.path)
setPageIndex(0)
setLazyPageUrls({})
- }, [file.path])
+ }
// Keyed by path (not object identity) so manifest churn doesn't re-request
// the page already being loaded.
diff --git a/apps/v4/components/extend/pdf-block-resizable-shell.tsx b/apps/v4/components/extend/pdf-block-resizable-shell.tsx
index f973826..a62b069 100644
--- a/apps/v4/components/extend/pdf-block-resizable-shell.tsx
+++ b/apps/v4/components/extend/pdf-block-resizable-shell.tsx
@@ -74,14 +74,14 @@ function useElementWidth<T extends HTMLElement>() {
return [setNode, width] as const
}
-function useMounted() {
- const [mounted, setMounted] = React.useState(false)
-
- React.useEffect(() => {
- setMounted(true)
- }, [])
+const subscribeToHydration = () => () => {}
- return mounted
+function useMounted() {
+ return React.useSyncExternalStore(
+ subscribeToHydration,
+ () => true,
+ () => false
+ )
}
function getSavedLayout(key: string) {
diff --git a/apps/v4/components/extend/pdf-editor-dialogs.tsx b/apps/v4/components/extend/pdf-editor-dialogs.tsx
index eb4f4ac..3ff40e5 100644
--- a/apps/v4/components/extend/pdf-editor-dialogs.tsx
+++ b/apps/v4/components/extend/pdf-editor-dialogs.tsx
@@ -160,15 +160,17 @@ export function PdfEditorPrintDialog({
const [isPrinting, setIsPrinting] = React.useState(false)
const [error, setError] = React.useState<string | null>(null)
- React.useEffect(() => {
- if (open) return
-
- setSelection("all")
- setCustomPages("")
- setIncludeAnnotations(true)
- setIsPrinting(false)
- setError(null)
- }, [open])
+ const [previousOpen, setPreviousOpen] = React.useState(open)
+ if (previousOpen !== open) {
+ setPreviousOpen(open)
+ if (!open) {
+ setSelection("all")
+ setCustomPages("")
+ setIncludeAnnotations(true)
+ setIsPrinting(false)
+ setError(null)
+ }
+ }
const canSubmit =
!isPrinting && (selection !== "custom" || customPages.trim().length > 0)
@@ -516,21 +518,23 @@ export function PdfEditorSecurityDialog({
const [isApplying, setIsApplying] = React.useState(false)
const [error, setError] = React.useState<string | null>(null)
- React.useEffect(() => {
- if (!open) return
-
- setUnlockPassword("")
- setIsUnlocking(false)
- setRequireOpenPassword(false)
- setOpenPassword("")
- setConfirmOpenPassword("")
- setRestrictPermissions(false)
- setOwnerPassword("")
- setConfirmOwnerPassword("")
- setAllowedFlags(new Set(PERMISSION_OPTIONS.map((option) => option.flag)))
- setIsApplying(false)
- setError(null)
- }, [open])
+ const [previousOpen, setPreviousOpen] = React.useState(open)
+ if (previousOpen !== open) {
+ setPreviousOpen(open)
+ if (open) {
+ setUnlockPassword("")
+ setIsUnlocking(false)
+ setRequireOpenPassword(false)
+ setOpenPassword("")
+ setConfirmOpenPassword("")
+ setRestrictPermissions(false)
+ setOwnerPassword("")
+ setConfirmOwnerPassword("")
+ setAllowedFlags(new Set(PERMISSION_OPTIONS.map((option) => option.flag)))
+ setIsApplying(false)
+ setError(null)
+ }
+ }
const openPasswordValid =
!requireOpenPassword ||
@@ -887,16 +891,31 @@ export function PdfEditorPropertiesDialog({
creationDate: Date | null
modificationDate: Date | null
}>({ creationDate: null, modificationDate: null })
- const [isLoading, setIsLoading] = React.useState(false)
+ const [isLoading, setIsLoading] = React.useState(
+ Boolean(open && registry && document)
+ )
const [isSaving, setIsSaving] = React.useState(false)
const [error, setError] = React.useState<string | null>(null)
+ const [metadataRequest, setMetadataRequest] = React.useState({
+ document,
+ open,
+ registry,
+ })
+ if (
+ metadataRequest.document !== document ||
+ metadataRequest.open !== open ||
+ metadataRequest.registry !== registry
+ ) {
+ setMetadataRequest({ document, open, registry })
+ setIsLoading(Boolean(open && registry && document))
+ setError(null)
+ }
+
React.useEffect(() => {
if (!open || !registry || !document) return
let cancelled = false
- setIsLoading(true)
- setError(null)
registry
.getEngine()
@@ -1278,16 +1297,18 @@ export function PdfEditorSignatureDialog({
setInitials(null)
}, [clearInitialsUpload, clearSignatureUpload])
- React.useEffect(() => {
- if (open) return
-
- setTab("draw")
- setColor(SIGNATURE_COLORS[0].value)
- setFontFamily(PDF_EDITOR_SIGNATURE_FONTS[0].family)
- setActiveTarget("signature")
- setSignature(null)
- setInitials(null)
- }, [open])
+ const [previousOpen, setPreviousOpen] = React.useState(open)
+ if (previousOpen !== open) {
+ setPreviousOpen(open)
+ if (!open) {
+ setTab("draw")
+ setColor(SIGNATURE_COLORS[0].value)
+ setFontFamily(PDF_EDITOR_SIGNATURE_FONTS[0].family)
+ setActiveTarget("signature")
+ setSignature(null)
+ setInitials(null)
+ }
+ }
const handleTabChange = (nextTab: SignatureCreationTab) => {
clearAll()
@@ -1566,26 +1587,31 @@ export function PdfEditorLinkDialog({
[documentId, selectionCapability]
)
- React.useEffect(() => {
- if (!open) return
-
- const selected =
- source === "annotation" ? annotationScope?.getSelectedAnnotation() : null
-
- if (selected && selected.object.type === PdfAnnotationSubtype.LINK) {
- const existing = readLinkTarget(
- (selected.object as PdfLinkAnnoObject).target
- )
+ const [linkRequest, setLinkRequest] = React.useState({
+ annotationScope,
+ open: false,
+ source,
+ })
+ if (
+ linkRequest.annotationScope !== annotationScope ||
+ linkRequest.open !== open ||
+ linkRequest.source !== source
+ ) {
+ setLinkRequest({ annotationScope, open, source })
+ if (open) {
+ const selected =
+ source === "annotation"
+ ? annotationScope?.getSelectedAnnotation()
+ : null
+ const existing =
+ selected?.object.type === PdfAnnotationSubtype.LINK
+ ? readLinkTarget((selected.object as PdfLinkAnnoObject).target)
+ : { tab: "url" as const, url: "", pageNumber: 1 }
setTab(existing.tab)
setUrl(existing.url)
setPageNumber(existing.pageNumber ?? 1)
- return
}
-
- setTab("url")
- setUrl("")
- setPageNumber(1)
- }, [annotationScope, open, source])
+ }
const buildTarget = (): PdfLinkTarget | null => {
if (tab === "url") {
diff --git a/apps/v4/components/extend/pdf-editor-panels.tsx b/apps/v4/components/extend/pdf-editor-panels.tsx
index 7453bb3..30132b6 100644
--- a/apps/v4/components/extend/pdf-editor-panels.tsx
+++ b/apps/v4/components/extend/pdf-editor-panels.tsx
@@ -112,6 +112,35 @@ import {
const THUMBNAIL_FOCUS_RING_CLASS =
"group-focus-visible/pdf-editor-thumbnails:ring-2 group-focus-visible/pdf-editor-thumbnails:ring-ring group-focus-visible/pdf-editor-thumbnails:ring-offset-1 group-focus-visible/pdf-editor-thumbnails:ring-offset-background"
+function createFormFieldStore(
+ scope: {
+ getFormFields: () => FormFieldInfo[]
+ onFormReady: (listener: (fields: FormFieldInfo[]) => void) => () => void
+ onFieldValueChange: (listener: () => void) => () => void
+ } | null
+) {
+ let fields: FormFieldInfo[] = scope?.getFormFields() ?? []
+ return {
+ getSnapshot: () => fields,
+ subscribe: (listener: () => void) => {
+ if (!scope) return () => {}
+ const update = (next: FormFieldInfo[]) => {
+ fields = next
+ listener()
+ }
+ const unsubscribeReady = scope.onFormReady(update)
+ const unsubscribeChange = scope.onFieldValueChange(() =>
+ update(scope.getFormFields())
+ )
+ update(scope.getFormFields())
+ return () => {
+ unsubscribeReady()
+ unsubscribeChange()
+ }
+ },
+ }
+}
+
export function PdfEditorThumbnailsPanel({
documentId,
activePage,
@@ -235,6 +264,7 @@ export function PdfEditorThumbnailsPanel({
aria-selected={isActive}
aria-current={isActive ? "page" : undefined}
aria-label={`Page ${pageNumber}`}
+ style={{ maxWidth: meta.width + imagePadding * 2 + 16 }}
className={cn(
"flex h-full w-full cursor-default flex-col items-center justify-between rounded-md px-2 text-xs transition-shadow outline-none select-none hover:bg-sidebar-accent",
isActive
@@ -1016,7 +1046,10 @@ export function PdfEditorPagesPanel({
className="min-h-0 flex-1"
viewportClassName="px-2.5 py-3"
>
- <div className="grid grid-cols-2 gap-2">
+ <div
+ data-slot="pdf-editor-pages-grid"
+ className="grid grid-cols-[repeat(auto-fill,minmax(5.5rem,1fr))] items-start gap-2"
+ >
{metas.map((meta) => {
const pageNumber = meta.pageIndex + 1
const isSelected = selected.has(meta.pageIndex)
@@ -1030,7 +1063,7 @@ export function PdfEditorPagesPanel({
className={cn(
"group flex min-w-0 flex-col items-center gap-1.5 rounded-lg border p-1.5 text-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
isSelected
- ? "border-primary bg-primary/5 ring-1 ring-primary/20"
+ ? "border-primary bg-primary/5"
: "border-transparent hover:bg-sidebar-accent",
isActive && !isSelected && "border-border"
)}
@@ -1046,23 +1079,15 @@ export function PdfEditorPagesPanel({
}}
onDoubleClick={() => scrollToPage(pageNumber)}
>
- <span
- className={cn(
- "grid place-items-center rounded-md border p-1 transition-colors",
- isSelected
- ? "border-primary/40 bg-primary/5"
- : "border-border/60 bg-muted/30"
- )}
- >
+ <span className="grid w-full place-items-center rounded-md border border-border/60 bg-muted/30 p-1">
<span
- className="grid place-items-center overflow-hidden rounded-sm bg-white shadow-xs"
- style={{ width: meta.width, height: meta.height }}
+ className="grid w-full place-items-center overflow-hidden rounded-sm bg-white shadow-xs"
+ style={{ aspectRatio: `${meta.width} / ${meta.height}` }}
>
<ThumbImg
documentId={documentId}
meta={meta}
- className="block object-contain"
- style={{ width: meta.width, height: meta.height }}
+ className="block size-full object-contain"
/>
</span>
</span>
@@ -1673,14 +1698,12 @@ export function PdfEditorStampsPanel({ documentId }: { documentId: string }) {
})),
]
- React.useEffect(() => {
- if (
- libraryId !== "all" &&
- !libraries.some((library) => library.id === libraryId)
- ) {
- setLibraryId("all")
- }
- }, [libraries, libraryId])
+ if (
+ libraryId !== "all" &&
+ !libraries.some((library) => library.id === libraryId)
+ ) {
+ setLibraryId("all")
+ }
const placeStamp = (targetLibraryId: string, stamp: StampDefinition) => {
if (!stampCapability) return
@@ -2097,26 +2120,15 @@ export function PdfEditorFormsPanel({ documentId }: { documentId: string }) {
() => form?.forDocument(documentId) ?? null,
[documentId, form]
)
- const [fields, setFields] = React.useState<FormFieldInfo[]>([])
+ const fieldStore = React.useMemo(() => createFormFieldStore(scope), [scope])
+ const fields = React.useSyncExternalStore(
+ fieldStore.subscribe,
+ fieldStore.getSnapshot,
+ fieldStore.getSnapshot
+ )
const importInputRef = React.useRef<HTMLInputElement>(null)
const designModeId = React.useId()
- React.useEffect(() => {
- if (!scope) return
-
- setFields(scope.getFormFields())
-
- const unsubscribeReady = scope.onFormReady((list) => setFields(list))
- const unsubscribeChange = scope.onFieldValueChange(() =>
- setFields(scope.getFormFields())
- )
-
- return () => {
- unsubscribeReady()
- unsubscribeChange()
- }
- }, [scope])
-
const widgetsByName = React.useMemo(() => {
const map = new Map<string, PdfWidgetAnnoObject>()
diff --git a/apps/v4/components/extend/pdf-editor-properties.tsx b/apps/v4/components/extend/pdf-editor-properties.tsx
index b8c6882..c155b28 100644
--- a/apps/v4/components/extend/pdf-editor-properties.tsx
+++ b/apps/v4/components/extend/pdf-editor-properties.tsx
@@ -364,9 +364,11 @@ function useDebouncedCommit<T>(
onCommitRef.current = onCommit
})
- React.useEffect(() => {
+ const [previousValue, setPreviousValue] = React.useState(value)
+ if (!Object.is(previousValue, value)) {
+ setPreviousValue(value)
setDraft(value)
- }, [value])
+ }
React.useEffect(
() => () => {
@@ -1381,10 +1383,18 @@ function WidgetProperties({
const field = widget.field
const fieldLabel = getFormFieldTypeLabel(field.type)
- React.useEffect(() => {
+ const [previousField, setPreviousField] = React.useState({
+ id: widget.id,
+ name: widget.field.name,
+ })
+ if (
+ previousField.id !== widget.id ||
+ previousField.name !== widget.field.name
+ ) {
+ setPreviousField({ id: widget.id, name: widget.field.name })
setNameDraft(widget.field.name)
setNameError(null)
- }, [widget.field.name, widget.id])
+ }
const updateField = React.useCallback(
(patch: Partial<PdfWidgetAnnoField>) => {
@@ -1955,9 +1965,11 @@ function NoteEditor({
}) {
const [draft, setDraft] = React.useState(value)
- React.useEffect(() => {
+ const [previousValue, setPreviousValue] = React.useState(value)
+ if (!Object.is(previousValue, value)) {
+ setPreviousValue(value)
setDraft(value)
- }, [value])
+ }
return (
<textarea
diff --git a/apps/v4/components/extend/pdf-editor-workspace.tsx b/apps/v4/components/extend/pdf-editor-workspace.tsx
new file mode 100644
index 0000000..a8850df
--- /dev/null
+++ b/apps/v4/components/extend/pdf-editor-workspace.tsx
@@ -0,0 +1,115 @@
+"use client"
+
+import * as React from "react"
+
+import { cn } from "@/lib/utils"
+import {
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+} from "@/components/ui/resizable"
+
+function PanelBorder({ side }: { side: "left" | "right" }) {
+ return (
+ <ResizableHandle
+ aria-label={`Resize ${side} panel`}
+ className={cn(
+ "pointer-events-auto z-40 w-px bg-border before:absolute before:inset-y-2 before:w-px before:bg-primary/50 before:[mask-image:linear-gradient(to_bottom,transparent,black_8%,black_92%,transparent)] before:opacity-0 before:transition-opacity before:duration-200 before:ease-in-out hover:before:opacity-100 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:before:opacity-100 data-[separator=active]:before:opacity-100 data-[separator=hover]:before:opacity-100 motion-reduce:before:transition-none",
+ side === "left" ? "before:-left-px" : "before:left-full"
+ )}
+ />
+ )
+}
+
+export function PdfEditorWorkspace({
+ children,
+ left,
+ right,
+ leftInline,
+ rightInline,
+}: {
+ children: React.ReactNode
+ left: React.ReactNode
+ right: React.ReactNode
+ leftInline: boolean
+ rightInline: boolean
+}) {
+ const id = React.useId()
+ const [leftSize, setLeftSize] = React.useState<string | number>("14rem")
+ const [rightSize, setRightSize] = React.useState<string | number>("21rem")
+ const leftElement = React.useRef<HTMLDivElement>(null)
+ const rightElement = React.useRef<HTMLDivElement>(null)
+ const leftId = `${id}-left`
+ const rightId = `${id}-right`
+ const rememberSizes = () => {
+ if (leftElement.current)
+ setLeftSize(leftElement.current.getBoundingClientRect().width)
+ if (rightElement.current)
+ setRightSize(rightElement.current.getBoundingClientRect().width)
+ }
+ const sidebar = (side: "left" | "right", content: React.ReactNode) => (
+ <ResizablePanel
+ id={side === "left" ? leftId : rightId}
+ defaultSize={side === "left" ? leftSize : rightSize}
+ minSize={side === "left" ? "14rem" : "21rem"}
+ maxSize={side === "left" ? "28rem" : "32rem"}
+ groupResizeBehavior="preserve-pixel-size"
+ elementRef={side === "left" ? leftElement : rightElement}
+ className="pointer-events-auto h-full min-h-0 overflow-hidden bg-sidebar"
+ >
+ <aside
+ data-slot={`pdf-editor-${side}-panel`}
+ className="flex h-full min-h-0 flex-col"
+ >
+ {content}
+ </aside>
+ </ResizablePanel>
+ )
+
+ return (
+ <div className="relative h-full min-h-0 w-full flex-1 overflow-hidden">
+ <ResizablePanelGroup
+ orientation="horizontal"
+ onLayoutChanged={rememberSizes}
+ >
+ {left && leftInline ? sidebar("left", left) : null}
+ {left && leftInline ? <PanelBorder side="left" /> : null}
+ <ResizablePanel
+ id={`${id}-document`}
+ minSize={leftInline || rightInline ? "15rem" : "0%"}
+ className="relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden"
+ >
+ {children}
+ </ResizablePanel>
+ {right && rightInline ? <PanelBorder side="right" /> : null}
+ {right && rightInline ? sidebar("right", right) : null}
+ </ResizablePanelGroup>
+ {(["left", "right"] as const).map((side) => {
+ const content = side === "left" ? left : right
+ const inline = side === "left" ? leftInline : rightInline
+ if (!content || inline) return null
+ return (
+ <ResizablePanelGroup
+ key={side}
+ orientation="horizontal"
+ onLayoutChanged={rememberSizes}
+ className={cn(
+ "pointer-events-none absolute inset-y-0 z-30",
+ side === "left" ? "left-0 min-w-60" : "right-0 min-w-88"
+ )}
+ >
+ {side === "right" ? (
+ <ResizablePanel id={`${id}-right-space`} minSize="1rem" />
+ ) : null}
+ {side === "right" ? <PanelBorder side="right" /> : null}
+ {sidebar(side, content)}
+ {side === "left" ? <PanelBorder side="left" /> : null}
+ {side === "left" ? (
+ <ResizablePanel id={`${id}-left-space`} minSize="1rem" />
+ ) : null}
+ </ResizablePanelGroup>
+ )
+ })}
+ </div>
+ )
+}
diff --git a/apps/v4/components/extend/pdf-editor.tsx b/apps/v4/components/extend/pdf-editor.tsx
index 2910365..cbe7393 100644
--- a/apps/v4/components/extend/pdf-editor.tsx
+++ b/apps/v4/components/extend/pdf-editor.tsx
@@ -4,6 +4,7 @@ import * as React from "react"
import { createPluginRegistration } from "@embedpdf/core"
import {
EmbedPDF,
+ PDFContext,
useDocumentPermissions,
useRegistry,
} from "@embedpdf/core/react"
@@ -161,8 +162,6 @@ import { Spinner } from "@/components/ui/spinner"
import { ToastPrimitive, ToastProvider } from "@/components/ui/toast"
import { TooltipProvider } from "@/components/ui/tooltip"
import {
- DocumentViewerSidebarSkeleton,
- DocumentViewerThumbnailSidebar,
useElementWidth,
useInlineThumbnailSidebar,
} from "@/components/extend/document-viewer-sidebar"
@@ -279,6 +278,7 @@ import {
type PdfEditorSelectionPage,
type PdfEditorSelectionPayload,
} from "@/components/extend/pdf-editor-shared"
+import { PdfEditorWorkspace } from "@/components/extend/pdf-editor-workspace"
export type {
PdfEditorFeatureFlags,
@@ -390,9 +390,6 @@ const THUMBNAIL_WIDTH = THUMBNAIL_PAGE_WIDTH + THUMBNAIL_IMAGE_PADDING * 2
const THUMBNAIL_LABEL_HEIGHT = 24
const THUMBNAIL_GAP = 12
const THUMBNAIL_PANE_PADDING_Y = 16
-const LEFT_SIDEBAR_WIDTH_CLASS = "w-56"
-const LEFT_SIDEBAR_CLOSED_CLASS = "-ml-56"
-const RIGHT_PANEL_WIDTH_CLASS = "w-84"
const RIGHT_PANEL_INLINE_MIN_WIDTH = 1100
const TOOLBAR_STACK_MAX_WIDTH = 640
const ZOOM_PRESETS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4]
@@ -487,93 +484,72 @@ function useEditorSource(
src: PDFEditorProps["src"],
fileName: string | undefined
) {
- const [state, setState] = React.useState<{
- src: PDFEditorProps["src"]
- source: EditorSource | null
- loading: boolean
- }>({ src: undefined, source: null, loading: false })
-
- React.useEffect(() => {
- if (src === undefined || src === null) {
- setState({ src, source: null, loading: false })
- return
- }
-
- if (typeof src === "string") {
- setState({
- src,
- source: {
- key: nextSourceKey(),
- kind: "url",
- url: src,
- name: getPdfFileName(fileName, src),
- },
- loading: false,
- })
- return
- }
-
- if (src instanceof ArrayBuffer) {
- setState({
- src,
- source: {
- key: nextSourceKey(),
- kind: "buffer",
- buffer: src.slice(0),
- name: getPdfFileName(fileName),
- },
- loading: false,
- })
- return
+ const sourceId = React.useId()
+ const [input, setInput] = React.useState({ src, fileName, version: 0 })
+ if (input.src !== src || input.fileName !== fileName) {
+ setInput({ src, fileName, version: input.version + 1 })
+ }
+ const immediateSource = React.useMemo<EditorSource | null>(() => {
+ const key = `${sourceId}-${input.version}`
+ if (typeof input.src === "string") {
+ return {
+ key,
+ kind: "url",
+ url: input.src,
+ name: getPdfFileName(input.fileName, input.src),
+ }
}
-
- if (src instanceof Uint8Array) {
- setState({
- src,
- source: {
- key: nextSourceKey(),
- kind: "buffer",
- buffer: bytesToArrayBuffer(src),
- name: getPdfFileName(fileName),
- },
- loading: false,
- })
- return
+ if (input.src instanceof ArrayBuffer || input.src instanceof Uint8Array) {
+ return {
+ key,
+ kind: "buffer",
+ buffer:
+ input.src instanceof ArrayBuffer
+ ? input.src.slice(0)
+ : bytesToArrayBuffer(input.src),
+ name: getPdfFileName(input.fileName),
+ }
}
+ return null
+ }, [input, sourceId])
+ const [resolved, setResolved] = React.useState<{
+ input: typeof input
+ source: EditorSource
+ } | null>(null)
+ React.useEffect(() => {
+ if (!(input.src instanceof Blob)) return
let cancelled = false
- const blobName = fileName ?? (src instanceof File ? src.name : undefined)
-
- setState({ src, source: null, loading: true })
- src.arrayBuffer().then((buffer) => {
+ const blobName =
+ input.fileName ?? (input.src instanceof File ? input.src.name : undefined)
+ input.src.arrayBuffer().then((buffer) => {
if (cancelled) return
-
- setState({
- src,
+ setResolved({
+ input,
source: {
key: nextSourceKey(),
kind: "buffer",
buffer,
name: getPdfFileName(blobName),
},
- loading: false,
})
})
-
return () => {
cancelled = true
}
- }, [fileName, src])
-
- const replace = React.useCallback((buffer: ArrayBuffer, name: string) => {
- setState((previous) => ({
- ...previous,
- source: { key: nextSourceKey(), kind: "buffer", buffer, name },
- loading: false,
- }))
- }, [])
+ }, [input])
- return { source: state.source, loading: state.loading, replace }
+ const replace = React.useCallback(
+ (buffer: ArrayBuffer, name: string) => {
+ setResolved({
+ input,
+ source: { key: nextSourceKey(), kind: "buffer", buffer, name },
+ })
+ },
+ [input]
+ )
+ const source = resolved?.input === input ? resolved.source : immediateSource
+ return { source, loading: input.src instanceof Blob && !source, replace }
}
/* -------------------------------------------------------------------------- */
@@ -1756,12 +1732,14 @@ function PanelTabStrip<T extends string>({
onChange,
onClose,
label,
+ disabled = false,
}: {
tabs: Array<{ id: T; label: string; glyph: PdfEditorGlyph }>
value: T | null
onChange: (value: T) => void
onClose: () => void
label: string
+ disabled?: boolean
}) {
return (
<div className="flex shrink-0 items-center justify-between gap-1 border-b px-1.5 py-1">
@@ -1781,6 +1759,7 @@ function PanelTabStrip<T extends string>({
active={value === tab.id}
role="tab"
aria-selected={value === tab.id}
+ disabled={disabled}
onClick={() => onChange(tab.id)}
>
<Glyph className="size-4" />
@@ -1791,6 +1770,7 @@ function PanelTabStrip<T extends string>({
<PdfEditorToolButton
label="Close panel"
size="icon-xs"
+ disabled={disabled}
onClick={onClose}
>
<CloseGlyph className="size-3.5" />
@@ -1800,35 +1780,6 @@ function PanelTabStrip<T extends string>({
)
}
-function PdfEditorRightPanelShell({
- open,
- inline,
- children,
-}: {
- open: boolean
- inline: boolean
- children: React.ReactNode
-}) {
- return (
- <aside
- data-slot="pdf-editor-right-panel"
- data-panel-open={open ? "true" : "false"}
- className={cn(
- "absolute inset-y-0 right-0 z-30 flex shrink-0 flex-col overflow-hidden border-l bg-sidebar shadow-lg transition-[translate,margin-right] duration-200 ease-out",
- RIGHT_PANEL_WIDTH_CLASS,
- inline && "relative z-auto translate-x-0 shadow-none",
- open
- ? "mr-0 translate-x-0"
- : inline
- ? "-mr-84 border-l-0"
- : "pointer-events-none translate-x-full border-l-0"
- )}
- >
- {children}
- </aside>
- )
-}
-
/* -------------------------------------------------------------------------- */
/* Signature persistence + engine warm-up utilities */
/* -------------------------------------------------------------------------- */
@@ -1872,45 +1823,32 @@ function PdfEditorSignaturePersistence({
/* Fallback shell (engine loading, document loading, errors, empty) */
/* -------------------------------------------------------------------------- */
-function PdfEditorFallbackShell({
- className,
- fileName,
- showToolbar,
- showUpload,
+function PdfEditorDocumentStatus({
state,
- errorMessage = "The PDF could not be loaded.",
+ errorMessage,
onUploadFile,
- children,
}: {
- className?: string
- fileName?: string
- showToolbar: boolean
- showUpload: boolean
- state: "loading" | "error" | "empty" | "password"
+ state: "loading" | "error" | "empty"
errorMessage?: string
onUploadFile?: (file: File) => void
- children?: React.ReactNode
}) {
const inputRef = React.useRef<HTMLInputElement>(null)
-
return (
<div
- data-slot="pdf-editor"
+ data-slot="pdf-editor-document-status"
data-state={state}
- className={cn(
- "flex h-full max-h-full min-h-0 w-full flex-col overflow-hidden bg-background",
- className
- )}
+ className="grid min-h-0 flex-1 place-items-center p-6 text-center text-sm text-muted-foreground"
>
- {showToolbar ? (
- <div className="flex min-h-12 items-center justify-between gap-2 border-b px-3 py-2">
- <div className="flex min-w-0 items-center gap-2 text-sm">
- <FileTextGlyph className="size-4 shrink-0 text-muted-foreground" />
- <span className="truncate text-muted-foreground">
- {fileName ?? "PDF editor"}
- </span>
+ {state === "loading" ? (
+ <Spinner className="size-4" />
+ ) : (
+ <div className="flex max-w-sm flex-col items-center gap-3">
+ <div role={state === "error" ? "alert" : undefined}>
+ {state === "error"
+ ? (errorMessage ?? "The PDF could not be loaded.")
+ : "Open a PDF to start editing"}
</div>
- {showUpload && onUploadFile ? (
+ {onUploadFile ? (
<>
<input
ref={inputRef}
@@ -1936,36 +1874,22 @@ function PdfEditorFallbackShell({
</>
) : null}
</div>
- ) : null}
- <div className="relative flex min-h-0 flex-1 overflow-hidden bg-muted/30">
- {children ? (
- children
- ) : state === "loading" ? (
- <div className="grid flex-1 place-items-center">
- <Spinner className="size-4" />
- </div>
- ) : state === "error" ? (
- <div className="grid flex-1 place-items-center p-6 text-center text-sm text-muted-foreground">
- {errorMessage}
- </div>
- ) : (
- <div className="grid flex-1 place-items-center p-6 text-center text-sm text-muted-foreground">
- <div className="max-w-sm space-y-3">
- <div className="font-medium text-foreground">
- Open a PDF to start editing
- </div>
- <div>
- Pass a URL or file with the <code>src</code> prop, or use the
- upload control.
- </div>
- </div>
- </div>
- )}
- </div>
+ )}
</div>
)
}
+const EMPTY_EDITOR_CONTEXT: React.ContextType<typeof PDFContext> = {
+ registry: null,
+ coreState: null,
+ isInitializing: true,
+ pluginsReady: false,
+ activeDocumentId: null,
+ activeDocument: null,
+ documents: {},
+ documentStates: [],
+}
+
/* -------------------------------------------------------------------------- */
/* Editor (per loaded document) */
/* -------------------------------------------------------------------------- */
@@ -1975,6 +1899,8 @@ type EditorHandleImpl = PDFEditorHandle
type PdfEditorInnerProps = {
documentId: string
document: PdfDocumentObject | null
+ documentState: "loading" | "ready" | "empty" | "error" | "password"
+ unavailableContent?: React.ReactNode
fileName: string
className?: string
defaultZoom: PDFEditorZoomLevel
@@ -2069,6 +1995,8 @@ const RIGHT_PANEL_TABS: Array<{
function PdfEditorInner({
documentId,
document: pdfDocument,
+ documentState,
+ unavailableContent,
fileName,
className,
defaultZoom,
@@ -2151,7 +2079,6 @@ function PdfEditorInner({
const activePage = scrollState.currentPage
const numPages = pdfDocument?.pageCount ?? 0
- const isLoading = !pdfDocument
const controlsDisabled = !numPages
const currentZoom = zoomState.currentZoomLevel
const selectedAnnotations = React.useMemo(
@@ -2310,8 +2237,8 @@ function PdfEditorInner({
/* ---- callbacks: page, annotations, forms, redactions ------------------ */
React.useEffect(() => {
- if (activePage > 0) onActivePageChange?.(activePage)
- }, [activePage, onActivePageChange])
+ if (!controlsDisabled && activePage > 0) onActivePageChange?.(activePage)
+ }, [activePage, controlsDisabled, onActivePageChange])
const onAnnotationEventRef = React.useRef(onAnnotationEvent)
const onAnnotationsChangeRef = React.useRef(onAnnotationsChange)
@@ -2574,6 +2501,7 @@ function PdfEditorInner({
/* ---- imperative handle ------------------------------------------------ */
React.useEffect(() => {
+ if (controlsDisabled) return
handleRef.current = {
getDocumentBuffer,
download: downloadDocument,
@@ -2608,6 +2536,7 @@ function PdfEditorInner({
}
}, [
annotation,
+ controlsDisabled,
downloadDocument,
formScope,
getDocumentBuffer,
@@ -2623,6 +2552,7 @@ function PdfEditorInner({
const handleKeyDown = React.useCallback(
(event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (controlsDisabled) return
const key = event.key
const mod = event.metaKey || event.ctrlKey
@@ -2723,6 +2653,7 @@ function PdfEditorInner({
activePage,
annotation,
annotationState.pages,
+ controlsDisabled,
deactivateTools,
deleteSelectedAnnotations,
downloadDocument,
@@ -3416,6 +3347,8 @@ function PdfEditorInner({
<div
data-slot="pdf-editor"
data-mode={mode}
+ data-state={documentState}
+ aria-busy={documentState === "loading"}
data-fullscreen={fullscreenState.isFullscreen ? "" : undefined}
className={cn(
"flex h-full max-h-full min-h-0 w-full flex-col overflow-hidden bg-background",
@@ -3460,303 +3393,317 @@ function PdfEditorInner({
{showToolbar ? (
<TooltipProvider delay={TOOLTIP_DELAY_MS}>
- <div
- data-slot="pdf-editor-toolbar"
- className={cn(
- "flex min-h-12 flex-wrap items-center justify-between gap-2 border-b bg-background px-3 py-2",
- compactToolbar && "gap-0 px-0 py-0"
- )}
- >
+ <fieldset disabled={controlsDisabled} className="contents">
<div
+ data-slot="pdf-editor-toolbar"
className={cn(
- "flex min-w-0 items-center gap-2",
- compactToolbar && "w-full px-3 py-2"
- )}
- >
- <PdfEditorToolButton
- label="Pages sidebar"
- active={leftPanel !== null}
- disabled={controlsDisabled}
- onClick={() => toggleLeftPanel("thumbnails")}
- >
- <PanelLeftGlyph className="size-4" />
- </PdfEditorToolButton>
- <PdfEditorPageControl
- activePage={activePage}
- numPages={numPages}
- disabled={controlsDisabled}
- onPageChange={(pageNumber) => scrollToPage(pageNumber)}
- />
- </div>
- <ScrollArea
- orientation="horizontal"
- scrollFade
- scrollbarOverflowOnly
- className={cn(
- "min-w-0 flex-1",
- compactToolbar && "h-12 w-full flex-none border-t"
+ "flex min-h-12 flex-wrap items-center justify-between gap-2 border-b bg-background px-3 py-2",
+ compactToolbar && "gap-0 px-0 py-0"
)}
- viewportClassName={cn(compactToolbar && "px-3 py-2")}
>
<div
className={cn(
- "flex w-max min-w-full items-center gap-1",
- compactToolbar ? "justify-start" : "justify-end"
+ "flex min-w-0 items-center gap-2",
+ compactToolbar && "w-full px-3 py-2"
)}
>
- <div className="flex items-center gap-0.5">
- <PdfEditorToolButton
- label="Undo"
- shortcut="mod+Z"
- disabled={!historyState.canUndo}
- onClick={() => historyScope?.undo()}
- >
- <UndoGlyph className="size-4" />
- </PdfEditorToolButton>
- <PdfEditorToolButton
- label="Redo"
- shortcut="mod+shift+Z"
- disabled={!historyState.canRedo}
- onClick={() => historyScope?.redo()}
- >
- <RedoGlyph className="size-4" />
- </PdfEditorToolButton>
- </div>
- <PdfEditorToolbarSeparator />
- <PdfEditorZoomControl
- documentId={documentId}
- disabled={controlsDisabled}
- />
- <PdfEditorToolbarSeparator />
- <div className="flex items-center gap-0.5">
- <PdfEditorToolButton
- label="Rotate counterclockwise"
- disabled={controlsDisabled}
- onClick={() => rotate?.rotateBackward()}
- >
- <RotateGlyph className="size-4 -scale-x-100" />
- </PdfEditorToolButton>
- <PdfEditorToolButton
- label="Rotate clockwise"
- disabled={controlsDisabled}
- onClick={() => rotate?.rotateForward()}
- >
- <RotateGlyph className="size-4" />
- </PdfEditorToolButton>
- </div>
- <PdfEditorToolbarSeparator />
- <PdfEditorSearchControl
- documentId={documentId}
- disabled={controlsDisabled}
- open={searchOpen}
- onOpenChange={setSearchOpen}
- />
<PdfEditorToolButton
- label="Details panel"
- active={rightPanel !== null}
+ label="Pages sidebar"
+ active={leftPanel !== null}
disabled={controlsDisabled}
- onClick={() => toggleRightPanel("properties")}
+ onClick={() => toggleLeftPanel("thumbnails")}
>
- <PanelRightGlyph className="size-4" />
+ <PanelLeftGlyph className="size-4" />
</PdfEditorToolButton>
- {toolbarActions ? (
- <>
- <PdfEditorToolbarSeparator />
- {toolbarActions}
- </>
- ) : null}
- <PdfEditorToolbarSeparator />
- {showDownload ? (
+ <PdfEditorPageControl
+ activePage={activePage}
+ numPages={numPages}
+ disabled={controlsDisabled}
+ onPageChange={(pageNumber) => scrollToPage(pageNumber)}
+ />
+ </div>
+ <ScrollArea
+ orientation="horizontal"
+ scrollFade
+ scrollbarOverflowOnly
+ className={cn(
+ "min-w-0 flex-1",
+ compactToolbar && "h-12 w-full flex-none border-t"
+ )}
+ viewportClassName={cn(compactToolbar && "px-3 py-2")}
+ >
+ <div
+ className={cn(
+ "flex w-max min-w-full items-center gap-1",
+ compactToolbar ? "justify-start" : "justify-end"
+ )}
+ >
+ <div className="flex items-center gap-0.5">
+ <PdfEditorToolButton
+ label="Undo"
+ shortcut="mod+Z"
+ disabled={!historyState.canUndo}
+ onClick={() => historyScope?.undo()}
+ >
+ <UndoGlyph className="size-4" />
+ </PdfEditorToolButton>
+ <PdfEditorToolButton
+ label="Redo"
+ shortcut="mod+shift+Z"
+ disabled={!historyState.canRedo}
+ onClick={() => historyScope?.redo()}
+ >
+ <RedoGlyph className="size-4" />
+ </PdfEditorToolButton>
+ </div>
+ <PdfEditorToolbarSeparator />
+ <PdfEditorZoomControl
+ documentId={documentId}
+ disabled={controlsDisabled}
+ />
+ <PdfEditorToolbarSeparator />
+ <div className="flex items-center gap-0.5">
+ <PdfEditorToolButton
+ label="Rotate counterclockwise"
+ disabled={controlsDisabled}
+ onClick={() => rotate?.rotateBackward()}
+ >
+ <RotateGlyph className="size-4 -scale-x-100" />
+ </PdfEditorToolButton>
+ <PdfEditorToolButton
+ label="Rotate clockwise"
+ disabled={controlsDisabled}
+ onClick={() => rotate?.rotateForward()}
+ >
+ <RotateGlyph className="size-4" />
+ </PdfEditorToolButton>
+ </div>
+ <PdfEditorToolbarSeparator />
+ <PdfEditorSearchControl
+ documentId={documentId}
+ disabled={controlsDisabled}
+ open={searchOpen}
+ onOpenChange={setSearchOpen}
+ />
<PdfEditorToolButton
- label="Download"
- shortcut="mod+S"
- disabled={controlsDisabled || isDownloading}
- onClick={() => void downloadDocument()}
+ label="Details panel"
+ active={rightPanel !== null}
+ disabled={controlsDisabled}
+ onClick={() => toggleRightPanel("properties")}
>
- {isDownloading ? (
- <Spinner className="size-4" />
- ) : (
- <DownloadGlyph className="size-4" />
- )}
+ <PanelRightGlyph className="size-4" />
</PdfEditorToolButton>
- ) : null}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- aria-label="More actions"
+ {toolbarActions ? (
+ <>
+ <PdfEditorToolbarSeparator />
+ {toolbarActions}
+ </>
+ ) : null}
+ <PdfEditorToolbarSeparator />
+ {showDownload ? (
+ <PdfEditorToolButton
+ label="Download"
+ shortcut="mod+S"
+ disabled={controlsDisabled || isDownloading}
+ onClick={() => void downloadDocument()}
>
- <MoreGlyph className="size-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-60">
- <DropdownMenuGroup>
- <DropdownMenuLabel className="truncate">
- {fileName}
- </DropdownMenuLabel>
- {showUpload ? (
- <DropdownMenuItem
- onClick={() => uploadInputRef.current?.click()}
- >
- <UploadGlyph className="size-4" />
- Open PDF…
- </DropdownMenuItem>
- ) : null}
- {showDownload ? (
+ {isDownloading ? (
+ <Spinner className="size-4" />
+ ) : (
+ <DownloadGlyph className="size-4" />
+ )}
+ </PdfEditorToolButton>
+ ) : null}
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label="More actions"
+ >
+ <MoreGlyph className="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-60">
+ <DropdownMenuGroup>
+ <DropdownMenuLabel className="truncate">
+ {fileName}
+ </DropdownMenuLabel>
+ {showUpload ? (
+ <DropdownMenuItem
+ onClick={() =>
+ uploadInputRef.current?.click()
+ }
+ >
+ <UploadGlyph className="size-4" />
+ Open PDF…
+ </DropdownMenuItem>
+ ) : null}
+ {showDownload ? (
+ <DropdownMenuItem
+ disabled={controlsDisabled}
+ onClick={() => void downloadDocument()}
+ >
+ <DownloadGlyph className="size-4" />
+ Download
+ <DropdownMenuShortcut>
+ ⌘S
+ </DropdownMenuShortcut>
+ </DropdownMenuItem>
+ ) : null}
+ {features.print ? (
+ <DropdownMenuItem
+ disabled={
+ controlsDisabled || !permissions.canPrint
+ }
+ onClick={() => setDialog({ type: "print" })}
+ >
+ <PrintGlyph className="size-4" />
+ Print…
+ <DropdownMenuShortcut>
+ ⌘P
+ </DropdownMenuShortcut>
+ </DropdownMenuItem>
+ ) : null}
+ {features.capture ? (
+ <DropdownMenuItem
+ disabled={controlsDisabled}
+ onClick={() =>
+ capture?.toggleMarqueeCapture()
+ }
+ >
+ <CameraGlyph className="size-4" />
+ Capture area as image
+ </DropdownMenuItem>
+ ) : null}
+ {features.fullscreen ? (
+ <DropdownMenuItem
+ onClick={() => fullscreen?.toggleFullscreen()}
+ >
+ {fullscreenState.isFullscreen ? (
+ <ExitFullscreenGlyph className="size-4" />
+ ) : (
+ <FullscreenGlyph className="size-4" />
+ )}
+ {fullscreenState.isFullscreen
+ ? "Exit full screen"
+ : "Full screen"}
+ </DropdownMenuItem>
+ ) : null}
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
<DropdownMenuItem
disabled={controlsDisabled}
- onClick={() => void downloadDocument()}
+ onClick={() =>
+ setDialog({ type: "properties" })
+ }
>
- <DownloadGlyph className="size-4" />
- Download
- <DropdownMenuShortcut>⌘S</DropdownMenuShortcut>
+ <InfoGlyph className="size-4" />
+ Document properties…
</DropdownMenuItem>
- ) : null}
- {features.print ? (
+ {features.security ? (
+ <DropdownMenuItem
+ disabled={controlsDisabled}
+ onClick={() =>
+ setDialog({ type: "security" })
+ }
+ >
+ <ShieldGlyph className="size-4" />
+ Security…
+ </DropdownMenuItem>
+ ) : null}
<DropdownMenuItem
disabled={
- controlsDisabled || !permissions.canPrint
+ controlsDisabled ||
+ !permissions.canModifyContents
}
- onClick={() => setDialog({ type: "print" })}
+ onClick={flattenDocument}
>
- <PrintGlyph className="size-4" />
- Print…
- <DropdownMenuShortcut>⌘P</DropdownMenuShortcut>
+ <LayersGlyph className="size-4" />
+ Flatten annotations…
</DropdownMenuItem>
- ) : null}
- {features.capture ? (
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
<DropdownMenuItem
disabled={controlsDisabled}
- onClick={() => capture?.toggleMarqueeCapture()}
+ onClick={exportAnnotationsJson}
>
- <CameraGlyph className="size-4" />
- Capture area as image
+ <DownloadGlyph className="size-4" />
+ Export annotations (JSON)
</DropdownMenuItem>
- ) : null}
- {features.fullscreen ? (
<DropdownMenuItem
- onClick={() => fullscreen?.toggleFullscreen()}
+ disabled={
+ controlsDisabled ||
+ !permissions.canModifyAnnotations
+ }
+ onClick={() =>
+ annotationImportInputRef.current?.click()
+ }
>
- {fullscreenState.isFullscreen ? (
- <ExitFullscreenGlyph className="size-4" />
- ) : (
- <FullscreenGlyph className="size-4" />
- )}
- {fullscreenState.isFullscreen
- ? "Exit full screen"
- : "Full screen"}
+ <UploadGlyph className="size-4" />
+ Import annotations (JSON)…
</DropdownMenuItem>
- ) : null}
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- <DropdownMenuGroup>
- <DropdownMenuItem
- disabled={controlsDisabled}
- onClick={() => setDialog({ type: "properties" })}
- >
- <InfoGlyph className="size-4" />
- Document properties…
- </DropdownMenuItem>
- {features.security ? (
- <DropdownMenuItem
- disabled={controlsDisabled}
- onClick={() => setDialog({ type: "security" })}
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
+ <DropdownMenuGroup>
+ <DropdownMenuLabel>Page layout</DropdownMenuLabel>
+ <DropdownMenuRadioGroup
+ value={spreadMode}
+ onValueChange={(value) =>
+ spread?.setSpreadMode(
+ String(value) as SpreadMode
+ )
+ }
>
- <ShieldGlyph className="size-4" />
- Security…
- </DropdownMenuItem>
- ) : null}
+ <DropdownMenuRadioItem value={SpreadMode.None}>
+ Single page
+ </DropdownMenuRadioItem>
+ <DropdownMenuRadioItem value={SpreadMode.Odd}>
+ Two pages
+ </DropdownMenuRadioItem>
+ <DropdownMenuRadioItem value={SpreadMode.Even}>
+ Two pages, cover first
+ </DropdownMenuRadioItem>
+ </DropdownMenuRadioGroup>
+ </DropdownMenuGroup>
+ <DropdownMenuSeparator />
<DropdownMenuItem
- disabled={
- controlsDisabled ||
- !permissions.canModifyContents
- }
- onClick={flattenDocument}
+ onClick={() => setDialog({ type: "shortcuts" })}
>
- <LayersGlyph className="size-4" />
- Flatten annotations…
+ <KeyboardGlyph className="size-4" />
+ Keyboard shortcuts
</DropdownMenuItem>
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- <DropdownMenuGroup>
- <DropdownMenuItem
- disabled={controlsDisabled}
- onClick={exportAnnotationsJson}
- >
- <DownloadGlyph className="size-4" />
- Export annotations (JSON)
- </DropdownMenuItem>
- <DropdownMenuItem
- disabled={
- controlsDisabled ||
- !permissions.canModifyAnnotations
- }
- onClick={() =>
- annotationImportInputRef.current?.click()
- }
- >
- <UploadGlyph className="size-4" />
- Import annotations (JSON)…
- </DropdownMenuItem>
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- <DropdownMenuGroup>
- <DropdownMenuLabel>Page layout</DropdownMenuLabel>
- <DropdownMenuRadioGroup
- value={spreadMode}
- onValueChange={(value) =>
- spread?.setSpreadMode(
- String(value) as SpreadMode
- )
- }
- >
- <DropdownMenuRadioItem value={SpreadMode.None}>
- Single page
- </DropdownMenuRadioItem>
- <DropdownMenuRadioItem value={SpreadMode.Odd}>
- Two pages
- </DropdownMenuRadioItem>
- <DropdownMenuRadioItem value={SpreadMode.Even}>
- Two pages, cover first
- </DropdownMenuRadioItem>
- </DropdownMenuRadioGroup>
- </DropdownMenuGroup>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={() => setDialog({ type: "shortcuts" })}
- >
- <KeyboardGlyph className="size-4" />
- Keyboard shortcuts
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </ScrollArea>
- </div>
- <div
- data-slot="pdf-editor-ribbon"
- className="flex min-h-10 items-center gap-1 border-b bg-muted/30 px-3 py-1.5"
- >
- <PdfEditorModeSwitch
- mode={mode}
- features={features}
- compact={compactToolbar}
- onModeChange={setMode}
- />
- <PdfEditorToolbarSeparator className="mx-1.5" />
- <ScrollArea
- orientation="horizontal"
- scrollFade
- scrollbarOverflowOnly
- className="min-w-0 flex-1 self-stretch"
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ </ScrollArea>
+ </div>
+ <div
+ data-slot="pdf-editor-ribbon"
+ className="flex min-h-10 items-center gap-1 border-b bg-muted/30 px-3 py-1.5"
>
- <div className="flex w-max min-w-full items-center gap-0.5 py-0.5">
- {ribbon}
- </div>
- </ScrollArea>
- </div>
+ <PdfEditorModeSwitch
+ mode={mode}
+ features={features}
+ compact={compactToolbar}
+ onModeChange={setMode}
+ />
+ <PdfEditorToolbarSeparator className="mx-1.5" />
+ <ScrollArea
+ orientation="horizontal"
+ scrollFade
+ scrollbarOverflowOnly
+ className="min-w-0 flex-1 self-stretch"
+ >
+ <div className="flex w-max min-w-full items-center gap-0.5 py-0.5">
+ {ribbon}
+ </div>
+ </ScrollArea>
+ </div>
+ </fieldset>
</TooltipProvider>
) : null}
@@ -3764,27 +3711,11 @@ function PdfEditorInner({
ref={shellRef}
className="relative flex min-h-0 flex-1 overflow-hidden bg-muted/30"
>
- {isLoading ? (
- <div className="absolute inset-0 z-20 flex bg-muted/30">
- {leftPanel ? (
- <DocumentViewerSidebarSkeleton
- className={LEFT_SIDEBAR_WIDTH_CLASS}
- inline={leftInline}
- />
- ) : null}
- <div className="grid min-w-0 flex-1 place-items-center">
- <Spinner className="size-4" />
- </div>
- </div>
- ) : null}
- <div className="flex h-full max-h-full min-h-0 w-full flex-1 overflow-hidden">
- <DocumentViewerThumbnailSidebar
- closedInlineClassName={LEFT_SIDEBAR_CLOSED_CLASS}
- inline={leftInline}
- open={leftPanel !== null && !isLoading}
- widthClassName={LEFT_SIDEBAR_WIDTH_CLASS}
- >
- {leftPanel !== null && !isLoading ? (
+ <PdfEditorWorkspace
+ leftInline={leftInline}
+ rightInline={rightInline}
+ left={
+ leftPanel !== null ? (
<div className="flex h-full flex-col">
<PanelTabStrip
tabs={visibleLeftTabs}
@@ -3792,30 +3723,16 @@ function PdfEditorInner({
onChange={setLeftPanel}
onClose={() => setLeftPanel(null)}
label="Sidebar panels"
+ disabled={controlsDisabled}
/>
- <div className="min-h-0 flex-1">{leftPanelContent}</div>
+ <div className="min-h-0 flex-1">
+ {controlsDisabled ? null : leftPanelContent}
+ </div>
</div>
- ) : null}
- </DocumentViewerThumbnailSidebar>
-
- <PdfEditorViewport
- documentId={documentId}
- className="relative h-full max-h-full min-h-0 min-w-0 flex-1"
- >
- <PdfEditorViewportBridge
- viewportElementRef={viewportElementRef}
- />
- <GlobalPointerProvider documentId={documentId}>
- <Scroller documentId={documentId} renderPage={renderPage} />
- </GlobalPointerProvider>
- <CopyToClipboard />
- </PdfEditorViewport>
-
- <PdfEditorRightPanelShell
- open={rightPanel !== null && !isLoading}
- inline={rightInline}
- >
- {rightPanel !== null && !isLoading ? (
+ ) : null
+ }
+ right={
+ rightPanel !== null ? (
<div className="flex h-full flex-col">
<PanelTabStrip
tabs={visibleRightTabs}
@@ -3823,9 +3740,11 @@ function PdfEditorInner({
onChange={setRightPanel}
onClose={() => setRightPanel(null)}
label="Detail panels"
+ disabled={controlsDisabled}
/>
<div className="min-h-0 flex-1 overflow-hidden">
- {rightPanel === "properties" ? (
+ {controlsDisabled ? null : rightPanel ===
+ "properties" ? (
<PdfEditorScrollArea
className="h-full w-full"
scrollbarGutter={false}
@@ -3837,75 +3756,98 @@ function PdfEditorInner({
)}
</div>
</div>
- ) : null}
- </PdfEditorRightPanelShell>
- </div>
+ ) : null
+ }
+ >
+ {controlsDisabled ? (
+ unavailableContent
+ ) : (
+ <PdfEditorViewport
+ documentId={documentId}
+ className="relative h-full max-h-full min-h-0 min-w-0 flex-1"
+ >
+ <PdfEditorViewportBridge
+ viewportElementRef={viewportElementRef}
+ />
+ <GlobalPointerProvider documentId={documentId}>
+ <Scroller
+ documentId={documentId}
+ renderPage={renderPage}
+ />
+ </GlobalPointerProvider>
+ <CopyToClipboard />
+ </PdfEditorViewport>
+ )}
+ </PdfEditorWorkspace>
</div>
- <PdfEditorSignaturePersistence storageKey={null} />
- {features.capture ? (
- <PdfEditorCaptureDialog documentId={documentId} />
+ {!controlsDisabled ? (
+ <>
+ {features.capture ? (
+ <PdfEditorCaptureDialog documentId={documentId} />
+ ) : null}
+ <PdfEditorPrintDialog
+ documentId={documentId}
+ open={dialog?.type === "print"}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ <PdfEditorSecurityDialog
+ documentId={documentId}
+ open={dialog?.type === "security"}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ <PdfEditorPropertiesDialog
+ documentId={documentId}
+ open={dialog?.type === "properties"}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ <PdfEditorShortcutsDialog
+ open={dialog?.type === "shortcuts"}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ <PdfEditorSignatureDialog
+ open={dialog?.type === "signature"}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ <PdfEditorLinkDialog
+ documentId={documentId}
+ open={dialog?.type === "link"}
+ source={dialog?.type === "link" ? dialog.source : "selection"}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ <PdfEditorConfirmDialog
+ open={dialog?.type === "confirm"}
+ title={dialog?.type === "confirm" ? dialog.title : ""}
+ description={
+ dialog?.type === "confirm" ? dialog.description : undefined
+ }
+ confirmLabel={
+ dialog?.type === "confirm" ? dialog.confirmLabel : undefined
+ }
+ destructive={
+ dialog?.type === "confirm" ? dialog.destructive : false
+ }
+ onConfirm={() => {
+ if (dialog?.type === "confirm") dialog.onConfirm()
+ }}
+ onOpenChange={(open) => {
+ if (!open) setDialog(null)
+ }}
+ />
+ </>
) : null}
- <PdfEditorPrintDialog
- documentId={documentId}
- open={dialog?.type === "print"}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
- <PdfEditorSecurityDialog
- documentId={documentId}
- open={dialog?.type === "security"}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
- <PdfEditorPropertiesDialog
- documentId={documentId}
- open={dialog?.type === "properties"}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
- <PdfEditorShortcutsDialog
- open={dialog?.type === "shortcuts"}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
- <PdfEditorSignatureDialog
- open={dialog?.type === "signature"}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
- <PdfEditorLinkDialog
- documentId={documentId}
- open={dialog?.type === "link"}
- source={dialog?.type === "link" ? dialog.source : "selection"}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
- <PdfEditorConfirmDialog
- open={dialog?.type === "confirm"}
- title={dialog?.type === "confirm" ? dialog.title : ""}
- description={
- dialog?.type === "confirm" ? dialog.description : undefined
- }
- confirmLabel={
- dialog?.type === "confirm" ? dialog.confirmLabel : undefined
- }
- destructive={
- dialog?.type === "confirm" ? dialog.destructive : false
- }
- onConfirm={() => {
- if (dialog?.type === "confirm") dialog.onConfirm()
- }}
- onOpenChange={(open) => {
- if (!open) setDialog(null)
- }}
- />
</div>
</div>
</ToastProvider>
@@ -3921,14 +3863,17 @@ type PdfEditorDocumentLoaderProps = Omit<
PdfEditorInnerProps,
| "documentId"
| "document"
+ | "documentState"
| "fileName"
| "leftPanel"
| "setLeftPanel"
| "formDesignMode"
| "setFormDesignMode"
+ | "unavailableContent"
> & {
source: EditorSource | null
sourceLoading: boolean
+ engineError?: string
fileNameOverride?: string
signatureStorageKey: string | null
onDocumentLoadSuccess?: PDFEditorProps["onDocumentLoadSuccess"]
@@ -3938,15 +3883,24 @@ type PdfEditorDocumentLoaderProps = Omit<
function PdfEditorDocumentLoader({
source,
sourceLoading,
+ engineError,
fileNameOverride,
signatureStorageKey,
onDocumentLoadSuccess,
onDocumentLoadError,
...innerProps
}: PdfEditorDocumentLoaderProps) {
+ const registryState = useRegistry()
const { provides: documentManager } = useDocumentManagerCapability()
const { activeDocumentId, activeDocument } = useActiveDocument()
- const [loadError, setLoadError] = React.useState<string | null>(null)
+ const [loadError, setLoadError] = React.useState<{
+ sourceKey: string
+ message: string
+ } | null>(null)
+ const [requestedDocument, setRequestedDocument] = React.useState<{
+ sourceKey: string
+ documentId: string
+ } | null>(null)
const [leftPanel, setLeftPanel] = React.useState<PdfEditorLeftPanel | null>(
null
)
@@ -3973,7 +3927,7 @@ function PdfEditorDocumentLoader({
const fail = (message: string) => {
if (openedSourceRef.current !== source.key) return
- setLoadError(message)
+ setLoadError({ sourceKey: source.key, message })
errorRef.current?.(message)
}
@@ -3993,8 +3947,14 @@ function PdfEditorDocumentLoader({
task.wait(
(response) => {
+ if (openedSourceRef.current !== source.key) return
+ setRequestedDocument({
+ sourceKey: source.key,
+ documentId: response.documentId,
+ })
response.task.wait(
(openedDocument) => {
+ if (openedSourceRef.current !== source.key) return
documentManager.setActiveDocument(response.documentId)
successRef.current?.({
numPages: openedDocument.pageCount,
@@ -4009,7 +3969,10 @@ function PdfEditorDocumentLoader({
},
(failure) => {
// Password prompts are handled through the document state.
- if (failure?.reason?.code === PdfErrorCode.Password) return
+ if (failure?.reason?.code === PdfErrorCode.Password) {
+ documentManager.setActiveDocument(response.documentId)
+ return
+ }
fail(failure?.reason?.message ?? "The PDF could not be loaded.")
}
)
@@ -4022,64 +3985,76 @@ function PdfEditorDocumentLoader({
const fileName = fileNameOverride
? getPdfFileName(fileNameOverride)
: (source?.name ?? getPdfFileName(undefined))
+ const isRequestedDocument =
+ requestedDocument?.sourceKey === source?.key &&
+ requestedDocument?.documentId === activeDocumentId
+ const currentError =
+ loadError?.sourceKey === source?.key ? loadError?.message : undefined
const passwordRequired =
+ isRequestedDocument &&
activeDocument?.status === "error" &&
activeDocument.errorCode === PdfErrorCode.Password
const documentFailed =
- loadError !== null ||
- (activeDocument?.status === "error" && !passwordRequired)
-
- if (
- !source ||
- sourceLoading ||
- !activeDocumentId ||
- documentFailed ||
- passwordRequired
- ) {
- return (
- <PdfEditorFallbackShell
- className={innerProps.className}
- fileName={source?.name}
- showToolbar={innerProps.showToolbar}
- showUpload={innerProps.showUpload}
- state={
- !source && !sourceLoading
- ? "empty"
- : passwordRequired
- ? "password"
- : documentFailed
- ? "error"
- : "loading"
- }
- errorMessage={loadError ?? activeDocument?.error ?? undefined}
- onUploadFile={innerProps.onUploadFile}
- >
- {passwordRequired && activeDocument ? (
- <div className="flex-1">
- <PdfEditorPasswordPrompt documentState={activeDocument} />
- </div>
- ) : null}
- </PdfEditorFallbackShell>
- )
- }
+ currentError !== undefined ||
+ (isRequestedDocument &&
+ activeDocument?.status === "error" &&
+ !passwordRequired)
const document =
- activeDocument?.status === "loaded" ? activeDocument.document : null
+ !sourceLoading &&
+ !documentFailed &&
+ !engineError &&
+ isRequestedDocument &&
+ activeDocument?.status === "loaded"
+ ? activeDocument.document
+ : null
+ const status =
+ engineError || documentFailed
+ ? "error"
+ : !source && !sourceLoading
+ ? "empty"
+ : "loading"
return (
<TooltipProvider delay={TOOLTIP_DELAY_MS}>
<PdfEditorSignaturePersistence storageKey={signatureStorageKey} />
- <PdfEditorInner
- key={activeDocumentId}
- {...innerProps}
- documentId={activeDocumentId}
- document={document}
- fileName={fileName}
- leftPanel={leftPanel}
- setLeftPanel={setLeftPanel}
- formDesignMode={formDesignMode}
- setFormDesignMode={setFormDesignMode}
- />
+ <PDFContext.Provider
+ value={document ? registryState : EMPTY_EDITOR_CONTEXT}
+ >
+ <PdfEditorInner
+ {...innerProps}
+ documentId={document ? activeDocumentId! : ""}
+ document={document}
+ documentState={
+ document ? "ready" : passwordRequired ? "password" : status
+ }
+ fileName={fileName}
+ leftPanel={leftPanel}
+ setLeftPanel={setLeftPanel}
+ formDesignMode={formDesignMode}
+ setFormDesignMode={setFormDesignMode}
+ unavailableContent={
+ passwordRequired && activeDocument ? (
+ <PDFContext.Provider value={registryState}>
+ <PdfEditorPasswordPrompt documentState={activeDocument} />
+ </PDFContext.Provider>
+ ) : (
+ <PdfEditorDocumentStatus
+ state={status}
+ errorMessage={
+ engineError ??
+ currentError ??
+ activeDocument?.error ??
+ undefined
+ }
+ onUploadFile={
+ innerProps.showUpload ? innerProps.onUploadFile : undefined
+ }
+ />
+ )
+ }
+ />
+ </PDFContext.Provider>
</TooltipProvider>
)
}
@@ -4279,73 +4254,58 @@ export const PDFEditor = React.forwardRef<PDFEditorHandle, PDFEditorProps>(
[]
)
- if (engineError) {
- return (
- <PdfEditorFallbackShell
- className={className}
- fileName={source?.name}
- showToolbar={showToolbar}
- showUpload={showUpload}
- state="error"
- errorMessage="The PDF engine could not be loaded."
- onUploadFile={handleUploadFile}
- />
- )
- }
-
- if (!engine) {
- return (
- <PdfEditorFallbackShell
- className={className}
- fileName={source?.name}
- showToolbar={showToolbar}
- showUpload={showUpload}
- state="loading"
- onUploadFile={handleUploadFile}
- />
- )
- }
-
+ const editor = (
+ <PdfEditorDocumentLoader
+ engineError={
+ engineError ? "The PDF engine could not be loaded." : undefined
+ }
+ source={source}
+ sourceLoading={sourceLoading}
+ fileNameOverride={fileName}
+ signatureStorageKey={signatureStorageKey}
+ className={className}
+ defaultZoom={defaultZoom}
+ defaultMode={defaultMode}
+ annotationAuthor={annotationAuthor}
+ features={resolvedFeatures}
+ showToolbar={showToolbar}
+ showUpload={showUpload}
+ showDownload={showDownload}
+ toolbarActions={toolbarActions}
+ selectionActions={resolvedSelectionActions}
+ signatureFontsStylesheetUrl={signatureFontsStylesheetUrl}
+ renderPageOverlay={renderPageOverlay}
+ handleRef={handleRef}
+ onReplaceDocument={replace}
+ onUploadFile={handleUploadFile}
+ onDocumentLoadSuccess={onDocumentLoadSuccess}
+ onDocumentLoadError={onDocumentLoadError}
+ onActivePageChange={onActivePageChange}
+ onModeChange={onModeChange}
+ onAnnotationEvent={onAnnotationEvent}
+ onAnnotationsChange={onAnnotationsChange}
+ onFormValuesChange={onFormValuesChange}
+ onRedactionsApplied={onRedactionsApplied}
+ onSave={onSave}
+ onCapture={onCapture}
+ onToast={onToast}
+ onSelectionAction={onSelectionAction}
+ />
+ )
return (
- <PdfEditorScrollAreaResolverContext.Provider
- value={resolveScrollAreaViewport ?? resolveDefaultScrollAreaViewport}
- >
- <EmbedPDF engine={engine} plugins={plugins}>
- <PdfEditorDocumentLoader
- source={source}
- sourceLoading={sourceLoading}
- fileNameOverride={fileName}
- signatureStorageKey={signatureStorageKey}
- className={className}
- defaultZoom={defaultZoom}
- defaultMode={defaultMode}
- annotationAuthor={annotationAuthor}
- features={resolvedFeatures}
- showToolbar={showToolbar}
- showUpload={showUpload}
- showDownload={showDownload}
- toolbarActions={toolbarActions}
- selectionActions={resolvedSelectionActions}
- signatureFontsStylesheetUrl={signatureFontsStylesheetUrl}
- renderPageOverlay={renderPageOverlay}
- handleRef={handleRef}
- onReplaceDocument={replace}
- onUploadFile={handleUploadFile}
- onDocumentLoadSuccess={onDocumentLoadSuccess}
- onDocumentLoadError={onDocumentLoadError}
- onActivePageChange={onActivePageChange}
- onModeChange={onModeChange}
- onAnnotationEvent={onAnnotationEvent}
- onAnnotationsChange={onAnnotationsChange}
- onFormValuesChange={onFormValuesChange}
- onRedactionsApplied={onRedactionsApplied}
- onSave={onSave}
- onCapture={onCapture}
- onToast={onToast}
- onSelectionAction={onSelectionAction}
- />
- </EmbedPDF>
- </PdfEditorScrollAreaResolverContext.Provider>
+ <PDFContext.Provider value={EMPTY_EDITOR_CONTEXT}>
+ <PdfEditorScrollAreaResolverContext.Provider
+ value={resolveScrollAreaViewport ?? resolveDefaultScrollAreaViewport}
+ >
+ {engine ? (
+ <EmbedPDF engine={engine} plugins={plugins}>
+ {editor}
+ </EmbedPDF>
+ ) : (
+ editor
+ )}
+ </PdfEditorScrollAreaResolverContext.Provider>
+ </PDFContext.Provider>
)
}
)
diff --git a/apps/v4/components/extend/pptx-viewer.tsx b/apps/v4/components/extend/pptx-viewer.tsx
index 6f93003..ec9f54a 100644
--- a/apps/v4/components/extend/pptx-viewer.tsx
+++ b/apps/v4/components/extend/pptx-viewer.tsx
@@ -3,11 +3,11 @@
import * as React from "react"
import {
ReactPptxViewer,
- usePptxViewer,
usePptxViewerThumbnails,
type ParsedPresentation,
type PptxSlideThumbnailItem,
type PptxSlideThumbnailRenderWindow,
+ type PptxViewerController,
type PptxViewerError,
type PresentationSource,
} from "@extend-ai/react-pptx"
@@ -154,19 +154,25 @@ function getNextZoom(currentZoom: number, direction: 1 | -1) {
}
function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
- const [visible, setVisible] = React.useState(false)
+ const [showSpinner, setShowSpinner] = React.useState(false)
+ const [previousIsLoading, setPreviousIsLoading] = React.useState(isLoading)
+
+ if (previousIsLoading !== isLoading) {
+ setPreviousIsLoading(isLoading)
+ setShowSpinner(false)
+ }
React.useEffect(() => {
- if (!isLoading) {
- setVisible(false)
- return
- }
+ if (!isLoading) return
+
+ const timeoutId = window.setTimeout(() => {
+ setShowSpinner(true)
+ }, delayMs)
- const timeoutId = window.setTimeout(() => setVisible(true), delayMs)
return () => window.clearTimeout(timeoutId)
}, [delayMs, isLoading])
- return visible
+ return isLoading && showSpinner
}
function useDebouncedValue<TValue>(value: TValue, delayMs: number) {
@@ -300,10 +306,6 @@ function PptxSlideNumberControl({
const [isEditing, setIsEditing] = React.useState(false)
const [draftSlide, setDraftSlide] = React.useState(() => String(displaySlide))
- React.useEffect(() => {
- if (!isEditing) setDraftSlide(String(displaySlide))
- }, [displaySlide, isEditing])
-
React.useEffect(() => {
if (!isEditing) return
@@ -839,7 +841,7 @@ function PptxThumbnailSidebarContent({
slideCount,
}: {
activeSlideIndex: number
- controller: ReturnType<typeof usePptxViewer>["controller"]
+ controller: PptxViewerController | null
displayFileName: string
isLoading: boolean
onSelectSlide: (slideIndex: number) => void
@@ -945,7 +947,8 @@ export function PptxViewerPreview({
const [isLoading, setIsLoading] = React.useState(Boolean(src))
const [loadError, setLoadError] = React.useState<string>()
const [isPreparingDownload, setIsPreparingDownload] = React.useState(false)
- const viewer = usePptxViewer()
+ const [controller, setController] =
+ React.useState<PptxViewerController | null>(null)
const sidebarInline = useInlineThumbnailSidebar(viewerShellWidth)
const activeUploadedPresentation =
uploadedPresentation?.sourceUrl === src ? uploadedPresentation : null
@@ -993,16 +996,27 @@ export function PptxViewerPreview({
}
}, [])
- React.useEffect(() => {
- if (thumbnailSidebarVisible) setThumbnailSidebarMounted(true)
- }, [thumbnailSidebarVisible])
+ if (thumbnailSidebarVisible && !thumbnailSidebarMounted) {
+ setThumbnailSidebarMounted(true)
+ }
- React.useEffect(() => {
- cancelPendingSlideNavigation()
+ const [previousSource, setPreviousSource] = React.useState({
+ sourceIdentity,
+ defaultZoom,
+ })
+ if (
+ previousSource.sourceIdentity !== sourceIdentity ||
+ previousSource.defaultZoom !== defaultZoom
+ ) {
+ setPreviousSource({ sourceIdentity, defaultZoom })
setSlideCount(0)
setZoom(Math.min(400, Math.max(10, Math.round(defaultZoom))))
setLoadError(undefined)
setIsLoading(Boolean(sourceIdentity))
+ }
+
+ React.useEffect(() => {
+ cancelPendingSlideNavigation()
viewportElement?.scrollTo({ top: 0, left: 0 })
}, [
cancelPendingSlideNavigation,
@@ -1016,15 +1030,26 @@ export function PptxViewerPreview({
[cancelPendingSlideNavigation]
)
- React.useEffect(() => {
+ const [initialSlideSource, setInitialSlideSource] = React.useState({
+ sourceIdentity,
+ requestedInitialSlideIndex,
+ })
+ if (
+ initialSlideSource.sourceIdentity !== sourceIdentity ||
+ initialSlideSource.requestedInitialSlideIndex !== requestedInitialSlideIndex
+ ) {
+ setInitialSlideSource({ sourceIdentity, requestedInitialSlideIndex })
setActiveSlideIndex(requestedInitialSlideIndex)
- if (viewer.controller?.isReady()) {
- void viewer.controller.goToSlide(requestedInitialSlideIndex, {
+ }
+
+ React.useEffect(() => {
+ if (controller?.isReady()) {
+ void controller.goToSlide(requestedInitialSlideIndex, {
behavior: "instant",
block: "center",
})
}
- }, [requestedInitialSlideIndex, sourceIdentity, viewer.controller])
+ }, [requestedInitialSlideIndex, sourceIdentity, controller])
const navigateToSlide = React.useCallback(
(nextSlideIndex: number, behavior: ScrollBehavior) => {
@@ -1059,12 +1084,12 @@ export function PptxViewerPreview({
}
setActiveSlideIndex(normalizedSlideIndex)
- void viewer.controller?.goToSlide(normalizedSlideIndex, {
+ void controller?.goToSlide(normalizedSlideIndex, {
behavior: resolvedBehavior,
block: "center",
})
},
- [cancelPendingSlideNavigation, slideCount, viewer.controller]
+ [cancelPendingSlideNavigation, slideCount, controller]
)
const handleSlideChange = React.useCallback(
(nextSlideIndex: number) => navigateToSlide(nextSlideIndex, "smooth"),
@@ -1111,7 +1136,6 @@ export function PptxViewerPreview({
currentSlideIndex === 0 ? currentSlideIndex : 0
)
- const controller = viewer.controller
if (!isLoading && controller && controller.getSlideIndex() !== 0) {
void controller.goToSlide(0, {
behavior: "instant",
@@ -1119,7 +1143,7 @@ export function PptxViewerPreview({
})
}
},
- [isLoading, viewer.controller]
+ [isLoading, controller]
)
const handleViewerUserScrollIntent = React.useCallback(
(event: React.SyntheticEvent<HTMLDivElement>) => {
@@ -1260,7 +1284,7 @@ export function PptxViewerPreview({
{thumbnailSidebarMounted && hasPresentation ? (
<PptxThumbnailSidebarContent
activeSlideIndex={sidebarActiveSlideIndex}
- controller={viewer.controller}
+ controller={controller}
displayFileName={displayFileName}
isLoading={isLoading}
onSelectSlide={handleThumbnailSlideChange}
@@ -1315,7 +1339,7 @@ export function PptxViewerPreview({
) : (
<ReactPptxViewer
key={sourceIdentity}
- ref={viewer.ref}
+ ref={setController}
source={source}
mode="continuous"
initialSlide={requestedInitialSlideIndex}
diff --git a/apps/v4/components/extend/schema-builder.tsx b/apps/v4/components/extend/schema-builder.tsx
index 57d5701..4f63a03 100644
--- a/apps/v4/components/extend/schema-builder.tsx
+++ b/apps/v4/components/extend/schema-builder.tsx
@@ -502,13 +502,15 @@ function ScrollAreaVirtualizer({
)
}
+const subscribeToHydration = () => () => {}
+
function useResolvedCodeThemeType(theme?: SchemaBuilderTheme) {
const { resolvedTheme } = useTheme()
- const [isMounted, setIsMounted] = React.useState(false)
-
- React.useEffect(() => {
- setIsMounted(true)
- }, [])
+ const isMounted = React.useSyncExternalStore(
+ subscribeToHydration,
+ () => true,
+ () => false
+ )
if (theme) return theme
diff --git a/apps/v4/components/extend/xlsx-editor.tsx b/apps/v4/components/extend/xlsx-editor.tsx
index 34293cb..66638ba 100644
--- a/apps/v4/components/extend/xlsx-editor.tsx
+++ b/apps/v4/components/extend/xlsx-editor.tsx
@@ -381,12 +381,15 @@ function formatWorkbookName(fileName: string | undefined, url: string) {
function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
const [showSpinner, setShowSpinner] = React.useState(false)
+ const [previousIsLoading, setPreviousIsLoading] = React.useState(isLoading)
+
+ if (previousIsLoading !== isLoading) {
+ setPreviousIsLoading(isLoading)
+ setShowSpinner(false)
+ }
React.useEffect(() => {
- if (!isLoading) {
- setShowSpinner(false)
- return
- }
+ if (!isLoading) return
const timeoutId = window.setTimeout(() => {
setShowSpinner(true)
@@ -395,7 +398,7 @@ function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
return () => window.clearTimeout(timeoutId)
}, [delayMs, isLoading])
- return showSpinner
+ return isLoading && showSpinner
}
function normalizeHexColor(value: string, fallback = DEFAULT_TEXT_COLOR) {
@@ -1406,27 +1409,22 @@ function EditorToolbar({
)
)
- React.useEffect(() => {
- if (
- appliedMergeRegions.length === 0 ||
- worksheetMergeRegions.length === 0
- ) {
- return
- }
-
- setAppliedMergeRegions((currentRegions) =>
- currentRegions.filter(
- (currentRegion) =>
- !worksheetMergeRegions.some((worksheetRegion) =>
- rangesIntersect(currentRegion, worksheetRegion)
- )
+ const pendingMergeRegions = appliedMergeRegions.filter(
+ (currentRegion) =>
+ !worksheetMergeRegions.some((worksheetRegion) =>
+ rangesIntersect(currentRegion, worksheetRegion)
)
- )
- }, [appliedMergeRegions.length, worksheetMergeRegions])
+ )
+ if (pendingMergeRegions.length !== appliedMergeRegions.length) {
+ setAppliedMergeRegions(pendingMergeRegions)
+ }
- React.useEffect(() => {
+ const [previousSheetIndex, setPreviousSheetIndex] =
+ React.useState(activeSheetIndex)
+ if (!Object.is(previousSheetIndex, activeSheetIndex)) {
+ setPreviousSheetIndex(activeSheetIndex)
setAppliedMergeRegions([])
- }, [activeSheetIndex])
+ }
const selectionIsSingleCell = activeRange
? isSingleCellRange(activeRange)
: true
@@ -1451,11 +1449,6 @@ function EditorToolbar({
const currentZoom = Math.round(zoomScale)
const selectedCellInputValue = selectedFormula || selectedValue
- React.useEffect(() => {
- if (formulaFocused) return
- setFormulaDraft(selectedCellInputValue)
- }, [formulaFocused, selectedCellInputValue, activeCellAddress])
-
const activeCellStyle = React.useMemo(() => {
// Worksheet style objects are mutable; revision invalidates this read after edits.
void revision
@@ -2384,7 +2377,7 @@ function EditorToolbar({
XLSX_EDITOR_FORMULA_INPUT_CHROME_CLASS
)}
disabled={!hasActiveCell || readOnly}
- value={formulaDraft}
+ value={formulaFocused ? formulaDraft : selectedCellInputValue}
onBlur={() => {
commitFormula()
setFormulaFocused(false)
@@ -2392,7 +2385,8 @@ function EditorToolbar({
onChange={(event) => setFormulaDraft(event.target.value)}
onFocus={() => {
formulaEditCellRef.current = activeCell
- formulaInitialValueRef.current = formulaDraft
+ formulaInitialValueRef.current = selectedCellInputValue
+ setFormulaDraft(selectedCellInputValue)
setFormulaFocused(true)
}}
onKeyDown={(event) => {
@@ -2499,6 +2493,7 @@ export function XlsxEditorPreview({
}) {
return (
<XlsxEditorContent
+ key={src}
className={className}
effectiveIsDark={isDark}
fileName={fileName}
@@ -2546,19 +2541,8 @@ function XlsxEditorContent({
React.useEffect(() => {
let isCurrent = true
- if (url) {
- setUploadedWorkbook(null)
- }
-
async function loadWorkbook(): Promise<void> {
- if (!url) {
- setWorkbookBuffer(null)
- setLoadError(undefined)
- return
- }
-
- setWorkbookBuffer(null)
- setLoadError(undefined)
+ if (!url) return
try {
const response = await fetch(url)
diff --git a/apps/v4/components/extend/xlsx-viewer.tsx b/apps/v4/components/extend/xlsx-viewer.tsx
index 7973826..d382abf 100644
--- a/apps/v4/components/extend/xlsx-viewer.tsx
+++ b/apps/v4/components/extend/xlsx-viewer.tsx
@@ -410,12 +410,15 @@ function scrollXlsxCellIntoView({
function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
const [showSpinner, setShowSpinner] = React.useState(false)
+ const [previousIsLoading, setPreviousIsLoading] = React.useState(isLoading)
+
+ if (previousIsLoading !== isLoading) {
+ setPreviousIsLoading(isLoading)
+ setShowSpinner(false)
+ }
React.useEffect(() => {
- if (!isLoading) {
- setShowSpinner(false)
- return
- }
+ if (!isLoading) return
const timeoutId = window.setTimeout(() => {
setShowSpinner(true)
@@ -424,7 +427,7 @@ function useDelayedLoadingIndicator(isLoading: boolean, delayMs: number) {
return () => window.clearTimeout(timeoutId)
}, [delayMs, isLoading])
- return showSpinner
+ return isLoading && showSpinner
}
function ToolbarTooltip({
@@ -630,10 +633,8 @@ export function WorkbookTableHeaderMenu({
function WorkbookSearchPopover({
viewportRef,
- workbookIdentity,
}: {
viewportRef: React.RefObject<HTMLDivElement | null>
- workbookIdentity: string
}) {
const controller = useXlsxViewer()
const [searchDraft, setSearchDraft] = React.useState("")
@@ -698,14 +699,8 @@ function WorkbookSearchPopover({
}, [])
React.useEffect(() => {
- const trimmedDraft = searchDraft.trim()
-
- if (!trimmedDraft) {
- runSearch("")
- return
- }
+ if (!searchDraft.trim()) return
- setIsSearching(true)
const timeoutId = window.setTimeout(() => {
runSearch(searchDraft)
}, XLSX_SEARCH_DEBOUNCE_MS)
@@ -713,6 +708,16 @@ function WorkbookSearchPopover({
return () => window.clearTimeout(timeoutId)
}, [runSearch, searchDraft])
+ const handleSearchDraftChange = (nextDraft: string) => {
+ searchRequestIdRef.current += 1
+ setSearchDraft(nextDraft)
+ if (!nextDraft.trim()) {
+ runSearch("")
+ return
+ }
+ setIsSearching(true)
+ }
+
const clearSearch = React.useCallback(() => {
searchRequestIdRef.current += 1
setSearchDraft("")
@@ -739,14 +744,10 @@ function WorkbookSearchPopover({
)
React.useEffect(() => {
- searchRequestIdRef.current += 1
- setSearchDraft("")
- setSearchQuery("")
- setSearchResults([])
- setActiveResultIndex(0)
- setIsSearching(false)
- appliedResultKeyRef.current = ""
- }, [workbookIdentity])
+ return () => {
+ searchRequestIdRef.current += 1
+ }
+ }, [])
React.useEffect(() => {
if (!activeResult) return
@@ -805,7 +806,7 @@ function WorkbookSearchPopover({
<Input
placeholder="Search workbook"
value={searchDraft}
- onChange={(event) => setSearchDraft(event.target.value)}
+ onChange={(event) => handleSearchDraftChange(event.target.value)}
onKeyDown={(event) => {
if (event.key !== "Enter") return
@@ -993,8 +994,8 @@ function WorkbookToolbar({
</div>
<Separator orientation="vertical" className="mx-1 h-4 self-center" />
<WorkbookSearchPopover
+ key={workbookIdentity}
viewportRef={viewportRef}
- workbookIdentity={workbookIdentity}
/>
{toolbarActions ? (
<>
@@ -1074,7 +1075,6 @@ type WorkbookSheetTabsInnerProps = {
activeSheetIndex: number
onActiveSheetIndexChange: (index: number) => void
sheets: WorkbookSheetTab[]
- workbookIdentity: string
}
export function WorkbookSheetTabs({
@@ -1091,10 +1091,10 @@ export function WorkbookSheetTabs({
return (
<WorkbookSheetTabsInner
+ key={workbookIdentity}
activeSheetIndex={activeSheetIndex}
onActiveSheetIndexChange={handleActiveSheetIndexChange}
sheets={sheets}
- workbookIdentity={workbookIdentity}
/>
)
}
@@ -1103,7 +1103,6 @@ const WorkbookSheetTabsInner = React.memo(function WorkbookSheetTabsInner({
activeSheetIndex,
onActiveSheetIndexChange,
sheets,
- workbookIdentity,
}: WorkbookSheetTabsInnerProps) {
const [visiblePreviewIndex, setVisiblePreviewIndex] = React.useState<
number | null
@@ -1212,14 +1211,6 @@ const WorkbookSheetTabsInner = React.memo(function WorkbookSheetTabsInner({
}
}, [clearCloseTimeout, clearOpenTimeout])
- React.useEffect(() => {
- clearOpenTimeout()
- clearCloseTimeout()
- setVisiblePreviewIndex(null)
- setPreviewPosition({ left: 0, top: 0 })
- setThumbnailUrls({})
- }, [clearCloseTimeout, clearOpenTimeout, workbookIdentity])
-
React.useEffect(() => {
thumbnails.forEach((thumbnail) => {
setThumbnailUrls((current) => {
@@ -1344,7 +1335,7 @@ const WorkbookSheetTabsInner = React.memo(function WorkbookSheetTabsInner({
<div className="relative aspect-[11/7] w-full overflow-hidden bg-muted/60">
{/* eslint-disable-next-line @next/next/no-img-element -- Workbook sheet previews are generated runtime image URLs. */}
<img
- key={`${workbookIdentity}-${visiblePreviewIndex}-${previewUrl}`}
+ key={`${visiblePreviewIndex}-${previewUrl}`}
src={previewUrl}
alt={`${previewSheet.name} preview`}
className="absolute inset-0 h-full w-full object-cover object-left-top"
@@ -1485,6 +1476,7 @@ export function XlsxViewerPreview({
}) {
return (
<XlsxViewerContent
+ key={src}
className={className}
effectiveIsDark={isDark}
fileName={fileName}
@@ -1548,19 +1540,9 @@ function XlsxViewerContent({
React.useEffect(() => {
let isCurrent = true
- if (url) {
- setUploadedWorkbook(null)
- }
async function loadWorkbook(): Promise<void> {
- if (!url) {
- setWorkbookBuffer(null)
- setLoadError(undefined)
- return
- }
-
- setWorkbookBuffer(null)
- setLoadError(undefined)
+ if (!url) return
try {
const response = await fetch(url)
diff --git a/apps/v4/components/file-thumbnail-docs.tsx b/apps/v4/components/file-thumbnail-docs.tsx
index 694dfc5..0001915 100644
--- a/apps/v4/components/file-thumbnail-docs.tsx
+++ b/apps/v4/components/file-thumbnail-docs.tsx
@@ -130,11 +130,15 @@ function PdfThumbnailPreview({
const [imageUrl, setImageUrl] = React.useState<string | null>(null)
const [hasError, setHasError] = React.useState(false)
- React.useEffect(() => {
- let isCurrent = true
-
+ const [previousUrl, setPreviousUrl] = React.useState(file.url)
+ if (previousUrl !== file.url) {
+ setPreviousUrl(file.url)
setImageUrl(null)
setHasError(false)
+ }
+
+ React.useEffect(() => {
+ let isCurrent = true
void renderPdfThumbnailUrl({
pageIndex: 0,
@@ -205,22 +209,24 @@ function DocxThumbnailPreview({
)
)
const firstThumbnail = thumbnails[0]
- const docxCanvasRef =
- React.useRef<React.RefCallback<HTMLCanvasElement> | null>(null)
- const [thumbnailRenderState, setThumbnailRenderState] =
- React.useState<DocxThumbnailRenderState | null>(null)
- const attachDocxThumbnailCanvas = React.useCallback(
- (canvas: HTMLCanvasElement | null) => {
- docxCanvasRef.current?.(canvas)
- },
- []
- )
-
- React.useEffect(() => {
- let isCurrent = true
+ const thumbnailRenderState = firstThumbnail
+ const attachDocxThumbnailCanvas = firstThumbnail?.canvasRef
+ const [previousInputs, setPreviousInputs] = React.useState({
+ file,
+ importDocxFile,
+ })
+ if (
+ previousInputs.file !== file ||
+ previousInputs.importDocxFile !== importDocxFile
+ ) {
+ setPreviousInputs({ file, importDocxFile })
setIsLoading(true)
setHasError(false)
+ }
+
+ React.useEffect(() => {
+ let isCurrent = true
void fetchFile(file)
.then((docxFile) => importDocxFile(docxFile))
@@ -241,23 +247,6 @@ function DocxThumbnailPreview({
}
}, [file, importDocxFile])
- React.useEffect(() => {
- if (!firstThumbnail) {
- docxCanvasRef.current = null
- setThumbnailRenderState(null)
- return
- }
-
- docxCanvasRef.current = firstThumbnail.canvasRef
- setThumbnailRenderState({
- aspectRatio: firstThumbnail.aspectRatio,
- isMounted: firstThumbnail.isMounted,
- pixelHeightPx: firstThumbnail.pixelHeightPx,
- pixelWidthPx: firstThumbnail.pixelWidthPx,
- status: firstThumbnail.status,
- })
- }, [firstThumbnail])
-
const thumbnailIsLoading =
isLoading ||
(!thumbnailRenderState && !hasError) ||
@@ -324,12 +313,16 @@ function XlsxThumbnailPreview({
const [imageUrl, setImageUrl] = React.useState<string | null>(null)
const [hasError, setHasError] = React.useState(false)
- React.useEffect(() => {
- let isCurrent = true
-
+ const [previousInputs, setPreviousInputs] = React.useState({ file })
+ if (previousInputs.file !== file) {
+ setPreviousInputs({ file })
setWorkbookBuffer(null)
setImageUrl(null)
setHasError(false)
+ }
+
+ React.useEffect(() => {
+ let isCurrent = true
void fetch(file.url)
.then(async (response) => {
diff --git a/apps/v4/components/highlighted-code-block.tsx b/apps/v4/components/highlighted-code-block.tsx
index 57afd12..83c1359 100644
--- a/apps/v4/components/highlighted-code-block.tsx
+++ b/apps/v4/components/highlighted-code-block.tsx
@@ -16,6 +16,7 @@ import {
import { useTheme } from "next-themes"
import { cn } from "@/lib/utils"
+import { useMounted } from "@/hooks/use-mounted"
import { ScrollArea } from "@/components/ui/scroll-area"
import { CopyButton } from "@/components/copy-button"
@@ -150,11 +151,7 @@ function ScrollAreaVirtualizer({
function useCodeThemeType(): CodeThemeType {
const { resolvedTheme } = useTheme()
- const [isMounted, setIsMounted] = React.useState(false)
-
- React.useEffect(() => {
- setIsMounted(true)
- }, [])
+ const isMounted = useMounted()
return isMounted && resolvedTheme === "dark" ? "dark" : "light"
}
@@ -344,7 +341,12 @@ export function HighlightedCodeBlock({
scrollResetKey?: React.Key
useScrollArea?: boolean
}) {
- const [isVisible, setIsVisible] = React.useState(!lazy)
+ const [hasIntersected, setIsVisible] = React.useState(false)
+ const isMounted = useMounted()
+ const isVisible =
+ !lazy ||
+ hasIntersected ||
+ (isMounted && !("IntersectionObserver" in window))
const [renderedCodeKey, setRenderedCodeKey] = React.useState<string | null>(
null
)
@@ -374,8 +376,14 @@ export function HighlightedCodeBlock({
const hasRenderedCode = renderedCodeKey === codeRenderKey
const shouldShowFallback = renderFallbackCode && isVisible && !hasRenderedCode
- React.useLayoutEffect(() => {
+ const [previousCodeRenderKey, setPreviousCodeRenderKey] =
+ React.useState(codeRenderKey)
+ if (previousCodeRenderKey !== codeRenderKey) {
+ setPreviousCodeRenderKey(codeRenderKey)
setRenderedCodeKey(null)
+ }
+
+ React.useLayoutEffect(() => {
pendingScrollResetKeyRef.current = codeRenderKey
const container = containerRef.current
@@ -427,18 +435,12 @@ export function HighlightedCodeBlock({
)
React.useEffect(() => {
- if (!lazy) {
- setIsVisible(true)
- return
- }
+ if (!lazy) return
const container = containerRef.current
if (!container) return
- if (!("IntersectionObserver" in window)) {
- setIsVisible(true)
- return
- }
+ if (!("IntersectionObserver" in window)) return
const observer = new IntersectionObserver(
([entry]) => {
diff --git a/apps/v4/components/layout-blocks-docs.tsx b/apps/v4/components/layout-blocks-docs.tsx
index 4521a8b..a14023f 100644
--- a/apps/v4/components/layout-blocks-docs.tsx
+++ b/apps/v4/components/layout-blocks-docs.tsx
@@ -8502,13 +8502,9 @@ export function OcrBlocksBlock({
activeBlockIdRef.current = activeBlockId
}, [activeBlockId])
- React.useEffect(() => {
- if (!blocks.length || blocks.some((block) => block.id === activeBlockId)) {
- return
- }
-
+ if (blocks.length && !blocks.some((block) => block.id === activeBlockId)) {
setActiveBlockId(blocks[0].id)
- }, [activeBlockId, blocks])
+ }
const focusBlock = React.useCallback((block: OcrBlock) => {
if (block.id === activeBlockIdRef.current) return
diff --git a/apps/v4/components/pdf-editor-docs.tsx b/apps/v4/components/pdf-editor-docs.tsx
index 5f733ef..10efec6 100644
--- a/apps/v4/components/pdf-editor-docs.tsx
+++ b/apps/v4/components/pdf-editor-docs.tsx
@@ -4,6 +4,7 @@ import * as React from "react"
import dynamic from "next/dynamic"
import { cn } from "@/lib/utils"
+import { useMounted } from "@/hooks/use-mounted"
import { Spinner } from "@/components/ui/spinner"
import { DocsViewCodeBlock } from "@/components/docs-code-block"
@@ -104,17 +105,17 @@ export function PdfEditorBlock({
}
export function PdfEditorSource() {
- const [shouldLoadSource, setShouldLoadSource] = React.useState(false)
+ const [hasIntersected, setShouldLoadSource] = React.useState(false)
+ const isMounted = useMounted()
+ const shouldLoadSource =
+ hasIntersected || (isMounted && !("IntersectionObserver" in window))
const containerRef = React.useRef<HTMLDivElement | null>(null)
React.useEffect(() => {
const container = containerRef.current
if (!container) return
- if (!("IntersectionObserver" in window)) {
- setShouldLoadSource(true)
- return
- }
+ if (!("IntersectionObserver" in window)) return
const observer = new IntersectionObserver(
([entry]) => {
diff --git a/apps/v4/components/pdf-viewer-blocks.tsx b/apps/v4/components/pdf-viewer-blocks.tsx
index 3d63b37..61faad8 100644
--- a/apps/v4/components/pdf-viewer-blocks.tsx
+++ b/apps/v4/components/pdf-viewer-blocks.tsx
@@ -290,19 +290,12 @@ function PdfViewerBlockPreview({
return () => window.clearTimeout(timer)
}, [isCommandCopied])
- React.useEffect(() => {
- if (!codeSamples.length) {
- setActiveFile(null)
- return
- }
-
- if (
- !activeFile ||
- !codeSamples.some((sample) => sample.targetPath === activeFile)
- ) {
- setActiveFile(codeSamples[0]?.targetPath ?? null)
- }
- }, [activeFile, codeSamples])
+ const validActiveFile = codeSamples.some(
+ (sample) => sample.targetPath === activeFile
+ )
+ ? activeFile
+ : (codeSamples[0]?.targetPath ?? null)
+ if (activeFile !== validActiveFile) setActiveFile(validActiveFile)
async function copyInstallCommand() {
const copied = await copyToClipboardWithMeta(block.command, {
@@ -456,16 +449,16 @@ function PdfViewerBlockPreview({
function useLazyBlockPreview() {
const [node, setNode] = React.useState<HTMLElement | null>(null)
- const [shouldMountPreview, setShouldMountPreview] = React.useState(false)
+ const [hasIntersected, setShouldMountPreview] = React.useState(false)
+ const isMounted = useMounted()
+ const shouldMountPreview =
+ hasIntersected || (isMounted && !("IntersectionObserver" in window))
React.useEffect(() => {
if (shouldMountPreview) return
if (!node) return
- if (!("IntersectionObserver" in window)) {
- setShouldMountPreview(true)
- return
- }
+ if (!("IntersectionObserver" in window)) return
const observer = new IntersectionObserver(
([entry]) => {
diff --git a/apps/v4/components/pdf-viewer-docs.tsx b/apps/v4/components/pdf-viewer-docs.tsx
index 3eab1ca..37698e8 100644
--- a/apps/v4/components/pdf-viewer-docs.tsx
+++ b/apps/v4/components/pdf-viewer-docs.tsx
@@ -12,17 +12,18 @@ import {
} from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"
+import { useMounted } from "@/hooks/use-mounted"
import { Button } from "@/components/ui/button"
import { Select, SelectTrigger, SelectValue } from "@/components/ui/select"
-import { Spinner } from "@/components/ui/spinner"
-import { DocsViewCodeBlock } from "@/components/docs-code-block"
import { Separator } from "@/components/ui/separator"
+import { Spinner } from "@/components/ui/spinner"
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip"
+import { DocsViewCodeBlock } from "@/components/docs-code-block"
function ToolbarTooltip({
label,
@@ -213,17 +214,17 @@ export function PdfViewerDemo() {
}
export function PdfViewerSource() {
- const [shouldLoadSource, setShouldLoadSource] = React.useState(false)
+ const [hasIntersected, setShouldLoadSource] = React.useState(false)
+ const isMounted = useMounted()
+ const shouldLoadSource =
+ hasIntersected || (isMounted && !("IntersectionObserver" in window))
const containerRef = React.useRef<HTMLDivElement | null>(null)
React.useEffect(() => {
const container = containerRef.current
if (!container) return
- if (!("IntersectionObserver" in window)) {
- setShouldLoadSource(true)
- return
- }
+ if (!("IntersectionObserver" in window)) return
const observer = new IntersectionObserver(
([entry]) => {
diff --git a/apps/v4/components/root-liquid-logo.tsx b/apps/v4/components/root-liquid-logo.tsx
index d96fe3c..35f81d9 100644
--- a/apps/v4/components/root-liquid-logo.tsx
+++ b/apps/v4/components/root-liquid-logo.tsx
@@ -7,6 +7,7 @@ import { useTheme } from "next-themes"
import { cn } from "@/lib/utils"
import { withUiBasePath } from "@/lib/zone-path"
import { useMediaQuery } from "@/hooks/use-media-query"
+import { useMounted } from "@/hooks/use-mounted"
const SMOKE_COLORS = ["#004CFF", "#FF8C00", "#FFB066", "#FFD29A"]
@@ -18,11 +19,7 @@ export function RootLiquidLogo({ className }: { className?: string }) {
const isMobileViewport = useMediaQuery("max-md")
const isCoarsePointer = useMediaQuery({ pointer: "coarse" })
const prefersReducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)")
- const [isMounted, setIsMounted] = React.useState(false)
-
- React.useEffect(() => {
- setIsMounted(true)
- }, [])
+ const isMounted = useMounted()
const isDarkMode = isMounted && resolvedTheme === "dark"
const shouldUseLayeredBloom =
diff --git a/apps/v4/components/ui/color-picker.tsx b/apps/v4/components/ui/color-picker.tsx
index 84e3dff..bd801a9 100644
--- a/apps/v4/components/ui/color-picker.tsx
+++ b/apps/v4/components/ui/color-picker.tsx
@@ -677,34 +677,54 @@ export function ColorPicker({
}
})
const [format, setFormat] = React.useState<ColorFormat>(defaultFormat)
- const lastCommitAtRef = React.useRef(0)
+ const [controlledValue, setControlledValue] = React.useState({
+ value,
+ showAlpha,
+ pending: [] as string[],
+ })
const triggerGroupRef = React.useRef<HTMLDivElement>(null)
- React.useEffect(() => {
- if (!value) return
- // User input wins over delayed controlled-value echoes.
- if (Date.now() - lastCommitAtRef.current < 400) return
- const parsed = parseColorInput(value, "hex")
- if (!parsed) return
- setPicker((prev) => {
- // Preserve opacity when the parent stores only RGB.
- const alpha = showAlpha ? (parsed.alpha ?? prev.a) : 1
- // Preserve unrounded channel precision.
- if (rgbaToHex(prev.rgb, prev.a) === rgbaToHex(parsed.rgb, alpha))
- return prev
- const derived = rgbToOklchPlane(parsed.rgb, prev.plane.h)
- return {
- plane: withHueContinuity(derived, prev.plane.h, derived.s / 100),
- rgb: parsed.rgb,
- a: alpha,
- }
+ if (
+ controlledValue.value !== value ||
+ controlledValue.showAlpha !== showAlpha
+ ) {
+ const parsed = value ? parseColorInput(value, "hex") : null
+ const alpha = showAlpha ? (parsed?.alpha ?? picker.a) : 1
+ const incoming = parsed ? rgbaToHex(parsed.rgb, alpha) : null
+ const echoIndex =
+ incoming === null ? -1 : controlledValue.pending.lastIndexOf(incoming)
+ setControlledValue({
+ value,
+ showAlpha,
+ pending:
+ echoIndex < 0 ? [] : controlledValue.pending.slice(echoIndex + 1),
})
- }, [value, showAlpha])
+ if (
+ parsed &&
+ (echoIndex < 0 ||
+ echoIndex === controlledValue.pending.length - 1 ||
+ controlledValue.showAlpha !== showAlpha)
+ ) {
+ if (rgbaToHex(picker.rgb, picker.a) !== incoming) {
+ const derived = rgbToOklchPlane(parsed.rgb, picker.plane.h)
+ setPicker({
+ plane: withHueContinuity(derived, picker.plane.h, derived.s / 100),
+ rgb: parsed.rgb,
+ a: alpha,
+ })
+ }
+ }
+ }
const applyState = (next: { plane: HsvColor; rgb: RgbColor; a: number }) => {
setPicker(next)
- lastCommitAtRef.current = Date.now()
const hex = rgbaToHex(next.rgb, next.a)
+ if ((valueProp !== undefined || color !== undefined) && onChange) {
+ setControlledValue((current) => ({
+ ...current,
+ pending: [...current.pending, hex],
+ }))
+ }
onChange?.(hex)
}
@@ -724,9 +744,9 @@ export function ColorPicker({
const hsva: HsvaColor = { ...picker.plane, a: picker.a }
const rgb = picker.rgb
// Preserve hue for achromatic colors.
- const srgbHueRef = React.useRef(0)
- const displayHsv = rgbToHsv(rgb, srgbHueRef.current)
- srgbHueRef.current = displayHsv.h
+ const [srgbHue, setSrgbHue] = React.useState(0)
+ const displayHsv = rgbToHsv(rgb, srgbHue)
+ if (srgbHue !== displayHsv.h) setSrgbHue(displayHsv.h)
const hsl = hsvToHsl(displayHsv)
const rawOklch = rgbToOklch(rgb, hsva.h)
const oklch = withHueContinuity(rawOklch, hsva.h, rawOklch.c / 0.33)
diff --git a/apps/v4/content/docs/(root)/index.mdx b/apps/v4/content/docs/(root)/index.mdx
index 627da52..dacfc3b 100644
--- a/apps/v4/content/docs/(root)/index.mdx
+++ b/apps/v4/content/docs/(root)/index.mdx
@@ -22,6 +22,10 @@ The document-specific React components are maintained in Extend UI. This site us
Configure the style-aware registry in `components.json`:
+If your existing `@extend` URL ends in `/r/{name}.json`, replace it with the
+URL below. That older endpoint always serves Base UI components, even when
+your project's `style` is Radix.
+
```json
{
"registries": {
diff --git a/apps/v4/content/docs/components/pdf-editor.mdx b/apps/v4/content/docs/components/pdf-editor.mdx
index 6825eb3..e9b8ea5 100644
--- a/apps/v4/content/docs/components/pdf-editor.mdx
+++ b/apps/v4/content/docs/components/pdf-editor.mdx
@@ -62,7 +62,7 @@ prop for your library.
</Step>
```bash
-npx shadcn@latest add @extend/color-picker @extend/document-viewer-sidebar
+npx shadcn@latest add @extend/color-picker @extend/document-viewer-sidebar resizable
```
<Step>Copy and paste the following files into your project.</Step>
@@ -96,6 +96,8 @@ The ribbon below the main toolbar switches between five modes. Each mode exposes
- Undo and redo cover annotations, form edits, and redaction marks through the history plugin.
- The left sidebar hosts thumbnails, the bookmark outline, embedded attachments, and a page organizer that rotates, reorders, inserts, deletes, extracts, and appends pages.
- The right panel hosts annotation properties, comment threads, pending redactions, rubber stamp libraries, saved signatures, and form fields.
+- Drag either panel border to resize it. The left panel ranges from 14rem to 28rem and the right from 21rem to 32rem. A tapered 1px border indicator appears on hover, keyboard focus, or while dragging. The page organizer adds evenly sized columns as its panel widens.
+- The toolbar and mode ribbon remain visible and disabled while a document loads; only the document area shows loading, error, or password states.
- The document menu covers download, print, capture, full screen, document properties, password protection and permissions, flattening, and annotation JSON import and export.
- Uploaded files replace the current document. Page operations, flattening, and encryption changes are written into the PDF bytes returned by `getDocumentBuffer` and `download`.
diff --git a/apps/v4/content/docs/components/xlsx-viewer.mdx b/apps/v4/content/docs/components/xlsx-viewer.mdx
index 01ceee5..7e13c4e 100644
--- a/apps/v4/content/docs/components/xlsx-viewer.mdx
+++ b/apps/v4/content/docs/components/xlsx-viewer.mdx
@@ -11,6 +11,10 @@ The React Excel Viewer is the core spreadsheet preview for XLSX workbooks, finan
## Installation
+First configure the [style-aware registry](/docs#installation) in
+`components.json`. Its URL must include `{style}` so the CLI installs the
+Base UI or Radix version that matches your project.
+
<CodeTabs>
<TabsList>
diff --git a/apps/v4/eslint.config.mjs b/apps/v4/eslint.config.mjs
index e6e3796..0b24068 100644
--- a/apps/v4/eslint.config.mjs
+++ b/apps/v4/eslint.config.mjs
@@ -1,4 +1,5 @@
import nextVitals from "eslint-config-next/core-web-vitals"
+import reactHooks from "eslint-plugin-react-hooks"
import tseslint from "typescript-eslint"
const eslintConfig = tseslint.config(
@@ -7,7 +8,12 @@ const eslintConfig = tseslint.config(
...nextVitals.map((config) =>
config.name === "next/typescript"
? { ...config, plugins: {} }
- : config
+ : config.plugins?.["react-hooks"]
+ ? {
+ ...config,
+ plugins: { ...config.plugins, "react-hooks": reactHooks },
+ }
+ : config
),
...tseslint.configs.recommended,
{
@@ -38,6 +44,14 @@ const eslintConfig = tseslint.config(
],
},
},
+ {
+ files: [
+ "components/**/*.{ts,tsx}",
+ "hooks/**/*.{ts,tsx}",
+ "registry/**/*.{ts,tsx}",
+ ],
+ rules: reactHooks.configs.flat.recommended.rules,
+ }
)
export default eslintConfig
diff --git a/apps/v4/hooks/use-mounted.ts b/apps/v4/hooks/use-mounted.ts
index 3a20c62..e0c6022 100644
--- a/apps/v4/hooks/use-mounted.ts
+++ b/apps/v4/hooks/use-mounted.ts
@@ -1,11 +1,11 @@
import * as React from "react"
-export function useMounted() {
- const [mounted, setMounted] = React.useState(false)
-
- React.useEffect(() => {
- setMounted(true)
- }, [])
+const subscribe = () => () => {}
- return mounted
+export function useMounted() {
+ return React.useSyncExternalStore(
+ subscribe,
+ () => true,
+ () => false
+ )
}
diff --git a/apps/v4/package.json b/apps/v4/package.json
index 31736a8..86ec10c 100644
--- a/apps/v4/package.json
+++ b/apps/v4/package.json
@@ -86,6 +86,7 @@
"nuqs": "^2.8.9",
"papaparse": "^5.5.3",
"pdf-lib": "^1.17.1",
+ "radix-ui": "^1.4.3",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-markdown": "^10.1.0",
@@ -112,9 +113,11 @@
"babel-plugin-react-compiler": "^1.0.0",
"eslint": "^9",
"eslint-config-next": "16.2.10",
+ "eslint-plugin-react-hooks": "7.1.1",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.7.2",
"tailwindcss": "^4",
+ "ts-morph": "27.0.2",
"tw-animate-css": "^1.4.0",
"typescript": "^5",
"typescript-eslint": "^8.59.1"
diff --git a/apps/v4/registry.json b/apps/v4/registry.json
index 5121550..cf8de21 100644
--- a/apps/v4/registry.json
+++ b/apps/v4/registry.json
@@ -686,7 +686,7 @@
"@embedpdf/plugin-zoom@^2.15.0",
"pdf-lib@^1.17.1"
],
- "registryDependencies": ["@extend/document-viewer-sidebar"],
+ "registryDependencies": ["@extend/document-viewer-sidebar", "resizable"],
"categories": ["documents"],
"files": [
{
@@ -694,6 +694,11 @@
"type": "registry:ui",
"target": "@components/extend/pdf-editor.tsx"
},
+ {
+ "path": "components/extend/pdf-editor-workspace.tsx",
+ "type": "registry:ui",
+ "target": "@components/extend/pdf-editor-workspace.tsx"
+ },
{
"path": "components/extend/pdf-editor-shared.tsx",
"type": "registry:ui",
diff --git a/apps/v4/registry/bases/base/document-scroll-area.tsx b/apps/v4/registry/bases/base/document-scroll-area.tsx
index c9f2880..2670e7b 100644
--- a/apps/v4/registry/bases/base/document-scroll-area.tsx
+++ b/apps/v4/registry/bases/base/document-scroll-area.tsx
@@ -4,6 +4,10 @@ import * as React from "react"
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
import { cn } from "@/lib/utils"
+import {
+ ScrollArea as NativeScrollArea,
+ ScrollBar,
+} from "@/components/ui/scroll-area"
type ScrollAreaProps = ScrollAreaPrimitive.Root.Props & {
orientation?: "vertical" | "horizontal" | "both"
@@ -37,6 +41,32 @@ export function ScrollArea({
[viewportPropsRef, viewportRef]
)
+ if (
+ !viewportProps &&
+ !viewportRef &&
+ !viewportClassName &&
+ !scrollFade &&
+ !scrollbarGutter &&
+ !scrollbarOverflowOnly
+ ) {
+ return (
+ <NativeScrollArea
+ {...props}
+ className={cn(
+ "size-full min-h-0",
+ orientation === "horizontal" &&
+ "[&>[data-orientation=vertical]]:hidden",
+ className
+ )}
+ >
+ {children}
+ {orientation !== "vertical" ? (
+ <ScrollBar orientation="horizontal" />
+ ) : null}
+ </NativeScrollArea>
+ )
+ }
+
return (
<ScrollAreaPrimitive.Root
className={cn(
@@ -64,22 +94,10 @@ export function ScrollArea({
{children}
</ScrollAreaPrimitive.Viewport>
{orientation !== "horizontal" ? (
- <ScrollAreaPrimitive.Scrollbar
- data-slot="scroll-area-scrollbar"
- orientation="vertical"
- className="m-1 flex w-1.5"
- >
- <ScrollAreaPrimitive.Thumb className="relative flex-1 rounded-full bg-foreground/20" />
- </ScrollAreaPrimitive.Scrollbar>
+ <ScrollBar orientation="vertical" />
) : null}
{orientation !== "vertical" ? (
- <ScrollAreaPrimitive.Scrollbar
- data-slot="scroll-area-scrollbar"
- orientation="horizontal"
- className="m-1 flex h-1.5 flex-col"
- >
- <ScrollAreaPrimitive.Thumb className="relative flex-1 rounded-full bg-foreground/20" />
- </ScrollAreaPrimitive.Scrollbar>
+ <ScrollBar orientation="horizontal" />
) : null}
{orientation === "both" ? <ScrollAreaPrimitive.Corner /> : null}
</ScrollAreaPrimitive.Root>
diff --git a/apps/v4/registry/bases/radix/document-scroll-area.tsx b/apps/v4/registry/bases/radix/document-scroll-area.tsx
index 6350c20..12abff2 100644
--- a/apps/v4/registry/bases/radix/document-scroll-area.tsx
+++ b/apps/v4/registry/bases/radix/document-scroll-area.tsx
@@ -1,9 +1,13 @@
"use client"
import * as React from "react"
-import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
+import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
+import {
+ ScrollArea as NativeScrollArea,
+ ScrollBar,
+} from "@/components/ui/scroll-area"
type ScrollAreaProps = React.ComponentProps<typeof ScrollAreaPrimitive.Root> & {
orientation?: "vertical" | "horizontal" | "both"
@@ -68,6 +72,32 @@ export function ScrollArea({
}
}, [scrollFade])
+ if (
+ !viewportProps &&
+ !viewportRef &&
+ !viewportClassName &&
+ !scrollFade &&
+ !scrollbarGutter &&
+ !scrollbarOverflowOnly
+ ) {
+ return (
+ <NativeScrollArea
+ {...props}
+ className={cn(
+ "size-full min-h-0",
+ orientation === "horizontal" &&
+ "[&>[data-orientation=vertical]]:hidden",
+ className
+ )}
+ >
+ {children}
+ {orientation !== "vertical" ? (
+ <ScrollBar orientation="horizontal" />
+ ) : null}
+ </NativeScrollArea>
+ )
+ }
+
return (
<ScrollAreaPrimitive.Root
type={scrollbarOverflowOnly ? "auto" : "hover"}
@@ -92,22 +122,10 @@ export function ScrollArea({
{children}
</ScrollAreaPrimitive.Viewport>
{orientation !== "horizontal" ? (
- <ScrollAreaPrimitive.ScrollAreaScrollbar
- orientation="vertical"
- data-slot="scroll-area-scrollbar"
- className="m-1 flex w-1.5 touch-none select-none"
- >
- <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-foreground/20" />
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
+ <ScrollBar orientation="vertical" />
) : null}
{orientation !== "vertical" ? (
- <ScrollAreaPrimitive.ScrollAreaScrollbar
- orientation="horizontal"
- data-slot="scroll-area-scrollbar"
- className="m-1 flex h-1.5 touch-none flex-col select-none"
- >
- <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-foreground/20" />
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
+ <ScrollBar orientation="horizontal" />
) : null}
{orientation === "both" ? <ScrollAreaPrimitive.Corner /> : null}
</ScrollAreaPrimitive.Root>
diff --git a/apps/v4/registry/extend/document-controls.tsx b/apps/v4/registry/extend/document-controls.tsx
index c53fcdc..24632a6 100644
--- a/apps/v4/registry/extend/document-controls.tsx
+++ b/apps/v4/registry/extend/document-controls.tsx
@@ -27,11 +27,10 @@ export function Spinner({ className, ...props }: RegistryIconProps) {
export function DialogPanel({
className,
children,
- scrollFade = true,
...props
-}: React.ComponentProps<"div"> & { scrollFade?: boolean }) {
+}: React.ComponentProps<"div">) {
return (
- <ScrollArea scrollFade={scrollFade} className="min-h-0">
+ <ScrollArea className="min-h-0">
<div
data-slot="dialog-panel"
className={cn("min-h-0", className)}
diff --git a/apps/v4/registry/new-york-v4/blocks/bounding-box-citations-block.tsx b/apps/v4/registry/new-york-v4/blocks/bounding-box-citations-block.tsx
index 5cb07c6..c0011a5 100644
--- a/apps/v4/registry/new-york-v4/blocks/bounding-box-citations-block.tsx
+++ b/apps/v4/registry/new-york-v4/blocks/bounding-box-citations-block.tsx
@@ -59,10 +59,9 @@ export function HumanReviewBlock({
const activeLocation =
hoverLocation ?? getReviewFieldLocation(activeField, resolveFieldLocation)
- React.useEffect(() => {
- if (activeFieldKey || !fields[0]) return
+ if (!activeFieldKey && fields[0]) {
setActiveFieldKey(fields[0].key)
- }, [activeFieldKey, fields])
+ }
const focusField = React.useCallback(
(field: ReviewField) => {
diff --git a/apps/v4/registry/new-york-v4/blocks/document-splits-block.tsx b/apps/v4/registry/new-york-v4/blocks/document-splits-block.tsx
index af17fce..2fd7abe 100644
--- a/apps/v4/registry/new-york-v4/blocks/document-splits-block.tsx
+++ b/apps/v4/registry/new-york-v4/blocks/document-splits-block.tsx
@@ -26,9 +26,11 @@ export function DocumentSplitsBlock({
const viewerRef = React.useRef<PDFViewerHandle>(null)
const uploadedPdfUrlRef = React.useRef<string | null>(null)
- React.useEffect(() => {
+ const [previousFile, setPreviousFile] = React.useState(file)
+ if (!Object.is(previousFile, file)) {
+ setPreviousFile(file)
setPdfFile(file)
- }, [file])
+ }
React.useEffect(() => {
return () => {
diff --git a/apps/v4/registry/new-york-v4/blocks/e-signature.tsx b/apps/v4/registry/new-york-v4/blocks/e-signature.tsx
index 42de421..abf980a 100644
--- a/apps/v4/registry/new-york-v4/blocks/e-signature.tsx
+++ b/apps/v4/registry/new-york-v4/blocks/e-signature.tsx
@@ -124,11 +124,22 @@ function SignatureDialog({
[fieldBbox]
)
- React.useEffect(() => {
+ const [previousOpen, setPreviousOpen] = React.useState(open)
+ if (previousOpen !== open) {
+ setPreviousOpen(open)
if (!open) {
setGuideSize(null)
- return
+ setIsReady(false)
+ setHasSignature(false)
}
+ }
+ const canInitialize = Boolean(
+ open && guideSize && guideSize.width > 1 && guideSize.height > 1
+ )
+ if (!canInitialize && isReady) setIsReady(false)
+
+ React.useEffect(() => {
+ if (!open) return
let frameId = 0
let resizeObserver: ResizeObserver | null = null
@@ -191,10 +202,6 @@ function SignatureDialog({
if (!open || !guideSize || guideSize.width <= 1 || guideSize.height <= 1) {
signaturePadRef.current?.off()
signaturePadRef.current = null
- setIsReady(false)
- if (!open) {
- setHasSignature(false)
- }
return
}
diff --git a/apps/v4/registry/new-york-v4/blocks/layout-blocks-block.tsx b/apps/v4/registry/new-york-v4/blocks/layout-blocks-block.tsx
index e2d0352..64f452c 100644
--- a/apps/v4/registry/new-york-v4/blocks/layout-blocks-block.tsx
+++ b/apps/v4/registry/new-york-v4/blocks/layout-blocks-block.tsx
@@ -32,13 +32,9 @@ export function OcrBlocksBlock({
activeBlockIdRef.current = activeBlockId
}, [activeBlockId])
- React.useEffect(() => {
- if (!blocks.length || blocks.some((block) => block.id === activeBlockId)) {
- return
- }
-
+ if (blocks.length && !blocks.some((block) => block.id === activeBlockId)) {
setActiveBlockId(blocks[0].id)
- }, [activeBlockId, blocks])
+ }
const focusBlock = React.useCallback((block: OcrBlock) => {
if (block.id === activeBlockIdRef.current) return
diff --git a/apps/v4/registry/new-york-v4/hooks/use-mobile.ts b/apps/v4/registry/new-york-v4/hooks/use-mobile.ts
index 2b0fe1d..6465731 100644
--- a/apps/v4/registry/new-york-v4/hooks/use-mobile.ts
+++ b/apps/v4/registry/new-york-v4/hooks/use-mobile.ts
@@ -1,19 +1,17 @@
import * as React from "react"
-const MOBILE_BREAKPOINT = 768
+const MOBILE_QUERY = "(max-width: 767px)"
-export function useIsMobile() {
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
-
- React.useEffect(() => {
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
- const onChange = () => {
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
- }
- mql.addEventListener("change", onChange)
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
- return () => mql.removeEventListener("change", onChange)
- }, [])
+function subscribeToMobileQuery(listener: () => void) {
+ const query = window.matchMedia(MOBILE_QUERY)
+ query.addEventListener("change", listener)
+ return () => query.removeEventListener("change", listener)
+}
- return !!isMobile
+export function useIsMobile() {
+ return React.useSyncExternalStore(
+ subscribeToMobileQuery,
+ () => window.matchMedia(MOBILE_QUERY).matches,
+ () => false
+ )
}
diff --git a/apps/v4/registry/new-york-v4/ui/sidebar.tsx b/apps/v4/registry/new-york-v4/ui/sidebar.tsx
index 819f74f..342f1dd 100644
--- a/apps/v4/registry/new-york-v4/ui/sidebar.tsx
+++ b/apps/v4/registry/new-york-v4/ui/sidebar.tsx
@@ -659,10 +659,8 @@ export function SidebarMenuSkeleton({
}: React.ComponentProps<"div"> & {
showIcon?: boolean
}): React.ReactElement {
- // Random width between 50 to 90%.
- const width = React.useMemo(() => {
- return `${Math.floor(Math.random() * 40) + 50}%`
- }, [])
+ const id = React.useId()
+ const width = `${50 + (Array.from(id).reduce((sum, char) => sum + char.charCodeAt(0), 0) % 41)}%`
return (
<div
diff --git a/apps/v4/scripts/README.md b/apps/v4/scripts/README.md
index 6e1e362..89bc8a7 100644
--- a/apps/v4/scripts/README.md
+++ b/apps/v4/scripts/README.md
@@ -7,8 +7,11 @@ build time and formats separate Base and Radix artifacts in
Installed components import ordinary primitives directly from the consumer's
`components/ui` alias. Extend does not ship replacements for those primitives
-as document dependencies. Enhanced scrolling, color-picker positioning, loading
-buttons, and document notifications live in separately named Extend components.
+as document dependencies. The build inlines only the support code each component
+uses: document controls, enhanced scroll viewports, color-picker positioning, and
+icon prop types. Ordinary scrolling uses the consumer's ScrollArea; enhanced
+viewports reuse its ScrollBar. These helpers do not create additional installed
+files. Larger document components and document notifications remain shared entries.
The route `/r/styles/{style}/{name}.json` selects the family artifact and resolves
standard dependencies against the same upstream style. It does not translate
@@ -42,6 +45,8 @@ incompatible older primitive and dependency APIs; migrate it before installing.
`EXTEND_KEEP_FIXTURES=1` retains temporary projects for debugging.
`EXTEND_FIXTURE_FAMILY=base|radix` and `EXTEND_SKIP_STYLE_MATRIX=1` narrow a local
run; neither should be used for release validation.
+`EXTEND_FIXTURE_ITEMS=pdf-editor` limits CLI installation and icon probes to a
+comma-separated selection and its dependency closure for focused checks.
## Release
diff --git a/apps/v4/scripts/build-registry.mts b/apps/v4/scripts/build-registry.mts
index b7b4296..5ea5b4c 100644
--- a/apps/v4/scripts/build-registry.mts
+++ b/apps/v4/scripts/build-registry.mts
@@ -1,10 +1,13 @@
import { spawnSync } from "node:child_process"
-import { mkdir, readFile, writeFile } from "node:fs/promises"
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"
+import os from "node:os"
import path from "node:path"
import { format, resolveConfig } from "prettier"
import ts from "typescript"
+import { inlineRegistrySupport } from "./inline-registry-support.mts"
import { transformRegistrySource } from "./registry-source.mts"
+import { getRegistrySupport } from "./registry-support.mts"
type RegistryFile = {
path: string
@@ -23,10 +26,13 @@ type RegistryItem = {
const appRoot = process.cwd()
const outputRoot = path.join(appRoot, "public/r")
+const sourceRoot = await mkdtemp(
+ path.join(os.tmpdir(), "extend-registry-source-")
+)
const formatOptions = await resolveConfig(path.join(appRoot, "package.json"))
const build = spawnSync(
path.join(appRoot, "node_modules/.bin/shadcn"),
- ["build", "--output", "public/r"],
+ ["build", "--output", sourceRoot],
{ stdio: "inherit" }
)
if (build.status !== 0) process.exit(build.status ?? 1)
@@ -49,11 +55,12 @@ for (const item of registry.items)
}
for (const family of ["base", "radix"] as const) {
+ const support = await getRegistrySupport(appRoot, family)
const directory = path.join(outputRoot, "bases", family)
await mkdir(directory, { recursive: true })
for (const definition of registry.items) {
const item = JSON.parse(
- await readFile(path.join(outputRoot, `${definition.name}.json`), "utf8")
+ await readFile(path.join(sourceRoot, `${definition.name}.json`), "utf8")
) as RegistryItem
const dependencies = new Set(item.dependencies)
const registryDependencies = new Set(item.registryDependencies ?? [])
@@ -84,11 +91,21 @@ for (const family of ["base", "radix"] as const) {
const isDocumentSource =
file.target?.startsWith("@components/extend/") ||
file.target?.startsWith("@components/blocks/")
- if (isDocumentSource && /\.[jt]sx?$/.test(file.path))
- content = await format(transformRegistrySource(content, family), {
+ if (/\.[jt]sx?$/.test(file.path)) {
+ if (
+ isDocumentSource &&
+ !["document-scroll-area", "document-color-popover"].includes(
+ item.name
+ )
+ ) {
+ content = transformRegistrySource(content, family)
+ }
+ content = inlineRegistrySupport(content, support)
+ content = await format(content, {
...formatOptions,
filepath: path.join(appRoot, file.path),
})
+ }
const source = ts.createSourceFile(
file.path,
content,
@@ -158,9 +175,16 @@ for (const definition of registry.items) {
path.join(outputRoot, "bases/base", `${definition.name}.json`)
)
)
+ } else {
+ await writeFile(
+ path.join(outputRoot, `${definition.name}.json`),
+ await readFile(path.join(sourceRoot, `${definition.name}.json`))
+ )
}
}
+await rm(sourceRoot, { recursive: true, force: true })
+
console.log(
"Built Base and Radix registry artifacts with direct primitive imports."
)
diff --git a/apps/v4/scripts/check-extend-ui-registry.mts b/apps/v4/scripts/check-extend-ui-registry.mts
index 4ba5929..24d57e2 100644
--- a/apps/v4/scripts/check-extend-ui-registry.mts
+++ b/apps/v4/scripts/check-extend-ui-registry.mts
@@ -100,6 +100,12 @@ const publicItems = catalog
)
.map((item) => item.name)
assert(publicItems.includes("pdf-editor"))
+const selectedItems =
+ process.env.EXTEND_FIXTURE_ITEMS?.split(",") ?? publicItems
+assert(
+ selectedItems.every((name) => publicItems.includes(name)),
+ "Unknown fixture entry"
+)
const readItem = async (family: Family, name: string): Promise<RegistryItem> =>
JSON.parse(
await readFile(
@@ -113,8 +119,16 @@ async function iconProbe(
library: keyof typeof iconLibraries
): Promise<RegistryItem> {
const files = new Map<string, RegistryFile>()
- for (const definition of catalog) {
- for (const file of (await readItem(family, definition.name)).files ?? []) {
+ const visited = new Set<string>()
+ const include = async (name: string) => {
+ if (visited.has(name)) return
+ visited.add(name)
+ const item = await readItem(family, name)
+ for (const dependency of item.registryDependencies ?? []) {
+ if (dependency.startsWith("@extend/"))
+ await include(dependency.slice("@extend/".length))
+ }
+ for (const file of item.files ?? []) {
if (
file.target?.match(/^@components\/(extend|blocks)\//) &&
file.content?.includes("IconPlaceholder")
@@ -126,6 +140,7 @@ async function iconProbe(
}
}
}
+ for (const name of selectedItems) await include(name)
assert(files.size > 0)
return {
name: `icon-probe-${library}`,
@@ -218,6 +233,14 @@ async function checkFamily(family: Family) {
}
}
include(entry)
+ for (const support of [
+ "document-controls",
+ "document-scroll-area",
+ "document-color-popover",
+ "registry-icon-props",
+ ]) {
+ assert(!closure.has(support), `${entry} installs an inline support file`)
+ }
const dependencies = new Set(
[...closure.values()].flatMap((item) => item.registryDependencies ?? [])
)
@@ -227,6 +250,7 @@ async function checkFamily(family: Family) {
.map((name) => name.match(/^(@[^/]+\/[^@]+|[^@]+)/)![0])
)
const files = [...closure.values()].flatMap((item) => item.files ?? [])
+ if (entry === "xlsx-viewer") assert.equal(files.length, 1)
const modules = new Set(
files.map((file) =>
file.target
@@ -350,7 +374,7 @@ async function checkFamily(family: Family) {
const utilsBefore = await checksum(path.join(directory, "src/lib/utils.ts"))
await run(
shadcn,
- ["add", ...publicItems.map((name) => `@extend/${name}`), "-y"],
+ ["add", ...selectedItems.map((name) => `@extend/${name}`), "-y"],
directory,
true
)
@@ -390,7 +414,7 @@ async function checkFamily(family: Family) {
)
await run("npm", ["run", "build"], directory)
console.log(
- `PASS ${name}: all public components, all icon libraries, unchanged consumer primitives, production build`
+ `PASS ${name}: ${selectedItems.length} public entries, all icon libraries, unchanged consumer primitives, production build`
)
if (process.env.EXTEND_SKIP_STYLE_MATRIX === "1") return
const otherStyles = styles
diff --git a/apps/v4/scripts/inline-registry-support.mts b/apps/v4/scripts/inline-registry-support.mts
new file mode 100644
index 0000000..692666b
--- /dev/null
+++ b/apps/v4/scripts/inline-registry-support.mts
@@ -0,0 +1,175 @@
+import { Node, Project, SyntaxKind, type Statement } from "ts-morph"
+
+export function inlineRegistrySupport(
+ content: string,
+ modules: ReadonlyMap<string, string>
+) {
+ if (![...modules.keys()].some((name) => content.includes(`"${name}"`))) {
+ return content
+ }
+ const project = new Project({
+ useInMemoryFileSystem: true,
+ compilerOptions: { baseUrl: "/", paths: { "@/*": ["*"] } },
+ })
+ const helpers = new Map(
+ [...modules].map(([name, source]) => [
+ name,
+ project.createSourceFile(`${name.replace(/^@\//, "/")}.tsx`, source),
+ ])
+ )
+ const entry = project.createSourceFile("/entry.tsx", content)
+ const usedNames = new Set(
+ entry
+ .getDescendantsOfKind(SyntaxKind.Identifier)
+ .map((node) => node.getText())
+ )
+ const importedNames = new Map<string, string>()
+ for (const source of [entry, ...helpers.values()]) {
+ for (const declaration of source.getImportDeclarations()) {
+ const modulePath = declaration.getModuleSpecifierValue()
+ if (helpers.has(modulePath)) continue
+ const bindings = [
+ ...declaration.getNamedImports().map((specifier) => ({
+ imported: specifier.getName(),
+ local: specifier.getAliasNode()?.getText() ?? specifier.getName(),
+ rename: (name: string) => specifier.renameAlias(name),
+ })),
+ ...[declaration.getNamespaceImport()].flatMap((binding) =>
+ binding
+ ? [
+ {
+ imported: "*",
+ local: binding.getText(),
+ rename: (name: string) => binding.rename(name),
+ },
+ ]
+ : []
+ ),
+ ...[declaration.getDefaultImport()].flatMap((binding) =>
+ binding
+ ? [
+ {
+ imported: "default",
+ local: binding.getText(),
+ rename: (name: string) =>
+ declaration.renameDefaultImport(name),
+ },
+ ]
+ : []
+ ),
+ ]
+ for (const binding of bindings) {
+ const key = `${modulePath}:${binding.imported}`
+ let name = importedNames.get(key)
+ if (!name) {
+ name = binding.local
+ if (source !== entry && usedNames.has(name)) {
+ const prefix = `Inline${name}`
+ name = prefix
+ let suffix = 2
+ while (usedNames.has(name)) name = `${prefix}${suffix++}`
+ }
+ importedNames.set(key, name)
+ usedNames.add(name)
+ }
+ if (source !== entry && name !== binding.local) binding.rename(name)
+ }
+ }
+ }
+ for (const helper of helpers.values()) {
+ for (const statement of helper.getStatements()) {
+ const declarations = Node.isVariableStatement(statement)
+ ? statement.getDeclarations()
+ : Node.isFunctionDeclaration(statement) ||
+ Node.isTypeAliasDeclaration(statement) ||
+ Node.isInterfaceDeclaration(statement)
+ ? [statement]
+ : []
+ for (const declaration of declarations) {
+ const name = declaration.getName()
+ if (!name) continue
+ const prefix = name.startsWith("use")
+ ? `useInline${name.slice(3)}`
+ : `Inline${name[0].toUpperCase()}${name.slice(1)}`
+ let renamed = prefix
+ let suffix = 2
+ while (usedNames.has(renamed)) renamed = `${prefix}${suffix++}`
+ usedNames.add(renamed)
+ declaration.rename(renamed)
+ }
+ }
+ }
+
+ for (const source of [entry, ...helpers.values()]) {
+ for (const declaration of source.getImportDeclarations()) {
+ if (!helpers.has(declaration.getModuleSpecifierValue())) continue
+ for (const specifier of declaration.getNamedImports()) {
+ if (specifier.getAliasNode()) specifier.renameAlias(specifier.getName())
+ }
+ }
+ }
+
+ const selected = new Set<Statement>()
+ const imports = new Map<string, Set<string>>()
+ const include = (statement: Statement) => {
+ if (selected.has(statement)) return
+ selected.add(statement)
+ for (const identifier of statement.getDescendantsOfKind(
+ SyntaxKind.Identifier
+ )) {
+ const symbol = identifier.getSymbol()
+ for (const declaration of symbol?.getDeclarations() ?? []) {
+ const importDeclaration = declaration.getFirstAncestorByKind(
+ SyntaxKind.ImportDeclaration
+ )
+ if (importDeclaration) {
+ const modulePath = importDeclaration.getModuleSpecifierValue()
+ if (helpers.has(modulePath)) {
+ const target = symbol?.getAliasedSymbol()?.getDeclarations()[0]
+ if (target) includeDeclaration(target)
+ } else {
+ if (!imports.has(importDeclaration.getText()))
+ imports.set(importDeclaration.getText(), new Set())
+ imports.get(importDeclaration.getText())!.add(identifier.getText())
+ }
+ } else {
+ includeDeclaration(declaration)
+ }
+ }
+ }
+ }
+ const includeDeclaration = (node: Node) => {
+ if (![...helpers.values()].includes(node.getSourceFile())) return
+ let top = node
+ while (top.getParent() && !Node.isSourceFile(top.getParent()))
+ top = top.getParentOrThrow()
+ if (Node.isStatement(top) && !Node.isImportDeclaration(top)) include(top)
+ }
+ for (const declaration of entry.getImportDeclarations()) {
+ const helper = helpers.get(declaration.getModuleSpecifierValue())
+ if (!helper) continue
+ for (const specifier of declaration.getNamedImports()) {
+ const targets = helper.getExportedDeclarations().get(specifier.getName())
+ if (!targets?.length)
+ throw new Error(`Missing inline export ${specifier.getName()}`)
+ for (const target of targets) includeDeclaration(target)
+ }
+ declaration.remove()
+ }
+ for (const [text, used] of imports) {
+ const scratch = project.createSourceFile("/import.ts", text, {
+ overwrite: true,
+ })
+ const declaration = scratch.getImportDeclarations()[0]
+ for (const specifier of declaration.getNamedImports()) {
+ if (!used.has(specifier.getAliasNode()?.getText() ?? specifier.getName()))
+ specifier.remove()
+ }
+ entry.addStatements(declaration.getText())
+ }
+ for (const statement of selected) {
+ entry.addStatements(statement.getText().replace(/^export\s+/, ""))
+ }
+ entry.organizeImports()
+ return entry.getFullText()
+}
diff --git a/apps/v4/scripts/registry-source.mts b/apps/v4/scripts/registry-source.mts
index 83bbdbe..3f8ef02 100644
--- a/apps/v4/scripts/registry-source.mts
+++ b/apps/v4/scripts/registry-source.mts
@@ -23,6 +23,29 @@ export function transformRegistrySource(
true,
ts.ScriptKind.TSX
)
+ let needsEnhancedScrollArea = false
+ const inspectScrollArea = (node: ts.Node) => {
+ if (
+ (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) &&
+ node.tagName.getText(source) === "ScrollArea"
+ ) {
+ needsEnhancedScrollArea ||= node.attributes.properties.some(
+ (prop) =>
+ ts.isJsxSpreadAttribute(prop) ||
+ [
+ "viewportRef",
+ "viewportProps",
+ "viewportClassName",
+ "scrollFade",
+ "scrollbarGutter",
+ "scrollbarOverflowOnly",
+ "orientation",
+ ].includes(prop.name.getText(source))
+ )
+ }
+ ts.forEachChild(node, inspectScrollArea)
+ }
+ inspectScrollArea(source)
const f = ts.factory
const extraImports = new Map<string, Set<string>>()
let buttonProps = false
@@ -149,7 +172,11 @@ export function transformRegistrySource(
)
}
if (!imports.length) return undefined
- modulePath = customModules[modulePath] ?? modulePath
+ modulePath =
+ modulePath === "@/components/ui/scroll-area" &&
+ !needsEnhancedScrollArea
+ ? modulePath
+ : (customModules[modulePath] ?? modulePath)
return f.updateImportDeclaration(
node,
node.modifiers,
diff --git a/apps/v4/scripts/registry-source.test.mts b/apps/v4/scripts/registry-source.test.mts
index 1285286..e6295b4 100644
--- a/apps/v4/scripts/registry-source.test.mts
+++ b/apps/v4/scripts/registry-source.test.mts
@@ -1,13 +1,16 @@
import assert from "node:assert/strict"
import { readFileSync } from "node:fs"
import test from "node:test"
+import { ESLint } from "eslint"
import ts from "typescript"
import {
getRegistryFamily,
styleRegistryDependencies,
} from "../lib/registry-style.ts"
+import { inlineRegistrySupport } from "./inline-registry-support.mts"
import { transformRegistrySource } from "./registry-source.mts"
+import { getRegistrySupport } from "./registry-support.mts"
const source = `"use client"
import {Button} from "@/components/ui/button"
@@ -17,6 +20,63 @@ import {ToggleGroup, ToggleGroupItem} from "@/components/ui/toggle"
export function Controls() { return <><DialogTrigger render={<Button/>}>Open</DialogTrigger><DialogClose render={<Button>Close</Button>}/><DialogPanel>Body</DialogPanel><Select items={options}><SelectContent alignItemWithTrigger={false}><SelectItem value="one" label="One">One</SelectItem></SelectContent></Select><ToggleGroup value={values} onValueChange={setValues}><ToggleGroupItem value="one">One</ToggleGroupItem></ToggleGroup></> }`
for (const family of ["base", "radix"] as const) {
+ test(`${family} document components pass consumer effect linting`, async () => {
+ const registry = JSON.parse(
+ readFileSync(new URL("../registry.json", import.meta.url), "utf8")
+ ) as {
+ items: Array<{ files?: Array<{ path: string; target?: string }> }>
+ }
+ const paths = new Set(
+ registry.items.flatMap((item) =>
+ (item.files ?? [])
+ .filter(
+ (file) =>
+ file.target?.startsWith("@components/extend/") ||
+ file.target?.startsWith("@components/blocks/")
+ )
+ .map((file) => file.path)
+ )
+ )
+ const eslint = new ESLint({ cwd: new URL("..", import.meta.url).pathname })
+ const errors: string[] = []
+ const support = await getRegistrySupport(
+ new URL("..", import.meta.url).pathname,
+ family
+ )
+ for (const path of paths) {
+ const familyPath = path.startsWith("registry/bases/base/")
+ ? path.replace("/base/", `/${family}/`)
+ : family === "radix" &&
+ path === "components/extend/document-preview-card.tsx"
+ ? "registry/bases/radix/document-preview-card.tsx"
+ : path
+ const filename = new URL(`../${familyPath}`, import.meta.url)
+ const raw = readFileSync(filename, "utf8")
+ const transformed = /document-(scroll-area|color-popover)\.tsx$/.test(
+ familyPath
+ )
+ ? raw
+ : transformRegistrySource(raw, family)
+ const output = inlineRegistrySupport(transformed, support)
+ for (const name of support.keys())
+ assert(!output.includes(`from "${name}"`), `${path} imports ${name}`)
+ const results = await eslint.lintText(output, {
+ filePath: filename.pathname,
+ })
+ for (const result of results) {
+ errors.push(
+ ...result.messages
+ .filter((message) => message.severity === 2)
+ .map(
+ (message) =>
+ `${path}:${message.line}: ${message.ruleId}: ${message.message}`
+ )
+ )
+ }
+ }
+ assert.deepEqual(errors, [])
+ })
+
test(`${family} source keeps direct primitives and valid composition`, () => {
const output = transformRegistrySource(source, family)
assert.match(output, /import \{ Button \} from "@\/components\/ui\/button"/)
@@ -133,3 +193,76 @@ test("The icon-only color select uses popup positioning", () => {
assert.match(transformRegistrySource(source, "radix"), /position=\{/)
assert.doesNotMatch(source, /RiColorPickerLine/)
})
+
+test("Editor loading keeps the normal controls without a document-keyed remount", () => {
+ const source = readFileSync(
+ new URL("../components/extend/pdf-editor.tsx", import.meta.url),
+ "utf8"
+ )
+ assert.match(source, /<fieldset disabled=\{controlsDisabled\}/)
+ assert.match(
+ source,
+ /value=\{document \? registryState : EMPTY_EDITOR_CONTEXT\}/
+ )
+ assert.doesNotMatch(source, /PdfEditorFallbackShell|key=\{activeDocumentId\}/)
+ assert.match(source, /if \(controlsDisabled\) return/)
+})
+
+test("Editor panels use the consumer resizable primitive and preserve minimum sizes", () => {
+ const source = readFileSync(
+ new URL("../components/extend/pdf-editor-workspace.tsx", import.meta.url),
+ "utf8"
+ )
+ assert.match(source, /from "@\/components\/ui\/resizable"/)
+ assert.match(source, /minSize=\{side === "left" \? "14rem" : "21rem"\}/)
+ assert.match(source, /maxSize=\{side === "left" \? "28rem" : "32rem"\}/)
+ assert.match(source, /data-\[separator=hover\]/)
+ assert.match(source, /before:w-px/)
+ assert.match(source, /mask-image:linear-gradient/)
+ assert.doesNotMatch(source, /withHandle/)
+ assert.doesNotMatch(source, /data-\[separator=focus\]/)
+ const registry = JSON.parse(
+ readFileSync(new URL("../registry.json", import.meta.url), "utf8")
+ )
+ const core = registry.items.find(
+ (item: { name: string }) => item.name === "pdf-editor-core"
+ )
+ assert(core.registryDependencies.includes("resizable"))
+ assert(
+ core.files.some(
+ (file: { path: string }) =>
+ file.path === "components/extend/pdf-editor-workspace.tsx"
+ )
+ )
+})
+
+test("Inline support keeps only referenced helpers and preserves local bindings", () => {
+ const output = inlineRegistrySupport(
+ 'import { Spinner as Busy } from "@/components/extend/document-controls"; const InlineSpinner = 1; export function View() { return <Busy title={String(InlineSpinner)} /> }',
+ new Map([
+ [
+ "@/components/extend/document-controls",
+ 'import type * as React from "react"; export function Spinner(props: React.ComponentProps<"span">) { return <span {...props} /> }; export function Unused() { return <div/> }',
+ ],
+ ])
+ )
+ assert.doesNotMatch(output, /document-controls|function Unused/)
+ assert.match(output, /const InlineSpinner = 1/)
+ assert.match(output, /function InlineSpinner2/)
+ assert.match(output, /<InlineSpinner2 title=/)
+})
+
+test("Inline support separates conflicting primitive imports", () => {
+ const output = inlineRegistrySupport(
+ 'import { Popover } from "@/components/ui/popover"; import { Content as Panel } from "@/support"; export const View = () => <Popover><Panel /></Popover>',
+ new Map([
+ [
+ "@/support",
+ 'import { Popover } from "@base-ui/react/popover"; export const Content = () => <Popover.Popup />',
+ ],
+ ])
+ )
+ assert.match(output, /Popover as InlinePopover/)
+ assert.match(output, /<InlinePopover.Popup/)
+ assert.match(output, /<Popover><InlineContent/)
+})
diff --git a/apps/v4/scripts/registry-support.mts b/apps/v4/scripts/registry-support.mts
new file mode 100644
index 0000000..2f04682
--- /dev/null
+++ b/apps/v4/scripts/registry-support.mts
@@ -0,0 +1,41 @@
+import { readFile } from "node:fs/promises"
+import path from "node:path"
+
+import {
+ transformRegistrySource,
+ type PrimitiveFamily,
+} from "./registry-source.mts"
+
+export async function getRegistrySupport(
+ appRoot: string,
+ family: PrimitiveFamily
+) {
+ const files = [
+ [
+ "@/components/extend/document-controls",
+ "registry/extend/document-controls.tsx",
+ ],
+ [
+ "@/components/extend/document-scroll-area",
+ `registry/bases/${family}/document-scroll-area.tsx`,
+ ],
+ [
+ "@/components/extend/document-color-popover",
+ `registry/bases/${family}/document-color-popover.tsx`,
+ ],
+ ["@/lib/registry-icon-props", "lib/registry-icon-props.ts"],
+ ] as const
+ return new Map(
+ await Promise.all(
+ files.map(async ([name, file]) => {
+ const content = await readFile(path.join(appRoot, file), "utf8")
+ return [
+ name,
+ name.endsWith("document-controls")
+ ? transformRegistrySource(content, family)
+ : content,
+ ] as const
+ })
+ )
+ )
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9e8fad4..792efe2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -216,6 +216,9 @@ importers:
pdf-lib:
specifier: ^1.17.1
version: 1.17.1
+ radix-ui:
+ specifier: ^1.4.3
react:
specifier: 19.2.3
version: 19.2.3
@@ -289,6 +292,9 @@ importers:
eslint-config-next:
specifier: 16.2.10
+ eslint-plugin-react-hooks:
+ specifier: 7.1.1
prettier:
specifier: ^3.4.2
version: 3.6.2
@@ -298,6 +304,9 @@ importers:
tailwindcss:
specifier: ^4
version: 4.1.18
+ ts-morph:
+ specifier: 27.0.2
+ version: 27.0.2
tw-animate-css:
specifier: ^1.4.0
version: 1.4.0
@@ -1923,6 +1932,45 @@ packages:
'@radix-ui/[email protected]':
resolution: {integrity: sha512-rqWnm76nYT8HoNNqEjpgJ7Pw/DrBj5iBTrmEPo6HTX5+VJyBNOqTdv4g89G63HuR5g0AaENoAcH7Is5fF2kZ8Q==}
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-WTQwcAvQf5sOcuUyi90lKPbhwcvQ+j55cjrSmeaN+L2vKU3DooOvlKw2MDeiJ5IkV5N905KW0/fGojKOBhD11A==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-jDhG9FvAEnlhnjrsINbNXcUa4G+L1KqSkJSunkbKEzFRcAb52jvM0PjPxPRvhe1HNc5F5yc0yzzWeeqlH4yBIg==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-VAYOiQRqj3GPpYJE0I9J+X8Ip05cyVlNdKOFeiGS2Ou1HHGfpl0BxOyZm6nmVDyU+W+NF3/XLzmjHmVGydhwgA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-v4zggRcjadnI+ClKDuijlQEW4tw3NoaeHc/PwpKnLoLLKNUG4InLegkstooLcRIUWCs+8L22dGURCVuFfOKfnA==}
peerDependencies:
@@ -1936,6 +1984,58 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-fy+dyVR+90nelK8rqIznFlxzx7uPcGbhxH8Nfr2bHb4UfSe+e3hklOC0luK0hDwVwnRX7xTRySpsrQVeW+/oNQ==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-4ULOTJ/mqy2hT9GlWa/MFHxHSvH3nJzHnZM1waNsc5Bonv7i70aNenghXmD97S6OJ81ekXONGGt4nT1r0PfEdA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-Gnptr9pDDQxD3hgq2dtPbtrp/c2qH1mBwIzw3X/ivrMb2e1t0jMTi606fVEqFPaQR1ggXIVQWKj3P2WW9v7zGQ==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-mcGesGplBnzN2sbvJETzpCNfSMyPnb29q1GRLU+Ib7bJrpIG2ywmRoh2V5VbA2uNvKikKUlVbAPks7JDjz4A8Q==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-9W+B9NPF0NaaPh/1NJd3+KqsnlLqU9H7T2rvww+fp+T/evVXdNAyYcnfRQZFOjkR1ajQp3yORlqnI8soawLvNA==}
peerDependencies:
@@ -1967,6 +2067,19 @@ packages:
'@types/react':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-CtXP35dxaB5T3zXSd+E3uHe/QpXcpYnZmxp6OaIbfthtfW4wyb77M23BG+bwIJDtsMwEP/YssdsmNyZu7jhWew==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-jCi/QKUM2r1Ju5a3J64TH2A5SpKAgh0LpknyqdQ4m6DCV0xJ2HG1xARRwNGPQfi1SLdLWZ1OJz6F4OMBBNiGJA==}
peerDependencies:
@@ -1998,6 +2111,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-Ksw4WeROkO4rC9k/onilX/Ao2Cr1ku1unMNH+XSCcP4jSXYu7HDsg9n4ojMjVb22XpYjAQ9qfrFlVbru1vXDUA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-5pzg4FGQNpExhnhT2zlrP1wZFaYCd1K0nYWoFAdcYoYK868IEigqMX3B3f8yIoRlAhAeDWciLI6ZdCKHF9P4Vg==}
peerDependencies:
@@ -2033,6 +2159,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-geq8l2rJkxvkXsT9RMgtUE3P8pITFpTsvYpbySi1IH4fZEABD/Gp85myayFgxk0ktljGMJnCbeFkyTusvSvv7g==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-0rFg/Rj2Q62NCm62jZw0QX7a3sz6QCQU0LpZdNrJX8byRGaGVTqbrW9jAoIAHyMQqsNpeZ81YgSizOt5WXq0Pw==}
peerDependencies:
@@ -2077,6 +2216,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-Q4TLEn2A7TAypxwmd6R9EwrlXDvkfYSDMrq9/887AXAGh+G1rH+kYJKSTv+Si9Y0JPKTwKYv6PviAJosysNimA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-H8qONfZd3ltrU3+jHCIgITbWo6e1iTKvP9DHdrvYbX48ooRM5FjEDTn16AMwdfuOGkWdZEhpl3PLL/Wk/AnHDQ==}
peerDependencies:
@@ -2108,6 +2260,84 @@ packages:
'@types/react':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-o/rdYEwZTTo5tjknnPeyQFU45kUC4i/XyeDPP+HGyi6XqpOP6Zf5Ya5vh/Yfe9Id5JiuWnnAx2XqIeD3UYZt0g==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-uW7RVuU6Lp/ZtfeY4b3kL32zccgEWvPv1+cf17ubYzHa9cL8AHokmk36cG/XEiH/smbQvumnieXX9j/e9RqJWA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-eeVs0vf7cuqXaM0qLQCPcufImiJNVBXdJDLu7ZGYl2732UH23Qat/foNGrr6vYV3/DdTsBqASoggUFgH14OcZA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-ou7iLEJ+yrhQndkkA4U21XIdS/CS45F4iXIkTZcb6/Ne9EMsOuDudVmCwmDnfFZZ+y1FZqXRNSIgBy+YMvZVZg==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-Tj9P6ntAJEw52oq/F0AGknXR4XncxEt7XU47O3xJQOiWfLzEy3d9gtgKfvjSzGxzHkfL+VzvxGu2KTFsloJqXw==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-4gvFnmDXu3dgj21CqsufzIameRvlRd4SBqaWhcrlrNhRo0Y5i/49AmRJYe1fdAM3G2VNBbmin4b0D6cdQocwgw==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-mw58MrBlyHWFisTOYignD0vf/3gdcgAR+9of1s9G/38CbFiUwH1nCDkc0AUM9IrXFgN5Ue8n45j9WCgyM1sbiQ==}
peerDependencies:
@@ -2225,6 +2455,45 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-5XnomAsoZZCY+KNTxbIghpGqPruZvKFNlvcAljVAOdDRDsH4/OZQxhtwo5wdtoDM5R6MhJBb2sPnDuRFep3lzg==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-cgYFEkntCxppHZgtSZ+7vh0wbZQ+IC7PPMw8DSnRG27B6kDd32/Zw0OJt7dGDigCoprMuWHjg2PvUn3PYvPFoQ==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-V9jI6hDjT7l3jsCQD9bLNvDLM3tH/gdbOTp7Tefp3hbbgCGQoK7tUvrWiRlcoBHIZ809ElXwNQwVo0B98LuTXQ==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-Zn5Cd171wxsO3Dfg8HaW6RifTb9CYTKQJHs/G4+LN1GfmJpaQMZQyQxMprVPHpaz7QY4l9BxK2JwQuzHsXC8nA==}
peerDependencies:
@@ -2251,32 +2520,149 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==}
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-jOLO4lssEzWpoDu7G+Ze4VjwMRUBt291pnZD0gmalREZipnTX3wadQo7Fy48GCTfe14/YRN6rw/rOJqrE85Wxw==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-mTSLf1GC/C0moWjTbvCM6Qn/gBjvlFt1azuWF2v7MN5C3Zq2U2J2lN3ZEYkpujuOU5Ro7A28wkviSxaKnG0BYg==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-Jl+bCv8HxKnlTLVrcDE8zTMJ09R9/ukw4qBs/oZClOfoQk/cOTbDn+NceXfV7j09YPVQUryJPHurafcSg6EVKA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-qx7oqnYbxnK9kYI9m317qmFmEgo6ywqWvbTogdj7cL9p3/yx4M48p7Rnw5z3H890cL/ow/EeWJsuTykeZVXP5Q==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-48tB/4dn2UVLBCYhTu9AuR63IHl73l/qLbLgxd86noTUor4/K4LFDAcYjK+isP5313qxaFpjPVogE7+Y0/V3Kw==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-UKxJlZid7FVtsk/WTxj4i4uSEgj2Au+KBbS7SQyTlzMhhn+86Cz3tISZdTa87bfEfcuvZezf2ZsxD4xuEKtkog==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-ofhyAsYaocRGOs/n0XWdUOSVzEAG6BfrMVM8z0c0kLEWY38w/0WuMFPTJP/HVaZPYkMvHZoKIIhNcjbTCBILPg==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-OtnwuSVjd1Ofi+AdnvhsjQdyuhCDwYs1w9RyB5BN/OavXOVQo42SYqQjwUnbPnaiPFBpQ9aX70dWeee+v2oBLA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-7lonPlKfSacd20GlOBx2ltuVKz9oqWYZz+oMQyOltw6t1y2nyftj2ZmwwUHYn49kqfDWcp8dNZm5NgV+5Z+mug==}
peerDependencies:
'@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
'@types/react':
optional: true
+ '@types/react-dom':
+ optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-Jl+bCv8HxKnlTLVrcDE8zTMJ09R9/ukw4qBs/oZClOfoQk/cOTbDn+NceXfV7j09YPVQUryJPHurafcSg6EVKA==}
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-Ph0IvtYw4VB12ZnZg+YtrGs8yJQsnizwo/zu0R4Y/nWugtJzA7Pg1eWeuDR9+LSqn+xjamss+UOSOJJJ4gx8jw==}
peerDependencies:
'@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
'@types/react':
optional: true
+ '@types/react-dom':
+ optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-qx7oqnYbxnK9kYI9m317qmFmEgo6ywqWvbTogdj7cL9p3/yx4M48p7Rnw5z3H890cL/ow/EeWJsuTykeZVXP5Q==}
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-6EamKFRRnlpdadndbZ6LMwycfwkwPte1B42hs6QA0gYhjaOKqW4PZ4pjaW9UrlDX5eVt/OjncE7BFTPL5nmZhg==}
peerDependencies:
'@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
'@types/react':
optional: true
+ '@types/react-dom':
+ optional: true
'@radix-ui/[email protected]':
resolution: {integrity: sha512-FkBMwD+qbGQeMu1cOHnuGB6x4yzPjho8ap5WtbEJ26umhgqVXbhekKUQO+hZEL1vU92a3wHwdp0HAcqAUF5iDg==}
@@ -2341,6 +2727,24 @@ packages:
'@types/react':
optional: true
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-ge3ipobwSXTj4JyVtswQ7qZj0ZHdtbGuOno/LrgAAeSxtsJ6Vs4Gz5IkPH2bmqpjcLUFoqGhA/mueuIf63UXlA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
+ '@radix-ui/[email protected]':
+ resolution: {integrity: sha512-umO/aJ+82CpOnhDZUTbILCQf7kU/g0iv+oGs/Q8jw7IkhWBzaEP4sA268PhFAJTFetbwp3ICc6ktpI4TqtxcIw==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+
'@radix-ui/[email protected]':
resolution: {integrity: sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==}
peerDependencies:
@@ -2704,6 +3108,9 @@ packages:
'@ts-morph/[email protected]':
resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==}
+ '@ts-morph/[email protected]':
+ resolution: {integrity: sha512-W74iWf7ILp1ZKNYXY5qbddNaml7e9Sedv5lvU1V8lftlitkc9Pq1A+jlH23ltDgWYeZFFEqGCD1Ies9hqu3O+g==}
+
resolution: {integrity: sha512-VyyPYFlOMNylG45GoAe0xDoLwWuowvf92F9kySqzYh8vmYm7D2u4iUJKa1tOUpS70Ku13ASrOkS4ScXFsTaCNQ==}
@@ -3674,11 +4081,11 @@ packages:
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9
- resolution: {integrity: sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==}
+ resolution: {integrity: sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==}
engines: {node: '>=18'}
peerDependencies:
- eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
+ eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0
resolution: {integrity: sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==}
@@ -5241,6 +5648,19 @@ packages:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
+ resolution: {integrity: sha512-QBdhh1arIEUvPC0dQ5+nwWAxt7+N+oP/9jPwjJkGFoSk/sqxg32gJtSXGtFh8frAIcS6oC9cx2Q+7KYCQLOAeA==}
+ peerDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==}
engines: {node: '>= 0.6'}
@@ -5780,6 +6200,9 @@ packages:
resolution: {integrity: sha512-ztMO++owQnz8c/gIENcM9XfCEzgoGphTv+nKpYNM1bgsdOVC/jRZuEBf6N+mLLDNg68Kl+GgUZfOySaRiG1/Ug==}
+ resolution: {integrity: sha512-fhUhgeljcrdZ+9DZND1De1029PrE+cMkIP7ooqkLRTrRLTqcki2AstsyJm0vRNbTbVCNJ0idGlbBrfqc7/nA8w==}
+
resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==}
@@ -7614,6 +8037,45 @@ snapshots:
'@radix-ui/[email protected]': {}
+ dependencies:
+ '@radix-ui/react-visually-hidden': 1.2.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-collapsible': 1.1.20(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
@@ -7623,6 +8085,60 @@ snapshots:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
+ dependencies:
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-is-hydrated': 0.1.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
'@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
@@ -7647,6 +8163,19 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.2
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
react: 19.2.3
@@ -7681,6 +8210,29 @@ snapshots:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-focus-guards': 1.1.6(@types/[email protected])([email protected])
+ '@radix-ui/react-focus-scope': 1.1.16(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-slot': 1.3.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ aria-hidden: 1.2.6
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ react-remove-scroll: 2.7.2(@types/[email protected])([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
react: 19.2.3
@@ -7713,6 +8265,21 @@ snapshots:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
react: 19.2.3
@@ -7747,36 +8314,161 @@ snapshots:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
+ react: 19.2.3
+ optionalDependencies:
+ '@types/react': 19.2.2
+
+ dependencies:
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ optionalDependencies:
+ '@types/react': 19.2.2
+
+ dependencies:
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-focus-guards': 1.1.6(@types/[email protected])([email protected])
+ '@radix-ui/react-focus-scope': 1.1.16(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-slot': 1.3.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
+ aria-hidden: 1.2.6
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ react-remove-scroll: 2.7.2(@types/[email protected])([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.7
'@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
'@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
'@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
'@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
react: 19.2.3
react-dom: 19.2.3([email protected])
optionalDependencies:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
dependencies:
- '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/number': 1.1.3
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-effect-event': 0.0.5(@types/[email protected])([email protected])
+ '@radix-ui/react-use-is-hydrated': 0.1.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
react: 19.2.3
+ react-dom: 19.2.3([email protected])
optionalDependencies:
'@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
dependencies:
- '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-effect-event': 0.0.5(@types/[email protected])([email protected])
+ '@radix-ui/react-use-is-hydrated': 0.1.3(@types/[email protected])([email protected])
react: 19.2.3
+ react-dom: 19.2.3([email protected])
optionalDependencies:
'@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
dependencies:
@@ -7885,6 +8577,52 @@ snapshots:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
+ dependencies:
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-is-hydrated': 0.1.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
'@radix-ui/number': 1.1.3
@@ -7932,6 +8670,34 @@ snapshots:
'@types/react': 19.2.2
'@types/react-dom': 19.2.2(@types/[email protected])
+ dependencies:
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/number': 1.1.3
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
'@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
@@ -7953,6 +8719,118 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.2
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-toggle-group': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-id': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-slot': 1.3.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
dependencies:
react: 19.2.3
@@ -8003,6 +8881,19 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.2
+ dependencies:
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
+ react: 19.2.3
+ optionalDependencies:
+ '@types/react': 19.2.2
+
+ dependencies:
+ react: 19.2.3
+ optionalDependencies:
+ '@types/react': 19.2.2
+
dependencies:
react: 19.2.3
@@ -8309,6 +9200,12 @@ snapshots:
minimatch: 10.2.5
path-browserify: 1.0.1
+ '@ts-morph/[email protected]':
+ dependencies:
+ minimatch: 10.2.5
+ path-browserify: 1.0.1
+ tinyglobby: 0.2.17
+
dependencies:
tslib: 2.8.1
@@ -9329,7 +10226,7 @@ snapshots:
eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected])([email protected]))
- eslint-plugin-react-hooks: 7.0.1([email protected]([email protected])([email protected]))
+ eslint-plugin-react-hooks: 7.1.1([email protected]([email protected])([email protected]))
globals: 16.4.0
optionalDependencies:
@@ -9422,7 +10319,7 @@ snapshots:
safe-regex-test: 1.1.0
string.prototype.includes: 2.0.1
dependencies:
'@babel/core': 7.28.0
'@babel/parser': 7.29.7
@@ -11304,6 +12201,69 @@ snapshots:
+ dependencies:
+ '@radix-ui/primitive': 1.1.7
+ '@radix-ui/react-accessible-icon': 1.1.15(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-alert-dialog': 1.1.23(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-aspect-ratio': 1.1.15(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-collapsible': 1.1.20(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-compose-refs': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context-menu': 2.3.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-direction': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-dropdown-menu': 2.1.24(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-focus-guards': 1.1.6(@types/[email protected])([email protected])
+ '@radix-ui/react-focus-scope': 1.1.16(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-navigation-menu': 1.2.22(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-one-time-password-field': 0.1.16(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-password-toggle-field': 0.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-roving-focus': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-scroll-area': 1.2.18(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-slot': 1.3.3(@types/[email protected])([email protected])
+ '@radix-ui/react-toggle-group': 1.1.19(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.6(@types/[email protected])([email protected])
+ '@radix-ui/react-use-effect-event': 0.0.5(@types/[email protected])([email protected])
+ '@radix-ui/react-use-escape-keydown': 1.1.5(@types/[email protected])([email protected])
+ '@radix-ui/react-use-is-hydrated': 0.1.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.4(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.2.3
+ react-dom: 19.2.3([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.2
+ '@types/react-dom': 19.2.2(@types/[email protected])
+
@@ -12078,6 +13038,11 @@ snapshots:
'@ts-morph/common': 0.27.0
code-block-writer: 13.0.3
+ dependencies:
+ '@ts-morph/common': 0.28.1
+ code-block-writer: 13.0.3
+
dependencies:
'@types/json5': 0.0.29