@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/toolbar.js
CHANGED
|
@@ -1,145 +1,60 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { GlassShape as e } from "./shape.js";
|
|
3
3
|
import { GlassSurface as t } from "./surface.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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);
|
|
4
|
+
import { Children as n, Fragment as r, cloneElement as i, isValidElement as a } from "react";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
import { Toolbar as s } from "@base-ui/react/toolbar";
|
|
7
|
+
// src/react/toolbar.tsx
|
|
8
|
+
function c({ material: e, appearance: c, radius: l = "capsule", refraction: u, tint: d, specular: p, frost: m, interactive: h = !0, motion: g, className: _ = "", style: v, children: y, ...b }) {
|
|
9
|
+
let x = [], S = (e, t = "") => {
|
|
10
|
+
n.forEach(n.toArray(e), (e) => {
|
|
11
|
+
a(e) && e.type === r ? S(e.props.children, `${t}${e.key}/`) : x.push(a(e) ? i(e, { key: `${t}${e.key}` }) : e);
|
|
17
12
|
});
|
|
18
13
|
};
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 = [];
|
|
14
|
+
S(y);
|
|
15
|
+
let C = b.orientation ?? "horizontal", w = [], T = [], E = () => {
|
|
16
|
+
T.length && (w.push(/* @__PURE__ */ o(t, {
|
|
17
|
+
material: e,
|
|
18
|
+
appearance: c,
|
|
19
|
+
radius: l,
|
|
20
|
+
refraction: u,
|
|
21
|
+
tint: d,
|
|
22
|
+
specular: p,
|
|
23
|
+
frost: m,
|
|
24
|
+
interactive: h,
|
|
25
|
+
motion: g,
|
|
26
|
+
className: "lg-toolbar-cluster",
|
|
27
|
+
"data-orientation": C,
|
|
28
|
+
children: T
|
|
29
|
+
}, `cluster-${w.length}`)), T = []);
|
|
45
30
|
};
|
|
46
|
-
for (let e of
|
|
47
|
-
|
|
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, {
|
|
31
|
+
for (let e of x) a(e) && e.type === f ? (E(), w.push(e)) : T.push(e);
|
|
32
|
+
return E(), /* @__PURE__ */ o(s.Root, {
|
|
52
33
|
"aria-label": "Toolbar",
|
|
53
|
-
...
|
|
54
|
-
style:
|
|
55
|
-
className: `lg-toolbar ${
|
|
56
|
-
"data-segmented":
|
|
57
|
-
children:
|
|
34
|
+
...b,
|
|
35
|
+
style: v,
|
|
36
|
+
className: `lg-toolbar ${_}`,
|
|
37
|
+
"data-segmented": w.length > 1 ? "" : void 0,
|
|
38
|
+
children: w
|
|
58
39
|
});
|
|
59
40
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
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, {
|
|
41
|
+
function l({ className: t, size: n = "icon", ...r }) {
|
|
42
|
+
return /* @__PURE__ */ o(e, {
|
|
127
43
|
radius: n === "icon" ? "circle" : "capsule",
|
|
128
|
-
render: /* @__PURE__ */
|
|
44
|
+
render: /* @__PURE__ */ o(s.Button, {
|
|
129
45
|
...r,
|
|
130
46
|
"data-size": n,
|
|
131
47
|
className: (e) => `lg-toolbar-button ${typeof t == "function" ? t(e) : t ?? ""}`
|
|
132
48
|
})
|
|
133
49
|
});
|
|
134
50
|
}
|
|
135
|
-
var
|
|
136
|
-
function
|
|
137
|
-
return /* @__PURE__ */
|
|
51
|
+
var u = s.Link, d = s.Group;
|
|
52
|
+
function f({ sizing: e = "flexible", className: t = "", ...n }) {
|
|
53
|
+
return /* @__PURE__ */ o("span", {
|
|
138
54
|
...n,
|
|
139
55
|
"aria-hidden": "true",
|
|
140
56
|
className: `lg-toolbar-spacer ${t}`,
|
|
141
57
|
"data-sizing": e
|
|
142
58
|
});
|
|
143
59
|
}
|
|
144
|
-
|
|
145
|
-
export { m as GlassToolbar, _ as GlassToolbarButton, y as GlassToolbarGroup, v as GlassToolbarLink, b as GlassToolbarSpacer };
|
|
60
|
+
export { c as GlassToolbar, l as GlassToolbarButton, d as GlassToolbarGroup, u as GlassToolbarLink, f as GlassToolbarSpacer };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
// src/react/value-control-motion.ts
|
|
3
3
|
function e(e, t) {
|
|
4
4
|
if (!e.oppositeHalf) return t >= e.left + e.width / 2 !== e.rtl;
|
|
5
5
|
let n = (t - e.x) * (e.rtl ? -1 : 1);
|
|
6
6
|
return e.start === 0 ? n > e.width * .4 : n >= -e.width * .4;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { e as switchDragState };
|