@kitlangton/knobs 0.2.0 → 0.4.0-next.0
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 +197 -19
- package/dist/dev/{chunk-gezhc24g.js → chunk-7xgkerd2.js} +14 -5
- package/dist/dev/{chunk-693jd1gj.js → chunk-pmkvb9ep.js} +1544 -160
- package/dist/dev/{chunk-5cr85vv6.js → chunk-stbcgz1y.js} +7924 -7931
- package/dist/dev/{chunk-4km87zfx.js → chunk-t68smqkc.js} +18 -7
- package/dist/dev/index.js +187 -31
- package/dist/index.js +197 -33
- package/dist/panel.js +20342 -18461
- package/dist/types/core/keys.d.ts +2 -0
- package/dist/types/core/remote.d.ts +2 -0
- package/dist/types/core/schema.d.ts +5 -0
- package/dist/types/core/store.d.ts +29 -2
- package/dist/types/core/unlock.d.ts +77 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/panel/attach.d.ts +2 -0
- package/dist/types/panel/crumbs.d.ts +19 -0
- package/dist/types/panel/editors.d.ts +9 -0
- package/dist/types/panel/feel.d.ts +103 -0
- package/dist/types/panel/give.d.ts +34 -1
- package/dist/types/panel/gpu/color.d.ts +4 -4
- package/dist/types/panel/gpu/renderer.d.ts +32 -0
- package/dist/types/panel/gpu/shader.wgsl.d.ts +1 -1
- package/dist/types/panel/index.d.ts +2 -1
- package/dist/types/panel/inspector.d.ts +1 -1
- package/dist/types/panel/lens.d.ts +113 -0
- package/dist/types/panel/motion.d.ts +2 -0
- package/dist/types/panel/page-hints.d.ts +2 -1
- package/dist/types/panel/prefs.d.ts +2 -2
- package/dist/types/panel/presence.d.ts +20 -0
- package/dist/types/panel/scope.d.ts +29 -0
- package/dist/types/panel/slider.d.ts +21 -4
- package/dist/types/panel/tab-transition.d.ts +15 -0
- package/dist/types/panel/tabs.d.ts +1 -1
- package/dist/types/panel/toggle.d.ts +27 -0
- package/dist/types/ui/compare-css.d.ts +1 -0
- package/dist/types/ui/compare-frames.d.ts +41 -0
- package/dist/types/ui/compare-gpu.d.ts +58 -0
- package/dist/types/ui/compare-model.d.ts +169 -0
- package/dist/types/ui/compare-mp4.d.ts +29 -0
- package/dist/types/ui/compare-strip.d.ts +28 -0
- package/dist/types/ui/compare.d.ts +103 -0
- package/dist/types/ui/diff-css.d.ts +1 -0
- package/dist/types/ui/diff-model.d.ts +128 -0
- package/dist/types/ui/diff-scroll.d.ts +29 -0
- package/dist/types/ui/diff.d.ts +158 -0
- package/dist/types/ui/index.d.ts +9 -1
- package/dist/types/ui/look.d.ts +1 -1
- package/dist/types/ui/react.d.ts +66 -0
- package/dist/types/ui/scrollbar.d.ts +12 -0
- package/dist/types/ui/solid.d.ts +52 -0
- package/dist/types/ui/split-model.d.ts +4 -3
- package/dist/types/ui/split.d.ts +8 -6
- package/dist/types/ui/timeline.d.ts +35 -2
- package/dist/types/ui/tree.d.ts +7 -2
- package/dist/types/ui/walkthrough-css.d.ts +1 -0
- package/dist/types/ui/walkthrough-media.d.ts +29 -0
- package/dist/types/ui/walkthrough-model.d.ts +447 -0
- package/dist/types/ui/walkthrough.d.ts +63 -0
- package/dist/ui-react.js +16486 -8140
- package/dist/ui-solid.js +16030 -7775
- package/dist/ui.js +17510 -9506
- package/package.json +6 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** A file as before and after text. */
|
|
2
|
+
export interface DiffSource {
|
|
3
|
+
/** Its path, which is its id. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly before: string;
|
|
6
|
+
readonly after: string;
|
|
7
|
+
/** A Shiki language id, when the extension doesn't say. */
|
|
8
|
+
readonly lang?: string;
|
|
9
|
+
}
|
|
10
|
+
/** What a diff takes: a unified patch (`git diff`, `git show`, one file or many) or pairs. */
|
|
11
|
+
export interface DiffInput {
|
|
12
|
+
readonly patch?: string;
|
|
13
|
+
readonly files?: readonly DiffSource[];
|
|
14
|
+
}
|
|
15
|
+
export type DiffChange = "change" | "new" | "deleted" | "rename";
|
|
16
|
+
export interface DiffFile {
|
|
17
|
+
/** Its path after the change (before it, for a deleted file): the file's id. */
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** Its path before a rename. */
|
|
20
|
+
readonly prevName?: string;
|
|
21
|
+
readonly change: DiffChange;
|
|
22
|
+
readonly additions: number;
|
|
23
|
+
readonly deletions: number;
|
|
24
|
+
readonly binary?: boolean;
|
|
25
|
+
/** Its own part of the patch, headers and hunks. */
|
|
26
|
+
readonly patch?: string;
|
|
27
|
+
readonly before?: string;
|
|
28
|
+
readonly after?: string;
|
|
29
|
+
readonly lang?: string;
|
|
30
|
+
/** The rows its diff takes once drawn (see `DiffRows`). */
|
|
31
|
+
readonly rows?: DiffRows;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* How tall a file's diff is once drawn, in rows: each layout's lines (`split` pairs a removed
|
|
35
|
+
* line with an added one) and the separators that stand for unchanged lines between hunks. A
|
|
36
|
+
* card reserves this much before the renderer has loaded, so nothing jumps when it does.
|
|
37
|
+
*/
|
|
38
|
+
export interface DiffRows {
|
|
39
|
+
readonly unified: number;
|
|
40
|
+
readonly split: number;
|
|
41
|
+
readonly separators: number;
|
|
42
|
+
}
|
|
43
|
+
/** The context lines a patch made from before and after text keeps around each change. */
|
|
44
|
+
export declare const DIFF_CONTEXT = 3;
|
|
45
|
+
/**
|
|
46
|
+
* The files in a unified patch, in its order, with lines added and removed counted from the
|
|
47
|
+
* hunks. Takes `git diff`, `git show` and `format-patch` output (anything before the first
|
|
48
|
+
* file, a commit's header and message, is skipped) and plain `diff -u` output.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parsePatch(patch: string): DiffFile[];
|
|
51
|
+
/** Lines one side has that the other doesn't, by a shortest edit (Myers), as a patch counts them. */
|
|
52
|
+
export declare function countChanges(before: string, after: string): {
|
|
53
|
+
additions: number;
|
|
54
|
+
deletions: number;
|
|
55
|
+
};
|
|
56
|
+
/** What a patch made from before and after text would show: its counts and its rows. */
|
|
57
|
+
export declare function compareText(before: string, after: string, context?: number): {
|
|
58
|
+
additions: number;
|
|
59
|
+
deletions: number;
|
|
60
|
+
rows: DiffRows;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The rows of a patch over whole files: changes with `context` unchanged lines around them,
|
|
64
|
+
* changes no more than twice that apart in one hunk, and a separator for each run of
|
|
65
|
+
* unchanged lines left out (before, between and after the hunks).
|
|
66
|
+
*/
|
|
67
|
+
export declare function hunkRows(ops: ArrayLike<number>, context?: number): DiffRows;
|
|
68
|
+
/**
|
|
69
|
+
* A fingerprint of a file's change (its part of the patch, or its before and after text), so a
|
|
70
|
+
* file marked viewed comes back unviewed once its diff changes.
|
|
71
|
+
*/
|
|
72
|
+
export declare function fileKey(file: DiffFile): string;
|
|
73
|
+
/**
|
|
74
|
+
* Orders paths as a file tree shows them: at each level folders first, then files, each by
|
|
75
|
+
* name (natural order, so `file2` comes before `file10`).
|
|
76
|
+
*/
|
|
77
|
+
export declare function comparePaths(a: string, b: string): number;
|
|
78
|
+
/** A diff's files in tree order, counted: from the patch, or from each pair's text. */
|
|
79
|
+
export declare function diffFiles(input: DiffInput): DiffFile[];
|
|
80
|
+
/** Lines added and removed across the files. */
|
|
81
|
+
export declare function diffStats(files: readonly DiffFile[]): {
|
|
82
|
+
files: number;
|
|
83
|
+
additions: number;
|
|
84
|
+
deletions: number;
|
|
85
|
+
};
|
|
86
|
+
/** A path as the folder it's in and its own name. */
|
|
87
|
+
export declare function splitPath(name: string): {
|
|
88
|
+
dir: string;
|
|
89
|
+
base: string;
|
|
90
|
+
};
|
|
91
|
+
/** A row of a diff's file tree: a folder (one or more path segments) or a file. */
|
|
92
|
+
export interface DiffTreeItem {
|
|
93
|
+
/** A file's name, or `dir:` and a folder's path. */
|
|
94
|
+
readonly id: string;
|
|
95
|
+
readonly label: string;
|
|
96
|
+
/** The folder's path, or the file's. */
|
|
97
|
+
readonly path: string;
|
|
98
|
+
readonly file?: DiffFile;
|
|
99
|
+
readonly children?: readonly DiffTreeItem[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The files as tree items: folders hold what's in them, and a folder whose only child is a
|
|
103
|
+
* folder joins it (`src` › `ui` is one row, `src/ui`), so short trees stay flat.
|
|
104
|
+
*/
|
|
105
|
+
export declare function diffTree(files: readonly DiffFile[]): DiffTreeItem[];
|
|
106
|
+
/** Every folder's id in a diff tree (to open them all). */
|
|
107
|
+
export declare function diffFolders(items: readonly DiffTreeItem[]): string[];
|
|
108
|
+
/**
|
|
109
|
+
* Which file to show once the list changes: the same one if it's still there; else the one now
|
|
110
|
+
* where it was (the next, or the last); else the first. Null with no files.
|
|
111
|
+
*/
|
|
112
|
+
export declare function keepFile(prev: readonly DiffFile[], next: readonly DiffFile[], current: string | null | undefined): string | null;
|
|
113
|
+
/** The file before or after `current`, stopping at the ends. */
|
|
114
|
+
export declare function stepFile(files: readonly DiffFile[], current: string | null | undefined, dir: -1 | 1): string | null;
|
|
115
|
+
/**
|
|
116
|
+
* A change as a bar of `cells` squares, as GitHub draws one: how many show added, how many
|
|
117
|
+
* removed and how many neither. A change smaller than the bar fills one square a line; each side
|
|
118
|
+
* that has lines keeps at least one.
|
|
119
|
+
*/
|
|
120
|
+
export declare function diffBar(additions: number, deletions: number, cells?: number): [number, number, number];
|
|
121
|
+
/** Whether a path has every word of a query in it, any case: `ui diff` finds `src/ui/diff.ts`. */
|
|
122
|
+
export declare function matchPath(path: string, query: string): boolean;
|
|
123
|
+
/** The files still viewed: those saved viewed whose change is the one saved (see `fileKey`). */
|
|
124
|
+
export declare function stillViewed(saved: Readonly<Record<string, string>>, files: readonly DiffFile[]): Set<string>;
|
|
125
|
+
/** What to save for the files viewed: each one's name and the key of its change. */
|
|
126
|
+
export declare function saveViewed(viewed: Iterable<string>, files: readonly DiffFile[]): Record<string, string>;
|
|
127
|
+
/** The files under a tree item (itself, for a file). */
|
|
128
|
+
export declare function filesUnder(item: DiffTreeItem): string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CSS to hand the renderer: its code columns' native scrollbars hidden (`codeBars` draws
|
|
3
|
+
* thin ones), and every corner its stylesheet rounds by 6px rounded by `--kd-inner` instead, so
|
|
4
|
+
* a hunk separator inset in the card is concentric with it. Read once from its stylesheet.
|
|
5
|
+
*/
|
|
6
|
+
export declare function rendererCss(coreCss: () => string): string;
|
|
7
|
+
export interface CodeBars {
|
|
8
|
+
/** Looks for the code columns again (after a render) and places their bars. */
|
|
9
|
+
rescan(): void;
|
|
10
|
+
place(): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Thin bars for the code columns' sideways scroll (one per column; two when split), drawn in
|
|
15
|
+
* `layer` (a positioned element inside the scroller) at the bottom of what shows of each
|
|
16
|
+
* column, so the bar is in view however far down a long file you are. Hidden until the pointer
|
|
17
|
+
* is over the diff, or while you scroll the code sideways or drag a bar, as `overlayScrollbar`'s.
|
|
18
|
+
*/
|
|
19
|
+
export declare function codeBars(scroller: HTMLElement, layer: HTMLElement, root: () => ShadowRoot | null | undefined): CodeBars;
|
|
20
|
+
export interface EdgeFades {
|
|
21
|
+
update(): void;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Marks a scroller `data-fade-top` once it's scrolled and `data-fade-bottom` while there's more
|
|
26
|
+
* below, for the CSS that fades its content out at that edge (a mask, its stops on registered
|
|
27
|
+
* properties so they ease in and out).
|
|
28
|
+
*/
|
|
29
|
+
export declare function edgeFades(scroller: HTMLElement, content: Element): EdgeFades;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { type StoragePort } from "../core/storage.js";
|
|
2
|
+
import { type DiffFile, type DiffSource, type DiffTreeItem } from "./diff-model.js";
|
|
3
|
+
import { type UiLook } from "./look.js";
|
|
4
|
+
import { type Tree } from "./tree.js";
|
|
5
|
+
export type DiffLayout = "split" | "unified";
|
|
6
|
+
/** Lines picked in a diff (`onLines`): a range on one side, or across both. */
|
|
7
|
+
export interface DiffLines {
|
|
8
|
+
readonly start: number;
|
|
9
|
+
readonly end: number;
|
|
10
|
+
readonly side?: "deletions" | "additions";
|
|
11
|
+
readonly endSide?: "deletions" | "additions";
|
|
12
|
+
}
|
|
13
|
+
export interface CodeDiffOptions extends UiLook {
|
|
14
|
+
/** A unified patch: `git diff` or `git show` output, one file or many. */
|
|
15
|
+
readonly patch?: string;
|
|
16
|
+
/** Or files as before and after text (`patch` wins when both are set). */
|
|
17
|
+
readonly files?: readonly DiffSource[];
|
|
18
|
+
/** The file on show (its path); the first unless set. */
|
|
19
|
+
readonly file?: string | null;
|
|
20
|
+
/** Side by side (default) or one column. */
|
|
21
|
+
readonly layout?: DiffLayout;
|
|
22
|
+
/** Long lines wrap instead of scrolling sideways. */
|
|
23
|
+
readonly wrap?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* `"fill"` (default): the card fills its container and the diff scrolls inside it. `"auto"`:
|
|
26
|
+
* the card is as tall as the file's diff, up to `maxHeight`, and springs to each new height;
|
|
27
|
+
* it holds the height the diff will take from the start, so a page doesn't jump as it loads.
|
|
28
|
+
*/
|
|
29
|
+
readonly height?: "fill" | "auto";
|
|
30
|
+
/** Pixels, for `height: "auto"` (640, or 70% of the window when that's less); it scrolls past. */
|
|
31
|
+
readonly maxHeight?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Draws only near the viewport (a screen ahead) and lets go of a diff far behind, keeping its
|
|
34
|
+
* height; on by default with `height: "auto"`, for a long page of them. `ready` waits for it.
|
|
35
|
+
*/
|
|
36
|
+
readonly lazy?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Every file down one scroller, each under its own header (status, path, counts, Viewed)
|
|
39
|
+
* that sticks to the top until the next file's pushes it off; ‹ › and `show()` glide to a
|
|
40
|
+
* file, and the file on show follows the scroll. Each file draws when it's near the view.
|
|
41
|
+
*/
|
|
42
|
+
readonly stack?: boolean;
|
|
43
|
+
/** The files marked viewed; with this or `onViewed`, a Viewed check in the header. */
|
|
44
|
+
readonly viewed?: readonly string[];
|
|
45
|
+
/** The header's Viewed check marked or cleared the file on show. */
|
|
46
|
+
readonly onViewed?: (viewed: readonly string[], file: string) => void;
|
|
47
|
+
/** ‹ 2 of 5 › in the header when there are several files (on by default). */
|
|
48
|
+
readonly nav?: boolean;
|
|
49
|
+
/** Shiki themes for the code, dark and light (Pierre's own unless set). */
|
|
50
|
+
readonly syntax?: {
|
|
51
|
+
readonly dark: string;
|
|
52
|
+
readonly light: string;
|
|
53
|
+
};
|
|
54
|
+
/** Its own controls changed the file (‹ ›); `show()` doesn't call it. */
|
|
55
|
+
readonly onFile?: (name: string) => void;
|
|
56
|
+
readonly onLayout?: (layout: DiffLayout) => void;
|
|
57
|
+
readonly onWrap?: (wrap: boolean) => void;
|
|
58
|
+
/** Lines picked by dragging over line numbers; turns line selection on. */
|
|
59
|
+
readonly onLines?: (lines: DiffLines | null, file: string) => void;
|
|
60
|
+
/** Shown with no files. */
|
|
61
|
+
readonly empty?: string;
|
|
62
|
+
/** An element of your own at the start of the header (diffReview puts its list's toggle here). */
|
|
63
|
+
readonly lead?: HTMLElement;
|
|
64
|
+
}
|
|
65
|
+
export interface CodeDiffUpdate {
|
|
66
|
+
readonly patch?: string;
|
|
67
|
+
readonly files?: readonly DiffSource[];
|
|
68
|
+
readonly file?: string | null;
|
|
69
|
+
readonly layout?: DiffLayout;
|
|
70
|
+
readonly wrap?: boolean;
|
|
71
|
+
readonly viewed?: readonly string[];
|
|
72
|
+
/**
|
|
73
|
+
* Switches between filling the container and its diff's own height, in place: the views and
|
|
74
|
+
* their scroll stay. The new height is taken as it is, not sprung, so a container whose size
|
|
75
|
+
* is moving (a card going full window) is followed rather than fought.
|
|
76
|
+
*/
|
|
77
|
+
readonly height?: "fill" | "auto";
|
|
78
|
+
readonly maxHeight?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface CodeDiff {
|
|
81
|
+
readonly element: HTMLElement;
|
|
82
|
+
/** The diff's files, counted, in tree order. */
|
|
83
|
+
readonly files: readonly DiffFile[];
|
|
84
|
+
readonly file: string | null;
|
|
85
|
+
readonly layout: DiffLayout;
|
|
86
|
+
readonly wrap: boolean;
|
|
87
|
+
readonly viewed: readonly string[];
|
|
88
|
+
/** Shows a file: the new one fades in over the last, in place. */
|
|
89
|
+
show(name: string): void;
|
|
90
|
+
/** The file before or after the one on show. */
|
|
91
|
+
step(dir: -1 | 1): void;
|
|
92
|
+
/** New input or settings; a new patch keeps the file on show if it's still there. */
|
|
93
|
+
update(next: CodeDiffUpdate): void;
|
|
94
|
+
/** Settles once the first file is drawn. */
|
|
95
|
+
readonly ready: Promise<void>;
|
|
96
|
+
dispose(): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A file's `+12 −3`, coloured, for a row of your own (a tree's `detail`); `bar` adds five
|
|
100
|
+
* squares that show the share added and removed, as GitHub does.
|
|
101
|
+
*/
|
|
102
|
+
export declare function diffCounts(file: DiffFile, doc?: Document, options?: {
|
|
103
|
+
readonly bar?: boolean;
|
|
104
|
+
}): HTMLElement;
|
|
105
|
+
/** A file's change as a letter (M, A, D, R), for a tree's `icon`. */
|
|
106
|
+
export declare function diffStatus(file: DiffFile, doc?: Document): HTMLElement;
|
|
107
|
+
/**
|
|
108
|
+
* A code diff in a knobs card: a header with the file's path, its counts and Split | Unified
|
|
109
|
+
* over the diff, drawn by `@pierre/diffs` (Shiki highlighting, word-level changes, hunks that
|
|
110
|
+
* expand when the whole files are known). Takes a unified patch or before and after pairs.
|
|
111
|
+
* Changing the file or the layout fades the new view in over the old, in place; each file
|
|
112
|
+
* keeps its scroll. On another surface (a card, a split's pane, a walkthrough's step) it draws
|
|
113
|
+
* no card of its own. Needs `@pierre/diffs` installed; it loads on first use.
|
|
114
|
+
*/
|
|
115
|
+
export declare function codeDiff(container: HTMLElement, options: CodeDiffOptions): CodeDiff;
|
|
116
|
+
export interface DiffReviewOptions extends CodeDiffOptions {
|
|
117
|
+
/**
|
|
118
|
+
* Saves whether the file list is open and the files marked viewed, under this id. A viewed
|
|
119
|
+
* file whose change moves on comes back unviewed.
|
|
120
|
+
*/
|
|
121
|
+
readonly id?: string;
|
|
122
|
+
readonly storage?: StoragePort | null;
|
|
123
|
+
/** The file list's title ("Files"). */
|
|
124
|
+
readonly title?: string;
|
|
125
|
+
/** The file list's width in pixels when open (256). */
|
|
126
|
+
readonly listSize?: number;
|
|
127
|
+
/** The file list starts open (the default) or closed; what was last chosen wins, with an id. */
|
|
128
|
+
readonly listOpen?: boolean;
|
|
129
|
+
/** A field over the file list that narrows it by path (on by default). */
|
|
130
|
+
readonly search?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface DiffReview {
|
|
133
|
+
readonly element: HTMLElement;
|
|
134
|
+
readonly tree: Tree<DiffTreeItem>;
|
|
135
|
+
readonly diff: CodeDiff;
|
|
136
|
+
/** The files marked viewed. */
|
|
137
|
+
readonly viewed: readonly string[];
|
|
138
|
+
/** Marks files viewed or not (a folder's id marks what's in it). */
|
|
139
|
+
setViewed(names: readonly string[], viewed: boolean): void;
|
|
140
|
+
/** Narrows the file list to paths with every word of `query`. */
|
|
141
|
+
filter(query: string): void;
|
|
142
|
+
/** Whether the file list is open. */
|
|
143
|
+
readonly listOpen: boolean;
|
|
144
|
+
/** Springs the file list open or closed (toggles without an argument). */
|
|
145
|
+
toggleList(open?: boolean): void;
|
|
146
|
+
update(next: CodeDiffUpdate): void;
|
|
147
|
+
dispose(): void;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A diff beside its file list, as a review, in one card: the list is a drawer at its left that
|
|
151
|
+
* springs open and shut (0 to 256px, .4 s, no bounce; the diff reflows as it moves) from a
|
|
152
|
+
* button at the start of the diff's header, or ⌘B / Ctrl+B. In it, a field that narrows the list
|
|
153
|
+
* by path, then the changed files as a compact tree (folders folded into paths), each with its
|
|
154
|
+
* change as a letter (M, A, D, R, coloured), its +/− counts and their bar, and a tick to mark it
|
|
155
|
+
* viewed; one highlight glides to the file on show. Viewed files dim, count in the list's title
|
|
156
|
+
* and, with an `id`, are remembered until their change moves on. `tree` and `diff` are the pieces.
|
|
157
|
+
*/
|
|
158
|
+
export declare function diffReview(container: HTMLElement, options: DiffReviewOptions): DiffReview;
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -12,13 +12,21 @@ export { toast, type Toast, type ToastOptions } from "./toast.js";
|
|
|
12
12
|
export { tooltip, tooltips, type TooltipContent, type TooltipOptions } from "./tooltip.js";
|
|
13
13
|
export { split, type PaneAction, type PaneOptions, type Split, type SplitFold, type SplitOptions, type SplitPane, } from "./split.js";
|
|
14
14
|
export { COLLAPSE_PAST, drag as dragDivider, parseLayout, softClamp, solve as solveSplit, type PaneSpec, type SplitDirection, type SplitLayout, } from "./split-model.js";
|
|
15
|
-
export { timeline, type SeekSource, type Timeline, type TimelineMarker, type TimelineOptions, type TimelineRange, } from "./timeline.js";
|
|
15
|
+
export { timeline, type SeekSource, type Timeline, type TimelineMarker, type TimelineListener, type TimelineOptions, type TimelineRange, } from "./timeline.js";
|
|
16
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";
|
|
17
|
+
export { compare, COMPARE_FFMPEG, type Compare, type CompareLoop, type CompareMode, type CompareOptions, type CompareSource, type CompareView, type MediaKind, type ZoomRegion, } from "./compare.js";
|
|
18
|
+
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";
|
|
17
20
|
export { tree, type Tree, type TreeOptions, type TreeRowContext, type TreeToggle } from "./tree.js";
|
|
18
21
|
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
|
+
export { codeDiff, diffCounts, diffReview, diffStatus, type CodeDiff, type CodeDiffOptions, type CodeDiffUpdate, type DiffLayout, type DiffLines, type DiffReview, type DiffReviewOptions, } from "./diff.js";
|
|
23
|
+
export { compareText, comparePaths, countChanges, diffBar, diffFiles, diffFolders, diffStats, diffTree, fileKey, filesUnder, keepFile, matchPath, parsePatch, splitPath, stepFile, type DiffChange, type DiffFile, type DiffInput, type DiffRows, type DiffSource, type DiffTreeItem, } from "./diff-model.js";
|
|
19
24
|
export { bento, type Bento, type BentoItem, type BentoOptions } from "./bento.js";
|
|
20
25
|
export { fitRect, FIT_MAX, motionBlur, neighbour as bentoNeighbour, planBento, rowTarget, windowOf as bentoWindow, type BentoDirection, type BentoLayout, type BentoMode, type BentoPlan, type BentoRect, } from "./bento-model.js";
|
|
21
26
|
export { activity, type Activity, type ActivityOptions, } from "./activity.js";
|
|
22
27
|
export { diffActivity, flattenActivity, formatDuration, indexActivity, keepSelection as keepActivitySelection, navigateActivity, railSegments, showsSelection, stackRows, type ActivityEvent, type ActivityInput, type ActivityKey, type ActivityKind, type ActivityRow, type RailNode, } from "./activity-model.js";
|
|
23
28
|
export { optionPicker, type OptionPicker, type OptionPickerOptions, type PickerOption, } from "./picker.js";
|
|
24
29
|
export { claimsDigit, digitPick, keepPick, stepPick } from "./picker-model.js";
|
|
30
|
+
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";
|
package/dist/types/ui/look.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const tune: <T extends {
|
|
|
39
39
|
readonly zeta: number;
|
|
40
40
|
}) => T;
|
|
41
41
|
/** Whether `target` is an editable field or select that takes typed keys. */
|
|
42
|
-
export
|
|
42
|
+
export { isTypingTarget } from "../core/keys.js";
|
|
43
43
|
/**
|
|
44
44
|
* Tells the page's GPU overlay that layout moved (a pane resizing, collapsing or sliding): it
|
|
45
45
|
* reads rects afresh on its next frame, so a panel inside a pane keeps up.
|
package/dist/types/ui/react.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
2
|
import { type Activity as ActivityHandle, type ActivityOptions } from "./activity.js";
|
|
3
3
|
import { type Bento as BentoHandle, type BentoOptions } from "./bento.js";
|
|
4
|
+
import { type CodeDiff as CodeDiffHandle, type CodeDiffOptions, type DiffReview as DiffReviewHandle, type DiffReviewOptions } from "./diff.js";
|
|
4
5
|
import { type OptionPicker as OptionPickerHandle, type OptionPickerOptions, type PickerOption } from "./picker.js";
|
|
5
6
|
import { type Split as SplitHandle, type SplitOptions } from "./split.js";
|
|
6
7
|
import { type Timeline as TimelineHandle, type TimelineOptions } from "./timeline.js";
|
|
8
|
+
import { type Compare as CompareHandle, type CompareOptions } from "./compare.js";
|
|
9
|
+
import { type CompareStrip as CompareStripHandle, type CompareStripOptions } from "./compare-strip.js";
|
|
7
10
|
import { type Tree as TreeHandle, type TreeOptions } from "./tree.js";
|
|
11
|
+
import { type TasteTest as TasteTestHandle, type TasteTestOptions, type Walkthrough as WalkthroughHandle, type WalkthroughOptions } from "./walkthrough.js";
|
|
12
|
+
import { type MediaSlot as MediaSlotHandle, type MediaSlotOptions } from "./walkthrough-media.js";
|
|
8
13
|
export type SplitProps = SplitOptions & {
|
|
9
14
|
/** One child per pane, in the panes' order; each renders into its pane's body. */
|
|
10
15
|
children?: ReactNode;
|
|
@@ -24,6 +29,24 @@ export type TreeProps<T> = TreeOptions<T> & {
|
|
|
24
29
|
* `filter` follow their props; callbacks always call the latest props.
|
|
25
30
|
*/
|
|
26
31
|
export declare function Tree<T>(props: TreeProps<T>): import("react").JSX.Element;
|
|
32
|
+
export type CodeDiffProps = CodeDiffOptions & {
|
|
33
|
+
className?: string;
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
onReady?: (diff: CodeDiffHandle) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* `codeDiff()` as a component. `patch`, `files`, `file`, `layout`, `wrap`, `viewed`, `height` and
|
|
39
|
+
* `maxHeight` follow their
|
|
40
|
+
* props; callbacks always call the latest props.
|
|
41
|
+
*/
|
|
42
|
+
export declare function CodeDiff(props: CodeDiffProps): import("react").JSX.Element;
|
|
43
|
+
export type DiffReviewProps = DiffReviewOptions & {
|
|
44
|
+
className?: string;
|
|
45
|
+
style?: CSSProperties;
|
|
46
|
+
onReady?: (review: DiffReviewHandle) => void;
|
|
47
|
+
};
|
|
48
|
+
/** `diffReview()` as a component: the file tree beside the diff; follows as `CodeDiff` does. */
|
|
49
|
+
export declare function DiffReview(props: DiffReviewProps): import("react").JSX.Element;
|
|
27
50
|
export type TimelineProps = TimelineOptions & {
|
|
28
51
|
className?: string;
|
|
29
52
|
style?: CSSProperties;
|
|
@@ -35,6 +58,24 @@ export type TimelineProps = TimelineOptions & {
|
|
|
35
58
|
* always call the latest props.
|
|
36
59
|
*/
|
|
37
60
|
export declare function Timeline(props: TimelineProps): import("react").JSX.Element;
|
|
61
|
+
export type CompareProps = CompareOptions & {
|
|
62
|
+
className?: string;
|
|
63
|
+
style?: CSSProperties;
|
|
64
|
+
onReady?: (compare: CompareHandle) => void;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* `compare()` as a component. `before`, `after` (by `src`), `mode`, `wipe`, `loupe`, `threshold`
|
|
68
|
+
* and `fps` follow their props; a new `timeline` handle, `strip` or `renderer` makes it afresh;
|
|
69
|
+
* callbacks always call the latest props.
|
|
70
|
+
*/
|
|
71
|
+
export declare function Compare(props: CompareProps): import("react").JSX.Element;
|
|
72
|
+
export type CompareStripProps = CompareStripOptions & {
|
|
73
|
+
className?: string;
|
|
74
|
+
style?: CSSProperties;
|
|
75
|
+
onReady?: (strip: CompareStripHandle) => void;
|
|
76
|
+
};
|
|
77
|
+
/** `compareStrip()` as a component, on a timeline handle; new sources (by `src`) follow. */
|
|
78
|
+
export declare function CompareStrip(props: CompareStripProps): import("react").JSX.Element;
|
|
38
79
|
export type BentoProps = BentoOptions & {
|
|
39
80
|
className?: string;
|
|
40
81
|
style?: CSSProperties;
|
|
@@ -70,3 +111,28 @@ export type OptionPickerProps = Omit<OptionPickerOptions, "body"> & {
|
|
|
70
111
|
export declare function OptionPicker(props: OptionPickerProps): import("react").JSX.Element;
|
|
71
112
|
export type { ActivityEvent } from "./activity-model.js";
|
|
72
113
|
export type { PickerOption } from "./picker.js";
|
|
114
|
+
export type WalkthroughProps = WalkthroughOptions & {
|
|
115
|
+
className?: string;
|
|
116
|
+
style?: CSSProperties;
|
|
117
|
+
onReady?: (walkthrough: WalkthroughHandle) => void;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* `walkthrough()` as a component: a new `doc` is a new draft (answers carry over by step key);
|
|
121
|
+
* `onFeedback` always calls the latest prop.
|
|
122
|
+
*/
|
|
123
|
+
export declare function Walkthrough(props: WalkthroughProps): import("react").JSX.Element;
|
|
124
|
+
export type TasteTestProps = TasteTestOptions & {
|
|
125
|
+
className?: string;
|
|
126
|
+
style?: CSSProperties;
|
|
127
|
+
onReady?: (test: TasteTestHandle) => void;
|
|
128
|
+
};
|
|
129
|
+
/** `tasteTest()` as a component: `picked` follows its prop; new `options` make it afresh. */
|
|
130
|
+
export declare function TasteTest(props: TasteTestProps): import("react").JSX.Element;
|
|
131
|
+
export type MediaSlotProps = MediaSlotOptions & {
|
|
132
|
+
className?: string;
|
|
133
|
+
style?: CSSProperties;
|
|
134
|
+
onReady?: (slot: MediaSlotHandle) => void;
|
|
135
|
+
};
|
|
136
|
+
/** `mediaSlot()` as a component: one walkthrough media slot; new `media` mounts afresh. */
|
|
137
|
+
export declare function MediaSlot(props: MediaSlotProps): import("react").JSX.Element;
|
|
138
|
+
export type { WalkthroughDoc, WalkthroughFeedback } from "./walkthrough-model.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A thin scrollbar drawn over a scroller's content, in place of the native one beside it. A native
|
|
3
|
+
* scrollbar that's always shown (as a system may be set) takes its width from the rows the moment
|
|
4
|
+
* the content overflows, so every row jumps sideways, and gives it back when it stops; this one
|
|
5
|
+
* takes no room. It shows while the pointer is over the scroller, while you scroll it and while
|
|
6
|
+
* you drag it; a scroll from code (a reveal, a restored position) doesn't flash it. `content` is the element whose height makes the scroll: it's watched for changes.
|
|
7
|
+
* The scroller hides its own (`scrollbar-width: none`) and is positioned.
|
|
8
|
+
*/
|
|
9
|
+
export declare function overlayScrollbar(scroller: HTMLElement, content: Element): {
|
|
10
|
+
update: () => void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
};
|
package/dist/types/ui/solid.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { type JSX } from "solid-js";
|
|
2
2
|
import { type Activity as ActivityHandle, type ActivityOptions } from "./activity.js";
|
|
3
3
|
import { type Bento as BentoHandle, type BentoOptions } from "./bento.js";
|
|
4
|
+
import { type CodeDiff as CodeDiffHandle, type CodeDiffOptions, type DiffReview as DiffReviewHandle, type DiffReviewOptions } from "./diff.js";
|
|
4
5
|
import { type OptionPicker as OptionPickerHandle, type OptionPickerOptions, type PickerOption } from "./picker.js";
|
|
5
6
|
import { type Split as SplitHandle, type SplitOptions } from "./split.js";
|
|
6
7
|
import { type Timeline as TimelineHandle, type TimelineOptions } from "./timeline.js";
|
|
8
|
+
import { type Compare as CompareHandle, type CompareOptions } from "./compare.js";
|
|
9
|
+
import { type CompareStrip as CompareStripHandle, type CompareStripOptions } from "./compare-strip.js";
|
|
7
10
|
import { type Tree as TreeHandle, type TreeOptions } from "./tree.js";
|
|
11
|
+
import { type TasteTest as TasteTestHandle, type TasteTestOptions, type Walkthrough as WalkthroughHandle, type WalkthroughOptions } from "./walkthrough.js";
|
|
12
|
+
import { type MediaSlot as MediaSlotHandle, type MediaSlotOptions } from "./walkthrough-media.js";
|
|
8
13
|
export type SplitProps = SplitOptions & {
|
|
9
14
|
/** One element per pane, in the panes' order; each goes into its pane's body. */
|
|
10
15
|
children?: JSX.Element;
|
|
@@ -23,6 +28,20 @@ export type TreeProps<T> = TreeOptions<T> & {
|
|
|
23
28
|
* `filter` follow their props; callbacks always call the latest props.
|
|
24
29
|
*/
|
|
25
30
|
export declare function Tree<T>(props: TreeProps<T>): JSX.Element;
|
|
31
|
+
export type CodeDiffProps = CodeDiffOptions & {
|
|
32
|
+
onReady?: (diff: CodeDiffHandle) => void;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* `codeDiff()` as a component. `patch`, `files`, `file`, `layout`, `wrap`, `viewed`, `height` and
|
|
36
|
+
* `maxHeight` follow their
|
|
37
|
+
* props; callbacks always call the latest props.
|
|
38
|
+
*/
|
|
39
|
+
export declare function CodeDiff(props: CodeDiffProps): JSX.Element;
|
|
40
|
+
export type DiffReviewProps = DiffReviewOptions & {
|
|
41
|
+
onReady?: (review: DiffReviewHandle) => void;
|
|
42
|
+
};
|
|
43
|
+
/** `diffReview()` as a component: the file tree beside the diff; follows as `CodeDiff` does. */
|
|
44
|
+
export declare function DiffReview(props: DiffReviewProps): JSX.Element;
|
|
26
45
|
export type TimelineProps = TimelineOptions & {
|
|
27
46
|
onReady?: (timeline: TimelineHandle) => void;
|
|
28
47
|
};
|
|
@@ -32,6 +51,20 @@ export type TimelineProps = TimelineOptions & {
|
|
|
32
51
|
* always call the latest props.
|
|
33
52
|
*/
|
|
34
53
|
export declare function Timeline(props: TimelineProps): JSX.Element;
|
|
54
|
+
export type CompareProps = CompareOptions & {
|
|
55
|
+
onReady?: (compare: CompareHandle) => void;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* `compare()` as a component, made once (with the `timeline`, `strip` and `renderer` it starts
|
|
59
|
+
* with). `before`, `after` (by `src`), `mode`, `wipe`, `loupe`, `threshold` and `fps` follow
|
|
60
|
+
* their props; callbacks always call the latest props.
|
|
61
|
+
*/
|
|
62
|
+
export declare function Compare(props: CompareProps): JSX.Element;
|
|
63
|
+
export type CompareStripProps = CompareStripOptions & {
|
|
64
|
+
onReady?: (strip: CompareStripHandle) => void;
|
|
65
|
+
};
|
|
66
|
+
/** `compareStrip()` as a component, on a timeline handle; new sources (by `src`) follow. */
|
|
67
|
+
export declare function CompareStrip(props: CompareStripProps): JSX.Element;
|
|
35
68
|
export type BentoProps = BentoOptions & {
|
|
36
69
|
onReady?: (bento: BentoHandle) => void;
|
|
37
70
|
};
|
|
@@ -61,3 +94,22 @@ export type OptionPickerProps = Omit<OptionPickerOptions, "body"> & {
|
|
|
61
94
|
export declare function OptionPicker(props: OptionPickerProps): JSX.Element;
|
|
62
95
|
export type { ActivityEvent } from "./activity-model.js";
|
|
63
96
|
export type { PickerOption } from "./picker.js";
|
|
97
|
+
export type WalkthroughProps = WalkthroughOptions & {
|
|
98
|
+
onReady?: (walkthrough: WalkthroughHandle) => void;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* `walkthrough()` as a component: a new `doc` is a new draft (answers carry over by step key);
|
|
102
|
+
* `onFeedback` always calls the latest prop.
|
|
103
|
+
*/
|
|
104
|
+
export declare function Walkthrough(props: WalkthroughProps): JSX.Element;
|
|
105
|
+
export type TasteTestProps = TasteTestOptions & {
|
|
106
|
+
onReady?: (test: TasteTestHandle) => void;
|
|
107
|
+
};
|
|
108
|
+
/** `tasteTest()` as a component: `picked` follows its prop. */
|
|
109
|
+
export declare function TasteTest(props: TasteTestProps): JSX.Element;
|
|
110
|
+
export type MediaSlotProps = MediaSlotOptions & {
|
|
111
|
+
onReady?: (slot: MediaSlotHandle) => void;
|
|
112
|
+
};
|
|
113
|
+
/** `mediaSlot()` as a component: one walkthrough media slot. */
|
|
114
|
+
export declare function MediaSlot(props: MediaSlotProps): JSX.Element;
|
|
115
|
+
export type { WalkthroughDoc, WalkthroughFeedback } from "./walkthrough-model.js";
|
|
@@ -97,10 +97,11 @@ export declare function foldFaces(prev: FoldFaces, p: number): FoldFaces;
|
|
|
97
97
|
*/
|
|
98
98
|
export declare function chevronTurn(p: number, edge: "start" | "end"): number;
|
|
99
99
|
/**
|
|
100
|
-
* The fold's chevron, flipping: its
|
|
101
|
-
* `f` (0 open, 1 folded).
|
|
100
|
+
* The fold's chevron, flipping over: its turn about its vertical axis (degrees, drawn with depth)
|
|
101
|
+
* against the rail's chevron at flip progress `f` (0 open, 1 folded). Edge-on halfway, it comes
|
|
102
|
+
* round mirrored, rolling the way the pane's edge travels.
|
|
102
103
|
*/
|
|
103
|
-
export declare function chevronFlip(f: number): number;
|
|
104
|
+
export declare function chevronFlip(f: number, edge: "start" | "end"): number;
|
|
104
105
|
/** How a pane folds: see `SplitOptions.fold`. */
|
|
105
106
|
export interface FoldStyle {
|
|
106
107
|
readonly chevron: "flip" | "turn";
|
package/dist/types/ui/split.d.ts
CHANGED
|
@@ -45,8 +45,9 @@ export interface SplitOptions extends UiLook {
|
|
|
45
45
|
/** How a pane folds (each part has a default). */
|
|
46
46
|
export interface SplitFold {
|
|
47
47
|
/**
|
|
48
|
-
* The collapse chevron: `"flip"` (default)
|
|
49
|
-
*
|
|
48
|
+
* The collapse chevron: `"flip"` (default) turns it over about its vertical axis, with depth,
|
|
49
|
+
* mirrored as it travels, on its own snappy spring; `"turn"` spins it half a turn flat, with
|
|
50
|
+
* the fold.
|
|
50
51
|
*/
|
|
51
52
|
readonly chevron?: "flip" | "turn";
|
|
52
53
|
/**
|
|
@@ -54,7 +55,7 @@ export interface SplitFold {
|
|
|
54
55
|
* element all the way; `"fade"` fades it out with the header as the rail's label fades in.
|
|
55
56
|
*/
|
|
56
57
|
readonly title?: "travel" | "fade";
|
|
57
|
-
/** The fold's spring, in seconds (no bounce): 0.
|
|
58
|
+
/** The fold's spring, in seconds (no bounce): 0.25 unless set. */
|
|
58
59
|
readonly duration?: number;
|
|
59
60
|
}
|
|
60
61
|
export interface SplitPane {
|
|
@@ -85,8 +86,9 @@ export interface Split {
|
|
|
85
86
|
/**
|
|
86
87
|
* Resizable panes along a row or a column, divided by hairlines with a wider grip. Drag a divider
|
|
87
88
|
* to resize (each pane slows into its min and max), double-click it to reset, or focus it and use
|
|
88
|
-
* the arrow keys (⇧ for bigger steps) and Enter to collapse
|
|
89
|
-
*
|
|
90
|
-
*
|
|
89
|
+
* the arrow keys (⇧ for bigger steps) and Enter to collapse; in a row, double-click a pane's header
|
|
90
|
+
* to collapse it too. Collapsing springs the pane down to a slim rail, or to its header in a
|
|
91
|
+
* column, which opens it again. Sizes persist and restore before the first paint. Splits nest:
|
|
92
|
+
* call `split` on another split's pane body.
|
|
91
93
|
*/
|
|
92
94
|
export declare function split(container: HTMLElement, options: SplitOptions): Split;
|