@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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for fetching and managing all Google Fonts
|
|
3
|
+
*/
|
|
4
|
+
export interface GoogleFontMetadata {
|
|
5
|
+
family: string;
|
|
6
|
+
category: string;
|
|
7
|
+
subsets?: string[];
|
|
8
|
+
variants?: string[];
|
|
9
|
+
version?: string;
|
|
10
|
+
lastModified?: string;
|
|
11
|
+
popularity?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fetch all Google Fonts from metadata endpoint
|
|
15
|
+
* Results are cached after first fetch
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchAllGoogleFonts(): Promise<GoogleFontMetadata[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get all Google Fonts (uses cache if available)
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAllGoogleFonts(): GoogleFontMetadata[];
|
|
22
|
+
/**
|
|
23
|
+
* Check if fonts have been loaded
|
|
24
|
+
*/
|
|
25
|
+
export declare function isFontsLoaded(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Search Google Fonts by name
|
|
28
|
+
*/
|
|
29
|
+
export declare function searchGoogleFonts(query: string): GoogleFontMetadata[];
|
|
30
|
+
/**
|
|
31
|
+
* Filter Google Fonts by category
|
|
32
|
+
*/
|
|
33
|
+
export declare function filterGoogleFontsByCategory(category: string): GoogleFontMetadata[];
|
|
34
|
+
/**
|
|
35
|
+
* Map Google Fonts category to our internal categories
|
|
36
|
+
*/
|
|
37
|
+
export declare function mapGoogleCategory(googleCategory: string): string;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ImageElement } from '../core/ImageElement.js';
|
|
2
|
+
import { ImageElementConfig } from '../types/index.js';
|
|
3
|
+
import { Alignment, ScaleMode } from './ArtworkPlacement.js';
|
|
4
|
+
export interface ImageLoadResult {
|
|
5
|
+
success: boolean;
|
|
6
|
+
element?: HTMLImageElement;
|
|
7
|
+
error?: Error;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
aspectRatio?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ImageLoaderOptions {
|
|
13
|
+
/** Timeout in milliseconds (default: 30000 - 30 seconds) */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/** Number of retry attempts on failure (default: 1) */
|
|
16
|
+
retries?: number;
|
|
17
|
+
/** Retry delay in milliseconds (default: 1000) */
|
|
18
|
+
retryDelay?: number;
|
|
19
|
+
/** Whether to validate URL before loading (default: true) */
|
|
20
|
+
validateUrl?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type ImageLoadingState = 'idle' | 'loading' | 'success' | 'error';
|
|
23
|
+
/**
|
|
24
|
+
* Validate if a string is a valid URL
|
|
25
|
+
*/
|
|
26
|
+
export declare function isValidImageUrl(url: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Load an image from a URL
|
|
29
|
+
* Returns a promise that resolves with the loaded HTMLImageElement
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadImageFromURL(url: string, options?: ImageLoaderOptions): Promise<ImageLoadResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Preload multiple images in parallel
|
|
34
|
+
* Returns results for all images (some may fail)
|
|
35
|
+
*/
|
|
36
|
+
export declare function preloadImages(urls: string[], options?: ImageLoaderOptions): Promise<Map<string, ImageLoadResult>>;
|
|
37
|
+
/**
|
|
38
|
+
* Create an ImageElement from a URL with loading state handling
|
|
39
|
+
*/
|
|
40
|
+
export declare function createImageElement(url: string, config?: Partial<ImageElementConfig>, options?: ImageLoaderOptions): Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
element?: ImageElement;
|
|
43
|
+
error?: Error;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Configuration for artwork placement on artboard
|
|
47
|
+
*/
|
|
48
|
+
export interface ArtworkPlacementOptions {
|
|
49
|
+
/** Artboard dimensions */
|
|
50
|
+
artboard: {
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
/** Artboard position on canvas (for proper element positioning) */
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
};
|
|
57
|
+
/** Alignment string (e.g., 'center', 'top', 'bottom-left') */
|
|
58
|
+
alignment?: string | Alignment;
|
|
59
|
+
/** User scale multiplier (default: 1) */
|
|
60
|
+
scale?: number;
|
|
61
|
+
/** X offset in range -1 to 1 */
|
|
62
|
+
offsetX?: number;
|
|
63
|
+
/** Y offset in range -1 to 1 */
|
|
64
|
+
offsetY?: number;
|
|
65
|
+
/** Scale mode: "cover" fills area (may crop), "contain" fits inside (may have space). Default: "cover" */
|
|
66
|
+
scaleMode?: ScaleMode;
|
|
67
|
+
/** Top margin in pixels (reduces available area in contain mode) */
|
|
68
|
+
marginTop?: number;
|
|
69
|
+
/** Right margin in pixels (reduces available area in contain mode) */
|
|
70
|
+
marginRight?: number;
|
|
71
|
+
/** Bottom margin in pixels (reduces available area in contain mode) */
|
|
72
|
+
marginBottom?: number;
|
|
73
|
+
/** Left margin in pixels (reduces available area in contain mode) */
|
|
74
|
+
marginLeft?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Create an ImageElement with proper "cover" sizing and placement on artboard
|
|
78
|
+
*
|
|
79
|
+
* This uses CSS-like object-fit: cover logic to ensure the artwork completely
|
|
80
|
+
* fills the artboard while maintaining aspect ratio, with 9-point alignment support.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const result = await createImageElementWithPlacement(
|
|
84
|
+
* 'https://example.com/art.png',
|
|
85
|
+
* {
|
|
86
|
+
* artboard: { width: 1200, height: 1500, x: 250, y: 250 },
|
|
87
|
+
* alignment: 'center',
|
|
88
|
+
* scale: 1
|
|
89
|
+
* }
|
|
90
|
+
* );
|
|
91
|
+
*/
|
|
92
|
+
export declare function createImageElementWithPlacement(url: string, placementOptions: ArtworkPlacementOptions, config?: Partial<ImageElementConfig>, loaderOptions?: ImageLoaderOptions): Promise<{
|
|
93
|
+
success: boolean;
|
|
94
|
+
element?: ImageElement;
|
|
95
|
+
error?: Error;
|
|
96
|
+
placement?: {
|
|
97
|
+
artworkSize: {
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
};
|
|
101
|
+
finalSize: {
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
};
|
|
105
|
+
position: {
|
|
106
|
+
x: number;
|
|
107
|
+
y: number;
|
|
108
|
+
};
|
|
109
|
+
scale: number;
|
|
110
|
+
};
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Check if an image URL is accessible (HEAD request)
|
|
114
|
+
* More efficient than fully loading the image
|
|
115
|
+
*/
|
|
116
|
+
export declare function checkImageUrl(url: string): Promise<boolean>;
|
|
117
|
+
/**
|
|
118
|
+
* Get image dimensions without fully loading it (when possible)
|
|
119
|
+
* Falls back to full load if necessary
|
|
120
|
+
*/
|
|
121
|
+
export declare function getImageDimensions(url: string): Promise<{
|
|
122
|
+
width: number;
|
|
123
|
+
height: number;
|
|
124
|
+
} | null>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ArtboardElement } from '../core/ArtboardElement.js';
|
|
2
|
+
import { TextElement } from '../core/TextElement.js';
|
|
3
|
+
import { ImageElement } from '../core/ImageElement.js';
|
|
4
|
+
import { GroupElement } from '../core/GroupElement.js';
|
|
5
|
+
export interface ImportResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
artboards?: ArtboardElement[];
|
|
8
|
+
elements?: (TextElement | ImageElement | GroupElement)[];
|
|
9
|
+
activeArtboardId?: string | null;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ImageImportResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
dataUrl?: string;
|
|
15
|
+
filename?: string;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class ImportManager {
|
|
21
|
+
private static readonly SUPPORTED_VERSIONS;
|
|
22
|
+
/**
|
|
23
|
+
* Import workspace from JSON file
|
|
24
|
+
*/
|
|
25
|
+
static importFromJSON(file: File): Promise<ImportResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Migrate v1 document (no artboards) to v2 (with artboards)
|
|
28
|
+
*/
|
|
29
|
+
private static migrateV1Document;
|
|
30
|
+
/**
|
|
31
|
+
* Import image file
|
|
32
|
+
*/
|
|
33
|
+
static importImage(file: File): Promise<ImageImportResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Validate document structure
|
|
36
|
+
*/
|
|
37
|
+
private static validateDocument;
|
|
38
|
+
/**
|
|
39
|
+
* Read file as text
|
|
40
|
+
*/
|
|
41
|
+
private static readFileAsText;
|
|
42
|
+
/**
|
|
43
|
+
* Read file as data URL
|
|
44
|
+
*/
|
|
45
|
+
private static readFileAsDataURL;
|
|
46
|
+
/**
|
|
47
|
+
* Get image dimensions from data URL
|
|
48
|
+
*/
|
|
49
|
+
private static getImageDimensions;
|
|
50
|
+
/**
|
|
51
|
+
* Validate imported data before applying to state
|
|
52
|
+
*/
|
|
53
|
+
static validateImportedData(artboards: ArtboardElement[], elements: (TextElement | ImageElement | GroupElement)[]): {
|
|
54
|
+
valid: boolean;
|
|
55
|
+
errors: string[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Get import summary (for UI display before confirming)
|
|
59
|
+
*/
|
|
60
|
+
static getImportSummary(artboards: ArtboardElement[], elements: (TextElement | ImageElement | GroupElement)[]): {
|
|
61
|
+
artboardCount: number;
|
|
62
|
+
elementCount: number;
|
|
63
|
+
artboardNames: string[];
|
|
64
|
+
warnings: string[];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Preload all images in parallel for fast artboard switching
|
|
68
|
+
* Recursively finds all ImageElements (including those in groups)
|
|
69
|
+
*/
|
|
70
|
+
private static preloadAllImages;
|
|
71
|
+
}
|
|
72
|
+
export default ImportManager;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FontCategory } from '../fonts/google-fonts.js';
|
|
2
|
+
export interface CategoryRule {
|
|
3
|
+
canonical: FontCategory;
|
|
4
|
+
monotypeClassifications: string[];
|
|
5
|
+
googleCategory?: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
description: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Category mapping rules with priority order
|
|
12
|
+
* Most specific categories first, general categories last
|
|
13
|
+
*/
|
|
14
|
+
export declare const CATEGORY_MAPPINGS: CategoryRule[];
|
|
15
|
+
/**
|
|
16
|
+
* Map Monotype classifications to canonical category
|
|
17
|
+
* Uses priority order (most specific first)
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* - ["SERIF", "SLAB SERIF"] → 'slab-serif' (most specific wins)
|
|
21
|
+
* - ["SERIF", "OLD STYLE SERIF", "DISPLAY"] → 'display' (priority order)
|
|
22
|
+
* - ["SANS SERIF", "GEOMETRIC SANS"] → 'sans-serif'
|
|
23
|
+
*
|
|
24
|
+
* @param classifications - Array of Monotype classifications
|
|
25
|
+
* @returns Canonical category
|
|
26
|
+
*/
|
|
27
|
+
export declare function mapMonotypeClassifications(classifications: string[]): FontCategory;
|
|
28
|
+
/**
|
|
29
|
+
* Get category mapping by canonical name
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCategoryMapping(category: FontCategory): CategoryRule | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get all Monotype classifications for a canonical category
|
|
34
|
+
* Useful for API searches
|
|
35
|
+
*/
|
|
36
|
+
export declare function getMonotypeClassifications(category: FontCategory): string[];
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FontCategory, FontDefinition } from '../fonts/google-fonts.js';
|
|
2
|
+
export interface MonotypeFont {
|
|
3
|
+
fontId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
friendlyName: string;
|
|
6
|
+
family: string;
|
|
7
|
+
familyId: string;
|
|
8
|
+
foundry: string;
|
|
9
|
+
classification: string[];
|
|
10
|
+
tag: string[];
|
|
11
|
+
publicTags: string[];
|
|
12
|
+
weightCSS: number;
|
|
13
|
+
sample: string;
|
|
14
|
+
format?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MonotypeSearchParams {
|
|
17
|
+
name?: string;
|
|
18
|
+
family?: string;
|
|
19
|
+
classification?: string[];
|
|
20
|
+
foundry?: string;
|
|
21
|
+
tag?: string[];
|
|
22
|
+
searchSettings?: {
|
|
23
|
+
fuzzy?: string[];
|
|
24
|
+
partial?: string[];
|
|
25
|
+
exact?: string[];
|
|
26
|
+
};
|
|
27
|
+
pageSize?: number;
|
|
28
|
+
pageNumber?: number;
|
|
29
|
+
pageId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface MonotypeSearchResponse {
|
|
32
|
+
fonts: MonotypeFont[];
|
|
33
|
+
nextPageId?: string;
|
|
34
|
+
totalCount?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface WebFontKit {
|
|
37
|
+
fontFamily: string;
|
|
38
|
+
cssUrl: string;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
}
|
|
41
|
+
declare class MonotypeServiceClass {
|
|
42
|
+
private accessToken;
|
|
43
|
+
private tokenExpiry;
|
|
44
|
+
private fonts;
|
|
45
|
+
private fontsLoaded;
|
|
46
|
+
private webfontKits;
|
|
47
|
+
private searchCache;
|
|
48
|
+
private readonly API_BASE;
|
|
49
|
+
private readonly CACHE_TTL;
|
|
50
|
+
private monotypeEnabled;
|
|
51
|
+
constructor();
|
|
52
|
+
/**
|
|
53
|
+
* Check if Monotype credentials are configured
|
|
54
|
+
*/
|
|
55
|
+
private checkMonotypeEnabled;
|
|
56
|
+
/**
|
|
57
|
+
* Check if Monotype integration is enabled
|
|
58
|
+
*/
|
|
59
|
+
isMonotypeEnabled(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Authenticate with Monotype API using OAuth 2.0
|
|
62
|
+
* Token is cached and automatically refreshed when expired
|
|
63
|
+
* Returns silently if Monotype is not enabled
|
|
64
|
+
*/
|
|
65
|
+
authenticate(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Check if service is authenticated
|
|
68
|
+
*/
|
|
69
|
+
isAuthenticated(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Fetch all Monotype fonts with pagination and caching
|
|
72
|
+
* Strategy: Fetch fonts by category to get classification data
|
|
73
|
+
* Returns silently if Monotype is not enabled
|
|
74
|
+
*/
|
|
75
|
+
fetchAllFonts(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Get all Monotype fonts (uses cache if available)
|
|
78
|
+
*/
|
|
79
|
+
getAllFonts(): MonotypeFont[];
|
|
80
|
+
/**
|
|
81
|
+
* Check if fonts have been loaded
|
|
82
|
+
*/
|
|
83
|
+
isFontsLoaded(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Search Monotype fonts (returns raw API response)
|
|
86
|
+
* For internal use - external callers should use searchFonts()
|
|
87
|
+
*/
|
|
88
|
+
private searchFontsRaw;
|
|
89
|
+
/**
|
|
90
|
+
* Search Monotype fonts and return FontDefinitions
|
|
91
|
+
* Supports text search, fuzzy matching, and category filtering
|
|
92
|
+
*/
|
|
93
|
+
searchFonts(params: MonotypeSearchParams): Promise<FontDefinition[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Search fonts by name with fuzzy matching
|
|
96
|
+
*/
|
|
97
|
+
searchFontsByName(query: string): Promise<FontDefinition[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Filter fonts by category
|
|
100
|
+
*/
|
|
101
|
+
filterFontsByCategory(category: FontCategory): Promise<FontDefinition[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Group Monotype fonts by family
|
|
104
|
+
* Reduces 492 font variants to ~120 font families
|
|
105
|
+
*/
|
|
106
|
+
groupMonotypeFontsByFamily(fonts: MonotypeFont[]): FontDefinition[];
|
|
107
|
+
/**
|
|
108
|
+
* Extract font weights from variants
|
|
109
|
+
*/
|
|
110
|
+
private extractWeights;
|
|
111
|
+
/**
|
|
112
|
+
* Get or generate WebFont kit for a Monotype font
|
|
113
|
+
* Kit URLs are persistent and cached forever
|
|
114
|
+
*/
|
|
115
|
+
getWebFontKit(fontId: string, fontFamily: string): Promise<WebFontKit>;
|
|
116
|
+
/**
|
|
117
|
+
* Load Monotype font by injecting CSS link
|
|
118
|
+
*/
|
|
119
|
+
loadMonotypeFont(fontId: string, fontFamily: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Load caches from localStorage
|
|
122
|
+
*/
|
|
123
|
+
private loadCachesFromStorage;
|
|
124
|
+
/**
|
|
125
|
+
* Save caches to localStorage
|
|
126
|
+
*/
|
|
127
|
+
private saveCachesToStorage;
|
|
128
|
+
/**
|
|
129
|
+
* Clear all caches (including auth state)
|
|
130
|
+
*/
|
|
131
|
+
clearCaches(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Get service stats for debugging
|
|
134
|
+
*/
|
|
135
|
+
getStats(): {
|
|
136
|
+
monotypeEnabled: boolean;
|
|
137
|
+
authenticated: boolean;
|
|
138
|
+
hasAccessToken: boolean;
|
|
139
|
+
tokenExpiry: string | null;
|
|
140
|
+
fontsLoaded: boolean;
|
|
141
|
+
fontCount: number;
|
|
142
|
+
familyCount: number;
|
|
143
|
+
webfontKitCount: number;
|
|
144
|
+
searchCacheSize: number;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export declare const MonotypeService: MonotypeServiceClass;
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PerformanceMonitor - Dev-mode performance metrics for the canvas render loop.
|
|
3
|
+
*
|
|
4
|
+
* Singleton class that tracks frame times, element counts, cache hit rates,
|
|
5
|
+
* and export durations. Exposed on `window.__CANVAS_PERF__` in dev mode
|
|
6
|
+
* so developers can inspect real-time metrics from the browser console.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // Record a frame render time
|
|
11
|
+
* const start = performance.now();
|
|
12
|
+
* renderFrame();
|
|
13
|
+
* PerformanceMonitor.getInstance().recordFrameTime(performance.now() - start);
|
|
14
|
+
*
|
|
15
|
+
* // Read metrics from console in dev mode
|
|
16
|
+
* window.__CANVAS_PERF__.getMetrics();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface CanvasPerformanceMetrics {
|
|
20
|
+
/** Average frame render time in ms (rolling window of last 60 frames) */
|
|
21
|
+
frameTime: number;
|
|
22
|
+
/** Total frames rendered since last reset */
|
|
23
|
+
frameCount: number;
|
|
24
|
+
/** Current element count on the active artboard */
|
|
25
|
+
elementCount: number;
|
|
26
|
+
/** Bitmap cache hit rate as a ratio 0-1 */
|
|
27
|
+
cacheHitRate: number;
|
|
28
|
+
/** Duration of the last export operation in ms */
|
|
29
|
+
lastExportDuration: number;
|
|
30
|
+
}
|
|
31
|
+
export declare class PerformanceMonitor {
|
|
32
|
+
private static instance;
|
|
33
|
+
private metrics;
|
|
34
|
+
/** Rolling window of the last N frame times (ms) */
|
|
35
|
+
private frameTimes;
|
|
36
|
+
private constructor();
|
|
37
|
+
static getInstance(): PerformanceMonitor;
|
|
38
|
+
/**
|
|
39
|
+
* Record a single frame's render duration. Maintains a rolling window
|
|
40
|
+
* of the last 60 values and recomputes the average.
|
|
41
|
+
*/
|
|
42
|
+
recordFrameTime(ms: number): void;
|
|
43
|
+
/** Record the duration of an export operation. */
|
|
44
|
+
recordExportDuration(ms: number): void;
|
|
45
|
+
/** Update the current element count (call once per frame or on change). */
|
|
46
|
+
setElementCount(count: number): void;
|
|
47
|
+
/** Update the bitmap cache hit rate (0-1). */
|
|
48
|
+
setCacheHitRate(rate: number): void;
|
|
49
|
+
/** Return a readonly snapshot of the current metrics. */
|
|
50
|
+
getMetrics(): Readonly<CanvasPerformanceMetrics>;
|
|
51
|
+
/** Reset all metrics and the rolling window. */
|
|
52
|
+
reset(): void;
|
|
53
|
+
private _average;
|
|
54
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextureManager - Loads and caches background textures
|
|
3
|
+
* Provides texture loading for artboard backgrounds
|
|
4
|
+
*/
|
|
5
|
+
export interface TextureInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
url: string;
|
|
9
|
+
category?: string;
|
|
10
|
+
presetColor: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class TextureManager {
|
|
13
|
+
private static cache;
|
|
14
|
+
private static loading;
|
|
15
|
+
/**
|
|
16
|
+
* Available built-in textures
|
|
17
|
+
*/
|
|
18
|
+
static readonly TEXTURES: TextureInfo[];
|
|
19
|
+
/**
|
|
20
|
+
* Load a texture by ID or URL
|
|
21
|
+
*/
|
|
22
|
+
static loadTexture(idOrUrl: string): Promise<HTMLImageElement>;
|
|
23
|
+
/**
|
|
24
|
+
* Get a texture synchronously (returns null if not loaded)
|
|
25
|
+
*/
|
|
26
|
+
static getTexture(idOrUrl: string): HTMLImageElement | null;
|
|
27
|
+
/**
|
|
28
|
+
* Preload multiple textures
|
|
29
|
+
*/
|
|
30
|
+
static preloadTextures(idsOrUrls: string[]): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Preload all built-in textures
|
|
33
|
+
*/
|
|
34
|
+
static preloadAllTextures(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Clear cache
|
|
37
|
+
*/
|
|
38
|
+
static clearCache(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve texture URL from ID
|
|
41
|
+
*/
|
|
42
|
+
private static resolveTextureUrl;
|
|
43
|
+
/**
|
|
44
|
+
* Get texture info by ID
|
|
45
|
+
*/
|
|
46
|
+
static getTextureInfo(id: string): TextureInfo | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Get all available textures
|
|
49
|
+
*/
|
|
50
|
+
static getAllTextures(): TextureInfo[];
|
|
51
|
+
/**
|
|
52
|
+
* Get textures by category
|
|
53
|
+
*/
|
|
54
|
+
static getTexturesByCategory(category: string): TextureInfo[];
|
|
55
|
+
/**
|
|
56
|
+
* Get preset color for a texture
|
|
57
|
+
* Each texture has a fixed color that's part of its preset
|
|
58
|
+
*/
|
|
59
|
+
static getTexturePresetColor(textureId: string): string;
|
|
60
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { FontCategory, FontDefinition } from '../fonts/google-fonts.js';
|
|
2
|
+
declare class UnifiedFontServiceClass {
|
|
3
|
+
private searchCache;
|
|
4
|
+
private previewFontLinks;
|
|
5
|
+
/**
|
|
6
|
+
* Initialize both Google Fonts and Monotype
|
|
7
|
+
* Monotype is optional - app works with Google Fonts only if credentials not configured
|
|
8
|
+
*/
|
|
9
|
+
initialize(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if fonts are loaded
|
|
12
|
+
*/
|
|
13
|
+
isFontsLoaded(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Check if Monotype integration is enabled
|
|
16
|
+
*/
|
|
17
|
+
isMonotypeEnabled(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get all fonts from both sources
|
|
20
|
+
* Returns system fonts + Google Fonts + Monotype Fonts (deduplicated)
|
|
21
|
+
*/
|
|
22
|
+
getAllFonts(): FontDefinition[];
|
|
23
|
+
/**
|
|
24
|
+
* Get recommended fonts (TSHIRT_FONTS curated list)
|
|
25
|
+
*/
|
|
26
|
+
getRecommendedFonts(): FontDefinition[];
|
|
27
|
+
/**
|
|
28
|
+
* Search fonts by name (text search with fuzzy matching)
|
|
29
|
+
* Combines results from both Google Fonts and Monotype
|
|
30
|
+
*/
|
|
31
|
+
searchFontsByName(query: string): Promise<FontDefinition[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Filter fonts by category
|
|
34
|
+
* Combines results from both Google Fonts and Monotype
|
|
35
|
+
*/
|
|
36
|
+
filterFontsByCategory(category: FontCategory): Promise<FontDefinition[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Combined search: text search + category filter
|
|
39
|
+
* Option A: Search overrides category (simpler UX)
|
|
40
|
+
*/
|
|
41
|
+
searchAndFilterFonts(query: string, category: FontCategory | 'all'): Promise<FontDefinition[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Load a font (Google or Monotype). All exposed fonts are one or
|
|
44
|
+
* the other; the picker no longer offers true "system" fonts that
|
|
45
|
+
* aren't on Google Fonts because Android lacks them and we'd render
|
|
46
|
+
* inconsistently across platforms.
|
|
47
|
+
*/
|
|
48
|
+
loadFont(font: FontDefinition): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Load Google Font via CSS link injection (full font)
|
|
51
|
+
*/
|
|
52
|
+
private loadGoogleFont;
|
|
53
|
+
/**
|
|
54
|
+
* Load Google Font with only specific characters (for previews)
|
|
55
|
+
* Uses the text= parameter to load minimal glyphs (~99.9% smaller than full font)
|
|
56
|
+
* See: https://developers.google.com/fonts/docs/getting_started#optimizing_your_font_requests
|
|
57
|
+
*
|
|
58
|
+
* @param fontName - Font family name
|
|
59
|
+
* @param text - Text to render (only these characters will be loaded)
|
|
60
|
+
*/
|
|
61
|
+
loadGoogleFontForPreview(fontName: string, text: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Clear all preview font links from DOM
|
|
64
|
+
* Call this when closing the font browser to free memory
|
|
65
|
+
*/
|
|
66
|
+
clearPreviewFonts(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Get count of loaded preview fonts
|
|
69
|
+
*/
|
|
70
|
+
getPreviewFontCount(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Map Google Font metadata to FontDefinition
|
|
73
|
+
*/
|
|
74
|
+
private mapGoogleFont;
|
|
75
|
+
/**
|
|
76
|
+
* Map Google Fonts array to FontDefinitions
|
|
77
|
+
*/
|
|
78
|
+
private mapGoogleFonts;
|
|
79
|
+
/**
|
|
80
|
+
* Merge fonts from multiple sources and deduplicate by family name
|
|
81
|
+
* Priority: Monotype > Google (Monotype fonts are premium)
|
|
82
|
+
*/
|
|
83
|
+
private mergeFonts;
|
|
84
|
+
/**
|
|
85
|
+
* Clear search cache
|
|
86
|
+
*/
|
|
87
|
+
clearSearchCache(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Clear all caches (including Monotype service caches)
|
|
90
|
+
*/
|
|
91
|
+
clearAllCaches(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Get service stats for debugging
|
|
94
|
+
*/
|
|
95
|
+
getStats(): {
|
|
96
|
+
initialized: boolean;
|
|
97
|
+
monotypeEnabled: boolean;
|
|
98
|
+
totalFonts: number;
|
|
99
|
+
googleFontsCount: number;
|
|
100
|
+
monotopeFontsCount: number;
|
|
101
|
+
systemFontsCount: number;
|
|
102
|
+
searchCacheSize: number;
|
|
103
|
+
monotypeStats: {
|
|
104
|
+
monotypeEnabled: boolean;
|
|
105
|
+
authenticated: boolean;
|
|
106
|
+
hasAccessToken: boolean;
|
|
107
|
+
tokenExpiry: string | null;
|
|
108
|
+
fontsLoaded: boolean;
|
|
109
|
+
fontCount: number;
|
|
110
|
+
familyCount: number;
|
|
111
|
+
webfontKitCount: number;
|
|
112
|
+
searchCacheSize: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export declare const UnifiedFontService: UnifiedFontServiceClass;
|
|
117
|
+
export {};
|