@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,159 +1,130 @@
1
1
  "use client";
2
- import { GlassShape as e } from "./shape.js";
3
- import { prepareSubmenuHandoff as t } from "../dom/morph.js";
2
+ import { useMergedRef as e } from "./merged-ref.js";
3
+ import { GlassRow as t } from "./shape.js";
4
4
  import { useScene as n } from "./scene.js";
5
- import { GlassSurface as r } from "./surface.js";
6
- import { useMergedRef as i } from "./merged-ref.js";
7
- import { Fragment as a, createContext as o, useCallback as s, useContext as c, useEffect as l, useRef as u, useState as d } from "react";
8
- import { useRender as f } from "@base-ui/react/use-render";
9
- import { jsx as p } from "react/jsx-runtime";
10
- import { Menu as m } from "@base-ui/react/menu";
11
- //#region src/react/menu.tsx
12
- var h = o(null);
13
- function g(e) {
14
- let [t] = d(() => ({
5
+ import { GlassPopupSurface as r } from "./surface.js";
6
+ import { layoutRect as i } from "../dom/layout-rect.js";
7
+ import { Fragment as a, createContext as o, useCallback as s, useContext as c, useState as l } from "react";
8
+ import { useRender as u } from "@base-ui/react/use-render";
9
+ import { jsx as d } from "react/jsx-runtime";
10
+ import { Menu as f } from "@base-ui/react/menu";
11
+ // src/react/menu.tsx
12
+ var p = o(null);
13
+ function m(e) {
14
+ let [t] = l(() => ({
15
15
  triggers: /* @__PURE__ */ new Map(),
16
16
  stable: e
17
17
  }));
18
18
  return t;
19
19
  }
20
- function _(e) {
21
- let t = c(h), [n] = d(() => e);
20
+ function h(e) {
21
+ let t = c(p), [n] = l(() => e);
22
22
  return s((e) => {
23
23
  if (e && t) return t.triggers.set(e, n(e)), () => {
24
24
  t.triggers.delete(e);
25
25
  };
26
26
  }, [t, n]);
27
27
  }
28
- function v(e) {
29
- let t = g(!0);
30
- return /* @__PURE__ */ p(h.Provider, {
28
+ function g(e) {
29
+ let t = m(!0);
30
+ return /* @__PURE__ */ d(p.Provider, {
31
31
  value: t,
32
- children: /* @__PURE__ */ p(m.Root, { ...e })
32
+ children: /* @__PURE__ */ d(f.Root, { ...e })
33
33
  });
34
34
  }
35
- function y({ ref: e, ...t }) {
36
- let n = _((e) => e.parentElement), r = f({
37
- render: /* @__PURE__ */ p(m.Trigger, { ...t }),
35
+ function _({ ref: e, ...t }) {
36
+ let n = h((e) => e.parentElement), r = u({
37
+ render: /* @__PURE__ */ d(f.Trigger, { ...t }),
38
38
  ref: [n, e ?? null]
39
39
  });
40
- return /* @__PURE__ */ p("span", {
40
+ return /* @__PURE__ */ d("span", {
41
41
  className: "lg-menu-anchor",
42
42
  children: r
43
43
  });
44
44
  }
45
- function b(e) {
46
- let t = g(!1);
47
- return /* @__PURE__ */ p(h.Provider, {
45
+ function v(e) {
46
+ let t = m(!1);
47
+ return /* @__PURE__ */ d(p.Provider, {
48
48
  value: t,
49
- children: /* @__PURE__ */ p(m.SubmenuRoot, { ...e })
49
+ children: /* @__PURE__ */ d(f.SubmenuRoot, { ...e })
50
50
  });
51
51
  }
52
- function x({ ref: n, delay: r = 40, onPointerEnter: a, onPointerLeave: o, onFocus: s, onBlur: c, ...d }) {
53
- let f = _(() => null), h = u(void 0), g = (e) => {
54
- h.current?.(), h.current = t(e);
55
- }, v = () => {
56
- h.current?.(), h.current = void 0;
57
- };
58
- return l(() => v, []), /* @__PURE__ */ p(e, {
59
- ref: i(f, n),
60
- concentric: { contentPadding: 8 },
61
- render: /* @__PURE__ */ p(m.SubmenuTrigger, {
52
+ function y({ ref: n, delay: r = 0, ...i }) {
53
+ let a = h(() => null);
54
+ return /* @__PURE__ */ d(t, {
55
+ ref: e(a, n),
56
+ render: /* @__PURE__ */ d(f.SubmenuTrigger, {
62
57
  delay: r,
63
- ...d,
64
- onPointerEnter: (e) => {
65
- a?.(e), !e.defaultPrevented && !d.disabled && g(e.currentTarget);
66
- },
67
- onPointerLeave: (e) => {
68
- o?.(e), v();
69
- },
70
- onFocus: (e) => {
71
- s?.(e), !e.defaultPrevented && !d.disabled && g(e.currentTarget);
72
- },
73
- onBlur: (e) => {
74
- c?.(e), v();
75
- }
58
+ ...i
76
59
  })
77
60
  });
78
61
  }
79
- var S = m.Group;
80
- function C(t) {
81
- return /* @__PURE__ */ p(e, {
82
- concentric: { contentPadding: 8 },
83
- render: /* @__PURE__ */ p(m.GroupLabel, { ...t })
84
- });
62
+ var b = f.Group;
63
+ function x(e) {
64
+ return /* @__PURE__ */ d(t, { render: /* @__PURE__ */ d(f.GroupLabel, { ...e }) });
85
65
  }
86
- var w = m.Separator;
87
- function T(t) {
88
- return /* @__PURE__ */ p(e, {
89
- concentric: { contentPadding: 8 },
90
- render: /* @__PURE__ */ p(m.CheckboxItem, { ...t })
91
- });
66
+ var S = f.Separator;
67
+ function C(e) {
68
+ return /* @__PURE__ */ d(t, { render: /* @__PURE__ */ d(f.CheckboxItem, { ...e }) });
92
69
  }
93
- var E = m.RadioGroup;
94
- function D(t) {
95
- return /* @__PURE__ */ p(e, {
96
- concentric: { contentPadding: 8 },
97
- render: /* @__PURE__ */ p(m.RadioItem, { ...t })
98
- });
70
+ var w = f.RadioGroup;
71
+ function T(e) {
72
+ return /* @__PURE__ */ d(t, { render: /* @__PURE__ */ d(f.RadioItem, { ...e }) });
99
73
  }
100
- function O({ children: e, className: t = "", style: i, material: o = "regular", appearance: s, radius: l = 28, refraction: u, tint: d, interactive: f, motion: g, morph: _, neck: v, side: y, align: b, sideOffset: x, alignOffset: S, collisionAvoidance: C, positionerProps: w, portalProps: T, ...E }) {
101
- let { root: D } = n(), O = c(h), k = () => {
102
- let e = [...O?.triggers.keys() ?? []];
74
+ function E({ children: e, className: t = "", style: o, material: s = "regular", appearance: l, radius: u = 28, refraction: m, tint: h, specular: g, frost: _, interactive: v, motion: y, side: b, align: x, sideOffset: S, alignOffset: C, collisionAvoidance: w, positionerProps: T, portalProps: E, ...D }) {
75
+ let { root: O } = n(), k = c(p), A = () => {
76
+ let e = [...k?.triggers.keys() ?? []];
103
77
  return e.find((e) => e.hasAttribute("data-popup-open")) ?? e[0] ?? null;
104
- }, A = () => {
105
- let e = k();
106
- return e ? O?.triggers.get(e) ?? null : null;
107
- }, j = O?.stable ? O : null;
108
- return /* @__PURE__ */ p(m.Portal, {
109
- ...T,
110
- container: D,
78
+ }, j = () => {
79
+ let e = A(), t = e ? k?.triggers.get(e) ?? null : null;
80
+ return t ? {
81
+ getBoundingClientRect: () => i(t),
82
+ contextElement: t
83
+ } : null;
84
+ }, M = k?.stable ? k : null;
85
+ return /* @__PURE__ */ d(f.Portal, {
86
+ ...E,
87
+ container: O,
111
88
  style: {
112
89
  display: "contents",
113
- ...T?.style
90
+ ...E?.style
114
91
  },
115
- children: /* @__PURE__ */ p(m.Positioner, {
92
+ children: /* @__PURE__ */ d(f.Positioner, {
116
93
  className: "lg-menu-positioner",
117
- ...w,
118
- anchor: w?.anchor ?? (j ? A : void 0),
119
- side: y ?? w?.side,
120
- align: b ?? w?.align ?? "end",
121
- sideOffset: x ?? w?.sideOffset ?? 8,
122
- alignOffset: S ?? w?.alignOffset,
123
- collisionAvoidance: C ?? w?.collisionAvoidance,
124
- children: /* @__PURE__ */ p(r, {
125
- material: o,
126
- appearance: s,
127
- radius: l,
128
- refraction: u,
129
- tint: d,
130
- interactive: f,
131
- motion: g,
132
- morphFrom: k,
133
- morph: _,
134
- neck: v,
135
- style: i,
94
+ positionMethod: "fixed",
95
+ ...T,
96
+ anchor: T?.anchor ?? (M ? j : void 0),
97
+ side: b ?? T?.side,
98
+ align: x ?? T?.align ?? "end",
99
+ sideOffset: S ?? T?.sideOffset ?? 8,
100
+ alignOffset: C ?? T?.alignOffset,
101
+ collisionAvoidance: w ?? T?.collisionAvoidance,
102
+ children: /* @__PURE__ */ d(r, {
103
+ material: s,
104
+ appearance: l,
105
+ radius: u,
106
+ refraction: m,
107
+ tint: h,
108
+ specular: g,
109
+ frost: _,
110
+ interactive: v,
111
+ motion: y,
112
+ style: o,
136
113
  className: `lg-menu ${t}`,
137
- render: /* @__PURE__ */ p(m.Popup, { ...E }),
138
- children: /* @__PURE__ */ p(a, { children: e })
114
+ render: /* @__PURE__ */ d(f.Popup, { ...D }),
115
+ children: /* @__PURE__ */ d(a, { children: e })
139
116
  })
140
117
  })
141
118
  });
142
119
  }
143
- function k(t) {
144
- return /* @__PURE__ */ p(e, {
145
- concentric: { contentPadding: 8 },
146
- render: /* @__PURE__ */ p(m.Item, { ...t })
147
- });
120
+ function D(e) {
121
+ return /* @__PURE__ */ d(t, { render: /* @__PURE__ */ d(f.Item, { ...e }) });
148
122
  }
149
- function A(e) {
150
- return /* @__PURE__ */ p(O, {
151
- neck: 0,
123
+ function O(e) {
124
+ return /* @__PURE__ */ d(E, {
152
125
  ...e,
153
- "data-glass-submenu": "",
154
126
  side: e.side ?? e.positionerProps?.side ?? "inline-end",
155
127
  align: e.align ?? e.positionerProps?.align ?? "start"
156
128
  });
157
129
  }
158
- //#endregion
159
- export { v as GlassMenu, T as GlassMenuCheckboxItem, O as GlassMenuContent, S as GlassMenuGroup, C as GlassMenuGroupLabel, k as GlassMenuItem, E as GlassMenuRadioGroup, D as GlassMenuRadioItem, w as GlassMenuSeparator, b as GlassMenuSubmenu, A as GlassMenuSubmenuContent, x as GlassMenuSubmenuTrigger, y as GlassMenuTrigger };
130
+ export { g as GlassMenu, C as GlassMenuCheckboxItem, E as GlassMenuContent, b as GlassMenuGroup, x as GlassMenuGroupLabel, D as GlassMenuItem, w as GlassMenuRadioGroup, T as GlassMenuRadioItem, S as GlassMenuSeparator, v as GlassMenuSubmenu, O as GlassMenuSubmenuContent, y as GlassMenuSubmenuTrigger, _ as GlassMenuTrigger };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useCallback as e } from "react";
3
- //#region src/react/merged-ref.ts
3
+ // src/react/merged-ref.ts
4
4
  function t(e, t) {
5
5
  if (typeof e == "function") return e(t);
6
6
  e && (e.current = t);
@@ -14,5 +14,4 @@ function n(n, r) {
14
14
  });
15
15
  }, [n, r]);
16
16
  }
17
- //#endregion
18
17
  export { n as useMergedRef };
@@ -3,7 +3,7 @@ import { validateProgressive as e } from "../core/progressive.js";
3
3
  import { useScene as t } from "./scene.js";
4
4
  import { useCallback as n, useLayoutEffect as r } from "react";
5
5
  import { useRender as i } from "@base-ui/react/use-render";
6
- //#region src/react/progressive.tsx
6
+ // src/react/progressive.tsx
7
7
  function a({ edge: r = "bottom", size: a = 80, blur: o = 20, refraction: s = 0, disabled: c = !1, className: l = "", style: u, ref: d, ...f }) {
8
8
  let { controller: p } = t();
9
9
  e({
@@ -69,5 +69,4 @@ function s({ target: n, edges: i = o, size: a = 80, blur: s = 20, refraction: c
69
69
  l
70
70
  ]), null;
71
71
  }
72
- //#endregion
73
72
  export { a as GlassProgressiveBlur, s as GlassScrollEdges };
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { webkit as e } from "../dom/engine.js";
3
- import { createGlassScene as t } from "../dom.js";
4
- import { createContext as n, useCallback as r, useContext as i, useLayoutEffect as a, useRef as o, useState as s, useSyncExternalStore as c } from "react";
5
- import { useRender as l } from "@base-ui/react/use-render";
6
- import { jsx as u } from "react/jsx-runtime";
7
- //#region src/react/scene.tsx
8
- var d = {
3
+ import { createContext as t, useCallback as n, useContext as r, useLayoutEffect as i, useRef as a, useState as o, useSyncExternalStore as s } from "react";
4
+ import { useRender as c } from "@base-ui/react/use-render";
5
+ import { jsx as l } from "react/jsx-runtime";
6
+ // src/react/scene.tsx
7
+ var u, d = () => u ??= import("../dom.js"), f = {
9
8
  setContent() {},
9
+ updateSurface() {},
10
10
  addForeground() {
11
11
  return () => {};
12
12
  },
@@ -23,100 +23,116 @@ var d = {
23
23
  return () => {};
24
24
  },
25
25
  dispose() {}
26
- }, f = n(null);
27
- function p(e) {
28
- let t = i(f);
26
+ }, p = t(null);
27
+ function m(e) {
28
+ let t = r(p);
29
29
  return e ?? t?.motion ?? "full";
30
30
  }
31
- function m() {
32
- let e = i(f);
31
+ function h() {
32
+ let e = r(p);
33
33
  if (!e) throw Error("Glass components must be inside <GlassScene>.");
34
34
  return e;
35
35
  }
36
- function h() {
37
- let { controller: e } = m();
38
- return r((t) => {
36
+ function g() {
37
+ let { controller: e } = h();
38
+ return n((t) => {
39
39
  if (t) return e.addForeground(t);
40
40
  }, [e]);
41
41
  }
42
- function g({ render: e, ref: t, ...n }) {
43
- let r = h();
44
- return l({
42
+ function _({ render: e, ref: t, ...n }) {
43
+ let r = g();
44
+ return c({
45
45
  render: e,
46
46
  ref: [r, t ?? null],
47
47
  props: n
48
48
  });
49
49
  }
50
- function _({ children: e, className: n = "", onDiagnostic: i, maxSurfaces: c = 16, ref: p, material: m = "clear", appearance: h = "light", motion: g = "full", ..._ }) {
51
- let v = Math.max(1, Math.min(64, Math.floor(c)));
52
- if (!Number.isFinite(v)) throw RangeError("maxSurfaces must be finite.");
53
- let [y, b] = s({
54
- controller: d,
50
+ function v({ children: e, className: t = "", onDiagnostic: r, maxSurfaces: s = 16, ref: u, material: m = "regular", appearance: h = "light", specular: g = !1, frost: _ = 0, motion: v = "full", ...y }) {
51
+ let b = Math.max(1, Math.min(64, Math.floor(s)));
52
+ if (!Number.isFinite(b)) throw RangeError("maxSurfaces must be finite.");
53
+ let [x, S] = o({
54
+ controller: f,
55
55
  root: null,
56
- maxSurfaces: v,
56
+ maxSurfaces: b,
57
57
  material: m,
58
58
  appearance: h,
59
- motion: g
60
- }), x = o(i);
61
- a(() => {
62
- x.current = i;
63
- }, [i]);
64
- let S = r((e) => {
59
+ specular: g,
60
+ frost: _,
61
+ motion: v
62
+ }), C = a(r);
63
+ i(() => {
64
+ C.current = r;
65
+ }, [r]);
66
+ let w = n((e) => {
65
67
  if (!e) return;
66
- let n = t(e, {
67
- maxSurfaces: v,
68
- onDiagnostic: (e) => x.current?.(e)
69
- });
70
- return b((t) => ({
68
+ S((t) => ({
71
69
  ...t,
72
- controller: n,
73
70
  root: e,
74
- maxSurfaces: v
75
- })), () => n.dispose();
76
- }, [v]);
77
- return l({
78
- ref: [S, p ?? null],
71
+ maxSurfaces: b
72
+ }));
73
+ let t, n = !1;
74
+ return d().then(({ createGlassScene: r }) => {
75
+ if (n) return;
76
+ let i = r(e, {
77
+ maxSurfaces: b,
78
+ onDiagnostic: (e) => C.current?.(e)
79
+ });
80
+ t = i, S((e) => ({
81
+ ...e,
82
+ controller: i
83
+ }));
84
+ }), () => {
85
+ n = !0, t?.dispose(), S((e) => ({
86
+ ...e,
87
+ controller: f,
88
+ root: null
89
+ }));
90
+ };
91
+ }, [b]);
92
+ return c({
93
+ ref: [w, u ?? null],
79
94
  props: {
80
- ..._,
81
- className: `lg-scene ${n}`,
82
- children: /* @__PURE__ */ u(f.Provider, {
95
+ ...y,
96
+ className: `lg-scene ${t}`,
97
+ children: /* @__PURE__ */ l(p.Provider, {
83
98
  value: {
84
- ...y,
99
+ ...x,
85
100
  material: m,
86
101
  appearance: h,
87
- motion: g
102
+ specular: g,
103
+ frost: _,
104
+ motion: v
88
105
  },
89
106
  children: e
90
107
  })
91
108
  }
92
109
  });
93
110
  }
94
- var v = () => () => {}, y = () => e, b = () => !1;
95
- function x({ layout: e = "overlay", className: t = "", ref: n, ...i }) {
96
- let { controller: a } = m(), o = c(v, y, b) && e === "scroll", s = r((e) => (a.setContent(e), () => {
111
+ var y = (e) => (addEventListener("resize", e), () => removeEventListener("resize", e)), b = () => e && matchMedia(`(resolution: ${devicePixelRatio}dppx)`).matches, x = () => !1;
112
+ function S({ layout: e = "overlay", className: t = "", ref: r, ...i }) {
113
+ let { controller: a } = h(), o = s(y, b, x) && e === "scroll", u = n((e) => (a.setContent(e), () => {
97
114
  a.setContent(null);
98
- }), [a]), d = l({
99
- ref: [s, n ?? null],
115
+ }), [a]), d = c({
116
+ ref: [u, r ?? null],
100
117
  props: {
101
118
  ...i,
102
119
  "data-layout": e,
103
120
  className: `lg-content ${t}`
104
121
  }
105
122
  });
106
- return d = /* @__PURE__ */ u("div", {
123
+ return d = /* @__PURE__ */ l("div", {
107
124
  "data-glass-blur-host": "",
108
125
  "data-layout": e,
109
126
  children: d
110
- }), o && (d = /* @__PURE__ */ u("svg", {
127
+ }), o && (d = /* @__PURE__ */ l("svg", {
111
128
  className: "lg-scroll-paint-root",
112
129
  width: "100%",
113
130
  height: "100%",
114
- children: /* @__PURE__ */ u("foreignObject", {
131
+ children: /* @__PURE__ */ l("foreignObject", {
115
132
  width: "100%",
116
133
  height: "100%",
117
134
  children: d
118
135
  })
119
136
  })), d;
120
137
  }
121
- //#endregion
122
- export { x as GlassContent, g as GlassForeground, _ as GlassScene, h as useGlassForeground, p as useGlassMotion, m as useScene };
138
+ export { S as GlassContent, _ as GlassForeground, v as GlassScene, g as useGlassForeground, m as useGlassMotion, h as useScene };
@@ -1,48 +1,67 @@
1
1
  "use client";
2
- import { observeFixedShape as e } from "../dom/fixed-shape.js";
3
- import { observeConcentricShape as t, observeCornerPlacement as n, shapeContainerAttributes as r } from "../dom/shape-layout.js";
4
- import { useLayoutEffect as i, useRef as a } from "react";
5
- import { useRender as o } from "@base-ui/react/use-render";
6
- import { jsx as s } from "react/jsx-runtime";
7
- //#region src/react/shape.tsx
8
- function c({ concentric: e, container: t, ...n }) {
9
- return e ? /* @__PURE__ */ s(u, {
2
+ import { shapeContainerAttributes as e } from "../dom/shape-attributes.js";
3
+ import { useLayoutEffect as t, useRef as n } from "react";
4
+ import { useRender as r } from "@base-ui/react/use-render";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ // src/react/shape.tsx
7
+ var a, o, s = () => a ??= import("../dom/shape-geometry.js").then((e) => o = e);
8
+ function c(e) {
9
+ if (o) return e(o);
10
+ let t, n = !1;
11
+ return s().then((r) => {
12
+ n || (t = e(r));
13
+ }), () => {
14
+ n = !0, t?.();
15
+ };
16
+ }
17
+ function l({ contentPadding: e = 8, ...t }) {
18
+ return /* @__PURE__ */ i(u, {
19
+ ...t,
20
+ concentric: { contentPadding: e }
21
+ });
22
+ }
23
+ function u({ concentric: e, container: t, ...n }) {
24
+ return e ? /* @__PURE__ */ i(f, {
10
25
  ...n,
11
26
  concentric: e,
12
27
  container: t
13
- }) : /* @__PURE__ */ s(l, { ...n });
28
+ }) : /* @__PURE__ */ i(d, { ...n });
14
29
  }
15
- function l({ radius: t = 8, render: n, ref: s, style: c, ...l }) {
16
- let u = a(null);
17
- return i(() => {
18
- if (u.current) return e(u.current, t);
19
- }, [t]), o({
20
- render: n,
21
- ref: [u, s ?? null],
30
+ function d({ radius: i = 8, render: a, ref: o, style: s, ...l }) {
31
+ let u = n(null);
32
+ return t(() => {
33
+ if (!u.current) return;
34
+ let e = u.current;
35
+ return c(({ observeFixedShape: t }) => t(e, i));
36
+ }, [i]), r({
37
+ render: a,
38
+ ref: [u, o ?? null],
22
39
  props: {
23
40
  ...l,
24
- ...r(t),
41
+ ...e(i),
25
42
  "data-lg-shape": "",
26
43
  style: {
27
- ...c,
44
+ ...s,
28
45
  borderRadius: 0
29
46
  }
30
47
  }
31
48
  });
32
49
  }
33
- function u({ radius: e, concentric: n, container: s, render: c, ref: l, style: u, ...d }) {
34
- let f = a(null), p = typeof n == "object" ? n : {}, m = JSON.stringify({
50
+ function f({ radius: i, concentric: a, container: o, render: s, ref: l, style: u, ...d }) {
51
+ let f = n(null), p = typeof a == "object" ? a : {}, m = JSON.stringify({
35
52
  ...p,
36
- radius: e ?? p.radius ?? 8
53
+ radius: i ?? p.radius ?? 8
37
54
  });
38
- return i(() => {
39
- if (f.current) return t(f.current, JSON.parse(m), s ? () => s.current : void 0);
40
- }, [m, s]), o({
41
- render: c,
55
+ return t(() => {
56
+ if (!f.current) return;
57
+ let e = f.current;
58
+ return c(({ observeConcentricShape: t }) => t(e, JSON.parse(m), o ? () => o.current : void 0));
59
+ }, [m, o]), r({
60
+ render: s,
42
61
  ref: [f, l ?? null],
43
62
  props: {
44
63
  ...d,
45
- ...r(e ?? p.radius ?? 8),
64
+ ...e(i ?? p.radius ?? 8),
46
65
  "data-lg-shape": "",
47
66
  "data-lg-concentric": "",
48
67
  style: {
@@ -52,36 +71,38 @@ function u({ radius: e, concentric: n, container: s, render: c, ref: l, style: u
52
71
  }
53
72
  });
54
73
  }
55
- function d({ radius: e = 8, render: t, ref: n, ...i }) {
56
- return o({
57
- render: t,
58
- ref: n ?? null,
74
+ function p({ radius: t = 8, render: n, ref: i, ...a }) {
75
+ return r({
76
+ render: n,
77
+ ref: i ?? null,
59
78
  props: {
60
- ...i,
61
- ...r(e)
79
+ ...a,
80
+ ...e(t)
62
81
  }
63
82
  });
64
83
  }
65
- function f({ enabled: e = !0, corner: t = "top-right", gap: r = 8, radius: s = "circle", container: c, render: l, ref: u, style: d, ...f }) {
66
- let p = a(null);
67
- return i(() => {
68
- if (p.current && e) return n(p.current, {
69
- corner: t,
70
- gap: r,
71
- radius: s
72
- }, c ? () => c.current : void 0);
84
+ function m({ enabled: e = !0, corner: i = "top-right", gap: a = 8, radius: o = "circle", container: s, render: l, ref: u, style: d, ...f }) {
85
+ let p = n(null);
86
+ return t(() => {
87
+ if (!p.current || !e) return;
88
+ let t = p.current;
89
+ return c(({ observeCornerPlacement: e }) => e(t, {
90
+ corner: i,
91
+ gap: a,
92
+ radius: o
93
+ }, s ? () => s.current : void 0));
73
94
  }, [
74
- t,
75
- r,
95
+ i,
96
+ a,
97
+ o,
76
98
  s,
77
- c,
78
99
  e
79
- ]), o({
100
+ ]), r({
80
101
  render: l,
81
102
  ref: [p, u ?? null],
82
103
  props: {
83
104
  ...f,
84
- "data-lg-corner": t,
105
+ "data-lg-corner": i,
85
106
  style: {
86
107
  position: "absolute",
87
108
  ...d
@@ -89,5 +110,4 @@ function f({ enabled: e = !0, corner: t = "top-right", gap: r = 8, radius: s = "
89
110
  }
90
111
  });
91
112
  }
92
- //#endregion
93
- export { f as GlassCorner, c as GlassShape, d as GlassShapeContainer };
113
+ export { m as GlassCorner, l as GlassRow, u as GlassShape, p as GlassShapeContainer };