@snowcone-app/canvas 0.1.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.txt +70 -0
- package/README.md +357 -0
- package/dist/CanvasStateV1-D5GzvmnY.cjs +65 -0
- package/dist/CanvasStateV1-D5GzvmnY.cjs.map +1 -0
- package/dist/CanvasStateV1-ejb4d_LM.js +3692 -0
- package/dist/CanvasStateV1-ejb4d_LM.js.map +1 -0
- package/dist/ElementFactory-B7UOaJSD.cjs +23865 -0
- package/dist/ElementFactory-B7UOaJSD.cjs.map +1 -0
- package/dist/ElementFactory-uJTXU-nP.js +29615 -0
- package/dist/ElementFactory-uJTXU-nP.js.map +1 -0
- package/dist/HybridHistoryManager-BV6XV0nD.js +8048 -0
- package/dist/HybridHistoryManager-BV6XV0nD.js.map +1 -0
- package/dist/HybridHistoryManager-BXD93pp8.cjs +8 -0
- package/dist/HybridHistoryManager-BXD93pp8.cjs.map +1 -0
- package/dist/ImportManager-BYwuK6n4.cjs +2 -0
- package/dist/ImportManager-BYwuK6n4.cjs.map +1 -0
- package/dist/ImportManager-CxiaRg1N.js +222 -0
- package/dist/ImportManager-CxiaRg1N.js.map +1 -0
- package/dist/ThemeContext-4mJ_y0Me.cjs +2 -0
- package/dist/ThemeContext-4mJ_y0Me.cjs.map +1 -0
- package/dist/ThemeContext-H0Z-MqqR.js +1077 -0
- package/dist/ThemeContext-H0Z-MqqR.js.map +1 -0
- package/dist/advanced.d.ts +2 -0
- package/dist/advanced.js +48 -0
- package/dist/advanced.js.map +1 -0
- package/dist/advanced.mjs +15679 -0
- package/dist/advanced.mjs.map +1 -0
- package/dist/api/advanced.d.ts +110 -0
- package/dist/api/internals.d.ts +39 -0
- package/dist/api/stable.d.ts +44 -0
- package/dist/api/testing.d.ts +25 -0
- package/dist/browser-module-D0gHY9rY.cjs +9 -0
- package/dist/browser-module-D0gHY9rY.cjs.map +1 -0
- package/dist/browser-module-DFvKXBUE.js +15474 -0
- package/dist/browser-module-DFvKXBUE.js.map +1 -0
- package/dist/components/ArtboardDistressPanel.d.ts +7 -0
- package/dist/components/ArtboardImageMaskPanel.d.ts +7 -0
- package/dist/components/ArtboardPropertiesToolbar.d.ts +19 -0
- package/dist/components/ArtboardToolbar.d.ts +10 -0
- package/dist/components/BackButton.d.ts +7 -0
- package/dist/components/BackgroundPickerDropdown.d.ts +11 -0
- package/dist/components/BackgroundSwitcher.d.ts +7 -0
- package/dist/components/CanvasA11yFallback.d.ts +62 -0
- package/dist/components/CanvasEditor/CanvasRendererComponent.d.ts +51 -0
- package/dist/components/CanvasEditor/handlers/cropModeHandlers.d.ts +114 -0
- package/dist/components/CanvasEditor/handlers/groupChildHandlers.d.ts +65 -0
- package/dist/components/CanvasEditor/handlers/index.d.ts +10 -0
- package/dist/components/CanvasEditor/handlers/multiSelectionHandlers.d.ts +86 -0
- package/dist/components/CanvasEditor/hooks/buildSpreadClipShape.d.ts +20 -0
- package/dist/components/CanvasEditor/hooks/index.d.ts +24 -0
- package/dist/components/CanvasEditor/hooks/useActiveChild.d.ts +23 -0
- package/dist/components/CanvasEditor/hooks/useAnimatedFocusRect.d.ts +17 -0
- package/dist/components/CanvasEditor/hooks/useCanvasInteraction.d.ts +284 -0
- package/dist/components/CanvasEditor/hooks/useCanvasLayout.d.ts +50 -0
- package/dist/components/CanvasEditor/hooks/useCanvasRenderLoop.d.ts +140 -0
- package/dist/components/CanvasEditor/hooks/useCropMode.d.ts +4 -0
- package/dist/components/CanvasEditor/hooks/useHoverState.d.ts +9 -0
- package/dist/components/CanvasEditor/hooks/useInteractionState.d.ts +23 -0
- package/dist/components/CanvasEditor/hooks/useKeyboardHandlers.d.ts +16 -0
- package/dist/components/CanvasEditor/hooks/useMarqueeSelection.d.ts +22 -0
- package/dist/components/CanvasEditor/hooks/useMultiSelection.d.ts +5 -0
- package/dist/components/CanvasEditor/hooks/usePenTool.d.ts +10 -0
- package/dist/components/CanvasEditor/hooks/useRenderState.d.ts +31 -0
- package/dist/components/CanvasEditor/hooks/useSnapAndSpacing.d.ts +42 -0
- package/dist/components/CanvasEditor/hooks/useTextEditing.d.ts +56 -0
- package/dist/components/CanvasEditor/hooks/useTextEditingHandlers.d.ts +75 -0
- package/dist/components/CanvasEditor/renderers/hoverRenderer.d.ts +12 -0
- package/dist/components/CanvasEditor/renderers/index.d.ts +10 -0
- package/dist/components/CanvasEditor/renderers/marqueeRenderer.d.ts +21 -0
- package/dist/components/CanvasEditor/renderers/multiSelectionRenderer.d.ts +52 -0
- package/dist/components/CanvasEditor/renderers/renderingConstants.d.ts +59 -0
- package/dist/components/CanvasEditor/types/index.d.ts +11 -0
- package/dist/components/CanvasEditor.d.ts +102 -0
- package/dist/components/ColorPickerDropdown.d.ts +29 -0
- package/dist/components/CompositingPanel.d.ts +8 -0
- package/dist/components/ContextualToolbars.d.ts +150 -0
- package/dist/components/CropPanel.d.ts +20 -0
- package/dist/components/DistressPanel.d.ts +7 -0
- package/dist/components/DocsPage.d.ts +6 -0
- package/dist/components/Drawer.d.ts +39 -0
- package/dist/components/EffectsPanel.d.ts +14 -0
- package/dist/components/ExportTestPanel.d.ts +16 -0
- package/dist/components/FontBrowserDrawer.d.ts +20 -0
- package/dist/components/FontSizeDropdown.d.ts +12 -0
- package/dist/components/GlyphBrowserDrawer.d.ts +13 -0
- package/dist/components/GlyphPicker.d.ts +14 -0
- package/dist/components/IconMatchTest.d.ts +3 -0
- package/dist/components/IconSizeTest.d.ts +3 -0
- package/dist/components/ImageBrowserDrawer.d.ts +27 -0
- package/dist/components/ImageToolbar.d.ts +47 -0
- package/dist/components/LayerEffects.d.ts +11 -0
- package/dist/components/LayerLeadingChip.d.ts +9 -0
- package/dist/components/LayersPanel.d.ts +30 -0
- package/dist/components/MaskItem.d.ts +12 -0
- package/dist/components/MasksPanel.d.ts +7 -0
- package/dist/components/MonotypeDemoPage.d.ts +2 -0
- package/dist/components/MoreMenu.d.ts +15 -0
- package/dist/components/OpenTypeFeaturesPanel.d.ts +12 -0
- package/dist/components/PathToolbar.d.ts +10 -0
- package/dist/components/PenToolDemo.d.ts +3 -0
- package/dist/components/ProgressiveBlur.d.ts +25 -0
- package/dist/components/RotationHandle.d.ts +47 -0
- package/dist/components/SaveLoadMenu.d.ts +15 -0
- package/dist/components/ShapeToolbar.d.ts +71 -0
- package/dist/components/ShapeTypeDrawer.d.ts +10 -0
- package/dist/components/StrokePanel.d.ts +7 -0
- package/dist/components/TailwindDemo.d.ts +3 -0
- package/dist/components/TextEffectsDropdown.d.ts +14 -0
- package/dist/components/TextToolbar.d.ts +47 -0
- package/dist/components/TextTypeDrawer.d.ts +8 -0
- package/dist/components/ThemeToggle.d.ts +2 -0
- package/dist/components/TransformControlPanel.d.ts +12 -0
- package/dist/components/VisualGuideOverlay.d.ts +156 -0
- package/dist/components/embed/ArtboardTabs.d.ts +74 -0
- package/dist/components/embed/Canvas.d.ts +72 -0
- package/dist/components/embed/EffectsPanel.d.ts +76 -0
- package/dist/components/embed/ErrorBoundary.d.ts +34 -0
- package/dist/components/embed/ExportPanel.d.ts +51 -0
- package/dist/components/embed/GlyphPanel.d.ts +70 -0
- package/dist/components/embed/ImagePanel.d.ts +58 -0
- package/dist/components/embed/LayersPanel.d.ts +13 -0
- package/dist/components/embed/LoadingStates.d.ts +32 -0
- package/dist/components/embed/MenuButton.d.ts +47 -0
- package/dist/components/embed/SnowconeCanvas.d.ts +844 -0
- package/dist/components/embed/ZoomControls.d.ts +16 -0
- package/dist/components/embed/index.d.ts +129 -0
- package/dist/components/embed/primitives/index.d.ts +42 -0
- package/dist/components/embed/ui/index.d.ts +52 -0
- package/dist/components/embed/utils/index.d.ts +31 -0
- package/dist/components/embedded/ArtboardEmbed.d.ts +70 -0
- package/dist/components/embedded/MerchifyThemeWrapper.d.ts +30 -0
- package/dist/components/embedded/ProductPreviewCard.d.ts +8 -0
- package/dist/components/embedded/index.d.ts +7 -0
- package/dist/components/primitives/ButtonGroup.d.ts +27 -0
- package/dist/components/primitives/ControlGroup.d.ts +15 -0
- package/dist/components/primitives/Dropdown.d.ts +27 -0
- package/dist/components/primitives/DropdownMenu.d.ts +9 -0
- package/dist/components/primitives/MenuItem.d.ts +13 -0
- package/dist/components/primitives/Panel.d.ts +25 -0
- package/dist/components/primitives/SecondaryToolbar.d.ts +9 -0
- package/dist/components/primitives/Switch.d.ts +10 -0
- package/dist/components/primitives/Toggle.d.ts +17 -0
- package/dist/components/primitives/index.d.ts +22 -0
- package/dist/components/stories/utils/MockEditorProvider.d.ts +32 -0
- package/dist/components/stories/utils/QACanvasCard.d.ts +41 -0
- package/dist/components/stories/utils/VisualQACard.d.ts +24 -0
- package/dist/components/stories/utils/element-factories.d.ts +188 -0
- package/dist/components/stories/utils/spec-to-elements.d.ts +74 -0
- package/dist/components/stories/utils/themeDecorator.d.ts +45 -0
- package/dist/components/stories/utils/unified-test-cases.d.ts +27 -0
- package/dist/components/text-toolbar/BoldButton.d.ts +5 -0
- package/dist/components/text-toolbar/FontColorButton.d.ts +6 -0
- package/dist/components/text-toolbar/FontSizeGroup.d.ts +5 -0
- package/dist/components/text-toolbar/ItalicButton.d.ts +5 -0
- package/dist/components/text-toolbar/TextAlignButton.d.ts +5 -0
- package/dist/components/text-toolbar/TextMoreMenu.d.ts +7 -0
- package/dist/components/text-toolbar/UnderlineButton.d.ts +5 -0
- package/dist/components/text-toolbar/UppercaseButton.d.ts +5 -0
- package/dist/components/text-toolbar/index.d.ts +25 -0
- package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +49 -0
- package/dist/components/toolbars/ExpandedPanelIcon.d.ts +13 -0
- package/dist/components/toolbars/FloatingPanels.d.ts +23 -0
- package/dist/components/toolbars/GroupElementToolbar.d.ts +35 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +125 -0
- package/dist/components/toolbars/index.d.ts +18 -0
- package/dist/components/toolbars/shared/ColorPanelWrapper.d.ts +9 -0
- package/dist/components/toolbars/shared/SecondaryPanelWrapper.d.ts +9 -0
- package/dist/components/ui/PresetCarousel.d.ts +21 -0
- package/dist/components/ui/SecondaryPanel.d.ts +28 -0
- package/dist/components/ui/SliderRow.d.ts +30 -0
- package/dist/components/ui/collapsed-toolbar-header.d.ts +14 -0
- package/dist/components/ui/custom-icons.d.ts +25 -0
- package/dist/components/ui/icons.d.ts +100 -0
- package/dist/components/ui/index.d.ts +48 -0
- package/dist/components/ui/normalized-icon.d.ts +63 -0
- package/dist/components/ui/toolbar-button.d.ts +24 -0
- package/dist/compose-Bo108juW.cjs +33 -0
- package/dist/compose-Bo108juW.cjs.map +1 -0
- package/dist/compose-DQ1FZS3O.js +7690 -0
- package/dist/compose-DQ1FZS3O.js.map +1 -0
- package/dist/constants.d.ts +121 -0
- package/dist/contexts/CommandContext.d.ts +87 -0
- package/dist/contexts/EditorContext.d.ts +190 -0
- package/dist/contexts/ElementsContext.d.ts +104 -0
- package/dist/contexts/HistoryContext.d.ts +60 -0
- package/dist/contexts/KitContext.d.ts +50 -0
- package/dist/contexts/SelectionContext.d.ts +51 -0
- package/dist/contexts/ThemeContext.d.ts +55 -0
- package/dist/contexts/ToolStateContext.d.ts +60 -0
- package/dist/contexts/ViewportContext.d.ts +87 -0
- package/dist/core/AlignmentSnapSystem.d.ts +270 -0
- package/dist/core/ArtboardElement.d.ts +106 -0
- package/dist/core/ArtboardManager.d.ts +130 -0
- package/dist/core/ArtboardRenderer.d.ts +97 -0
- package/dist/core/BaseElement.d.ts +94 -0
- package/dist/core/CanvasRenderer.d.ts +237 -0
- package/dist/core/CommandHistory.d.ts +173 -0
- package/dist/core/CoordinateTransform.d.ts +69 -0
- package/dist/core/CropModeController.d.ts +90 -0
- package/dist/core/EditModeRenderer.d.ts +51 -0
- package/dist/core/ElementFactory.d.ts +73 -0
- package/dist/core/ElementStore.d.ts +69 -0
- package/dist/core/EventBus.d.ts +163 -0
- package/dist/core/GeometryUtils.d.ts +247 -0
- package/dist/core/GroupElement.d.ts +134 -0
- package/dist/core/HoverRenderer.d.ts +103 -0
- package/dist/core/HybridHistoryManager.d.ts +137 -0
- package/dist/core/ImageCache.d.ts +63 -0
- package/dist/core/ImageElement.d.ts +226 -0
- package/dist/core/ImageLoadEvents.d.ts +23 -0
- package/dist/core/InteractionFeedbackRenderer.d.ts +15 -0
- package/dist/core/InteractionStateMachine.d.ts +199 -0
- package/dist/core/PathElement.d.ts +84 -0
- package/dist/core/PenToolManager.d.ts +112 -0
- package/dist/core/PinchHandler.d.ts +32 -0
- package/dist/core/ResizeHandler.d.ts +51 -0
- package/dist/core/ResizePipeline.d.ts +83 -0
- package/dist/core/ResizeUtils.d.ts +17 -0
- package/dist/core/RotationAnchorResolver.d.ts +60 -0
- package/dist/core/RotationUtils.d.ts +28 -0
- package/dist/core/SelectionRenderer.d.ts +24 -0
- package/dist/core/ShapeElement.d.ts +121 -0
- package/dist/core/SpacingSystem.d.ts +73 -0
- package/dist/core/SpatialGrid.d.ts +53 -0
- package/dist/core/TextElement.d.ts +80 -0
- package/dist/core/TextMetrics.d.ts +117 -0
- package/dist/core/Transform.d.ts +158 -0
- package/dist/core/TransformConverter.d.ts +16 -0
- package/dist/core/TransformHandles.d.ts +55 -0
- package/dist/core/artboardReducer.d.ts +46 -0
- package/dist/effects/DistressGenerator.d.ts +26 -0
- package/dist/effects/DistressTextureCache.d.ts +49 -0
- package/dist/effects/distress-presets.d.ts +86 -0
- package/dist/effects/distress-textures.d.ts +34 -0
- package/dist/effects/distress-utils.d.ts +39 -0
- package/dist/effects/mask-presets.d.ts +36 -0
- package/dist/fonts/google-fonts.d.ts +48 -0
- package/dist/google-fonts.json +1 -0
- package/dist/hooks/index.d.ts +42 -0
- package/dist/hooks/useArtboards.d.ts +71 -0
- package/dist/hooks/useAutoExport.d.ts +66 -0
- package/dist/hooks/useBreakpoint.d.ts +53 -0
- package/dist/hooks/useCanvasEvents.d.ts +8 -0
- package/dist/hooks/useCanvasReady.d.ts +22 -0
- package/dist/hooks/useClickOutside.d.ts +3 -0
- package/dist/hooks/useCommandHistory.d.ts +39 -0
- package/dist/hooks/useCommands.d.ts +47 -0
- package/dist/hooks/useContentReady.d.ts +18 -0
- package/dist/hooks/useElementById.d.ts +20 -0
- package/dist/hooks/useElementByName.d.ts +10 -0
- package/dist/hooks/useElementProperties.d.ts +29 -0
- package/dist/hooks/useExport.d.ts +89 -0
- package/dist/hooks/useImageBinding.d.ts +34 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +13 -0
- package/dist/hooks/useLayerDndKit.d.ts +24 -0
- package/dist/hooks/useLayerDragDrop.d.ts +58 -0
- package/dist/hooks/useLayerPreview.d.ts +31 -0
- package/dist/hooks/useLayerSelection.d.ts +76 -0
- package/dist/hooks/useLayers.d.ts +91 -0
- package/dist/hooks/usePerformance.d.ts +48 -0
- package/dist/hooks/useProjectLoader.d.ts +64 -0
- package/dist/hooks/useSelectedElement.d.ts +17 -0
- package/dist/hooks/useTextBinding.d.ts +26 -0
- package/dist/hooks/useTextToolbar.d.ts +61 -0
- package/dist/hooks/useViewport.d.ts +46 -0
- package/dist/icons/icon-data.d.ts +2 -0
- package/dist/icons/registry.d.ts +28 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1138 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internals.d.ts +2 -0
- package/dist/internals.js +2 -0
- package/dist/internals.js.map +1 -0
- package/dist/internals.mjs +219 -0
- package/dist/internals.mjs.map +1 -0
- package/dist/kits/compose.d.ts +69 -0
- package/dist/kits/index.d.ts +21 -0
- package/dist/kits/presets.d.ts +40 -0
- package/dist/kits/registry.d.ts +33 -0
- package/dist/kits/sections.d.ts +119 -0
- package/dist/kits/serialization.d.ts +78 -0
- package/dist/kits/types.d.ts +129 -0
- package/dist/kits/validation.d.ts +36 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/plugins/ElementTypePlugin.d.ts +90 -0
- package/dist/presets/artboard-color-presets.d.ts +22 -0
- package/dist/presets/tshirt-presets.d.ts +60 -0
- package/dist/rendering/CompositingRenderer.d.ts +33 -0
- package/dist/rendering/DistressTextureRenderer.d.ts +39 -0
- package/dist/rendering/ElementRenderUtils.d.ts +17 -0
- package/dist/rendering/MaskRenderer.d.ts +41 -0
- package/dist/rendering/PieceGuideRenderer.d.ts +177 -0
- package/dist/rendering/StrokeRenderer.d.ts +24 -0
- package/dist/rendering/canvas-renderer.d.ts +18 -0
- package/dist/rendering/element-serializer.d.ts +143 -0
- package/dist/rendering/image-renderer.d.ts +6 -0
- package/dist/rendering/knockout-utils.d.ts +48 -0
- package/dist/rendering/mask-utils.d.ts +65 -0
- package/dist/rendering/renderer-types.d.ts +79 -0
- package/dist/rendering/rich-text-renderer.d.ts +43 -0
- package/dist/rendering/serialize-for-server.d.ts +45 -0
- package/dist/rendering/shape-renderer.d.ts +6 -0
- package/dist/rendering/stroke-utils.d.ts +18 -0
- package/dist/rendering/text-renderer.d.ts +71 -0
- package/dist/rendering/transform-renderer.d.ts +33 -0
- package/dist/services/AutoExportManager.d.ts +107 -0
- package/dist/services/falApi.d.ts +63 -0
- package/dist/services/nounProjectApi.d.ts +90 -0
- package/dist/services/recraftApi.d.ts +65 -0
- package/dist/services/runwareApi.d.ts +69 -0
- package/dist/state/CanvasStateV1.d.ts +373 -0
- package/dist/state/index.d.ts +10 -0
- package/dist/style.css +1 -0
- package/dist/taco-reference-cropped.jpg +0 -0
- package/dist/testing/MockEditorProvider.d.ts +49 -0
- package/dist/testing/index.d.ts +25 -0
- package/dist/testing/utils.d.ts +128 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.mjs +140 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/textures/glass-frame.svg +32 -0
- package/dist/theme.d.ts +99 -0
- package/dist/themes/index.d.ts +23 -0
- package/dist/transforms/ArchTransform.d.ts +14 -0
- package/dist/transforms/AscendTransform.d.ts +14 -0
- package/dist/transforms/CircleTransform.d.ts +51 -0
- package/dist/transforms/CustomTransform.d.ts +81 -0
- package/dist/transforms/FlagTransform.d.ts +14 -0
- package/dist/transforms/LeanTransform.d.ts +14 -0
- package/dist/transforms/WaveTransform.d.ts +16 -0
- package/dist/transforms/defaults.d.ts +33 -0
- package/dist/transforms/index.d.ts +10 -0
- package/dist/transforms/registry.d.ts +51 -0
- package/dist/types/capabilities.d.ts +50 -0
- package/dist/types/guards.d.ts +31 -0
- package/dist/types/index.d.ts +765 -0
- package/dist/types/public.d.ts +31 -0
- package/dist/types/react.d.ts +132 -0
- package/dist/utils/ArtworkPlacement.d.ts +97 -0
- package/dist/utils/ElementPreviewRenderer.d.ts +19 -0
- package/dist/utils/ExportManager.d.ts +208 -0
- package/dist/utils/FontAnalyzer.d.ts +137 -0
- package/dist/utils/GlyphRenderer.d.ts +55 -0
- package/dist/utils/GoogleFontsService.d.ts +37 -0
- package/dist/utils/ImageLoader.d.ts +124 -0
- package/dist/utils/ImportManager.d.ts +72 -0
- package/dist/utils/MonotypeCategoryMapping.d.ts +36 -0
- package/dist/utils/MonotypeService.d.ts +148 -0
- package/dist/utils/PerformanceMonitor.d.ts +54 -0
- package/dist/utils/TextureManager.d.ts +60 -0
- package/dist/utils/UnifiedFontService.d.ts +117 -0
- package/dist/utils/WorkerExportManager.d.ts +185 -0
- package/dist/utils/clickProtection.d.ts +39 -0
- package/dist/utils/cn.d.ts +4 -0
- package/dist/utils/colorConversion.d.ts +101 -0
- package/dist/utils/documentColors.d.ts +108 -0
- package/dist/utils/featureApplied.d.ts +14 -0
- package/dist/utils/google-fonts-loader.d.ts +67 -0
- package/dist/utils/logger.d.ts +66 -0
- package/dist/utils/selectionPreservation.d.ts +42 -0
- package/dist/utils/textCursorUtils.d.ts +39 -0
- package/dist/utils/textUtils.d.ts +11 -0
- package/dist/workers/export-protocol.d.ts +119 -0
- package/dist/workers/export-worker.bundle.string.d.ts +2 -0
- package/dist/workers/export-worker.d.ts +5 -0
- package/package.json +201 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-0054: SVG-based visual-guide overlay.
|
|
3
|
+
*
|
|
4
|
+
* Duplicated intentionally between:
|
|
5
|
+
* - snowcone-loom/app/components/VisualGuideOverlay.tsx (Loom editor)
|
|
6
|
+
* - ui-components/packages/canvas/src/components/VisualGuideOverlay.tsx
|
|
7
|
+
* (this file — consumed by the Snowcone consumer editor via
|
|
8
|
+
* @snowcone-app/canvas)
|
|
9
|
+
* Loom doesn't depend on @snowcone-app/canvas. Keep these two files
|
|
10
|
+
* byte-identical below the header; if you change one, mirror the other.
|
|
11
|
+
*
|
|
12
|
+
* Renders structured piece guides (boundary, safe area, zones, labels) as
|
|
13
|
+
* stacked SVG layers on top of an artboard preview. The entire overlay
|
|
14
|
+
* lives inside a single `<svg viewBox="0 0 artboardWidth artboardHeight">`
|
|
15
|
+
* so piece-local coordinates compose directly and strokes can opt into
|
|
16
|
+
* `vector-effect="non-scaling-stroke"` to stay visually crisp at every
|
|
17
|
+
* viewport scale.
|
|
18
|
+
*
|
|
19
|
+
* Falls back cleanly when no guides are authored:
|
|
20
|
+
* - `boundary` → the piece's bounding rect (0,0 to pieceWidth, pieceHeight)
|
|
21
|
+
* - `safeArea` → an inset rect derived from `safeAreaInsetPx` when present,
|
|
22
|
+
* omitted otherwise
|
|
23
|
+
*/
|
|
24
|
+
export type SvgPath = {
|
|
25
|
+
kind: "rect";
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "roundedRect";
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
rx?: number;
|
|
37
|
+
ry?: number;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "path";
|
|
40
|
+
d: string;
|
|
41
|
+
};
|
|
42
|
+
export interface ZoneShape {
|
|
43
|
+
kind: "wrap" | "binding" | "dieCut" | "warning" | "custom";
|
|
44
|
+
label?: string;
|
|
45
|
+
path: SvgPath;
|
|
46
|
+
}
|
|
47
|
+
export interface GuideLabel {
|
|
48
|
+
text: string;
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
anchor?: "tl" | "tc" | "tr" | "cl" | "c" | "cr" | "bl" | "bc" | "br";
|
|
52
|
+
}
|
|
53
|
+
export interface PieceGuide {
|
|
54
|
+
boundary?: SvgPath;
|
|
55
|
+
safeArea?: SvgPath;
|
|
56
|
+
zones?: ZoneShape[];
|
|
57
|
+
labels?: GuideLabel[];
|
|
58
|
+
/**
|
|
59
|
+
* Corner radius of the piece's *physical outer shape* (e.g. a phone
|
|
60
|
+
* case's outer curve) in piece-local pixels. When set, the bleed
|
|
61
|
+
* ring's outer edge uses a rounded rectangle of `(pieceWidth,
|
|
62
|
+
* pieceHeight)` with this radius, and the entire piece render is
|
|
63
|
+
* clipped to that shape — so nothing bleeds into the sharp corners
|
|
64
|
+
* of the piece's bounding rect. Omit / 0 = sharp corners (current
|
|
65
|
+
* default behaviour).
|
|
66
|
+
*/
|
|
67
|
+
outerRadius?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface OverlayPiece {
|
|
70
|
+
/** Stable piece id (matches `placements[].name`). */
|
|
71
|
+
id: string;
|
|
72
|
+
/** Piece's top-left position on the artboard, in artboard pixel coords. */
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
/** Piece-local dimensions in px. */
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
/**
|
|
79
|
+
* Fallback safe-area inset when no authored `safeArea` is present. In
|
|
80
|
+
* piece-local pixels (caller converts from inches). Omit to skip the
|
|
81
|
+
* fallback safe area entirely.
|
|
82
|
+
*/
|
|
83
|
+
safeAreaInsetPx?: number;
|
|
84
|
+
/** Clockwise rotation in degrees about the piece center. Default 0. */
|
|
85
|
+
rotation?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface VisualGuideOverlayStyle {
|
|
88
|
+
bleedFill?: string;
|
|
89
|
+
bleedOpacity?: number;
|
|
90
|
+
boundaryStroke?: string;
|
|
91
|
+
boundaryStrokeWidth?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Safe-area wash: fills the region outside the safe area (inside the
|
|
94
|
+
* piece) with a semi-transparent color. Replaces the old dashed
|
|
95
|
+
* safe-area outline as the default — de-emphasizes the bleed margin so
|
|
96
|
+
* the safe area reads as the "clean" zone without adding line chrome.
|
|
97
|
+
*/
|
|
98
|
+
safeAreaWashFill?: string;
|
|
99
|
+
safeAreaWashOpacity?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Corner radius (in viewBox px) for the wash's outer edge so it hugs
|
|
102
|
+
* rounded products (phone cases, rounded cards, etc.) instead of
|
|
103
|
+
* boxing sharp corners. Pass `0` for hard corners. Omit to use an
|
|
104
|
+
* artboard-proportional default (~2% of the shorter axis).
|
|
105
|
+
*/
|
|
106
|
+
safeAreaWashCornerRadius?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Safe-area stroke settings — legacy dashed outline. Disabled by default
|
|
109
|
+
* (wash does the work). Set `safeAreaStroke` to any color to re-enable.
|
|
110
|
+
*/
|
|
111
|
+
safeAreaStroke?: string;
|
|
112
|
+
safeAreaStrokeWidth?: number;
|
|
113
|
+
safeAreaDashArray?: string;
|
|
114
|
+
zoneFill?: Partial<Record<ZoneShape["kind"], string>>;
|
|
115
|
+
zoneStroke?: Partial<Record<ZoneShape["kind"], string>>;
|
|
116
|
+
labelColor?: string;
|
|
117
|
+
labelFontSize?: number;
|
|
118
|
+
labelFontFamily?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface VisualGuideOverlayProps {
|
|
121
|
+
/** Artboard dimensions in px — defines the SVG viewBox. */
|
|
122
|
+
artboardWidth: number;
|
|
123
|
+
artboardHeight: number;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Do not use — leave at 0 (the default).
|
|
126
|
+
*
|
|
127
|
+
* This was intended to mirror SnowconeCanvas's `fixedMargin`, but
|
|
128
|
+
* `fixedMargin` is in CSS pixels (converted to world units via
|
|
129
|
+
* `worldMargin = fixedMargin / zoom` in useCanvasLayout.ts) while
|
|
130
|
+
* this prop treated the value as viewBox/world units. The two only
|
|
131
|
+
* match at zoom === 1, so passing a non-zero value silently drifted
|
|
132
|
+
* the overlay content by tens of pixels at typical editor zooms.
|
|
133
|
+
*
|
|
134
|
+
* Correct usage: keep the SVG viewBox equal to the artboard, and
|
|
135
|
+
* position the wrapping div with `inset: ${fixedMargin}px` so the
|
|
136
|
+
* overlay covers only the artboard region of the padded canvas.
|
|
137
|
+
*/
|
|
138
|
+
canvasPadding?: number;
|
|
139
|
+
/** Pieces to render guides for. */
|
|
140
|
+
pieces: OverlayPiece[];
|
|
141
|
+
/** Authored guides keyed by piece id. Pieces without a guide fall back. */
|
|
142
|
+
pieceGuides?: Record<string, PieceGuide>;
|
|
143
|
+
/** Per-layer visibility toggles. All default to true. */
|
|
144
|
+
show?: {
|
|
145
|
+
bleed?: boolean;
|
|
146
|
+
zones?: boolean;
|
|
147
|
+
boundary?: boolean;
|
|
148
|
+
safeArea?: boolean;
|
|
149
|
+
labels?: boolean;
|
|
150
|
+
};
|
|
151
|
+
/** Optional style overrides. */
|
|
152
|
+
style?: VisualGuideOverlayStyle;
|
|
153
|
+
/** `className` applied to the wrapping SVG element. */
|
|
154
|
+
className?: string;
|
|
155
|
+
}
|
|
156
|
+
export declare function VisualGuideOverlay({ artboardWidth, artboardHeight, canvasPadding, pieces, pieceGuides, show, style, className, }: VisualGuideOverlayProps): JSX.Element;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ArtboardTabsProps {
|
|
3
|
+
/**
|
|
4
|
+
* Tab orientation
|
|
5
|
+
*/
|
|
6
|
+
orientation?: 'horizontal' | 'vertical';
|
|
7
|
+
/**
|
|
8
|
+
* Show "Add Artboard" button
|
|
9
|
+
*/
|
|
10
|
+
showAddButton?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Show close buttons on tabs
|
|
13
|
+
*/
|
|
14
|
+
showCloseButtons?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum tab width (for horizontal tabs)
|
|
17
|
+
*/
|
|
18
|
+
maxTabWidth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Custom CSS styles
|
|
21
|
+
*/
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
/**
|
|
24
|
+
* Custom class name
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Callback when a new artboard is created
|
|
29
|
+
*/
|
|
30
|
+
onArtboardCreate?: (artboardId: string) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when an artboard is deleted
|
|
33
|
+
*/
|
|
34
|
+
onArtboardDelete?: (artboardId: string) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Standalone artboard tabs component
|
|
38
|
+
*
|
|
39
|
+
* @example Horizontal tabs
|
|
40
|
+
* ```tsx
|
|
41
|
+
* function EditorWithTabs() {
|
|
42
|
+
* return (
|
|
43
|
+
* <EditorProvider>
|
|
44
|
+
* <div style={{ height: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
45
|
+
* <ArtboardTabs
|
|
46
|
+
* orientation="horizontal"
|
|
47
|
+
* showAddButton={true}
|
|
48
|
+
* showCloseButtons={true}
|
|
49
|
+
* />
|
|
50
|
+
* <Canvas />
|
|
51
|
+
* </div>
|
|
52
|
+
* </EditorProvider>
|
|
53
|
+
* );
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example Vertical tabs
|
|
58
|
+
* ```tsx
|
|
59
|
+
* function EditorWithSideTabs() {
|
|
60
|
+
* return (
|
|
61
|
+
* <EditorProvider>
|
|
62
|
+
* <div style={{ display: 'flex' }}>
|
|
63
|
+
* <ArtboardTabs
|
|
64
|
+
* orientation="vertical"
|
|
65
|
+
* showAddButton={true}
|
|
66
|
+
* />
|
|
67
|
+
* <Canvas />
|
|
68
|
+
* </div>
|
|
69
|
+
* </EditorProvider>
|
|
70
|
+
* );
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare const ArtboardTabs: React.FC<ArtboardTabsProps>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CanvasProps {
|
|
3
|
+
/** CSS class name */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Inline styles */
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
/** Viewport width (container size) */
|
|
8
|
+
width?: number;
|
|
9
|
+
/** Viewport height (container size) */
|
|
10
|
+
height?: number;
|
|
11
|
+
/** Zoom level - if not provided, automatically fits artboard to container */
|
|
12
|
+
zoom?: number;
|
|
13
|
+
/** Padding percentage when auto-fitting (0-1, default 0.95 = 95% of container) */
|
|
14
|
+
fitPadding?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Enable interactive pan/zoom mode (infinite canvas)
|
|
17
|
+
* - Scroll wheel: zoom in/out
|
|
18
|
+
* - Space+drag or middle mouse: pan
|
|
19
|
+
*/
|
|
20
|
+
interactive?: boolean;
|
|
21
|
+
/** Border radius for artboard corners (in pixels) */
|
|
22
|
+
artboardBorderRadius?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Fixed screen-space margin in pixels (overrides fitPadding for positioning)
|
|
25
|
+
* When set, the artboard will have this exact margin regardless of zoom level.
|
|
26
|
+
* The fitPadding still controls the zoom calculation, but positioning uses this fixed margin.
|
|
27
|
+
*/
|
|
28
|
+
fixedMargin?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum HTML height in pixels. When the artboard (with vertical fixedMargin padding)
|
|
31
|
+
* would exceed this height, horizontal padding is increased to shrink the artboard
|
|
32
|
+
* until it fits within this constraint while still respecting vertical fixedMargin.
|
|
33
|
+
*/
|
|
34
|
+
maxHeight?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to show the rotation handle on canvas (defaults to true)
|
|
37
|
+
* Set to false for embedded mode where rotation is handled via toolbar panel
|
|
38
|
+
*/
|
|
39
|
+
showRotationHandle?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether keyboard shortcuts (copy/paste, delete, undo/redo, etc.) are enabled.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
enableShortcuts?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* ADR-0054 Phase 4: cutout shapes (artboard px) punched through the
|
|
47
|
+
* `<canvas>` as truly transparent holes. See SnowconeCanvasProps.
|
|
48
|
+
*/
|
|
49
|
+
canvasCutouts?: import('./SnowconeCanvas').CanvasCutoutShape[];
|
|
50
|
+
/**
|
|
51
|
+
* ADR-0054: piece-guide overlays drawn directly into the canvas
|
|
52
|
+
* render loop (boundary, safe-area wash, zones, die-cut, labels).
|
|
53
|
+
*/
|
|
54
|
+
pieceGuides?: import('./SnowconeCanvas').PieceGuidesConfig;
|
|
55
|
+
/**
|
|
56
|
+
* ADR-0060: viewport focus mode for multi-piece spread layouts. See
|
|
57
|
+
* `SnowconeCanvasProps.pieceFocus` for the full contract.
|
|
58
|
+
*/
|
|
59
|
+
pieceFocus?: 'spread' | {
|
|
60
|
+
pieceId: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Canvas component - renders CanvasEditor without UI chrome
|
|
65
|
+
* Exactly like App.tsx but as a reusable component
|
|
66
|
+
*
|
|
67
|
+
* Auto-fit behavior: If no zoom is provided, the canvas will automatically
|
|
68
|
+
* calculate the zoom level to fit the artboard within the container with padding.
|
|
69
|
+
*
|
|
70
|
+
* Interactive mode: Enables infinite canvas with pan/zoom controls.
|
|
71
|
+
*/
|
|
72
|
+
export declare const Canvas: React.FC<CanvasProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextElement } from '../../core/TextElement.js';
|
|
3
|
+
import { ImageElement } from '../../core/ImageElement.js';
|
|
4
|
+
import { GroupElement } from '../../core/GroupElement.js';
|
|
5
|
+
import { ShapeElement } from '../../core/ShapeElement.js';
|
|
6
|
+
import { PathElement } from '../../core/PathElement.js';
|
|
7
|
+
type EditorElement = TextElement | ImageElement | GroupElement | ShapeElement | PathElement;
|
|
8
|
+
export interface EffectsPanelProps {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the panel is open
|
|
11
|
+
*/
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when panel should close
|
|
15
|
+
*/
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Element to edit effects for
|
|
19
|
+
* If not provided, uses the selected element from context
|
|
20
|
+
*/
|
|
21
|
+
element?: EditorElement | null;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when element is updated
|
|
24
|
+
* If not provided, uses the command history from context
|
|
25
|
+
*/
|
|
26
|
+
onElementUpdate?: (element: EditorElement) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Custom CSS styles
|
|
29
|
+
*/
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
/**
|
|
32
|
+
* Custom class name
|
|
33
|
+
*/
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Standalone effects panel component
|
|
38
|
+
*
|
|
39
|
+
* @example Using with context (automatic)
|
|
40
|
+
* ```tsx
|
|
41
|
+
* function App() {
|
|
42
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
43
|
+
*
|
|
44
|
+
* return (
|
|
45
|
+
* <EditorProvider>
|
|
46
|
+
* <Canvas />
|
|
47
|
+
* <button onClick={() => setIsOpen(true)}>Edit Effects</button>
|
|
48
|
+
* <EffectsPanel
|
|
49
|
+
* isOpen={isOpen}
|
|
50
|
+
* onClose={() => setIsOpen(false)}
|
|
51
|
+
* />
|
|
52
|
+
* </EditorProvider>
|
|
53
|
+
* );
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example Using with custom element (manual)
|
|
58
|
+
* ```tsx
|
|
59
|
+
* function App() {
|
|
60
|
+
* const [element, setElement] = useState(myElement);
|
|
61
|
+
*
|
|
62
|
+
* return (
|
|
63
|
+
* <EditorProvider>
|
|
64
|
+
* <EffectsPanel
|
|
65
|
+
* isOpen={true}
|
|
66
|
+
* onClose={() => {}}
|
|
67
|
+
* element={element}
|
|
68
|
+
* onElementUpdate={setElement}
|
|
69
|
+
* />
|
|
70
|
+
* </EditorProvider>
|
|
71
|
+
* );
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const EffectsPanel: React.FC<EffectsPanelProps>;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
import { CanvasError } from '../../types/index.js';
|
|
3
|
+
export interface ErrorBoundaryProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Fallback UI to render when an error is caught. Can be a static ReactNode or a render function. */
|
|
6
|
+
fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
|
|
7
|
+
/**
|
|
8
|
+
* Render function for custom error UI.
|
|
9
|
+
* Takes the error and a reset function, returns a ReactNode.
|
|
10
|
+
* When both `fallback` and `renderError` are provided, `renderError` takes precedence.
|
|
11
|
+
*/
|
|
12
|
+
renderError?: (error: Error, reset: () => void) => ReactNode;
|
|
13
|
+
/** Callback fired when an error is caught. Receives the raw Error and React ErrorInfo. */
|
|
14
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
15
|
+
/** Callback fired when an error is caught, receiving a structured CanvasError. */
|
|
16
|
+
onCanvasError?: (error: CanvasError) => void;
|
|
17
|
+
}
|
|
18
|
+
interface ErrorBoundaryState {
|
|
19
|
+
hasError: boolean;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error boundary component for graceful error handling.
|
|
24
|
+
* Catches React rendering errors in the component tree and displays fallback UI.
|
|
25
|
+
* Supports both plain Error and structured CanvasError callbacks.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
28
|
+
constructor(props: ErrorBoundaryProps);
|
|
29
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
30
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
31
|
+
resetError: () => void;
|
|
32
|
+
render(): ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ExportPanelProps {
|
|
3
|
+
/**
|
|
4
|
+
* Show continuous export controls
|
|
5
|
+
*/
|
|
6
|
+
showContinuousExport?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Default export scale
|
|
9
|
+
*/
|
|
10
|
+
defaultScale?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Default export format
|
|
13
|
+
*/
|
|
14
|
+
defaultFormat?: 'png' | 'jpg';
|
|
15
|
+
/**
|
|
16
|
+
* Callback when export is complete
|
|
17
|
+
*/
|
|
18
|
+
onExportComplete?: (exports: Record<string, string>) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Custom CSS styles
|
|
21
|
+
*/
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
/**
|
|
24
|
+
* Custom class name
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Standalone export panel component
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* function EditorWithExport() {
|
|
34
|
+
* return (
|
|
35
|
+
* <EditorProvider>
|
|
36
|
+
* <div style={{ display: 'flex' }}>
|
|
37
|
+
* <Canvas />
|
|
38
|
+
* <ExportPanel
|
|
39
|
+
* showContinuousExport={true}
|
|
40
|
+
* defaultScale={3}
|
|
41
|
+
* onExportComplete={(exports) => {
|
|
42
|
+
* console.log('Exports:', exports);
|
|
43
|
+
* }}
|
|
44
|
+
* />
|
|
45
|
+
* </div>
|
|
46
|
+
* </EditorProvider>
|
|
47
|
+
* );
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const ExportPanel: React.FC<ExportPanelProps>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextElement } from '../../core/TextElement.js';
|
|
3
|
+
export interface GlyphPanelProps {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the panel is open
|
|
6
|
+
*/
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when panel should close
|
|
10
|
+
*/
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Font family to browse glyphs for
|
|
14
|
+
* If not provided, uses the selected text element's font
|
|
15
|
+
*/
|
|
16
|
+
fontFamily?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Font weight to browse glyphs for
|
|
19
|
+
* If not provided, uses the selected text element's weight
|
|
20
|
+
*/
|
|
21
|
+
fontWeight?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Custom glyph insertion handler
|
|
24
|
+
* If not provided, uses the default handler that updates the selected element
|
|
25
|
+
*/
|
|
26
|
+
onInsertGlyph?: (unicode: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Text element to insert glyphs into
|
|
29
|
+
* If not provided, uses the selected element from context
|
|
30
|
+
*/
|
|
31
|
+
element?: TextElement | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Standalone glyph browser panel component
|
|
35
|
+
*
|
|
36
|
+
* @example Using with context (automatic)
|
|
37
|
+
* ```tsx
|
|
38
|
+
* function App() {
|
|
39
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
40
|
+
*
|
|
41
|
+
* return (
|
|
42
|
+
* <EditorProvider>
|
|
43
|
+
* <Canvas />
|
|
44
|
+
* <button onClick={() => setIsOpen(true)}>Browse Glyphs</button>
|
|
45
|
+
* <GlyphPanel
|
|
46
|
+
* isOpen={isOpen}
|
|
47
|
+
* onClose={() => setIsOpen(false)}
|
|
48
|
+
* />
|
|
49
|
+
* </EditorProvider>
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Using with custom font
|
|
55
|
+
* ```tsx
|
|
56
|
+
* function App() {
|
|
57
|
+
* return (
|
|
58
|
+
* <EditorProvider>
|
|
59
|
+
* <GlyphPanel
|
|
60
|
+
* isOpen={true}
|
|
61
|
+
* onClose={() => {}}
|
|
62
|
+
* fontFamily="Playfair Display"
|
|
63
|
+
* fontWeight={700}
|
|
64
|
+
* />
|
|
65
|
+
* </EditorProvider>
|
|
66
|
+
* );
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare const GlyphPanel: React.FC<GlyphPanelProps>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ImageElement } from '../../core/ImageElement.js';
|
|
3
|
+
export interface ImagePanelProps {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the panel is open
|
|
6
|
+
*/
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when panel open state changes
|
|
10
|
+
*/
|
|
11
|
+
onOpenChange: (open: boolean) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Callback after image is selected and element is created/updated
|
|
14
|
+
*/
|
|
15
|
+
onImageAdded?: (element: ImageElement) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Callback after existing image is changed
|
|
18
|
+
*/
|
|
19
|
+
onImageChanged?: (element: ImageElement) => void;
|
|
20
|
+
/**
|
|
21
|
+
* ID of element to change image for (if changing existing image)
|
|
22
|
+
* If not provided, a new image element will be created
|
|
23
|
+
*/
|
|
24
|
+
changingElementId?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Callback when changing element ID changes
|
|
27
|
+
*/
|
|
28
|
+
onChangingElementIdChange?: (id: string | null) => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Standalone image browser panel component
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* function EditorWithImageBrowser() {
|
|
36
|
+
* const [isImagePanelOpen, setIsImagePanelOpen] = useState(false);
|
|
37
|
+
* const [changingImageId, setChangingImageId] = useState(null);
|
|
38
|
+
*
|
|
39
|
+
* return (
|
|
40
|
+
* <EditorProvider>
|
|
41
|
+
* <div style={{ display: 'flex' }}>
|
|
42
|
+
* <Canvas />
|
|
43
|
+
* <button onClick={() => setIsImagePanelOpen(true)}>
|
|
44
|
+
* Add Image
|
|
45
|
+
* </button>
|
|
46
|
+
* <ImagePanel
|
|
47
|
+
* isOpen={isImagePanelOpen}
|
|
48
|
+
* onOpenChange={setIsImagePanelOpen}
|
|
49
|
+
* changingElementId={changingImageId}
|
|
50
|
+
* onChangingElementIdChange={setChangingImageId}
|
|
51
|
+
* />
|
|
52
|
+
* </div>
|
|
53
|
+
* </EditorProvider>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare const ImagePanel: React.FC<ImagePanelProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UseLayersOptions } from '../../hooks/useLayers.js';
|
|
3
|
+
export interface LayersPanelProps extends UseLayersOptions {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
showPreviewImages?: boolean;
|
|
7
|
+
enableDragReorder?: boolean;
|
|
8
|
+
enableGrouping?: boolean;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
showHeader?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const LayersPanel: React.FC<LayersPanelProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface CanvasSkeletonProps {
|
|
3
|
+
width?: number | string;
|
|
4
|
+
height?: number | string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
export interface LayersPanelSkeletonProps {
|
|
8
|
+
itemCount?: number;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export interface ToolbarSkeletonProps {
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Canvas loading skeleton
|
|
16
|
+
*/
|
|
17
|
+
export declare function CanvasSkeleton({ width, height, style }: CanvasSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Layers panel loading skeleton
|
|
20
|
+
*/
|
|
21
|
+
export declare function LayersPanelSkeleton({ itemCount, style }: LayersPanelSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Toolbar loading skeleton
|
|
24
|
+
*/
|
|
25
|
+
export declare function ToolbarSkeleton({ style }: ToolbarSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Generic loading spinner
|
|
28
|
+
*/
|
|
29
|
+
export declare function Spinner({ size, color }: {
|
|
30
|
+
size?: number;
|
|
31
|
+
color?: string;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface MenuButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the layers panel is open
|
|
5
|
+
*/
|
|
6
|
+
isLayersPanelOpen?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Callback when layers panel toggle is requested
|
|
9
|
+
*/
|
|
10
|
+
onToggleLayersPanel?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when image browser should be opened
|
|
13
|
+
* If provided, this will be called when user selects "Add Image" instead of using the default handler
|
|
14
|
+
*/
|
|
15
|
+
onOpenImageBrowser?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Additional menu items to append
|
|
18
|
+
*/
|
|
19
|
+
additionalItems?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Custom button icon
|
|
22
|
+
*/
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Button tooltip
|
|
26
|
+
*/
|
|
27
|
+
tooltip?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Additional CSS class name
|
|
30
|
+
*/
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* MenuButton - Unified menu for save/open/export/layers
|
|
35
|
+
* Must be used within EditorProvider
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <EditorProvider>
|
|
40
|
+
* <MenuButton
|
|
41
|
+
* isLayersPanelOpen={layersOpen}
|
|
42
|
+
* onToggleLayersPanel={() => setLayersOpen(!layersOpen)}
|
|
43
|
+
* />
|
|
44
|
+
* </EditorProvider>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const MenuButton: React.FC<MenuButtonProps>;
|