@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,1144 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
/**
|
|
4
|
+
* CanvasEditorShell - Canvas editor with shared sidebar and page management
|
|
5
|
+
*
|
|
6
|
+
* Brand-free: what a host adds (document tabs, the menu bar, the page picker,
|
|
7
|
+
* template callbacks) it registers through `registerEditorShell` (./editorShell).
|
|
8
|
+
*
|
|
9
|
+
* Architecture: SHARED SIDEBAR pattern
|
|
10
|
+
* - ONE sidebar managed at this level (not per-page)
|
|
11
|
+
* - Sidebar reads config/state/actions from the ACTIVE page
|
|
12
|
+
* - GenericCanvas children render in "bare" mode (no individual sidebars)
|
|
13
|
+
* - Click on a page to select it, sidebar updates automatically
|
|
14
|
+
*
|
|
15
|
+
* Performance optimizations applied (Vercel React Best Practices):
|
|
16
|
+
* - Memoized page components to prevent unnecessary re-renders
|
|
17
|
+
* - Functional setState for stable callbacks
|
|
18
|
+
* - Hoisted static JSX elements
|
|
19
|
+
* - content-visibility CSS for off-screen pages
|
|
20
|
+
*
|
|
21
|
+
* The component is split into:
|
|
22
|
+
* - PageWrapper — memoized per-page renderer (./PageWrapper)
|
|
23
|
+
* - usePageRefs — imperative canvas/DOM ref arrays
|
|
24
|
+
* - useLoadedConfigs — async config cache
|
|
25
|
+
* - useMobileSheetFit — mobile: fit the active page above the open sheet
|
|
26
|
+
* - useScrollToAddedPage — auto-scroll to a newly added page
|
|
27
|
+
* - usePageUndoRedoShortcuts — Cmd/Ctrl+Z page-array history
|
|
28
|
+
* - useToolbarHandlers — bundled toolbar actions for the active page
|
|
29
|
+
*/
|
|
30
|
+
import { DocumentBrandContext } from '@ggraphic/editor/brand/documentBrand';
|
|
31
|
+
import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
|
|
32
|
+
import { messages, useMessages } from '@ggraphic/editor/i18n/messages';
|
|
33
|
+
import { pagePersistedStateKeys } from '@ggraphic/editor/collab/pageElementStateKeys';
|
|
34
|
+
import { serializeDeck } from '@ggraphic/editor/collab/pagesDoc';
|
|
35
|
+
import { createPageSyncedCallbacks } from '@ggraphic/editor/collab/wrapCallbacksWithPageSync';
|
|
36
|
+
import { CanvasTextEditorProvider } from '@ggraphic/editor/components/CanvasTextOverlay';
|
|
37
|
+
import { DEFAULT_FORMAT_ID, getCanvasFormatOrDefault, isPrintFormat, isSlideFormat, } from '@ggraphic/editor/formats/index';
|
|
38
|
+
import { usePageManager, useMultiPageExport, usePageThumbnails, } from '@ggraphic/editor/hooks/index';
|
|
39
|
+
import { AnnouncerContext, useLiveAnnouncer } from '@ggraphic/editor/hooks/useAnnounce';
|
|
40
|
+
import { useDeckAutoSave } from '@ggraphic/editor/hooks/useDeckAutoSave';
|
|
41
|
+
import { browserFileDelivery } from '@ggraphic/editor/hostServices';
|
|
42
|
+
import { UserUploadsProvider } from '@ggraphic/editor/sidebar/UserUploadsProvider';
|
|
43
|
+
import { useCanvasStoreSelector } from '@ggraphic/editor/stores/CanvasStoreProvider';
|
|
44
|
+
import { AutoSaveStoreProvider } from '@ggraphic/editor/stores/useAutoSaveStore';
|
|
45
|
+
import { Skeleton } from '@ggraphic/editor/ui/skeleton';
|
|
46
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
47
|
+
import { ensureFontsReady } from '@ggraphic/editor/utils/ensureFontsReady';
|
|
48
|
+
import { sameLayerEntries } from '@ggraphic/editor/utils/layerLabels';
|
|
49
|
+
import Konva from 'konva';
|
|
50
|
+
import { useCallback, useImperativeHandle, useRef, useMemo, useEffect, useState, Suspense, startTransition, } from 'react';
|
|
51
|
+
import { shareImageText } from '../../configs/shareSection.js';
|
|
52
|
+
import { exportPptxDeck } from '@ggraphic/editor/export/pptx/exportPptxDeck';
|
|
53
|
+
import { exportPrintPdf, lowResolutionWarnings, PRINT_JPEG_QUALITY, printPdfFilename, } from '../../export/printExport.js';
|
|
54
|
+
import { exportSlidesPdf } from '@ggraphic/editor/export/slidesPdf';
|
|
55
|
+
import { useIsCanvasMobile } from '@ggraphic/editor/hooks/useIsCanvasMobile';
|
|
56
|
+
import { useZoomGestures } from '@ggraphic/editor/hooks/useZoomGestures';
|
|
57
|
+
import { CanvasEditorLayout } from '@ggraphic/editor/layouts/index';
|
|
58
|
+
import { SidebarPanel } from '@ggraphic/editor/sidebar/SidebarPanel';
|
|
59
|
+
import { SidebarTabBar } from '@ggraphic/editor/sidebar/SidebarTabBar';
|
|
60
|
+
import { hasEffects } from '@ggraphic/editor/sidebar/sections/effects/effectsFor';
|
|
61
|
+
import { EffectsSection } from '@ggraphic/editor/sidebar/sections/EffectsSection';
|
|
62
|
+
import { LayersSection } from '@ggraphic/editor/sidebar/sections/LayersSection';
|
|
63
|
+
import { collectAltTextPages as collectCapturedAltTextPages } from '@ggraphic/editor/utils/collectAltTextPages';
|
|
64
|
+
import { creditLines } from '@ggraphic/editor/utils/photoCredits';
|
|
65
|
+
import { scrollBehavior } from '@ggraphic/editor/utils/scrollBehavior';
|
|
66
|
+
import { CanvasAnnouncer } from '@ggraphic/editor/components/CanvasAnnouncer';
|
|
67
|
+
import { CanvasActionSheet } from '@ggraphic/editor/components/CanvasContextMenu/CanvasActionSheet';
|
|
68
|
+
import { CanvasContextMenu } from '@ggraphic/editor/components/CanvasContextMenu/CanvasContextMenu';
|
|
69
|
+
import { CanvasPageSkeleton, CanvasTabRailSkeleton, } from '@ggraphic/editor/components/CanvasEditorSkeleton';
|
|
70
|
+
import { CanvasMetaBar, CanvasZoomIndicator } from '@ggraphic/editor/components/CanvasMetaBar';
|
|
71
|
+
import { SelectionPill } from '@ggraphic/editor/components/SelectionPill';
|
|
72
|
+
import { PageThumbnailStrip } from '../PageThumbnailStrip.js';
|
|
73
|
+
import { SlideNotesPanel } from '@ggraphic/editor/components/SlideNotesPanel';
|
|
74
|
+
import { AddPageButton } from '../AddPageButton.js';
|
|
75
|
+
import { Toolbar } from '../Toolbar.js';
|
|
76
|
+
import { hasObjectActions } from '@ggraphic/editor/components/TopBar/ContextControls';
|
|
77
|
+
import { ContextToolbar } from '@ggraphic/editor/components/TopBar/ContextToolbar';
|
|
78
|
+
import { MobileSelectionBar } from '@ggraphic/editor/components/TopBar/MobileSelectionBar';
|
|
79
|
+
import { MobileSelectionControls } from '@ggraphic/editor/components/TopBar/MobileSelectionControls';
|
|
80
|
+
import { FloatingAiSuggestionBanner } from '@ggraphic/editor/components/TopBar/modules/FloatingAiSuggestionBanner';
|
|
81
|
+
import { MultiSelectionToolbar } from '@ggraphic/editor/components/TopBar/MultiSelectionToolbar';
|
|
82
|
+
import { autoSwitchTab } from '@ggraphic/editor/components/CanvasEditor/autoSwitchTab';
|
|
83
|
+
import { registeredEditorShell, withEditorTabs, } from '@ggraphic/editor/components/CanvasEditor/editorShell';
|
|
84
|
+
import { useCanvasContextMenu } from '@ggraphic/editor/components/CanvasEditor/hooks/useCanvasContextMenu';
|
|
85
|
+
import { useLoadedConfigs } from '@ggraphic/editor/components/CanvasEditor/hooks/useLoadedConfigs';
|
|
86
|
+
import { useMobileSheetFit } from '@ggraphic/editor/components/CanvasEditor/hooks/useMobileSheetFit';
|
|
87
|
+
import { usePageRefs } from '@ggraphic/editor/components/CanvasEditor/hooks/usePageRefs';
|
|
88
|
+
import { usePageUndoRedoShortcuts } from '@ggraphic/editor/components/CanvasEditor/hooks/usePageUndoRedoShortcuts';
|
|
89
|
+
import { needsImpressum, usePrintImpressumGate, } from '@ggraphic/editor/components/CanvasEditor/hooks/usePrintImpressumGate';
|
|
90
|
+
import { useScrollToAddedPage } from '@ggraphic/editor/components/CanvasEditor/hooks/useScrollToAddedPage';
|
|
91
|
+
import { useToolbarHandlers } from '@ggraphic/editor/components/CanvasEditor/hooks/useToolbarHandlers';
|
|
92
|
+
import { useWorkAreaDeselect } from '@ggraphic/editor/components/CanvasEditor/hooks/useWorkAreaDeselect';
|
|
93
|
+
import { layersTab, withLayersTab } from '@ggraphic/editor/components/CanvasEditor/layersTab';
|
|
94
|
+
import { getMobileSelectionArea } from '@ggraphic/editor/components/CanvasEditor/mobileSelectionArea';
|
|
95
|
+
import { PageWrapper } from '@ggraphic/editor/components/CanvasEditor/PageWrapper';
|
|
96
|
+
// Hoisted static JSX elements (Rule 6.3: avoids re-creation every render)
|
|
97
|
+
const sidebarLoadingFallback = (_jsxs("div", { style: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
flexDirection: 'column',
|
|
100
|
+
gap: 'var(--spacing-small)',
|
|
101
|
+
padding: 'var(--spacing-large)',
|
|
102
|
+
minHeight: '200px',
|
|
103
|
+
width: '100%',
|
|
104
|
+
maxWidth: '20rem',
|
|
105
|
+
}, children: [_jsx(Skeleton, { className: "h-6 w-3/4 rounded" }), _jsx(Skeleton, { className: "h-20 w-full rounded-lg" }), _jsx(Skeleton, { className: "h-4 w-1/2 rounded" }), _jsx(Skeleton, { className: "h-4 w-2/3 rounded" })] }));
|
|
106
|
+
const NO_EDITOR_TABS = [];
|
|
107
|
+
const NoShellProvider = ({ children }) => _jsx(_Fragment, { children: children });
|
|
108
|
+
const NO_CALLBACK_KEYS = () => [];
|
|
109
|
+
const DEFAULT_DECK_LOCALE = () => 'de-DE';
|
|
110
|
+
/** Folien-PDF: 2× der 1920 × 1080-Folie, scharf auch im Vollbild. */
|
|
111
|
+
const SLIDES_PDF_PIXEL_RATIO = 2;
|
|
112
|
+
export function CanvasEditorShell(props) {
|
|
113
|
+
return (_jsx(AutoSaveStoreProvider, { initialShareToken: props.initialShareToken ?? null, children: _jsx(CanvasEditorInner, { ...props }) }));
|
|
114
|
+
}
|
|
115
|
+
function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialProps, onExport, onCancel, onDownload, callbacks = {}, maxPages = 10, initialPages, collaborative, chromeLeft, chromeCenter, chromeRight, onInvitePeople, onSaveAsTemplate, onCollabSnapshot, onAutoSaveShareToken, initialTab = null, onActiveTabChange, galleryAutoSave = true, showShare = true, exportApiRef, hostChrome, readOnly = false, }) {
|
|
116
|
+
const t = useMessages();
|
|
117
|
+
// Note: onAutoSaveShareToken is threaded down to useCanvasAutoSave (via
|
|
118
|
+
// PageWrapper → GenericCanvas) instead of a store subscription here — a
|
|
119
|
+
// subscription dies with the unmount, losing tokens that resolve after the
|
|
120
|
+
// editor closes (flush save, in-flight save) and re-creating duplicates.
|
|
121
|
+
const isMobileWeb = useIsCanvasMobile();
|
|
122
|
+
const { announcer, message: liveMessage } = useLiveAnnouncer();
|
|
123
|
+
const { pages, addPage, duplicateCurrentPage, duplicatePage, movePage, removePage, setPageConfig, currentPageIndex, setCurrentPageIndex, canAddMore, pageCount, getConfigForPage, getPageYMap, updatePageState, pagesDoc, undoPageOp, redoPageOp, discardReplaceDeck, replaceDeck, canUndoPageOp, canRedoPageOp, pageOpStamps, isPreview, schemaRefusal, } = usePageManager({
|
|
124
|
+
initialConfigId,
|
|
125
|
+
formatId,
|
|
126
|
+
initialProps,
|
|
127
|
+
maxPages,
|
|
128
|
+
// Persisted page JSON: `parseInitialPages` only checks that `configId` is
|
|
129
|
+
// a string; an unknown id fails when its config loads.
|
|
130
|
+
initialPages: initialPages,
|
|
131
|
+
collaborative,
|
|
132
|
+
announce: announcer.announce,
|
|
133
|
+
});
|
|
134
|
+
// Store loaded configs for rendering
|
|
135
|
+
const loadedConfigs = useLoadedConfigs({ pages, getConfigForPage });
|
|
136
|
+
const { tabs: editorTabs = NO_EDITOR_TABS, Provider: ShellProvider = NoShellProvider, pagePicker, pageCallbackKeys = NO_CALLBACK_KEYS, deckLocale: deckLocaleOf = DEFAULT_DECK_LOCALE, } = registeredEditorShell();
|
|
137
|
+
// Template-field callbacks dual-write into the page's `state` map so other
|
|
138
|
+
// clients (useYjsPageStateSync), page duplication and reloads see the
|
|
139
|
+
// edits. Wrappers are identity-stable per page id and resolve the host
|
|
140
|
+
// callbacks + writer at call time — the host rebuilds its callbacks object
|
|
141
|
+
// every render, and memoizing on it would re-render every PageWrapper per
|
|
142
|
+
// keystroke.
|
|
143
|
+
const callbacksRef = useRef(callbacks);
|
|
144
|
+
callbacksRef.current = callbacks;
|
|
145
|
+
const updatePageStateRef = useRef(updatePageState);
|
|
146
|
+
updatePageStateRef.current = updatePageState;
|
|
147
|
+
// The host declares text-field callbacks for its own canvas type only; a
|
|
148
|
+
// page of another template (added, converted, or inserted by the creator)
|
|
149
|
+
// gets its own fields' writers minted from its configId.
|
|
150
|
+
const pageCallbacksCacheRef = useRef(new Map());
|
|
151
|
+
const getCallbacksForPage = useCallback((pageId, configId) => {
|
|
152
|
+
const cache = pageCallbacksCacheRef.current;
|
|
153
|
+
const cached = cache.get(pageId);
|
|
154
|
+
if (cached?.configId === configId)
|
|
155
|
+
return cached.wrapped;
|
|
156
|
+
const wrapped = createPageSyncedCallbacks(() => callbacksRef.current, (partial) => updatePageStateRef.current(pageId, partial), [...pageCallbackKeys(configId), ...pagePersistedStateKeys()]);
|
|
157
|
+
cache.set(pageId, { configId, wrapped });
|
|
158
|
+
return wrapped;
|
|
159
|
+
}, [pageCallbackKeys]);
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
const ids = new Set(pages.map((p) => p.id));
|
|
162
|
+
for (const id of pageCallbacksCacheRef.current.keys()) {
|
|
163
|
+
if (!ids.has(id))
|
|
164
|
+
pageCallbacksCacheRef.current.delete(id);
|
|
165
|
+
}
|
|
166
|
+
}, [pages]);
|
|
167
|
+
// Sidebar state - ONE shared sidebar for all pages
|
|
168
|
+
// Desktop only: on mobile an open tab is a bottom sheet over the canvas, so
|
|
169
|
+
// a remembered tab is neither restored nor reported (which would also
|
|
170
|
+
// overwrite the desktop's remembered tab).
|
|
171
|
+
const [activeTab, setActiveTab] = useState(isMobileWeb ? null : initialTab);
|
|
172
|
+
const prevTabRef = useRef(null);
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
if (!isMobileWeb)
|
|
175
|
+
onActiveTabChange?.(activeTab);
|
|
176
|
+
}, [activeTab, onActiveTabChange, isMobileWeb]);
|
|
177
|
+
// Active page state/actions/selectedElement - synced via effect from PageWrapper
|
|
178
|
+
const [activePageData, setActivePageData] = useState(null);
|
|
179
|
+
// Toolbar state - reported by active page's GenericCanvas
|
|
180
|
+
const [toolbarState, setToolbarState] = useState(null);
|
|
181
|
+
// Imperative canvas + DOM ref arrays (grown synchronously before render)
|
|
182
|
+
const { canvasRefsRef, pageDomRefsRef, pagesContainerRef, canvasRefs } = usePageRefs(pages.length);
|
|
183
|
+
const [zoom, setZoom] = useState(1);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
pagesContainerRef.current?.style.setProperty('--canvas-zoom', String(zoom));
|
|
186
|
+
}, [zoom, pagesContainerRef]);
|
|
187
|
+
// Pinch and ctrl/cmd+wheel drive the same zoom as the CanvasMetaBar buttons.
|
|
188
|
+
// The container mounts after the loading state, so the hook gets it as state.
|
|
189
|
+
const [pagesContainer, setPagesContainer] = useState(null);
|
|
190
|
+
const pagesContainerCallbackRef = useCallback((el) => {
|
|
191
|
+
pagesContainerRef.current = el;
|
|
192
|
+
setPagesContainer(el);
|
|
193
|
+
}, [pagesContainerRef]);
|
|
194
|
+
useZoomGestures(pagesContainer, setZoom, { leftOrigin: isMobileWeb });
|
|
195
|
+
// Every page binds its config to its page Y.Map — in collab mode
|
|
196
|
+
// that syncs to peers, in local mode it makes duplicate/move/undo carry
|
|
197
|
+
// the full page content (the Y.Doc is the single source of truth).
|
|
198
|
+
// Bindings are identity-cached per page: a fresh object per render would
|
|
199
|
+
// defeat PageWrapper's memo for the whole deck on every parent render.
|
|
200
|
+
const pageBindingCacheRef = useRef(new Map());
|
|
201
|
+
const pageBindingAt = useCallback((index, pageId, isActivePage) => {
|
|
202
|
+
const pageYMap = getPageYMap(index);
|
|
203
|
+
if (!pageYMap)
|
|
204
|
+
return undefined;
|
|
205
|
+
const publishSelection = collaborative ? isActivePage : false;
|
|
206
|
+
const isSynced = collaborative ? collaborative.isSynced : true;
|
|
207
|
+
const provider = collaborative?.provider ?? null;
|
|
208
|
+
const cache = pageBindingCacheRef.current;
|
|
209
|
+
const cached = cache.get(pageId);
|
|
210
|
+
if (cached &&
|
|
211
|
+
cached.pageYMap === pageYMap &&
|
|
212
|
+
cached.isSynced === isSynced &&
|
|
213
|
+
cached.provider === provider &&
|
|
214
|
+
cached.publishSelection === publishSelection) {
|
|
215
|
+
return cached;
|
|
216
|
+
}
|
|
217
|
+
const next = { pageYMap, isSynced, provider, pageId, publishSelection };
|
|
218
|
+
cache.set(pageId, next);
|
|
219
|
+
return next;
|
|
220
|
+
}, [collaborative, getPageYMap]);
|
|
221
|
+
// Multi-page export hook
|
|
222
|
+
const { exportAllPages, downloadAllAsZip, isExporting: isMultiExporting, exportProgress, error: multiExportError, notice: multiExportNotice, } = useMultiPageExport({
|
|
223
|
+
canvasRefs,
|
|
224
|
+
canvasType: 'sharepic',
|
|
225
|
+
});
|
|
226
|
+
// Stable callback using functional pattern (Rule 5.5)
|
|
227
|
+
const handleExport = useCallback((base64) => {
|
|
228
|
+
onExport(base64);
|
|
229
|
+
}, [onExport]);
|
|
230
|
+
// Template selection handler
|
|
231
|
+
const handleAddPage = useCallback(async (configId, stateOverrides) => {
|
|
232
|
+
await addPage(configId, true, stateOverrides);
|
|
233
|
+
}, [addPage]);
|
|
234
|
+
// "Vorlage ändern" — convert an existing page to another template.
|
|
235
|
+
const [templateChangePageId, setTemplateChangePageId] = useState(null);
|
|
236
|
+
const handleOpenTemplateChange = useCallback((pageId) => {
|
|
237
|
+
setTemplateChangePageId(pageId);
|
|
238
|
+
}, []);
|
|
239
|
+
const handleCloseTemplateChange = useCallback(() => {
|
|
240
|
+
setTemplateChangePageId(null);
|
|
241
|
+
}, []);
|
|
242
|
+
const handleSelectTemplateChange = useCallback((configId, state) => {
|
|
243
|
+
if (templateChangePageId)
|
|
244
|
+
void setPageConfig(templateChangePageId, configId, state);
|
|
245
|
+
setTemplateChangePageId(null);
|
|
246
|
+
}, [templateChangePageId, setPageConfig]);
|
|
247
|
+
const templateChangePage = useMemo(() => {
|
|
248
|
+
if (templateChangePageId === null)
|
|
249
|
+
return null;
|
|
250
|
+
const index = pages.findIndex((p) => p.id === templateChangePageId);
|
|
251
|
+
return index >= 0
|
|
252
|
+
? { index, configId: pages[index].configId, state: pages[index].state }
|
|
253
|
+
: null;
|
|
254
|
+
}, [templateChangePageId, pages]);
|
|
255
|
+
// Sidebar handlers - functional setState (Rule 5.5)
|
|
256
|
+
const handleTabClick = useCallback((tabId) => {
|
|
257
|
+
setActiveTab((current) => (current === tabId ? null : tabId));
|
|
258
|
+
}, [setActiveTab]);
|
|
259
|
+
// Mobile: closing the sheet keeps the selection — its controls live in the
|
|
260
|
+
// bottom selection bar, which comes back once the sheet is gone.
|
|
261
|
+
const handlePanelClose = useCallback(() => {
|
|
262
|
+
prevTabRef.current = null;
|
|
263
|
+
setActiveTab(null);
|
|
264
|
+
}, [setActiveTab]);
|
|
265
|
+
// Page selection handler - functional setState (Rule 5.5)
|
|
266
|
+
const handlePageSelect = useCallback((index) => {
|
|
267
|
+
setCurrentPageIndex(index);
|
|
268
|
+
}, [setCurrentPageIndex]);
|
|
269
|
+
// Thumbnail-strip click: select page AND smooth-scroll its full-size wrapper into view.
|
|
270
|
+
const handleThumbnailSelect = useCallback((index) => {
|
|
271
|
+
setCurrentPageIndex(index);
|
|
272
|
+
pageDomRefsRef.current[index]?.current?.scrollIntoView({
|
|
273
|
+
behavior: scrollBehavior(),
|
|
274
|
+
block: 'center',
|
|
275
|
+
});
|
|
276
|
+
}, [setCurrentPageIndex, pageDomRefsRef]);
|
|
277
|
+
useScrollToAddedPage({
|
|
278
|
+
pagesLength: pages.length,
|
|
279
|
+
currentPageIndex,
|
|
280
|
+
pageDomRefsRef,
|
|
281
|
+
});
|
|
282
|
+
// Capture per-page PNG snapshots for the thumbnail strip
|
|
283
|
+
const pageThumbnails = usePageThumbnails({
|
|
284
|
+
pages,
|
|
285
|
+
canvasRefs: canvasRefsRef.current,
|
|
286
|
+
});
|
|
287
|
+
// Page-level undo/redo via capture-phase keydown.
|
|
288
|
+
const activePageStamps = useCallback(() => canvasRefsRef.current[currentPageIndex]?.current?.historyStamps?.() ?? null, [canvasRefsRef, currentPageIndex]);
|
|
289
|
+
usePageUndoRedoShortcuts({
|
|
290
|
+
activePageStamps,
|
|
291
|
+
pageOpStamps,
|
|
292
|
+
undoPageOp,
|
|
293
|
+
redoPageOp,
|
|
294
|
+
});
|
|
295
|
+
// Callback for PageWrapper to report state changes
|
|
296
|
+
const handlePageStateChange = useCallback((pageId, state, actions, selectedElement) => {
|
|
297
|
+
// Transitions: the canvas paints the selection/edit first; the editor
|
|
298
|
+
// shell (sidebar, context bar) follows without blocking that frame.
|
|
299
|
+
startTransition(() => setActivePageData((prev) => {
|
|
300
|
+
// Only update if data actually changed (shallow compare)
|
|
301
|
+
if (prev?.pageId === pageId &&
|
|
302
|
+
prev?.state === state &&
|
|
303
|
+
prev?.actions === actions &&
|
|
304
|
+
prev?.selectedElement === selectedElement) {
|
|
305
|
+
return prev;
|
|
306
|
+
}
|
|
307
|
+
return { pageId, state, actions, selectedElement };
|
|
308
|
+
}));
|
|
309
|
+
}, []);
|
|
310
|
+
const handleToolbarStateChange = useCallback((report) => {
|
|
311
|
+
startTransition(() => setToolbarState((prev) => {
|
|
312
|
+
if (prev &&
|
|
313
|
+
prev.selectedElement === report.selectedElement &&
|
|
314
|
+
prev.activeFloatingModule === report.activeFloatingModule &&
|
|
315
|
+
prev.canUndo === report.canUndo &&
|
|
316
|
+
prev.canRedo === report.canRedo &&
|
|
317
|
+
prev.canMoveUp === report.canMoveUp &&
|
|
318
|
+
prev.canMoveDown === report.canMoveDown &&
|
|
319
|
+
prev.canDuplicate === report.canDuplicate &&
|
|
320
|
+
prev.canDelete === report.canDelete &&
|
|
321
|
+
prev.isCropping === report.isCropping &&
|
|
322
|
+
prev.cropAspect === report.cropAspect &&
|
|
323
|
+
prev.cropRotation === report.cropRotation &&
|
|
324
|
+
prev.isExpanding === report.isExpanding &&
|
|
325
|
+
prev.selectionCount === report.selectionCount &&
|
|
326
|
+
prev.canCopy === report.canCopy &&
|
|
327
|
+
prev.lockState === report.lockState &&
|
|
328
|
+
prev.canLock === report.canLock &&
|
|
329
|
+
prev.selectedLayerIds === report.selectedLayerIds &&
|
|
330
|
+
sameLayerEntries(prev.layers, report.layers)) {
|
|
331
|
+
return prev;
|
|
332
|
+
}
|
|
333
|
+
return report;
|
|
334
|
+
}));
|
|
335
|
+
}, []);
|
|
336
|
+
// Live reads for the chat's spec path; stable identity so the section's
|
|
337
|
+
// memoized adapter is not rebuilt on every page change. Latest-ref pattern
|
|
338
|
+
// like callbacksRef: the bridge reads it at call time, never during render.
|
|
339
|
+
const specEditRef = useRef({
|
|
340
|
+
pages,
|
|
341
|
+
activePageId: pages[currentPageIndex]?.id ?? null,
|
|
342
|
+
replaceDeck,
|
|
343
|
+
});
|
|
344
|
+
// eslint-disable-next-line react-hooks/refs -- latest-ref write, read only by the bridge's handlers
|
|
345
|
+
specEditRef.current = { pages, activePageId: pages[currentPageIndex]?.id ?? null, replaceDeck };
|
|
346
|
+
// A page the Vorlagen tab just added: shown as soon as the deck has it.
|
|
347
|
+
const pageToShowRef = useRef(null);
|
|
348
|
+
const showPage = useCallback((pageId) => {
|
|
349
|
+
const index = specEditRef.current.pages.findIndex((p) => p.id === pageId);
|
|
350
|
+
if (index >= 0)
|
|
351
|
+
handleThumbnailSelect(index);
|
|
352
|
+
else
|
|
353
|
+
pageToShowRef.current = pageId;
|
|
354
|
+
}, [handleThumbnailSelect]);
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
const pageId = pageToShowRef.current;
|
|
357
|
+
if (!pageId)
|
|
358
|
+
return;
|
|
359
|
+
const index = pages.findIndex((p) => p.id === pageId);
|
|
360
|
+
if (index < 0)
|
|
361
|
+
return;
|
|
362
|
+
pageToShowRef.current = null;
|
|
363
|
+
handleThumbnailSelect(index);
|
|
364
|
+
}, [pages, handleThumbnailSelect]);
|
|
365
|
+
const hasReplaceDeck = replaceDeck !== null;
|
|
366
|
+
const specEdit = useMemo(() => hasReplaceDeck
|
|
367
|
+
? {
|
|
368
|
+
getPages: () => specEditRef.current.pages,
|
|
369
|
+
getActivePageId: () => specEditRef.current.activePageId,
|
|
370
|
+
replaceDeck: (ops) => specEditRef.current.replaceDeck?.(ops) ?? [],
|
|
371
|
+
}
|
|
372
|
+
: null, [hasReplaceDeck]);
|
|
373
|
+
const services = useCanvasEditorServices();
|
|
374
|
+
const { fileDelivery = browserFileDelivery, print: printService } = services;
|
|
375
|
+
const filenamePrefix = fileDelivery.filenamePrefix ?? 'ggraphic';
|
|
376
|
+
const shareTitle = fileDelivery.shareTitle ?? 'ggraphic';
|
|
377
|
+
// The host's document tabs (the Vorlagen) change the deck, so they need the
|
|
378
|
+
// synced pages doc.
|
|
379
|
+
const availableEditorTabs = useMemo(() => hasReplaceDeck ? editorTabs.filter((def) => def.isAvailable({ services, formatId })) : [], [editorTabs, hasReplaceDeck, services, formatId]);
|
|
380
|
+
const takesPageDrops = availableEditorTabs.some((def) => def.takesPageDrops);
|
|
381
|
+
// A tile dropped on a page goes to the open document tab: a Seite lands
|
|
382
|
+
// after that page, a print Vorlage asks first on a design with content.
|
|
383
|
+
const pageDropRef = useRef(null);
|
|
384
|
+
const handleDropVorlage = useCallback((id, pageId) => pageDropRef.current?.drop(id, pageId), []);
|
|
385
|
+
const toolbarHandlers = useToolbarHandlers({
|
|
386
|
+
canvasRefsRef,
|
|
387
|
+
currentPageIndex,
|
|
388
|
+
pageOpStamps,
|
|
389
|
+
undoPageOp,
|
|
390
|
+
redoPageOp,
|
|
391
|
+
discardReplaceDeck,
|
|
392
|
+
});
|
|
393
|
+
const handleCaptureCanvas = useCallback(async (options) => {
|
|
394
|
+
const ref = canvasRefsRef.current[currentPageIndex];
|
|
395
|
+
if (!ref?.current)
|
|
396
|
+
return null;
|
|
397
|
+
return await ref.current.captureCanvas(options);
|
|
398
|
+
}, [currentPageIndex, canvasRefsRef]);
|
|
399
|
+
// Wie capturePages: jede Seite braucht ihr gemountetes Stage, sonst bricht der Export ab.
|
|
400
|
+
const buildPptx = useCallback(async (onProgress) => {
|
|
401
|
+
await ensureFontsReady();
|
|
402
|
+
const deck = serializeDeck(pagesDoc);
|
|
403
|
+
const refs = canvasRefsRef.current;
|
|
404
|
+
if (deck.some((_, i) => !refs[i]?.current)) {
|
|
405
|
+
throw new Error(messages().errors.exportSlidesPartial);
|
|
406
|
+
}
|
|
407
|
+
// One brand per deck: its pages share a country.
|
|
408
|
+
const brand = deck[0] ? loadedConfigs.get(deck[0].configId)?.brand : undefined;
|
|
409
|
+
return exportPptxDeck({
|
|
410
|
+
pages: deck.map((page) => page.state),
|
|
411
|
+
format: getCanvasFormatOrDefault(formatId),
|
|
412
|
+
rasterizeElement: async (slideIndex, elementId) => (await refs[slideIndex]?.current?.rasterizeElement(elementId)) ?? null,
|
|
413
|
+
...(documentTitle ? { title: documentTitle } : {}),
|
|
414
|
+
...(brand ? { brand } : {}),
|
|
415
|
+
...(onProgress ? { onProgress } : {}),
|
|
416
|
+
});
|
|
417
|
+
}, [pagesDoc, canvasRefsRef, formatId, documentTitle, loadedConfigs]);
|
|
418
|
+
useImperativeHandle(exportApiRef, () => ({
|
|
419
|
+
captureActivePage: async ({ pixelRatio = 1, transparent = false } = {}) => {
|
|
420
|
+
await ensureFontsReady();
|
|
421
|
+
return handleCaptureCanvas({ format: 'png', pixelRatio, includeBackground: !transparent });
|
|
422
|
+
},
|
|
423
|
+
capturePages: async ({ pixelRatio = 1 } = {}) => {
|
|
424
|
+
await ensureFontsReady();
|
|
425
|
+
return exportAllPages({ pixelRatio });
|
|
426
|
+
},
|
|
427
|
+
exportPptx: () => buildPptx(),
|
|
428
|
+
getPages: () => serializeDeck(pagesDoc).map(({ configId, state }) => ({ configId, state })),
|
|
429
|
+
undo: toolbarHandlers.undo,
|
|
430
|
+
redo: toolbarHandlers.redo,
|
|
431
|
+
}), [handleCaptureCanvas, exportAllPages, buildPptx, pagesDoc, toolbarHandlers]);
|
|
432
|
+
const handleCaptureCanvasForAi = useCallback(async () => {
|
|
433
|
+
const ref = canvasRefsRef.current[currentPageIndex];
|
|
434
|
+
if (!ref?.current)
|
|
435
|
+
return null;
|
|
436
|
+
return await ref.current.captureCanvasForAi();
|
|
437
|
+
}, [currentPageIndex, canvasRefsRef]);
|
|
438
|
+
const collectAltTextPages = useCallback(async (scope) => {
|
|
439
|
+
await ensureFontsReady();
|
|
440
|
+
const refs = canvasRefsRef.current;
|
|
441
|
+
const indices = scope === 'active' ? [currentPageIndex] : refs.map((_, i) => i);
|
|
442
|
+
return collectCapturedAltTextPages(refs, indices);
|
|
443
|
+
}, [currentPageIndex, canvasRefsRef]);
|
|
444
|
+
// Every page, not just the active one: a selection left behind on page 2
|
|
445
|
+
// keeps its context bar alive after the user scrolls away.
|
|
446
|
+
const handleDeselectAll = useCallback(() => {
|
|
447
|
+
canvasRefsRef.current.forEach((ref) => ref.current?.deselect());
|
|
448
|
+
}, [canvasRefsRef]);
|
|
449
|
+
// Ebenen: die Liste zeigt die aktive Seite und wählt über deren Store aus.
|
|
450
|
+
const handleLayerSelect = useCallback((change) => canvasRefsRef.current[currentPageIndex]?.current?.selectLayers?.(change), [canvasRefsRef, currentPageIndex]);
|
|
451
|
+
// Enter/F2 auf einem Eintrag: was das Kontextmenü für das Element anbietet —
|
|
452
|
+
// Text bearbeiten, wenn die Auswahl es erlaubt, sonst ein Bild in den Rahmen.
|
|
453
|
+
const handleLayerActivate = useCallback((id) => {
|
|
454
|
+
const page = canvasRefsRef.current[currentPageIndex]?.current;
|
|
455
|
+
if (!page)
|
|
456
|
+
return;
|
|
457
|
+
page.selectLayers?.({ kind: 'only', id });
|
|
458
|
+
const snapshot = page.getMenuSnapshot?.();
|
|
459
|
+
if (snapshot?.caps.canEditText)
|
|
460
|
+
page.runCommand?.('editText', null);
|
|
461
|
+
else if (snapshot?.module?.type === 'frame')
|
|
462
|
+
page.runCommand?.('insertFrameImage', null);
|
|
463
|
+
}, [canvasRefsRef, currentPageIndex]);
|
|
464
|
+
// „Zu den Ebenen": öffnet den Bereich; die Liste holt sich den Fokus, sobald sie steht.
|
|
465
|
+
const [layersFocusRequested, setLayersFocusRequested] = useState(false);
|
|
466
|
+
const handleLayersFocusHandled = useCallback(() => setLayersFocusRequested(false), []);
|
|
467
|
+
const handleSkipToLayers = useCallback(() => {
|
|
468
|
+
setActiveTab('layers');
|
|
469
|
+
setLayersFocusRequested(true);
|
|
470
|
+
}, []);
|
|
471
|
+
// While a suggestion is open the pages are locked: keep or discard it first.
|
|
472
|
+
// A selection from before would still answer Delete and arrow keys.
|
|
473
|
+
const hasPendingSuggestion = useCanvasStoreSelector((s) => s.pendingAiSuggestion !== null);
|
|
474
|
+
const canUndo = (toolbarState?.canUndo ?? false) || canUndoPageOp;
|
|
475
|
+
const canRedo = (toolbarState?.canRedo ?? false) || canRedoPageOp;
|
|
476
|
+
// A waiting suggestion is kept or discarded, not undone: the bar hides the
|
|
477
|
+
// buttons then, and a host-drawn bar must do the same.
|
|
478
|
+
const onHistoryChange = hostChrome?.onHistoryChange;
|
|
479
|
+
useEffect(() => {
|
|
480
|
+
onHistoryChange?.({
|
|
481
|
+
canUndo: canUndo && !hasPendingSuggestion,
|
|
482
|
+
canRedo: canRedo && !hasPendingSuggestion,
|
|
483
|
+
});
|
|
484
|
+
}, [onHistoryChange, canUndo, canRedo, hasPendingSuggestion]);
|
|
485
|
+
useEffect(() => {
|
|
486
|
+
if (hasPendingSuggestion)
|
|
487
|
+
handleDeselectAll();
|
|
488
|
+
}, [hasPendingSuggestion, handleDeselectAll]);
|
|
489
|
+
// Desktop right-click menu; "Bild ersetzen …" opens the bar's picker.
|
|
490
|
+
const [backgroundPickerRequest, setBackgroundPickerRequest] = useState(0);
|
|
491
|
+
const requestBackgroundPicker = useCallback(() => setBackgroundPickerRequest((n) => n + 1), []);
|
|
492
|
+
const openImageAdjust = useCallback(() => setActiveTab('image-adjust'), []);
|
|
493
|
+
const pageIds = useMemo(() => pages.map((page) => page.id), [pages]);
|
|
494
|
+
const { menuRef: contextMenuRef, openAtAnchor: openContextMenuAt } = useCanvasContextMenu({
|
|
495
|
+
containerRef: pagesContainerRef,
|
|
496
|
+
canvasRefsRef,
|
|
497
|
+
pageDomRefsRef,
|
|
498
|
+
pageIds,
|
|
499
|
+
currentPageIndex,
|
|
500
|
+
canAddPage: canAddMore,
|
|
501
|
+
enabled: !isMobileWeb && !isPreview && !readOnly && !hasPendingSuggestion,
|
|
502
|
+
duplicatePage,
|
|
503
|
+
removePage,
|
|
504
|
+
openImageAdjust,
|
|
505
|
+
deselectAll: handleDeselectAll,
|
|
506
|
+
requestBackgroundPicker,
|
|
507
|
+
});
|
|
508
|
+
// Selection pill: reads the active page's selection geometry.
|
|
509
|
+
const getSelectionBox = useCallback(() => canvasRefsRef.current[currentPageIndex]?.current?.getSelectionBox?.() ?? null, [canvasRefsRef, currentPageIndex]);
|
|
510
|
+
const subscribeManipulation = useCallback((listener) => canvasRefsRef.current[currentPageIndex]?.current?.subscribeManipulation?.(listener) ??
|
|
511
|
+
(() => { }), [canvasRefsRef, currentPageIndex]);
|
|
512
|
+
// The grey work area around the artboard is the natural "click out" target,
|
|
513
|
+
// and until now nothing happened there: the Konva stage is sized exactly to
|
|
514
|
+
// the artboard, and templates cover it with a full-bleed, listening
|
|
515
|
+
// background image, so the stage's own deselect (useCanvasInteractions) never
|
|
516
|
+
// fires. The guard keeps clicks that bubble up from a page from deselecting.
|
|
517
|
+
// Touch deselects only on a tap: the gutters are the scroll surfaces on mobile.
|
|
518
|
+
// A mouse press there also starts a marquee on the active page, so a
|
|
519
|
+
// selection can be drawn from outside the artboard.
|
|
520
|
+
const handleWorkAreaMousePress = useCallback((evt) => canvasRefsRef.current[currentPageIndex]?.current?.beginMarquee(evt), [canvasRefsRef, currentPageIndex]);
|
|
521
|
+
const handleWorkAreaPointerDown = useWorkAreaDeselect(handleDeselectAll, handleWorkAreaMousePress);
|
|
522
|
+
// The ONLY gallery autosave in this editor, for any page count — a
|
|
523
|
+
// single-page doc is a one-page deck. Per-page useCanvasAutoSave is
|
|
524
|
+
// disabled below (autoSave={false}); its legacy per-type metadata shape
|
|
525
|
+
// stays read-only for old drafts.
|
|
526
|
+
const captureFirstPage = useCallback(async () => {
|
|
527
|
+
const ref = canvasRefsRef.current[0];
|
|
528
|
+
return ref?.current ? await ref.current.captureCanvas() : null;
|
|
529
|
+
}, [canvasRefsRef]);
|
|
530
|
+
useDeckAutoSave({
|
|
531
|
+
ydoc: pagesDoc,
|
|
532
|
+
enabled: !collaborative && galleryAutoSave,
|
|
533
|
+
deckType: pages[0]?.configId ?? initialConfigId,
|
|
534
|
+
captureImage: captureFirstPage,
|
|
535
|
+
onShareToken: onAutoSaveShareToken,
|
|
536
|
+
});
|
|
537
|
+
// Collab mode has no shared_media autosave, so the host's document thumbnail
|
|
538
|
+
// only refreshed on download — edits persisted via Yjs but the gallery card
|
|
539
|
+
// kept showing the old state. Capture after local edits settle (and on tab
|
|
540
|
+
// hide) and hand the render to the host. Refs keep the ydoc listener stable
|
|
541
|
+
// across page switches.
|
|
542
|
+
const snapshotFnsRef = useRef({ capture: handleCaptureCanvas, notify: onCollabSnapshot });
|
|
543
|
+
snapshotFnsRef.current = { capture: handleCaptureCanvas, notify: onCollabSnapshot };
|
|
544
|
+
const collabYdoc = collaborative?.ydoc;
|
|
545
|
+
useEffect(() => {
|
|
546
|
+
if (!collabYdoc || !snapshotFnsRef.current.notify)
|
|
547
|
+
return;
|
|
548
|
+
let timer = null;
|
|
549
|
+
let idleHandle = null;
|
|
550
|
+
let lastSent = null;
|
|
551
|
+
// The gallery card shows the snapshot at ≤180 px, so a 540 px render
|
|
552
|
+
// (pixelRatio 0.5) is plenty even on retina — the default 2 rendered
|
|
553
|
+
// sixteen times the pixels on the main thread.
|
|
554
|
+
const snapshot = () => {
|
|
555
|
+
timer = null;
|
|
556
|
+
idleHandle = null;
|
|
557
|
+
void snapshotFnsRef.current.capture({ pixelRatio: 0.5 }).then((dataUrl) => {
|
|
558
|
+
if (dataUrl && dataUrl !== lastSent) {
|
|
559
|
+
lastSent = dataUrl;
|
|
560
|
+
snapshotFnsRef.current.notify?.(dataUrl);
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
const onUpdate = (_update, _origin, _doc, transaction) => {
|
|
565
|
+
if (!transaction.local)
|
|
566
|
+
return;
|
|
567
|
+
if (timer)
|
|
568
|
+
clearTimeout(timer);
|
|
569
|
+
if (idleHandle !== null)
|
|
570
|
+
window.cancelIdleCallback(idleHandle);
|
|
571
|
+
idleHandle = null;
|
|
572
|
+
timer = setTimeout(snapshotWhenIdle, 4000);
|
|
573
|
+
};
|
|
574
|
+
// Never render the snapshot into a running gesture.
|
|
575
|
+
const snapshotWhenIdle = () => {
|
|
576
|
+
if (Konva.isDragging() || Konva.isTransforming()) {
|
|
577
|
+
timer = setTimeout(snapshotWhenIdle, 1000);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
timer = null;
|
|
581
|
+
if (typeof window.requestIdleCallback === 'function') {
|
|
582
|
+
idleHandle = window.requestIdleCallback(snapshot, { timeout: 2000 });
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
snapshot();
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
// Takes a pending snapshot now — once, whether it waits on the timer or
|
|
589
|
+
// on the idle callback.
|
|
590
|
+
const flushPending = () => {
|
|
591
|
+
if (timer === null && idleHandle === null)
|
|
592
|
+
return;
|
|
593
|
+
if (timer !== null)
|
|
594
|
+
clearTimeout(timer);
|
|
595
|
+
if (idleHandle !== null)
|
|
596
|
+
window.cancelIdleCallback(idleHandle);
|
|
597
|
+
snapshot();
|
|
598
|
+
};
|
|
599
|
+
const onVisibilityChange = () => {
|
|
600
|
+
if (document.visibilityState === 'hidden')
|
|
601
|
+
flushPending();
|
|
602
|
+
};
|
|
603
|
+
collabYdoc.on('update', onUpdate);
|
|
604
|
+
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
605
|
+
return () => {
|
|
606
|
+
collabYdoc.off('update', onUpdate);
|
|
607
|
+
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
608
|
+
// Best effort — captureStageImage no-ops when the stage is already gone.
|
|
609
|
+
flushPending();
|
|
610
|
+
};
|
|
611
|
+
}, [collabYdoc]);
|
|
612
|
+
const handleDownload = useCallback(async (format = 'png', pixelRatio = 1, transparent = false) => {
|
|
613
|
+
const ref = canvasRefsRef.current[currentPageIndex];
|
|
614
|
+
if (!ref?.current)
|
|
615
|
+
return;
|
|
616
|
+
// Fonts load via font-display:swap; capture before they settle bakes in
|
|
617
|
+
// the fallback face (see ensureFontsReady). Gate the sync toDataURL path.
|
|
618
|
+
await ensureFontsReady();
|
|
619
|
+
const dataUrl = ref.current.toDataURL({
|
|
620
|
+
format,
|
|
621
|
+
pixelRatio,
|
|
622
|
+
includeBackground: !transparent,
|
|
623
|
+
});
|
|
624
|
+
if (dataUrl) {
|
|
625
|
+
const ext = format === 'jpeg' ? 'jpg' : format;
|
|
626
|
+
await fileDelivery.downloadDataUrl(dataUrl, `${filenamePrefix}-${messages().export.pageFile}-${currentPageIndex + 1}.${ext}`);
|
|
627
|
+
onDownload?.(dataUrl);
|
|
628
|
+
}
|
|
629
|
+
}, [currentPageIndex, canvasRefsRef, onDownload, fileDelivery, filenamePrefix]);
|
|
630
|
+
// Each poster page's live state for the impressum warning. The ref dedupes
|
|
631
|
+
// reports without a stale closure, the state re-renders the gate.
|
|
632
|
+
const [observedPages, setObservedPages] = useState({});
|
|
633
|
+
const observedPagesRef = useRef({});
|
|
634
|
+
const handleObservedState = useCallback((pageId, state, actions) => {
|
|
635
|
+
const prev = observedPagesRef.current[pageId];
|
|
636
|
+
if (prev?.state === state && prev.actions === actions)
|
|
637
|
+
return;
|
|
638
|
+
const next = { ...observedPagesRef.current, [pageId]: { pageId, state, actions } };
|
|
639
|
+
observedPagesRef.current = next;
|
|
640
|
+
startTransition(() => setObservedPages(next));
|
|
641
|
+
}, []);
|
|
642
|
+
// Print: one PDF page per editor page, in page order.
|
|
643
|
+
const printPages = useCallback(() => {
|
|
644
|
+
const refs = canvasRefsRef.current;
|
|
645
|
+
return refs.map((ref) => ({
|
|
646
|
+
captureTile: async (tile, pixelRatio) => (await ref.current?.capturePrintTile(tile, pixelRatio, PRINT_JPEG_QUALITY)) ?? null,
|
|
647
|
+
getImages: () => ref.current?.getPrintImages() ?? [],
|
|
648
|
+
}));
|
|
649
|
+
}, [canvasRefsRef]);
|
|
650
|
+
const printFormat = useMemo(() => {
|
|
651
|
+
const f = getCanvasFormatOrDefault(formatId);
|
|
652
|
+
return isPrintFormat(f) ? f : null;
|
|
653
|
+
}, [formatId]);
|
|
654
|
+
const handleDownloadPdf = useCallback(async () => {
|
|
655
|
+
if (!printFormat)
|
|
656
|
+
return;
|
|
657
|
+
const pages = printPages();
|
|
658
|
+
if (pages.some((_, i) => !canvasRefsRef.current[i]?.current)) {
|
|
659
|
+
throw new Error(messages().errors.exportPagesPartial);
|
|
660
|
+
}
|
|
661
|
+
const pdf = await exportPrintPdf({ format: printFormat, pages });
|
|
662
|
+
const blob = new Blob([pdf], { type: 'application/pdf' });
|
|
663
|
+
await fileDelivery.downloadBlob(blob, printPdfFilename(documentTitle ?? null, filenamePrefix));
|
|
664
|
+
}, [printFormat, printPages, canvasRefsRef, documentTitle, fileDelivery, filenamePrefix]);
|
|
665
|
+
const isSlideDeck = useMemo(() => isSlideFormat(getCanvasFormatOrDefault(formatId)), [formatId]);
|
|
666
|
+
const handleDownloadPptx = useCallback(async (onProgress) => {
|
|
667
|
+
const blob = await buildPptx(onProgress);
|
|
668
|
+
const filename = printPdfFilename(documentTitle ?? messages().defaults.presentationTitle, filenamePrefix).replace(/\.pdf$/, '.pptx');
|
|
669
|
+
await fileDelivery.downloadBlob(blob, filename);
|
|
670
|
+
}, [buildPptx, documentTitle, fileDelivery, filenamePrefix]);
|
|
671
|
+
const handleDownloadSlidesPdf = useCallback(async () => {
|
|
672
|
+
await ensureFontsReady();
|
|
673
|
+
const images = await exportAllPages({ pixelRatio: SLIDES_PDF_PIXEL_RATIO });
|
|
674
|
+
const pdf = await exportSlidesPdf(images);
|
|
675
|
+
const blob = new Blob([pdf], { type: 'application/pdf' });
|
|
676
|
+
await fileDelivery.downloadBlob(blob, printPdfFilename(documentTitle ?? messages().defaults.presentationTitle, filenamePrefix));
|
|
677
|
+
}, [exportAllPages, documentTitle, fileDelivery, filenamePrefix]);
|
|
678
|
+
// Every poster page should carry a filled-in V.i.S.d.P. / Impressum, whichever
|
|
679
|
+
// page is active; the download warns (never blocks) once every page has reported.
|
|
680
|
+
const impressumGate = usePrintImpressumGate(printFormat, pages, observedPages);
|
|
681
|
+
const getPrintWarnings = useCallback(() => (printFormat ? lowResolutionWarnings(printFormat, printPages()) : []), [printFormat, printPages]);
|
|
682
|
+
// Get active page data for shared sidebar
|
|
683
|
+
const currentPage = pages[currentPageIndex];
|
|
684
|
+
const activeConfig = currentPage ? loadedConfigs.get(currentPage.configId) : undefined;
|
|
685
|
+
// Use synced state/actions/selectedElement from PageWrapper.
|
|
686
|
+
// Guard on currentPage existing so we don't hit `undefined === undefined`
|
|
687
|
+
// when pages is empty during the first collaborative render.
|
|
688
|
+
const activeData = currentPage && activePageData?.pageId === currentPage.id ? activePageData : null;
|
|
689
|
+
const activeState = activeData?.state ?? null;
|
|
690
|
+
const activeActions = activeData?.actions ?? null;
|
|
691
|
+
const activeSelectedElement = activeData?.selectedElement ?? null;
|
|
692
|
+
// Compute visible tabs for active config.
|
|
693
|
+
// Always call getVisibleTabs when defined — gating on `activeState` causes a
|
|
694
|
+
// sticky stale-render after slide switches: the previous slide's PageWrapper
|
|
695
|
+
// callback owns `activePageData`, so `activeState` collapses to null until
|
|
696
|
+
// the new slide re-reports state, falling through to the unfiltered `tabs:`
|
|
697
|
+
// list (which intentionally contains hidden entries like `settings`/
|
|
698
|
+
// `frame-settings` for `getAutoSwitchTab` to target).
|
|
699
|
+
const visibleTabs = useMemo(() => {
|
|
700
|
+
if (!activeConfig)
|
|
701
|
+
return [];
|
|
702
|
+
let tabs = activeConfig.tabs;
|
|
703
|
+
if (activeConfig.getVisibleTabs) {
|
|
704
|
+
const visibleIds = activeConfig.getVisibleTabs(activeState, {
|
|
705
|
+
selectedElement: activeSelectedElement,
|
|
706
|
+
});
|
|
707
|
+
tabs = activeConfig.tabs.filter((tab) => visibleIds.includes(tab.id));
|
|
708
|
+
}
|
|
709
|
+
// Mobile has room for six areas; the chat gives way to the Vorlagen there for now.
|
|
710
|
+
if (isMobileWeb)
|
|
711
|
+
tabs = tabs.filter((tab) => tab.id !== 'chat');
|
|
712
|
+
return withEditorTabs(withLayersTab(tabs), availableEditorTabs);
|
|
713
|
+
}, [activeConfig, activeState, activeSelectedElement, availableEditorTabs, isMobileWeb]);
|
|
714
|
+
const configTabIds = useMemo(() => activeConfig?.tabs.map((tab) => tab.id) ?? [], [activeConfig]);
|
|
715
|
+
// Compute disabled tabs for active config
|
|
716
|
+
const disabledTabs = useMemo(() => {
|
|
717
|
+
if (!activeConfig || !activeState)
|
|
718
|
+
return [];
|
|
719
|
+
if (activeConfig.getDisabledTabs) {
|
|
720
|
+
return activeConfig.getDisabledTabs(activeState);
|
|
721
|
+
}
|
|
722
|
+
return [];
|
|
723
|
+
}, [activeConfig, activeState]);
|
|
724
|
+
// Auto-switch tabs based on config (e.g., switch to 'settings' when a host element is selected).
|
|
725
|
+
// Desktop only: on mobile a tap just selects — the canvas keeps its size, and
|
|
726
|
+
// the selection's area opens from the bottom bar's "Mehr" button instead.
|
|
727
|
+
const mobileSelectionArea = isMobileWeb
|
|
728
|
+
? getMobileSelectionArea(activeSelectedElement, toolbarState?.activeFloatingModule ?? null, visibleTabs.map((tab) => tab.id), activeConfig?.getAutoSwitchTab?.(activeSelectedElement ?? null) ?? null)
|
|
729
|
+
: null;
|
|
730
|
+
useEffect(() => {
|
|
731
|
+
if (!activeConfig?.getAutoSwitchTab || isMobileWeb)
|
|
732
|
+
return;
|
|
733
|
+
const targetTab = activeConfig.getAutoSwitchTab(activeSelectedElement ?? null);
|
|
734
|
+
setActiveTab((current) => {
|
|
735
|
+
const next = autoSwitchTab(current, targetTab, prevTabRef.current);
|
|
736
|
+
prevTabRef.current = next.prev;
|
|
737
|
+
return next.tab;
|
|
738
|
+
});
|
|
739
|
+
}, [activeSelectedElement, activeConfig, setActiveTab, isMobileWeb]);
|
|
740
|
+
// „Effekte“ gilt der Auswahl: hat die neue keine (oder ist keine mehr da),
|
|
741
|
+
// schließt der Bereich, statt nur zu sagen, dass es nichts gibt.
|
|
742
|
+
const selectionHasEffects = hasEffects(toolbarState?.activeFloatingModule ?? null);
|
|
743
|
+
useEffect(() => {
|
|
744
|
+
if (!selectionHasEffects)
|
|
745
|
+
setActiveTab((current) => (current === 'effects' ? null : current));
|
|
746
|
+
}, [selectionHasEffects]);
|
|
747
|
+
const isPanelOpen = activeTab !== null;
|
|
748
|
+
const isMobileSheetOpen = isMobileWeb && isPanelOpen;
|
|
749
|
+
const activeEditorTab = editorTabs.find((def) => def.tab.id === activeTab) ?? null;
|
|
750
|
+
const panelTitle = activeEditorTab
|
|
751
|
+
? activeEditorTab.tab.label
|
|
752
|
+
: activeTab === 'layers'
|
|
753
|
+
? layersTab.label
|
|
754
|
+
: activeTab === 'effects'
|
|
755
|
+
? messages().sidebar.effects.title
|
|
756
|
+
: (activeTab && activeConfig?.tabs.find((tab) => tab.id === activeTab)?.label) ||
|
|
757
|
+
messages().topBar.selection;
|
|
758
|
+
useMobileSheetFit({
|
|
759
|
+
enabled: isMobileSheetOpen,
|
|
760
|
+
zoom,
|
|
761
|
+
pagesContainerRef,
|
|
762
|
+
activePageRef: pageDomRefsRef.current[currentPageIndex],
|
|
763
|
+
});
|
|
764
|
+
// Share all pages via native share (Web Share API with multiple files)
|
|
765
|
+
const shareAllPages = useCallback(async () => {
|
|
766
|
+
const route = fileDelivery.pickShareRoute();
|
|
767
|
+
if (route === null)
|
|
768
|
+
return;
|
|
769
|
+
let dataUrls;
|
|
770
|
+
try {
|
|
771
|
+
dataUrls = await exportAllPages();
|
|
772
|
+
}
|
|
773
|
+
catch (error) {
|
|
774
|
+
console.error('[CanvasEditor] share-all export failed:', error);
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
if (dataUrls.length === 0)
|
|
778
|
+
return;
|
|
779
|
+
if (route === 'native-host') {
|
|
780
|
+
dataUrls.forEach((dataUrl, i) => fileDelivery.shareDataUrlViaNativeHost(dataUrl, `${filenamePrefix}-${messages().export.pageFile}-${i + 1}.png`, {
|
|
781
|
+
title: shareTitle,
|
|
782
|
+
}));
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
const files = await Promise.all(dataUrls.map(async (dataUrl, i) => {
|
|
786
|
+
const blob = await (await fetch(dataUrl)).blob();
|
|
787
|
+
return new File([blob], `${filenamePrefix}-${messages().export.pageFile}-${i + 1}.png`, {
|
|
788
|
+
type: 'image/png',
|
|
789
|
+
});
|
|
790
|
+
}));
|
|
791
|
+
if (navigator.canShare?.({ files })) {
|
|
792
|
+
await navigator.share({ files, title: shareTitle });
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
await navigator.share({ title: shareTitle });
|
|
796
|
+
}
|
|
797
|
+
}, [exportAllPages, fileDelivery, filenamePrefix, shareTitle]);
|
|
798
|
+
// Share props for sidebar (used by share section)
|
|
799
|
+
const shareProps = useMemo(() => ({
|
|
800
|
+
exportedImage: null,
|
|
801
|
+
autoSaveStatus: 'idle',
|
|
802
|
+
shareToken: null,
|
|
803
|
+
onCaptureCanvas: () => { },
|
|
804
|
+
captureCanvasImage: handleCaptureCanvas,
|
|
805
|
+
captureCanvasImageForAi: handleCaptureCanvasForAi,
|
|
806
|
+
rotateElement: (id, deg) => canvasRefsRef.current[currentPageIndex]?.current?.rotateElement?.(id, deg) ?? false,
|
|
807
|
+
collectAltTextPages,
|
|
808
|
+
onDownload: async () => {
|
|
809
|
+
const ref = canvasRefsRef.current[currentPageIndex];
|
|
810
|
+
if (ref?.current) {
|
|
811
|
+
await ensureFontsReady();
|
|
812
|
+
const dataUrl = ref.current.toDataURL({ pixelRatio: 1 });
|
|
813
|
+
if (dataUrl) {
|
|
814
|
+
await fileDelivery.downloadDataUrl(dataUrl, `${filenamePrefix}-slider-${messages().export.pageFile}-${currentPageIndex + 1}.png`);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
onNavigateToGallery: () => { },
|
|
819
|
+
onSaveAsTemplate,
|
|
820
|
+
pageCount,
|
|
821
|
+
onDownloadAllZip: downloadAllAsZip,
|
|
822
|
+
onShareAllPages: shareAllPages,
|
|
823
|
+
isMultiExporting,
|
|
824
|
+
exportProgress,
|
|
825
|
+
exportError: multiExportError,
|
|
826
|
+
exportNotice: multiExportNotice,
|
|
827
|
+
}), [
|
|
828
|
+
pageCount,
|
|
829
|
+
downloadAllAsZip,
|
|
830
|
+
shareAllPages,
|
|
831
|
+
isMultiExporting,
|
|
832
|
+
exportProgress,
|
|
833
|
+
currentPageIndex,
|
|
834
|
+
canvasRefsRef,
|
|
835
|
+
multiExportError,
|
|
836
|
+
multiExportNotice,
|
|
837
|
+
handleCaptureCanvas,
|
|
838
|
+
handleCaptureCanvasForAi,
|
|
839
|
+
collectAltTextPages,
|
|
840
|
+
onSaveAsTemplate,
|
|
841
|
+
fileDelivery,
|
|
842
|
+
filenamePrefix,
|
|
843
|
+
]);
|
|
844
|
+
// After a page switch or a deck replace there is one render before the new
|
|
845
|
+
// page reports its state. The chat would unmount there and lose its running
|
|
846
|
+
// turn (#4273), so it keeps rendering against the last reported page. So does
|
|
847
|
+
// any tab while the new page shares the last one's config: a tile dropped on
|
|
848
|
+
// another page would otherwise lose its panel (open category, its dragend).
|
|
849
|
+
const sectionSource = useMemo(() => activeConfig && activeState && activeActions
|
|
850
|
+
? {
|
|
851
|
+
config: activeConfig,
|
|
852
|
+
state: activeState,
|
|
853
|
+
actions: activeActions,
|
|
854
|
+
selectedElement: activeSelectedElement,
|
|
855
|
+
}
|
|
856
|
+
: null, [activeConfig, activeState, activeActions, activeSelectedElement]);
|
|
857
|
+
const lastSectionSourceRef = useRef(sectionSource);
|
|
858
|
+
if (sectionSource)
|
|
859
|
+
lastSectionSourceRef.current = sectionSource;
|
|
860
|
+
// Render the active section based on configuration
|
|
861
|
+
const renderActiveSection = useCallback(() => {
|
|
862
|
+
if (!activeTab)
|
|
863
|
+
return null;
|
|
864
|
+
if (activeTab === 'effects') {
|
|
865
|
+
return (_jsx(EffectsSection, { module: toolbarState?.activeFloatingModule ?? null, onGradientChange: toolbarHandlers.handleGradientSelect, onOutlineChange: toolbarHandlers.handleOutlineChange, onShadowChange: toolbarHandlers.handleShadowChange }));
|
|
866
|
+
}
|
|
867
|
+
if (activeTab === 'layers') {
|
|
868
|
+
return (_jsx(LayersSection, { layers: toolbarState?.layers ?? [], selectedIds: toolbarState?.selectedLayerIds ?? [], onSelect: handleLayerSelect, onActivate: handleLayerActivate, focusRequested: layersFocusRequested, onFocusHandled: handleLayersFocusHandled }));
|
|
869
|
+
}
|
|
870
|
+
if (activeEditorTab) {
|
|
871
|
+
const EditorTabSection = activeEditorTab.Section;
|
|
872
|
+
return availableEditorTabs.includes(activeEditorTab) && specEdit ? (_jsx(EditorTabSection, { ref: activeEditorTab.takesPageDrops ? pageDropRef : undefined, formatId: formatId ?? DEFAULT_FORMAT_ID, pages: pages, deck: specEdit, onShowPage: showPage, canAddPage: canAddMore })) : null;
|
|
873
|
+
}
|
|
874
|
+
const last = lastSectionSourceRef.current;
|
|
875
|
+
const source = sectionSource ?? (activeTab === 'chat' || last?.config === activeConfig ? last : null);
|
|
876
|
+
if (!source)
|
|
877
|
+
return null;
|
|
878
|
+
const sectionConfig = source.config.sections[activeTab];
|
|
879
|
+
if (!sectionConfig)
|
|
880
|
+
return null;
|
|
881
|
+
const SectionComponent = sectionConfig.component;
|
|
882
|
+
const sectionProps = sectionConfig.propsFactory(source.state, source.actions, {
|
|
883
|
+
selectedElement: source.selectedElement,
|
|
884
|
+
...shareProps,
|
|
885
|
+
...(specEdit && { specEdit }),
|
|
886
|
+
background: source.config.background?.(source.state, source.actions) ?? null,
|
|
887
|
+
chartColors: source.config.chartColors ?? source.config.brand?.chart,
|
|
888
|
+
});
|
|
889
|
+
return (_jsx(Suspense, { fallback: sidebarLoadingFallback, children: _jsx(SectionComponent, { ...sectionProps }) }));
|
|
890
|
+
}, [
|
|
891
|
+
activeTab,
|
|
892
|
+
sectionSource,
|
|
893
|
+
activeConfig,
|
|
894
|
+
shareProps,
|
|
895
|
+
specEdit,
|
|
896
|
+
activeEditorTab,
|
|
897
|
+
availableEditorTabs,
|
|
898
|
+
formatId,
|
|
899
|
+
pages,
|
|
900
|
+
showPage,
|
|
901
|
+
canAddMore,
|
|
902
|
+
toolbarState?.layers,
|
|
903
|
+
toolbarState?.selectedLayerIds,
|
|
904
|
+
toolbarState?.activeFloatingModule,
|
|
905
|
+
toolbarHandlers.handleGradientSelect,
|
|
906
|
+
toolbarHandlers.handleOutlineChange,
|
|
907
|
+
toolbarHandlers.handleShadowChange,
|
|
908
|
+
handleLayerSelect,
|
|
909
|
+
handleLayerActivate,
|
|
910
|
+
layersFocusRequested,
|
|
911
|
+
handleLayersFocusHandled,
|
|
912
|
+
]);
|
|
913
|
+
// Collab vor dem ersten Sync (noch keine Seiten) und der eine Render, in dem
|
|
914
|
+
// die Seiten-Configs nachladen: das Layout bleibt stehen, nur die Fläche
|
|
915
|
+
// zeigt den Platzhalter. Ein Voll-Skeleton hier blendete die Chrome noch
|
|
916
|
+
// einmal aus, nachdem sie schon sichtbar war.
|
|
917
|
+
const noPageRenderable = !pages.some((p) => loadedConfigs.has(p.configId));
|
|
918
|
+
// Multi-page export props - for the share section
|
|
919
|
+
const multiPageExportProps = useMemo(() => ({
|
|
920
|
+
pageCount,
|
|
921
|
+
onDownloadAllZip: downloadAllAsZip,
|
|
922
|
+
isExporting: isMultiExporting,
|
|
923
|
+
exportProgress,
|
|
924
|
+
}), [pageCount, downloadAllAsZip, isMultiExporting, exportProgress]);
|
|
925
|
+
const toolbarOnDelete = useMemo(() => (pageCount > 1 && currentPage ? () => removePage(currentPage.id) : undefined), [pageCount, currentPage, removePage]);
|
|
926
|
+
// Derselbe Bildtext wie im Teilen-Abschnitt der Seitenleiste; Vorlagen ohne
|
|
927
|
+
// ihn fallen auf die Überschrift zurück.
|
|
928
|
+
const canvasText = shareImageText(activeConfig?.sections.share ?? null, activeState) ??
|
|
929
|
+
activeState?.headline ??
|
|
930
|
+
'';
|
|
931
|
+
const canvasConfigId = pages[currentPageIndex]?.configId ?? '';
|
|
932
|
+
const canvasWidth = activeConfig?.canvas.width ?? 1080;
|
|
933
|
+
const canvasHeight = activeConfig?.canvas.height ?? 1080;
|
|
934
|
+
const noop = useCallback(() => { }, []);
|
|
935
|
+
const getPhotoCredit = useCallback(() => creditLines(serializeDeck(pagesDoc).map((page) => page.state)), [pagesDoc]);
|
|
936
|
+
// Als String, damit Notiz-Tippen (neues `pages`) die Leiste nicht neu baut
|
|
937
|
+
const deckLocale = deckLocaleOf(pages);
|
|
938
|
+
const toolbarShareProps = useMemo(() => ({
|
|
939
|
+
getPhotoCredit,
|
|
940
|
+
onCaptureCanvas: handleCaptureCanvas,
|
|
941
|
+
onDownload: handleDownload,
|
|
942
|
+
onNavigateToGallery: noop,
|
|
943
|
+
canvasText,
|
|
944
|
+
canvasType: canvasConfigId,
|
|
945
|
+
canvasWidth,
|
|
946
|
+
canvasHeight,
|
|
947
|
+
shareToken: null,
|
|
948
|
+
pageCount,
|
|
949
|
+
onDownloadAllZip: downloadAllAsZip,
|
|
950
|
+
onShareAllPages: shareAllPages,
|
|
951
|
+
isMultiExporting,
|
|
952
|
+
exportProgress,
|
|
953
|
+
exportError: multiExportError,
|
|
954
|
+
exportNotice: multiExportNotice,
|
|
955
|
+
onInvitePeople,
|
|
956
|
+
onSaveAsTemplate,
|
|
957
|
+
printExport: printFormat
|
|
958
|
+
? {
|
|
959
|
+
onDownloadPdf: handleDownloadPdf,
|
|
960
|
+
getWarnings: getPrintWarnings,
|
|
961
|
+
impressum: impressumGate,
|
|
962
|
+
}
|
|
963
|
+
: null,
|
|
964
|
+
slideDeck: isSlideDeck
|
|
965
|
+
? {
|
|
966
|
+
onDownloadPdf: handleDownloadSlidesPdf,
|
|
967
|
+
onDownloadPptx: handleDownloadPptx,
|
|
968
|
+
locale: deckLocale,
|
|
969
|
+
}
|
|
970
|
+
: null,
|
|
971
|
+
}), [
|
|
972
|
+
getPhotoCredit,
|
|
973
|
+
isSlideDeck,
|
|
974
|
+
handleDownloadSlidesPdf,
|
|
975
|
+
handleDownloadPptx,
|
|
976
|
+
deckLocale,
|
|
977
|
+
printFormat,
|
|
978
|
+
impressumGate,
|
|
979
|
+
handleDownloadPdf,
|
|
980
|
+
getPrintWarnings,
|
|
981
|
+
handleCaptureCanvas,
|
|
982
|
+
handleDownload,
|
|
983
|
+
noop,
|
|
984
|
+
canvasText,
|
|
985
|
+
canvasConfigId,
|
|
986
|
+
canvasWidth,
|
|
987
|
+
canvasHeight,
|
|
988
|
+
pageCount,
|
|
989
|
+
downloadAllAsZip,
|
|
990
|
+
shareAllPages,
|
|
991
|
+
isMultiExporting,
|
|
992
|
+
exportProgress,
|
|
993
|
+
multiExportError,
|
|
994
|
+
multiExportNotice,
|
|
995
|
+
onInvitePeople,
|
|
996
|
+
onSaveAsTemplate,
|
|
997
|
+
]);
|
|
998
|
+
const format = getCanvasFormatOrDefault(formatId);
|
|
999
|
+
const pageAspectRatio = format.width / format.height;
|
|
1000
|
+
// Build sidebar elements (static within the already-async editor chunk)
|
|
1001
|
+
const areaTabBar = (_jsx(Suspense, { fallback: _jsx(CanvasTabRailSkeleton, {}), children: _jsx(SidebarTabBar, { tabs: visibleTabs, activeTab: activeTab, onTabClick: handleTabClick, disabledTabs: disabledTabs }) }));
|
|
1002
|
+
// Render the toolbar whenever there is something to put in it — either the
|
|
1003
|
+
// canvas has reported edit state (toolbarState) or the host has supplied
|
|
1004
|
+
// chrome slots (title, sync indicator, presence). This keeps host chrome
|
|
1005
|
+
// visible during the pre-sync "Synchronisiere..." phase in collab mode,
|
|
1006
|
+
// when toolbarState is still null.
|
|
1007
|
+
const showToolbar = toolbarState !== null || chromeLeft || chromeCenter || chromeRight;
|
|
1008
|
+
const toolbarElement = showToolbar ? (_jsx(Toolbar, { canUndo: canUndo, canRedo: canRedo, handlers: toolbarHandlers, shareProps: toolbarState && showShare ? toolbarShareProps : undefined, chromeLeft: chromeLeft, chromeCenter: chromeCenter, chromeRight: chromeRight, suggestionInBar: isMobileWeb, hostShare: hostChrome
|
|
1009
|
+
? { open: hostChrome.shareOpen, onOpenChange: hostChrome.onShareOpenChange }
|
|
1010
|
+
: undefined })) : null;
|
|
1011
|
+
// Selection-driven formatting controls live outside the menu bar: a floating
|
|
1012
|
+
// card over the canvas (desktop); on mobile a bottom selection bar in the
|
|
1013
|
+
// area tab bar's slot plus a pill on the object, and — once the user opens
|
|
1014
|
+
// the selection's area — an "Auswahl" block at the top of the sheet.
|
|
1015
|
+
// Render only when the canvas has reported an actual element selection (not
|
|
1016
|
+
// merely because delete-page is available on a multi-page doc — page ops live
|
|
1017
|
+
// in the page toolbar / thumbnail strip). While an element is selected, the
|
|
1018
|
+
// delete-page action rides along only in the mobile sheet's "Auswahl" block;
|
|
1019
|
+
// in the desktop card it sat next to the element actions and deleted the
|
|
1020
|
+
// page instead of the element. Only one of the two bars is mounted per
|
|
1021
|
+
// viewport to avoid a hidden duplicate React tree.
|
|
1022
|
+
const backgroundControls = activeConfig?.background && activeState && activeActions
|
|
1023
|
+
? activeConfig.background(activeState, activeActions)
|
|
1024
|
+
: null;
|
|
1025
|
+
const contextControlsProps = toolbarState
|
|
1026
|
+
? {
|
|
1027
|
+
selectedElement: toolbarState.selectedElement ?? null,
|
|
1028
|
+
activeFloatingModule: toolbarState.activeFloatingModule ?? null,
|
|
1029
|
+
canMoveUp: toolbarState.canMoveUp ?? false,
|
|
1030
|
+
canMoveDown: toolbarState.canMoveDown ?? false,
|
|
1031
|
+
canDuplicate: toolbarState.canDuplicate ?? false,
|
|
1032
|
+
isCropping: toolbarState.isCropping ?? false,
|
|
1033
|
+
cropAspect: toolbarState.cropAspect,
|
|
1034
|
+
cropRotation: toolbarState.cropRotation,
|
|
1035
|
+
isExpanding: toolbarState.isExpanding,
|
|
1036
|
+
lockState: toolbarState.lockState,
|
|
1037
|
+
canLock: toolbarState.canLock,
|
|
1038
|
+
canAlign: toolbarState.canAlign,
|
|
1039
|
+
canChangeFontRole: toolbarState.canChangeFontRole,
|
|
1040
|
+
backgroundPickerRequest,
|
|
1041
|
+
handlers: {
|
|
1042
|
+
...toolbarHandlers,
|
|
1043
|
+
onEditImage: () => setActiveTab('image-adjust'),
|
|
1044
|
+
onOpenEffects: () => setActiveTab('effects'),
|
|
1045
|
+
},
|
|
1046
|
+
background: backgroundControls,
|
|
1047
|
+
// Boundary: page actions arrive as Record<string, unknown>.
|
|
1048
|
+
onRemoveUserImage: typeof activeActions?.removeUserImage === 'function'
|
|
1049
|
+
? activeActions.removeUserImage
|
|
1050
|
+
: undefined,
|
|
1051
|
+
onDeselect: handleDeselectAll,
|
|
1052
|
+
}
|
|
1053
|
+
: null;
|
|
1054
|
+
const hasContextControls = contextControlsProps !== null &&
|
|
1055
|
+
(contextControlsProps.selectedElement !== null ||
|
|
1056
|
+
contextControlsProps.activeFloatingModule !== null);
|
|
1057
|
+
// An open suggestion locks the pages (see the container below); the card
|
|
1058
|
+
// takes the selection bar's place so the lock never looks like a dead click.
|
|
1059
|
+
const contextBarElement = isMobileWeb ? null : hasPendingSuggestion ? (_jsx(FloatingAiSuggestionBanner, { variant: "card", onUndo: toolbarHandlers.undo, onUndoPages: toolbarHandlers.undoPages })) : contextControlsProps && hasContextControls ? (_jsx(ContextToolbar, { ...contextControlsProps })) : toolbarState && toolbarState.selectionCount > 1 ? (_jsx(MultiSelectionToolbar, { count: toolbarState.selectionCount, canAlign: toolbarState.canAlign, canDistribute: toolbarState.canDistribute, onCommand: toolbarHandlers.runCommand, canFlip: toolbarState.canFlip, onFlip: toolbarHandlers.handleFlip })) : null;
|
|
1060
|
+
const mobileSelectionElement = contextControlsProps && hasContextControls && isMobileWeb && isPanelOpen ? (_jsx(MobileSelectionControls, { ...contextControlsProps, onDeletePage: toolbarOnDelete })) : null;
|
|
1061
|
+
const openSelectionArea = mobileSelectionArea
|
|
1062
|
+
? () => setActiveTab(mobileSelectionArea)
|
|
1063
|
+
: undefined;
|
|
1064
|
+
const showMobileSelection = contextControlsProps !== null && hasContextControls && isMobileWeb && !isPanelOpen;
|
|
1065
|
+
const tabBar = showMobileSelection ? (_jsx(MobileSelectionBar, { ...contextControlsProps, onOpenArea: openSelectionArea, onDone: handleDeselectAll })) : (areaTabBar);
|
|
1066
|
+
// A multi-selection has no selection bar on phones; the pill and its
|
|
1067
|
+
// action sheet are its only door to the selection's commands.
|
|
1068
|
+
const isMultiSelection = (toolbarState?.selectionCount ?? 0) > 1;
|
|
1069
|
+
// Desktop: what acts on the selection as a whole (lock, duplicate, delete,
|
|
1070
|
+
// the context menu) sits on the object; the bar above only shapes it. The
|
|
1071
|
+
// background plane and photo are not objects — they keep their bar.
|
|
1072
|
+
const showDesktopPill = !isMobileWeb &&
|
|
1073
|
+
!isPreview &&
|
|
1074
|
+
!readOnly &&
|
|
1075
|
+
!hasPendingSuggestion &&
|
|
1076
|
+
(isMultiSelection ||
|
|
1077
|
+
(!!toolbarState?.selectedElement &&
|
|
1078
|
+
hasObjectActions(toolbarState.activeFloatingModule ?? null)));
|
|
1079
|
+
// Im Zuschneide-Modus gelten nur Abbrechen und Fertig; die Pille würde das Restbild verdecken.
|
|
1080
|
+
const selectionPill = toolbarState &&
|
|
1081
|
+
!toolbarState.isCropping &&
|
|
1082
|
+
((showMobileSelection && toolbarState.selectedElement) ||
|
|
1083
|
+
(isMultiSelection && isMobileWeb && !isPanelOpen) ||
|
|
1084
|
+
showDesktopPill) ? (_jsx(SelectionPill, { variant: isMobileWeb ? 'touch' : 'pointer', measureKey: isMultiSelection ? toolbarState : toolbarState.activeFloatingModule, zoom: zoom, getBox: getSelectionBox, subscribeManipulation: subscribeManipulation, canDuplicate: toolbarState.canDuplicate ?? false, canDelete: toolbarState.canDelete ?? false, onDuplicate: toolbarHandlers.handleDuplicate, onDelete: toolbarHandlers.handleDeleteElement, onMore: openContextMenuAt, isLocked: toolbarState.lockState === 'all', onToggleLock: isMobileWeb || toolbarState.canLock ? toolbarHandlers.handleToggleLock : undefined, onFlip: isMultiSelection && isMobileWeb && toolbarState.canFlip
|
|
1085
|
+
? toolbarHandlers.handleFlip
|
|
1086
|
+
: undefined, isMulti: isMultiSelection })) : null;
|
|
1087
|
+
const panel = (_jsx(Suspense, { fallback: sidebarLoadingFallback, children: _jsxs(SidebarPanel, { isOpen: isPanelOpen, title: panelTitle, onClose: handlePanelClose, children: [mobileSelectionElement, renderActiveSection()] }) }));
|
|
1088
|
+
// Die untere Leiste trägt zwei Dinge, und nur eines davon hängt an der
|
|
1089
|
+
// Seitenzahl: der Miniaturen-Streifen ist erst im Deck sinnvoll, die
|
|
1090
|
+
// Meta-Leiste daneben (Zoom-Regler, Vollbild, Seitenanzeige) gilt immer.
|
|
1091
|
+
// Bis hierher hing beides an derselben Bedingung — bei einer einzelnen Seite
|
|
1092
|
+
// fiel damit auch der Zoom weg und war nur noch per Pinch bzw. Strg/Cmd+Rad
|
|
1093
|
+
// erreichbar.
|
|
1094
|
+
const showPageStrip = pages.length > 1;
|
|
1095
|
+
// Ein Viewer blättert, fügt aber nichts an: ohne Knöpfe bleibt der Streifen Navigation.
|
|
1096
|
+
const canAddPages = canAddMore && !readOnly;
|
|
1097
|
+
const currentTemplateId = pages[currentPageIndex]?.configId;
|
|
1098
|
+
const PagePicker = pagePicker?.Picker;
|
|
1099
|
+
const renderAddPicker = useMemo(() => PagePicker
|
|
1100
|
+
? (open) => (_jsx(PagePicker, { ...open, mode: "add", currentTemplateId: currentTemplateId, activeTemplateId: currentTemplateId, pages: pages, formatId: formatId, onSelectTemplate: handleAddPage, addPage: addPage, onDuplicateCurrent: duplicateCurrentPage }))
|
|
1101
|
+
: null, [PagePicker, currentTemplateId, pages, formatId, handleAddPage, addPage, duplicateCurrentPage]);
|
|
1102
|
+
const handleAddPageLikeCurrent = useCallback(() => {
|
|
1103
|
+
if (currentTemplateId)
|
|
1104
|
+
void handleAddPage(currentTemplateId);
|
|
1105
|
+
}, [currentTemplateId, handleAddPage]);
|
|
1106
|
+
// Die Leiste selbst ist durchsichtig und rahmenlos — sie liegt über der
|
|
1107
|
+
// Fläche, statt eine eigene Kante zu bilden, und fängt außerhalb ihrer
|
|
1108
|
+
// Kapseln keine Klicks ab. Lesbar bleiben die Bedienteile durch je eine
|
|
1109
|
+
// eigene, leicht durchscheinende Kapsel.
|
|
1110
|
+
const bottomBarGroup = 'flex items-center rounded-xl border border-[var(--editor-border)] bg-[var(--editor-surface)]/80 shadow-sm backdrop-blur-sm pointer-events-auto';
|
|
1111
|
+
const pageStrip = showPageStrip ? (_jsx(PageThumbnailStrip, { pages: pages, currentPageIndex: currentPageIndex, thumbnails: pageThumbnails, loadedConfigs: loadedConfigs, currentTemplateId: currentTemplateId, canAddMore: canAddPages, onSelect: handleThumbnailSelect, onAddPage: handleAddPage, quickAddOpensPicker: pagePicker?.quickAddOpensPicker?.(pages) ?? false, renderPicker: renderAddPicker })) : null;
|
|
1112
|
+
const bottomBar = (_jsxs("div", { className: "canvas-bottom-bar pointer-events-none flex items-center gap-2 px-2 pb-2", children: [pageStrip ? (_jsx("div", { className: "min-w-0 flex-1", children: _jsx("div", { className: cn('w-fit max-w-full', bottomBarGroup), children: pageStrip }) })) : (_jsx("div", { className: "min-w-0 flex-1", children: canAddPages && (_jsx("div", { className: cn('w-fit px-1.5 py-1', bottomBarGroup), children: _jsx(AddPageButton, { onAddPage: handleAddPageLikeCurrent, renderPicker: renderAddPicker, disabled: !renderAddPicker && !currentTemplateId, compact: true }) })) })), _jsx("div", { className: cn('shrink-0', bottomBarGroup), children: _jsx(CanvasMetaBar, { pageCount: pageCount, currentPageIndex: currentPageIndex, zoom: zoom, onZoomChange: setZoom }) })] }));
|
|
1113
|
+
return (_jsx(DocumentBrandContext.Provider, { value: activeConfig?.brand ?? null, children: _jsxs(AnnouncerContext.Provider, { value: announcer, children: [_jsx(CanvasAnnouncer, { message: liveMessage }), _jsx(ShellProvider, { pages: pages, currentPageIndex: currentPageIndex, formatId: formatId, canvasRefsRef: canvasRefsRef, configTabIds: configTabIds, children: _jsx(UserUploadsProvider, { children: _jsxs(CanvasTextEditorProvider, { children: [!isPreview && !readOnly && !hasPendingSuggestion && (_jsx("button", { type: "button", onClick: handleSkipToLayers, className: "sr-only focus:not-sr-only focus:fixed focus:left-2 focus:top-2 focus:z-[400] focus:flex focus:min-h-8 focus:items-center focus:rounded-md focus:border focus:border-[var(--editor-border-strong)] focus:bg-[var(--editor-surface)] focus:px-3 focus:text-[length:var(--font-size-small)] focus:font-semibold focus:text-[var(--editor-text)] focus:shadow-md outline-none kbd:focus-visible:outline-2 kbd:focus-visible:outline-solid kbd:focus-visible:outline-offset-2 kbd:focus-visible:outline-[var(--editor-accent)]", children: t.shell.skipToLayers })), _jsxs(CanvasEditorLayout
|
|
1114
|
+
// Vorschau vor dem Sync: zeigen, aber nichts anbieten, was schreibt —
|
|
1115
|
+
// die Seiten hängen noch an keinem Y.Map, jede Änderung ginge verloren.
|
|
1116
|
+
// Ein Viewer ebenso: der Server verwirft seine Schreibzugriffe.
|
|
1117
|
+
, {
|
|
1118
|
+
// Vorschau vor dem Sync: zeigen, aber nichts anbieten, was schreibt —
|
|
1119
|
+
// die Seiten hängen noch an keinem Y.Map, jede Änderung ginge verloren.
|
|
1120
|
+
// Ein Viewer ebenso: der Server verwirft seine Schreibzugriffe.
|
|
1121
|
+
sidebar: isPreview || readOnly ? null : hasPendingSuggestion ? (_jsx("div", { inert: true, className: "contents", children: panel })) : (panel), tabBar: isPreview || readOnly ? null : tabBar, actions: null, toolbar: toolbarElement, contextBar: isPreview || readOnly ? null : contextBarElement,
|
|
1122
|
+
// Die Desktop-Leiste ist auf dem Handy per CSS ausgeblendet; gar
|
|
1123
|
+
// nicht erst mitgeben, sonst hinge der Streifen zweimal im Baum.
|
|
1124
|
+
bottomBar: isMobileWeb || isPreview ? null : bottomBar,
|
|
1125
|
+
// Auf dem Handy scrollt ein Finger auf dem Sharepic nicht (wie in
|
|
1126
|
+
// Canva) — die Seiten wechselt dort dieser Streifen.
|
|
1127
|
+
mobilePageStrip: isMobileWeb && !isMobileSheetOpen && !isPreview ? pageStrip : null, mobileZoomControl: isMobileWeb && !isMobileSheetOpen && !isPreview ? (_jsx(CanvasZoomIndicator, { zoom: zoom, onZoomChange: setZoom })) : null, mobileSheetOpen: isMobileSheetOpen, onCanvasBackdropPointerDown: isMobileSheetOpen ? handlePanelClose : undefined, children: [schemaRefusal && (_jsx("p", { role: "alert", className: "mx-auto mt-sm max-w-prose rounded-md border border-[var(--editor-border-strong)] bg-[var(--editor-surface)] px-3 py-2 text-[length:var(--font-size-small)] text-[var(--editor-text)]", children: t.shell.schemaRefusal[schemaRefusal.status] })), _jsxs("div", { inert: isPreview || hasPendingSuggestion, "aria-busy": isPreview && !schemaRefusal, ref: pagesContainerCallbackRef, onPointerDown: handleWorkAreaPointerDown, className: cn('heterogeneous-multipage__pages-container has-bottom-bar flex flex-col items-center gap-md p-sm pb-lg w-full max-canvas-mobile:gap-sm max-canvas-mobile:p-xs', hasPendingSuggestion && 'opacity-60 transition-opacity duration-200'), children: [pages.map((page, index) => {
|
|
1128
|
+
const config = loadedConfigs.get(page.configId);
|
|
1129
|
+
if (!config)
|
|
1130
|
+
return null;
|
|
1131
|
+
const isActive = index === currentPageIndex;
|
|
1132
|
+
const canDelete = pageCount > 1;
|
|
1133
|
+
return (_jsx(PageWrapper
|
|
1134
|
+
// A replaced state (convert, undo) mounts the page afresh on the new state.
|
|
1135
|
+
, { page: page, index: index, pageCount: pageCount, config: config, formatId: formatId, isActive: isActive, canDelete: canDelete, canvasRef: canvasRefsRef.current[index], pageRef: pageDomRefsRef.current[index], onSelect: handlePageSelect, onDelete: removePage, onMovePage: movePage, onDuplicatePage: duplicatePage, onChangeTemplate: PagePicker ? handleOpenTemplateChange : undefined, onDropVorlage: takesPageDrops && !readOnly ? handleDropVorlage : undefined, onExport: handleExport, onCancel: onCancel, callbacks: getCallbacksForPage(page.id, page.configId), multiPageExport: index === 0 ? multiPageExportProps : undefined, onStateChange: handlePageStateChange, onObservedState: printService && needsImpressum(printFormat)
|
|
1136
|
+
? handleObservedState
|
|
1137
|
+
: undefined, onToolbarStateChange: isActive && !isPreview ? handleToolbarStateChange : undefined, onAutoSaveShareToken: onAutoSaveShareToken, autoSave: false, pageBinding: pageBindingAt(index, page.id, isActive), readOnly: readOnly }, `${page.id}:${page.stateEpoch ?? 0}`));
|
|
1138
|
+
}), noPageRenderable && _jsx(CanvasPageSkeleton, { aspectRatio: pageAspectRatio }), templateChangePage && PagePicker && (_jsx(PagePicker, { isOpen: true, mode: "replace", anchorRef: pageDomRefsRef.current[templateChangePage.index], onSelectTemplate: handleSelectTemplateChange, onClose: handleCloseTemplateChange, currentTemplateId: templateChangePage.configId, currentState: templateChangePage.state, activeTemplateId: currentTemplateId, pages: pages, formatId: formatId })), isSlideFormat(format) && !isPreview && pages[currentPageIndex] && (_jsx(SlideNotesPanel, { value: typeof pages[currentPageIndex].state.notes === 'string'
|
|
1139
|
+
? pages[currentPageIndex].state.notes
|
|
1140
|
+
: '', onChange: (notes) => updatePageState(pages[currentPageIndex].id, { notes }), readOnly: readOnly })), canAddPages && !showPageStrip && (_jsx("div", { className: "w-full max-w-[28rem] pt-sm max-canvas-mobile:pt-xs max-canvas-mobile:px-xs max-canvas-mobile:origin-top max-canvas-mobile:[scale:calc(1/var(--canvas-total-scale,1))] canvas-mobile:hidden", children: _jsx(AddPageButton, { onAddPage: handleAddPageLikeCurrent, renderPicker: renderAddPicker, disabled: !canAddMore || (!renderAddPicker && !currentTemplateId) }) }))] })] }), selectionPill, !isPreview &&
|
|
1141
|
+
!readOnly &&
|
|
1142
|
+
(isMobileWeb ? (_jsx(CanvasActionSheet, { handleRef: contextMenuRef })) : (_jsx(CanvasContextMenu, { handleRef: contextMenuRef, closeKey: zoom })))] }) }) })] }) }));
|
|
1143
|
+
}
|
|
1144
|
+
export default CanvasEditorShell;
|