@varianta/sdk 0.1.3 → 0.1.5
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/dist/index.cjs.js +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +655 -778
- package/dist/index.esm.js.map +1 -1
- package/dist/react.cjs.js +2 -0
- package/dist/react.cjs.js.map +1 -0
- package/dist/react.esm.js +291 -0
- package/dist/react.esm.js.map +1 -0
- package/dist/types/index.d.ts +1 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/react/Customizer.d.ts +11 -2
- package/dist/types/react/Customizer.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +36 -2
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/vanilla/index.d.ts.map +1 -1
- package/package.json +4 -27
- package/dist/index.umd.js +0 -8
- package/dist/index.umd.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),r=require("react"),V=require("./index.cjs.js"),D=r.forwardRef((I,v)=>{const{templateId:f,productId:y,apiUrl:t,theme:s="light",mode:m="edit",debug:S=!1,className:b,style:T,initialDesign:g,onReady:z,onChange:w,onLayerSelect:l,onLayerAdd:d,onLayerRemove:E,onLayerUpdate:h,onError:c,onFinalize:L,onViewChange:C}=I,R=r.useRef(null),e=r.useRef(null),u=r.useRef({onReady:z,onChange:w,onLayerSelect:l,onLayerAdd:d,onLayerRemove:E,onLayerUpdate:h,onError:c,onFinalize:L,onViewChange:C});return r.useEffect(()=>{u.current={onReady:z,onChange:w,onLayerSelect:l,onLayerAdd:d,onLayerRemove:E,onLayerUpdate:h,onError:c,onFinalize:L,onViewChange:C}},[z,w,l,d,E,h,c,L,C]),r.useEffect(()=>{if(!R.current)return;const i={templateId:f,productId:y,apiUrl:t,theme:s,mode:m,debug:S,initialDesign:g,onReady:()=>u.current.onReady?.(),onChange:n=>u.current.onChange?.(n),onLayerSelect:n=>u.current.onLayerSelect?.(n),onLayerAdd:n=>u.current.onLayerAdd?.(n),onLayerRemove:n=>u.current.onLayerRemove?.(n),onLayerUpdate:n=>u.current.onLayerUpdate?.(n),onError:n=>u.current.onError?.(n),onFinalize:n=>u.current.onFinalize?.(n),onViewChange:n=>u.current.onViewChange?.(n)};try{const n=V.initCustomizer(R.current,i);e.current=n}catch(n){console.error("[Customizer React] Failed to initialize:",n),u.current.onError?.({code:"INIT_ERROR",message:n instanceof Error?n.message:"Unknown error",details:n})}return()=>{e.current&&(e.current.destroy(),e.current=null)}},[f,y,t,S,g]),r.useEffect(()=>{e.current&&e.current.setTheme(s)},[s]),r.useEffect(()=>{e.current&&e.current.setMode(m)},[m]),r.useImperativeHandle(v,()=>({getDesign:()=>{if(!e.current)throw new Error("Editor not initialized");return e.current.getDesign()},setDesign:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.setDesign(i)},undo:()=>{if(!e.current)throw new Error("Editor not initialized");e.current.undo()},redo:()=>{if(!e.current)throw new Error("Editor not initialized");e.current.redo()},canUndo:()=>e.current?e.current.canUndo():!1,canRedo:()=>e.current?e.current.canRedo():!1,finalize:async()=>{if(!e.current)throw new Error("Editor not initialized");return e.current.finalize()},addTextLayer:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.addTextLayer(i)},addImageLayer:async i=>{if(!e.current)throw new Error("Editor not initialized");return e.current.addImageLayer(i)},removeLayer:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.removeLayer(i)},selectLayer:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.selectLayer(i)},getSelectedLayerId:()=>e.current?e.current.getSelectedLayerId():null,getActiveView:()=>e.current?e.current.getActiveView():null,getViews:()=>e.current?e.current.getViews():[],setActiveView:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.setActiveView(i)},setTheme:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.setTheme(i)},setMode:i=>{if(!e.current)throw new Error("Editor not initialized");e.current.setMode(i)},destroy:()=>{e.current&&(e.current.destroy(),e.current=null)},getElement:()=>{if(!e.current)throw new Error("Editor not initialized");return e.current.getElement()}}),[]),p.jsx("div",{ref:R,className:b,style:{width:"100%",height:"100%",...T}})});D.displayName="Customizer";function x(I={}){const{autoSave:v=!1,autoSaveKey:f="customizer-design",autoSaveDebounce:y=1e3}=I,t=r.useRef(null),[s,m]=r.useState(null),[S,b]=r.useState(!1),[T,g]=r.useState(!1),[z,w]=r.useState(null),[l,d]=r.useState(!1),[E,h]=r.useState(null),c=r.useRef(void 0);r.useEffect(()=>{if(!(!v||!s))return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{try{localStorage.setItem(f,JSON.stringify(s))}catch(o){console.error("[useCustomizer] Auto-save failed:",o)}},y),()=>{c.current&&clearTimeout(c.current)}},[s,v,f,y]);const L=r.useCallback(()=>{if(!t.current)return null;try{return t.current.getDesign()}catch(o){return console.error("[useCustomizer] getDesign failed:",o),null}},[]),C=r.useCallback(o=>{if(t.current)try{t.current.setDesign(o),m(o)}catch(a){console.error("[useCustomizer] setDesign failed:",a)}},[]),R=r.useCallback(()=>{if(t.current)try{t.current.undo(),b(t.current.canUndo()),g(t.current.canRedo())}catch(o){console.error("[useCustomizer] undo failed:",o)}},[]),e=r.useCallback(()=>{if(t.current)try{t.current.redo(),b(t.current.canUndo()),g(t.current.canRedo())}catch(o){console.error("[useCustomizer] redo failed:",o)}},[]),u=r.useCallback(async()=>{if(!t.current||l)return null;d(!0);try{const o=await t.current.finalize();return h(o),o}catch(o){return console.error("[useCustomizer] finalize failed:",o),null}finally{d(!1)}},[l]),i=r.useCallback(o=>{if(t.current)try{t.current.addTextLayer(o)}catch(a){console.error("[useCustomizer] addTextLayer failed:",a)}},[]),n=r.useCallback(async o=>{if(t.current)try{await t.current.addImageLayer(o)}catch(a){console.error("[useCustomizer] addImageLayer failed:",a)}},[]),k=r.useCallback(o=>{if(t.current)try{t.current.removeLayer(o)}catch(a){console.error("[useCustomizer] removeLayer failed:",a)}},[]),U=r.useCallback(o=>{if(t.current)try{t.current.selectLayer(o),w(o)}catch(a){console.error("[useCustomizer] selectLayer failed:",a)}},[]);return{customizerRef:t,design:s,canUndo:S,canRedo:T,selectedLayerId:z,isFinalizing:l,finalizeResult:E,getDesign:L,setDesign:C,undo:R,redo:e,finalize:u,addTextLayer:i,addImageLayer:n,removeLayer:k,selectLayer:U}}exports.Customizer=D;exports.useCustomizer=x;
|
|
2
|
+
//# sourceMappingURL=react.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.cjs.js","sources":["../src/react/Customizer.tsx","../src/react/useCustomizer.ts"],"sourcesContent":["/**\n * React wrapper for Customizer Editor\n * @packageDocumentation\n */\n\nimport {\n useRef,\n useEffect,\n useImperativeHandle,\n forwardRef,\n type CSSProperties,\n} from 'react';\nimport { initCustomizer } from '../vanilla';\nimport type {\n CustomizerOptions,\n CustomizerInstance,\n DesignJSON,\n FinalizeResult,\n CustomizerError,\n} from '../types';\n\n/**\n * Props for the Customizer React component\n */\nexport interface CustomizerProps {\n /**\n * Template ID to load. Required unless productId is provided.\n */\n templateId?: string;\n\n /**\n * Product ID to load (fetches all views/templates for the product).\n * Alternative to templateId. Exactly one of templateId or productId must be provided.\n */\n productId?: string;\n\n /**\n * API base URL for fetching templates and finalizing designs\n * @default 'https://api.varianta.io'\n */\n apiUrl?: string;\n\n /**\n * Visual theme\n * @default 'light'\n */\n theme?: 'light' | 'dark';\n\n /**\n * Editor mode\n * @default 'edit'\n */\n mode?: 'edit' | 'preview';\n\n /**\n * Enable debug mode with additional logging\n * @default false\n */\n debug?: boolean;\n\n /**\n * Custom CSS class name\n */\n className?: string;\n\n /**\n * Custom inline styles\n */\n style?: CSSProperties;\n\n /**\n * Initial design data to load\n */\n initialDesign?: DesignJSON;\n\n /**\n * Called when the editor is ready\n */\n onReady?: () => void;\n\n /**\n * Called when the design changes\n */\n onChange?: (design: DesignJSON) => void;\n\n /**\n * Called when a layer is selected\n */\n onLayerSelect?: (layerId: string | null) => void;\n\n /**\n * Called when a layer is added\n */\n onLayerAdd?: (layerId: string) => void;\n\n /**\n * Called when a layer is removed\n */\n onLayerRemove?: (layerId: string) => void;\n\n /**\n * Called when a layer is updated\n */\n onLayerUpdate?: (layerId: string) => void;\n\n /**\n * Called when an error occurs\n */\n onError?: (error: CustomizerError) => void;\n\n /**\n * Called when finalization is complete\n */\n onFinalize?: (result: FinalizeResult) => void;\n\n /**\n * Called when the active view changes (only relevant when using productId)\n */\n onViewChange?: (viewName: string) => void;\n}\n\n/**\n * Handle type exposed via ref\n */\nexport interface CustomizerHandle extends CustomizerInstance {}\n\n/**\n * Customizer React Component\n *\n * @example\n * ```tsx\n * import { Customizer, CustomizerHandle } from '@varianta/sdk/react';\n * import { useRef } from 'react';\n *\n * function App() {\n * const customizerRef = useRef<CustomizerHandle>(null);\n *\n * const handleFinalize = async () => {\n * if (customizerRef.current) {\n * const result = await customizerRef.current.finalize();\n * console.log('Finalized:', result);\n * }\n * };\n *\n * return (\n * <div style={{ width: '100vw', height: '100vh' }}>\n * <Customizer\n * ref={customizerRef}\n * templateId=\"tshirt-001\"\n * theme=\"light\"\n * onChange={(design) => console.log('Design changed:', design)}\n * onReady={() => console.log('Editor ready!')}\n * />\n * <button onClick={handleFinalize}>Finalize Design</button>\n * </div>\n * );\n * }\n * ```\n */\nexport const Customizer = forwardRef<CustomizerHandle, CustomizerProps>(\n (props, ref) => {\n const {\n templateId,\n productId,\n apiUrl,\n theme = 'light',\n mode = 'edit',\n debug = false,\n className,\n style,\n initialDesign,\n onReady,\n onChange,\n onLayerSelect,\n onLayerAdd,\n onLayerRemove,\n onLayerUpdate,\n onError,\n onFinalize,\n onViewChange,\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<CustomizerInstance | null>(null);\n\n // Store latest callbacks in a ref to avoid stale closures\n const callbacksRef = useRef({\n onReady,\n onChange,\n onLayerSelect,\n onLayerAdd,\n onLayerRemove,\n onLayerUpdate,\n onError,\n onFinalize,\n onViewChange,\n });\n\n // Update callbacks ref whenever they change\n useEffect(() => {\n callbacksRef.current = {\n onReady,\n onChange,\n onLayerSelect,\n onLayerAdd,\n onLayerRemove,\n onLayerUpdate,\n onError,\n onFinalize,\n onViewChange,\n };\n }, [onReady, onChange, onLayerSelect, onLayerAdd, onLayerRemove, onLayerUpdate, onError, onFinalize, onViewChange]);\n\n // Initialize the editor\n useEffect(() => {\n if (!containerRef.current) return;\n\n const options: CustomizerOptions = {\n templateId,\n productId,\n apiUrl,\n theme,\n mode,\n debug,\n initialDesign,\n // Use callback refs to always get latest callbacks\n onReady: () => callbacksRef.current.onReady?.(),\n onChange: (design) => callbacksRef.current.onChange?.(design),\n onLayerSelect: (layerId) => callbacksRef.current.onLayerSelect?.(layerId),\n onLayerAdd: (layerId) => callbacksRef.current.onLayerAdd?.(layerId),\n onLayerRemove: (layerId) => callbacksRef.current.onLayerRemove?.(layerId),\n onLayerUpdate: (layerId) => callbacksRef.current.onLayerUpdate?.(layerId),\n onError: (error) => callbacksRef.current.onError?.(error),\n onFinalize: (result) => callbacksRef.current.onFinalize?.(result),\n onViewChange: (viewName) => callbacksRef.current.onViewChange?.(viewName),\n };\n\n try {\n const instance = initCustomizer(containerRef.current, options);\n instanceRef.current = instance;\n } catch (error) {\n console.error('[Customizer React] Failed to initialize:', error);\n callbacksRef.current.onError?.({\n code: 'INIT_ERROR',\n message: error instanceof Error ? error.message : 'Unknown error',\n details: error,\n });\n }\n\n // Cleanup\n return () => {\n if (instanceRef.current) {\n instanceRef.current.destroy();\n instanceRef.current = null;\n }\n };\n }, [templateId, productId, apiUrl, debug, initialDesign]); // Only re-initialize on structural changes\n\n // Update theme when it changes\n useEffect(() => {\n if (instanceRef.current) {\n instanceRef.current.setTheme(theme);\n }\n }, [theme]);\n\n // Update mode when it changes\n useEffect(() => {\n if (instanceRef.current) {\n instanceRef.current.setMode(mode);\n }\n }, [mode]);\n\n // Expose methods via ref\n useImperativeHandle(\n ref,\n () => {\n // Return API that always uses current instanceRef\n return {\n getDesign: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.getDesign();\n },\n setDesign: (design: DesignJSON) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setDesign(design);\n },\n undo: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.undo();\n },\n redo: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.redo();\n },\n canUndo: () => {\n if (!instanceRef.current) return false;\n return instanceRef.current.canUndo();\n },\n canRedo: () => {\n if (!instanceRef.current) return false;\n return instanceRef.current.canRedo();\n },\n finalize: async () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.finalize();\n },\n addTextLayer: (text?: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.addTextLayer(text);\n },\n addImageLayer: async (url: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.addImageLayer(url);\n },\n removeLayer: (layerId: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.removeLayer(layerId);\n },\n selectLayer: (layerId: string | null) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.selectLayer(layerId);\n },\n getSelectedLayerId: () => {\n if (!instanceRef.current) return null;\n return instanceRef.current.getSelectedLayerId();\n },\n getActiveView: () => {\n if (!instanceRef.current) return null;\n return instanceRef.current.getActiveView();\n },\n getViews: () => {\n if (!instanceRef.current) return [];\n return instanceRef.current.getViews();\n },\n setActiveView: (viewName: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setActiveView(viewName);\n },\n setTheme: (newTheme: 'light' | 'dark') => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setTheme(newTheme);\n },\n setMode: (newMode: 'edit' | 'preview') => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setMode(newMode);\n },\n destroy: () => {\n if (!instanceRef.current) return;\n instanceRef.current.destroy();\n instanceRef.current = null;\n },\n getElement: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.getElement();\n },\n };\n },\n [] // Empty deps is OK - we always read from instanceRef.current\n );\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={{\n width: '100%',\n height: '100%',\n ...style,\n }}\n />\n );\n }\n);\n\nCustomizer.displayName = 'Customizer';\n","/**\n * React hook for controlling the customizer editor\n * @packageDocumentation\n */\n\nimport { useRef, useCallback, useState, useEffect } from 'react';\nimport type { CustomizerHandle } from './Customizer';\nimport type { DesignJSON, FinalizeResult } from '../types';\n\n/**\n * Options for the useCustomizer hook\n */\nexport interface UseCustomizerOptions {\n /**\n * Auto-save design to localStorage\n */\n autoSave?: boolean;\n\n /**\n * localStorage key for auto-save\n * @default 'customizer-design'\n */\n autoSaveKey?: string;\n\n /**\n * Debounce time for auto-save in ms\n * @default 1000\n */\n autoSaveDebounce?: number;\n}\n\n/**\n * Return type for useCustomizer hook\n */\nexport interface UseCustomizerReturn {\n /**\n * Ref to attach to the Customizer component\n */\n customizerRef: React.RefObject<CustomizerHandle | null>;\n\n /**\n * Current design state\n */\n design: DesignJSON | null;\n\n /**\n * Whether undo is available\n */\n canUndo: boolean;\n\n /**\n * Whether redo is available\n */\n canRedo: boolean;\n\n /**\n * Selected layer ID\n */\n selectedLayerId: string | null;\n\n /**\n * Whether finalization is in progress\n */\n isFinalizing: boolean;\n\n /**\n * Finalization result\n */\n finalizeResult: FinalizeResult | null;\n\n /**\n * Get the current design\n */\n getDesign: () => DesignJSON | null;\n\n /**\n * Set a new design\n */\n setDesign: (design: DesignJSON) => void;\n\n /**\n * Undo the last action\n */\n undo: () => void;\n\n /**\n * Redo the last undone action\n */\n redo: () => void;\n\n /**\n * Finalize the design\n */\n finalize: () => Promise<FinalizeResult | null>;\n\n /**\n * Add a text layer\n */\n addTextLayer: (text?: string) => void;\n\n /**\n * Add an image layer\n */\n addImageLayer: (url: string) => Promise<void>;\n\n /**\n * Remove a layer\n */\n removeLayer: (layerId: string) => void;\n\n /**\n * Select a layer\n */\n selectLayer: (layerId: string | null) => void;\n}\n\n/**\n * React hook for controlling the customizer editor\n *\n * @example\n * ```tsx\n * import { Customizer } from '@varianta/sdk/react';\n * import { useCustomizer } from '@varianta/sdk/react';\n *\n * function App() {\n * const {\n * customizerRef,\n * design,\n * canUndo,\n * canRedo,\n * undo,\n * redo,\n * finalize,\n * isFinalizing,\n * } = useCustomizer({ autoSave: true });\n *\n * return (\n * <>\n * <Customizer\n * ref={customizerRef}\n * templateId=\"tshirt-001\"\n * onChange={(d) => console.log('Changed:', d)}\n * />\n * <button onClick={undo} disabled={!canUndo}>Undo</button>\n * <button onClick={redo} disabled={!canRedo}>Redo</button>\n * <button onClick={finalize} disabled={isFinalizing}>\n * {isFinalizing ? 'Finalizing...' : 'Finalize'}\n * </button>\n * </>\n * );\n * }\n * ```\n */\nexport function useCustomizer(\n options: UseCustomizerOptions = {}\n): UseCustomizerReturn {\n const {\n autoSave = false,\n autoSaveKey = 'customizer-design',\n autoSaveDebounce = 1000,\n } = options;\n\n const customizerRef = useRef<CustomizerHandle>(null);\n const [design, setDesign] = useState<DesignJSON | null>(null);\n const [canUndo, setCanUndo] = useState(false);\n const [canRedo, setCanRedo] = useState(false);\n const [selectedLayerId, setSelectedLayerId] = useState<string | null>(null);\n const [isFinalizing, setIsFinalizing] = useState(false);\n const [finalizeResult, setFinalizeResult] = useState<FinalizeResult | null>(\n null\n );\n\n const autoSaveTimeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);\n\n // Auto-save to localStorage\n useEffect(() => {\n if (!autoSave || !design) return;\n\n // Clear existing timeout\n if (autoSaveTimeoutRef.current) {\n clearTimeout(autoSaveTimeoutRef.current);\n }\n\n // Set new timeout\n autoSaveTimeoutRef.current = setTimeout(() => {\n try {\n localStorage.setItem(autoSaveKey, JSON.stringify(design));\n } catch (error) {\n console.error('[useCustomizer] Auto-save failed:', error);\n }\n }, autoSaveDebounce);\n\n return () => {\n if (autoSaveTimeoutRef.current) {\n clearTimeout(autoSaveTimeoutRef.current);\n }\n };\n }, [design, autoSave, autoSaveKey, autoSaveDebounce]);\n\n const getDesign = useCallback(() => {\n if (!customizerRef.current) return null;\n try {\n return customizerRef.current.getDesign();\n } catch (error) {\n console.error('[useCustomizer] getDesign failed:', error);\n return null;\n }\n }, []);\n\n const setDesignCallback = useCallback((newDesign: DesignJSON) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.setDesign(newDesign);\n setDesign(newDesign);\n } catch (error) {\n console.error('[useCustomizer] setDesign failed:', error);\n }\n }, []);\n\n const undo = useCallback(() => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.undo();\n setCanUndo(customizerRef.current.canUndo());\n setCanRedo(customizerRef.current.canRedo());\n } catch (error) {\n console.error('[useCustomizer] undo failed:', error);\n }\n }, []);\n\n const redo = useCallback(() => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.redo();\n setCanUndo(customizerRef.current.canUndo());\n setCanRedo(customizerRef.current.canRedo());\n } catch (error) {\n console.error('[useCustomizer] redo failed:', error);\n }\n }, []);\n\n const finalize = useCallback(async () => {\n if (!customizerRef.current || isFinalizing) return null;\n\n setIsFinalizing(true);\n try {\n const result = await customizerRef.current.finalize();\n setFinalizeResult(result);\n return result;\n } catch (error) {\n console.error('[useCustomizer] finalize failed:', error);\n return null;\n } finally {\n setIsFinalizing(false);\n }\n }, [isFinalizing]);\n\n const addTextLayer = useCallback((text?: string) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.addTextLayer(text);\n } catch (error) {\n console.error('[useCustomizer] addTextLayer failed:', error);\n }\n }, []);\n\n const addImageLayer = useCallback(async (url: string) => {\n if (!customizerRef.current) return;\n try {\n await customizerRef.current.addImageLayer(url);\n } catch (error) {\n console.error('[useCustomizer] addImageLayer failed:', error);\n }\n }, []);\n\n const removeLayer = useCallback((layerId: string) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.removeLayer(layerId);\n } catch (error) {\n console.error('[useCustomizer] removeLayer failed:', error);\n }\n }, []);\n\n const selectLayer = useCallback((layerId: string | null) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.selectLayer(layerId);\n setSelectedLayerId(layerId);\n } catch (error) {\n console.error('[useCustomizer] selectLayer failed:', error);\n }\n }, []);\n\n return {\n customizerRef,\n design,\n canUndo,\n canRedo,\n selectedLayerId,\n isFinalizing,\n finalizeResult,\n getDesign,\n setDesign: setDesignCallback,\n undo,\n redo,\n finalize,\n addTextLayer,\n addImageLayer,\n removeLayer,\n selectLayer,\n };\n}\n"],"names":["Customizer","forwardRef","props","ref","templateId","productId","apiUrl","theme","mode","debug","className","style","initialDesign","onReady","onChange","onLayerSelect","onLayerAdd","onLayerRemove","onLayerUpdate","onError","onFinalize","onViewChange","containerRef","useRef","instanceRef","callbacksRef","useEffect","options","design","layerId","error","result","viewName","instance","initCustomizer","useImperativeHandle","text","url","newTheme","newMode","jsx","useCustomizer","autoSave","autoSaveKey","autoSaveDebounce","customizerRef","setDesign","useState","canUndo","setCanUndo","canRedo","setCanRedo","selectedLayerId","setSelectedLayerId","isFinalizing","setIsFinalizing","finalizeResult","setFinalizeResult","autoSaveTimeoutRef","getDesign","useCallback","setDesignCallback","newDesign","undo","redo","finalize","addTextLayer","addImageLayer","removeLayer","selectLayer"],"mappings":"oKA+JaA,EAAaC,EAAAA,WACxB,CAACC,EAAOC,IAAQ,CACd,KAAM,CACJ,WAAAC,EACA,UAAAC,EACA,OAAAC,EACA,MAAAC,EAAQ,QACR,KAAAC,EAAO,OACP,MAAAC,EAAQ,GACR,UAAAC,EACA,MAAAC,EACA,cAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,WAAAC,EACA,cAAAC,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AAc,QACnB,GAAI,CACF,MAAMA,EAAc,QAAQ,cAAcR,CAAG,CAC/C,OAASP,EAAO,CACd,QAAQ,MAAM,wCAAyCA,CAAK,CAC9D,CACF,EAAG,CAAA,CAAE,EAECsC,EAAcR,cAAa/B,GAAoB,CACnD,GAAKgB,EAAc,QACnB,GAAI,CACFA,EAAc,QAAQ,YAAYhB,CAAO,CAC3C,OAASC,EAAO,CACd,QAAQ,MAAM,sCAAuCA,CAAK,CAC5D,CACF,EAAG,CAAA,CAAE,EAECuC,EAAcT,cAAa/B,GAA2B,CAC1D,GAAKgB,EAAc,QACnB,GAAI,CACFA,EAAc,QAAQ,YAAYhB,CAAO,EACzCwB,EAAmBxB,CAAO,CAC5B,OAASC,EAAO,CACd,QAAQ,MAAM,sCAAuCA,CAAK,CAC5D,CACF,EAAG,CAAA,CAAE,EAEL,MAAO,CACL,cAAAe,EACA,OAAAjB,EACA,QAAAoB,EACA,QAAAE,EACA,gBAAAE,EACA,aAAAE,EACA,eAAAE,EACA,UAAAG,EACA,UAAWE,EACX,KAAAE,EACA,KAAAC,EACA,SAAAC,EACA,aAAAC,EACA,cAAAC,EACA,YAAAC,EACA,YAAAC,CAAA,CAEJ"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as b, useRef as p, useEffect as I, useImperativeHandle as k, useState as f, useCallback as a } from "react";
|
|
3
|
+
import { initCustomizer as N } from "./index.esm.js";
|
|
4
|
+
const M = b(
|
|
5
|
+
(U, D) => {
|
|
6
|
+
const {
|
|
7
|
+
templateId: y,
|
|
8
|
+
productId: m,
|
|
9
|
+
apiUrl: r,
|
|
10
|
+
theme: s = "light",
|
|
11
|
+
mode: g = "edit",
|
|
12
|
+
debug: S = !1,
|
|
13
|
+
className: T,
|
|
14
|
+
style: V,
|
|
15
|
+
initialDesign: z,
|
|
16
|
+
onReady: w,
|
|
17
|
+
onChange: h,
|
|
18
|
+
onLayerSelect: l,
|
|
19
|
+
onLayerAdd: d,
|
|
20
|
+
onLayerRemove: L,
|
|
21
|
+
onLayerUpdate: E,
|
|
22
|
+
onError: c,
|
|
23
|
+
onFinalize: C,
|
|
24
|
+
onViewChange: R
|
|
25
|
+
} = U, v = p(null), e = p(null), i = p({
|
|
26
|
+
onReady: w,
|
|
27
|
+
onChange: h,
|
|
28
|
+
onLayerSelect: l,
|
|
29
|
+
onLayerAdd: d,
|
|
30
|
+
onLayerRemove: L,
|
|
31
|
+
onLayerUpdate: E,
|
|
32
|
+
onError: c,
|
|
33
|
+
onFinalize: C,
|
|
34
|
+
onViewChange: R
|
|
35
|
+
});
|
|
36
|
+
return I(() => {
|
|
37
|
+
i.current = {
|
|
38
|
+
onReady: w,
|
|
39
|
+
onChange: h,
|
|
40
|
+
onLayerSelect: l,
|
|
41
|
+
onLayerAdd: d,
|
|
42
|
+
onLayerRemove: L,
|
|
43
|
+
onLayerUpdate: E,
|
|
44
|
+
onError: c,
|
|
45
|
+
onFinalize: C,
|
|
46
|
+
onViewChange: R
|
|
47
|
+
};
|
|
48
|
+
}, [w, h, l, d, L, E, c, C, R]), I(() => {
|
|
49
|
+
if (!v.current) return;
|
|
50
|
+
const o = {
|
|
51
|
+
templateId: y,
|
|
52
|
+
productId: m,
|
|
53
|
+
apiUrl: r,
|
|
54
|
+
theme: s,
|
|
55
|
+
mode: g,
|
|
56
|
+
debug: S,
|
|
57
|
+
initialDesign: z,
|
|
58
|
+
// Use callback refs to always get latest callbacks
|
|
59
|
+
onReady: () => i.current.onReady?.(),
|
|
60
|
+
onChange: (t) => i.current.onChange?.(t),
|
|
61
|
+
onLayerSelect: (t) => i.current.onLayerSelect?.(t),
|
|
62
|
+
onLayerAdd: (t) => i.current.onLayerAdd?.(t),
|
|
63
|
+
onLayerRemove: (t) => i.current.onLayerRemove?.(t),
|
|
64
|
+
onLayerUpdate: (t) => i.current.onLayerUpdate?.(t),
|
|
65
|
+
onError: (t) => i.current.onError?.(t),
|
|
66
|
+
onFinalize: (t) => i.current.onFinalize?.(t),
|
|
67
|
+
onViewChange: (t) => i.current.onViewChange?.(t)
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
const t = N(v.current, o);
|
|
71
|
+
e.current = t;
|
|
72
|
+
} catch (t) {
|
|
73
|
+
console.error("[Customizer React] Failed to initialize:", t), i.current.onError?.({
|
|
74
|
+
code: "INIT_ERROR",
|
|
75
|
+
message: t instanceof Error ? t.message : "Unknown error",
|
|
76
|
+
details: t
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return () => {
|
|
80
|
+
e.current && (e.current.destroy(), e.current = null);
|
|
81
|
+
};
|
|
82
|
+
}, [y, m, r, S, z]), I(() => {
|
|
83
|
+
e.current && e.current.setTheme(s);
|
|
84
|
+
}, [s]), I(() => {
|
|
85
|
+
e.current && e.current.setMode(g);
|
|
86
|
+
}, [g]), k(
|
|
87
|
+
D,
|
|
88
|
+
() => ({
|
|
89
|
+
getDesign: () => {
|
|
90
|
+
if (!e.current)
|
|
91
|
+
throw new Error("Editor not initialized");
|
|
92
|
+
return e.current.getDesign();
|
|
93
|
+
},
|
|
94
|
+
setDesign: (o) => {
|
|
95
|
+
if (!e.current)
|
|
96
|
+
throw new Error("Editor not initialized");
|
|
97
|
+
e.current.setDesign(o);
|
|
98
|
+
},
|
|
99
|
+
undo: () => {
|
|
100
|
+
if (!e.current)
|
|
101
|
+
throw new Error("Editor not initialized");
|
|
102
|
+
e.current.undo();
|
|
103
|
+
},
|
|
104
|
+
redo: () => {
|
|
105
|
+
if (!e.current)
|
|
106
|
+
throw new Error("Editor not initialized");
|
|
107
|
+
e.current.redo();
|
|
108
|
+
},
|
|
109
|
+
canUndo: () => e.current ? e.current.canUndo() : !1,
|
|
110
|
+
canRedo: () => e.current ? e.current.canRedo() : !1,
|
|
111
|
+
finalize: async () => {
|
|
112
|
+
if (!e.current)
|
|
113
|
+
throw new Error("Editor not initialized");
|
|
114
|
+
return e.current.finalize();
|
|
115
|
+
},
|
|
116
|
+
addTextLayer: (o) => {
|
|
117
|
+
if (!e.current)
|
|
118
|
+
throw new Error("Editor not initialized");
|
|
119
|
+
e.current.addTextLayer(o);
|
|
120
|
+
},
|
|
121
|
+
addImageLayer: async (o) => {
|
|
122
|
+
if (!e.current)
|
|
123
|
+
throw new Error("Editor not initialized");
|
|
124
|
+
return e.current.addImageLayer(o);
|
|
125
|
+
},
|
|
126
|
+
removeLayer: (o) => {
|
|
127
|
+
if (!e.current)
|
|
128
|
+
throw new Error("Editor not initialized");
|
|
129
|
+
e.current.removeLayer(o);
|
|
130
|
+
},
|
|
131
|
+
selectLayer: (o) => {
|
|
132
|
+
if (!e.current)
|
|
133
|
+
throw new Error("Editor not initialized");
|
|
134
|
+
e.current.selectLayer(o);
|
|
135
|
+
},
|
|
136
|
+
getSelectedLayerId: () => e.current ? e.current.getSelectedLayerId() : null,
|
|
137
|
+
getActiveView: () => e.current ? e.current.getActiveView() : null,
|
|
138
|
+
getViews: () => e.current ? e.current.getViews() : [],
|
|
139
|
+
setActiveView: (o) => {
|
|
140
|
+
if (!e.current)
|
|
141
|
+
throw new Error("Editor not initialized");
|
|
142
|
+
e.current.setActiveView(o);
|
|
143
|
+
},
|
|
144
|
+
setTheme: (o) => {
|
|
145
|
+
if (!e.current)
|
|
146
|
+
throw new Error("Editor not initialized");
|
|
147
|
+
e.current.setTheme(o);
|
|
148
|
+
},
|
|
149
|
+
setMode: (o) => {
|
|
150
|
+
if (!e.current)
|
|
151
|
+
throw new Error("Editor not initialized");
|
|
152
|
+
e.current.setMode(o);
|
|
153
|
+
},
|
|
154
|
+
destroy: () => {
|
|
155
|
+
e.current && (e.current.destroy(), e.current = null);
|
|
156
|
+
},
|
|
157
|
+
getElement: () => {
|
|
158
|
+
if (!e.current)
|
|
159
|
+
throw new Error("Editor not initialized");
|
|
160
|
+
return e.current.getElement();
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
[]
|
|
164
|
+
// Empty deps is OK - we always read from instanceRef.current
|
|
165
|
+
), /* @__PURE__ */ F(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
ref: v,
|
|
169
|
+
className: T,
|
|
170
|
+
style: {
|
|
171
|
+
width: "100%",
|
|
172
|
+
height: "100%",
|
|
173
|
+
...V
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
M.displayName = "Customizer";
|
|
180
|
+
function J(U = {}) {
|
|
181
|
+
const {
|
|
182
|
+
autoSave: D = !1,
|
|
183
|
+
autoSaveKey: y = "customizer-design",
|
|
184
|
+
autoSaveDebounce: m = 1e3
|
|
185
|
+
} = U, r = p(null), [s, g] = f(null), [S, T] = f(!1), [V, z] = f(!1), [w, h] = f(null), [l, d] = f(!1), [L, E] = f(
|
|
186
|
+
null
|
|
187
|
+
), c = p(void 0);
|
|
188
|
+
I(() => {
|
|
189
|
+
if (!(!D || !s))
|
|
190
|
+
return c.current && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
191
|
+
try {
|
|
192
|
+
localStorage.setItem(y, JSON.stringify(s));
|
|
193
|
+
} catch (n) {
|
|
194
|
+
console.error("[useCustomizer] Auto-save failed:", n);
|
|
195
|
+
}
|
|
196
|
+
}, m), () => {
|
|
197
|
+
c.current && clearTimeout(c.current);
|
|
198
|
+
};
|
|
199
|
+
}, [s, D, y, m]);
|
|
200
|
+
const C = a(() => {
|
|
201
|
+
if (!r.current) return null;
|
|
202
|
+
try {
|
|
203
|
+
return r.current.getDesign();
|
|
204
|
+
} catch (n) {
|
|
205
|
+
return console.error("[useCustomizer] getDesign failed:", n), null;
|
|
206
|
+
}
|
|
207
|
+
}, []), R = a((n) => {
|
|
208
|
+
if (r.current)
|
|
209
|
+
try {
|
|
210
|
+
r.current.setDesign(n), g(n);
|
|
211
|
+
} catch (u) {
|
|
212
|
+
console.error("[useCustomizer] setDesign failed:", u);
|
|
213
|
+
}
|
|
214
|
+
}, []), v = a(() => {
|
|
215
|
+
if (r.current)
|
|
216
|
+
try {
|
|
217
|
+
r.current.undo(), T(r.current.canUndo()), z(r.current.canRedo());
|
|
218
|
+
} catch (n) {
|
|
219
|
+
console.error("[useCustomizer] undo failed:", n);
|
|
220
|
+
}
|
|
221
|
+
}, []), e = a(() => {
|
|
222
|
+
if (r.current)
|
|
223
|
+
try {
|
|
224
|
+
r.current.redo(), T(r.current.canUndo()), z(r.current.canRedo());
|
|
225
|
+
} catch (n) {
|
|
226
|
+
console.error("[useCustomizer] redo failed:", n);
|
|
227
|
+
}
|
|
228
|
+
}, []), i = a(async () => {
|
|
229
|
+
if (!r.current || l) return null;
|
|
230
|
+
d(!0);
|
|
231
|
+
try {
|
|
232
|
+
const n = await r.current.finalize();
|
|
233
|
+
return E(n), n;
|
|
234
|
+
} catch (n) {
|
|
235
|
+
return console.error("[useCustomizer] finalize failed:", n), null;
|
|
236
|
+
} finally {
|
|
237
|
+
d(!1);
|
|
238
|
+
}
|
|
239
|
+
}, [l]), o = a((n) => {
|
|
240
|
+
if (r.current)
|
|
241
|
+
try {
|
|
242
|
+
r.current.addTextLayer(n);
|
|
243
|
+
} catch (u) {
|
|
244
|
+
console.error("[useCustomizer] addTextLayer failed:", u);
|
|
245
|
+
}
|
|
246
|
+
}, []), t = a(async (n) => {
|
|
247
|
+
if (r.current)
|
|
248
|
+
try {
|
|
249
|
+
await r.current.addImageLayer(n);
|
|
250
|
+
} catch (u) {
|
|
251
|
+
console.error("[useCustomizer] addImageLayer failed:", u);
|
|
252
|
+
}
|
|
253
|
+
}, []), A = a((n) => {
|
|
254
|
+
if (r.current)
|
|
255
|
+
try {
|
|
256
|
+
r.current.removeLayer(n);
|
|
257
|
+
} catch (u) {
|
|
258
|
+
console.error("[useCustomizer] removeLayer failed:", u);
|
|
259
|
+
}
|
|
260
|
+
}, []), x = a((n) => {
|
|
261
|
+
if (r.current)
|
|
262
|
+
try {
|
|
263
|
+
r.current.selectLayer(n), h(n);
|
|
264
|
+
} catch (u) {
|
|
265
|
+
console.error("[useCustomizer] selectLayer failed:", u);
|
|
266
|
+
}
|
|
267
|
+
}, []);
|
|
268
|
+
return {
|
|
269
|
+
customizerRef: r,
|
|
270
|
+
design: s,
|
|
271
|
+
canUndo: S,
|
|
272
|
+
canRedo: V,
|
|
273
|
+
selectedLayerId: w,
|
|
274
|
+
isFinalizing: l,
|
|
275
|
+
finalizeResult: L,
|
|
276
|
+
getDesign: C,
|
|
277
|
+
setDesign: R,
|
|
278
|
+
undo: v,
|
|
279
|
+
redo: e,
|
|
280
|
+
finalize: i,
|
|
281
|
+
addTextLayer: o,
|
|
282
|
+
addImageLayer: t,
|
|
283
|
+
removeLayer: A,
|
|
284
|
+
selectLayer: x
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
export {
|
|
288
|
+
M as Customizer,
|
|
289
|
+
J as useCustomizer
|
|
290
|
+
};
|
|
291
|
+
//# sourceMappingURL=react.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.esm.js","sources":["../src/react/Customizer.tsx","../src/react/useCustomizer.ts"],"sourcesContent":["/**\n * React wrapper for Customizer Editor\n * @packageDocumentation\n */\n\nimport {\n useRef,\n useEffect,\n useImperativeHandle,\n forwardRef,\n type CSSProperties,\n} from 'react';\nimport { initCustomizer } from '../vanilla';\nimport type {\n CustomizerOptions,\n CustomizerInstance,\n DesignJSON,\n FinalizeResult,\n CustomizerError,\n} from '../types';\n\n/**\n * Props for the Customizer React component\n */\nexport interface CustomizerProps {\n /**\n * Template ID to load. Required unless productId is provided.\n */\n templateId?: string;\n\n /**\n * Product ID to load (fetches all views/templates for the product).\n * Alternative to templateId. Exactly one of templateId or productId must be provided.\n */\n productId?: string;\n\n /**\n * API base URL for fetching templates and finalizing designs\n * @default 'https://api.varianta.io'\n */\n apiUrl?: string;\n\n /**\n * Visual theme\n * @default 'light'\n */\n theme?: 'light' | 'dark';\n\n /**\n * Editor mode\n * @default 'edit'\n */\n mode?: 'edit' | 'preview';\n\n /**\n * Enable debug mode with additional logging\n * @default false\n */\n debug?: boolean;\n\n /**\n * Custom CSS class name\n */\n className?: string;\n\n /**\n * Custom inline styles\n */\n style?: CSSProperties;\n\n /**\n * Initial design data to load\n */\n initialDesign?: DesignJSON;\n\n /**\n * Called when the editor is ready\n */\n onReady?: () => void;\n\n /**\n * Called when the design changes\n */\n onChange?: (design: DesignJSON) => void;\n\n /**\n * Called when a layer is selected\n */\n onLayerSelect?: (layerId: string | null) => void;\n\n /**\n * Called when a layer is added\n */\n onLayerAdd?: (layerId: string) => void;\n\n /**\n * Called when a layer is removed\n */\n onLayerRemove?: (layerId: string) => void;\n\n /**\n * Called when a layer is updated\n */\n onLayerUpdate?: (layerId: string) => void;\n\n /**\n * Called when an error occurs\n */\n onError?: (error: CustomizerError) => void;\n\n /**\n * Called when finalization is complete\n */\n onFinalize?: (result: FinalizeResult) => void;\n\n /**\n * Called when the active view changes (only relevant when using productId)\n */\n onViewChange?: (viewName: string) => void;\n}\n\n/**\n * Handle type exposed via ref\n */\nexport interface CustomizerHandle extends CustomizerInstance {}\n\n/**\n * Customizer React Component\n *\n * @example\n * ```tsx\n * import { Customizer, CustomizerHandle } from '@varianta/sdk/react';\n * import { useRef } from 'react';\n *\n * function App() {\n * const customizerRef = useRef<CustomizerHandle>(null);\n *\n * const handleFinalize = async () => {\n * if (customizerRef.current) {\n * const result = await customizerRef.current.finalize();\n * console.log('Finalized:', result);\n * }\n * };\n *\n * return (\n * <div style={{ width: '100vw', height: '100vh' }}>\n * <Customizer\n * ref={customizerRef}\n * templateId=\"tshirt-001\"\n * theme=\"light\"\n * onChange={(design) => console.log('Design changed:', design)}\n * onReady={() => console.log('Editor ready!')}\n * />\n * <button onClick={handleFinalize}>Finalize Design</button>\n * </div>\n * );\n * }\n * ```\n */\nexport const Customizer = forwardRef<CustomizerHandle, CustomizerProps>(\n (props, ref) => {\n const {\n templateId,\n productId,\n apiUrl,\n theme = 'light',\n mode = 'edit',\n debug = false,\n className,\n style,\n initialDesign,\n onReady,\n onChange,\n onLayerSelect,\n onLayerAdd,\n onLayerRemove,\n onLayerUpdate,\n onError,\n onFinalize,\n onViewChange,\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const instanceRef = useRef<CustomizerInstance | null>(null);\n\n // Store latest callbacks in a ref to avoid stale closures\n const callbacksRef = useRef({\n onReady,\n onChange,\n onLayerSelect,\n onLayerAdd,\n onLayerRemove,\n onLayerUpdate,\n onError,\n onFinalize,\n onViewChange,\n });\n\n // Update callbacks ref whenever they change\n useEffect(() => {\n callbacksRef.current = {\n onReady,\n onChange,\n onLayerSelect,\n onLayerAdd,\n onLayerRemove,\n onLayerUpdate,\n onError,\n onFinalize,\n onViewChange,\n };\n }, [onReady, onChange, onLayerSelect, onLayerAdd, onLayerRemove, onLayerUpdate, onError, onFinalize, onViewChange]);\n\n // Initialize the editor\n useEffect(() => {\n if (!containerRef.current) return;\n\n const options: CustomizerOptions = {\n templateId,\n productId,\n apiUrl,\n theme,\n mode,\n debug,\n initialDesign,\n // Use callback refs to always get latest callbacks\n onReady: () => callbacksRef.current.onReady?.(),\n onChange: (design) => callbacksRef.current.onChange?.(design),\n onLayerSelect: (layerId) => callbacksRef.current.onLayerSelect?.(layerId),\n onLayerAdd: (layerId) => callbacksRef.current.onLayerAdd?.(layerId),\n onLayerRemove: (layerId) => callbacksRef.current.onLayerRemove?.(layerId),\n onLayerUpdate: (layerId) => callbacksRef.current.onLayerUpdate?.(layerId),\n onError: (error) => callbacksRef.current.onError?.(error),\n onFinalize: (result) => callbacksRef.current.onFinalize?.(result),\n onViewChange: (viewName) => callbacksRef.current.onViewChange?.(viewName),\n };\n\n try {\n const instance = initCustomizer(containerRef.current, options);\n instanceRef.current = instance;\n } catch (error) {\n console.error('[Customizer React] Failed to initialize:', error);\n callbacksRef.current.onError?.({\n code: 'INIT_ERROR',\n message: error instanceof Error ? error.message : 'Unknown error',\n details: error,\n });\n }\n\n // Cleanup\n return () => {\n if (instanceRef.current) {\n instanceRef.current.destroy();\n instanceRef.current = null;\n }\n };\n }, [templateId, productId, apiUrl, debug, initialDesign]); // Only re-initialize on structural changes\n\n // Update theme when it changes\n useEffect(() => {\n if (instanceRef.current) {\n instanceRef.current.setTheme(theme);\n }\n }, [theme]);\n\n // Update mode when it changes\n useEffect(() => {\n if (instanceRef.current) {\n instanceRef.current.setMode(mode);\n }\n }, [mode]);\n\n // Expose methods via ref\n useImperativeHandle(\n ref,\n () => {\n // Return API that always uses current instanceRef\n return {\n getDesign: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.getDesign();\n },\n setDesign: (design: DesignJSON) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setDesign(design);\n },\n undo: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.undo();\n },\n redo: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.redo();\n },\n canUndo: () => {\n if (!instanceRef.current) return false;\n return instanceRef.current.canUndo();\n },\n canRedo: () => {\n if (!instanceRef.current) return false;\n return instanceRef.current.canRedo();\n },\n finalize: async () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.finalize();\n },\n addTextLayer: (text?: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.addTextLayer(text);\n },\n addImageLayer: async (url: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.addImageLayer(url);\n },\n removeLayer: (layerId: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.removeLayer(layerId);\n },\n selectLayer: (layerId: string | null) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.selectLayer(layerId);\n },\n getSelectedLayerId: () => {\n if (!instanceRef.current) return null;\n return instanceRef.current.getSelectedLayerId();\n },\n getActiveView: () => {\n if (!instanceRef.current) return null;\n return instanceRef.current.getActiveView();\n },\n getViews: () => {\n if (!instanceRef.current) return [];\n return instanceRef.current.getViews();\n },\n setActiveView: (viewName: string) => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setActiveView(viewName);\n },\n setTheme: (newTheme: 'light' | 'dark') => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setTheme(newTheme);\n },\n setMode: (newMode: 'edit' | 'preview') => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n instanceRef.current.setMode(newMode);\n },\n destroy: () => {\n if (!instanceRef.current) return;\n instanceRef.current.destroy();\n instanceRef.current = null;\n },\n getElement: () => {\n if (!instanceRef.current) {\n throw new Error('Editor not initialized');\n }\n return instanceRef.current.getElement();\n },\n };\n },\n [] // Empty deps is OK - we always read from instanceRef.current\n );\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={{\n width: '100%',\n height: '100%',\n ...style,\n }}\n />\n );\n }\n);\n\nCustomizer.displayName = 'Customizer';\n","/**\n * React hook for controlling the customizer editor\n * @packageDocumentation\n */\n\nimport { useRef, useCallback, useState, useEffect } from 'react';\nimport type { CustomizerHandle } from './Customizer';\nimport type { DesignJSON, FinalizeResult } from '../types';\n\n/**\n * Options for the useCustomizer hook\n */\nexport interface UseCustomizerOptions {\n /**\n * Auto-save design to localStorage\n */\n autoSave?: boolean;\n\n /**\n * localStorage key for auto-save\n * @default 'customizer-design'\n */\n autoSaveKey?: string;\n\n /**\n * Debounce time for auto-save in ms\n * @default 1000\n */\n autoSaveDebounce?: number;\n}\n\n/**\n * Return type for useCustomizer hook\n */\nexport interface UseCustomizerReturn {\n /**\n * Ref to attach to the Customizer component\n */\n customizerRef: React.RefObject<CustomizerHandle | null>;\n\n /**\n * Current design state\n */\n design: DesignJSON | null;\n\n /**\n * Whether undo is available\n */\n canUndo: boolean;\n\n /**\n * Whether redo is available\n */\n canRedo: boolean;\n\n /**\n * Selected layer ID\n */\n selectedLayerId: string | null;\n\n /**\n * Whether finalization is in progress\n */\n isFinalizing: boolean;\n\n /**\n * Finalization result\n */\n finalizeResult: FinalizeResult | null;\n\n /**\n * Get the current design\n */\n getDesign: () => DesignJSON | null;\n\n /**\n * Set a new design\n */\n setDesign: (design: DesignJSON) => void;\n\n /**\n * Undo the last action\n */\n undo: () => void;\n\n /**\n * Redo the last undone action\n */\n redo: () => void;\n\n /**\n * Finalize the design\n */\n finalize: () => Promise<FinalizeResult | null>;\n\n /**\n * Add a text layer\n */\n addTextLayer: (text?: string) => void;\n\n /**\n * Add an image layer\n */\n addImageLayer: (url: string) => Promise<void>;\n\n /**\n * Remove a layer\n */\n removeLayer: (layerId: string) => void;\n\n /**\n * Select a layer\n */\n selectLayer: (layerId: string | null) => void;\n}\n\n/**\n * React hook for controlling the customizer editor\n *\n * @example\n * ```tsx\n * import { Customizer } from '@varianta/sdk/react';\n * import { useCustomizer } from '@varianta/sdk/react';\n *\n * function App() {\n * const {\n * customizerRef,\n * design,\n * canUndo,\n * canRedo,\n * undo,\n * redo,\n * finalize,\n * isFinalizing,\n * } = useCustomizer({ autoSave: true });\n *\n * return (\n * <>\n * <Customizer\n * ref={customizerRef}\n * templateId=\"tshirt-001\"\n * onChange={(d) => console.log('Changed:', d)}\n * />\n * <button onClick={undo} disabled={!canUndo}>Undo</button>\n * <button onClick={redo} disabled={!canRedo}>Redo</button>\n * <button onClick={finalize} disabled={isFinalizing}>\n * {isFinalizing ? 'Finalizing...' : 'Finalize'}\n * </button>\n * </>\n * );\n * }\n * ```\n */\nexport function useCustomizer(\n options: UseCustomizerOptions = {}\n): UseCustomizerReturn {\n const {\n autoSave = false,\n autoSaveKey = 'customizer-design',\n autoSaveDebounce = 1000,\n } = options;\n\n const customizerRef = useRef<CustomizerHandle>(null);\n const [design, setDesign] = useState<DesignJSON | null>(null);\n const [canUndo, setCanUndo] = useState(false);\n const [canRedo, setCanRedo] = useState(false);\n const [selectedLayerId, setSelectedLayerId] = useState<string | null>(null);\n const [isFinalizing, setIsFinalizing] = useState(false);\n const [finalizeResult, setFinalizeResult] = useState<FinalizeResult | null>(\n null\n );\n\n const autoSaveTimeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);\n\n // Auto-save to localStorage\n useEffect(() => {\n if (!autoSave || !design) return;\n\n // Clear existing timeout\n if (autoSaveTimeoutRef.current) {\n clearTimeout(autoSaveTimeoutRef.current);\n }\n\n // Set new timeout\n autoSaveTimeoutRef.current = setTimeout(() => {\n try {\n localStorage.setItem(autoSaveKey, JSON.stringify(design));\n } catch (error) {\n console.error('[useCustomizer] Auto-save failed:', error);\n }\n }, autoSaveDebounce);\n\n return () => {\n if (autoSaveTimeoutRef.current) {\n clearTimeout(autoSaveTimeoutRef.current);\n }\n };\n }, [design, autoSave, autoSaveKey, autoSaveDebounce]);\n\n const getDesign = useCallback(() => {\n if (!customizerRef.current) return null;\n try {\n return customizerRef.current.getDesign();\n } catch (error) {\n console.error('[useCustomizer] getDesign failed:', error);\n return null;\n }\n }, []);\n\n const setDesignCallback = useCallback((newDesign: DesignJSON) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.setDesign(newDesign);\n setDesign(newDesign);\n } catch (error) {\n console.error('[useCustomizer] setDesign failed:', error);\n }\n }, []);\n\n const undo = useCallback(() => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.undo();\n setCanUndo(customizerRef.current.canUndo());\n setCanRedo(customizerRef.current.canRedo());\n } catch (error) {\n console.error('[useCustomizer] undo failed:', error);\n }\n }, []);\n\n const redo = useCallback(() => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.redo();\n setCanUndo(customizerRef.current.canUndo());\n setCanRedo(customizerRef.current.canRedo());\n } catch (error) {\n console.error('[useCustomizer] redo failed:', error);\n }\n }, []);\n\n const finalize = useCallback(async () => {\n if (!customizerRef.current || isFinalizing) return null;\n\n setIsFinalizing(true);\n try {\n const result = await customizerRef.current.finalize();\n setFinalizeResult(result);\n return result;\n } catch (error) {\n console.error('[useCustomizer] finalize failed:', error);\n return null;\n } finally {\n setIsFinalizing(false);\n }\n }, [isFinalizing]);\n\n const addTextLayer = useCallback((text?: string) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.addTextLayer(text);\n } catch (error) {\n console.error('[useCustomizer] addTextLayer failed:', error);\n }\n }, []);\n\n const addImageLayer = useCallback(async (url: string) => {\n if (!customizerRef.current) return;\n try {\n await customizerRef.current.addImageLayer(url);\n } catch (error) {\n console.error('[useCustomizer] addImageLayer failed:', error);\n }\n }, []);\n\n const removeLayer = useCallback((layerId: string) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.removeLayer(layerId);\n } catch (error) {\n console.error('[useCustomizer] removeLayer failed:', error);\n }\n }, []);\n\n const selectLayer = useCallback((layerId: string | null) => {\n if (!customizerRef.current) return;\n try {\n customizerRef.current.selectLayer(layerId);\n setSelectedLayerId(layerId);\n } catch (error) {\n console.error('[useCustomizer] selectLayer failed:', error);\n }\n }, []);\n\n return {\n customizerRef,\n design,\n canUndo,\n canRedo,\n selectedLayerId,\n isFinalizing,\n finalizeResult,\n getDesign,\n setDesign: setDesignCallback,\n undo,\n redo,\n finalize,\n addTextLayer,\n addImageLayer,\n removeLayer,\n selectLayer,\n };\n}\n"],"names":["Customizer","forwardRef","props","ref","templateId","productId","apiUrl","theme","mode","debug","className","style","initialDesign","onReady","onChange","onLayerSelect","onLayerAdd","onLayerRemove","onLayerUpdate","onError","onFinalize","onViewChange","containerRef","useRef","instanceRef","callbacksRef","useEffect","options","design","layerId","error","result","viewName","instance","initCustomizer","useImperativeHandle","text","url","newTheme","newMode","jsx","useCustomizer","autoSave","autoSaveKey","autoSaveDebounce","customizerRef","setDesign","useState","canUndo","setCanUndo","canRedo","setCanRedo","selectedLayerId","setSelectedLayerId","isFinalizing","setIsFinalizing","finalizeResult","setFinalizeResult","autoSaveTimeoutRef","getDesign","useCallback","setDesignCallback","newDesign","undo","redo","finalize","addTextLayer","addImageLayer","removeLayer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AgB;AACvD,QAAKQ,EAAc;AACnB,UAAI;AACF,cAAMA,EAAc,QAAQ,cAAcR,CAAG;AAAA,MAC/C,SAASP,GAAO;AACd,gBAAQ,MAAM,yCAAyCA,CAAK;AAAA,MAC9D;AAAA,EACF,GAAG,CAAA,CAAE,GAECsC,IAAcR,EAAY,CAAC/B,MAAoB;AACnD,QAAKgB,EAAc;AACnB,UAAI;AACF,QAAAA,EAAc,QAAQ,YAAYhB,CAAO;AAAA,MAC3C,SAASC,GAAO;AACd,gBAAQ,MAAM,uCAAuCA,CAAK;AAAA,MAC5D;AAAA,EACF,GAAG,CAAA,CAAE,GAECuC,IAAcT,EAAY,CAAC/B,MAA2B;AAC1D,QAAKgB,EAAc;AACnB,UAAI;AACF,QAAAA,EAAc,QAAQ,YAAYhB,CAAO,GACzCwB,EAAmBxB,CAAO;AAAA,MAC5B,SAASC,GAAO;AACd,gBAAQ,MAAM,uCAAuCA,CAAK;AAAA,MAC5D;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,eAAAe;AAAA,IACA,QAAAjB;AAAA,IACA,SAAAoB;AAAA,IACA,SAAAE;AAAA,IACA,iBAAAE;AAAA,IACA,cAAAE;AAAA,IACA,gBAAAE;AAAA,IACA,WAAAG;AAAA,IACA,WAAWE;AAAA,IACX,MAAAE;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,EAAA;AAEJ;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Customizer SDK -
|
|
2
|
+
* Customizer SDK - Vanilla JS SDK for product customization
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
export { initCustomizer } from './vanilla';
|
|
6
|
-
export { Customizer, useCustomizer } from './react';
|
|
7
|
-
export type { CustomizerProps, CustomizerHandle, UseCustomizerOptions, UseCustomizerReturn } from './react';
|
|
8
6
|
export type * from './types';
|
|
9
|
-
/**
|
|
10
|
-
* Note: Vue components should be imported from '@varianta/sdk/vue'
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { Customizer } from '@varianta/sdk/vue';
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,mBAAmB,SAAS,CAAC"}
|
|
@@ -9,9 +9,14 @@ import type { CustomizerInstance, DesignJSON, FinalizeResult, CustomizerError }
|
|
|
9
9
|
*/
|
|
10
10
|
export interface CustomizerProps {
|
|
11
11
|
/**
|
|
12
|
-
* Template ID to load
|
|
12
|
+
* Template ID to load. Required unless productId is provided.
|
|
13
13
|
*/
|
|
14
|
-
templateId
|
|
14
|
+
templateId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Product ID to load (fetches all views/templates for the product).
|
|
17
|
+
* Alternative to templateId. Exactly one of templateId or productId must be provided.
|
|
18
|
+
*/
|
|
19
|
+
productId?: string;
|
|
15
20
|
/**
|
|
16
21
|
* API base URL for fetching templates and finalizing designs
|
|
17
22
|
* @default 'https://api.varianta.io'
|
|
@@ -76,6 +81,10 @@ export interface CustomizerProps {
|
|
|
76
81
|
* Called when finalization is complete
|
|
77
82
|
*/
|
|
78
83
|
onFinalize?: (result: FinalizeResult) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Called when the active view changes (only relevant when using productId)
|
|
86
|
+
*/
|
|
87
|
+
onViewChange?: (viewName: string) => void;
|
|
79
88
|
}
|
|
80
89
|
/**
|
|
81
90
|
* Handle type exposed via ref
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Customizer.d.ts","sourceRoot":"","sources":["../../../src/react/Customizer.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAEV,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAExC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAEjD;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C;;OAEG;IACH,aAAa,CA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C,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAE3C;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAE9C;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;CAAG;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,UAAU,8GA+OtB,CAAC"}
|
|
@@ -100,14 +100,29 @@ export interface DesignJSON {
|
|
|
100
100
|
[key: string]: any;
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* View info for products with multiple templates
|
|
105
|
+
*/
|
|
106
|
+
export interface ViewInfo {
|
|
107
|
+
viewName: string;
|
|
108
|
+
viewOrder: number;
|
|
109
|
+
isRequired: boolean;
|
|
110
|
+
isDefault: boolean;
|
|
111
|
+
templateId: string;
|
|
112
|
+
}
|
|
103
113
|
/**
|
|
104
114
|
* Configuration options for initializing the customizer
|
|
105
115
|
*/
|
|
106
116
|
export interface CustomizerOptions {
|
|
107
117
|
/**
|
|
108
|
-
* Template ID to load
|
|
118
|
+
* Template ID to load. Required unless productId is provided.
|
|
109
119
|
*/
|
|
110
|
-
templateId
|
|
120
|
+
templateId?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Product ID to load (fetches all views/templates for the product).
|
|
123
|
+
* Alternative to templateId. Exactly one of templateId or productId must be provided.
|
|
124
|
+
*/
|
|
125
|
+
productId?: string;
|
|
111
126
|
/**
|
|
112
127
|
* API base URL for fetching templates and finalizing designs
|
|
113
128
|
* @default 'https://api.varianta.io'
|
|
@@ -168,6 +183,10 @@ export interface CustomizerOptions {
|
|
|
168
183
|
* Called when finalization is complete
|
|
169
184
|
*/
|
|
170
185
|
onFinalize?: (result: FinalizeResult) => void;
|
|
186
|
+
/**
|
|
187
|
+
* Called when the active view changes (only relevant when using productId)
|
|
188
|
+
*/
|
|
189
|
+
onViewChange?: (viewName: string) => void;
|
|
171
190
|
}
|
|
172
191
|
/**
|
|
173
192
|
* Error object returned by the customizer
|
|
@@ -238,6 +257,18 @@ export interface CustomizerInstance {
|
|
|
238
257
|
* Get the selected layer ID
|
|
239
258
|
*/
|
|
240
259
|
getSelectedLayerId(): string | null;
|
|
260
|
+
/**
|
|
261
|
+
* Get the currently active view name (null if not using productId)
|
|
262
|
+
*/
|
|
263
|
+
getActiveView(): string | null;
|
|
264
|
+
/**
|
|
265
|
+
* Get all available views (empty array if not using productId)
|
|
266
|
+
*/
|
|
267
|
+
getViews(): ViewInfo[];
|
|
268
|
+
/**
|
|
269
|
+
* Switch to a different view by name
|
|
270
|
+
*/
|
|
271
|
+
setActiveView(viewName: string): void;
|
|
241
272
|
/**
|
|
242
273
|
* Set the theme
|
|
243
274
|
*/
|
|
@@ -294,5 +325,8 @@ export interface CustomizerEditorElement extends HTMLElement {
|
|
|
294
325
|
removeLayer(layerId: string): void;
|
|
295
326
|
selectLayer(layerId: string | null): void;
|
|
296
327
|
getSelectedLayerId(): string | null;
|
|
328
|
+
getActiveView(): string | null;
|
|
329
|
+
getViews(): ViewInfo[];
|
|
330
|
+
setActiveView(viewName: string): void;
|
|
297
331
|
}
|
|
298
332
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM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AAsB;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,SAAS,IAAI,UAAU,CAAC;IACxB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,IAAI,OAAO,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC;IACnB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1C,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAAC;IACpC,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,IAAI,QAAQ,EAAE,CAAC;IACvB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAMnB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAC5B,iBAAiB,EAAE,WAAW,GAAG,MAAM,EACvC,OAAO,EAAE,iBAAiB,GACzB,kBAAkB,CA+UpB;AAED;;GAEG;AACH,mBAAmB,UAAU,CAAC"}
|