@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/dom/selection.js
CHANGED
|
@@ -1,19 +1,40 @@
|
|
|
1
|
-
import { Spring as e
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Spring as e } from "../core/spring.js";
|
|
2
|
+
// src/dom/selection.ts
|
|
3
|
+
var t = (e) => !e.matches(":disabled, [data-disabled], [aria-disabled='true']"), n = {
|
|
4
|
+
lift: {
|
|
5
|
+
duration: .25,
|
|
6
|
+
bounce: 0
|
|
7
|
+
},
|
|
8
|
+
settle: {
|
|
9
|
+
duration: .4,
|
|
10
|
+
bounce: 0
|
|
11
|
+
},
|
|
12
|
+
end: {
|
|
13
|
+
duration: .3,
|
|
14
|
+
bounce: .1
|
|
15
|
+
},
|
|
16
|
+
squash: {
|
|
17
|
+
duration: .38,
|
|
18
|
+
bounce: .45
|
|
19
|
+
}
|
|
20
|
+
}, r = {
|
|
21
|
+
along: 1 / 3,
|
|
22
|
+
across: .29
|
|
23
|
+
};
|
|
24
|
+
function i(i, a, o) {
|
|
25
|
+
let s = i.parentElement;
|
|
26
|
+
if (!s) return {
|
|
27
|
+
frame: () => !1,
|
|
28
|
+
dispose() {},
|
|
29
|
+
setLens() {}
|
|
9
30
|
};
|
|
10
|
-
let
|
|
11
|
-
left:
|
|
12
|
-
top:
|
|
13
|
-
width:
|
|
14
|
-
height:
|
|
15
|
-
|
|
16
|
-
},
|
|
31
|
+
let c = i.ownerDocument.defaultView, l = {
|
|
32
|
+
left: i.style.left,
|
|
33
|
+
top: i.style.top,
|
|
34
|
+
width: i.style.width,
|
|
35
|
+
height: i.style.height,
|
|
36
|
+
opacity: i.style.opacity
|
|
37
|
+
}, u = new e(0, n.settle), d = new e(0, n.settle), f = new e(0, n.settle), p = new e(0, n.settle), m = new e(0, n.lift), h = new e(0, n.squash), g = 0, _ = null, v = null, y = null, b = !1, x = 0, S = !1, C = !1, w = !1, T = null, E = null, D = () => s.getAttribute("aria-orientation") === "vertical" || s.dataset.orientation === "vertical", O = () => [...s.querySelectorAll("[role=\"tab\"]")].filter((e) => e.closest("[role=\"tablist\"]") === s), k = (e) => D() ? {
|
|
17
38
|
pos: e.offsetTop,
|
|
18
39
|
cross: e.offsetLeft,
|
|
19
40
|
length: e.offsetHeight,
|
|
@@ -23,84 +44,117 @@ function r(r, i) {
|
|
|
23
44
|
cross: e.offsetTop,
|
|
24
45
|
length: e.offsetWidth,
|
|
25
46
|
thickness: e.offsetHeight
|
|
26
|
-
},
|
|
27
|
-
let t =
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
}, A = (e) => D() ? e.clientY : e.clientX, j = (e) => {
|
|
48
|
+
let t = s.getBoundingClientRect();
|
|
49
|
+
return D() ? (e - t.top) * s.offsetHeight / (t.height || 1) : (e - t.left) * s.offsetWidth / (t.width || 1);
|
|
50
|
+
}, M = (e) => {
|
|
51
|
+
let n = O().filter(t);
|
|
52
|
+
return n.find((t) => {
|
|
53
|
+
let n = k(t);
|
|
54
|
+
return e >= n.pos && e < n.pos + n.length;
|
|
55
|
+
}) ?? n.map((t) => ({
|
|
56
|
+
tab: t,
|
|
57
|
+
distance: Math.abs(k(t).pos + k(t).length / 2 - e)
|
|
58
|
+
})).sort((e, t) => e.distance - t.distance)[0]?.tab;
|
|
59
|
+
}, N = () => O().find((e) => e.getAttribute("aria-selected") === "true");
|
|
60
|
+
function P(e) {
|
|
61
|
+
if (e.button !== 0 || a() !== "full") return;
|
|
62
|
+
let r = e.target?.closest("[role=\"tab\"]");
|
|
63
|
+
if (!r || !s.contains(r) || !t(r)) return;
|
|
64
|
+
let i = j(A(e)), l = r === N() ? i - (u.value + d.value / 2) : 0;
|
|
65
|
+
T = {
|
|
39
66
|
id: e.pointerId,
|
|
40
|
-
start:
|
|
41
|
-
client:
|
|
42
|
-
grab:
|
|
43
|
-
|
|
67
|
+
start: A(e),
|
|
68
|
+
client: A(e),
|
|
69
|
+
grab: l,
|
|
70
|
+
moved: !1,
|
|
71
|
+
held: r
|
|
72
|
+
}, E = null, m.configure(n.lift).target = 1, C || (C = !0, o?.(!0)), c.addEventListener("pointermove", F), c.addEventListener("pointerup", L), c.addEventListener("pointercancel", R);
|
|
73
|
+
}
|
|
74
|
+
function F(e) {
|
|
75
|
+
T && e.pointerId === T.id && (T.client = A(e), T.moved ||= Math.abs(T.client - T.start) > 3);
|
|
76
|
+
}
|
|
77
|
+
function I() {
|
|
78
|
+
T = null, m.configure(n.settle).target = 0, c.removeEventListener("pointermove", F), c.removeEventListener("pointerup", L), c.removeEventListener("pointercancel", R);
|
|
44
79
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
80
|
+
function L(e) {
|
|
81
|
+
if (!T || e.pointerId !== T.id) return;
|
|
82
|
+
let t = T.moved, n = t ? M(u.target + d.target / 2) : T.held;
|
|
83
|
+
I(), n && (E = {
|
|
84
|
+
tab: n,
|
|
85
|
+
at: performance.now()
|
|
86
|
+
}, t && (S = !0, setTimeout(() => {
|
|
87
|
+
S = !1;
|
|
88
|
+
}, 0), n.getAttribute("aria-selected") !== "true" && n.click()));
|
|
47
89
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
90
|
+
function R(e) {
|
|
91
|
+
T && e.pointerId === T.id && (I(), E = null);
|
|
50
92
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
let t = S(c.value + u.value / 2);
|
|
54
|
-
T(), m && t && (h = !0, setTimeout(() => {
|
|
55
|
-
h = !1;
|
|
56
|
-
}, 0), t.getAttribute("aria-selected") !== "true" && t.click());
|
|
93
|
+
function z(e) {
|
|
94
|
+
S && e.isTrusted && (S = !1, e.preventDefault(), e.stopPropagation());
|
|
57
95
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
96
|
+
function B() {
|
|
97
|
+
a() === "full" && (w = !0, C || (C = !0, o?.(!0)));
|
|
60
98
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
99
|
+
function V() {
|
|
100
|
+
w = !1;
|
|
63
101
|
}
|
|
64
|
-
|
|
102
|
+
s.addEventListener("pointerenter", B), s.addEventListener("pointerleave", V), s.addEventListener("pointerdown", P), s.addEventListener("click", z, !0);
|
|
103
|
+
let H = () => {
|
|
104
|
+
v && !v.hidden && (v.hidden = !0);
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
setLens(e, t) {
|
|
108
|
+
v && v !== e && (v.hidden = !0), v = e, y = t, v && (v.hidden = !0);
|
|
109
|
+
},
|
|
65
110
|
frame(e) {
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
let
|
|
71
|
-
if (!
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]) e.configure(t.layout);
|
|
82
|
-
c.target = h.pos, l.target = h.cross, u.target = h.length, d.target = h.thickness;
|
|
83
|
-
}
|
|
111
|
+
let t = x ? Math.min((e - x) / 1e3, 1 / 20) : 1 / 60;
|
|
112
|
+
x = e;
|
|
113
|
+
let c = a() === "full";
|
|
114
|
+
E && (N() === E.tab || e - E.at > 600) && (E = null);
|
|
115
|
+
let S = N();
|
|
116
|
+
if (!S) return !1;
|
|
117
|
+
let A = O(), M = !!T?.moved && c, P = k(E?.tab ?? T?.held ?? S), F = !1;
|
|
118
|
+
if (T && M) {
|
|
119
|
+
let e = k(A[0]), t = k(A.at(-1)), r = k(T.held), i = j(T.client) - T.grab - r.length / 2;
|
|
120
|
+
u.configure(n.end), d.configure(n.end), i <= e.pos ? (T.held = A[0], P = e) : i + r.length >= t.pos + t.length ? (T.held = A.at(-1), P = t) : (P = {
|
|
121
|
+
...r,
|
|
122
|
+
pos: i
|
|
123
|
+
}, F = b);
|
|
124
|
+
} else u.configure(n.settle), d.configure(n.settle);
|
|
125
|
+
!b || !c ? (u.jump(P.pos), d.jump(P.length), f.jump(P.cross), p.jump(P.thickness), m.jump(0), h.jump(0), b = P.length > 0) : (u.target = P.pos, d.target = P.length, f.target = P.cross, p.target = P.thickness), _ = F ? (_ ?? u.value - P.pos) * Math.exp(-50 * t) : null, g = _ === null ? u.velocity : g + ((P.pos + _ - u.value) / (t || 1) - g) * t * 20, h.target = M && v?.style.backdropFilter ? Math.min(.045, Math.abs(g) * 85e-6) : 0;
|
|
84
126
|
for (let e of [
|
|
85
|
-
c,
|
|
86
|
-
l,
|
|
87
127
|
u,
|
|
88
|
-
d
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
128
|
+
d,
|
|
129
|
+
f,
|
|
130
|
+
p,
|
|
131
|
+
m,
|
|
132
|
+
h
|
|
133
|
+
]) e.step(t);
|
|
134
|
+
_ !== null && (u.jump(P.pos + _).velocity = g);
|
|
135
|
+
let I = D(), L = (e, t, n, r, i) => {
|
|
136
|
+
e.style.left = `${(I ? n : t).toFixed(3)}px`, e.style.top = `${(I ? t : n).toFixed(3)}px`, e.style.width = `${(I ? i : r).toFixed(3)}px`, e.style.height = `${(I ? r : i).toFixed(3)}px`;
|
|
137
|
+
};
|
|
138
|
+
L(i, u.value, f.value, d.value, p.value);
|
|
139
|
+
let R = Math.max(0, Math.min(1, m.value));
|
|
140
|
+
if (i.style.opacity = R > .001 ? (1 - R).toFixed(3) : l.opacity, v && y && (R > .001 || w)) {
|
|
141
|
+
let e = R > .001 ? R : 1, t = p.value, n = t * (1 + 2 * r.across), i = d.value + 2 * t * r.along * e, a = t * (1 + 2 * r.across * e) / n, o = i / a, c = s.getBoundingClientRect(), l = y.getBoundingClientRect(), m = c.left - l.left + y.scrollLeft - y.clientLeft, g = c.top - l.top + y.scrollTop - y.clientTop, _ = u.value + d.value / 2, b = f.value + t / 2, x = 1 + h.value, S = 1 - 2.4 * h.value;
|
|
142
|
+
v.hidden && (v.hidden = !1);
|
|
143
|
+
let C = R > .001 ? "" : "hidden";
|
|
144
|
+
v.style.visibility !== C && (v.style.visibility = C), L(v, _ - o / 2 + (I ? g : m), b - n / 2 + (I ? m : g), o, n), v.style.scale = I ? `${(a * S).toFixed(4)} ${(a * x).toFixed(4)}` : `${(a * x).toFixed(4)} ${(a * S).toFixed(4)}`;
|
|
145
|
+
} else H();
|
|
146
|
+
return T ? i.dataset.glassLifted = "" : delete i.dataset.glassLifted, C && !T && !w && m.settled && m.value === 0 && (C = !1, o?.(!1)), !b || !!T || !!E || [
|
|
96
147
|
u,
|
|
97
|
-
d
|
|
148
|
+
d,
|
|
149
|
+
f,
|
|
150
|
+
p,
|
|
151
|
+
m,
|
|
152
|
+
h
|
|
98
153
|
].some((e) => !e.settled);
|
|
99
154
|
},
|
|
100
155
|
dispose() {
|
|
101
|
-
T(),
|
|
156
|
+
T && I(), s.removeEventListener("pointerenter", B), s.removeEventListener("pointerleave", V), s.removeEventListener("pointerdown", P), s.removeEventListener("click", z, !0), Object.assign(i.style, l), delete i.dataset.glassLifted, H();
|
|
102
157
|
}
|
|
103
158
|
};
|
|
104
159
|
}
|
|
105
|
-
|
|
106
|
-
export { r as attachSelectionLens };
|
|
160
|
+
export { i as attachSelectionLens };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { acquirePosition as e, createDropShadow as t, createSvgEffects as n, extractAndStripEffects as r, hasEffects as i, observeAnchor as a, releasePosition as o, restoreStyles as s } from "@lisse/core";
|
|
2
|
+
// src/dom/shape-effects.ts
|
|
3
|
+
function c(c) {
|
|
4
|
+
let l = r(c), u = i(l.effects) ? c.parentElement : null, d = u ? e(u) : !1, f = u ? n(u, c) : null, p = u && l.effects.shadow ? t(u, c) : null, m = u ? a(u, c) : null;
|
|
5
|
+
return {
|
|
6
|
+
update(e, t, n, r) {
|
|
7
|
+
f?.update(e, l.effects, t, n, r), p && l.effects.shadow && p.update(e, l.effects.shadow, t, n, r);
|
|
8
|
+
},
|
|
9
|
+
dispose() {
|
|
10
|
+
m?.(), f?.destroy(), p?.destroy(), d && u && o(u), s(c, l.savedStyles);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export { c as createShapeEffects };
|
package/dist/dom/shape-layout.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
1
|
+
import { getLayoutSize as e } from "./layout-size.js";
|
|
2
|
+
import { shapeContainerAttributes as t } from "./shape-attributes.js";
|
|
3
|
+
import { concentricOutline as n, contentInsets as r, cornerPlacement as i, insetShape as a, polygonClip as o, scrolledShape as s } from "../core/concentric.js";
|
|
4
|
+
import { createTicker as c } from "./ticker.js";
|
|
5
|
+
// src/dom/shape-layout.ts
|
|
6
|
+
var l = /* @__PURE__ */ new Set(), u, d = /* @__PURE__ */ new Map();
|
|
7
|
+
function f() {
|
|
8
|
+
d = /* @__PURE__ */ new Map();
|
|
9
9
|
let e = [], t = !1;
|
|
10
|
-
for (let n of
|
|
10
|
+
for (let n of l) try {
|
|
11
11
|
let r = n();
|
|
12
12
|
r?.changed && (t = !0), e.push(r?.write);
|
|
13
13
|
} catch (e) {
|
|
14
|
-
|
|
14
|
+
l.delete(n), queueMicrotask(() => {
|
|
15
15
|
throw e;
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -22,32 +22,26 @@ function d() {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
for (let e of t)
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
for (let e of t)
|
|
31
|
-
|
|
25
|
+
function p(e, ...t) {
|
|
26
|
+
l.add(e), u ??= c(f, { root: document });
|
|
27
|
+
for (let e of t) u.observe(e);
|
|
28
|
+
return u.wake(), () => {
|
|
29
|
+
l.delete(e);
|
|
30
|
+
for (let e of t) u?.unobserve(e);
|
|
31
|
+
l.size || (u?.dispose(), u = void 0);
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
e &&
|
|
34
|
+
function m(e) {
|
|
35
|
+
e && u?.observe(e), u?.wake();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function h(e, t) {
|
|
44
|
-
let n = m(t), r = Object.keys(n).map((t) => [t, e.getAttribute(t)]);
|
|
45
|
-
for (let [t, r] of Object.entries(n)) e.getAttribute(t) !== r && e.setAttribute(t, r);
|
|
46
|
-
let i = !1;
|
|
37
|
+
function h(e, n) {
|
|
38
|
+
let r = t(n), i = Object.keys(r).map((t) => [t, e.getAttribute(t)]);
|
|
39
|
+
for (let [t, n] of Object.entries(r)) e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
40
|
+
let a = !1;
|
|
47
41
|
return () => {
|
|
48
|
-
if (!
|
|
49
|
-
|
|
50
|
-
for (let [t, n] of
|
|
42
|
+
if (!a) {
|
|
43
|
+
a = !0;
|
|
44
|
+
for (let [t, n] of i) n === null ? e.removeAttribute(t) : e.setAttribute(t, n);
|
|
51
45
|
}
|
|
52
46
|
};
|
|
53
47
|
}
|
|
@@ -55,91 +49,97 @@ var g = /* @__PURE__ */ new WeakMap();
|
|
|
55
49
|
function _(e, t) {
|
|
56
50
|
t ? g.set(e, t) : g.delete(e);
|
|
57
51
|
}
|
|
58
|
-
function v(e) {
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
function v(e, t) {
|
|
53
|
+
for (let n = e.parentElement; n && n !== t; n = n.parentElement) {
|
|
54
|
+
let e = getComputedStyle(n);
|
|
55
|
+
if (/(auto|scroll)/.test(e.overflowY + e.overflowX)) return n;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function y(t) {
|
|
59
|
+
let n = t.getAttribute("data-lg-container-radius");
|
|
60
|
+
if (n === null) throw Error("Declare the container with GlassShapeContainer, GlassShape, GlassSurface, or registerShapeContainer.");
|
|
61
|
+
let { width: r, height: i } = e(t);
|
|
62
62
|
return {
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
65
|
-
radius:
|
|
66
|
-
outline: g.get(
|
|
63
|
+
width: r,
|
|
64
|
+
height: i,
|
|
65
|
+
radius: n === "circle" || n === "capsule" ? n : Number(n),
|
|
66
|
+
outline: g.get(t)
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function b(e, t) {
|
|
70
70
|
if (t) return t();
|
|
71
71
|
let n = e.parentElement?.closest("[data-lg-container]");
|
|
72
72
|
if (!n && e.isConnected) throw Error("Container-relative geometry requires a declared shape container.");
|
|
73
73
|
return n ?? null;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
if (
|
|
77
|
-
let
|
|
78
|
-
clipPath:
|
|
79
|
-
paddingLeft:
|
|
80
|
-
paddingRight:
|
|
81
|
-
},
|
|
82
|
-
let
|
|
83
|
-
if (!
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
if (!
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]),
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
s !==
|
|
99
|
-
let c =
|
|
100
|
-
x:
|
|
101
|
-
y:
|
|
102
|
-
width:
|
|
103
|
-
height:
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
let
|
|
107
|
-
|
|
75
|
+
function x(t, i = {}, c) {
|
|
76
|
+
if (i.contentPadding !== void 0 && (!Number.isFinite(i.contentPadding) || i.contentPadding < 0)) throw RangeError("Content padding must be finite and nonnegative.");
|
|
77
|
+
let l = h(t, i.radius ?? 8), u = {
|
|
78
|
+
clipPath: t.style.clipPath,
|
|
79
|
+
paddingLeft: t.style.paddingLeft,
|
|
80
|
+
paddingRight: t.style.paddingRight
|
|
81
|
+
}, f = "", g = "", x = [], S = "", C = "", w, T = [], E, D, O = p(() => {
|
|
82
|
+
let l = b(t, c);
|
|
83
|
+
if (!l || !t.isConnected) return;
|
|
84
|
+
l !== E && (E = l, D = v(t, l), m(l));
|
|
85
|
+
let u = y(l), p = e(t), h = l.getBoundingClientRect(), O = t.getBoundingClientRect();
|
|
86
|
+
if (!u.width || !u.height || !p.width || !p.height || !h.width || !h.height) return;
|
|
87
|
+
let k = u.width / h.width, A = u.height / h.height, j = D ? s(u, (D.scrollWidth - D.clientWidth) * k, (D.scrollHeight - D.clientHeight) * A) : u, M = (O.left - h.left + (D?.scrollLeft ?? 0)) * k, N = (O.top - h.top + (D?.scrollTop ?? 0)) * A, P = JSON.stringify([
|
|
88
|
+
j,
|
|
89
|
+
p.width,
|
|
90
|
+
p.height,
|
|
91
|
+
M,
|
|
92
|
+
N,
|
|
93
|
+
i
|
|
94
|
+
]), F = f !== P;
|
|
95
|
+
if (F) {
|
|
96
|
+
f = P;
|
|
97
|
+
let e = i.inset ?? Math.max(0, Math.min(M, N, j.width - M - p.width, j.height - N - p.height)), s = JSON.stringify([j, e]);
|
|
98
|
+
s !== g && (x = a(j, e), g = s);
|
|
99
|
+
let c = n(x, {
|
|
100
|
+
x: M,
|
|
101
|
+
y: N,
|
|
102
|
+
width: p.width,
|
|
103
|
+
height: p.height
|
|
104
|
+
}, i.radius ?? 8);
|
|
105
|
+
S = o(c), T = c;
|
|
106
|
+
let l = Math.min(p.height, Math.max(16, parseFloat(getComputedStyle(t).lineHeight) || 20));
|
|
107
|
+
w = i.contentPadding === void 0 ? void 0 : r(c, p.width, p.height, l);
|
|
108
108
|
}
|
|
109
|
-
if (
|
|
110
|
-
let e =
|
|
109
|
+
if (w) {
|
|
110
|
+
let e = d.get(l) ?? {
|
|
111
111
|
left: 0,
|
|
112
112
|
right: 0
|
|
113
113
|
};
|
|
114
|
-
e.left = Math.max(e.left,
|
|
114
|
+
e.left = Math.max(e.left, w.left), e.right = Math.max(e.right, w.right), d.set(l, e);
|
|
115
115
|
}
|
|
116
116
|
return {
|
|
117
|
-
changed:
|
|
117
|
+
changed: F,
|
|
118
118
|
write: () => {
|
|
119
|
-
if (_(
|
|
120
|
-
let
|
|
121
|
-
|
|
119
|
+
if (_(t, T), C !== S && (t.style.clipPath = S, C = S), w) {
|
|
120
|
+
let e = d.get(l), n = `${e.left + i.contentPadding}px`, r = `${e.right + i.contentPadding}px`;
|
|
121
|
+
t.style.paddingLeft !== n && (t.style.paddingLeft = n), t.style.paddingRight !== r && (t.style.paddingRight = r);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
},
|
|
125
|
+
}, t);
|
|
126
126
|
return () => {
|
|
127
|
-
|
|
127
|
+
O(), l(), _(t), Object.assign(t.style, u);
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
let
|
|
132
|
-
left:
|
|
133
|
-
top:
|
|
134
|
-
right:
|
|
135
|
-
bottom:
|
|
136
|
-
},
|
|
137
|
-
let
|
|
138
|
-
if (!
|
|
139
|
-
|
|
140
|
-
let u =
|
|
130
|
+
function S(t, n = {}, r) {
|
|
131
|
+
let a = {
|
|
132
|
+
left: t.style.left,
|
|
133
|
+
top: t.style.top,
|
|
134
|
+
right: t.style.right,
|
|
135
|
+
bottom: t.style.bottom
|
|
136
|
+
}, o = "", s = "", c = 0, l, u = p(() => {
|
|
137
|
+
let a = b(t, r);
|
|
138
|
+
if (!a || !t.isConnected) return;
|
|
139
|
+
a !== l && (l = a, m(a));
|
|
140
|
+
let u = y(a), d = e(t), f = a.getBoundingClientRect();
|
|
141
141
|
if (!u.width || !u.height || !d.width || !d.height || !f.width || !f.height) return;
|
|
142
|
-
let
|
|
142
|
+
let p = getComputedStyle(t).position === "fixed" ? null : t.offsetParent, h = p?.getBoundingClientRect(), g = JSON.stringify([
|
|
143
143
|
u,
|
|
144
144
|
d.width,
|
|
145
145
|
d.height,
|
|
@@ -149,37 +149,37 @@ function x(e, t = {}, n) {
|
|
|
149
149
|
f.height,
|
|
150
150
|
h?.x,
|
|
151
151
|
h?.y,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
p?.scrollLeft,
|
|
153
|
+
p?.scrollTop,
|
|
154
|
+
n
|
|
155
155
|
]);
|
|
156
|
-
if (g ===
|
|
157
|
-
|
|
156
|
+
if (g === o) return { changed: !1 };
|
|
157
|
+
o = g;
|
|
158
158
|
let _ = JSON.stringify([
|
|
159
159
|
u,
|
|
160
160
|
d.width,
|
|
161
161
|
d.height,
|
|
162
|
-
|
|
162
|
+
n
|
|
163
163
|
]);
|
|
164
|
-
_ !==
|
|
165
|
-
let
|
|
164
|
+
_ !== s && (c = i(u, d.width, d.height, n.gap ?? 8, n.radius ?? "circle"), s = _);
|
|
165
|
+
let v = c, x = n.corner ?? "top-right", S = x.endsWith("right") ? u.width - v - d.width : v, C = x.startsWith("bottom") ? u.height - v - d.height : v, w = f.width / u.width, T = f.height / u.height, E = p && h ? h.width / p.offsetWidth : 1, D = p && h ? h.height / p.offsetHeight : 1, O = (f.left + S * w - (h?.left ?? 0)) / E + (p?.scrollLeft ?? 0) - (p?.clientLeft ?? 0), k = (f.top + C * T - (h?.top ?? 0)) / D + (p?.scrollTop ?? 0) - (p?.clientTop ?? 0);
|
|
166
166
|
return {
|
|
167
167
|
changed: !0,
|
|
168
168
|
write: () => {
|
|
169
|
-
|
|
169
|
+
t.style.left = `${O}px`, t.style.top = `${k}px`, t.style.right = "auto", t.style.bottom = "auto";
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
-
},
|
|
172
|
+
}, t);
|
|
173
173
|
return () => {
|
|
174
|
-
u(), Object.assign(
|
|
174
|
+
u(), Object.assign(t.style, a);
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
let
|
|
177
|
+
function C(t, r, i) {
|
|
178
|
+
let o = "", s = [];
|
|
179
179
|
return () => {
|
|
180
|
-
let c =
|
|
180
|
+
let c = b(t);
|
|
181
181
|
if (!c) return;
|
|
182
|
-
let l =
|
|
182
|
+
let l = y(c), u = e(t), d = c.getBoundingClientRect(), f = t.getBoundingClientRect();
|
|
183
183
|
if (!l.width || !l.height || !d.width || !d.height || !u.width || !u.height) return;
|
|
184
184
|
let p = {
|
|
185
185
|
x: (f.left - d.left) * l.width / d.width,
|
|
@@ -189,11 +189,10 @@ function S(e, n, r) {
|
|
|
189
189
|
}, m = JSON.stringify([
|
|
190
190
|
l,
|
|
191
191
|
p,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
]), h =
|
|
195
|
-
return m !==
|
|
192
|
+
r,
|
|
193
|
+
i
|
|
194
|
+
]), h = r ?? Math.max(0, Math.min(p.x, p.y, l.width - p.x - p.width, l.height - p.y - p.height));
|
|
195
|
+
return m !== o && (s = n(a(l, h), p, i), o = m), s;
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
export { S as createConcentricResolver, b as observeConcentricShape, x as observeCornerPlacement, h as registerShapeContainer, _ as setResolvedShape, m as shapeContainerAttributes, p as wakeShapeLayout };
|
|
198
|
+
export { C as createConcentricResolver, x as observeConcentricShape, S as observeCornerPlacement, h as registerShapeContainer, _ as setResolvedShape, t as shapeContainerAttributes, m as wakeShapeLayout };
|