@kitlangton/knobs 0.4.0-next.7 → 0.4.0-next.8
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 +3 -1
- package/dist/types/ui/walkthrough-blocks.d.ts +15 -22
- package/dist/types/ui/walkthrough-model.d.ts +21 -2
- package/dist/ui-react.js +366 -133
- package/dist/ui-solid.js +366 -133
- package/dist/ui.js +367 -295
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1370,7 +1370,7 @@ Media is a bare URL (a video or picture), or `compare`, `video`, `image`, `diff`
|
|
|
1370
1370
|
"more": "A mock provider answers 410 Gone.\n\n**Pick another model** opens the picker." }
|
|
1371
1371
|
```
|
|
1372
1372
|
|
|
1373
|
-
**Pull requests** read as
|
|
1373
|
+
**Pull requests and issues** read as capsules: their state's icon (merge, pull request, draft, closed; a circle-dot for an issue) and number in a quiet tint of the state (open green, merged violet, draft and closed faint, unknown neutral), a faint check where its checks pass, the title and state on hover. Every ref becomes one: a section's PR `link` on the meta line ("PR 3 of 9 · ⟨#57158⟩"), and in titles, captions, summaries, `more` and table cells, a link to a pull request or issue whose words are its number, inline code that's just a ref, and a bare `#57148` (`issue:#123` for an issue). The state comes from the doc's `prs` by number (`{ "57148": { state: "merged", title: "…" } }`, `kind: "issue"` for an issue), else a `stack` on the page (an item's title and the first word of its `status`), else the section whose `link` is that PR. A ref needs no `repo` to be a chip; `repo: "owner/name"` only links the ones whose text has no URL. So a caption needn't spell out "#57158 (Draft · Green)".
|
|
1374
1374
|
|
|
1375
1375
|
**The feed** (`updates` and `qa`, newest first) is a calm list a group's room apart, a hairline between items and no boxes: a meta line (when · the step's PR, and `status` with review on), the question in text colour (or the update), its answer in dim prose, and its `trail` (what Kit did before asking, `"0:04 · Played the compare"`) folded under a small faint **Context** toggle whose height springs open on the state spring (.3 s) while the lines fade in place under a soft bottom edge. `status: "shipped"` reads Shipped, `"changes"` reads Changes queued.
|
|
1376
1376
|
|
|
@@ -1416,6 +1416,8 @@ The demo is `examples/walkthrough.html`.
|
|
|
1416
1416
|
|
|
1417
1417
|
**`annotations`** on an `image`, a `video` or a `compare` draw the eye to what matters: `[{ x, y, w?, h?, label?, at?: [start, end], shape?: "box" | "dot" | "arrow" }]`, in 0–1 of the picture (a box's top-left, or the point). A box takes a calm ring, a point a dot (or an arrow pointing at it), each with a small label; on a video or compare one shows only between its `at` seconds, fading in and out with a small blur. On a compare they're drawn on both sides and stay on their spot through a zoom. They're on by default; the eye button on the picture, or `a`, hides or shows every one on the page.
|
|
1418
1418
|
|
|
1419
|
+
A **`video`** plays in **`player()`**, the same look as a compare: the picture, then one thin line under it to seek on, its chapters as segments.
|
|
1420
|
+
|
|
1419
1421
|
**`chapters`** on a `video` (or a `compare`): a readout list under it, a row each (number · label · start). A click selects the chapter at once while the media seeks there and plays, and goes in the note's log; the selection pill slides to the chapter playing (the last that started at or before the playhead) and fades out in place outside them, and a note's `media` names it (`chapter`). A chapter ends at `end`, else `start + duration`, else the next one's start. On a compare they're also its timeline's markers. A video's `captions` (or `captionsSrc`) is a WebVTT URL, shown by default.
|
|
1420
1422
|
|
|
1421
1423
|
```json
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ContextEvent, type WalkChapter, type WalkMedia } from "./walkthrough-model.js";
|
|
1
|
+
import { type ContextEvent, type WalkChapter, type WalkMedia, prStatus, type PRState } from "./walkthrough-model.js";
|
|
2
2
|
/** The glyphs the blocks draw. */
|
|
3
3
|
export declare const GLYPH: {
|
|
4
4
|
caret: string;
|
|
@@ -61,34 +61,27 @@ export declare function disclosure(host: HTMLElement, options: {
|
|
|
61
61
|
open?: boolean;
|
|
62
62
|
content: HTMLElement;
|
|
63
63
|
}): Disclosure;
|
|
64
|
-
|
|
65
|
-
readonly merged: "Merged";
|
|
66
|
-
readonly open: "Open";
|
|
67
|
-
readonly draft: "Draft";
|
|
68
|
-
readonly closed: "Closed";
|
|
69
|
-
};
|
|
70
|
-
export type PRState = keyof typeof PR_STATE;
|
|
71
|
-
/**
|
|
72
|
-
* A stack row's pull-request state from its `status` words: the first word when it's merged,
|
|
73
|
-
* draft, open or closed (any case), and whether they say its checks pass ("green", "passing",
|
|
74
|
-
* "CI"). The state comes from the words, never the tone.
|
|
75
|
-
*/
|
|
76
|
-
export declare function prStatus(status: string | undefined): {
|
|
77
|
-
state: PRState | null;
|
|
78
|
-
checks: boolean;
|
|
79
|
-
};
|
|
64
|
+
export { prStatus, type PRState };
|
|
80
65
|
/** A pull request's state as GitHub shows it: its glyph and word, quietly tinted; a check after. */
|
|
81
66
|
export declare function prStateLabel(doc: Document, state: PRState, checks: boolean, title?: string): HTMLSpanElement;
|
|
82
67
|
export interface PRInfo {
|
|
83
68
|
readonly state?: PRState;
|
|
69
|
+
readonly kind?: "pr" | "issue";
|
|
70
|
+
readonly checks?: boolean;
|
|
84
71
|
readonly title?: string;
|
|
85
72
|
readonly href?: string;
|
|
86
73
|
}
|
|
87
|
-
/**
|
|
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
|
+
*/
|
|
88
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;
|
|
89
81
|
/**
|
|
90
|
-
* Turns
|
|
91
|
-
* number or URL,
|
|
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.
|
|
92
86
|
*/
|
|
93
|
-
export declare function linkPRs(root: HTMLElement, find:
|
|
94
|
-
export {};
|
|
87
|
+
export declare function linkPRs(root: HTMLElement, find: FindPR): void;
|
|
@@ -352,6 +352,10 @@ export interface WalkthroughDoc {
|
|
|
352
352
|
}
|
|
353
353
|
export interface WalkthroughPR {
|
|
354
354
|
readonly state?: "merged" | "open" | "draft" | "closed";
|
|
355
|
+
/** An issue rather than a pull request (`issue:` refs and `/issues/` links are). */
|
|
356
|
+
readonly kind?: "pr" | "issue";
|
|
357
|
+
/** Its checks pass (a stack item's status saying green, passing or CI). */
|
|
358
|
+
readonly checks?: boolean;
|
|
355
359
|
readonly title?: string;
|
|
356
360
|
/** Its URL, when neither `repo` nor a link on the page gives it. */
|
|
357
361
|
readonly href?: string;
|
|
@@ -580,8 +584,23 @@ export declare function linkLabel(href: string): string;
|
|
|
580
584
|
export declare function normalizeWalkthrough(doc: WalkthroughDoc): WalkPage;
|
|
581
585
|
/** The number in a pull request's URL (`…/pull/57148`), or null. */
|
|
582
586
|
export declare const prNumber: (href: string) => string | null;
|
|
583
|
-
|
|
584
|
-
|
|
587
|
+
export type PRState = NonNullable<WalkthroughPR["state"]>;
|
|
588
|
+
/**
|
|
589
|
+
* A pull request's state from some status words: the first word when it's merged, draft, open or
|
|
590
|
+
* closed (any case; shipped and done read as merged), and whether they say its checks pass
|
|
591
|
+
* ("green", "passing", "CI"). The state comes from the words, never a tone.
|
|
592
|
+
*/
|
|
593
|
+
export declare function prStatus(status: string | undefined): {
|
|
594
|
+
state: PRState | null;
|
|
595
|
+
checks: boolean;
|
|
596
|
+
};
|
|
597
|
+
/**
|
|
598
|
+
* A pull request (or an issue) by number: what the page knows, or (with a repo) its URL; null
|
|
599
|
+
* when it knows nothing. An issue takes only what `prs` says of it as an issue.
|
|
600
|
+
*/
|
|
601
|
+
export declare function findPR(prs: Readonly<Record<string, WalkthroughPR>>, n: string, repo?: string, kind?: "pr" | "issue"): WalkthroughPR | null;
|
|
602
|
+
/** The number in an issue's URL (`…/issues/123`), or null. */
|
|
603
|
+
export declare const issueNumber: (href: string) => string | null;
|
|
585
604
|
/** Whether a link is a pull (or merge) request: GitHub's `/pull/123`, GitLab's merge requests. */
|
|
586
605
|
export declare const isPullRequest: (href: string) => boolean;
|
|
587
606
|
/**
|