@kitlangton/knobs 0.4.0-next.2 → 0.4.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/dev/{chunk-ayb292zj.js → chunk-j6zmtens.js} +1 -1
- package/dist/dev/{chunk-1qzffbpa.js → chunk-zwj6yngd.js} +66 -33
- package/dist/dev/index.js +3 -3
- package/dist/panel.js +66 -33
- package/dist/types/ui/compare-css.d.ts +1 -1
- package/dist/types/ui/compare-gpu.d.ts +0 -5
- package/dist/types/ui/compare-model.d.ts +31 -2
- package/dist/types/ui/compare.d.ts +17 -4
- package/dist/types/ui/icons.d.ts +40 -0
- package/dist/types/ui/index.d.ts +4 -2
- package/dist/types/ui/selection-pill-css.d.ts +1 -0
- package/dist/types/ui/selection-pill.d.ts +103 -0
- package/dist/types/ui/timeline-model.d.ts +23 -0
- package/dist/types/ui/timeline.d.ts +11 -1
- package/dist/types/ui/tree.d.ts +3 -2
- package/dist/ui-react.js +696 -270
- package/dist/ui-solid.js +696 -270
- package/dist/ui.js +716 -270
- package/package.json +1 -1
|
@@ -3,7 +3,6 @@ export declare const MODE_INDEX: {
|
|
|
3
3
|
readonly side: 0;
|
|
4
4
|
readonly wipe: 1;
|
|
5
5
|
readonly difference: 2;
|
|
6
|
-
readonly flicker: 3;
|
|
7
6
|
};
|
|
8
7
|
export interface CompareDraw {
|
|
9
8
|
/** Device px: where each side's picture lands (zoomed, it's larger than its clip). */
|
|
@@ -22,10 +21,6 @@ export interface CompareDraw {
|
|
|
22
21
|
readonly to: number;
|
|
23
22
|
/** 0 shows `from`, 1 shows `to`. */
|
|
24
23
|
readonly mix: number;
|
|
25
|
-
/** Before in After's place (X held). */
|
|
26
|
-
readonly flick: boolean;
|
|
27
|
-
/** Flicker mode's phase: Before showing. */
|
|
28
|
-
readonly phase: boolean;
|
|
29
24
|
readonly threshold: number;
|
|
30
25
|
readonly gain: number;
|
|
31
26
|
readonly accent: readonly [number, number, number];
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { TimeView } from "./timeline-model.js";
|
|
2
|
-
|
|
2
|
+
/** Side by side, a wipe, or (opt in) a difference. */
|
|
3
|
+
export type CompareMode = "side" | "wipe" | "difference";
|
|
4
|
+
/**
|
|
5
|
+
* The modes a viewer offers (`["side", "wipe"]` unless given; `difference` only when asked for),
|
|
6
|
+
* in their order, and the mode it starts in (the first offered when the asked one isn't).
|
|
7
|
+
*/
|
|
8
|
+
export declare function compareModes(modes?: readonly CompareMode[], mode?: CompareMode): {
|
|
9
|
+
readonly modes: readonly CompareMode[];
|
|
10
|
+
readonly mode: CompareMode;
|
|
11
|
+
};
|
|
12
|
+
/** The mode a key picks among those offered: a digit by position, or S, W, D. */
|
|
13
|
+
export declare function modeForKey(key: string, modes: readonly CompareMode[]): CompareMode | null;
|
|
14
|
+
/** A mode's letter key (S, W, D). */
|
|
15
|
+
export declare const modeKey: (mode: CompareMode) => string;
|
|
3
16
|
export type MediaKind = "video" | "image";
|
|
4
17
|
/** A source's kind: as given, else by its extension (a video's, or an image). */
|
|
5
18
|
export declare function mediaKind(src: string, kind?: MediaKind): MediaKind;
|
|
@@ -76,7 +89,7 @@ export interface CompareLayout {
|
|
|
76
89
|
readonly after: Rect;
|
|
77
90
|
readonly split: number;
|
|
78
91
|
};
|
|
79
|
-
/** Overlaid (wipe, difference
|
|
92
|
+
/** Overlaid (wipe, difference): both in the same place. */
|
|
80
93
|
readonly overlay: {
|
|
81
94
|
readonly before: Rect;
|
|
82
95
|
readonly after: Rect;
|
|
@@ -134,6 +147,22 @@ export declare function wipeGrab(x: number, rect: Rect, wipe: number, slop?: num
|
|
|
134
147
|
onLine: boolean;
|
|
135
148
|
offset: number;
|
|
136
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* Wiping, Before and After ride either side of the seam at `x`, `gap` from it, each fading out as
|
|
152
|
+
* its side runs out of room (`left`/`right`: the wipe's edges; `wb`/`wa`: the labels' widths).
|
|
153
|
+
*/
|
|
154
|
+
export declare function seamLabels(x: number, left: number, right: number, wb: number, wa: number, gap?: number): {
|
|
155
|
+
before: {
|
|
156
|
+
x: number;
|
|
157
|
+
opacity: number;
|
|
158
|
+
};
|
|
159
|
+
after: {
|
|
160
|
+
x: number;
|
|
161
|
+
opacity: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/** Where the wipe's grip sits for a pointer at `y`: its top, kept `margin` inside the line. */
|
|
165
|
+
export declare function gripTop(y: number, rect: Rect, grip: number, margin?: number): number;
|
|
137
166
|
/** The wipe moved by a key: 1% a press, 10% with Shift. */
|
|
138
167
|
export declare const wipeKey: (wipe: number, dir: -1 | 1, big?: boolean) => number;
|
|
139
168
|
export interface StripColumn {
|
|
@@ -29,8 +29,13 @@ export interface CompareSource {
|
|
|
29
29
|
export interface CompareOptions extends UiLook {
|
|
30
30
|
readonly before: CompareSource;
|
|
31
31
|
readonly after: CompareSource;
|
|
32
|
-
/** `"side"
|
|
32
|
+
/** The first of `modes` (`"side"`, side by side) by default. */
|
|
33
33
|
readonly mode?: CompareMode;
|
|
34
|
+
/**
|
|
35
|
+
* The modes it offers, in the mode bar's order and on `1`–`3`: `["side", "wipe"]` by default.
|
|
36
|
+
* Add `"difference"` to offer a difference. One mode hides the bar.
|
|
37
|
+
*/
|
|
38
|
+
readonly modes?: readonly CompareMode[];
|
|
34
39
|
/** Where the wipe's line sits, 0 (all After) to 1 (all Before); 0.5. */
|
|
35
40
|
readonly wipe?: number;
|
|
36
41
|
/** Frames per second (the bound timeline's, else 30): steps, and where paused videos land. */
|
|
@@ -41,8 +46,8 @@ export interface CompareOptions extends UiLook {
|
|
|
41
46
|
readonly threshold?: number;
|
|
42
47
|
/**
|
|
43
48
|
* The clock: an existing `timeline()` (its time drives both sides; while playing it follows
|
|
44
|
-
* After), or `true` for one of its own under the viewer
|
|
45
|
-
* still work.
|
|
49
|
+
* After), or `true` for a slim one of its own under the viewer (the `"lane"` variant: its
|
|
50
|
+
* markers are chapter ticks). Without one, `seek`, `play` and keys still work.
|
|
46
51
|
*/
|
|
47
52
|
readonly timeline?: Timeline | boolean;
|
|
48
53
|
/** The frame strip over the timeline (off; one timeline is made if there's none). */
|
|
@@ -68,6 +73,8 @@ export interface CompareOptions extends UiLook {
|
|
|
68
73
|
export interface Compare {
|
|
69
74
|
readonly element: HTMLElement;
|
|
70
75
|
readonly mode: CompareMode;
|
|
76
|
+
/** The modes it offers. */
|
|
77
|
+
readonly modes: readonly CompareMode[];
|
|
71
78
|
readonly wipe: number;
|
|
72
79
|
readonly loupe: boolean;
|
|
73
80
|
/** Seconds. */
|
|
@@ -85,7 +92,13 @@ export interface Compare {
|
|
|
85
92
|
readonly loop: CompareLoop | null;
|
|
86
93
|
/** New sources, mode, wipe, loupe, threshold or fps. A new mode glides in. */
|
|
87
94
|
update(next: Partial<Pick<CompareOptions, "before" | "after" | "mode" | "wipe" | "loupe" | "threshold" | "fps">>): void;
|
|
88
|
-
|
|
95
|
+
/**
|
|
96
|
+
* `glide`: a jump the hand didn't make (a chapter's click): the timeline's playhead catches up
|
|
97
|
+
* from where it is while the videos land at once.
|
|
98
|
+
*/
|
|
99
|
+
seek(time: number, options?: {
|
|
100
|
+
readonly glide?: boolean;
|
|
101
|
+
}): void;
|
|
89
102
|
/** Moves by `seconds`, the timeline's playhead gliding there (playing carries on). */
|
|
90
103
|
seekBy(seconds: number): void;
|
|
91
104
|
play(): void;
|
|
@@ -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,17 @@ 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, 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 { compareLayout, frameMidpoint, frameOf, letterbox, mediaKind, meanAbsDiff, requestSeek, seeked, seekTime, stripColumns, stripPeaks, syncAction, wipeAt, wipeGrab, wipeKey, wipeX, zoomAbout, type CompareLayout, type SeekState, type StripColumn, type SyncAction, } from "./compare-model.js";
|
|
21
|
+
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
22
|
export { tree, type Tree, type TreeOptions, type TreeRowContext, type TreeToggle } from "./tree.js";
|
|
21
23
|
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
24
|
export { codeDiff, diffCounts, diffReview, diffStatus, type CodeDiff, type CodeDiffOptions, type CodeDiffUpdate, type DiffLayout, type DiffLines, type DiffReview, type DiffReviewOptions, } from "./diff.js";
|
|
@@ -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,103 @@
|
|
|
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
|
+
}
|
|
27
|
+
export interface SelectionPill {
|
|
28
|
+
/** The fill. */
|
|
29
|
+
readonly element: HTMLElement;
|
|
30
|
+
/**
|
|
31
|
+
* Reads the selection and the rows again (after a click, a key, new content). The pill travels
|
|
32
|
+
* to a new row; `snap` lands it there instead (content swapped wholesale, a row that moved with
|
|
33
|
+
* its list).
|
|
34
|
+
*/
|
|
35
|
+
update(options?: {
|
|
36
|
+
readonly snap?: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
40
|
+
/** The state spring for a trip of `distance` px, 1.4× as long past 400 px. */
|
|
41
|
+
export declare function pillSpring(distance: number, base?: SpringValue): SpringValue;
|
|
42
|
+
/** Where `row` sits in `container`'s coordinates, from their client rects and its scroll. */
|
|
43
|
+
export declare function pillBoxOf(row: {
|
|
44
|
+
left: number;
|
|
45
|
+
top: number;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
}, container: {
|
|
49
|
+
left: number;
|
|
50
|
+
top: number;
|
|
51
|
+
scrollLeft: number;
|
|
52
|
+
scrollTop: number;
|
|
53
|
+
clientLeft: number;
|
|
54
|
+
clientTop: number;
|
|
55
|
+
}): PillBox;
|
|
56
|
+
/**
|
|
57
|
+
* The radius on the way from one row to the next: it follows the height when the rows differ in
|
|
58
|
+
* height (so the pill keeps each row's proportion), else the trip's progress `k`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function pillRadius(from: {
|
|
61
|
+
readonly h: number;
|
|
62
|
+
readonly r: number;
|
|
63
|
+
}, to: {
|
|
64
|
+
readonly h: number;
|
|
65
|
+
readonly r: number;
|
|
66
|
+
}, h: number, k: number): number;
|
|
67
|
+
/** How far along a trip from `from` to `to` the box `at` is (1 when there's no trip). */
|
|
68
|
+
export declare function pillProgress(from: PillBox, to: PillBox, at: PillBox): number;
|
|
69
|
+
export type PillPlan = {
|
|
70
|
+
readonly kind: "hide";
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "stay";
|
|
73
|
+
} | {
|
|
74
|
+
readonly kind: "land";
|
|
75
|
+
readonly box: PillBox;
|
|
76
|
+
} | {
|
|
77
|
+
readonly kind: "travel";
|
|
78
|
+
readonly box: PillBox;
|
|
79
|
+
readonly spring: SpringValue;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* What the pill does next. Nothing selected: it fades out in place. Shown for the first time, after
|
|
83
|
+
* a fade-out, on first paint, with reduced motion or asked to snap: it lands on the row. Otherwise
|
|
84
|
+
* it travels there from wherever it is (mid-trip included), on a spring for the distance.
|
|
85
|
+
*/
|
|
86
|
+
export declare function planPill(state: {
|
|
87
|
+
readonly shown: boolean;
|
|
88
|
+
readonly at: PillBox | null;
|
|
89
|
+
readonly target: PillBox | null;
|
|
90
|
+
}, next: PillBox | null, flags?: {
|
|
91
|
+
readonly first?: boolean;
|
|
92
|
+
readonly reduced?: boolean;
|
|
93
|
+
readonly snap?: boolean;
|
|
94
|
+
}): PillPlan;
|
|
95
|
+
/** Whether two boxes overlap. */
|
|
96
|
+
export declare const boxesMeet: (a: PillBox, b: PillBox) => boolean;
|
|
97
|
+
/** The box around both. */
|
|
98
|
+
export declare const boxUnion: (a: PillBox, b: PillBox) => PillBox;
|
|
99
|
+
/**
|
|
100
|
+
* The selection pill over `container`'s rows. The container is positioned if it isn't; its rows
|
|
101
|
+
* may be anywhere in it (flex children, absolutely placed, scrolled), as the pill measures them.
|
|
102
|
+
*/
|
|
103
|
+
export declare function selectionPill(container: HTMLElement, options: SelectionPillOptions): SelectionPill;
|
|
@@ -81,3 +81,26 @@ 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;
|
|
@@ -45,6 +45,13 @@ 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), nothing to
|
|
52
|
+
* edit, and the wheel left to the page.
|
|
53
|
+
*/
|
|
54
|
+
readonly variant?: "editor" | "lane";
|
|
48
55
|
readonly label?: string;
|
|
49
56
|
/** The time moved: scrubbed, stepped, jumped, played (every frame) or set from code. */
|
|
50
57
|
onSeek?(time: number, source: SeekSource): void;
|
|
@@ -82,7 +89,10 @@ export interface Timeline {
|
|
|
82
89
|
readonly markers: readonly TimelineMarker[];
|
|
83
90
|
readonly ranges: readonly TimelineRange[];
|
|
84
91
|
readonly view: TimeView;
|
|
85
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* `glide`: a jump the hand didn't make (a chapter's click, say): the playhead catches up from
|
|
94
|
+
* where it is on a quick spring; the time, and what it drives, land at once.
|
|
95
|
+
*/
|
|
86
96
|
seek(time: number, options?: {
|
|
87
97
|
readonly glide?: boolean;
|
|
88
98
|
}): 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
|
}
|