nish-ui 2.2.0 → 3.0.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 (74) hide show
  1. package/README.md +5 -1
  2. package/dist/chart.js +1 -1
  3. package/dist/elements-all.js +58 -58
  4. package/dist/elements-charts.js +1 -1
  5. package/dist/elements-data.js +1 -1
  6. package/dist/elements-forms.js +1 -1
  7. package/dist/elements.js +4 -4
  8. package/dist/esm/components/accordion.js +3 -2
  9. package/dist/esm/components/app-shell.js +3 -2
  10. package/dist/esm/components/avatar.js +4 -3
  11. package/dist/esm/components/breadcrumbs.js +3 -2
  12. package/dist/esm/components/calendar-base.js +4 -3
  13. package/dist/esm/components/canvas/legend.js +3 -2
  14. package/dist/esm/components/canvas/node.js +3 -2
  15. package/dist/esm/components/canvas/system-canvas.js +3 -2
  16. package/dist/esm/components/carousel.js +3 -2
  17. package/dist/esm/components/charts.js +8 -7
  18. package/dist/esm/components/combobox.js +3 -2
  19. package/dist/esm/components/command.js +4 -3
  20. package/dist/esm/components/context-menu.js +3 -2
  21. package/dist/esm/components/data.js +4 -3
  22. package/dist/esm/components/date-picker.js +4 -3
  23. package/dist/esm/components/date-range-picker.js +4 -3
  24. package/dist/esm/components/display.js +7 -6
  25. package/dist/esm/components/drawer.js +3 -2
  26. package/dist/esm/components/error-boundary.js +4 -2
  27. package/dist/esm/components/feedback.js +7 -6
  28. package/dist/esm/components/file-dropzone.js +3 -2
  29. package/dist/esm/components/filters.js +4 -3
  30. package/dist/esm/components/flow.js +6 -5
  31. package/dist/esm/components/forms.js +13 -8
  32. package/dist/esm/components/hooks.js +2 -2
  33. package/dist/esm/components/hover-card.js +2 -2
  34. package/dist/esm/components/inbox.js +4 -2
  35. package/dist/esm/components/layout.js +5 -4
  36. package/dist/esm/components/media.js +3 -2
  37. package/dist/esm/components/menu.js +5 -4
  38. package/dist/esm/components/modal.js +4 -3
  39. package/dist/esm/components/more-sheet.js +3 -2
  40. package/dist/esm/components/multi-select.js +3 -2
  41. package/dist/esm/components/nav-items.js +4 -3
  42. package/dist/esm/components/nav.js +5 -4
  43. package/dist/esm/components/overlay-dialog.js +3 -2
  44. package/dist/esm/components/pagination.js +3 -2
  45. package/dist/esm/components/popover.js +2 -2
  46. package/dist/esm/components/portal.js +2 -2
  47. package/dist/esm/components/progress.js +3 -2
  48. package/dist/esm/components/provider.js +34 -5
  49. package/dist/esm/components/range-calendar.js +4 -3
  50. package/dist/esm/components/service-tokens.js +4 -3
  51. package/dist/esm/components/settings.js +4 -3
  52. package/dist/esm/components/slider.js +3 -2
  53. package/dist/esm/components/split.js +4 -3
  54. package/dist/esm/components/strings.js +174 -65
  55. package/dist/esm/components/tag-input.js +3 -2
  56. package/dist/esm/components/theme-toggle.js +3 -2
  57. package/dist/esm/components/time-field.js +4 -3
  58. package/dist/esm/components/toast-card.js +155 -0
  59. package/dist/esm/components/toast-store.js +136 -0
  60. package/dist/esm/components/toast.js +38 -241
  61. package/dist/esm/components/tooltip.js +2 -2
  62. package/dist/esm/components/virtual-table.js +3 -2
  63. package/dist/esm/index.js +0 -20
  64. package/dist/esm/runtime.js +1 -1
  65. package/dist/esm/system-canvas.js +4 -0
  66. package/dist/esm/theme.js +7 -7
  67. package/dist/format.js +1 -1
  68. package/dist/index.d.ts +11 -14
  69. package/dist/system-canvas.d.ts +183 -2
  70. package/dist/theme.d.ts +3 -3
  71. package/dist/theme.global.js +21 -145
  72. package/dist/theme.js +21 -145
  73. package/package.json +1 -1
  74. package/dist/system-canvas-BLuWd69H.d.ts +0 -183
@@ -1,2 +1,183 @@
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
+ /** A pannable, zoomable graph-paper canvas of grouped nodes joined by edges. Nodes with
100
+ * `active` pulse in their group's hue, edges into them flow, and `heat` leaves a fading
101
+ * glow behind. Drag or scroll to pan, ctrl+scroll or pinch to zoom, arrow keys, `+`, `-`
102
+ * and `0` from the keyboard. */
103
+ 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;
104
+
105
+ interface CanvasLayout {
106
+ mode: "columns" | "bands";
107
+ width: number;
108
+ height: number;
109
+ /** World px above y = 0 taken by the headers: 36 in "columns" (titles sit above the cards), 0 in "bands" (titles sit inside). */
110
+ titleRoom: number;
111
+ /** Top-left of each column's ("columns") or band's ("bands") title, world px; `index` is the column or band value. */
112
+ headers: {
113
+ index: number;
114
+ x: number;
115
+ y: number;
116
+ }[];
117
+ groups: Record<string, {
118
+ x: number;
119
+ y: number;
120
+ w: number;
121
+ h: number;
122
+ }>;
123
+ nodes: Record<string, {
124
+ x: number;
125
+ y: number;
126
+ w: number;
127
+ h: number;
128
+ }>;
129
+ }
130
+ /** Where every group and node sits, in world units (px at zoom 1). Pure and deterministic.
131
+ *
132
+ * "columns" (default): columns are the distinct `column` values in ascending order, groups
133
+ * stack in the order given, nodes sit in a 2-column grid inside their group (1 column for a
134
+ * group of one), and each column is centered against the tallest. The first sub-column starts
135
+ * 60 px in and `width` includes 60 px after the last, which is room for the edge lanes
136
+ * outside the cards.
137
+ *
138
+ * "bands": bands are the distinct `band ?? column` values in ascending order, stacked top to
139
+ * bottom; each band wraps its groups (by `column`, then input order) into rows no wider than
140
+ * `width`. The gaps between rows grow with the number of edge ends that need lanes there. */
141
+ interface LayoutOptions {
142
+ /** Default "columns". */
143
+ mode?: "columns" | "bands";
144
+ /** "bands" only: the widest a row of groups may get, world px (at least one group per row). */
145
+ width?: number;
146
+ /** "bands" only: used to size the gaps between rows for the edge lanes. */
147
+ edges?: CanvasEdge[];
148
+ columnGap?: number;
149
+ rowGap?: number;
150
+ }
151
+ declare function layoutSystem(groups: CanvasGroup[], o?: LayoutOptions): CanvasLayout;
152
+ /** The layout to show in a viewport of `viewport` px. "columns" and "bands" use that mode;
153
+ * "auto" picks whichever candidate shows the map biggest. Pure and deterministic. */
154
+ declare function pickLayout(groups: CanvasGroup[], edges: CanvasEdge[], viewport: {
155
+ w: number;
156
+ h: number;
157
+ }, mode?: CanvasLayoutMode): CanvasLayout;
158
+
159
+ interface RoutedEdge {
160
+ id: string;
161
+ /** The corners of the line, source port first. Every segment is horizontal or vertical. */
162
+ points: [number, number][];
163
+ /** The same line as an SVG path with rounded corners; also valid for CSS `offset-path`. */
164
+ d: string;
165
+ /** Direction of travel of the last segment: "right" in "columns", "down" in "bands". */
166
+ dir: 'right' | 'down';
167
+ }
168
+ /** Routes every edge as an orthogonal line (horizontal and vertical segments, rounded corners)
169
+ * from the right border of its source card to the left border of its target card. A node
170
+ * attaches at its own center height, a group at its card's middle. Group boxes are clustered
171
+ * into sub-columns by x; the gaps between them (and 60 px outside the first and last) are
172
+ * channels, where vertical lanes run: one lane per source port (edges from a port share a
173
+ * trunk) and one per target port (edges into a port merge). An edge to a sub-column further
174
+ * right than the next travels along a horizontal corridor free of cards; backward edges and
175
+ * edges inside one sub-column do the same, mirrored. Two edges share a line only at a shared
176
+ * source or target port. Pure and deterministic; the result is keyed by edge id and skips
177
+ * edges with an unknown end. In a "bands" layout the same router runs on the transposed layout
178
+ * (x and y swapped) and the points are swapped back: lines leave the bottom border of the
179
+ * source card and enter the top border of the target card, and `dir` is "down". */
180
+ declare function routeEdges(layout: CanvasLayout, groups: CanvasGroup[], edges: CanvasEdge[]): Record<string, RoutedEdge>;
181
+
182
+ export { DEFAULT_CANVAS_LABELS, SystemCanvas, layoutSystem, pickLayout, routeEdges };
183
+ export type { CanvasEdge, CanvasEdgeKind, CanvasGroup, CanvasHue, CanvasLabels, CanvasLayout, CanvasLayoutMode, CanvasNode, CanvasNodeKind, LayoutOptions, RoutedEdge, SystemCanvasProps };
package/dist/theme.d.ts CHANGED
@@ -353,7 +353,7 @@ interface MountThemeToggleOptions {
353
353
  /** Replace the words "System", "Light" and "Dark" in the button's label, e.g. for
354
354
  * another language. The label reads "Theme: Light. Switch to Dark". */
355
355
  labels?: ThemeToggleLabels;
356
- /** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to DEFAULT_STRINGS. */
356
+ /** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to THEME_STRINGS. */
357
357
  strings?: Partial<Pick<NishStrings, 'themeToggleLabel'>>;
358
358
  /** The words after a preset saved on another site: "Theme: Mocha (set on another site). …".
359
359
  * Default "set on another site". */
@@ -398,7 +398,7 @@ interface ShowToastOptions {
398
398
  href?: string;
399
399
  onClick?: () => void;
400
400
  };
401
- /** Accessible name of the dismiss button. Default DEFAULT_STRINGS.dismiss ("Dismiss"). */
401
+ /** Accessible name of the dismiss button. Default DISPLAY_STRINGS.dismiss ("Dismiss"). */
402
402
  dismissLabel?: string;
403
403
  /** Strings for this toast (another language): `dismiss`. `dismissLabel` wins when both are given. */
404
404
  strings?: Partial<Pick<NishStrings, 'dismiss'>>;
@@ -416,7 +416,7 @@ interface ConfirmDialogOptions {
416
416
  body?: string | Node;
417
417
  /** The confirm button's label: a verb that names the action. Default "Confirm". */
418
418
  confirmLabel?: string;
419
- /** The cancel button's label. Default DEFAULT_STRINGS.cancel ("Cancel"). */
419
+ /** The cancel button's label. Default OVERLAY_STRINGS.cancel ("Cancel"). */
420
420
  cancelLabel?: string;
421
421
  /** Strings for this dialog (another language): `cancel`. `cancelLabel` wins when both are given. */
422
422
  strings?: Partial<Pick<NishStrings, 'cancel'>>;
@@ -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.0.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);
package/dist/theme.js CHANGED
@@ -264,7 +264,7 @@ var THEMES = /* @__PURE__ */ Object.fromEntries(
264
264
  var DEFAULT_THEME = "dark";
265
265
 
266
266
  // src/runtime.ts
267
- var version = true ? "2.2.0" : "dev";
267
+ var version = true ? "3.0.0" : "dev";
268
268
  var KEY = /* @__PURE__ */ Symbol.for("nish-ui.runtime.v1");
269
269
  function runtime() {
270
270
  const g = globalThis;
@@ -309,154 +309,30 @@ function safeUrl(href) {
309
309
  }
310
310
 
311
311
  // src/components/strings.ts
312
- var DEFAULT_STRINGS = {
312
+ var OVERLAY_STRINGS = {
313
313
  close: "Close",
314
314
  cancel: "Cancel",
315
315
  menu: "Menu",
316
316
  back: "Back: ",
317
- contextMenu: "Actions",
318
- sortAnnounce: (header, dir) => dir ? `Sorted by ${header}, ${dir === "asc" ? "ascending" : "descending"}` : "Sorting cleared",
319
- dismiss: "Dismiss",
320
- moreCount: (count) => `${count} more`,
321
- copy: "Copy",
322
- copied: "Copied",
323
- hubTitle: "Back to nish.software",
324
- hubLabel: "\u2190 nish.software",
325
- moreActions: "More actions",
326
- more: "More",
327
- legend: "Legend",
328
- optional: "Optional",
329
- search: "Search",
330
- clearSearch: "Clear search",
331
- remove: "Remove",
332
- removeNamed: (name) => `Remove ${name}`,
333
- noMatches: "No matches",
334
- clear: "Clear",
335
- searching: "Searching\u2026",
336
- invalidDate: "Enter a valid date.",
337
- chooseDate: "Choose date",
338
- changeDate: (date) => `Change date, ${date}`,
339
- previousMonth: "Previous month",
340
- nextMonth: "Next month",
341
- month: "Month",
342
- year: "Year",
343
- dayToken: "DD",
344
- monthToken: "MM",
345
- yearToken: "YYYY",
346
- chooseDates: "Choose dates",
347
- changeDates: (range) => `Change dates, ${range}`,
348
- dateRange: (from, to) => `${from} to ${to}`,
349
- rangeStarted: (start) => `Start date ${start}. Pick the end date.`,
350
- invalidDateRange: "Enter a valid date range.",
351
- hour: "Hour",
352
- minute: "Minute",
353
- dayPeriod: "AM/PM",
354
- invalidTime: "Enter a valid time.",
355
- optionAdded: (l) => `Added ${l}`,
356
- optionRemoved: (l) => `Removed ${l}`,
357
- clearAll: "Clear all",
358
- maxSelected: (n) => `You can pick up to ${n}`,
359
- carouselRole: "carousel",
360
- slideRole: "slide",
361
- slideLabel: (n, c) => `${n} of ${c}`,
362
- previousSlide: "Previous slide",
363
- nextSlide: "Next slide",
364
- goToSlide: (n) => `Go to slide ${n}`,
365
- slidePicker: "Choose slide",
366
- startRotation: "Start slide rotation",
367
- stopRotation: "Stop slide rotation",
368
- searchPlaceholder: "Search\u2026",
369
- noResults: "No results",
370
- results: "Results",
371
- loading: "Loading",
372
- failedToLoad: "Failed to load",
373
- retry: "Retry",
374
- actions: "Actions",
375
- offline: "You're offline",
376
- nothingHere: "Nothing here yet",
377
- loadingNamed: (label) => `Loading ${label}`,
378
- sortBy: "Sort by",
379
- sortDefault: "Default",
380
- noData: "No data",
381
- noDataNamed: (label) => `${label}: no data`,
382
- filters: "Filters",
383
- clearFilters: "Clear filters",
384
- done: "Done",
385
- activeCount: (n) => `${n} active`,
386
- newCount: (value) => `${value} new`,
387
- sections: "Sections",
317
+ contextMenu: "Actions"
318
+ };
319
+ var THEME_STRINGS = {
388
320
  theme: "Theme",
389
- sidebar: "Sidebar",
390
- expandSidebar: "Expand sidebar",
391
- collapseSidebar: "Collapse sidebar",
392
- skipToContent: "Skip to content",
393
321
  themeSystem: "System",
394
322
  themeLight: "Light",
395
323
  themeDark: "Dark",
396
324
  themeToggleLabel: (current, next) => `Theme: ${current}. Switch to ${next}`,
397
325
  themePreset: "Theme preset",
398
- themePresetPlaceholder: "Preset\u2026",
399
- errorStaleTitle: "A new version is available",
400
- errorStaleBody: "Reload the page to get the latest version.",
401
- errorTitle: "Something went wrong",
402
- errorBody: "An unexpected error occurred.",
403
- errorDetails: "Details",
404
- errorTryAgain: "Try again",
405
- errorReload: "Reload page",
406
- saving: "Saving\u2026",
407
- saved: "Saved",
408
- saveFailed: "Could not save",
409
- enterNumber: "Enter a number",
410
- resizeColumns: "Resize columns",
411
- resizeRows: "Resize rows",
412
- layoutPresets: "Layout presets",
413
- live: "Live",
414
- offlineBadge: "Offline",
415
- progress: "Progress",
416
- workflow: "Workflow",
417
- activity: "Activity",
418
- other: "Other",
419
- waiting: "Waiting",
420
- noActivity: "No activity yet",
421
- systemMap: "System map",
422
- zoomOut: "Zoom out",
423
- zoomIn: "Zoom in",
424
- fitToScreen: "Fit to screen",
425
- followActivity: "Follow activity",
426
- canvasLines: "Lines",
427
- serviceTokens: "Service tokens",
428
- serviceTokensIntro: "Machine clients, like the nish MCP server, use these tokens to read this app. Revoking one stops it at once.",
429
- loadingServiceTokens: "Loading service tokens",
430
- tokenRevoke: "Revoke",
431
- tokenRevoked: "Revoked",
432
- tokenRevokedAt: (when) => `Revoked ${when}`,
433
- tokenRevokeNamed: (name) => `Revoke ${name}`,
434
- tokenRevokeTitle: (name) => `Revoke ${name}?`,
435
- tokenRevokeFailed: "Could not revoke the token.",
436
- inboxMarkHandled: "Mark handled",
437
- inboxSnooze: "Snooze",
438
- inboxActions: "Actions",
439
- inboxViews: "Inbox views",
440
- inboxOpen: "Open",
441
- inboxSnoozed: "Snoozed",
442
- inboxHandled: "Handled",
443
- inboxFilterBySource: "Filter by source",
444
- inboxHappened: (count) => `Happened ${count} times`,
445
- previousPage: "Previous page",
446
- nextPage: "Next page",
447
- pageLabel: (n) => `Page ${n}`,
448
- paginationLabel: "Pagination",
449
- breadcrumbs: "Breadcrumbs",
450
- removeTag: (tag) => `Remove ${tag}`,
451
- dropzoneLabel: "Drop files here or browse",
452
- browseFiles: "Browse files",
453
- removeFile: (name) => `Remove ${name}`,
454
- avatar: "Avatar",
455
- avatarMore: (count) => `${count} more`,
456
- sliderMin: "Minimum",
457
- sliderMax: "Maximum",
458
- accordion: "Accordion",
459
- progressIndeterminate: "Loading"
326
+ themePresetPlaceholder: "Preset\u2026"
327
+ };
328
+ var DISPLAY_STRINGS = {
329
+ dismiss: "Dismiss",
330
+ moreCount: (count) => `${count} more`,
331
+ copy: "Copy",
332
+ copied: "Copied",
333
+ legend: "Legend",
334
+ noData: "No data",
335
+ noDataNamed: (label) => `${label}: no data`
460
336
  };
461
337
 
462
338
  // src/theme.ts
@@ -658,9 +534,9 @@ var TOGGLE_ICONS = {
658
534
  dark: [["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9" }]]
659
535
  };
660
536
  var defaultToggleLabels = () => ({
661
- system: DEFAULT_STRINGS.themeSystem,
662
- light: DEFAULT_STRINGS.themeLight,
663
- dark: DEFAULT_STRINGS.themeDark
537
+ system: THEME_STRINGS.themeSystem,
538
+ light: THEME_STRINGS.themeLight,
539
+ dark: THEME_STRINGS.themeDark
664
540
  });
665
541
  var DEFAULT_ELSEWHERE = "set on another site";
666
542
  function nextChoice(choice) {
@@ -674,7 +550,7 @@ function themeLabel(choice, words) {
674
550
  }
675
551
  function mountThemeToggle(button, opts = {}) {
676
552
  const words = { ...defaultToggleLabels(), ...opts.labels };
677
- const sentence = opts.strings?.themeToggleLabel ?? DEFAULT_STRINGS.themeToggleLabel;
553
+ const sentence = opts.strings?.themeToggleLabel ?? THEME_STRINGS.themeToggleLabel;
678
554
  const elsewhereWords = opts.elsewhereLabel ?? DEFAULT_ELSEWHERE;
679
555
  if (button.tagName === "BUTTON" && !button.getAttribute("type")) button.setAttribute("type", "button");
680
556
  const children = Object.keys(TOGGLE_ICONS).map(
@@ -798,7 +674,7 @@ function showToast(content, opts = {}) {
798
674
  const close = document.createElement("button");
799
675
  close.type = "button";
800
676
  close.className = "nish-toast-close";
801
- close.setAttribute("aria-label", opts.dismissLabel ?? opts.strings?.dismiss ?? DEFAULT_STRINGS.dismiss);
677
+ close.setAttribute("aria-label", opts.dismissLabel ?? opts.strings?.dismiss ?? DISPLAY_STRINGS.dismiss);
802
678
  close.append(svgIcon(14, [["path", { d: "M18 6 6 18M6 6l12 12" }]]));
803
679
  close.addEventListener("click", hide);
804
680
  box.append(close);
@@ -848,7 +724,7 @@ function confirmDialog(opts) {
848
724
  b.textContent = label;
849
725
  return b;
850
726
  };
851
- const cancelBtn = button(opts.cancelLabel ?? opts.strings?.cancel ?? DEFAULT_STRINGS.cancel, "nish-btn");
727
+ const cancelBtn = button(opts.cancelLabel ?? opts.strings?.cancel ?? OVERLAY_STRINGS.cancel, "nish-btn");
852
728
  const confirmBtn = button(opts.confirmLabel ?? "Confirm", `nish-btn ${danger ? "nish-btn--danger" : "nish-btn--primary"}`);
853
729
  (danger ? cancelBtn : confirmBtn).autofocus = true;
854
730
  actions.append(cancelBtn, confirmBtn);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nish-ui",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
4
4
  "description": "Design tokens, seven themes, flash-free theme switching and accessible React 19 components for Tailwind 4, plain CSS and static HTML. Live docs: https://design.nish.software",
5
5
  "license": "MIT",
6
6
  "author": "Nishant Arora",