@kitlangton/knobs 0.4.0-next.2 → 0.4.0-next.4

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.
@@ -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 {};
@@ -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
- /** `glide`: the playhead springs there (the time, and what it drives, land at once). */
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;
@@ -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 one highlight that glides to the next row selected, on the
68
- * rows' own spring, instead of each row lighting in place. Several selected rows light in place.
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
  }
@@ -1,4 +1,9 @@
1
1
  import { type ContextEvent, type WalkChapter, type WalkMedia } from "./walkthrough-model.js";
2
+ /** The glyphs the blocks draw. */
3
+ export declare const GLYPH: {
4
+ go: string;
5
+ caret: string;
6
+ };
2
7
  /** How media reach the page's steps: `step` on a history event, a stack item or a table cell. */
3
8
  export interface StepLinks {
4
9
  /** The step a ref names (its key, id or number), or null when there's none. */
@@ -17,6 +22,8 @@ export interface Block {
17
22
  kind: string;
18
23
  };
19
24
  }
25
+ /** A small arrow that goes to the step a ref names; null when it names none. */
26
+ export declare function stepButton(doc: Document, ref: string | undefined, steps: StepLinks | undefined): HTMLButtonElement | null;
20
27
  export declare function mountHistory(host: HTMLElement, m: Extract<WalkMedia, {
21
28
  kind: "history";
22
29
  }>, steps: StepLinks | undefined): Block;
@@ -27,7 +34,7 @@ export declare function mountTable(host: HTMLElement, m: Extract<WalkMedia, {
27
34
  kind: "table";
28
35
  }>, steps: StepLinks | undefined): Block;
29
36
  export interface ChapterPills {
30
- /** The chapter the time is in (call as it plays or seeks): the highlight springs to it. */
37
+ /** The chapter the time is in (call as it plays or seeks): the pill slides to it. */
31
38
  sync(): void;
32
39
  /** The chapter playing, or null. */
33
40
  readonly current: WalkChapter | null;
@@ -40,4 +47,16 @@ export declare function chapterPills(host: HTMLElement, chapters: readonly WalkC
40
47
  seek(time: number): void;
41
48
  onEvent: OnEvent;
42
49
  }): ChapterPills;
50
+ export interface Disclosure {
51
+ readonly element: HTMLElement;
52
+ readonly open: boolean;
53
+ toggle(open?: boolean): void;
54
+ dispose(): void;
55
+ }
56
+ export declare function disclosure(host: HTMLElement, options: {
57
+ label: string;
58
+ count?: number;
59
+ open?: boolean;
60
+ content: HTMLElement;
61
+ }): Disclosure;
43
62
  export {};
@@ -144,6 +144,14 @@ export type WalkthroughMedia = string | {
144
144
  readonly columns: readonly WalkthroughTableColumn[];
145
145
  readonly rows: readonly WalkthroughTableRow[];
146
146
  readonly caption?: string;
147
+ /**
148
+ * Where the step is too narrow for its columns, each row becomes a block: its primary cell
149
+ * as a title over the rest as term and value (`"auto"`, the default); always; or never
150
+ * (the table scrolls sideways instead).
151
+ */
152
+ readonly stack?: "auto" | "always" | "never";
153
+ /** The column that titles a stacked row (its key); the first by default. */
154
+ readonly primary?: string;
147
155
  } | {
148
156
  readonly kind: "image";
149
157
  readonly src: string;
@@ -205,8 +213,12 @@ export interface WalkthroughStep {
205
213
  readonly title: string;
206
214
  /** A line or two: what it shows and how it was made. `code`, **bold** and [links](…) work. */
207
215
  readonly caption?: string;
208
- /** One slot; two or more sit side by side, stacking where it's narrow. */
216
+ /** One slot, or several one under another (`columns` sets them side by side). */
209
217
  readonly media?: WalkthroughMedia | readonly WalkthroughMedia[];
218
+ /** Media side by side, this many to a row where there's room; one under another by default. */
219
+ readonly columns?: 1 | 2 | 3;
220
+ /** The media after the first fold away under a quiet toggle with these words ("More clips"). */
221
+ readonly more?: string;
210
222
  /** A taste test: Kit picks one. */
211
223
  readonly options?: readonly WalkthroughOption[];
212
224
  /**
@@ -225,6 +237,11 @@ export interface WalkthroughSection {
225
237
  readonly href: string;
226
238
  readonly label?: string;
227
239
  };
240
+ /**
241
+ * The words that lead its meta line, in text colour: its count by default (`"PR 2 of 5"` where
242
+ * `link` is a pull request, or the doc's `kickers` noun), your own words, or `false` for none.
243
+ */
244
+ readonly kicker?: string | false;
228
245
  readonly status?: WalkthroughStatus;
229
246
  readonly summary?: string;
230
247
  readonly steps: readonly WalkthroughStep[];
@@ -241,6 +258,10 @@ export interface WalkthroughUpdate {
241
258
  readonly text: string;
242
259
  /** The step it's about: its key, id or number ("1.2"). */
243
260
  readonly step?: string;
261
+ /** Its state in a word or two (`"shipped"`, `"changes"`), last on its meta line. */
262
+ readonly status?: string;
263
+ /** Context, folded away under the item: one line each, `"0:04 · Played the compare"`. */
264
+ readonly trail?: readonly string[];
244
265
  }
245
266
  /** A question Kit asked and the agent's answer. */
246
267
  export interface WalkthroughQA {
@@ -249,6 +270,10 @@ export interface WalkthroughQA {
249
270
  readonly q: string;
250
271
  readonly a: string;
251
272
  readonly step?: string;
273
+ /** `"shipped"` or `"changes"` (shown as "Changes queued"), or your own words. */
274
+ readonly status?: string;
275
+ /** What Kit did before asking, folded away under the answer: `"0:04 · Played the compare"`. */
276
+ readonly trail?: readonly string[];
252
277
  }
253
278
  /** The document an agent writes: plain data, JSON but for `mount` media. */
254
279
  export interface WalkthroughDoc {
@@ -266,6 +291,15 @@ export interface WalkthroughDoc {
266
291
  readonly updates?: readonly WalkthroughUpdate[];
267
292
  /** Kit's questions and the agent's answers. */
268
293
  readonly qa?: readonly WalkthroughQA[];
294
+ /**
295
+ * How sections are counted on their meta line: `"pr"` (the default) gives "PR i of N" to the
296
+ * sections that link a pull request, `{ noun: "Part" }` "Part i of N" to every section, and
297
+ * `false` none. A section's own `kicker` wins over its count, and `false` hides it, without
298
+ * renumbering the rest.
299
+ */
300
+ readonly kickers?: "pr" | {
301
+ readonly noun: string;
302
+ } | false;
269
303
  readonly sections: readonly WalkthroughSection[];
270
304
  }
271
305
  type CompareMedia = Extract<WalkthroughMedia, {
@@ -342,6 +376,9 @@ export type WalkMedia = Exclude<WalkthroughMedia, string | {
342
376
  readonly columns: readonly WalkTableColumn[];
343
377
  readonly rows: readonly Readonly<Record<string, WalkTableCell>>[];
344
378
  readonly caption?: string;
379
+ readonly stack: "auto" | "always" | "never";
380
+ /** The key of the column that titles a stacked row. */
381
+ readonly primary: string;
345
382
  };
346
383
  export interface WalkOption {
347
384
  readonly id: string;
@@ -363,6 +400,9 @@ export interface WalkStep {
363
400
  readonly caption?: string;
364
401
  readonly question?: string;
365
402
  readonly media: readonly WalkMedia[];
403
+ /** Media to a row: 1 (one under another) unless the step asked for more. */
404
+ readonly columns: number;
405
+ readonly more?: string;
366
406
  readonly options: readonly WalkOption[];
367
407
  readonly ask: "note" | "pick" | "none";
368
408
  }
@@ -373,6 +413,8 @@ export interface WalkSection {
373
413
  readonly href: string;
374
414
  readonly label: string;
375
415
  };
416
+ /** What leads its meta line ("PR 2 of 5"), when anything does. */
417
+ readonly kicker?: string;
376
418
  readonly status?: WalkthroughStatus;
377
419
  readonly summary?: string;
378
420
  readonly steps: readonly WalkStep[];
@@ -391,6 +433,8 @@ export interface FeedItem {
391
433
  readonly q?: string;
392
434
  /** The step's key, when it names one that's there. */
393
435
  readonly step: string | null;
436
+ readonly status?: string;
437
+ readonly trail: readonly string[];
394
438
  }
395
439
  export interface WalkPage {
396
440
  readonly id: string;
@@ -470,6 +514,18 @@ export declare function linkLabel(href: string): string;
470
514
  * ask, options lettered, media URLs resolved against `base`, and the verdicts labelled.
471
515
  */
472
516
  export declare function normalizeWalkthrough(doc: WalkthroughDoc): WalkPage;
517
+ /** Whether a link is a pull (or merge) request: GitHub's `/pull/123`, GitLab's merge requests. */
518
+ export declare const isPullRequest: (href: string) => boolean;
519
+ /**
520
+ * Whether a table stacks its rows into blocks: always, never, or (auto) when the room it has is
521
+ * less than its columns' natural width.
522
+ */
523
+ export declare function tableStacks(stack: "auto" | "always" | "never", room: number, natural: number): boolean;
524
+ /**
525
+ * The page's bottom reserve for the docked note bar: its height, the gap it floats above the
526
+ * page's edge, and a gap above it, so the last step and a step gone to never sit under it.
527
+ */
528
+ export declare function noteBarReserve(bar: number, inset: number, gap: number): number;
473
529
  /** An ISO time as epoch ms; null when it isn't one. */
474
530
  export declare function parseAt(at: string | undefined): number | null;
475
531
  /** Newest first; items without a time after those with one, later-written first. */
@@ -677,5 +733,7 @@ export declare function feedbackMarkdown(fb: WalkthroughFeedback, verdicts?: rea
677
733
  * Inline Markdown as safe HTML: `code`, **bold**, *italic* and [links](https://…), the rest
678
734
  * escaped. Links take http(s), relative and # URLs only; blank lines make paragraphs' breaks.
679
735
  */
736
+ /** Inline Markdown as plain words, for a contents row, a label or a title attribute. */
737
+ export declare function plainMarkdown(text: string): string;
680
738
  export declare function inlineMarkdown(text: string): string;
681
739
  export {};
@@ -35,8 +35,16 @@ export interface WalkthroughOptions extends UiLook {
35
35
  readonly onFeedback?: (feedback: WalkthroughFeedback) => void;
36
36
  /** The page's keys (on by default). */
37
37
  readonly keys?: boolean;
38
- /** The contents and progress rail (on by default). */
39
- readonly rail?: boolean;
38
+ /** The contents and progress rail (on by default), beside the column on the right or left. */
39
+ readonly rail?: boolean | "right" | "left";
40
+ /** Each step on a card of its own (off by default: steps sit on the page, hairlines between). */
41
+ readonly cards?: boolean;
42
+ /**
43
+ * The note bar: a small launcher in the column's corner that opens into the bar on a click, n,
44
+ * a recording or ink, and folds back when it's empty (`"collapsed"`, the default); the bar
45
+ * always there (`"docked"`); or none (`"hidden"`; `send()` still works).
46
+ */
47
+ readonly noteBar?: "collapsed" | "docked" | "hidden";
40
48
  /** Sending a note moves on to the next step (on by default). */
41
49
  readonly advance?: boolean;
42
50
  }