@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,197 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* State Type Assertions for Canvas Editor
|
|
4
|
+
*
|
|
5
|
+
* Centralizes type assertions for dynamic state access in the config-driven canvas system.
|
|
6
|
+
* The canvas editor uses TState = Record<string, unknown> generics, which means
|
|
7
|
+
* state[key] returns 'unknown'. These utilities provide type-safe extraction with
|
|
8
|
+
* runtime validation and sensible defaults.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Instead of: const scale = state[config.scaleKey] as number ?? 1;
|
|
12
|
+
* // Use: const scale = assertAsNumber(state[config.scaleKey], 1);
|
|
13
|
+
*/
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// PRIMITIVE TYPE ASSERTIONS
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Safely extract a number from unknown state value
|
|
19
|
+
*/
|
|
20
|
+
export function assertAsNumber(value, fallback = 0) {
|
|
21
|
+
if (typeof value === 'number' && !Number.isNaN(value))
|
|
22
|
+
return value;
|
|
23
|
+
if (typeof value === 'string') {
|
|
24
|
+
const parsed = parseFloat(value);
|
|
25
|
+
if (!Number.isNaN(parsed))
|
|
26
|
+
return parsed;
|
|
27
|
+
}
|
|
28
|
+
return fallback;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Safely extract a boolean from unknown state value
|
|
32
|
+
*/
|
|
33
|
+
export function assertAsBoolean(value, fallback = false) {
|
|
34
|
+
if (typeof value === 'boolean')
|
|
35
|
+
return value;
|
|
36
|
+
if (value === 'true')
|
|
37
|
+
return true;
|
|
38
|
+
if (value === 'false')
|
|
39
|
+
return false;
|
|
40
|
+
return fallback;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Safely extract a string from unknown state value
|
|
44
|
+
*/
|
|
45
|
+
export function assertAsString(value, fallback = '') {
|
|
46
|
+
if (typeof value === 'string')
|
|
47
|
+
return value;
|
|
48
|
+
if (value !== null && value !== undefined)
|
|
49
|
+
return String(value);
|
|
50
|
+
return fallback;
|
|
51
|
+
}
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// OBJECT TYPE ASSERTIONS
|
|
54
|
+
// ============================================================================
|
|
55
|
+
/**
|
|
56
|
+
* Safely extract a position object { x, y } from unknown state value
|
|
57
|
+
*/
|
|
58
|
+
export function assertAsPosition(value, fallback = { x: 0, y: 0 }) {
|
|
59
|
+
if (value && typeof value === 'object' && 'x' in value && 'y' in value) {
|
|
60
|
+
const obj = value;
|
|
61
|
+
return {
|
|
62
|
+
x: typeof obj.x === 'number' ? obj.x : fallback.x,
|
|
63
|
+
y: typeof obj.y === 'number' ? obj.y : fallback.y,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return fallback;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Safely extract a size object { w, h } from unknown state value
|
|
70
|
+
*/
|
|
71
|
+
export function assertAsSize(value, fallback = { w: 0, h: 0 }) {
|
|
72
|
+
if (value && typeof value === 'object' && 'w' in value && 'h' in value) {
|
|
73
|
+
const obj = value;
|
|
74
|
+
return {
|
|
75
|
+
w: typeof obj.w === 'number' ? obj.w : fallback.w,
|
|
76
|
+
h: typeof obj.h === 'number' ? obj.h : fallback.h,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return fallback;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Safely extract dimensions { width, height } from unknown state value
|
|
83
|
+
*/
|
|
84
|
+
export function assertAsDimensions(value, fallback = { width: 0, height: 0 }) {
|
|
85
|
+
if (value && typeof value === 'object' && 'width' in value && 'height' in value) {
|
|
86
|
+
const obj = value;
|
|
87
|
+
return {
|
|
88
|
+
width: typeof obj.width === 'number' ? obj.width : fallback.width,
|
|
89
|
+
height: typeof obj.height === 'number' ? obj.height : fallback.height,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return fallback;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Safely extract an offset object { x, y } (alias for position, semantic clarity)
|
|
96
|
+
*/
|
|
97
|
+
export const assertAsOffset = assertAsPosition;
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// ARRAY TYPE ASSERTIONS
|
|
100
|
+
// ============================================================================
|
|
101
|
+
/**
|
|
102
|
+
* Safely extract a string array from unknown state value
|
|
103
|
+
*/
|
|
104
|
+
export function assertAsStringArray(value, fallback = []) {
|
|
105
|
+
if (Array.isArray(value)) {
|
|
106
|
+
return value.filter((item) => typeof item === 'string');
|
|
107
|
+
}
|
|
108
|
+
return fallback;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Safely extract a number array from unknown state value
|
|
112
|
+
*/
|
|
113
|
+
export function assertAsNumberArray(value, fallback = []) {
|
|
114
|
+
if (Array.isArray(value)) {
|
|
115
|
+
return value.filter((item) => typeof item === 'number');
|
|
116
|
+
}
|
|
117
|
+
return fallback;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Safely extract a tuple of 3 numbers (common for bar offsets)
|
|
121
|
+
*/
|
|
122
|
+
export function assertAsNumberTuple3(value, fallback = [0, 0, 0]) {
|
|
123
|
+
if (Array.isArray(value) && value.length >= 3) {
|
|
124
|
+
return [
|
|
125
|
+
typeof value[0] === 'number' ? value[0] : fallback[0],
|
|
126
|
+
typeof value[1] === 'number' ? value[1] : fallback[1],
|
|
127
|
+
typeof value[2] === 'number' ? value[2] : fallback[2],
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
return fallback;
|
|
131
|
+
}
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// GENERIC STATE ACCESS
|
|
134
|
+
// ============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Get a typed value from state by key, with fallback
|
|
137
|
+
* Use when you know the expected type at call site
|
|
138
|
+
*/
|
|
139
|
+
export function getStateValue(state, key, fallback) {
|
|
140
|
+
if (!key)
|
|
141
|
+
return fallback;
|
|
142
|
+
const value = state[key];
|
|
143
|
+
if (value === undefined || value === null)
|
|
144
|
+
return fallback;
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get an optional typed value from state (returns undefined if not present)
|
|
149
|
+
*/
|
|
150
|
+
export function getOptionalStateValue(state, key) {
|
|
151
|
+
if (!key)
|
|
152
|
+
return undefined;
|
|
153
|
+
const value = state[key];
|
|
154
|
+
if (value === undefined || value === null)
|
|
155
|
+
return undefined;
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if a state key exists and has a truthy value
|
|
160
|
+
*/
|
|
161
|
+
export function hasStateValue(state, key) {
|
|
162
|
+
if (!key)
|
|
163
|
+
return false;
|
|
164
|
+
const value = state[key];
|
|
165
|
+
return value !== undefined && value !== null;
|
|
166
|
+
}
|
|
167
|
+
// ============================================================================
|
|
168
|
+
// SPECIALIZED CANVAS ASSERTIONS
|
|
169
|
+
// ============================================================================
|
|
170
|
+
/**
|
|
171
|
+
* Assert a color value (string or undefined)
|
|
172
|
+
*/
|
|
173
|
+
export function assertAsColor(value, fallback) {
|
|
174
|
+
if (typeof value === 'string' && value.length > 0)
|
|
175
|
+
return value;
|
|
176
|
+
return fallback;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Assert an opacity value (number between 0 and 1)
|
|
180
|
+
*/
|
|
181
|
+
export function assertAsOpacity(value, fallback = 1) {
|
|
182
|
+
const num = assertAsNumber(value, fallback);
|
|
183
|
+
return Math.max(0, Math.min(1, num));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Assert a scale value (positive number)
|
|
187
|
+
*/
|
|
188
|
+
export function assertAsScale(value, fallback = 1) {
|
|
189
|
+
const num = assertAsNumber(value, fallback);
|
|
190
|
+
return Math.max(0.01, num); // Minimum scale to prevent invisible elements
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Assert a rotation value (in degrees)
|
|
194
|
+
*/
|
|
195
|
+
export function assertAsRotation(value, fallback = 0) {
|
|
196
|
+
return assertAsNumber(value, fallback);
|
|
197
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Mirror, type Rect, type Size } from './coverFit.js';
|
|
2
|
+
import type Konva from 'konva';
|
|
3
|
+
export declare const STRAIGHTEN_LIMIT = 45;
|
|
4
|
+
interface Point {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function clampStraighten(value: number): number;
|
|
9
|
+
/** `null` heißt: nie begradigt — der alte Zeichenweg, unverändert. */
|
|
10
|
+
export declare function storedStraighten(value: unknown): number | null;
|
|
11
|
+
export declare const BACKGROUND_STRAIGHTEN_KEY = "backgroundImageRotation";
|
|
12
|
+
export declare function backgroundStraighten(state: Record<string, unknown>): number | null;
|
|
13
|
+
/** Deckt das Foto dieses Rechteck in seinen Achsen, deckt es den ganzen Rahmen. */
|
|
14
|
+
export declare function rotatedExtent(frame: Size, deg: number): Size;
|
|
15
|
+
export declare function minCoverScale(natural: Size, frame: Size, deg: number): number;
|
|
16
|
+
export declare function minStraightenZoom(natural: Size, frame: Size, deg: number): number;
|
|
17
|
+
/** In Fotoachsen geklemmt: dort ist der erlaubte Bereich achsparallel, und Drehen erhält Abstände. */
|
|
18
|
+
export declare function clampStraightCentre(centre: Point, size: Size, deg: number, frame: Rect): Point;
|
|
19
|
+
/** Ohne Korrektur kommt `photo` selbst zurück: bei 0° rendert ein deckendes Foto bytegleich. */
|
|
20
|
+
export declare function straightenPhoto(photo: Rect, deg: number, frame: Rect): Rect;
|
|
21
|
+
export declare function panStraightPhoto(photo: Rect, deg: number, frame: Rect, dx: number, dy: number): Rect;
|
|
22
|
+
/** Zoom um die Rahmenmitte: was man sieht, bleibt mittig. */
|
|
23
|
+
export declare function zoomStraightPhoto(photo: Rect, factor: number, deg: number, frame: Rect): Rect;
|
|
24
|
+
/** Hintergrund: der Fenster-Zoom setzt auf dem Mindestzoom des Winkels auf, sonst bliebe der Zoom-Regler darunter wirkungslos. */
|
|
25
|
+
export declare function straightenWindowPhoto(natural: Size, photo: Rect, deg: number, frame: Rect): Rect;
|
|
26
|
+
export declare function windowPhotoOfStraight(natural: Size, straight: Rect, deg: number, frame: Rect): Rect;
|
|
27
|
+
export declare function straightPhotoCovers(photo: Rect, deg: number, frame: Rect, epsilon?: number): boolean;
|
|
28
|
+
export declare function clampPointToStraightPhoto(point: Point, photo: Rect, deg: number): Point;
|
|
29
|
+
/** Eigenes Bild: `pan` ist der Anteil am Spielraum in Fotoachsen, damit Zurückdrehen den Ausschnitt wiederfindet. */
|
|
30
|
+
export declare function straightFramedPhoto(natural: Size, frame: Size, pan: Point, zoom: number, deg: number): Rect;
|
|
31
|
+
/** Eine Achse ohne Spielraum sagt nichts über den Anteil; dort bleibt `kept`. */
|
|
32
|
+
export declare function panOfStraightPhoto(photo: Rect, deg: number, frame: Size, kept?: Point): Point;
|
|
33
|
+
export declare function frameForAspectOnStraightPhoto(frame: Rect, photo: Rect, deg: number, ratio: number): Rect;
|
|
34
|
+
/** Knoten-lokal; x/y ist die Mitte des Fotos. */
|
|
35
|
+
export interface StraightDraw {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
rotation: number;
|
|
41
|
+
}
|
|
42
|
+
/** Der Flip-Filter spiegelt danach den Knoten; daher hier Lage gespiegelt, Winkel je Achse umgekehrt. */
|
|
43
|
+
export declare function straightDrawOf(photo: Rect, deg: number, box: Rect, mirror: Mirror | null): StraightDraw;
|
|
44
|
+
export declare const STRAIGHT_DRAW_ATTR = "straightDraw";
|
|
45
|
+
/** Konvas `crop` schneidet nur achsparallel aus; das gedrehte Foto zeichnet diese Funktion. */
|
|
46
|
+
export declare function straightSceneFunc(context: Konva.Context, shape: Konva.Shape): void;
|
|
47
|
+
/** Trägt nur den Maßstab: `printImageInfo` liest `cropWidth` für die Druck-DPI. */
|
|
48
|
+
export declare function straightScaleCrop(natural: Size, photo: Rect, box: Rect): Rect;
|
|
49
|
+
/** Ein neues Hintergrundfoto beginnt ungedreht; 0 statt Löschen hält ein gedreht verschobenes Fenster auf Deckung. */
|
|
50
|
+
export declare function straightenResetFor(state: Record<string, unknown>): Record<string, number>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
// Begradigen. Gedrehte Fotos sind Rechtecke ihrer ungedrehten Lage, gedreht um die Mitte (Grad, wie Konva).
|
|
3
|
+
import { cornersOf, hasCorners, traceRoundedRect } from './cornerRadius.js';
|
|
4
|
+
import { coverPhotoRect, framedPhotoRect, panOfFramedPhoto, } from './coverFit.js';
|
|
5
|
+
export const STRAIGHTEN_LIMIT = 45;
|
|
6
|
+
export function clampStraighten(value) {
|
|
7
|
+
if (!Number.isFinite(value))
|
|
8
|
+
return 0;
|
|
9
|
+
return Math.max(-STRAIGHTEN_LIMIT, Math.min(STRAIGHTEN_LIMIT, Math.round(value))) || 0;
|
|
10
|
+
}
|
|
11
|
+
/** `null` heißt: nie begradigt — der alte Zeichenweg, unverändert. */
|
|
12
|
+
export function storedStraighten(value) {
|
|
13
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
14
|
+
}
|
|
15
|
+
// Wer `imageOffset`/`imageScale` liest, muss diesen Winkel beachten (`straightenWindowPhoto`): gedreht verschoben liegt das Fenster außerhalb der 0°-Grenzen.
|
|
16
|
+
export const BACKGROUND_STRAIGHTEN_KEY = 'backgroundImageRotation';
|
|
17
|
+
export function backgroundStraighten(state) {
|
|
18
|
+
return storedStraighten(state[BACKGROUND_STRAIGHTEN_KEY]);
|
|
19
|
+
}
|
|
20
|
+
const radians = (deg) => (deg * Math.PI) / 180;
|
|
21
|
+
function toPhotoAxes(v, deg) {
|
|
22
|
+
const r = radians(deg);
|
|
23
|
+
const cos = Math.cos(r);
|
|
24
|
+
const sin = Math.sin(r);
|
|
25
|
+
return { x: v.x * cos + v.y * sin, y: -v.x * sin + v.y * cos };
|
|
26
|
+
}
|
|
27
|
+
function toPageAxes(v, deg) {
|
|
28
|
+
const r = radians(deg);
|
|
29
|
+
const cos = Math.cos(r);
|
|
30
|
+
const sin = Math.sin(r);
|
|
31
|
+
return { x: v.x * cos - v.y * sin, y: v.x * sin + v.y * cos };
|
|
32
|
+
}
|
|
33
|
+
const centreOf = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
|
|
34
|
+
/** Deckt das Foto dieses Rechteck in seinen Achsen, deckt es den ganzen Rahmen. */
|
|
35
|
+
export function rotatedExtent(frame, deg) {
|
|
36
|
+
const r = radians(deg);
|
|
37
|
+
const cos = Math.abs(Math.cos(r));
|
|
38
|
+
const sin = Math.abs(Math.sin(r));
|
|
39
|
+
return {
|
|
40
|
+
width: frame.width * cos + frame.height * sin,
|
|
41
|
+
height: frame.width * sin + frame.height * cos,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function minCoverScale(natural, frame, deg) {
|
|
45
|
+
const extent = rotatedExtent(frame, deg);
|
|
46
|
+
return Math.max(extent.width / natural.width, extent.height / natural.height);
|
|
47
|
+
}
|
|
48
|
+
export function minStraightenZoom(natural, frame, deg) {
|
|
49
|
+
return minCoverScale(natural, frame, deg) / minCoverScale(natural, frame, 0);
|
|
50
|
+
}
|
|
51
|
+
function slackOf(size, frame, deg) {
|
|
52
|
+
const extent = rotatedExtent(frame, deg);
|
|
53
|
+
return {
|
|
54
|
+
x: Math.max(0, (size.width - extent.width) / 2),
|
|
55
|
+
y: Math.max(0, (size.height - extent.height) / 2),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const clampTo = (v, limit) => Math.max(-limit, Math.min(limit, v));
|
|
59
|
+
/** In Fotoachsen geklemmt: dort ist der erlaubte Bereich achsparallel, und Drehen erhält Abstände. */
|
|
60
|
+
export function clampStraightCentre(centre, size, deg, frame) {
|
|
61
|
+
const middle = centreOf(frame);
|
|
62
|
+
const local = toPhotoAxes({ x: centre.x - middle.x, y: centre.y - middle.y }, deg);
|
|
63
|
+
const slack = slackOf(size, frame, deg);
|
|
64
|
+
const held = { x: clampTo(local.x, slack.x), y: clampTo(local.y, slack.y) };
|
|
65
|
+
if (held.x === local.x && held.y === local.y)
|
|
66
|
+
return centre;
|
|
67
|
+
const page = toPageAxes(held, deg);
|
|
68
|
+
return { x: middle.x + page.x, y: middle.y + page.y };
|
|
69
|
+
}
|
|
70
|
+
/** Ohne Korrektur kommt `photo` selbst zurück: bei 0° rendert ein deckendes Foto bytegleich. */
|
|
71
|
+
export function straightenPhoto(photo, deg, frame) {
|
|
72
|
+
const extent = rotatedExtent(frame, deg);
|
|
73
|
+
const grow = Math.max(1, extent.width / photo.width, extent.height / photo.height);
|
|
74
|
+
const size = { width: photo.width * grow, height: photo.height * grow };
|
|
75
|
+
const centre = centreOf(photo);
|
|
76
|
+
const held = clampStraightCentre(centre, size, deg, frame);
|
|
77
|
+
if (grow === 1 && held === centre)
|
|
78
|
+
return photo;
|
|
79
|
+
return { x: held.x - size.width / 2, y: held.y - size.height / 2, ...size };
|
|
80
|
+
}
|
|
81
|
+
export function panStraightPhoto(photo, deg, frame, dx, dy) {
|
|
82
|
+
const centre = centreOf(photo);
|
|
83
|
+
const held = clampStraightCentre({ x: centre.x + dx, y: centre.y + dy }, photo, deg, frame);
|
|
84
|
+
return { ...photo, x: held.x - photo.width / 2, y: held.y - photo.height / 2 };
|
|
85
|
+
}
|
|
86
|
+
/** Zoom um die Rahmenmitte: was man sieht, bleibt mittig. */
|
|
87
|
+
export function zoomStraightPhoto(photo, factor, deg, frame) {
|
|
88
|
+
const middle = centreOf(frame);
|
|
89
|
+
const centre = centreOf(photo);
|
|
90
|
+
const width = photo.width * factor;
|
|
91
|
+
const height = photo.height * factor;
|
|
92
|
+
const zoomed = {
|
|
93
|
+
x: middle.x + (centre.x - middle.x) * factor - width / 2,
|
|
94
|
+
y: middle.y + (centre.y - middle.y) * factor - height / 2,
|
|
95
|
+
width,
|
|
96
|
+
height,
|
|
97
|
+
};
|
|
98
|
+
return straightenPhoto(zoomed, deg, frame);
|
|
99
|
+
}
|
|
100
|
+
function scaledAbout(photo, factor) {
|
|
101
|
+
const centre = centreOf(photo);
|
|
102
|
+
const width = photo.width * factor;
|
|
103
|
+
const height = photo.height * factor;
|
|
104
|
+
return { x: centre.x - width / 2, y: centre.y - height / 2, width, height };
|
|
105
|
+
}
|
|
106
|
+
/** Hintergrund: der Fenster-Zoom setzt auf dem Mindestzoom des Winkels auf, sonst bliebe der Zoom-Regler darunter wirkungslos. */
|
|
107
|
+
export function straightenWindowPhoto(natural, photo, deg, frame) {
|
|
108
|
+
const floor = minStraightenZoom(natural, frame, deg);
|
|
109
|
+
return straightenPhoto(floor === 1 ? photo : scaledAbout(photo, floor), deg, frame);
|
|
110
|
+
}
|
|
111
|
+
export function windowPhotoOfStraight(natural, straight, deg, frame) {
|
|
112
|
+
const floor = minStraightenZoom(natural, frame, deg);
|
|
113
|
+
return floor === 1 ? straight : scaledAbout(straight, 1 / floor);
|
|
114
|
+
}
|
|
115
|
+
export function straightPhotoCovers(photo, deg, frame, epsilon = 0.5) {
|
|
116
|
+
const centre = centreOf(photo);
|
|
117
|
+
const corners = [
|
|
118
|
+
{ x: frame.x, y: frame.y },
|
|
119
|
+
{ x: frame.x + frame.width, y: frame.y },
|
|
120
|
+
{ x: frame.x, y: frame.y + frame.height },
|
|
121
|
+
{ x: frame.x + frame.width, y: frame.y + frame.height },
|
|
122
|
+
];
|
|
123
|
+
return corners.every((corner) => {
|
|
124
|
+
const local = toPhotoAxes({ x: corner.x - centre.x, y: corner.y - centre.y }, deg);
|
|
125
|
+
return (Math.abs(local.x) <= photo.width / 2 + epsilon &&
|
|
126
|
+
Math.abs(local.y) <= photo.height / 2 + epsilon);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export function clampPointToStraightPhoto(point, photo, deg) {
|
|
130
|
+
const centre = centreOf(photo);
|
|
131
|
+
const local = toPhotoAxes({ x: point.x - centre.x, y: point.y - centre.y }, deg);
|
|
132
|
+
const held = { x: clampTo(local.x, photo.width / 2), y: clampTo(local.y, photo.height / 2) };
|
|
133
|
+
if (held.x === local.x && held.y === local.y)
|
|
134
|
+
return point;
|
|
135
|
+
const page = toPageAxes(held, deg);
|
|
136
|
+
return { x: centre.x + page.x, y: centre.y + page.y };
|
|
137
|
+
}
|
|
138
|
+
/** Eigenes Bild: `pan` ist der Anteil am Spielraum in Fotoachsen, damit Zurückdrehen den Ausschnitt wiederfindet. */
|
|
139
|
+
export function straightFramedPhoto(natural, frame, pan, zoom, deg) {
|
|
140
|
+
if (deg === 0)
|
|
141
|
+
return framedPhotoRect(natural, frame, pan, zoom);
|
|
142
|
+
// Ohne max(1, …): ein Rahmen, der gedreht ins Foto passt, darf ungedreht darüber hinausragen.
|
|
143
|
+
const base = coverPhotoRect(natural, frame, zoom > 0 ? zoom : 1);
|
|
144
|
+
const extent = rotatedExtent(frame, deg);
|
|
145
|
+
const grow = Math.max(1, extent.width / base.width, extent.height / base.height);
|
|
146
|
+
const width = base.width * grow;
|
|
147
|
+
const height = base.height * grow;
|
|
148
|
+
const slack = slackOf({ width, height }, frame, deg);
|
|
149
|
+
const local = { x: clampTo(pan.x, 1) * slack.x, y: clampTo(pan.y, 1) * slack.y };
|
|
150
|
+
const page = toPageAxes(local, deg);
|
|
151
|
+
return {
|
|
152
|
+
x: frame.width / 2 + page.x - width / 2,
|
|
153
|
+
y: frame.height / 2 + page.y - height / 2,
|
|
154
|
+
width,
|
|
155
|
+
height,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** Eine Achse ohne Spielraum sagt nichts über den Anteil; dort bleibt `kept`. */
|
|
159
|
+
export function panOfStraightPhoto(photo, deg, frame, kept = { x: 0, y: 0 }) {
|
|
160
|
+
if (deg === 0)
|
|
161
|
+
return panOfFramedPhoto(photo, frame);
|
|
162
|
+
const centre = centreOf(photo);
|
|
163
|
+
const local = toPhotoAxes({ x: centre.x - frame.width / 2, y: centre.y - frame.height / 2 }, deg);
|
|
164
|
+
const slack = slackOf(photo, frame, deg);
|
|
165
|
+
// Unter einem halben Pixel Spielraum ist der Anteil Rauschen.
|
|
166
|
+
return {
|
|
167
|
+
x: slack.x > 0.5 ? clampTo(local.x / slack.x, 1) : kept.x,
|
|
168
|
+
y: slack.y > 0.5 ? clampTo(local.y / slack.y, 1) : kept.y,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export function frameForAspectOnStraightPhoto(frame, photo, deg, ratio) {
|
|
172
|
+
const r = radians(deg);
|
|
173
|
+
const cos = Math.abs(Math.cos(r));
|
|
174
|
+
const sin = Math.abs(Math.sin(r));
|
|
175
|
+
const halfW = photo.width / 2;
|
|
176
|
+
const halfH = photo.height / 2;
|
|
177
|
+
// Ecken (±a, ±a/ratio) in Fotoachsen: |x| = a·cos + b·sin ≤ halfW, |y| = a·sin + b·cos ≤ halfH.
|
|
178
|
+
const a = Math.min(halfW / (cos + sin / ratio), halfH / (sin + cos / ratio));
|
|
179
|
+
const width = 2 * a;
|
|
180
|
+
const height = width / ratio;
|
|
181
|
+
const box = { width, height };
|
|
182
|
+
const free = {
|
|
183
|
+
width: photo.width - 2 * (a * cos + (a / ratio) * sin),
|
|
184
|
+
height: photo.height - 2 * (a * sin + (a / ratio) * cos),
|
|
185
|
+
};
|
|
186
|
+
const centre = centreOf(photo);
|
|
187
|
+
const local = toPhotoAxes({ x: centreOf(frame).x - centre.x, y: centreOf(frame).y - centre.y }, deg);
|
|
188
|
+
const held = toPageAxes({
|
|
189
|
+
x: clampTo(local.x, Math.max(0, free.width / 2)),
|
|
190
|
+
y: clampTo(local.y, Math.max(0, free.height / 2)),
|
|
191
|
+
}, deg);
|
|
192
|
+
return {
|
|
193
|
+
x: centre.x + held.x - box.width / 2,
|
|
194
|
+
y: centre.y + held.y - box.height / 2,
|
|
195
|
+
...box,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/** Der Flip-Filter spiegelt danach den Knoten; daher hier Lage gespiegelt, Winkel je Achse umgekehrt. */
|
|
199
|
+
export function straightDrawOf(photo, deg, box, mirror) {
|
|
200
|
+
const centre = centreOf(photo);
|
|
201
|
+
const x = centre.x - box.x;
|
|
202
|
+
const y = centre.y - box.y;
|
|
203
|
+
const flips = (mirror?.x ? 1 : 0) + (mirror?.y ? 1 : 0);
|
|
204
|
+
return {
|
|
205
|
+
x: mirror?.x ? box.width - x : x,
|
|
206
|
+
y: mirror?.y ? box.height - y : y,
|
|
207
|
+
width: photo.width,
|
|
208
|
+
height: photo.height,
|
|
209
|
+
rotation: flips === 1 ? -deg : deg,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// Ziehen setzt das Attribut direkt, ohne React-Zustand.
|
|
213
|
+
export const STRAIGHT_DRAW_ATTR = 'straightDraw';
|
|
214
|
+
/** Konvas `crop` schneidet nur achsparallel aus; das gedrehte Foto zeichnet diese Funktion. */
|
|
215
|
+
export function straightSceneFunc(context, shape) {
|
|
216
|
+
const image = shape.getAttr('image');
|
|
217
|
+
const draw = shape.getAttr(STRAIGHT_DRAW_ATTR);
|
|
218
|
+
if (!image || !draw)
|
|
219
|
+
return;
|
|
220
|
+
const width = shape.width();
|
|
221
|
+
const height = shape.height();
|
|
222
|
+
const radius = shape.getAttr('cornerRadius');
|
|
223
|
+
context.save();
|
|
224
|
+
context.beginPath();
|
|
225
|
+
if (hasCorners(radius)) {
|
|
226
|
+
traceRoundedRect(context, width, height, cornersOf(radius, width, height));
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
context.rect(0, 0, width, height);
|
|
230
|
+
}
|
|
231
|
+
context.closePath();
|
|
232
|
+
context.clip();
|
|
233
|
+
context.translate(draw.x, draw.y);
|
|
234
|
+
context.rotate(radians(draw.rotation));
|
|
235
|
+
context.drawImage(image, -draw.width / 2, -draw.height / 2, draw.width, draw.height);
|
|
236
|
+
context.restore();
|
|
237
|
+
}
|
|
238
|
+
/** Trägt nur den Maßstab: `printImageInfo` liest `cropWidth` für die Druck-DPI. */
|
|
239
|
+
export function straightScaleCrop(natural, photo, box) {
|
|
240
|
+
const sx = natural.width / photo.width;
|
|
241
|
+
const sy = natural.height / photo.height;
|
|
242
|
+
const width = box.width * sx;
|
|
243
|
+
const height = box.height * sy;
|
|
244
|
+
return {
|
|
245
|
+
x: natural.width / 2 - width / 2,
|
|
246
|
+
y: natural.height / 2 - height / 2,
|
|
247
|
+
width,
|
|
248
|
+
height,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/** Ein neues Hintergrundfoto beginnt ungedreht; 0 statt Löschen hält ein gedreht verschobenes Fenster auf Deckung. */
|
|
252
|
+
export function straightenResetFor(state) {
|
|
253
|
+
return backgroundStraighten(state) !== null ? { [BACKGROUND_STRAIGHTEN_KEY]: 0 } : {};
|
|
254
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The radial glow a stored plane colour is drawn as, centre first — null when
|
|
3
|
+
* it is drawn flat. Read from the registered brand packs' grounds
|
|
4
|
+
* (`registerBrandPacks`). The stored value stays what
|
|
5
|
+
* documents, descriptors and swatches carry; only the paint changes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function surfaceGlow(color: string): readonly string[] | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { registeredBrands } from '@ggraphic/editor/brand/brandRegistry';
|
|
3
|
+
let builtFor = null;
|
|
4
|
+
let glows = new Map();
|
|
5
|
+
/**
|
|
6
|
+
* The radial glow a stored plane colour is drawn as, centre first — null when
|
|
7
|
+
* it is drawn flat. Read from the registered brand packs' grounds
|
|
8
|
+
* (`registerBrandPacks`). The stored value stays what
|
|
9
|
+
* documents, descriptors and swatches carry; only the paint changes.
|
|
10
|
+
*/
|
|
11
|
+
export function surfaceGlow(color) {
|
|
12
|
+
const packs = registeredBrands();
|
|
13
|
+
if (packs !== builtFor) {
|
|
14
|
+
// Built once per registration. A colour two grounds glow takes the later
|
|
15
|
+
// one, as the table built from the packs did before it was read here.
|
|
16
|
+
const next = new Map();
|
|
17
|
+
for (const pack of packs) {
|
|
18
|
+
for (const ground of pack.backgrounds) {
|
|
19
|
+
if (ground.glow)
|
|
20
|
+
next.set(ground.color.toLowerCase(), ground.glow);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
glows = next;
|
|
24
|
+
builtFor = packs;
|
|
25
|
+
}
|
|
26
|
+
return glows.get(color.toLowerCase()) ?? null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vorlagen-Grafik → Asset-Instanz (#3403).
|
|
3
|
+
*
|
|
4
|
+
* Die Grafiken der Vorlagen und die Grafiken des Bildkatalogs sind DIESELBEN
|
|
5
|
+
* Bilder, zweimal aufgeschrieben: die Vorlage deklariert ein `ImageElementConfig`
|
|
6
|
+
* mit fester Breite/Hoehe, der Katalog eine `UniversalAsset` mit einer `src`.
|
|
7
|
+
* Sie gleichen sich ueber genau diese `src` ab.
|
|
8
|
+
*
|
|
9
|
+
* Beim Duplizieren wird aus der einen die andere. Der harte Teil ist nicht die
|
|
10
|
+
* Identitaet, sondern die Geometrie — die beiden Darstellungen messen anders:
|
|
11
|
+
*
|
|
12
|
+
* | | Vorlagen-Element | Asset-Instanz |
|
|
13
|
+
* |---|---|---|
|
|
14
|
+
* | Anker | oben links | **Mitte** |
|
|
15
|
+
* | Groesse | `width`/`height` in Pixeln | `scale` gegen `ASSET_TARGET_SIZE` |
|
|
16
|
+
*
|
|
17
|
+
* `AssetPrimitive` normalisiert jedes Bild so, dass seine LAENGERE Seite bei
|
|
18
|
+
* `scale: 1` genau `ASSET_TARGET_SIZE` misst. Die Umrechnung ist deshalb
|
|
19
|
+
* `scale = max(width, height) / ASSET_TARGET_SIZE` und die Mitte der Schachtel.
|
|
20
|
+
* Exakt ist das, solange die Vorlage das natuerliche Seitenverhaeltnis
|
|
21
|
+
* respektiert; wo sie es nicht tut (ein quadratischer Platz fuer ein nicht
|
|
22
|
+
* quadratisches Logo), zeichnet die Vorlage verzerrt und die Kopie nicht — sie
|
|
23
|
+
* passt dann auf der laengeren Seite und ist auf der kuerzeren schmaler.
|
|
24
|
+
*
|
|
25
|
+
* Nicht umgerechnet wird, was keine Entsprechung im Katalog hat: das Foto der
|
|
26
|
+
* Nutzer*in (`srcKey`), die Info-Hintergruende (die sind ohnehin nicht
|
|
27
|
+
* auswaehlbar) und jedes Vorlagen-Element, das kein Bild ist. Vorlagen-TEXTE
|
|
28
|
+
* bleiben ebenfalls aussen vor: `AdditionalText` kennt weder `align` noch
|
|
29
|
+
* `lineHeight`, eine zentrierte Headline kaeme also linksbuendig heraus.
|
|
30
|
+
*/
|
|
31
|
+
import type { DuplicableEntry } from './duplicateElement.js';
|
|
32
|
+
import type { CanvasElementConfig, LayoutResult } from '../configs/types.js';
|
|
33
|
+
/**
|
|
34
|
+
* Die Instanz, die aus diesem Vorlagen-Element wird — oder `null`, wenn es
|
|
35
|
+
* keine gibt. Der Versatz der Kopie kommt nicht von hier: den legt
|
|
36
|
+
* `insertInstance` ueber die Nutzlast, wie bei jeder anderen Art auch.
|
|
37
|
+
*/
|
|
38
|
+
export declare function templateElementToEntry<TState extends Record<string, unknown>>(element: CanvasElementConfig<TState>, state: TState, layout: LayoutResult): DuplicableEntry | null;
|
|
39
|
+
/**
|
|
40
|
+
* Findet das Vorlagen-Element mit dieser ID und macht eine Instanz daraus.
|
|
41
|
+
* Speist sowohl den Aktiv-Zustand des Duplizieren-Knopfes als auch die Tat.
|
|
42
|
+
*/
|
|
43
|
+
export declare function findTemplateEntry<TState extends Record<string, unknown>>(elements: readonly CanvasElementConfig<TState>[] | undefined, state: TState, layout: LayoutResult | undefined, elementId: string): DuplicableEntry | null;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Vorlagen-Grafik → Asset-Instanz (#3403).
|
|
4
|
+
*
|
|
5
|
+
* Die Grafiken der Vorlagen und die Grafiken des Bildkatalogs sind DIESELBEN
|
|
6
|
+
* Bilder, zweimal aufgeschrieben: die Vorlage deklariert ein `ImageElementConfig`
|
|
7
|
+
* mit fester Breite/Hoehe, der Katalog eine `UniversalAsset` mit einer `src`.
|
|
8
|
+
* Sie gleichen sich ueber genau diese `src` ab.
|
|
9
|
+
*
|
|
10
|
+
* Beim Duplizieren wird aus der einen die andere. Der harte Teil ist nicht die
|
|
11
|
+
* Identitaet, sondern die Geometrie — die beiden Darstellungen messen anders:
|
|
12
|
+
*
|
|
13
|
+
* | | Vorlagen-Element | Asset-Instanz |
|
|
14
|
+
* |---|---|---|
|
|
15
|
+
* | Anker | oben links | **Mitte** |
|
|
16
|
+
* | Groesse | `width`/`height` in Pixeln | `scale` gegen `ASSET_TARGET_SIZE` |
|
|
17
|
+
*
|
|
18
|
+
* `AssetPrimitive` normalisiert jedes Bild so, dass seine LAENGERE Seite bei
|
|
19
|
+
* `scale: 1` genau `ASSET_TARGET_SIZE` misst. Die Umrechnung ist deshalb
|
|
20
|
+
* `scale = max(width, height) / ASSET_TARGET_SIZE` und die Mitte der Schachtel.
|
|
21
|
+
* Exakt ist das, solange die Vorlage das natuerliche Seitenverhaeltnis
|
|
22
|
+
* respektiert; wo sie es nicht tut (ein quadratischer Platz fuer ein nicht
|
|
23
|
+
* quadratisches Logo), zeichnet die Vorlage verzerrt und die Kopie nicht — sie
|
|
24
|
+
* passt dann auf der laengeren Seite und ist auf der kuerzeren schmaler.
|
|
25
|
+
*
|
|
26
|
+
* Nicht umgerechnet wird, was keine Entsprechung im Katalog hat: das Foto der
|
|
27
|
+
* Nutzer*in (`srcKey`), die Info-Hintergruende (die sind ohnehin nicht
|
|
28
|
+
* auswaehlbar) und jedes Vorlagen-Element, das kein Bild ist. Vorlagen-TEXTE
|
|
29
|
+
* bleiben ebenfalls aussen vor: `AdditionalText` kennt weder `align` noch
|
|
30
|
+
* `lineHeight`, eine zentrierte Headline kaeme also linksbuendig heraus.
|
|
31
|
+
*/
|
|
32
|
+
import { centreOf } from '@ggraphic/editor/utils/orientation';
|
|
33
|
+
import { ASSET_TARGET_SIZE, getAssetBySrc } from './canvasAssets.js';
|
|
34
|
+
import { resolveImageElementBox } from './resolveElementValue.js';
|
|
35
|
+
import { templateRotationOf } from './templateRotation.js';
|
|
36
|
+
/** Die Quelle eines Vorlagen-Bildes, soweit sie ohne Zustandsschluessel feststeht. */
|
|
37
|
+
function staticSrc(config, state) {
|
|
38
|
+
// `srcKey` zeigt auf ein hochgeladenes Bild — das gehoert in keinen Katalog.
|
|
39
|
+
if (config.srcKey || !config.src)
|
|
40
|
+
return null;
|
|
41
|
+
return typeof config.src === 'function' ? config.src(state) : config.src;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Die Instanz, die aus diesem Vorlagen-Element wird — oder `null`, wenn es
|
|
45
|
+
* keine gibt. Der Versatz der Kopie kommt nicht von hier: den legt
|
|
46
|
+
* `insertInstance` ueber die Nutzlast, wie bei jeder anderen Art auch.
|
|
47
|
+
*/
|
|
48
|
+
export function templateElementToEntry(element, state, layout) {
|
|
49
|
+
if (element.type !== 'image')
|
|
50
|
+
return null;
|
|
51
|
+
const config = element;
|
|
52
|
+
const src = staticSrc(config, state);
|
|
53
|
+
if (!src)
|
|
54
|
+
return null;
|
|
55
|
+
const asset = getAssetBySrc(src);
|
|
56
|
+
if (!asset)
|
|
57
|
+
return null;
|
|
58
|
+
const box = resolveImageElementBox(config, state, layout);
|
|
59
|
+
if (!(box.width > 0) || !(box.height > 0))
|
|
60
|
+
return null;
|
|
61
|
+
// Die Vorlage dreht um oben links, die Instanz um ihre Mitte: die Kopie
|
|
62
|
+
// sitzt auf der gedrehten Mitte, sonst wanderte sie um die halbe Diagonale.
|
|
63
|
+
const rotation = templateRotationOf(state, element.id);
|
|
64
|
+
const centre = centreOf({
|
|
65
|
+
x: box.x,
|
|
66
|
+
y: box.y,
|
|
67
|
+
rotation,
|
|
68
|
+
scaleX: 1,
|
|
69
|
+
scaleY: 1,
|
|
70
|
+
offsetX: 0,
|
|
71
|
+
offsetY: 0,
|
|
72
|
+
local: { x: 0, y: 0, width: box.width, height: box.height },
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
type: 'asset',
|
|
76
|
+
data: {
|
|
77
|
+
// Die ID vergibt `insertInstance`; hier steht ein Platzhalter, damit die
|
|
78
|
+
// Nutzlast dieselbe Form hat wie eine aus dem Zustand gelesene Instanz.
|
|
79
|
+
id: element.id,
|
|
80
|
+
assetId: asset.id,
|
|
81
|
+
x: centre.x,
|
|
82
|
+
y: centre.y,
|
|
83
|
+
scale: Math.max(box.width, box.height) / ASSET_TARGET_SIZE,
|
|
84
|
+
rotation,
|
|
85
|
+
opacity: box.opacity,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Findet das Vorlagen-Element mit dieser ID und macht eine Instanz daraus.
|
|
91
|
+
* Speist sowohl den Aktiv-Zustand des Duplizieren-Knopfes als auch die Tat.
|
|
92
|
+
*/
|
|
93
|
+
export function findTemplateEntry(elements, state, layout, elementId) {
|
|
94
|
+
if (!elements || !layout)
|
|
95
|
+
return null;
|
|
96
|
+
const element = elements.find((e) => e.id === elementId);
|
|
97
|
+
if (!element)
|
|
98
|
+
return null;
|
|
99
|
+
return templateElementToEntry(element, state, layout);
|
|
100
|
+
}
|