@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,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
|
|
4
|
+
import { headlineFontStack } from '@ggraphic/editor/brand/brandRegistry';
|
|
5
|
+
import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
|
|
6
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
7
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
8
|
+
import { Suspense, useEffect, useId, useState } from 'react';
|
|
9
|
+
import { HiSparkles } from 'react-icons/hi';
|
|
10
|
+
import { HiChatBubbleBottomCenterText, HiPencilSquare, HiPhoto, HiQrCode, HiScissors, } from 'react-icons/hi2';
|
|
11
|
+
import { PiArrowLeft, PiCaretRightBold, PiDropSimpleFill, PiPath } from 'react-icons/pi';
|
|
12
|
+
import { useIsCanvasMobile } from '@ggraphic/editor/hooks/useIsCanvasMobile';
|
|
13
|
+
import { lazyWithPreload } from '@ggraphic/editor/sidebar/sections/lazyWithPreload';
|
|
14
|
+
import { whenIdle } from '@ggraphic/editor/sidebar/sections/whenIdle';
|
|
15
|
+
import { ToolTile } from '@ggraphic/editor/sidebar/sections/tools/ToolTiles';
|
|
16
|
+
// The panels load on demand, so opening the tab only waits for the tiles. Once
|
|
17
|
+
// the tab is idle every offered panel is preloaded (touch has no hover), and a
|
|
18
|
+
// tile also warms its own on pointer-enter/focus in case the click comes first.
|
|
19
|
+
const PANELS = {
|
|
20
|
+
'remove-bg': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/RemoveBackgroundTool').then((m) => m.RemoveBackgroundTool)),
|
|
21
|
+
'ai-create': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/AiCreateTool').then((m) => m.AiCreateTool)),
|
|
22
|
+
'ai-edit': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/AiEditTool').then((m) => m.AiEditTool)),
|
|
23
|
+
'alt-text': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/AltTextTool').then((m) => m.AltTextTool)),
|
|
24
|
+
unsplash: lazyWithPreload(() => import('./UnsplashTool.js').then((m) => m.UnsplashTool)),
|
|
25
|
+
'qr-code': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/QRCodeTool').then((m) => m.QRCodeTool)),
|
|
26
|
+
'gradient-text': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/GradientTextTool').then((m) => m.GradientTextTool)),
|
|
27
|
+
blob: lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/BlobCreatorTool').then((m) => m.BlobCreatorTool)),
|
|
28
|
+
'text-path': lazyWithPreload(() => import('@ggraphic/editor/sidebar/sections/tools/TextPathCreatorTool').then((m) => m.TextPathCreatorTool)),
|
|
29
|
+
};
|
|
30
|
+
const { 'remove-bg': RemoveBackgroundTool, 'ai-create': AiCreateTool, 'ai-edit': AiEditTool, 'alt-text': AltTextTool, unsplash: UnsplashTool, 'qr-code': QRCodeTool, 'gradient-text': GradientTextTool, blob: BlobCreatorTool, 'text-path': TextPathCreatorTool, } = PANELS;
|
|
31
|
+
// A failed warm-up is not an error yet: the panel retries when it renders.
|
|
32
|
+
const warmPanel = (id) => void PANELS[id].preload().catch(() => { });
|
|
33
|
+
// The letters carry the gradient themselves, so the tile shows what the tool makes.
|
|
34
|
+
export function GradientTextIcon({ size = 24, className }) {
|
|
35
|
+
const gradientId = useId();
|
|
36
|
+
const brand = useDocumentBrand();
|
|
37
|
+
const { secondary, accent } = brand.colors;
|
|
38
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", className: className, "aria-hidden": "true", children: [_jsx("defs", { children: _jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "1", y2: "0", children: [_jsx("stop", { offset: "0", stopColor: secondary }), _jsx("stop", { offset: "1", stopColor: accent })] }) }), _jsx("text", { x: "12", y: "18", textAnchor: "middle", fontSize: "17", fontWeight: "900", fontFamily: headlineFontStack(brand), fill: `url(#${gradientId})`, children: "Aa" })] }));
|
|
39
|
+
}
|
|
40
|
+
function ToolCardButton({ card, onClick, }) {
|
|
41
|
+
return (_jsxs("button", { type: "button", onClick: onClick, onPointerEnter: () => warmPanel(card.id), onFocus: () => warmPanel(card.id), className: cn('tool-tile-trigger flex w-full flex-col items-center gap-2.5 p-2 cursor-pointer bg-transparent border-none rounded-[14px]', 'transition-colors duration-150 hover:bg-[var(--editor-active-soft)]', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-600'), children: [_jsx(ToolTile, { id: card.id }), _jsx("span", { className: "text-sm leading-tight text-foreground text-center", children: card.label })] }));
|
|
42
|
+
}
|
|
43
|
+
function ToolListRow({ card, onClick }) {
|
|
44
|
+
const Icon = card.icon;
|
|
45
|
+
return (_jsxs("button", { type: "button", onClick: onClick, className: "flex items-center gap-3 w-full min-h-14 py-2 px-0 bg-transparent border-none cursor-pointer text-left rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]", children: [_jsx("span", { className: cn('flex items-center justify-center size-10 shrink-0 rounded-[10px]', card.ai
|
|
46
|
+
? 'bg-[var(--editor-active-bg)] text-[var(--editor-active-fg)]'
|
|
47
|
+
: 'bg-[var(--editor-tile)] text-[var(--editor-text)]'), children: _jsx(Icon, { size: 20 }) }), _jsxs("span", { className: "flex flex-col flex-1 min-w-0", children: [_jsx("span", { className: "text-[15px] font-bold leading-tight text-[var(--editor-text)]", children: card.label }), _jsx("span", { className: "text-[13px] leading-snug text-[var(--editor-text-muted)]", children: card.description })] }), _jsx(PiCaretRightBold, { size: 14, className: "shrink-0 text-[var(--editor-text-muted)]" })] }));
|
|
48
|
+
}
|
|
49
|
+
function ToolListGroup({ label, cards, onSelect, }) {
|
|
50
|
+
if (cards.length === 0)
|
|
51
|
+
return null;
|
|
52
|
+
return (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("h4", { className: "m-0 text-[13px] font-bold text-[var(--editor-text-muted)]", children: label }), cards.map((card) => (_jsx(ToolListRow, { card: card, onClick: () => onSelect(card.id) }, card.id)))] }));
|
|
53
|
+
}
|
|
54
|
+
function DrillDownHeader({ label, onBack }) {
|
|
55
|
+
return (_jsxs("button", { type: "button", onClick: onBack, className: "flex items-center gap-2 w-full bg-transparent border-none cursor-pointer py-1.5 px-0 text-foreground text-sm font-semibold transition-colors duration-150 hover:text-primary-600 mb-2", children: [_jsx(PiArrowLeft, { size: 16 }), _jsx("span", { children: label })] }));
|
|
56
|
+
}
|
|
57
|
+
export function ToolsSection({ onJumpToUploads, onPlaceImageUrl, altTextPages, }) {
|
|
58
|
+
const t = useMessages();
|
|
59
|
+
const { removeBackgroundFromImage, generateAiImage, editAiImage, searchUnsplashImages, generateSlideAltTexts, } = useCanvasEditorServices();
|
|
60
|
+
const [activeView, setActiveView] = useState('browse');
|
|
61
|
+
const isMobile = useIsCanvasMobile();
|
|
62
|
+
const cards = [
|
|
63
|
+
{
|
|
64
|
+
id: 'remove-bg',
|
|
65
|
+
description: t.sidebar.tools.tiles.removeBgDesc,
|
|
66
|
+
ai: false,
|
|
67
|
+
label: t.sidebar.tools.tiles.removeBgLabel,
|
|
68
|
+
icon: HiScissors,
|
|
69
|
+
available: !!removeBackgroundFromImage,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'ai-create',
|
|
73
|
+
description: t.sidebar.tools.tiles.aiCreateDesc,
|
|
74
|
+
ai: true,
|
|
75
|
+
label: t.sidebar.tools.tiles.aiCreateLabel,
|
|
76
|
+
icon: HiSparkles,
|
|
77
|
+
available: !!generateAiImage,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'ai-edit',
|
|
81
|
+
description: t.sidebar.tools.tiles.aiEditDesc,
|
|
82
|
+
ai: true,
|
|
83
|
+
label: t.sidebar.tools.tiles.aiEditLabel,
|
|
84
|
+
icon: HiPencilSquare,
|
|
85
|
+
available: !!editAiImage,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'alt-text',
|
|
89
|
+
description: t.sidebar.tools.tiles.altDesc,
|
|
90
|
+
ai: true,
|
|
91
|
+
label: t.sidebar.tools.tiles.altLabel,
|
|
92
|
+
icon: HiChatBubbleBottomCenterText,
|
|
93
|
+
available: !!generateSlideAltTexts && !!altTextPages,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'unsplash',
|
|
97
|
+
description: t.sidebar.tools.tiles.unsplashDesc,
|
|
98
|
+
ai: false,
|
|
99
|
+
label: t.sidebar.tools.tiles.unsplashLabel,
|
|
100
|
+
icon: HiPhoto,
|
|
101
|
+
available: !!searchUnsplashImages && !!onPlaceImageUrl,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'qr-code',
|
|
105
|
+
description: t.sidebar.tools.tiles.qrDesc,
|
|
106
|
+
ai: false,
|
|
107
|
+
label: t.sidebar.tools.tiles.qrLabel,
|
|
108
|
+
icon: HiQrCode,
|
|
109
|
+
available: true,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 'gradient-text',
|
|
113
|
+
description: t.sidebar.tools.tiles.gradientDesc,
|
|
114
|
+
ai: false,
|
|
115
|
+
label: t.sidebar.tools.tiles.gradientLabel,
|
|
116
|
+
icon: GradientTextIcon,
|
|
117
|
+
available: true,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 'blob',
|
|
121
|
+
description: t.sidebar.tools.tiles.blobDesc,
|
|
122
|
+
ai: false,
|
|
123
|
+
label: t.sidebar.tools.tiles.blobLabel,
|
|
124
|
+
icon: PiDropSimpleFill,
|
|
125
|
+
available: true,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'text-path',
|
|
129
|
+
description: t.sidebar.tools.tiles.pathDesc,
|
|
130
|
+
ai: false,
|
|
131
|
+
label: t.sidebar.tools.tiles.pathLabel,
|
|
132
|
+
icon: PiPath,
|
|
133
|
+
available: true,
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
const availableCards = cards.filter((c) => c.available);
|
|
137
|
+
const availableKey = availableCards.map((c) => c.id).join(',');
|
|
138
|
+
useEffect(() => whenIdle(() => availableKey.split(',').forEach((id) => warmPanel(id))), [availableKey]);
|
|
139
|
+
if (availableCards.length === 0) {
|
|
140
|
+
return _jsx("div", { className: "p-4 text-xs text-foreground-muted", children: t.sidebar.tools.tiles.none });
|
|
141
|
+
}
|
|
142
|
+
if (activeView === 'browse' && isMobile) {
|
|
143
|
+
return (_jsxs("div", { className: "flex flex-col gap-4 w-full min-w-0", children: [_jsx(ToolListGroup, { label: t.sidebar.tools.tiles.withAi, cards: availableCards.filter((c) => c.ai), onSelect: setActiveView }), _jsx(ToolListGroup, { label: t.sidebar.tools.tiles.create, cards: availableCards.filter((c) => !c.ai), onSelect: setActiveView })] }));
|
|
144
|
+
}
|
|
145
|
+
if (activeView === 'browse') {
|
|
146
|
+
return (_jsx("div", { className: "flex flex-col gap-4 w-full min-w-0 p-md", children: _jsx("div", { className: "grid grid-cols-2 gap-x-3 gap-y-7", children: availableCards.map((card) => (_jsx(ToolCardButton, { card: card, onClick: () => setActiveView(card.id) }, card.id))) }) }));
|
|
147
|
+
}
|
|
148
|
+
const activeCard = cards.find((c) => c.id === activeView);
|
|
149
|
+
const goBack = () => setActiveView('browse');
|
|
150
|
+
return (_jsxs("div", { className: cn('flex flex-col gap-2 w-full min-w-0', !isMobile && 'px-md pt-md'), children: [_jsx(DrillDownHeader, { label: activeCard?.label ?? '', onBack: goBack }), _jsxs(Suspense, { fallback: null, children: [activeView === 'remove-bg' && _jsx(RemoveBackgroundTool, { onJumpToUploads: onJumpToUploads }), activeView === 'ai-create' && _jsx(AiCreateTool, { onJumpToUploads: onJumpToUploads }), activeView === 'ai-edit' && _jsx(AiEditTool, { onJumpToUploads: onJumpToUploads }), activeView === 'unsplash' && _jsx(UnsplashTool, { onPlaceImageUrl: onPlaceImageUrl }), activeView === 'alt-text' && altTextPages && _jsx(AltTextTool, { pages: altTextPages }), activeView === 'qr-code' && (_jsx(QRCodeTool, { onJumpToUploads: onJumpToUploads, onPlaceImageUrl: onPlaceImageUrl })), activeView === 'gradient-text' && (_jsx(GradientTextTool, { onJumpToUploads: onJumpToUploads, onPlaceImageUrl: onPlaceImageUrl })), activeView === 'blob' && (_jsx(BlobCreatorTool, { onJumpToUploads: onJumpToUploads, onPlaceImageUrl: onPlaceImageUrl })), activeView === 'text-path' && (_jsx(TextPathCreatorTool, { onJumpToUploads: onJumpToUploads, onPlaceImageUrl: onPlaceImageUrl }))] })] }));
|
|
151
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Says why the Unsplash search stopped and when it works again. */
|
|
2
|
+
export declare function UnsplashLimitNotice({ retryAt }: {
|
|
3
|
+
retryAt: Date;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
/** A quiet hint once the hourly Unsplash budget runs low. */
|
|
6
|
+
export declare function UnsplashRemaining({ remaining }: {
|
|
7
|
+
remaining: number | null;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, 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
|
+
/** Unsplash allows the shared key 50 searches an hour; below this the count is shown. */
|
|
6
|
+
const LOW_REMAINING = 10;
|
|
7
|
+
function clockTime(date) {
|
|
8
|
+
return date.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' });
|
|
9
|
+
}
|
|
10
|
+
/** Says why the Unsplash search stopped and when it works again. */
|
|
11
|
+
export function UnsplashLimitNotice({ retryAt }) {
|
|
12
|
+
const t = useMessages().sidebar.tools.unsplashLimit;
|
|
13
|
+
const { unsplashQuotaOwner = t.defaultOwner } = useCanvasEditorServices();
|
|
14
|
+
return (_jsxs("div", { role: "status", className: "flex flex-col gap-1 rounded-lg px-3 py-2.5 bg-[var(--editor-tile)] text-xs text-[var(--editor-text)]", children: [_jsx("strong", { className: "text-[13px]", children: t.title }), _jsx("span", { className: "text-[var(--editor-text-muted)] [text-wrap:pretty]", children: t.body(unsplashQuotaOwner, clockTime(retryAt)) })] }));
|
|
15
|
+
}
|
|
16
|
+
/** A quiet hint once the hourly Unsplash budget runs low. */
|
|
17
|
+
export function UnsplashRemaining({ remaining }) {
|
|
18
|
+
const t = useMessages().sidebar.tools.unsplashLimit;
|
|
19
|
+
if (remaining === null || remaining > LOW_REMAINING)
|
|
20
|
+
return null;
|
|
21
|
+
return (_jsx("p", { className: "m-0 text-[11px] text-[var(--editor-text-muted)]", children: t.remaining(remaining) }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UserImagePlacement } from '@ggraphic/editor/utils/userImageUtils';
|
|
2
|
+
export interface UnsplashToolProps {
|
|
3
|
+
onPlaceImageUrl?: (url: string, fileName: string, options?: UserImagePlacement) => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Unsplash search as a tool. A picked photo is placed by its hotlinked
|
|
7
|
+
* Unsplash URL and keeps its credit — API Terms §6 forbid re-hosting the
|
|
8
|
+
* unaltered photo, so it never goes through the uploads / Mediathek.
|
|
9
|
+
*/
|
|
10
|
+
export declare function UnsplashTool({ onPlaceImageUrl }: UnsplashToolProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
|
|
4
|
+
import { useNoUnsplashSearch } from '@ggraphic/editor/hostServices';
|
|
5
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
+
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
|
8
|
+
import { useTrackUnsplashDownload } from '@ggraphic/editor/hooks/useTrackUnsplashDownload';
|
|
9
|
+
import { useUnsplashHome } from '@ggraphic/editor/utils/unsplashLinks';
|
|
10
|
+
import { MOBILE_INPUT_TEXT } from '@ggraphic/editor/sidebar/sidebarStyles';
|
|
11
|
+
import { unsplashThumbnailUrl } from '@ggraphic/editor/sidebar/sections/assets/useStockPhotos';
|
|
12
|
+
import { UnsplashLimitNotice, UnsplashRemaining, } from '@ggraphic/editor/sidebar/sections/tools/UnsplashLimitNotice';
|
|
13
|
+
const SEARCH_DEBOUNCE_MS = 400;
|
|
14
|
+
/**
|
|
15
|
+
* Unsplash search as a tool. A picked photo is placed by its hotlinked
|
|
16
|
+
* Unsplash URL and keeps its credit — API Terms §6 forbid re-hosting the
|
|
17
|
+
* unaltered photo, so it never goes through the uploads / Mediathek.
|
|
18
|
+
*/
|
|
19
|
+
export function UnsplashTool({ onPlaceImageUrl }) {
|
|
20
|
+
const t = useMessages();
|
|
21
|
+
const unsplashHome = useUnsplashHome();
|
|
22
|
+
// `useUnsplashSearch` is a host hook, fixed for the lifetime of the editor.
|
|
23
|
+
const { searchUnsplashImages, useUnsplashSearch = useNoUnsplashSearch } = useCanvasEditorServices();
|
|
24
|
+
const trackDownload = useTrackUnsplashDownload();
|
|
25
|
+
const searchFn = useCallback((q, p, pp) => searchUnsplashImages
|
|
26
|
+
? searchUnsplashImages(q, p, pp)
|
|
27
|
+
: Promise.resolve({ results: [], total: 0, total_pages: 0 }), [searchUnsplashImages]);
|
|
28
|
+
const { searchResults, totalResults, isLoadingSearch, searchError, limit, remaining, lastQuery, searchUnsplash, loadMoreResults, } = useUnsplashSearch(searchFn);
|
|
29
|
+
const [query, setQuery] = useState('');
|
|
30
|
+
const [placedId, setPlacedId] = useState(null);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const id = setTimeout(() => void searchUnsplash(query), SEARCH_DEBOUNCE_MS);
|
|
33
|
+
return () => clearTimeout(id);
|
|
34
|
+
}, [query, searchUnsplash]);
|
|
35
|
+
const handlePick = (image) => {
|
|
36
|
+
if (!image.url || !onPlaceImageUrl)
|
|
37
|
+
return;
|
|
38
|
+
trackDownload(image.filename, image.attribution);
|
|
39
|
+
onPlaceImageUrl(image.url, image.filename, { attribution: image.attribution });
|
|
40
|
+
setPlacedId(image.filename);
|
|
41
|
+
};
|
|
42
|
+
const hasMore = searchResults.length > 0 && searchResults.length < totalResults;
|
|
43
|
+
return (_jsxs("div", { className: "flex flex-col gap-3 w-full min-w-0", children: [_jsxs("form", { role: "search", onSubmit: (e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
void searchUnsplash(query);
|
|
46
|
+
}, className: "relative", children: [_jsx(HiMagnifyingGlass, { size: 16, "aria-hidden": true, className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--editor-text-muted)]" }), _jsx("input", { type: "search", enterKeyHint: "search", value: query, onChange: (e) => setQuery(e.target.value), placeholder: t.sidebar.tools.unsplashPlaceholder, "aria-label": t.sidebar.tools.unsplashSearch, className: `w-full h-9 pl-8 pr-2 rounded-md border border-[var(--editor-border-strong)] bg-[var(--editor-surface)] text-sm ${MOBILE_INPUT_TEXT} text-[var(--editor-text)] placeholder:text-[var(--editor-text-muted)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]` })] }), limit && _jsx(UnsplashLimitNotice, { retryAt: limit.retryAt }), searchError && (_jsx("p", { role: "alert", className: "m-0 text-xs text-editor-danger-fg", children: searchError })), !lastQuery && !isLoadingSearch && (_jsx("p", { className: "m-0 text-xs text-[var(--editor-text-muted)]", children: t.sidebar.tools.unsplashHint })), lastQuery && !isLoadingSearch && searchResults.length === 0 && !searchError && !limit && (_jsx("p", { role: "status", className: "m-0 text-xs text-[var(--editor-text-muted)]", children: t.unsplash.noPhotos(lastQuery) })), searchResults.length > 0 && (_jsx("ul", { className: "grid grid-cols-2 gap-2 m-0 p-0 list-none", children: searchResults.map((image) => (_jsxs("li", { className: "flex flex-col gap-1 min-w-0", children: [_jsx("button", { type: "button", onClick: () => handlePick(image), "aria-label": t.sidebar.tools.insertPhoto(image.alt_text ?? image.filename), className: "block w-full aspect-square p-0 overflow-hidden rounded-md border-none bg-[var(--editor-tile)] cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]", children: image.url && (_jsx("img", { src: unsplashThumbnailUrl(image.url), alt: "", loading: "lazy", decoding: "async", draggable: false, className: "size-full object-cover" })) }), image.attribution && (_jsx("a", { href: image.attribution.profileUrl, target: "_blank", rel: "noopener noreferrer", title: t.sidebar.tools.photoBy(image.attribution.photographer), className: "truncate text-[11px] text-[var(--editor-text-muted)] no-underline hover:underline", children: image.attribution.photographer })), placedId === image.filename && (_jsx("span", { role: "status", className: "text-[11px] text-[var(--editor-active-fg)]", children: t.unsplash.inserted }))] }, image.filename))) })), isLoadingSearch && (_jsx("p", { role: "status", className: "m-0 text-xs text-[var(--editor-text-muted)]", children: t.sidebar.uploads.loading })), hasMore && !isLoadingSearch && (_jsx("button", { type: "button", onClick: () => void loadMoreResults(), className: "h-9 rounded-md border border-[var(--editor-border-strong)] bg-transparent text-sm text-[var(--editor-text)] cursor-pointer hover:bg-[var(--editor-surface-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]", children: t.unsplash.loadMore(searchResults.length, totalResults) })), !limit && _jsx(UnsplashRemaining, { remaining: remaining }), _jsxs("p", { className: "m-0 text-[11px] text-[var(--editor-text-muted)]", children: [t.unsplash.photosFrom, ' ', _jsx("a", { href: unsplashHome, target: "_blank", rel: "noopener noreferrer", className: "text-[var(--editor-text)] underline", children: "Unsplash" }), ' ', t.unsplash.licence] })] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ToolsSection, type ToolsSectionProps } from './ToolsSection.js';
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MPL-2.0 */
|
|
2
|
+
/* Tools-Raster: Mini-Vorschau-Kacheln (ToolTiles.tsx).
|
|
3
|
+
*
|
|
4
|
+
* Die Farben kommen aus der --primary-Skala, damit die Kacheln dem Seitenakzent
|
|
5
|
+
* folgen (Studio: Lila, sonst Grün). Die Animationen startet allein das CSS über
|
|
6
|
+
* :hover / :focus-visible des Buttons — kein React-State, also kein Rerender.
|
|
7
|
+
* Ruhezustand ist der 0-%-Frame jeder Animation, sonst springt die Kachel beim
|
|
8
|
+
* Verlassen. */
|
|
9
|
+
|
|
10
|
+
.tt-f50 {
|
|
11
|
+
fill: var(--primary-50);
|
|
12
|
+
}
|
|
13
|
+
.tt-f100 {
|
|
14
|
+
fill: var(--primary-100);
|
|
15
|
+
}
|
|
16
|
+
.tt-f200 {
|
|
17
|
+
fill: var(--primary-200);
|
|
18
|
+
}
|
|
19
|
+
.tt-f300 {
|
|
20
|
+
fill: var(--primary-300);
|
|
21
|
+
}
|
|
22
|
+
.tt-f400 {
|
|
23
|
+
fill: var(--primary-400);
|
|
24
|
+
}
|
|
25
|
+
.tt-f500 {
|
|
26
|
+
fill: var(--primary-500);
|
|
27
|
+
}
|
|
28
|
+
.tt-f700 {
|
|
29
|
+
fill: var(--primary-700);
|
|
30
|
+
}
|
|
31
|
+
.tt-s100 {
|
|
32
|
+
stop-color: var(--primary-100);
|
|
33
|
+
}
|
|
34
|
+
.tt-s400 {
|
|
35
|
+
stop-color: var(--primary-400);
|
|
36
|
+
}
|
|
37
|
+
.tt-s700 {
|
|
38
|
+
stop-color: var(--primary-700);
|
|
39
|
+
}
|
|
40
|
+
.tt-k200 {
|
|
41
|
+
stroke: var(--primary-200);
|
|
42
|
+
}
|
|
43
|
+
.tt-k500 {
|
|
44
|
+
stroke: var(--primary-500);
|
|
45
|
+
}
|
|
46
|
+
.tt-k700 {
|
|
47
|
+
stroke: var(--primary-700);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Elemente, die sich um die eigene Mitte drehen oder skalieren */
|
|
51
|
+
.tt-own {
|
|
52
|
+
transform-box: fill-box;
|
|
53
|
+
transform-origin: center;
|
|
54
|
+
}
|
|
55
|
+
.tt-own-left {
|
|
56
|
+
transform-box: fill-box;
|
|
57
|
+
transform-origin: left center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.tt-wand {
|
|
61
|
+
transform-box: view-box;
|
|
62
|
+
transform-origin: 48px 69px;
|
|
63
|
+
}
|
|
64
|
+
.tt-fan-l,
|
|
65
|
+
.tt-fan-r {
|
|
66
|
+
transform-box: view-box;
|
|
67
|
+
transform-origin: 36px 37px;
|
|
68
|
+
}
|
|
69
|
+
.tt-fan-l {
|
|
70
|
+
transform: rotate(-12deg);
|
|
71
|
+
}
|
|
72
|
+
.tt-fan-r {
|
|
73
|
+
transform: rotate(7deg);
|
|
74
|
+
}
|
|
75
|
+
.tt-shine {
|
|
76
|
+
transform: translateX(-14px) skewX(-20deg);
|
|
77
|
+
}
|
|
78
|
+
.tt-spread {
|
|
79
|
+
transform-box: view-box;
|
|
80
|
+
transform-origin: 36px 44px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
84
|
+
.tool-tile-trigger:is(:hover, :focus-visible) {
|
|
85
|
+
.tt-wipe {
|
|
86
|
+
animation: tool-tile-wipe 4.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
|
|
87
|
+
}
|
|
88
|
+
.tt-sun {
|
|
89
|
+
animation: tool-tile-sun 2s ease-in-out infinite;
|
|
90
|
+
}
|
|
91
|
+
.tt-twinkle {
|
|
92
|
+
animation: tool-tile-twinkle 3.6s ease-in-out infinite;
|
|
93
|
+
}
|
|
94
|
+
.tt-twinkle-2 {
|
|
95
|
+
animation: tool-tile-twinkle 3.6s ease-in-out 0.15s infinite;
|
|
96
|
+
}
|
|
97
|
+
.tt-wand {
|
|
98
|
+
animation: tool-tile-wand 3.8s ease-in-out infinite;
|
|
99
|
+
}
|
|
100
|
+
.tt-spark {
|
|
101
|
+
animation: tool-tile-spark 3.8s ease-in-out infinite;
|
|
102
|
+
}
|
|
103
|
+
.tt-spark-2 {
|
|
104
|
+
animation: tool-tile-spark 3.8s ease-in-out 0.12s infinite;
|
|
105
|
+
}
|
|
106
|
+
.tt-spark-3 {
|
|
107
|
+
animation: tool-tile-spark 3.8s ease-in-out 0.24s infinite;
|
|
108
|
+
}
|
|
109
|
+
.tt-tag {
|
|
110
|
+
animation: tool-tile-tag 4.4s ease-out infinite;
|
|
111
|
+
}
|
|
112
|
+
.tt-type {
|
|
113
|
+
animation: tool-tile-type 4.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
|
|
114
|
+
}
|
|
115
|
+
.tt-type-2 {
|
|
116
|
+
animation: tool-tile-type 4.4s cubic-bezier(0.65, 0, 0.35, 1) 0.15s infinite;
|
|
117
|
+
}
|
|
118
|
+
.tt-fan-l {
|
|
119
|
+
animation: tool-tile-fan-l 4s cubic-bezier(0.34, 1.4, 0.64, 1) infinite;
|
|
120
|
+
}
|
|
121
|
+
.tt-fan-r {
|
|
122
|
+
animation: tool-tile-fan-r 4s cubic-bezier(0.34, 1.4, 0.64, 1) infinite;
|
|
123
|
+
}
|
|
124
|
+
.tt-lift {
|
|
125
|
+
animation: tool-tile-lift 4s cubic-bezier(0.34, 1.4, 0.64, 1) infinite;
|
|
126
|
+
}
|
|
127
|
+
.tt-scan {
|
|
128
|
+
animation: tool-tile-scan 3.4s ease-in-out infinite;
|
|
129
|
+
}
|
|
130
|
+
.tt-shine {
|
|
131
|
+
animation: tool-tile-shine 3.2s ease-in-out infinite;
|
|
132
|
+
}
|
|
133
|
+
.tt-blob {
|
|
134
|
+
animation:
|
|
135
|
+
tool-tile-blob-morph 2.6s ease-in-out infinite,
|
|
136
|
+
tool-tile-blob-spin 5.2s ease-in-out infinite;
|
|
137
|
+
}
|
|
138
|
+
.tt-dash {
|
|
139
|
+
animation: tool-tile-dash 0.9s linear infinite;
|
|
140
|
+
}
|
|
141
|
+
.tt-spread {
|
|
142
|
+
animation: tool-tile-spread 4s ease-in-out infinite;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@keyframes tool-tile-wipe {
|
|
148
|
+
0% {
|
|
149
|
+
transform: translateX(0);
|
|
150
|
+
}
|
|
151
|
+
25%,
|
|
152
|
+
60% {
|
|
153
|
+
transform: translateX(36px);
|
|
154
|
+
}
|
|
155
|
+
85%,
|
|
156
|
+
100% {
|
|
157
|
+
transform: translateX(0);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
@keyframes tool-tile-twinkle {
|
|
161
|
+
0% {
|
|
162
|
+
transform: scale(1) rotate(0);
|
|
163
|
+
}
|
|
164
|
+
15% {
|
|
165
|
+
transform: scale(0.35) rotate(45deg);
|
|
166
|
+
}
|
|
167
|
+
32% {
|
|
168
|
+
transform: scale(1.15) rotate(90deg);
|
|
169
|
+
}
|
|
170
|
+
45%,
|
|
171
|
+
100% {
|
|
172
|
+
transform: scale(1) rotate(90deg);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
@keyframes tool-tile-sun {
|
|
176
|
+
0%,
|
|
177
|
+
100% {
|
|
178
|
+
transform: translateY(0);
|
|
179
|
+
}
|
|
180
|
+
50% {
|
|
181
|
+
transform: translateY(-3px);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
@keyframes tool-tile-wand {
|
|
185
|
+
0% {
|
|
186
|
+
transform: rotate(0);
|
|
187
|
+
}
|
|
188
|
+
15% {
|
|
189
|
+
transform: rotate(-14deg);
|
|
190
|
+
}
|
|
191
|
+
32% {
|
|
192
|
+
transform: rotate(9deg);
|
|
193
|
+
}
|
|
194
|
+
48%,
|
|
195
|
+
100% {
|
|
196
|
+
transform: rotate(0);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
@keyframes tool-tile-spark {
|
|
200
|
+
0% {
|
|
201
|
+
transform: scale(1);
|
|
202
|
+
opacity: 1;
|
|
203
|
+
}
|
|
204
|
+
12% {
|
|
205
|
+
transform: scale(0);
|
|
206
|
+
opacity: 0;
|
|
207
|
+
}
|
|
208
|
+
28% {
|
|
209
|
+
transform: scale(1.3);
|
|
210
|
+
opacity: 1;
|
|
211
|
+
}
|
|
212
|
+
40%,
|
|
213
|
+
100% {
|
|
214
|
+
transform: scale(1);
|
|
215
|
+
opacity: 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/* Startet und endet voll, damit die Zeilen in Ruhe sichtbar bleiben: erst
|
|
219
|
+
wegwischen, dann neu eintippen. */
|
|
220
|
+
@keyframes tool-tile-type {
|
|
221
|
+
0% {
|
|
222
|
+
transform: scaleX(1);
|
|
223
|
+
}
|
|
224
|
+
12% {
|
|
225
|
+
transform: scaleX(0);
|
|
226
|
+
}
|
|
227
|
+
34%,
|
|
228
|
+
100% {
|
|
229
|
+
transform: scaleX(1);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
@keyframes tool-tile-tag {
|
|
233
|
+
0% {
|
|
234
|
+
transform: scale(1);
|
|
235
|
+
}
|
|
236
|
+
10% {
|
|
237
|
+
transform: scale(1.18);
|
|
238
|
+
}
|
|
239
|
+
20%,
|
|
240
|
+
100% {
|
|
241
|
+
transform: scale(1);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
@keyframes tool-tile-fan-l {
|
|
245
|
+
0%,
|
|
246
|
+
100% {
|
|
247
|
+
transform: rotate(-12deg);
|
|
248
|
+
}
|
|
249
|
+
22%,
|
|
250
|
+
62% {
|
|
251
|
+
transform: rotate(-21deg) translateX(-2px);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
@keyframes tool-tile-fan-r {
|
|
255
|
+
0%,
|
|
256
|
+
100% {
|
|
257
|
+
transform: rotate(7deg);
|
|
258
|
+
}
|
|
259
|
+
22%,
|
|
260
|
+
62% {
|
|
261
|
+
transform: rotate(17deg) translateX(2px);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
@keyframes tool-tile-lift {
|
|
265
|
+
0%,
|
|
266
|
+
100% {
|
|
267
|
+
transform: translateY(0);
|
|
268
|
+
}
|
|
269
|
+
22%,
|
|
270
|
+
62% {
|
|
271
|
+
transform: translateY(-2px);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
@keyframes tool-tile-scan {
|
|
275
|
+
0% {
|
|
276
|
+
transform: translateY(0);
|
|
277
|
+
opacity: 1;
|
|
278
|
+
}
|
|
279
|
+
45% {
|
|
280
|
+
transform: translateY(62px);
|
|
281
|
+
opacity: 1;
|
|
282
|
+
}
|
|
283
|
+
55%,
|
|
284
|
+
100% {
|
|
285
|
+
transform: translateY(62px);
|
|
286
|
+
opacity: 0;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
@keyframes tool-tile-shine {
|
|
290
|
+
0% {
|
|
291
|
+
transform: translateX(-14px) skewX(-20deg);
|
|
292
|
+
}
|
|
293
|
+
40%,
|
|
294
|
+
100% {
|
|
295
|
+
transform: translateX(90px) skewX(-20deg);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/* Browser ohne CSS-`d` (Safari) behalten die Form und drehen nur. */
|
|
299
|
+
@keyframes tool-tile-blob-morph {
|
|
300
|
+
0%,
|
|
301
|
+
100% {
|
|
302
|
+
d: path(
|
|
303
|
+
'M40 13C51 13 60 20 59 32C58 43 52 50 42 56C32 62 19 60 14 50C9 40 14 31 21 23C27 16 32 13 40 13Z'
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
50% {
|
|
307
|
+
d: path(
|
|
308
|
+
'M35 11C49 10 61 21 60 34C59 46 50 55 38 57C26 59 15 54 13 44C11 34 16 25 22 19C27 14 30 12 35 11Z'
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
@keyframes tool-tile-blob-spin {
|
|
313
|
+
0%,
|
|
314
|
+
100% {
|
|
315
|
+
transform: rotate(0);
|
|
316
|
+
}
|
|
317
|
+
50% {
|
|
318
|
+
transform: rotate(8deg);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
@keyframes tool-tile-dash {
|
|
322
|
+
to {
|
|
323
|
+
stroke-dashoffset: -24;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
@keyframes tool-tile-spread {
|
|
327
|
+
0%,
|
|
328
|
+
100% {
|
|
329
|
+
transform: scale(1);
|
|
330
|
+
}
|
|
331
|
+
30%,
|
|
332
|
+
65% {
|
|
333
|
+
transform: scale(1.1);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ToolPanelSuccess } from './ToolPanel.js';
|
|
2
|
+
interface Options {
|
|
3
|
+
/** When present, the generated image is placed straight onto the canvas. */
|
|
4
|
+
onPlaceImageUrl?: (url: string, fileName: string) => void;
|
|
5
|
+
/** Fallback nudge to the Uploads tab when direct placement isn't wired. */
|
|
6
|
+
onJumpToUploads?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Shared finish-step for the generator tools, built on {@link useImagePlacement}.
|
|
10
|
+
* When `onPlaceImageUrl` is wired, the produced file is uploaded with the
|
|
11
|
+
* `canvas-element` source — a durable share URL excluded from the Uploads tab
|
|
12
|
+
* and Mediathek — and placed straight onto the canvas. Otherwise it falls back
|
|
13
|
+
* to adding the file to Uploads. Returns the `ToolPanelSuccess` to display.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useToolImagePlacement({ onPlaceImageUrl, onJumpToUploads }: Options): {
|
|
16
|
+
finish: (file: File) => Promise<ToolPanelSuccess>;
|
|
17
|
+
isUploading: boolean;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useImagePlacement } from '../../useImagePlacement.js';
|
|
4
|
+
/**
|
|
5
|
+
* Shared finish-step for the generator tools, built on {@link useImagePlacement}.
|
|
6
|
+
* When `onPlaceImageUrl` is wired, the produced file is uploaded with the
|
|
7
|
+
* `canvas-element` source — a durable share URL excluded from the Uploads tab
|
|
8
|
+
* and Mediathek — and placed straight onto the canvas. Otherwise it falls back
|
|
9
|
+
* to adding the file to Uploads. Returns the `ToolPanelSuccess` to display.
|
|
10
|
+
*/
|
|
11
|
+
export function useToolImagePlacement({ onPlaceImageUrl, onJumpToUploads }) {
|
|
12
|
+
const { place, isUploading } = useImagePlacement(onPlaceImageUrl);
|
|
13
|
+
const finish = useCallback(async (file) => {
|
|
14
|
+
if (onPlaceImageUrl) {
|
|
15
|
+
const { name } = await place(file, 'canvas-element');
|
|
16
|
+
return { thumbnailUrl: URL.createObjectURL(file), itemName: name, placedOnCanvas: true };
|
|
17
|
+
}
|
|
18
|
+
// Fallback (no canvas placement wired): add to the Uploads library.
|
|
19
|
+
const { name } = await place(file, 'upload');
|
|
20
|
+
return { thumbnailUrl: URL.createObjectURL(file), itemName: name, onJumpToUploads };
|
|
21
|
+
}, [place, onPlaceImageUrl, onJumpToUploads]);
|
|
22
|
+
return { finish, isUploading };
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
/** Runs `fn` once the browser is idle (at the latest after 4 s); returns the cancel. */
|
|
3
|
+
export function whenIdle(fn) {
|
|
4
|
+
if (typeof requestIdleCallback === 'function') {
|
|
5
|
+
const handle = requestIdleCallback(fn, { timeout: 4000 });
|
|
6
|
+
return () => cancelIdleCallback(handle);
|
|
7
|
+
}
|
|
8
|
+
const timer = setTimeout(fn, 2000);
|
|
9
|
+
return () => clearTimeout(timer);
|
|
10
|
+
}
|