@glass-sdk/liquid-glass 0.0.0-stage → 0.0.2

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 (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -2
  3. package/dist/core/concentric.js +86 -0
  4. package/dist/core/materials.js +41 -0
  5. package/dist/core/morph-path.js +206 -0
  6. package/dist/core/optics.js +7 -0
  7. package/dist/core/progressive.js +35 -0
  8. package/dist/core/shape.js +95 -0
  9. package/dist/core/spring.js +78 -0
  10. package/dist/core/union.js +117 -0
  11. package/dist/core.js +6 -0
  12. package/dist/dom/compose-layers.js +54 -0
  13. package/dist/dom/compound-field.js +23 -0
  14. package/dist/dom/control-motion.js +101 -0
  15. package/dist/dom/engine.js +7 -0
  16. package/dist/dom/exit-handoff.js +14 -0
  17. package/dist/dom/filter-bounds.js +87 -0
  18. package/dist/dom/filter-budget.js +45 -0
  19. package/dist/dom/filter-groups.js +38 -0
  20. package/dist/dom/filter-paint-root.js +41 -0
  21. package/dist/dom/filter-patch.js +129 -0
  22. package/dist/dom/filter-reach.js +36 -0
  23. package/dist/dom/filter-stages.js +7 -0
  24. package/dist/dom/fixed-shape.js +20 -0
  25. package/dist/dom/foreground.js +36 -0
  26. package/dist/dom/interaction.js +129 -0
  27. package/dist/dom/lens-layers.js +163 -0
  28. package/dist/dom/map-blend.js +8 -0
  29. package/dist/dom/map-encoder.js +47 -0
  30. package/dist/dom/map-encoder.worker.js +16 -0
  31. package/dist/dom/map-encoding.js +17 -0
  32. package/dist/dom/map-image.js +34 -0
  33. package/dist/dom/map-store.js +189 -0
  34. package/dist/dom/maps.js +131 -0
  35. package/dist/dom/material-graph.js +52 -0
  36. package/dist/dom/morph.js +296 -0
  37. package/dist/dom/page-zoom.js +46 -0
  38. package/dist/dom/png.js +105 -0
  39. package/dist/dom/progressive.js +299 -0
  40. package/dist/dom/renderer.js +6 -0
  41. package/dist/dom/sampling-bounds.js +22 -0
  42. package/dist/dom/selection.js +106 -0
  43. package/dist/dom/shape-layout.js +199 -0
  44. package/dist/dom/shared-backdrop.js +41 -0
  45. package/dist/dom/ticker.js +103 -0
  46. package/dist/dom/warm.js +108 -0
  47. package/dist/dom.js +694 -0
  48. package/dist/gpu/geometry.js +9 -0
  49. package/dist/gpu/maps.js +8 -0
  50. package/dist/gpu/planes.js +4 -0
  51. package/dist/gpu.js +213 -0
  52. package/dist/index.js +11 -0
  53. package/dist/react/button.js +23 -0
  54. package/dist/react/control-thumb.js +50 -0
  55. package/dist/react/menu.js +159 -0
  56. package/dist/react/merged-ref.js +18 -0
  57. package/dist/react/progressive.js +73 -0
  58. package/dist/react/scene.js +122 -0
  59. package/dist/react/shape.js +93 -0
  60. package/dist/react/surface.js +69 -0
  61. package/dist/react/tabs.js +94 -0
  62. package/dist/react/toolbar.js +145 -0
  63. package/dist/react/value-control-motion.js +9 -0
  64. package/dist/react/value-controls.js +176 -0
  65. package/dist/styles.css +360 -0
  66. package/dist/styles.d.css.ts +2 -0
  67. package/dist/types/core/concentric.d.ts +32 -0
  68. package/dist/types/core/index.d.ts +10 -0
  69. package/dist/types/core/materials.d.ts +43 -0
  70. package/dist/types/core/morph-path.d.ts +110 -0
  71. package/dist/types/core/optics.d.ts +1 -0
  72. package/dist/types/core/progressive.d.ts +17 -0
  73. package/dist/types/core/shape.d.ts +16 -0
  74. package/dist/types/core/spring.d.ts +60 -0
  75. package/dist/types/core/union.d.ts +20 -0
  76. package/dist/types/dom/compose-layers.d.ts +15 -0
  77. package/dist/types/dom/compound-field.d.ts +35 -0
  78. package/dist/types/dom/control-motion.d.ts +13 -0
  79. package/dist/types/dom/engine.d.ts +9 -0
  80. package/dist/types/dom/exit-handoff.d.ts +7 -0
  81. package/dist/types/dom/filter-bounds.d.ts +30 -0
  82. package/dist/types/dom/filter-budget.d.ts +20 -0
  83. package/dist/types/dom/filter-groups.d.ts +25 -0
  84. package/dist/types/dom/filter-paint-root.d.ts +9 -0
  85. package/dist/types/dom/filter-patch.d.ts +4 -0
  86. package/dist/types/dom/filter-reach.d.ts +23 -0
  87. package/dist/types/dom/filter-stages.d.ts +5 -0
  88. package/dist/types/dom/fixed-shape.d.ts +3 -0
  89. package/dist/types/dom/foreground.d.ts +20 -0
  90. package/dist/types/dom/index.d.ts +64 -0
  91. package/dist/types/dom/interaction.d.ts +16 -0
  92. package/dist/types/dom/lens-layers.d.ts +68 -0
  93. package/dist/types/dom/map-blend.d.ts +22 -0
  94. package/dist/types/dom/map-encoder.d.ts +5 -0
  95. package/dist/types/dom/map-encoder.worker.d.ts +1 -0
  96. package/dist/types/dom/map-encoding.d.ts +5 -0
  97. package/dist/types/dom/map-image.d.ts +17 -0
  98. package/dist/types/dom/map-store.d.ts +22 -0
  99. package/dist/types/dom/maps.d.ts +31 -0
  100. package/dist/types/dom/material-graph.d.ts +22 -0
  101. package/dist/types/dom/morph.d.ts +78 -0
  102. package/dist/types/dom/page-zoom.d.ts +18 -0
  103. package/dist/types/dom/png.d.ts +9 -0
  104. package/dist/types/dom/progressive.d.ts +42 -0
  105. package/dist/types/dom/renderer.d.ts +4 -0
  106. package/dist/types/dom/sampling-bounds.d.ts +10 -0
  107. package/dist/types/dom/selection.d.ts +5 -0
  108. package/dist/types/dom/shape-layout.d.ts +29 -0
  109. package/dist/types/dom/shared-backdrop.d.ts +19 -0
  110. package/dist/types/dom/ticker.d.ts +36 -0
  111. package/dist/types/dom/warm.d.ts +17 -0
  112. package/dist/types/gpu/geometry.d.ts +17 -0
  113. package/dist/types/gpu/index.d.ts +36 -0
  114. package/dist/types/gpu/planes.d.ts +2 -0
  115. package/dist/types/index.d.ts +4 -0
  116. package/dist/types/react/button.d.ts +11 -0
  117. package/dist/types/react/control-thumb.d.ts +11 -0
  118. package/dist/types/react/index.d.ts +20 -0
  119. package/dist/types/react/menu.d.ts +29 -0
  120. package/dist/types/react/merged-ref.d.ts +3 -0
  121. package/dist/types/react/progressive.d.ts +15 -0
  122. package/dist/types/react/scene.d.ts +35 -0
  123. package/dist/types/react/shape.d.ts +23 -0
  124. package/dist/types/react/surface.d.ts +35 -0
  125. package/dist/types/react/tabs.d.ts +29 -0
  126. package/dist/types/react/toolbar.d.ts +21 -0
  127. package/dist/types/react/value-control-motion.d.ts +9 -0
  128. package/dist/types/react/value-controls.d.ts +20 -0
  129. package/package.json +80 -4
@@ -0,0 +1,122 @@
1
+ "use client";
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 = {
9
+ setContent() {},
10
+ addForeground() {
11
+ return () => {};
12
+ },
13
+ addAnimator() {
14
+ return () => {};
15
+ },
16
+ addProgressiveBlur() {
17
+ return () => {};
18
+ },
19
+ addScrollEdges() {
20
+ return () => {};
21
+ },
22
+ addSurface() {
23
+ return () => {};
24
+ },
25
+ dispose() {}
26
+ }, f = n(null);
27
+ function p(e) {
28
+ let t = i(f);
29
+ return e ?? t?.motion ?? "full";
30
+ }
31
+ function m() {
32
+ let e = i(f);
33
+ if (!e) throw Error("Glass components must be inside <GlassScene>.");
34
+ return e;
35
+ }
36
+ function h() {
37
+ let { controller: e } = m();
38
+ return r((t) => {
39
+ if (t) return e.addForeground(t);
40
+ }, [e]);
41
+ }
42
+ function g({ render: e, ref: t, ...n }) {
43
+ let r = h();
44
+ return l({
45
+ render: e,
46
+ ref: [r, t ?? null],
47
+ props: n
48
+ });
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,
55
+ root: null,
56
+ maxSurfaces: v,
57
+ material: m,
58
+ appearance: h,
59
+ motion: g
60
+ }), x = o(i);
61
+ a(() => {
62
+ x.current = i;
63
+ }, [i]);
64
+ let S = r((e) => {
65
+ if (!e) return;
66
+ let n = t(e, {
67
+ maxSurfaces: v,
68
+ onDiagnostic: (e) => x.current?.(e)
69
+ });
70
+ return b((t) => ({
71
+ ...t,
72
+ controller: n,
73
+ root: e,
74
+ maxSurfaces: v
75
+ })), () => n.dispose();
76
+ }, [v]);
77
+ return l({
78
+ ref: [S, p ?? null],
79
+ props: {
80
+ ..._,
81
+ className: `lg-scene ${n}`,
82
+ children: /* @__PURE__ */ u(f.Provider, {
83
+ value: {
84
+ ...y,
85
+ material: m,
86
+ appearance: h,
87
+ motion: g
88
+ },
89
+ children: e
90
+ })
91
+ }
92
+ });
93
+ }
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), () => {
97
+ a.setContent(null);
98
+ }), [a]), d = l({
99
+ ref: [s, n ?? null],
100
+ props: {
101
+ ...i,
102
+ "data-layout": e,
103
+ className: `lg-content ${t}`
104
+ }
105
+ });
106
+ return d = /* @__PURE__ */ u("div", {
107
+ "data-glass-blur-host": "",
108
+ "data-layout": e,
109
+ children: d
110
+ }), o && (d = /* @__PURE__ */ u("svg", {
111
+ className: "lg-scroll-paint-root",
112
+ width: "100%",
113
+ height: "100%",
114
+ children: /* @__PURE__ */ u("foreignObject", {
115
+ width: "100%",
116
+ height: "100%",
117
+ children: d
118
+ })
119
+ })), d;
120
+ }
121
+ //#endregion
122
+ export { x as GlassContent, g as GlassForeground, _ as GlassScene, h as useGlassForeground, p as useGlassMotion, m as useScene };
@@ -0,0 +1,93 @@
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, {
10
+ ...n,
11
+ concentric: e,
12
+ container: t
13
+ }) : /* @__PURE__ */ s(l, { ...n });
14
+ }
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],
22
+ props: {
23
+ ...l,
24
+ ...r(t),
25
+ "data-lg-shape": "",
26
+ style: {
27
+ ...c,
28
+ borderRadius: 0
29
+ }
30
+ }
31
+ });
32
+ }
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({
35
+ ...p,
36
+ radius: e ?? p.radius ?? 8
37
+ });
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,
42
+ ref: [f, l ?? null],
43
+ props: {
44
+ ...d,
45
+ ...r(e ?? p.radius ?? 8),
46
+ "data-lg-shape": "",
47
+ "data-lg-concentric": "",
48
+ style: {
49
+ ...u,
50
+ borderRadius: 0
51
+ }
52
+ }
53
+ });
54
+ }
55
+ function d({ radius: e = 8, render: t, ref: n, ...i }) {
56
+ return o({
57
+ render: t,
58
+ ref: n ?? null,
59
+ props: {
60
+ ...i,
61
+ ...r(e)
62
+ }
63
+ });
64
+ }
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);
73
+ }, [
74
+ t,
75
+ r,
76
+ s,
77
+ c,
78
+ e
79
+ ]), o({
80
+ render: l,
81
+ ref: [p, u ?? null],
82
+ props: {
83
+ ...f,
84
+ "data-lg-corner": t,
85
+ style: {
86
+ position: "absolute",
87
+ ...d
88
+ }
89
+ }
90
+ });
91
+ }
92
+ //#endregion
93
+ export { f as GlassCorner, c as GlassShape, d as GlassShapeContainer };
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { shapeContainerAttributes as e } from "../dom/shape-layout.js";
3
+ import { useScene as t } from "./scene.js";
4
+ import { useCallback as n, useLayoutEffect as r, useMemo as i, useRef as a } from "react";
5
+ import { useRender as o } from "@base-ui/react/use-render";
6
+ //#region src/react/surface.tsx
7
+ function s({ material: s, appearance: c, radius: l, concentric: u, refraction: d, tint: f, interactive: p = !1, morphFrom: m, morph: h, neck: g, morphEnter: _, fluid: v = !1, motion: y, render: b, ref: x, children: S, className: C = "", style: w, ...T }) {
8
+ let E = t(), { controller: D } = E;
9
+ s ??= E.material, c ??= E.appearance, y ??= E.motion;
10
+ let O = !!u, k = typeof u == "object" ? u.inset : void 0, A = a(m);
11
+ r(() => {
12
+ A.current = m;
13
+ });
14
+ let j = !!m, M = i(() => ({
15
+ material: s,
16
+ appearance: c,
17
+ radius: l,
18
+ concentric: O ? { inset: k } : void 0,
19
+ refraction: d,
20
+ tint: f,
21
+ interactive: p,
22
+ fluid: v,
23
+ motion: y,
24
+ morph: h,
25
+ neck: g,
26
+ morphEnter: _,
27
+ morphFrom: j ? () => {
28
+ let e = A.current;
29
+ return typeof e == "function" ? e() : e?.current;
30
+ } : void 0
31
+ }), [
32
+ s,
33
+ c,
34
+ l,
35
+ O,
36
+ k,
37
+ d,
38
+ f,
39
+ p,
40
+ v,
41
+ y,
42
+ h,
43
+ g,
44
+ _,
45
+ j
46
+ ]), N = n((e) => {
47
+ if (!e) return;
48
+ let t = D.addSurface(e, M);
49
+ return () => {
50
+ t();
51
+ };
52
+ }, [D, M]);
53
+ return o({
54
+ render: b,
55
+ ref: [N, x ?? null],
56
+ props: {
57
+ ...T,
58
+ ...e(l ?? 8),
59
+ "data-glass-material": s,
60
+ "data-glass-appearance": c,
61
+ "data-glass-interactive": p ? "" : void 0,
62
+ className: `lg-surface ${C}`,
63
+ style: { ...w },
64
+ ...S === void 0 ? {} : { children: S }
65
+ }
66
+ });
67
+ }
68
+ //#endregion
69
+ export { s as GlassSurface };
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { GlassShape as e } from "./shape.js";
3
+ import { resolveMotion as t } from "../dom/interaction.js";
4
+ import { attachSelectionLens as n } from "../dom/selection.js";
5
+ import { useGlassMotion as r, useScene as i } from "./scene.js";
6
+ import { GlassSurface as a } from "./surface.js";
7
+ import { useMergedRef as o } from "./merged-ref.js";
8
+ import { createContext as s, useCallback as c, useContext as l } from "react";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ import { Tabs as f } from "@base-ui/react/tabs";
11
+ //#region src/react/tabs.tsx
12
+ var p = f.Root, m = f.Panel, h = s({});
13
+ function g({ material: e, appearance: t, radius: n = "capsule", refraction: r, tint: o, interactive: s = !0, motion: c, size: l = "default", className: d = "", style: p, children: m, ...g }) {
14
+ let _ = i(), v = {
15
+ material: e ?? _.material,
16
+ appearance: t ?? _.appearance,
17
+ motion: c
18
+ };
19
+ return /* @__PURE__ */ u(h.Provider, {
20
+ value: v,
21
+ children: /* @__PURE__ */ u(a, {
22
+ material: v.material,
23
+ appearance: v.appearance,
24
+ radius: n,
25
+ refraction: r,
26
+ tint: o,
27
+ interactive: s,
28
+ motion: c,
29
+ style: p,
30
+ className: `lg-tabs-list ${d}`,
31
+ "data-size": l,
32
+ render: /* @__PURE__ */ u(f.List, {
33
+ activateOnFocus: !0,
34
+ ...g
35
+ }),
36
+ children: m
37
+ })
38
+ });
39
+ }
40
+ function _({ material: e = "clear", appearance: s, radius: d = "capsule", refraction: p, tint: m, motion: g, className: _ = "", style: v, ref: y, ...b }) {
41
+ let x = l(h), { controller: S } = i(), C = r(g ?? x.motion), w = c((e) => {
42
+ if (e) return S.addAnimator(n(e, () => t(C)));
43
+ }, [S, C]);
44
+ return /* @__PURE__ */ u(a, {
45
+ material: e,
46
+ appearance: s ?? x.appearance,
47
+ radius: d,
48
+ refraction: p,
49
+ tint: m,
50
+ style: v,
51
+ ref: o(w, y),
52
+ className: `lg-tab-indicator ${_}`,
53
+ render: /* @__PURE__ */ u(f.Indicator, { ...b })
54
+ });
55
+ }
56
+ function v({ children: t, className: n, ...r }) {
57
+ return /* @__PURE__ */ u(e, {
58
+ radius: "capsule",
59
+ concentric: !0,
60
+ render: /* @__PURE__ */ u(f.Tab, {
61
+ ...r,
62
+ className: (e) => `lg-tab ${typeof n == "function" ? n(e) : n ?? ""}`
63
+ }),
64
+ children: /* @__PURE__ */ u("span", {
65
+ className: "lg-tab-label",
66
+ children: t
67
+ })
68
+ });
69
+ }
70
+ function y({ items: e, defaultValue: t, material: n, appearance: r, radius: i, refraction: a, tint: o, interactive: s, motion: c, size: l, className: f = "", "aria-label": m = "Sections", ...h }) {
71
+ return /* @__PURE__ */ u(p, {
72
+ ...h,
73
+ defaultValue: t ?? e.find((e) => !e.disabled)?.value,
74
+ className: `lg-tabs ${f}`,
75
+ children: /* @__PURE__ */ d(g, {
76
+ material: n,
77
+ appearance: r,
78
+ radius: i,
79
+ refraction: a,
80
+ tint: o,
81
+ interactive: s,
82
+ motion: c,
83
+ size: l,
84
+ "aria-label": m,
85
+ children: [/* @__PURE__ */ u(_, { tint: o }), e.map((e) => /* @__PURE__ */ u(v, {
86
+ value: e.value,
87
+ disabled: e.disabled,
88
+ children: e.label
89
+ }, e.value))]
90
+ })
91
+ });
92
+ }
93
+ //#endregion
94
+ export { y as GlassTabs, m as GlassTabsContent, _ as GlassTabsIndicator, g as GlassTabsList, p as GlassTabsRoot, v as GlassTabsTrigger };
@@ -0,0 +1,145 @@
1
+ "use client";
2
+ import { GlassShape as e } from "./shape.js";
3
+ import { GlassSurface as t } from "./surface.js";
4
+ import { useMergedRef as n } from "./merged-ref.js";
5
+ import { Children as r, Fragment as i, cloneElement as a, isValidElement as o, useCallback as s, useEffect as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
6
+ import { jsx as f } from "react/jsx-runtime";
7
+ import { Toolbar as p } from "@base-ui/react/toolbar";
8
+ //#region src/react/toolbar.tsx
9
+ function m({ material: e, appearance: t, radius: n = "capsule", refraction: s, tint: l, interactive: m = !0, motion: _, className: v = "", style: y, children: x, ...S }) {
10
+ let C = u(!1);
11
+ c(() => {
12
+ C.current = !0;
13
+ }, []);
14
+ let w = u(/* @__PURE__ */ new Map()), T = u(/* @__PURE__ */ new Map()), [E, D] = d(/* @__PURE__ */ new Map()), O = [], k = (e, t = "") => {
15
+ r.forEach(r.toArray(e), (e) => {
16
+ o(e) && e.type === i ? k(e.props.children, `${t}${e.key}/`) : O.push(o(e) ? a(e, { key: `${t}${e.key}` }) : e);
17
+ });
18
+ };
19
+ k(x);
20
+ let A = [], j = /* @__PURE__ */ new Map(), M = [], N = (r, i, a, o) => /* @__PURE__ */ f(g, {
21
+ index: i,
22
+ settled: C,
23
+ material: e,
24
+ appearance: t,
25
+ radius: n,
26
+ refraction: s,
27
+ tint: l,
28
+ interactive: m,
29
+ motion: _,
30
+ orientation: S.orientation ?? "horizontal",
31
+ ghost: o,
32
+ register: (e) => {
33
+ e ? w.current.set(r, e) : w.current.delete(r);
34
+ },
35
+ onExited: () => D((e) => {
36
+ if (!e.has(r)) return e;
37
+ let t = new Map(e);
38
+ return t.delete(r), t;
39
+ }),
40
+ children: a
41
+ }, r), P = () => {
42
+ if (!M.length) return;
43
+ let e = `cluster-${j.size}`;
44
+ j.set(e, M), A.push(N(e, j.size - 1, M)), M = [];
45
+ };
46
+ for (let e of O) o(e) && e.type === b ? (P(), A.push(e)) : M.push(e);
47
+ P();
48
+ let F = h(j, E, T, w, S.orientation !== "vertical");
49
+ (F.size !== E.size || [...F.keys()].some((e) => !E.has(e))) && queueMicrotask(() => D(F));
50
+ for (let [e, t] of F) A.push(N(e, j.size, t.children, t.box));
51
+ return /* @__PURE__ */ f(p.Root, {
52
+ "aria-label": "Toolbar",
53
+ ...S,
54
+ style: y,
55
+ className: `lg-toolbar ${v}`,
56
+ "data-segmented": A.length > 1 ? "" : void 0,
57
+ children: A
58
+ });
59
+ }
60
+ function h(e, t, n, r, i) {
61
+ let a = new Map(t);
62
+ for (let t of a.keys()) e.has(t) && a.delete(t);
63
+ if (i) for (let [t, i] of n.current) {
64
+ let n = r.current.get(t);
65
+ if (e.has(t) || a.has(t) || !n) continue;
66
+ let o = n.offsetParent;
67
+ a.set(t, {
68
+ children: i,
69
+ box: {
70
+ left: n.offsetLeft - (o?.clientLeft ?? 0),
71
+ top: n.offsetTop - (o?.clientTop ?? 0),
72
+ width: n.offsetWidth,
73
+ height: n.offsetHeight
74
+ }
75
+ });
76
+ }
77
+ return n.current = e, a;
78
+ }
79
+ function g({ index: e, settled: r, orientation: i, children: a, ghost: o, register: c, onExited: p, ...m }) {
80
+ let [h] = d(() => r.current && e > 0), g = s(() => {
81
+ let e = _.current?.previousElementSibling ?? null;
82
+ for (; e && (!e.classList.contains("lg-toolbar-cluster") || e.hasAttribute("data-ending-style"));) e = e.previousElementSibling;
83
+ return e;
84
+ }, []), _ = u(null), v = u({
85
+ register: c,
86
+ onExited: p
87
+ });
88
+ l(() => {
89
+ v.current = {
90
+ register: c,
91
+ onExited: p
92
+ };
93
+ });
94
+ let y = s((e) => {
95
+ if (v.current.register(e), !e) return;
96
+ let t = () => v.current.onExited();
97
+ return e.addEventListener("glass:exited", t), () => {
98
+ e.removeEventListener("glass:exited", t), v.current.register(null);
99
+ };
100
+ }, []);
101
+ return /* @__PURE__ */ f(t, {
102
+ ...m,
103
+ ref: n(_, y),
104
+ fluid: !0,
105
+ morphFrom: e > 0 ? g : void 0,
106
+ morphEnter: h,
107
+ morph: "detach",
108
+ neck: o ? 0 : void 0,
109
+ className: "lg-toolbar-cluster",
110
+ "data-orientation": i,
111
+ "data-ending-style": o ? "" : void 0,
112
+ "aria-hidden": o ? !0 : void 0,
113
+ inert: o ? !0 : void 0,
114
+ style: o ? {
115
+ position: "absolute",
116
+ left: o.left,
117
+ top: o.top,
118
+ width: o.width,
119
+ height: o.height,
120
+ pointerEvents: "none"
121
+ } : void 0,
122
+ children: a
123
+ });
124
+ }
125
+ function _({ className: t, size: n = "icon", ...r }) {
126
+ return /* @__PURE__ */ f(e, {
127
+ radius: n === "icon" ? "circle" : "capsule",
128
+ render: /* @__PURE__ */ f(p.Button, {
129
+ ...r,
130
+ "data-size": n,
131
+ className: (e) => `lg-toolbar-button ${typeof t == "function" ? t(e) : t ?? ""}`
132
+ })
133
+ });
134
+ }
135
+ var v = p.Link, y = p.Group;
136
+ function b({ sizing: e = "flexible", className: t = "", ...n }) {
137
+ return /* @__PURE__ */ f("span", {
138
+ ...n,
139
+ "aria-hidden": "true",
140
+ className: `lg-toolbar-spacer ${t}`,
141
+ "data-sizing": e
142
+ });
143
+ }
144
+ //#endregion
145
+ export { m as GlassToolbar, _ as GlassToolbarButton, y as GlassToolbarGroup, v as GlassToolbarLink, b as GlassToolbarSpacer };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ //#region src/react/value-control-motion.ts
3
+ function e(e, t) {
4
+ if (!e.oppositeHalf) return t >= e.left + e.width / 2 !== e.rtl;
5
+ let n = (t - e.x) * (e.rtl ? -1 : 1);
6
+ return e.start === 0 ? n > e.width * .4 : n >= -e.width * .4;
7
+ }
8
+ //#endregion
9
+ export { e as switchDragState };