@paper-design/shaders-react 0.0.0-canary.b448849 → 0.0.0-canary.b4f628d

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.
@@ -1,19 +1,18 @@
1
+ import { type ShaderSizeToContent } from '@paper-design/shaders';
1
2
  /** Props of the element that holds the children. It's what gets drawn, so it takes their layout and the visuals */
2
- export type ShaderContentProps = React.ComponentProps<'div'> & {
3
+ export type ShaderLayoutProps = React.ComponentProps<'div'> & {
3
4
  [key: `data-${string}`]: unknown;
4
5
  };
5
- /** Axes on which the shader takes the size of its content instead of its own size styles */
6
- export type ShaderSizeToContent = 'width' | 'height' | 'both';
6
+ export type { ShaderSizeToContent };
7
7
  export declare function willDrawHtmlChildren(children: React.ReactNode): boolean;
8
8
  /**
9
9
  * Draws the children into u_image where the browser supports it, otherwise they're shown on top of the shader.
10
10
  * Either way they're held by the same content element, so they lay out the same.
11
11
  *
12
12
  * The content element fills the shader, except on the axes sized to content: there it takes the size of the children,
13
- * and the shader follows it. The canvas can't be sized by what's inside it, so the content size is measured and
14
- * set on the shader element. Resize observer callbacks run before paint, so this settles within the same frame.
13
+ * and the shader follows it (see `observeContentSize`).
15
14
  */
16
- export declare function useHtmlChildren(acceptsHtmlChildren: boolean, children: React.ReactNode, contentProps: ShaderContentProps | undefined, sizeToContent: ShaderSizeToContent | undefined, shaderRef: React.RefObject<HTMLElement | null>): {
15
+ export declare function useHtmlChildren(acceptsHtmlChildren: boolean, children: React.ReactNode, layoutProps: ShaderLayoutProps | undefined, sizeToContent: ShaderSizeToContent | undefined, shaderRef: React.RefObject<HTMLElement | null>): {
17
16
  hasHtmlChildren: boolean;
18
17
  addHtmlUniform: <T extends object>(uniforms: T) => T;
19
18
  renderedChildren: React.ReactNode;
@@ -4,25 +4,23 @@
4
4
  * * * * * * * * * * * * * * * * * * * * * * * * * * * */
5
5
 
6
6
  "use client";
7
- import { Children, createContext, useContext, useLayoutEffect, useRef, useSyncExternalStore } from "react";
8
- import { isHtmlInCanvasSupported } from "@paper-design/shaders";
7
+ import { Children, useLayoutEffect, useRef, useSyncExternalStore } from "react";
8
+ import { isHtmlInCanvasSupported, observeContentSize } from "@paper-design/shaders";
9
9
  import { useMergeRefs } from "./use-merge-refs.js";
10
10
  import { jsx } from "react/jsx-runtime";
11
11
  const subscribeToNothing = () => () => {
12
12
  };
13
13
  const isSupportedOnServer = () => true;
14
- const InsideShaderCanvasContext = createContext(false);
15
14
  function hasChildren(children) {
16
15
  return Children.toArray(children).length > 0;
17
16
  }
18
17
  function willDrawHtmlChildren(children) {
19
18
  return hasChildren(children) && isHtmlInCanvasSupported();
20
19
  }
21
- function useHtmlChildren(acceptsHtmlChildren, children, contentProps, sizeToContent, shaderRef) {
20
+ function useHtmlChildren(acceptsHtmlChildren, children, layoutProps, sizeToContent, shaderRef) {
22
21
  const contentRef = useRef(null);
23
- const mergedContentRef = useMergeRefs([contentRef, contentProps?.ref]);
22
+ const mergedContentRef = useMergeRefs([contentRef, layoutProps?.ref]);
24
23
  const isSupported = useSyncExternalStore(subscribeToNothing, isHtmlInCanvasSupported, isSupportedOnServer);
25
- const isInsideShaderCanvas = useContext(InsideShaderCanvasContext);
26
24
  const isWrapped = acceptsHtmlChildren && hasChildren(children);
27
25
  const hasHtmlChildren = isWrapped && isSupported;
28
26
  const fitsWidth = isWrapped && (sizeToContent === "width" || sizeToContent === "both");
@@ -30,25 +28,16 @@ function useHtmlChildren(acceptsHtmlChildren, children, contentProps, sizeToCont
30
28
  useLayoutEffect(() => {
31
29
  const content2 = contentRef.current;
32
30
  const shader = shaderRef.current;
33
- if (!content2 || !shader || !fitsWidth && !fitsHeight) {
31
+ if (!content2 || !shader || !isWrapped || !sizeToContent) {
34
32
  return;
35
33
  }
36
- const observer = new ResizeObserver(([entry]) => {
37
- const size = entry?.borderBoxSize[0];
38
- if (!size) return;
39
- shader.style.setProperty("--paper-shader-content-width", `${size.inlineSize}px`);
40
- shader.style.setProperty("--paper-shader-content-height", `${size.blockSize}px`);
41
- });
42
- observer.observe(content2);
43
- return () => {
44
- observer.disconnect();
45
- };
46
- }, [fitsWidth, fitsHeight, hasHtmlChildren, shaderRef]);
34
+ return observeContentSize(shader, content2, sizeToContent);
35
+ }, [isWrapped, sizeToContent, hasHtmlChildren, shaderRef]);
47
36
  const addHtmlUniform = (uniforms) => hasHtmlChildren && contentRef.current ? { ...uniforms, u_image: contentRef.current } : uniforms;
48
37
  if (!isWrapped) {
49
38
  return { hasHtmlChildren, addHtmlUniform, renderedChildren: children, sizeStyle: void 0 };
50
39
  }
51
- const contentStyle = { ...contentProps?.style };
40
+ const contentStyle = { ...layoutProps?.style };
52
41
  if (fitsWidth) {
53
42
  contentStyle.width = "max-content";
54
43
  }
@@ -65,14 +54,11 @@ function useHtmlChildren(acceptsHtmlChildren, children, contentProps, sizeToCont
65
54
  sizeStyle.height = "var(--paper-shader-content-height)";
66
55
  }
67
56
  }
68
- const content = /* @__PURE__ */ jsx("div", { ...contentProps, ref: mergedContentRef, style: contentStyle, ...{ drawable: "" }, children });
69
- if (!hasHtmlChildren) {
70
- return { hasHtmlChildren, addHtmlUniform, renderedChildren: content, sizeStyle };
71
- }
57
+ const content = /* @__PURE__ */ jsx("div", { ...layoutProps, ref: mergedContentRef, style: contentStyle, ...{ drawable: "" }, children });
72
58
  return {
73
59
  hasHtmlChildren,
74
60
  addHtmlUniform,
75
- renderedChildren: /* @__PURE__ */ jsx(InsideShaderCanvasContext.Provider, { value: true, children: isInsideShaderCanvas ? content : /* @__PURE__ */ jsx("canvas", { ...{ content: "drawable", layoutsubtree: "" }, children: content }) }),
61
+ renderedChildren: hasHtmlChildren ? /* @__PURE__ */ jsx("canvas", { ...{ content: "drawable", layoutsubtree: "" }, children: content }) : content,
76
62
  sizeStyle
77
63
  };
78
64
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/html-in-canvas.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport { Children, createContext, useContext, useLayoutEffect, useRef, useSyncExternalStore } from 'react';\nimport { isHtmlInCanvasSupported } from '@paper-design/shaders';\nimport { useMergeRefs } from './use-merge-refs.js';\n\nconst subscribeToNothing = () => () => {};\n// Assumed on the server, so that supporting browsers don't re-render the canvas after hydration\nconst isSupportedOnServer = () => true;\n\n/** Whether the children are drawn by a shader canvas above, so nested shaders render through it instead of their own */\nconst InsideShaderCanvasContext = createContext(false);\n\n/** Props of the element that holds the children. It's what gets drawn, so it takes their layout and the visuals */\nexport type ShaderContentProps = React.ComponentProps<'div'> & { [key: `data-${string}`]: unknown };\n\n/** Axes on which the shader takes the size of its content instead of its own size styles */\nexport type ShaderSizeToContent = 'width' | 'height' | 'both';\n\nfunction hasChildren(children: React.ReactNode): boolean {\n return Children.toArray(children).length > 0;\n}\n\nexport function willDrawHtmlChildren(children: React.ReactNode): boolean {\n return hasChildren(children) && isHtmlInCanvasSupported();\n}\n\n/**\n * Draws the children into u_image where the browser supports it, otherwise they're shown on top of the shader.\n * Either way they're held by the same content element, so they lay out the same.\n *\n * The content element fills the shader, except on the axes sized to content: there it takes the size of the children,\n * and the shader follows it. The canvas can't be sized by what's inside it, so the content size is measured and\n * set on the shader element. Resize observer callbacks run before paint, so this settles within the same frame.\n */\nexport function useHtmlChildren(\n acceptsHtmlChildren: boolean,\n children: React.ReactNode,\n contentProps: ShaderContentProps | undefined,\n sizeToContent: ShaderSizeToContent | undefined,\n shaderRef: React.RefObject<HTMLElement | null>\n): {\n hasHtmlChildren: boolean;\n addHtmlUniform: <T extends object>(uniforms: T) => T;\n renderedChildren: React.ReactNode;\n sizeStyle: React.CSSProperties | undefined;\n} {\n const contentRef = useRef<HTMLDivElement>(null);\n const mergedContentRef = useMergeRefs([contentRef, contentProps?.ref]);\n const isSupported = useSyncExternalStore(subscribeToNothing, isHtmlInCanvasSupported, isSupportedOnServer);\n const isInsideShaderCanvas = useContext(InsideShaderCanvasContext);\n const isWrapped = acceptsHtmlChildren && hasChildren(children);\n const hasHtmlChildren = isWrapped && isSupported;\n\n const fitsWidth = isWrapped && (sizeToContent === 'width' || sizeToContent === 'both');\n const fitsHeight = isWrapped && (sizeToContent === 'height' || sizeToContent === 'both');\n\n useLayoutEffect(() => {\n const content = contentRef.current;\n const shader = shaderRef.current;\n if (!content || !shader || (!fitsWidth && !fitsHeight)) {\n return;\n }\n\n const observer = new ResizeObserver(([entry]) => {\n const size = entry?.borderBoxSize[0];\n if (!size) return;\n shader.style.setProperty('--paper-shader-content-width', `${size.inlineSize}px`);\n shader.style.setProperty('--paper-shader-content-height', `${size.blockSize}px`);\n });\n observer.observe(content);\n\n return () => {\n observer.disconnect();\n };\n }, [fitsWidth, fitsHeight, hasHtmlChildren, shaderRef]);\n\n const addHtmlUniform = <T extends object>(uniforms: T): T =>\n hasHtmlChildren && contentRef.current ? { ...uniforms, u_image: contentRef.current } : uniforms;\n\n if (!isWrapped) {\n return { hasHtmlChildren, addHtmlUniform, renderedChildren: children, sizeStyle: undefined };\n }\n\n // Sized to content: the content element takes the size of the children, which can overflow the canvas\n const contentStyle: React.CSSProperties = { ...contentProps?.style };\n if (fitsWidth) {\n contentStyle.width = 'max-content';\n }\n if (fitsHeight) {\n contentStyle.height = 'auto';\n }\n\n // The shader takes the measured content size\n let sizeStyle: React.CSSProperties | undefined;\n if (fitsWidth || fitsHeight) {\n sizeStyle = {};\n if (fitsWidth) {\n sizeStyle.width = 'var(--paper-shader-content-width)';\n }\n if (fitsHeight) {\n sizeStyle.height = 'var(--paper-shader-content-height)';\n }\n }\n\n const content = (\n <div {...contentProps} ref={mergedContentRef} style={contentStyle} {...{ drawable: '' }}>\n {children}\n </div>\n );\n\n if (!hasHtmlChildren) {\n return { hasHtmlChildren, addHtmlUniform, renderedChildren: content, sizeStyle };\n }\n\n // Nested in the HTML of another shader, the content stays drawable HTML that the root shader canvas captures\n return {\n hasHtmlChildren,\n addHtmlUniform,\n renderedChildren: (\n <InsideShaderCanvasContext.Provider value={true}>\n {isInsideShaderCanvas ?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I;AAAA,IACjF,CAAC;AACD,aAAS,QAAQA,QAAO;AAExB,WAAO,MAAM;AACX,eAAS,WAAW;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,WAAW,YAAY,iBAAiB,SAAS,CAAC;AAEtD,QAAM,iBAAiB,CAAmB,aACxC,mBAAmB,WAAW,UAAU,EAAE,GAAG,UAAU,SAAS,WAAW,QAAQ,IAAI;AAEzF,MAAI,CAAC,WAAW;AACd,WAAO,EAAE,iBAAiB,gBAAgB,kBAAkB,UAAU,WAAW,OAAU;AAAA,EAC7F;AAGA,QAAM,eAAoC,EAAE,GAAG,cAAc,MAAM;AACnE,MAAI,WAAW;AACb,iBAAa,QAAQ;AAAA,EACvB;AACA,MAAI,YAAY;AACd,iBAAa,SAAS;AAAA,EACxB;AAGA,MAAI;AACJ,MAAI,aAAa,YAAY;AAC3B,gBAAY,CAAC;AACb,QAAI,WAAW;AACb,gBAAU,QAAQ;AAAA,IACpB;AACA,QAAI,YAAY;AACd,gBAAU,SAAS;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,UACJ,oBAAC,SAAK,GAAG,cAAc,KAAK,kBAAkB,OAAO,cAAe,GAAG,EAAE,UAAU,GAAG,GACnF,UACH;AAGF,MAAI,CAAC,iBAAiB;AACpB,WAAO,EAAE,iBAAiB,gBAAgB,kBAAkB,SAAS,UAAU;AAAA,EACjF;AAGA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,kBACE,oBAAC,0BAA0B,UAA1B,EAAmC,OAAO,MACxC,iCAAuB,UAAU,oBAAC,YAAQ,GAAG,EAAE,SAAS,YAAY,eAAe,GAAG,GAAI,mBAAQ,GACrG;AAAA,IAEF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["'use client';\n\nimport { Children, useLayoutEffect, useRef, useSyncExternalStore } from 'react';\nimport { isHtmlInCanvasSupported, observeContentSize, type ShaderSizeToContent } from '@paper-design/shaders';\nimport { useMergeRefs } from './use-merge-refs.js';\n\nconst subscribeToNothing = () => () => {};\n// Assumed on the server, so that supporting browsers don't re-render the canvas after hydration\nconst isSupportedOnServer = () => true;\n\n/** Props of the element that holds the children. It's what gets drawn, so it takes their layout and the visuals */\nexport type ShaderLayoutProps = React.ComponentProps<'div'> & { [key: `data-${string}`]: unknown };\n\nexport type { ShaderSizeToContent };\n\nfunction hasChildren(children: React.ReactNode): boolean {\n return Children.toArray(children).length > 0;\n}\n\nexport function willDrawHtmlChildren(children: React.ReactNode): boolean {\n return hasChildren(children) && isHtmlInCanvasSupported();\n}\n\n/**\n * Draws the children into u_image where the browser supports it, otherwise they're shown on top of the shader.\n * Either way they're held by the same content element, so they lay out the same.\n *\n * The content element fills the shader, except on the axes sized to content: there it takes the size of the children,\n * and the shader follows it (see `observeContentSize`).\n */\nexport function useHtmlChildren(\n acceptsHtmlChildren: boolean,\n children: React.ReactNode,\n layoutProps: ShaderLayoutProps | undefined,\n sizeToContent: ShaderSizeToContent | undefined,\n shaderRef: React.RefObject<HTMLElement | null>\n): {\n hasHtmlChildren: boolean;\n addHtmlUniform: <T extends object>(uniforms: T) => T;\n renderedChildren: React.ReactNode;\n sizeStyle: React.CSSProperties | undefined;\n} {\n const contentRef = useRef<HTMLDivElement>(null);\n const mergedContentRef = useMergeRefs([contentRef, layoutProps?.ref]);\n const isSupported = useSyncExternalStore(subscribeToNothing, isHtmlInCanvasSupported, isSupportedOnServer);\n const isWrapped = acceptsHtmlChildren && hasChildren(children);\n const hasHtmlChildren = isWrapped && isSupported;\n\n const fitsWidth = isWrapped && (sizeToContent === 'width' || sizeToContent === 'both');\n const fitsHeight = isWrapped && (sizeToContent === 'height' || sizeToContent === 'both');\n\n useLayoutEffect(() => {\n const content = contentRef.current;\n const shader = shaderRef.current;\n if (!content || !shader || !isWrapped || !sizeToContent) {\n return;\n }\n\n return observeContentSize(shader, content, sizeToContent);\n }, [isWrapped, sizeToContent, hasHtmlChildren, shaderRef]);\n\n const addHtmlUniform = <T extends object>(uniforms: T): T =>\n hasHtmlChildren && contentRef.current ? { ...uniforms, u_image: contentRef.current } : uniforms;\n\n if (!isWrapped) {\n return { hasHtmlChildren, addHtmlUniform, renderedChildren: children, sizeStyle: undefined };\n }\n\n // Sized to content: the content element takes the size of the children, which can overflow the canvas\n const contentStyle: React.CSSProperties = { ...layoutProps?.style };\n if (fitsWidth) {\n contentStyle.width = 'max-content';\n }\n if (fitsHeight) {\n contentStyle.height = 'auto';\n }\n\n // The shader takes the measured content size\n let sizeStyle: React.CSSProperties | undefined;\n if (fitsWidth || fitsHeight) {\n sizeStyle = {};\n if (fitsWidth) {\n sizeStyle.width = 'var(--paper-shader-content-width)';\n }\n if (fitsHeight) {\n sizeStyle.height = 'var(--paper-shader-content-height)';\n }\n }\n\n const content = (\n <div {...layoutProps} ref={mergedContentRef} style={contentStyle} {...{ drawable: '' }}>\n {children}\n </div>\n );\n\n return {\n hasHtmlChildren,\n addHtmlUniform,\n renderedChildren: hasHtmlChildren ? (\n <canvas {...{ content: 'drawable', layoutsubtree: '' }}>{content}</canvas>\n ) : (\n content\n ),\n sizeStyle,\n };\n}\n"],
5
+ "mappings": ";;;;;;AAEA,SAAS,UAAU,iBAAiB,QAAQ,4BAA4B;AACxE,SAAS,yBAAyB,0BAAoD;AACtF,SAAS,oBAAoB;AAsFzB;AApFJ,MAAM,qBAAqB,MAAM,MAAM;AAAC;AAExC,MAAM,sBAAsB,MAAM;AAOlC,SAAS,YAAY,UAAoC;AACvD,SAAO,SAAS,QAAQ,QAAQ,EAAE,SAAS;AAC7C;AAEO,SAAS,qBAAqB,UAAoC;AACvE,SAAO,YAAY,QAAQ,KAAK,wBAAwB;AAC1D;AASO,SAAS,gBACd,qBACA,UACA,aACA,eACA,WAMA;AACA,QAAM,aAAa,OAAuB,IAAI;AAC9C,QAAM,mBAAmB,aAAa,CAAC,YAAY,aAAa,GAAG,CAAC;AACpE,QAAM,cAAc,qBAAqB,oBAAoB,yBAAyB,mBAAmB;AACzG,QAAM,YAAY,uBAAuB,YAAY,QAAQ;AAC7D,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{ ShaderMountProps, ShaderComponentProps } from './shader-mount.js';
3
- export type { ShaderContentProps, ShaderSizeToContent } from './html-in-canvas.js';
3
+ export type { ShaderLayoutProps, ShaderSizeToContent } from './html-in-canvas.js';
4
4
  export { MeshGradient, meshGradientPresets } from './shaders/mesh-gradient.js';
5
5
  export type { MeshGradientProps } from './shaders/mesh-gradient.js';
6
6
  export type { MeshGradientUniforms, MeshGradientParams } from '@paper-design/shaders';
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["'use client';\n\nexport { ShaderMount } from './shader-mount.js';\nexport type { ShaderMountProps, ShaderComponentProps } from './shader-mount.js';\nexport type { ShaderContentProps, ShaderSizeToContent } from './html-in-canvas.js';\n\nexport { MeshGradient, meshGradientPresets } from './shaders/mesh-gradient.js';\nexport type { MeshGradientProps } from './shaders/mesh-gradient.js';\nexport type { MeshGradientUniforms, MeshGradientParams } from '@paper-design/shaders';\n\nexport { SmokeRing, smokeRingPresets } from './shaders/smoke-ring.js';\nexport type { SmokeRingProps } from './shaders/smoke-ring.js';\nexport type { SmokeRingUniforms, SmokeRingParams } from '@paper-design/shaders';\n\nexport { NeuroNoise, neuroNoisePresets } from './shaders/neuro-noise.js';\nexport type { NeuroNoiseProps } from './shaders/neuro-noise.js';\nexport type { NeuroNoiseUniforms, NeuroNoiseParams } from '@paper-design/shaders';\n\nexport { DotOrbit, dotOrbitPresets } from './shaders/dot-orbit.js';\nexport type { DotOrbitProps } from './shaders/dot-orbit.js';\nexport type { DotOrbitUniforms, DotOrbitParams } from '@paper-design/shaders';\n\nexport { DotGrid, dotGridPresets } from './shaders/dot-grid.js';\nexport type { DotGridProps } from './shaders/dot-grid.js';\nexport type { DotGridUniforms, DotGridParams } from '@paper-design/shaders';\n\nexport { SimplexNoise, simplexNoisePresets } from './shaders/simplex-noise.js';\nexport type { SimplexNoiseProps } from './shaders/simplex-noise.js';\nexport type { SimplexNoiseUniforms, SimplexNoiseParams } from '@paper-design/shaders';\n\nexport { Metaballs, metaballsPresets } from './shaders/metaballs.js';\nexport type { MetaballsProps } from './shaders/metaballs.js';\nexport type { MetaballsUniforms, MetaballsParams } from '@paper-design/shaders';\n\nexport { Waves, wavesPresets } from './shaders/waves.js';\nexport type { WavesProps } from './shaders/waves.js';\nexport type { WavesUniforms, WavesParams } from '@paper-design/shaders';\n\nexport { PerlinNoise, perlinNoisePresets } from './shaders/perlin-noise.js';\nexport type { PerlinNoiseProps } from './shaders/perlin-noise.js';\nexport type { PerlinNoiseUniforms, PerlinNoiseParams } from '@paper-design/shaders';\n\nexport { Voronoi, voronoiPresets } from './shaders/voronoi.js';\nexport type { VoronoiProps } from './shaders/voronoi.js';\nexport type { VoronoiUniforms, VoronoiParams } from '@paper-design/shaders';\n\nexport { Warp, warpPresets } from './shaders/warp.js';\nexport type { WarpProps } from './shaders/warp.js';\nexport type { WarpUniforms, WarpParams, WarpPattern } from '@paper-design/shaders';\n\nexport { GodRays, godRaysPresets } from './shaders/god-rays.js';\nexport type { GodRaysProps } from './shaders/god-rays.js';\nexport type { GodRaysUniforms, GodRaysParams } from '@paper-design/shaders';\n\nexport { Spiral, spiralPresets } from './shaders/spiral.js';\nexport type { SpiralProps } from './shaders/spiral.js';\nexport type { SpiralUniforms, SpiralParams } from '@paper-design/shaders';\n\nexport { Swirl, swirlPresets } from './shaders/swirl.js';\nexport type { SwirlProps } from './shaders/swirl.js';\nexport type { SwirlUniforms, SwirlParams } from '@paper-design/shaders';\n\nexport { Dithering, ditheringPresets } from './shaders/dithering.js';\nexport type { DitheringProps } from './shaders/dithering.js';\nexport type { DitheringUniforms, DitheringParams } from '@paper-design/shaders';\n\nexport { GrainGradient, grainGradientPresets } from './shaders/grain-gradient.js';\nexport type { GrainGradientProps } from './shaders/grain-gradient.js';\nexport type { GrainGradientUniforms, GrainGradientParams } from '@paper-design/shaders';\n\nexport { PulsingBorder, pulsingBorderPresets } from './shaders/pulsing-border.js';\nexport type { PulsingBorderProps } from './shaders/pulsing-border.js';\nexport type { PulsingBorderUniforms, PulsingBorderParams } from '@paper-design/shaders';\n\nexport { ColorPanels, colorPanelsPresets } from './shaders/color-panels.js';\nexport type { ColorPanelsProps } from './shaders/color-panels.js';\nexport type { ColorPanelsUniforms, ColorPanelsParams } from '@paper-design/shaders';\n\nexport { StaticMeshGradient, staticMeshGradientPresets } from './shaders/static-mesh-gradient.js';\nexport type { StaticMeshGradientProps } from './shaders/static-mesh-gradient.js';\nexport type { StaticMeshGradientUniforms, StaticMeshGradientParams } from '@paper-design/shaders';\n\nexport { StaticRadialGradient, staticRadialGradientPresets } from './shaders/static-radial-gradient.js';\nexport type { StaticRadialGradientProps } from './shaders/static-radial-gradient.js';\nexport type { StaticRadialGradientUniforms, StaticRadialGradientParams } from '@paper-design/shaders';\n\nexport { PaperTexture, paperTexturePresets } from './shaders/paper-texture.js';\nexport type { PaperTextureProps } from './shaders/paper-texture.js';\nexport type { PaperTextureUniforms, PaperTextureParams } from '@paper-design/shaders';\n\nexport { FlutedGlass, flutedGlassPresets } from './shaders/fluted-glass.js';\nexport { type FlutedGlassProps } from './shaders/fluted-glass.js';\nexport { type FlutedGlassUniforms, type FlutedGlassParams } from '@paper-design/shaders';\n\nexport { Water, waterPresets } from './shaders/water.js';\nexport type { WaterProps } from './shaders/water.js';\nexport type { WaterUniforms, WaterParams } from '@paper-design/shaders';\n\nexport { ImageDithering, imageDitheringPresets } from './shaders/image-dithering.js';\nexport type { ImageDitheringProps } from './shaders/image-dithering.js';\nexport type { ImageDitheringUniforms, ImageDitheringParams } from '@paper-design/shaders';\n\nexport { LensDistortion, lensDistortionPresets } from './shaders/lens-distortion.js';\nexport type { LensDistortionProps } from './shaders/lens-distortion.js';\nexport type { LensDistortionUniforms, LensDistortionParams } from '@paper-design/shaders';\n\nexport { Heatmap, heatmapPresets } from './shaders/heatmap.js';\nexport type { HeatmapProps } from './shaders/heatmap.js';\nexport type { HeatmapUniforms, HeatmapParams } from '@paper-design/shaders';\n\nexport { LiquidMetal, liquidMetalPresets } from './shaders/liquid-metal.js';\nexport type { LiquidMetalProps } from './shaders/liquid-metal.js';\nexport type { LiquidMetalUniforms, LiquidMetalParams } from '@paper-design/shaders';\n\nexport { HalftoneDots, halftoneDotsPresets } from './shaders/halftone-dots.js';\nexport type { HalftoneDotsProps } from './shaders/halftone-dots.js';\nexport type { HalftoneDotsUniforms, HalftoneDotsParams } from '@paper-design/shaders';\n\nexport { HalftoneCmyk, halftoneCmykPresets } from './shaders/halftone-cmyk.js';\nexport type { HalftoneCmykProps } from './shaders/halftone-cmyk.js';\nexport type { HalftoneCmykUniforms, HalftoneCmykParams } from '@paper-design/shaders';\n\nexport { GemSmoke, gemSmokePresets } from './shaders/gem-smoke.js';\nexport type { GemSmokeProps } from './shaders/gem-smoke.js';\nexport type { GemSmokeUniforms, GemSmokeParams } from '@paper-design/shaders';\n\nexport { isPaperShaderElement, getShaderColorFromString } from '@paper-design/shaders';\nexport type { PaperShaderElement, ShaderFit, ShaderSizingParams, ShaderSizingUniforms } from '@paper-design/shaders';\n\nexport {\n colorPanelsMeta,\n dotOrbitMeta,\n godRaysMeta,\n grainGradientMeta,\n meshGradientMeta,\n metaballsMeta,\n paperTextureMeta,\n pulsingBorderMeta,\n simplexNoiseMeta,\n smokeRingMeta,\n swirlMeta,\n voronoiMeta,\n warpMeta,\n heatmapMeta,\n lensDistortionMeta,\n staticMeshGradientMeta,\n staticRadialGradientMeta,\n} from '@paper-design/shaders';\n"],
4
+ "sourcesContent": ["'use client';\n\nexport { ShaderMount } from './shader-mount.js';\nexport type { ShaderMountProps, ShaderComponentProps } from './shader-mount.js';\nexport type { ShaderLayoutProps, ShaderSizeToContent } from './html-in-canvas.js';\n\nexport { MeshGradient, meshGradientPresets } from './shaders/mesh-gradient.js';\nexport type { MeshGradientProps } from './shaders/mesh-gradient.js';\nexport type { MeshGradientUniforms, MeshGradientParams } from '@paper-design/shaders';\n\nexport { SmokeRing, smokeRingPresets } from './shaders/smoke-ring.js';\nexport type { SmokeRingProps } from './shaders/smoke-ring.js';\nexport type { SmokeRingUniforms, SmokeRingParams } from '@paper-design/shaders';\n\nexport { NeuroNoise, neuroNoisePresets } from './shaders/neuro-noise.js';\nexport type { NeuroNoiseProps } from './shaders/neuro-noise.js';\nexport type { NeuroNoiseUniforms, NeuroNoiseParams } from '@paper-design/shaders';\n\nexport { DotOrbit, dotOrbitPresets } from './shaders/dot-orbit.js';\nexport type { DotOrbitProps } from './shaders/dot-orbit.js';\nexport type { DotOrbitUniforms, DotOrbitParams } from '@paper-design/shaders';\n\nexport { DotGrid, dotGridPresets } from './shaders/dot-grid.js';\nexport type { DotGridProps } from './shaders/dot-grid.js';\nexport type { DotGridUniforms, DotGridParams } from '@paper-design/shaders';\n\nexport { SimplexNoise, simplexNoisePresets } from './shaders/simplex-noise.js';\nexport type { SimplexNoiseProps } from './shaders/simplex-noise.js';\nexport type { SimplexNoiseUniforms, SimplexNoiseParams } from '@paper-design/shaders';\n\nexport { Metaballs, metaballsPresets } from './shaders/metaballs.js';\nexport type { MetaballsProps } from './shaders/metaballs.js';\nexport type { MetaballsUniforms, MetaballsParams } from '@paper-design/shaders';\n\nexport { Waves, wavesPresets } from './shaders/waves.js';\nexport type { WavesProps } from './shaders/waves.js';\nexport type { WavesUniforms, WavesParams } from '@paper-design/shaders';\n\nexport { PerlinNoise, perlinNoisePresets } from './shaders/perlin-noise.js';\nexport type { PerlinNoiseProps } from './shaders/perlin-noise.js';\nexport type { PerlinNoiseUniforms, PerlinNoiseParams } from '@paper-design/shaders';\n\nexport { Voronoi, voronoiPresets } from './shaders/voronoi.js';\nexport type { VoronoiProps } from './shaders/voronoi.js';\nexport type { VoronoiUniforms, VoronoiParams } from '@paper-design/shaders';\n\nexport { Warp, warpPresets } from './shaders/warp.js';\nexport type { WarpProps } from './shaders/warp.js';\nexport type { WarpUniforms, WarpParams, WarpPattern } from '@paper-design/shaders';\n\nexport { GodRays, godRaysPresets } from './shaders/god-rays.js';\nexport type { GodRaysProps } from './shaders/god-rays.js';\nexport type { GodRaysUniforms, GodRaysParams } from '@paper-design/shaders';\n\nexport { Spiral, spiralPresets } from './shaders/spiral.js';\nexport type { SpiralProps } from './shaders/spiral.js';\nexport type { SpiralUniforms, SpiralParams } from '@paper-design/shaders';\n\nexport { Swirl, swirlPresets } from './shaders/swirl.js';\nexport type { SwirlProps } from './shaders/swirl.js';\nexport type { SwirlUniforms, SwirlParams } from '@paper-design/shaders';\n\nexport { Dithering, ditheringPresets } from './shaders/dithering.js';\nexport type { DitheringProps } from './shaders/dithering.js';\nexport type { DitheringUniforms, DitheringParams } from '@paper-design/shaders';\n\nexport { GrainGradient, grainGradientPresets } from './shaders/grain-gradient.js';\nexport type { GrainGradientProps } from './shaders/grain-gradient.js';\nexport type { GrainGradientUniforms, GrainGradientParams } from '@paper-design/shaders';\n\nexport { PulsingBorder, pulsingBorderPresets } from './shaders/pulsing-border.js';\nexport type { PulsingBorderProps } from './shaders/pulsing-border.js';\nexport type { PulsingBorderUniforms, PulsingBorderParams } from '@paper-design/shaders';\n\nexport { ColorPanels, colorPanelsPresets } from './shaders/color-panels.js';\nexport type { ColorPanelsProps } from './shaders/color-panels.js';\nexport type { ColorPanelsUniforms, ColorPanelsParams } from '@paper-design/shaders';\n\nexport { StaticMeshGradient, staticMeshGradientPresets } from './shaders/static-mesh-gradient.js';\nexport type { StaticMeshGradientProps } from './shaders/static-mesh-gradient.js';\nexport type { StaticMeshGradientUniforms, StaticMeshGradientParams } from '@paper-design/shaders';\n\nexport { StaticRadialGradient, staticRadialGradientPresets } from './shaders/static-radial-gradient.js';\nexport type { StaticRadialGradientProps } from './shaders/static-radial-gradient.js';\nexport type { StaticRadialGradientUniforms, StaticRadialGradientParams } from '@paper-design/shaders';\n\nexport { PaperTexture, paperTexturePresets } from './shaders/paper-texture.js';\nexport type { PaperTextureProps } from './shaders/paper-texture.js';\nexport type { PaperTextureUniforms, PaperTextureParams } from '@paper-design/shaders';\n\nexport { FlutedGlass, flutedGlassPresets } from './shaders/fluted-glass.js';\nexport { type FlutedGlassProps } from './shaders/fluted-glass.js';\nexport { type FlutedGlassUniforms, type FlutedGlassParams } from '@paper-design/shaders';\n\nexport { Water, waterPresets } from './shaders/water.js';\nexport type { WaterProps } from './shaders/water.js';\nexport type { WaterUniforms, WaterParams } from '@paper-design/shaders';\n\nexport { ImageDithering, imageDitheringPresets } from './shaders/image-dithering.js';\nexport type { ImageDitheringProps } from './shaders/image-dithering.js';\nexport type { ImageDitheringUniforms, ImageDitheringParams } from '@paper-design/shaders';\n\nexport { LensDistortion, lensDistortionPresets } from './shaders/lens-distortion.js';\nexport type { LensDistortionProps } from './shaders/lens-distortion.js';\nexport type { LensDistortionUniforms, LensDistortionParams } from '@paper-design/shaders';\n\nexport { Heatmap, heatmapPresets } from './shaders/heatmap.js';\nexport type { HeatmapProps } from './shaders/heatmap.js';\nexport type { HeatmapUniforms, HeatmapParams } from '@paper-design/shaders';\n\nexport { LiquidMetal, liquidMetalPresets } from './shaders/liquid-metal.js';\nexport type { LiquidMetalProps } from './shaders/liquid-metal.js';\nexport type { LiquidMetalUniforms, LiquidMetalParams } from '@paper-design/shaders';\n\nexport { HalftoneDots, halftoneDotsPresets } from './shaders/halftone-dots.js';\nexport type { HalftoneDotsProps } from './shaders/halftone-dots.js';\nexport type { HalftoneDotsUniforms, HalftoneDotsParams } from '@paper-design/shaders';\n\nexport { HalftoneCmyk, halftoneCmykPresets } from './shaders/halftone-cmyk.js';\nexport type { HalftoneCmykProps } from './shaders/halftone-cmyk.js';\nexport type { HalftoneCmykUniforms, HalftoneCmykParams } from '@paper-design/shaders';\n\nexport { GemSmoke, gemSmokePresets } from './shaders/gem-smoke.js';\nexport type { GemSmokeProps } from './shaders/gem-smoke.js';\nexport type { GemSmokeUniforms, GemSmokeParams } from '@paper-design/shaders';\n\nexport { isPaperShaderElement, getShaderColorFromString } from '@paper-design/shaders';\nexport type { PaperShaderElement, ShaderFit, ShaderSizingParams, ShaderSizingUniforms } from '@paper-design/shaders';\n\nexport {\n colorPanelsMeta,\n dotOrbitMeta,\n godRaysMeta,\n grainGradientMeta,\n meshGradientMeta,\n metaballsMeta,\n paperTextureMeta,\n pulsingBorderMeta,\n simplexNoiseMeta,\n smokeRingMeta,\n swirlMeta,\n voronoiMeta,\n warpMeta,\n heatmapMeta,\n lensDistortionMeta,\n staticMeshGradientMeta,\n staticRadialGradientMeta,\n} from '@paper-design/shaders';\n"],
5
5
  "mappings": ";;;;;;AAEA,SAAS,mBAAmB;AAI5B,SAAS,cAAc,2BAA2B;AAIlD,SAAS,WAAW,wBAAwB;AAI5C,SAAS,YAAY,yBAAyB;AAI9C,SAAS,UAAU,uBAAuB;AAI1C,SAAS,SAAS,sBAAsB;AAIxC,SAAS,cAAc,2BAA2B;AAIlD,SAAS,WAAW,wBAAwB;AAI5C,SAAS,OAAO,oBAAoB;AAIpC,SAAS,aAAa,0BAA0B;AAIhD,SAAS,SAAS,sBAAsB;AAIxC,SAAS,MAAM,mBAAmB;AAIlC,SAAS,SAAS,sBAAsB;AAIxC,SAAS,QAAQ,qBAAqB;AAItC,SAAS,OAAO,oBAAoB;AAIpC,SAAS,WAAW,wBAAwB;AAI5C,SAAS,eAAe,4BAA4B;AAIpD,SAAS,eAAe,4BAA4B;AAIpD,SAAS,aAAa,0BAA0B;AAIhD,SAAS,oBAAoB,iCAAiC;AAI9D,SAAS,sBAAsB,mCAAmC;AAIlE,SAAS,cAAc,2BAA2B;AAIlD,SAAS,aAAa,0BAA0B;AAChD,eAAsC;AACtC,eAAiE;AAEjE,SAAS,OAAO,oBAAoB;AAIpC,SAAS,gBAAgB,6BAA6B;AAItD,SAAS,gBAAgB,6BAA6B;AAItD,SAAS,SAAS,sBAAsB;AAIxC,SAAS,aAAa,0BAA0B;AAIhD,SAAS,cAAc,2BAA2B;AAIlD,SAAS,cAAc,2BAA2B;AAIlD,SAAS,UAAU,uBAAuB;AAI1C,SAAS,sBAAsB,gCAAgC;AAG/D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { type PaperShaderElement, type ShaderMotionParams } from '@paper-design/shaders';
2
- import { type ShaderContentProps, type ShaderSizeToContent } from './html-in-canvas.js';
2
+ import { type ShaderLayoutProps, type ShaderSizeToContent } from './html-in-canvas.js';
3
3
  /**
4
4
  * React Shader Mount can also accept strings as uniform values, which will assumed to be URLs and loaded as images
5
5
  *
@@ -20,7 +20,7 @@ export interface ShaderMountProps extends Omit<React.ComponentProps<'div'>, 'col
20
20
  /** Set by shaders that can draw their children into u_image (experimental) */
21
21
  acceptsHtmlChildren?: boolean;
22
22
  /** Props of the element that holds the children and is drawn with them: layout, padding, background, border */
23
- contentProps?: ShaderContentProps;
23
+ layoutProps?: ShaderLayoutProps;
24
24
  /** Size the shader to its children on these axes instead of its own width and height styles */
25
25
  sizeToContent?: ShaderSizeToContent;
26
26
  /** Inline CSS width style */
@@ -34,7 +34,7 @@ export interface ShaderComponentProps extends Omit<React.ComponentProps<'div'>,
34
34
  maxPixelCount?: number;
35
35
  webGlContextAttributes?: WebGLContextAttributes;
36
36
  /** Props of the element that holds the children and is drawn with them, for shaders that accept HTML children */
37
- contentProps?: ShaderContentProps;
37
+ layoutProps?: ShaderLayoutProps;
38
38
  /** Size the shader to its children on these axes, for shaders that accept HTML children */
39
39
  sizeToContent?: ShaderSizeToContent;
40
40
  /** Inline CSS width style */
@@ -84,7 +84,7 @@ const ShaderMount = forwardRef(
84
84
  maxPixelCount,
85
85
  mipmaps,
86
86
  acceptsHtmlChildren = false,
87
- contentProps,
87
+ layoutProps,
88
88
  sizeToContent,
89
89
  children,
90
90
  style,
@@ -97,7 +97,7 @@ const ShaderMount = forwardRef(
97
97
  const { hasHtmlChildren, addHtmlUniform, renderedChildren, sizeStyle } = useHtmlChildren(
98
98
  acceptsHtmlChildren,
99
99
  children,
100
- contentProps,
100
+ layoutProps,
101
101
  sizeToContent,
102
102
  divRef
103
103
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/shader-mount.tsx"],
4
- "sourcesContent": ["'use client';\n\nimport { useEffect, useRef, forwardRef, useState } from 'react';\nimport {\n ShaderMount as ShaderMountVanilla,\n emptyPixel,\n type PaperShaderElement,\n type ShaderMotionParams,\n type ShaderMountUniforms,\n} from '@paper-design/shaders';\nimport { useMergeRefs } from './use-merge-refs.js';\nimport { setMinImageSize } from './set-min-image-size.js';\nimport { useHtmlChildren, type ShaderContentProps, type ShaderSizeToContent } from './html-in-canvas.js';\n\n/**\n * React Shader Mount can also accept strings as uniform values, which will assumed to be URLs and loaded as images\n *\n * We accept undefined as a convenience for server rendering, when some things may be undefined\n * We just skip setting the uniform if it's undefined. This allows the shader mount to still take up space during server rendering\n */\ninterface ShaderMountUniformsReact {\n [key: string]: string | boolean | number | number[] | number[][] | HTMLImageElement | HTMLElement | undefined;\n}\n\nexport interface ShaderMountProps extends Omit<React.ComponentProps<'div'>, 'color' | 'ref'>, ShaderMotionParams {\n ref?: React.Ref<PaperShaderElement>;\n fragmentShader: string;\n uniforms: ShaderMountUniformsReact;\n mipmaps?: string[];\n minPixelRatio?: number;\n maxPixelCount?: number;\n webGlContextAttributes?: WebGLContextAttributes;\n /** Set by shaders that can draw their children into u_image (experimental) */\n acceptsHtmlChildren?: boolean;\n /** Props of the element that holds the children and is drawn with them: layout, padding, background, border */\n contentProps?: ShaderContentProps;\n /** Size the shader to its children on these axes instead of its own width and height styles */\n sizeToContent?: ShaderSizeToContent;\n\n /** Inline CSS width style */\n width?: string | number;\n /** Inline CSS height style */\n height?: string | number;\n}\n\nexport interface ShaderComponentProps extends Omit<React.ComponentProps<'div'>, 'color' | 'ref'> {\n ref?: React.Ref<PaperShaderElement>;\n minPixelRatio?: number;\n maxPixelCount?: number;\n webGlContextAttributes?: WebGLContextAttributes;\n /** Props of the element that holds the children and is drawn with them, for shaders that accept HTML children */\n contentProps?: ShaderContentProps;\n /** Size the shader to its children on these axes, for shaders that accept HTML children */\n sizeToContent?: ShaderSizeToContent;\n\n /** Inline CSS width style */\n width?: string | number;\n /** Inline CSS height style */\n height?: string | number;\n}\n\n/** Parse the provided uniforms, turning URL strings into loaded images */\nasync function processUniforms(uniformsProp: ShaderMountUniformsReact): Promise<ShaderMountUniforms> {\n const processedUniforms = {} as ShaderMountUniforms;\n const imageLoadPromises: Promise<void>[] = [];\n\n const isValidUrl = (url: string): boolean => {\n try {\n // Handle absolute paths\n if (url.startsWith('/')) return true;\n // Check if it's a valid URL\n new URL(url);\n return true;\n } catch {\n return false;\n }\n };\n\n const isExternalUrl = (url: string): boolean => {\n try {\n if (url.startsWith('/')) return false;\n const urlObject = new URL(url, window.location.origin);\n return urlObject.origin !== window.location.origin;\n } catch {\n return false;\n }\n };\n\n Object.entries(uniformsProp).forEach(([key, value]) => {\n if (typeof value === 'string') {\n // Use a transparent pixel for empty strings\n const url = value || emptyPixel;\n\n // Make sure the provided string is a valid URL or just skip trying to set this uniform entirely\n if (!isValidUrl(url)) {\n console.warn(`Uniform \"${key}\" has invalid URL \"${url}\". Skipping image loading.`);\n return;\n }\n\n const imagePromise = new Promise<void>((resolve, reject) => {\n const img = new Image();\n if (isExternalUrl(url)) {\n img.crossOrigin = 'anonymous';\n }\n img.onload = () => {\n setMinImageSize(img);\n processedUniforms[key] = img;\n resolve();\n };\n img.onerror = () => {\n console.error(`Could not set uniforms. Failed to load image at ${url}`);\n reject();\n };\n img.src = url;\n });\n\n imageLoadPromises.push(imagePromise);\n } else if (value instanceof HTMLImageElement) {\n const imagePromise = value.decode().then(() => {\n setMinImageSize(value);\n processedUniforms[key] = value;\n });\n imageLoadPromises.push(imagePromise);\n } else {\n processedUniforms[key] = value;\n }\n });\n\n await Promise.all(imageLoadPromises);\n return processedUniforms;\n}\n\n/**\n * A React component that mounts a shader and updates its uniforms as the component's props change\n * If you pass a string as a uniform value, it will be assumed to be a URL and attempted to be loaded as an image\n */\nexport const ShaderMount: React.FC<ShaderMountProps> = forwardRef<PaperShaderElement, ShaderMountProps>(\n function ShaderMountImpl(\n {\n fragmentShader,\n uniforms: uniformsProp,\n webGlContextAttributes,\n speed = 0,\n frame = 0,\n width,\n height,\n minPixelRatio,\n maxPixelCount,\n mipmaps,\n acceptsHtmlChildren = false,\n contentProps,\n sizeToContent,\n children,\n style,\n ...divProps\n },\n forwardedRef\n ) {\n const [isInitialized, setIsInitialized] = useState(false);\n const divRef = useRef<PaperShaderElement>(null);\n const shaderMountRef: React.RefObject<ShaderMountVanilla | null> = useRef<ShaderMountVanilla>(null);\n const webGlContextAttributesRef = useRef(webGlContextAttributes);\n const { hasHtmlChildren, addHtmlUniform, renderedChildren, sizeStyle } = useHtmlChildren(\n acceptsHtmlChildren,\n children,\n contentProps,\n sizeToContent,\n divRef\n );\n\n const getUniforms = (): ShaderMountUniformsReact => addHtmlUniform(uniformsProp);\n\n // Initialize the ShaderMountVanilla\n useEffect(() => {\n let isStale = false;\n\n const initShader = async () => {\n const uniforms = await processUniforms(getUniforms());\n\n if (!isStale && divRef.current && !shaderMountRef.current) {\n shaderMountRef.current = new ShaderMountVanilla(\n divRef.current,\n fragmentShader,\n uniforms,\n webGlContextAttributesRef.current,\n speed,\n frame,\n minPixelRatio,\n maxPixelCount,\n mipmaps\n );\n\n setIsInitialized(true);\n }\n };\n\n initShader();\n\n return () => {\n isStale = true;\n shaderMountRef.current?.dispose();\n shaderMountRef.current = null;\n };\n }, [fragmentShader, hasHtmlChildren]);\n\n // Uniforms\n useEffect(() => {\n let isStale = false;\n\n const updateUniforms = async () => {\n const uniforms = await processUniforms(getUniforms());\n\n if (!isStale) {\n // We only use the freshest uniforms otherwise we can get into race conditions\n // if some uniforms (images!) take longer to load in subsequent effect runs.\n shaderMountRef.current?.setUniforms(uniforms);\n }\n };\n\n updateUniforms();\n\n return () => {\n isStale = true;\n };\n }, [uniformsProp, isInitialized]);\n\n // Speed\n useEffect(() => {\n shaderMountRef.current?.setSpeed(speed);\n }, [speed, isInitialized]);\n\n // Max Pixel Count\n useEffect(() => {\n shaderMountRef.current?.setMaxPixelCount(maxPixelCount);\n }, [maxPixelCount, isInitialized]);\n\n // Min Pixel Ratio\n useEffect(() => {\n shaderMountRef.current?.setMinPixelRatio(minPixelRatio);\n }, [minPixelRatio, isInitialized]);\n\n // Frame\n useEffect(() => {\n shaderMountRef.current?.setFrame(frame);\n }, [frame, isInitialized]);\n\n const mergedRef = useMergeRefs([divRef, forwardedRef]) as unknown as React.RefObject<HTMLDivElement>;\n const shaderStyle =\n width !== undefined || height !== undefined\n ? {\n width: typeof width === 'string' && isNaN(+width) === false ? +width : width,\n height: typeof height === 'string' && isNaN(+height) === false ? +height : height,\n ...style,\n }\n : style;\n return (\n <div ref={mergedRef} style={sizeStyle ? { ...shaderStyle, ...sizeStyle } : shaderStyle} {...divProps}>\n {renderedChildren}\n </div>\n );\n }\n);\n\nShaderMount.displayName = 'ShaderMount';\n"],
5
- "mappings": ";;;;;;AAEA,SAAS,WAAW,QAAQ,YAAY,gBAAgB;AACxD;AAAA,EACE,eAAe;AAAA,EACf;AAAA,OAIK;AACP,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,uBAA0E;AAoP7E;AAlMN,eAAe,gBAAgB,cAAsE;AACnG,QAAM,oBAAoB,CAAC;AAC3B,QAAM,oBAAqC,CAAC;AAE5C,QAAM,aAAa,CAAC,QAAyB;AAC3C,QAAI;AAEF,UAAI,IAAI,WAAW,GAAG,EAAG,QAAO;AAEhC,UAAI,IAAI,GAAG;AACX,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,gBAAgB,CAAC,QAAyB;AAC9C,QAAI;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,CAAC;AAGhC,cAAU,MAAM;AACd,qBAAe,SAAS,SAAS,KAAK;AAAA,IACxC,GAAG,CAAC,OAAO,aAAa,CAAC;AAGzB,cAAU,MAAM;AACd,qBAAe,SAAS,iBAAiB,aAAa;AAAA,IACxD,GAAG,CAAC,eAAe,aAAa,CAAC;AAGjC,cAAU,MAAM;AACd,qBAAe,SAAS,iBAAiB,aAAa;AAAA,IACxD,GAAG,CAAC,eAAe,aAAa,CAAC;AAGjC,cAAU,MAAM;AACd,qBAAe,SAAS,SAAS,KAAK;AAAA,IACxC,GAAG,CAAC,OAAO,aAAa,CAAC;AAEzB,UAAM,YAAY,aAAa,CAAC,QAAQ,YAAY,CAAC;AACrD,UAAM,cACJ,UAAU,UAAa,WAAW,SAC9B;AAAA,MACE,OAAO,OAAO,UAAU,YAAY,MAAM,CAAC,KAAK,MAAM,QAAQ,CAAC,QAAQ;AAAA,MACvE,QAAQ,OAAO,WAAW,YAAY,MAAM,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS;AAAA,MAC3E,GAAG;AAAA,IACL,IACA;AACN,WACE,oBAAC,SAAI,KAAK,WAAW,OAAO,YAAY,EAAE,GAAG,aAAa,GAAG,UAAU,IAAI,aAAc,GAAG,UACzF,4BACH;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;",
4
+ "sourcesContent": ["'use client';\n\nimport { useEffect, useRef, forwardRef, useState } from 'react';\nimport {\n ShaderMount as ShaderMountVanilla,\n emptyPixel,\n type PaperShaderElement,\n type ShaderMotionParams,\n type ShaderMountUniforms,\n} from '@paper-design/shaders';\nimport { useMergeRefs } from './use-merge-refs.js';\nimport { setMinImageSize } from './set-min-image-size.js';\nimport { useHtmlChildren, type ShaderLayoutProps, type ShaderSizeToContent } from './html-in-canvas.js';\n\n/**\n * React Shader Mount can also accept strings as uniform values, which will assumed to be URLs and loaded as images\n *\n * We accept undefined as a convenience for server rendering, when some things may be undefined\n * We just skip setting the uniform if it's undefined. This allows the shader mount to still take up space during server rendering\n */\ninterface ShaderMountUniformsReact {\n [key: string]: string | boolean | number | number[] | number[][] | HTMLImageElement | HTMLElement | undefined;\n}\n\nexport interface ShaderMountProps extends Omit<React.ComponentProps<'div'>, 'color' | 'ref'>, ShaderMotionParams {\n ref?: React.Ref<PaperShaderElement>;\n fragmentShader: string;\n uniforms: ShaderMountUniformsReact;\n mipmaps?: string[];\n minPixelRatio?: number;\n maxPixelCount?: number;\n webGlContextAttributes?: WebGLContextAttributes;\n /** Set by shaders that can draw their children into u_image (experimental) */\n acceptsHtmlChildren?: boolean;\n /** Props of the element that holds the children and is drawn with them: layout, padding, background, border */\n layoutProps?: ShaderLayoutProps;\n /** Size the shader to its children on these axes instead of its own width and height styles */\n sizeToContent?: ShaderSizeToContent;\n\n /** Inline CSS width style */\n width?: string | number;\n /** Inline CSS height style */\n height?: string | number;\n}\n\nexport interface ShaderComponentProps extends Omit<React.ComponentProps<'div'>, 'color' | 'ref'> {\n ref?: React.Ref<PaperShaderElement>;\n minPixelRatio?: number;\n maxPixelCount?: number;\n webGlContextAttributes?: WebGLContextAttributes;\n /** Props of the element that holds the children and is drawn with them, for shaders that accept HTML children */\n layoutProps?: ShaderLayoutProps;\n /** Size the shader to its children on these axes, for shaders that accept HTML children */\n sizeToContent?: ShaderSizeToContent;\n\n /** Inline CSS width style */\n width?: string | number;\n /** Inline CSS height style */\n height?: string | number;\n}\n\n/** Parse the provided uniforms, turning URL strings into loaded images */\nasync function processUniforms(uniformsProp: ShaderMountUniformsReact): Promise<ShaderMountUniforms> {\n const processedUniforms = {} as ShaderMountUniforms;\n const imageLoadPromises: Promise<void>[] = [];\n\n const isValidUrl = (url: string): boolean => {\n try {\n // Handle absolute paths\n if (url.startsWith('/')) return true;\n // Check if it's a valid URL\n new URL(url);\n return true;\n } catch {\n return false;\n }\n };\n\n const isExternalUrl = (url: string): boolean => {\n try {\n if (url.startsWith('/')) return false;\n const urlObject = new URL(url, window.location.origin);\n return urlObject.origin !== window.location.origin;\n } catch {\n return false;\n }\n };\n\n Object.entries(uniformsProp).forEach(([key, value]) => {\n if (typeof value === 'string') {\n // Use a transparent pixel for empty strings\n const url = value || emptyPixel;\n\n // Make sure the provided string is a valid URL or just skip trying to set this uniform entirely\n if (!isValidUrl(url)) {\n console.warn(`Uniform \"${key}\" has invalid URL \"${url}\". Skipping image loading.`);\n return;\n }\n\n const imagePromise = new Promise<void>((resolve, reject) => {\n const img = new Image();\n if (isExternalUrl(url)) {\n img.crossOrigin = 'anonymous';\n }\n img.onload = () => {\n setMinImageSize(img);\n processedUniforms[key] = img;\n resolve();\n };\n img.onerror = () => {\n console.error(`Could not set uniforms. Failed to load image at ${url}`);\n reject();\n };\n img.src = url;\n });\n\n imageLoadPromises.push(imagePromise);\n } else if (value instanceof HTMLImageElement) {\n const imagePromise = value.decode().then(() => {\n setMinImageSize(value);\n processedUniforms[key] = value;\n });\n imageLoadPromises.push(imagePromise);\n } else {\n processedUniforms[key] = value;\n }\n });\n\n await Promise.all(imageLoadPromises);\n return processedUniforms;\n}\n\n/**\n * A React component that mounts a shader and updates its uniforms as the component's props change\n * If you pass a string as a uniform value, it will be assumed to be a URL and attempted to be loaded as an image\n */\nexport const ShaderMount: React.FC<ShaderMountProps> = forwardRef<PaperShaderElement, ShaderMountProps>(\n function ShaderMountImpl(\n {\n fragmentShader,\n uniforms: uniformsProp,\n webGlContextAttributes,\n speed = 0,\n frame = 0,\n width,\n height,\n minPixelRatio,\n maxPixelCount,\n mipmaps,\n acceptsHtmlChildren = false,\n layoutProps,\n sizeToContent,\n children,\n style,\n ...divProps\n },\n forwardedRef\n ) {\n const [isInitialized, setIsInitialized] = useState(false);\n const divRef = useRef<PaperShaderElement>(null);\n const shaderMountRef: React.RefObject<ShaderMountVanilla | null> = useRef<ShaderMountVanilla>(null);\n const webGlContextAttributesRef = useRef(webGlContextAttributes);\n const { hasHtmlChildren, addHtmlUniform, renderedChildren, sizeStyle } = useHtmlChildren(\n acceptsHtmlChildren,\n children,\n layoutProps,\n sizeToContent,\n divRef\n );\n\n const getUniforms = (): ShaderMountUniformsReact => addHtmlUniform(uniformsProp);\n\n // Initialize the ShaderMountVanilla\n useEffect(() => {\n let isStale = false;\n\n const initShader = async () => {\n const uniforms = await processUniforms(getUniforms());\n\n if (!isStale && divRef.current && !shaderMountRef.current) {\n shaderMountRef.current = new ShaderMountVanilla(\n divRef.current,\n fragmentShader,\n uniforms,\n webGlContextAttributesRef.current,\n speed,\n frame,\n minPixelRatio,\n maxPixelCount,\n mipmaps\n );\n\n setIsInitialized(true);\n }\n };\n\n initShader();\n\n return () => {\n isStale = true;\n shaderMountRef.current?.dispose();\n shaderMountRef.current = null;\n };\n }, [fragmentShader, hasHtmlChildren]);\n\n // Uniforms\n useEffect(() => {\n let isStale = false;\n\n const updateUniforms = async () => {\n const uniforms = await processUniforms(getUniforms());\n\n if (!isStale) {\n // We only use the freshest uniforms otherwise we can get into race conditions\n // if some uniforms (images!) take longer to load in subsequent effect runs.\n shaderMountRef.current?.setUniforms(uniforms);\n }\n };\n\n updateUniforms();\n\n return () => {\n isStale = true;\n };\n }, [uniformsProp, isInitialized]);\n\n // Speed\n useEffect(() => {\n shaderMountRef.current?.setSpeed(speed);\n }, [speed, isInitialized]);\n\n // Max Pixel Count\n useEffect(() => {\n shaderMountRef.current?.setMaxPixelCount(maxPixelCount);\n }, [maxPixelCount, isInitialized]);\n\n // Min Pixel Ratio\n useEffect(() => {\n shaderMountRef.current?.setMinPixelRatio(minPixelRatio);\n }, [minPixelRatio, isInitialized]);\n\n // Frame\n useEffect(() => {\n shaderMountRef.current?.setFrame(frame);\n }, [frame, isInitialized]);\n\n const mergedRef = useMergeRefs([divRef, forwardedRef]) as unknown as React.RefObject<HTMLDivElement>;\n const shaderStyle =\n width !== undefined || height !== undefined\n ? {\n width: typeof width === 'string' && isNaN(+width) === false ? +width : width,\n height: typeof height === 'string' && isNaN(+height) === false ? +height : height,\n ...style,\n }\n : style;\n return (\n <div ref={mergedRef} style={sizeStyle ? { ...shaderSty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L,IACA;AACN,WACE,oBAAC,SAAI,KAAK,WAAW,OAAO,YAAY,EAAE,GAAG,aAAa,GAAG,UAAU,IAAI,aAAc,GAAG,UACzF,4BACH;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paper-design/shaders-react",
3
- "version": "0.0.0-canary.b448849",
3
+ "version": "0.0.0-canary.b4f628d",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -26,7 +26,7 @@
26
26
  "type-check": "tsc --project tsconfig.json"
27
27
  },
28
28
  "dependencies": {
29
- "@paper-design/shaders": "0.0.0-canary.b448849"
29
+ "@paper-design/shaders": "0.0.0-canary.b4f628d"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "19.1.0"