@zakisheriff/liquid-glass 0.2.2 → 0.2.4
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/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/index.css +54 -41
- package/dist/index.css.map +1 -1
- package/dist/index.js +164 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +151 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -540,7 +540,6 @@ function bake(width, height, radius, shape, pad = 0, simple = false) {
|
|
|
540
540
|
const rimA = new Float32Array(cw * ch);
|
|
541
541
|
const rimHue = new Float32Array(cw * ch);
|
|
542
542
|
const inside = new Float32Array(cw * ch);
|
|
543
|
-
const depth = new Float32Array(cw * ch);
|
|
544
543
|
let max = 1e-4;
|
|
545
544
|
const hw = width / 2;
|
|
546
545
|
const hh = height / 2;
|
|
@@ -580,15 +579,13 @@ function bake(width, height, radius, shape, pad = 0, simple = false) {
|
|
|
580
579
|
const m = Math.max(Math.abs(vx), Math.abs(vy));
|
|
581
580
|
if (m > max) max = m;
|
|
582
581
|
inside[i] = clamp(d / px1 + 0.5, 0, 1);
|
|
583
|
-
const t = clamp(d / (shape.bezel * 0.9), 0, 1);
|
|
584
|
-
depth[i] = t * t * (3 - 2 * t);
|
|
585
582
|
if (d >= -px1) {
|
|
586
583
|
const facing = -(nx + ny) * Math.SQRT1_2;
|
|
587
584
|
const light = 0.22 + 0.78 * Math.abs(facing) ** 2.2 * (facing > 0 ? 1 : 0.62);
|
|
588
585
|
const line = Math.exp(-(((d - 0.55) / 0.55) ** 2));
|
|
589
|
-
const
|
|
586
|
+
const inner = Math.exp(-((d / (shape.bezel * 0.55)) ** 2)) * 0.14;
|
|
590
587
|
const edgeAA = clamp(d / px1 + 1, 0, 1);
|
|
591
|
-
rimA[i] = clamp((line * (lens ? 0.95 : 0.7) +
|
|
588
|
+
rimA[i] = clamp((line * (lens ? 0.95 : 0.7) + inner) * light * edgeAA, 0, 1);
|
|
592
589
|
rimHue[i] = Math.atan2(ny, nx);
|
|
593
590
|
}
|
|
594
591
|
}
|
|
@@ -653,9 +650,6 @@ function bake(width, height, radius, shape, pad = 0, simple = false) {
|
|
|
653
650
|
}
|
|
654
651
|
ctx.putImageData(shapeMask, 0, 0);
|
|
655
652
|
const mask = canvas.toDataURL();
|
|
656
|
-
for (let i = 0; i < cw * ch; i++) shapeMask.data[i * 4 + 3] = Math.round(depth[i] * 255);
|
|
657
|
-
ctx.putImageData(shapeMask, 0, 0);
|
|
658
|
-
const inner = canvas.toDataURL();
|
|
659
653
|
const id = `lg-refract-${++counter}`;
|
|
660
654
|
const box = { x: 0, y: 0, width: W, height: H };
|
|
661
655
|
const filter = el("filter", {
|
|
@@ -725,7 +719,7 @@ function bake(width, height, radius, shape, pad = 0, simple = false) {
|
|
|
725
719
|
el("feComposite", { in: "bent", in2: "shape", operator: "in" })
|
|
726
720
|
);
|
|
727
721
|
container().append(filter);
|
|
728
|
-
return { filter: `url(#${id})`, rim: `url("${rim}")`, inner: `url("${
|
|
722
|
+
return { filter: `url(#${id})`, rim: `url("${rim}")`, inner: `url("${mask}")` };
|
|
729
723
|
}
|
|
730
724
|
function resolve(shape, width, height) {
|
|
731
725
|
const kind = shape.kind ?? "surface";
|
|
@@ -928,15 +922,30 @@ GlassCard.displayName = "GlassCard";
|
|
|
928
922
|
|
|
929
923
|
// src/components/GlassInput/GlassInput.tsx
|
|
930
924
|
var import_react5 = __toESM(require("react"));
|
|
925
|
+
|
|
926
|
+
// src/components/internal/Symbol.tsx
|
|
931
927
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
]
|
|
928
|
+
function Symbol2({ source, size = 24, className, style, ...props }) {
|
|
929
|
+
const mask = `url("${source}")`;
|
|
930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
931
|
+
"span",
|
|
932
|
+
{
|
|
933
|
+
"aria-hidden": "true",
|
|
934
|
+
...props,
|
|
935
|
+
className: ["lg-symbol", className].filter(Boolean).join(" "),
|
|
936
|
+
style: { "--lg-symbol-size": `${size}px`, WebkitMaskImage: mask, maskImage: mask, ...style }
|
|
937
|
+
}
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// src/components/internal/inputSymbols.ts
|
|
942
|
+
var searchSymbol = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAAAXNSR0IArs4c6QAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAkKADAAQAAAABAAAAkAAAAAAc9yiyAAALUklEQVR4Ae1da8wdVRX9wFpoy1OEQgX7lQKhAhUKsYaH1FSglAQh+A6pEIjxSZQQ1ComxiAB4wMCASHQoKHKH16REEiRKgRpDZBYKI8i/VpQngWkQMtT1zK9YfLl3tl7HmfumTNrJ6t3vjn7nLP3mn3nnDlnz+3IiEQMiAExIAbEgBgQA2JADIgBMSAGxIAYEANiQAyIATEgBsSAGBADYkAMiAExIAbEgBgQA2JADIgBMSAGxIAYEANiQAyIATEgBsRARxnYKmG/d4dvs4GZwCiwG/AhYBIwEXgHeBN4BXgBeAp4ElgNrAHeAyQdYmAv+Ho6cB3wDPDfCngdde8AzgXmAFsDkgQZ2AM+8SI/BFQJGKsu71CXAocCkgQYWAAf/gRwGLIuft3l/0Cf3wE4FEpaxsBC2LsCqDsoyrT3LOw4G5gMSCJn4DDYdx9Q5kKHrsNAOgNI+YEE7rVTtoPZvwGGMVQVDby/wM5Z7aQ5Tas/DbfWA0Uv5DD1uSywGNDdCCQMS0j+D4A23HUGBeutsJ9rTslLbN+UHcH474ATa2J+DO08AjwKPAH8B9gIvAZsC2wP7ABwDWn/DD6I46oyhg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+jxAx4z+nc6oZCuglJqBoO5AS3fYe4ruTX3VrPeZe2Me674PTtZ1Uy4ig9mHdn0EfOzpWzNXkO4/Qw1SrjmWre01EQXYivQDdJwtzqg4rcaOUc0Kx9vzc9W6lY7O/lzLFZfwoAWuuZl+g5DMzfwbuYJONYM5/0+5soaH3KyD3nlxb+5rvW9cdGbSLRLPnl4DaOjGXv8pr6txURTsJzczoyuwXJqKJO5EyDHTuaDaCAYnIRqLxI7HSQpRfZLYAAzqc2TnR/4voLnjRCbOZAwM6sdacTq5zjNLaVXLc8Q68WZEhBnSs7/vNxl/DwcohXuyrBwO6Y93XaY9zib3J7/agzIoOM6CT6z5NwN5GvKcMk2Df2zOgVJCu5xPp7zXHPQ7UnkGrYUZJaZ8FXUuP3UJML7b+TceAcqy7kKivy/OzwZJ01FlLgwxs4MtmUNql9yR/7sbnj4Iof0FJvWaeDOgJWD1GXfqhTW+Kfy/QodisQAaW49P7wTyYNAqk+l2Tn5qiORXYZTkk1GC6m608I91LuQ6kEkvTjtItLgVvAHomvtMmsrtuRxHgiUCHOmEFCGnbqUxvArsC/AzMgntAL6wPAhruSJ2DrAHHgMPASrAMKD1Uv+mqSG/VULamZsElkDvBrUBzU7rsngMa3a4G1wIdqsyMAWPAGDAGjAFjwBgwBowBY8AYMAaMAWPAGDAGjAFjwBgwBowBY8AYMAaMAWPAGDAGjAFjwBgwBowBY8AYMAaMAWPAGDAGpmLgv14OpyS3UH6uAAAAAElFTkSuQmCC";
|
|
944
|
+
|
|
945
|
+
// src/components/GlassInput/GlassInput.tsx
|
|
946
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
947
|
+
var Magnifier = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Symbol2, { source: searchSymbol, size: 20 });
|
|
948
|
+
var ClearGlyph = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Symbol2, { source: clearSymbol, size: 20 });
|
|
940
949
|
var GlassInput = import_react5.default.forwardRef(
|
|
941
950
|
({ intensity = 5, tint, label: label2, icon, trailing, onClear, className, style, value, onChange, type = "text", disabled, onFocus, onBlur, ...rest }, forwardedRef) => {
|
|
942
951
|
const fieldRef = (0, import_react5.useRef)(null);
|
|
@@ -958,17 +967,17 @@ var GlassInput = import_react5.default.forwardRef(
|
|
|
958
967
|
}
|
|
959
968
|
inputRef.current?.focus();
|
|
960
969
|
};
|
|
961
|
-
return /* @__PURE__ */ (0,
|
|
970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
962
971
|
"label",
|
|
963
972
|
{
|
|
964
973
|
className: ["lg-input", className].filter(Boolean).join(" "),
|
|
965
974
|
"data-liquid-glass": "",
|
|
966
975
|
style: tint ? { "--lg-input-tint": tint, ...style } : style,
|
|
967
976
|
children: [
|
|
968
|
-
label2 && /* @__PURE__ */ (0,
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
970
|
-
leading && /* @__PURE__ */ (0,
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
977
|
+
label2 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lg-input__label", children: label2 }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: fieldRef, className: "lg-glass lg-input__field", "data-focused": focused ? "" : void 0, children: [
|
|
979
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lg-input__icon", children: leading }),
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
972
981
|
"input",
|
|
973
982
|
{
|
|
974
983
|
ref: inputRef,
|
|
@@ -990,7 +999,7 @@ var GlassInput = import_react5.default.forwardRef(
|
|
|
990
999
|
...rest
|
|
991
1000
|
}
|
|
992
1001
|
),
|
|
993
|
-
current && !disabled ? /* @__PURE__ */ (0,
|
|
1002
|
+
current && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
994
1003
|
"button",
|
|
995
1004
|
{
|
|
996
1005
|
type: "button",
|
|
@@ -1000,7 +1009,7 @@ var GlassInput = import_react5.default.forwardRef(
|
|
|
1000
1009
|
onClick: clear,
|
|
1001
1010
|
children: ClearGlyph
|
|
1002
1011
|
}
|
|
1003
|
-
) : trailing && /* @__PURE__ */ (0,
|
|
1012
|
+
) : trailing && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lg-input__icon lg-input__trailing", children: trailing })
|
|
1004
1013
|
] })
|
|
1005
1014
|
]
|
|
1006
1015
|
}
|
|
@@ -1012,7 +1021,7 @@ GlassInput.displayName = "GlassInput";
|
|
|
1012
1021
|
// src/components/GlassSheet/GlassSheet.tsx
|
|
1013
1022
|
var import_react6 = require("react");
|
|
1014
1023
|
var import_react_dom = require("react-dom");
|
|
1015
|
-
var
|
|
1024
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1016
1025
|
var OPEN = springFrom(0.42, 0.86);
|
|
1017
1026
|
var CLOSE = springFrom(0.34, 1);
|
|
1018
1027
|
var GlassSheet = ({ open, onClose, intensity = 5, tint, children, "aria-label": ariaLabel }) => {
|
|
@@ -1113,9 +1122,9 @@ var GlassSheet = ({ open, onClose, intensity = 5, tint, children, "aria-label":
|
|
|
1113
1122
|
}, [mounted]);
|
|
1114
1123
|
if (!mounted || typeof document === "undefined") return null;
|
|
1115
1124
|
return (0, import_react_dom.createPortal)(
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
1117
|
-
/* @__PURE__ */ (0,
|
|
1118
|
-
/* @__PURE__ */ (0,
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "lg-sheet-layer", "data-liquid-glass": "", children: [
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: scrimRef, className: "lg-sheet__scrim", onClick: () => onClose?.(), "aria-hidden": "true" }),
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1119
1128
|
"div",
|
|
1120
1129
|
{
|
|
1121
1130
|
ref: sheetRef,
|
|
@@ -1126,8 +1135,8 @@ var GlassSheet = ({ open, onClose, intensity = 5, tint, children, "aria-label":
|
|
|
1126
1135
|
className: "lg-glass lg-glass--host lg-sheet",
|
|
1127
1136
|
style: tint ? { "--lg-host-tint": tint } : void 0,
|
|
1128
1137
|
children: [
|
|
1129
|
-
/* @__PURE__ */ (0,
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "lg-sheet__grabber-zone", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "lg-sheet__grabber" }) }),
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "lg-sheet__content", children })
|
|
1131
1140
|
]
|
|
1132
1141
|
}
|
|
1133
1142
|
)
|
|
@@ -1152,44 +1161,84 @@ function useLensTrack(refs, options) {
|
|
|
1152
1161
|
(0, import_react7.useEffect)(() => {
|
|
1153
1162
|
const bar = refs.bar.current;
|
|
1154
1163
|
const lens = refs.lens.current;
|
|
1155
|
-
const tint = refs.tint.current;
|
|
1156
|
-
const row = refs.row.current;
|
|
1157
1164
|
const glass = refs.glass.current;
|
|
1158
|
-
|
|
1165
|
+
const select = refs.select.current;
|
|
1166
|
+
if (!bar || !lens || !glass || !select) return;
|
|
1159
1167
|
let slot = 0;
|
|
1160
1168
|
let height = 0;
|
|
1161
1169
|
let pad = 0;
|
|
1162
|
-
let
|
|
1170
|
+
let W = 0;
|
|
1171
|
+
let H = 0;
|
|
1163
1172
|
const state = { x: 0, lift: 0, swell: 0, squash: 0 };
|
|
1164
1173
|
let current = latest.current.index;
|
|
1165
1174
|
let gesture = null;
|
|
1166
1175
|
let suppressClick = false;
|
|
1176
|
+
const buttons = Array.from(bar.querySelectorAll("[data-lg-item]"));
|
|
1177
|
+
let glyphs = [];
|
|
1178
|
+
const preview = (index) => {
|
|
1179
|
+
if (index === void 0) delete bar.dataset.previewing;
|
|
1180
|
+
else bar.dataset.previewing = "";
|
|
1181
|
+
buttons.forEach((button, i) => button.toggleAttribute("data-lg-preview", i === index));
|
|
1182
|
+
};
|
|
1167
1183
|
const measure = () => {
|
|
1168
1184
|
const style = getComputedStyle(bar);
|
|
1169
1185
|
pad = parseFloat(style.paddingLeft) || 0;
|
|
1170
1186
|
slot = (bar.clientWidth - pad - (parseFloat(style.paddingRight) || 0)) / latest.current.count;
|
|
1171
|
-
height =
|
|
1172
|
-
|
|
1187
|
+
height = bar.clientHeight - (parseFloat(style.paddingTop) || 0) - (parseFloat(style.paddingBottom) || 0);
|
|
1188
|
+
const { overhang, spread } = latest.current;
|
|
1189
|
+
W = Math.round(slot * (1 + spread));
|
|
1190
|
+
H = Math.round(bar.offsetHeight + overhang);
|
|
1191
|
+
lens.style.width = `${W}px`;
|
|
1192
|
+
lens.style.height = `${H}px`;
|
|
1193
|
+
lens.style.left = `${pad + (slot - W) / 2}px`;
|
|
1194
|
+
lens.style.top = `${pad + (height - H) / 2}px`;
|
|
1195
|
+
select.style.width = `${slot}px`;
|
|
1196
|
+
glyphs = buttons.flatMap(
|
|
1197
|
+
(button) => Array.from(button.querySelectorAll(".lg-nav__label, .lg-nav__icon > .lg-symbol")).map((node) => ({
|
|
1198
|
+
node,
|
|
1199
|
+
x: button.offsetLeft + node.offsetLeft - pad,
|
|
1200
|
+
y: node.offsetTop + node.offsetHeight / 2,
|
|
1201
|
+
width: node.offsetWidth,
|
|
1202
|
+
label: node.classList.contains("lg-nav__label")
|
|
1203
|
+
}))
|
|
1204
|
+
);
|
|
1173
1205
|
};
|
|
1174
1206
|
const paint = () => {
|
|
1175
|
-
const { x: x2,
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
const
|
|
1179
|
-
const
|
|
1180
|
-
const transform = `translateX(${x2}px) scale(${
|
|
1207
|
+
const { x: x2, swell: swell2, squash } = state;
|
|
1208
|
+
const lift2 = clamp(state.lift, 0, 1.08);
|
|
1209
|
+
if (!W || !H) return;
|
|
1210
|
+
const kx = (slot + (W - slot) * lift2) / W * (1 + squash);
|
|
1211
|
+
const ky = (height + (H - height) * lift2) / H * (1 - squash * 0.6);
|
|
1212
|
+
const transform = `translateX(${x2}px) scale(${kx}, ${ky})`;
|
|
1181
1213
|
lens.style.transform = transform;
|
|
1182
|
-
|
|
1183
|
-
|
|
1214
|
+
select.style.transform = `translateX(${x2}px)`;
|
|
1215
|
+
lens.style.opacity = String(clamp(lift2 * 4, 0, 1));
|
|
1184
1216
|
const grow = 1 + latest.current.swell / Math.max(bar.offsetWidth, 1) * swell2;
|
|
1185
1217
|
bar.style.scale = `${grow}`;
|
|
1186
1218
|
lens.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
|
|
1187
1219
|
bar.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
|
|
1220
|
+
for (const glyph of glyphs) {
|
|
1221
|
+
if (lift2 <= 0.02 && !gesture) {
|
|
1222
|
+
glyph.node.style.removeProperty("--lg-content-tint");
|
|
1223
|
+
glyph.node.style.removeProperty("transform");
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1226
|
+
const ry = H * ky / 2;
|
|
1227
|
+
const dy = clamp(Math.abs(glyph.y - height / 2) / ry, 0, 1);
|
|
1228
|
+
const half = Math.max(0, (W - H) * kx / 2) + H * kx / 2 * Math.sqrt(1 - dy * dy);
|
|
1229
|
+
const from = x2 + slot / 2 - half - glyph.x;
|
|
1230
|
+
const to = x2 + slot / 2 + half - glyph.x;
|
|
1231
|
+
const normal = "var(--lg-fg)";
|
|
1232
|
+
const active2 = "var(--lg-track-active, var(--lg-accent))";
|
|
1233
|
+
glyph.node.style.setProperty("--lg-content-tint", `linear-gradient(90deg, ${normal} ${from}px, ${active2} ${from}px, ${active2} ${to}px, ${normal} ${to}px)`);
|
|
1234
|
+
const coverage = clamp((Math.min(glyph.width, to) - Math.max(0, from)) / Math.max(1, glyph.width), 0, 1);
|
|
1235
|
+
glyph.node.style.transform = `scale(${1 + clamp(lift2, 0, 1) * coverage * (glyph.label ? 0.035 : 0.08)})`;
|
|
1236
|
+
}
|
|
1188
1237
|
if (!gesture && lift2 < 0.02) delete bar.dataset.lifted;
|
|
1189
1238
|
};
|
|
1190
1239
|
const x = createSpring(current * slot, SPRINGS.snap, (value, velocity) => {
|
|
1191
1240
|
state.x = value;
|
|
1192
|
-
state.squash = clamp(Math.abs(velocity) /
|
|
1241
|
+
state.squash = clamp(Math.abs(velocity) / 6e3, 0, 0.08);
|
|
1193
1242
|
paint();
|
|
1194
1243
|
});
|
|
1195
1244
|
const lift = createSpring(0, SPRINGS.lift, (value) => {
|
|
@@ -1209,7 +1258,7 @@ function useLensTrack(refs, options) {
|
|
|
1209
1258
|
};
|
|
1210
1259
|
const position = (clientX) => {
|
|
1211
1260
|
if (!gesture) return 0;
|
|
1212
|
-
const raw = gesture.anchor + clientX - gesture.startX;
|
|
1261
|
+
const raw = gesture.anchor + (clientX - gesture.startX) * bar.offsetWidth / Math.max(1, gesture.box.width);
|
|
1213
1262
|
const max = slot * (latest.current.count - 1);
|
|
1214
1263
|
const give = Math.min(14, slot * 0.12);
|
|
1215
1264
|
if (raw < 0) return rubberband(raw, give, 0.55);
|
|
@@ -1233,6 +1282,7 @@ function useLensTrack(refs, options) {
|
|
|
1233
1282
|
gesture = { id: event.pointerId, startX: event.clientX, anchor: index * slot, moved: false, box, hovered: index };
|
|
1234
1283
|
suppressClick = false;
|
|
1235
1284
|
bar.dataset.lifted = "";
|
|
1285
|
+
preview(index);
|
|
1236
1286
|
lens.dataset.pressed = "";
|
|
1237
1287
|
light(event.clientX, box);
|
|
1238
1288
|
haptic();
|
|
@@ -1242,6 +1292,7 @@ function useLensTrack(refs, options) {
|
|
|
1242
1292
|
swell.set(1);
|
|
1243
1293
|
x.tune(SPRINGS.snap);
|
|
1244
1294
|
x.set(index * slot);
|
|
1295
|
+
paint();
|
|
1245
1296
|
};
|
|
1246
1297
|
const onMove = (event) => {
|
|
1247
1298
|
if (event.pointerId !== gesture?.id) return;
|
|
@@ -1260,6 +1311,7 @@ function useLensTrack(refs, options) {
|
|
|
1260
1311
|
const hovered = clamp(Math.round(at / slot), 0, latest.current.count - 1);
|
|
1261
1312
|
if (hovered !== gesture.hovered) {
|
|
1262
1313
|
gesture.hovered = hovered;
|
|
1314
|
+
preview(hovered);
|
|
1263
1315
|
haptic();
|
|
1264
1316
|
}
|
|
1265
1317
|
};
|
|
@@ -1269,6 +1321,7 @@ function useLensTrack(refs, options) {
|
|
|
1269
1321
|
const at = moved ? position(event.clientX) : gesture.anchor;
|
|
1270
1322
|
const index = clamp(Math.round(at / slot), 0, latest.current.count - 1);
|
|
1271
1323
|
gesture = null;
|
|
1324
|
+
preview();
|
|
1272
1325
|
delete lens.dataset.pressed;
|
|
1273
1326
|
if (bar.hasPointerCapture?.(event.pointerId)) bar.releasePointerCapture(event.pointerId);
|
|
1274
1327
|
const inside = event.clientY >= box.top - 30 && event.clientY <= box.bottom + 30;
|
|
@@ -1288,6 +1341,20 @@ function useLensTrack(refs, options) {
|
|
|
1288
1341
|
};
|
|
1289
1342
|
const onUp = (event) => finish(event, true);
|
|
1290
1343
|
const onCancel = (event) => finish(event, false);
|
|
1344
|
+
const onBlur = () => {
|
|
1345
|
+
if (!gesture) return;
|
|
1346
|
+
const id = gesture.id;
|
|
1347
|
+
gesture = null;
|
|
1348
|
+
preview();
|
|
1349
|
+
delete lens.dataset.pressed;
|
|
1350
|
+
if (bar.hasPointerCapture(id)) bar.releasePointerCapture(id);
|
|
1351
|
+
lift.tune(SPRINGS.settle);
|
|
1352
|
+
lift.set(0);
|
|
1353
|
+
swell.tune(SPRINGS.release);
|
|
1354
|
+
swell.set(0);
|
|
1355
|
+
x.tune(SPRINGS.snap);
|
|
1356
|
+
x.set(current * slot);
|
|
1357
|
+
};
|
|
1291
1358
|
const onClick = (event) => {
|
|
1292
1359
|
if (suppressClick && event.detail !== 0) {
|
|
1293
1360
|
suppressClick = false;
|
|
@@ -1324,6 +1391,7 @@ function useLensTrack(refs, options) {
|
|
|
1324
1391
|
window.addEventListener("pointermove", onMove);
|
|
1325
1392
|
window.addEventListener("pointerup", onUp);
|
|
1326
1393
|
window.addEventListener("pointercancel", onCancel);
|
|
1394
|
+
window.addEventListener("blur", onBlur);
|
|
1327
1395
|
bar.addEventListener("click", onClick, true);
|
|
1328
1396
|
bar.addEventListener("keydown", onKey);
|
|
1329
1397
|
bar.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
@@ -1336,11 +1404,17 @@ function useLensTrack(refs, options) {
|
|
|
1336
1404
|
window.removeEventListener("pointermove", onMove);
|
|
1337
1405
|
window.removeEventListener("pointerup", onUp);
|
|
1338
1406
|
window.removeEventListener("pointercancel", onCancel);
|
|
1407
|
+
window.removeEventListener("blur", onBlur);
|
|
1339
1408
|
bar.removeEventListener("click", onClick, true);
|
|
1340
1409
|
bar.removeEventListener("keydown", onKey);
|
|
1341
1410
|
bar.removeEventListener("touchmove", onTouchMove);
|
|
1342
1411
|
delete bar.dataset.ready;
|
|
1343
1412
|
delete bar.dataset.lifted;
|
|
1413
|
+
preview();
|
|
1414
|
+
glyphs.forEach(({ node }) => {
|
|
1415
|
+
node.style.removeProperty("--lg-content-tint");
|
|
1416
|
+
node.style.removeProperty("transform");
|
|
1417
|
+
});
|
|
1344
1418
|
};
|
|
1345
1419
|
}, [options.count]);
|
|
1346
1420
|
(0, import_react7.useEffect)(() => {
|
|
@@ -1349,7 +1423,7 @@ function useLensTrack(refs, options) {
|
|
|
1349
1423
|
}
|
|
1350
1424
|
|
|
1351
1425
|
// src/components/internal/LensTrack.tsx
|
|
1352
|
-
var
|
|
1426
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1353
1427
|
function LensTrack({
|
|
1354
1428
|
items,
|
|
1355
1429
|
labels,
|
|
@@ -1364,14 +1438,13 @@ function LensTrack({
|
|
|
1364
1438
|
const bar = (0, import_react8.useRef)(null);
|
|
1365
1439
|
const glass = (0, import_react8.useRef)(null);
|
|
1366
1440
|
const lens = (0, import_react8.useRef)(null);
|
|
1367
|
-
const
|
|
1368
|
-
const row = (0, import_react8.useRef)(null);
|
|
1441
|
+
const select = (0, import_react8.useRef)(null);
|
|
1369
1442
|
const strength = Math.max(1, Math.min(10, intensity)) / 5;
|
|
1370
1443
|
useRefraction(glass, { kind: "surface", strength });
|
|
1371
1444
|
useRefraction(lens, { kind: "lens", strength, zoom: variant === "tabbar" ? 1.14 : 1.1 });
|
|
1372
1445
|
const tabbar = variant === "tabbar";
|
|
1373
1446
|
useLensTrack(
|
|
1374
|
-
{ bar, glass, lens,
|
|
1447
|
+
{ bar, glass, lens, select },
|
|
1375
1448
|
{
|
|
1376
1449
|
count: items.length,
|
|
1377
1450
|
index,
|
|
@@ -1381,7 +1454,7 @@ function LensTrack({
|
|
|
1381
1454
|
swell: tabbar ? 8 : 14
|
|
1382
1455
|
}
|
|
1383
1456
|
);
|
|
1384
|
-
return /* @__PURE__ */ (0,
|
|
1457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1385
1458
|
"div",
|
|
1386
1459
|
{
|
|
1387
1460
|
ref: bar,
|
|
@@ -1391,8 +1464,9 @@ function LensTrack({
|
|
|
1391
1464
|
"data-liquid-glass": "",
|
|
1392
1465
|
style: { ...style, "--lg-count": items.length, "--lg-index": index },
|
|
1393
1466
|
children: [
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref: glass, className: "lg-glass lg-track__glass", "aria-hidden": "true" }),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref: select, className: "lg-track__select", "aria-hidden": "true" }),
|
|
1469
|
+
items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1396
1470
|
"button",
|
|
1397
1471
|
{
|
|
1398
1472
|
type: "button",
|
|
@@ -1406,15 +1480,14 @@ function LensTrack({
|
|
|
1406
1480
|
},
|
|
1407
1481
|
i
|
|
1408
1482
|
)),
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1410
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { ref: lens, className: "lg-glass lg-track__lens", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "lg-track__pill" }) })
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref: lens, className: "lg-glass lg-track__lens", "aria-hidden": "true" })
|
|
1411
1484
|
]
|
|
1412
1485
|
}
|
|
1413
1486
|
);
|
|
1414
1487
|
}
|
|
1415
1488
|
|
|
1416
1489
|
// src/components/GlassNav/GlassNav.tsx
|
|
1417
|
-
var
|
|
1490
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1418
1491
|
var GlassNav = ({
|
|
1419
1492
|
items,
|
|
1420
1493
|
activeIndex = 0,
|
|
@@ -1425,7 +1498,7 @@ var GlassNav = ({
|
|
|
1425
1498
|
"aria-label": ariaLabel = "Tabs"
|
|
1426
1499
|
}) => {
|
|
1427
1500
|
const hasIcons = items.some((item) => item.icon != null);
|
|
1428
|
-
return /* @__PURE__ */ (0,
|
|
1501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1429
1502
|
LensTrack,
|
|
1430
1503
|
{
|
|
1431
1504
|
variant: "tabbar",
|
|
@@ -1436,9 +1509,9 @@ var GlassNav = ({
|
|
|
1436
1509
|
index: activeIndex,
|
|
1437
1510
|
onChange,
|
|
1438
1511
|
labels: items.map((item) => item.label),
|
|
1439
|
-
items: items.map((item, i) => /* @__PURE__ */ (0,
|
|
1440
|
-
item.icon != null && /* @__PURE__ */ (0,
|
|
1441
|
-
/* @__PURE__ */ (0,
|
|
1512
|
+
items: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react9.default.Fragment, { children: [
|
|
1513
|
+
item.icon != null && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "lg-nav__icon", children: item.icon }),
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "lg-nav__label", children: item.label })
|
|
1442
1515
|
] }, i))
|
|
1443
1516
|
}
|
|
1444
1517
|
);
|
|
@@ -1447,7 +1520,7 @@ GlassNav.displayName = "GlassNav";
|
|
|
1447
1520
|
|
|
1448
1521
|
// src/components/GlassSegmented/GlassSegmented.tsx
|
|
1449
1522
|
var import_react10 = __toESM(require("react"));
|
|
1450
|
-
var
|
|
1523
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1451
1524
|
var GlassSegmented = ({
|
|
1452
1525
|
options,
|
|
1453
1526
|
value,
|
|
@@ -1459,7 +1532,7 @@ var GlassSegmented = ({
|
|
|
1459
1532
|
"aria-label": ariaLabel
|
|
1460
1533
|
}) => {
|
|
1461
1534
|
const normalized = options.map((option) => typeof option === "string" ? { label: option } : option);
|
|
1462
|
-
return /* @__PURE__ */ (0,
|
|
1535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1463
1536
|
LensTrack,
|
|
1464
1537
|
{
|
|
1465
1538
|
variant: "segmented",
|
|
@@ -1470,9 +1543,9 @@ var GlassSegmented = ({
|
|
|
1470
1543
|
index: value,
|
|
1471
1544
|
onChange,
|
|
1472
1545
|
labels: normalized.map((option) => option.label),
|
|
1473
|
-
items: normalized.map((option, i) => /* @__PURE__ */ (0,
|
|
1546
|
+
items: normalized.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react10.default.Fragment, { children: [
|
|
1474
1547
|
option.icon,
|
|
1475
|
-
/* @__PURE__ */ (0,
|
|
1548
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: option.label })
|
|
1476
1549
|
] }, i))
|
|
1477
1550
|
}
|
|
1478
1551
|
);
|
|
@@ -1481,7 +1554,7 @@ GlassSegmented.displayName = "GlassSegmented";
|
|
|
1481
1554
|
|
|
1482
1555
|
// src/components/GlassSlider/GlassSlider.tsx
|
|
1483
1556
|
var import_react11 = __toESM(require("react"));
|
|
1484
|
-
var
|
|
1557
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1485
1558
|
var GlassSlider = import_react11.default.forwardRef(
|
|
1486
1559
|
({
|
|
1487
1560
|
value = 0,
|
|
@@ -1638,7 +1711,7 @@ var GlassSlider = import_react11.default.forwardRef(
|
|
|
1638
1711
|
window.removeEventListener("pointercancel", up);
|
|
1639
1712
|
};
|
|
1640
1713
|
}, [showThumb]);
|
|
1641
|
-
const input = /* @__PURE__ */ (0,
|
|
1714
|
+
const input = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1642
1715
|
"input",
|
|
1643
1716
|
{
|
|
1644
1717
|
ref: inputRef,
|
|
@@ -1658,7 +1731,7 @@ var GlassSlider = import_react11.default.forwardRef(
|
|
|
1658
1731
|
);
|
|
1659
1732
|
const vars = { "--lg-progress": progress, ...tint ? { "--lg-slider-fill": tint } : {}, ...style };
|
|
1660
1733
|
if (!showThumb) {
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
1734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1662
1735
|
"div",
|
|
1663
1736
|
{
|
|
1664
1737
|
ref: rootRef,
|
|
@@ -1666,16 +1739,16 @@ var GlassSlider = import_react11.default.forwardRef(
|
|
|
1666
1739
|
"data-liquid-glass": "",
|
|
1667
1740
|
style: vars,
|
|
1668
1741
|
children: [
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1671
|
-
icon && /* @__PURE__ */ (0,
|
|
1672
|
-
label2 && /* @__PURE__ */ (0,
|
|
1673
|
-
/* @__PURE__ */ (0,
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref: blockRef, className: "lg-glass lg-slider__block", children: [
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "lg-slider__block-content", "aria-hidden": "true", children: [
|
|
1744
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__icon", children: icon }),
|
|
1745
|
+
label2 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__label", children: label2 }),
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__value", children: Number(value) })
|
|
1674
1747
|
] }),
|
|
1675
|
-
/* @__PURE__ */ (0,
|
|
1676
|
-
icon && /* @__PURE__ */ (0,
|
|
1677
|
-
label2 && /* @__PURE__ */ (0,
|
|
1678
|
-
/* @__PURE__ */ (0,
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__block-fill", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "lg-slider__block-content lg-slider__block-content--lit", children: [
|
|
1749
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__icon", children: icon }),
|
|
1750
|
+
label2 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__label", children: label2 }),
|
|
1751
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__value", children: Number(value) })
|
|
1679
1752
|
] }) })
|
|
1680
1753
|
] }),
|
|
1681
1754
|
input
|
|
@@ -1683,7 +1756,7 @@ var GlassSlider = import_react11.default.forwardRef(
|
|
|
1683
1756
|
}
|
|
1684
1757
|
);
|
|
1685
1758
|
}
|
|
1686
|
-
return /* @__PURE__ */ (0,
|
|
1759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1687
1760
|
"div",
|
|
1688
1761
|
{
|
|
1689
1762
|
ref: rootRef,
|
|
@@ -1692,8 +1765,8 @@ var GlassSlider = import_react11.default.forwardRef(
|
|
|
1692
1765
|
"data-mirror": mirrored ? "" : void 0,
|
|
1693
1766
|
style: vars,
|
|
1694
1767
|
children: [
|
|
1695
|
-
/* @__PURE__ */ (0,
|
|
1696
|
-
/* @__PURE__ */ (0,
|
|
1768
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__rail", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__fill" }) }),
|
|
1769
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lg-slider__thumb-slot", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { ref: thumbRef, className: "lg-glass lg-slider__thumb", "data-lg-mirror-bare": "", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { ref: faceRef, className: "lg-slider__face" }) }) }),
|
|
1697
1770
|
input
|
|
1698
1771
|
]
|
|
1699
1772
|
}
|
|
@@ -1704,7 +1777,7 @@ GlassSlider.displayName = "GlassSlider";
|
|
|
1704
1777
|
|
|
1705
1778
|
// src/components/GlassSwitch/GlassSwitch.tsx
|
|
1706
1779
|
var import_react12 = __toESM(require("react"));
|
|
1707
|
-
var
|
|
1780
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1708
1781
|
var SETTLE = springFrom(0.36, 0.68);
|
|
1709
1782
|
var REST = 0.655;
|
|
1710
1783
|
var TRAVEL = 22;
|
|
@@ -1855,7 +1928,7 @@ var GlassSwitch = import_react12.default.forwardRef(
|
|
|
1855
1928
|
(0, import_react12.useEffect)(() => {
|
|
1856
1929
|
sync.current?.(checked);
|
|
1857
1930
|
}, [checked]);
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
1931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1859
1932
|
"button",
|
|
1860
1933
|
{
|
|
1861
1934
|
ref,
|
|
@@ -1872,8 +1945,8 @@ var GlassSwitch = import_react12.default.forwardRef(
|
|
|
1872
1945
|
rest.onKeyDown?.(event);
|
|
1873
1946
|
},
|
|
1874
1947
|
children: [
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1876
|
-
/* @__PURE__ */ (0,
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { ref: fillRef, className: "lg-switch__fill", "aria-hidden": "true" }),
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { ref: thumbRef, className: "lg-glass lg-switch__thumb", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { ref: faceRef, className: "lg-switch__face" }) })
|
|
1877
1950
|
]
|
|
1878
1951
|
}
|
|
1879
1952
|
);
|
|
@@ -1883,28 +1956,28 @@ GlassSwitch.displayName = "GlassSwitch";
|
|
|
1883
1956
|
|
|
1884
1957
|
// src/filters/LiquidGlassFilter.tsx
|
|
1885
1958
|
var import_react13 = require("react");
|
|
1886
|
-
var
|
|
1959
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1887
1960
|
var GlassFilterContext = (0, import_react13.createContext)(false);
|
|
1888
1961
|
function LiquidGlassFilter({ children }) {
|
|
1889
|
-
return /* @__PURE__ */ (0,
|
|
1890
|
-
/* @__PURE__ */ (0,
|
|
1962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(GlassFilterContext.Provider, { value: true, children: [
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GlassFilterSVG, {}),
|
|
1891
1964
|
children
|
|
1892
1965
|
] });
|
|
1893
1966
|
}
|
|
1894
1967
|
function GlassFilterSVG() {
|
|
1895
|
-
return /* @__PURE__ */ (0,
|
|
1968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1896
1969
|
"svg",
|
|
1897
1970
|
{
|
|
1898
1971
|
width: "0",
|
|
1899
1972
|
height: "0",
|
|
1900
1973
|
style: { position: "absolute", pointerEvents: "none" },
|
|
1901
1974
|
"aria-hidden": "true",
|
|
1902
|
-
children: /* @__PURE__ */ (0,
|
|
1975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("defs", { children: Array.from({ length: 10 }, (_, i) => {
|
|
1903
1976
|
const level = i + 1;
|
|
1904
1977
|
const scale = level * 2;
|
|
1905
1978
|
const freq1 = 0.012 + level * 1e-3;
|
|
1906
1979
|
const freq2 = 0.01 + level * 8e-4;
|
|
1907
|
-
return /* @__PURE__ */ (0,
|
|
1980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1908
1981
|
"filter",
|
|
1909
1982
|
{
|
|
1910
1983
|
id: `liquid-glass-refract-${level}`,
|
|
@@ -1914,7 +1987,7 @@ function GlassFilterSVG() {
|
|
|
1914
1987
|
height: "120%",
|
|
1915
1988
|
colorInterpolationFilters: "sRGB",
|
|
1916
1989
|
children: [
|
|
1917
|
-
/* @__PURE__ */ (0,
|
|
1990
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1918
1991
|
"feTurbulence",
|
|
1919
1992
|
{
|
|
1920
1993
|
type: "fractalNoise",
|
|
@@ -1924,7 +1997,7 @@ function GlassFilterSVG() {
|
|
|
1924
1997
|
result: "noise"
|
|
1925
1998
|
}
|
|
1926
1999
|
),
|
|
1927
|
-
/* @__PURE__ */ (0,
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1928
2001
|
"feDisplacementMap",
|
|
1929
2002
|
{
|
|
1930
2003
|
in: "SourceGraphic",
|