@liqeliquid/liqe-liquid 0.0.0-stage → 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 +21 -0
- package/README.md +387 -2
- package/dist/liqe.js +2449 -0
- package/dist/liqe.mjs +2451 -0
- package/package.json +30 -4
- package/source/liqe.css +392 -0
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liqeliquid/liqe-liquid",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.7.1",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"author": "youssefahmed2017",
|
|
7
|
+
"keywords": ["liquid glass", "glassmorphism", "refraction", "backdrop-filter", "ui", "controls", "accessibility", "contrast"],
|
|
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",
|
|
11
|
+
"main": "dist/liqe.js",
|
|
12
|
+
"module": "dist/liqe.mjs",
|
|
13
|
+
"style": "source/liqe.css",
|
|
14
|
+
"jsdelivr": "dist/liqe.js",
|
|
15
|
+
"unpkg": "dist/liqe.js",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": { "import": "./dist/liqe.mjs", "default": "./dist/liqe.js" },
|
|
18
|
+
"./liqe.css": "./source/liqe.css",
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": true,
|
|
22
|
+
"files": ["dist", "source/liqe.css"],
|
|
23
|
+
"publishConfig": { "access": "public" },
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "node build.js",
|
|
26
|
+
"test": "node --test test/*.test.js",
|
|
27
|
+
"prepublishOnly": "npm run build && npm test"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"esbuild": "0.28.2"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/source/liqe.css
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/* Liqe-Liquid v0.7 · MIT
|
|
2
|
+
A light-bending surface for the chrome layer. Pair with liqe.js for
|
|
3
|
+
Meniscus refraction, Guard and Viscosity.
|
|
4
|
+
The base rule uses :where() so your own classes can override layout. */
|
|
5
|
+
:where(.liqe) {
|
|
6
|
+
--liqe-radius: 22px;
|
|
7
|
+
--liqe-tint: var(--surface, #ffffff);
|
|
8
|
+
--liqe-tint-a: 0.62; /* Guard writes this */
|
|
9
|
+
--liqe-blur: 20px; /* fallback frost where refraction isn't available */
|
|
10
|
+
--liqe-fallback-sat: 1.7; /* fallback saturation; the refracting path uses the material's own */
|
|
11
|
+
--liqe-rim: 0.85; /* rim highlight strength */
|
|
12
|
+
--liqe-shadow: rgba(8, 10, 30, 0.28);
|
|
13
|
+
|
|
14
|
+
position: relative;
|
|
15
|
+
isolation: isolate;
|
|
16
|
+
border-radius: var(--liqe-radius);
|
|
17
|
+
/* a slightly denser wash toward the top, as seen on native system glass */
|
|
18
|
+
background: linear-gradient(180deg,
|
|
19
|
+
color-mix(in srgb, var(--liqe-tint) calc(min(1, var(--liqe-tint-a) + .08) * 100%), transparent),
|
|
20
|
+
color-mix(in srgb, var(--liqe-tint) calc(max(0, var(--liqe-tint-a) - .05) * 100%), transparent));
|
|
21
|
+
-webkit-backdrop-filter: blur(var(--liqe-blur)) saturate(var(--liqe-fallback-sat));
|
|
22
|
+
backdrop-filter: blur(var(--liqe-blur)) saturate(var(--liqe-fallback-sat));
|
|
23
|
+
box-shadow:
|
|
24
|
+
0 14px 34px -12px var(--liqe-shadow),
|
|
25
|
+
0 2px 6px -2px var(--liqe-shadow),
|
|
26
|
+
inset 0 1px 1px color-mix(in srgb, #ffffff 40%, transparent),
|
|
27
|
+
inset 0 -1px 1px color-mix(in srgb, #000000 10%, transparent);
|
|
28
|
+
transform-origin: 50% 50%;
|
|
29
|
+
will-change: transform;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Sheen: a soft, fixed highlight across the top of the surface. Nothing follows the pointer. */
|
|
33
|
+
.liqe::before {
|
|
34
|
+
content: "";
|
|
35
|
+
position: absolute; inset: 0; z-index: -1;
|
|
36
|
+
border-radius: inherit;
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
/* a fixed top sheen, plus a neutral grey veil: compared side by side with native Liquid Glass,
|
|
39
|
+
the material slightly darkens and desaturates what's behind it rather than brightening it */
|
|
40
|
+
background:
|
|
41
|
+
linear-gradient(180deg, color-mix(in srgb, #ffffff 9%, transparent), transparent 42%),
|
|
42
|
+
linear-gradient(rgba(var(--liqe-veil-c, 112, 118, 128), var(--liqe-veil, .16)), rgba(var(--liqe-veil-c, 112, 118, 128), var(--liqe-veil, .16)));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Rim: a thin edge light from a fixed key light at the upper left, as on native system glass. */
|
|
46
|
+
.liqe::after {
|
|
47
|
+
content: "";
|
|
48
|
+
position: absolute; inset: 0;
|
|
49
|
+
border-radius: inherit;
|
|
50
|
+
padding: 1.25px;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
background: conic-gradient(from -45deg,
|
|
53
|
+
rgba(255, 255, 255, var(--liqe-rim)),
|
|
54
|
+
rgba(255, 255, 255, 0.12) 22%,
|
|
55
|
+
rgba(255, 255, 255, 0.04) 50%,
|
|
56
|
+
rgba(255, 255, 255, 0.12) 78%,
|
|
57
|
+
rgba(255, 255, 255, var(--liqe-rim)));
|
|
58
|
+
-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
59
|
+
-webkit-mask-composite: xor;
|
|
60
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.liqe[data-guard="solid"], .liqe.liqe--solid { --liqe-rim: 0.25; }
|
|
64
|
+
.liqe.liqe--solid { -webkit-backdrop-filter: none; backdrop-filter: none; }
|
|
65
|
+
.liqe[data-drag] { touch-action: none; cursor: grab; }
|
|
66
|
+
.liqe[data-drag].liqe--dragging { cursor: grabbing; }
|
|
67
|
+
|
|
68
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
69
|
+
.liqe { --liqe-tint-a: 0.94 !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ---------- Liqe button ----------
|
|
73
|
+
The first component, and the reference for every other one. Use a real
|
|
74
|
+
<button> with data-press="squish" data-ripple data-magnetic and data-guard. */
|
|
75
|
+
:where(.liqe-button) {
|
|
76
|
+
--liqe-radius: 999px;
|
|
77
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 10px;
|
|
78
|
+
min-height: 52px; padding: 0 26px;
|
|
79
|
+
font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1; letter-spacing: .005em;
|
|
80
|
+
color: var(--ink, #12142b);
|
|
81
|
+
border: 0; cursor: pointer; overflow: hidden;
|
|
82
|
+
-webkit-tap-highlight-color: transparent; user-select: none; touch-action: manipulation;
|
|
83
|
+
}
|
|
84
|
+
.liqe.liqe--lit::before { box-shadow: inset 0 0 0 999px rgba(255, 255, 255, .16); } /* the measured press light */
|
|
85
|
+
.liqe-button:focus-visible { outline: 3px solid var(--accent, #3b36e8); outline-offset: 4px; }
|
|
86
|
+
.liqe-button:disabled, .liqe-button[aria-disabled="true"] { cursor: not-allowed; opacity: .55; --liqe-rim: .3; }
|
|
87
|
+
.liqe-ripple {
|
|
88
|
+
position: absolute; z-index: -1; border-radius: 50%; pointer-events: none;
|
|
89
|
+
background: radial-gradient(circle, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 62%);
|
|
90
|
+
mix-blend-mode: screen;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ---------- Adaptive ink (data-ink="auto") ----------
|
|
94
|
+
Guard writes --liqe-ink, --liqe-tint and --liqe-halo. Registering the colours lets them glide. */
|
|
95
|
+
@property --liqe-tint { syntax: '<color>'; inherits: true; initial-value: #ffffff; }
|
|
96
|
+
@property --liqe-ink { syntax: '<color>'; inherits: true; initial-value: #0b0d1a; }
|
|
97
|
+
.liqe[data-ink="auto"] {
|
|
98
|
+
color: var(--liqe-ink);
|
|
99
|
+
text-shadow: 0 0 14px var(--liqe-halo, transparent), 0 1px 2px var(--liqe-halo, transparent);
|
|
100
|
+
}
|
|
101
|
+
.liqe[data-ink="auto"].liqe--ink-ready { transition: --liqe-tint .35s ease, --liqe-ink .35s ease; }
|
|
102
|
+
/* label levels on glass (macOS vibrancy, measured; Guard writes --liqe-label-2..4, see contrast.js). Without
|
|
103
|
+
samples Guard can't place them, so they fall back to the primary ink, which it does check. */
|
|
104
|
+
.liqe .liqe-secondary { color: var(--liqe-label-2, inherit); }
|
|
105
|
+
.liqe .liqe-tertiary { color: var(--liqe-label-3, inherit); }
|
|
106
|
+
.liqe .liqe-quaternary { color: var(--liqe-label-4, inherit); }
|
|
107
|
+
|
|
108
|
+
/* ---------- Dock ----------
|
|
109
|
+
A glass bar of items that magnify toward the pointer (Liqe.dock). Items grow upward. */
|
|
110
|
+
.liqe-dock { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; overflow: visible; }
|
|
111
|
+
.liqe-dock-item { flex: 0 0 auto; display: block; border-radius: 22%; transform-origin: 50% 100%; }
|
|
112
|
+
.liqe-dock-item img { width: 100%; height: 100%; border-radius: inherit; display: block; object-fit: cover; }
|
|
113
|
+
.liqe-dock-label {
|
|
114
|
+
position: fixed; z-index: 60; pointer-events: none; --liqe-radius: 999px;
|
|
115
|
+
padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; line-height: 1.2;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* ---------- Native materials (data-meniscus="native" | "native-clear") ----------
|
|
119
|
+
Matched to Apple's glass on a flat backdrop: a flat grey veil (set per size by liqe.js),
|
|
120
|
+
one dark hairline at the boundary, and no sheen, fixed rim or drop shadow. */
|
|
121
|
+
.liqe.liqe--native { box-shadow: none; }
|
|
122
|
+
.liqe.liqe--native::before { background: rgba(var(--liqe-veil-c), var(--liqe-veil)); }
|
|
123
|
+
/* the rim image is drawn by liqe.js from the shape's distance field: one device pixel just outside
|
|
124
|
+
the edge, darker where the edge faces sideways */
|
|
125
|
+
.liqe.liqe--native::after {
|
|
126
|
+
display: block; inset: -1px; padding: 0; border-radius: 0;
|
|
127
|
+
background: var(--liqe-rim-img) center / 100% 100% no-repeat;
|
|
128
|
+
-webkit-mask: none; mask: none;
|
|
129
|
+
}
|
|
130
|
+
.liqe.liqe--native { background: color-mix(in srgb, var(--liqe-tint) calc(var(--liqe-tint-a) * 100%), transparent); }
|
|
131
|
+
|
|
132
|
+
/* Fusion groups: the shape comes from a mask built from the smooth union; the rim is a sibling */
|
|
133
|
+
.liqe.liqe--group { border-radius: 0; }
|
|
134
|
+
.liqe.liqe--group::after { display: none; }
|
|
135
|
+
|
|
136
|
+
/* Control Center glass appearing / leaving (liqe.js sets --liqe-appear each frame): the glass mix is
|
|
137
|
+
done inside the filter so the blur can stay at full strength; everything drawn on top fades here. */
|
|
138
|
+
.liqe[data-appearing] > *, .liqe[data-appearing]::before, .liqe[data-appearing]::after { opacity: var(--liqe-appear, 1); }
|
|
139
|
+
.liqe.liqe--native[data-appearing] { background: color-mix(in srgb, var(--liqe-tint) calc(var(--liqe-tint-a) * var(--liqe-appear, 1) * 100%), transparent); }
|
|
140
|
+
|
|
141
|
+
/* ------------------------------------------------------------------------------------------------
|
|
142
|
+
Controls, measured from native macOS 27 controls (dark appearance, 2x captures, sRGB).
|
|
143
|
+
Switch and slider: liqe.js wraps the <input> and adds a knob that turns to glass while pressed.
|
|
144
|
+
Checkbox, radio, segmented, push and progress are flat on macOS too, so they are pure CSS.
|
|
145
|
+
---------------------------------------------------------------------------------------------- */
|
|
146
|
+
:root {
|
|
147
|
+
--liqe-accent: #117dff; /* control accent as drawn (switch, checkbox, slider fill) */
|
|
148
|
+
--liqe-accent-solid: #007aff; /* default button, progress */
|
|
149
|
+
--liqe-ctl-off: #343434; /* checkbox, radio */
|
|
150
|
+
--liqe-track: rgba(255, 255, 255, .098); /* switch and slider track: translucent, #343434 on the window colour */
|
|
151
|
+
--liqe-tick: rgba(255, 255, 255, .25); /* slider tick dots: #565656 on #1e1e1e */
|
|
152
|
+
--liqe-ctl-fill: #2f2f2f; /* push, segmented, popup */
|
|
153
|
+
--liqe-ctl-text: rgba(255, 255, 255, .85);
|
|
154
|
+
--liqe-ctl-font: 13px/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
|
|
155
|
+
--liqe-accent-on: #137cff; /* switch track when on */
|
|
156
|
+
--liqe-seg-sep: rgba(255, 255, 255, .26);
|
|
157
|
+
--liqe-press: rgba(255, 255, 255, .15); /* push / segmented press wash */
|
|
158
|
+
--liqe-progress-track: #303030;
|
|
159
|
+
--liqe-knob-shadow: 0 1px 5px rgba(0, 0, 0, .12), 0 0 0.5px rgba(0, 0, 0, .12);
|
|
160
|
+
/* glass push buttons (NSButton bezelStyle .glass), see the glass button section */
|
|
161
|
+
--liqe-gb-veil: rgba(85, 85, 85, .574); /* backdrop 20 -> 57, 255 -> 157, flat #1e1e1e -> 62 */
|
|
162
|
+
--liqe-gb-ink: #fff;
|
|
163
|
+
--liqe-gb-hair: rgba(0, 0, 0, 0); /* outside the edge, up/down-facing */
|
|
164
|
+
--liqe-gb-hair-side: rgba(0, 0, 0, .7); /* outside the edge, sideways: #1e1e1e -> #090909 */
|
|
165
|
+
--liqe-gb-shadow: 0 0 transparent;
|
|
166
|
+
--liqe-gb-shade: .08; /* darker mid-height: 55 at the lips -> 49 (recording, text-free columns) */
|
|
167
|
+
--liqe-gb-face: rgb(62, 62, 62); /* the rest colour on the window, brightened by hover and press */
|
|
168
|
+
--liqe-gb-hover: 1.33; --liqe-gb-hover-p: 1.18; /* hover: grey 55 -> 73, blue 117 -> 138 (green) */
|
|
169
|
+
--liqe-gb-press-base: 1.10; --liqe-gb-press-peak: .33; /* press over hover: x(1.10 + .33 g), both buttons;
|
|
170
|
+
light: x(1.05 + .05 g), blue held 109 median / 113 max over hover 104, grey back up to 253 from 240 */
|
|
171
|
+
--liqe-gb-prominent: #0080ff; /* sRGB fallback of the P3 fill below */
|
|
172
|
+
}
|
|
173
|
+
/* Light appearance, measured from the same controls in macOS 27 light (2x captures, sRGB, white window).
|
|
174
|
+
Follows the page: system light unless <html data-theme="dark">, or forced with <html data-theme="light">.
|
|
175
|
+
The light accent is the system accent #007aff (AppKit, aqua); the probe window can't be made active
|
|
176
|
+
off-screen, so the drawn active blue is not yet captured. */
|
|
177
|
+
@media (prefers-color-scheme: light) {
|
|
178
|
+
:root:not([data-theme="dark"]) {
|
|
179
|
+
--liqe-accent: #007aff; --liqe-accent-solid: #007aff; --liqe-accent-on: #007aff;
|
|
180
|
+
--liqe-ctl-off: #e6e6e6; /* checkbox, radio */
|
|
181
|
+
--liqe-track: rgba(0, 0, 0, .1); /* switch/slider track: #e4e4e4-#e6e6e6 on white */
|
|
182
|
+
--liqe-tick: rgba(0, 0, 0, .26); /* slider tick dots: #bdbdbd on white */
|
|
183
|
+
--liqe-ctl-fill: #ececec; /* push, segmented, popup */
|
|
184
|
+
--liqe-ctl-text: rgba(0, 0, 0, .85);
|
|
185
|
+
--liqe-seg-sep: rgba(0, 0, 0, .23); /* #b5b5b5 on #ececec */
|
|
186
|
+
--liqe-press: rgba(0, 0, 0, .08);
|
|
187
|
+
--liqe-progress-track: #f0f0f0;
|
|
188
|
+
--liqe-knob-shadow: 0 0 0 0.5px rgba(0, 0, 0, .14), 0 1px 2px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
|
|
189
|
+
--liqe-gb-veil: rgba(246, 246, 246, .623); --liqe-gb-ink: #000;
|
|
190
|
+
--liqe-gb-hair: rgba(0, 0, 0, .08); --liqe-gb-hair-side: rgba(0, 0, 0, .26);
|
|
191
|
+
--liqe-gb-shadow: 0 3px 6px rgba(0, 0, 0, .02); --liqe-gb-shade: .024;
|
|
192
|
+
--liqe-gb-face: rgb(250, 250, 250); --liqe-gb-hover: .956; --liqe-gb-hover-p: .90; --liqe-gb-press-base: 1.05; --liqe-gb-press-peak: .05;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
:root[data-theme="light"] {
|
|
196
|
+
--liqe-accent: #007aff; --liqe-accent-solid: #007aff; --liqe-accent-on: #007aff;
|
|
197
|
+
--liqe-ctl-off: #e6e6e6;
|
|
198
|
+
--liqe-track: rgba(0, 0, 0, .1);
|
|
199
|
+
--liqe-tick: rgba(0, 0, 0, .26);
|
|
200
|
+
--liqe-ctl-fill: #ececec;
|
|
201
|
+
--liqe-ctl-text: rgba(0, 0, 0, .85);
|
|
202
|
+
--liqe-seg-sep: rgba(0, 0, 0, .23);
|
|
203
|
+
--liqe-press: rgba(0, 0, 0, .08);
|
|
204
|
+
--liqe-progress-track: #f0f0f0;
|
|
205
|
+
--liqe-knob-shadow: 0 0 0 0.5px rgba(0, 0, 0, .14), 0 1px 2px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
|
|
206
|
+
--liqe-gb-veil: rgba(246, 246, 246, .623); --liqe-gb-ink: #000;
|
|
207
|
+
--liqe-gb-hair: rgba(0, 0, 0, .08); --liqe-gb-hair-side: rgba(0, 0, 0, .26);
|
|
208
|
+
--liqe-gb-shadow: 0 3px 6px rgba(0, 0, 0, .02); --liqe-gb-shade: .024;
|
|
209
|
+
--liqe-gb-face: rgb(250, 250, 250); --liqe-gb-hover: .956; --liqe-gb-hover-p: .90; --liqe-gb-press-base: 1.05; --liqe-gb-press-peak: .05;
|
|
210
|
+
}
|
|
211
|
+
.liqe-ctl-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; }
|
|
212
|
+
|
|
213
|
+
/* switch: track 54x24, knob 32x20 inset 2, travel 18; pressed lens 52x33 */
|
|
214
|
+
.liqe-switch { position: relative; display: inline-block; width: 54px; height: 24px; vertical-align: middle; touch-action: none; cursor: default; }
|
|
215
|
+
.liqe-switch .liqe-ctl-input { pointer-events: none; }
|
|
216
|
+
.liqe-switch-track {
|
|
217
|
+
position: absolute; inset: 0; border-radius: 12px;
|
|
218
|
+
background: color-mix(in srgb, #fff calc(var(--liqe-lens, 0) * 10%), var(--liqe-track));
|
|
219
|
+
transition: background-color .17s ease;
|
|
220
|
+
}
|
|
221
|
+
.liqe-switch.is-on .liqe-switch-track { background: color-mix(in srgb, #fff calc(var(--liqe-lens, 0) * 10%), var(--liqe-accent-on)); }
|
|
222
|
+
.liqe-knob { position: absolute; transform-origin: 50% 50%; pointer-events: none; }
|
|
223
|
+
.liqe-knob--sw { left: -8px; top: -4.5px; width: 52px; height: 33px; border-radius: 16.5px; --r: 16.5px; }
|
|
224
|
+
.liqe-switch--small { width: 44px; height: 20px; }
|
|
225
|
+
.liqe-switch--small .liqe-switch-track { border-radius: 10px; }
|
|
226
|
+
.liqe-switch--small .liqe-knob--sw { left: -6px; top: -3.5px; width: 42px; height: 26.5px; border-radius: 13.25px; --r: 13.25px; }
|
|
227
|
+
.liqe-knob-face, .liqe-knob-glass { position: absolute; inset: 0; border-radius: inherit; }
|
|
228
|
+
.liqe-knob-face { background: #fff; box-shadow: var(--liqe-knob-shadow); }
|
|
229
|
+
.liqe-knob-glass.liqe {
|
|
230
|
+
/* the element reaches 6px past the lens so the outward pull has backdrop to sample; clip-path trims it */
|
|
231
|
+
--liqe-inset: 6; inset: -6px; border-radius: calc(var(--r) + 6px); clip-path: inset(6px round var(--r));
|
|
232
|
+
position: absolute; background: none; box-shadow: none; /* ring and inner light: liqe.js rim image */
|
|
233
|
+
}
|
|
234
|
+
.liqe-knob--sl .liqe-knob-glass.liqe {
|
|
235
|
+
/* the slider's lens is milky and nearly flat (measured): white 14% at the rim, 7.5% across the middle */
|
|
236
|
+
--liqe-strength: 0.15; padding: 6px; background-clip: content-box;
|
|
237
|
+
background-image: linear-gradient(rgba(255, 255, 255, .15), rgba(255, 255, 255, .075) 45%, rgba(255, 255, 255, .075) 55%, rgba(255, 255, 255, .15));
|
|
238
|
+
}
|
|
239
|
+
.liqe-knob::before { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 3px 10px rgba(0, 0, 0, calc(var(--liqe-lens, 0) * .1)); }
|
|
240
|
+
.liqe-knob-glass.liqe::before { display: none; }
|
|
241
|
+
.liqe-switch :focus-visible ~ .liqe-switch-track, .liqe-slider :focus-visible ~ .liqe-knob .liqe-knob-face { outline: 3px solid color-mix(in srgb, var(--liqe-accent) 50%, transparent); outline-offset: 1px; }
|
|
242
|
+
.liqe-switch[data-mouse] :focus-visible ~ .liqe-switch-track, .liqe-switch[data-mouse] .liqe-ctl-input:focus-visible { outline: none; }
|
|
243
|
+
|
|
244
|
+
/* slider: 6px track, knob 20x16, pressed lens 26x21.5 */
|
|
245
|
+
.liqe-slider { position: relative; display: inline-block; width: 100%; height: 22px; vertical-align: middle; touch-action: none; }
|
|
246
|
+
.liqe-slider-track { position: absolute; left: 0; right: 0; top: 8px; height: 6px; border-radius: 3px; background: var(--liqe-track); }
|
|
247
|
+
.liqe-slider-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--liqe-accent); }
|
|
248
|
+
.liqe-slider .liqe-ctl-input { -webkit-appearance: none; appearance: none; background: none; cursor: default; }
|
|
249
|
+
.liqe-slider .liqe-ctl-input::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 16px; }
|
|
250
|
+
.liqe-slider .liqe-ctl-input::-moz-range-thumb { width: 20px; height: 16px; border: 0; }
|
|
251
|
+
.liqe-knob--sl { left: -3px; top: 0; width: 26px; height: 21.5px; border-radius: 10.75px; --r: 10.75px; }
|
|
252
|
+
/* tick marks (<input list> -> <datalist>): 2px dots, one per value at the knob centre's stops, 7px off the
|
|
253
|
+
track centre line, below it (right of it when vertical). Measured from NSSlider numberOfTickMarks = 11. */
|
|
254
|
+
.liqe-slider-ticks { position: absolute; inset: 0; pointer-events: none; }
|
|
255
|
+
.liqe-slider-ticks i { position: absolute; width: 2px; height: 2px; border-radius: 1px; background: var(--liqe-tick);
|
|
256
|
+
left: calc(10px + var(--v) * (100% - 20px) - 1px); top: 17px; }
|
|
257
|
+
.liqe-slider--v .liqe-slider-ticks i { left: 17px; top: auto; bottom: calc(10px + var(--v) * (100% - 20px) - 1px); }
|
|
258
|
+
/* vertical slider: the horizontal one turned 90 degrees (measured), filling from the bottom; 120px tall like the probe's NSSlider */
|
|
259
|
+
.liqe-slider--v { width: 22px; height: 120px; }
|
|
260
|
+
.liqe-slider--v .liqe-slider-track { left: 8px; right: auto; top: 0; bottom: 0; width: 6px; height: auto; }
|
|
261
|
+
.liqe-slider--v .liqe-slider-fill { top: auto; left: 0; right: 0; bottom: 0; }
|
|
262
|
+
.liqe-slider--v .liqe-ctl-input { width: 100%; height: 100%; writing-mode: vertical-lr; direction: rtl; } /* the input also carries .liqe-slider, whose 22px height would win */
|
|
263
|
+
.liqe-slider--v .liqe-ctl-input::-webkit-slider-thumb { width: 16px; height: 20px; }
|
|
264
|
+
.liqe-slider--v .liqe-ctl-input::-moz-range-thumb { width: 16px; height: 20px; }
|
|
265
|
+
.liqe-slider--v .liqe-knob--sl { left: 0; top: -3px; width: 21.5px; height: 26px; }
|
|
266
|
+
/* its milky lens keeps the top-to-bottom gradient: measured, the lighting stays on up/down-facing edges (the caps), it does not turn with the lens */
|
|
267
|
+
|
|
268
|
+
/* checkbox and radio: 16x16 */
|
|
269
|
+
input.liqe-check, input.liqe-radio {
|
|
270
|
+
-webkit-appearance: none; appearance: none; margin: 0 6px 0 0; width: 16px; height: 16px; vertical-align: -3px;
|
|
271
|
+
background: var(--liqe-ctl-off) center / 16px 16px no-repeat; border-radius: 5px; flex: none;
|
|
272
|
+
}
|
|
273
|
+
input.liqe-radio { border-radius: 50%; }
|
|
274
|
+
input.liqe-check:checked {
|
|
275
|
+
background-color: var(--liqe-accent);
|
|
276
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.9 8.6L6.95 12.05L11.3 5.45' fill='none' stroke='%23fff' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
|
|
277
|
+
}
|
|
278
|
+
input.liqe-check:indeterminate { background-color: var(--liqe-accent); background-image: linear-gradient(#fff, #fff); background-size: 8px 1.9px; }
|
|
279
|
+
input.liqe-radio:checked { background: radial-gradient(circle, #fff 0 2.4px, transparent 2.8px) var(--liqe-accent); }
|
|
280
|
+
input.liqe-check:active, input.liqe-radio:active { filter: brightness(1.18); }
|
|
281
|
+
input.liqe-check:focus-visible, input.liqe-radio:focus-visible { outline: 3px solid color-mix(in srgb, var(--liqe-accent) 50%, transparent); outline-offset: 1px; }
|
|
282
|
+
input.liqe-check:disabled, input.liqe-radio:disabled { opacity: .4; }
|
|
283
|
+
|
|
284
|
+
/* glass checkbox (Liqe.controls upgrades input.liqe-check): the box is a knob, 16 at rest, 22 lifted */
|
|
285
|
+
.liqe-checkbox { position: relative; display: inline-block; width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px; flex: none; }
|
|
286
|
+
.liqe-checkbox input.liqe-check { margin: 0; width: 100%; height: 100%; }
|
|
287
|
+
.liqe-knob--cb { left: -3px; top: -3px; width: 22px; height: 22px; border-radius: 6.875px; --r: 6.875px; }
|
|
288
|
+
.liqe-check-fill { position: absolute; inset: 0; border-radius: inherit; background: var(--liqe-ctl-off); overflow: hidden; }
|
|
289
|
+
.liqe-check-on { position: absolute; inset: 0; background: var(--liqe-accent); }
|
|
290
|
+
.liqe-knob--cb .liqe-knob-glass.liqe { padding: 6px; background-clip: content-box; /* tint follows the blue coverage */
|
|
291
|
+
background-color: color-mix(in srgb, color-mix(in srgb, var(--liqe-accent) calc(var(--liqe-cb-v, 0) * 100%), var(--liqe-ctl-off)) calc(var(--liqe-cb-tint, 0) * 100%), transparent); }
|
|
292
|
+
.liqe-check-tick { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
|
|
293
|
+
.liqe-check-tick path { fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 13.4; }
|
|
294
|
+
.liqe-check-tick .liqe-check-dash { stroke-width: 1.9; stroke-linecap: butt; stroke-dasharray: 8; }
|
|
295
|
+
.liqe-checkbox :focus-visible ~ .liqe-knob .liqe-check-fill { outline: 3px solid color-mix(in srgb, var(--liqe-accent) 50%, transparent); outline-offset: 1px; }
|
|
296
|
+
.liqe-checkbox:has(:disabled) { opacity: .4; }
|
|
297
|
+
.liqe-checkbox input.liqe-radio { margin: 0; width: 100%; height: 100%; }
|
|
298
|
+
.liqe-knob--rb, .liqe-checkbox--radio .liqe-check-fill { border-radius: 50%; --r: 11px; }
|
|
299
|
+
/* dot as drawn at rest (2.4px solid, 2.8px edge at 16px), in the 22px lifted frame */
|
|
300
|
+
.liqe-radio-dot { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #fff 0 3.3px, transparent 3.85px); }
|
|
301
|
+
|
|
302
|
+
/* segmented: 24 high, radius 6; a group of radios */
|
|
303
|
+
.liqe-segmented { display: inline-flex; height: 24px; border-radius: 6px; background: var(--liqe-ctl-fill); font: var(--liqe-ctl-font); color: var(--liqe-ctl-text); vertical-align: middle; }
|
|
304
|
+
.liqe-segmented label { position: relative; display: flex; }
|
|
305
|
+
.liqe-segmented input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
|
|
306
|
+
.liqe-segmented label > span { display: flex; align-items: center; padding: 0 12.125px; border-radius: 6px; user-select: none; }
|
|
307
|
+
.liqe-segmented label + label > span::before { content: ""; position: absolute; left: -0.5px; top: 5px; bottom: 5px; width: 1px; background: var(--liqe-seg-sep); }
|
|
308
|
+
.liqe-segmented label:has(input:checked) > span, .liqe-segmented label:has(input:checked) + label > span { --sep: 0; }
|
|
309
|
+
.liqe-segmented label:has(input:checked) > span::before, .liqe-segmented label:has(input:checked) + label > span::before,
|
|
310
|
+
.liqe-segmented label:active > span::before, .liqe-segmented label:active + label > span::before { opacity: 0; }
|
|
311
|
+
.liqe-segmented input:checked + span { background: var(--liqe-accent); color: #fff; }
|
|
312
|
+
.liqe-segmented label:active input:not(:checked) + span { background: var(--liqe-press); }
|
|
313
|
+
.liqe-segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--liqe-accent) 50%, transparent); }
|
|
314
|
+
|
|
315
|
+
/* glass segmented (Liqe.controls upgrades .liqe-segmented): the selected pill is a knob */
|
|
316
|
+
.liqe-segmented.is-glass { position: relative; touch-action: none; }
|
|
317
|
+
.liqe-segmented.is-glass.is-glass input:checked + span { background: none; color: color-mix(in srgb, #fff calc(var(--on, 0) * 100%), var(--liqe-ctl-text)); }
|
|
318
|
+
.liqe-segmented.is-glass.is-glass label > span { position: relative; z-index: 1; color: color-mix(in srgb, #fff calc(var(--on, 0) * 100%), var(--liqe-ctl-text)); }
|
|
319
|
+
.liqe-segmented.is-glass.is-glass label:active input:not(:checked) + span { background: none; }
|
|
320
|
+
.liqe-segmented.is-glass.is-glass label + label > span::before { opacity: var(--sep, 1); }
|
|
321
|
+
.liqe-seg-face { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--liqe-accent); pointer-events: none; }
|
|
322
|
+
.liqe-knob--seg { left: 0; top: 0; z-index: 2; transform-origin: 50% 50%; }
|
|
323
|
+
.liqe-knob--seg .liqe-knob-glass.liqe { padding: 6px; background-clip: content-box;
|
|
324
|
+
background-color: color-mix(in srgb, var(--liqe-accent) calc(var(--liqe-seg-tint, 0) * 100%), transparent); }
|
|
325
|
+
.liqe-segmented.is-glass[data-mouse] input:focus-visible + span { outline: none; }
|
|
326
|
+
|
|
327
|
+
/* push button: 24 high, radius 6 */
|
|
328
|
+
.liqe-push { -webkit-appearance: none; appearance: none; height: 24px; padding: 0 12px; border: 0; border-radius: 6px; background: var(--liqe-ctl-fill); color: var(--liqe-ctl-text); font: var(--liqe-ctl-font); cursor: default; }
|
|
329
|
+
.liqe-push:active { background: linear-gradient(var(--liqe-press), var(--liqe-press)) var(--liqe-ctl-fill); }
|
|
330
|
+
.liqe-push--default { background: var(--liqe-accent-solid); color: #fff; }
|
|
331
|
+
.liqe-push--default:active { background: color-mix(in srgb, #fff 15%, var(--liqe-accent-solid)); }
|
|
332
|
+
.liqe-push:focus-visible { outline: 3px solid color-mix(in srgb, var(--liqe-accent) 50%, transparent); outline-offset: 1px; }
|
|
333
|
+
|
|
334
|
+
/* glass push buttons: NSButton bezelStyle .glass in ctlprobe (macOS 27, 2x stills, Display P3 converted to sRGB),
|
|
335
|
+
dark and light, over the flat window colour and over black/white stripes:
|
|
336
|
+
- 24 high, a regular 13px label with 12px either side (Glass 57.5, Capsule 73, Prominent 86 wide; regular
|
|
337
|
+
13px advances + 24 give 57.3, 73.0, 85.9 in Chrome, medium is 2-3px too wide);
|
|
338
|
+
corner radius 5 (outline rows fit a 10 device px circle), or a capsule with .liqe-glass-btn--capsule;
|
|
339
|
+
- the glass is a flat veil over a ~1px blur: out = in * (1 - a) + c * a, dark c 85 a .574, light c 246 a .623
|
|
340
|
+
(fits stripes 20 and 255 and the flat window colour to 1-2 levels);
|
|
341
|
+
- a bright lip on the top and bottom edges only (dark +47 +26 +8 levels over the fill on device rows 1-3),
|
|
342
|
+
and one device px outside the edge that darkens the backdrop where the edge faces sideways;
|
|
343
|
+
- light only: a faint shadow below, 3-4 levels darker for ~5px then fading by ~10px (recording);
|
|
344
|
+
- a little darker at mid-height (dark grey -8%, the rest ~-2%);
|
|
345
|
+
- prominent: the system blue, nearly opaque (stripes show through 3% dark, 8-16% light), white label.
|
|
346
|
+
The white label is ~3.9:1 on it (3.8 on the sRGB fallback), under 4.5:1: kept as macOS draws it, the user's call.
|
|
347
|
+
Press and release are in control-button.js.
|
|
348
|
+
shortcut: no edge refraction (the real one bends the backdrop a few px at the capsule ends) and no Guard,
|
|
349
|
+
so the label passes 4.5:1 on flat page colours but not over busy images; upgrade with a measured button
|
|
350
|
+
profile for liqe.js when these sit over content. */
|
|
351
|
+
.liqe-glass-btn {
|
|
352
|
+
-webkit-appearance: none; appearance: none; position: relative; isolation: isolate;
|
|
353
|
+
height: 24px; padding: 0 12px; border: 0; border-radius: 5px; vertical-align: middle;
|
|
354
|
+
font: 400 13px/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: var(--liqe-gb-ink); cursor: default;
|
|
355
|
+
background:
|
|
356
|
+
linear-gradient(rgba(255, 255, 255, var(--l1)) 0 .5px, rgba(255, 255, 255, var(--l2)) .5px 1px, rgba(255, 255, 255, var(--l3)) 1px 1.5px, transparent 1.5px calc(100% - 1.5px),
|
|
357
|
+
rgba(255, 255, 255, var(--l3)) calc(100% - 1.5px) calc(100% - 1px), rgba(255, 255, 255, var(--l2)) calc(100% - 1px) calc(100% - .5px), rgba(255, 255, 255, var(--l1)) calc(100% - .5px)),
|
|
358
|
+
linear-gradient(transparent 12%, rgba(0, 0, 0, var(--liqe-gb-shade)) 35% 65%, transparent 92%),
|
|
359
|
+
linear-gradient(var(--liqe-gb-fill, var(--liqe-gb-veil)), var(--liqe-gb-fill, var(--liqe-gb-veil)));
|
|
360
|
+
-webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
|
|
361
|
+
box-shadow: -.5px 0 0 var(--liqe-gb-hair-side), .5px 0 0 var(--liqe-gb-hair-side), 0 0 0 .5px var(--liqe-gb-hair), var(--liqe-gb-shadow);
|
|
362
|
+
transform-origin: 50% 50%; transition: transform 80ms cubic-bezier(.2, .8, .3, 1);
|
|
363
|
+
-webkit-tap-highlight-color: transparent; user-select: none; touch-action: manipulation;
|
|
364
|
+
}
|
|
365
|
+
/* lip: white over the fill on the top and bottom device rows 1-3; dark 109 88 70 over 62, light 255 255 253 over 249 */
|
|
366
|
+
.liqe-glass-btn { --l1: .24; --l2: .135; --l3: .04; }
|
|
367
|
+
:root[data-theme="light"] .liqe-glass-btn { --l1: 1; --l2: 1; --l3: .6; }
|
|
368
|
+
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .liqe-glass-btn { --l1: 1; --l2: 1; --l3: .6; } }
|
|
369
|
+
.liqe-glass-btn--capsule { border-radius: 999px; }
|
|
370
|
+
.liqe-glass-btn--prominent { --liqe-gb-fill: var(--liqe-gb-prominent); --liqe-gb-face: var(--liqe-gb-fill); --liqe-gb-hover: var(--liqe-gb-hover-p);
|
|
371
|
+
--liqe-gb-shade: .02; --liqe-gb-hair-side: rgba(0, 0, 0, .66); color: #fff; } /* side hairline 86 on 253 in light too; mid-height 101 -> 99 */
|
|
372
|
+
:root .liqe-glass-btn--prominent.liqe-glass-btn { --l1: .36; --l2: .2; --l3: .06; } /* both themes: 174 154 136 over 128 (green) */
|
|
373
|
+
@supports (color: color(display-p3 0 0 1)) {
|
|
374
|
+
.liqe-glass-btn--prominent { --liqe-gb-fill: color(display-p3 .016 .486 .996); } /* (4, 124, 254) as captured, P3 */
|
|
375
|
+
}
|
|
376
|
+
/* hover and press light, under the label (control-button.js): dim multiplies down, glow adds the face colour */
|
|
377
|
+
.liqe-glass-btn-dim, .liqe-glass-btn-glow { position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; }
|
|
378
|
+
.liqe-glass-btn-dim { background: #000; opacity: 0; }
|
|
379
|
+
.liqe-glass-btn-glow { mix-blend-mode: plus-lighter; }
|
|
380
|
+
.liqe-glass-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--liqe-accent) 50%, transparent); outline-offset: 1px; }
|
|
381
|
+
.liqe-glass-btn:disabled { opacity: .5; } /* not measured: the probe has no disabled glass button */
|
|
382
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
383
|
+
.liqe-glass-btn { -webkit-backdrop-filter: none; backdrop-filter: none; --liqe-gb-veil: #3e3e3e; }
|
|
384
|
+
:root[data-theme="light"] .liqe-glass-btn { --liqe-gb-veil: #fafafa; }
|
|
385
|
+
}
|
|
386
|
+
@media (prefers-reduced-transparency: reduce) and (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .liqe-glass-btn { --liqe-gb-veil: #fafafa; } }
|
|
387
|
+
|
|
388
|
+
/* progress: 8 high capsule */
|
|
389
|
+
progress.liqe-progress { -webkit-appearance: none; appearance: none; height: 8px; border: 0; border-radius: 4px; background: var(--liqe-progress-track); overflow: hidden; vertical-align: middle; }
|
|
390
|
+
progress.liqe-progress::-webkit-progress-bar { background: var(--liqe-progress-track); border-radius: 4px; }
|
|
391
|
+
progress.liqe-progress::-webkit-progress-value { background: var(--liqe-accent-solid); border-radius: 4px; }
|
|
392
|
+
progress.liqe-progress::-moz-progress-bar { background: var(--liqe-accent-solid); border-radius: 4px; }
|