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
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../transformations-
|
|
2
|
-
import { n as componentDefinition, t as MultiPointGradient_default } from "../../MultiPointGradient-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
|
+
import { n as componentDefinition, t as MultiPointGradient_default } from "../../MultiPointGradient-Bd-EGOI8.js";
|
|
3
3
|
export { componentDefinition, MultiPointGradient_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../sdf-DyC2H_qS.js";
|
|
3
|
-
import { n as componentDefinition, t as Neon_default } from "../../Neon-
|
|
3
|
+
import { n as componentDefinition, t as Neon_default } from "../../Neon-BeGABHrs.js";
|
|
4
4
|
export { componentDefinition, Neon_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
|
-
import { n as componentDefinition, t as Perspective_default } from "../../Perspective-
|
|
4
|
+
import { n as componentDefinition, t as Perspective_default } from "../../Perspective-CqweSeFv.js";
|
|
5
5
|
export { componentDefinition, Perspective_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as Plasma_default } from "../../Plasma-
|
|
4
|
+
import { n as componentDefinition, t as Plasma_default } from "../../Plasma-DqKLBDYd.js";
|
|
5
5
|
export { componentDefinition, Plasma_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
|
-
import { n as componentDefinition, t as PolarCoordinates_default } from "../../PolarCoordinates-
|
|
4
|
+
import { n as componentDefinition, t as PolarCoordinates_default } from "../../PolarCoordinates-CKT4CLT7.js";
|
|
5
5
|
export { componentDefinition, PolarCoordinates_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as Polygon_default } from "../../Polygon-
|
|
4
|
+
import { n as componentDefinition, t as Polygon_default } from "../../Polygon-_3DSqSBg.js";
|
|
5
5
|
export { componentDefinition, Polygon_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../alpha-C4ptedXe.js";
|
|
3
3
|
import "../../computeBlur-DCRhuYEi.js";
|
|
4
|
-
import { n as componentDefinition, t as ProgressiveBlur_default } from "../../ProgressiveBlur-
|
|
4
|
+
import { n as componentDefinition, t as ProgressiveBlur_default } from "../../ProgressiveBlur-Dh8W2bZ3.js";
|
|
5
5
|
export { componentDefinition, ProgressiveBlur_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
|
-
import { n as componentDefinition, t as RadialGradient_default } from "../../RadialGradient-
|
|
3
|
+
import { n as componentDefinition, t as RadialGradient_default } from "../../RadialGradient-Dj3-DdO7.js";
|
|
4
4
|
export { componentDefinition, RadialGradient_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
|
-
import { n as componentDefinition, t as RectangularCoordinates_default } from "../../RectangularCoordinates-
|
|
4
|
+
import { n as componentDefinition, t as RectangularCoordinates_default } from "../../RectangularCoordinates-DxeLJ2nt.js";
|
|
5
5
|
export { componentDefinition, RectangularCoordinates_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as Ring_default } from "../../Ring-
|
|
4
|
+
import { n as componentDefinition, t as Ring_default } from "../../Ring-4J6h5Iof.js";
|
|
5
5
|
export { componentDefinition, Ring_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as Ripples_default } from "../../Ripples-
|
|
4
|
+
import { n as componentDefinition, t as Ripples_default } from "../../Ripples-CXeVzwUd.js";
|
|
5
5
|
export { componentDefinition, Ripples_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as RoundedRect_default } from "../../RoundedRect-
|
|
4
|
+
import { n as componentDefinition, t as RoundedRect_default } from "../../RoundedRect-Dj-gqOc0.js";
|
|
5
5
|
export { componentDefinition, RoundedRect_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
|
-
import { n as componentDefinition, t as Shatter_default } from "../../Shatter-
|
|
4
|
+
import { n as componentDefinition, t as Shatter_default } from "../../Shatter-CDza7dSw.js";
|
|
5
5
|
export { componentDefinition, Shatter_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as SimplexNoise_default } from "../../SimplexNoise-
|
|
4
|
+
import { n as componentDefinition, t as SimplexNoise_default } from "../../SimplexNoise-HQTocBLm.js";
|
|
5
5
|
export { componentDefinition, SimplexNoise_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../time-DUqSFWvT.js";
|
|
3
|
-
import { n as componentDefinition, t as SineWave_default } from "../../SineWave
|
|
3
|
+
import { n as componentDefinition, t as SineWave_default } from "../../SineWave-S6nK8ZHR.js";
|
|
4
4
|
export { componentDefinition, SineWave_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
|
-
import { n as componentDefinition, t as Smoke_default } from "../../Smoke-
|
|
3
|
+
import { n as componentDefinition, t as Smoke_default } from "../../Smoke-DjlArYQW.js";
|
|
4
4
|
export { componentDefinition, Smoke_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as SmokeFill_default } from "../../SmokeFill-
|
|
4
|
+
import { n as componentDefinition, t as SmokeFill_default } from "../../SmokeFill-rM9vUIm4.js";
|
|
5
5
|
export { componentDefinition, SmokeFill_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../transformations-
|
|
2
|
-
import { n as componentDefinition, t as SolidColor_default } from "../../SolidColor-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
|
+
import { n as componentDefinition, t as SolidColor_default } from "../../SolidColor-a8bCIksn.js";
|
|
3
3
|
export { componentDefinition, SolidColor_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../alpha-C4ptedXe.js";
|
|
3
|
-
import { n as componentDefinition, t as Spherize_default } from "../../Spherize-
|
|
3
|
+
import { n as componentDefinition, t as Spherize_default } from "../../Spherize-BHmD2ajL.js";
|
|
4
4
|
export { componentDefinition, Spherize_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as Spiral_default } from "../../Spiral-
|
|
4
|
+
import { n as componentDefinition, t as Spiral_default } from "../../Spiral-Bjsi8BMH.js";
|
|
5
5
|
export { componentDefinition, Spiral_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as Star_default } from "../../Star-
|
|
4
|
+
import { n as componentDefinition, t as Star_default } from "../../Star-CJ4mkBZg.js";
|
|
5
5
|
export { componentDefinition, Star_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../time-DUqSFWvT.js";
|
|
3
|
-
import { n as componentDefinition, t as Strands_default } from "../../Strands-
|
|
3
|
+
import { n as componentDefinition, t as Strands_default } from "../../Strands-C9fEwaiR.js";
|
|
4
4
|
export { componentDefinition, Strands_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
|
-
import { n as componentDefinition, t as Stretch_default } from "../../Stretch-
|
|
4
|
+
import { n as componentDefinition, t as Stretch_default } from "../../Stretch-Cvht8B0L.js";
|
|
5
5
|
export { componentDefinition, Stretch_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as Stripes_default } from "../../Stripes-
|
|
4
|
+
import { n as componentDefinition, t as Stripes_default } from "../../Stripes-ChVSAeCO.js";
|
|
5
5
|
export { componentDefinition, Stripes_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../time-DUqSFWvT.js";
|
|
3
|
-
import { n as componentDefinition, t as StudioBackground_default } from "../../StudioBackground-
|
|
3
|
+
import { n as componentDefinition, t as StudioBackground_default } from "../../StudioBackground-B8hilROB.js";
|
|
4
4
|
export { componentDefinition, StudioBackground_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as Swirl_default } from "../../Swirl-
|
|
4
|
+
import { n as componentDefinition, t as Swirl_default } from "../../Swirl-DZTPLx-W.js";
|
|
5
5
|
export { componentDefinition, Swirl_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../alpha-C4ptedXe.js";
|
|
3
3
|
import "../../computeBlur-DCRhuYEi.js";
|
|
4
|
-
import { n as componentDefinition, t as TiltShift_default } from "../../TiltShift-
|
|
4
|
+
import { n as componentDefinition, t as TiltShift_default } from "../../TiltShift-DSQ-CsXz.js";
|
|
5
5
|
export { componentDefinition, TiltShift_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../transformations-
|
|
2
|
-
import { n as componentDefinition, t as Tint_default } from "../../Tint-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
|
+
import { n as componentDefinition, t as Tint_default } from "../../Tint-P7KwJAU5.js";
|
|
3
3
|
export { componentDefinition, Tint_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as Trapezoid_default } from "../../Trapezoid-
|
|
4
|
+
import { n as componentDefinition, t as Trapezoid_default } from "../../Trapezoid-P9gXhH9a.js";
|
|
5
5
|
export { componentDefinition, Trapezoid_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
|
-
import { n as componentDefinition, t as Tritone_default } from "../../Tritone-
|
|
3
|
+
import { n as componentDefinition, t as Tritone_default } from "../../Tritone-_9VR2bhu.js";
|
|
4
4
|
export { componentDefinition, Tritone_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
|
-
import { n as componentDefinition, t as Truchet_default } from "../../Truchet-
|
|
3
|
+
import { n as componentDefinition, t as Truchet_default } from "../../Truchet-CbL5nYMj.js";
|
|
4
4
|
export { componentDefinition, Truchet_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
|
-
import { n as componentDefinition, t as Twirl_default } from "../../Twirl-
|
|
4
|
+
import { n as componentDefinition, t as Twirl_default } from "../../Twirl-C_97m32v.js";
|
|
5
5
|
export { componentDefinition, Twirl_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../sdf-DyC2H_qS.js";
|
|
4
|
-
import { n as componentDefinition, t as Vesica_default } from "../../Vesica-
|
|
4
|
+
import { n as componentDefinition, t as Vesica_default } from "../../Vesica-DYov_i53.js";
|
|
5
5
|
export { componentDefinition, Vesica_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../transformations-
|
|
2
|
-
import { n as componentDefinition, t as Vignette_default } from "../../Vignette-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
|
+
import { n as componentDefinition, t as Vignette_default } from "../../Vignette-DmYVHciL.js";
|
|
3
3
|
export { componentDefinition, Vignette_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../colorMixing-BPpDnR5I.js";
|
|
3
3
|
import "../../time-DUqSFWvT.js";
|
|
4
|
-
import { n as componentDefinition, t as Voronoi_default } from "../../Voronoi-
|
|
4
|
+
import { n as componentDefinition, t as Voronoi_default } from "../../Voronoi-kngFpTNB.js";
|
|
5
5
|
export { componentDefinition, Voronoi_default as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../edges-CX_lJB9R.js";
|
|
2
|
-
import "../../transformations-
|
|
2
|
+
import "../../transformations-CJcUeZIC.js";
|
|
3
3
|
import "../../alpha-C4ptedXe.js";
|
|
4
4
|
import "../../time-DUqSFWvT.js";
|
|
5
|
-
import { n as componentDefinition, t as WaveDistortion_default } from "../../WaveDistortion-
|
|
5
|
+
import { n as componentDefinition, t as WaveDistortion_default } from "../../WaveDistortion-DM-f_XCw.js";
|
|
6
6
|
export { componentDefinition, WaveDistortion_default as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../../transformations-
|
|
2
|
-
import { n as componentDefinition, t as Weave_default } from "../../Weave-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
|
+
import { n as componentDefinition, t as Weave_default } from "../../Weave-DO0m0Dsh.js";
|
|
3
3
|
export { componentDefinition, Weave_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../transformations-
|
|
1
|
+
import "../../transformations-CJcUeZIC.js";
|
|
2
2
|
import "../../alpha-C4ptedXe.js";
|
|
3
|
-
import { n as componentDefinition, t as ZoomBlur_default } from "../../ZoomBlur-
|
|
3
|
+
import { n as componentDefinition, t as ZoomBlur_default } from "../../ZoomBlur-DLaH226M.js";
|
|
4
4
|
export { componentDefinition, ZoomBlur_default as default };
|
|
@@ -4598,21 +4598,36 @@ const setColorSpaceMode = (mode) => {
|
|
|
4598
4598
|
colorSpaceMode = mode;
|
|
4599
4599
|
};
|
|
4600
4600
|
const transformBoolean = (value) => value ? 1 : -1;
|
|
4601
|
+
function parseColorChannels(value) {
|
|
4602
|
+
try {
|
|
4603
|
+
const threeColor = new Color(value);
|
|
4604
|
+
const targetSpace = colorSpaceMode === "srgb" ? "srgb-linear" : "p3-linear";
|
|
4605
|
+
const coords = threeColor.to(targetSpace).coords;
|
|
4606
|
+
return {
|
|
4607
|
+
r: Number.isFinite(coords?.[0]) ? coords[0] : 0,
|
|
4608
|
+
g: Number.isFinite(coords?.[1]) ? coords[1] : 0,
|
|
4609
|
+
b: Number.isFinite(coords?.[2]) ? coords[2] : 0,
|
|
4610
|
+
a: Number.isFinite(threeColor.alpha) ? threeColor.alpha : 0
|
|
4611
|
+
};
|
|
4612
|
+
} catch {
|
|
4613
|
+
return {
|
|
4614
|
+
r: 0,
|
|
4615
|
+
g: 0,
|
|
4616
|
+
b: 0,
|
|
4617
|
+
a: 0
|
|
4618
|
+
};
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4601
4621
|
const transformColor = (value) => {
|
|
4602
|
-
const
|
|
4603
|
-
const targetSpace = colorSpaceMode === "srgb" ? "srgb-linear" : "p3-linear";
|
|
4604
|
-
const coords = threeColor.to(targetSpace).coords;
|
|
4605
|
-
const r = coords[0], g$1 = coords[1], b$2 = coords[2], a$1 = threeColor.alpha;
|
|
4622
|
+
const { r, g: g$1, b: b$2, a: a$1 } = parseColorChannels(value);
|
|
4606
4623
|
return {
|
|
4607
4624
|
node: vec4(r, g$1, b$2, a$1),
|
|
4608
4625
|
data: new Vector4(r, g$1, b$2, a$1)
|
|
4609
4626
|
};
|
|
4610
4627
|
};
|
|
4611
4628
|
const transformColorUpdate = (value) => {
|
|
4612
|
-
const
|
|
4613
|
-
|
|
4614
|
-
const coords = threeColor.to(targetSpace).coords;
|
|
4615
|
-
return getReusableVector4().set(coords[0], coords[1], coords[2], threeColor.alpha);
|
|
4629
|
+
const { r, g: g$1, b: b$2, a: a$1 } = parseColorChannels(value);
|
|
4630
|
+
return getReusableVector4().set(r, g$1, b$2, a$1);
|
|
4616
4631
|
};
|
|
4617
4632
|
const transformPosition = (value) => {
|
|
4618
4633
|
let x = .5;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as transformColor, c as transformEdges, i as transformBoolean, l as transformPosition, n as setColorSpaceMode, o as transformColorSpace, r as transformAngle, s as transformColorUpdate, t as colorSpaceOptions, u as transformPositionUpdate } from "../../transformations-
|
|
1
|
+
import { a as transformColor, c as transformEdges, i as transformBoolean, l as transformPosition, n as setColorSpaceMode, o as transformColorSpace, r as transformAngle, s as transformColorUpdate, t as colorSpaceOptions, u as transformPositionUpdate } from "../../transformations-CJcUeZIC.js";
|
|
2
2
|
export { colorSpaceOptions, setColorSpaceMode, transformAngle, transformBoolean, transformColor, transformColorSpace, transformColorUpdate, transformEdges, transformPosition, transformPositionUpdate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/utilities/transformations.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AA4BtC,eAAO,MAAM,iBAAiB,SAAU,WAAW,GAAG,MAAM,SAE3D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAW,OAAO,WAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/utilities/transformations.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,OAAO,CAAA;AA4BtC,eAAO,MAAM,iBAAiB,SAAU,WAAW,GAAG,MAAM,SAE3D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAW,OAAO,WAAkB,CAAA;AAgCjE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM;UAGV,GAAG;;CAGpC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,UAAW,MAAM,KAAG,OAGpD,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,UAAW;IAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GAAG,MAAM;UA4DzD,GAAG;;CAGnC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,UAAW;IAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,GAAG,MAAM,KAAG,OAiDlG,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,GAAG,MAAM,KAAG,MAyEvD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,MAe9C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;GAO7B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,MAiBnD,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PreviewInstance, PreviewOptions } from './types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Create a watermarked shader preview from a preview token or preset ID.
|
|
@@ -8,12 +8,16 @@ import { ShaderInstance, PreviewOptions } from './types';
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
10
|
* const preview = await createPreview(canvas, {
|
|
11
|
-
* presetId: 'abc123'
|
|
11
|
+
* presetId: 'abc123',
|
|
12
|
+
* configuration: { primaryColor: '#ff0000', intensity: 0.5 }
|
|
12
13
|
* })
|
|
13
14
|
*
|
|
15
|
+
* // Update configuration at runtime (no refetch)
|
|
16
|
+
* preview.setConfiguration({ primaryColor: '#00ff00', intensity: 0.8 })
|
|
17
|
+
*
|
|
14
18
|
* // Cleanup
|
|
15
19
|
* preview.destroy()
|
|
16
20
|
* ```
|
|
17
21
|
*/
|
|
18
|
-
export declare function createPreview(canvas: HTMLCanvasElement, options: PreviewOptions): Promise<
|
|
22
|
+
export declare function createPreview(canvas: HTMLCanvasElement, options: PreviewOptions): Promise<PreviewInstance>;
|
|
19
23
|
//# sourceMappingURL=createPreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPreview.d.ts","sourceRoot":"","sources":["../src/createPreview.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createPreview.d.ts","sourceRoot":"","sources":["../src/createPreview.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAW,MAAM,SAAS,CAAA;AA8EvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CA2F1B"}
|
package/dist/js/createPreview.js
CHANGED
|
@@ -3,24 +3,130 @@ import { decodePreviewDefinition } from "./decode.js";
|
|
|
3
3
|
var DEFAULT_API_BASE = "https://shaders.com";
|
|
4
4
|
var WATERMARK_TEXT = "Unlock your Shaders Pro license";
|
|
5
5
|
var WATERMARK_LINK = "https://shaders.com/dashboard?pricing=true";
|
|
6
|
+
var RESERVED_IDENTIFIERS = new Set([
|
|
7
|
+
"break",
|
|
8
|
+
"case",
|
|
9
|
+
"catch",
|
|
10
|
+
"class",
|
|
11
|
+
"const",
|
|
12
|
+
"continue",
|
|
13
|
+
"default",
|
|
14
|
+
"delete",
|
|
15
|
+
"do",
|
|
16
|
+
"else",
|
|
17
|
+
"export",
|
|
18
|
+
"extends",
|
|
19
|
+
"finally",
|
|
20
|
+
"for",
|
|
21
|
+
"function",
|
|
22
|
+
"if",
|
|
23
|
+
"import",
|
|
24
|
+
"in",
|
|
25
|
+
"instanceof",
|
|
26
|
+
"new",
|
|
27
|
+
"return",
|
|
28
|
+
"super",
|
|
29
|
+
"switch",
|
|
30
|
+
"this",
|
|
31
|
+
"throw",
|
|
32
|
+
"try",
|
|
33
|
+
"typeof",
|
|
34
|
+
"var",
|
|
35
|
+
"void",
|
|
36
|
+
"while",
|
|
37
|
+
"with",
|
|
38
|
+
"yield"
|
|
39
|
+
]);
|
|
40
|
+
function slugifyIdentifier(label, fallback) {
|
|
41
|
+
const cleaned = label.replace(/[^A-Za-z0-9]+/g, " ").trim();
|
|
42
|
+
if (!cleaned) return fallback;
|
|
43
|
+
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("");
|
|
44
|
+
const safe = /^[A-Za-z_$]/.test(camel) ? camel : `_${camel}`;
|
|
45
|
+
return RESERVED_IDENTIFIERS.has(safe) ? `_${safe}` : safe;
|
|
46
|
+
}
|
|
47
|
+
function buildKeyPropIdentifierMap(keyProps) {
|
|
48
|
+
const used = new Set(["style"]);
|
|
49
|
+
const map = /* @__PURE__ */ new Map();
|
|
50
|
+
if (!keyProps?.length) return map;
|
|
51
|
+
keyProps.forEach((kp, i) => {
|
|
52
|
+
if (!kp.targets?.length) return;
|
|
53
|
+
const base = slugifyIdentifier(kp.label, `keyProp${i}`);
|
|
54
|
+
let ident = base;
|
|
55
|
+
let suffix = 1;
|
|
56
|
+
while (used.has(ident)) {
|
|
57
|
+
suffix++;
|
|
58
|
+
ident = `${base}${suffix}`;
|
|
59
|
+
}
|
|
60
|
+
used.add(ident);
|
|
61
|
+
map.set(ident, kp);
|
|
62
|
+
});
|
|
63
|
+
return map;
|
|
64
|
+
}
|
|
65
|
+
function findInTree(id, list) {
|
|
66
|
+
for (const c of list) {
|
|
67
|
+
if (c.id === id) return c;
|
|
68
|
+
const children = c.children;
|
|
69
|
+
if (children?.length) {
|
|
70
|
+
const hit = findInTree(id, children);
|
|
71
|
+
if (hit) return hit;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
function applyConfigurationInPlace(components, configuration, identMap) {
|
|
77
|
+
if (!configuration) return;
|
|
78
|
+
for (const [ident, value] of Object.entries(configuration)) {
|
|
79
|
+
const kp = identMap.get(ident);
|
|
80
|
+
if (!kp) continue;
|
|
81
|
+
for (const t of kp.targets ?? []) {
|
|
82
|
+
const comp = findInTree(t.component_id, components);
|
|
83
|
+
if (comp?.props && t.prop in comp.props) comp.props[t.prop] = value;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
6
87
|
async function createPreview(canvas, options) {
|
|
7
88
|
if (!options.shader && !options.presetId || options.shader && options.presetId) throw new Error("Exactly one of shader (preview token) or presetId must be provided");
|
|
8
89
|
const apiBase = options.apiBaseUrl || DEFAULT_API_BASE;
|
|
9
|
-
const
|
|
90
|
+
const versionParam = options.presetId && options.version ? `?version=${encodeURIComponent(options.version)}` : "";
|
|
91
|
+
const url = options.shader ? `${apiBase}/api/preview/shader/${encodeURIComponent(options.shader)}` : `${apiBase}/api/preview/preset/${encodeURIComponent(options.presetId)}${versionParam}`;
|
|
10
92
|
const response = await fetch(url);
|
|
11
93
|
if (!response.ok) throw new Error(`Failed to fetch preview: ${response.status} ${response.statusText}`);
|
|
12
|
-
const
|
|
94
|
+
const payload = await response.json();
|
|
95
|
+
const item = payload.preset ?? payload.shader;
|
|
96
|
+
if (!item?.definition || typeof item.definition !== "string") throw new Error("Preview response missing encoded definition");
|
|
97
|
+
const definition = decodePreviewDefinition(item.definition);
|
|
98
|
+
const keyProps = Array.isArray(item.key_props) ? item.key_props : null;
|
|
99
|
+
const identMap = buildKeyPropIdentifierMap(keyProps);
|
|
100
|
+
const baselineMap = /* @__PURE__ */ new Map();
|
|
101
|
+
for (const kp of identMap.values()) for (const t of kp.targets ?? []) {
|
|
102
|
+
const comp = findInTree(t.component_id, definition.components);
|
|
103
|
+
if (comp?.props && t.prop in comp.props) baselineMap.set(`${t.component_id}:${t.prop}`, comp.props[t.prop]);
|
|
104
|
+
}
|
|
105
|
+
applyConfigurationInPlace(definition.components, options.configuration, identMap);
|
|
106
|
+
const instance = await createShader(canvas, definition, {
|
|
13
107
|
isPreview: true,
|
|
14
108
|
enablePerformanceTracking: true
|
|
15
109
|
});
|
|
16
110
|
const { overlay, savedPosition, parentEl } = createWatermarkOverlay(canvas);
|
|
17
111
|
const originalDestroy = instance.destroy.bind(instance);
|
|
18
|
-
|
|
112
|
+
const previewInstance = instance;
|
|
113
|
+
previewInstance.destroy = () => {
|
|
19
114
|
if (parentEl && savedPosition !== void 0) parentEl.style.position = savedPosition;
|
|
20
115
|
overlay.remove();
|
|
21
116
|
originalDestroy();
|
|
22
117
|
};
|
|
23
|
-
|
|
118
|
+
previewInstance.setConfiguration = (configuration) => {
|
|
119
|
+
if (!keyProps?.length) return;
|
|
120
|
+
for (const [ident, kp] of identMap) {
|
|
121
|
+
const hasNewValue = Object.prototype.hasOwnProperty.call(configuration, ident) && configuration[ident] !== void 0;
|
|
122
|
+
for (const t of kp.targets ?? []) {
|
|
123
|
+
const value = hasNewValue ? configuration[ident] : baselineMap.get(`${t.component_id}:${t.prop}`);
|
|
124
|
+
if (value === void 0) continue;
|
|
125
|
+
instance.update(t.component_id, { [t.prop]: value });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
return previewInstance;
|
|
24
130
|
}
|
|
25
131
|
function createWatermarkOverlay(canvas) {
|
|
26
132
|
const parent = canvas.parentElement;
|
package/dist/js/createShader.js
CHANGED
|
@@ -48,7 +48,7 @@ async function createShader(canvas, preset, options) {
|
|
|
48
48
|
if (isExternalUser()) {
|
|
49
49
|
const checkRendering = () => {
|
|
50
50
|
if (renderer.getPerformanceStats().fps > 0) {
|
|
51
|
-
telemetryCollector = startTelemetry(renderer, "2.5.
|
|
51
|
+
telemetryCollector = startTelemetry(renderer, "2.5.116", options?.disableTelemetry || false, false);
|
|
52
52
|
if (telemetryCollector) telemetryCollector.start();
|
|
53
53
|
telemetryStartTimeout = null;
|
|
54
54
|
} else telemetryStartTimeout = setTimeout(checkRendering, 500);
|
package/dist/js/types.d.ts
CHANGED
|
@@ -40,10 +40,42 @@ export interface ShaderOptions {
|
|
|
40
40
|
adapter: GPUAdapter;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
export interface KeyPropTarget {
|
|
44
|
+
component_id: string;
|
|
45
|
+
prop: string;
|
|
46
|
+
}
|
|
47
|
+
export interface KeyProp {
|
|
48
|
+
label: string;
|
|
49
|
+
type: 'color' | 'range' | 'logo' | 'image';
|
|
50
|
+
category?: string;
|
|
51
|
+
targets: KeyPropTarget[];
|
|
52
|
+
}
|
|
43
53
|
export interface PreviewOptions {
|
|
44
54
|
shader?: string;
|
|
45
55
|
presetId?: string;
|
|
46
56
|
apiBaseUrl?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Map of camelCase key_prop identifier → user value, layered on top of the
|
|
59
|
+
* preset's authored defaults. Identifiers are derived from `key_prop.label`
|
|
60
|
+
* via the same slugify rules the Pro Framer exporter uses, so identifiers
|
|
61
|
+
* generated by codegen and identifiers expected here always match.
|
|
62
|
+
*
|
|
63
|
+
* Only applies on the `presetId` path — `shader` token previews don't carry
|
|
64
|
+
* key_props and silently ignore this option.
|
|
65
|
+
*/
|
|
66
|
+
configuration?: Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Lock the preview to a specific snapshot of the preset, addressed by
|
|
69
|
+
* content hash. Customized snippets pin a version so subsequent upstream
|
|
70
|
+
* edits don't silently break the configuration. Server falls back to
|
|
71
|
+
* latest with the `X-Shaders-Version-Fallback` header when the requested
|
|
72
|
+
* snapshot is missing. Only meaningful on the `presetId` path.
|
|
73
|
+
*/
|
|
74
|
+
version?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface PreviewInstance extends ShaderInstance {
|
|
77
|
+
/** Replace the active configuration. Re-applies values to the live shader without refetching. */
|
|
78
|
+
setConfiguration(configuration: Record<string, unknown>): void;
|
|
47
79
|
}
|
|
48
80
|
export interface ShaderInstance {
|
|
49
81
|
update(componentId: string, props: Record<string, any>): void;
|