@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,140 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { useCanvasStore } from '@ggraphic/editor/stores/CanvasStoreProvider';
|
|
4
|
+
import { canStartMarquee, itemsInRect, SELECTION_COLOR, syncOutlines, } from '@ggraphic/editor/utils/multiSelect';
|
|
5
|
+
const MARQUEE_FILL = 'rgba(0, 161, 255, 0.08)';
|
|
6
|
+
/** Unter dieser Strecke (Bildschirm-px) bleibt der Druck ein gewöhnlicher Klick. */
|
|
7
|
+
const ACTIVATION_DISTANCE = 4;
|
|
8
|
+
/**
|
|
9
|
+
* Auswahlrahmen: Maus auf leerer Fläche, einem nicht ziehbaren Hintergrund
|
|
10
|
+
* oder der Arbeitsfläche um das Bild drücken und ziehen wählt jedes ziehbare
|
|
11
|
+
* Element, das der Rahmen schneidet (mit Shift zur bestehenden Auswahl hinzu).
|
|
12
|
+
*
|
|
13
|
+
* Der Rahmen selbst ist ein DOM-Element in Bildschirmkoordinaten, kein
|
|
14
|
+
* Konva-Knoten: die Leinwand endet am Bildrand, ein Rahmen darin wäre dort
|
|
15
|
+
* abgeschnitten. Getroffen wird in Bühnenkoordinaten — Konva rechnet
|
|
16
|
+
* Zeigerpositionen auch außerhalb der Leinwand um.
|
|
17
|
+
*
|
|
18
|
+
* Was der Rahmen gerade trifft, bekommt schon während des Zugs einen Umriss;
|
|
19
|
+
* in den Store geht die Auswahl erst beim Loslassen — sonst schalteten
|
|
20
|
+
* Sidebar und Sheets bei jedem Zwischenstand um. Während des Zugs rendert
|
|
21
|
+
* keine React-Komponente. Nur Maus — auf Touch gehört die Geste dem Scrollen.
|
|
22
|
+
*/
|
|
23
|
+
export function useMarqueeSelection(stageRef, enabled) {
|
|
24
|
+
const store = useCanvasStore();
|
|
25
|
+
const suppressClickRef = useRef(false);
|
|
26
|
+
const startRef = useRef(null);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const stage = stageRef.current?.getStage();
|
|
29
|
+
const layer = stage?.getLayers()[0];
|
|
30
|
+
if (!stage || !layer || !enabled)
|
|
31
|
+
return;
|
|
32
|
+
// Vorschau: ein Umriss je getroffenem Element, wiederverwendet über die Züge.
|
|
33
|
+
const outlines = [];
|
|
34
|
+
const showPreview = (nodes) => syncOutlines(layer, outlines, nodes);
|
|
35
|
+
let cleanupDrag = null;
|
|
36
|
+
// Jeder neue Druck beginnt ohne Altlast — auch wenn nach dem letzten
|
|
37
|
+
// Rahmenzug gar kein Klick auf ein Element kam.
|
|
38
|
+
const resetSuppress = () => {
|
|
39
|
+
suppressClickRef.current = false;
|
|
40
|
+
};
|
|
41
|
+
const container = stage.container();
|
|
42
|
+
container.addEventListener('pointerdown', resetSuppress, true);
|
|
43
|
+
/** Zeigerposition in Bühnenkoordinaten, auch außerhalb der Leinwand. */
|
|
44
|
+
const stagePoint = (evt) => {
|
|
45
|
+
stage.setPointersPositions(evt);
|
|
46
|
+
return stage.getPointerPosition();
|
|
47
|
+
};
|
|
48
|
+
const start = (down) => {
|
|
49
|
+
if (down.button !== 0)
|
|
50
|
+
return;
|
|
51
|
+
cleanupDrag?.();
|
|
52
|
+
const startScreen = { x: down.clientX, y: down.clientY };
|
|
53
|
+
const startStage = stagePoint(down);
|
|
54
|
+
if (!startStage)
|
|
55
|
+
return;
|
|
56
|
+
const additive = down.shiftKey;
|
|
57
|
+
let overlay = null;
|
|
58
|
+
let hitRect = { x: 0, y: 0, width: 0, height: 0 };
|
|
59
|
+
const onMove = (evt) => {
|
|
60
|
+
if (!overlay) {
|
|
61
|
+
const dist = Math.hypot(evt.clientX - startScreen.x, evt.clientY - startScreen.y);
|
|
62
|
+
if (dist < ACTIVATION_DISTANCE)
|
|
63
|
+
return;
|
|
64
|
+
suppressClickRef.current = true;
|
|
65
|
+
// Ohne Shift ersetzt der Rahmen die Auswahl — die alte soll während
|
|
66
|
+
// des Zugs nicht neben der Vorschau stehen bleiben.
|
|
67
|
+
const { selectedLayerIds, setSelectedLayers } = store.getState();
|
|
68
|
+
if (!additive && selectedLayerIds.length > 0)
|
|
69
|
+
setSelectedLayers([]);
|
|
70
|
+
overlay = document.createElement('div');
|
|
71
|
+
Object.assign(overlay.style, {
|
|
72
|
+
position: 'fixed',
|
|
73
|
+
pointerEvents: 'none',
|
|
74
|
+
zIndex: '1000',
|
|
75
|
+
border: `1px solid ${SELECTION_COLOR}`,
|
|
76
|
+
background: MARQUEE_FILL,
|
|
77
|
+
});
|
|
78
|
+
document.body.appendChild(overlay);
|
|
79
|
+
}
|
|
80
|
+
Object.assign(overlay.style, {
|
|
81
|
+
left: `${Math.min(startScreen.x, evt.clientX)}px`,
|
|
82
|
+
top: `${Math.min(startScreen.y, evt.clientY)}px`,
|
|
83
|
+
width: `${Math.abs(evt.clientX - startScreen.x)}px`,
|
|
84
|
+
height: `${Math.abs(evt.clientY - startScreen.y)}px`,
|
|
85
|
+
});
|
|
86
|
+
const pos = stagePoint(evt);
|
|
87
|
+
if (!pos)
|
|
88
|
+
return;
|
|
89
|
+
hitRect = {
|
|
90
|
+
x: Math.min(startStage.x, pos.x),
|
|
91
|
+
y: Math.min(startStage.y, pos.y),
|
|
92
|
+
width: Math.abs(pos.x - startStage.x),
|
|
93
|
+
height: Math.abs(pos.y - startStage.y),
|
|
94
|
+
};
|
|
95
|
+
showPreview(itemsInRect(layer, hitRect).map((hit) => hit.node));
|
|
96
|
+
layer.batchDraw();
|
|
97
|
+
};
|
|
98
|
+
const stop = () => {
|
|
99
|
+
window.removeEventListener('mousemove', onMove);
|
|
100
|
+
window.removeEventListener('mouseup', finish);
|
|
101
|
+
overlay?.remove();
|
|
102
|
+
cleanupDrag = null;
|
|
103
|
+
};
|
|
104
|
+
const finish = () => {
|
|
105
|
+
const wasActive = overlay !== null;
|
|
106
|
+
stop();
|
|
107
|
+
if (!wasActive)
|
|
108
|
+
return;
|
|
109
|
+
const hits = itemsInRect(layer, hitRect).map((hit) => hit.id);
|
|
110
|
+
showPreview([]);
|
|
111
|
+
layer.batchDraw();
|
|
112
|
+
const { selectedLayerIds, setSelectedLayers } = store.getState();
|
|
113
|
+
setSelectedLayers(additive ? [...selectedLayerIds, ...hits] : hits);
|
|
114
|
+
};
|
|
115
|
+
window.addEventListener('mousemove', onMove);
|
|
116
|
+
window.addEventListener('mouseup', finish);
|
|
117
|
+
cleanupDrag = stop;
|
|
118
|
+
};
|
|
119
|
+
startRef.current = start;
|
|
120
|
+
const onMouseDown = (e) => {
|
|
121
|
+
if (canStartMarquee(e.target))
|
|
122
|
+
start(e.evt);
|
|
123
|
+
};
|
|
124
|
+
stage.on('mousedown.marquee', onMouseDown);
|
|
125
|
+
return () => {
|
|
126
|
+
stage.off('mousedown.marquee');
|
|
127
|
+
container.removeEventListener('pointerdown', resetSuppress, true);
|
|
128
|
+
cleanupDrag?.();
|
|
129
|
+
startRef.current = null;
|
|
130
|
+
outlines.forEach((outline) => outline.destroy());
|
|
131
|
+
};
|
|
132
|
+
}, [stageRef, enabled, store]);
|
|
133
|
+
const consumeMarqueeClick = useCallback(() => {
|
|
134
|
+
const suppress = suppressClickRef.current;
|
|
135
|
+
suppressClickRef.current = false;
|
|
136
|
+
return suppress;
|
|
137
|
+
}, []);
|
|
138
|
+
const beginMarquee = useCallback((evt) => startRef.current?.(evt), []);
|
|
139
|
+
return { consumeMarqueeClick, beginMarquee };
|
|
140
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
interface UseMobileSheetOptions {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
/**
|
|
5
|
+
* Called once a drag has carried the sheet off-screen, right before
|
|
6
|
+
* `onClose` and in the same event — the owner can drop the sheet at once
|
|
7
|
+
* instead of playing its own exit from the top.
|
|
8
|
+
*/
|
|
9
|
+
onDragClosed?: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* What the sheet shows (e.g. its title). A change while a drag-close slides
|
|
12
|
+
* out aborts it — the close belonged to the previous content.
|
|
13
|
+
*/
|
|
14
|
+
closeKey?: string | null;
|
|
15
|
+
threshold?: number;
|
|
16
|
+
velocityThreshold?: number;
|
|
17
|
+
}
|
|
18
|
+
interface UseMobileSheetReturn {
|
|
19
|
+
/** Header: wraps the grab handle and the title row. */
|
|
20
|
+
handleRef: React.RefObject<HTMLDivElement | null>;
|
|
21
|
+
sheetRef: React.RefObject<HTMLElement | null>;
|
|
22
|
+
/** The scroll container; pulls the sheet down only from its top. */
|
|
23
|
+
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
isDragging: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Swipe-down-to-close for the mobile sheet. The drag writes the transform
|
|
28
|
+
* straight onto `sheetRef` — a React render per touchmove drops frames on a
|
|
29
|
+
* sheet full of tiles.
|
|
30
|
+
*
|
|
31
|
+
* The header (handle + title row, `touch-action: none`) drags with passive
|
|
32
|
+
* listeners. The content drags only when it sits at its top and the move goes
|
|
33
|
+
* down; anything else is left to native scrolling. Once the content has
|
|
34
|
+
* handed the gesture to the sheet, its touchmove calls `preventDefault` —
|
|
35
|
+
* the one non-passive listener — so the list does not scroll along.
|
|
36
|
+
*
|
|
37
|
+
* WebKit commits an unprevented first touchmove to native scrolling (the list
|
|
38
|
+
* rubber-bands at its top) and later moves are no longer cancelable, so the
|
|
39
|
+
* content claims the gesture on its FIRST move if that goes down steeply
|
|
40
|
+
* (dy >= 2·|dx|); the slop then only decides between drag and nothing. Whether the
|
|
41
|
+
* content may take over at all is settled at touchstart (list at its top, not
|
|
42
|
+
* inside a textarea, slider, horizontal or scrolled nested scroller): every other gesture
|
|
43
|
+
* returns from the non-passive touchmove at its first line. Passivity is fixed
|
|
44
|
+
* at registration and a listener added mid-gesture does not make that
|
|
45
|
+
* gesture's moves cancelable, so the one listener stays.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useMobileSheet({ isOpen, onClose, onDragClosed, closeKey, threshold, velocityThreshold, }: UseMobileSheetOptions): UseMobileSheetReturn;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { useState, useEffect, useRef } from 'react';
|
|
3
|
+
const SHEET_TRANSITION = 'transform 200ms var(--editor-ease-out)';
|
|
4
|
+
const SHEET_FADE = 'opacity 200ms var(--editor-ease-out)';
|
|
5
|
+
/** Movement before a touch counts as a drag, so taps (close button) stay taps. */
|
|
6
|
+
const DRAG_SLOP_PX = 6;
|
|
7
|
+
/** Release velocity is measured over the samples within this window. */
|
|
8
|
+
const VELOCITY_WINDOW_MS = 80;
|
|
9
|
+
const SAMPLE_COUNT = 16;
|
|
10
|
+
/** Upper bound for the 200 ms slide-out when `transitionend` never comes. */
|
|
11
|
+
const CLOSE_FALLBACK_MS = 350;
|
|
12
|
+
/**
|
|
13
|
+
* Swipe-down-to-close for the mobile sheet. The drag writes the transform
|
|
14
|
+
* straight onto `sheetRef` — a React render per touchmove drops frames on a
|
|
15
|
+
* sheet full of tiles.
|
|
16
|
+
*
|
|
17
|
+
* The header (handle + title row, `touch-action: none`) drags with passive
|
|
18
|
+
* listeners. The content drags only when it sits at its top and the move goes
|
|
19
|
+
* down; anything else is left to native scrolling. Once the content has
|
|
20
|
+
* handed the gesture to the sheet, its touchmove calls `preventDefault` —
|
|
21
|
+
* the one non-passive listener — so the list does not scroll along.
|
|
22
|
+
*
|
|
23
|
+
* WebKit commits an unprevented first touchmove to native scrolling (the list
|
|
24
|
+
* rubber-bands at its top) and later moves are no longer cancelable, so the
|
|
25
|
+
* content claims the gesture on its FIRST move if that goes down steeply
|
|
26
|
+
* (dy >= 2·|dx|); the slop then only decides between drag and nothing. Whether the
|
|
27
|
+
* content may take over at all is settled at touchstart (list at its top, not
|
|
28
|
+
* inside a textarea, slider, horizontal or scrolled nested scroller): every other gesture
|
|
29
|
+
* returns from the non-passive touchmove at its first line. Passivity is fixed
|
|
30
|
+
* at registration and a listener added mid-gesture does not make that
|
|
31
|
+
* gesture's moves cancelable, so the one listener stays.
|
|
32
|
+
*/
|
|
33
|
+
export function useMobileSheet({ isOpen, onClose, onDragClosed, closeKey = null, threshold = 100, velocityThreshold = 0.5, }) {
|
|
34
|
+
const handleRef = useRef(null);
|
|
35
|
+
const sheetRef = useRef(null);
|
|
36
|
+
const contentRef = useRef(null);
|
|
37
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
38
|
+
// Set while a drag-close slides out; aborts it and brings the sheet back.
|
|
39
|
+
const abortCloseRef = useRef(null);
|
|
40
|
+
const onCloseRef = useRef(onClose);
|
|
41
|
+
const onDragClosedRef = useRef(onDragClosed);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
onCloseRef.current = onClose;
|
|
44
|
+
onDragClosedRef.current = onDragClosed;
|
|
45
|
+
}, [onClose, onDragClosed]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const handle = handleRef.current;
|
|
48
|
+
const sheet = sheetRef.current;
|
|
49
|
+
if (!isOpen || !handle || !sheet)
|
|
50
|
+
return;
|
|
51
|
+
const content = contentRef.current;
|
|
52
|
+
// A reopened sheet must not keep a previous drag's inline styles.
|
|
53
|
+
sheet.style.transform = '';
|
|
54
|
+
sheet.style.transition = '';
|
|
55
|
+
sheet.style.opacity = '';
|
|
56
|
+
sheet.style.willChange = '';
|
|
57
|
+
// 'pending' until the touch moved past the slop; then the sheet drags, or
|
|
58
|
+
// (content only) the browser scrolls for the rest of the gesture.
|
|
59
|
+
let mode = 'idle';
|
|
60
|
+
let fromContent = false;
|
|
61
|
+
// Content only: the first move went down, so the browser must not scroll.
|
|
62
|
+
let claimed = false;
|
|
63
|
+
// The finger that owns the gesture; other fingers are ignored.
|
|
64
|
+
let activeId = 0;
|
|
65
|
+
let startScrollTop = 0;
|
|
66
|
+
let startX = 0;
|
|
67
|
+
let startY = 0;
|
|
68
|
+
let deltaY = 0;
|
|
69
|
+
// Ring buffer of the latest touch positions for the release velocity.
|
|
70
|
+
const samples = Array.from({ length: SAMPLE_COUNT }, () => ({ y: 0, t: 0 }));
|
|
71
|
+
let sampleIndex = 0;
|
|
72
|
+
let sampleCount = 0;
|
|
73
|
+
let closing = false;
|
|
74
|
+
let fallbackTimer = 0;
|
|
75
|
+
const record = (y) => {
|
|
76
|
+
const sample = samples[sampleIndex];
|
|
77
|
+
sample.y = y;
|
|
78
|
+
sample.t = Date.now();
|
|
79
|
+
sampleIndex = (sampleIndex + 1) % SAMPLE_COUNT;
|
|
80
|
+
sampleCount = Math.min(sampleCount + 1, SAMPLE_COUNT);
|
|
81
|
+
};
|
|
82
|
+
/** px/ms between the oldest and newest sample of the last 80 ms. */
|
|
83
|
+
const releaseVelocity = () => {
|
|
84
|
+
const now = Date.now();
|
|
85
|
+
let newest = null;
|
|
86
|
+
let oldest = null;
|
|
87
|
+
for (let i = 1; i <= sampleCount; i++) {
|
|
88
|
+
const sample = samples[(sampleIndex - i + SAMPLE_COUNT) % SAMPLE_COUNT];
|
|
89
|
+
if (now - sample.t > VELOCITY_WINDOW_MS)
|
|
90
|
+
break;
|
|
91
|
+
newest ??= sample;
|
|
92
|
+
oldest = sample;
|
|
93
|
+
}
|
|
94
|
+
if (!newest || !oldest || newest.t === oldest.t)
|
|
95
|
+
return 0;
|
|
96
|
+
return (newest.y - oldest.y) / (newest.t - oldest.t);
|
|
97
|
+
};
|
|
98
|
+
const reducedMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
99
|
+
const onTransitionEnd = (e) => {
|
|
100
|
+
if (e.target !== sheet)
|
|
101
|
+
return;
|
|
102
|
+
if (e.propertyName !== 'transform' && e.propertyName !== 'opacity')
|
|
103
|
+
return;
|
|
104
|
+
finishClose();
|
|
105
|
+
};
|
|
106
|
+
const finishClose = () => {
|
|
107
|
+
if (!closing)
|
|
108
|
+
return;
|
|
109
|
+
closing = false;
|
|
110
|
+
window.clearTimeout(fallbackTimer);
|
|
111
|
+
sheet.removeEventListener('transitionend', onTransitionEnd);
|
|
112
|
+
onDragClosedRef.current?.();
|
|
113
|
+
onCloseRef.current();
|
|
114
|
+
};
|
|
115
|
+
abortCloseRef.current = () => {
|
|
116
|
+
if (!closing)
|
|
117
|
+
return;
|
|
118
|
+
closing = false;
|
|
119
|
+
window.clearTimeout(fallbackTimer);
|
|
120
|
+
sheet.removeEventListener('transitionend', onTransitionEnd);
|
|
121
|
+
sheet.style.opacity = '';
|
|
122
|
+
snapBack();
|
|
123
|
+
};
|
|
124
|
+
const activeTouch = (list) => Array.from(list).find((t) => t.identifier === activeId) ?? null;
|
|
125
|
+
/** A horizontal scroller (chip/swatch row) pans sideways; claiming it would freeze it. */
|
|
126
|
+
const scrollsSideways = (el) => el.scrollWidth > el.clientWidth && /auto|scroll/.test(getComputedStyle(el).overflowX);
|
|
127
|
+
/**
|
|
128
|
+
* Touches the content must never claim: a textarea, a slider, a scrolled
|
|
129
|
+
* nested scroller, or a horizontal scroller between the touch and the content.
|
|
130
|
+
*/
|
|
131
|
+
const startsInNestedScroll = (target) => {
|
|
132
|
+
for (let el = target instanceof Element ? target : null; el && el !== content;) {
|
|
133
|
+
if (el instanceof HTMLTextAreaElement ||
|
|
134
|
+
(el instanceof HTMLInputElement && el.type === 'range') ||
|
|
135
|
+
el.getAttribute('role') === 'slider' ||
|
|
136
|
+
el.scrollTop > 0 ||
|
|
137
|
+
scrollsSideways(el)) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
el = el.parentElement;
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
};
|
|
144
|
+
const start = (e, isContent) => {
|
|
145
|
+
// A second finger neither restarts nor ends the running gesture.
|
|
146
|
+
if (closing || mode !== 'idle' || e.touches.length > 1)
|
|
147
|
+
return;
|
|
148
|
+
const touch = e.touches[0];
|
|
149
|
+
activeId = touch.identifier;
|
|
150
|
+
fromContent = isContent;
|
|
151
|
+
claimed = false;
|
|
152
|
+
startScrollTop = isContent ? (content?.scrollTop ?? 0) : 0;
|
|
153
|
+
// Decided here, so a scrolling list's moves skip the handler at once.
|
|
154
|
+
mode =
|
|
155
|
+
isContent && (startScrollTop > 0 || startsInNestedScroll(e.target)) ? 'scroll' : 'pending';
|
|
156
|
+
startX = touch.clientX || 0;
|
|
157
|
+
startY = touch.clientY;
|
|
158
|
+
deltaY = 0;
|
|
159
|
+
sampleCount = 0;
|
|
160
|
+
record(startY);
|
|
161
|
+
};
|
|
162
|
+
const move = (e) => {
|
|
163
|
+
if (mode === 'idle' || mode === 'scroll')
|
|
164
|
+
return;
|
|
165
|
+
const touch = activeTouch(e.touches);
|
|
166
|
+
if (!touch)
|
|
167
|
+
return;
|
|
168
|
+
const dy = touch.clientY - startY;
|
|
169
|
+
record(touch.clientY);
|
|
170
|
+
if (mode === 'pending') {
|
|
171
|
+
const dx = (touch.clientX || 0) - startX;
|
|
172
|
+
if (fromContent && !claimed) {
|
|
173
|
+
if (dx === 0 && dy === 0)
|
|
174
|
+
return;
|
|
175
|
+
// First move: only a steep downward one claims it (a diagonal one may
|
|
176
|
+
// still turn into a sideways swipe); anything else scrolls.
|
|
177
|
+
if (dy < 2 * Math.abs(dx) || dy <= 0 || (content?.scrollTop ?? 0) > 0) {
|
|
178
|
+
mode = 'scroll';
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
claimed = true;
|
|
182
|
+
}
|
|
183
|
+
if (claimed && e.cancelable)
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
if (Math.max(Math.abs(dx), Math.abs(dy)) < DRAG_SLOP_PX)
|
|
186
|
+
return;
|
|
187
|
+
const scrolled = (content?.scrollTop ?? 0) > 0;
|
|
188
|
+
if (fromContent && (dy <= Math.abs(dx) || scrolled)) {
|
|
189
|
+
mode = 'scroll';
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (dy <= 0)
|
|
193
|
+
return; // header: wait for a downward move
|
|
194
|
+
mode = 'drag';
|
|
195
|
+
sheet.style.transition = 'none';
|
|
196
|
+
sheet.style.willChange = 'transform';
|
|
197
|
+
setIsDragging(true);
|
|
198
|
+
}
|
|
199
|
+
if (fromContent && e.cancelable)
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
deltaY = Math.max(0, dy);
|
|
202
|
+
sheet.style.transform = `translateY(${deltaY}px)`;
|
|
203
|
+
};
|
|
204
|
+
/** True if this touchend/cancel lifts the owning finger. */
|
|
205
|
+
const endsGesture = (e) => mode !== 'idle' && (e.touches.length === 0 || activeTouch(e.changedTouches) !== null);
|
|
206
|
+
/** Leaves drag mode; true if the sheet was being dragged. */
|
|
207
|
+
const release = () => {
|
|
208
|
+
const wasDragging = mode === 'drag';
|
|
209
|
+
mode = 'idle';
|
|
210
|
+
if (wasDragging) {
|
|
211
|
+
setIsDragging(false);
|
|
212
|
+
sheet.style.willChange = '';
|
|
213
|
+
}
|
|
214
|
+
return wasDragging;
|
|
215
|
+
};
|
|
216
|
+
const snapBack = () => {
|
|
217
|
+
sheet.style.transition = reducedMotion() ? 'none' : SHEET_TRANSITION;
|
|
218
|
+
sheet.style.transform = '';
|
|
219
|
+
};
|
|
220
|
+
// The system took the touch away (call, gesture, …): never a close.
|
|
221
|
+
const cancel = (e) => {
|
|
222
|
+
if (endsGesture(e) && release())
|
|
223
|
+
snapBack();
|
|
224
|
+
};
|
|
225
|
+
const end = (e) => {
|
|
226
|
+
if (!endsGesture(e) || !release())
|
|
227
|
+
return;
|
|
228
|
+
// A flick decides by itself; a long drag closes unless flicked back up.
|
|
229
|
+
const velocity = releaseVelocity();
|
|
230
|
+
const shouldClose = velocity > velocityThreshold || (deltaY > threshold && velocity >= -velocityThreshold);
|
|
231
|
+
if (!shouldClose) {
|
|
232
|
+
snapBack();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
// Slide on from where the finger let go; reduced motion fades in place.
|
|
236
|
+
closing = true;
|
|
237
|
+
sheet.addEventListener('transitionend', onTransitionEnd);
|
|
238
|
+
fallbackTimer = window.setTimeout(finishClose, CLOSE_FALLBACK_MS);
|
|
239
|
+
if (reducedMotion()) {
|
|
240
|
+
sheet.style.transition = SHEET_FADE;
|
|
241
|
+
sheet.style.opacity = '0';
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
sheet.style.transition = SHEET_TRANSITION;
|
|
245
|
+
sheet.style.transform = 'translateY(100%)';
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
const onHandleStart = (e) => start(e, false);
|
|
249
|
+
const onContentStart = (e) => start(e, true);
|
|
250
|
+
handle.addEventListener('touchstart', onHandleStart, { passive: true });
|
|
251
|
+
handle.addEventListener('touchmove', move, { passive: true });
|
|
252
|
+
handle.addEventListener('touchend', end);
|
|
253
|
+
handle.addEventListener('touchcancel', cancel);
|
|
254
|
+
content?.addEventListener('touchstart', onContentStart, { passive: true });
|
|
255
|
+
content?.addEventListener('touchmove', move, { passive: false });
|
|
256
|
+
content?.addEventListener('touchend', end);
|
|
257
|
+
content?.addEventListener('touchcancel', cancel);
|
|
258
|
+
return () => {
|
|
259
|
+
abortCloseRef.current = null;
|
|
260
|
+
window.clearTimeout(fallbackTimer);
|
|
261
|
+
sheet.removeEventListener('transitionend', onTransitionEnd);
|
|
262
|
+
handle.removeEventListener('touchstart', onHandleStart);
|
|
263
|
+
handle.removeEventListener('touchmove', move);
|
|
264
|
+
handle.removeEventListener('touchend', end);
|
|
265
|
+
handle.removeEventListener('touchcancel', cancel);
|
|
266
|
+
content?.removeEventListener('touchstart', onContentStart);
|
|
267
|
+
content?.removeEventListener('touchmove', move);
|
|
268
|
+
content?.removeEventListener('touchend', end);
|
|
269
|
+
content?.removeEventListener('touchcancel', cancel);
|
|
270
|
+
};
|
|
271
|
+
}, [isOpen, threshold, velocityThreshold]);
|
|
272
|
+
// Another tab while the drag-close slides out: keep the sheet for it.
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
abortCloseRef.current?.();
|
|
275
|
+
}, [closeKey]);
|
|
276
|
+
return {
|
|
277
|
+
handleRef,
|
|
278
|
+
sheetRef,
|
|
279
|
+
contentRef,
|
|
280
|
+
isDragging,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useMultiPageExport - Coordinates batch export for multi-page canvases
|
|
3
|
+
*
|
|
4
|
+
* Collects page images (PNG unless another format is asked for) from multiple
|
|
5
|
+
* canvas refs and packs them into a ZIP in the browser. Handles progress
|
|
6
|
+
* tracking and error states.
|
|
7
|
+
*/
|
|
8
|
+
import { type RefObject } from 'react';
|
|
9
|
+
import { type ExportFormat } from '@ggraphic/editor/types/editorTypes';
|
|
10
|
+
import type { GenericCanvasRef } from '../components/GenericCanvas.js';
|
|
11
|
+
export interface UseMultiPageExportProps {
|
|
12
|
+
canvasRefs: RefObject<GenericCanvasRef | null>[];
|
|
13
|
+
canvasType: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ExportProgress {
|
|
16
|
+
current: number;
|
|
17
|
+
total: number;
|
|
18
|
+
}
|
|
19
|
+
export interface UseMultiPageExportReturn {
|
|
20
|
+
exportAllPages: (options?: {
|
|
21
|
+
pixelRatio?: number;
|
|
22
|
+
format?: ExportFormat;
|
|
23
|
+
}) => Promise<string[]>;
|
|
24
|
+
downloadAllAsZip: (format?: ExportFormat) => Promise<void>;
|
|
25
|
+
isExporting: boolean;
|
|
26
|
+
exportProgress: ExportProgress;
|
|
27
|
+
error: string | null;
|
|
28
|
+
notice: string | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function useMultiPageExport({ canvasRefs, canvasType, }: UseMultiPageExportProps): UseMultiPageExportReturn;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* useMultiPageExport - Coordinates batch export for multi-page canvases
|
|
4
|
+
*
|
|
5
|
+
* Collects page images (PNG unless another format is asked for) from multiple
|
|
6
|
+
* canvas refs and packs them into a ZIP in the browser. Handles progress
|
|
7
|
+
* tracking and error states.
|
|
8
|
+
*/
|
|
9
|
+
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
10
|
+
import { messages } from '@ggraphic/editor/i18n/messages';
|
|
11
|
+
import { isDownloadTooLarge } from '@ggraphic/editor/utils/downloadError';
|
|
12
|
+
import { zipPageImages } from '@ggraphic/editor/utils/zipPageImages';
|
|
13
|
+
import { useCanvasEditorServices } from '../CanvasEditorProvider.js';
|
|
14
|
+
import { browserFileDelivery } from '../hostServices.js';
|
|
15
|
+
const NOTICE_LIFETIME_MS = 5000;
|
|
16
|
+
export function useMultiPageExport({ canvasRefs, canvasType, }) {
|
|
17
|
+
const [isExporting, setIsExporting] = useState(false);
|
|
18
|
+
const [exportProgress, setExportProgress] = useState({ current: 0, total: 0 });
|
|
19
|
+
const [error, setError] = useState(null);
|
|
20
|
+
const [notice, setNotice] = useState(null);
|
|
21
|
+
const noticeTimer = useRef(undefined);
|
|
22
|
+
const { fileDelivery = browserFileDelivery } = useCanvasEditorServices();
|
|
23
|
+
const prefix = fileDelivery.filenamePrefix ?? 'ggraphic';
|
|
24
|
+
useEffect(() => () => clearTimeout(noticeTimer.current), []);
|
|
25
|
+
// A page whose stage is not mounted or whose capture fails must surface as
|
|
26
|
+
// an error, not silently shrink the export — a ZIP with fewer images than
|
|
27
|
+
// pages reads as data loss.
|
|
28
|
+
const exportAllPages = useCallback(async (options) => {
|
|
29
|
+
const total = canvasRefs.length;
|
|
30
|
+
const images = [];
|
|
31
|
+
const failedPages = [];
|
|
32
|
+
setExportProgress({ current: 0, total });
|
|
33
|
+
for (let i = 0; i < canvasRefs.length; i++) {
|
|
34
|
+
const ref = canvasRefs[i];
|
|
35
|
+
let dataUrl = null;
|
|
36
|
+
if (ref.current) {
|
|
37
|
+
try {
|
|
38
|
+
dataUrl = await ref.current.captureCanvas(options);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
dataUrl = null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (dataUrl) {
|
|
45
|
+
images.push(dataUrl);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
failedPages.push(i + 1);
|
|
49
|
+
}
|
|
50
|
+
setExportProgress({ current: i + 1, total });
|
|
51
|
+
}
|
|
52
|
+
if (failedPages.length > 0) {
|
|
53
|
+
throw new Error(messages().errors.pagesExport(failedPages.join(', ')));
|
|
54
|
+
}
|
|
55
|
+
return images;
|
|
56
|
+
}, [canvasRefs]);
|
|
57
|
+
const downloadAllAsZip = useCallback(async (format = 'png') => {
|
|
58
|
+
if (canvasRefs.length === 0) {
|
|
59
|
+
setError(messages().errors.noPagesToExport);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setIsExporting(true);
|
|
63
|
+
setError(null);
|
|
64
|
+
clearTimeout(noticeTimer.current);
|
|
65
|
+
setNotice(null);
|
|
66
|
+
try {
|
|
67
|
+
// Capture all canvas images
|
|
68
|
+
const images = await exportAllPages({ format });
|
|
69
|
+
if (images.length === 0) {
|
|
70
|
+
throw new Error(messages().errors.noImagesExported);
|
|
71
|
+
}
|
|
72
|
+
const blob = zipPageImages(images);
|
|
73
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
|
|
74
|
+
const filename = `${prefix}-${canvasType}-${timestamp}.zip`;
|
|
75
|
+
try {
|
|
76
|
+
await fileDelivery.downloadBlob(blob, filename);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
if (!isDownloadTooLarge(err))
|
|
80
|
+
throw err;
|
|
81
|
+
// A payload the bridge refuses (any other failure lands in setError
|
|
82
|
+
// below): the pages are smaller than their ZIP, so send them one by one.
|
|
83
|
+
let sent = 0;
|
|
84
|
+
try {
|
|
85
|
+
for (let i = 0; i < images.length; i++) {
|
|
86
|
+
setNotice(messages().export.sending(i + 1, images.length));
|
|
87
|
+
await fileDelivery.downloadDataUrl(images[i], `${prefix}-${canvasType}-${messages().export.pageFile}-${i + 1}.${format === 'jpeg' ? 'jpg' : format}`);
|
|
88
|
+
sent = i + 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (pageErr) {
|
|
92
|
+
setNotice(sent === 0 ? null : messages().export.partlySent(sent));
|
|
93
|
+
throw pageErr;
|
|
94
|
+
}
|
|
95
|
+
setNotice(messages().export.allSent);
|
|
96
|
+
noticeTimer.current = setTimeout(() => setNotice(null), NOTICE_LIFETIME_MS);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
const message = err instanceof Error ? err.message : messages().errors.zipUnknown;
|
|
101
|
+
setError(message);
|
|
102
|
+
console.error('[useMultiPageExport] ZIP download failed:', err);
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
setIsExporting(false);
|
|
106
|
+
setExportProgress({ current: 0, total: 0 });
|
|
107
|
+
}
|
|
108
|
+
}, [canvasRefs, canvasType, exportAllPages, fileDelivery, prefix]);
|
|
109
|
+
return {
|
|
110
|
+
exportAllPages,
|
|
111
|
+
downloadAllAsZip,
|
|
112
|
+
isExporting,
|
|
113
|
+
exportProgress,
|
|
114
|
+
error,
|
|
115
|
+
notice,
|
|
116
|
+
};
|
|
117
|
+
}
|