@liqeliquid/liqe-liquid 0.7.0 → 0.7.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/LICENSE +1 -1
- package/README.md +25 -1
- package/dist/liqe.js +18 -2
- package/dist/liqe.mjs +18 -2
- package/package.json +5 -4
- package/source/liqe.css +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
An open-source liquid glass material and control set for the web. It bends light at its edges, keeps text readable on its own, and moves like the real thing: every number is measured from macOS 27, frame by frame, then improved where the web can do better. Status: **v0.7 preview**.
|
|
4
4
|
|
|
5
|
-
[Docs and live demos](https://youssefahmed2017.github.io/
|
|
5
|
+
[Docs and live demos](https://youssefahmed2017.github.io/Liqe-Liquid/) · [Lab](https://youssefahmed2017.github.io/Liqe-Liquid/lab.html) · [npm](https://www.npmjs.com/package/@liqeliquid/liqe-liquid) · MIT
|
|
6
6
|
|
|
7
7
|
> Liqe-Liquid is inspired by physical optics and modern translucent interface design. It is not affiliated with, endorsed by, or sponsored by Apple Inc. All third-party trademarks belong to their respective owners.
|
|
8
8
|
|
|
@@ -29,6 +29,26 @@ Or from the jsDelivr CDN, no build step:
|
|
|
29
29
|
|
|
30
30
|
It needs a browser (it reads `window` and `document` when loaded), so in server-rendered apps import it on the client only.
|
|
31
31
|
|
|
32
|
+
### Try it in one file
|
|
33
|
+
|
|
34
|
+
Save this as `test.html` and open it in Chrome. Glass needs something behind it to bend, so give the page a colourful background:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<!doctype html>
|
|
38
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@liqeliquid/liqe-liquid@0.7/source/liqe.css">
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/npm/@liqeliquid/liqe-liquid@0.7/dist/liqe.js"></script>
|
|
40
|
+
<style>nav a { color: inherit; text-decoration: none; font: 600 15px system-ui, sans-serif; }</style>
|
|
41
|
+
<!-- data-liqe-lum: the page's average brightness (0 to 1), so Guard can pick the ink; it can't read a gradient -->
|
|
42
|
+
<body data-liqe-lum="0.25" style="margin:0;min-height:100vh;background:linear-gradient(120deg,#ff8a3d,#2447bd)">
|
|
43
|
+
<nav class="liqe" data-meniscus="native" data-ink="auto" style="margin:40px;padding:12px 24px;border-radius:99px;display:inline-flex;gap:20px">
|
|
44
|
+
<a href="#">Home</a> <a href="#">Docs</a>
|
|
45
|
+
</nav>
|
|
46
|
+
<script>Liqe.mount(document.querySelector('nav'), { sample: 'dom' });</script>
|
|
47
|
+
</body>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Liqe is a browser library, not a command-line tool: install it into your project (`npm i`), not globally, and open it in a page rather than running it with Node.
|
|
51
|
+
|
|
32
52
|

|
|
33
53
|
|
|
34
54
|
## What we learned from studying translucent materials
|
|
@@ -362,3 +382,7 @@ How it was measured: `measure/ctlprobe.swift` is a native window holding NSSwitc
|
|
|
362
382
|
- Switch release: lens shrinks over 65–190 ms; white returns over 65–275 ms.
|
|
363
383
|
- Slide: spring with ω 11.5 and ζ 0.69, about 4% overshoot.
|
|
364
384
|
- A quick click only dips the white to about 0.8 and never grows the lens.
|
|
385
|
+
|
|
386
|
+
## License
|
|
387
|
+
|
|
388
|
+
MIT © 2026 youssefahmed2017. See [LICENSE](LICENSE).
|
package/dist/liqe.js
CHANGED
|
@@ -563,6 +563,20 @@
|
|
|
563
563
|
var dispURL = c.toDataURL();
|
|
564
564
|
return { disp: dispURL, mask: maskURL, rim: rimURL, light: edge || kind === 3 ? lightURL(ctx, w, h, LT) : null, max };
|
|
565
565
|
}
|
|
566
|
+
function fallbackVeil(s) {
|
|
567
|
+
var n = (PROFILES[s.profile] || {}).native;
|
|
568
|
+
var v = state.light && (n === 1 || n === 2) ? n === 2 ? nativeVeil(2) : { c: 215, a: 0.475 } : null;
|
|
569
|
+
s.flat = v ? function(x) {
|
|
570
|
+
return x * (1 - v.a) + v.c / 255 * v.a;
|
|
571
|
+
} : null;
|
|
572
|
+
if (v) {
|
|
573
|
+
s.el.style.setProperty("--liqe-veil", v.a.toFixed(3));
|
|
574
|
+
s.el.style.setProperty("--liqe-veil-c", v.c + "," + v.c + "," + v.c);
|
|
575
|
+
} else {
|
|
576
|
+
s.el.style.removeProperty("--liqe-veil");
|
|
577
|
+
s.el.style.removeProperty("--liqe-veil-c");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
566
580
|
function buildFilter(s) {
|
|
567
581
|
var p = params(s), w = Math.max(1, Math.round(s.w)), h = Math.max(1, Math.round(s.h)), r = Math.round(radiusPx(s));
|
|
568
582
|
p.bezel = Math.max(4, Math.min(p.bezel, Math.min(w, h) / 2 * (p.reach || 0.6)));
|
|
@@ -1141,7 +1155,7 @@
|
|
|
1141
1155
|
}
|
|
1142
1156
|
}
|
|
1143
1157
|
var raw = samples;
|
|
1144
|
-
if (samples && s.flat
|
|
1158
|
+
if (samples && s.flat) samples = samples.map(function(L) {
|
|
1145
1159
|
return lin(255 * s.flat(enc(L)));
|
|
1146
1160
|
});
|
|
1147
1161
|
var target = s.opts.target || 4.5, glow = s.glows ? PRESS_GLOW : 0, a, textL, tintL;
|
|
@@ -1298,6 +1312,7 @@
|
|
|
1298
1312
|
var can = refractSupported && !state.reducedT && !!PROFILES[s.profile] && rank < state.maxRefract && s.w > 0 && s.h > 0 && inView(s.el);
|
|
1299
1313
|
if (can === s.refracting && (!can || s.key)) {
|
|
1300
1314
|
if (can) buildFilter(s);
|
|
1315
|
+
else fallbackVeil(s);
|
|
1301
1316
|
return;
|
|
1302
1317
|
}
|
|
1303
1318
|
if (can) {
|
|
@@ -1305,6 +1320,7 @@
|
|
|
1305
1320
|
s.el.style.backdropFilter = "url(#" + s.id + ")";
|
|
1306
1321
|
} else {
|
|
1307
1322
|
s.el.style.backdropFilter = "";
|
|
1323
|
+
fallbackVeil(s);
|
|
1308
1324
|
}
|
|
1309
1325
|
s.refracting = can;
|
|
1310
1326
|
s.el.classList.toggle("liqe--refract", can);
|
|
@@ -2364,7 +2380,7 @@
|
|
|
2364
2380
|
root.querySelectorAll(".liqe-glass-btn").forEach(makeGlassButton);
|
|
2365
2381
|
}
|
|
2366
2382
|
window.Liqe = {
|
|
2367
|
-
version: "0.7.
|
|
2383
|
+
version: "0.7.1",
|
|
2368
2384
|
supportsRefraction: refractSupported,
|
|
2369
2385
|
mount,
|
|
2370
2386
|
controls,
|
package/dist/liqe.mjs
CHANGED
|
@@ -563,6 +563,20 @@ function makeGroupMaps(cw, ch, blobs, k, kind, k0, edge) {
|
|
|
563
563
|
var dispURL = c.toDataURL();
|
|
564
564
|
return { disp: dispURL, mask: maskURL, rim: rimURL, light: edge || kind === 3 ? lightURL(ctx, w, h, LT) : null, max };
|
|
565
565
|
}
|
|
566
|
+
function fallbackVeil(s) {
|
|
567
|
+
var n = (PROFILES[s.profile] || {}).native;
|
|
568
|
+
var v = state.light && (n === 1 || n === 2) ? n === 2 ? nativeVeil(2) : { c: 215, a: 0.475 } : null;
|
|
569
|
+
s.flat = v ? function(x) {
|
|
570
|
+
return x * (1 - v.a) + v.c / 255 * v.a;
|
|
571
|
+
} : null;
|
|
572
|
+
if (v) {
|
|
573
|
+
s.el.style.setProperty("--liqe-veil", v.a.toFixed(3));
|
|
574
|
+
s.el.style.setProperty("--liqe-veil-c", v.c + "," + v.c + "," + v.c);
|
|
575
|
+
} else {
|
|
576
|
+
s.el.style.removeProperty("--liqe-veil");
|
|
577
|
+
s.el.style.removeProperty("--liqe-veil-c");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
566
580
|
function buildFilter(s) {
|
|
567
581
|
var p = params(s), w = Math.max(1, Math.round(s.w)), h = Math.max(1, Math.round(s.h)), r = Math.round(radiusPx(s));
|
|
568
582
|
p.bezel = Math.max(4, Math.min(p.bezel, Math.min(w, h) / 2 * (p.reach || 0.6)));
|
|
@@ -1141,7 +1155,7 @@ function guard(s, immediate) {
|
|
|
1141
1155
|
}
|
|
1142
1156
|
}
|
|
1143
1157
|
var raw = samples;
|
|
1144
|
-
if (samples && s.flat
|
|
1158
|
+
if (samples && s.flat) samples = samples.map(function(L) {
|
|
1145
1159
|
return lin(255 * s.flat(enc(L)));
|
|
1146
1160
|
});
|
|
1147
1161
|
var target = s.opts.target || 4.5, glow = s.glows ? PRESS_GLOW : 0, a, textL, tintL;
|
|
@@ -1298,6 +1312,7 @@ function applyRefraction(s) {
|
|
|
1298
1312
|
var can = refractSupported && !state.reducedT && !!PROFILES[s.profile] && rank < state.maxRefract && s.w > 0 && s.h > 0 && inView(s.el);
|
|
1299
1313
|
if (can === s.refracting && (!can || s.key)) {
|
|
1300
1314
|
if (can) buildFilter(s);
|
|
1315
|
+
else fallbackVeil(s);
|
|
1301
1316
|
return;
|
|
1302
1317
|
}
|
|
1303
1318
|
if (can) {
|
|
@@ -1305,6 +1320,7 @@ function applyRefraction(s) {
|
|
|
1305
1320
|
s.el.style.backdropFilter = "url(#" + s.id + ")";
|
|
1306
1321
|
} else {
|
|
1307
1322
|
s.el.style.backdropFilter = "";
|
|
1323
|
+
fallbackVeil(s);
|
|
1308
1324
|
}
|
|
1309
1325
|
s.refracting = can;
|
|
1310
1326
|
s.el.classList.toggle("liqe--refract", can);
|
|
@@ -2364,7 +2380,7 @@ function controls(root) {
|
|
|
2364
2380
|
root.querySelectorAll(".liqe-glass-btn").forEach(makeGlassButton);
|
|
2365
2381
|
}
|
|
2366
2382
|
window.Liqe = {
|
|
2367
|
-
version: "0.7.
|
|
2383
|
+
version: "0.7.1",
|
|
2368
2384
|
supportsRefraction: refractSupported,
|
|
2369
2385
|
mount,
|
|
2370
2386
|
controls,
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liqeliquid/liqe-liquid",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Open-source liquid glass for the web: edge refraction, measured macOS 27 materials and controls, and Guard, which keeps text on glass at 4.5:1.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": "youssefahmed2017",
|
|
6
7
|
"keywords": ["liquid glass", "glassmorphism", "refraction", "backdrop-filter", "ui", "controls", "accessibility", "contrast"],
|
|
7
|
-
"homepage": "https://youssefahmed2017.github.io/
|
|
8
|
-
"repository": { "type": "git", "url": "git+https://github.com/youssefahmed2017/
|
|
9
|
-
"bugs": "https://github.com/youssefahmed2017/
|
|
8
|
+
"homepage": "https://youssefahmed2017.github.io/Liqe-Liquid/",
|
|
9
|
+
"repository": { "type": "git", "url": "git+https://github.com/youssefahmed2017/Liqe-Liquid.git" },
|
|
10
|
+
"bugs": "https://github.com/youssefahmed2017/Liqe-Liquid/issues",
|
|
10
11
|
"main": "dist/liqe.js",
|
|
11
12
|
"module": "dist/liqe.mjs",
|
|
12
13
|
"style": "source/liqe.css",
|
package/source/liqe.css
CHANGED