@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.
- package/LICENSE +21 -0
- package/README.md +235 -2
- package/dist/core/concentric.js +86 -0
- package/dist/core/materials.js +41 -0
- package/dist/core/morph-path.js +206 -0
- package/dist/core/optics.js +7 -0
- package/dist/core/progressive.js +35 -0
- package/dist/core/shape.js +95 -0
- package/dist/core/spring.js +78 -0
- package/dist/core/union.js +117 -0
- package/dist/core.js +6 -0
- package/dist/dom/compose-layers.js +54 -0
- package/dist/dom/compound-field.js +23 -0
- package/dist/dom/control-motion.js +101 -0
- package/dist/dom/engine.js +7 -0
- package/dist/dom/exit-handoff.js +14 -0
- package/dist/dom/filter-bounds.js +87 -0
- package/dist/dom/filter-budget.js +45 -0
- package/dist/dom/filter-groups.js +38 -0
- package/dist/dom/filter-paint-root.js +41 -0
- package/dist/dom/filter-patch.js +129 -0
- package/dist/dom/filter-reach.js +36 -0
- package/dist/dom/filter-stages.js +7 -0
- package/dist/dom/fixed-shape.js +20 -0
- package/dist/dom/foreground.js +36 -0
- package/dist/dom/interaction.js +129 -0
- package/dist/dom/lens-layers.js +163 -0
- package/dist/dom/map-blend.js +8 -0
- package/dist/dom/map-encoder.js +47 -0
- package/dist/dom/map-encoder.worker.js +16 -0
- package/dist/dom/map-encoding.js +17 -0
- package/dist/dom/map-image.js +34 -0
- package/dist/dom/map-store.js +189 -0
- package/dist/dom/maps.js +131 -0
- package/dist/dom/material-graph.js +52 -0
- package/dist/dom/morph.js +296 -0
- package/dist/dom/page-zoom.js +46 -0
- package/dist/dom/png.js +105 -0
- package/dist/dom/progressive.js +299 -0
- package/dist/dom/renderer.js +6 -0
- package/dist/dom/sampling-bounds.js +22 -0
- package/dist/dom/selection.js +106 -0
- package/dist/dom/shape-layout.js +199 -0
- package/dist/dom/shared-backdrop.js +41 -0
- package/dist/dom/ticker.js +103 -0
- package/dist/dom/warm.js +108 -0
- package/dist/dom.js +694 -0
- package/dist/gpu/geometry.js +9 -0
- package/dist/gpu/maps.js +8 -0
- package/dist/gpu/planes.js +4 -0
- package/dist/gpu.js +213 -0
- package/dist/index.js +11 -0
- package/dist/react/button.js +23 -0
- package/dist/react/control-thumb.js +50 -0
- package/dist/react/menu.js +159 -0
- package/dist/react/merged-ref.js +18 -0
- package/dist/react/progressive.js +73 -0
- package/dist/react/scene.js +122 -0
- package/dist/react/shape.js +93 -0
- package/dist/react/surface.js +69 -0
- package/dist/react/tabs.js +94 -0
- package/dist/react/toolbar.js +145 -0
- package/dist/react/value-control-motion.js +9 -0
- package/dist/react/value-controls.js +176 -0
- package/dist/styles.css +360 -0
- package/dist/styles.d.css.ts +2 -0
- package/dist/types/core/concentric.d.ts +32 -0
- package/dist/types/core/index.d.ts +10 -0
- package/dist/types/core/materials.d.ts +43 -0
- package/dist/types/core/morph-path.d.ts +110 -0
- package/dist/types/core/optics.d.ts +1 -0
- package/dist/types/core/progressive.d.ts +17 -0
- package/dist/types/core/shape.d.ts +16 -0
- package/dist/types/core/spring.d.ts +60 -0
- package/dist/types/core/union.d.ts +20 -0
- package/dist/types/dom/compose-layers.d.ts +15 -0
- package/dist/types/dom/compound-field.d.ts +35 -0
- package/dist/types/dom/control-motion.d.ts +13 -0
- package/dist/types/dom/engine.d.ts +9 -0
- package/dist/types/dom/exit-handoff.d.ts +7 -0
- package/dist/types/dom/filter-bounds.d.ts +30 -0
- package/dist/types/dom/filter-budget.d.ts +20 -0
- package/dist/types/dom/filter-groups.d.ts +25 -0
- package/dist/types/dom/filter-paint-root.d.ts +9 -0
- package/dist/types/dom/filter-patch.d.ts +4 -0
- package/dist/types/dom/filter-reach.d.ts +23 -0
- package/dist/types/dom/filter-stages.d.ts +5 -0
- package/dist/types/dom/fixed-shape.d.ts +3 -0
- package/dist/types/dom/foreground.d.ts +20 -0
- package/dist/types/dom/index.d.ts +64 -0
- package/dist/types/dom/interaction.d.ts +16 -0
- package/dist/types/dom/lens-layers.d.ts +68 -0
- package/dist/types/dom/map-blend.d.ts +22 -0
- package/dist/types/dom/map-encoder.d.ts +5 -0
- package/dist/types/dom/map-encoder.worker.d.ts +1 -0
- package/dist/types/dom/map-encoding.d.ts +5 -0
- package/dist/types/dom/map-image.d.ts +17 -0
- package/dist/types/dom/map-store.d.ts +22 -0
- package/dist/types/dom/maps.d.ts +31 -0
- package/dist/types/dom/material-graph.d.ts +22 -0
- package/dist/types/dom/morph.d.ts +78 -0
- package/dist/types/dom/page-zoom.d.ts +18 -0
- package/dist/types/dom/png.d.ts +9 -0
- package/dist/types/dom/progressive.d.ts +42 -0
- package/dist/types/dom/renderer.d.ts +4 -0
- package/dist/types/dom/sampling-bounds.d.ts +10 -0
- package/dist/types/dom/selection.d.ts +5 -0
- package/dist/types/dom/shape-layout.d.ts +29 -0
- package/dist/types/dom/shared-backdrop.d.ts +19 -0
- package/dist/types/dom/ticker.d.ts +36 -0
- package/dist/types/dom/warm.d.ts +17 -0
- package/dist/types/gpu/geometry.d.ts +17 -0
- package/dist/types/gpu/index.d.ts +36 -0
- package/dist/types/gpu/planes.d.ts +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/react/button.d.ts +11 -0
- package/dist/types/react/control-thumb.d.ts +11 -0
- package/dist/types/react/index.d.ts +20 -0
- package/dist/types/react/menu.d.ts +29 -0
- package/dist/types/react/merged-ref.d.ts +3 -0
- package/dist/types/react/progressive.d.ts +15 -0
- package/dist/types/react/scene.d.ts +35 -0
- package/dist/types/react/shape.d.ts +23 -0
- package/dist/types/react/surface.d.ts +35 -0
- package/dist/types/react/tabs.d.ts +29 -0
- package/dist/types/react/toolbar.d.ts +21 -0
- package/dist/types/react/value-control-motion.d.ts +9 -0
- package/dist/types/react/value-controls.d.ts +20 -0
- package/package.json +80 -4
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/dom/ticker.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"pointerdown",
|
|
4
|
+
"pointerup",
|
|
5
|
+
"pointercancel",
|
|
6
|
+
"pointermove",
|
|
7
|
+
"pointerenter",
|
|
8
|
+
"pointerleave",
|
|
9
|
+
"keydown",
|
|
10
|
+
"keyup",
|
|
11
|
+
"focusin",
|
|
12
|
+
"focusout"
|
|
13
|
+
], t = [
|
|
14
|
+
"transitionrun",
|
|
15
|
+
"transitionstart",
|
|
16
|
+
"transitionend",
|
|
17
|
+
"transitioncancel",
|
|
18
|
+
"animationstart",
|
|
19
|
+
"animationiteration",
|
|
20
|
+
"animationend",
|
|
21
|
+
"animationcancel"
|
|
22
|
+
], n = class {
|
|
23
|
+
view;
|
|
24
|
+
raf = 0;
|
|
25
|
+
pending = /* @__PURE__ */ new Set();
|
|
26
|
+
constructor(e) {
|
|
27
|
+
this.view = e;
|
|
28
|
+
}
|
|
29
|
+
schedule(e) {
|
|
30
|
+
e.disposed || (this.pending.add(e), this.raf ||= this.view.requestAnimationFrame((e) => this.frame(e)));
|
|
31
|
+
}
|
|
32
|
+
frame(e) {
|
|
33
|
+
this.raf = 0;
|
|
34
|
+
let t = [...this.pending];
|
|
35
|
+
this.pending.clear();
|
|
36
|
+
let n = [];
|
|
37
|
+
for (let r of t) {
|
|
38
|
+
if (r.disposed) continue;
|
|
39
|
+
let t;
|
|
40
|
+
try {
|
|
41
|
+
t = r.step(e);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
queueMicrotask(() => {
|
|
44
|
+
throw e;
|
|
45
|
+
});
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
let i = typeof t == "boolean" ? t : t.active;
|
|
49
|
+
typeof t != "boolean" && t.write && n.push(t.write), r.idle = i ? 0 : r.idle + 1, r.idle < 3 && this.schedule(r);
|
|
50
|
+
}
|
|
51
|
+
for (let e of n) try {
|
|
52
|
+
e();
|
|
53
|
+
} catch (e) {
|
|
54
|
+
queueMicrotask(() => {
|
|
55
|
+
throw e;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, r = /* @__PURE__ */ new WeakMap();
|
|
60
|
+
function i(i, a) {
|
|
61
|
+
let { root: o, ignore: s, onMutation: c } = a, l = (o.ownerDocument ?? o).defaultView ?? window, u = r.get(l) ?? (() => {
|
|
62
|
+
let e = new n(l);
|
|
63
|
+
return r.set(l, e), e;
|
|
64
|
+
})(), d = {
|
|
65
|
+
step: i,
|
|
66
|
+
idle: 0,
|
|
67
|
+
disposed: !1
|
|
68
|
+
}, f = () => u.schedule(d), p = typeof ResizeObserver == "function" ? new ResizeObserver(f) : void 0, m = typeof MutationObserver == "function" ? new MutationObserver((e) => {
|
|
69
|
+
(!s || e.some((e) => !s(e.target))) && (c?.(), f());
|
|
70
|
+
}) : void 0;
|
|
71
|
+
m?.observe(o, {
|
|
72
|
+
subtree: !0,
|
|
73
|
+
attributes: !0,
|
|
74
|
+
childList: !0,
|
|
75
|
+
characterData: !1
|
|
76
|
+
});
|
|
77
|
+
let h = o;
|
|
78
|
+
for (let n of [...e, ...t]) h.addEventListener(n, f, {
|
|
79
|
+
capture: !0,
|
|
80
|
+
passive: !0
|
|
81
|
+
});
|
|
82
|
+
l.addEventListener("scroll", f, {
|
|
83
|
+
capture: !0,
|
|
84
|
+
passive: !0
|
|
85
|
+
}), l.addEventListener("resize", f, { passive: !0 }), l.document.addEventListener("visibilitychange", f);
|
|
86
|
+
let g = l.setInterval(f, a.heartbeat ?? 1e3);
|
|
87
|
+
return f(), {
|
|
88
|
+
wake: f,
|
|
89
|
+
observe(e) {
|
|
90
|
+
p?.observe(e);
|
|
91
|
+
},
|
|
92
|
+
unobserve(e) {
|
|
93
|
+
p?.unobserve(e);
|
|
94
|
+
},
|
|
95
|
+
dispose() {
|
|
96
|
+
d.disposed = !0, p?.disconnect(), m?.disconnect();
|
|
97
|
+
for (let n of [...e, ...t]) h.removeEventListener(n, f, { capture: !0 });
|
|
98
|
+
l.removeEventListener("scroll", f, { capture: !0 }), l.removeEventListener("resize", f), l.document.removeEventListener("visibilitychange", f), l.clearInterval(g);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { i as createTicker };
|
package/dist/dom/warm.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//#region src/dom/warm.ts
|
|
2
|
+
var e = "http://www.w3.org/2000/svg", t = 0;
|
|
3
|
+
function n(n) {
|
|
4
|
+
let r = `lg-warm-${++t}`, i = n.ownerDocument, a = i.createElementNS(e, "svg");
|
|
5
|
+
a.setAttribute("aria-hidden", "true"), a.setAttribute("width", "0"), a.setAttribute("height", "0"), a.style.position = "absolute", n.append(a);
|
|
6
|
+
let o = [], s = () => {
|
|
7
|
+
let t = i.createElementNS(e, "filter");
|
|
8
|
+
t.id = `${r}-${o.length}`;
|
|
9
|
+
for (let [e, n] of Object.entries({
|
|
10
|
+
x: "0",
|
|
11
|
+
y: "0",
|
|
12
|
+
width: "1",
|
|
13
|
+
height: "1",
|
|
14
|
+
filterUnits: "objectBoundingBox",
|
|
15
|
+
primitiveUnits: "objectBoundingBox"
|
|
16
|
+
})) t.setAttribute(e, n);
|
|
17
|
+
a.append(t);
|
|
18
|
+
let s = i.createElement("div");
|
|
19
|
+
s.setAttribute("aria-hidden", "true"), Object.assign(s.style, {
|
|
20
|
+
position: "absolute",
|
|
21
|
+
left: "0",
|
|
22
|
+
top: "0",
|
|
23
|
+
width: "1px",
|
|
24
|
+
height: "1px",
|
|
25
|
+
opacity: "0.004",
|
|
26
|
+
pointerEvents: "none",
|
|
27
|
+
filter: `url("#${t.id}")`
|
|
28
|
+
}), n.append(s);
|
|
29
|
+
let c = i.createElementNS(e, "feMerge");
|
|
30
|
+
t.append(c);
|
|
31
|
+
let l = {
|
|
32
|
+
filter: t,
|
|
33
|
+
merge: c,
|
|
34
|
+
element: s,
|
|
35
|
+
count: 0
|
|
36
|
+
};
|
|
37
|
+
return o.push(l), l;
|
|
38
|
+
};
|
|
39
|
+
s();
|
|
40
|
+
let c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new Map(), d, f = 0, p = (t) => {
|
|
41
|
+
if (c.has(t)) return;
|
|
42
|
+
if (c.size >= 96) {
|
|
43
|
+
let [e, t] = c.entries().next().value;
|
|
44
|
+
t.image.remove(), t.node.remove(), t.probe.count--, c.delete(e);
|
|
45
|
+
}
|
|
46
|
+
let n = o.find((e) => e.count < 48) ?? s(), r = `w${++f}`, a = i.createElementNS(e, "feImage");
|
|
47
|
+
for (let [e, t] of Object.entries({
|
|
48
|
+
x: "0",
|
|
49
|
+
y: "0",
|
|
50
|
+
width: "1",
|
|
51
|
+
height: "1",
|
|
52
|
+
preserveAspectRatio: "none",
|
|
53
|
+
result: r
|
|
54
|
+
})) a.setAttribute(e, t);
|
|
55
|
+
let l = i.createElementNS(e, "feMergeNode");
|
|
56
|
+
l.setAttribute("in", r), n.filter.insertBefore(a, n.merge), n.merge.append(l), a.setAttribute("href", t), n.count++, c.set(t, {
|
|
57
|
+
image: a,
|
|
58
|
+
node: l,
|
|
59
|
+
probe: n
|
|
60
|
+
});
|
|
61
|
+
}, m = 0, h = !1, g = [], _ = () => {
|
|
62
|
+
let e = ++m;
|
|
63
|
+
g.forEach(clearTimeout), g = [
|
|
64
|
+
16,
|
|
65
|
+
60,
|
|
66
|
+
150
|
|
67
|
+
].map((t) => setTimeout(() => {
|
|
68
|
+
if (m === e && !h) for (let { filter: e } of o) e.setAttribute("x", e.getAttribute("x") === "0" ? "0.000001" : "0");
|
|
69
|
+
}, t));
|
|
70
|
+
}, v = (e) => [
|
|
71
|
+
e.field,
|
|
72
|
+
e.overlay,
|
|
73
|
+
...Object.values(e.capsule?.planes ?? {}).flat()
|
|
74
|
+
], y = () => {
|
|
75
|
+
let e = performance.now();
|
|
76
|
+
for (let [t, n] of u) n <= e && (v(t).every((e) => c.has(e)) && l.add(t), u.delete(t));
|
|
77
|
+
}, b = () => {
|
|
78
|
+
if (d !== void 0 || !u.size) return;
|
|
79
|
+
let e = Math.min(...u.values());
|
|
80
|
+
d = setTimeout(() => {
|
|
81
|
+
d = void 0, !h && (y(), b());
|
|
82
|
+
}, Math.max(0, e - performance.now()));
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
warm(e) {
|
|
86
|
+
if (h || (y(), l.has(e))) return;
|
|
87
|
+
let t = v(e).filter((e) => !c.has(e));
|
|
88
|
+
if (t.length) {
|
|
89
|
+
for (let e of t) p(e);
|
|
90
|
+
_();
|
|
91
|
+
}
|
|
92
|
+
(t.length || !u.has(e)) && u.set(e, performance.now() + 50), b();
|
|
93
|
+
},
|
|
94
|
+
has(e) {
|
|
95
|
+
return !h && (y(), l.has(e));
|
|
96
|
+
},
|
|
97
|
+
owns(e) {
|
|
98
|
+
return a.contains(e) || o.some((t) => t.element.contains(e));
|
|
99
|
+
},
|
|
100
|
+
dispose() {
|
|
101
|
+
h = !0, g.forEach(clearTimeout), g = [], d !== void 0 && clearTimeout(d), d = void 0, u.clear(), a.remove();
|
|
102
|
+
for (let { element: e } of o) e.remove();
|
|
103
|
+
c.clear();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { n as createMapWarmer };
|