@sdxc/ui 2026.11.11 → 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 +89 -44
- 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/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/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
package/dist/app/page-header.js
CHANGED
|
@@ -1,44 +1,62 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
-
import { ChevronLeftIcon } from "@sdxc/icons";
|
|
2
|
+
import { ChevronDownIcon, ChevronLeftIcon } from "@sdxc/icons";
|
|
3
3
|
import { bg, fg, outline } from "@sdxc/u/color";
|
|
4
4
|
import { mergeMix, raw } from "@sdxc/u/general";
|
|
5
5
|
import { focusVisible, hover, when } from "@sdxc/u/state";
|
|
6
6
|
import { tabularNums, text, weight } from "@sdxc/u/typography";
|
|
7
|
+
import { generateUUID } from "@sdxc/uuid/v4";
|
|
7
8
|
import { Breadcrumbs } from "../components/breadcrumbs.js";
|
|
9
|
+
import { Menu } from "../components/menu.js";
|
|
8
10
|
/** The container the header measures and, when sticky, the one whose stuck state it reads. */
|
|
9
11
|
const CONTAINER = "ui-page-header";
|
|
10
12
|
/** The header's width from which the breadcrumb shows; narrower, the parent link does. */
|
|
11
13
|
const WIDE = `@container ${CONTAINER} (min-width: 40rem)`;
|
|
12
14
|
/** Every header width under {@link WIDE}. */
|
|
13
15
|
const NARROW = `@container ${CONTAINER} (max-width: 39.9375rem)`;
|
|
16
|
+
/**
|
|
17
|
+
* Browsers that take a scroll-state container. Every other browser keeps a plain inline-size
|
|
18
|
+
* container, so the width queries that pick the trail or the parent link apply everywhere.
|
|
19
|
+
*/
|
|
20
|
+
const SCROLL_STATE_SUPPORT = "@supports (container-type: scroll-state)";
|
|
14
21
|
/** The sticky header once it is held at the top while motion is welcome, which is when it compacts. */
|
|
15
22
|
const STUCK = `@container ${CONTAINER} scroll-state(stuck: top)`;
|
|
23
|
+
/** How many tabs a narrow header shows before the rest fold into "More". */
|
|
24
|
+
const DEFAULT_NARROW_TABS = 2;
|
|
25
|
+
/** The overflow menu's label when `tabsMore` is omitted. */
|
|
26
|
+
const DEFAULT_MORE_LABEL = "More";
|
|
16
27
|
/** Whether the header sticks and compacts when `sticky` is omitted. */
|
|
17
28
|
const DEFAULT_STICKY = false;
|
|
18
29
|
/** Motion for the compacting rows; reduced motion keeps the header full size. */
|
|
19
30
|
const EASE = "200ms cubic-bezier(0.2, 0, 0, 1)";
|
|
20
31
|
/**
|
|
21
32
|
* Renders the header. From 40rem the actions end the title's row, the description under both;
|
|
22
|
-
* narrower,
|
|
23
|
-
*
|
|
33
|
+
* narrower, actions sit beside the title or after the description, and tabs past `tabsNarrow`
|
|
34
|
+
* fold into a popover "More ▾" menu that opens with no script. Sticky spans `--ui-app-gutter`.
|
|
24
35
|
*
|
|
25
36
|
* @param handle Runtime handle carrying the header's props.
|
|
26
37
|
* @returns The render function producing the header's markup.
|
|
27
38
|
* @example
|
|
28
39
|
* <PageHeader crumbsLabel="Breadcrumb" crumbs={[{ label: "Monitors", href: "/monitors" }, { label: "api.acme.dev" }]} title="api.acme.dev" status={<Badge color="success">Up</Badge>} actions={<Button variant="outline">Pause</Button>} primaryAction={<Button>Edit monitor</Button>} />
|
|
40
|
+
* @example
|
|
41
|
+
* <PageHeader title="acme / delta" tabsLabel={t("repo.views")} tabsMore={t("repo.more")} tabs={[{ href: "/code", label: t("repo.code"), current: true }, { href: "/issues", label: t("repo.issues"), count: 26 }, { href: "/pulls", label: t("repo.pulls"), count: 71 }, { href: "/actions", label: t("repo.actions") }]} />
|
|
29
42
|
*/
|
|
30
43
|
export function PageHeader(handle) {
|
|
44
|
+
let moreId = `page-header-more-${generateUUID()}`;
|
|
31
45
|
return () => {
|
|
32
|
-
let { title, crumbs = [], crumbsLabel, parent, description, status, primaryAction, actions, overflow, tabs = [], tabsLabel, sticky = DEFAULT_STICKY, mix, ...rest } = handle.props;
|
|
46
|
+
let { title, crumbs = [], crumbsLabel, parent, description, status, primaryAction, actions, overflow, tabs = [], tabsLabel, tabsNarrow = DEFAULT_NARROW_TABS, tabsMore = DEFAULT_MORE_LABEL, sticky = DEFAULT_STICKY, mix, ...rest } = handle.props;
|
|
33
47
|
let back = parent ?? parentOf(crumbs);
|
|
34
48
|
let hasActions = primaryAction !== undefined || actions !== undefined || overflow !== undefined;
|
|
49
|
+
let folded = foldedTabs(tabs, tabsNarrow);
|
|
35
50
|
return (_jsx("header", { ...rest, "data-slot": "page-header", "data-sticky": sticky ? "" : undefined, mix: mergeMix([
|
|
36
51
|
raw({
|
|
37
52
|
display: "block",
|
|
38
53
|
inlineSize: "100%",
|
|
39
54
|
minInlineSize: "0",
|
|
40
|
-
containerType:
|
|
55
|
+
containerType: "inline-size",
|
|
41
56
|
containerName: CONTAINER,
|
|
57
|
+
...(sticky
|
|
58
|
+
? { [SCROLL_STATE_SUPPORT]: { containerType: "inline-size scroll-state" } }
|
|
59
|
+
: {}),
|
|
42
60
|
overflowWrap: "anywhere",
|
|
43
61
|
}),
|
|
44
62
|
sticky
|
|
@@ -47,6 +65,8 @@ export function PageHeader(handle) {
|
|
|
47
65
|
position: "sticky",
|
|
48
66
|
insetBlockStart: "var(--ui-app-sticky-top, 0px)",
|
|
49
67
|
zIndex: "2",
|
|
68
|
+
boxSizing: "border-box",
|
|
69
|
+
inlineSize: "calc(100% + 2 * var(--ui-app-gutter, 0px))",
|
|
50
70
|
marginInline: "calc(-1 * var(--ui-app-gutter, 0px))",
|
|
51
71
|
paddingInline: "var(--ui-app-gutter, 0px)",
|
|
52
72
|
}),
|
|
@@ -79,15 +99,15 @@ export function PageHeader(handle) {
|
|
|
79
99
|
let isCurrent = index === crumbs.length - 1;
|
|
80
100
|
return (_jsx(Breadcrumbs.Item, { children: _jsx(Breadcrumbs.Link, { href: isCurrent ? undefined : crumb.href, "aria-current": isCurrent ? "page" : undefined, children: crumb.label }) }, `${index}:${crumb.label}`));
|
|
81
101
|
}) }) }) })) : null, back ? (_jsxs("a", { href: back.href, "data-slot": "page-header-parent", mix: [
|
|
82
|
-
|
|
83
|
-
when(NARROW, raw({
|
|
102
|
+
raw({
|
|
84
103
|
display: "inline-flex",
|
|
85
104
|
alignItems: "center",
|
|
86
105
|
gap: "0.25rem",
|
|
87
106
|
maxInlineSize: "100%",
|
|
88
107
|
textDecoration: "none",
|
|
89
108
|
borderRadius: "0.25rem",
|
|
90
|
-
})
|
|
109
|
+
}),
|
|
110
|
+
when(WIDE, raw({ display: "none" })),
|
|
91
111
|
text("sm"),
|
|
92
112
|
fg("neutral.muted"),
|
|
93
113
|
hover(fg("neutral.emphasis")),
|
|
@@ -108,13 +128,13 @@ export function PageHeader(handle) {
|
|
|
108
128
|
: '"title actions"',
|
|
109
129
|
alignItems: "center",
|
|
110
130
|
columnGap: "1rem",
|
|
111
|
-
rowGap: "0.
|
|
131
|
+
rowGap: "0.75rem",
|
|
112
132
|
})),
|
|
113
133
|
], children: [_jsxs("div", { "data-slot": "page-header-heading", mix: [
|
|
114
134
|
when(NARROW, raw({
|
|
115
135
|
display: "flex",
|
|
116
136
|
flexDirection: "column",
|
|
117
|
-
gap: "0.
|
|
137
|
+
gap: "0.75rem",
|
|
118
138
|
flex: "1 1 16rem",
|
|
119
139
|
minInlineSize: "0",
|
|
120
140
|
})),
|
|
@@ -167,7 +187,7 @@ export function PageHeader(handle) {
|
|
|
167
187
|
scrollbarWidth: "none",
|
|
168
188
|
boxShadow: "inset 0 -1px 0 var(--ui-neutral-border)",
|
|
169
189
|
}),
|
|
170
|
-
], children:
|
|
190
|
+
], children: _jsxs("ul", { mix: [
|
|
171
191
|
raw({
|
|
172
192
|
display: "flex",
|
|
173
193
|
gap: "1rem",
|
|
@@ -176,45 +196,16 @@ export function PageHeader(handle) {
|
|
|
176
196
|
listStyle: "none",
|
|
177
197
|
inlineSize: "max-content",
|
|
178
198
|
}),
|
|
179
|
-
], children: tabs.map((tab) => (_jsx("li", { children: _jsxs("a", { href: tab.href, "aria-current": tab.current ? "page" : undefined, mix: [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}),
|
|
189
|
-
text("sm"),
|
|
190
|
-
fg("neutral.muted"),
|
|
191
|
-
hover(fg("neutral.emphasis")),
|
|
192
|
-
focusVisible(outline({ color: "brand.ring", offset: -2 })),
|
|
193
|
-
when('&[aria-current="page"]', [fg("neutral.emphasis"), weight("medium")]),
|
|
194
|
-
when('&[aria-current="page"]::after', raw({
|
|
195
|
-
content: '""',
|
|
196
|
-
position: "absolute",
|
|
197
|
-
insetInline: "0",
|
|
198
|
-
insetBlockEnd: "0",
|
|
199
|
-
blockSize: "2px",
|
|
200
|
-
borderRadius: "2px",
|
|
201
|
-
backgroundColor: "var(--ui-brand-bg-solid)",
|
|
202
|
-
})),
|
|
203
|
-
], children: [tab.label, tab.count !== undefined ? (_jsx("span", { "data-slot": "page-header-tab-count", mix: [
|
|
204
|
-
raw({
|
|
205
|
-
minInlineSize: "1.25rem",
|
|
206
|
-
paddingInline: "0.375rem",
|
|
207
|
-
borderRadius: "999px",
|
|
208
|
-
fontSize: "0.75rem",
|
|
209
|
-
lineHeight: "1.25rem",
|
|
210
|
-
textAlign: "center",
|
|
211
|
-
boxSizing: "border-box",
|
|
212
|
-
}),
|
|
213
|
-
tabularNums(),
|
|
214
|
-
weight("medium"),
|
|
215
|
-
bg("neutral.bg-tint-hover"),
|
|
216
|
-
fg("neutral.emphasis"),
|
|
217
|
-
], children: tab.count })) : null] }) }, tab.href))) }) })) : null] }) }));
|
|
199
|
+
], children: [tabs.map((tab, index) => (_jsx("li", { "data-folded": folded.has(index) ? "" : undefined, mix: [folded.has(index) ? when(NARROW, raw({ display: "none" })) : []], children: _jsxs("a", { href: tab.href, "aria-current": tab.current ? "page" : undefined, mix: tabMix(), children: [tab.label, tab.count !== undefined ? _jsx(TabCount, { count: tab.count }) : null] }) }, tab.href))), folded.size > 0 ? (_jsx("li", { "data-slot": "page-header-tabs-more", mix: [when(WIDE, raw({ display: "none" }))], children: _jsxs("button", { type: "button", commandfor: moreId, command: "toggle-popover", "aria-haspopup": "menu", mix: [
|
|
200
|
+
...tabMix(),
|
|
201
|
+
raw({
|
|
202
|
+
border: "none",
|
|
203
|
+
background: "none",
|
|
204
|
+
padding: "0",
|
|
205
|
+
fontFamily: "inherit",
|
|
206
|
+
cursor: "pointer",
|
|
207
|
+
}),
|
|
208
|
+
], children: [tabsMore, _jsx(ChevronDownIcon, { size: 14, "aria-hidden": "true" })] }) })) : null] }) })) : null, folded.size > 0 ? (_jsx(Menu, { id: moreId, placement: "bottom-end", "aria-label": tabsMore, children: tabs.map((tab, index) => folded.has(index) ? (_jsxs(Menu.Item, { href: tab.href, children: [tab.label, tab.count !== undefined ? (_jsx(TabCount, { count: tab.count, mix: [raw({ marginInlineStart: "auto" })] })) : null] }, tab.href)) : null) })) : null] }) }));
|
|
218
209
|
};
|
|
219
210
|
}
|
|
220
211
|
/**
|
|
@@ -247,3 +238,67 @@ function parentOf(crumbs) {
|
|
|
247
238
|
}
|
|
248
239
|
return undefined;
|
|
249
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* The indices of the tabs a narrow header moves into "More": all but the first `narrow`,
|
|
243
|
+
* where the current tab takes the last place in the row when it would have folded, so the
|
|
244
|
+
* view shown is always named in the row. Empty when "More" would stand in for a single tab.
|
|
245
|
+
*/
|
|
246
|
+
function foldedTabs(tabs, narrow) {
|
|
247
|
+
let keep = Math.max(1, narrow);
|
|
248
|
+
if (tabs.length <= keep + 1)
|
|
249
|
+
return new Set();
|
|
250
|
+
let current = tabs.findIndex((tab) => tab.current);
|
|
251
|
+
let shown = tabs.map((_, index) => index).slice(0, keep);
|
|
252
|
+
if (current >= keep)
|
|
253
|
+
shown[keep - 1] = current;
|
|
254
|
+
return new Set(tabs.map((_, index) => index).filter((index) => !shown.includes(index)));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* A tab's look, shared by the links and the "More" button: a 40px row of muted text, and for
|
|
258
|
+
* the current tab emphasis with a 2px accent underline.
|
|
259
|
+
*/
|
|
260
|
+
function tabMix() {
|
|
261
|
+
return [
|
|
262
|
+
raw({
|
|
263
|
+
position: "relative",
|
|
264
|
+
display: "inline-flex",
|
|
265
|
+
alignItems: "center",
|
|
266
|
+
gap: "0.375rem",
|
|
267
|
+
blockSize: "2.5rem",
|
|
268
|
+
whiteSpace: "nowrap",
|
|
269
|
+
textDecoration: "none",
|
|
270
|
+
}),
|
|
271
|
+
text("sm"),
|
|
272
|
+
fg("neutral.muted"),
|
|
273
|
+
hover(fg("neutral.emphasis")),
|
|
274
|
+
focusVisible(outline({ color: "brand.ring", offset: -2 })),
|
|
275
|
+
when('&[aria-current="page"]', [fg("neutral.emphasis"), weight("medium")]),
|
|
276
|
+
when('&[aria-current="page"]::after', raw({
|
|
277
|
+
content: '""',
|
|
278
|
+
position: "absolute",
|
|
279
|
+
insetInline: "0",
|
|
280
|
+
insetBlockEnd: "0",
|
|
281
|
+
blockSize: "2px",
|
|
282
|
+
borderRadius: "2px",
|
|
283
|
+
backgroundColor: "var(--ui-brand-bg-solid)",
|
|
284
|
+
})),
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
/** A tab's count as a 12px pill, such as open issues, read before the tab is opened. */
|
|
288
|
+
function TabCount(handle) {
|
|
289
|
+
return () => (_jsx("span", { "data-slot": "page-header-tab-count", mix: mergeMix([
|
|
290
|
+
raw({
|
|
291
|
+
minInlineSize: "1.25rem",
|
|
292
|
+
paddingInline: "0.375rem",
|
|
293
|
+
borderRadius: "999px",
|
|
294
|
+
fontSize: "0.75rem",
|
|
295
|
+
lineHeight: "1.25rem",
|
|
296
|
+
textAlign: "center",
|
|
297
|
+
boxSizing: "border-box",
|
|
298
|
+
}),
|
|
299
|
+
tabularNums(),
|
|
300
|
+
weight("medium"),
|
|
301
|
+
bg("neutral.bg-tint-hover"),
|
|
302
|
+
fg("neutral.emphasis"),
|
|
303
|
+
], handle.props.mix), children: handle.props.count }));
|
|
304
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A conversation anchored to lines of a change: comment cards, a suggested change drawn as a
|
|
3
|
+
* small diff, a reply box and Resolve, all plain POST forms that reload the thread's own
|
|
4
|
+
* frame. A resolved or outdated thread folds to one line, and pending comments say so.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Hunk } from "@sdxc/diff";
|
|
10
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
11
|
+
import { Diff } from "./diff.js";
|
|
12
|
+
/**
|
|
13
|
+
* Prop types for {@link ReviewThread}.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace ReviewThread {
|
|
16
|
+
/** One comment of the thread, drawn as a `Timeline.Comment` card. */
|
|
17
|
+
interface Comment {
|
|
18
|
+
/** The card's id, so `#discussion_r123` lands on it. */
|
|
19
|
+
id?: string;
|
|
20
|
+
/** The author's picture, such as an `Avatar`, at the card's start. */
|
|
21
|
+
avatar: RemixNode;
|
|
22
|
+
/** The author's name, usually a link to their profile. */
|
|
23
|
+
author: RemixNode;
|
|
24
|
+
/** The muted verb after the name, such as "commented". */
|
|
25
|
+
action?: RemixNode;
|
|
26
|
+
/** When it was written, such as a `RelativeTime`, after the verb. */
|
|
27
|
+
time?: RemixNode;
|
|
28
|
+
/** A `⋯` menu trigger at the card's header end. */
|
|
29
|
+
menu?: RemixNode;
|
|
30
|
+
/** The reactions row under the body. */
|
|
31
|
+
reactions?: RemixNode;
|
|
32
|
+
/** The comment belongs to a review not yet submitted, so only its author sees it. */
|
|
33
|
+
pending?: boolean;
|
|
34
|
+
/** The rendered Markdown body. */
|
|
35
|
+
body: RemixNode;
|
|
36
|
+
}
|
|
37
|
+
/** Lines of a file drawn as a small diff: the code a thread is about, or a suggestion. */
|
|
38
|
+
interface Lines {
|
|
39
|
+
/** The file's path, which names the excerpt. */
|
|
40
|
+
path: string;
|
|
41
|
+
/** The lines to draw, as parsed hunks. */
|
|
42
|
+
hunks: readonly Hunk[];
|
|
43
|
+
/** Language the lines highlight as. */
|
|
44
|
+
language?: string;
|
|
45
|
+
}
|
|
46
|
+
/** A suggested change and where accepting it posts. */
|
|
47
|
+
interface Suggestion extends Lines {
|
|
48
|
+
/** Where "Apply suggestion" posts; omitted, the suggestion only reads. */
|
|
49
|
+
applyAction?: string;
|
|
50
|
+
}
|
|
51
|
+
/** Every string the thread shows or announces; the library ships no copy. */
|
|
52
|
+
interface Labels {
|
|
53
|
+
/** The reply box's name and its button, such as "Reply". */
|
|
54
|
+
reply: string;
|
|
55
|
+
/** Shown in the empty reply box, such as "Reply…". */
|
|
56
|
+
replyPlaceholder?: string;
|
|
57
|
+
/** The button on an open thread, such as "Resolve conversation". */
|
|
58
|
+
resolve: string;
|
|
59
|
+
/** The button on a resolved thread, such as "Unresolve conversation". */
|
|
60
|
+
unresolve: string;
|
|
61
|
+
/** The badge on an outdated thread, such as "Outdated". */
|
|
62
|
+
outdated: string;
|
|
63
|
+
/** The badge on an unsent comment, such as "Pending". */
|
|
64
|
+
pending: string;
|
|
65
|
+
/** Heads a suggestion block, such as "Suggested change". */
|
|
66
|
+
suggestion: string;
|
|
67
|
+
/** The button under a suggestion with an `applyAction`, such as "Apply suggestion". */
|
|
68
|
+
applySuggestion: string;
|
|
69
|
+
/** Hidden column headers for the excerpt and suggestion tables. */
|
|
70
|
+
columns: Diff.ColumnLabels;
|
|
71
|
+
}
|
|
72
|
+
/** Props accepted by {@link ReviewThread}: every native `<div>` attribute for its root. */
|
|
73
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
74
|
+
/** The thread's comments, oldest first. */
|
|
75
|
+
comments: readonly Comment[];
|
|
76
|
+
/** The thread is resolved, which folds it to `resolvedSummary`. */
|
|
77
|
+
resolved?: boolean;
|
|
78
|
+
/** The folded line of a resolved thread, such as "ana marked this conversation as resolved". */
|
|
79
|
+
resolvedSummary?: RemixNode;
|
|
80
|
+
/** The lines the thread cites have changed since, which folds it and labels it. */
|
|
81
|
+
outdated?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The code the thread is about, drawn above the comments: on the timeline, and for an
|
|
84
|
+
* outdated thread, whose original lines no longer show in the diff.
|
|
85
|
+
*/
|
|
86
|
+
excerpt?: Lines;
|
|
87
|
+
/** A change the reviewer proposes, drawn as a small diff under the comments. */
|
|
88
|
+
suggestion?: Suggestion;
|
|
89
|
+
/** Where a reply posts its text (as `body`); omitted, the thread draws no reply box. */
|
|
90
|
+
replyAction?: string;
|
|
91
|
+
/** Where Resolve and Unresolve post `resolved=true|false`; omitted, no button. */
|
|
92
|
+
resolveAction?: string;
|
|
93
|
+
/** The named frame the thread renders in, which every form reloads in place. */
|
|
94
|
+
frame?: string;
|
|
95
|
+
/** Hidden inputs every form carries, such as a CSRF token. */
|
|
96
|
+
fields?: RemixNode;
|
|
97
|
+
/** Every string the thread shows or announces, so it reads in any language. */
|
|
98
|
+
labels: Labels;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Open, it shows the excerpt, comments, suggestion and forms; resolved or outdated, it folds into
|
|
103
|
+
* a closed `<details>` behind one line. Every form is a plain POST, so it works without script and
|
|
104
|
+
* needs no island; with the page's runtime, `frame` reloads only the thread in place.
|
|
105
|
+
*
|
|
106
|
+
* @param handle Runtime handle carrying the thread's props.
|
|
107
|
+
* @returns The render function producing the thread.
|
|
108
|
+
* @example
|
|
109
|
+
* <Frame name={`thread-${thread.id}`} src={`/threads/${thread.id}`}>
|
|
110
|
+
* <ReviewThread id={`thread-${thread.id}`} frame={`thread-${thread.id}`} comments={comments}
|
|
111
|
+
* replyAction={`/threads/${thread.id}/replies`} resolveAction={`/threads/${thread.id}/resolve`} labels={labels} />
|
|
112
|
+
* </Frame>
|
|
113
|
+
* @example <ReviewThread resolved resolvedSummary={t("thread.resolvedBy", { name: "ana" })} comments={comments} labels={labels} />
|
|
114
|
+
*/
|
|
115
|
+
export declare function ReviewThread(handle: Handle<ReviewThread.Props>): () => import("remix/component").RemixElement;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ChevronDownIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { rounded } from "@sdxc/u/effects";
|
|
5
|
+
import { cursor, mergeMix, raw } from "@sdxc/u/general";
|
|
6
|
+
import { flexWrap, hstack, shrink, vstack } from "@sdxc/u/layout";
|
|
7
|
+
import { motionSafe } from "@sdxc/u/responsive";
|
|
8
|
+
import { minIs, p, pb, pi } from "@sdxc/u/size";
|
|
9
|
+
import { focusVisible, when } from "@sdxc/u/state";
|
|
10
|
+
import { font, text, weight } from "@sdxc/u/typography";
|
|
11
|
+
import { Badge } from "../components/badge.js";
|
|
12
|
+
import { Button } from "../components/button.js";
|
|
13
|
+
import { TextArea } from "../components/textarea.js";
|
|
14
|
+
import { Timeline } from "../components/timeline.js";
|
|
15
|
+
import { Diff } from "./diff.js";
|
|
16
|
+
/** Field the reply form posts its text under. */
|
|
17
|
+
const REPLY_FIELD = "body";
|
|
18
|
+
/** Field the resolve form posts the thread's next state under, `"true"` or `"false"`. */
|
|
19
|
+
const RESOLVED_FIELD = "resolved";
|
|
20
|
+
/**
|
|
21
|
+
* Open, it shows the excerpt, comments, suggestion and forms; resolved or outdated, it folds into
|
|
22
|
+
* a closed `<details>` behind one line. Every form is a plain POST, so it works without script and
|
|
23
|
+
* needs no island; with the page's runtime, `frame` reloads only the thread in place.
|
|
24
|
+
*
|
|
25
|
+
* @param handle Runtime handle carrying the thread's props.
|
|
26
|
+
* @returns The render function producing the thread.
|
|
27
|
+
* @example
|
|
28
|
+
* <Frame name={`thread-${thread.id}`} src={`/threads/${thread.id}`}>
|
|
29
|
+
* <ReviewThread id={`thread-${thread.id}`} frame={`thread-${thread.id}`} comments={comments}
|
|
30
|
+
* replyAction={`/threads/${thread.id}/replies`} resolveAction={`/threads/${thread.id}/resolve`} labels={labels} />
|
|
31
|
+
* </Frame>
|
|
32
|
+
* @example <ReviewThread resolved resolvedSummary={t("thread.resolvedBy", { name: "ana" })} comments={comments} labels={labels} />
|
|
33
|
+
*/
|
|
34
|
+
export function ReviewThread(handle) {
|
|
35
|
+
return () => {
|
|
36
|
+
let { comments, excerpt, fields, frame, labels, mix, outdated, replyAction, resolveAction, resolved, resolvedSummary, suggestion, ...rest } = handle.props;
|
|
37
|
+
let state = threadState(resolved, outdated);
|
|
38
|
+
let content = (_jsxs("div", { "data-slot": "review-thread-content", mix: [vstack({ gap: 3 }), p(3), minIs(0)], children: [excerpt ? _jsx(ThreadLines, { lines: excerpt, columns: labels.columns }) : null, _jsx(Timeline, { mix: [raw({ "--ui-timeline-surface": "var(--review-thread-bg)" })], children: comments.map((comment) => (_jsx(Timeline.Comment, { id: comment.id, avatar: comment.avatar, author: comment.author, action: comment.pending ? (_jsxs("span", { mix: [hstack({ gap: 1.5, align: "center" })], children: [comment.action, _jsx(Badge, { color: "warning", variant: "outline", "data-slot": "review-thread-pending", children: labels.pending })] })) : (comment.action), time: comment.time, menu: comment.menu, reactions: comment.reactions, "data-pending": comment.pending ? "" : undefined, children: comment.body }))) }), suggestion ? (_jsxs("div", { "data-slot": "review-thread-suggestion", mix: [
|
|
39
|
+
vstack({ gap: 0 }),
|
|
40
|
+
rounded("md"),
|
|
41
|
+
border({ color: "neutral.border", width: 1 }),
|
|
42
|
+
raw({ overflow: "clip" }),
|
|
43
|
+
], children: [_jsx("p", { mix: [
|
|
44
|
+
raw({ margin: 0 }),
|
|
45
|
+
pi(3),
|
|
46
|
+
pb(1.5),
|
|
47
|
+
bg("neutral.bg-tint"),
|
|
48
|
+
text("xs"),
|
|
49
|
+
weight(600),
|
|
50
|
+
fg("neutral.muted"),
|
|
51
|
+
], children: labels.suggestion }), _jsx(Diff.Hunks, { path: suggestion.path, hunks: suggestion.hunks, language: suggestion.language, anchored: false, labels: { columns: labels.columns } }), suggestion.applyAction ? (_jsxs("form", { method: "post", action: suggestion.applyAction, "data-rmx-target": frame, "data-slot": "review-thread-apply", mix: [
|
|
52
|
+
hstack({ justify: "end" }),
|
|
53
|
+
pi(3),
|
|
54
|
+
pb(2),
|
|
55
|
+
raw({ borderBlockStart: "1px solid var(--ui-neutral-border)" }),
|
|
56
|
+
], children: [fields, _jsx(Button, { type: "submit", size: "sm", color: "neutral", variant: "surface", children: labels.applySuggestion })] })) : null] })) : null, replyAction || resolveAction ? (_jsxs("div", { "data-slot": "review-thread-footer", mix: [vstack({ gap: 2 })], children: [replyAction ? (_jsxs("form", { method: "post", action: replyAction, "data-rmx-target": frame, "data-slot": "review-thread-reply", mix: [vstack({ gap: 2 })], children: [fields, _jsx(TextArea, { name: REPLY_FIELD, required: true, rows: 2, "aria-label": labels.reply, placeholder: labels.replyPlaceholder }), _jsx("span", { mix: [hstack({ justify: "end" })], children: _jsx(Button, { type: "submit", size: "sm", children: labels.reply }) })] })) : null, resolveAction ? (_jsxs("form", { method: "post", action: resolveAction, "data-rmx-target": frame, "data-slot": "review-thread-resolve", children: [fields, _jsx("input", { type: "hidden", name: RESOLVED_FIELD, value: resolved ? "false" : "true" }), _jsx(Button, { type: "submit", size: "sm", color: "neutral", variant: "outline", children: resolved ? labels.unresolve : labels.resolve })] })) : null] })) : null] }));
|
|
57
|
+
return (_jsx("div", { ...rest, "data-slot": "review-thread", "data-state": state, mix: mergeMix([
|
|
58
|
+
minIs(0),
|
|
59
|
+
rounded("md"),
|
|
60
|
+
border({ color: "neutral.border", width: 1 }),
|
|
61
|
+
raw({
|
|
62
|
+
overflow: "clip",
|
|
63
|
+
backgroundColor: "var(--review-thread-bg)",
|
|
64
|
+
"--review-thread-bg": "var(--ui-surface-raised, var(--ui-bg, Canvas))",
|
|
65
|
+
}),
|
|
66
|
+
], mix), children: state === "open" ? (content) : (_jsxs("details", { "data-slot": "review-thread-details", children: [_jsxs("summary", { "data-slot": "review-thread-summary", mix: [
|
|
67
|
+
hstack({ gap: 2, align: "center" }),
|
|
68
|
+
flexWrap("wrap"),
|
|
69
|
+
pi(3),
|
|
70
|
+
pb(2),
|
|
71
|
+
text("sm"),
|
|
72
|
+
fg("neutral.muted"),
|
|
73
|
+
cursor("pointer"),
|
|
74
|
+
raw({ listStyle: "none", "&::-webkit-details-marker": { display: "none" } }),
|
|
75
|
+
focusVisible(outline({ color: "brand.ring", offset: -2 })),
|
|
76
|
+
], children: [_jsx(ChevronDownIcon, { size: 16, "aria-hidden": "true", mix: [
|
|
77
|
+
shrink(0),
|
|
78
|
+
raw({ rotate: "-90deg" }),
|
|
79
|
+
motionSafe(raw({ transition: "rotate 150ms ease" })),
|
|
80
|
+
when(":is(details[open] > summary) > &", raw({ rotate: "0deg" })),
|
|
81
|
+
] }), outdated ? (_jsx(Badge, { color: "warning", variant: "outline", "data-slot": "review-thread-outdated", children: labels.outdated })) : null, resolved ? _jsx("span", { children: resolvedSummary }) : null, !resolved && excerpt ? (_jsx("span", { mix: [font("mono"), text("xs"), raw({ overflowWrap: "anywhere" })], children: excerpt.path })) : null] }), _jsx("div", { mix: [raw({ borderBlockStart: "1px solid var(--ui-neutral-border)" })], children: content })] })) }));
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Which way the thread draws: open, or folded as resolved (first) or outdated. */
|
|
85
|
+
function threadState(resolved, outdated) {
|
|
86
|
+
if (resolved)
|
|
87
|
+
return "resolved";
|
|
88
|
+
if (outdated)
|
|
89
|
+
return "outdated";
|
|
90
|
+
return "open";
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Renders an excerpt: the file's path over its lines as a small unified diff, so the thread
|
|
94
|
+
* reads on the timeline, or after the diff moved on, as it did beside the code.
|
|
95
|
+
*
|
|
96
|
+
* @param handle Runtime handle carrying the excerpt.
|
|
97
|
+
* @returns The render function producing the excerpt.
|
|
98
|
+
*/
|
|
99
|
+
function ThreadLines(handle) {
|
|
100
|
+
return () => {
|
|
101
|
+
let { columns, lines } = handle.props;
|
|
102
|
+
return (_jsxs("figure", { "data-slot": "review-thread-excerpt", mix: [
|
|
103
|
+
raw({ margin: 0, overflow: "clip" }),
|
|
104
|
+
rounded("md"),
|
|
105
|
+
border({ color: "neutral.border", width: 1 }),
|
|
106
|
+
], children: [_jsx("figcaption", { mix: [
|
|
107
|
+
pi(3),
|
|
108
|
+
pb(1.5),
|
|
109
|
+
bg("neutral.bg-tint"),
|
|
110
|
+
font("mono"),
|
|
111
|
+
text("xs"),
|
|
112
|
+
weight(600),
|
|
113
|
+
raw({ overflowWrap: "anywhere" }),
|
|
114
|
+
], children: lines.path }), _jsx(Diff.Hunks, { path: lines.path, hunks: lines.hunks, language: lines.language, anchored: false, labels: { columns } })] }));
|
|
115
|
+
};
|
|
116
|
+
}
|
package/dist/app/save-bar.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export type SaveBarProps = {
|
|
|
17
17
|
labels: {
|
|
18
18
|
/** The bar's message, such as "Unsaved changes". */
|
|
19
19
|
message: string;
|
|
20
|
+
/**
|
|
21
|
+
* The question asked before a link the page follows in place would lose the changes,
|
|
22
|
+
* such as "Leave without saving your changes?". @default message
|
|
23
|
+
*/
|
|
24
|
+
leave?: string;
|
|
20
25
|
discard: string;
|
|
21
26
|
save: string;
|
|
22
27
|
/** The save shortcut as the platform writes it, such as "⌘S", shown on the Save button. */
|
package/dist/app/save-bar.js
CHANGED
|
@@ -28,7 +28,7 @@ export const SaveBar = clientEntry("@sdxc/ui/app/save-bar#SaveBar", function Sav
|
|
|
28
28
|
return () => {
|
|
29
29
|
let { form, labels } = handle.props;
|
|
30
30
|
return (_jsxs("div", { "data-slot": "save-bar", hidden: true, mix: [
|
|
31
|
-
saveBarSync({ form, message: labels.message }),
|
|
31
|
+
saveBarSync({ form, message: labels.message, leave: labels.leave }),
|
|
32
32
|
sticky(),
|
|
33
33
|
hstack({ gap: 3, align: "center" }),
|
|
34
34
|
raw({ insetBlockEnd: "1rem", flexWrap: "wrap", zIndex: 10 }),
|
|
@@ -46,6 +46,11 @@ export declare namespace SettingsLayout {
|
|
|
46
46
|
page?: "index" | "section";
|
|
47
47
|
/** Where the narrow back link returns to: the settings index route. */
|
|
48
48
|
backHref?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The named frame the section links and the back link load into (`data-rmx-target`), for
|
|
51
|
+
* a layout drawn inside that frame, so switching sections reloads it alone.
|
|
52
|
+
*/
|
|
53
|
+
frame?: string;
|
|
49
54
|
labels: Labels;
|
|
50
55
|
}
|
|
51
56
|
}
|
|
@@ -35,7 +35,7 @@ const NARROW = `@container ${LAYOUT_CONTAINER} (max-width: 47.999rem)`;
|
|
|
35
35
|
*/
|
|
36
36
|
export function SettingsLayout(handle) {
|
|
37
37
|
return () => {
|
|
38
|
-
let { sections, page: pageProp, backHref, labels, children, mix, ...rest } = handle.props;
|
|
38
|
+
let { sections, page: pageProp, backHref, frame, labels, children, mix, ...rest } = handle.props;
|
|
39
39
|
let page = pageProp ?? DEFAULT_PAGE;
|
|
40
40
|
let hasNav = sections !== undefined;
|
|
41
41
|
let isIndex = page === "index";
|
|
@@ -64,11 +64,11 @@ export function SettingsLayout(handle) {
|
|
|
64
64
|
alignSelf: "start",
|
|
65
65
|
},
|
|
66
66
|
}),
|
|
67
|
-
], children: sections.map((group) => (_jsx(SettingsNavGroup, { group: group }))) })) : null, _jsxs("div", { "data-slot": "settings-content", mix: [
|
|
67
|
+
], children: sections.map((group) => (_jsx(SettingsNavGroup, { group: group, frame: frame }))) })) : null, _jsxs("div", { "data-slot": "settings-content", mix: [
|
|
68
68
|
vstack({ gap: 8, align: "stretch" }),
|
|
69
69
|
minIs(0),
|
|
70
70
|
raw({ [NARROW]: { display: hideNarrowContent ? "none" : "flex" } }),
|
|
71
|
-
], children: [!isIndex && backHref ? (_jsxs("a", { href: backHref, "data-slot": "settings-back", mix: [
|
|
71
|
+
], children: [!isIndex && backHref ? (_jsxs("a", { href: backHref, "data-rmx-target": frame, "data-slot": "settings-back", mix: [
|
|
72
72
|
hstack({ gap: 1, align: "center" }),
|
|
73
73
|
raw({ alignSelf: "start", [WIDE]: { display: "none" } }),
|
|
74
74
|
text("sm"),
|
|
@@ -86,9 +86,9 @@ export function SettingsLayout(handle) {
|
|
|
86
86
|
*/
|
|
87
87
|
function SettingsNavGroup(handle) {
|
|
88
88
|
return () => {
|
|
89
|
-
let { group } = handle.props;
|
|
89
|
+
let { group, frame } = handle.props;
|
|
90
90
|
let headingId = group.label ? `${handle.id}-label` : undefined;
|
|
91
|
-
return (_jsxs("div", { mix: [vstack({ gap: 1, align: "stretch" })], children: [group.label ? (_jsx("p", { id: headingId, mix: [pi(2.5), text("xs"), weight("medium"), fg("neutral.muted")], children: group.label })) : null, _jsx("ul", { "aria-labelledby": headingId, mix: [vstack({ gap: 0.5, align: "stretch" }), listStyle(), m(0), p(0)], children: group.items.map((item) => (_jsx("li", { children: _jsx("a", { href: item.href, "aria-current": item.current ? "page" : undefined, "data-slot": "settings-nav-item", mix: [
|
|
91
|
+
return (_jsxs("div", { mix: [vstack({ gap: 1, align: "stretch" })], children: [group.label ? (_jsx("p", { id: headingId, mix: [pi(2.5), text("xs"), weight("medium"), fg("neutral.muted")], children: group.label })) : null, _jsx("ul", { "aria-labelledby": headingId, mix: [vstack({ gap: 0.5, align: "stretch" }), listStyle(), m(0), p(0)], children: group.items.map((item) => (_jsx("li", { children: _jsx("a", { href: item.href, "data-rmx-target": frame, "aria-current": item.current ? "page" : undefined, "data-slot": "settings-nav-item", mix: [
|
|
92
92
|
hstack({ gap: 2, align: "center" }),
|
|
93
93
|
pi(2.5),
|
|
94
94
|
rounded("md"),
|
package/dist/app/skeleton.d.ts
CHANGED
|
@@ -46,6 +46,14 @@ export declare namespace Skeleton {
|
|
|
46
46
|
/** Draws the chart band under the value, as a card with a sparkline has. */
|
|
47
47
|
chart?: boolean;
|
|
48
48
|
}
|
|
49
|
+
/** Props accepted by {@link Skeleton.Text}. */
|
|
50
|
+
interface TextProps extends TagProps<"span"> {
|
|
51
|
+
/**
|
|
52
|
+
* Draws one bar over the whole box instead of one per wrapped line, for an inline-flex
|
|
53
|
+
* box such as a badge or a button. @default false
|
|
54
|
+
*/
|
|
55
|
+
block?: boolean;
|
|
56
|
+
}
|
|
49
57
|
/** Props accepted by {@link Skeleton.List}. */
|
|
50
58
|
interface ListProps extends TagProps<"div">, Labelled {
|
|
51
59
|
/** Placeholder rows. Default: `5`. */
|
|
@@ -76,4 +84,5 @@ export declare namespace Skeleton {
|
|
|
76
84
|
var Table: (handle: Handle<Skeleton.TableProps>) => () => import("remix/component").RemixElement;
|
|
77
85
|
var Stat: (handle: Handle<Skeleton.StatProps>) => () => import("remix/component").RemixElement;
|
|
78
86
|
var List: (handle: Handle<Skeleton.ListProps>) => () => import("remix/component").RemixElement;
|
|
87
|
+
var Text: (handle: Handle<Skeleton.TextProps>) => () => import("remix/component").RemixElement;
|
|
79
88
|
}
|
package/dist/app/skeleton.js
CHANGED
|
@@ -183,3 +183,31 @@ Skeleton.List = function SkeletonList(handle) {
|
|
|
183
183
|
], children: [avatar ? (_jsx("span", { mix: [shrink(0), raw({ display: "inline-flex" })], children: _jsx(SkeletonBar, { width: "2rem", height: "2rem", round: true }) })) : null, _jsxs("span", { mix: [flex(), flexCol(), gap(2), grow()], children: [_jsx(SkeletonBar, { width: BAR_WIDTHS[row % BAR_WIDTHS.length] }), lines === 2 ? (_jsx(SkeletonBar, { width: BAR_WIDTHS[(row + 2) % BAR_WIDTHS.length], height: "0.625rem" })) : null] })] }, row))) }));
|
|
184
184
|
};
|
|
185
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* Lays out real content unseen and paints a bar over each line it wraps to, so a placeholder
|
|
188
|
+
* takes exactly the content's size at every width: a name that wraps on a phone wraps in its
|
|
189
|
+
* placeholder too. Hidden from assistive technology.
|
|
190
|
+
*
|
|
191
|
+
* @param handle Runtime handle carrying the host `<span>`'s props.
|
|
192
|
+
* @returns The render function producing the placeholder's markup.
|
|
193
|
+
* @example
|
|
194
|
+
* <p><Skeleton.Text>{person.name}</Skeleton.Text></p>
|
|
195
|
+
* @example
|
|
196
|
+
* <Skeleton.Text block><Badge>Follows you</Badge></Skeleton.Text>
|
|
197
|
+
*/
|
|
198
|
+
Skeleton.Text = function SkeletonText(handle) {
|
|
199
|
+
return () => {
|
|
200
|
+
let { block = false, children, mix, ...rest } = handle.props;
|
|
201
|
+
return (_jsx("span", { ...rest, "data-slot": "skeleton-text", mix: mergeMix([
|
|
202
|
+
attrs({ "aria-hidden": DEFAULT_ARIA_HIDDEN }),
|
|
203
|
+
raw({
|
|
204
|
+
borderRadius: block ? "9999px" : "var(--ui-radius-sm, 0.25rem)",
|
|
205
|
+
boxDecorationBreak: "clone",
|
|
206
|
+
WebkitBoxDecorationBreak: "clone",
|
|
207
|
+
userSelect: "none",
|
|
208
|
+
}),
|
|
209
|
+
block ? raw({ display: "inline-flex" }) : raw({}),
|
|
210
|
+
bg("neutral.border"),
|
|
211
|
+
], mix), children: _jsx("span", { mix: [raw({ visibility: "hidden", display: block ? "contents" : "inline" })], children: children }) }));
|
|
212
|
+
};
|
|
213
|
+
};
|
package/dist/app/split-view.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export declare namespace SplitView {
|
|
|
50
50
|
active?: Pane;
|
|
51
51
|
/** The list's URL; below 48rem the detail links back to it. */
|
|
52
52
|
backHref?: string;
|
|
53
|
+
/** The named frame the back link loads into (`data-rmx-target`), for a view inside one. */
|
|
54
|
+
frame?: string;
|
|
53
55
|
/** The remembered split, from {@link readSplitViewLayout}. */
|
|
54
56
|
layout?: Layout;
|
|
55
57
|
/**
|
|
@@ -58,6 +60,8 @@ export declare namespace SplitView {
|
|
|
58
60
|
* @default "ui-split-view"
|
|
59
61
|
*/
|
|
60
62
|
cookie?: string;
|
|
63
|
+
/** The path the layout cookie is sent under, such as one app's own prefix. @default "/" */
|
|
64
|
+
cookiePath?: string;
|
|
61
65
|
/**
|
|
62
66
|
* Where j/k answer: `"page"` anywhere, `"view"` only while focus is inside the view.
|
|
63
67
|
*
|