@react-three/fiber 8.17.5 → 8.17.6

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 (29) hide show
  1. package/CHANGELOG.md +1040 -1034
  2. package/dist/declarations/src/core/events.d.ts +93 -93
  3. package/dist/declarations/src/core/hooks.d.ts +57 -57
  4. package/dist/declarations/src/core/index.d.ts +94 -94
  5. package/dist/declarations/src/core/loop.d.ts +38 -38
  6. package/dist/declarations/src/core/renderer.d.ts +58 -58
  7. package/dist/declarations/src/core/store.d.ts +138 -138
  8. package/dist/declarations/src/core/utils.d.ts +134 -134
  9. package/dist/declarations/src/index.d.ts +12 -12
  10. package/dist/declarations/src/native/Canvas.d.ts +14 -14
  11. package/dist/declarations/src/native/events.d.ts +5 -5
  12. package/dist/declarations/src/native/polyfills.d.ts +1 -1
  13. package/dist/declarations/src/native.d.ts +13 -13
  14. package/dist/declarations/src/three-types.d.ts +396 -393
  15. package/dist/declarations/src/web/Canvas.d.ts +24 -24
  16. package/dist/declarations/src/web/events.d.ts +5 -5
  17. package/dist/declarations/src/web/use-measure.d.ts +34 -34
  18. package/dist/{events-be1682bd.cjs.prod.js → events-2e7e6eab.cjs.prod.js} +76 -76
  19. package/dist/{events-a5fc3e51.esm.js → events-3515660a.esm.js} +76 -76
  20. package/dist/{events-66f43fbc.cjs.dev.js → events-c54ce65e.cjs.dev.js} +76 -76
  21. package/dist/react-three-fiber.cjs.dev.js +4 -4
  22. package/dist/react-three-fiber.cjs.prod.js +4 -4
  23. package/dist/react-three-fiber.esm.js +5 -5
  24. package/native/dist/react-three-fiber-native.cjs.dev.js +13 -18
  25. package/native/dist/react-three-fiber-native.cjs.prod.js +13 -18
  26. package/native/dist/react-three-fiber-native.esm.js +14 -19
  27. package/native/package.json +5 -5
  28. package/package.json +1 -1
  29. package/readme.md +253 -253
@@ -1,134 +1,134 @@
1
- /// <reference types="webxr" />
2
- import * as THREE from 'three';
3
- import * as React from 'react';
4
- import { UseBoundStore } from 'zustand';
5
- import { AttachType, Instance, InstanceProps, LocalState } from './renderer';
6
- import { Dpr, Renderer, RootState, Size } from './store';
7
- /** @ts-ignore */
8
- declare type _DeprecatedXRFrame = THREE.XRFrame;
9
- /** @ts-ignore */
10
- export declare type _XRFrame = THREE.WebGLRenderTargetOptions extends {
11
- samples?: number;
12
- } ? XRFrame : _DeprecatedXRFrame;
13
- /**
14
- * Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
15
- */
16
- export declare const hasColorSpace: <T extends object | Renderer | THREE.Texture, P = T extends Renderer ? {
17
- outputColorSpace: string;
18
- } : {
19
- colorSpace: string;
20
- }>(object: T) => object is T & P;
21
- export declare type ColorManagementRepresentation = {
22
- enabled: boolean | never;
23
- } | {
24
- legacyMode: boolean | never;
25
- };
26
- /**
27
- * The current THREE.ColorManagement instance, if present.
28
- */
29
- export declare const getColorManagement: () => ColorManagementRepresentation | null;
30
- export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
31
- export declare const isOrthographicCamera: (def: Camera) => def is THREE.OrthographicCamera;
32
- export declare const isRef: (obj: any) => obj is React.MutableRefObject<unknown>;
33
- /**
34
- * An SSR-friendly useLayoutEffect.
35
- *
36
- * React currently throws a warning when using useLayoutEffect on the server.
37
- * To get around it, we can conditionally useEffect on the server (no-op) and
38
- * useLayoutEffect elsewhere.
39
- *
40
- * @see https://github.com/facebook/react/issues/14927
41
- */
42
- export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
43
- export declare function useMutableCallback<T>(fn: T): React.MutableRefObject<T>;
44
- export declare type SetBlock = false | Promise<null> | null;
45
- export declare type UnblockProps = {
46
- set: React.Dispatch<React.SetStateAction<SetBlock>>;
47
- children: React.ReactNode;
48
- };
49
- export declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
50
- export declare class ErrorBoundary extends React.Component<{
51
- set: React.Dispatch<Error | undefined>;
52
- children: React.ReactNode;
53
- }, {
54
- error: boolean;
55
- }> {
56
- state: {
57
- error: boolean;
58
- };
59
- static getDerivedStateFromError: () => {
60
- error: boolean;
61
- };
62
- componentDidCatch(err: Error): void;
63
- render(): React.ReactNode;
64
- }
65
- export declare const DEFAULT = "__default";
66
- export declare const DEFAULTS: Map<any, any>;
67
- export declare type DiffSet = {
68
- memoized: {
69
- [key: string]: any;
70
- };
71
- changes: [key: string, value: unknown, isEvent: boolean, keys: string[]][];
72
- };
73
- export declare const isDiffSet: (def: any) => def is DiffSet;
74
- export declare type ClassConstructor = {
75
- new (): void;
76
- };
77
- export declare type ObjectMap = {
78
- nodes: {
79
- [name: string]: THREE.Object3D;
80
- };
81
- materials: {
82
- [name: string]: THREE.Material;
83
- };
84
- };
85
- export declare function calculateDpr(dpr: Dpr): number;
86
- /**
87
- * Returns instance root state
88
- */
89
- export declare const getRootState: (obj: THREE.Object3D) => RootState | undefined;
90
- /**
91
- * Returns the instances initial (outmost) root
92
- */
93
- export declare function findInitialRoot(child: Instance): UseBoundStore<RootState, import("zustand").StoreApi<RootState>>;
94
- export declare type EquConfig = {
95
- /** Compare arrays by reference equality a === b (default), or by shallow equality */
96
- arrays?: 'reference' | 'shallow';
97
- /** Compare objects by reference equality a === b (default), or by shallow equality */
98
- objects?: 'reference' | 'shallow';
99
- /** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
100
- strict?: boolean;
101
- };
102
- export declare const is: {
103
- obj: (a: any) => boolean;
104
- fun: (a: any) => a is Function;
105
- str: (a: any) => a is string;
106
- num: (a: any) => a is number;
107
- boo: (a: any) => a is boolean;
108
- und: (a: any) => boolean;
109
- arr: (a: any) => boolean;
110
- equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
111
- };
112
- /**
113
- * Collects nodes and materials from a THREE.Object3D.
114
- */
115
- export declare function buildGraph(object: THREE.Object3D): ObjectMap;
116
- export declare function dispose<TObj extends {
117
- dispose?: () => void;
118
- type?: string;
119
- [key: string]: any;
120
- }>(obj: TObj): void;
121
- export declare function prepare<T = THREE.Object3D>(object: T, state?: Partial<LocalState>): T;
122
- export declare function attach(parent: Instance, child: Instance, type: AttachType): void;
123
- export declare function detach(parent: Instance, child: Instance, type: AttachType): void;
124
- declare type MaybeInstance = Omit<Instance, '__r3f'> & {
125
- __r3f?: LocalState;
126
- };
127
- export declare function diffProps(instance: MaybeInstance, { children: cN, key: kN, ref: rN, ...props }: InstanceProps, { children: cP, key: kP, ref: rP, ...previous }?: InstanceProps, remove?: boolean): DiffSet;
128
- export declare function applyProps(instance: MaybeInstance, data: InstanceProps | DiffSet): MaybeInstance;
129
- export declare function invalidateInstance(instance: MaybeInstance): void;
130
- export declare function updateInstance(instance: MaybeInstance): void;
131
- export declare function updateCamera(camera: Camera & {
132
- manual?: boolean;
133
- }, size: Size): void;
134
- export {};
1
+ /// <reference types="webxr" />
2
+ import * as THREE from 'three';
3
+ import * as React from 'react';
4
+ import { UseBoundStore } from 'zustand';
5
+ import { AttachType, Instance, InstanceProps, LocalState } from './renderer';
6
+ import { Dpr, Renderer, RootState, Size } from './store';
7
+ /** @ts-ignore */
8
+ declare type _DeprecatedXRFrame = THREE.XRFrame;
9
+ /** @ts-ignore */
10
+ export declare type _XRFrame = THREE.WebGLRenderTargetOptions extends {
11
+ samples?: number;
12
+ } ? XRFrame : _DeprecatedXRFrame;
13
+ /**
14
+ * Returns `true` with correct TS type inference if an object has a configurable color space (since r152).
15
+ */
16
+ export declare const hasColorSpace: <T extends object | Renderer | THREE.Texture, P = T extends Renderer ? {
17
+ outputColorSpace: string;
18
+ } : {
19
+ colorSpace: string;
20
+ }>(object: T) => object is T & P;
21
+ export declare type ColorManagementRepresentation = {
22
+ enabled: boolean | never;
23
+ } | {
24
+ legacyMode: boolean | never;
25
+ };
26
+ /**
27
+ * The current THREE.ColorManagement instance, if present.
28
+ */
29
+ export declare const getColorManagement: () => ColorManagementRepresentation | null;
30
+ export declare type Camera = THREE.OrthographicCamera | THREE.PerspectiveCamera;
31
+ export declare const isOrthographicCamera: (def: Camera) => def is THREE.OrthographicCamera;
32
+ export declare const isRef: (obj: any) => obj is React.MutableRefObject<unknown>;
33
+ /**
34
+ * An SSR-friendly useLayoutEffect.
35
+ *
36
+ * React currently throws a warning when using useLayoutEffect on the server.
37
+ * To get around it, we can conditionally useEffect on the server (no-op) and
38
+ * useLayoutEffect elsewhere.
39
+ *
40
+ * @see https://github.com/facebook/react/issues/14927
41
+ */
42
+ export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
43
+ export declare function useMutableCallback<T>(fn: T): React.MutableRefObject<T>;
44
+ export declare type SetBlock = false | Promise<null> | null;
45
+ export declare type UnblockProps = {
46
+ set: React.Dispatch<React.SetStateAction<SetBlock>>;
47
+ children: React.ReactNode;
48
+ };
49
+ export declare function Block({ set }: Omit<UnblockProps, 'children'>): null;
50
+ export declare class ErrorBoundary extends React.Component<{
51
+ set: React.Dispatch<Error | undefined>;
52
+ children: React.ReactNode;
53
+ }, {
54
+ error: boolean;
55
+ }> {
56
+ state: {
57
+ error: boolean;
58
+ };
59
+ static getDerivedStateFromError: () => {
60
+ error: boolean;
61
+ };
62
+ componentDidCatch(err: Error): void;
63
+ render(): React.ReactNode;
64
+ }
65
+ export declare const DEFAULT = "__default";
66
+ export declare const DEFAULTS: Map<any, any>;
67
+ export declare type DiffSet = {
68
+ memoized: {
69
+ [key: string]: any;
70
+ };
71
+ changes: [key: string, value: unknown, isEvent: boolean, keys: string[]][];
72
+ };
73
+ export declare const isDiffSet: (def: any) => def is DiffSet;
74
+ export declare type ClassConstructor = {
75
+ new (): void;
76
+ };
77
+ export declare type ObjectMap = {
78
+ nodes: {
79
+ [name: string]: THREE.Object3D;
80
+ };
81
+ materials: {
82
+ [name: string]: THREE.Material;
83
+ };
84
+ };
85
+ export declare function calculateDpr(dpr: Dpr): number;
86
+ /**
87
+ * Returns instance root state
88
+ */
89
+ export declare const getRootState: (obj: THREE.Object3D) => RootState | undefined;
90
+ /**
91
+ * Returns the instances initial (outmost) root
92
+ */
93
+ export declare function findInitialRoot(child: Instance): UseBoundStore<RootState, import("zustand").StoreApi<RootState>>;
94
+ export declare type EquConfig = {
95
+ /** Compare arrays by reference equality a === b (default), or by shallow equality */
96
+ arrays?: 'reference' | 'shallow';
97
+ /** Compare objects by reference equality a === b (default), or by shallow equality */
98
+ objects?: 'reference' | 'shallow';
99
+ /** If true the keys in both a and b must match 1:1 (default), if false a's keys must intersect b's */
100
+ strict?: boolean;
101
+ };
102
+ export declare const is: {
103
+ obj: (a: any) => boolean;
104
+ fun: (a: any) => a is Function;
105
+ str: (a: any) => a is string;
106
+ num: (a: any) => a is number;
107
+ boo: (a: any) => a is boolean;
108
+ und: (a: any) => boolean;
109
+ arr: (a: any) => boolean;
110
+ equ(a: any, b: any, { arrays, objects, strict }?: EquConfig): boolean;
111
+ };
112
+ /**
113
+ * Collects nodes and materials from a THREE.Object3D.
114
+ */
115
+ export declare function buildGraph(object: THREE.Object3D): ObjectMap;
116
+ export declare function dispose<TObj extends {
117
+ dispose?: () => void;
118
+ type?: string;
119
+ [key: string]: any;
120
+ }>(obj: TObj): void;
121
+ export declare function prepare<T = THREE.Object3D>(object: T, state?: Partial<LocalState>): T;
122
+ export declare function attach(parent: Instance, child: Instance, type: AttachType): void;
123
+ export declare function detach(parent: Instance, child: Instance, type: AttachType): void;
124
+ declare type MaybeInstance = Omit<Instance, '__r3f'> & {
125
+ __r3f?: LocalState;
126
+ };
127
+ export declare function diffProps(instance: MaybeInstance, { children: cN, key: kN, ref: rN, ...props }: InstanceProps, { children: cP, key: kP, ref: rP, ...previous }?: InstanceProps, remove?: boolean): DiffSet;
128
+ export declare function applyProps(instance: MaybeInstance, data: InstanceProps | DiffSet): MaybeInstance;
129
+ export declare function invalidateInstance(instance: MaybeInstance): void;
130
+ export declare function updateInstance(instance: MaybeInstance): void;
131
+ export declare function updateCamera(camera: Camera & {
132
+ manual?: boolean;
133
+ }, size: Size): void;
134
+ export {};
@@ -1,12 +1,12 @@
1
- export * from './three-types';
2
- import * as ReactThreeFiber from './three-types';
3
- export { ReactThreeFiber };
4
- export type { BaseInstance, LocalState } from './core/renderer';
5
- export type { Intersection, Subscription, Dpr, Size, Viewport, RenderCallback, Performance, RootState, } from './core/store';
6
- export type { ThreeEvent, Events, EventManager, ComputeFunction } from './core/events';
7
- export { createEvents } from './core/events';
8
- export type { ObjectMap, Camera } from './core/utils';
9
- export * from './web/Canvas';
10
- export { createPointerEvents as events, createPointerEvents } from './web/events';
11
- export type { GlobalRenderCallback, GlobalEffectType } from './core/loop';
12
- export * from './core';
1
+ export * from './three-types';
2
+ import * as ReactThreeFiber from './three-types';
3
+ export { ReactThreeFiber };
4
+ export type { BaseInstance, LocalState } from './core/renderer';
5
+ export type { Intersection, Subscription, Dpr, Size, Viewport, RenderCallback, Performance, RootState, } from './core/store';
6
+ export type { ThreeEvent, Events, EventManager, ComputeFunction } from './core/events';
7
+ export { createEvents } from './core/events';
8
+ export type { ObjectMap, Camera } from './core/utils';
9
+ export * from './web/Canvas';
10
+ export { createPointerEvents as events, createPointerEvents } from './web/events';
11
+ export type { GlobalRenderCallback, GlobalEffectType } from './core/loop';
12
+ export * from './core';
@@ -1,14 +1,14 @@
1
- import * as React from 'react';
2
- import { View, type ViewProps, type ViewStyle } from 'react-native';
3
- import { RenderProps } from '../core';
4
- export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, ViewProps {
5
- children: React.ReactNode;
6
- style?: ViewStyle;
7
- }
8
- export interface Props extends CanvasProps {
9
- }
10
- /**
11
- * A native canvas which accepts threejs elements as children.
12
- * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
13
- */
14
- export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<View>>;
1
+ import * as React from 'react';
2
+ import { View, type ViewProps, type ViewStyle } from 'react-native';
3
+ import { RenderProps } from '../core';
4
+ export interface CanvasProps extends Omit<RenderProps<HTMLCanvasElement>, 'size' | 'dpr'>, ViewProps {
5
+ children: React.ReactNode;
6
+ style?: ViewStyle;
7
+ }
8
+ export interface Props extends CanvasProps {
9
+ }
10
+ /**
11
+ * A native canvas which accepts threejs elements as children.
12
+ * @see https://docs.pmnd.rs/react-three-fiber/api/canvas
13
+ */
14
+ export declare const Canvas: React.ForwardRefExoticComponent<Props & React.RefAttributes<View>>;
@@ -1,5 +1,5 @@
1
- import { UseBoundStore } from 'zustand';
2
- import { RootState } from '../core/store';
3
- import { EventManager } from '../core/events';
4
- /** Default R3F event manager for react-native */
5
- export declare function createTouchEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
1
+ import { UseBoundStore } from 'zustand';
2
+ import { RootState } from '../core/store';
3
+ import { EventManager } from '../core/events';
4
+ /** Default R3F event manager for react-native */
5
+ export declare function createTouchEvents(store: UseBoundStore<RootState>): EventManager<HTMLElement>;
@@ -1 +1 @@
1
- export declare function polyfills(): void;
1
+ export declare function polyfills(): void;
@@ -1,13 +1,13 @@
1
- export * from './three-types';
2
- import * as ReactThreeFiber from './three-types';
3
- export { ReactThreeFiber };
4
- export type { BaseInstance, LocalState } from './core/renderer';
5
- export type { Intersection, Subscription, Dpr, Size, Viewport, RenderCallback, Performance, RootState, } from './core/store';
6
- export type { ThreeEvent, Events, EventManager, ComputeFunction } from './core/events';
7
- export { createEvents } from './core/events';
8
- export type { ObjectMap, Camera } from './core/utils';
9
- export * from './native/Canvas';
10
- export { createTouchEvents as events } from './native/events';
11
- export { createPointerEvents } from './web/events';
12
- export type { GlobalRenderCallback, GlobalEffectType } from './core/loop';
13
- export * from './core';
1
+ export * from './three-types';
2
+ import * as ReactThreeFiber from './three-types';
3
+ export { ReactThreeFiber };
4
+ export type { BaseInstance, LocalState } from './core/renderer';
5
+ export type { Intersection, Subscription, Dpr, Size, Viewport, RenderCallback, Performance, RootState, } from './core/store';
6
+ export type { ThreeEvent, Events, EventManager, ComputeFunction } from './core/events';
7
+ export { createEvents } from './core/events';
8
+ export type { ObjectMap, Camera } from './core/utils';
9
+ export * from './native/Canvas';
10
+ export { createTouchEvents as events } from './native/events';
11
+ export { createPointerEvents } from './web/events';
12
+ export type { GlobalRenderCallback, GlobalEffectType } from './core/loop';
13
+ export * from './core';