@vizor-vr/svelte 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ import { type VizorEventHandlers } from './vizor-action.js';
2
+ type $$ComponentProps = {
3
+ src?: string;
4
+ format?: string;
5
+ title?: string;
6
+ poster?: string;
7
+ loop?: boolean;
8
+ muted?: boolean;
9
+ preload?: 'auto' | 'metadata' | 'none';
10
+ apiKey?: string;
11
+ licenseKey?: string;
12
+ apiEndpoint?: string;
13
+ contentId?: string;
14
+ controlsBehavior?: 'autohide' | 'always' | 'minimal';
15
+ hideControls?: boolean;
16
+ primaryColor?: string;
17
+ collabServer?: string;
18
+ collabRoom?: string;
19
+ collabRole?: 'host' | 'viewer';
20
+ collabUserId?: string;
21
+ collabDisplayName?: string;
22
+ collabPassword?: string;
23
+ style?: string;
24
+ class?: string;
25
+ children?: any;
26
+ } & VizorEventHandlers & Record<string, any>;
27
+ /** Svelte wrapper for <vz-live>. */
28
+ declare const VzLive: import("svelte").Component<$$ComponentProps, {
29
+ getElement: () => HTMLElement | undefined;
30
+ play: () => void;
31
+ pause: () => void;
32
+ seekToLive: () => void;
33
+ }, "">;
34
+ type VzLive = ReturnType<typeof VzLive>;
35
+ export default VzLive;
36
+ //# sourceMappingURL=VzLive.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VzLive.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VzLive.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,gBAAgB,GAAI;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IACrD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAsE/C,oCAAoC;AACpC,QAAA,MAAM,MAAM;;;;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,87 @@
1
+ <!--
2
+ @component
3
+ Svelte wrapper for <vz-playlist>.
4
+ -->
5
+ <script lang="ts">
6
+ import { onMount, onDestroy } from 'svelte';
7
+ import '@vizor-vr/player/register';
8
+ import { vizorEvents, type VizorEventHandlers } from './vizor-action.js';
9
+
10
+ let {
11
+ autoplay = false,
12
+ loopPlaylist = false,
13
+ panel = undefined,
14
+ style = undefined,
15
+ class: className = undefined,
16
+ children,
17
+ onplaylistchange = undefined,
18
+ onplaylistend = undefined,
19
+ // Vizor event handlers
20
+ onxrsessionstart = undefined,
21
+ onxrsessionend = undefined,
22
+ onannotationclick = undefined,
23
+ onorientationchange = undefined,
24
+ onlicensevalidated = undefined,
25
+ oncaptionchange = undefined,
26
+ ...restProps
27
+ }: {
28
+ autoplay?: boolean;
29
+ loopPlaylist?: boolean;
30
+ panel?: 'none' | 'expandable';
31
+ style?: string;
32
+ class?: string;
33
+ children?: any;
34
+ onplaylistchange?: (detail: { index: number; title: string; total: number }) => void;
35
+ onplaylistend?: () => void;
36
+ } & Pick<VizorEventHandlers, 'onxrsessionstart' | 'onxrsessionend' | 'onannotationclick' | 'onorientationchange' | 'onlicensevalidated' | 'oncaptionchange'> & Record<string, any> = $props();
37
+
38
+ let el: HTMLElement | undefined = $state();
39
+ const cleanups: Array<() => void> = [];
40
+
41
+ onMount(() => {
42
+ if (!el) return;
43
+
44
+ if (onplaylistchange) {
45
+ const handler = (e: Event) => {
46
+ if (e instanceof CustomEvent) onplaylistchange!(e.detail);
47
+ };
48
+ el.addEventListener('vz-playlist-change', handler);
49
+ cleanups.push(() => el!.removeEventListener('vz-playlist-change', handler));
50
+ }
51
+
52
+ if (onplaylistend) {
53
+ const handler = () => onplaylistend!();
54
+ el.addEventListener('vz-playlist-end', handler);
55
+ cleanups.push(() => el!.removeEventListener('vz-playlist-end', handler));
56
+ }
57
+ });
58
+
59
+ onDestroy(() => {
60
+ for (const cleanup of cleanups) cleanup();
61
+ });
62
+
63
+ const eventHandlers: VizorEventHandlers = $derived({
64
+ onxrsessionstart, onxrsessionend, onannotationclick,
65
+ onorientationchange, onlicensevalidated, oncaptionchange,
66
+ });
67
+
68
+ export function getElement() { return el; }
69
+ export function next() { (el as any)?.next?.(); }
70
+ export function previous() { (el as any)?.previous?.(); }
71
+ export function goTo(index: number) { (el as any)?.goTo?.(index); }
72
+ </script>
73
+
74
+ <vz-playlist
75
+ bind:this={el}
76
+ use:vizorEvents={eventHandlers}
77
+ autoplay={autoplay || undefined}
78
+ loop-playlist={loopPlaylist || undefined}
79
+ {panel}
80
+ {style}
81
+ class={className}
82
+ {...restProps}
83
+ >
84
+ {#if children}
85
+ {@render children()}
86
+ {/if}
87
+ </vz-playlist>
@@ -0,0 +1,26 @@
1
+ import '@vizor-vr/player/register';
2
+ import { type VizorEventHandlers } from './vizor-action.js';
3
+ type $$ComponentProps = {
4
+ autoplay?: boolean;
5
+ loopPlaylist?: boolean;
6
+ panel?: 'none' | 'expandable';
7
+ style?: string;
8
+ class?: string;
9
+ children?: any;
10
+ onplaylistchange?: (detail: {
11
+ index: number;
12
+ title: string;
13
+ total: number;
14
+ }) => void;
15
+ onplaylistend?: () => void;
16
+ } & Pick<VizorEventHandlers, 'onxrsessionstart' | 'onxrsessionend' | 'onannotationclick' | 'onorientationchange' | 'onlicensevalidated' | 'oncaptionchange'> & Record<string, any>;
17
+ /** Svelte wrapper for <vz-playlist>. */
18
+ declare const VzPlaylist: import("svelte").Component<$$ComponentProps, {
19
+ getElement: () => HTMLElement | undefined;
20
+ next: () => void;
21
+ previous: () => void;
22
+ goTo: (index: number) => void;
23
+ }, "">;
24
+ type VzPlaylist = ReturnType<typeof VzPlaylist>;
25
+ export default VzPlaylist;
26
+ //# sourceMappingURL=VzPlaylist.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VzPlaylist.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VzPlaylist.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,gBAAgB,GAAI;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrF,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,GAAG,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,oBAAoB,GAAG,iBAAiB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAsErL,wCAAwC;AACxC,QAAA,MAAM,UAAU;;;;kBAbQ,MAAM;MAa0B,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -0,0 +1,83 @@
1
+ <!--
2
+ @component
3
+ Svelte wrapper for <vz-tour>.
4
+ -->
5
+ <script lang="ts">
6
+ import { vizorEvents, type VizorEventHandlers } from './vizor-action.js';
7
+
8
+ let {
9
+ src = undefined,
10
+ format = undefined,
11
+ title = undefined,
12
+ poster = undefined,
13
+ apiKey = undefined,
14
+ licenseKey = undefined,
15
+ apiEndpoint = undefined,
16
+ contentId = undefined,
17
+ controlsBehavior = undefined,
18
+ hideControls = false,
19
+ primaryColor = undefined,
20
+ style = undefined,
21
+ class: className = undefined,
22
+ onready = undefined,
23
+ onplay = undefined,
24
+ onpause = undefined,
25
+ onended = undefined,
26
+ ontimeupdate = undefined,
27
+ onerror = undefined,
28
+ onqualitychange = undefined,
29
+ onfullscreenenter = undefined,
30
+ onfullscreenexit = undefined,
31
+ onxrsessionstart = undefined,
32
+ onxrsessionend = undefined,
33
+ onannotationclick = undefined,
34
+ onorientationchange = undefined,
35
+ onlicensevalidated = undefined,
36
+ oncaptionchange = undefined,
37
+ ...restProps
38
+ }: {
39
+ src?: string;
40
+ format?: string;
41
+ title?: string;
42
+ poster?: string;
43
+ apiKey?: string;
44
+ licenseKey?: string;
45
+ apiEndpoint?: string;
46
+ contentId?: string;
47
+ controlsBehavior?: 'autohide' | 'always' | 'minimal';
48
+ hideControls?: boolean;
49
+ primaryColor?: string;
50
+ style?: string;
51
+ class?: string;
52
+ } & VizorEventHandlers & Record<string, any> = $props();
53
+
54
+ let el: HTMLElement | undefined = $state();
55
+
56
+ const eventHandlers: VizorEventHandlers = $derived({
57
+ onready, onplay, onpause, onended, ontimeupdate,
58
+ onerror, onqualitychange, onfullscreenenter, onfullscreenexit,
59
+ onxrsessionstart, onxrsessionend, onannotationclick,
60
+ onorientationchange, onlicensevalidated, oncaptionchange,
61
+ });
62
+
63
+ export function getElement() { return el; }
64
+ </script>
65
+
66
+ <vz-tour
67
+ bind:this={el}
68
+ use:vizorEvents={eventHandlers}
69
+ {src}
70
+ {format}
71
+ {title}
72
+ {poster}
73
+ api-key={apiKey}
74
+ license-key={licenseKey}
75
+ api-endpoint={apiEndpoint}
76
+ content-id={contentId}
77
+ controls-behavior={controlsBehavior}
78
+ hide-controls={hideControls || undefined}
79
+ primary-color={primaryColor}
80
+ {style}
81
+ class={className}
82
+ {...restProps}
83
+ />
@@ -0,0 +1,23 @@
1
+ import { type VizorEventHandlers } from './vizor-action.js';
2
+ type $$ComponentProps = {
3
+ src?: string;
4
+ format?: string;
5
+ title?: string;
6
+ poster?: string;
7
+ apiKey?: string;
8
+ licenseKey?: string;
9
+ apiEndpoint?: string;
10
+ contentId?: string;
11
+ controlsBehavior?: 'autohide' | 'always' | 'minimal';
12
+ hideControls?: boolean;
13
+ primaryColor?: string;
14
+ style?: string;
15
+ class?: string;
16
+ } & VizorEventHandlers & Record<string, any>;
17
+ /** Svelte wrapper for <vz-tour>. */
18
+ declare const VzTour: import("svelte").Component<$$ComponentProps, {
19
+ getElement: () => HTMLElement | undefined;
20
+ }, "">;
21
+ type VzTour = ReturnType<typeof VzTour>;
22
+ export default VzTour;
23
+ //# sourceMappingURL=VzTour.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VzTour.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VzTour.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,gBAAgB,GAAI;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IACrD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAqD/C,oCAAoC;AACpC,QAAA,MAAM,MAAM;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,135 @@
1
+ <!--
2
+ @component
3
+ Svelte wrapper for <vz-video>.
4
+
5
+ @example
6
+ ```svelte
7
+ <script>
8
+ import { VzVideo } from '@vizor-vr/svelte';
9
+ </script>
10
+
11
+ <VzVideo
12
+ src="video.mp4"
13
+ format="MONO_360"
14
+ style="width: 100%; aspect-ratio: 16/9"
15
+ onready={() => console.log('ready')}
16
+ />
17
+ ```
18
+ -->
19
+ <script lang="ts">
20
+ import { vizorEvents, type VizorEventHandlers } from './vizor-action.js';
21
+
22
+ /* ---- Props ---- */
23
+ let {
24
+ src = undefined,
25
+ format = undefined,
26
+ title = undefined,
27
+ poster = undefined,
28
+ loop = false,
29
+ muted = false,
30
+ preload = undefined,
31
+ apiKey = undefined,
32
+ licenseKey = undefined,
33
+ apiEndpoint = undefined,
34
+ contentId = undefined,
35
+ controlsBehavior = undefined,
36
+ hideControls = false,
37
+ primaryColor = undefined,
38
+ collabServer = undefined,
39
+ collabRoom = undefined,
40
+ collabRole = undefined,
41
+ collabUserId = undefined,
42
+ collabDisplayName = undefined,
43
+ collabPassword = undefined,
44
+ style = undefined,
45
+ class: className = undefined,
46
+ children,
47
+ // Event handlers
48
+ onready = undefined,
49
+ onplay = undefined,
50
+ onpause = undefined,
51
+ onended = undefined,
52
+ ontimeupdate = undefined,
53
+ onerror = undefined,
54
+ onqualitychange = undefined,
55
+ onfullscreenenter = undefined,
56
+ onfullscreenexit = undefined,
57
+ onxrsessionstart = undefined,
58
+ onxrsessionend = undefined,
59
+ onannotationclick = undefined,
60
+ onorientationchange = undefined,
61
+ onlicensevalidated = undefined,
62
+ oncaptionchange = undefined,
63
+ ...restProps
64
+ }: {
65
+ src?: string;
66
+ format?: string;
67
+ title?: string;
68
+ poster?: string;
69
+ loop?: boolean;
70
+ muted?: boolean;
71
+ preload?: 'auto' | 'metadata' | 'none';
72
+ apiKey?: string;
73
+ licenseKey?: string;
74
+ apiEndpoint?: string;
75
+ contentId?: string;
76
+ controlsBehavior?: 'autohide' | 'always' | 'minimal';
77
+ hideControls?: boolean;
78
+ primaryColor?: string;
79
+ collabServer?: string;
80
+ collabRoom?: string;
81
+ collabRole?: 'host' | 'viewer';
82
+ collabUserId?: string;
83
+ collabDisplayName?: string;
84
+ collabPassword?: string;
85
+ style?: string;
86
+ class?: string;
87
+ children?: any;
88
+ } & VizorEventHandlers & Record<string, any> = $props();
89
+
90
+ let el: HTMLElement | undefined = $state();
91
+
92
+ const eventHandlers: VizorEventHandlers = $derived({
93
+ onready, onplay, onpause, onended, ontimeupdate,
94
+ onerror, onqualitychange, onfullscreenenter, onfullscreenexit,
95
+ onxrsessionstart, onxrsessionend, onannotationclick,
96
+ onorientationchange, onlicensevalidated, oncaptionchange,
97
+ });
98
+
99
+ export function getElement() { return el; }
100
+ export function play() { (el as any)?.play?.(); }
101
+ export function pause() { (el as any)?.pause?.(); }
102
+ export function seek(time: number) { (el as any)?.seek?.(time); }
103
+ </script>
104
+
105
+ <vz-video
106
+ bind:this={el}
107
+ use:vizorEvents={eventHandlers}
108
+ {src}
109
+ {format}
110
+ {title}
111
+ {poster}
112
+ loop={loop || undefined}
113
+ muted={muted || undefined}
114
+ {preload}
115
+ api-key={apiKey}
116
+ license-key={licenseKey}
117
+ api-endpoint={apiEndpoint}
118
+ content-id={contentId}
119
+ controls-behavior={controlsBehavior}
120
+ hide-controls={hideControls || undefined}
121
+ primary-color={primaryColor}
122
+ collab-server={collabServer}
123
+ collab-room={collabRoom}
124
+ collab-role={collabRole}
125
+ collab-user-id={collabUserId}
126
+ collab-display-name={collabDisplayName}
127
+ collab-password={collabPassword}
128
+ {style}
129
+ class={className}
130
+ {...restProps}
131
+ >
132
+ {#if children}
133
+ {@render children()}
134
+ {/if}
135
+ </vz-video>
@@ -0,0 +1,52 @@
1
+ import { type VizorEventHandlers } from './vizor-action.js';
2
+ type $$ComponentProps = {
3
+ src?: string;
4
+ format?: string;
5
+ title?: string;
6
+ poster?: string;
7
+ loop?: boolean;
8
+ muted?: boolean;
9
+ preload?: 'auto' | 'metadata' | 'none';
10
+ apiKey?: string;
11
+ licenseKey?: string;
12
+ apiEndpoint?: string;
13
+ contentId?: string;
14
+ controlsBehavior?: 'autohide' | 'always' | 'minimal';
15
+ hideControls?: boolean;
16
+ primaryColor?: string;
17
+ collabServer?: string;
18
+ collabRoom?: string;
19
+ collabRole?: 'host' | 'viewer';
20
+ collabUserId?: string;
21
+ collabDisplayName?: string;
22
+ collabPassword?: string;
23
+ style?: string;
24
+ class?: string;
25
+ children?: any;
26
+ } & VizorEventHandlers & Record<string, any>;
27
+ /**
28
+ * Svelte wrapper for <vz-video>.
29
+ *
30
+ * @example
31
+ * ```svelte
32
+ * <script>
33
+ * import { VzVideo } from '@vizor-vr/svelte';
34
+ * </script>
35
+ *
36
+ * <VzVideo
37
+ * src="video.mp4"
38
+ * format="MONO_360"
39
+ * style="width: 100%; aspect-ratio: 16/9"
40
+ * onready={() => console.log('ready')}
41
+ * />
42
+ * ```
43
+ */
44
+ declare const VzVideo: import("svelte").Component<$$ComponentProps, {
45
+ getElement: () => HTMLElement | undefined;
46
+ play: () => void;
47
+ pause: () => void;
48
+ seek: (time: number) => void;
49
+ }, "">;
50
+ type VzVideo = ReturnType<typeof VzVideo>;
51
+ export default VzVideo;
52
+ //# sourceMappingURL=VzVideo.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VzVideo.svelte.d.ts","sourceRoot":"","sources":["../src/lib/VzVideo.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,gBAAgB,GAAI;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;IACrD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,GAAG,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAwE/C;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,OAAO;;;;iBA7BU,MAAM;MA6BwB,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @vizor-vr/svelte — Svelte wrappers for the Vizor VR Player
3
+ *
4
+ * @example
5
+ * ```svelte
6
+ * <script>
7
+ * import { VzVideo } from '@vizor-vr/svelte';
8
+ * </script>
9
+ *
10
+ * <VzVideo
11
+ * src="video.mp4"
12
+ * format="MONO_360"
13
+ * style="width: 100%; aspect-ratio: 16/9"
14
+ * onready={() => console.log('ready')}
15
+ * />
16
+ * ```
17
+ */
18
+ export { default as VzVideo } from './VzVideo.svelte';
19
+ export { default as VzImg } from './VzImg.svelte';
20
+ export { default as VzTour } from './VzTour.svelte';
21
+ export { default as VzCinema } from './VzCinema.svelte';
22
+ export { default as VzLive } from './VzLive.svelte';
23
+ export { default as VzPlaylist } from './VzPlaylist.svelte';
24
+ export { default as VzAnnotation } from './VzAnnotation.svelte';
25
+ export { default as VzCaption } from './VzCaption.svelte';
26
+ export { vizorEvents, type VizorEventHandlers } from './vizor-action.js';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @vizor-vr/svelte — Svelte wrappers for the Vizor VR Player
3
+ *
4
+ * @example
5
+ * ```svelte
6
+ * <script>
7
+ * import { VzVideo } from '@vizor-vr/svelte';
8
+ * </script>
9
+ *
10
+ * <VzVideo
11
+ * src="video.mp4"
12
+ * format="MONO_360"
13
+ * style="width: 100%; aspect-ratio: 16/9"
14
+ * onready={() => console.log('ready')}
15
+ * />
16
+ * ```
17
+ */
18
+ export { default as VzVideo } from './VzVideo.svelte';
19
+ export { default as VzImg } from './VzImg.svelte';
20
+ export { default as VzTour } from './VzTour.svelte';
21
+ export { default as VzCinema } from './VzCinema.svelte';
22
+ export { default as VzLive } from './VzLive.svelte';
23
+ export { default as VzPlaylist } from './VzPlaylist.svelte';
24
+ export { default as VzAnnotation } from './VzAnnotation.svelte';
25
+ export { default as VzCaption } from './VzCaption.svelte';
26
+ // Action (advanced usage)
27
+ export { vizorEvents } from './vizor-action.js';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Svelte action that attaches Vizor DOM event listeners to an element
3
+ * and dispatches them as Svelte component events.
4
+ */
5
+ import '@vizor-vr/player/register';
6
+ export type VizorEventHandlers = {
7
+ onready?: () => void;
8
+ onplay?: () => void;
9
+ onpause?: () => void;
10
+ onended?: () => void;
11
+ ontimeupdate?: (e: Event) => void;
12
+ onerror?: (detail: {
13
+ code: string;
14
+ message: string;
15
+ }) => void;
16
+ onqualitychange?: (detail: {
17
+ quality: string;
18
+ auto: boolean;
19
+ }) => void;
20
+ onfullscreenenter?: () => void;
21
+ onfullscreenexit?: () => void;
22
+ onxrsessionstart?: () => void;
23
+ onxrsessionend?: () => void;
24
+ onannotationclick?: (detail: {
25
+ id: string;
26
+ lat: number;
27
+ lon: number;
28
+ }) => void;
29
+ onorientationchange?: (detail: {
30
+ lat: number;
31
+ lon: number;
32
+ }) => void;
33
+ onlicensevalidated?: (detail: {
34
+ tier: string;
35
+ valid: boolean;
36
+ }) => void;
37
+ oncaptionchange?: (detail: {
38
+ lang: string;
39
+ label: string;
40
+ }) => void;
41
+ };
42
+ /**
43
+ * Svelte action for attaching Vizor event listeners.
44
+ *
45
+ * Usage:
46
+ * ```svelte
47
+ * <vz-video use:vizorEvents={{ onready, onplay }} />
48
+ * ```
49
+ */
50
+ export declare function vizorEvents(node: HTMLElement, handlers: VizorEventHandlers): {
51
+ update(newHandlers: VizorEventHandlers): void;
52
+ destroy(): void;
53
+ };
54
+ //# sourceMappingURL=vizor-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vizor-action.d.ts","sourceRoot":"","sources":["../src/lib/vizor-action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,2BAA2B,CAAC;AAyBnC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9D,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/E,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrE,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACrE,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB;wBAgCnD,kBAAkB;;EAOzC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Svelte action that attaches Vizor DOM event listeners to an element
3
+ * and dispatches them as Svelte component events.
4
+ */
5
+ // '/register' performs the side-effect element registration (the bare entry
6
+ // does not). SSR-safe: registration no-ops when there is no DOM.
7
+ import '@vizor-vr/player/register';
8
+ const EVENT_MAP = {
9
+ ready: { dom: 'vz-ready' },
10
+ play: { dom: 'play' },
11
+ pause: { dom: 'pause' },
12
+ ended: { dom: 'ended' },
13
+ timeupdate: { dom: 'timeupdate' },
14
+ error: { dom: 'vz-error', hasDetail: true },
15
+ qualitychange: { dom: 'vz-quality-change', hasDetail: true },
16
+ fullscreenenter: { dom: 'vz-fullscreen-enter' },
17
+ fullscreenexit: { dom: 'vz-fullscreen-exit' },
18
+ xrsessionstart: { dom: 'vz-xr-session-start' },
19
+ xrsessionend: { dom: 'vz-xr-session-end' },
20
+ annotationclick: { dom: 'vz-annotation-click', hasDetail: true },
21
+ orientationchange: { dom: 'vz-orientation-change', hasDetail: true },
22
+ licensevalidated: { dom: 'vz-license-validated', hasDetail: true },
23
+ captionchange: { dom: 'vz-caption-change', hasDetail: true },
24
+ };
25
+ /**
26
+ * Svelte action for attaching Vizor event listeners.
27
+ *
28
+ * Usage:
29
+ * ```svelte
30
+ * <vz-video use:vizorEvents={{ onready, onplay }} />
31
+ * ```
32
+ */
33
+ export function vizorEvents(node, handlers) {
34
+ const cleanups = [];
35
+ function attach(h) {
36
+ detach();
37
+ for (const [name, { dom, hasDetail }] of Object.entries(EVENT_MAP)) {
38
+ const handler = h[`on${name}`];
39
+ if (!handler)
40
+ continue;
41
+ const listener = (e) => {
42
+ if (hasDetail && e instanceof CustomEvent) {
43
+ handler(e.detail);
44
+ }
45
+ else {
46
+ handler(e);
47
+ }
48
+ };
49
+ node.addEventListener(dom, listener);
50
+ cleanups.push(() => node.removeEventListener(dom, listener));
51
+ }
52
+ }
53
+ function detach() {
54
+ for (const cleanup of cleanups)
55
+ cleanup();
56
+ cleanups.length = 0;
57
+ }
58
+ attach(handlers);
59
+ return {
60
+ update(newHandlers) {
61
+ attach(newHandlers);
62
+ },
63
+ destroy() {
64
+ detach();
65
+ },
66
+ };
67
+ }