@threlte/xr 1.6.0 → 1.6.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.
@@ -1,73 +1,34 @@
1
- import { injectPlugin, isInstanceOf } from '@threlte/core';
1
+ import { injectPlugin } from '@threlte/core';
2
2
  import { useTeleportControls } from './context.js';
3
3
  /**
4
4
  * Registers T components with "teleportSurface" or "teleportBlocker" attributes.
5
5
  */
6
6
  export const injectTeleportControlsPlugin = () => {
7
7
  injectPlugin('threlte-teleport-controls-surfaces', (args) => {
8
- if (!isInstanceOf(args.ref, 'Mesh'))
9
- return;
10
- if (!('teleportSurface' in args.props))
11
- return;
12
- let ref = $state(args.ref);
13
- let isSurface = $state(args.props.teleportSurface);
14
8
  const { addSurface, removeSurface } = useTeleportControls();
15
9
  $effect(() => {
16
- if (!ref)
17
- return;
18
- const mesh = ref;
19
- if (isSurface) {
20
- addSurface(mesh, args.props);
10
+ const currentProps = args.props;
11
+ const currentRef = args.ref;
12
+ if (currentProps.teleportSurface) {
13
+ addSurface(currentRef, currentProps);
21
14
  }
22
- else {
23
- removeSurface(mesh);
24
- }
25
- return () => removeSurface(mesh);
15
+ return () => removeSurface(currentRef);
26
16
  });
27
17
  return {
28
- pluginProps: ['teleportSurface'],
29
- onRefChange: (nextRef) => {
30
- ref = nextRef;
31
- return () => {
32
- ref = undefined;
33
- };
34
- },
35
- onPropsChange: (props) => {
36
- isSurface = props.teleportSurface;
37
- }
18
+ pluginProps: ['teleportSurface']
38
19
  };
39
20
  });
40
21
  injectPlugin('threlte-teleport-controls-blockers', (args) => {
41
- if (!isInstanceOf(args.ref, 'Mesh'))
42
- return;
43
- if (!('teleportBlocker' in args.props))
44
- return;
45
- let ref = $state(args.ref);
46
- let isBlocker = $state(args.props.teleportBlocker);
47
22
  const { addBlocker, removeBlocker } = useTeleportControls();
48
23
  $effect(() => {
49
- if (!ref)
50
- return;
51
- const mesh = ref;
52
- if (isBlocker) {
53
- addBlocker(mesh);
24
+ const currentRef = args.ref;
25
+ if (args.props.teleportBlocker) {
26
+ addBlocker(currentRef);
54
27
  }
55
- else {
56
- removeBlocker(mesh);
57
- }
58
- return () => removeBlocker(mesh);
28
+ return () => removeBlocker(currentRef);
59
29
  });
60
30
  return {
61
- pluginProps: ['teleportBlocker'],
62
- onRefChange: (nextRef) => {
63
- ref = nextRef;
64
- return () => {
65
- ref = undefined;
66
- };
67
- },
68
- onPropsChange: (props) => {
69
- isBlocker = props.teleportBlocker;
70
- }
31
+ pluginProps: ['teleportBlocker']
71
32
  };
72
33
  });
73
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/xr",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
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",
@@ -28,8 +28,8 @@
28
28
  "typescript-eslint": "^8.32.0",
29
29
  "vite": "^7.1.4",
30
30
  "vite-plugin-mkcert": "^1.17.5",
31
- "@threlte/extras": "9.15.0",
32
- "@threlte/core": "8.5.10"
31
+ "@threlte/core": "8.5.14",
32
+ "@threlte/extras": "9.16.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "svelte": ">=5",