lldlab-ui 0.1.0 → 0.3.0
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 +706 -51
- package/dist/index.d.ts +952 -89
- package/dist/index.js +2020 -345
- package/dist/index.js.map +1 -1
- package/dist/theme.css +102 -2
- package/package.json +30 -12
package/dist/index.js
CHANGED
|
@@ -81,6 +81,27 @@ var HEADING_SIZE = {
|
|
|
81
81
|
lg: { display: "lg:text-display", xl: "lg:text-headline-xl", lg: "lg:text-headline-lg", md: "lg:text-headline-md", sm: "lg:text-headline-sm" },
|
|
82
82
|
xl: { display: "xl:text-display", xl: "xl:text-headline-xl", lg: "xl:text-headline-lg", md: "xl:text-headline-md", sm: "xl:text-headline-sm" }
|
|
83
83
|
};
|
|
84
|
+
var PADDING_TOP = {
|
|
85
|
+
base: { none: "pt-0", "2xs": "pt-space-2xs", xs: "pt-space-xs", sm: "pt-space-sm", md: "pt-space-md", lg: "pt-space-lg", xl: "pt-space-xl", "2xl": "pt-space-2xl" },
|
|
86
|
+
sm: { none: "sm:pt-0", "2xs": "sm:pt-space-2xs", xs: "sm:pt-space-xs", sm: "sm:pt-space-sm", md: "sm:pt-space-md", lg: "sm:pt-space-lg", xl: "sm:pt-space-xl", "2xl": "sm:pt-space-2xl" },
|
|
87
|
+
md: { none: "md:pt-0", "2xs": "md:pt-space-2xs", xs: "md:pt-space-xs", sm: "md:pt-space-sm", md: "md:pt-space-md", lg: "md:pt-space-lg", xl: "md:pt-space-xl", "2xl": "md:pt-space-2xl" },
|
|
88
|
+
lg: { none: "lg:pt-0", "2xs": "lg:pt-space-2xs", xs: "lg:pt-space-xs", sm: "lg:pt-space-sm", md: "lg:pt-space-md", lg: "lg:pt-space-lg", xl: "lg:pt-space-xl", "2xl": "lg:pt-space-2xl" },
|
|
89
|
+
xl: { none: "xl:pt-0", "2xs": "xl:pt-space-2xs", xs: "xl:pt-space-xs", sm: "xl:pt-space-sm", md: "xl:pt-space-md", lg: "xl:pt-space-lg", xl: "xl:pt-space-xl", "2xl": "xl:pt-space-2xl" }
|
|
90
|
+
};
|
|
91
|
+
var PADDING_BOTTOM = {
|
|
92
|
+
base: { none: "pb-0", "2xs": "pb-space-2xs", xs: "pb-space-xs", sm: "pb-space-sm", md: "pb-space-md", lg: "pb-space-lg", xl: "pb-space-xl", "2xl": "pb-space-2xl" },
|
|
93
|
+
sm: { none: "sm:pb-0", "2xs": "sm:pb-space-2xs", xs: "sm:pb-space-xs", sm: "sm:pb-space-sm", md: "sm:pb-space-md", lg: "sm:pb-space-lg", xl: "sm:pb-space-xl", "2xl": "sm:pb-space-2xl" },
|
|
94
|
+
md: { none: "md:pb-0", "2xs": "md:pb-space-2xs", xs: "md:pb-space-xs", sm: "md:pb-space-sm", md: "md:pb-space-md", lg: "md:pb-space-lg", xl: "md:pb-space-xl", "2xl": "md:pb-space-2xl" },
|
|
95
|
+
lg: { none: "lg:pb-0", "2xs": "lg:pb-space-2xs", xs: "lg:pb-space-xs", sm: "lg:pb-space-sm", md: "lg:pb-space-md", lg: "lg:pb-space-lg", xl: "lg:pb-space-xl", "2xl": "lg:pb-space-2xl" },
|
|
96
|
+
xl: { none: "xl:pb-0", "2xs": "xl:pb-space-2xs", xs: "xl:pb-space-xs", sm: "xl:pb-space-sm", md: "xl:pb-space-md", lg: "xl:pb-space-lg", xl: "xl:pb-space-xl", "2xl": "xl:pb-space-2xl" }
|
|
97
|
+
};
|
|
98
|
+
var COL_SPAN = {
|
|
99
|
+
base: { 1: "col-span-1", 2: "col-span-2", 3: "col-span-3", 4: "col-span-4", 5: "col-span-5", 6: "col-span-6" },
|
|
100
|
+
sm: { 1: "sm:col-span-1", 2: "sm:col-span-2", 3: "sm:col-span-3", 4: "sm:col-span-4", 5: "sm:col-span-5", 6: "sm:col-span-6" },
|
|
101
|
+
md: { 1: "md:col-span-1", 2: "md:col-span-2", 3: "md:col-span-3", 4: "md:col-span-4", 5: "md:col-span-5", 6: "md:col-span-6" },
|
|
102
|
+
lg: { 1: "lg:col-span-1", 2: "lg:col-span-2", 3: "lg:col-span-3", 4: "lg:col-span-4", 5: "lg:col-span-5", 6: "lg:col-span-6" },
|
|
103
|
+
xl: { 1: "xl:col-span-1", 2: "xl:col-span-2", 3: "xl:col-span-3", 4: "xl:col-span-4", 5: "xl:col-span-5", 6: "xl:col-span-6" }
|
|
104
|
+
};
|
|
84
105
|
|
|
85
106
|
// src/primitives/Box.tsx
|
|
86
107
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
@@ -89,18 +110,29 @@ var SURFACE_TONE = {
|
|
|
89
110
|
subtle: "bg-surface-subtle text-on-surface",
|
|
90
111
|
elevated: "bg-surface-elevated text-on-surface",
|
|
91
112
|
low: "bg-surface-container-low text-on-surface",
|
|
113
|
+
container: "bg-surface-container text-on-surface",
|
|
92
114
|
inverse: "bg-brand-obsidian text-on-primary"
|
|
93
115
|
};
|
|
94
116
|
var RADIUS = { none: "", sm: "rounded", md: "rounded-lg", lg: "rounded-xl" };
|
|
95
117
|
var BORDER = { none: "", subtle: "border border-border-subtle", strong: "border border-border-strong" };
|
|
96
118
|
var SHADOW = { none: "", sm: "shadow-sm", md: "shadow-md" };
|
|
97
|
-
function Box({ as, padding, radius = "none", tone, border = "none", shadow = "none", ...rest }) {
|
|
119
|
+
function Box({ as, padding, radius = "none", tone, border = "none", shadow = "none", dimmed, ...rest }) {
|
|
98
120
|
const C = as ?? "div";
|
|
99
121
|
return /* @__PURE__ */ jsx2(
|
|
100
122
|
C,
|
|
101
123
|
{
|
|
102
124
|
...rest,
|
|
103
|
-
|
|
125
|
+
"data-theme": tone === "inverse" ? "dark" : void 0,
|
|
126
|
+
inert: dimmed || void 0,
|
|
127
|
+
className: cx(
|
|
128
|
+
"min-w-0 max-w-full",
|
|
129
|
+
tone && SURFACE_TONE[tone],
|
|
130
|
+
responsive(PADDING, padding),
|
|
131
|
+
RADIUS[radius],
|
|
132
|
+
BORDER[border],
|
|
133
|
+
SHADOW[shadow],
|
|
134
|
+
dimmed && "pointer-events-none select-none opacity-40"
|
|
135
|
+
)
|
|
104
136
|
}
|
|
105
137
|
);
|
|
106
138
|
}
|
|
@@ -132,6 +164,10 @@ function Grid({ as, cols = 1, gap = "md", ...rest }) {
|
|
|
132
164
|
const c = typeof cols === "object" ? { base: 1, ...cols } : { base: 1, md: cols };
|
|
133
165
|
return /* @__PURE__ */ jsx4(C, { ...rest, className: cx("grid min-w-0", responsive(COLS, c), responsive(GAP, gap)) });
|
|
134
166
|
}
|
|
167
|
+
function GridItem({ as, span, ...rest }) {
|
|
168
|
+
const C = as ?? "div";
|
|
169
|
+
return /* @__PURE__ */ jsx4(C, { ...rest, className: cx("min-w-0", responsive(COL_SPAN, span)) });
|
|
170
|
+
}
|
|
135
171
|
|
|
136
172
|
// src/primitives/Container.tsx
|
|
137
173
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
@@ -143,21 +179,49 @@ function Container({ as, size = "xl", ...rest }) {
|
|
|
143
179
|
|
|
144
180
|
// src/primitives/Section.tsx
|
|
145
181
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
146
|
-
var PADDING2 = { md: "py-section-md", lg: "py-section-lg", xl: "py-section-xl" };
|
|
147
|
-
var PATTERN = { none: "", dots: "bg-pattern-dots", grid: "bg-pattern-grid" };
|
|
148
|
-
function Section({ as, tone, padding = "lg", pattern = "none", ...rest }) {
|
|
182
|
+
var PADDING2 = { none: "", md: "py-section-md", lg: "py-section-lg", xl: "py-section-xl" };
|
|
183
|
+
var PATTERN = { none: "", dots: "bg-pattern-dots", "dots-brand": "bg-pattern-dots-brand", grid: "bg-pattern-grid" };
|
|
184
|
+
function Section({ as, tone, padding = "lg", paddingTop, paddingBottom, pattern = "none", ...rest }) {
|
|
185
|
+
const fixed = paddingTop !== void 0 || paddingBottom !== void 0;
|
|
149
186
|
const C = as ?? "section";
|
|
150
|
-
return /* @__PURE__ */ jsx6(C, { ...rest, className: cx("w-full min-w-0", tone && SURFACE_TONE[tone], PADDING2[padding], PATTERN[pattern]) });
|
|
187
|
+
return /* @__PURE__ */ jsx6(C, { ...rest, "data-theme": tone === "inverse" ? "dark" : void 0, className: cx("w-full min-w-0", tone && SURFACE_TONE[tone], fixed ? cx(responsive(PADDING_TOP, paddingTop), responsive(PADDING_BOTTOM, paddingBottom)) : PADDING2[padding], PATTERN[pattern]) });
|
|
151
188
|
}
|
|
152
189
|
|
|
153
190
|
// src/primitives/Split.tsx
|
|
154
191
|
import { jsx as jsx7, jsxs } from "react/jsx-runtime";
|
|
155
|
-
var MAIN = {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
192
|
+
var MAIN = {
|
|
193
|
+
lg: { "8/4": "lg:col-span-8", "1/1": "lg:col-span-6", "9/3": "lg:col-span-9", "7/5": "lg:col-span-7", "5/7": "lg:col-span-5" },
|
|
194
|
+
xl: { "8/4": "xl:col-span-8", "1/1": "xl:col-span-6", "9/3": "xl:col-span-9", "7/5": "xl:col-span-7", "5/7": "xl:col-span-5" }
|
|
195
|
+
};
|
|
196
|
+
var ASIDE = {
|
|
197
|
+
lg: { "8/4": "lg:col-span-4", "1/1": "lg:col-span-6", "9/3": "lg:col-span-3", "7/5": "lg:col-span-5", "5/7": "lg:col-span-7" },
|
|
198
|
+
xl: { "8/4": "xl:col-span-4", "1/1": "xl:col-span-6", "9/3": "xl:col-span-3", "7/5": "xl:col-span-5", "5/7": "xl:col-span-7" }
|
|
199
|
+
};
|
|
200
|
+
var GRID = { lg: "lg:grid-cols-12", xl: "xl:grid-cols-12" };
|
|
201
|
+
var STICKY_ASIDE = {
|
|
202
|
+
none: "xl:sticky xl:top-space-lg xl:self-start",
|
|
203
|
+
appbar: "xl:sticky xl:top-[calc(var(--spacing-appbar)+1rem)] xl:self-start"
|
|
204
|
+
};
|
|
205
|
+
var STICKY_ASIDE_LG = {
|
|
206
|
+
none: "lg:sticky lg:top-space-lg lg:self-start",
|
|
207
|
+
appbar: "lg:sticky lg:top-[calc(var(--spacing-appbar)+1rem)] lg:self-start"
|
|
208
|
+
};
|
|
209
|
+
var STICKY_START = {
|
|
210
|
+
none: "lg:sticky lg:top-space-lg lg:self-start",
|
|
211
|
+
appbar: "lg:sticky lg:top-[calc(var(--spacing-appbar)+1rem)] lg:self-start"
|
|
212
|
+
};
|
|
213
|
+
function Split({ ratio = "8/4", breakpoint = "xl", asideAs = "aside", aside, start, sticky, stickyOffset = "none", gap = "lg", children, ...rest }) {
|
|
214
|
+
if (start) {
|
|
215
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, className: cx("grid min-w-0 grid-cols-1 lg:grid-cols-12", responsive(GAP, gap)), children: [
|
|
216
|
+
/* @__PURE__ */ jsx7("div", { className: cx("hidden min-w-0 lg:col-span-3 lg:block xl:col-span-2", sticky && STICKY_START[stickyOffset]), children: start }),
|
|
217
|
+
/* @__PURE__ */ jsx7("div", { className: "min-w-0 lg:col-span-9 xl:col-span-7", children }),
|
|
218
|
+
/* @__PURE__ */ jsx7("aside", { className: cx("min-w-0 lg:col-span-9 lg:col-start-4 xl:col-span-3 xl:col-start-auto", sticky && STICKY_ASIDE[stickyOffset]), children: aside })
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
const Side = asideAs;
|
|
222
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, className: cx("grid min-w-0 grid-cols-1", GRID[breakpoint], responsive(GAP, gap)), children: [
|
|
223
|
+
/* @__PURE__ */ jsx7("div", { className: cx("min-w-0", MAIN[breakpoint][ratio]), children }),
|
|
224
|
+
/* @__PURE__ */ jsx7(Side, { className: cx("min-w-0", ASIDE[breakpoint][ratio], sticky && (breakpoint === "lg" ? STICKY_ASIDE_LG : STICKY_ASIDE)[stickyOffset]), children: aside })
|
|
161
225
|
] });
|
|
162
226
|
}
|
|
163
227
|
|
|
@@ -182,7 +246,7 @@ var DOT_TONE = {
|
|
|
182
246
|
|
|
183
247
|
// src/components/Icon.tsx
|
|
184
248
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
185
|
-
var SIZE2 = { sm: "text-[16px]", md: "text-[20px]", lg: "text-[24px]" };
|
|
249
|
+
var SIZE2 = { xs: "text-[14px]", sm: "text-[16px]", ms: "text-[18px]", md: "text-[20px]", lg: "text-[24px]", xl: "text-[32px]" };
|
|
186
250
|
function Icon({ name, size = "md", tone = "inherit", filled, spin, label, ...rest }) {
|
|
187
251
|
return /* @__PURE__ */ jsx8(
|
|
188
252
|
"span",
|
|
@@ -205,7 +269,7 @@ function Icon({ name, size = "md", tone = "inherit", filled, spin, label, ...res
|
|
|
205
269
|
|
|
206
270
|
// src/components/Dot.tsx
|
|
207
271
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
208
|
-
var SIZE3 = { sm: "size-1.5", md: "size-2" };
|
|
272
|
+
var SIZE3 = { sm: "size-1.5", md: "size-2", lg: "size-3" };
|
|
209
273
|
function Dot({ tone = "neutral", size = "sm", pulse, ...rest }) {
|
|
210
274
|
return /* @__PURE__ */ jsx9("span", { ...rest, "aria-hidden": "true", className: cx("inline-block shrink-0 rounded-full", DOT_TONE[tone], SIZE3[size], pulse && "animate-pulse") });
|
|
211
275
|
}
|
|
@@ -216,18 +280,45 @@ var VARIANT = {
|
|
|
216
280
|
"body-lead": "font-body-lead text-body-lead",
|
|
217
281
|
"body-md": "font-body-md text-body-md",
|
|
218
282
|
"body-sm": "font-body-sm text-body-sm",
|
|
219
|
-
label: "font-label-mono text-label-mono
|
|
220
|
-
code: "font-code-inline text-code-inline"
|
|
283
|
+
label: "font-label-mono text-label-mono",
|
|
284
|
+
code: "font-code-inline text-code-inline",
|
|
285
|
+
/** Inherits font and size from the parent (inline highlights inside a Heading). */
|
|
286
|
+
inherit: ""
|
|
221
287
|
};
|
|
222
288
|
var WEIGHT = { regular: "", medium: "font-medium", semibold: "font-semibold" };
|
|
223
289
|
var CLAMP = { 1: "line-clamp-1", 2: "line-clamp-2", 3: "line-clamp-3", 4: "line-clamp-4" };
|
|
224
|
-
|
|
290
|
+
var ALIGN2 = { start: "text-start", center: "text-center", end: "text-end" };
|
|
291
|
+
function Text({
|
|
292
|
+
as,
|
|
293
|
+
variant = "body-md",
|
|
294
|
+
tone = "default",
|
|
295
|
+
weight = "regular",
|
|
296
|
+
truncate,
|
|
297
|
+
clamp: clamp2,
|
|
298
|
+
align,
|
|
299
|
+
measure,
|
|
300
|
+
uppercase,
|
|
301
|
+
underline,
|
|
302
|
+
...rest
|
|
303
|
+
}) {
|
|
225
304
|
const C = as ?? "p";
|
|
305
|
+
const upper = uppercase ?? variant === "label";
|
|
226
306
|
return /* @__PURE__ */ jsx10(
|
|
227
307
|
C,
|
|
228
308
|
{
|
|
229
309
|
...rest,
|
|
230
|
-
className: cx(
|
|
310
|
+
className: cx(
|
|
311
|
+
"min-w-0 wrap-break-word",
|
|
312
|
+
VARIANT[variant],
|
|
313
|
+
TEXT_TONE[tone],
|
|
314
|
+
WEIGHT[weight],
|
|
315
|
+
truncate && "truncate",
|
|
316
|
+
clamp2 && CLAMP[clamp2],
|
|
317
|
+
align && ALIGN2[align],
|
|
318
|
+
measure && "max-w-prose",
|
|
319
|
+
upper && "uppercase",
|
|
320
|
+
underline === "wavy" && "underline decoration-wavy decoration-2 decoration-brand-crimson/30 underline-offset-4"
|
|
321
|
+
)
|
|
231
322
|
}
|
|
232
323
|
);
|
|
233
324
|
}
|
|
@@ -236,17 +327,39 @@ function Text({ as, variant = "body-md", tone = "default", weight = "regular", t
|
|
|
236
327
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
237
328
|
var TAG = { 1: "h1", 2: "h2", 3: "h3", 4: "h4" };
|
|
238
329
|
var DEFAULT_SIZE = { 1: "xl", 2: "lg", 3: "md", 4: "sm" };
|
|
239
|
-
var TONE = {
|
|
240
|
-
|
|
330
|
+
var TONE = {
|
|
331
|
+
default: "text-ink",
|
|
332
|
+
muted: "text-on-surface-variant",
|
|
333
|
+
brand: "text-fg-brand",
|
|
334
|
+
inverse: "text-on-primary",
|
|
335
|
+
success: "text-fg-success",
|
|
336
|
+
danger: "text-fg-danger",
|
|
337
|
+
warning: "text-fg-warning"
|
|
338
|
+
};
|
|
339
|
+
var ALIGN3 = { start: "", center: "text-center" };
|
|
340
|
+
function Heading({ level, size, tone = "default", truncate, align = "start", balance = true, leading, ...rest }) {
|
|
241
341
|
const C = TAG[level];
|
|
242
|
-
return /* @__PURE__ */ jsx11(
|
|
342
|
+
return /* @__PURE__ */ jsx11(
|
|
343
|
+
C,
|
|
344
|
+
{
|
|
345
|
+
...rest,
|
|
346
|
+
className: cx("min-w-0 font-display", truncate ? "truncate" : cx(balance && "text-balance", "wrap-break-word"), responsive(HEADING_SIZE, size ?? DEFAULT_SIZE[level]), leading === "none" && "leading-none", TONE[tone], ALIGN3[align])
|
|
347
|
+
}
|
|
348
|
+
);
|
|
243
349
|
}
|
|
244
350
|
|
|
245
351
|
// src/primitives/Eyebrow.tsx
|
|
246
352
|
import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
353
|
+
var VARIANT2 = {
|
|
354
|
+
pill: "rounded-full bg-surface-elevated shadow-sm px-space-sm py-space-2xs",
|
|
355
|
+
tinted: "rounded-full bg-surface-container px-space-sm py-space-2xs",
|
|
356
|
+
plain: ""
|
|
357
|
+
};
|
|
358
|
+
var TEXT = { neutral: "text-on-surface-variant", brand: "text-fg-brand", success: "text-fg-success", warning: "text-fg-warning", danger: "text-fg-danger" };
|
|
359
|
+
function Eyebrow({ tone = "brand", pulse, variant = "pill", dot = true, children, ...rest }) {
|
|
360
|
+
const text = variant === "tinted" && tone === "brand" ? "text-badge-intermediate-text" : TEXT[tone];
|
|
361
|
+
return /* @__PURE__ */ jsxs2("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-xs font-label-mono text-label-mono uppercase", text, VARIANT2[variant]), children: [
|
|
362
|
+
dot && /* @__PURE__ */ jsx12(Dot, { tone, pulse, "data-dot": "" }),
|
|
250
363
|
/* @__PURE__ */ jsx12("span", { className: "truncate", children })
|
|
251
364
|
] });
|
|
252
365
|
}
|
|
@@ -258,11 +371,124 @@ function Code({ children, ...rest }) {
|
|
|
258
371
|
}
|
|
259
372
|
|
|
260
373
|
// src/primitives/CodeBlock.tsx
|
|
261
|
-
import {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
374
|
+
import { useTokenize } from "prism-react-renderer";
|
|
375
|
+
|
|
376
|
+
// src/internal/highlight.ts
|
|
377
|
+
import { Prism } from "prism-react-renderer";
|
|
378
|
+
if (!Prism.languages.java) {
|
|
379
|
+
Prism.languages.java = Prism.languages.extend("clike", {
|
|
380
|
+
keyword: /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|record|return|sealed|short|static|super|switch|synchronized|this|throw|throws|transient|try|var|void|volatile|while|yield)\b/,
|
|
381
|
+
"class-name": /\b[A-Z]\w*\b/,
|
|
382
|
+
number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?[dfl]?/i
|
|
383
|
+
});
|
|
384
|
+
Prism.languages.insertBefore("java", "keyword", { annotation: { pattern: /@\w+/, alias: "punctuation" } });
|
|
385
|
+
}
|
|
386
|
+
if (!Prism.languages.bash) {
|
|
387
|
+
Prism.languages.bash = {
|
|
388
|
+
comment: { pattern: /(^|\s)#.*/, lookbehind: true },
|
|
389
|
+
string: [/"(?:\\.|[^"\\])*"/, /'[^']*'/],
|
|
390
|
+
variable: /\$(?:\w+|\{[^}]+\})/,
|
|
391
|
+
function: /\b(?:cd|echo|export|go|npm|npx|node|python3?|pip|git|ls|cat|curl|make)\b/,
|
|
392
|
+
operator: /&&|\|\||[|;<>]/,
|
|
393
|
+
punctuation: /[{}()[\]]/
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
var ALIAS = {
|
|
397
|
+
ts: "typescript",
|
|
398
|
+
typescript: "typescript",
|
|
399
|
+
tsx: "tsx",
|
|
400
|
+
js: "javascript",
|
|
401
|
+
javascript: "javascript",
|
|
402
|
+
jsx: "jsx",
|
|
403
|
+
py: "python",
|
|
404
|
+
python: "python",
|
|
405
|
+
go: "go",
|
|
406
|
+
golang: "go",
|
|
407
|
+
java: "java",
|
|
408
|
+
json: "json",
|
|
409
|
+
bash: "bash",
|
|
410
|
+
sh: "bash",
|
|
411
|
+
shell: "bash"
|
|
412
|
+
};
|
|
413
|
+
function resolveLanguage(lang) {
|
|
414
|
+
const id = lang ? ALIAS[lang.toLowerCase()] : void 0;
|
|
415
|
+
return id && Prism.languages[id] ? id : void 0;
|
|
416
|
+
}
|
|
417
|
+
var TOKEN_CLASS = {
|
|
418
|
+
keyword: "text-code-keyword",
|
|
419
|
+
builtin: "text-code-keyword",
|
|
420
|
+
tag: "text-code-keyword",
|
|
421
|
+
important: "text-code-keyword",
|
|
422
|
+
boolean: "text-code-number",
|
|
423
|
+
number: "text-code-number",
|
|
424
|
+
constant: "text-code-number",
|
|
425
|
+
string: "text-code-string",
|
|
426
|
+
char: "text-code-string",
|
|
427
|
+
"template-string": "text-code-string",
|
|
428
|
+
"attr-value": "text-code-string",
|
|
429
|
+
regex: "text-code-string",
|
|
430
|
+
comment: "text-code-comment italic",
|
|
431
|
+
prolog: "text-code-comment italic",
|
|
432
|
+
doctype: "text-code-comment italic",
|
|
433
|
+
function: "text-code-function",
|
|
434
|
+
"function-variable": "text-code-function",
|
|
435
|
+
variable: "text-code-function",
|
|
436
|
+
"class-name": "text-code-type",
|
|
437
|
+
"maybe-class-name": "text-code-type",
|
|
438
|
+
"attr-name": "text-code-type",
|
|
439
|
+
property: "text-code-type",
|
|
440
|
+
operator: "text-code-punctuation",
|
|
441
|
+
punctuation: "text-code-punctuation"
|
|
442
|
+
};
|
|
443
|
+
function tokenClass(types) {
|
|
444
|
+
for (let i = types.length - 1; i >= 0; i--) {
|
|
445
|
+
const c = TOKEN_CLASS[types[i]];
|
|
446
|
+
if (c) return c;
|
|
447
|
+
}
|
|
448
|
+
return "";
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// src/primitives/CodeBlock.tsx
|
|
452
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
453
|
+
var TONE2 = {
|
|
454
|
+
dark: { root: "bg-brand-obsidian", header: "border-white/10 text-slate-300" },
|
|
455
|
+
subtle: { root: "code-subtle border border-border-subtle bg-code-bg-subtle", header: "border-border-subtle text-on-surface-variant" }
|
|
456
|
+
};
|
|
457
|
+
function Lines({ lines, numbered }) {
|
|
458
|
+
return /* @__PURE__ */ jsx14(Fragment, { children: lines.map((line, i) => /* @__PURE__ */ jsxs3("span", { className: "table-row", children: [
|
|
459
|
+
numbered && /* @__PURE__ */ jsx14("span", { "aria-hidden": "true", className: "table-cell select-none pr-space-md text-right text-code-comment", children: i + 1 }),
|
|
460
|
+
/* @__PURE__ */ jsxs3("span", { className: "table-cell", children: [
|
|
461
|
+
line.map((t, j) => /* @__PURE__ */ jsx14("span", { className: t.className || void 0, children: t.content }, j)),
|
|
462
|
+
"\n"
|
|
463
|
+
] })
|
|
464
|
+
] }, i)) });
|
|
465
|
+
}
|
|
466
|
+
function Highlighted({ code, language, numbered }) {
|
|
467
|
+
const tokens = useTokenize({ prism: Prism, code, grammar: Prism.languages[language], language });
|
|
468
|
+
return /* @__PURE__ */ jsx14(Lines, { numbered, lines: tokens.map((line) => line.map((t) => ({ content: t.content, className: tokenClass(t.types) }))) });
|
|
469
|
+
}
|
|
470
|
+
function CodeBlock({ language, highlight, title, meta, actions, lineNumbers, tone = "dark", bare, children, ...rest }) {
|
|
471
|
+
const t = TONE2[tone];
|
|
472
|
+
const code = typeof children === "string" ? children.replace(/\n$/, "") : null;
|
|
473
|
+
const lang = highlight && code !== null ? resolveLanguage(language) : void 0;
|
|
474
|
+
const heading = title ?? language;
|
|
475
|
+
let body = children;
|
|
476
|
+
if (code !== null && lang) body = /* @__PURE__ */ jsx14(Highlighted, { code, language: lang, numbered: lineNumbers });
|
|
477
|
+
else if (code !== null && lineNumbers) body = /* @__PURE__ */ jsx14(Lines, { numbered: true, lines: code.split("\n").map((l) => [{ content: l, className: "" }]) });
|
|
478
|
+
return /* @__PURE__ */ jsxs3("figure", { ...rest, "data-theme": tone === "dark" ? "dark" : void 0, className: cx("min-w-0 max-w-full overflow-hidden", !bare && cx("rounded-xl", t.root)), children: [
|
|
479
|
+
!bare && (heading || meta || actions) && /* @__PURE__ */ jsxs3("figcaption", { className: cx("flex min-w-0 flex-wrap items-center gap-space-sm border-b px-space-md py-space-xs font-label-mono text-label-mono", t.header), children: [
|
|
480
|
+
heading && /* @__PURE__ */ jsx14("span", { className: cx("min-w-0 truncate", !title && "uppercase"), children: heading }),
|
|
481
|
+
meta,
|
|
482
|
+
actions && /* @__PURE__ */ jsx14("span", { className: "ml-auto flex shrink-0 items-center gap-space-xs", children: actions })
|
|
483
|
+
] }),
|
|
484
|
+
/* @__PURE__ */ jsx14(
|
|
485
|
+
"pre",
|
|
486
|
+
{
|
|
487
|
+
tabIndex: 0,
|
|
488
|
+
className: cx("overflow-x-auto font-code-inline text-code-inline text-code-plain focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt", bare ? "p-0" : "p-space-md"),
|
|
489
|
+
children: /* @__PURE__ */ jsx14("code", { className: lineNumbers ? "table" : void 0, children: body })
|
|
490
|
+
}
|
|
491
|
+
)
|
|
266
492
|
] });
|
|
267
493
|
}
|
|
268
494
|
|
|
@@ -279,7 +505,7 @@ var components = {
|
|
|
279
505
|
h6: ({ children }) => /* @__PURE__ */ jsx15(Heading, { level: 4, size: "sm", children }),
|
|
280
506
|
p: ({ children }) => /* @__PURE__ */ jsx15("p", { className: "font-body-md text-body-md text-on-surface wrap-break-word", children }),
|
|
281
507
|
strong: ({ children }) => /* @__PURE__ */ jsx15("strong", { className: "font-semibold text-ink", children }),
|
|
282
|
-
a: ({ href, children }) => /* @__PURE__ */ jsx15("a", { href, className: "text-fg-brand underline underline-offset-2 hover:text-brand-
|
|
508
|
+
a: ({ href, children }) => /* @__PURE__ */ jsx15("a", { href, className: "text-fg-brand underline underline-offset-2 hover:text-fg-brand-hover wrap-break-word", children }),
|
|
283
509
|
ul: ({ className, children }) => /* @__PURE__ */ jsx15("ul", { className: cx("flex flex-col gap-space-xs", className === "contains-task-list" ? "pl-0" : "list-disc pl-space-lg"), children }),
|
|
284
510
|
ol: ({ children }) => /* @__PURE__ */ jsx15("ol", { className: "flex list-decimal flex-col gap-space-xs pl-space-lg", children }),
|
|
285
511
|
li: ({ className, children }) => /* @__PURE__ */ jsx15("li", { className: cx("font-body-md text-body-md text-on-surface", className === "task-list-item" ? "flex list-none items-start gap-space-xs wrap-anywhere" : "wrap-break-word"), children }),
|
|
@@ -304,25 +530,41 @@ function Markdown({ children, ...rest }) {
|
|
|
304
530
|
}
|
|
305
531
|
|
|
306
532
|
// src/components/Badge.tsx
|
|
307
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
308
|
-
var
|
|
533
|
+
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
534
|
+
var TONE3 = {
|
|
309
535
|
neutral: "bg-surface-muted text-on-surface-variant",
|
|
536
|
+
subtle: "bg-surface-subtle text-on-surface",
|
|
537
|
+
container: "bg-surface-container text-secondary",
|
|
310
538
|
brand: "bg-ink text-on-ink",
|
|
311
539
|
success: "bg-badge-beginner-bg text-badge-beginner-text",
|
|
312
540
|
warning: "bg-badge-amber-bg text-badge-amber-text",
|
|
313
541
|
danger: "bg-badge-advanced-bg text-badge-advanced-text",
|
|
314
542
|
info: "bg-badge-intermediate-bg text-badge-intermediate-text"
|
|
315
543
|
};
|
|
316
|
-
var SIZE4 = { sm: "px-space-xs py-space-2xs", md: "px-space-sm py-space-xs" };
|
|
317
|
-
|
|
318
|
-
|
|
544
|
+
var SIZE4 = { xs: "px-space-xs py-space-2xs text-[10px]", sm: "px-space-xs py-space-2xs", md: "px-space-sm py-space-xs" };
|
|
545
|
+
var SHAPE = { square: "rounded", pill: "rounded-full" };
|
|
546
|
+
function Badge({ tone = "neutral", uppercase, size = "sm", shape = "square", outlined, icon, dot, pulse, children, ...rest }) {
|
|
547
|
+
return /* @__PURE__ */ jsxs4("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-2xs whitespace-nowrap font-label-mono text-label-mono", SHAPE[shape], TONE3[tone], SIZE4[size], outlined && "border border-current/25", uppercase && "uppercase"), children: [
|
|
548
|
+
dot && /* @__PURE__ */ jsx16(Dot, { tone: dot, pulse }),
|
|
549
|
+
icon && /* @__PURE__ */ jsx16(Icon, { name: icon, size: "sm" }),
|
|
550
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate", children })
|
|
551
|
+
] });
|
|
319
552
|
}
|
|
320
553
|
|
|
321
554
|
// src/components/Chip.tsx
|
|
322
|
-
import { jsx as jsx17, jsxs as
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
|
|
555
|
+
import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
556
|
+
var TONE4 = {
|
|
557
|
+
neutral: "border-border-subtle text-on-surface",
|
|
558
|
+
brand: "border-brand-cobalt/40 text-fg-brand",
|
|
559
|
+
info: "border-brand-cobalt/40 text-fg-brand",
|
|
560
|
+
success: "border-fg-success/40 text-fg-success",
|
|
561
|
+
warning: "border-fg-warning/40 text-fg-warning",
|
|
562
|
+
danger: "border-fg-danger/40 text-fg-danger"
|
|
563
|
+
};
|
|
564
|
+
var isStatusTone = (d) => d in DOT_TONE;
|
|
565
|
+
function Chip({ tone = "neutral", icon, dot, onRemove, children, ...rest }) {
|
|
566
|
+
return /* @__PURE__ */ jsxs5("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-2xs rounded-full border bg-surface-elevated px-space-sm py-space-2xs font-body-sm text-body-sm", TONE4[tone]), children: [
|
|
567
|
+
dot && (isStatusTone(dot) ? /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: cx("inline-block size-1.5 shrink-0 rounded-full", DOT_TONE[dot]) }) : /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: "inline-block size-1.5 shrink-0 rounded-full", style: { backgroundColor: dot } })),
|
|
326
568
|
icon && /* @__PURE__ */ jsx17(Icon, { name: icon, size: "sm" }),
|
|
327
569
|
/* @__PURE__ */ jsx17("span", { className: "truncate", children }),
|
|
328
570
|
onRemove && /* @__PURE__ */ jsx17(
|
|
@@ -339,33 +581,33 @@ function Chip({ tone = "neutral", icon, onRemove, children, ...rest }) {
|
|
|
339
581
|
}
|
|
340
582
|
|
|
341
583
|
// src/components/Stat.tsx
|
|
342
|
-
import { jsx as jsx18, jsxs as
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
584
|
+
import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
585
|
+
var ICON_TONE = { muted: "text-on-surface-variant", brand: "text-brand-cobalt", success: "text-brand-emerald", warning: "text-brand-amber", danger: "text-brand-crimson" };
|
|
586
|
+
var VARIANT3 = { plain: "gap-space-sm", tile: "gap-space-xs rounded-lg bg-surface-subtle px-space-md py-space-xs shadow-sm" };
|
|
587
|
+
function Stat({ icon, label, value, variant = "plain", iconTone = "muted", ...rest }) {
|
|
588
|
+
return /* @__PURE__ */ jsxs6("div", { ...rest, className: cx("flex min-w-0 items-center", VARIANT3[variant]), children: [
|
|
589
|
+
/* @__PURE__ */ jsx18("span", { className: ICON_TONE[iconTone], children: /* @__PURE__ */ jsx18(Icon, { name: icon, tone: "inherit" }) }),
|
|
590
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
591
|
+
/* @__PURE__ */ jsx18("p", { className: "truncate font-label-mono text-label-mono uppercase leading-none text-on-surface-variant", children: label }),
|
|
592
|
+
/* @__PURE__ */ jsx18("p", { className: "mt-space-2xs truncate font-display text-headline-sm leading-none text-ink", children: value })
|
|
349
593
|
] })
|
|
350
594
|
] });
|
|
351
595
|
}
|
|
352
596
|
|
|
353
597
|
// src/components/ProgressBar.tsx
|
|
354
598
|
import { useId } from "react";
|
|
355
|
-
import { jsx as jsx19, jsxs as
|
|
356
|
-
var
|
|
357
|
-
|
|
599
|
+
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
600
|
+
var TONE5 = { brand: "bg-brand-cobalt", success: "bg-brand-emerald", warning: "bg-brand-amber", danger: "bg-brand-crimson" };
|
|
601
|
+
var SIZE5 = { sm: "h-1", md: "h-1.5" };
|
|
602
|
+
function ProgressBar({ value, max = 100, tone = "brand", label, hideLabel, valueLabel, caption, size = "md", ...rest }) {
|
|
358
603
|
const id = useId();
|
|
359
604
|
const safeMax = max > 0 ? max : 0;
|
|
360
605
|
const clamped = safeMax ? Math.min(safeMax, Math.max(0, value)) : 0;
|
|
361
606
|
const pct = safeMax ? Math.round(clamped / safeMax * 100) : 0;
|
|
362
|
-
return /* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */ jsx19("span", { id, className: "truncate", children: label }),
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
pct,
|
|
367
|
-
"%"
|
|
368
|
-
] })
|
|
607
|
+
return /* @__PURE__ */ jsxs7("div", { ...rest, className: "flex min-w-0 flex-col gap-space-2xs", children: [
|
|
608
|
+
/* @__PURE__ */ jsxs7("div", { className: cx("flex justify-between gap-space-sm font-body-sm text-body-sm text-on-surface-variant", hideLabel && "sr-only"), children: [
|
|
609
|
+
/* @__PURE__ */ jsx19("span", { id, className: "min-w-0 truncate", children: label }),
|
|
610
|
+
/* @__PURE__ */ jsx19("span", { className: "shrink-0 tabular-nums", children: valueLabel ?? `${pct}%` })
|
|
369
611
|
] }),
|
|
370
612
|
/* @__PURE__ */ jsx19(
|
|
371
613
|
"div",
|
|
@@ -375,143 +617,247 @@ function ProgressBar({ value, max = 100, tone = "brand", label, hideLabel, ...re
|
|
|
375
617
|
"aria-valuemin": 0,
|
|
376
618
|
"aria-valuemax": safeMax,
|
|
377
619
|
"aria-valuenow": clamped,
|
|
378
|
-
className: "
|
|
379
|
-
children: /* @__PURE__ */ jsx19("div", { className: cx("h-full rounded-full transition-[width]",
|
|
620
|
+
className: cx("w-full overflow-hidden rounded-full bg-surface-muted", SIZE5[size]),
|
|
621
|
+
children: /* @__PURE__ */ jsx19("div", { className: cx("h-full rounded-full transition-[width]", TONE5[tone]), style: { width: `${pct}%` } })
|
|
380
622
|
}
|
|
381
|
-
)
|
|
623
|
+
),
|
|
624
|
+
caption && /* @__PURE__ */ jsx19("p", { className: "font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: caption })
|
|
382
625
|
] });
|
|
383
626
|
}
|
|
384
627
|
|
|
628
|
+
// src/components/IconTile.tsx
|
|
629
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
630
|
+
var TONE6 = {
|
|
631
|
+
neutral: "bg-surface-muted text-on-surface-variant",
|
|
632
|
+
brand: "bg-badge-intermediate-bg text-badge-intermediate-text",
|
|
633
|
+
success: "bg-badge-beginner-bg text-badge-beginner-text",
|
|
634
|
+
warning: "bg-badge-amber-bg text-badge-amber-text",
|
|
635
|
+
danger: "bg-badge-advanced-bg text-badge-advanced-text"
|
|
636
|
+
};
|
|
637
|
+
var FILLED = {
|
|
638
|
+
neutral: "bg-ink text-on-ink",
|
|
639
|
+
brand: "bg-badge-intermediate-text text-badge-intermediate-bg",
|
|
640
|
+
success: "bg-badge-beginner-text text-badge-beginner-bg",
|
|
641
|
+
warning: "bg-badge-amber-text text-badge-amber-bg",
|
|
642
|
+
danger: "bg-badge-advanced-text text-badge-advanced-bg"
|
|
643
|
+
};
|
|
644
|
+
var SIZE6 = { sm: "size-8", md: "size-10", lg: "size-12", xl: "size-14" };
|
|
645
|
+
var ICON_SIZE = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
646
|
+
var SHAPE2 = { square: "rounded-lg", circle: "rounded-full" };
|
|
647
|
+
function IconTile({ icon, tone = "neutral", size = "md", shape = "square", filled, label, ...rest }) {
|
|
648
|
+
return /* @__PURE__ */ jsx20(
|
|
649
|
+
"span",
|
|
650
|
+
{
|
|
651
|
+
...rest,
|
|
652
|
+
role: label ? "img" : void 0,
|
|
653
|
+
"aria-label": label,
|
|
654
|
+
"aria-hidden": label ? void 0 : true,
|
|
655
|
+
className: cx("inline-flex shrink-0 items-center justify-center", filled ? FILLED[tone] : TONE6[tone], SIZE6[size], SHAPE2[shape]),
|
|
656
|
+
children: /* @__PURE__ */ jsx20(Icon, { name: icon, size: ICON_SIZE[size], filled })
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
|
|
385
661
|
// src/components/SectionHeader.tsx
|
|
386
|
-
import { jsx as
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
662
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
663
|
+
var ACCENT = {
|
|
664
|
+
neutral: "border-b-2 border-b-border-strong",
|
|
665
|
+
brand: "border-b-2 border-b-brand-cobalt",
|
|
666
|
+
success: "border-b-2 border-b-brand-emerald",
|
|
667
|
+
warning: "border-b-2 border-b-brand-amber",
|
|
668
|
+
danger: "border-b-2 border-b-brand-crimson"
|
|
669
|
+
};
|
|
670
|
+
function SectionHeader({ title, level = 2, dot, tag, tagTone = "neutral", meta, description, icon, accent, size = "sm", divider = true, metaUppercase = true, ...rest }) {
|
|
671
|
+
return /* @__PURE__ */ jsxs8("div", { ...rest, className: cx("flex min-w-0 flex-wrap items-center gap-x-space-sm gap-y-space-xs pb-space-sm", accent ? ACCENT[accent] : divider && "border-b border-border-subtle"), children: [
|
|
672
|
+
icon && /* @__PURE__ */ jsx21(IconTile, { icon, size: "sm", tone: accent ?? "neutral" }),
|
|
673
|
+
dot && /* @__PURE__ */ jsx21(Dot, { tone: dot, size: divider ? "md" : "lg" }),
|
|
674
|
+
/* @__PURE__ */ jsx21(Heading, { level, size, children: title }),
|
|
675
|
+
tag && /* @__PURE__ */ jsx21(Badge, { tone: tagTone, uppercase: true, children: tag }),
|
|
676
|
+
meta && /* @__PURE__ */ jsx21("span", { className: cx("ml-auto min-w-0 max-w-full truncate font-label-mono text-label-mono text-on-surface-variant", metaUppercase && "uppercase"), children: meta }),
|
|
677
|
+
description && /* @__PURE__ */ jsx21("p", { className: "basis-full font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description })
|
|
393
678
|
] });
|
|
394
679
|
}
|
|
395
680
|
|
|
396
681
|
// src/components/Callout.tsx
|
|
397
|
-
import { jsx as
|
|
398
|
-
var
|
|
682
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
683
|
+
var TONE7 = {
|
|
399
684
|
danger: "bg-badge-advanced-bg text-badge-advanced-text",
|
|
400
685
|
info: "bg-badge-intermediate-bg text-badge-intermediate-text",
|
|
401
686
|
success: "bg-badge-beginner-bg text-badge-beginner-text",
|
|
402
687
|
warning: "bg-badge-amber-bg text-badge-amber-text"
|
|
403
688
|
};
|
|
404
689
|
var ICON = { danger: "error", info: "info", success: "check_circle", warning: "warning" };
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
690
|
+
var SIZE7 = { sm: "gap-space-xs rounded-lg p-space-sm", md: "gap-space-sm rounded-xl p-space-md" };
|
|
691
|
+
function Callout({ tone = "info", title, action, live = true, icon, size = "md", accent, children, ...rest }) {
|
|
692
|
+
const role = live ? tone === "danger" ? "alert" : "status" : void 0;
|
|
693
|
+
return /* @__PURE__ */ jsxs9("div", { ...rest, role, className: cx("flex min-w-0 flex-wrap items-start border border-current/20", TONE7[tone], SIZE7[size], accent && "border-l-4"), children: [
|
|
694
|
+
/* @__PURE__ */ jsx22(Icon, { name: icon ?? ICON[tone], size: size === "sm" ? "sm" : "md" }),
|
|
695
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
|
|
696
|
+
title && /* @__PURE__ */ jsx22("p", { className: cx("font-display wrap-break-word", size === "sm" ? "text-body-md font-semibold" : "text-headline-sm"), children: title }),
|
|
697
|
+
/* @__PURE__ */ jsx22("div", { className: "font-body-sm text-body-sm wrap-break-word", children })
|
|
411
698
|
] }),
|
|
412
|
-
action && /* @__PURE__ */
|
|
699
|
+
action && /* @__PURE__ */ jsx22("div", { className: "shrink-0", children: action })
|
|
413
700
|
] });
|
|
414
701
|
}
|
|
415
702
|
|
|
416
703
|
// src/components/ResultRow.tsx
|
|
417
|
-
import { jsx as
|
|
704
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
418
705
|
var STATUS = {
|
|
419
706
|
pass: { icon: "check_circle", tone: "success", label: "Passed" },
|
|
420
707
|
fail: { icon: "cancel", tone: "danger", label: "Failed" },
|
|
708
|
+
warning: { icon: "warning", tone: "warning", label: "Warning" },
|
|
421
709
|
pending: { icon: "schedule", tone: "muted", label: "Pending" }
|
|
422
710
|
};
|
|
423
|
-
|
|
711
|
+
var VARIANT4 = { plain: "items-start py-space-sm", boxed: "items-center rounded bg-surface-subtle p-space-sm" };
|
|
712
|
+
function ResultRow({ status, title, detail, meta, badge, variant = "plain", selected, titleMono, ...rest }) {
|
|
424
713
|
const s = STATUS[status];
|
|
425
|
-
return /* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
detail && /* @__PURE__ */
|
|
714
|
+
return /* @__PURE__ */ jsxs10("div", { ...rest, className: cx("flex min-w-0 gap-space-sm", VARIANT4[variant], selected && "border-l-4 border-l-brand-cobalt pl-space-sm"), children: [
|
|
715
|
+
/* @__PURE__ */ jsx23(Icon, { name: s.icon, tone: s.tone, filled: true, label: s.label }),
|
|
716
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
|
|
717
|
+
/* @__PURE__ */ jsx23("p", { className: cx("text-on-surface wrap-break-word", titleMono ? "font-code-inline text-code-inline" : "font-body-md text-body-md"), children: title }),
|
|
718
|
+
detail && /* @__PURE__ */ jsx23("p", { className: "whitespace-pre-wrap font-code-inline text-code-inline text-on-surface-variant wrap-break-word", children: detail })
|
|
430
719
|
] }),
|
|
431
|
-
meta && /* @__PURE__ */
|
|
720
|
+
(meta || badge) && /* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center gap-space-xs", children: [
|
|
721
|
+
meta && /* @__PURE__ */ jsx23("span", { className: "font-label-mono text-label-mono text-on-surface-variant", children: meta }),
|
|
722
|
+
badge
|
|
723
|
+
] })
|
|
432
724
|
] });
|
|
433
725
|
}
|
|
434
726
|
|
|
435
727
|
// src/components/Message.tsx
|
|
436
|
-
import { jsx as
|
|
728
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
437
729
|
function Message({ tone = "default", children, ...rest }) {
|
|
438
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ jsx24("p", { ...rest, role: tone === "danger" ? "alert" : "status", className: cx("min-w-0 font-body-md text-body-md wrap-break-word", tone === "danger" ? "text-fg-danger" : "text-on-surface-variant"), children });
|
|
439
731
|
}
|
|
440
732
|
|
|
441
733
|
// src/components/EmptyState.tsx
|
|
442
|
-
import { jsx as
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
734
|
+
import { jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
735
|
+
var TONE8 = {
|
|
736
|
+
default: { tile: "bg-surface-muted text-on-surface-variant", text: "text-on-surface-variant" },
|
|
737
|
+
danger: { tile: "bg-badge-advanced-bg text-badge-advanced-text", text: "text-fg-danger" }
|
|
738
|
+
};
|
|
739
|
+
function EmptyState({ icon = "inbox", title, description, action, media, code, tone = "default", headingLevel = 3, ...rest }) {
|
|
740
|
+
const t = TONE8[tone];
|
|
741
|
+
return /* @__PURE__ */ jsxs11("div", { ...rest, className: "flex min-w-0 flex-col items-center gap-space-sm px-space-md py-space-xl text-center", children: [
|
|
742
|
+
media ? /* @__PURE__ */ jsx25("div", { className: "w-full min-w-0", children: media }) : code ? /* @__PURE__ */ jsx25("p", { className: "font-label-mono text-6xl font-semibold text-ink", children: code }) : /* @__PURE__ */ jsx25("span", { className: cx("inline-flex size-12 items-center justify-center rounded-full", t.tile), children: /* @__PURE__ */ jsx25(Icon, { name: icon, size: "lg" }) }),
|
|
743
|
+
/* @__PURE__ */ jsx25("div", { className: "w-full min-w-0", children: /* @__PURE__ */ jsx25(Heading, { level: headingLevel, size: headingLevel === 1 ? "lg" : "sm", children: title }) }),
|
|
744
|
+
description && /* @__PURE__ */ jsx25("p", { className: cx("w-full min-w-0 max-w-prose font-body-sm text-body-sm wrap-break-word", t.text), children: description }),
|
|
448
745
|
action
|
|
449
746
|
] });
|
|
450
747
|
}
|
|
451
748
|
|
|
452
749
|
// src/components/CheckList.tsx
|
|
453
|
-
import { jsx as
|
|
454
|
-
function CheckList({ items, ...rest }) {
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */
|
|
750
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
751
|
+
function CheckList({ items, icon = "check", tone = "success", ...rest }) {
|
|
752
|
+
return /* @__PURE__ */ jsx26("ul", { ...rest, className: "flex min-w-0 flex-col gap-space-xs", children: items.map((item, i) => /* @__PURE__ */ jsxs12("li", { className: "flex items-start gap-space-xs font-body-md text-body-md text-on-surface", children: [
|
|
753
|
+
/* @__PURE__ */ jsx26(Icon, { name: icon, size: "sm", tone }),
|
|
754
|
+
/* @__PURE__ */ jsx26("span", { className: "min-w-0 wrap-break-word", children: item })
|
|
458
755
|
] }, i)) });
|
|
459
756
|
}
|
|
460
757
|
|
|
461
758
|
// src/components/Card.tsx
|
|
462
759
|
import { Children, isValidElement } from "react";
|
|
463
|
-
import { jsx as
|
|
464
|
-
var
|
|
465
|
-
default: "bg-surface-elevated
|
|
466
|
-
|
|
760
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
761
|
+
var TONE9 = {
|
|
762
|
+
default: "bg-surface-elevated text-on-surface",
|
|
763
|
+
subtle: "bg-surface-subtle text-on-surface",
|
|
764
|
+
inverse: "bg-brand-obsidian text-on-primary"
|
|
467
765
|
};
|
|
766
|
+
var SHADOW2 = { none: "", sm: "shadow-sm", md: "shadow-md", xl: "shadow-xl" };
|
|
767
|
+
var BAR_TONE = { default: "bg-surface-subtle", slate: "bg-brand-slate", none: "" };
|
|
768
|
+
var BAR_DENSITY = { md: "px-space-lg py-space-sm", sm: "px-space-md py-space-sm" };
|
|
468
769
|
var PATTERN2 = { none: "", dots: "bg-pattern-dots", grid: "bg-pattern-grid" };
|
|
469
770
|
var ASPECT = { video: "aspect-video", wide: "aspect-[21/9]", square: "aspect-square" };
|
|
470
|
-
|
|
471
|
-
|
|
771
|
+
var HEIGHT = { sm: "h-30", md: "h-35" };
|
|
772
|
+
var INVERSE_BAR = "group-data-[tone=inverse]/card:border-white/10 group-data-[tone=inverse]/card:bg-brand-slate";
|
|
773
|
+
function CardHeader({ start, end, children, divider = false, density = "md", tone = "default", ...rest }) {
|
|
774
|
+
return /* @__PURE__ */ jsxs13(
|
|
775
|
+
"div",
|
|
776
|
+
{
|
|
777
|
+
...rest,
|
|
778
|
+
className: cx("flex min-w-0 flex-wrap items-center justify-between gap-space-sm", BAR_TONE[tone], BAR_DENSITY[density], divider && "border-b border-border-subtle", tone === "default" && INVERSE_BAR),
|
|
779
|
+
children: [
|
|
780
|
+
/* @__PURE__ */ jsx27("div", { className: "flex min-w-0 items-center gap-space-sm", children: start ?? children }),
|
|
781
|
+
end && /* @__PURE__ */ jsx27("div", { className: "flex shrink-0 flex-wrap items-center gap-space-sm", children: end })
|
|
782
|
+
]
|
|
783
|
+
}
|
|
784
|
+
);
|
|
472
785
|
}
|
|
473
|
-
function
|
|
474
|
-
return /* @__PURE__ */
|
|
786
|
+
function CardMedia({ pattern = "dots", aspect = "video", height, caption, children, ...rest }) {
|
|
787
|
+
return /* @__PURE__ */ jsxs13(
|
|
788
|
+
"div",
|
|
789
|
+
{
|
|
790
|
+
...rest,
|
|
791
|
+
className: cx("relative flex min-w-0 items-center justify-center border-b border-border-subtle bg-surface-subtle", INVERSE_BAR, PATTERN2[pattern], height ? HEIGHT[height] : ASPECT[aspect]),
|
|
792
|
+
children: [
|
|
793
|
+
caption && /* @__PURE__ */ jsx27("span", { className: "absolute left-space-sm top-space-sm font-label-mono text-[10px] uppercase tracking-wider text-on-surface-variant", children: caption }),
|
|
794
|
+
children
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
);
|
|
475
798
|
}
|
|
476
|
-
function
|
|
799
|
+
function CardFooter({ children, divider = false, density = "md", tone = "default", ...rest }) {
|
|
800
|
+
return /* @__PURE__ */ jsx27(
|
|
801
|
+
"div",
|
|
802
|
+
{
|
|
803
|
+
...rest,
|
|
804
|
+
className: cx("flex min-w-0 flex-wrap items-center justify-between gap-space-sm", BAR_TONE[tone], BAR_DENSITY[density], divider && "border-t border-border-subtle", tone === "default" && INVERSE_BAR),
|
|
805
|
+
children
|
|
806
|
+
}
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
function CardRoot({ as, padding = "lg", interactive, tone = "default", pattern = "none", shadow = "sm", outlined, gap = "sm", children, ...rest }) {
|
|
477
810
|
const C = as ?? "div";
|
|
478
811
|
const parts = Children.toArray(children);
|
|
479
812
|
const isType = (t) => (p) => isValidElement(p) && p.type === t;
|
|
813
|
+
const header = parts.filter(isType(CardHeader));
|
|
480
814
|
const media = parts.filter(isType(CardMedia));
|
|
481
815
|
const footer = parts.filter(isType(CardFooter));
|
|
482
|
-
const body = parts.filter((p) => !media.includes(p) && !footer.includes(p));
|
|
483
|
-
return /* @__PURE__ */
|
|
816
|
+
const body = parts.filter((p) => !header.includes(p) && !media.includes(p) && !footer.includes(p));
|
|
817
|
+
return /* @__PURE__ */ jsxs13(
|
|
484
818
|
C,
|
|
485
819
|
{
|
|
486
820
|
...rest,
|
|
487
821
|
"data-tone": tone,
|
|
488
|
-
|
|
822
|
+
"data-theme": tone === "inverse" ? "dark" : void 0,
|
|
823
|
+
className: cx("group/card flex min-w-0 flex-col overflow-hidden rounded-xl", TONE9[tone], SHADOW2[shadow], outlined && "border border-border-subtle", PATTERN2[pattern], interactive && cx("transition-shadow hover:shadow-md", FOCUS_RING)),
|
|
489
824
|
children: [
|
|
825
|
+
header,
|
|
490
826
|
media,
|
|
491
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ jsx27("div", { className: cx("flex min-w-0 flex-1 flex-col", responsive(GAP, gap), responsive(PADDING, padding)), children: body }),
|
|
492
828
|
footer
|
|
493
829
|
]
|
|
494
830
|
}
|
|
495
831
|
);
|
|
496
832
|
}
|
|
497
|
-
var Card = Object.assign(CardRoot, { Media: CardMedia, Footer: CardFooter });
|
|
833
|
+
var Card = Object.assign(CardRoot, { Header: CardHeader, Media: CardMedia, Footer: CardFooter });
|
|
498
834
|
|
|
499
835
|
// src/components/Button.tsx
|
|
500
|
-
import { jsx as
|
|
501
|
-
var
|
|
836
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
837
|
+
var VARIANT5 = {
|
|
502
838
|
primary: "bg-ink text-on-ink shadow-sm hover:bg-ink-hover",
|
|
503
839
|
secondary: "border border-border-subtle bg-surface-elevated text-ink shadow-sm hover:bg-surface-muted",
|
|
504
|
-
|
|
840
|
+
// Stitch's white button: lifted by shadow, no border.
|
|
841
|
+
raised: "bg-surface-elevated text-ink shadow-sm hover:bg-surface-container",
|
|
842
|
+
subtle: "bg-surface-subtle text-on-surface hover:bg-surface-container",
|
|
843
|
+
// Secondary action on a dark surface.
|
|
844
|
+
slate: "bg-brand-slate text-white hover:bg-surface-tint",
|
|
505
845
|
ghost: "bg-transparent text-on-surface hover:bg-surface-muted",
|
|
506
|
-
danger: "bg-danger text-white shadow-sm hover:bg-danger-hover"
|
|
846
|
+
danger: "bg-danger text-white shadow-sm hover:bg-danger-hover",
|
|
847
|
+
brand: "bg-brand-cobalt text-white shadow-sm hover:bg-brand-cobalt-hover",
|
|
848
|
+
// Crimson call to action (not destructive): #DC2626 keeps white text at AA.
|
|
849
|
+
accent: "bg-brand-crimson-hover text-white shadow-sm hover:bg-danger"
|
|
507
850
|
};
|
|
508
|
-
var
|
|
851
|
+
var SIZE8 = { xs: "px-space-md py-space-xs", ms: "px-space-lg py-space-sm", sm: "h-8 px-space-md", md: "h-10 px-space-lg", lg: "h-12 px-space-lg" };
|
|
509
852
|
function Button({
|
|
510
853
|
as,
|
|
511
854
|
variant = "primary",
|
|
512
855
|
size = "md",
|
|
513
856
|
icon,
|
|
514
857
|
iconRight,
|
|
858
|
+
iconTone,
|
|
859
|
+
iconFilled,
|
|
860
|
+
leading,
|
|
515
861
|
fullWidth,
|
|
516
862
|
loading,
|
|
517
863
|
disabled,
|
|
@@ -522,7 +868,8 @@ function Button({
|
|
|
522
868
|
const native = C === "button";
|
|
523
869
|
const off = Boolean(disabled || loading);
|
|
524
870
|
const state = native ? { type: rest.type ?? "button", disabled: off } : { "aria-disabled": off || void 0 };
|
|
525
|
-
|
|
871
|
+
const start = loading ? /* @__PURE__ */ jsx28(Icon, { name: "progress_activity", size: "sm", spin: true }) : leading ? /* @__PURE__ */ jsx28("span", { className: "inline-flex shrink-0 items-center", children: leading }) : icon && /* @__PURE__ */ jsx28(Icon, { name: icon, size: "sm", tone: iconTone, filled: iconFilled });
|
|
872
|
+
return /* @__PURE__ */ jsxs14(
|
|
526
873
|
C,
|
|
527
874
|
{
|
|
528
875
|
...rest,
|
|
@@ -531,105 +878,143 @@ function Button({
|
|
|
531
878
|
className: cx(
|
|
532
879
|
"inline-flex max-w-full items-center justify-center gap-space-xs whitespace-nowrap rounded-lg font-button-text text-button-text transition-colors",
|
|
533
880
|
"disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
534
|
-
|
|
535
|
-
|
|
881
|
+
VARIANT5[variant],
|
|
882
|
+
SIZE8[size],
|
|
536
883
|
FOCUS_RING,
|
|
537
884
|
TOUCH,
|
|
538
885
|
fullWidth && "w-full"
|
|
539
886
|
),
|
|
540
887
|
children: [
|
|
541
|
-
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
iconRight && /* @__PURE__ */
|
|
888
|
+
start,
|
|
889
|
+
/* @__PURE__ */ jsx28("span", { className: "inline-flex min-w-0 items-center gap-space-xs truncate", children }),
|
|
890
|
+
iconRight && /* @__PURE__ */ jsx28(Icon, { name: iconRight, size: "sm" })
|
|
544
891
|
]
|
|
545
892
|
}
|
|
546
893
|
);
|
|
547
894
|
}
|
|
548
895
|
|
|
549
896
|
// src/components/IconButton.tsx
|
|
550
|
-
import { jsx as
|
|
551
|
-
var
|
|
897
|
+
import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
898
|
+
var VARIANT6 = {
|
|
552
899
|
ghost: "text-on-surface-variant hover:bg-surface-muted hover:text-on-surface",
|
|
553
|
-
subtle: "bg-surface-subtle text-on-surface hover:bg-surface-
|
|
900
|
+
subtle: "bg-surface-subtle text-on-surface-variant hover:bg-surface-container hover:text-on-surface",
|
|
901
|
+
secondary: "border border-border-subtle bg-surface-elevated text-on-surface hover:bg-surface-muted",
|
|
554
902
|
primary: "bg-ink text-on-ink hover:bg-ink-hover"
|
|
555
903
|
};
|
|
556
|
-
var
|
|
557
|
-
function IconButton({ icon, label, variant = "ghost", size = "md",
|
|
558
|
-
|
|
559
|
-
|
|
904
|
+
var SIZE9 = { xs: "size-6", sm: "size-8", ms: "size-9", md: "size-10" };
|
|
905
|
+
function IconButton({ as, icon, label, variant = "ghost", size = "md", dot, badge, ...rest }) {
|
|
906
|
+
const C = as ?? "button";
|
|
907
|
+
const native = C === "button";
|
|
908
|
+
const typeProp = native ? { type: rest.type ?? "button" } : {};
|
|
909
|
+
return /* @__PURE__ */ jsxs15(
|
|
910
|
+
C,
|
|
560
911
|
{
|
|
561
912
|
...rest,
|
|
562
|
-
|
|
913
|
+
...typeProp,
|
|
563
914
|
"aria-label": label,
|
|
564
915
|
title: label,
|
|
565
|
-
className: cx(
|
|
566
|
-
|
|
916
|
+
className: cx(
|
|
917
|
+
"relative inline-flex shrink-0 items-center justify-center rounded-lg transition-colors disabled:pointer-events-none disabled:opacity-50",
|
|
918
|
+
VARIANT6[variant],
|
|
919
|
+
SIZE9[size],
|
|
920
|
+
FOCUS_RING,
|
|
921
|
+
TOUCH_ICON
|
|
922
|
+
),
|
|
923
|
+
children: [
|
|
924
|
+
/* @__PURE__ */ jsx29(Icon, { name: icon, size: size === "md" ? "md" : size === "ms" ? "ms" : "sm" }),
|
|
925
|
+
dot && /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: cx("absolute right-1.5 top-1.5 size-2 rounded-full ring-2 ring-surface-elevated", DOT_TONE[dot]) }),
|
|
926
|
+
badge && /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: "absolute -right-1 -top-1 min-w-4 rounded-full bg-brand-crimson-hover px-1 text-center font-label-mono text-[10px] leading-4 text-white", children: badge })
|
|
927
|
+
]
|
|
567
928
|
}
|
|
568
929
|
);
|
|
569
930
|
}
|
|
570
931
|
|
|
571
932
|
// src/components/Kbd.tsx
|
|
572
|
-
import { jsx as
|
|
573
|
-
|
|
574
|
-
|
|
933
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
934
|
+
var VARIANT7 = {
|
|
935
|
+
outline: "rounded border border-border-subtle bg-surface-subtle",
|
|
936
|
+
// Lifted keycap for filled fields (the header search).
|
|
937
|
+
raised: "rounded bg-surface-elevated shadow-sm"
|
|
938
|
+
};
|
|
939
|
+
function Kbd({ variant = "outline", children, ...rest }) {
|
|
940
|
+
return /* @__PURE__ */ jsx30("kbd", { ...rest, className: cx("inline-flex items-center px-space-xs font-label-mono text-[11px] leading-5 text-on-surface-variant", VARIANT7[variant]), children });
|
|
575
941
|
}
|
|
576
942
|
|
|
577
943
|
// src/components/TextField.tsx
|
|
578
|
-
import { useId as useId2 } from "react";
|
|
579
|
-
import { jsx as
|
|
580
|
-
|
|
944
|
+
import { useId as useId2, useState } from "react";
|
|
945
|
+
import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
946
|
+
var SIZE10 = { sm: "h-8 px-space-sm", ms: "h-9 px-space-sm", md: "h-10 px-space-sm", lg: "h-11 px-space-md" };
|
|
947
|
+
var TEXT2 = { sm: "font-body-sm text-body-sm", ms: "font-body-sm text-body-sm", md: "font-body-md text-body-md", lg: "font-body-sm text-body-sm" };
|
|
948
|
+
var WIDTH = { auto: "", full: "w-full", sm: "w-64", md: "w-80", lg: "w-full max-w-xl" };
|
|
949
|
+
var VARIANT8 = {
|
|
950
|
+
outline: "border bg-surface-subtle focus-within:ring-2",
|
|
951
|
+
filled: "bg-surface-subtle hover:bg-surface-container/40 focus-within:ring-1",
|
|
952
|
+
raised: "bg-surface-elevated shadow-sm focus-within:ring-2"
|
|
953
|
+
};
|
|
954
|
+
function TextField({ label, hideLabel, icon, hint, error, labelEnd, revealable, size = "md", variant = "outline", iconPosition = "start", width = "auto", id, type, ...rest }) {
|
|
581
955
|
const generated = useId2();
|
|
582
956
|
const inputId = id ?? generated;
|
|
583
957
|
const errorId = `${inputId}-error`;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
/* @__PURE__ */
|
|
958
|
+
const [shown, setShown] = useState(false);
|
|
959
|
+
return /* @__PURE__ */ jsxs16("div", { className: cx("flex min-w-0 flex-col gap-space-2xs", WIDTH[width]), children: [
|
|
960
|
+
/* @__PURE__ */ jsxs16("div", { className: cx("flex min-w-0 items-center justify-between gap-space-sm", hideLabel && !labelEnd && "sr-only"), children: [
|
|
961
|
+
/* @__PURE__ */ jsx31("label", { htmlFor: inputId, className: cx("font-body-sm text-body-sm font-medium text-on-surface", hideLabel && "sr-only"), children: label }),
|
|
962
|
+
labelEnd
|
|
963
|
+
] }),
|
|
964
|
+
/* @__PURE__ */ jsxs16(
|
|
587
965
|
"div",
|
|
588
966
|
{
|
|
589
967
|
className: cx(
|
|
590
|
-
"flex
|
|
591
|
-
|
|
968
|
+
"flex min-w-0 items-center gap-space-xs rounded-lg focus-within:ring-brand-cobalt",
|
|
969
|
+
VARIANT8[variant],
|
|
970
|
+
SIZE10[size],
|
|
971
|
+
error ? "border border-fg-danger" : variant === "outline" && "border-border-subtle",
|
|
592
972
|
TOUCH
|
|
593
973
|
),
|
|
594
974
|
children: [
|
|
595
|
-
icon && /* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
975
|
+
icon && iconPosition === "start" && /* @__PURE__ */ jsx31(Icon, { name: icon, size: size === "lg" ? "md" : "sm", tone: "muted" }),
|
|
976
|
+
/* @__PURE__ */ jsx31(
|
|
597
977
|
"input",
|
|
598
978
|
{
|
|
599
979
|
...rest,
|
|
600
980
|
id: inputId,
|
|
981
|
+
type: revealable ? shown ? "text" : "password" : type,
|
|
601
982
|
"aria-invalid": error ? true : rest["aria-invalid"],
|
|
602
983
|
"aria-describedby": cx(rest["aria-describedby"], error && errorId) || void 0,
|
|
603
|
-
className: "h-full min-w-0 flex-1 bg-transparent
|
|
984
|
+
className: cx("h-full min-w-0 flex-1 bg-transparent text-on-surface outline-none placeholder:text-on-surface-variant", TEXT2[size])
|
|
604
985
|
}
|
|
605
986
|
),
|
|
606
|
-
hint && /* @__PURE__ */
|
|
987
|
+
hint && /* @__PURE__ */ jsx31("span", { className: "shrink-0", children: hint }),
|
|
988
|
+
revealable && /* @__PURE__ */ jsx31(IconButton, { icon: shown ? "visibility_off" : "visibility", label: "Show password", "aria-pressed": shown, size: "xs", onClick: () => setShown((s) => !s) }),
|
|
989
|
+
icon && iconPosition === "end" && /* @__PURE__ */ jsx31(Icon, { name: icon, size: "sm", tone: "muted" })
|
|
607
990
|
]
|
|
608
991
|
}
|
|
609
992
|
),
|
|
610
|
-
error && /* @__PURE__ */
|
|
993
|
+
error && /* @__PURE__ */ jsx31("p", { id: errorId, className: "font-body-sm text-body-sm text-fg-danger", children: error })
|
|
611
994
|
] });
|
|
612
995
|
}
|
|
613
996
|
|
|
614
997
|
// src/components/Select.tsx
|
|
615
998
|
import { useId as useId3 } from "react";
|
|
616
|
-
import { jsx as
|
|
617
|
-
|
|
999
|
+
import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1000
|
+
var VARIANT9 = { outline: "border border-border-subtle bg-surface-subtle", raised: "bg-surface-elevated shadow-sm" };
|
|
1001
|
+
var SIZE11 = { md: "h-10 pl-space-sm font-body-md text-body-md", lg: "h-11 pl-space-md font-body-sm text-body-sm" };
|
|
1002
|
+
function Select({ label, hideLabel, options, variant = "outline", size = "md", id, ...rest }) {
|
|
618
1003
|
const generated = useId3();
|
|
619
1004
|
const selectId = id ?? generated;
|
|
620
|
-
return /* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
1005
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 flex-col gap-space-2xs", children: [
|
|
1006
|
+
/* @__PURE__ */ jsx32("label", { htmlFor: selectId, className: cx("font-body-sm text-body-sm font-medium text-on-surface", hideLabel && "sr-only"), children: label }),
|
|
1007
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative min-w-0", children: [
|
|
1008
|
+
/* @__PURE__ */ jsx32(
|
|
624
1009
|
"select",
|
|
625
1010
|
{
|
|
626
1011
|
...rest,
|
|
627
1012
|
id: selectId,
|
|
628
|
-
className: cx("
|
|
629
|
-
children: options.map((o) => /* @__PURE__ */
|
|
1013
|
+
className: cx("w-full min-w-0 appearance-none rounded-lg pr-space-xl text-on-surface", VARIANT9[variant], SIZE11[size], FOCUS_RING, TOUCH),
|
|
1014
|
+
children: options.map((o) => /* @__PURE__ */ jsx32("option", { value: o.value, children: o.label }, o.value))
|
|
630
1015
|
}
|
|
631
1016
|
),
|
|
632
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ jsx32("span", { className: "pointer-events-none absolute inset-y-0 right-space-sm flex items-center text-on-surface-variant", children: /* @__PURE__ */ jsx32(Icon, { name: "expand_more", size: "sm" }) })
|
|
633
1018
|
] })
|
|
634
1019
|
] });
|
|
635
1020
|
}
|
|
@@ -656,8 +1041,9 @@ function rovingIndex(key, index, count) {
|
|
|
656
1041
|
}
|
|
657
1042
|
|
|
658
1043
|
// src/components/Tabs.tsx
|
|
659
|
-
import { Fragment, jsx as
|
|
660
|
-
var
|
|
1044
|
+
import { Fragment as Fragment2, jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1045
|
+
var HIDE_BELOW = { sm: "hidden sm:flex", md: "hidden md:flex", lg: "hidden lg:flex", xl: "hidden xl:flex", "2xl": "hidden 2xl:flex" };
|
|
1046
|
+
var VARIANT10 = {
|
|
661
1047
|
underline: {
|
|
662
1048
|
list: "flex min-w-0 max-w-full gap-space-lg overflow-x-auto border-b border-border-subtle [scrollbar-width:none]",
|
|
663
1049
|
tab: "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap border-b-2 py-space-sm font-button-text text-button-text transition-colors",
|
|
@@ -669,25 +1055,58 @@ var VARIANT4 = {
|
|
|
669
1055
|
tab: "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap rounded-md px-space-md py-space-xs font-button-text text-button-text transition-colors",
|
|
670
1056
|
active: "bg-surface-elevated text-ink shadow-sm",
|
|
671
1057
|
idle: "text-on-surface-variant hover:text-on-surface"
|
|
1058
|
+
},
|
|
1059
|
+
// Header navigation: icon + label + count pill; active is a cobalt tint.
|
|
1060
|
+
nav: {
|
|
1061
|
+
list: "flex min-w-0 max-w-full items-center gap-space-xs overflow-x-auto [scrollbar-width:none]",
|
|
1062
|
+
// One weight for every item: a bolder active item would widen and shift its neighbours.
|
|
1063
|
+
tab: "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap rounded-lg px-space-sm py-space-xs font-body-md text-body-md font-medium transition-colors",
|
|
1064
|
+
active: "bg-surface-container/60 text-brand-cobalt",
|
|
1065
|
+
idle: "text-on-surface-variant hover:bg-surface-subtle hover:text-on-surface"
|
|
1066
|
+
},
|
|
1067
|
+
// Filter chips: separate buttons, active filled with ink, dot leading.
|
|
1068
|
+
solid: {
|
|
1069
|
+
list: "flex min-w-0 max-w-full gap-space-xs overflow-x-auto pb-space-2xs [scrollbar-width:none]",
|
|
1070
|
+
tab: "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap rounded-lg px-space-md py-space-xs font-button-text text-button-text transition-colors",
|
|
1071
|
+
active: "bg-ink text-on-ink shadow-sm",
|
|
1072
|
+
idle: "bg-surface-subtle text-on-surface-variant hover:bg-surface-container hover:text-on-surface"
|
|
1073
|
+
},
|
|
1074
|
+
// Workspace tabs: mono caps, cobalt underline on the active tab, no rule under the list.
|
|
1075
|
+
label: {
|
|
1076
|
+
list: "flex min-w-0 max-w-full gap-space-md overflow-x-auto [scrollbar-width:none]",
|
|
1077
|
+
tab: "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap border-b-2 py-space-sm font-label-mono text-label-mono uppercase transition-colors",
|
|
1078
|
+
active: "border-brand-cobalt text-fg-brand",
|
|
1079
|
+
idle: "border-transparent text-on-surface-variant hover:text-on-surface"
|
|
672
1080
|
}
|
|
673
1081
|
};
|
|
674
|
-
|
|
675
|
-
|
|
1082
|
+
var DISABLED = "cursor-not-allowed opacity-60";
|
|
1083
|
+
function TabBody({ item, variant, active }) {
|
|
1084
|
+
const leadingDot = variant === "solid";
|
|
1085
|
+
let count = null;
|
|
1086
|
+
if (item.count !== void 0) {
|
|
1087
|
+
if (variant === "nav") count = /* @__PURE__ */ jsx33(Badge, { shape: "pill", tone: item.countTone ?? "info", children: item.count });
|
|
1088
|
+
else if (variant === "solid") count = /* @__PURE__ */ jsx33("span", { className: cx("rounded px-space-2xs font-label-mono text-label-mono", active ? "bg-white/20" : "bg-surface-elevated"), children: item.count });
|
|
1089
|
+
else count = /* @__PURE__ */ jsx33(Badge, { children: item.count });
|
|
1090
|
+
}
|
|
1091
|
+
return /* @__PURE__ */ jsxs18(Fragment2, { children: [
|
|
1092
|
+
item.dot && leadingDot && /* @__PURE__ */ jsx33(Dot, { tone: item.dot, size: "md" }),
|
|
1093
|
+
item.icon && /* @__PURE__ */ jsx33(Icon, { name: item.icon, size: "ms" }),
|
|
676
1094
|
item.label,
|
|
677
|
-
|
|
678
|
-
item.
|
|
1095
|
+
count,
|
|
1096
|
+
item.badge && (typeof item.badge === "string" ? /* @__PURE__ */ jsx33(Badge, { size: "xs", tone: "subtle", uppercase: true, children: item.badge }) : item.badge),
|
|
1097
|
+
item.dot && !leadingDot && /* @__PURE__ */ jsx33(Dot, { tone: item.dot })
|
|
679
1098
|
] });
|
|
680
1099
|
}
|
|
681
1100
|
function Tabs({ items, value, onChange, variant = "underline", label, ...rest }) {
|
|
682
1101
|
const baseId = useId4();
|
|
683
1102
|
const refs = useRef([]);
|
|
684
1103
|
if (!items.length) return null;
|
|
685
|
-
const v =
|
|
1104
|
+
const v = VARIANT10[variant];
|
|
686
1105
|
if (items.some((i) => i.href)) {
|
|
687
|
-
return /* @__PURE__ */
|
|
1106
|
+
return /* @__PURE__ */ jsx33("nav", { ...rest, "aria-label": label, className: "min-w-0 max-w-full", children: /* @__PURE__ */ jsx33("ul", { className: v.list, children: items.map((item) => {
|
|
688
1107
|
const C = item.as ?? "a";
|
|
689
1108
|
const active = item.id === value;
|
|
690
|
-
return /* @__PURE__ */
|
|
1109
|
+
return /* @__PURE__ */ jsx33("li", { className: cx("shrink-0", item.hideBelow ? HIDE_BELOW[item.hideBelow] : "flex"), children: item.disabled ? /* @__PURE__ */ jsx33("span", { "aria-disabled": "true", title: item.title, className: cx(v.tab, v.idle, DISABLED), children: /* @__PURE__ */ jsx33(TabBody, { item, variant, active: false }) }) : /* @__PURE__ */ jsx33(C, { href: item.href, title: item.title, "aria-current": active ? "page" : void 0, className: cx(v.tab, active ? v.active : v.idle, FOCUS_RING, TOUCH), children: /* @__PURE__ */ jsx33(TabBody, { item, variant, active }) }) }, item.id);
|
|
691
1110
|
}) }) });
|
|
692
1111
|
}
|
|
693
1112
|
const activeIndex = Math.max(0, items.findIndex((i) => i.id === value));
|
|
@@ -698,9 +1117,9 @@ function Tabs({ items, value, onChange, variant = "underline", label, ...rest })
|
|
|
698
1117
|
refs.current[next]?.focus();
|
|
699
1118
|
onChange?.(items[next].id);
|
|
700
1119
|
};
|
|
701
|
-
return /* @__PURE__ */
|
|
1120
|
+
return /* @__PURE__ */ jsx33("div", { ...rest, role: "tablist", "aria-label": label, className: v.list, children: items.map((item, i) => {
|
|
702
1121
|
const active = i === activeIndex;
|
|
703
|
-
return /* @__PURE__ */
|
|
1122
|
+
return /* @__PURE__ */ jsx33(
|
|
704
1123
|
"button",
|
|
705
1124
|
{
|
|
706
1125
|
ref: (el) => {
|
|
@@ -712,23 +1131,35 @@ function Tabs({ items, value, onChange, variant = "underline", label, ...rest })
|
|
|
712
1131
|
"aria-controls": item.panelId,
|
|
713
1132
|
"aria-selected": active,
|
|
714
1133
|
tabIndex: active ? 0 : -1,
|
|
1134
|
+
disabled: item.disabled,
|
|
1135
|
+
title: item.title,
|
|
715
1136
|
onClick: () => onChange?.(item.id),
|
|
716
1137
|
onKeyDown: (e) => onKeyDown(e, i),
|
|
717
|
-
className: cx(v.tab, active ? v.active : v.idle, FOCUS_RING, TOUCH),
|
|
718
|
-
children: /* @__PURE__ */
|
|
1138
|
+
className: cx(v.tab, active ? v.active : v.idle, item.disabled && DISABLED, FOCUS_RING, TOUCH),
|
|
1139
|
+
children: /* @__PURE__ */ jsx33(TabBody, { item, variant, active })
|
|
719
1140
|
},
|
|
720
1141
|
item.id
|
|
721
1142
|
);
|
|
722
1143
|
}) });
|
|
723
1144
|
}
|
|
724
1145
|
function TabPanel({ id, active, children, ...rest }) {
|
|
725
|
-
return /* @__PURE__ */
|
|
1146
|
+
return /* @__PURE__ */ jsx33("div", { ...rest, role: "tabpanel", id, "aria-labelledby": `${id}-tab`, hidden: !active, tabIndex: 0, className: cx("min-w-0 outline-none", FOCUS_RING), children });
|
|
726
1147
|
}
|
|
727
1148
|
|
|
728
1149
|
// src/components/SegmentedControl.tsx
|
|
729
1150
|
import { useRef as useRef2 } from "react";
|
|
730
|
-
import { jsx as
|
|
731
|
-
|
|
1151
|
+
import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1152
|
+
var TRACK = {
|
|
1153
|
+
default: "rounded-lg border border-border-subtle bg-surface-subtle p-space-2xs",
|
|
1154
|
+
// Compact mono switcher for toolbars (the IDE header).
|
|
1155
|
+
label: ""
|
|
1156
|
+
};
|
|
1157
|
+
var OPTION = {
|
|
1158
|
+
default: { base: "rounded-md py-space-xs font-button-text text-button-text", on: "bg-surface-elevated text-ink shadow-sm", off: "text-on-surface-variant hover:text-on-surface" },
|
|
1159
|
+
label: { base: "rounded px-space-xs py-space-2xs font-label-mono text-label-mono", on: "bg-surface-subtle text-fg-brand", off: "text-on-surface-variant hover:text-ink" }
|
|
1160
|
+
};
|
|
1161
|
+
function SegmentedControl({ label, options, value, onChange, variant = "default", ...rest }) {
|
|
1162
|
+
const opt = OPTION[variant];
|
|
732
1163
|
const refs = useRef2([]);
|
|
733
1164
|
const checkedIndex = options.findIndex((o) => o.value === value);
|
|
734
1165
|
const tabbable = checkedIndex === -1 ? 0 : checkedIndex;
|
|
@@ -739,9 +1170,9 @@ function SegmentedControl({ label, options, value, onChange, ...rest }) {
|
|
|
739
1170
|
refs.current[next]?.focus();
|
|
740
1171
|
onChange(options[next].value);
|
|
741
1172
|
};
|
|
742
|
-
return /* @__PURE__ */
|
|
1173
|
+
return /* @__PURE__ */ jsx34("div", { ...rest, role: "radiogroup", "aria-label": label, className: cx("inline-flex min-w-0 max-w-full gap-space-2xs overflow-x-auto [scrollbar-width:none]", TRACK[variant]), children: options.map((o, i) => {
|
|
743
1174
|
const checked = i === checkedIndex;
|
|
744
|
-
return /* @__PURE__ */
|
|
1175
|
+
return /* @__PURE__ */ jsxs19(
|
|
745
1176
|
"button",
|
|
746
1177
|
{
|
|
747
1178
|
ref: (el) => {
|
|
@@ -750,18 +1181,23 @@ function SegmentedControl({ label, options, value, onChange, ...rest }) {
|
|
|
750
1181
|
type: "button",
|
|
751
1182
|
role: "radio",
|
|
752
1183
|
"aria-checked": checked,
|
|
1184
|
+
"aria-label": o.hideLabel ? o.label : void 0,
|
|
1185
|
+
title: o.hideLabel ? o.label : void 0,
|
|
753
1186
|
tabIndex: i === tabbable ? 0 : -1,
|
|
754
1187
|
onClick: () => onChange(o.value),
|
|
755
1188
|
onKeyDown: (e) => onKeyDown(e, i),
|
|
756
1189
|
className: cx(
|
|
757
|
-
"inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap
|
|
758
|
-
|
|
1190
|
+
"inline-flex shrink-0 items-center justify-center gap-space-xs whitespace-nowrap transition-colors",
|
|
1191
|
+
opt.base,
|
|
1192
|
+
variant === "default" && (o.hideLabel ? "px-space-xs" : "px-space-sm"),
|
|
1193
|
+
checked ? opt.on : opt.off,
|
|
759
1194
|
FOCUS_RING,
|
|
760
|
-
TOUCH
|
|
1195
|
+
o.hideLabel ? TOUCH_ICON : TOUCH
|
|
761
1196
|
),
|
|
762
1197
|
children: [
|
|
763
|
-
o.
|
|
764
|
-
o.
|
|
1198
|
+
o.dot && /* @__PURE__ */ jsx34(Dot, { tone: o.dot }),
|
|
1199
|
+
o.icon && /* @__PURE__ */ jsx34(Icon, { name: o.icon, size: "sm" }),
|
|
1200
|
+
!o.hideLabel && o.label
|
|
765
1201
|
]
|
|
766
1202
|
},
|
|
767
1203
|
o.value
|
|
@@ -770,31 +1206,43 @@ function SegmentedControl({ label, options, value, onChange, ...rest }) {
|
|
|
770
1206
|
}
|
|
771
1207
|
|
|
772
1208
|
// src/components/Dialog.tsx
|
|
773
|
-
import {
|
|
1209
|
+
import { useId as useId5, useRef as useRef4 } from "react";
|
|
774
1210
|
import { createPortal } from "react-dom";
|
|
775
|
-
|
|
776
|
-
|
|
1211
|
+
|
|
1212
|
+
// src/internal/useModal.ts
|
|
1213
|
+
import { useEffect, useRef as useRef3 } from "react";
|
|
777
1214
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1215
|
+
var openPanels = [];
|
|
1216
|
+
var locks = 0;
|
|
1217
|
+
var savedOverflow = "";
|
|
1218
|
+
function lockScroll() {
|
|
1219
|
+
if (locks++ === 0) {
|
|
1220
|
+
savedOverflow = document.body.style.overflow;
|
|
1221
|
+
document.body.style.overflow = "hidden";
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
function unlockScroll() {
|
|
1225
|
+
if (--locks === 0) document.body.style.overflow = savedOverflow;
|
|
1226
|
+
}
|
|
1227
|
+
function useModal({ open, onClose, panelRef, initialFocusRef }) {
|
|
783
1228
|
const onCloseRef = useRef3(onClose);
|
|
784
|
-
const theme = useThemeTone();
|
|
785
1229
|
useEffect(() => {
|
|
786
1230
|
onCloseRef.current = onClose;
|
|
787
1231
|
});
|
|
788
1232
|
useEffect(() => {
|
|
789
1233
|
if (!open) return;
|
|
790
1234
|
const opener = document.activeElement;
|
|
791
|
-
const previousOverflow = document.body.style.overflow;
|
|
792
|
-
document.body.style.overflow = "hidden";
|
|
793
1235
|
const panel = panelRef.current;
|
|
1236
|
+
openPanels.push(panel);
|
|
1237
|
+
lockScroll();
|
|
794
1238
|
const focusables = () => [...panel.querySelectorAll(FOCUSABLE)];
|
|
795
|
-
|
|
1239
|
+
const initial = initialFocusRef?.current;
|
|
1240
|
+
const target = initial?.matches(FOCUSABLE) ? initial : initial?.querySelector(FOCUSABLE);
|
|
1241
|
+
(target ?? focusables()[0] ?? panel).focus();
|
|
796
1242
|
const onKey = (e) => {
|
|
797
1243
|
if (e.defaultPrevented) return;
|
|
1244
|
+
const owner = openPanels.find((p) => p.contains(document.activeElement));
|
|
1245
|
+
if (owner ? owner !== panel : openPanels[openPanels.length - 1] !== panel) return;
|
|
798
1246
|
if (e.key === "Escape") {
|
|
799
1247
|
e.preventDefault();
|
|
800
1248
|
onCloseRef.current();
|
|
@@ -818,7 +1266,8 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
|
|
|
818
1266
|
document.addEventListener("keydown", onKey);
|
|
819
1267
|
return () => {
|
|
820
1268
|
document.removeEventListener("keydown", onKey);
|
|
821
|
-
|
|
1269
|
+
openPanels.splice(openPanels.indexOf(panel), 1);
|
|
1270
|
+
unlockScroll();
|
|
822
1271
|
if (opener?.isConnected) opener.focus();
|
|
823
1272
|
else {
|
|
824
1273
|
document.activeElement?.blur();
|
|
@@ -826,17 +1275,29 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
|
|
|
826
1275
|
}
|
|
827
1276
|
};
|
|
828
1277
|
}, [open]);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// src/components/Dialog.tsx
|
|
1281
|
+
import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1282
|
+
var SIZE12 = { sm: "max-w-sm", md: "max-w-md", lg: "max-w-2xl" };
|
|
1283
|
+
function Dialog({ open, onClose, title, description, footer, size = "md", children, ...rest }) {
|
|
1284
|
+
const titleId = useId5();
|
|
1285
|
+
const descId = useId5();
|
|
1286
|
+
const panelRef = useRef4(null);
|
|
1287
|
+
const contentRef = useRef4(null);
|
|
1288
|
+
const theme = useThemeTone();
|
|
1289
|
+
useModal({ open, onClose, panelRef, initialFocusRef: contentRef });
|
|
829
1290
|
if (!open || typeof document === "undefined") return null;
|
|
830
1291
|
return createPortal(
|
|
831
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ jsx35(
|
|
832
1293
|
"div",
|
|
833
1294
|
{
|
|
834
1295
|
"data-theme": theme,
|
|
835
1296
|
className: "fixed inset-0 z-50 flex items-end justify-center bg-brand-obsidian/40 p-space-md backdrop-blur-sm sm:items-center",
|
|
836
1297
|
onMouseDown: (e) => {
|
|
837
|
-
if (e.target === e.currentTarget)
|
|
1298
|
+
if (e.target === e.currentTarget) onClose();
|
|
838
1299
|
},
|
|
839
|
-
children: /* @__PURE__ */
|
|
1300
|
+
children: /* @__PURE__ */ jsxs20(
|
|
840
1301
|
"div",
|
|
841
1302
|
{
|
|
842
1303
|
...rest,
|
|
@@ -846,15 +1307,15 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
|
|
|
846
1307
|
"aria-labelledby": titleId,
|
|
847
1308
|
"aria-describedby": description ? descId : void 0,
|
|
848
1309
|
tabIndex: -1,
|
|
849
|
-
className: cx("relative flex max-h-[calc(100dvh-2rem)] w-full min-w-0 flex-col gap-space-md overflow-y-auto rounded-xl bg-surface-elevated p-space-lg text-on-surface shadow-md outline-none",
|
|
1310
|
+
className: cx("relative flex max-h-[calc(100dvh-2rem)] w-full min-w-0 flex-col gap-space-md overflow-y-auto rounded-xl bg-surface-elevated p-space-lg text-on-surface shadow-md outline-none", SIZE12[size]),
|
|
850
1311
|
children: [
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
/* @__PURE__ */
|
|
853
|
-
description && /* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ jsxs20("div", { className: "min-w-0 pr-space-xl", children: [
|
|
1313
|
+
/* @__PURE__ */ jsx35("h2", { id: titleId, className: "font-display text-headline-md text-ink wrap-break-word", children: title }),
|
|
1314
|
+
description && /* @__PURE__ */ jsx35("p", { id: descId, className: "font-body-sm text-body-sm text-on-surface-variant", children: description })
|
|
854
1315
|
] }),
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
footer && /* @__PURE__ */
|
|
857
|
-
/* @__PURE__ */
|
|
1316
|
+
/* @__PURE__ */ jsx35("div", { ref: contentRef, className: "flex min-w-0 flex-col gap-space-sm", children }),
|
|
1317
|
+
footer && /* @__PURE__ */ jsx35("div", { className: "flex flex-wrap justify-end gap-space-sm", children: footer }),
|
|
1318
|
+
/* @__PURE__ */ jsx35("div", { className: "absolute right-space-md top-space-md", children: /* @__PURE__ */ jsx35(IconButton, { icon: "close", label: "Close", onClick: onClose }) })
|
|
858
1319
|
]
|
|
859
1320
|
}
|
|
860
1321
|
)
|
|
@@ -865,16 +1326,18 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
|
|
|
865
1326
|
}
|
|
866
1327
|
|
|
867
1328
|
// src/components/Menu.tsx
|
|
868
|
-
import { useEffect as useEffect2, useId as useId6, useRef as
|
|
869
|
-
import { jsx as
|
|
870
|
-
|
|
871
|
-
|
|
1329
|
+
import { useEffect as useEffect2, useId as useId6, useRef as useRef5, useState as useState2 } from "react";
|
|
1330
|
+
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1331
|
+
var isItem = (e) => !("type" in e);
|
|
1332
|
+
function Menu({ label, trigger, items, align = "end", header, footer, ...rest }) {
|
|
1333
|
+
const [open, setOpen] = useState2(false);
|
|
872
1334
|
const triggerId = useId6();
|
|
873
1335
|
const menuId = useId6();
|
|
874
|
-
const rootRef =
|
|
875
|
-
const triggerRef =
|
|
876
|
-
const itemRefs =
|
|
877
|
-
const pendingFocus =
|
|
1336
|
+
const rootRef = useRef5(null);
|
|
1337
|
+
const triggerRef = useRef5(null);
|
|
1338
|
+
const itemRefs = useRef5([]);
|
|
1339
|
+
const pendingFocus = useRef5(null);
|
|
1340
|
+
const actions = items.filter(isItem);
|
|
878
1341
|
const openAt = (index) => {
|
|
879
1342
|
pendingFocus.current = index;
|
|
880
1343
|
setOpen(true);
|
|
@@ -900,7 +1363,7 @@ function Menu({ label, trigger, items, align = "end", ...rest }) {
|
|
|
900
1363
|
focusItem(0);
|
|
901
1364
|
} else if (e.key === "ArrowUp") {
|
|
902
1365
|
e.preventDefault();
|
|
903
|
-
focusItem(
|
|
1366
|
+
focusItem(actions.length - 1);
|
|
904
1367
|
} else if (e.key === "Escape" && open) {
|
|
905
1368
|
e.preventDefault();
|
|
906
1369
|
close(true);
|
|
@@ -917,12 +1380,13 @@ function Menu({ label, trigger, items, align = "end", ...rest }) {
|
|
|
917
1380
|
return;
|
|
918
1381
|
}
|
|
919
1382
|
const current = itemRefs.current.indexOf(document.activeElement);
|
|
920
|
-
const next = rovingIndex(e.key, Math.max(0, current),
|
|
1383
|
+
const next = rovingIndex(e.key, Math.max(0, current), actions.length);
|
|
921
1384
|
if (next === null) return;
|
|
922
1385
|
e.preventDefault();
|
|
923
1386
|
itemRefs.current[next]?.focus();
|
|
924
1387
|
};
|
|
925
|
-
|
|
1388
|
+
let actionIndex = 0;
|
|
1389
|
+
return /* @__PURE__ */ jsxs21("div", { ...rest, ref: rootRef, className: "relative inline-flex", children: [
|
|
926
1390
|
trigger({
|
|
927
1391
|
ref: triggerRef,
|
|
928
1392
|
id: triggerId,
|
|
@@ -932,123 +1396,149 @@ function Menu({ label, trigger, items, align = "end", ...rest }) {
|
|
|
932
1396
|
onClick: () => open ? close(false) : openAt(0),
|
|
933
1397
|
onKeyDown: onTriggerKeyDown
|
|
934
1398
|
}),
|
|
935
|
-
open && /* @__PURE__ */
|
|
1399
|
+
open && /* @__PURE__ */ jsxs21(
|
|
936
1400
|
"div",
|
|
937
1401
|
{
|
|
938
|
-
id: menuId,
|
|
939
|
-
role: "menu",
|
|
940
|
-
"aria-label": label,
|
|
941
|
-
onKeyDown: onMenuKeyDown,
|
|
942
1402
|
className: cx(
|
|
943
|
-
"absolute top-full z-40 mt-space-xs flex min-w-48 max-w-[calc(100vw-2rem)] flex-col rounded-xl border border-border-subtle bg-surface-elevated
|
|
1403
|
+
"absolute top-full z-40 mt-space-xs flex min-w-48 max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border border-border-subtle bg-surface-elevated shadow-md",
|
|
944
1404
|
align === "end" ? "right-0" : "left-0"
|
|
945
1405
|
),
|
|
946
|
-
children:
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1406
|
+
children: [
|
|
1407
|
+
header && /* @__PURE__ */ jsx36("div", { className: "border-b border-border-subtle px-space-sm py-space-sm", children: header }),
|
|
1408
|
+
/* @__PURE__ */ jsx36("div", { id: menuId, role: "menu", "aria-label": label, onKeyDown: onMenuKeyDown, className: "flex flex-col p-space-2xs", children: items.map((entry, i) => {
|
|
1409
|
+
if (!isItem(entry)) return /* @__PURE__ */ jsx36("div", { role: "separator", className: "my-space-2xs h-px bg-border-subtle" }, `sep-${i}`);
|
|
1410
|
+
const index = actionIndex++;
|
|
1411
|
+
const C = entry.href ? entry.as ?? "a" : "button";
|
|
1412
|
+
return /* @__PURE__ */ jsxs21(
|
|
1413
|
+
C,
|
|
1414
|
+
{
|
|
1415
|
+
ref: (el) => {
|
|
1416
|
+
itemRefs.current[index] = el;
|
|
1417
|
+
},
|
|
1418
|
+
role: "menuitem",
|
|
1419
|
+
tabIndex: -1,
|
|
1420
|
+
...entry.href ? { href: entry.href } : { type: "button" },
|
|
1421
|
+
onClick: () => {
|
|
1422
|
+
entry.onSelect?.();
|
|
1423
|
+
close(!entry.href);
|
|
1424
|
+
},
|
|
1425
|
+
className: cx(
|
|
1426
|
+
"flex w-full items-center gap-space-sm rounded-lg px-space-sm py-space-xs text-left font-body-md text-body-md outline-none hover:bg-surface-muted focus:bg-surface-muted",
|
|
1427
|
+
entry.tone === "danger" ? "text-fg-danger" : "text-on-surface",
|
|
1428
|
+
TOUCH
|
|
1429
|
+
),
|
|
1430
|
+
children: [
|
|
1431
|
+
entry.icon && /* @__PURE__ */ jsx36(Icon, { name: entry.icon, size: "sm" }),
|
|
1432
|
+
/* @__PURE__ */ jsx36("span", { className: "min-w-0 flex-1 truncate", children: entry.label }),
|
|
1433
|
+
entry.meta !== void 0 && /* @__PURE__ */ jsx36("span", { className: "shrink-0 font-label-mono text-label-mono text-on-surface-variant", children: entry.meta }),
|
|
1434
|
+
entry.shortcut && /* @__PURE__ */ jsx36(Kbd, { children: entry.shortcut })
|
|
1435
|
+
]
|
|
960
1436
|
},
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
children: [
|
|
967
|
-
item.icon && /* @__PURE__ */ jsx35(Icon, { name: item.icon, size: "sm" }),
|
|
968
|
-
/* @__PURE__ */ jsx35("span", { className: "truncate", children: item.label })
|
|
969
|
-
]
|
|
970
|
-
},
|
|
971
|
-
item.label
|
|
972
|
-
);
|
|
973
|
-
})
|
|
1437
|
+
i
|
|
1438
|
+
);
|
|
1439
|
+
}) }),
|
|
1440
|
+
footer && /* @__PURE__ */ jsx36("div", { className: "border-t border-border-subtle bg-surface-subtle px-space-sm py-space-xs", children: footer })
|
|
1441
|
+
]
|
|
974
1442
|
}
|
|
975
1443
|
)
|
|
976
1444
|
] });
|
|
977
1445
|
}
|
|
978
1446
|
|
|
979
1447
|
// src/ide/Breadcrumbs.tsx
|
|
980
|
-
import { jsx as
|
|
1448
|
+
import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
981
1449
|
function Breadcrumbs({ items, label = "Breadcrumb", ...rest }) {
|
|
982
1450
|
const collapse = items.length > 2;
|
|
983
|
-
return /* @__PURE__ */
|
|
1451
|
+
return /* @__PURE__ */ jsx37("nav", { ...rest, "aria-label": label, className: "min-w-0", children: /* @__PURE__ */ jsx37("ol", { className: "flex min-w-0 items-center gap-space-xs font-body-sm text-body-sm text-on-surface-variant", children: items.map((c, i) => {
|
|
984
1452
|
const last = i === items.length - 1;
|
|
985
1453
|
const middle = i > 0 && !last;
|
|
986
1454
|
const C = c.as ?? "a";
|
|
987
1455
|
return [
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
i > 0 && /* @__PURE__ */
|
|
990
|
-
last ? /* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ jsxs22("li", { className: cx("flex min-w-0 items-center gap-space-xs", middle && collapse && "max-md:hidden", last && "min-w-0"), children: [
|
|
1457
|
+
i > 0 && /* @__PURE__ */ jsx37(Icon, { name: "chevron_right", size: "sm" }),
|
|
1458
|
+
last ? /* @__PURE__ */ jsx37("span", { "aria-current": "page", className: "truncate font-medium text-on-surface", children: c.label }) : c.href ? /* @__PURE__ */ jsx37(C, { href: c.href, className: cx("truncate rounded hover:text-on-surface", FOCUS_RING), children: c.label }) : /* @__PURE__ */ jsx37("span", { className: "truncate", children: c.label })
|
|
991
1459
|
] }, c.label + i),
|
|
992
|
-
i === 0 && collapse && /* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
994
|
-
/* @__PURE__ */
|
|
1460
|
+
i === 0 && collapse && /* @__PURE__ */ jsxs22("li", { "aria-hidden": "true", className: "flex items-center gap-space-xs md:hidden", children: [
|
|
1461
|
+
/* @__PURE__ */ jsx37(Icon, { name: "chevron_right", size: "sm" }),
|
|
1462
|
+
/* @__PURE__ */ jsx37("span", { children: "\u2026" })
|
|
995
1463
|
] }, "ellipsis")
|
|
996
1464
|
];
|
|
997
1465
|
}) }) });
|
|
998
1466
|
}
|
|
999
1467
|
|
|
1000
1468
|
// src/ide/StatusBar.tsx
|
|
1001
|
-
import { jsx as
|
|
1002
|
-
var
|
|
1469
|
+
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1470
|
+
var TONE10 = { default: "", success: TEXT_TONE.success, danger: TEXT_TONE.danger, warning: TEXT_TONE.warning, brand: TEXT_TONE.brand };
|
|
1003
1471
|
function StatusItem({ icon, tone = "default", children, ...rest }) {
|
|
1004
|
-
return /* @__PURE__ */
|
|
1005
|
-
icon && /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ jsxs23("span", { ...rest, className: cx("inline-flex shrink-0 items-center gap-space-2xs", TONE10[tone]), children: [
|
|
1473
|
+
icon && /* @__PURE__ */ jsx38(Icon, { name: icon, size: "sm" }),
|
|
1006
1474
|
children
|
|
1007
1475
|
] });
|
|
1008
1476
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1477
|
+
var BAR = {
|
|
1478
|
+
default: "h-7 border-t border-border-subtle bg-surface-subtle",
|
|
1479
|
+
// Filled strip without a rule (dark IDE card footer).
|
|
1480
|
+
raised: "h-9 bg-surface-container"
|
|
1481
|
+
};
|
|
1482
|
+
function StatusBarRoot({ start, end, label = "Status", tone = "default", ...rest }) {
|
|
1483
|
+
return /* @__PURE__ */ jsxs23("footer", { ...rest, "aria-label": label, className: cx("flex min-w-0 shrink-0 items-center justify-between gap-space-md overflow-hidden px-space-sm font-label-mono text-[11px] text-on-surface-variant", BAR[tone]), children: [
|
|
1484
|
+
/* @__PURE__ */ jsx38("div", { className: "flex min-w-0 items-center gap-space-md overflow-hidden", children: start }),
|
|
1485
|
+
/* @__PURE__ */ jsx38("div", { className: "flex min-w-0 items-center gap-space-md overflow-hidden", children: end })
|
|
1013
1486
|
] });
|
|
1014
1487
|
}
|
|
1015
1488
|
var StatusBar = Object.assign(StatusBarRoot, { Item: StatusItem });
|
|
1016
1489
|
|
|
1017
1490
|
// src/ide/MetricTile.tsx
|
|
1018
|
-
import { jsx as
|
|
1019
|
-
var
|
|
1020
|
-
function MetricTile({ label, value, tone = "neutral", icon, ...rest }) {
|
|
1021
|
-
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
|
|
1024
|
-
/* @__PURE__ */
|
|
1491
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1492
|
+
var TONE11 = { success: "text-fg-success", danger: "text-fg-danger", warning: "text-fg-warning", brand: "text-fg-brand", neutral: "text-ink" };
|
|
1493
|
+
function MetricTile({ label, value, tone = "neutral", icon, hint, hintTone = "muted", variant = "default", ...rest }) {
|
|
1494
|
+
if (variant === "centered") {
|
|
1495
|
+
return /* @__PURE__ */ jsxs24("div", { ...rest, className: "flex min-w-0 flex-col items-center rounded-lg bg-surface-subtle p-space-sm text-center", children: [
|
|
1496
|
+
/* @__PURE__ */ jsx39("span", { className: cx("truncate font-display text-headline-lg", TONE11[tone]), children: value }),
|
|
1497
|
+
/* @__PURE__ */ jsx39("span", { className: "truncate font-body-sm text-body-sm text-on-surface-variant", children: label })
|
|
1498
|
+
] });
|
|
1499
|
+
}
|
|
1500
|
+
return /* @__PURE__ */ jsxs24("div", { ...rest, className: "flex min-w-0 flex-col gap-space-2xs rounded-lg bg-surface-subtle p-space-sm", children: [
|
|
1501
|
+
/* @__PURE__ */ jsxs24("span", { className: "flex min-w-0 items-center gap-space-2xs font-label-mono text-label-mono uppercase text-on-surface-variant", children: [
|
|
1502
|
+
icon && /* @__PURE__ */ jsx39(Icon, { name: icon, size: "sm" }),
|
|
1503
|
+
/* @__PURE__ */ jsx39("span", { className: "truncate", children: label })
|
|
1025
1504
|
] }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ jsx39("span", { className: cx("truncate font-display text-headline-sm", TONE11[tone]), children: value }),
|
|
1506
|
+
hint && /* @__PURE__ */ jsx39("span", { className: cx("truncate font-body-sm text-body-sm", TEXT_TONE[hintTone]), children: hint })
|
|
1027
1507
|
] });
|
|
1028
1508
|
}
|
|
1029
1509
|
|
|
1030
1510
|
// src/ide/Avatar.tsx
|
|
1031
|
-
import { useState as
|
|
1032
|
-
import { jsx as
|
|
1033
|
-
var
|
|
1511
|
+
import { useState as useState3 } from "react";
|
|
1512
|
+
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1513
|
+
var AVATAR_SIZE = { sm: "size-7 text-[11px]", ms: "size-8 text-xs", md: "size-9 text-xs", ml: "size-10 text-sm", lg: "size-12 text-sm" };
|
|
1514
|
+
var SHAPE3 = { circle: "rounded-full", square: "rounded-lg" };
|
|
1515
|
+
var TONE12 = {
|
|
1516
|
+
ink: "bg-ink text-on-ink",
|
|
1517
|
+
brand: "bg-brand-cobalt text-white",
|
|
1518
|
+
success: "bg-badge-beginner-text text-badge-beginner-bg",
|
|
1519
|
+
warning: "bg-badge-amber-text text-badge-amber-bg",
|
|
1520
|
+
danger: "bg-badge-advanced-text text-badge-advanced-bg"
|
|
1521
|
+
};
|
|
1034
1522
|
function initials(name) {
|
|
1035
1523
|
return name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
1036
1524
|
}
|
|
1037
|
-
function Avatar({ name, src, size = "md", badge, ...rest }) {
|
|
1038
|
-
const [
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1525
|
+
function Avatar({ name, src, size = "md", shape = "circle", tone = "ink", badge, status, statusLabel, ...rest }) {
|
|
1526
|
+
const [failedSrc, setFailedSrc] = useState3(void 0);
|
|
1527
|
+
const accessibleName = statusLabel ? `${name}, ${statusLabel}` : name;
|
|
1528
|
+
return /* @__PURE__ */ jsxs25("span", { ...rest, className: "relative inline-flex shrink-0", children: [
|
|
1529
|
+
src && failedSrc !== src ? /* @__PURE__ */ jsx40("img", { src, alt: accessibleName, onError: () => setFailedSrc(src), className: cx("object-cover", SHAPE3[shape], AVATAR_SIZE[size]) }) : /* @__PURE__ */ jsx40("span", { role: "img", "aria-label": accessibleName, className: cx("inline-flex items-center justify-center font-label-mono", SHAPE3[shape], TONE12[tone], AVATAR_SIZE[size]), children: initials(name) }),
|
|
1530
|
+
status && /* @__PURE__ */ jsx40("span", { "aria-hidden": "true", className: cx("absolute bottom-0 right-0 size-2.5 rounded-full ring-2 ring-surface-elevated", DOT_TONE[status]) }),
|
|
1531
|
+
badge && /* @__PURE__ */ jsx40("span", { className: "absolute -bottom-1 -right-1 rounded-full border-2 border-surface-elevated bg-brand-cobalt px-1 font-label-mono text-[10px] leading-4 text-white", children: badge })
|
|
1042
1532
|
] });
|
|
1043
1533
|
}
|
|
1044
1534
|
|
|
1045
1535
|
// src/ide/EditorTabs.tsx
|
|
1046
|
-
import { Fragment as
|
|
1536
|
+
import { Fragment as Fragment3, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1047
1537
|
function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", ...rest }) {
|
|
1048
1538
|
if (!tabs.length) return null;
|
|
1049
|
-
return /* @__PURE__ */
|
|
1539
|
+
return /* @__PURE__ */ jsx41("nav", { ...rest, "aria-label": label, className: "min-w-0 max-w-full border-b border-border-subtle bg-surface-subtle", children: /* @__PURE__ */ jsx41("ul", { className: "flex min-w-0 overflow-x-auto [scrollbar-width:none]", children: tabs.map((t) => {
|
|
1050
1540
|
const active = t.id === activeId;
|
|
1051
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ jsxs26(
|
|
1052
1542
|
"li",
|
|
1053
1543
|
{
|
|
1054
1544
|
className: cx(
|
|
@@ -1056,7 +1546,7 @@ function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", .
|
|
|
1056
1546
|
active ? "bg-surface-elevated text-ink shadow-[inset_0_-2px_0_var(--color-brand-cobalt)]" : "text-on-surface-variant hover:text-on-surface"
|
|
1057
1547
|
),
|
|
1058
1548
|
children: [
|
|
1059
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ jsxs26(
|
|
1060
1550
|
"button",
|
|
1061
1551
|
{
|
|
1062
1552
|
type: "button",
|
|
@@ -1070,25 +1560,25 @@ function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", .
|
|
|
1070
1560
|
},
|
|
1071
1561
|
className: cx("flex items-center gap-space-xs whitespace-nowrap px-space-md py-space-xs font-code-inline text-code-inline", FOCUS_RING, TOUCH),
|
|
1072
1562
|
children: [
|
|
1073
|
-
t.readOnly && /* @__PURE__ */
|
|
1563
|
+
t.readOnly && /* @__PURE__ */ jsx41(Icon, { name: "lock", size: "sm", label: "Read-only" }),
|
|
1074
1564
|
t.readOnly && " ",
|
|
1075
1565
|
t.label,
|
|
1076
|
-
t.modified && /* @__PURE__ */
|
|
1566
|
+
t.modified && /* @__PURE__ */ jsxs26(Fragment3, { children: [
|
|
1077
1567
|
" ",
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1568
|
+
/* @__PURE__ */ jsx41(Dot, { tone: "brand" }),
|
|
1569
|
+
/* @__PURE__ */ jsx41("span", { className: "sr-only", children: "(modified)" })
|
|
1080
1570
|
] })
|
|
1081
1571
|
]
|
|
1082
1572
|
}
|
|
1083
1573
|
),
|
|
1084
|
-
onClose && /* @__PURE__ */
|
|
1574
|
+
onClose && /* @__PURE__ */ jsx41(
|
|
1085
1575
|
"button",
|
|
1086
1576
|
{
|
|
1087
1577
|
type: "button",
|
|
1088
1578
|
"aria-label": `Close ${t.label}`,
|
|
1089
1579
|
onClick: () => onClose(t.id),
|
|
1090
1580
|
className: cx("mr-space-2xs inline-flex size-6 items-center justify-center rounded text-on-surface-variant hover:bg-surface-muted hover:text-on-surface", FOCUS_RING, TOUCH_ICON),
|
|
1091
|
-
children: /* @__PURE__ */
|
|
1581
|
+
children: /* @__PURE__ */ jsx41(Icon, { name: "close", size: "sm" })
|
|
1092
1582
|
}
|
|
1093
1583
|
)
|
|
1094
1584
|
]
|
|
@@ -1099,8 +1589,8 @@ function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", .
|
|
|
1099
1589
|
}
|
|
1100
1590
|
|
|
1101
1591
|
// src/ide/Countdown.tsx
|
|
1102
|
-
import { useEffect as useEffect3, useRef as
|
|
1103
|
-
import { jsx as
|
|
1592
|
+
import { useEffect as useEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
1593
|
+
import { jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
1104
1594
|
var pad = (n) => String(n).padStart(2, "0");
|
|
1105
1595
|
function formatClock(totalSeconds) {
|
|
1106
1596
|
const s = Math.max(0, Math.floor(totalSeconds));
|
|
@@ -1108,11 +1598,11 @@ function formatClock(totalSeconds) {
|
|
|
1108
1598
|
const m = Math.floor(s % 3600 / 60);
|
|
1109
1599
|
return h > 0 ? `${h}:${pad(m)}:${pad(s % 60)}` : `${pad(m)}:${pad(s % 60)}`;
|
|
1110
1600
|
}
|
|
1111
|
-
function Countdown({ seconds, until, direction = "down", warnAt, onExpire, label = "Time remaining", ...rest }) {
|
|
1112
|
-
const [start] =
|
|
1113
|
-
const [now, setNow] =
|
|
1114
|
-
const onExpireRef =
|
|
1115
|
-
const fired =
|
|
1601
|
+
function Countdown({ seconds, until, direction = "down", warnAt, onExpire, label = "Time remaining", variant = "plain", ...rest }) {
|
|
1602
|
+
const [start] = useState4(() => Date.now());
|
|
1603
|
+
const [now, setNow] = useState4(() => until ? null : start);
|
|
1604
|
+
const onExpireRef = useRef6(onExpire);
|
|
1605
|
+
const fired = useRef6(false);
|
|
1116
1606
|
useEffect3(() => {
|
|
1117
1607
|
onExpireRef.current = onExpire;
|
|
1118
1608
|
});
|
|
@@ -1136,14 +1626,27 @@ function Countdown({ seconds, until, direction = "down", warnAt, onExpire, label
|
|
|
1136
1626
|
}
|
|
1137
1627
|
}, [expired]);
|
|
1138
1628
|
const warn = direction === "down" && warnAt !== void 0 && value !== null && value <= warnAt;
|
|
1139
|
-
return /* @__PURE__ */
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1629
|
+
return /* @__PURE__ */ jsxs27(
|
|
1630
|
+
"span",
|
|
1631
|
+
{
|
|
1632
|
+
...rest,
|
|
1633
|
+
role: "timer",
|
|
1634
|
+
"aria-label": label,
|
|
1635
|
+
className: cx(
|
|
1636
|
+
"inline-flex items-center gap-space-2xs tabular-nums",
|
|
1637
|
+
variant === "chip" ? "rounded bg-surface-subtle px-space-sm py-space-xs font-label-mono text-label-mono" : "font-code-inline text-code-inline",
|
|
1638
|
+
warn ? "text-fg-danger" : "text-on-surface"
|
|
1639
|
+
),
|
|
1640
|
+
children: [
|
|
1641
|
+
/* @__PURE__ */ jsx42("span", { className: variant === "chip" ? "text-fg-brand" : void 0, children: /* @__PURE__ */ jsx42(Icon, { name: "timer", size: "sm", tone: "inherit" }) }),
|
|
1642
|
+
value === null ? "--:--" : formatClock(value)
|
|
1643
|
+
]
|
|
1644
|
+
}
|
|
1645
|
+
);
|
|
1143
1646
|
}
|
|
1144
1647
|
|
|
1145
1648
|
// src/ide/FileTree.tsx
|
|
1146
|
-
import { useId as useId7, useMemo, useRef as
|
|
1649
|
+
import { useId as useId7, useMemo, useRef as useRef7, useState as useState5 } from "react";
|
|
1147
1650
|
|
|
1148
1651
|
// src/ide/tree.ts
|
|
1149
1652
|
function buildTree(nodes) {
|
|
@@ -1161,6 +1664,9 @@ function buildTree(nodes) {
|
|
|
1161
1664
|
kind,
|
|
1162
1665
|
readOnly: extra?.readOnly,
|
|
1163
1666
|
modified: extra?.modified,
|
|
1667
|
+
icon: extra?.icon,
|
|
1668
|
+
status: extra?.status,
|
|
1669
|
+
meta: extra?.meta,
|
|
1164
1670
|
level: parts.length,
|
|
1165
1671
|
parent: parentPath,
|
|
1166
1672
|
children: []
|
|
@@ -1199,7 +1705,7 @@ function allDirs(roots) {
|
|
|
1199
1705
|
}
|
|
1200
1706
|
|
|
1201
1707
|
// src/ide/FileTree.tsx
|
|
1202
|
-
import { Fragment as
|
|
1708
|
+
import { Fragment as Fragment4, jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
1203
1709
|
var EXT_ICON = {
|
|
1204
1710
|
ts: "code",
|
|
1205
1711
|
tsx: "code",
|
|
@@ -1214,13 +1720,19 @@ function fileIcon(name) {
|
|
|
1214
1720
|
const ext = name.includes(".") ? name.split(".").pop().toLowerCase() : "";
|
|
1215
1721
|
return EXT_ICON[ext] ?? "description";
|
|
1216
1722
|
}
|
|
1723
|
+
var STATUS_ICON = {
|
|
1724
|
+
success: { name: "check_circle", tone: "success", label: "Passing" },
|
|
1725
|
+
warning: { name: "warning", tone: "warning", label: "Warning" },
|
|
1726
|
+
danger: { name: "error", tone: "danger", label: "Failing" },
|
|
1727
|
+
info: { name: "info", tone: "brand", label: "Info" }
|
|
1728
|
+
};
|
|
1217
1729
|
function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, ...rest }) {
|
|
1218
1730
|
const baseId = useId7();
|
|
1219
1731
|
const roots = useMemo(() => buildTree(nodes), [nodes]);
|
|
1220
1732
|
const allOpen = defaultExpanded === "all";
|
|
1221
|
-
const [toggled, setToggled] =
|
|
1222
|
-
const [focused, setFocused] =
|
|
1223
|
-
const refs =
|
|
1733
|
+
const [toggled, setToggled] = useState5(() => new Set(allOpen ? [] : defaultExpanded));
|
|
1734
|
+
const [focused, setFocused] = useState5(activePath);
|
|
1735
|
+
const refs = useRef7(/* @__PURE__ */ new Map());
|
|
1224
1736
|
if (!roots.length) return null;
|
|
1225
1737
|
const expanded = new Set(allDirs(roots).filter((d) => toggled.has(d) !== allOpen));
|
|
1226
1738
|
const visible = flattenVisible(roots, expanded);
|
|
@@ -1279,7 +1791,7 @@ function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, .
|
|
|
1279
1791
|
const isDir = item.kind === "dir";
|
|
1280
1792
|
const isOpen = isDir && expanded.has(item.path);
|
|
1281
1793
|
const rowId = `${baseId}-${encodeURIComponent(item.path)}`;
|
|
1282
|
-
return /* @__PURE__ */
|
|
1794
|
+
return /* @__PURE__ */ jsxs28(
|
|
1283
1795
|
"li",
|
|
1284
1796
|
{
|
|
1285
1797
|
ref: (el) => {
|
|
@@ -1298,7 +1810,7 @@ function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, .
|
|
|
1298
1810
|
},
|
|
1299
1811
|
className: "outline-none [&:focus-visible>div]:ring-2 [&:focus-visible>div]:ring-inset [&:focus-visible>div]:ring-brand-cobalt",
|
|
1300
1812
|
children: [
|
|
1301
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsxs28(
|
|
1302
1814
|
"div",
|
|
1303
1815
|
{
|
|
1304
1816
|
id: rowId,
|
|
@@ -1312,26 +1824,31 @@ function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, .
|
|
|
1312
1824
|
item.path === activePath ? "bg-surface-muted text-ink" : "text-on-surface-variant hover:bg-surface-muted hover:text-on-surface"
|
|
1313
1825
|
),
|
|
1314
1826
|
children: [
|
|
1315
|
-
isDir ? /* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1317
|
-
/* @__PURE__ */
|
|
1827
|
+
isDir ? /* @__PURE__ */ jsx43(Icon, { name: isOpen ? "expand_more" : "chevron_right", size: "sm" }) : /* @__PURE__ */ jsx43("span", { className: "inline-block w-4 shrink-0" }),
|
|
1828
|
+
/* @__PURE__ */ jsx43(Icon, { name: isDir ? isOpen ? "folder_open" : "folder" : item.icon ?? fileIcon(item.name), size: "sm", tone: isDir ? "brand" : "inherit" }),
|
|
1829
|
+
/* @__PURE__ */ jsx43("span", { className: "truncate", children: item.name }),
|
|
1318
1830
|
item.readOnly && " ",
|
|
1319
|
-
item.readOnly && /* @__PURE__ */
|
|
1320
|
-
item.modified && /* @__PURE__ */
|
|
1831
|
+
item.readOnly && /* @__PURE__ */ jsx43(Icon, { name: "lock", size: "sm", label: "Read-only" }),
|
|
1832
|
+
item.modified && /* @__PURE__ */ jsxs28(Fragment4, { children: [
|
|
1321
1833
|
" ",
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
] })
|
|
1834
|
+
/* @__PURE__ */ jsx43(Dot, { tone: "brand" }),
|
|
1835
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", children: "(modified)" })
|
|
1836
|
+
] }),
|
|
1837
|
+
item.status && /* @__PURE__ */ jsxs28(Fragment4, { children: [
|
|
1838
|
+
" ",
|
|
1839
|
+
/* @__PURE__ */ jsx43(Icon, { name: STATUS_ICON[item.status].name, size: "sm", tone: STATUS_ICON[item.status].tone, label: STATUS_ICON[item.status].label })
|
|
1840
|
+
] }),
|
|
1841
|
+
item.meta !== void 0 && /* @__PURE__ */ jsx43("span", { className: "ml-auto shrink-0 font-label-mono text-[11px] text-on-surface-variant", children: item.meta })
|
|
1325
1842
|
]
|
|
1326
1843
|
}
|
|
1327
1844
|
),
|
|
1328
|
-
isDir && isOpen && item.children.length > 0 && /* @__PURE__ */
|
|
1845
|
+
isDir && isOpen && item.children.length > 0 && /* @__PURE__ */ jsx43("ul", { role: "group", children: renderItems(item.children) })
|
|
1329
1846
|
]
|
|
1330
1847
|
},
|
|
1331
1848
|
item.path
|
|
1332
1849
|
);
|
|
1333
1850
|
});
|
|
1334
|
-
return /* @__PURE__ */
|
|
1851
|
+
return /* @__PURE__ */ jsx43("ul", { ...rest, role: "tree", "aria-label": label, className: "min-w-0 overflow-auto py-space-xs", children: renderItems(roots) });
|
|
1335
1852
|
}
|
|
1336
1853
|
|
|
1337
1854
|
// src/ide/Workbench.tsx
|
|
@@ -1340,10 +1857,10 @@ import {
|
|
|
1340
1857
|
useContext as useContext2,
|
|
1341
1858
|
useEffect as useEffect4,
|
|
1342
1859
|
useId as useId8,
|
|
1343
|
-
useRef as
|
|
1344
|
-
useState as
|
|
1860
|
+
useRef as useRef8,
|
|
1861
|
+
useState as useState6
|
|
1345
1862
|
} from "react";
|
|
1346
|
-
import { Fragment as
|
|
1863
|
+
import { Fragment as Fragment5, jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
1347
1864
|
var DEFAULT_SIZES = { left: 240, right: 380, bottom: 30 };
|
|
1348
1865
|
var DEFAULT_LIMITS = { left: [160, 480], right: [260, 640], bottom: [15, 70] };
|
|
1349
1866
|
var DEFAULT_LABELS = { left: "Explorer", main: "Editor", right: "Details", bottom: "Panel" };
|
|
@@ -1357,7 +1874,7 @@ var COLUMNS = {
|
|
|
1357
1874
|
};
|
|
1358
1875
|
var clamp = (v, [min, max]) => Math.min(max, Math.max(min, v));
|
|
1359
1876
|
function readSizes(raw, defaults, limits) {
|
|
1360
|
-
let parsed;
|
|
1877
|
+
let parsed = null;
|
|
1361
1878
|
try {
|
|
1362
1879
|
parsed = raw ? JSON.parse(raw) : null;
|
|
1363
1880
|
} catch {
|
|
@@ -1377,7 +1894,7 @@ function Toggle({ panel }) {
|
|
|
1377
1894
|
const ctx = useContext2(WorkbenchContext);
|
|
1378
1895
|
if (!ctx) return null;
|
|
1379
1896
|
const open = ctx.drawer === panel;
|
|
1380
|
-
return /* @__PURE__ */
|
|
1897
|
+
return /* @__PURE__ */ jsx44("span", { className: "lg:hidden", children: /* @__PURE__ */ jsx44(
|
|
1381
1898
|
IconButton,
|
|
1382
1899
|
{
|
|
1383
1900
|
icon: panel === "left" ? "left_panel_open" : "right_panel_open",
|
|
@@ -1389,7 +1906,7 @@ function Toggle({ panel }) {
|
|
|
1389
1906
|
) });
|
|
1390
1907
|
}
|
|
1391
1908
|
function Separator({ panel, value, limits, label, controls, onChange, centerHeight }) {
|
|
1392
|
-
const drag =
|
|
1909
|
+
const drag = useRef8(null);
|
|
1393
1910
|
const vertical = panel !== "bottom";
|
|
1394
1911
|
const grow = panel === "left" ? "ArrowRight" : panel === "right" ? "ArrowLeft" : "ArrowUp";
|
|
1395
1912
|
const shrink = panel === "left" ? "ArrowLeft" : panel === "right" ? "ArrowRight" : "ArrowDown";
|
|
@@ -1419,7 +1936,7 @@ function Separator({ panel, value, limits, label, controls, onChange, centerHeig
|
|
|
1419
1936
|
const end = () => {
|
|
1420
1937
|
drag.current = null;
|
|
1421
1938
|
};
|
|
1422
|
-
return /* @__PURE__ */
|
|
1939
|
+
return /* @__PURE__ */ jsx44(
|
|
1423
1940
|
"div",
|
|
1424
1941
|
{
|
|
1425
1942
|
role: "separator",
|
|
@@ -1446,15 +1963,15 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
|
|
|
1446
1963
|
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
1447
1964
|
const limits = { ...DEFAULT_LIMITS, ...limitsProp };
|
|
1448
1965
|
const defaults = { ...DEFAULT_SIZES, ...defaultSizes };
|
|
1449
|
-
const [sizes, setSizes] =
|
|
1450
|
-
const [drawer, setDrawer] =
|
|
1451
|
-
const [mobileView, setMobileView] =
|
|
1966
|
+
const [sizes, setSizes] = useState6(defaults);
|
|
1967
|
+
const [drawer, setDrawer] = useState6(null);
|
|
1968
|
+
const [mobileView, setMobileView] = useState6("main");
|
|
1452
1969
|
const baseId = useId8();
|
|
1453
1970
|
const ids = { left: `${baseId}-left`, main: `${baseId}-main`, right: `${baseId}-right`, bottom: `${baseId}-bottom` };
|
|
1454
|
-
const centerRef =
|
|
1971
|
+
const centerRef = useRef8(null);
|
|
1455
1972
|
useEffect4(() => {
|
|
1456
1973
|
if (!persistKey) return;
|
|
1457
|
-
let raw;
|
|
1974
|
+
let raw = null;
|
|
1458
1975
|
try {
|
|
1459
1976
|
raw = window.localStorage.getItem(persistKey);
|
|
1460
1977
|
} catch {
|
|
@@ -1489,15 +2006,15 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
|
|
|
1489
2006
|
side === "left" ? "border-r border-border-subtle max-lg:left-0" : "border-l border-border-subtle max-lg:right-0",
|
|
1490
2007
|
drawer !== side && "max-lg:hidden"
|
|
1491
2008
|
);
|
|
1492
|
-
return /* @__PURE__ */
|
|
1493
|
-
header && /* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
left && /* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
2009
|
+
return /* @__PURE__ */ jsx44(WorkbenchContext.Provider, { value: { drawer, setDrawer, ids, labels }, children: /* @__PURE__ */ jsxs29("div", { ...rest, className: "flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface text-on-surface", children: [
|
|
2010
|
+
header && /* @__PURE__ */ jsx44("div", { className: "flex min-w-0 shrink-0 items-center gap-space-sm border-b border-border-subtle px-space-sm py-space-xs", children: header }),
|
|
2011
|
+
/* @__PURE__ */ jsxs29("div", { style: vars, className: cx("relative grid min-h-0 min-w-0 flex-1 grid-cols-1 grid-rows-[minmax(0,1fr)]", columns), children: [
|
|
2012
|
+
left && /* @__PURE__ */ jsxs29(Fragment5, { children: [
|
|
2013
|
+
/* @__PURE__ */ jsx44("section", { id: ids.left, "aria-label": labels.left, className: drawerClass("left"), children: left }),
|
|
2014
|
+
/* @__PURE__ */ jsx44(Separator, { panel: "left", value: sizes.left, limits: limits.left, label: `Resize ${labels.left}`, controls: ids.left, onChange: resize("left"), centerHeight })
|
|
1498
2015
|
] }),
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
bottom && /* @__PURE__ */
|
|
2016
|
+
/* @__PURE__ */ jsxs29("div", { ref: centerRef, className: "flex min-h-0 min-w-0 flex-col", children: [
|
|
2017
|
+
bottom && /* @__PURE__ */ jsx44("div", { className: "flex shrink-0 border-b border-border-subtle p-space-2xs md:hidden", children: /* @__PURE__ */ jsx44(
|
|
1501
2018
|
SegmentedControl,
|
|
1502
2019
|
{
|
|
1503
2020
|
label: "View",
|
|
@@ -1509,10 +2026,10 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
|
|
|
1509
2026
|
onChange: (v) => setMobileView(v === "bottom" ? "bottom" : "main")
|
|
1510
2027
|
}
|
|
1511
2028
|
) }),
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
bottom && /* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */
|
|
1515
|
-
/* @__PURE__ */
|
|
2029
|
+
/* @__PURE__ */ jsx44("section", { id: ids.main, "aria-label": labels.main, className: cx("min-h-0 min-w-0 flex-1 overflow-auto", Boolean(bottom) && mobileView === "bottom" && "max-md:hidden"), children: main }),
|
|
2030
|
+
bottom && /* @__PURE__ */ jsxs29(Fragment5, { children: [
|
|
2031
|
+
/* @__PURE__ */ jsx44(Separator, { panel: "bottom", value: sizes.bottom, limits: limits.bottom, label: `Resize ${labels.bottom}`, controls: ids.bottom, onChange: resize("bottom"), centerHeight }),
|
|
2032
|
+
/* @__PURE__ */ jsx44(
|
|
1516
2033
|
"section",
|
|
1517
2034
|
{
|
|
1518
2035
|
id: ids.bottom,
|
|
@@ -1523,62 +2040,1220 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
|
|
|
1523
2040
|
)
|
|
1524
2041
|
] })
|
|
1525
2042
|
] }),
|
|
1526
|
-
right && /* @__PURE__ */
|
|
1527
|
-
/* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
2043
|
+
right && /* @__PURE__ */ jsxs29(Fragment5, { children: [
|
|
2044
|
+
/* @__PURE__ */ jsx44(Separator, { panel: "right", value: sizes.right, limits: limits.right, label: `Resize ${labels.right}`, controls: ids.right, onChange: resize("right"), centerHeight }),
|
|
2045
|
+
/* @__PURE__ */ jsx44("section", { id: ids.right, "aria-label": labels.right, className: drawerClass("right"), children: right })
|
|
1529
2046
|
] }),
|
|
1530
|
-
drawer && /* @__PURE__ */
|
|
2047
|
+
drawer && /* @__PURE__ */ jsx44("button", { type: "button", "aria-label": "Close panel", tabIndex: -1, onClick: () => setDrawer(null), className: "fixed inset-0 z-30 bg-brand-obsidian/40 lg:hidden" })
|
|
1531
2048
|
] })
|
|
1532
2049
|
] }) });
|
|
1533
2050
|
}
|
|
1534
2051
|
var Workbench = Object.assign(WorkbenchRoot, { Toggle });
|
|
2052
|
+
|
|
2053
|
+
// src/components/Drawer.tsx
|
|
2054
|
+
import { useId as useId9, useRef as useRef9 } from "react";
|
|
2055
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
2056
|
+
import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2057
|
+
var SIDE = { left: "left-0 border-r", right: "right-0 border-l" };
|
|
2058
|
+
var SIZE13 = { sm: "w-[min(85vw,20rem)]", md: "w-[min(90vw,28rem)]" };
|
|
2059
|
+
function Drawer({ open, onClose, title, side = "left", size = "sm", children, ...rest }) {
|
|
2060
|
+
const titleId = useId9();
|
|
2061
|
+
const panelRef = useRef9(null);
|
|
2062
|
+
const bodyRef = useRef9(null);
|
|
2063
|
+
const theme = useThemeTone();
|
|
2064
|
+
useModal({ open, onClose, panelRef, initialFocusRef: bodyRef });
|
|
2065
|
+
if (!open || typeof document === "undefined") return null;
|
|
2066
|
+
return createPortal2(
|
|
2067
|
+
/* @__PURE__ */ jsx45(
|
|
2068
|
+
"div",
|
|
2069
|
+
{
|
|
2070
|
+
"data-theme": theme,
|
|
2071
|
+
className: "fixed inset-0 z-50 bg-brand-obsidian/40 backdrop-blur-sm",
|
|
2072
|
+
onMouseDown: (e) => {
|
|
2073
|
+
if (e.target === e.currentTarget) onClose();
|
|
2074
|
+
},
|
|
2075
|
+
children: /* @__PURE__ */ jsxs30(
|
|
2076
|
+
"div",
|
|
2077
|
+
{
|
|
2078
|
+
...rest,
|
|
2079
|
+
ref: panelRef,
|
|
2080
|
+
role: "dialog",
|
|
2081
|
+
"aria-modal": "true",
|
|
2082
|
+
"aria-labelledby": titleId,
|
|
2083
|
+
tabIndex: -1,
|
|
2084
|
+
className: cx("fixed inset-y-0 flex flex-col border-border-subtle bg-surface-elevated text-on-surface shadow-md outline-none", SIDE[side], SIZE13[size]),
|
|
2085
|
+
children: [
|
|
2086
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex min-w-0 items-center justify-between gap-space-sm border-b border-border-subtle px-space-md py-space-sm", children: [
|
|
2087
|
+
/* @__PURE__ */ jsx45("h2", { id: titleId, className: "min-w-0 truncate font-display text-headline-sm text-ink", children: title }),
|
|
2088
|
+
/* @__PURE__ */ jsx45(IconButton, { icon: "close", label: "Close", onClick: onClose })
|
|
2089
|
+
] }),
|
|
2090
|
+
/* @__PURE__ */ jsx45("div", { ref: bodyRef, className: "min-h-0 flex-1 overflow-y-auto p-space-md", children })
|
|
2091
|
+
]
|
|
2092
|
+
}
|
|
2093
|
+
)
|
|
2094
|
+
}
|
|
2095
|
+
),
|
|
2096
|
+
document.body
|
|
2097
|
+
);
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
// src/components/TextLink.tsx
|
|
2101
|
+
import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2102
|
+
var TONE13 = {
|
|
2103
|
+
brand: "text-fg-brand hover:text-fg-brand-hover",
|
|
2104
|
+
default: "text-on-surface hover:text-ink",
|
|
2105
|
+
muted: "text-on-surface-variant hover:text-on-surface",
|
|
2106
|
+
danger: "text-fg-danger",
|
|
2107
|
+
success: "text-fg-success",
|
|
2108
|
+
warning: "text-fg-warning"
|
|
2109
|
+
};
|
|
2110
|
+
var SIZE14 = { sm: "font-body-sm text-body-sm", md: "font-body-md text-body-md" };
|
|
2111
|
+
var UNDERLINE = { hover: "underline-offset-2 hover:underline", always: "underline underline-offset-2", none: "" };
|
|
2112
|
+
function TextLink({ as, tone = "brand", size = "md", icon, iconRight, underline = "hover", children, ...rest }) {
|
|
2113
|
+
const C = as ?? "a";
|
|
2114
|
+
return /* @__PURE__ */ jsxs31(
|
|
2115
|
+
C,
|
|
2116
|
+
{
|
|
2117
|
+
...rest,
|
|
2118
|
+
className: cx("inline-flex max-w-full items-center gap-space-2xs rounded font-medium wrap-break-word transition-colors", TONE13[tone], SIZE14[size], UNDERLINE[underline], FOCUS_RING),
|
|
2119
|
+
children: [
|
|
2120
|
+
icon && /* @__PURE__ */ jsx46(Icon, { name: icon, size: "sm" }),
|
|
2121
|
+
/* @__PURE__ */ jsx46("span", { className: "min-w-0", children }),
|
|
2122
|
+
iconRight && /* @__PURE__ */ jsx46(Icon, { name: iconRight, size: "sm" })
|
|
2123
|
+
]
|
|
2124
|
+
}
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
// src/components/Divider.tsx
|
|
2129
|
+
import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2130
|
+
var SPACE_Y = {
|
|
2131
|
+
none: "",
|
|
2132
|
+
"2xs": "my-space-2xs",
|
|
2133
|
+
xs: "my-space-xs",
|
|
2134
|
+
sm: "my-space-sm",
|
|
2135
|
+
md: "my-space-md",
|
|
2136
|
+
lg: "my-space-lg",
|
|
2137
|
+
xl: "my-space-xl",
|
|
2138
|
+
"2xl": "my-space-2xl"
|
|
2139
|
+
};
|
|
2140
|
+
var SPACE_X = {
|
|
2141
|
+
none: "",
|
|
2142
|
+
"2xs": "mx-space-2xs",
|
|
2143
|
+
xs: "mx-space-xs",
|
|
2144
|
+
sm: "mx-space-sm",
|
|
2145
|
+
md: "mx-space-md",
|
|
2146
|
+
lg: "mx-space-lg",
|
|
2147
|
+
xl: "mx-space-xl",
|
|
2148
|
+
"2xl": "mx-space-2xl"
|
|
2149
|
+
};
|
|
2150
|
+
function Divider({ orientation = "horizontal", label, spacing = "none", ...rest }) {
|
|
2151
|
+
if (orientation === "vertical") {
|
|
2152
|
+
return /* @__PURE__ */ jsx47("div", { ...rest, role: "separator", "aria-orientation": "vertical", className: cx("min-h-4 w-px shrink-0 self-stretch bg-border-subtle", SPACE_X[spacing]) });
|
|
2153
|
+
}
|
|
2154
|
+
if (label) {
|
|
2155
|
+
return /* @__PURE__ */ jsxs32("div", { ...rest, role: "separator", "aria-orientation": "horizontal", className: cx("flex w-full min-w-0 items-center gap-space-sm", SPACE_Y[spacing]), children: [
|
|
2156
|
+
/* @__PURE__ */ jsx47("span", { className: "h-px flex-1 bg-border-subtle" }),
|
|
2157
|
+
/* @__PURE__ */ jsx47("span", { className: "shrink-0 font-label-mono text-label-mono uppercase text-on-surface-variant", children: label }),
|
|
2158
|
+
/* @__PURE__ */ jsx47("span", { className: "h-px flex-1 bg-border-subtle" })
|
|
2159
|
+
] });
|
|
2160
|
+
}
|
|
2161
|
+
return /* @__PURE__ */ jsx47("div", { ...rest, role: "separator", "aria-orientation": "horizontal", className: cx("h-px w-full shrink-0 bg-border-subtle", SPACE_Y[spacing]) });
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
// src/ide/AvatarGroup.tsx
|
|
2165
|
+
import { Children as Children2, cloneElement, isValidElement as isValidElement2 } from "react";
|
|
2166
|
+
import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2167
|
+
function AvatarGroup({ children, max, size = "md", label, ...rest }) {
|
|
2168
|
+
const all = Children2.toArray(children);
|
|
2169
|
+
const shown = max !== void 0 ? all.slice(0, Math.max(0, max)) : all;
|
|
2170
|
+
const extra = all.length - shown.length;
|
|
2171
|
+
return /* @__PURE__ */ jsxs33("div", { ...rest, role: "group", "aria-label": label, className: "flex items-center -space-x-2", children: [
|
|
2172
|
+
shown.map((child, i) => /* @__PURE__ */ jsx48("span", { className: "inline-flex rounded-full ring-2 ring-surface-elevated", children: isValidElement2(child) ? cloneElement(child, { size }) : child }, i)),
|
|
2173
|
+
extra > 0 && /* @__PURE__ */ jsxs33("span", { className: cx("inline-flex items-center justify-center rounded-full bg-surface-muted font-label-mono text-on-surface-variant ring-2 ring-surface-elevated", AVATAR_SIZE[size]), children: [
|
|
2174
|
+
"+",
|
|
2175
|
+
extra
|
|
2176
|
+
] })
|
|
2177
|
+
] });
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
// src/primitives/AppBar.tsx
|
|
2181
|
+
import { jsx as jsx49, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2182
|
+
var POSITION = { sticky: "sticky top-0", fixed: "fixed inset-x-0 top-0", static: "relative" };
|
|
2183
|
+
var HEIGHT2 = { sm: "h-12", md: "h-16" };
|
|
2184
|
+
var DIVIDER = { shadow: "shadow-appbar", border: "border-b border-border-subtle" };
|
|
2185
|
+
function AppBar({ position = "sticky", start, center, end, blur = true, height = "md", contained = true, divider = "shadow", ...rest }) {
|
|
2186
|
+
return /* @__PURE__ */ jsx49("header", { ...rest, className: cx("z-40 w-full min-w-0", DIVIDER[divider], POSITION[position], blur ? "bg-surface-elevated/95 backdrop-blur-md" : "bg-surface-elevated"), children: /* @__PURE__ */ jsxs34("div", { className: cx("flex min-w-0 items-center gap-space-md px-gutter-fluid", HEIGHT2[height], contained && "mx-auto max-w-7xl"), children: [
|
|
2187
|
+
/* @__PURE__ */ jsx49("div", { className: "flex min-w-0 shrink-0 items-center gap-space-sm", children: start }),
|
|
2188
|
+
/* @__PURE__ */ jsx49("div", { className: "flex min-w-0 flex-1 items-center justify-center", children: center }),
|
|
2189
|
+
/* @__PURE__ */ jsx49("div", { className: "flex shrink-0 items-center gap-space-xs", children: end })
|
|
2190
|
+
] }) });
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
// src/components/NavList.tsx
|
|
2194
|
+
import { jsx as jsx50, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
2195
|
+
var VARIANT11 = {
|
|
2196
|
+
sidebar: {
|
|
2197
|
+
item: "rounded-lg px-space-sm py-space-xs font-body-md text-body-md",
|
|
2198
|
+
active: "bg-surface-container-high font-medium text-ink",
|
|
2199
|
+
idle: "text-on-surface-variant hover:bg-surface-muted hover:text-on-surface"
|
|
2200
|
+
},
|
|
2201
|
+
toc: {
|
|
2202
|
+
item: "border-l-2 px-space-sm py-space-2xs font-body-sm text-body-sm",
|
|
2203
|
+
active: "border-brand-cobalt bg-badge-intermediate-bg font-medium text-badge-intermediate-text",
|
|
2204
|
+
idle: "border-transparent text-on-surface-variant hover:border-border-strong hover:text-on-surface"
|
|
2205
|
+
}
|
|
2206
|
+
};
|
|
2207
|
+
function NavList({ label, items, current, heading, variant = "sidebar", ...rest }) {
|
|
2208
|
+
const v = VARIANT11[variant];
|
|
2209
|
+
return /* @__PURE__ */ jsxs35("nav", { ...rest, "aria-label": label, className: "min-w-0", children: [
|
|
2210
|
+
heading && /* @__PURE__ */ jsx50("p", { className: "px-space-sm pb-space-xs font-label-mono text-label-mono uppercase text-on-surface-variant", children: heading }),
|
|
2211
|
+
/* @__PURE__ */ jsx50("ul", { className: "flex min-w-0 flex-col gap-space-2xs", children: items.map((item) => {
|
|
2212
|
+
const active = item.id === current;
|
|
2213
|
+
const C = item.href ? item.as ?? "a" : "button";
|
|
2214
|
+
return /* @__PURE__ */ jsx50("li", { className: "min-w-0", children: /* @__PURE__ */ jsxs35(
|
|
2215
|
+
C,
|
|
2216
|
+
{
|
|
2217
|
+
...item.href ? { href: item.href } : { type: "button" },
|
|
2218
|
+
"aria-current": active ? item.href ? "page" : "true" : void 0,
|
|
2219
|
+
onClick: item.onSelect,
|
|
2220
|
+
className: cx("flex w-full min-w-0 items-center gap-space-sm text-left transition-colors", v.item, active ? v.active : v.idle, FOCUS_RING, TOUCH),
|
|
2221
|
+
children: [
|
|
2222
|
+
item.icon && /* @__PURE__ */ jsx50(Icon, { name: item.icon, size: "sm" }),
|
|
2223
|
+
/* @__PURE__ */ jsx50("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
2224
|
+
item.count !== void 0 && /* @__PURE__ */ jsx50("span", { className: cx("shrink-0 font-label-mono text-label-mono", active ? "text-ink" : "text-on-surface-variant"), children: item.count })
|
|
2225
|
+
]
|
|
2226
|
+
}
|
|
2227
|
+
) }, item.id);
|
|
2228
|
+
}) })
|
|
2229
|
+
] });
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
// src/components/Pagination.tsx
|
|
2233
|
+
import { jsx as jsx51, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
2234
|
+
var range = (a, b) => Array.from({ length: Math.max(0, b - a + 1) }, (_, i) => a + i);
|
|
2235
|
+
function pageRange(page, pageCount, siblingCount = 1) {
|
|
2236
|
+
if (pageCount <= 0) return [];
|
|
2237
|
+
const p = Math.min(Math.max(1, Math.trunc(page)), pageCount);
|
|
2238
|
+
if (pageCount <= 2 * siblingCount + 5) return range(1, pageCount);
|
|
2239
|
+
const left = Math.max(p - siblingCount, 2);
|
|
2240
|
+
const right = Math.min(p + siblingCount, pageCount - 1);
|
|
2241
|
+
const out = [1];
|
|
2242
|
+
if (left > 2) out.push("gap");
|
|
2243
|
+
out.push(...range(left, right));
|
|
2244
|
+
if (right < pageCount - 1) out.push("gap");
|
|
2245
|
+
out.push(pageCount);
|
|
2246
|
+
return out;
|
|
2247
|
+
}
|
|
2248
|
+
function Pagination({ page, pageCount, onChange, siblingCount = 1, summary, label = "Pagination", ...rest }) {
|
|
2249
|
+
if (pageCount <= 1) return null;
|
|
2250
|
+
const p = Math.min(Math.max(1, Math.trunc(page)), pageCount);
|
|
2251
|
+
return /* @__PURE__ */ jsxs36("nav", { ...rest, "aria-label": label, className: "flex min-w-0 flex-wrap items-center justify-between gap-space-sm", children: [
|
|
2252
|
+
summary && /* @__PURE__ */ jsx51("p", { className: "font-body-sm text-body-sm text-on-surface-variant", children: summary }),
|
|
2253
|
+
/* @__PURE__ */ jsxs36("ul", { className: "flex items-center gap-space-2xs", children: [
|
|
2254
|
+
/* @__PURE__ */ jsx51("li", { children: /* @__PURE__ */ jsx51(IconButton, { icon: "chevron_left", label: "Previous page", variant: "secondary", size: "sm", disabled: p <= 1, onClick: () => onChange(p - 1) }) }),
|
|
2255
|
+
pageRange(p, pageCount, siblingCount).map(
|
|
2256
|
+
(item, i) => item === "gap" ? /* @__PURE__ */ jsx51("li", { "aria-hidden": "true", className: "px-space-2xs text-on-surface-variant max-md:hidden", children: "\u2026" }, `gap-${i}`) : /* @__PURE__ */ jsx51("li", { className: item === p ? "" : "max-md:hidden", children: /* @__PURE__ */ jsx51(
|
|
2257
|
+
"button",
|
|
2258
|
+
{
|
|
2259
|
+
type: "button",
|
|
2260
|
+
"aria-label": `Page ${item}`,
|
|
2261
|
+
"aria-current": item === p ? "page" : void 0,
|
|
2262
|
+
onClick: () => onChange(item),
|
|
2263
|
+
className: cx(
|
|
2264
|
+
"inline-flex size-8 items-center justify-center rounded-lg font-label-mono text-label-mono transition-colors",
|
|
2265
|
+
item === p ? "bg-ink text-on-ink" : "text-on-surface hover:bg-surface-muted",
|
|
2266
|
+
FOCUS_RING,
|
|
2267
|
+
TOUCH_ICON
|
|
2268
|
+
),
|
|
2269
|
+
children: item
|
|
2270
|
+
}
|
|
2271
|
+
) }, item)
|
|
2272
|
+
),
|
|
2273
|
+
/* @__PURE__ */ jsxs36("li", { "aria-hidden": "true", className: "font-label-mono text-label-mono text-on-surface-variant md:hidden", children: [
|
|
2274
|
+
"/ ",
|
|
2275
|
+
pageCount
|
|
2276
|
+
] }),
|
|
2277
|
+
/* @__PURE__ */ jsx51("li", { children: /* @__PURE__ */ jsx51(IconButton, { icon: "chevron_right", label: "Next page", variant: "secondary", size: "sm", disabled: p >= pageCount, onClick: () => onChange(p + 1) }) })
|
|
2278
|
+
] })
|
|
2279
|
+
] });
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
// src/components/Table.tsx
|
|
2283
|
+
import { jsx as jsx52, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
2284
|
+
var PAD = { compact: "px-space-sm py-space-xs", normal: "px-space-md py-space-sm" };
|
|
2285
|
+
var ALIGN4 = { start: "text-start", end: "text-end" };
|
|
2286
|
+
var WIDTH2 = { auto: "", min: "w-px whitespace-nowrap" };
|
|
2287
|
+
function Table({ caption, showCaption, columns, rows, rowKey, density = "normal", empty, ...rest }) {
|
|
2288
|
+
return /* @__PURE__ */ jsx52(
|
|
2289
|
+
"div",
|
|
2290
|
+
{
|
|
2291
|
+
...rest,
|
|
2292
|
+
role: "region",
|
|
2293
|
+
"aria-label": caption,
|
|
2294
|
+
tabIndex: 0,
|
|
2295
|
+
className: "min-w-0 max-w-full overflow-x-auto rounded-xl border border-border-subtle focus-visible:outline-2 focus-visible:outline-brand-cobalt",
|
|
2296
|
+
children: /* @__PURE__ */ jsxs37("table", { className: "w-full border-collapse font-body-sm text-body-sm text-on-surface", children: [
|
|
2297
|
+
/* @__PURE__ */ jsx52("caption", { className: showCaption ? "caption-top px-space-md py-space-sm text-start font-label-mono text-label-mono uppercase text-on-surface-variant" : "sr-only", children: caption }),
|
|
2298
|
+
/* @__PURE__ */ jsx52("thead", { className: "bg-surface-subtle", children: /* @__PURE__ */ jsx52("tr", { children: columns.map((c) => /* @__PURE__ */ jsx52("th", { scope: "col", className: cx("border-b border-border-subtle font-label-mono text-label-mono uppercase text-on-surface-variant", PAD[density], ALIGN4[c.align ?? "start"], WIDTH2[c.width ?? "auto"]), children: c.header }, c.key)) }) }),
|
|
2299
|
+
/* @__PURE__ */ jsx52("tbody", { className: "divide-y divide-border-subtle", children: rows.length ? rows.map((row, i) => /* @__PURE__ */ jsx52("tr", { children: columns.map((c) => /* @__PURE__ */ jsx52("td", { className: cx("align-top wrap-break-word", PAD[density], ALIGN4[c.align ?? "start"], WIDTH2[c.width ?? "auto"], c.mono && "font-code-inline text-code-inline"), children: row[c.key] }, c.key)) }, rowKey ? rowKey(row, i) : i)) : /* @__PURE__ */ jsx52("tr", { children: /* @__PURE__ */ jsx52("td", { colSpan: columns.length, className: "px-space-md py-space-lg text-center text-on-surface-variant", children: empty ?? "No rows" }) }) })
|
|
2300
|
+
] })
|
|
2301
|
+
}
|
|
2302
|
+
);
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
// src/components/DescriptionList.tsx
|
|
2306
|
+
import { jsx as jsx53, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
2307
|
+
var LAYOUT = {
|
|
2308
|
+
stacked: "flex flex-col gap-space-sm",
|
|
2309
|
+
inline: "grid grid-cols-1 gap-x-space-md gap-y-space-xs sm:grid-cols-[minmax(0,auto)_minmax(0,1fr)]"
|
|
2310
|
+
};
|
|
2311
|
+
function DescriptionList({ items, layout = "stacked", mono, ...rest }) {
|
|
2312
|
+
return /* @__PURE__ */ jsx53("dl", { ...rest, className: cx("min-w-0", LAYOUT[layout]), children: items.map((item, i) => /* @__PURE__ */ jsxs38("div", { className: cx("min-w-0", layout === "inline" && "sm:contents"), children: [
|
|
2313
|
+
/* @__PURE__ */ jsx53("dt", { className: "font-label-mono text-label-mono uppercase text-on-surface-variant", children: item.term }),
|
|
2314
|
+
/* @__PURE__ */ jsx53("dd", { className: cx("min-w-0 text-on-surface wrap-break-word", mono ? "font-code-inline text-code-inline" : "font-body-md text-body-md"), children: item.detail })
|
|
2315
|
+
] }, i)) });
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
// src/components/Timeline.tsx
|
|
2319
|
+
import { jsx as jsx54, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
2320
|
+
var STATUS2 = {
|
|
2321
|
+
done: { icon: "check", marker: "bg-badge-beginner-text text-badge-beginner-bg", text: "Completed" },
|
|
2322
|
+
current: { icon: "radio_button_checked", marker: "bg-badge-intermediate-text text-badge-intermediate-bg ring-4 ring-badge-intermediate-bg", text: "Current" },
|
|
2323
|
+
locked: { icon: "lock", marker: "bg-surface-muted text-on-surface-variant", text: "Locked" },
|
|
2324
|
+
success: { icon: "check_circle", marker: "bg-badge-beginner-text text-badge-beginner-bg", text: "Passed" },
|
|
2325
|
+
warning: { icon: "warning", marker: "bg-badge-amber-text text-badge-amber-bg", text: "Warning" },
|
|
2326
|
+
danger: { icon: "close", marker: "bg-badge-advanced-text text-badge-advanced-bg", text: "Failed" },
|
|
2327
|
+
pending: { icon: "schedule", marker: "bg-surface-muted text-on-surface-variant", text: "Pending" }
|
|
2328
|
+
};
|
|
2329
|
+
function Timeline({ label, items, ...rest }) {
|
|
2330
|
+
return /* @__PURE__ */ jsx54("ol", { ...rest, "aria-label": label, className: "flex min-w-0 flex-col", children: items.map((item, i) => {
|
|
2331
|
+
const s = STATUS2[item.status];
|
|
2332
|
+
return /* @__PURE__ */ jsxs39("li", { "aria-current": item.status === "current" ? "step" : void 0, className: "relative flex min-w-0 gap-space-sm pb-space-md last:pb-0", children: [
|
|
2333
|
+
i < items.length - 1 && /* @__PURE__ */ jsx54("span", { "aria-hidden": "true", className: "absolute bottom-0 left-3 top-7 w-px -translate-x-1/2 bg-border-subtle" }),
|
|
2334
|
+
/* @__PURE__ */ jsx54("span", { "aria-hidden": "true", className: cx("relative inline-flex size-6 shrink-0 items-center justify-center rounded-full", s.marker), children: /* @__PURE__ */ jsx54(Icon, { name: s.icon, size: "sm" }) }),
|
|
2335
|
+
/* @__PURE__ */ jsxs39("div", { className: "min-w-0 flex-1 pt-0.5", children: [
|
|
2336
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 flex-wrap items-center gap-space-xs", children: [
|
|
2337
|
+
/* @__PURE__ */ jsxs39("p", { className: "font-body-md text-body-md font-medium text-on-surface wrap-break-word", children: [
|
|
2338
|
+
/* @__PURE__ */ jsxs39("span", { className: "sr-only", children: [
|
|
2339
|
+
s.text,
|
|
2340
|
+
": "
|
|
2341
|
+
] }),
|
|
2342
|
+
item.title
|
|
2343
|
+
] }),
|
|
2344
|
+
item.badge
|
|
2345
|
+
] }),
|
|
2346
|
+
item.description && /* @__PURE__ */ jsx54("p", { className: "font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: item.description }),
|
|
2347
|
+
item.meta && /* @__PURE__ */ jsx54("p", { className: "font-label-mono text-label-mono text-on-surface-variant", children: item.meta })
|
|
2348
|
+
] })
|
|
2349
|
+
] }, item.id);
|
|
2350
|
+
}) });
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
// src/components/Disclosure.tsx
|
|
2354
|
+
import { useId as useId10, useState as useState7 } from "react";
|
|
2355
|
+
import { jsx as jsx55, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
2356
|
+
function Disclosure({ summary, children, open, defaultOpen = false, onOpenChange, selected, variant = "plain", ...rest }) {
|
|
2357
|
+
const id = useId10();
|
|
2358
|
+
const [inner, setInner] = useState7(defaultOpen);
|
|
2359
|
+
const isOpen = open ?? inner;
|
|
2360
|
+
const toggle = () => {
|
|
2361
|
+
const next = !isOpen;
|
|
2362
|
+
if (open === void 0) setInner(next);
|
|
2363
|
+
onOpenChange?.(next);
|
|
2364
|
+
};
|
|
2365
|
+
const row = variant === "row";
|
|
2366
|
+
return /* @__PURE__ */ jsxs40("div", { ...rest, className: cx("min-w-0", row && "border-b border-border-subtle", selected && "border-l-4 border-l-brand-cobalt"), children: [
|
|
2367
|
+
/* @__PURE__ */ jsxs40(
|
|
2368
|
+
"button",
|
|
2369
|
+
{
|
|
2370
|
+
type: "button",
|
|
2371
|
+
id: `${id}-button`,
|
|
2372
|
+
"aria-expanded": isOpen,
|
|
2373
|
+
"aria-controls": `${id}-panel`,
|
|
2374
|
+
onClick: toggle,
|
|
2375
|
+
className: cx("flex w-full min-w-0 items-center gap-space-sm text-left", row ? "px-space-sm py-space-sm hover:bg-surface-subtle" : "py-space-xs", FOCUS_RING, TOUCH),
|
|
2376
|
+
children: [
|
|
2377
|
+
/* @__PURE__ */ jsx55("span", { className: "min-w-0 flex-1", children: summary }),
|
|
2378
|
+
/* @__PURE__ */ jsx55(Icon, { name: isOpen ? "expand_less" : "expand_more", size: "sm", tone: "muted" })
|
|
2379
|
+
]
|
|
2380
|
+
}
|
|
2381
|
+
),
|
|
2382
|
+
/* @__PURE__ */ jsx55("div", { id: `${id}-panel`, role: "region", "aria-labelledby": `${id}-button`, hidden: !isOpen, className: cx("min-w-0", row ? "px-space-sm pb-space-sm" : "pb-space-xs"), children })
|
|
2383
|
+
] });
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
// src/components/Skeleton.tsx
|
|
2387
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
2388
|
+
var SHAPE4 = { line: "rounded", pill: "rounded-full", rect: "rounded-xl", circle: "rounded-full aspect-square" };
|
|
2389
|
+
var WIDTH3 = { full: "w-full", "3/4": "w-3/4", "1/2": "w-1/2", "1/3": "w-1/3", "1/4": "w-1/4" };
|
|
2390
|
+
var HEIGHT3 = { xs: "h-2", sm: "h-3", md: "h-4", lg: "h-8", xl: "h-24" };
|
|
2391
|
+
var DEFAULT_HEIGHT = { line: "sm", pill: "lg", rect: "xl", circle: "lg" };
|
|
2392
|
+
function Skeleton({ shape = "line", width = "full", height, lines, ...rest }) {
|
|
2393
|
+
const h = HEIGHT3[height ?? DEFAULT_HEIGHT[shape]];
|
|
2394
|
+
if (lines && lines > 1) {
|
|
2395
|
+
return /* @__PURE__ */ jsx56("div", { ...rest, "aria-hidden": "true", className: "flex w-full min-w-0 flex-col gap-space-xs", children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx56("div", { className: cx("skeleton-shimmer rounded", h, i === lines - 1 ? "w-3/4" : "w-full") }, i)) });
|
|
2396
|
+
}
|
|
2397
|
+
return /* @__PURE__ */ jsx56("div", { ...rest, "aria-hidden": "true", className: cx("skeleton-shimmer shrink-0", SHAPE4[shape], h, shape !== "circle" && WIDTH3[width]) });
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
// src/components/TerminalOutput.tsx
|
|
2401
|
+
import { jsx as jsx57, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
2402
|
+
var KIND = {
|
|
2403
|
+
command: "text-slate-100",
|
|
2404
|
+
plain: "text-slate-300",
|
|
2405
|
+
error: "border-l-2 border-red-400 bg-red-500/10 pl-space-sm text-red-300",
|
|
2406
|
+
warning: "text-amber-300",
|
|
2407
|
+
hint: "text-sky-300",
|
|
2408
|
+
success: "text-emerald-300"
|
|
2409
|
+
};
|
|
2410
|
+
var MAX = { sm: "max-h-40", md: "max-h-72", lg: "max-h-[32rem]", none: "" };
|
|
2411
|
+
function TerminalOutput({ lines, title, status, maxHeight = "md", ...rest }) {
|
|
2412
|
+
return /* @__PURE__ */ jsxs41("figure", { ...rest, className: "min-w-0 max-w-full overflow-hidden rounded-xl bg-brand-obsidian", children: [
|
|
2413
|
+
(title || status) && /* @__PURE__ */ jsxs41("figcaption", { className: "flex min-w-0 items-center justify-between gap-space-sm border-b border-white/10 px-space-md py-space-xs font-label-mono text-label-mono uppercase text-slate-300", children: [
|
|
2414
|
+
/* @__PURE__ */ jsx57("span", { className: "truncate", children: title }),
|
|
2415
|
+
status
|
|
2416
|
+
] }),
|
|
2417
|
+
/* @__PURE__ */ jsx57(
|
|
2418
|
+
"div",
|
|
2419
|
+
{
|
|
2420
|
+
role: "log",
|
|
2421
|
+
"aria-label": typeof title === "string" ? title : "Output",
|
|
2422
|
+
tabIndex: 0,
|
|
2423
|
+
className: cx("overflow-auto p-space-md font-code-inline text-code-inline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt", MAX[maxHeight]),
|
|
2424
|
+
children: lines.map((line, i) => /* @__PURE__ */ jsxs41("div", { className: cx("whitespace-pre-wrap wrap-break-word", KIND[line.kind]), children: [
|
|
2425
|
+
line.kind === "command" && /* @__PURE__ */ jsxs41("span", { "aria-hidden": "true", className: "select-none text-slate-400", children: [
|
|
2426
|
+
"$",
|
|
2427
|
+
" "
|
|
2428
|
+
] }),
|
|
2429
|
+
/* @__PURE__ */ jsx57("span", { children: line.text })
|
|
2430
|
+
] }, i))
|
|
2431
|
+
}
|
|
2432
|
+
)
|
|
2433
|
+
] });
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
// src/components/VerdictBanner.tsx
|
|
2437
|
+
import { jsx as jsx58, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
2438
|
+
var TITLE = { success: "text-fg-success", danger: "text-fg-danger", warning: "text-fg-warning" };
|
|
2439
|
+
function VerdictBanner({ tone, icon, title, badge, meta, actions, ...rest }) {
|
|
2440
|
+
return /* @__PURE__ */ jsxs42("section", { ...rest, className: "flex min-w-0 flex-col gap-space-md rounded-xl border border-border-subtle bg-surface-elevated p-space-lg md:flex-row md:items-center", children: [
|
|
2441
|
+
/* @__PURE__ */ jsx58(IconTile, { icon, tone, size: "xl", shape: "circle", filled: true }),
|
|
2442
|
+
/* @__PURE__ */ jsxs42("div", { className: "min-w-0 flex-1", children: [
|
|
2443
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 flex-wrap items-center gap-space-sm", children: [
|
|
2444
|
+
/* @__PURE__ */ jsx58("h2", { className: cx("min-w-0 font-display text-headline-xl wrap-break-word", TITLE[tone]), children: title }),
|
|
2445
|
+
badge
|
|
2446
|
+
] }),
|
|
2447
|
+
meta && meta.length > 0 && /* @__PURE__ */ jsx58("ul", { className: "mt-space-xs flex min-w-0 flex-wrap items-center gap-x-space-sm gap-y-space-2xs font-body-sm text-body-sm text-on-surface-variant", children: meta.map((m, i) => /* @__PURE__ */ jsxs42("li", { className: "flex items-center gap-space-sm", children: [
|
|
2448
|
+
i > 0 && /* @__PURE__ */ jsx58("span", { "aria-hidden": "true", className: "h-3 w-px bg-border-strong" }),
|
|
2449
|
+
m
|
|
2450
|
+
] }, i)) })
|
|
2451
|
+
] }),
|
|
2452
|
+
actions && /* @__PURE__ */ jsx58("div", { className: "flex shrink-0 flex-wrap items-center gap-space-sm", children: actions })
|
|
2453
|
+
] });
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
// src/components/Checkbox.tsx
|
|
2457
|
+
import { useEffect as useEffect5, useId as useId11, useRef as useRef10 } from "react";
|
|
2458
|
+
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
2459
|
+
function Checkbox({ label, description, strikeWhenChecked, indeterminate, size = "md", id, ...rest }) {
|
|
2460
|
+
const generated = useId11();
|
|
2461
|
+
const inputId = id ?? generated;
|
|
2462
|
+
const descId = `${inputId}-desc`;
|
|
2463
|
+
const ref = useRef10(null);
|
|
2464
|
+
useEffect5(() => {
|
|
2465
|
+
if (ref.current) ref.current.indeterminate = Boolean(indeterminate);
|
|
2466
|
+
}, [indeterminate]);
|
|
2467
|
+
return /* @__PURE__ */ jsxs43("div", { className: "min-w-0", children: [
|
|
2468
|
+
/* @__PURE__ */ jsxs43("label", { htmlFor: inputId, className: cx("group flex min-w-0 cursor-pointer items-start gap-space-sm", TOUCH), children: [
|
|
2469
|
+
/* @__PURE__ */ jsxs43("span", { className: "relative mt-0.5 inline-flex size-4 shrink-0", children: [
|
|
2470
|
+
/* @__PURE__ */ jsx59(
|
|
2471
|
+
"input",
|
|
2472
|
+
{
|
|
2473
|
+
...rest,
|
|
2474
|
+
ref,
|
|
2475
|
+
id: inputId,
|
|
2476
|
+
type: "checkbox",
|
|
2477
|
+
"aria-describedby": cx(rest["aria-describedby"], description ? descId : void 0) || void 0,
|
|
2478
|
+
className: cx(
|
|
2479
|
+
"peer size-4 cursor-pointer appearance-none rounded border border-border-strong bg-surface-elevated checked:border-brand-cobalt checked:bg-brand-cobalt indeterminate:border-brand-cobalt indeterminate:bg-brand-cobalt disabled:cursor-not-allowed disabled:opacity-50",
|
|
2480
|
+
FOCUS_RING
|
|
2481
|
+
)
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
/* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 hidden items-center justify-center text-white peer-checked:flex", children: /* @__PURE__ */ jsx59(Icon, { name: "check", size: "sm" }) }),
|
|
2485
|
+
/* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 hidden items-center justify-center text-white peer-indeterminate:flex", children: /* @__PURE__ */ jsx59(Icon, { name: "remove", size: "sm" }) })
|
|
2486
|
+
] }),
|
|
2487
|
+
/* @__PURE__ */ jsx59("span", { className: cx("min-w-0 text-on-surface wrap-break-word", size === "sm" ? "font-body-sm text-body-sm" : "font-body-md text-body-md", strikeWhenChecked && "group-has-checked:text-on-surface-variant group-has-checked:line-through"), children: label })
|
|
2488
|
+
] }),
|
|
2489
|
+
description && /* @__PURE__ */ jsx59("p", { id: descId, className: "pl-6 font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description })
|
|
2490
|
+
] });
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
// src/components/Switch.tsx
|
|
2494
|
+
import { useId as useId12 } from "react";
|
|
2495
|
+
import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
2496
|
+
function Switch({ label, checked, onChange, description, ...rest }) {
|
|
2497
|
+
const id = useId12();
|
|
2498
|
+
const buttonId = rest.id ?? `${id}-switch`;
|
|
2499
|
+
return (
|
|
2500
|
+
// The row is a <label> for the button, so tapping the text toggles it and the target is the full row.
|
|
2501
|
+
/* @__PURE__ */ jsxs44("label", { htmlFor: buttonId, className: cx("flex min-w-0 cursor-pointer items-start justify-between gap-space-md", TOUCH), children: [
|
|
2502
|
+
/* @__PURE__ */ jsxs44("span", { className: "min-w-0", children: [
|
|
2503
|
+
/* @__PURE__ */ jsx60("span", { id: `${id}-label`, className: "font-body-md text-body-md text-on-surface", children: label }),
|
|
2504
|
+
description && /* @__PURE__ */ jsx60("span", { id: `${id}-desc`, className: "block font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description })
|
|
2505
|
+
] }),
|
|
2506
|
+
/* @__PURE__ */ jsx60(
|
|
2507
|
+
"button",
|
|
2508
|
+
{
|
|
2509
|
+
...rest,
|
|
2510
|
+
id: buttonId,
|
|
2511
|
+
type: "button",
|
|
2512
|
+
role: "switch",
|
|
2513
|
+
"aria-checked": checked,
|
|
2514
|
+
"aria-labelledby": `${id}-label`,
|
|
2515
|
+
"aria-describedby": description ? `${id}-desc` : void 0,
|
|
2516
|
+
onClick: () => onChange(!checked),
|
|
2517
|
+
className: cx("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors disabled:pointer-events-none disabled:opacity-50", checked ? "bg-brand-cobalt" : "bg-border-strong", FOCUS_RING),
|
|
2518
|
+
children: /* @__PURE__ */ jsx60("span", { "aria-hidden": "true", className: cx("inline-block size-5 rounded-full bg-white shadow-sm transition-transform", checked ? "translate-x-5.5" : "translate-x-0.5") })
|
|
2519
|
+
}
|
|
2520
|
+
)
|
|
2521
|
+
] })
|
|
2522
|
+
);
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
// src/components/Overlay.tsx
|
|
2526
|
+
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
2527
|
+
function Overlay({ children, overlay, blur = true, ...rest }) {
|
|
2528
|
+
return /* @__PURE__ */ jsxs45("div", { ...rest, className: "relative min-w-0 overflow-hidden rounded-xl", children: [
|
|
2529
|
+
/* @__PURE__ */ jsx61("div", { inert: true, "aria-hidden": "true", className: cx("pointer-events-none select-none", blur && "blur-sm"), children }),
|
|
2530
|
+
/* @__PURE__ */ jsx61("div", { className: "absolute inset-0 flex items-center justify-center bg-surface/70 p-space-md", children: overlay })
|
|
2531
|
+
] });
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
// src/components/CopyButton.tsx
|
|
2535
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
2536
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
2537
|
+
function CopyButton({ value, label = "Copy", copiedLabel = "Copied", size = "sm", variant = "secondary", ...rest }) {
|
|
2538
|
+
const [state, setState] = useState8("idle");
|
|
2539
|
+
useEffect6(() => {
|
|
2540
|
+
if (state === "idle") return;
|
|
2541
|
+
const t = setTimeout(() => setState("idle"), 2e3);
|
|
2542
|
+
return () => clearTimeout(t);
|
|
2543
|
+
}, [state]);
|
|
2544
|
+
const copy = async () => {
|
|
2545
|
+
try {
|
|
2546
|
+
await navigator.clipboard.writeText(value);
|
|
2547
|
+
setState("copied");
|
|
2548
|
+
} catch {
|
|
2549
|
+
setState("failed");
|
|
2550
|
+
}
|
|
2551
|
+
};
|
|
2552
|
+
return /* @__PURE__ */ jsx62(Button, { ...rest, variant, size, icon: state === "copied" ? "check" : state === "failed" ? "error" : "content_copy", onClick: copy, "aria-live": "polite", children: state === "copied" ? copiedLabel : state === "failed" ? "Copy failed" : label });
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
// src/internal/diff.ts
|
|
2556
|
+
var toLines = (s) => {
|
|
2557
|
+
const t = s.endsWith("\n") ? s.slice(0, -1) : s;
|
|
2558
|
+
return t === "" && s.length <= 1 ? [] : t.split("\n");
|
|
2559
|
+
};
|
|
2560
|
+
function diffLines(a, b) {
|
|
2561
|
+
const x = toLines(a);
|
|
2562
|
+
const y = toLines(b);
|
|
2563
|
+
const n = x.length;
|
|
2564
|
+
const m = y.length;
|
|
2565
|
+
const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
|
|
2566
|
+
for (let i2 = n - 1; i2 >= 0; i2--) {
|
|
2567
|
+
for (let j2 = m - 1; j2 >= 0; j2--) dp[i2][j2] = x[i2] === y[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
|
|
2568
|
+
}
|
|
2569
|
+
const out = [];
|
|
2570
|
+
let i = 0;
|
|
2571
|
+
let j = 0;
|
|
2572
|
+
while (i < n && j < m) {
|
|
2573
|
+
if (x[i] === y[j]) out.push({ kind: "same", text: x[i], oldNo: ++i, newNo: ++j });
|
|
2574
|
+
else if (dp[i + 1][j] >= dp[i][j + 1]) out.push({ kind: "del", text: x[i], oldNo: ++i });
|
|
2575
|
+
else out.push({ kind: "add", text: y[j], newNo: ++j });
|
|
2576
|
+
}
|
|
2577
|
+
while (i < n) out.push({ kind: "del", text: x[i], oldNo: ++i });
|
|
2578
|
+
while (j < m) out.push({ kind: "add", text: y[j], newNo: ++j });
|
|
2579
|
+
return out;
|
|
2580
|
+
}
|
|
2581
|
+
function splitRows(lines) {
|
|
2582
|
+
const rows = [];
|
|
2583
|
+
let k = 0;
|
|
2584
|
+
while (k < lines.length) {
|
|
2585
|
+
if (lines[k].kind === "same") {
|
|
2586
|
+
rows.push({ left: lines[k], right: lines[k] });
|
|
2587
|
+
k++;
|
|
2588
|
+
continue;
|
|
2589
|
+
}
|
|
2590
|
+
const dels = [];
|
|
2591
|
+
const adds = [];
|
|
2592
|
+
while (k < lines.length && lines[k].kind === "del") dels.push(lines[k++]);
|
|
2593
|
+
while (k < lines.length && lines[k].kind === "add") adds.push(lines[k++]);
|
|
2594
|
+
for (let t = 0; t < Math.max(dels.length, adds.length); t++) rows.push({ left: dels[t], right: adds[t] });
|
|
2595
|
+
}
|
|
2596
|
+
return rows;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
// src/components/DiffViewer.tsx
|
|
2600
|
+
import { jsx as jsx63, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
2601
|
+
var KIND2 = { same: "text-code-plain", add: "bg-diff-add-bg text-diff-add-fg", del: "bg-diff-del-bg text-diff-del-fg" };
|
|
2602
|
+
var SIGN = { same: " ", add: "+", del: "\u2212" };
|
|
2603
|
+
var SPOKEN = { same: "", add: "added:", del: "removed:" };
|
|
2604
|
+
var PRE = "overflow-x-auto py-space-sm font-code-inline text-code-inline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt";
|
|
2605
|
+
function Row({ line, gutters }) {
|
|
2606
|
+
if (!line) return /* @__PURE__ */ jsx63("div", { className: "min-h-5 bg-white/5" });
|
|
2607
|
+
return /* @__PURE__ */ jsxs46("div", { className: cx("flex min-w-0 px-space-sm", KIND2[line.kind]), children: [
|
|
2608
|
+
gutters !== "new" && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: "w-8 shrink-0 select-none pr-space-xs text-right text-code-comment", children: line.oldNo ?? "" }),
|
|
2609
|
+
gutters !== "old" && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: "w-8 shrink-0 select-none pr-space-xs text-right text-code-comment", children: line.newNo ?? "" }),
|
|
2610
|
+
/* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: "w-4 shrink-0 select-none", children: SIGN[line.kind] }),
|
|
2611
|
+
SPOKEN[line.kind] && /* @__PURE__ */ jsx63("span", { className: "sr-only", children: SPOKEN[line.kind] }),
|
|
2612
|
+
/* @__PURE__ */ jsx63("span", { className: "min-w-0 whitespace-pre-wrap wrap-break-word", children: line.text || " " })
|
|
2613
|
+
] });
|
|
2614
|
+
}
|
|
2615
|
+
function DiffViewer({ oldValue, newValue, oldTitle, newTitle, mode = "unified", ...rest }) {
|
|
2616
|
+
const lines = diffLines(oldValue, newValue);
|
|
2617
|
+
const unified = /* @__PURE__ */ jsx63("pre", { tabIndex: 0, className: cx(PRE, mode === "split" && "lg:hidden"), children: lines.map((l, i) => /* @__PURE__ */ jsx63(Row, { line: l, gutters: "both" }, i)) });
|
|
2618
|
+
return /* @__PURE__ */ jsxs46("figure", { ...rest, className: "min-w-0 max-w-full overflow-hidden rounded-xl bg-brand-obsidian", children: [
|
|
2619
|
+
(oldTitle || newTitle) && /* @__PURE__ */ jsxs46("figcaption", { className: "flex min-w-0 flex-wrap items-center gap-space-xs border-b border-white/10 px-space-md py-space-xs font-label-mono text-label-mono text-slate-300", children: [
|
|
2620
|
+
oldTitle && /* @__PURE__ */ jsx63("span", { className: "truncate", children: oldTitle }),
|
|
2621
|
+
oldTitle && newTitle && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", children: "\u2192" }),
|
|
2622
|
+
newTitle && /* @__PURE__ */ jsx63("span", { className: "truncate", children: newTitle })
|
|
2623
|
+
] }),
|
|
2624
|
+
unified,
|
|
2625
|
+
mode === "split" && /* @__PURE__ */ jsx63("pre", { tabIndex: 0, className: cx(PRE, "hidden grid-cols-2 lg:grid"), children: splitRows(lines).map((r, i) => /* @__PURE__ */ jsxs46("div", { className: "contents", children: [
|
|
2626
|
+
/* @__PURE__ */ jsx63(Row, { line: r.left, gutters: "old" }),
|
|
2627
|
+
/* @__PURE__ */ jsx63(Row, { line: r.right, gutters: "new" })
|
|
2628
|
+
] }, i)) })
|
|
2629
|
+
] });
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
// src/components/BarChart.tsx
|
|
2633
|
+
import { jsx as jsx64, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
2634
|
+
var HEIGHT4 = { sm: "h-16", md: "h-28" };
|
|
2635
|
+
var TONE14 = { brand: "bg-brand-cobalt", success: "bg-brand-emerald" };
|
|
2636
|
+
function BarChart({ label, bars, highlight, highlightLabel, axis, height = "md", tone = "brand", ...rest }) {
|
|
2637
|
+
const max = Math.max(0, ...bars.map((b) => b.value));
|
|
2638
|
+
const name = (i) => bars[i].label ?? `Bar ${i + 1}`;
|
|
2639
|
+
const hl = highlight !== void 0 && bars[highlight] ? `; highlighted ${name(highlight)} = ${bars[highlight].value}` : "";
|
|
2640
|
+
const summary = `${label}: ${bars.length} bars, highest ${max}${hl}`;
|
|
2641
|
+
return /* @__PURE__ */ jsxs47("figure", { ...rest, className: "flex min-w-0 flex-col gap-space-xs", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx64("div", { role: "img", "aria-label": summary, className: cx("flex items-end gap-1", HEIGHT4[height], highlightLabel && "pt-space-lg"), children: bars.map((b, i) => {
|
|
2643
|
+
const pct = max > 0 ? Math.max(2, Math.round(Math.max(0, b.value) / max * 100)) : 2;
|
|
2644
|
+
const strong = highlight === void 0 || i === highlight;
|
|
2645
|
+
return /* @__PURE__ */ jsxs47("div", { className: "relative flex h-full min-w-0 flex-1 items-end", children: [
|
|
2646
|
+
i === highlight && highlightLabel && /* @__PURE__ */ jsx64("span", { className: "absolute -top-space-lg left-1/2 -translate-x-1/2 whitespace-nowrap font-label-mono text-[10px] text-fg-brand", children: highlightLabel }),
|
|
2647
|
+
/* @__PURE__ */ jsx64("div", { "data-bar": "", className: cx("w-full rounded-t", strong ? TONE14[tone] : "bg-surface-container-high"), style: { height: `${pct}%` } })
|
|
2648
|
+
] }, i);
|
|
2649
|
+
}) }),
|
|
2650
|
+
axis && /* @__PURE__ */ jsxs47("div", { "aria-hidden": "true", className: "flex justify-between font-label-mono text-[10px] text-on-surface-variant", children: [
|
|
2651
|
+
/* @__PURE__ */ jsx64("span", { children: axis[0] }),
|
|
2652
|
+
/* @__PURE__ */ jsx64("span", { children: axis[1] }),
|
|
2653
|
+
/* @__PURE__ */ jsx64("span", { children: axis[2] })
|
|
2654
|
+
] }),
|
|
2655
|
+
/* @__PURE__ */ jsxs47("table", { className: "sr-only", children: [
|
|
2656
|
+
/* @__PURE__ */ jsx64("caption", { children: label }),
|
|
2657
|
+
/* @__PURE__ */ jsx64("tbody", { children: bars.map((b, i) => /* @__PURE__ */ jsxs47("tr", { children: [
|
|
2658
|
+
/* @__PURE__ */ jsx64("th", { scope: "row", children: name(i) }),
|
|
2659
|
+
/* @__PURE__ */ jsx64("td", { children: b.value })
|
|
2660
|
+
] }, i)) })
|
|
2661
|
+
] })
|
|
2662
|
+
] });
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
// src/ide/UmlClass.tsx
|
|
2666
|
+
import { jsx as jsx65, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
2667
|
+
var EMPHASIS = { default: "border border-border-strong", brand: "border-2 border-brand-cobalt", strong: "border-2 border-ink" };
|
|
2668
|
+
var SIZE15 = { sm: { text: "text-[11px] leading-4", pad: "px-space-xs py-space-2xs" }, md: { text: "text-code-inline", pad: "px-space-sm py-space-xs" } };
|
|
2669
|
+
var HEADER_TONE = { container: "bg-surface-container", info: "bg-badge-intermediate-bg", strong: "bg-surface-container-high" };
|
|
2670
|
+
var STEREO_TONE = { container: "text-secondary", info: "text-badge-intermediate-text", strong: "text-secondary" };
|
|
2671
|
+
function UmlClass({ name, stereotype, attributes = [], methods = [], tag, emphasis = "default", size = "md", dashed, variant = "box", headerTone = "container", columns = 1, ...rest }) {
|
|
2672
|
+
const s = SIZE15[size];
|
|
2673
|
+
if (variant === "tinted") {
|
|
2674
|
+
const strong = headerTone === "strong";
|
|
2675
|
+
return /* @__PURE__ */ jsxs48("div", { ...rest, className: "flex min-w-0 flex-col gap-space-xs rounded-lg bg-surface-elevated p-space-sm shadow-sm", children: [
|
|
2676
|
+
/* @__PURE__ */ jsxs48("div", { className: cx("flex min-w-0 gap-space-xs rounded px-space-xs py-space-2xs", HEADER_TONE[headerTone], strong ? "items-center justify-between" : "flex-col items-center text-center"), children: [
|
|
2677
|
+
stereotype && /* @__PURE__ */ jsxs48("span", { className: cx("font-label-mono text-label-mono italic", STEREO_TONE[headerTone]), children: [
|
|
2678
|
+
"\xAB",
|
|
2679
|
+
stereotype,
|
|
2680
|
+
"\xBB"
|
|
2681
|
+
] }),
|
|
2682
|
+
/* @__PURE__ */ jsx65("span", { className: "truncate font-headline-sm text-headline-sm text-ink", children: name }),
|
|
2683
|
+
tag
|
|
2684
|
+
] }),
|
|
2685
|
+
attributes.length + methods.length > 0 && /* @__PURE__ */ jsxs48("ul", { className: cx("grid min-w-0 gap-space-2xs p-space-2xs font-code-inline text-code-inline", columns === 2 ? "grid-cols-2" : "grid-cols-1"), children: [
|
|
2686
|
+
attributes.map((a, i) => /* @__PURE__ */ jsx65("li", { className: "min-w-0 truncate text-on-surface-variant", children: a }, `a${i}`)),
|
|
2687
|
+
methods.map((m, i) => /* @__PURE__ */ jsx65("li", { className: cx("min-w-0 truncate text-fg-brand", columns === 2 && "col-span-2"), children: m }, `m${i}`))
|
|
2688
|
+
] })
|
|
2689
|
+
] });
|
|
2690
|
+
}
|
|
2691
|
+
return /* @__PURE__ */ jsxs48("div", { ...rest, className: cx("inline-flex min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-elevated font-code-inline text-on-surface shadow-sm", EMPHASIS[emphasis], dashed && "border-dashed", s.text), children: [
|
|
2692
|
+
/* @__PURE__ */ jsxs48("div", { className: cx("flex flex-col items-center text-center", s.pad), children: [
|
|
2693
|
+
stereotype && /* @__PURE__ */ jsxs48("span", { className: "text-on-surface-variant", children: [
|
|
2694
|
+
"\xAB",
|
|
2695
|
+
stereotype,
|
|
2696
|
+
"\xBB"
|
|
2697
|
+
] }),
|
|
2698
|
+
/* @__PURE__ */ jsx65("span", { className: "font-semibold text-ink", children: name }),
|
|
2699
|
+
tag
|
|
2700
|
+
] }),
|
|
2701
|
+
attributes.length > 0 && /* @__PURE__ */ jsx65("ul", { className: cx("border-t border-border-subtle", s.pad), children: attributes.map((a, i) => /* @__PURE__ */ jsx65("li", { className: "whitespace-nowrap", children: a }, i)) }),
|
|
2702
|
+
methods.length > 0 && /* @__PURE__ */ jsx65("ul", { className: cx("border-t border-border-subtle", s.pad), children: methods.map((m, i) => /* @__PURE__ */ jsx65("li", { className: "whitespace-nowrap", children: m }, i)) })
|
|
2703
|
+
] });
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
// src/ide/UmlDiagram.tsx
|
|
2707
|
+
import { useEffect as useEffect7, useId as useId13, useRef as useRef11, useState as useState9 } from "react";
|
|
2708
|
+
import { jsx as jsx66, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
2709
|
+
var VERB = {
|
|
2710
|
+
association: "is associated with",
|
|
2711
|
+
dependency: "depends on",
|
|
2712
|
+
realization: "implements",
|
|
2713
|
+
inheritance: "extends",
|
|
2714
|
+
aggregation: "aggregates",
|
|
2715
|
+
composition: "composes"
|
|
2716
|
+
};
|
|
2717
|
+
var ZOOM_MIN = 0.5;
|
|
2718
|
+
var ZOOM_MAX = 2;
|
|
2719
|
+
var ZOOM_STEP = 0.25;
|
|
2720
|
+
function describeDiagram(label, nodes, edges) {
|
|
2721
|
+
const byId = new Map(nodes.map((n) => [n.id, n.name]));
|
|
2722
|
+
const classes = nodes.map((n) => n.stereotype ? `${n.name} (${n.stereotype})` : n.name).join(", ");
|
|
2723
|
+
const rels = edges.filter((e) => byId.has(e.from) && byId.has(e.to)).map((e) => {
|
|
2724
|
+
const mult = e.fromMultiplicity || e.toMultiplicity ? ` (${e.fromMultiplicity ?? ""} to ${e.toMultiplicity ?? ""})` : "";
|
|
2725
|
+
return `${byId.get(e.from)} ${VERB[e.kind]} ${byId.get(e.to)}${mult}${e.label ? `, ${e.label}` : ""}`;
|
|
2726
|
+
}).join("; ");
|
|
2727
|
+
return `${label}. Classes: ${classes}.${rels ? ` Relationships: ${rels}.` : ""}`;
|
|
2728
|
+
}
|
|
2729
|
+
function edgeStyle(kind, id) {
|
|
2730
|
+
const dashed = kind === "dependency" || kind === "realization";
|
|
2731
|
+
const end = kind === "association" || kind === "dependency" ? `url(#${id}-arrow)` : kind === "realization" || kind === "inheritance" ? `url(#${id}-triangle)` : void 0;
|
|
2732
|
+
const start = kind === "aggregation" ? `url(#${id}-diamond-hollow)` : kind === "composition" ? `url(#${id}-diamond-filled)` : void 0;
|
|
2733
|
+
return { dashed, end, start };
|
|
2734
|
+
}
|
|
2735
|
+
function UmlDiagram({ label, nodes, edges, direction = "TB", zoomable = true, compact, pattern = "dots", ...rest }) {
|
|
2736
|
+
const id = useId13().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
2737
|
+
const nodeRefs = useRef11(/* @__PURE__ */ new Map());
|
|
2738
|
+
const viewportRef = useRef11(null);
|
|
2739
|
+
const [layout, setLayout] = useState9(null);
|
|
2740
|
+
const [zoom, setZoom] = useState9(1);
|
|
2741
|
+
const [fit, setFit] = useState9(1);
|
|
2742
|
+
const contentKey = JSON.stringify({ n: nodes.map((n) => [n.id, n.name, n.stereotype, n.attributes, n.methods]), e: edges.map((e) => [e.from, e.to, e.kind]), direction, compact });
|
|
2743
|
+
const [sizeTick, setSizeTick] = useState9(0);
|
|
2744
|
+
const sizes = useRef11(/* @__PURE__ */ new Map());
|
|
2745
|
+
const key = `${contentKey}#${sizeTick}`;
|
|
2746
|
+
useEffect7(() => {
|
|
2747
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
2748
|
+
const ro = new ResizeObserver(() => {
|
|
2749
|
+
let changed = false;
|
|
2750
|
+
nodeRefs.current.forEach((el, nodeId) => {
|
|
2751
|
+
const size = `${el.offsetWidth}x${el.offsetHeight}`;
|
|
2752
|
+
if (sizes.current.get(nodeId) !== size) {
|
|
2753
|
+
sizes.current.set(nodeId, size);
|
|
2754
|
+
changed = true;
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
if (changed) setSizeTick((t) => t + 1);
|
|
2758
|
+
});
|
|
2759
|
+
nodeRefs.current.forEach((el) => ro.observe(el));
|
|
2760
|
+
return () => ro.disconnect();
|
|
2761
|
+
}, [contentKey]);
|
|
2762
|
+
useEffect7(() => {
|
|
2763
|
+
let cancelled = false;
|
|
2764
|
+
void (async () => {
|
|
2765
|
+
const { Graph, layout: runLayout } = await import("@dagrejs/dagre");
|
|
2766
|
+
const g = new Graph({ multigraph: true });
|
|
2767
|
+
g.setGraph({ rankdir: direction, nodesep: 48, ranksep: 64, marginx: 16, marginy: 16 });
|
|
2768
|
+
g.setDefaultEdgeLabel(() => ({}));
|
|
2769
|
+
for (const n of nodes) {
|
|
2770
|
+
const el = nodeRefs.current.get(n.id);
|
|
2771
|
+
g.setNode(n.id, { width: el?.offsetWidth || 160, height: el?.offsetHeight || 80 });
|
|
2772
|
+
}
|
|
2773
|
+
edges.forEach((e, i) => {
|
|
2774
|
+
if (g.hasNode(e.from) && g.hasNode(e.to)) g.setEdge(e.from, e.to, {}, `e${i}`);
|
|
2775
|
+
});
|
|
2776
|
+
runLayout(g);
|
|
2777
|
+
if (cancelled) return;
|
|
2778
|
+
const graph = g.graph();
|
|
2779
|
+
const positioned = {};
|
|
2780
|
+
for (const n of nodes) {
|
|
2781
|
+
const v = g.node(n.id);
|
|
2782
|
+
if (v) positioned[n.id] = { x: v.x - v.width / 2, y: v.y - v.height / 2 };
|
|
2783
|
+
}
|
|
2784
|
+
setLayout({
|
|
2785
|
+
width: graph.width ?? 0,
|
|
2786
|
+
height: graph.height ?? 0,
|
|
2787
|
+
nodes: positioned,
|
|
2788
|
+
edges: edges.map((e, i) => g.edge({ v: e.from, w: e.to, name: `e${i}` })?.points ?? null)
|
|
2789
|
+
});
|
|
2790
|
+
})();
|
|
2791
|
+
return () => {
|
|
2792
|
+
cancelled = true;
|
|
2793
|
+
};
|
|
2794
|
+
}, [key]);
|
|
2795
|
+
useEffect7(() => {
|
|
2796
|
+
const vp = viewportRef.current;
|
|
2797
|
+
if (!layout || !vp || layout.width === 0) return;
|
|
2798
|
+
const measure = () => setFit(Math.min(1, vp.clientWidth / layout.width || 1));
|
|
2799
|
+
measure();
|
|
2800
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
2801
|
+
const ro = new ResizeObserver(measure);
|
|
2802
|
+
ro.observe(vp);
|
|
2803
|
+
return () => ro.disconnect();
|
|
2804
|
+
}, [layout]);
|
|
2805
|
+
const scale = compact ? fit : zoom;
|
|
2806
|
+
const descId = `${id}-desc`;
|
|
2807
|
+
return /* @__PURE__ */ jsxs49("figure", { ...rest, className: "relative min-w-0 max-w-full overflow-hidden rounded-xl border border-border-subtle bg-surface-subtle", children: [
|
|
2808
|
+
/* @__PURE__ */ jsx66("figcaption", { id: descId, className: "sr-only", children: describeDiagram(label, nodes, edges) }),
|
|
2809
|
+
zoomable && !compact && /* @__PURE__ */ jsxs49("div", { className: "absolute right-space-sm top-space-sm z-10 flex items-center gap-space-2xs rounded-lg bg-surface-elevated/90 p-space-2xs shadow-sm", children: [
|
|
2810
|
+
/* @__PURE__ */ jsx66(IconButton, { icon: "zoom_out", label: "Zoom out", size: "xs", variant: "secondary", disabled: zoom <= ZOOM_MIN, onClick: () => setZoom((z) => Math.max(ZOOM_MIN, z - ZOOM_STEP)) }),
|
|
2811
|
+
/* @__PURE__ */ jsxs49("span", { "aria-live": "polite", className: "w-10 text-center font-label-mono text-[11px] text-on-surface-variant", children: [
|
|
2812
|
+
Math.round(zoom * 100),
|
|
2813
|
+
"%"
|
|
2814
|
+
] }),
|
|
2815
|
+
/* @__PURE__ */ jsx66(IconButton, { icon: "zoom_in", label: "Zoom in", size: "xs", variant: "secondary", disabled: zoom >= ZOOM_MAX, onClick: () => setZoom((z) => Math.min(ZOOM_MAX, z + ZOOM_STEP)) }),
|
|
2816
|
+
/* @__PURE__ */ jsx66(IconButton, { icon: "fit_screen", label: "Reset zoom", size: "xs", variant: "secondary", onClick: () => setZoom(1) })
|
|
2817
|
+
] }),
|
|
2818
|
+
/* @__PURE__ */ jsx66(
|
|
2819
|
+
"div",
|
|
2820
|
+
{
|
|
2821
|
+
ref: viewportRef,
|
|
2822
|
+
role: "region",
|
|
2823
|
+
"aria-label": `${label} diagram`,
|
|
2824
|
+
tabIndex: 0,
|
|
2825
|
+
className: cx("min-h-40 overflow-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt", pattern === "dots" && "bg-pattern-dots", compact ? "max-h-64" : "max-h-[36rem]", zoomable && !compact && "pt-space-2xl"),
|
|
2826
|
+
children: /* @__PURE__ */ jsxs49(
|
|
2827
|
+
"div",
|
|
2828
|
+
{
|
|
2829
|
+
role: "img",
|
|
2830
|
+
"aria-label": label,
|
|
2831
|
+
"aria-describedby": descId,
|
|
2832
|
+
className: layout ? "relative origin-top-left" : "flex flex-wrap gap-space-md p-space-md",
|
|
2833
|
+
style: layout ? { width: layout.width, height: layout.height, transform: `scale(${scale})` } : void 0,
|
|
2834
|
+
children: [
|
|
2835
|
+
layout && /* @__PURE__ */ jsxs49("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 overflow-visible text-on-surface-variant", width: layout.width, height: layout.height, children: [
|
|
2836
|
+
/* @__PURE__ */ jsxs49("defs", { children: [
|
|
2837
|
+
/* @__PURE__ */ jsx66("marker", { id: `${id}-arrow`, viewBox: "0 0 10 10", refX: "10", refY: "5", markerWidth: "10", markerHeight: "10", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,0 L10,5 L0,10", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }) }),
|
|
2838
|
+
/* @__PURE__ */ jsx66("marker", { id: `${id}-triangle`, viewBox: "0 0 12 12", refX: "12", refY: "6", markerWidth: "12", markerHeight: "12", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,0 L12,6 L0,12 z", fill: "var(--color-surface-elevated)", stroke: "currentColor", strokeWidth: "1.5" }) }),
|
|
2839
|
+
/* @__PURE__ */ jsx66("marker", { id: `${id}-diamond-hollow`, viewBox: "0 0 14 8", refX: "14", refY: "4", markerWidth: "14", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,4 L7,0 L14,4 L7,8 z", fill: "var(--color-surface-elevated)", stroke: "currentColor", strokeWidth: "1.5" }) }),
|
|
2840
|
+
/* @__PURE__ */ jsx66("marker", { id: `${id}-diamond-filled`, viewBox: "0 0 14 8", refX: "14", refY: "4", markerWidth: "14", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,4 L7,0 L14,4 L7,8 z", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.5" }) })
|
|
2841
|
+
] }),
|
|
2842
|
+
edges.map((e, i) => {
|
|
2843
|
+
const pts = layout.edges[i];
|
|
2844
|
+
if (!pts || pts.length < 2) return null;
|
|
2845
|
+
const s = edgeStyle(e.kind, id);
|
|
2846
|
+
const d = pts.map((p, k) => `${k === 0 ? "M" : "L"}${p.x},${p.y}`).join(" ");
|
|
2847
|
+
const mid = pts[Math.floor(pts.length / 2)];
|
|
2848
|
+
return /* @__PURE__ */ jsxs49("g", { children: [
|
|
2849
|
+
/* @__PURE__ */ jsx66(
|
|
2850
|
+
"path",
|
|
2851
|
+
{
|
|
2852
|
+
"data-edge": "",
|
|
2853
|
+
d,
|
|
2854
|
+
fill: "none",
|
|
2855
|
+
stroke: "currentColor",
|
|
2856
|
+
strokeWidth: "1.5",
|
|
2857
|
+
strokeDasharray: s.dashed ? "6 4" : void 0,
|
|
2858
|
+
markerEnd: s.end,
|
|
2859
|
+
markerStart: s.start
|
|
2860
|
+
}
|
|
2861
|
+
),
|
|
2862
|
+
e.label && /* @__PURE__ */ jsx66("text", { x: mid.x + 6, y: mid.y - 6, className: "fill-on-surface-variant font-code-inline text-[10px]", children: e.label }),
|
|
2863
|
+
e.fromMultiplicity && /* @__PURE__ */ jsx66("text", { x: pts[0].x + 6, y: pts[0].y + 14, className: "fill-on-surface-variant font-code-inline text-[10px]", children: e.fromMultiplicity }),
|
|
2864
|
+
e.toMultiplicity && /* @__PURE__ */ jsx66("text", { x: pts[pts.length - 1].x + 6, y: pts[pts.length - 1].y - 6, className: "fill-on-surface-variant font-code-inline text-[10px]", children: e.toMultiplicity })
|
|
2865
|
+
] }, i);
|
|
2866
|
+
})
|
|
2867
|
+
] }),
|
|
2868
|
+
nodes.map((n) => /* @__PURE__ */ jsx66(
|
|
2869
|
+
"div",
|
|
2870
|
+
{
|
|
2871
|
+
"data-node": "",
|
|
2872
|
+
ref: (el) => {
|
|
2873
|
+
if (el) nodeRefs.current.set(n.id, el);
|
|
2874
|
+
else nodeRefs.current.delete(n.id);
|
|
2875
|
+
},
|
|
2876
|
+
className: layout ? "absolute" : void 0,
|
|
2877
|
+
style: layout?.nodes[n.id] ? { left: layout.nodes[n.id].x, top: layout.nodes[n.id].y } : void 0,
|
|
2878
|
+
children: /* @__PURE__ */ jsx66(UmlClass, { name: n.name, stereotype: n.stereotype, attributes: n.attributes, methods: n.methods, tag: n.tag, emphasis: n.emphasis, dashed: n.dashed, size: compact ? "sm" : "md" })
|
|
2879
|
+
},
|
|
2880
|
+
n.id
|
|
2881
|
+
))
|
|
2882
|
+
]
|
|
2883
|
+
}
|
|
2884
|
+
)
|
|
2885
|
+
}
|
|
2886
|
+
)
|
|
2887
|
+
] });
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
// src/components/Tooltip.tsx
|
|
2891
|
+
import {
|
|
2892
|
+
cloneElement as cloneElement2,
|
|
2893
|
+
useEffect as useEffect8,
|
|
2894
|
+
useId as useId14,
|
|
2895
|
+
useLayoutEffect,
|
|
2896
|
+
useRef as useRef12,
|
|
2897
|
+
useState as useState10
|
|
2898
|
+
} from "react";
|
|
2899
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
2900
|
+
import { Fragment as Fragment6, jsx as jsx67, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
2901
|
+
var GAP2 = 8;
|
|
2902
|
+
function Tooltip({ content, children, side = "top", delay = 400 }) {
|
|
2903
|
+
const id = useId14();
|
|
2904
|
+
const theme = useThemeTone();
|
|
2905
|
+
const [open, setOpen] = useState10(false);
|
|
2906
|
+
const [pos, setPos] = useState10(null);
|
|
2907
|
+
const triggerRef = useRef12(null);
|
|
2908
|
+
const tipRef = useRef12(null);
|
|
2909
|
+
const timer = useRef12(void 0);
|
|
2910
|
+
const show = () => {
|
|
2911
|
+
clearTimeout(timer.current);
|
|
2912
|
+
timer.current = setTimeout(() => setOpen(true), delay);
|
|
2913
|
+
};
|
|
2914
|
+
const hide = () => {
|
|
2915
|
+
clearTimeout(timer.current);
|
|
2916
|
+
setOpen(false);
|
|
2917
|
+
setPos(null);
|
|
2918
|
+
};
|
|
2919
|
+
useEffect8(() => () => clearTimeout(timer.current), []);
|
|
2920
|
+
useEffect8(() => {
|
|
2921
|
+
if (!open) return;
|
|
2922
|
+
const onKey = (e) => {
|
|
2923
|
+
if (e.key === "Escape") hide();
|
|
2924
|
+
};
|
|
2925
|
+
document.addEventListener("keydown", onKey);
|
|
2926
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
2927
|
+
}, [open]);
|
|
2928
|
+
useLayoutEffect(() => {
|
|
2929
|
+
if (!open || !triggerRef.current || !tipRef.current) return;
|
|
2930
|
+
const r = triggerRef.current.getBoundingClientRect();
|
|
2931
|
+
const t = tipRef.current.getBoundingClientRect();
|
|
2932
|
+
const vw = window.innerWidth;
|
|
2933
|
+
const vh = window.innerHeight;
|
|
2934
|
+
let s = side;
|
|
2935
|
+
if (s === "top" && r.top - t.height - GAP2 < 0) s = "bottom";
|
|
2936
|
+
else if (s === "bottom" && r.bottom + t.height + GAP2 > vh) s = "top";
|
|
2937
|
+
else if (s === "left" && r.left - t.width - GAP2 < 0) s = "right";
|
|
2938
|
+
else if (s === "right" && r.right + t.width + GAP2 > vw) s = "left";
|
|
2939
|
+
let top = s === "top" ? r.top - t.height - GAP2 : s === "bottom" ? r.bottom + GAP2 : r.top + r.height / 2 - t.height / 2;
|
|
2940
|
+
let left = s === "left" ? r.left - t.width - GAP2 : s === "right" ? r.right + GAP2 : r.left + r.width / 2 - t.width / 2;
|
|
2941
|
+
left = Math.min(Math.max(GAP2, left), Math.max(GAP2, vw - t.width - GAP2));
|
|
2942
|
+
top = Math.min(Math.max(GAP2, top), Math.max(GAP2, vh - t.height - GAP2));
|
|
2943
|
+
setPos({ top, left });
|
|
2944
|
+
}, [open, side]);
|
|
2945
|
+
const own = children.props;
|
|
2946
|
+
const trigger = cloneElement2(children, {
|
|
2947
|
+
ref: (el) => {
|
|
2948
|
+
triggerRef.current = el;
|
|
2949
|
+
const r = own.ref;
|
|
2950
|
+
if (typeof r === "function") r(el);
|
|
2951
|
+
else if (r && typeof r === "object") r.current = el;
|
|
2952
|
+
},
|
|
2953
|
+
"aria-describedby": open ? [own["aria-describedby"], id].filter(Boolean).join(" ") : own["aria-describedby"],
|
|
2954
|
+
onMouseEnter: (e) => {
|
|
2955
|
+
own.onMouseEnter?.(e);
|
|
2956
|
+
show();
|
|
2957
|
+
},
|
|
2958
|
+
onMouseLeave: (e) => {
|
|
2959
|
+
own.onMouseLeave?.(e);
|
|
2960
|
+
hide();
|
|
2961
|
+
},
|
|
2962
|
+
onFocus: (e) => {
|
|
2963
|
+
own.onFocus?.(e);
|
|
2964
|
+
show();
|
|
2965
|
+
},
|
|
2966
|
+
onBlur: (e) => {
|
|
2967
|
+
own.onBlur?.(e);
|
|
2968
|
+
hide();
|
|
2969
|
+
}
|
|
2970
|
+
});
|
|
2971
|
+
return /* @__PURE__ */ jsxs50(Fragment6, { children: [
|
|
2972
|
+
trigger,
|
|
2973
|
+
open && typeof document !== "undefined" && createPortal3(
|
|
2974
|
+
/* @__PURE__ */ jsx67(
|
|
2975
|
+
"div",
|
|
2976
|
+
{
|
|
2977
|
+
ref: tipRef,
|
|
2978
|
+
id,
|
|
2979
|
+
role: "tooltip",
|
|
2980
|
+
"data-theme": theme,
|
|
2981
|
+
className: "pointer-events-none fixed z-50 max-w-[min(20rem,calc(100vw-1rem))] rounded-lg bg-ink px-space-sm py-space-xs font-body-sm text-body-sm text-on-ink shadow-md wrap-break-word",
|
|
2982
|
+
style: pos ? { top: pos.top, left: pos.left } : { top: 0, left: 0, visibility: "hidden" },
|
|
2983
|
+
children: content
|
|
2984
|
+
}
|
|
2985
|
+
),
|
|
2986
|
+
document.body
|
|
2987
|
+
)
|
|
2988
|
+
] });
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
// src/components/Toast.tsx
|
|
2992
|
+
import { useEffect as useEffect9, useState as useState11, useSyncExternalStore } from "react";
|
|
2993
|
+
import { jsx as jsx68, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
2994
|
+
var toasts = [];
|
|
2995
|
+
var nextId = 1;
|
|
2996
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
2997
|
+
var EMPTY = [];
|
|
2998
|
+
var emit = () => listeners.forEach((l) => l());
|
|
2999
|
+
var toastStore = {
|
|
3000
|
+
show(options) {
|
|
3001
|
+
const toast = { ...options, tone: options.tone ?? "default", duration: options.duration ?? 4e3, id: nextId++ };
|
|
3002
|
+
toasts = [...toasts, toast];
|
|
3003
|
+
emit();
|
|
3004
|
+
return toast.id;
|
|
3005
|
+
},
|
|
3006
|
+
dismiss(id) {
|
|
3007
|
+
toasts = toasts.filter((t) => t.id !== id);
|
|
3008
|
+
emit();
|
|
3009
|
+
},
|
|
3010
|
+
clear() {
|
|
3011
|
+
toasts = [];
|
|
3012
|
+
emit();
|
|
3013
|
+
},
|
|
3014
|
+
subscribe(listener) {
|
|
3015
|
+
listeners.add(listener);
|
|
3016
|
+
return () => {
|
|
3017
|
+
listeners.delete(listener);
|
|
3018
|
+
};
|
|
3019
|
+
},
|
|
3020
|
+
get: () => toasts
|
|
3021
|
+
};
|
|
3022
|
+
function useToast() {
|
|
3023
|
+
return { show: toastStore.show, dismiss: toastStore.dismiss };
|
|
3024
|
+
}
|
|
3025
|
+
var TONE15 = { default: "border-l-ink", success: "border-l-brand-emerald", danger: "border-l-brand-crimson" };
|
|
3026
|
+
function ToastItem({ toast }) {
|
|
3027
|
+
const [paused, setPaused] = useState11(false);
|
|
3028
|
+
useEffect9(() => {
|
|
3029
|
+
if (paused || !Number.isFinite(toast.duration)) return;
|
|
3030
|
+
const t = setTimeout(() => toastStore.dismiss(toast.id), toast.duration);
|
|
3031
|
+
return () => clearTimeout(t);
|
|
3032
|
+
}, [paused, toast]);
|
|
3033
|
+
return /* @__PURE__ */ jsxs51(
|
|
3034
|
+
"li",
|
|
3035
|
+
{
|
|
3036
|
+
onMouseEnter: () => setPaused(true),
|
|
3037
|
+
onMouseLeave: () => setPaused(false),
|
|
3038
|
+
onFocus: () => setPaused(true),
|
|
3039
|
+
onBlur: () => setPaused(false),
|
|
3040
|
+
className: cx("pointer-events-auto flex min-w-0 items-start gap-space-sm rounded-lg border border-l-4 border-border-subtle bg-surface-elevated p-space-sm text-on-surface shadow-md", TONE15[toast.tone]),
|
|
3041
|
+
children: [
|
|
3042
|
+
/* @__PURE__ */ jsxs51("div", { className: "min-w-0 flex-1", children: [
|
|
3043
|
+
/* @__PURE__ */ jsx68("p", { className: "font-body-md text-body-md font-semibold wrap-break-word", children: toast.title }),
|
|
3044
|
+
toast.description && /* @__PURE__ */ jsx68("p", { className: "font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: toast.description }),
|
|
3045
|
+
toast.action && /* @__PURE__ */ jsx68("div", { className: "mt-space-xs", children: toast.action })
|
|
3046
|
+
] }),
|
|
3047
|
+
/* @__PURE__ */ jsx68(IconButton, { icon: "close", label: "Dismiss notification", size: "xs", onClick: () => toastStore.dismiss(toast.id) })
|
|
3048
|
+
]
|
|
3049
|
+
}
|
|
3050
|
+
);
|
|
3051
|
+
}
|
|
3052
|
+
function Toaster({ label = "Notifications" }) {
|
|
3053
|
+
const list = useSyncExternalStore(toastStore.subscribe, toastStore.get, () => EMPTY);
|
|
3054
|
+
return /* @__PURE__ */ jsx68("section", { "aria-label": label, className: "pointer-events-none fixed inset-x-0 bottom-0 z-50 p-space-md md:inset-x-auto md:right-0 md:w-96", children: /* @__PURE__ */ jsx68("div", { "aria-live": "polite", "aria-relevant": "additions", children: /* @__PURE__ */ jsx68("ol", { className: "flex flex-col gap-space-xs", children: list.map((t) => /* @__PURE__ */ jsx68(ToastItem, { toast: t }, t.id)) }) }) });
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
// src/components/CommandPalette.tsx
|
|
3058
|
+
import { useEffect as useEffect10, useId as useId15, useRef as useRef13, useState as useState12 } from "react";
|
|
3059
|
+
import { createPortal as createPortal4 } from "react-dom";
|
|
3060
|
+
import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
3061
|
+
function CommandPalette({ open, onClose, query, onQueryChange, groups, placeholder = "Search\u2026", emptyText = "No results", label = "Command palette", ...rest }) {
|
|
3062
|
+
const base = useId15();
|
|
3063
|
+
const theme = useThemeTone();
|
|
3064
|
+
const panelRef = useRef13(null);
|
|
3065
|
+
const inputRef = useRef13(null);
|
|
3066
|
+
const [activeId, setActiveId] = useState12(null);
|
|
3067
|
+
useModal({ open, onClose, panelRef, initialFocusRef: inputRef });
|
|
3068
|
+
const flat = groups.flatMap((g) => g.items);
|
|
3069
|
+
const active = flat.find((i) => i.id === activeId) ?? flat[0];
|
|
3070
|
+
const optionId = (id) => `${base}-opt-${id}`;
|
|
3071
|
+
useEffect10(() => {
|
|
3072
|
+
if (active) document.getElementById(optionId(active.id))?.scrollIntoView?.({ block: "nearest" });
|
|
3073
|
+
}, [active?.id]);
|
|
3074
|
+
const select = (item) => {
|
|
3075
|
+
item.onSelect();
|
|
3076
|
+
onClose();
|
|
3077
|
+
};
|
|
3078
|
+
const onKeyDown = (e) => {
|
|
3079
|
+
if (!flat.length) return;
|
|
3080
|
+
const i = active ? flat.indexOf(active) : 0;
|
|
3081
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
3082
|
+
e.preventDefault();
|
|
3083
|
+
const next = (i + (e.key === "ArrowDown" ? 1 : -1) + flat.length) % flat.length;
|
|
3084
|
+
setActiveId(flat[next].id);
|
|
3085
|
+
} else if (e.key === "Enter" && active) {
|
|
3086
|
+
e.preventDefault();
|
|
3087
|
+
select(active);
|
|
3088
|
+
}
|
|
3089
|
+
};
|
|
3090
|
+
if (!open || typeof document === "undefined") return null;
|
|
3091
|
+
const listId = `${base}-list`;
|
|
3092
|
+
return createPortal4(
|
|
3093
|
+
/* @__PURE__ */ jsx69(
|
|
3094
|
+
"div",
|
|
3095
|
+
{
|
|
3096
|
+
"data-theme": theme,
|
|
3097
|
+
className: "fixed inset-0 z-50 flex items-start justify-center bg-brand-obsidian/40 p-space-md pt-[10vh] backdrop-blur-sm",
|
|
3098
|
+
onMouseDown: (e) => {
|
|
3099
|
+
if (e.target === e.currentTarget) onClose();
|
|
3100
|
+
},
|
|
3101
|
+
children: /* @__PURE__ */ jsxs52(
|
|
3102
|
+
"div",
|
|
3103
|
+
{
|
|
3104
|
+
...rest,
|
|
3105
|
+
ref: panelRef,
|
|
3106
|
+
role: "dialog",
|
|
3107
|
+
"aria-modal": "true",
|
|
3108
|
+
"aria-label": label,
|
|
3109
|
+
tabIndex: -1,
|
|
3110
|
+
className: "flex max-h-[80vh] w-full min-w-0 max-w-xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-surface-elevated text-on-surface shadow-md outline-none",
|
|
3111
|
+
children: [
|
|
3112
|
+
/* @__PURE__ */ jsxs52("div", { className: "flex items-center gap-space-sm border-b border-border-subtle px-space-md", children: [
|
|
3113
|
+
/* @__PURE__ */ jsx69(Icon, { name: "search", tone: "muted" }),
|
|
3114
|
+
/* @__PURE__ */ jsx69(
|
|
3115
|
+
"input",
|
|
3116
|
+
{
|
|
3117
|
+
ref: inputRef,
|
|
3118
|
+
role: "combobox",
|
|
3119
|
+
"aria-label": label,
|
|
3120
|
+
"aria-expanded": "true",
|
|
3121
|
+
"aria-controls": listId,
|
|
3122
|
+
"aria-autocomplete": "list",
|
|
3123
|
+
"aria-activedescendant": active ? optionId(active.id) : void 0,
|
|
3124
|
+
value: query,
|
|
3125
|
+
placeholder,
|
|
3126
|
+
onChange: (e) => {
|
|
3127
|
+
onQueryChange(e.target.value);
|
|
3128
|
+
setActiveId(null);
|
|
3129
|
+
},
|
|
3130
|
+
onKeyDown,
|
|
3131
|
+
className: "h-12 min-w-0 flex-1 bg-transparent font-body-md text-body-md text-on-surface outline-none placeholder:text-on-surface-variant"
|
|
3132
|
+
}
|
|
3133
|
+
)
|
|
3134
|
+
] }),
|
|
3135
|
+
/* @__PURE__ */ jsxs52("div", { id: listId, role: "listbox", "aria-label": label, className: "min-h-0 flex-1 overflow-y-auto p-space-2xs", children: [
|
|
3136
|
+
flat.length === 0 && /* @__PURE__ */ jsx69("p", { className: "px-space-sm py-space-md text-center font-body-sm text-body-sm text-on-surface-variant", children: emptyText }),
|
|
3137
|
+
groups.map((g, gi) => /* @__PURE__ */ jsxs52("div", { role: "group", "aria-labelledby": `${base}-g${gi}`, children: [
|
|
3138
|
+
/* @__PURE__ */ jsx69("p", { id: `${base}-g${gi}`, className: "px-space-sm pb-space-2xs pt-space-sm font-label-mono text-label-mono uppercase text-on-surface-variant", children: g.label }),
|
|
3139
|
+
g.items.map((item) => {
|
|
3140
|
+
const isActive = item === active;
|
|
3141
|
+
return /* @__PURE__ */ jsxs52(
|
|
3142
|
+
"div",
|
|
3143
|
+
{
|
|
3144
|
+
id: optionId(item.id),
|
|
3145
|
+
role: "option",
|
|
3146
|
+
"aria-selected": isActive,
|
|
3147
|
+
onMouseMove: () => setActiveId(item.id),
|
|
3148
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
3149
|
+
onClick: () => select(item),
|
|
3150
|
+
className: cx("flex min-w-0 cursor-pointer items-center gap-space-sm rounded-lg px-space-sm py-space-xs font-body-md text-body-md max-md:min-h-11", isActive ? "bg-surface-muted text-ink" : "text-on-surface"),
|
|
3151
|
+
children: [
|
|
3152
|
+
item.icon && /* @__PURE__ */ jsx69(Icon, { name: item.icon, size: "sm", tone: "muted" }),
|
|
3153
|
+
/* @__PURE__ */ jsx69("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
3154
|
+
item.meta && /* @__PURE__ */ jsx69("span", { className: "shrink-0 font-label-mono text-label-mono text-on-surface-variant", children: item.meta })
|
|
3155
|
+
]
|
|
3156
|
+
},
|
|
3157
|
+
item.id
|
|
3158
|
+
);
|
|
3159
|
+
})
|
|
3160
|
+
] }, g.label))
|
|
3161
|
+
] })
|
|
3162
|
+
]
|
|
3163
|
+
}
|
|
3164
|
+
)
|
|
3165
|
+
}
|
|
3166
|
+
),
|
|
3167
|
+
document.body
|
|
3168
|
+
);
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
// src/primitives/Show.tsx
|
|
3172
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
3173
|
+
var ABOVE = { sm: "hidden sm:contents", md: "hidden md:contents", lg: "hidden lg:contents", xl: "hidden xl:contents", "2xl": "hidden 2xl:contents" };
|
|
3174
|
+
var BELOW = { sm: "contents sm:hidden", md: "contents md:hidden", lg: "contents lg:hidden", xl: "contents xl:hidden", "2xl": "contents 2xl:hidden" };
|
|
3175
|
+
function Show({ above, below, children, ...rest }) {
|
|
3176
|
+
return /* @__PURE__ */ jsx70("div", { ...rest, className: cx(above && ABOVE[above], below && BELOW[below]), children });
|
|
3177
|
+
}
|
|
1535
3178
|
export {
|
|
3179
|
+
AppBar,
|
|
1536
3180
|
Avatar,
|
|
3181
|
+
AvatarGroup,
|
|
1537
3182
|
Badge,
|
|
3183
|
+
BarChart,
|
|
1538
3184
|
Box,
|
|
1539
3185
|
Breadcrumbs,
|
|
1540
3186
|
Button,
|
|
1541
3187
|
Callout,
|
|
1542
3188
|
Card,
|
|
1543
3189
|
CardFooter,
|
|
3190
|
+
CardHeader,
|
|
1544
3191
|
CardMedia,
|
|
1545
3192
|
CheckList,
|
|
3193
|
+
Checkbox,
|
|
1546
3194
|
Chip,
|
|
1547
3195
|
Code,
|
|
1548
3196
|
CodeBlock,
|
|
3197
|
+
CommandPalette,
|
|
1549
3198
|
Container,
|
|
3199
|
+
CopyButton,
|
|
1550
3200
|
Countdown,
|
|
3201
|
+
DescriptionList,
|
|
1551
3202
|
Dialog,
|
|
3203
|
+
DiffViewer,
|
|
3204
|
+
Disclosure,
|
|
3205
|
+
Divider,
|
|
1552
3206
|
Dot,
|
|
3207
|
+
Drawer,
|
|
1553
3208
|
EditorTabs,
|
|
1554
3209
|
EmptyState,
|
|
1555
3210
|
Eyebrow,
|
|
1556
3211
|
FileTree,
|
|
1557
3212
|
Grid,
|
|
3213
|
+
GridItem,
|
|
1558
3214
|
Heading,
|
|
1559
3215
|
Icon,
|
|
1560
3216
|
IconButton,
|
|
3217
|
+
IconTile,
|
|
1561
3218
|
Kbd,
|
|
1562
3219
|
Markdown,
|
|
1563
3220
|
Menu,
|
|
1564
3221
|
Message,
|
|
1565
3222
|
MetricTile,
|
|
3223
|
+
NavList,
|
|
3224
|
+
Overlay,
|
|
3225
|
+
Pagination,
|
|
1566
3226
|
ProgressBar,
|
|
1567
3227
|
ResultRow,
|
|
1568
3228
|
Section,
|
|
1569
3229
|
SectionHeader,
|
|
1570
3230
|
SegmentedControl,
|
|
1571
3231
|
Select,
|
|
3232
|
+
Show,
|
|
3233
|
+
Skeleton,
|
|
1572
3234
|
Split,
|
|
1573
3235
|
Stack,
|
|
1574
3236
|
Stat,
|
|
1575
3237
|
StatusBar,
|
|
3238
|
+
Switch,
|
|
1576
3239
|
TabPanel,
|
|
3240
|
+
Table,
|
|
1577
3241
|
Tabs,
|
|
3242
|
+
TerminalOutput,
|
|
1578
3243
|
Text,
|
|
1579
3244
|
TextField,
|
|
3245
|
+
TextLink,
|
|
1580
3246
|
Theme,
|
|
3247
|
+
Timeline,
|
|
3248
|
+
Toaster,
|
|
3249
|
+
Tooltip,
|
|
3250
|
+
UmlClass,
|
|
3251
|
+
UmlDiagram,
|
|
3252
|
+
VerdictBanner,
|
|
1581
3253
|
Workbench,
|
|
1582
|
-
|
|
3254
|
+
describeDiagram,
|
|
3255
|
+
pageRange,
|
|
3256
|
+
useThemeTone,
|
|
3257
|
+
useToast
|
|
1583
3258
|
};
|
|
1584
3259
|
//# sourceMappingURL=index.js.map
|