@sdxc/ui 2026.11.10 → 2026.11.14
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 +92 -45
- package/dist/app/app-shell-toggle.d.ts +2 -0
- package/dist/app/app-shell-toggle.js +5 -2
- package/dist/app/app-shell.d.ts +25 -1
- package/dist/app/app-shell.js +73 -38
- package/dist/app/auto-refresh.d.ts +2 -0
- package/dist/app/auto-refresh.js +3 -3
- package/dist/app/behaviors/refresh-schedule.d.ts +8 -3
- package/dist/app/behaviors/refresh-schedule.js +4 -3
- package/dist/app/board.d.ts +123 -0
- package/dist/app/board.js +224 -0
- package/dist/app/chart.d.ts +2 -2
- package/dist/app/chart.js +7 -3
- package/dist/app/check-runs.d.ts +116 -0
- package/dist/app/check-runs.js +201 -0
- package/dist/app/code-view.d.ts +172 -0
- package/dist/app/code-view.js +414 -0
- package/dist/app/command-palette.d.ts +38 -3
- package/dist/app/command-palette.js +53 -5
- package/dist/app/contribution-graph.d.ts +106 -0
- package/dist/app/contribution-graph.js +289 -0
- package/dist/app/detail-sheet.d.ts +7 -0
- package/dist/app/detail-sheet.js +7 -7
- package/dist/app/diff.d.ts +200 -0
- package/dist/app/diff.js +702 -0
- package/dist/app/filter-bar.d.ts +20 -0
- package/dist/app/filter-bar.js +35 -15
- package/dist/app/filter-menu.d.ts +144 -0
- package/dist/app/filter-menu.js +480 -0
- package/dist/app/gantt.d.ts +108 -0
- package/dist/app/gantt.js +420 -0
- package/dist/app/index.d.ts +19 -0
- package/dist/app/index.js +19 -0
- package/dist/app/log-viewer.d.ts +120 -0
- package/dist/app/log-viewer.js +384 -0
- package/dist/app/merge-box.d.ts +97 -0
- package/dist/app/merge-box.js +227 -0
- package/dist/app/mixins/app-shell-controls.d.ts +4 -1
- package/dist/app/mixins/app-shell-controls.js +64 -4
- package/dist/app/mixins/auto-refresh.d.ts +5 -2
- package/dist/app/mixins/auto-refresh.js +9 -3
- package/dist/app/mixins/close-popover-on-submit.d.ts +16 -0
- package/dist/app/mixins/close-popover-on-submit.js +32 -0
- package/dist/app/mixins/code-view-selection.d.ts +60 -0
- package/dist/app/mixins/code-view-selection.js +276 -0
- package/dist/app/mixins/command-palette.d.ts +15 -4
- package/dist/app/mixins/command-palette.js +94 -6
- package/dist/app/mixins/contribution-graph-keys.d.ts +19 -0
- package/dist/app/mixins/contribution-graph-keys.js +155 -0
- package/dist/app/mixins/diff-interactions.d.ts +72 -0
- package/dist/app/mixins/diff-interactions.js +269 -0
- package/dist/app/mixins/filter-menu-keys.d.ts +41 -0
- package/dist/app/mixins/filter-menu-keys.js +91 -0
- package/dist/app/mixins/gantt-today.d.ts +17 -0
- package/dist/app/mixins/gantt-today.js +50 -0
- package/dist/app/mixins/log-viewer.d.ts +29 -0
- package/dist/app/mixins/log-viewer.js +333 -0
- package/dist/app/mixins/optimistic-toggle-sync.d.ts +5 -0
- package/dist/app/mixins/optimistic-toggle-sync.js +25 -1
- package/dist/app/mixins/save-bar-sync.d.ts +7 -1
- package/dist/app/mixins/save-bar-sync.js +23 -4
- package/dist/app/mixins/save-status-sync.js +23 -1
- package/dist/app/mixins/split-view.js +1 -1
- package/dist/app/mixins/submit-on-close.d.ts +17 -0
- package/dist/app/mixins/submit-on-close.js +52 -0
- package/dist/app/mixins/tree-filter.d.ts +44 -0
- package/dist/app/mixins/tree-filter.js +111 -0
- package/dist/app/mixins/tree-navigation.d.ts +50 -0
- package/dist/app/mixins/tree-navigation.js +216 -0
- package/dist/app/optimistic-toggle.d.ts +8 -0
- package/dist/app/optimistic-toggle.js +3 -2
- package/dist/app/page-header.d.ts +18 -3
- package/dist/app/page-header.js +105 -50
- package/dist/app/review-thread.d.ts +115 -0
- package/dist/app/review-thread.js +116 -0
- package/dist/app/save-bar.d.ts +5 -0
- package/dist/app/save-bar.js +1 -1
- package/dist/app/settings-layout.d.ts +5 -0
- package/dist/app/settings-layout.js +5 -5
- package/dist/app/skeleton.d.ts +9 -0
- package/dist/app/skeleton.js +28 -0
- package/dist/app/split-view.d.ts +4 -0
- package/dist/app/split-view.js +3 -3
- package/dist/app/styles/code-tokens.d.ts +24 -0
- package/dist/app/styles/code-tokens.js +47 -0
- package/dist/app/tab-bar.d.ts +59 -0
- package/dist/app/tab-bar.js +111 -0
- package/dist/app/tree.d.ts +111 -14
- package/dist/app/tree.js +202 -15
- package/dist/app/utils/ansi.d.ts +55 -0
- package/dist/app/utils/ansi.js +157 -0
- package/dist/app/utils/diff-rows.d.ts +82 -0
- package/dist/app/utils/diff-rows.js +209 -0
- package/dist/app/utils/fuzzy-path.d.ts +58 -0
- package/dist/app/utils/fuzzy-path.js +202 -0
- package/dist/app/utils/line-range.d.ts +48 -0
- package/dist/app/utils/line-range.js +61 -0
- package/dist/app/utils/log-lines.d.ts +107 -0
- package/dist/app/utils/log-lines.js +170 -0
- package/dist/app/utils/tree-filter.d.ts +19 -0
- package/dist/app/utils/tree-filter.js +26 -0
- package/dist/app/view-options.d.ts +2 -0
- package/dist/app/view-options.js +2 -2
- package/dist/chat/activity.d.ts +72 -0
- package/dist/chat/activity.js +184 -0
- package/dist/chat/composer-submit.d.ts +38 -0
- package/dist/chat/composer-submit.js +44 -0
- package/dist/chat/composer.d.ts +47 -0
- package/dist/chat/composer.js +100 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/index.js +6 -0
- package/dist/chat/mixins/composer-send.d.ts +32 -0
- package/dist/chat/mixins/composer-send.js +121 -0
- package/dist/chat/mixins/reveal-stream.d.ts +68 -0
- package/dist/chat/mixins/reveal-stream.js +184 -0
- package/dist/chat/mixins/stream-target.d.ts +18 -0
- package/dist/chat/mixins/stream-target.js +38 -0
- package/dist/components/button.js +7 -1
- package/dist/components/character-count.d.ts +44 -0
- package/dist/components/character-count.js +68 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/label-chip.d.ts +42 -0
- package/dist/components/label-chip.js +86 -0
- package/dist/components/property-list.d.ts +9 -2
- package/dist/components/property-list.js +11 -6
- package/dist/components/textarea.js +6 -1
- package/dist/components/timeline.d.ts +62 -5
- package/dist/components/timeline.js +124 -5
- package/dist/docs/code-block.js +8 -31
- package/dist/docs/file-tree.js +3 -48
- package/dist/landing/case-study.d.ts +79 -0
- package/dist/landing/case-study.js +162 -0
- package/dist/landing/contributor-wall.d.ts +72 -0
- package/dist/landing/contributor-wall.js +129 -0
- package/dist/landing/countdown.d.ts +88 -0
- package/dist/landing/countdown.js +91 -0
- package/dist/landing/episode-player.d.ts +87 -0
- package/dist/landing/episode-player.js +113 -0
- package/dist/landing/faq-band.d.ts +3 -2
- package/dist/landing/faq-band.js +4 -3
- package/dist/landing/feature-band.d.ts +8 -0
- package/dist/landing/feature-band.js +9 -3
- package/dist/landing/index.d.ts +9 -0
- package/dist/landing/index.js +9 -0
- package/dist/landing/landing-header.js +15 -4
- package/dist/landing/mixins/countdown-tick.d.ts +29 -0
- package/dist/landing/mixins/countdown-tick.js +65 -0
- package/dist/landing/mixins/usage-estimate-live.d.ts +32 -0
- package/dist/landing/mixins/usage-estimate-live.js +120 -0
- package/dist/landing/phone-fan.d.ts +38 -0
- package/dist/landing/phone-fan.js +89 -0
- package/dist/landing/phone-frame.d.ts +48 -0
- package/dist/landing/phone-frame.js +41 -0
- package/dist/landing/price-list.d.ts +68 -0
- package/dist/landing/price-list.js +125 -0
- package/dist/landing/scroll-scene.d.ts +59 -0
- package/dist/landing/scroll-scene.js +70 -0
- package/dist/landing/sponsor-wall.d.ts +30 -6
- package/dist/landing/sponsor-wall.js +70 -14
- package/dist/landing/typed-terminal.d.ts +24 -6
- package/dist/landing/typed-terminal.js +22 -14
- package/dist/landing/usage-estimate.d.ts +127 -0
- package/dist/landing/usage-estimate.js +164 -0
- package/dist/landing/utils/countdown.d.ts +33 -0
- package/dist/landing/utils/countdown.js +42 -0
- package/dist/landing/utils/pause-toggle.d.ts +2 -1
- package/dist/mixins/character-count.d.ts +62 -0
- package/dist/mixins/character-count.js +139 -0
- package/dist/mixins/index.d.ts +6 -2
- package/dist/mixins/index.js +6 -2
- package/dist/mixins/invoker-fields.d.ts +18 -0
- package/dist/mixins/invoker-fields.js +60 -0
- package/dist/mixins/media-sync.d.ts +58 -0
- package/dist/mixins/media-sync.js +102 -0
- package/dist/mixins/menu-keys.d.ts +11 -0
- package/dist/mixins/menu-keys.js +79 -70
- package/dist/mixins/sortable.d.ts +96 -0
- package/dist/mixins/sortable.js +433 -0
- package/dist/utils/code-lines.d.ts +26 -0
- package/dist/utils/code-lines.js +29 -0
- package/dist/utils/file-icon.d.ts +31 -0
- package/dist/utils/file-icon.js +60 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/write-cookie.d.ts +15 -15
- package/dist/utils/write-cookie.js +10 -16
- package/dist/video/index.d.ts +11 -0
- package/dist/video/index.js +11 -0
- package/dist/video/mixins/video-player-sync.d.ts +27 -0
- package/dist/video/mixins/video-player-sync.js +413 -0
- package/dist/video/utils/timeline.d.ts +55 -0
- package/dist/video/utils/timeline.js +90 -0
- package/dist/video/video-player.d.ts +261 -0
- package/dist/video/video-player.js +927 -0
- package/package.json +6 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A CI job's log: one native `<details>` per step (the failed one open), numbered lines whose
|
|
3
|
+
* numbers are links painted from attributes so a copy skips them, `##[group]` folds, ANSI
|
|
4
|
+
* colours as toned spans, a live step that streams its lines, and an island for log search.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { EntryComponent, Handle, Props as TagProps } from "remix/component";
|
|
10
|
+
import type { LogViewerBehavior } from "./mixins/log-viewer.js";
|
|
11
|
+
import type { LogLine } from "./utils/log-lines.js";
|
|
12
|
+
export type { AnsiColor, AnsiLine, AnsiSpan, AnsiStyle } from "./utils/ansi.js";
|
|
13
|
+
export { parseAnsi, parseAnsiLine, stripAnsi } from "./utils/ansi.js";
|
|
14
|
+
export type { LogEntry, LogLine, LogNode, LogTone } from "./utils/log-lines.js";
|
|
15
|
+
export { buildLogTree, formatLogTime, readMarker, splitTimestamp } from "./utils/log-lines.js";
|
|
16
|
+
/**
|
|
17
|
+
* Types for {@link LogViewer} and its parts.
|
|
18
|
+
*/
|
|
19
|
+
export declare namespace LogViewer {
|
|
20
|
+
/** Where a step stands. */
|
|
21
|
+
type State = "success" | "failure" | "running" | "queued" | "skipped" | "cancelled";
|
|
22
|
+
/** One step of the job. */
|
|
23
|
+
interface Step {
|
|
24
|
+
/** The step's title in its `<summary>`, such as "Run tests". */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Picks the step's icon and opens a failed step by default. */
|
|
27
|
+
state: State;
|
|
28
|
+
/** How long it took, already formatted, e.g. "1m 12s". */
|
|
29
|
+
duration?: string;
|
|
30
|
+
/** The output so far; `##[group]` markers fold and ANSI codes become toned spans. */
|
|
31
|
+
lines: LogLine[];
|
|
32
|
+
/** Starts open; a failed step does by default and every other step starts closed. */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/** Makes the step live: its further lines stream from `src`, and `refresh` reloads the page. */
|
|
35
|
+
stream?: StreamSource;
|
|
36
|
+
}
|
|
37
|
+
/** Where a running step's further lines come from. */
|
|
38
|
+
interface StreamSource {
|
|
39
|
+
/**
|
|
40
|
+
* A URL answering the step's lines after those already drawn, as a streamed `text/plain`
|
|
41
|
+
* body of one line per `\n`; a line may start with an ISO timestamp and a space.
|
|
42
|
+
*/
|
|
43
|
+
src: string;
|
|
44
|
+
/** The page's own address, offered as a "Refresh" link while the stream is not running. */
|
|
45
|
+
refresh: string;
|
|
46
|
+
}
|
|
47
|
+
/** Every string the viewer shows or announces. */
|
|
48
|
+
interface Labels {
|
|
49
|
+
/** Names the scrolling log, e.g. "Job log". */
|
|
50
|
+
log: string;
|
|
51
|
+
/** Each state's accessible name, read for the step's icon: "Failed", "In progress"… */
|
|
52
|
+
states: Record<State, string>;
|
|
53
|
+
/** The search field's label, e.g. "Search logs". */
|
|
54
|
+
search: string;
|
|
55
|
+
/** The match counter, with `{index}` and `{count}` replaced, e.g. "{index} of {count}". */
|
|
56
|
+
matches: string;
|
|
57
|
+
/** Shown in place of the counter when nothing matches, e.g. "No results". */
|
|
58
|
+
noMatches: string;
|
|
59
|
+
/** The search's step-back button name, e.g. "Previous match". */
|
|
60
|
+
previousMatch: string;
|
|
61
|
+
/** The search's step-forward button name, e.g. "Next match". */
|
|
62
|
+
nextMatch: string;
|
|
63
|
+
/** The toggle's text while timestamps are hidden, e.g. "Show timestamps". */
|
|
64
|
+
showTimestamps: string;
|
|
65
|
+
/** The toggle's text while timestamps show, e.g. "Hide timestamps". */
|
|
66
|
+
hideTimestamps: string;
|
|
67
|
+
/** The pill shown when lines arrive below the view, e.g. "Jump to latest". */
|
|
68
|
+
jumpToLatest: string;
|
|
69
|
+
/** The no-script link that reloads a running job's log, e.g. "Refresh". */
|
|
70
|
+
refresh: string;
|
|
71
|
+
}
|
|
72
|
+
/** Props for {@link LogViewer}. */
|
|
73
|
+
interface Props extends Omit<TagProps<"section">, "children"> {
|
|
74
|
+
/** The job's steps in run order; each becomes one collapsible section. */
|
|
75
|
+
steps: Step[];
|
|
76
|
+
/** A line's link, e.g. `(step, n) => "#step:" + step + ":" + n`; its fragment becomes the line's id. */
|
|
77
|
+
lineHref: (step: number, n: number) => string;
|
|
78
|
+
/** Draws each line's time beside its number. */
|
|
79
|
+
timestamps?: boolean;
|
|
80
|
+
/** The page with timestamps toggled, e.g. `?ts=1`; omitted, the toggle is not drawn. */
|
|
81
|
+
timestampsHref?: string;
|
|
82
|
+
/** Every string the viewer shows or announces, so it reads in any language. */
|
|
83
|
+
labels: Labels;
|
|
84
|
+
}
|
|
85
|
+
/** Props for {@link LogViewer.Stream}. */
|
|
86
|
+
interface StreamProps {
|
|
87
|
+
/** The step's position in the job, from 1, as `lineHref` receives it. */
|
|
88
|
+
index: number;
|
|
89
|
+
/** The running step, with the stream its further lines come from. */
|
|
90
|
+
step: Step & {
|
|
91
|
+
stream: StreamSource;
|
|
92
|
+
};
|
|
93
|
+
/** The viewer's `lineHref`, so streamed lines link like drawn ones. */
|
|
94
|
+
lineHref: (step: number, n: number) => string;
|
|
95
|
+
/** The viewer's strings. */
|
|
96
|
+
labels: Labels;
|
|
97
|
+
}
|
|
98
|
+
/** Props for {@link LogViewerController}; plain data, since they cross into the browser. */
|
|
99
|
+
type ControllerProps = LogViewerBehavior.Options;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Every line is in the page from the start, so find-in-page and line links work without script;
|
|
103
|
+
* mapping `@sdxc/ui/app/log-viewer` runs {@link LogViewerController} for search, streaming and
|
|
104
|
+
* tail-follow. Set `--ui-log-viewer-height` for the scroll box, `--ui-log-chunk-lines` per chunk.
|
|
105
|
+
*
|
|
106
|
+
* @param handle Runtime handle carrying the viewer's props.
|
|
107
|
+
* @returns The render function producing the viewer.
|
|
108
|
+
* @example
|
|
109
|
+
* <LogViewer steps={job.steps} lineHref={(step, n) => `#step:${step}:${n}`} timestamps={ts} timestampsHref={ts ? "?" : "?ts=1"} labels={labels} />
|
|
110
|
+
*/
|
|
111
|
+
export declare function LogViewer(handle: Handle<LogViewer.Props>): () => import("remix/component").RemixElement;
|
|
112
|
+
export declare namespace LogViewer {
|
|
113
|
+
var Stream: (handle: Handle<LogViewer.StreamProps>) => () => import("remix/component").RemixElement;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The viewer's island: renders nothing visible and wires the log it sits in once loaded, for
|
|
117
|
+
* search, streaming and following the tail. `LogViewer` places it; load
|
|
118
|
+
* `@sdxc/ui/app/log-viewer` in the browser entry.
|
|
119
|
+
*/
|
|
120
|
+
export declare const LogViewerController: EntryComponent<LogViewer.ControllerProps>;
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ArrowDownIcon, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, CircleCheckIcon, CircleDashedIcon, CircleSlashIcon, CircleStopIcon, CircleXIcon, LoaderCircleIcon, SearchIcon, } from "@sdxc/icons";
|
|
3
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
4
|
+
import { fg, outline } from "@sdxc/u/color";
|
|
5
|
+
import { mergeMix, raw } from "@sdxc/u/general";
|
|
6
|
+
import { motionSafe } from "@sdxc/u/responsive";
|
|
7
|
+
import { data, focusVisible, hover, when } from "@sdxc/u/state";
|
|
8
|
+
import { font, tabularNums, text, weight } from "@sdxc/u/typography";
|
|
9
|
+
import { attrs, clientEntry } from "remix/component";
|
|
10
|
+
import { spin } from "../animations/keyframes.js";
|
|
11
|
+
import { logViewerController } from "./mixins/log-viewer.js";
|
|
12
|
+
import { LOG_LINE_PLACEHOLDER, ansiAttributes, buildLogTree, chunkLogNodes, formatLogTime, } from "./utils/log-lines.js";
|
|
13
|
+
export { parseAnsi, parseAnsiLine, stripAnsi } from "./utils/ansi.js";
|
|
14
|
+
export { buildLogTree, formatLogTime, readMarker, splitTimestamp } from "./utils/log-lines.js";
|
|
15
|
+
/** Lines per chunk: each chunk is one box the browser skips painting while it is off screen. */
|
|
16
|
+
const CHUNK_LINES = 200;
|
|
17
|
+
/** The height one log line takes, which an off-screen chunk reserves per line. */
|
|
18
|
+
const LINE_HEIGHT = "1.25rem";
|
|
19
|
+
/** The number column's width. */
|
|
20
|
+
const GUTTER = "3.5rem";
|
|
21
|
+
/** The number and time columns' width together, with timestamps on. */
|
|
22
|
+
const GUTTER_WITH_TIME = "9rem";
|
|
23
|
+
/** The id a line takes: its link's fragment, so following the link scrolls to and paints it. */
|
|
24
|
+
function idFromHref(href) {
|
|
25
|
+
let hash = href.indexOf("#");
|
|
26
|
+
return hash === -1 ? undefined : decodeURIComponent(href.slice(hash + 1));
|
|
27
|
+
}
|
|
28
|
+
/** Whether a span carries any style, so a plain one renders as a bare text node. */
|
|
29
|
+
function isStyled(span) {
|
|
30
|
+
return Object.keys(span).length > 1;
|
|
31
|
+
}
|
|
32
|
+
/** The colours and weights of ANSI spans and line tones, set once on the viewer for every line. */
|
|
33
|
+
function logStyles() {
|
|
34
|
+
let tone = (name) => `var(--ui-${name}-fg)`;
|
|
35
|
+
let tint = (name, amount) => `color-mix(in oklab, var(--ui-${name}-fg) ${amount}%, transparent)`;
|
|
36
|
+
return raw({
|
|
37
|
+
"& [data-fg=red]": { color: tone("danger") },
|
|
38
|
+
"& [data-fg=green]": { color: tone("success") },
|
|
39
|
+
"& [data-fg=yellow]": { color: tone("warning") },
|
|
40
|
+
"& :is([data-fg=blue], [data-fg=cyan], [data-fg=magenta])": { color: tone("brand") },
|
|
41
|
+
"& [data-fg=black]": { color: "var(--ui-neutral-fg-muted, GrayText)" },
|
|
42
|
+
"& [data-fg=white]": { color: "var(--ui-neutral-fg-emphasis, CanvasText)" },
|
|
43
|
+
"& [data-bg=red]": { backgroundColor: tint("danger", 25) },
|
|
44
|
+
"& [data-bg=green]": { backgroundColor: tint("success", 25) },
|
|
45
|
+
"& [data-bg=yellow]": { backgroundColor: tint("warning", 25) },
|
|
46
|
+
"& :is([data-bg=blue], [data-bg=cyan], [data-bg=magenta])": {
|
|
47
|
+
backgroundColor: tint("brand", 25),
|
|
48
|
+
},
|
|
49
|
+
"& :is([data-bg=black], [data-bg=white])": { backgroundColor: tint("neutral", 20) },
|
|
50
|
+
"& [data-b]": { fontWeight: "600" },
|
|
51
|
+
"& [data-dim]": { opacity: "0.7" },
|
|
52
|
+
"& [data-i]": { fontStyle: "italic" },
|
|
53
|
+
"& [data-u]": { textDecoration: "underline" },
|
|
54
|
+
"& [data-log-line][data-tone=danger]": {
|
|
55
|
+
color: tone("danger"),
|
|
56
|
+
backgroundColor: tint("danger", 10),
|
|
57
|
+
},
|
|
58
|
+
"& [data-log-line][data-tone=warning]": {
|
|
59
|
+
color: tone("warning"),
|
|
60
|
+
backgroundColor: tint("warning", 10),
|
|
61
|
+
},
|
|
62
|
+
"& [data-log-line][data-tone=notice]": { color: tone("brand") },
|
|
63
|
+
"& [data-log-line][data-tone=command]": { color: tone("brand") },
|
|
64
|
+
"& [data-log-line][data-tone=muted]": { opacity: "0.7" },
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** The layout of every line: a hanging gutter for the painted number and time, then the text. */
|
|
68
|
+
function lineStyles() {
|
|
69
|
+
return raw({
|
|
70
|
+
"& [data-log-line]": {
|
|
71
|
+
display: "block",
|
|
72
|
+
minBlockSize: LINE_HEIGHT,
|
|
73
|
+
paddingInlineStart: "var(--ui-log-gutter)",
|
|
74
|
+
paddingInlineEnd: "1rem",
|
|
75
|
+
whiteSpace: "pre-wrap",
|
|
76
|
+
overflowWrap: "anywhere",
|
|
77
|
+
tabSize: "4",
|
|
78
|
+
},
|
|
79
|
+
"& [data-log-line]:hover": {
|
|
80
|
+
backgroundColor: "color-mix(in oklab, var(--ui-neutral-fg) 6%, transparent)",
|
|
81
|
+
},
|
|
82
|
+
"& [data-log-line]:target, & [data-log-line][data-log-current]": {
|
|
83
|
+
backgroundColor: "color-mix(in oklab, var(--ui-warning-fg) 16%, transparent)",
|
|
84
|
+
boxShadow: "inset 2px 0 0 var(--ui-warning-fg)",
|
|
85
|
+
},
|
|
86
|
+
"& [data-log-line] > a:first-child": {
|
|
87
|
+
display: "inline-grid",
|
|
88
|
+
gridAutoFlow: "column",
|
|
89
|
+
gridTemplateColumns: `${GUTTER} 1fr`,
|
|
90
|
+
inlineSize: "var(--ui-log-gutter)",
|
|
91
|
+
marginInlineStart: "calc(-1 * var(--ui-log-gutter))",
|
|
92
|
+
verticalAlign: "top",
|
|
93
|
+
color: "var(--ui-neutral-fg-muted, GrayText)",
|
|
94
|
+
textDecoration: "none",
|
|
95
|
+
userSelect: "none",
|
|
96
|
+
fontVariantNumeric: "tabular-nums",
|
|
97
|
+
},
|
|
98
|
+
"& [data-log-line] > a:first-child::before": {
|
|
99
|
+
content: "attr(data-n)",
|
|
100
|
+
textAlign: "end",
|
|
101
|
+
paddingInlineEnd: "1rem",
|
|
102
|
+
},
|
|
103
|
+
"& [data-log-line] > a:first-child:hover": { color: "var(--ui-neutral-fg-emphasis)" },
|
|
104
|
+
"&[data-timestamps] [data-log-line] > a:first-child::after": {
|
|
105
|
+
content: "attr(data-ts)",
|
|
106
|
+
paddingInlineEnd: "1rem",
|
|
107
|
+
},
|
|
108
|
+
"& [data-log-chunk]": {
|
|
109
|
+
contentVisibility: "auto",
|
|
110
|
+
containIntrinsicBlockSize: `auto calc(var(--ui-log-chunk-lines, ${CHUNK_LINES}) * ${LINE_HEIGHT})`,
|
|
111
|
+
},
|
|
112
|
+
"& [data-log-group] > summary": { listStyle: "none", cursor: "pointer" },
|
|
113
|
+
"& [data-log-group] > summary::-webkit-details-marker": { display: "none" },
|
|
114
|
+
"& [data-log-group-title]::before": { content: '"▸ "', color: "var(--ui-neutral-fg-muted)" },
|
|
115
|
+
"& [data-log-group][open] > summary [data-log-group-title]::before": { content: '"▾ "' },
|
|
116
|
+
"& [data-log-group-body]": { paddingInlineStart: "1rem" },
|
|
117
|
+
"& *::highlight(ui-log-match)": {
|
|
118
|
+
backgroundColor: "color-mix(in oklab, var(--ui-warning-fg) 35%, transparent)",
|
|
119
|
+
},
|
|
120
|
+
"& *::highlight(ui-log-current)": {
|
|
121
|
+
backgroundColor: "var(--ui-warning-fg)",
|
|
122
|
+
color: "var(--ui-bg, Canvas)",
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Draws sibling nodes as chunks of about {@link CHUNK_LINES} lines. Each line is one element
|
|
128
|
+
* holding an empty link and its text, so a plain line costs three nodes in a 20,000-line log.
|
|
129
|
+
*/
|
|
130
|
+
function LogNodes(handle) {
|
|
131
|
+
return () => {
|
|
132
|
+
let { nodes, href } = handle.props;
|
|
133
|
+
return (_jsx(_Fragment, { children: chunkLogNodes(nodes, CHUNK_LINES).map((chunk) => (_jsx("div", { "data-log-chunk": true, style: `--ui-log-chunk-lines: ${chunk.reduce((sum, node) => sum + (node.kind === "group" ? node.lines : 1), 0)}`, children: chunk.map((node) => {
|
|
134
|
+
let link = href(node.entry.n);
|
|
135
|
+
let number = (_jsx("a", { href: link, "data-n": node.entry.n, "data-ts": node.entry.ts === undefined ? undefined : formatLogTime(node.entry.ts), tabindex: -1, "aria-hidden": "true" }));
|
|
136
|
+
let spans = node.entry.spans.map((span) => isStyled(span) ? _jsx("span", { ...ansiAttributes(span), children: span.text }) : span.text);
|
|
137
|
+
if (node.kind === "line") {
|
|
138
|
+
return (_jsxs("div", { "data-log-line": true, id: idFromHref(link), "data-tone": node.entry.tone, children: [number, spans] }));
|
|
139
|
+
}
|
|
140
|
+
return (_jsxs("details", { "data-log-group": true, open: node.hasError, children: [_jsxs("summary", { "data-log-line": true, id: idFromHref(link), "data-tone": node.entry.tone, children: [number, _jsx("span", { "data-log-group-title": true, children: spans })] }), _jsx("div", { "data-log-group-body": true, children: _jsx(LogNodes, { nodes: node.children, href: href }) })] }));
|
|
141
|
+
}) }))) }));
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/** The icon each state draws, toned by what it means. */
|
|
145
|
+
function StateIcon(handle) {
|
|
146
|
+
return () => {
|
|
147
|
+
let { state, label } = handle.props;
|
|
148
|
+
let size = 16;
|
|
149
|
+
let icon = (() => {
|
|
150
|
+
if (state === "success")
|
|
151
|
+
return _jsx(CircleCheckIcon, { size: size, "aria-hidden": "true" });
|
|
152
|
+
if (state === "failure")
|
|
153
|
+
return _jsx(CircleXIcon, { size: size, "aria-hidden": "true" });
|
|
154
|
+
if (state === "running") {
|
|
155
|
+
return _jsx(LoaderCircleIcon, { size: size, "aria-hidden": "true", mix: [spin()] });
|
|
156
|
+
}
|
|
157
|
+
if (state === "skipped")
|
|
158
|
+
return _jsx(CircleSlashIcon, { size: size, "aria-hidden": "true" });
|
|
159
|
+
if (state === "cancelled")
|
|
160
|
+
return _jsx(CircleStopIcon, { size: size, "aria-hidden": "true" });
|
|
161
|
+
return _jsx(CircleDashedIcon, { size: size, "aria-hidden": "true" });
|
|
162
|
+
})();
|
|
163
|
+
return (_jsx("span", { role: "img", "aria-label": label, "data-state": state, mix: [
|
|
164
|
+
raw({ display: "inline-flex", flexShrink: "0" }),
|
|
165
|
+
fg("neutral.muted"),
|
|
166
|
+
data("state", "success", fg("success")),
|
|
167
|
+
data("state", "failure", fg("danger")),
|
|
168
|
+
data("state", "running", fg("warning")),
|
|
169
|
+
], children: icon }));
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* One step as a `<details>`: a summary row (chevron, state, name, duration) that sticks to the
|
|
174
|
+
* top of the log while the step is open, then its lines. A live step adds the container its
|
|
175
|
+
* streamed lines land in and the no-script Refresh link.
|
|
176
|
+
*/
|
|
177
|
+
function LogStep(handle) {
|
|
178
|
+
return () => {
|
|
179
|
+
let { index, step, lineHref, labels } = handle.props;
|
|
180
|
+
let open = step.open ?? (step.state === "failure" || step.stream !== undefined);
|
|
181
|
+
let nodes = buildLogTree(step.lines);
|
|
182
|
+
let last = step.lines.at(-1)?.n ?? 0;
|
|
183
|
+
let live = step.stream;
|
|
184
|
+
return (_jsxs("details", { "data-log-step": index, "data-state": step.state, open: open, ...(live
|
|
185
|
+
? {
|
|
186
|
+
"data-log-stream": live.src,
|
|
187
|
+
"data-log-next": String(last + 1),
|
|
188
|
+
"data-log-href": lineHref(index, LOG_LINE_PLACEHOLDER),
|
|
189
|
+
"data-stream-pending": "",
|
|
190
|
+
}
|
|
191
|
+
: {}), mix: [
|
|
192
|
+
raw({ borderBlockEnd: "1px solid var(--ui-neutral-border)" }),
|
|
193
|
+
when("&:last-child", raw({ borderBlockEnd: "none" })),
|
|
194
|
+
], children: [_jsxs("summary", { mix: [
|
|
195
|
+
raw({
|
|
196
|
+
display: "flex",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
gap: "0.5rem",
|
|
199
|
+
minBlockSize: "2.5rem",
|
|
200
|
+
paddingInline: "0.75rem",
|
|
201
|
+
listStyle: "none",
|
|
202
|
+
cursor: "pointer",
|
|
203
|
+
fontFamily: "var(--ui-font-sans, system-ui, sans-serif)",
|
|
204
|
+
"&::-webkit-details-marker": { display: "none" },
|
|
205
|
+
}),
|
|
206
|
+
text("sm"),
|
|
207
|
+
hover(raw({ backgroundColor: "var(--ui-neutral-bg-tint-hover)" })),
|
|
208
|
+
focusVisible(outline({ color: "brand.ring", offset: -2, width: 2 })),
|
|
209
|
+
when(":is(details[open]) > &", raw({
|
|
210
|
+
position: "sticky",
|
|
211
|
+
insetBlockStart: "0",
|
|
212
|
+
zIndex: "1",
|
|
213
|
+
backgroundColor: "var(--ui-log-viewer-surface, var(--ui-bg, Canvas))",
|
|
214
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
215
|
+
})),
|
|
216
|
+
when(":is(details[open]) > & [data-slot=log-step-chevron]", raw({ transform: "rotate(90deg)" })),
|
|
217
|
+
], children: [_jsx(ChevronRightIcon, { size: 14, "aria-hidden": "true", "data-slot": "log-step-chevron", mix: [
|
|
218
|
+
raw({ flexShrink: "0" }),
|
|
219
|
+
motionSafe(raw({ transition: "transform 150ms ease" })),
|
|
220
|
+
fg("neutral.muted"),
|
|
221
|
+
] }), _jsx(StateIcon, { state: step.state, label: labels.states[step.state] }), _jsx("span", { "data-slot": "log-step-name", mix: [raw({ flex: "1 1 auto", minInlineSize: "0" })], children: step.name }), step.duration ? (_jsx("span", { mix: [fg("neutral.muted"), text("xs"), tabularNums()], children: step.duration })) : null] }), _jsxs("div", { "data-slot": "log-step-body", mix: [raw({ paddingBlock: "0.25rem 0.5rem" })], children: [_jsx(LogNodes, { nodes: nodes, href: (n) => lineHref(index, n) }), live ? _jsx("div", { "data-log-live": true }) : null] }), live ? (_jsx("p", { "data-log-refresh": true, mix: [raw({ margin: "0", padding: "0 0.75rem 0.5rem" }), text("sm")], children: _jsx("a", { href: live.refresh, mix: [fg("brand")], children: labels.refresh }) })) : null] }));
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Every line is in the page from the start, so find-in-page and line links work without script;
|
|
226
|
+
* mapping `@sdxc/ui/app/log-viewer` runs {@link LogViewerController} for search, streaming and
|
|
227
|
+
* tail-follow. Set `--ui-log-viewer-height` for the scroll box, `--ui-log-chunk-lines` per chunk.
|
|
228
|
+
*
|
|
229
|
+
* @param handle Runtime handle carrying the viewer's props.
|
|
230
|
+
* @returns The render function producing the viewer.
|
|
231
|
+
* @example
|
|
232
|
+
* <LogViewer steps={job.steps} lineHref={(step, n) => `#step:${step}:${n}`} timestamps={ts} timestampsHref={ts ? "?" : "?ts=1"} labels={labels} />
|
|
233
|
+
*/
|
|
234
|
+
export function LogViewer(handle) {
|
|
235
|
+
return () => {
|
|
236
|
+
let { steps, lineHref, timestamps = false, timestampsHref, labels, mix, ...rest } = handle.props;
|
|
237
|
+
return (_jsxs("section", { "data-slot": "log-viewer", "data-timestamps": timestamps ? "" : undefined, ...rest, mix: mergeMix([
|
|
238
|
+
raw({
|
|
239
|
+
"--ui-log-gutter": timestamps ? GUTTER_WITH_TIME : GUTTER,
|
|
240
|
+
position: "relative",
|
|
241
|
+
display: "flex",
|
|
242
|
+
flexDirection: "column",
|
|
243
|
+
minInlineSize: "0",
|
|
244
|
+
border: "1px solid var(--ui-neutral-border)",
|
|
245
|
+
borderRadius: "0.5rem",
|
|
246
|
+
backgroundColor: "var(--ui-log-viewer-surface, var(--ui-bg, Canvas))",
|
|
247
|
+
overflow: "clip",
|
|
248
|
+
}),
|
|
249
|
+
lineStyles(),
|
|
250
|
+
logStyles(),
|
|
251
|
+
], mix), children: [_jsxs("div", { "data-slot": "log-viewer-toolbar", mix: [
|
|
252
|
+
raw({
|
|
253
|
+
display: "flex",
|
|
254
|
+
flexWrap: "wrap",
|
|
255
|
+
alignItems: "center",
|
|
256
|
+
justifyContent: "flex-end",
|
|
257
|
+
gap: "0.5rem",
|
|
258
|
+
padding: "0.5rem 0.75rem",
|
|
259
|
+
borderBlockEnd: "1px solid var(--ui-neutral-border)",
|
|
260
|
+
}),
|
|
261
|
+
text("sm"),
|
|
262
|
+
], children: [_jsx(LogSearch, { labels: labels }), timestampsHref ? (_jsx("a", { href: timestampsHref, "aria-pressed": timestamps ? "true" : "false", role: "button", "data-slot": "log-viewer-timestamps", mix: [
|
|
263
|
+
fg("neutral.muted"),
|
|
264
|
+
hover(fg("neutral.emphasis")),
|
|
265
|
+
focusVisible(outline({ color: "brand.ring", offset: 2 })),
|
|
266
|
+
raw({ textDecoration: "none", whiteSpace: "nowrap" }),
|
|
267
|
+
], children: timestamps ? labels.hideTimestamps : labels.showTimestamps })) : null] }), _jsx("div", { "data-slot": "log-viewer-body", role: "region", "aria-label": labels.log, mix: [
|
|
268
|
+
attrs({ tabIndex: 0 }),
|
|
269
|
+
raw({
|
|
270
|
+
overflow: "auto",
|
|
271
|
+
maxBlockSize: "var(--ui-log-viewer-height, min(70vh, 48rem))",
|
|
272
|
+
overscrollBehavior: "contain",
|
|
273
|
+
fontSize: "0.75rem",
|
|
274
|
+
lineHeight: LINE_HEIGHT,
|
|
275
|
+
fontVariantLigatures: "none",
|
|
276
|
+
}),
|
|
277
|
+
font("mono"),
|
|
278
|
+
focusVisible(outline({ color: "brand.ring", offset: -2, width: 2 })),
|
|
279
|
+
], children: steps.map((step, position) => step.stream ? (_jsx(LogViewer.Stream, { index: position + 1, step: step, lineHref: lineHref, labels: labels })) : (_jsx(LogStep, { index: position + 1, step: step, lineHref: lineHref, labels: labels }))) }), _jsxs("button", { type: "button", hidden: true, "data-log-jump": true, mix: [
|
|
280
|
+
raw({
|
|
281
|
+
position: "absolute",
|
|
282
|
+
insetBlockEnd: "1rem",
|
|
283
|
+
insetInlineStart: "50%",
|
|
284
|
+
transform: "translateX(-50%)",
|
|
285
|
+
zIndex: "2",
|
|
286
|
+
display: "inline-flex",
|
|
287
|
+
alignItems: "center",
|
|
288
|
+
gap: "0.375rem",
|
|
289
|
+
padding: "0.375rem 0.875rem",
|
|
290
|
+
border: "none",
|
|
291
|
+
borderRadius: "999px",
|
|
292
|
+
backgroundColor: "var(--ui-brand-bg-solid)",
|
|
293
|
+
color: "var(--ui-brand-fg-on-solid, white)",
|
|
294
|
+
boxShadow: "0 4px 12px rgb(0 0 0 / 0.2)",
|
|
295
|
+
cursor: "pointer",
|
|
296
|
+
"&[hidden]": { display: "none" },
|
|
297
|
+
}),
|
|
298
|
+
text("sm"),
|
|
299
|
+
weight("medium"),
|
|
300
|
+
focusVisible(outline({ color: "brand.ring", offset: 2, width: 2 })),
|
|
301
|
+
], children: [_jsx(ArrowDownIcon, { size: 14, "aria-hidden": "true" }), labels.jumpToLatest] }), _jsx(LogViewerController, { matches: labels.matches, noMatches: labels.noMatches })] }));
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Renders the step the viewer draws for a running step: the lines so far, then each line the
|
|
306
|
+
* stream answers appended in place while the log follows its tail. Without script, or when the
|
|
307
|
+
* stream fails or ends, it offers a Refresh link to the page instead.
|
|
308
|
+
*
|
|
309
|
+
* @param handle Runtime handle carrying the step and its stream.
|
|
310
|
+
* @returns The render function producing the live step.
|
|
311
|
+
* @example <LogViewer.Stream index={4} step={{ ...step, stream: { src: "/runs/7/steps/4/log?after=120", refresh: "/runs/7" } }} lineHref={href} labels={labels} />
|
|
312
|
+
*/
|
|
313
|
+
LogViewer.Stream = function LogViewerStream(handle) {
|
|
314
|
+
return () => _jsx(LogStep, { ...handle.props });
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* The search box the island reveals: a field, the match counter and previous/next buttons.
|
|
318
|
+
* It stays hidden without script, where the browser's own find-in-page covers the log.
|
|
319
|
+
*/
|
|
320
|
+
function LogSearch(handle) {
|
|
321
|
+
return () => {
|
|
322
|
+
let { labels } = handle.props;
|
|
323
|
+
let buttonMix = [
|
|
324
|
+
raw({
|
|
325
|
+
display: "inline-flex",
|
|
326
|
+
alignItems: "center",
|
|
327
|
+
justifyContent: "center",
|
|
328
|
+
inlineSize: "1.75rem",
|
|
329
|
+
blockSize: "1.75rem",
|
|
330
|
+
padding: "0",
|
|
331
|
+
border: "none",
|
|
332
|
+
borderRadius: "0.375rem",
|
|
333
|
+
background: "none",
|
|
334
|
+
color: "inherit",
|
|
335
|
+
cursor: "pointer",
|
|
336
|
+
}),
|
|
337
|
+
hover(raw({ backgroundColor: "var(--ui-neutral-bg-tint-hover)" })),
|
|
338
|
+
focusVisible(outline({ color: "brand.ring", offset: 0, width: 2 })),
|
|
339
|
+
];
|
|
340
|
+
return (_jsxs("div", { role: "search", hidden: true, "data-log-search": true, mix: [
|
|
341
|
+
raw({
|
|
342
|
+
display: "flex",
|
|
343
|
+
alignItems: "center",
|
|
344
|
+
gap: "0.25rem",
|
|
345
|
+
marginInlineEnd: "auto",
|
|
346
|
+
flex: "1 1 16rem",
|
|
347
|
+
maxInlineSize: "24rem",
|
|
348
|
+
"&[hidden]": { display: "none" },
|
|
349
|
+
}),
|
|
350
|
+
], children: [_jsxs("label", { mix: [
|
|
351
|
+
raw({
|
|
352
|
+
display: "flex",
|
|
353
|
+
alignItems: "center",
|
|
354
|
+
gap: "0.375rem",
|
|
355
|
+
flex: "1 1 auto",
|
|
356
|
+
minInlineSize: "0",
|
|
357
|
+
blockSize: "2rem",
|
|
358
|
+
paddingInline: "0.5rem",
|
|
359
|
+
border: "1px solid var(--ui-neutral-border)",
|
|
360
|
+
borderRadius: "0.375rem",
|
|
361
|
+
"&:focus-within": { outline: "2px solid var(--ui-brand-ring)" },
|
|
362
|
+
}),
|
|
363
|
+
], children: [_jsx(SearchIcon, { size: 14, "aria-hidden": "true", mix: [fg("neutral.muted")] }), _jsx("span", { mix: [visuallyHidden()], children: labels.search }), _jsx("input", { type: "search", "data-log-search-input": true, placeholder: labels.search, autocomplete: "off", spellcheck: false, mix: [
|
|
364
|
+
raw({
|
|
365
|
+
flex: "1 1 auto",
|
|
366
|
+
minInlineSize: "0",
|
|
367
|
+
border: "none",
|
|
368
|
+
outline: "none",
|
|
369
|
+
background: "none",
|
|
370
|
+
color: "inherit",
|
|
371
|
+
font: "inherit",
|
|
372
|
+
fontSize: "max(16px, 0.875rem)",
|
|
373
|
+
}),
|
|
374
|
+
] }), _jsx("span", { "data-log-search-count": true, role: "status", mix: [fg("neutral.muted"), text("xs"), tabularNums(), raw({ whiteSpace: "nowrap" })] })] }), _jsx("button", { type: "button", "data-log-search-previous": true, "aria-label": labels.previousMatch, mix: buttonMix, children: _jsx(ChevronUpIcon, { size: 16, "aria-hidden": "true" }) }), _jsx("button", { type: "button", "data-log-search-next": true, "aria-label": labels.nextMatch, mix: buttonMix, children: _jsx(ChevronDownIcon, { size: 16, "aria-hidden": "true" }) })] }));
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* The viewer's island: renders nothing visible and wires the log it sits in once loaded, for
|
|
379
|
+
* search, streaming and following the tail. `LogViewer` places it; load
|
|
380
|
+
* `@sdxc/ui/app/log-viewer` in the browser entry.
|
|
381
|
+
*/
|
|
382
|
+
export const LogViewerController = clientEntry("@sdxc/ui/app/log-viewer#LogViewerController", function LogViewerController(handle) {
|
|
383
|
+
return () => _jsx("div", { hidden: true, mix: [logViewerController(handle.props)] });
|
|
384
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The box at the end of a pull request that answers "can I merge, and if not, why?": one ruled
|
|
3
|
+
* row per precondition (reviews, checks, conflicts), then a split merge button whose method menu
|
|
4
|
+
* is a native radio group. Merging is a plain form POST, so the whole box works without script.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
+
/**
|
|
11
|
+
* Prop types for {@link MergeBox}.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace MergeBox {
|
|
14
|
+
/**
|
|
15
|
+
* Where the pull request stands: `ready` can merge, `blocked` waits on a review or a check,
|
|
16
|
+
* `conflicts` needs the branch updated, and `merged` and `closed` are settled.
|
|
17
|
+
*/
|
|
18
|
+
type State = "ready" | "blocked" | "conflicts" | "merged" | "closed";
|
|
19
|
+
/** How the branch lands: a merge commit, one squashed commit, or rebased commits. */
|
|
20
|
+
type Method = "merge" | "squash" | "rebase";
|
|
21
|
+
/** The tone a row reads in: met is `success`, waiting `warning`, failing `danger`. */
|
|
22
|
+
type Tone = "success" | "warning" | "danger" | "neutral";
|
|
23
|
+
/** One precondition. */
|
|
24
|
+
interface Row {
|
|
25
|
+
/** Picks the row's icon and color, so met, waiting and failing read apart at a glance. */
|
|
26
|
+
tone: Tone;
|
|
27
|
+
/** The row's claim ("1 approving review", "All checks have passed"). */
|
|
28
|
+
title: RemixNode;
|
|
29
|
+
/** One sentence under the title ("24 successful checks"). */
|
|
30
|
+
detail?: RemixNode;
|
|
31
|
+
/** Content below the row's text, such as a `CheckRuns` list. */
|
|
32
|
+
children?: RemixNode;
|
|
33
|
+
}
|
|
34
|
+
/** The precondition rows, drawn in this order when given. */
|
|
35
|
+
interface Rows {
|
|
36
|
+
/** Whether the required reviews are in. */
|
|
37
|
+
reviews?: Row;
|
|
38
|
+
/** How the checks stand, with room for a `CheckRuns` list as its children. */
|
|
39
|
+
checks?: Row;
|
|
40
|
+
/** Whether the branch merges cleanly into its base. */
|
|
41
|
+
conflicts?: Row;
|
|
42
|
+
}
|
|
43
|
+
/** Every string the box shows, so an app translates each one. */
|
|
44
|
+
interface Labels {
|
|
45
|
+
/** Each method's button text ("Merge pull request", "Squash and merge", "Rebase and merge"). */
|
|
46
|
+
methods: Record<Method, string>;
|
|
47
|
+
/** One line under each method in the menu ("All commits will be added to the base branch"). */
|
|
48
|
+
methodDetails?: Partial<Record<Method, string>>;
|
|
49
|
+
/** The menu toggle's name and the menu's legend ("Choose a merge method"). */
|
|
50
|
+
chooseMethod: string;
|
|
51
|
+
/**
|
|
52
|
+
* One sentence per state: for `blocked` and `conflicts` the reason the button is disabled,
|
|
53
|
+
* for `merged` and `closed` the outcome, and for `ready` an optional hint.
|
|
54
|
+
*/
|
|
55
|
+
status: Partial<Record<State, string>>;
|
|
56
|
+
}
|
|
57
|
+
/** Props accepted by {@link MergeBox}; the host is a `<section>`. */
|
|
58
|
+
interface Props extends Omit<TagProps<"section">, "children"> {
|
|
59
|
+
/** Enables the merge button only at `ready`, and swaps it for the outcome once settled. */
|
|
60
|
+
state: State;
|
|
61
|
+
/** The preconditions shown above the button; an omitted row is left out. */
|
|
62
|
+
rows?: Rows;
|
|
63
|
+
/** The methods offered. @default ["merge", "squash", "rebase"] */
|
|
64
|
+
methods?: Method[];
|
|
65
|
+
/** The method chosen when the box renders. Defaults to the first of `methods`. */
|
|
66
|
+
defaultMethod?: Method;
|
|
67
|
+
/** Where the form posts; the body carries `method` and any `fields`. */
|
|
68
|
+
action: string;
|
|
69
|
+
/** Extra hidden fields posted with the merge, such as a CSRF token. */
|
|
70
|
+
fields?: RemixNode;
|
|
71
|
+
/** What follows a settled pull request, such as a "Delete branch" form. */
|
|
72
|
+
followUp?: RemixNode;
|
|
73
|
+
/** Every string the box shows, so it reads in any language. */
|
|
74
|
+
labels: Labels;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Renders the precondition rows, then the merge control or the outcome. While the request can't
|
|
79
|
+
* merge, both halves of the split button stay on screen, disabled, and the sentence naming why is
|
|
80
|
+
* their `aria-describedby`. The method menu is a native popover of radios posting `method`, and
|
|
81
|
+
* the button names the chosen method through CSS, so the box needs no island at all.
|
|
82
|
+
*
|
|
83
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
84
|
+
* @returns The render function producing the box's markup.
|
|
85
|
+
* @example
|
|
86
|
+
* <MergeBox
|
|
87
|
+
* state="ready"
|
|
88
|
+
* action={href("pulls.merge", { number })}
|
|
89
|
+
* rows={{
|
|
90
|
+
* reviews: { tone: "success", title: t("pr.approved", { count: 1 }) },
|
|
91
|
+
* checks: { tone: "success", title: t("pr.checksPassed"), children: <CheckRuns runs={runs} labels={checkLabels} /> },
|
|
92
|
+
* conflicts: { tone: "success", title: t("pr.noConflicts") },
|
|
93
|
+
* }}
|
|
94
|
+
* labels={mergeLabels}
|
|
95
|
+
* />
|
|
96
|
+
*/
|
|
97
|
+
export declare function MergeBox(handle: Handle<MergeBox.Props>): () => import("remix/component").RemixElement;
|