@ggraphic/editor 0.0.0-stage → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/NOTICE +2 -0
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES +7 -0
- package/dist/CanvasEditorProvider.d.ts +214 -0
- package/dist/CanvasEditorProvider.js +10 -0
- package/dist/ai/applyOperation.d.ts +75 -0
- package/dist/ai/applyOperation.js +354 -0
- package/dist/ai/describeCanvasElements.d.ts +17 -0
- package/dist/ai/describeCanvasElements.js +148 -0
- package/dist/ai/illustrationCapability.d.ts +6 -0
- package/dist/ai/illustrationCapability.js +20 -0
- package/dist/ai/types.d.ts +91 -0
- package/dist/ai/types.js +1 -0
- package/dist/blocks/liftedBlock.d.ts +61 -0
- package/dist/blocks/liftedBlock.js +117 -0
- package/dist/brand/bindPick.d.ts +18 -0
- package/dist/brand/bindPick.js +28 -0
- package/dist/brand/bindableFields.d.ts +9 -0
- package/dist/brand/bindableFields.js +61 -0
- package/dist/brand/brandRegistry.d.ts +26 -0
- package/dist/brand/brandRegistry.js +56 -0
- package/dist/brand/composerBrand.d.ts +146 -0
- package/dist/brand/composerBrand.js +6 -0
- package/dist/brand/documentBrand.d.ts +16 -0
- package/dist/brand/documentBrand.js +6 -0
- package/dist/collab/documentVersion.d.ts +36 -0
- package/dist/collab/documentVersion.js +139 -0
- package/dist/collab/pageElementStateKeys.d.ts +33 -0
- package/dist/collab/pageElementStateKeys.js +148 -0
- package/dist/collab/pagesDoc.d.ts +152 -0
- package/dist/collab/pagesDoc.js +434 -0
- package/dist/collab/useAwarenessState.d.ts +12 -0
- package/dist/collab/useAwarenessState.js +47 -0
- package/dist/collab/useEmitHostStateChanges.d.ts +18 -0
- package/dist/collab/useEmitHostStateChanges.js +40 -0
- package/dist/collab/useSelectionAwareness.d.ts +22 -0
- package/dist/collab/useSelectionAwareness.js +60 -0
- package/dist/collab/useYjsCanvasBinding.d.ts +7 -0
- package/dist/collab/useYjsCanvasBinding.js +21 -0
- package/dist/collab/useYjsPageStateSync.d.ts +20 -0
- package/dist/collab/useYjsPageStateSync.js +49 -0
- package/dist/collab/useYjsPages.d.ts +73 -0
- package/dist/collab/useYjsPages.js +396 -0
- package/dist/collab/wrapCallbacksWithPageSync.d.ts +3 -0
- package/dist/collab/wrapCallbacksWithPageSync.js +62 -0
- package/dist/collab/ydocKeys.d.ts +50 -0
- package/dist/collab/ydocKeys.js +50 -0
- package/dist/collab/yjsBinding.d.ts +27 -0
- package/dist/collab/yjsBinding.js +105 -0
- package/dist/common/Lightbox.d.ts +8 -0
- package/dist/common/Lightbox.js +8 -0
- package/dist/common/imageSourceTypes.d.ts +1 -0
- package/dist/common/imageSourceTypes.js +1 -0
- package/dist/components/AddPageButton.d.ts +13 -0
- package/dist/components/AddPageButton.js +13 -0
- package/dist/components/CanvasAnnouncer.d.ts +8 -0
- package/dist/components/CanvasAnnouncer.js +10 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.d.ts +12 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.js +145 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.d.ts +33 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.js +107 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.d.ts +68 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.js +203 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.d.ts +32 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.js +1144 -0
- package/dist/components/CanvasEditor/PageWrapper.d.ts +7 -0
- package/dist/components/CanvasEditor/PageWrapper.js +103 -0
- package/dist/components/CanvasEditor/autoSwitchTab.d.ts +11 -0
- package/dist/components/CanvasEditor/autoSwitchTab.js +15 -0
- package/dist/components/CanvasEditor/blockInsertContext.d.ts +22 -0
- package/dist/components/CanvasEditor/blockInsertContext.js +5 -0
- package/dist/components/CanvasEditor/editorShell.d.ts +99 -0
- package/dist/components/CanvasEditor/editorShell.js +20 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.d.ts +32 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.js +140 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.d.ts +13 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.js +29 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.d.ts +14 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.js +56 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.d.ts +18 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.js +36 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.d.ts +25 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.js +49 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.js +70 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.js +31 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.d.ts +75 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.js +69 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.d.ts +6 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.js +56 -0
- package/dist/components/CanvasEditor/layersTab.d.ts +13 -0
- package/dist/components/CanvasEditor/layersTab.js +27 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.d.ts +8 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.js +27 -0
- package/dist/components/CanvasEditor/types.d.ts +202 -0
- package/dist/components/CanvasEditor/types.js +1 -0
- package/dist/components/CanvasEditorSkeleton.d.ts +16 -0
- package/dist/components/CanvasEditorSkeleton.js +24 -0
- package/dist/components/CanvasMetaBar.d.ts +16 -0
- package/dist/components/CanvasMetaBar.js +33 -0
- package/dist/components/CanvasRenderLayer.d.ts +37 -0
- package/dist/components/CanvasRenderLayer.js +54 -0
- package/dist/components/CanvasTextOverlay.d.ts +126 -0
- package/dist/components/CanvasTextOverlay.js +527 -0
- package/dist/components/ConfigCanvas.d.ts +35 -0
- package/dist/components/ConfigCanvas.js +30 -0
- package/dist/components/CropGhostOverlay.d.ts +13 -0
- package/dist/components/CropGhostOverlay.js +56 -0
- package/dist/components/CustomColorSwatch.d.ts +35 -0
- package/dist/components/CustomColorSwatch.js +81 -0
- package/dist/components/DownloadNotice.d.ts +7 -0
- package/dist/components/DownloadNotice.js +7 -0
- package/dist/components/GenericCanvas.d.ts +309 -0
- package/dist/components/GenericCanvas.js +787 -0
- package/dist/components/GenericCanvasElement.d.ts +34 -0
- package/dist/components/GenericCanvasElement.js +267 -0
- package/dist/components/MultiSelectionTransformer.d.ts +39 -0
- package/dist/components/MultiSelectionTransformer.js +107 -0
- package/dist/components/PagePreview.d.ts +14 -0
- package/dist/components/PagePreview.js +63 -0
- package/dist/components/PageThumbnailStrip.d.ts +25 -0
- package/dist/components/PageThumbnailStrip.js +46 -0
- package/dist/components/PageToolbar.d.ts +12 -0
- package/dist/components/PageToolbar.js +20 -0
- package/dist/components/PrintGuides.d.ts +13 -0
- package/dist/components/PrintGuides.js +28 -0
- package/dist/components/RemoteSelectionOverlay.d.ts +15 -0
- package/dist/components/RemoteSelectionOverlay.js +29 -0
- package/dist/components/RichTextField.d.ts +34 -0
- package/dist/components/RichTextField.js +216 -0
- package/dist/components/SelectionPill.d.ts +56 -0
- package/dist/components/SelectionPill.js +123 -0
- package/dist/components/SlideNotesPanel.d.ts +13 -0
- package/dist/components/SlideNotesPanel.js +28 -0
- package/dist/components/SlotBudgetStatus.d.ts +12 -0
- package/dist/components/SlotBudgetStatus.js +64 -0
- package/dist/components/StandaloneCanvas.d.ts +33 -0
- package/dist/components/StandaloneCanvas.js +61 -0
- package/dist/components/TextFormatButtons.d.ts +61 -0
- package/dist/components/TextFormatButtons.js +107 -0
- package/dist/components/TextFormatControls.d.ts +26 -0
- package/dist/components/TextFormatControls.js +73 -0
- package/dist/components/Toolbar.d.ts +40 -0
- package/dist/components/Toolbar.js +26 -0
- package/dist/components/ToolbarStateBridge.d.ts +72 -0
- package/dist/components/ToolbarStateBridge.js +298 -0
- package/dist/components/TopBar/AutoSaveIndicator.d.ts +8 -0
- package/dist/components/TopBar/AutoSaveIndicator.js +44 -0
- package/dist/components/TopBar/ContextControls.d.ts +107 -0
- package/dist/components/TopBar/ContextControls.js +321 -0
- package/dist/components/TopBar/ContextToolbar.d.ts +14 -0
- package/dist/components/TopBar/ContextToolbar.js +20 -0
- package/dist/components/TopBar/CropModeControls.d.ts +35 -0
- package/dist/components/TopBar/CropModeControls.js +84 -0
- package/dist/components/TopBar/DownloadSection.d.ts +47 -0
- package/dist/components/TopBar/DownloadSection.js +102 -0
- package/dist/components/TopBar/MobileSelectionBar.d.ts +16 -0
- package/dist/components/TopBar/MobileSelectionBar.js +26 -0
- package/dist/components/TopBar/MobileSelectionControls.d.ts +10 -0
- package/dist/components/TopBar/MobileSelectionControls.js +43 -0
- package/dist/components/TopBar/MultiSelectionToolbar.d.ts +19 -0
- package/dist/components/TopBar/MultiSelectionToolbar.js +30 -0
- package/dist/components/TopBar/ShareDropdown.d.ts +54 -0
- package/dist/components/TopBar/ShareDropdown.js +110 -0
- package/dist/components/TopBar/TopBar.d.ts +6 -0
- package/dist/components/TopBar/TopBar.js +6 -0
- package/dist/components/TopBar/barTiles.d.ts +15 -0
- package/dist/components/TopBar/barTiles.js +34 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.d.ts +28 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.js +26 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.js +133 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.d.ts +16 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.js +89 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.d.ts +17 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.js +37 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.d.ts +7 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.js +22 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.js +19 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.js +15 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.js +9 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.js +19 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.js +74 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.d.ts +12 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.js +27 -0
- package/dist/components/TransformHud.d.ts +11 -0
- package/dist/components/TransformHud.js +121 -0
- package/dist/components/WholeTextFormatControls.d.ts +10 -0
- package/dist/components/WholeTextFormatControls.js +37 -0
- package/dist/components/ZoomableViewport.d.ts +6 -0
- package/dist/components/ZoomableViewport.js +4 -0
- package/dist/components/accentMark.d.ts +20 -0
- package/dist/components/accentMark.js +24 -0
- package/dist/components/canvasItemLock.d.ts +13 -0
- package/dist/components/canvasItemLock.js +12 -0
- package/dist/components/kindRenderers.d.ts +118 -0
- package/dist/components/kindRenderers.js +151 -0
- package/dist/components/markColor.d.ts +13 -0
- package/dist/components/markColor.js +21 -0
- package/dist/components/markerMark.d.ts +24 -0
- package/dist/components/markerMark.js +22 -0
- package/dist/composer/cardFollowsText.d.ts +17 -0
- package/dist/composer/cardFollowsText.js +34 -0
- package/dist/composer/marks.d.ts +4 -0
- package/dist/composer/marks.js +15 -0
- package/dist/composer/steckbriefLayout.d.ts +147 -0
- package/dist/composer/steckbriefLayout.js +468 -0
- package/dist/composer/textFit.d.ts +31 -0
- package/dist/composer/textFit.js +89 -0
- package/dist/configs/buildSharepicText.d.ts +5 -0
- package/dist/configs/buildSharepicText.js +58 -0
- package/dist/configs/configLoader.d.ts +34 -0
- package/dist/configs/configLoader.js +60 -0
- package/dist/configs/factory/actionFactories.d.ts +201 -0
- package/dist/configs/factory/actionFactories.js +628 -0
- package/dist/configs/factory/baseTypes.d.ts +150 -0
- package/dist/configs/factory/baseTypes.js +8 -0
- package/dist/configs/factory/carryInstanceState.d.ts +82 -0
- package/dist/configs/factory/carryInstanceState.js +121 -0
- package/dist/configs/factory/createTextElement.d.ts +63 -0
- package/dist/configs/factory/createTextElement.js +63 -0
- package/dist/configs/factory/defineSection.d.ts +45 -0
- package/dist/configs/factory/defineSection.js +45 -0
- package/dist/configs/factory/layoutAccessors.d.ts +15 -0
- package/dist/configs/factory/layoutAccessors.js +20 -0
- package/dist/configs/featureInjector.d.ts +40 -0
- package/dist/configs/featureInjector.js +184 -0
- package/dist/configs/pageInheritance.d.ts +8 -0
- package/dist/configs/pageInheritance.js +82 -0
- package/dist/configs/placeholders.d.ts +14 -0
- package/dist/configs/placeholders.js +33 -0
- package/dist/configs/shareSection.d.ts +11 -0
- package/dist/configs/shareSection.js +65 -0
- package/dist/configs/types.d.ts +431 -0
- package/dist/configs/types.js +1 -0
- package/dist/configs/unifiedTabs.d.ts +26 -0
- package/dist/configs/unifiedTabs.js +6 -0
- package/dist/editorSeamTypes.d.ts +41 -0
- package/dist/editorSeamTypes.js +1 -0
- package/dist/export/pptx/buildPptxModel.d.ts +47 -0
- package/dist/export/pptx/buildPptxModel.js +612 -0
- package/dist/export/pptx/exportPptxDeck.d.ts +26 -0
- package/dist/export/pptx/exportPptxDeck.js +80 -0
- package/dist/export/pptx/pptxFonts.d.ts +26 -0
- package/dist/export/pptx/pptxFonts.js +41 -0
- package/dist/export/pptx/pptxUnits.d.ts +27 -0
- package/dist/export/pptx/pptxUnits.js +54 -0
- package/dist/export/pptx/textModel.d.ts +17 -0
- package/dist/export/pptx/textModel.js +118 -0
- package/dist/export/pptx/types.d.ts +161 -0
- package/dist/export/pptx/types.js +11 -0
- package/dist/export/pptx/writePptx.d.ts +40 -0
- package/dist/export/pptx/writePptx.js +206 -0
- package/dist/export/pptx/writeText.d.ts +19 -0
- package/dist/export/pptx/writeText.js +120 -0
- package/dist/export/printExport.d.ts +42 -0
- package/dist/export/printExport.js +94 -0
- package/dist/export/printPdf.d.ts +103 -0
- package/dist/export/printPdf.js +144 -0
- package/dist/export/slidesPdf.d.ts +9 -0
- package/dist/export/slidesPdf.js +31 -0
- package/dist/formats/index.d.ts +115 -0
- package/dist/formats/index.js +287 -0
- package/dist/groups/pageGroups.d.ts +32 -0
- package/dist/groups/pageGroups.js +91 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/useAiImageGeneration.d.ts +15 -0
- package/dist/hooks/useAiImageGeneration.js +73 -0
- package/dist/hooks/useAnnounce.d.ts +27 -0
- package/dist/hooks/useAnnounce.js +47 -0
- package/dist/hooks/useBoxSnap.d.ts +37 -0
- package/dist/hooks/useBoxSnap.js +49 -0
- package/dist/hooks/useCanvasAutoSave.d.ts +33 -0
- package/dist/hooks/useCanvasAutoSave.js +259 -0
- package/dist/hooks/useCanvasElementHandlers.d.ts +182 -0
- package/dist/hooks/useCanvasElementHandlers.js +326 -0
- package/dist/hooks/useCanvasHistorySetup.d.ts +37 -0
- package/dist/hooks/useCanvasHistorySetup.js +113 -0
- package/dist/hooks/useCanvasInteractions.d.ts +31 -0
- package/dist/hooks/useCanvasInteractions.js +103 -0
- package/dist/hooks/useCanvasKeyboardHandlers.d.ts +37 -0
- package/dist/hooks/useCanvasKeyboardHandlers.js +280 -0
- package/dist/hooks/useCanvasStoreReset.d.ts +25 -0
- package/dist/hooks/useCanvasStoreReset.js +35 -0
- package/dist/hooks/useCanvasUndoRedo.d.ts +34 -0
- package/dist/hooks/useCanvasUndoRedo.js +213 -0
- package/dist/hooks/useContextPress.d.ts +14 -0
- package/dist/hooks/useContextPress.js +45 -0
- package/dist/hooks/useCropSession.d.ts +23 -0
- package/dist/hooks/useCropSession.js +69 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +14 -0
- package/dist/hooks/useDeckAutoSave.d.ts +30 -0
- package/dist/hooks/useDeckAutoSave.js +234 -0
- package/dist/hooks/useDeepSelect.d.ts +18 -0
- package/dist/hooks/useDeepSelect.js +135 -0
- package/dist/hooks/useElementSnapping.d.ts +13 -0
- package/dist/hooks/useElementSnapping.js +26 -0
- package/dist/hooks/useEmojiCatalog.d.ts +3 -0
- package/dist/hooks/useEmojiCatalog.js +13 -0
- package/dist/hooks/useFloatingModuleHandlers.d.ts +52 -0
- package/dist/hooks/useFloatingModuleHandlers.js +285 -0
- package/dist/hooks/useFloatingModuleState.d.ts +83 -0
- package/dist/hooks/useFloatingModuleState.js +250 -0
- package/dist/hooks/useFontGeneration.d.ts +10 -0
- package/dist/hooks/useFontGeneration.js +77 -0
- package/dist/hooks/useFontLoader.d.ts +53 -0
- package/dist/hooks/useFontLoader.js +129 -0
- package/dist/hooks/useGeometryReporter.d.ts +19 -0
- package/dist/hooks/useGeometryReporter.js +41 -0
- package/dist/hooks/useHoverOutline.d.ts +8 -0
- package/dist/hooks/useHoverOutline.js +78 -0
- package/dist/hooks/useIconCatalog.d.ts +12 -0
- package/dist/hooks/useIconCatalog.js +30 -0
- package/dist/hooks/useIconSearch.d.ts +2 -0
- package/dist/hooks/useIconSearch.js +14 -0
- package/dist/hooks/useIconSetsFor.d.ts +8 -0
- package/dist/hooks/useIconSetsFor.js +30 -0
- package/dist/hooks/useImageCoverFit.d.ts +17 -0
- package/dist/hooks/useImageCoverFit.js +35 -0
- package/dist/hooks/useIsCanvasMobile.d.ts +3 -0
- package/dist/hooks/useIsCanvasMobile.js +19 -0
- package/dist/hooks/useMarqueeSelection.d.ts +27 -0
- package/dist/hooks/useMarqueeSelection.js +140 -0
- package/dist/hooks/useMobileSheet.d.ts +48 -0
- package/dist/hooks/useMobileSheet.js +282 -0
- package/dist/hooks/useMultiPageExport.d.ts +30 -0
- package/dist/hooks/useMultiPageExport.js +117 -0
- package/dist/hooks/usePageManager.d.ts +132 -0
- package/dist/hooks/usePageManager.js +399 -0
- package/dist/hooks/usePageThumbnails.d.ts +10 -0
- package/dist/hooks/usePageThumbnails.js +122 -0
- package/dist/hooks/usePaginatedIcons.d.ts +11 -0
- package/dist/hooks/usePaginatedIcons.js +46 -0
- package/dist/hooks/useRovingToolbar.d.ts +17 -0
- package/dist/hooks/useRovingToolbar.js +76 -0
- package/dist/hooks/useSelectionAnnouncement.d.ts +13 -0
- package/dist/hooks/useSelectionAnnouncement.js +68 -0
- package/dist/hooks/useSnapScheduler.d.ts +20 -0
- package/dist/hooks/useSnapScheduler.js +61 -0
- package/dist/hooks/useTrackUnsplashDownload.d.ts +6 -0
- package/dist/hooks/useTrackUnsplashDownload.js +19 -0
- package/dist/hooks/useZoomGestures.d.ts +35 -0
- package/dist/hooks/useZoomGestures.js +185 -0
- package/dist/hostServices.d.ts +308 -0
- package/dist/hostServices.js +107 -0
- package/dist/i18n/de.d.ts +897 -0
- package/dist/i18n/de.js +961 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +949 -0
- package/dist/i18n/messages.d.ts +28 -0
- package/dist/i18n/messages.js +66 -0
- package/dist/layouts/CanvasEditorLayout.d.ts +28 -0
- package/dist/layouts/CanvasEditorLayout.js +56 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/index.js +2 -0
- package/dist/primitives/AssetPrimitive.d.ts +24 -0
- package/dist/primitives/AssetPrimitive.js +158 -0
- package/dist/primitives/CanvasBackground.d.ts +33 -0
- package/dist/primitives/CanvasBackground.js +44 -0
- package/dist/primitives/CanvasIcons.d.ts +19 -0
- package/dist/primitives/CanvasIcons.js +46 -0
- package/dist/primitives/CanvasImage.d.ts +73 -0
- package/dist/primitives/CanvasImage.js +460 -0
- package/dist/primitives/CanvasRichText.d.ts +25 -0
- package/dist/primitives/CanvasRichText.js +284 -0
- package/dist/primitives/CanvasStage.d.ts +84 -0
- package/dist/primitives/CanvasStage.js +292 -0
- package/dist/primitives/CanvasText.d.ts +91 -0
- package/dist/primitives/CanvasText.js +293 -0
- package/dist/primitives/ChartPrimitive.d.ts +24 -0
- package/dist/primitives/ChartPrimitive.js +318 -0
- package/dist/primitives/CircleBadge.d.ts +43 -0
- package/dist/primitives/CircleBadge.js +233 -0
- package/dist/primitives/FramePrimitive.d.ts +14 -0
- package/dist/primitives/FramePrimitive.js +406 -0
- package/dist/primitives/IconPrimitive.d.ts +28 -0
- package/dist/primitives/IconPrimitive.js +119 -0
- package/dist/primitives/IllustrationPrimitive.d.ts +16 -0
- package/dist/primitives/IllustrationPrimitive.js +184 -0
- package/dist/primitives/PillBadge.d.ts +45 -0
- package/dist/primitives/PillBadge.js +237 -0
- package/dist/primitives/ShapePrimitive.d.ts +12 -0
- package/dist/primitives/ShapePrimitive.js +521 -0
- package/dist/primitives/SnapGuidelines.d.ts +19 -0
- package/dist/primitives/SnapGuidelines.js +34 -0
- package/dist/primitives/UserImagePrimitive.d.ts +30 -0
- package/dist/primitives/UserImagePrimitive.js +496 -0
- package/dist/primitives/index.d.ts +18 -0
- package/dist/primitives/index.js +11 -0
- package/dist/sidebar/SidebarPanel.d.ts +8 -0
- package/dist/sidebar/SidebarPanel.js +219 -0
- package/dist/sidebar/SidebarTabBar.d.ts +2 -0
- package/dist/sidebar/SidebarTabBar.js +31 -0
- package/dist/sidebar/SubsectionTabBar.d.ts +13 -0
- package/dist/sidebar/SubsectionTabBar.js +30 -0
- package/dist/sidebar/UserUploadsProvider.d.ts +31 -0
- package/dist/sidebar/UserUploadsProvider.js +139 -0
- package/dist/sidebar/components/AltTextField.d.ts +21 -0
- package/dist/sidebar/components/AltTextField.js +60 -0
- package/dist/sidebar/components/SidebarHint.d.ts +7 -0
- package/dist/sidebar/components/SidebarHint.js +38 -0
- package/dist/sidebar/components/SidebarSlider.d.ts +16 -0
- package/dist/sidebar/components/SidebarSlider.js +9 -0
- package/dist/sidebar/components/TextFieldPrimitives.d.ts +26 -0
- package/dist/sidebar/components/TextFieldPrimitives.js +56 -0
- package/dist/sidebar/sections/ChartSettingsSection.d.ts +9 -0
- package/dist/sidebar/sections/ChartSettingsSection.js +78 -0
- package/dist/sidebar/sections/CombinedTextSection.d.ts +16 -0
- package/dist/sidebar/sections/CombinedTextSection.js +43 -0
- package/dist/sidebar/sections/DiagrammeSection.d.ts +9 -0
- package/dist/sidebar/sections/DiagrammeSection.js +40 -0
- package/dist/sidebar/sections/EffectsSection.d.ts +20 -0
- package/dist/sidebar/sections/EffectsSection.js +23 -0
- package/dist/sidebar/sections/FormenSection.d.ts +28 -0
- package/dist/sidebar/sections/FormenSection.js +440 -0
- package/dist/sidebar/sections/FrameSettingsSection.d.ts +8 -0
- package/dist/sidebar/sections/FrameSettingsSection.js +26 -0
- package/dist/sidebar/sections/GenericShareSection.d.ts +26 -0
- package/dist/sidebar/sections/GenericShareSection.js +262 -0
- package/dist/sidebar/sections/IconsSection.d.ts +8 -0
- package/dist/sidebar/sections/IconsSection.js +55 -0
- package/dist/sidebar/sections/IllustrationSettings.d.ts +9 -0
- package/dist/sidebar/sections/IllustrationSettings.js +33 -0
- package/dist/sidebar/sections/IllustrationThumb.d.ts +7 -0
- package/dist/sidebar/sections/IllustrationThumb.js +15 -0
- package/dist/sidebar/sections/ImageAdjustSection.d.ts +13 -0
- package/dist/sidebar/sections/ImageAdjustSection.js +85 -0
- package/dist/sidebar/sections/LayersSection.d.ts +25 -0
- package/dist/sidebar/sections/LayersSection.js +155 -0
- package/dist/sidebar/sections/RahmenSection.d.ts +7 -0
- package/dist/sidebar/sections/RahmenSection.js +18 -0
- package/dist/sidebar/sections/StudioGallery.d.ts +33 -0
- package/dist/sidebar/sections/StudioGallery.js +58 -0
- package/dist/sidebar/sections/UploadsSection.d.ts +11 -0
- package/dist/sidebar/sections/UploadsSection.js +130 -0
- package/dist/sidebar/sections/assets/AssetsSection.d.ts +59 -0
- package/dist/sidebar/sections/assets/AssetsSection.js +27 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.d.ts +9 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.js +49 -0
- package/dist/sidebar/sections/assets/CategoryCard.d.ts +14 -0
- package/dist/sidebar/sections/assets/CategoryCard.js +15 -0
- package/dist/sidebar/sections/assets/ElementGrid.d.ts +14 -0
- package/dist/sidebar/sections/assets/ElementGrid.js +34 -0
- package/dist/sidebar/sections/assets/ElementThumb.d.ts +10 -0
- package/dist/sidebar/sections/assets/ElementThumb.js +61 -0
- package/dist/sidebar/sections/assets/ElementTile.d.ts +32 -0
- package/dist/sidebar/sections/assets/ElementTile.js +60 -0
- package/dist/sidebar/sections/assets/ElementsPanel.d.ts +7 -0
- package/dist/sidebar/sections/assets/ElementsPanel.js +249 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.d.ts +8 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.js +26 -0
- package/dist/sidebar/sections/assets/FotosCatalog.d.ts +12 -0
- package/dist/sidebar/sections/assets/FotosCatalog.js +41 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.js +133 -0
- package/dist/sidebar/sections/assets/RecentCarousel.d.ts +7 -0
- package/dist/sidebar/sections/assets/RecentCarousel.js +42 -0
- package/dist/sidebar/sections/assets/StickerCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/StickerCatalog.js +49 -0
- package/dist/sidebar/sections/assets/constants.d.ts +4 -0
- package/dist/sidebar/sections/assets/constants.js +15 -0
- package/dist/sidebar/sections/assets/elementPanelHost.d.ts +45 -0
- package/dist/sidebar/sections/assets/elementPanelHost.js +1 -0
- package/dist/sidebar/sections/assets/elementSearch.d.ts +10 -0
- package/dist/sidebar/sections/assets/elementSearch.js +38 -0
- package/dist/sidebar/sections/assets/elementTypes.d.ts +67 -0
- package/dist/sidebar/sections/assets/elementTypes.js +24 -0
- package/dist/sidebar/sections/assets/index.d.ts +3 -0
- package/dist/sidebar/sections/assets/index.js +3 -0
- package/dist/sidebar/sections/assets/useElementCatalog.d.ts +43 -0
- package/dist/sidebar/sections/assets/useElementCatalog.js +386 -0
- package/dist/sidebar/sections/assets/useRecentElements.d.ts +21 -0
- package/dist/sidebar/sections/assets/useRecentElements.js +67 -0
- package/dist/sidebar/sections/assets/useStockPhotos.d.ts +22 -0
- package/dist/sidebar/sections/assets/useStockPhotos.js +96 -0
- package/dist/sidebar/sections/effects/EffectCard.d.ts +11 -0
- package/dist/sidebar/sections/effects/EffectCard.js +14 -0
- package/dist/sidebar/sections/effects/GradientSettings.d.ts +10 -0
- package/dist/sidebar/sections/effects/GradientSettings.js +34 -0
- package/dist/sidebar/sections/effects/OutlineSettings.d.ts +12 -0
- package/dist/sidebar/sections/effects/OutlineSettings.js +29 -0
- package/dist/sidebar/sections/effects/ShadowSettings.d.ts +13 -0
- package/dist/sidebar/sections/effects/ShadowSettings.js +38 -0
- package/dist/sidebar/sections/effects/effectsFor.d.ts +16 -0
- package/dist/sidebar/sections/effects/effectsFor.js +24 -0
- package/dist/sidebar/sections/index.d.ts +28 -0
- package/dist/sidebar/sections/index.js +36 -0
- package/dist/sidebar/sections/lazyWithPreload.d.ts +11 -0
- package/dist/sidebar/sections/lazyWithPreload.js +29 -0
- package/dist/sidebar/sections/tools/AiCreateTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiCreateTool.js +58 -0
- package/dist/sidebar/sections/tools/AiEditTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiEditTool.js +57 -0
- package/dist/sidebar/sections/tools/AltTextTool.d.ts +11 -0
- package/dist/sidebar/sections/tools/AltTextTool.js +78 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.js +90 -0
- package/dist/sidebar/sections/tools/GradientTextTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/GradientTextTool.js +104 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.d.ts +7 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.js +68 -0
- package/dist/sidebar/sections/tools/QRCodeTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/QRCodeTool.js +63 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.js +52 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.js +125 -0
- package/dist/sidebar/sections/tools/ToolPanel.d.ts +26 -0
- package/dist/sidebar/sections/tools/ToolPanel.js +13 -0
- package/dist/sidebar/sections/tools/ToolTiles.d.ts +5 -0
- package/dist/sidebar/sections/tools/ToolTiles.js +76 -0
- package/dist/sidebar/sections/tools/ToolsSection.d.ts +15 -0
- package/dist/sidebar/sections/tools/ToolsSection.js +151 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.d.ts +8 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.js +22 -0
- package/dist/sidebar/sections/tools/UnsplashTool.d.ts +10 -0
- package/dist/sidebar/sections/tools/UnsplashTool.js +47 -0
- package/dist/sidebar/sections/tools/index.d.ts +1 -0
- package/dist/sidebar/sections/tools/index.js +2 -0
- package/dist/sidebar/sections/tools/toolTiles.css +335 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.d.ts +19 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.js +23 -0
- package/dist/sidebar/sections/whenIdle.d.ts +2 -0
- package/dist/sidebar/sections/whenIdle.js +10 -0
- package/dist/sidebar/sidebarStyles.d.ts +60 -0
- package/dist/sidebar/sidebarStyles.js +61 -0
- package/dist/sidebar/tabTypes.d.ts +27 -0
- package/dist/sidebar/tabTypes.js +1 -0
- package/dist/sidebar/types.d.ts +43 -0
- package/dist/sidebar/types.js +1 -0
- package/dist/sidebar/useImagePlacement.d.ts +17 -0
- package/dist/sidebar/useImagePlacement.js +28 -0
- package/dist/stores/AutoSaveStoreProvider.d.ts +28 -0
- package/dist/stores/AutoSaveStoreProvider.js +45 -0
- package/dist/stores/CanvasStoreProvider.d.ts +43 -0
- package/dist/stores/CanvasStoreProvider.js +74 -0
- package/dist/stores/createAutoSaveStore.d.ts +50 -0
- package/dist/stores/createAutoSaveStore.js +42 -0
- package/dist/stores/createCanvasEditorStore.d.ts +126 -0
- package/dist/stores/createCanvasEditorStore.js +266 -0
- package/dist/stores/useAutoSaveStore.d.ts +12 -0
- package/dist/stores/useAutoSaveStore.js +12 -0
- package/dist/styles/editor.css +445 -0
- package/dist/styles/index.css +4 -0
- package/dist/styles/tailwind.css +239 -0
- package/dist/styles/tokens.css +199 -0
- package/dist/templates/fontWidths.generated.d.ts +1 -0
- package/dist/templates/fontWidths.generated.js +17 -0
- package/dist/templates/registry.d.ts +59 -0
- package/dist/templates/registry.js +40 -0
- package/dist/templates/templateGeometry.d.ts +32 -0
- package/dist/templates/templateGeometry.js +887 -0
- package/dist/templates/testKinds.d.ts +15 -0
- package/dist/templates/testKinds.js +151 -0
- package/dist/testing/documentBrandConfig.d.ts +14 -0
- package/dist/testing/documentBrandConfig.js +60 -0
- package/dist/testing/documentBrandPacks.d.ts +10 -0
- package/dist/testing/documentBrandPacks.js +45 -0
- package/dist/testing/fixtureTemplates.d.ts +13 -0
- package/dist/testing/fixtureTemplates.js +376 -0
- package/dist/testing/stampKind.d.ts +91 -0
- package/dist/testing/stampKind.js +56 -0
- package/dist/types/editorTypes.d.ts +65 -0
- package/dist/types/editorTypes.js +21 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +42 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/button.js +29 -0
- package/dist/ui/dialog.d.ts +15 -0
- package/dist/ui/dialog.js +53 -0
- package/dist/ui/icon-button.d.ts +18 -0
- package/dist/ui/icon-button.js +54 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +6 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +8 -0
- package/dist/ui/masonry-grid.d.ts +11 -0
- package/dist/ui/masonry-grid.js +43 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +26 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +38 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +7 -0
- package/dist/ui/switch.d.ts +6 -0
- package/dist/ui/switch.js +8 -0
- package/dist/utils/__snapshots__/kindSelection.vitest.ts.snap +1086 -0
- package/dist/utils/alignment.d.ts +21 -0
- package/dist/utils/alignment.js +54 -0
- package/dist/utils/axisLock.d.ts +30 -0
- package/dist/utils/axisLock.js +78 -0
- package/dist/utils/backgroundPhotoCrop.d.ts +28 -0
- package/dist/utils/backgroundPhotoCrop.js +28 -0
- package/dist/utils/canvasAssets.d.ts +140 -0
- package/dist/utils/canvasAssets.js +121 -0
- package/dist/utils/canvasClipboard.d.ts +51 -0
- package/dist/utils/canvasClipboard.js +37 -0
- package/dist/utils/canvasCommandRegistry.d.ts +207 -0
- package/dist/utils/canvasCommandRegistry.js +124 -0
- package/dist/utils/canvasCommands.d.ts +106 -0
- package/dist/utils/canvasCommands.js +564 -0
- package/dist/utils/canvasFontFamilies.d.ts +12 -0
- package/dist/utils/canvasFontFamilies.js +24 -0
- package/dist/utils/canvasIcons.d.ts +68 -0
- package/dist/utils/canvasIcons.js +293 -0
- package/dist/utils/canvasImageSource.d.ts +12 -0
- package/dist/utils/canvasImageSource.js +19 -0
- package/dist/utils/canvasItem.d.ts +102 -0
- package/dist/utils/canvasItem.js +1 -0
- package/dist/utils/canvasLayerManager.d.ts +51 -0
- package/dist/utils/canvasLayerManager.js +107 -0
- package/dist/utils/canvasValueResolver.d.ts +9 -0
- package/dist/utils/canvasValueResolver.js +13 -0
- package/dist/utils/captureStage.d.ts +59 -0
- package/dist/utils/captureStage.js +152 -0
- package/dist/utils/chartTypes.d.ts +6 -0
- package/dist/utils/chartTypes.js +2 -0
- package/dist/utils/chartUtils.d.ts +49 -0
- package/dist/utils/chartUtils.js +191 -0
- package/dist/utils/circleBadgeUtils.d.ts +30 -0
- package/dist/utils/circleBadgeUtils.js +85 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +66 -0
- package/dist/utils/collectAltTextPages.d.ts +6 -0
- package/dist/utils/collectAltTextPages.js +20 -0
- package/dist/utils/colorLuminance.d.ts +3 -0
- package/dist/utils/colorLuminance.js +14 -0
- package/dist/utils/colorNames.d.ts +7 -0
- package/dist/utils/colorNames.js +17 -0
- package/dist/utils/colorOptions.d.ts +20 -0
- package/dist/utils/colorOptions.js +20 -0
- package/dist/utils/cornerRadius.d.ts +14 -0
- package/dist/utils/cornerRadius.js +27 -0
- package/dist/utils/cornerReservation.d.ts +19 -0
- package/dist/utils/cornerReservation.js +7 -0
- package/dist/utils/coverFit.d.ts +117 -0
- package/dist/utils/coverFit.js +207 -0
- package/dist/utils/cropAspect.d.ts +47 -0
- package/dist/utils/cropAspect.js +53 -0
- package/dist/utils/cropGhost.d.ts +63 -0
- package/dist/utils/cropGhost.js +216 -0
- package/dist/utils/cropSession.d.ts +23 -0
- package/dist/utils/cropSession.js +92 -0
- package/dist/utils/cropTarget.d.ts +22 -0
- package/dist/utils/cropTarget.js +33 -0
- package/dist/utils/deepSelect.d.ts +43 -0
- package/dist/utils/deepSelect.js +74 -0
- package/dist/utils/downloadError.d.ts +2 -0
- package/dist/utils/downloadError.js +13 -0
- package/dist/utils/duplicateElement.d.ts +127 -0
- package/dist/utils/duplicateElement.js +235 -0
- package/dist/utils/editorFocus.d.ts +36 -0
- package/dist/utils/editorFocus.js +67 -0
- package/dist/utils/editorToast.d.ts +21 -0
- package/dist/utils/editorToast.js +7 -0
- package/dist/utils/elementKinds.d.ts +212 -0
- package/dist/utils/elementKinds.js +137 -0
- package/dist/utils/emoji/emojiCatalog.d.ts +12 -0
- package/dist/utils/emoji/emojiCatalog.en.json +9997 -0
- package/dist/utils/emoji/emojiCatalog.js +53 -0
- package/dist/utils/emoji/emojiCatalog.json +9913 -0
- package/dist/utils/ensureFontsReady.d.ts +12 -0
- package/dist/utils/ensureFontsReady.js +23 -0
- package/dist/utils/expandImage.d.ts +17 -0
- package/dist/utils/expandImage.js +76 -0
- package/dist/utils/externalIcons.d.ts +67 -0
- package/dist/utils/externalIcons.js +168 -0
- package/dist/utils/filterCache.d.ts +16 -0
- package/dist/utils/filterCache.js +31 -0
- package/dist/utils/filterUtils.d.ts +2 -0
- package/dist/utils/filterUtils.js +89 -0
- package/dist/utils/followStage.d.ts +2 -0
- package/dist/utils/followStage.js +48 -0
- package/dist/utils/fontAliases.d.ts +14 -0
- package/dist/utils/fontAliases.js +32 -0
- package/dist/utils/fontMarkSupport.d.ts +26 -0
- package/dist/utils/fontMarkSupport.js +32 -0
- package/dist/utils/frameUtils.d.ts +20 -0
- package/dist/utils/frameUtils.js +283 -0
- package/dist/utils/gradientFill.d.ts +55 -0
- package/dist/utils/gradientFill.js +57 -0
- package/dist/utils/gradientHitArea.d.ts +22 -0
- package/dist/utils/gradientHitArea.js +94 -0
- package/dist/utils/grain.d.ts +29 -0
- package/dist/utils/grain.js +103 -0
- package/dist/utils/grainSpec.d.ts +2 -0
- package/dist/utils/grainSpec.js +3 -0
- package/dist/utils/groupSnap.d.ts +27 -0
- package/dist/utils/groupSnap.js +54 -0
- package/dist/utils/handDrawn.d.ts +92 -0
- package/dist/utils/handDrawn.js +523 -0
- package/dist/utils/historyStamp.d.ts +22 -0
- package/dist/utils/historyStamp.js +31 -0
- package/dist/utils/hostStorageKeys.d.ts +16 -0
- package/dist/utils/hostStorageKeys.js +27 -0
- package/dist/utils/iconInstances.d.ts +80 -0
- package/dist/utils/iconInstances.js +109 -0
- package/dist/utils/illustrations/gophers.d.ts +11 -0
- package/dist/utils/illustrations/gophers.js +1236 -0
- package/dist/utils/illustrations/humaaans.d.ts +8 -0
- package/dist/utils/illustrations/humaaans.js +265 -0
- package/dist/utils/illustrations/illlustrations.d.ts +11 -0
- package/dist/utils/illustrations/illlustrations.js +929 -0
- package/dist/utils/illustrations/kawaii.d.ts +6 -0
- package/dist/utils/illustrations/kawaii.js +73 -0
- package/dist/utils/illustrations/opendoodles.d.ts +6 -0
- package/dist/utils/illustrations/opendoodles.js +271 -0
- package/dist/utils/illustrations/openpeeps.d.ts +9 -0
- package/dist/utils/illustrations/openpeeps.js +1522 -0
- package/dist/utils/illustrations/prefetchAnalytics.d.ts +78 -0
- package/dist/utils/illustrations/prefetchAnalytics.js +162 -0
- package/dist/utils/illustrations/registry.d.ts +27 -0
- package/dist/utils/illustrations/registry.js +106 -0
- package/dist/utils/illustrations/svgCache.d.ts +60 -0
- package/dist/utils/illustrations/svgCache.js +349 -0
- package/dist/utils/illustrations/transhumans.d.ts +8 -0
- package/dist/utils/illustrations/transhumans.js +313 -0
- package/dist/utils/illustrations/types.d.ts +25 -0
- package/dist/utils/illustrations/types.js +45 -0
- package/dist/utils/imageElementComparison.d.ts +19 -0
- package/dist/utils/imageElementComparison.js +121 -0
- package/dist/utils/imageFilters.d.ts +94 -0
- package/dist/utils/imageFilters.js +304 -0
- package/dist/utils/imageLook.d.ts +18 -0
- package/dist/utils/imageLook.js +41 -0
- package/dist/utils/keyboardCrop.d.ts +25 -0
- package/dist/utils/keyboardCrop.js +98 -0
- package/dist/utils/keyboardOwnership.d.ts +30 -0
- package/dist/utils/keyboardOwnership.js +93 -0
- package/dist/utils/layerLabels.d.ts +39 -0
- package/dist/utils/layerLabels.js +181 -0
- package/dist/utils/layerLock.d.ts +24 -0
- package/dist/utils/layerLock.js +52 -0
- package/dist/utils/layerSelection.d.ts +24 -0
- package/dist/utils/layerSelection.js +16 -0
- package/dist/utils/markerBoxes.d.ts +38 -0
- package/dist/utils/markerBoxes.js +60 -0
- package/dist/utils/markerColors.d.ts +16 -0
- package/dist/utils/markerColors.js +32 -0
- package/dist/utils/mediaDrop.d.ts +76 -0
- package/dist/utils/mediaDrop.js +95 -0
- package/dist/utils/mediaPlacement.d.ts +6 -0
- package/dist/utils/mediaPlacement.js +17 -0
- package/dist/utils/motifSizes.d.ts +8 -0
- package/dist/utils/motifSizes.js +9 -0
- package/dist/utils/multiSelect.d.ts +44 -0
- package/dist/utils/multiSelect.js +139 -0
- package/dist/utils/notch.d.ts +17 -0
- package/dist/utils/notch.js +23 -0
- package/dist/utils/orientElement.d.ts +46 -0
- package/dist/utils/orientElement.js +108 -0
- package/dist/utils/orientation.d.ts +119 -0
- package/dist/utils/orientation.js +411 -0
- package/dist/utils/pageCounter.d.ts +15 -0
- package/dist/utils/pageCounter.js +17 -0
- package/dist/utils/pendingImages.d.ts +10 -0
- package/dist/utils/pendingImages.js +25 -0
- package/dist/utils/photoCredit.d.ts +9 -0
- package/dist/utils/photoCredit.js +29 -0
- package/dist/utils/photoCredits.d.ts +5 -0
- package/dist/utils/photoCredits.js +17 -0
- package/dist/utils/photoPlaceholder.d.ts +25 -0
- package/dist/utils/photoPlaceholder.js +38 -0
- package/dist/utils/pillBadgeUtils.d.ts +41 -0
- package/dist/utils/pillBadgeUtils.js +94 -0
- package/dist/utils/pixelHitArea.d.ts +13 -0
- package/dist/utils/pixelHitArea.js +33 -0
- package/dist/utils/plainTextLayout.d.ts +11 -0
- package/dist/utils/plainTextLayout.js +64 -0
- package/dist/utils/printImageInfo.d.ts +9 -0
- package/dist/utils/printImageInfo.js +14 -0
- package/dist/utils/recacheNextFrame.d.ts +6 -0
- package/dist/utils/recacheNextFrame.js +15 -0
- package/dist/utils/removeElement.d.ts +17 -0
- package/dist/utils/removeElement.js +47 -0
- package/dist/utils/renderedBoxes.d.ts +19 -0
- package/dist/utils/renderedBoxes.js +67 -0
- package/dist/utils/resolveElementValue.d.ts +44 -0
- package/dist/utils/resolveElementValue.js +72 -0
- package/dist/utils/scrollBehavior.d.ts +6 -0
- package/dist/utils/scrollBehavior.js +17 -0
- package/dist/utils/searchTranslations.d.ts +20 -0
- package/dist/utils/searchTranslations.js +366 -0
- package/dist/utils/selectionCapabilities.d.ts +53 -0
- package/dist/utils/selectionCapabilities.js +52 -0
- package/dist/utils/shade.d.ts +24 -0
- package/dist/utils/shade.js +55 -0
- package/dist/utils/shapeDevices.d.ts +72 -0
- package/dist/utils/shapeDevices.js +100 -0
- package/dist/utils/shapeTransform.d.ts +29 -0
- package/dist/utils/shapeTransform.js +69 -0
- package/dist/utils/shapes.d.ts +64 -0
- package/dist/utils/shapes.js +838 -0
- package/dist/utils/smartCrop.d.ts +30 -0
- package/dist/utils/smartCrop.js +163 -0
- package/dist/utils/snapping.d.ts +116 -0
- package/dist/utils/snapping.js +426 -0
- package/dist/utils/stageCssScale.d.ts +7 -0
- package/dist/utils/stageCssScale.js +11 -0
- package/dist/utils/stateTypeAssertions.d.ts +99 -0
- package/dist/utils/stateTypeAssertions.js +197 -0
- package/dist/utils/straighten.d.ts +51 -0
- package/dist/utils/straighten.js +254 -0
- package/dist/utils/surfaceGlow.d.ts +7 -0
- package/dist/utils/surfaceGlow.js +27 -0
- package/dist/utils/templateElementInstance.d.ts +43 -0
- package/dist/utils/templateElementInstance.js +100 -0
- package/dist/utils/templateRotation.d.ts +24 -0
- package/dist/utils/templateRotation.js +56 -0
- package/dist/utils/textAlign.d.ts +17 -0
- package/dist/utils/textAlign.js +30 -0
- package/dist/utils/textEditorOpeners.d.ts +12 -0
- package/dist/utils/textEditorOpeners.js +40 -0
- package/dist/utils/textRouting.d.ts +17 -0
- package/dist/utils/textRouting.js +22 -0
- package/dist/utils/textUtils.d.ts +102 -0
- package/dist/utils/textUtils.js +254 -0
- package/dist/utils/touchInput.d.ts +7 -0
- package/dist/utils/touchInput.js +19 -0
- package/dist/utils/transformHudLabel.d.ts +3 -0
- package/dist/utils/transformHudLabel.js +12 -0
- package/dist/utils/unsplashLinks.d.ts +2 -0
- package/dist/utils/unsplashLinks.js +7 -0
- package/dist/utils/userFacingError.d.ts +10 -0
- package/dist/utils/userFacingError.js +10 -0
- package/dist/utils/userImageCrop.d.ts +4 -0
- package/dist/utils/userImageCrop.js +26 -0
- package/dist/utils/userImageUtils.d.ts +44 -0
- package/dist/utils/userImageUtils.js +136 -0
- package/dist/utils/viewport.d.ts +16 -0
- package/dist/utils/viewport.js +30 -0
- package/dist/utils/zipPageImages.d.ts +9 -0
- package/dist/utils/zipPageImages.js +30 -0
- package/package.json +105 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
/**
|
|
3
|
+
* Push external changes of a page's `state` Y.Map into the mounted canvas.
|
|
4
|
+
*
|
|
5
|
+
* GenericCanvas holds template-field state as local React state seeded once
|
|
6
|
+
* from `page.state` — without this observer neither a chat sharepic edit
|
|
7
|
+
* (applied server-side via the Hocuspocus internal API) nor another studio
|
|
8
|
+
* client's edit (dual-written into the page state map by CanvasEditor) would
|
|
9
|
+
* appear in an open studio tab until reload.
|
|
10
|
+
*
|
|
11
|
+
* This client's own dual-writes carry PAGES_STATE_ORIGIN and are skipped —
|
|
12
|
+
* the local component state already has those values, and rebuilding it on
|
|
13
|
+
* every keystroke would disrupt inline text editing. Structural page ops are
|
|
14
|
+
* not skipped: the carousel chrome they rewrite is news to the canvas.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useYjsPageStateSync(options: {
|
|
17
|
+
pageYMap: Y.Map<unknown> | null;
|
|
18
|
+
isSynced: boolean;
|
|
19
|
+
onRemoteState: (partial: Record<string, unknown>) => void;
|
|
20
|
+
}): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
import { YDOC_KEYS } from '@ggraphic/editor/collab/ydocKeys';
|
|
5
|
+
import { PAGES_STATE_ORIGIN } from './useYjsPages.js';
|
|
6
|
+
/**
|
|
7
|
+
* Push external changes of a page's `state` Y.Map into the mounted canvas.
|
|
8
|
+
*
|
|
9
|
+
* GenericCanvas holds template-field state as local React state seeded once
|
|
10
|
+
* from `page.state` — without this observer neither a chat sharepic edit
|
|
11
|
+
* (applied server-side via the Hocuspocus internal API) nor another studio
|
|
12
|
+
* client's edit (dual-written into the page state map by CanvasEditor) would
|
|
13
|
+
* appear in an open studio tab until reload.
|
|
14
|
+
*
|
|
15
|
+
* This client's own dual-writes carry PAGES_STATE_ORIGIN and are skipped —
|
|
16
|
+
* the local component state already has those values, and rebuilding it on
|
|
17
|
+
* every keystroke would disrupt inline text editing. Structural page ops are
|
|
18
|
+
* not skipped: the carousel chrome they rewrite is news to the canvas.
|
|
19
|
+
*/
|
|
20
|
+
export function useYjsPageStateSync(options) {
|
|
21
|
+
const { pageYMap, isSynced, onRemoteState } = options;
|
|
22
|
+
const onRemoteStateRef = useRef(onRemoteState);
|
|
23
|
+
onRemoteStateRef.current = onRemoteState;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!pageYMap || !isSynced)
|
|
26
|
+
return undefined;
|
|
27
|
+
const handler = (events) => {
|
|
28
|
+
const stateY = pageYMap.get(YDOC_KEYS.state);
|
|
29
|
+
if (!(stateY instanceof Y.Map))
|
|
30
|
+
return;
|
|
31
|
+
const partial = {};
|
|
32
|
+
for (const event of events) {
|
|
33
|
+
if (event.target !== stateY)
|
|
34
|
+
continue;
|
|
35
|
+
if (event.transaction.origin === PAGES_STATE_ORIGIN)
|
|
36
|
+
continue;
|
|
37
|
+
for (const key of event.keysChanged) {
|
|
38
|
+
partial[key] = stateY.get(key);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (Object.keys(partial).length > 0)
|
|
42
|
+
onRemoteStateRef.current(partial);
|
|
43
|
+
};
|
|
44
|
+
pageYMap.observeDeep(handler);
|
|
45
|
+
return () => {
|
|
46
|
+
pageYMap.unobserveDeep(handler);
|
|
47
|
+
};
|
|
48
|
+
}, [pageYMap, isSynced]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type DocumentRefusal } from '@ggraphic/schema';
|
|
2
|
+
import * as Y from 'yjs';
|
|
3
|
+
import { type PageDef, type PageView, type ReplaceDeckOps } from '@ggraphic/editor/collab/pagesDoc';
|
|
4
|
+
import { type HistoryStamps } from '@ggraphic/editor/utils/historyStamp';
|
|
5
|
+
/**
|
|
6
|
+
* What a mounted canvas writes back for a page state it receives: its
|
|
7
|
+
* template's createInitialState, restricted to the keys the canvas emits.
|
|
8
|
+
* Null when the page's template is not loaded (nothing of it is mounted).
|
|
9
|
+
*/
|
|
10
|
+
export type NormalizeEcho = (configId: string, state: Record<string, unknown>) => Record<string, unknown> | null;
|
|
11
|
+
/**
|
|
12
|
+
* Origin of this client's own page-state dual-writes. Exported so
|
|
13
|
+
* useYjsPageStateSync can skip them — without the filter every local
|
|
14
|
+
* keystroke (dual-written into the page state map by CanvasEditor) would
|
|
15
|
+
* round-trip back into component state and rebuild it mid-typing.
|
|
16
|
+
* Structural ops (LOCAL_ORIGIN) are NOT skipped: the carousel chrome they
|
|
17
|
+
* rewrite (the host's `carousel.refreshChrome`) must reach the mounted canvases.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PAGES_STATE_ORIGIN: unknown;
|
|
20
|
+
export type YjsPageView = PageView;
|
|
21
|
+
export interface SeedPageDef extends Omit<PageDef, 'id'> {
|
|
22
|
+
/**
|
|
23
|
+
* Stable page id. Provide it when the caller's world already references
|
|
24
|
+
* pages by id (chat deck patches address `initial_state.pages[i].id`);
|
|
25
|
+
* omitted ids fall back to deterministic `seed-<index>` so racing seeds
|
|
26
|
+
* still converge.
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface YjsPagesApi {
|
|
31
|
+
pages: PageView[];
|
|
32
|
+
isSeeded: boolean;
|
|
33
|
+
/** Seed a fresh page list. No-op if pages already populated or watermarked. */
|
|
34
|
+
seedIfEmpty: (defs: SeedPageDef[]) => void;
|
|
35
|
+
addPage: (def: PageDef) => void;
|
|
36
|
+
insertPage: (index: number, def: PageDef) => void;
|
|
37
|
+
/** Deep-clone a page (state + config) right after the source; returns the new id. */
|
|
38
|
+
duplicatePage: (sourceId: string) => string | null;
|
|
39
|
+
removePage: (id: string) => void;
|
|
40
|
+
movePage: (id: string, direction: 'up' | 'down') => void;
|
|
41
|
+
/** Patch fields on a page's `state` Y.Map. */
|
|
42
|
+
updatePageState: (id: string, partial: Record<string, unknown>) => void;
|
|
43
|
+
/** Convert a page to another template in place (keeps id, pos). */
|
|
44
|
+
setPageConfig: (id: string, configId: string, newState: Record<string, unknown>) => void;
|
|
45
|
+
/** Apply updates/inserts/removes as ONE undo step; updated pages get their whole state replaced. Returns inserted page ids. */
|
|
46
|
+
replaceDeck: (ops: ReplaceDeckOps) => string[];
|
|
47
|
+
/** Undo the last LOCAL page operation (add/remove/duplicate/move). */
|
|
48
|
+
undoPageOp: () => void;
|
|
49
|
+
/** Redo the most recently undone page operation. */
|
|
50
|
+
redoPageOp: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Verwerfen of the newest `replaceDeck`: undoes back to before it (page ops
|
|
53
|
+
* made since go with it) and drops the redo stack, so Redo cannot bring the
|
|
54
|
+
* discarded deck back.
|
|
55
|
+
*/
|
|
56
|
+
discardReplaceDeck: () => void;
|
|
57
|
+
canUndoPageOp: boolean;
|
|
58
|
+
canRedoPageOp: boolean;
|
|
59
|
+
/** Stamps of the page ops Undo/Redo would reach, read at call time. */
|
|
60
|
+
pageOpStamps: () => HistoryStamps;
|
|
61
|
+
/**
|
|
62
|
+
* Set when this build must not write the doc: it carries a newer document
|
|
63
|
+
* version (or a malformed stamp). Every mutator above is then a no-op and
|
|
64
|
+
* nothing is seeded or lifted; show `pages` read-only.
|
|
65
|
+
*/
|
|
66
|
+
schemaRefusal: DocumentRefusal | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Mirror a Y.Doc's `pagesById` map into React state and expose mutation
|
|
70
|
+
* helpers that wrap each change in a `ydoc.transact` so it propagates to
|
|
71
|
+
* remote peers. Migrates legacy docs (pages Y.Array, legacy_root) once.
|
|
72
|
+
*/
|
|
73
|
+
export declare function useYjsPages(ydoc: Y.Doc | null, isSynced: boolean, normalizeEcho?: NormalizeEcho | null): YjsPagesApi | null;
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
import { migrateYDocument, readYDocRefusal, stampYDocument, } from '@ggraphic/editor/collab/documentVersion';
|
|
5
|
+
import { appendPage, duplicatePageById, foldLegacyFormStateIntoFirstPage, getMetaMap, getPagesMap, insertPageAt, migrateLegacyDoc, movePageById, readPages, removePageById, replaceDeck, restorePageStateKeys, sameStateValue, seedPageId, seedPagesIfEmpty, setPageConfigById, updatePageStateById, } from '@ggraphic/editor/collab/pagesDoc';
|
|
6
|
+
import { YDOC_KEYS } from '@ggraphic/editor/collab/ydocKeys';
|
|
7
|
+
import { nextHistoryStamp } from '@ggraphic/editor/utils/historyStamp';
|
|
8
|
+
import { useCanvasEditorServices } from '../CanvasEditorProvider.js';
|
|
9
|
+
// Structural page ops (add/remove/duplicate/move/convert) — tracked by the
|
|
10
|
+
// page UndoManager.
|
|
11
|
+
const LOCAL_ORIGIN = Symbol('canvas-editor-pages-local');
|
|
12
|
+
// Per-keystroke template-field dual-writes — deliberately NOT tracked: they
|
|
13
|
+
// would flood the page-op undo stack with thousands of discrete entries.
|
|
14
|
+
const STATE_ORIGIN = Symbol('canvas-editor-pages-state');
|
|
15
|
+
// Seeding + legacy migration — not tracked either: the first Ctrl+Z in a
|
|
16
|
+
// fresh editor must not "undo the seed" and blank the document.
|
|
17
|
+
const SETUP_ORIGIN = Symbol('canvas-editor-pages-setup');
|
|
18
|
+
// Re-applies a replaced deck's page states after its undo/redo — untracked,
|
|
19
|
+
// but unlike STATE_ORIGIN not skipped by the mounted canvases.
|
|
20
|
+
const RESTORE_ORIGIN = Symbol('canvas-editor-pages-restore');
|
|
21
|
+
const DECK_STATES = 'deckStates';
|
|
22
|
+
/** When the step was first taken; Undo and Redo carry it across (`utils/historyStamp`). */
|
|
23
|
+
const STEP_STAMP = 'stepStamp';
|
|
24
|
+
/** A new stack item gets a stamp; one Undo or Redo creates keeps the original's (see onPopped). */
|
|
25
|
+
function stampStackItem(event) {
|
|
26
|
+
if (!event.stackItem.meta.has(STEP_STAMP))
|
|
27
|
+
event.stackItem.meta.set(STEP_STAMP, nextHistoryStamp());
|
|
28
|
+
}
|
|
29
|
+
/** Undo/Redo pushed the item's mirror onto the other stack before popping it. */
|
|
30
|
+
function carryStepStamp(manager, event) {
|
|
31
|
+
const stamp = event.stackItem.meta.get(STEP_STAMP);
|
|
32
|
+
if (typeof stamp !== 'number')
|
|
33
|
+
return;
|
|
34
|
+
const mirror = event.type === 'undo' ? manager.redoStack : manager.undoStack;
|
|
35
|
+
mirror[mirror.length - 1]?.meta.set(STEP_STAMP, stamp);
|
|
36
|
+
}
|
|
37
|
+
const stackStamp = (stack) => {
|
|
38
|
+
const stamp = stack[stack.length - 1]?.meta.get(STEP_STAMP);
|
|
39
|
+
return typeof stamp === 'number' ? stamp : null;
|
|
40
|
+
};
|
|
41
|
+
function snapshotStates(doc, normalize) {
|
|
42
|
+
const states = new Map();
|
|
43
|
+
const echoes = new Map();
|
|
44
|
+
for (const v of readPages(doc)) {
|
|
45
|
+
const state = JSON.parse(JSON.stringify(v.state));
|
|
46
|
+
states.set(v.id, state);
|
|
47
|
+
let echo = null;
|
|
48
|
+
try {
|
|
49
|
+
echo = normalize?.(v.configId, state) ?? null;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// Runs after the replacement committed: without an echo the undo only restores exact states.
|
|
53
|
+
console.warn('[useYjsPages] canvas echo failed for page', v.id, err);
|
|
54
|
+
}
|
|
55
|
+
if (echo)
|
|
56
|
+
echoes.set(v.id, echo);
|
|
57
|
+
}
|
|
58
|
+
return { states, echoes };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Yjs undo only reverts the items its own transaction wrote. Every mounted
|
|
62
|
+
* canvas — on this client and on each collaborator's — echoes a replaced page
|
|
63
|
+
* right back, and those newer items survive the undo. So a deck replacement
|
|
64
|
+
* keeps the states it changed, and its undo/redo writes them back key by key
|
|
65
|
+
* where the live value still is the opposite snapshot or its canvas echo. Any
|
|
66
|
+
* other value is a real edit, whoever made it and whenever: it is kept.
|
|
67
|
+
*/
|
|
68
|
+
function restoreDeckStates(doc, manager, event) {
|
|
69
|
+
const states = event.stackItem.meta.get(DECK_STATES);
|
|
70
|
+
if (!states)
|
|
71
|
+
return;
|
|
72
|
+
// The opposite stack's new item carries them on, for redo after undo and back.
|
|
73
|
+
const mirror = event.type === 'undo' ? manager.redoStack : manager.undoStack;
|
|
74
|
+
mirror[mirror.length - 1]?.meta.set(DECK_STATES, states);
|
|
75
|
+
const [target, other, otherEcho] = event.type === 'undo'
|
|
76
|
+
? [states.before, states.after, states.afterEcho]
|
|
77
|
+
: [states.after, states.before, states.beforeEcho];
|
|
78
|
+
const live = new Set(readPages(doc).map((v) => v.id));
|
|
79
|
+
doc.transact(() => {
|
|
80
|
+
for (const [id, state] of target) {
|
|
81
|
+
if (!live.has(id))
|
|
82
|
+
continue;
|
|
83
|
+
const expected = other.get(id) ?? {};
|
|
84
|
+
const echo = otherEcho.get(id);
|
|
85
|
+
const keys = new Set([...Object.keys(state), ...Object.keys(expected)]);
|
|
86
|
+
restorePageStateKeys(doc, id, state, keys, (key, value) => sameStateValue(value, expected[key]) ||
|
|
87
|
+
(echo !== undefined && Object.hasOwn(echo, key) && sameStateValue(value, echo[key])));
|
|
88
|
+
}
|
|
89
|
+
}, RESTORE_ORIGIN);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Origin of this client's own page-state dual-writes. Exported so
|
|
93
|
+
* useYjsPageStateSync can skip them — without the filter every local
|
|
94
|
+
* keystroke (dual-written into the page state map by CanvasEditor) would
|
|
95
|
+
* round-trip back into component state and rebuild it mid-typing.
|
|
96
|
+
* Structural ops (LOCAL_ORIGIN) are NOT skipped: the carousel chrome they
|
|
97
|
+
* rewrite (the host's `carousel.refreshChrome`) must reach the mounted canvases.
|
|
98
|
+
*/
|
|
99
|
+
export const PAGES_STATE_ORIGIN = STATE_ORIGIN;
|
|
100
|
+
const noChrome = () => { };
|
|
101
|
+
const noop = () => { };
|
|
102
|
+
const noStamps = () => ({ undo: null, redo: null });
|
|
103
|
+
/** The API of a doc this build must not write: its pages, and nothing that changes them. */
|
|
104
|
+
function refusedApi(pages, schemaRefusal) {
|
|
105
|
+
return {
|
|
106
|
+
pages,
|
|
107
|
+
// Seeded as far as the page manager is concerned: it must not seed over it.
|
|
108
|
+
isSeeded: true,
|
|
109
|
+
seedIfEmpty: noop,
|
|
110
|
+
addPage: noop,
|
|
111
|
+
insertPage: noop,
|
|
112
|
+
duplicatePage: () => null,
|
|
113
|
+
removePage: noop,
|
|
114
|
+
movePage: noop,
|
|
115
|
+
updatePageState: noop,
|
|
116
|
+
setPageConfig: noop,
|
|
117
|
+
replaceDeck: () => [],
|
|
118
|
+
undoPageOp: noop,
|
|
119
|
+
redoPageOp: noop,
|
|
120
|
+
discardReplaceDeck: noop,
|
|
121
|
+
canUndoPageOp: false,
|
|
122
|
+
canRedoPageOp: false,
|
|
123
|
+
pageOpStamps: noStamps,
|
|
124
|
+
schemaRefusal,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const shallowEqualState = (a, b) => {
|
|
128
|
+
const keysA = Object.keys(a);
|
|
129
|
+
if (keysA.length !== Object.keys(b).length)
|
|
130
|
+
return false;
|
|
131
|
+
for (const k of keysA) {
|
|
132
|
+
if (a[k] !== b[k])
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Mirror a Y.Doc's `pagesById` map into React state and expose mutation
|
|
139
|
+
* helpers that wrap each change in a `ydoc.transact` so it propagates to
|
|
140
|
+
* remote peers. Migrates legacy docs (pages Y.Array, legacy_root) once.
|
|
141
|
+
*/
|
|
142
|
+
export function useYjsPages(ydoc, isSynced, normalizeEcho = null) {
|
|
143
|
+
const [version, setVersion] = useState(0);
|
|
144
|
+
const [historyVersion, setHistoryVersion] = useState(0);
|
|
145
|
+
// Keyed by doc, not by hook instance — collab providers can hand us a NEW
|
|
146
|
+
// Y.Doc mid-session (reconnect), and skipping migration on the replacement
|
|
147
|
+
// doc would let the default seed shadow a legacy deck.
|
|
148
|
+
const migratedDocsRef = useRef(new WeakSet());
|
|
149
|
+
// A lift that failed (a step broke the page set): the doc stays unwritten.
|
|
150
|
+
const [failedLift, setFailedLift] = useState(null);
|
|
151
|
+
const undoManagerRef = useRef(null);
|
|
152
|
+
// Identity cache: untouched pages keep their PageView (and state object)
|
|
153
|
+
// identity across version bumps, so memo'd PageWrappers don't re-render
|
|
154
|
+
// whenever ANY page changes.
|
|
155
|
+
const viewsRef = useRef([]);
|
|
156
|
+
// The host keeps the carousel chrome true after page ops; without it they leave it as is.
|
|
157
|
+
const refreshChrome = useCanvasEditorServices().carousel?.refreshChrome ?? noChrome;
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (!ydoc || !isSynced)
|
|
160
|
+
return undefined;
|
|
161
|
+
const pagesMap = getPagesMap(ydoc);
|
|
162
|
+
const meta = getMetaMap(ydoc);
|
|
163
|
+
// Brings the doc to this build's document version, or leaves it alone
|
|
164
|
+
// when it is newer. Re-run when a version stamp changes remotely: a
|
|
165
|
+
// stamp raced down by an older client is lifted again (the steps are
|
|
166
|
+
// idempotent), a newer one turns this client read-only. Neither loops —
|
|
167
|
+
// this client writes only while the stored version is below its own.
|
|
168
|
+
// The trigger is the stamp, not the data: old-shape data written under
|
|
169
|
+
// a current stamp (an old bundle, a peer before it saw the newer stamp)
|
|
170
|
+
// is never lifted here — see "Old writers" in DOCUMENT_VERSIONING.md.
|
|
171
|
+
let disposed = false;
|
|
172
|
+
const settleVersion = () => {
|
|
173
|
+
if (disposed || readYDocRefusal(ydoc))
|
|
174
|
+
return;
|
|
175
|
+
const outcome = ydoc.transact(() => migrateYDocument(ydoc), SETUP_ORIGIN);
|
|
176
|
+
if (outcome.status === 'invalid' || outcome.status === 'newer') {
|
|
177
|
+
console.error('[useYjsPages] document version not lifted:', outcome);
|
|
178
|
+
setFailedLift({ doc: ydoc, refusal: outcome });
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
if (!migratedDocsRef.current.has(ydoc)) {
|
|
182
|
+
migratedDocsRef.current.add(ydoc);
|
|
183
|
+
// A newer doc is not touched at all, not even by the legacy lift.
|
|
184
|
+
if (!readYDocRefusal(ydoc)) {
|
|
185
|
+
ydoc.transact(() => {
|
|
186
|
+
migrateLegacyDoc(ydoc);
|
|
187
|
+
foldLegacyFormStateIntoFirstPage(ydoc);
|
|
188
|
+
}, SETUP_ORIGIN);
|
|
189
|
+
settleVersion();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const isVersionKey = (key) => key === YDOC_KEYS.schemaVersion || key.startsWith(YDOC_KEYS.kindVersionPrefix);
|
|
193
|
+
const onMeta = (event) => {
|
|
194
|
+
if (event.transaction.origin === SETUP_ORIGIN)
|
|
195
|
+
return;
|
|
196
|
+
if (![...event.keysChanged].some(isVersionKey))
|
|
197
|
+
return;
|
|
198
|
+
// Re-render to pick up a refusal; lift outside the remote transaction.
|
|
199
|
+
setVersion((v) => v + 1);
|
|
200
|
+
queueMicrotask(settleVersion);
|
|
201
|
+
};
|
|
202
|
+
meta.observe(onMeta);
|
|
203
|
+
// Re-derive on every change — local AND remote. The writer hooks below
|
|
204
|
+
// mutate the Y.Doc only; they don't keep a separate React mirror, so
|
|
205
|
+
// skipping local-origin events would leave React showing stale data.
|
|
206
|
+
const onChange = () => {
|
|
207
|
+
setVersion((v) => v + 1);
|
|
208
|
+
};
|
|
209
|
+
pagesMap.observeDeep(onChange);
|
|
210
|
+
// Undo manager scoped to LOCAL_ORIGIN — only structural page ops are
|
|
211
|
+
// tracked (state dual-writes use STATE_ORIGIN, seeds SETUP_ORIGIN, layer
|
|
212
|
+
// edits in yjsBinding.ts their own symbol). captureTimeout=0 ensures
|
|
213
|
+
// each page op is a discrete undo step.
|
|
214
|
+
const undoManager = new Y.UndoManager([pagesMap, ydoc.getMap(YDOC_KEYS.deckReplaceMark)], {
|
|
215
|
+
trackedOrigins: new Set([LOCAL_ORIGIN]),
|
|
216
|
+
captureTimeout: 0,
|
|
217
|
+
});
|
|
218
|
+
undoManagerRef.current = undoManager;
|
|
219
|
+
const onUndoChange = () => setHistoryVersion((v) => v + 1);
|
|
220
|
+
const onPopped = (event) => {
|
|
221
|
+
carryStepStamp(undoManager, event);
|
|
222
|
+
restoreDeckStates(ydoc, undoManager, event);
|
|
223
|
+
};
|
|
224
|
+
undoManager.on('stack-item-added', stampStackItem);
|
|
225
|
+
undoManager.on('stack-item-added', onUndoChange);
|
|
226
|
+
undoManager.on('stack-item-popped', onPopped);
|
|
227
|
+
undoManager.on('stack-item-popped', onUndoChange);
|
|
228
|
+
undoManager.on('stack-cleared', onUndoChange);
|
|
229
|
+
setVersion((v) => v + 1);
|
|
230
|
+
return () => {
|
|
231
|
+
disposed = true;
|
|
232
|
+
meta.unobserve(onMeta);
|
|
233
|
+
pagesMap.unobserveDeep(onChange);
|
|
234
|
+
undoManager.off('stack-item-added', stampStackItem);
|
|
235
|
+
undoManager.off('stack-item-added', onUndoChange);
|
|
236
|
+
undoManager.off('stack-item-popped', onPopped);
|
|
237
|
+
undoManager.off('stack-item-popped', onUndoChange);
|
|
238
|
+
undoManager.off('stack-cleared', onUndoChange);
|
|
239
|
+
undoManager.destroy();
|
|
240
|
+
undoManagerRef.current = null;
|
|
241
|
+
};
|
|
242
|
+
}, [ydoc, isSynced]);
|
|
243
|
+
return useMemo(() => {
|
|
244
|
+
if (!ydoc || !isSynced)
|
|
245
|
+
return null;
|
|
246
|
+
// A pure read, so the first synced render already refuses — before any
|
|
247
|
+
// effect could seed or write.
|
|
248
|
+
const schemaRefusal = readYDocRefusal(ydoc) ?? (failedLift?.doc === ydoc ? failedLift.refusal : null);
|
|
249
|
+
if (schemaRefusal)
|
|
250
|
+
return refusedApi(readPages(ydoc), schemaRefusal);
|
|
251
|
+
const fresh = readPages(ydoc);
|
|
252
|
+
const prev = viewsRef.current;
|
|
253
|
+
const prevById = new Map(prev.map((v) => [v.id, v]));
|
|
254
|
+
let unchanged = fresh.length === prev.length;
|
|
255
|
+
const stable = fresh.map((view, i) => {
|
|
256
|
+
const cached = prevById.get(view.id);
|
|
257
|
+
if (cached &&
|
|
258
|
+
cached.yMap === view.yMap &&
|
|
259
|
+
cached.stateEpoch === view.stateEpoch &&
|
|
260
|
+
cached.configId === view.configId &&
|
|
261
|
+
cached.pos === view.pos &&
|
|
262
|
+
shallowEqualState(cached.state, view.state)) {
|
|
263
|
+
if (prev[i] !== cached)
|
|
264
|
+
unchanged = false;
|
|
265
|
+
return cached;
|
|
266
|
+
}
|
|
267
|
+
unchanged = false;
|
|
268
|
+
return view;
|
|
269
|
+
});
|
|
270
|
+
const pages = unchanged ? prev : stable;
|
|
271
|
+
viewsRef.current = pages;
|
|
272
|
+
const seedIfEmpty = (defs) => {
|
|
273
|
+
ydoc.transact(() => {
|
|
274
|
+
const seeded = seedPagesIfEmpty(ydoc, defs.map((def, index) => ({ ...def, id: def.id ?? seedPageId(index) })));
|
|
275
|
+
// Fold NOW, in the same transaction — deferring to a later open
|
|
276
|
+
// would overwrite page edits made in between (see pagesDoc).
|
|
277
|
+
if (seeded) {
|
|
278
|
+
foldLegacyFormStateIntoFirstPage(ydoc);
|
|
279
|
+
stampYDocument(ydoc);
|
|
280
|
+
}
|
|
281
|
+
}, SETUP_ORIGIN);
|
|
282
|
+
};
|
|
283
|
+
const addPage = (def) => {
|
|
284
|
+
ydoc.transact(() => {
|
|
285
|
+
appendPage(ydoc, def);
|
|
286
|
+
refreshChrome(ydoc);
|
|
287
|
+
}, LOCAL_ORIGIN);
|
|
288
|
+
};
|
|
289
|
+
const insertPage = (index, def) => {
|
|
290
|
+
ydoc.transact(() => {
|
|
291
|
+
insertPageAt(ydoc, index, def);
|
|
292
|
+
refreshChrome(ydoc);
|
|
293
|
+
}, LOCAL_ORIGIN);
|
|
294
|
+
};
|
|
295
|
+
const duplicatePage = (sourceId) => {
|
|
296
|
+
const newId = uuid();
|
|
297
|
+
let ok = false;
|
|
298
|
+
ydoc.transact(() => {
|
|
299
|
+
ok = duplicatePageById(ydoc, sourceId, newId);
|
|
300
|
+
refreshChrome(ydoc);
|
|
301
|
+
}, LOCAL_ORIGIN);
|
|
302
|
+
return ok ? newId : null;
|
|
303
|
+
};
|
|
304
|
+
const removePage = (id) => {
|
|
305
|
+
ydoc.transact(() => {
|
|
306
|
+
removePageById(ydoc, id);
|
|
307
|
+
refreshChrome(ydoc);
|
|
308
|
+
}, LOCAL_ORIGIN);
|
|
309
|
+
};
|
|
310
|
+
const movePage = (id, direction) => {
|
|
311
|
+
ydoc.transact(() => {
|
|
312
|
+
movePageById(ydoc, id, direction);
|
|
313
|
+
refreshChrome(ydoc);
|
|
314
|
+
}, LOCAL_ORIGIN);
|
|
315
|
+
};
|
|
316
|
+
const updatePageState = (id, partial) => {
|
|
317
|
+
ydoc.transact(() => {
|
|
318
|
+
updatePageStateById(ydoc, id, partial);
|
|
319
|
+
}, STATE_ORIGIN);
|
|
320
|
+
};
|
|
321
|
+
const setPageConfig = (id, configId, newState) => {
|
|
322
|
+
ydoc.transact(() => {
|
|
323
|
+
setPageConfigById(ydoc, id, configId, newState);
|
|
324
|
+
}, LOCAL_ORIGIN);
|
|
325
|
+
};
|
|
326
|
+
const replaceDeckOp = (ops) => {
|
|
327
|
+
let ids = [];
|
|
328
|
+
const before = snapshotStates(ydoc, normalizeEcho);
|
|
329
|
+
const manager = undoManagerRef.current;
|
|
330
|
+
const depth = manager?.undoStack.length ?? 0;
|
|
331
|
+
ydoc.transact(() => {
|
|
332
|
+
ids = replaceDeck(ydoc, ops, LOCAL_ORIGIN);
|
|
333
|
+
refreshChrome(ydoc);
|
|
334
|
+
// Yjs undo pops nothing when every item it would revert was overwritten
|
|
335
|
+
// since (the canvas echo does exactly that), and silently undoes the
|
|
336
|
+
// next older step instead. A key only this client writes always reverts.
|
|
337
|
+
const mark = ydoc.getMap(YDOC_KEYS.deckReplaceMark);
|
|
338
|
+
const key = String(ydoc.clientID);
|
|
339
|
+
mark.set(key, (mark.get(key) ?? 0) + 1);
|
|
340
|
+
}, LOCAL_ORIGIN);
|
|
341
|
+
const after = snapshotStates(ydoc, normalizeEcho);
|
|
342
|
+
const changed = (id) => JSON.stringify(before.states.get(id)) !== JSON.stringify(after.states.get(id));
|
|
343
|
+
const keep = (states) => new Map([...states].filter(([id]) => changed(id)));
|
|
344
|
+
if (manager && manager.undoStack.length > depth) {
|
|
345
|
+
const states = {
|
|
346
|
+
before: keep(before.states),
|
|
347
|
+
after: keep(after.states),
|
|
348
|
+
beforeEcho: keep(before.echoes),
|
|
349
|
+
afterEcho: keep(after.echoes),
|
|
350
|
+
};
|
|
351
|
+
manager.undoStack[manager.undoStack.length - 1].meta.set(DECK_STATES, states);
|
|
352
|
+
}
|
|
353
|
+
return ids;
|
|
354
|
+
};
|
|
355
|
+
const discardReplaceDeck = () => {
|
|
356
|
+
const manager = undoManagerRef.current;
|
|
357
|
+
if (!manager)
|
|
358
|
+
return;
|
|
359
|
+
let at = manager.undoStack.length - 1;
|
|
360
|
+
while (at >= 0 && !manager.undoStack[at].meta.has(DECK_STATES))
|
|
361
|
+
at--;
|
|
362
|
+
if (at < 0)
|
|
363
|
+
return;
|
|
364
|
+
while (manager.undoStack.length > at)
|
|
365
|
+
manager.undo();
|
|
366
|
+
manager.clear(false, true);
|
|
367
|
+
};
|
|
368
|
+
const undoManager = undoManagerRef.current;
|
|
369
|
+
return {
|
|
370
|
+
pages,
|
|
371
|
+
isSeeded: pages.length > 0,
|
|
372
|
+
seedIfEmpty,
|
|
373
|
+
addPage,
|
|
374
|
+
insertPage,
|
|
375
|
+
duplicatePage,
|
|
376
|
+
removePage,
|
|
377
|
+
movePage,
|
|
378
|
+
updatePageState,
|
|
379
|
+
setPageConfig,
|
|
380
|
+
replaceDeck: replaceDeckOp,
|
|
381
|
+
undoPageOp: () => undoManager?.undo(),
|
|
382
|
+
redoPageOp: () => undoManager?.redo(),
|
|
383
|
+
discardReplaceDeck,
|
|
384
|
+
canUndoPageOp: (undoManager?.undoStack.length ?? 0) > 0,
|
|
385
|
+
canRedoPageOp: (undoManager?.redoStack.length ?? 0) > 0,
|
|
386
|
+
pageOpStamps: () => {
|
|
387
|
+
const manager = undoManagerRef.current;
|
|
388
|
+
return manager
|
|
389
|
+
? { undo: stackStamp(manager.undoStack), redo: stackStamp(manager.redoStack) }
|
|
390
|
+
: noStamps();
|
|
391
|
+
},
|
|
392
|
+
schemaRefusal: null,
|
|
393
|
+
};
|
|
394
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- version/historyVersion invalidate the derived view
|
|
395
|
+
}, [ydoc, isSynced, version, historyVersion, normalizeEcho, refreshChrome, failedLift]);
|
|
396
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** The state key an `on<Key>Change` callback writes, or null for any other name. */
|
|
2
|
+
export declare function stateKeyOfCallback(name: string): string | null;
|
|
3
|
+
export declare function createPageSyncedCallbacks(getCallbacks: () => Record<string, (val: unknown) => void>, writePageState: (partial: Record<string, unknown>) => void, alsoPersistKeys?: readonly string[]): Record<string, (val: unknown) => void>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Dual-write wrapper for template-field callbacks.
|
|
4
|
+
*
|
|
5
|
+
* Template-field edits flow `on<Key>Change` → host (CanvasEditorRouter).
|
|
6
|
+
* A mounted page renders from `pages[i].state`, which historically was only
|
|
7
|
+
* written at seed time — so text edits never reached other clients live
|
|
8
|
+
* (collab) or page duplication (local), and a reload mounted the stale seed.
|
|
9
|
+
* Wrapping each callback to ALSO write the page's state map keeps
|
|
10
|
+
* `pages[i].state` current everywhere.
|
|
11
|
+
*
|
|
12
|
+
* The returned object is identity-stable, and each entry resolves the host
|
|
13
|
+
* callback and page-state writer at CALL time through the getters — hosts
|
|
14
|
+
* rebuild their callbacks object every render, and memoizing on it would
|
|
15
|
+
* re-render every PageWrapper per keystroke (the returned object is each
|
|
16
|
+
* page's `callbacks` prop).
|
|
17
|
+
*
|
|
18
|
+
* Callback names follow the `on<Key>Change` convention (see
|
|
19
|
+
* CanvasEditorRouter.createCallbacks); anything else passes through untouched.
|
|
20
|
+
*
|
|
21
|
+
* `alsoPersistKeys` covers the other half of a page: the free-element
|
|
22
|
+
* collections (pageElementStateKeys()). No host declares a callback for
|
|
23
|
+
* those — the config's own actions mutate them through `setState` — so the
|
|
24
|
+
* wrapper mints the missing `on<Key>Change` itself, writing page state only.
|
|
25
|
+
* That is what `useEmitHostStateChanges` calls from the mounted page. Without
|
|
26
|
+
* it a key with no host entry has no writer at all, which is exactly how free
|
|
27
|
+
* elements went missing on reload (#3416).
|
|
28
|
+
*/
|
|
29
|
+
const CALLBACK_NAME = /^on([A-Z].*)Change$/;
|
|
30
|
+
/** The state key an `on<Key>Change` callback writes, or null for any other name. */
|
|
31
|
+
export function stateKeyOfCallback(name) {
|
|
32
|
+
const match = CALLBACK_NAME.exec(name);
|
|
33
|
+
return match ? match[1].charAt(0).toLowerCase() + match[1].slice(1) : null;
|
|
34
|
+
}
|
|
35
|
+
const callbackName = (stateKey) => `on${stateKey.charAt(0).toUpperCase()}${stateKey.slice(1)}Change`;
|
|
36
|
+
export function createPageSyncedCallbacks(getCallbacks, writePageState, alsoPersistKeys = []) {
|
|
37
|
+
const wrapped = {};
|
|
38
|
+
for (const name of Object.keys(getCallbacks())) {
|
|
39
|
+
const stateKey = stateKeyOfCallback(name);
|
|
40
|
+
if (!stateKey) {
|
|
41
|
+
wrapped[name] = (val) => {
|
|
42
|
+
getCallbacks()[name]?.(val);
|
|
43
|
+
};
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
wrapped[name] = (val) => {
|
|
47
|
+
getCallbacks()[name]?.(val);
|
|
48
|
+
writePageState({ [stateKey]: val });
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
for (const stateKey of alsoPersistKeys) {
|
|
52
|
+
const name = callbackName(stateKey);
|
|
53
|
+
// A host that DOES declare this one is already dual-written above; minting
|
|
54
|
+
// a second entry would drop its callback.
|
|
55
|
+
if (wrapped[name])
|
|
56
|
+
continue;
|
|
57
|
+
wrapped[name] = (val) => {
|
|
58
|
+
writePageState({ [stateKey]: val });
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return wrapped;
|
|
62
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized Y.Doc key strings. A typo in any of these is a silent
|
|
3
|
+
* data-loss bug — keep all references through this module so a rename
|
|
4
|
+
* stays synchronized.
|
|
5
|
+
*
|
|
6
|
+
* The Hocuspocus service (services/hocuspocus/src/internalApi.ts) has zero
|
|
7
|
+
* cross-package deps and re-declares these literals inline — keep both in
|
|
8
|
+
* sync when changing anything here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const YDOC_KEYS: {
|
|
11
|
+
/** Current multi-page container: Y.Map<pageId, page Y.Map>. */
|
|
12
|
+
readonly pagesById: "pagesById";
|
|
13
|
+
/** Doc-level markers: seed watermark, one-shot migration flags. */
|
|
14
|
+
readonly meta: "meta";
|
|
15
|
+
/** Fractional order key on each page Y.Map (lexicographic sort). */
|
|
16
|
+
readonly pos: "pos";
|
|
17
|
+
/** Set in `meta` once pages were seeded (server-authoritative or client). */
|
|
18
|
+
readonly pagesSeeded: "pagesSeeded";
|
|
19
|
+
/** Set in `meta` after the legacy pages-array/root migration ran. */
|
|
20
|
+
readonly legacyMigrated: "legacyMigrated";
|
|
21
|
+
/** Set in `meta` after root formState was folded into the single page. */
|
|
22
|
+
readonly formStateFolded: "formStateFolded";
|
|
23
|
+
/**
|
|
24
|
+
* Core document format version in `meta` (`@ggraphic/schema`
|
|
25
|
+
* `CANVAS_DOCUMENT_VERSION`); absent = 1. Only ever raised.
|
|
26
|
+
*/
|
|
27
|
+
readonly schemaVersion: "schemaVersion";
|
|
28
|
+
/** Prefix of a host kind's version in `meta`: `kindVersion:<stateKey>`; absent = 1. */
|
|
29
|
+
readonly kindVersionPrefix: "kindVersion:";
|
|
30
|
+
/**
|
|
31
|
+
* Top-level Y.Map<clientID, counter> each deck replacement bumps under its
|
|
32
|
+
* own client's key, so its page-level undo always reverts something.
|
|
33
|
+
*/
|
|
34
|
+
readonly deckReplaceMark: "deckReplaceMark";
|
|
35
|
+
/** Legacy multi-page container (Y.Array) — migrated into pagesById on open. */
|
|
36
|
+
readonly pages: "pages";
|
|
37
|
+
/** Legacy root form-state bucket — folded into pages[0].state on open. */
|
|
38
|
+
readonly formState: "formState";
|
|
39
|
+
readonly legacyRoot: "legacy_root";
|
|
40
|
+
readonly config: "config";
|
|
41
|
+
readonly state: "state";
|
|
42
|
+
readonly id: "id";
|
|
43
|
+
readonly configId: "configId";
|
|
44
|
+
/**
|
|
45
|
+
* Legacy watermark set inside `formState` by an authoritative server-side
|
|
46
|
+
* seed (mint-on-open) so the client never seeds template defaults over it.
|
|
47
|
+
*/
|
|
48
|
+
readonly seeded: "_seeded";
|
|
49
|
+
};
|
|
50
|
+
export type YDocKey = (typeof YDOC_KEYS)[keyof typeof YDOC_KEYS];
|