@hyperframes/studio 0.8.143 → 0.8.144
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/dist/assets/{hyperframes-player-BXSuksFh.js → hyperframes-player-Bw_jIaSX.js} +3 -3
- package/dist/assets/{index-J7jpL4pj.js → index-BVM9NuWl.js} +141 -141
- package/dist/assets/{index-BgOVCqjo.js → index-Cj7W_c7p.js} +1 -1
- package/dist/assets/{index-FgyO_5Kv.js → index-DyH9dT7b.js} +1 -1
- package/dist/{chunk-TFLU2MGI.js → chunk-3GHTHPZD.js} +8 -1
- package/dist/chunk-3GHTHPZD.js.map +1 -0
- package/dist/{chunk-H2DUOXTF.js → chunk-G3EDKRZH.js} +3 -3
- package/dist/{chunk-UYWON5AX.js → chunk-PEAKCOUW.js} +7 -3
- package/dist/chunk-PEAKCOUW.js.map +1 -0
- package/dist/{chunk-LOVBLSMR.js → chunk-Y2OHHNM2.js} +35 -19
- package/dist/chunk-Y2OHHNM2.js.map +1 -0
- package/dist/{domEditingLayers-KBTPQKGA.js → domEditingLayers-PYST4G45.js} +3 -3
- package/dist/index.html +1 -1
- package/dist/index.js +139 -70
- package/dist/index.js.map +1 -1
- package/dist/player.js +3 -3
- package/dist/ui.d.ts +4 -5
- package/dist/ui.js +1 -1
- package/package.json +8 -8
- package/src/components/editor/DomEditSelectionChrome.test.tsx +103 -0
- package/src/components/editor/DomEditSelectionChrome.tsx +42 -16
- package/src/components/editor/anchoredResizeCommitFeedsOffset.test.ts +36 -0
- package/src/components/editor/domEditOverlayGestures.ts +1 -0
- package/src/components/editor/domEditOverlayStartGesture.ts +5 -0
- package/src/components/editor/domEditResizeLocal.test.ts +81 -1
- package/src/components/editor/domEditResizeLocal.ts +27 -3
- package/src/components/editor/domEditingLayers.ts +4 -1
- package/src/components/editor/domEditingTextFields.test.ts +18 -0
- package/src/components/editor/manualEditsDom.ts +12 -12
- package/src/components/editor/previewGestureStarts.ts +14 -5
- package/src/components/editor/resizeDraft.ts +13 -4
- package/src/components/editor/useDomEditOverlayGestures.ts +5 -3
- package/src/components/ui/Menu.test.tsx +67 -5
- package/src/components/ui/Menu.tsx +21 -4
- package/src/components/ui/Popover.tsx +11 -5
- package/src/hooks/gsapResizeIntercept.test.ts +46 -11
- package/src/hooks/gsapResizeIntercept.ts +25 -20
- package/src/hooks/useThumbnailStripSize.test.tsx +123 -0
- package/src/hooks/useThumbnailStripSize.ts +19 -8
- package/src/player/components/CompositionThumbnail.test.ts +3 -0
- package/src/player/components/ImageThumbnail.test.tsx +4 -1
- package/src/player/components/VideoThumbnail.test.tsx +13 -2
- package/src/player/hooks/timelineSyncHydration.ts +2 -1
- package/src/utils/authoredSource.test.ts +25 -0
- package/src/utils/authoredSource.ts +3 -5
- package/src/utils/rounding.ts +7 -0
- package/dist/chunk-LOVBLSMR.js.map +0 -1
- package/dist/chunk-TFLU2MGI.js.map +0 -1
- package/dist/chunk-UYWON5AX.js.map +0 -1
- /package/dist/{chunk-H2DUOXTF.js.map → chunk-G3EDKRZH.js.map} +0 -0
- /package/dist/{domEditingLayers-KBTPQKGA.js.map → domEditingLayers-PYST4G45.js.map} +0 -0
|
@@ -18,9 +18,125 @@ vi.mock("../player/components/timelineZoomInput", () => ({
|
|
|
18
18
|
|
|
19
19
|
Reflect.set(globalThis, "IS_REACT_ACT_ENVIRONMENT", true);
|
|
20
20
|
|
|
21
|
+
/** Runs the frames the hook asked for, as the browser does after the observer's delivery. */
|
|
22
|
+
function nextFrames() {
|
|
23
|
+
vi.useFakeTimers({ toFake: ["requestAnimationFrame", "cancelAnimationFrame"] });
|
|
24
|
+
return () => act(() => vi.advanceTimersToNextFrame());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// A strip that re-rendered inside the observer's delivery resized the timeline Chromium had already measured that
|
|
28
|
+
// frame, which it reported as a ResizeObserver loop on every frame of a trim.
|
|
29
|
+
it("applies a reported size on the next frame, never inside the observer's delivery", () => {
|
|
30
|
+
const originalResizeObserver = globalThis.ResizeObserver;
|
|
31
|
+
globalThis.ResizeObserver = MockResizeObserver as unknown as typeof ResizeObserver;
|
|
32
|
+
const runFrames = nextFrames();
|
|
33
|
+
const host = document.createElement("div");
|
|
34
|
+
document.body.append(host);
|
|
35
|
+
Object.defineProperty(host, "clientWidth", { configurable: true, value: 300 });
|
|
36
|
+
Object.defineProperty(host, "clientHeight", { configurable: true, value: 40 });
|
|
37
|
+
const root = createRoot(host);
|
|
38
|
+
function Harness() {
|
|
39
|
+
const [size, ref] = useThumbnailStripSize();
|
|
40
|
+
return <div ref={ref}>{`${size.width}x${size.height}`}</div>;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
act(() => root.render(<Harness />));
|
|
44
|
+
reportResize(310, 40);
|
|
45
|
+
reportResize(320, 40);
|
|
46
|
+
expect(vi.getTimerCount()).toBe(1);
|
|
47
|
+
expect(host.textContent).toBe("300x40");
|
|
48
|
+
runFrames();
|
|
49
|
+
expect(host.textContent).toBe("320x40");
|
|
50
|
+
} finally {
|
|
51
|
+
act(() => root.unmount());
|
|
52
|
+
host.remove();
|
|
53
|
+
vi.useRealTimers();
|
|
54
|
+
vi.restoreAllMocks();
|
|
55
|
+
globalThis.ResizeObserver = originalResizeObserver;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("cancels a pending resize frame when the last strip unmounts", () => {
|
|
60
|
+
const originalResizeObserver = globalThis.ResizeObserver;
|
|
61
|
+
globalThis.ResizeObserver = MockResizeObserver as unknown as typeof ResizeObserver;
|
|
62
|
+
const runFrames = nextFrames();
|
|
63
|
+
const host = document.createElement("div");
|
|
64
|
+
document.body.append(host);
|
|
65
|
+
const root = createRoot(host);
|
|
66
|
+
function Harness() {
|
|
67
|
+
const [, ref] = useThumbnailStripSize();
|
|
68
|
+
return <div ref={ref} />;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
act(() => root.render(<Harness />));
|
|
72
|
+
reportResize(320, 40);
|
|
73
|
+
expect(vi.getTimerCount()).toBe(1);
|
|
74
|
+
act(() => root.unmount());
|
|
75
|
+
expect(vi.getTimerCount()).toBe(0);
|
|
76
|
+
runFrames();
|
|
77
|
+
} finally {
|
|
78
|
+
act(() => root.unmount());
|
|
79
|
+
host.remove();
|
|
80
|
+
vi.useRealTimers();
|
|
81
|
+
vi.restoreAllMocks();
|
|
82
|
+
globalThis.ResizeObserver = originalResizeObserver;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("drops a pending size when its strip unmounts, so a strip remounted on that box keeps its own", () => {
|
|
87
|
+
const originalResizeObserver = globalThis.ResizeObserver;
|
|
88
|
+
globalThis.ResizeObserver = MockResizeObserver as unknown as typeof ResizeObserver;
|
|
89
|
+
const runFrames = nextFrames();
|
|
90
|
+
const host = document.createElement("div");
|
|
91
|
+
document.body.append(host);
|
|
92
|
+
const root = createRoot(host);
|
|
93
|
+
function Strip() {
|
|
94
|
+
const [size, ref] = useThumbnailStripSize();
|
|
95
|
+
return <div ref={ref}>{`${size.width}x${size.height}`}</div>;
|
|
96
|
+
}
|
|
97
|
+
function Box({ id }: { id: string }) {
|
|
98
|
+
const box = (element: HTMLDivElement | null) => {
|
|
99
|
+
if (!element) return;
|
|
100
|
+
Object.defineProperty(element, "clientWidth", { configurable: true, value: 300 });
|
|
101
|
+
Object.defineProperty(element, "clientHeight", { configurable: true, value: 40 });
|
|
102
|
+
};
|
|
103
|
+
return (
|
|
104
|
+
<div ref={box} data-testid="box">
|
|
105
|
+
<Strip key={id} />
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
// The other strip keeps the shared observer alive across the remount.
|
|
110
|
+
const render = (id: string) =>
|
|
111
|
+
act(() =>
|
|
112
|
+
root.render(
|
|
113
|
+
<>
|
|
114
|
+
<div>
|
|
115
|
+
<Strip />
|
|
116
|
+
</div>
|
|
117
|
+
<Box id={id} />
|
|
118
|
+
</>,
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
try {
|
|
122
|
+
render("a");
|
|
123
|
+
reportResize(320, 40);
|
|
124
|
+
render("b");
|
|
125
|
+
runFrames();
|
|
126
|
+
expect(host.querySelector('[data-testid="box"]')?.textContent).toBe("300x40");
|
|
127
|
+
} finally {
|
|
128
|
+
act(() => root.unmount());
|
|
129
|
+
host.remove();
|
|
130
|
+
vi.useRealTimers();
|
|
131
|
+
vi.restoreAllMocks();
|
|
132
|
+
globalThis.ResizeObserver = originalResizeObserver;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
21
136
|
it("does not re-render the strip when the observer reports the size it already holds", () => {
|
|
22
137
|
const originalResizeObserver = globalThis.ResizeObserver;
|
|
23
138
|
globalThis.ResizeObserver = MockResizeObserver as unknown as typeof ResizeObserver;
|
|
139
|
+
const runFrames = nextFrames();
|
|
24
140
|
const host = document.createElement("div");
|
|
25
141
|
document.body.append(host);
|
|
26
142
|
Object.defineProperty(host, "clientWidth", { configurable: true, value: 300 });
|
|
@@ -45,14 +161,18 @@ it("does not re-render the strip when the observer reports the size it already h
|
|
|
45
161
|
const settled = stripRenders;
|
|
46
162
|
|
|
47
163
|
act(() => reportResize(300, 40));
|
|
164
|
+
runFrames();
|
|
48
165
|
expect(stripRenders).toBe(settled);
|
|
49
166
|
|
|
50
167
|
act(() => reportResize(320, 40));
|
|
168
|
+
runFrames();
|
|
51
169
|
expect(stripRenders).toBe(settled + 1);
|
|
52
170
|
expect(host.textContent).toBe("320x40");
|
|
53
171
|
} finally {
|
|
54
172
|
act(() => root.unmount());
|
|
55
173
|
host.remove();
|
|
174
|
+
vi.useRealTimers();
|
|
175
|
+
vi.restoreAllMocks();
|
|
56
176
|
globalThis.ResizeObserver = originalResizeObserver;
|
|
57
177
|
}
|
|
58
178
|
});
|
|
@@ -60,6 +180,7 @@ it("does not re-render the strip when the observer reports the size it already h
|
|
|
60
180
|
it("measures a strip once a zoom preview ends, not while the preview scales it", () => {
|
|
61
181
|
const originalResizeObserver = globalThis.ResizeObserver;
|
|
62
182
|
globalThis.ResizeObserver = MockResizeObserver as unknown as typeof ResizeObserver;
|
|
183
|
+
const runFrames = nextFrames();
|
|
63
184
|
const host = document.createElement("div");
|
|
64
185
|
document.body.append(host);
|
|
65
186
|
let width = 300;
|
|
@@ -75,6 +196,7 @@ it("measures a strip once a zoom preview ends, not while the preview scales it",
|
|
|
75
196
|
zoom.previewing = true;
|
|
76
197
|
width = 600;
|
|
77
198
|
act(() => reportResize(600, 40));
|
|
199
|
+
runFrames();
|
|
78
200
|
expect(host.textContent).toBe("300x40");
|
|
79
201
|
zoom.previewing = false;
|
|
80
202
|
act(() => zoom.listeners.forEach((listener) => listener()));
|
|
@@ -83,6 +205,7 @@ it("measures a strip once a zoom preview ends, not while the preview scales it",
|
|
|
83
205
|
zoom.previewing = false;
|
|
84
206
|
act(() => root.unmount());
|
|
85
207
|
host.remove();
|
|
208
|
+
vi.useRealTimers();
|
|
86
209
|
globalThis.ResizeObserver = originalResizeObserver;
|
|
87
210
|
}
|
|
88
211
|
});
|
|
@@ -152,13 +152,20 @@ const measure = (entries: { target: Element; size?: { width: number; height: num
|
|
|
152
152
|
const onPresence = (entries: IntersectionObserverEntry[]) =>
|
|
153
153
|
measure(entries.filter((entry) => entry.isIntersecting));
|
|
154
154
|
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
);
|
|
155
|
+
const pendingSizes = new Map<Element, { width: number; height: number }>();
|
|
156
|
+
let pendingSizesFrame = 0;
|
|
157
|
+
const applyPendingSizes = () => {
|
|
158
|
+
pendingSizesFrame = 0;
|
|
159
|
+
const entries = [...pendingSizes].map(([target, size]) => ({ target, size }));
|
|
160
|
+
pendingSizes.clear();
|
|
161
|
+
measure(entries);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const applyResizesNextFrame = (entries: ResizeObserverEntry[]) => {
|
|
165
|
+
for (const { target, contentRect } of entries)
|
|
166
|
+
pendingSizes.set(target, { width: contentRect.width, height: contentRect.height });
|
|
167
|
+
pendingSizesFrame ||= requestAnimationFrame(applyPendingSizes);
|
|
168
|
+
};
|
|
162
169
|
|
|
163
170
|
const observeIntersections = (callback: IntersectionObserverCallback) =>
|
|
164
171
|
typeof IntersectionObserver === "undefined"
|
|
@@ -168,7 +175,7 @@ const observeIntersections = (callback: IntersectionObserverCallback) =>
|
|
|
168
175
|
function acquire() {
|
|
169
176
|
if (users++ === 0) {
|
|
170
177
|
shared = {
|
|
171
|
-
resize: new ResizeObserver(
|
|
178
|
+
resize: new ResizeObserver(applyResizesNextFrame),
|
|
172
179
|
presence: observeIntersections(onPresence),
|
|
173
180
|
gaps: observeIntersections(
|
|
174
181
|
(entries) => entries.some((entry) => entry.isIntersecting) && scheduleRefresh(),
|
|
@@ -190,6 +197,9 @@ function release() {
|
|
|
190
197
|
window.removeEventListener("scroll", scheduleRefresh, { capture: true });
|
|
191
198
|
cancelAnimationFrame(frame);
|
|
192
199
|
frame = 0;
|
|
200
|
+
cancelAnimationFrame(pendingSizesFrame);
|
|
201
|
+
pendingSizesFrame = 0;
|
|
202
|
+
pendingSizes.clear();
|
|
193
203
|
}
|
|
194
204
|
|
|
195
205
|
const watchGap = (gap: HTMLDivElement | null) => {
|
|
@@ -234,6 +244,7 @@ export function useThumbnailStripSize() {
|
|
|
234
244
|
resize.unobserve(target);
|
|
235
245
|
presence?.unobserve(target);
|
|
236
246
|
strips.delete(target);
|
|
247
|
+
pendingSizes.delete(target);
|
|
237
248
|
release();
|
|
238
249
|
};
|
|
239
250
|
}, []);
|
|
@@ -47,6 +47,7 @@ beforeEach(() => {
|
|
|
47
47
|
afterEach(() => {
|
|
48
48
|
act(() => root?.unmount());
|
|
49
49
|
root = null;
|
|
50
|
+
vi.useRealTimers();
|
|
50
51
|
thumbnailScheduler.invalidateProject("/api/projects/demo/preview");
|
|
51
52
|
globalThis.ResizeObserver = originalResizeObserver;
|
|
52
53
|
globalThis.Image = originalImage;
|
|
@@ -175,7 +176,9 @@ describe("CompositionThumbnail", () => {
|
|
|
175
176
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
176
177
|
});
|
|
177
178
|
|
|
179
|
+
vi.useFakeTimers({ toFake: ["requestAnimationFrame", "cancelAnimationFrame"] });
|
|
178
180
|
act(() => reportResize(500, 40));
|
|
181
|
+
act(() => vi.advanceTimersToNextFrame());
|
|
179
182
|
|
|
180
183
|
expect(host.querySelector("img")?.parentElement?.style.width).toBe("108px");
|
|
181
184
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { act } from "react";
|
|
4
4
|
import { createRoot, type Root } from "react-dom/client";
|
|
5
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
6
|
import { MockResizeObserver, reportResize } from "../../hooks/resizeObserverTestUtils";
|
|
7
7
|
import { thumbnailScheduler } from "../lib/thumbnailScheduler";
|
|
8
8
|
import { ImageThumbnail } from "./ImageThumbnail";
|
|
@@ -64,6 +64,7 @@ beforeEach(() => {
|
|
|
64
64
|
afterEach(() => {
|
|
65
65
|
act(() => root?.unmount());
|
|
66
66
|
root = null;
|
|
67
|
+
vi.useRealTimers();
|
|
67
68
|
thumbnailScheduler.invalidateProject("p");
|
|
68
69
|
globalThis.IntersectionObserver = originalIO;
|
|
69
70
|
globalThis.ResizeObserver = originalRO;
|
|
@@ -187,7 +188,9 @@ describe("ImageThumbnail", () => {
|
|
|
187
188
|
probe.onload?.();
|
|
188
189
|
});
|
|
189
190
|
|
|
191
|
+
vi.useFakeTimers({ toFake: ["requestAnimationFrame", "cancelAnimationFrame"] });
|
|
190
192
|
act(() => reportResize(500, 40));
|
|
193
|
+
act(() => vi.advanceTimersToNextFrame());
|
|
191
194
|
|
|
192
195
|
expect(host.querySelector("img")?.parentElement?.style.width).toBe("108px");
|
|
193
196
|
});
|
|
@@ -23,6 +23,7 @@ beforeEach(() => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
afterEach(() => {
|
|
26
|
+
vi.useRealTimers();
|
|
26
27
|
thumbnailScheduler.invalidateProject("p");
|
|
27
28
|
vi.clearAllMocks();
|
|
28
29
|
});
|
|
@@ -243,8 +244,10 @@ describe("VideoThumbnail", () => {
|
|
|
243
244
|
});
|
|
244
245
|
await render(0, 0);
|
|
245
246
|
|
|
247
|
+
vi.useFakeTimers({ toFake: ["requestAnimationFrame", "cancelAnimationFrame"] });
|
|
248
|
+
act(() => reportResize(500, 40));
|
|
246
249
|
await act(async () => {
|
|
247
|
-
|
|
250
|
+
vi.advanceTimersToNextFrame();
|
|
248
251
|
await Promise.resolve();
|
|
249
252
|
});
|
|
250
253
|
|
|
@@ -264,7 +267,9 @@ describe("VideoThumbnail", () => {
|
|
|
264
267
|
|
|
265
268
|
describe("VideoThumbnail during a zoom", () => {
|
|
266
269
|
beforeEach(() => {
|
|
267
|
-
vi.useFakeTimers({
|
|
270
|
+
vi.useFakeTimers({
|
|
271
|
+
toFake: ["setTimeout", "clearTimeout", "requestAnimationFrame", "cancelAnimationFrame"],
|
|
272
|
+
});
|
|
268
273
|
vi.mocked(decodeVideoThumbnail).mockResolvedValue({
|
|
269
274
|
value: { kind: "filmstrip", urls: ["blob:a", "blob:b"], aspect: 16 / 9 },
|
|
270
275
|
weight: 256,
|
|
@@ -308,6 +313,7 @@ describe("VideoThumbnail during a zoom", () => {
|
|
|
308
313
|
vi.mocked(decodeVideoThumbnail).mockImplementation(() => new Promise(() => {}));
|
|
309
314
|
await act(async () => {
|
|
310
315
|
reportResize(880, 40);
|
|
316
|
+
vi.advanceTimersToNextFrame();
|
|
311
317
|
await Promise.resolve();
|
|
312
318
|
});
|
|
313
319
|
await rest();
|
|
@@ -326,6 +332,7 @@ describe("VideoThumbnail during a zoom", () => {
|
|
|
326
332
|
vi.mocked(decodeVideoThumbnail).mockImplementation(() => new Promise(() => {}));
|
|
327
333
|
await act(async () => {
|
|
328
334
|
reportResize(880, 40);
|
|
335
|
+
vi.advanceTimersToNextFrame();
|
|
329
336
|
root.render(clip(undefined, "overscan"));
|
|
330
337
|
await Promise.resolve();
|
|
331
338
|
});
|
|
@@ -371,6 +378,7 @@ describe("VideoThumbnail during a zoom", () => {
|
|
|
371
378
|
vi.mocked(decodeVideoThumbnail).mockImplementation(() => new Promise(() => {}));
|
|
372
379
|
await act(async () => {
|
|
373
380
|
reportResize(880, 40);
|
|
381
|
+
vi.advanceTimersToNextFrame();
|
|
374
382
|
await Promise.resolve();
|
|
375
383
|
});
|
|
376
384
|
await rest();
|
|
@@ -411,6 +419,7 @@ describe("VideoThumbnail during a zoom", () => {
|
|
|
411
419
|
await render(440);
|
|
412
420
|
await act(async () => {
|
|
413
421
|
reportResize(50, 40);
|
|
422
|
+
vi.advanceTimersToNextFrame();
|
|
414
423
|
await Promise.resolve();
|
|
415
424
|
});
|
|
416
425
|
await rest();
|
|
@@ -419,6 +428,7 @@ describe("VideoThumbnail during a zoom", () => {
|
|
|
419
428
|
vi.mocked(decodeVideoThumbnail).mockImplementation(() => new Promise(() => {}));
|
|
420
429
|
await act(async () => {
|
|
421
430
|
reportResize(880, 40);
|
|
431
|
+
vi.advanceTimersToNextFrame();
|
|
422
432
|
await Promise.resolve();
|
|
423
433
|
});
|
|
424
434
|
await rest();
|
|
@@ -431,6 +441,7 @@ describe("VideoThumbnail during a zoom", () => {
|
|
|
431
441
|
await act(async () => {
|
|
432
442
|
markTimelineMotion();
|
|
433
443
|
reportResize(880, 40);
|
|
444
|
+
vi.advanceTimersToNextFrame();
|
|
434
445
|
await Promise.resolve();
|
|
435
446
|
});
|
|
436
447
|
expect(decodeVideoThumbnail).not.toHaveBeenCalled();
|
|
@@ -13,6 +13,7 @@ import { createTimelineDomNodeResolver, findClipElementById } from "../lib/timel
|
|
|
13
13
|
import { usePlayerStore } from "../store/playerStore";
|
|
14
14
|
import type { TimelineElement, DomClipChild, SubCompositionHostState } from "../store/playerStore";
|
|
15
15
|
import { resolveCssStackingContextId } from "@hyperframes/core/runtime/stacking-context";
|
|
16
|
+
import { LOOP_INFLATED_TIMELINE_SECONDS } from "@hyperframes/core/runtime/composition-length";
|
|
16
17
|
import type { ClipTree } from "@hyperframes/core/runtime/clipTree";
|
|
17
18
|
import { HF_AUDIO_GROUP_ATTR } from "@hyperframes/core/audio-groups";
|
|
18
19
|
import { groupInfoFor } from "../lib/timelineGroupInfo";
|
|
@@ -31,7 +32,7 @@ import { inspectStudioRuntimeMessage } from "../lib/runtimeProtocol";
|
|
|
31
32
|
|
|
32
33
|
/** Reject non-finite, non-positive, and absurdly large (loop-inflated) values. */
|
|
33
34
|
export function sanitizeDurationSeconds(value: number): number {
|
|
34
|
-
return Number.isFinite(value) && value > 0 && value <
|
|
35
|
+
return Number.isFinite(value) && value > 0 && value < LOOP_INFLATED_TIMELINE_SECONDS ? value : 0;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import {
|
|
4
|
+
PREVIEW_RASTER_ATTR,
|
|
5
|
+
STUDIO_PREVIEW_LAZY_ATTR,
|
|
6
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
7
|
+
import { liveMarkupWithoutPreviewMarks } from "./authoredSource";
|
|
8
|
+
|
|
9
|
+
describe("liveMarkupWithoutPreviewMarks", () => {
|
|
10
|
+
it("drops the preview's raster mark from an element and its descendants", () => {
|
|
11
|
+
const live = document.createElement("div");
|
|
12
|
+
live.innerHTML = `<div class="line" ${PREVIEW_RASTER_ATTR}><span class="word">LOUD</span></div>`;
|
|
13
|
+
live.setAttribute(PREVIEW_RASTER_ATTR, "");
|
|
14
|
+
expect(liveMarkupWithoutPreviewMarks(live)).toBe(
|
|
15
|
+
'<div><div class="line"><span class="word">LOUD</span></div></div>',
|
|
16
|
+
);
|
|
17
|
+
expect(live.hasAttribute(PREVIEW_RASTER_ATTR)).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("gives a lazily previewed image back its authored loading", () => {
|
|
21
|
+
const live = document.createElement("div");
|
|
22
|
+
live.innerHTML = `<img src="a.png" loading="lazy" ${STUDIO_PREVIEW_LAZY_ATTR}>`;
|
|
23
|
+
expect(liveMarkupWithoutPreviewMarks(live)).toBe('<div><img src="a.png"></div>');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureHfIds, isCompositionTemplate } from "@hyperframes/parsers/hf-ids";
|
|
2
2
|
import {
|
|
3
|
+
PREVIEW_ONLY_ATTRS,
|
|
3
4
|
STUDIO_PREVIEW_LAZY_ATTR,
|
|
4
|
-
STUDIO_PREVIEW_UPCOMING_ATTR,
|
|
5
5
|
} from "@hyperframes/core/studio-preview-mark";
|
|
6
6
|
|
|
7
7
|
// Stamped as the preview stamps the files it serves, so a live element's hf-id finds its source.
|
|
@@ -98,10 +98,8 @@ export function authoredMarkup(authored: Element, live: Element, sourceFile: str
|
|
|
98
98
|
export function liveMarkupWithoutPreviewMarks(live: Element): string {
|
|
99
99
|
const copy = live.cloneNode(true) as Element;
|
|
100
100
|
for (const el of [copy, ...Array.from(copy.querySelectorAll("*"))]) {
|
|
101
|
-
el.removeAttribute(
|
|
102
|
-
|
|
103
|
-
el.removeAttribute("loading");
|
|
104
|
-
el.removeAttribute(STUDIO_PREVIEW_LAZY_ATTR);
|
|
101
|
+
if (el.hasAttribute(STUDIO_PREVIEW_LAZY_ATTR)) el.removeAttribute("loading");
|
|
102
|
+
for (const attr of PREVIEW_ONLY_ATTRS) el.removeAttribute(attr);
|
|
105
103
|
}
|
|
106
104
|
return copy.outerHTML;
|
|
107
105
|
}
|
package/src/utils/rounding.ts
CHANGED
|
@@ -8,6 +8,13 @@ export function roundToLayoutPx(val: number): number {
|
|
|
8
8
|
return Math.round(val);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export function roundToLayoutSize(size: { width: number; height: number }) {
|
|
12
|
+
return {
|
|
13
|
+
width: roundToLayoutPx(Math.max(1, size.width)),
|
|
14
|
+
height: roundToLayoutPx(Math.max(1, size.height)),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
/** Round to 2 decimal places (centisecond precision for timeline values). */
|
|
12
19
|
export function roundToCenti(val: number): number {
|
|
13
20
|
return Math.round(val * 100) / 100;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/cn.ts","../src/components/ui/Button.tsx","../src/components/ui/IconButton.tsx","../src/components/ui/Tabs.tsx","../src/components/ui/HyperframesMark.tsx","../src/components/ui/HyperframesLoader.tsx","../src/components/ui/Menu.tsx","../src/components/ui/Tooltip.tsx","../src/components/ui/Popover.tsx","../src/components/ui/Input.tsx","../src/components/ui/NumberField.tsx","../src/components/ui/Select.tsx","../src/components/ui/Slider.tsx","../src/components/ui/Toggle.tsx"],"sourcesContent":["/**\n * Studio's tailwind-merge config: teaches it the two scales `theme.css`\n * invents (`text-step-*`, `ctl`/`ctl-sm`/`ctl-lg`) so overrides replace, not stack.\n */\n\nimport type { CnFunction } from \"cn\";\nimport { createCn } from \"cn/config\";\n\n/** `text-step-11`, `text-step-9`, … — the type scale from `theme.css`. */\nconst isTypeStep = (value: string) => /^step-\\d+$/.test(value);\n\n/** `ctl`, `ctl-sm`, `ctl-lg` — the control heights from `theme.css`. */\nconst isControlSize = (value: string) => /^ctl(-sm|-lg)?$/.test(value);\n\nexport const cn: CnFunction = createCn({\n extend: {\n classGroups: {\n \"font-size\": [{ text: [isTypeStep] }],\n h: [{ h: [isControlSize] }],\n w: [{ w: [isControlSize] }],\n size: [{ size: [isControlSize] }],\n \"min-h\": [{ \"min-h\": [isControlSize] }],\n \"min-w\": [{ \"min-w\": [isControlSize] }],\n },\n },\n});\n","/**\n * Button — a native `<button>` wearing Studio's tokens.\n *\n * Everything visual comes from `theme.css`: the three control heights, the\n * radius scale, the semantic colours, the motion durations. No value is decided\n * here, so a button cannot drift from the rest of the system.\n *\n * Two conventions: classes merge through `cn`, so a caller's `className`\n * always wins within its group; and every interactive look is written twice,\n * once as the real state and once as `data-[preview-state=…]` (CSS-only, for\n * screenshots). `Button.test.tsx` asserts the two stay in sync.\n */\n\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode } from \"react\";\nimport { cn } from \"./cn\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"danger\" | \"ghost\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\n/** Forces one interactive look for a gallery shot. CSS-only; see the header. */\nexport type PreviewState = \"hover\" | \"active\" | \"focus\";\n\nexport interface ButtonBaseProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n \"data-preview-state\"?: PreviewState;\n}\n\ninterface ButtonProps extends ButtonBaseProps {\n loading?: boolean;\n icon?: ReactNode;\n}\n\n/**\n * Shared by Button and IconButton. `disabled:` keeps pointer events alive so a\n * wrapping Tooltip can still explain why the control is disabled.\n */\nexport const buttonBase = cn(\n \"inline-flex items-center justify-center select-none cursor-pointer whitespace-nowrap\",\n \"transition-[background-color,border-color,color,filter,transform] ease-out-quint duration-press\",\n \"disabled:opacity-40 disabled:cursor-not-allowed\",\n \"outline-hidden\",\n \"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent\",\n \"data-[preview-state=focus]:outline-solid data-[preview-state=focus]:outline-2 data-[preview-state=focus]:outline-offset-1 data-[preview-state=focus]:outline-accent\",\n);\n\n/**\n * One entry per variant. The `data-[preview-state=…]` half of each string\n * repeats the `hover:` and `active:` half exactly; the test pairs them.\n */\nexport const buttonVariants: Record<ButtonVariant, string> = {\n primary: cn(\n \"bg-accent text-on-accent font-semibold\",\n \"enabled:hover:bg-accent-hover data-[preview-state=hover]:bg-accent-hover\",\n \"enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]\",\n ),\n secondary: cn(\n \"bg-transparent text-text-1 font-medium border border-border-strong\",\n \"enabled:hover:bg-hover enabled:hover:text-text-0 data-[preview-state=hover]:bg-hover data-[preview-state=hover]:text-text-0\",\n \"enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]\",\n ),\n danger: cn(\n \"bg-danger text-on-danger font-medium\",\n \"enabled:hover:brightness-95 data-[preview-state=hover]:brightness-95\",\n \"enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]\",\n ),\n ghost: cn(\n \"bg-transparent text-text-2 font-medium\",\n \"enabled:hover:bg-hover enabled:hover:text-text-0 data-[preview-state=hover]:bg-hover data-[preview-state=hover]:text-text-0\",\n \"enabled:active:scale-[0.98] data-[preview-state=active]:scale-[0.98]\",\n ),\n};\n\n/**\n * The three control heights, 24 / 28 / 32 px, from `--spacing-ctl-*`.\n * Exported so the Capture download `<a href>` can wear the same recipe as a Button.\n */\nexport const buttonSizes: Record<ButtonSize, string> = {\n sm: \"h-ctl-sm px-2 gap-1 rounded-sm text-step-11\",\n md: \"h-ctl px-3 gap-1.5 rounded-md text-step-12\",\n lg: \"h-ctl-lg px-4 gap-2 rounded-md text-step-13\",\n};\n\nfunction Spinner() {\n return (\n <svg className=\"animate-spin size-3.5\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path\n className=\"opacity-75\"\n fill=\"currentColor\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"\n />\n </svg>\n );\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n { variant = \"secondary\", size = \"md\", loading, icon, children, className, disabled, ...props },\n ref,\n ) => {\n const isDisabled = disabled || loading;\n let leading: ReactNode = null;\n if (loading) leading = <Spinner />;\n else if (icon) leading = <span className=\"shrink-0\">{icon}</span>;\n return (\n <button\n ref={ref}\n disabled={isDisabled}\n // `aria-disabled` as well as `disabled`: assistive tech announces the\n // state even where the native attribute is filtered out of the tree.\n aria-disabled={isDisabled || undefined}\n className={cn(buttonBase, buttonVariants[variant], buttonSizes[size], className)}\n {...props}\n >\n {leading}\n {children}\n </button>\n );\n },\n);\nButton.displayName = \"Button\";\n","/**\n * IconButton — Button's square sibling; shares its base/variant classes so\n * the two never drift. `aria-label` is required for screen readers.\n */\n\nimport { forwardRef } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { buttonBase, buttonVariants, type ButtonBaseProps, type ButtonSize } from \"./Button\";\nimport { cn } from \"./cn\";\n\ninterface IconButtonProps extends ButtonBaseProps {\n icon: ReactNode;\n \"aria-label\": string;\n}\n\n/** Square boxes on the same 24 / 28 / 32 px control heights as Button. */\nconst iconSizeStyles: Record<ButtonSize, string> = {\n sm: \"size-ctl-sm rounded-sm\",\n md: \"size-ctl rounded-md\",\n lg: \"size-ctl-lg rounded-md\",\n};\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n ({ icon, size = \"md\", variant = \"ghost\", className, disabled, ...props }, ref) => {\n return (\n <button\n ref={ref}\n disabled={disabled}\n aria-disabled={disabled || undefined}\n className={cn(buttonBase, buttonVariants[variant], iconSizeStyles[size], className)}\n {...props}\n >\n {icon}\n </button>\n );\n },\n);\nIconButton.displayName = \"IconButton\";\n","/**\n * Tabs — Base UI's tabs wearing Studio's tokens; replaces six hand-rolled\n * strips with one implementation (roving tabindex, arrow/Home/End, `aria-controls`).\n */\n\nimport { Tabs as BaseTabs } from \"@base-ui/react/tabs\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport { cn } from \"./cn\";\nimport type { PreviewState } from \"./Button\";\n\n/**\n * Base UI lets `className` be a function of the part's state. Studio's parts\n * merge a string with `cn`, so the string form is the one they accept.\n */\ntype StyledProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, \"className\"> & {\n className?: string;\n};\n\n/**\n * Groups a tab list with its panels. Uncontrolled by default; pass `value` and\n * `onValueChange` for a strip whose selection lives in a store.\n */\nexport function Tabs(props: ComponentPropsWithoutRef<typeof BaseTabs.Root>) {\n return <BaseTabs.Root {...props} />;\n}\n\n/** The strip. Give it an `aria-label`: a tablist with no name is unlabelled. */\nexport function TabsList({ className, ...props }: StyledProps<typeof BaseTabs.List>) {\n return (\n <BaseTabs.List\n // Arrow keys move selection, matching today's sidebar strip.\n activateOnFocus\n className={cn(\"inline-flex items-center gap-0.5 rounded-lg bg-surface-alt p-1\", className)}\n {...props}\n />\n );\n}\n\ninterface TabProps extends StyledProps<typeof BaseTabs.Tab> {\n value: string;\n \"data-preview-state\"?: PreviewState;\n}\n\n/**\n * aria-selected drives the selected look (Base UI sets it) so assistive tech\n * and sighted users match. data-preview-state is for gallery shots only.\n */\nexport function Tab({ value, className, ...props }: TabProps) {\n return (\n <BaseTabs.Tab\n value={value}\n data-tab-id={value}\n className={cn(\n \"inline-flex h-ctl-sm cursor-pointer select-none items-center justify-center rounded-sm px-2.5\",\n \"text-step-11 font-semibold whitespace-nowrap text-text-3\",\n \"transition-[background-color,color] ease-out-quint duration-hover\",\n \"hover:text-text-1 data-[preview-state=hover]:text-text-1\",\n \"aria-selected:bg-hover aria-selected:text-text-0\",\n \"outline-hidden focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent\",\n \"data-[preview-state=focus]:outline-solid data-[preview-state=focus]:outline-2 data-[preview-state=focus]:outline-offset-1 data-[preview-state=focus]:outline-accent\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** The panel for one tab. Base UI wires `aria-labelledby` back to its tab. */\nexport function TabPanel({ className, ...props }: StyledProps<typeof BaseTabs.Panel>) {\n return <BaseTabs.Panel className={cn(\"outline-hidden\", className)} {...props} />;\n}\n","import { useId, type SVGProps } from \"react\";\n\nexport function HyperframesMark({ viewBox = \"0 0 100 100\", ...props }: SVGProps<SVGSVGElement>) {\n const gradientId = useId();\n const leftGradient = `${gradientId}-left`;\n const rightGradient = `${gradientId}-right`;\n return (\n <svg\n viewBox={viewBox}\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n {...props}\n >\n <g transform=\"translate(50 50)\" opacity=\".92\">\n <g transform=\"translate(-50 -50)\">\n <path\n d=\"M10.1851 57.8021L33.1145 73.8313C36.2202 75.9978 41.5173 73.5433 42.4816 69.4984L51.7611 30.4271C52.7253 26.3822 48.5802 23.9277 44.4602 26.0942L13.917 42.1235C6.96677 45.7676 4.97564 54.1579 10.1851 57.8021Z\"\n fill={`url(#${leftGradient})`}\n />\n <path\n d=\"M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z\"\n fill={`url(#${rightGradient})`}\n />\n </g>\n </g>\n <defs>\n <linearGradient\n id={leftGradient}\n x1=\"48.5676\"\n y1=\"25\"\n x2=\"44.7804\"\n y2=\"71.9384\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#06E3FA\" />\n <stop offset=\"1\" stopColor=\"#4FDB5E\" />\n </linearGradient>\n <linearGradient\n id={rightGradient}\n x1=\"54.8282\"\n y1=\"73.8392\"\n x2=\"72.0989\"\n y2=\"32.8932\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#06E3FA\" />\n <stop offset=\"1\" stopColor=\"#4FDB5E\" />\n </linearGradient>\n </defs>\n </svg>\n );\n}\n","import { HyperframesMark } from \"./HyperframesMark\";\n\nexport interface HyperframesLoaderProps {\n /** Status text shown below the mark. */\n title: string;\n /** Optional secondary detail line. */\n detail?: string;\n /** Optional monospace third line for IDs, counts, or percentages. */\n mono?: string;\n /** Pixel size of the mark itself; status text scales independently. */\n size?: number;\n /** Optional normalized progress value from 0 to 1. */\n progress?: number;\n}\n\nexport function HyperframesLoader({\n title,\n detail,\n mono,\n size = 64,\n progress,\n}: HyperframesLoaderProps) {\n const boundedProgress =\n typeof progress === \"number\" && Number.isFinite(progress)\n ? Math.min(1, Math.max(0, progress))\n : undefined;\n const markFrameSize = Math.round(size * 1.16);\n\n return (\n <div className=\"hf-loader\" role=\"status\" draggable={false}>\n <div\n className=\"hf-loader-mark-frame\"\n style={{ width: markFrameSize, height: markFrameSize }}\n draggable={false}\n >\n <HyperframesMark className=\"hf-loader-mark\" width={size} height={size} />\n </div>\n <div className=\"hf-loader-title\">{title}</div>\n {detail && <div className=\"hf-loader-detail\">{detail}</div>}\n {boundedProgress !== undefined && (\n <div\n className=\"hf-loader-progress\"\n role=\"progressbar\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(boundedProgress * 100)}\n >\n <div\n className=\"hf-loader-progress__fill\"\n style={{ transform: `scaleX(${boundedProgress})` }}\n />\n </div>\n )}\n {mono && <div className=\"hf-loader-mono\">{mono}</div>}\n </div>\n );\n}\n\n// fallow-ignore-next-line unused-export\nexport function StatusFrame(props: HyperframesLoaderProps) {\n return (\n <div className=\"hf-frame\">\n <HyperframesLoader {...props} />\n </div>\n );\n}\n","/**\n * Menu and ContextMenu on Base UI. Dismissal is plain Base UI (capture-phase listeners survive the overlay's\n * `stopPropagation`); `trigger` is rendered, not wrapped; `container` exists for shadow roots.\n */\n\nimport { ContextMenu as BaseContextMenu } from \"@base-ui/react/context-menu\";\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\nimport { cn } from \"./cn\";\n\n/**\n * Base UI lets `className` be a function of the part's state. Studio's parts\n * merge a string with `cn`, so the string form is the one they accept.\n */\ntype StyledProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, \"className\"> & {\n className?: string;\n};\n\n/** Forces the settled open look for a gallery shot; CSS-only, open state stays controlled. */\nexport type PopupPreviewState = \"open\";\n\n/** Where the portal puts the popup. `null` keeps it inline, next to its trigger. */\ntype PortalContainer = ComponentPropsWithoutRef<typeof BaseMenu.Portal>[\"container\"];\n\n/** Matches Tooltip's gap from its trigger, and its viewport margin. */\nconst SIDE_OFFSET = 6;\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Enter and exit shared by menus, popovers, dropdowns, and tooltips.\n * The open duration class differs; the shape does not.\n * `data-starting-style`/`data-ending-style` are Base UI's transition attributes.\n */\nexport function floatingMotion(openDuration: \"duration-open\" | \"duration-tooltip\") {\n return cn(\n \"origin-[var(--transform-origin)] outline-hidden\",\n \"transition-[opacity,transform] ease-out-quint\",\n openDuration,\n \"data-[ending-style]:duration-close data-[ending-style]:ease-in\",\n \"data-[starting-style]:[opacity:var(--popup-enter-opacity)]\",\n \"data-[starting-style]:[scale:var(--popup-enter-scale)]\",\n \"data-[ending-style]:opacity-0\",\n );\n}\n\n/**\n * Chrome shared by every floating panel (`Popover` too); callers add their own shadow token.\n */\nexport const popupSurface = cn(\n \"rounded-lg border border-border-input bg-surface\",\n floatingMotion(\"duration-open\"),\n \"data-[preview-state=open]:opacity-100 data-[preview-state=open]:scale-100\",\n);\n\n/** Every floating list, menu, popover and tooltip sits on this layer, above panel chrome and modals. */\nexport const POPUP_LAYER = \"z-200\";\n\nconst menuPopup = cn(popupSurface, \"min-w-36 p-1 shadow-menu\");\n\n/** One row. `data-highlighted` is set by keyboard and pointer alike, so the seen row is the Enter row. */\nconst itemBase = cn(\n \"flex cursor-default select-none items-center justify-between gap-6 rounded-sm px-2 py-1.5\",\n \"text-step-11 whitespace-nowrap text-text-1\",\n \"outline-hidden transition-colors ease-out-quint duration-hover\",\n \"data-[highlighted]:bg-hover data-[highlighted]:text-text-0\",\n \"data-[preview-state=hover]:bg-hover data-[preview-state=hover]:text-text-0\",\n \"data-[disabled]:pointer-events-none data-[disabled]:opacity-40\",\n);\n\nconst itemDanger = cn(\n \"text-danger-ink data-[highlighted]:bg-danger/15 data-[highlighted]:text-danger-ink\",\n);\n\nexport type MenuItemTone = \"default\" | \"danger\";\n\ninterface PositionedProps {\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n align?: \"start\" | \"center\" | \"end\";\n sideOffset?: number;\n /** Portal target. Pass the shadow root when the trigger lives in one. */\n container?: PortalContainer;\n /** Names the popup for assistive tech. A menu with no name is unlabelled. */\n \"aria-label\"?: string;\n className?: string;\n \"data-preview-state\"?: PopupPreviewState;\n}\n\ninterface MenuProps\n extends PositionedProps, Omit<ComponentPropsWithoutRef<typeof BaseMenu.Root>, \"children\"> {\n /** A single element. It becomes the trigger; no wrapper is added around it. */\n trigger: ReactElement;\n /** The items: `MenuItem`, `MenuRadioGroup`, `MenuSeparator`. */\n children: ReactNode;\n}\n\n/**\n * A menu opened by its trigger. Uncontrolled by default; pass `open` and\n * `onOpenChange` for a menu whose state lives in a store.\n */\nexport function Menu({\n trigger,\n children,\n side = \"bottom\",\n align = \"start\",\n sideOffset = SIDE_OFFSET,\n container,\n className,\n \"aria-label\": ariaLabel,\n \"data-preview-state\": previewState,\n ...root\n}: MenuProps) {\n return (\n <BaseMenu.Root {...root}>\n <BaseMenu.Trigger render={trigger} />\n <BaseMenu.Portal container={container}>\n <BaseMenu.Positioner\n side={side}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={VIEWPORT_MARGIN}\n className={POPUP_LAYER}\n >\n <BaseMenu.Popup\n aria-label={ariaLabel}\n data-preview-state={previewState}\n className={cn(menuPopup, className)}\n >\n {children}\n </BaseMenu.Popup>\n </BaseMenu.Positioner>\n </BaseMenu.Portal>\n </BaseMenu.Root>\n );\n}\n\ninterface ContextMenuProps\n extends PositionedProps, Omit<ComponentPropsWithoutRef<typeof BaseContextMenu.Root>, \"children\"> {\n /**\n * The right-clickable area, as the caller's own element. Its children are\n * kept: the trigger renders that element rather than wrapping it.\n */\n trigger: ReactElement;\n children: ReactNode;\n}\n\n/** Opened by right click or long press at the pointer, so `side` and `align` are not offered. */\nexport function ContextMenu({\n trigger,\n children,\n container,\n className,\n \"aria-label\": ariaLabel,\n \"data-preview-state\": previewState,\n ...root\n}: Omit<ContextMenuProps, \"side\" | \"align\" | \"sideOffset\">) {\n return (\n <BaseContextMenu.Root {...root}>\n <BaseContextMenu.Trigger render={trigger} />\n <BaseContextMenu.Portal container={container}>\n <BaseContextMenu.Positioner collisionPadding={VIEWPORT_MARGIN} className={POPUP_LAYER}>\n <BaseContextMenu.Popup\n aria-label={ariaLabel}\n data-preview-state={previewState}\n className={cn(menuPopup, className)}\n >\n {children}\n </BaseContextMenu.Popup>\n </BaseContextMenu.Positioner>\n </BaseContextMenu.Portal>\n </BaseContextMenu.Root>\n );\n}\n\n/** Keyboard shortcut hint, mono and tabular; exported for hints that are not a plain string. */\nexport function MenuShortcut({ className, ...props }: StyledProps<\"span\">) {\n return (\n <span\n className={cn(\"shrink-0 font-mono text-step-10 tabular-nums text-text-4\", className)}\n aria-hidden=\"true\"\n {...props}\n />\n );\n}\n\ninterface MenuItemProps extends StyledProps<typeof BaseMenu.Item> {\n /** Rendered as a dim mono hint on the trailing edge. Decorative. */\n shortcut?: string;\n /** `danger` for a destructive action (Delete, Remove). */\n tone?: MenuItemTone;\n \"data-preview-state\"?: \"hover\";\n}\n\n/** One action. `disabled` items are skipped by the arrow keys, not just dimmed. */\nexport function MenuItem({ shortcut, tone, className, children, ...props }: MenuItemProps) {\n return (\n <BaseMenu.Item className={cn(itemBase, tone === \"danger\" && itemDanger, className)} {...props}>\n <span className=\"truncate\">{children}</span>\n {shortcut ? <MenuShortcut>{shortcut}</MenuShortcut> : null}\n </BaseMenu.Item>\n );\n}\n\n/** Single-choice group; selection is `aria-checked` on each item, which the dot indicator draws from. */\nexport function MenuRadioGroup(props: ComponentPropsWithoutRef<typeof BaseMenu.RadioGroup>) {\n return <BaseMenu.RadioGroup {...props} />;\n}\n\ninterface MenuRadioItemProps extends StyledProps<typeof BaseMenu.RadioItem> {\n \"data-preview-state\"?: \"hover\";\n}\n\n/** One choice in a `MenuRadioGroup`. The dot renders only while it is checked. */\nexport function MenuRadioItem({ className, children, ...props }: MenuRadioItemProps) {\n return (\n <BaseMenu.RadioItem className={cn(itemBase, className)} {...props}>\n <span className=\"truncate\">{children}</span>\n {/* Fixed box so a checked and an unchecked row keep the same width. */}\n <span className=\"flex size-3 shrink-0 items-center justify-center\">\n <BaseMenu.RadioItemIndicator className=\"size-1.5 rounded-full bg-accent\" />\n </span>\n </BaseMenu.RadioItem>\n );\n}\n\n/** An on/off row; the tick renders only while `checked`. */\nexport function MenuCheckboxItem({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseMenu.CheckboxItem>) {\n return (\n <BaseMenu.CheckboxItem className={cn(itemBase, className)} {...props}>\n <span className=\"truncate\">{children}</span>\n <span className=\"flex size-3 shrink-0 items-center justify-center text-accent-ink\">\n <BaseMenu.CheckboxItemIndicator>✓</BaseMenu.CheckboxItemIndicator>\n </span>\n </BaseMenu.CheckboxItem>\n );\n}\n\n/** A hairline between two groups of items. */\nexport function MenuSeparator({ className, ...props }: StyledProps<typeof BaseMenu.Separator>) {\n return <BaseMenu.Separator className={cn(\"my-1 h-px bg-hairline\", className)} {...props} />;\n}\n","/**\n * Tooltip: Base UI's tooltip in Studio tokens. The trigger is a box-less\n * `display: contents` wrapper so a disabled control still gets hover.\n */\n\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { cloneElement, useId, useRef, useState, type ReactElement } from \"react\";\nimport { cn } from \"./cn\";\nimport { floatingMotion, POPUP_LAYER } from \"./Menu\";\n\ninterface TooltipProps {\n label: string;\n /** A single element, wrapped in a box-less span so a disabled one still gets hover. */\n children: ReactElement<{ \"aria-describedby\"?: string }>;\n /** Hover delay in ms. */\n delay?: number;\n disabled?: boolean;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}\n\n/** Matches the old bubble's gap from its trigger, and its viewport margin. */\nconst SIDE_OFFSET = 6;\nconst VIEWPORT_MARGIN = 8;\n\nexport function Tooltip({\n label,\n children,\n delay = 400,\n side = \"top\",\n disabled = false,\n}: TooltipProps) {\n const [open, setOpen] = useState(false);\n const boxRef = useRef<HTMLSpanElement>(null);\n const tooltipId = useId();\n\n return (\n <BaseTooltip.Root open={open} onOpenChange={setOpen} disabled={disabled}>\n <BaseTooltip.Trigger delay={delay} render={<span ref={boxRef} className=\"contents\" />}>\n {cloneElement(children, {\n \"aria-describedby\": open && !disabled ? tooltipId : children.props[\"aria-describedby\"],\n })}\n </BaseTooltip.Trigger>\n <BaseTooltip.Portal>\n <BaseTooltip.Positioner\n anchor={() => boxRef.current?.firstElementChild ?? null}\n side={side}\n sideOffset={SIDE_OFFSET}\n collisionPadding={VIEWPORT_MARGIN}\n className={POPUP_LAYER}\n >\n <BaseTooltip.Popup\n id={tooltipId}\n role=\"tooltip\"\n className={cn(\n \"pointer-events-none rounded-md border border-border-input bg-surface px-2 py-1 text-step-10 font-medium text-text-1 whitespace-nowrap shadow-menu\",\n floatingMotion(\"duration-tooltip\"),\n )}\n >\n {label}\n </BaseTooltip.Popup>\n </BaseTooltip.Positioner>\n </BaseTooltip.Portal>\n </BaseTooltip.Root>\n );\n}\n","/**\n * Popover: `Menu`'s floating chrome (`popupSurface`) without item semantics, so arrow keys\n * stay with whatever is focused inside (rename inputs, forms). Only the shadow differs.\n */\n\nimport { Popover as BasePopover } from \"@base-ui/react/popover\";\nimport type { ComponentPropsWithoutRef, ReactElement, ReactNode } from \"react\";\nimport { cn } from \"./cn\";\nimport { POPUP_LAYER, popupSurface, type PopupPreviewState } from \"./Menu\";\n\ntype PortalContainer = ComponentPropsWithoutRef<typeof BasePopover.Portal>[\"container\"];\n\n/** Matches Menu's gap from its trigger, and its viewport margin. */\nconst SIDE_OFFSET = 6;\nconst VIEWPORT_MARGIN = 8;\n\n/** The arrow's 14x8 box overlaps the popup's border by 1px, so its fill hides the border where it meets the popup. */\nconst ARROW_PX = 7;\nconst ARROW_CORNER_CLEARANCE = 10;\nconst arrowPlace = cn(\n \"data-[side=bottom]:-top-[7px] data-[side=top]:-bottom-[7px] data-[side=top]:rotate-180\",\n \"data-[side=left]:-right-[10px] data-[side=left]:rotate-90\",\n \"data-[side=right]:-left-[10px] data-[side=right]:-rotate-90\",\n);\n\ninterface PopoverProps extends Omit<ComponentPropsWithoutRef<typeof BasePopover.Root>, \"children\"> {\n /** A single element. It becomes the trigger; no wrapper is added around it. */\n trigger: ReactElement;\n /** Arbitrary content. The popover owns none of its keys. */\n children: ReactNode;\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n align?: \"start\" | \"center\" | \"end\";\n sideOffset?: number;\n /** Points the popup at its trigger. Off by default; the default gap from the trigger grows by the arrow's height. */\n arrow?: boolean;\n /** Portal target. Pass the shadow root when the trigger lives in one. */\n container?: PortalContainer;\n /** Names the popup for assistive tech. */\n \"aria-label\"?: string;\n /**\n * What to focus on open. Defaults to Base UI's behaviour (the first tabbable\n * element), which is what a rename field wants.\n */\n initialFocus?: ComponentPropsWithoutRef<typeof BasePopover.Popup>[\"initialFocus\"];\n className?: string;\n \"data-preview-state\"?: PopupPreviewState;\n}\n\nexport function Popover({\n trigger,\n children,\n side = \"bottom\",\n align = \"center\",\n arrow = false,\n sideOffset = arrow ? SIDE_OFFSET + ARROW_PX : SIDE_OFFSET,\n container,\n className,\n initialFocus,\n \"aria-label\": ariaLabel,\n \"data-preview-state\": previewState,\n ...root\n}: PopoverProps) {\n return (\n <BasePopover.Root {...root}>\n <BasePopover.Trigger render={trigger} />\n <BasePopover.Portal container={container}>\n <BasePopover.Positioner\n side={side}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={VIEWPORT_MARGIN}\n arrowPadding={ARROW_CORNER_CLEARANCE}\n className={POPUP_LAYER}\n >\n <BasePopover.Popup\n aria-label={ariaLabel}\n initialFocus={initialFocus}\n data-preview-state={previewState}\n className={cn(popupSurface, \"p-3 text-step-11 text-text-1 shadow-popover\", className)}\n >\n {arrow && (\n <BasePopover.Arrow className={arrowPlace}>\n <svg width=\"14\" height=\"8\" viewBox=\"0 0 14 8\" aria-hidden=\"true\" className=\"block\">\n <path d=\"M0 8 L7 1 L14 8\" className=\"fill-surface stroke-border-input\" />\n </svg>\n </BasePopover.Arrow>\n )}\n {children}\n </BasePopover.Popup>\n </BasePopover.Positioner>\n </BasePopover.Portal>\n </BasePopover.Root>\n );\n}\n","/**\n * Input: a boxed text field. Typing edits a local draft; Enter and blur commit it,\n * Escape abandons it. `onTrack` fires once per commit, never per keystroke.\n */\n\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport { useEffect, useRef, useState, type ComponentPropsWithoutRef } from \"react\";\nimport { cn } from \"./cn\";\nimport type { PreviewState } from \"./Button\";\n\n/**\n * Shared field look (also used by NumberField and Select). Each interactive state is written\n * twice, real and `data-[preview-state=...]`; `valueControls.test.tsx` asserts the lists match.\n */\nexport const fieldBase = cn(\n \"flex min-w-0 items-center gap-1.5 h-ctl px-2 rounded-md\",\n \"bg-input border border-border-input text-step-11 font-medium text-text-1\",\n \"transition-[border-color,background-color] ease-standard duration-focus\",\n \"hover:border-border-strong data-[preview-state=hover]:border-border-strong\",\n \"outline-hidden\",\n \"focus-within:outline-solid focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-accent\",\n \"data-[preview-state=focus]:outline-solid data-[preview-state=focus]:outline-2 data-[preview-state=focus]:outline-offset-1 data-[preview-state=focus]:outline-accent\",\n // `aria-invalid` is not one of Tailwind's built-in aria variants, so the\n // arbitrary form is the one that compiles. The token gate would have caught\n // the bare `aria-invalid:` spelling as a class that resolves to nothing.\n \"aria-[invalid]:border-danger-ink\",\n \"has-[:disabled]:opacity-40 has-[:disabled]:cursor-not-allowed\",\n);\n\n/** The text itself, inside the box. The box owns the border and the ring. */\nexport const fieldText = cn(\n \"min-w-0 w-full bg-transparent text-inherit outline-hidden\",\n \"placeholder:text-text-5 disabled:cursor-not-allowed\",\n);\n\nexport interface InputProps extends Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"value\" | \"onChange\" | \"className\"\n> {\n /** The committed value. A draft lives inside until Enter or blur. */\n value: string;\n /** Called with the draft on Enter and on blur, only when it really changed. */\n onCommit: (next: string) => void;\n /** Called once per committed change, for design-input telemetry. */\n onTrack?: () => void;\n /** Marks the field invalid: red boundary and `aria-invalid`. */\n invalid?: boolean;\n className?: string;\n \"data-preview-state\"?: PreviewState;\n}\n\nexport function Input({\n value,\n onCommit,\n onTrack,\n invalid,\n disabled,\n className,\n \"data-preview-state\": previewState,\n ...props\n}: InputProps) {\n const [draft, setDraft] = useState(value);\n const valueRef = useRef(value);\n valueRef.current = value;\n const dirtyRef = useRef(false);\n\n // An external write (a seek, an undo, another panel) is authoritative, but it\n // must not eat what the user is halfway through typing.\n useEffect(() => {\n if (!dirtyRef.current) setDraft(value);\n }, [value]);\n\n const commit = (next: string) => {\n dirtyRef.current = false;\n if (next === valueRef.current) return;\n onCommit(next);\n onTrack?.();\n };\n\n return (\n <div\n className={cn(fieldBase, className)}\n aria-invalid={invalid || undefined}\n data-preview-state={previewState}\n >\n <BaseInput\n value={draft}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n className={fieldText}\n onValueChange={(next) => {\n dirtyRef.current = true;\n setDraft(next);\n }}\n onBlur={() => commit(draft)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n event.preventDefault();\n commit(draft);\n return;\n }\n if (event.key === \"Escape\") {\n // Abandon the draft rather than leave it for the blur commit.\n event.preventDefault();\n event.stopPropagation();\n dirtyRef.current = false;\n setDraft(valueRef.current);\n event.currentTarget.blur();\n }\n }}\n {...props}\n />\n </div>\n );\n}\n","/**\n * NumberField: the inspector's metric control. Commits only on blur, Enter, or a settled step (KTD11),\n * never per keystroke. The unit is a sibling of the input; unparseable text shows a red boundary and commits nothing.\n */\n\nimport { NumberField as BaseNumberField } from \"@base-ui/react/number-field\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { cn } from \"./cn\";\nimport { fieldBase, fieldText } from \"./Input\";\nimport type { PreviewState } from \"./Button\";\n\nexport interface NumberFieldProps {\n /** Accessible name. The inspector's row label is the usual one. */\n label: string;\n /** The committed value. */\n value: number;\n /** Called when a commit boundary produces a value different from `value`. */\n onCommit: (next: number) => void;\n /** Called once per committed change, for design-input telemetry. */\n onTrack?: () => void;\n /** Rendered beside the number: \"px\", \"%\", \"deg\". Never part of the text. */\n unit?: string;\n min?: number;\n max?: number;\n step?: number;\n disabled?: boolean;\n className?: string;\n \"data-preview-state\"?: PreviewState;\n}\n\nexport function NumberField({\n label,\n value,\n onCommit,\n onTrack,\n unit,\n min,\n max,\n step,\n disabled,\n className,\n \"data-preview-state\": previewState,\n}: NumberFieldProps) {\n const [draft, setDraft] = useState<number | null>(value);\n const [invalid, setInvalid] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n // What was last handed to `onCommit`, which is not the same as `value`: a\n // blur can fire both Base UI's commit and ours in one turn, before the parent\n // has re-rendered with the new prop, and the second must be a no-op.\n const committedRef = useRef(value);\n const valueRef = useRef(value);\n valueRef.current = value;\n\n useEffect(() => {\n committedRef.current = value;\n setDraft(value);\n setInvalid(false);\n }, [value]);\n\n const commit = (next: number | null) => {\n if (next === null || !Number.isFinite(next)) {\n setInvalid(true);\n return;\n }\n setInvalid(false);\n if (next === committedRef.current) return;\n committedRef.current = next;\n onCommit(next);\n onTrack?.();\n };\n\n /** Enter commits what is on screen, which Base UI has not parsed for us yet. */\n const commitFromText = () => {\n const text = inputRef.current?.value.trim() ?? \"\";\n commit(text === \"\" ? null : Number(text));\n };\n\n return (\n <BaseNumberField.Root\n value={draft}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n onValueChange={(next) => {\n setDraft(next);\n if (next !== null) setInvalid(false);\n }}\n onValueCommitted={(next) => commit(next)}\n >\n <BaseNumberField.Group\n className={cn(fieldBase, className)}\n aria-invalid={invalid || undefined}\n data-preview-state={previewState}\n >\n <BaseNumberField.Input\n ref={inputRef}\n aria-label={label}\n aria-invalid={invalid || undefined}\n className={cn(fieldText, \"tabular-nums\")}\n onKeyDown={(event) => {\n if (event.key !== \"Enter\") return;\n event.preventDefault();\n commitFromText();\n }}\n onBlur={() => {\n // Base UI's own blur handler returns without committing when the\n // text does not parse. That is the only case left for us: a valid\n // blur has already arrived through `onValueCommitted`.\n const text = inputRef.current?.value.trim() ?? \"\";\n if (text === \"\" || !Number.isFinite(Number(text))) setInvalid(true);\n }}\n />\n {unit && (\n <span className=\"shrink-0 select-none text-step-10 text-text-4\" aria-hidden=\"true\">\n {unit}\n </span>\n )}\n </BaseNumberField.Group>\n </BaseNumberField.Root>\n );\n}\n","/**\n * Select: Base UI select in Input's box. The trigger keeps `role=\"combobox\"`, which both hotkey selector\n * lists match. Options are data, not children, so typeahead and the value display can read labels.\n */\n\nimport { Select as BaseSelect } from \"@base-ui/react/select\";\nimport { cn } from \"./cn\";\nimport { fieldBase } from \"./Input\";\nimport { floatingMotion, POPUP_LAYER } from \"./Menu\";\nimport type { PreviewState } from \"./Button\";\n\nexport interface SelectOption {\n label: string;\n value: string;\n /** Offered but not choosable; the label stays visible so the reason stays visible too. */\n disabled?: boolean;\n}\n\nexport interface SelectProps {\n /** Accessible name for the trigger. */\n label: string;\n value: string;\n options: SelectOption[];\n /** Called when a different option is chosen. */\n onCommit: (next: string) => void;\n /** Called once per committed change, for design-input telemetry. */\n onTrack?: () => void;\n disabled?: boolean;\n className?: string;\n \"data-preview-state\"?: PreviewState;\n}\n\nexport function Select({\n label,\n value,\n options,\n onCommit,\n onTrack,\n disabled,\n className,\n \"data-preview-state\": previewState,\n}: SelectProps) {\n return (\n <BaseSelect.Root\n value={value}\n disabled={disabled}\n items={options}\n onValueChange={(next) => {\n const chosen = String(next);\n if (chosen === value) return;\n onCommit(chosen);\n onTrack?.();\n }}\n >\n <BaseSelect.Trigger\n aria-label={label}\n className={cn(\n fieldBase,\n \"w-full cursor-pointer justify-between text-left\",\n \"data-[popup-open]:border-border-strong\",\n className,\n )}\n data-preview-state={previewState}\n >\n <BaseSelect.Value className=\"truncate\" />\n <BaseSelect.Icon className=\"shrink-0 text-text-4\" aria-hidden=\"true\">\n <svg width=\"8\" height=\"5\" viewBox=\"0 0 8 5\" fill=\"none\">\n <path\n d=\"M1 1L4 4L7 1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </BaseSelect.Icon>\n </BaseSelect.Trigger>\n\n <BaseSelect.Portal>\n <BaseSelect.Positioner sideOffset={4} alignItemWithTrigger={false} className={POPUP_LAYER}>\n <BaseSelect.Popup\n className={cn(\n \"min-w-[var(--anchor-width)] rounded-md border border-border bg-surface py-1 shadow-menu\",\n floatingMotion(\"duration-open\"),\n )}\n >\n <BaseSelect.List>\n {options.map((option) => (\n <BaseSelect.Item\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className={cn(\n \"flex h-ctl-sm cursor-pointer select-none items-center gap-2 px-2.5\",\n \"text-step-11 text-text-2 outline-hidden\",\n \"data-[highlighted]:bg-hover data-[highlighted]:text-text-0\",\n \"data-[selected]:text-text-0\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-40\",\n )}\n >\n <BaseSelect.ItemText className=\"truncate\">{option.label}</BaseSelect.ItemText>\n </BaseSelect.Item>\n ))}\n </BaseSelect.List>\n </BaseSelect.Popup>\n </BaseSelect.Positioner>\n </BaseSelect.Portal>\n </BaseSelect.Root>\n );\n}\n","/**\n * Slider: `onPreview` fires while the thumb moves and writes nothing durable; `onCommit` (with `onTrack`, once)\n * fires at a boundary. Right-click or Escape aborts a drag via `eventDetails.cancel()` and restores the start value.\n */\n\nimport { Slider as BaseSlider } from \"@base-ui/react/slider\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { cn } from \"./cn\";\nimport type { PreviewState } from \"./Button\";\n\nexport interface SliderProps {\n /** Accessible name for the thumb. The inspector's row label is the usual one. */\n label: string;\n /** The committed value. */\n value: number;\n min: number;\n max: number;\n step?: number;\n /** Every intermediate value while dragging or stepping. Not a commit. */\n onPreview?: (next: number) => void;\n /** Called at a commit boundary when the value really changed. */\n onCommit: (next: number) => void;\n /** Called once per commit boundary, for design-input telemetry. */\n onTrack?: () => void;\n disabled?: boolean;\n className?: string;\n \"data-preview-state\"?: PreviewState;\n}\n\nconst first = (next: number | number[]): number => (Array.isArray(next) ? next[0] : next);\n\nexport function Slider({\n label,\n value,\n min,\n max,\n step,\n onPreview,\n onCommit,\n onTrack,\n disabled,\n className,\n \"data-preview-state\": previewState,\n}: SliderProps) {\n const [draft, setDraft] = useState(value);\n const draggingRef = useRef(false);\n const abortedRef = useRef(false);\n // The committed value the current gesture started from, so an abort has\n // something to put back.\n const dragStartRef = useRef(value);\n // What was last handed to `onCommit`. A gesture's own commit lands before the\n // parent re-renders, so deduping against the `value` prop would double-fire.\n const committedRef = useRef(value);\n const valueRef = useRef(value);\n valueRef.current = value;\n\n // An external write wins, except mid-drag: the echo is a frame behind, and\n // applying it would snap the thumb backwards under the pointer.\n useEffect(() => {\n if (draggingRef.current) return;\n committedRef.current = value;\n setDraft(value);\n }, [value]);\n\n const commit = (next: number) => {\n if (next === committedRef.current) return;\n committedRef.current = next;\n onCommit(next);\n };\n\n const abort = () => {\n if (!draggingRef.current) return;\n abortedRef.current = true;\n const start = dragStartRef.current;\n setDraft(start);\n onPreview?.(start);\n commit(start);\n };\n\n return (\n <BaseSlider.Root\n value={draft}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n onValueChange={(next, details) => {\n if (abortedRef.current) {\n // The pointer is still down after a right-click abort. Base UI would\n // otherwise keep applying moves to a gesture the user cancelled.\n details.cancel();\n return;\n }\n const n = first(next);\n setDraft(n);\n onPreview?.(n);\n }}\n onValueCommitted={(next) => {\n draggingRef.current = false;\n if (abortedRef.current) {\n abortedRef.current = false;\n return;\n }\n commit(first(next));\n onTrack?.();\n }}\n className={cn(\"flex min-w-0 items-center\", className)}\n data-preview-state={previewState}\n >\n <BaseSlider.Control\n // A stable hook for the drag tests and for the screenshot script. Base\n // UI's own marker on this part only exists before hydration.\n data-slider-control=\"true\"\n // h-6 is the 24x24 WCAG 2.2 (2.5.8) target: the visible track stays\n // 2px, only the pointer box grows.\n className=\"flex h-6 w-full min-w-0 touch-none select-none items-center\"\n onPointerDown={() => {\n draggingRef.current = true;\n abortedRef.current = false;\n dragStartRef.current = valueRef.current;\n }}\n onContextMenu={(event) => {\n if (!draggingRef.current) return;\n event.preventDefault();\n abort();\n }}\n onKeyDown={(event) => {\n if (event.key !== \"Escape\" || !draggingRef.current) return;\n event.preventDefault();\n abort();\n }}\n >\n <BaseSlider.Track className=\"h-0.5 w-full rounded-full bg-hover\">\n <BaseSlider.Indicator className=\"rounded-full bg-text-5\" />\n <BaseSlider.Thumb\n aria-label={label}\n className={cn(\n // The ring separates the thumb from the track behind it. A drop\n // shadow would need a raw colour literal, which R5 does not allow\n // outside the token file, and no shadow token fits a 10px dot.\n \"size-2.5 rounded-full bg-text-0 ring-2 ring-bg-1\",\n \"cursor-grab active:cursor-grabbing data-[preview-state=active]:cursor-grabbing\",\n \"hover:scale-110 data-[preview-state=hover]:scale-110\",\n \"transition-transform ease-standard duration-hover\",\n \"has-[:focus-visible]:outline-solid has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-accent\",\n \"data-[preview-state=focus]:outline-solid data-[preview-state=focus]:outline-2 data-[preview-state=focus]:outline-offset-2 data-[preview-state=focus]:outline-accent\",\n )}\n />\n </BaseSlider.Track>\n </BaseSlider.Control>\n </BaseSlider.Root>\n );\n}\n","/**\n * Toggle: a switch, not a checkbox (immediate effect). `role=\"switch\"` needed an entry in\n * `typingTarget.ts` so Space is not leaked to the global playback shortcut.\n */\n\nimport { Switch } from \"@base-ui/react/switch\";\nimport { cn } from \"./cn\";\nimport type { PreviewState } from \"./Button\";\n\nexport interface ToggleProps {\n /** Accessible name. */\n label: string;\n checked: boolean;\n /** Called on every flip. */\n onCommit: (next: boolean) => void;\n /** Called once per flip, for design-input telemetry. */\n onTrack?: () => void;\n disabled?: boolean;\n className?: string;\n \"data-preview-state\"?: PreviewState;\n}\n\nexport function Toggle({\n label,\n checked,\n onCommit,\n onTrack,\n disabled,\n className,\n \"data-preview-state\": previewState,\n}: ToggleProps) {\n return (\n <Switch.Root\n aria-label={label}\n checked={checked}\n disabled={disabled}\n onCheckedChange={(next) => {\n onCommit(next);\n onTrack?.();\n }}\n data-preview-state={previewState}\n className={cn(\n \"relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full p-0.5\",\n \"border border-border-input bg-input\",\n \"transition-[background-color,border-color] ease-standard duration-press\",\n \"hover:border-border-strong data-[preview-state=hover]:border-border-strong\",\n \"data-[checked]:border-accent data-[checked]:bg-accent\",\n \"outline-hidden focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent\",\n \"data-[preview-state=focus]:outline-solid data-[preview-state=focus]:outline-2 data-[preview-state=focus]:outline-offset-1 data-[preview-state=focus]:outline-accent\",\n \"disabled:cursor-not-allowed disabled:opacity-40\",\n className,\n )}\n >\n <Switch.Thumb\n className={cn(\n \"size-3 rounded-full bg-text-3\",\n \"transition-[transform,background-color] ease-standard duration-press\",\n \"data-[checked]:translate-x-3 data-[checked]:bg-bg-0\",\n )}\n />\n </Switch.Root>\n );\n}\n"],"mappings":";AAMA,SAAS,gBAAgB;AAGzB,IAAM,aAAa,CAAC,UAAkB,aAAa,KAAK,KAAK;AAG7D,IAAM,gBAAgB,CAAC,UAAkB,kBAAkB,KAAK,KAAK;AAE9D,IAAM,KAAiB,SAAS;AAAA,EACrC,QAAQ;AAAA,IACN,aAAa;AAAA,MACX,aAAa,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;AAAA,MACpC,GAAG,CAAC,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC;AAAA,MAC1B,GAAG,CAAC,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC;AAAA,MAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,aAA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ACR;AAAA,UAEA,0BAAAC,MAAC,WAAW,OAAX,EAAiB,WAAU,sCAC1B;AAAA,4BAAAD,MAAC,WAAW,WAAX,EAAqB,WAAU,0BAAyB;AAAA,YACzD,gBAAAA;AAAA,cAAC,WAAW;AAAA,cAAX;AAAA,gBACC,cAAY;AAAA,gBACZ,WAAW;AAAA;AAAA;AAAA;AAAA,kBAIT;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,gBACF;AAAA;AAAA,YACF;AAAA,aACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;;;ACnJA,SAAS,cAAc;AAgDjB,gBAAAK,aAAA;AA/BC,SAAS,OAAO;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AACxB,GAAgB;AACd,SACE,gBAAAA;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACC,cAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,iBAAiB,CAAC,SAAS;AACzB,iBAAS,IAAI;AACb,kBAAU;AAAA,MACZ;AAAA,MACA,sBAAoB;AAAA,MACpB,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA,0BAAAA;AAAA,QAAC,OAAO;AAAA,QAAP;AAAA,UACC,WAAW;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":["forwardRef","jsx","forwardRef","jsx","jsx","jsxs","jsx","jsxs","jsx","jsxs","useId","jsx","jsxs","SIDE_OFFSET","VIEWPORT_MARGIN","useId","jsx","jsxs","SIDE_OFFSET","VIEWPORT_MARGIN","useRef","useState","jsx","useState","useRef","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","jsx","jsxs","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","jsx"]}
|