@threlte/flex 2.0.0-next.6 → 2.0.0-next.8

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.
Files changed (2) hide show
  1. package/dist/Box/Box.svelte +25 -18
  2. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
- <script lang="ts">import { HierarchicalObject, T } from '@threlte/core';
1
+ <script lang="ts">import { T } from '@threlte/core';
2
2
  import { onDestroy } from 'svelte';
3
- import { Group } from 'three';
3
+ import { Group, Object3D } from 'three';
4
4
  import { useFlex } from '../Flex/context';
5
5
  import { createUseDimensionsContext } from '../hooks/useDimensions';
6
6
  import { createNodeContext } from '../nodes/context';
@@ -46,27 +46,34 @@ onEvent('reflow:after', () => {
46
46
  height: computedHeight
47
47
  });
48
48
  });
49
+ const proxy = new Object3D();
50
+ proxy.add = (child) => {
51
+ if (child.userData.isNode) {
52
+ group.add(child);
53
+ }
54
+ else {
55
+ contentGroup.add(child);
56
+ }
57
+ return child;
58
+ };
59
+ proxy.remove = (child) => {
60
+ if (child.userData.isNode) {
61
+ group.remove(child);
62
+ }
63
+ else {
64
+ contentGroup.remove(child);
65
+ }
66
+ return child;
67
+ };
49
68
  </script>
50
69
 
51
70
  <T is={group}>
52
71
  <T is={contentGroup} />
53
72
  </T>
54
73
 
55
- <HierarchicalObject
56
- onChildMount={(child) => {
57
- if (child.userData.isNode) {
58
- group.add(child)
59
- } else {
60
- contentGroup.add(child)
61
- }
62
- }}
63
- onChildDestroy={(child) => {
64
- if (child.userData.isNode) {
65
- group.remove(child)
66
- } else {
67
- contentGroup.remove(child)
68
- }
69
- }}
74
+ <T
75
+ is={proxy}
76
+ attach={false}
70
77
  >
71
78
  {@render children?.({ reflow, width: computedWidth, height: computedHeight })}
72
- </HierarchicalObject>
79
+ </T>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/flex",
3
- "version": "2.0.0-next.6",
3
+ "version": "2.0.0-next.8",
4
4
  "author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
5
5
  "license": "MIT",
6
6
  "description": "Components to easily use the flexbox spec with Threlte",
@@ -10,7 +10,7 @@
10
10
  "@sveltejs/package": "^2.3.1",
11
11
  "@sveltejs/vite-plugin-svelte": "^3.1.0",
12
12
  "@types/node": "^20.12.7",
13
- "@types/three": "^0.166.0",
13
+ "@types/three": "^0.169.0",
14
14
  "@typescript-eslint/eslint-plugin": "^7.6.0",
15
15
  "@typescript-eslint/parser": "^7.6.0",
16
16
  "@yushijinhun/three-minifier-rollup": "^0.4.0",
@@ -25,12 +25,12 @@
25
25
  "svelte-check": "^3.6.9",
26
26
  "svelte-preprocess": "^5.1.3",
27
27
  "svelte2tsx": "^0.7.6",
28
- "three": "^0.166.1",
28
+ "three": "^0.169.0",
29
29
  "tslib": "^2.6.2",
30
30
  "typescript": "^5.4.5",
31
31
  "vite": "^5.2.8",
32
- "@threlte/core": "8.0.0-next.16",
33
- "@threlte/extras": "9.0.0-next.22"
32
+ "@threlte/core": "8.0.0-next.19",
33
+ "@threlte/extras": "9.0.0-next.26"
34
34
  },
35
35
  "dependencies": {
36
36
  "mitt": "^3.0.1",