@glass-sdk/liquid-glass 0.0.2 → 0.0.3-beta.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 (146) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +66 -149
  3. package/dist/core/concentric.js +20 -3
  4. package/dist/core/corner-options.js +12 -0
  5. package/dist/core/corner-path.js +118 -0
  6. package/dist/core/materials.js +264 -32
  7. package/dist/core/optics.js +1 -2
  8. package/dist/core/progressive.js +1 -2
  9. package/dist/core/shape.js +18 -28
  10. package/dist/core/spring.js +5 -10
  11. package/dist/core.js +5 -6
  12. package/dist/dom/backdrop-glass.js +46 -0
  13. package/dist/dom/compose-layers.js +42 -31
  14. package/dist/dom/composited.js +136 -0
  15. package/dist/dom/control-motion.js +58 -47
  16. package/dist/dom/engine.js +1 -2
  17. package/dist/dom/escaped-layers.js +179 -0
  18. package/dist/dom/filter-bounds.js +42 -13
  19. package/dist/dom/filter-budget.js +1 -2
  20. package/dist/dom/filter-chain.js +40 -0
  21. package/dist/dom/filter-groups.js +33 -14
  22. package/dist/dom/filter-paint-root.js +8 -6
  23. package/dist/dom/filter-patch.js +94 -55
  24. package/dist/dom/filter-reach.js +32 -19
  25. package/dist/dom/filter-stages.js +1 -2
  26. package/dist/dom/fixed-shape.js +23 -16
  27. package/dist/dom/foreground.js +16 -17
  28. package/dist/dom/interaction.js +65 -92
  29. package/dist/dom/layout-rect.js +42 -0
  30. package/dist/dom/layout-size.js +28 -0
  31. package/dist/dom/lens-layers.js +250 -136
  32. package/dist/dom/map-encoder.js +16 -13
  33. package/dist/dom/map-encoder.worker.js +2 -3
  34. package/dist/dom/map-encoding.js +49 -12
  35. package/dist/dom/map-image.js +29 -7
  36. package/dist/dom/map-store.js +1 -2
  37. package/dist/dom/maps.js +133 -83
  38. package/dist/dom/material-graph.js +108 -29
  39. package/dist/dom/media-mirror.js +244 -0
  40. package/dist/dom/page-zoom.js +19 -18
  41. package/dist/dom/png.js +1 -2
  42. package/dist/dom/progressive.js +152 -147
  43. package/dist/dom/renderer.js +1 -2
  44. package/dist/dom/sampling-bounds.js +1 -2
  45. package/dist/dom/selection.js +133 -79
  46. package/dist/dom/shape-attributes.js +9 -0
  47. package/dist/dom/shape-effects.js +14 -0
  48. package/dist/dom/shape-geometry.js +3 -0
  49. package/dist/dom/shape-layout.js +115 -116
  50. package/dist/dom/shared-backdrop.js +33 -25
  51. package/dist/dom/specular.js +116 -0
  52. package/dist/dom/ticker.js +28 -19
  53. package/dist/dom/tint-color.js +24 -0
  54. package/dist/dom/warm.js +63 -59
  55. package/dist/dom.js +591 -505
  56. package/dist/gpu/geometry.js +2 -3
  57. package/dist/gpu/maps.js +1109 -7
  58. package/dist/gpu/planes.js +2 -3
  59. package/dist/gpu.js +66 -64
  60. package/dist/index.js +12 -10
  61. package/dist/react/button.js +12 -11
  62. package/dist/react/color-picker.js +199 -0
  63. package/dist/react/control-thumb.js +4 -5
  64. package/dist/react/menu.js +82 -111
  65. package/dist/react/merged-ref.js +1 -2
  66. package/dist/react/progressive.js +1 -2
  67. package/dist/react/scene.js +71 -55
  68. package/dist/react/shape.js +67 -47
  69. package/dist/react/slider.js +81 -0
  70. package/dist/react/surface.js +90 -56
  71. package/dist/react/switch.js +101 -0
  72. package/dist/react/tabs.js +85 -63
  73. package/dist/react/toolbar.js +38 -123
  74. package/dist/react/value-control-motion.js +1 -2
  75. package/dist/styles.css +517 -111
  76. package/dist/types/core/concentric.d.ts +8 -0
  77. package/dist/types/core/corner-options.d.ts +4 -0
  78. package/dist/types/core/corner-path.d.ts +8 -0
  79. package/dist/types/core/index.d.ts +3 -5
  80. package/dist/types/core/materials.d.ts +100 -28
  81. package/dist/types/core/shape.d.ts +4 -6
  82. package/dist/types/core/spring.d.ts +8 -12
  83. package/dist/types/dom/backdrop-glass.d.ts +38 -0
  84. package/dist/types/dom/compose-layers.d.ts +4 -0
  85. package/dist/types/dom/composited.d.ts +61 -0
  86. package/dist/types/dom/escaped-layers.d.ts +32 -0
  87. package/dist/types/dom/filter-bounds.d.ts +4 -0
  88. package/dist/types/dom/filter-chain.d.ts +6 -0
  89. package/dist/types/dom/filter-groups.d.ts +1 -1
  90. package/dist/types/dom/filter-paint-root.d.ts +3 -0
  91. package/dist/types/dom/filter-patch.d.ts +5 -0
  92. package/dist/types/dom/filter-reach.d.ts +9 -9
  93. package/dist/types/dom/foreground.d.ts +2 -1
  94. package/dist/types/dom/index.d.ts +8 -19
  95. package/dist/types/dom/interaction.d.ts +8 -8
  96. package/dist/types/dom/layout-rect.d.ts +17 -0
  97. package/dist/types/dom/layout-size.d.ts +11 -0
  98. package/dist/types/dom/lens-layers.d.ts +18 -10
  99. package/dist/types/dom/map-encoder.d.ts +5 -2
  100. package/dist/types/dom/map-encoding.d.ts +12 -3
  101. package/dist/types/dom/map-image.d.ts +7 -1
  102. package/dist/types/dom/maps.d.ts +25 -7
  103. package/dist/types/dom/material-graph.d.ts +73 -10
  104. package/dist/types/dom/media-mirror.d.ts +49 -0
  105. package/dist/types/dom/progressive.d.ts +2 -5
  106. package/dist/types/dom/sampling-bounds.d.ts +1 -3
  107. package/dist/types/dom/selection.d.ts +29 -4
  108. package/dist/types/dom/shape-attributes.d.ts +6 -0
  109. package/dist/types/dom/shape-effects.d.ts +10 -0
  110. package/dist/types/dom/shape-geometry.d.ts +6 -0
  111. package/dist/types/dom/shape-layout.d.ts +2 -4
  112. package/dist/types/dom/shared-backdrop.d.ts +7 -3
  113. package/dist/types/dom/specular.d.ts +50 -0
  114. package/dist/types/dom/ticker.d.ts +4 -1
  115. package/dist/types/dom/tint-color.d.ts +11 -0
  116. package/dist/types/dom/warm.d.ts +8 -2
  117. package/dist/types/gpu/geometry.d.ts +2 -0
  118. package/dist/types/gpu/planes.d.ts +3 -2
  119. package/dist/types/index.d.ts +1 -1
  120. package/dist/types/react/button.d.ts +1 -1
  121. package/dist/types/react/color-picker.d.ts +26 -0
  122. package/dist/types/react/index.d.ts +14 -10
  123. package/dist/types/react/menu.d.ts +4 -5
  124. package/dist/types/react/progressive.d.ts +1 -1
  125. package/dist/types/react/scene.d.ts +4 -2
  126. package/dist/types/react/shape.d.ts +11 -1
  127. package/dist/types/react/slider.d.ts +14 -0
  128. package/dist/types/react/surface.d.ts +11 -22
  129. package/dist/types/react/switch.d.ts +9 -0
  130. package/dist/types/react/tabs.d.ts +3 -3
  131. package/dist/types/react/toolbar.d.ts +1 -1
  132. package/package.json +46 -40
  133. package/dist/core/morph-path.js +0 -206
  134. package/dist/core/union.js +0 -117
  135. package/dist/dom/compound-field.js +0 -23
  136. package/dist/dom/exit-handoff.js +0 -14
  137. package/dist/dom/map-blend.js +0 -8
  138. package/dist/dom/morph.js +0 -296
  139. package/dist/react/value-controls.js +0 -176
  140. package/dist/types/core/morph-path.d.ts +0 -110
  141. package/dist/types/core/union.d.ts +0 -20
  142. package/dist/types/dom/compound-field.d.ts +0 -35
  143. package/dist/types/dom/exit-handoff.d.ts +0 -7
  144. package/dist/types/dom/map-blend.d.ts +0 -22
  145. package/dist/types/dom/morph.d.ts +0 -78
  146. package/dist/types/react/value-controls.d.ts +0 -20
@@ -1,50 +1,51 @@
1
- import { gecko as e, webkit as t } from "./engine.js";
2
- import { filterBudgetFactor as n, filterGraphOutsets as r, outsetBudget as i } from "./filter-budget.js";
3
- import { pngDataUrlSync as a } from "./png.js";
4
- import { filterPixelRatio as o, pageZoom as s, untiledOutsets as c } from "./page-zoom.js";
5
- import { patchFilters as l } from "./filter-patch.js";
6
- import { physicalEdge as u, scrollEdgeStrength as d, validateProgressive as f } from "../core/progressive.js";
7
- import { padRepaintReach as p, repaintReach as m } from "./filter-reach.js";
8
- import { filterPrimitiveCount as h } from "./filter-stages.js";
9
- import { acquireFilterPaintRoot as g } from "./filter-paint-root.js";
10
- //#region src/dom/progressive.ts
11
- var _ = t ? "webkit" : e ? "gecko" : "chromium", v = 0, y = "http://www.w3.org/2000/svg", b = 6, x = (e) => e * e * (3 - 2 * e), S = (e) => .5 - Math.sin(Math.asin(1 - 2 * Math.max(0, Math.min(1, e))) / 3), C = (e, t) => Math.max(0, 1 - Math.abs(b * x(Math.max(0, Math.min(1, t))) - e)), w = Array.from({ length: 7 }, (e, t) => [S((t - 1) / b), S((t + 1) / b)]), T = (e) => {
12
- let t = e / b;
1
+ import { physicalEdge as e, scrollEdgeStrength as t, validateProgressive as n } from "../core/progressive.js";
2
+ import { boundsMeet as r } from "./filter-bounds.js";
3
+ import { filterBudgetFactor as i, filterGraphOutsets as a, outsetBudget as o } from "./filter-budget.js";
4
+ import { padRepaintReach as s, repaintReach as c } from "./filter-reach.js";
5
+ import { filterPixelRatio as l, pageZoom as u, untiledOutsets as d } from "./page-zoom.js";
6
+ import { filterPrimitiveCount as f } from "./filter-stages.js";
7
+ import { gecko as p, webkit as m } from "./engine.js";
8
+ import { acquireFilterPaintRoot as h } from "./filter-paint-root.js";
9
+ import { patchFilters as g } from "./filter-patch.js";
10
+ import { pngDataUrlSync as _ } from "./png.js";
11
+ // src/dom/progressive.ts
12
+ var v = m ? "webkit" : p ? "gecko" : "chromium", y = 0, b = "http://www.w3.org/2000/svg", x = 6, S = (e) => e * e * (3 - 2 * e), C = (e) => .5 - Math.sin(Math.asin(1 - 2 * Math.max(0, Math.min(1, e))) / 3), w = (e, t) => Math.max(0, 1 - Math.abs(x * S(Math.max(0, Math.min(1, t))) - e)), T = (e, t) => Math.min(1, Math.max(0, e + 1 - x * S(Math.max(0, Math.min(1, t))))), E = Array.from({ length: 7 }, (e, t) => [C((t - 1) / x), C((t + 1) / x)]), D = (e) => {
13
+ let t = e / x;
13
14
  return 3.92 * t * (1 - t);
14
15
  };
15
- function E(e) {
16
+ function O(e) {
16
17
  let t = 1 / (1 + .3275911 * Math.abs(e) / Math.SQRT2), n = 1 - ((((1.061405429 * t - 1.453152027) * t + 1.421413741) * t - .284496736) * t + .254829592) * t * Math.exp(-e * e / 2);
17
18
  return e < 0 ? (1 - n) / 2 : (1 + n) / 2;
18
19
  }
19
- function D(e) {
20
+ function k(e) {
20
21
  let t = -8, n = 8;
21
22
  for (let r = 0; r < 48; r++) {
22
23
  let r = (t + n) / 2;
23
- E(r) < e ? t = r : n = r;
24
+ O(r) < e ? t = r : n = r;
24
25
  }
25
26
  return (t + n) / 2;
26
27
  }
27
- var O = Array.from({ length: 7 }, (e, t) => Array.from({ length: 65 }, (e, n) => {
28
- let r = n / 64, i = r <= 0 ? 0 : r >= 1 ? 1 : .5 + D(r) / 6;
29
- return Number(C(t, i).toFixed(4));
30
- }).join(" ")), k = 64, A = /* @__PURE__ */ new Map();
31
- function j(e) {
32
- let t = A.get(e);
28
+ var A = (e) => Array.from({ length: 7 }, (t, n) => Array.from({ length: 65 }, (t, r) => {
29
+ let i = r / 64, a = i <= 0 ? 0 : i >= 1 ? 1 : .5 + k(i) / 6;
30
+ return Number(e(n, a).toFixed(4));
31
+ }).join(" ")), j = A(w), M = A(T), N = 64, P = /* @__PURE__ */ new Map();
32
+ function F(e) {
33
+ let t = P.get(e);
33
34
  if (t) return t;
34
- let [, n, r] = e.split(":"), i = Number(r), [o, s] = w[i], c = n === "top" || n === "bottom", l = n === "top" || n === "left", u = /* @__PURE__ */ new Uint8Array(256);
35
- for (let e = 0; e < k; e++) {
36
- let t = (e + .5) / k, n = l ? s - t * (s - o) : o + t * (s - o);
37
- u.set([
35
+ let [, n, r] = e.split(":"), i = Number(r), [a, o] = E[i], s = n === "top" || n === "bottom", c = n === "top" || n === "left", l = /* @__PURE__ */ new Uint8Array(256);
36
+ for (let e = 0; e < N; e++) {
37
+ let t = (e + .5) / N, n = c ? o - t * (o - a) : a + t * (o - a);
38
+ l.set([
38
39
  255,
39
40
  255,
40
41
  255,
41
- Math.round(255 * C(i, n))
42
+ Math.round(255 * T(i, n))
42
43
  ], e * 4);
43
44
  }
44
- let d = a(c ? 1 : k, c ? k : 1, u);
45
- return A.set(e, d), d;
45
+ let u = _(s ? 1 : N, s ? N : 1, l);
46
+ return P.set(e, u), u;
46
47
  }
47
- var M = (e) => {
48
+ var I = (e) => {
48
49
  let t = Math.floor(e.x), n = Math.floor(e.y);
49
50
  return {
50
51
  x: t,
@@ -52,33 +53,33 @@ var M = (e) => {
52
53
  width: Math.ceil(e.x + e.width) - t,
53
54
  height: Math.ceil(e.y + e.height) - n
54
55
  };
55
- }, N = (e) => `x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}"`, P = (e, t) => ({
56
+ }, L = (e) => `x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}"`, R = (e, t) => ({
56
57
  x: e.x - t,
57
58
  y: e.y - t,
58
59
  width: e.width + 2 * t,
59
60
  height: e.height + 2 * t
60
61
  });
61
- function F(e, t, n) {
62
+ function z(e, t, n) {
62
63
  switch (e.edge) {
63
- case "bottom": return M({
64
+ case "bottom": return I({
64
65
  x: e.x,
65
66
  y: e.y + t * e.height,
66
67
  width: e.width,
67
68
  height: (n - t) * e.height
68
69
  });
69
- case "top": return M({
70
+ case "top": return I({
70
71
  x: e.x,
71
72
  y: e.y + (1 - n) * e.height,
72
73
  width: e.width,
73
74
  height: (n - t) * e.height
74
75
  });
75
- case "right": return M({
76
+ case "right": return I({
76
77
  x: e.x + t * e.width,
77
78
  y: e.y,
78
79
  width: (n - t) * e.width,
79
80
  height: e.height
80
81
  });
81
- case "left": return M({
82
+ case "left": return I({
82
83
  x: e.x + (1 - n) * e.width,
83
84
  y: e.y,
84
85
  width: (n - t) * e.width,
@@ -86,100 +87,105 @@ function F(e, t, n) {
86
87
  });
87
88
  }
88
89
  }
89
- var I = (e, t) => e.x < t.x + t.width && t.x < e.x + e.width && e.y < t.y + t.height && t.y < e.y + e.height;
90
- function L(e, t, n, r, i) {
91
- let a = [], o = e.edge === "top" || e.edge === "bottom", s = e.edge === "bottom" || e.edge === "right" ? -1 : 1, c = o ? e.height : e.width;
92
- if (!r) {
93
- let n = c / 6;
94
- a.push(`<feFlood flood-color="#fff" ${N(F(e, .5, 1.5))} result="${t}step"/>`, `<feGaussianBlur in="${t}step" stdDeviation="${o ? `0 ${n}` : `${n} 0`}" ${N(M(e))} result="${t}ramp"/>`);
90
+ function B(e, t, n, r, i) {
91
+ let a = r === "webkit", o = r !== "gecko", s = [], c = e.edge === "top" || e.edge === "bottom", l = e.edge === "bottom" || e.edge === "right" ? -1 : 1, u = c ? e.height : e.width;
92
+ if (!a) {
93
+ let n = u / 6;
94
+ s.push(`<feFlood flood-color="#fff" ${L(z(e, .5, 1.5))} result="${t}step"/>`, `<feGaussianBlur in="${t}step" stdDeviation="${c ? `0 ${n}` : `${n} 0`}" ${L(I(e))} result="${t}ramp"/>`);
95
95
  }
96
- let l = [], u = [];
97
- for (let c = 0; c <= b; c++) {
98
- let d = F(e, w[c][0], w[c][1]), f = ` ${N(c === 0 && i ? i : d)}`, p = e.blur * (c / b) ** 2, m = n, h = e.refraction * T(c);
99
- if (h > .01) {
100
- let e = (h * s).toFixed(3);
101
- a.push(`<feOffset in="${n}" dx="${o ? 0 : e}" dy="${o ? e : 0}" ${N(P(d, Math.ceil(3 * p) + 1))} result="${t}shift${c}"/>`), m = `${t}shift${c}`;
96
+ let d = [], f = [];
97
+ for (let r = 0; r <= x; r++) {
98
+ let u = z(e, E[r][0], E[r][1]), p = ` ${L(r === 0 && i ? i : u)}`, m = e.blur * (r / x) ** 2, h = n, g = e.refraction * D(r);
99
+ if (g > .01) {
100
+ let e = (g * l).toFixed(3);
101
+ s.push(`<feOffset in="${n}" dx="${c ? 0 : e}" dy="${c ? e : 0}" ${L(R(u, Math.ceil(3 * m) + 1))} result="${t}shift${r}"/>`), h = `${t}shift${r}`;
102
102
  }
103
- c && (a.push(`<feGaussianBlur in="${m}" stdDeviation="${p}" ${N(d)} result="${t}blur${c}"/>`), m = `${t}blur${c}`), a.push(r ? `<feImage data-map="pg:${e.edge}:${c}" preserveAspectRatio="none" ${N(d)} result="${t}weight${c}"/>` : `<feComponentTransfer in="${t}ramp"${f} result="${t}weight${c}"><feFuncA type="table" tableValues="${O[c]}"/></feComponentTransfer>`), a.push(`<feComposite in="${m}" in2="${t}weight${c}" operator="in"${f} result="${t}part${c}"/>`), (c % 2 ? u : l).push(`${t}part${c}`);
103
+ r && (s.push(`<feGaussianBlur in="${h}" stdDeviation="${m}" ${L(u)} result="${t}blur${r}"/>`), h = `${t}blur${r}`);
104
+ let _ = !o || r < x;
105
+ if (_ && s.push(a ? `<feImage data-map="pg:${e.edge}:${r}" preserveAspectRatio="none" ${L(u)} result="${t}weight${r}"/>` : `<feComponentTransfer in="${t}ramp"${p} result="${t}weight${r}"><feFuncA type="table" tableValues="${(o ? M : j)[r]}"/></feComponentTransfer>`), _) {
106
+ let e = `${t}${o && r ? "covered" : "part"}${r}`;
107
+ s.push(`<feComposite in="${h}" in2="${t}weight${r}" operator="in"${p} result="${e}"/>`), h = e;
108
+ }
109
+ o && r && s.push(`<feComposite in="${h}" in2="${t}weight${r - 1}" operator="out"${p} result="${t}part${r}"/>`), (r % 2 ? f : d).push(`${t}part${r}`);
104
110
  }
105
111
  return {
106
- markup: a,
107
- even: l,
108
- odd: u
112
+ markup: s,
113
+ even: d,
114
+ odd: f
109
115
  };
110
116
  }
111
- function R(e, t, n, r, i = _) {
112
- let a = Math.max(256, ...t.map((e) => Math.ceil((e.edge === "top" || e.edge === "bottom" ? e.height : e.width) / 2 + 3 * e.blur + e.refraction + 8))), o = {
113
- x: -a,
114
- y: -a,
115
- width: n + 2 * a,
116
- height: r + 2 * a
117
- }, s = [], c = (e, t, n) => `<feMerge result="${t}"${n ? ` ${N(n)}` : ""}>${e.map((e) => `<feMergeNode in="${e}"/>`).join("")}</feMerge>`, l = (e, t, n, r) => i === "gecko" ? `<feComposite in="${e}" in2="${t}" operator="arithmetic" k2="1" k3="1"${r ? ` ${N(r)}` : ""} result="${n}"/>` : `<feComposite in="${e}" in2="${t}" operator="lighter"${r ? ` ${N(r)}` : ""} result="${n}"/>`;
118
- if (i === "gecko") {
117
+ function V(e, t, n, i, a = v) {
118
+ let o = Math.max(256, ...t.map((e) => Math.ceil((e.edge === "top" || e.edge === "bottom" ? e.height : e.width) / 2 + 3 * e.blur + e.refraction + 8))), s = {
119
+ x: -o,
120
+ y: -o,
121
+ width: n + 2 * o,
122
+ height: i + 2 * o
123
+ }, c = [], l = (e, t, n) => `<feMerge result="${t}"${n ? ` ${L(n)}` : ""}>${e.map((e) => `<feMergeNode in="${e}"/>`).join("")}</feMerge>`, u = (e, t, n, r) => a === "gecko" ? `<feComposite in="${e}" in2="${t}" operator="arithmetic" k2="1" k3="1"${r ? ` ${L(r)}` : ""} result="${n}"/>` : `<feComposite in="${e}" in2="${t}" operator="lighter"${r ? ` ${L(r)}` : ""} result="${n}"/>`;
124
+ if (a === "gecko") {
119
125
  let e = "SourceGraphic";
120
126
  t.forEach((t, n) => {
121
- let r = `e${n}`, { markup: i, even: a, odd: u } = L(t, r, e, !1, o);
122
- s.push(...i, c(a, `${r}even`, o), c(u, `${r}odd`, M(t)), l(`${r}even`, `${r}odd`, `${r}result`, o)), e = `${r}result`;
127
+ let r = `e${n}`, { markup: i, even: o, odd: d } = B(t, r, e, a, s);
128
+ c.push(...i, l(o, `${r}even`, s), l(d, `${r}odd`, I(t)), u(`${r}even`, `${r}odd`, `${r}result`, s)), e = `${r}result`;
123
129
  });
124
130
  } else {
125
- let e = t.every((e, n) => t.every((t, r) => n === r || !I(M(e), M(t)))) ? [t] : t.map((e) => [e]), n = "SourceGraphic";
131
+ let e = t.every((e, n) => t.every((t, i) => n === i || !r(I(e), I(t)))) ? [t] : t.map((e) => [e]), n = "SourceGraphic";
126
132
  e.forEach((e, r) => {
127
- let a = [], o = [];
133
+ let i = [], o = [];
128
134
  e.forEach((e) => {
129
- let r = `e${t.indexOf(e)}`, { markup: u, even: d, odd: f } = L(e, r, n, i === "webkit");
130
- s.push(...u, `<feFlood flood-color="#fff" ${N(M(e))} result="${r}area"/>`, c(d, `${r}even`, M(e)), c(f, `${r}odd`, M(e)), l(`${r}even`, `${r}odd`, `${r}result`, M(e))), a.push(`${r}result`), o.push(`${r}area`);
135
+ let r = `e${t.indexOf(e)}`, { markup: s, even: d, odd: f } = B(e, r, n, a);
136
+ c.push(...s, `<feFlood flood-color="#fff" ${L(I(e))} result="${r}area"/>`, l(d, `${r}even`, I(e)), l(f, `${r}odd`, I(e)), u(`${r}even`, `${r}odd`, `${r}result`, I(e))), i.push(`${r}result`), o.push(`${r}area`);
131
137
  });
132
- let u = `g${r}`;
133
- o.length > 1 && s.push(c(o, `${u}areas`)), s.push(`<feComposite in="${n}" in2="${o.length > 1 ? `${u}areas` : o[0]}" operator="out" result="${u}outside"/>`, c([`${u}outside`, ...a], `${u}result`)), n = `${u}result`;
138
+ let s = `g${r}`;
139
+ o.length > 1 && c.push(l(o, `${s}areas`)), c.push(`<feComposite in="${n}" in2="${o.length > 1 ? `${s}areas` : o[0]}" operator="out" result="${s}outside"/>`, l([`${s}outside`, ...i], `${s}result`)), n = `${s}result`;
134
140
  });
135
141
  }
136
- return `<filter id="${e}" x="${-a / n}" y="${-a / r}" width="${1 + 2 * a / n}" height="${1 + 2 * a / r}" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">${s.join("")}</filter>`;
142
+ return `<filter id="${e}" x="${-o / n}" y="${-o / i}" width="${1 + 2 * o / n}" height="${1 + 2 * o / i}" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="sRGB">${c.join("")}</filter>`;
137
143
  }
138
- function z(a, _, b = !1) {
139
- let x = document.createElementNS(y, "svg");
144
+ function H(r, _, v = !1) {
145
+ let x = document.createElementNS(b, "svg");
140
146
  x.setAttribute("aria-hidden", "true"), x.setAttribute("width", "0"), x.setAttribute("height", "0"), x.style.cssText = "position:absolute;pointer-events:none;overflow:hidden";
141
- let S = document.createElementNS(y, "defs");
142
- x.append(S), a.ownerDocument.body.append(x);
143
- let C = `lg-progressive-${++v}`, w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), E = 0, D = 1, O = !1, k = "", A = 0, M = /* @__PURE__ */ new Map();
144
- function N(e, t) {
145
- e.style.filter === t.applied && (e.style.filter = t.original), t.layer.dispose(), t.releasePaint?.(), M.delete(e);
147
+ let S = document.createElementNS(b, "defs");
148
+ x.append(S), r.ownerDocument.body.append(x);
149
+ let C = `lg-progressive-${++y}`, w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), E = 0, D = 1, O = !1, k = "", A = 0, j = /* @__PURE__ */ new Map();
150
+ function M(e, t) {
151
+ e.style.filter === t.applied && (e.style.filter = t.original), t.layer.dispose(), t.releasePaint?.(), j.delete(e);
146
152
  }
147
- function P(e) {
148
- let n = /* @__PURE__ */ new Map();
149
- for (let t of T) {
150
- let r = typeof t.target == "function" ? t.target() : t.target;
153
+ function N(e) {
154
+ let t = /* @__PURE__ */ new Map();
155
+ for (let n of T) {
156
+ let r = typeof n.target == "function" ? n.target() : n.target;
151
157
  if (r === e) continue;
152
158
  let i = r;
153
159
  if (!i) continue;
154
- let a = n.get(i) ?? [];
155
- a.push(t), n.set(i, a);
160
+ let a = t.get(i) ?? [];
161
+ a.push(n), t.set(i, a);
156
162
  }
157
- for (let [e, t] of M) n.has(e) || N(e, t);
158
- let r = 0;
159
- for (let [e, i] of n) {
160
- let n = M.get(e);
161
- n || (n = {
162
- layer: z(a, _, !0),
163
+ for (let [e, n] of j) t.has(e) || M(e, n);
164
+ let n = 0;
165
+ for (let [e, i] of t) {
166
+ let t = j.get(e);
167
+ t || (t = {
168
+ layer: H(r, _, !0),
163
169
  options: [],
164
170
  remove: [],
165
171
  original: e.style.filter,
166
- releasePaint: t ? g(e) : void 0,
172
+ releasePaint: m ? h(e) : void 0,
167
173
  applied: e.style.filter
168
- }, M.set(e, n)), (i.length !== n.options.length || i.some((e, t) => e !== n.options[t])) && (n.remove.forEach((e) => e()), n.remove = i.map((e) => n.layer.addScroll(e)), n.options = i);
169
- let o = n.layer.update(e), s = [n.original, o].filter(Boolean).join(" ");
170
- e.style.filter !== s && (e.style.filter = s), n.applied = s, r += n.layer.count();
174
+ }, j.set(e, t)), (i.length !== t.options.length || i.some((e, n) => e !== t.options[n])) && (t.remove.forEach((e) => e()), t.remove = i.map((e) => t.layer.addScroll(e)), t.options = i);
175
+ let a = t.layer.update(e), o = [t.original, a].filter(Boolean).join(" ");
176
+ e.style.filter !== o && (e.style.filter = o), t.applied = o, n += t.layer.count();
171
177
  }
172
- return r;
178
+ return n;
173
179
  }
174
- let F = matchMedia("(prefers-reduced-transparency: reduce)"), I = matchMedia("(forced-colors: active)"), L = "", B = "", V = 0, H = [], U, W = 0, G = (e) => {
175
- a.dataset.glassBlurEdges !== e && (a.dataset.glassBlurEdges = e);
180
+ let P = matchMedia("(prefers-reduced-transparency: reduce)"), I = matchMedia("(forced-colors: active)"), L = "", R = "", z = 0, B = [], U, W = 0, G = (e) => {
181
+ r.dataset.glassBlurEdges !== e && (r.dataset.glassBlurEdges = e);
176
182
  };
177
183
  function K() {
178
- H = [], L && l(S, [], j), L = "", B = "", V = 0, U = void 0, W = 0, b || G("0");
184
+ B = [], L && g(S, [], F), L = "", R = "", z = 0, U = void 0, W = 0, v || G("0");
179
185
  }
180
186
  let q = () => w.size + [...T].reduce((e, t) => e + new Set(t.edges ?? ["top", "bottom"]).size, 0);
181
187
  function J(e) {
182
- if (f(e.options), q() >= 64) throw RangeError("A GlassScene supports at most 64 progressive blur regions.");
188
+ if (n(e.options), q() >= 64) throw RangeError("A GlassScene supports at most 64 progressive blur regions.");
183
189
  return w.add(e), () => {
184
190
  w.delete(e);
185
191
  };
@@ -193,24 +199,24 @@ function z(a, _, b = !1) {
193
199
  },
194
200
  addScroll(e) {
195
201
  let t = [...new Set(e.edges ?? ["top", "bottom"])];
196
- if (f(e), t.forEach((e) => f({ edge: e })), q() + t.length > 64) throw RangeError("A GlassScene supports at most 64 progressive blur regions.");
197
- if (!b) return T.add(e), () => {
202
+ if (n(e), t.forEach((e) => n({ edge: e })), q() + t.length > 64) throw RangeError("A GlassScene supports at most 64 progressive blur regions.");
203
+ if (!v) return T.add(e), () => {
198
204
  T.delete(e);
199
205
  };
200
- let n = t.map((t) => J({
206
+ let r = t.map((t) => J({
201
207
  options: {
202
208
  ...e,
203
209
  edge: t
204
210
  },
205
211
  target: e.target
206
212
  }));
207
- return () => n.forEach((e) => e());
213
+ return () => r.forEach((e) => e());
208
214
  },
209
215
  count() {
210
- return V;
216
+ return z;
211
217
  },
212
218
  regions() {
213
- return H;
219
+ return B;
214
220
  },
215
221
  operations() {
216
222
  return W;
@@ -222,13 +228,13 @@ function z(a, _, b = !1) {
222
228
  return O;
223
229
  },
224
230
  error() {
225
- return U ?? [...M.values()].map((e) => e.layer.error()).find(Boolean);
231
+ return U ?? [...j.values()].map((e) => e.layer.error()).find(Boolean);
226
232
  },
227
- update(f) {
233
+ update(n) {
228
234
  E = 0;
229
- let g = b ? 0 : P(f);
230
- b || G(String(g));
231
- let _ = [...T].filter((e) => (typeof e.target == "function" ? e.target() : e.target) === f).flatMap((e) => [...new Set(e.edges ?? ["top", "bottom"])].map((t) => ({
235
+ let h = v ? 0 : N(n);
236
+ v || G(String(h));
237
+ let _ = [...T].filter((e) => (typeof e.target == "function" ? e.target() : e.target) === n).flatMap((e) => [...new Set(e.edges ?? ["top", "bottom"])].map((t) => ({
232
238
  options: {
233
239
  ...e,
234
240
  edge: t
@@ -236,38 +242,38 @@ function z(a, _, b = !1) {
236
242
  target: e.target
237
243
  })));
238
244
  O = _.length > 0;
239
- let v = [...w, ..._];
240
- if (!f || F.matches || I.matches || !v.length) return (L || B) && K(), b || G(String(g)), "";
241
- let y = f.getBoundingClientRect(), x = f.offsetWidth, M = f.offsetHeight;
242
- if (!x || !M || !y.width || !y.height) return K(), "";
243
- let N = x / y.width, z = M / y.height, q = [];
244
- for (let { element: e, options: t, target: n } of v) {
245
- if (t.disabled || !(t.size ?? 80) || !(t.blur ?? 20) && !(t.refraction ?? 0)) continue;
246
- let r = typeof n == "function" ? n() : n;
247
- if (n && !r) continue;
248
- let i = getComputedStyle(r ?? a).direction === "rtl", o = u(t.edge ?? "bottom", i), s = o === "top" || o === "bottom", c = e?.getBoundingClientRect(), l = 1;
249
- if (r) {
250
- let e = r.clientWidth, n = r.clientHeight, a = r.getBoundingClientRect(), u = a.width / (r.offsetWidth || 1), f = a.height / (r.offsetHeight || 1), p = a.left + r.clientLeft * u, m = a.top + r.clientTop * f, h = Math.min(t.size ?? 80, (s ? n : e) / 2);
251
- l = d(o, r.scrollLeft, r.scrollTop, Math.max(0, r.scrollWidth - e), Math.max(0, r.scrollHeight - n), i, h), c = new DOMRect(o === "right" ? p + (e - h) * u : p, o === "bottom" ? m + (n - h) * f : m, (s ? e : h) * u, (s ? h : n) * f);
245
+ let y = [...w, ..._];
246
+ if (!n || P.matches || I.matches || !y.length) return (L || R) && K(), v || G(String(h)), "";
247
+ let b = n.getBoundingClientRect(), x = n.offsetWidth, j = n.offsetHeight;
248
+ if (!x || !j || !b.width || !b.height) return K(), "";
249
+ let M = x / b.width, H = j / b.height, q = [];
250
+ for (let { element: n, options: i, target: a } of y) {
251
+ if (i.disabled || !(i.size ?? 80) || !(i.blur ?? 20) && !(i.refraction ?? 0)) continue;
252
+ let o = typeof a == "function" ? a() : a;
253
+ if (a && !o) continue;
254
+ let s = getComputedStyle(o ?? r).direction === "rtl", c = e(i.edge ?? "bottom", s), l = c === "top" || c === "bottom", u = n?.getBoundingClientRect(), d = 1;
255
+ if (o) {
256
+ let e = o.clientWidth, n = o.clientHeight, r = o.getBoundingClientRect(), a = r.width / (o.offsetWidth || 1), f = r.height / (o.offsetHeight || 1), p = r.left + o.clientLeft * a, m = r.top + o.clientTop * f, h = Math.min(i.size ?? 80, (l ? n : e) / 2);
257
+ d = t(c, o.scrollLeft, o.scrollTop, Math.max(0, o.scrollWidth - e), Math.max(0, o.scrollHeight - n), s, h), u = new DOMRect(c === "right" ? p + (e - h) * a : p, c === "bottom" ? m + (n - h) * f : m, (l ? e : h) * a, (l ? h : n) * f);
252
258
  }
253
- if (!c || !l || c.bottom < 0 || c.top > innerHeight || c.right < 0 || c.left > innerWidth) continue;
254
- let f = s ? Math.max(c.left, y.left) : c.left, p = s ? c.top : Math.max(c.top, y.top), m = s ? Math.min(c.right, y.right) : c.right, h = s ? c.bottom : Math.min(c.bottom, y.bottom);
255
- m <= f || h <= p || c.bottom <= y.top || c.top >= y.bottom || c.right <= y.left || c.left >= y.right || q.push({
256
- edge: o,
257
- x: (f - y.left) * N,
258
- y: (p - y.top) * z,
259
- width: (m - f) * N,
260
- height: (h - p) * z,
261
- blur: (t.blur ?? 20) * l,
262
- refraction: (t.refraction ?? 0) * l
259
+ if (!u || !d || u.bottom < 0 || u.top > innerHeight || u.right < 0 || u.left > innerWidth) continue;
260
+ let f = l ? Math.max(u.left, b.left) : u.left, p = l ? u.top : Math.max(u.top, b.top), m = l ? Math.min(u.right, b.right) : u.right, h = l ? u.bottom : Math.min(u.bottom, b.bottom);
261
+ m <= f || h <= p || u.bottom <= b.top || u.top >= b.bottom || u.right <= b.left || u.left >= b.right || q.push({
262
+ edge: c,
263
+ x: (f - b.left) * M,
264
+ y: (p - b.top) * H,
265
+ width: (m - f) * M,
266
+ height: (h - p) * H,
267
+ blur: (i.blur ?? 20) * d,
268
+ refraction: (i.refraction ?? 0) * d
263
269
  });
264
270
  }
265
- if (H = q, !q.length) return (L || B) && K(), b || G(String(g)), "";
266
- let J = o();
267
- if (t) {
271
+ if (B = q, !q.length) return (L || R) && K(), v || G(String(h)), "";
272
+ let J = l();
273
+ if (m) {
268
274
  let e = JSON.stringify([
269
275
  x,
270
- M,
276
+ j,
271
277
  ...q.map((e) => [
272
278
  e.edge,
273
279
  e.width,
@@ -276,24 +282,23 @@ function z(a, _, b = !1) {
276
282
  e.refraction
277
283
  ])
278
284
  ]);
279
- e !== k && (k = e, A = r(R(C, q, x, M)));
280
- let t = A * J, i = n(x * J, M * J, t);
281
- if (E = t * i / J, i < 1) for (let e of q) e.blur *= i, e.refraction *= i;
285
+ e !== k && (k = e, A = a(V(C, q, x, j)));
286
+ let t = A * J, n = i(x * J, j * J, t);
287
+ if (E = t * n / J, n < 1) for (let e of q) e.blur *= n, e.refraction *= n;
282
288
  }
283
- let Y = R(C, q, x, M);
284
- if (t) {
285
- let e = E > c(x, M) / 2, t = Math.min((e ? 2 : 1) * m(Y, x, M), i(x * J, M * J) / J / 2, e ? Infinity : c(x, M, .85) / 2);
286
- t > E && (Y = p(Y, Math.floor(t), x, M, e), E = Math.floor(t));
289
+ let Y = V(C, q, x, j);
290
+ if (m) {
291
+ let e = E > d(x, j) / 2, t = Math.min((e ? 2 : 1) * c(Y, x, j), o(x * J, j * J) / J / 2, e ? Infinity : d(x, j, .85) / 2);
292
+ t > E && (Y = s(Y, Math.floor(t), x, j, E === A ? A : void 0), E = a(Y));
287
293
  }
288
- let X = s();
289
- return (Y !== L || X !== D) && (L = Y, D = X, V = q.length, W = e ? h(Y) : 0, U = W > 64 ? /* @__PURE__ */ RangeError(`Progressive blur requires ${W} filter operations; this browser supports 64 per element.`) : void 0, B = `url("#${l(S, [Y], j)(C)}")`), b || G(String(g + q.length)), B;
294
+ let X = u();
295
+ return (Y !== L || X !== D) && (L = Y, D = X, z = q.length, W = p ? f(Y) : 0, U = W > 64 ? /* @__PURE__ */ RangeError(`Progressive blur requires ${W} filter operations; this browser supports 64 per element.`) : void 0, R = `url("#${g(S, [Y], F)(C)}")`), v || G(String(h + q.length)), R;
290
296
  },
291
297
  dispose() {
292
298
  w.clear(), T.clear();
293
- for (let [e, t] of M) N(e, t);
294
- x.remove(), b || delete a.dataset.glassBlurEdges;
299
+ for (let [e, t] of j) M(e, t);
300
+ x.remove(), v || delete r.dataset.glassBlurEdges;
295
301
  }
296
302
  };
297
303
  }
298
- //#endregion
299
- export { z as createProgressiveLayer, j as maskUrl, R as progressiveGraph, O as rampTables };
304
+ export { M as coverTables, H as createProgressiveLayer, F as maskUrl, V as progressiveGraph, j as rampTables };
@@ -1,6 +1,5 @@
1
- //#region src/dom/renderer.ts
1
+ // src/dom/renderer.ts
2
2
  function e() {
3
3
  return import("../gpu.js").then((e) => e.getMaterialRenderer());
4
4
  }
5
- //#endregion
6
5
  export { e as getMaterialRenderer };
@@ -1,4 +1,4 @@
1
- //#region src/dom/sampling-bounds.ts
1
+ // src/dom/sampling-bounds.ts
2
2
  function e(e, t, n = !1) {
3
3
  let r = Math.abs(t), i = (e) => !n || t < 0 ? r + 3 : Math.min(r, Math.max(0, r - e / 2) + r / 255) + 3, a = i(e.width), o = i(e.height);
4
4
  return {
@@ -18,5 +18,4 @@ function t(e) {
18
18
  height: Math.max(...e.map((e) => e.y + e.height)) - n
19
19
  };
20
20
  }
21
- //#endregion
22
21
  export { e as refractionSamplingBounds, t as unionSamplingBounds };