Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v9 rc #2331

Draft
wants to merge 324 commits into
base: master
Choose a base branch
from
Draft

v9 rc #2331

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
324 commits
Select commit Hold shift + click to select a range
3f928f5
Merge branch 'master' into v9
CodyJasonBennett Sep 13, 2022
5b1bb20
[v9] fix: don't updateStyle on offscreen canvas (#2495)
CodyJasonBennett Sep 15, 2022
8aa3a96
Merge branch 'master' into v9
CodyJasonBennett Sep 15, 2022
1e7e0a1
[v9] refactor!: instance descriptors, dynamically map ThreeElements (…
CodyJasonBennett Sep 18, 2022
1ef6515
Merge branch 'master' into v9
CodyJasonBennett Sep 21, 2022
c071328
chore: add integration tests for context bridge
CodyJasonBennett Sep 21, 2022
25d8766
Merge branch 'master' into v9
CodyJasonBennett Sep 21, 2022
0b08077
Merge branch 'master' into v9
CodyJasonBennett Sep 21, 2022
0a03489
chore: restore RTTR version
CodyJasonBennett Sep 21, 2022
8ebcdbd
Merge branch 'master' into v9
CodyJasonBennett Sep 21, 2022
3ef7086
Merge branch 'master' into v9
CodyJasonBennett Sep 21, 2022
3f57f0f
chore: remove outdated tests with master
CodyJasonBennett Sep 21, 2022
fee303a
new alpha
drcmda Sep 23, 2022
3bb9da4
[v9] fix: prefer named functions, for loops in hot paths (#2540)
AlaricBaraou Sep 29, 2022
2635187
Merge branch 'master' into v9
CodyJasonBennett Sep 29, 2022
9b30b0b
Merge branch 'master' into v9
CodyJasonBennett Oct 2, 2022
85c1e05
fix: don't memoize strict check
CodyJasonBennett Oct 2, 2022
1b2b8ce
Revert "fix: don't memoize strict check"
CodyJasonBennett Oct 2, 2022
e80b43c
Merge branch 'master' into v9
CodyJasonBennett Oct 3, 2022
968891b
Merge branch 'master' into v9
CodyJasonBennett Oct 11, 2022
d6963ca
fix: invalidate pierced props (#2563)
CodyJasonBennett Oct 11, 2022
b197712
Merge branch 'master' into v9
CodyJasonBennett Oct 11, 2022
e7804f9
chore: upgrade lockfile
CodyJasonBennett Oct 11, 2022
9e10ee7
refactor(types)!: upgrade Zustand to v4 (#2558)
CodyJasonBennett Oct 20, 2022
cb65de1
[v9] refactor(types): export public types (#2559)
CodyJasonBennett Oct 20, 2022
009f36f
Merge branch 'master' into v9
CodyJasonBennett Oct 29, 2022
b4c52ee
chore: unmangle merge
CodyJasonBennett Oct 29, 2022
e7e78bd
Merge branch 'master' into v9
CodyJasonBennett Oct 29, 2022
7c85caa
fix: separate type and js exports
CodyJasonBennett Oct 29, 2022
3668563
fix: unmangle export
CodyJasonBennett Oct 29, 2022
ce90b8f
[v9] chore(tests): add exports snapshots for targets (#2606)
CodyJasonBennett Nov 1, 2022
0b753e4
[v9] refactor: streamline core, harden exports (#2583)
CodyJasonBennett Nov 1, 2022
27295a7
experiment: create objects with container effects
CodyJasonBennett Nov 2, 2022
cec4297
fix(types): don't overwrite types of infer fallback (#2669)
CodyJasonBennett Dec 18, 2022
0df10bb
chore(types): add back ReactThreeFiber namespace, math types (#2674)
CodyJasonBennett Dec 31, 2022
9c43039
Merge branch 'master' into v9
CodyJasonBennett Dec 31, 2022
d82d9ad
fix(events): unmangle types
CodyJasonBennett Dec 31, 2022
dd1ffe8
[v9] fix(core): correctly swap map elements on invalidate (#2690)
CodyJasonBennett Dec 31, 2022
8170527
fix: Euler types and ReactProps (#2705)
krispya Jan 13, 2023
a47e48d
chore(tests): update snapshot
CodyJasonBennett Jan 14, 2023
a660cd1
fix: applyProps ignores undefined props (#2709)
krispya Jan 19, 2023
111b4a5
chore: export Overwrite (#2721)
krispya Jan 19, 2023
1b602d4
fix(types): loosen Loader type
CodyJasonBennett Jan 19, 2023
ff8dff5
chore: endOfLine auto for crossplatform dev (#2737)
krispya Jan 25, 2023
fd3e92a
Merge branch 'master' into v9
CodyJasonBennett Feb 26, 2023
39b2cfd
fix: offscreencanvas fixes
CodyJasonBennett Feb 26, 2023
7e5d450
fix: progressive color management
CodyJasonBennett Feb 26, 2023
ee510a4
fix: valid sRGB encode
CodyJasonBennett Feb 26, 2023
e67482e
fix: memoize HMR defaults
CodyJasonBennett Feb 26, 2023
b38c18f
fix: portal injects
CodyJasonBennett Feb 26, 2023
e508a79
feat: short cut for shadow type
CodyJasonBennett Feb 26, 2023
6c4e52f
chore: update HMR identity test
CodyJasonBennett Feb 26, 2023
7edff25
fix(types): accept string[][] in useLoader
CodyJasonBennett Feb 27, 2023
8ee196d
Merge branch 'v9' into fix/loosen-loader-type
CodyJasonBennett Feb 27, 2023
b255c2a
fix(types): remove excess useLoader generics
CodyJasonBennett Feb 27, 2023
f750f3a
chore(hooks): cleanup
CodyJasonBennett Feb 27, 2023
0340acd
chore(types): more cleanup, update snapshot
CodyJasonBennett Feb 27, 2023
0fc6afc
refactor(hooks): try to infer useLoader type
CodyJasonBennett Feb 27, 2023
9c5d23a
chore(hooks): prune unused types
CodyJasonBennett Feb 27, 2023
9969c6c
chore: disable ESLint in tests
CodyJasonBennett Feb 27, 2023
f479040
Merge branch 'v9' into fix/loosen-loader-type
CodyJasonBennett Feb 27, 2023
0d53ce9
fix(hooks): Loader#load signature returns any
CodyJasonBennett Feb 27, 2023
2847837
fix(hooks): remove Loader#loadAsync
CodyJasonBennett Feb 27, 2023
c25f990
[v9] fix: forward StrictMode (#2547)
CodyJasonBennett Feb 27, 2023
b22c406
fix: harden hooks tests
CodyJasonBennett Feb 27, 2023
2b3a68f
Merge branch 'v9' into experiment/object-constructor-effects
CodyJasonBennett Feb 28, 2023
d106982
fix(reconciler): handle append as container effect
CodyJasonBennett Feb 28, 2023
06234ad
chore: cleanup instance init
CodyJasonBennett Feb 28, 2023
5d61585
chore(tests): harden suspense lifecycle tests
CodyJasonBennett Feb 28, 2023
dc994ac
chore: cleanup
CodyJasonBennett Feb 28, 2023
090e497
chore: cleanup element mock
CodyJasonBennett Feb 28, 2023
254a715
fix: don't no-op primitive prepare
CodyJasonBennett Feb 28, 2023
cea29e6
chore: harden render tests
CodyJasonBennett Feb 28, 2023
c195d11
fix(reconciler): handle insert on out-of-order reconstruct
CodyJasonBennett Feb 28, 2023
4fb41a0
experiment: don't dispose on swap
CodyJasonBennett Feb 28, 2023
cf9bfc6
chore: revert swap
CodyJasonBennett Feb 28, 2023
5f376ce
fix(reconciler): remove beforeChild on replace
CodyJasonBennett Mar 4, 2023
5883610
Revert "fix(reconciler): remove beforeChild on replace"
CodyJasonBennett Mar 4, 2023
461561e
feat: `scene` render prop for custom THREE.Scene (#2803)
krispya Mar 14, 2023
fad83b2
[fix] Canvas now properly forwards scene
krispya Mar 15, 2023
76276c0
[fix] narrow scene options type
krispya Mar 15, 2023
6a873aa
Merge pull request #2805 from Nicetouchco/feat/scene-prop
krispya May 30, 2023
35333c9
[feat] relax Object3D checks in the reconciler (#2806)
krispya May 30, 2023
a83e06e
Merge branch 'v9' into experiment/object-constructor-effects
krispya Jun 5, 2023
4ae810e
fix: dispose properly binds its object
krispya Jun 5, 2023
ec1d723
fix: call instead of bind
krispya Jun 5, 2023
9e0b2d1
Revert to bind
krispya Jun 5, 2023
cab6d59
Merge pull request #2871 from Nicetouchco/fix/dispose
krispya Jun 10, 2023
02a2740
Merge branch 'master' into v9
CodyJasonBennett Jun 10, 2023
ad37b2a
chore: update tests, upstream fixes
CodyJasonBennett Jun 10, 2023
ba6aa5b
Merge branch 'master' into v9
CodyJasonBennett Jun 12, 2023
44694cc
fix: inline SSR fallbacks
CodyJasonBennett Jun 12, 2023
7088dc5
chore: prefer imperative loops for tracing
CodyJasonBennett Jun 12, 2023
dde49a5
Merge pull request #2723 from pmndrs/fix/loosen-loader-type
krispya Jun 22, 2023
66b7cb3
Merge pull request #2607 from pmndrs/experiment/object-constructor-ef…
krispya Jun 22, 2023
8449aac
fix: scene prop not being used in web canvas
krispya Jun 22, 2023
e8f2ef0
Merge pull request #2901 from Nicetouchco/fix/scene
krispya Jun 22, 2023
2e7d5d6
fix: object3d check in reconciler
krispya Jun 22, 2023
4249c39
Merge pull request #2902 from Nicetouchco/fix/object3d-check
krispya Jun 22, 2023
df2c2fd
Merge branch 'master' into v9
CodyJasonBennett Jul 12, 2023
0e45425
chore: cleanup
CodyJasonBennett Jul 12, 2023
245cd3e
Merge branch 'master' into v9
CodyJasonBennett Jul 26, 2023
bca4137
fix(types): r153 colors overload fix (#2932)
CodyJasonBennett Aug 20, 2023
1477e10
chore: merge
CodyJasonBennett Sep 4, 2023
f681076
chore: resolve conflicts
CodyJasonBennett Sep 4, 2023
795fa93
Merge branch 'master' into v9
CodyJasonBennett Sep 17, 2023
642c0ca
[v9] experiment: extend factory overload (#2785)
CodyJasonBennett Sep 17, 2023
c5694ee
Merge branch 'master' into v9
CodyJasonBennett Sep 28, 2023
4d59d9c
fix: Function formatting destroying syntax highlighting
krispya Oct 2, 2023
1ff2e32
Merge pull request #3031 from Nicetouchco/fix/syntax-highlighting
krispya Oct 5, 2023
fb0174f
Merge branch 'master' into v9
CodyJasonBennett Oct 6, 2023
221ad2d
fix(applyProps): loosen copy identity in dev
CodyJasonBennett Oct 6, 2023
97bad98
Merge branch 'master' into v9
CodyJasonBennett Oct 21, 2023
62dec65
chore: export buildGraph
CodyJasonBennett Oct 21, 2023
b126089
Merge branch 'master' into v9
CodyJasonBennett Oct 21, 2023
b362ea4
Merge branch 'master' into v9
CodyJasonBennett Oct 22, 2023
fccfd06
chore: handle conflicts
CodyJasonBennett Oct 22, 2023
8921435
Merge branch 'master' into v9
CodyJasonBennett Oct 25, 2023
a56b1ab
refactor(reconciler): remove replace
CodyJasonBennett Oct 26, 2023
e5291a0
Merge branch 'master' into v9
CodyJasonBennett Oct 26, 2023
2ec2bbc
[fix] Add missing math types
krispya Oct 29, 2023
42ccaeb
[v9] fix: add missing math types (#3072)
krispya Oct 29, 2023
1dc2b95
chore: update snapshot
CodyJasonBennett Oct 29, 2023
7ea6c52
Merge remote-tracking branch 'upstream/v9' into v9
krispya Nov 20, 2023
fa978ba
[fix] Guard against constructing without params in diffProps
krispya Nov 20, 2023
9a61979
Merge pull request #3098 from Nicetouchco/fix/primitive-diffProps
krispya Dec 4, 2023
6b3e3dc
docs: update introduction for three.js r155+ (#3134)
charliefuller Jan 1, 2024
9d11627
Update readme.md (#3135)
charliefuller Jan 1, 2024
e07fccf
fix: tests were not extending Three
krispya Mar 20, 2024
037b5f9
fix(RTTR): set initial size for NaN in viewport (#3137)
AbsharHassan Jan 2, 2024
c4e248e
chore: add triplex link
itsdouges Jan 2, 2024
bbf8657
chore: update links
itsdouges Jan 2, 2024
ebd4220
chore: center align
itsdouges Jan 2, 2024
40bfbcb
chore: remove div
itsdouges Jan 2, 2024
0b515aa
fix(native): use MSAA for antialias on iOS (#3139)
CodyJasonBennett Jan 2, 2024
ed81989
docs(changeset): fix(native): use MSAA for antialias on iOS
CodyJasonBennett Jan 2, 2024
03d832a
fix: portal events, update examples
drcmda Jan 12, 2024
a30b2e1
new examples
drcmda Jan 22, 2024
f2d8adf
docs(changeset): fix: portal events, update examples
drcmda Jan 12, 2024
db77e16
chore(ci): matrix (#3146)
satelllte Jan 22, 2024
888f213
csb: node 18 (#3157)
satelllte Jan 23, 2024
0d4011c
chore(CI): setup-node v4 (#3144)
satelllte Jan 23, 2024
4fc5cfe
fix: tonemapping config overwrites userland
krispya Mar 21, 2024
bbb3a03
chore(tests): update color management checks
krispya Mar 21, 2024
4689d0e
new sandboxes
drcmda Feb 15, 2024
0b82cdd
fix: correctly pass frames in invalidate (#3185)
krispya Mar 21, 2024
765ae04
Update readme.md
drcmda Mar 4, 2024
78cfbbd
Merge branch 'master' into v9
CodyJasonBennett Mar 27, 2024
0b4b51a
chore: resolve conflicts
CodyJasonBennett Mar 27, 2024
18a5d7b
chore: add lockfile back
CodyJasonBennett Mar 27, 2024
783f377
Merge branch 'master' into v9
CodyJasonBennett Mar 29, 2024
d7a5b31
chore: mirror #3197
CodyJasonBennett Mar 29, 2024
b4f7bbc
fix(useLoader): loosen object3d check
CodyJasonBennett Apr 22, 2024
6d2543b
chore(examples): remove styled-components
CodyJasonBennett Apr 22, 2024
be6cc23
[v9] fix!: upgrade reconciler for React 19 (#3224)
CodyJasonBennett Apr 26, 2024
36a7fc4
Merge branch 'master' into v9
CodyJasonBennett Apr 26, 2024
2c4f448
chore: resolve conflicts
CodyJasonBennett Apr 26, 2024
4c1242c
[v9] chore(tests): add array attach case (#3070)
CodyJasonBennett Apr 26, 2024
85fad8e
feat(useLoader): support loader instances (#3131)
CodyJasonBennett Apr 26, 2024
9e20942
[v9] fix!: don't automatically set texture colorSpace, colorMap fallb…
CodyJasonBennett Apr 26, 2024
f722b5d
chore(examples): use React beta
CodyJasonBennett Apr 26, 2024
d092606
chore: cleanup global access
CodyJasonBennett Apr 26, 2024
15fb1dd
chore(reconciler): cleanup switchInstance
CodyJasonBennett Apr 26, 2024
1e77613
chore: cleanup, re-enable eslint tests
CodyJasonBennett Apr 26, 2024
dd148bd
fix(updateCamera): don't update world matrices
CodyJasonBennett Apr 26, 2024
1cde392
RELEASING: Releasing 2 package(s)
CodyJasonBennett Apr 26, 2024
425b6bd
chore(tests): use names in swap cases
CodyJasonBennett Apr 26, 2024
c3a1189
chore(tests): cleanup
CodyJasonBennett Apr 26, 2024
0af41db
perf(reconciler): inline prepareUpdate
CodyJasonBennett Apr 27, 2024
f2de25c
fix(types): use new createWithEqualityFn signature
CodyJasonBennett Apr 27, 2024
ad0e822
fix(types): shim OffscreenCanvas
CodyJasonBennett Apr 27, 2024
eafb2cc
fix(findInitialRoot): restore traverse, add coverage
CodyJasonBennett Apr 27, 2024
b252c8a
chore(demos): cleanup SVGRenderer
CodyJasonBennett Apr 28, 2024
817335b
chore: cleanup
CodyJasonBennett Apr 28, 2024
b62c807
chore(demos): upgrade deps
CodyJasonBennett Apr 28, 2024
d7eb077
[v9] refactor!: remove viewport, add dpr (#2887)
CodyJasonBennett Apr 28, 2024
538a89a
chore: Use React beta typings
krispya Apr 28, 2024
a4a86c4
Merge branch 'v9' of https://github.com/pmndrs/react-three-fiber into v9
krispya Apr 28, 2024
d7f7ed4
fix: JSX namespacing for v19
krispya Apr 28, 2024
0ffa718
fix(types): use new ref type
CodyJasonBennett Apr 28, 2024
e0f8a3a
fix(types): resolve remaining type issues
CodyJasonBennett Apr 28, 2024
bcc0620
chore: replace ts-ignore with ts-expect-error
krispya Apr 28, 2024
f1a296d
chore(tests): add failing suspense case
CodyJasonBennett Apr 28, 2024
eafe554
fix(reconciler): don't implement (un)hideInstance methods (#3241)
CodyJasonBennett Apr 28, 2024
a17fe45
RELEASING: Releasing 2 package(s)
CodyJasonBennett Apr 28, 2024
0d8d270
chore(hooks): cleanup
CodyJasonBennett Apr 28, 2024
77fd711
Merge branch 'master' into v9
CodyJasonBennett Apr 30, 2024
1141515
chore: resolve conflicts
CodyJasonBennett Apr 30, 2024
5a076d9
fix(reconciler): instances were not being unhidden properly
krispya May 1, 2024
f6e4c46
chore: cleanup
CodyJasonBennett May 1, 2024
6607d4d
chore: re-use (un)hide hooks
CodyJasonBennett May 1, 2024
03c823b
fix: swapped hide/unhide
CodyJasonBennett May 1, 2024
f6325a6
test: suspense visibility
krispya May 1, 2024
cc3080b
chore(tests): fix typo in sorted attach case
CodyJasonBennett May 3, 2024
1183029
[v9] fix: primitive children mounting (#3248)
krispya May 3, 2024
6f8f736
Revert "[v9] refactor!: remove viewport, add dpr (#2887)"
CodyJasonBennett May 4, 2024
f6dea27
chore(tests): move dpr reactivity case
CodyJasonBennett May 4, 2024
7cd62f7
RELEASING: Releasing 2 package(s)
CodyJasonBennett May 4, 2024
ded1acd
Merge branch 'master' into v9
CodyJasonBennett May 8, 2024
37e6499
chore: resolve conflicts
CodyJasonBennett May 8, 2024
50d43c2
chore: lint
CodyJasonBennett May 8, 2024
eed92d8
chore: upgrade React beta
CodyJasonBennett May 8, 2024
564c252
RELEASING: Releasing 2 package(s)
CodyJasonBennett May 8, 2024
2207cec
fix: remove useUpdate
krispya May 10, 2024
684d89e
Update packages/fiber/src/core/loop.ts
krispya May 11, 2024
a196f20
Update packages/fiber/src/core/store.ts
krispya May 11, 2024
687f90e
Update packages/fiber/src/core/store.ts
krispya May 11, 2024
82ec6c7
Merge branch 'master' into v9
CodyJasonBennett May 15, 2024
aa0957e
chore: upgrade to 19-rc
CodyJasonBennett May 15, 2024
2c267dc
fix(types): add shell types for react-reconciler changes (#3242)
CodyJasonBennett May 15, 2024
1db781d
fix: don't set initial frustum for manual camera
CodyJasonBennett May 21, 2024
566c660
fix(createPortal): preserve injected state
CodyJasonBennett May 22, 2024
09637a2
RELEASING: Releasing 2 package(s)
CodyJasonBennett May 22, 2024
c49e02a
Merge branch 'v9' into fix/remove-use-update
CodyJasonBennett May 22, 2024
9ba7697
Merge pull request #3262 from pmndrs/fix/remove-use-update
krispya May 22, 2024
b1b0198
chore: update rc
CodyJasonBennett May 25, 2024
00d4f0f
fix: use new ref signature
CodyJasonBennett May 25, 2024
486ba41
[v9] fix: swap instances in reverse (#3272)
CodyJasonBennett May 26, 2024
b0b2a1f
fix: color types
krispya May 26, 2024
b355536
chore: update snapshot
CodyJasonBennett May 26, 2024
fad0496
chore(types): cleanup
CodyJasonBennett May 26, 2024
5ac7a71
fix: export constraint types
CodyJasonBennett May 26, 2024
c2c6169
fix: restore exports
CodyJasonBennett May 26, 2024
8f7366a
chore: update snapshot
CodyJasonBennett May 26, 2024
4ab5ef0
fix(extend): don't use deprecated forwardRef
CodyJasonBennett May 26, 2024
7da6142
docs: use new CanvasProps
CodyJasonBennett May 26, 2024
8294bdb
fix: restore onUpdate
CodyJasonBennett May 26, 2024
cbebe98
fix: don't write behavior props
CodyJasonBennett May 26, 2024
24a7485
chore(docs): WIP v9 upgrade guide
CodyJasonBennett May 26, 2024
b4adc17
RELEASING: Releasing 2 package(s)
CodyJasonBennett May 26, 2024
973a182
chore: cleanup
CodyJasonBennett May 26, 2024
86a8ff4
feat: args prop requirement matches constructor params
krispya May 27, 2024
4afe441
chore: fix use of bufferAttribute args
CodyJasonBennett May 27, 2024
a5a9553
chore: update snapshot
CodyJasonBennett May 27, 2024
10c2746
fix: harden vector type
CodyJasonBennett May 27, 2024
e6eeac1
chore: upgrade rc
CodyJasonBennett May 30, 2024
a3db926
chore(example): cleanup
CodyJasonBennett May 30, 2024
2c1224b
v9.0.0-beta.0
CodyJasonBennett May 30, 2024
e4419fe
Merge branch 'master' into v9
CodyJasonBennett May 31, 2024
3ee709d
fix(applyProps): use copy method if same implementation
CodyJasonBennett May 31, 2024
3b2620b
Merge branch 'master' into v9
CodyJasonBennett Jun 4, 2024
841338f
chore: resolve conflicts
CodyJasonBennett Jun 4, 2024
6887b2d
chore: upgrade React to rc.0
CodyJasonBennett Jun 13, 2024
79e0247
RELEASING: Releasing 2 package(s)
CodyJasonBennett Jun 13, 2024
8fa636c
chore: cleanup migration guide
CodyJasonBennett Aug 17, 2024
7c1ea70
Merge branch 'master' into v9
CodyJasonBennett Nov 3, 2024
d3af6bd
chore: resolve conflicts
CodyJasonBennett Nov 3, 2024
18505d9
chore(tests): remove warning assertions for text
CodyJasonBennett Nov 3, 2024
451d68d
v9.0.0-rc.0
CodyJasonBennett Nov 3, 2024
fde05ed
v9.0.0-rc.1
CodyJasonBennett Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: yarn run build

- name: Jest run
run: yarn run test
run: yarn run dev && yarn run test

- name: Report Fiber size
run: yarn run analyze-fiber
Expand Down
42 changes: 21 additions & 21 deletions docs/API/canvas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ const App = () => (

## Properties

| Prop | Description | Default |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| children | three.js JSX elements or regular components | |
| fallback | optional DOM JSX elements or regular components in case GL is not supported | |
| gl | Props that go into the default renderer, or your own renderer. Also accepts a synchronous callback like `gl={canvas => new Renderer({ canvas })}` | `{}` |
| camera | Props that go into the default camera, or your own `THREE.Camera` | `{ fov: 75, near: 0.1, far: 1000, position: [0, 0, 5] }` |
| scene | Props that go into the default scene, or your own `THREE.Scene` | `{}` |
| shadows | Props that go into `gl.shadowMap`, can be set true for `PCFsoft` or one of the following: 'basic', 'percentage', 'soft', 'variance' | `false` |
| raycaster | Props that go into the default raycaster | `{}` |
| frameloop | Render mode: always, demand, never | `always` |
| resize | Resize config, see react-use-measure's options | `{ scroll: true, debounce: { scroll: 50, resize: 0 } }` |
| orthographic | Creates an orthographic camera | `false` |
| dpr | Pixel-ratio, use `window.devicePixelRatio`, or automatic: [min, max] | `[1, 2]` |
| legacy | Enables THREE.ColorManagement in three r139 or later | `false` |
| linear | Switch off automatic sRGB color space and gamma correction | `false` |
| events | Configuration for the event manager, as a function of state | `import { events } from "@react-three/fiber"` |
| eventSource | The source where events are being subscribed to, HTMLElement | `React.MutableRefObject<HTMLElement>`, `gl.domElement.parentNode` |
| eventPrefix | The event prefix that is cast into canvas pointer x/y events | `offset` |
| flat | Use `THREE.NoToneMapping` instead of `THREE.ACESFilmicToneMapping` | `false` |
| onCreated | Callback after the canvas has rendered (but not yet committed) | `(state) => {}` |
| onPointerMissed | Response for pointer clicks that have missed any target | `(event) => {}` |
| Prop | Description | Default |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| children | three.js JSX elements or regular components | |
| fallback | optional DOM JSX elements or regular components in case GL is not supported | |
| gl | Props that go into the default renderer, or your own renderer. Also accepts a synchronous callback like `gl={canvas => new Renderer({ canvas })}` | `{}` |
| camera | Props that go into the default camera, or your own `THREE.Camera` | `{ fov: 75, near: 0.1, far: 1000, position: [0, 0, 5] }` |
| scene | Props that go into the default scene, or your own `THREE.Scene` | `{}` |
| shadows | Props that go into `gl.shadowMap`, can be set true for `PCFsoft` or one of the following: 'basic', 'percentage', 'soft', 'variance' | `false` |
| raycaster | Props that go into the default raycaster | `{}` |
| frameloop | Render mode: always, demand, never | `always` |
| resize | Resize config, see react-use-measure's options | `{ scroll: true, debounce: { scroll: 50, resize: 0 } }` |
| orthographic | Creates an orthographic camera | `false` |
| dpr | Pixel-ratio, use `window.devicePixelRatio`, or automatic: [min, max] | `[1, 2]` |
| legacy | Enables THREE.ColorManagement in three r139 or later | `false` |
| linear | Switch off automatic sRGB color space and gamma correction | `false` |
| events | Configuration for the event manager, as a function of state | `import { events } from "@react-three/fiber"` |
| eventSource | The source where events are being subscribed to, HTMLElement | `React.RefObject<HTMLElement>`, `gl.domElement.parentNode` |
| eventPrefix | The event prefix that is cast into canvas pointer x/y events | `offset` |
| flat | Use `THREE.NoToneMapping` instead of `THREE.ACESFilmicToneMapping` | `false` |
| onCreated | Callback after the canvas has rendered (but not yet committed) | `(state) => {}` |
| onPointerMissed | Response for pointer clicks that have missed any target | `(event) => {}` |

## Defaults

Expand Down
6 changes: 3 additions & 3 deletions docs/API/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ The hook is reactive, if you resize the browser for instance, you get fresh meas
| `legacy` | Disables global color management via `THREE.ColorManagement` | `boolean` |
| `frameloop` | Render mode: always, demand, never | `always`, `demand`, `never` |
| `performance` | System regression | `{ current: number, min: number, max: number, debounce: number, regress: () => void }` |
| `size` | Canvas size in pixels | `{ width: number, height: number, top: number, left: number, updateStyle?: boolean }` |
| `size` | Canvas size in pixels | `{ width: number, height: number, top: number, left: number }` |
| `viewport` | Viewport size in three.js units | `{ width: number, height: number, initialDpr: number, dpr: number, factor: number, distance: number, aspect: number, getCurrentViewport: (camera?: Camera, target?: THREE.Vector3, size?: Size) => Viewport }` |
| `xr` | XR interface, manages WebXR rendering | `{ connect: () => void, disconnect: () => void }` |
| `set` | Allows you to set any state property | `(state: SetState<RootState>) => void` |
| `get` | Allows you to retrieve any state property non-reactively | `() => GetState<RootState>` |
| `invalidate` | Request a new render, given that `frameloop === 'demand'` | `() => void` |
| `advance` | Advance one tick, given that `frameloop === 'never'` | `(timestamp: number, runGlobalEffects?: boolean) => void` |
| `setSize` | Resize the canvas | `(width: number, height: number, updateStyle?: boolean, top?: number, left?: number) => void` |
| `setSize` | Resize the canvas | `(width: number, height: number, top?: number, left?: number) => void` |
| `setDpr` | Set the pixel-ratio | `(dpr: number) => void` |
| `setFrameloop` | Shortcut to set the current render mode | `(frameloop?: 'always', 'demand', 'never') => void` |
| `setEvents` | Shortcut to setting the event layer | `(events: Partial<EventManager<any>>) => void` |
Expand Down Expand Up @@ -126,7 +126,7 @@ function Foo() {

> [!CAUTION]
> Be careful about what you do inside useFrame! You should never setState in there! Your calculations should be slim and
you should mind all the commonly known pitfalls when dealing with loops in general, like re-use of variables, etc.
> you should mind all the commonly known pitfalls when dealing with loops in general, like re-use of variables, etc.

### Taking over the render-loop

Expand Down
2 changes: 1 addition & 1 deletion docs/API/objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ You can also deeply nest attach through piercing. The following adds a buffer-at
```jsx
<mesh>
<bufferGeometry>
<bufferAttribute attach="attributes-position" count={v.length / 3} array={v} itemSize={3} />
<bufferAttribute attach="attributes-position" args={[v, 3]} />
```

#### More examples
Expand Down
Binary file added docs/triplex-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 9 additions & 48 deletions docs/tutorials/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,7 @@ function Box(props) {

The exclamation mark is a non-null assertion that will let TS know that `ref.current` is defined when we access it in effects.

## Typing shorthand props

react-three-fiber accepts short-hand props like scalars, strings, and arrays so you can declaratively set properties without side effects.

Here are the different variations of props:

```tsx
import { Euler, Vector3, Color } from 'three'

rotation: Euler || [x, y, z]
position: Vector3 || [x, y, z] || scalar
color: Color || 'hotpink' || 0xffffff
```

Each property has extended types which you can pull from to type these properties.

```tsx
import { Euler, Vector3, Color } from '@react-three/fiber'
// or
// import { ReactThreeFiber } from '@react-three/fiber'
// ReactThreeFiber.Euler, ReactThreeFiber.Vector3, etc.

rotation: Euler
position: Vector3
color: Color
```

This is particularly useful if you are typing properties outside of components, such as a store or a hook.

## `extend` usage
## Extend usage

react-three-fiber can also accept third-party elements and extend them into its internal catalogue.

Expand All @@ -77,6 +48,8 @@ class CustomElement extends GridHelper {}

// Extend so the reconciler will learn about it
extend({ CustomElement })

<customElement />
```

The catalogue teaches the underlying reconciler how to create fibers for these elements and treat them within the scene.
Expand All @@ -89,26 +62,14 @@ You can then declaratively create custom elements with primitives, but TypeScrip
<customElement />
```

### Node Helpers

react-three-fiber exports helpers that you can use to define different types of nodes. These nodes will type an element that we'll attach to the global JSX namespace.

```tsx
Node
Object3DNode
BufferGeometryNode
MaterialNode
LightNode
```

### Extending `ThreeElements`
### Extending ThreeElements

Since our custom element is an object, we'll use `Object3DNode` to define it.
To define our element in JSX, we'll use the `ThreeElement` interface to extend `ThreeElements`. This interface describes three.js classes that are available in the R3F catalog and can be used as native elements.

```tsx
import { useRef, useEffect } from 'react'
import { GridHelper } from 'three'
import { extend, Object3DNode } from '@react-three/fiber'
import { extend, ThreeElement } from '@react-three/fiber'

// Create our custom element
class CustomElement extends GridHelper {}
Expand All @@ -119,12 +80,12 @@ extend({ CustomElement })
// Add types to ThreeElements elements so primitives pick up on it
declare module '@react-three/fiber' {
interface ThreeElements {
customElement: Object3DNode<CustomElement, typeof CustomElement>
customElement: ThreeElement<typeof CustomElement>
}
}

// react-three-fiber will create your custom component and TypeScript will understand it
<customComponent />
;<customComponent />
```

## Exported types
Expand All @@ -148,7 +109,7 @@ Viewport
Camera

// Canvas props
Props
CanvasProps

// Supported events
Events
Expand Down
Loading
Loading