@jini-ai/ui 0.6.22 → 0.7.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/features/admin-widgets/components/ImagePreviewModal.d.ts +3 -3
  3. package/dist/features/admin-widgets/components/ImagePreviewModal.js +3 -1
  4. package/dist/features/admin-widgets/components/InfoTip.d.ts +2 -2
  5. package/dist/features/admin-widgets/components/InfoTip.js +3 -1
  6. package/dist/features/admin-widgets/components/SeeMore/SeeMore.d.ts +2 -2
  7. package/dist/features/admin-widgets/components/SeeMore/SeeMore.js +3 -1
  8. package/dist/features/admin-widgets/components/Select/Select.d.ts +2 -2
  9. package/dist/features/admin-widgets/components/Select/Select.js +12 -8
  10. package/dist/features/admin-widgets/components/SuggestInput/SuggestInput.d.ts +2 -2
  11. package/dist/features/admin-widgets/components/SuggestInput/SuggestInput.js +3 -1
  12. package/dist/features/execution/react/components/SearchableModelSelect.d.ts +5 -5
  13. package/dist/features/execution/react/components/SearchableModelSelect.js +4 -2
  14. package/dist/features/interactive-ui/providers/shadcn/checkbox-field.d.ts +3 -2
  15. package/dist/features/interactive-ui/providers/shadcn/checkbox-field.js +5 -2
  16. package/dist/features/interactive-ui/providers/shadcn/select-field.d.ts +4 -2
  17. package/dist/features/interactive-ui/providers/shadcn/select-field.js +9 -2
  18. package/dist/features/interactive-ui/providers/shadcn/select.d.ts +5 -3
  19. package/dist/features/interactive-ui/providers/shadcn/select.js +9 -4
  20. package/dist/features/mcp-ui/cards.d.ts +12 -0
  21. package/dist/features/mcp-ui/cards.js +8 -0
  22. package/dist/features/mcp-ui/credential-card.d.ts +34 -0
  23. package/dist/features/mcp-ui/credential-card.js +42 -0
  24. package/dist/features/mcp-ui/secret-card.d.ts +2 -16
  25. package/dist/features/mcp-ui/secret-card.js +4 -1
  26. package/dist/features/mcp-ui/sign-in-card.d.ts +57 -0
  27. package/dist/features/mcp-ui/sign-in-card.js +67 -0
  28. package/dist/features/mcp-ui/surfaces/access-approval.d.ts +15 -0
  29. package/dist/features/mcp-ui/surfaces/access-approval.js +17 -0
  30. package/dist/features/mcp-ui/surfaces/bridge.d.ts +2 -8
  31. package/dist/features/mcp-ui/surfaces/confirmation.d.ts +9 -8
  32. package/dist/features/mcp-ui/surfaces/confirmation.js +24 -9
  33. package/dist/features/mcp-ui/surfaces/document.d.ts +18 -27
  34. package/dist/features/mcp-ui/surfaces/document.js +21 -7
  35. package/dist/features/mcp-ui/surfaces/fields.d.ts +2 -74
  36. package/dist/features/mcp-ui/surfaces/form.d.ts +2 -42
  37. package/dist/features/mcp-ui/surfaces/index.d.ts +1 -0
  38. package/dist/features/mcp-ui/surfaces/index.js +1 -0
  39. package/dist/features/mcp-ui/surfaces/outcome.d.ts +2 -39
  40. package/dist/features/mcp-ui/surfaces/outcome.js +25 -2
  41. package/dist/features/mcp-ui/surfaces/select.d.ts +2 -7
  42. package/dist/features/mcp-ui/surfaces/structured-details.d.ts +2 -19
  43. package/dist/features/mcp-ui/surfaces/text-input.d.ts +2 -5
  44. package/dist/features/mcp-ui/surfaces/tokens.d.ts +2 -2
  45. package/dist/features/panel-kit/failure-channel.d.ts +25 -0
  46. package/dist/features/panel-kit/failure-channel.js +36 -0
  47. package/dist/features/panel-kit/index.d.ts +2 -0
  48. package/dist/features/panel-kit/index.js +1 -0
  49. package/dist/features/site-card/SiteCard.d.ts +40 -0
  50. package/dist/features/site-card/SiteCard.js +15 -0
  51. package/dist/features/site-card/SiteListToolbar.d.ts +28 -0
  52. package/dist/features/site-card/SiteListToolbar.js +15 -0
  53. package/dist/features/site-card/index.d.ts +5 -0
  54. package/dist/features/site-card/index.js +5 -0
  55. package/dist/features/site-card/site-card.css +136 -0
  56. package/dist/features/site-card/site-list-view.d.ts +53 -0
  57. package/dist/features/site-card/site-list-view.js +62 -0
  58. package/dist/features/site-card/use-site-list-view.hooks.d.ts +24 -0
  59. package/dist/features/site-card/use-site-list-view.hooks.js +26 -0
  60. package/dist/features/tab-strip/react/components/TabStrip.d.ts +3 -2
  61. package/dist/features/tab-strip/react/components/TabStrip.js +5 -2
  62. package/dist/features/tab-strip/react/components/TabStripItem.d.ts +3 -2
  63. package/dist/features/tab-strip/react/components/TabStripItem.js +5 -2
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.js +3 -0
  66. package/dist/react/components/CustomSelect.d.ts +5 -3
  67. package/dist/react/components/CustomSelect.js +18 -11
  68. package/dist/react/components/PillButton.d.ts +3 -2
  69. package/dist/react/components/PillButton.js +5 -2
  70. package/dist/react/components/PopoverItem.d.ts +3 -2
  71. package/dist/react/components/PopoverItem.js +5 -2
  72. package/dist/react/components/PopoverMenu.d.ts +3 -2
  73. package/dist/react/components/PopoverMenu.js +5 -2
  74. package/dist/react/components/SecretInput.d.ts +3 -2
  75. package/dist/react/components/SecretInput.js +6 -3
  76. package/dist/react/components/select-popover.d.ts +8 -2
  77. package/dist/react/components/select-popover.js +8 -3
  78. package/dist/react/hooks/useAgentHandle.d.ts +17 -0
  79. package/dist/react/hooks/useAgentHandle.js +17 -0
  80. package/dist/styles/admin.css +1 -0
  81. package/package.json +38 -12
@@ -1,3 +1,5 @@
1
+ import type { FormSurfaceSpec } from '@jini-ai/core/contracts/cards';
2
+ export type { FormSurfaceSpec } from '@jini-ai/core/contracts/cards';
1
3
  /**
2
4
  * @module features/mcp-ui/surfaces/form
3
5
  *
@@ -24,48 +26,6 @@
24
26
  * `boolean` reads `checked`, and `string`/`enum` pass through.
25
27
  */
26
28
  import { type UIResource, type UIResourceUri } from '../resource.js';
27
- import { type SurfaceDetail, type SurfaceStatusText } from './document.js';
28
- import { type SurfaceField } from './fields.js';
29
- import type { BridgeScriptSpec } from './bridge.js';
30
- import type { SurfaceTokenName } from './tokens.js';
31
- import { type SecretInputText } from './text-input.js';
32
- export interface FormSurfaceSpec {
33
- readonly title: string;
34
- /** Resource framing carried through host form projections; ignored by HTML rendering. */
35
- readonly preferredFrameSize?: readonly [string, string];
36
- readonly description?: string;
37
- /** Read-only context shown above the fields — what the input is *about*. */
38
- readonly details?: readonly SurfaceDetail[];
39
- readonly fields: readonly SurfaceField[];
40
- /** Callout above the buttons. */
41
- readonly warning?: string;
42
- /** Styles the submit button as destructive. */
43
- readonly danger?: boolean;
44
- readonly submitLabel: string;
45
- /** Alternative submit buttons collect the same fields, with explicit action params. */
46
- readonly additionalSubmitActions?: readonly {
47
- readonly id: string;
48
- readonly label: string;
49
- readonly params: Readonly<Record<string, unknown>>;
50
- }[];
51
- /** The tool the collected values are sent to. */
52
- readonly toolName: string;
53
- /**
54
- * Merged UNDER the collected field values, so a field can never be shadowed by a base param it
55
- * shares a name with. Where a confirmation token belongs when the form is a confirmation.
56
- */
57
- readonly baseParams?: Readonly<Record<string, unknown>>;
58
- /** Omit for a form with no cancel button. Give it a tool name to notify the server of the dismissal. */
59
- readonly cancel?: {
60
- readonly label: string;
61
- readonly toolName?: string;
62
- readonly params?: Readonly<Record<string, unknown>>;
63
- };
64
- readonly text?: Partial<SurfaceStatusText & SecretInputText>;
65
- readonly app?: BridgeScriptSpec;
66
- readonly lang?: string;
67
- readonly tokens?: Partial<Record<SurfaceTokenName, string>>;
68
- }
69
29
  /**
70
30
  * Renders the form dialog as a complete, self-contained HTML document.
71
31
  *
@@ -11,4 +11,5 @@ export * from './select.js';
11
11
  export * from './text-input.js';
12
12
  export * from './tokens.js';
13
13
  export * from './tool-approval.js';
14
+ export * from './access-approval.js';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -11,4 +11,5 @@ export * from './select.js';
11
11
  export * from './text-input.js';
12
12
  export * from './tokens.js';
13
13
  export * from './tool-approval.js';
14
+ export * from './access-approval.js';
14
15
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,5 @@
1
+ import type { SurfaceOutcomeSpec } from '@jini-ai/core/contracts/cards';
2
+ export type { SurfaceOutcomeSpec } from '@jini-ai/core/contracts/cards';
1
3
  /**
2
4
  * @module features/mcp-ui/surfaces/outcome
3
5
  *
@@ -46,45 +48,6 @@
46
48
  * navigating. Ordinary completed outcomes retain their read-only contract.
47
49
  */
48
50
  import { type UIResource, type UIResourceUri } from '../resource.js';
49
- import { type SurfaceDetail } from './document.js';
50
- import type { ConfirmationToolAction } from './confirmation.js';
51
- import type { BridgeScriptSpec } from './bridge.js';
52
- import type { SurfaceTokenName } from './tokens.js';
53
- export interface SurfaceOutcomeSpec {
54
- readonly title: string;
55
- /** Resource framing carried through host outcome projections; ignored by HTML rendering. */
56
- readonly preferredFrameSize?: readonly [string, string];
57
- readonly description?: string;
58
- /** The facts of what actually happened — same shape as a confirmation's own `details`, but
59
- * reporting the RESULT (e.g. the real URL, the real status) rather than what was proposed. */
60
- readonly details?: readonly SurfaceDetail[];
61
- /**
62
- * Styles the status line and, when {@link openLinkUrl} is also present, the open-link button.
63
- * THREE states, not a boolean — matching this package's own callers, which distinguish a genuine
64
- * partial outcome (e.g. a downstream product's static-publish "uploaded, but not yet confirmed reachable") from
65
- * both a plain success and a plain failure specifically so neither is misreported: folding
66
- * `'partial'` into `'success'` would claim something is live when it may not be reachable yet;
67
- * folding it into `'failure'` would hide that the operation itself did NOT fail (nothing needs
68
- * retrying, only a separate follow-up step). See `document.ts`'s own `[data-state="partial"]` rule
69
- * for why this needs a third visual state as well as a third value here, not merely a third string
70
- * that renders identically to one of the other two.
71
- */
72
- readonly state: 'success' | 'partial' | 'failure';
73
- /** The one human-facing sentence explaining the outcome — the actionable message on failure, or a
74
- * short confirmation on success. Never a raw credential or provider response body; that boundary
75
- * is the CALLER's responsibility (this builder only renders what it is given). */
76
- readonly message: string;
77
- /** When present, renders one button ("Open site" by default) that calls the bridge's `openLink`.
78
- * Only meaningful alongside `state: 'success'` — a caller should not supply this for a failure. */
79
- readonly openLinkUrl?: string;
80
- readonly openLinkLabel?: string;
81
- /** A pending external action may be skipped through its existing surface exchange. */
82
- readonly cancel?: ConfirmationToolAction;
83
- /** Identity reported to the Host in `ui/initialize`. Defaults to a generic one. */
84
- readonly app?: BridgeScriptSpec;
85
- readonly lang?: string;
86
- readonly tokens?: Partial<Record<SurfaceTokenName, string>>;
87
- }
88
51
  /**
89
52
  * Renders the outcome document as a complete, self-contained HTML document.
90
53
  *
@@ -51,6 +51,9 @@ import { DEFAULT_SURFACE_STATUS_TEXT, renderActions, renderDetailList, renderSur
51
51
  const DEFAULT_APP = { appName: 'jini-mcp-ui-outcome', appVersion: '1' };
52
52
  const DEFAULT_OPEN_LINK_LABEL = 'Open site';
53
53
  const OPEN_LINK_ACTION_ID = 'open-link';
54
+ /** How long a sign-in card waits for the Host to answer an open-link request. The bridge keeps an
55
+ * unanswered request forever, so without this deadline the card would ignore every later click. */
56
+ const OPEN_LINK_TIMEOUT_MS = 30_000;
54
57
  /** The status region's `data-state` for an outcome state. @complexity O(1). */
55
58
  function statusStateOf(state) {
56
59
  if (state === 'success')
@@ -81,11 +84,24 @@ ${SURFACE_SCRIPT_PRELUDE}
81
84
  var TEXT = ${escapeJsValue(DEFAULT_SURFACE_STATUS_TEXT)};
82
85
  var CANCEL = ${escapeJsValue(spec.cancel)};
83
86
  var OPEN_URL = ${escapeJsValue(spec.openLinkUrl ?? null)};
87
+ var OPEN_TIMEOUT_MS = ${OPEN_LINK_TIMEOUT_MS};
88
+ var OPEN_TIMEOUT_TEXT = ${escapeJsValue(`The link did not open within ${OPEN_LINK_TIMEOUT_MS / 1000} seconds. Try again.`)};
84
89
  var locked = false;
90
+ var opening = null;
85
91
  function onClick(event) {
86
92
  if (event.isTrusted !== true || locked) return;
87
93
  if (event.currentTarget.getAttribute("data-mcpui-action") === "open-link") {
88
- api.openLink(OPEN_URL);
94
+ // A repeat click while the Host is still opening the link reuses that request, not a second window.
95
+ if (opening) return;
96
+ var timer;
97
+ opening = Promise.race([
98
+ api.openLink(OPEN_URL).then(function (result) {
99
+ if (result && result.isError) throw new Error("Could not open the link.");
100
+ }),
101
+ new Promise(function (_resolve, reject) {
102
+ timer = setTimeout(function () { reject(new Error(OPEN_TIMEOUT_TEXT)); }, OPEN_TIMEOUT_MS);
103
+ }),
104
+ ]).catch(reportCallFailure).then(function () { clearTimeout(timer); opening = null; });
89
105
  return;
90
106
  }
91
107
  locked = true;
@@ -107,8 +123,15 @@ function outcomeScript(openLinkUrl) {
107
123
  "use strict";
108
124
  ${SURFACE_SCRIPT_PRELUDE}
109
125
  var OPEN_URL = ${escapeJsValue(openLinkUrl)};
126
+ var OUTCOME = statusNode.textContent;
127
+ // A refused or failed open keeps the outcome (it still happened) and says what to do instead.
128
+ function reportOpenFailure() {
129
+ statusNode.textContent = OUTCOME + " The link did not open. Try again, or copy this address into your browser: " + OPEN_URL;
130
+ }
110
131
  for (var i = 0; i < actionButtons.length; i++) {
111
- actionButtons[i].addEventListener("click", function () { api.openLink(OPEN_URL); });
132
+ actionButtons[i].addEventListener("click", function () {
133
+ api.openLink(OPEN_URL).then(function (result) { if (result && result.isError) reportOpenFailure(); }, reportOpenFailure);
134
+ });
112
135
  }
113
136
  }());`;
114
137
  }
@@ -1,10 +1,5 @@
1
- export interface SelectOption {
2
- /** The value posted back. */
3
- readonly value: string;
4
- /** What the human reads. Defaults to `value`. */
5
- readonly label?: string;
6
- readonly disabled?: boolean;
7
- }
1
+ import type { SelectOption } from '@jini-ai/core/contracts/cards';
2
+ export type { SelectOption } from '@jini-ai/core/contracts/cards';
8
3
  export interface SelectProps {
9
4
  /** HTML `name`, DOM `id` suffix, and the params key the value is posted under. */
10
5
  readonly name: string;
@@ -1,21 +1,5 @@
1
- /** One fact. Values and previous snapshots must be JSON-serializable; strings remain supported. */
2
- export interface SurfaceDetail {
3
- readonly label: string;
4
- readonly value: unknown;
5
- /** Presence enables a diff, including an explicitly absent previous override. */
6
- readonly previous?: unknown;
7
- /** Explicit, optionally translated labels keyed by dotted object path. */
8
- readonly labels?: Readonly<Record<string, string>>;
9
- /** Optional secondary context beneath the label, using the shared muted hint style. */
10
- readonly description?: string;
11
- /**
12
- * `code` discloses a monospace `<pre>` that keeps line breaks and scrolls inside its own box
13
- * past a fixed height, so long SQL or JSON remains readable without stretching the dialog past
14
- * its frame. `status` reserves one line for a short outcome value. Omitted (or `text`) permits
15
- * value-sensitive presentation, preserving plain inline strings for short prose.
16
- */
17
- readonly format?: 'text' | 'code' | 'status';
18
- }
1
+ import type { SurfaceDetail } from '@jini-ai/core/contracts/cards';
2
+ export type { SurfaceDetail } from '@jini-ai/core/contracts/cards';
19
3
  type ValueContext = {
20
4
  value: unknown;
21
5
  path: string;
@@ -36,5 +20,4 @@ export declare function surfaceDetailLabel({ key, path, labels }: {
36
20
  export declare function renderStructuredDetail({ detail }: {
37
21
  detail: SurfaceDetail;
38
22
  }, _options?: {}): string;
39
- export {};
40
23
  //# sourceMappingURL=structured-details.d.ts.map
@@ -1,8 +1,5 @@
1
- /** Verbs the host can translate for a secret's reveal toggle; the field label is appended. */
2
- export interface SecretInputText {
3
- readonly showSecret: string;
4
- readonly hideSecret: string;
5
- }
1
+ import type { SecretInputText } from '@jini-ai/core/contracts/cards';
2
+ export type { SecretInputText } from '@jini-ai/core/contracts/cards';
6
3
  export declare const DEFAULT_SECRET_INPUT_TEXT: SecretInputText;
7
4
  export interface TextInputProps extends Partial<SecretInputText> {
8
5
  /** HTML `name`, DOM `id` suffix, and the params key the value is posted under. */
@@ -1,3 +1,5 @@
1
+ import type { SurfaceTokenName } from '@jini-ai/core/contracts/cards';
2
+ export type { SurfaceTokenName } from '@jini-ai/core/contracts/cards';
1
3
  /**
2
4
  * @module features/mcp-ui/surfaces/tokens
3
5
  *
@@ -65,8 +67,6 @@ export declare const SURFACE_TOKENS: {
65
67
  readonly '--jini-mcpui-font': string;
66
68
  readonly '--jini-mcpui-font-mono': string;
67
69
  };
68
- /** The token names a caller may override. */
69
- export type SurfaceTokenName = keyof typeof SURFACE_TOKENS;
70
70
  /**
71
71
  * The dark-scheme value for every token in {@link SURFACE_TOKENS}, keyed the same way and typed as
72
72
  * `Record<SurfaceTokenName, string>` rather than a partial — a token added to the light palette and
@@ -0,0 +1,25 @@
1
+ import type { UserFacingError } from '@jini-ai/core';
2
+ /** One retained incident per host instance; no history, timers, requests or persistence. */
3
+ export interface FailureChannel {
4
+ publish(input: {
5
+ failure: UserFacingError;
6
+ generation?: number;
7
+ }): void;
8
+ subscribe(listener: () => void): () => void;
9
+ getSnapshot(): UserFacingError | null;
10
+ getGeneration(): number;
11
+ reset(): void;
12
+ }
13
+ /**
14
+ * Create a host-owned external store for the final unexpected failure after transport retries.
15
+ * Reset invalidates pending work across identity/site changes, including when no incident is shown.
16
+ * Optional publication effects are injected and isolated: a broken subscriber cannot replace a transport error or prevent a scope reset.
17
+ * @complexity O(s) time/temporary space per publish/reset for s subscribers; O(s + one bounded failure) retained.
18
+ * @overallScore 98 — host formatting owns disclosure and payload bounds; notification has no recovery effects.
19
+ */
20
+ export declare function createFailureChannel(_requiredArgs: Record<string, never>, { onPublish }?: {
21
+ onPublish?: (input: {
22
+ failure: UserFacingError;
23
+ }) => void;
24
+ }): FailureChannel;
25
+ //# sourceMappingURL=failure-channel.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Create a host-owned external store for the final unexpected failure after transport retries.
3
+ * Reset invalidates pending work across identity/site changes, including when no incident is shown.
4
+ * Optional publication effects are injected and isolated: a broken subscriber cannot replace a transport error or prevent a scope reset.
5
+ * @complexity O(s) time/temporary space per publish/reset for s subscribers; O(s + one bounded failure) retained.
6
+ * @overallScore 98 — host formatting owns disclosure and payload bounds; notification has no recovery effects.
7
+ */
8
+ export function createFailureChannel(_requiredArgs, { onPublish } = {}) {
9
+ let snapshot = null;
10
+ let generation = 0;
11
+ const listeners = new Set();
12
+ const notify = () => { for (const listener of [...listeners])
13
+ notifySafely(listener); };
14
+ return {
15
+ publish({ failure, generation: sourceGeneration = generation }) {
16
+ if (sourceGeneration !== generation)
17
+ return;
18
+ snapshot = failure;
19
+ notify();
20
+ if (onPublish)
21
+ notifySafely(() => onPublish({ failure }));
22
+ },
23
+ subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener); }; },
24
+ getSnapshot: () => snapshot,
25
+ getGeneration: () => generation,
26
+ reset() { generation += 1; snapshot = null; notify(); },
27
+ };
28
+ }
29
+ /** Notification failures must never block session invalidation or replace the original request error. */
30
+ function notifySafely(effect) {
31
+ try {
32
+ effect();
33
+ }
34
+ catch { /* The retained incident remains available to other subscribers. */ }
35
+ }
36
+ //# sourceMappingURL=failure-channel.js.map
@@ -24,4 +24,6 @@ export { useStandingDraftAutosave } from './hooks/use-standing-draft-autosave.ho
24
24
  export type { StandingDraftAutosavePort, StandingDraftAutosaveInput, StandingDraftAutosaveSnapshot, StandingDraftAutosaveController, StandingDraftStaleBasis, StandingDraftAutosaveOptions } from './hooks/use-standing-draft-autosave.hooks.js';
25
25
  export { createStandingDraftLocalBackup, LOCAL_BACKUP_PRINCIPAL_ID } from './helpers/standing-draft-local-backup.js';
26
26
  export { standingDraftRecoveryMessage } from './helpers/standing-draft-recovery-message.js';
27
+ export { createFailureChannel } from './failure-channel.js';
28
+ export type { FailureChannel } from './failure-channel.js';
27
29
  //# sourceMappingURL=index.d.ts.map
@@ -15,4 +15,5 @@ export { useSettingsSlice, mergeSaveStates, commitQueuedSave, canAcceptRefresh,
15
15
  export { useStandingDraftAutosave } from './hooks/use-standing-draft-autosave.hooks.js';
16
16
  export { createStandingDraftLocalBackup, LOCAL_BACKUP_PRINCIPAL_ID } from './helpers/standing-draft-local-backup.js';
17
17
  export { standingDraftRecoveryMessage } from './helpers/standing-draft-recovery-message.js';
18
+ export { createFailureChannel } from './failure-channel.js';
18
19
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ /**
3
+ * @file One site's card, shared by the desktop app's Websites grid and the web admin's Sites page
4
+ * (owner, 2026-11-04). Layout only: a preview tile, then a head grid (name | menu, details | status),
5
+ * then the action row, in the desktop's shape. Each host fills the slots with its own controls, so
6
+ * what a button does stays with the host. Grid auto-placement fills the head in DOM order, so the
7
+ * order below IS the layout and also the Tab order.
8
+ */
9
+ export type SiteCardTone = "neutral" | "running" | "busy" | "warning" | "danger";
10
+ export interface SiteCardProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
11
+ name: string;
12
+ /** Under the name in the same cell, e.g. a duplicate name's parent folder. */
13
+ nameDetail?: ReactNode;
14
+ /** The last captured picture of the site; a neutral placeholder without one. */
15
+ previewSrc?: string | null | undefined;
16
+ onPreviewError?: (() => void) | undefined;
17
+ /** Beside the name, before the menu. */
18
+ nameExtra?: ReactNode;
19
+ /** Top-right, level with the name: the pin and the menu. */
20
+ menu?: ReactNode;
21
+ /** Muted line under the name. */
22
+ details?: ReactNode;
23
+ /** Right-aligned under the menu; usually a {@link SiteCardStatus}. */
24
+ status?: ReactNode;
25
+ /** Anything else the card says, on full-width lines below the head. */
26
+ notes?: ReactNode;
27
+ /** The row of buttons under the text; give its element the class `jini-site-card__actions`. */
28
+ actions?: ReactNode;
29
+ /** A panel covering the card, e.g. a confirmation. */
30
+ overlay?: ReactNode;
31
+ }
32
+ /** The whole card; extra attributes (click target, title, role) go on the `<article>`. @complexity O(1). */
33
+ export declare function SiteCard({ name, nameDetail, previewSrc, onPreviewError, nameExtra, menu, details, status, notes, actions, overlay, className, ...article }: SiteCardProps): import("react").JSX.Element;
34
+ /** A dot and a word, tinted by tone. @complexity O(1). */
35
+ export declare function SiteCardStatus({ label, tone, title }: {
36
+ label: ReactNode;
37
+ tone?: SiteCardTone;
38
+ title?: string | undefined;
39
+ }): import("react").JSX.Element;
40
+ //# sourceMappingURL=SiteCard.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** The placeholder keeps the tile's shape and tells nothing false about the site. @complexity O(1). */
3
+ function SiteCardTile({ previewSrc, onPreviewError }) {
4
+ // Decorative: the name right below already says which site this is.
5
+ return (_jsx("div", { className: "jini-site-card__tile", "aria-hidden": "true", children: previewSrc ? (_jsx("img", { className: "jini-site-card__preview", src: previewSrc, alt: "", loading: "lazy", decoding: "async", onError: onPreviewError })) : (_jsxs("svg", { className: "jini-site-card__placeholder", viewBox: "0 0 48 36", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("rect", { x: "1", y: "1", width: "46", height: "34", rx: "4" }), _jsx("path", { d: "M1 9h46M7 5h.01M11 5h.01M15 5h.01M9 17h30M9 23h20", strokeLinecap: "round" })] })) }));
6
+ }
7
+ /** The whole card; extra attributes (click target, title, role) go on the `<article>`. @complexity O(1). */
8
+ export function SiteCard({ name, nameDetail, previewSrc, onPreviewError, nameExtra, menu, details, status, notes, actions, overlay, className, ...article }) {
9
+ return (_jsxs("article", { ...article, className: className ? `jini-site-card ${className}` : "jini-site-card", children: [_jsx(SiteCardTile, { previewSrc: previewSrc, onPreviewError: onPreviewError }), _jsxs("div", { className: "jini-site-card__body", children: [_jsxs("div", { className: "jini-site-card__head", children: [_jsxs("div", { className: "jini-site-card__namewrap", children: [_jsxs("div", { className: "jini-site-card__nameline", children: [_jsx("h3", { className: "jini-site-card__name", title: name, children: name }), nameExtra] }), nameDetail] }), _jsx("div", { className: "jini-site-card__menu", children: menu }), _jsx("div", { className: "jini-site-card__details", children: details }), _jsx("div", { className: "jini-site-card__meta", children: status }), notes] }), actions] }), overlay] }));
10
+ }
11
+ /** A dot and a word, tinted by tone. @complexity O(1). */
12
+ export function SiteCardStatus({ label, tone = "neutral", title }) {
13
+ return (_jsxs("span", { className: `jini-site-card__status jini-site-card__status--${tone}`, title: title, children: [_jsx("span", { className: "jini-site-card__status-dot", "aria-hidden": "true" }), label] }));
14
+ }
15
+ //# sourceMappingURL=SiteCard.js.map
@@ -0,0 +1,28 @@
1
+ import type { SiteListController } from "./use-site-list-view.hooks.js";
2
+ /** Every word on the toolbar, supplied by the host so it can translate them. */
3
+ export interface SiteListToolbarCopy {
4
+ views: string;
5
+ pinnedRecent: string;
6
+ /** With its count, e.g. "All sites (12)". */
7
+ all: string;
8
+ /** With its count, e.g. "Hidden (2)". */
9
+ hidden: string;
10
+ sortBy: string;
11
+ recent: string;
12
+ oldest: string;
13
+ name: string;
14
+ }
15
+ type ToolbarController = Pick<SiteListController<unknown>, "filter" | "setFilter" | "sort" | "setSort" | "hiddenCount">;
16
+ /** View chips and the "Sort by" dropdown. "Hidden" appears only once something is hidden. @complexity O(1). */
17
+ export declare function SiteListToolbar({ list, copy }: {
18
+ list: ToolbarController;
19
+ copy: SiteListToolbarCopy;
20
+ }): import("react").JSX.Element;
21
+ /** The pin on a card. Stops its events, since a card can itself be a click target. @complexity O(1). */
22
+ export declare function SiteCardPin({ pinned, label, onToggle }: {
23
+ pinned: boolean;
24
+ label: string;
25
+ onToggle: () => void;
26
+ }): import("react").JSX.Element;
27
+ export {};
28
+ //# sourceMappingURL=SiteListToolbar.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** View chips and the "Sort by" dropdown. "Hidden" appears only once something is hidden. @complexity O(1). */
3
+ export function SiteListToolbar({ list, copy }) {
4
+ const views = [
5
+ { id: "pinned-recent", label: copy.pinnedRecent },
6
+ { id: "all", label: copy.all },
7
+ ...(list.hiddenCount > 0 ? [{ id: "hidden", label: copy.hidden }] : []),
8
+ ];
9
+ return (_jsxs("div", { className: "jini-site-list-toolbar", children: [_jsx("div", { className: "jini-site-list-toolbar__views", role: "group", "aria-label": copy.views, children: views.map((view) => (_jsx("button", { type: "button", className: "jini-site-list-toolbar__view", "aria-pressed": list.filter === view.id, onClick: () => list.setFilter(view.id), children: view.label }, view.id))) }), _jsxs("label", { className: "jini-site-list-toolbar__sort", children: [copy.sortBy, _jsxs("select", { value: list.sort, onChange: (event) => list.setSort(event.target.value), children: [_jsx("option", { value: "recent", children: copy.recent }), _jsx("option", { value: "oldest", children: copy.oldest }), _jsx("option", { value: "name", children: copy.name })] })] })] }));
10
+ }
11
+ /** The pin on a card. Stops its events, since a card can itself be a click target. @complexity O(1). */
12
+ export function SiteCardPin({ pinned, label, onToggle }) {
13
+ return (_jsx("button", { type: "button", className: "jini-site-card__pin", "aria-pressed": pinned, "aria-label": label, title: label, onClick: (event) => { event.stopPropagation(); onToggle(); }, onKeyDown: (event) => event.stopPropagation(), children: _jsx("svg", { viewBox: "0 0 24 24", fill: pinned ? "currentColor" : "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M9 3.5h6l-.8 7 3.3 3.5h-11l3.3-3.5zM12 14v6.5" }) }) }));
14
+ }
15
+ //# sourceMappingURL=SiteListToolbar.js.map
@@ -0,0 +1,5 @@
1
+ export { SiteCard, SiteCardStatus, type SiteCardProps, type SiteCardTone } from "./SiteCard.js";
2
+ export { SiteCardPin, SiteListToolbar, type SiteListToolbarCopy } from "./SiteListToolbar.js";
3
+ export { useSiteListView, type SiteListController } from "./use-site-list-view.hooks.js";
4
+ export { DEFAULT_SITE_LIST_PREFS, parseSiteListPrefs, type SiteListFilter, type SiteListItem, type SiteListPrefs, type SiteListSort } from "./site-list-view.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ export { SiteCard, SiteCardStatus } from "./SiteCard.js";
2
+ export { SiteCardPin, SiteListToolbar } from "./SiteListToolbar.js";
3
+ export { useSiteListView } from "./use-site-list-view.hooks.js";
4
+ export { DEFAULT_SITE_LIST_PREFS, parseSiteListPrefs } from "./site-list-view.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,136 @@
1
+ /*
2
+ * The shared site card and the list controls above it. The host's own token comes first: the admin's
3
+ * --jini-* palette is a flat grey behind its --surface and --border, and the desktop shell defines no
4
+ * --jini-* outside its dialogs. The --jini-* name is the fallback for any other host.
5
+ */
6
+ .jini-site-card {
7
+ min-width: 0;
8
+ position: relative;
9
+ display: flex;
10
+ flex-direction: column;
11
+ border: 1px solid var(--border, var(--jini-border));
12
+ border-radius: var(--r-md, var(--jini-radius-md));
13
+ background: var(--surface, var(--jini-bg-panel));
14
+ color: var(--fg, var(--jini-text));
15
+ overflow: hidden;
16
+ text-align: left;
17
+ box-shadow: var(--shadow-sm);
18
+ }
19
+
20
+ /* Fixed ratio: a capture landing causes no layout jump. `top`: a thumbnail is recognised by its hero. */
21
+ .jini-site-card__tile {
22
+ position: relative;
23
+ display: grid;
24
+ place-items: center;
25
+ aspect-ratio: 16 / 10;
26
+ background: var(--sunken, var(--surface-2));
27
+ border-bottom: 1px solid var(--border, var(--jini-border));
28
+ }
29
+ .jini-site-card__placeholder { width: 3rem; height: auto; color: var(--faint); opacity: 0.6; }
30
+ .jini-site-card__preview { width: 100%; height: 100%; object-fit: cover; object-position: top; }
31
+
32
+ .jini-site-card__body {
33
+ flex: 1;
34
+ padding: 0.75rem 0.875rem 0.875rem;
35
+ display: flex;
36
+ flex-direction: column;
37
+ gap: 0.5rem;
38
+ }
39
+
40
+ /* `minmax(0, 1fr)` is load-bearing: a bare `1fr` would not shrink, and a long name would push the menu off the card. */
41
+ .jini-site-card__head {
42
+ display: grid;
43
+ grid-template-columns: minmax(0, 1fr) auto;
44
+ column-gap: 0.75rem;
45
+ row-gap: 0.3125rem;
46
+ align-items: center;
47
+ }
48
+ /* Anything beyond the head's four cells spans both columns, below row 2. */
49
+ .jini-site-card__head > :nth-child(n + 5) { grid-column: 1 / -1; }
50
+
51
+ .jini-site-card__namewrap { min-width: 0; }
52
+ .jini-site-card__nameline { display: flex; align-items: center; gap: 0.25rem; min-width: 0; }
53
+ .jini-site-card__name {
54
+ margin: 0;
55
+ font-size: 0.875rem;
56
+ font-weight: 500;
57
+ overflow: hidden;
58
+ text-overflow: ellipsis;
59
+ white-space: nowrap;
60
+ min-width: 0;
61
+ }
62
+ .jini-site-card__menu { position: relative; z-index: 3; justify-self: end; align-self: start; display: inline-flex; align-items: center; gap: 0.25rem; }
63
+ .jini-site-card__details { margin: 0; min-width: 0; color: var(--faint); font-family: var(--font-mono); font-size: 0.6875rem; }
64
+ .jini-site-card__meta { margin: 0; justify-self: end; display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; }
65
+
66
+ /* The row of buttons under the text: no `margin-top: auto`, it sits directly under the last line. */
67
+ .jini-site-card__actions { display: flex; flex-direction: row; align-items: center; gap: 0.375rem; }
68
+ .jini-site-card__actions:empty { display: none; }
69
+
70
+ .jini-site-card__status { display: inline-flex; align-items: center; gap: 0.375rem; color: var(--faint); }
71
+ .jini-site-card__status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
72
+ .jini-site-card__status--running { color: var(--primary); }
73
+ .jini-site-card__status--running .jini-site-card__status-dot { box-shadow: 0 0 0 3px var(--primary-ring, var(--primary-dim)); }
74
+ .jini-site-card__status--busy, .jini-site-card__status--warning { color: var(--warning); }
75
+ .jini-site-card__status--danger { color: var(--danger); }
76
+ /* Both transitions, not only the boot: a stop takes as long as its drain does. */
77
+ .jini-site-card__status--busy .jini-site-card__status-dot { animation: jini-site-card-pulse 1.4s ease-in-out infinite; }
78
+ @keyframes jini-site-card-pulse { 50% { opacity: 0.3; } }
79
+ @media (prefers-reduced-motion: reduce) {
80
+ .jini-site-card__status--busy .jini-site-card__status-dot { animation: none; }
81
+ }
82
+
83
+ /* List controls: the view chips on the left, "Sort by" on the right; they wrap at phone width. */
84
+ .jini-site-list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-block-end: 1rem; }
85
+ .jini-site-list-toolbar__views { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
86
+ .jini-site-list-toolbar__view {
87
+ min-height: 2rem;
88
+ padding: 0 0.75rem;
89
+ border: 1px solid var(--border, var(--jini-border));
90
+ border-radius: 999px;
91
+ background: transparent;
92
+ color: var(--muted);
93
+ font: inherit;
94
+ font-size: 0.8125rem;
95
+ cursor: pointer;
96
+ }
97
+ .jini-site-list-toolbar__view:hover { background: var(--surface-2); color: var(--fg, var(--jini-text)); }
98
+ .jini-site-list-toolbar__view[aria-pressed="true"] { background: var(--surface-2); color: var(--fg, var(--jini-text)); border-color: var(--border-strong); font-weight: 500; }
99
+ .jini-site-list-toolbar__view:focus-visible,
100
+ .jini-site-list-toolbar__sort select:focus-visible,
101
+ .jini-site-card__pin:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
102
+ .jini-site-list-toolbar__sort { display: inline-flex; align-items: center; gap: 0.5rem; margin-inline-start: auto; color: var(--muted); font-size: 0.8125rem; }
103
+ .jini-site-list-toolbar__sort select {
104
+ min-height: 2rem;
105
+ width: auto;
106
+ /* Room for the host's chevron; `background-color`, since the shorthand would erase that chevron. */
107
+ padding: 0 1.75rem 0 0.5rem;
108
+ border: 1px solid var(--border, var(--jini-border));
109
+ border-radius: var(--r-sm, var(--jini-radius-sm));
110
+ background-color: var(--surface, var(--jini-bg-panel));
111
+ color: var(--fg, var(--jini-text));
112
+ font: inherit;
113
+ }
114
+
115
+ .jini-site-card__pin {
116
+ display: inline-grid;
117
+ place-items: center;
118
+ flex: none;
119
+ width: 26px;
120
+ height: 26px;
121
+ padding: 0;
122
+ border: 0;
123
+ border-radius: var(--r-sm, var(--jini-radius-sm));
124
+ background: transparent;
125
+ color: var(--faint);
126
+ cursor: pointer;
127
+ }
128
+ .jini-site-card__pin:hover { background: var(--surface-2); color: var(--fg, var(--jini-text)); }
129
+ .jini-site-card__pin[aria-pressed="true"] { color: var(--primary); }
130
+ .jini-site-card__pin svg { width: 14px; height: 14px; }
131
+
132
+ /* A finger needs 44px; the pointer rules above stay compact. */
133
+ @media (pointer: coarse), (max-width: 480px) {
134
+ .jini-site-list-toolbar__view, .jini-site-list-toolbar__sort select { min-height: 44px; }
135
+ .jini-site-card__pin { width: 44px; height: 44px; }
136
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @file What the Websites list shows, as plain functions (owner, 2026-11-04): newest first by default,
3
+ * a remembered "Sort by", pinned and recent sites by default with the rest one click away, and a
4
+ * "Hidden" filter. Hiding only leaves the list; the site stays on disk.
5
+ */
6
+ export type SiteListSort = "recent" | "oldest" | "name";
7
+ export type SiteListFilter = "pinned-recent" | "all" | "hidden";
8
+ /** What is remembered per person. */
9
+ export interface SiteListPrefs {
10
+ sort: SiteListSort;
11
+ pinned: readonly string[];
12
+ hidden: readonly string[];
13
+ }
14
+ export interface SiteListItem {
15
+ id: string;
16
+ name: string;
17
+ createdAt: string;
18
+ /** A running site is always listed: no filter and no hide takes it out of sight (owner, 2026-11-06). */
19
+ running?: boolean;
20
+ }
21
+ export declare const DEFAULT_SITE_LIST_PREFS: SiteListPrefs;
22
+ /** How many of the newest sites the default view shows besides the pinned ones. */
23
+ export declare const SITE_LIST_RECENT_COUNT = 6;
24
+ /**
25
+ * Reads a stored value; anything malformed falls back to the defaults, so a damaged entry can never
26
+ * blank the list.
27
+ * @returns Valid preferences. @complexity O(n) stored ids.
28
+ */
29
+ export declare function parseSiteListPrefs({ stored }: {
30
+ stored: unknown;
31
+ }, _options?: {}): SiteListPrefs;
32
+ export interface SiteListView<Item> {
33
+ visible: readonly Item[];
34
+ /** Every site not hidden, the number on "All sites (n)". */
35
+ allCount: number;
36
+ /** The number on "Hidden (n)". */
37
+ hiddenCount: number;
38
+ }
39
+ /**
40
+ * The cards for one filter, pinned first and then in the chosen order.
41
+ * @returns The visible items and both counts. @complexity O(n log n) in `items`.
42
+ */
43
+ export declare function siteListView<Item extends SiteListItem>({ items, prefs, filter }: {
44
+ items: readonly Item[];
45
+ prefs: SiteListPrefs;
46
+ filter: SiteListFilter;
47
+ }, _options?: {}): SiteListView<Item>;
48
+ /** Adds or removes one id. @returns A new list. @complexity O(n). */
49
+ export declare function toggleListed({ list, id }: {
50
+ list: readonly string[];
51
+ id: string;
52
+ }, _options?: {}): readonly string[];
53
+ //# sourceMappingURL=site-list-view.d.ts.map