@threlte/xr 1.0.0-next.10 → 1.0.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ARButton.svelte.d.ts +9 -37
- package/dist/components/Controller.svelte.d.ts +25 -37
- package/dist/components/Hand.svelte.d.ts +21 -33
- package/dist/components/Headset.svelte.d.ts +19 -16
- package/dist/components/VRButton.svelte.d.ts +3 -32
- package/dist/components/XR.svelte.d.ts +32 -44
- package/dist/components/XRButton.svelte.d.ts +26 -38
- package/dist/components/internal/Cursor.svelte.d.ts +7 -18
- package/dist/components/internal/PointerCursor.svelte.d.ts +5 -17
- package/dist/components/internal/ScenePortal.svelte.d.ts +19 -16
- package/dist/components/internal/ShortRay.svelte.d.ts +5 -17
- package/dist/components/internal/TeleportCursor.svelte.d.ts +5 -17
- package/dist/components/internal/TeleportRay.svelte.d.ts +6 -18
- package/dist/plugins/pointerControls/index.js +1 -1
- package/dist/plugins/pointerControls/plugin.svelte.js +22 -0
- package/dist/plugins/teleportControls/index.js +1 -1
- package/dist/plugins/teleportControls/plugin.svelte.js +31 -0
- package/package.json +8 -8
- package/dist/plugins/pointerControls/plugin.js +0 -26
- package/dist/plugins/teleportControls/plugin.js +0 -54
- /package/dist/plugins/pointerControls/{plugin.d.ts → plugin.svelte.d.ts} +0 -0
- /package/dist/plugins/teleportControls/{plugin.d.ts → plugin.svelte.d.ts} +0 -0
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
/// <reference types="webxr" />
|
|
2
|
-
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: Omit<import("svelte/elements").HTMLButtonAttributes & {
|
|
5
|
-
mode: XRSessionMode;
|
|
6
|
-
sessionInit?: (XRSessionInit & {
|
|
7
|
-
domOverlay?: {
|
|
8
|
-
root: HTMLElement;
|
|
9
|
-
} | undefined;
|
|
10
|
-
}) | undefined;
|
|
11
|
-
force?: "enter" | "exit" | undefined;
|
|
12
|
-
styled?: boolean | undefined;
|
|
13
|
-
children?: import("svelte").Snippet<[{
|
|
14
|
-
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
15
|
-
}]> | undefined;
|
|
16
|
-
onclick?: ((event: {
|
|
17
|
-
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
18
|
-
nativeEvent: MouseEvent;
|
|
19
|
-
}) => void) | undefined;
|
|
20
|
-
onerror?: ((error: Error) => void) | undefined;
|
|
21
|
-
}, "mode" | "sessionInit"> & {
|
|
22
|
-
sessionInit?: (XRSessionInit & {
|
|
23
|
-
domOverlay?: {
|
|
24
|
-
root: HTMLElement;
|
|
25
|
-
} | undefined;
|
|
26
|
-
}) | undefined;
|
|
27
|
-
};
|
|
28
|
-
events: {
|
|
29
|
-
[evt: string]: CustomEvent<any>;
|
|
30
|
-
};
|
|
31
|
-
slots: {};
|
|
32
|
-
};
|
|
33
|
-
export type ArButtonProps = typeof __propDef.props;
|
|
34
|
-
export type ArButtonEvents = typeof __propDef.events;
|
|
35
|
-
export type ArButtonSlots = typeof __propDef.slots;
|
|
2
|
+
/// <reference types="svelte" />
|
|
36
3
|
/**
|
|
37
4
|
* `<ARButton />` is an HTML `<button />` that can be used to init and display info about your immersive AR session.
|
|
38
5
|
*
|
|
@@ -43,6 +10,11 @@ export type ArButtonSlots = typeof __propDef.slots;
|
|
|
43
10
|
* />
|
|
44
11
|
* ```
|
|
45
12
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
13
|
+
declare const ArButton: import("svelte").Component<Omit<Record<string, any>, "mode" | "sessionInit"> & {
|
|
14
|
+
sessionInit?: (XRSessionInit & {
|
|
15
|
+
domOverlay?: {
|
|
16
|
+
root: HTMLElement;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}) | undefined;
|
|
19
|
+
}, {}, "">;
|
|
20
|
+
export default ArButton;
|
|
@@ -1,40 +1,28 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { XRControllerEvents } from '../types';
|
|
3
2
|
import type { Snippet } from 'svelte';
|
|
4
|
-
declare const __propDef: {
|
|
5
|
-
props: {
|
|
6
|
-
children?: Snippet<[]> | undefined;
|
|
7
|
-
grip?: Snippet<[]> | undefined;
|
|
8
|
-
targetRay?: Snippet<[]> | undefined;
|
|
9
|
-
pointerRay?: Snippet<[]> | undefined;
|
|
10
|
-
pointerCursor?: Snippet<[]> | undefined;
|
|
11
|
-
teleportRay?: Snippet<[]> | undefined;
|
|
12
|
-
teleportCursor?: Snippet<[]> | undefined;
|
|
13
|
-
} & XRControllerEvents & ({
|
|
14
|
-
/** Whether the controller should be matched with the left hand. */
|
|
15
|
-
left: true;
|
|
16
|
-
right?: undefined;
|
|
17
|
-
hand?: undefined;
|
|
18
|
-
} | {
|
|
19
|
-
/** Whether the controller should be matched with the right hand. */
|
|
20
|
-
right: true;
|
|
21
|
-
left?: undefined;
|
|
22
|
-
hand?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
/** Whether the controller should be matched with the left or right hand. */
|
|
25
|
-
hand: 'left' | 'right';
|
|
26
|
-
left?: undefined;
|
|
27
|
-
right?: undefined;
|
|
28
|
-
});
|
|
29
|
-
events: {
|
|
30
|
-
[evt: string]: CustomEvent<any>;
|
|
31
|
-
};
|
|
32
|
-
slots: {};
|
|
33
|
-
};
|
|
34
|
-
export type ControllerProps = typeof __propDef.props;
|
|
35
|
-
export type ControllerEvents = typeof __propDef.events;
|
|
36
|
-
export type ControllerSlots = typeof __propDef.slots;
|
|
37
3
|
/** `<Controller />` represents a THREE.XRTargetRaySpace, a THREE.XRGripSpace, and a controller model. */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
4
|
+
declare const Controller: import("svelte").Component<{
|
|
5
|
+
children?: Snippet<[]> | undefined;
|
|
6
|
+
grip?: Snippet<[]> | undefined;
|
|
7
|
+
targetRay?: Snippet<[]> | undefined;
|
|
8
|
+
pointerRay?: Snippet<[]> | undefined;
|
|
9
|
+
pointerCursor?: Snippet<[]> | undefined;
|
|
10
|
+
teleportRay?: Snippet<[]> | undefined;
|
|
11
|
+
teleportCursor?: Snippet<[]> | undefined;
|
|
12
|
+
} & XRControllerEvents & ({
|
|
13
|
+
/** Whether the controller should be matched with the left hand. */
|
|
14
|
+
left: true;
|
|
15
|
+
right?: undefined;
|
|
16
|
+
hand?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
/** Whether the controller should be matched with the right hand. */
|
|
19
|
+
right: true;
|
|
20
|
+
left?: undefined;
|
|
21
|
+
hand?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
/** Whether the controller should be matched with the left or right hand. */
|
|
24
|
+
hand: 'left' | 'right';
|
|
25
|
+
left?: undefined;
|
|
26
|
+
right?: undefined;
|
|
27
|
+
}), {}, "">;
|
|
28
|
+
export default Controller;
|
|
@@ -1,35 +1,23 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { XRHandEvents } from '../types';
|
|
3
2
|
import type { Snippet } from 'svelte';
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
events: {
|
|
26
|
-
[evt: string]: CustomEvent<any>;
|
|
27
|
-
};
|
|
28
|
-
slots: {};
|
|
29
|
-
};
|
|
30
|
-
export type HandProps = typeof __propDef.props;
|
|
31
|
-
export type HandEvents = typeof __propDef.events;
|
|
32
|
-
export type HandSlots = typeof __propDef.slots;
|
|
33
|
-
export default class Hand extends SvelteComponent<HandProps, HandEvents, HandSlots> {
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
3
|
+
declare const Hand: import("svelte").Component<{
|
|
4
|
+
children?: Snippet<[]> | undefined;
|
|
5
|
+
targetRay?: Snippet<[]> | undefined;
|
|
6
|
+
wrist?: Snippet<[]> | undefined;
|
|
7
|
+
} & XRHandEvents & ({
|
|
8
|
+
/** Whether the XRHand should be matched with the left hand. */
|
|
9
|
+
left: true;
|
|
10
|
+
right?: undefined;
|
|
11
|
+
hand?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
/** Whether the XRHand should be matched with the right hand. */
|
|
14
|
+
right: true;
|
|
15
|
+
left?: undefined;
|
|
16
|
+
hand?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
/** Whether the XRHand should be matched with the left or right hand. */
|
|
19
|
+
hand: 'left' | 'right';
|
|
20
|
+
left?: undefined;
|
|
21
|
+
right?: undefined;
|
|
22
|
+
}), {}, "">;
|
|
23
|
+
export default Hand;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
5
12
|
};
|
|
6
|
-
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {
|
|
10
|
-
default: {};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type HeadsetProps = typeof __propDef.props;
|
|
14
|
-
export type HeadsetEvents = typeof __propDef.events;
|
|
15
|
-
export type HeadsetSlots = typeof __propDef.slots;
|
|
16
|
-
export default class Headset extends SvelteComponent<HeadsetProps, HeadsetEvents, HeadsetSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
17
14
|
}
|
|
18
|
-
|
|
15
|
+
declare const Headset: $$__sveltets_2_IsomorphicComponent<any, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {
|
|
18
|
+
default: {};
|
|
19
|
+
}, {}, string>;
|
|
20
|
+
type Headset = InstanceType<typeof Headset>;
|
|
21
|
+
export default Headset;
|
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
import { SvelteComponent } from "svelte";
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: Omit<import("svelte/elements").HTMLButtonAttributes & {
|
|
5
|
-
mode: XRSessionMode;
|
|
6
|
-
sessionInit?: (XRSessionInit & {
|
|
7
|
-
domOverlay?: {
|
|
8
|
-
root: HTMLElement;
|
|
9
|
-
} | undefined;
|
|
10
|
-
}) | undefined;
|
|
11
|
-
force?: "enter" | "exit" | undefined;
|
|
12
|
-
styled?: boolean | undefined;
|
|
13
|
-
children?: import("svelte").Snippet<[{
|
|
14
|
-
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
15
|
-
}]> | undefined;
|
|
16
|
-
onclick?: ((event: {
|
|
17
|
-
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
18
|
-
nativeEvent: MouseEvent;
|
|
19
|
-
}) => void) | undefined;
|
|
20
|
-
onerror?: ((error: Error) => void) | undefined;
|
|
21
|
-
}, "mode" | "sessionInit">;
|
|
22
|
-
events: {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {};
|
|
26
|
-
};
|
|
27
|
-
export type VrButtonProps = typeof __propDef.props;
|
|
28
|
-
export type VrButtonEvents = typeof __propDef.events;
|
|
29
|
-
export type VrButtonSlots = typeof __propDef.slots;
|
|
1
|
+
/// <reference types="svelte" />
|
|
30
2
|
/**
|
|
31
3
|
* `<VRButton />` is an HTML `<button />` that can be used to init and display info about your immersive VR session.
|
|
32
4
|
*
|
|
@@ -37,6 +9,5 @@ export type VrButtonSlots = typeof __propDef.slots;
|
|
|
37
9
|
* />
|
|
38
10
|
* ```
|
|
39
11
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export {};
|
|
12
|
+
declare const VrButton: import("svelte").Component<Omit<Record<string, any>, "mode" | "sessionInit">, {}, "">;
|
|
13
|
+
export default VrButton;
|
|
@@ -1,47 +1,6 @@
|
|
|
1
1
|
/// <reference types="webxr" />
|
|
2
|
-
import { SvelteComponent } from "svelte";
|
|
3
2
|
import { type Snippet } from 'svelte';
|
|
4
3
|
import type { XRSessionEvent } from '../types';
|
|
5
|
-
declare const __propDef: {
|
|
6
|
-
props: {
|
|
7
|
-
/**
|
|
8
|
-
* Enables foveated rendering. Default is `1`, the three.js default.
|
|
9
|
-
*
|
|
10
|
-
* 0 = no foveation, full resolution
|
|
11
|
-
*
|
|
12
|
-
* 1 = maximum foveation, the edges render at lower resolution
|
|
13
|
-
*/
|
|
14
|
-
foveation?: number | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* The target framerate for the XRSystem. Smaller rates give more CPU headroom at the cost of responsiveness.
|
|
17
|
-
* Recommended range is `72`-`120`. Default is unset and left to the device.
|
|
18
|
-
* @note If your experience cannot effectively reach the target framerate, it will be subject to frame reprojection
|
|
19
|
-
* which will halve the effective framerate. Choose a conservative estimate that balances responsiveness and
|
|
20
|
-
* headroom based on your experience.
|
|
21
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Rendering#refresh_rate_and_frame_rate
|
|
22
|
-
*/
|
|
23
|
-
frameRate?: number | undefined;
|
|
24
|
-
/** Type of WebXR reference space to use. Default is `local-floor` */
|
|
25
|
-
referenceSpace?: XRReferenceSpaceType | undefined;
|
|
26
|
-
fallback?: Snippet<[]> | undefined;
|
|
27
|
-
children?: Snippet<[]> | undefined;
|
|
28
|
-
/** Called as an XRSession is requested */
|
|
29
|
-
onsessionstart?: ((event: XRSessionEvent<'sessionstart'>) => void) | undefined;
|
|
30
|
-
/** Called after an XRSession is terminated */
|
|
31
|
-
onsessionend?: ((event: XRSessionEvent<'sessionend'>) => void) | undefined;
|
|
32
|
-
/** Called when an XRSession is hidden or unfocused. */
|
|
33
|
-
onvisibilitychange?: ((event: globalThis.XRSessionEvent) => void) | undefined;
|
|
34
|
-
/** Called when available inputsources change */
|
|
35
|
-
oninputsourceschange?: ((event: globalThis.XRSessionEvent) => void) | undefined;
|
|
36
|
-
};
|
|
37
|
-
events: {
|
|
38
|
-
[evt: string]: CustomEvent<any>;
|
|
39
|
-
};
|
|
40
|
-
slots: {};
|
|
41
|
-
};
|
|
42
|
-
export type XrProps = typeof __propDef.props;
|
|
43
|
-
export type XrEvents = typeof __propDef.events;
|
|
44
|
-
export type XrSlots = typeof __propDef.slots;
|
|
45
4
|
/**
|
|
46
5
|
* `<XR />` is a WebXR manager that configures your scene for XR rendering and interaction.
|
|
47
6
|
*
|
|
@@ -59,6 +18,35 @@ export type XrSlots = typeof __propDef.slots;
|
|
|
59
18
|
* />
|
|
60
19
|
* ```
|
|
61
20
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
21
|
+
declare const Xr: import("svelte").Component<{
|
|
22
|
+
/**
|
|
23
|
+
* Enables foveated rendering. Default is `1`, the three.js default.
|
|
24
|
+
*
|
|
25
|
+
* 0 = no foveation, full resolution
|
|
26
|
+
*
|
|
27
|
+
* 1 = maximum foveation, the edges render at lower resolution
|
|
28
|
+
*/
|
|
29
|
+
foveation?: number | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* The target framerate for the XRSystem. Smaller rates give more CPU headroom at the cost of responsiveness.
|
|
32
|
+
* Recommended range is `72`-`120`. Default is unset and left to the device.
|
|
33
|
+
* @note If your experience cannot effectively reach the target framerate, it will be subject to frame reprojection
|
|
34
|
+
* which will halve the effective framerate. Choose a conservative estimate that balances responsiveness and
|
|
35
|
+
* headroom based on your experience.
|
|
36
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Rendering#refresh_rate_and_frame_rate
|
|
37
|
+
*/
|
|
38
|
+
frameRate?: number | undefined;
|
|
39
|
+
/** Type of WebXR reference space to use. Default is `local-floor` */
|
|
40
|
+
referenceSpace?: XRReferenceSpaceType | undefined;
|
|
41
|
+
fallback?: Snippet<[]> | undefined;
|
|
42
|
+
children?: Snippet<[]> | undefined;
|
|
43
|
+
/** Called as an XRSession is requested */
|
|
44
|
+
onsessionstart?: ((event: XRSessionEvent<'sessionstart'>) => void) | undefined;
|
|
45
|
+
/** Called after an XRSession is terminated */
|
|
46
|
+
onsessionend?: ((event: XRSessionEvent<'sessionend'>) => void) | undefined;
|
|
47
|
+
/** Called when an XRSession is hidden or unfocused. */
|
|
48
|
+
onvisibilitychange?: ((event: globalThis.XRSessionEvent) => void) | undefined;
|
|
49
|
+
/** Called when available inputsources change */
|
|
50
|
+
oninputsourceschange?: ((event: globalThis.XRSessionEvent) => void) | undefined;
|
|
51
|
+
}, {}, "">;
|
|
52
|
+
export default Xr;
|
|
@@ -1,41 +1,6 @@
|
|
|
1
1
|
/// <reference types="webxr" />
|
|
2
|
-
import { SvelteComponent } from "svelte";
|
|
3
2
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
3
|
import type { Snippet } from 'svelte';
|
|
5
|
-
declare const __propDef: {
|
|
6
|
-
props: HTMLButtonAttributes & {
|
|
7
|
-
/** The type of `XRSession` to create */
|
|
8
|
-
mode: XRSessionMode;
|
|
9
|
-
/**
|
|
10
|
-
* `XRSession` configuration options
|
|
11
|
-
* @see https://immersive-web.github.io/webxr/#feature-dependencies
|
|
12
|
-
*/
|
|
13
|
-
sessionInit?: (XRSessionInit & {
|
|
14
|
-
domOverlay?: {
|
|
15
|
-
root: HTMLElement;
|
|
16
|
-
} | undefined;
|
|
17
|
-
}) | undefined;
|
|
18
|
-
/** Whether this button should only enter / exit an `XRSession`. Default is to toggle both ways */
|
|
19
|
-
force?: "enter" | "exit" | undefined;
|
|
20
|
-
/** Whether to apply automatic styling to the button. Set false to apply custom styles. Default is true. */
|
|
21
|
-
styled?: boolean | undefined;
|
|
22
|
-
children?: Snippet<[{
|
|
23
|
-
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
24
|
-
}]> | undefined;
|
|
25
|
-
onclick?: ((event: {
|
|
26
|
-
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
27
|
-
nativeEvent: MouseEvent;
|
|
28
|
-
}) => void) | undefined;
|
|
29
|
-
onerror?: ((error: Error) => void) | undefined;
|
|
30
|
-
};
|
|
31
|
-
events: {
|
|
32
|
-
[evt: string]: CustomEvent<any>;
|
|
33
|
-
};
|
|
34
|
-
slots: {};
|
|
35
|
-
};
|
|
36
|
-
export type XrButtonProps = typeof __propDef.props;
|
|
37
|
-
export type XrButtonEvents = typeof __propDef.events;
|
|
38
|
-
export type XrButtonSlots = typeof __propDef.slots;
|
|
39
4
|
/**
|
|
40
5
|
* `<XRButton />` is an HTML `<button />` that can be used to init and
|
|
41
6
|
* display info about your WebXR session. This is aliased by `ARButton` and
|
|
@@ -54,6 +19,29 @@ export type XrButtonSlots = typeof __propDef.slots;
|
|
|
54
19
|
* />
|
|
55
20
|
* ```
|
|
56
21
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
22
|
+
declare const XrButton: import("svelte").Component<HTMLButtonAttributes & {
|
|
23
|
+
/** The type of `XRSession` to create */
|
|
24
|
+
mode: XRSessionMode;
|
|
25
|
+
/**
|
|
26
|
+
* `XRSession` configuration options
|
|
27
|
+
* @see https://immersive-web.github.io/webxr/#feature-dependencies
|
|
28
|
+
*/
|
|
29
|
+
sessionInit?: (XRSessionInit & {
|
|
30
|
+
domOverlay?: {
|
|
31
|
+
root: HTMLElement;
|
|
32
|
+
} | undefined;
|
|
33
|
+
}) | undefined;
|
|
34
|
+
/** Whether this button should only enter / exit an `XRSession`. Default is to toggle both ways */
|
|
35
|
+
force?: "enter" | "exit" | undefined;
|
|
36
|
+
/** Whether to apply automatic styling to the button. Set false to apply custom styles. Default is true. */
|
|
37
|
+
styled?: boolean | undefined;
|
|
38
|
+
children?: Snippet<[{
|
|
39
|
+
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
40
|
+
}]> | undefined;
|
|
41
|
+
onclick?: ((event: {
|
|
42
|
+
state: "blocked" | "unsupported" | "insecure" | "supported";
|
|
43
|
+
nativeEvent: MouseEvent;
|
|
44
|
+
}) => void) | undefined;
|
|
45
|
+
onerror?: ((error: Error) => void) | undefined;
|
|
46
|
+
}, {}, "">;
|
|
47
|
+
export default XrButton;
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
2
|
import { type ColorRepresentation } from 'three';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
events: {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
};
|
|
14
|
-
export type CursorProps = typeof __propDef.props;
|
|
15
|
-
export type CursorEvents = typeof __propDef.events;
|
|
16
|
-
export type CursorSlots = typeof __propDef.slots;
|
|
17
|
-
export default class Cursor extends SvelteComponent<CursorProps, CursorEvents, CursorSlots> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
3
|
+
declare const Cursor: import("svelte").Component<{
|
|
4
|
+
color?: ColorRepresentation | undefined;
|
|
5
|
+
size?: number | undefined;
|
|
6
|
+
thickness?: number | undefined;
|
|
7
|
+
}, {}, "">;
|
|
8
|
+
export default Cursor;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Snippet } from 'svelte';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
export type PointerCursorProps = typeof __propDef.props;
|
|
14
|
-
export type PointerCursorEvents = typeof __propDef.events;
|
|
15
|
-
export type PointerCursorSlots = typeof __propDef.slots;
|
|
16
|
-
export default class PointerCursor extends SvelteComponent<PointerCursorProps, PointerCursorEvents, PointerCursorSlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
2
|
+
declare const PointerCursor: import("svelte").Component<{
|
|
3
|
+
handedness: 'left' | 'right';
|
|
4
|
+
children?: Snippet<[]> | undefined;
|
|
5
|
+
}, {}, "">;
|
|
6
|
+
export default PointerCursor;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
5
12
|
};
|
|
6
|
-
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {
|
|
10
|
-
default: {};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type ScenePortalProps = typeof __propDef.props;
|
|
14
|
-
export type ScenePortalEvents = typeof __propDef.events;
|
|
15
|
-
export type ScenePortalSlots = typeof __propDef.slots;
|
|
16
|
-
export default class ScenePortal extends SvelteComponent<ScenePortalProps, ScenePortalEvents, ScenePortalSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
17
14
|
}
|
|
18
|
-
|
|
15
|
+
declare const ScenePortal: $$__sveltets_2_IsomorphicComponent<any, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {
|
|
18
|
+
default: {};
|
|
19
|
+
}, {}, string>;
|
|
20
|
+
type ScenePortal = InstanceType<typeof ScenePortal>;
|
|
21
|
+
export default ScenePortal;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Snippet } from 'svelte';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
export type ShortRayProps = typeof __propDef.props;
|
|
14
|
-
export type ShortRayEvents = typeof __propDef.events;
|
|
15
|
-
export type ShortRaySlots = typeof __propDef.slots;
|
|
16
|
-
export default class ShortRay extends SvelteComponent<ShortRayProps, ShortRayEvents, ShortRaySlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
2
|
+
declare const ShortRay: import("svelte").Component<{
|
|
3
|
+
handedness: 'left' | 'right';
|
|
4
|
+
children?: Snippet<[]> | undefined;
|
|
5
|
+
}, {}, "">;
|
|
6
|
+
export default ShortRay;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Snippet } from 'svelte';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
export type TeleportCursorProps = typeof __propDef.props;
|
|
14
|
-
export type TeleportCursorEvents = typeof __propDef.events;
|
|
15
|
-
export type TeleportCursorSlots = typeof __propDef.slots;
|
|
16
|
-
export default class TeleportCursor extends SvelteComponent<TeleportCursorProps, TeleportCursorEvents, TeleportCursorSlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
2
|
+
declare const TeleportCursor: import("svelte").Component<{
|
|
3
|
+
handedness: 'left' | 'right';
|
|
4
|
+
children?: Snippet<[]> | undefined;
|
|
5
|
+
}, {}, "">;
|
|
6
|
+
export default TeleportCursor;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { type XRTargetRaySpace } from 'three';
|
|
3
2
|
import type { Snippet } from 'svelte';
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
events: {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
};
|
|
15
|
-
export type TeleportRayProps = typeof __propDef.props;
|
|
16
|
-
export type TeleportRayEvents = typeof __propDef.events;
|
|
17
|
-
export type TeleportRaySlots = typeof __propDef.slots;
|
|
18
|
-
export default class TeleportRay extends SvelteComponent<TeleportRayProps, TeleportRayEvents, TeleportRaySlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
3
|
+
declare const TeleportRay: import("svelte").Component<{
|
|
4
|
+
handedness: 'left' | 'right';
|
|
5
|
+
targetRay: XRTargetRaySpace;
|
|
6
|
+
children?: Snippet<[]> | undefined;
|
|
7
|
+
}, {}, "">;
|
|
8
|
+
export default TeleportRay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Raycaster, Vector3 } from 'three';
|
|
2
2
|
import { currentWritable, watch } from '@threlte/core';
|
|
3
3
|
import { defaultComputeFunction } from './compute';
|
|
4
|
-
import { injectPointerControlsPlugin } from './plugin';
|
|
4
|
+
import { injectPointerControlsPlugin } from './plugin.svelte';
|
|
5
5
|
import { setupPointerControls } from './setup';
|
|
6
6
|
import { getControlsContext, getHandContext, setControlsContext, setHandContext, setInternalContext } from './context';
|
|
7
7
|
import { pointerState } from '../../internal/stores';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { injectPlugin, isInstanceOf, observe } from '@threlte/core';
|
|
2
|
+
import { usePointerControls } from './hook';
|
|
3
|
+
import { events } from './types';
|
|
4
|
+
export const injectPointerControlsPlugin = () => {
|
|
5
|
+
injectPlugin('threlte-pointer-controls', (args) => {
|
|
6
|
+
if (!isInstanceOf(args.ref, 'Object3D'))
|
|
7
|
+
return;
|
|
8
|
+
const hasEventHandlers = Object.entries(args.props).some(([key, value]) => {
|
|
9
|
+
return value !== undefined && events.includes(key);
|
|
10
|
+
});
|
|
11
|
+
if (!hasEventHandlers)
|
|
12
|
+
return;
|
|
13
|
+
const { addInteractiveObject, removeInteractiveObject } = usePointerControls();
|
|
14
|
+
observe.pre(() => [args.ref], ([ref]) => {
|
|
15
|
+
addInteractiveObject(ref, args.props);
|
|
16
|
+
return () => removeInteractiveObject(ref);
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
pluginProps: events
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { currentWritable, watch } from '@threlte/core';
|
|
2
2
|
import { createTeleportContext, useTeleportControls, getHandContext } from './context';
|
|
3
|
-
import { injectTeleportControlsPlugin } from './plugin';
|
|
3
|
+
import { injectTeleportControlsPlugin } from './plugin.svelte';
|
|
4
4
|
import { setHandContext } from './context';
|
|
5
5
|
import { setupTeleportControls } from './setup';
|
|
6
6
|
import { teleportState } from '../../internal/stores';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { injectPlugin, isInstanceOf, observe } from '@threlte/core';
|
|
2
|
+
import { useTeleportControls } from './context';
|
|
3
|
+
/**
|
|
4
|
+
* Registers T components with "teleportSurface" or "teleportBlocker" attributes.
|
|
5
|
+
*/
|
|
6
|
+
export const injectTeleportControlsPlugin = () => {
|
|
7
|
+
injectPlugin('threlte-teleport-controls', (args) => {
|
|
8
|
+
if (!isInstanceOf(args.ref, 'Mesh'))
|
|
9
|
+
return;
|
|
10
|
+
const isSurface = $derived('teleportSurface' in args.props && !!args.props.teleportSurface);
|
|
11
|
+
const isBlocker = $derived('teleportBlocker' in args.props && !!args.props.teleportBlocker);
|
|
12
|
+
const surfaceRef = $derived(isSurface ? args.ref : undefined);
|
|
13
|
+
const blockerRef = $derived(isBlocker ? args.ref : undefined);
|
|
14
|
+
if (!isSurface && !isBlocker)
|
|
15
|
+
return;
|
|
16
|
+
const { addBlocker, addSurface, removeBlocker, removeSurface } = useTeleportControls();
|
|
17
|
+
observe.pre(() => [surfaceRef, blockerRef], ([surfaceRef, blockerRef]) => {
|
|
18
|
+
if (surfaceRef) {
|
|
19
|
+
addSurface(surfaceRef, args.props);
|
|
20
|
+
return removeSurface(surfaceRef);
|
|
21
|
+
}
|
|
22
|
+
else if (blockerRef) {
|
|
23
|
+
addBlocker(blockerRef);
|
|
24
|
+
return removeBlocker(blockerRef);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
pluginProps: ['teleportSurface', 'teleportBlocker']
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
};
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/xr",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.12",
|
|
4
4
|
"author": "Micheal Parks <michealparks1989@gmail.com> (https://parks.lol)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Tools to more easily create VR and AR experiences with Threlte",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@sveltejs/adapter-auto": "^3.2.0",
|
|
9
9
|
"@sveltejs/kit": "^2.7.2",
|
|
10
|
-
"@sveltejs/package": "^2.3.
|
|
10
|
+
"@sveltejs/package": "^2.3.7",
|
|
11
11
|
"@sveltejs/vite-plugin-svelte": "^3.1.0",
|
|
12
|
+
"@types/three": "^0.169.0",
|
|
12
13
|
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
13
14
|
"@typescript-eslint/parser": "^7.6.0",
|
|
15
|
+
"autoprefixer": "^10.4.19",
|
|
14
16
|
"eslint": "^9.0.0",
|
|
15
17
|
"eslint-plugin-svelte": "^2.36.0",
|
|
16
|
-
"svelte-check": "^3.6.9",
|
|
17
|
-
"typescript": "^5.4.5",
|
|
18
|
-
"@types/three": "^0.169.0",
|
|
19
|
-
"autoprefixer": "^10.4.19",
|
|
20
18
|
"postcss": "^8.4.38",
|
|
21
19
|
"publint": "^0.2.7",
|
|
22
|
-
"svelte": "^5.
|
|
20
|
+
"svelte": "^5.1.6",
|
|
21
|
+
"svelte-check": "^3.6.9",
|
|
23
22
|
"three": "^0.169.0",
|
|
24
23
|
"tslib": "^2.6.2",
|
|
24
|
+
"typescript": "^5.4.5",
|
|
25
25
|
"vite": "^5.2.8",
|
|
26
26
|
"vite-plugin-mkcert": "^1.17.5",
|
|
27
|
-
"@threlte/core": "8.0.0-next.
|
|
27
|
+
"@threlte/core": "8.0.0-next.23"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"svelte": ">=5",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { injectPlugin, watch } from '@threlte/core';
|
|
2
|
-
import { writable } from 'svelte/store';
|
|
3
|
-
import { usePointerControls } from './hook';
|
|
4
|
-
import { events } from './types';
|
|
5
|
-
export const injectPointerControlsPlugin = () => {
|
|
6
|
-
injectPlugin('threlte-pointer-controls', ({ ref, props }) => {
|
|
7
|
-
if (!ref.isObject3D)
|
|
8
|
-
return;
|
|
9
|
-
const { addInteractiveObject, removeInteractiveObject } = usePointerControls();
|
|
10
|
-
const refStore = writable(ref);
|
|
11
|
-
watch(refStore, ($refStore) => {
|
|
12
|
-
const hasEventHandlers = Object.entries(props).some(([key, value]) => {
|
|
13
|
-
return value !== undefined && events.includes(key);
|
|
14
|
-
});
|
|
15
|
-
if (!hasEventHandlers)
|
|
16
|
-
return;
|
|
17
|
-
addInteractiveObject($refStore, props);
|
|
18
|
-
return () => removeInteractiveObject($refStore);
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
onRefChange(ref) {
|
|
22
|
-
refStore.set(ref);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { writable } from 'svelte/store';
|
|
2
|
-
import { isInstanceOf, watch } from '@threlte/core';
|
|
3
|
-
import { injectPlugin } from '@threlte/core';
|
|
4
|
-
import { useTeleportControls } from './context';
|
|
5
|
-
/**
|
|
6
|
-
* Registers T components with "teleportSurface" or "teleportBlocker" attributes.
|
|
7
|
-
*/
|
|
8
|
-
export const injectTeleportControlsPlugin = () => {
|
|
9
|
-
const noop = () => { };
|
|
10
|
-
injectPlugin('threlte-teleport-controls', ({ ref, props }) => {
|
|
11
|
-
if (!isInstanceOf(ref, 'Mesh'))
|
|
12
|
-
return;
|
|
13
|
-
const isSurface = 'teleportSurface' in props;
|
|
14
|
-
const isBlocker = 'teleportBlocker' in props;
|
|
15
|
-
if (!isSurface && !isBlocker)
|
|
16
|
-
return;
|
|
17
|
-
const { addBlocker, addSurface, removeBlocker, removeSurface } = useTeleportControls();
|
|
18
|
-
const refStore = writable(ref);
|
|
19
|
-
const propsStore = writable(props);
|
|
20
|
-
watch([refStore, propsStore], ([$refStore, $propsStore]) => {
|
|
21
|
-
if (isSurface) {
|
|
22
|
-
if ($propsStore.teleportSurface === false) {
|
|
23
|
-
removeSurface($refStore);
|
|
24
|
-
return noop;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
addSurface($refStore, props);
|
|
28
|
-
return () => removeSurface($refStore);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else if (isBlocker) {
|
|
32
|
-
if (props.teleportBlocker === false) {
|
|
33
|
-
removeBlocker($refStore);
|
|
34
|
-
return noop;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
addBlocker($refStore);
|
|
38
|
-
return () => removeBlocker($refStore);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return noop;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return {
|
|
46
|
-
onRefChange(ref) {
|
|
47
|
-
refStore.set(ref);
|
|
48
|
-
},
|
|
49
|
-
onPropsChange(props) {
|
|
50
|
-
propsStore.set(props);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
};
|
|
File without changes
|
|
File without changes
|