react-native-effects 0.1.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.
Files changed (61) hide show
  1. package/README.md +75 -13
  2. package/lib/module/components/ShaderView/index.js +122 -27
  3. package/lib/module/components/ShaderView/index.js.map +1 -1
  4. package/lib/module/components/ShaderViewWithPanGesture/index.js +196 -0
  5. package/lib/module/components/ShaderViewWithPanGesture/index.js.map +1 -0
  6. package/lib/module/hooks/useParamsSynchronizable.js +37 -0
  7. package/lib/module/hooks/useParamsSynchronizable.js.map +1 -0
  8. package/lib/module/hooks/useWGPUSetup.js +62 -13
  9. package/lib/module/hooks/useWGPUSetup.js.map +1 -1
  10. package/lib/module/index.js +3 -1
  11. package/lib/module/index.js.map +1 -1
  12. package/lib/module/shaders/uniforms.js +4 -3
  13. package/lib/module/shaders/uniforms.js.map +1 -1
  14. package/lib/module/utils/gpuDevice.js +38 -0
  15. package/lib/module/utils/gpuDevice.js.map +1 -0
  16. package/lib/typescript/src/components/Aurora.d.ts +1 -1
  17. package/lib/typescript/src/components/Aurora.d.ts.map +1 -1
  18. package/lib/typescript/src/components/CalicoSwirl.d.ts +1 -1
  19. package/lib/typescript/src/components/CalicoSwirl.d.ts.map +1 -1
  20. package/lib/typescript/src/components/Campfire.d.ts +1 -1
  21. package/lib/typescript/src/components/Campfire.d.ts.map +1 -1
  22. package/lib/typescript/src/components/CircularGradient.d.ts +1 -1
  23. package/lib/typescript/src/components/CircularGradient.d.ts.map +1 -1
  24. package/lib/typescript/src/components/Iridescence.d.ts +1 -1
  25. package/lib/typescript/src/components/Iridescence.d.ts.map +1 -1
  26. package/lib/typescript/src/components/LinearGradient.d.ts +1 -1
  27. package/lib/typescript/src/components/LinearGradient.d.ts.map +1 -1
  28. package/lib/typescript/src/components/LiquidChrome.d.ts +1 -1
  29. package/lib/typescript/src/components/LiquidChrome.d.ts.map +1 -1
  30. package/lib/typescript/src/components/ShaderView/index.d.ts +1 -1
  31. package/lib/typescript/src/components/ShaderView/index.d.ts.map +1 -1
  32. package/lib/typescript/src/components/ShaderView/types.d.ts +20 -0
  33. package/lib/typescript/src/components/ShaderView/types.d.ts.map +1 -1
  34. package/lib/typescript/src/components/ShaderViewWithPanGesture/index.d.ts +35 -0
  35. package/lib/typescript/src/components/ShaderViewWithPanGesture/index.d.ts.map +1 -0
  36. package/lib/typescript/src/components/Silk.d.ts +1 -1
  37. package/lib/typescript/src/components/Silk.d.ts.map +1 -1
  38. package/lib/typescript/src/hooks/useParamsSynchronizable.d.ts +22 -0
  39. package/lib/typescript/src/hooks/useParamsSynchronizable.d.ts.map +1 -0
  40. package/lib/typescript/src/hooks/useWGPUSetup.d.ts +5 -2
  41. package/lib/typescript/src/hooks/useWGPUSetup.d.ts.map +1 -1
  42. package/lib/typescript/src/index.d.ts +6 -2
  43. package/lib/typescript/src/index.d.ts.map +1 -1
  44. package/lib/typescript/src/shaders/uniforms.d.ts +3 -3
  45. package/lib/typescript/src/shaders/uniforms.d.ts.map +1 -1
  46. package/lib/typescript/src/utils/gpuDevice.d.ts +13 -0
  47. package/lib/typescript/src/utils/gpuDevice.d.ts.map +1 -0
  48. package/package.json +31 -30
  49. package/src/components/ShaderView/index.tsx +140 -32
  50. package/src/components/ShaderView/types.ts +21 -0
  51. package/src/components/ShaderViewWithPanGesture/index.tsx +225 -0
  52. package/src/hooks/useParamsSynchronizable.ts +52 -0
  53. package/src/hooks/useWGPUSetup.tsx +69 -21
  54. package/src/index.tsx +10 -1
  55. package/src/shaders/uniforms.ts +4 -3
  56. package/src/utils/gpuDevice.ts +38 -0
  57. package/lib/module/utils/initWebGPU.js +0 -40
  58. package/lib/module/utils/initWebGPU.js.map +0 -1
  59. package/lib/typescript/src/utils/initWebGPU.d.ts +0 -23
  60. package/lib/typescript/src/utils/initWebGPU.d.ts.map +0 -1
  61. package/src/utils/initWebGPU.ts +0 -47
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useRef } from 'react';
4
+ import { createSynchronizable } from 'react-native-worklets';
5
+ /**
6
+ * Creates a {@link ParamsSynchronizable} — a 4-float channel written into the
7
+ * dedicated `u.live` slot of a {@link ShaderView} every frame. It has its own
8
+ * uniform slot, so it leaves all 8 static `params` untouched.
9
+ *
10
+ * The returned `setParamsSynchronizable` runs on the JS thread (call it from gesture or scroll
11
+ * handlers); the values are read by the off-thread render loop. By convention
12
+ * the four floats carry `(x, y, active, extra)` for pointer input, or
13
+ * `(progress, ...)` for scroll-driven effects — but the meaning is up to the
14
+ * shader consuming `u.live`.
15
+ *
16
+ * Pass `initial` to seed the channel's starting value (read once on first
17
+ * render), so the shader has a sane resting state before the first update —
18
+ * e.g. `[0.5, 0.5, 0, 0]` to start a pointer at screen center. Defaults to all
19
+ * zeros.
20
+ */
21
+ export function useParamsSynchronizable(initial = [0, 0, 0, 0]) {
22
+ // Lazily create once; `initial` is only a seed, so it is read on first render
23
+ // and ignored thereafter.
24
+ const ref = useRef(null);
25
+ if (ref.current === null) {
26
+ ref.current = createSynchronizable(Float64Array.of(initial[0], initial[1], initial[2], initial[3]));
27
+ }
28
+ const paramsSynchronizable = ref.current;
29
+ const setParamsSynchronizable = useCallback((x, y, active, extra) => {
30
+ paramsSynchronizable.setBlocking(() => Float64Array.of(x, y, active, extra));
31
+ }, [paramsSynchronizable]);
32
+ return {
33
+ paramsSynchronizable,
34
+ setParamsSynchronizable
35
+ };
36
+ }
37
+ //# sourceMappingURL=useParamsSynchronizable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useRef","createSynchronizable","useParamsSynchronizable","initial","ref","current","Float64Array","of","paramsSynchronizable","setParamsSynchronizable","x","y","active","extra","setBlocking"],"sourceRoot":"../../../src","sources":["hooks/useParamsSynchronizable.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC3C,SAASC,oBAAoB,QAAQ,uBAAuB;AAG5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,OAAkD,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EASjE;EACA;EACA;EACA,MAAMC,GAAG,GAAGJ,MAAM,CAA8B,IAAI,CAAC;EACrD,IAAII,GAAG,CAACC,OAAO,KAAK,IAAI,EAAE;IACxBD,GAAG,CAACC,OAAO,GAAGJ,oBAAoB,CAChCK,YAAY,CAACC,EAAE,CAACJ,OAAO,CAAC,CAAC,CAAC,EAAEA,OAAO,CAAC,CAAC,CAAC,EAAEA,OAAO,CAAC,CAAC,CAAC,EAAEA,OAAO,CAAC,CAAC,CAAC,CAChE,CAAC;EACH;EACA,MAAMK,oBAAoB,GAAGJ,GAAG,CAACC,OAAO;EAExC,MAAMI,uBAAuB,GAAGV,WAAW,CACzC,CAACW,CAAS,EAAEC,CAAS,EAAEC,MAAc,EAAEC,KAAa,KAAK;IACvDL,oBAAoB,CAACM,WAAW,CAAC,MAC/BR,YAAY,CAACC,EAAE,CAACG,CAAC,EAAEC,CAAC,EAAEC,MAAM,EAAEC,KAAK,CACrC,CAAC;EACH,CAAC,EACD,CAACL,oBAAoB,CACvB,CAAC;EAED,OAAO;IAAEA,oBAAoB;IAAEC;EAAwB,CAAC;AAC1D","ignoreList":[]}
@@ -1,37 +1,45 @@
1
1
  "use strict";
2
2
 
3
3
  import { PixelRatio } from 'react-native';
4
- import { useCanvasRef } from 'react-native-wgpu';
5
- import { useEffect, useState } from 'react';
6
- import { initWebGPU } from "../utils/initWebGPU.js";
4
+ import { useCanvasRef } from 'react-native-webgpu';
5
+ import { useCallback, useEffect, useRef, useState } from 'react';
7
6
  import { BackgroundRuntime } from "../utils/backgroundRuntime.js";
7
+ import { getSharedGPUDevice } from "../utils/gpuDevice.js";
8
8
  export function useWGPUSetup() {
9
9
  const canvasRef = useCanvasRef();
10
10
  const [resources, setResources] = useState(null);
11
11
  const runtime = BackgroundRuntime;
12
+
13
+ // Physical-pixel size the surface is currently configured for. Used to drive
14
+ // resize (and to skip redundant reconfigures when the layout pass reports the
15
+ // same size).
16
+ const configuredSizeRef = useRef(null);
12
17
  useEffect(() => {
13
18
  let cancelled = false;
14
19
  (async () => {
15
- const adapter = await navigator.gpu.requestAdapter();
16
- if (!adapter || cancelled) {
17
- return;
18
- }
19
- const device = await adapter.requestDevice();
20
- if (cancelled) {
20
+ // Shared across every ShaderView — see getSharedGPUDevice. Returns null if
21
+ // no adapter is available.
22
+ const device = await getSharedGPUDevice();
23
+ if (!device || cancelled) {
21
24
  return;
22
25
  }
23
26
  const context = canvasRef.current.getContext('webgpu');
24
27
  const canvas = context.canvas;
25
28
  const dpr = PixelRatio.get();
26
- canvas.width = canvas.width * dpr;
27
- canvas.height = canvas.height * dpr;
29
+ const width = Math.max(1, Math.round(canvas.width * dpr));
30
+ const height = Math.max(1, Math.round(canvas.height * dpr));
31
+ canvas.width = width;
32
+ canvas.height = height;
28
33
  const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
29
34
  context.configure({
30
35
  device,
31
36
  format: presentationFormat,
32
37
  alphaMode: 'premultiplied'
33
38
  });
34
- initWebGPU(runtime);
39
+ configuredSizeRef.current = {
40
+ width,
41
+ height
42
+ };
35
43
  if (!cancelled) {
36
44
  setResources({
37
45
  device,
@@ -42,13 +50,54 @@ export function useWGPUSetup() {
42
50
  })();
43
51
  return () => {
44
52
  cancelled = true;
53
+ // The device is shared across all ShaderViews and lives for the JS
54
+ // runtime's lifetime, so it must NOT be destroyed here. This view's own
55
+ // GPU resources (the uniform buffer) are torn down by the render loop when
56
+ // it stops; the pipeline/shader modules are released once the loop's
57
+ // worklet closure is garbage-collected.
45
58
  };
46
59
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
60
  }, []);
61
+
62
+ // Resize the drawing buffer and reconfigure the surface whenever the view's
63
+ // layout changes (most notably device rotation). Without this the buffer keeps
64
+ // its original dimensions and the shader renders stretched / wrong-aspect. The
65
+ // render loop reads `canvas.width/height` each frame, so the resolution uniform
66
+ // picks up the new size on the next frame. No-op until GPU resources are ready
67
+ // (initial sizing is handled by the setup effect above).
68
+ const onCanvasLayout = useCallback(event => {
69
+ if (!resources) {
70
+ return;
71
+ }
72
+ const {
73
+ width,
74
+ height
75
+ } = event.nativeEvent.layout;
76
+ const dpr = PixelRatio.get();
77
+ const w = Math.max(1, Math.round(width * dpr));
78
+ const h = Math.max(1, Math.round(height * dpr));
79
+ const prev = configuredSizeRef.current;
80
+ if (prev && prev.width === w && prev.height === h) {
81
+ return;
82
+ }
83
+ const canvas = resources.context.canvas;
84
+ canvas.width = w;
85
+ canvas.height = h;
86
+ resources.context.configure({
87
+ device: resources.device,
88
+ format: resources.presentationFormat,
89
+ alphaMode: 'premultiplied'
90
+ });
91
+ configuredSizeRef.current = {
92
+ width: w,
93
+ height: h
94
+ };
95
+ }, [resources]);
48
96
  return {
49
97
  canvasRef,
50
98
  runtime,
51
- resources
99
+ resources,
100
+ onCanvasLayout
52
101
  };
53
102
  }
54
103
  //# sourceMappingURL=useWGPUSetup.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PixelRatio","useCanvasRef","useEffect","useState","initWebGPU","BackgroundRuntime","useWGPUSetup","canvasRef","resources","setResources","runtime","cancelled","adapter","navigator","gpu","requestAdapter","device","requestDevice","context","current","getContext","canvas","dpr","get","width","height","presentationFormat","getPreferredCanvasFormat","configure","format","alphaMode"],"sourceRoot":"../../../src","sources":["hooks/useWGPUSetup.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SACEC,YAAY,QAGP,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,UAAU,QAAQ,wBAAqB;AAChD,SAASC,iBAAiB,QAAQ,+BAA4B;AAc9D,OAAO,SAASC,YAAYA,CAAA,EAAoB;EAC9C,MAAMC,SAAS,GAAGN,YAAY,CAAC,CAAC;EAChC,MAAM,CAACO,SAAS,EAAEC,YAAY,CAAC,GAAGN,QAAQ,CAAsB,IAAI,CAAC;EACrE,MAAMO,OAAO,GAAGL,iBAAiB;EAEjCH,SAAS,CAAC,MAAM;IACd,IAAIS,SAAS,GAAG,KAAK;IAErB,CAAC,YAAY;MACX,MAAMC,OAAO,GAAG,MAAMC,SAAS,CAACC,GAAG,CAACC,cAAc,CAAC,CAAC;MACpD,IAAI,CAACH,OAAO,IAAID,SAAS,EAAE;QACzB;MACF;MAEA,MAAMK,MAAM,GAAG,MAAMJ,OAAO,CAACK,aAAa,CAAC,CAAC;MAC5C,IAAIN,SAAS,EAAE;QACb;MACF;MAEA,MAAMO,OAAO,GAAGX,SAAS,CAACY,OAAO,CAAEC,UAAU,CAAC,QAAQ,CAAE;MACxD,MAAMC,MAAM,GAAGH,OAAO,CAACG,MAGtB;MACD,MAAMC,GAAG,GAAGtB,UAAU,CAACuB,GAAG,CAAC,CAAC;MAC5BF,MAAM,CAACG,KAAK,GAAGH,MAAM,CAACG,KAAK,GAAGF,GAAG;MACjCD,MAAM,CAACI,MAAM,GAAGJ,MAAM,CAACI,MAAM,GAAGH,GAAG;MAEnC,MAAMI,kBAAkB,GAAGb,SAAS,CAACC,GAAG,CAACa,wBAAwB,CAAC,CAAC;MACnET,OAAO,CAACU,SAAS,CAAC;QAChBZ,MAAM;QACNa,MAAM,EAAEH,kBAAkB;QAC1BI,SAAS,EAAE;MACb,CAAC,CAAC;MAEF1B,UAAU,CAACM,OAAO,CAAC;MAEnB,IAAI,CAACC,SAAS,EAAE;QACdF,YAAY,CAAC;UAAEO,MAAM;UAAEE,OAAO;UAAEQ;QAAmB,CAAC,CAAC;MACvD;IACF,CAAC,EAAE,CAAC;IAEJ,OAAO,MAAM;MACXf,SAAS,GAAG,IAAI;IAClB,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IAAEJ,SAAS;IAAEG,OAAO;IAAEF;EAAU,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"names":["PixelRatio","useCanvasRef","useCallback","useEffect","useRef","useState","BackgroundRuntime","getSharedGPUDevice","useWGPUSetup","canvasRef","resources","setResources","runtime","configuredSizeRef","cancelled","device","context","current","getContext","canvas","dpr","get","width","Math","max","round","height","presentationFormat","navigator","gpu","getPreferredCanvasFormat","configure","format","alphaMode","onCanvasLayout","event","nativeEvent","layout","w","h","prev"],"sourceRoot":"../../../src","sources":["hooks/useWGPUSetup.tsx"],"mappings":"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","ignoreList":[]}
@@ -3,11 +3,13 @@
3
3
  import CircularGradient from "./components/CircularGradient.js";
4
4
  import LinearGradient from "./components/LinearGradient.js";
5
5
  import ShaderView from "./components/ShaderView/index.js";
6
+ import ShaderViewWithPanGesture from "./components/ShaderViewWithPanGesture/index.js";
6
7
  import Iridescence from "./components/Iridescence.js";
7
8
  import LiquidChrome from "./components/LiquidChrome.js";
8
9
  import Silk from "./components/Silk.js";
9
10
  import Campfire from "./components/Campfire.js";
10
11
  import CalicoSwirl from "./components/CalicoSwirl.js";
11
12
  import Aurora from "./components/Aurora.js";
12
- export { CircularGradient, LinearGradient, ShaderView, Iridescence, LiquidChrome, Silk, Campfire, CalicoSwirl, Aurora };
13
+ import { useParamsSynchronizable } from "./hooks/useParamsSynchronizable.js";
14
+ export { CircularGradient, LinearGradient, ShaderView, ShaderViewWithPanGesture, Iridescence, LiquidChrome, Silk, Campfire, CalicoSwirl, Aurora, useParamsSynchronizable };
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CircularGradient","LinearGradient","ShaderView","Iridescence","LiquidChrome","Silk","Campfire","CalicoSwirl","Aurora"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,gBAAgB,MAAM,kCAA+B;AAC5D,OAAOC,cAAc,MAAM,gCAA6B;AACxD,OAAOC,UAAU,MAAM,kCAAyB;AAChD,OAAOC,WAAW,MAAM,6BAA0B;AAClD,OAAOC,YAAY,MAAM,8BAA2B;AACpD,OAAOC,IAAI,MAAM,sBAAmB;AACpC,OAAOC,QAAQ,MAAM,0BAAuB;AAC5C,OAAOC,WAAW,MAAM,6BAA0B;AAClD,OAAOC,MAAM,MAAM,wBAAqB;AAIxC,SACER,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["CircularGradient","LinearGradient","ShaderView","ShaderViewWithPanGesture","Iridescence","LiquidChrome","Silk","Campfire","CalicoSwirl","Aurora","useParamsSynchronizable"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,gBAAgB,MAAM,kCAA+B;AAC5D,OAAOC,cAAc,MAAM,gCAA6B;AACxD,OAAOC,UAAU,MAAM,kCAAyB;AAChD,OAAOC,wBAAwB,MAAM,gDAAuC;AAC5E,OAAOC,WAAW,MAAM,6BAA0B;AAClD,OAAOC,YAAY,MAAM,8BAA2B;AACpD,OAAOC,IAAI,MAAM,sBAAmB;AACpC,OAAOC,QAAQ,MAAM,0BAAuB;AAC5C,OAAOC,WAAW,MAAM,6BAA0B;AAClD,OAAOC,MAAM,MAAM,wBAAqB;AACxC,SAASC,uBAAuB,QAAQ,oCAAiC;AASzE,SACEV,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,wBAAwB,EACxBC,WAAW,EACXC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,MAAM,EACNC,uBAAuB","ignoreList":[]}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- /** 96 bytes = 6 × vec4<f32> */
4
- export const UNIFORM_BUFFER_SIZE = 96;
3
+ /** 112 bytes = 7 × vec4<f32> */
4
+ export const UNIFORM_BUFFER_SIZE = 112;
5
5
 
6
6
  /** Number of float32 values in the uniform buffer */
7
- export const UNIFORM_FLOAT_COUNT = UNIFORM_BUFFER_SIZE / 4; // 24
7
+ export const UNIFORM_FLOAT_COUNT = UNIFORM_BUFFER_SIZE / 4; // 28
8
8
 
9
9
  export const UNIFORMS_WGSL = /* wgsl */`
10
10
  struct Uniforms {
@@ -14,6 +14,7 @@ struct Uniforms {
14
14
  color1: vec4<f32>, // colors[1] RGBA
15
15
  params0: vec4<f32>, // params[0..3]
16
16
  params1: vec4<f32>, // params[4..7]
17
+ live: vec4<f32>, // paramsSynchronizable (touch/scroll/audio); (0,0,0,0) when unused
17
18
  };
18
19
  @group(0) @binding(0) var<uniform> u: Uniforms;
19
20
  `;
@@ -1 +1 @@
1
- {"version":3,"names":["UNIFORM_BUFFER_SIZE","UNIFORM_FLOAT_COUNT","UNIFORMS_WGSL"],"sourceRoot":"../../../src","sources":["shaders/uniforms.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,mBAAmB,GAAG,EAAE;;AAErC;AACA,OAAO,MAAMC,mBAAmB,GAAGD,mBAAmB,GAAG,CAAC,CAAC,CAAC;;AAE5D,OAAO,MAAME,aAAa,GAAG,UAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UNIFORM_BUFFER_SIZE","UNIFORM_FLOAT_COUNT","UNIFORMS_WGSL"],"sourceRoot":"../../../src","sources":["shaders/uniforms.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,mBAAmB,GAAG,GAAG;;AAEtC;AACA,OAAO,MAAMC,mBAAmB,GAAGD,mBAAmB,GAAG,CAAC,CAAC,CAAC;;AAE5D,OAAO,MAAME,aAAa,GAAG,UAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ let devicePromise = null;
4
+
5
+ /**
6
+ * Lazily requests a single GPUDevice shared by every ShaderView.
7
+ *
8
+ * Requesting an adapter + device per view is expensive (real GPU/memory cost and
9
+ * slower init), and a screen that mounts several effects would otherwise spin up
10
+ * N devices on the one background runtime. The promise is cached for the lifetime
11
+ * of the JS runtime so every view awaits the same device.
12
+ *
13
+ * If the device is ever lost, the cache is cleared so the next ShaderView mount
14
+ * requests a fresh one instead of awaiting a dead device forever.
15
+ */
16
+ export function getSharedGPUDevice() {
17
+ if (devicePromise) {
18
+ return devicePromise;
19
+ }
20
+ const promise = (async () => {
21
+ const adapter = await navigator.gpu.requestAdapter();
22
+ if (!adapter) {
23
+ return null;
24
+ }
25
+ const device = await adapter.requestDevice();
26
+ device.lost?.then(() => {
27
+ // Only clear if we're still the cached promise, so we don't clobber a
28
+ // newer device that a later mount may already have requested.
29
+ if (devicePromise === promise) {
30
+ devicePromise = null;
31
+ }
32
+ });
33
+ return device;
34
+ })();
35
+ devicePromise = promise;
36
+ return promise;
37
+ }
38
+ //# sourceMappingURL=gpuDevice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["devicePromise","getSharedGPUDevice","promise","adapter","navigator","gpu","requestAdapter","device","requestDevice","lost","then"],"sourceRoot":"../../../src","sources":["utils/gpuDevice.ts"],"mappings":";;AAAA,IAAIA,aAA+C,GAAG,IAAI;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAA8B;EAC9D,IAAID,aAAa,EAAE;IACjB,OAAOA,aAAa;EACtB;EAEA,MAAME,OAAO,GAAG,CAAC,YAAY;IAC3B,MAAMC,OAAO,GAAG,MAAMC,SAAS,CAACC,GAAG,CAACC,cAAc,CAAC,CAAC;IACpD,IAAI,CAACH,OAAO,EAAE;MACZ,OAAO,IAAI;IACb;IAEA,MAAMI,MAAM,GAAG,MAAMJ,OAAO,CAACK,aAAa,CAAC,CAAC;IAC5CD,MAAM,CAACE,IAAI,EAAEC,IAAI,CAAC,MAAM;MACtB;MACA;MACA,IAAIV,aAAa,KAAKE,OAAO,EAAE;QAC7BF,aAAa,GAAG,IAAI;MACtB;IACF,CAAC,CAAC;IACF,OAAOO,MAAM;EACf,CAAC,EAAE,CAAC;EAEJP,aAAa,GAAGE,OAAO;EACvB,OAAOA,OAAO;AAChB","ignoreList":[]}
@@ -12,6 +12,6 @@ type Props = ViewProps & {
12
12
  /** How wavy/turbulent the curtains are. Default: 1.0 */
13
13
  waviness?: number;
14
14
  };
15
- export default function Aurora({ color, speed, intensity, layers, waviness, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
15
+ export default function Aurora({ color, speed, intensity, layers, waviness, ...viewProps }: Props): import("react").JSX.Element;
16
16
  export {};
17
17
  //# sourceMappingURL=Aurora.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Aurora.d.ts","sourceRoot":"","sources":["../../../../src/components/Aurora.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,MAAY,EACZ,QAAc,EACd,GAAG,SAAS,EACb,EAAE,KAAK,2CAiBP"}
1
+ {"version":3,"file":"Aurora.d.ts","sourceRoot":"","sources":["../../../../src/components/Aurora.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,MAAY,EACZ,QAAc,EACd,GAAG,SAAS,EACb,EAAE,KAAK,+BAiBP"}
@@ -8,6 +8,6 @@ type Props = ViewProps & {
8
8
  /** Intensity of the effect. Default: 1.0 */
9
9
  intensity?: number;
10
10
  };
11
- export default function CalicoSwirl({ color, speed, intensity, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export default function CalicoSwirl({ color, speed, intensity, ...viewProps }: Props): import("react").JSX.Element;
12
12
  export {};
13
13
  //# sourceMappingURL=CalicoSwirl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalicoSwirl.d.ts","sourceRoot":"","sources":["../../../../src/components/CalicoSwirl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,kDAAkD;IAClD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,GAAG,SAAS,EACb,EAAE,KAAK,2CAcP"}
1
+ {"version":3,"file":"CalicoSwirl.d.ts","sourceRoot":"","sources":["../../../../src/components/CalicoSwirl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,kDAAkD;IAClD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,GAAG,SAAS,EACb,EAAE,KAAK,+BAcP"}
@@ -12,6 +12,6 @@ type Props = ViewProps & {
12
12
  /** Intensity of the smoke. Default: 1.0 */
13
13
  smokeIntensity?: number;
14
14
  };
15
- export default function Campfire({ color, speed, sparkSize, fireIntensity, smokeIntensity, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
15
+ export default function Campfire({ color, speed, sparkSize, fireIntensity, smokeIntensity, ...viewProps }: Props): import("react").JSX.Element;
16
16
  export {};
17
17
  //# sourceMappingURL=Campfire.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Campfire.d.ts","sourceRoot":"","sources":["../../../../src/components/Campfire.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,aAAmB,EACnB,cAAoB,EACpB,GAAG,SAAS,EACb,EAAE,KAAK,2CAiBP"}
1
+ {"version":3,"file":"Campfire.d.ts","sourceRoot":"","sources":["../../../../src/components/Campfire.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,aAAmB,EACnB,cAAoB,EACpB,GAAG,SAAS,EACb,EAAE,KAAK,+BAiBP"}
@@ -14,6 +14,6 @@ type Props = ViewProps & {
14
14
  /** Vertical radius. Default: 0.5 */
15
15
  sizeY?: number;
16
16
  };
17
- export default function CircularGradient({ centerColor, edgeColor, centerX, centerY, sizeX, sizeY, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
17
+ export default function CircularGradient({ centerColor, edgeColor, centerX, centerY, sizeX, sizeY, ...viewProps }: Props): import("react").JSX.Element;
18
18
  export {};
19
19
  //# sourceMappingURL=CircularGradient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CircularGradient.d.ts","sourceRoot":"","sources":["../../../../src/components/CircularGradient.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,+CAA+C;IAC/C,WAAW,EAAE,UAAU,CAAC;IACxB,kEAAkE;IAClE,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,WAAW,EACX,SAA2B,EAC3B,OAAa,EACb,OAAa,EACb,KAAW,EACX,KAAW,EACX,GAAG,SAAS,EACb,EAAE,KAAK,2CAmBP"}
1
+ {"version":3,"file":"CircularGradient.d.ts","sourceRoot":"","sources":["../../../../src/components/CircularGradient.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,+CAA+C;IAC/C,WAAW,EAAE,UAAU,CAAC;IACxB,kEAAkE;IAClE,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,WAAW,EACX,SAA2B,EAC3B,OAAa,EACb,OAAa,EACb,KAAW,EACX,KAAW,EACX,GAAG,SAAS,EACb,EAAE,KAAK,+BAmBP"}
@@ -6,6 +6,6 @@ type Props = ViewProps & {
6
6
  /** Animation speed multiplier. Default: 1.0 */
7
7
  speed?: number;
8
8
  };
9
- export default function Iridescence({ color, speed, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export default function Iridescence({ color, speed, ...viewProps }: Props): import("react").JSX.Element;
10
10
  export {};
11
11
  //# sourceMappingURL=Iridescence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Iridescence.d.ts","sourceRoot":"","sources":["../../../../src/components/Iridescence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,iDAAiD;IACjD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAiB,EACjB,KAAW,EACX,GAAG,SAAS,EACb,EAAE,KAAK,2CAaP"}
1
+ {"version":3,"file":"Iridescence.d.ts","sourceRoot":"","sources":["../../../../src/components/Iridescence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,iDAAiD;IACjD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAiB,EACjB,KAAW,EACX,GAAG,SAAS,EACb,EAAE,KAAK,+BAaP"}
@@ -10,6 +10,6 @@ type Props = ViewProps & {
10
10
  /** Rotation speed in degrees/second. 0 = static. Default: 0 */
11
11
  speed?: number;
12
12
  };
13
- export default function LinearGradient({ startColor, endColor, angle, speed, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export default function LinearGradient({ startColor, endColor, angle, speed, ...viewProps }: Props): import("react").JSX.Element;
14
14
  export {};
15
15
  //# sourceMappingURL=LinearGradient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../../../../src/components/LinearGradient.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,8CAA8C;IAC9C,UAAU,EAAE,UAAU,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,EAAE,UAAU,CAAC;IACrB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,UAAU,EACV,QAAQ,EACR,KAAK,EACL,KAAS,EACT,GAAG,SAAS,EACb,EAAE,KAAK,2CAcP"}
1
+ {"version":3,"file":"LinearGradient.d.ts","sourceRoot":"","sources":["../../../../src/components/LinearGradient.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,8CAA8C;IAC9C,UAAU,EAAE,UAAU,CAAC;IACvB,4CAA4C;IAC5C,QAAQ,EAAE,UAAU,CAAC;IACrB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,UAAU,EACV,QAAQ,EACR,KAAK,EACL,KAAS,EACT,GAAG,SAAS,EACb,EAAE,KAAK,+BAcP"}
@@ -12,6 +12,6 @@ type Props = ViewProps & {
12
12
  /** Vertical frequency. Default: 3 */
13
13
  frequencyY?: number;
14
14
  };
15
- export default function LiquidChrome({ color, speed, amplitude, frequencyX, frequencyY, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
15
+ export default function LiquidChrome({ color, speed, amplitude, frequencyX, frequencyY, ...viewProps }: Props): import("react").JSX.Element;
16
16
  export {};
17
17
  //# sourceMappingURL=LiquidChrome.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LiquidChrome.d.ts","sourceRoot":"","sources":["../../../../src/components/LiquidChrome.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,mDAAmD;IACnD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,UAAc,EACd,UAAc,EACd,GAAG,SAAS,EACb,EAAE,KAAK,2CAiBP"}
1
+ {"version":3,"file":"LiquidChrome.d.ts","sourceRoot":"","sources":["../../../../src/components/LiquidChrome.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,mDAAmD;IACnD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAiB,EACjB,KAAW,EACX,SAAe,EACf,UAAc,EACd,UAAc,EACd,GAAG,SAAS,EACb,EAAE,KAAK,+BAiBP"}
@@ -1,3 +1,3 @@
1
1
  import type { ShaderViewProps } from './types';
2
- export default function ShaderView({ fragmentShader, colors, speed, params, isStatic, style, ...viewProps }: ShaderViewProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function ShaderView({ fragmentShader, colors, speed, params, isStatic, transparent, paramsSynchronizable, style, ...viewProps }: ShaderViewProps): import("react").JSX.Element;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ShaderView/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAS/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,cAAc,EACd,MAAW,EACX,KAAW,EACX,MAAW,EACX,QAAgB,EAChB,KAAK,EACL,GAAG,SAAS,EACb,EAAE,eAAe,2CA8LjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ShaderView/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAS/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,cAAc,EACd,MAAW,EACX,KAAW,EACX,MAAW,EACX,QAAgB,EAChB,WAAmB,EACnB,oBAAoB,EACpB,KAAK,EACL,GAAG,SAAS,EACb,EAAE,eAAe,+BAwSjB"}
@@ -1,5 +1,17 @@
1
1
  import type { ViewProps } from 'react-native';
2
+ import type { Synchronizable } from 'react-native-worklets';
2
3
  import type { ColorInput } from '../../utils/colors';
4
+ /**
5
+ * A 4-float synchronizable whose values are written into the dedicated `u.live`
6
+ * uniform slot every frame. It has its own slot, so it never collides with the
7
+ * 8 static `params` (`u.params0`/`u.params1`).
8
+ *
9
+ * This is the bridge for live, per-frame input (touch position, scroll
10
+ * progress, velocity) coming from the JS thread into the off-thread render
11
+ * loop. Create one with `useParamsSynchronizable` and update it from
12
+ * gesture/scroll handlers. See `ShaderViewWithPanGesture`.
13
+ */
14
+ export type ParamsSynchronizable = Synchronizable<Float64Array>;
3
15
  export type ShaderViewProps = ViewProps & {
4
16
  /** WGSL fragment shader source (must declare the Uniforms struct) */
5
17
  fragmentShader: string;
@@ -11,5 +23,13 @@ export type ShaderViewProps = ViewProps & {
11
23
  params?: number[];
12
24
  /** Render once then stop the RAF loop. Default: false */
13
25
  isStatic?: boolean;
26
+ /** Use transparent background (clear to alpha 0). Default: false */
27
+ transparent?: boolean;
28
+ /**
29
+ * Optional live input. Its 4 floats are written into the dedicated `u.live`
30
+ * slot every frame — independent of the static `params`. Use for
31
+ * touch/scroll/audio. Create it with `useParamsSynchronizable`.
32
+ */
33
+ paramsSynchronizable?: ParamsSynchronizable;
14
34
  };
15
35
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ShaderView/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ShaderView/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { ShaderViewProps } from '../ShaderView/types';
2
+ /**
3
+ * A {@link ShaderView} that feeds touch input into the shader's `u.live`:
4
+ *
5
+ * - `live.x` → pointer X, normalized 0..1 (left → right)
6
+ * - `live.y` → pointer Y, normalized 0..1 (bottom → top, matching UV space)
7
+ * - `live.z` → 1.0 while touching, 0.0 when released
8
+ * - `live.w` → 0.0 (reserved)
9
+ *
10
+ * Dragging moves the pointer **relatively** — it pushes from where the pointer
11
+ * already is rather than jumping under the finger — and a fling lets it glide to
12
+ * a stop. The position is **remembered**: it stays wherever it ended and is
13
+ * never reset; only the "touched" flag (`live.z`) toggles on release. A
14
+ * shader can read `live.xy` as a stable resting position and use `live.z`
15
+ * purely for touch-driven emphasis, so the effect never snaps back.
16
+ *
17
+ * The resting value before the first touch is `[0, 0, 0, 0]` by default; pass
18
+ * `initialParamsSynchronizable` to seed it — e.g. `[0.5, 0.5, 0, 0]` to start a
19
+ * pointer at screen center.
20
+ *
21
+ * The drag runs as a **worklet on the UI thread** and writes the synchronizable
22
+ * directly, so pointer updates never hop to the JS thread — matching the rest of
23
+ * the library, which renders off the JS thread. The render runtime reads the
24
+ * same synchronizable each frame.
25
+ */
26
+ export type ShaderViewWithPanGestureProps = Omit<ShaderViewProps, 'paramsSynchronizable'> & {
27
+ /**
28
+ * Initial value for the gesture channel (`u.live`) before the first touch.
29
+ * Defaults to `[0, 0, 0, 0]`. Use e.g. `[0.5, 0.5, 0, 0]` to rest a pointer at
30
+ * screen center.
31
+ */
32
+ initialParamsSynchronizable?: readonly [number, number, number, number];
33
+ };
34
+ export default function ShaderViewWithPanGesture({ style, initialParamsSynchronizable, ...props }: ShaderViewWithPanGestureProps): import("react").JSX.Element;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ShaderViewWithPanGesture/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,eAAe,EACf,sBAAsB,CACvB,GAAG;IACF;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACzE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,KAAK,EACL,2BAA0C,EAC1C,GAAG,KAAK,EACT,EAAE,6BAA6B,+BAuK/B"}
@@ -12,6 +12,6 @@ type Props = ViewProps & {
12
12
  /** Intensity of the noise grain. Default: 1.5 */
13
13
  noiseIntensity?: number;
14
14
  };
15
- export default function Silk({ color, speed, scale, rotation, noiseIntensity, ...viewProps }: Props): import("react/jsx-runtime").JSX.Element;
15
+ export default function Silk({ color, speed, scale, rotation, noiseIntensity, ...viewProps }: Props): import("react").JSX.Element;
16
16
  export {};
17
17
  //# sourceMappingURL=Silk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Silk.d.ts","sourceRoot":"","sources":["../../../../src/components/Silk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,KAAiB,EACjB,KAAW,EACX,KAAW,EACX,QAAc,EACd,cAAoB,EACpB,GAAG,SAAS,EACb,EAAE,KAAK,2CAiBP"}
1
+ {"version":3,"file":"Silk.d.ts","sourceRoot":"","sources":["../../../../src/components/Silk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,KAAiB,EACjB,KAAW,EACX,KAAW,EACX,QAAc,EACd,cAAoB,EACpB,GAAG,SAAS,EACb,EAAE,KAAK,+BAiBP"}
@@ -0,0 +1,22 @@
1
+ import type { ParamsSynchronizable } from '../components/ShaderView/types';
2
+ /**
3
+ * Creates a {@link ParamsSynchronizable} — a 4-float channel written into the
4
+ * dedicated `u.live` slot of a {@link ShaderView} every frame. It has its own
5
+ * uniform slot, so it leaves all 8 static `params` untouched.
6
+ *
7
+ * The returned `setParamsSynchronizable` runs on the JS thread (call it from gesture or scroll
8
+ * handlers); the values are read by the off-thread render loop. By convention
9
+ * the four floats carry `(x, y, active, extra)` for pointer input, or
10
+ * `(progress, ...)` for scroll-driven effects — but the meaning is up to the
11
+ * shader consuming `u.live`.
12
+ *
13
+ * Pass `initial` to seed the channel's starting value (read once on first
14
+ * render), so the shader has a sane resting state before the first update —
15
+ * e.g. `[0.5, 0.5, 0, 0]` to start a pointer at screen center. Defaults to all
16
+ * zeros.
17
+ */
18
+ export declare function useParamsSynchronizable(initial?: readonly [number, number, number, number]): {
19
+ paramsSynchronizable: ParamsSynchronizable;
20
+ setParamsSynchronizable: (x: number, y: number, active: number, extra: number) => void;
21
+ };
22
+ //# sourceMappingURL=useParamsSynchronizable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParamsSynchronizable.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useParamsSynchronizable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAgB,GAChE;IACD,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,uBAAuB,EAAE,CACvB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,KACV,IAAI,CAAC;CACX,CAqBA"}
@@ -1,5 +1,6 @@
1
- import { type CanvasRef, type RNCanvasContext } from 'react-native-wgpu';
2
- import type { WorkletRuntime } from 'react-native-worklets';
1
+ import { type LayoutChangeEvent } from 'react-native';
2
+ import { type CanvasRef, type RNCanvasContext } from 'react-native-webgpu';
3
+ import { type WorkletRuntime } from 'react-native-worklets';
3
4
  type GPUResources = {
4
5
  device: GPUDevice;
5
6
  context: RNCanvasContext;
@@ -9,6 +10,8 @@ type WGPUSetupResult = {
9
10
  canvasRef: React.RefObject<CanvasRef>;
10
11
  runtime: WorkletRuntime;
11
12
  resources: GPUResources | null;
13
+ /** Wire to `<Canvas onLayout>` so the surface resizes on rotation/layout change. */
14
+ onCanvasLayout: (event: LayoutChangeEvent) => void;
12
15
  };
13
16
  export declare function useWGPUSetup(): WGPUSetupResult;
14
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useWGPUSetup.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useWGPUSetup.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,eAAe,CAAC;IACzB,kBAAkB,EAAE,gBAAgB,CAAC;CACtC,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,EAAE,cAAc,CAAC;IACxB,SAAS,EAAE,YAAY,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,wBAAgB,YAAY,IAAI,eAAe,CAiD9C"}
1
+ {"version":3,"file":"useWGPUSetup.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useWGPUSetup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,eAAe,CAAC;IACzB,kBAAkB,EAAE,gBAAgB,CAAC;CACtC,CAAC;AAOF,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,EAAE,cAAc,CAAC;IACxB,SAAS,EAAE,YAAY,GAAG,IAAI,CAAC;IAC/B,oFAAoF;IACpF,cAAc,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,wBAAgB,YAAY,IAAI,eAAe,CA0F9C"}
@@ -1,12 +1,16 @@
1
1
  import CircularGradient from './components/CircularGradient';
2
2
  import LinearGradient from './components/LinearGradient';
3
3
  import ShaderView from './components/ShaderView';
4
+ import ShaderViewWithPanGesture from './components/ShaderViewWithPanGesture';
4
5
  import Iridescence from './components/Iridescence';
5
6
  import LiquidChrome from './components/LiquidChrome';
6
7
  import Silk from './components/Silk';
7
8
  import Campfire from './components/Campfire';
8
9
  import CalicoSwirl from './components/CalicoSwirl';
9
10
  import Aurora from './components/Aurora';
10
- export type { ShaderViewProps } from './components/ShaderView/types';
11
- export { CircularGradient, LinearGradient, ShaderView, Iridescence, LiquidChrome, Silk, Campfire, CalicoSwirl, Aurora, };
11
+ import { useParamsSynchronizable } from './hooks/useParamsSynchronizable';
12
+ export type { ShaderViewProps, ParamsSynchronizable, } from './components/ShaderView/types';
13
+ export type { ShaderViewWithPanGestureProps } from './components/ShaderViewWithPanGesture';
14
+ export type { ColorInput } from './utils/colors';
15
+ export { CircularGradient, LinearGradient, ShaderView, ShaderViewWithPanGesture, Iridescence, LiquidChrome, Silk, Campfire, CalicoSwirl, Aurora, useParamsSynchronizable, };
12
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,IAAI,MAAM,mBAAmB,CAAC;AACrC,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,YAAY,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,MAAM,GACP,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAC7E,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,IAAI,MAAM,mBAAmB,CAAC;AACrC,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,YAAY,EACV,eAAe,EACf,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAC3F,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,wBAAwB,EACxB,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,MAAM,EACN,uBAAuB,GACxB,CAAC"}
@@ -1,6 +1,6 @@
1
- /** 96 bytes = 6 × vec4<f32> */
2
- export declare const UNIFORM_BUFFER_SIZE = 96;
1
+ /** 112 bytes = 7 × vec4<f32> */
2
+ export declare const UNIFORM_BUFFER_SIZE = 112;
3
3
  /** Number of float32 values in the uniform buffer */
4
4
  export declare const UNIFORM_FLOAT_COUNT: number;
5
- export declare const UNIFORMS_WGSL = "\nstruct Uniforms {\n resolution: vec4<f32>, // (width, height, aspect, pixelRatio)\n time: vec4<f32>, // (seconds, dt, 0, 0)\n color0: vec4<f32>, // colors[0] RGBA\n color1: vec4<f32>, // colors[1] RGBA\n params0: vec4<f32>, // params[0..3]\n params1: vec4<f32>, // params[4..7]\n};\n@group(0) @binding(0) var<uniform> u: Uniforms;\n";
5
+ export declare const UNIFORMS_WGSL = "\nstruct Uniforms {\n resolution: vec4<f32>, // (width, height, aspect, pixelRatio)\n time: vec4<f32>, // (seconds, dt, 0, 0)\n color0: vec4<f32>, // colors[0] RGBA\n color1: vec4<f32>, // colors[1] RGBA\n params0: vec4<f32>, // params[0..3]\n params1: vec4<f32>, // params[4..7]\n live: vec4<f32>, // paramsSynchronizable (touch/scroll/audio); (0,0,0,0) when unused\n};\n@group(0) @binding(0) var<uniform> u: Uniforms;\n";
6
6
  //# sourceMappingURL=uniforms.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../../src/shaders/uniforms.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAE3D,eAAO,MAAM,aAAa,mXAUzB,CAAC"}
1
+ {"version":3,"file":"uniforms.d.ts","sourceRoot":"","sources":["../../../../src/shaders/uniforms.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,QAA0B,CAAC;AAE3D,eAAO,MAAM,aAAa,kdAWzB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Lazily requests a single GPUDevice shared by every ShaderView.
3
+ *
4
+ * Requesting an adapter + device per view is expensive (real GPU/memory cost and
5
+ * slower init), and a screen that mounts several effects would otherwise spin up
6
+ * N devices on the one background runtime. The promise is cached for the lifetime
7
+ * of the JS runtime so every view awaits the same device.
8
+ *
9
+ * If the device is ever lost, the cache is cleared so the next ShaderView mount
10
+ * requests a fresh one instead of awaiting a dead device forever.
11
+ */
12
+ export declare function getSharedGPUDevice(): Promise<GPUDevice | null>;
13
+ //# sourceMappingURL=gpuDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpuDevice.d.ts","sourceRoot":"","sources":["../../../../src/utils/gpuDevice.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAwB9D"}