shaders 2.5.114 → 2.5.116
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/{AngularBlur-BgZWbEjj.js → AngularBlur-C1oRJ8Y9.js} +1 -1
- package/dist/core/{Aurora-KcUDr49P.js → Aurora-D5Pjk4ve.js} +1 -1
- package/dist/core/{Beam-CAnoOWgt.js → Beam-mvF5Ri7_.js} +1 -1
- package/dist/core/{Blob-CuRSRXmA.js → Blob-CLHx5s6k.js} +1 -1
- package/dist/core/{Bulge-6gRUYqZS.js → Bulge-wflTcWfI.js} +1 -1
- package/dist/core/{Checkerboard-ucave4-a.js → Checkerboard-Db7Rb57F.js} +1 -1
- package/dist/core/{ChromaFlow-DxQaUqPL.js → ChromaFlow-DbiVz3hF.js} +1 -1
- package/dist/core/{ChromaticAberration-DsMj-vBw.js → ChromaticAberration-Bg_I4XF-.js} +1 -1
- package/dist/core/{Circle-QgCuVo44.js → Circle-Bfi2e0Vm.js} +1 -1
- package/dist/core/{ConcentricSpin-Fegtvhl6.js → ConcentricSpin-bAFd5_WI.js} +1 -1
- package/dist/core/{ConicGradient-CQAPYlQg.js → ConicGradient-Bcw4_25S.js} +1 -1
- package/dist/core/{ContourLines-tDBvQOvb.js → ContourLines-CcQWPKLx.js} +1 -1
- package/dist/core/{Crescent-BkRt-XWy.js → Crescent-DiioCL2k.js} +1 -1
- package/dist/core/{Cross-kkY7feuC.js → Cross-CxQTHuxC.js} +1 -1
- package/dist/core/{Crystal-COGiLVvV.js → Crystal-B3iO7o_n.js} +1 -1
- package/dist/core/{CursorRipples-BqtHgpEq.js → CursorRipples-CsYAXG2E.js} +1 -1
- package/dist/core/{CursorTrail-CgRMXbTG.js → CursorTrail-CUtEP_-P.js} +1 -1
- package/dist/core/{DiamondGradient-BC3ugP8a.js → DiamondGradient-3b93bdrv.js} +1 -1
- package/dist/core/{DiffuseBlur-B-Vki4ab.js → DiffuseBlur-61Vuq571.js} +1 -1
- package/dist/core/{Dither-CDfDotR6.js → Dither-Cv0Uci60.js} +1 -1
- package/dist/core/{DotGrid-T9YbgC3V.js → DotGrid-C88Sux6D.js} +1 -1
- package/dist/core/{DropShadow-B7FzTp4H.js → DropShadow-EZyCC_97.js} +1 -1
- package/dist/core/{Duotone-CqQ0NMxS.js → Duotone-D4ads1T9.js} +1 -1
- package/dist/core/{Ellipse-CXxGqTYI.js → Ellipse-iwH-zEvD.js} +1 -1
- package/dist/core/{Emboss-LU-6cckT.js → Emboss-B4i61QDT.js} +1 -1
- package/dist/core/{FallingLines-CArEXajJ.js → FallingLines-CQBvwLqn.js} +1 -1
- package/dist/core/{FloatingParticles-DpYA0_TE.js → FloatingParticles-BAvsQDhF.js} +1 -1
- package/dist/core/{FlowField-CTWyjeXm.js → FlowField-D2xJ0Xr4.js} +1 -1
- package/dist/core/{Flower-MAwlZEv8.js → Flower-CdHVKJKu.js} +1 -1
- package/dist/core/{FlowingGradient-C0Zoyfd6.js → FlowingGradient-DVDnNpGd.js} +1 -1
- package/dist/core/{FlutedGlass-B4FlyBOn.js → FlutedGlass-trmBFfQr.js} +1 -1
- package/dist/core/{Fog-CIdU2Wn-.js → Fog-DrsxPyih.js} +1 -1
- package/dist/core/{Form3D-CqmOXXGj.js → Form3D-D1TtCjk8.js} +1 -1
- package/dist/core/{Glass-BCOkQbvW.js → Glass-B19xsZLn.js} +1 -1
- package/dist/core/{Godrays-w3ruw4NO.js → Godrays-Mvz7ha2E.js} +1 -1
- package/dist/core/{Grid-CKbLS5tU.js → Grid-CsD21Eqg.js} +1 -1
- package/dist/core/{GridDistortion-CVpebl48.js → GridDistortion-BcDqBh9i.js} +1 -1
- package/dist/core/{Halftone-BGQeBAgG.js → Halftone-3ImN5uQi.js} +1 -1
- package/dist/core/{HexGrid-BFrnZEZT.js → HexGrid-BWwIHYEg.js} +1 -1
- package/dist/core/{Kaleidoscope-B0_OCrob.js → Kaleidoscope-D1HmcoOv.js} +1 -1
- package/dist/core/{LensFlare-B8x1fOKu.js → LensFlare-Be-Z9whi.js} +1 -1
- package/dist/core/{LinearBlur-CshzmjfO.js → LinearBlur-xrHtMmWp.js} +1 -1
- package/dist/core/{LinearGradient-Bzwquw_Q.js → LinearGradient-BiIad_hA.js} +1 -1
- package/dist/core/{Liquify-ZMAyGUIb.js → Liquify-DkTxZZFW.js} +1 -1
- package/dist/core/{Mirror-Gb0fugtF.js → Mirror-BDTE51kP.js} +1 -1
- package/dist/core/{MultiPointGradient-D0QQwizn.js → MultiPointGradient-Bd-EGOI8.js} +1 -1
- package/dist/core/{Neon-eN4HlILk.js → Neon-BeGABHrs.js} +1 -1
- package/dist/core/{Perspective-SBZzprC5.js → Perspective-CqweSeFv.js} +1 -1
- package/dist/core/{Plasma-COq8mAw2.js → Plasma-DqKLBDYd.js} +1 -1
- package/dist/core/{PolarCoordinates-Ckvb1eG0.js → PolarCoordinates-CKT4CLT7.js} +1 -1
- package/dist/core/{Polygon-BP5eKEiz.js → Polygon-_3DSqSBg.js} +1 -1
- package/dist/core/{ProgressiveBlur-CNacb2Qx.js → ProgressiveBlur-Dh8W2bZ3.js} +1 -1
- package/dist/core/{RadialGradient-SASVv2vb.js → RadialGradient-Dj3-DdO7.js} +1 -1
- package/dist/core/{RectangularCoordinates-r0fTwVuL.js → RectangularCoordinates-DxeLJ2nt.js} +1 -1
- package/dist/core/{Ring-CdJlzjRV.js → Ring-4J6h5Iof.js} +1 -1
- package/dist/core/{Ripples-BRZPZszq.js → Ripples-CXeVzwUd.js} +1 -1
- package/dist/core/{RoundedRect-lzzi_1J7.js → RoundedRect-Dj-gqOc0.js} +1 -1
- package/dist/core/{Shatter-CC3EFcP9.js → Shatter-CDza7dSw.js} +1 -1
- package/dist/core/{SimplexNoise-0-rfeziU.js → SimplexNoise-HQTocBLm.js} +1 -1
- package/dist/core/{SineWave--i6bSrad.js → SineWave-S6nK8ZHR.js} +1 -1
- package/dist/core/{Smoke-BgPHDWDR.js → Smoke-DjlArYQW.js} +1 -1
- package/dist/core/{SmokeFill-Dtctgt2S.js → SmokeFill-rM9vUIm4.js} +1 -1
- package/dist/core/{SolidColor-D9ikFFu3.js → SolidColor-a8bCIksn.js} +1 -1
- package/dist/core/{Spherize-ZBorEEOU.js → Spherize-BHmD2ajL.js} +1 -1
- package/dist/core/{Spiral-sg-i02xw.js → Spiral-Bjsi8BMH.js} +1 -1
- package/dist/core/{Star-BcqCHzHG.js → Star-CJ4mkBZg.js} +1 -1
- package/dist/core/{Strands-XLpth60o.js → Strands-C9fEwaiR.js} +1 -1
- package/dist/core/{Stretch-CJUUU-I1.js → Stretch-Cvht8B0L.js} +1 -1
- package/dist/core/{Stripes-DEOXYnmy.js → Stripes-ChVSAeCO.js} +1 -1
- package/dist/core/{StudioBackground-B5dpTR_X.js → StudioBackground-B8hilROB.js} +1 -1
- package/dist/core/{Swirl-WqPvBF7u.js → Swirl-DZTPLx-W.js} +1 -1
- package/dist/core/{TiltShift-CYb6OQoU.js → TiltShift-DSQ-CsXz.js} +1 -1
- package/dist/core/{Tint-C-bJpwd0.js → Tint-P7KwJAU5.js} +1 -1
- package/dist/core/{Trapezoid-BvTEGdW_.js → Trapezoid-P9gXhH9a.js} +1 -1
- package/dist/core/{Tritone-LX-qUAGy.js → Tritone-_9VR2bhu.js} +1 -1
- package/dist/core/{Truchet-DE4lgYRb.js → Truchet-CbL5nYMj.js} +1 -1
- package/dist/core/{Twirl-CgRyZdT1.js → Twirl-C_97m32v.js} +1 -1
- package/dist/core/{Vesica-DqJMyqmy.js → Vesica-DYov_i53.js} +1 -1
- package/dist/core/{Vignette-CA12P9VO.js → Vignette-DmYVHciL.js} +1 -1
- package/dist/core/{Voronoi-DXeJ3xOf.js → Voronoi-kngFpTNB.js} +1 -1
- package/dist/core/{WaveDistortion-iyTUI1lj.js → WaveDistortion-DM-f_XCw.js} +1 -1
- package/dist/core/{Weave-Bn2CfeE4.js → Weave-DO0m0Dsh.js} +1 -1
- package/dist/core/{ZoomBlur-DOzP_sOK.js → ZoomBlur-DLaH226M.js} +1 -1
- package/dist/core/index.js +85 -85
- package/dist/core/registry.js +85 -85
- package/dist/core/{shaderRegistry-SmtG2mTo.js → shaderRegistry-BPtUQU-N.js} +83 -83
- package/dist/core/shaders/AngularBlur/index.js +2 -2
- package/dist/core/shaders/Aurora/index.js +2 -2
- package/dist/core/shaders/Beam/index.js +2 -2
- package/dist/core/shaders/Blob/index.js +2 -2
- package/dist/core/shaders/Bulge/index.js +2 -2
- package/dist/core/shaders/Checkerboard/index.js +2 -2
- package/dist/core/shaders/ChromaFlow/index.js +2 -2
- package/dist/core/shaders/ChromaticAberration/index.js +2 -2
- package/dist/core/shaders/Circle/index.js +2 -2
- package/dist/core/shaders/ConcentricSpin/index.js +2 -2
- package/dist/core/shaders/ConicGradient/index.js +2 -2
- package/dist/core/shaders/ContourLines/index.js +2 -2
- package/dist/core/shaders/Crescent/index.js +2 -2
- package/dist/core/shaders/Cross/index.js +2 -2
- package/dist/core/shaders/Crystal/index.js +2 -2
- package/dist/core/shaders/CursorRipples/index.js +2 -2
- package/dist/core/shaders/CursorTrail/index.js +2 -2
- package/dist/core/shaders/DiamondGradient/index.js +2 -2
- package/dist/core/shaders/DiffuseBlur/index.js +2 -2
- package/dist/core/shaders/Dither/index.js +2 -2
- package/dist/core/shaders/DotGrid/index.js +2 -2
- package/dist/core/shaders/DropShadow/index.js +2 -2
- package/dist/core/shaders/Duotone/index.js +2 -2
- package/dist/core/shaders/Ellipse/index.js +2 -2
- package/dist/core/shaders/Emboss/index.js +2 -2
- package/dist/core/shaders/FallingLines/index.js +2 -2
- package/dist/core/shaders/FloatingParticles/index.js +2 -2
- package/dist/core/shaders/FlowField/index.js +2 -2
- package/dist/core/shaders/Flower/index.js +2 -2
- package/dist/core/shaders/FlowingGradient/index.js +2 -2
- package/dist/core/shaders/FlutedGlass/index.js +2 -2
- package/dist/core/shaders/Fog/index.js +2 -2
- package/dist/core/shaders/Form3D/index.js +2 -2
- package/dist/core/shaders/Glass/index.js +2 -2
- package/dist/core/shaders/Godrays/index.js +2 -2
- package/dist/core/shaders/Grid/index.js +2 -2
- package/dist/core/shaders/GridDistortion/index.js +2 -2
- package/dist/core/shaders/Halftone/index.js +2 -2
- package/dist/core/shaders/HexGrid/index.js +2 -2
- package/dist/core/shaders/Kaleidoscope/index.js +2 -2
- package/dist/core/shaders/LensFlare/index.js +2 -2
- package/dist/core/shaders/LinearBlur/index.js +2 -2
- package/dist/core/shaders/LinearGradient/index.js +2 -2
- package/dist/core/shaders/Liquify/index.js +2 -2
- package/dist/core/shaders/Mirror/index.js +2 -2
- package/dist/core/shaders/MultiPointGradient/index.js +2 -2
- package/dist/core/shaders/Neon/index.js +2 -2
- package/dist/core/shaders/Perspective/index.js +2 -2
- package/dist/core/shaders/Plasma/index.js +2 -2
- package/dist/core/shaders/PolarCoordinates/index.js +2 -2
- package/dist/core/shaders/Polygon/index.js +2 -2
- package/dist/core/shaders/ProgressiveBlur/index.js +2 -2
- package/dist/core/shaders/RadialGradient/index.js +2 -2
- package/dist/core/shaders/RectangularCoordinates/index.js +2 -2
- package/dist/core/shaders/Ring/index.js +2 -2
- package/dist/core/shaders/Ripples/index.js +2 -2
- package/dist/core/shaders/RoundedRect/index.js +2 -2
- package/dist/core/shaders/Shatter/index.js +2 -2
- package/dist/core/shaders/SimplexNoise/index.js +2 -2
- package/dist/core/shaders/SineWave/index.js +2 -2
- package/dist/core/shaders/Smoke/index.js +2 -2
- package/dist/core/shaders/SmokeFill/index.js +2 -2
- package/dist/core/shaders/SolidColor/index.js +2 -2
- package/dist/core/shaders/Spherize/index.js +2 -2
- package/dist/core/shaders/Spiral/index.js +2 -2
- package/dist/core/shaders/Star/index.js +2 -2
- package/dist/core/shaders/Strands/index.js +2 -2
- package/dist/core/shaders/Stretch/index.js +2 -2
- package/dist/core/shaders/Stripes/index.js +2 -2
- package/dist/core/shaders/StudioBackground/index.js +2 -2
- package/dist/core/shaders/Swirl/index.js +2 -2
- package/dist/core/shaders/TiltShift/index.js +2 -2
- package/dist/core/shaders/Tint/index.js +2 -2
- package/dist/core/shaders/Trapezoid/index.js +2 -2
- package/dist/core/shaders/Tritone/index.js +2 -2
- package/dist/core/shaders/Truchet/index.js +2 -2
- package/dist/core/shaders/Twirl/index.js +2 -2
- package/dist/core/shaders/Vesica/index.js +2 -2
- package/dist/core/shaders/Vignette/index.js +2 -2
- package/dist/core/shaders/Voronoi/index.js +2 -2
- package/dist/core/shaders/WaveDistortion/index.js +2 -2
- package/dist/core/shaders/Weave/index.js +2 -2
- package/dist/core/shaders/ZoomBlur/index.js +2 -2
- package/dist/core/{transformations-B5lM6fYX.js → transformations-CJcUeZIC.js} +23 -8
- package/dist/core/utilities/transformations/index.js +1 -1
- package/dist/core/utilities/transformations.d.ts.map +1 -1
- package/dist/js/createPreview.d.ts +7 -3
- package/dist/js/createPreview.d.ts.map +1 -1
- package/dist/js/createPreview.js +110 -4
- package/dist/js/createShader.js +1 -1
- package/dist/js/types.d.ts +32 -0
- package/dist/js/types.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.js +1 -1
- package/dist/react/Preview.js +113 -9
- package/dist/react/Shader.js +1 -1
- package/dist/react/bundle.js +196 -196
- package/dist/react/engine/Preview.d.ts +29 -0
- package/dist/react/engine/Preview.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +1 -1
- package/dist/react/utils/generatePresetCode.template.d.ts.map +1 -1
- package/dist/solid/engine/Preview.d.ts +18 -0
- package/dist/solid/engine/Preview.d.ts.map +1 -1
- package/dist/solid/engine/Preview.js +69 -2
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +1 -1
- package/dist/solid/utils/generatePresetCode.template.d.ts.map +1 -1
- package/dist/svelte/engine/Preview.svelte.d.ts +18 -0
- package/dist/svelte/index.js +124 -13
- package/dist/svelte/source/engine/Preview.svelte +134 -10
- package/dist/svelte/utils/generatePresetCode.js +1 -1
- package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +111 -8
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +1 -1
- package/dist/vue/utils/generatePresetCode.template.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/js/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEjE,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;kBAKc;IACd,GAAG,CAAC,EAAE;QACJ,MAAM,EAAE,SAAS,CAAA;QACjB,OAAO,EAAE,UAAU,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEjE,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;kBAKc;IACd,GAAG,CAAC,EAAE;QACJ,MAAM,EAAE,SAAS,CAAA;QACjB,OAAO,EAAE,UAAU,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,iGAAiG;IACjG,gBAAgB,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC/D;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;IAC7D;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7C,mFAAmF;IACnF,KAAK,IAAI,IAAI,CAAA;IACb,kDAAkD;IAClD,MAAM,IAAI,IAAI,CAAA;IACd,OAAO,IAAI,IAAI,CAAA;CAChB"}
|
|
@@ -1374,7 +1374,7 @@ function formatValue(value, indent) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
function shouldIncludeProp(key, value, componentType, props) {
|
|
1376
1376
|
if (key === "maskType" && value === "alpha") return false;
|
|
1377
|
-
if (key === "shape" && props.shapeSdfUrl) return false;
|
|
1377
|
+
if ((key === "shape" || key === "shapeType") && props.shapeSdfUrl) return false;
|
|
1378
1378
|
if (key === "transform" && typeof value === "object") {
|
|
1379
1379
|
if (Object.keys(DEFAULT_TRANSFORM).every((k) => value[k] === DEFAULT_TRANSFORM[k])) return false;
|
|
1380
1380
|
}
|
package/dist/react/Preview.js
CHANGED
|
@@ -19,6 +19,94 @@ function decodePreviewDefinition(encoded, key) {
|
|
|
19
19
|
throw new Error("Failed to decode shader definition: invalid data or incorrect key");
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
var RESERVED_IDENTIFIERS = new Set([
|
|
23
|
+
"break",
|
|
24
|
+
"case",
|
|
25
|
+
"catch",
|
|
26
|
+
"class",
|
|
27
|
+
"const",
|
|
28
|
+
"continue",
|
|
29
|
+
"default",
|
|
30
|
+
"delete",
|
|
31
|
+
"do",
|
|
32
|
+
"else",
|
|
33
|
+
"export",
|
|
34
|
+
"extends",
|
|
35
|
+
"finally",
|
|
36
|
+
"for",
|
|
37
|
+
"function",
|
|
38
|
+
"if",
|
|
39
|
+
"import",
|
|
40
|
+
"in",
|
|
41
|
+
"instanceof",
|
|
42
|
+
"new",
|
|
43
|
+
"return",
|
|
44
|
+
"super",
|
|
45
|
+
"switch",
|
|
46
|
+
"this",
|
|
47
|
+
"throw",
|
|
48
|
+
"try",
|
|
49
|
+
"typeof",
|
|
50
|
+
"var",
|
|
51
|
+
"void",
|
|
52
|
+
"while",
|
|
53
|
+
"with",
|
|
54
|
+
"yield"
|
|
55
|
+
]);
|
|
56
|
+
function slugifyIdentifier(label, fallback) {
|
|
57
|
+
const cleaned = label.replace(/[^A-Za-z0-9]+/g, " ").trim();
|
|
58
|
+
if (!cleaned) return fallback;
|
|
59
|
+
const camel = cleaned.split(/\s+/).map((part, i) => i === 0 ? part.charAt(0).toLowerCase() + part.slice(1) : part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
60
|
+
const safe = /^[A-Za-z_$]/.test(camel) ? camel : `_${camel}`;
|
|
61
|
+
return RESERVED_IDENTIFIERS.has(safe) ? `_${safe}` : safe;
|
|
62
|
+
}
|
|
63
|
+
function buildKeyPropIdentifierMap(keyProps) {
|
|
64
|
+
const used = new Set(["style"]);
|
|
65
|
+
const map = /* @__PURE__ */ new Map();
|
|
66
|
+
if (!keyProps?.length) return map;
|
|
67
|
+
keyProps.forEach((kp, i) => {
|
|
68
|
+
if (!kp.targets?.length) return;
|
|
69
|
+
const base = slugifyIdentifier(kp.label, `keyProp${i}`);
|
|
70
|
+
let ident = base;
|
|
71
|
+
let suffix = 1;
|
|
72
|
+
while (used.has(ident)) {
|
|
73
|
+
suffix++;
|
|
74
|
+
ident = `${base}${suffix}`;
|
|
75
|
+
}
|
|
76
|
+
used.add(ident);
|
|
77
|
+
map.set(ident, kp);
|
|
78
|
+
});
|
|
79
|
+
return map;
|
|
80
|
+
}
|
|
81
|
+
function findInTree(id, list) {
|
|
82
|
+
for (const c of list) {
|
|
83
|
+
if (c.id === id) return c;
|
|
84
|
+
if (c.children?.length) {
|
|
85
|
+
const hit = findInTree(id, c.children);
|
|
86
|
+
if (hit) return hit;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function applyConfiguration(definition, configuration, keyProps) {
|
|
92
|
+
if (!configuration || !keyProps?.length) return definition;
|
|
93
|
+
const entries = Object.entries(configuration);
|
|
94
|
+
if (entries.length === 0) return definition;
|
|
95
|
+
const identMap = buildKeyPropIdentifierMap(keyProps);
|
|
96
|
+
const cloned = JSON.parse(JSON.stringify(definition.components));
|
|
97
|
+
for (const [ident, value] of entries) {
|
|
98
|
+
const kp = identMap.get(ident);
|
|
99
|
+
if (!kp) continue;
|
|
100
|
+
for (const t of kp.targets ?? []) {
|
|
101
|
+
const comp = findInTree(t.component_id, cloned);
|
|
102
|
+
if (comp?.props && t.prop in comp.props) comp.props[t.prop] = value;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
...definition,
|
|
107
|
+
components: cloned
|
|
108
|
+
};
|
|
109
|
+
}
|
|
22
110
|
var componentMap = {
|
|
23
111
|
AngularBlur: lazy(() => import("./AngularBlur.js")),
|
|
24
112
|
Ascii: lazy(() => import("./Ascii.js")),
|
|
@@ -158,23 +246,31 @@ function RenderComponent({ component }) {
|
|
|
158
246
|
children: children?.map((child, index) => /* @__PURE__ */ jsx(RenderComponent, { component: child }, child.id || index))
|
|
159
247
|
});
|
|
160
248
|
}
|
|
161
|
-
const Preview = ({ shader, presetId, apiBaseUrl = "https://shaders.com", obfuscationKey = DEFAULT_KEY, watermarkText = "Unlock your Shaders Pro license", watermarkLink = "https://shaders.com/dashboard?pricing=true", style, className,...rest }) => {
|
|
249
|
+
const Preview = ({ shader, presetId, apiBaseUrl = "https://shaders.com", obfuscationKey = DEFAULT_KEY, watermarkText = "Unlock your Shaders Pro license", watermarkLink = "https://shaders.com/dashboard?pricing=true", style, className, configuration, version,...rest }) => {
|
|
162
250
|
const [fetchedDefinition, setFetchedDefinition] = useState(null);
|
|
251
|
+
const [fetchedKeyProps, setFetchedKeyProps] = useState(null);
|
|
163
252
|
const fetchAndDecode = (url) => {
|
|
164
253
|
setFetchedDefinition(null);
|
|
254
|
+
setFetchedKeyProps(null);
|
|
165
255
|
fetch(url).then((res) => {
|
|
166
256
|
if (!res.ok) throw new Error(`Failed to fetch: ${res.status}`);
|
|
167
257
|
return res.json();
|
|
168
258
|
}).then((data) => {
|
|
169
259
|
const item = data.preset || data.shader;
|
|
170
|
-
if (item?.definition && typeof item.definition === "string")
|
|
260
|
+
if (item?.definition && typeof item.definition === "string") {
|
|
261
|
+
setFetchedDefinition(decodePreviewDefinition(item.definition, obfuscationKey));
|
|
262
|
+
setFetchedKeyProps(Array.isArray(item.key_props) ? item.key_props : null);
|
|
263
|
+
}
|
|
171
264
|
}).catch((err) => {
|
|
172
265
|
console.error("[Shaders Preview] Failed to fetch preview:", err);
|
|
173
266
|
});
|
|
174
267
|
};
|
|
175
268
|
useEffect(() => {
|
|
176
269
|
if (shader) fetchAndDecode(`${apiBaseUrl}/api/preview/shader/${shader}`);
|
|
177
|
-
else if (!presetId)
|
|
270
|
+
else if (!presetId) {
|
|
271
|
+
setFetchedDefinition(null);
|
|
272
|
+
setFetchedKeyProps(null);
|
|
273
|
+
}
|
|
178
274
|
}, [
|
|
179
275
|
shader,
|
|
180
276
|
presetId,
|
|
@@ -182,18 +278,26 @@ const Preview = ({ shader, presetId, apiBaseUrl = "https://shaders.com", obfusca
|
|
|
182
278
|
obfuscationKey
|
|
183
279
|
]);
|
|
184
280
|
useEffect(() => {
|
|
185
|
-
if (presetId) fetchAndDecode(`${apiBaseUrl}/api/preview/preset/${presetId}`);
|
|
186
|
-
else if (!shader)
|
|
281
|
+
if (presetId) fetchAndDecode(`${apiBaseUrl}/api/preview/preset/${presetId}${version ? `?version=${encodeURIComponent(version)}` : ""}`);
|
|
282
|
+
else if (!shader) {
|
|
283
|
+
setFetchedDefinition(null);
|
|
284
|
+
setFetchedKeyProps(null);
|
|
285
|
+
}
|
|
187
286
|
}, [
|
|
188
287
|
presetId,
|
|
189
288
|
shader,
|
|
190
289
|
apiBaseUrl,
|
|
191
|
-
obfuscationKey
|
|
290
|
+
obfuscationKey,
|
|
291
|
+
version
|
|
192
292
|
]);
|
|
193
293
|
const definition = useMemo(() => {
|
|
194
|
-
if (fetchedDefinition) return
|
|
195
|
-
return
|
|
196
|
-
}, [
|
|
294
|
+
if (!fetchedDefinition) return null;
|
|
295
|
+
return applyConfiguration(fetchedDefinition, configuration, fetchedKeyProps);
|
|
296
|
+
}, [
|
|
297
|
+
fetchedDefinition,
|
|
298
|
+
fetchedKeyProps,
|
|
299
|
+
configuration
|
|
300
|
+
]);
|
|
197
301
|
const hasWarnedRef = useRef(false);
|
|
198
302
|
useEffect(() => {
|
|
199
303
|
if (!hasWarnedRef.current && definition) {
|
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.116", disableTelemetry, isPreview);
|
|
93
93
|
if (telemetryCollectorRef.current) telemetryCollectorRef.current.start();
|
|
94
94
|
telemetryStartTimeoutRef.current = null;
|
|
95
95
|
} else telemetryStartTimeoutRef.current = window.setTimeout(checkRendering, 500);
|