@ggraphic/editor 0.0.0-stage → 0.0.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 +18 -0
- package/dist/brand/brandRegistry.js +41 -0
- package/dist/brand/composerBrand.d.ts +146 -0
- package/dist/brand/composerBrand.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 +1138 -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 +525 -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 +80 -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 +780 -0
- package/dist/components/GenericCanvasElement.d.ts +34 -0
- package/dist/components/GenericCanvasElement.js +267 -0
- package/dist/components/MobileSelectionPill.d.ts +40 -0
- package/dist/components/MobileSelectionPill.js +85 -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 +212 -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 +123 -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 +319 -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 +87 -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/FloatingGradientControl.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingGradientControl.js +35 -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/FloatingOutlineControl.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingOutlineControl.js +31 -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/FloatingShadowControl.d.ts +12 -0
- package/dist/components/TopBar/modules/FloatingShadowControl.js +40 -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 +19 -0
- package/dist/components/markerMark.js +26 -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 +172 -0
- package/dist/configs/factory/actionFactories.js +611 -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 +420 -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 +44 -0
- package/dist/export/pptx/buildPptxModel.js +612 -0
- package/dist/export/pptx/exportPptxDeck.d.ts +23 -0
- package/dist/export/pptx/exportPptxDeck.js +77 -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 +13 -0
- package/dist/export/pptx/textModel.js +115 -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 +895 -0
- package/dist/i18n/de.js +959 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +948 -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 +281 -0
- package/dist/primitives/CanvasStage.d.ts +84 -0
- package/dist/primitives/CanvasStage.js +291 -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 +494 -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 +75 -0
- package/dist/sidebar/sections/CombinedTextSection.d.ts +16 -0
- package/dist/sidebar/sections/CombinedTextSection.js +42 -0
- package/dist/sidebar/sections/DiagrammeSection.d.ts +9 -0
- package/dist/sidebar/sections/DiagrammeSection.js +41 -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 +26 -0
- package/dist/sidebar/sections/FormenSection.js +428 -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 +32 -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 +84 -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 +59 -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 +42 -0
- package/dist/sidebar/sections/assets/useElementCatalog.js +371 -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 +32 -0
- package/dist/sidebar/sections/effects/OutlineSettings.d.ts +12 -0
- package/dist/sidebar/sections/effects/OutlineSettings.js +28 -0
- package/dist/sidebar/sections/effects/ShadowSettings.d.ts +13 -0
- package/dist/sidebar/sections/effects/ShadowSettings.js +37 -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 +85 -0
- package/dist/sidebar/sections/tools/GradientTextTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/GradientTextTool.js +102 -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 +123 -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 +149 -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/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/balkenUtils.d.ts +22 -0
- package/dist/utils/balkenUtils.js +8 -0
- package/dist/utils/canvasAssets.d.ts +134 -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 +28 -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 +2 -0
- package/dist/utils/colorNames.js +8 -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 +25 -0
- package/dist/utils/fontMarkSupport.js +26 -0
- package/dist/utils/frameUtils.d.ts +19 -0
- package/dist/utils/frameUtils.js +282 -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 +24 -0
- package/dist/utils/illustrations/registry.js +104 -0
- package/dist/utils/illustrations/svgCache.d.ts +60 -0
- package/dist/utils/illustrations/svgCache.js +342 -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 +92 -0
- package/dist/utils/imageFilters.js +303 -0
- package/dist/utils/imageLook.d.ts +16 -0
- package/dist/utils/imageLook.js +39 -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 +23 -0
- package/dist/utils/markerBoxes.js +73 -0
- package/dist/utils/markerColors.d.ts +9 -0
- package/dist/utils/markerColors.js +39 -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 +22 -0
- package/dist/utils/photoPlaceholder.js +36 -0
- package/dist/utils/pillBadgeUtils.d.ts +40 -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 +62 -0
- package/dist/utils/shapes.js +836 -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 +250 -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 +8 -0
- package/dist/utils/zipPageImages.js +29 -0
- package/package.json +105 -3
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useRef, useEffect, useState, memo } from 'react';
|
|
4
|
+
import { Rect, Circle, RegularPolygon, Star, Path, Ellipse, Ring, Line, Arrow, Shape, Transformer, } from 'react-konva';
|
|
5
|
+
import { LOCKED_TRANSFORMER, useIsItemLocked } from '@ggraphic/editor/components/canvasItemLock';
|
|
6
|
+
import { useBoxSnap } from '@ggraphic/editor/hooks/useBoxSnap';
|
|
7
|
+
import { gradientFillProps } from '@ggraphic/editor/utils/gradientFill';
|
|
8
|
+
import { translucentHitFunc } from '@ggraphic/editor/utils/gradientHitArea';
|
|
9
|
+
import { handDrawnPath } from '@ggraphic/editor/utils/handDrawn';
|
|
10
|
+
import { sameCorners } from '../utils/cornerRadius.js';
|
|
11
|
+
import { paintDots, paintGrain, paintStripes } from '../utils/grain.js';
|
|
12
|
+
import { notchPx, traceNotch } from '../utils/notch.js';
|
|
13
|
+
import { arrowPoints, ringGeometry, tailOf, traceBubble } from '../utils/shapeDevices.js';
|
|
14
|
+
import { cornersOf } from '../utils/cornerRadius.js';
|
|
15
|
+
import { ELEMENT_TRANSFORMER, MIRROR_X_ATTR, nodeRotation, signedScale, } from '@ggraphic/editor/utils/orientation';
|
|
16
|
+
import { glowGradient, shapeGradient } from '@ggraphic/editor/utils/shade';
|
|
17
|
+
import { assertNever, isComposerPlane, STROKE_ONLY_SHAPES, } from '@ggraphic/editor/utils/shapes';
|
|
18
|
+
import { PATH_OFFSETS, PATH_VIEWBOX, resizedShapeSize, shapeNodeScale, } from '@ggraphic/editor/utils/shapeTransform';
|
|
19
|
+
import { shapeBox } from '../utils/renderedBoxes.js';
|
|
20
|
+
const SHAPE_PATHS = {
|
|
21
|
+
arrow: 'M0,20 L50,20 L50,0 L100,50 L50,100 L50,80 L0,80 Z',
|
|
22
|
+
heart: 'M50,90 C50,90 10,70 10,40 C10,15 30,5 50,30 C70,5 90,15 90,40 C90,70 50,90 50,90 Z',
|
|
23
|
+
cloud: 'M25,60 C10,60 0,50 0,35 C0,20 15,10 25,15 C30,5 45,0 60,5 C75,10 80,20 80,25 C90,25 100,35 100,50 C100,65 85,75 70,70 C60,80 35,80 25,60 Z',
|
|
24
|
+
chevron: 'M20,10 L40,10 L80,50 L40,90 L20,90 L60,50 Z',
|
|
25
|
+
'double-arrow': 'M0,50 L25,20 L25,40 L75,40 L75,20 L100,50 L75,80 L75,60 L25,60 L25,80 Z',
|
|
26
|
+
wavy: 'M0,30 C15,5 35,55 50,30 C65,5 85,55 100,30 L100,70 C85,95 65,45 50,70 C35,95 15,45 0,70 Z',
|
|
27
|
+
'speech-round': 'M50,5 C22,5 5,22 5,42 C5,58 16,72 32,78 L24,95 L46,80 C47,80 48,80 50,80 C78,80 95,63 95,42 C95,22 78,5 50,5 Z',
|
|
28
|
+
'speech-rect': 'M5,8 L95,8 L95,72 L42,72 L24,92 L24,72 L5,72 Z',
|
|
29
|
+
'speech-cloud': 'M50,8 C28,8 12,22 12,40 C12,52 18,60 28,66 L24,82 L42,68 C45,69 48,70 50,70 C72,70 88,56 88,40 C88,22 72,8 50,8 Z M22,84 C20,84 19,87 21,88 C23,89 25,87 24,85 Z M14,93 C13,93 12,95 13,96 C15,97 17,95 16,94 Z',
|
|
30
|
+
'speech-pointed': 'M5,8 L95,8 L95,68 L60,68 L72,90 L40,68 L5,68 Z',
|
|
31
|
+
'cloud-fluffy': 'M30,55 C20,55 12,48 14,38 C16,28 28,26 34,32 C36,20 52,16 62,28 C68,20 82,22 84,36 C92,38 94,50 86,56 C92,62 88,72 78,70 C72,76 60,76 56,70 C46,76 36,76 32,70 C24,76 16,70 22,62 C14,62 18,55 30,55 Z',
|
|
32
|
+
'heart-broken': 'M50,90 C50,90 10,70 10,40 C10,15 30,5 50,30 L42,42 L52,50 L42,62 L50,90 Z M50,90 L60,62 L50,50 L60,42 L50,30 C70,5 90,15 90,40 C90,70 50,90 50,90 Z',
|
|
33
|
+
'heart-double': 'M28,72 C28,72 4,58 4,32 C4,12 22,2 30,20 C38,2 56,12 56,32 C56,58 28,72 28,72 Z M68,72 C68,72 44,58 44,32 C44,12 62,2 70,20 C78,2 96,12 96,32 C96,58 68,72 68,72 Z',
|
|
34
|
+
drop: 'M50,5 C50,5 70,30 80,55 C85,75 70,92 50,92 C30,92 15,75 20,55 C30,30 50,5 50,5 Z',
|
|
35
|
+
'banner-ribbon': 'M5,30 L75,30 L95,50 L75,70 L5,70 L20,50 Z',
|
|
36
|
+
'banner-flag': 'M10,8 L10,92 L14,92 L14,55 L88,38 L14,18 Z',
|
|
37
|
+
gear: 'M50,5 L57,12 L62,8 L67,18 L80,15 L82,28 L92,33 L88,42 L95,50 L88,58 L92,67 L82,72 L80,85 L67,82 L62,92 L57,88 L50,95 L43,88 L38,92 L33,82 L20,85 L18,72 L8,67 L12,58 L5,50 L12,42 L8,33 L18,28 L20,15 L33,18 L38,8 L43,12 Z',
|
|
38
|
+
plus: 'M40,5 L60,5 L60,40 L95,40 L95,60 L60,60 L60,95 L40,95 L40,60 L5,60 L5,40 L40,40 Z',
|
|
39
|
+
checkmark: 'M10,52 L38,80 L90,18 L78,8 L38,58 L22,42 Z',
|
|
40
|
+
blob: 'M50,4 C72,6 90,22 94,44 C98,66 88,86 70,93 C52,100 30,96 18,82 C6,68 4,46 14,28 C24,10 38,2 50,4 Z',
|
|
41
|
+
'blob-2': 'M52,6 C75,12 95,28 92,52 C90,72 75,90 52,92 C32,93 12,82 8,62 C4,42 18,18 30,12 C38,8 45,5 52,6 Z',
|
|
42
|
+
leaf: 'M50,4 C76,12 92,36 88,62 C84,84 64,94 50,94 C36,94 16,84 12,62 C8,36 24,12 50,4 Z',
|
|
43
|
+
'arrow-curved': 'M8,72 C8,42 32,22 60,28 L60,16 L92,38 L60,60 L60,48 C42,46 26,58 26,72 Z',
|
|
44
|
+
'cloud-puff': 'M22,60 C8,60 5,45 18,38 C18,22 38,18 48,30 C58,18 78,22 78,40 C92,40 92,58 78,62 C78,72 60,72 56,66 C50,72 30,72 22,60 Z',
|
|
45
|
+
'cloud-thin': 'M5,55 C5,40 22,30 32,40 C36,30 50,28 58,38 C72,30 88,38 90,52 C95,55 95,65 85,65 L15,65 C5,65 5,58 5,55 Z',
|
|
46
|
+
'heart-arrow': 'M50,90 C50,90 12,68 12,38 C12,15 30,5 50,28 C70,5 88,15 88,38 C88,68 50,90 50,90 Z M0,46 L20,46 L20,38 L32,52 L20,66 L20,58 L0,58 Z M68,52 L80,52 L80,44 L100,58 L80,72 L80,64 L68,64 Z',
|
|
47
|
+
'drop-pin': 'M50,5 C32,5 18,18 18,35 C18,55 50,92 50,92 C50,92 82,55 82,35 C82,18 68,5 50,5 Z',
|
|
48
|
+
'drop-tear': 'M50,8 C42,28 28,52 32,70 C34,82 42,90 50,90 C58,90 66,82 68,70 C72,52 58,28 50,8 Z',
|
|
49
|
+
'drop-flame': 'M50,5 C45,18 35,28 38,42 C30,50 30,62 38,72 C32,75 32,82 38,88 C45,93 55,93 62,88 C68,82 68,75 62,72 C70,62 70,50 62,42 C65,28 55,18 50,5 Z',
|
|
50
|
+
'banner-tag': 'M5,25 L70,25 L95,50 L70,75 L5,75 Z',
|
|
51
|
+
'banner-scroll': 'M0,42 C0,32 12,28 22,32 L22,68 C12,72 0,68 0,58 Z M22,28 L78,28 L78,72 L22,72 Z M78,32 C88,28 100,32 100,42 L100,58 C100,68 88,72 78,68 Z',
|
|
52
|
+
tree: 'M40,72 L60,72 L60,90 L40,90 Z M50,8 L72,40 L62,40 L82,68 L66,68 L78,90 L22,90 L34,68 L18,68 L38,40 L28,40 Z',
|
|
53
|
+
mountain: 'M5,82 L32,38 L48,58 L62,30 L95,82 Z',
|
|
54
|
+
minus: 'M5,42 L95,42 L95,58 L5,58 Z',
|
|
55
|
+
'x-mark': 'M14,5 L50,40 L86,5 L95,14 L60,50 L95,86 L86,95 L50,60 L14,95 L5,86 L40,50 L5,14 Z',
|
|
56
|
+
};
|
|
57
|
+
const isPathShape = (type) => type in SHAPE_PATHS;
|
|
58
|
+
/**
|
|
59
|
+
* A rect or ellipse drawn by hand: same box and origin as the Konva node it replaces, only the
|
|
60
|
+
* outline (the notch) or the fill (the glow) differs.
|
|
61
|
+
*/
|
|
62
|
+
function outlined(shape, commonProps, shapeRef, notchSize) {
|
|
63
|
+
const { width, height } = shape;
|
|
64
|
+
const trace = (ctx) => {
|
|
65
|
+
if (shape.type === 'ellipse') {
|
|
66
|
+
ctx.beginPath();
|
|
67
|
+
ctx.ellipse(width / 2, height / 2, width / 2, height / 2, 0, 0, Math.PI * 2);
|
|
68
|
+
ctx.closePath();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
traceNotch(ctx, width, height, notchSize);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return (_jsx(Shape, { ref: shapeRef, ...commonProps, width: width, height: height, offsetX: width / 2, offsetY: height / 2, sceneFunc: (ctx, node) => {
|
|
75
|
+
trace(ctx);
|
|
76
|
+
if (!shape.glow) {
|
|
77
|
+
ctx.fillStrokeShape(node);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// The fade is elliptical: a circular gradient squeezed to the shape's height.
|
|
81
|
+
const glow = glowGradient(shape.fill, width, height);
|
|
82
|
+
ctx.save();
|
|
83
|
+
ctx.clip();
|
|
84
|
+
ctx.translate(width / 2, height / 2);
|
|
85
|
+
ctx.scale(1, height / width);
|
|
86
|
+
const paint = ctx.createRadialGradient(0, 0, 0, 0, 0, glow.radius ?? width / 2);
|
|
87
|
+
for (const stop of glow.stops)
|
|
88
|
+
paint.addColorStop(stop.offset, stop.color);
|
|
89
|
+
ctx.setAttr('fillStyle', paint);
|
|
90
|
+
ctx.fillRect(-width, -width, width * 2, width * 2);
|
|
91
|
+
ctx.restore();
|
|
92
|
+
}, hitFunc: (ctx, node) => {
|
|
93
|
+
trace(ctx);
|
|
94
|
+
ctx.fillShape(node);
|
|
95
|
+
} }));
|
|
96
|
+
}
|
|
97
|
+
/** A ring drawn by hand: a stroke of `ringWidth`, or only the share `arc` of it. */
|
|
98
|
+
function arcRing(shape, commonProps, shapeRef) {
|
|
99
|
+
const { width } = shape;
|
|
100
|
+
const ring = ringGeometry(width, shape.ringWidth, shape.arc);
|
|
101
|
+
const trace = (ctx) => {
|
|
102
|
+
ctx.beginPath();
|
|
103
|
+
if (ring.empty)
|
|
104
|
+
return;
|
|
105
|
+
const c = width / 2;
|
|
106
|
+
if (ring.full) {
|
|
107
|
+
// Opposite directions: the non-zero fill leaves the inner circle bare.
|
|
108
|
+
ctx.arc(c, c, ring.outer, 0, Math.PI * 2, false);
|
|
109
|
+
ctx.moveTo(c + ring.inner, c);
|
|
110
|
+
ctx.arc(c, c, ring.inner, 0, Math.PI * 2, true);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
ctx.arc(c, c, ring.outer, ring.start, ring.end, false);
|
|
114
|
+
ctx.arc(c, c, ring.inner, ring.end, ring.start, true);
|
|
115
|
+
}
|
|
116
|
+
ctx.closePath();
|
|
117
|
+
};
|
|
118
|
+
return (_jsx(Shape, { ref: shapeRef, ...commonProps, width: width, height: width, offsetX: width / 2, offsetY: width / 2, sceneFunc: (ctx, node) => {
|
|
119
|
+
trace(ctx);
|
|
120
|
+
ctx.fillStrokeShape(node);
|
|
121
|
+
}, hitFunc: (ctx, node) => {
|
|
122
|
+
trace(ctx);
|
|
123
|
+
ctx.fillShape(node);
|
|
124
|
+
} }));
|
|
125
|
+
}
|
|
126
|
+
/** A rounded rect with a speech-bubble tail in the same outline, so one fill (and shadow) covers both. */
|
|
127
|
+
function bubble(shape, commonProps, shapeRef, tail) {
|
|
128
|
+
const { width, height } = shape;
|
|
129
|
+
const corners = cornersOf(shape.cornerRadius ?? 32, width, height);
|
|
130
|
+
const trace = (ctx) => {
|
|
131
|
+
ctx.beginPath();
|
|
132
|
+
traceBubble(ctx, width, height, corners, tail);
|
|
133
|
+
};
|
|
134
|
+
return (_jsx(Shape, { ref: shapeRef, ...commonProps, width: width, height: height, offsetX: width / 2, offsetY: height / 2, sceneFunc: (ctx, node) => {
|
|
135
|
+
trace(ctx);
|
|
136
|
+
ctx.fillStrokeShape(node);
|
|
137
|
+
}, hitFunc: (ctx, node) => {
|
|
138
|
+
trace(ctx);
|
|
139
|
+
ctx.fillShape(node);
|
|
140
|
+
} }));
|
|
141
|
+
}
|
|
142
|
+
function renderShape(shape, commonProps, shapeRef, notchSize) {
|
|
143
|
+
switch (shape.type) {
|
|
144
|
+
case 'rect':
|
|
145
|
+
if (notchSize > 0 || shape.glow) {
|
|
146
|
+
return outlined(shape, commonProps, shapeRef, notchSize);
|
|
147
|
+
}
|
|
148
|
+
return (_jsx(Rect, { ref: shapeRef, ...commonProps, width: shape.width, height: shape.height, offsetX: shape.width / 2, offsetY: shape.height / 2 }));
|
|
149
|
+
case 'rounded-rect': {
|
|
150
|
+
const tail = tailOf(shape);
|
|
151
|
+
if (tail)
|
|
152
|
+
return bubble(shape, commonProps, shapeRef, tail);
|
|
153
|
+
return (_jsx(Rect, { ref: shapeRef, ...commonProps, width: shape.width, height: shape.height, offsetX: shape.width / 2, offsetY: shape.height / 2, cornerRadius: shape.cornerRadius ?? 32 }));
|
|
154
|
+
}
|
|
155
|
+
case 'circle':
|
|
156
|
+
return (_jsx(Circle, { ref: shapeRef, ...commonProps, width: shape.width, height: shape.height, radius: shape.width / 2 }));
|
|
157
|
+
case 'ellipse':
|
|
158
|
+
if (shape.glow)
|
|
159
|
+
return outlined(shape, commonProps, shapeRef, 0);
|
|
160
|
+
return (_jsx(Ellipse, { ref: shapeRef, ...commonProps, radiusX: shape.width / 2, radiusY: shape.height / 2 }));
|
|
161
|
+
case 'ring':
|
|
162
|
+
if (shape.arc !== undefined || shape.ringWidth !== undefined) {
|
|
163
|
+
return arcRing(shape, commonProps, shapeRef);
|
|
164
|
+
}
|
|
165
|
+
return (_jsx(Ring, { ref: shapeRef, ...commonProps, innerRadius: shape.width * 0.3, outerRadius: shape.width / 2 }));
|
|
166
|
+
case 'triangle':
|
|
167
|
+
return (_jsx(RegularPolygon, { ref: shapeRef, ...commonProps, sides: 3, radius: shape.width / 2 }));
|
|
168
|
+
case 'pentagon':
|
|
169
|
+
return (_jsx(RegularPolygon, { ref: shapeRef, ...commonProps, sides: 5, radius: shape.width / 2 }));
|
|
170
|
+
case 'hexagon':
|
|
171
|
+
return (_jsx(RegularPolygon, { ref: shapeRef, ...commonProps, sides: 6, radius: shape.width / 2 }));
|
|
172
|
+
case 'diamond':
|
|
173
|
+
return (_jsx(RegularPolygon, { ref: shapeRef, ...commonProps, sides: 4, radius: shape.width / 2 }));
|
|
174
|
+
case 'star':
|
|
175
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 5, innerRadius: shape.width / 4, outerRadius: shape.width / 2 }));
|
|
176
|
+
case 'sparkle':
|
|
177
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 4, innerRadius: shape.width / 10, outerRadius: shape.width / 2 }));
|
|
178
|
+
case 'asterisk':
|
|
179
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 6, innerRadius: shape.width / 12, outerRadius: shape.width / 2 }));
|
|
180
|
+
case 'flower':
|
|
181
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 6, innerRadius: shape.width * 0.28, outerRadius: shape.width / 2 }));
|
|
182
|
+
case 'flower-8':
|
|
183
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 8, innerRadius: shape.width * 0.3, outerRadius: shape.width / 2 }));
|
|
184
|
+
case 'star-burst':
|
|
185
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 8, innerRadius: shape.width / 12, outerRadius: shape.width / 2 }));
|
|
186
|
+
case 'sun':
|
|
187
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 12, innerRadius: shape.width * 0.32, outerRadius: shape.width / 2 }));
|
|
188
|
+
case 'gear-12':
|
|
189
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 12, innerRadius: shape.width * 0.4, outerRadius: shape.width / 2 }));
|
|
190
|
+
case 'gear-6':
|
|
191
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 6, innerRadius: shape.width * 0.36, outerRadius: shape.width / 2 }));
|
|
192
|
+
case 'gear-fine':
|
|
193
|
+
return (_jsx(Star, { ref: shapeRef, ...commonProps, numPoints: 20, innerRadius: shape.width * 0.42, outerRadius: shape.width / 2 }));
|
|
194
|
+
case 'arrow':
|
|
195
|
+
case 'arrow-curved':
|
|
196
|
+
case 'heart':
|
|
197
|
+
case 'cloud':
|
|
198
|
+
case 'chevron':
|
|
199
|
+
case 'double-arrow':
|
|
200
|
+
case 'wavy':
|
|
201
|
+
case 'speech-round':
|
|
202
|
+
case 'speech-rect':
|
|
203
|
+
case 'speech-cloud':
|
|
204
|
+
case 'speech-pointed':
|
|
205
|
+
case 'cloud-fluffy':
|
|
206
|
+
case 'cloud-puff':
|
|
207
|
+
case 'cloud-thin':
|
|
208
|
+
case 'heart-broken':
|
|
209
|
+
case 'heart-double':
|
|
210
|
+
case 'heart-arrow':
|
|
211
|
+
case 'drop':
|
|
212
|
+
case 'drop-pin':
|
|
213
|
+
case 'drop-tear':
|
|
214
|
+
case 'drop-flame':
|
|
215
|
+
case 'banner-ribbon':
|
|
216
|
+
case 'banner-flag':
|
|
217
|
+
case 'banner-tag':
|
|
218
|
+
case 'banner-scroll':
|
|
219
|
+
case 'gear':
|
|
220
|
+
case 'plus':
|
|
221
|
+
case 'minus':
|
|
222
|
+
case 'x-mark':
|
|
223
|
+
case 'tree':
|
|
224
|
+
case 'mountain':
|
|
225
|
+
case 'blob-2':
|
|
226
|
+
case 'checkmark':
|
|
227
|
+
case 'blob':
|
|
228
|
+
case 'leaf': {
|
|
229
|
+
const offset = PATH_OFFSETS[shape.type];
|
|
230
|
+
return (_jsx(Path, { ref: shapeRef, ...commonProps, data: SHAPE_PATHS[shape.type], offsetX: offset.x, offsetY: offset.y, scaleX: signedScale((shape.width / PATH_VIEWBOX) * shape.scaleX, shape.flipX === true), scaleY: signedScale((shape.height / PATH_VIEWBOX) * shape.scaleY, shape.flipY === true) }));
|
|
231
|
+
}
|
|
232
|
+
case 'line':
|
|
233
|
+
case 'line-thick':
|
|
234
|
+
case 'line-dashed':
|
|
235
|
+
case 'line-dotted':
|
|
236
|
+
return (_jsx(Line, { ref: shapeRef, ...commonProps, points: [-shape.width / 2, 0, shape.width / 2, 0], stroke: shape.fill, strokeWidth: shape.strokeWidth ?? 6, dash: shape.dash, lineCap: shape.type === 'line-dotted' ? 'round' : 'butt',
|
|
237
|
+
// An open line paints no fill, so Konva's fill+stroke offscreen buffer
|
|
238
|
+
// (taken at opacity < 1) would cost a canvas per draw for nothing.
|
|
239
|
+
perfectDrawEnabled: false }));
|
|
240
|
+
case 'line-double':
|
|
241
|
+
return (_jsx(Path, { ref: shapeRef, ...commonProps, data: `M -${shape.width / 2},-6 L ${shape.width / 2},-6 M -${shape.width / 2},6 L ${shape.width / 2},6`, stroke: shape.fill, strokeWidth: shape.strokeWidth ?? 6, perfectDrawEnabled: false }));
|
|
242
|
+
case 'line-arrow': {
|
|
243
|
+
const sw = shape.strokeWidth ?? 6;
|
|
244
|
+
const shaft = arrowPoints(shape.width, shape.bend);
|
|
245
|
+
return (_jsx(Arrow, { ref: shapeRef, ...commonProps, points: shaft.points, tension: shaft.tension, stroke: shape.fill, strokeWidth: sw, pointerLength: Math.max(16, sw * 2.5), pointerWidth: Math.max(16, sw * 2.5) }));
|
|
246
|
+
}
|
|
247
|
+
case 'hand-kreis':
|
|
248
|
+
case 'hand-unterstrich':
|
|
249
|
+
case 'hand-pfeil':
|
|
250
|
+
case 'hand-ausruf':
|
|
251
|
+
case 'hand-marker':
|
|
252
|
+
case 'hand-marker-box':
|
|
253
|
+
case 'hand-winken':
|
|
254
|
+
case 'hand-pfeil-schlaufe':
|
|
255
|
+
case 'hand-pfeil-welle':
|
|
256
|
+
case 'hand-pfeil-bogen':
|
|
257
|
+
case 'hand-pfeil-haken':
|
|
258
|
+
case 'hand-pfeil-herz':
|
|
259
|
+
case 'hand-pfeil-spirale':
|
|
260
|
+
return (_jsx(Path, { ref: shapeRef, ...commonProps, data: handDrawnPath(shape.type, shape.width, shape.height, shape.strokeWidth ?? 8),
|
|
261
|
+
// The brush outline is a few px wide: an invisible stroke widens what a click hits.
|
|
262
|
+
stroke: "rgba(0,0,0,0)", strokeWidth: 1, hitStrokeWidth: 24,
|
|
263
|
+
// The stroke is invisible, so the fill+stroke buffer changes nothing visible.
|
|
264
|
+
perfectDrawEnabled: false }));
|
|
265
|
+
default:
|
|
266
|
+
return assertNever(shape.type);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const ShapePrimitiveInner = ({ shape, isSelected, onSelect, onChange, draggable: draggableProp = true, ...snapProps }) => {
|
|
270
|
+
const locked = useIsItemLocked();
|
|
271
|
+
const snap = useBoxSnap({ id: shape.id, ...snapProps }, shapeBox(shape));
|
|
272
|
+
const draggable = draggableProp && !locked;
|
|
273
|
+
const shapeRef = useRef(null);
|
|
274
|
+
const dotsRef = useRef(null);
|
|
275
|
+
const grainRef = useRef(null);
|
|
276
|
+
const trRef = useRef(null);
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
if (isSelected && trRef.current && shapeRef.current) {
|
|
279
|
+
trRef.current.nodes([shapeRef.current]);
|
|
280
|
+
trRef.current.getLayer()?.batchDraw();
|
|
281
|
+
}
|
|
282
|
+
}, [isSelected]);
|
|
283
|
+
// Gradient fill is painted in the shape's local box. getSelfRect() gives the
|
|
284
|
+
// correct box for both top-left (Rect) and center-origin (Circle/Star) shapes.
|
|
285
|
+
const [gradientProps, setGradientProps] = useState(null);
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
const gradient = shapeGradient({
|
|
288
|
+
fill: shape.fill,
|
|
289
|
+
shade: shape.shade,
|
|
290
|
+
fillGradient: shape.fillGradient,
|
|
291
|
+
type: shape.type,
|
|
292
|
+
glow: shape.glow,
|
|
293
|
+
width: shape.width,
|
|
294
|
+
height: shape.height,
|
|
295
|
+
});
|
|
296
|
+
if (gradient && shapeRef.current) {
|
|
297
|
+
setGradientProps(gradientFillProps(gradient, shapeRef.current.getSelfRect()));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
setGradientProps(null);
|
|
301
|
+
}
|
|
302
|
+
}, [
|
|
303
|
+
shape.fillGradient,
|
|
304
|
+
shape.shade,
|
|
305
|
+
shape.glow,
|
|
306
|
+
shape.fill,
|
|
307
|
+
shape.type,
|
|
308
|
+
shape.width,
|
|
309
|
+
shape.height,
|
|
310
|
+
]);
|
|
311
|
+
// The texture nodes are siblings of the shape, so a live drag or resize moves them by hand.
|
|
312
|
+
const followShape = () => {
|
|
313
|
+
const node = shapeRef.current;
|
|
314
|
+
if (!node)
|
|
315
|
+
return;
|
|
316
|
+
for (const texture of [dotsRef.current, grainRef.current]) {
|
|
317
|
+
texture?.setAttrs({
|
|
318
|
+
x: node.x(),
|
|
319
|
+
y: node.y(),
|
|
320
|
+
rotation: node.rotation(),
|
|
321
|
+
scaleX: node.scaleX(),
|
|
322
|
+
scaleY: node.scaleY(),
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
const handleDragEnd = (e) => {
|
|
327
|
+
snap.onDragEnd();
|
|
328
|
+
onChange({
|
|
329
|
+
x: e.target.x(),
|
|
330
|
+
y: e.target.y(),
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
const handleTransformEnd = () => {
|
|
334
|
+
const node = shapeRef.current;
|
|
335
|
+
if (!node)
|
|
336
|
+
return;
|
|
337
|
+
const pathShape = isPathShape(shape.type);
|
|
338
|
+
const size = resizedShapeSize(pathShape, shape, node.scaleX(), node.scaleY());
|
|
339
|
+
const nodeScale = shapeNodeScale(pathShape, size);
|
|
340
|
+
// Vor dem Zurücksetzen der Vorzeichen lesen: nur dann erkennt es Konvas Zerlegung.
|
|
341
|
+
const rotation = nodeRotation(node);
|
|
342
|
+
node.scaleX(signedScale(nodeScale.width, shape.flipX === true));
|
|
343
|
+
node.scaleY(signedScale(nodeScale.height, shape.flipY === true));
|
|
344
|
+
node.rotation(rotation);
|
|
345
|
+
onChange({
|
|
346
|
+
x: node.x(),
|
|
347
|
+
y: node.y(),
|
|
348
|
+
rotation,
|
|
349
|
+
width: size.width,
|
|
350
|
+
height: size.height,
|
|
351
|
+
scaleX: 1,
|
|
352
|
+
scaleY: 1,
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
// A large composer plane lies under the finger wherever one touches the
|
|
356
|
+
// slide: as with the background photo, the first touch selects it and only a
|
|
357
|
+
// touch on the selected plane drags it.
|
|
358
|
+
const touchDragNeedsSelection = isComposerPlane(shape.id) && !isSelected && draggable;
|
|
359
|
+
const notchSize = shape.type === 'rect' ? notchPx(shape.notch, snapProps.stageWidth) : 0;
|
|
360
|
+
const fillsArea = !STROKE_ONLY_SHAPES.has(shape.type) && !shape.type.startsWith('hand-');
|
|
361
|
+
const commonProps = {
|
|
362
|
+
x: shape.x,
|
|
363
|
+
y: shape.y,
|
|
364
|
+
fill: shape.fill,
|
|
365
|
+
opacity: shape.opacity ?? 1,
|
|
366
|
+
rotation: shape.rotation,
|
|
367
|
+
scaleX: signedScale(shape.scaleX, shape.flipX === true),
|
|
368
|
+
scaleY: signedScale(shape.scaleY, shape.flipY === true),
|
|
369
|
+
[MIRROR_X_ATTR]: shape.flipX === true,
|
|
370
|
+
draggable,
|
|
371
|
+
hitFunc: fillsArea ? translucentHitFunc(shapeGradient(shape)) : undefined,
|
|
372
|
+
onMouseDown: (e) => {
|
|
373
|
+
e.cancelBubble = true;
|
|
374
|
+
onSelect(shape.id);
|
|
375
|
+
},
|
|
376
|
+
onTouchStart: (e) => {
|
|
377
|
+
e.cancelBubble = true;
|
|
378
|
+
if (touchDragNeedsSelection) {
|
|
379
|
+
const node = e.target;
|
|
380
|
+
node.draggable(false);
|
|
381
|
+
node.stopDrag();
|
|
382
|
+
const restore = () => {
|
|
383
|
+
window.removeEventListener('touchend', restore);
|
|
384
|
+
window.removeEventListener('touchcancel', restore);
|
|
385
|
+
node.draggable(draggable);
|
|
386
|
+
};
|
|
387
|
+
window.addEventListener('touchend', restore);
|
|
388
|
+
window.addEventListener('touchcancel', restore);
|
|
389
|
+
}
|
|
390
|
+
onSelect(shape.id);
|
|
391
|
+
},
|
|
392
|
+
onDragStart: snap.onDragStart,
|
|
393
|
+
onDragMove: (e) => {
|
|
394
|
+
snap.onDragMove(e);
|
|
395
|
+
followShape();
|
|
396
|
+
},
|
|
397
|
+
onDragEnd: handleDragEnd,
|
|
398
|
+
onTransform: followShape,
|
|
399
|
+
onTransformEnd: handleTransformEnd,
|
|
400
|
+
name: `shape-${shape.id}`,
|
|
401
|
+
shadowColor: shape.shadowColor,
|
|
402
|
+
shadowBlur: shape.shadowBlur,
|
|
403
|
+
shadowOffsetX: shape.shadowOffsetX,
|
|
404
|
+
shadowOffsetY: shape.shadowOffsetY,
|
|
405
|
+
shadowOpacity: shape.shadowOpacity,
|
|
406
|
+
globalCompositeOperation: shape.blendMode,
|
|
407
|
+
...(gradientProps ?? { fillPriority: 'color' }),
|
|
408
|
+
};
|
|
409
|
+
const outline = (ctx) => {
|
|
410
|
+
traceNotch(ctx, shape.width, shape.height, notchSize);
|
|
411
|
+
ctx.save();
|
|
412
|
+
ctx.clip();
|
|
413
|
+
};
|
|
414
|
+
const textureBox = {
|
|
415
|
+
x: commonProps.x,
|
|
416
|
+
y: commonProps.y,
|
|
417
|
+
rotation: commonProps.rotation,
|
|
418
|
+
scaleX: commonProps.scaleX,
|
|
419
|
+
scaleY: commonProps.scaleY,
|
|
420
|
+
width: shape.width,
|
|
421
|
+
height: shape.height,
|
|
422
|
+
offsetX: shape.width / 2,
|
|
423
|
+
offsetY: shape.height / 2,
|
|
424
|
+
listening: false,
|
|
425
|
+
perfectDrawEnabled: false,
|
|
426
|
+
};
|
|
427
|
+
const pattern = shape.type === 'rect' ? shape.pattern : undefined;
|
|
428
|
+
const dots = pattern === 'dots' || pattern === 'stripes';
|
|
429
|
+
const grain = shape.type === 'rect' ? Math.min(1, Math.max(0, shape.grain ?? 0)) : 0;
|
|
430
|
+
return (_jsxs(_Fragment, { children: [renderShape(shape, commonProps, shapeRef, notchSize), dots && (_jsx(Shape, { ref: dotsRef, name: `shape-texture-${shape.id}-dots`, ...textureBox, opacity: shape.opacity ?? 1, globalCompositeOperation: shape.blendMode, sceneFunc: (ctx) => {
|
|
431
|
+
outline(ctx);
|
|
432
|
+
const paint = pattern === 'stripes' ? paintStripes : paintDots;
|
|
433
|
+
paint(ctx, shape, shape.width, shape.height, snapProps.stageWidth ?? 0);
|
|
434
|
+
ctx.restore();
|
|
435
|
+
} })), grain > 0 && (_jsx(Shape, { ref: grainRef, name: `shape-texture-${shape.id}-grain`, ...textureBox, opacity: (shape.opacity ?? 1) * grain, globalCompositeOperation: shape.blendMode, sceneFunc: (ctx) => {
|
|
436
|
+
outline(ctx);
|
|
437
|
+
paintGrain(ctx, shape.grainTone ?? 'dark', shape.width, shape.height);
|
|
438
|
+
ctx.restore();
|
|
439
|
+
} })), isSelected && (_jsx(Transformer, { ref: trRef, boundBoxFunc: (oldBox, newBox) => {
|
|
440
|
+
if (newBox.width < 5 || newBox.height < 5) {
|
|
441
|
+
return oldBox;
|
|
442
|
+
}
|
|
443
|
+
return newBox;
|
|
444
|
+
}, rotateEnabled: true, ...ELEMENT_TRANSFORMER, ...(locked ? LOCKED_TRANSFORMER : {}) }))] }));
|
|
445
|
+
};
|
|
446
|
+
export const ShapePrimitive = memo(ShapePrimitiveInner, (prevProps, nextProps) => {
|
|
447
|
+
const prevShape = prevProps.shape;
|
|
448
|
+
const nextShape = nextProps.shape;
|
|
449
|
+
if (prevShape.id !== nextShape.id)
|
|
450
|
+
return false;
|
|
451
|
+
if (prevShape.type !== nextShape.type)
|
|
452
|
+
return false;
|
|
453
|
+
if (prevShape.x !== nextShape.x)
|
|
454
|
+
return false;
|
|
455
|
+
if (prevShape.y !== nextShape.y)
|
|
456
|
+
return false;
|
|
457
|
+
if (prevShape.width !== nextShape.width)
|
|
458
|
+
return false;
|
|
459
|
+
if (prevShape.height !== nextShape.height)
|
|
460
|
+
return false;
|
|
461
|
+
if (prevShape.fill !== nextShape.fill)
|
|
462
|
+
return false;
|
|
463
|
+
if (prevShape.rotation !== nextShape.rotation)
|
|
464
|
+
return false;
|
|
465
|
+
if (prevShape.scaleX !== nextShape.scaleX)
|
|
466
|
+
return false;
|
|
467
|
+
if (prevShape.scaleY !== nextShape.scaleY)
|
|
468
|
+
return false;
|
|
469
|
+
if (prevShape.opacity !== nextShape.opacity)
|
|
470
|
+
return false;
|
|
471
|
+
if (!sameCorners(prevShape.cornerRadius, nextShape.cornerRadius))
|
|
472
|
+
return false;
|
|
473
|
+
if (prevShape.strokeWidth !== nextShape.strokeWidth)
|
|
474
|
+
return false;
|
|
475
|
+
if (prevShape.dash !== nextShape.dash)
|
|
476
|
+
return false;
|
|
477
|
+
if (prevShape.shadowColor !== nextShape.shadowColor)
|
|
478
|
+
return false;
|
|
479
|
+
if (prevShape.shadowBlur !== nextShape.shadowBlur)
|
|
480
|
+
return false;
|
|
481
|
+
if (prevShape.shadowOffsetX !== nextShape.shadowOffsetX)
|
|
482
|
+
return false;
|
|
483
|
+
if (prevShape.shadowOffsetY !== nextShape.shadowOffsetY)
|
|
484
|
+
return false;
|
|
485
|
+
if (prevShape.shadowOpacity !== nextShape.shadowOpacity)
|
|
486
|
+
return false;
|
|
487
|
+
if (prevShape.fillGradient !== nextShape.fillGradient)
|
|
488
|
+
return false;
|
|
489
|
+
if (prevShape.shade !== nextShape.shade)
|
|
490
|
+
return false;
|
|
491
|
+
if (prevShape.blendMode !== nextShape.blendMode)
|
|
492
|
+
return false;
|
|
493
|
+
if (prevShape.notch !== nextShape.notch)
|
|
494
|
+
return false;
|
|
495
|
+
if (prevShape.glow !== nextShape.glow)
|
|
496
|
+
return false;
|
|
497
|
+
if (prevShape.grain !== nextShape.grain)
|
|
498
|
+
return false;
|
|
499
|
+
if (prevShape.grainTone !== nextShape.grainTone)
|
|
500
|
+
return false;
|
|
501
|
+
if (prevShape.pattern !== nextShape.pattern)
|
|
502
|
+
return false;
|
|
503
|
+
if (prevShape.patternColor !== nextShape.patternColor)
|
|
504
|
+
return false;
|
|
505
|
+
if (prevShape.patternSpacing !== nextShape.patternSpacing)
|
|
506
|
+
return false;
|
|
507
|
+
if (prevShape.flipX !== nextShape.flipX)
|
|
508
|
+
return false;
|
|
509
|
+
if (prevShape.flipY !== nextShape.flipY)
|
|
510
|
+
return false;
|
|
511
|
+
if (prevProps.isSelected !== nextProps.isSelected)
|
|
512
|
+
return false;
|
|
513
|
+
if (prevProps.draggable !== nextProps.draggable)
|
|
514
|
+
return false;
|
|
515
|
+
if (prevProps.stageWidth !== nextProps.stageWidth)
|
|
516
|
+
return false;
|
|
517
|
+
if (prevProps.stageHeight !== nextProps.stageHeight)
|
|
518
|
+
return false;
|
|
519
|
+
return true;
|
|
520
|
+
});
|
|
521
|
+
ShapePrimitive.displayName = 'ShapePrimitive';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SnapGuidelines - Visual guidelines shown when elements snap to center or other elements
|
|
3
|
+
*
|
|
4
|
+
* Subscribes to snap state directly from the store to avoid re-rendering
|
|
5
|
+
* the parent GenericCanvas on every snap line change during drag.
|
|
6
|
+
*
|
|
7
|
+
* Gezeichnet werden nur die gemeldeten Linien. Rastet die Seitenmitte ein, ist
|
|
8
|
+
* sie selbst eine davon; die Achsen-Flags (`snapGuides`) sagen nur „eingerastet",
|
|
9
|
+
* nicht „an der Mitte" — als Mittellinie gelesen, malten sie neben jede
|
|
10
|
+
* Element-Linie eine falsche Seitenmitte.
|
|
11
|
+
*/
|
|
12
|
+
export interface SnapGuidelinesProps {
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Abstandsmarken beim Gleich-verteilen. */
|
|
15
|
+
gapColor?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function SnapGuidelinesInner({ color, gapColor }: SnapGuidelinesProps): import("react").JSX.Element | null;
|
|
18
|
+
export declare const SnapGuidelines: import("react").MemoExoticComponent<typeof SnapGuidelinesInner>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
/**
|
|
4
|
+
* SnapGuidelines - Visual guidelines shown when elements snap to center or other elements
|
|
5
|
+
*
|
|
6
|
+
* Subscribes to snap state directly from the store to avoid re-rendering
|
|
7
|
+
* the parent GenericCanvas on every snap line change during drag.
|
|
8
|
+
*
|
|
9
|
+
* Gezeichnet werden nur die gemeldeten Linien. Rastet die Seitenmitte ein, ist
|
|
10
|
+
* sie selbst eine davon; die Achsen-Flags (`snapGuides`) sagen nur „eingerastet",
|
|
11
|
+
* nicht „an der Mitte" — als Mittellinie gelesen, malten sie neben jede
|
|
12
|
+
* Element-Linie eine falsche Seitenmitte.
|
|
13
|
+
*/
|
|
14
|
+
import { memo } from 'react';
|
|
15
|
+
import { Line } from 'react-konva';
|
|
16
|
+
import { useCanvasStoreShallow } from '../stores/CanvasStoreProvider.js';
|
|
17
|
+
/** Halbe Höhe der Endstriche einer Abstandsmarke. */
|
|
18
|
+
const GAP_TICK = 6;
|
|
19
|
+
/** Eine Abstandsmarke |—| als ein Linienzug: Strich, Strecke, Strich. */
|
|
20
|
+
function gapPoints(line) {
|
|
21
|
+
const { start: s, end: e, position: p } = line;
|
|
22
|
+
return line.orientation === 'horizontal'
|
|
23
|
+
? [s, p - GAP_TICK, s, p + GAP_TICK, s, p, e, p, e, p - GAP_TICK, e, p + GAP_TICK]
|
|
24
|
+
: [p - GAP_TICK, s, p + GAP_TICK, s, p, s, p, e, p - GAP_TICK, e, p + GAP_TICK, e];
|
|
25
|
+
}
|
|
26
|
+
function SnapGuidelinesInner({ color = '#0066ff', gapColor = '#e6007e' }) {
|
|
27
|
+
const snapLines = useCanvasStoreShallow((s) => s.snapLines);
|
|
28
|
+
if (snapLines.length === 0)
|
|
29
|
+
return null;
|
|
30
|
+
return (_jsx(_Fragment, { children: snapLines.map((line, index) => line.kind === 'gap' ? (_jsx(Line, { points: gapPoints(line), stroke: gapColor, strokeWidth: 1.5, listening: false }, `snap-line-${index}`)) : (_jsx(Line, { points: line.orientation === 'vertical'
|
|
31
|
+
? [line.position, line.start, line.position, line.end]
|
|
32
|
+
: [line.start, line.position, line.end, line.position], stroke: color, strokeWidth: 1, dash: [4, 4], listening: false }, `snap-line-${index}`))) }));
|
|
33
|
+
}
|
|
34
|
+
export const SnapGuidelines = memo(SnapGuidelinesInner);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UserImagePrimitive - Draggable, transformable user-uploaded image
|
|
3
|
+
*
|
|
4
|
+
* Follows the same pattern as AssetPrimitive but loads from blob URLs
|
|
5
|
+
* instead of pre-registered asset definitions. Uses the instance's
|
|
6
|
+
* width/height directly (already scaled during creation).
|
|
7
|
+
*/
|
|
8
|
+
import { type SnapProps } from '@ggraphic/editor/hooks/useBoxSnap';
|
|
9
|
+
import { type CropAspectId } from '@ggraphic/editor/utils/cropAspect';
|
|
10
|
+
import { type UserImageInstance } from '../utils/userImageUtils.js';
|
|
11
|
+
export interface UserImagePrimitiveProps extends SnapProps {
|
|
12
|
+
userImage: UserImageInstance;
|
|
13
|
+
isSelected: boolean;
|
|
14
|
+
onSelect: (id: string) => void;
|
|
15
|
+
onDragEnd: (x: number, y: number) => void;
|
|
16
|
+
onTransformEnd: (x: number, y: number, width: number, height: number, rotation: number) => void;
|
|
17
|
+
/** One atomic image update for a moved photo or a resized crop window. */
|
|
18
|
+
onCropEnd?: (patch: Partial<UserImageInstance>) => void;
|
|
19
|
+
/** Ausschnitt mode (Canva's crop): double-click or the context bar's button turns it on. */
|
|
20
|
+
isCropping?: boolean;
|
|
21
|
+
onCroppingChange?: (on: boolean) => void;
|
|
22
|
+
/** Seitenverhältnis-Vorgabe des Zuschneide-Modus: setzt den Rahmen und hält ihn beim Ziehen. */
|
|
23
|
+
cropAspect?: CropAspectId;
|
|
24
|
+
draggable?: boolean;
|
|
25
|
+
/** The page's colour world; an empty slot takes the colours of its placeholder from it. */
|
|
26
|
+
brandScheme?: string | null;
|
|
27
|
+
}
|
|
28
|
+
declare function UserImagePrimitiveInner({ userImage, isSelected, onSelect, onDragEnd, onTransformEnd, onCropEnd, isCropping: cropping, onCroppingChange, cropAspect, draggable, brandScheme, ...snapProps }: UserImagePrimitiveProps): import("react").JSX.Element | null;
|
|
29
|
+
export declare const UserImagePrimitive: import("react").MemoExoticComponent<typeof UserImagePrimitiveInner>;
|
|
30
|
+
export {};
|