@threlte/flex 2.1.0 → 2.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.
@@ -40,10 +40,13 @@
40
40
  */
41
41
  const { width: computedWidth, height: computedHeight } = createUseDimensionsContext()
42
42
 
43
+ let shouldReflow = $state(false)
44
+ const reflow = () => (shouldReflow = true)
45
+
43
46
  /**
44
47
  * Reflowing inside useTask automatically batches reflows to 1 per frame.
45
48
  */
46
- const { start: reflow, stop } = useTask(
49
+ useTask(
47
50
  Symbol('threlte-flex-reflow'),
48
51
  () => {
49
52
  flexContext.emit('reflow:before')
@@ -107,11 +110,11 @@
107
110
  height: computedHeight.current
108
111
  })
109
112
 
110
- stop()
113
+ shouldReflow = false
111
114
  },
112
115
  {
113
116
  stage: reflowStage,
114
- autoStart: false
117
+ running: () => shouldReflow
115
118
  }
116
119
  )
117
120
 
@@ -1,5 +1,5 @@
1
1
  import type { CurrentWritable } from '@threlte/core';
2
- import type { Emitter } from 'mitt';
2
+ import { type Emitter } from 'mitt';
3
3
  import type { Group } from 'three';
4
4
  import type { Node } from 'yoga-layout';
5
5
  import type Yoga from 'yoga-layout';
@@ -1,7 +1,4 @@
1
- // We need to cast here because TypeScript with "moduleResolution": "NodeNext"
2
- // fails to resolve the default export otherwise.
3
- import mittModule from 'mitt';
4
- const mitt = mittModule;
1
+ import mitt, {} from 'mitt';
5
2
  import { getContext, onDestroy, setContext } from 'svelte';
6
3
  export const flexContextName = '__threlte-flex';
7
4
  export const createFlexContext = (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/flex",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
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",
@@ -28,8 +28,8 @@
28
28
  "typescript": "5.9.2",
29
29
  "typescript-eslint": "^8.32.0",
30
30
  "vite": "^7.1.4",
31
- "@threlte/core": "8.3.0",
32
- "@threlte/extras": "9.7.0"
31
+ "@threlte/core": "8.4.0",
32
+ "@threlte/extras": "9.8.1"
33
33
  },
34
34
  "dependencies": {
35
35
  "mitt": "^3.0.1",