@ggraphic/editor 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/NOTICE +2 -0
- package/README.md +8 -2
- package/THIRD_PARTY_NOTICES +7 -0
- package/dist/CanvasEditorProvider.d.ts +214 -0
- package/dist/CanvasEditorProvider.js +10 -0
- package/dist/ai/applyOperation.d.ts +75 -0
- package/dist/ai/applyOperation.js +354 -0
- package/dist/ai/describeCanvasElements.d.ts +17 -0
- package/dist/ai/describeCanvasElements.js +148 -0
- package/dist/ai/illustrationCapability.d.ts +6 -0
- package/dist/ai/illustrationCapability.js +20 -0
- package/dist/ai/types.d.ts +91 -0
- package/dist/ai/types.js +1 -0
- package/dist/blocks/liftedBlock.d.ts +61 -0
- package/dist/blocks/liftedBlock.js +117 -0
- package/dist/brand/bindPick.d.ts +18 -0
- package/dist/brand/bindPick.js +28 -0
- package/dist/brand/bindableFields.d.ts +9 -0
- package/dist/brand/bindableFields.js +61 -0
- package/dist/brand/brandRegistry.d.ts +18 -0
- package/dist/brand/brandRegistry.js +41 -0
- package/dist/brand/composerBrand.d.ts +146 -0
- package/dist/brand/composerBrand.js +6 -0
- package/dist/collab/documentVersion.d.ts +36 -0
- package/dist/collab/documentVersion.js +139 -0
- package/dist/collab/pageElementStateKeys.d.ts +33 -0
- package/dist/collab/pageElementStateKeys.js +148 -0
- package/dist/collab/pagesDoc.d.ts +152 -0
- package/dist/collab/pagesDoc.js +434 -0
- package/dist/collab/useAwarenessState.d.ts +12 -0
- package/dist/collab/useAwarenessState.js +47 -0
- package/dist/collab/useEmitHostStateChanges.d.ts +18 -0
- package/dist/collab/useEmitHostStateChanges.js +40 -0
- package/dist/collab/useSelectionAwareness.d.ts +22 -0
- package/dist/collab/useSelectionAwareness.js +60 -0
- package/dist/collab/useYjsCanvasBinding.d.ts +7 -0
- package/dist/collab/useYjsCanvasBinding.js +21 -0
- package/dist/collab/useYjsPageStateSync.d.ts +20 -0
- package/dist/collab/useYjsPageStateSync.js +49 -0
- package/dist/collab/useYjsPages.d.ts +73 -0
- package/dist/collab/useYjsPages.js +396 -0
- package/dist/collab/wrapCallbacksWithPageSync.d.ts +3 -0
- package/dist/collab/wrapCallbacksWithPageSync.js +62 -0
- package/dist/collab/ydocKeys.d.ts +50 -0
- package/dist/collab/ydocKeys.js +50 -0
- package/dist/collab/yjsBinding.d.ts +27 -0
- package/dist/collab/yjsBinding.js +105 -0
- package/dist/common/Lightbox.d.ts +8 -0
- package/dist/common/Lightbox.js +8 -0
- package/dist/common/imageSourceTypes.d.ts +1 -0
- package/dist/common/imageSourceTypes.js +1 -0
- package/dist/components/AddPageButton.d.ts +13 -0
- package/dist/components/AddPageButton.js +13 -0
- package/dist/components/CanvasAnnouncer.d.ts +8 -0
- package/dist/components/CanvasAnnouncer.js +10 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.d.ts +12 -0
- package/dist/components/CanvasContextMenu/CanvasActionSheet.js +145 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.d.ts +33 -0
- package/dist/components/CanvasContextMenu/CanvasContextMenu.js +107 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.d.ts +68 -0
- package/dist/components/CanvasContextMenu/canvasMenuModel.js +203 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.d.ts +32 -0
- package/dist/components/CanvasEditor/CanvasEditorShell.js +1138 -0
- package/dist/components/CanvasEditor/PageWrapper.d.ts +7 -0
- package/dist/components/CanvasEditor/PageWrapper.js +103 -0
- package/dist/components/CanvasEditor/autoSwitchTab.d.ts +11 -0
- package/dist/components/CanvasEditor/autoSwitchTab.js +15 -0
- package/dist/components/CanvasEditor/blockInsertContext.d.ts +22 -0
- package/dist/components/CanvasEditor/blockInsertContext.js +5 -0
- package/dist/components/CanvasEditor/editorShell.d.ts +99 -0
- package/dist/components/CanvasEditor/editorShell.js +20 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.d.ts +32 -0
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.js +140 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.d.ts +13 -0
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.js +29 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.d.ts +14 -0
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.js +56 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.d.ts +18 -0
- package/dist/components/CanvasEditor/hooks/usePageRefs.js +36 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.d.ts +25 -0
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.js +49 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.js +70 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.js +31 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.d.ts +75 -0
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.js +69 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.d.ts +6 -0
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.js +56 -0
- package/dist/components/CanvasEditor/layersTab.d.ts +13 -0
- package/dist/components/CanvasEditor/layersTab.js +27 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.d.ts +8 -0
- package/dist/components/CanvasEditor/mobileSelectionArea.js +27 -0
- package/dist/components/CanvasEditor/types.d.ts +202 -0
- package/dist/components/CanvasEditor/types.js +1 -0
- package/dist/components/CanvasEditorSkeleton.d.ts +16 -0
- package/dist/components/CanvasEditorSkeleton.js +24 -0
- package/dist/components/CanvasMetaBar.d.ts +16 -0
- package/dist/components/CanvasMetaBar.js +33 -0
- package/dist/components/CanvasRenderLayer.d.ts +37 -0
- package/dist/components/CanvasRenderLayer.js +54 -0
- package/dist/components/CanvasTextOverlay.d.ts +126 -0
- package/dist/components/CanvasTextOverlay.js +525 -0
- package/dist/components/ConfigCanvas.d.ts +35 -0
- package/dist/components/ConfigCanvas.js +30 -0
- package/dist/components/CropGhostOverlay.d.ts +13 -0
- package/dist/components/CropGhostOverlay.js +56 -0
- package/dist/components/CustomColorSwatch.d.ts +35 -0
- package/dist/components/CustomColorSwatch.js +80 -0
- package/dist/components/DownloadNotice.d.ts +7 -0
- package/dist/components/DownloadNotice.js +7 -0
- package/dist/components/GenericCanvas.d.ts +309 -0
- package/dist/components/GenericCanvas.js +780 -0
- package/dist/components/GenericCanvasElement.d.ts +34 -0
- package/dist/components/GenericCanvasElement.js +267 -0
- package/dist/components/MobileSelectionPill.d.ts +40 -0
- package/dist/components/MobileSelectionPill.js +85 -0
- package/dist/components/MultiSelectionTransformer.d.ts +39 -0
- package/dist/components/MultiSelectionTransformer.js +107 -0
- package/dist/components/PagePreview.d.ts +14 -0
- package/dist/components/PagePreview.js +63 -0
- package/dist/components/PageThumbnailStrip.d.ts +25 -0
- package/dist/components/PageThumbnailStrip.js +46 -0
- package/dist/components/PageToolbar.d.ts +12 -0
- package/dist/components/PageToolbar.js +20 -0
- package/dist/components/PrintGuides.d.ts +13 -0
- package/dist/components/PrintGuides.js +28 -0
- package/dist/components/RemoteSelectionOverlay.d.ts +15 -0
- package/dist/components/RemoteSelectionOverlay.js +29 -0
- package/dist/components/RichTextField.d.ts +34 -0
- package/dist/components/RichTextField.js +212 -0
- package/dist/components/SelectionPill.d.ts +56 -0
- package/dist/components/SelectionPill.js +123 -0
- package/dist/components/SlideNotesPanel.d.ts +13 -0
- package/dist/components/SlideNotesPanel.js +28 -0
- package/dist/components/SlotBudgetStatus.d.ts +12 -0
- package/dist/components/SlotBudgetStatus.js +64 -0
- package/dist/components/StandaloneCanvas.d.ts +33 -0
- package/dist/components/StandaloneCanvas.js +61 -0
- package/dist/components/TextFormatButtons.d.ts +61 -0
- package/dist/components/TextFormatButtons.js +123 -0
- package/dist/components/TextFormatControls.d.ts +26 -0
- package/dist/components/TextFormatControls.js +73 -0
- package/dist/components/Toolbar.d.ts +40 -0
- package/dist/components/Toolbar.js +26 -0
- package/dist/components/ToolbarStateBridge.d.ts +72 -0
- package/dist/components/ToolbarStateBridge.js +298 -0
- package/dist/components/TopBar/AutoSaveIndicator.d.ts +8 -0
- package/dist/components/TopBar/AutoSaveIndicator.js +44 -0
- package/dist/components/TopBar/ContextControls.d.ts +107 -0
- package/dist/components/TopBar/ContextControls.js +319 -0
- package/dist/components/TopBar/ContextToolbar.d.ts +14 -0
- package/dist/components/TopBar/ContextToolbar.js +20 -0
- package/dist/components/TopBar/CropModeControls.d.ts +35 -0
- package/dist/components/TopBar/CropModeControls.js +84 -0
- package/dist/components/TopBar/DownloadSection.d.ts +47 -0
- package/dist/components/TopBar/DownloadSection.js +102 -0
- package/dist/components/TopBar/MobileSelectionBar.d.ts +16 -0
- package/dist/components/TopBar/MobileSelectionBar.js +26 -0
- package/dist/components/TopBar/MobileSelectionControls.d.ts +10 -0
- package/dist/components/TopBar/MobileSelectionControls.js +43 -0
- package/dist/components/TopBar/MultiSelectionToolbar.d.ts +19 -0
- package/dist/components/TopBar/MultiSelectionToolbar.js +30 -0
- package/dist/components/TopBar/ShareDropdown.d.ts +54 -0
- package/dist/components/TopBar/ShareDropdown.js +110 -0
- package/dist/components/TopBar/TopBar.d.ts +6 -0
- package/dist/components/TopBar/TopBar.js +6 -0
- package/dist/components/TopBar/barTiles.d.ts +15 -0
- package/dist/components/TopBar/barTiles.js +34 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.d.ts +28 -0
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.js +26 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingBackgroundControls.js +133 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.d.ts +16 -0
- package/dist/components/TopBar/modules/FloatingColorPicker.js +87 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.d.ts +17 -0
- package/dist/components/TopBar/modules/FloatingFontRoleControl.js +37 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.d.ts +7 -0
- package/dist/components/TopBar/modules/FloatingFontSizeControl.js +22 -0
- package/dist/components/TopBar/modules/FloatingGradientControl.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingGradientControl.js +35 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingHistoryControls.js +19 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingImageLookControl.js +15 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.d.ts +9 -0
- package/dist/components/TopBar/modules/FloatingLayerControls.js +9 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingOpacityControl.js +19 -0
- package/dist/components/TopBar/modules/FloatingOutlineControl.d.ts +11 -0
- package/dist/components/TopBar/modules/FloatingOutlineControl.js +31 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.d.ts +38 -0
- package/dist/components/TopBar/modules/FloatingPositionControl.js +74 -0
- package/dist/components/TopBar/modules/FloatingShadowControl.d.ts +12 -0
- package/dist/components/TopBar/modules/FloatingShadowControl.js +40 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.d.ts +12 -0
- package/dist/components/TopBar/modules/FloatingTextAlignControl.js +27 -0
- package/dist/components/TransformHud.d.ts +11 -0
- package/dist/components/TransformHud.js +121 -0
- package/dist/components/WholeTextFormatControls.d.ts +10 -0
- package/dist/components/WholeTextFormatControls.js +37 -0
- package/dist/components/ZoomableViewport.d.ts +6 -0
- package/dist/components/ZoomableViewport.js +4 -0
- package/dist/components/accentMark.d.ts +20 -0
- package/dist/components/accentMark.js +24 -0
- package/dist/components/canvasItemLock.d.ts +13 -0
- package/dist/components/canvasItemLock.js +12 -0
- package/dist/components/kindRenderers.d.ts +118 -0
- package/dist/components/kindRenderers.js +151 -0
- package/dist/components/markColor.d.ts +13 -0
- package/dist/components/markColor.js +21 -0
- package/dist/components/markerMark.d.ts +19 -0
- package/dist/components/markerMark.js +26 -0
- package/dist/composer/cardFollowsText.d.ts +17 -0
- package/dist/composer/cardFollowsText.js +34 -0
- package/dist/composer/marks.d.ts +4 -0
- package/dist/composer/marks.js +15 -0
- package/dist/composer/steckbriefLayout.d.ts +147 -0
- package/dist/composer/steckbriefLayout.js +468 -0
- package/dist/composer/textFit.d.ts +31 -0
- package/dist/composer/textFit.js +89 -0
- package/dist/configs/buildSharepicText.d.ts +5 -0
- package/dist/configs/buildSharepicText.js +58 -0
- package/dist/configs/configLoader.d.ts +34 -0
- package/dist/configs/configLoader.js +60 -0
- package/dist/configs/factory/actionFactories.d.ts +172 -0
- package/dist/configs/factory/actionFactories.js +611 -0
- package/dist/configs/factory/baseTypes.d.ts +150 -0
- package/dist/configs/factory/baseTypes.js +8 -0
- package/dist/configs/factory/carryInstanceState.d.ts +82 -0
- package/dist/configs/factory/carryInstanceState.js +121 -0
- package/dist/configs/factory/createTextElement.d.ts +63 -0
- package/dist/configs/factory/createTextElement.js +63 -0
- package/dist/configs/factory/defineSection.d.ts +45 -0
- package/dist/configs/factory/defineSection.js +45 -0
- package/dist/configs/factory/layoutAccessors.d.ts +15 -0
- package/dist/configs/factory/layoutAccessors.js +20 -0
- package/dist/configs/featureInjector.d.ts +40 -0
- package/dist/configs/featureInjector.js +184 -0
- package/dist/configs/pageInheritance.d.ts +8 -0
- package/dist/configs/pageInheritance.js +82 -0
- package/dist/configs/placeholders.d.ts +14 -0
- package/dist/configs/placeholders.js +33 -0
- package/dist/configs/shareSection.d.ts +11 -0
- package/dist/configs/shareSection.js +65 -0
- package/dist/configs/types.d.ts +420 -0
- package/dist/configs/types.js +1 -0
- package/dist/configs/unifiedTabs.d.ts +26 -0
- package/dist/configs/unifiedTabs.js +6 -0
- package/dist/editorSeamTypes.d.ts +41 -0
- package/dist/editorSeamTypes.js +1 -0
- package/dist/export/pptx/buildPptxModel.d.ts +44 -0
- package/dist/export/pptx/buildPptxModel.js +612 -0
- package/dist/export/pptx/exportPptxDeck.d.ts +23 -0
- package/dist/export/pptx/exportPptxDeck.js +77 -0
- package/dist/export/pptx/pptxFonts.d.ts +26 -0
- package/dist/export/pptx/pptxFonts.js +41 -0
- package/dist/export/pptx/pptxUnits.d.ts +27 -0
- package/dist/export/pptx/pptxUnits.js +54 -0
- package/dist/export/pptx/textModel.d.ts +13 -0
- package/dist/export/pptx/textModel.js +115 -0
- package/dist/export/pptx/types.d.ts +161 -0
- package/dist/export/pptx/types.js +11 -0
- package/dist/export/pptx/writePptx.d.ts +40 -0
- package/dist/export/pptx/writePptx.js +206 -0
- package/dist/export/pptx/writeText.d.ts +19 -0
- package/dist/export/pptx/writeText.js +120 -0
- package/dist/export/printExport.d.ts +42 -0
- package/dist/export/printExport.js +94 -0
- package/dist/export/printPdf.d.ts +103 -0
- package/dist/export/printPdf.js +144 -0
- package/dist/export/slidesPdf.d.ts +9 -0
- package/dist/export/slidesPdf.js +31 -0
- package/dist/formats/index.d.ts +115 -0
- package/dist/formats/index.js +287 -0
- package/dist/groups/pageGroups.d.ts +32 -0
- package/dist/groups/pageGroups.js +91 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +19 -0
- package/dist/hooks/useAiImageGeneration.d.ts +15 -0
- package/dist/hooks/useAiImageGeneration.js +73 -0
- package/dist/hooks/useAnnounce.d.ts +27 -0
- package/dist/hooks/useAnnounce.js +47 -0
- package/dist/hooks/useBoxSnap.d.ts +37 -0
- package/dist/hooks/useBoxSnap.js +49 -0
- package/dist/hooks/useCanvasAutoSave.d.ts +33 -0
- package/dist/hooks/useCanvasAutoSave.js +259 -0
- package/dist/hooks/useCanvasElementHandlers.d.ts +182 -0
- package/dist/hooks/useCanvasElementHandlers.js +326 -0
- package/dist/hooks/useCanvasHistorySetup.d.ts +37 -0
- package/dist/hooks/useCanvasHistorySetup.js +113 -0
- package/dist/hooks/useCanvasInteractions.d.ts +31 -0
- package/dist/hooks/useCanvasInteractions.js +103 -0
- package/dist/hooks/useCanvasKeyboardHandlers.d.ts +37 -0
- package/dist/hooks/useCanvasKeyboardHandlers.js +280 -0
- package/dist/hooks/useCanvasStoreReset.d.ts +25 -0
- package/dist/hooks/useCanvasStoreReset.js +35 -0
- package/dist/hooks/useCanvasUndoRedo.d.ts +34 -0
- package/dist/hooks/useCanvasUndoRedo.js +213 -0
- package/dist/hooks/useContextPress.d.ts +14 -0
- package/dist/hooks/useContextPress.js +45 -0
- package/dist/hooks/useCropSession.d.ts +23 -0
- package/dist/hooks/useCropSession.js +69 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useDebounce.js +14 -0
- package/dist/hooks/useDeckAutoSave.d.ts +30 -0
- package/dist/hooks/useDeckAutoSave.js +234 -0
- package/dist/hooks/useDeepSelect.d.ts +18 -0
- package/dist/hooks/useDeepSelect.js +135 -0
- package/dist/hooks/useElementSnapping.d.ts +13 -0
- package/dist/hooks/useElementSnapping.js +26 -0
- package/dist/hooks/useEmojiCatalog.d.ts +3 -0
- package/dist/hooks/useEmojiCatalog.js +13 -0
- package/dist/hooks/useFloatingModuleHandlers.d.ts +52 -0
- package/dist/hooks/useFloatingModuleHandlers.js +285 -0
- package/dist/hooks/useFloatingModuleState.d.ts +83 -0
- package/dist/hooks/useFloatingModuleState.js +250 -0
- package/dist/hooks/useFontGeneration.d.ts +10 -0
- package/dist/hooks/useFontGeneration.js +77 -0
- package/dist/hooks/useFontLoader.d.ts +53 -0
- package/dist/hooks/useFontLoader.js +129 -0
- package/dist/hooks/useGeometryReporter.d.ts +19 -0
- package/dist/hooks/useGeometryReporter.js +41 -0
- package/dist/hooks/useHoverOutline.d.ts +8 -0
- package/dist/hooks/useHoverOutline.js +78 -0
- package/dist/hooks/useIconCatalog.d.ts +12 -0
- package/dist/hooks/useIconCatalog.js +30 -0
- package/dist/hooks/useIconSearch.d.ts +2 -0
- package/dist/hooks/useIconSearch.js +14 -0
- package/dist/hooks/useIconSetsFor.d.ts +8 -0
- package/dist/hooks/useIconSetsFor.js +30 -0
- package/dist/hooks/useImageCoverFit.d.ts +17 -0
- package/dist/hooks/useImageCoverFit.js +35 -0
- package/dist/hooks/useIsCanvasMobile.d.ts +3 -0
- package/dist/hooks/useIsCanvasMobile.js +19 -0
- package/dist/hooks/useMarqueeSelection.d.ts +27 -0
- package/dist/hooks/useMarqueeSelection.js +140 -0
- package/dist/hooks/useMobileSheet.d.ts +48 -0
- package/dist/hooks/useMobileSheet.js +282 -0
- package/dist/hooks/useMultiPageExport.d.ts +30 -0
- package/dist/hooks/useMultiPageExport.js +117 -0
- package/dist/hooks/usePageManager.d.ts +132 -0
- package/dist/hooks/usePageManager.js +399 -0
- package/dist/hooks/usePageThumbnails.d.ts +10 -0
- package/dist/hooks/usePageThumbnails.js +122 -0
- package/dist/hooks/usePaginatedIcons.d.ts +11 -0
- package/dist/hooks/usePaginatedIcons.js +46 -0
- package/dist/hooks/useRovingToolbar.d.ts +17 -0
- package/dist/hooks/useRovingToolbar.js +76 -0
- package/dist/hooks/useSelectionAnnouncement.d.ts +13 -0
- package/dist/hooks/useSelectionAnnouncement.js +68 -0
- package/dist/hooks/useSnapScheduler.d.ts +20 -0
- package/dist/hooks/useSnapScheduler.js +61 -0
- package/dist/hooks/useTrackUnsplashDownload.d.ts +6 -0
- package/dist/hooks/useTrackUnsplashDownload.js +19 -0
- package/dist/hooks/useZoomGestures.d.ts +35 -0
- package/dist/hooks/useZoomGestures.js +185 -0
- package/dist/hostServices.d.ts +308 -0
- package/dist/hostServices.js +107 -0
- package/dist/i18n/de.d.ts +895 -0
- package/dist/i18n/de.js +959 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +948 -0
- package/dist/i18n/messages.d.ts +28 -0
- package/dist/i18n/messages.js +66 -0
- package/dist/layouts/CanvasEditorLayout.d.ts +28 -0
- package/dist/layouts/CanvasEditorLayout.js +56 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/index.js +2 -0
- package/dist/primitives/AssetPrimitive.d.ts +24 -0
- package/dist/primitives/AssetPrimitive.js +158 -0
- package/dist/primitives/CanvasBackground.d.ts +33 -0
- package/dist/primitives/CanvasBackground.js +44 -0
- package/dist/primitives/CanvasIcons.d.ts +19 -0
- package/dist/primitives/CanvasIcons.js +46 -0
- package/dist/primitives/CanvasImage.d.ts +73 -0
- package/dist/primitives/CanvasImage.js +460 -0
- package/dist/primitives/CanvasRichText.d.ts +25 -0
- package/dist/primitives/CanvasRichText.js +281 -0
- package/dist/primitives/CanvasStage.d.ts +84 -0
- package/dist/primitives/CanvasStage.js +291 -0
- package/dist/primitives/CanvasText.d.ts +91 -0
- package/dist/primitives/CanvasText.js +293 -0
- package/dist/primitives/ChartPrimitive.d.ts +24 -0
- package/dist/primitives/ChartPrimitive.js +318 -0
- package/dist/primitives/CircleBadge.d.ts +43 -0
- package/dist/primitives/CircleBadge.js +233 -0
- package/dist/primitives/FramePrimitive.d.ts +14 -0
- package/dist/primitives/FramePrimitive.js +406 -0
- package/dist/primitives/IconPrimitive.d.ts +28 -0
- package/dist/primitives/IconPrimitive.js +119 -0
- package/dist/primitives/IllustrationPrimitive.d.ts +16 -0
- package/dist/primitives/IllustrationPrimitive.js +184 -0
- package/dist/primitives/PillBadge.d.ts +45 -0
- package/dist/primitives/PillBadge.js +237 -0
- package/dist/primitives/ShapePrimitive.d.ts +12 -0
- package/dist/primitives/ShapePrimitive.js +521 -0
- package/dist/primitives/SnapGuidelines.d.ts +19 -0
- package/dist/primitives/SnapGuidelines.js +34 -0
- package/dist/primitives/UserImagePrimitive.d.ts +30 -0
- package/dist/primitives/UserImagePrimitive.js +494 -0
- package/dist/primitives/index.d.ts +18 -0
- package/dist/primitives/index.js +11 -0
- package/dist/sidebar/SidebarPanel.d.ts +8 -0
- package/dist/sidebar/SidebarPanel.js +219 -0
- package/dist/sidebar/SidebarTabBar.d.ts +2 -0
- package/dist/sidebar/SidebarTabBar.js +31 -0
- package/dist/sidebar/SubsectionTabBar.d.ts +13 -0
- package/dist/sidebar/SubsectionTabBar.js +30 -0
- package/dist/sidebar/UserUploadsProvider.d.ts +31 -0
- package/dist/sidebar/UserUploadsProvider.js +139 -0
- package/dist/sidebar/components/AltTextField.d.ts +21 -0
- package/dist/sidebar/components/AltTextField.js +60 -0
- package/dist/sidebar/components/SidebarHint.d.ts +7 -0
- package/dist/sidebar/components/SidebarHint.js +38 -0
- package/dist/sidebar/components/SidebarSlider.d.ts +16 -0
- package/dist/sidebar/components/SidebarSlider.js +9 -0
- package/dist/sidebar/components/TextFieldPrimitives.d.ts +26 -0
- package/dist/sidebar/components/TextFieldPrimitives.js +56 -0
- package/dist/sidebar/sections/ChartSettingsSection.d.ts +9 -0
- package/dist/sidebar/sections/ChartSettingsSection.js +75 -0
- package/dist/sidebar/sections/CombinedTextSection.d.ts +16 -0
- package/dist/sidebar/sections/CombinedTextSection.js +42 -0
- package/dist/sidebar/sections/DiagrammeSection.d.ts +9 -0
- package/dist/sidebar/sections/DiagrammeSection.js +41 -0
- package/dist/sidebar/sections/EffectsSection.d.ts +20 -0
- package/dist/sidebar/sections/EffectsSection.js +23 -0
- package/dist/sidebar/sections/FormenSection.d.ts +26 -0
- package/dist/sidebar/sections/FormenSection.js +428 -0
- package/dist/sidebar/sections/FrameSettingsSection.d.ts +8 -0
- package/dist/sidebar/sections/FrameSettingsSection.js +26 -0
- package/dist/sidebar/sections/GenericShareSection.d.ts +26 -0
- package/dist/sidebar/sections/GenericShareSection.js +262 -0
- package/dist/sidebar/sections/IconsSection.d.ts +8 -0
- package/dist/sidebar/sections/IconsSection.js +55 -0
- package/dist/sidebar/sections/IllustrationSettings.d.ts +9 -0
- package/dist/sidebar/sections/IllustrationSettings.js +32 -0
- package/dist/sidebar/sections/IllustrationThumb.d.ts +7 -0
- package/dist/sidebar/sections/IllustrationThumb.js +15 -0
- package/dist/sidebar/sections/ImageAdjustSection.d.ts +13 -0
- package/dist/sidebar/sections/ImageAdjustSection.js +84 -0
- package/dist/sidebar/sections/LayersSection.d.ts +25 -0
- package/dist/sidebar/sections/LayersSection.js +155 -0
- package/dist/sidebar/sections/RahmenSection.d.ts +7 -0
- package/dist/sidebar/sections/RahmenSection.js +18 -0
- package/dist/sidebar/sections/StudioGallery.d.ts +33 -0
- package/dist/sidebar/sections/StudioGallery.js +58 -0
- package/dist/sidebar/sections/UploadsSection.d.ts +11 -0
- package/dist/sidebar/sections/UploadsSection.js +130 -0
- package/dist/sidebar/sections/assets/AssetsSection.d.ts +59 -0
- package/dist/sidebar/sections/assets/AssetsSection.js +27 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.d.ts +9 -0
- package/dist/sidebar/sections/assets/BackgroundCatalog.js +49 -0
- package/dist/sidebar/sections/assets/CategoryCard.d.ts +14 -0
- package/dist/sidebar/sections/assets/CategoryCard.js +15 -0
- package/dist/sidebar/sections/assets/ElementGrid.d.ts +14 -0
- package/dist/sidebar/sections/assets/ElementGrid.js +34 -0
- package/dist/sidebar/sections/assets/ElementThumb.d.ts +10 -0
- package/dist/sidebar/sections/assets/ElementThumb.js +59 -0
- package/dist/sidebar/sections/assets/ElementTile.d.ts +32 -0
- package/dist/sidebar/sections/assets/ElementTile.js +60 -0
- package/dist/sidebar/sections/assets/ElementsPanel.d.ts +7 -0
- package/dist/sidebar/sections/assets/ElementsPanel.js +249 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.d.ts +8 -0
- package/dist/sidebar/sections/assets/EmojiTonePicker.js +26 -0
- package/dist/sidebar/sections/assets/FotosCatalog.d.ts +12 -0
- package/dist/sidebar/sections/assets/FotosCatalog.js +41 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/IconifyCatalog.js +133 -0
- package/dist/sidebar/sections/assets/RecentCarousel.d.ts +7 -0
- package/dist/sidebar/sections/assets/RecentCarousel.js +42 -0
- package/dist/sidebar/sections/assets/StickerCatalog.d.ts +14 -0
- package/dist/sidebar/sections/assets/StickerCatalog.js +49 -0
- package/dist/sidebar/sections/assets/constants.d.ts +4 -0
- package/dist/sidebar/sections/assets/constants.js +15 -0
- package/dist/sidebar/sections/assets/elementPanelHost.d.ts +45 -0
- package/dist/sidebar/sections/assets/elementPanelHost.js +1 -0
- package/dist/sidebar/sections/assets/elementSearch.d.ts +10 -0
- package/dist/sidebar/sections/assets/elementSearch.js +38 -0
- package/dist/sidebar/sections/assets/elementTypes.d.ts +67 -0
- package/dist/sidebar/sections/assets/elementTypes.js +24 -0
- package/dist/sidebar/sections/assets/index.d.ts +3 -0
- package/dist/sidebar/sections/assets/index.js +3 -0
- package/dist/sidebar/sections/assets/useElementCatalog.d.ts +42 -0
- package/dist/sidebar/sections/assets/useElementCatalog.js +371 -0
- package/dist/sidebar/sections/assets/useRecentElements.d.ts +21 -0
- package/dist/sidebar/sections/assets/useRecentElements.js +67 -0
- package/dist/sidebar/sections/assets/useStockPhotos.d.ts +22 -0
- package/dist/sidebar/sections/assets/useStockPhotos.js +96 -0
- package/dist/sidebar/sections/effects/EffectCard.d.ts +11 -0
- package/dist/sidebar/sections/effects/EffectCard.js +14 -0
- package/dist/sidebar/sections/effects/GradientSettings.d.ts +10 -0
- package/dist/sidebar/sections/effects/GradientSettings.js +32 -0
- package/dist/sidebar/sections/effects/OutlineSettings.d.ts +12 -0
- package/dist/sidebar/sections/effects/OutlineSettings.js +28 -0
- package/dist/sidebar/sections/effects/ShadowSettings.d.ts +13 -0
- package/dist/sidebar/sections/effects/ShadowSettings.js +37 -0
- package/dist/sidebar/sections/effects/effectsFor.d.ts +16 -0
- package/dist/sidebar/sections/effects/effectsFor.js +24 -0
- package/dist/sidebar/sections/index.d.ts +28 -0
- package/dist/sidebar/sections/index.js +36 -0
- package/dist/sidebar/sections/lazyWithPreload.d.ts +11 -0
- package/dist/sidebar/sections/lazyWithPreload.js +29 -0
- package/dist/sidebar/sections/tools/AiCreateTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiCreateTool.js +58 -0
- package/dist/sidebar/sections/tools/AiEditTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/AiEditTool.js +57 -0
- package/dist/sidebar/sections/tools/AltTextTool.d.ts +11 -0
- package/dist/sidebar/sections/tools/AltTextTool.js +78 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/BlobCreatorTool.js +85 -0
- package/dist/sidebar/sections/tools/GradientTextTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/GradientTextTool.js +102 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.d.ts +7 -0
- package/dist/sidebar/sections/tools/ImageInputPicker.js +68 -0
- package/dist/sidebar/sections/tools/QRCodeTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/QRCodeTool.js +63 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.d.ts +4 -0
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.js +52 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.d.ts +5 -0
- package/dist/sidebar/sections/tools/TextPathCreatorTool.js +123 -0
- package/dist/sidebar/sections/tools/ToolPanel.d.ts +26 -0
- package/dist/sidebar/sections/tools/ToolPanel.js +13 -0
- package/dist/sidebar/sections/tools/ToolTiles.d.ts +5 -0
- package/dist/sidebar/sections/tools/ToolTiles.js +76 -0
- package/dist/sidebar/sections/tools/ToolsSection.d.ts +15 -0
- package/dist/sidebar/sections/tools/ToolsSection.js +149 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.d.ts +8 -0
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.js +22 -0
- package/dist/sidebar/sections/tools/UnsplashTool.d.ts +10 -0
- package/dist/sidebar/sections/tools/UnsplashTool.js +47 -0
- package/dist/sidebar/sections/tools/index.d.ts +1 -0
- package/dist/sidebar/sections/tools/index.js +2 -0
- package/dist/sidebar/sections/tools/toolTiles.css +335 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.d.ts +19 -0
- package/dist/sidebar/sections/tools/useToolImagePlacement.js +23 -0
- package/dist/sidebar/sections/whenIdle.d.ts +2 -0
- package/dist/sidebar/sections/whenIdle.js +10 -0
- package/dist/sidebar/sidebarStyles.d.ts +60 -0
- package/dist/sidebar/sidebarStyles.js +61 -0
- package/dist/sidebar/tabTypes.d.ts +27 -0
- package/dist/sidebar/tabTypes.js +1 -0
- package/dist/sidebar/types.d.ts +43 -0
- package/dist/sidebar/types.js +1 -0
- package/dist/sidebar/useImagePlacement.d.ts +17 -0
- package/dist/sidebar/useImagePlacement.js +28 -0
- package/dist/stores/AutoSaveStoreProvider.d.ts +28 -0
- package/dist/stores/AutoSaveStoreProvider.js +45 -0
- package/dist/stores/CanvasStoreProvider.d.ts +43 -0
- package/dist/stores/CanvasStoreProvider.js +74 -0
- package/dist/stores/createAutoSaveStore.d.ts +50 -0
- package/dist/stores/createAutoSaveStore.js +42 -0
- package/dist/stores/createCanvasEditorStore.d.ts +126 -0
- package/dist/stores/createCanvasEditorStore.js +266 -0
- package/dist/stores/useAutoSaveStore.d.ts +12 -0
- package/dist/stores/useAutoSaveStore.js +12 -0
- package/dist/styles/editor.css +445 -0
- package/dist/styles/index.css +4 -0
- package/dist/styles/tailwind.css +239 -0
- package/dist/styles/tokens.css +199 -0
- package/dist/templates/fontWidths.generated.d.ts +1 -0
- package/dist/templates/fontWidths.generated.js +17 -0
- package/dist/templates/registry.d.ts +59 -0
- package/dist/templates/registry.js +40 -0
- package/dist/templates/templateGeometry.d.ts +32 -0
- package/dist/templates/templateGeometry.js +887 -0
- package/dist/templates/testKinds.d.ts +15 -0
- package/dist/templates/testKinds.js +151 -0
- package/dist/testing/fixtureTemplates.d.ts +13 -0
- package/dist/testing/fixtureTemplates.js +376 -0
- package/dist/testing/stampKind.d.ts +91 -0
- package/dist/testing/stampKind.js +56 -0
- package/dist/types/editorTypes.d.ts +65 -0
- package/dist/types/editorTypes.js +21 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +42 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/button.js +29 -0
- package/dist/ui/dialog.d.ts +15 -0
- package/dist/ui/dialog.js +53 -0
- package/dist/ui/icon-button.d.ts +18 -0
- package/dist/ui/icon-button.js +54 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +6 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.js +8 -0
- package/dist/ui/masonry-grid.d.ts +11 -0
- package/dist/ui/masonry-grid.js +43 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +26 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +38 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +7 -0
- package/dist/ui/switch.d.ts +6 -0
- package/dist/ui/switch.js +8 -0
- package/dist/utils/__snapshots__/kindSelection.vitest.ts.snap +1086 -0
- package/dist/utils/alignment.d.ts +21 -0
- package/dist/utils/alignment.js +54 -0
- package/dist/utils/axisLock.d.ts +30 -0
- package/dist/utils/axisLock.js +78 -0
- package/dist/utils/backgroundPhotoCrop.d.ts +28 -0
- package/dist/utils/backgroundPhotoCrop.js +28 -0
- package/dist/utils/balkenUtils.d.ts +22 -0
- package/dist/utils/balkenUtils.js +8 -0
- package/dist/utils/canvasAssets.d.ts +134 -0
- package/dist/utils/canvasAssets.js +121 -0
- package/dist/utils/canvasClipboard.d.ts +51 -0
- package/dist/utils/canvasClipboard.js +37 -0
- package/dist/utils/canvasCommandRegistry.d.ts +207 -0
- package/dist/utils/canvasCommandRegistry.js +124 -0
- package/dist/utils/canvasCommands.d.ts +106 -0
- package/dist/utils/canvasCommands.js +564 -0
- package/dist/utils/canvasFontFamilies.d.ts +12 -0
- package/dist/utils/canvasFontFamilies.js +24 -0
- package/dist/utils/canvasIcons.d.ts +68 -0
- package/dist/utils/canvasIcons.js +293 -0
- package/dist/utils/canvasImageSource.d.ts +12 -0
- package/dist/utils/canvasImageSource.js +19 -0
- package/dist/utils/canvasItem.d.ts +102 -0
- package/dist/utils/canvasItem.js +1 -0
- package/dist/utils/canvasLayerManager.d.ts +51 -0
- package/dist/utils/canvasLayerManager.js +107 -0
- package/dist/utils/canvasValueResolver.d.ts +9 -0
- package/dist/utils/canvasValueResolver.js +13 -0
- package/dist/utils/captureStage.d.ts +59 -0
- package/dist/utils/captureStage.js +152 -0
- package/dist/utils/chartTypes.d.ts +6 -0
- package/dist/utils/chartTypes.js +2 -0
- package/dist/utils/chartUtils.d.ts +49 -0
- package/dist/utils/chartUtils.js +191 -0
- package/dist/utils/circleBadgeUtils.d.ts +28 -0
- package/dist/utils/circleBadgeUtils.js +85 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +66 -0
- package/dist/utils/collectAltTextPages.d.ts +6 -0
- package/dist/utils/collectAltTextPages.js +20 -0
- package/dist/utils/colorLuminance.d.ts +3 -0
- package/dist/utils/colorLuminance.js +14 -0
- package/dist/utils/colorNames.d.ts +2 -0
- package/dist/utils/colorNames.js +8 -0
- package/dist/utils/colorOptions.d.ts +20 -0
- package/dist/utils/colorOptions.js +20 -0
- package/dist/utils/cornerRadius.d.ts +14 -0
- package/dist/utils/cornerRadius.js +27 -0
- package/dist/utils/cornerReservation.d.ts +19 -0
- package/dist/utils/cornerReservation.js +7 -0
- package/dist/utils/coverFit.d.ts +117 -0
- package/dist/utils/coverFit.js +207 -0
- package/dist/utils/cropAspect.d.ts +47 -0
- package/dist/utils/cropAspect.js +53 -0
- package/dist/utils/cropGhost.d.ts +63 -0
- package/dist/utils/cropGhost.js +216 -0
- package/dist/utils/cropSession.d.ts +23 -0
- package/dist/utils/cropSession.js +92 -0
- package/dist/utils/cropTarget.d.ts +22 -0
- package/dist/utils/cropTarget.js +33 -0
- package/dist/utils/deepSelect.d.ts +43 -0
- package/dist/utils/deepSelect.js +74 -0
- package/dist/utils/downloadError.d.ts +2 -0
- package/dist/utils/downloadError.js +13 -0
- package/dist/utils/duplicateElement.d.ts +127 -0
- package/dist/utils/duplicateElement.js +235 -0
- package/dist/utils/editorFocus.d.ts +36 -0
- package/dist/utils/editorFocus.js +67 -0
- package/dist/utils/editorToast.d.ts +21 -0
- package/dist/utils/editorToast.js +7 -0
- package/dist/utils/elementKinds.d.ts +212 -0
- package/dist/utils/elementKinds.js +137 -0
- package/dist/utils/emoji/emojiCatalog.d.ts +12 -0
- package/dist/utils/emoji/emojiCatalog.en.json +9997 -0
- package/dist/utils/emoji/emojiCatalog.js +53 -0
- package/dist/utils/emoji/emojiCatalog.json +9913 -0
- package/dist/utils/ensureFontsReady.d.ts +12 -0
- package/dist/utils/ensureFontsReady.js +23 -0
- package/dist/utils/expandImage.d.ts +17 -0
- package/dist/utils/expandImage.js +76 -0
- package/dist/utils/externalIcons.d.ts +67 -0
- package/dist/utils/externalIcons.js +168 -0
- package/dist/utils/filterCache.d.ts +16 -0
- package/dist/utils/filterCache.js +31 -0
- package/dist/utils/filterUtils.d.ts +2 -0
- package/dist/utils/filterUtils.js +89 -0
- package/dist/utils/followStage.d.ts +2 -0
- package/dist/utils/followStage.js +48 -0
- package/dist/utils/fontAliases.d.ts +14 -0
- package/dist/utils/fontAliases.js +32 -0
- package/dist/utils/fontMarkSupport.d.ts +25 -0
- package/dist/utils/fontMarkSupport.js +26 -0
- package/dist/utils/frameUtils.d.ts +19 -0
- package/dist/utils/frameUtils.js +282 -0
- package/dist/utils/gradientFill.d.ts +55 -0
- package/dist/utils/gradientFill.js +57 -0
- package/dist/utils/gradientHitArea.d.ts +22 -0
- package/dist/utils/gradientHitArea.js +94 -0
- package/dist/utils/grain.d.ts +29 -0
- package/dist/utils/grain.js +103 -0
- package/dist/utils/grainSpec.d.ts +2 -0
- package/dist/utils/grainSpec.js +3 -0
- package/dist/utils/groupSnap.d.ts +27 -0
- package/dist/utils/groupSnap.js +54 -0
- package/dist/utils/handDrawn.d.ts +92 -0
- package/dist/utils/handDrawn.js +523 -0
- package/dist/utils/historyStamp.d.ts +22 -0
- package/dist/utils/historyStamp.js +31 -0
- package/dist/utils/hostStorageKeys.d.ts +16 -0
- package/dist/utils/hostStorageKeys.js +27 -0
- package/dist/utils/iconInstances.d.ts +80 -0
- package/dist/utils/iconInstances.js +109 -0
- package/dist/utils/illustrations/gophers.d.ts +11 -0
- package/dist/utils/illustrations/gophers.js +1236 -0
- package/dist/utils/illustrations/humaaans.d.ts +8 -0
- package/dist/utils/illustrations/humaaans.js +265 -0
- package/dist/utils/illustrations/illlustrations.d.ts +11 -0
- package/dist/utils/illustrations/illlustrations.js +929 -0
- package/dist/utils/illustrations/kawaii.d.ts +6 -0
- package/dist/utils/illustrations/kawaii.js +73 -0
- package/dist/utils/illustrations/opendoodles.d.ts +6 -0
- package/dist/utils/illustrations/opendoodles.js +271 -0
- package/dist/utils/illustrations/openpeeps.d.ts +9 -0
- package/dist/utils/illustrations/openpeeps.js +1522 -0
- package/dist/utils/illustrations/prefetchAnalytics.d.ts +78 -0
- package/dist/utils/illustrations/prefetchAnalytics.js +162 -0
- package/dist/utils/illustrations/registry.d.ts +24 -0
- package/dist/utils/illustrations/registry.js +104 -0
- package/dist/utils/illustrations/svgCache.d.ts +60 -0
- package/dist/utils/illustrations/svgCache.js +342 -0
- package/dist/utils/illustrations/transhumans.d.ts +8 -0
- package/dist/utils/illustrations/transhumans.js +313 -0
- package/dist/utils/illustrations/types.d.ts +25 -0
- package/dist/utils/illustrations/types.js +45 -0
- package/dist/utils/imageElementComparison.d.ts +19 -0
- package/dist/utils/imageElementComparison.js +121 -0
- package/dist/utils/imageFilters.d.ts +92 -0
- package/dist/utils/imageFilters.js +303 -0
- package/dist/utils/imageLook.d.ts +16 -0
- package/dist/utils/imageLook.js +39 -0
- package/dist/utils/keyboardCrop.d.ts +25 -0
- package/dist/utils/keyboardCrop.js +98 -0
- package/dist/utils/keyboardOwnership.d.ts +30 -0
- package/dist/utils/keyboardOwnership.js +93 -0
- package/dist/utils/layerLabels.d.ts +39 -0
- package/dist/utils/layerLabels.js +181 -0
- package/dist/utils/layerLock.d.ts +24 -0
- package/dist/utils/layerLock.js +52 -0
- package/dist/utils/layerSelection.d.ts +24 -0
- package/dist/utils/layerSelection.js +16 -0
- package/dist/utils/markerBoxes.d.ts +23 -0
- package/dist/utils/markerBoxes.js +73 -0
- package/dist/utils/markerColors.d.ts +9 -0
- package/dist/utils/markerColors.js +39 -0
- package/dist/utils/mediaDrop.d.ts +76 -0
- package/dist/utils/mediaDrop.js +95 -0
- package/dist/utils/mediaPlacement.d.ts +6 -0
- package/dist/utils/mediaPlacement.js +17 -0
- package/dist/utils/motifSizes.d.ts +8 -0
- package/dist/utils/motifSizes.js +9 -0
- package/dist/utils/multiSelect.d.ts +44 -0
- package/dist/utils/multiSelect.js +139 -0
- package/dist/utils/notch.d.ts +17 -0
- package/dist/utils/notch.js +23 -0
- package/dist/utils/orientElement.d.ts +46 -0
- package/dist/utils/orientElement.js +108 -0
- package/dist/utils/orientation.d.ts +119 -0
- package/dist/utils/orientation.js +411 -0
- package/dist/utils/pageCounter.d.ts +15 -0
- package/dist/utils/pageCounter.js +17 -0
- package/dist/utils/pendingImages.d.ts +10 -0
- package/dist/utils/pendingImages.js +25 -0
- package/dist/utils/photoCredit.d.ts +9 -0
- package/dist/utils/photoCredit.js +29 -0
- package/dist/utils/photoCredits.d.ts +5 -0
- package/dist/utils/photoCredits.js +17 -0
- package/dist/utils/photoPlaceholder.d.ts +22 -0
- package/dist/utils/photoPlaceholder.js +36 -0
- package/dist/utils/pillBadgeUtils.d.ts +40 -0
- package/dist/utils/pillBadgeUtils.js +94 -0
- package/dist/utils/pixelHitArea.d.ts +13 -0
- package/dist/utils/pixelHitArea.js +33 -0
- package/dist/utils/plainTextLayout.d.ts +11 -0
- package/dist/utils/plainTextLayout.js +64 -0
- package/dist/utils/printImageInfo.d.ts +9 -0
- package/dist/utils/printImageInfo.js +14 -0
- package/dist/utils/recacheNextFrame.d.ts +6 -0
- package/dist/utils/recacheNextFrame.js +15 -0
- package/dist/utils/removeElement.d.ts +17 -0
- package/dist/utils/removeElement.js +47 -0
- package/dist/utils/renderedBoxes.d.ts +19 -0
- package/dist/utils/renderedBoxes.js +67 -0
- package/dist/utils/resolveElementValue.d.ts +44 -0
- package/dist/utils/resolveElementValue.js +72 -0
- package/dist/utils/scrollBehavior.d.ts +6 -0
- package/dist/utils/scrollBehavior.js +17 -0
- package/dist/utils/searchTranslations.d.ts +20 -0
- package/dist/utils/searchTranslations.js +366 -0
- package/dist/utils/selectionCapabilities.d.ts +53 -0
- package/dist/utils/selectionCapabilities.js +52 -0
- package/dist/utils/shade.d.ts +24 -0
- package/dist/utils/shade.js +55 -0
- package/dist/utils/shapeDevices.d.ts +72 -0
- package/dist/utils/shapeDevices.js +100 -0
- package/dist/utils/shapeTransform.d.ts +29 -0
- package/dist/utils/shapeTransform.js +69 -0
- package/dist/utils/shapes.d.ts +62 -0
- package/dist/utils/shapes.js +836 -0
- package/dist/utils/smartCrop.d.ts +30 -0
- package/dist/utils/smartCrop.js +163 -0
- package/dist/utils/snapping.d.ts +116 -0
- package/dist/utils/snapping.js +426 -0
- package/dist/utils/stageCssScale.d.ts +7 -0
- package/dist/utils/stageCssScale.js +11 -0
- package/dist/utils/stateTypeAssertions.d.ts +99 -0
- package/dist/utils/stateTypeAssertions.js +197 -0
- package/dist/utils/straighten.d.ts +51 -0
- package/dist/utils/straighten.js +254 -0
- package/dist/utils/surfaceGlow.d.ts +7 -0
- package/dist/utils/surfaceGlow.js +27 -0
- package/dist/utils/templateElementInstance.d.ts +43 -0
- package/dist/utils/templateElementInstance.js +100 -0
- package/dist/utils/templateRotation.d.ts +24 -0
- package/dist/utils/templateRotation.js +56 -0
- package/dist/utils/textAlign.d.ts +17 -0
- package/dist/utils/textAlign.js +30 -0
- package/dist/utils/textEditorOpeners.d.ts +12 -0
- package/dist/utils/textEditorOpeners.js +40 -0
- package/dist/utils/textRouting.d.ts +17 -0
- package/dist/utils/textRouting.js +22 -0
- package/dist/utils/textUtils.d.ts +102 -0
- package/dist/utils/textUtils.js +250 -0
- package/dist/utils/touchInput.d.ts +7 -0
- package/dist/utils/touchInput.js +19 -0
- package/dist/utils/transformHudLabel.d.ts +3 -0
- package/dist/utils/transformHudLabel.js +12 -0
- package/dist/utils/unsplashLinks.d.ts +2 -0
- package/dist/utils/unsplashLinks.js +7 -0
- package/dist/utils/userFacingError.d.ts +10 -0
- package/dist/utils/userFacingError.js +10 -0
- package/dist/utils/userImageCrop.d.ts +4 -0
- package/dist/utils/userImageCrop.js +26 -0
- package/dist/utils/userImageUtils.d.ts +44 -0
- package/dist/utils/userImageUtils.js +136 -0
- package/dist/utils/viewport.d.ts +16 -0
- package/dist/utils/viewport.js +30 -0
- package/dist/utils/zipPageImages.d.ts +8 -0
- package/dist/utils/zipPageImages.js +29 -0
- package/package.json +105 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { ElementTile } from './ElementTile.js';
|
|
5
|
+
const PAGE_SIZE = 48;
|
|
6
|
+
/**
|
|
7
|
+
* The three-column tile grid of a category or a search. Long sets (illustrations,
|
|
8
|
+
* icons, emoji) grow page by page as the sentinel nears the viewport; tiles off
|
|
9
|
+
* screen skip layout and paint through `content-visibility`.
|
|
10
|
+
*/
|
|
11
|
+
export function ElementGrid({ items, onActivate, enterIndexOf, canDrag, isSelected, isDisabled, }) {
|
|
12
|
+
const [limit, setLimit] = useState(PAGE_SIZE);
|
|
13
|
+
const sentinelRef = useRef(null);
|
|
14
|
+
const hasMore = items.length > limit;
|
|
15
|
+
// A new list (search, other category) starts at the first page again.
|
|
16
|
+
const [prevItems, setPrevItems] = useState(items);
|
|
17
|
+
if (prevItems !== items) {
|
|
18
|
+
setPrevItems(items);
|
|
19
|
+
setLimit(PAGE_SIZE);
|
|
20
|
+
}
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const sentinel = sentinelRef.current;
|
|
23
|
+
if (!hasMore || !sentinel)
|
|
24
|
+
return;
|
|
25
|
+
const root = sentinel.closest('.sidebar-panel__content');
|
|
26
|
+
const observer = new IntersectionObserver((entries) => {
|
|
27
|
+
if (entries[0]?.isIntersecting)
|
|
28
|
+
setLimit((l) => l + PAGE_SIZE);
|
|
29
|
+
}, { root, rootMargin: '400px 0px' });
|
|
30
|
+
observer.observe(sentinel);
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
}, [hasMore, limit]);
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid grid-cols-3 gap-2.5 w-full", children: items.slice(0, limit).map((item, i) => (_jsx("div", { className: "min-w-0 [content-visibility:auto] [contain-intrinsic-size:auto_124px]", children: _jsx(ElementTile, { item: item, variant: "grid", onActivate: onActivate, enterIndex: enterIndexOf(i), canDrag: canDrag, selected: isSelected?.(item) ?? false, disabled: isDisabled?.(item) ?? false }) }, item.key))) }), hasMore && _jsx("div", { ref: sentinelRef, "aria-hidden": true, className: "h-px w-full" })] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ElementThumbSpec } from './elementTypes.js';
|
|
2
|
+
/** A photo fills its tile edge to edge; every other preview sits centred inside it. */
|
|
3
|
+
export declare function thumbFillsTile(thumb: ElementThumbSpec): boolean;
|
|
4
|
+
/** Light-on-dark logos need the dark tile to stay visible. */
|
|
5
|
+
export declare function thumbNeedsDarkTile(thumb: ElementThumbSpec): boolean;
|
|
6
|
+
export declare function ElementThumb({ thumb, eager, }: {
|
|
7
|
+
thumb: ElementThumbSpec;
|
|
8
|
+
/** Above the fold (recent, brand): load at once instead of on scroll. */
|
|
9
|
+
eager?: boolean;
|
|
10
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { plainAssetImageUrls, registeredAssetCatalog } from '@ggraphic/editor/utils/canvasAssets';
|
|
4
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
5
|
+
import { Icon } from '@iconify/react';
|
|
6
|
+
import { ChartTypePreview } from '@ggraphic/editor/sidebar/sections/DiagrammeSection';
|
|
7
|
+
import { ALL_PALETTE_SHAPES, getShapeVariant, } from '@ggraphic/editor/sidebar/sections/FormenSection';
|
|
8
|
+
import { IllustrationThumb } from '@ggraphic/editor/sidebar/sections/IllustrationThumb';
|
|
9
|
+
import { FramePresetPreview } from '@ggraphic/editor/sidebar/sections/RahmenSection';
|
|
10
|
+
import { PREVIEW_COMPONENTS } from '@ggraphic/editor/sidebar/sections/assets/constants';
|
|
11
|
+
const PALETTE_BY_TYPE = new Map(ALL_PALETTE_SHAPES.map((shape) => [shape.id, shape]));
|
|
12
|
+
/** Kawaii characters draw in the host's colour; the tile behind them stays light. */
|
|
13
|
+
const DEFAULT_KAWAII_COLOR = '#555555';
|
|
14
|
+
/** A photo fills its tile edge to edge; every other preview sits centred inside it. */
|
|
15
|
+
export function thumbFillsTile(thumb) {
|
|
16
|
+
return thumb.t === 'photo';
|
|
17
|
+
}
|
|
18
|
+
/** Light-on-dark logos need the dark tile to stay visible. */
|
|
19
|
+
export function thumbNeedsDarkTile(thumb) {
|
|
20
|
+
return thumb.t === 'img' && thumb.inverse === true;
|
|
21
|
+
}
|
|
22
|
+
function ShapeThumb({ shapeType }) {
|
|
23
|
+
const shape = PALETTE_BY_TYPE.get(shapeType);
|
|
24
|
+
if (!shape)
|
|
25
|
+
return null;
|
|
26
|
+
const variant = getShapeVariant(shapeType);
|
|
27
|
+
return (_jsx("span", { className: cn('inline-flex items-center justify-center scale-[1.45]', variant.darkPreviewClass), style: { color: variant.color }, children: shape.renderPreview() }));
|
|
28
|
+
}
|
|
29
|
+
export function ElementThumb({ thumb, eager = false, }) {
|
|
30
|
+
const loading = eager ? 'eager' : 'lazy';
|
|
31
|
+
const catalog = registeredAssetCatalog();
|
|
32
|
+
const urls = catalog.imageUrls ?? plainAssetImageUrls;
|
|
33
|
+
switch (thumb.t) {
|
|
34
|
+
case 'img':
|
|
35
|
+
return (_jsx("img", { src: thumb.src, alt: "", loading: loading, decoding: "async", draggable: false, className: "size-full object-contain" }));
|
|
36
|
+
case 'share':
|
|
37
|
+
return (_jsx("img", { src: urls.thumbnail(thumb.src, 200), alt: "", loading: loading, decoding: "async", draggable: false, className: "size-full object-contain" }));
|
|
38
|
+
case 'photo':
|
|
39
|
+
return (_jsx("img", { src: urls.preview(thumb.src, 200), srcSet: `${urls.preview(thumb.src, 200)} 200w, ${urls.preview(thumb.src, 400)} 400w`, sizes: "(max-width: 899px) 33vw, 104px", alt: "", loading: loading, decoding: "async", draggable: false, className: "absolute inset-0 size-full object-cover rounded-[inherit]" }));
|
|
40
|
+
case 'shape':
|
|
41
|
+
return _jsx(ShapeThumb, { shapeType: thumb.shapeType });
|
|
42
|
+
case 'chart':
|
|
43
|
+
return _jsx(ChartTypePreview, { type: thumb.chartType, size: 64 });
|
|
44
|
+
case 'frame':
|
|
45
|
+
return (_jsx(FramePresetPreview, { clipType: thumb.clipType, className: "size-full text-editor-secondary-fg" }));
|
|
46
|
+
case 'kawaii': {
|
|
47
|
+
const Kawaii = PREVIEW_COMPONENTS[thumb.id];
|
|
48
|
+
return (_jsx(Kawaii, { size: 52, mood: "happy", color: catalog.illustrations?.kawaiiColor ?? DEFAULT_KAWAII_COLOR }));
|
|
49
|
+
}
|
|
50
|
+
case 'svg':
|
|
51
|
+
return _jsx(IllustrationThumb, { def: thumb.def, alt: "", className: "size-full object-contain" });
|
|
52
|
+
case 'icon':
|
|
53
|
+
return (_jsx("span", { className: "inline-flex text-[var(--editor-text)]", children: _jsx(Icon, { icon: thumb.iconId, width: 34, height: 34 }) }));
|
|
54
|
+
default: {
|
|
55
|
+
const HostThumb = catalog.elementPanel?.HostThumb;
|
|
56
|
+
return HostThumb ? _jsx(HostThumb, { thumb: thumb, size: 60 }) : null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type DragEvent } from 'react';
|
|
2
|
+
import { type ElementItem } from './elementTypes.js';
|
|
3
|
+
/**
|
|
4
|
+
* - `grid`: category and search grids, label under the tile.
|
|
5
|
+
* - `recent`: the 88px carousel tiles.
|
|
6
|
+
* - `brand`: the "Eure Marke" row, a card with a border and a springier hover.
|
|
7
|
+
*/
|
|
8
|
+
export type ElementTileVariant = 'grid' | 'recent' | 'brand';
|
|
9
|
+
interface ElementTileProps {
|
|
10
|
+
item: ElementItem;
|
|
11
|
+
variant: ElementTileVariant;
|
|
12
|
+
onActivate: (item: ElementItem) => void;
|
|
13
|
+
/** Position in the entrance stagger; null when the tile mounts after it. */
|
|
14
|
+
enterIndex: number | null;
|
|
15
|
+
/** Mouse drag onto a page; off on touch layouts, where HTML5 DnD does not fire. */
|
|
16
|
+
canDrag: boolean;
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
eager?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Makes a button drag `item` onto a page, previewed by its `[data-tile-face]`
|
|
23
|
+
* or else its image. A drop the page accepted counts like a click for
|
|
24
|
+
* "Zuletzt verwendet".
|
|
25
|
+
*/
|
|
26
|
+
export declare function elementDragProps(item: ElementItem): {
|
|
27
|
+
draggable: boolean;
|
|
28
|
+
onDragStart: (e: DragEvent<HTMLElement>) => void;
|
|
29
|
+
onDragEnd: () => void;
|
|
30
|
+
};
|
|
31
|
+
export declare const ElementTile: import("react").MemoExoticComponent<({ item, variant, onActivate, enterIndex, canDrag, selected, disabled, eager, }: ElementTileProps) => import("react").JSX.Element>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
4
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
5
|
+
import { onThumbnailHover } from '@ggraphic/editor/utils/illustrations/svgCache';
|
|
6
|
+
import { takeDropPlaced } from '@ggraphic/editor/utils/mediaDrop';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { PiCheck } from 'react-icons/pi';
|
|
9
|
+
import { ElementThumb, thumbFillsTile, thumbNeedsDarkTile } from './ElementThumb.js';
|
|
10
|
+
import { dragDataFor } from './elementTypes.js';
|
|
11
|
+
import { useRecentElements } from './useRecentElements.js';
|
|
12
|
+
const INNER = {
|
|
13
|
+
grid: 'size-[74%] duration-200 ease-out',
|
|
14
|
+
recent: 'size-[72%] duration-200 ease-out',
|
|
15
|
+
brand: 'size-[66%] duration-[450ms] ease-[cubic-bezier(.3,1.5,.5,1)]',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Makes a button drag `item` onto a page, previewed by its `[data-tile-face]`
|
|
19
|
+
* or else its image. A drop the page accepted counts like a click for
|
|
20
|
+
* "Zuletzt verwendet".
|
|
21
|
+
*/
|
|
22
|
+
export function elementDragProps(item) {
|
|
23
|
+
return {
|
|
24
|
+
draggable: true,
|
|
25
|
+
onDragStart: (e) => {
|
|
26
|
+
takeDropPlaced();
|
|
27
|
+
const drag = dragDataFor(item.action);
|
|
28
|
+
e.dataTransfer.setData(drag.type, drag.data);
|
|
29
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
30
|
+
const preview = e.currentTarget.querySelector('[data-tile-face]') ??
|
|
31
|
+
e.currentTarget.querySelector('img');
|
|
32
|
+
if (preview)
|
|
33
|
+
e.dataTransfer.setDragImage(preview, preview.offsetWidth / 2, preview.offsetHeight / 2);
|
|
34
|
+
},
|
|
35
|
+
onDragEnd: () => {
|
|
36
|
+
if (takeDropPlaced())
|
|
37
|
+
useRecentElements.getState().remember(item);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export const ElementTile = memo(function ElementTile({ item, variant, onActivate, enterIndex, canDrag, selected = false, disabled = false, eager = false, }) {
|
|
42
|
+
const t = useMessages();
|
|
43
|
+
const fills = thumbFillsTile(item.thumb);
|
|
44
|
+
const dark = thumbNeedsDarkTile(item.thumb);
|
|
45
|
+
// `selected`/`disabled` describe the active page; a drag can target another
|
|
46
|
+
// page, whose canvas decides on the drop. Hence `aria-disabled`: a disabled
|
|
47
|
+
// button starts no drag.
|
|
48
|
+
const draggable = canDrag;
|
|
49
|
+
const svgDef = item.thumb.t === 'svg' ? item.thumb.def : null;
|
|
50
|
+
return (_jsxs("div", { className: cn('flex flex-col gap-1.5 min-w-0', variant === 'recent' && 'w-[88px] flex-none', enterIndex !== null && 'element-enter'), ...(enterIndex !== null
|
|
51
|
+
? { style: { '--i': Math.min(enterIndex, 7) } }
|
|
52
|
+
: {}), children: [_jsxs("button", { type: "button", title: item.label, "aria-label": t.sidebar.elements.addItem(item.label), ...(item.action.kind === 'icon' ? { 'aria-pressed': selected } : {}), "aria-disabled": disabled, ...(draggable ? elementDragProps(item) : { draggable: false }), onClick: () => {
|
|
53
|
+
if (!disabled)
|
|
54
|
+
onActivate(item);
|
|
55
|
+
}, ...(svgDef ? { onPointerEnter: () => onThumbnailHover(svgDef.id, svgDef) } : {}), className: cn('group/tile relative grid place-items-center w-full rounded-xl p-0 border cursor-pointer', 'transition-[background-color,border-color] duration-150', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]', variant === 'recent' ? 'size-[88px]' : 'aspect-square', fills && 'overflow-hidden', dark
|
|
56
|
+
? 'bg-secondary-600 hover:bg-secondary-700 border-transparent'
|
|
57
|
+
: variant === 'brand'
|
|
58
|
+
? 'bg-[var(--editor-surface)] border-[var(--editor-border-soft)] hover:bg-[var(--editor-tile)]'
|
|
59
|
+
: 'bg-transparent border-transparent hover:bg-[var(--editor-tile)]', selected && 'border-[var(--editor-accent)] bg-[var(--editor-active-soft)]', disabled && 'opacity-40 cursor-not-allowed', draggable && 'active:cursor-grabbing'), children: [_jsx("span", { "data-tile-face": true, className: cn('relative grid place-items-center', fills ? 'absolute inset-0' : INNER[variant], 'transition-transform group-hover/tile:scale-[1.04] group-aria-disabled/tile:scale-100', 'motion-reduce:transition-none'), children: _jsx(ElementThumb, { thumb: item.thumb, eager: eager }) }), selected && (_jsx("span", { className: "absolute top-1.5 right-1.5 size-4 rounded-full bg-[var(--editor-active-fg)] text-[var(--editor-surface)] grid place-items-center", children: _jsx(PiCheck, { size: 8 }) }))] }), variant === 'grid' && (_jsx("span", { className: "text-xs text-[var(--editor-text-muted)] text-center truncate", children: item.label }))] }));
|
|
60
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExtendedAssetsSectionProps } from './AssetsSection.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Elemente tab: a start page (recent, brand, category cards), a category
|
|
4
|
+
* page, and a search — in the category or across all of them. Desktop and
|
|
5
|
+
* the mobile sheet share it; only spacing and drag differ.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ElementsPanel(props: ExtendedAssetsSectionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,249 @@
|
|
|
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 { useDebounce } from '@ggraphic/editor/hooks/useDebounce';
|
|
5
|
+
import { messages, useMessages } from '@ggraphic/editor/i18n/messages';
|
|
6
|
+
import { registeredAssetCatalog } from '@ggraphic/editor/utils/canvasAssets';
|
|
7
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
8
|
+
import { addHostElement } from '@ggraphic/editor/utils/elementKinds';
|
|
9
|
+
import { MAX_ICON_SELECTIONS } from '@ggraphic/editor/utils/iconInstances';
|
|
10
|
+
import { useCallback, useDeferredValue, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
11
|
+
import { PiCaretLeftBold, PiMagnifyingGlass, PiX } from 'react-icons/pi';
|
|
12
|
+
import { useIsCanvasMobile } from '../../../hooks/useIsCanvasMobile.js';
|
|
13
|
+
import { useTrackUnsplashDownload } from '@ggraphic/editor/hooks/useTrackUnsplashDownload';
|
|
14
|
+
import { MOBILE_INPUT_TEXT } from '@ggraphic/editor/sidebar/sidebarStyles';
|
|
15
|
+
import { IllustrationSettings } from '../IllustrationSettings.js';
|
|
16
|
+
import { FramePreviewDefs } from '@ggraphic/editor/sidebar/sections/RahmenSection';
|
|
17
|
+
import { BackgroundCatalog } from './BackgroundCatalog.js';
|
|
18
|
+
import { CategoryCard } from '@ggraphic/editor/sidebar/sections/assets/CategoryCard';
|
|
19
|
+
import { ElementGrid } from './ElementGrid.js';
|
|
20
|
+
import { searchElements } from './elementSearch.js';
|
|
21
|
+
import { ElementTile } from './ElementTile.js';
|
|
22
|
+
import { galleryStickerItem } from './elementTypes.js';
|
|
23
|
+
import { EmojiTonePicker } from '@ggraphic/editor/sidebar/sections/assets/EmojiTonePicker';
|
|
24
|
+
import { FotosCatalog } from './FotosCatalog.js';
|
|
25
|
+
import { IconifyCatalog } from './IconifyCatalog.js';
|
|
26
|
+
import { RecentCarousel } from './RecentCarousel.js';
|
|
27
|
+
import { StickerCatalog } from './StickerCatalog.js';
|
|
28
|
+
import { canRun, useElementCatalog } from './useElementCatalog.js';
|
|
29
|
+
import { useRecentElements } from './useRecentElements.js';
|
|
30
|
+
/**
|
|
31
|
+
* Entrance (element-enter in both CSS twins): tiles 0–7 start 30 ms apart, the
|
|
32
|
+
* last one at 7 × 30 ms, and its 250 ms rise ends the entrance; 50 ms slack.
|
|
33
|
+
*/
|
|
34
|
+
const ENTRANCE_MS = 7 * 30 + 250 + 50;
|
|
35
|
+
const BRAND_COUNT = 4;
|
|
36
|
+
const useNoBlocks = () => null;
|
|
37
|
+
function countLabel(n) {
|
|
38
|
+
return messages().common.elements(n);
|
|
39
|
+
}
|
|
40
|
+
function SearchField({ value, onChange, placeholder, }) {
|
|
41
|
+
const t = useMessages();
|
|
42
|
+
return (_jsxs("label", { className: cn('flex flex-none items-center gap-2.5 h-11 pl-3.5 pr-2 rounded-xl border-[1.5px] cursor-text', 'border-[var(--editor-border-soft)] text-[var(--editor-text-muted)] bg-[var(--editor-surface)]', 'transition-[border-color] duration-200 focus-within:border-[var(--editor-accent)]'), children: [_jsx(PiMagnifyingGlass, { size: 18, "aria-hidden": true }), _jsx("input", { type: "search", enterKeyHint: "search", value: value, placeholder: placeholder, "aria-label": placeholder, onChange: (e) => onChange(e.target.value), onKeyDown: (e) => {
|
|
43
|
+
if (e.key === 'Escape' && value) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
onChange('');
|
|
46
|
+
}
|
|
47
|
+
}, className: cn('flex-1 min-w-0 border-none outline-none bg-transparent p-0 text-[15px] text-[var(--editor-text)]', MOBILE_INPUT_TEXT, 'placeholder:text-[var(--editor-text-muted)] [&::-webkit-search-cancel-button]:appearance-none') }), value && (_jsx("button", { type: "button", "aria-label": t.sidebar.elements.clearSearch, onClick: () => onChange(''), className: "touch-target size-7 rounded-lg grid place-items-center border-none bg-transparent cursor-pointer text-[var(--editor-text-muted)] hover:bg-[var(--editor-tile)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]", children: _jsx(PiX, { size: 16 }) }))] }));
|
|
48
|
+
}
|
|
49
|
+
function SectionHeading({ children }) {
|
|
50
|
+
return _jsx("h3", { className: "m-0 text-base font-bold text-[var(--editor-text)]", children: children });
|
|
51
|
+
}
|
|
52
|
+
/** The Blöcke category: its tiles under one heading per group (Listen, Text …). */
|
|
53
|
+
function BlockGroups({ blocks, items, grid, }) {
|
|
54
|
+
const groups = blocks.groups
|
|
55
|
+
.map((group) => ({
|
|
56
|
+
label: group.label,
|
|
57
|
+
items: items.filter((i) => group.keys.includes(i.key)),
|
|
58
|
+
}))
|
|
59
|
+
.filter((g) => g.items.length > 0);
|
|
60
|
+
return (_jsx("div", { className: "flex flex-col gap-5", children: groups.map((g) => (_jsxs("section", { className: "flex flex-col gap-2.5", children: [_jsx(SectionHeading, { children: g.label }), grid(g.items)] }, g.label))) }));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The Elemente tab: a start page (recent, brand, category cards), a category
|
|
64
|
+
* page, and a search — in the category or across all of them. Desktop and
|
|
65
|
+
* the mobile sheet share it; only spacing and drag differ.
|
|
66
|
+
*/
|
|
67
|
+
export function ElementsPanel(props) {
|
|
68
|
+
const t = useMessages();
|
|
69
|
+
const isMobile = useIsCanvasMobile();
|
|
70
|
+
const { userLocale = 'de-DE', searchUnsplashImages, iconSearch } = useCanvasEditorServices();
|
|
71
|
+
// Opened for a selected frame or illustration ("Mehr" on the phone), it starts in that category.
|
|
72
|
+
const [cat, setCat] = useState(() => props.selectedFrameId ? 'rahmen' : props.selectedIllustrationId ? 'illustrationen' : null);
|
|
73
|
+
const [query, setQuery] = useState('');
|
|
74
|
+
const q = useDeferredValue(useDebounce(query, 200)).trim();
|
|
75
|
+
const hasQuery = q.length > 0;
|
|
76
|
+
// Opening the tab plays the staggered entrance once; tiles mounted later just appear.
|
|
77
|
+
const [entering, setEntering] = useState(true);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
const t = window.setTimeout(() => setEntering(false), ENTRANCE_MS);
|
|
80
|
+
return () => window.clearTimeout(t);
|
|
81
|
+
}, []);
|
|
82
|
+
const enterIndexOf = useCallback((i) => (entering ? i : null), [entering]);
|
|
83
|
+
// A frame or illustration newly selected on the canvas opens its category.
|
|
84
|
+
const [seenFrame, setSeenFrame] = useState(props.selectedFrameId ?? null);
|
|
85
|
+
const [seenIllustration, setSeenIllustration] = useState(props.selectedIllustrationId ?? null);
|
|
86
|
+
if ((props.selectedFrameId ?? null) !== seenFrame) {
|
|
87
|
+
setSeenFrame(props.selectedFrameId ?? null);
|
|
88
|
+
if (props.selectedFrameId)
|
|
89
|
+
setCat('rahmen');
|
|
90
|
+
}
|
|
91
|
+
if ((props.selectedIllustrationId ?? null) !== seenIllustration) {
|
|
92
|
+
setSeenIllustration(props.selectedIllustrationId ?? null);
|
|
93
|
+
if (props.selectedIllustrationId)
|
|
94
|
+
setCat('illustrationen');
|
|
95
|
+
}
|
|
96
|
+
const [emojiTone, setEmojiTone] = useState(0);
|
|
97
|
+
const catalog = useElementCatalog(props, {
|
|
98
|
+
illustrations: hasQuery || cat === 'illustrationen',
|
|
99
|
+
icons: hasQuery,
|
|
100
|
+
photos: true,
|
|
101
|
+
emoji: hasQuery || cat === 'emoji',
|
|
102
|
+
}, emojiTone);
|
|
103
|
+
const category = cat ? (catalog.find((c) => c.id === cat) ?? null) : null;
|
|
104
|
+
// Handlers come in fresh props every render; the tiles get one stable callback.
|
|
105
|
+
const propsRef = useRef(props);
|
|
106
|
+
useLayoutEffect(() => {
|
|
107
|
+
propsRef.current = props;
|
|
108
|
+
});
|
|
109
|
+
const remember = useRecentElements((s) => s.remember);
|
|
110
|
+
const panelHost = registeredAssetCatalog().elementPanel;
|
|
111
|
+
const useBlocks = panelHost?.useBlocks ?? useNoBlocks;
|
|
112
|
+
const blocks = useBlocks();
|
|
113
|
+
const blocksRef = useRef(blocks);
|
|
114
|
+
useLayoutEffect(() => {
|
|
115
|
+
blocksRef.current = blocks;
|
|
116
|
+
});
|
|
117
|
+
const trackDownload = useTrackUnsplashDownload();
|
|
118
|
+
const activate = useCallback((item) => {
|
|
119
|
+
const p = propsRef.current;
|
|
120
|
+
const action = item.action;
|
|
121
|
+
switch (action.kind) {
|
|
122
|
+
case 'asset':
|
|
123
|
+
p.onAddAsset?.(action.assetId);
|
|
124
|
+
break;
|
|
125
|
+
case 'sticker':
|
|
126
|
+
p.onAddStickerAsset?.(action.ref);
|
|
127
|
+
break;
|
|
128
|
+
case 'shape':
|
|
129
|
+
p.onAddShape?.(action.shapeType, action.color);
|
|
130
|
+
break;
|
|
131
|
+
case 'illustration':
|
|
132
|
+
p.onAddIllustration?.(action.id);
|
|
133
|
+
break;
|
|
134
|
+
case 'chart':
|
|
135
|
+
p.onAddChart?.(action.chartType);
|
|
136
|
+
break;
|
|
137
|
+
case 'frame':
|
|
138
|
+
p.onAddFrame?.(action.clipType);
|
|
139
|
+
break;
|
|
140
|
+
case 'media':
|
|
141
|
+
if (!p.onAddImageFromUrl)
|
|
142
|
+
return;
|
|
143
|
+
trackDownload(action.name, action.attribution);
|
|
144
|
+
p.onAddImageFromUrl(action.url, action.name, action.attribution ? { attribution: action.attribution } : {});
|
|
145
|
+
break;
|
|
146
|
+
case 'block':
|
|
147
|
+
if (!blocksRef.current)
|
|
148
|
+
return;
|
|
149
|
+
void blocksRef.current.insert(action.blockId);
|
|
150
|
+
break;
|
|
151
|
+
case 'icon': {
|
|
152
|
+
const selected = p.selectedIcons ?? [];
|
|
153
|
+
const isOn = selected.includes(action.iconId);
|
|
154
|
+
if (!isOn && selected.length >= (p.maxIconSelections ?? MAX_ICON_SELECTIONS))
|
|
155
|
+
return;
|
|
156
|
+
p.onIconToggle?.(action.iconId, !isOn);
|
|
157
|
+
if (isOn)
|
|
158
|
+
return;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
default:
|
|
162
|
+
addHostElement(action, p.hostElementActions ?? null);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
remember(item);
|
|
166
|
+
}, [remember, trackDownload]);
|
|
167
|
+
// A gallery sticker goes through the same path, so it lands in "Zuletzt" too.
|
|
168
|
+
const addGallerySticker = useCallback((ref) => activate(galleryStickerItem(ref)), [activate]);
|
|
169
|
+
const selectedIcons = props.selectedIcons;
|
|
170
|
+
const maxIcons = props.maxIconSelections ?? MAX_ICON_SELECTIONS;
|
|
171
|
+
const isSelected = useCallback((item) => item.action.kind === 'icon' && (selectedIcons?.includes(item.action.iconId) ?? false), [selectedIcons]);
|
|
172
|
+
const isDisabled = useCallback((item) => item.action.kind === 'icon' &&
|
|
173
|
+
!(selectedIcons?.includes(item.action.iconId) ?? false) &&
|
|
174
|
+
(selectedIcons?.length ?? 0) >= maxIcons, [selectedIcons, maxIcons]);
|
|
175
|
+
const storedRecent = useRecentElements((s) => s.items);
|
|
176
|
+
const recent = useMemo(() => storedRecent.filter((item) => canRun(item.action, props, blocks)),
|
|
177
|
+
// `props` changes identity every render; what matters is which handlers exist.
|
|
178
|
+
[
|
|
179
|
+
storedRecent,
|
|
180
|
+
props.onAddAsset,
|
|
181
|
+
props.onAddStickerAsset,
|
|
182
|
+
props.onAddShape,
|
|
183
|
+
props.onAddIllustration,
|
|
184
|
+
props.onAddChart,
|
|
185
|
+
props.onAddFrame,
|
|
186
|
+
props.addableHostKinds,
|
|
187
|
+
props.onAddImageFromUrl,
|
|
188
|
+
props.onIconToggle,
|
|
189
|
+
blocks,
|
|
190
|
+
]);
|
|
191
|
+
const results = useMemo(() => {
|
|
192
|
+
if (!hasQuery)
|
|
193
|
+
return [];
|
|
194
|
+
return searchElements(catalog, q, category);
|
|
195
|
+
}, [hasQuery, q, category, catalog]);
|
|
196
|
+
const openCategory = (id) => {
|
|
197
|
+
setCat(id);
|
|
198
|
+
setQuery('');
|
|
199
|
+
};
|
|
200
|
+
const brand = catalog.find((c) => c.id === 'marke');
|
|
201
|
+
const cards = catalog.filter((c) => c.id !== 'marke');
|
|
202
|
+
const placeholder = category
|
|
203
|
+
? t.sidebar.elements.searchIn(category.label)
|
|
204
|
+
: t.sidebar.elements.searchElements;
|
|
205
|
+
const noResultsHint = panelHost?.noResultsHint?.(userLocale) ?? null;
|
|
206
|
+
const canDrag = !isMobile;
|
|
207
|
+
const selectedIllustration = cat === 'illustrationen' && props.selectedIllustrationId
|
|
208
|
+
? (props.illustrationInstances?.find((i) => i.id === props.selectedIllustrationId) ?? null)
|
|
209
|
+
: null;
|
|
210
|
+
// Icons from the host's icon search, below a search query, next to the bundled ones.
|
|
211
|
+
const iconify = hasQuery && iconSearch && props.onAddExternalIcon ? (_jsx(IconifyCatalog, { query: q, onAdd: props.onAddExternalIcon, full: (selectedIcons?.length ?? 0) >= maxIcons ? maxIcons : null })) : null;
|
|
212
|
+
const grid = (items) => (_jsx(ElementGrid, { items: items, onActivate: activate, enterIndexOf: enterIndexOf, canDrag: canDrag, isSelected: isSelected, isDisabled: isDisabled }));
|
|
213
|
+
function renderCategoryBody() {
|
|
214
|
+
if (!category)
|
|
215
|
+
return null;
|
|
216
|
+
if (category.id === 'hintergruende' && props.onSetBackgroundImage) {
|
|
217
|
+
return (_jsx(BackgroundCatalog, { currentImageSrc: props.currentBackgroundSrc, onImageChange: props.onSetBackgroundImage, searchQuery: q }));
|
|
218
|
+
}
|
|
219
|
+
const items = hasQuery ? results : category.items;
|
|
220
|
+
const body = items.length > 0 ? (grid(items)) : category.isLoading ? (_jsx("p", { className: "m-0 py-8 text-center text-sm text-[var(--editor-text-muted)]", children: t.sidebar.elements.loading })) : null;
|
|
221
|
+
if (category.id === 'bloecke' && !hasQuery && blocks) {
|
|
222
|
+
return _jsx(BlockGroups, { blocks: blocks, items: items, grid: grid });
|
|
223
|
+
}
|
|
224
|
+
if (category.id === 'emoji') {
|
|
225
|
+
return (_jsxs(_Fragment, { children: [_jsx(EmojiTonePicker, { tone: emojiTone, onChange: setEmojiTone }), body] }));
|
|
226
|
+
}
|
|
227
|
+
if (category.id === 'fotos') {
|
|
228
|
+
return (_jsx(FotosCatalog, { searchQuery: q, grid: grid, children: body }));
|
|
229
|
+
}
|
|
230
|
+
if (category.id === 'sticker' && props.onAddAsset) {
|
|
231
|
+
return (_jsx(StickerCatalog, { ...(props.onAddStickerAsset ? { onAddStickerAsset: addGallerySticker } : {}), searchQuery: q, canDrag: canDrag, children: body }));
|
|
232
|
+
}
|
|
233
|
+
if (category.id === 'icons' && iconify) {
|
|
234
|
+
return (_jsxs("div", { className: "flex flex-col gap-5", children: [body, iconify] }));
|
|
235
|
+
}
|
|
236
|
+
return body;
|
|
237
|
+
}
|
|
238
|
+
const showResultsHeader = hasQuery && (category?.searchable ?? true);
|
|
239
|
+
// In Fotos an empty local search still leads on to Unsplash, so the body stays.
|
|
240
|
+
const searchesUnsplash = category?.id === 'fotos' && searchUnsplashImages !== undefined;
|
|
241
|
+
// The icon search below a query can still find icons the bundled sets lack.
|
|
242
|
+
const searchesIcons = iconify !== null && (category === null || category.id === 'icons');
|
|
243
|
+
const showNoResults = showResultsHeader && results.length === 0 && !searchesUnsplash && !searchesIcons;
|
|
244
|
+
return (_jsxs("div", { className: cn('flex flex-col gap-[22px] max-canvas-mobile:gap-5 w-full min-w-0', 'canvas-mobile:-m-3 canvas-mobile:min-w-[calc(100%+24px)] canvas-mobile:px-4 canvas-mobile:pt-5 canvas-mobile:pb-8'), children: [_jsx(FramePreviewDefs, {}), _jsx(SearchField, { value: query, onChange: setQuery, placeholder: placeholder }), category && (_jsxs("div", { className: "flex items-center gap-2 -mt-1.5", children: [_jsx("button", { type: "button", onClick: () => setCat(null), "aria-label": t.sidebar.elements.backToAll, className: "size-9 rounded-[10px] grid place-items-center border-none bg-transparent cursor-pointer text-[var(--editor-text)] hover:bg-[var(--editor-tile)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]", children: _jsx(PiCaretLeftBold, { size: 20 }) }), _jsx("h3", { className: "m-0 flex-1 text-lg font-extrabold text-[var(--editor-text)] truncate", children: category.label }), category.count !== null && (_jsx("span", { className: "text-[13px] text-[var(--editor-text-muted)]", children: countLabel(category.count) }))] })), showResultsHeader && (_jsxs("div", { className: "flex items-baseline justify-between gap-2 -mt-1.5", children: [_jsx(SectionHeading, { children: results.length > 0
|
|
245
|
+
? t.sidebar.elements.resultsFor(results.length, q)
|
|
246
|
+
: t.topBar.background.noMatch(q) }), category && (_jsx("button", { type: "button", onClick: () => setCat(null), className: "p-0 border-none bg-transparent cursor-pointer whitespace-nowrap text-[13px] font-semibold text-[var(--editor-active-fg)] hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)] rounded", children: t.sidebar.elements.searchEverywhere }))] })), showNoResults ? (_jsxs("div", { className: "flex flex-col items-center gap-1.5 px-3 py-10 text-center", children: [_jsx("strong", { className: "text-[15px] text-[var(--editor-text)]", children: t.sidebar.elements.nothingFound }), noResultsHint && (_jsx("span", { className: "text-sm text-[var(--editor-text-muted)] [text-wrap:pretty]", children: noResultsHint }))] })) : category ? (_jsxs(_Fragment, { children: [selectedIllustration && (_jsx(IllustrationSettings, { selectedIllustration: selectedIllustration, onUpdateIllustration: props.onUpdateIllustration ?? (() => { }), onRemoveIllustration: props.onRemoveIllustration ?? (() => { }), ...(props.onDuplicateIllustration
|
|
247
|
+
? { onDuplicateIllustration: props.onDuplicateIllustration }
|
|
248
|
+
: {}) })), renderCategoryBody()] })) : hasQuery ? (_jsxs(_Fragment, { children: [grid(results), iconify] })) : (_jsxs(_Fragment, { children: [recent.length > 0 && (_jsxs("section", { className: "flex flex-col gap-2.5", children: [_jsxs("div", { className: "flex items-baseline justify-between", children: [_jsx(SectionHeading, { children: t.sidebar.elements.recent }), _jsx("span", { className: "text-xs text-[var(--editor-text-muted)]", children: countLabel(recent.length) })] }), _jsx(RecentCarousel, { items: recent, onActivate: activate, enterIndexOf: enterIndexOf, canDrag: canDrag })] })), brand && (_jsxs("section", { className: "flex flex-col gap-2.5", children: [_jsxs("div", { className: "flex items-baseline justify-between", children: [_jsx(SectionHeading, { children: t.sidebar.elements.yourBrand }), _jsx("button", { type: "button", onClick: () => openCategory('marke'), className: "touch-target p-0 border-none bg-transparent cursor-pointer text-[13px] font-semibold text-[var(--editor-active-fg)] hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)] rounded", children: t.sidebar.elements.showAll })] }), _jsx("div", { className: "grid grid-cols-4 gap-2", children: brand.items.slice(0, BRAND_COUNT).map((item, i) => (_jsx(ElementTile, { item: item, variant: "brand", onActivate: activate, enterIndex: enterIndexOf(i), canDrag: canDrag, eager: true }, item.key))) })] })), cards.length > 0 && (_jsxs("section", { className: "flex flex-col gap-3.5", children: [_jsx(SectionHeading, { children: t.sidebar.elements.browseCategories }), _jsx("div", { className: "grid grid-cols-3 gap-x-3.5 gap-y-[22px]", children: cards.map((c, i) => (_jsx(CategoryCard, { label: c.label, countLabel: c.count !== null ? countLabel(c.count) : null, tint: c.tint, cover: c.cover, enterIndex: enterIndexOf(i), onOpen: () => openCategory(c.id) }, c.id))) })] }))] }))] }));
|
|
249
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skin tone of the emoji tiles: 0 default, 1–5 light → dark. A radio group:
|
|
3
|
+
* one tab stop, the arrow keys move and select, wrapping at both ends.
|
|
4
|
+
*/
|
|
5
|
+
export declare function EmojiTonePicker({ tone, onChange, }: {
|
|
6
|
+
tone: number;
|
|
7
|
+
onChange: (tone: number) => void;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
4
|
+
import { cn } from '@ggraphic/editor/utils/cn';
|
|
5
|
+
import { useRef } from 'react';
|
|
6
|
+
const SKIN_TONE_COLORS = ['#fcc21b', '#f7dece', '#f3d2a2', '#d5ab88', '#af7e57', '#7c533e'];
|
|
7
|
+
const STEP = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 };
|
|
8
|
+
/**
|
|
9
|
+
* Skin tone of the emoji tiles: 0 default, 1–5 light → dark. A radio group:
|
|
10
|
+
* one tab stop, the arrow keys move and select, wrapping at both ends.
|
|
11
|
+
*/
|
|
12
|
+
export function EmojiTonePicker({ tone, onChange, }) {
|
|
13
|
+
const t = useMessages();
|
|
14
|
+
const labels = t.sidebar.elements.skinTones;
|
|
15
|
+
const groupRef = useRef(null);
|
|
16
|
+
const onKeyDown = (e) => {
|
|
17
|
+
const step = STEP[e.key];
|
|
18
|
+
if (!step)
|
|
19
|
+
return;
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
const next = (tone + step + SKIN_TONE_COLORS.length) % SKIN_TONE_COLORS.length;
|
|
22
|
+
onChange(next);
|
|
23
|
+
groupRef.current?.querySelectorAll('[role="radio"]')[next]?.focus();
|
|
24
|
+
};
|
|
25
|
+
return (_jsx("div", { ref: groupRef, role: "radiogroup", "aria-label": t.sidebar.elements.skinTone, className: "flex items-center gap-1.5 pb-3", children: SKIN_TONE_COLORS.map((color, i) => (_jsx("button", { type: "button", role: "radio", "aria-checked": tone === i, "aria-label": labels[i], title: labels[i], tabIndex: tone === i ? 0 : -1, onClick: () => onChange(i), onKeyDown: onKeyDown, className: cn('size-6 rounded-full border-2 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--editor-accent)]', tone === i ? 'border-[var(--editor-accent)]' : 'border-transparent'), style: { backgroundColor: color } }, labels[i]))) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ElementItem } from './elementTypes.js';
|
|
3
|
+
/**
|
|
4
|
+
* The Fotos category: the bundled photos (`children`), and below a search
|
|
5
|
+
* query the live Unsplash search. Each search spends one of the shared key's
|
|
6
|
+
* 50 hourly requests; once they are gone the notice says so.
|
|
7
|
+
*/
|
|
8
|
+
export declare function FotosCatalog({ searchQuery, grid, children, }: {
|
|
9
|
+
searchQuery: string;
|
|
10
|
+
grid: (items: readonly ElementItem[]) => ReactNode;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { useNoUnsplashSearch } from '@ggraphic/editor/hostServices';
|
|
5
|
+
import { useMessages } from '@ggraphic/editor/i18n/messages';
|
|
6
|
+
import { useUnsplashHome } from '@ggraphic/editor/utils/unsplashLinks';
|
|
7
|
+
import { UnsplashLimitNotice, UnsplashRemaining, } from '@ggraphic/editor/sidebar/sections/tools/UnsplashLimitNotice';
|
|
8
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
9
|
+
import { unsplashPhotoItem } from './useStockPhotos.js';
|
|
10
|
+
/** On top of the panel's own 200 ms, so a typing pause, not every key, costs a search. */
|
|
11
|
+
const SEARCH_DEBOUNCE_MS = 400;
|
|
12
|
+
/**
|
|
13
|
+
* The Fotos category: the bundled photos (`children`), and below a search
|
|
14
|
+
* query the live Unsplash search. Each search spends one of the shared key's
|
|
15
|
+
* 50 hourly requests; once they are gone the notice says so.
|
|
16
|
+
*/
|
|
17
|
+
export function FotosCatalog({ searchQuery, grid, children, }) {
|
|
18
|
+
const t = useMessages();
|
|
19
|
+
const unsplashHome = useUnsplashHome();
|
|
20
|
+
// `useUnsplashSearch` is a host hook, fixed for the lifetime of the editor.
|
|
21
|
+
const { searchUnsplashImages, useUnsplashSearch = useNoUnsplashSearch } = useCanvasEditorServices();
|
|
22
|
+
const searchFn = useCallback((q, p, pp) => searchUnsplashImages
|
|
23
|
+
? searchUnsplashImages(q, p, pp)
|
|
24
|
+
: Promise.resolve({ results: [], total: 0, total_pages: 0 }), [searchUnsplashImages]);
|
|
25
|
+
const { searchResults, totalResults, isLoadingSearch, searchError, limit, remaining, lastQuery, searchUnsplash, loadMoreResults, } = useUnsplashSearch(searchFn);
|
|
26
|
+
const items = useMemo(() => searchResults.filter((image) => image.url).map(unsplashPhotoItem), [searchResults]);
|
|
27
|
+
const query = searchQuery.trim();
|
|
28
|
+
const canSearch = searchUnsplashImages !== undefined && query.length > 0;
|
|
29
|
+
// While blocked a request would only fetch the same refusal.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!canSearch || limit)
|
|
32
|
+
return;
|
|
33
|
+
const id = setTimeout(() => void searchUnsplash(query), SEARCH_DEBOUNCE_MS);
|
|
34
|
+
return () => clearTimeout(id);
|
|
35
|
+
}, [canSearch, limit, query, searchUnsplash]);
|
|
36
|
+
if (!canSearch)
|
|
37
|
+
return children;
|
|
38
|
+
const isCurrent = lastQuery === query;
|
|
39
|
+
const hasMore = isCurrent && items.length > 0 && searchResults.length < totalResults;
|
|
40
|
+
return (_jsxs("div", { className: "flex flex-col gap-3 w-full", children: [children, _jsxs("section", { "aria-label": t.sidebar.elements.unsplashPhotos, className: "flex flex-col gap-2.5", children: [_jsx("h4", { className: "m-0 text-sm font-bold text-[var(--editor-text)]", children: t.unsplash.moreFrom }), limit && _jsx(UnsplashLimitNotice, { retryAt: limit.retryAt }), isCurrent && searchError && (_jsx("p", { role: "alert", className: "m-0 text-xs text-editor-danger-fg", children: searchError })), isCurrent && items.length > 0 && grid(items), isCurrent && !isLoadingSearch && !searchError && !limit && items.length === 0 && (_jsx("p", { role: "status", className: "m-0 text-xs text-[var(--editor-text-muted)]", children: t.unsplash.noPhotosEither(query) })), isLoadingSearch && (_jsx("p", { role: "status", className: "m-0 text-xs text-[var(--editor-text-muted)]", children: t.sidebar.elements.unsplashSearching })), hasMore && !isLoadingSearch && !limit && (_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) })), isCurrent && (_jsxs(_Fragment, { children: [!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] })] }))] })] }));
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ExternalIconPayload } from '@ggraphic/editor/utils/externalIcons';
|
|
2
|
+
/**
|
|
3
|
+
* Icons from the host's icon search under a search query: a grid of hits, and
|
|
4
|
+
* for the selected one its set, author and licence with an insert button. The
|
|
5
|
+
* SVG is fetched on insert and handed to `onAdd`, which stores a copy in the
|
|
6
|
+
* design. Renders nothing when the host has no `iconSearch`.
|
|
7
|
+
*
|
|
8
|
+
* `full` is the per-page icon limit when it is reached; inserting is then off.
|
|
9
|
+
*/
|
|
10
|
+
export declare function IconifyCatalog({ query, onAdd, full, }: {
|
|
11
|
+
query: string;
|
|
12
|
+
onAdd: (id: string, payload: ExternalIconPayload) => void;
|
|
13
|
+
full?: number | null;
|
|
14
|
+
}): import("react").JSX.Element | null;
|