@threlte/xr 0.1.0 → 0.1.1

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.
@@ -3,28 +3,21 @@
3
3
  import { SvelteComponent } from "svelte";
4
4
  declare const __propDef: {
5
5
  props: {
6
- force?: "enter" | "exit";
7
- styled?: boolean;
8
- form?: string | null | undefined;
9
- radiogroup?: string | null | undefined;
10
6
  name?: string | null | undefined;
7
+ type?: "button" | "submit" | "reset" | null | undefined;
11
8
  style?: string | null | undefined;
12
- disabled?: boolean | null | undefined;
13
- formaction?: string | null | undefined;
14
- formenctype?: string | null | undefined;
15
- formmethod?: string | null | undefined;
16
- formnovalidate?: boolean | null | undefined;
17
- formtarget?: string | null | undefined;
18
- type?: "submit" | "reset" | "button" | null | undefined;
9
+ class?: string | null | undefined;
10
+ typeof?: string | null | undefined;
19
11
  value?: string | number | string[] | null | undefined;
12
+ form?: string | null | undefined;
13
+ radiogroup?: string | null | undefined;
20
14
  accesskey?: string | null | undefined;
21
15
  autofocus?: boolean | null | undefined;
22
- class?: string | null | undefined;
23
16
  contenteditable?: import("svelte/elements").Booleanish | "inherit" | null | undefined;
24
17
  contextmenu?: string | null | undefined;
25
18
  dir?: string | null | undefined;
26
19
  draggable?: import("svelte/elements").Booleanish | null | undefined;
27
- enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | null | undefined;
20
+ enterkeyhint?: "search" | "done" | "enter" | "go" | "next" | "previous" | "send" | null | undefined;
28
21
  hidden?: boolean | null | undefined;
29
22
  id?: string | null | undefined;
30
23
  lang?: string | null | undefined;
@@ -43,7 +36,6 @@ declare const __propDef: {
43
36
  prefix?: string | null | undefined;
44
37
  property?: string | null | undefined;
45
38
  resource?: string | null | undefined;
46
- typeof?: string | null | undefined;
47
39
  vocab?: string | null | undefined;
48
40
  autocapitalize?: string | null | undefined;
49
41
  autocorrect?: string | null | undefined;
@@ -56,8 +48,8 @@ declare const __propDef: {
56
48
  itemref?: string | null | undefined;
57
49
  results?: number | null | undefined;
58
50
  security?: string | null | undefined;
59
- unselectable?: "on" | "off" | null | undefined;
60
- inputmode?: "url" | "search" | "none" | "text" | "tel" | "email" | "numeric" | "decimal" | null | undefined;
51
+ unselectable?: "off" | "on" | null | undefined;
52
+ inputmode?: "search" | "numeric" | "decimal" | "none" | "text" | "tel" | "url" | "email" | null | undefined;
61
53
  is?: string | null | undefined;
62
54
  'bind:innerHTML'?: string | null | undefined;
63
55
  'bind:textContent'?: string | null | undefined;
@@ -74,9 +66,9 @@ declare const __propDef: {
74
66
  'data-sveltekit-replacestate'?: true | "" | "off" | null | undefined;
75
67
  'aria-activedescendant'?: string | null | undefined;
76
68
  'aria-atomic'?: import("svelte/elements").Booleanish | null | undefined;
77
- 'aria-autocomplete'?: "inline" | "list" | "none" | "both" | null | undefined;
69
+ 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | null | undefined;
78
70
  'aria-busy'?: import("svelte/elements").Booleanish | null | undefined;
79
- 'aria-checked'?: boolean | "true" | "false" | "mixed" | null | undefined;
71
+ 'aria-checked'?: boolean | "false" | "true" | "mixed" | null | undefined;
80
72
  'aria-colcount'?: number | null | undefined;
81
73
  'aria-colindex'?: number | null | undefined;
82
74
  'aria-colspan'?: number | null | undefined;
@@ -90,7 +82,7 @@ declare const __propDef: {
90
82
  'aria-expanded'?: import("svelte/elements").Booleanish | null | undefined;
91
83
  'aria-flowto'?: string | null | undefined;
92
84
  'aria-grabbed'?: import("svelte/elements").Booleanish | null | undefined;
93
- 'aria-haspopup'?: import("svelte/elements").Booleanish | "dialog" | "grid" | "listbox" | "menu" | "tree" | null | undefined;
85
+ 'aria-haspopup'?: import("svelte/elements").Booleanish | "menu" | "listbox" | "tree" | "grid" | "dialog" | null | undefined;
94
86
  'aria-hidden'?: import("svelte/elements").Booleanish | null | undefined;
95
87
  'aria-invalid'?: import("svelte/elements").Booleanish | "grammar" | "spelling" | null | undefined;
96
88
  'aria-keyshortcuts'?: string | null | undefined;
@@ -105,9 +97,9 @@ declare const __propDef: {
105
97
  'aria-owns'?: string | null | undefined;
106
98
  'aria-placeholder'?: string | null | undefined;
107
99
  'aria-posinset'?: number | null | undefined;
108
- 'aria-pressed'?: boolean | "true" | "false" | "mixed" | null | undefined;
100
+ 'aria-pressed'?: boolean | "false" | "true" | "mixed" | null | undefined;
109
101
  'aria-readonly'?: import("svelte/elements").Booleanish | null | undefined;
110
- 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | null | undefined;
102
+ 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | null | undefined;
111
103
  'aria-required'?: import("svelte/elements").Booleanish | null | undefined;
112
104
  'aria-roledescription'?: string | null | undefined;
113
105
  'aria-rowcount'?: number | null | undefined;
@@ -115,7 +107,7 @@ declare const __propDef: {
115
107
  'aria-rowspan'?: number | null | undefined;
116
108
  'aria-selected'?: import("svelte/elements").Booleanish | null | undefined;
117
109
  'aria-setsize'?: number | null | undefined;
118
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | null | undefined;
110
+ 'aria-sort'?: "other" | "none" | "ascending" | "descending" | null | undefined;
119
111
  'aria-valuemax'?: number | null | undefined;
120
112
  'aria-valuemin'?: number | null | undefined;
121
113
  'aria-valuenow'?: number | null | undefined;
@@ -223,11 +215,19 @@ declare const __propDef: {
223
215
  'on:close'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
224
216
  'on:fullscreenchange'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
225
217
  'on:fullscreenerror'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
226
- sessionInit?: XRSessionInit & {
218
+ disabled?: boolean | null | undefined;
219
+ formaction?: string | null | undefined;
220
+ formenctype?: string | null | undefined;
221
+ formmethod?: string | null | undefined;
222
+ formnovalidate?: boolean | null | undefined;
223
+ formtarget?: string | null | undefined;
224
+ force?: "enter" | "exit" | undefined;
225
+ styled?: boolean | undefined;
226
+ sessionInit?: (XRSessionInit & {
227
227
  domOverlay?: {
228
228
  root: HTMLElement;
229
229
  } | undefined;
230
- };
230
+ }) | undefined;
231
231
  };
232
232
  events: {
233
233
  click: CustomEvent<{
@@ -1,5 +1,7 @@
1
- <script context='module'>import { Group } from "three";
2
- import { T, useThrelte, createRawEventDispatcher, useFrame } from "@threlte/core";
1
+ <script
2
+
3
+ context="module"
4
+ >import { T, useThrelte, createRawEventDispatcher, useTask } from "@threlte/core";
3
5
  import { isHandTracking, handDispatchers } from "../internal/stores";
4
6
  import { left as leftStore, right as rightStore } from "../hooks/useHand";
5
7
  import ScenePortal from "./internal/ScenePortal.svelte";
@@ -22,18 +24,21 @@ $:
22
24
  $:
23
25
  handDispatchers[$handedness].set(dispatch);
24
26
  let children;
25
- const { start, stop } = useFrame(() => {
26
- const frame = xr.getFrame();
27
- const joint = inputSource.get("wrist");
28
- if (joint === void 0 || space === null)
29
- return;
30
- const pose = frame.getJointPose?.(joint, space);
31
- if (pose === void 0 || pose === null)
32
- return;
33
- const { position, orientation } = pose.transform;
34
- children.position.set(position.x, position.y, position.z);
35
- children.quaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);
36
- }, { autostart: false });
27
+ const { start, stop } = useTask(
28
+ () => {
29
+ const frame = xr.getFrame();
30
+ const joint = inputSource.get("wrist");
31
+ if (joint === void 0 || space === null)
32
+ return;
33
+ const pose = frame.getJointPose?.(joint, space);
34
+ if (pose === void 0 || pose === null)
35
+ return;
36
+ const { position, orientation } = pose.transform;
37
+ children.position.set(position.x, position.y, position.z);
38
+ children.quaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);
39
+ },
40
+ { autoStart: false }
41
+ );
37
42
  $:
38
43
  if ($isHandTracking && ($$slots.wrist || $$slots.default) && inputSource) {
39
44
  start();
@@ -57,7 +62,7 @@ $:
57
62
 
58
63
  {#if $$slots['target-ray'] !== undefined}
59
64
  <T is={$store.targetRay}>
60
- <slot name='target-ray' />
65
+ <slot name="target-ray" />
61
66
  </T>
62
67
  {/if}
63
68
  {/if}
@@ -65,7 +70,7 @@ $:
65
70
  {#if $isHandTracking}
66
71
  <ScenePortal>
67
72
  <T.Group bind:ref={children}>
68
- <slot name='wrist' />
73
+ <slot name="wrist" />
69
74
  <slot />
70
75
  </T.Group>
71
76
  </ScenePortal>
@@ -2,28 +2,21 @@
2
2
  import { SvelteComponent } from "svelte";
3
3
  declare const __propDef: {
4
4
  props: {
5
- force?: "enter" | "exit";
6
- styled?: boolean;
7
- form?: string | null | undefined;
8
- radiogroup?: string | null | undefined;
9
5
  name?: string | null | undefined;
6
+ type?: "button" | "submit" | "reset" | null | undefined;
10
7
  style?: string | null | undefined;
11
- disabled?: boolean | null | undefined;
12
- formaction?: string | null | undefined;
13
- formenctype?: string | null | undefined;
14
- formmethod?: string | null | undefined;
15
- formnovalidate?: boolean | null | undefined;
16
- formtarget?: string | null | undefined;
17
- type?: "submit" | "reset" | "button" | null | undefined;
8
+ class?: string | null | undefined;
9
+ typeof?: string | null | undefined;
18
10
  value?: string | number | string[] | null | undefined;
11
+ form?: string | null | undefined;
12
+ radiogroup?: string | null | undefined;
19
13
  accesskey?: string | null | undefined;
20
14
  autofocus?: boolean | null | undefined;
21
- class?: string | null | undefined;
22
15
  contenteditable?: import("svelte/elements").Booleanish | "inherit" | null | undefined;
23
16
  contextmenu?: string | null | undefined;
24
17
  dir?: string | null | undefined;
25
18
  draggable?: import("svelte/elements").Booleanish | null | undefined;
26
- enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | null | undefined;
19
+ enterkeyhint?: "search" | "done" | "enter" | "go" | "next" | "previous" | "send" | null | undefined;
27
20
  hidden?: boolean | null | undefined;
28
21
  id?: string | null | undefined;
29
22
  lang?: string | null | undefined;
@@ -42,7 +35,6 @@ declare const __propDef: {
42
35
  prefix?: string | null | undefined;
43
36
  property?: string | null | undefined;
44
37
  resource?: string | null | undefined;
45
- typeof?: string | null | undefined;
46
38
  vocab?: string | null | undefined;
47
39
  autocapitalize?: string | null | undefined;
48
40
  autocorrect?: string | null | undefined;
@@ -55,8 +47,8 @@ declare const __propDef: {
55
47
  itemref?: string | null | undefined;
56
48
  results?: number | null | undefined;
57
49
  security?: string | null | undefined;
58
- unselectable?: "on" | "off" | null | undefined;
59
- inputmode?: "url" | "search" | "none" | "text" | "tel" | "email" | "numeric" | "decimal" | null | undefined;
50
+ unselectable?: "off" | "on" | null | undefined;
51
+ inputmode?: "search" | "numeric" | "decimal" | "none" | "text" | "tel" | "url" | "email" | null | undefined;
60
52
  is?: string | null | undefined;
61
53
  'bind:innerHTML'?: string | null | undefined;
62
54
  'bind:textContent'?: string | null | undefined;
@@ -73,9 +65,9 @@ declare const __propDef: {
73
65
  'data-sveltekit-replacestate'?: true | "" | "off" | null | undefined;
74
66
  'aria-activedescendant'?: string | null | undefined;
75
67
  'aria-atomic'?: import("svelte/elements").Booleanish | null | undefined;
76
- 'aria-autocomplete'?: "inline" | "list" | "none" | "both" | null | undefined;
68
+ 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | null | undefined;
77
69
  'aria-busy'?: import("svelte/elements").Booleanish | null | undefined;
78
- 'aria-checked'?: boolean | "true" | "false" | "mixed" | null | undefined;
70
+ 'aria-checked'?: boolean | "false" | "true" | "mixed" | null | undefined;
79
71
  'aria-colcount'?: number | null | undefined;
80
72
  'aria-colindex'?: number | null | undefined;
81
73
  'aria-colspan'?: number | null | undefined;
@@ -89,7 +81,7 @@ declare const __propDef: {
89
81
  'aria-expanded'?: import("svelte/elements").Booleanish | null | undefined;
90
82
  'aria-flowto'?: string | null | undefined;
91
83
  'aria-grabbed'?: import("svelte/elements").Booleanish | null | undefined;
92
- 'aria-haspopup'?: import("svelte/elements").Booleanish | "dialog" | "grid" | "listbox" | "menu" | "tree" | null | undefined;
84
+ 'aria-haspopup'?: import("svelte/elements").Booleanish | "menu" | "listbox" | "tree" | "grid" | "dialog" | null | undefined;
93
85
  'aria-hidden'?: import("svelte/elements").Booleanish | null | undefined;
94
86
  'aria-invalid'?: import("svelte/elements").Booleanish | "grammar" | "spelling" | null | undefined;
95
87
  'aria-keyshortcuts'?: string | null | undefined;
@@ -104,9 +96,9 @@ declare const __propDef: {
104
96
  'aria-owns'?: string | null | undefined;
105
97
  'aria-placeholder'?: string | null | undefined;
106
98
  'aria-posinset'?: number | null | undefined;
107
- 'aria-pressed'?: boolean | "true" | "false" | "mixed" | null | undefined;
99
+ 'aria-pressed'?: boolean | "false" | "true" | "mixed" | null | undefined;
108
100
  'aria-readonly'?: import("svelte/elements").Booleanish | null | undefined;
109
- 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | null | undefined;
101
+ 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | null | undefined;
110
102
  'aria-required'?: import("svelte/elements").Booleanish | null | undefined;
111
103
  'aria-roledescription'?: string | null | undefined;
112
104
  'aria-rowcount'?: number | null | undefined;
@@ -114,7 +106,7 @@ declare const __propDef: {
114
106
  'aria-rowspan'?: number | null | undefined;
115
107
  'aria-selected'?: import("svelte/elements").Booleanish | null | undefined;
116
108
  'aria-setsize'?: number | null | undefined;
117
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | null | undefined;
109
+ 'aria-sort'?: "other" | "none" | "ascending" | "descending" | null | undefined;
118
110
  'aria-valuemax'?: number | null | undefined;
119
111
  'aria-valuemin'?: number | null | undefined;
120
112
  'aria-valuenow'?: number | null | undefined;
@@ -222,6 +214,14 @@ declare const __propDef: {
222
214
  'on:close'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
223
215
  'on:fullscreenchange'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
224
216
  'on:fullscreenerror'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
217
+ disabled?: boolean | null | undefined;
218
+ formaction?: string | null | undefined;
219
+ formenctype?: string | null | undefined;
220
+ formmethod?: string | null | undefined;
221
+ formnovalidate?: boolean | null | undefined;
222
+ formtarget?: string | null | undefined;
223
+ force?: "enter" | "exit" | undefined;
224
+ styled?: boolean | undefined;
225
225
  };
226
226
  events: {
227
227
  click: CustomEvent<{
@@ -9,7 +9,7 @@ declare const __propDef: {
9
9
  * 0 = no foveation, full resolution
10
10
  *
11
11
  * 1 = maximum foveation, the edges render at lower resolution
12
- */ foveation?: number;
12
+ */ foveation?: number | undefined;
13
13
  /**
14
14
  * The target framerate for the XRSystem. Smaller rates give more CPU headroom at the cost of responsiveness.
15
15
  * Recommended range is `72`-`120`. Default is unset and left to the device.
@@ -18,7 +18,7 @@ declare const __propDef: {
18
18
  * headroom based on your experience.
19
19
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Rendering#refresh_rate_and_frame_rate
20
20
  */ frameRate?: number | undefined;
21
- /** Type of WebXR reference space to use. Default is `local-floor` */ referenceSpace?: XRReferenceSpaceType;
21
+ /** Type of WebXR reference space to use. Default is `local-floor` */ referenceSpace?: XRReferenceSpaceType | undefined;
22
22
  };
23
23
  slots: {
24
24
  default: {};
@@ -11,7 +11,7 @@ declare const __propDef: {
11
11
  formnovalidate?: boolean | null | undefined;
12
12
  formtarget?: string | null | undefined;
13
13
  name?: string | null | undefined;
14
- type?: "submit" | "reset" | "button" | null | undefined;
14
+ type?: "button" | "submit" | "reset" | null | undefined;
15
15
  value?: string | number | string[] | null | undefined;
16
16
  accesskey?: string | null | undefined;
17
17
  autofocus?: boolean | null | undefined;
@@ -20,7 +20,7 @@ declare const __propDef: {
20
20
  contextmenu?: string | null | undefined;
21
21
  dir?: string | null | undefined;
22
22
  draggable?: import("svelte/elements").Booleanish | null | undefined;
23
- enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | null | undefined;
23
+ enterkeyhint?: "search" | "done" | "enter" | "go" | "next" | "previous" | "send" | null | undefined;
24
24
  hidden?: boolean | null | undefined;
25
25
  id?: string | null | undefined;
26
26
  lang?: string | null | undefined;
@@ -54,8 +54,8 @@ declare const __propDef: {
54
54
  itemref?: string | null | undefined;
55
55
  results?: number | null | undefined;
56
56
  security?: string | null | undefined;
57
- unselectable?: "on" | "off" | null | undefined;
58
- inputmode?: "url" | "search" | "none" | "text" | "tel" | "email" | "numeric" | "decimal" | null | undefined;
57
+ unselectable?: "off" | "on" | null | undefined;
58
+ inputmode?: "search" | "numeric" | "decimal" | "none" | "text" | "tel" | "url" | "email" | null | undefined;
59
59
  is?: string | null | undefined;
60
60
  'bind:innerHTML'?: string | null | undefined;
61
61
  'bind:textContent'?: string | null | undefined;
@@ -72,9 +72,9 @@ declare const __propDef: {
72
72
  'data-sveltekit-replacestate'?: true | "" | "off" | null | undefined;
73
73
  'aria-activedescendant'?: string | null | undefined;
74
74
  'aria-atomic'?: import("svelte/elements").Booleanish | null | undefined;
75
- 'aria-autocomplete'?: "inline" | "list" | "none" | "both" | null | undefined;
75
+ 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | null | undefined;
76
76
  'aria-busy'?: import("svelte/elements").Booleanish | null | undefined;
77
- 'aria-checked'?: boolean | "true" | "false" | "mixed" | null | undefined;
77
+ 'aria-checked'?: boolean | "false" | "true" | "mixed" | null | undefined;
78
78
  'aria-colcount'?: number | null | undefined;
79
79
  'aria-colindex'?: number | null | undefined;
80
80
  'aria-colspan'?: number | null | undefined;
@@ -88,7 +88,7 @@ declare const __propDef: {
88
88
  'aria-expanded'?: import("svelte/elements").Booleanish | null | undefined;
89
89
  'aria-flowto'?: string | null | undefined;
90
90
  'aria-grabbed'?: import("svelte/elements").Booleanish | null | undefined;
91
- 'aria-haspopup'?: import("svelte/elements").Booleanish | "dialog" | "grid" | "listbox" | "menu" | "tree" | null | undefined;
91
+ 'aria-haspopup'?: import("svelte/elements").Booleanish | "menu" | "listbox" | "tree" | "grid" | "dialog" | null | undefined;
92
92
  'aria-hidden'?: import("svelte/elements").Booleanish | null | undefined;
93
93
  'aria-invalid'?: import("svelte/elements").Booleanish | "grammar" | "spelling" | null | undefined;
94
94
  'aria-keyshortcuts'?: string | null | undefined;
@@ -103,9 +103,9 @@ declare const __propDef: {
103
103
  'aria-owns'?: string | null | undefined;
104
104
  'aria-placeholder'?: string | null | undefined;
105
105
  'aria-posinset'?: number | null | undefined;
106
- 'aria-pressed'?: boolean | "true" | "false" | "mixed" | null | undefined;
106
+ 'aria-pressed'?: boolean | "false" | "true" | "mixed" | null | undefined;
107
107
  'aria-readonly'?: import("svelte/elements").Booleanish | null | undefined;
108
- 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | null | undefined;
108
+ 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | null | undefined;
109
109
  'aria-required'?: import("svelte/elements").Booleanish | null | undefined;
110
110
  'aria-roledescription'?: string | null | undefined;
111
111
  'aria-rowcount'?: number | null | undefined;
@@ -113,7 +113,7 @@ declare const __propDef: {
113
113
  'aria-rowspan'?: number | null | undefined;
114
114
  'aria-selected'?: import("svelte/elements").Booleanish | null | undefined;
115
115
  'aria-setsize'?: number | null | undefined;
116
- 'aria-sort'?: "none" | "ascending" | "descending" | "other" | null | undefined;
116
+ 'aria-sort'?: "other" | "none" | "ascending" | "descending" | null | undefined;
117
117
  'aria-valuemax'?: number | null | undefined;
118
118
  'aria-valuemin'?: number | null | undefined;
119
119
  'aria-valuenow'?: number | null | undefined;
@@ -222,13 +222,13 @@ declare const __propDef: {
222
222
  'on:fullscreenchange'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
223
223
  'on:fullscreenerror'?: import("svelte/elements").EventHandler<Event<EventTarget>, HTMLButtonElement> | null | undefined;
224
224
  mode: XRSessionMode;
225
- sessionInit?: XRSessionInit & {
225
+ sessionInit?: (XRSessionInit & {
226
226
  domOverlay?: {
227
227
  root: HTMLElement;
228
228
  } | undefined;
229
- };
230
- force?: 'enter' | 'exit';
231
- styled?: boolean;
229
+ }) | undefined;
230
+ force?: "enter" | "exit" | undefined;
231
+ styled?: boolean | undefined;
232
232
  };
233
233
  events: {
234
234
  click: CustomEvent<{
@@ -3,9 +3,9 @@ import { SvelteComponent } from "svelte";
3
3
  import { type ColorRepresentation } from 'three';
4
4
  declare const __propDef: {
5
5
  props: {
6
- color?: ColorRepresentation;
7
- size?: number;
8
- thickness?: number;
6
+ color?: ColorRepresentation | undefined;
7
+ size?: number | undefined;
8
+ thickness?: number | undefined;
9
9
  };
10
10
  events: {
11
11
  [evt: string]: CustomEvent<any>;
@@ -1,5 +1,5 @@
1
1
  <script>import { Group, Vector3, Matrix3 } from "three";
2
- import { T, useFrame } from "@threlte/core";
2
+ import { T, useTask } from "@threlte/core";
3
3
  import { pointerIntersection, pointerState } from "../../internal/stores";
4
4
  import Cursor from "./Cursor.svelte";
5
5
  export let handedness;
@@ -11,7 +11,7 @@ $:
11
11
  hovering = $pointerState[handedness].hovering;
12
12
  $:
13
13
  intersection = pointerIntersection[handedness];
14
- const { start, stop } = useFrame(
14
+ const { start, stop } = useTask(
15
15
  () => {
16
16
  if (intersection.current === void 0)
17
17
  return;
@@ -24,7 +24,7 @@ const { start, stop } = useFrame(
24
24
  }
25
25
  },
26
26
  {
27
- autostart: false
27
+ autoStart: false
28
28
  }
29
29
  );
30
30
  $:
@@ -1,6 +1,6 @@
1
1
  <script>import { spring } from "svelte/motion";
2
2
  import { Group, Matrix3, Vector3 } from "three";
3
- import { T, useFrame } from "@threlte/core";
3
+ import { T, useTask } from "@threlte/core";
4
4
  import { teleportIntersection } from "../../internal/stores";
5
5
  import Cursor from "./Cursor.svelte";
6
6
  export let handedness;
@@ -10,7 +10,7 @@ const normalMatrix = new Matrix3();
10
10
  const worldNormal = new Vector3();
11
11
  $:
12
12
  intersection = teleportIntersection[handedness];
13
- const { start, stop } = useFrame(
13
+ const { start, stop } = useTask(
14
14
  () => {
15
15
  if (intersection.current === void 0)
16
16
  return;
@@ -23,7 +23,7 @@ const { start, stop } = useFrame(
23
23
  }
24
24
  },
25
25
  {
26
- autostart: false
26
+ autoStart: false
27
27
  }
28
28
  );
29
29
  const size = spring(0.1, { stiffness: 0.2 });
@@ -2,7 +2,7 @@
2
2
  import { Line2 } from "three/examples/jsm/lines/Line2";
3
3
  import { LineGeometry } from "three/examples/jsm/lines/LineGeometry";
4
4
  import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
5
- import { T, useFrame } from "@threlte/core";
5
+ import { T, useTask } from "@threlte/core";
6
6
  import { teleportIntersection } from "../../internal/stores";
7
7
  export let handedness;
8
8
  export let targetRay;
@@ -41,11 +41,11 @@ const setCurvePoints = (alpha = 0.3) => {
41
41
  }
42
42
  lineGeometry.setPositions(positions);
43
43
  };
44
- const { start, stop } = useFrame(
44
+ const { start, stop } = useTask(
45
45
  () => {
46
46
  setCurvePoints();
47
47
  },
48
- { autostart: false }
48
+ { autoStart: false }
49
49
  );
50
50
  $:
51
51
  if ($intersection === void 0) {
@@ -1,12 +1,13 @@
1
- import { currentWritable, useFrame } from '@threlte/core';
1
+ import { currentWritable, useTask, useThrelte } from '@threlte/core';
2
2
  import { useHand } from './useHand';
3
3
  /**
4
4
  * Provides a reference to a requested hand joint, once available.
5
5
  */
6
6
  export const useHandJoint = (handedness, joint) => {
7
+ const { invalidate } = useThrelte();
7
8
  const jointSpaceStore = currentWritable(undefined);
8
9
  const xrhand = useHand(handedness);
9
- const { stop } = useFrame(({ invalidate }) => {
10
+ const { stop } = useTask(() => {
10
11
  const jointSpace = xrhand.current?.hand.joints[joint];
11
12
  // The joint radius is a good indicator that the joint is ready
12
13
  if (jointSpace?.jointRadius !== undefined) {
@@ -14,6 +15,6 @@ export const useHandJoint = (handedness, joint) => {
14
15
  invalidate();
15
16
  stop();
16
17
  }
17
- }, { invalidate: false });
18
+ }, { autoInvalidate: false });
18
19
  return jointSpaceStore;
19
20
  };
@@ -1,5 +1,5 @@
1
1
  import { Matrix4 } from 'three';
2
- import { useThrelte, useFrame, watch, currentWritable } from '@threlte/core';
2
+ import { useThrelte, useTask, watch, currentWritable } from '@threlte/core';
3
3
  import { useXR } from './useXR';
4
4
  import { useController } from './useController';
5
5
  /**
@@ -18,7 +18,7 @@ export const useHitTest = (hitTestCallback, options = {}) => {
18
18
  const { xr } = useThrelte().renderer;
19
19
  const xrState = useXR();
20
20
  const hitMatrix = new Matrix4();
21
- let hitTestSource = currentWritable(undefined);
21
+ const hitTestSource = currentWritable(undefined);
22
22
  if (source === 'viewer') {
23
23
  watch(xrState.session, async (session) => {
24
24
  if (session === undefined) {
@@ -49,7 +49,7 @@ export const useHitTest = (hitTestCallback, options = {}) => {
49
49
  hitTestSource.set(await session.requestHitTestSource?.({ space }));
50
50
  });
51
51
  }
52
- const { start, stop } = useFrame(() => {
52
+ const { start, stop } = useTask(() => {
53
53
  const referenceSpace = xr.getReferenceSpace();
54
54
  if (referenceSpace === null || hitTestSource.current === undefined) {
55
55
  return hitTestCallback(hitMatrix, undefined);
@@ -61,7 +61,7 @@ export const useHitTest = (hitTestCallback, options = {}) => {
61
61
  }
62
62
  hitMatrix.fromArray(pose.transform.matrix);
63
63
  hitTestCallback(hitMatrix, hit);
64
- }, { autostart: false });
64
+ }, { autoStart: false });
65
65
  watch([xrState.isPresenting, hitTestSource], ([isPresenting, testSource]) => {
66
66
  if (!isPresenting) {
67
67
  stop();
package/dist/index.d.ts CHANGED
@@ -17,4 +17,4 @@ export { useHeadset } from './hooks/useHeadset';
17
17
  export { useHitTest } from './hooks/useHitTest';
18
18
  export { useTeleport } from './hooks/useTeleport';
19
19
  export { useXR } from './hooks/useXR';
20
- export type { XRSessionEventType, XRControllerEventType, XRHandEventType, XRSessionEvent, XRControllerEvent, XRController, XRHand, XRHandEvent, } from './types';
20
+ export type { XRSessionEventType, XRControllerEventType, XRHandEventType, XRSessionEvent, XRControllerEvent, XRController, XRHand, XRHandEvent } from './types';
@@ -23,7 +23,7 @@ export const setupHands = () => {
23
23
  if (!hasHands())
24
24
  return;
25
25
  const handEvent = event;
26
- const handedness = ('handedness' in handEvent) ? handEvent.handedness : handEvent.data.handedness;
26
+ const handedness = 'handedness' in handEvent ? handEvent.handedness : handEvent.data.handedness;
27
27
  handDispatchers[handedness]?.current?.(event.type, event);
28
28
  };
29
29
  function handleConnected(event) {
@@ -1,11 +1,11 @@
1
1
  import { Group } from 'three';
2
- import { useThrelte, useFrame, watch } from '@threlte/core';
2
+ import { useThrelte, useTask, watch } from '@threlte/core';
3
3
  import { useXR } from '../hooks/useXR';
4
4
  export const headset = new Group();
5
5
  export const setupHeadset = () => {
6
6
  const { renderer, camera } = useThrelte();
7
7
  const { xr } = renderer;
8
- const immersiveFrame = useFrame(() => {
8
+ const immersiveFrame = useTask(() => {
9
9
  const space = xr.getReferenceSpace();
10
10
  if (space === null)
11
11
  return;
@@ -17,11 +17,11 @@ export const setupHeadset = () => {
17
17
  const { position, orientation } = pose.transform;
18
18
  headset.position.set(position.x, position.y, position.z);
19
19
  headset.quaternion.set(orientation.x, orientation.y, orientation.z, orientation.w);
20
- }, { autostart: false, invalidate: false });
21
- const nonImmersiveFrame = useFrame(() => {
20
+ }, { autoStart: false, autoInvalidate: false });
21
+ const nonImmersiveFrame = useTask(() => {
22
22
  headset.position.copy(camera.current.position);
23
23
  headset.quaternion.copy(camera.current.quaternion);
24
- }, { autostart: false, invalidate: false });
24
+ }, { autoStart: false, autoInvalidate: false });
25
25
  watch(useXR().isPresenting, (isPresenting) => {
26
26
  if (isPresenting) {
27
27
  immersiveFrame.start();
@@ -1,11 +1,11 @@
1
- import { type ThrelteUseFrameOptions, type ThrelteContext } from '@threlte/core';
2
- type UseFixedOptions = ThrelteUseFrameOptions & {
1
+ import { type ThrelteUseTaskOptions } from '@threlte/core';
2
+ type UseFixedOptions = ThrelteUseTaskOptions & {
3
3
  fixedStep?: number;
4
4
  };
5
5
  /**
6
- * A fixed useFrame, based on https://github.com/threlte/threlte/pull/654
6
+ * A fixed useTask, based on https://github.com/threlte/threlte/pull/654
7
7
  *
8
8
  * @Todo Can be removed if this or a similar feature is merged.
9
9
  */
10
- export declare const useFixed: (fn: (ctx: ThrelteContext, delta: number) => void, options: UseFixedOptions) => import("@threlte/core/dist/hooks/legacy/useFrame").ThrelteUseFrame;
10
+ export declare const useFixed: (fn: (delta: number) => void, options: UseFixedOptions) => import("@threlte/core").ThrelteUseTask;
11
11
  export {};
@@ -1,17 +1,17 @@
1
- import { useFrame } from '@threlte/core';
1
+ import { useTask } from '@threlte/core';
2
2
  /**
3
- * A fixed useFrame, based on https://github.com/threlte/threlte/pull/654
3
+ * A fixed useTask, based on https://github.com/threlte/threlte/pull/654
4
4
  *
5
5
  * @Todo Can be removed if this or a similar feature is merged.
6
6
  */
7
7
  export const useFixed = (fn, options) => {
8
8
  let fixedStepTimeAccumulator = 0;
9
9
  let fixedStep = options.fixedStep ?? 1 / 60;
10
- return useFrame((ctx, delta) => {
10
+ return useTask((delta) => {
11
11
  fixedStepTimeAccumulator += delta;
12
12
  while (fixedStepTimeAccumulator >= fixedStep) {
13
13
  fixedStepTimeAccumulator -= fixedStep;
14
- fn(ctx, fixedStep);
14
+ fn(fixedStep);
15
15
  }
16
16
  }, options);
17
17
  };
@@ -14,7 +14,7 @@ export const pointerControls = (handedness, options) => {
14
14
  interactiveObjects: [],
15
15
  raycaster: new Raycaster(),
16
16
  compute: options?.compute ?? defaultComputeFunction,
17
- filter: options?.filter,
17
+ filter: options?.filter
18
18
  });
19
19
  }
20
20
  const context = getControlsContext();
@@ -28,14 +28,14 @@ export const pointerControls = (handedness, options) => {
28
28
  lastEvent: undefined,
29
29
  initialClick: [0, 0, 0],
30
30
  initialHits: [],
31
- hovered: new Map(),
31
+ hovered: new Map()
32
32
  };
33
33
  setHandContext(handedness, ctx);
34
34
  setupPointerControls(context, ctx, options?.fixedStep);
35
35
  }
36
36
  const handContext = getHandContext(handedness);
37
37
  watch(handContext.enabled, (enabled) => {
38
- controlsCounter += (enabled ? 1 : -1);
38
+ controlsCounter += enabled ? 1 : -1;
39
39
  pointerState.update((value) => {
40
40
  value[handedness].enabled = controlsCounter > 0;
41
41
  return value;
@@ -49,6 +49,6 @@ export const pointerControls = (handedness, options) => {
49
49
  });
50
50
  return {
51
51
  enabled: handContext.enabled,
52
- hovered: handContext.hovered,
52
+ hovered: handContext.hovered
53
53
  };
54
54
  };
package/package.json CHANGED
@@ -1,24 +1,28 @@
1
1
  {
2
2
  "name": "@threlte/xr",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "author": "Micheal Parks <michealparks1989@gmail.com> (https://parks.lol)",
5
5
  "license": "MIT",
6
6
  "devDependencies": {
7
7
  "@sveltejs/adapter-auto": "^2.1.0",
8
- "@sveltejs/kit": "^1.22.3",
9
- "@sveltejs/package": "^2.2.0",
8
+ "@sveltejs/kit": "^1.26.0",
9
+ "@sveltejs/package": "^2.2.2",
10
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
11
+ "@typescript-eslint/parser": "^6.8.0",
12
+ "eslint": "^8.51.0",
13
+ "eslint-plugin-svelte": "^2.34.0",
14
+ "svelte-check": "^3.5.2",
15
+ "typescript": "^5.2.2",
10
16
  "@types/three": "^0.158.3",
11
17
  "autoprefixer": "^10.4.14",
12
18
  "postcss": "^8.4.27",
13
19
  "publint": "^0.1.16",
14
20
  "svelte": "^4.1.1",
15
- "svelte-check": "^3.4.6",
16
21
  "three": "^0.158.0",
17
22
  "tslib": "^2.6.0",
18
- "typescript": "^5.1.6",
19
23
  "vite": "^4.4.6",
20
24
  "vite-plugin-mkcert": "^1.16.0",
21
- "@threlte/core": "7.0.0"
25
+ "@threlte/core": "7.0.2"
22
26
  },
23
27
  "peerDependencies": {
24
28
  "svelte": ">=4",