@absolutejs/rendering 0.2.0 → 0.3.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.
- package/README.md +33 -0
- package/dist/spring.d.ts +10 -0
- package/dist/spring.js +13 -0
- package/package.json +41 -4
package/README.md
CHANGED
|
@@ -54,3 +54,36 @@ neutral state, restores the caller immediately, and returns the exact supplied
|
|
|
54
54
|
Float32Array on completion. It never restores stale renderer state after await.
|
|
55
55
|
Allocate supported targets and correctly sized buffers before calling these
|
|
56
56
|
helpers. The helpers do not choose formats, sample counts or capture resolution.
|
|
57
|
+
|
|
58
|
+
## React Spring with demand-rendered Fiber scenes
|
|
59
|
+
|
|
60
|
+
The optional `@absolutejs/rendering/spring` entry provides `animated.mesh`,
|
|
61
|
+
`animated.group`, `useSpring`, `easings`, and `createFiberSpringHost` for other
|
|
62
|
+
explicit Fiber primitives:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { animated, useSpring } from '@absolutejs/rendering/spring';
|
|
66
|
+
|
|
67
|
+
function MovingGroup({ x }: { x: number }) {
|
|
68
|
+
const motion = useSpring({ x });
|
|
69
|
+
return <animated.group position-x={motion.x}>{/* scene content */}</animated.group>;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
It keeps React Spring's normal scheduler. Three prop updates invalidate the
|
|
74
|
+
owning Fiber root through `applyProps`; DOM-only animation does not render a
|
|
75
|
+
scene and can finish without a mounted Canvas. No `useFrame`, manual animation
|
|
76
|
+
clock, global scheduler replacement, or unconditional render loop is installed.
|
|
77
|
+
|
|
78
|
+
Do not also runtime-import `@react-spring/three`: that entry installs a global
|
|
79
|
+
Fiber-driven scheduler even when its consuming component is never mounted. This
|
|
80
|
+
adapter does not override or repair another module's global scheduler changes.
|
|
81
|
+
Type-only imports from that package are safe. Test your actual application's
|
|
82
|
+
eager import graph as well as isolated components.
|
|
83
|
+
|
|
84
|
+
Use `createFiberSpringHost(['instancedMesh', 'meshStandardMaterial'])` to opt into
|
|
85
|
+
additional hosts without registering every Three constructor. React, Fiber and
|
|
86
|
+
React Spring peers are optional for the core material utilities, but required
|
|
87
|
+
when using this subpath. `@react-spring/three` supplies host types only; it is not
|
|
88
|
+
runtime-imported by this entry. The tested versions are React 19.3, Fiber 9.8.2,
|
|
89
|
+
Three 0.186.1 and React Spring 10.1.2.
|
package/dist/spring.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ThreeElements } from "@react-three/fiber";
|
|
2
|
+
import type { WithAnimated } from "@react-spring/three";
|
|
3
|
+
/** Explicit Three hosts driven by React Spring's normal scheduler. Updating a
|
|
4
|
+
* Three prop invalidates its Fiber root; DOM-only springs do not render a scene.
|
|
5
|
+
* Does not install a global clock, call useFrame, or repair another module's
|
|
6
|
+
* scheduler changes. Avoid runtime imports of @react-spring/three alongside it. */
|
|
7
|
+
export declare function createFiberSpringHost<T extends keyof ThreeElements>(primitives: readonly T[]): Pick<WithAnimated, T>;
|
|
8
|
+
/** Small default host; opt into other Fiber primitives with createFiberSpringHost. */
|
|
9
|
+
export declare const animated: Pick<WithAnimated, "group" | "mesh">;
|
|
10
|
+
export { useSpring, easings } from "@react-spring/web";
|
package/dist/spring.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { applyProps } from "@react-three/fiber";
|
|
2
|
+
import { createHost } from "@react-spring/animated";
|
|
3
|
+
/** Explicit Three hosts driven by React Spring's normal scheduler. Updating a
|
|
4
|
+
* Three prop invalidates its Fiber root; DOM-only springs do not render a scene.
|
|
5
|
+
* Does not install a global clock, call useFrame, or repair another module's
|
|
6
|
+
* scheduler changes. Avoid runtime imports of @react-spring/three alongside it. */
|
|
7
|
+
export function createFiberSpringHost(primitives) {
|
|
8
|
+
return createHost([...primitives], { applyAnimatedValues: applyProps })
|
|
9
|
+
.animated;
|
|
10
|
+
}
|
|
11
|
+
/** Small default host; opt into other Fiber primitives with createFiberSpringHost. */
|
|
12
|
+
export const animated = createFiberSpringHost(["mesh", "group"]);
|
|
13
|
+
export { useSpring, easings } from "@react-spring/web";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/rendering",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Render-destination coverage policies and callback-preserving material ownership for Three.js applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./spring": {
|
|
15
|
+
"types": "./dist/spring.d.ts",
|
|
16
|
+
"import": "./dist/spring.js",
|
|
17
|
+
"default": "./dist/spring.js"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -31,16 +36,48 @@
|
|
|
31
36
|
"build": "tsc -p tsconfig.json",
|
|
32
37
|
"test": "bun test ./tests",
|
|
33
38
|
"check:package": "bun run build && bun run test",
|
|
34
|
-
"test:browser": "bun scripts/verify-browser.cjs"
|
|
39
|
+
"test:browser": "bun scripts/verify-browser.cjs",
|
|
40
|
+
"test:spring:browser": "bun scripts/verify-spring.cjs"
|
|
35
41
|
},
|
|
36
42
|
"peerDependencies": {
|
|
37
|
-
"three": ">=0.186.0 <0.187.0"
|
|
43
|
+
"three": ">=0.186.0 <0.187.0",
|
|
44
|
+
"react": ">=19.3.0 <20",
|
|
45
|
+
"@react-three/fiber": ">=9.8.2 <10",
|
|
46
|
+
"@react-spring/animated": ">=10.1.2 <11",
|
|
47
|
+
"@react-spring/web": ">=10.1.2 <11",
|
|
48
|
+
"@react-spring/three": ">=10.1.2 <11"
|
|
38
49
|
},
|
|
39
50
|
"devDependencies": {
|
|
40
51
|
"three": "0.186.1",
|
|
41
52
|
"@types/three": "0.186.0",
|
|
42
53
|
"@types/bun": "1.4.2",
|
|
43
54
|
"typescript": "5.9.3",
|
|
44
|
-
"playwright": "1.61.1"
|
|
55
|
+
"playwright": "1.61.1",
|
|
56
|
+
"react": "19.3.0",
|
|
57
|
+
"react-dom": "19.3.0",
|
|
58
|
+
"@types/react": "19.3.0",
|
|
59
|
+
"@types/react-dom": "19.3.0",
|
|
60
|
+
"@react-three/fiber": "9.8.2",
|
|
61
|
+
"@react-spring/animated": "10.1.2",
|
|
62
|
+
"@react-spring/web": "10.1.2",
|
|
63
|
+
"@react-spring/three": "10.1.2",
|
|
64
|
+
"@react-spring/shared": "10.1.2"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"react": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@react-three/fiber": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@react-spring/animated": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"@react-spring/web": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"@react-spring/three": {
|
|
80
|
+
"optional": true
|
|
81
|
+
}
|
|
45
82
|
}
|
|
46
83
|
}
|