@kitlangton/knobs 0.4.0-next.0 → 0.4.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +451 -54
- package/dist/dev/{chunk-7xgkerd2.js → chunk-3ygqgy1x.js} +23 -1
- package/dist/dev/{chunk-stbcgz1y.js → chunk-5pb7ymrd.js} +567 -471
- package/dist/dev/{chunk-t68smqkc.js → chunk-a7cjgy8x.js} +13 -11
- package/dist/dev/{chunk-pmkvb9ep.js → chunk-dyq4m24m.js} +2081 -507
- package/dist/dev/index.js +10 -5
- package/dist/index.js +25 -1
- package/dist/panel.js +3187 -1341
- package/dist/react.js +294 -6
- package/dist/review-react.js +18580 -0
- package/dist/review-solid.js +18482 -0
- package/dist/review.js +18488 -0
- package/dist/solid.js +292 -4
- package/dist/themes.js +1767 -7
- package/dist/types/core/adapter.d.ts +6 -2
- package/dist/types/core/appearance.d.ts +44 -0
- package/dist/types/core/glide.d.ts +7 -0
- package/dist/types/core/motion.d.ts +66 -0
- package/dist/types/core/root.d.ts +13 -0
- package/dist/types/core/store.d.ts +18 -5
- package/dist/types/core/theme.d.ts +10 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/panel/gpu/color.d.ts +6 -0
- package/dist/types/panel/motion.d.ts +1 -1
- package/dist/types/panel/styles.d.ts +2 -3
- package/dist/types/review/font.d.ts +13 -0
- package/dist/types/review/foundations.d.ts +175 -0
- package/dist/types/review/index.d.ts +13 -0
- package/dist/types/review/react.d.ts +1 -0
- package/dist/types/review/solid.d.ts +1 -0
- package/dist/types/themes/define.d.ts +104 -0
- package/dist/types/themes/index.d.ts +16 -0
- package/dist/types/themes/knobs.d.ts +5 -0
- package/dist/types/themes/review.d.ts +8 -0
- package/dist/types/themes/void.d.ts +8 -0
- package/dist/types/tokens/color.d.ts +42 -0
- package/dist/types/tokens/css.d.ts +13 -0
- package/dist/types/tokens/evaluate.d.ts +8 -0
- package/dist/types/tokens/index.d.ts +4 -0
- package/dist/types/tokens/schema.d.ts +1280 -0
- package/dist/types/ui/bento-css.d.ts +1 -1
- package/dist/types/ui/compare-css.d.ts +1 -1
- package/dist/types/ui/compare-gpu.d.ts +6 -6
- package/dist/types/ui/compare-model.d.ts +85 -2
- package/dist/types/ui/compare.d.ts +18 -4
- package/dist/types/ui/diff.d.ts +4 -5
- package/dist/types/ui/history-css.d.ts +1 -0
- package/dist/types/ui/history-model.d.ts +249 -0
- package/dist/types/ui/history.d.ts +38 -0
- package/dist/types/ui/icons.d.ts +40 -0
- package/dist/types/ui/index.d.ts +9 -5
- package/dist/types/ui/look.d.ts +18 -13
- package/dist/types/ui/overlay-css.d.ts +1 -1
- package/dist/types/ui/player-css.d.ts +1 -0
- package/dist/types/ui/player.d.ts +51 -0
- package/dist/types/ui/readout-css.d.ts +1 -1
- package/dist/types/ui/readout-model.d.ts +5 -1
- package/dist/types/ui/review-look.d.ts +6 -0
- package/dist/types/ui/review-options.d.ts +28 -0
- package/dist/types/ui/rgba.d.ts +11 -0
- package/dist/types/ui/selection-pill-css.d.ts +1 -0
- package/dist/types/ui/selection-pill.d.ts +106 -0
- package/dist/types/ui/timeline-model.d.ts +27 -0
- package/dist/types/ui/timeline.d.ts +16 -1
- package/dist/types/ui/tree.d.ts +3 -2
- package/dist/types/ui/walkthrough-annotations.d.ts +42 -0
- package/dist/types/ui/walkthrough-blocks.d.ts +87 -0
- package/dist/types/ui/walkthrough-media.d.ts +30 -1
- package/dist/types/ui/walkthrough-model.d.ts +469 -5
- package/dist/types/ui/walkthrough.d.ts +27 -5
- package/dist/ui-react.js +8087 -2350
- package/dist/ui-solid.js +8100 -2363
- package/dist/ui.js +9751 -3963
- package/package.json +13 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ContextEvent, type WalkChapter, type WalkMedia, prStatus, type PRState } from "./walkthrough-model.js";
|
|
2
|
+
/** The glyphs the blocks draw. */
|
|
3
|
+
export declare const GLYPH: {
|
|
4
|
+
caret: string;
|
|
5
|
+
};
|
|
6
|
+
/** How media reach the page's steps: `step` on a history event, a stack item or a table cell. */
|
|
7
|
+
export interface StepLinks {
|
|
8
|
+
/** The step a ref names (its key, id or number), or null when there's none. */
|
|
9
|
+
find(ref: string): {
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly number: string;
|
|
12
|
+
readonly title: string;
|
|
13
|
+
} | null;
|
|
14
|
+
/** Goes to the step, as j / k do. */
|
|
15
|
+
go(key: string): void;
|
|
16
|
+
}
|
|
17
|
+
type OnEvent = ((event: Omit<ContextEvent, "at" | "step">) => void) | undefined;
|
|
18
|
+
export interface Block {
|
|
19
|
+
dispose(): void;
|
|
20
|
+
context?(): {
|
|
21
|
+
kind: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Makes a whole row go to the step a ref names (a click away from its links, Enter or Space when
|
|
26
|
+
* it has focus); nothing trails it, so rows with and without a step line up.
|
|
27
|
+
*/
|
|
28
|
+
export declare function rowLink(row: HTMLElement, ref: string | undefined, steps: StepLinks | undefined): void;
|
|
29
|
+
/** A history through `history()`: lanes of spans over a date axis, or the older groups of events. */
|
|
30
|
+
export declare function mountHistory(host: HTMLElement, m: Extract<WalkMedia, {
|
|
31
|
+
kind: "history";
|
|
32
|
+
}>, steps: StepLinks | undefined): Block;
|
|
33
|
+
export declare function mountStack(host: HTMLElement, m: Extract<WalkMedia, {
|
|
34
|
+
kind: "stack";
|
|
35
|
+
}>, steps: StepLinks | undefined, findPR?: (n: string) => PRInfo | null): Block;
|
|
36
|
+
export declare function mountTable(host: HTMLElement, m: Extract<WalkMedia, {
|
|
37
|
+
kind: "table";
|
|
38
|
+
}>, steps: StepLinks | undefined): Block;
|
|
39
|
+
export interface ChapterPills {
|
|
40
|
+
/** The chapter the time is in (call as it plays or seeks): the pill slides to it. */
|
|
41
|
+
sync(): void;
|
|
42
|
+
/** The chapter playing, or null. */
|
|
43
|
+
readonly current: WalkChapter | null;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function chapterPills(host: HTMLElement, chapters: readonly WalkChapter[], io: {
|
|
47
|
+
/** Seconds. */
|
|
48
|
+
now(): number;
|
|
49
|
+
/** Seeks and plays. */
|
|
50
|
+
seek(time: number): void;
|
|
51
|
+
onEvent: OnEvent;
|
|
52
|
+
}): ChapterPills;
|
|
53
|
+
export interface Disclosure {
|
|
54
|
+
readonly element: HTMLElement;
|
|
55
|
+
readonly open: boolean;
|
|
56
|
+
toggle(open?: boolean): void;
|
|
57
|
+
dispose(): void;
|
|
58
|
+
}
|
|
59
|
+
export declare function disclosure(host: HTMLElement, options: {
|
|
60
|
+
label: string;
|
|
61
|
+
open?: boolean;
|
|
62
|
+
content: HTMLElement;
|
|
63
|
+
}): Disclosure;
|
|
64
|
+
export { prStatus, type PRState };
|
|
65
|
+
/** A pull request's state as GitHub shows it: its glyph and word, quietly tinted; a check after. */
|
|
66
|
+
export declare function prStateLabel(doc: Document, state: PRState, checks: boolean, title?: string): HTMLSpanElement;
|
|
67
|
+
export interface PRInfo {
|
|
68
|
+
readonly state?: PRState;
|
|
69
|
+
readonly kind?: "pr" | "issue";
|
|
70
|
+
readonly checks?: boolean;
|
|
71
|
+
readonly title?: string;
|
|
72
|
+
readonly href?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A pull request (or an issue) as a capsule: its state's glyph and number, tinted quietly by state
|
|
76
|
+
* (neutral where none is known), a faint check where its checks pass, title and state on hover.
|
|
77
|
+
*/
|
|
78
|
+
export declare function prChip(doc: Document, n: string, pr: PRInfo): HTMLElement;
|
|
79
|
+
/** What the page knows of a pull request or issue by number (null when nothing). */
|
|
80
|
+
export type FindPR = (n: string, kind: "pr" | "issue") => PRInfo | null;
|
|
81
|
+
/**
|
|
82
|
+
* Turns every pull request and issue ref in some rendered prose into a capsule: links to one
|
|
83
|
+
* whose words are its number or URL, inline code that's just a ref, and bare `#57148`s
|
|
84
|
+
* (`issue:#123` for an issue). One the page knows nothing of is a neutral chip, linked only where
|
|
85
|
+
* the page has a repo.
|
|
86
|
+
*/
|
|
87
|
+
export declare function linkPRs(root: HTMLElement, find: FindPR): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type UiLook } from "./look.js";
|
|
2
|
+
import { type PRInfo, type StepLinks } from "./walkthrough-blocks.js";
|
|
2
3
|
import { type ContextEvent, type MediaContext, type WalkthroughMedia } from "./walkthrough-model.js";
|
|
3
4
|
export interface MediaSlotOptions extends UiLook {
|
|
4
5
|
readonly media: WalkthroughMedia;
|
|
@@ -6,7 +7,12 @@ export interface MediaSlotOptions extends UiLook {
|
|
|
6
7
|
readonly lazy?: boolean;
|
|
7
8
|
/** Kit played, paused or sought a video, or showed another diff file (for a note's log). */
|
|
8
9
|
readonly onEvent?: (event: Omit<ContextEvent, "at" | "step">) => void;
|
|
10
|
+
/** The page's steps, for `step` on a history event, a stack item or a table cell. */
|
|
11
|
+
readonly steps?: StepLinks;
|
|
12
|
+
/** What the page knows of a pull request by its number (a stack row's state and link). */
|
|
13
|
+
readonly findPR?: (n: string) => PRInfo | null;
|
|
9
14
|
}
|
|
15
|
+
export type { StepLinks };
|
|
10
16
|
export interface MediaSlot {
|
|
11
17
|
readonly element: HTMLElement;
|
|
12
18
|
/** Whether its content is mounted (heavy kinds wait until they're near the view). */
|
|
@@ -25,5 +31,28 @@ export interface MediaSlot {
|
|
|
25
31
|
}
|
|
26
32
|
/** Adds the walkthrough's stylesheet once per document. */
|
|
27
33
|
export declare function injectWalkthroughStyles(doc: Document): void;
|
|
28
|
-
export declare function mediaSlot(container: HTMLElement,
|
|
34
|
+
export declare function mediaSlot(container: HTMLElement, given: MediaSlotOptions): MediaSlot;
|
|
29
35
|
export declare const CHECK: string;
|
|
36
|
+
type FactsMedia = Extract<WalkthroughMedia, {
|
|
37
|
+
kind: "facts";
|
|
38
|
+
}>;
|
|
39
|
+
type DecisionMedia = Extract<WalkthroughMedia, {
|
|
40
|
+
kind: "decision";
|
|
41
|
+
}>;
|
|
42
|
+
export interface FactsOptions extends UiLook, Omit<FactsMedia, "kind"> {
|
|
43
|
+
}
|
|
44
|
+
export interface DecisionOptions extends UiLook, Omit<DecisionMedia, "kind">, Pick<MediaSlotOptions, "lazy" | "steps" | "onEvent"> {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Term → value pairs in an aligned grid: terms small and faint in a fixed gutter, values beside
|
|
48
|
+
* them, code and evidence as small mono chips; groups under a heading, hairlines between. Each
|
|
49
|
+
* term sits over its value where it's narrow. Also a walkthrough's `{ kind: "facts" }`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function facts(container: HTMLElement, options: FactsOptions): MediaSlot;
|
|
52
|
+
/**
|
|
53
|
+
* N ways to go, one recommended: each a title, a sentence, optional media and what changes as
|
|
54
|
+
* facts, side by side where there's room (whole rows only), hairlines between, the recommended one
|
|
55
|
+
* marked by a quiet word. Also a walkthrough's `{ kind: "decision" }`; a step's `options` (Kit
|
|
56
|
+
* picks) look the same.
|
|
57
|
+
*/
|
|
58
|
+
export declare function decision(container: HTMLElement, options: DecisionOptions): MediaSlot;
|