@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/map-store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/dom/map-store.ts
|
|
2
2
|
var e = "maps", t;
|
|
3
3
|
function n() {
|
|
4
4
|
return t ||= new Promise((n) => {
|
|
@@ -185,5 +185,4 @@ async function D() {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
//#endregion
|
|
189
188
|
export { y as claimFirstPaint, c as loadStoredMaps, v as peekStoredMaps, s as preloadStoredMaps, l as preloadedKeys, T as saveStoredMaps };
|
package/dist/dom/maps.js
CHANGED
|
@@ -1,131 +1,181 @@
|
|
|
1
|
-
import { encodeMaterialPixels as e } from "./map-encoder.js";
|
|
2
|
-
import { getMaterialRenderer as
|
|
3
|
-
import { mapScale as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { encodeMaterialPixels as e, warmMapEncoder as t } from "./map-encoder.js";
|
|
2
|
+
import { getMaterialRenderer as n } from "./renderer.js";
|
|
3
|
+
import { mapScale as r } from "../gpu/geometry.js";
|
|
4
|
+
import i from "../gpu/maps.js";
|
|
5
|
+
import { refractionFor as a } from "../core/materials.js";
|
|
6
|
+
import { chromium as o } from "./engine.js";
|
|
7
|
+
import { capsuleMapGeometry as s, releaseMapToken as c } from "./map-image.js";
|
|
8
|
+
import { claimFirstPaint as l, loadStoredMaps as u, peekStoredMaps as d, preloadStoredMaps as f, preloadedKeys as p, saveStoredMaps as m } from "./map-store.js";
|
|
9
|
+
// src/dom/maps.ts
|
|
10
|
+
function h(e) {
|
|
11
|
+
if (e.outline) return;
|
|
12
|
+
let t = r(e), n = Math.min(e.width, e.height), i = typeof e.radius == "number" ? Math.min(e.radius, n / 2) : n / 2, o = Math.max(1.8125 * i, 24, a(e.material ?? "regular", n).height), s = Math.ceil((o + 3) * t), c = Math.ceil((e.width + 4) * t), l = Math.ceil((e.height + 4) * t);
|
|
13
|
+
if (!(c * l < g)) return {
|
|
14
|
+
x: Math.min(s, Math.ceil(c / 2)),
|
|
15
|
+
y: Math.min(s, Math.ceil(l / 2))
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var g = 102400, _ = (() => {
|
|
19
|
+
let e = 2166136261, t = [
|
|
20
|
+
"clear",
|
|
21
|
+
"regular",
|
|
22
|
+
"lens"
|
|
23
|
+
].map((e) => [
|
|
24
|
+
16,
|
|
25
|
+
64,
|
|
26
|
+
160
|
|
27
|
+
].map((t) => a(e, t).height).join()).join(";");
|
|
28
|
+
for (let n of `${i.wgsl}|png-sub-6|${t}`) e = Math.imul(e ^ n.charCodeAt(0), 16777619);
|
|
11
29
|
return (e >>> 0).toString(36);
|
|
12
|
-
})(),
|
|
30
|
+
})(), v = /* @__PURE__ */ new Map();
|
|
13
31
|
if (typeof indexedDB < "u" && typeof Image < "u") {
|
|
14
|
-
let e = `${
|
|
15
|
-
|
|
16
|
-
for (let t of
|
|
32
|
+
let e = `${_}|`;
|
|
33
|
+
f(e).then(() => {
|
|
34
|
+
for (let t of p()) {
|
|
17
35
|
let n = t.slice(e.length), r, i;
|
|
18
36
|
try {
|
|
19
|
-
let [e, t, a, o, s, c, l] = JSON.parse(n);
|
|
37
|
+
let [e, t, a, o, s, c, l, u] = JSON.parse(n);
|
|
20
38
|
r = {
|
|
21
39
|
width: e,
|
|
22
40
|
height: t,
|
|
23
41
|
radius: a,
|
|
24
42
|
dpr: o,
|
|
25
43
|
appearance: s,
|
|
26
|
-
|
|
27
|
-
|
|
44
|
+
material: c,
|
|
45
|
+
outline: l
|
|
46
|
+
}, i = u;
|
|
28
47
|
} catch {
|
|
29
48
|
continue;
|
|
30
49
|
}
|
|
31
|
-
|
|
50
|
+
v.has(n) || k(r, i).catch(() => void 0);
|
|
32
51
|
}
|
|
33
52
|
});
|
|
34
53
|
}
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
var y = !1;
|
|
55
|
+
function b() {
|
|
56
|
+
y || (y = !0, n().catch(() => {
|
|
57
|
+
y = !1;
|
|
58
|
+
}), t());
|
|
37
59
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
return n ? S(n, !0, t) : S(e, !1, t);
|
|
60
|
+
function x(e) {
|
|
61
|
+
return k(e);
|
|
41
62
|
}
|
|
42
|
-
function
|
|
43
|
-
let t =
|
|
44
|
-
return
|
|
63
|
+
function S(e) {
|
|
64
|
+
let t = s(e);
|
|
65
|
+
return t ? k(t, !0) : k(e, !1);
|
|
45
66
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
67
|
+
function C(e) {
|
|
68
|
+
let t = s(e);
|
|
69
|
+
return T(t ?? e, !!t);
|
|
48
70
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
71
|
+
function w(e) {
|
|
72
|
+
return T(e, !1);
|
|
73
|
+
}
|
|
74
|
+
function T(e, t) {
|
|
75
|
+
let n = E(e, t), r = N.get(n);
|
|
51
76
|
if (r) return r;
|
|
52
|
-
if (
|
|
53
|
-
let
|
|
54
|
-
if (!
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
var
|
|
77
|
+
if (v.has(n)) return;
|
|
78
|
+
let i = d(`${_}|${n}`);
|
|
79
|
+
if (!i) return;
|
|
80
|
+
let a = O(e, t, i.planes, i.duration);
|
|
81
|
+
l(`${_}|${n}`, i), M.set(a, performance.now()), N.set(n, a);
|
|
82
|
+
let o = Promise.all(I(a).map(j)).then(() => a);
|
|
83
|
+
return v.set(n, o), o.catch(() => void 0), V(), a;
|
|
84
|
+
}
|
|
85
|
+
var E = (e, t) => JSON.stringify([
|
|
61
86
|
e.width,
|
|
62
87
|
e.height,
|
|
63
88
|
e.radius,
|
|
64
89
|
e.dpr,
|
|
65
90
|
e.appearance,
|
|
91
|
+
e.material,
|
|
66
92
|
e.outline,
|
|
67
93
|
t
|
|
68
|
-
]),
|
|
69
|
-
|
|
70
|
-
|
|
94
|
+
]), D = [
|
|
95
|
+
"field",
|
|
96
|
+
"rim",
|
|
97
|
+
"light"
|
|
98
|
+
];
|
|
99
|
+
function O(e, t, n, i) {
|
|
100
|
+
let a = t ? 3 : 0, o = Object.fromEntries(D.map((e, t) => [e, n[t].slice(1, 1 + a)])), s = h(e), c = r(e), l = Object.fromEntries(D.map((e, t) => [e, n[t].slice(1 + a)]));
|
|
71
101
|
return {
|
|
72
102
|
field: n[0][0],
|
|
73
|
-
|
|
74
|
-
|
|
103
|
+
rim: n[1][0],
|
|
104
|
+
light: n[2][0],
|
|
105
|
+
duration: i,
|
|
75
106
|
...t ? { capsule: {
|
|
76
107
|
cap: e.height + 2,
|
|
77
108
|
height: e.height + 4,
|
|
78
|
-
planes:
|
|
109
|
+
planes: o
|
|
110
|
+
} } : {},
|
|
111
|
+
...s && l.field.length === 9 ? { nine: {
|
|
112
|
+
x: s.x / c,
|
|
113
|
+
y: s.y / c,
|
|
114
|
+
planes: l
|
|
79
115
|
} } : {}
|
|
80
116
|
};
|
|
81
117
|
}
|
|
82
|
-
function
|
|
83
|
-
let
|
|
84
|
-
if (
|
|
85
|
-
let
|
|
86
|
-
if (a) return
|
|
87
|
-
let { width: o, height:
|
|
88
|
-
return
|
|
89
|
-
planes:
|
|
90
|
-
duration:
|
|
91
|
-
}),
|
|
92
|
-
planes:
|
|
93
|
-
duration:
|
|
94
|
-
})
|
|
95
|
-
}).then(async (e) => (await Promise.all(
|
|
96
|
-
throw
|
|
118
|
+
function k(t, i = !1) {
|
|
119
|
+
let a = E(t, i), o = v.get(a);
|
|
120
|
+
if (o) return o;
|
|
121
|
+
let s = `${_}|${a}`, c = u(s).then(async (a) => {
|
|
122
|
+
if (a) return l(s, a), O(t, i, a.planes, a.duration);
|
|
123
|
+
let { width: o, height: c, pixels: u, duration: d } = await (await n()).render(t), f = await e(u, o, c, i ? Math.round((t.height + 2) * r(t)) : void 0, h(t));
|
|
124
|
+
return m(s, {
|
|
125
|
+
planes: f,
|
|
126
|
+
duration: d
|
|
127
|
+
}), l(s, {
|
|
128
|
+
planes: f,
|
|
129
|
+
duration: d
|
|
130
|
+
}), O(t, i, f, d);
|
|
131
|
+
}).then(async (e) => (await Promise.all(I(e).map(j)), M.set(e, performance.now()), v.get(a) === c && N.set(a, e), e)).catch((e) => {
|
|
132
|
+
throw v.delete(a), e;
|
|
97
133
|
});
|
|
98
|
-
return
|
|
134
|
+
return v.set(a, c), V(), c;
|
|
99
135
|
}
|
|
100
|
-
var
|
|
101
|
-
async function
|
|
102
|
-
if (
|
|
136
|
+
var A = /* @__PURE__ */ new Map();
|
|
137
|
+
async function j(e) {
|
|
138
|
+
if (A.has(e) || typeof Image > "u") return;
|
|
103
139
|
let t = new Image();
|
|
104
|
-
t.src = e, await t.decode(),
|
|
140
|
+
t.src = e, await t.decode(), A.set(e, t);
|
|
105
141
|
}
|
|
106
|
-
var
|
|
107
|
-
function
|
|
108
|
-
|
|
142
|
+
var M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new Map();
|
|
143
|
+
function P(e) {
|
|
144
|
+
M.set(e, performance.now());
|
|
109
145
|
}
|
|
110
|
-
var
|
|
146
|
+
var F = (e) => [
|
|
111
147
|
e.field,
|
|
112
|
-
e.
|
|
113
|
-
|
|
148
|
+
e.rim,
|
|
149
|
+
e.light,
|
|
150
|
+
...Object.values(e.capsule?.planes ?? {}).flat(),
|
|
151
|
+
...Object.values(e.nine?.planes ?? {}).flat()
|
|
114
152
|
];
|
|
115
|
-
function
|
|
116
|
-
|
|
153
|
+
function I(e) {
|
|
154
|
+
return o && e.nine ? Object.values(e.nine.planes).flat() : [
|
|
155
|
+
e.field,
|
|
156
|
+
e.rim,
|
|
157
|
+
e.light,
|
|
158
|
+
...Object.values(e.capsule?.planes ?? {}).flat()
|
|
159
|
+
];
|
|
117
160
|
}
|
|
118
|
-
function
|
|
119
|
-
let e
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
161
|
+
function L(e) {
|
|
162
|
+
for (let t of F(e)) c(t), A.delete(t);
|
|
163
|
+
}
|
|
164
|
+
var R = (e) => F(e).reduce((e, t) => {
|
|
165
|
+
let n = A.get(t);
|
|
166
|
+
return e + (n ? n.naturalWidth * n.naturalHeight * 4 : 0);
|
|
167
|
+
}, 0), z = 64, B = 100663296;
|
|
168
|
+
function V() {
|
|
169
|
+
let e = performance.now(), t = 0;
|
|
170
|
+
for (let e of N.values()) t += R(e);
|
|
171
|
+
for (let [n, r] of N) {
|
|
172
|
+
if (v.size <= z && t <= B) break;
|
|
173
|
+
e - (M.get(r) ?? 0) < 1e4 || (t -= R(r), v.delete(n), N.delete(n), L(r));
|
|
123
174
|
}
|
|
124
175
|
}
|
|
125
|
-
function
|
|
176
|
+
function H() {
|
|
126
177
|
let e = performance.now();
|
|
127
|
-
for (let t of
|
|
128
|
-
|
|
178
|
+
for (let t of N.values()) e - (M.get(t) ?? 0) >= 1e4 && L(t);
|
|
179
|
+
N.clear(), v.clear();
|
|
129
180
|
}
|
|
130
|
-
|
|
131
|
-
export { j as clearMaterialMapCache, w as decode, m as getMaterialMaps, h as getSurfaceMaterialMaps, _ as peekMaterialMaps, g as peekSurfaceMaterialMaps, D as touchMaps };
|
|
181
|
+
export { H as clearMaterialMapCache, j as decode, I as drawnMapUrls, x as getMaterialMaps, S as getSurfaceMaterialMaps, w as peekMaterialMaps, C as peekSurfaceMaterialMaps, P as touchMaps, b as warmMapPipeline };
|
|
@@ -1,38 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
return {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { glassRecipe as e, shadowReach as t } from "../core/materials.js";
|
|
2
|
+
// src/dom/material-graph.ts
|
|
3
|
+
var n = "var(--lg-backdrop, transparent)";
|
|
4
|
+
function r(e) {
|
|
5
|
+
let t = e.trim().toLowerCase();
|
|
6
|
+
return !(t === "" || t === "transparent" || /^rgba\((?:[^,()]*,){3}\s*0(?:\.0*)?\s*\)$/.test(t) || /\/\s*0(?:\.0*)?%?\s*\)$/.test(t));
|
|
7
|
+
}
|
|
8
|
+
function i(e, t) {
|
|
9
|
+
return `<feFlood style="flood-color:${n}" x="${t.x}" y="${t.y}" width="${t.width}" height="${t.height}" result="${e}"/>`;
|
|
10
|
+
}
|
|
11
|
+
function a(t, n, r, i, a = 1) {
|
|
12
|
+
let o = e(r, i).blur * a;
|
|
13
|
+
return o < .05 ? {
|
|
14
|
+
markup: "",
|
|
15
|
+
result: n
|
|
16
|
+
} : {
|
|
17
|
+
markup: `<feGaussianBlur in="${n}" stdDeviation="${o}" result="${t}mix"/>`,
|
|
18
|
+
result: `${t}mix`
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var o = 1.2, s = 2, c = .5, l = 12;
|
|
22
|
+
function u(e, t, n, r = 0) {
|
|
23
|
+
let i = (e, t, n, r) => `<feDisplacementMap in="${e}" in2="${t}" scale="${n}" xChannelSelector="R" yChannelSelector="G" result="${r}"/>`;
|
|
24
|
+
if (!(r >= .05)) return i(t, `${e}field`, n * 2, `${e}refracted`);
|
|
25
|
+
let a = (e, t, n) => `<feColorMatrix in="${e}" type="matrix" values="${[
|
|
26
|
+
...[
|
|
27
|
+
0,
|
|
28
|
+
1,
|
|
29
|
+
2
|
|
30
|
+
].map((e) => e === t ? [
|
|
31
|
+
+(e === 0),
|
|
32
|
+
+(e === 1),
|
|
33
|
+
+(e === 2),
|
|
34
|
+
0,
|
|
35
|
+
0
|
|
36
|
+
] : [
|
|
37
|
+
0,
|
|
38
|
+
0,
|
|
39
|
+
0,
|
|
40
|
+
0,
|
|
41
|
+
0
|
|
42
|
+
]).flat(),
|
|
43
|
+
0,
|
|
44
|
+
0,
|
|
45
|
+
0,
|
|
46
|
+
1,
|
|
47
|
+
0
|
|
48
|
+
].join(" ")}" result="${n}"/>`, u = r * o, d = r * s, f = n + d, p = (t, r) => `<feComposite in="${e}field" in2="${t}" operator="arithmetic" k1="0" k2="${n / f}" k3="${d / f}" k4="0" result="${r}"/>`, m = l;
|
|
49
|
+
return `<feGaussianBlur in="${e}field" stdDeviation="${u}" result="${e}fringeOut"/><feComponentTransfer in="${e}fringeOut" result="${e}fringeIn"><feFuncR type="table" tableValues="1 0"/><feFuncG type="table" tableValues="1 0"/></feComponentTransfer>` + p(`${e}fringeOut`, `${e}redField`) + p(`${e}fringeIn`, `${e}blueField`) + `<feGaussianBlur in="${t}" stdDeviation="${c}" result="${e}fringeSoft"/>` + i(`${e}fringeSoft`, `${e}redField`, f * 2, `${e}bentR`) + i(`${e}fringeSoft`, `${e}field`, n * 2, `${e}bent`) + i(`${e}fringeSoft`, `${e}blueField`, f * 2, `${e}bentB`) + a(`${e}bentR`, 0, `${e}red`) + a(`${e}bent`, 1, `${e}green`) + a(`${e}bentB`, 2, `${e}blue`) + `<feComposite in="${e}red" in2="${e}green" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="${e}redGreen"/><feComposite in="${e}redGreen" in2="${e}blue" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="${e}parted"/><feComponentTransfer in="${e}fringeOut" result="${e}bend"><feFuncR type="table" tableValues="1 0 1"/><feFuncG type="table" tableValues="1 0 1"/></feComponentTransfer><feColorMatrix in="${e}fringeBend" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${m} ${m} 0 0 0" result="${e}fringeBand"/><feComposite in="${e}parted" in2="${e}fringeBand" operator="in" result="${e}fringeLit"/><feComposite in="${t}" in2="${e}fringeBand" operator="out" result="${e}fringeRest"/><feComposite in="${e}fringeLit" in2="${e}fringeRest" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="${e}refracted"/>`;
|
|
50
|
+
}
|
|
51
|
+
function d(t, n, r, i, a, o = 1, s) {
|
|
52
|
+
let { blur: c, fill: l, fillBlend: u } = e(i, a);
|
|
53
|
+
if (!l || !u.amount) return {
|
|
54
|
+
markup: "",
|
|
55
|
+
result: n
|
|
56
|
+
};
|
|
57
|
+
let d = u.amount, f = u.cover, p = s && Math.abs(l - c) < .01, m = p ? s : `${t}fill`, h = [
|
|
58
|
+
...p ? [] : [`<feGaussianBlur in="${r}" stdDeviation="${l * o}" result="${t}fill"/>`],
|
|
59
|
+
`<feBlend in="${n}" in2="${m}" mode="${u.mode}" result="${t}blend"/>`,
|
|
60
|
+
`<feComposite in="${t}blend" in2="${n}" operator="arithmetic" k1="0" k2="${d * (1 - f)}" k3="${(1 - d) * (1 - f)}" k4="0" result="${t}blended"/>`
|
|
61
|
+
];
|
|
62
|
+
return f > 0 && h.push(`<feComposite in="${t}blended" in2="${m}" operator="arithmetic" k1="0" k2="1" k3="${f}" k4="0" result="${t}covered"/>`), {
|
|
63
|
+
markup: h.join(""),
|
|
64
|
+
result: f > 0 ? `${t}covered` : `${t}blended`
|
|
9
65
|
};
|
|
10
66
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
67
|
+
var f = .551;
|
|
68
|
+
function p(t, n, r, i = `${t}refracted`) {
|
|
69
|
+
let { saturation: a, tone: o } = e(n, r), [s, c, l] = o;
|
|
70
|
+
if (a === 1 && s === 0 && l === 1 && Math.abs(c - f) < .001) return `<feOffset in="${i}" result="${t}color"/>`;
|
|
71
|
+
let u = f, d = (c - s - (l - s) * u) / (u * u - u), p = l - s - d, m = 0, h = Array.from({ length: 33 }, (e, t) => {
|
|
72
|
+
let n = t / 32;
|
|
73
|
+
return m = Math.max(m, Math.min(1, s + p * n + d * n * n)), m;
|
|
74
|
+
}).map((e, t) => {
|
|
75
|
+
let n = t / 32, r = n === 0 ? p : (e - s) / n;
|
|
76
|
+
return Math.max(0, Math.min(1, r));
|
|
77
|
+
}).join(" "), g = "0.2126 0.7152 0.0722 0 0";
|
|
78
|
+
if (Math.abs(d) < .001) {
|
|
79
|
+
let e = [
|
|
80
|
+
"R",
|
|
81
|
+
"G",
|
|
82
|
+
"B"
|
|
83
|
+
].map((e) => `<feFunc${e} type="linear" slope="${p}" intercept="${s}"/>`).join("");
|
|
84
|
+
return (a === 1 ? "" : `<feColorMatrix in="${i}" type="saturate" values="${a}" result="${t}saturated"/>`) + `<feComponentTransfer in="${a === 1 ? i : `${t}saturated`}" result="${t}color">${e}</feComponentTransfer>`;
|
|
18
85
|
}
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
return Math.max(0, Math.min(1, (1 - l) * s + l * c + u));
|
|
22
|
-
}).join(" ");
|
|
23
|
-
return `<feComponentTransfer in="${n}refracted" result="${n}color"><feFuncR type="table" tableValues="${o}"/><feFuncG type="table" tableValues="${o}"/><feFuncB type="table" tableValues="${o}"/></feComponentTransfer>`;
|
|
86
|
+
let _ = a === 1 ? i : `${t}saturated`;
|
|
87
|
+
return (a === 1 ? "" : `<feColorMatrix in="${i}" type="saturate" values="${a}" result="${t}saturated"/>`) + `<feColorMatrix in="${_}" type="matrix" values="${g} ${g} ${g} 0 0 0 0 1" result="${t}luminance"/><feComponentTransfer in="${t}luminance" result="${t}gain"><feFuncR type="table" tableValues="${h}"/><feFuncG type="table" tableValues="${h}"/><feFuncB type="table" tableValues="${h}"/></feComponentTransfer><feComposite in="${_}" in2="${t}gain" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" result="${t}scaled"/><feComponentTransfer in="${t}scaled" result="${t}color"><feFuncR type="linear" slope="1" intercept="${s}"/><feFuncG type="linear" slope="1" intercept="${s}"/><feFuncB type="linear" slope="1" intercept="${s}"/></feComponentTransfer>`;
|
|
24
88
|
}
|
|
25
|
-
function
|
|
89
|
+
function m(e) {
|
|
26
90
|
return e.tint && /^#[\da-f]{6}$/i.test(e.tint) ? [
|
|
27
91
|
1,
|
|
28
92
|
3,
|
|
29
93
|
5
|
|
30
94
|
].map((t) => parseInt(e.tint.slice(t, t + 2), 16) / 255) : void 0;
|
|
31
95
|
}
|
|
32
|
-
function
|
|
96
|
+
function h(e, t, n) {
|
|
33
97
|
let r = t.material === "regular" ? .78 : .68;
|
|
34
98
|
return {
|
|
35
|
-
markup: `<feColorMatrix in="${e}color" type="saturate" values="0" result="${e}
|
|
99
|
+
markup: `<feColorMatrix in="${e}color" type="saturate" values="0" result="${e}tintLuminance"/><feComponentTransfer in="${e}tintLuminance" result="${e}tinted">${[
|
|
36
100
|
"R",
|
|
37
101
|
"G",
|
|
38
102
|
"B"
|
|
@@ -40,13 +104,28 @@ function a(e, t, n) {
|
|
|
40
104
|
color: `${e}tinted`
|
|
41
105
|
};
|
|
42
106
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
107
|
+
function g(e, t, n, r = 1, i = {
|
|
108
|
+
base: 1.5,
|
|
109
|
+
slope: -1
|
|
110
|
+
}) {
|
|
111
|
+
return `<feColorMatrix in="${t}" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2126 0.7152 0.0722 0 0" result="${e}lum"/><feComposite in="${n}" in2="${e}lum" operator="arithmetic" k1="${i.slope * r}" k2="${i.base * r}" k3="0" k4="0" result="${e}outline"/>`;
|
|
112
|
+
}
|
|
113
|
+
function _(e, t, n, r, i = "regular") {
|
|
114
|
+
let a = i !== "regular";
|
|
115
|
+
return `<feComposite in="${t}" in2="${n}" operator="arithmetic" k1="${a ? 1.445 : 0}" k2="1" k3="${a ? .82 : 1}" k4="0" result="${e}lit"/><feComposite in="${e}lit" in2="${r}" operator="in" result="${e}litInside"/>`;
|
|
116
|
+
}
|
|
117
|
+
function v(e, t, n) {
|
|
118
|
+
return `<feComponentTransfer in="${e}" result="${t}">${[
|
|
46
119
|
"R",
|
|
47
120
|
"G",
|
|
48
121
|
"B"
|
|
49
|
-
].map((e, t) => `<feFunc${e} type="linear" slope="${
|
|
122
|
+
].map((e, t) => `<feFunc${e} type="linear" slope="${.45 + .55 * n[t]}"/>`).join("")}</feComponentTransfer>`;
|
|
123
|
+
}
|
|
124
|
+
function y(e, n, r, i, a) {
|
|
125
|
+
let o = t(a), s = `x="${r.x - o}" y="${r.y - o}" width="${r.width + 2 * o}" height="${r.height + 2 * o}"`, c = a.opacity * i;
|
|
126
|
+
return {
|
|
127
|
+
markup: `<feGaussianBlur in="${n}" stdDeviation="${a.blur}" ${s} result="${e}shadowBlur"/><feOffset in="${e}shadowBlur" dy="${a.dy}" ${s} result="${e}shadowOffset"/><feComposite in="${e}shadowOffset" in2="${n}" operator="out" ${s} result="${e}shadowOut"/><feColorMatrix in="${e}shadowOut" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${c} 0" ${s} result="${e}shadow"/>`,
|
|
128
|
+
result: `${e}shadow`
|
|
129
|
+
};
|
|
50
130
|
}
|
|
51
|
-
|
|
52
|
-
export { n as frostMarkup, o as overlayTintMarkup, i as tintChannels, a as tintMarkup, r as toneMarkup };
|
|
131
|
+
export { n as backdropColor, i as backdropMarkup, d as fillMarkup, a as frostMarkup, y as glassShadowMarkup, r as hasBackdrop, _ as lightMarkup, g as outlineMarkup, v as overlayTintMarkup, u as refractMarkup, m as tintChannels, h as tintMarkup, p as toneMarkup };
|