js-cloudimage-360-view 4.1.2 → 4.1.4
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/README.md +4 -2
- package/dist/js-cloudimage-360-view.min.js +3 -3
- package/dist/react/{ci360-CbNlMnNZ.mjs → ci360-CILBSFAa.mjs} +578 -574
- package/dist/react/ci360-CILBSFAa.mjs.map +1 -0
- package/dist/react/ci360-TSs45Yhc.js +35 -0
- package/dist/react/ci360-TSs45Yhc.js.map +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +197 -161
- package/dist/react/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/react/ci360-COjOXkWS.js +0 -35
- package/dist/react/ci360-COjOXkWS.js.map +0 -1
- package/dist/react/ci360-CbNlMnNZ.mjs.map +0 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("react/jsx-runtime"),n=require("react");let I=null;function C(f,t){const[w,p]=n.useState(!1),a=n.useRef(null),l=n.useRef(null),m=n.useId();n.useEffect(()=>{if(typeof window>"u"||!f.current||t.autoInit===!1)return;let u=!0;const i=f.current;return(async()=>{try{if(I||(I=(await Promise.resolve().then(()=>require("./ci360-TSs45Yhc.js"))).default),!i||!u)return;i.id||(i.id=`ci360-${m.replace(/:/g,"")}`);const s={...t,onReady:c=>{var d;u&&(p(!0),(d=t.onReady)==null||d.call(t,c))}};l.current=new I,a.current=l.current.init(i,s)}catch(s){console.error("Failed to initialize CI360 viewer:",s)}})(),()=>{if(u=!1,a.current){try{a.current.destroy()}catch{}a.current=null}l.current=null,p(!1)}},[t.folder,t.filenameX,t.filenameY,t.imageListX,t.imageListY,t.amountX,t.amountY,t.theme,m]);const y=n.useCallback(()=>a.current,[]);return{viewer:a.current,isReady:w,getViewer:y}}const we=(f,t)=>{const{id:w,className:p,style:a,folder:l,apiVersion:m,filenameX:y,filenameY:u,imageListX:i,imageListY:v,indexZeroBase:s,amountX:c,amountY:d,draggable:g,swipeable:h,keys:V,keysReverse:S,autoplay:L,autoplayBehavior:T,playOnce:b,speed:O,autoplayReverse:Z,dragSpeed:F,dragReverse:X,stopAtEdges:Y,inertia:k,fullscreen:q,magnifier:z,pointerZoom:A,pinchZoom:B,bottomCircle:D,bottomCircleOffset:E,initialIconShown:j,hide360Logo:x,logoSrc:M,imageInfo:P,hints:N,theme:H,ciToken:$,ciFilters:G,ciTransformation:J,lazyload:K,hotspots:Q,hotspotTimelineOnClick:U,aspectRatio:W,onReady:_,onLoad:ee,onSpin:te,onAutoplayStart:oe,onAutoplayStop:re,onFullscreenOpen:ne,onFullscreenClose:ae,onZoomIn:ie,onZoomOut:se,onDragStart:le,onDragEnd:ue,onError:me,...fe}=f,ce=n.useRef(null),pe=n.useMemo(()=>({folder:l,apiVersion:m,filenameX:y,filenameY:u,imageListX:i,imageListY:v,indexZeroBase:s,amountX:c,amountY:d,draggable:g,swipeable:h,keys:V,keysReverse:S,autoplay:L,autoplayBehavior:T,playOnce:b,speed:O,autoplayReverse:Z,dragSpeed:F,dragReverse:X,stopAtEdges:Y,inertia:k,fullscreen:q,magnifier:z,pointerZoom:A,pinchZoom:B,bottomCircle:D,bottomCircleOffset:E,initialIconShown:j,hide360Logo:x,logoSrc:M,imageInfo:P,hints:N,theme:H,ciToken:$,ciFilters:G,ciTransformation:J,lazyload:K,hotspots:Q,hotspotTimelineOnClick:U,aspectRatio:W,onReady:_,onLoad:ee,onSpin:te,onAutoplayStart:oe,onAutoplayStop:re,onFullscreenOpen:ne,onFullscreenClose:ae,onZoomIn:ie,onZoomOut:se,onDragStart:le,onDragEnd:ue,onError:me}),[l,m,y,u,i,v,s,c,d,g,h,V,S,L,T,b,O,Z,F,X,Y,k,q,z,A,B,D,E,j,x,M,P,N,H,$,G,J,K,Q,U,W,_,ee,te,oe,re,ne,ae,ie,se,le,ue,me]),{getViewer:r}=C(ce,pe);return n.useImperativeHandle(t,()=>({moveLeft:(e=1)=>{var o;return(o=r())==null?void 0:o.moveLeft(!1,e)},moveRight:(e=1)=>{var o;return(o=r())==null?void 0:o.moveRight(!1,e)},moveTop:(e=1)=>{var o;return(o=r())==null?void 0:o.moveTop(!1,e)},moveBottom:(e=1)=>{var o;return(o=r())==null?void 0:o.moveBottom(!1,e)},play:()=>{var e;return(e=r())==null?void 0:e.play()},stop:()=>{var e;return(e=r())==null?void 0:e.stopAutoplay()},zoomIn:()=>{var e;return(e=r())==null?void 0:e.toggleZoom()},zoomOut:()=>{var e;return(e=r())==null?void 0:e.removeZoom()},goToFrame:(e,o)=>{var de;return(de=r())==null?void 0:de.animateToFrame(e,o)},getViewer:()=>r()}),[r]),ye.jsx("div",{ref:ce,id:w,className:p,style:a,...fe})},R=n.forwardRef(we);R.displayName="CI360Viewer";exports.CI360Viewer=R;exports.CI360ViewerDefault=R;exports.useCI360=C;exports.useCI360Default=C;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/react/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/react/useCI360.ts","../../src/react/CI360Viewer.tsx"],"sourcesContent":["import { useEffect, useRef, useState, useId, type RefObject } from 'react';\nimport type {\n CI360Config,\n CI360ViewerInstance,\n UseCI360Return,\n UseCI360Options,\n} from './types';\n\n// Import CI360 class dynamically to avoid SSR issues\nlet CI360Class: any = null;\n\n/**\n * Custom hook for integrating CI360 viewer with React\n *\n * @param containerRef - React ref to the container element\n * @param config - CI360 configuration options\n * @returns Object containing viewer instance and ready state\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const containerRef = useRef<HTMLDivElement>(null);\n * const { viewer, isReady } = useCI360(containerRef, {\n * folder: 'https://example.com/images/',\n * filenameX: 'image-{index}.jpg',\n * amountX: 36,\n * });\n *\n * return <div ref={containerRef} />;\n * }\n * ```\n */\nexport function useCI360(\n containerRef: RefObject<HTMLDivElement | null>,\n config: UseCI360Options\n): UseCI360Return {\n const [isReady, setIsReady] = useState(false);\n const viewerRef = useRef<CI360ViewerInstance | null>(null);\n const ci360Ref = useRef<any>(null);\n const uniqueId = useId();\n\n // Initialize viewer\n useEffect(() => {\n // SSR guard\n if (typeof window === 'undefined') return;\n if (!containerRef.current) return;\n if (config.autoInit === false) return;\n\n let isMounted = true;\n const container = containerRef.current;\n\n const initViewer = async () => {\n try {\n // Dynamically import CI360 to avoid SSR issues\n if (!CI360Class) {\n const module = await import('../ci360');\n CI360Class = module.default;\n }\n\n if (!container || !isMounted) return;\n\n // Set a unique ID on the container if not present\n if (!container.id) {\n container.id = `ci360-${uniqueId.replace(/:/g, '')}`;\n }\n\n // Wrap user callbacks to update React state\n const wrappedConfig: CI360Config = {\n ...config,\n onReady: (data) => {\n if (isMounted) {\n setIsReady(true);\n config.onReady?.(data);\n }\n },\n };\n\n // Create CI360 instance and initialize viewer\n ci360Ref.current = new CI360Class();\n viewerRef.current = ci360Ref.current.init(container, wrappedConfig);\n } catch (error) {\n console.error('Failed to initialize CI360 viewer:', error);\n }\n };\n\n initViewer();\n\n // Cleanup on unmount or when dependencies change\n return () => {\n isMounted = false;\n if (viewerRef.current) {\n try {\n viewerRef.current.destroy();\n } catch (e) {\n // Ignore errors during cleanup - element may already be detached\n }\n viewerRef.current = null;\n }\n ci360Ref.current = null;\n setIsReady(false);\n };\n }, [\n config.folder,\n config.filenameX,\n config.filenameY,\n config.imageListX,\n config.imageListY,\n config.amountX,\n config.amountY,\n config.theme,\n uniqueId,\n ]);\n\n return {\n viewer: viewerRef.current,\n isReady,\n };\n}\n\nexport default useCI360;\n","import {\n useRef,\n useImperativeHandle,\n forwardRef,\n useMemo,\n type ForwardRefRenderFunction,\n} from 'react';\nimport { useCI360 } from './useCI360';\nimport type {\n CI360ViewerProps,\n CI360ViewerRef,\n CI360Config,\n} from './types';\n\n/**\n * CI360Viewer React Component\n *\n * A declarative React wrapper for the CI360 360-degree image viewer.\n *\n * @example\n * ```tsx\n * import { CI360Viewer } from 'js-cloudimage-360-view/react';\n * import 'js-cloudimage-360-view/css';\n *\n * function ProductView() {\n * return (\n * <CI360Viewer\n * folder=\"https://example.com/images/\"\n * filenameX=\"product-{index}.jpg\"\n * amountX={36}\n * autoplay\n * fullscreen\n * />\n * );\n * }\n * ```\n *\n * @example With ref for imperative control\n * ```tsx\n * import { useRef } from 'react';\n * import { CI360Viewer, CI360ViewerRef } from 'js-cloudimage-360-view/react';\n *\n * function ProductView() {\n * const viewerRef = useRef<CI360ViewerRef>(null);\n *\n * return (\n * <>\n * <CI360Viewer\n * ref={viewerRef}\n * folder=\"https://example.com/images/\"\n * filenameX=\"{index}.jpg\"\n * amountX={36}\n * onSpin={(e) => console.log(`Frame: ${e.activeImageX}`)}\n * />\n * <button onClick={() => viewerRef.current?.play()}>Play</button>\n * <button onClick={() => viewerRef.current?.stop()}>Stop</button>\n * </>\n * );\n * }\n * ```\n */\nconst CI360ViewerComponent: ForwardRefRenderFunction<\n CI360ViewerRef,\n CI360ViewerProps\n> = (props, ref) => {\n const {\n // Container props\n id,\n className,\n style,\n\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n\n ...restProps\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Memoize config to prevent unnecessary re-initializations\n const config = useMemo<CI360Config>(\n () => ({\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n }),\n [\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n ]\n );\n\n const { viewer } = useCI360(containerRef, config);\n\n // Expose imperative methods via ref\n useImperativeHandle(\n ref,\n () => ({\n moveLeft: (steps = 1) => viewer?.moveLeft(false, steps),\n moveRight: (steps = 1) => viewer?.moveRight(false, steps),\n moveTop: (steps = 1) => viewer?.moveTop(false, steps),\n moveBottom: (steps = 1) => viewer?.moveBottom(false, steps),\n play: () => viewer?.play(),\n stop: () => viewer?.stopAutoplay(),\n zoomIn: () => viewer?.toggleZoom(),\n zoomOut: () => viewer?.removeZoom(),\n goToFrame: (frame: number, hotspotId?: string) =>\n viewer?.animateToFrame(frame, hotspotId),\n getViewer: () => viewer,\n }),\n [viewer]\n );\n\n return (\n <div\n ref={containerRef}\n id={id}\n className={className}\n style={style}\n {...restProps}\n />\n );\n};\n\nexport const CI360Viewer = forwardRef(CI360ViewerComponent);\nCI360Viewer.displayName = 'CI360Viewer';\n\nexport default CI360Viewer;\n"],"names":["CI360Class","useCI360","containerRef","config","isReady","setIsReady","useState","viewerRef","useRef","ci360Ref","uniqueId","useId","useEffect","isMounted","container","wrappedConfig","data","_a","error","CI360ViewerComponent","props","ref","id","className","style","folder","apiVersion","filenameX","filenameY","imageListX","imageListY","indexZeroBase","amountX","amountY","draggable","swipeable","keys","keysReverse","autoplay","autoplayBehavior","playOnce","speed","autoplayReverse","dragSpeed","dragReverse","stopAtEdges","inertia","fullscreen","magnifier","pointerZoom","pinchZoom","bottomCircle","bottomCircleOffset","initialIconShown","hide360Logo","logoSrc","imageInfo","hints","theme","ciToken","ciFilters","ciTransformation","lazyload","hotspots","hotspotTimelineOnClick","onReady","onLoad","onSpin","onAutoplayStart","onAutoplayStop","onFullscreenOpen","onFullscreenClose","onZoomIn","onZoomOut","onDragStart","onDragEnd","onError","restProps","useMemo","viewer","useImperativeHandle","steps","frame","hotspotId","jsx","CI360Viewer","forwardRef"],"mappings":"yIASA,IAAIA,EAAkB,KAuBf,SAASC,EACdC,EACAC,EACgB,CAChB,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtCC,EAAYC,EAAAA,OAAmC,IAAI,EACnDC,EAAWD,EAAAA,OAAY,IAAI,EAC3BE,EAAWC,EAAAA,MAAA,EAGjBC,OAAAA,EAAAA,UAAU,IAAM,CAId,GAFI,OAAO,OAAW,KAClB,CAACV,EAAa,SACdC,EAAO,WAAa,GAAO,OAE/B,IAAIU,EAAY,GAChB,MAAMC,EAAYZ,EAAa,QAoC/B,OAlCmB,SAAY,CAC7B,GAAI,CAOF,GALKF,IAEHA,GADe,MAAM,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,qBAAU,CAAA,GAClB,SAGlB,CAACc,GAAa,CAACD,EAAW,OAGzBC,EAAU,KACbA,EAAU,GAAK,SAASJ,EAAS,QAAQ,KAAM,EAAE,CAAC,IAIpD,MAAMK,EAA6B,CACjC,GAAGZ,EACH,QAAUa,GAAS,OACbH,IACFR,EAAW,EAAI,GACfY,EAAAd,EAAO,UAAP,MAAAc,EAAA,KAAAd,EAAiBa,GAErB,CAAA,EAIFP,EAAS,QAAU,IAAIT,EACvBO,EAAU,QAAUE,EAAS,QAAQ,KAAKK,EAAWC,CAAa,CACpE,OAASG,EAAO,CACd,QAAQ,MAAM,qCAAsCA,CAAK,CAC3D,CACF,GAEA,EAGO,IAAM,CAEX,GADAL,EAAY,GACRN,EAAU,QAAS,CACrB,GAAI,CACFA,EAAU,QAAQ,QAAA,CACpB,MAAY,CAEZ,CACAA,EAAU,QAAU,IACtB,CACAE,EAAS,QAAU,KACnBJ,EAAW,EAAK,CAClB,CACF,EAAG,CACDF,EAAO,OACPA,EAAO,UACPA,EAAO,UACPA,EAAO,WACPA,EAAO,WACPA,EAAO,QACPA,EA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GAAA,YAAAA,EAAQ,eAAeG,EAAOC,IAChC,UAAW,IAAMJ,CAAA,GAEnB,CAACA,CAAM,CAAA,EAIPK,GAAAA,IAAC,MAAA,CACC,IAAKlF,GACL,GAAAoB,EACA,UAAAC,EACA,MAAAC,EACC,GAAGqD,EAAA,CAAA,CAGV,EAEaQ,EAAcC,EAAAA,WAAWnE,EAAoB,EAC1DkE,EAAY,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/react/useCI360.ts","../../src/react/CI360Viewer.tsx"],"sourcesContent":["import { useEffect, useRef, useState, useId, useCallback, type RefObject } from 'react';\nimport type {\n CI360Config,\n CI360ViewerInstance,\n UseCI360Return,\n UseCI360Options,\n} from './types';\n\n// Import CI360 class dynamically to avoid SSR issues\nlet CI360Class: any = null;\n\n/**\n * Custom hook for integrating CI360 viewer with React\n *\n * @param containerRef - React ref to the container element\n * @param config - CI360 configuration options\n * @returns Object containing viewer instance and ready state\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const containerRef = useRef<HTMLDivElement>(null);\n * const { viewer, isReady } = useCI360(containerRef, {\n * folder: 'https://example.com/images/',\n * filenameX: 'image-{index}.jpg',\n * amountX: 36,\n * });\n *\n * return <div ref={containerRef} />;\n * }\n * ```\n */\nexport function useCI360(\n containerRef: RefObject<HTMLDivElement | null>,\n config: UseCI360Options\n): UseCI360Return {\n const [isReady, setIsReady] = useState(false);\n const viewerRef = useRef<CI360ViewerInstance | null>(null);\n const ci360Ref = useRef<any>(null);\n const uniqueId = useId();\n\n // Initialize viewer\n useEffect(() => {\n // SSR guard\n if (typeof window === 'undefined') return;\n if (!containerRef.current) return;\n if (config.autoInit === false) return;\n\n let isMounted = true;\n const container = containerRef.current;\n\n const initViewer = async () => {\n try {\n // Dynamically import CI360 to avoid SSR issues\n if (!CI360Class) {\n const module = await import('../ci360');\n CI360Class = module.default;\n }\n\n if (!container || !isMounted) return;\n\n // Set a unique ID on the container if not present\n if (!container.id) {\n container.id = `ci360-${uniqueId.replace(/:/g, '')}`;\n }\n\n // Wrap user callbacks to update React state\n const wrappedConfig: CI360Config = {\n ...config,\n onReady: (data) => {\n if (isMounted) {\n setIsReady(true);\n config.onReady?.(data);\n }\n },\n };\n\n // Create CI360 instance and initialize viewer\n ci360Ref.current = new CI360Class();\n viewerRef.current = ci360Ref.current.init(container, wrappedConfig);\n } catch (error) {\n console.error('Failed to initialize CI360 viewer:', error);\n }\n };\n\n initViewer();\n\n // Cleanup on unmount or when dependencies change\n return () => {\n isMounted = false;\n if (viewerRef.current) {\n try {\n viewerRef.current.destroy();\n } catch (e) {\n // Ignore errors during cleanup - element may already be detached\n }\n viewerRef.current = null;\n }\n ci360Ref.current = null;\n setIsReady(false);\n };\n }, [\n config.folder,\n config.filenameX,\n config.filenameY,\n config.imageListX,\n config.imageListY,\n config.amountX,\n config.amountY,\n config.theme,\n uniqueId,\n ]);\n\n // Stable getter to always return current viewer (avoids stale closures)\n const getViewer = useCallback(() => viewerRef.current, []);\n\n return {\n viewer: viewerRef.current,\n isReady,\n getViewer,\n };\n}\n\nexport default useCI360;\n","import {\n useRef,\n useImperativeHandle,\n forwardRef,\n useMemo,\n type ForwardRefRenderFunction,\n} from 'react';\nimport { useCI360 } from './useCI360';\nimport type {\n CI360ViewerProps,\n CI360ViewerRef,\n CI360Config,\n} from './types';\n\n/**\n * CI360Viewer React Component\n *\n * A declarative React wrapper for the CI360 360-degree image viewer.\n *\n * @example\n * ```tsx\n * import { CI360Viewer } from 'js-cloudimage-360-view/react';\n * import 'js-cloudimage-360-view/css';\n *\n * function ProductView() {\n * return (\n * <CI360Viewer\n * folder=\"https://example.com/images/\"\n * filenameX=\"product-{index}.jpg\"\n * amountX={36}\n * autoplay\n * fullscreen\n * />\n * );\n * }\n * ```\n *\n * @example With ref for imperative control\n * ```tsx\n * import { useRef } from 'react';\n * import { CI360Viewer, CI360ViewerRef } from 'js-cloudimage-360-view/react';\n *\n * function ProductView() {\n * const viewerRef = useRef<CI360ViewerRef>(null);\n *\n * return (\n * <>\n * <CI360Viewer\n * ref={viewerRef}\n * folder=\"https://example.com/images/\"\n * filenameX=\"{index}.jpg\"\n * amountX={36}\n * onSpin={(e) => console.log(`Frame: ${e.activeImageX}`)}\n * />\n * <button onClick={() => viewerRef.current?.play()}>Play</button>\n * <button onClick={() => viewerRef.current?.stop()}>Stop</button>\n * </>\n * );\n * }\n * ```\n */\nconst CI360ViewerComponent: ForwardRefRenderFunction<\n CI360ViewerRef,\n CI360ViewerProps\n> = (props, ref) => {\n const {\n // Container props\n id,\n className,\n style,\n\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Container\n aspectRatio,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n\n ...restProps\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Memoize config to prevent unnecessary re-initializations\n const config = useMemo<CI360Config>(\n () => ({\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Container\n aspectRatio,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n }),\n [\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Container\n aspectRatio,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n ]\n );\n\n const { getViewer } = useCI360(containerRef, config);\n\n // Expose imperative methods via ref\n // Use getViewer() inside methods to always get the current viewer instance,\n // avoiding stale closure issues when the viewer initializes after first render\n useImperativeHandle(\n ref,\n () => ({\n moveLeft: (steps = 1) => getViewer()?.moveLeft(false, steps),\n moveRight: (steps = 1) => getViewer()?.moveRight(false, steps),\n moveTop: (steps = 1) => getViewer()?.moveTop(false, steps),\n moveBottom: (steps = 1) => getViewer()?.moveBottom(false, steps),\n play: () => getViewer()?.play(),\n stop: () => getViewer()?.stopAutoplay(),\n zoomIn: () => getViewer()?.toggleZoom(),\n zoomOut: () => getViewer()?.removeZoom(),\n goToFrame: (frame: number, hotspotId?: string) =>\n getViewer()?.animateToFrame(frame, hotspotId),\n getViewer: () => getViewer(),\n }),\n [getViewer]\n );\n\n return (\n <div\n ref={containerRef}\n id={id}\n className={className}\n style={style}\n {...restProps}\n />\n );\n};\n\nexport const CI360Viewer = forwardRef(CI360ViewerComponent);\nCI360Viewer.displayName = 'CI360Viewer';\n\nexport default CI360Viewer;\n"],"names":["CI360Class","useCI360","containerRef","config","isReady","setIsReady","useState","viewerRef","useRef","ci360Ref","uniqueId","useId","useEffect","isMounted","container","wrappedConfig","data","_a","error","getViewer","useCallback","CI360ViewerComponent","props","ref","id","className","style","folder","apiVersion","filenameX","filenameY","imageListX","imageListY","indexZeroBase","amountX","amountY","draggable","swipeable","keys","keysReverse","autoplay","autoplayBehavior","playOnce","speed","autoplayReverse","dragSpeed","dragReverse","stopAtEdges","inertia","fullscreen","magnifier","pointerZoom","pinchZoom","bottomCircle","bottomCircleOffset","initialIconShown","hide360Logo","logoSrc","imageInfo","hints","theme","ciToken","ciFilters","ciTransformation","lazyload","hotspots","hotspotTimelineOnClick","aspectRatio","onReady","onLoad","onSpin","onAutoplayStart","onAutoplayStop","onFullscreenOpen","onFullscreenClose","onZoomIn","onZoomOut","onDragStart","onDragEnd","onError","restProps","useMemo","useImperativeHandle","steps","frame","hotspotId","jsx","CI360Viewer","forwardRef"],"mappings":"yIASA,IAAIA,EAAkB,KAuBf,SAASC,EACdC,EACAC,EACgB,CAChB,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtCC,EAAYC,EAAAA,OAAmC,IAAI,EACnDC,EAAWD,EAAAA,OA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C5B,UAAW,CAACmE,EAAeC,IAAA,QACzB,OAAApE,GAAAE,MAAA,YAAAF,GAAa,eAAemE,EAAOC,IACrC,UAAW,IAAMlE,EAAA,CAAU,GAE7B,CAACA,CAAS,CAAA,EAIVmE,GAAAA,IAAC,MAAA,CACC,IAAKpF,GACL,GAAAsB,EACA,UAAAC,EACA,MAAAC,EACC,GAAGsD,EAAA,CAAA,CAGV,EAEaO,EAAcC,EAAAA,WAAWnE,EAAoB,EAC1DkE,EAAY,YAAc"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
|
|
7
|
-
if (typeof window > "u" || !
|
|
1
|
+
import { jsx as de } from "react/jsx-runtime";
|
|
2
|
+
import { useState as fe, useRef as I, useId as ye, useEffect as we, useCallback as ve, forwardRef as Ie, useMemo as Ce, useImperativeHandle as Re } from "react";
|
|
3
|
+
let v = null;
|
|
4
|
+
function he(p, t) {
|
|
5
|
+
const [y, d] = fe(!1), n = I(null), s = I(null), u = ye();
|
|
6
|
+
we(() => {
|
|
7
|
+
if (typeof window > "u" || !p.current || t.autoInit === !1) return;
|
|
8
8
|
let l = !0;
|
|
9
|
-
const a =
|
|
9
|
+
const a = p.current;
|
|
10
10
|
return (async () => {
|
|
11
11
|
try {
|
|
12
|
-
if (
|
|
13
|
-
a.id || (a.id = `ci360-${
|
|
14
|
-
const
|
|
12
|
+
if (v || (v = (await import("./ci360-CILBSFAa.mjs")).default), !a || !l) return;
|
|
13
|
+
a.id || (a.id = `ci360-${u.replace(/:/g, "")}`);
|
|
14
|
+
const i = {
|
|
15
15
|
...t,
|
|
16
|
-
onReady: (
|
|
17
|
-
var
|
|
18
|
-
l && (d(!0), (
|
|
16
|
+
onReady: (m) => {
|
|
17
|
+
var c;
|
|
18
|
+
l && (d(!0), (c = t.onReady) == null || c.call(t, m));
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
s.current = new
|
|
22
|
-
} catch (
|
|
23
|
-
console.error("Failed to initialize CI360 viewer:",
|
|
21
|
+
s.current = new v(), n.current = s.current.init(a, i);
|
|
22
|
+
} catch (i) {
|
|
23
|
+
console.error("Failed to initialize CI360 viewer:", i);
|
|
24
24
|
}
|
|
25
25
|
})(), () => {
|
|
26
26
|
if (l = !1, n.current) {
|
|
@@ -41,166 +41,174 @@ function Re(c, t) {
|
|
|
41
41
|
t.amountX,
|
|
42
42
|
t.amountY,
|
|
43
43
|
t.theme,
|
|
44
|
-
|
|
45
|
-
])
|
|
44
|
+
u
|
|
45
|
+
]);
|
|
46
|
+
const f = ve(() => n.current, []);
|
|
47
|
+
return {
|
|
46
48
|
viewer: n.current,
|
|
47
|
-
isReady:
|
|
49
|
+
isReady: y,
|
|
50
|
+
getViewer: f
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
const
|
|
53
|
+
const ge = (p, t) => {
|
|
51
54
|
const {
|
|
52
55
|
// Container props
|
|
53
|
-
id:
|
|
56
|
+
id: y,
|
|
54
57
|
className: d,
|
|
55
58
|
style: n,
|
|
56
59
|
// Image source
|
|
57
60
|
folder: s,
|
|
58
|
-
apiVersion:
|
|
59
|
-
filenameX:
|
|
60
|
-
filenameY:
|
|
61
|
-
imageListX:
|
|
62
|
-
imageListY:
|
|
63
|
-
indexZeroBase:
|
|
61
|
+
apiVersion: u,
|
|
62
|
+
filenameX: f,
|
|
63
|
+
filenameY: l,
|
|
64
|
+
imageListX: a,
|
|
65
|
+
imageListY: w,
|
|
66
|
+
indexZeroBase: i,
|
|
64
67
|
amountX: m,
|
|
65
|
-
amountY:
|
|
68
|
+
amountY: c,
|
|
66
69
|
// Behavior
|
|
67
|
-
draggable:
|
|
68
|
-
swipeable:
|
|
69
|
-
keys:
|
|
70
|
-
keysReverse:
|
|
71
|
-
autoplay:
|
|
72
|
-
autoplayBehavior:
|
|
73
|
-
playOnce:
|
|
74
|
-
speed:
|
|
75
|
-
autoplayReverse:
|
|
76
|
-
dragSpeed:
|
|
77
|
-
dragReverse:
|
|
78
|
-
stopAtEdges:
|
|
79
|
-
inertia:
|
|
70
|
+
draggable: C,
|
|
71
|
+
swipeable: R,
|
|
72
|
+
keys: h,
|
|
73
|
+
keysReverse: g,
|
|
74
|
+
autoplay: V,
|
|
75
|
+
autoplayBehavior: L,
|
|
76
|
+
playOnce: S,
|
|
77
|
+
speed: T,
|
|
78
|
+
autoplayReverse: Z,
|
|
79
|
+
dragSpeed: F,
|
|
80
|
+
dragReverse: O,
|
|
81
|
+
stopAtEdges: X,
|
|
82
|
+
inertia: Y,
|
|
80
83
|
// UI Features
|
|
81
|
-
fullscreen:
|
|
82
|
-
magnifier:
|
|
83
|
-
pointerZoom:
|
|
84
|
-
pinchZoom:
|
|
85
|
-
bottomCircle:
|
|
86
|
-
bottomCircleOffset:
|
|
87
|
-
initialIconShown:
|
|
88
|
-
hide360Logo:
|
|
89
|
-
logoSrc:
|
|
90
|
-
imageInfo:
|
|
91
|
-
hints:
|
|
92
|
-
theme:
|
|
84
|
+
fullscreen: b,
|
|
85
|
+
magnifier: k,
|
|
86
|
+
pointerZoom: z,
|
|
87
|
+
pinchZoom: A,
|
|
88
|
+
bottomCircle: B,
|
|
89
|
+
bottomCircleOffset: D,
|
|
90
|
+
initialIconShown: E,
|
|
91
|
+
hide360Logo: x,
|
|
92
|
+
logoSrc: M,
|
|
93
|
+
imageInfo: N,
|
|
94
|
+
hints: j,
|
|
95
|
+
theme: q,
|
|
93
96
|
// Cloudimage CDN
|
|
94
|
-
ciToken:
|
|
95
|
-
ciFilters:
|
|
96
|
-
ciTransformation:
|
|
97
|
+
ciToken: H,
|
|
98
|
+
ciFilters: P,
|
|
99
|
+
ciTransformation: $,
|
|
97
100
|
// Loading
|
|
98
|
-
lazyload:
|
|
101
|
+
lazyload: G,
|
|
99
102
|
// Hotspots
|
|
100
|
-
hotspots:
|
|
101
|
-
hotspotTimelineOnClick:
|
|
103
|
+
hotspots: J,
|
|
104
|
+
hotspotTimelineOnClick: K,
|
|
105
|
+
// Container
|
|
106
|
+
aspectRatio: Q,
|
|
102
107
|
// Event callbacks
|
|
103
|
-
onReady:
|
|
104
|
-
onLoad:
|
|
105
|
-
onSpin:
|
|
106
|
-
onAutoplayStart:
|
|
107
|
-
onAutoplayStop:
|
|
108
|
-
onFullscreenOpen:
|
|
109
|
-
onFullscreenClose:
|
|
110
|
-
onZoomIn:
|
|
111
|
-
onZoomOut:
|
|
112
|
-
onDragStart:
|
|
113
|
-
onDragEnd:
|
|
114
|
-
onError:
|
|
115
|
-
...
|
|
116
|
-
} =
|
|
108
|
+
onReady: U,
|
|
109
|
+
onLoad: W,
|
|
110
|
+
onSpin: _,
|
|
111
|
+
onAutoplayStart: ee,
|
|
112
|
+
onAutoplayStop: te,
|
|
113
|
+
onFullscreenOpen: oe,
|
|
114
|
+
onFullscreenClose: re,
|
|
115
|
+
onZoomIn: ne,
|
|
116
|
+
onZoomOut: ae,
|
|
117
|
+
onDragStart: ie,
|
|
118
|
+
onDragEnd: se,
|
|
119
|
+
onError: le,
|
|
120
|
+
...ce
|
|
121
|
+
} = p, ue = I(null), pe = Ce(
|
|
117
122
|
() => ({
|
|
118
123
|
// Image source
|
|
119
124
|
folder: s,
|
|
120
|
-
apiVersion:
|
|
121
|
-
filenameX:
|
|
122
|
-
filenameY:
|
|
123
|
-
imageListX:
|
|
124
|
-
imageListY:
|
|
125
|
-
indexZeroBase:
|
|
125
|
+
apiVersion: u,
|
|
126
|
+
filenameX: f,
|
|
127
|
+
filenameY: l,
|
|
128
|
+
imageListX: a,
|
|
129
|
+
imageListY: w,
|
|
130
|
+
indexZeroBase: i,
|
|
126
131
|
amountX: m,
|
|
127
|
-
amountY:
|
|
132
|
+
amountY: c,
|
|
128
133
|
// Behavior
|
|
129
|
-
draggable:
|
|
130
|
-
swipeable:
|
|
131
|
-
keys:
|
|
132
|
-
keysReverse:
|
|
133
|
-
autoplay:
|
|
134
|
-
autoplayBehavior:
|
|
135
|
-
playOnce:
|
|
136
|
-
speed:
|
|
137
|
-
autoplayReverse:
|
|
138
|
-
dragSpeed:
|
|
139
|
-
dragReverse:
|
|
140
|
-
stopAtEdges:
|
|
141
|
-
inertia:
|
|
134
|
+
draggable: C,
|
|
135
|
+
swipeable: R,
|
|
136
|
+
keys: h,
|
|
137
|
+
keysReverse: g,
|
|
138
|
+
autoplay: V,
|
|
139
|
+
autoplayBehavior: L,
|
|
140
|
+
playOnce: S,
|
|
141
|
+
speed: T,
|
|
142
|
+
autoplayReverse: Z,
|
|
143
|
+
dragSpeed: F,
|
|
144
|
+
dragReverse: O,
|
|
145
|
+
stopAtEdges: X,
|
|
146
|
+
inertia: Y,
|
|
142
147
|
// UI Features
|
|
143
|
-
fullscreen:
|
|
144
|
-
magnifier:
|
|
145
|
-
pointerZoom:
|
|
146
|
-
pinchZoom:
|
|
147
|
-
bottomCircle:
|
|
148
|
-
bottomCircleOffset:
|
|
149
|
-
initialIconShown:
|
|
150
|
-
hide360Logo:
|
|
151
|
-
logoSrc:
|
|
152
|
-
imageInfo:
|
|
153
|
-
hints:
|
|
154
|
-
theme:
|
|
148
|
+
fullscreen: b,
|
|
149
|
+
magnifier: k,
|
|
150
|
+
pointerZoom: z,
|
|
151
|
+
pinchZoom: A,
|
|
152
|
+
bottomCircle: B,
|
|
153
|
+
bottomCircleOffset: D,
|
|
154
|
+
initialIconShown: E,
|
|
155
|
+
hide360Logo: x,
|
|
156
|
+
logoSrc: M,
|
|
157
|
+
imageInfo: N,
|
|
158
|
+
hints: j,
|
|
159
|
+
theme: q,
|
|
155
160
|
// Cloudimage CDN
|
|
156
|
-
ciToken:
|
|
157
|
-
ciFilters:
|
|
158
|
-
ciTransformation:
|
|
161
|
+
ciToken: H,
|
|
162
|
+
ciFilters: P,
|
|
163
|
+
ciTransformation: $,
|
|
159
164
|
// Loading
|
|
160
|
-
lazyload:
|
|
165
|
+
lazyload: G,
|
|
161
166
|
// Hotspots
|
|
162
|
-
hotspots:
|
|
163
|
-
hotspotTimelineOnClick:
|
|
167
|
+
hotspots: J,
|
|
168
|
+
hotspotTimelineOnClick: K,
|
|
169
|
+
// Container
|
|
170
|
+
aspectRatio: Q,
|
|
164
171
|
// Event callbacks
|
|
165
|
-
onReady:
|
|
166
|
-
onLoad:
|
|
167
|
-
onSpin:
|
|
168
|
-
onAutoplayStart:
|
|
169
|
-
onAutoplayStop:
|
|
170
|
-
onFullscreenOpen:
|
|
171
|
-
onFullscreenClose:
|
|
172
|
-
onZoomIn:
|
|
173
|
-
onZoomOut:
|
|
174
|
-
onDragStart:
|
|
175
|
-
onDragEnd:
|
|
176
|
-
onError:
|
|
172
|
+
onReady: U,
|
|
173
|
+
onLoad: W,
|
|
174
|
+
onSpin: _,
|
|
175
|
+
onAutoplayStart: ee,
|
|
176
|
+
onAutoplayStop: te,
|
|
177
|
+
onFullscreenOpen: oe,
|
|
178
|
+
onFullscreenClose: re,
|
|
179
|
+
onZoomIn: ne,
|
|
180
|
+
onZoomOut: ae,
|
|
181
|
+
onDragStart: ie,
|
|
182
|
+
onDragEnd: se,
|
|
183
|
+
onError: le
|
|
177
184
|
}),
|
|
178
185
|
[
|
|
179
186
|
// Image source
|
|
180
187
|
s,
|
|
181
|
-
|
|
188
|
+
u,
|
|
189
|
+
f,
|
|
182
190
|
l,
|
|
183
191
|
a,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
u,
|
|
192
|
+
w,
|
|
193
|
+
i,
|
|
187
194
|
m,
|
|
188
|
-
|
|
195
|
+
c,
|
|
189
196
|
// Behavior
|
|
197
|
+
C,
|
|
190
198
|
R,
|
|
191
199
|
h,
|
|
192
200
|
g,
|
|
201
|
+
V,
|
|
193
202
|
L,
|
|
194
203
|
S,
|
|
195
|
-
V,
|
|
196
204
|
T,
|
|
197
205
|
Z,
|
|
198
206
|
F,
|
|
199
207
|
O,
|
|
200
208
|
X,
|
|
201
209
|
Y,
|
|
202
|
-
b,
|
|
203
210
|
// UI Features
|
|
211
|
+
b,
|
|
204
212
|
k,
|
|
205
213
|
z,
|
|
206
214
|
A,
|
|
@@ -212,62 +220,90 @@ const he = (c, t) => {
|
|
|
212
220
|
N,
|
|
213
221
|
j,
|
|
214
222
|
q,
|
|
215
|
-
v,
|
|
216
223
|
// Cloudimage CDN
|
|
217
|
-
w,
|
|
218
224
|
H,
|
|
219
225
|
P,
|
|
220
|
-
// Loading
|
|
221
226
|
$,
|
|
222
|
-
//
|
|
227
|
+
// Loading
|
|
223
228
|
G,
|
|
229
|
+
// Hotspots
|
|
224
230
|
J,
|
|
225
|
-
// Event callbacks
|
|
226
231
|
K,
|
|
232
|
+
// Container
|
|
227
233
|
Q,
|
|
234
|
+
// Event callbacks
|
|
228
235
|
U,
|
|
229
236
|
W,
|
|
230
237
|
_,
|
|
231
238
|
ee,
|
|
232
239
|
te,
|
|
233
240
|
oe,
|
|
241
|
+
re,
|
|
234
242
|
ne,
|
|
235
243
|
ae,
|
|
236
|
-
|
|
237
|
-
se
|
|
244
|
+
ie,
|
|
245
|
+
se,
|
|
246
|
+
le
|
|
238
247
|
]
|
|
239
|
-
), {
|
|
240
|
-
return
|
|
248
|
+
), { getViewer: r } = he(ue, pe);
|
|
249
|
+
return Re(
|
|
241
250
|
t,
|
|
242
251
|
() => ({
|
|
243
|
-
moveLeft: (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
moveLeft: (e = 1) => {
|
|
253
|
+
var o;
|
|
254
|
+
return (o = r()) == null ? void 0 : o.moveLeft(!1, e);
|
|
255
|
+
},
|
|
256
|
+
moveRight: (e = 1) => {
|
|
257
|
+
var o;
|
|
258
|
+
return (o = r()) == null ? void 0 : o.moveRight(!1, e);
|
|
259
|
+
},
|
|
260
|
+
moveTop: (e = 1) => {
|
|
261
|
+
var o;
|
|
262
|
+
return (o = r()) == null ? void 0 : o.moveTop(!1, e);
|
|
263
|
+
},
|
|
264
|
+
moveBottom: (e = 1) => {
|
|
265
|
+
var o;
|
|
266
|
+
return (o = r()) == null ? void 0 : o.moveBottom(!1, e);
|
|
267
|
+
},
|
|
268
|
+
play: () => {
|
|
269
|
+
var e;
|
|
270
|
+
return (e = r()) == null ? void 0 : e.play();
|
|
271
|
+
},
|
|
272
|
+
stop: () => {
|
|
273
|
+
var e;
|
|
274
|
+
return (e = r()) == null ? void 0 : e.stopAutoplay();
|
|
275
|
+
},
|
|
276
|
+
zoomIn: () => {
|
|
277
|
+
var e;
|
|
278
|
+
return (e = r()) == null ? void 0 : e.toggleZoom();
|
|
279
|
+
},
|
|
280
|
+
zoomOut: () => {
|
|
281
|
+
var e;
|
|
282
|
+
return (e = r()) == null ? void 0 : e.removeZoom();
|
|
283
|
+
},
|
|
284
|
+
goToFrame: (e, o) => {
|
|
285
|
+
var me;
|
|
286
|
+
return (me = r()) == null ? void 0 : me.animateToFrame(e, o);
|
|
287
|
+
},
|
|
288
|
+
getViewer: () => r()
|
|
253
289
|
}),
|
|
254
|
-
[
|
|
255
|
-
), /* @__PURE__ */
|
|
290
|
+
[r]
|
|
291
|
+
), /* @__PURE__ */ de(
|
|
256
292
|
"div",
|
|
257
293
|
{
|
|
258
|
-
ref:
|
|
259
|
-
id:
|
|
294
|
+
ref: ue,
|
|
295
|
+
id: y,
|
|
260
296
|
className: d,
|
|
261
297
|
style: n,
|
|
262
|
-
...
|
|
298
|
+
...ce
|
|
263
299
|
}
|
|
264
300
|
);
|
|
265
|
-
},
|
|
266
|
-
|
|
301
|
+
}, Ve = Ie(ge);
|
|
302
|
+
Ve.displayName = "CI360Viewer";
|
|
267
303
|
export {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
304
|
+
Ve as CI360Viewer,
|
|
305
|
+
Ve as CI360ViewerDefault,
|
|
306
|
+
he as useCI360,
|
|
307
|
+
he as useCI360Default
|
|
272
308
|
};
|
|
273
309
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/react/useCI360.ts","../../src/react/CI360Viewer.tsx"],"sourcesContent":["import { useEffect, useRef, useState, useId, type RefObject } from 'react';\nimport type {\n CI360Config,\n CI360ViewerInstance,\n UseCI360Return,\n UseCI360Options,\n} from './types';\n\n// Import CI360 class dynamically to avoid SSR issues\nlet CI360Class: any = null;\n\n/**\n * Custom hook for integrating CI360 viewer with React\n *\n * @param containerRef - React ref to the container element\n * @param config - CI360 configuration options\n * @returns Object containing viewer instance and ready state\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const containerRef = useRef<HTMLDivElement>(null);\n * const { viewer, isReady } = useCI360(containerRef, {\n * folder: 'https://example.com/images/',\n * filenameX: 'image-{index}.jpg',\n * amountX: 36,\n * });\n *\n * return <div ref={containerRef} />;\n * }\n * ```\n */\nexport function useCI360(\n containerRef: RefObject<HTMLDivElement | null>,\n config: UseCI360Options\n): UseCI360Return {\n const [isReady, setIsReady] = useState(false);\n const viewerRef = useRef<CI360ViewerInstance | null>(null);\n const ci360Ref = useRef<any>(null);\n const uniqueId = useId();\n\n // Initialize viewer\n useEffect(() => {\n // SSR guard\n if (typeof window === 'undefined') return;\n if (!containerRef.current) return;\n if (config.autoInit === false) return;\n\n let isMounted = true;\n const container = containerRef.current;\n\n const initViewer = async () => {\n try {\n // Dynamically import CI360 to avoid SSR issues\n if (!CI360Class) {\n const module = await import('../ci360');\n CI360Class = module.default;\n }\n\n if (!container || !isMounted) return;\n\n // Set a unique ID on the container if not present\n if (!container.id) {\n container.id = `ci360-${uniqueId.replace(/:/g, '')}`;\n }\n\n // Wrap user callbacks to update React state\n const wrappedConfig: CI360Config = {\n ...config,\n onReady: (data) => {\n if (isMounted) {\n setIsReady(true);\n config.onReady?.(data);\n }\n },\n };\n\n // Create CI360 instance and initialize viewer\n ci360Ref.current = new CI360Class();\n viewerRef.current = ci360Ref.current.init(container, wrappedConfig);\n } catch (error) {\n console.error('Failed to initialize CI360 viewer:', error);\n }\n };\n\n initViewer();\n\n // Cleanup on unmount or when dependencies change\n return () => {\n isMounted = false;\n if (viewerRef.current) {\n try {\n viewerRef.current.destroy();\n } catch (e) {\n // Ignore errors during cleanup - element may already be detached\n }\n viewerRef.current = null;\n }\n ci360Ref.current = null;\n setIsReady(false);\n };\n }, [\n config.folder,\n config.filenameX,\n config.filenameY,\n config.imageListX,\n config.imageListY,\n config.amountX,\n config.amountY,\n config.theme,\n uniqueId,\n ]);\n\n return {\n viewer: viewerRef.current,\n isReady,\n };\n}\n\nexport default useCI360;\n","import {\n useRef,\n useImperativeHandle,\n forwardRef,\n useMemo,\n type ForwardRefRenderFunction,\n} from 'react';\nimport { useCI360 } from './useCI360';\nimport type {\n CI360ViewerProps,\n CI360ViewerRef,\n CI360Config,\n} from './types';\n\n/**\n * CI360Viewer React Component\n *\n * A declarative React wrapper for the CI360 360-degree image viewer.\n *\n * @example\n * ```tsx\n * import { CI360Viewer } from 'js-cloudimage-360-view/react';\n * import 'js-cloudimage-360-view/css';\n *\n * function ProductView() {\n * return (\n * <CI360Viewer\n * folder=\"https://example.com/images/\"\n * filenameX=\"product-{index}.jpg\"\n * amountX={36}\n * autoplay\n * fullscreen\n * />\n * );\n * }\n * ```\n *\n * @example With ref for imperative control\n * ```tsx\n * import { useRef } from 'react';\n * import { CI360Viewer, CI360ViewerRef } from 'js-cloudimage-360-view/react';\n *\n * function ProductView() {\n * const viewerRef = useRef<CI360ViewerRef>(null);\n *\n * return (\n * <>\n * <CI360Viewer\n * ref={viewerRef}\n * folder=\"https://example.com/images/\"\n * filenameX=\"{index}.jpg\"\n * amountX={36}\n * onSpin={(e) => console.log(`Frame: ${e.activeImageX}`)}\n * />\n * <button onClick={() => viewerRef.current?.play()}>Play</button>\n * <button onClick={() => viewerRef.current?.stop()}>Stop</button>\n * </>\n * );\n * }\n * ```\n */\nconst CI360ViewerComponent: ForwardRefRenderFunction<\n CI360ViewerRef,\n CI360ViewerProps\n> = (props, ref) => {\n const {\n // Container props\n id,\n className,\n style,\n\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n\n ...restProps\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Memoize config to prevent unnecessary re-initializations\n const config = useMemo<CI360Config>(\n () => ({\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n }),\n [\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n ]\n );\n\n const { viewer } = useCI360(containerRef, config);\n\n // Expose imperative methods via ref\n useImperativeHandle(\n ref,\n () => ({\n moveLeft: (steps = 1) => viewer?.moveLeft(false, steps),\n moveRight: (steps = 1) => viewer?.moveRight(false, steps),\n moveTop: (steps = 1) => viewer?.moveTop(false, steps),\n moveBottom: (steps = 1) => viewer?.moveBottom(false, steps),\n play: () => viewer?.play(),\n stop: () => viewer?.stopAutoplay(),\n zoomIn: () => viewer?.toggleZoom(),\n zoomOut: () => viewer?.removeZoom(),\n goToFrame: (frame: number, hotspotId?: string) =>\n viewer?.animateToFrame(frame, hotspotId),\n getViewer: () => viewer,\n }),\n [viewer]\n );\n\n return (\n <div\n ref={containerRef}\n id={id}\n className={className}\n style={style}\n {...restProps}\n />\n );\n};\n\nexport const CI360Viewer = forwardRef(CI360ViewerComponent);\nCI360Viewer.displayName = 'CI360Viewer';\n\nexport default CI360Viewer;\n"],"names":["CI360Class","useCI360","containerRef","config","isReady","setIsReady","useState","viewerRef","useRef","ci360Ref","uniqueId","useId","useEffect","isMounted","container","wrappedConfig","data","_a","error","CI360ViewerComponent","props","ref","id","className","style","folder","apiVersion","filenameX","filenameY","imageListX","imageListY","indexZeroBase","amountX","amountY","draggable","swipeable","keys","keysReverse","autoplay","autoplayBehavior","playOnce","speed","autoplayReverse","dragSpeed","dragReverse","stopAtEdges","inertia","fullscreen","magnifier","pointerZoom","pinchZoom","bottomCircle","bottomCircleOffset","initialIconShown","hide360Logo","logoSrc","imageInfo","hints","theme","ciToken","ciFilters","ciTransformation","lazyload","hotspots","hotspotTimelineOnClick","onReady","onLoad","onSpin","onAutoplayStart","onAutoplayStop","onFullscreenOpen","onFullscreenClose","onZoomIn","onZoomOut","onDragStart","onDragEnd","onError","restProps","useMemo","viewer","useImperativeHandle","steps","frame","hotspotId","jsx","CI360Viewer","forwardRef"],"mappings":";;AASA,IAAIA,IAAkB;AAuBf,SAASC,GACdC,GACAC,GACgB;AAChB,QAAM,CAACC,GAASC,CAAU,IAAIC,GAAS,EAAK,GACtCC,IAAYC,EAAmC,IAAI,GACnDC,IAAWD,EAAY,IAAI,GAC3BE,IAAWC,GAAA;AAGjB,SAAAC,GAAU,MAAM;AAId,QAFI,OAAO,SAAW,OAClB,CAACV,EAAa,WACdC,EAAO,aAAa,GAAO;AAE/B,QAAIU,IAAY;AAChB,UAAMC,IAAYZ,EAAa;AAoC/B,YAlCmB,YAAY;AAC7B,UAAI;AAOF,YALKF,MAEHA,KADe,MAAM,OAAO,sBAAU,GAClB,UAGlB,CAACc,KAAa,CAACD,EAAW;AAG9B,QAAKC,EAAU,OACbA,EAAU,KAAK,SAASJ,EAAS,QAAQ,MAAM,EAAE,CAAC;AAIpD,cAAMK,IAA6B;AAAA,UACjC,GAAGZ;AAAA,UACH,SAAS,CAACa,MAAS;;AACjB,YAA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,GAGI,EAAE,QAAAG,EAAA,IAAW9E,GAASC,IAAcC,EAAM;AAGhD,SAAA6E;AAAA,IACE3D;AAAA,IACA,OAAO;AAAA,MACL,UAAU,CAAC4D,IAAQ,MAAMF,KAAA,gBAAAA,EAAQ,SAAS,IAAOE;AAAA,MACjD,WAAW,CAACA,IAAQ,MAAMF,KAAA,gBAAAA,EAAQ,UAAU,IAAOE;AAAA,MACnD,SAAS,CAACA,IAAQ,MAAMF,KAAA,gBAAAA,EAAQ,QAAQ,IAAOE;AAAA,MAC/C,YAAY,CAACA,IAAQ,MAAMF,KAAA,gBAAAA,EAAQ,WAAW,IAAOE;AAAA,MACrD,MAAM,MAAMF,KAAA,gBAAAA,EAAQ;AAAA,MACpB,MAAM,MAAMA,KAAA,gBAAAA,EAAQ;AAAA,MACpB,QAAQ,MAAMA,KAAA,gBAAAA,EAAQ;AAAA,MACtB,SAAS,MAAMA,KAAA,gBAAAA,EAAQ;AAAA,MACvB,WAAW,CAACG,GAAeC,OACzBJ,KAAA,gBAAAA,EAAQ,eAAeG,GAAOC;AAAA,MAChC,WAAW,MAAMJ;AAAA,IAAA;AAAA,IAEnB,CAACA,CAAM;AAAA,EAAA,GAIP,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKlF;AAAA,MACL,IAAAoB;AAAA,MACA,WAAAC;AAAA,MACA,OAAAC;AAAA,MACC,GAAGqD;AAAA,IAAA;AAAA,EAAA;AAGV,GAEaQ,KAAcC,GAAWnE,EAAoB;AAC1DkE,GAAY,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/react/useCI360.ts","../../src/react/CI360Viewer.tsx"],"sourcesContent":["import { useEffect, useRef, useState, useId, useCallback, type RefObject } from 'react';\nimport type {\n CI360Config,\n CI360ViewerInstance,\n UseCI360Return,\n UseCI360Options,\n} from './types';\n\n// Import CI360 class dynamically to avoid SSR issues\nlet CI360Class: any = null;\n\n/**\n * Custom hook for integrating CI360 viewer with React\n *\n * @param containerRef - React ref to the container element\n * @param config - CI360 configuration options\n * @returns Object containing viewer instance and ready state\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const containerRef = useRef<HTMLDivElement>(null);\n * const { viewer, isReady } = useCI360(containerRef, {\n * folder: 'https://example.com/images/',\n * filenameX: 'image-{index}.jpg',\n * amountX: 36,\n * });\n *\n * return <div ref={containerRef} />;\n * }\n * ```\n */\nexport function useCI360(\n containerRef: RefObject<HTMLDivElement | null>,\n config: UseCI360Options\n): UseCI360Return {\n const [isReady, setIsReady] = useState(false);\n const viewerRef = useRef<CI360ViewerInstance | null>(null);\n const ci360Ref = useRef<any>(null);\n const uniqueId = useId();\n\n // Initialize viewer\n useEffect(() => {\n // SSR guard\n if (typeof window === 'undefined') return;\n if (!containerRef.current) return;\n if (config.autoInit === false) return;\n\n let isMounted = true;\n const container = containerRef.current;\n\n const initViewer = async () => {\n try {\n // Dynamically import CI360 to avoid SSR issues\n if (!CI360Class) {\n const module = await import('../ci360');\n CI360Class = module.default;\n }\n\n if (!container || !isMounted) return;\n\n // Set a unique ID on the container if not present\n if (!container.id) {\n container.id = `ci360-${uniqueId.replace(/:/g, '')}`;\n }\n\n // Wrap user callbacks to update React state\n const wrappedConfig: CI360Config = {\n ...config,\n onReady: (data) => {\n if (isMounted) {\n setIsReady(true);\n config.onReady?.(data);\n }\n },\n };\n\n // Create CI360 instance and initialize viewer\n ci360Ref.current = new CI360Class();\n viewerRef.current = ci360Ref.current.init(container, wrappedConfig);\n } catch (error) {\n console.error('Failed to initialize CI360 viewer:', error);\n }\n };\n\n initViewer();\n\n // Cleanup on unmount or when dependencies change\n return () => {\n isMounted = false;\n if (viewerRef.current) {\n try {\n viewerRef.current.destroy();\n } catch (e) {\n // Ignore errors during cleanup - element may already be detached\n }\n viewerRef.current = null;\n }\n ci360Ref.current = null;\n setIsReady(false);\n };\n }, [\n config.folder,\n config.filenameX,\n config.filenameY,\n config.imageListX,\n config.imageListY,\n config.amountX,\n config.amountY,\n config.theme,\n uniqueId,\n ]);\n\n // Stable getter to always return current viewer (avoids stale closures)\n const getViewer = useCallback(() => viewerRef.current, []);\n\n return {\n viewer: viewerRef.current,\n isReady,\n getViewer,\n };\n}\n\nexport default useCI360;\n","import {\n useRef,\n useImperativeHandle,\n forwardRef,\n useMemo,\n type ForwardRefRenderFunction,\n} from 'react';\nimport { useCI360 } from './useCI360';\nimport type {\n CI360ViewerProps,\n CI360ViewerRef,\n CI360Config,\n} from './types';\n\n/**\n * CI360Viewer React Component\n *\n * A declarative React wrapper for the CI360 360-degree image viewer.\n *\n * @example\n * ```tsx\n * import { CI360Viewer } from 'js-cloudimage-360-view/react';\n * import 'js-cloudimage-360-view/css';\n *\n * function ProductView() {\n * return (\n * <CI360Viewer\n * folder=\"https://example.com/images/\"\n * filenameX=\"product-{index}.jpg\"\n * amountX={36}\n * autoplay\n * fullscreen\n * />\n * );\n * }\n * ```\n *\n * @example With ref for imperative control\n * ```tsx\n * import { useRef } from 'react';\n * import { CI360Viewer, CI360ViewerRef } from 'js-cloudimage-360-view/react';\n *\n * function ProductView() {\n * const viewerRef = useRef<CI360ViewerRef>(null);\n *\n * return (\n * <>\n * <CI360Viewer\n * ref={viewerRef}\n * folder=\"https://example.com/images/\"\n * filenameX=\"{index}.jpg\"\n * amountX={36}\n * onSpin={(e) => console.log(`Frame: ${e.activeImageX}`)}\n * />\n * <button onClick={() => viewerRef.current?.play()}>Play</button>\n * <button onClick={() => viewerRef.current?.stop()}>Stop</button>\n * </>\n * );\n * }\n * ```\n */\nconst CI360ViewerComponent: ForwardRefRenderFunction<\n CI360ViewerRef,\n CI360ViewerProps\n> = (props, ref) => {\n const {\n // Container props\n id,\n className,\n style,\n\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Container\n aspectRatio,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n\n ...restProps\n } = props;\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n // Memoize config to prevent unnecessary re-initializations\n const config = useMemo<CI360Config>(\n () => ({\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Container\n aspectRatio,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n }),\n [\n // Image source\n folder,\n apiVersion,\n filenameX,\n filenameY,\n imageListX,\n imageListY,\n indexZeroBase,\n amountX,\n amountY,\n\n // Behavior\n draggable,\n swipeable,\n keys,\n keysReverse,\n autoplay,\n autoplayBehavior,\n playOnce,\n speed,\n autoplayReverse,\n dragSpeed,\n dragReverse,\n stopAtEdges,\n inertia,\n\n // UI Features\n fullscreen,\n magnifier,\n pointerZoom,\n pinchZoom,\n bottomCircle,\n bottomCircleOffset,\n initialIconShown,\n hide360Logo,\n logoSrc,\n imageInfo,\n hints,\n theme,\n\n // Cloudimage CDN\n ciToken,\n ciFilters,\n ciTransformation,\n\n // Loading\n lazyload,\n\n // Hotspots\n hotspots,\n hotspotTimelineOnClick,\n\n // Container\n aspectRatio,\n\n // Event callbacks\n onReady,\n onLoad,\n onSpin,\n onAutoplayStart,\n onAutoplayStop,\n onFullscreenOpen,\n onFullscreenClose,\n onZoomIn,\n onZoomOut,\n onDragStart,\n onDragEnd,\n onError,\n ]\n );\n\n const { getViewer } = useCI360(containerRef, config);\n\n // Expose imperative methods via ref\n // Use getViewer() inside methods to always get the current viewer instance,\n // avoiding stale closure issues when the viewer initializes after first render\n useImperativeHandle(\n ref,\n () => ({\n moveLeft: (steps = 1) => getViewer()?.moveLeft(false, steps),\n moveRight: (steps = 1) => getViewer()?.moveRight(false, steps),\n moveTop: (steps = 1) => getViewer()?.moveTop(false, steps),\n moveBottom: (steps = 1) => getViewer()?.moveBottom(false, steps),\n play: () => getViewer()?.play(),\n stop: () => getViewer()?.stopAutoplay(),\n zoomIn: () => getViewer()?.toggleZoom(),\n zoomOut: () => getViewer()?.removeZoom(),\n goToFrame: (frame: number, hotspotId?: string) =>\n getViewer()?.animateToFrame(frame, hotspotId),\n getViewer: () => getViewer(),\n }),\n [getViewer]\n );\n\n return (\n <div\n ref={containerRef}\n id={id}\n className={className}\n style={style}\n {...restProps}\n />\n );\n};\n\nexport const CI360Viewer = forwardRef(CI360ViewerComponent);\nCI360Viewer.displayName = 'CI360Viewer';\n\nexport default CI360Viewer;\n"],"names":["CI360Class","useCI360","containerRef","config","isReady","setIsReady","useState","viewerRef","useRef","ci360Ref","uniqueId","useId","useEffect","isMounted","container","wrappedConfig","data","_a","error","getViewer","useCallback","CI360ViewerComponent","props","ref","id","className","style","folder","apiVersion","filenameX","filenameY","imageListX","imageListY","indexZeroBase","amountX","amountY","draggable","swipeable","keys","keysReverse","autoplay","autoplayBehavior","playOnce","speed","autoplayReverse","dragSpeed","dragReverse","stopAtEdges","inertia","fullscreen","magnifier","pointerZoom","pinchZoom","bottomCircle","bottomCircleOffset","initialIconShown","hide360Logo","logoSrc","imageInfo","hints","theme","ciToken","ciFilters","ciTransformation","lazyload","hotspots","hotspotTimelineOnClick","aspectRatio","onReady","onLoad","onSpin","onAutoplayStart","onAutoplayStop","onFullscreenOpen","onFullscreenClose","onZoomIn","onZoomOut","onDragStart","onDragEnd","onError","restProps","useMemo","useImperativeHandle","steps","frame","hotspotId","jsx","CI360Viewer","forwardRef"],"mappings":";;AASA,IAAIA,IAAkB;AAuBf,SAASC,GACdC,GACAC,GACgB;AAChB,QAAM,CAACC,GAASC,CAAU,IAAIC,GAAS,EAAK,GACtCC,IAAYC,EAAmC,IAAI,GACnDC,IAAWD,EAAY,IAAI,GAC3BE,IAAWC,GAAA;AAGjB,EAAAC,GAAU,MAAM;AAId,QAFI,OAAO,SAAW,OAClB,CAACV,EAAa,WACdC,EAAO,aAAa,GAAO;AAE/B,QAAIU,IAAY;AAChB,UAAMC,IAAYZ,EAAa;AAoC/B,YAlCmB,YAAY;AAC7B,UAAI;AAOF,YALKF,MAEHA,KADe,MAAM,OAAO,sBAAU,GAClB,UAGlB,CAACc,KAAa,CAACD,EAAW;AAG9B,QAAKC,EAAU,OACbA,EAAU,KAAK,SAASJ,EAAS,QAAQ,MAAM,EAAE,CAAC;AAIpD,cAAMK,IAA6B;AAAA,UACjC,GAAGZ;AAAA,UACH,SAAS,CAACa,MAAS;;AACjB,YAAIH,MACFR,EAAW,EAAI,IACfY,IAAAd,EAAO,YAAP,QAAAc,EAAA,KAAAd,GAAiBa;AAAA,UAErB;AAAA,QAAA;AAIF,QAAA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