@ggraphic/editor 0.0.0-stage → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/NOTICE +2 -0
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES +7 -0
- package/dist/CanvasEditorProvider.d.ts +214 -0
- package/dist/CanvasEditorProvider.js +10 -0
- package/dist/ai/applyOperation.d.ts +75 -0
- package/dist/ai/applyOperation.js +354 -0
- package/dist/ai/describeCanvasElements.d.ts +17 -0
- package/dist/ai/describeCanvasElements.js +148 -0
- package/dist/ai/illustrationCapability.d.ts +6 -0
- package/dist/ai/illustrationCapability.js +20 -0
- package/dist/ai/types.d.ts +91 -0
- package/dist/ai/types.js +1 -0
- package/dist/blocks/liftedBlock.d.ts +61 -0
- package/dist/blocks/liftedBlock.js +117 -0
- package/dist/brand/bindPick.d.ts +18 -0
- package/dist/brand/bindPick.js +28 -0
- package/dist/brand/bindableFields.d.ts +9 -0
- package/dist/brand/bindableFields.js +61 -0
- package/dist/brand/brandRegistry.d.ts +26 -0
- package/dist/brand/brandRegistry.js +56 -0
- package/dist/brand/composerBrand.d.ts +146 -0
- package/dist/brand/composerBrand.js +6 -0
- package/dist/brand/documentBrand.d.ts +16 -0
- package/dist/brand/documentBrand.js +6 -0
- package/dist/collab/documentVersion.d.ts +36 -0
- package/dist/collab/documentVersion.js +139 -0
- package/dist/collab/pageElementStateKeys.d.ts +33 -0
- package/dist/collab/pageElementStateKeys.js +148 -0
- package/dist/collab/pagesDoc.d.ts +152 -0
- package/dist/collab/pagesDoc.js +434 -0
- package/dist/collab/useAwarenessState.d.ts +12 -0
- package/dist/collab/useAwarenessState.js +47 -0
- package/dist/collab/useEmitHostStateChanges.d.ts +18 -0
- package/dist/collab/useEmitHostStateChanges.js +40 -0
- package/dist/collab/useSelectionAwareness.d.ts +22 -0
- package/dist/collab/useSelectionAwareness.js +60 -0
- package/dist/collab/useYjsCanvasBinding.d.ts +7 -0
- package/dist/collab/useYjsCanvasBinding.js +21 -0
- package/dist/collab/useYjsPageStateSync.d.ts +20 -0
- package/dist/collab/useYjsPageStateSync.js +49 -0
- package/dist/collab/useYjsPages.d.ts +73 -0
- package/dist/collab/useYjsPages.js +396 -0
- package/dist/collab/wrapCallbacksWithPageSync.d.ts +3 -0
- package/dist/collab/wrapCallbacksWithPageSync.js +62 -0
- package/dist/collab/ydocKeys.d.ts +50 -0
- package/dist/collab/ydocKeys.js +50 -0
- package/dist/collab/yjsBinding.d.ts +27 -0
- package/dist/collab/yjsBinding.js +105 -0
- package/dist/common/Lightbox.d.ts +8 -0
- package/dist/common/Lightbox.js +8 -0
- package/dist/common/imageSourceTypes.d.ts +1 -0
- package/dist/common/imageSourceTypes.js +1 -0
- package/dist/components/AddPageButton.d.ts +13 -0
- package/dist/components/AddPageButton.js +13 -0
- package/dist/components/CanvasAnnouncer.d.ts +8 -0
- package/dist/components/CanvasAnnouncer.js +10 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.d.ts +12 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.js +145 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.d.ts +33 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.js +107 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.d.ts +68 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.js +203 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.d.ts +32 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.js +1144 -0
- package/dist/components/CanvasEditor/PageWrapper.d.ts +7 -0
- package/dist/components/CanvasEditor/PageWrapper.js +103 -0
- package/dist/components/CanvasEditor/autoSwitchTab.d.ts +11 -0
- package/dist/components/CanvasEditor/autoSwitchTab.js +15 -0
- package/dist/components/CanvasEditor/blockInsertContext.d.ts +22 -0
- package/dist/components/CanvasEditor/blockInsertContext.js +5 -0
- package/dist/components/CanvasEditor/editorShell.d.ts +99 -0
- package/dist/components/CanvasEditor/editorShell.js +20 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.d.ts +32 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.js +140 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.d.ts +13 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.js +29 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.d.ts +14 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.js +56 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.d.ts +18 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.js +36 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.d.ts +25 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.js +49 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.js +70 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.js +31 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.d.ts +75 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.js +69 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.d.ts +6 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.js +56 -0
- package/dist/components/CanvasEditor/layersTab.d.ts +13 -0
- package/dist/components/CanvasEditor/layersTab.js +27 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.d.ts +8 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.js +27 -0
- package/dist/components/CanvasEditor/types.d.ts +202 -0
- package/dist/components/CanvasEditor/types.js +1 -0
- package/dist/components/CanvasEditorSkeleton.d.ts +16 -0
- package/dist/components/CanvasEditorSkeleton.js +24 -0
- package/dist/components/CanvasMetaBar.d.ts +16 -0
- package/dist/components/CanvasMetaBar.js +33 -0
- package/dist/components/CanvasRenderLayer.d.ts +37 -0
- package/dist/components/CanvasRenderLayer.js +54 -0
- package/dist/components/CanvasTextOverlay.d.ts +126 -0
- package/dist/components/CanvasTextOverlay.js +527 -0
- package/dist/components/ConfigCanvas.d.ts +35 -0
- package/dist/components/ConfigCanvas.js +30 -0
- package/dist/components/CropGhostOverlay.d.ts +13 -0
- package/dist/components/CropGhostOverlay.js +56 -0
- package/dist/components/CustomColorSwatch.d.ts +35 -0
- package/dist/components/CustomColorSwatch.js +81 -0
- package/dist/components/DownloadNotice.d.ts +7 -0
- package/dist/components/DownloadNotice.js +7 -0
- package/dist/components/GenericCanvas.d.ts +309 -0
- package/dist/components/GenericCanvas.js +787 -0
- package/dist/components/GenericCanvasElement.d.ts +34 -0
- package/dist/components/GenericCanvasElement.js +267 -0
- package/dist/components/MultiSelectionTransformer.d.ts +39 -0
- package/dist/components/MultiSelectionTransformer.js +107 -0
- package/dist/components/PagePreview.d.ts +14 -0
- package/dist/components/PagePreview.js +63 -0
- package/dist/components/PageThumbnailStrip.d.ts +25 -0
- package/dist/components/PageThumbnailStrip.js +46 -0
- package/dist/components/PageToolbar.d.ts +12 -0
- package/dist/components/PageToolbar.js +20 -0
- package/dist/components/PrintGuides.d.ts +13 -0
- package/dist/components/PrintGuides.js +28 -0
- package/dist/components/RemoteSelectionOverlay.d.ts +15 -0
- package/dist/components/RemoteSelectionOverlay.js +29 -0
- package/dist/components/RichTextField.d.ts +34 -0
- package/dist/components/RichTextField.js +216 -0
- package/dist/components/SelectionPill.d.ts +56 -0
- package/dist/components/SelectionPill.js +123 -0
- package/dist/components/SlideNotesPanel.d.ts +13 -0
- package/dist/components/SlideNotesPanel.js +28 -0
- package/dist/components/SlotBudgetStatus.d.ts +12 -0
- package/dist/components/SlotBudgetStatus.js +64 -0
- package/dist/components/StandaloneCanvas.d.ts +33 -0
- package/dist/components/StandaloneCanvas.js +61 -0
- package/dist/components/TextFormatButtons.d.ts +61 -0
- package/dist/components/TextFormatButtons.js +107 -0
- package/dist/components/TextFormatControls.d.ts +26 -0
- package/dist/components/TextFormatControls.js +73 -0
- package/dist/components/Toolbar.d.ts +40 -0
- package/dist/components/Toolbar.js +26 -0
- package/dist/components/ToolbarStateBridge.d.ts +72 -0
- package/dist/components/ToolbarStateBridge.js +298 -0
- package/dist/components/TopBar/AutoSaveIndicator.d.ts +8 -0
- package/dist/components/TopBar/AutoSaveIndicator.js +44 -0
- package/dist/components/TopBar/ContextControls.d.ts +107 -0
- package/dist/components/TopBar/ContextControls.js +321 -0
- package/dist/components/TopBar/ContextToolbar.d.ts +14 -0
- package/dist/components/TopBar/ContextToolbar.js +20 -0
- package/dist/components/TopBar/CropModeControls.d.ts +35 -0
- package/dist/components/TopBar/CropModeControls.js +84 -0
- package/dist/components/TopBar/DownloadSection.d.ts +47 -0
- package/dist/components/TopBar/DownloadSection.js +102 -0
- package/dist/components/TopBar/MobileSelectionBar.d.ts +16 -0
- package/dist/components/TopBar/MobileSelectionBar.js +26 -0
- package/dist/components/TopBar/MobileSelectionControls.d.ts +10 -0
- package/dist/components/TopBar/MobileSelectionControls.js +43 -0
- package/dist/components/TopBar/MultiSelectionToolbar.d.ts +19 -0
- package/dist/components/TopBar/MultiSelectionToolbar.js +30 -0
- package/dist/components/TopBar/ShareDropdown.d.ts +54 -0
- package/dist/components/TopBar/ShareDropdown.js +110 -0
- package/dist/components/TopBar/TopBar.d.ts +6 -0
- package/dist/components/TopBar/TopBar.js +6 -0
- package/dist/components/TopBar/barTiles.d.ts +15 -0
- package/dist/components/TopBar/barTiles.js +34 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.d.ts +28 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.js +26 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.js +133 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.d.ts +16 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.js +89 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.d.ts +17 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.js +37 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.d.ts +7 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.js +22 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.js +19 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.js +15 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.js +9 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.js +19 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.js +74 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.d.ts +12 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.js +27 -0
- package/dist/components/TransformHud.d.ts +11 -0
- package/dist/components/TransformHud.js +121 -0
- package/dist/components/WholeTextFormatControls.d.ts +10 -0
- package/dist/components/WholeTextFormatControls.js +37 -0
- package/dist/components/ZoomableViewport.d.ts +6 -0
- package/dist/components/ZoomableViewport.js +4 -0
- package/dist/components/accentMark.d.ts +20 -0
- package/dist/components/accentMark.js +24 -0
- package/dist/components/canvasItemLock.d.ts +13 -0
- package/dist/components/canvasItemLock.js +12 -0
- package/dist/components/kindRenderers.d.ts +118 -0
- package/dist/components/kindRenderers.js +151 -0
- package/dist/components/markColor.d.ts +13 -0
- package/dist/components/markColor.js +21 -0
- package/dist/components/markerMark.d.ts +24 -0
- package/dist/components/markerMark.js +22 -0
- package/dist/composer/cardFollowsText.d.ts +17 -0
- package/dist/composer/cardFollowsText.js +34 -0
- package/dist/composer/marks.d.ts +4 -0
- package/dist/composer/marks.js +15 -0
- package/dist/composer/steckbriefLayout.d.ts +147 -0
- package/dist/composer/steckbriefLayout.js +468 -0
- package/dist/composer/textFit.d.ts +31 -0
- package/dist/composer/textFit.js +89 -0
- package/dist/configs/buildSharepicText.d.ts +5 -0
- package/dist/configs/buildSharepicText.js +58 -0
- package/dist/configs/configLoader.d.ts +34 -0
- package/dist/configs/configLoader.js +60 -0
- package/dist/configs/factory/actionFactories.d.ts +201 -0
- package/dist/configs/factory/actionFactories.js +628 -0
- package/dist/configs/factory/baseTypes.d.ts +150 -0
- package/dist/configs/factory/baseTypes.js +8 -0
- package/dist/configs/factory/carryInstanceState.d.ts +82 -0
- package/dist/configs/factory/carryInstanceState.js +121 -0
- package/dist/configs/factory/createTextElement.d.ts +63 -0
- package/dist/configs/factory/createTextElement.js +63 -0
- package/dist/configs/factory/defineSection.d.ts +45 -0
- package/dist/configs/factory/defineSection.js +45 -0
- package/dist/configs/factory/layoutAccessors.d.ts +15 -0
- package/dist/configs/factory/layoutAccessors.js +20 -0
- package/dist/configs/featureInjector.d.ts +40 -0
- package/dist/configs/featureInjector.js +184 -0
- package/dist/configs/pageInheritance.d.ts +8 -0
- package/dist/configs/pageInheritance.js +82 -0
- package/dist/configs/placeholders.d.ts +14 -0
- package/dist/configs/placeholders.js +33 -0
- package/dist/configs/shareSection.d.ts +11 -0
- package/dist/configs/shareSection.js +65 -0
- package/dist/configs/types.d.ts +431 -0
- package/dist/configs/types.js +1 -0
- package/dist/configs/unifiedTabs.d.ts +26 -0
- package/dist/configs/unifiedTabs.js +6 -0
- package/dist/editorSeamTypes.d.ts +41 -0
- package/dist/editorSeamTypes.js +1 -0
- package/dist/export/pptx/buildPptxModel.d.ts +47 -0
- package/dist/export/pptx/buildPptxModel.js +612 -0
- package/dist/export/pptx/exportPptxDeck.d.ts +26 -0
- package/dist/export/pptx/exportPptxDeck.js +80 -0
- package/dist/export/pptx/pptxFonts.d.ts +26 -0
- package/dist/export/pptx/pptxFonts.js +41 -0
- package/dist/export/pptx/pptxUnits.d.ts +27 -0
- package/dist/export/pptx/pptxUnits.js +54 -0
- package/dist/export/pptx/textModel.d.ts +17 -0
- package/dist/export/pptx/textModel.js +118 -0
- package/dist/export/pptx/types.d.ts +161 -0
- package/dist/export/pptx/types.js +11 -0
- package/dist/export/pptx/writePptx.d.ts +40 -0
- package/dist/export/pptx/writePptx.js +206 -0
- package/dist/export/pptx/writeText.d.ts +19 -0
- package/dist/export/pptx/writeText.js +120 -0
- package/dist/export/printExport.d.ts +42 -0
- package/dist/export/printExport.js +94 -0
- package/dist/export/printPdf.d.ts +103 -0
- package/dist/export/printPdf.js +144 -0
- package/dist/export/slidesPdf.d.ts +9 -0
- package/dist/export/slidesPdf.js +31 -0
- package/dist/formats/index.d.ts +115 -0
- package/dist/formats/index.js +287 -0
- package/dist/groups/pageGroups.d.ts +32 -0
- package/dist/groups/pageGroups.js +91 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/useAiImageGeneration.d.ts +15 -0
- package/dist/hooks/useAiImageGeneration.js +73 -0
- package/dist/hooks/useAnnounce.d.ts +27 -0
- package/dist/hooks/useAnnounce.js +47 -0
- package/dist/hooks/useBoxSnap.d.ts +37 -0
- package/dist/hooks/useBoxSnap.js +49 -0
- package/dist/hooks/useCanvasAutoSave.d.ts +33 -0
- package/dist/hooks/useCanvasAutoSave.js +259 -0
- package/dist/hooks/useCanvasElementHandlers.d.ts +182 -0
- package/dist/hooks/useCanvasElementHandlers.js +326 -0
- package/dist/hooks/useCanvasHistorySetup.d.ts +37 -0
- package/dist/hooks/useCanvasHistorySetup.js +113 -0
- package/dist/hooks/useCanvasInteractions.d.ts +31 -0
- package/dist/hooks/useCanvasInteractions.js +103 -0
- package/dist/hooks/useCanvasKeyboardHandlers.d.ts +37 -0
- package/dist/hooks/useCanvasKeyboardHandlers.js +280 -0
- package/dist/hooks/useCanvasStoreReset.d.ts +25 -0
- package/dist/hooks/useCanvasStoreReset.js +35 -0
- package/dist/hooks/useCanvasUndoRedo.d.ts +34 -0
- package/dist/hooks/useCanvasUndoRedo.js +213 -0
- package/dist/hooks/useContextPress.d.ts +14 -0
- package/dist/hooks/useContextPress.js +45 -0
- package/dist/hooks/useCropSession.d.ts +23 -0
- package/dist/hooks/useCropSession.js +69 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +14 -0
- package/dist/hooks/useDeckAutoSave.d.ts +30 -0
- package/dist/hooks/useDeckAutoSave.js +234 -0
- package/dist/hooks/useDeepSelect.d.ts +18 -0
- package/dist/hooks/useDeepSelect.js +135 -0
- package/dist/hooks/useElementSnapping.d.ts +13 -0
- package/dist/hooks/useElementSnapping.js +26 -0
- package/dist/hooks/useEmojiCatalog.d.ts +3 -0
- package/dist/hooks/useEmojiCatalog.js +13 -0
- package/dist/hooks/useFloatingModuleHandlers.d.ts +52 -0
- package/dist/hooks/useFloatingModuleHandlers.js +285 -0
- package/dist/hooks/useFloatingModuleState.d.ts +83 -0
- package/dist/hooks/useFloatingModuleState.js +250 -0
- package/dist/hooks/useFontGeneration.d.ts +10 -0
- package/dist/hooks/useFontGeneration.js +77 -0
- package/dist/hooks/useFontLoader.d.ts +53 -0
- package/dist/hooks/useFontLoader.js +129 -0
- package/dist/hooks/useGeometryReporter.d.ts +19 -0
- package/dist/hooks/useGeometryReporter.js +41 -0
- package/dist/hooks/useHoverOutline.d.ts +8 -0
- package/dist/hooks/useHoverOutline.js +78 -0
- package/dist/hooks/useIconCatalog.d.ts +12 -0
- package/dist/hooks/useIconCatalog.js +30 -0
- package/dist/hooks/useIconSearch.d.ts +2 -0
- package/dist/hooks/useIconSearch.js +14 -0
- package/dist/hooks/useIconSetsFor.d.ts +8 -0
- package/dist/hooks/useIconSetsFor.js +30 -0
- package/dist/hooks/useImageCoverFit.d.ts +17 -0
- package/dist/hooks/useImageCoverFit.js +35 -0
- package/dist/hooks/useIsCanvasMobile.d.ts +3 -0
- package/dist/hooks/useIsCanvasMobile.js +19 -0
- package/dist/hooks/useMarqueeSelection.d.ts +27 -0
- package/dist/hooks/useMarqueeSelection.js +140 -0
- package/dist/hooks/useMobileSheet.d.ts +48 -0
- package/dist/hooks/useMobileSheet.js +282 -0
- package/dist/hooks/useMultiPageExport.d.ts +30 -0
- package/dist/hooks/useMultiPageExport.js +117 -0
- package/dist/hooks/usePageManager.d.ts +132 -0
- package/dist/hooks/usePageManager.js +399 -0
- package/dist/hooks/usePageThumbnails.d.ts +10 -0
- package/dist/hooks/usePageThumbnails.js +122 -0
- package/dist/hooks/usePaginatedIcons.d.ts +11 -0
- package/dist/hooks/usePaginatedIcons.js +46 -0
- package/dist/hooks/useRovingToolbar.d.ts +17 -0
- package/dist/hooks/useRovingToolbar.js +76 -0
- package/dist/hooks/useSelectionAnnouncement.d.ts +13 -0
- package/dist/hooks/useSelectionAnnouncement.js +68 -0
- package/dist/hooks/useSnapScheduler.d.ts +20 -0
- package/dist/hooks/useSnapScheduler.js +61 -0
- package/dist/hooks/useTrackUnsplashDownload.d.ts +6 -0
- package/dist/hooks/useTrackUnsplashDownload.js +19 -0
- package/dist/hooks/useZoomGestures.d.ts +35 -0
- package/dist/hooks/useZoomGestures.js +185 -0
- package/dist/hostServices.d.ts +308 -0
- package/dist/hostServices.js +107 -0
- package/dist/i18n/de.d.ts +897 -0
- package/dist/i18n/de.js +961 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +949 -0
- package/dist/i18n/messages.d.ts +28 -0
- package/dist/i18n/messages.js +66 -0
- package/dist/layouts/CanvasEditorLayout.d.ts +28 -0
- package/dist/layouts/CanvasEditorLayout.js +56 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/index.js +2 -0
- package/dist/primitives/AssetPrimitive.d.ts +24 -0
- package/dist/primitives/AssetPrimitive.js +158 -0
- package/dist/primitives/CanvasBackground.d.ts +33 -0
- package/dist/primitives/CanvasBackground.js +44 -0
- package/dist/primitives/CanvasIcons.d.ts +19 -0
- package/dist/primitives/CanvasIcons.js +46 -0
- package/dist/primitives/CanvasImage.d.ts +73 -0
- package/dist/primitives/CanvasImage.js +460 -0
- package/dist/primitives/CanvasRichText.d.ts +25 -0
- package/dist/primitives/CanvasRichText.js +284 -0
- package/dist/primitives/CanvasStage.d.ts +84 -0
- package/dist/primitives/CanvasStage.js +292 -0
- package/dist/primitives/CanvasText.d.ts +91 -0
- package/dist/primitives/CanvasText.js +293 -0
- package/dist/primitives/ChartPrimitive.d.ts +24 -0
- package/dist/primitives/ChartPrimitive.js +318 -0
- package/dist/primitives/CircleBadge.d.ts +43 -0
- package/dist/primitives/CircleBadge.js +233 -0
- package/dist/primitives/FramePrimitive.d.ts +14 -0
- package/dist/primitives/FramePrimitive.js +406 -0
- package/dist/primitives/IconPrimitive.d.ts +28 -0
- package/dist/primitives/IconPrimitive.js +119 -0
- package/dist/primitives/IllustrationPrimitive.d.ts +16 -0
- package/dist/primitives/IllustrationPrimitive.js +184 -0
- package/dist/primitives/PillBadge.d.ts +45 -0
- package/dist/primitives/PillBadge.js +237 -0
- package/dist/primitives/ShapePrimitive.d.ts +12 -0
- package/dist/primitives/ShapePrimitive.js +521 -0
- package/dist/primitives/SnapGuidelines.d.ts +19 -0
- package/dist/primitives/SnapGuidelines.js +34 -0
- package/dist/primitives/UserImagePrimitive.d.ts +30 -0
- package/dist/primitives/UserImagePrimitive.js +496 -0
- package/dist/primitives/index.d.ts +18 -0
- package/dist/primitives/index.js +11 -0
- package/dist/sidebar/SidebarPanel.d.ts +8 -0
- package/dist/sidebar/SidebarPanel.js +219 -0
- package/dist/sidebar/SidebarTabBar.d.ts +2 -0
- package/dist/sidebar/SidebarTabBar.js +31 -0
- package/dist/sidebar/SubsectionTabBar.d.ts +13 -0
- package/dist/sidebar/SubsectionTabBar.js +30 -0
- package/dist/sidebar/UserUploadsProvider.d.ts +31 -0
- package/dist/sidebar/UserUploadsProvider.js +139 -0
- package/dist/sidebar/components/AltTextField.d.ts +21 -0
- package/dist/sidebar/components/AltTextField.js +60 -0
- package/dist/sidebar/components/SidebarHint.d.ts +7 -0
- package/dist/sidebar/components/SidebarHint.js +38 -0
- package/dist/sidebar/components/SidebarSlider.d.ts +16 -0
- package/dist/sidebar/components/SidebarSlider.js +9 -0
- package/dist/sidebar/components/TextFieldPrimitives.d.ts +26 -0
- package/dist/sidebar/components/TextFieldPrimitives.js +56 -0
- package/dist/sidebar/sections/ChartSettingsSection.d.ts +9 -0
- package/dist/sidebar/sections/ChartSettingsSection.js +78 -0
- package/dist/sidebar/sections/CombinedTextSection.d.ts +16 -0
- package/dist/sidebar/sections/CombinedTextSection.js +43 -0
- package/dist/sidebar/sections/DiagrammeSection.d.ts +9 -0
- package/dist/sidebar/sections/DiagrammeSection.js +40 -0
- package/dist/sidebar/sections/EffectsSection.d.ts +20 -0
- package/dist/sidebar/sections/EffectsSection.js +23 -0
- package/dist/sidebar/sections/FormenSection.d.ts +28 -0
- package/dist/sidebar/sections/FormenSection.js +440 -0
- package/dist/sidebar/sections/FrameSettingsSection.d.ts +8 -0
- package/dist/sidebar/sections/FrameSettingsSection.js +26 -0
- package/dist/sidebar/sections/GenericShareSection.d.ts +26 -0
- package/dist/sidebar/sections/GenericShareSection.js +262 -0
- package/dist/sidebar/sections/IconsSection.d.ts +8 -0
- package/dist/sidebar/sections/IconsSection.js +55 -0
- package/dist/sidebar/sections/IllustrationSettings.d.ts +9 -0
- package/dist/sidebar/sections/IllustrationSettings.js +33 -0
- package/dist/sidebar/sections/IllustrationThumb.d.ts +7 -0
- package/dist/sidebar/sections/IllustrationThumb.js +15 -0
- package/dist/sidebar/sections/ImageAdjustSection.d.ts +13 -0
- package/dist/sidebar/sections/ImageAdjustSection.js +85 -0
- package/dist/sidebar/sections/LayersSection.d.ts +25 -0
- package/dist/sidebar/sections/LayersSection.js +155 -0
- package/dist/sidebar/sections/RahmenSection.d.ts +7 -0
- package/dist/sidebar/sections/RahmenSection.js +18 -0
- package/dist/sidebar/sections/StudioGallery.d.ts +33 -0
- package/dist/sidebar/sections/StudioGallery.js +58 -0
- package/dist/sidebar/sections/UploadsSection.d.ts +11 -0
- package/dist/sidebar/sections/UploadsSection.js +130 -0
- package/dist/sidebar/sections/assets/AssetsSection.d.ts +59 -0
- package/dist/sidebar/sections/assets/AssetsSection.js +27 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.d.ts +9 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.js +49 -0
- package/dist/sidebar/sections/assets/CategoryCard.d.ts +14 -0
- package/dist/sidebar/sections/assets/CategoryCard.js +15 -0
- package/dist/sidebar/sections/assets/ElementGrid.d.ts +14 -0
- package/dist/sidebar/sections/assets/ElementGrid.js +34 -0
- package/dist/sidebar/sections/assets/ElementThumb.d.ts +10 -0
- package/dist/sidebar/sections/assets/ElementThumb.js +61 -0
- package/dist/sidebar/sections/assets/ElementTile.d.ts +32 -0
- package/dist/sidebar/sections/assets/ElementTile.js +60 -0
- package/dist/sidebar/sections/assets/ElementsPanel.d.ts +7 -0
- package/dist/sidebar/sections/assets/ElementsPanel.js +249 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.d.ts +8 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.js +26 -0
- package/dist/sidebar/sections/assets/FotosCatalog.d.ts +12 -0
- package/dist/sidebar/sections/assets/FotosCatalog.js +41 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.js +133 -0
- package/dist/sidebar/sections/assets/RecentCarousel.d.ts +7 -0
- package/dist/sidebar/sections/assets/RecentCarousel.js +42 -0
- package/dist/sidebar/sections/assets/StickerCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/StickerCatalog.js +49 -0
- package/dist/sidebar/sections/assets/constants.d.ts +4 -0
- package/dist/sidebar/sections/assets/constants.js +15 -0
- package/dist/sidebar/sections/assets/elementPanelHost.d.ts +45 -0
- package/dist/sidebar/sections/assets/elementPanelHost.js +1 -0
- package/dist/sidebar/sections/assets/elementSearch.d.ts +10 -0
- package/dist/sidebar/sections/assets/elementSearch.js +38 -0
- package/dist/sidebar/sections/assets/elementTypes.d.ts +67 -0
- package/dist/sidebar/sections/assets/elementTypes.js +24 -0
- package/dist/sidebar/sections/assets/index.d.ts +3 -0
- package/dist/sidebar/sections/assets/index.js +3 -0
- package/dist/sidebar/sections/assets/useElementCatalog.d.ts +43 -0
- package/dist/sidebar/sections/assets/useElementCatalog.js +386 -0
- package/dist/sidebar/sections/assets/useRecentElements.d.ts +21 -0
- package/dist/sidebar/sections/assets/useRecentElements.js +67 -0
- package/dist/sidebar/sections/assets/useStockPhotos.d.ts +22 -0
- package/dist/sidebar/sections/assets/useStockPhotos.js +96 -0
- package/dist/sidebar/sections/effects/EffectCard.d.ts +11 -0
- package/dist/sidebar/sections/effects/EffectCard.js +14 -0
- package/dist/sidebar/sections/effects/GradientSettings.d.ts +10 -0
- package/dist/sidebar/sections/effects/GradientSettings.js +34 -0
- package/dist/sidebar/sections/effects/OutlineSettings.d.ts +12 -0
- package/dist/sidebar/sections/effects/OutlineSettings.js +29 -0
- package/dist/sidebar/sections/effects/ShadowSettings.d.ts +13 -0
- package/dist/sidebar/sections/effects/ShadowSettings.js +38 -0
- package/dist/sidebar/sections/effects/effectsFor.d.ts +16 -0
- package/dist/sidebar/sections/effects/effectsFor.js +24 -0
- package/dist/sidebar/sections/index.d.ts +28 -0
- package/dist/sidebar/sections/index.js +36 -0
- package/dist/sidebar/sections/lazyWithPreload.d.ts +11 -0
- package/dist/sidebar/sections/lazyWithPreload.js +29 -0
- package/dist/sidebar/sections/tools/AiCreateTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiCreateTool.js +58 -0
- package/dist/sidebar/sections/tools/AiEditTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiEditTool.js +57 -0
- package/dist/sidebar/sections/tools/AltTextTool.d.ts +11 -0
- package/dist/sidebar/sections/tools/AltTextTool.js +78 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.js +90 -0
- package/dist/sidebar/sections/tools/GradientTextTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/GradientTextTool.js +104 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.d.ts +7 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.js +68 -0
- package/dist/sidebar/sections/tools/QRCodeTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/QRCodeTool.js +63 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.js +52 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.js +125 -0
- package/dist/sidebar/sections/tools/ToolPanel.d.ts +26 -0
- package/dist/sidebar/sections/tools/ToolPanel.js +13 -0
- package/dist/sidebar/sections/tools/ToolTiles.d.ts +5 -0
- package/dist/sidebar/sections/tools/ToolTiles.js +76 -0
- package/dist/sidebar/sections/tools/ToolsSection.d.ts +15 -0
- package/dist/sidebar/sections/tools/ToolsSection.js +151 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.d.ts +8 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.js +22 -0
- package/dist/sidebar/sections/tools/UnsplashTool.d.ts +10 -0
- package/dist/sidebar/sections/tools/UnsplashTool.js +47 -0
- package/dist/sidebar/sections/tools/index.d.ts +1 -0
- package/dist/sidebar/sections/tools/index.js +2 -0
- package/dist/sidebar/sections/tools/toolTiles.css +335 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.d.ts +19 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.js +23 -0
- package/dist/sidebar/sections/whenIdle.d.ts +2 -0
- package/dist/sidebar/sections/whenIdle.js +10 -0
- package/dist/sidebar/sidebarStyles.d.ts +60 -0
- package/dist/sidebar/sidebarStyles.js +61 -0
- package/dist/sidebar/tabTypes.d.ts +27 -0
- package/dist/sidebar/tabTypes.js +1 -0
- package/dist/sidebar/types.d.ts +43 -0
- package/dist/sidebar/types.js +1 -0
- package/dist/sidebar/useImagePlacement.d.ts +17 -0
- package/dist/sidebar/useImagePlacement.js +28 -0
- package/dist/stores/AutoSaveStoreProvider.d.ts +28 -0
- package/dist/stores/AutoSaveStoreProvider.js +45 -0
- package/dist/stores/CanvasStoreProvider.d.ts +43 -0
- package/dist/stores/CanvasStoreProvider.js +74 -0
- package/dist/stores/createAutoSaveStore.d.ts +50 -0
- package/dist/stores/createAutoSaveStore.js +42 -0
- package/dist/stores/createCanvasEditorStore.d.ts +126 -0
- package/dist/stores/createCanvasEditorStore.js +266 -0
- package/dist/stores/useAutoSaveStore.d.ts +12 -0
- package/dist/stores/useAutoSaveStore.js +12 -0
- package/dist/styles/editor.css +445 -0
- package/dist/styles/index.css +4 -0
- package/dist/styles/tailwind.css +239 -0
- package/dist/styles/tokens.css +199 -0
- package/dist/templates/fontWidths.generated.d.ts +1 -0
- package/dist/templates/fontWidths.generated.js +17 -0
- package/dist/templates/registry.d.ts +59 -0
- package/dist/templates/registry.js +40 -0
- package/dist/templates/templateGeometry.d.ts +32 -0
- package/dist/templates/templateGeometry.js +887 -0
- package/dist/templates/testKinds.d.ts +15 -0
- package/dist/templates/testKinds.js +151 -0
- package/dist/testing/documentBrandConfig.d.ts +14 -0
- package/dist/testing/documentBrandConfig.js +60 -0
- package/dist/testing/documentBrandPacks.d.ts +10 -0
- package/dist/testing/documentBrandPacks.js +45 -0
- package/dist/testing/fixtureTemplates.d.ts +13 -0
- package/dist/testing/fixtureTemplates.js +376 -0
- package/dist/testing/stampKind.d.ts +91 -0
- package/dist/testing/stampKind.js +56 -0
- package/dist/types/editorTypes.d.ts +65 -0
- package/dist/types/editorTypes.js +21 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +42 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/button.js +29 -0
- package/dist/ui/dialog.d.ts +15 -0
- package/dist/ui/dialog.js +53 -0
- package/dist/ui/icon-button.d.ts +18 -0
- package/dist/ui/icon-button.js +54 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +6 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +8 -0
- package/dist/ui/masonry-grid.d.ts +11 -0
- package/dist/ui/masonry-grid.js +43 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +26 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +38 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +7 -0
- package/dist/ui/switch.d.ts +6 -0
- package/dist/ui/switch.js +8 -0
- package/dist/utils/__snapshots__/kindSelection.vitest.ts.snap +1086 -0
- package/dist/utils/alignment.d.ts +21 -0
- package/dist/utils/alignment.js +54 -0
- package/dist/utils/axisLock.d.ts +30 -0
- package/dist/utils/axisLock.js +78 -0
- package/dist/utils/backgroundPhotoCrop.d.ts +28 -0
- package/dist/utils/backgroundPhotoCrop.js +28 -0
- package/dist/utils/canvasAssets.d.ts +140 -0
- package/dist/utils/canvasAssets.js +121 -0
- package/dist/utils/canvasClipboard.d.ts +51 -0
- package/dist/utils/canvasClipboard.js +37 -0
- package/dist/utils/canvasCommandRegistry.d.ts +207 -0
- package/dist/utils/canvasCommandRegistry.js +124 -0
- package/dist/utils/canvasCommands.d.ts +106 -0
- package/dist/utils/canvasCommands.js +564 -0
- package/dist/utils/canvasFontFamilies.d.ts +12 -0
- package/dist/utils/canvasFontFamilies.js +24 -0
- package/dist/utils/canvasIcons.d.ts +68 -0
- package/dist/utils/canvasIcons.js +293 -0
- package/dist/utils/canvasImageSource.d.ts +12 -0
- package/dist/utils/canvasImageSource.js +19 -0
- package/dist/utils/canvasItem.d.ts +102 -0
- package/dist/utils/canvasItem.js +1 -0
- package/dist/utils/canvasLayerManager.d.ts +51 -0
- package/dist/utils/canvasLayerManager.js +107 -0
- package/dist/utils/canvasValueResolver.d.ts +9 -0
- package/dist/utils/canvasValueResolver.js +13 -0
- package/dist/utils/captureStage.d.ts +59 -0
- package/dist/utils/captureStage.js +152 -0
- package/dist/utils/chartTypes.d.ts +6 -0
- package/dist/utils/chartTypes.js +2 -0
- package/dist/utils/chartUtils.d.ts +49 -0
- package/dist/utils/chartUtils.js +191 -0
- package/dist/utils/circleBadgeUtils.d.ts +30 -0
- package/dist/utils/circleBadgeUtils.js +85 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +66 -0
- package/dist/utils/collectAltTextPages.d.ts +6 -0
- package/dist/utils/collectAltTextPages.js +20 -0
- package/dist/utils/colorLuminance.d.ts +3 -0
- package/dist/utils/colorLuminance.js +14 -0
- package/dist/utils/colorNames.d.ts +7 -0
- package/dist/utils/colorNames.js +17 -0
- package/dist/utils/colorOptions.d.ts +20 -0
- package/dist/utils/colorOptions.js +20 -0
- package/dist/utils/cornerRadius.d.ts +14 -0
- package/dist/utils/cornerRadius.js +27 -0
- package/dist/utils/cornerReservation.d.ts +19 -0
- package/dist/utils/cornerReservation.js +7 -0
- package/dist/utils/coverFit.d.ts +117 -0
- package/dist/utils/coverFit.js +207 -0
- package/dist/utils/cropAspect.d.ts +47 -0
- package/dist/utils/cropAspect.js +53 -0
- package/dist/utils/cropGhost.d.ts +63 -0
- package/dist/utils/cropGhost.js +216 -0
- package/dist/utils/cropSession.d.ts +23 -0
- package/dist/utils/cropSession.js +92 -0
- package/dist/utils/cropTarget.d.ts +22 -0
- package/dist/utils/cropTarget.js +33 -0
- package/dist/utils/deepSelect.d.ts +43 -0
- package/dist/utils/deepSelect.js +74 -0
- package/dist/utils/downloadError.d.ts +2 -0
- package/dist/utils/downloadError.js +13 -0
- package/dist/utils/duplicateElement.d.ts +127 -0
- package/dist/utils/duplicateElement.js +235 -0
- package/dist/utils/editorFocus.d.ts +36 -0
- package/dist/utils/editorFocus.js +67 -0
- package/dist/utils/editorToast.d.ts +21 -0
- package/dist/utils/editorToast.js +7 -0
- package/dist/utils/elementKinds.d.ts +212 -0
- package/dist/utils/elementKinds.js +137 -0
- package/dist/utils/emoji/emojiCatalog.d.ts +12 -0
- package/dist/utils/emoji/emojiCatalog.en.json +9997 -0
- package/dist/utils/emoji/emojiCatalog.js +53 -0
- package/dist/utils/emoji/emojiCatalog.json +9913 -0
- package/dist/utils/ensureFontsReady.d.ts +12 -0
- package/dist/utils/ensureFontsReady.js +23 -0
- package/dist/utils/expandImage.d.ts +17 -0
- package/dist/utils/expandImage.js +76 -0
- package/dist/utils/externalIcons.d.ts +67 -0
- package/dist/utils/externalIcons.js +168 -0
- package/dist/utils/filterCache.d.ts +16 -0
- package/dist/utils/filterCache.js +31 -0
- package/dist/utils/filterUtils.d.ts +2 -0
- package/dist/utils/filterUtils.js +89 -0
- package/dist/utils/followStage.d.ts +2 -0
- package/dist/utils/followStage.js +48 -0
- package/dist/utils/fontAliases.d.ts +14 -0
- package/dist/utils/fontAliases.js +32 -0
- package/dist/utils/fontMarkSupport.d.ts +26 -0
- package/dist/utils/fontMarkSupport.js +32 -0
- package/dist/utils/frameUtils.d.ts +20 -0
- package/dist/utils/frameUtils.js +283 -0
- package/dist/utils/gradientFill.d.ts +55 -0
- package/dist/utils/gradientFill.js +57 -0
- package/dist/utils/gradientHitArea.d.ts +22 -0
- package/dist/utils/gradientHitArea.js +94 -0
- package/dist/utils/grain.d.ts +29 -0
- package/dist/utils/grain.js +103 -0
- package/dist/utils/grainSpec.d.ts +2 -0
- package/dist/utils/grainSpec.js +3 -0
- package/dist/utils/groupSnap.d.ts +27 -0
- package/dist/utils/groupSnap.js +54 -0
- package/dist/utils/handDrawn.d.ts +92 -0
- package/dist/utils/handDrawn.js +523 -0
- package/dist/utils/historyStamp.d.ts +22 -0
- package/dist/utils/historyStamp.js +31 -0
- package/dist/utils/hostStorageKeys.d.ts +16 -0
- package/dist/utils/hostStorageKeys.js +27 -0
- package/dist/utils/iconInstances.d.ts +80 -0
- package/dist/utils/iconInstances.js +109 -0
- package/dist/utils/illustrations/gophers.d.ts +11 -0
- package/dist/utils/illustrations/gophers.js +1236 -0
- package/dist/utils/illustrations/humaaans.d.ts +8 -0
- package/dist/utils/illustrations/humaaans.js +265 -0
- package/dist/utils/illustrations/illlustrations.d.ts +11 -0
- package/dist/utils/illustrations/illlustrations.js +929 -0
- package/dist/utils/illustrations/kawaii.d.ts +6 -0
- package/dist/utils/illustrations/kawaii.js +73 -0
- package/dist/utils/illustrations/opendoodles.d.ts +6 -0
- package/dist/utils/illustrations/opendoodles.js +271 -0
- package/dist/utils/illustrations/openpeeps.d.ts +9 -0
- package/dist/utils/illustrations/openpeeps.js +1522 -0
- package/dist/utils/illustrations/prefetchAnalytics.d.ts +78 -0
- package/dist/utils/illustrations/prefetchAnalytics.js +162 -0
- package/dist/utils/illustrations/registry.d.ts +27 -0
- package/dist/utils/illustrations/registry.js +106 -0
- package/dist/utils/illustrations/svgCache.d.ts +60 -0
- package/dist/utils/illustrations/svgCache.js +349 -0
- package/dist/utils/illustrations/transhumans.d.ts +8 -0
- package/dist/utils/illustrations/transhumans.js +313 -0
- package/dist/utils/illustrations/types.d.ts +25 -0
- package/dist/utils/illustrations/types.js +45 -0
- package/dist/utils/imageElementComparison.d.ts +19 -0
- package/dist/utils/imageElementComparison.js +121 -0
- package/dist/utils/imageFilters.d.ts +94 -0
- package/dist/utils/imageFilters.js +304 -0
- package/dist/utils/imageLook.d.ts +18 -0
- package/dist/utils/imageLook.js +41 -0
- package/dist/utils/keyboardCrop.d.ts +25 -0
- package/dist/utils/keyboardCrop.js +98 -0
- package/dist/utils/keyboardOwnership.d.ts +30 -0
- package/dist/utils/keyboardOwnership.js +93 -0
- package/dist/utils/layerLabels.d.ts +39 -0
- package/dist/utils/layerLabels.js +181 -0
- package/dist/utils/layerLock.d.ts +24 -0
- package/dist/utils/layerLock.js +52 -0
- package/dist/utils/layerSelection.d.ts +24 -0
- package/dist/utils/layerSelection.js +16 -0
- package/dist/utils/markerBoxes.d.ts +38 -0
- package/dist/utils/markerBoxes.js +60 -0
- package/dist/utils/markerColors.d.ts +16 -0
- package/dist/utils/markerColors.js +32 -0
- package/dist/utils/mediaDrop.d.ts +76 -0
- package/dist/utils/mediaDrop.js +95 -0
- package/dist/utils/mediaPlacement.d.ts +6 -0
- package/dist/utils/mediaPlacement.js +17 -0
- package/dist/utils/motifSizes.d.ts +8 -0
- package/dist/utils/motifSizes.js +9 -0
- package/dist/utils/multiSelect.d.ts +44 -0
- package/dist/utils/multiSelect.js +139 -0
- package/dist/utils/notch.d.ts +17 -0
- package/dist/utils/notch.js +23 -0
- package/dist/utils/orientElement.d.ts +46 -0
- package/dist/utils/orientElement.js +108 -0
- package/dist/utils/orientation.d.ts +119 -0
- package/dist/utils/orientation.js +411 -0
- package/dist/utils/pageCounter.d.ts +15 -0
- package/dist/utils/pageCounter.js +17 -0
- package/dist/utils/pendingImages.d.ts +10 -0
- package/dist/utils/pendingImages.js +25 -0
- package/dist/utils/photoCredit.d.ts +9 -0
- package/dist/utils/photoCredit.js +29 -0
- package/dist/utils/photoCredits.d.ts +5 -0
- package/dist/utils/photoCredits.js +17 -0
- package/dist/utils/photoPlaceholder.d.ts +25 -0
- package/dist/utils/photoPlaceholder.js +38 -0
- package/dist/utils/pillBadgeUtils.d.ts +41 -0
- package/dist/utils/pillBadgeUtils.js +94 -0
- package/dist/utils/pixelHitArea.d.ts +13 -0
- package/dist/utils/pixelHitArea.js +33 -0
- package/dist/utils/plainTextLayout.d.ts +11 -0
- package/dist/utils/plainTextLayout.js +64 -0
- package/dist/utils/printImageInfo.d.ts +9 -0
- package/dist/utils/printImageInfo.js +14 -0
- package/dist/utils/recacheNextFrame.d.ts +6 -0
- package/dist/utils/recacheNextFrame.js +15 -0
- package/dist/utils/removeElement.d.ts +17 -0
- package/dist/utils/removeElement.js +47 -0
- package/dist/utils/renderedBoxes.d.ts +19 -0
- package/dist/utils/renderedBoxes.js +67 -0
- package/dist/utils/resolveElementValue.d.ts +44 -0
- package/dist/utils/resolveElementValue.js +72 -0
- package/dist/utils/scrollBehavior.d.ts +6 -0
- package/dist/utils/scrollBehavior.js +17 -0
- package/dist/utils/searchTranslations.d.ts +20 -0
- package/dist/utils/searchTranslations.js +366 -0
- package/dist/utils/selectionCapabilities.d.ts +53 -0
- package/dist/utils/selectionCapabilities.js +52 -0
- package/dist/utils/shade.d.ts +24 -0
- package/dist/utils/shade.js +55 -0
- package/dist/utils/shapeDevices.d.ts +72 -0
- package/dist/utils/shapeDevices.js +100 -0
- package/dist/utils/shapeTransform.d.ts +29 -0
- package/dist/utils/shapeTransform.js +69 -0
- package/dist/utils/shapes.d.ts +64 -0
- package/dist/utils/shapes.js +838 -0
- package/dist/utils/smartCrop.d.ts +30 -0
- package/dist/utils/smartCrop.js +163 -0
- package/dist/utils/snapping.d.ts +116 -0
- package/dist/utils/snapping.js +426 -0
- package/dist/utils/stageCssScale.d.ts +7 -0
- package/dist/utils/stageCssScale.js +11 -0
- package/dist/utils/stateTypeAssertions.d.ts +99 -0
- package/dist/utils/stateTypeAssertions.js +197 -0
- package/dist/utils/straighten.d.ts +51 -0
- package/dist/utils/straighten.js +254 -0
- package/dist/utils/surfaceGlow.d.ts +7 -0
- package/dist/utils/surfaceGlow.js +27 -0
- package/dist/utils/templateElementInstance.d.ts +43 -0
- package/dist/utils/templateElementInstance.js +100 -0
- package/dist/utils/templateRotation.d.ts +24 -0
- package/dist/utils/templateRotation.js +56 -0
- package/dist/utils/textAlign.d.ts +17 -0
- package/dist/utils/textAlign.js +30 -0
- package/dist/utils/textEditorOpeners.d.ts +12 -0
- package/dist/utils/textEditorOpeners.js +40 -0
- package/dist/utils/textRouting.d.ts +17 -0
- package/dist/utils/textRouting.js +22 -0
- package/dist/utils/textUtils.d.ts +102 -0
- package/dist/utils/textUtils.js +254 -0
- package/dist/utils/touchInput.d.ts +7 -0
- package/dist/utils/touchInput.js +19 -0
- package/dist/utils/transformHudLabel.d.ts +3 -0
- package/dist/utils/transformHudLabel.js +12 -0
- package/dist/utils/unsplashLinks.d.ts +2 -0
- package/dist/utils/unsplashLinks.js +7 -0
- package/dist/utils/userFacingError.d.ts +10 -0
- package/dist/utils/userFacingError.js +10 -0
- package/dist/utils/userImageCrop.d.ts +4 -0
- package/dist/utils/userImageCrop.js +26 -0
- package/dist/utils/userImageUtils.d.ts +44 -0
- package/dist/utils/userImageUtils.js +136 -0
- package/dist/utils/viewport.d.ts +16 -0
- package/dist/utils/viewport.js +30 -0
- package/dist/utils/zipPageImages.d.ts +9 -0
- package/dist/utils/zipPageImages.js +30 -0
- package/package.json +105 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface OutlineSettingsProps {
|
|
3
|
+
stroke?: string;
|
|
4
|
+
strokeWidth?: number;
|
|
5
|
+
onChange: (patch: {
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
}) => void;
|
|
9
|
+
}
|
|
10
|
+
/** Kontur eines freien Textes, im Bereich „Effekte“. */
|
|
11
|
+
export declare function OutlineSettings({ stroke, strokeWidth, onChange }: OutlineSettingsProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { Slider } from 'radix-ui';
|
|
4
|
+
import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
|
|
5
|
+
import { CustomColorSwatch } from '@ggraphic/editor/components/CustomColorSwatch';
|
|
6
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
7
|
+
import { EffectCard } from '@ggraphic/editor/sidebar/sections/effects/EffectCard';
|
|
8
|
+
import { colorName } from '@ggraphic/editor/utils/colorNames';
|
|
9
|
+
const DEFAULT_WIDTH = 2;
|
|
10
|
+
/** Kontur eines freien Textes, im Bereich „Effekte“. */
|
|
11
|
+
export function OutlineSettings({ stroke, strokeWidth, onChange }) {
|
|
12
|
+
const brand = useDocumentBrand();
|
|
13
|
+
const { outlines } = brand.effects;
|
|
14
|
+
const t = useMessages();
|
|
15
|
+
const enabled = !!stroke && (strokeWidth ?? 0) > 0;
|
|
16
|
+
const toggle = () => {
|
|
17
|
+
if (enabled) {
|
|
18
|
+
onChange({ stroke: undefined, strokeWidth: 0 });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
onChange({ stroke: '#ffffff', strokeWidth: DEFAULT_WIDTH });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(EffectCard, { title: t.topBar.outline, enabled: enabled, onToggle: toggle, children: [_jsxs("div", { className: "flex items-center gap-2", children: [outlines.map((c) => (_jsx("button", { className: "size-6 rounded-full border border-black/10 hover:scale-110 transition-transform", style: {
|
|
25
|
+
backgroundColor: c,
|
|
26
|
+
outline: stroke === c ? '2px solid var(--editor-accent)' : 'none',
|
|
27
|
+
outlineOffset: '2px',
|
|
28
|
+
}, onClick: () => onChange({ stroke: c }), title: colorName(c, brand), "aria-label": colorName(c, brand), "aria-pressed": stroke === c, type: "button" }, c))), _jsx(CustomColorSwatch, { value: stroke, presets: outlines, onPick: (color) => onChange({ stroke: color }), className: "size-6" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-[11px] w-12 text-[var(--editor-text-muted)]", children: t.topBar.strength }), _jsxs(Slider.Root, { className: "relative flex items-center select-none touch-none grow h-4 max-canvas-mobile:h-11", value: [strokeWidth ?? DEFAULT_WIDTH], onValueChange: (v) => onChange({ strokeWidth: v[0] }), min: 0.5, max: 12, step: 0.5, children: [_jsx(Slider.Track, { className: "relative grow rounded-full h-1 bg-[var(--editor-border-soft)]", children: _jsx(Slider.Range, { className: "absolute rounded-full h-full bg-[var(--editor-accent)]" }) }), _jsx(Slider.Thumb, { className: "block size-3 max-canvas-mobile:size-5 bg-white rounded-full border-2 border-[var(--editor-accent)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] cursor-grab focus:outline-none", "aria-label": t.topBar.outlineWidth })] }), _jsx("span", { className: "text-[11px] w-8 text-right tabular-nums text-[var(--editor-text-muted)]", children: strokeWidth ?? DEFAULT_WIDTH })] })] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ShadowPatch } from '@ggraphic/editor/hooks/useFloatingModuleHandlers';
|
|
3
|
+
interface ShadowSettingsProps {
|
|
4
|
+
shadowColor?: string;
|
|
5
|
+
shadowBlur?: number;
|
|
6
|
+
shadowOffsetX?: number;
|
|
7
|
+
shadowOffsetY?: number;
|
|
8
|
+
shadowOpacity?: number;
|
|
9
|
+
onChange: (patch: ShadowPatch) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Schatten einer Form oder eines freien Textes, im Bereich „Effekte“. */
|
|
12
|
+
export declare function ShadowSettings({ shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, onChange, }: ShadowSettingsProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { Slider } from 'radix-ui';
|
|
4
|
+
import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
|
|
5
|
+
import { CustomColorSwatch } from '@ggraphic/editor/components/CustomColorSwatch';
|
|
6
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
7
|
+
import { EffectCard } from '@ggraphic/editor/sidebar/sections/effects/EffectCard';
|
|
8
|
+
import { colorName } from '@ggraphic/editor/utils/colorNames';
|
|
9
|
+
const SHADOW_DEFAULTS = {
|
|
10
|
+
shadowColor: '#000000',
|
|
11
|
+
shadowBlur: 8,
|
|
12
|
+
shadowOffsetX: 4,
|
|
13
|
+
shadowOffsetY: 4,
|
|
14
|
+
shadowOpacity: 0.5,
|
|
15
|
+
};
|
|
16
|
+
function LabeledSlider({ label, value, min, max, step, suffix, onValueChange, }) {
|
|
17
|
+
return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-[11px] w-14 text-[var(--editor-text-muted)]", children: label }), _jsxs(Slider.Root, { className: "relative flex items-center select-none touch-none grow h-4 max-canvas-mobile:h-11", value: [value], onValueChange: (v) => onValueChange(v[0]), min: min, max: max, step: step, children: [_jsx(Slider.Track, { className: "relative grow rounded-full h-1 bg-[var(--editor-border-soft)]", children: _jsx(Slider.Range, { className: "absolute rounded-full h-full bg-[var(--editor-accent)]" }) }), _jsx(Slider.Thumb, { className: "block size-3 max-canvas-mobile:size-5 bg-white rounded-full border-2 border-[var(--editor-accent)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] cursor-grab focus:outline-none", "aria-label": label })] }), _jsxs("span", { className: "text-[11px] w-9 text-right tabular-nums text-[var(--editor-text-muted)]", children: [Math.round(value), suffix] })] }));
|
|
18
|
+
}
|
|
19
|
+
/** Schatten einer Form oder eines freien Textes, im Bereich „Effekte“. */
|
|
20
|
+
export function ShadowSettings({ shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, onChange, }) {
|
|
21
|
+
const brand = useDocumentBrand();
|
|
22
|
+
const { shadows } = brand.effects;
|
|
23
|
+
const t = useMessages();
|
|
24
|
+
const enabled = !!shadowColor;
|
|
25
|
+
const toggle = () => {
|
|
26
|
+
if (enabled) {
|
|
27
|
+
onChange({ shadowColor: undefined, shadowBlur: 0, shadowOpacity: 0 });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
onChange(SHADOW_DEFAULTS);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs(EffectCard, { title: t.topBar.shadow, enabled: enabled, onToggle: toggle, children: [_jsxs("div", { className: "flex items-center gap-2", children: [shadows.map((c) => (_jsx("button", { className: "size-6 rounded-full border border-black/10 hover:scale-110 transition-transform", style: {
|
|
34
|
+
backgroundColor: c,
|
|
35
|
+
outline: shadowColor === c ? '2px solid var(--editor-accent)' : 'none',
|
|
36
|
+
outlineOffset: '2px',
|
|
37
|
+
}, onClick: () => onChange({ shadowColor: c }), title: colorName(c, brand), "aria-label": colorName(c, brand), "aria-pressed": shadowColor === c, type: "button" }, c))), _jsx(CustomColorSwatch, { value: shadowColor, presets: shadows, onPick: (color) => onChange({ shadowColor: color }), className: "size-6" })] }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.softness, value: shadowBlur ?? 0, min: 0, max: 40, step: 1, onValueChange: (v) => onChange({ shadowBlur: v }) }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.offsetX, value: shadowOffsetX ?? 0, min: -40, max: 40, step: 1, onValueChange: (v) => onChange({ shadowOffsetX: v }) }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.offsetY, value: shadowOffsetY ?? 0, min: -40, max: 40, step: 1, onValueChange: (v) => onChange({ shadowOffsetY: v }) }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.opacity, value: (shadowOpacity ?? 0) * 100, min: 0, max: 100, step: 1, suffix: "%", onValueChange: (v) => onChange({ shadowOpacity: v / 100 }) })] }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FloatingModuleState } from '@ggraphic/editor/hooks/useFloatingModuleState';
|
|
2
|
+
export interface EffectsAvailability {
|
|
3
|
+
gradient: boolean;
|
|
4
|
+
outline: boolean;
|
|
5
|
+
shadow: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Welche Effekte die Auswahl kennt — für den Knopf „Effekte“ in der Leiste und
|
|
9
|
+
* den Bereich, den er öffnet; beide fragen hier.
|
|
10
|
+
*
|
|
11
|
+
* Nur freie Texte (`additionalTexts`) speichern Effekt-Felder; Vorlagen-Texte
|
|
12
|
+
* laufen über State-Keys. Linien und Pfeile haben keine Fläche, ein Verlauf
|
|
13
|
+
* dort wäre wirkungslos. Bilder haben ihren Schatten im Bereich „Bearbeiten“.
|
|
14
|
+
*/
|
|
15
|
+
export declare function effectsFor(module: FloatingModuleState | null): EffectsAvailability;
|
|
16
|
+
export declare function hasEffects(module: FloatingModuleState | null): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { STROKE_ONLY_SHAPES } from '@ggraphic/editor/utils/shapes';
|
|
3
|
+
/**
|
|
4
|
+
* Welche Effekte die Auswahl kennt — für den Knopf „Effekte“ in der Leiste und
|
|
5
|
+
* den Bereich, den er öffnet; beide fragen hier.
|
|
6
|
+
*
|
|
7
|
+
* Nur freie Texte (`additionalTexts`) speichern Effekt-Felder; Vorlagen-Texte
|
|
8
|
+
* laufen über State-Keys. Linien und Pfeile haben keine Fläche, ein Verlauf
|
|
9
|
+
* dort wäre wirkungslos. Bilder haben ihren Schatten im Bereich „Bearbeiten“.
|
|
10
|
+
*/
|
|
11
|
+
export function effectsFor(module) {
|
|
12
|
+
const type = module?.type;
|
|
13
|
+
const isEffectText = type === 'text' && !!module?.data.isInstanceText;
|
|
14
|
+
const isFillableShape = type === 'shape' && !STROKE_ONLY_SHAPES.has(String(module?.data.type));
|
|
15
|
+
return {
|
|
16
|
+
gradient: isFillableShape || isEffectText,
|
|
17
|
+
outline: isEffectText,
|
|
18
|
+
shadow: type === 'shape' || isEffectText,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function hasEffects(module) {
|
|
22
|
+
const { gradient, outline, shadow } = effectsFor(module);
|
|
23
|
+
return gradient || outline || shadow;
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core's sidebar sections, for template configs to list.
|
|
3
|
+
*
|
|
4
|
+
* Exports are split into static and lazy-loaded sections:
|
|
5
|
+
* - Lightweight sections are exported directly
|
|
6
|
+
* - Heavy sections are lazy-loaded with React.lazy() to reduce initial bundle size
|
|
7
|
+
*
|
|
8
|
+
* The lazy wrappers exist once, here: a host barrel re-exports them, so a
|
|
9
|
+
* preload (`AssetsSection.preload()`) warms the same component the config renders.
|
|
10
|
+
*/
|
|
11
|
+
export { CombinedTextSection } from './CombinedTextSection.js';
|
|
12
|
+
export type { CombinedTextSectionProps } from './CombinedTextSection.js';
|
|
13
|
+
export { IconsSection } from './IconsSection.js';
|
|
14
|
+
export { FrameSettingsSection } from './FrameSettingsSection.js';
|
|
15
|
+
export type { FrameSettingsSectionProps } from './FrameSettingsSection.js';
|
|
16
|
+
export { FormenSection } from './FormenSection.js';
|
|
17
|
+
export type { FormenSectionProps } from './FormenSection.js';
|
|
18
|
+
export declare const AssetsSection: ((props: import("./assets/AssetsSection.js").ExtendedAssetsSectionProps) => import("react").JSX.Element) & {
|
|
19
|
+
preload: () => Promise<import("react").ComponentType<import("./assets/AssetsSection.js").ExtendedAssetsSectionProps>>;
|
|
20
|
+
};
|
|
21
|
+
export declare const GenericShareSection: import("react").LazyExoticComponent<typeof import("./GenericShareSection.js").GenericShareSection>;
|
|
22
|
+
export type { GenericShareSectionProps } from './GenericShareSection.js';
|
|
23
|
+
export declare const UploadsSection: import("react").LazyExoticComponent<typeof import("./UploadsSection.js").UploadsSection>;
|
|
24
|
+
export type { UploadsSectionProps } from './UploadsSection.js';
|
|
25
|
+
export declare const ToolsSection: ((props: import("./index.js").ToolsSectionProps) => import("react").JSX.Element) & {
|
|
26
|
+
preload: () => Promise<import("react").ComponentType<import("./index.js").ToolsSectionProps>>;
|
|
27
|
+
};
|
|
28
|
+
export type { ToolsSectionProps } from './tools/index.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/**
|
|
3
|
+
* The core's sidebar sections, for template configs to list.
|
|
4
|
+
*
|
|
5
|
+
* Exports are split into static and lazy-loaded sections:
|
|
6
|
+
* - Lightweight sections are exported directly
|
|
7
|
+
* - Heavy sections are lazy-loaded with React.lazy() to reduce initial bundle size
|
|
8
|
+
*
|
|
9
|
+
* The lazy wrappers exist once, here: a host barrel re-exports them, so a
|
|
10
|
+
* preload (`AssetsSection.preload()`) warms the same component the config renders.
|
|
11
|
+
*/
|
|
12
|
+
import { lazy } from 'react';
|
|
13
|
+
import { lazyWithPreload } from './lazyWithPreload.js';
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// STATIC EXPORTS - Lightweight sections loaded immediately
|
|
16
|
+
// =============================================================================
|
|
17
|
+
export { CombinedTextSection } from './CombinedTextSection.js';
|
|
18
|
+
// Static: IconsSection used to be statically imported by AssetsSection, so the
|
|
19
|
+
// previous lazy() wrapper was an ineffective dynamic import
|
|
20
|
+
// (it confused the chunker). Export it directly.
|
|
21
|
+
export { IconsSection } from './IconsSection.js';
|
|
22
|
+
export { FrameSettingsSection } from './FrameSettingsSection.js';
|
|
23
|
+
export { FormenSection } from './FormenSection.js';
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// LAZY EXPORTS - Heavy sections loaded on-demand
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// Preloaded while the editor is idle (usePreloadElements), so the first open is instant.
|
|
28
|
+
export const AssetsSection = lazyWithPreload(() => import('./assets/index.js').then((m) => m.AssetsSection));
|
|
29
|
+
export const GenericShareSection = lazy(() => import('./GenericShareSection.js').then((m) => ({
|
|
30
|
+
default: m.GenericShareSection,
|
|
31
|
+
})));
|
|
32
|
+
export const UploadsSection = lazy(() => import('./UploadsSection.js').then((m) => ({
|
|
33
|
+
default: m.UploadsSection,
|
|
34
|
+
})));
|
|
35
|
+
// Preloaded while the editor is idle (usePreloadTools), so the first open is instant.
|
|
36
|
+
export const ToolsSection = lazyWithPreload(() => import('./tools/index.js').then((m) => m.ToolsSection));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `lazy()` with a `preload()`. React.lazy suspends on its first render even when
|
|
4
|
+
* the chunk is already in memory, and React 19 then holds the reveal back for
|
|
5
|
+
* ~300 ms (Suspense fallback throttling). Once `preload()` has resolved, this
|
|
6
|
+
* renders the component directly — no Suspense, no delay. The choice is made
|
|
7
|
+
* once per mount, so a chunk landing mid-mount never remounts the section.
|
|
8
|
+
*/
|
|
9
|
+
export declare function lazyWithPreload<P extends object>(load: () => Promise<ComponentType<P>>): ((props: P) => import("react").JSX.Element) & {
|
|
10
|
+
preload: () => Promise<ComponentType<P>>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { lazy, useState } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* `lazy()` with a `preload()`. React.lazy suspends on its first render even when
|
|
6
|
+
* the chunk is already in memory, and React 19 then holds the reveal back for
|
|
7
|
+
* ~300 ms (Suspense fallback throttling). Once `preload()` has resolved, this
|
|
8
|
+
* renders the component directly — no Suspense, no delay. The choice is made
|
|
9
|
+
* once per mount, so a chunk landing mid-mount never remounts the section.
|
|
10
|
+
*/
|
|
11
|
+
export function lazyWithPreload(load) {
|
|
12
|
+
let loaded = null;
|
|
13
|
+
let pending = null;
|
|
14
|
+
// A failed load is forgotten, so the next preload (another hover, the next
|
|
15
|
+
// idle warm-up) retries instead of replaying the rejection until a reload.
|
|
16
|
+
const preload = () => (pending ??= load().then((component) => {
|
|
17
|
+
loaded = component;
|
|
18
|
+
return component;
|
|
19
|
+
}, (error) => {
|
|
20
|
+
pending = null;
|
|
21
|
+
throw error;
|
|
22
|
+
}));
|
|
23
|
+
const Lazy = lazy(() => preload().then((component) => ({ default: component })));
|
|
24
|
+
function LazyWithPreload(props) {
|
|
25
|
+
const [Component] = useState(() => loaded ?? Lazy);
|
|
26
|
+
return _jsx(Component, { ...props });
|
|
27
|
+
}
|
|
28
|
+
return Object.assign(LazyWithPreload, { preload });
|
|
29
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
|
|
4
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
5
|
+
import { useUserUploads } from '@ggraphic/editor/sidebar/UserUploadsProvider';
|
|
6
|
+
import { useCallback, useState } from 'react';
|
|
7
|
+
import { HiSparkles } from 'react-icons/hi';
|
|
8
|
+
import { useAiImageGeneration } from '../../../hooks/useAiImageGeneration.js';
|
|
9
|
+
import { MOBILE_INPUT_TEXT } from '../../sidebarStyles.js';
|
|
10
|
+
import { ToolPanel } from './ToolPanel.js';
|
|
11
|
+
const aiVariantOptions = (t) => [
|
|
12
|
+
{ value: 'realistic', label: t.sidebar.tools.variantRealistic },
|
|
13
|
+
{ value: 'illustration', label: t.sidebar.tools.variantIllustration },
|
|
14
|
+
{ value: 'pixel', label: t.sidebar.tools.variantPixel },
|
|
15
|
+
];
|
|
16
|
+
export function AiCreateTool({ onJumpToUploads }) {
|
|
17
|
+
const t = useMessages();
|
|
18
|
+
const { generateAiImage } = useCanvasEditorServices();
|
|
19
|
+
const { upload, isUploading } = useUserUploads();
|
|
20
|
+
const { generate, isGenerating, generationError, remaining } = useAiImageGeneration();
|
|
21
|
+
const [prompt, setPrompt] = useState('');
|
|
22
|
+
const [variant, setVariant] = useState('realistic');
|
|
23
|
+
const [uploadError, setUploadError] = useState(null);
|
|
24
|
+
const [success, setSuccess] = useState(null);
|
|
25
|
+
const handleAction = useCallback(async () => {
|
|
26
|
+
setUploadError(null);
|
|
27
|
+
setSuccess(null);
|
|
28
|
+
const result = await generate(prompt, variant);
|
|
29
|
+
if (!result)
|
|
30
|
+
return;
|
|
31
|
+
try {
|
|
32
|
+
const item = await upload(result.file);
|
|
33
|
+
if (!item)
|
|
34
|
+
throw new Error(t.sidebar.uploadFailed);
|
|
35
|
+
setSuccess({
|
|
36
|
+
thumbnailUrl: result.objectUrl,
|
|
37
|
+
itemName: item.originalFilename ?? item.title ?? result.file.name,
|
|
38
|
+
onJumpToUploads,
|
|
39
|
+
});
|
|
40
|
+
setPrompt('');
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
const message = err instanceof Error ? err.message : t.sidebar.tools.saveError;
|
|
44
|
+
setUploadError(message);
|
|
45
|
+
}
|
|
46
|
+
}, [t, generate, prompt, variant, upload, onJumpToUploads]);
|
|
47
|
+
if (!generateAiImage)
|
|
48
|
+
return null;
|
|
49
|
+
const canSubmit = prompt.trim().length >= 5;
|
|
50
|
+
const error = uploadError ?? generationError;
|
|
51
|
+
const isBusy = isGenerating || isUploading;
|
|
52
|
+
const progressMessage = isGenerating
|
|
53
|
+
? t.sidebar.tools.generating
|
|
54
|
+
: isUploading
|
|
55
|
+
? t.sidebar.tools.savingToUploads
|
|
56
|
+
: null;
|
|
57
|
+
return (_jsx(ToolPanel, { body: _jsxs(_Fragment, { children: [_jsx("textarea", { value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: t.sidebar.tools.generatePlaceholder, rows: 3, maxLength: 500, disabled: isBusy, className: `w-full p-3 bg-background border border-[var(--font-color)] rounded-lg text-foreground text-sm ${MOBILE_INPUT_TEXT} outline-none resize-none focus:border-primary-600 disabled:opacity-50` }), _jsxs("label", { className: "flex flex-col gap-1 text-foreground-muted text-xs", children: [t.sidebar.tools.style, _jsx("select", { value: variant, onChange: (e) => setVariant(e.target.value), disabled: isBusy, className: `w-full py-2 px-3 bg-background border border-[var(--font-color)] rounded-lg text-foreground text-sm ${MOBILE_INPUT_TEXT} outline-none focus:border-primary-600 disabled:opacity-50`, children: aiVariantOptions(t).map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) })] })] }), actionLabel: t.sidebar.tools.generate, actionIcon: HiSparkles, canSubmit: canSubmit, isBusy: isBusy, progressMessage: progressMessage, error: error, success: success, onAction: () => void handleAction(), footer: remaining !== null && !error ? (_jsx("p", { className: "m-0 text-foreground-muted text-xs text-center", children: t.sidebar.tools.remainingToday(remaining) })) : null }));
|
|
58
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
|
|
4
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
5
|
+
import { useUserUploads } from '@ggraphic/editor/sidebar/UserUploadsProvider';
|
|
6
|
+
import { useCallback, useState } from 'react';
|
|
7
|
+
import { HiPencilSquare } from 'react-icons/hi2';
|
|
8
|
+
import { MOBILE_INPUT_TEXT } from '@ggraphic/editor/sidebar/sidebarStyles';
|
|
9
|
+
import { ImageInputPicker } from './ImageInputPicker.js';
|
|
10
|
+
import { ToolPanel, } from '@ggraphic/editor/sidebar/sections/tools/ToolPanel';
|
|
11
|
+
const MIN_INSTRUCTION_LENGTH = 15;
|
|
12
|
+
const MAX_INSTRUCTION_LENGTH = 500;
|
|
13
|
+
export function AiEditTool({ onJumpToUploads }) {
|
|
14
|
+
const t = useMessages();
|
|
15
|
+
const { editAiImage } = useCanvasEditorServices();
|
|
16
|
+
const { upload, isUploading } = useUserUploads();
|
|
17
|
+
const [input, setInput] = useState(null);
|
|
18
|
+
const [instruction, setInstruction] = useState('');
|
|
19
|
+
const [isBusy, setIsBusy] = useState(false);
|
|
20
|
+
const [progressMessage, setProgressMessage] = useState(null);
|
|
21
|
+
const [error, setError] = useState(null);
|
|
22
|
+
const [success, setSuccess] = useState(null);
|
|
23
|
+
const handleAction = useCallback(async () => {
|
|
24
|
+
if (!input || !editAiImage)
|
|
25
|
+
return;
|
|
26
|
+
setError(null);
|
|
27
|
+
setSuccess(null);
|
|
28
|
+
setIsBusy(true);
|
|
29
|
+
setProgressMessage(t.sidebar.tools.editing);
|
|
30
|
+
try {
|
|
31
|
+
const { file, objectUrl } = await editAiImage(input, instruction.trim());
|
|
32
|
+
setProgressMessage(t.sidebar.tools.savingToUploads);
|
|
33
|
+
const item = await upload(file);
|
|
34
|
+
if (!item)
|
|
35
|
+
throw new Error(t.sidebar.uploadFailed);
|
|
36
|
+
setSuccess({
|
|
37
|
+
thumbnailUrl: objectUrl,
|
|
38
|
+
itemName: item.originalFilename ?? item.title ?? file.name,
|
|
39
|
+
onJumpToUploads,
|
|
40
|
+
});
|
|
41
|
+
setInput(null);
|
|
42
|
+
setInstruction('');
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
const message = err instanceof Error ? err.message : t.sidebar.tools.editError;
|
|
46
|
+
setError(message);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
setIsBusy(false);
|
|
50
|
+
setProgressMessage(null);
|
|
51
|
+
}
|
|
52
|
+
}, [t, input, editAiImage, instruction, upload, onJumpToUploads]);
|
|
53
|
+
if (!editAiImage)
|
|
54
|
+
return null;
|
|
55
|
+
const canSubmit = !!input && instruction.trim().length >= MIN_INSTRUCTION_LENGTH;
|
|
56
|
+
return (_jsx(ToolPanel, { body: _jsxs(_Fragment, { children: [_jsx(ImageInputPicker, { value: input, onChange: setInput, disabled: isBusy || isUploading }), _jsx("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: t.sidebar.tools.editPlaceholder, rows: 3, maxLength: MAX_INSTRUCTION_LENGTH, disabled: isBusy || isUploading, className: `w-full p-3 bg-background border border-[var(--font-color)] rounded-lg text-foreground text-sm ${MOBILE_INPUT_TEXT} outline-none resize-none focus:border-primary-600 disabled:opacity-50` }), _jsx("p", { className: "m-0 text-[10px] text-foreground-muted", children: t.sidebar.tools.minInstruction(MIN_INSTRUCTION_LENGTH) })] }), actionLabel: t.topBar.edit, actionIcon: HiPencilSquare, canSubmit: canSubmit, isBusy: isBusy || isUploading, progressMessage: progressMessage, error: error, success: success, onAction: () => void handleAction() }));
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AltTextPage, AltTextScope } from '@ggraphic/editor/CanvasEditorProvider';
|
|
2
|
+
/** Instagram's alt-text limit; the contract's `SLIDE_ALT_TEXT_MAX_CHARS` (guarded by a test) is the same number. */
|
|
3
|
+
export declare const ALT_TEXT_MAX_CHARS = 1000;
|
|
4
|
+
export interface AltTextPagesSource {
|
|
5
|
+
collect: (scope: AltTextScope) => Promise<AltTextPage[]>;
|
|
6
|
+
pageCount: number;
|
|
7
|
+
}
|
|
8
|
+
export interface AltTextToolProps {
|
|
9
|
+
pages: AltTextPagesSource;
|
|
10
|
+
}
|
|
11
|
+
export declare function AltTextTool({ pages }: AltTextToolProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
|
|
4
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
5
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
6
|
+
import { useCallback, useId, useState } from 'react';
|
|
7
|
+
import { HiChatBubbleBottomCenterText } from 'react-icons/hi2';
|
|
8
|
+
import { MOBILE_INPUT_TEXT } from '@ggraphic/editor/sidebar/sidebarStyles';
|
|
9
|
+
import { ToolPanel } from '@ggraphic/editor/sidebar/sections/tools/ToolPanel';
|
|
10
|
+
/** Instagram's alt-text limit; the contract's `SLIDE_ALT_TEXT_MAX_CHARS` (guarded by a test) is the same number. */
|
|
11
|
+
export const ALT_TEXT_MAX_CHARS = 1000;
|
|
12
|
+
function CopyButton({ text, label }) {
|
|
13
|
+
const t = useMessages();
|
|
14
|
+
const [copied, setCopied] = useState(false);
|
|
15
|
+
return (_jsx("button", { type: "button", onClick: () => {
|
|
16
|
+
void navigator.clipboard.writeText(text).then(() => {
|
|
17
|
+
setCopied(true);
|
|
18
|
+
setTimeout(() => setCopied(false), 1500);
|
|
19
|
+
});
|
|
20
|
+
}, className: "text-xs text-primary-600 bg-transparent border-none cursor-pointer hover:underline p-0", children: copied ? t.shell.copied : label }));
|
|
21
|
+
}
|
|
22
|
+
export function AltTextTool({ pages }) {
|
|
23
|
+
const t = useMessages();
|
|
24
|
+
const { generateSlideAltTexts } = useCanvasEditorServices();
|
|
25
|
+
const scopeName = useId();
|
|
26
|
+
const [scope, setScope] = useState('all');
|
|
27
|
+
const [isBusy, setIsBusy] = useState(false);
|
|
28
|
+
const [progressMessage, setProgressMessage] = useState(null);
|
|
29
|
+
const [error, setError] = useState(null);
|
|
30
|
+
const [results, setResults] = useState([]);
|
|
31
|
+
const multiPage = pages.pageCount > 1;
|
|
32
|
+
const effectiveScope = multiPage ? scope : 'active';
|
|
33
|
+
const handleAction = useCallback(async () => {
|
|
34
|
+
if (!generateSlideAltTexts)
|
|
35
|
+
return;
|
|
36
|
+
setError(null);
|
|
37
|
+
setIsBusy(true);
|
|
38
|
+
setProgressMessage(t.sidebar.tools.altText.capturing);
|
|
39
|
+
try {
|
|
40
|
+
const collected = await pages.collect(effectiveScope);
|
|
41
|
+
setProgressMessage(collected.length > 1
|
|
42
|
+
? t.sidebar.tools.altText.writingN(collected.length)
|
|
43
|
+
: t.sidebar.tools.altText.writingAlt);
|
|
44
|
+
const texts = await generateSlideAltTexts(collected);
|
|
45
|
+
setResults(collected.map((page, i) => ({ pageNumber: page.pageNumber, text: texts[i] ?? null })));
|
|
46
|
+
if (texts.some((t) => t === null)) {
|
|
47
|
+
setError(t.sidebar.tools.altText.somePagesFailed);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
setError(err instanceof Error ? err.message : t.sidebar.tools.altText.altError);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
setIsBusy(false);
|
|
55
|
+
setProgressMessage(null);
|
|
56
|
+
}
|
|
57
|
+
}, [t, generateSlideAltTexts, pages, effectiveScope]);
|
|
58
|
+
const updateText = (pageNumber, text) => setResults((prev) => prev.map((r) => (r.pageNumber === pageNumber ? { ...r, text } : r)));
|
|
59
|
+
if (!generateSlideAltTexts)
|
|
60
|
+
return null;
|
|
61
|
+
const done = results.filter((r) => r.text !== null);
|
|
62
|
+
const allText = done.map((r) => `${t.common.page(r.pageNumber)}: ${r.text}`).join('\n\n');
|
|
63
|
+
const scopeChoice = multiPage ? (_jsxs("fieldset", { className: "m-0 p-0 border-none flex flex-col gap-1.5", children: [_jsx("legend", { className: "text-xs text-foreground-muted mb-1", children: t.sidebar.tools.altText.whichPages }), [
|
|
64
|
+
['all', t.sidebar.tools.altText.allPages(pages.pageCount)],
|
|
65
|
+
['active', t.sidebar.tools.altText.currentPageOnly],
|
|
66
|
+
].map(([value, label]) => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-foreground cursor-pointer", children: [_jsx("input", { type: "radio", name: scopeName, value: value, checked: scope === value, onChange: () => setScope(value), disabled: isBusy }), label] }, value)))] })) : null;
|
|
67
|
+
return (_jsx(ToolPanel, { body: _jsxs(_Fragment, { children: [_jsx("p", { className: "m-0 text-xs text-foreground-muted leading-snug", children: t.sidebar.tools.altText.intro }), scopeChoice] }), actionLabel: results.length > 0 ? t.sidebar.tools.altText.regenerate : t.sidebar.tools.altText.createAlt, actionIcon: HiChatBubbleBottomCenterText, canSubmit: true, isBusy: isBusy, progressMessage: progressMessage, error: error, onAction: () => void handleAction(), footer: results.length > 0 ? (_jsxs("div", { className: "flex flex-col gap-3", children: [done.length > 1 ? (_jsx("div", { className: "flex justify-end", children: _jsx(CopyButton, { text: allText, label: t.sidebar.tools.altText.copyAll }) })) : null, results.map((result) => (_jsx(AltTextResultField, { result: result, onChange: (text) => updateText(result.pageNumber, text) }, result.pageNumber))), _jsx("p", { className: "m-0 text-xs text-foreground-muted leading-snug", children: t.sidebar.tools.altText.aiSuggestion })] })) : null }));
|
|
68
|
+
}
|
|
69
|
+
function AltTextResultField({ result, onChange, }) {
|
|
70
|
+
const t = useMessages();
|
|
71
|
+
const fieldId = useId();
|
|
72
|
+
const label = t.common.page(result.pageNumber);
|
|
73
|
+
if (result.text === null) {
|
|
74
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs font-semibold text-foreground", children: label }), _jsx("p", { className: "m-0 text-xs text-foreground-muted", children: t.sidebar.tools.altText.failed })] }));
|
|
75
|
+
}
|
|
76
|
+
const tooLong = result.text.length > ALT_TEXT_MAX_CHARS;
|
|
77
|
+
return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("label", { htmlFor: fieldId, className: "text-xs font-semibold text-foreground", children: label }), _jsx(CopyButton, { text: result.text, label: t.commands.copy })] }), _jsx("textarea", { id: fieldId, value: result.text, onChange: (e) => onChange(e.target.value), rows: 6, className: `w-full resize-y rounded-lg border border-[var(--editor-border)] bg-[var(--editor-surface)] p-2 text-sm ${MOBILE_INPUT_TEXT} text-[var(--editor-text)] leading-snug` }), _jsx("span", { className: cn('text-xs self-end', tooLong ? 'text-[var(--editor-danger-fg)]' : 'text-foreground-muted'), "aria-live": "polite", children: t.sidebar.tools.altText.charCount(result.text.length, ALT_TEXT_MAX_CHARS, tooLong) })] }));
|
|
78
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
|
|
3
|
+
import { CustomColorSwatch } from '@ggraphic/editor/components/CustomColorSwatch';
|
|
4
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
5
|
+
import { brandColors } from '@ggraphic/editor/utils/colorOptions';
|
|
6
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { PiShuffle, PiDropSimpleFill } from 'react-icons/pi';
|
|
8
|
+
import { Layer, Line, Stage } from 'react-konva';
|
|
9
|
+
import { ToolPanel, } from '@ggraphic/editor/sidebar/sections/tools/ToolPanel';
|
|
10
|
+
import { useToolImagePlacement } from '@ggraphic/editor/sidebar/sections/tools/useToolImagePlacement';
|
|
11
|
+
const STAGE_SIZE = 220;
|
|
12
|
+
const CENTER = STAGE_SIZE / 2;
|
|
13
|
+
const BASE_RADIUS = STAGE_SIZE * 0.38;
|
|
14
|
+
const EXPORT_PIXEL_RATIO = 4; // 220 * 4 = 880px PNG
|
|
15
|
+
const MAX_POINTS = 12;
|
|
16
|
+
const TENSION = 0.6;
|
|
17
|
+
/** The document brand's fourth colour, read when the tool opens. */
|
|
18
|
+
const defaultColor = (brand) => () => {
|
|
19
|
+
const palette = brandColors(brand);
|
|
20
|
+
return palette[3]?.value ?? palette[0]?.value ?? '#000000';
|
|
21
|
+
};
|
|
22
|
+
function randomSeed() {
|
|
23
|
+
return Array.from({ length: MAX_POINTS }, () => Math.random());
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A "beautiful blob" is a closed Konva.Line with tension (Catmull-Rom spline)
|
|
27
|
+
* over points placed around a circle with per-point radius jitter. See
|
|
28
|
+
* https://konvajs.org/docs/shapes/Line_-_Blob.html
|
|
29
|
+
*/
|
|
30
|
+
function computeBlobPoints(seed, numPoints, irregularity) {
|
|
31
|
+
const points = [];
|
|
32
|
+
for (let i = 0; i < numPoints; i++) {
|
|
33
|
+
const angle = (i / numPoints) * Math.PI * 2;
|
|
34
|
+
const jitter = 1 - irregularity + seed[i % seed.length] * irregularity * 2;
|
|
35
|
+
const r = BASE_RADIUS * jitter;
|
|
36
|
+
points.push(CENTER + r * Math.cos(angle), CENTER + r * Math.sin(angle));
|
|
37
|
+
}
|
|
38
|
+
return points;
|
|
39
|
+
}
|
|
40
|
+
function ColorRow({ selected, onSelect, disabled, }) {
|
|
41
|
+
const t = useMessages();
|
|
42
|
+
const brand = useDocumentBrand();
|
|
43
|
+
return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("span", { className: "text-xs text-foreground-muted", children: t.sidebar.chart.color }), _jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [brandColors(brand).map((c) => (_jsx("button", { type: "button", disabled: disabled, onClick: () => onSelect(c.value), title: c.name, className: "size-6 rounded-full border border-black/10 transition-transform hover:scale-110 disabled:opacity-50", style: {
|
|
44
|
+
backgroundColor: c.value,
|
|
45
|
+
outline: selected === c.value ? '2px solid var(--editor-accent)' : 'none',
|
|
46
|
+
outlineOffset: '2px',
|
|
47
|
+
} }, c.id))), _jsx(CustomColorSwatch, { value: selected, presets: brandColors(brand).map((c) => c.value), onPick: onSelect, className: "size-6", disabled: disabled })] })] }));
|
|
48
|
+
}
|
|
49
|
+
function LabeledRange({ label, value, min, max, step, onChange, disabled, }) {
|
|
50
|
+
return (_jsxs("label", { className: "flex flex-col gap-1.5 text-xs", children: [_jsx("span", { className: "text-foreground-muted", children: label }), _jsx("input", { type: "range", min: min, max: max, step: step, value: value, onChange: (e) => onChange(Number(e.target.value)), disabled: disabled, className: "w-full max-canvas-mobile:h-11 accent-primary-600 disabled:opacity-50" })] }));
|
|
51
|
+
}
|
|
52
|
+
export function BlobCreatorTool({ onJumpToUploads, onPlaceImageUrl }) {
|
|
53
|
+
const t = useMessages();
|
|
54
|
+
const brand = useDocumentBrand();
|
|
55
|
+
const { finish, isUploading } = useToolImagePlacement({ onPlaceImageUrl, onJumpToUploads });
|
|
56
|
+
const stageRef = useRef(null);
|
|
57
|
+
const [seed, setSeed] = useState(randomSeed);
|
|
58
|
+
const [numPoints, setNumPoints] = useState(7);
|
|
59
|
+
const [irregularity, setIrregularity] = useState(0.35);
|
|
60
|
+
const [color, setColor] = useState(defaultColor(brand));
|
|
61
|
+
const [isBusy, setIsBusy] = useState(false);
|
|
62
|
+
const [error, setError] = useState(null);
|
|
63
|
+
const [success, setSuccess] = useState(null);
|
|
64
|
+
const points = useMemo(() => computeBlobPoints(seed, numPoints, irregularity), [seed, numPoints, irregularity]);
|
|
65
|
+
const disabled = isBusy || isUploading;
|
|
66
|
+
const handleAction = useCallback(async () => {
|
|
67
|
+
const stage = stageRef.current;
|
|
68
|
+
if (!stage) {
|
|
69
|
+
setError(t.sidebar.tools.previewFailed);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
setError(null);
|
|
73
|
+
setSuccess(null);
|
|
74
|
+
setIsBusy(true);
|
|
75
|
+
try {
|
|
76
|
+
const dataUrl = stage.toDataURL({ mimeType: 'image/png', pixelRatio: EXPORT_PIXEL_RATIO });
|
|
77
|
+
const blob = await (await fetch(dataUrl)).blob();
|
|
78
|
+
const file = new File([blob], `blob_${Date.now()}.png`, { type: 'image/png' });
|
|
79
|
+
setSuccess(await finish(file));
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
const message = err instanceof Error ? err.message : t.sidebar.tools.blobError;
|
|
83
|
+
setError(message);
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
setIsBusy(false);
|
|
87
|
+
}
|
|
88
|
+
}, [t, finish]);
|
|
89
|
+
return (_jsx(ToolPanel, { body: _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("div", { className: "self-center rounded-lg bg-editor-inset p-3", children: _jsx(Stage, { ref: stageRef, width: STAGE_SIZE, height: STAGE_SIZE, children: _jsx(Layer, { children: _jsx(Line, { points: points, closed: true, tension: TENSION, fill: color }) }) }) }), _jsxs("button", { type: "button", onClick: () => setSeed(randomSeed()), disabled: disabled, className: "inline-flex items-center justify-center gap-2 rounded-md border border-editor-border-strong bg-background px-sm py-xs text-sm text-foreground transition-colors hover:border-primary-500 disabled:opacity-50", children: [_jsx(PiShuffle, { size: 16 }), t.sidebar.tools.reroll] }), _jsx(ColorRow, { selected: color, onSelect: setColor, disabled: disabled }), _jsx(LabeledRange, { label: t.sidebar.tools.points(numPoints), value: numPoints, min: 4, max: MAX_POINTS, step: 1, onChange: setNumPoints, disabled: disabled }), _jsx(LabeledRange, { label: t.sidebar.tools.irregularity(Math.round(irregularity * 100)), value: irregularity, min: 0.1, max: 0.6, step: 0.05, onChange: setIrregularity, disabled: disabled })] }), actionLabel: onPlaceImageUrl ? t.sidebar.tools.blobPlace : t.sidebar.tools.blobAdd, actionIcon: PiDropSimpleFill, canSubmit: !disabled, isBusy: disabled, progressMessage: isBusy ? t.sidebar.tools.blobSaving : null, error: error, success: success, onAction: () => void handleAction() }));
|
|
90
|
+
}
|