@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,527 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Der Bearbeiten-Overlay für Leinwand-Text — EINE Erscheinung für beide
|
|
5
|
+
* Renderer, und zwar auf der DOM-Seite der Bühne.
|
|
6
|
+
*
|
|
7
|
+
* ## Warum nicht einfach ein Portal aus dem Knoten heraus
|
|
8
|
+
*
|
|
9
|
+
* Genau das war der Fehler, der die Werkzeugleiste unsichtbar machte.
|
|
10
|
+
* `react-konva` bringt einen EIGENEN Reconciler mit; ein `createPortal` aus
|
|
11
|
+
* einem Knoten heraus wird von IHM abgearbeitet, nicht von `react-dom`. Das
|
|
12
|
+
* Ziel `document.body` ändert daran nichts: `<div>` und `<button>` werden zu
|
|
13
|
+
* Konva-Knoten aufgelöst, Konva meldet „Konva has no node with the type div.
|
|
14
|
+
* Group will be used instead", und tiptap bekommt in `EditorContent` eine
|
|
15
|
+
* Konva-Gruppe statt eines Elements gereicht (`element.append is not a
|
|
16
|
+
* function`). Im DOM landete nie etwas — auf KEINER Vorlage, auch nicht auf
|
|
17
|
+
* den dreien, die schon `richText` trugen.
|
|
18
|
+
*
|
|
19
|
+
* Der alte `<textarea>`-Zweig funktionierte nur, weil er an React vorbeiging:
|
|
20
|
+
* `document.createElement` + `appendChild`, rein imperativ.
|
|
21
|
+
*
|
|
22
|
+
* Deshalb liegt der Editor hier außerhalb der Bühne. Die Knoten melden
|
|
23
|
+
* lediglich „bearbeite mich, hier ist meine Box"; gezeichnet wird der Editor
|
|
24
|
+
* von `CanvasStage` als Geschwister des `<Stage>`, wo `react-dom` zuständig
|
|
25
|
+
* ist.
|
|
26
|
+
*
|
|
27
|
+
* ## Ein Editor, nicht zwei
|
|
28
|
+
*
|
|
29
|
+
* Vorher hatte jeder Renderer seinen eigenen: `CanvasRichText` das
|
|
30
|
+
* tiptap-Portal, `CanvasText` die handgebaute Textarea. Weil `CanvasText`
|
|
31
|
+
* alles zeichnet, was noch keinen Marker trägt, sah ein frisches Feld die
|
|
32
|
+
* Werkzeugleiste nie — und ohne Werkzeugleiste entsteht auch kein erster
|
|
33
|
+
* Marker. Die Aufteilung der Renderer bleibt (ein Konva-Knoten für glatten
|
|
34
|
+
* Text, eine Gruppe aus Läufen für ausgezeichneten); der Editor ist derselbe.
|
|
35
|
+
*
|
|
36
|
+
* ## Wer die Knöpfe zeigt
|
|
37
|
+
*
|
|
38
|
+
* Fett/Kursiv/… gehören zum Text, nicht zum Overlay. Im Editor zeigt sie die
|
|
39
|
+
* Kontextleiste der Kopfleiste, neben Farbe, Schriftgröße und Ausrichtung
|
|
40
|
+
* desselben Elements. Wo es keine Kopfleiste gibt, bleibt die schwebende
|
|
41
|
+
* Karte über dem Text der einzige mögliche Ort.
|
|
42
|
+
*
|
|
43
|
+
* Wer von beiden, sagt nicht der Aufrufer, sondern der Wirt selbst: wer
|
|
44
|
+
* `useCanvasTextFormatting` aufruft, MELDET SICH damit an, und die Karte
|
|
45
|
+
* erscheint nur, solange niemand angemeldet ist. Ein Schalter am Provider
|
|
46
|
+
* („über mir liegt eine Kopfleiste") wäre ein Versprechen, das der Aufrufer
|
|
47
|
+
* brechen kann, ohne dass es auffällt — und genau das täte
|
|
48
|
+
* `CanvasEditorInner`, sobald es die Kontextleiste gar nicht erst rendert:
|
|
49
|
+
* der Text hätte dann überhaupt keine Schnitt-Knöpfe mehr, weder Leiste noch
|
|
50
|
+
* Karte.
|
|
51
|
+
*
|
|
52
|
+
* Damit der Wirt den Editor erreicht, steht dieser Provider dort, wo auch die
|
|
53
|
+
* Kopfleiste steht: an der Wurzel des Editors. Der Provider in `CanvasStage`
|
|
54
|
+
* bleibt trotzdem stehen — er ist NESTFEST: findet er einen über sich, reicht
|
|
55
|
+
* er seine Kinder unverändert durch. So bedient eine Bühne im Editor die
|
|
56
|
+
* Kopfleiste, eine Bühne ohne Editor weiterhin sich selbst, und keine der
|
|
57
|
+
* beiden weiß etwas von der anderen.
|
|
58
|
+
*
|
|
59
|
+
* Genau eine Sitzung ist zu jeder Zeit offen — dieselbe Reichweite, die
|
|
60
|
+
* `selectedElement` längst hat. Vorher lag sie je Seite, eine Stufe zu eng.
|
|
61
|
+
*
|
|
62
|
+
* Der Entwurf lebt im Overlay und wird erst beim Abschließen nach oben
|
|
63
|
+
* gegeben. Das ist nicht nur Sparsamkeit: schriebe jeder Tastendruck in den
|
|
64
|
+
* Zustand, wechselte das Feld beim ersten Marker mitten im Tippen den
|
|
65
|
+
* Renderer, und der Editor würde unter der Hand abgeräumt.
|
|
66
|
+
*/
|
|
67
|
+
import { PLAIN_STYLE, splitListItems, stripInlineMarks } from '@ggraphic/schema';
|
|
68
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
69
|
+
import { createPortal, flushSync } from 'react-dom';
|
|
70
|
+
import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
|
|
71
|
+
import { messages } from '@ggraphic/editor/i18n/messages';
|
|
72
|
+
import { captureFocusOrigin, returnFocus, } from '@ggraphic/editor/utils/editorFocus';
|
|
73
|
+
import { normalizeRotation } from '@ggraphic/editor/utils/orientation';
|
|
74
|
+
import { stageCssScale } from '@ggraphic/editor/utils/stageCssScale';
|
|
75
|
+
import { resolveFontFamily } from '../utils/fontAliases.js';
|
|
76
|
+
import { fontMarkSupport } from '../utils/fontMarkSupport.js';
|
|
77
|
+
import { defaultTextMarker } from '../utils/markerColors.js';
|
|
78
|
+
import { fontStyleForRun, measureTextWidthWithFont, } from '../utils/textUtils.js';
|
|
79
|
+
/** Ohne offene Sitzung trägt niemand einen Schnitt. */
|
|
80
|
+
const NO_MARKS = { bold: false, italic: false, accent: false, marker: false };
|
|
81
|
+
/**
|
|
82
|
+
* Untergrenze für die gespiegelte Deckkraft. Der Regler der Kopfleiste geht
|
|
83
|
+
* bis 0; ein Feld, das dort steht, wäre als Editor nicht mehr zu sehen.
|
|
84
|
+
*/
|
|
85
|
+
const LOWEST_LEGIBLE_OPACITY = 0.2;
|
|
86
|
+
const TextEditorContext = createContext(null);
|
|
87
|
+
let richTextModules = null;
|
|
88
|
+
let richTextLoading = null;
|
|
89
|
+
/**
|
|
90
|
+
* tiptap samt ProseMirror (~360 KB) gehört nicht in den ersten Ladevorgang
|
|
91
|
+
* der Leinwand — gebraucht wird es erst beim Bearbeiten. Geladen wird es,
|
|
92
|
+
* sobald ein bearbeitbarer Text auf der Bühne steht: der Editor muss im
|
|
93
|
+
* Normalfall schon bereitliegen, wenn der Doppeltipp kommt. Erscheint er erst
|
|
94
|
+
* danach, liegt sein Fokus außerhalb der Geste, und iOS zeigt keine Tastatur.
|
|
95
|
+
*/
|
|
96
|
+
export function preloadRichText() {
|
|
97
|
+
richTextLoading ??= Promise.all([
|
|
98
|
+
import('./RichTextField.js'),
|
|
99
|
+
import('./TextFormatControls.js'),
|
|
100
|
+
]).then(([field, controls]) => (richTextModules = {
|
|
101
|
+
RichTextField: field.RichTextField,
|
|
102
|
+
TextFormatControls: controls.TextFormatControls,
|
|
103
|
+
}), (error) => {
|
|
104
|
+
// Ein fehlgeschlagener Chunk-Abruf soll beim nächsten Öffnen erneut versucht werden.
|
|
105
|
+
richTextLoading = null;
|
|
106
|
+
throw error;
|
|
107
|
+
});
|
|
108
|
+
return richTextLoading;
|
|
109
|
+
}
|
|
110
|
+
/** Lädt bei Bedarf; schlägt es zweimal fehl, meldet `onFailed` das und die Sitzung schließt. */
|
|
111
|
+
function useRichTextModules(needed, onFailed) {
|
|
112
|
+
const [, setLoaded] = useState(false);
|
|
113
|
+
const failedRef = useRef(onFailed);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
failedRef.current = onFailed;
|
|
116
|
+
});
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!needed || richTextModules)
|
|
119
|
+
return;
|
|
120
|
+
let live = true;
|
|
121
|
+
preloadRichText()
|
|
122
|
+
.catch((error) => {
|
|
123
|
+
console.warn('[CanvasTextOverlay] Texteditor nicht geladen, neuer Versuch', error);
|
|
124
|
+
return preloadRichText();
|
|
125
|
+
})
|
|
126
|
+
.then(() => live && setLoaded(true), (error) => {
|
|
127
|
+
console.error('[CanvasTextOverlay] Texteditor konnte nicht geladen werden', error);
|
|
128
|
+
if (live)
|
|
129
|
+
failedRef.current();
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
live = false;
|
|
133
|
+
};
|
|
134
|
+
}, [needed]);
|
|
135
|
+
return richTextModules;
|
|
136
|
+
}
|
|
137
|
+
const NOTICE_MS = 6000;
|
|
138
|
+
/**
|
|
139
|
+
* Geometrie eines Knotens in Fensterkoordinaten — dieselbe Rechnung, die
|
|
140
|
+
* beide Renderer vorher je für sich anstellten.
|
|
141
|
+
*/
|
|
142
|
+
export function overlayBoxForNode(node, width, height) {
|
|
143
|
+
const stage = node.getStage();
|
|
144
|
+
if (!stage)
|
|
145
|
+
return null;
|
|
146
|
+
const stageBox = stage.container().getBoundingClientRect();
|
|
147
|
+
const position = node.getAbsolutePosition();
|
|
148
|
+
// Der Maßstab des KNOTENS, nicht der der Bühne. Bei einem Format, dessen
|
|
149
|
+
// Entwurfsmaße von den Ausgabemaßen abweichen (Story, Präsentation, Flyer,
|
|
150
|
+
// Plakat), legt `CanvasStage` eine zusätzlich skalierte Gruppe um den
|
|
151
|
+
// Entwurf. `stage.scaleX()` kennt die nicht — der Editor stünde dort zwar
|
|
152
|
+
// an der richtigen Stelle, aber in der falschen Größe.
|
|
153
|
+
const cssScale = stageCssScale(stage, stageBox);
|
|
154
|
+
const scale = node.getAbsoluteScale().x * cssScale;
|
|
155
|
+
return {
|
|
156
|
+
top: stageBox.top + window.scrollY + position.y * cssScale,
|
|
157
|
+
left: stageBox.left + window.scrollX + position.x * cssScale,
|
|
158
|
+
width: width * scale,
|
|
159
|
+
minHeight: height * scale,
|
|
160
|
+
scale,
|
|
161
|
+
rotation: normalizeRotation(node.getAbsoluteRotation()),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** iOS zoomt in Eingabefelder unter 16px; kleinere Schrift wird deshalb hochskaliert gerendert und per `transform` zurückgenommen. */
|
|
165
|
+
const MIN_EDITOR_FONT_PX = 16;
|
|
166
|
+
function sameBox(a, b) {
|
|
167
|
+
return (a.top === b.top &&
|
|
168
|
+
a.left === b.left &&
|
|
169
|
+
a.width === b.width &&
|
|
170
|
+
a.minHeight === b.minHeight &&
|
|
171
|
+
a.scale === b.scale &&
|
|
172
|
+
a.rotation === b.rotation);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Die Box des bearbeiteten Knotens, nachgeführt, solange die Sitzung offen
|
|
176
|
+
* ist. Das Overlay hängt an `document.body`, die Leinwand aber nicht: auf
|
|
177
|
+
* Mobilgeräten scrollt sie in `.canvas-editor-layout__main`, und Zoom sowie
|
|
178
|
+
* das Mobile-Sheet verschieben und skalieren den Seiten-Container per CSS
|
|
179
|
+
* (`--canvas-zoom`, `--canvas-sheet-shift`, `--canvas-sheet-scale`). Ohne
|
|
180
|
+
* Nachführen bliebe der Editor stehen, während der Text darunter wegfährt.
|
|
181
|
+
*
|
|
182
|
+
* Höchstens einmal je Frame vermessen; während der Container seine
|
|
183
|
+
* `transform`-Transition abspielt, in jedem Frame.
|
|
184
|
+
*/
|
|
185
|
+
function useAnchoredOverlayBox(session) {
|
|
186
|
+
// An den Anker gebunden: öffnet ein anderes Feld, gilt sofort dessen
|
|
187
|
+
// `box`, nicht für einen Durchlauf noch die nachgeführte des vorigen.
|
|
188
|
+
const [followed, setFollowed] = useState(null);
|
|
189
|
+
const anchor = session?.anchor;
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
if (!anchor)
|
|
192
|
+
return;
|
|
193
|
+
const current = anchor;
|
|
194
|
+
const pages = current.node
|
|
195
|
+
.getStage()
|
|
196
|
+
?.container()
|
|
197
|
+
.closest('.heterogeneous-multipage__pages-container');
|
|
198
|
+
let frame = 0;
|
|
199
|
+
let transitioning = false;
|
|
200
|
+
function schedule() {
|
|
201
|
+
if (!frame)
|
|
202
|
+
frame = requestAnimationFrame(measure);
|
|
203
|
+
}
|
|
204
|
+
function measure() {
|
|
205
|
+
frame = 0;
|
|
206
|
+
const next = overlayBoxForNode(current.node, current.width, current.height);
|
|
207
|
+
if (next) {
|
|
208
|
+
setFollowed((prev) => prev?.anchor === current && sameBox(prev.box, next)
|
|
209
|
+
? prev
|
|
210
|
+
: { anchor: current, box: next });
|
|
211
|
+
}
|
|
212
|
+
if (transitioning)
|
|
213
|
+
schedule();
|
|
214
|
+
}
|
|
215
|
+
const onTransitionRun = (event) => {
|
|
216
|
+
if (event.target !== pages || event.propertyName !== 'transform')
|
|
217
|
+
return;
|
|
218
|
+
transitioning = true;
|
|
219
|
+
schedule();
|
|
220
|
+
};
|
|
221
|
+
const onTransitionStop = (event) => {
|
|
222
|
+
if (event.target !== pages || event.propertyName !== 'transform')
|
|
223
|
+
return;
|
|
224
|
+
transitioning = false;
|
|
225
|
+
schedule();
|
|
226
|
+
};
|
|
227
|
+
// Capture-Phase: `scroll` blubbert nicht, so kommt das Scrollen jedes
|
|
228
|
+
// Vorfahren an, nicht nur das des Fensters.
|
|
229
|
+
window.addEventListener('scroll', schedule, { capture: true, passive: true });
|
|
230
|
+
window.addEventListener('resize', schedule);
|
|
231
|
+
window.visualViewport?.addEventListener('resize', schedule);
|
|
232
|
+
window.visualViewport?.addEventListener('scroll', schedule);
|
|
233
|
+
const observer = new MutationObserver(schedule);
|
|
234
|
+
if (pages) {
|
|
235
|
+
observer.observe(pages, { attributes: true, attributeFilter: ['style', 'data-zooming'] });
|
|
236
|
+
pages.addEventListener('transitionrun', onTransitionRun);
|
|
237
|
+
pages.addEventListener('transitionend', onTransitionStop);
|
|
238
|
+
pages.addEventListener('transitioncancel', onTransitionStop);
|
|
239
|
+
}
|
|
240
|
+
return () => {
|
|
241
|
+
cancelAnimationFrame(frame);
|
|
242
|
+
window.removeEventListener('scroll', schedule, { capture: true });
|
|
243
|
+
window.removeEventListener('resize', schedule);
|
|
244
|
+
window.visualViewport?.removeEventListener('resize', schedule);
|
|
245
|
+
window.visualViewport?.removeEventListener('scroll', schedule);
|
|
246
|
+
observer.disconnect();
|
|
247
|
+
pages?.removeEventListener('transitionrun', onTransitionRun);
|
|
248
|
+
pages?.removeEventListener('transitionend', onTransitionStop);
|
|
249
|
+
pages?.removeEventListener('transitioncancel', onTransitionStop);
|
|
250
|
+
};
|
|
251
|
+
}, [anchor]);
|
|
252
|
+
if (!session)
|
|
253
|
+
return null;
|
|
254
|
+
return followed && followed.anchor === anchor ? followed.box : session.box;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Ruft ein Knoten auf, um den Editor zu öffnen. Ohne Provider passiert
|
|
258
|
+
* nichts — eine Bühne ohne Editor-Schicht ist eine reine Anzeige (die
|
|
259
|
+
* Vorschaubilder etwa), kein Fehler.
|
|
260
|
+
*/
|
|
261
|
+
export function useCanvasTextEditor(id, editable = false) {
|
|
262
|
+
const context = useContext(TextEditorContext);
|
|
263
|
+
const hasEditor = context !== null;
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
if (!hasEditor || !editable)
|
|
266
|
+
return;
|
|
267
|
+
// Scheitert es hier, versucht es das Öffnen noch einmal und meldet sich dann.
|
|
268
|
+
preloadRichText().catch(() => { });
|
|
269
|
+
}, [hasEditor, editable]);
|
|
270
|
+
return {
|
|
271
|
+
open: context?.open ?? (() => { }),
|
|
272
|
+
// Ohne Id gibt es kein „dieses Feld" — zwei namenlose Knoten hielten
|
|
273
|
+
// sich sonst gegenseitig für den, der gerade bearbeitet wird.
|
|
274
|
+
isEditing: id !== undefined && id !== '' && context?.editingId === id,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Für den Wirt der Formatierungsknöpfe (die Kontextleiste). Der Aufruf IST
|
|
279
|
+
* die Anmeldung: solange dieser Hook irgendwo im Baum hängt, lässt das
|
|
280
|
+
* Overlay seine eigene Karte weg — zwei Leisten für dieselbe Handlung wären
|
|
281
|
+
* eine zu viel, keine wäre eine zu wenig.
|
|
282
|
+
*
|
|
283
|
+
* Angemeldet wird unabhängig davon, ob gerade etwas bearbeitet wird. Sonst
|
|
284
|
+
* fiele die Anmeldung mit dem Öffnen der Sitzung zusammen und die Karte
|
|
285
|
+
* blitzte für einen Durchlauf auf. Die Kontextleiste steht ohnehin schon,
|
|
286
|
+
* wenn ein Element ausgewählt ist — und ausgewählt ist es, bevor der
|
|
287
|
+
* Doppelklick den Editor öffnet.
|
|
288
|
+
*
|
|
289
|
+
* Liefert `null`, solange nichts bearbeitet wird — und solange der Editor
|
|
290
|
+
* noch nachgeladen wird. Die Knöpfe kommen deshalb mit: `TextFormatControls`
|
|
291
|
+
* gehört zum nachgeladenen Teil und ist nur zusammen mit `editor` da.
|
|
292
|
+
*/
|
|
293
|
+
export function useCanvasTextFormatting() {
|
|
294
|
+
const context = useContext(TextEditorContext);
|
|
295
|
+
const claimHost = context?.claimHost;
|
|
296
|
+
useEffect(() => claimHost?.(), [claimHost]);
|
|
297
|
+
if (!context || !context.editor || !context.editingId || !context.formatControls)
|
|
298
|
+
return null;
|
|
299
|
+
return {
|
|
300
|
+
editor: context.editor,
|
|
301
|
+
marks: context.marks,
|
|
302
|
+
editingId: context.editingId,
|
|
303
|
+
TextFormatControls: context.formatControls,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Wird gerade ein Text bearbeitet? Meldet sich — anders als
|
|
308
|
+
* `useCanvasTextFormatting` — NICHT als Wirt an, die Karte bleibt also, wo sie ist.
|
|
309
|
+
*/
|
|
310
|
+
export function useIsCanvasTextEditing() {
|
|
311
|
+
return useContext(TextEditorContext)?.editingId != null;
|
|
312
|
+
}
|
|
313
|
+
/** Offene Sitzungen, damit ein Host den Entwurf übernehmen kann, bevor er die Seite abräumt. */
|
|
314
|
+
const openCommits = new Set();
|
|
315
|
+
/**
|
|
316
|
+
* Übernimmt einen offenen Textentwurf sofort — für Hosts, die gleich
|
|
317
|
+
* schließen (eingebettet: `CLOSE` an die App, #4397). Dort kommt kein Blur
|
|
318
|
+
* mehr: ein Tipp auf einen Knopf nimmt dem Text auf iOS den Fokus nicht.
|
|
319
|
+
*
|
|
320
|
+
* `flushSync`, weil freie Elemente erst aus einem Effekt im Dokument landen
|
|
321
|
+
* (`useEmitHostStateChanges`); bei einem synchronen Render laufen die Effekte
|
|
322
|
+
* noch vor der Rückkehr, das Update liegt danach also schon beim Provider.
|
|
323
|
+
* Deshalb nur aus Event-Handlern aufrufen, nicht aus Render oder Effekten.
|
|
324
|
+
*/
|
|
325
|
+
export function commitOpenTextEdit() {
|
|
326
|
+
if (openCommits.size === 0)
|
|
327
|
+
return;
|
|
328
|
+
flushSync(() => {
|
|
329
|
+
for (const commit of [...openCommits])
|
|
330
|
+
commit();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Nestfest: liegt schon ein Provider darüber, reicht dieser seine Kinder
|
|
335
|
+
* unverändert durch. Die Prüfung MUSS hier stehen und nicht im Rumpf von
|
|
336
|
+
* `TextEditorRoot` — ein vorzeitiges `return` nach den Zustands-Hooks wäre
|
|
337
|
+
* ein bedingter Hook-Aufruf.
|
|
338
|
+
*/
|
|
339
|
+
export function CanvasTextEditorProvider({ children }) {
|
|
340
|
+
const existing = useContext(TextEditorContext);
|
|
341
|
+
if (existing)
|
|
342
|
+
return _jsx(_Fragment, { children: children });
|
|
343
|
+
return _jsx(TextEditorRoot, { children: children });
|
|
344
|
+
}
|
|
345
|
+
function TextEditorRoot({ children }) {
|
|
346
|
+
const brand = useDocumentBrand();
|
|
347
|
+
const [session, setSession] = useState(null);
|
|
348
|
+
const [editor, setEditor] = useState(null);
|
|
349
|
+
const [draft, setDraft] = useState('');
|
|
350
|
+
// Gezählt, nicht als Schalter: beim Wechsel zwischen Kontextleiste und
|
|
351
|
+
// mobiler Zeile hängen An- und Abmeldung kurz gleichzeitig im selben
|
|
352
|
+
// Durchlauf.
|
|
353
|
+
const [hosts, setHosts] = useState(0);
|
|
354
|
+
// Sobald der Editor geschlossen ist, darf sein Blur nichts mehr schreiben.
|
|
355
|
+
// Beim Abräumen verschiebt tiptap das fokussierte contenteditable, der
|
|
356
|
+
// Browser feuert dabei synchron `blur` — und `onBlur` hält noch die
|
|
357
|
+
// Callbacks des letzten Renderns, also ein `commit` mit dem gerade
|
|
358
|
+
// verworfenen Entwurf. Ein Guard auf `isConnected` hilft nicht: beim Feuern
|
|
359
|
+
// hängt der Knoten noch im Dokument.
|
|
360
|
+
const closed = useRef(false);
|
|
361
|
+
const draftRef = useRef('');
|
|
362
|
+
draftRef.current = draft;
|
|
363
|
+
// Die Schrift, auf die der Wirt den Entwurf eingepasst hat; die der Sitzung gilt, bis er eine nennt.
|
|
364
|
+
const [previewSize, setPreviewSize] = useState(null);
|
|
365
|
+
const previewed = useRef(false);
|
|
366
|
+
const onDraftChange = useCallback((next) => {
|
|
367
|
+
setDraft(next);
|
|
368
|
+
if (!session?.onTextPreview)
|
|
369
|
+
return;
|
|
370
|
+
previewed.current = true;
|
|
371
|
+
setPreviewSize(session.onTextPreview(next));
|
|
372
|
+
}, [session]);
|
|
373
|
+
// Woher die Bearbeitung kam: der Ebenen-Eintrag (Enter/F2 in der Liste) oder
|
|
374
|
+
// die Seite. Nach Escape oder Übernehmen geht der Fokus dorthin zurück —
|
|
375
|
+
// sonst fiele er mit dem abgeräumten Editor auf <body>.
|
|
376
|
+
const originRef = useRef(null);
|
|
377
|
+
const open = useCallback((next) => {
|
|
378
|
+
if (!next)
|
|
379
|
+
return;
|
|
380
|
+
closed.current = false;
|
|
381
|
+
originRef.current ??= captureFocusOrigin(next.anchor?.node.getStage()?.container() ?? null);
|
|
382
|
+
setDraft(next.text);
|
|
383
|
+
setPreviewSize(null);
|
|
384
|
+
previewed.current = false;
|
|
385
|
+
setSession(next);
|
|
386
|
+
}, []);
|
|
387
|
+
const commit = useCallback(() => {
|
|
388
|
+
if (closed.current || !session)
|
|
389
|
+
return;
|
|
390
|
+
closed.current = true;
|
|
391
|
+
setSession(null);
|
|
392
|
+
if (draftRef.current !== session.text)
|
|
393
|
+
session.onTextChange?.(draftRef.current);
|
|
394
|
+
else if (previewed.current)
|
|
395
|
+
session.onTextPreview?.(null);
|
|
396
|
+
}, [session]);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
if (session || !originRef.current)
|
|
399
|
+
return;
|
|
400
|
+
const origin = originRef.current;
|
|
401
|
+
originRef.current = null;
|
|
402
|
+
returnFocus(origin);
|
|
403
|
+
}, [session]);
|
|
404
|
+
useEffect(() => {
|
|
405
|
+
if (!session)
|
|
406
|
+
return undefined;
|
|
407
|
+
openCommits.add(commit);
|
|
408
|
+
return () => {
|
|
409
|
+
openCommits.delete(commit);
|
|
410
|
+
};
|
|
411
|
+
}, [session, commit]);
|
|
412
|
+
const box = useAnchoredOverlayBox(session);
|
|
413
|
+
const [loadFailed, setLoadFailed] = useState(false);
|
|
414
|
+
const modules = useRichTextModules(session !== null, () => {
|
|
415
|
+
// Der Entwurf ist noch unverändert — Schließen verliert nichts.
|
|
416
|
+
commit();
|
|
417
|
+
setLoadFailed(true);
|
|
418
|
+
});
|
|
419
|
+
useEffect(() => {
|
|
420
|
+
if (!loadFailed)
|
|
421
|
+
return;
|
|
422
|
+
const timer = window.setTimeout(() => setLoadFailed(false), NOTICE_MS);
|
|
423
|
+
return () => window.clearTimeout(timer);
|
|
424
|
+
}, [loadFailed]);
|
|
425
|
+
const formatControls = modules?.TextFormatControls ?? null;
|
|
426
|
+
const fontSize = previewSize ?? session?.fontSize ?? 0;
|
|
427
|
+
const realFontSize = session && box ? fontSize * box.scale : 0;
|
|
428
|
+
const renderFontSize = Math.max(MIN_EDITOR_FONT_PX, realFontSize);
|
|
429
|
+
const shrink = realFontSize > 0 ? realFontSize / renderFontSize : 1;
|
|
430
|
+
const marks = useMemo(() => session
|
|
431
|
+
? {
|
|
432
|
+
...fontMarkSupport(session.fontFamily),
|
|
433
|
+
accent: !!session.accent,
|
|
434
|
+
marker: !!session.marker,
|
|
435
|
+
}
|
|
436
|
+
: NO_MARKS, [session]);
|
|
437
|
+
// Der Einzug einer Aufzählung, nach derselben Regel wie
|
|
438
|
+
// `layoutRichTextBlock`: der breiteste Marker des Blocks samt Leerzeichen,
|
|
439
|
+
// in der Schrift des Feldes gemessen. Er landet als CSS-Variable im Feld
|
|
440
|
+
// (siehe `canvas-editor.css`) und leistet dort zweierlei — der Punkt steht
|
|
441
|
+
// IM Feld statt links daneben, und der Editor bricht auf derselben Breite
|
|
442
|
+
// um wie Leinwand und Export, der Text springt beim Schließen also nicht.
|
|
443
|
+
//
|
|
444
|
+
// Am Entwurf gemessen und danach skaliert, genau wie auf der Bühne: dort
|
|
445
|
+
// rechnet der Renderer in Entwurfsmaßen, und die Gruppe darum skaliert.
|
|
446
|
+
const listIndent = useMemo(() => {
|
|
447
|
+
if (!session)
|
|
448
|
+
return 0;
|
|
449
|
+
const markers = splitListItems(draft)
|
|
450
|
+
.map((item) => item.marker)
|
|
451
|
+
.filter((marker) => marker !== null);
|
|
452
|
+
if (markers.length === 0)
|
|
453
|
+
return 0;
|
|
454
|
+
const style = fontStyleForRun(session.fontStyle, PLAIN_STYLE);
|
|
455
|
+
const widest = Math.max(...markers.map((marker) => measureTextWidthWithFont(`${marker} `, fontSize, session.fontFamily, style)));
|
|
456
|
+
return (widest * (box?.scale ?? 1)) / shrink;
|
|
457
|
+
}, [draft, session, fontSize, box?.scale, shrink]);
|
|
458
|
+
const claimHost = useCallback(() => {
|
|
459
|
+
setHosts((count) => count + 1);
|
|
460
|
+
return () => setHosts((count) => count - 1);
|
|
461
|
+
}, []);
|
|
462
|
+
const value = useMemo(() => ({ open, editingId: session?.id ?? null, editor, formatControls, marks, claimHost }), [open, session?.id, editor, formatControls, marks, claimHost]);
|
|
463
|
+
// Gedreht um die linke obere Ecke — der Ursprung des Knotens —, dann verkleinert.
|
|
464
|
+
const contentTransform = box
|
|
465
|
+
? [box.rotation !== 0 && `rotate(${box.rotation}deg)`, shrink < 1 && `scale(${shrink})`]
|
|
466
|
+
.filter(Boolean)
|
|
467
|
+
.join(' ') || undefined
|
|
468
|
+
: undefined;
|
|
469
|
+
const contentStyle = session && box
|
|
470
|
+
? {
|
|
471
|
+
fontSize: renderFontSize,
|
|
472
|
+
width: shrink < 1 ? box.width / shrink : undefined,
|
|
473
|
+
transform: contentTransform,
|
|
474
|
+
transformOrigin: 'top left',
|
|
475
|
+
pointerEvents: 'auto',
|
|
476
|
+
fontFamily: resolveFontFamily(session.fontFamily),
|
|
477
|
+
fontStyle: session.fontStyle.includes('italic') ? 'italic' : 'normal',
|
|
478
|
+
fontWeight: /\d+/.exec(session.fontStyle)?.[0] ??
|
|
479
|
+
(session.fontStyle.includes('bold') ? 'bold' : 'normal'),
|
|
480
|
+
color: session.fill,
|
|
481
|
+
textAlign: session.align,
|
|
482
|
+
lineHeight: String(session.lineHeight),
|
|
483
|
+
// Em wie am Knoten (Konva rechnet `letterSpacing * fontSize`); es folgt so auch
|
|
484
|
+
// der Verkleinerung des Editors. Konva wie CSS setzen den Abstand nach jedem Zeichen.
|
|
485
|
+
letterSpacing: session.letterSpacing ? `${session.letterSpacing}em` : undefined,
|
|
486
|
+
// Nicht ganz bis 0: die Deckkraft gehört zum Feld und wird
|
|
487
|
+
// in derselben Leiste gestellt, aber der Editor ist Werkzeug,
|
|
488
|
+
// nicht Sujet — bei 0 tippte man ins Unsichtbare.
|
|
489
|
+
opacity: Math.max(session.opacity, LOWEST_LEGIBLE_OPACITY),
|
|
490
|
+
// Eigene Eigenschaft; React typisiert sie nicht, reicht den
|
|
491
|
+
// Wert aber unverändert durch.
|
|
492
|
+
...{
|
|
493
|
+
'--canvas-rte-list-indent': `${listIndent}px`,
|
|
494
|
+
'--canvas-rte-marker-fill': (session.marker ?? defaultTextMarker(brand)).fill,
|
|
495
|
+
'--canvas-rte-marker-color': (session.marker ?? defaultTextMarker(brand)).color,
|
|
496
|
+
...(session.accent && {
|
|
497
|
+
'--canvas-rte-accent-color': session.accent.fill,
|
|
498
|
+
'--canvas-rte-accent-font': resolveFontFamily(session.accent.fontFamily ?? session.fontFamily),
|
|
499
|
+
'--canvas-rte-accent-style': session.accent.fontStyle?.includes('italic')
|
|
500
|
+
? 'italic'
|
|
501
|
+
: 'inherit',
|
|
502
|
+
'--canvas-rte-accent-weight': session.accent.fontStyle?.includes('bold')
|
|
503
|
+
? 'bold'
|
|
504
|
+
: 'inherit',
|
|
505
|
+
}),
|
|
506
|
+
},
|
|
507
|
+
}
|
|
508
|
+
: null;
|
|
509
|
+
return (_jsxs(TextEditorContext.Provider, { value: value, children: [children, box &&
|
|
510
|
+
contentStyle &&
|
|
511
|
+
// Jetzt ein echtes react-dom-Portal: der Provider steht AUSSERHALB
|
|
512
|
+
// der Bühne, also ist react-dom zuständig. Nach `document.body`,
|
|
513
|
+
// damit die Seitenkoordinaten aus `overlayBoxForNode` stimmen und
|
|
514
|
+
// kein `overflow: hidden` der Leinwandfläche die Werkzeugleiste
|
|
515
|
+
// abschneidet — die sitzt über dem Text und ragt bei einem Feld am
|
|
516
|
+
// oberen Rand aus dem Sujet heraus.
|
|
517
|
+
createPortal(_jsx("div", { style: {
|
|
518
|
+
position: 'absolute',
|
|
519
|
+
top: box.top,
|
|
520
|
+
left: box.left,
|
|
521
|
+
width: box.width,
|
|
522
|
+
minHeight: box.minHeight,
|
|
523
|
+
zIndex: 10000,
|
|
524
|
+
pointerEvents: shrink < 1 ? 'none' : undefined,
|
|
525
|
+
}, children: modules ? (_jsx(modules.RichTextField, { value: draft, onChange: onDraftChange, marks: marks, showToolbar: hosts === 0, onEditorReady: setEditor, autoFocus: true, contentStyle: contentStyle, onBlur: commit, onEscape: commit, onSubmit: commit })) : (_jsx("div", { className: "canvas-rte", children: _jsx("div", { style: contentStyle, children: _jsx("div", { className: "canvas-rte__content", children: stripInlineMarks(draft) }) }) })) }), document.body), loadFailed &&
|
|
526
|
+
createPortal(_jsx("div", { role: "alert", className: "fixed bottom-4 left-1/2 z-[10000] max-w-[min(420px,calc(100vw-32px))] -translate-x-1/2 rounded-md bg-[var(--editor-surface)] px-4 py-3 text-sm text-[var(--editor-text)] shadow-lg", children: messages().errors.textEditorLoad }), document.body)] }));
|
|
527
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfigCanvas — the canvas for a template object the host built itself.
|
|
3
|
+
*
|
|
4
|
+
* Draws the template without sidebar, toolbar or layout chrome and never looks
|
|
5
|
+
* at the template registry, so a host that brings its own templates loads
|
|
6
|
+
* none of the built-in ones. Without a format the stage takes the template's
|
|
7
|
+
* own size when a format of that size exists.
|
|
8
|
+
*
|
|
9
|
+
* To open a template by id, use StandaloneCanvas.
|
|
10
|
+
*/
|
|
11
|
+
import type { GenericCanvasRef } from './GenericCanvas.js';
|
|
12
|
+
import type { AnyCanvasConfig } from '../configs/types.js';
|
|
13
|
+
import type React from 'react';
|
|
14
|
+
export interface ConfigCanvasProps {
|
|
15
|
+
/** The template to draw. Read once on mount. */
|
|
16
|
+
config: AnyCanvasConfig;
|
|
17
|
+
/** Format id of the canvas; freeform lays out on it. Absent: the template's size. */
|
|
18
|
+
formatId?: string;
|
|
19
|
+
initialProps: Record<string, unknown>;
|
|
20
|
+
canvasRef?: React.Ref<GenericCanvasRef>;
|
|
21
|
+
onStateChange?: (state: Record<string, unknown>) => void;
|
|
22
|
+
onExport?: (base64: string) => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Render-once snapshot rather than an embedded editor — see
|
|
26
|
+
* `GenericCanvasProps.preview`. Used by the offscreen chat-preview renderer.
|
|
27
|
+
*/
|
|
28
|
+
preview?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare function ConfigCanvasInner({ config, formatId, initialProps, canvasRef, onStateChange, onExport, className, preview, }: ConfigCanvasProps): React.JSX.Element;
|
|
31
|
+
declare namespace ConfigCanvasInner {
|
|
32
|
+
var displayName: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const ConfigCanvas: React.MemoExoticComponent<typeof ConfigCanvasInner>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
/**
|
|
4
|
+
* ConfigCanvas — the canvas for a template object the host built itself.
|
|
5
|
+
*
|
|
6
|
+
* Draws the template without sidebar, toolbar or layout chrome and never looks
|
|
7
|
+
* at the template registry, so a host that brings its own templates loads
|
|
8
|
+
* none of the built-in ones. Without a format the stage takes the template's
|
|
9
|
+
* own size when a format of that size exists.
|
|
10
|
+
*
|
|
11
|
+
* To open a template by id, use StandaloneCanvas.
|
|
12
|
+
*/
|
|
13
|
+
import { memo, useRef } from 'react';
|
|
14
|
+
import { DEFAULT_FORMAT_ID, formatIdForSize } from '@ggraphic/editor/formats/index';
|
|
15
|
+
import { GenericCanvas } from './GenericCanvas.js';
|
|
16
|
+
const noop = () => { };
|
|
17
|
+
function ConfigCanvasInner({ config, formatId, initialProps, canvasRef, onStateChange, onExport, className, preview = false, }) {
|
|
18
|
+
// Stable ref for onStateChange callback — avoids stale closures
|
|
19
|
+
const onStateChangeRef = useRef(onStateChange);
|
|
20
|
+
onStateChangeRef.current = onStateChange;
|
|
21
|
+
const callbacks = useRef({
|
|
22
|
+
onStateChange: (val) => onStateChangeRef.current?.(val),
|
|
23
|
+
});
|
|
24
|
+
// A template of the default size keeps no format, exactly as before.
|
|
25
|
+
const sized = formatIdForSize(config.canvas.width, config.canvas.height);
|
|
26
|
+
const format = formatId ?? (sized === DEFAULT_FORMAT_ID ? null : sized);
|
|
27
|
+
return (_jsx("div", { className: className, children: _jsx(GenericCanvas, { forwardedRef: canvasRef, config: config, ...(format ? { formatId: format } : {}), initialProps: initialProps, onExport: onExport ?? noop, onCancel: noop, callbacks: callbacks.current, preview: preview }) }));
|
|
28
|
+
}
|
|
29
|
+
ConfigCanvasInner.displayName = 'ConfigCanvas';
|
|
30
|
+
export const ConfigCanvas = memo(ConfigCanvasInner);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type Konva from 'konva';
|
|
2
|
+
/**
|
|
3
|
+
* Das Restbild im Zuschneide-Modus jenseits der Seite. Die Konva-Bühne ist so
|
|
4
|
+
* groß wie die Seite und schneidet alles darüber hinaus ab; diese DOM-Fläche
|
|
5
|
+
* liegt im Bühnen-Container, zeichnet nach jedem Konva-Frame die Restbild-
|
|
6
|
+
* Knoten (`CROP_GHOST_NAME`) nach und folgt damit Ziehen und Zoomen ohne
|
|
7
|
+
* React-Zustand. Gezeichnet wird nur der sichtbare Ausschnitt, damit die
|
|
8
|
+
* Fläche bei starkem Zoom nicht über die Canvas-Grenze von iOS wächst.
|
|
9
|
+
* Exporte rendern nur die Bühne und sehen sie nie.
|
|
10
|
+
*/
|
|
11
|
+
export declare function CropGhostOverlay({ getStage }: {
|
|
12
|
+
getStage: () => Konva.Stage | null;
|
|
13
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
4
|
+
import { useCanvasStoreSelector } from '@ggraphic/editor/stores/CanvasStoreProvider';
|
|
5
|
+
import { paintCropGhosts, visibleContainerRect } from '../utils/cropGhost.js';
|
|
6
|
+
/**
|
|
7
|
+
* Das Restbild im Zuschneide-Modus jenseits der Seite. Die Konva-Bühne ist so
|
|
8
|
+
* groß wie die Seite und schneidet alles darüber hinaus ab; diese DOM-Fläche
|
|
9
|
+
* liegt im Bühnen-Container, zeichnet nach jedem Konva-Frame die Restbild-
|
|
10
|
+
* Knoten (`CROP_GHOST_NAME`) nach und folgt damit Ziehen und Zoomen ohne
|
|
11
|
+
* React-Zustand. Gezeichnet wird nur der sichtbare Ausschnitt, damit die
|
|
12
|
+
* Fläche bei starkem Zoom nicht über die Canvas-Grenze von iOS wächst.
|
|
13
|
+
* Exporte rendern nur die Bühne und sehen sie nie.
|
|
14
|
+
*/
|
|
15
|
+
export function CropGhostOverlay({ getStage }) {
|
|
16
|
+
const active = useCanvasStoreSelector((s) => s.croppingElement !== null);
|
|
17
|
+
const canvasRef = useRef(null);
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
const stage = getStage();
|
|
20
|
+
const canvas = canvasRef.current;
|
|
21
|
+
if (!active || !stage || !canvas)
|
|
22
|
+
return;
|
|
23
|
+
const host = canvas.parentElement;
|
|
24
|
+
const paint = () => paintCropGhosts(stage, canvas, host ? visibleContainerRect(host) : null);
|
|
25
|
+
const layers = stage.getLayers();
|
|
26
|
+
layers.forEach((layer) => layer.on('draw.cropGhost', paint));
|
|
27
|
+
// Scrollen und Zoomen verschieben den sichtbaren Ausschnitt ohne Konva-Frame.
|
|
28
|
+
const viewKey = () => {
|
|
29
|
+
const box = host?.getBoundingClientRect();
|
|
30
|
+
return box
|
|
31
|
+
? `${box.left},${box.top},${box.width},${window.innerWidth},${window.innerHeight}`
|
|
32
|
+
: '';
|
|
33
|
+
};
|
|
34
|
+
let lastView = viewKey();
|
|
35
|
+
let frame = 0;
|
|
36
|
+
const watch = () => {
|
|
37
|
+
const view = viewKey();
|
|
38
|
+
if (view !== lastView) {
|
|
39
|
+
lastView = view;
|
|
40
|
+
paint();
|
|
41
|
+
}
|
|
42
|
+
frame = requestAnimationFrame(watch);
|
|
43
|
+
};
|
|
44
|
+
paint();
|
|
45
|
+
frame = requestAnimationFrame(watch);
|
|
46
|
+
return () => {
|
|
47
|
+
cancelAnimationFrame(frame);
|
|
48
|
+
layers.forEach((layer) => layer.off('draw.cropGhost'));
|
|
49
|
+
};
|
|
50
|
+
}, [active, getStage]);
|
|
51
|
+
if (!active)
|
|
52
|
+
return null;
|
|
53
|
+
return (_jsx("canvas", { ref: canvasRef, "aria-hidden": "true", "data-crop-ghost-overlay": "",
|
|
54
|
+
// Über der Bühne, aber unter ihrem Rahmen (::after, z-index 10); die Seite selbst ist ausgespart.
|
|
55
|
+
className: "pointer-events-none absolute z-[5]", style: { display: 'none' } }));
|
|
56
|
+
}
|