shaders 2.2.30 → 2.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/core/{Beam-DCaOPIk_.js → Beam-CbG4MkLo.js} +2 -3
  2. package/dist/core/{Blob-8YqXuE5v.js → Blob-C_fYRjJF.js} +2 -3
  3. package/dist/core/{Bulge-D9mLn8-p.js → Bulge-C8-_hIFp.js} +1 -20
  4. package/dist/core/{Checkerboard-DjrQsDvl.js → Checkerboard-D_H3XYbF.js} +2 -3
  5. package/dist/core/{Circle-BSAdYHYZ.js → Circle-DI0gXpyD.js} +2 -3
  6. package/dist/core/{DiffuseBlur-B-QHWSjt.js → DiffuseBlur-Cg7AsB3W.js} +1 -12
  7. package/dist/core/{DotGrid-BJyEY7YH.js → DotGrid-B2DXsjFE.js} +2 -3
  8. package/dist/core/{FilmGrain-osBGk_b9.js → FilmGrain-CY4ZO9UI.js} +2 -3
  9. package/dist/core/{FloatingParticles-Ct7GMVzZ.js → FloatingParticles-BduIDXKd.js} +2 -3
  10. package/dist/core/GlassTiles-BaAwsNxl.js +84 -0
  11. package/dist/core/{Godrays-fJIUiGke.js → Godrays-ChqiT2zn.js} +2 -3
  12. package/dist/core/{Grid-o_nFs0CE.js → Grid-DazyiX15.js} +2 -3
  13. package/dist/core/{GridDistortion-xuUXyMGP.js → GridDistortion-CYQUwuXw.js} +1 -1
  14. package/dist/core/{ImageTexture-D9OMwqAs.js → ImageTexture-D0xwHmkW.js} +2 -3
  15. package/dist/core/{LinearGradient-DN_FYXL2.js → LinearGradient-B6ySxWpU.js} +2 -3
  16. package/dist/core/{Liquify-Qm_y-apj.js → Liquify-yoKWSK0F.js} +1 -7
  17. package/dist/core/{Pixelate-_pyYeLRP.js → Pixelate-BmE_Zryn.js} +0 -4
  18. package/dist/core/{PolarCoordinates-DfjOpgDQ.js → PolarCoordinates-PLyS00-P.js} +1 -10
  19. package/dist/core/{RadialGradient-DGmfTA60.js → RadialGradient-pwKyDUBu.js} +2 -3
  20. package/dist/core/{RectangularCoordinates-TM8tkEBk.js → RectangularCoordinates-Dq2JrmOX.js} +1 -10
  21. package/dist/core/{Ripples-D60vIa8s.js → Ripples-Ot1rx8kL.js} +2 -3
  22. package/dist/core/{SimplexNoise-CI-FEJ6v.js → SimplexNoise-BfilWh05.js} +2 -3
  23. package/dist/core/{SineWave-CQIQ0oCt.js → SineWave-DRqL-jda.js} +2 -3
  24. package/dist/core/{SolidColor-CTN8J944.js → SolidColor-B62ZBRlK.js} +0 -1
  25. package/dist/core/{Spiral-DIzFj8Xi.js → Spiral-Cx7Z8gLc.js} +2 -3
  26. package/dist/core/{Strands-WwfH6CNO.js → Strands-C9FBVtDe.js} +2 -3
  27. package/dist/core/{Stretch-DxuMSLMk.js → Stretch-BCpOO3q6.js} +1 -20
  28. package/dist/core/Swirl-BfD35doJ.js +96 -0
  29. package/dist/core/{Twirl-DRomCc8u.js → Twirl-EJ3aS_lo.js} +1 -11
  30. package/dist/core/{WaveDistortion-Btn7OJ4m.js → WaveDistortion-BOWBSWEU.js} +1 -23
  31. package/dist/core/{edges-Djr_12SL.js → edges-Bd7GP4s2.js} +1 -10
  32. package/dist/core/index.js +107 -588
  33. package/dist/core/renderer.d.ts +0 -21
  34. package/dist/core/renderer.d.ts.map +1 -1
  35. package/dist/core/shaders/Beam/index.d.ts.map +1 -1
  36. package/dist/core/shaders/Beam/index.js +1 -1
  37. package/dist/core/shaders/Blob/index.d.ts.map +1 -1
  38. package/dist/core/shaders/Blob/index.js +1 -1
  39. package/dist/core/shaders/Bulge/index.d.ts.map +1 -1
  40. package/dist/core/shaders/Bulge/index.js +2 -2
  41. package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
  42. package/dist/core/shaders/Checkerboard/index.js +1 -1
  43. package/dist/core/shaders/Circle/index.d.ts.map +1 -1
  44. package/dist/core/shaders/Circle/index.js +1 -1
  45. package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
  46. package/dist/core/shaders/DiffuseBlur/index.js +2 -2
  47. package/dist/core/shaders/DotGrid/index.d.ts.map +1 -1
  48. package/dist/core/shaders/DotGrid/index.js +1 -1
  49. package/dist/core/shaders/FilmGrain/index.d.ts.map +1 -1
  50. package/dist/core/shaders/FilmGrain/index.js +1 -1
  51. package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
  52. package/dist/core/shaders/FloatingParticles/index.js +1 -1
  53. package/dist/core/shaders/GlassTiles/index.d.ts +18 -4
  54. package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
  55. package/dist/core/shaders/GlassTiles/index.js +1 -1
  56. package/dist/core/shaders/Godrays/index.d.ts.map +1 -1
  57. package/dist/core/shaders/Godrays/index.js +1 -1
  58. package/dist/core/shaders/Grid/index.d.ts.map +1 -1
  59. package/dist/core/shaders/Grid/index.js +1 -1
  60. package/dist/core/shaders/GridDistortion/index.js +2 -2
  61. package/dist/core/shaders/ImageTexture/index.d.ts.map +1 -1
  62. package/dist/core/shaders/ImageTexture/index.js +1 -1
  63. package/dist/core/shaders/LinearGradient/index.d.ts.map +1 -1
  64. package/dist/core/shaders/LinearGradient/index.js +1 -1
  65. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  66. package/dist/core/shaders/Liquify/index.js +2 -2
  67. package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
  68. package/dist/core/shaders/Pixelate/index.js +1 -1
  69. package/dist/core/shaders/PolarCoordinates/index.d.ts.map +1 -1
  70. package/dist/core/shaders/PolarCoordinates/index.js +2 -2
  71. package/dist/core/shaders/RadialGradient/index.d.ts.map +1 -1
  72. package/dist/core/shaders/RadialGradient/index.js +1 -1
  73. package/dist/core/shaders/RectangularCoordinates/index.d.ts.map +1 -1
  74. package/dist/core/shaders/RectangularCoordinates/index.js +2 -2
  75. package/dist/core/shaders/Ripples/index.d.ts.map +1 -1
  76. package/dist/core/shaders/Ripples/index.js +1 -1
  77. package/dist/core/shaders/SimplexNoise/index.d.ts.map +1 -1
  78. package/dist/core/shaders/SimplexNoise/index.js +1 -1
  79. package/dist/core/shaders/SineWave/index.d.ts.map +1 -1
  80. package/dist/core/shaders/SineWave/index.js +1 -1
  81. package/dist/core/shaders/SolidColor/index.d.ts.map +1 -1
  82. package/dist/core/shaders/SolidColor/index.js +1 -1
  83. package/dist/core/shaders/Spiral/index.d.ts.map +1 -1
  84. package/dist/core/shaders/Spiral/index.js +1 -1
  85. package/dist/core/shaders/Strands/index.d.ts.map +1 -1
  86. package/dist/core/shaders/Strands/index.js +1 -1
  87. package/dist/core/shaders/Stretch/index.d.ts.map +1 -1
  88. package/dist/core/shaders/Stretch/index.js +2 -2
  89. package/dist/core/shaders/Swirl/index.d.ts +1 -43
  90. package/dist/core/shaders/Swirl/index.d.ts.map +1 -1
  91. package/dist/core/shaders/Swirl/index.js +1 -1
  92. package/dist/core/shaders/Twirl/index.d.ts.map +1 -1
  93. package/dist/core/shaders/Twirl/index.js +2 -2
  94. package/dist/core/shaders/WaveDistortion/index.d.ts.map +1 -1
  95. package/dist/core/shaders/WaveDistortion/index.js +2 -2
  96. package/dist/core/types.d.ts +0 -81
  97. package/dist/core/types.d.ts.map +1 -1
  98. package/dist/react/{generatePresetCode-CCibXbtZ.js → generatePresetCode-Ci4D5lDy.js} +41 -12
  99. package/dist/react/index.js +1 -1
  100. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  101. package/dist/react/utils/generatePresetCode.js +1 -1
  102. package/dist/react/utils/generatePresetCode.template.d.ts.map +1 -1
  103. package/dist/registry.js +60 -167
  104. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  105. package/dist/solid/utils/generatePresetCode.js +56 -10
  106. package/dist/solid/utils/generatePresetCode.template.d.ts.map +1 -1
  107. package/dist/svelte/{generatePresetCode-CymgoDq_.js → generatePresetCode-hILbcEw8.js} +41 -12
  108. package/dist/svelte/index.js +1 -1
  109. package/dist/svelte/utils/generatePresetCode.js +1 -1
  110. package/dist/vue/{generatePresetCode-CRJmU8iF.js → generatePresetCode-DfkHaBG4.js} +36 -12
  111. package/dist/vue/index.js +5 -9
  112. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  113. package/dist/vue/utils/generatePresetCode.js +1 -1
  114. package/dist/vue/utils/generatePresetCode.template.d.ts.map +1 -1
  115. package/package.json +1 -1
  116. package/dist/core/GlassTiles-CA90XrNT.js +0 -67
  117. package/dist/core/Swirl-SrhhoVBs.js +0 -172
@@ -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;AA6lBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UAyD/B,CAAA"}
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;AAupBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UAyD/B,CAAA"}
@@ -1,3 +1,19 @@
1
+ const DEFAULT_TRANSFORM = {
2
+ offsetX: 0,
3
+ offsetY: 0,
4
+ rotation: 0,
5
+ scale: 1,
6
+ anchorX: 0.5,
7
+ anchorY: 0.5,
8
+ edges: "transparent"
9
+ };
10
+ function toObjectLiteral(obj) {
11
+ const entries = Object.entries(obj).map(([key, value]) => {
12
+ const valueStr = typeof value === "string" ? `"${value}"` : value;
13
+ return `${key}: ${valueStr}`;
14
+ });
15
+ return `{ ${entries.join(", ")} }`;
16
+ }
1
17
  const shaderMetadata = {
2
18
  "AngularBlur": {
3
19
  "opacity": 1,
@@ -194,8 +210,10 @@ const shaderMetadata = {
194
210
  "GlassTiles": {
195
211
  "opacity": 1,
196
212
  "blendMode": "normal",
197
- "intensity": 1,
198
- "tileCount": 100
213
+ "intensity": 2,
214
+ "tileCount": 20,
215
+ "rotation": 0,
216
+ "roundness": 0
199
217
  },
200
218
  "Glow": {
201
219
  "opacity": 1,
@@ -476,12 +494,6 @@ const shaderMetadata = {
476
494
  "speed": 1,
477
495
  "detail": 1,
478
496
  "blend": 50,
479
- "coarseX": 50,
480
- "coarseY": 50,
481
- "mediumX": 50,
482
- "mediumY": 50,
483
- "fineX": 50,
484
- "fineY": 50,
485
497
  "colorSpace": "linear"
486
498
  },
487
499
  "TiltShift": {
@@ -541,7 +553,14 @@ const shaderMetadata = {
541
553
  }
542
554
  };
543
555
  function generatePropString(props, componentType, indent = " ") {
544
- return Object.entries(props).filter(([key, value]) => {
556
+ return Object.entries(props).sort(([a], [b]) => a.localeCompare(b)).filter(([key, value]) => {
557
+ if (key === "maskType" && value === "alpha") return false;
558
+ if (key === "transform" && typeof value === "object") {
559
+ const allDefaults = Object.keys(DEFAULT_TRANSFORM).every(
560
+ (k) => value[k] === DEFAULT_TRANSFORM[k]
561
+ );
562
+ if (allDefaults) return false;
563
+ }
545
564
  const componentDefaults = shaderMetadata[componentType] || {};
546
565
  if (componentDefaults.hasOwnProperty(key)) {
547
566
  const defaultValue = componentDefaults[key];
@@ -554,10 +573,37 @@ function generatePropString(props, componentType, indent = " ") {
554
573
  if (key === "blendMode" && value === "normal") return false;
555
574
  return true;
556
575
  }).map(([key, value]) => {
576
+ if (key === "transform" && typeof value === "object") {
577
+ const nonDefaultKeys = {};
578
+ for (const k in value) {
579
+ if (value[k] !== DEFAULT_TRANSFORM[k]) {
580
+ nonDefaultKeys[k] = value[k];
581
+ }
582
+ }
583
+ const keys = Object.keys(nonDefaultKeys).sort();
584
+ if (keys.length > 1) {
585
+ const entries = keys.map((k) => `${k}: ${typeof nonDefaultKeys[k] === "string" ? `"${nonDefaultKeys[k]}"` : nonDefaultKeys[k]}`);
586
+ return `${key}={{
587
+ ${indent} ${entries.join(`,
588
+ ${indent} `)}
589
+ ${indent} }}`;
590
+ } else if (keys.length === 1) {
591
+ const k = keys[0];
592
+ const v = nonDefaultKeys[k];
593
+ return `${key}={{ ${k}: ${typeof v === "string" ? `"${v}"` : v} }}`;
594
+ }
595
+ }
557
596
  if (typeof value === "string") {
558
597
  return `${key}=${JSON.stringify(value)}`;
559
598
  } else if (value !== null && typeof value === "object") {
560
- return `${key}={${JSON.stringify(value)}}`;
599
+ const roundedValue = { ...value };
600
+ if ("x" in roundedValue && typeof roundedValue.x === "number") {
601
+ roundedValue.x = Math.round(roundedValue.x * 100) / 100;
602
+ }
603
+ if ("y" in roundedValue && typeof roundedValue.y === "number") {
604
+ roundedValue.y = Math.round(roundedValue.y * 100) / 100;
605
+ }
606
+ return `${key}={${toObjectLiteral(roundedValue)}}`;
561
607
  } else {
562
608
  return `${key}={${value}}`;
563
609
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generatePresetCode.template.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.template.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;AAgED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,OAG/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.template.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.template.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;AA8HD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,OAG/B,CAAA"}
@@ -1,3 +1,17 @@
1
+ var DEFAULT_TRANSFORM = {
2
+ offsetX: 0,
3
+ offsetY: 0,
4
+ rotation: 0,
5
+ scale: 1,
6
+ anchorX: .5,
7
+ anchorY: .5,
8
+ edges: "transparent"
9
+ };
10
+ function toObjectLiteral(obj) {
11
+ return `{ ${Object.entries(obj).map(([key, value]) => {
12
+ return `${key}: ${typeof value === "string" ? `"${value}"` : value}`;
13
+ }).join(", ")} }`;
14
+ }
1
15
  var shaderMetadata = {
2
16
  "AngularBlur": {
3
17
  "opacity": 1,
@@ -194,8 +208,10 @@ var shaderMetadata = {
194
208
  "GlassTiles": {
195
209
  "opacity": 1,
196
210
  "blendMode": "normal",
197
- "intensity": 1,
198
- "tileCount": 100
211
+ "intensity": 2,
212
+ "tileCount": 20,
213
+ "rotation": 0,
214
+ "roundness": 0
199
215
  },
200
216
  "Glow": {
201
217
  "opacity": 1,
@@ -476,12 +492,6 @@ var shaderMetadata = {
476
492
  "speed": 1,
477
493
  "detail": 1,
478
494
  "blend": 50,
479
- "coarseX": 50,
480
- "coarseY": 50,
481
- "mediumX": 50,
482
- "mediumY": 50,
483
- "fineX": 50,
484
- "fineY": 50,
485
495
  "colorSpace": "linear"
486
496
  },
487
497
  "TiltShift": {
@@ -541,20 +551,39 @@ var shaderMetadata = {
541
551
  }
542
552
  };
543
553
  function generatePropString(props, componentType, indent = " ") {
544
- return Object.entries(props).filter(([key, value]) => {
554
+ return Object.entries(props).sort(([a], [b]) => a.localeCompare(b)).filter(([key, value]) => {
555
+ if (key === "maskType" && value === "alpha") return false;
556
+ if (key === "transform" && typeof value === "object") {
557
+ if (Object.keys(DEFAULT_TRANSFORM).every((k) => value[k] === DEFAULT_TRANSFORM[k])) return false;
558
+ }
545
559
  const componentDefaults = shaderMetadata[componentType] || {};
546
560
  if (componentDefaults.hasOwnProperty(key)) {
547
561
  const defaultValue = componentDefaults[key];
548
- if (typeof value === "object" && typeof defaultValue === "object") return JSON.stringify(value) !== JSON.stringify(defaultValue);
562
+ if (value != null && defaultValue != null && typeof value === "object" && typeof defaultValue === "object") return JSON.stringify(value) !== JSON.stringify(defaultValue);
549
563
  return value !== defaultValue;
550
564
  }
551
565
  if (key === "opacity" && value === 1) return false;
552
566
  if (key === "blendMode" && value === "normal") return false;
553
567
  return true;
554
568
  }).map(([key, value]) => {
569
+ if (key === "transform" && typeof value === "object") {
570
+ const nonDefaultKeys = {};
571
+ for (const k in value) if (value[k] !== DEFAULT_TRANSFORM[k]) nonDefaultKeys[k] = value[k];
572
+ const keys = Object.keys(nonDefaultKeys).sort();
573
+ if (keys.length > 1) return `${key}={{\n${indent} ${keys.map((k) => `${k}: ${typeof nonDefaultKeys[k] === "string" ? `"${nonDefaultKeys[k]}"` : nonDefaultKeys[k]}`).join(`,\n${indent} `)}\n${indent} }}`;
574
+ else if (keys.length === 1) {
575
+ const k = keys[0];
576
+ const v = nonDefaultKeys[k];
577
+ return `${key}={{ ${k}: ${typeof v === "string" ? `"${v}"` : v} }}`;
578
+ }
579
+ }
555
580
  if (typeof value === "string") return `${key}="${value}"`;
556
- else if (typeof value === "object") return `${key}={${JSON.stringify(value)}}`;
557
- else return `${key}={${value}}`;
581
+ else if (value !== null && typeof value === "object") {
582
+ const roundedValue = { ...value };
583
+ if ("x" in roundedValue && typeof roundedValue.x === "number") roundedValue.x = Math.round(roundedValue.x * 100) / 100;
584
+ if ("y" in roundedValue && typeof roundedValue.y === "number") roundedValue.y = Math.round(roundedValue.y * 100) / 100;
585
+ return `${key}={${toObjectLiteral(roundedValue)}}`;
586
+ } else return `${key}={${value}}`;
558
587
  }).join("\n" + indent + " ");
559
588
  }
560
589
  function isIdUsedAsMaskSource(id, allComponents) {
@@ -1,4 +1,4 @@
1
- import { n as generatePresetCode } from "./generatePresetCode-CymgoDq_.js";
1
+ import { n as generatePresetCode } from "./generatePresetCode-hILbcEw8.js";
2
2
  import "svelte/internal/disclose-version";
3
3
  import * as $ from "svelte/internal/client";
4
4
  import { getContext, onDestroy, onMount, setContext } from "svelte";
@@ -1,2 +1,2 @@
1
- import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-CymgoDq_.js";
1
+ import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-hILbcEw8.js";
2
2
  export { availableComponents, generatePresetCode };
@@ -1,6 +1,15 @@
1
1
  function camelToKebab(str) {
2
2
  return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
3
3
  }
4
+ var DEFAULT_TRANSFORM = {
5
+ offsetX: 0,
6
+ offsetY: 0,
7
+ rotation: 0,
8
+ scale: 1,
9
+ anchorX: .5,
10
+ anchorY: .5,
11
+ edges: "transparent"
12
+ };
4
13
  var shaderMetadata = {
5
14
  "AngularBlur": {
6
15
  "opacity": 1,
@@ -197,8 +206,10 @@ var shaderMetadata = {
197
206
  "GlassTiles": {
198
207
  "opacity": 1,
199
208
  "blendMode": "normal",
200
- "intensity": 1,
201
- "tileCount": 100
209
+ "intensity": 2,
210
+ "tileCount": 20,
211
+ "rotation": 0,
212
+ "roundness": 0
202
213
  },
203
214
  "Glow": {
204
215
  "opacity": 1,
@@ -479,12 +490,6 @@ var shaderMetadata = {
479
490
  "speed": 1,
480
491
  "detail": 1,
481
492
  "blend": 50,
482
- "coarseX": 50,
483
- "coarseY": 50,
484
- "mediumX": 50,
485
- "mediumY": 50,
486
- "fineX": 50,
487
- "fineY": 50,
488
493
  "colorSpace": "linear"
489
494
  },
490
495
  "TiltShift": {
@@ -544,11 +549,15 @@ var shaderMetadata = {
544
549
  }
545
550
  };
546
551
  function generatePropString(props, componentType, indent = " ") {
547
- return Object.entries(props).filter(([key, value]) => {
552
+ return Object.entries(props).sort(([a], [b]) => a.localeCompare(b)).filter(([key, value]) => {
553
+ if (key === "maskType" && value === "alpha") return false;
554
+ if (key === "transform" && typeof value === "object") {
555
+ if (Object.keys(DEFAULT_TRANSFORM).every((k) => value[k] === DEFAULT_TRANSFORM[k])) return false;
556
+ }
548
557
  const componentDefaults = shaderMetadata[componentType] || {};
549
558
  if (componentDefaults.hasOwnProperty(key)) {
550
559
  const defaultValue = componentDefaults[key];
551
- if (typeof value === "object" && typeof defaultValue === "object") return JSON.stringify(value) !== JSON.stringify(defaultValue);
560
+ if (value != null && defaultValue != null && typeof value === "object" && typeof defaultValue === "object") return JSON.stringify(value) !== JSON.stringify(defaultValue);
552
561
  return value !== defaultValue;
553
562
  }
554
563
  if (key === "opacity" && value === 1) return false;
@@ -556,9 +565,24 @@ function generatePropString(props, componentType, indent = " ") {
556
565
  return true;
557
566
  }).map(([key, value]) => {
558
567
  const kebabKey = camelToKebab(key);
568
+ if (key === "transform" && typeof value === "object") {
569
+ const nonDefaultKeys = {};
570
+ for (const k in value) if (value[k] !== DEFAULT_TRANSFORM[k]) nonDefaultKeys[k] = value[k];
571
+ const keys = Object.keys(nonDefaultKeys).sort();
572
+ if (keys.length > 1) return `:${kebabKey}="{\n${indent} ${keys.map((k) => `'${k}':${typeof nonDefaultKeys[k] === "string" ? `'${nonDefaultKeys[k]}'` : nonDefaultKeys[k]}`).join(`,\n${indent} `)}\n${indent} }"`;
573
+ else if (keys.length === 1) {
574
+ const k = keys[0];
575
+ const v = nonDefaultKeys[k];
576
+ return `:${kebabKey}="{'${k}':${typeof v === "string" ? `'${v}'` : v}}"`;
577
+ }
578
+ }
559
579
  if (typeof value === "string") return `${kebabKey}="${value}"`;
560
- else if (typeof value === "object") return `:${kebabKey}="${JSON.stringify(value).replace(/"/g, "'").replace(/'/g, "'")}"`;
561
- else return `:${kebabKey}="${value}"`;
580
+ else if (value !== null && typeof value === "object") {
581
+ const roundedValue = { ...value };
582
+ if ("x" in roundedValue && typeof roundedValue.x === "number") roundedValue.x = Math.round(roundedValue.x * 100) / 100;
583
+ if ("y" in roundedValue && typeof roundedValue.y === "number") roundedValue.y = Math.round(roundedValue.y * 100) / 100;
584
+ return `:${kebabKey}="${JSON.stringify(roundedValue).replace(/"/g, "'")}"`;
585
+ } else return `:${kebabKey}="${value}"`;
562
586
  }).join("\n" + indent + " ");
563
587
  }
564
588
  function isIdUsedAsMaskSource(id, allComponents) {
package/dist/vue/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as generatePresetCode } from "./generatePresetCode-CRJmU8iF.js";
1
+ import { n as generatePresetCode } from "./generatePresetCode-DfkHaBG4.js";
2
2
  import { computed, createElementBlock, createElementVNode, defineComponent, effectScope, inject, mergeDefaults, mergeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderSlot, toValue, watch } from "vue";
3
3
  import { createUniformsMap, shaderRenderer } from "../core/index.js";
4
4
  import { componentDefinition } from "../core/shaders/AngularBlur/index.js";
@@ -2429,7 +2429,9 @@ var GlassTiles_default = /* @__PURE__ */ defineComponent({
2429
2429
  renderOrder: {},
2430
2430
  transform: {},
2431
2431
  intensity: {},
2432
- tileCount: {}
2432
+ tileCount: {},
2433
+ rotation: {},
2434
+ roundness: {}
2433
2435
  }, {
2434
2436
  blendMode: "normal",
2435
2437
  renderOrder: 0,
@@ -6000,13 +6002,7 @@ var Swirl_default = /* @__PURE__ */ defineComponent({
6000
6002
  speed: {},
6001
6003
  detail: {},
6002
6004
  blend: {},
6003
- coarseX: {},
6004
- coarseY: {},
6005
- colorSpace: {},
6006
- mediumX: {},
6007
- mediumY: {},
6008
- fineX: {},
6009
- fineY: {}
6005
+ colorSpace: {}
6010
6006
  }, {
6011
6007
  blendMode: "normal",
6012
6008
  renderOrder: 0,
@@ -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;AAgmBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UAyD/B,CAAA"}
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;AAkpBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,UAyD/B,CAAA"}
@@ -1,2 +1,2 @@
1
- import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-CRJmU8iF.js";
1
+ import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-DfkHaBG4.js";
2
2
  export { availableComponents, generatePresetCode };
@@ -1 +1 @@
1
- {"version":3,"file":"generatePresetCode.template.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.template.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;AAmED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,OAG/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.template.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.template.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;AAyHD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyC/D;AAGD,eAAO,MAAM,mBAAmB,OAG/B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shaders",
3
- "version": "2.2.30",
3
+ "version": "2.2.32",
4
4
  "description": "Declarative shader components for Vue, React, and Svelte",
5
5
  "author": "Simon Le Marchant<https://github.com/marchantweb>",
6
6
  "homepage": "https://shaders.com/",
@@ -1,67 +0,0 @@
1
- import { add, convertToTexture, div, floor, mul, screenUV, select, sub, uniform, vec2, vec4 } from "three/tsl";
2
- const componentDefinition = {
3
- name: "GlassTiles",
4
- category: "Distortions",
5
- description: "Refraction-like distortion in a tile grid pattern",
6
- requiresRTT: true,
7
- requiresChild: true,
8
- props: {
9
- intensity: {
10
- default: 1,
11
- description: "The intensity of the glass tiles effect",
12
- ui: {
13
- type: "range",
14
- min: 0,
15
- max: 5,
16
- step: .1,
17
- label: "Intensity"
18
- }
19
- },
20
- tileCount: {
21
- default: 100,
22
- description: "Number of tiles across the shortest dimension",
23
- ui: {
24
- type: "range",
25
- min: 1,
26
- max: 200,
27
- step: 1,
28
- label: "Tile Count"
29
- }
30
- }
31
- },
32
- uvTransformNode: ({ uv: uv$1, uniforms, viewportSize: viewportSize$1 }) => {
33
- const intensity = uniforms.intensity.uniform;
34
- const baseTileCount = uniforms.tileCount.uniform;
35
- const aspectRatio = viewportSize$1.x.div(viewportSize$1.y);
36
- const tileCount = vec2(select(aspectRatio.greaterThanEqual(1), baseTileCount.mul(aspectRatio), baseTileCount), select(aspectRatio.lessThan(1), baseTileCount.div(aspectRatio), baseTileCount));
37
- const cellCoord = floor(uv$1.mul(tileCount)).div(tileCount);
38
- const localUV = uv$1.sub(cellCoord);
39
- const distortionCenter = vec2(.5, .5);
40
- const distortionFactor = intensity.mul(.025);
41
- const distortion = localUV.div(vec2(1, 1).div(tileCount)).sub(distortionCenter).mul(distortionFactor);
42
- return localUV.add(distortion).add(cellCoord);
43
- },
44
- fragmentNode: ({ uniforms, childNode, dimensions, onCleanup }) => {
45
- if (!childNode) {
46
- console.error("You must pass a child component into the Glass Tiles shader.");
47
- return vec4(0);
48
- }
49
- const texture$1 = convertToTexture(childNode);
50
- onCleanup(() => {
51
- if (texture$1?.renderTarget?.dispose) texture$1.renderTarget.dispose();
52
- });
53
- const aspectRatioUniform = uniform(dimensions.width / dimensions.height);
54
- const uvNode = screenUV;
55
- const intensity = uniforms.intensity.uniform;
56
- const baseTileCount = uniforms.tileCount.uniform;
57
- const tileCount = vec2(aspectRatioUniform.greaterThanEqual(1).select(mul(baseTileCount, aspectRatioUniform), baseTileCount), aspectRatioUniform.lessThan(1).select(div(baseTileCount, aspectRatioUniform), baseTileCount));
58
- const cellCoord = div(floor(mul(uvNode, tileCount)), tileCount);
59
- const localUV = sub(uvNode, cellCoord);
60
- const distortionCenter = vec2(.5, .5);
61
- const distortionFactor = mul(intensity, .025);
62
- const finalUV = add(add(localUV, mul(sub(div(localUV, div(vec2(1), tileCount)), distortionCenter), distortionFactor)), cellCoord);
63
- return vec4(texture$1.sample(finalUV));
64
- }
65
- };
66
- var GlassTiles_default = componentDefinition;
67
- export { componentDefinition as n, GlassTiles_default as t };
@@ -1,172 +0,0 @@
1
- import { i as transformColorSpace, r as transformColor, t as colorSpaceOptions } from "./transformations-YbhRK-rd.js";
2
- import { t as createAnimatedTime } from "./time-DgRTVr2F.js";
3
- import { t as mixColors } from "./colorMixing-CZPFmiT4.js";
4
- import { cos, float, screenUV, sin, smoothstep, vec2, vec4 } from "three/tsl";
5
- const componentDefinition = {
6
- name: "Swirl",
7
- category: "Base Layers",
8
- description: "Flowing swirl pattern with multi-layered noise",
9
- acceptsUVContext: true,
10
- props: {
11
- colorA: {
12
- default: "#1275d8",
13
- description: "Primary gradient color",
14
- transform: transformColor,
15
- ui: {
16
- type: "color",
17
- label: "Primary Color"
18
- }
19
- },
20
- colorB: {
21
- default: "#e19136",
22
- description: "Secondary gradient color",
23
- transform: transformColor,
24
- ui: {
25
- type: "color",
26
- label: "Secondary Color"
27
- }
28
- },
29
- speed: {
30
- default: 1,
31
- description: "Flow animation speed",
32
- ui: {
33
- type: "range",
34
- min: 0,
35
- max: 5,
36
- step: .1,
37
- label: "Speed"
38
- }
39
- },
40
- detail: {
41
- default: 1,
42
- description: "Level of detail and intricacy in the swirl patterns",
43
- ui: {
44
- type: "range",
45
- min: 0,
46
- max: 10,
47
- step: .1,
48
- label: "Detail"
49
- }
50
- },
51
- blend: {
52
- default: 50,
53
- description: "Skew color balance toward A (lower values) or B (higher values)",
54
- ui: {
55
- type: "range",
56
- min: 0,
57
- max: 100,
58
- step: 1,
59
- label: "Blend"
60
- }
61
- },
62
- coarseX: {
63
- default: 50,
64
- description: "Horizontal frequency for coarse/base layer",
65
- ui: {
66
- type: "range",
67
- min: 0,
68
- max: 100,
69
- step: 1,
70
- label: "Coarse X"
71
- }
72
- },
73
- coarseY: {
74
- default: 50,
75
- description: "Vertical frequency for coarse/base layer",
76
- ui: {
77
- type: "range",
78
- min: 0,
79
- max: 100,
80
- step: 1,
81
- label: "Coarse Y"
82
- }
83
- },
84
- mediumX: {
85
- default: 50,
86
- description: "Horizontal frequency for medium detail layer",
87
- ui: {
88
- type: "range",
89
- min: 0,
90
- max: 100,
91
- step: 1,
92
- label: "Medium X"
93
- }
94
- },
95
- mediumY: {
96
- default: 50,
97
- description: "Vertical frequency for medium detail layer",
98
- ui: {
99
- type: "range",
100
- min: 0,
101
- max: 100,
102
- step: 1,
103
- label: "Medium Y"
104
- }
105
- },
106
- fineX: {
107
- default: 50,
108
- description: "Horizontal frequency for fine detail layer",
109
- ui: {
110
- type: "range",
111
- min: 0,
112
- max: 100,
113
- step: 1,
114
- label: "Fine X"
115
- }
116
- },
117
- fineY: {
118
- default: 50,
119
- description: "Vertical frequency for fine detail layer",
120
- ui: {
121
- type: "range",
122
- min: 0,
123
- max: 100,
124
- step: 1,
125
- label: "Fine Y"
126
- }
127
- },
128
- colorSpace: {
129
- default: "linear",
130
- transform: transformColorSpace,
131
- description: "Color space for color interpolation",
132
- ui: {
133
- type: "select",
134
- options: colorSpaceOptions,
135
- label: "Color Space"
136
- }
137
- }
138
- },
139
- fragmentNode: (params) => {
140
- const { uniforms, uvContext } = params;
141
- const uvCoords = uvContext ?? screenUV;
142
- const t = createAnimatedTime(params, uniforms.speed);
143
- const detail = uniforms.detail.uniform;
144
- const scaleCoarse = float(.02);
145
- const scaleMedium = float(.028);
146
- const scaleFine = float(.056);
147
- const freq1 = detail;
148
- const coarseScaleX = uniforms.coarseX.uniform.mul(scaleCoarse);
149
- const coarseScaleY = uniforms.coarseY.uniform.mul(scaleCoarse);
150
- const distort1 = vec2(uvCoords.x.add(sin(uvCoords.y.mul(freq1.mul(coarseScaleY).mul(1.7)).add(t.mul(.8))).mul(.12)), uvCoords.y.add(cos(uvCoords.x.mul(freq1.mul(coarseScaleX).mul(1.3)).sub(t.mul(.6))).mul(.12)));
151
- const pattern1 = sin(distort1.x.mul(freq1.mul(coarseScaleX).mul(2.1)).add(distort1.y.mul(freq1.mul(coarseScaleY).mul(1.8))).add(t.mul(.4)));
152
- const freq2 = detail.mul(1.4);
153
- const mediumScaleX = uniforms.mediumX.uniform.mul(scaleMedium);
154
- const mediumScaleY = uniforms.mediumY.uniform.mul(scaleMedium);
155
- const distort2 = vec2(distort1.x.add(cos(distort1.y.mul(freq2.mul(mediumScaleY).mul(1.9)).sub(t.mul(.5))).mul(.06)), distort1.y.add(sin(distort1.x.mul(freq2.mul(mediumScaleX).mul(2.3)).add(t.mul(.7))).mul(.06)));
156
- const pattern2 = cos(distort2.x.mul(freq2.mul(mediumScaleX).mul(1.6)).sub(distort2.y.mul(freq2.mul(mediumScaleY).mul(2.4))).add(t.mul(.3)));
157
- const freq3 = detail.mul(2.8);
158
- const fineScaleX = uniforms.fineX.uniform.mul(scaleFine);
159
- const fineScaleY = uniforms.fineY.uniform.mul(scaleFine);
160
- const distort3 = vec2(distort2.x.add(sin(distort2.y.mul(freq3.mul(fineScaleY).mul(1.1)).add(t.mul(.9))).mul(.03)), distort2.y.add(cos(distort2.x.mul(freq3.mul(fineScaleX).mul(.9)).sub(t.mul(.4))).mul(.03)));
161
- const pattern3 = sin(distort3.x.mul(freq3.mul(fineScaleX).mul(1.3)).add(distort3.y.mul(freq3.mul(fineScaleY).mul(1.7))).sub(t.mul(.6)));
162
- const combinedPattern = pattern1.mul(.5).add(pattern2.mul(.3)).add(pattern3.mul(.2));
163
- const blendBias = uniforms.blend.uniform.sub(50).mul(.006);
164
- const blendFactor = smoothstep(.3, .7, combinedPattern.mul(.5).add(.5).add(blendBias));
165
- const colorMix = mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, blendFactor, uniforms.colorSpace.uniform);
166
- const shimmer = sin(t.mul(2.5).add(combinedPattern.mul(8))).mul(.015).add(1);
167
- const finalColor = colorMix.mul(shimmer);
168
- return vec4(finalColor.rgb, finalColor.a);
169
- }
170
- };
171
- var Swirl_default = componentDefinition;
172
- export { componentDefinition as n, Swirl_default as t };