@kitlangton/knobs 0.4.0-next.1 → 0.4.0-next.10
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 +164 -12
- package/dist/dev/{chunk-1qzffbpa.js → chunk-5pb7ymrd.js} +150 -46
- package/dist/dev/{chunk-ayb292zj.js → chunk-a7cjgy8x.js} +2 -2
- package/dist/dev/{chunk-8mabjeyk.js → chunk-dyq4m24m.js} +162 -1
- package/dist/dev/index.js +3 -3
- package/dist/panel.js +312 -46
- package/dist/review-react.js +18580 -0
- package/dist/review-solid.js +18482 -0
- package/dist/review.js +18488 -0
- package/dist/themes.js +281 -23
- package/dist/types/review/font.d.ts +13 -0
- package/dist/types/review/foundations.d.ts +175 -0
- package/dist/types/review/index.d.ts +13 -0
- package/dist/types/review/react.d.ts +1 -0
- package/dist/types/review/solid.d.ts +1 -0
- package/dist/types/themes/index.d.ts +7 -2
- package/dist/types/themes/review.d.ts +8 -0
- package/dist/types/tokens/schema.d.ts +180 -0
- package/dist/types/ui/compare-css.d.ts +1 -1
- package/dist/types/ui/compare-gpu.d.ts +6 -6
- package/dist/types/ui/compare-model.d.ts +85 -2
- package/dist/types/ui/compare.d.ts +18 -4
- package/dist/types/ui/diff.d.ts +4 -5
- package/dist/types/ui/history-css.d.ts +1 -0
- package/dist/types/ui/history-model.d.ts +249 -0
- package/dist/types/ui/history.d.ts +38 -0
- package/dist/types/ui/icons.d.ts +40 -0
- package/dist/types/ui/index.d.ts +8 -4
- package/dist/types/ui/player-css.d.ts +1 -0
- package/dist/types/ui/player.d.ts +51 -0
- package/dist/types/ui/review-look.d.ts +6 -0
- package/dist/types/ui/review-options.d.ts +28 -0
- package/dist/types/ui/selection-pill-css.d.ts +1 -0
- package/dist/types/ui/selection-pill.d.ts +106 -0
- package/dist/types/ui/timeline-model.d.ts +27 -0
- package/dist/types/ui/timeline.d.ts +16 -1
- package/dist/types/ui/tree.d.ts +3 -2
- package/dist/types/ui/walkthrough-annotations.d.ts +42 -0
- package/dist/types/ui/walkthrough-blocks.d.ts +87 -0
- package/dist/types/ui/walkthrough-media.d.ts +30 -1
- package/dist/types/ui/walkthrough-model.d.ts +469 -5
- package/dist/types/ui/walkthrough.d.ts +27 -5
- package/dist/ui-react.js +5124 -1031
- package/dist/ui-solid.js +5136 -1043
- package/dist/ui.js +6411 -2269
- package/package.json +13 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
export type HistoryTone = "good" | "warn" | "bad" | "info" | "dim";
|
|
2
|
+
export type HistoryProvenance = "verified" | "inferred";
|
|
3
|
+
/** A small tag that backs a claim: a PR, a commit, a log, as a link or not. */
|
|
4
|
+
export interface HistoryEvidence {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly href?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A stretch of a lane in one state: "v1 works", "v2 broken". */
|
|
9
|
+
export interface HistorySpan {
|
|
10
|
+
readonly id?: string;
|
|
11
|
+
/** ISO date (`2026-09-19`), or as a page writes it (`"Sep 19, 2026"`). */
|
|
12
|
+
readonly from: string;
|
|
13
|
+
/** Left out: still so today. */
|
|
14
|
+
readonly to?: string;
|
|
15
|
+
/** A key in `states`, or a word of its own. */
|
|
16
|
+
readonly state: string;
|
|
17
|
+
/** Its tag at the end, in place of the state's (`"31d broken"`). */
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
/** Its detail's title, in place of "lane · state". */
|
|
20
|
+
readonly title?: string;
|
|
21
|
+
readonly detail?: string;
|
|
22
|
+
readonly provenance?: HistoryProvenance;
|
|
23
|
+
readonly source?: string;
|
|
24
|
+
readonly evidence?: readonly HistoryEvidence[];
|
|
25
|
+
/** A step it's about, for `onJump`. */
|
|
26
|
+
readonly step?: string;
|
|
27
|
+
}
|
|
28
|
+
/** A row of the chart: a channel or a track, with its spans. */
|
|
29
|
+
export interface HistoryLane {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly label: string;
|
|
32
|
+
readonly spans?: readonly HistorySpan[];
|
|
33
|
+
}
|
|
34
|
+
/** A dated moment: a commit, a release, a deletion. */
|
|
35
|
+
export interface HistoryEvent {
|
|
36
|
+
readonly id?: string;
|
|
37
|
+
/** ISO, or as written: "Apr 9, 2026", "Oct 14–16, 2026", "May 7–8". */
|
|
38
|
+
readonly date: string;
|
|
39
|
+
/** Where it ran over days: its last day. */
|
|
40
|
+
readonly to?: string;
|
|
41
|
+
/** The lane it sits on (`"code"` by default). */
|
|
42
|
+
readonly lane?: string;
|
|
43
|
+
readonly title: string;
|
|
44
|
+
readonly detail?: string;
|
|
45
|
+
/** Its mark: a commit a dot, a release a diamond, a deletion a cross, an audit a triangle. */
|
|
46
|
+
readonly type?: "commit" | "release" | "deletion" | "channel" | "audit" | (string & {});
|
|
47
|
+
readonly tone?: HistoryTone;
|
|
48
|
+
readonly provenance?: HistoryProvenance;
|
|
49
|
+
readonly source?: string;
|
|
50
|
+
readonly evidence?: readonly HistoryEvidence[];
|
|
51
|
+
readonly step?: string;
|
|
52
|
+
}
|
|
53
|
+
/** A faint labelled stretch behind every lane: a phase. */
|
|
54
|
+
export interface HistoryBand {
|
|
55
|
+
readonly from: string;
|
|
56
|
+
readonly to?: string;
|
|
57
|
+
readonly label: string;
|
|
58
|
+
}
|
|
59
|
+
/** What a span's state means: its name in the legend, its colour and its tag (`{d}` the days). */
|
|
60
|
+
export interface HistoryState {
|
|
61
|
+
readonly label?: string;
|
|
62
|
+
readonly tone?: HistoryTone;
|
|
63
|
+
/** `"{d}d"` (the default), words of its own (`"v1"`), or `""` for none. */
|
|
64
|
+
readonly tag?: string;
|
|
65
|
+
}
|
|
66
|
+
/** The walkthrough's older shape: events under headings. */
|
|
67
|
+
export interface HistoryGroup {
|
|
68
|
+
readonly heading?: string;
|
|
69
|
+
readonly summary?: string;
|
|
70
|
+
readonly events?: readonly HistoryEvent[];
|
|
71
|
+
readonly rows?: readonly HistoryEvent[];
|
|
72
|
+
}
|
|
73
|
+
/** What `history()` draws: plain JSON. */
|
|
74
|
+
export interface HistoryData {
|
|
75
|
+
readonly axis?: {
|
|
76
|
+
readonly from?: string;
|
|
77
|
+
readonly to?: string;
|
|
78
|
+
readonly today?: string;
|
|
79
|
+
};
|
|
80
|
+
readonly lanes?: readonly HistoryLane[];
|
|
81
|
+
readonly events?: readonly HistoryEvent[];
|
|
82
|
+
readonly bands?: readonly HistoryBand[];
|
|
83
|
+
readonly states?: Readonly<Record<string, HistoryState>>;
|
|
84
|
+
/** The walkthrough's older shape: each group's events go on the code lane under a band. */
|
|
85
|
+
readonly groups?: readonly HistoryGroup[];
|
|
86
|
+
}
|
|
87
|
+
/** Days since 1970-01-01 (UTC): every date in the model. */
|
|
88
|
+
export type Day = number;
|
|
89
|
+
export interface HyItem {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly kind: "event" | "span";
|
|
92
|
+
readonly lane: string;
|
|
93
|
+
readonly from: Day;
|
|
94
|
+
readonly to: Day;
|
|
95
|
+
/** A span still running today. */
|
|
96
|
+
readonly open: boolean;
|
|
97
|
+
readonly title: string;
|
|
98
|
+
readonly detail?: string;
|
|
99
|
+
readonly tone: HistoryTone;
|
|
100
|
+
readonly type?: string;
|
|
101
|
+
readonly inferred: boolean;
|
|
102
|
+
readonly provenance?: HistoryProvenance;
|
|
103
|
+
readonly source?: string;
|
|
104
|
+
readonly evidence: readonly HistoryEvidence[];
|
|
105
|
+
readonly step?: string;
|
|
106
|
+
/** A span's state key. */
|
|
107
|
+
readonly state?: string;
|
|
108
|
+
/** A span's end tags, longest first: its own or the state's, then the days alone. */
|
|
109
|
+
readonly tags: readonly string[];
|
|
110
|
+
}
|
|
111
|
+
export interface HyLane {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly label: string;
|
|
114
|
+
readonly spans: readonly HyItem[];
|
|
115
|
+
readonly events: readonly HyItem[];
|
|
116
|
+
}
|
|
117
|
+
export interface HyBand {
|
|
118
|
+
readonly from: Day;
|
|
119
|
+
readonly to: Day;
|
|
120
|
+
readonly label: string;
|
|
121
|
+
}
|
|
122
|
+
export interface HyState {
|
|
123
|
+
readonly key: string;
|
|
124
|
+
readonly label: string;
|
|
125
|
+
readonly tone: HistoryTone;
|
|
126
|
+
}
|
|
127
|
+
export interface HistoryModel {
|
|
128
|
+
readonly from: Day;
|
|
129
|
+
readonly to: Day;
|
|
130
|
+
readonly today: Day;
|
|
131
|
+
readonly lanes: readonly HyLane[];
|
|
132
|
+
/** Every event, in the order ←/→ walk them. */
|
|
133
|
+
readonly events: readonly HyItem[];
|
|
134
|
+
readonly bands: readonly HyBand[];
|
|
135
|
+
/** The states the spans use, in the order they first appear. */
|
|
136
|
+
readonly states: readonly HyState[];
|
|
137
|
+
/** The event types used, in the order they first appear. */
|
|
138
|
+
readonly types: readonly string[];
|
|
139
|
+
/** Whether anything is marked inferred, and anything verified: the legend needs both. */
|
|
140
|
+
readonly inferred: boolean;
|
|
141
|
+
readonly verified: boolean;
|
|
142
|
+
readonly items: ReadonlyMap<string, HyItem>;
|
|
143
|
+
}
|
|
144
|
+
export declare const dayOf: (y: number, m: number, d: number) => Day;
|
|
145
|
+
export declare const todayDay: (now?: number) => Day;
|
|
146
|
+
/**
|
|
147
|
+
* A date as written, as whole days: ISO (`2026-04-09`, a time after it ignored), or `"Apr 9, 2026"`,
|
|
148
|
+
* `"Oct 14–16, 2026"`, `"Jun 26 – Jul 2, 2026"`; with no year, `year`. Null when it's neither.
|
|
149
|
+
*/
|
|
150
|
+
export declare function parseDay(text: string, year?: number): {
|
|
151
|
+
from: Day;
|
|
152
|
+
to: Day;
|
|
153
|
+
year?: number;
|
|
154
|
+
} | null;
|
|
155
|
+
/** `"Jun 26, 2026"`. */
|
|
156
|
+
export declare function formatDay(day: Day): string;
|
|
157
|
+
/** One day, or a range as short as it reads: `"Oct 14–16, 2026"`, `"Sep 19, 2026 – today"`. */
|
|
158
|
+
export declare function formatRange(from: Day, to: Day, open?: boolean): string;
|
|
159
|
+
/** `"1 day"`, `"31 days"`. */
|
|
160
|
+
export declare const formatDays: (n: number) => string;
|
|
161
|
+
/** A state's colour from its name when `states` doesn't give one. */
|
|
162
|
+
export declare function guessTone(state: string): HistoryTone;
|
|
163
|
+
/** A group heading as a band's label: its number and a trailing "(Apr – May 2026)" go. */
|
|
164
|
+
export declare const bandLabel: (heading: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* The walkthrough's older shape in the new one: every group's events on the code lane, each group
|
|
167
|
+
* with a heading a faint band from its first event to its last. Dates with no year take the year
|
|
168
|
+
* of the event before (or the first one written).
|
|
169
|
+
*/
|
|
170
|
+
export declare function fromGroups(groups: readonly HistoryGroup[], today: Day): {
|
|
171
|
+
events: HistoryEvent[];
|
|
172
|
+
bands: HistoryBand[];
|
|
173
|
+
};
|
|
174
|
+
/** A day as ISO `2026-04-09`. */
|
|
175
|
+
export declare function iso(day: Day): string;
|
|
176
|
+
/** The document filled in: whole days, lanes with their spans and events, the axis and the order. */
|
|
177
|
+
export declare function normalizeHistory(data: HistoryData, now?: Day): HistoryModel;
|
|
178
|
+
/** The marks drawn from the start: the rest wait for the pointer or "Show …". */
|
|
179
|
+
export declare const DEFAULT_MARKS: readonly string[];
|
|
180
|
+
/**
|
|
181
|
+
* The events held back until asked for: those with a type that isn't in `marks`. Untyped events
|
|
182
|
+
* always show, and where holding back would leave no mark at all, none are.
|
|
183
|
+
*/
|
|
184
|
+
export declare function quietEvents(events: readonly HyItem[], marks: readonly string[] | "all"): Set<string>;
|
|
185
|
+
/** What the toggle shows: `"commits"`, `"commits and findings"`. */
|
|
186
|
+
export declare function quietLabel(events: readonly HyItem[], quiet: ReadonlySet<string>): string;
|
|
187
|
+
/** The order ←/→ walk: by date, then lane (top first), then as written. */
|
|
188
|
+
export declare function eventOrder(events: readonly {
|
|
189
|
+
item: HyItem;
|
|
190
|
+
index: number;
|
|
191
|
+
laneIndex: number;
|
|
192
|
+
}[]): HyItem[];
|
|
193
|
+
/**
|
|
194
|
+
* The event ←/→ land on from `current`: the next or the one before, stopping at the ends; from
|
|
195
|
+
* nothing (or a span), → the first and ← the last.
|
|
196
|
+
*/
|
|
197
|
+
export declare function stepEvent(order: readonly HyItem[], current: string | null, dir: 1 | -1,
|
|
198
|
+
/** Where the selection is when it isn't in `order` (a held-back mark): carry on from there. */
|
|
199
|
+
at?: Day): HyItem | null;
|
|
200
|
+
/** Where a day sits across `width` (pixels), and the day at an x. */
|
|
201
|
+
export declare function dayScale(from: Day, to: Day, width: number): {
|
|
202
|
+
x: (day: number) => number;
|
|
203
|
+
day: (x: number) => number;
|
|
204
|
+
/** As a fraction of the width, for `left: n%`. */
|
|
205
|
+
f: (day: number) => number;
|
|
206
|
+
};
|
|
207
|
+
export interface MonthTick {
|
|
208
|
+
readonly day: Day;
|
|
209
|
+
/** `"Apr"`, or the year on January. */
|
|
210
|
+
readonly label: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* A tick on the first of each month inside the axis, thinned to every 2, 3, 6 or 12 months until
|
|
214
|
+
* neighbours sit at least `minGap` pixels apart. January says its year.
|
|
215
|
+
*/
|
|
216
|
+
export declare function monthTicks(from: Day, to: Day, width: number, minGap?: number): MonthTick[];
|
|
217
|
+
/**
|
|
218
|
+
* Which labels to draw, left to right: each starts at its `x` and is `w` wide, and one is left out
|
|
219
|
+
* where it would touch the one before (within `gap`), a reserved box (today's label), or run past
|
|
220
|
+
* `width`.
|
|
221
|
+
*/
|
|
222
|
+
export declare function fitLabels(labels: readonly {
|
|
223
|
+
x: number;
|
|
224
|
+
w: number;
|
|
225
|
+
}[], width: number, reserved?: readonly {
|
|
226
|
+
x0: number;
|
|
227
|
+
x1: number;
|
|
228
|
+
}[], gap?: number): boolean[];
|
|
229
|
+
/** A span clipped to the axis, and which ends were cut; null when it's outside it. */
|
|
230
|
+
export declare function clipSpan(from: Day, to: Day, axisFrom: Day, axisTo: Day): {
|
|
231
|
+
from: Day;
|
|
232
|
+
to: Day;
|
|
233
|
+
clipStart: boolean;
|
|
234
|
+
clipEnd: boolean;
|
|
235
|
+
} | null;
|
|
236
|
+
/**
|
|
237
|
+
* Where a span's tag goes: the longest of `widths` (pixels, longest first) that fits inside the
|
|
238
|
+
* bar with `pad` either side, else one that fits after it in `roomAfter`; else none.
|
|
239
|
+
*/
|
|
240
|
+
export declare function fitTag(widths: readonly number[], spanWidth: number, roomAfter: number, pad?: number): {
|
|
241
|
+
index: number;
|
|
242
|
+
place: "inside" | "after";
|
|
243
|
+
} | null;
|
|
244
|
+
/** Each band's label room: from its start to its end or the next band's start, if sooner. */
|
|
245
|
+
export declare function bandRoom(bands: readonly HyBand[], x: (day: Day) => number): number[];
|
|
246
|
+
/** The event nearest `day` within `tolerance` days, else null. */
|
|
247
|
+
export declare function nearestEvent(events: readonly HyItem[], day: number, tolerance: number): HyItem | null;
|
|
248
|
+
/** The first sentence of a detail: a tooltip's one line. */
|
|
249
|
+
export declare function firstSentence(text: string | undefined): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type HistoryData, type HistoryModel } from "./history-model.js";
|
|
2
|
+
import { type UiLook } from "./look.js";
|
|
3
|
+
export type { HistoryBand, HistoryData, HistoryEvent, HistoryEvidence, HistoryGroup, HistoryLane, HistoryProvenance, HistorySpan, HistoryState, HistoryTone, } from "./history-model.js";
|
|
4
|
+
export interface HistoryOptions extends UiLook {
|
|
5
|
+
/** Lanes of spans and events (or the walkthrough's `groups` of events): plain JSON. */
|
|
6
|
+
readonly data: HistoryData;
|
|
7
|
+
/** The selected event or span's id. */
|
|
8
|
+
readonly selected?: string | null;
|
|
9
|
+
/** Clicks and keys moved the selection (a host's `select()` doesn't call it). */
|
|
10
|
+
readonly onSelect?: (id: string | null) => void;
|
|
11
|
+
/** Draws "Go to step" in the detail of anything with a `step`, and Enter on it. */
|
|
12
|
+
readonly onJump?: (step: string) => void;
|
|
13
|
+
/** Its accessible name. */
|
|
14
|
+
readonly label?: string;
|
|
15
|
+
/** Under this width (px) lane labels sit above their lanes instead of beside them (560). */
|
|
16
|
+
readonly narrow?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The event types marked from the start (releases and deletions, or `"all"`); the rest show
|
|
19
|
+
* while the pointer is on their lane, and all of them behind a "Show commits" toggle.
|
|
20
|
+
*/
|
|
21
|
+
readonly marks?: readonly string[] | "all";
|
|
22
|
+
}
|
|
23
|
+
export interface History {
|
|
24
|
+
readonly element: HTMLElement;
|
|
25
|
+
/** The data filled in: whole days, lanes, the axis and the order ←/→ walk. */
|
|
26
|
+
readonly model: HistoryModel;
|
|
27
|
+
readonly selected: string | null;
|
|
28
|
+
/** Selects an event or span (`null` clears); doesn't call `onSelect`. */
|
|
29
|
+
select(id: string | null): void;
|
|
30
|
+
set(data: HistoryData): void;
|
|
31
|
+
focus(): void;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
/** The same as `dispose`. */
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
36
|
+
/** Adds the history's stylesheet once per document. */
|
|
37
|
+
export declare function injectHistoryStyles(doc: Document): void;
|
|
38
|
+
export declare function history(container: HTMLElement, options: HistoryOptions): History;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const PATHS: {
|
|
2
|
+
readonly arrowLeft: "M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z";
|
|
3
|
+
readonly arrowUpRight: "M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z";
|
|
4
|
+
readonly arrowSquareOut: "M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z";
|
|
5
|
+
readonly arrowCounterClockwise: "M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z";
|
|
6
|
+
readonly arrowUDownLeft: "M232,112a64.07,64.07,0,0,1-64,64H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48a8,8,0,0,1,11.32,11.32L51.31,160H168a48,48,0,0,0,0-96H80a8,8,0,0,1,0-16h88A64.07,64.07,0,0,1,232,112Z";
|
|
7
|
+
readonly arrowsHorizontal: "M136,40V216a8,8,0,0,1-16,0V40a8,8,0,0,1,16,0ZM96,120H35.31l18.35-18.34A8,8,0,0,0,42.34,90.34l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32L35.31,136H96a8,8,0,0,0,0-16Zm149.66,2.34-32-32a8,8,0,0,0-11.32,11.32L220.69,120H160a8,8,0,0,0,0,16h60.69l-18.35,18.34a8,8,0,0,0,11.32,11.32l32-32A8,8,0,0,0,245.66,122.34Z";
|
|
8
|
+
readonly caretDown: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z";
|
|
9
|
+
readonly caretLeft: "M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z";
|
|
10
|
+
readonly caretRight: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z";
|
|
11
|
+
readonly caretUp: "M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z";
|
|
12
|
+
readonly check: "M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z";
|
|
13
|
+
readonly checkCircle: "M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z";
|
|
14
|
+
readonly circle: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z";
|
|
15
|
+
readonly copy: "M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z";
|
|
16
|
+
readonly cornersIn: "M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z";
|
|
17
|
+
readonly cornersOut: "M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z";
|
|
18
|
+
readonly folder: "M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z";
|
|
19
|
+
readonly keyboard: "M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z";
|
|
20
|
+
readonly magnifyingGlass: "M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z";
|
|
21
|
+
readonly magnifyingGlassMinus: "M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z";
|
|
22
|
+
readonly magnifyingGlassPlus: "M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z";
|
|
23
|
+
readonly microphone: "M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z";
|
|
24
|
+
readonly paperPlaneRight: "M231.87,114l-168-95.89A16,16,0,0,0,40.92,37.34L71.55,128,40.92,218.67A16,16,0,0,0,56,240a16.15,16.15,0,0,0,7.93-2.1l167.92-96.05a16,16,0,0,0,.05-27.89ZM56,224a.56.56,0,0,0,0-.12L85.74,136H144a8,8,0,0,0,0-16H85.74L56.06,32.16A.46.46,0,0,0,56,32l168,95.83Z";
|
|
25
|
+
readonly pencilSimple: "M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z";
|
|
26
|
+
readonly repeat: "M24,128A72.08,72.08,0,0,1,96,56H204.69L194.34,45.66a8,8,0,0,1,11.32-11.32l24,24a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L204.69,72H96a56.06,56.06,0,0,0-56,56,8,8,0,0,1-16,0Zm200-8a8,8,0,0,0-8,8,56.06,56.06,0,0,1-56,56H51.31l10.35-10.34a8,8,0,0,0-11.32-11.32l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L51.31,200H160a72.08,72.08,0,0,0,72-72A8,8,0,0,0,224,120Z";
|
|
27
|
+
readonly sidebar: "M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z";
|
|
28
|
+
readonly x: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z";
|
|
29
|
+
};
|
|
30
|
+
export type IconName = keyof typeof PATHS;
|
|
31
|
+
/** Every glyph's name. */
|
|
32
|
+
export declare const ICON_NAMES: readonly IconName[];
|
|
33
|
+
/**
|
|
34
|
+
* A Phosphor regular glyph as SVG markup, in `currentColor`: 16 px for controls, 12 px (`small`)
|
|
35
|
+
* inline. Decorative (`aria-hidden`); label the control it sits in.
|
|
36
|
+
*/
|
|
37
|
+
export declare function icon(name: IconName, options?: {
|
|
38
|
+
readonly small?: boolean;
|
|
39
|
+
}): string;
|
|
40
|
+
export {};
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -8,15 +8,19 @@ export { commandPalette, type Command, type CommandPalette, type CommandPaletteO
|
|
|
8
8
|
export { contextMenu, menu, type ContextMenu, type ContextMenuOptions, type Menu, type MenuCloseReason, type MenuEntry, type MenuItem, type MenuOptions, } from "./menu.js";
|
|
9
9
|
export { popover, type Popover, type PopoverCloseReason, type PopoverOptions } from "./popover.js";
|
|
10
10
|
export { readout, type Readout } from "./readouts.js";
|
|
11
|
+
export { icon, ICON_NAMES, type IconName } from "./icons.js";
|
|
12
|
+
export { planPill, pillBoxOf, pillProgress, pillRadius, pillSpring, selectionPill, type PillBox, type PillPlan, type SelectionPill, type SelectionPillOptions, } from "./selection-pill.js";
|
|
11
13
|
export { toast, type Toast, type ToastOptions } from "./toast.js";
|
|
12
14
|
export { tooltip, tooltips, type TooltipContent, type TooltipOptions } from "./tooltip.js";
|
|
13
15
|
export { split, type PaneAction, type PaneOptions, type Split, type SplitFold, type SplitOptions, type SplitPane, } from "./split.js";
|
|
14
16
|
export { COLLAPSE_PAST, drag as dragDivider, parseLayout, softClamp, solve as solveSplit, type PaneSpec, type SplitDirection, type SplitLayout, } from "./split-model.js";
|
|
15
17
|
export { timeline, type SeekSource, type Timeline, type TimelineMarker, type TimelineListener, type TimelineOptions, type TimelineRange, } from "./timeline.js";
|
|
16
|
-
export { adjacentMarker, advance, clampView, followView, frameTime, magnet, rulerTicks, scrubTime, timeLabel, toFrame, zoomView, type Tick, type Ticks, type TimeUnits, type TimeView, } from "./timeline-model.js";
|
|
18
|
+
export { adjacentMarker, advance, CATCH_UP, clampView, currentMarker, followView, frameTime, magnet, moveHead, rulerTicks, scrubTime, minutes, timeLabel, toFrame, zoomView, type HeadPosition, type Tick, type Ticks, type TimeUnits, type TimeView, } from "./timeline-model.js";
|
|
17
19
|
export { compare, COMPARE_FFMPEG, type Compare, type CompareLoop, type CompareMode, type CompareOptions, type CompareSource, type CompareView, type MediaKind, type ZoomRegion, } from "./compare.js";
|
|
18
20
|
export { compareStrip, type CompareStrip, type CompareStripOptions } from "./compare-strip.js";
|
|
19
|
-
export {
|
|
21
|
+
export { player, type Player, type PlayerChapter, type PlayerOptions } from "./player.js";
|
|
22
|
+
export { history, type History, type HistoryBand, type HistoryData, type HistoryEvent, type HistoryEvidence, type HistoryGroup, type HistoryLane, type HistoryOptions, type HistoryProvenance, type HistorySpan, type HistoryState, type HistoryTone, } from "./history.js";
|
|
23
|
+
export { compareLayout, compareModes, frameMidpoint, frameOf, gripTop, letterbox, mediaKind, meanAbsDiff, modeForKey, requestSeek, seamLabels, seeked, seekTime, stripColumns, stripPeaks, syncAction, wipeAt, wipeGrab, wipeKey, wipeX, zoomAbout, type CompareLayout, type SeekState, type StripColumn, type SyncAction, } from "./compare-model.js";
|
|
20
24
|
export { tree, type Tree, type TreeOptions, type TreeRowContext, type TreeToggle } from "./tree.js";
|
|
21
25
|
export { applyMove, plainAccess, dropTarget, flatten, indexTree, matchLabel, navigate, select, stepMove, topmost, typeahead, validMove, virtualWindow, type DropTarget, type FlatRow, type Selection, type TreeAccess, type TreeFilter, type TreeMove, } from "./tree-model.js";
|
|
22
26
|
export { codeDiff, diffCounts, diffReview, diffStatus, type CodeDiff, type CodeDiffOptions, type CodeDiffUpdate, type DiffLayout, type DiffLines, type DiffReview, type DiffReviewOptions, } from "./diff.js";
|
|
@@ -28,5 +32,5 @@ export { diffActivity, flattenActivity, formatDuration, indexActivity, keepSelec
|
|
|
28
32
|
export { optionPicker, type OptionPicker, type OptionPickerOptions, type PickerOption, } from "./picker.js";
|
|
29
33
|
export { claimsDigit, digitPick, keepPick, stepPick } from "./picker-model.js";
|
|
30
34
|
export { tasteTest, walkthrough, type TasteTest, type TasteTestOptions, type Walkthrough, type WalkthroughOptions, } from "./walkthrough.js";
|
|
31
|
-
export { mediaSlot, type MediaSlot, type MediaSlotOptions } from "./walkthrough-media.js";
|
|
32
|
-
export { collectFeedback, feedbackMarkdown, inlineMarkdown, normalizeWalkthrough, readState as readWalkthroughState, walkthroughProgress, type ContextEvent, type FeedbackItem, type FeedbackNote, type FeedItem, type MediaContext, type NoteContext, type WalkInk, type WalkNote, type WalkVoice, type WalkthroughQA, type WalkthroughUpdate, type WalkPage, type WalkStep, type WalkthroughDoc, type WalkthroughFeedback, type WalkthroughMedia, type WalkthroughMeta, type WalkthroughOption, type WalkthroughSection, type WalkthroughSource, type WalkthroughState, type WalkthroughStatus, type WalkthroughStep, } from "./walkthrough-model.js";
|
|
35
|
+
export { decision, facts, mediaSlot, type DecisionOptions, type FactsOptions, type MediaSlot, type MediaSlotOptions, type StepLinks, } from "./walkthrough-media.js";
|
|
36
|
+
export { collectFeedback, feedbackMarkdown, inlineMarkdown, plainMarkdown, normalizeWalkthrough, readState as readWalkthroughState, stackLayout, walkthroughProgress, type ContextEvent, type FeedbackItem, type FeedbackNote, type FeedItem, type MediaContext, type NoteContext, type StackLayout, type StackRow, type WalkInk, type WalkNote, type WalkVoice, type WalkthroughQA, type WalkthroughUpdate, type WalkPage, type WalkStep, type WalkthroughChapter, type WalkthroughDecisionOption, type WalkthroughFact, type WalkthroughFactGroup, type WalkthroughFacts, type WalkthroughDoc, type WalkthroughEvidence, type WalkthroughFeedback, type WalkthroughHistoryEvent, type WalkthroughHistoryGroup, type WalkthroughMedia, type WalkthroughMeta, type WalkthroughOption, type WalkthroughSection, type WalkthroughSource, type WalkthroughStackItem, type WalkthroughState, type WalkthroughStatus, type WalkthroughStep, type WalkthroughTableCell, type WalkthroughTableColumn, type WalkthroughTableRow, type WalkthroughTone, type WalkthroughPR, type WalkthroughAnnotation, } from "./walkthrough-model.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const playerCss = "\n:where(.knobs-player,.knobs-player *){box-sizing:border-box}\n.knobs-ui.knobs-player{--_kp-stage:var(--_k-compare-stage);display:flex;flex-direction:column;gap:6px;width:100%;outline:none;\n font:var(--_k-weight) var(--_k-type-small)/var(--_k-leading-small) var(--_k-font);color:var(--_k-fg);letter-spacing:normal;text-align:left}\n:where(.knobs-surface,.knobs-pane:not([data-nested])>.knobs-pane-clip) .knobs-ui.knobs-player,.knobs-ui.knobs-player[data-nested]{--_kp-stage:var(--k-compare-stage,transparent)}\n.knobs-player-frame{position:relative;width:100%;aspect-ratio:var(--kp-aspect,16/9);overflow:hidden;border-radius:var(--_k-radius-panel);background:var(--_kp-stage)}\n.knobs-player[data-frame=\"flat\"] .knobs-player-frame{border-radius:0}\n.knobs-player-media{position:absolute;inset:0;display:block;width:100%;height:100%;margin:0;padding:0;border:0;object-fit:contain;\n opacity:0;filter:blur(4px);transition:opacity calc(var(--_k-motion-default-ms) * 1ms) var(--_k-motion-default),filter calc(var(--_k-motion-default-ms) * 1ms) var(--_k-motion-default)}\n.knobs-player[data-ready] .knobs-player-media{opacity:1;filter:none}\n.knobs-player-line{flex:none;min-height:0}\n/* The timeline's own stylesheet is look.ts's; what the player's row and every timeline share\n about the hand is set here, after it. No hand cursor anywhere (the arrow, or a resize where it\n resizes); hover is a quiet fill (fill-hover), in at once (hover-in, 0 ms), out easing. */\n.knobs-ui .knobs-tl-play,.knobs-ui.knobs-timeline :is(.knobs-tl-pin,.knobs-tl-rlabel),\n.knobs-ui.knobs-timeline[data-dragging] .knobs-tl-marker :is(.knobs-tl-pin,.knobs-tl-mlabel){cursor:default}\n.knobs-ui .knobs-tl-play:hover,.knobs-tl-edge:hover::after,.knobs-tl-rlabel:hover,.knobs-tl-track:hover .knobs-tl-hover,\n.knobs-timeline[data-variant=\"line\"] .knobs-tl-track:hover .knobs-tl-segs{transition-duration:calc(var(--_k-hover-in) * 1ms)}\n/* The line's row: a minimal play/pause (the filled pair, a 28px target, no fill at rest), then\n the line, centred on it. */\n.knobs-ui.knobs-timeline[data-variant=\"line\"]{gap:4px;align-items:center}\n.knobs-timeline[data-variant=\"line\"] .knobs-tl-transport{display:flex}\n.knobs-ui.knobs-timeline[data-variant=\"line\"] .knobs-tl-play{width:28px;height:28px;min-width:28px;min-height:28px;border-radius:var(--_k-radius);background:transparent;color:var(--_k-fg-2);\n transition:background calc(var(--_k-hover-out) * 1ms),transform .15s var(--_ku-ease)}\n.knobs-ui.knobs-timeline[data-variant=\"line\"][data-playing] .knobs-tl-play{background:transparent;color:var(--_k-fg-2)}\n.knobs-ui.knobs-timeline[data-variant=\"line\"] .knobs-tl-play:hover{background:var(--_k-fill-hover);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-ui.knobs-timeline[data-variant=\"line\"] .knobs-tl-track{cursor:default;transition:background calc(var(--_k-hover-out) * 1ms)}\n.knobs-ui.knobs-timeline[data-variant=\"line\"] .knobs-tl-track:hover{background:var(--_k-fill-hover);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type UiLook } from "./look.js";
|
|
2
|
+
import { type Timeline } from "./timeline.js";
|
|
3
|
+
/** A chapter: where it starts (seconds) and its name. */
|
|
4
|
+
export interface PlayerChapter {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly start: number;
|
|
7
|
+
readonly id?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PlayerOptions extends UiLook {
|
|
10
|
+
readonly src: string;
|
|
11
|
+
readonly poster?: string;
|
|
12
|
+
/** A WebVTT file, shown by default. */
|
|
13
|
+
readonly captions?: string;
|
|
14
|
+
/** One segment of the line each, named under the pointer. */
|
|
15
|
+
readonly chapters?: readonly PlayerChapter[];
|
|
16
|
+
/** Starts over at the end (true). */
|
|
17
|
+
readonly loop?: boolean;
|
|
18
|
+
/** True by default. */
|
|
19
|
+
readonly muted?: boolean;
|
|
20
|
+
/** Width over height before the video loads (16/9). */
|
|
21
|
+
readonly aspect?: number;
|
|
22
|
+
/** Frames per second, for stepping with `,` and `.` (30). */
|
|
23
|
+
readonly fps?: number;
|
|
24
|
+
readonly label?: string;
|
|
25
|
+
/** The line's play key and playhead take codes in the page's hint mode (on by default). */
|
|
26
|
+
readonly hints?: boolean;
|
|
27
|
+
/** Played or paused, at `time` (seconds). */
|
|
28
|
+
onPlay?(playing: boolean, time: number): void;
|
|
29
|
+
/** Sought by the hand (the line, a key, a chapter) or code, at rest. */
|
|
30
|
+
onSeek?(time: number): void;
|
|
31
|
+
}
|
|
32
|
+
export interface Player {
|
|
33
|
+
readonly element: HTMLElement;
|
|
34
|
+
readonly video: HTMLVideoElement;
|
|
35
|
+
readonly timeline: Timeline;
|
|
36
|
+
/** Seconds. */
|
|
37
|
+
readonly time: number;
|
|
38
|
+
readonly playing: boolean;
|
|
39
|
+
readonly duration: number;
|
|
40
|
+
play(): void;
|
|
41
|
+
pause(): void;
|
|
42
|
+
toggle(): void;
|
|
43
|
+
/** `glide`: a jump the hand didn't make; the line catches up while the video lands at once. */
|
|
44
|
+
seek(time: number, options?: {
|
|
45
|
+
readonly glide?: boolean;
|
|
46
|
+
}): void;
|
|
47
|
+
seekBy(seconds: number): void;
|
|
48
|
+
focus(): void;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
}
|
|
51
|
+
export declare function player(container: HTMLElement, options: PlayerOptions): Player;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UiLook } from "./look.js";
|
|
2
|
+
/**
|
|
3
|
+
* A review piece's look: the theme it's given, else the theme of the knobs element it sits in,
|
|
4
|
+
* else the review theme (quiet, true black, visible hairlines) rather than the panel's glass.
|
|
5
|
+
*/
|
|
6
|
+
export declare function reviewLook<T extends UiLook>(options: T, container?: Element): T;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type WalkFact, type WalkFactGroup } from "./walkthrough-model.js";
|
|
2
|
+
/** Facts as a `<dl>` per group under its heading: terms in a gutter, values beside them. */
|
|
3
|
+
export declare function renderFacts(doc: Document, groups: readonly WalkFactGroup[]): HTMLElement;
|
|
4
|
+
export interface OptionView {
|
|
5
|
+
/** "Option 1". */
|
|
6
|
+
readonly number: string;
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly summary?: string;
|
|
9
|
+
readonly recommended: boolean;
|
|
10
|
+
readonly facts?: readonly WalkFact[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One option's column: its head (a `div`, or the `button` given for picking), its sentence, then
|
|
14
|
+
* `media(tile)` and its facts.
|
|
15
|
+
*/
|
|
16
|
+
export declare function optionTile(doc: Document, o: OptionView, options?: {
|
|
17
|
+
readonly head?: HTMLElement;
|
|
18
|
+
readonly media?: (tile: HTMLElement) => void;
|
|
19
|
+
}): {
|
|
20
|
+
readonly tile: HTMLElement;
|
|
21
|
+
readonly head: HTMLElement;
|
|
22
|
+
readonly kicker: HTMLElement;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Lays `tiles` out in `root` as columns that fill whole rows, marking each with its column and
|
|
26
|
+
* row for the hairlines, again whenever `root`'s width changes. Returns the cleanup.
|
|
27
|
+
*/
|
|
28
|
+
export declare function layoutOptions(root: HTMLElement, tiles: readonly HTMLElement[]): () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const selectionPillCss = "\n.knobs-pick-pill,.knobs-pick-copy{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;transition:opacity .1s linear}\n.knobs-pick-pill{background:var(--_k-fill-selected);will-change:transform}\n.knobs-pick-copy{overflow:hidden;will-change:transform}\n.knobs-pick-copy-rows{position:absolute;left:0;top:0;width:0;height:0}\n:is(.knobs-pick-pill,.knobs-pick-copy)[data-off]{opacity:0}\n";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type SpringValue } from "../core/spring.js";
|
|
2
|
+
/** A box in the container's coordinates (its padding box, scrolled content included). */
|
|
3
|
+
export interface PillBox {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly w: number;
|
|
7
|
+
readonly h: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SelectionPillOptions {
|
|
10
|
+
/** The selected row, or null for none. Read on `update()`. */
|
|
11
|
+
selected(): HTMLElement | null;
|
|
12
|
+
/**
|
|
13
|
+
* The rows the pill moves between, for the bright copy. The container's own children by
|
|
14
|
+
* default (the pill's parts left out).
|
|
15
|
+
*/
|
|
16
|
+
rows?(): Iterable<HTMLElement>;
|
|
17
|
+
/** A row's corner radius (px); its computed `border-top-left-radius` by default. */
|
|
18
|
+
radius?(row: HTMLElement): number;
|
|
19
|
+
/** The bright copy of the rows clipped to the pill (true). */
|
|
20
|
+
copy?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The copy's text colour (`var(--_k-fg)`), set on each copied row; a row's parts with colours
|
|
23
|
+
* of their own keep them unless you restyle them under `.knobs-pick-copy`.
|
|
24
|
+
*/
|
|
25
|
+
color?: string;
|
|
26
|
+
/** The spring it travels on (`SPRINGS.default`, the state spring); 1.4× as long past 400 px. */
|
|
27
|
+
spring?: SpringValue;
|
|
28
|
+
}
|
|
29
|
+
export interface SelectionPill {
|
|
30
|
+
/** The fill. */
|
|
31
|
+
readonly element: HTMLElement;
|
|
32
|
+
/**
|
|
33
|
+
* Reads the selection and the rows again (after a click, a key, new content). The pill travels
|
|
34
|
+
* to a new row; `snap` lands it there instead (content swapped wholesale, a row that moved with
|
|
35
|
+
* its list).
|
|
36
|
+
*/
|
|
37
|
+
update(options?: {
|
|
38
|
+
readonly snap?: boolean;
|
|
39
|
+
}): void;
|
|
40
|
+
dispose(): void;
|
|
41
|
+
}
|
|
42
|
+
/** The state spring for a trip of `distance` px, 1.4× as long past 400 px. */
|
|
43
|
+
export declare function pillSpring(distance: number, base?: SpringValue): SpringValue;
|
|
44
|
+
/** Where `row` sits in `container`'s coordinates, from their client rects and its scroll. */
|
|
45
|
+
export declare function pillBoxOf(row: {
|
|
46
|
+
left: number;
|
|
47
|
+
top: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}, container: {
|
|
51
|
+
left: number;
|
|
52
|
+
top: number;
|
|
53
|
+
scrollLeft: number;
|
|
54
|
+
scrollTop: number;
|
|
55
|
+
clientLeft: number;
|
|
56
|
+
clientTop: number;
|
|
57
|
+
}): PillBox;
|
|
58
|
+
/**
|
|
59
|
+
* The radius on the way from one row to the next: it follows the height when the rows differ in
|
|
60
|
+
* height (so the pill keeps each row's proportion), else the trip's progress `k`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function pillRadius(from: {
|
|
63
|
+
readonly h: number;
|
|
64
|
+
readonly r: number;
|
|
65
|
+
}, to: {
|
|
66
|
+
readonly h: number;
|
|
67
|
+
readonly r: number;
|
|
68
|
+
}, h: number, k: number): number;
|
|
69
|
+
/** How far along a trip from `from` to `to` the box `at` is (1 when there's no trip). */
|
|
70
|
+
export declare function pillProgress(from: PillBox, to: PillBox, at: PillBox): number;
|
|
71
|
+
export type PillPlan = {
|
|
72
|
+
readonly kind: "hide";
|
|
73
|
+
} | {
|
|
74
|
+
readonly kind: "stay";
|
|
75
|
+
} | {
|
|
76
|
+
readonly kind: "land";
|
|
77
|
+
readonly box: PillBox;
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: "travel";
|
|
80
|
+
readonly box: PillBox;
|
|
81
|
+
readonly spring: SpringValue;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* What the pill does next. Nothing selected: it fades out in place. Shown for the first time, after
|
|
85
|
+
* a fade-out, on first paint, with reduced motion or asked to snap: it lands on the row. Otherwise
|
|
86
|
+
* it travels there from wherever it is (mid-trip included), on a spring for the distance.
|
|
87
|
+
*/
|
|
88
|
+
export declare function planPill(state: {
|
|
89
|
+
readonly shown: boolean;
|
|
90
|
+
readonly at: PillBox | null;
|
|
91
|
+
readonly target: PillBox | null;
|
|
92
|
+
}, next: PillBox | null, flags?: {
|
|
93
|
+
readonly first?: boolean;
|
|
94
|
+
readonly reduced?: boolean;
|
|
95
|
+
readonly snap?: boolean;
|
|
96
|
+
readonly spring?: SpringValue;
|
|
97
|
+
}): PillPlan;
|
|
98
|
+
/** Whether two boxes overlap. */
|
|
99
|
+
export declare const boxesMeet: (a: PillBox, b: PillBox) => boolean;
|
|
100
|
+
/** The box around both. */
|
|
101
|
+
export declare const boxUnion: (a: PillBox, b: PillBox) => PillBox;
|
|
102
|
+
/**
|
|
103
|
+
* The selection pill over `container`'s rows. The container is positioned if it isn't; its rows
|
|
104
|
+
* may be anywhere in it (flex children, absolutely placed, scrolled), as the pill measures them.
|
|
105
|
+
*/
|
|
106
|
+
export declare function selectionPill(container: HTMLElement, options: SelectionPillOptions): SelectionPill;
|
|
@@ -81,3 +81,30 @@ export declare function advance(t: number, dt: number, o: {
|
|
|
81
81
|
ended: boolean;
|
|
82
82
|
wrapped: boolean;
|
|
83
83
|
};
|
|
84
|
+
/** A jump the hand didn't make catches up on this: quick, no bounce. */
|
|
85
|
+
export declare const CATCH_UP: {
|
|
86
|
+
readonly duration: 0.15;
|
|
87
|
+
readonly bounce: 0;
|
|
88
|
+
};
|
|
89
|
+
/** Where the playhead is drawn (`x`) and where it's going (`target`), in seconds. */
|
|
90
|
+
export interface HeadPosition {
|
|
91
|
+
readonly x: number;
|
|
92
|
+
readonly target: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The playhead's next move. A `jump` (a chapter or marker click, a loop's wrap, a press on the
|
|
96
|
+
* lane away from it, play from elsewhere, a glide from code) catches up from where it's drawn when
|
|
97
|
+
* it's more than `minGap` seconds away. A `follow` (a drag, the clock, a step) lands 1:1; during a
|
|
98
|
+
* catch-up it shifts both ends, so it follows the hand and the remaining offset settles on its own.
|
|
99
|
+
*/
|
|
100
|
+
export declare function moveHead(head: HeadPosition, t: number, motion: "jump" | "follow", catching: boolean, minGap?: number): HeadPosition & {
|
|
101
|
+
readonly catching: boolean;
|
|
102
|
+
};
|
|
103
|
+
/** The last marker at or before `t` (half a frame's leeway): the current chapter. */
|
|
104
|
+
export declare function currentMarker<M extends {
|
|
105
|
+
readonly time: number;
|
|
106
|
+
}>(markers: readonly M[], t: number, fps: number): M | null;
|
|
107
|
+
/** A time as a player shows it: `m:ss` (`1:05`), `h:mm:ss` past an hour. */
|
|
108
|
+
export declare function minutes(t: number): string;
|
|
109
|
+
/** A line's segment bounds: 0, each chapter start inside the length (once each), the end. */
|
|
110
|
+
export declare function chapterBounds(times: readonly number[], duration: number): number[];
|
|
@@ -45,6 +45,18 @@ export interface TimelineOptions extends UiLook {
|
|
|
45
45
|
readonly step: number;
|
|
46
46
|
readonly shift: number;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* `"editor"` (the default): a ruler with labels over a lane of markers to add, drag and name,
|
|
50
|
+
* zoomed and panned by the wheel. `"lane"`: one slim lane under a compare or a video, with ticks
|
|
51
|
+
* and no labels, markers as faint chapter ticks (the current one in text colour) and nothing to
|
|
52
|
+
* edit. A pinch, ⌘/ctrl-wheel or = and - zoom it around the pointer, a sideways scroll pans it,
|
|
53
|
+
* both following the hand 1:1; a double-click or 0 fits it again. An up-and-down wheel is left
|
|
54
|
+
* to the page. `"line"`: a player's row under a video or a compare: a minimal play/pause button,
|
|
55
|
+
* then a single thin progress line, one segment per chapter with a small gap between,
|
|
56
|
+
* each filling as the time passes it, thicker under the pointer; click or drag anywhere on it
|
|
57
|
+
* to seek, 1:1, and the chapter and time under the pointer show over it. Zooms as a lane does.
|
|
58
|
+
*/
|
|
59
|
+
readonly variant?: "editor" | "lane" | "line";
|
|
48
60
|
readonly label?: string;
|
|
49
61
|
/** The time moved: scrubbed, stepped, jumped, played (every frame) or set from code. */
|
|
50
62
|
onSeek?(time: number, source: SeekSource): void;
|
|
@@ -82,7 +94,10 @@ export interface Timeline {
|
|
|
82
94
|
readonly markers: readonly TimelineMarker[];
|
|
83
95
|
readonly ranges: readonly TimelineRange[];
|
|
84
96
|
readonly view: TimeView;
|
|
85
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* `glide`: a jump the hand didn't make (a chapter's click, say): the playhead catches up from
|
|
99
|
+
* where it is on a quick spring; the time, and what it drives, land at once.
|
|
100
|
+
*/
|
|
86
101
|
seek(time: number, options?: {
|
|
87
102
|
readonly glide?: boolean;
|
|
88
103
|
}): void;
|
package/dist/types/ui/tree.d.ts
CHANGED
|
@@ -64,8 +64,9 @@ export interface TreeOptions<T> extends UiLook {
|
|
|
64
64
|
*/
|
|
65
65
|
readonly hints?: boolean;
|
|
66
66
|
/**
|
|
67
|
-
* The selected row (one) shows as
|
|
68
|
-
*
|
|
67
|
+
* The selected row (one) shows as the selection pill (`selectionPill`): one highlight that slides
|
|
68
|
+
* to the next row selected on the state spring, the row's text sharp and bright under it, instead
|
|
69
|
+
* of each row lighting in place. Several selected rows light in place.
|
|
69
70
|
*/
|
|
70
71
|
readonly glide?: boolean;
|
|
71
72
|
}
|