@lantun/core 0.1.1 → 0.1.3
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 +22 -1
- package/dist/highlight/highlight.js +4 -0
- package/dist/highlight/highlight.types.d.ts +1 -0
- package/dist/index.js +0 -1
- package/dist/lib/emitter.d.ts +0 -1
- package/dist/lib/emitter.js +0 -3
- package/dist/reader/reader.js +7 -3
- package/dist/ui/dock.js +20 -2
- package/dist/ui/ui.constants.d.ts +7 -0
- package/dist/ui/ui.constants.js +14 -0
- package/dist/ui/ui.hooks.js +51 -12
- package/dist/ui/ui.lib.d.ts +19 -1
- package/dist/ui/ui.lib.js +55 -2
- package/dist/ui/ui.styles.d.ts +1 -1
- package/dist/ui/ui.styles.js +24 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Lantun adds a small dock to your page. Readers press play and hear the article w
|
|
|
6
6
|
|
|
7
7
|
**[Try the live demo →](https://lantun.rzknkbr.xyz)** Open any sample article and press play.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/playing-dark.png" alt="Lantun reading an article aloud, highlighting the current sentence and word">
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -78,6 +78,27 @@ Turn on debug logs with `localStorage.setItem("lantun:debug", "1")`.
|
|
|
78
78
|
- **No build step?** Use the [`lantun`](https://www.npmjs.com/package/lantun) script tag.
|
|
79
79
|
- **React or Next.js?** Use [`@lantun/react`](https://www.npmjs.com/package/@lantun/react).
|
|
80
80
|
|
|
81
|
+
## A closer look
|
|
82
|
+
|
|
83
|
+
<table>
|
|
84
|
+
<tr>
|
|
85
|
+
<td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/dock-dark.png" alt="The idle dock on the right edge, its play button showing a one-minute listening time"></td>
|
|
86
|
+
<td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/voice-dark.png" alt="The voice picker with lifelike and built-in voices"></td>
|
|
87
|
+
</tr>
|
|
88
|
+
<tr>
|
|
89
|
+
<td><b>Quiet until needed.</b> A slim dock shows how long the article takes to hear. Drag it to any edge, or tuck it away.</td>
|
|
90
|
+
<td><b>Lifelike voices.</b> Natural English voices made on the reader's device, downloaded once and only when chosen.</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/accessibility-dark.png" alt="The reading aids panel with the Dyslexia profile on"></td>
|
|
94
|
+
<td align="center"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/mobile-dark.png" width="240" alt="Lantun on a phone, the dock lying flat along the bottom while the headline is read aloud"></td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td><b>Reading aids.</b> Text size, spacing, readable and dyslexia fonts, colour modes, reading guide and mask, and more.</td>
|
|
98
|
+
<td><b>On phones.</b> The dock lies flat along the bottom, in thumb reach.</td>
|
|
99
|
+
</tr>
|
|
100
|
+
</table>
|
|
101
|
+
|
|
81
102
|
## Links
|
|
82
103
|
|
|
83
104
|
- [Live demo](https://lantun.rzknkbr.xyz)
|
|
@@ -68,7 +68,9 @@ function createOverlayPainter(doc, win, o) {
|
|
|
68
68
|
// One insertion per paint instead of one per line box.
|
|
69
69
|
shadow.append(boxes);
|
|
70
70
|
}
|
|
71
|
+
const reflow = typeof ResizeObserver === "function" ? new ResizeObserver(paint) : null;
|
|
71
72
|
win.addEventListener("resize", paint);
|
|
73
|
+
reflow?.observe(o.root);
|
|
72
74
|
return {
|
|
73
75
|
sentence(range) {
|
|
74
76
|
ranges.s = range;
|
|
@@ -80,6 +82,7 @@ function createOverlayPainter(doc, win, o) {
|
|
|
80
82
|
},
|
|
81
83
|
destroy() {
|
|
82
84
|
win.removeEventListener("resize", paint);
|
|
85
|
+
reflow?.disconnect();
|
|
83
86
|
host.remove();
|
|
84
87
|
},
|
|
85
88
|
};
|
|
@@ -92,6 +95,7 @@ export function createReadingView(o) {
|
|
|
92
95
|
const painter = createPainter(o.doc, o.win, {
|
|
93
96
|
color: resolveColor(o.color, o.doc) ?? DEFAULT_RGB,
|
|
94
97
|
background: backgroundOf(o.root),
|
|
98
|
+
root: o.root,
|
|
95
99
|
zIndex: o.zIndex,
|
|
96
100
|
nonce: o.nonce,
|
|
97
101
|
});
|
package/dist/index.js
CHANGED
package/dist/lib/emitter.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ type Handler = (payload: unknown) => void;
|
|
|
2
2
|
export interface Emitter<E extends string> {
|
|
3
3
|
on(event: E, handler: Handler): () => void;
|
|
4
4
|
emit(event: E, payload?: unknown): void;
|
|
5
|
-
clear(): void;
|
|
6
5
|
}
|
|
7
6
|
export declare function createEmitter<E extends string>(): Emitter<E>;
|
|
8
7
|
export {};
|
package/dist/lib/emitter.js
CHANGED
package/dist/reader/reader.js
CHANGED
|
@@ -194,14 +194,18 @@ export function createReader(opts, emit, deps = {}) {
|
|
|
194
194
|
player?.setVoice(voice);
|
|
195
195
|
warmUp();
|
|
196
196
|
}
|
|
197
|
-
// Runs at start and whenever an add-on engine registers
|
|
197
|
+
// Runs at start and whenever an add-on engine registers. The reader's saved choice wins once it is
|
|
198
|
+
// listed: built-in voices usually resolve before an add-on registers, and keeping that stand-in
|
|
199
|
+
// would lose a saved lifelike voice on every page load. Otherwise the current voice stays.
|
|
198
200
|
function loadVoices() {
|
|
199
201
|
driver.getVoices().then((all) => {
|
|
200
202
|
if (destroyed)
|
|
201
203
|
return;
|
|
202
204
|
const voices = listVoices(all, opts.lang);
|
|
203
|
-
const current = store.get()
|
|
204
|
-
const
|
|
205
|
+
const { voice: current, status } = store.get();
|
|
206
|
+
const savedId = settings.voices[lang];
|
|
207
|
+
const saved = status === "playing" ? undefined : voices.find((v) => v.id === savedId);
|
|
208
|
+
const voice = saved ?? (current && voices.find((v) => v.id === current.id)) ?? pickVoice(voices, opts.lang, savedId);
|
|
205
209
|
store.set({ voices, voicesLoaded: true });
|
|
206
210
|
if (!current || voice?.id !== current.id)
|
|
207
211
|
useVoice(voice);
|
package/dist/ui/dock.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "preact/hooks";
|
|
2
3
|
import { describeVoice } from "../voices/voices.lib";
|
|
3
4
|
import { AccessIcon, ChevronIcon, GripIcon, PauseIcon, PlayIcon, SkipIcon, VoiceIcon } from "./icons";
|
|
4
|
-
import { RING } from "./ui.constants";
|
|
5
|
+
import { RING, TIP_WARM_MS } from "./ui.constants";
|
|
5
6
|
import { useCountdown, useDockPlacement, useDrag } from "./ui.hooks";
|
|
6
7
|
import { clock, fmt, formatRate } from "./ui.i18n";
|
|
7
8
|
import { hideDir, leaveAttr } from "./ui.lib";
|
|
@@ -12,6 +13,23 @@ export function Dock(props) {
|
|
|
12
13
|
const remaining = useCountdown(state);
|
|
13
14
|
const startDrag = useDrag(props.dockRef, place.o, () => props.onOpen(null), props.onMove);
|
|
14
15
|
useDockPlacement(props.dockRef, place.x, place.y, [place.o, axOn === null]);
|
|
16
|
+
// The first tooltip waits, so passing over the dock opens nothing. Once the reader has rested on
|
|
17
|
+
// it, the next ones open at once as they move between buttons. The grace on leave covers the gap
|
|
18
|
+
// between the rail and the puck.
|
|
19
|
+
const warm = useRef(undefined);
|
|
20
|
+
useEffect(() => () => clearTimeout(warm.current), []);
|
|
21
|
+
function warmTips(on) {
|
|
22
|
+
clearTimeout(warm.current);
|
|
23
|
+
warm.current = setTimeout(() => {
|
|
24
|
+
const el = props.dockRef.current;
|
|
25
|
+
if (!el)
|
|
26
|
+
return;
|
|
27
|
+
if (on)
|
|
28
|
+
el.dataset.warm = "";
|
|
29
|
+
else
|
|
30
|
+
delete el.dataset.warm;
|
|
31
|
+
}, on ? TIP_WARM_MS : 300);
|
|
32
|
+
}
|
|
15
33
|
const playing = state.status === "playing";
|
|
16
34
|
const active = playing || state.status === "paused";
|
|
17
35
|
// Without a voice or article text there is nothing to play: the rail keeps only move and hide.
|
|
@@ -65,7 +83,7 @@ export function Dock(props) {
|
|
|
65
83
|
function resetPlace() {
|
|
66
84
|
props.onMove({ x: place.x < 0.5 ? 0 : 1, y: 0.5, o: "v" });
|
|
67
85
|
}
|
|
68
|
-
return (_jsxs("div", { class: "dock", ref: props.dockRef, "data-o": place.o, "data-leave": leaveAttr(props.leaving), children: [_jsxs("div", { class: "rail surface", role: "region", "aria-label": t.region, "data-active": active ? "" : undefined, onKeyDown: onKey, children: [_jsx("div", { class: "grip", "aria-hidden": "true", title: t.move, onPointerDown: startDrag, onDblClick: resetPlace, children: _jsx(GripIcon, {}) }), tts && (_jsxs(_Fragment, { children: [_jsx("div", { class: "xtra", children: _jsx("button", { type: "button", class: "ghost", "aria-label": t.prev, "data-tip": t.prev, disabled: isLoading, onClick: () => tts.prev(), children: _jsx(SkipIcon, {}) }) }), _jsxs("div", { class: "playwrap", children: [active && (_jsx("div", { class: `ring${load}`, role: "progressbar", "aria-label": t.progress, "aria-valuemin": 1, "aria-valuemax": total, "aria-valuenow": Math.min(state.index + 1, total), "aria-valuetext": isLoading ? preparing : position, children: _jsxs("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", children: [_jsx("circle", { cx: "24", cy: "24", r: "22" }), _jsx("circle", { cx: "24", cy: "24", r: "22", class: "prg", "stroke-dasharray": RING, "stroke-dashoffset": RING * (1 - ring) })] }) })), _jsx("button", { type: "button", class: `play${load}`, "aria-label": playing ? t.pause : t.play, "data-tip": tip, onClick: props.onToggle, "data-lt": "play", children: playing ? _jsx(PauseIcon, { size: 13 }) : _jsx(PlayIcon, { size: 14 }) })] }), _jsx("span", { class: `time${load}`, "aria-hidden": "true", children: time }), _jsx("div", { class: "xtra", children: _jsx("button", { type: "button", class: "ghost", "aria-label": t.next, "data-tip": t.next, disabled: isLoading, onClick: () => tts.next(), children: _jsx(SkipIcon, { ahead: true }) }) }), _jsx("span", { class: "sep" }), _jsxs("button", { type: "button", class: "ghost vb", ref: triggers.voice, "aria-label": fmt(state.voice?.engine ? t.voiceOfHd : t.voiceOf, {
|
|
86
|
+
return (_jsxs("div", { class: "dock", ref: props.dockRef, "data-o": place.o, "data-leave": leaveAttr(props.leaving), onPointerEnter: (e) => e.pointerType === "mouse" && warmTips(true), onPointerLeave: () => warmTips(false), children: [_jsxs("div", { class: "rail surface", role: "region", "aria-label": t.region, "data-active": active ? "" : undefined, onKeyDown: onKey, children: [_jsx("div", { class: "grip", "aria-hidden": "true", title: t.move, onPointerDown: startDrag, onDblClick: resetPlace, children: _jsx(GripIcon, {}) }), tts && (_jsxs(_Fragment, { children: [_jsx("div", { class: "xtra", children: _jsx("button", { type: "button", class: "ghost", "aria-label": t.prev, "data-tip": t.prev, disabled: isLoading, onClick: () => tts.prev(), children: _jsx(SkipIcon, {}) }) }), _jsxs("div", { class: "playwrap", children: [active && (_jsx("div", { class: `ring${load}`, role: "progressbar", "aria-label": t.progress, "aria-valuemin": 1, "aria-valuemax": total, "aria-valuenow": Math.min(state.index + 1, total), "aria-valuetext": isLoading ? preparing : position, children: _jsxs("svg", { viewBox: "0 0 48 48", "aria-hidden": "true", children: [_jsx("circle", { cx: "24", cy: "24", r: "22" }), _jsx("circle", { cx: "24", cy: "24", r: "22", class: "prg", "stroke-dasharray": RING, "stroke-dashoffset": RING * (1 - ring) })] }) })), _jsx("button", { type: "button", class: `play${load}`, "aria-label": playing ? t.pause : t.play, "data-tip": tip, onClick: props.onToggle, "data-lt": "play", children: playing ? _jsx(PauseIcon, { size: 13 }) : _jsx(PlayIcon, { size: 14 }) })] }), _jsx("span", { class: `time${load}`, "aria-hidden": "true", children: time }), _jsx("div", { class: "xtra", children: _jsx("button", { type: "button", class: "ghost", "aria-label": t.next, "data-tip": t.next, disabled: isLoading, onClick: () => tts.next(), children: _jsx(SkipIcon, { ahead: true }) }) }), _jsx("span", { class: "sep" }), _jsxs("button", { type: "button", class: "ghost vb", ref: triggers.voice, "aria-label": fmt(state.voice?.engine ? t.voiceOfHd : t.voiceOf, {
|
|
69
87
|
v: voiceName,
|
|
70
88
|
}), "aria-expanded": open === "voice", "aria-haspopup": "dialog", "data-tip": fmt(t.voiceOf, { v: voiceName }), "data-hint": props.hint ? "" : undefined, "data-lt": "voice", onClick: toggle("voice"), children: [_jsx(VoiceIcon, {}), state.voice?.engine && _jsx("i", { class: "dot" })] }), _jsxs("button", { type: "button", class: "speed", ref: triggers.speed, "aria-label": `${t.speed}, ${formatRate(state.rate)}×`, "aria-expanded": open === "speed", "aria-haspopup": "dialog", "data-tip": t.speed, onClick: toggle("speed"), children: [formatRate(state.rate), "\u00D7"] })] })), _jsx("button", { type: "button", class: "ghost hide", "aria-label": t.hide, "data-tip": t.hide, onClick: props.onHide, "data-lt": "hide", children: _jsx(ChevronIcon, { dir: hideDir(place) }) })] }), axOn !== null && (_jsxs("button", { type: "button", class: "puck surface", ref: triggers.ax, "aria-label": axOn ? `${t.a11y}, ${t.on}` : t.a11y, "aria-expanded": open === "ax", "aria-haspopup": "dialog", "data-tip": t.a11yTitle, "data-lt": "ax", onClick: toggle("ax"), children: [_jsx(AccessIcon, { size: 18 }), axOn && _jsx("i", { class: "dot" })] }))] }));
|
|
71
89
|
}
|
|
@@ -15,6 +15,13 @@ export declare const HINT_AFTER = 2;
|
|
|
15
15
|
export declare const EDGE = 12;
|
|
16
16
|
export declare const GAP = 12;
|
|
17
17
|
export declare const SNAP = 80;
|
|
18
|
+
export declare const FLING_WINDOW_MS = 80;
|
|
19
|
+
export declare const FLING_MIN_SPEED = 0.6;
|
|
20
|
+
export declare const FLING_PROJECT_MS = 330;
|
|
21
|
+
export declare const RUBBER_PX = 48;
|
|
22
|
+
export declare const GLIDE_MS = 420;
|
|
23
|
+
export declare const GLIDE_EASE = "cubic-bezier(.32,.72,0,1)";
|
|
24
|
+
export declare const TIP_WARM_MS = 400;
|
|
18
25
|
export declare const NARROW_PLACE: DockPlace;
|
|
19
26
|
export declare const OUT_OF: Record<Edge, ChevronDir>;
|
|
20
27
|
export declare const RATE_PRESETS: number[];
|
package/dist/ui/ui.constants.js
CHANGED
|
@@ -22,6 +22,20 @@ export const EDGE = 12;
|
|
|
22
22
|
export const GAP = 12;
|
|
23
23
|
// Released this close to a side, the dock snaps flush against it.
|
|
24
24
|
export const SNAP = 80;
|
|
25
|
+
// A drag released within this long of its last move keeps the pointer's momentum: a flick throws
|
|
26
|
+
// the dock, a careful drop leaves it where it is.
|
|
27
|
+
export const FLING_WINDOW_MS = 80;
|
|
28
|
+
// Released faster than this (px/ms), the drag was a throw: the dock lands on the edge it heads for.
|
|
29
|
+
export const FLING_MIN_SPEED = 0.6;
|
|
30
|
+
// How far along that edge a throw carries: release velocity (px/ms) × this, iOS's deceleration.
|
|
31
|
+
export const FLING_PROJECT_MS = 330;
|
|
32
|
+
// Dragged past the viewport edge, the dock follows with growing resistance up to this many px.
|
|
33
|
+
export const RUBBER_PX = 48;
|
|
34
|
+
// The settle after a drop or a reset: Ionic's drawer curve, which reads as a damped spring.
|
|
35
|
+
export const GLIDE_MS = 420;
|
|
36
|
+
export const GLIDE_EASE = "cubic-bezier(.32,.72,0,1)";
|
|
37
|
+
// Pointer time on the dock before tooltips open instantly as it moves between buttons.
|
|
38
|
+
export const TIP_WARM_MS = 400;
|
|
25
39
|
export const NARROW_PLACE = { x: 0.5, y: 1, o: "h" };
|
|
26
40
|
// The hidden tab's chevron points out of its edge, toward where the dock comes back.
|
|
27
41
|
export const OUT_OF = { left: "right", right: "left", top: "down", bottom: "up" };
|
package/dist/ui/ui.hooks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
|
|
2
2
|
import { EDGE, GAP } from "./ui.constants";
|
|
3
|
-
import { clamp,
|
|
3
|
+
import { clamp, flingDock, glide, layoutBox, offsetIn, placeDock, prefersReducedMotion, releaseVelocity, rubberBand, takeShift, viewport, } from "./ui.lib";
|
|
4
4
|
export function useStore(store) {
|
|
5
5
|
const [state, setState] = useState(store.get());
|
|
6
6
|
useEffect(() => {
|
|
@@ -72,7 +72,8 @@ export function useCountdown(state) {
|
|
|
72
72
|
// `remaining` is already in seconds at the current rate, so wall-clock time subtracts directly.
|
|
73
73
|
return Math.max(state.remainingAfter, state.remaining - (now - since.current) / 1000);
|
|
74
74
|
}
|
|
75
|
-
// Re-places the dock on resize and as it grows or shrinks, so it grows around its centre.
|
|
75
|
+
// Re-places the dock on resize and as it grows or shrinks, so it grows around its centre. A new
|
|
76
|
+
// spot (a drop, a reset) glides there from wherever the dock is drawn.
|
|
76
77
|
export function useDockPlacement(ref, x, y, deps) {
|
|
77
78
|
useLayoutEffect(() => {
|
|
78
79
|
const el = ref.current;
|
|
@@ -82,7 +83,15 @@ export function useDockPlacement(ref, x, y, deps) {
|
|
|
82
83
|
if (el && !("drag" in el.dataset))
|
|
83
84
|
placeDock(el, x, y);
|
|
84
85
|
}
|
|
86
|
+
// Mid-drag the pointer owns the dock; the drop places it.
|
|
87
|
+
const settled = !("drag" in el.dataset);
|
|
88
|
+
const from = settled && "ready" in el.dataset ? layoutBox(el) : null;
|
|
89
|
+
const shift = settled ? takeShift(el) : { x: 0, y: 0 };
|
|
85
90
|
place();
|
|
91
|
+
if (from) {
|
|
92
|
+
const to = layoutBox(el);
|
|
93
|
+
glide(el, from.left + shift.x - to.left, from.top + shift.y - to.top);
|
|
94
|
+
}
|
|
86
95
|
// Glide only between placements, never from the unplaced (0, 0) of the first frame.
|
|
87
96
|
const ready = requestAnimationFrame(() => {
|
|
88
97
|
el.dataset.ready = "";
|
|
@@ -134,11 +143,16 @@ export function useAnchor(panel, anchor) {
|
|
|
134
143
|
px = toLeft ? 10 : -10;
|
|
135
144
|
}
|
|
136
145
|
top = Math.round(clamp(top, EDGE, vh - h - EDGE));
|
|
146
|
+
left = Math.round(clamp(left, EDGE, vw - w - EDGE));
|
|
137
147
|
el.dataset.top = String(top);
|
|
138
148
|
el.style.setProperty("--top", `${top}px`);
|
|
139
|
-
el.style.setProperty("--left", `${
|
|
149
|
+
el.style.setProperty("--left", `${left}px`);
|
|
140
150
|
el.style.setProperty("--px", `${px}px`);
|
|
141
151
|
el.style.setProperty("--py", `${py}px`);
|
|
152
|
+
// Grow out of the button that opened it: the edge facing the dock, level with that button.
|
|
153
|
+
const ox = flat ? `${Math.round(r.left + r.width / 2 - left)}px` : px > 0 ? "100%" : "0%";
|
|
154
|
+
const oy = flat ? (py > 0 ? "100%" : "0%") : `${Math.round(r.top + r.height / 2 - top)}px`;
|
|
155
|
+
el.style.setProperty("--origin", `${ox} ${oy}`);
|
|
142
156
|
}
|
|
143
157
|
// Every render: content may have changed size.
|
|
144
158
|
useLayoutEffect(() => place(false));
|
|
@@ -151,38 +165,63 @@ export function useAnchor(panel, anchor) {
|
|
|
151
165
|
return () => window.removeEventListener("resize", onResize);
|
|
152
166
|
}, []);
|
|
153
167
|
}
|
|
154
|
-
// The dock follows the pointer
|
|
168
|
+
// The dock follows the pointer on the compositor (translate, no layout), rubber-bands past the
|
|
169
|
+
// edges, and keeps a flick's momentum: the drop lands where the throw would carry it. The drop is
|
|
170
|
+
// committed once, so dragging never re-renders.
|
|
155
171
|
export function useDrag(target, o, onStart, onEnd) {
|
|
156
172
|
const latest = useRef({ onStart, onEnd, o });
|
|
157
173
|
latest.current = { onStart, onEnd, o };
|
|
158
174
|
return function startDrag(e) {
|
|
159
175
|
const el = target.current;
|
|
160
|
-
|
|
176
|
+
// One pointer at a time: a second finger mid-drag would make the dock jump to it.
|
|
177
|
+
if (!el || e.button !== 0 || "drag" in el.dataset)
|
|
161
178
|
return;
|
|
162
179
|
e.preventDefault();
|
|
163
180
|
const handle = e.currentTarget;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
181
|
+
// A grab mid-glide continues from where the dock is drawn, not from where it was heading.
|
|
182
|
+
const shift = takeShift(el);
|
|
183
|
+
const box = layoutBox(el);
|
|
184
|
+
const left0 = box.left;
|
|
185
|
+
const top0 = box.top;
|
|
186
|
+
const { width: vw, height: vh } = viewport();
|
|
187
|
+
let cx = left0 + shift.x + box.width / 2;
|
|
188
|
+
let cy = top0 + shift.y + box.height / 2;
|
|
167
189
|
// Keep the grab point under the pointer instead of jumping the dock's centre to it.
|
|
168
190
|
const dx = cx - e.clientX;
|
|
169
191
|
const dy = cy - e.clientY;
|
|
192
|
+
const samples = [{ t: e.timeStamp, x: e.clientX, y: e.clientY }];
|
|
193
|
+
function draw() {
|
|
194
|
+
const left = rubberBand(cx - box.width / 2, EDGE, vw - EDGE - box.width);
|
|
195
|
+
const top = rubberBand(cy - box.height / 2, EDGE, vh - EDGE - box.height);
|
|
196
|
+
el.style.translate = `${left - left0}px ${top - top0}px`;
|
|
197
|
+
}
|
|
170
198
|
function move(ev) {
|
|
171
199
|
cx = ev.clientX + dx;
|
|
172
200
|
cy = ev.clientY + dy;
|
|
173
|
-
|
|
174
|
-
|
|
201
|
+
samples.push({ t: ev.timeStamp, x: ev.clientX, y: ev.clientY });
|
|
202
|
+
if (samples.length > 8)
|
|
203
|
+
samples.shift();
|
|
204
|
+
draw();
|
|
175
205
|
}
|
|
176
|
-
function up() {
|
|
206
|
+
function up(ev) {
|
|
177
207
|
handle.removeEventListener("pointermove", move);
|
|
178
208
|
handle.removeEventListener("pointerup", up);
|
|
179
209
|
handle.removeEventListener("pointercancel", up);
|
|
180
210
|
delete el.dataset.drag;
|
|
211
|
+
const v = ev.type === "pointerup" ? releaseVelocity(samples, ev.timeStamp) : { vx: 0, vy: 0 };
|
|
181
212
|
const { width, height } = viewport();
|
|
182
|
-
latest.current.onEnd(
|
|
213
|
+
latest.current.onEnd(flingDock(cx, cy, v, latest.current.o, width, height));
|
|
214
|
+
// A drop on the spot it started from changes no props, so nothing re-places it: settle here.
|
|
215
|
+
requestAnimationFrame(() => {
|
|
216
|
+
if (!el || "drag" in el.dataset || !el.style.translate)
|
|
217
|
+
return;
|
|
218
|
+
const rest = takeShift(el);
|
|
219
|
+
glide(el, rest.x, rest.y);
|
|
220
|
+
});
|
|
183
221
|
}
|
|
184
222
|
handle.setPointerCapture?.(e.pointerId);
|
|
185
223
|
el.dataset.drag = "";
|
|
224
|
+
el.style.translate = `${shift.x}px ${shift.y}px`;
|
|
186
225
|
latest.current.onStart();
|
|
187
226
|
handle.addEventListener("pointermove", move);
|
|
188
227
|
handle.addEventListener("pointerup", up);
|
package/dist/ui/ui.lib.d.ts
CHANGED
|
@@ -13,8 +13,26 @@ export declare function viewport(): {
|
|
|
13
13
|
width: number;
|
|
14
14
|
height: number;
|
|
15
15
|
};
|
|
16
|
+
export declare function rubberBand(v: number, lo: number, hi: number): number;
|
|
17
|
+
export type Sample = {
|
|
18
|
+
t: number;
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function releaseVelocity(samples: readonly Sample[], now: number): {
|
|
23
|
+
vx: number;
|
|
24
|
+
vy: number;
|
|
25
|
+
};
|
|
26
|
+
export declare function takeShift(el: HTMLElement): {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function glide(el: HTMLElement, dx: number, dy: number): void;
|
|
16
31
|
export declare function placeDock(el: HTMLElement, x: number, y: number): void;
|
|
17
|
-
export declare function
|
|
32
|
+
export declare function flingDock(cx: number, cy: number, v: {
|
|
33
|
+
vx: number;
|
|
34
|
+
vy: number;
|
|
35
|
+
}, o: Orientation, vw: number, vh: number): DockPlace;
|
|
18
36
|
export declare function edgeOf(place: DockPlace): Edge;
|
|
19
37
|
export declare function hideDir(place: DockPlace): ChevronDir;
|
|
20
38
|
export declare function radioKeys(e: KeyboardEvent, count: number, current: number, select: (i: number) => void): void;
|
package/dist/ui/ui.lib.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { contrast } from "../lib/color";
|
|
2
|
-
import { EDGE, SNAP, SURFACE } from "./ui.constants";
|
|
2
|
+
import { EDGE, FLING_MIN_SPEED, FLING_PROJECT_MS, FLING_WINDOW_MS, GLIDE_EASE, GLIDE_MS, RUBBER_PX, SNAP, SURFACE, } from "./ui.constants";
|
|
3
3
|
import { fmt } from "./ui.i18n";
|
|
4
4
|
export function clamp(v, lo, hi) {
|
|
5
5
|
return Math.min(Math.max(v, lo), Math.max(lo, hi));
|
|
@@ -29,6 +29,48 @@ export function viewport() {
|
|
|
29
29
|
const root = document.documentElement;
|
|
30
30
|
return { width: root.clientWidth || window.innerWidth, height: root.clientHeight || window.innerHeight };
|
|
31
31
|
}
|
|
32
|
+
// Past an edge the dock still follows, with resistance that grows until it stops at RUBBER_PX.
|
|
33
|
+
// Apple's rubber-band curve: it never hits a wall, it slows down.
|
|
34
|
+
export function rubberBand(v, lo, hi) {
|
|
35
|
+
const band = (over) => (1 - 1 / ((over * 0.55) / RUBBER_PX + 1)) * RUBBER_PX;
|
|
36
|
+
if (v < lo)
|
|
37
|
+
return lo - band(lo - v);
|
|
38
|
+
if (v > hi)
|
|
39
|
+
return hi + band(v - hi);
|
|
40
|
+
return v;
|
|
41
|
+
}
|
|
42
|
+
// Release velocity in px/ms from the last moves. A pointer that stopped before letting go has
|
|
43
|
+
// none: the reader placed the dock rather than flinging it.
|
|
44
|
+
export function releaseVelocity(samples, now) {
|
|
45
|
+
const last = samples.at(-1);
|
|
46
|
+
const first = samples.find((s) => last && last.t - s.t <= FLING_WINDOW_MS);
|
|
47
|
+
if (!last || !first || now - last.t > FLING_WINDOW_MS || last.t === first.t)
|
|
48
|
+
return { vx: 0, vy: 0 };
|
|
49
|
+
const dt = last.t - first.t;
|
|
50
|
+
return { vx: (last.x - first.x) / dt, vy: (last.y - first.y) / dt };
|
|
51
|
+
}
|
|
52
|
+
const glides = new WeakMap();
|
|
53
|
+
// Where the dock is drawn relative to its left/top: a drag's offset, or a glide in flight. Reading
|
|
54
|
+
// it also stops the glide, so a grab or a new placement continues from what the reader sees.
|
|
55
|
+
export function takeShift(el) {
|
|
56
|
+
const shown = getComputedStyle(el).translate;
|
|
57
|
+
const [x = 0, y = 0] = (shown && shown !== "none" ? shown : el.style.translate).split(" ").map(parseFloat);
|
|
58
|
+
glides.get(el)?.cancel();
|
|
59
|
+
glides.delete(el);
|
|
60
|
+
el.style.translate = "";
|
|
61
|
+
return { x: x || 0, y: y || 0 };
|
|
62
|
+
}
|
|
63
|
+
// Moves the dock's left/top at once, then animates the drawing from where it was. Translate only,
|
|
64
|
+
// so the glide runs on the compositor and never re-lays out the page.
|
|
65
|
+
export function glide(el, dx, dy) {
|
|
66
|
+
if (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5)
|
|
67
|
+
return;
|
|
68
|
+
if (typeof el.animate !== "function" || el.closest("[data-still]") || prefersReducedMotion())
|
|
69
|
+
return;
|
|
70
|
+
const anim = el.animate({ translate: [`${dx}px ${dy}px`, "0px 0px"] }, { duration: GLIDE_MS, easing: GLIDE_EASE });
|
|
71
|
+
glides.set(el, anim);
|
|
72
|
+
anim.onfinish = () => glides.get(el) === anim && glides.delete(el);
|
|
73
|
+
}
|
|
32
74
|
// Centre at (x, y) as viewport fractions, kept fully on screen whatever the dock's size.
|
|
33
75
|
export function placeDock(el, x, y) {
|
|
34
76
|
const { width: vw, height: vh } = viewport();
|
|
@@ -38,7 +80,7 @@ export function placeDock(el, x, y) {
|
|
|
38
80
|
el.style.top = `${Math.round(clamp(y * vh - h / 2, EDGE, vh - EDGE - h))}px`;
|
|
39
81
|
}
|
|
40
82
|
// Near a side the dock snaps flush: upright on the left/right edge, flat on the top/bottom one.
|
|
41
|
-
|
|
83
|
+
function dropDock(cx, cy, o, vw, vh) {
|
|
42
84
|
const x = clamp(cx / vw, 0, 1);
|
|
43
85
|
const y = clamp(cy / vh, 0, 1);
|
|
44
86
|
if (cx < SNAP)
|
|
@@ -51,6 +93,17 @@ export function dropDock(cx, cy, o, vw, vh) {
|
|
|
51
93
|
return { x, y: 1, o: "h" };
|
|
52
94
|
return { x, y, o };
|
|
53
95
|
}
|
|
96
|
+
// A throw lands on the edge it heads for, as far along it as its momentum carries. Anything slower
|
|
97
|
+
// is a placement: the dock stays where it was let go.
|
|
98
|
+
export function flingDock(cx, cy, v, o, vw, vh) {
|
|
99
|
+
if (Math.hypot(v.vx, v.vy) < FLING_MIN_SPEED)
|
|
100
|
+
return dropDock(cx, cy, o, vw, vh);
|
|
101
|
+
const x = clamp((cx + v.vx * FLING_PROJECT_MS) / vw, 0, 1);
|
|
102
|
+
const y = clamp((cy + v.vy * FLING_PROJECT_MS) / vh, 0, 1);
|
|
103
|
+
if (Math.abs(v.vx) >= Math.abs(v.vy))
|
|
104
|
+
return { x: v.vx < 0 ? 0 : 1, y, o: "v" };
|
|
105
|
+
return { x, y: v.vy < 0 ? 0 : 1, o: "h" };
|
|
106
|
+
}
|
|
54
107
|
export function edgeOf(place) {
|
|
55
108
|
if (place.o === "h")
|
|
56
109
|
return place.y < 0.5 ? "top" : "bottom";
|
package/dist/ui/ui.styles.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const UI_CSS = "\n:host{all:initial}\n.lt{\n --bg:#161513;--bg2:#201e1b;--bg3:#2c2a26;--ln:rgba(255,244,228,.08);--ln2:rgba(255,244,228,.16);\n --tx:#f7f4ee;--mu:#aba69c;--hv:rgba(255,244,228,.07);\n --sh:0 1px 2px rgba(0,0,0,.2),0 18px 44px -10px rgba(0,0,0,.5);\n --ease:cubic-bezier(.2,.8,.2,1);--out:cubic-bezier(.4,0,1,1);\n --gap:12px;--cell:32px;--pad:4px;--rw:calc(var(--cell) + var(--pad)*2);--dx:16px;--dy:0px;--safe:env(safe-area-inset-bottom,0px);color-scheme:dark;\n font:400 14px/1.4 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif;\n color:var(--tx);letter-spacing:normal;word-spacing:normal;text-align:left;text-transform:none;\n white-space:normal;font-style:normal;direction:ltr;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;\n}\n.lt[data-side=left]{--dx:-16px}\n.lt[data-side=top]{--dx:0px;--dy:-16px}\n.lt[data-side=bottom]{--dx:0px;--dy:16px}\n.lt *,.lt *::before,.lt *::after{box-sizing:border-box}\n/* Resets wrapped in :where() so they carry zero specificity and never beat component rules. */\n:where(.lt) :where(button,input,h2,h3,p){font:inherit;color:inherit;letter-spacing:inherit;margin:0}\n:where(.lt) button{background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:background-color .15s,color .15s,border-color .15s,transform .16s var(--ease),opacity .15s}\n:where(.lt) button:where(:active:not(:disabled)){transform:scale(.94)}\n:where(.lt) button:where(:disabled){cursor:default}\n.lt :focus{outline:none}\n.lt :focus-visible{outline:2px solid #fff;outline-offset:0;box-shadow:0 0 0 4px #0b0b0d}\n.lt svg{display:block;flex:none}\n.sr{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n\n.surface{background:var(--bg);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:auto}\n.ghost{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;color:var(--tx)}\n.ghost.sm{width:32px;height:32px}\n.ghost:disabled{opacity:.35}\n@media (hover:hover){.ghost:not(:disabled):hover,.opt:hover{background:var(--hv)}}\n\n/* Dock: the listening rail and, set apart, the reading-aids puck. Placed in px by useDockPlacement\n (0 and 1 sit flush on an edge); upright on a side, flat along the top or bottom. After a drag it\n glides to its resting place instead of jumping. */\n.dock{position:fixed;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;animation:lt-in .36s var(--ease) both}\n.dock[data-ready]{transition:left .32s var(--ease),top .32s var(--ease)}\n.dock[data-o=h]{flex-direction:row}\n.dock[data-drag]{transition:none}\n.dock[data-leave]{animation:lt-out .16s var(--out) both}\n.dock[data-leave] *{pointer-events:none!important}\n/* Every control in the rail is one --cell square on the same grid, with --pad all round, so the\n spacing is identical between icons and at both ends, upright or flat. */\n.rail{width:var(--rw);padding:var(--pad) 0;border-radius:calc(var(--rw)/2);display:flex;flex-direction:column;align-items:center}\n.dock[data-o=h] .rail{width:auto;height:var(--rw);padding:0 var(--pad);flex-direction:row}\n.rail .ghost,.grip,.playwrap,.time,.speed,.hide{width:var(--cell);height:var(--cell);flex:none}\n.dock[data-drag] .rail,.dock[data-drag] .puck{box-shadow:0 1px 2px rgba(0,0,0,.2),0 26px 60px -12px rgba(0,0,0,.6)}\n/* The handle's dots run across the dock, so it reads as a grip and not as more content. */\n.grip{display:grid;place-items:center;color:var(--mu);opacity:.6;cursor:grab;touch-action:none;transition:opacity .15s}\n.dock[data-o=v] .grip svg{transform:rotate(90deg)}\n@media (hover:hover){.grip:hover{opacity:1}}\n.dock[data-drag] .grip{cursor:grabbing;opacity:1}\n/* Session-only controls unfold instead of popping in, so the dock grows smoothly. */\n.xtra{display:flex;flex:none;max-height:var(--cell);max-width:var(--cell);overflow:hidden;transition:max-height .34s var(--ease),max-width .34s var(--ease),opacity .22s .1s}\n.rail:not([data-active]) .xtra{opacity:0;visibility:hidden;transition:max-height .3s var(--ease),max-width .3s var(--ease),opacity .1s,visibility 0s .3s}\n.dock[data-o=v] .rail:not([data-active]) .xtra{max-height:0}\n.dock[data-o=h] .rail:not([data-active]) .xtra{max-width:0}\n.playwrap{position:relative;display:grid;place-items:center}\n.play{width:calc(var(--cell) - 6px);height:calc(var(--cell) - 6px);border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 3px 10px -4px color-mix(in srgb,var(--a) 75%,transparent);transition:width .3s var(--ease),height .3s var(--ease),transform .16s var(--ease),background-color .2s,color .2s}\n/* Preparing a lifelike voice: the button steps back and the ring carries the download. */\n.play.load{background:var(--bg3);color:var(--a);box-shadow:none}\n.play svg{animation:lt-swap .2s var(--ease)}\n.ring{position:absolute;inset:0;pointer-events:none;animation:lt-fade .3s both}\n.ring svg{width:100%;height:100%;transform:rotate(-90deg)}\n.ring circle{fill:none;stroke:var(--ln2);stroke-width:2.5}\n.ring .prg{stroke:var(--a);stroke-linecap:round;transition:stroke-dashoffset .6s var(--ease)}\n.ring.load .prg{animation:lt-breathe 1.6s ease-in-out infinite}\n.time{display:grid;place-items:center;font-size:10px;font-weight:600;letter-spacing:-.02em;color:var(--mu);font-variant-numeric:tabular-nums;white-space:nowrap;transition:color .2s}\n.time.load{color:var(--a)}\n.sep{width:16px;height:1px;flex:none;background:var(--ln2);margin:var(--pad) 0}\n.dock[data-o=h] .sep{width:1px;height:16px;margin:0 var(--pad)}\n.vb{position:relative}\n.vb[aria-expanded=true]{background:var(--hv)}\n/* The one-time voice hint points here. */\n.vb[data-hint]{background:color-mix(in srgb,var(--a) 16%,transparent);color:var(--a);box-shadow:0 0 0 2px color-mix(in srgb,var(--a) 40%,transparent)}\n.speed{border-radius:50%;font-size:10px;font-weight:700;letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap}\n.speed[aria-expanded=true]{background:var(--hv)}\n.hide{color:var(--mu)}\n.dot{position:absolute;top:5px;right:4px;width:6px;height:6px;border-radius:50%;background:var(--a);box-shadow:0 0 0 2px var(--bg);animation:lt-pop-dot .25s var(--ease)}\n.puck{position:relative;width:var(--rw);height:var(--rw);flex:none;border-radius:14px;display:grid;place-items:center;color:var(--tx)}\n.puck[aria-expanded=true]{background:var(--bg3);border-color:var(--ln2)}\n.puck .dot{top:7px;right:7px;width:7px;height:7px}\n.puck[aria-expanded=true] .dot{box-shadow:0 0 0 2px var(--bg3)}\n@media (hover:hover){.speed:hover{background:var(--hv)}.hide:hover{color:var(--tx)}.puck:not([aria-expanded=true]):hover{background:var(--bg2)}}\n\n/* Tooltips name each icon for pointer users; screen readers get the aria-label instead. They open\n away from the dock's edge. */\n@media (hover:hover) and (pointer:fine){\n .dock [data-tip]::after{content:attr(data-tip);position:absolute;top:50%;right:calc(100% + 14px);padding:6px 10px;border-radius:9px;background:var(--bg);border:1px solid var(--ln2);box-shadow:var(--sh);color:var(--tx);font-size:12.5px;font-weight:500;letter-spacing:0;white-space:nowrap;pointer-events:none;opacity:0;transform:translate(4px,-50%);transition:opacity .12s,transform .15s var(--ease)}\n .dock [data-tip]{position:relative}\n .dock [data-tip]:hover::after{opacity:1;transform:translate(0,-50%);transition-delay:.4s}\n .lt[data-side=left] .dock [data-tip]::after{right:auto;left:calc(100% + 14px);transform:translate(-4px,-50%)}\n .lt[data-side=left] .dock [data-tip]:hover::after{transform:translate(0,-50%)}\n .lt[data-side=bottom] .dock [data-tip]::after,.lt[data-side=top] .dock [data-tip]::after{right:auto;left:50%;top:auto;bottom:calc(100% + 14px);transform:translate(-50%,4px)}\n .lt[data-side=top] .dock [data-tip]::after{bottom:auto;top:calc(100% + 14px);transform:translate(-50%,-4px)}\n .lt[data-side=bottom] .dock [data-tip]:hover::after,.lt[data-side=top] .dock [data-tip]:hover::after{transform:translate(-50%,0)}\n .dock[data-drag] [data-tip]::after,.dock [aria-expanded=true]::after{display:none}\n}\n\n/* Hidden: a small tab on the nearest edge. While audio plays it shows only the playing bars. */\n.tab{position:fixed;top:clamp(40px,calc(var(--y,.5)*100%),calc(100% - 40px));right:0;width:28px;height:56px;transform:translateY(-50%);border-radius:14px 0 0 14px;border-right:0;display:grid;place-items:center;color:var(--tx);transition:width .2s var(--ease),height .2s var(--ease);animation:lt-tab .3s .08s var(--ease) both}\n.lt[data-side=left] .tab{right:auto;left:0;border-radius:0 14px 14px 0;border-right:1px solid var(--ln);border-left:0}\n.lt[data-side=bottom] .tab,.lt[data-side=top] .tab{top:auto;bottom:0;right:auto;left:clamp(40px,calc(var(--x,.5)*100%),calc(100% - 40px));width:56px;height:28px;transform:translateX(-50%);border-radius:14px 14px 0 0;border:1px solid var(--ln);border-bottom:0}\n.lt[data-side=top] .tab{bottom:auto;top:0;border-radius:0 0 14px 14px;border-top:0;border-bottom:1px solid var(--ln)}\n.tab:active{transform:translateY(-50%)}\n.lt[data-side=bottom] .tab:active,.lt[data-side=top] .tab:active{transform:translateX(-50%)}\n.tab[data-leave]{animation:lt-tab-out .14s var(--out) both;pointer-events:none}\n@media (hover:hover){.lt[data-side=left] .tab:hover,.lt[data-side=right] .tab:hover{width:34px}.lt[data-side=bottom] .tab:hover,.lt[data-side=top] .tab:hover{height:34px}}\n\n/* Popovers sit next to the dock (placed by useAnchor) and grow out of it: --px/--py point back\n toward the dock. */\n.pop,.toast{position:fixed;top:var(--top,50%);left:var(--left,auto);animation:lt-pop .22s var(--ease) both}\n.pop[data-leave],.toast[data-leave]{animation:lt-pop-out .14s var(--out) both;pointer-events:none}\n.pop{width:min(320px,calc(100% - 24px));max-height:calc(100% - 24px);border-radius:20px;display:flex;flex-direction:column}\n.speedpop{width:min(300px,calc(100% - 24px));padding:16px 16px 14px}\n.label{display:flex;justify-content:space-between;align-items:baseline;font-size:12.5px;font-weight:600;color:var(--mu);margin-bottom:8px}\n.label b{font-size:15px;font-weight:650;color:var(--tx);font-variant-numeric:tabular-nums}\n.stepper{display:flex;align-items:center;gap:8px}\n.range{flex:1;-webkit-appearance:none;appearance:none;height:28px;background:transparent;cursor:pointer}\n.range::-webkit-slider-runnable-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--a) var(--p),var(--ln2) var(--p))}\n.range::-moz-range-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--a) var(--p),var(--ln2) var(--p))}\n.range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-7px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px rgba(0,0,0,.45)}\n.range::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px rgba(0,0,0,.45)}\n.range:focus-visible{box-shadow:none;outline:2px solid #fff;outline-offset:2px;border-radius:6px}\n.presets{display:flex;gap:4px;margin-top:8px}\n.presets button{flex:1;height:30px;border-radius:9px;font-size:12.5px;font-weight:600;color:var(--mu);font-variant-numeric:tabular-nums}\n.presets button[aria-pressed=true]{background:var(--bg3);color:var(--tx)}\n@media (hover:hover){.presets button:hover{color:var(--tx)}}\n\n.voicepop{padding:6px}\n.voices{display:flex;flex-direction:column;gap:2px;min-height:0;max-height:min(540px,calc(100vh - 40px));overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,244,228,.22) transparent;scroll-padding-top:58px}\n.group{position:sticky;top:0;z-index:1;display:flex;flex-direction:column;gap:1px;padding:10px 10px 6px;background:var(--bg)}\n.group+.opt{margin-top:0}\n.opt+.group{margin-top:6px;box-shadow:0 -1px 0 var(--ln)}\n.group b{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--mu)}\n.group b svg{color:var(--a)}\n.group:first-child b{color:var(--tx)}\n.group span{font-size:11.5px;color:var(--mu);opacity:.8}\n.opt{display:flex;align-items:center;gap:11px;width:100%;min-height:50px;padding:6px 10px;border-radius:14px;text-align:left}\n.opt[aria-checked=true]{background:var(--bg2)}\n.av{flex:none;width:32px;height:32px;border-radius:50%;background:var(--bg3);display:grid;place-items:center;font-size:13.5px;font-weight:700;color:var(--tx);transition:background-color .2s,color .2s}\n.opt[aria-checked=true] .av{background:var(--a);color:var(--ai)}\n.opt .n{flex:1;min-width:0}\n.opt .n b{display:block;font-weight:600;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.opt .sub{display:block;font-size:12px;color:var(--mu);margin-top:1px}\n.opt .tick{color:var(--a);opacity:0;transform:scale(.6);transition:opacity .15s,transform .2s var(--ease)}\n.opt[aria-checked=true] .tick{opacity:1;transform:none}\n.tag{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:5px;font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;vertical-align:1px;color:var(--a);background:color-mix(in srgb,var(--a) 16%,transparent)}\n.empty,.tip{font-size:12.5px;color:var(--mu);line-height:1.5}\n.empty{padding:10px}\n.tip{margin:6px;padding:10px 12px;border-radius:12px;background:var(--bg2)}\n\n/* Accessibility panel */\n.panel{width:min(368px,calc(100% - 24px))}\n.phead{display:flex;align-items:center;gap:4px;padding:12px 10px 4px 18px}\n.phead h2{flex:1;font-size:16px;font-weight:650;letter-spacing:-.01em}\n.reset{height:30px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;color:var(--a)}\n.reset:disabled{color:var(--mu);opacity:.5}\n@media (hover:hover){.reset:not(:disabled):hover{background:var(--hv)}}\n.body{overflow:auto;padding:0 14px 16px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,244,228,.22) transparent}\n.panel h3{margin:16px 2px 8px;font-size:12.5px;font-weight:600;color:var(--mu)}\n.chips{display:flex;flex-wrap:wrap;gap:6px}\n.pchip{height:34px;padding:0 13px 0 10px;border-radius:999px;display:flex;align-items:center;gap:7px;font-size:13px;font-weight:600;background:var(--bg2);border:1px solid var(--ln)}\n.pchip svg{color:var(--mu)}\n.pchip[aria-pressed=true]{background:var(--a);color:var(--ai);border-color:transparent}\n.pchip[aria-pressed=true] svg{color:inherit}\n@media (hover:hover){.pchip[aria-pressed=false]:hover{border-color:var(--ln2)}}\n.hint{margin:8px 2px 0;min-height:36px;font-size:12.5px;line-height:1.45;color:var(--mu)}\n\n.size{display:flex;align-items:center;gap:6px;padding:6px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);margin-bottom:6px}\n.step{width:44px;height:44px;border-radius:10px;background:var(--bg3);display:grid;place-items:center}\n.step:disabled{opacity:.35}\n@media (hover:hover){.step:not(:disabled):hover{background:#33333b}}\n.step .a{font-weight:700;line-height:1}\n.step .sm{font-size:13px}\n.step .lg{font-size:20px}\n.val{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px}\n.val span{font-size:11.5px;color:var(--mu)}\n.val b{font-size:15px;font-weight:650;font-variant-numeric:tabular-nums;line-height:1.1}\n.pips{display:flex;gap:3px}\n.pips i{display:block;width:12px;height:3px;border-radius:2px;background:var(--ln2);transition:background-color .15s}\n.pips i.f{background:var(--a)}\n\n.tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}\n.tiles.two{grid-template-columns:repeat(2,1fr)}\n.tile{position:relative;min-height:76px;padding:12px 6px 10px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;font-size:12.5px;font-weight:600;line-height:1.2;text-align:center}\n.tile svg{color:var(--mu);transition:color .15s}\n.tile[aria-checked=true],.tile[data-on]{background:color-mix(in srgb,var(--a) 15%,var(--bg2));border-color:color-mix(in srgb,var(--a) 65%,transparent)}\n.tile[aria-checked=true] svg,.tile[data-on] svg{color:var(--a)}\n.tile .ck{position:absolute;top:7px;right:7px;width:16px;height:16px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;transform:scale(0);transition:transform .18s var(--ease)}\n.tile[aria-checked=true] .ck{transform:scale(1)}\n.tile .ck svg{color:inherit;stroke-width:3.2}\n.tl{display:flex;flex-direction:column;align-items:center;gap:6px}\n/* Text tiles sit two to a row, so they lie flat to keep the panel short. */\n.tiles.two .tile{flex-direction:row;justify-content:flex-start;min-height:54px;padding:8px 12px;gap:10px;text-align:left}\n.tiles.two .tl{align-items:flex-start;gap:5px}\n@media (hover:hover){.tile:hover{border-color:var(--ln2)}}\n\n.swatches{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}\n.sw{display:flex;flex-direction:column;align-items:center;gap:6px;padding:6px 2px 7px;border-radius:12px;font-size:11.5px;font-weight:600;color:var(--mu);white-space:nowrap}\n.sw .prev{width:100%;max-width:48px;aspect-ratio:1;border-radius:11px;display:grid;place-items:center;font-size:16px;font-weight:700;border:1px solid var(--ln2);transition:box-shadow .15s}\n.sw .invert span{background:linear-gradient(135deg,#18181b 50%,#f4f4f5 50%);-webkit-background-clip:text;background-clip:text}\n.sw[aria-checked=true]{color:var(--tx)}\n.sw[aria-checked=true] .prev{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--a)}\n@media (hover:hover){.sw[aria-checked=false]:hover{color:var(--tx)}}\n.toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;margin-top:6px;padding:0 12px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);font-size:13px;font-weight:600;text-align:left}\n.toggle svg{color:var(--mu)}\n.toggle span:first-of-type{flex:1}\n.knobs{position:relative;flex:none;width:36px;height:22px;border-radius:999px;background:var(--bg3);transition:background-color .18s}\n.knobs::after{content:\"\";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s var(--ease)}\n.toggle[aria-checked=true] .knobs{background:var(--a)}\n.toggle[aria-checked=true] .knobs::after{transform:translateX(14px)}\n\n/* Toast beside the dock (placed like a popover) */\n.toast{max-width:min(340px,calc(100% - 24px));display:flex;align-items:center;gap:8px;padding:6px 6px 6px 14px;border-radius:16px;font-size:13px;font-weight:500}\n.toast span{flex:1;min-width:0}\n.btn{height:32px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;white-space:nowrap}\n.btn.primary{background:var(--a);color:var(--ai)}\n\n/* Equaliser bars: animate only while audio plays */\n.bars{display:inline-flex;align-items:center;gap:2px;height:12px}\n.bars i{display:block;width:2.5px;height:100%;border-radius:2px;background:var(--a);transform:scaleY(.35);transform-origin:50% 50%}\n.on .bars i{animation:lt-bar .9s ease-in-out infinite alternate}\n.on .bars i:nth-child(2){animation-delay:-.45s;animation-duration:.7s}\n.on .bars i:nth-child(3){animation-delay:-.2s;animation-duration:1.1s}\n.on .bars i:nth-child(4){animation-delay:-.6s;animation-duration:.8s}\n\n/* Play from here */\n.here{position:fixed;top:0;left:0;width:28px;height:28px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 4px 12px -2px rgba(0,0,0,.35);pointer-events:auto;opacity:0;transform:scale(.6);transition:opacity .15s,transform .18s var(--ease)}\n.here.on{opacity:1;transform:scale(1)}\n.selchip{position:fixed;top:0;left:0;height:34px;padding:0 13px 0 9px;border-radius:999px;display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;animation:lt-in-soft .2s var(--ease) both}\n.selchip .disc{width:20px;height:20px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center}\n\n/* Reading guide & mask */\n.guide{position:fixed;left:0;right:0;top:0;height:30px;margin-top:-15px;pointer-events:none;background:rgba(255,214,90,.16);border-top:2px solid rgba(240,180,0,.85);border-bottom:2px solid rgba(240,180,0,.85);will-change:transform}\n.shade{position:fixed;left:0;right:0;top:0;height:100%;pointer-events:none;background:rgba(8,8,10,.66);will-change:transform}\n\n@keyframes lt-in{from{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.96)}}\n@keyframes lt-out{to{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.96)}}\n@keyframes lt-tab{from{opacity:0}}\n@keyframes lt-tab-out{to{opacity:0}}\n@keyframes lt-pop{from{opacity:0;transform:translate(var(--px,0px),var(--py,0px)) scale(.97)}}\n@keyframes lt-pop-out{to{opacity:0;transform:translate(calc(var(--px,0px)*.6),calc(var(--py,0px)*.6)) scale(.98)}}\n@keyframes lt-sheet{from{opacity:0;transform:translateY(24px)}}\n@keyframes lt-sheet-out{to{opacity:0;transform:translateY(16px)}}\n@keyframes lt-in-soft{from{opacity:0;transform:translateY(8px) scale(.97)}}\n@keyframes lt-swap{from{opacity:0;transform:scale(.7)}}\n@keyframes lt-fade{from{opacity:0}}\n@keyframes lt-pop-dot{from{transform:scale(0)}}\n@keyframes lt-bar{to{transform:scaleY(1)}}\n@keyframes lt-breathe{50%{opacity:.45}}\n\n/* Phones: panels become bottom sheets */\n@media (max-width:540px){\n .lt{--gap:8px;--cell:40px}\n /* The flat bottom dock is fixed on phones: no handle, and thumb-sized targets. */\n .grip{display:none}\n .speed,.time{font-size:11px}\n .puck{border-radius:16px}\n .pop,.toast{top:auto;bottom:calc(8px + var(--safe));left:8px;right:8px;width:auto;max-width:none;transform-origin:center bottom;animation-name:lt-sheet}\n .pop[data-leave],.toast[data-leave]{animation-name:lt-sheet-out}\n .pop{max-height:min(80vh,640px);border-radius:24px}\n}\n/* Motion off: every animation and transition takes no time. Zero durations rather than\n animation:none, which would replay every entrance animation (the dock and an open panel sliding\n in again) the moment \"pause animations\" is switched back off. */\n@media (prefers-reduced-motion:reduce){.lt *,.lt *::before,.lt *::after{animation-duration:0s!important;animation-delay:0s!important;transition-duration:0s!important;transition-delay:0s!important}}\n.lt[data-still] *,.lt[data-still] *::before,.lt[data-still] *::after{animation-duration:0s!important;animation-delay:0s!important;transition-duration:0s!important;transition-delay:0s!important}\n/* Printing the article prints the article: no dock, guide, mask or panels on every page. */\n@media print{.lt{display:none!important}}\n@media (forced-colors:active){\n .surface,.play,.speed,.pchip,.tile,.size,.toggle,.sw .prev,.disc{border:1px solid CanvasText}\n .ring .prg,.pips i.f,.knobs,.dot{background:Highlight;stroke:Highlight}\n .tile[aria-checked=true],.tile[data-on],.pchip[aria-pressed=true]{outline:2px solid Highlight}\n}\n";
|
|
1
|
+
export declare const UI_CSS = "\n:host{all:initial}\n.lt{\n --bg:#161513;--bg2:#201e1b;--bg3:#2c2a26;--ln:rgba(255,244,228,.08);--ln2:rgba(255,244,228,.16);\n --tx:#f7f4ee;--mu:#aba69c;--hv:rgba(255,244,228,.07);\n --sh:0 1px 2px rgba(0,0,0,.2),0 18px 44px -10px rgba(0,0,0,.5);\n --ease:cubic-bezier(.23,1,.32,1);--drawer:cubic-bezier(.32,.72,0,1);\n --gap:12px;--cell:32px;--pad:4px;--rw:calc(var(--cell) + var(--pad)*2);--dx:16px;--dy:0px;--safe:env(safe-area-inset-bottom,0px);color-scheme:dark;\n font:400 14px/1.4 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif;\n color:var(--tx);letter-spacing:normal;word-spacing:normal;text-align:left;text-transform:none;\n white-space:normal;font-style:normal;direction:ltr;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;\n}\n.lt[data-side=left]{--dx:-16px}\n.lt[data-side=top]{--dx:0px;--dy:-16px}\n.lt[data-side=bottom]{--dx:0px;--dy:16px}\n.lt *,.lt *::before,.lt *::after{box-sizing:border-box}\n/* Resets wrapped in :where() so they carry zero specificity and never beat component rules. */\n:where(.lt) :where(button,input,h2,h3,p){font:inherit;color:inherit;letter-spacing:inherit;margin:0}\n:where(.lt) button{background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:background-color .15s,color .15s,border-color .15s,transform .16s var(--ease),opacity .15s}\n:where(.lt) button:where(:active:not(:disabled)){transform:scale(.96)}\n:where(.lt) button:where(:disabled){cursor:default}\n.lt :focus{outline:none}\n.lt :focus-visible{outline:2px solid #fff;outline-offset:0;box-shadow:0 0 0 4px #0b0b0d}\n.lt svg{display:block;flex:none}\n.sr{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n\n.surface{background:var(--bg);border:1px solid var(--ln);box-shadow:var(--sh);pointer-events:auto}\n.ghost{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;color:var(--tx)}\n.ghost.sm{width:32px;height:32px}\n.ghost:disabled{opacity:.35}\n@media (hover:hover){.ghost:not(:disabled):hover,.opt:hover{background:var(--hv)}}\n\n/* Dock: the listening rail and, set apart, the reading-aids puck. Placed in px by useDockPlacement\n (0 and 1 sit flush on an edge); upright on a side, flat along the top or bottom. Dragging and the\n glide after a drop move it with translate only, so they never re-lay out the page. */\n.dock{position:fixed;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;animation:lt-in .3s var(--ease) both}\n.dock[data-o=h]{flex-direction:row}\n.dock[data-drag]{will-change:translate}\n.dock[data-leave]{animation:lt-out .16s var(--ease) both}\n.dock[data-leave] *{pointer-events:none!important}\n/* Every control in the rail is one --cell square on the same grid, with --pad all round, so the\n spacing is identical between icons and at both ends, upright or flat. */\n.rail{width:var(--rw);padding:var(--pad) 0;border-radius:calc(var(--rw)/2);display:flex;flex-direction:column;align-items:center}\n.dock[data-o=h] .rail{width:auto;height:var(--rw);padding:0 var(--pad);flex-direction:row}\n.rail .ghost,.grip,.playwrap,.time,.speed,.hide{width:var(--cell);height:var(--cell);flex:none}\n/* The puck is a button: it keeps the button transitions and adds the shadow's. */\n.rail{transition:box-shadow .2s var(--ease)}\n.puck{transition:background-color .15s,transform .16s var(--ease),box-shadow .2s var(--ease)}\n.dock[data-drag] .rail,.dock[data-drag] .puck{box-shadow:0 1px 2px rgba(0,0,0,.2),0 26px 60px -12px rgba(0,0,0,.6)}\n/* The handle's dots run across the dock, so it reads as a grip and not as more content. */\n.grip{display:grid;place-items:center;color:var(--mu);opacity:.6;cursor:grab;touch-action:none;transition:opacity .15s}\n.dock[data-o=v] .grip svg{transform:rotate(90deg)}\n@media (hover:hover){.grip:hover{opacity:1}}\n.dock[data-drag] .grip{cursor:grabbing;opacity:1}\n/* Session-only controls unfold instead of popping in, so the dock grows smoothly. */\n.xtra{display:flex;flex:none;max-height:var(--cell);max-width:var(--cell);overflow:hidden;transition:max-height .28s var(--ease),max-width .28s var(--ease),opacity .2s .08s}\n.rail:not([data-active]) .xtra{opacity:0;visibility:hidden;transition:max-height .24s var(--ease),max-width .24s var(--ease),opacity .1s,visibility 0s .24s}\n.dock[data-o=v] .rail:not([data-active]) .xtra{max-height:0}\n.dock[data-o=h] .rail:not([data-active]) .xtra{max-width:0}\n.playwrap{position:relative;display:grid;place-items:center}\n.play{width:calc(var(--cell) - 6px);height:calc(var(--cell) - 6px);border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 3px 10px -4px color-mix(in srgb,var(--a) 75%,transparent);transition:width .3s var(--ease),height .3s var(--ease),transform .16s var(--ease),background-color .2s,color .2s}\n/* Preparing a lifelike voice: the button steps back and the ring carries the download. */\n.play.load{background:var(--bg3);color:var(--a);box-shadow:none}\n.play svg{animation:lt-swap .2s var(--ease)}\n.ring{position:absolute;inset:0;pointer-events:none;animation:lt-fade .3s both}\n.ring svg{width:100%;height:100%;transform:rotate(-90deg)}\n.ring circle{fill:none;stroke:var(--ln2);stroke-width:2.5}\n.ring .prg{stroke:var(--a);stroke-linecap:round;transition:stroke-dashoffset .6s var(--ease)}\n.ring.load .prg{animation:lt-breathe 1.6s ease-in-out infinite}\n.time{display:grid;place-items:center;font-size:10px;font-weight:600;letter-spacing:-.02em;color:var(--mu);font-variant-numeric:tabular-nums;white-space:nowrap;transition:color .2s}\n.time.load{color:var(--a)}\n.sep{width:16px;height:1px;flex:none;background:var(--ln2);margin:var(--pad) 0}\n.dock[data-o=h] .sep{width:1px;height:16px;margin:0 var(--pad)}\n.vb{position:relative}\n.vb[aria-expanded=true]{background:var(--hv)}\n/* The one-time voice hint points here. */\n.vb[data-hint]{background:color-mix(in srgb,var(--a) 16%,transparent);color:var(--a);box-shadow:0 0 0 2px color-mix(in srgb,var(--a) 40%,transparent)}\n.speed{border-radius:50%;font-size:10px;font-weight:700;letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap}\n.speed[aria-expanded=true]{background:var(--hv)}\n.hide{color:var(--mu)}\n.dot{position:absolute;top:5px;right:4px;width:6px;height:6px;border-radius:50%;background:var(--a);box-shadow:0 0 0 2px var(--bg);animation:lt-pop-dot .25s var(--ease)}\n.puck{position:relative;width:var(--rw);height:var(--rw);flex:none;border-radius:14px;display:grid;place-items:center;color:var(--tx)}\n.puck[aria-expanded=true]{background:var(--bg3);border-color:var(--ln2)}\n.puck .dot{top:7px;right:7px;width:7px;height:7px}\n.puck[aria-expanded=true] .dot{box-shadow:0 0 0 2px var(--bg3)}\n@media (hover:hover){.speed:hover{background:var(--hv)}.hide:hover{color:var(--tx)}.puck:not([aria-expanded=true]):hover{background:var(--bg2)}}\n\n/* Tooltips name each icon for pointer users; screen readers get the aria-label instead. They open\n away from the dock's edge. */\n@media (hover:hover) and (pointer:fine){\n .dock [data-tip]::after{content:attr(data-tip);position:absolute;top:50%;right:calc(100% + 14px);padding:6px 10px;border-radius:9px;background:var(--bg);border:1px solid var(--ln2);box-shadow:var(--sh);color:var(--tx);font-size:12.5px;font-weight:500;letter-spacing:0;white-space:nowrap;pointer-events:none;opacity:0;transform:translate(4px,-50%);transition:opacity .12s,transform .15s var(--ease)}\n .dock [data-tip]{position:relative}\n .dock [data-tip]:hover::after{opacity:1;transform:translate(0,-50%);transition-delay:.4s}\n .dock[data-warm] [data-tip]:hover::after{transition-delay:0s;transition-duration:0s}\n .lt[data-side=left] .dock [data-tip]::after{right:auto;left:calc(100% + 14px);transform:translate(-4px,-50%)}\n .lt[data-side=left] .dock [data-tip]:hover::after{transform:translate(0,-50%)}\n .lt[data-side=bottom] .dock [data-tip]::after,.lt[data-side=top] .dock [data-tip]::after{right:auto;left:50%;top:auto;bottom:calc(100% + 14px);transform:translate(-50%,4px)}\n .lt[data-side=top] .dock [data-tip]::after{bottom:auto;top:calc(100% + 14px);transform:translate(-50%,-4px)}\n .lt[data-side=bottom] .dock [data-tip]:hover::after,.lt[data-side=top] .dock [data-tip]:hover::after{transform:translate(-50%,0)}\n .dock[data-drag] [data-tip]::after,.dock [aria-expanded=true]::after{display:none}\n}\n\n/* Hidden: a small tab on the nearest edge. While audio plays it shows only the playing bars. */\n.tab{position:fixed;top:clamp(40px,calc(var(--y,.5)*100%),calc(100% - 40px));right:0;width:28px;height:56px;transform:translateY(-50%);border-radius:14px 0 0 14px;border-right:0;display:grid;place-items:center;color:var(--tx);transition:width .2s var(--ease),height .2s var(--ease);animation:lt-tab .3s .08s var(--ease) both}\n.lt[data-side=left] .tab{right:auto;left:0;border-radius:0 14px 14px 0;border-right:1px solid var(--ln);border-left:0}\n.lt[data-side=bottom] .tab,.lt[data-side=top] .tab{top:auto;bottom:0;right:auto;left:clamp(40px,calc(var(--x,.5)*100%),calc(100% - 40px));width:56px;height:28px;transform:translateX(-50%);border-radius:14px 14px 0 0;border:1px solid var(--ln);border-bottom:0}\n.lt[data-side=top] .tab{bottom:auto;top:0;border-radius:0 0 14px 14px;border-top:0;border-bottom:1px solid var(--ln)}\n.tab:active{transform:translateY(-50%)}\n.lt[data-side=bottom] .tab:active,.lt[data-side=top] .tab:active{transform:translateX(-50%)}\n.tab[data-leave]{animation:lt-tab-out .14s var(--ease) both;pointer-events:none}\n@media (hover:hover){.lt[data-side=left] .tab:hover,.lt[data-side=right] .tab:hover{width:34px}.lt[data-side=bottom] .tab:hover,.lt[data-side=top] .tab:hover{height:34px}}\n\n/* Popovers sit next to the dock (placed by useAnchor) and grow out of it: --px/--py point back\n toward the dock. */\n.pop,.toast{position:fixed;top:var(--top,50%);left:var(--left,auto);transform-origin:var(--origin,center);animation:lt-pop .2s var(--ease) both}\n.pop[data-leave],.toast[data-leave]{animation:lt-pop-out .14s var(--ease) both;pointer-events:none}\n.pop{width:min(320px,calc(100% - 24px));max-height:calc(100% - 24px);border-radius:20px;display:flex;flex-direction:column}\n.speedpop{width:min(300px,calc(100% - 24px));padding:16px 16px 14px}\n.label{display:flex;justify-content:space-between;align-items:baseline;font-size:12.5px;font-weight:600;color:var(--mu);margin-bottom:8px}\n.label b{font-size:15px;font-weight:650;color:var(--tx);font-variant-numeric:tabular-nums}\n.stepper{display:flex;align-items:center;gap:8px}\n.range{flex:1;-webkit-appearance:none;appearance:none;height:28px;background:transparent;cursor:pointer}\n.range::-webkit-slider-runnable-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--a) var(--p),var(--ln2) var(--p))}\n.range::-moz-range-track{height:4px;border-radius:4px;background:linear-gradient(to right,var(--a) var(--p),var(--ln2) var(--p))}\n.range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-7px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px rgba(0,0,0,.45)}\n.range::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#fff;border:0;box-shadow:0 1px 4px rgba(0,0,0,.45)}\n.range:focus-visible{box-shadow:none;outline:2px solid #fff;outline-offset:2px;border-radius:6px}\n.presets{display:flex;gap:4px;margin-top:8px}\n.presets button{flex:1;height:30px;border-radius:9px;font-size:12.5px;font-weight:600;color:var(--mu);font-variant-numeric:tabular-nums}\n.presets button[aria-pressed=true]{background:var(--bg3);color:var(--tx)}\n@media (hover:hover){.presets button:hover{color:var(--tx)}}\n\n.voicepop{padding:6px}\n.voices{display:flex;flex-direction:column;gap:2px;min-height:0;max-height:min(540px,calc(100vh - 40px));overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,244,228,.22) transparent;scroll-padding-top:58px}\n.group{position:sticky;top:0;z-index:1;display:flex;flex-direction:column;gap:1px;padding:10px 10px 6px;background:var(--bg)}\n.group+.opt{margin-top:0}\n.opt+.group{margin-top:6px;box-shadow:0 -1px 0 var(--ln)}\n.group b{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--mu)}\n.group b svg{color:var(--a)}\n.group:first-child b{color:var(--tx)}\n.group span{font-size:11.5px;color:var(--mu);opacity:.8}\n.opt{display:flex;align-items:center;gap:11px;width:100%;min-height:50px;padding:6px 10px;border-radius:14px;text-align:left}\n.opt[aria-checked=true]{background:var(--bg2)}\n.av{flex:none;width:32px;height:32px;border-radius:50%;background:var(--bg3);display:grid;place-items:center;font-size:13.5px;font-weight:700;color:var(--tx);transition:background-color .2s,color .2s}\n.opt[aria-checked=true] .av{background:var(--a);color:var(--ai)}\n.opt .n{flex:1;min-width:0}\n.opt .n b{display:block;font-weight:600;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.opt .sub{display:block;font-size:12px;color:var(--mu);margin-top:1px}\n.opt .tick{color:var(--a);opacity:0;transform:scale(.8);transition:opacity .15s,transform .2s var(--ease)}\n.opt[aria-checked=true] .tick{opacity:1;transform:none}\n.tag{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:5px;font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;vertical-align:1px;color:var(--a);background:color-mix(in srgb,var(--a) 16%,transparent)}\n.empty,.tip{font-size:12.5px;color:var(--mu);line-height:1.5}\n.empty{padding:10px}\n.tip{margin:6px;padding:10px 12px;border-radius:12px;background:var(--bg2)}\n\n/* Accessibility panel */\n.panel{width:min(368px,calc(100% - 24px))}\n.phead{display:flex;align-items:center;gap:4px;padding:12px 10px 4px 18px}\n.phead h2{flex:1;font-size:16px;font-weight:650;letter-spacing:-.01em}\n.reset{height:30px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;color:var(--a)}\n.reset:disabled{color:var(--mu);opacity:.5}\n@media (hover:hover){.reset:not(:disabled):hover{background:var(--hv)}}\n.body{overflow:auto;padding:0 14px 16px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,244,228,.22) transparent}\n.panel h3{margin:16px 2px 8px;font-size:12.5px;font-weight:600;color:var(--mu)}\n.chips{display:flex;flex-wrap:wrap;gap:6px}\n.pchip{height:34px;padding:0 13px 0 10px;border-radius:999px;display:flex;align-items:center;gap:7px;font-size:13px;font-weight:600;background:var(--bg2);border:1px solid var(--ln)}\n.pchip svg{color:var(--mu)}\n.pchip[aria-pressed=true]{background:var(--a);color:var(--ai);border-color:transparent}\n.pchip[aria-pressed=true] svg{color:inherit}\n@media (hover:hover){.pchip[aria-pressed=false]:hover{border-color:var(--ln2)}}\n.hint{margin:8px 2px 0;min-height:36px;font-size:12.5px;line-height:1.45;color:var(--mu)}\n\n.size{display:flex;align-items:center;gap:6px;padding:6px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);margin-bottom:6px}\n.step{width:44px;height:44px;border-radius:10px;background:var(--bg3);display:grid;place-items:center}\n.step:disabled{opacity:.35}\n@media (hover:hover){.step:not(:disabled):hover{background:#33333b}}\n.step .a{font-weight:700;line-height:1}\n.step .sm{font-size:13px}\n.step .lg{font-size:20px}\n.val{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px}\n.val span{font-size:11.5px;color:var(--mu)}\n.val b{font-size:15px;font-weight:650;font-variant-numeric:tabular-nums;line-height:1.1}\n.pips{display:flex;gap:3px}\n.pips i{display:block;width:12px;height:3px;border-radius:2px;background:var(--ln2);transition:background-color .15s}\n.pips i.f{background:var(--a)}\n\n.tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}\n.tiles.two{grid-template-columns:repeat(2,1fr)}\n.tile{position:relative;min-height:76px;padding:12px 6px 10px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;font-size:12.5px;font-weight:600;line-height:1.2;text-align:center}\n.tile svg{color:var(--mu);transition:color .15s}\n.tile[aria-checked=true],.tile[data-on]{background:color-mix(in srgb,var(--a) 15%,var(--bg2));border-color:color-mix(in srgb,var(--a) 65%,transparent)}\n.tile[aria-checked=true] svg,.tile[data-on] svg{color:var(--a)}\n.tile .ck{position:absolute;top:7px;right:7px;width:16px;height:16px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;opacity:0;transform:scale(.5);transition:opacity .12s,transform .18s var(--ease)}\n.tile[aria-checked=true] .ck{opacity:1;transform:none}\n.tile .ck svg{color:inherit;stroke-width:3.2}\n.tl{display:flex;flex-direction:column;align-items:center;gap:6px}\n/* Text tiles sit two to a row, so they lie flat to keep the panel short. */\n.tiles.two .tile{flex-direction:row;justify-content:flex-start;min-height:54px;padding:8px 12px;gap:10px;text-align:left}\n.tiles.two .tl{align-items:flex-start;gap:5px}\n@media (hover:hover){.tile:hover{border-color:var(--ln2)}}\n\n.swatches{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}\n.sw{display:flex;flex-direction:column;align-items:center;gap:6px;padding:6px 2px 7px;border-radius:12px;font-size:11.5px;font-weight:600;color:var(--mu);white-space:nowrap}\n.sw .prev{width:100%;max-width:48px;aspect-ratio:1;border-radius:11px;display:grid;place-items:center;font-size:16px;font-weight:700;border:1px solid var(--ln2);transition:box-shadow .15s}\n.sw .invert span{background:linear-gradient(135deg,#18181b 50%,#f4f4f5 50%);-webkit-background-clip:text;background-clip:text}\n.sw[aria-checked=true]{color:var(--tx)}\n.sw[aria-checked=true] .prev{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--a)}\n@media (hover:hover){.sw[aria-checked=false]:hover{color:var(--tx)}}\n.toggle{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;margin-top:6px;padding:0 12px;border-radius:14px;background:var(--bg2);border:1px solid var(--ln);font-size:13px;font-weight:600;text-align:left}\n.toggle svg{color:var(--mu)}\n.toggle span:first-of-type{flex:1}\n.knobs{position:relative;flex:none;width:36px;height:22px;border-radius:999px;background:var(--bg3);transition:background-color .18s}\n.knobs::after{content:\"\";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s var(--ease)}\n.toggle[aria-checked=true] .knobs{background:var(--a)}\n.toggle[aria-checked=true] .knobs::after{transform:translateX(14px)}\n\n/* Toast beside the dock (placed like a popover) */\n.toast{max-width:min(340px,calc(100% - 24px));display:flex;align-items:center;gap:8px;padding:6px 6px 6px 14px;border-radius:16px;font-size:13px;font-weight:500}\n.toast span{flex:1;min-width:0}\n.btn{height:32px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;white-space:nowrap}\n.btn.primary{background:var(--a);color:var(--ai)}\n\n/* Equaliser bars: animate only while audio plays */\n.bars{display:inline-flex;align-items:center;gap:2px;height:12px}\n.bars i{display:block;width:2.5px;height:100%;border-radius:2px;background:var(--a);transform:scaleY(.35);transform-origin:50% 50%}\n.on .bars i{animation:lt-bar .9s ease-in-out infinite alternate}\n.on .bars i:nth-child(2){animation-delay:-.45s;animation-duration:.7s}\n.on .bars i:nth-child(3){animation-delay:-.2s;animation-duration:1.1s}\n.on .bars i:nth-child(4){animation-delay:-.6s;animation-duration:.8s}\n\n/* Play from here */\n.here{position:fixed;top:0;left:0;width:28px;height:28px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 4px 12px -2px rgba(0,0,0,.35);pointer-events:auto;opacity:0;transform:scale(.85);transition:opacity .15s,transform .18s var(--ease)}\n.here.on{opacity:1;transform:scale(1)}\n.selchip{position:fixed;top:0;left:0;height:34px;padding:0 13px 0 9px;border-radius:999px;display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;animation:lt-in-soft .2s var(--ease) both}\n.selchip .disc{width:20px;height:20px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center}\n\n/* Reading guide & mask */\n.guide{position:fixed;left:0;right:0;top:0;height:30px;margin-top:-15px;pointer-events:none;background:rgba(255,214,90,.16);border-top:2px solid rgba(240,180,0,.85);border-bottom:2px solid rgba(240,180,0,.85);will-change:transform}\n.shade{position:fixed;left:0;right:0;top:0;height:100%;pointer-events:none;background:rgba(8,8,10,.66);will-change:transform}\n\n@keyframes lt-in{from{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.96)}}\n@keyframes lt-out{to{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.96)}}\n@keyframes lt-tab{from{opacity:0}}\n@keyframes lt-tab-out{to{opacity:0}}\n@keyframes lt-pop{from{opacity:0;transform:translate(var(--px,0px),var(--py,0px)) scale(.97)}}\n@keyframes lt-pop-out{to{opacity:0;transform:translate(calc(var(--px,0px)*.6),calc(var(--py,0px)*.6)) scale(.98)}}\n@keyframes lt-sheet{from{opacity:0;transform:translateY(32px)}}\n@keyframes lt-sheet-out{to{opacity:0;transform:translateY(16px)}}\n@keyframes lt-in-soft{from{opacity:0;transform:translateY(8px) scale(.97)}}\n@keyframes lt-swap{from{opacity:0;transform:scale(.8);filter:blur(2px)}}\n@keyframes lt-fade{from{opacity:0}}\n@keyframes lt-pop-dot{from{opacity:0;transform:scale(.5)}}\n@keyframes lt-bar{to{transform:scaleY(1)}}\n@keyframes lt-breathe{50%{opacity:.45}}\n\n/* Phones: panels become bottom sheets */\n@media (max-width:540px){\n .lt{--gap:8px;--cell:40px}\n /* The flat bottom dock is fixed on phones: no handle, and thumb-sized targets. */\n .grip{display:none}\n .speed,.time{font-size:11px}\n .puck{border-radius:16px}\n .pop,.toast{top:auto;bottom:calc(8px + var(--safe));left:8px;right:8px;width:auto;max-width:none;transform-origin:center bottom;animation:lt-sheet .32s var(--drawer) both}\n .pop[data-leave],.toast[data-leave]{animation-name:lt-sheet-out}\n .pop{max-height:min(80vh,640px);border-radius:24px}\n}\n/* Motion off: every animation and transition takes no time. Zero durations rather than\n animation:none, which would replay every entrance animation (the dock and an open panel sliding\n in again) the moment \"pause animations\" is switched back off. */\n@media (prefers-reduced-motion:reduce){.lt *,.lt *::before,.lt *::after{animation-duration:0s!important;animation-delay:0s!important;transition-duration:0s!important;transition-delay:0s!important}}\n.lt[data-still] *,.lt[data-still] *::before,.lt[data-still] *::after{animation-duration:0s!important;animation-delay:0s!important;transition-duration:0s!important;transition-delay:0s!important}\n/* Printing the article prints the article: no dock, guide, mask or panels on every page. */\n@media print{.lt{display:none!important}}\n@media (forced-colors:active){\n .surface,.play,.speed,.pchip,.tile,.size,.toggle,.sw .prev,.disc{border:1px solid CanvasText}\n .ring .prg,.pips i.f,.knobs,.dot{background:Highlight;stroke:Highlight}\n .tile[aria-checked=true],.tile[data-on],.pchip[aria-pressed=true]{outline:2px solid Highlight}\n}\n";
|
package/dist/ui/ui.styles.js
CHANGED
|
@@ -6,7 +6,7 @@ export const UI_CSS = `
|
|
|
6
6
|
--bg:#161513;--bg2:#201e1b;--bg3:#2c2a26;--ln:rgba(255,244,228,.08);--ln2:rgba(255,244,228,.16);
|
|
7
7
|
--tx:#f7f4ee;--mu:#aba69c;--hv:rgba(255,244,228,.07);
|
|
8
8
|
--sh:0 1px 2px rgba(0,0,0,.2),0 18px 44px -10px rgba(0,0,0,.5);
|
|
9
|
-
--ease:cubic-bezier(.
|
|
9
|
+
--ease:cubic-bezier(.23,1,.32,1);--drawer:cubic-bezier(.32,.72,0,1);
|
|
10
10
|
--gap:12px;--cell:32px;--pad:4px;--rw:calc(var(--cell) + var(--pad)*2);--dx:16px;--dy:0px;--safe:env(safe-area-inset-bottom,0px);color-scheme:dark;
|
|
11
11
|
font:400 14px/1.4 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
|
|
12
12
|
color:var(--tx);letter-spacing:normal;word-spacing:normal;text-align:left;text-transform:none;
|
|
@@ -19,7 +19,7 @@ export const UI_CSS = `
|
|
|
19
19
|
/* Resets wrapped in :where() so they carry zero specificity and never beat component rules. */
|
|
20
20
|
:where(.lt) :where(button,input,h2,h3,p){font:inherit;color:inherit;letter-spacing:inherit;margin:0}
|
|
21
21
|
:where(.lt) button{background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:background-color .15s,color .15s,border-color .15s,transform .16s var(--ease),opacity .15s}
|
|
22
|
-
:where(.lt) button:where(:active:not(:disabled)){transform:scale(.
|
|
22
|
+
:where(.lt) button:where(:active:not(:disabled)){transform:scale(.96)}
|
|
23
23
|
:where(.lt) button:where(:disabled){cursor:default}
|
|
24
24
|
.lt :focus{outline:none}
|
|
25
25
|
.lt :focus-visible{outline:2px solid #fff;outline-offset:0;box-shadow:0 0 0 4px #0b0b0d}
|
|
@@ -33,19 +33,21 @@ export const UI_CSS = `
|
|
|
33
33
|
@media (hover:hover){.ghost:not(:disabled):hover,.opt:hover{background:var(--hv)}}
|
|
34
34
|
|
|
35
35
|
/* Dock: the listening rail and, set apart, the reading-aids puck. Placed in px by useDockPlacement
|
|
36
|
-
(0 and 1 sit flush on an edge); upright on a side, flat along the top or bottom.
|
|
37
|
-
|
|
38
|
-
.dock{position:fixed;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;animation:lt-in .
|
|
39
|
-
.dock[data-ready]{transition:left .32s var(--ease),top .32s var(--ease)}
|
|
36
|
+
(0 and 1 sit flush on an edge); upright on a side, flat along the top or bottom. Dragging and the
|
|
37
|
+
glide after a drop move it with translate only, so they never re-lay out the page. */
|
|
38
|
+
.dock{position:fixed;left:0;top:0;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;animation:lt-in .3s var(--ease) both}
|
|
40
39
|
.dock[data-o=h]{flex-direction:row}
|
|
41
|
-
.dock[data-drag]{
|
|
42
|
-
.dock[data-leave]{animation:lt-out .16s var(--
|
|
40
|
+
.dock[data-drag]{will-change:translate}
|
|
41
|
+
.dock[data-leave]{animation:lt-out .16s var(--ease) both}
|
|
43
42
|
.dock[data-leave] *{pointer-events:none!important}
|
|
44
43
|
/* Every control in the rail is one --cell square on the same grid, with --pad all round, so the
|
|
45
44
|
spacing is identical between icons and at both ends, upright or flat. */
|
|
46
45
|
.rail{width:var(--rw);padding:var(--pad) 0;border-radius:calc(var(--rw)/2);display:flex;flex-direction:column;align-items:center}
|
|
47
46
|
.dock[data-o=h] .rail{width:auto;height:var(--rw);padding:0 var(--pad);flex-direction:row}
|
|
48
47
|
.rail .ghost,.grip,.playwrap,.time,.speed,.hide{width:var(--cell);height:var(--cell);flex:none}
|
|
48
|
+
/* The puck is a button: it keeps the button transitions and adds the shadow's. */
|
|
49
|
+
.rail{transition:box-shadow .2s var(--ease)}
|
|
50
|
+
.puck{transition:background-color .15s,transform .16s var(--ease),box-shadow .2s var(--ease)}
|
|
49
51
|
.dock[data-drag] .rail,.dock[data-drag] .puck{box-shadow:0 1px 2px rgba(0,0,0,.2),0 26px 60px -12px rgba(0,0,0,.6)}
|
|
50
52
|
/* The handle's dots run across the dock, so it reads as a grip and not as more content. */
|
|
51
53
|
.grip{display:grid;place-items:center;color:var(--mu);opacity:.6;cursor:grab;touch-action:none;transition:opacity .15s}
|
|
@@ -53,8 +55,8 @@ export const UI_CSS = `
|
|
|
53
55
|
@media (hover:hover){.grip:hover{opacity:1}}
|
|
54
56
|
.dock[data-drag] .grip{cursor:grabbing;opacity:1}
|
|
55
57
|
/* Session-only controls unfold instead of popping in, so the dock grows smoothly. */
|
|
56
|
-
.xtra{display:flex;flex:none;max-height:var(--cell);max-width:var(--cell);overflow:hidden;transition:max-height .
|
|
57
|
-
.rail:not([data-active]) .xtra{opacity:0;visibility:hidden;transition:max-height .
|
|
58
|
+
.xtra{display:flex;flex:none;max-height:var(--cell);max-width:var(--cell);overflow:hidden;transition:max-height .28s var(--ease),max-width .28s var(--ease),opacity .2s .08s}
|
|
59
|
+
.rail:not([data-active]) .xtra{opacity:0;visibility:hidden;transition:max-height .24s var(--ease),max-width .24s var(--ease),opacity .1s,visibility 0s .24s}
|
|
58
60
|
.dock[data-o=v] .rail:not([data-active]) .xtra{max-height:0}
|
|
59
61
|
.dock[data-o=h] .rail:not([data-active]) .xtra{max-width:0}
|
|
60
62
|
.playwrap{position:relative;display:grid;place-items:center}
|
|
@@ -91,6 +93,7 @@ export const UI_CSS = `
|
|
|
91
93
|
.dock [data-tip]::after{content:attr(data-tip);position:absolute;top:50%;right:calc(100% + 14px);padding:6px 10px;border-radius:9px;background:var(--bg);border:1px solid var(--ln2);box-shadow:var(--sh);color:var(--tx);font-size:12.5px;font-weight:500;letter-spacing:0;white-space:nowrap;pointer-events:none;opacity:0;transform:translate(4px,-50%);transition:opacity .12s,transform .15s var(--ease)}
|
|
92
94
|
.dock [data-tip]{position:relative}
|
|
93
95
|
.dock [data-tip]:hover::after{opacity:1;transform:translate(0,-50%);transition-delay:.4s}
|
|
96
|
+
.dock[data-warm] [data-tip]:hover::after{transition-delay:0s;transition-duration:0s}
|
|
94
97
|
.lt[data-side=left] .dock [data-tip]::after{right:auto;left:calc(100% + 14px);transform:translate(-4px,-50%)}
|
|
95
98
|
.lt[data-side=left] .dock [data-tip]:hover::after{transform:translate(0,-50%)}
|
|
96
99
|
.lt[data-side=bottom] .dock [data-tip]::after,.lt[data-side=top] .dock [data-tip]::after{right:auto;left:50%;top:auto;bottom:calc(100% + 14px);transform:translate(-50%,4px)}
|
|
@@ -106,13 +109,13 @@ export const UI_CSS = `
|
|
|
106
109
|
.lt[data-side=top] .tab{bottom:auto;top:0;border-radius:0 0 14px 14px;border-top:0;border-bottom:1px solid var(--ln)}
|
|
107
110
|
.tab:active{transform:translateY(-50%)}
|
|
108
111
|
.lt[data-side=bottom] .tab:active,.lt[data-side=top] .tab:active{transform:translateX(-50%)}
|
|
109
|
-
.tab[data-leave]{animation:lt-tab-out .14s var(--
|
|
112
|
+
.tab[data-leave]{animation:lt-tab-out .14s var(--ease) both;pointer-events:none}
|
|
110
113
|
@media (hover:hover){.lt[data-side=left] .tab:hover,.lt[data-side=right] .tab:hover{width:34px}.lt[data-side=bottom] .tab:hover,.lt[data-side=top] .tab:hover{height:34px}}
|
|
111
114
|
|
|
112
115
|
/* Popovers sit next to the dock (placed by useAnchor) and grow out of it: --px/--py point back
|
|
113
116
|
toward the dock. */
|
|
114
|
-
.pop,.toast{position:fixed;top:var(--top,50%);left:var(--left,auto);animation:lt-pop .
|
|
115
|
-
.pop[data-leave],.toast[data-leave]{animation:lt-pop-out .14s var(--
|
|
117
|
+
.pop,.toast{position:fixed;top:var(--top,50%);left:var(--left,auto);transform-origin:var(--origin,center);animation:lt-pop .2s var(--ease) both}
|
|
118
|
+
.pop[data-leave],.toast[data-leave]{animation:lt-pop-out .14s var(--ease) both;pointer-events:none}
|
|
116
119
|
.pop{width:min(320px,calc(100% - 24px));max-height:calc(100% - 24px);border-radius:20px;display:flex;flex-direction:column}
|
|
117
120
|
.speedpop{width:min(300px,calc(100% - 24px));padding:16px 16px 14px}
|
|
118
121
|
.label{display:flex;justify-content:space-between;align-items:baseline;font-size:12.5px;font-weight:600;color:var(--mu);margin-bottom:8px}
|
|
@@ -145,7 +148,7 @@ export const UI_CSS = `
|
|
|
145
148
|
.opt .n{flex:1;min-width:0}
|
|
146
149
|
.opt .n b{display:block;font-weight:600;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
147
150
|
.opt .sub{display:block;font-size:12px;color:var(--mu);margin-top:1px}
|
|
148
|
-
.opt .tick{color:var(--a);opacity:0;transform:scale(.
|
|
151
|
+
.opt .tick{color:var(--a);opacity:0;transform:scale(.8);transition:opacity .15s,transform .2s var(--ease)}
|
|
149
152
|
.opt[aria-checked=true] .tick{opacity:1;transform:none}
|
|
150
153
|
.tag{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:5px;font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;vertical-align:1px;color:var(--a);background:color-mix(in srgb,var(--a) 16%,transparent)}
|
|
151
154
|
.empty,.tip{font-size:12.5px;color:var(--mu);line-height:1.5}
|
|
@@ -189,8 +192,8 @@ export const UI_CSS = `
|
|
|
189
192
|
.tile svg{color:var(--mu);transition:color .15s}
|
|
190
193
|
.tile[aria-checked=true],.tile[data-on]{background:color-mix(in srgb,var(--a) 15%,var(--bg2));border-color:color-mix(in srgb,var(--a) 65%,transparent)}
|
|
191
194
|
.tile[aria-checked=true] svg,.tile[data-on] svg{color:var(--a)}
|
|
192
|
-
.tile .ck{position:absolute;top:7px;right:7px;width:16px;height:16px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;transform:scale(
|
|
193
|
-
.tile[aria-checked=true] .ck{transform:
|
|
195
|
+
.tile .ck{position:absolute;top:7px;right:7px;width:16px;height:16px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;opacity:0;transform:scale(.5);transition:opacity .12s,transform .18s var(--ease)}
|
|
196
|
+
.tile[aria-checked=true] .ck{opacity:1;transform:none}
|
|
194
197
|
.tile .ck svg{color:inherit;stroke-width:3.2}
|
|
195
198
|
.tl{display:flex;flex-direction:column;align-items:center;gap:6px}
|
|
196
199
|
/* Text tiles sit two to a row, so they lie flat to keep the panel short. */
|
|
@@ -228,7 +231,7 @@ export const UI_CSS = `
|
|
|
228
231
|
.on .bars i:nth-child(4){animation-delay:-.6s;animation-duration:.8s}
|
|
229
232
|
|
|
230
233
|
/* Play from here */
|
|
231
|
-
.here{position:fixed;top:0;left:0;width:28px;height:28px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 4px 12px -2px rgba(0,0,0,.35);pointer-events:auto;opacity:0;transform:scale(.
|
|
234
|
+
.here{position:fixed;top:0;left:0;width:28px;height:28px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center;box-shadow:0 4px 12px -2px rgba(0,0,0,.35);pointer-events:auto;opacity:0;transform:scale(.85);transition:opacity .15s,transform .18s var(--ease)}
|
|
232
235
|
.here.on{opacity:1;transform:scale(1)}
|
|
233
236
|
.selchip{position:fixed;top:0;left:0;height:34px;padding:0 13px 0 9px;border-radius:999px;display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;animation:lt-in-soft .2s var(--ease) both}
|
|
234
237
|
.selchip .disc{width:20px;height:20px;border-radius:50%;background:var(--a);color:var(--ai);display:grid;place-items:center}
|
|
@@ -243,12 +246,12 @@ export const UI_CSS = `
|
|
|
243
246
|
@keyframes lt-tab-out{to{opacity:0}}
|
|
244
247
|
@keyframes lt-pop{from{opacity:0;transform:translate(var(--px,0px),var(--py,0px)) scale(.97)}}
|
|
245
248
|
@keyframes lt-pop-out{to{opacity:0;transform:translate(calc(var(--px,0px)*.6),calc(var(--py,0px)*.6)) scale(.98)}}
|
|
246
|
-
@keyframes lt-sheet{from{opacity:0;transform:translateY(
|
|
249
|
+
@keyframes lt-sheet{from{opacity:0;transform:translateY(32px)}}
|
|
247
250
|
@keyframes lt-sheet-out{to{opacity:0;transform:translateY(16px)}}
|
|
248
251
|
@keyframes lt-in-soft{from{opacity:0;transform:translateY(8px) scale(.97)}}
|
|
249
|
-
@keyframes lt-swap{from{opacity:0;transform:scale(.
|
|
252
|
+
@keyframes lt-swap{from{opacity:0;transform:scale(.8);filter:blur(2px)}}
|
|
250
253
|
@keyframes lt-fade{from{opacity:0}}
|
|
251
|
-
@keyframes lt-pop-dot{from{transform:scale(
|
|
254
|
+
@keyframes lt-pop-dot{from{opacity:0;transform:scale(.5)}}
|
|
252
255
|
@keyframes lt-bar{to{transform:scaleY(1)}}
|
|
253
256
|
@keyframes lt-breathe{50%{opacity:.45}}
|
|
254
257
|
|
|
@@ -259,7 +262,7 @@ export const UI_CSS = `
|
|
|
259
262
|
.grip{display:none}
|
|
260
263
|
.speed,.time{font-size:11px}
|
|
261
264
|
.puck{border-radius:16px}
|
|
262
|
-
.pop,.toast{top:auto;bottom:calc(8px + var(--safe));left:8px;right:8px;width:auto;max-width:none;transform-origin:center bottom;animation
|
|
265
|
+
.pop,.toast{top:auto;bottom:calc(8px + var(--safe));left:8px;right:8px;width:auto;max-width:none;transform-origin:center bottom;animation:lt-sheet .32s var(--drawer) both}
|
|
263
266
|
.pop[data-leave],.toast[data-leave]{animation-name:lt-sheet-out}
|
|
264
267
|
.pop{max-height:min(80vh,640px);border-radius:24px}
|
|
265
268
|
}
|
package/package.json
CHANGED