shaders 2.5.128 → 2.5.130
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.
- package/dist/core/{Blur-5_t3tR_g.js → Blur-1GcG1L1y.js} +1 -1
- package/dist/core/{ChannelBlur-DWgS3nhn.js → ChannelBlur-CxlVaYGM.js} +1 -1
- package/dist/core/Exposure-CFn2J_t3.js +29 -0
- package/dist/core/{Glass-CXT1jdLw.js → Glass-D8DayF1P.js} +1 -1
- package/dist/core/{Glow-5PP4-rM9.js → Glow-chsUpCyj.js} +25 -8
- package/dist/core/{ProgressiveBlur-BJwJ5mE0.js → ProgressiveBlur-By_PgPtK.js} +1 -1
- package/dist/core/{ReflectivePlane-UIT4xlmn.js → ReflectivePlane-VjZ1E5B0.js} +1 -1
- package/dist/core/ThinFilm-CUsi8eSg.js +305 -0
- package/dist/core/{TiltShift-DtQ3dRL-.js → TiltShift-vG90NlLr.js} +1 -1
- package/dist/core/{VideoTexture-ClutlOqj.js → VideoTexture-FmV1l91c.js} +1 -1
- package/dist/core/{WebcamTexture-D4e06ajM.js → WebcamTexture-DlS4MCDm.js} +1 -1
- package/dist/core/blendModes/linearDodge.d.ts.map +1 -1
- package/dist/core/{computeBlur-CprKe0xa.js → computeBlur-oxyhoztH.js} +14 -7
- package/dist/core/effects/thinFilm.d.ts +81 -0
- package/dist/core/effects/thinFilm.d.ts.map +1 -0
- package/dist/core/index.js +90 -88
- package/dist/core/registry.js +89 -87
- package/dist/core/shaderRegistry-BVFBmRN3.js +276 -0
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/Blur/index.js +2 -2
- package/dist/core/shaders/ChannelBlur/index.js +2 -2
- package/dist/core/shaders/Exposure/index.d.ts +13 -0
- package/dist/core/shaders/Exposure/index.d.ts.map +1 -0
- package/dist/core/shaders/Exposure/index.js +2 -0
- package/dist/core/shaders/FallingLines/index.js +1 -1
- package/dist/core/shaders/FilmGrain/index.js +1 -1
- package/dist/core/shaders/FloatingParticles/index.js +1 -1
- package/dist/core/shaders/FlowField/index.js +1 -1
- package/dist/core/shaders/Flower/index.js +1 -1
- package/dist/core/shaders/FlowingGradient/index.js +1 -1
- package/dist/core/shaders/FlutedGlass/index.js +1 -1
- package/dist/core/shaders/Fog/index.js +1 -1
- package/dist/core/shaders/Form3D/index.js +1 -1
- package/dist/core/shaders/FractalNoise/index.js +1 -1
- package/dist/core/shaders/Glass/index.js +2 -2
- package/dist/core/shaders/GlassTiles/index.js +1 -1
- package/dist/core/shaders/Glitch/index.js +1 -1
- package/dist/core/shaders/Glow/index.d.ts.map +1 -1
- package/dist/core/shaders/Glow/index.js +2 -2
- package/dist/core/shaders/Godrays/index.js +1 -1
- package/dist/core/shaders/Grayscale/index.js +1 -1
- package/dist/core/shaders/Grid/index.js +1 -1
- package/dist/core/shaders/GridDistortion/index.js +1 -1
- package/dist/core/shaders/Group/index.js +1 -1
- package/dist/core/shaders/Halftone/index.js +1 -1
- package/dist/core/shaders/HexGrid/index.js +1 -1
- package/dist/core/shaders/HueShift/index.js +1 -1
- package/dist/core/shaders/ImageTexture/index.js +1 -1
- package/dist/core/shaders/Invert/index.js +1 -1
- package/dist/core/shaders/Kaleidoscope/index.js +1 -1
- package/dist/core/shaders/LensFlare/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.js +1 -1
- package/dist/core/shaders/LinearGradient/index.js +1 -1
- package/dist/core/shaders/Liquify/index.js +1 -1
- package/dist/core/shaders/Marble/index.js +1 -1
- package/dist/core/shaders/Mirror/index.js +1 -1
- package/dist/core/shaders/MultiPointGradient/index.js +1 -1
- package/dist/core/shaders/Neon/index.js +1 -1
- package/dist/core/shaders/Paper/index.js +1 -1
- package/dist/core/shaders/Perspective/index.js +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/Plasma/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +1 -1
- package/dist/core/shaders/Polygon/index.js +1 -1
- package/dist/core/shaders/Posterize/index.js +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +2 -2
- package/dist/core/shaders/RadialGradient/index.js +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
- package/dist/core/shaders/ReflectivePlane/index.js +2 -2
- package/dist/core/shaders/Ring/index.js +1 -1
- package/dist/core/shaders/Ripples/index.js +1 -1
- package/dist/core/shaders/RoundedRect/index.js +1 -1
- package/dist/core/shaders/Saturation/index.js +1 -1
- package/dist/core/shaders/Sharpness/index.js +1 -1
- package/dist/core/shaders/Shatter/index.js +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +1 -1
- package/dist/core/shaders/SineWave/index.js +1 -1
- package/dist/core/shaders/Smoke/index.js +1 -1
- package/dist/core/shaders/SmokeFill/index.js +1 -1
- package/dist/core/shaders/Solarize/index.js +1 -1
- package/dist/core/shaders/SolidColor/index.js +1 -1
- package/dist/core/shaders/Spherize/index.js +1 -1
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Star/index.js +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Stripes/index.js +1 -1
- package/dist/core/shaders/StudioBackground/index.js +1 -1
- package/dist/core/shaders/SunBurst/index.js +1 -1
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/ThinFilm/index.d.ts +130 -0
- package/dist/core/shaders/ThinFilm/index.d.ts.map +1 -0
- package/dist/core/shaders/ThinFilm/index.js +6 -0
- package/dist/core/shaders/TiltShift/index.js +2 -2
- package/dist/core/shaders/Tint/index.js +1 -1
- package/dist/core/shaders/Trapezoid/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Truchet/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/VHS/index.js +1 -1
- package/dist/core/shaders/Vesica/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/VideoTexture/index.js +2 -2
- package/dist/core/shaders/Vignette/index.js +1 -1
- package/dist/core/shaders/Voronoi/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/Weave/index.js +1 -1
- package/dist/core/shaders/WebcamTexture/index.js +2 -2
- package/dist/core/shaders/WorleyNoise/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/core/utilities/computeBlur.d.ts +3 -1
- package/dist/core/utilities/computeBlur.d.ts.map +1 -1
- package/dist/js/bundle.js +199 -199
- package/dist/js/createShader.js +1 -1
- package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.js +31 -0
- package/dist/react/Exposure.js +217 -0
- package/dist/react/Preview.js +2 -0
- package/dist/react/Shader.js +1 -1
- package/dist/react/ThinFilm.js +217 -0
- package/dist/react/bundle.js +214 -214
- package/dist/react/components/Exposure.d.ts +33 -0
- package/dist/react/components/Exposure.d.ts.map +1 -0
- package/dist/react/components/ThinFilm.d.ts +41 -0
- package/dist/react/components/ThinFilm.d.ts.map +1 -0
- package/dist/react/engine/Preview.d.ts.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +31 -0
- package/dist/registry.js +590 -0
- package/dist/solid/components/Exposure.d.ts +30 -0
- package/dist/solid/components/Exposure.d.ts.map +1 -0
- package/dist/solid/components/Exposure.js +228 -0
- package/dist/solid/components/ThinFilm.d.ts +38 -0
- package/dist/solid/components/ThinFilm.d.ts.map +1 -0
- package/dist/solid/components/ThinFilm.js +228 -0
- package/dist/solid/engine/Preview.d.ts.map +1 -1
- package/dist/solid/engine/Preview.js +204 -200
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/solid/index.d.ts +2 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +172 -168
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +31 -0
- package/dist/svelte/components/Exposure.svelte.d.ts +20 -0
- package/dist/svelte/components/ThinFilm.svelte.d.ts +28 -0
- package/dist/svelte/index.d.ts +2 -0
- package/dist/svelte/index.js +1033 -633
- package/dist/svelte/source/components/Exposure.svelte +326 -0
- package/dist/svelte/source/components/ThinFilm.svelte +334 -0
- package/dist/svelte/source/engine/Preview.svelte +4 -0
- package/dist/svelte/source/index.js +2 -0
- package/dist/svelte/utils/generatePresetCode.js +31 -0
- package/dist/vue/Exposure.js +3 -0
- package/dist/vue/Exposure.vue_vue_type_script_setup_true_lang.js +213 -0
- package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/vue/ThinFilm.js +3 -0
- package/dist/vue/ThinFilm.vue_vue_type_script_setup_true_lang.js +231 -0
- package/dist/vue/components/Exposure.vue.d.ts +55 -0
- package/dist/vue/components/Exposure.vue.d.ts.map +1 -0
- package/dist/vue/components/ThinFilm.vue.d.ts +63 -0
- package/dist/vue/components/ThinFilm.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -1
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +31 -0
- package/package.json +17 -1
- package/dist/core/shaderRegistry-Brvv9sO8.js +0 -272
- /package/dist/core/{FallingLines-DqIZ8wTH.js → FallingLines-9elMmSlj.js} +0 -0
- /package/dist/core/{FilmGrain-DdV7_b8g.js → FilmGrain-DIydVgOW.js} +0 -0
- /package/dist/core/{FloatingParticles-LMsFTJKp.js → FloatingParticles-B068TLIi.js} +0 -0
- /package/dist/core/{FlowField-D3CAHBBG.js → FlowField-CeZjhyEo.js} +0 -0
- /package/dist/core/{Flower-BbRNrXIa.js → Flower-DSr0JWa2.js} +0 -0
- /package/dist/core/{FlowingGradient-BRQ_K-k3.js → FlowingGradient-Bd8KBK5P.js} +0 -0
- /package/dist/core/{FlutedGlass-CyFWN_SM.js → FlutedGlass-BJtMfV2c.js} +0 -0
- /package/dist/core/{Fog-CLGVVVeo.js → Fog-BQuVDReH.js} +0 -0
- /package/dist/core/{Form3D-8tPyUgh4.js → Form3D-DOek31CJ.js} +0 -0
- /package/dist/core/{FractalNoise-Ccufnbw6.js → FractalNoise-Dyhbvx9a.js} +0 -0
- /package/dist/core/{GlassTiles-CXJHjEBe.js → GlassTiles-Bb3cuOkr.js} +0 -0
- /package/dist/core/{Glitch-Bg9W-KNm.js → Glitch-zqdbCc2E.js} +0 -0
- /package/dist/core/{Godrays-DHXKsw5B.js → Godrays-DdSLZtBs.js} +0 -0
- /package/dist/core/{Grayscale-DgXoUcmg.js → Grayscale-BC40hfXH.js} +0 -0
- /package/dist/core/{Grid-DwyhjFAT.js → Grid-Lc4S0Hmp.js} +0 -0
- /package/dist/core/{GridDistortion-DJ8S-96Y.js → GridDistortion-DQcPYbXS.js} +0 -0
- /package/dist/core/{Group-DmgNNlDd.js → Group-BeZhHbOT.js} +0 -0
- /package/dist/core/{Halftone-x9boWkFW.js → Halftone-CsblgxnY.js} +0 -0
- /package/dist/core/{HexGrid-BUsgyF8P.js → HexGrid-DWRNPMET.js} +0 -0
- /package/dist/core/{HueShift-D3_5D7jx.js → HueShift-C-p9W5sr.js} +0 -0
- /package/dist/core/{ImageTexture-6ZzBt79u.js → ImageTexture-bqgQxAt9.js} +0 -0
- /package/dist/core/{Invert-kXxY97QJ.js → Invert-D-RVP34v.js} +0 -0
- /package/dist/core/{Kaleidoscope-D4jRcZCt.js → Kaleidoscope-HQNQrRP_.js} +0 -0
- /package/dist/core/{LensFlare-D7vypE2Q.js → LensFlare-DtES749p.js} +0 -0
- /package/dist/core/{LinearBlur-2hspd2YP.js → LinearBlur-6mCJ9fY5.js} +0 -0
- /package/dist/core/{LinearGradient-glCc9IaB.js → LinearGradient-DIbCAHc7.js} +0 -0
- /package/dist/core/{Liquify-uZjs0wcu.js → Liquify-8dcdv2Sl.js} +0 -0
- /package/dist/core/{Marble-DkHLcqFD.js → Marble-DX29RG-p.js} +0 -0
- /package/dist/core/{Mirror-Dv5fOEp6.js → Mirror-BM2xf3Nr.js} +0 -0
- /package/dist/core/{MultiPointGradient-Dvt1GUiv.js → MultiPointGradient-BzM24vnR.js} +0 -0
- /package/dist/core/{Neon-DQDB7hAE.js → Neon-nPiMi3wt.js} +0 -0
- /package/dist/core/{Paper-DNP2-hPM.js → Paper-Ddpe8-EI.js} +0 -0
- /package/dist/core/{Perspective-CAIchX9p.js → Perspective-BIKpqd4H.js} +0 -0
- /package/dist/core/{Pixelate-BbT3Rrf2.js → Pixelate-Cp0-lwkG.js} +0 -0
- /package/dist/core/{Plasma-D9rhkH2y.js → Plasma-M--gLd1Q.js} +0 -0
- /package/dist/core/{PolarCoordinates-2RBCk-fo.js → PolarCoordinates-C42rlD2q.js} +0 -0
- /package/dist/core/{Polygon-C6_siOs0.js → Polygon-CKqH0ApY.js} +0 -0
- /package/dist/core/{Posterize-DNxTRgvF.js → Posterize-B6ZhRkH2.js} +0 -0
- /package/dist/core/{RadialGradient-CQIctl__.js → RadialGradient-SHxJ9ZNF.js} +0 -0
- /package/dist/core/{RectangularCoordinates-F2VzXmal.js → RectangularCoordinates-Dw6Xr9uV.js} +0 -0
- /package/dist/core/{Ring-UT__kmzY.js → Ring-V4sEHwwm.js} +0 -0
- /package/dist/core/{Ripples-CWVLSUP0.js → Ripples-DC1y3YuP.js} +0 -0
- /package/dist/core/{RoundedRect-BPWHTT1j.js → RoundedRect-JY2z6YEH.js} +0 -0
- /package/dist/core/{Saturation-DFOp2yD9.js → Saturation-ChJ9IWnl.js} +0 -0
- /package/dist/core/{Sharpness-PIWR4gYc.js → Sharpness-C1ufX8S-.js} +0 -0
- /package/dist/core/{Shatter-CUYQp-qy.js → Shatter-Du5THcwZ.js} +0 -0
- /package/dist/core/{SimplexNoise-LAxWw8fJ.js → SimplexNoise--vwIZVu0.js} +0 -0
- /package/dist/core/{SineWave-CEQWxC9Q.js → SineWave-BIVPG3oc.js} +0 -0
- /package/dist/core/{Smoke-DO4yylWk.js → Smoke-DSBQreo0.js} +0 -0
- /package/dist/core/{SmokeFill-Dm0sZS5F.js → SmokeFill-Dy-0kjsX.js} +0 -0
- /package/dist/core/{Solarize-mE7LU1li.js → Solarize-BymZlSu0.js} +0 -0
- /package/dist/core/{SolidColor-BljkSdvg.js → SolidColor-D8XC4aoJ.js} +0 -0
- /package/dist/core/{Spherize-DARagREe.js → Spherize-tRTB4WdO.js} +0 -0
- /package/dist/core/{Spiral-CumsIpkp.js → Spiral-CiDp2Tg2.js} +0 -0
- /package/dist/core/{Star-8fAlzR9L.js → Star-Cp4dt6Fl.js} +0 -0
- /package/dist/core/{Strands-BB4RIsFz.js → Strands-V3q8N-y1.js} +0 -0
- /package/dist/core/{Stretch-3S2atBkJ.js → Stretch-CTgtc3nG.js} +0 -0
- /package/dist/core/{Stripes-BGFVSZIt.js → Stripes-CZV6oGMy.js} +0 -0
- /package/dist/core/{StudioBackground-BtJ6b1Ki.js → StudioBackground-CWSHq6vE.js} +0 -0
- /package/dist/core/{SunBurst-BJRFFYhs.js → SunBurst-CskZwXc3.js} +0 -0
- /package/dist/core/{Swirl-fkUEZ2TQ.js → Swirl-CyGfVZ8n.js} +0 -0
- /package/dist/core/{Tint-W_EvzN1-.js → Tint-R7y5CJ4U.js} +0 -0
- /package/dist/core/{Trapezoid-cQzS6-bh.js → Trapezoid-BXzH--z9.js} +0 -0
- /package/dist/core/{Tritone-B3hI2nAi.js → Tritone-CF4Oj1sl.js} +0 -0
- /package/dist/core/{Truchet-s9PmowCP.js → Truchet-BL4jzZDX.js} +0 -0
- /package/dist/core/{Twirl-UDDXGkFl.js → Twirl-BVLPHKJD.js} +0 -0
- /package/dist/core/{VHS-DW1H7Wuy.js → VHS-B2IBdQgX.js} +0 -0
- /package/dist/core/{Vesica-ChQBYWuw.js → Vesica-DzIEa3aJ.js} +0 -0
- /package/dist/core/{Vibrance-DUj7hwzE.js → Vibrance-jrvT49Du.js} +0 -0
- /package/dist/core/{Vignette-F9yxi-UM.js → Vignette-ng_5gjXc.js} +0 -0
- /package/dist/core/{Voronoi-D8HHP_WR.js → Voronoi-C8iIU7AT.js} +0 -0
- /package/dist/core/{WaveDistortion-MbB-Kgjz.js → WaveDistortion-Crt9JSXN.js} +0 -0
- /package/dist/core/{Weave-ou5shgl3.js → Weave-CFmLkEaq.js} +0 -0
- /package/dist/core/{WorleyNoise-Uf6IPm7A.js → WorleyNoise-CEZiaVAN.js} +0 -0
- /package/dist/core/{ZoomBlur-DJ-RNKHM.js → ZoomBlur-DTVSwIvc.js} +0 -0
- /package/dist/core/{browser-NUM-x2tw.js → browser-CDogs09U.js} +0 -0
package/dist/js/createShader.js
CHANGED
|
@@ -149,7 +149,7 @@ async function createShader(canvas, preset, options) {
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
if (renderer.getPerformanceStats().fps > 0) {
|
|
152
|
-
state.telemetryCollector = startTelemetry(renderer, "2.5.
|
|
152
|
+
state.telemetryCollector = startTelemetry(renderer, "2.5.130", options?.disableTelemetry || false, false);
|
|
153
153
|
if (state.telemetryCollector) state.telemetryCollector.start();
|
|
154
154
|
state.telemetryStartTimeout = null;
|
|
155
155
|
} else state.telemetryStartTimeout = setTimeout(checkRendering, 500);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;
|
|
1
|
+
{"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAonDD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAuBpM;AAGD,eAAO,MAAM,mBAAmB,UAyH/B,CAAA"}
|
|
@@ -440,6 +440,11 @@ var shaderMetadata = {
|
|
|
440
440
|
"shadowIntensity": .3,
|
|
441
441
|
"shape": "{\"type\":\"circleSDF\",\"radius\":0.35}"
|
|
442
442
|
},
|
|
443
|
+
"Exposure": {
|
|
444
|
+
"opacity": 1,
|
|
445
|
+
"blendMode": "normal",
|
|
446
|
+
"exposure": 1
|
|
447
|
+
},
|
|
443
448
|
"FallingLines": {
|
|
444
449
|
"opacity": 1,
|
|
445
450
|
"blendMode": "normal",
|
|
@@ -1288,6 +1293,30 @@ var shaderMetadata = {
|
|
|
1288
1293
|
"blend": 50,
|
|
1289
1294
|
"colorSpace": "linear"
|
|
1290
1295
|
},
|
|
1296
|
+
"ThinFilm": {
|
|
1297
|
+
"opacity": 1,
|
|
1298
|
+
"blendMode": "normal",
|
|
1299
|
+
"center": {
|
|
1300
|
+
"x": .5,
|
|
1301
|
+
"y": .5
|
|
1302
|
+
},
|
|
1303
|
+
"scale": 1,
|
|
1304
|
+
"intensity": 1,
|
|
1305
|
+
"rimWidth": 1,
|
|
1306
|
+
"edgeSoftness": .3,
|
|
1307
|
+
"thickness": .5,
|
|
1308
|
+
"dispersion": .5,
|
|
1309
|
+
"saturation": 1,
|
|
1310
|
+
"hueShift": 0,
|
|
1311
|
+
"lightAngle": 300,
|
|
1312
|
+
"mode": "rainbow",
|
|
1313
|
+
"colorA": "#2b6fff",
|
|
1314
|
+
"colorB": "#ffffff",
|
|
1315
|
+
"colorC": "#ff7a21",
|
|
1316
|
+
"colorSpace": "oklch",
|
|
1317
|
+
"speed": .1,
|
|
1318
|
+
"shape": "{\"type\":\"circleSDF\",\"radius\":0.35}"
|
|
1319
|
+
},
|
|
1291
1320
|
"TiltShift": {
|
|
1292
1321
|
"opacity": 1,
|
|
1293
1322
|
"blendMode": "normal",
|
|
@@ -1586,6 +1615,7 @@ const availableComponents = [
|
|
|
1586
1615
|
"Duotone",
|
|
1587
1616
|
"Ellipse",
|
|
1588
1617
|
"Emboss",
|
|
1618
|
+
"Exposure",
|
|
1589
1619
|
"FallingLines",
|
|
1590
1620
|
"FilmGrain",
|
|
1591
1621
|
"FloatingParticles",
|
|
@@ -1651,6 +1681,7 @@ const availableComponents = [
|
|
|
1651
1681
|
"StudioBackground",
|
|
1652
1682
|
"SunBurst",
|
|
1653
1683
|
"Swirl",
|
|
1684
|
+
"ThinFilm",
|
|
1654
1685
|
"TiltShift",
|
|
1655
1686
|
"Tint",
|
|
1656
1687
|
"Trapezoid",
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { ShaderContext } from "./Shader.js";
|
|
2
|
+
import { useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { createUniformsMap } from "../core/index.js";
|
|
5
|
+
import { setColorSpaceMode } from "../core/utilities/transformations/index.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { componentDefinition } from "../core/shaders/Exposure/index.js";
|
|
8
|
+
function isPropDriver(value) {
|
|
9
|
+
return typeof value === "object" && value !== null && "type" in value && (value.type === "map" || value.type === "mouse" || value.type === "mouse-position" || value.type === "auto-animate");
|
|
10
|
+
}
|
|
11
|
+
function computeEffectiveProps(props, defaultProps$1) {
|
|
12
|
+
let baseProps = { ...defaultProps$1 };
|
|
13
|
+
for (const [key, value] of Object.entries(props)) if (key !== "children" && key !== "ref" && value !== void 0 && !isPropDriver(value)) baseProps[key] = value;
|
|
14
|
+
return baseProps;
|
|
15
|
+
}
|
|
16
|
+
var MARKER_STYLE = { display: "contents" };
|
|
17
|
+
var DEFAULT_TRANSFORM = {
|
|
18
|
+
offsetX: 0,
|
|
19
|
+
offsetY: 0,
|
|
20
|
+
rotation: 0,
|
|
21
|
+
scale: 1,
|
|
22
|
+
anchorX: .5,
|
|
23
|
+
anchorY: .5,
|
|
24
|
+
edges: "transparent"
|
|
25
|
+
};
|
|
26
|
+
var defaultProps = {
|
|
27
|
+
blendMode: "normal",
|
|
28
|
+
visible: true
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
if (componentDefinition && componentDefinition.props) Object.entries(componentDefinition.props).forEach(([key, config]) => {
|
|
32
|
+
const propConfig = config;
|
|
33
|
+
if (propConfig && typeof propConfig === "object" && "default" in propConfig) defaultProps[key] = propConfig.default;
|
|
34
|
+
});
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.warn("Error extracting default props:", e);
|
|
37
|
+
}
|
|
38
|
+
const ShaderComponent = (props) => {
|
|
39
|
+
const context = useContext(ShaderContext);
|
|
40
|
+
if (!context) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
41
|
+
const { shaderParentId: parentId, shaderNodeRegister: parentRegister, shaderUniformUpdate: parentUniformUpdate, shaderMetadataUpdate: parentMetadataUpdate, shaderColorSpace } = context;
|
|
42
|
+
const reactId = useId();
|
|
43
|
+
const instanceId = useMemo(() => {
|
|
44
|
+
return (props.id ? props.id.replace(/[^a-zA-Z0-9_]/g, "_") : null) || reactId.replace(/[^a-zA-Z0-9_]/g, "");
|
|
45
|
+
}, [props.id, reactId]);
|
|
46
|
+
const effectiveProps = useMemo(() => {
|
|
47
|
+
return computeEffectiveProps(props, defaultProps);
|
|
48
|
+
}, [props]);
|
|
49
|
+
const effectiveTransform = useMemo(() => ({
|
|
50
|
+
...DEFAULT_TRANSFORM,
|
|
51
|
+
...props.transform
|
|
52
|
+
}), [props.transform]);
|
|
53
|
+
const markerRef = useRef(null);
|
|
54
|
+
const isCapturesDOM = !!componentDefinition.capturesDOM;
|
|
55
|
+
const captureCanvasRef = useRef(null);
|
|
56
|
+
const [domMounted, setDomMounted] = useState(false);
|
|
57
|
+
const [captureSize, setCaptureSize] = useState(() => ({
|
|
58
|
+
w: typeof window !== "undefined" ? Math.round(window.innerWidth * Math.min(window.devicePixelRatio, 2)) : 0,
|
|
59
|
+
h: typeof window !== "undefined" ? Math.round(window.innerHeight * Math.min(window.devicePixelRatio, 2)) : 0
|
|
60
|
+
}));
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!isCapturesDOM) return;
|
|
63
|
+
setDomMounted(true);
|
|
64
|
+
const onResize = () => {
|
|
65
|
+
const d = Math.min(window.devicePixelRatio, 2);
|
|
66
|
+
setCaptureSize({
|
|
67
|
+
w: Math.round(window.innerWidth * d),
|
|
68
|
+
h: Math.round(window.innerHeight * d)
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
window.addEventListener("resize", onResize);
|
|
72
|
+
return () => window.removeEventListener("resize", onResize);
|
|
73
|
+
}, [isCapturesDOM]);
|
|
74
|
+
const detectedOrderRef = useRef(void 0);
|
|
75
|
+
const uniformsRef = useRef(null);
|
|
76
|
+
if (uniformsRef.current === null) {
|
|
77
|
+
setColorSpaceMode(shaderColorSpace);
|
|
78
|
+
uniformsRef.current = createUniformsMap(componentDefinition, effectiveProps, instanceId);
|
|
79
|
+
}
|
|
80
|
+
const childContextValue = useMemo(() => {
|
|
81
|
+
return {
|
|
82
|
+
...context,
|
|
83
|
+
shaderParentId: instanceId
|
|
84
|
+
};
|
|
85
|
+
}, [context, instanceId]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!uniformsRef.current) return;
|
|
88
|
+
try {
|
|
89
|
+
const metadata = {
|
|
90
|
+
blendMode: props.blendMode || "normal",
|
|
91
|
+
opacity: props.opacity,
|
|
92
|
+
visible: props.visible === false ? false : true,
|
|
93
|
+
id: props.id,
|
|
94
|
+
mask: props.maskSource ? {
|
|
95
|
+
source: props.maskSource,
|
|
96
|
+
type: props.maskType || "alpha"
|
|
97
|
+
} : void 0,
|
|
98
|
+
maps: mapsFromProps,
|
|
99
|
+
renderOrder: props.renderOrder ?? detectedOrderRef.current,
|
|
100
|
+
transform: effectiveTransform
|
|
101
|
+
};
|
|
102
|
+
parentRegister(instanceId, componentDefinition.fragmentNode, parentId, metadata, uniformsRef.current, componentDefinition, isCapturesDOM ? captureCanvasRef.current ?? void 0 : void 0);
|
|
103
|
+
return () => {
|
|
104
|
+
parentRegister(instanceId, null, null, null, null);
|
|
105
|
+
};
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("Error registering shader node:", error);
|
|
108
|
+
return () => {};
|
|
109
|
+
}
|
|
110
|
+
}, [
|
|
111
|
+
instanceId,
|
|
112
|
+
parentId,
|
|
113
|
+
parentRegister,
|
|
114
|
+
domMounted
|
|
115
|
+
]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (props.renderOrder === void 0 && markerRef.current) {
|
|
118
|
+
const parent = markerRef.current.parentElement;
|
|
119
|
+
if (parent) {
|
|
120
|
+
const siblings = parent.querySelectorAll(":scope > [data-shader-id]");
|
|
121
|
+
const position = Array.from(siblings).indexOf(markerRef.current);
|
|
122
|
+
if (position >= 0) {
|
|
123
|
+
detectedOrderRef.current = position;
|
|
124
|
+
parentMetadataUpdate(instanceId, { renderOrder: position });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, []);
|
|
129
|
+
const prevPropsRef = useRef({});
|
|
130
|
+
const mapsFromProps = useMemo(() => {
|
|
131
|
+
const maps = {};
|
|
132
|
+
for (const [key, value] of Object.entries(props)) if (key !== "children" && key !== "ref" && isPropDriver(value)) maps[key] = value;
|
|
133
|
+
return Object.keys(maps).length > 0 ? maps : void 0;
|
|
134
|
+
}, [props]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (!uniformsRef.current) return;
|
|
137
|
+
try {
|
|
138
|
+
Object.entries(uniformsRef.current).forEach(([propName, uniformData]) => {
|
|
139
|
+
if (!uniformData || typeof uniformData !== "object") return;
|
|
140
|
+
const { uniform } = uniformData;
|
|
141
|
+
if (uniform?.value !== void 0 && propName in effectiveProps) {
|
|
142
|
+
const newValue = effectiveProps[propName];
|
|
143
|
+
if (isPropDriver(newValue)) return;
|
|
144
|
+
if (newValue !== prevPropsRef.current[propName]) {
|
|
145
|
+
parentUniformUpdate(instanceId, propName, newValue);
|
|
146
|
+
prevPropsRef.current[propName] = newValue;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.error("Error updating uniforms:", error);
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
effectiveProps,
|
|
155
|
+
instanceId,
|
|
156
|
+
parentUniformUpdate
|
|
157
|
+
]);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
try {
|
|
160
|
+
parentMetadataUpdate(instanceId, {
|
|
161
|
+
blendMode: props.blendMode || "normal",
|
|
162
|
+
opacity: props.opacity,
|
|
163
|
+
visible: props.visible === false ? false : true,
|
|
164
|
+
id: props.id,
|
|
165
|
+
mask: props.maskSource ? {
|
|
166
|
+
source: props.maskSource,
|
|
167
|
+
type: props.maskType || "alpha"
|
|
168
|
+
} : void 0,
|
|
169
|
+
maps: mapsFromProps,
|
|
170
|
+
renderOrder: props.renderOrder ?? detectedOrderRef.current,
|
|
171
|
+
transform: effectiveTransform
|
|
172
|
+
});
|
|
173
|
+
} catch (error) {
|
|
174
|
+
console.error("Error updating metadata:", error);
|
|
175
|
+
}
|
|
176
|
+
}, [
|
|
177
|
+
props.blendMode,
|
|
178
|
+
props.opacity,
|
|
179
|
+
props.visible,
|
|
180
|
+
props.maskSource,
|
|
181
|
+
props.maskType,
|
|
182
|
+
props.renderOrder,
|
|
183
|
+
props.id,
|
|
184
|
+
mapsFromProps,
|
|
185
|
+
effectiveTransform,
|
|
186
|
+
instanceId,
|
|
187
|
+
parentMetadataUpdate
|
|
188
|
+
]);
|
|
189
|
+
if (props.ref && typeof props.ref === "function") try {
|
|
190
|
+
props.ref(null);
|
|
191
|
+
} catch (e) {}
|
|
192
|
+
const captureCanvas = isCapturesDOM && domMounted ? createPortal(/* @__PURE__ */ jsx("canvas", {
|
|
193
|
+
ref: captureCanvasRef,
|
|
194
|
+
"layoutsubtree": "",
|
|
195
|
+
width: captureSize.w,
|
|
196
|
+
height: captureSize.h,
|
|
197
|
+
style: {
|
|
198
|
+
position: "fixed",
|
|
199
|
+
inset: 0,
|
|
200
|
+
width: "100vw",
|
|
201
|
+
height: "100vh",
|
|
202
|
+
zIndex: -9999
|
|
203
|
+
},
|
|
204
|
+
children: props.children
|
|
205
|
+
}), document.body) : null;
|
|
206
|
+
return /* @__PURE__ */ jsxs(ShaderContext.Provider, {
|
|
207
|
+
value: childContextValue,
|
|
208
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
209
|
+
ref: markerRef,
|
|
210
|
+
style: MARKER_STYLE,
|
|
211
|
+
"data-shader-id": instanceId,
|
|
212
|
+
children: !isCapturesDOM && props.children
|
|
213
|
+
}), captureCanvas]
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
var Exposure_default = ShaderComponent;
|
|
217
|
+
export { ShaderComponent, Exposure_default as default };
|
package/dist/react/Preview.js
CHANGED
|
@@ -143,6 +143,7 @@ var componentMap = {
|
|
|
143
143
|
Duotone: lazy(() => import("./Duotone.js")),
|
|
144
144
|
Ellipse: lazy(() => import("./Ellipse.js")),
|
|
145
145
|
Emboss: lazy(() => import("./Emboss.js")),
|
|
146
|
+
Exposure: lazy(() => import("./Exposure.js")),
|
|
146
147
|
FallingLines: lazy(() => import("./FallingLines.js")),
|
|
147
148
|
FilmGrain: lazy(() => import("./FilmGrain.js")),
|
|
148
149
|
FloatingParticles: lazy(() => import("./FloatingParticles.js")),
|
|
@@ -208,6 +209,7 @@ var componentMap = {
|
|
|
208
209
|
StudioBackground: lazy(() => import("./StudioBackground.js")),
|
|
209
210
|
SunBurst: lazy(() => import("./SunBurst.js")),
|
|
210
211
|
Swirl: lazy(() => import("./Swirl.js")),
|
|
212
|
+
ThinFilm: lazy(() => import("./ThinFilm.js")),
|
|
211
213
|
TiltShift: lazy(() => import("./TiltShift.js")),
|
|
212
214
|
Tint: lazy(() => import("./Tint.js")),
|
|
213
215
|
Trapezoid: lazy(() => import("./Trapezoid.js")),
|
package/dist/react/Shader.js
CHANGED
|
@@ -89,7 +89,7 @@ const Shader = ({ children, disableTelemetry = false, colorSpace = "p3-linear",
|
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
if (rendererRef.current.getPerformanceStats().fps > 0) {
|
|
92
|
-
telemetryCollectorRef.current = startTelemetry(rendererRef.current, "2.5.
|
|
92
|
+
telemetryCollectorRef.current = startTelemetry(rendererRef.current, "2.5.130", disableTelemetry, isPreview);
|
|
93
93
|
if (telemetryCollectorRef.current) telemetryCollectorRef.current.start();
|
|
94
94
|
telemetryStartTimeoutRef.current = null;
|
|
95
95
|
} else telemetryStartTimeoutRef.current = window.setTimeout(checkRendering, 500);
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { ShaderContext } from "./Shader.js";
|
|
2
|
+
import { useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { createUniformsMap } from "../core/index.js";
|
|
5
|
+
import { setColorSpaceMode } from "../core/utilities/transformations/index.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { componentDefinition } from "../core/shaders/ThinFilm/index.js";
|
|
8
|
+
function isPropDriver(value) {
|
|
9
|
+
return typeof value === "object" && value !== null && "type" in value && (value.type === "map" || value.type === "mouse" || value.type === "mouse-position" || value.type === "auto-animate");
|
|
10
|
+
}
|
|
11
|
+
function computeEffectiveProps(props, defaultProps$1) {
|
|
12
|
+
let baseProps = { ...defaultProps$1 };
|
|
13
|
+
for (const [key, value] of Object.entries(props)) if (key !== "children" && key !== "ref" && value !== void 0 && !isPropDriver(value)) baseProps[key] = value;
|
|
14
|
+
return baseProps;
|
|
15
|
+
}
|
|
16
|
+
var MARKER_STYLE = { display: "contents" };
|
|
17
|
+
var DEFAULT_TRANSFORM = {
|
|
18
|
+
offsetX: 0,
|
|
19
|
+
offsetY: 0,
|
|
20
|
+
rotation: 0,
|
|
21
|
+
scale: 1,
|
|
22
|
+
anchorX: .5,
|
|
23
|
+
anchorY: .5,
|
|
24
|
+
edges: "transparent"
|
|
25
|
+
};
|
|
26
|
+
var defaultProps = {
|
|
27
|
+
blendMode: "normal",
|
|
28
|
+
visible: true
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
if (componentDefinition && componentDefinition.props) Object.entries(componentDefinition.props).forEach(([key, config]) => {
|
|
32
|
+
const propConfig = config;
|
|
33
|
+
if (propConfig && typeof propConfig === "object" && "default" in propConfig) defaultProps[key] = propConfig.default;
|
|
34
|
+
});
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.warn("Error extracting default props:", e);
|
|
37
|
+
}
|
|
38
|
+
const ShaderComponent = (props) => {
|
|
39
|
+
const context = useContext(ShaderContext);
|
|
40
|
+
if (!context) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
41
|
+
const { shaderParentId: parentId, shaderNodeRegister: parentRegister, shaderUniformUpdate: parentUniformUpdate, shaderMetadataUpdate: parentMetadataUpdate, shaderColorSpace } = context;
|
|
42
|
+
const reactId = useId();
|
|
43
|
+
const instanceId = useMemo(() => {
|
|
44
|
+
return (props.id ? props.id.replace(/[^a-zA-Z0-9_]/g, "_") : null) || reactId.replace(/[^a-zA-Z0-9_]/g, "");
|
|
45
|
+
}, [props.id, reactId]);
|
|
46
|
+
const effectiveProps = useMemo(() => {
|
|
47
|
+
return computeEffectiveProps(props, defaultProps);
|
|
48
|
+
}, [props]);
|
|
49
|
+
const effectiveTransform = useMemo(() => ({
|
|
50
|
+
...DEFAULT_TRANSFORM,
|
|
51
|
+
...props.transform
|
|
52
|
+
}), [props.transform]);
|
|
53
|
+
const markerRef = useRef(null);
|
|
54
|
+
const isCapturesDOM = !!componentDefinition.capturesDOM;
|
|
55
|
+
const captureCanvasRef = useRef(null);
|
|
56
|
+
const [domMounted, setDomMounted] = useState(false);
|
|
57
|
+
const [captureSize, setCaptureSize] = useState(() => ({
|
|
58
|
+
w: typeof window !== "undefined" ? Math.round(window.innerWidth * Math.min(window.devicePixelRatio, 2)) : 0,
|
|
59
|
+
h: typeof window !== "undefined" ? Math.round(window.innerHeight * Math.min(window.devicePixelRatio, 2)) : 0
|
|
60
|
+
}));
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!isCapturesDOM) return;
|
|
63
|
+
setDomMounted(true);
|
|
64
|
+
const onResize = () => {
|
|
65
|
+
const d = Math.min(window.devicePixelRatio, 2);
|
|
66
|
+
setCaptureSize({
|
|
67
|
+
w: Math.round(window.innerWidth * d),
|
|
68
|
+
h: Math.round(window.innerHeight * d)
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
window.addEventListener("resize", onResize);
|
|
72
|
+
return () => window.removeEventListener("resize", onResize);
|
|
73
|
+
}, [isCapturesDOM]);
|
|
74
|
+
const detectedOrderRef = useRef(void 0);
|
|
75
|
+
const uniformsRef = useRef(null);
|
|
76
|
+
if (uniformsRef.current === null) {
|
|
77
|
+
setColorSpaceMode(shaderColorSpace);
|
|
78
|
+
uniformsRef.current = createUniformsMap(componentDefinition, effectiveProps, instanceId);
|
|
79
|
+
}
|
|
80
|
+
const childContextValue = useMemo(() => {
|
|
81
|
+
return {
|
|
82
|
+
...context,
|
|
83
|
+
shaderParentId: instanceId
|
|
84
|
+
};
|
|
85
|
+
}, [context, instanceId]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!uniformsRef.current) return;
|
|
88
|
+
try {
|
|
89
|
+
const metadata = {
|
|
90
|
+
blendMode: props.blendMode || "normal",
|
|
91
|
+
opacity: props.opacity,
|
|
92
|
+
visible: props.visible === false ? false : true,
|
|
93
|
+
id: props.id,
|
|
94
|
+
mask: props.maskSource ? {
|
|
95
|
+
source: props.maskSource,
|
|
96
|
+
type: props.maskType || "alpha"
|
|
97
|
+
} : void 0,
|
|
98
|
+
maps: mapsFromProps,
|
|
99
|
+
renderOrder: props.renderOrder ?? detectedOrderRef.current,
|
|
100
|
+
transform: effectiveTransform
|
|
101
|
+
};
|
|
102
|
+
parentRegister(instanceId, componentDefinition.fragmentNode, parentId, metadata, uniformsRef.current, componentDefinition, isCapturesDOM ? captureCanvasRef.current ?? void 0 : void 0);
|
|
103
|
+
return () => {
|
|
104
|
+
parentRegister(instanceId, null, null, null, null);
|
|
105
|
+
};
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("Error registering shader node:", error);
|
|
108
|
+
return () => {};
|
|
109
|
+
}
|
|
110
|
+
}, [
|
|
111
|
+
instanceId,
|
|
112
|
+
parentId,
|
|
113
|
+
parentRegister,
|
|
114
|
+
domMounted
|
|
115
|
+
]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (props.renderOrder === void 0 && markerRef.current) {
|
|
118
|
+
const parent = markerRef.current.parentElement;
|
|
119
|
+
if (parent) {
|
|
120
|
+
const siblings = parent.querySelectorAll(":scope > [data-shader-id]");
|
|
121
|
+
const position = Array.from(siblings).indexOf(markerRef.current);
|
|
122
|
+
if (position >= 0) {
|
|
123
|
+
detectedOrderRef.current = position;
|
|
124
|
+
parentMetadataUpdate(instanceId, { renderOrder: position });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, []);
|
|
129
|
+
const prevPropsRef = useRef({});
|
|
130
|
+
const mapsFromProps = useMemo(() => {
|
|
131
|
+
const maps = {};
|
|
132
|
+
for (const [key, value] of Object.entries(props)) if (key !== "children" && key !== "ref" && isPropDriver(value)) maps[key] = value;
|
|
133
|
+
return Object.keys(maps).length > 0 ? maps : void 0;
|
|
134
|
+
}, [props]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (!uniformsRef.current) return;
|
|
137
|
+
try {
|
|
138
|
+
Object.entries(uniformsRef.current).forEach(([propName, uniformData]) => {
|
|
139
|
+
if (!uniformData || typeof uniformData !== "object") return;
|
|
140
|
+
const { uniform } = uniformData;
|
|
141
|
+
if (uniform?.value !== void 0 && propName in effectiveProps) {
|
|
142
|
+
const newValue = effectiveProps[propName];
|
|
143
|
+
if (isPropDriver(newValue)) return;
|
|
144
|
+
if (newValue !== prevPropsRef.current[propName]) {
|
|
145
|
+
parentUniformUpdate(instanceId, propName, newValue);
|
|
146
|
+
prevPropsRef.current[propName] = newValue;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.error("Error updating uniforms:", error);
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
effectiveProps,
|
|
155
|
+
instanceId,
|
|
156
|
+
parentUniformUpdate
|
|
157
|
+
]);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
try {
|
|
160
|
+
parentMetadataUpdate(instanceId, {
|
|
161
|
+
blendMode: props.blendMode || "normal",
|
|
162
|
+
opacity: props.opacity,
|
|
163
|
+
visible: props.visible === false ? false : true,
|
|
164
|
+
id: props.id,
|
|
165
|
+
mask: props.maskSource ? {
|
|
166
|
+
source: props.maskSource,
|
|
167
|
+
type: props.maskType || "alpha"
|
|
168
|
+
} : void 0,
|
|
169
|
+
maps: mapsFromProps,
|
|
170
|
+
renderOrder: props.renderOrder ?? detectedOrderRef.current,
|
|
171
|
+
transform: effectiveTransform
|
|
172
|
+
});
|
|
173
|
+
} catch (error) {
|
|
174
|
+
console.error("Error updating metadata:", error);
|
|
175
|
+
}
|
|
176
|
+
}, [
|
|
177
|
+
props.blendMode,
|
|
178
|
+
props.opacity,
|
|
179
|
+
props.visible,
|
|
180
|
+
props.maskSource,
|
|
181
|
+
props.maskType,
|
|
182
|
+
props.renderOrder,
|
|
183
|
+
props.id,
|
|
184
|
+
mapsFromProps,
|
|
185
|
+
effectiveTransform,
|
|
186
|
+
instanceId,
|
|
187
|
+
parentMetadataUpdate
|
|
188
|
+
]);
|
|
189
|
+
if (props.ref && typeof props.ref === "function") try {
|
|
190
|
+
props.ref(null);
|
|
191
|
+
} catch (e) {}
|
|
192
|
+
const captureCanvas = isCapturesDOM && domMounted ? createPortal(/* @__PURE__ */ jsx("canvas", {
|
|
193
|
+
ref: captureCanvasRef,
|
|
194
|
+
"layoutsubtree": "",
|
|
195
|
+
width: captureSize.w,
|
|
196
|
+
height: captureSize.h,
|
|
197
|
+
style: {
|
|
198
|
+
position: "fixed",
|
|
199
|
+
inset: 0,
|
|
200
|
+
width: "100vw",
|
|
201
|
+
height: "100vh",
|
|
202
|
+
zIndex: -9999
|
|
203
|
+
},
|
|
204
|
+
children: props.children
|
|
205
|
+
}), document.body) : null;
|
|
206
|
+
return /* @__PURE__ */ jsxs(ShaderContext.Provider, {
|
|
207
|
+
value: childContextValue,
|
|
208
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
209
|
+
ref: markerRef,
|
|
210
|
+
style: MARKER_STYLE,
|
|
211
|
+
"data-shader-id": instanceId,
|
|
212
|
+
children: !isCapturesDOM && props.children
|
|
213
|
+
}), captureCanvas]
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
var ThinFilm_default = ShaderComponent;
|
|
217
|
+
export { ShaderComponent, ThinFilm_default as default };
|