@zakisheriff/liquid-glass 0.2.3 → 0.2.5
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/README.md +2 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/index.css +92 -42
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +219 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -870,15 +870,30 @@ GlassCard.displayName = "GlassCard";
|
|
|
870
870
|
|
|
871
871
|
// src/components/GlassInput/GlassInput.tsx
|
|
872
872
|
import React3, { useImperativeHandle as useImperativeHandle3, useRef as useRef3, useState } from "react";
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
873
|
+
|
|
874
|
+
// src/components/internal/Symbol.tsx
|
|
875
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
876
|
+
function Symbol({ source, size = 24, className, style, ...props }) {
|
|
877
|
+
const mask = `url("${source}")`;
|
|
878
|
+
return /* @__PURE__ */ jsx3(
|
|
879
|
+
"span",
|
|
880
|
+
{
|
|
881
|
+
"aria-hidden": "true",
|
|
882
|
+
...props,
|
|
883
|
+
className: ["lg-symbol", className].filter(Boolean).join(" "),
|
|
884
|
+
style: { "--lg-symbol-size": `${size}px`, WebkitMaskImage: mask, maskImage: mask, ...style }
|
|
885
|
+
}
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// src/components/internal/inputSymbols.ts
|
|
890
|
+
var searchSymbol = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAAAXNSR0IArs4c6QAAADhlWElmTU0AKgAAAAgAAYdpAAQAA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3UJML7b+TceAcqy7kKivy/OzwZJ01FlLgwxs4MtmUNql9yR/7sbnj4Iof0FJvWaeDOgJWD1GXfqhTW+Kfy/QodisQAaW49P7wTyYNAqk+l2Tn5qiORXYZTkk1GC6m608I91LuQ6kEkvTjtItLgVvAHomvtMmsrtuRxHgiUCHOmEFCGnbqUxvArsC/AzMgntAL6wPAhruSJ2DrAHHgMPASrAMKD1Uv+mqSG/VULamZsElkDvBrUBzU7rsngMa3a4G1wIdqsyMAWPAGDAGjAFjwBgwBowBY8AYMAaMAWPAGDAGjAFjwBgwBowBY8AYMAaMAWPAGDAGjAFjwBgwBowBY8AYMAaMAWPAGDAGpmLgv14OpyS3UH6uAAAAAElFTkSuQmCC";
|
|
892
|
+
|
|
893
|
+
// src/components/GlassInput/GlassInput.tsx
|
|
894
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
895
|
+
var Magnifier = /* @__PURE__ */ jsx4(Symbol, { source: searchSymbol, size: 20 });
|
|
896
|
+
var ClearGlyph = /* @__PURE__ */ jsx4(Symbol, { source: clearSymbol, size: 20 });
|
|
882
897
|
var GlassInput = React3.forwardRef(
|
|
883
898
|
({ intensity = 5, tint, label: label2, icon, trailing, onClear, className, style, value, onChange, type = "text", disabled, onFocus, onBlur, ...rest }, forwardedRef) => {
|
|
884
899
|
const fieldRef = useRef3(null);
|
|
@@ -907,10 +922,10 @@ var GlassInput = React3.forwardRef(
|
|
|
907
922
|
"data-liquid-glass": "",
|
|
908
923
|
style: tint ? { "--lg-input-tint": tint, ...style } : style,
|
|
909
924
|
children: [
|
|
910
|
-
label2 && /* @__PURE__ */
|
|
925
|
+
label2 && /* @__PURE__ */ jsx4("span", { className: "lg-input__label", children: label2 }),
|
|
911
926
|
/* @__PURE__ */ jsxs2("div", { ref: fieldRef, className: "lg-glass lg-input__field", "data-focused": focused ? "" : void 0, children: [
|
|
912
|
-
leading && /* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
927
|
+
leading && /* @__PURE__ */ jsx4("span", { className: "lg-input__icon", children: leading }),
|
|
928
|
+
/* @__PURE__ */ jsx4(
|
|
914
929
|
"input",
|
|
915
930
|
{
|
|
916
931
|
ref: inputRef,
|
|
@@ -932,7 +947,7 @@ var GlassInput = React3.forwardRef(
|
|
|
932
947
|
...rest
|
|
933
948
|
}
|
|
934
949
|
),
|
|
935
|
-
current && !disabled ? /* @__PURE__ */
|
|
950
|
+
current && !disabled ? /* @__PURE__ */ jsx4(
|
|
936
951
|
"button",
|
|
937
952
|
{
|
|
938
953
|
type: "button",
|
|
@@ -942,7 +957,7 @@ var GlassInput = React3.forwardRef(
|
|
|
942
957
|
onClick: clear,
|
|
943
958
|
children: ClearGlyph
|
|
944
959
|
}
|
|
945
|
-
) : trailing && /* @__PURE__ */
|
|
960
|
+
) : trailing && /* @__PURE__ */ jsx4("span", { className: "lg-input__icon lg-input__trailing", children: trailing })
|
|
946
961
|
] })
|
|
947
962
|
]
|
|
948
963
|
}
|
|
@@ -954,7 +969,7 @@ GlassInput.displayName = "GlassInput";
|
|
|
954
969
|
// src/components/GlassSheet/GlassSheet.tsx
|
|
955
970
|
import { useEffect as useEffect3, useRef as useRef4, useState as useState2 } from "react";
|
|
956
971
|
import { createPortal } from "react-dom";
|
|
957
|
-
import { jsx as
|
|
972
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
958
973
|
var OPEN = springFrom(0.42, 0.86);
|
|
959
974
|
var CLOSE = springFrom(0.34, 1);
|
|
960
975
|
var GlassSheet = ({ open, onClose, intensity = 5, tint, children, "aria-label": ariaLabel }) => {
|
|
@@ -1056,7 +1071,7 @@ var GlassSheet = ({ open, onClose, intensity = 5, tint, children, "aria-label":
|
|
|
1056
1071
|
if (!mounted || typeof document === "undefined") return null;
|
|
1057
1072
|
return createPortal(
|
|
1058
1073
|
/* @__PURE__ */ jsxs3("div", { className: "lg-sheet-layer", "data-liquid-glass": "", children: [
|
|
1059
|
-
/* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ jsx5("div", { ref: scrimRef, className: "lg-sheet__scrim", onClick: () => onClose?.(), "aria-hidden": "true" }),
|
|
1060
1075
|
/* @__PURE__ */ jsxs3(
|
|
1061
1076
|
"div",
|
|
1062
1077
|
{
|
|
@@ -1068,8 +1083,8 @@ var GlassSheet = ({ open, onClose, intensity = 5, tint, children, "aria-label":
|
|
|
1068
1083
|
className: "lg-glass lg-glass--host lg-sheet",
|
|
1069
1084
|
style: tint ? { "--lg-host-tint": tint } : void 0,
|
|
1070
1085
|
children: [
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1086
|
+
/* @__PURE__ */ jsx5("div", { className: "lg-sheet__grabber-zone", "aria-hidden": "true", children: /* @__PURE__ */ jsx5("span", { className: "lg-sheet__grabber" }) }),
|
|
1087
|
+
/* @__PURE__ */ jsx5("div", { className: "lg-sheet__content", children })
|
|
1073
1088
|
]
|
|
1074
1089
|
}
|
|
1075
1090
|
)
|
|
@@ -1094,11 +1109,9 @@ function useLensTrack(refs, options) {
|
|
|
1094
1109
|
useEffect4(() => {
|
|
1095
1110
|
const bar = refs.bar.current;
|
|
1096
1111
|
const lens = refs.lens.current;
|
|
1097
|
-
const tint = refs.tint.current;
|
|
1098
|
-
const row = refs.row.current;
|
|
1099
1112
|
const glass = refs.glass.current;
|
|
1100
1113
|
const select = refs.select.current;
|
|
1101
|
-
if (!bar || !lens || !
|
|
1114
|
+
if (!bar || !lens || !glass || !select) return;
|
|
1102
1115
|
let slot = 0;
|
|
1103
1116
|
let height = 0;
|
|
1104
1117
|
let pad = 0;
|
|
@@ -1108,23 +1121,35 @@ function useLensTrack(refs, options) {
|
|
|
1108
1121
|
let current = latest.current.index;
|
|
1109
1122
|
let gesture = null;
|
|
1110
1123
|
let suppressClick = false;
|
|
1124
|
+
const buttons = Array.from(bar.querySelectorAll("[data-lg-item]"));
|
|
1125
|
+
let glyphs = [];
|
|
1126
|
+
const preview = (index) => {
|
|
1127
|
+
if (index === void 0) delete bar.dataset.previewing;
|
|
1128
|
+
else bar.dataset.previewing = "";
|
|
1129
|
+
buttons.forEach((button, i) => button.toggleAttribute("data-lg-preview", i === index));
|
|
1130
|
+
};
|
|
1111
1131
|
const measure = () => {
|
|
1112
1132
|
const style = getComputedStyle(bar);
|
|
1113
1133
|
pad = parseFloat(style.paddingLeft) || 0;
|
|
1114
1134
|
slot = (bar.clientWidth - pad - (parseFloat(style.paddingRight) || 0)) / latest.current.count;
|
|
1115
1135
|
height = bar.clientHeight - (parseFloat(style.paddingTop) || 0) - (parseFloat(style.paddingBottom) || 0);
|
|
1116
1136
|
const { overhang, spread } = latest.current;
|
|
1117
|
-
W = Math.round(slot * (1 + spread));
|
|
1118
1137
|
H = Math.round(bar.offsetHeight + overhang);
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1138
|
+
W = Math.round(Math.max(slot * (1 + spread), slot + H - height));
|
|
1139
|
+
lens.style.width = `${W}px`;
|
|
1140
|
+
lens.style.height = `${H}px`;
|
|
1141
|
+
lens.style.left = `${pad + (slot - W) / 2}px`;
|
|
1142
|
+
lens.style.top = `${pad + (height - H) / 2}px`;
|
|
1125
1143
|
select.style.width = `${slot}px`;
|
|
1126
|
-
|
|
1127
|
-
|
|
1144
|
+
glyphs = buttons.flatMap(
|
|
1145
|
+
(button) => Array.from(button.querySelectorAll(".lg-nav__label, .lg-nav__icon > .lg-symbol")).map((node) => ({
|
|
1146
|
+
node,
|
|
1147
|
+
x: button.offsetLeft + node.offsetLeft - pad,
|
|
1148
|
+
y: node.offsetTop + node.offsetHeight / 2,
|
|
1149
|
+
width: node.offsetWidth,
|
|
1150
|
+
label: node.classList.contains("lg-nav__label")
|
|
1151
|
+
}))
|
|
1152
|
+
);
|
|
1128
1153
|
};
|
|
1129
1154
|
const paint = () => {
|
|
1130
1155
|
const { x: x2, swell: swell2, squash } = state;
|
|
@@ -1134,14 +1159,29 @@ function useLensTrack(refs, options) {
|
|
|
1134
1159
|
const ky = (height + (H - height) * lift2) / H * (1 - squash * 0.6);
|
|
1135
1160
|
const transform = `translateX(${x2}px) scale(${kx}, ${ky})`;
|
|
1136
1161
|
lens.style.transform = transform;
|
|
1137
|
-
tint.style.transform = transform;
|
|
1138
|
-
row.style.transform = `translate(${W / 2 + (-slot / 2 - x2) / kx}px, ${H / 2 - height / (2 * ky)}px) scale(${1 / kx}, ${1 / ky})`;
|
|
1139
1162
|
select.style.transform = `translateX(${x2}px)`;
|
|
1140
1163
|
lens.style.opacity = String(clamp(lift2 * 4, 0, 1));
|
|
1141
1164
|
const grow = 1 + latest.current.swell / Math.max(bar.offsetWidth, 1) * swell2;
|
|
1142
1165
|
bar.style.scale = `${grow}`;
|
|
1143
1166
|
lens.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
|
|
1144
1167
|
bar.style.setProperty("--lg-lift", String(clamp(lift2, 0, 1)));
|
|
1168
|
+
for (const glyph of glyphs) {
|
|
1169
|
+
if (lift2 <= 0.02 && !gesture) {
|
|
1170
|
+
glyph.node.style.removeProperty("--lg-content-tint");
|
|
1171
|
+
glyph.node.style.removeProperty("transform");
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
const ry = H * ky / 2;
|
|
1175
|
+
const dy = clamp(Math.abs(glyph.y - height / 2) / ry, 0, 1);
|
|
1176
|
+
const half = Math.max(0, (W - H) * kx / 2) + H * kx / 2 * Math.sqrt(1 - dy * dy);
|
|
1177
|
+
const from = x2 + slot / 2 - half - glyph.x;
|
|
1178
|
+
const to = x2 + slot / 2 + half - glyph.x;
|
|
1179
|
+
const normal = "var(--lg-fg)";
|
|
1180
|
+
const active2 = "var(--lg-track-active, var(--lg-accent))";
|
|
1181
|
+
glyph.node.style.setProperty("--lg-content-tint", `linear-gradient(90deg, ${normal} ${from}px, ${active2} ${from}px, ${active2} ${to}px, ${normal} ${to}px)`);
|
|
1182
|
+
const coverage = clamp((Math.min(glyph.width, to) - Math.max(0, from)) / Math.max(1, glyph.width), 0, 1);
|
|
1183
|
+
glyph.node.style.transform = `scale(${1 + clamp(lift2, 0, 1) * coverage * (glyph.label ? 0.035 : 0.08)})`;
|
|
1184
|
+
}
|
|
1145
1185
|
if (!gesture && lift2 < 0.02) delete bar.dataset.lifted;
|
|
1146
1186
|
};
|
|
1147
1187
|
const x = createSpring(current * slot, SPRINGS.snap, (value, velocity) => {
|
|
@@ -1166,7 +1206,7 @@ function useLensTrack(refs, options) {
|
|
|
1166
1206
|
};
|
|
1167
1207
|
const position = (clientX) => {
|
|
1168
1208
|
if (!gesture) return 0;
|
|
1169
|
-
const raw = gesture.anchor + clientX - gesture.startX;
|
|
1209
|
+
const raw = gesture.anchor + (clientX - gesture.startX) * bar.offsetWidth / Math.max(1, gesture.box.width);
|
|
1170
1210
|
const max = slot * (latest.current.count - 1);
|
|
1171
1211
|
const give = Math.min(14, slot * 0.12);
|
|
1172
1212
|
if (raw < 0) return rubberband(raw, give, 0.55);
|
|
@@ -1190,6 +1230,7 @@ function useLensTrack(refs, options) {
|
|
|
1190
1230
|
gesture = { id: event.pointerId, startX: event.clientX, anchor: index * slot, moved: false, box, hovered: index };
|
|
1191
1231
|
suppressClick = false;
|
|
1192
1232
|
bar.dataset.lifted = "";
|
|
1233
|
+
preview(index);
|
|
1193
1234
|
lens.dataset.pressed = "";
|
|
1194
1235
|
light(event.clientX, box);
|
|
1195
1236
|
haptic();
|
|
@@ -1199,6 +1240,7 @@ function useLensTrack(refs, options) {
|
|
|
1199
1240
|
swell.set(1);
|
|
1200
1241
|
x.tune(SPRINGS.snap);
|
|
1201
1242
|
x.set(index * slot);
|
|
1243
|
+
paint();
|
|
1202
1244
|
};
|
|
1203
1245
|
const onMove = (event) => {
|
|
1204
1246
|
if (event.pointerId !== gesture?.id) return;
|
|
@@ -1217,6 +1259,7 @@ function useLensTrack(refs, options) {
|
|
|
1217
1259
|
const hovered = clamp(Math.round(at / slot), 0, latest.current.count - 1);
|
|
1218
1260
|
if (hovered !== gesture.hovered) {
|
|
1219
1261
|
gesture.hovered = hovered;
|
|
1262
|
+
preview(hovered);
|
|
1220
1263
|
haptic();
|
|
1221
1264
|
}
|
|
1222
1265
|
};
|
|
@@ -1226,6 +1269,7 @@ function useLensTrack(refs, options) {
|
|
|
1226
1269
|
const at = moved ? position(event.clientX) : gesture.anchor;
|
|
1227
1270
|
const index = clamp(Math.round(at / slot), 0, latest.current.count - 1);
|
|
1228
1271
|
gesture = null;
|
|
1272
|
+
preview();
|
|
1229
1273
|
delete lens.dataset.pressed;
|
|
1230
1274
|
if (bar.hasPointerCapture?.(event.pointerId)) bar.releasePointerCapture(event.pointerId);
|
|
1231
1275
|
const inside = event.clientY >= box.top - 30 && event.clientY <= box.bottom + 30;
|
|
@@ -1245,6 +1289,20 @@ function useLensTrack(refs, options) {
|
|
|
1245
1289
|
};
|
|
1246
1290
|
const onUp = (event) => finish(event, true);
|
|
1247
1291
|
const onCancel = (event) => finish(event, false);
|
|
1292
|
+
const onBlur = () => {
|
|
1293
|
+
if (!gesture) return;
|
|
1294
|
+
const id = gesture.id;
|
|
1295
|
+
gesture = null;
|
|
1296
|
+
preview();
|
|
1297
|
+
delete lens.dataset.pressed;
|
|
1298
|
+
if (bar.hasPointerCapture(id)) bar.releasePointerCapture(id);
|
|
1299
|
+
lift.tune(SPRINGS.settle);
|
|
1300
|
+
lift.set(0);
|
|
1301
|
+
swell.tune(SPRINGS.release);
|
|
1302
|
+
swell.set(0);
|
|
1303
|
+
x.tune(SPRINGS.snap);
|
|
1304
|
+
x.set(current * slot);
|
|
1305
|
+
};
|
|
1248
1306
|
const onClick = (event) => {
|
|
1249
1307
|
if (suppressClick && event.detail !== 0) {
|
|
1250
1308
|
suppressClick = false;
|
|
@@ -1281,6 +1339,7 @@ function useLensTrack(refs, options) {
|
|
|
1281
1339
|
window.addEventListener("pointermove", onMove);
|
|
1282
1340
|
window.addEventListener("pointerup", onUp);
|
|
1283
1341
|
window.addEventListener("pointercancel", onCancel);
|
|
1342
|
+
window.addEventListener("blur", onBlur);
|
|
1284
1343
|
bar.addEventListener("click", onClick, true);
|
|
1285
1344
|
bar.addEventListener("keydown", onKey);
|
|
1286
1345
|
bar.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
@@ -1293,11 +1352,17 @@ function useLensTrack(refs, options) {
|
|
|
1293
1352
|
window.removeEventListener("pointermove", onMove);
|
|
1294
1353
|
window.removeEventListener("pointerup", onUp);
|
|
1295
1354
|
window.removeEventListener("pointercancel", onCancel);
|
|
1355
|
+
window.removeEventListener("blur", onBlur);
|
|
1296
1356
|
bar.removeEventListener("click", onClick, true);
|
|
1297
1357
|
bar.removeEventListener("keydown", onKey);
|
|
1298
1358
|
bar.removeEventListener("touchmove", onTouchMove);
|
|
1299
1359
|
delete bar.dataset.ready;
|
|
1300
1360
|
delete bar.dataset.lifted;
|
|
1361
|
+
preview();
|
|
1362
|
+
glyphs.forEach(({ node }) => {
|
|
1363
|
+
node.style.removeProperty("--lg-content-tint");
|
|
1364
|
+
node.style.removeProperty("transform");
|
|
1365
|
+
});
|
|
1301
1366
|
};
|
|
1302
1367
|
}, [options.count]);
|
|
1303
1368
|
useEffect4(() => {
|
|
@@ -1306,7 +1371,7 @@ function useLensTrack(refs, options) {
|
|
|
1306
1371
|
}
|
|
1307
1372
|
|
|
1308
1373
|
// src/components/internal/LensTrack.tsx
|
|
1309
|
-
import { jsx as
|
|
1374
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1310
1375
|
function LensTrack({
|
|
1311
1376
|
items,
|
|
1312
1377
|
labels,
|
|
@@ -1321,15 +1386,13 @@ function LensTrack({
|
|
|
1321
1386
|
const bar = useRef6(null);
|
|
1322
1387
|
const glass = useRef6(null);
|
|
1323
1388
|
const lens = useRef6(null);
|
|
1324
|
-
const tint = useRef6(null);
|
|
1325
|
-
const row = useRef6(null);
|
|
1326
1389
|
const select = useRef6(null);
|
|
1327
1390
|
const strength = Math.max(1, Math.min(10, intensity)) / 5;
|
|
1328
1391
|
useRefraction(glass, { kind: "surface", strength });
|
|
1329
1392
|
useRefraction(lens, { kind: "lens", strength, zoom: variant === "tabbar" ? 1.14 : 1.1 });
|
|
1330
1393
|
const tabbar = variant === "tabbar";
|
|
1331
1394
|
useLensTrack(
|
|
1332
|
-
{ bar, glass, lens,
|
|
1395
|
+
{ bar, glass, lens, select },
|
|
1333
1396
|
{
|
|
1334
1397
|
count: items.length,
|
|
1335
1398
|
index,
|
|
@@ -1349,9 +1412,9 @@ function LensTrack({
|
|
|
1349
1412
|
"data-liquid-glass": "",
|
|
1350
1413
|
style: { ...style, "--lg-count": items.length, "--lg-index": index },
|
|
1351
1414
|
children: [
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
items.map((item, i) => /* @__PURE__ */
|
|
1415
|
+
/* @__PURE__ */ jsx6("span", { ref: glass, className: "lg-glass lg-track__glass", "aria-hidden": "true" }),
|
|
1416
|
+
/* @__PURE__ */ jsx6("span", { ref: select, className: "lg-track__select", "aria-hidden": "true" }),
|
|
1417
|
+
items.map((item, i) => /* @__PURE__ */ jsx6(
|
|
1355
1418
|
"button",
|
|
1356
1419
|
{
|
|
1357
1420
|
type: "button",
|
|
@@ -1365,15 +1428,14 @@ function LensTrack({
|
|
|
1365
1428
|
},
|
|
1366
1429
|
i
|
|
1367
1430
|
)),
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */ jsx5("span", { ref: lens, className: "lg-glass lg-track__lens", "aria-hidden": "true" })
|
|
1431
|
+
/* @__PURE__ */ jsx6("span", { ref: lens, className: "lg-glass lg-track__lens", "aria-hidden": "true" })
|
|
1370
1432
|
]
|
|
1371
1433
|
}
|
|
1372
1434
|
);
|
|
1373
1435
|
}
|
|
1374
1436
|
|
|
1375
1437
|
// src/components/GlassNav/GlassNav.tsx
|
|
1376
|
-
import { jsx as
|
|
1438
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1377
1439
|
var GlassNav = ({
|
|
1378
1440
|
items,
|
|
1379
1441
|
activeIndex = 0,
|
|
@@ -1384,7 +1446,7 @@ var GlassNav = ({
|
|
|
1384
1446
|
"aria-label": ariaLabel = "Tabs"
|
|
1385
1447
|
}) => {
|
|
1386
1448
|
const hasIcons = items.some((item) => item.icon != null);
|
|
1387
|
-
return /* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ jsx7(
|
|
1388
1450
|
LensTrack,
|
|
1389
1451
|
{
|
|
1390
1452
|
variant: "tabbar",
|
|
@@ -1396,8 +1458,8 @@ var GlassNav = ({
|
|
|
1396
1458
|
onChange,
|
|
1397
1459
|
labels: items.map((item) => item.label),
|
|
1398
1460
|
items: items.map((item, i) => /* @__PURE__ */ jsxs5(React6.Fragment, { children: [
|
|
1399
|
-
item.icon != null && /* @__PURE__ */
|
|
1400
|
-
/* @__PURE__ */
|
|
1461
|
+
item.icon != null && /* @__PURE__ */ jsx7("span", { className: "lg-nav__icon", children: item.icon }),
|
|
1462
|
+
/* @__PURE__ */ jsx7("span", { className: "lg-nav__label", children: item.label })
|
|
1401
1463
|
] }, i))
|
|
1402
1464
|
}
|
|
1403
1465
|
);
|
|
@@ -1406,7 +1468,7 @@ GlassNav.displayName = "GlassNav";
|
|
|
1406
1468
|
|
|
1407
1469
|
// src/components/GlassSegmented/GlassSegmented.tsx
|
|
1408
1470
|
import React7 from "react";
|
|
1409
|
-
import { jsx as
|
|
1471
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1410
1472
|
var GlassSegmented = ({
|
|
1411
1473
|
options,
|
|
1412
1474
|
value,
|
|
@@ -1418,7 +1480,7 @@ var GlassSegmented = ({
|
|
|
1418
1480
|
"aria-label": ariaLabel
|
|
1419
1481
|
}) => {
|
|
1420
1482
|
const normalized = options.map((option) => typeof option === "string" ? { label: option } : option);
|
|
1421
|
-
return /* @__PURE__ */
|
|
1483
|
+
return /* @__PURE__ */ jsx8(
|
|
1422
1484
|
LensTrack,
|
|
1423
1485
|
{
|
|
1424
1486
|
variant: "segmented",
|
|
@@ -1431,7 +1493,7 @@ var GlassSegmented = ({
|
|
|
1431
1493
|
labels: normalized.map((option) => option.label),
|
|
1432
1494
|
items: normalized.map((option, i) => /* @__PURE__ */ jsxs6(React7.Fragment, { children: [
|
|
1433
1495
|
option.icon,
|
|
1434
|
-
/* @__PURE__ */
|
|
1496
|
+
/* @__PURE__ */ jsx8("span", { children: option.label })
|
|
1435
1497
|
] }, i))
|
|
1436
1498
|
}
|
|
1437
1499
|
);
|
|
@@ -1440,13 +1502,13 @@ GlassSegmented.displayName = "GlassSegmented";
|
|
|
1440
1502
|
|
|
1441
1503
|
// src/components/GlassSlider/GlassSlider.tsx
|
|
1442
1504
|
import React8, { useEffect as useEffect5, useImperativeHandle as useImperativeHandle4, useRef as useRef7 } from "react";
|
|
1443
|
-
import { jsx as
|
|
1505
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1444
1506
|
var GlassSlider = React8.forwardRef(
|
|
1445
1507
|
({
|
|
1446
1508
|
value = 0,
|
|
1447
1509
|
min = 0,
|
|
1448
1510
|
max = 100,
|
|
1449
|
-
step: step2 =
|
|
1511
|
+
step: step2 = "any",
|
|
1450
1512
|
intensity = 5,
|
|
1451
1513
|
tint,
|
|
1452
1514
|
shimmer: _shimmer,
|
|
@@ -1466,6 +1528,74 @@ var GlassSlider = React8.forwardRef(
|
|
|
1466
1528
|
const faceRef = useRef7(null);
|
|
1467
1529
|
const blockRef = useRef7(null);
|
|
1468
1530
|
useImperativeHandle4(forwardedRef, () => inputRef.current);
|
|
1531
|
+
useEffect5(() => {
|
|
1532
|
+
const input2 = inputRef.current;
|
|
1533
|
+
const root = rootRef.current;
|
|
1534
|
+
const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set;
|
|
1535
|
+
let drag = null;
|
|
1536
|
+
const update = (clientX) => {
|
|
1537
|
+
if (!drag || max <= min) return;
|
|
1538
|
+
const inset = showThumb ? 19 * drag.width / root.offsetWidth : 0;
|
|
1539
|
+
const travel = Math.max(1, drag.width - inset * 2);
|
|
1540
|
+
const fraction = clamp((clientX - drag.left - inset - drag.offset) / travel, 0, 1);
|
|
1541
|
+
let next = min + fraction * (max - min);
|
|
1542
|
+
const increment = Number(step2);
|
|
1543
|
+
if (step2 !== "any" && Number.isFinite(increment) && increment > 0) {
|
|
1544
|
+
next = clamp(min + Math.round((next - min) / increment) * increment, min, max);
|
|
1545
|
+
next = Number(next.toFixed(10));
|
|
1546
|
+
}
|
|
1547
|
+
root.style.setProperty("--lg-progress", String((next - min) / (max - min)));
|
|
1548
|
+
if (next === input2.valueAsNumber) return;
|
|
1549
|
+
setValue.call(input2, String(next));
|
|
1550
|
+
input2.dispatchEvent(new Event("input", { bubbles: true }));
|
|
1551
|
+
};
|
|
1552
|
+
const down = (event) => {
|
|
1553
|
+
if (input2.disabled || !event.isPrimary || event.button !== 0 || drag) return;
|
|
1554
|
+
event.preventDefault();
|
|
1555
|
+
input2.focus({ preventScroll: true });
|
|
1556
|
+
const box = root.getBoundingClientRect();
|
|
1557
|
+
const inset = showThumb ? 19 * box.width / root.offsetWidth : 0;
|
|
1558
|
+
const current = max > min ? clamp((input2.valueAsNumber - min) / (max - min), 0, 1) : 0;
|
|
1559
|
+
const center = box.left + inset + current * (box.width - inset * 2);
|
|
1560
|
+
const offset = showThumb && Math.abs(event.clientX - center) <= inset ? event.clientX - center : 0;
|
|
1561
|
+
drag = { id: event.pointerId, left: box.left, width: box.width, offset };
|
|
1562
|
+
root.dataset.dragging = "";
|
|
1563
|
+
input2.setPointerCapture(event.pointerId);
|
|
1564
|
+
update(event.clientX);
|
|
1565
|
+
};
|
|
1566
|
+
const move = (event) => {
|
|
1567
|
+
if (event.pointerId !== drag?.id) return;
|
|
1568
|
+
event.preventDefault();
|
|
1569
|
+
update(event.clientX);
|
|
1570
|
+
};
|
|
1571
|
+
const release = () => {
|
|
1572
|
+
if (!drag) return;
|
|
1573
|
+
const id = drag.id;
|
|
1574
|
+
drag = null;
|
|
1575
|
+
delete root.dataset.dragging;
|
|
1576
|
+
if (input2.hasPointerCapture(id)) input2.releasePointerCapture(id);
|
|
1577
|
+
};
|
|
1578
|
+
const up = (event) => {
|
|
1579
|
+
if (event.pointerId !== drag?.id) return;
|
|
1580
|
+
update(event.clientX);
|
|
1581
|
+
release();
|
|
1582
|
+
};
|
|
1583
|
+
input2.addEventListener("pointerdown", down);
|
|
1584
|
+
input2.addEventListener("pointermove", move);
|
|
1585
|
+
input2.addEventListener("pointerup", up);
|
|
1586
|
+
input2.addEventListener("pointercancel", release);
|
|
1587
|
+
input2.addEventListener("lostpointercapture", release);
|
|
1588
|
+
window.addEventListener("blur", release);
|
|
1589
|
+
return () => {
|
|
1590
|
+
release();
|
|
1591
|
+
input2.removeEventListener("pointerdown", down);
|
|
1592
|
+
input2.removeEventListener("pointermove", move);
|
|
1593
|
+
input2.removeEventListener("pointerup", up);
|
|
1594
|
+
input2.removeEventListener("pointercancel", release);
|
|
1595
|
+
input2.removeEventListener("lostpointercapture", release);
|
|
1596
|
+
window.removeEventListener("blur", release);
|
|
1597
|
+
};
|
|
1598
|
+
}, [min, max, step2, showThumb]);
|
|
1469
1599
|
const strength = Math.max(1, Math.min(10, intensity)) / 5;
|
|
1470
1600
|
const [mirrored, setMirrored] = React8.useState(false);
|
|
1471
1601
|
useEffect5(() => setMirrored(!canRefractBackdrop()), []);
|
|
@@ -1490,6 +1620,7 @@ var GlassSlider = React8.forwardRef(
|
|
|
1490
1620
|
thumb.style.scale = `${s * (1 + v.stretch)} ${s * (1 - v.stretch * 0.5)}`;
|
|
1491
1621
|
face.style.opacity = String(1 - clamp(v.lift, 0, 1) * 0.92);
|
|
1492
1622
|
root.style.setProperty("--lg-lift", String(clamp(v.lift, 0, 1)));
|
|
1623
|
+
if (v.lift < 0.01 && lift.target === 0) delete root.dataset.lifted;
|
|
1493
1624
|
};
|
|
1494
1625
|
const lift = createSpring(0, SPRINGS.lift, (x) => {
|
|
1495
1626
|
v.lift = x;
|
|
@@ -1506,6 +1637,7 @@ var GlassSlider = React8.forwardRef(
|
|
|
1506
1637
|
if (input2.disabled) return;
|
|
1507
1638
|
lastX = event.clientX;
|
|
1508
1639
|
lastT = event.timeStamp;
|
|
1640
|
+
root.dataset.lifted = "";
|
|
1509
1641
|
lift.tune(SPRINGS.lift);
|
|
1510
1642
|
lift.set(1);
|
|
1511
1643
|
haptic();
|
|
@@ -1531,6 +1663,7 @@ var GlassSlider = React8.forwardRef(
|
|
|
1531
1663
|
window.addEventListener("pointerup", up);
|
|
1532
1664
|
window.addEventListener("pointercancel", up);
|
|
1533
1665
|
input2.addEventListener("blur", up);
|
|
1666
|
+
window.addEventListener("blur", up);
|
|
1534
1667
|
return () => {
|
|
1535
1668
|
lift.stop();
|
|
1536
1669
|
stretch.stop();
|
|
@@ -1539,6 +1672,8 @@ var GlassSlider = React8.forwardRef(
|
|
|
1539
1672
|
window.removeEventListener("pointerup", up);
|
|
1540
1673
|
window.removeEventListener("pointercancel", up);
|
|
1541
1674
|
input2.removeEventListener("blur", up);
|
|
1675
|
+
window.removeEventListener("blur", up);
|
|
1676
|
+
delete root.dataset.lifted;
|
|
1542
1677
|
};
|
|
1543
1678
|
}, [showThumb]);
|
|
1544
1679
|
useEffect5(() => {
|
|
@@ -1597,7 +1732,7 @@ var GlassSlider = React8.forwardRef(
|
|
|
1597
1732
|
window.removeEventListener("pointercancel", up);
|
|
1598
1733
|
};
|
|
1599
1734
|
}, [showThumb]);
|
|
1600
|
-
const input = /* @__PURE__ */
|
|
1735
|
+
const input = /* @__PURE__ */ jsx9(
|
|
1601
1736
|
"input",
|
|
1602
1737
|
{
|
|
1603
1738
|
ref: inputRef,
|
|
@@ -1627,14 +1762,14 @@ var GlassSlider = React8.forwardRef(
|
|
|
1627
1762
|
children: [
|
|
1628
1763
|
/* @__PURE__ */ jsxs7("div", { ref: blockRef, className: "lg-glass lg-slider__block", children: [
|
|
1629
1764
|
/* @__PURE__ */ jsxs7("span", { className: "lg-slider__block-content", "aria-hidden": "true", children: [
|
|
1630
|
-
icon && /* @__PURE__ */
|
|
1631
|
-
label2 && /* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1765
|
+
icon && /* @__PURE__ */ jsx9("span", { className: "lg-slider__icon", children: icon }),
|
|
1766
|
+
label2 && /* @__PURE__ */ jsx9("span", { className: "lg-slider__label", children: label2 }),
|
|
1767
|
+
/* @__PURE__ */ jsx9("span", { className: "lg-slider__value", children: Math.round(Number(value)) })
|
|
1633
1768
|
] }),
|
|
1634
|
-
/* @__PURE__ */
|
|
1635
|
-
icon && /* @__PURE__ */
|
|
1636
|
-
label2 && /* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1769
|
+
/* @__PURE__ */ jsx9("span", { className: "lg-slider__block-fill", "aria-hidden": "true", children: /* @__PURE__ */ jsxs7("span", { className: "lg-slider__block-content lg-slider__block-content--lit", children: [
|
|
1770
|
+
icon && /* @__PURE__ */ jsx9("span", { className: "lg-slider__icon", children: icon }),
|
|
1771
|
+
label2 && /* @__PURE__ */ jsx9("span", { className: "lg-slider__label", children: label2 }),
|
|
1772
|
+
/* @__PURE__ */ jsx9("span", { className: "lg-slider__value", children: Math.round(Number(value)) })
|
|
1638
1773
|
] }) })
|
|
1639
1774
|
] }),
|
|
1640
1775
|
input
|
|
@@ -1651,8 +1786,8 @@ var GlassSlider = React8.forwardRef(
|
|
|
1651
1786
|
"data-mirror": mirrored ? "" : void 0,
|
|
1652
1787
|
style: vars,
|
|
1653
1788
|
children: [
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ jsx9("span", { className: "lg-slider__rail", "aria-hidden": "true", children: /* @__PURE__ */ jsx9("span", { className: "lg-slider__fill" }) }),
|
|
1790
|
+
/* @__PURE__ */ jsx9("span", { className: "lg-slider__thumb-slot", "aria-hidden": "true", children: /* @__PURE__ */ jsx9("span", { ref: thumbRef, className: "lg-glass lg-slider__thumb", "data-lg-mirror-bare": "", children: /* @__PURE__ */ jsx9("span", { ref: faceRef, className: "lg-slider__face" }) }) }),
|
|
1656
1791
|
input
|
|
1657
1792
|
]
|
|
1658
1793
|
}
|
|
@@ -1663,7 +1798,7 @@ GlassSlider.displayName = "GlassSlider";
|
|
|
1663
1798
|
|
|
1664
1799
|
// src/components/GlassSwitch/GlassSwitch.tsx
|
|
1665
1800
|
import React9, { useEffect as useEffect6, useImperativeHandle as useImperativeHandle5, useRef as useRef8, useState as useState3 } from "react";
|
|
1666
|
-
import { jsx as
|
|
1801
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1667
1802
|
var SETTLE = springFrom(0.36, 0.68);
|
|
1668
1803
|
var REST = 0.655;
|
|
1669
1804
|
var TRAVEL = 22;
|
|
@@ -1699,7 +1834,6 @@ var GlassSwitch = React9.forwardRef(
|
|
|
1699
1834
|
const el2 = ref.current;
|
|
1700
1835
|
const thumb = thumbRef.current;
|
|
1701
1836
|
const fill = fillRef.current;
|
|
1702
|
-
const face = faceRef.current;
|
|
1703
1837
|
const v = { x: checked ? 1 : 0, lift: 0, stretch: 0 };
|
|
1704
1838
|
const paint = () => {
|
|
1705
1839
|
const s = REST + (1 - REST) * v.lift;
|
|
@@ -1707,8 +1841,8 @@ var GlassSwitch = React9.forwardRef(
|
|
|
1707
1841
|
const sy = s * (1 - v.stretch * 0.5);
|
|
1708
1842
|
thumb.style.transform = `translate(${v.x * TRAVEL}px, -50%) scale(${sx}, ${sy})`;
|
|
1709
1843
|
const l = clamp(v.lift, 0, 1);
|
|
1710
|
-
face.style.opacity = String(1 - l * 0.92);
|
|
1711
1844
|
el2.style.setProperty("--lg-lift", String(l));
|
|
1845
|
+
el2.toggleAttribute("data-lifted", l > 0.01);
|
|
1712
1846
|
};
|
|
1713
1847
|
const position = createSpring(v.x, SPRINGS.snap, (value, velocity) => {
|
|
1714
1848
|
v.x = value;
|
|
@@ -1831,8 +1965,8 @@ var GlassSwitch = React9.forwardRef(
|
|
|
1831
1965
|
rest.onKeyDown?.(event);
|
|
1832
1966
|
},
|
|
1833
1967
|
children: [
|
|
1834
|
-
/* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ jsx10("span", { ref: fillRef, className: "lg-switch__fill", "aria-hidden": "true" }),
|
|
1969
|
+
/* @__PURE__ */ jsx10("span", { ref: thumbRef, className: "lg-glass lg-switch__thumb", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("span", { ref: faceRef, className: "lg-switch__face" }) })
|
|
1836
1970
|
]
|
|
1837
1971
|
}
|
|
1838
1972
|
);
|
|
@@ -1842,23 +1976,23 @@ GlassSwitch.displayName = "GlassSwitch";
|
|
|
1842
1976
|
|
|
1843
1977
|
// src/filters/LiquidGlassFilter.tsx
|
|
1844
1978
|
import { createContext, useContext } from "react";
|
|
1845
|
-
import { jsx as
|
|
1979
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1846
1980
|
var GlassFilterContext = createContext(false);
|
|
1847
1981
|
function LiquidGlassFilter({ children }) {
|
|
1848
1982
|
return /* @__PURE__ */ jsxs9(GlassFilterContext.Provider, { value: true, children: [
|
|
1849
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsx11(GlassFilterSVG, {}),
|
|
1850
1984
|
children
|
|
1851
1985
|
] });
|
|
1852
1986
|
}
|
|
1853
1987
|
function GlassFilterSVG() {
|
|
1854
|
-
return /* @__PURE__ */
|
|
1988
|
+
return /* @__PURE__ */ jsx11(
|
|
1855
1989
|
"svg",
|
|
1856
1990
|
{
|
|
1857
1991
|
width: "0",
|
|
1858
1992
|
height: "0",
|
|
1859
1993
|
style: { position: "absolute", pointerEvents: "none" },
|
|
1860
1994
|
"aria-hidden": "true",
|
|
1861
|
-
children: /* @__PURE__ */
|
|
1995
|
+
children: /* @__PURE__ */ jsx11("defs", { children: Array.from({ length: 10 }, (_, i) => {
|
|
1862
1996
|
const level = i + 1;
|
|
1863
1997
|
const scale = level * 2;
|
|
1864
1998
|
const freq1 = 0.012 + level * 1e-3;
|
|
@@ -1873,7 +2007,7 @@ function GlassFilterSVG() {
|
|
|
1873
2007
|
height: "120%",
|
|
1874
2008
|
colorInterpolationFilters: "sRGB",
|
|
1875
2009
|
children: [
|
|
1876
|
-
/* @__PURE__ */
|
|
2010
|
+
/* @__PURE__ */ jsx11(
|
|
1877
2011
|
"feTurbulence",
|
|
1878
2012
|
{
|
|
1879
2013
|
type: "fractalNoise",
|
|
@@ -1883,7 +2017,7 @@ function GlassFilterSVG() {
|
|
|
1883
2017
|
result: "noise"
|
|
1884
2018
|
}
|
|
1885
2019
|
),
|
|
1886
|
-
/* @__PURE__ */
|
|
2020
|
+
/* @__PURE__ */ jsx11(
|
|
1887
2021
|
"feDisplacementMap",
|
|
1888
2022
|
{
|
|
1889
2023
|
in: "SourceGraphic",
|