@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,293 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Canvas icon utilities powered by bundled Iconify icon sets.
|
|
4
|
+
*
|
|
5
|
+
* Icons come from local `@iconify-json/*` sets (Tabler, Flowbite) — no network
|
|
6
|
+
* calls. Each set's data is lazy-imported the first time the picker or a canvas
|
|
7
|
+
* icon needs it, so each lands in its own chunk. SVGs are generated locally via
|
|
8
|
+
* `@iconify/utils`, colorized, and cached as base64 data URLs for rendering on
|
|
9
|
+
* the Konva canvas.
|
|
10
|
+
*/
|
|
11
|
+
import { addCollection } from '@iconify/react';
|
|
12
|
+
import { getIconData, iconToSVG } from '@iconify/utils';
|
|
13
|
+
import { externalIconDataUrl, externalIconDefs, externalIconsVersion, getExternalIcon, isExternalIconId, } from './externalIcons.js';
|
|
14
|
+
const ICON_SETS = [
|
|
15
|
+
{ prefix: 'tabler', library: 'Tabler', load: () => import('@iconify-json/tabler') },
|
|
16
|
+
{ prefix: 'flowbite', library: 'Flowbite', load: () => import('@iconify-json/flowbite') },
|
|
17
|
+
{ prefix: 'lucide', library: 'Lucide', load: () => import('@iconify-json/lucide') },
|
|
18
|
+
{ prefix: 'heroicons', library: 'Heroicons', load: () => import('@iconify-json/heroicons') },
|
|
19
|
+
{ prefix: 'iconoir', library: 'Iconoir', load: () => import('@iconify-json/iconoir') },
|
|
20
|
+
{ prefix: 'bi', library: 'Bootstrap Icons', load: () => import('@iconify-json/bi') },
|
|
21
|
+
{ prefix: 'ri', library: 'Remix Icon', load: () => import('@iconify-json/ri') },
|
|
22
|
+
];
|
|
23
|
+
/** Split a `prefix:name` id; unprefixed ids default to the first set. */
|
|
24
|
+
function splitIconId(iconId) {
|
|
25
|
+
const colon = iconId.indexOf(':');
|
|
26
|
+
if (colon === -1)
|
|
27
|
+
return { prefix: ICON_SETS[0].prefix, name: iconId };
|
|
28
|
+
return { prefix: iconId.slice(0, colon), name: iconId.slice(colon + 1) };
|
|
29
|
+
}
|
|
30
|
+
const toIconName = (iconId) => splitIconId(iconId).name;
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Per-set data loading (lazy dynamic import, registered with @iconify/react)
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
const setData = new Map();
|
|
35
|
+
const setPromises = new Map();
|
|
36
|
+
function loadIconSet(set) {
|
|
37
|
+
const existing = setData.get(set.prefix);
|
|
38
|
+
if (existing)
|
|
39
|
+
return Promise.resolve(existing);
|
|
40
|
+
const pending = setPromises.get(set.prefix);
|
|
41
|
+
if (pending)
|
|
42
|
+
return pending;
|
|
43
|
+
const promise = set
|
|
44
|
+
.load()
|
|
45
|
+
.then(({ icons }) => {
|
|
46
|
+
setData.set(set.prefix, icons);
|
|
47
|
+
// Register so <Icon icon="prefix:..."> in the sidebar renders offline.
|
|
48
|
+
addCollection(icons);
|
|
49
|
+
return icons;
|
|
50
|
+
})
|
|
51
|
+
.catch((err) => {
|
|
52
|
+
// Don't cache a rejected chunk load — clear it so a later call retries.
|
|
53
|
+
setPromises.delete(set.prefix);
|
|
54
|
+
throw err;
|
|
55
|
+
});
|
|
56
|
+
setPromises.set(set.prefix, promise);
|
|
57
|
+
return promise;
|
|
58
|
+
}
|
|
59
|
+
function loadSetByPrefix(prefix) {
|
|
60
|
+
const set = ICON_SETS.find((s) => s.prefix === prefix);
|
|
61
|
+
return set ? loadIconSet(set) : null;
|
|
62
|
+
}
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// Icon metadata loading (names only, no SVG data)
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
/** The set browsed by default when the picker opens (loads eagerly, alone). */
|
|
67
|
+
export const DEFAULT_ICON_SET = ICON_SETS[0].prefix;
|
|
68
|
+
// Per-set catalogs (names only). Each set is built lazily the first time it is
|
|
69
|
+
// browsed, so the picker's first open only pays for the default set.
|
|
70
|
+
const catalogBySet = new Map();
|
|
71
|
+
const catalogPromises = new Map();
|
|
72
|
+
let syncList = null;
|
|
73
|
+
let syncMap = null;
|
|
74
|
+
const formatName = (str) => str
|
|
75
|
+
.split('-')
|
|
76
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
77
|
+
.join(' ');
|
|
78
|
+
/** Recompute the combined sync views from all currently-loaded sets. */
|
|
79
|
+
function rebuildSyncViews() {
|
|
80
|
+
const list = [];
|
|
81
|
+
const map = {};
|
|
82
|
+
for (const { prefix } of ICON_SETS) {
|
|
83
|
+
const catalog = catalogBySet.get(prefix);
|
|
84
|
+
if (!catalog)
|
|
85
|
+
continue;
|
|
86
|
+
for (const def of catalog) {
|
|
87
|
+
list.push(def);
|
|
88
|
+
map[def.id] = def;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
list.sort((a, b) => a.name.localeCompare(b.name));
|
|
92
|
+
syncList = list;
|
|
93
|
+
syncMap = map;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build the browsable catalog for a single set (names only; SVG data is
|
|
97
|
+
* generated on demand). Cached; a failed load is not cached so it can retry.
|
|
98
|
+
*/
|
|
99
|
+
export function loadIconSetCatalog(prefix) {
|
|
100
|
+
const cached = catalogBySet.get(prefix);
|
|
101
|
+
if (cached)
|
|
102
|
+
return Promise.resolve(cached);
|
|
103
|
+
const pending = catalogPromises.get(prefix);
|
|
104
|
+
if (pending)
|
|
105
|
+
return pending;
|
|
106
|
+
const set = ICON_SETS.find((s) => s.prefix === prefix);
|
|
107
|
+
if (!set)
|
|
108
|
+
return Promise.resolve([]);
|
|
109
|
+
const promise = loadIconSet(set)
|
|
110
|
+
.then((data) => {
|
|
111
|
+
const names = [...Object.keys(data.icons), ...Object.keys(data.aliases ?? {})];
|
|
112
|
+
const list = names.map((name) => ({
|
|
113
|
+
id: `${set.prefix}:${name}`,
|
|
114
|
+
name: formatName(name),
|
|
115
|
+
library: set.library,
|
|
116
|
+
}));
|
|
117
|
+
list.sort((a, b) => a.name.localeCompare(b.name));
|
|
118
|
+
catalogBySet.set(set.prefix, list);
|
|
119
|
+
rebuildSyncViews();
|
|
120
|
+
return list;
|
|
121
|
+
})
|
|
122
|
+
.catch((err) => {
|
|
123
|
+
catalogPromises.delete(set.prefix);
|
|
124
|
+
throw err;
|
|
125
|
+
});
|
|
126
|
+
catalogPromises.set(set.prefix, promise);
|
|
127
|
+
return promise;
|
|
128
|
+
}
|
|
129
|
+
/** Synchronous per-set catalog lookup (null until that set has been loaded). */
|
|
130
|
+
export function getIconSetCatalogSync(prefix) {
|
|
131
|
+
return catalogBySet.get(prefix) ?? null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Load every set and return the combined catalog. Used by cross-set search —
|
|
135
|
+
* NOT on picker mount, so the common browse path only loads the default set.
|
|
136
|
+
*/
|
|
137
|
+
export function loadAllIcons() {
|
|
138
|
+
return Promise.all(ICON_SETS.map((s) => loadIconSetCatalog(s.prefix))).then(() => syncList ?? []);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Load the sets the given catalog ids belong to. A document's icons can come
|
|
142
|
+
* from any set, but only the default set loads with the sidebar — without this
|
|
143
|
+
* an icon from another set draws nothing until someone opens the icon search.
|
|
144
|
+
*/
|
|
145
|
+
export function loadIconSetsFor(iconIds) {
|
|
146
|
+
const prefixes = new Set(iconIds.map((id) => splitIconId(id).prefix));
|
|
147
|
+
return Promise.all([...prefixes]
|
|
148
|
+
.filter((prefix) => !catalogBySet.has(prefix))
|
|
149
|
+
.map((prefix) => loadIconSetCatalog(prefix).catch(() => []))).then(() => undefined);
|
|
150
|
+
}
|
|
151
|
+
/** Are the sets of these catalog ids loaded, so the sync map can resolve them? */
|
|
152
|
+
export function iconSetsLoaded(iconIds) {
|
|
153
|
+
// An icon from the host's search needs no set: its SVG lives in the document.
|
|
154
|
+
return iconIds.every((id) => isExternalIconId(id) || catalogBySet.has(splitIconId(id).prefix));
|
|
155
|
+
}
|
|
156
|
+
export function getIconsSync() {
|
|
157
|
+
return syncList;
|
|
158
|
+
}
|
|
159
|
+
let mergedMap = null;
|
|
160
|
+
/** The bundled catalog plus the icons placed from the host's search. */
|
|
161
|
+
export function getIconMapSync() {
|
|
162
|
+
const version = externalIconsVersion();
|
|
163
|
+
const external = externalIconDefs();
|
|
164
|
+
if (Object.keys(external).length === 0)
|
|
165
|
+
return syncMap;
|
|
166
|
+
if (mergedMap?.bundled !== syncMap || mergedMap.version !== version) {
|
|
167
|
+
mergedMap = { bundled: syncMap, version, map: { ...syncMap, ...external } };
|
|
168
|
+
}
|
|
169
|
+
return mergedMap.map;
|
|
170
|
+
}
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// SVG data URL generation (renders Tabler SVG locally on demand)
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
const dataUrlCache = new Map();
|
|
175
|
+
const pendingFetches = new Map();
|
|
176
|
+
/**
|
|
177
|
+
* Render a Tabler icon to a colorized base64 SVG data URL.
|
|
178
|
+
* Results are cached to avoid redundant work.
|
|
179
|
+
*/
|
|
180
|
+
export async function generateIconDataUrl(iconId, size = 64, color = '#ffffff') {
|
|
181
|
+
const cacheKey = `${iconId}-${size}-${color}`;
|
|
182
|
+
const cached = dataUrlCache.get(cacheKey);
|
|
183
|
+
if (cached)
|
|
184
|
+
return cached;
|
|
185
|
+
// Deduplicate in-flight work for the same icon+size+color
|
|
186
|
+
const pending = pendingFetches.get(cacheKey);
|
|
187
|
+
if (pending)
|
|
188
|
+
return pending;
|
|
189
|
+
const promise = (async () => {
|
|
190
|
+
try {
|
|
191
|
+
if (isExternalIconId(iconId)) {
|
|
192
|
+
const external = getExternalIcon(iconId);
|
|
193
|
+
if (!external)
|
|
194
|
+
return null;
|
|
195
|
+
const dataUrl = externalIconDataUrl(external.svg, size, color);
|
|
196
|
+
dataUrlCache.set(cacheKey, dataUrl);
|
|
197
|
+
return dataUrl;
|
|
198
|
+
}
|
|
199
|
+
const { prefix, name } = splitIconId(iconId);
|
|
200
|
+
const setPromise = loadSetByPrefix(prefix);
|
|
201
|
+
if (!setPromise)
|
|
202
|
+
return null;
|
|
203
|
+
const data = await setPromise;
|
|
204
|
+
const iconData = getIconData(data, name);
|
|
205
|
+
if (!iconData)
|
|
206
|
+
return null;
|
|
207
|
+
const rendered = iconToSVG(iconData, { height: size });
|
|
208
|
+
const attributes = Object.entries(rendered.attributes)
|
|
209
|
+
.map(([key, value]) => `${key}="${value}"`)
|
|
210
|
+
.join(' ');
|
|
211
|
+
// Iconify sets use currentColor for stroke/fill — bake the color in.
|
|
212
|
+
const body = rendered.body.replace(/currentColor/g, color);
|
|
213
|
+
const svgText = `<svg xmlns="http://www.w3.org/2000/svg" ${attributes}>${body}</svg>`;
|
|
214
|
+
const dataUrl = `data:image/svg+xml;base64,${btoa(svgText)}`;
|
|
215
|
+
dataUrlCache.set(cacheKey, dataUrl);
|
|
216
|
+
return dataUrl;
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
finally {
|
|
222
|
+
pendingFetches.delete(cacheKey);
|
|
223
|
+
}
|
|
224
|
+
})();
|
|
225
|
+
pendingFetches.set(cacheKey, promise);
|
|
226
|
+
return promise;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Synchronous data URL lookup. Returns cached value or null if not yet built.
|
|
230
|
+
* Use generateIconDataUrl() to trigger generation.
|
|
231
|
+
*/
|
|
232
|
+
export function getIconDataUrlSync(iconId, size = 64, color = '#ffffff') {
|
|
233
|
+
return dataUrlCache.get(`${iconId}-${size}-${color}`) ?? null;
|
|
234
|
+
}
|
|
235
|
+
export async function searchIcons(query, limit = 64) {
|
|
236
|
+
const trimmed = query.trim().toLowerCase();
|
|
237
|
+
if (!trimmed)
|
|
238
|
+
return { icons: [], total: 0 };
|
|
239
|
+
const all = await loadAllIcons();
|
|
240
|
+
// Match the bare icon name (e.g. "heart-filled"), NOT the full id — every id
|
|
241
|
+
// shares the "tabler:" prefix, so matching the id would return the whole
|
|
242
|
+
// catalog for any query that is a substring of "tabler:".
|
|
243
|
+
const matches = all.filter((icon) => icon.name.toLowerCase().includes(trimmed) || toIconName(icon.id).includes(trimmed));
|
|
244
|
+
return { icons: matches.slice(0, limit), total: matches.length };
|
|
245
|
+
}
|
|
246
|
+
// ---------------------------------------------------------------------------
|
|
247
|
+
// Canvas icon building (same interface as before)
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
const DEFAULT_POSITIONS = [
|
|
250
|
+
{ x: 100, y: 100 },
|
|
251
|
+
{ x: 200, y: 100 },
|
|
252
|
+
{ x: 300, y: 100 },
|
|
253
|
+
];
|
|
254
|
+
export async function buildCanvasIcons(selectedIconIds, existingIcons = [], defaultColor = '#ffffff', defaultSize = 64, stageWidth = 1080, stageHeight = 1080) {
|
|
255
|
+
const result = [];
|
|
256
|
+
for (let index = 0; index < selectedIconIds.length; index++) {
|
|
257
|
+
const iconId = selectedIconIds[index];
|
|
258
|
+
const existing = existingIcons.find((i) => i.iconId === iconId);
|
|
259
|
+
if (existing) {
|
|
260
|
+
result.push(existing);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
const dataUrl = await generateIconDataUrl(iconId, defaultSize * 2, defaultColor);
|
|
264
|
+
if (dataUrl) {
|
|
265
|
+
const defaultPos = DEFAULT_POSITIONS[index] || {
|
|
266
|
+
x: stageWidth / 2 - defaultSize / 2,
|
|
267
|
+
y: stageHeight / 2 - defaultSize / 2,
|
|
268
|
+
};
|
|
269
|
+
result.push({
|
|
270
|
+
id: `icon-${iconId}-${Date.now()}`,
|
|
271
|
+
iconId,
|
|
272
|
+
dataUrl,
|
|
273
|
+
x: defaultPos.x,
|
|
274
|
+
y: defaultPos.y,
|
|
275
|
+
size: defaultSize,
|
|
276
|
+
color: defaultColor,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return result;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* @deprecated Use `loadAllIcons()` + `getIconsSync()` instead.
|
|
285
|
+
*/
|
|
286
|
+
export const ALL_ICONS = new Proxy([], {
|
|
287
|
+
get(target, prop) {
|
|
288
|
+
if (syncList && prop !== 'constructor') {
|
|
289
|
+
return Reflect.get(syncList, prop);
|
|
290
|
+
}
|
|
291
|
+
return Reflect.get(target, prop);
|
|
292
|
+
},
|
|
293
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CanvasImageUrlService } from '../hostServices.js';
|
|
2
|
+
/**
|
|
3
|
+
* Pick the source an image element renders from.
|
|
4
|
+
*
|
|
5
|
+
* The host's variant (`previewWidth` px) is export-quality at the UI's max
|
|
6
|
+
* export scale while the element draws at most half as wide: the coverFit crop
|
|
7
|
+
* is stretched to the element's box, so a wider box needs more source pixels
|
|
8
|
+
* than the variant holds. Wider boxes (zoomed-in backgrounds with imageScale
|
|
9
|
+
* up to 3x, or resized elements) load the original instead, so exports stay as
|
|
10
|
+
* sharp as the stored image.
|
|
11
|
+
*/
|
|
12
|
+
export declare function canvasImageSourceUrl(url: string | undefined, boxWidth: number, urls: CanvasImageUrlService): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The download UI offers 1x/2x export (TopBar/DownloadSection.tsx SCALE_OPTIONS). */
|
|
2
|
+
const EXPORT_PIXEL_RATIO = 2;
|
|
3
|
+
/**
|
|
4
|
+
* Pick the source an image element renders from.
|
|
5
|
+
*
|
|
6
|
+
* The host's variant (`previewWidth` px) is export-quality at the UI's max
|
|
7
|
+
* export scale while the element draws at most half as wide: the coverFit crop
|
|
8
|
+
* is stretched to the element's box, so a wider box needs more source pixels
|
|
9
|
+
* than the variant holds. Wider boxes (zoomed-in backgrounds with imageScale
|
|
10
|
+
* up to 3x, or resized elements) load the original instead, so exports stay as
|
|
11
|
+
* sharp as the stored image.
|
|
12
|
+
*/
|
|
13
|
+
export function canvasImageSourceUrl(url, boxWidth, urls) {
|
|
14
|
+
if (!url)
|
|
15
|
+
return url;
|
|
16
|
+
return boxWidth * EXPORT_PIXEL_RATIO <= urls.previewWidth
|
|
17
|
+
? urls.previewUrl(url)
|
|
18
|
+
: urls.originalUrl(url);
|
|
19
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { AssetInstance } from './canvasAssets.js';
|
|
2
|
+
import type { AdditionalText, CanvasElementConfig } from '../configs/types.js';
|
|
3
|
+
import type { ChartInstance } from '@ggraphic/editor/utils/chartTypes';
|
|
4
|
+
import type { CircleBadgeInstance } from '@ggraphic/editor/utils/circleBadgeUtils';
|
|
5
|
+
import type { FrameInstance } from '@ggraphic/editor/utils/frameUtils';
|
|
6
|
+
import type { IllustrationInstance } from '@ggraphic/editor/utils/illustrations/types';
|
|
7
|
+
import type { PillBadgeInstance } from '@ggraphic/editor/utils/pillBadgeUtils';
|
|
8
|
+
import type { ShapeInstance } from '@ggraphic/editor/utils/shapes';
|
|
9
|
+
import type { UserImageInstance } from '@ggraphic/editor/utils/userImageUtils';
|
|
10
|
+
/**
|
|
11
|
+
* The element kinds a host adds to the core's. Empty in the core; a host
|
|
12
|
+
* augments it (`declare module '@ggraphic/editor/utils/canvasItem'`) with one
|
|
13
|
+
* entry per kind: where its list lives in the canvas state (`stateKey`), one
|
|
14
|
+
* instance (`data`) and, when a tile or a drop can add one, the fields that
|
|
15
|
+
* tile carries next to `kind` (`payload`). The runtime half, what the editor
|
|
16
|
+
* does with the kind, is `registerElementKind` in `elementKinds.ts`.
|
|
17
|
+
*/
|
|
18
|
+
export interface HostElementKinds {
|
|
19
|
+
}
|
|
20
|
+
/** The kinds a host registered; `never` without a host. */
|
|
21
|
+
export type HostElementKindName = Extract<keyof HostElementKinds, string>;
|
|
22
|
+
/** One instance of a host kind. */
|
|
23
|
+
export type HostElementData<K extends HostElementKindName> = HostElementKinds[K] extends {
|
|
24
|
+
data: infer TData;
|
|
25
|
+
} ? TData : never;
|
|
26
|
+
/** Where a host kind's list lives in the canvas state. */
|
|
27
|
+
export type HostElementStateKey<K extends HostElementKindName> = HostElementKinds[K] extends {
|
|
28
|
+
stateKey: infer TKey extends string;
|
|
29
|
+
} ? TKey : never;
|
|
30
|
+
/** The fields of a tile or drop that adds a host kind, next to its `kind`. */
|
|
31
|
+
export type HostElementPayload<K extends HostElementKindName> = HostElementKinds[K] extends {
|
|
32
|
+
payload: infer TPayload extends object;
|
|
33
|
+
} ? TPayload : never;
|
|
34
|
+
/**
|
|
35
|
+
* A host kind's list in the canvas state, by its `stateKey`. Spelled over
|
|
36
|
+
* `keyof` directly: through the helpers above, an empty `HostElementKinds`
|
|
37
|
+
* would map to a string index signature.
|
|
38
|
+
*/
|
|
39
|
+
export type HostElementState = {
|
|
40
|
+
[K in keyof HostElementKinds as HostElementKinds[K] extends {
|
|
41
|
+
stateKey: infer TKey extends string;
|
|
42
|
+
} ? TKey : never]: HostElementKinds[K] extends {
|
|
43
|
+
data: infer TData;
|
|
44
|
+
} ? TData[] : never;
|
|
45
|
+
};
|
|
46
|
+
/** One placed instance of a host kind in the layer list. */
|
|
47
|
+
export type HostCanvasItem = {
|
|
48
|
+
[K in HostElementKindName]: {
|
|
49
|
+
id: string;
|
|
50
|
+
type: K;
|
|
51
|
+
data: HostElementData<K>;
|
|
52
|
+
};
|
|
53
|
+
}[HostElementKindName];
|
|
54
|
+
/**
|
|
55
|
+
* One item of a page's layer list. Its own module so the element-kind
|
|
56
|
+
* registry (`elementKinds.ts`) can name it without importing the layer
|
|
57
|
+
* manager, which imports the registry.
|
|
58
|
+
*/
|
|
59
|
+
export type CanvasItem = {
|
|
60
|
+
id: string;
|
|
61
|
+
type: 'element';
|
|
62
|
+
data: CanvasElementConfig;
|
|
63
|
+
} | {
|
|
64
|
+
id: string;
|
|
65
|
+
type: 'icon';
|
|
66
|
+
} | {
|
|
67
|
+
id: string;
|
|
68
|
+
type: 'shape';
|
|
69
|
+
data: ShapeInstance;
|
|
70
|
+
} | {
|
|
71
|
+
id: string;
|
|
72
|
+
type: 'frame';
|
|
73
|
+
data: FrameInstance;
|
|
74
|
+
} | {
|
|
75
|
+
id: string;
|
|
76
|
+
type: 'additional-text';
|
|
77
|
+
data: AdditionalText;
|
|
78
|
+
} | {
|
|
79
|
+
id: string;
|
|
80
|
+
type: 'illustration';
|
|
81
|
+
data: IllustrationInstance;
|
|
82
|
+
} | {
|
|
83
|
+
id: string;
|
|
84
|
+
type: 'asset';
|
|
85
|
+
data: AssetInstance;
|
|
86
|
+
} | {
|
|
87
|
+
id: string;
|
|
88
|
+
type: 'circle-badge';
|
|
89
|
+
data: CircleBadgeInstance;
|
|
90
|
+
} | {
|
|
91
|
+
id: string;
|
|
92
|
+
type: 'pill-badge';
|
|
93
|
+
data: PillBadgeInstance;
|
|
94
|
+
} | {
|
|
95
|
+
id: string;
|
|
96
|
+
type: 'user-image';
|
|
97
|
+
data: UserImageInstance;
|
|
98
|
+
} | {
|
|
99
|
+
id: string;
|
|
100
|
+
type: 'chart';
|
|
101
|
+
data: ChartInstance;
|
|
102
|
+
} | HostCanvasItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AssetInstance } from './canvasAssets.js';
|
|
2
|
+
import type { CanvasItem } from './canvasItem.js';
|
|
3
|
+
import type { AdditionalText, FullCanvasConfig } from '../configs/types.js';
|
|
4
|
+
import type { ChartInstance } from '@ggraphic/editor/utils/chartTypes';
|
|
5
|
+
import type { CircleBadgeInstance } from '@ggraphic/editor/utils/circleBadgeUtils';
|
|
6
|
+
import type { FrameInstance } from '@ggraphic/editor/utils/frameUtils';
|
|
7
|
+
import type { IllustrationInstance } from '@ggraphic/editor/utils/illustrations/types';
|
|
8
|
+
import type { PillBadgeInstance } from '@ggraphic/editor/utils/pillBadgeUtils';
|
|
9
|
+
import type { ShapeInstance } from '@ggraphic/editor/utils/shapes';
|
|
10
|
+
import type { UserImageInstance } from '@ggraphic/editor/utils/userImageUtils';
|
|
11
|
+
/**
|
|
12
|
+
* Canvas Layer Manager - Utilities for managing layer ordering
|
|
13
|
+
*
|
|
14
|
+
* Handles the construction and manipulation of canvas element layers.
|
|
15
|
+
* Elements are rendered in order: config elements, then the kinds of `ELEMENT_KINDS`.
|
|
16
|
+
*/
|
|
17
|
+
export type { CanvasItem };
|
|
18
|
+
interface StateWithFeatures {
|
|
19
|
+
selectedIcons?: string[];
|
|
20
|
+
shapeInstances?: ShapeInstance[];
|
|
21
|
+
additionalTexts?: AdditionalText[];
|
|
22
|
+
illustrationInstances?: IllustrationInstance[];
|
|
23
|
+
assetInstances?: AssetInstance[];
|
|
24
|
+
frameInstances?: FrameInstance[];
|
|
25
|
+
circleBadgeInstances?: CircleBadgeInstance[];
|
|
26
|
+
pillBadgeInstances?: PillBadgeInstance[];
|
|
27
|
+
userImageInstances?: UserImageInstance[];
|
|
28
|
+
chartInstances?: ChartInstance[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build flat list of all canvas items in default order
|
|
32
|
+
*
|
|
33
|
+
* Default order: the config elements (sorted by their `order` property), then
|
|
34
|
+
* the host's kinds (`registerElementKind`), then every kind in the order of
|
|
35
|
+
* `ELEMENT_KINDS`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildCanvasItems<TState extends StateWithFeatures = StateWithFeatures, TActions = Record<string, unknown>>(config: FullCanvasConfig<TState, TActions>, state: TState): CanvasItem[];
|
|
38
|
+
/**
|
|
39
|
+
* Sort items by layerOrder array
|
|
40
|
+
*
|
|
41
|
+
* Items in layerOrder are rendered in that order.
|
|
42
|
+
* Items not in layerOrder keep their default position: user-added ones are
|
|
43
|
+
* appended on top, background planes go to the back.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildSortedRenderList(items: CanvasItem[], layerOrder: string[]): CanvasItem[];
|
|
46
|
+
export type LayerStep = 'front' | 'forward' | 'backward' | 'back';
|
|
47
|
+
/** Wie viele Hintergrund-Ebenen zuunterst liegen. */
|
|
48
|
+
export declare function backgroundFloor(items: readonly CanvasItem[]): number;
|
|
49
|
+
/** Die Zeichenfolge nach dem Schritt; unverändert, wenn er nichts bewegt. */
|
|
50
|
+
export declare function moveLayerTo(items: readonly CanvasItem[], id: string, step: LayerStep): string[];
|
|
51
|
+
export declare function canMoveLayer(items: readonly CanvasItem[], id: string, step: LayerStep): boolean;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { ELEMENT_KINDS, hostElementKinds, kindItem, kindList } from './elementKinds.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build flat list of all canvas items in default order
|
|
5
|
+
*
|
|
6
|
+
* Default order: the config elements (sorted by their `order` property), then
|
|
7
|
+
* the host's kinds (`registerElementKind`), then every kind in the order of
|
|
8
|
+
* `ELEMENT_KINDS`.
|
|
9
|
+
*/
|
|
10
|
+
export function buildCanvasItems(config, state) {
|
|
11
|
+
const items = [];
|
|
12
|
+
// 1. Config Elements (sorted by order property)
|
|
13
|
+
const sortedConfigElements = [...config.elements].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
14
|
+
// Widen TState parameter for the union: CanvasElementConfig<TState> is invariant
|
|
15
|
+
// in TState, but the consumer (memo'd GenericCanvasElement) re-infers TState from
|
|
16
|
+
// the state prop, so widening here is safe.
|
|
17
|
+
sortedConfigElements.forEach((el) => items.push({ id: el.id, type: 'element', data: el }));
|
|
18
|
+
// 2. The host's kinds in registration order, then every core kind in the
|
|
19
|
+
// order `ELEMENT_KINDS` lists them.
|
|
20
|
+
for (const { kind, stateKey } of [...hostElementKinds(), ...ELEMENT_KINDS]) {
|
|
21
|
+
for (const entry of kindList(state, stateKey))
|
|
22
|
+
items.push(kindItem(kind, entry));
|
|
23
|
+
}
|
|
24
|
+
return items;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A config element that declares a negative `order` is a background plane: the
|
|
28
|
+
* solid colour, the photo over it, the contrast scrim. It says "behind
|
|
29
|
+
* everything" in the only vocabulary the config has.
|
|
30
|
+
*/
|
|
31
|
+
function isBackgroundPlane(item) {
|
|
32
|
+
return item.type === 'element' && (item.data.order ?? 0) < 0;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sort items by layerOrder array
|
|
36
|
+
*
|
|
37
|
+
* Items in layerOrder are rendered in that order.
|
|
38
|
+
* Items not in layerOrder keep their default position: user-added ones are
|
|
39
|
+
* appended on top, background planes go to the back.
|
|
40
|
+
*/
|
|
41
|
+
export function buildSortedRenderList(items, layerOrder) {
|
|
42
|
+
const pendingItems = [...items];
|
|
43
|
+
const result = [];
|
|
44
|
+
// 1. Add items that are in layerOrder, in that order
|
|
45
|
+
layerOrder.forEach((id) => {
|
|
46
|
+
const idx = pendingItems.findIndex((item) => item.id === id);
|
|
47
|
+
if (idx !== -1) {
|
|
48
|
+
result.push(pendingItems[idx]);
|
|
49
|
+
pendingItems.splice(idx, 1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
// 2. What is left is untracked, and there are two reasons for that. A shape
|
|
53
|
+
// the user just added belongs on top — appending is right. A background
|
|
54
|
+
// plane the template gained AFTER this layerOrder was saved does not:
|
|
55
|
+
// appending would paint a full-bleed rect over the finished sharepic and
|
|
56
|
+
// the document would open as a solid colour. So those go to the front, in
|
|
57
|
+
// their declared order, and everything else keeps appending.
|
|
58
|
+
const behind = pendingItems.filter(isBackgroundPlane);
|
|
59
|
+
behind.sort((a, b) => {
|
|
60
|
+
const ao = a.type === 'element' ? (a.data.order ?? 0) : 0;
|
|
61
|
+
const bo = b.type === 'element' ? (b.data.order ?? 0) : 0;
|
|
62
|
+
return ao - bo;
|
|
63
|
+
});
|
|
64
|
+
const onTop = pendingItems.filter((item) => !isBackgroundPlane(item));
|
|
65
|
+
return [...behind, ...result, ...onTop];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Wohin `id` mit diesem Schritt in der Zeichenfolge rückt (hinten → vorn).
|
|
69
|
+
* Unter die Hintergrund-Ebenen am Anfang der Liste geht es nicht: dort
|
|
70
|
+
* verschwand ein Element bisher hinter der vollflächigen Farbe.
|
|
71
|
+
*/
|
|
72
|
+
function layerTarget(ids, id, step, floor) {
|
|
73
|
+
const from = ids.indexOf(id);
|
|
74
|
+
if (from === -1)
|
|
75
|
+
return null;
|
|
76
|
+
const min = Math.min(floor, from);
|
|
77
|
+
const max = ids.length - 1;
|
|
78
|
+
const to = step === 'front'
|
|
79
|
+
? max
|
|
80
|
+
: step === 'back'
|
|
81
|
+
? min
|
|
82
|
+
: step === 'forward'
|
|
83
|
+
? Math.min(from + 1, max)
|
|
84
|
+
: Math.max(from - 1, min);
|
|
85
|
+
return { from, to };
|
|
86
|
+
}
|
|
87
|
+
/** Wie viele Hintergrund-Ebenen zuunterst liegen. */
|
|
88
|
+
export function backgroundFloor(items) {
|
|
89
|
+
let floor = 0;
|
|
90
|
+
while (floor < items.length && isBackgroundPlane(items[floor]))
|
|
91
|
+
floor++;
|
|
92
|
+
return floor;
|
|
93
|
+
}
|
|
94
|
+
/** Die Zeichenfolge nach dem Schritt; unverändert, wenn er nichts bewegt. */
|
|
95
|
+
export function moveLayerTo(items, id, step) {
|
|
96
|
+
const ids = items.map((item) => item.id);
|
|
97
|
+
const target = layerTarget(ids, id, step, backgroundFloor(items));
|
|
98
|
+
if (!target || target.from === target.to)
|
|
99
|
+
return ids;
|
|
100
|
+
ids.splice(target.from, 1);
|
|
101
|
+
ids.splice(target.to, 0, id);
|
|
102
|
+
return ids;
|
|
103
|
+
}
|
|
104
|
+
export function canMoveLayer(items, id, step) {
|
|
105
|
+
const target = layerTarget(items.map((item) => item.id), id, step, backgroundFloor(items));
|
|
106
|
+
return target !== null && target.from !== target.to;
|
|
107
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LayoutResult } from '../configs/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a value that can be either static or a function
|
|
4
|
+
*
|
|
5
|
+
* Config values can be static (e.g., x: 50) or dynamic functions
|
|
6
|
+
* (e.g., x: (state, layout) => layout.centerX).
|
|
7
|
+
* This utility resolves both cases uniformly.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveValue<T, TState extends Record<string, unknown>>(value: T | ((state: TState, layout: LayoutResult) => T), state: TState, layout: LayoutResult): T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a value that can be either static or a function
|
|
3
|
+
*
|
|
4
|
+
* Config values can be static (e.g., x: 50) or dynamic functions
|
|
5
|
+
* (e.g., x: (state, layout) => layout.centerX).
|
|
6
|
+
* This utility resolves both cases uniformly.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveValue(value, state, layout) {
|
|
9
|
+
if (typeof value === 'function') {
|
|
10
|
+
return value(state, layout);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CanvasStageRef } from '../primitives/CanvasStage.js';
|
|
2
|
+
import type { ExportOptions } from '@ggraphic/editor/types/editorTypes';
|
|
3
|
+
import type Konva from 'konva';
|
|
4
|
+
/** Konva node name of what the editor shows but no export contains. */
|
|
5
|
+
export declare const EXPORT_HIDDEN_NAME = "export-hidden";
|
|
6
|
+
/**
|
|
7
|
+
* Runs `capture` with all selection chrome on the stage hidden — Konva
|
|
8
|
+
* Transformers plus the dashed selection Rects primitives render alongside
|
|
9
|
+
* them (tagged `name="selection-chrome"`). Callers don't have to mutate the
|
|
10
|
+
* user's selection (or wait for a deselect re-render) to get a clean shot;
|
|
11
|
+
* exactly the nodes that were hidden are restored.
|
|
12
|
+
*
|
|
13
|
+
* Nodes named `export-hidden` (the placeholder of an empty photo slot) are
|
|
14
|
+
* hidden too: every capture is an export unless it says it is a preview with
|
|
15
|
+
* `keepPlaceholders`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withSelectionChromeHidden<T>(stage: Konva.Stage | null, capture: () => T, { keepPlaceholders }?: {
|
|
18
|
+
keepPlaceholders?: boolean;
|
|
19
|
+
}): T;
|
|
20
|
+
/**
|
|
21
|
+
* The one stage-image capture used by auto-save (debounced and unmount
|
|
22
|
+
* flush), the imperative captureCanvas/captureCanvasForAi handles, and any
|
|
23
|
+
* future export path. Never throws; returns null when the stage is gone
|
|
24
|
+
* (e.g. capture during teardown).
|
|
25
|
+
*
|
|
26
|
+
* Hiding the selection chrome is CanvasStage.toDataURL's job — every export
|
|
27
|
+
* goes through it, so wrapping again here would only be a no-op.
|
|
28
|
+
*/
|
|
29
|
+
export declare function captureStageImage(stageApi: CanvasStageRef | null, options?: Partial<ExportOptions>): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* captureStageImage without the synchronous encode: the scene is rendered on
|
|
32
|
+
* the spot, the PNG is encoded off the main thread. For captures that nobody
|
|
33
|
+
* waits on frame-by-frame (gallery snapshots, share, multi-page export).
|
|
34
|
+
*/
|
|
35
|
+
export declare function captureStageImageAsync(stageApi: CanvasStageRef | null, options?: Partial<ExportOptions>): Promise<string | null>;
|
|
36
|
+
/**
|
|
37
|
+
* One element alone as PNG, for the PPTX export: the `canvas-item` group
|
|
38
|
+
* `CanvasRenderLayer` wraps around it, rendered over its axis-aligned box.
|
|
39
|
+
* Rotation, opacity and shadow are in the picture; the box comes back in
|
|
40
|
+
* page px (the stage is shown scaled). Null when no group carries the id
|
|
41
|
+
* or the canvas cannot be read (cross-origin image).
|
|
42
|
+
*/
|
|
43
|
+
export declare function rasterizeStageElement(stage: Konva.Stage | null, elementId: string, pixelRatio?: number): {
|
|
44
|
+
dataUrl: string;
|
|
45
|
+
box: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
};
|
|
51
|
+
} | null;
|
|
52
|
+
/**
|
|
53
|
+
* The texts a page shows, one entry per text element, roughly in reading
|
|
54
|
+
* order (top to bottom, then left to right). A rich text block draws one node
|
|
55
|
+
* per run; its runs are joined back into the block's text (the runs keep
|
|
56
|
+
* their spaces, so they join without a separator). Selection chrome
|
|
57
|
+
* and hidden nodes are skipped — the same view an export shows.
|
|
58
|
+
*/
|
|
59
|
+
export declare function visibleStageTexts(stage: Konva.Stage | null): string[];
|