@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.
- package/CHANGELOG.md +124 -0
- package/README.md +66 -149
- package/dist/core/concentric.js +20 -3
- package/dist/core/corner-options.js +12 -0
- package/dist/core/corner-path.js +118 -0
- package/dist/core/materials.js +264 -32
- package/dist/core/optics.js +1 -2
- package/dist/core/progressive.js +1 -2
- package/dist/core/shape.js +18 -28
- package/dist/core/spring.js +5 -10
- package/dist/core.js +5 -6
- package/dist/dom/backdrop-glass.js +46 -0
- package/dist/dom/compose-layers.js +42 -31
- package/dist/dom/composited.js +136 -0
- package/dist/dom/control-motion.js +58 -47
- package/dist/dom/engine.js +1 -2
- package/dist/dom/escaped-layers.js +179 -0
- package/dist/dom/filter-bounds.js +42 -13
- package/dist/dom/filter-budget.js +1 -2
- package/dist/dom/filter-chain.js +40 -0
- package/dist/dom/filter-groups.js +33 -14
- package/dist/dom/filter-paint-root.js +8 -6
- package/dist/dom/filter-patch.js +94 -55
- package/dist/dom/filter-reach.js +32 -19
- package/dist/dom/filter-stages.js +1 -2
- package/dist/dom/fixed-shape.js +23 -16
- package/dist/dom/foreground.js +16 -17
- package/dist/dom/interaction.js +65 -92
- package/dist/dom/layout-rect.js +42 -0
- package/dist/dom/layout-size.js +28 -0
- package/dist/dom/lens-layers.js +250 -136
- package/dist/dom/map-encoder.js +16 -13
- package/dist/dom/map-encoder.worker.js +2 -3
- package/dist/dom/map-encoding.js +49 -12
- package/dist/dom/map-image.js +29 -7
- package/dist/dom/map-store.js +1 -2
- package/dist/dom/maps.js +133 -83
- package/dist/dom/material-graph.js +108 -29
- package/dist/dom/media-mirror.js +244 -0
- package/dist/dom/page-zoom.js +19 -18
- package/dist/dom/png.js +1 -2
- package/dist/dom/progressive.js +152 -147
- package/dist/dom/renderer.js +1 -2
- package/dist/dom/sampling-bounds.js +1 -2
- package/dist/dom/selection.js +133 -79
- package/dist/dom/shape-attributes.js +9 -0
- package/dist/dom/shape-effects.js +14 -0
- package/dist/dom/shape-geometry.js +3 -0
- package/dist/dom/shape-layout.js +115 -116
- package/dist/dom/shared-backdrop.js +33 -25
- package/dist/dom/specular.js +116 -0
- package/dist/dom/ticker.js +28 -19
- package/dist/dom/tint-color.js +24 -0
- package/dist/dom/warm.js +63 -59
- package/dist/dom.js +591 -505
- package/dist/gpu/geometry.js +2 -3
- package/dist/gpu/maps.js +1109 -7
- package/dist/gpu/planes.js +2 -3
- package/dist/gpu.js +66 -64
- package/dist/index.js +12 -10
- package/dist/react/button.js +12 -11
- package/dist/react/color-picker.js +199 -0
- package/dist/react/control-thumb.js +4 -5
- package/dist/react/menu.js +82 -111
- package/dist/react/merged-ref.js +1 -2
- package/dist/react/progressive.js +1 -2
- package/dist/react/scene.js +71 -55
- package/dist/react/shape.js +67 -47
- package/dist/react/slider.js +81 -0
- package/dist/react/surface.js +90 -56
- package/dist/react/switch.js +101 -0
- package/dist/react/tabs.js +85 -63
- package/dist/react/toolbar.js +38 -123
- package/dist/react/value-control-motion.js +1 -2
- package/dist/styles.css +517 -111
- package/dist/types/core/concentric.d.ts +8 -0
- package/dist/types/core/corner-options.d.ts +4 -0
- package/dist/types/core/corner-path.d.ts +8 -0
- package/dist/types/core/index.d.ts +3 -5
- package/dist/types/core/materials.d.ts +100 -28
- package/dist/types/core/shape.d.ts +4 -6
- package/dist/types/core/spring.d.ts +8 -12
- package/dist/types/dom/backdrop-glass.d.ts +38 -0
- package/dist/types/dom/compose-layers.d.ts +4 -0
- package/dist/types/dom/composited.d.ts +61 -0
- package/dist/types/dom/escaped-layers.d.ts +32 -0
- package/dist/types/dom/filter-bounds.d.ts +4 -0
- package/dist/types/dom/filter-chain.d.ts +6 -0
- package/dist/types/dom/filter-groups.d.ts +1 -1
- package/dist/types/dom/filter-paint-root.d.ts +3 -0
- package/dist/types/dom/filter-patch.d.ts +5 -0
- package/dist/types/dom/filter-reach.d.ts +9 -9
- package/dist/types/dom/foreground.d.ts +2 -1
- package/dist/types/dom/index.d.ts +8 -19
- package/dist/types/dom/interaction.d.ts +8 -8
- package/dist/types/dom/layout-rect.d.ts +17 -0
- package/dist/types/dom/layout-size.d.ts +11 -0
- package/dist/types/dom/lens-layers.d.ts +18 -10
- package/dist/types/dom/map-encoder.d.ts +5 -2
- package/dist/types/dom/map-encoding.d.ts +12 -3
- package/dist/types/dom/map-image.d.ts +7 -1
- package/dist/types/dom/maps.d.ts +25 -7
- package/dist/types/dom/material-graph.d.ts +73 -10
- package/dist/types/dom/media-mirror.d.ts +49 -0
- package/dist/types/dom/progressive.d.ts +2 -5
- package/dist/types/dom/sampling-bounds.d.ts +1 -3
- package/dist/types/dom/selection.d.ts +29 -4
- package/dist/types/dom/shape-attributes.d.ts +6 -0
- package/dist/types/dom/shape-effects.d.ts +10 -0
- package/dist/types/dom/shape-geometry.d.ts +6 -0
- package/dist/types/dom/shape-layout.d.ts +2 -4
- package/dist/types/dom/shared-backdrop.d.ts +7 -3
- package/dist/types/dom/specular.d.ts +50 -0
- package/dist/types/dom/ticker.d.ts +4 -1
- package/dist/types/dom/tint-color.d.ts +11 -0
- package/dist/types/dom/warm.d.ts +8 -2
- package/dist/types/gpu/geometry.d.ts +2 -0
- package/dist/types/gpu/planes.d.ts +3 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/react/button.d.ts +1 -1
- package/dist/types/react/color-picker.d.ts +26 -0
- package/dist/types/react/index.d.ts +14 -10
- package/dist/types/react/menu.d.ts +4 -5
- package/dist/types/react/progressive.d.ts +1 -1
- package/dist/types/react/scene.d.ts +4 -2
- package/dist/types/react/shape.d.ts +11 -1
- package/dist/types/react/slider.d.ts +14 -0
- package/dist/types/react/surface.d.ts +11 -22
- package/dist/types/react/switch.d.ts +9 -0
- package/dist/types/react/tabs.d.ts +3 -3
- package/dist/types/react/toolbar.d.ts +1 -1
- package/package.json +46 -40
- package/dist/core/morph-path.js +0 -206
- package/dist/core/union.js +0 -117
- package/dist/dom/compound-field.js +0 -23
- package/dist/dom/exit-handoff.js +0 -14
- package/dist/dom/map-blend.js +0 -8
- package/dist/dom/morph.js +0 -296
- package/dist/react/value-controls.js +0 -176
- package/dist/types/core/morph-path.d.ts +0 -110
- package/dist/types/core/union.d.ts +0 -20
- package/dist/types/dom/compound-field.d.ts +0 -35
- package/dist/types/dom/exit-handoff.d.ts +0 -7
- package/dist/types/dom/map-blend.d.ts +0 -22
- package/dist/types/dom/morph.d.ts +0 -78
- package/dist/types/react/value-controls.d.ts +0 -20
package/dist/react/menu.js
CHANGED
|
@@ -1,159 +1,130 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
6
|
-
import {
|
|
7
|
-
import { Fragment as a, createContext as o, useCallback as s, useContext as c,
|
|
8
|
-
import { useRender as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { Menu as
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
let [t] =
|
|
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
|
|
21
|
-
let t = c(
|
|
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
|
|
29
|
-
let t =
|
|
30
|
-
return /* @__PURE__ */ p
|
|
28
|
+
function g(e) {
|
|
29
|
+
let t = m(!0);
|
|
30
|
+
return /* @__PURE__ */ d(p.Provider, {
|
|
31
31
|
value: t,
|
|
32
|
-
children: /* @__PURE__ */
|
|
32
|
+
children: /* @__PURE__ */ d(f.Root, { ...e })
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
let n =
|
|
37
|
-
render: /* @__PURE__ */
|
|
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__ */
|
|
40
|
+
return /* @__PURE__ */ d("span", {
|
|
41
41
|
className: "lg-menu-anchor",
|
|
42
42
|
children: r
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
let t =
|
|
47
|
-
return /* @__PURE__ */ p
|
|
45
|
+
function v(e) {
|
|
46
|
+
let t = m(!1);
|
|
47
|
+
return /* @__PURE__ */ d(p.Provider, {
|
|
48
48
|
value: t,
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ d(f.SubmenuRoot, { ...e })
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
...
|
|
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
|
|
80
|
-
function
|
|
81
|
-
return /* @__PURE__ */
|
|
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
|
|
87
|
-
function
|
|
88
|
-
return /* @__PURE__ */
|
|
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
|
|
94
|
-
function
|
|
95
|
-
return /* @__PURE__ */
|
|
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
|
|
101
|
-
let { root:
|
|
102
|
-
let e = [...
|
|
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
|
-
},
|
|
105
|
-
let e = k();
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
...
|
|
90
|
+
...E?.style
|
|
114
91
|
},
|
|
115
|
-
children: /* @__PURE__ */
|
|
92
|
+
children: /* @__PURE__ */ d(f.Positioner, {
|
|
116
93
|
className: "lg-menu-positioner",
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
style:
|
|
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__ */
|
|
138
|
-
children: /* @__PURE__ */
|
|
114
|
+
render: /* @__PURE__ */ d(f.Popup, { ...D }),
|
|
115
|
+
children: /* @__PURE__ */ d(a, { children: e })
|
|
139
116
|
})
|
|
140
117
|
})
|
|
141
118
|
});
|
|
142
119
|
}
|
|
143
|
-
function
|
|
144
|
-
return /* @__PURE__ */
|
|
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
|
|
150
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
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 };
|
package/dist/react/merged-ref.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback as e } from "react";
|
|
3
|
-
|
|
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
|
-
|
|
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 };
|
package/dist/react/scene.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { webkit as e } from "../dom/engine.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
},
|
|
27
|
-
function
|
|
28
|
-
let t =
|
|
26
|
+
}, p = t(null);
|
|
27
|
+
function m(e) {
|
|
28
|
+
let t = r(p);
|
|
29
29
|
return e ?? t?.motion ?? "full";
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
let e =
|
|
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
|
|
37
|
-
let { controller: e } =
|
|
38
|
-
return
|
|
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
|
|
43
|
-
let r =
|
|
44
|
-
return
|
|
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
|
|
51
|
-
let
|
|
52
|
-
if (!Number.isFinite(
|
|
53
|
-
let [
|
|
54
|
-
controller:
|
|
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:
|
|
56
|
+
maxSurfaces: b,
|
|
57
57
|
material: m,
|
|
58
58
|
appearance: h,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
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:
|
|
75
|
-
}))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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 ${
|
|
82
|
-
children: /* @__PURE__ */
|
|
95
|
+
...y,
|
|
96
|
+
className: `lg-scene ${t}`,
|
|
97
|
+
children: /* @__PURE__ */ l(p.Provider, {
|
|
83
98
|
value: {
|
|
84
|
-
...
|
|
99
|
+
...x,
|
|
85
100
|
material: m,
|
|
86
101
|
appearance: h,
|
|
87
|
-
|
|
102
|
+
specular: g,
|
|
103
|
+
frost: _,
|
|
104
|
+
motion: v
|
|
88
105
|
},
|
|
89
106
|
children: e
|
|
90
107
|
})
|
|
91
108
|
}
|
|
92
109
|
});
|
|
93
110
|
}
|
|
94
|
-
var
|
|
95
|
-
function
|
|
96
|
-
let { controller: a } =
|
|
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 =
|
|
99
|
-
ref: [
|
|
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__ */
|
|
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__ */
|
|
127
|
+
}), o && (d = /* @__PURE__ */ l("svg", {
|
|
111
128
|
className: "lg-scroll-paint-root",
|
|
112
129
|
width: "100%",
|
|
113
130
|
height: "100%",
|
|
114
|
-
children: /* @__PURE__ */
|
|
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
|
-
|
|
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 };
|
package/dist/react/shape.js
CHANGED
|
@@ -1,48 +1,67 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function c(
|
|
9
|
-
return e
|
|
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__ */
|
|
28
|
+
}) : /* @__PURE__ */ i(d, { ...n });
|
|
14
29
|
}
|
|
15
|
-
function
|
|
16
|
-
let u =
|
|
17
|
-
return
|
|
18
|
-
if (u.current) return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
...
|
|
41
|
+
...e(i),
|
|
25
42
|
"data-lg-shape": "",
|
|
26
43
|
style: {
|
|
27
|
-
...
|
|
44
|
+
...s,
|
|
28
45
|
borderRadius: 0
|
|
29
46
|
}
|
|
30
47
|
}
|
|
31
48
|
});
|
|
32
49
|
}
|
|
33
|
-
function
|
|
34
|
-
let f =
|
|
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:
|
|
53
|
+
radius: i ?? p.radius ?? 8
|
|
37
54
|
});
|
|
38
|
-
return
|
|
39
|
-
if (f.current) return
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
...
|
|
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
|
|
56
|
-
return
|
|
57
|
-
render:
|
|
58
|
-
ref:
|
|
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
|
-
...
|
|
61
|
-
...
|
|
79
|
+
...a,
|
|
80
|
+
...e(t)
|
|
62
81
|
}
|
|
63
82
|
});
|
|
64
83
|
}
|
|
65
|
-
function
|
|
66
|
-
let p =
|
|
67
|
-
return
|
|
68
|
-
if (p.current
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
75
|
-
|
|
95
|
+
i,
|
|
96
|
+
a,
|
|
97
|
+
o,
|
|
76
98
|
s,
|
|
77
|
-
c,
|
|
78
99
|
e
|
|
79
|
-
]),
|
|
100
|
+
]), r({
|
|
80
101
|
render: l,
|
|
81
102
|
ref: [p, u ?? null],
|
|
82
103
|
props: {
|
|
83
104
|
...f,
|
|
84
|
-
"data-lg-corner":
|
|
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
|
-
|
|
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 };
|