@motion-core/motion-gpu 0.3.0 → 0.4.1

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 (38) hide show
  1. package/README.md +72 -1
  2. package/dist/core/material-preprocess.d.ts +5 -5
  3. package/dist/core/material-preprocess.js +1 -4
  4. package/dist/core/material.d.ts +32 -23
  5. package/dist/core/material.js +14 -7
  6. package/dist/core/render-targets.d.ts +1 -0
  7. package/dist/core/runtime-loop.d.ts +1 -0
  8. package/dist/core/textures.d.ts +1 -0
  9. package/dist/core/types.d.ts +21 -10
  10. package/dist/passes/CopyPass.d.ts +1 -0
  11. package/dist/passes/FullscreenPass.d.ts +1 -0
  12. package/dist/react/FragCanvas.d.ts +27 -0
  13. package/dist/react/FragCanvas.js +218 -0
  14. package/dist/react/MotionGPUErrorOverlay.d.ts +6 -0
  15. package/dist/react/MotionGPUErrorOverlay.js +305 -0
  16. package/dist/react/Portal.d.ts +6 -0
  17. package/dist/react/Portal.js +24 -0
  18. package/dist/react/advanced.d.ts +11 -0
  19. package/dist/react/advanced.js +6 -0
  20. package/dist/react/frame-context.d.ts +14 -0
  21. package/dist/react/frame-context.js +98 -0
  22. package/dist/react/index.d.ts +15 -0
  23. package/dist/react/index.js +9 -0
  24. package/dist/react/motiongpu-context.d.ts +73 -0
  25. package/dist/react/motiongpu-context.js +18 -0
  26. package/dist/react/use-motiongpu-user-context.d.ts +49 -0
  27. package/dist/react/use-motiongpu-user-context.js +94 -0
  28. package/dist/react/use-texture.d.ts +40 -0
  29. package/dist/react/use-texture.js +162 -0
  30. package/dist/svelte/FragCanvas.svelte +8 -22
  31. package/dist/svelte/FragCanvas.svelte.d.ts +1 -0
  32. package/dist/svelte/MotionGPUErrorOverlay.svelte +17 -20
  33. package/dist/svelte/Portal.svelte +6 -21
  34. package/dist/svelte/use-motiongpu-user-context.d.ts +9 -1
  35. package/dist/svelte/use-motiongpu-user-context.js +4 -1
  36. package/dist/svelte/use-texture.d.ts +6 -2
  37. package/dist/svelte/use-texture.js +6 -2
  38. package/package.json +32 -4
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
  [![Svelte](https://img.shields.io/badge/Svelte-5-orange.svg)](https://svelte.dev)
5
+ [![React](https://img.shields.io/badge/React-18%2B-149eca.svg)](https://react.dev)
5
6
  [![WebGPU](https://img.shields.io/badge/Shaders-WGSL-blueviolet.svg)](https://gpuweb.github.io/gpuweb/)
6
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9.3-blue.svg)](https://www.typescriptlang.org)
7
8
  [![npm](https://img.shields.io/badge/npm-@motion--core%2Fmotion--gpu-red.svg)](https://www.npmjs.com/package/@motion-core/motion-gpu)
@@ -12,7 +13,7 @@
12
13
 
13
14
  **A tiny WebGPU runtime for writing Shadertoy-style fullscreen shaders in pure WGSL.**
14
15
 
15
- `@motion-core/motion-gpu` ships a framework-agnostic core plus a Svelte 5 adapter for building fullscreen shader pipelines using WebGPU and WGSL.
16
+ `@motion-core/motion-gpu` ships a framework-agnostic core plus Svelte 5 and React adapters for building fullscreen shader pipelines using WebGPU and WGSL.
16
17
  It provides a minimal runtime loop, scheduler, and render graph designed specifically for fragment-driven GPU programs.
17
18
 
18
19
  Unlike general-purpose 3D engines, Motion GPU focuses on a very narrow problem: **running fullscreen fragment shaders and multi-pass GPU pipelines**.
@@ -119,6 +120,39 @@ Also exports runtime/core types:
119
120
 
120
121
  ---
121
122
 
123
+ ## React adapter
124
+
125
+ `@motion-core/motion-gpu/react` exposes the runtime API for React:
126
+
127
+ - `FragCanvas`
128
+ - `defineMaterial`
129
+ - `useMotionGPU`
130
+ - `useFrame`
131
+ - `useTexture`
132
+ - `ShaderPass`
133
+ - `BlitPass`
134
+ - `CopyPass`
135
+
136
+ Also exports runtime/core types:
137
+
138
+ - uniforms
139
+ - textures
140
+ - render passes
141
+ - scheduler
142
+ - loader types
143
+
144
+ ---
145
+
146
+ `@motion-core/motion-gpu/react/advanced` re-exports everything above, plus:
147
+
148
+ - `useMotionGPUUserContext`
149
+ - `useSetMotionGPUUserContext`
150
+ - `setMotionGPUUserContext`
151
+ - `applySchedulerPreset`
152
+ - `captureSchedulerDebugSnapshot`
153
+
154
+ ---
155
+
122
156
  ## Framework-agnostic core
123
157
 
124
158
  `@motion-core/motion-gpu` (and explicit alias `@motion-core/motion-gpu/core`) exposes adapter-building primitives:
@@ -144,6 +178,7 @@ Also exports runtime/core types:
144
178
  # Requirements
145
179
 
146
180
  - Svelte 5 is required only for the Svelte adapter entrypoints (`/svelte`, `/svelte/advanced`)
181
+ - React 18+ is required only for the React adapter entrypoints (`/react`, `/react/advanced`)
147
182
  - A browser/runtime with WebGPU support
148
183
  - Secure context (`https://` or `localhost`)
149
184
 
@@ -188,6 +223,30 @@ fn frag(uv: vec2f) -> vec4f {
188
223
 
189
224
  ---
190
225
 
226
+ ### React equivalent
227
+
228
+ ```tsx
229
+ import { FragCanvas, defineMaterial } from '@motion-core/motion-gpu/react';
230
+
231
+ const material = defineMaterial({
232
+ fragment: `
233
+ fn frag(uv: vec2f) -> vec4f {
234
+ return vec4f(uv.x, uv.y, 0.25, 1.0);
235
+ }
236
+ `
237
+ });
238
+
239
+ export function App() {
240
+ return (
241
+ <div style={{ width: '100vw', height: '100vh' }}>
242
+ <FragCanvas material={material} />
243
+ </div>
244
+ );
245
+ }
246
+ ```
247
+
248
+ ---
249
+
191
250
  ## 2. Add animated uniforms via `useFrame`
192
251
 
193
252
  ```svelte
@@ -225,6 +284,18 @@ fn frag(uv: vec2f) -> vec4f {
225
284
  </script>
226
285
  ```
227
286
 
287
+ ```tsx
288
+ import { useFrame } from '@motion-core/motion-gpu/react';
289
+
290
+ export function Runtime() {
291
+ useFrame((state) => {
292
+ state.setUniform('uTime', state.time);
293
+ });
294
+
295
+ return null;
296
+ }
297
+ ```
298
+
228
299
  ---
229
300
 
230
301
  # Core Runtime Model
@@ -44,11 +44,11 @@ export interface PreprocessedMaterialFragment {
44
44
  /**
45
45
  * Validates and normalizes define entries.
46
46
  */
47
- export declare function normalizeDefines(defines: MaterialDefines | undefined): MaterialDefines;
47
+ export declare function normalizeDefines<TDefineKey extends string>(defines: MaterialDefines<TDefineKey> | undefined): MaterialDefines<TDefineKey>;
48
48
  /**
49
49
  * Validates include map identifiers and source chunks.
50
50
  */
51
- export declare function normalizeIncludes(includes: MaterialIncludes | undefined): MaterialIncludes;
51
+ export declare function normalizeIncludes<TIncludeKey extends string>(includes: MaterialIncludes<TIncludeKey> | undefined): MaterialIncludes<TIncludeKey>;
52
52
  /**
53
53
  * Converts one define declaration to WGSL `const`.
54
54
  */
@@ -56,8 +56,8 @@ export declare function toDefineLine(key: string, value: MaterialDefineValue): s
56
56
  /**
57
57
  * Preprocesses material fragment with deterministic define/include expansion and line mapping.
58
58
  */
59
- export declare function preprocessMaterialFragment(input: {
59
+ export declare function preprocessMaterialFragment<TDefineKey extends string, TIncludeKey extends string>(input: {
60
60
  fragment: string;
61
- defines?: MaterialDefines;
62
- includes?: MaterialIncludes;
61
+ defines?: MaterialDefines<TDefineKey>;
62
+ includes?: MaterialIncludes<TIncludeKey>;
63
63
  }): PreprocessedMaterialFragment;
@@ -44,10 +44,7 @@ export function normalizeDefines(defines) {
44
44
  continue;
45
45
  }
46
46
  const normalized = normalizeTypedDefine(name, value);
47
- resolved[name] = Object.freeze({
48
- type: normalized.type,
49
- value: normalized.value
50
- });
47
+ resolved[name] = Object.freeze(normalized);
51
48
  }
52
49
  return resolved;
53
50
  }
@@ -5,16 +5,25 @@ import type { TextureDefinitionMap, UniformMap } from './types.js';
5
5
  /**
6
6
  * Typed compile-time define declaration.
7
7
  */
8
- export interface TypedMaterialDefineValue {
8
+ export type TypedMaterialDefineValue = {
9
9
  /**
10
10
  * WGSL scalar type.
11
11
  */
12
- type: 'bool' | 'f32' | 'i32' | 'u32';
12
+ type: 'bool';
13
13
  /**
14
14
  * Literal value for the selected WGSL type.
15
15
  */
16
- value: boolean | number;
17
- }
16
+ value: boolean;
17
+ } | {
18
+ /**
19
+ * WGSL scalar type.
20
+ */
21
+ type: 'f32' | 'i32' | 'u32';
22
+ /**
23
+ * Literal value for the selected WGSL type.
24
+ */
25
+ value: number;
26
+ };
18
27
  /**
19
28
  * Allowed value types for WGSL `const` define injection.
20
29
  */
@@ -22,15 +31,15 @@ export type MaterialDefineValue = boolean | number | TypedMaterialDefineValue;
22
31
  /**
23
32
  * Define map keyed by uniform-compatible identifier names.
24
33
  */
25
- export type MaterialDefines = Record<string, MaterialDefineValue>;
34
+ export type MaterialDefines<TKey extends string = string> = Record<TKey, MaterialDefineValue>;
26
35
  /**
27
36
  * Include map keyed by include identifier used in `#include <name>` directives.
28
37
  */
29
- export type MaterialIncludes = Record<string, string>;
38
+ export type MaterialIncludes<TKey extends string = string> = Record<TKey, string>;
30
39
  /**
31
40
  * External material input accepted by {@link defineMaterial}.
32
41
  */
33
- export interface FragMaterialInput {
42
+ export interface FragMaterialInput<TUniformKey extends string = string, TTextureKey extends string = string, TDefineKey extends string = string, TIncludeKey extends string = string> {
34
43
  /**
35
44
  * User WGSL source containing `frag(uv: vec2f) -> vec4f`.
36
45
  */
@@ -38,24 +47,24 @@ export interface FragMaterialInput {
38
47
  /**
39
48
  * Initial uniform values.
40
49
  */
41
- uniforms?: UniformMap;
50
+ uniforms?: UniformMap<TUniformKey>;
42
51
  /**
43
52
  * Texture definitions keyed by texture uniform name.
44
53
  */
45
- textures?: TextureDefinitionMap;
54
+ textures?: TextureDefinitionMap<TTextureKey>;
46
55
  /**
47
56
  * Optional compile-time define constants injected into WGSL.
48
57
  */
49
- defines?: MaterialDefines;
58
+ defines?: MaterialDefines<TDefineKey>;
50
59
  /**
51
60
  * Optional WGSL include chunks used by `#include <name>` directives.
52
61
  */
53
- includes?: MaterialIncludes;
62
+ includes?: MaterialIncludes<TIncludeKey>;
54
63
  }
55
64
  /**
56
65
  * Normalized and immutable material declaration consumed by `FragCanvas`.
57
66
  */
58
- export interface FragMaterial {
67
+ export interface FragMaterial<TUniformKey extends string = string, TTextureKey extends string = string, TDefineKey extends string = string, TIncludeKey extends string = string> {
59
68
  /**
60
69
  * User WGSL source containing `frag(uv: vec2f) -> vec4f`.
61
70
  */
@@ -63,24 +72,24 @@ export interface FragMaterial {
63
72
  /**
64
73
  * Initial uniform values.
65
74
  */
66
- readonly uniforms: Readonly<UniformMap>;
75
+ readonly uniforms: Readonly<UniformMap<TUniformKey>>;
67
76
  /**
68
77
  * Texture definitions keyed by texture uniform name.
69
78
  */
70
- readonly textures: Readonly<TextureDefinitionMap>;
79
+ readonly textures: Readonly<TextureDefinitionMap<TTextureKey>>;
71
80
  /**
72
81
  * Optional compile-time define constants injected into WGSL.
73
82
  */
74
- readonly defines: Readonly<MaterialDefines>;
83
+ readonly defines: Readonly<MaterialDefines<TDefineKey>>;
75
84
  /**
76
85
  * Optional WGSL include chunks used by `#include <name>` directives.
77
86
  */
78
- readonly includes: Readonly<MaterialIncludes>;
87
+ readonly includes: Readonly<MaterialIncludes<TIncludeKey>>;
79
88
  }
80
89
  /**
81
90
  * Fully resolved, immutable material snapshot used for renderer creation/caching.
82
91
  */
83
- export interface ResolvedMaterial {
92
+ export interface ResolvedMaterial<TUniformKey extends string = string, TTextureKey extends string = string, TIncludeKey extends string = string> {
84
93
  /**
85
94
  * Final fragment WGSL after define injection.
86
95
  */
@@ -92,11 +101,11 @@ export interface ResolvedMaterial {
92
101
  /**
93
102
  * Cloned uniforms.
94
103
  */
95
- uniforms: UniformMap;
104
+ uniforms: UniformMap<TUniformKey>;
96
105
  /**
97
106
  * Cloned texture definitions.
98
107
  */
99
- textures: TextureDefinitionMap;
108
+ textures: TextureDefinitionMap<TTextureKey>;
100
109
  /**
101
110
  * Resolved packed uniform layout.
102
111
  */
@@ -104,7 +113,7 @@ export interface ResolvedMaterial {
104
113
  /**
105
114
  * Sorted texture keys.
106
115
  */
107
- textureKeys: string[];
116
+ textureKeys: TTextureKey[];
108
117
  /**
109
118
  * Deterministic JSON signature for cache invalidation.
110
119
  */
@@ -116,7 +125,7 @@ export interface ResolvedMaterial {
116
125
  /**
117
126
  * Normalized include sources map.
118
127
  */
119
- includeSources: MaterialIncludes;
128
+ includeSources: MaterialIncludes<TIncludeKey>;
120
129
  /**
121
130
  * Deterministic define block source used for diagnostics mapping.
122
131
  */
@@ -147,11 +156,11 @@ export declare function applyMaterialDefines(fragment: string, defines: Material
147
156
  * @param input - User material declaration.
148
157
  * @returns Frozen material object safe to share and cache.
149
158
  */
150
- export declare function defineMaterial(input: FragMaterialInput): FragMaterial;
159
+ export declare function defineMaterial<TUniformKey extends string = string, TTextureKey extends string = string, TDefineKey extends string = string, TIncludeKey extends string = string>(input: FragMaterialInput<TUniformKey, TTextureKey, TDefineKey, TIncludeKey>): FragMaterial<TUniformKey, TTextureKey, TDefineKey, TIncludeKey>;
151
160
  /**
152
161
  * Resolves a material to renderer-ready data and a deterministic signature.
153
162
  *
154
163
  * @param material - Material input created via {@link defineMaterial}.
155
164
  * @returns Resolved material with packed uniform layout, sorted texture keys and cache signature.
156
165
  */
157
- export declare function resolveMaterial(material: FragMaterial): ResolvedMaterial;
166
+ export declare function resolveMaterial<TUniformKey extends string = string, TTextureKey extends string = string, TDefineKey extends string = string, TIncludeKey extends string = string>(material: FragMaterial<TUniformKey, TTextureKey, TDefineKey, TIncludeKey>): ResolvedMaterial<TUniformKey, TTextureKey, TIncludeKey>;
@@ -6,12 +6,17 @@ import { normalizeDefines, normalizeIncludes, preprocessMaterialFragment, toDefi
6
6
  */
7
7
  const FRAGMENT_FUNCTION_SIGNATURE_PATTERN = /\bfn\s+frag\s*\(\s*([^)]*?)\s*\)\s*->\s*([A-Za-z_][A-Za-z0-9_<>\s]*)\s*(?:\{|$)/m;
8
8
  const FRAGMENT_FUNCTION_NAME_PATTERN = /\bfn\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
9
- /**
10
- * Cache of resolved material snapshots keyed by immutable material instance.
11
- */
12
9
  const resolvedMaterialCache = new WeakMap();
13
10
  const preprocessedFragmentCache = new WeakMap();
14
11
  const materialSourceMetadataCache = new WeakMap();
12
+ function getCachedResolvedMaterial(material) {
13
+ const cached = resolvedMaterialCache.get(material);
14
+ if (!cached) {
15
+ return null;
16
+ }
17
+ // Invariant: the cache key is the same material object used to produce this resolved payload.
18
+ return cached;
19
+ }
15
20
  const STACK_TRACE_CHROME_PATTERN = /^\s*at\s+(?:(.*?)\s+\()?(.+?):(\d+):(\d+)\)?$/;
16
21
  const STACK_TRACE_FIREFOX_PATTERN = /^(.*?)@(.+?):(\d+):(\d+)$/;
17
22
  function getPathBasename(path) {
@@ -204,9 +209,11 @@ function resolveTextures(textures) {
204
209
  const resolved = {};
205
210
  for (const [name, definition] of Object.entries(textures ?? {})) {
206
211
  assertUniformName(name);
212
+ const source = definition?.source;
213
+ const normalizedSource = cloneTextureValue(source);
207
214
  const clonedDefinition = {
208
215
  ...(definition ?? {}),
209
- source: cloneTextureValue(definition?.source)
216
+ ...(source !== undefined ? { source: normalizedSource } : {})
210
217
  };
211
218
  resolved[name] = Object.freeze(clonedDefinition);
212
219
  }
@@ -296,8 +303,8 @@ export function defineMaterial(input) {
296
303
  const source = Object.freeze(resolveSourceMetadata(undefined));
297
304
  const preprocessed = preprocessMaterialFragment({
298
305
  fragment,
299
- defines: defines,
300
- includes: includes
306
+ defines,
307
+ includes
301
308
  });
302
309
  const material = Object.freeze({
303
310
  fragment,
@@ -318,7 +325,7 @@ export function defineMaterial(input) {
318
325
  */
319
326
  export function resolveMaterial(material) {
320
327
  assertDefinedMaterial(material);
321
- const cached = resolvedMaterialCache.get(material);
328
+ const cached = getCachedResolvedMaterial(material);
322
329
  if (cached) {
323
330
  return cached;
324
331
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  import type { RenderTargetDefinitionMap } from './types.js';
2
3
  /**
3
4
  * Concrete render target configuration resolved for current canvas size.
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  import type { CurrentReadable, CurrentWritable } from './current-value.js';
2
3
  import { type FragMaterial } from './material.js';
3
4
  import { type MotionGPUErrorReport } from './error-report.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  import type { TextureData, TextureDefinition, TextureDefinitionMap, TextureUpdateMode, TextureValue } from './types.js';
2
3
  /**
3
4
  * Texture definition with defaults and normalized numeric limits applied.
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  /**
2
3
  * Core runtime and API contracts used by MotionGPU's renderer, hooks and scheduler.
3
4
  */
@@ -11,7 +12,21 @@ export type UniformType = 'f32' | 'vec2f' | 'vec3f' | 'vec4f' | 'mat4x4f';
11
12
  * @typeParam TType - WGSL type tag.
12
13
  * @typeParam TValue - Runtime value shape for the selected type.
13
14
  */
14
- export interface TypedUniform<TType extends UniformType = UniformType, TValue = unknown> {
15
+ /**
16
+ * Accepted matrix value formats for `mat4x4f` uniforms.
17
+ */
18
+ export type UniformMat4Value = number[] | Float32Array;
19
+ /**
20
+ * Runtime value shape by WGSL uniform type tag.
21
+ */
22
+ export interface UniformValueByType {
23
+ f32: number;
24
+ vec2f: [number, number];
25
+ vec3f: [number, number, number];
26
+ vec4f: [number, number, number, number];
27
+ mat4x4f: UniformMat4Value;
28
+ }
29
+ export interface TypedUniform<TType extends UniformType = UniformType, TValue extends UniformValueByType[TType] = UniformValueByType[TType]> {
15
30
  /**
16
31
  * WGSL type tag.
17
32
  */
@@ -21,18 +36,14 @@ export interface TypedUniform<TType extends UniformType = UniformType, TValue =
21
36
  */
22
37
  value: TValue;
23
38
  }
24
- /**
25
- * Accepted matrix value formats for `mat4x4f` uniforms.
26
- */
27
- export type UniformMat4Value = number[] | Float32Array;
28
39
  /**
29
40
  * Supported uniform input shapes accepted by material and render APIs.
30
41
  */
31
- export type UniformValue = number | [number, number] | [number, number, number] | [number, number, number, number] | TypedUniform<'f32', number> | TypedUniform<'vec2f', [number, number]> | TypedUniform<'vec3f', [number, number, number]> | TypedUniform<'vec4f', [number, number, number, number]> | TypedUniform<'mat4x4f', UniformMat4Value>;
42
+ export type UniformValue = number | [number, number] | [number, number, number] | [number, number, number, number] | TypedUniform<'f32'> | TypedUniform<'vec2f'> | TypedUniform<'vec3f'> | TypedUniform<'vec4f'> | TypedUniform<'mat4x4f'>;
32
43
  /**
33
44
  * Uniform map keyed by WGSL identifier names.
34
45
  */
35
- export type UniformMap = Record<string, UniformValue>;
46
+ export type UniformMap<TKey extends string = string> = Record<TKey, UniformValue>;
36
47
  /**
37
48
  * Resolved layout metadata for a single uniform field inside the packed uniform buffer.
38
49
  */
@@ -168,11 +179,11 @@ export interface TextureDefinition {
168
179
  /**
169
180
  * Texture definition map keyed by uniform-compatible texture names.
170
181
  */
171
- export type TextureDefinitionMap = Record<string, TextureDefinition>;
182
+ export type TextureDefinitionMap<TKey extends string = string> = Record<TKey, TextureDefinition>;
172
183
  /**
173
184
  * Runtime texture value map keyed by texture uniform names.
174
185
  */
175
- export type TextureMap = Record<string, TextureValue>;
186
+ export type TextureMap<TKey extends string = string> = Record<TKey, TextureValue>;
176
187
  /**
177
188
  * Output color space requested for final canvas presentation.
178
189
  */
@@ -226,7 +237,7 @@ export interface RenderTarget {
226
237
  /**
227
238
  * Named render target definitions keyed by output slot names.
228
239
  */
229
- export type RenderTargetDefinitionMap = Record<string, RenderTargetDefinition>;
240
+ export type RenderTargetDefinitionMap<TKey extends string = string> = Record<TKey, RenderTargetDefinition>;
230
241
  /**
231
242
  * User-defined render slot name (mapped to `renderTargets` keys).
232
243
  */
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  import type { RenderPass, RenderPassContext, RenderPassFlags, RenderPassInputSlot, RenderPassOutputSlot } from '../core/types.js';
2
3
  export interface CopyPassOptions extends RenderPassFlags {
3
4
  enabled?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" />
1
2
  import type { RenderPass, RenderPassContext, RenderPassFlags, RenderPassInputSlot, RenderPassOutputSlot } from '../core/types.js';
2
3
  export interface FullscreenPassOptions extends RenderPassFlags {
3
4
  enabled?: boolean;
@@ -0,0 +1,27 @@
1
+ /// <reference types="@webgpu/types" />
2
+ import { type MotionGPUErrorReport } from '../core/error-report.js';
3
+ import type { FragMaterial } from '../core/material.js';
4
+ import type { OutputColorSpace, RenderPass, RenderMode, RenderTargetDefinitionMap } from '../core/types.js';
5
+ import { type CSSProperties, type ReactNode } from 'react';
6
+ export interface FragCanvasProps {
7
+ material: FragMaterial;
8
+ renderTargets?: RenderTargetDefinitionMap;
9
+ passes?: RenderPass[];
10
+ clearColor?: [number, number, number, number];
11
+ outputColorSpace?: OutputColorSpace;
12
+ renderMode?: RenderMode;
13
+ autoRender?: boolean;
14
+ maxDelta?: number;
15
+ adapterOptions?: GPURequestAdapterOptions;
16
+ deviceDescriptor?: GPUDeviceDescriptor;
17
+ dpr?: number;
18
+ showErrorOverlay?: boolean;
19
+ errorRenderer?: (report: MotionGPUErrorReport) => ReactNode;
20
+ onError?: (report: MotionGPUErrorReport) => void;
21
+ errorHistoryLimit?: number;
22
+ onErrorHistory?: (history: MotionGPUErrorReport[]) => void;
23
+ className?: string;
24
+ style?: CSSProperties;
25
+ children?: ReactNode;
26
+ }
27
+ export declare function FragCanvas({ material, renderTargets, passes, clearColor, outputColorSpace, renderMode, autoRender, maxDelta, adapterOptions, deviceDescriptor, dpr, showErrorOverlay, errorRenderer, onError, errorHistoryLimit, onErrorHistory, className, style, children }: FragCanvasProps): import("react/jsx-runtime").JSX.Element;