@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
package/dist/testing.mjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u } from "react";
|
|
3
|
+
import { T as s, E as m } from "./ThemeContext-H0Z-MqqR.js";
|
|
4
|
+
import { ad as d, i as h, f as g, I as A } from "./HybridHistoryManager-BV6XV0nD.js";
|
|
5
|
+
const x = ({
|
|
6
|
+
children: t,
|
|
7
|
+
initialElements: e = [],
|
|
8
|
+
initialArtboards: n,
|
|
9
|
+
initialSelection: r = null,
|
|
10
|
+
initialMultiSelection: i = [],
|
|
11
|
+
initialArtboardConfig: l = {}
|
|
12
|
+
}) => {
|
|
13
|
+
const [f] = u(() => {
|
|
14
|
+
const c = new d();
|
|
15
|
+
return n && n.length > 0 ? n.forEach((o) => {
|
|
16
|
+
c.createArtboard({
|
|
17
|
+
name: o.name,
|
|
18
|
+
width: o.width,
|
|
19
|
+
height: o.height,
|
|
20
|
+
backgroundColor: o.backgroundColor
|
|
21
|
+
});
|
|
22
|
+
}) : c.createArtboard({
|
|
23
|
+
name: "Test Artboard",
|
|
24
|
+
width: 1200,
|
|
25
|
+
height: 1200,
|
|
26
|
+
backgroundColor: "#FFFFFF",
|
|
27
|
+
...l
|
|
28
|
+
}), c;
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(
|
|
31
|
+
m,
|
|
32
|
+
{
|
|
33
|
+
initialArtboardConfig: l,
|
|
34
|
+
children: t
|
|
35
|
+
}
|
|
36
|
+
) });
|
|
37
|
+
}, M = ({
|
|
38
|
+
children: t,
|
|
39
|
+
initialElements: e = [],
|
|
40
|
+
initialSelection: n = null,
|
|
41
|
+
initialMultiSelection: r = [],
|
|
42
|
+
initialArtboardConfig: i = {}
|
|
43
|
+
}) => /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(m, { initialArtboardConfig: i, children: t }) });
|
|
44
|
+
function S(t = "custom", e = {}) {
|
|
45
|
+
const n = g(t);
|
|
46
|
+
if (!n || !n.Component)
|
|
47
|
+
throw new Error(`Transform type "${t}" not found in registry`);
|
|
48
|
+
return new n.Component({
|
|
49
|
+
transformType: t,
|
|
50
|
+
text: "Test Text",
|
|
51
|
+
fontSize: 32,
|
|
52
|
+
color: "#000000",
|
|
53
|
+
fontFamily: "Arial",
|
|
54
|
+
x: 100,
|
|
55
|
+
y: 100,
|
|
56
|
+
rotation: 0,
|
|
57
|
+
...e
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- test utility: overrides merge Partial<TextElement> properties with config, which are structurally compatible but not type-assignable
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function k(t = {}) {
|
|
62
|
+
return new A({
|
|
63
|
+
imageUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
|
|
64
|
+
imageAspectRatio: 1,
|
|
65
|
+
x: 100,
|
|
66
|
+
y: 100,
|
|
67
|
+
rotation: 0,
|
|
68
|
+
...t
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function p(t = {}) {
|
|
72
|
+
return new h({
|
|
73
|
+
name: "Test Artboard",
|
|
74
|
+
width: 1200,
|
|
75
|
+
height: 1200,
|
|
76
|
+
x: 0,
|
|
77
|
+
y: 0,
|
|
78
|
+
backgroundColor: "#FFFFFF",
|
|
79
|
+
...t
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async function w(t, e = 5e3, n = 100) {
|
|
83
|
+
const r = Date.now();
|
|
84
|
+
for (; !t(); ) {
|
|
85
|
+
if (Date.now() - r > e)
|
|
86
|
+
throw new Error(`Timeout waiting for condition after ${e}ms`);
|
|
87
|
+
await new Promise((i) => setTimeout(i, n));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function v(t, e = 5e3) {
|
|
91
|
+
let n = null;
|
|
92
|
+
return await w(() => !1, e), n;
|
|
93
|
+
}
|
|
94
|
+
function T(t, e = {}) {
|
|
95
|
+
const n = new KeyboardEvent("keydown", {
|
|
96
|
+
key: t,
|
|
97
|
+
ctrlKey: e.ctrl,
|
|
98
|
+
shiftKey: e.shift,
|
|
99
|
+
altKey: e.alt,
|
|
100
|
+
metaKey: e.meta,
|
|
101
|
+
bubbles: !0,
|
|
102
|
+
cancelable: !0
|
|
103
|
+
});
|
|
104
|
+
document.dispatchEvent(n);
|
|
105
|
+
}
|
|
106
|
+
function _(t = 800, e = 600) {
|
|
107
|
+
const n = document.createElement("canvas");
|
|
108
|
+
return n.width = t, n.height = e, n;
|
|
109
|
+
}
|
|
110
|
+
function B(t, e) {
|
|
111
|
+
Object.entries(e).forEach(([n, r]) => {
|
|
112
|
+
if (t[n] !== r)
|
|
113
|
+
throw new Error(
|
|
114
|
+
`Expected element.${n} to be ${r}, got ${t[n]}`
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function C(t) {
|
|
119
|
+
const e = t.getBoundingBox();
|
|
120
|
+
return {
|
|
121
|
+
x: e.x,
|
|
122
|
+
y: e.y,
|
|
123
|
+
width: e.width,
|
|
124
|
+
height: e.height
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
x as MockEditorProvider,
|
|
129
|
+
M as MockEditorProviderWithState,
|
|
130
|
+
B as assertElementProperties,
|
|
131
|
+
p as createMockArtboard,
|
|
132
|
+
_ as createMockCanvas,
|
|
133
|
+
S as createMockElement,
|
|
134
|
+
k as createMockImageElement,
|
|
135
|
+
C as getElementBounds,
|
|
136
|
+
T as simulateKeyPress,
|
|
137
|
+
w as waitFor,
|
|
138
|
+
v as waitForExport
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../src/testing/MockEditorProvider.tsx","../src/testing/utils.ts"],"sourcesContent":["/**\n * MockEditorProvider - Lightweight mock for testing custom components\n * Compatible with Vitest (does not require Jest)\n *\n * @example\n * ```tsx\n * import { render } from '@testing-library/react';\n * import { MockEditorProvider } from '@snowcone-app/canvas/embed';\n *\n * test('my component renders', () => {\n * render(\n * <MockEditorProvider>\n * <MyCustomComponent />\n * </MockEditorProvider>\n * );\n * });\n * ```\n */\n\nimport React, { useState, ReactNode } from 'react';\nimport { EditorProvider } from '../contexts/EditorContext.js';\nimport { ThemeProvider } from '../contexts/ThemeContext.js';\nimport { ArtboardManager } from '../core/ArtboardManager.js';\nimport { ArtboardElement } from '../core/ArtboardElement.js';\nimport type { TextElement } from '../core/TextElement.js';\nimport type { ImageElement } from '../core/ImageElement.js';\nimport type { GroupElement } from '../core/GroupElement.js';\nimport type { ShapeElement } from '../core/ShapeElement.js';\n\nexport type MockEditorElement = TextElement | ImageElement | GroupElement | ShapeElement;\n\nexport interface MockEditorProviderProps {\n children: ReactNode;\n\n /**\n * Initial elements to populate the editor\n */\n initialElements?: MockEditorElement[];\n\n /**\n * Initial artboards (default: one artboard)\n */\n initialArtboards?: ArtboardElement[];\n\n /**\n * Initial selection\n */\n initialSelection?: string | null;\n\n /**\n * Initial multi-selection\n */\n initialMultiSelection?: string[];\n\n /**\n * Initial artboard configuration\n */\n initialArtboardConfig?: {\n name?: string;\n width?: number;\n height?: number;\n backgroundColor?: string;\n };\n}\n\n/**\n * MockEditorProvider - Wraps EditorProvider with test-friendly defaults\n *\n * This is a lightweight wrapper that provides the same EditorContext\n * as the real app, making it perfect for testing custom components.\n */\nexport const MockEditorProvider: React.FC<MockEditorProviderProps> = ({\n children,\n initialElements: _initialElements = [],\n initialArtboards,\n initialSelection: _initialSelection = null,\n initialMultiSelection: _initialMultiSelection = [],\n initialArtboardConfig = {},\n}) => {\n // Create artboard manager if artboards provided\n const [_artboardManager] = useState(() => {\n const manager = new ArtboardManager();\n\n if (initialArtboards && initialArtboards.length > 0) {\n // Use provided artboards\n initialArtboards.forEach(artboard => {\n manager.createArtboard({\n name: artboard.name,\n width: artboard.width,\n height: artboard.height,\n backgroundColor: artboard.backgroundColor,\n });\n });\n } else {\n // Create default artboard\n manager.createArtboard({\n name: 'Test Artboard',\n width: 1200,\n height: 1200,\n backgroundColor: '#FFFFFF',\n ...initialArtboardConfig,\n });\n }\n\n return manager;\n });\n\n // Simple wrapper that passes children through to real EditorProvider\n // The EditorProvider will handle all the state management\n // ThemeProvider is required because CanvasEditor uses useTheme()\n return (\n <ThemeProvider>\n <EditorProvider\n initialArtboardConfig={initialArtboardConfig}\n >\n {children}\n </EditorProvider>\n </ThemeProvider>\n );\n};\n\n/**\n * MockEditorProviderWithState - For tests that need to control state directly\n *\n * Use this when you need fine-grained control over the editor state.\n * Most tests should use the simpler MockEditorProvider above.\n */\nexport const MockEditorProviderWithState: React.FC<MockEditorProviderProps> = ({\n children,\n initialElements: _initialElements = [],\n initialSelection: _initialSelection = null,\n initialMultiSelection: _initialMultiSelection = [],\n initialArtboardConfig = {},\n}) => {\n return (\n <ThemeProvider>\n <EditorProvider initialArtboardConfig={initialArtboardConfig}>\n {children}\n </EditorProvider>\n </ThemeProvider>\n );\n};\n","/**\n * Testing Utilities - Helpers for creating mock elements and artboards\n * Compatible with Vitest\n */\n\nimport { TextElement } from '../core/TextElement.js';\nimport { ImageElement } from '../core/ImageElement.js';\nimport { ArtboardElement } from '../core/ArtboardElement.js';\nimport { getTransformById } from '../transforms/registry.js';\nimport type { TransformType, ImageElementConfig } from '../types/index.js';\n\n/**\n * Create a mock text element with sensible defaults\n *\n * @example\n * ```tsx\n * const element = createMockElement('custom', {\n * text: 'Hello World',\n * fontSize: 48,\n * fontColor: '#FF0000'\n * });\n * ```\n */\nexport function createMockElement(\n transformType: TransformType = 'custom',\n overrides: Partial<TextElement> = {}\n): TextElement {\n // Get the correct concrete class from registry\n const transformDef = getTransformById(transformType);\n if (!transformDef || !transformDef.Component) {\n throw new Error(`Transform type \"${transformType}\" not found in registry`);\n }\n\n // Create element using the concrete class\n const element = new transformDef.Component({\n transformType,\n text: 'Test Text',\n fontSize: 32,\n color: '#000000',\n fontFamily: 'Arial',\n x: 100,\n y: 100,\n rotation: 0,\n ...overrides,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- test utility: overrides merge Partial<TextElement> properties with config, which are structurally compatible but not type-assignable\n } as any);\n\n return element as TextElement;\n}\n\n/**\n * Create a mock image element\n *\n * @example\n * ```tsx\n * const image = createMockImageElement({\n * imageUrl: 'data:image/png;base64,...',\n * width: 200,\n * height: 200\n * });\n * ```\n */\nexport function createMockImageElement(\n overrides: Partial<ImageElementConfig> = {}\n): ImageElement {\n const element = new ImageElement({\n imageUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',\n imageAspectRatio: 1,\n x: 100,\n y: 100,\n rotation: 0,\n ...overrides,\n });\n\n return element;\n}\n\n/**\n * Create a mock artboard\n *\n * @example\n * ```tsx\n * const artboard = createMockArtboard({\n * name: 'Front',\n * width: 1200,\n * height: 1200,\n * backgroundColor: '#FFFFFF'\n * });\n * ```\n */\nexport function createMockArtboard(\n overrides: Partial<{\n name: string;\n width: number;\n height: number;\n x: number;\n y: number;\n backgroundColor: string;\n }> = {}\n): ArtboardElement {\n const artboard = new ArtboardElement({\n name: 'Test Artboard',\n width: 1200,\n height: 1200,\n x: 0,\n y: 0,\n backgroundColor: '#FFFFFF',\n ...overrides,\n });\n\n return artboard;\n}\n\n/**\n * Wait for a condition to become true\n * Useful for async testing\n *\n * @example\n * ```tsx\n * await waitFor(() => screen.getByText('Loaded'), 5000);\n * ```\n */\nexport async function waitFor(\n condition: () => boolean,\n timeout = 5000,\n interval = 100\n): Promise<void> {\n const startTime = Date.now();\n\n while (!condition()) {\n if (Date.now() - startTime > timeout) {\n throw new Error(`Timeout waiting for condition after ${timeout}ms`);\n }\n await new Promise(resolve => setTimeout(resolve, interval));\n }\n}\n\n/**\n * Wait for an export to complete\n * Polls until dataUrl is available\n *\n * @example\n * ```tsx\n * const dataUrl = await waitForExport('artboard-1', 5000);\n * expect(dataUrl).toContain('data:image/png');\n * ```\n */\nexport async function waitForExport(\n _artboardId: string,\n timeout = 5000\n): Promise<string | null> {\n let dataUrl: string | null = null;\n\n await waitFor(() => {\n // Check if export completed (this would need to be implemented based on your export state)\n // For now, just return false as a placeholder\n return false;\n }, timeout);\n\n return dataUrl;\n}\n\n/**\n * Simulate a keyboard event\n * Useful for testing keyboard shortcuts\n *\n * @example\n * ```tsx\n * simulateKeyPress('c', { meta: true }); // Cmd+C\n * ```\n */\nexport function simulateKeyPress(\n key: string,\n options: {\n ctrl?: boolean;\n shift?: boolean;\n alt?: boolean;\n meta?: boolean;\n } = {}\n): void {\n const event = new KeyboardEvent('keydown', {\n key,\n ctrlKey: options.ctrl,\n shiftKey: options.shift,\n altKey: options.alt,\n metaKey: options.meta,\n bubbles: true,\n cancelable: true,\n });\n\n document.dispatchEvent(event);\n}\n\n/**\n * Create a mock canvas element for testing\n * Returns an HTMLCanvasElement with mocked context\n *\n * @example\n * ```tsx\n * const canvas = createMockCanvas(800, 600);\n * const ctx = canvas.getContext('2d');\n * ```\n */\nexport function createMockCanvas(\n width = 800,\n height = 600\n): HTMLCanvasElement {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n return canvas;\n}\n\n/**\n * Assert that an element has certain properties\n * Useful for programmatic assertions\n *\n * @example\n * ```tsx\n * assertElementProperties(element, {\n * text: 'Hello',\n * fontSize: 48,\n * fontColor: '#FF0000'\n * });\n * ```\n */\nexport function assertElementProperties(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Test utility: accepts any element type and checks arbitrary properties\n element: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Test utility: expected values can be any type\n expected: Record<string, any>\n): void {\n Object.entries(expected).forEach(([key, value]) => {\n if (element[key] !== value) {\n throw new Error(\n `Expected element.${key} to be ${value}, got ${element[key]}`\n );\n }\n });\n}\n\n/**\n * Get element bounding box for testing\n * Returns computed bounds from the element\n *\n * @example\n * ```tsx\n * const bounds = getElementBounds(element);\n * expect(bounds.width).toBeGreaterThan(0);\n * ```\n */\nexport function getElementBounds(element: TextElement | ImageElement): {\n x: number;\n y: number;\n width: number;\n height: number;\n} {\n const bbox = element.getBoundingBox();\n\n return {\n x: bbox.x,\n y: bbox.y,\n width: bbox.width,\n height: bbox.height,\n };\n}\n"],"names":["MockEditorProvider","children","_initialElements","initialArtboards","_initialSelection","_initialMultiSelection","initialArtboardConfig","_artboardManager","useState","manager","ArtboardManager","artboard","ThemeProvider","jsx","EditorProvider","MockEditorProviderWithState","createMockElement","transformType","overrides","transformDef","getTransformById","createMockImageElement","ImageElement","createMockArtboard","ArtboardElement","waitFor","condition","timeout","interval","startTime","resolve","waitForExport","_artboardId","dataUrl","simulateKeyPress","key","options","event","createMockCanvas","width","height","canvas","assertElementProperties","element","expected","value","getElementBounds","bbox"],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<svg width="1200" height="800" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<!-- Diagonal shine gradient with more contrast -->
|
|
4
|
+
<linearGradient id="shine" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
5
|
+
<stop offset="0%" style="stop-color:rgba(255,255,255,1);stop-opacity:1" />
|
|
6
|
+
<stop offset="25%" style="stop-color:rgba(255,255,255,0.1);stop-opacity:1" />
|
|
7
|
+
<stop offset="100%" style="stop-color:rgba(255,255,255,0);stop-opacity:1" />
|
|
8
|
+
</linearGradient>
|
|
9
|
+
|
|
10
|
+
<!-- Top-left bright highlight with higher contrast -->
|
|
11
|
+
<radialGradient id="highlight" cx="15%" cy="15%">
|
|
12
|
+
<stop offset="0%" style="stop-color:rgba(255,255,255,1);stop-opacity:1" />
|
|
13
|
+
<stop offset="20%" style="stop-color:rgba(255,255,255,0.4);stop-opacity:1" />
|
|
14
|
+
<stop offset="60%" style="stop-color:rgba(255,255,255,0);stop-opacity:1" />
|
|
15
|
+
</radialGradient>
|
|
16
|
+
</defs>
|
|
17
|
+
|
|
18
|
+
<!-- Base glass layer - lighter overall -->
|
|
19
|
+
<rect width="1200" height="800" fill="rgba(255, 255, 255, 0.15)" rx="12"/>
|
|
20
|
+
|
|
21
|
+
<!-- Diagonal shine -->
|
|
22
|
+
<rect width="1200" height="800" fill="url(#shine)" rx="12"/>
|
|
23
|
+
|
|
24
|
+
<!-- Radial highlight for extra shine -->
|
|
25
|
+
<rect width="1200" height="800" fill="url(#highlight)" rx="12"/>
|
|
26
|
+
|
|
27
|
+
<!-- Sharp bright border for contrast -->
|
|
28
|
+
<rect x="0" y="0" width="1200" height="800" fill="none" stroke="rgba(255,255,255,1)" stroke-width="3" rx="12"/>
|
|
29
|
+
|
|
30
|
+
<!-- Inner subtle highlight edge -->
|
|
31
|
+
<rect x="3" y="3" width="1194" height="794" fill="none" stroke="rgba(255,255,255,0.3)" stroke-width="1" rx="10"/>
|
|
32
|
+
</svg>
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme constants for the application
|
|
3
|
+
* Centralized color palette and design tokens
|
|
4
|
+
*/
|
|
5
|
+
export declare const colors: {
|
|
6
|
+
readonly primary: string;
|
|
7
|
+
accent: {
|
|
8
|
+
blue: string;
|
|
9
|
+
purple: string;
|
|
10
|
+
orange: string;
|
|
11
|
+
};
|
|
12
|
+
background: string;
|
|
13
|
+
surface: string;
|
|
14
|
+
border: string;
|
|
15
|
+
text: {
|
|
16
|
+
primary: string;
|
|
17
|
+
secondary: string;
|
|
18
|
+
tertiary: string;
|
|
19
|
+
};
|
|
20
|
+
success: string;
|
|
21
|
+
warning: string;
|
|
22
|
+
error: string;
|
|
23
|
+
info: string;
|
|
24
|
+
readonly hover: string;
|
|
25
|
+
readonly active: string;
|
|
26
|
+
disabled: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const theme: {
|
|
29
|
+
colors: {
|
|
30
|
+
readonly primary: string;
|
|
31
|
+
accent: {
|
|
32
|
+
blue: string;
|
|
33
|
+
purple: string;
|
|
34
|
+
orange: string;
|
|
35
|
+
};
|
|
36
|
+
background: string;
|
|
37
|
+
surface: string;
|
|
38
|
+
border: string;
|
|
39
|
+
text: {
|
|
40
|
+
primary: string;
|
|
41
|
+
secondary: string;
|
|
42
|
+
tertiary: string;
|
|
43
|
+
};
|
|
44
|
+
success: string;
|
|
45
|
+
warning: string;
|
|
46
|
+
error: string;
|
|
47
|
+
info: string;
|
|
48
|
+
readonly hover: string;
|
|
49
|
+
readonly active: string;
|
|
50
|
+
disabled: string;
|
|
51
|
+
};
|
|
52
|
+
spacing: {
|
|
53
|
+
xs: number;
|
|
54
|
+
sm: number;
|
|
55
|
+
md: number;
|
|
56
|
+
lg: number;
|
|
57
|
+
xl: number;
|
|
58
|
+
xxl: number;
|
|
59
|
+
};
|
|
60
|
+
borderRadius: {
|
|
61
|
+
sm: number;
|
|
62
|
+
md: number;
|
|
63
|
+
lg: number;
|
|
64
|
+
full: number;
|
|
65
|
+
};
|
|
66
|
+
fontSize: {
|
|
67
|
+
xs: number;
|
|
68
|
+
sm: number;
|
|
69
|
+
base: number;
|
|
70
|
+
lg: number;
|
|
71
|
+
xl: number;
|
|
72
|
+
xxl: number;
|
|
73
|
+
};
|
|
74
|
+
zIndex: {
|
|
75
|
+
base: number;
|
|
76
|
+
dropdown: number;
|
|
77
|
+
modal: number;
|
|
78
|
+
tooltip: number;
|
|
79
|
+
editor: number;
|
|
80
|
+
};
|
|
81
|
+
canvas: {
|
|
82
|
+
readonly selectionColor: string;
|
|
83
|
+
readonly snapGuideColor: string;
|
|
84
|
+
readonly rotationHandleColor: string;
|
|
85
|
+
handleSize: number;
|
|
86
|
+
handleHoverSize: number;
|
|
87
|
+
snapThreshold: number;
|
|
88
|
+
snapGuideDash: number[];
|
|
89
|
+
snapGuideWidth: number;
|
|
90
|
+
selectionPadding: number;
|
|
91
|
+
spacingIndicatorColor: string;
|
|
92
|
+
spacingIndicatorWidth: number;
|
|
93
|
+
spacingDetectionThreshold: number;
|
|
94
|
+
spacingLabelFontSize: number;
|
|
95
|
+
spacingLabelFontFamily: string;
|
|
96
|
+
spacingLabelBackground: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export default theme;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { applyTheme, clearTheme } from '@snowcone-app/ui/themes';
|
|
2
|
+
/**
|
|
3
|
+
* Theme System
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from the shared theme system in @snowcone-app/ui.
|
|
6
|
+
* This module provides backward-compatible aliases for canvas-specific names.
|
|
7
|
+
*
|
|
8
|
+
* USAGE:
|
|
9
|
+
* ------
|
|
10
|
+
* 1. Use `baseThemes` for the theme picker dropdown (light themes only)
|
|
11
|
+
* 2. Use `getThemeVariant(theme, isDark)` to get the light/dark variant
|
|
12
|
+
* 3. Use `applyNextEcommerceTheme(theme)` to apply CSS variables (or `applyTheme`)
|
|
13
|
+
*
|
|
14
|
+
* SOURCE OF TRUTH: packages/ui-react/src/themes/
|
|
15
|
+
*/
|
|
16
|
+
export type { ThemeConfig, ThemePreset, FontPairing, FontWeights, RadiusSize, RadiusPresetId, RadiusConfig, } from '@snowcone-app/ui/themes';
|
|
17
|
+
export { RADIUS_PRESETS } from '@snowcone-app/ui/themes';
|
|
18
|
+
export { presetThemes, baseThemes, getThemeVariant, findTheme, getBaseThemeName, } from '@snowcone-app/ui/themes';
|
|
19
|
+
export { applyTheme, clearTheme, toThemeId, getCurrentThemeId } from '@snowcone-app/ui/themes';
|
|
20
|
+
export declare const applyNextEcommerceTheme: typeof applyTheme;
|
|
21
|
+
export declare const clearNextEcommerceTheme: typeof clearTheme;
|
|
22
|
+
export { ThemeProvider, useTheme, useThemeStandalone, type ThemeContextValue, type ThemeProviderProps, } from '@snowcone-app/ui/themes';
|
|
23
|
+
export { getThemeStyles, getThemeStylesCSS } from '@snowcone-app/ui/themes';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { ArchElementConfig, ArchTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class ArchTransform extends TextElement {
|
|
4
|
+
transformData: ArchTransformData;
|
|
5
|
+
constructor(config?: Partial<ArchElementConfig>);
|
|
6
|
+
getBoundingBox(): BoundingBox;
|
|
7
|
+
getVisualBoundingBox(): BoundingBox;
|
|
8
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
9
|
+
resize(anchor: ResizeAnchor, newWidth: number, _newHeight: number, startData: TransformStartData): void;
|
|
10
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
11
|
+
toJSON(): ArchElementConfig;
|
|
12
|
+
getTransformStartData(): TransformStartData;
|
|
13
|
+
}
|
|
14
|
+
export default ArchTransform;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { AscendElementConfig, AscendTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class AscendTransform extends TextElement {
|
|
4
|
+
transformData: AscendTransformData;
|
|
5
|
+
constructor(config?: Partial<AscendElementConfig>);
|
|
6
|
+
getBoundingBox(): BoundingBox;
|
|
7
|
+
getVisualBoundingBox(): BoundingBox;
|
|
8
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
9
|
+
resize(anchor: ResizeAnchor, newWidth: number, _newHeight: number, startData: TransformStartData): void;
|
|
10
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
11
|
+
toJSON(): AscendElementConfig;
|
|
12
|
+
getTransformStartData(): TransformStartData;
|
|
13
|
+
}
|
|
14
|
+
export default AscendTransform;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { CircleElementConfig, CircleTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class CircleTransform extends TextElement {
|
|
4
|
+
transformData: CircleTransformData;
|
|
5
|
+
constructor(config?: Partial<CircleElementConfig>);
|
|
6
|
+
/**
|
|
7
|
+
* Get bounding box in world coordinates
|
|
8
|
+
* For circle, this is center ± radius (diameter)
|
|
9
|
+
* This is used for transform math (resize, rotation)
|
|
10
|
+
*/
|
|
11
|
+
getBoundingBox(): BoundingBox;
|
|
12
|
+
/**
|
|
13
|
+
* Get visual bounding box (tight fit around actual text)
|
|
14
|
+
* For circular text, calculate the arc bounds where text actually appears
|
|
15
|
+
*/
|
|
16
|
+
getVisualBoundingBox(): BoundingBox;
|
|
17
|
+
/**
|
|
18
|
+
* Render the circular text
|
|
19
|
+
* Uses canvas arc path like SVG path in original
|
|
20
|
+
* Now uses shared rendering function
|
|
21
|
+
*/
|
|
22
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
23
|
+
/**
|
|
24
|
+
* Handle resize
|
|
25
|
+
* For circle, we maintain uniform scale and keep scale on the transform
|
|
26
|
+
*/
|
|
27
|
+
resize(anchor: ResizeAnchor, newWidth: number, newHeight: number, startData: TransformStartData): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get enabled anchors
|
|
30
|
+
* Circle supports only corner handles (uniform scale)
|
|
31
|
+
*/
|
|
32
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
33
|
+
/**
|
|
34
|
+
* Get effective font size (base fontSize * scale)
|
|
35
|
+
* This is what the user sees
|
|
36
|
+
*/
|
|
37
|
+
getEffectiveFontSize(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Set effective font size (adjusts base fontSize to achieve desired effective size)
|
|
40
|
+
*/
|
|
41
|
+
setEffectiveFontSize(targetSize: number): void;
|
|
42
|
+
/**
|
|
43
|
+
* Serialize with transform data
|
|
44
|
+
*/
|
|
45
|
+
toJSON(): CircleElementConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Get transform start data
|
|
48
|
+
*/
|
|
49
|
+
getTransformStartData(): TransformStartData;
|
|
50
|
+
}
|
|
51
|
+
export default CircleTransform;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { CustomElementConfig, CustomTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class CustomTransform extends TextElement {
|
|
4
|
+
transformData: CustomTransformData;
|
|
5
|
+
_lockedLineCount?: number;
|
|
6
|
+
constructor(config?: Partial<CustomElementConfig>);
|
|
7
|
+
/**
|
|
8
|
+
* Calculate height for rich text considering per-character fonts
|
|
9
|
+
* Returns the total height based on the tallest font in each line
|
|
10
|
+
*/
|
|
11
|
+
private calculateRichTextHeight;
|
|
12
|
+
/**
|
|
13
|
+
* Check if rich text has per-character formatting that differs from element defaults
|
|
14
|
+
*/
|
|
15
|
+
private hasPerCharacterFormatting;
|
|
16
|
+
/**
|
|
17
|
+
* Get bounding box in world coordinates
|
|
18
|
+
* For straight text with center-based positioning (x, y is the center)
|
|
19
|
+
* This should match the actual text bounds including wrapping
|
|
20
|
+
*/
|
|
21
|
+
getBoundingBox(): BoundingBox;
|
|
22
|
+
/**
|
|
23
|
+
* Get visual bounding box (container bounds for selection display)
|
|
24
|
+
* For CustomTransform, this shows the container width (transformData.width)
|
|
25
|
+
* and the actual height based on text wrapping
|
|
26
|
+
* (x, y) is the center of the element
|
|
27
|
+
*/
|
|
28
|
+
getVisualBoundingBox(): BoundingBox;
|
|
29
|
+
/**
|
|
30
|
+
* Get rotation anchor (center of the visual bounding box)
|
|
31
|
+
* CustomTransform rotates around the center of the actual text, including multi-line
|
|
32
|
+
*/
|
|
33
|
+
getRotationAnchor(): {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Render the straight text
|
|
39
|
+
* (x, y) is the center of the element, we rotate around this center point
|
|
40
|
+
* Now uses shared rendering function that works in both main thread and worker
|
|
41
|
+
*/
|
|
42
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
43
|
+
/**
|
|
44
|
+
* Render stroke+fill to an offscreen canvas at full opacity, then composite
|
|
45
|
+
* at the element's opacity. Prevents stroke inner half showing through fill.
|
|
46
|
+
*/
|
|
47
|
+
private renderWithOffscreen;
|
|
48
|
+
/**
|
|
49
|
+
* Override getTransformStartData to capture initial line count
|
|
50
|
+
*/
|
|
51
|
+
getTransformStartData(): TransformStartData;
|
|
52
|
+
/**
|
|
53
|
+
* Handle resize using standard resize logic
|
|
54
|
+
* Corner handles: uniform scale (fontSize and width both change) - line count locked
|
|
55
|
+
* Side handles: only width changes - text re-wraps naturally
|
|
56
|
+
*/
|
|
57
|
+
resize(anchor: ResizeAnchor, newWidth: number, newHeight: number, startData: TransformStartData): void;
|
|
58
|
+
/**
|
|
59
|
+
* Override setText - don't auto-adjust width
|
|
60
|
+
* Let text wrap naturally within the current container width
|
|
61
|
+
*/
|
|
62
|
+
setText(newText: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get enabled anchors
|
|
65
|
+
* Straight text supports all 8 handles
|
|
66
|
+
*/
|
|
67
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
68
|
+
/**
|
|
69
|
+
* Clone this element
|
|
70
|
+
* Override to preserve temporary _lockedLineCount during resize operations
|
|
71
|
+
* (but it still won't be saved in JSON exports)
|
|
72
|
+
*/
|
|
73
|
+
clone(): CustomTransform;
|
|
74
|
+
/**
|
|
75
|
+
* Serialize with transform data
|
|
76
|
+
* NOTE: _lockedLineCount is intentionally NOT serialized
|
|
77
|
+
* The lock is temporary during resize and should not persist after
|
|
78
|
+
*/
|
|
79
|
+
toJSON(): CustomElementConfig;
|
|
80
|
+
}
|
|
81
|
+
export default CustomTransform;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { FlagElementConfig, FlagTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class FlagTransform extends TextElement {
|
|
4
|
+
transformData: FlagTransformData;
|
|
5
|
+
constructor(config?: Partial<FlagElementConfig>);
|
|
6
|
+
getBoundingBox(): BoundingBox;
|
|
7
|
+
getVisualBoundingBox(): BoundingBox;
|
|
8
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
9
|
+
resize(anchor: ResizeAnchor, newWidth: number, _newHeight: number, startData: TransformStartData): void;
|
|
10
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
11
|
+
toJSON(): FlagElementConfig;
|
|
12
|
+
getTransformStartData(): TransformStartData;
|
|
13
|
+
}
|
|
14
|
+
export default FlagTransform;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { LeanElementConfig, LeanTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class LeanTransform extends TextElement {
|
|
4
|
+
transformData: LeanTransformData;
|
|
5
|
+
constructor(config?: Partial<LeanElementConfig>);
|
|
6
|
+
getBoundingBox(): BoundingBox;
|
|
7
|
+
getVisualBoundingBox(): BoundingBox;
|
|
8
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
9
|
+
resize(anchor: ResizeAnchor, newWidth: number, _newHeight: number, startData: TransformStartData): void;
|
|
10
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
11
|
+
toJSON(): LeanElementConfig;
|
|
12
|
+
getTransformStartData(): TransformStartData;
|
|
13
|
+
}
|
|
14
|
+
export default LeanTransform;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TextElement } from '../core/TextElement.js';
|
|
2
|
+
import { WaveElementConfig, WaveTransformData, BoundingBox, ResizeAnchor, TransformStartData } from '../types/index.js';
|
|
3
|
+
export declare class WaveTransform extends TextElement {
|
|
4
|
+
transformData: WaveTransformData;
|
|
5
|
+
constructor(config?: Partial<WaveElementConfig>);
|
|
6
|
+
getBoundingBox(): BoundingBox;
|
|
7
|
+
getVisualBoundingBox(): BoundingBox;
|
|
8
|
+
render(ctx: CanvasRenderingContext2D, _isSelected?: boolean, _isHovered?: boolean): void;
|
|
9
|
+
resize(anchor: ResizeAnchor, newWidth: number, newHeight: number, startData: TransformStartData): void;
|
|
10
|
+
getEnabledAnchors(): ResizeAnchor[];
|
|
11
|
+
/**
|
|
12
|
+
* Serialize with transform data
|
|
13
|
+
*/
|
|
14
|
+
toJSON(): WaveElementConfig;
|
|
15
|
+
}
|
|
16
|
+
export default WaveTransform;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform Default Values
|
|
3
|
+
* Single source of truth for all transform default parameters
|
|
4
|
+
*/
|
|
5
|
+
export declare const WAVE_DEFAULTS: {
|
|
6
|
+
readonly amplitude: 0.2;
|
|
7
|
+
readonly frequency: 1.2;
|
|
8
|
+
readonly width: 200;
|
|
9
|
+
};
|
|
10
|
+
export declare const FLAG_DEFAULTS: {
|
|
11
|
+
readonly amplitude: 0.2;
|
|
12
|
+
readonly frequency: 2;
|
|
13
|
+
readonly width: 200;
|
|
14
|
+
};
|
|
15
|
+
export declare const ARCH_DEFAULTS: {
|
|
16
|
+
readonly archHeight: 0.5;
|
|
17
|
+
readonly width: 200;
|
|
18
|
+
};
|
|
19
|
+
export declare const CIRCLE_DEFAULTS: {
|
|
20
|
+
readonly radius: 100;
|
|
21
|
+
readonly reverse: false;
|
|
22
|
+
};
|
|
23
|
+
export declare const LEAN_DEFAULTS: {
|
|
24
|
+
readonly leanAmount: 0;
|
|
25
|
+
readonly width: 200;
|
|
26
|
+
};
|
|
27
|
+
export declare const ASCEND_DEFAULTS: {
|
|
28
|
+
readonly ascendAngle: -15;
|
|
29
|
+
readonly width: 200;
|
|
30
|
+
};
|
|
31
|
+
export declare const CUSTOM_DEFAULTS: {
|
|
32
|
+
readonly width: 200;
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export all transform types
|
|
3
|
+
*/
|
|
4
|
+
export { CustomTransform } from './CustomTransform.js';
|
|
5
|
+
export { CircleTransform } from './CircleTransform.js';
|
|
6
|
+
export { ArchTransform } from './ArchTransform.js';
|
|
7
|
+
export { WaveTransform } from './WaveTransform.js';
|
|
8
|
+
export { FlagTransform } from './FlagTransform.js';
|
|
9
|
+
export { LeanTransform } from './LeanTransform.js';
|
|
10
|
+
export { AscendTransform } from './AscendTransform.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TransformType, TransformControl } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Transform control configurations
|
|
4
|
+
* Defines the sliders and their properties for each transform type
|
|
5
|
+
*/
|
|
6
|
+
export declare const TRANSFORM_CONTROLS: Partial<Record<TransformType, TransformControl[]>>;
|
|
7
|
+
/**
|
|
8
|
+
* Transform definition shape used in the registry
|
|
9
|
+
*/
|
|
10
|
+
export interface TransformDef {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
Component: new (config: any) => any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Transform type definitions (built-in)
|
|
17
|
+
* Combines metadata (id, label) with component class
|
|
18
|
+
*/
|
|
19
|
+
export declare const TRANSFORM_TYPES: TransformDef[];
|
|
20
|
+
/**
|
|
21
|
+
* Check if a transform type ID belongs to a built-in type
|
|
22
|
+
*/
|
|
23
|
+
export declare function isBuiltinTransformType(id: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Register a dynamic transform type at runtime.
|
|
26
|
+
* Throws if the id conflicts with a built-in type or is already registered.
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerTransform(id: string, def: TransformDef): void;
|
|
29
|
+
/**
|
|
30
|
+
* Unregister a dynamic transform type.
|
|
31
|
+
* Returns true if the type was removed, false if it was not found.
|
|
32
|
+
* Throws if attempting to unregister a built-in type.
|
|
33
|
+
*/
|
|
34
|
+
export declare function unregisterTransform(id: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get all registered transforms (built-in + dynamic)
|
|
37
|
+
*/
|
|
38
|
+
export declare function getAllTransforms(): TransformDef[];
|
|
39
|
+
/**
|
|
40
|
+
* Get transform definition by id (built-in or dynamic)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getTransformById(id: string): TransformDef | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Get transform controls by id
|
|
45
|
+
*/
|
|
46
|
+
export declare function getTransformControls(id: TransformType): TransformControl[];
|
|
47
|
+
/**
|
|
48
|
+
* Reset all dynamic transforms (for testing only)
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function _resetDynamicTransforms(): void;
|