@lmzhen/dsh-evolution-client-kit 0.35.0 → 0.36.1

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
@@ -3,7 +3,11 @@ import { FALLBACKS } from "./generated/fallbacks.generated.js";
3
3
  import "./generated/contracts.generated.js";
4
4
  import { Block, FailureBlock, failureText, loadStateOf } from "./generated/states.generated.js";
5
5
  import { TOKENS, TOKEN_CSS, tokenVars } from "./tokens.js";
6
+ import { createRequire } from "node:module";
6
7
  import { createElement, useState } from "react";
8
+ //#region \0rolldown/runtime.js
9
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
10
+ //#endregion
7
11
  //#region lib/types/panel.js
8
12
  function interpolate(text, values) {
9
13
  if (values === void 0) return text;
@@ -438,6 +442,216 @@ function StateNotice({ tone, text, count, className }) {
438
442
  }, createElement("span", { "data-role": "state-notice-text" }, text), count === void 0 ? null : createElement("span", { "data-role": "state-notice-count" }, String(count)));
439
443
  }
440
444
  //#endregion
445
+ //#region lib/types/presentation/decision-frame.js
446
+ /** One decision card: title, facts, at most one primary, secondary actions and details. */
447
+ function actionButton$1(action, role) {
448
+ return createElement("button", {
449
+ key: action.id,
450
+ type: "button",
451
+ "data-role": role === "primary" ? "decision-primary" : "decision-secondary",
452
+ "data-action": action.id,
453
+ "aria-busy": action.busy === true ? "true" : void 0,
454
+ ...action.attributes ?? {},
455
+ disabled: action.disabled === true || action.busy === true,
456
+ title: action.title ?? action.label,
457
+ onClick: () => {
458
+ if (action.disabled !== true && action.busy !== true) action.onSelect();
459
+ }
460
+ }, action.label);
461
+ }
462
+ /**
463
+ * Render the one-card decision surface. The model has a singular primary on purpose.
464
+ * @param props - decision model and optional surface class.
465
+ * @returns the decision frame.
466
+ */
467
+ function DecisionFrame({ decision, className }) {
468
+ const secondary = decision.secondary ?? [];
469
+ return createElement("section", {
470
+ "data-role": "decision-frame",
471
+ ...className === void 0 ? {} : { className }
472
+ }, createElement("h2", { "data-role": "decision-title" }, decision.title), decision.summary === void 0 || decision.summary === "" ? null : createElement("p", { "data-role": "decision-summary" }, decision.summary), decision.facts.length === 0 ? null : createElement("dl", { "data-role": "decision-facts" }, decision.facts.map((fact) => createElement("div", {
473
+ key: fact.label,
474
+ "data-role": "decision-fact"
475
+ }, createElement("dt", null, fact.label), createElement("dd", null, fact.value)))), decision.details === void 0 ? null : createElement("div", { "data-role": "decision-details" }, decision.details), decision.primary === void 0 && secondary.length === 0 ? null : createElement("div", { "data-role": "decision-actions" }, decision.primary === void 0 ? null : actionButton$1(decision.primary, "primary"), secondary.map((action) => actionButton$1(action, "secondary"))));
476
+ }
477
+ //#endregion
478
+ //#region lib/types/presentation/task-banner.js
479
+ /** A read-only task hint; it deliberately has no primary action. */
480
+ /**
481
+ * Render a task count plus one sentence. The absence of an action prop is the contract.
482
+ * @param props - count, sentence and optional surface class.
483
+ * @returns the banner.
484
+ */
485
+ function TaskBanner({ count, text, className }) {
486
+ return createElement("div", {
487
+ "data-role": "task-banner",
488
+ "data-count": String(count),
489
+ role: "status",
490
+ ...className === void 0 ? {} : { className }
491
+ }, createElement("strong", { "data-role": "task-banner-count" }, String(count)), createElement("span", { "data-role": "task-banner-text" }, text));
492
+ }
493
+ //#endregion
494
+ //#region lib/types/presentation/chips.js
495
+ /** Read-only status chips and toggleable filter chips. */
496
+ /** Render one semantic status word. */
497
+ function StatusChip({ label, tone = "neutral", className }) {
498
+ return createElement("span", {
499
+ "data-role": "status-chip",
500
+ "data-tone": tone,
501
+ ...className === void 0 ? {} : { className }
502
+ }, label);
503
+ }
504
+ /** Render a toggleable filter with the pressed state exposed to assistive tech. */
505
+ function FilterChip({ label, active, onClick, count, disabled = false, className }) {
506
+ return createElement("button", {
507
+ type: "button",
508
+ "data-role": "filter-chip",
509
+ "data-active": active ? "true" : "false",
510
+ "aria-pressed": active ? "true" : "false",
511
+ disabled,
512
+ ...className === void 0 ? {} : { className },
513
+ onClick: () => {
514
+ if (!disabled) onClick();
515
+ }
516
+ }, createElement("span", { "data-role": "filter-chip-label" }, label), count === void 0 ? null : createElement("span", { "data-role": "filter-chip-count" }, String(count)));
517
+ }
518
+ //#endregion
519
+ //#region lib/types/presentation/empty-state.js
520
+ /** A compact completed/empty state with at most one primary next step. */
521
+ function actionButton(action, role) {
522
+ return createElement("button", {
523
+ key: action.id,
524
+ type: "button",
525
+ "data-role": role === "primary" ? "empty-primary" : "empty-secondary",
526
+ "data-action": action.id,
527
+ ...action.attributes ?? {},
528
+ disabled: action.disabled === true || action.busy === true,
529
+ title: action.title ?? action.label,
530
+ onClick: () => {
531
+ if (action.disabled !== true && action.busy !== true) action.onSelect();
532
+ }
533
+ }, action.label);
534
+ }
535
+ /** Render a quiet empty state; loading/failure remain the caller's separate states. */
536
+ function EmptyState({ title, description, tone = "neutral", primary, secondary, className }) {
537
+ const actions = primary === void 0 && secondary === void 0 ? null : createElement("div", { "data-role": "empty-actions" }, primary === void 0 ? null : actionButton(primary, "primary"), secondary === void 0 ? null : actionButton(secondary, "secondary"));
538
+ return createElement("section", {
539
+ "data-role": "empty-state",
540
+ "data-tone": tone,
541
+ ...className === void 0 ? {} : { className }
542
+ }, createElement("h2", { "data-role": "empty-title" }, title), description === void 0 || description === "" ? null : createElement("p", { "data-role": "empty-description" }, description), actions);
543
+ }
544
+ //#endregion
545
+ //#region lib/types/presentation/disclosure-group.js
546
+ /** A native details group for normal/secondary facts. */
547
+ /** Render a closed-by-default disclosure without introducing another accordion model. */
548
+ function DisclosureGroup({ summary, count, children, defaultOpen = false, className }) {
549
+ return createElement("details", {
550
+ "data-role": "disclosure-group",
551
+ ...defaultOpen ? { open: true } : {},
552
+ ...className === void 0 ? {} : { className }
553
+ }, createElement("summary", { "data-role": "disclosure-summary" }, createElement("span", { "data-role": "disclosure-title" }, summary), count === void 0 ? null : createElement("span", { "data-role": "disclosure-count" }, String(count))), createElement("div", { "data-role": "disclosure-content" }, children));
554
+ }
555
+ //#endregion
556
+ //#region lib/types/presentation/time-text.js
557
+ /** The one local-time presentation used by reading surfaces. */
558
+ /**
559
+ * Render a local wall time, or a neutral dash when the fact is unknown.
560
+ * @param props - ISO/epoch value and seconds preference.
561
+ * @returns a time element with the raw value in dateTime when valid.
562
+ */
563
+ function TimeText({ value, seconds = true, className }) {
564
+ const text = formatLocalDateTime(value, { seconds });
565
+ const ms = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : NaN;
566
+ const raw = Number.isFinite(ms) ? new Date(ms).toISOString() : void 0;
567
+ return createElement("time", {
568
+ "data-role": "time-text",
569
+ ...raw === void 0 ? {} : { dateTime: raw },
570
+ ...text === null ? {} : { title: text },
571
+ ...className === void 0 ? {} : { className }
572
+ }, text ?? "—");
573
+ }
574
+ //#endregion
575
+ //#region lib/types/presentation/action-menu.js
576
+ /**
577
+ * The one seam onto the platform's menu material, plus a small fallback for deployments
578
+ * without the primitive row. No page owns a second menu implementation.
579
+ */
580
+ const PLATFORM_UI_MODULE = "@deepseek-ai/dsh-client-ui-primitives";
581
+ /**
582
+ * Render the coordinate/action menu through the platform primitives, or a plain fallback.
583
+ * @param props - rows, accessible label, position/style and optional primitive override.
584
+ * @returns the menu element.
585
+ */
586
+ function ActionMenu({ actions, label, style, className, primitives = PLATFORM_MENU }) {
587
+ if (primitives !== void 0) return renderPlatformMenu(primitives, actions, label, style ?? {}, className);
588
+ return createElement("div", {
589
+ "data-role": "action-menu-fallback",
590
+ role: "menu",
591
+ "aria-label": label,
592
+ ...style === void 0 ? {} : { style },
593
+ ...className === void 0 ? {} : { className }
594
+ }, actions.map((action) => createElement("button", {
595
+ key: action.id,
596
+ type: "button",
597
+ role: "menuitem",
598
+ disabled: action.disabled === true,
599
+ "data-danger": action.danger === true ? "true" : "false",
600
+ ...action.separatorBefore === true ? { "data-separator-before": "true" } : {},
601
+ onClick: () => {
602
+ if (action.disabled !== true) action.onSelect();
603
+ }
604
+ }, action.label)));
605
+ }
606
+ /**
607
+ * Render the platform menu directly. Kept exported for callers that already own the primitive row.
608
+ * @param primitives - platform MenuSurface/MenuItemButton pair.
609
+ * @param actions - rows in display order.
610
+ * @param label - accessible menu name.
611
+ * @param style - fixed position computed from the pointer.
612
+ * @param className - optional surface class.
613
+ * @returns the menu element.
614
+ */
615
+ function renderPlatformMenu(primitives, actions, label, style, className) {
616
+ return createElement(primitives.MenuSurface, {
617
+ "data-role": "action-menu",
618
+ "data-platform": "true",
619
+ role: "menu",
620
+ "aria-label": label,
621
+ ...className === void 0 ? {} : { className },
622
+ style
623
+ }, actions.map((action) => createElement(primitives.MenuItemButton, {
624
+ key: action.id,
625
+ children: action.label,
626
+ ...action.separatorBefore === true ? { separatorBefore: true } : {},
627
+ ...action.disabled === true ? { disabled: true } : {},
628
+ ...action.danger === true ? { danger: true } : {},
629
+ onSelect: action.onSelect
630
+ })));
631
+ }
632
+ /**
633
+ * Accept only the two component functions; a namespace row without them is not a menu.
634
+ * @param row - the module row's exports.
635
+ * @returns the two components, or undefined.
636
+ */
637
+ function menuPrimitivesFrom(row) {
638
+ const surface = row.MenuSurface;
639
+ const item = row.MenuItemButton;
640
+ if (typeof surface !== "function" || typeof item !== "function") return void 0;
641
+ return {
642
+ MenuSurface: surface,
643
+ MenuItemButton: item
644
+ };
645
+ }
646
+ /** The module-table row, when this deployment carries it. */
647
+ const PLATFORM_MENU = (() => {
648
+ try {
649
+ return menuPrimitivesFrom(__require(PLATFORM_UI_MODULE));
650
+ } catch {
651
+ return;
652
+ }
653
+ })();
654
+ //#endregion
441
655
  //#region lib/types/action.js
442
656
  /**
443
657
  * Command-only actions. Approval decisions are a separate host API and must never
@@ -555,4 +769,4 @@ function createSettingsGatewayCache(binder, api) {
555
769
  };
556
770
  }
557
771
  //#endregion
558
- export { AsyncResource, Block, CommandCopyButton, FALLBACKS, FailureBlock, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, ROUTES, StateNotice, TOKENS, TOKEN_CSS, copyAction, createSettingsGatewayCache, createSettingsSeat, failureText, formatLocalDateTime, loadStateOf, panelWorkspaceId, registerSidebarPanel, registerWorkbenchView, saveSettings, tokenVars };
772
+ export { ActionMenu, AsyncResource, Block, CommandCopyButton, DecisionFrame, DisclosureGroup, EmptyState, FALLBACKS, FailureBlock, FilterChip, PAGE_SURFACE_CLASS, PAGE_SURFACE_CSS, PLATFORM_MENU, ROUTES, StateNotice, StatusChip, TOKENS, TOKEN_CSS, TaskBanner, TimeText, copyAction, createSettingsGatewayCache, createSettingsSeat, failureText, formatLocalDateTime, loadStateOf, menuPrimitivesFrom, panelWorkspaceId, registerSidebarPanel, registerWorkbenchView, renderPlatformMenu, saveSettings, tokenVars };
@@ -8,6 +8,14 @@ export { panelWorkspaceId } from './workspace.ts';
8
8
  export { AsyncResource } from './async-resource.ts';
9
9
  export { formatLocalDateTime, type LocalDateTimeOptions } from './format.ts';
10
10
  export { StateNotice, type StateNoticeProps, type StateNoticeTone } from './notice.ts';
11
+ export { DecisionFrame, type DecisionFrameProps } from './presentation/decision-frame.ts';
12
+ export { TaskBanner, type TaskBannerProps } from './presentation/task-banner.ts';
13
+ export { StatusChip, FilterChip, type StatusChipProps, type FilterChipProps } from './presentation/chips.ts';
14
+ export { EmptyState, type EmptyStateProps } from './presentation/empty-state.ts';
15
+ export { DisclosureGroup, type DisclosureGroupProps } from './presentation/disclosure-group.ts';
16
+ export { TimeText, type TimeTextProps } from './presentation/time-text.ts';
17
+ export { ActionMenu, PLATFORM_MENU, renderPlatformMenu, menuPrimitivesFrom, type ActionMenuProps, type RowMenuAction, type MenuPrimitives, type MenuSurfaceComponent, type MenuItemButtonComponent } from './presentation/action-menu.ts';
18
+ export type { PresentationTone, PresentationAction, DecisionFact, DecisionModel } from './presentation/types.ts';
11
19
  export { CommandCopyButton, copyAction } from './action.ts';
12
20
  export type { ActionRef, CommandCopyButtonProps, CommandCopyLabels, CopyStatus } from './action.ts';
13
21
  export type { AsyncLoader, AsyncState, AsyncStatus } from './async-resource.ts';
@@ -5,6 +5,13 @@ export { panelWorkspaceId } from "./workspace.js";
5
5
  export { AsyncResource } from "./async-resource.js";
6
6
  export { formatLocalDateTime } from "./format.js";
7
7
  export { StateNotice } from "./notice.js";
8
+ export { DecisionFrame } from "./presentation/decision-frame.js";
9
+ export { TaskBanner } from "./presentation/task-banner.js";
10
+ export { StatusChip, FilterChip } from "./presentation/chips.js";
11
+ export { EmptyState } from "./presentation/empty-state.js";
12
+ export { DisclosureGroup } from "./presentation/disclosure-group.js";
13
+ export { TimeText } from "./presentation/time-text.js";
14
+ export { ActionMenu, PLATFORM_MENU, renderPlatformMenu, menuPrimitivesFrom } from "./presentation/action-menu.js";
8
15
  export { CommandCopyButton, copyAction } from "./action.js";
9
16
  export { ROUTES } from "./generated/routes.generated.js";
10
17
  export { FALLBACKS } from "./generated/fallbacks.generated.js";
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The one seam onto the platform's menu material, plus a small fallback for deployments
3
+ * without the primitive row. No page owns a second menu implementation.
4
+ */
5
+ import { type ReactNode } from 'react';
6
+ /** The platform's menu surface: a styled container that accepts div props. */
7
+ export type MenuSurfaceComponent = (props: Record<string, unknown> & {
8
+ children?: ReactNode;
9
+ }) => ReactNode;
10
+ /** The platform's menu row: role=menuitem plus selected/disabled/danger semantics. */
11
+ export type MenuItemButtonComponent = (props: {
12
+ children: ReactNode;
13
+ current?: boolean;
14
+ disabled?: boolean;
15
+ danger?: boolean;
16
+ separatorBefore?: boolean;
17
+ onSelect: () => void;
18
+ }) => ReactNode;
19
+ /** The two components this family consumes from one platform module row. */
20
+ export interface MenuPrimitives {
21
+ MenuSurface: MenuSurfaceComponent;
22
+ MenuItemButton: MenuItemButtonComponent;
23
+ }
24
+ /** One row of the coordinate/action menu, independent of the renderer. */
25
+ export interface RowMenuAction {
26
+ readonly id: string;
27
+ readonly label: string;
28
+ readonly onSelect: () => void;
29
+ readonly separatorBefore?: boolean | undefined;
30
+ readonly disabled?: boolean | undefined;
31
+ readonly danger?: boolean | undefined;
32
+ }
33
+ /** Props for the shared action menu. */
34
+ export interface ActionMenuProps {
35
+ readonly actions: readonly RowMenuAction[];
36
+ readonly label: string;
37
+ readonly style?: Record<string, string | number> | undefined;
38
+ readonly className?: string | undefined;
39
+ readonly primitives?: MenuPrimitives | undefined;
40
+ }
41
+ /**
42
+ * Render the coordinate/action menu through the platform primitives, or a plain fallback.
43
+ * @param props - rows, accessible label, position/style and optional primitive override.
44
+ * @returns the menu element.
45
+ */
46
+ export declare function ActionMenu({ actions, label, style, className, primitives }: ActionMenuProps): ReactNode;
47
+ /**
48
+ * Render the platform menu directly. Kept exported for callers that already own the primitive row.
49
+ * @param primitives - platform MenuSurface/MenuItemButton pair.
50
+ * @param actions - rows in display order.
51
+ * @param label - accessible menu name.
52
+ * @param style - fixed position computed from the pointer.
53
+ * @param className - optional surface class.
54
+ * @returns the menu element.
55
+ */
56
+ export declare function renderPlatformMenu(primitives: MenuPrimitives, actions: readonly RowMenuAction[], label: string, style: Record<string, string | number>, className?: string | undefined): ReactNode;
57
+ /**
58
+ * Accept only the two component functions; a namespace row without them is not a menu.
59
+ * @param row - the module row's exports.
60
+ * @returns the two components, or undefined.
61
+ */
62
+ export declare function menuPrimitivesFrom(row: Record<string, unknown>): MenuPrimitives | undefined;
63
+ /** The module-table row, when this deployment carries it. */
64
+ export declare const PLATFORM_MENU: MenuPrimitives | undefined;
65
+ //# sourceMappingURL=action-menu.d.ts.map
@@ -0,0 +1,77 @@
1
+ /**
2
+ * The one seam onto the platform's menu material, plus a small fallback for deployments
3
+ * without the primitive row. No page owns a second menu implementation.
4
+ */
5
+ import { createElement } from 'react';
6
+ const PLATFORM_UI_MODULE = '@deepseek-ai/dsh-client-ui-primitives';
7
+ /**
8
+ * Render the coordinate/action menu through the platform primitives, or a plain fallback.
9
+ * @param props - rows, accessible label, position/style and optional primitive override.
10
+ * @returns the menu element.
11
+ */
12
+ export function ActionMenu({ actions, label, style, className, primitives = PLATFORM_MENU }) {
13
+ if (primitives !== undefined)
14
+ return renderPlatformMenu(primitives, actions, label, style ?? {}, className);
15
+ return createElement('div', {
16
+ 'data-role': 'action-menu-fallback',
17
+ role: 'menu',
18
+ 'aria-label': label,
19
+ ...(style === undefined ? {} : { style }),
20
+ ...(className === undefined ? {} : { className }),
21
+ }, actions.map(action => createElement('button', {
22
+ key: action.id,
23
+ type: 'button',
24
+ role: 'menuitem',
25
+ disabled: action.disabled === true,
26
+ 'data-danger': action.danger === true ? 'true' : 'false',
27
+ ...(action.separatorBefore === true ? { 'data-separator-before': 'true' } : {}),
28
+ onClick: () => { if (action.disabled !== true)
29
+ action.onSelect(); },
30
+ }, action.label)));
31
+ }
32
+ /**
33
+ * Render the platform menu directly. Kept exported for callers that already own the primitive row.
34
+ * @param primitives - platform MenuSurface/MenuItemButton pair.
35
+ * @param actions - rows in display order.
36
+ * @param label - accessible menu name.
37
+ * @param style - fixed position computed from the pointer.
38
+ * @param className - optional surface class.
39
+ * @returns the menu element.
40
+ */
41
+ export function renderPlatformMenu(primitives, actions, label, style, className) {
42
+ return createElement(primitives.MenuSurface, {
43
+ 'data-role': 'action-menu', 'data-platform': 'true', role: 'menu', 'aria-label': label,
44
+ ...(className === undefined ? {} : { className }),
45
+ style,
46
+ }, actions.map(action => createElement(primitives.MenuItemButton, {
47
+ key: action.id,
48
+ children: action.label,
49
+ ...(action.separatorBefore === true ? { separatorBefore: true } : {}),
50
+ ...(action.disabled === true ? { disabled: true } : {}),
51
+ ...(action.danger === true ? { danger: true } : {}),
52
+ onSelect: action.onSelect,
53
+ })));
54
+ }
55
+ /**
56
+ * Accept only the two component functions; a namespace row without them is not a menu.
57
+ * @param row - the module row's exports.
58
+ * @returns the two components, or undefined.
59
+ */
60
+ export function menuPrimitivesFrom(row) {
61
+ const surface = row.MenuSurface;
62
+ const item = row.MenuItemButton;
63
+ if (typeof surface !== 'function' || typeof item !== 'function')
64
+ return undefined;
65
+ return { MenuSurface: surface, MenuItemButton: item };
66
+ }
67
+ /** The module-table row, when this deployment carries it. */
68
+ export const PLATFORM_MENU = (() => {
69
+ try {
70
+ // oxlint-disable-next-line typescript/no-require-imports -- the client module table is reachable only through the loader's require
71
+ return menuPrimitivesFrom(require(PLATFORM_UI_MODULE));
72
+ }
73
+ catch {
74
+ return undefined;
75
+ }
76
+ })();
77
+ //# sourceMappingURL=action-menu.js.map
@@ -0,0 +1,23 @@
1
+ /** Read-only status chips and toggleable filter chips. */
2
+ import { type ReactNode } from 'react';
3
+ import type { PresentationTone } from './types.ts';
4
+ /** Props for one non-interactive status chip. */
5
+ export interface StatusChipProps {
6
+ readonly label: string;
7
+ readonly tone?: PresentationTone | undefined;
8
+ readonly className?: string | undefined;
9
+ }
10
+ /** Render one semantic status word. */
11
+ export declare function StatusChip({ label, tone, className }: StatusChipProps): ReactNode;
12
+ /** Props for a filter chip that only changes the visible list. */
13
+ export interface FilterChipProps {
14
+ readonly label: string;
15
+ readonly active: boolean;
16
+ readonly onClick: () => void;
17
+ readonly count?: number | undefined;
18
+ readonly disabled?: boolean | undefined;
19
+ readonly className?: string | undefined;
20
+ }
21
+ /** Render a toggleable filter with the pressed state exposed to assistive tech. */
22
+ export declare function FilterChip({ label, active, onClick, count, disabled, className }: FilterChipProps): ReactNode;
23
+ //# sourceMappingURL=chips.d.ts.map
@@ -0,0 +1,24 @@
1
+ /** Read-only status chips and toggleable filter chips. */
2
+ import { createElement } from 'react';
3
+ /** Render one semantic status word. */
4
+ export function StatusChip({ label, tone = 'neutral', className }) {
5
+ return createElement('span', {
6
+ 'data-role': 'status-chip',
7
+ 'data-tone': tone,
8
+ ...(className === undefined ? {} : { className }),
9
+ }, label);
10
+ }
11
+ /** Render a toggleable filter with the pressed state exposed to assistive tech. */
12
+ export function FilterChip({ label, active, onClick, count, disabled = false, className }) {
13
+ return createElement('button', {
14
+ type: 'button',
15
+ 'data-role': 'filter-chip',
16
+ 'data-active': active ? 'true' : 'false',
17
+ 'aria-pressed': active ? 'true' : 'false',
18
+ disabled,
19
+ ...(className === undefined ? {} : { className }),
20
+ onClick: () => { if (!disabled)
21
+ onClick(); },
22
+ }, createElement('span', { 'data-role': 'filter-chip-label' }, label), count === undefined ? null : createElement('span', { 'data-role': 'filter-chip-count' }, String(count)));
23
+ }
24
+ //# sourceMappingURL=chips.js.map
@@ -0,0 +1,15 @@
1
+ /** One decision card: title, facts, at most one primary, secondary actions and details. */
2
+ import { type ReactNode } from 'react';
3
+ import type { DecisionModel } from './types.ts';
4
+ /** Props for the shared decision frame. */
5
+ export interface DecisionFrameProps {
6
+ readonly decision: DecisionModel;
7
+ readonly className?: string | undefined;
8
+ }
9
+ /**
10
+ * Render the one-card decision surface. The model has a singular primary on purpose.
11
+ * @param props - decision model and optional surface class.
12
+ * @returns the decision frame.
13
+ */
14
+ export declare function DecisionFrame({ decision, className }: DecisionFrameProps): ReactNode;
15
+ //# sourceMappingURL=decision-frame.d.ts.map
@@ -0,0 +1,29 @@
1
+ /** One decision card: title, facts, at most one primary, secondary actions and details. */
2
+ import { createElement } from 'react';
3
+ function actionButton(action, role) {
4
+ return createElement('button', {
5
+ key: action.id,
6
+ type: 'button',
7
+ 'data-role': role === 'primary' ? 'decision-primary' : 'decision-secondary',
8
+ 'data-action': action.id,
9
+ 'aria-busy': action.busy === true ? 'true' : undefined,
10
+ ...(action.attributes ?? {}),
11
+ disabled: action.disabled === true || action.busy === true,
12
+ title: action.title ?? action.label,
13
+ onClick: () => { if (action.disabled !== true && action.busy !== true)
14
+ void action.onSelect(); },
15
+ }, action.label);
16
+ }
17
+ /**
18
+ * Render the one-card decision surface. The model has a singular primary on purpose.
19
+ * @param props - decision model and optional surface class.
20
+ * @returns the decision frame.
21
+ */
22
+ export function DecisionFrame({ decision, className }) {
23
+ const secondary = decision.secondary ?? [];
24
+ return createElement('section', {
25
+ 'data-role': 'decision-frame',
26
+ ...(className === undefined ? {} : { className }),
27
+ }, createElement('h2', { 'data-role': 'decision-title' }, decision.title), decision.summary === undefined || decision.summary === '' ? null : createElement('p', { 'data-role': 'decision-summary' }, decision.summary), decision.facts.length === 0 ? null : createElement('dl', { 'data-role': 'decision-facts' }, decision.facts.map(fact => createElement('div', { key: fact.label, 'data-role': 'decision-fact' }, createElement('dt', null, fact.label), createElement('dd', null, fact.value)))), decision.details === undefined ? null : createElement('div', { 'data-role': 'decision-details' }, decision.details), decision.primary === undefined && secondary.length === 0 ? null : createElement('div', { 'data-role': 'decision-actions' }, decision.primary === undefined ? null : actionButton(decision.primary, 'primary'), secondary.map(action => actionButton(action, 'secondary'))));
28
+ }
29
+ //# sourceMappingURL=decision-frame.js.map
@@ -0,0 +1,13 @@
1
+ /** A native details group for normal/secondary facts. */
2
+ import { type ReactNode } from 'react';
3
+ /** Props for the shared disclosure group. */
4
+ export interface DisclosureGroupProps {
5
+ readonly summary: string;
6
+ readonly count?: number | undefined;
7
+ readonly children: ReactNode;
8
+ readonly defaultOpen?: boolean | undefined;
9
+ readonly className?: string | undefined;
10
+ }
11
+ /** Render a closed-by-default disclosure without introducing another accordion model. */
12
+ export declare function DisclosureGroup({ summary, count, children, defaultOpen, className }: DisclosureGroupProps): ReactNode;
13
+ //# sourceMappingURL=disclosure-group.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** A native details group for normal/secondary facts. */
2
+ import { createElement } from 'react';
3
+ /** Render a closed-by-default disclosure without introducing another accordion model. */
4
+ export function DisclosureGroup({ summary, count, children, defaultOpen = false, className }) {
5
+ return createElement('details', {
6
+ 'data-role': 'disclosure-group',
7
+ ...(defaultOpen ? { open: true } : {}),
8
+ ...(className === undefined ? {} : { className }),
9
+ }, createElement('summary', { 'data-role': 'disclosure-summary' }, createElement('span', { 'data-role': 'disclosure-title' }, summary), count === undefined ? null : createElement('span', { 'data-role': 'disclosure-count' }, String(count))), createElement('div', { 'data-role': 'disclosure-content' }, children));
10
+ }
11
+ //# sourceMappingURL=disclosure-group.js.map
@@ -0,0 +1,15 @@
1
+ /** A compact completed/empty state with at most one primary next step. */
2
+ import { type ReactNode } from 'react';
3
+ import type { PresentationAction, PresentationTone } from './types.ts';
4
+ /** Props for the shared empty state. */
5
+ export interface EmptyStateProps {
6
+ readonly title: string;
7
+ readonly description?: string | undefined;
8
+ readonly tone?: PresentationTone | undefined;
9
+ readonly primary?: PresentationAction | undefined;
10
+ readonly secondary?: PresentationAction | undefined;
11
+ readonly className?: string | undefined;
12
+ }
13
+ /** Render a quiet empty state; loading/failure remain the caller's separate states. */
14
+ export declare function EmptyState({ title, description, tone, primary, secondary, className }: EmptyStateProps): ReactNode;
15
+ //# sourceMappingURL=empty-state.d.ts.map
@@ -0,0 +1,25 @@
1
+ /** A compact completed/empty state with at most one primary next step. */
2
+ import { createElement } from 'react';
3
+ function actionButton(action, role) {
4
+ return createElement('button', {
5
+ key: action.id,
6
+ type: 'button',
7
+ 'data-role': role === 'primary' ? 'empty-primary' : 'empty-secondary',
8
+ 'data-action': action.id,
9
+ ...(action.attributes ?? {}),
10
+ disabled: action.disabled === true || action.busy === true,
11
+ title: action.title ?? action.label,
12
+ onClick: () => { if (action.disabled !== true && action.busy !== true)
13
+ void action.onSelect(); },
14
+ }, action.label);
15
+ }
16
+ /** Render a quiet empty state; loading/failure remain the caller's separate states. */
17
+ export function EmptyState({ title, description, tone = 'neutral', primary, secondary, className }) {
18
+ const actions = primary === undefined && secondary === undefined ? null : createElement('div', { 'data-role': 'empty-actions' }, primary === undefined ? null : actionButton(primary, 'primary'), secondary === undefined ? null : actionButton(secondary, 'secondary'));
19
+ return createElement('section', {
20
+ 'data-role': 'empty-state',
21
+ 'data-tone': tone,
22
+ ...(className === undefined ? {} : { className }),
23
+ }, createElement('h2', { 'data-role': 'empty-title' }, title), description === undefined || description === '' ? null : createElement('p', { 'data-role': 'empty-description' }, description), actions);
24
+ }
25
+ //# sourceMappingURL=empty-state.js.map
@@ -0,0 +1,15 @@
1
+ /** A read-only task hint; it deliberately has no primary action. */
2
+ import { type ReactNode } from 'react';
3
+ /** Props for the shared task banner. */
4
+ export interface TaskBannerProps {
5
+ readonly count: number;
6
+ readonly text: string;
7
+ readonly className?: string | undefined;
8
+ }
9
+ /**
10
+ * Render a task count plus one sentence. The absence of an action prop is the contract.
11
+ * @param props - count, sentence and optional surface class.
12
+ * @returns the banner.
13
+ */
14
+ export declare function TaskBanner({ count, text, className }: TaskBannerProps): ReactNode;
15
+ //# sourceMappingURL=task-banner.d.ts.map
@@ -0,0 +1,16 @@
1
+ /** A read-only task hint; it deliberately has no primary action. */
2
+ import { createElement } from 'react';
3
+ /**
4
+ * Render a task count plus one sentence. The absence of an action prop is the contract.
5
+ * @param props - count, sentence and optional surface class.
6
+ * @returns the banner.
7
+ */
8
+ export function TaskBanner({ count, text, className }) {
9
+ return createElement('div', {
10
+ 'data-role': 'task-banner',
11
+ 'data-count': String(count),
12
+ role: 'status',
13
+ ...(className === undefined ? {} : { className }),
14
+ }, createElement('strong', { 'data-role': 'task-banner-count' }, String(count)), createElement('span', { 'data-role': 'task-banner-text' }, text));
15
+ }
16
+ //# sourceMappingURL=task-banner.js.map
@@ -0,0 +1,15 @@
1
+ /** The one local-time presentation used by reading surfaces. */
2
+ import { type ReactNode } from 'react';
3
+ /** Props for the shared time text. */
4
+ export interface TimeTextProps {
5
+ readonly value: string | number | null | undefined;
6
+ readonly seconds?: boolean | undefined;
7
+ readonly className?: string | undefined;
8
+ }
9
+ /**
10
+ * Render a local wall time, or a neutral dash when the fact is unknown.
11
+ * @param props - ISO/epoch value and seconds preference.
12
+ * @returns a time element with the raw value in dateTime when valid.
13
+ */
14
+ export declare function TimeText({ value, seconds, className }: TimeTextProps): ReactNode;
15
+ //# sourceMappingURL=time-text.d.ts.map
@@ -0,0 +1,20 @@
1
+ /** The one local-time presentation used by reading surfaces. */
2
+ import { createElement } from 'react';
3
+ import { formatLocalDateTime } from "../format.js";
4
+ /**
5
+ * Render a local wall time, or a neutral dash when the fact is unknown.
6
+ * @param props - ISO/epoch value and seconds preference.
7
+ * @returns a time element with the raw value in dateTime when valid.
8
+ */
9
+ export function TimeText({ value, seconds = true, className }) {
10
+ const text = formatLocalDateTime(value, { seconds });
11
+ const ms = typeof value === 'number' ? value : typeof value === 'string' ? Date.parse(value) : Number.NaN;
12
+ const raw = Number.isFinite(ms) ? new Date(ms).toISOString() : undefined;
13
+ return createElement('time', {
14
+ 'data-role': 'time-text',
15
+ ...(raw === undefined ? {} : { dateTime: raw }),
16
+ ...(text === null ? {} : { title: text }),
17
+ ...(className === undefined ? {} : { className }),
18
+ }, text ?? '—');
19
+ }
20
+ //# sourceMappingURL=time-text.js.map
@@ -0,0 +1,30 @@
1
+ /** Shared read-only presentation types; no business state or data loading. */
2
+ import type { ReactNode } from 'react';
3
+ /** Semantic tone shared by chips and empty states. */
4
+ export type PresentationTone = 'neutral' | 'ok' | 'warn' | 'error' | 'quiet';
5
+ /** One user action rendered by DecisionFrame/EmptyState. */
6
+ export interface PresentationAction {
7
+ readonly id: string;
8
+ readonly label: string;
9
+ readonly onSelect: () => void | Promise<void>;
10
+ readonly disabled?: boolean | undefined;
11
+ readonly busy?: boolean | undefined;
12
+ readonly title?: string | undefined;
13
+ /** Optional data-* attributes a decision needs (for example the confirmation marker). */
14
+ readonly attributes?: Readonly<Record<string, string>> | undefined;
15
+ }
16
+ /** One field a reader needs before deciding. */
17
+ export interface DecisionFact {
18
+ readonly label: string;
19
+ readonly value: string;
20
+ }
21
+ /** The only decision-card contract: singular primary, optional secondary and details. */
22
+ export interface DecisionModel {
23
+ readonly title: string;
24
+ readonly summary?: string | undefined;
25
+ readonly facts: readonly DecisionFact[];
26
+ readonly primary?: PresentationAction | undefined;
27
+ readonly secondary?: readonly PresentationAction[] | undefined;
28
+ readonly details?: ReactNode;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-client-kit",
3
3
  "description": "Shared browser seams and lifecycle for the evolution family sidebar panels (community build)",
4
- "version": "0.35.0",
4
+ "version": "0.36.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"