@sdxc/ui 2026.11.11 → 2026.11.17
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 +114 -61
- 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 +20 -0
- package/dist/app/index.js +20 -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 +347 -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/profile-picker.d.ts +47 -0
- package/dist/app/profile-picker.js +104 -0
- 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/save-status.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 +37 -10
- 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/index.d.ts +7 -0
- package/dist/landing/index.js +7 -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-frame.d.ts +2 -1
- 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/episode-list.d.ts +48 -0
- package/dist/video/episode-list.js +161 -0
- package/dist/video/index.d.ts +15 -0
- package/dist/video/index.js +15 -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/mixins/video-shelf-steps.d.ts +20 -0
- package/dist/video/mixins/video-shelf-steps.js +79 -0
- package/dist/video/title-hero.d.ts +51 -0
- package/dist/video/title-hero.js +170 -0
- package/dist/video/utils/timeline.d.ts +55 -0
- package/dist/video/utils/timeline.js +90 -0
- package/dist/video/video-card.d.ts +51 -0
- package/dist/video/video-card.js +135 -0
- package/dist/video/video-player.d.ts +261 -0
- package/dist/video/video-player.js +927 -0
- package/dist/video/video-shelf.d.ts +58 -0
- package/dist/video/video-shelf.js +155 -0
- package/package.json +6 -3
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { CheckIcon, ChevronDownIcon, CircleCheckIcon, CircleDotIcon, CircleIcon, CircleXIcon, GitMergeIcon, GitPullRequestClosedIcon, } from "@sdxc/icons";
|
|
3
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
4
|
+
import { bg, fg, outline } from "@sdxc/u/color";
|
|
5
|
+
import { rounded } from "@sdxc/u/effects";
|
|
6
|
+
import { cursor, mergeMix, raw } from "@sdxc/u/general";
|
|
7
|
+
import { flex, flexCol, flexWrap, gap, grow, inlineFlex, items, shrink } from "@sdxc/u/layout";
|
|
8
|
+
import { minIs, p, pb, pi } from "@sdxc/u/size";
|
|
9
|
+
import { hover, when } from "@sdxc/u/state";
|
|
10
|
+
import { leading, pretty, text, weight } from "@sdxc/u/typography";
|
|
11
|
+
import { Button } from "../components/button.js";
|
|
12
|
+
import { Card } from "../components/card.js";
|
|
13
|
+
import { Group } from "../components/group.js";
|
|
14
|
+
import { Popover } from "../components/popover.js";
|
|
15
|
+
/** The methods offered when `methods` is unset, in the order the menu lists them. */
|
|
16
|
+
const DEFAULT_METHODS = ["merge", "squash", "rebase"];
|
|
17
|
+
/** The rows a box draws, top to bottom, when each is given. */
|
|
18
|
+
const ROW_ORDER = ["reviews", "checks", "conflicts"];
|
|
19
|
+
/** The field name the chosen method posts under. */
|
|
20
|
+
const METHOD_FIELD = "method";
|
|
21
|
+
/**
|
|
22
|
+
* Renders the precondition rows, then the merge control or the outcome. While the request can't
|
|
23
|
+
* merge, both halves of the split button stay on screen, disabled, and the sentence naming why is
|
|
24
|
+
* their `aria-describedby`. The method menu is a native popover of radios posting `method`, and
|
|
25
|
+
* the button names the chosen method through CSS, so the box needs no island at all.
|
|
26
|
+
*
|
|
27
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
28
|
+
* @returns The render function producing the box's markup.
|
|
29
|
+
* @example
|
|
30
|
+
* <MergeBox
|
|
31
|
+
* state="ready"
|
|
32
|
+
* action={href("pulls.merge", { number })}
|
|
33
|
+
* rows={{
|
|
34
|
+
* reviews: { tone: "success", title: t("pr.approved", { count: 1 }) },
|
|
35
|
+
* checks: { tone: "success", title: t("pr.checksPassed"), children: <CheckRuns runs={runs} labels={checkLabels} /> },
|
|
36
|
+
* conflicts: { tone: "success", title: t("pr.noConflicts") },
|
|
37
|
+
* }}
|
|
38
|
+
* labels={mergeLabels}
|
|
39
|
+
* />
|
|
40
|
+
*/
|
|
41
|
+
export function MergeBox(handle) {
|
|
42
|
+
return () => {
|
|
43
|
+
let { state, rows = {}, methods = DEFAULT_METHODS, defaultMethod, action, fields, followUp, labels, mix, ...rest } = handle.props;
|
|
44
|
+
let given = ROW_ORDER.flatMap((key) => {
|
|
45
|
+
let row = rows[key];
|
|
46
|
+
return row === undefined ? [] : [{ key, row }];
|
|
47
|
+
});
|
|
48
|
+
return (_jsxs(Card, { ...rest, "data-slot": "merge-box", "data-state": state, mix: mergeMix([raw({ overflow: "clip" }), minIs(0)], mix), children: [given.map(({ key, row }) => (_jsx(MergeBoxRow, { name: key, row: row }, key))), state === "merged" || state === "closed" ? (_jsx(MergeBoxOutcome, { state: state, message: labels.status[state], followUp: followUp })) : (_jsx(MergeBoxControl, { id: handle.id, state: state, methods: methods, defaultMethod: defaultMethod !== undefined && methods.includes(defaultMethod)
|
|
49
|
+
? defaultMethod
|
|
50
|
+
: (methods[0] ?? "merge"), action: action, fields: fields, labels: labels }))] }));
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* One precondition as a ruled row: a toned icon whose shape follows the tone (✓ met, ● waiting,
|
|
55
|
+
* ✗ failing), the title, the detail, then any content such as the check list.
|
|
56
|
+
*
|
|
57
|
+
* @param handle Runtime handle carrying the row.
|
|
58
|
+
* @returns The render function producing the row.
|
|
59
|
+
*/
|
|
60
|
+
function MergeBoxRow(handle) {
|
|
61
|
+
return () => {
|
|
62
|
+
let { name, row } = handle.props;
|
|
63
|
+
return (_jsxs("div", { "data-slot": "merge-box-row", "data-row": name, "data-tone": row.tone, mix: [
|
|
64
|
+
flex(),
|
|
65
|
+
gap(3),
|
|
66
|
+
p(4),
|
|
67
|
+
minIs(0),
|
|
68
|
+
when("& + &", raw({ borderBlockStart: "1px solid var(--ui-neutral-border)" })),
|
|
69
|
+
], children: [_jsx(ToneIcon, { tone: row.tone }), _jsxs("div", { mix: [flex(), flexCol(), gap(1), grow(), minIs(0)], children: [_jsx("span", { "data-slot": "merge-box-row-title", mix: [weight("semibold"), fg("neutral.emphasis"), leading(1.4), pretty()], children: row.title }), row.detail === undefined ? null : (_jsx("span", { "data-slot": "merge-box-row-detail", mix: [text("sm"), fg("neutral.muted"), pretty()], children: row.detail })), row.children === undefined ? null : _jsx("div", { mix: [minIs(0), pb(1)], children: row.children })] })] }));
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A row's icon in a filled circle of its tone. The shape repeats the tone, so a row never relies
|
|
74
|
+
* on hue alone; the title beside it names the state, so the icon is decorative.
|
|
75
|
+
*
|
|
76
|
+
* @param handle Runtime handle carrying the tone.
|
|
77
|
+
* @returns The render function producing the icon.
|
|
78
|
+
*/
|
|
79
|
+
function ToneIcon(handle) {
|
|
80
|
+
return () => {
|
|
81
|
+
let { tone } = handle.props;
|
|
82
|
+
return (_jsx("span", { "aria-hidden": "true", "data-slot": "merge-box-icon", "data-tone": tone, mix: [
|
|
83
|
+
inlineFlex(),
|
|
84
|
+
items("center"),
|
|
85
|
+
raw({ justifyContent: "center", inlineSize: "2rem", blockSize: "2rem" }),
|
|
86
|
+
shrink(0),
|
|
87
|
+
rounded("full"),
|
|
88
|
+
bg("neutral.tint"),
|
|
89
|
+
fg("neutral.muted"),
|
|
90
|
+
when('&[data-tone="success"]', [bg("success.solid"), fg("success.onSolid")]),
|
|
91
|
+
when('&[data-tone="warning"]', [bg("warning.solid"), fg("warning.onSolid")]),
|
|
92
|
+
when('&[data-tone="danger"]', [bg("danger.solid"), fg("danger.onSolid")]),
|
|
93
|
+
], children: _jsx(ToneGlyph, { tone: tone }) }));
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The glyph for one tone at the row icon's 16px size.
|
|
98
|
+
*
|
|
99
|
+
* @param handle Runtime handle carrying the tone.
|
|
100
|
+
* @returns The render function producing the glyph.
|
|
101
|
+
*/
|
|
102
|
+
function ToneGlyph(handle) {
|
|
103
|
+
return () => {
|
|
104
|
+
switch (handle.props.tone) {
|
|
105
|
+
case "success":
|
|
106
|
+
return _jsx(CircleCheckIcon, { size: 16 });
|
|
107
|
+
case "warning":
|
|
108
|
+
return _jsx(CircleDotIcon, { size: 16 });
|
|
109
|
+
case "danger":
|
|
110
|
+
return _jsx(CircleXIcon, { size: 16 });
|
|
111
|
+
case "neutral":
|
|
112
|
+
return _jsx(CircleIcon, { size: 16 });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The merge form: a submit button joined to a toggle that opens the method menu, and the
|
|
118
|
+
* state's sentence. Each method's label sits in the submit button and only the checked radio's
|
|
119
|
+
* shows, so the button's text and accessible name follow the choice with no script. The submit
|
|
120
|
+
* button states `formmethod` because the `method` radios shadow `form.method` for any script that
|
|
121
|
+
* reads it. Space picks a method in the menu, Escape closes it, and Enter merges.
|
|
122
|
+
*
|
|
123
|
+
* @param handle Runtime handle carrying the form's inputs.
|
|
124
|
+
* @returns The render function producing the form.
|
|
125
|
+
*/
|
|
126
|
+
function MergeBoxControl(handle) {
|
|
127
|
+
return () => {
|
|
128
|
+
let { id, state, methods, defaultMethod, action, fields, labels } = handle.props;
|
|
129
|
+
let menuId = `${id}-methods`;
|
|
130
|
+
let statusId = `${id}-status`;
|
|
131
|
+
let disabled = state !== "ready";
|
|
132
|
+
let status = labels.status[state];
|
|
133
|
+
let describedBy = status === undefined ? undefined : statusId;
|
|
134
|
+
let chosenRules = {
|
|
135
|
+
'& [data-slot="merge-box-method-label"]': { display: "none" },
|
|
136
|
+
};
|
|
137
|
+
for (let method of methods) {
|
|
138
|
+
chosenRules[`&:has(input[name="${METHOD_FIELD}"][value="${method}"]:checked) [data-slot="merge-box-method-label"][data-method="${method}"]`] = { display: "inline" };
|
|
139
|
+
}
|
|
140
|
+
return (_jsxs("form", { method: "post", action: action, "data-slot": "merge-box-form", mix: [
|
|
141
|
+
flex(),
|
|
142
|
+
flexWrap(),
|
|
143
|
+
items("center"),
|
|
144
|
+
gap(3),
|
|
145
|
+
p(4),
|
|
146
|
+
raw({
|
|
147
|
+
borderBlockStart: "1px solid var(--ui-neutral-border)",
|
|
148
|
+
"&:first-child": { borderBlockStart: "none" },
|
|
149
|
+
}),
|
|
150
|
+
raw(chosenRules),
|
|
151
|
+
], children: [fields, _jsxs(Group, { children: [_jsx(Button, { type: "submit", formmethod: "post", color: disabled ? "neutral" : "success", disabled: disabled, "aria-describedby": describedBy, "data-slot": "merge-box-submit", children: methods.map((method) => (_jsx("span", { "data-slot": "merge-box-method-label", "data-method": method, children: labels.methods[method] }))) }), _jsx(Button, { color: disabled ? "neutral" : "success", disabled: disabled, commandfor: menuId, command: "toggle-popover", "aria-label": labels.chooseMethod, "aria-describedby": describedBy, "aria-haspopup": "true", "data-slot": "merge-box-toggle", mix: [
|
|
152
|
+
pi(2.5),
|
|
153
|
+
raw({ borderRadius: "var(--ui-button-radius, var(--ui-radius-md, 0.375rem))" }),
|
|
154
|
+
], children: _jsx(ChevronDownIcon, { size: 16, "aria-hidden": "true" }) })] }), _jsx(Popover, { id: menuId, placement: "bottom-start", "data-slot": "merge-box-methods", mix: [p(1), raw({ minInlineSize: "16rem", maxInlineSize: "min(22rem, 100vw - 2rem)" })], children: _jsxs("fieldset", { mix: [raw({ border: "none", margin: 0, padding: 0, minInlineSize: 0 })], children: [_jsx("legend", { mix: [visuallyHidden()], children: labels.chooseMethod }), methods.map((method) => (_jsx(MethodOption, { method: method, checked: method === defaultMethod, label: labels.methods[method], detail: labels.methodDetails?.[method] })))] }) }), status === undefined ? null : (_jsx("p", { id: statusId, "data-slot": "merge-box-status", mix: [
|
|
155
|
+
raw({ margin: 0, flex: "1 1 12rem" }),
|
|
156
|
+
minIs(0),
|
|
157
|
+
text("sm"),
|
|
158
|
+
fg("neutral.muted"),
|
|
159
|
+
pretty(),
|
|
160
|
+
], children: status }))] }));
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* One method as a menu row: a visually hidden radio posting `method`, a check that marks the
|
|
165
|
+
* chosen row, the method's name and its one-line detail. The whole row is the radio's label.
|
|
166
|
+
*
|
|
167
|
+
* @param handle Runtime handle carrying the method and its strings.
|
|
168
|
+
* @returns The render function producing the row.
|
|
169
|
+
*/
|
|
170
|
+
function MethodOption(handle) {
|
|
171
|
+
return () => {
|
|
172
|
+
let { method, checked, label, detail } = handle.props;
|
|
173
|
+
return (_jsxs("label", { "data-slot": "merge-box-method", "data-method": method, mix: [
|
|
174
|
+
flex(),
|
|
175
|
+
items("start"),
|
|
176
|
+
gap(2),
|
|
177
|
+
pi(3),
|
|
178
|
+
pb(2),
|
|
179
|
+
rounded("md"),
|
|
180
|
+
cursor("default"),
|
|
181
|
+
text("sm"),
|
|
182
|
+
fg("neutral.emphasis"),
|
|
183
|
+
hover(bg("neutral.bg-tint-hover")),
|
|
184
|
+
when("&:has(:focus-visible)", [
|
|
185
|
+
bg("brand.tint"),
|
|
186
|
+
outline({ color: "brand.ring", offset: 2 }),
|
|
187
|
+
]),
|
|
188
|
+
when("& > svg", [
|
|
189
|
+
raw({ visibility: "hidden", marginBlockStart: "0.125rem" }),
|
|
190
|
+
shrink(0),
|
|
191
|
+
fg("brand"),
|
|
192
|
+
]),
|
|
193
|
+
when("&:has(:checked) > svg", raw({ visibility: "visible" })),
|
|
194
|
+
], children: [_jsx("input", { type: "radio", name: METHOD_FIELD, value: method, defaultChecked: checked, mix: [visuallyHidden()] }), _jsx(CheckIcon, { size: 16, "aria-hidden": "true" }), _jsxs("span", { mix: [flex(), flexCol(), gap(0.5), minIs(0)], children: [_jsx("span", { mix: [weight("medium")], children: label }), detail === undefined ? null : (_jsx("span", { mix: [text("xs"), fg("neutral.muted"), pretty()], children: detail }))] })] }));
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The settled box: the outcome with its icon, and the follow-up beside it, such as "Delete branch".
|
|
199
|
+
*
|
|
200
|
+
* @param handle Runtime handle carrying the outcome.
|
|
201
|
+
* @returns The render function producing the outcome row.
|
|
202
|
+
*/
|
|
203
|
+
function MergeBoxOutcome(handle) {
|
|
204
|
+
return () => {
|
|
205
|
+
let { state, message, followUp } = handle.props;
|
|
206
|
+
return (_jsxs("div", { "data-slot": "merge-box-outcome", "data-state": state, mix: [
|
|
207
|
+
flex(),
|
|
208
|
+
flexWrap(),
|
|
209
|
+
items("center"),
|
|
210
|
+
gap(3),
|
|
211
|
+
p(4),
|
|
212
|
+
raw({
|
|
213
|
+
borderBlockStart: "1px solid var(--ui-neutral-border)",
|
|
214
|
+
"&:first-child": { borderBlockStart: "none" },
|
|
215
|
+
}),
|
|
216
|
+
], children: [_jsx("span", { "aria-hidden": "true", "data-slot": "merge-box-icon", "data-state": state, mix: [
|
|
217
|
+
inlineFlex(),
|
|
218
|
+
items("center"),
|
|
219
|
+
raw({ justifyContent: "center", inlineSize: "2rem", blockSize: "2rem" }),
|
|
220
|
+
shrink(0),
|
|
221
|
+
rounded("full"),
|
|
222
|
+
bg("brand.solid"),
|
|
223
|
+
fg("brand.onSolid"),
|
|
224
|
+
when('&[data-state="closed"]', [bg("danger.solid"), fg("danger.onSolid")]),
|
|
225
|
+
], children: state === "merged" ? _jsx(GitMergeIcon, { size: 16 }) : _jsx(GitPullRequestClosedIcon, { size: 16 }) }), message === undefined ? null : (_jsx("p", { "data-slot": "merge-box-status", mix: [raw({ margin: 0, flex: "1 1 12rem" }), minIs(0), weight("medium"), pretty()], children: message })), followUp === undefined ? null : (_jsx("div", { "data-slot": "merge-box-follow-up", mix: [shrink(0)], children: followUp }))] }));
|
|
226
|
+
};
|
|
227
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Why JS: writing the collapse cookie, a ⌘B shortcut, closing the phone sheet when a link is
|
|
3
|
-
* followed in place
|
|
3
|
+
* followed in place, re-marking the current row, retitling the page and restoring the content
|
|
4
|
+
* panel's scroll after a frame navigation and following a back row on Esc need script.
|
|
4
5
|
* No-JS baseline: the checkbox still collapses the sidebar through CSS and the sheet opens and
|
|
5
6
|
* closes through the Popover API; the collapse lasts until the next page load.
|
|
6
7
|
*
|
|
@@ -28,6 +29,8 @@ export declare function appShellQueries(sheetBelow: AppShellSheetBelow): {
|
|
|
28
29
|
export interface AppShellControlsOptions {
|
|
29
30
|
/** The cookie the collapsed state is written to, as `"true"` or `"false"`. */
|
|
30
31
|
cookieName: string;
|
|
32
|
+
/** The path the cookie is sent under. @default "/" */
|
|
33
|
+
cookiePath?: string;
|
|
31
34
|
/** The sidebar element's id, which is also the sheet's popover. */
|
|
32
35
|
sidebarId: string;
|
|
33
36
|
/** @default "48rem" */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Why JS: writing the collapse cookie, a ⌘B shortcut, closing the phone sheet when a link is
|
|
3
|
-
* followed in place
|
|
3
|
+
* followed in place, re-marking the current row, retitling the page and restoring the content
|
|
4
|
+
* panel's scroll after a frame navigation and following a back row on Esc need script.
|
|
4
5
|
* No-JS baseline: the checkbox still collapses the sidebar through CSS and the sheet opens and
|
|
5
6
|
* closes through the Popover API; the collapse lasts until the next page load.
|
|
6
7
|
*
|
|
@@ -60,9 +61,10 @@ function enhance(host, readOptions, signal) {
|
|
|
60
61
|
return id ? doc.getElementById(id) : null;
|
|
61
62
|
};
|
|
62
63
|
host.addEventListener("change", () => {
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
writeCookie(
|
|
64
|
+
let options = readOptions();
|
|
65
|
+
if (options?.cookieName) {
|
|
66
|
+
writeCookie(options.cookieName, host.checked, { path: options.cookiePath });
|
|
67
|
+
}
|
|
66
68
|
}, { signal });
|
|
67
69
|
doc.addEventListener("keydown", (event) => {
|
|
68
70
|
if (event.defaultPrevented || event.repeat)
|
|
@@ -87,6 +89,29 @@ function enhance(host, readOptions, signal) {
|
|
|
87
89
|
if (element.matches(":popover-open"))
|
|
88
90
|
element.hidePopover();
|
|
89
91
|
}, { signal });
|
|
92
|
+
let navigation = doc.defaultView?.navigation;
|
|
93
|
+
let scrolls = new Map();
|
|
94
|
+
let leaving = null;
|
|
95
|
+
let panel = () => doc.querySelector('[data-slot="app-shell-content"]');
|
|
96
|
+
navigation?.addEventListener("navigate", (event) => {
|
|
97
|
+
let key = navigation.currentEntry?.key;
|
|
98
|
+
let element = panel();
|
|
99
|
+
if (key !== undefined && element)
|
|
100
|
+
scrolls.set(key, element.scrollTop);
|
|
101
|
+
leaving = { type: event.navigationType, path: doc.location.pathname };
|
|
102
|
+
}, { signal });
|
|
103
|
+
navigation?.addEventListener("navigatesuccess", () => {
|
|
104
|
+
let left = leaving;
|
|
105
|
+
leaving = null;
|
|
106
|
+
doc.defaultView?.setTimeout(() => restorePanelScroll(panel(), left, scrolls, doc), 0);
|
|
107
|
+
let element = sidebar();
|
|
108
|
+
if (element)
|
|
109
|
+
markCurrentRow(element, doc.location.pathname);
|
|
110
|
+
let title = doc.querySelector('[data-slot="app-shell-main"][data-title]')
|
|
111
|
+
?.dataset.title;
|
|
112
|
+
if (title)
|
|
113
|
+
doc.title = title;
|
|
114
|
+
}, { signal });
|
|
90
115
|
let sheetBelow = readOptions()?.sheetBelow ?? DEFAULT_SHEET_BELOW;
|
|
91
116
|
let docked = doc.defaultView?.matchMedia(appShellQueries(sheetBelow).docked);
|
|
92
117
|
docked?.addEventListener("change", () => {
|
|
@@ -95,6 +120,41 @@ function enhance(host, readOptions, signal) {
|
|
|
95
120
|
element.hidePopover();
|
|
96
121
|
}, { signal });
|
|
97
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Puts the content panel's scroll where the visitor expects it once an in-place navigation
|
|
125
|
+
* settles, since the panel scrolls rather than the window: Back and Forward return to where
|
|
126
|
+
* the entry was left, and a link to another path starts at the top; a query change keeps it.
|
|
127
|
+
*/
|
|
128
|
+
function restorePanelScroll(panel, left, scrolls, doc) {
|
|
129
|
+
if (panel === null || left === null)
|
|
130
|
+
return;
|
|
131
|
+
let key = doc.defaultView?.navigation?.currentEntry?.key;
|
|
132
|
+
if (left.type === "traverse" && key !== undefined)
|
|
133
|
+
panel.scrollTop = scrolls.get(key) ?? 0;
|
|
134
|
+
else if (left.type === "push" && left.path !== doc.location.pathname)
|
|
135
|
+
panel.scrollTop = 0;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Marks the row whose link names `pathname` as the page shown and unmarks the one before it,
|
|
139
|
+
* so a navigation that reloads only a frame beside the sidebar keeps its current row true.
|
|
140
|
+
* With no row naming the address, the rows stay as the server drew them.
|
|
141
|
+
*/
|
|
142
|
+
function markCurrentRow(sidebar, pathname) {
|
|
143
|
+
let links = Array.from(sidebar.querySelectorAll('[data-slot="app-shell-item"] > a[href]'));
|
|
144
|
+
let match = links.find((link) => new URL(link.href).pathname === pathname);
|
|
145
|
+
if (match === undefined)
|
|
146
|
+
return;
|
|
147
|
+
for (let link of links) {
|
|
148
|
+
if (link === match) {
|
|
149
|
+
link.setAttribute("aria-current", "page");
|
|
150
|
+
link.setAttribute("data-current", "");
|
|
151
|
+
}
|
|
152
|
+
else if (link.getAttribute("aria-current") === "page") {
|
|
153
|
+
link.removeAttribute("aria-current");
|
|
154
|
+
link.removeAttribute("data-current");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
98
158
|
/**
|
|
99
159
|
* Flips the docked sidebar between column and rail through the checkbox, so the change event
|
|
100
160
|
* writes the cookie; with the checkbox hidden (a phone), opens or closes the sheet instead.
|
|
@@ -17,12 +17,15 @@ export declare namespace AutoRefreshTimer {
|
|
|
17
17
|
reload: () => Promise<unknown>;
|
|
18
18
|
/** Locale the refreshed time is written in. Defaults to the runtime's. */
|
|
19
19
|
locale?: string;
|
|
20
|
+
/** Time zone the time is written in. Defaults to the reader's own. */
|
|
21
|
+
timeZone?: string;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Runs a {@link RefreshSchedule} while the host `<time>` is in the document, counted from the
|
|
24
|
-
* host's own `datetime
|
|
25
|
-
* shown, sets `data-paused` meanwhile, and
|
|
26
|
+
* host's own `datetime`, which it first rewrites in the reader's time zone. It pauses while the
|
|
27
|
+
* page is hidden, catches up with one reload when shown, sets `data-paused` meanwhile, and
|
|
28
|
+
* rewrites the host's `datetime` and text after each reload.
|
|
26
29
|
*
|
|
27
30
|
* @example <time dateTime={iso} mix={[autoRefresh({ every: 30_000, reload: () => handle.frames.top.reload() })]}>{text}</time>
|
|
28
31
|
*/
|
|
@@ -10,8 +10,9 @@ import { createMixin } from "remix/component";
|
|
|
10
10
|
import { RefreshSchedule } from "../behaviors/refresh-schedule.js";
|
|
11
11
|
/**
|
|
12
12
|
* Runs a {@link RefreshSchedule} while the host `<time>` is in the document, counted from the
|
|
13
|
-
* host's own `datetime
|
|
14
|
-
* shown, sets `data-paused` meanwhile, and
|
|
13
|
+
* host's own `datetime`, which it first rewrites in the reader's time zone. It pauses while the
|
|
14
|
+
* page is hidden, catches up with one reload when shown, sets `data-paused` meanwhile, and
|
|
15
|
+
* rewrites the host's `datetime` and text after each reload.
|
|
15
16
|
*
|
|
16
17
|
* @example <time dateTime={iso} mix={[autoRefresh({ every: 30_000, reload: () => handle.frames.top.reload() })]}>{text}</time>
|
|
17
18
|
*/
|
|
@@ -47,7 +48,12 @@ function follow(host, options, signal) {
|
|
|
47
48
|
reload: options.reload,
|
|
48
49
|
refreshedAt: Number.isNaN(initial.getTime()) ? undefined : initial,
|
|
49
50
|
});
|
|
50
|
-
let format = new Intl.DateTimeFormat(options.locale, {
|
|
51
|
+
let format = new Intl.DateTimeFormat(options.locale, {
|
|
52
|
+
timeStyle: "medium",
|
|
53
|
+
timeZone: options.timeZone,
|
|
54
|
+
});
|
|
55
|
+
if (!Number.isNaN(initial.getTime()))
|
|
56
|
+
host.textContent = format.format(initial);
|
|
51
57
|
schedule.addEventListener("refresh", () => {
|
|
52
58
|
host.dateTime = schedule.refreshedAt.toISOString();
|
|
53
59
|
host.textContent = format.format(schedule.refreshedAt);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: a page that answers a submit in place keeps an open popover open, while a full page
|
|
3
|
+
* load closes it. No-JS baseline: the submit loads the next page, and the popover starts closed.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
import type { MixinFactory } from "remix/component";
|
|
9
|
+
/**
|
|
10
|
+
* Closes the popover holding the host whenever the host's form submits, by its own click or by
|
|
11
|
+
* Enter in any of the form's fields, so applying a choice always returns the visitor to the page.
|
|
12
|
+
* The form's fields stay in place while it closes, so the submission carries every value.
|
|
13
|
+
*
|
|
14
|
+
* @example <Button type="submit" form={formId} mix={[closePopoverOnSubmit()]}>Apply</Button>
|
|
15
|
+
*/
|
|
16
|
+
export declare const closePopoverOnSubmit: MixinFactory<HTMLButtonElement, []>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why JS: a page that answers a submit in place keeps an open popover open, while a full page
|
|
3
|
+
* load closes it. No-JS baseline: the submit loads the next page, and the popover starts closed.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
import { createMixin } from "remix/component";
|
|
9
|
+
/**
|
|
10
|
+
* Closes the popover holding the host whenever the host's form submits, by its own click or by
|
|
11
|
+
* Enter in any of the form's fields, so applying a choice always returns the visitor to the page.
|
|
12
|
+
* The form's fields stay in place while it closes, so the submission carries every value.
|
|
13
|
+
*
|
|
14
|
+
* @example <Button type="submit" form={formId} mix={[closePopoverOnSubmit()]}>Apply</Button>
|
|
15
|
+
*/
|
|
16
|
+
export const closePopoverOnSubmit = createMixin((handle) => {
|
|
17
|
+
let controller;
|
|
18
|
+
handle.addEventListener("insert", (event) => {
|
|
19
|
+
controller?.abort();
|
|
20
|
+
controller = new AbortController();
|
|
21
|
+
let button = event.node;
|
|
22
|
+
button.form?.addEventListener("submit", function closeHolder() {
|
|
23
|
+
let popover = button.closest("[popover]");
|
|
24
|
+
if (popover?.matches(":popover-open"))
|
|
25
|
+
popover.hidePopover();
|
|
26
|
+
}, { signal: controller.signal });
|
|
27
|
+
});
|
|
28
|
+
handle.addEventListener("remove", () => {
|
|
29
|
+
controller?.abort();
|
|
30
|
+
controller = undefined;
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line selection for a code view, from one listener on the view: a number click selects its
|
|
3
|
+
* line, a shift-click a range, the address becomes `#L3-L8` in place, the band and line menu
|
|
4
|
+
* follow, and the numbers are one Tab stop the arrow keys walk.
|
|
5
|
+
* Why JS: ranges, an address rewritten without a navigation, and the clipboard need script.
|
|
6
|
+
* No-JS baseline: every number links to `?L=n#Ln`, the server paints that line and
|
|
7
|
+
* `:target` paints the line an address names.
|
|
8
|
+
*
|
|
9
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
|
+
* @copyright Sergio Xalambrí 2026
|
|
11
|
+
*/
|
|
12
|
+
import type { ElementProps, MixinFactory } from "remix/component";
|
|
13
|
+
/** Selector for the element a code view renders as its root. */
|
|
14
|
+
export declare const CODE_VIEW_SELECTOR = "[data-slot=\"code-view\"]";
|
|
15
|
+
/** Attribute a selected row carries, which the view's styles paint as the band. */
|
|
16
|
+
export declare const CODE_VIEW_SELECTED_ATTRIBUTE = "data-selected";
|
|
17
|
+
/**
|
|
18
|
+
* Attribute the view's root carries while this mixin owns the selection, which hands the
|
|
19
|
+
* band from `:target` (fixed at load) to the rows it marks.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CODE_VIEW_LIVE_ATTRIBUTE = "data-selection-live";
|
|
22
|
+
/** Attribute the view's root carries while a selection shows its line menu. */
|
|
23
|
+
export declare const CODE_VIEW_MENU_ATTRIBUTE = "data-line-menu";
|
|
24
|
+
/**
|
|
25
|
+
* Types for {@link codeViewSelection}.
|
|
26
|
+
*/
|
|
27
|
+
export declare namespace CodeViewSelection {
|
|
28
|
+
/** The copy the keys list under in the help sheet, and the copy announced after a copy. */
|
|
29
|
+
interface Labels {
|
|
30
|
+
/** Announced once a line or a permalink is on the clipboard. */
|
|
31
|
+
copied: string;
|
|
32
|
+
/** The help-sheet heading the keys list under. */
|
|
33
|
+
group?: string;
|
|
34
|
+
/** What `y` does, such as "Copy permalink to address bar". */
|
|
35
|
+
permalinkKey?: string;
|
|
36
|
+
/** What Escape does while lines are selected. */
|
|
37
|
+
clearSelection?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Options for {@link codeViewSelection}. */
|
|
40
|
+
interface Options {
|
|
41
|
+
/** The address of this file at a fixed commit, which `y` and "Copy permalink" use. */
|
|
42
|
+
permalink?: string;
|
|
43
|
+
/** Where "Reference in new issue" goes, given the permalink under `issueParam`. */
|
|
44
|
+
issueHref?: string;
|
|
45
|
+
/** Search parameter `issueHref` receives the permalink under. @default "body" */
|
|
46
|
+
issueParam?: string;
|
|
47
|
+
labels: Labels;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Owns a code view's line selection from inside the view's island: it reads the range from
|
|
52
|
+
* the address (or the one the server painted), answers clicks on line numbers, `y` and
|
|
53
|
+
* Escape, and runs the line menu's actions, marked `data-action` on its items.
|
|
54
|
+
*
|
|
55
|
+
* @param options The permalink, the issue address and the copy.
|
|
56
|
+
* @example <div mix={[codeViewSelection({ permalink: "/blob/3f2a9c1/app.ts", labels: { copied: t("copied") } })]}>…menu…</div>
|
|
57
|
+
*/
|
|
58
|
+
export declare const codeViewSelection: MixinFactory<HTMLElement, [
|
|
59
|
+
options: CodeViewSelection.Options
|
|
60
|
+
], ElementProps>;
|