@fjandin/react-shader 0.0.16 → 0.0.18

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 (40) hide show
  1. package/dist/ReactGpuShader.d.ts +18 -0
  2. package/dist/ReactGpuShader.d.ts.map +1 -0
  3. package/dist/example/examples/mandelbrot.d.ts +2 -0
  4. package/dist/example/examples/mandelbrot.d.ts.map +1 -0
  5. package/dist/example/examples/mandelbrot2.d.ts +2 -0
  6. package/dist/example/examples/mandelbrot2.d.ts.map +1 -0
  7. package/dist/example/examples/webgl.d.ts +2 -0
  8. package/dist/example/examples/webgl.d.ts.map +1 -0
  9. package/dist/example/examples/webgpu.d.ts +2 -0
  10. package/dist/example/examples/webgpu.d.ts.map +1 -0
  11. package/dist/example/frontend.d.ts.map +1 -1
  12. package/dist/hooks/useWebGPU.d.ts +20 -0
  13. package/dist/hooks/useWebGPU.d.ts.map +1 -0
  14. package/dist/index.cjs +882 -54
  15. package/dist/index.d.ts +6 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +882 -54
  18. package/dist/shaders/color-palette-gpu.d.ts +2 -0
  19. package/dist/shaders/color-palette-gpu.d.ts.map +1 -0
  20. package/dist/shaders/distortion-ripple-gpu.d.ts +16 -0
  21. package/dist/shaders/distortion-ripple-gpu.d.ts.map +1 -0
  22. package/dist/shaders/scene-circles-gpu.d.ts +21 -0
  23. package/dist/shaders/scene-circles-gpu.d.ts.map +1 -0
  24. package/dist/shaders/simplex-noise-gpu.d.ts +2 -0
  25. package/dist/shaders/simplex-noise-gpu.d.ts.map +1 -0
  26. package/package.json +2 -1
  27. package/dist/example/glsl/cartesian-to-polar.glsl.d.ts +0 -2
  28. package/dist/example/glsl/cartesian-to-polar.glsl.d.ts.map +0 -1
  29. package/dist/example/glsl/circles.glsl.d.ts +0 -3
  30. package/dist/example/glsl/circles.glsl.d.ts.map +0 -1
  31. package/dist/example/glsl/noise.glsl.d.ts +0 -3
  32. package/dist/example/glsl/noise.glsl.d.ts.map +0 -1
  33. package/dist/example/glsl/palette.glsl.d.ts +0 -2
  34. package/dist/example/glsl/palette.glsl.d.ts.map +0 -1
  35. package/dist/example/glsl/texture-demo.glsl.d.ts +0 -2
  36. package/dist/example/glsl/texture-demo.glsl.d.ts.map +0 -1
  37. package/dist/example/lib/logger.d.ts +0 -2
  38. package/dist/example/lib/logger.d.ts.map +0 -1
  39. package/dist/example/shader.d.ts +0 -2
  40. package/dist/example/shader.d.ts.map +0 -1
@@ -0,0 +1,18 @@
1
+ import type { FrameInfo, Vec2, Vec3, Vec4, Vec4Array } from "./types";
2
+ type GpuUniformValue = number | Vec2 | Vec3 | Vec4 | Vec4Array;
3
+ export interface ReactGpuShaderProps {
4
+ className?: string;
5
+ fragment: string;
6
+ uniforms?: Record<string, GpuUniformValue>;
7
+ fullscreen?: boolean;
8
+ timeScale?: number;
9
+ onFrame?: (info: FrameInfo) => void;
10
+ onClick?: (info: FrameInfo) => void;
11
+ onMouseMove?: (info: FrameInfo) => void;
12
+ onMouseDown?: (info: FrameInfo) => void;
13
+ onMouseUp?: (info: FrameInfo) => void;
14
+ onMouseWheel?: (info: FrameInfo, wheelDelta: number) => void;
15
+ }
16
+ export declare function ReactGpuShader({ className, fragment, uniforms, fullscreen, timeScale, onFrame, onClick, onMouseMove, onMouseDown, onMouseUp, onMouseWheel, }: ReactGpuShaderProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=ReactGpuShader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactGpuShader.d.ts","sourceRoot":"","sources":["../src/ReactGpuShader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGrE,KAAK,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9D,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7D;AAuBD,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAkB,EAClB,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,WAAW,EACX,SAAS,EACT,YAAY,GACb,EAAE,mBAAmB,2CAyDrB"}
@@ -0,0 +1,2 @@
1
+ export declare function WebGpuMandelbrotDemo(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=mandelbrot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandelbrot.d.ts","sourceRoot":"","sources":["../../../src/example/examples/mandelbrot.tsx"],"names":[],"mappings":"AA8BA,wBAAgB,oBAAoB,4CAiFnC"}
@@ -0,0 +1,2 @@
1
+ export declare function WebGpuMandelbrotDemo2(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=mandelbrot2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandelbrot2.d.ts","sourceRoot":"","sources":["../../../src/example/examples/mandelbrot2.tsx"],"names":[],"mappings":"AA4HA,wBAAgB,qBAAqB,4CAiGpC"}
@@ -0,0 +1,2 @@
1
+ export declare function WebGlDemo(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=webgl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl.d.ts","sourceRoot":"","sources":["../../../src/example/examples/webgl.tsx"],"names":[],"mappings":"AAiDA,wBAAgB,SAAS,4CA6BxB"}
@@ -0,0 +1,2 @@
1
+ export declare function WebGpuDemo(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=webgpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgpu.d.ts","sourceRoot":"","sources":["../../../src/example/examples/webgpu.tsx"],"names":[],"mappings":"AAmDA,wBAAgB,UAAU,4CAgHzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../../src/example/frontend.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,aAAa,CAAA;AAkHpB,wBAAgB,GAAG,4CAiJlB"}
1
+ {"version":3,"file":"frontend.d.ts","sourceRoot":"","sources":["../../src/example/frontend.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,aAAa,CAAA;AA0BpB,wBAAgB,GAAG,4CAyClB"}
@@ -0,0 +1,20 @@
1
+ import type { FrameInfo, Vec2, Vec3, Vec4, Vec4Array } from "../types";
2
+ type GpuUniformValue = number | Vec2 | Vec3 | Vec4 | Vec4Array;
3
+ interface UseWebGPUOptions {
4
+ fragment: string;
5
+ uniforms?: Record<string, GpuUniformValue>;
6
+ onError?: (error: Error) => void;
7
+ timeScale?: number;
8
+ onFrame?: (info: FrameInfo) => void;
9
+ onClick?: (info: FrameInfo) => void;
10
+ onMouseMove?: (info: FrameInfo) => void;
11
+ onMouseDown?: (info: FrameInfo) => void;
12
+ onMouseUp?: (info: FrameInfo) => void;
13
+ onMouseWheel?: (info: FrameInfo, wheelDelta: number) => void;
14
+ }
15
+ export declare function useWebGPU(options: UseWebGPUOptions): {
16
+ canvasRef: import("react").RefObject<HTMLCanvasElement>;
17
+ mouseRef: import("react").MutableRefObject<[number, number]>;
18
+ };
19
+ export {};
20
+ //# sourceMappingURL=useWebGPU.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebGPU.d.ts","sourceRoot":"","sources":["../../src/hooks/useWebGPU.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGtE,KAAK,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9D,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7D;AA+WD,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;;;EA8QlD"}