@lmzhen/dsh-evolution-client-kit 0.51.1 → 0.52.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/lib/index.js CHANGED
@@ -311,6 +311,91 @@ const RESPONSIVE_TABLE_CSS = [
311
311
  "}"
312
312
  ].join(String.fromCharCode(10));
313
313
  //#endregion
314
+ //#region lib/types/data-table.js
315
+ /**
316
+ * One accessible, sortable table primitive for the family's read-only data pages.
317
+ *
318
+ * WHY IT LIVES HERE: the history panel, the stats page and later the queue views all need the same
319
+ * table semantics. A div grid would lose `<th>`, `aria-sort`, keyboard focus and screen-reader
320
+ * navigation; copying a second table implementation would let those rules drift.
321
+ *
322
+ * The component is controlled: the caller owns sort state and row actions. It renders no data logic.
323
+ * @module @lmzhen/dsh-evolution-client-kit
324
+ */
325
+ const SORT_MARK = {
326
+ none: "↕",
327
+ asc: "↑",
328
+ desc: "↓"
329
+ };
330
+ /**
331
+ * Render a semantic sortable table.
332
+ * @param props - rows, column definitions, controlled sort and empty state.
333
+ * @returns the table region.
334
+ */
335
+ function DataTable(props) {
336
+ const ariaSort = (column) => {
337
+ if (props.sort?.key !== column.key) return "none";
338
+ return props.sort.dir === "asc" ? "ascending" : "descending";
339
+ };
340
+ const head = createElement("thead", null, createElement("tr", null, props.columns.map((column) => {
341
+ const content = column.sortable === true ? createElement("button", {
342
+ type: "button",
343
+ className: "evo-data-sort",
344
+ onClick: () => {
345
+ props.onSort?.(column.key);
346
+ }
347
+ }, column.label, createElement("span", {
348
+ className: "evo-data-mark",
349
+ "aria-hidden": "true"
350
+ }, props.sort?.key === column.key ? SORT_MARK[props.sort.dir] : SORT_MARK.none)) : column.label;
351
+ return createElement("th", {
352
+ key: column.key,
353
+ scope: "col",
354
+ className: "evo-data-th" + (column.align === "right" ? " evo-data-num" : "") + (props.sort?.key === column.key ? " evo-data-th-active" : ""),
355
+ "aria-sort": column.sortable === true ? ariaSort(column) : void 0
356
+ }, content);
357
+ })));
358
+ const bodyRows = props.rows.map((row) => {
359
+ const cells = props.columns.map((column) => createElement("td", {
360
+ key: column.key,
361
+ className: "evo-data-td" + (column.align === "right" ? " evo-data-num" : "")
362
+ }, column.render(row)));
363
+ return createElement("tr", {
364
+ key: props.rowKey(row),
365
+ className: "evo-data-tr"
366
+ }, cells);
367
+ });
368
+ const body = createElement("tbody", null, props.rows.length === 0 ? createElement("tr", { className: "evo-data-empty-row" }, createElement("td", {
369
+ colSpan: props.columns.length,
370
+ className: "evo-data-empty"
371
+ }, props.empty)) : bodyRows);
372
+ return createElement("div", {
373
+ className: "evo-data-scroll" + (props.className === void 0 ? "" : " " + props.className),
374
+ tabIndex: 0,
375
+ role: "region",
376
+ "aria-label": props.caption
377
+ }, createElement("table", { className: "evo-data-table" }, createElement("caption", { className: "evo-data-caption" }, props.caption), head, body));
378
+ }
379
+ /** Styles for the primitive; the page owns token scope. */
380
+ const DATA_TABLE_CSS = [
381
+ ".evo-data-scroll{overflow:auto;max-width:100%;min-width:0;border-radius:var(--evo-radius-card,12px);outline:none}",
382
+ ".evo-data-scroll:focus-visible{outline:var(--evo-focus-ring,2px solid #2f6b58);outline-offset:var(--evo-focus-offset,2px)}",
383
+ ".evo-data-table{width:100%;border-collapse:separate;border-spacing:0;min-width:880px;font-size:var(--evo-type-sm,13px)}",
384
+ ".evo-data-caption{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}",
385
+ ".evo-data-th{position:sticky;top:0;z-index:2;padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2,#e5e2da);background:var(--dsw-alias-bg-layer-2,#faf9f5);color:var(--dsw-alias-label-tertiary,#9aa096);font-size:11px;font-weight:600;text-align:left;white-space:nowrap}",
386
+ ".evo-data-th-active{color:var(--evo-accent,#2f6b58);background:var(--evo-accent-weak,#f2f8f4)}",
387
+ ".evo-data-sort{display:inline-flex;align-items:center;gap:5px;border:0;background:transparent;color:inherit;font:inherit;font-weight:inherit;padding:0;cursor:pointer;border-radius:4px}",
388
+ ".evo-data-sort:focus-visible{outline:var(--evo-focus-ring,2px solid #2f6b58);outline-offset:2px}",
389
+ ".evo-data-mark{font-size:10px;opacity:.8}",
390
+ ".evo-data-tr:hover .evo-data-td{background:var(--dsw-alias-interactive-bg-hover,#fbfcf9)}",
391
+ ".evo-data-td{padding:10px;border-bottom:1px solid var(--dsw-alias-border-l1,#f0eee8);vertical-align:middle;min-width:0}",
392
+ ".evo-data-tr:last-child .evo-data-td{border-bottom:0}",
393
+ ".evo-data-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}",
394
+ ".evo-data-empty{padding:32px 16px;text-align:center;color:var(--dsw-alias-label-tertiary,#9aa096)}",
395
+ ".evo-data-empty-row:hover .evo-data-empty{background:transparent}",
396
+ "@media (max-width:720px){.evo-data-table{min-width:760px}}"
397
+ ].join("");
398
+ //#endregion
314
399
  //#region lib/types/presentation/action-menu.js
315
400
  /**
316
401
  * The one seam onto the platform's menu material, plus a small fallback for deployments
@@ -377,4 +462,4 @@ const PAGE_SURFACE_CLASS = "evolution-page-surface";
377
462
  /** Stylesheet for {@link PAGE_SURFACE_CLASS}; consumers append it to their own CSS. */
378
463
  const PAGE_SURFACE_CSS = ".evolution-page-surface{min-height:100%;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}";
379
464
  //#endregion
380
- export { Block, DecisionFrame, EmptyState, FALLBACKS, FailureBlock, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, PLATFORM_MENU, PLATFORM_UI_MODULE, RESPONSIVE_TABLE_CSS, ROUTES, TOKENS, TOKEN_CSS, TaskBanner, bindLocale, failureText, fillTemplate, formatLocalClock, formatLocalDateTime, injectPluginStyles, isSameLocalDay, loadStateOf, menuPrimitivesFrom, panelWorkspaceId, platformUiModule, registerSidebarPanel, registerSurface, registerWorkbenchView, renderPlatformMenu, requireClientSeats, tokenVars };
465
+ export { Block, DATA_TABLE_CSS, DataTable, DecisionFrame, EmptyState, FALLBACKS, FailureBlock, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, PLATFORM_MENU, PLATFORM_UI_MODULE, RESPONSIVE_TABLE_CSS, ROUTES, TOKENS, TOKEN_CSS, TaskBanner, bindLocale, failureText, fillTemplate, formatLocalClock, formatLocalDateTime, injectPluginStyles, isSameLocalDay, loadStateOf, menuPrimitivesFrom, panelWorkspaceId, platformUiModule, registerSidebarPanel, registerSurface, registerWorkbenchView, renderPlatformMenu, requireClientSeats, tokenVars };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * One accessible, sortable table primitive for the family's read-only data pages.
3
+ *
4
+ * WHY IT LIVES HERE: the history panel, the stats page and later the queue views all need the same
5
+ * table semantics. A div grid would lose `<th>`, `aria-sort`, keyboard focus and screen-reader
6
+ * navigation; copying a second table implementation would let those rules drift.
7
+ *
8
+ * The component is controlled: the caller owns sort state and row actions. It renders no data logic.
9
+ * @module @lmzhen/dsh-evolution-client-kit
10
+ */
11
+ import { type ReactNode } from 'react';
12
+ export type DataTableAlign = 'left' | 'right';
13
+ export interface DataTableSort {
14
+ readonly key: string;
15
+ readonly dir: 'asc' | 'desc';
16
+ }
17
+ export interface DataTableColumn<Row> {
18
+ readonly key: string;
19
+ readonly label: string;
20
+ readonly align?: DataTableAlign;
21
+ readonly sortable?: boolean;
22
+ /** The value sorted on; required for a sortable column. */
23
+ readonly sortValue?: (row: Row) => string | number | null;
24
+ readonly render: (row: Row) => ReactNode;
25
+ }
26
+ export interface DataTableProps<Row> {
27
+ readonly rows: readonly Row[];
28
+ readonly columns: readonly DataTableColumn<Row>[];
29
+ readonly rowKey: (row: Row) => string;
30
+ readonly sort?: DataTableSort | null;
31
+ readonly onSort?: (key: string) => void;
32
+ readonly empty?: ReactNode;
33
+ readonly caption: string;
34
+ readonly className?: string;
35
+ }
36
+ /**
37
+ * Render a semantic sortable table.
38
+ * @param props - rows, column definitions, controlled sort and empty state.
39
+ * @returns the table region.
40
+ */
41
+ export declare function DataTable<Row>(props: DataTableProps<Row>): ReactNode;
42
+ /** Styles for the primitive; the page owns token scope. */
43
+ export declare const DATA_TABLE_CSS: string;
44
+ //# sourceMappingURL=data-table.d.ts.map
@@ -0,0 +1,76 @@
1
+ /**
2
+ * One accessible, sortable table primitive for the family's read-only data pages.
3
+ *
4
+ * WHY IT LIVES HERE: the history panel, the stats page and later the queue views all need the same
5
+ * table semantics. A div grid would lose `<th>`, `aria-sort`, keyboard focus and screen-reader
6
+ * navigation; copying a second table implementation would let those rules drift.
7
+ *
8
+ * The component is controlled: the caller owns sort state and row actions. It renders no data logic.
9
+ * @module @lmzhen/dsh-evolution-client-kit
10
+ */
11
+ import { createElement } from 'react';
12
+ const SORT_MARK = { none: '↕', asc: '↑', desc: '↓' };
13
+ /**
14
+ * Render a semantic sortable table.
15
+ * @param props - rows, column definitions, controlled sort and empty state.
16
+ * @returns the table region.
17
+ */
18
+ export function DataTable(props) {
19
+ const ariaSort = (column) => {
20
+ if (props.sort?.key !== column.key)
21
+ return 'none';
22
+ return props.sort.dir === 'asc' ? 'ascending' : 'descending';
23
+ };
24
+ const headCells = props.columns.map(column => {
25
+ const content = column.sortable === true
26
+ ? createElement('button', {
27
+ type: 'button',
28
+ className: 'evo-data-sort',
29
+ onClick: () => { props.onSort?.(column.key); },
30
+ }, column.label, createElement('span', { className: 'evo-data-mark', 'aria-hidden': 'true' }, props.sort?.key === column.key ? SORT_MARK[props.sort.dir] : SORT_MARK.none))
31
+ : column.label;
32
+ return createElement('th', {
33
+ key: column.key,
34
+ scope: 'col',
35
+ className: 'evo-data-th' + (column.align === 'right' ? ' evo-data-num' : '') + (props.sort?.key === column.key ? ' evo-data-th-active' : ''),
36
+ 'aria-sort': column.sortable === true ? ariaSort(column) : undefined,
37
+ }, content);
38
+ });
39
+ const head = createElement('thead', null, createElement('tr', null, headCells));
40
+ const bodyRows = props.rows.map(row => {
41
+ const cells = props.columns.map(column => createElement('td', {
42
+ key: column.key,
43
+ className: 'evo-data-td' + (column.align === 'right' ? ' evo-data-num' : ''),
44
+ }, column.render(row)));
45
+ return createElement('tr', { key: props.rowKey(row), className: 'evo-data-tr' }, cells);
46
+ });
47
+ const body = createElement('tbody', null, props.rows.length === 0
48
+ ? createElement('tr', { className: 'evo-data-empty-row' }, createElement('td', { colSpan: props.columns.length, className: 'evo-data-empty' }, props.empty))
49
+ : bodyRows);
50
+ return createElement('div', {
51
+ className: 'evo-data-scroll' + (props.className === undefined ? '' : ' ' + props.className),
52
+ tabIndex: 0,
53
+ role: 'region',
54
+ 'aria-label': props.caption,
55
+ }, createElement('table', { className: 'evo-data-table' }, createElement('caption', { className: 'evo-data-caption' }, props.caption), head, body));
56
+ }
57
+ /** Styles for the primitive; the page owns token scope. */
58
+ export const DATA_TABLE_CSS = [
59
+ '.evo-data-scroll{overflow:auto;max-width:100%;min-width:0;border-radius:var(--evo-radius-card,12px);outline:none}',
60
+ '.evo-data-scroll:focus-visible{outline:var(--evo-focus-ring,2px solid #2f6b58);outline-offset:var(--evo-focus-offset,2px)}',
61
+ '.evo-data-table{width:100%;border-collapse:separate;border-spacing:0;min-width:880px;font-size:var(--evo-type-sm,13px)}',
62
+ '.evo-data-caption{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}',
63
+ '.evo-data-th{position:sticky;top:0;z-index:2;padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2,#e5e2da);background:var(--dsw-alias-bg-layer-2,#faf9f5);color:var(--dsw-alias-label-tertiary,#9aa096);font-size:11px;font-weight:600;text-align:left;white-space:nowrap}',
64
+ '.evo-data-th-active{color:var(--evo-accent,#2f6b58);background:var(--evo-accent-weak,#f2f8f4)}',
65
+ '.evo-data-sort{display:inline-flex;align-items:center;gap:5px;border:0;background:transparent;color:inherit;font:inherit;font-weight:inherit;padding:0;cursor:pointer;border-radius:4px}',
66
+ '.evo-data-sort:focus-visible{outline:var(--evo-focus-ring,2px solid #2f6b58);outline-offset:2px}',
67
+ '.evo-data-mark{font-size:10px;opacity:.8}',
68
+ '.evo-data-tr:hover .evo-data-td{background:var(--dsw-alias-interactive-bg-hover,#fbfcf9)}',
69
+ '.evo-data-td{padding:10px;border-bottom:1px solid var(--dsw-alias-border-l1,#f0eee8);vertical-align:middle;min-width:0}',
70
+ '.evo-data-tr:last-child .evo-data-td{border-bottom:0}',
71
+ '.evo-data-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}',
72
+ '.evo-data-empty{padding:32px 16px;text-align:center;color:var(--dsw-alias-label-tertiary,#9aa096)}',
73
+ '.evo-data-empty-row:hover .evo-data-empty{background:transparent}',
74
+ '@media (max-width:720px){.evo-data-table{min-width:760px}}',
75
+ ].join('');
76
+ //# sourceMappingURL=data-table.js.map
@@ -47,7 +47,6 @@ export declare const dictionaries: {
47
47
  readonly "line.unknown": "位置:未知";
48
48
  readonly loading: "读取中…";
49
49
  readonly "loading.failed": "读取失败——现在判断不了;点「刷新」重试。";
50
- readonly "proposal.copy": "复制命令";
51
50
  readonly "proposal.kept": "保留正文";
52
51
  readonly "proposal.outcome.extract": "提取";
53
52
  readonly "proposal.outcome.keep": "保持";
@@ -136,7 +135,6 @@ export declare const dictionaries: {
136
135
  readonly "line.unknown": "Location: unknown";
137
136
  readonly loading: "Loading…";
138
137
  readonly "loading.failed": "Couldn't load, so there's no verdict right now. Hit Refresh to retry.";
139
- readonly "proposal.copy": "Copy command";
140
138
  readonly "proposal.kept": "Body kept";
141
139
  readonly "proposal.outcome.extract": "Extract";
142
140
  readonly "proposal.outcome.keep": "Keep";
@@ -225,7 +223,6 @@ export declare const dictionaries: {
225
223
  readonly "line.unknown": "位置:不明";
226
224
  readonly loading: "読み取り中…";
227
225
  readonly "loading.failed": "読み取りに失敗したため、今は判断できません。「更新」を押して再試行してください。";
228
- readonly "proposal.copy": "コマンドをコピー";
229
226
  readonly "proposal.kept": "残す本文";
230
227
  readonly "proposal.outcome.extract": "抽出";
231
228
  readonly "proposal.outcome.keep": "維持";
@@ -314,7 +311,6 @@ export declare const dictionaries: {
314
311
  readonly "line.unknown": "línea: DESCONOCIDA";
315
312
  readonly loading: "Cargando…";
316
313
  readonly "loading.failed": "La lectura falló: ahora mismo no se puede juzgar; pulsa «Actualizar» para reintentar.";
317
- readonly "proposal.copy": "Copiar comando";
318
314
  readonly "proposal.kept": "cuerpo conservado";
319
315
  readonly "proposal.outcome.extract": "extraer";
320
316
  readonly "proposal.outcome.keep": "conservar";
@@ -403,7 +399,6 @@ export declare const dictionaries: {
403
399
  readonly "line.unknown": "ligne : inconnue";
404
400
  readonly loading: "Chargement…";
405
401
  readonly "loading.failed": "Lecture échouée : impossible de juger pour l’instant ; cliquez sur « Actualiser » pour réessayer.";
406
- readonly "proposal.copy": "Copier la commande";
407
402
  readonly "proposal.kept": "texte conservé";
408
403
  readonly "proposal.outcome.extract": "extraction";
409
404
  readonly "proposal.outcome.keep": "conservation";
@@ -492,7 +487,6 @@ export declare const dictionaries: {
492
487
  readonly "line.unknown": "Zeile: unbekannt";
493
488
  readonly loading: "Wird gelesen…";
494
489
  readonly "loading.failed": "Lesen fehlgeschlagen – eine Aussage ist gerade nicht möglich; „Aktualisieren“ versucht es erneut.";
495
- readonly "proposal.copy": "Befehl kopieren";
496
490
  readonly "proposal.kept": "behaltener Text";
497
491
  readonly "proposal.outcome.extract": "extrahieren";
498
492
  readonly "proposal.outcome.keep": "behalten";
@@ -581,7 +575,6 @@ export declare const dictionaries: {
581
575
  readonly "line.unknown": "Позиция: неизвестно";
582
576
  readonly loading: "Читаем…";
583
577
  readonly "loading.failed": "Не удалось прочитать — сейчас судить нельзя; нажмите «Обновить» и повторите.";
584
- readonly "proposal.copy": "Скопировать команду";
585
578
  readonly "proposal.kept": "оставленный текст";
586
579
  readonly "proposal.outcome.extract": "извлечение";
587
580
  readonly "proposal.outcome.keep": "оставить";
@@ -670,7 +663,6 @@ export declare const dictionaries: {
670
663
  readonly "line.unknown": "local: desconhecido";
671
664
  readonly loading: "carregando…";
672
665
  readonly "loading.failed": "A leitura falhou — não é possível avaliar agora; clique em Atualizar para tentar novamente.";
673
- readonly "proposal.copy": "Copiar comando";
674
666
  readonly "proposal.kept": "corpo mantido";
675
667
  readonly "proposal.outcome.extract": "extrair";
676
668
  readonly "proposal.outcome.keep": "manter";
@@ -48,7 +48,6 @@ export const dictionaries = {
48
48
  "line.unknown": "位置:未知",
49
49
  "loading": "读取中…",
50
50
  "loading.failed": "读取失败——现在判断不了;点「刷新」重试。",
51
- "proposal.copy": "复制命令",
52
51
  "proposal.kept": "保留正文",
53
52
  "proposal.outcome.extract": "提取",
54
53
  "proposal.outcome.keep": "保持",
@@ -137,7 +136,6 @@ export const dictionaries = {
137
136
  "line.unknown": "Location: unknown",
138
137
  "loading": "Loading…",
139
138
  "loading.failed": "Couldn't load, so there's no verdict right now. Hit Refresh to retry.",
140
- "proposal.copy": "Copy command",
141
139
  "proposal.kept": "Body kept",
142
140
  "proposal.outcome.extract": "Extract",
143
141
  "proposal.outcome.keep": "Keep",
@@ -226,7 +224,6 @@ export const dictionaries = {
226
224
  "line.unknown": "位置:不明",
227
225
  "loading": "読み取り中…",
228
226
  "loading.failed": "読み取りに失敗したため、今は判断できません。「更新」を押して再試行してください。",
229
- "proposal.copy": "コマンドをコピー",
230
227
  "proposal.kept": "残す本文",
231
228
  "proposal.outcome.extract": "抽出",
232
229
  "proposal.outcome.keep": "維持",
@@ -315,7 +312,6 @@ export const dictionaries = {
315
312
  "line.unknown": "línea: DESCONOCIDA",
316
313
  "loading": "Cargando…",
317
314
  "loading.failed": "La lectura falló: ahora mismo no se puede juzgar; pulsa «Actualizar» para reintentar.",
318
- "proposal.copy": "Copiar comando",
319
315
  "proposal.kept": "cuerpo conservado",
320
316
  "proposal.outcome.extract": "extraer",
321
317
  "proposal.outcome.keep": "conservar",
@@ -404,7 +400,6 @@ export const dictionaries = {
404
400
  "line.unknown": "ligne : inconnue",
405
401
  "loading": "Chargement…",
406
402
  "loading.failed": "Lecture échouée : impossible de juger pour l’instant ; cliquez sur « Actualiser » pour réessayer.",
407
- "proposal.copy": "Copier la commande",
408
403
  "proposal.kept": "texte conservé",
409
404
  "proposal.outcome.extract": "extraction",
410
405
  "proposal.outcome.keep": "conservation",
@@ -493,7 +488,6 @@ export const dictionaries = {
493
488
  "line.unknown": "Zeile: unbekannt",
494
489
  "loading": "Wird gelesen…",
495
490
  "loading.failed": "Lesen fehlgeschlagen – eine Aussage ist gerade nicht möglich; „Aktualisieren“ versucht es erneut.",
496
- "proposal.copy": "Befehl kopieren",
497
491
  "proposal.kept": "behaltener Text",
498
492
  "proposal.outcome.extract": "extrahieren",
499
493
  "proposal.outcome.keep": "behalten",
@@ -582,7 +576,6 @@ export const dictionaries = {
582
576
  "line.unknown": "Позиция: неизвестно",
583
577
  "loading": "Читаем…",
584
578
  "loading.failed": "Не удалось прочитать — сейчас судить нельзя; нажмите «Обновить» и повторите.",
585
- "proposal.copy": "Скопировать команду",
586
579
  "proposal.kept": "оставленный текст",
587
580
  "proposal.outcome.extract": "извлечение",
588
581
  "proposal.outcome.keep": "оставить",
@@ -671,7 +664,6 @@ export const dictionaries = {
671
664
  "line.unknown": "local: desconhecido",
672
665
  "loading": "carregando…",
673
666
  "loading.failed": "A leitura falhou — não é possível avaliar agora; clique em Atualizar para tentar novamente.",
674
- "proposal.copy": "Copiar comando",
675
667
  "proposal.kept": "corpo mantido",
676
668
  "proposal.outcome.extract": "extrair",
677
669
  "proposal.outcome.keep": "manter",