stickyflow 0.8.0 → 0.9.1

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 (63) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/dist/binding/index.cjs +9 -9
  4. package/dist/binding/index.d.cts +4 -4
  5. package/dist/binding/index.d.ts +4 -4
  6. package/dist/binding/index.js +3 -3
  7. package/dist/{chunk-VOYX6JMW.cjs → chunk-5EY7EK5V.cjs} +797 -669
  8. package/dist/chunk-5EY7EK5V.cjs.map +1 -0
  9. package/dist/{chunk-EDOPENSE.js → chunk-7ZEC7AB4.js} +228 -46
  10. package/dist/chunk-7ZEC7AB4.js.map +1 -0
  11. package/dist/{chunk-XPM3E7NV.cjs → chunk-BL5NCXS4.cjs} +23 -23
  12. package/dist/chunk-BL5NCXS4.cjs.map +1 -0
  13. package/dist/{chunk-LFEGZJWC.js → chunk-CM35H45Z.js} +3 -3
  14. package/dist/{chunk-LFEGZJWC.js.map → chunk-CM35H45Z.js.map} +1 -1
  15. package/dist/{chunk-GLZVHUSW.js → chunk-D2266VBZ.js} +393 -5
  16. package/dist/chunk-D2266VBZ.js.map +1 -0
  17. package/dist/{chunk-CZW3ARXQ.js → chunk-IKTSCLIK.js} +5 -5
  18. package/dist/chunk-IKTSCLIK.js.map +1 -0
  19. package/dist/{chunk-FQ7GMLCM.cjs → chunk-OUWGWDJ2.cjs} +15 -15
  20. package/dist/{chunk-FQ7GMLCM.cjs.map → chunk-OUWGWDJ2.cjs.map} +1 -1
  21. package/dist/{chunk-LNW5VIEA.cjs → chunk-QL7MNEMT.cjs} +393 -4
  22. package/dist/chunk-QL7MNEMT.cjs.map +1 -0
  23. package/dist/{chunk-IR2T47NW.cjs → chunk-RUSNRDLI.cjs} +257 -75
  24. package/dist/chunk-RUSNRDLI.cjs.map +1 -0
  25. package/dist/{chunk-MAPNY7MJ.js → chunk-TH2HFMEL.js} +147 -19
  26. package/dist/chunk-TH2HFMEL.js.map +1 -0
  27. package/dist/index.cjs +36 -36
  28. package/dist/index.d.cts +5 -5
  29. package/dist/index.d.ts +5 -5
  30. package/dist/index.js +5 -5
  31. package/dist/interaction/index.cjs +232 -230
  32. package/dist/interaction/index.cjs.map +1 -1
  33. package/dist/interaction/index.d.cts +2 -2
  34. package/dist/interaction/index.d.ts +2 -2
  35. package/dist/interaction/index.js +4 -2
  36. package/dist/interaction/index.js.map +1 -1
  37. package/dist/{render-Bp2FLEzv.d.cts → render-DU4lYbRl.d.cts} +19 -11
  38. package/dist/{render-Bp2FLEzv.d.ts → render-DU4lYbRl.d.ts} +19 -11
  39. package/dist/{runtime-DIag-XBa.d.cts → runtime-DG8X3Fwf.d.cts} +2 -2
  40. package/dist/{runtime-CWIGxRcL.d.ts → runtime-kqD1RS17.d.ts} +2 -2
  41. package/dist/{runtimeTypes-C7sSLfOK.d.ts → runtimeTypes-CvjlBZds.d.cts} +7 -3
  42. package/dist/{runtimeTypes-BYODuxHk.d.cts → runtimeTypes-vRaHOIHi.d.ts} +7 -3
  43. package/dist/stickyflow-diagram.global.js +192 -40
  44. package/dist/stickyflow-diagram.global.js.map +1 -1
  45. package/dist/{types-D2w6D_wG.d.cts → types-B5jrEEcF.d.cts} +1 -1
  46. package/dist/{types-B9QM_H3R.d.ts → types-B7IkZ0w4.d.ts} +1 -1
  47. package/dist/viewer/index.cjs +9 -9
  48. package/dist/viewer/index.d.cts +4 -4
  49. package/dist/viewer/index.d.ts +4 -4
  50. package/dist/viewer/index.js +4 -4
  51. package/dist/web-component/index.cjs +6 -6
  52. package/dist/web-component/index.d.cts +2 -2
  53. package/dist/web-component/index.d.ts +2 -2
  54. package/dist/web-component/index.js +4 -4
  55. package/package.json +1 -1
  56. package/dist/chunk-CZW3ARXQ.js.map +0 -1
  57. package/dist/chunk-EDOPENSE.js.map +0 -1
  58. package/dist/chunk-GLZVHUSW.js.map +0 -1
  59. package/dist/chunk-IR2T47NW.cjs.map +0 -1
  60. package/dist/chunk-LNW5VIEA.cjs.map +0 -1
  61. package/dist/chunk-MAPNY7MJ.js.map +0 -1
  62. package/dist/chunk-VOYX6JMW.cjs.map +0 -1
  63. package/dist/chunk-XPM3E7NV.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkVOYX6JMW_cjs = require('./chunk-VOYX6JMW.cjs');
4
- var chunkFQ7GMLCM_cjs = require('./chunk-FQ7GMLCM.cjs');
5
- var chunkLNW5VIEA_cjs = require('./chunk-LNW5VIEA.cjs');
3
+ var chunk5EY7EK5V_cjs = require('./chunk-5EY7EK5V.cjs');
4
+ var chunkOUWGWDJ2_cjs = require('./chunk-OUWGWDJ2.cjs');
5
+ var chunkQL7MNEMT_cjs = require('./chunk-QL7MNEMT.cjs');
6
6
 
7
7
  // src/runtime/viewer/components/rollingNumberDom.ts
8
8
  var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
@@ -162,12 +162,12 @@ function componentDigits(surface) {
162
162
  function componentStyle(surface) {
163
163
  const encoded = surface.getAttribute("data-sf-widget-style");
164
164
  if (!encoded) {
165
- return chunkLNW5VIEA_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
165
+ return chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
166
166
  }
167
167
  try {
168
- return { ...chunkLNW5VIEA_cjs.DEFAULT_ROLLING_NUMBER_STYLE, ...JSON.parse(encoded) };
168
+ return { ...chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE, ...JSON.parse(encoded) };
169
169
  } catch {
170
- return chunkLNW5VIEA_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
170
+ return chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
171
171
  }
172
172
  }
173
173
  function positiveInteger(value) {
@@ -191,7 +191,7 @@ function setRollingNumber(surface, value, animate) {
191
191
  return false;
192
192
  }
193
193
  const previousValue = surface.getAttribute("data-sf-widget-value") ?? "";
194
- const nextValue = chunkLNW5VIEA_cjs.formatRollingNumber(value, positiveInteger(surface.getAttribute("data-sf-widget-digits")));
194
+ const nextValue = chunkQL7MNEMT_cjs.formatRollingNumber(value, positiveInteger(surface.getAttribute("data-sf-widget-digits")));
195
195
  if (previousValue === nextValue) {
196
196
  return true;
197
197
  }
@@ -667,7 +667,7 @@ function mountDisplay(container, svgString) {
667
667
  }
668
668
 
669
669
  // src/runtime/viewer/events.ts
670
- var Emitter2 = class extends chunkFQ7GMLCM_cjs.Emitter {
670
+ var Emitter2 = class extends chunkOUWGWDJ2_cjs.Emitter {
671
671
  };
672
672
 
673
673
  // src/runtime/viewer/export/raster.ts
@@ -757,11 +757,11 @@ function svgElement(document, name, attributes) {
757
757
  function readComponentStyle(surface) {
758
758
  try {
759
759
  return {
760
- ...chunkLNW5VIEA_cjs.DEFAULT_ROLLING_NUMBER_STYLE,
760
+ ...chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE,
761
761
  ...JSON.parse(surface.getAttribute("data-sf-widget-style") ?? "{}")
762
762
  };
763
763
  } catch {
764
- return chunkLNW5VIEA_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
764
+ return chunkQL7MNEMT_cjs.DEFAULT_ROLLING_NUMBER_STYLE;
765
765
  }
766
766
  }
767
767
  function cellsOf(box, plain, fontSize = 0) {
@@ -901,7 +901,7 @@ function serializeSvgSnapshot(svg, captures) {
901
901
  // src/runtime/viewer/interaction/changeFlash.ts
902
902
  function createChangeFlash(svg) {
903
903
  const timers = /* @__PURE__ */ new Map();
904
- const flash = (ownerIds, color2 = chunkFQ7GMLCM_cjs.CHANGE_COLOR) => {
904
+ const flash = (ownerIds, color2 = chunkOUWGWDJ2_cjs.CHANGE_COLOR) => {
905
905
  const ids = [...new Set(ownerIds)];
906
906
  if (ids.length === 0) {
907
907
  return;
@@ -909,7 +909,7 @@ function createChangeFlash(svg) {
909
909
  const doc = svg.ownerDocument;
910
910
  const reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
911
911
  for (const id of ids) {
912
- const primary = chunkFQ7GMLCM_cjs.findOwnerNode(svg, id, chunkFQ7GMLCM_cjs.isPrimary);
912
+ const primary = chunkOUWGWDJ2_cjs.findOwnerNode(svg, id, chunkOUWGWDJ2_cjs.isPrimary);
913
913
  if (!primary) {
914
914
  continue;
915
915
  }
@@ -920,10 +920,10 @@ function createChangeFlash(svg) {
920
920
  for (const stale of svg.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(id)}"]`)) {
921
921
  stale.remove();
922
922
  }
923
- const overlay = primary.getAttribute("data-sf-role") === "link" ? chunkFQ7GMLCM_cjs.linkChangeOverlay(doc, primary, id, color2) : chunkFQ7GMLCM_cjs.shapeChangeOverlay(doc, primary, id, color2);
923
+ const overlay = primary.getAttribute("data-sf-role") === "link" ? chunkOUWGWDJ2_cjs.linkChangeOverlay(doc, primary, id, color2) : chunkOUWGWDJ2_cjs.shapeChangeOverlay(doc, primary, id, color2);
924
924
  svg.appendChild(overlay);
925
- chunkFQ7GMLCM_cjs.startChangeFade(overlay, reducedMotion);
926
- const duration = reducedMotion ? chunkFQ7GMLCM_cjs.REDUCED_MOTION_DURATION_MS : chunkFQ7GMLCM_cjs.FLASH_DURATION_MS;
925
+ chunkOUWGWDJ2_cjs.startChangeFade(overlay, reducedMotion);
926
+ const duration = reducedMotion ? chunkOUWGWDJ2_cjs.REDUCED_MOTION_DURATION_MS : chunkOUWGWDJ2_cjs.FLASH_DURATION_MS;
927
927
  timers.set(
928
928
  id,
929
929
  setTimeout(() => {
@@ -1010,7 +1010,7 @@ var OwnerPointerController = class {
1010
1010
  this.#selection = selection;
1011
1011
  }
1012
1012
  hover(event) {
1013
- const owner = chunkFQ7GMLCM_cjs.resolveOwner(event.target);
1013
+ const owner = chunkOUWGWDJ2_cjs.resolveOwner(event.target);
1014
1014
  this.#emitter.emit(
1015
1015
  "ownerHover",
1016
1016
  owner ? { diagramId: this.#diagramId, owner, modifiers: modifiersOf(event) } : { diagramId: this.#diagramId, owner: null }
@@ -1018,7 +1018,7 @@ var OwnerPointerController = class {
1018
1018
  }
1019
1019
  select(event) {
1020
1020
  const target = event.target;
1021
- const owner = chunkFQ7GMLCM_cjs.resolveOwner(target);
1021
+ const owner = chunkOUWGWDJ2_cjs.resolveOwner(target);
1022
1022
  if (!owner) {
1023
1023
  this.#clearWhenOutsideOverlay(target);
1024
1024
  return;
@@ -1039,7 +1039,7 @@ var OwnerPointerController = class {
1039
1039
  owner,
1040
1040
  modifiers
1041
1041
  });
1042
- const node = chunkFQ7GMLCM_cjs.findOwnerNode(this.#svg, owner.id, chunkFQ7GMLCM_cjs.isPrimary);
1042
+ const node = chunkOUWGWDJ2_cjs.findOwnerNode(this.#svg, owner.id, chunkOUWGWDJ2_cjs.isPrimary);
1043
1043
  if (node && !node.hasAttribute("tabindex")) {
1044
1044
  node.setAttribute("tabindex", "-1");
1045
1045
  }
@@ -1067,12 +1067,12 @@ var PointerInteractionSession = class {
1067
1067
  }
1068
1068
  #onPointerDown = (event) => {
1069
1069
  const target = event.target;
1070
- const overContent = Boolean(chunkFQ7GMLCM_cjs.resolveOwner(target)) || isSelectionOverlayControl(target);
1070
+ const overContent = Boolean(chunkOUWGWDJ2_cjs.resolveOwner(target)) || isSelectionOverlayControl(target);
1071
1071
  this.#down = {
1072
1072
  x: event.clientX,
1073
1073
  y: event.clientY,
1074
1074
  moved: false,
1075
- panable: chunkFQ7GMLCM_cjs.isCameraGesture(event) || !overContent
1075
+ panable: chunkOUWGWDJ2_cjs.isCameraGesture(event) || !overContent
1076
1076
  };
1077
1077
  };
1078
1078
  #onPointerMove = (event) => {
@@ -1100,7 +1100,7 @@ var PointerInteractionSession = class {
1100
1100
  if (!this.#down.moved) {
1101
1101
  return false;
1102
1102
  }
1103
- if (this.#down.panable && chunkFQ7GMLCM_cjs.isCameraGesture(event)) {
1103
+ if (this.#down.panable && chunkOUWGWDJ2_cjs.isCameraGesture(event)) {
1104
1104
  this.#display.panBy(event.movementX, event.movementY);
1105
1105
  }
1106
1106
  return true;
@@ -1124,15 +1124,15 @@ function paintSelectionOverlays(svg, selectedIds, owners) {
1124
1124
  }
1125
1125
  const document = svg.ownerDocument;
1126
1126
  for (const id of selectedIds) {
1127
- const primary = chunkFQ7GMLCM_cjs.findOwnerNode(svg, id, chunkFQ7GMLCM_cjs.isPrimary);
1127
+ const primary = chunkOUWGWDJ2_cjs.findOwnerNode(svg, id, chunkOUWGWDJ2_cjs.isPrimary);
1128
1128
  if (!primary) {
1129
1129
  continue;
1130
1130
  }
1131
1131
  const owner = owners.get(id);
1132
- const overlay = owner?.role === "link" ? chunkFQ7GMLCM_cjs.linkSelectionOverlay(document, primary, id, svg) : owner?.role === "path" ? chunkFQ7GMLCM_cjs.pathSelectionOverlay(document, primary, id, svg) : owner?.role === "isometric" ? chunkFQ7GMLCM_cjs.isometricSelectionOverlay(document, primary, id, svg) : chunkFQ7GMLCM_cjs.shapeSelectionOverlay(document, primary, id, svg, owner ? chunkFQ7GMLCM_cjs.DERIVED_HEIGHT_ROLES.has(owner.role) : false);
1132
+ const overlay = owner?.role === "link" ? chunkOUWGWDJ2_cjs.linkSelectionOverlay(document, primary, id, svg) : owner?.role === "path" ? chunkOUWGWDJ2_cjs.pathSelectionOverlay(document, primary, id, svg) : owner?.role === "isometric" ? chunkOUWGWDJ2_cjs.isometricSelectionOverlay(document, primary, id, svg) : chunkOUWGWDJ2_cjs.shapeSelectionOverlay(document, primary, id, svg, owner ? chunkOUWGWDJ2_cjs.DERIVED_HEIGHT_ROLES.has(owner.role) : false);
1133
1133
  svg.appendChild(overlay);
1134
1134
  if (owner?.role === "shape" && selectedIds.size === 1) {
1135
- svg.appendChild(chunkFQ7GMLCM_cjs.quickDuplicateBubbles(document, primary, id, svg));
1135
+ svg.appendChild(chunkOUWGWDJ2_cjs.quickDuplicateBubbles(document, primary, id, svg));
1136
1136
  }
1137
1137
  }
1138
1138
  }
@@ -1171,7 +1171,7 @@ var SelectionController = class {
1171
1171
  selectIds(ids) {
1172
1172
  for (const id of ids) {
1173
1173
  const element = this.#svg.querySelector(`[data-sf-id="${CSS.escape(id)}"]`);
1174
- const owner = chunkFQ7GMLCM_cjs.resolveOwner(element);
1174
+ const owner = chunkOUWGWDJ2_cjs.resolveOwner(element);
1175
1175
  if (owner) {
1176
1176
  this.remember(owner);
1177
1177
  }
@@ -1183,7 +1183,7 @@ var SelectionController = class {
1183
1183
  // src/runtime/viewer/interaction/wheel.ts
1184
1184
  function bindWheelZoom(display, selection) {
1185
1185
  const onWheel = (event) => {
1186
- if (!chunkFQ7GMLCM_cjs.isCameraGesture(event)) {
1186
+ if (!chunkOUWGWDJ2_cjs.isCameraGesture(event)) {
1187
1187
  return;
1188
1188
  }
1189
1189
  event.preventDefault();
@@ -1657,10 +1657,191 @@ var emberSlitsProgram = {
1657
1657
  fragmentSource: fragmentSource6
1658
1658
  };
1659
1659
 
1660
- // src/runtime/viewer/shaders/builtins/glassRefraction.ts
1660
+ // src/runtime/viewer/shaders/builtins/glassDots.ts
1661
1661
  var fragmentSource7 = `
1662
1662
  precision highp float;
1663
1663
 
1664
+ uniform vec2 uResolution;
1665
+ uniform float uTime;
1666
+ uniform float uSpeed;
1667
+ uniform float uIntensity;
1668
+ uniform float uDots;
1669
+ uniform float uDotSize;
1670
+ uniform float uStagger;
1671
+ uniform float uSphere;
1672
+ uniform float uAngle;
1673
+ uniform float uSpread;
1674
+ uniform float uWarp;
1675
+ uniform float uGlow;
1676
+ uniform float uRound;
1677
+ uniform float uScatter;
1678
+ uniform float uLens;
1679
+ uniform float uGrain;
1680
+ uniform vec3 uBaseColor;
1681
+ uniform vec3 uColorA;
1682
+ uniform vec3 uColorB;
1683
+ uniform vec3 uColorC;
1684
+ uniform vec3 uColorD;
1685
+ uniform vec3 uRimColor;
1686
+ varying vec2 vUv;
1687
+
1688
+ float hash(vec2 p) {
1689
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
1690
+ }
1691
+
1692
+ float noise(vec2 p) {
1693
+ vec2 i = floor(p);
1694
+ vec2 f = fract(p);
1695
+ vec2 u = f * f * (3.0 - 2.0 * f);
1696
+ return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x), mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
1697
+ }
1698
+
1699
+ float fbm(vec2 p) {
1700
+ return 0.5 * noise(p) + 0.25 * noise(p * 2.03 + 3.1) + 0.125 * noise(p * 4.01 + 7.7);
1701
+ }
1702
+
1703
+ vec2 turn(vec2 point, float angle) {
1704
+ float c = cos(angle);
1705
+ float s = sin(angle);
1706
+ return vec2(c * point.x - s * point.y, s * point.x + c * point.y);
1707
+ }
1708
+
1709
+ // How far the grid is stretched at a distance r from the middle; with sphere the dots follow the surface of a ball.
1710
+ float stretch(float r, float sphere) {
1711
+ float rr = clamp(r, 0.0001, 0.9999);
1712
+ return mix(1.0, asin(rr) / rr, sphere);
1713
+ }
1714
+
1715
+ // The color under the dots: an uneven cloud of color whose edge bleeds out into the dark, with a red glow around it.
1716
+ // body is how much of the cloud is there, from 1 inside to 0 far outside.
1717
+ vec3 field(vec2 q, float angle, float t, out float body, out float distance) {
1718
+ vec2 p = turn(q, -angle);
1719
+ vec2 bend = vec2(fbm(p * 2.2 + vec2(t * 0.3, 1.7)), fbm(p * 2.2 + vec2(8.3, -t * 0.25))) - 0.35;
1720
+ vec2 w = p + bend * max(uWarp, 0.0) * 0.4;
1721
+ float rr = length(w) / max(uSpread, 0.2);
1722
+ distance = rr;
1723
+ body = 1.0 - smoothstep(0.78, 1.22, rr);
1724
+
1725
+ vec3 c = uColorB;
1726
+ c = mix(c, uColorA, smoothstep(-0.1, 0.95, dot(w, normalize(vec2(-0.6, 0.7)))) * 0.95);
1727
+ c = mix(c, uColorC, smoothstep(-0.05, 0.6, dot(w, normalize(vec2(0.7, -0.45)))) * 0.9);
1728
+ c = mix(c, uColorD, smoothstep(0.18, 0.85, dot(w, normalize(vec2(0.85, -0.55)))) * 0.97);
1729
+ float ring = smoothstep(0.8, 1.05, rr) * max(uGlow, 0.0);
1730
+ c = mix(c, uRimColor, clamp(ring, 0.0, 1.0));
1731
+ return mix(uBaseColor, c, body);
1732
+ }
1733
+
1734
+ void main() {
1735
+ float side = min(uResolution.x, uResolution.y);
1736
+ vec2 q = (vUv * uResolution - uResolution * 0.5) / (side * 0.5);
1737
+ float r = length(q);
1738
+ // On a circle the picture ends at its edge; on a rectangle the dots run on over the whole surface and may lie beyond the cloud.
1739
+ float edge = uRound > 0.5 ? 1.0 - smoothstep(0.985, 1.0, r) : 1.0;
1740
+ if (edge <= 0.0) discard;
1741
+
1742
+ float t = uTime * max(uSpeed, 0.0);
1743
+ float angle = radians(uAngle);
1744
+ float cells = max(uDots, 2.0) * 0.5;
1745
+ vec2 g = q * stretch(r, uSphere) * cells;
1746
+
1747
+ // The dot that is nearest wins, so dots that lie close cut each other along a straight line.
1748
+ float stagger = clamp(uStagger, 0.0, 1.0);
1749
+ vec2 cell = floor(g);
1750
+ float best = 1e9;
1751
+ vec2 centre = vec2(0.0);
1752
+ for (int j = -1; j <= 1; j++) {
1753
+ for (int i = -1; i <= 1; i++) {
1754
+ vec2 c = cell + vec2(float(i), float(j));
1755
+ float shift = stagger * 0.5 * mod(c.y, 2.0);
1756
+ vec2 mid = vec2(c.x + 0.5 + shift, c.y + 0.5);
1757
+ float d = length(g - mid);
1758
+ if (d < best) {
1759
+ best = d;
1760
+ centre = mid;
1761
+ }
1762
+ }
1763
+ }
1764
+
1765
+ // Where the middle of that dot lies on the screen, found by running the stretch backwards.
1766
+ vec2 gc = centre / cells;
1767
+ float gl = length(gc);
1768
+ float rc = gl;
1769
+ for (int k = 0; k < 5; k++) {
1770
+ rc = gl / stretch(rc, uSphere);
1771
+ }
1772
+ rc = clamp(rc, 0.0, 1.0);
1773
+ vec2 qc = gl > 0.0001 ? gc / gl * rc : vec2(0.0);
1774
+
1775
+ float radius = clamp(uDotSize, 0.2, 0.9);
1776
+ float aa = 1.6 / side * cells * 2.0;
1777
+ float inside = 1.0 - smoothstep(radius - aa, radius + aa, best);
1778
+
1779
+ float bodyHere;
1780
+ float bodyDot;
1781
+ float farHere;
1782
+ float farDot;
1783
+ vec3 colorHere = field(q, angle, t, bodyHere, farHere);
1784
+ field(qc, angle, t, bodyDot, farDot);
1785
+
1786
+ // Between the dots the cloud is darker, so the dots read as glass lying on it.
1787
+ vec3 gap = colorHere * mix(0.3, 0.9, bodyHere);
1788
+
1789
+ // Every dot is a lens with a gradient of its own: lighter on the side that faces the middle, dark on the side that faces out.
1790
+ // The darker side grows toward the edge of the cloud, until the dots there are nearly black.
1791
+ vec2 e = (g - centre) / max(radius, 0.001);
1792
+ vec2 outward = length(qc) > 0.0001 ? normalize(qc) : vec2(0.0, 1.0);
1793
+ vec2 outwardGrid = outward;
1794
+ float along = clamp(dot(e, outwardGrid), -1.0, 1.0);
1795
+ float edgeness = 1.0 - smoothstep(0.1, 0.9, bodyDot);
1796
+ float lens = clamp(uLens, 0.0, 1.5);
1797
+ float darken = lens * (0.1 + 0.9 * edgeness) * smoothstep(-0.55, 1.0, along);
1798
+ float lift = lens * 0.09 * (1.0 - edgeness) * (-along);
1799
+ vec3 glass = colorHere * (1.0 + lift) * (1.0 - clamp(darken, 0.0, 0.96));
1800
+
1801
+ // A dot beyond the cloud is drawn in the dark glow color when the dice fall that way, more of them close to the cloud than far from it.
1802
+ float luck = hash(centre + 17.0);
1803
+ float shown = step(luck, clamp(uScatter, 0.0, 1.0) * (1.0 - smoothstep(1.0, 2.0, farDot))) * (1.0 - bodyDot);
1804
+ vec3 outer = mix(uRimColor, mix(uColorD, uColorC, hash(centre + 5.0)), 0.35 * hash(centre + 9.0)) * (0.25 + 0.4 * hash(centre + 3.0));
1805
+ outer *= 1.0 - 0.8 * smoothstep(-0.55, 1.0, along);
1806
+ glass = mix(glass, outer, shown);
1807
+
1808
+ vec3 color = mix(gap, glass, inside);
1809
+ color *= max(uIntensity, 0.0);
1810
+ color += (hash(gl_FragCoord.xy + t) - 0.5) * max(uGrain, 0.0);
1811
+ gl_FragColor = vec4(clamp(color, 0.0, 1.0), edge);
1812
+ }
1813
+ `;
1814
+ var glassDotsProgram = {
1815
+ name: "glassDots",
1816
+ fragmentSource: fragmentSource7,
1817
+ defaultParameters: {
1818
+ speed: 0,
1819
+ intensity: 1,
1820
+ dots: 13,
1821
+ dotSize: 0.5,
1822
+ stagger: 0,
1823
+ sphere: 0,
1824
+ angle: 0,
1825
+ spread: 0.86,
1826
+ warp: 1,
1827
+ glow: 0.75,
1828
+ round: 0,
1829
+ scatter: 0.45,
1830
+ lens: 0.75,
1831
+ grain: 0.06,
1832
+ baseColor: "#121212",
1833
+ colorA: "#f4b49c",
1834
+ colorB: "#4a9c93",
1835
+ colorC: "#34559c",
1836
+ colorD: "#ec3f93",
1837
+ rimColor: "#d93a24"
1838
+ }
1839
+ };
1840
+
1841
+ // src/runtime/viewer/shaders/builtins/glassRefraction.ts
1842
+ var fragmentSource8 = `
1843
+ precision highp float;
1844
+
1664
1845
  uniform sampler2D uBackdrop;
1665
1846
  uniform vec2 uBackdropOrigin;
1666
1847
  uniform vec2 uBackdropScale;
@@ -1763,12 +1944,12 @@ void main() {
1763
1944
  `;
1764
1945
  var glassRefractionProgram = {
1765
1946
  name: "glassRefraction",
1766
- fragmentSource: fragmentSource7,
1947
+ fragmentSource: fragmentSource8,
1767
1948
  usesBackdrop: true
1768
1949
  };
1769
1950
 
1770
1951
  // src/runtime/viewer/shaders/builtins/glowCard.ts
1771
- var fragmentSource8 = `
1952
+ var fragmentSource9 = `
1772
1953
  precision highp float;
1773
1954
 
1774
1955
  uniform vec2 uResolution;
@@ -1874,7 +2055,7 @@ void main() {
1874
2055
  `;
1875
2056
  var glowCardProgram = {
1876
2057
  name: "glowCard",
1877
- fragmentSource: fragmentSource8,
2058
+ fragmentSource: fragmentSource9,
1878
2059
  defaultParameters: {
1879
2060
  speed: 0.12,
1880
2061
  intensity: 1,
@@ -1894,7 +2075,7 @@ var glowCardProgram = {
1894
2075
  };
1895
2076
 
1896
2077
  // src/runtime/viewer/shaders/builtins/halftoneHalo.ts
1897
- var fragmentSource9 = `
2078
+ var fragmentSource10 = `
1898
2079
  precision highp float;
1899
2080
 
1900
2081
  uniform vec2 uResolution;
@@ -1973,11 +2154,11 @@ void main() {
1973
2154
  `;
1974
2155
  var halftoneHaloProgram = {
1975
2156
  name: "halftoneHalo",
1976
- fragmentSource: fragmentSource9
2157
+ fragmentSource: fragmentSource10
1977
2158
  };
1978
2159
 
1979
2160
  // src/runtime/viewer/shaders/builtins/halo.ts
1980
- var fragmentSource10 = `
2161
+ var fragmentSource11 = `
1981
2162
  precision highp float;
1982
2163
 
1983
2164
  uniform vec2 uResolution;
@@ -2052,11 +2233,11 @@ void main() {
2052
2233
  `;
2053
2234
  var haloProgram = {
2054
2235
  name: "halo",
2055
- fragmentSource: fragmentSource10
2236
+ fragmentSource: fragmentSource11
2056
2237
  };
2057
2238
 
2058
2239
  // src/runtime/viewer/shaders/builtins/ledMatrix.ts
2059
- var fragmentSource11 = `
2240
+ var fragmentSource12 = `
2060
2241
  precision highp float;
2061
2242
 
2062
2243
  uniform vec2 uResolution;
@@ -2172,7 +2353,7 @@ void main() {
2172
2353
  `;
2173
2354
  var ledMatrixProgram = {
2174
2355
  name: "ledMatrix",
2175
- fragmentSource: fragmentSource11,
2356
+ fragmentSource: fragmentSource12,
2176
2357
  defaultParameters: {
2177
2358
  speed: 0.25,
2178
2359
  intensity: 1,
@@ -2203,7 +2384,7 @@ var ledMatrixProgram = {
2203
2384
  };
2204
2385
 
2205
2386
  // src/runtime/viewer/shaders/builtins/lightBand.ts
2206
- var fragmentSource12 = `
2387
+ var fragmentSource13 = `
2207
2388
  precision highp float;
2208
2389
 
2209
2390
  uniform vec2 uResolution;
@@ -2263,7 +2444,7 @@ void main() {
2263
2444
  `;
2264
2445
  var lightBandProgram = {
2265
2446
  name: "lightBand",
2266
- fragmentSource: fragmentSource12,
2447
+ fragmentSource: fragmentSource13,
2267
2448
  defaultParameters: {
2268
2449
  speed: 0.3,
2269
2450
  intensity: 1,
@@ -2280,7 +2461,7 @@ var lightBandProgram = {
2280
2461
  };
2281
2462
 
2282
2463
  // src/runtime/viewer/shaders/builtins/lumenPortal.ts
2283
- var fragmentSource13 = `
2464
+ var fragmentSource14 = `
2284
2465
  precision highp float;
2285
2466
 
2286
2467
  uniform float uTime;
@@ -2338,11 +2519,11 @@ void main() {
2338
2519
  `;
2339
2520
  var lumenPortalProgram = {
2340
2521
  name: "lumenPortal",
2341
- fragmentSource: fragmentSource13
2522
+ fragmentSource: fragmentSource14
2342
2523
  };
2343
2524
 
2344
2525
  // src/runtime/viewer/shaders/builtins/lumenPortalLight.ts
2345
- var fragmentSource14 = `
2526
+ var fragmentSource15 = `
2346
2527
  precision highp float;
2347
2528
 
2348
2529
  uniform float uTime;
@@ -2401,11 +2582,11 @@ void main() {
2401
2582
  `;
2402
2583
  var lumenPortalLightProgram = {
2403
2584
  name: "lumenPortalLight",
2404
- fragmentSource: fragmentSource14
2585
+ fragmentSource: fragmentSource15
2405
2586
  };
2406
2587
 
2407
2588
  // src/runtime/viewer/shaders/builtins/orb.ts
2408
- var fragmentSource15 = `
2589
+ var fragmentSource16 = `
2409
2590
  precision highp float;
2410
2591
 
2411
2592
  uniform vec2 uResolution;
@@ -2441,11 +2622,11 @@ void main() {
2441
2622
  `;
2442
2623
  var orbProgram = {
2443
2624
  name: "orb",
2444
- fragmentSource: fragmentSource15
2625
+ fragmentSource: fragmentSource16
2445
2626
  };
2446
2627
 
2447
2628
  // src/runtime/viewer/shaders/builtins/pixelConstellation.ts
2448
- var fragmentSource16 = `
2629
+ var fragmentSource17 = `
2449
2630
  precision highp float;
2450
2631
 
2451
2632
  uniform float uTime;
@@ -2545,11 +2726,11 @@ void main() {
2545
2726
  `;
2546
2727
  var pixelConstellationProgram = {
2547
2728
  name: "pixelConstellation",
2548
- fragmentSource: fragmentSource16
2729
+ fragmentSource: fragmentSource17
2549
2730
  };
2550
2731
 
2551
2732
  // src/runtime/viewer/shaders/builtins/plasmaGauge.ts
2552
- var fragmentSource17 = `
2733
+ var fragmentSource18 = `
2553
2734
  precision highp float;
2554
2735
 
2555
2736
  uniform vec2 uResolution;
@@ -2651,12 +2832,12 @@ void main() {
2651
2832
  `;
2652
2833
  var plasmaGaugeProgram = {
2653
2834
  name: "plasmaGauge",
2654
- fragmentSource: fragmentSource17,
2835
+ fragmentSource: fragmentSource18,
2655
2836
  replacesBaseFill: true
2656
2837
  };
2657
2838
 
2658
2839
  // src/runtime/viewer/shaders/builtins/prismSlats.ts
2659
- var fragmentSource18 = `
2840
+ var fragmentSource19 = `
2660
2841
  precision highp float;
2661
2842
 
2662
2843
  uniform vec2 uResolution;
@@ -2731,11 +2912,11 @@ void main() {
2731
2912
  `;
2732
2913
  var prismSlatsProgram = {
2733
2914
  name: "prismSlats",
2734
- fragmentSource: fragmentSource18
2915
+ fragmentSource: fragmentSource19
2735
2916
  };
2736
2917
 
2737
2918
  // src/runtime/viewer/shaders/builtins/reactivePanel.ts
2738
- var fragmentSource19 = `
2919
+ var fragmentSource20 = `
2739
2920
  precision highp float;
2740
2921
 
2741
2922
  uniform float uTime;
@@ -2837,7 +3018,7 @@ void main() {
2837
3018
  `;
2838
3019
  var reactivePanelProgram = {
2839
3020
  name: "reactivePanel",
2840
- fragmentSource: fragmentSource19,
3021
+ fragmentSource: fragmentSource20,
2841
3022
  defaultParameters: {
2842
3023
  intensity: 0.5,
2843
3024
  speed: 0.18,
@@ -2860,7 +3041,7 @@ var reactivePanelProgram = {
2860
3041
  };
2861
3042
 
2862
3043
  // src/runtime/viewer/shaders/builtins/ruler.ts
2863
- var fragmentSource20 = `
3044
+ var fragmentSource21 = `
2864
3045
  precision highp float;
2865
3046
 
2866
3047
  uniform vec2 uResolution;
@@ -2965,12 +3146,12 @@ void main() {
2965
3146
  `;
2966
3147
  var rulerProgram = {
2967
3148
  name: "ruler",
2968
- fragmentSource: fragmentSource20,
3149
+ fragmentSource: fragmentSource21,
2969
3150
  replacesBaseFill: true
2970
3151
  };
2971
3152
 
2972
3153
  // src/runtime/viewer/shaders/builtins/silkFolds.ts
2973
- var fragmentSource21 = `
3154
+ var fragmentSource22 = `
2974
3155
  precision highp float;
2975
3156
 
2976
3157
  uniform vec2 uResolution;
@@ -3055,7 +3236,7 @@ void main() {
3055
3236
  `;
3056
3237
  var silkFoldsProgram = {
3057
3238
  name: "silkFolds",
3058
- fragmentSource: fragmentSource21,
3239
+ fragmentSource: fragmentSource22,
3059
3240
  defaultParameters: {
3060
3241
  speed: 0.2,
3061
3242
  intensity: 1,
@@ -3078,7 +3259,7 @@ var silkFoldsProgram = {
3078
3259
  };
3079
3260
 
3080
3261
  // src/runtime/viewer/shaders/builtins/smearOrb.ts
3081
- var fragmentSource22 = `
3262
+ var fragmentSource23 = `
3082
3263
  precision highp float;
3083
3264
 
3084
3265
  uniform vec2 uResolution;
@@ -3154,12 +3335,12 @@ void main() {
3154
3335
  `;
3155
3336
  var smearOrbProgram = {
3156
3337
  name: "smearOrb",
3157
- fragmentSource: fragmentSource22,
3338
+ fragmentSource: fragmentSource23,
3158
3339
  replacesBaseFill: true
3159
3340
  };
3160
3341
 
3161
3342
  // src/runtime/viewer/shaders/builtins/tickScale.ts
3162
- var fragmentSource23 = `
3343
+ var fragmentSource24 = `
3163
3344
  precision highp float;
3164
3345
 
3165
3346
  uniform vec2 uResolution;
@@ -3218,12 +3399,12 @@ void main() {
3218
3399
  `;
3219
3400
  var tickScaleProgram = {
3220
3401
  name: "tickScale",
3221
- fragmentSource: fragmentSource23,
3402
+ fragmentSource: fragmentSource24,
3222
3403
  replacesBaseFill: true
3223
3404
  };
3224
3405
 
3225
3406
  // src/runtime/viewer/shaders/builtins/violetGlass.ts
3226
- var fragmentSource24 = `
3407
+ var fragmentSource25 = `
3227
3408
  precision highp float;
3228
3409
 
3229
3410
  uniform float uTime;
@@ -3303,11 +3484,11 @@ void main() {
3303
3484
  `;
3304
3485
  var violetGlassProgram = {
3305
3486
  name: "violetGlass",
3306
- fragmentSource: fragmentSource24
3487
+ fragmentSource: fragmentSource25
3307
3488
  };
3308
3489
 
3309
3490
  // src/runtime/viewer/shaders/builtins/violetGlassLight.ts
3310
- var fragmentSource25 = `
3491
+ var fragmentSource26 = `
3311
3492
  precision highp float;
3312
3493
 
3313
3494
  uniform float uTime;
@@ -3377,7 +3558,7 @@ void main() {
3377
3558
  `;
3378
3559
  var violetGlassLightProgram = {
3379
3560
  name: "violetGlassLight",
3380
- fragmentSource: fragmentSource25
3561
+ fragmentSource: fragmentSource26
3381
3562
  };
3382
3563
 
3383
3564
  // src/runtime/viewer/shaders/programs.ts
@@ -3406,7 +3587,8 @@ var builtins = [
3406
3587
  ledMatrixProgram,
3407
3588
  lightBandProgram,
3408
3589
  silkFoldsProgram,
3409
- glowCardProgram
3590
+ glowCardProgram,
3591
+ glassDotsProgram
3410
3592
  ];
3411
3593
  var programs = new Map(builtins.map((program) => [program.name, program]));
3412
3594
  function registerShaderProgram(program) {
@@ -3587,9 +3769,9 @@ function compile(gl, type, source) {
3587
3769
  }
3588
3770
  return shader;
3589
3771
  }
3590
- function linkProgram(gl, fragmentSource26) {
3772
+ function linkProgram(gl, fragmentSource27) {
3591
3773
  const vertex = compile(gl, gl.VERTEX_SHADER, VERTEX_SOURCE);
3592
- const fragment = compile(gl, gl.FRAGMENT_SHADER, fragmentSource26);
3774
+ const fragment = compile(gl, gl.FRAGMENT_SHADER, fragmentSource27);
3593
3775
  if (!vertex || !fragment) {
3594
3776
  if (vertex) {
3595
3777
  gl.deleteShader(vertex);
@@ -4150,21 +4332,21 @@ function mountShaderSurfaces(svg) {
4150
4332
 
4151
4333
  // src/runtime/viewer/source.ts
4152
4334
  function renderViewerSource(next, defaultRenderOptions) {
4153
- const svg = next.svg ?? (next.source != null ? chunkVOYX6JMW_cjs.render(next.source, { ...next.renderOptions ?? defaultRenderOptions, linkHitAreas: true }).svg : null);
4335
+ const svg = next.svg ?? (next.source != null ? chunk5EY7EK5V_cjs.render(next.source, { ...next.renderOptions ?? defaultRenderOptions, linkHitAreas: true }).svg : null);
4154
4336
  if (svg == null) {
4155
4337
  throw new Error("createViewer: provide either `source` (SFL) or `svg`.");
4156
4338
  }
4157
4339
  return svg;
4158
4340
  }
4159
4341
  function assertCreateViewerContract(svg) {
4160
- const version = chunkFQ7GMLCM_cjs.parseContractVersion(svg);
4161
- if (!chunkFQ7GMLCM_cjs.isContractCompatible(version)) {
4342
+ const version = chunkOUWGWDJ2_cjs.parseContractVersion(svg);
4343
+ if (!chunkOUWGWDJ2_cjs.isContractCompatible(version)) {
4162
4344
  throw new Error(`createViewer: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
4163
4345
  }
4164
4346
  }
4165
4347
  function assertViewerUpdateContract(svg) {
4166
- const version = chunkFQ7GMLCM_cjs.parseContractVersion(svg);
4167
- if (!chunkFQ7GMLCM_cjs.isContractCompatible(version)) {
4348
+ const version = chunkOUWGWDJ2_cjs.parseContractVersion(svg);
4349
+ if (!chunkOUWGWDJ2_cjs.isContractCompatible(version)) {
4168
4350
  throw new Error(`viewer.update: incompatible DOM contract (svg=${version}). Renderer and viewer versions differ.`);
4169
4351
  }
4170
4352
  }
@@ -4398,7 +4580,7 @@ function trackScales(wiring, event) {
4398
4580
  }
4399
4581
  function driveValue(wiring, id, event) {
4400
4582
  const { runtime, svg } = wiring;
4401
- const kind = chunkLNW5VIEA_cjs.getComponentDescriptor(runtime.graph.elements.get(id)?.componentType)?.interaction;
4583
+ const kind = chunkQL7MNEMT_cjs.getComponentDescriptor(runtime.graph.elements.get(id)?.componentType)?.interaction;
4402
4584
  if (kind !== "slide" && kind !== "pick" && kind !== "turn" && kind !== "range") {
4403
4585
  return;
4404
4586
  }
@@ -4537,5 +4719,5 @@ exports.connectInteraction = connectInteraction;
4537
4719
  exports.createViewer = createViewer;
4538
4720
  exports.registerShaderProgram = registerShaderProgram;
4539
4721
  exports.shaderProgram = shaderProgram;
4540
- //# sourceMappingURL=chunk-IR2T47NW.cjs.map
4541
- //# sourceMappingURL=chunk-IR2T47NW.cjs.map
4722
+ //# sourceMappingURL=chunk-RUSNRDLI.cjs.map
4723
+ //# sourceMappingURL=chunk-RUSNRDLI.cjs.map