nish-ui 2.2.0 → 3.1.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 (99) hide show
  1. package/README.md +10 -6
  2. package/dist/chart.d.ts +8 -3
  3. package/dist/chart.js +2 -417
  4. package/dist/elements-all.js +81 -80
  5. package/dist/elements-charts.d.ts +7 -1
  6. package/dist/elements-charts.js +16 -16
  7. package/dist/elements-data.d.ts +7 -1
  8. package/dist/elements-data.js +5 -5
  9. package/dist/elements-forms.d.ts +7 -1
  10. package/dist/elements-forms.js +18 -17
  11. package/dist/elements.d.ts +7 -1
  12. package/dist/elements.js +4 -4
  13. package/dist/esm/components/accordion.js +3 -2
  14. package/dist/esm/components/app-shell.js +3 -2
  15. package/dist/esm/components/avatar.js +6 -5
  16. package/dist/esm/components/breadcrumbs.js +3 -2
  17. package/dist/esm/components/calendar-base.js +4 -3
  18. package/dist/esm/components/canvas/legend.js +7 -6
  19. package/dist/esm/components/canvas/node.js +3 -2
  20. package/dist/esm/components/canvas/system-canvas.js +27 -3
  21. package/dist/esm/components/carousel.js +24 -5
  22. package/dist/esm/components/charts.js +29 -20
  23. package/dist/esm/components/combobox.js +4 -3
  24. package/dist/esm/components/command.js +4 -3
  25. package/dist/esm/components/context-menu.js +3 -2
  26. package/dist/esm/components/data-classes.js +5 -4
  27. package/dist/esm/components/data.js +5 -8
  28. package/dist/esm/components/date-picker.js +5 -3
  29. package/dist/esm/components/date-range-picker.js +5 -3
  30. package/dist/esm/components/display.js +10 -9
  31. package/dist/esm/components/drawer.js +3 -2
  32. package/dist/esm/components/error-boundary.js +4 -2
  33. package/dist/esm/components/feedback.js +7 -6
  34. package/dist/esm/components/file-dropzone.js +24 -3
  35. package/dist/esm/components/filters.js +7 -4
  36. package/dist/esm/components/flow.js +17 -15
  37. package/dist/esm/components/forms.js +37 -10
  38. package/dist/esm/components/hooks.js +22 -19
  39. package/dist/esm/components/hover-card.js +2 -2
  40. package/dist/esm/components/inbox.js +12 -8
  41. package/dist/esm/components/layout-vars.js +10 -7
  42. package/dist/esm/components/layout.js +5 -4
  43. package/dist/esm/components/media.js +3 -2
  44. package/dist/esm/components/menu.js +12 -8
  45. package/dist/esm/components/modal.js +4 -3
  46. package/dist/esm/components/more-sheet.js +3 -2
  47. package/dist/esm/components/multi-select.js +10 -6
  48. package/dist/esm/components/nav-items.js +4 -3
  49. package/dist/esm/components/nav.js +5 -4
  50. package/dist/esm/components/overlay-core.js +31 -10
  51. package/dist/esm/components/overlay-dialog.js +20 -4
  52. package/dist/esm/components/pagination.js +7 -3
  53. package/dist/esm/components/popover.js +17 -11
  54. package/dist/esm/components/portal.js +2 -2
  55. package/dist/esm/components/primitives.js +1 -1
  56. package/dist/esm/components/progress.js +5 -2
  57. package/dist/esm/components/provider.js +34 -5
  58. package/dist/esm/components/range-calendar.js +4 -3
  59. package/dist/esm/components/resource-classes.js +34 -16
  60. package/dist/esm/components/resource.js +5 -4
  61. package/dist/esm/components/service-tokens.js +4 -3
  62. package/dist/esm/components/settings.js +8 -5
  63. package/dist/esm/components/slider.js +4 -2
  64. package/dist/esm/components/split.js +4 -3
  65. package/dist/esm/components/strings.js +182 -65
  66. package/dist/esm/components/tag-input.js +18 -9
  67. package/dist/esm/components/theme-toggle.js +3 -2
  68. package/dist/esm/components/time-field-classes.js +5 -2
  69. package/dist/esm/components/time-field.js +19 -10
  70. package/dist/esm/components/toast-card.js +155 -0
  71. package/dist/esm/components/toast-store.js +136 -0
  72. package/dist/esm/components/toast.js +38 -241
  73. package/dist/esm/components/tooltip.js +3 -3
  74. package/dist/esm/components/url-state.js +1 -0
  75. package/dist/esm/components/virtual-table.js +11 -4
  76. package/dist/esm/components/virtual.js +16 -2
  77. package/dist/esm/format.js +17 -14
  78. package/dist/esm/index.js +0 -20
  79. package/dist/esm/runtime.js +1 -1
  80. package/dist/esm/server/inbox/client.js +1 -1
  81. package/dist/esm/system-canvas.js +4 -0
  82. package/dist/esm/theme.js +73 -13
  83. package/dist/format.js +18 -15
  84. package/dist/inbox-client.js +1 -1
  85. package/dist/index.d.ts +43 -21
  86. package/dist/nish-components.css +41 -1
  87. package/dist/nish-components.min.css +1 -1
  88. package/dist/node/th-check.js +12 -3
  89. package/dist/server/hono.d.ts +1 -1
  90. package/dist/server/hono.js +20 -1
  91. package/dist/server/index.d.ts +2 -2
  92. package/dist/server/index.js +19 -5
  93. package/dist/{spa-BLlMc0eI.d.ts → spa-7myD4xvA.d.ts} +3 -2
  94. package/dist/system-canvas.d.ts +179 -2
  95. package/dist/theme.d.ts +23 -5
  96. package/dist/theme.global.js +87 -151
  97. package/dist/theme.js +87 -151
  98. package/package.json +1 -1
  99. package/dist/system-canvas-BLuWd69H.d.ts +0 -183
@@ -609,7 +609,7 @@ function createInboxClient(options) {
609
609
  if (disabled) return { ok: false, error: "disabled", queued: false };
610
610
  if (queue.length > 0) {
611
611
  enqueue(parsed.value);
612
- void flush();
612
+ if (timer === null) void flush();
613
613
  return { ok: false, error: "queued behind earlier events", queued: true };
614
614
  }
615
615
  const result = await attempt(parsed.value);
@@ -779,16 +779,25 @@ function jsonRevocationStore(file) {
779
779
  if (err.code === "ENOENT") return [];
780
780
  throw err;
781
781
  }
782
- const setAside = (why) => {
782
+ const salvage = (source) => [...new Set((source.match(/[0-9a-fA-F]{64}/g) ?? []).map((h) => h.toLowerCase()))].map((sha256) => ({
783
+ sha256,
784
+ id: "unknown",
785
+ at: ""
786
+ }));
787
+ const setAside = (why, failIfNoHash = false) => {
788
+ const found = salvage(text);
789
+ if (failIfNoHash && found.length === 0 && text.trim() !== "") {
790
+ throw new Error(`[service-tokens] ${file}: ${why} and no revoked token hash could be read; fix or remove the file`);
791
+ }
783
792
  warn(why);
784
793
  renameSync(file, `${file}.bad-${Date.now()}`);
785
- return [];
794
+ return found;
786
795
  };
787
796
  let raw;
788
797
  try {
789
798
  raw = JSON.parse(text);
790
799
  } catch {
791
- return setAside("not valid JSON");
800
+ return setAside("not valid JSON", true);
792
801
  }
793
802
  const list = raw?.revoked;
794
803
  if (!raw || typeof raw !== "object" || !Array.isArray(list)) return setAside("unexpected shape");
@@ -798,7 +807,12 @@ function jsonRevocationStore(file) {
798
807
  out.push({ sha256: r.sha256, id: r.id, at: r.at });
799
808
  } else {
800
809
  warn("unexpected shape");
801
- kept.push(r);
810
+ const hash = r && typeof r === "object" && typeof r.sha256 === "string" ? salvage(r.sha256)[0] : void 0;
811
+ if (hash) {
812
+ out.push({ sha256: hash.sha256, id: typeof r.id === "string" ? r.id : "unknown", at: typeof r.at === "string" ? r.at : "" });
813
+ } else {
814
+ kept.push(r);
815
+ }
802
816
  }
803
817
  }
804
818
  return out;
@@ -280,8 +280,9 @@ interface RevocationStore {
280
280
  save(list: RevokedToken[]): void;
281
281
  }
282
282
  /** JSON file store: missing file = []; any other read error throws (fail closed); invalid JSON or
283
- * shape = warn once, file renamed to `<file>.bad-<timestamp>`, [] (if that rename fails it throws);
284
- * invalid records are kept and written back unchanged on save.
283
+ * shape = warn once, file renamed to `<file>.bad-<timestamp>`, and every 64-hex hash found in it stays
284
+ * revoked (a corrupt, unparseable file with none to find, or a failed rename, throws and the file stays);
285
+ * invalid records without a readable hash are kept and written back unchanged on save.
285
286
  * save writes `<file>.tmp` then renames, creating the directory. File shape:
286
287
  * { "version": 1, "revoked": RevokedToken[] }. */
287
288
  declare function jsonRevocationStore(file: string): RevocationStore;
@@ -1,2 +1,179 @@
1
- export { C as CanvasEdge, a as CanvasEdgeKind, b as CanvasGroup, c as CanvasHue, d as CanvasLabels, e as CanvasLayout, f as CanvasLayoutMode, g as CanvasNode, h as CanvasNodeKind, L as LayoutOptions, R as RoutedEdge, S as SystemCanvas, i as SystemCanvasProps, l as layoutSystem, p as pickLayout, r as routeEdges } from './system-canvas-BLuWd69H.js';
2
- import 'react';
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentPropsWithoutRef, Ref } from 'react';
3
+
4
+ type CanvasHue = 'indigo' | 'emerald' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
5
+ type CanvasNodeKind = 'ui' | 'service' | 'worker' | 'library' | 'infra' | 'data' | 'tool' | 'docs';
6
+ interface CanvasNode {
7
+ id: string;
8
+ label: string;
9
+ kind?: CanvasNodeKind;
10
+ detail?: string;
11
+ /** 0..1 afterglow */
12
+ heat?: number;
13
+ /** live work here now */
14
+ active?: boolean;
15
+ /** When the newest activity here happened, ms. Follow mode visits the newest first. */
16
+ activeAt?: number;
17
+ /** shown under an active node, max ~48 chars */
18
+ note?: string;
19
+ /** sessions/agents here */
20
+ count?: number;
21
+ }
22
+ interface CanvasGroup {
23
+ id: string;
24
+ title: string;
25
+ subtitle?: string;
26
+ hue?: CanvasHue;
27
+ /** Left-to-right layer in the "columns" layout; also orders groups inside a band. */
28
+ column: number;
29
+ /** Top-to-bottom band in the "bands" layout. Default: `column`. */
30
+ band?: number;
31
+ badge?: ReactNode;
32
+ nodes: CanvasNode[];
33
+ }
34
+ interface CanvasEdge {
35
+ id: string;
36
+ /** node or group id */
37
+ from: string;
38
+ /** node or group id */
39
+ to: string;
40
+ /** Overrides the kind's line style with a dashed line. */
41
+ dashed?: boolean;
42
+ label?: string;
43
+ /** A `CanvasEdgeKind` id: sets the line style and which legend toggle shows or hides it. */
44
+ kind?: string;
45
+ }
46
+ /** One entry of the line legend. */
47
+ interface CanvasEdgeKind {
48
+ id: string;
49
+ /** Legend text ("Traffic", "Deploys"). */
50
+ label: string;
51
+ /** Default "solid". */
52
+ line?: 'solid' | 'dashed' | 'dotted';
53
+ /** Hidden until the viewer turns it on in the legend. */
54
+ hidden?: boolean;
55
+ }
56
+ /** "columns": layers left to right. "bands": bands top to bottom, each wrapping its groups into
57
+ * rows. "auto": whichever shows the map biggest in the current viewport. */
58
+ type CanvasLayoutMode = 'columns' | 'bands' | 'auto';
59
+ /** Text of the canvas that has no key in `NishStrings`. Each one wins over its English default. */
60
+ interface CanvasLabels {
61
+ /** Added to the "Lines" button when kinds are hidden: "· 2 hidden". */
62
+ hidden: (count: number) => string;
63
+ /** Follow caption when nothing is active. */
64
+ followIdle: string;
65
+ /** Follow caption for one node. */
66
+ followOne: (group: string, label: string) => string;
67
+ /** Follow caption for several nodes. */
68
+ followMany: (count: number) => string;
69
+ }
70
+ declare const DEFAULT_CANVAS_LABELS: CanvasLabels;
71
+ interface SystemCanvasProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onSelect' | 'children' | 'aria-label'> {
72
+ ref?: Ref<HTMLDivElement>;
73
+ groups: CanvasGroup[];
74
+ edges: CanvasEdge[];
75
+ /** Faint titles above each column ("Edge", "Infra", "Apps", ...), by column index. */
76
+ columns?: string[];
77
+ /** Titles of the bands in the "bands" layout, by band index. Falls back to `columns`. */
78
+ bands?: string[];
79
+ /** Default "auto". */
80
+ layout?: CanvasLayoutMode;
81
+ /** The line legend. Edges whose kind is hidden are left out of the layout and routing. */
82
+ edgeKinds?: CanvasEdgeKind[];
83
+ /** Follow mode: the view flies to where work is happening. Controlled when set. */
84
+ follow?: boolean;
85
+ onFollowChange?: (on: boolean) => void;
86
+ /** Overview map in a corner on viewports 600 px wide or more. Default true. */
87
+ minimap?: boolean;
88
+ selected?: string | null;
89
+ onSelect?: (id: string, type: 'node' | 'group') => void;
90
+ /** CSS height of the viewport. Default "100%". */
91
+ height?: string;
92
+ /** aria-label. Default: the `systemMap` string ("System map"). */
93
+ label?: string;
94
+ /** Text without a key in the provider's strings (follow caption, hidden-lines count). */
95
+ labels?: Partial<CanvasLabels>;
96
+ className?: string;
97
+ }
98
+
99
+ declare function SystemCanvas({ groups, edges, columns, bands, layout: layoutMode, edgeKinds, follow, onFollowChange, minimap, selected, onSelect, height, label: labelProp, labels: labelOverrides, className, style, ref: forwardedRef, ...rest }: SystemCanvasProps): react.JSX.Element;
100
+
101
+ interface CanvasLayout {
102
+ mode: "columns" | "bands";
103
+ width: number;
104
+ height: number;
105
+ /** World px above y = 0 taken by the headers: 36 in "columns" (titles sit above the cards), 0 in "bands" (titles sit inside). */
106
+ titleRoom: number;
107
+ /** Top-left of each column's ("columns") or band's ("bands") title, world px; `index` is the column or band value. */
108
+ headers: {
109
+ index: number;
110
+ x: number;
111
+ y: number;
112
+ }[];
113
+ groups: Record<string, {
114
+ x: number;
115
+ y: number;
116
+ w: number;
117
+ h: number;
118
+ }>;
119
+ nodes: Record<string, {
120
+ x: number;
121
+ y: number;
122
+ w: number;
123
+ h: number;
124
+ }>;
125
+ }
126
+ /** Where every group and node sits, in world units (px at zoom 1). Pure and deterministic.
127
+ *
128
+ * "columns" (default): columns are the distinct `column` values in ascending order, groups
129
+ * stack in the order given, nodes sit in a 2-column grid inside their group (1 column for a
130
+ * group of one), and each column is centered against the tallest. The first sub-column starts
131
+ * 60 px in and `width` includes 60 px after the last, which is room for the edge lanes
132
+ * outside the cards.
133
+ *
134
+ * "bands": bands are the distinct `band ?? column` values in ascending order, stacked top to
135
+ * bottom; each band wraps its groups (by `column`, then input order) into rows no wider than
136
+ * `width`. The gaps between rows grow with the number of edge ends that need lanes there. */
137
+ interface LayoutOptions {
138
+ /** Default "columns". */
139
+ mode?: "columns" | "bands";
140
+ /** "bands" only: the widest a row of groups may get, world px (at least one group per row). */
141
+ width?: number;
142
+ /** "bands" only: used to size the gaps between rows for the edge lanes. */
143
+ edges?: CanvasEdge[];
144
+ columnGap?: number;
145
+ rowGap?: number;
146
+ }
147
+ declare function layoutSystem(groups: CanvasGroup[], o?: LayoutOptions): CanvasLayout;
148
+ /** The layout to show in a viewport of `viewport` px. "columns" and "bands" use that mode;
149
+ * "auto" picks whichever candidate shows the map biggest. Pure and deterministic. */
150
+ declare function pickLayout(groups: CanvasGroup[], edges: CanvasEdge[], viewport: {
151
+ w: number;
152
+ h: number;
153
+ }, mode?: CanvasLayoutMode): CanvasLayout;
154
+
155
+ interface RoutedEdge {
156
+ id: string;
157
+ /** The corners of the line, source port first. Every segment is horizontal or vertical. */
158
+ points: [number, number][];
159
+ /** The same line as an SVG path with rounded corners; also valid for CSS `offset-path`. */
160
+ d: string;
161
+ /** Direction of travel of the last segment: "right" in "columns", "down" in "bands". */
162
+ dir: 'right' | 'down';
163
+ }
164
+ /** Routes every edge as an orthogonal line (horizontal and vertical segments, rounded corners)
165
+ * from the right border of its source card to the left border of its target card. A node
166
+ * attaches at its own center height, a group at its card's middle. Group boxes are clustered
167
+ * into sub-columns by x; the gaps between them (and 60 px outside the first and last) are
168
+ * channels, where vertical lanes run: one lane per source port (edges from a port share a
169
+ * trunk) and one per target port (edges into a port merge). An edge to a sub-column further
170
+ * right than the next travels along a horizontal corridor free of cards; backward edges and
171
+ * edges inside one sub-column do the same, mirrored. Two edges share a line only at a shared
172
+ * source or target port. Pure and deterministic; the result is keyed by edge id and skips
173
+ * edges with an unknown end. In a "bands" layout the same router runs on the transposed layout
174
+ * (x and y swapped) and the points are swapped back: lines leave the bottom border of the
175
+ * source card and enter the top border of the target card, and `dir` is "down". */
176
+ declare function routeEdges(layout: CanvasLayout, groups: CanvasGroup[], edges: CanvasEdge[]): Record<string, RoutedEdge>;
177
+
178
+ export { DEFAULT_CANVAS_LABELS, SystemCanvas, layoutSystem, pickLayout, routeEdges };
179
+ export type { CanvasEdge, CanvasEdgeKind, CanvasGroup, CanvasHue, CanvasLabels, CanvasLayout, CanvasLayoutMode, CanvasNode, CanvasNodeKind, LayoutOptions, RoutedEdge, SystemCanvasProps };
package/dist/theme.d.ts CHANGED
@@ -213,6 +213,20 @@ interface NishStrings {
213
213
  offlineBadge: string;
214
214
  /** FlowSteps: group label. */
215
215
  progress: string;
216
+ /** AgentNode: spoken state word. */
217
+ agentQueued: string;
218
+ /** AgentNode: spoken state word. */
219
+ agentRunning: string;
220
+ /** AgentNode: spoken state word. */
221
+ agentDone: string;
222
+ /** AgentNode: spoken state word. */
223
+ agentFailed: string;
224
+ /** FlowSteps: hidden text appended to a finished step. */
225
+ stepDone: string;
226
+ /** FlowSteps: hidden text appended to a failed step. */
227
+ stepFailed: string;
228
+ /** ResponsiveTable: label of the sort-direction button, from the current direction. */
229
+ sortToggle: (dir: 'asc' | 'desc' | null) => string;
216
230
  /** WorkflowBoard: group label. */
217
231
  workflow: string;
218
232
  /** ActivityFeed: group label. */
@@ -283,6 +297,8 @@ interface NishStrings {
283
297
  breadcrumbs: string;
284
298
  /** TagInput: remove button aria label. */
285
299
  removeTag: (tag: string) => string;
300
+ /** TagInput: shown when a tag is refused because the limit is reached. */
301
+ maxTags: (max: number) => string;
286
302
  /** FileDropzone: drop area text. */
287
303
  dropzoneLabel: string;
288
304
  /** FileDropzone: browse button. */
@@ -353,7 +369,7 @@ interface MountThemeToggleOptions {
353
369
  /** Replace the words "System", "Light" and "Dark" in the button's label, e.g. for
354
370
  * another language. The label reads "Theme: Light. Switch to Dark". */
355
371
  labels?: ThemeToggleLabels;
356
- /** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to DEFAULT_STRINGS. */
372
+ /** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to THEME_STRINGS. */
357
373
  strings?: Partial<Pick<NishStrings, 'themeToggleLabel'>>;
358
374
  /** The words after a preset saved on another site: "Theme: Mocha (set on another site). …".
359
375
  * Default "set on another site". */
@@ -398,7 +414,7 @@ interface ShowToastOptions {
398
414
  href?: string;
399
415
  onClick?: () => void;
400
416
  };
401
- /** Accessible name of the dismiss button. Default DEFAULT_STRINGS.dismiss ("Dismiss"). */
417
+ /** Accessible name of the dismiss button. Default DISPLAY_STRINGS.dismiss ("Dismiss"). */
402
418
  dismissLabel?: string;
403
419
  /** Strings for this toast (another language): `dismiss`. `dismissLabel` wins when both are given. */
404
420
  strings?: Partial<Pick<NishStrings, 'dismiss'>>;
@@ -416,7 +432,7 @@ interface ConfirmDialogOptions {
416
432
  body?: string | Node;
417
433
  /** The confirm button's label: a verb that names the action. Default "Confirm". */
418
434
  confirmLabel?: string;
419
- /** The cancel button's label. Default DEFAULT_STRINGS.cancel ("Cancel"). */
435
+ /** The cancel button's label. Default OVERLAY_STRINGS.cancel ("Cancel"). */
420
436
  cancelLabel?: string;
421
437
  /** Strings for this dialog (another language): `cancel`. `cancelLabel` wins when both are given. */
422
438
  strings?: Partial<Pick<NishStrings, 'cancel'>>;
@@ -470,8 +486,10 @@ interface MountScrollspyOptions {
470
486
  * has passed the offset, the first one at the top of the page), is scrolled into view
471
487
  * inside the nav, and the nav gets `data-at-start` / `data-at-end` for its edge fades.
472
488
  * Publishes the nav's height as `--nish-sticky-extra` so `.nish-scroll-target` clears it.
473
- * Returns a function that removes everything. */
474
- declare function mountScrollspy(nav: HTMLElement, o?: MountScrollspyOptions): () => void;
489
+ * Returns a function that removes everything; its `lock(id)` keeps that section's link current until the user scrolls. */
490
+ declare function mountScrollspy(nav: HTMLElement, o?: MountScrollspyOptions): (() => void) & {
491
+ lock: (id: string) => void;
492
+ };
475
493
  /** Persist a checklist: the `input[type=checkbox]` inside each `li[data-id]` of `list` is
476
494
  * saved to localStorage under `list.dataset.store` (a JSON array of checked ids) and
477
495
  * restored now. Updates the `.nish-checklist-progress` element before the list (or the
@@ -314,7 +314,7 @@ var nishTheme = (() => {
314
314
  var DEFAULT_THEME = "dark";
315
315
 
316
316
  // src/runtime.ts
317
- var version = true ? "2.2.0" : "dev";
317
+ var version = true ? "3.1.0" : "dev";
318
318
  var KEY = /* @__PURE__ */ Symbol.for("nish-ui.runtime.v1");
319
319
  function runtime() {
320
320
  var _a;
@@ -361,154 +361,30 @@ var nishTheme = (() => {
361
361
  }
362
362
 
363
363
  // src/components/strings.ts
364
- var DEFAULT_STRINGS = {
364
+ var OVERLAY_STRINGS = {
365
365
  close: "Close",
366
366
  cancel: "Cancel",
367
367
  menu: "Menu",
368
368
  back: "Back: ",
369
- contextMenu: "Actions",
370
- sortAnnounce: (header, dir) => dir ? `Sorted by ${header}, ${dir === "asc" ? "ascending" : "descending"}` : "Sorting cleared",
371
- dismiss: "Dismiss",
372
- moreCount: (count) => `${count} more`,
373
- copy: "Copy",
374
- copied: "Copied",
375
- hubTitle: "Back to nish.software",
376
- hubLabel: "\u2190 nish.software",
377
- moreActions: "More actions",
378
- more: "More",
379
- legend: "Legend",
380
- optional: "Optional",
381
- search: "Search",
382
- clearSearch: "Clear search",
383
- remove: "Remove",
384
- removeNamed: (name) => `Remove ${name}`,
385
- noMatches: "No matches",
386
- clear: "Clear",
387
- searching: "Searching\u2026",
388
- invalidDate: "Enter a valid date.",
389
- chooseDate: "Choose date",
390
- changeDate: (date) => `Change date, ${date}`,
391
- previousMonth: "Previous month",
392
- nextMonth: "Next month",
393
- month: "Month",
394
- year: "Year",
395
- dayToken: "DD",
396
- monthToken: "MM",
397
- yearToken: "YYYY",
398
- chooseDates: "Choose dates",
399
- changeDates: (range) => `Change dates, ${range}`,
400
- dateRange: (from, to) => `${from} to ${to}`,
401
- rangeStarted: (start) => `Start date ${start}. Pick the end date.`,
402
- invalidDateRange: "Enter a valid date range.",
403
- hour: "Hour",
404
- minute: "Minute",
405
- dayPeriod: "AM/PM",
406
- invalidTime: "Enter a valid time.",
407
- optionAdded: (l) => `Added ${l}`,
408
- optionRemoved: (l) => `Removed ${l}`,
409
- clearAll: "Clear all",
410
- maxSelected: (n) => `You can pick up to ${n}`,
411
- carouselRole: "carousel",
412
- slideRole: "slide",
413
- slideLabel: (n, c) => `${n} of ${c}`,
414
- previousSlide: "Previous slide",
415
- nextSlide: "Next slide",
416
- goToSlide: (n) => `Go to slide ${n}`,
417
- slidePicker: "Choose slide",
418
- startRotation: "Start slide rotation",
419
- stopRotation: "Stop slide rotation",
420
- searchPlaceholder: "Search\u2026",
421
- noResults: "No results",
422
- results: "Results",
423
- loading: "Loading",
424
- failedToLoad: "Failed to load",
425
- retry: "Retry",
426
- actions: "Actions",
427
- offline: "You're offline",
428
- nothingHere: "Nothing here yet",
429
- loadingNamed: (label) => `Loading ${label}`,
430
- sortBy: "Sort by",
431
- sortDefault: "Default",
432
- noData: "No data",
433
- noDataNamed: (label) => `${label}: no data`,
434
- filters: "Filters",
435
- clearFilters: "Clear filters",
436
- done: "Done",
437
- activeCount: (n) => `${n} active`,
438
- newCount: (value) => `${value} new`,
439
- sections: "Sections",
369
+ contextMenu: "Actions"
370
+ };
371
+ var THEME_STRINGS = {
440
372
  theme: "Theme",
441
- sidebar: "Sidebar",
442
- expandSidebar: "Expand sidebar",
443
- collapseSidebar: "Collapse sidebar",
444
- skipToContent: "Skip to content",
445
373
  themeSystem: "System",
446
374
  themeLight: "Light",
447
375
  themeDark: "Dark",
448
376
  themeToggleLabel: (current, next) => `Theme: ${current}. Switch to ${next}`,
449
377
  themePreset: "Theme preset",
450
- themePresetPlaceholder: "Preset\u2026",
451
- errorStaleTitle: "A new version is available",
452
- errorStaleBody: "Reload the page to get the latest version.",
453
- errorTitle: "Something went wrong",
454
- errorBody: "An unexpected error occurred.",
455
- errorDetails: "Details",
456
- errorTryAgain: "Try again",
457
- errorReload: "Reload page",
458
- saving: "Saving\u2026",
459
- saved: "Saved",
460
- saveFailed: "Could not save",
461
- enterNumber: "Enter a number",
462
- resizeColumns: "Resize columns",
463
- resizeRows: "Resize rows",
464
- layoutPresets: "Layout presets",
465
- live: "Live",
466
- offlineBadge: "Offline",
467
- progress: "Progress",
468
- workflow: "Workflow",
469
- activity: "Activity",
470
- other: "Other",
471
- waiting: "Waiting",
472
- noActivity: "No activity yet",
473
- systemMap: "System map",
474
- zoomOut: "Zoom out",
475
- zoomIn: "Zoom in",
476
- fitToScreen: "Fit to screen",
477
- followActivity: "Follow activity",
478
- canvasLines: "Lines",
479
- serviceTokens: "Service tokens",
480
- serviceTokensIntro: "Machine clients, like the nish MCP server, use these tokens to read this app. Revoking one stops it at once.",
481
- loadingServiceTokens: "Loading service tokens",
482
- tokenRevoke: "Revoke",
483
- tokenRevoked: "Revoked",
484
- tokenRevokedAt: (when) => `Revoked ${when}`,
485
- tokenRevokeNamed: (name) => `Revoke ${name}`,
486
- tokenRevokeTitle: (name) => `Revoke ${name}?`,
487
- tokenRevokeFailed: "Could not revoke the token.",
488
- inboxMarkHandled: "Mark handled",
489
- inboxSnooze: "Snooze",
490
- inboxActions: "Actions",
491
- inboxViews: "Inbox views",
492
- inboxOpen: "Open",
493
- inboxSnoozed: "Snoozed",
494
- inboxHandled: "Handled",
495
- inboxFilterBySource: "Filter by source",
496
- inboxHappened: (count) => `Happened ${count} times`,
497
- previousPage: "Previous page",
498
- nextPage: "Next page",
499
- pageLabel: (n) => `Page ${n}`,
500
- paginationLabel: "Pagination",
501
- breadcrumbs: "Breadcrumbs",
502
- removeTag: (tag) => `Remove ${tag}`,
503
- dropzoneLabel: "Drop files here or browse",
504
- browseFiles: "Browse files",
505
- removeFile: (name) => `Remove ${name}`,
506
- avatar: "Avatar",
507
- avatarMore: (count) => `${count} more`,
508
- sliderMin: "Minimum",
509
- sliderMax: "Maximum",
510
- accordion: "Accordion",
511
- progressIndeterminate: "Loading"
378
+ themePresetPlaceholder: "Preset\u2026"
379
+ };
380
+ var DISPLAY_STRINGS = {
381
+ dismiss: "Dismiss",
382
+ moreCount: (count) => `${count} more`,
383
+ copy: "Copy",
384
+ copied: "Copied",
385
+ legend: "Legend",
386
+ noData: "No data",
387
+ noDataNamed: (label) => `${label}: no data`
512
388
  };
513
389
 
514
390
  // src/theme.ts
@@ -703,9 +579,9 @@ var nishTheme = (() => {
703
579
  dark: [["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9" }]]
704
580
  };
705
581
  var defaultToggleLabels = () => ({
706
- system: DEFAULT_STRINGS.themeSystem,
707
- light: DEFAULT_STRINGS.themeLight,
708
- dark: DEFAULT_STRINGS.themeDark
582
+ system: THEME_STRINGS.themeSystem,
583
+ light: THEME_STRINGS.themeLight,
584
+ dark: THEME_STRINGS.themeDark
709
585
  });
710
586
  var DEFAULT_ELSEWHERE = "set on another site";
711
587
  function nextChoice(choice) {
@@ -720,7 +596,7 @@ var nishTheme = (() => {
720
596
  function mountThemeToggle(button, opts = {}) {
721
597
  var _a, _b, _c;
722
598
  const words = __spreadValues(__spreadValues({}, defaultToggleLabels()), opts.labels);
723
- const sentence = (_b = (_a = opts.strings) == null ? void 0 : _a.themeToggleLabel) != null ? _b : DEFAULT_STRINGS.themeToggleLabel;
599
+ const sentence = (_b = (_a = opts.strings) == null ? void 0 : _a.themeToggleLabel) != null ? _b : THEME_STRINGS.themeToggleLabel;
724
600
  const elsewhereWords = (_c = opts.elsewhereLabel) != null ? _c : DEFAULT_ELSEWHERE;
725
601
  if (button.tagName === "BUTTON" && !button.getAttribute("type")) button.setAttribute("type", "button");
726
602
  const children = Object.keys(TOGGLE_ICONS).map(
@@ -846,7 +722,7 @@ var nishTheme = (() => {
846
722
  const close = document.createElement("button");
847
723
  close.type = "button";
848
724
  close.className = "nish-toast-close";
849
- close.setAttribute("aria-label", (_e = (_d = opts.dismissLabel) != null ? _d : (_c = opts.strings) == null ? void 0 : _c.dismiss) != null ? _e : DEFAULT_STRINGS.dismiss);
725
+ close.setAttribute("aria-label", (_e = (_d = opts.dismissLabel) != null ? _d : (_c = opts.strings) == null ? void 0 : _c.dismiss) != null ? _e : DISPLAY_STRINGS.dismiss);
850
726
  close.append(svgIcon(14, [["path", { d: "M18 6 6 18M6 6l12 12" }]]));
851
727
  close.addEventListener("click", hide);
852
728
  box.append(close);
@@ -897,7 +773,7 @@ var nishTheme = (() => {
897
773
  b.textContent = label;
898
774
  return b;
899
775
  };
900
- const cancelBtn = button((_c = (_b = opts.cancelLabel) != null ? _b : (_a = opts.strings) == null ? void 0 : _a.cancel) != null ? _c : DEFAULT_STRINGS.cancel, "nish-btn");
776
+ const cancelBtn = button((_c = (_b = opts.cancelLabel) != null ? _b : (_a = opts.strings) == null ? void 0 : _a.cancel) != null ? _c : OVERLAY_STRINGS.cancel, "nish-btn");
901
777
  const confirmBtn = button((_d = opts.confirmLabel) != null ? _d : "Confirm", `nish-btn ${danger ? "nish-btn--danger" : "nish-btn--primary"}`);
902
778
  (danger ? cancelBtn : confirmBtn).autofocus = true;
903
779
  actions.append(cancelBtn, confirmBtn);
@@ -1157,7 +1033,8 @@ var nishTheme = (() => {
1157
1033
  };
1158
1034
  }
1159
1035
  function mountScrollspy(nav, o = {}) {
1160
- if (typeof document === "undefined") return () => void 0;
1036
+ const noop = Object.assign(() => void 0, { lock: (_id) => void 0 });
1037
+ if (typeof document === "undefined") return noop;
1161
1038
  const links = Array.from(nav.querySelectorAll('a[href^="#"]')).filter((a) => a.hash.length > 1);
1162
1039
  const target = (a) => {
1163
1040
  try {
@@ -1168,13 +1045,16 @@ var nishTheme = (() => {
1168
1045
  };
1169
1046
  const unheight = o.height === false ? () => void 0 : mountHeightVar(nav, "--nish-sticky-extra");
1170
1047
  let current = null;
1048
+ let locked = null;
1049
+ let unlockListeners = null;
1171
1050
  const edges = () => {
1172
1051
  const max = nav.scrollWidth - nav.clientWidth;
1173
- nav.dataset.atStart = String(nav.scrollLeft <= 1);
1174
- nav.dataset.atEnd = String(max <= 1 || nav.scrollLeft >= max - 1);
1052
+ const left = getComputedStyle(nav).direction === "rtl" ? nav.scrollLeft + max : nav.scrollLeft;
1053
+ nav.dataset.atStart = String(left <= 1);
1054
+ nav.dataset.atEnd = String(max <= 1 || left >= max - 1);
1175
1055
  };
1176
1056
  const reveal = (a) => {
1177
- const left = a.offsetLeft - nav.offsetLeft;
1057
+ const left = a.getBoundingClientRect().left - nav.getBoundingClientRect().left + nav.scrollLeft - nav.clientLeft;
1178
1058
  const view = nav.clientWidth;
1179
1059
  if (left < nav.scrollLeft + 24) nav.scrollLeft = Math.max(0, left - 24);
1180
1060
  else if (left + a.offsetWidth > nav.scrollLeft + view - 24) nav.scrollLeft = left + a.offsetWidth - view + 24;
@@ -1201,7 +1081,61 @@ var nishTheme = (() => {
1201
1081
  if (window.innerHeight + window.scrollY >= de.scrollHeight - 2) {
1202
1082
  for (const a of links) if (target(a)) found = a;
1203
1083
  }
1204
- activate(found);
1084
+ activate(locked != null ? locked : found);
1085
+ };
1086
+ const unlock = () => {
1087
+ unlockListeners == null ? void 0 : unlockListeners();
1088
+ unlockListeners = null;
1089
+ locked = null;
1090
+ };
1091
+ const lock = (id) => {
1092
+ const a = links.find((l) => {
1093
+ try {
1094
+ return decodeURIComponent(l.hash.slice(1)) === id;
1095
+ } catch (e) {
1096
+ return false;
1097
+ }
1098
+ });
1099
+ if (!a) return;
1100
+ unlock();
1101
+ locked = a;
1102
+ activate(a);
1103
+ const release = () => {
1104
+ unlock();
1105
+ schedule();
1106
+ };
1107
+ const onKey = (e) => {
1108
+ if (["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(e.key)) release();
1109
+ };
1110
+ let settled = false;
1111
+ const settle = () => {
1112
+ settled = true;
1113
+ };
1114
+ let t = setTimeout(settle, 400);
1115
+ const onScroll = () => {
1116
+ if (settled) release();
1117
+ else {
1118
+ clearTimeout(t);
1119
+ t = setTimeout(settle, 200);
1120
+ }
1121
+ };
1122
+ const onScrollEnd = () => {
1123
+ clearTimeout(t);
1124
+ t = setTimeout(settle, 50);
1125
+ };
1126
+ window.addEventListener("wheel", release, { passive: true });
1127
+ window.addEventListener("touchstart", release, { passive: true });
1128
+ window.addEventListener("keydown", onKey);
1129
+ window.addEventListener("scroll", onScroll, { passive: true });
1130
+ window.addEventListener("scrollend", onScrollEnd);
1131
+ unlockListeners = () => {
1132
+ clearTimeout(t);
1133
+ window.removeEventListener("wheel", release);
1134
+ window.removeEventListener("touchstart", release);
1135
+ window.removeEventListener("keydown", onKey);
1136
+ window.removeEventListener("scroll", onScroll);
1137
+ window.removeEventListener("scrollend", onScrollEnd);
1138
+ };
1205
1139
  };
1206
1140
  let frame = 0;
1207
1141
  const schedule = () => {
@@ -1229,7 +1163,8 @@ var nishTheme = (() => {
1229
1163
  });
1230
1164
  ro.observe(nav);
1231
1165
  }
1232
- return () => {
1166
+ const stop = () => {
1167
+ unlock();
1233
1168
  if (frame) cancelAnimationFrame(frame);
1234
1169
  window.removeEventListener("scroll", schedule);
1235
1170
  window.removeEventListener("resize", schedule);
@@ -1241,6 +1176,7 @@ var nishTheme = (() => {
1241
1176
  delete nav.dataset.atStart;
1242
1177
  delete nav.dataset.atEnd;
1243
1178
  };
1179
+ return Object.assign(stop, { lock });
1244
1180
  }
1245
1181
  function mountChecklist(list) {
1246
1182
  var _a, _b, _c;