nish-ui 2.1.3 → 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 (78) hide show
  1. package/README.md +6 -2
  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 +292 -0
  13. package/dist/esm/components/calendar-classes.js +78 -0
  14. package/dist/esm/components/calendar.js +22 -254
  15. package/dist/esm/components/canvas/legend.js +3 -2
  16. package/dist/esm/components/canvas/node.js +3 -2
  17. package/dist/esm/components/canvas/system-canvas.js +3 -2
  18. package/dist/esm/components/carousel.js +3 -2
  19. package/dist/esm/components/charts.js +8 -7
  20. package/dist/esm/components/combobox.js +3 -2
  21. package/dist/esm/components/command.js +4 -3
  22. package/dist/esm/components/context-menu.js +3 -2
  23. package/dist/esm/components/data.js +4 -3
  24. package/dist/esm/components/date-picker.js +4 -3
  25. package/dist/esm/components/date-range-picker.js +214 -0
  26. package/dist/esm/components/display.js +7 -6
  27. package/dist/esm/components/drawer.js +3 -2
  28. package/dist/esm/components/error-boundary.js +4 -2
  29. package/dist/esm/components/feedback.js +7 -6
  30. package/dist/esm/components/file-dropzone.js +3 -2
  31. package/dist/esm/components/filters.js +4 -3
  32. package/dist/esm/components/flow.js +6 -5
  33. package/dist/esm/components/forms.js +14 -8
  34. package/dist/esm/components/hooks.js +2 -2
  35. package/dist/esm/components/hover-card.js +2 -2
  36. package/dist/esm/components/inbox.js +4 -2
  37. package/dist/esm/components/layout.js +5 -4
  38. package/dist/esm/components/media.js +3 -2
  39. package/dist/esm/components/menu.js +5 -4
  40. package/dist/esm/components/modal.js +4 -3
  41. package/dist/esm/components/more-sheet.js +3 -2
  42. package/dist/esm/components/multi-select.js +3 -2
  43. package/dist/esm/components/nav-items.js +4 -3
  44. package/dist/esm/components/nav.js +5 -4
  45. package/dist/esm/components/overlay-dialog.js +3 -2
  46. package/dist/esm/components/pagination.js +3 -2
  47. package/dist/esm/components/popover.js +2 -2
  48. package/dist/esm/components/portal.js +2 -2
  49. package/dist/esm/components/progress.js +3 -2
  50. package/dist/esm/components/provider.js +34 -5
  51. package/dist/esm/components/range-calendar.js +123 -0
  52. package/dist/esm/components/service-tokens.js +4 -3
  53. package/dist/esm/components/settings.js +4 -3
  54. package/dist/esm/components/slider.js +3 -2
  55. package/dist/esm/components/split.js +4 -3
  56. package/dist/esm/components/strings.js +178 -60
  57. package/dist/esm/components/tag-input.js +3 -2
  58. package/dist/esm/components/theme-toggle.js +3 -2
  59. package/dist/esm/components/time-field-classes.js +110 -0
  60. package/dist/esm/components/time-field.js +309 -0
  61. package/dist/esm/components/toast-card.js +155 -0
  62. package/dist/esm/components/toast-store.js +136 -0
  63. package/dist/esm/components/toast.js +38 -241
  64. package/dist/esm/components/tooltip.js +2 -2
  65. package/dist/esm/components/tree-view.js +40 -46
  66. package/dist/esm/components/virtual-table.js +3 -2
  67. package/dist/esm/index.js +6 -20
  68. package/dist/esm/runtime.js +1 -1
  69. package/dist/esm/system-canvas.js +4 -0
  70. package/dist/esm/theme.js +7 -7
  71. package/dist/format.js +1 -1
  72. package/dist/index.d.ts +172 -24
  73. package/dist/system-canvas.d.ts +183 -2
  74. package/dist/theme.d.ts +21 -3
  75. package/dist/theme.global.js +21 -136
  76. package/dist/theme.js +21 -136
  77. package/package.json +1 -1
  78. package/dist/system-canvas-BLuWd69H.d.ts +0 -183
@@ -314,7 +314,7 @@ var nishTheme = (() => {
314
314
  var DEFAULT_THEME = "dark";
315
315
 
316
316
  // src/runtime.ts
317
- var version = true ? "2.1.3" : "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,145 +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
- optionAdded: (l) => `Added ${l}`,
399
- optionRemoved: (l) => `Removed ${l}`,
400
- clearAll: "Clear all",
401
- maxSelected: (n) => `You can pick up to ${n}`,
402
- carouselRole: "carousel",
403
- slideRole: "slide",
404
- slideLabel: (n, c) => `${n} of ${c}`,
405
- previousSlide: "Previous slide",
406
- nextSlide: "Next slide",
407
- goToSlide: (n) => `Go to slide ${n}`,
408
- slidePicker: "Choose slide",
409
- startRotation: "Start slide rotation",
410
- stopRotation: "Stop slide rotation",
411
- searchPlaceholder: "Search\u2026",
412
- noResults: "No results",
413
- results: "Results",
414
- loading: "Loading",
415
- failedToLoad: "Failed to load",
416
- retry: "Retry",
417
- actions: "Actions",
418
- offline: "You're offline",
419
- nothingHere: "Nothing here yet",
420
- loadingNamed: (label) => `Loading ${label}`,
421
- sortBy: "Sort by",
422
- sortDefault: "Default",
423
- noData: "No data",
424
- noDataNamed: (label) => `${label}: no data`,
425
- filters: "Filters",
426
- clearFilters: "Clear filters",
427
- done: "Done",
428
- activeCount: (n) => `${n} active`,
429
- newCount: (value) => `${value} new`,
430
- sections: "Sections",
369
+ contextMenu: "Actions"
370
+ };
371
+ var THEME_STRINGS = {
431
372
  theme: "Theme",
432
- sidebar: "Sidebar",
433
- expandSidebar: "Expand sidebar",
434
- collapseSidebar: "Collapse sidebar",
435
- skipToContent: "Skip to content",
436
373
  themeSystem: "System",
437
374
  themeLight: "Light",
438
375
  themeDark: "Dark",
439
376
  themeToggleLabel: (current, next) => `Theme: ${current}. Switch to ${next}`,
440
377
  themePreset: "Theme preset",
441
- themePresetPlaceholder: "Preset\u2026",
442
- errorStaleTitle: "A new version is available",
443
- errorStaleBody: "Reload the page to get the latest version.",
444
- errorTitle: "Something went wrong",
445
- errorBody: "An unexpected error occurred.",
446
- errorDetails: "Details",
447
- errorTryAgain: "Try again",
448
- errorReload: "Reload page",
449
- saving: "Saving\u2026",
450
- saved: "Saved",
451
- saveFailed: "Could not save",
452
- enterNumber: "Enter a number",
453
- resizeColumns: "Resize columns",
454
- resizeRows: "Resize rows",
455
- layoutPresets: "Layout presets",
456
- live: "Live",
457
- offlineBadge: "Offline",
458
- progress: "Progress",
459
- workflow: "Workflow",
460
- activity: "Activity",
461
- other: "Other",
462
- waiting: "Waiting",
463
- noActivity: "No activity yet",
464
- systemMap: "System map",
465
- zoomOut: "Zoom out",
466
- zoomIn: "Zoom in",
467
- fitToScreen: "Fit to screen",
468
- followActivity: "Follow activity",
469
- canvasLines: "Lines",
470
- serviceTokens: "Service tokens",
471
- serviceTokensIntro: "Machine clients, like the nish MCP server, use these tokens to read this app. Revoking one stops it at once.",
472
- loadingServiceTokens: "Loading service tokens",
473
- tokenRevoke: "Revoke",
474
- tokenRevoked: "Revoked",
475
- tokenRevokedAt: (when) => `Revoked ${when}`,
476
- tokenRevokeNamed: (name) => `Revoke ${name}`,
477
- tokenRevokeTitle: (name) => `Revoke ${name}?`,
478
- tokenRevokeFailed: "Could not revoke the token.",
479
- inboxMarkHandled: "Mark handled",
480
- inboxSnooze: "Snooze",
481
- inboxActions: "Actions",
482
- inboxViews: "Inbox views",
483
- inboxOpen: "Open",
484
- inboxSnoozed: "Snoozed",
485
- inboxHandled: "Handled",
486
- inboxFilterBySource: "Filter by source",
487
- inboxHappened: (count) => `Happened ${count} times`,
488
- previousPage: "Previous page",
489
- nextPage: "Next page",
490
- pageLabel: (n) => `Page ${n}`,
491
- paginationLabel: "Pagination",
492
- breadcrumbs: "Breadcrumbs",
493
- removeTag: (tag) => `Remove ${tag}`,
494
- dropzoneLabel: "Drop files here or browse",
495
- browseFiles: "Browse files",
496
- removeFile: (name) => `Remove ${name}`,
497
- avatar: "Avatar",
498
- avatarMore: (count) => `${count} more`,
499
- sliderMin: "Minimum",
500
- sliderMax: "Maximum",
501
- accordion: "Accordion",
502
- 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`
503
388
  };
504
389
 
505
390
  // src/theme.ts
@@ -694,9 +579,9 @@ var nishTheme = (() => {
694
579
  dark: [["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9" }]]
695
580
  };
696
581
  var defaultToggleLabels = () => ({
697
- system: DEFAULT_STRINGS.themeSystem,
698
- light: DEFAULT_STRINGS.themeLight,
699
- dark: DEFAULT_STRINGS.themeDark
582
+ system: THEME_STRINGS.themeSystem,
583
+ light: THEME_STRINGS.themeLight,
584
+ dark: THEME_STRINGS.themeDark
700
585
  });
701
586
  var DEFAULT_ELSEWHERE = "set on another site";
702
587
  function nextChoice(choice) {
@@ -711,7 +596,7 @@ var nishTheme = (() => {
711
596
  function mountThemeToggle(button, opts = {}) {
712
597
  var _a, _b, _c;
713
598
  const words = __spreadValues(__spreadValues({}, defaultToggleLabels()), opts.labels);
714
- 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;
715
600
  const elsewhereWords = (_c = opts.elsewhereLabel) != null ? _c : DEFAULT_ELSEWHERE;
716
601
  if (button.tagName === "BUTTON" && !button.getAttribute("type")) button.setAttribute("type", "button");
717
602
  const children = Object.keys(TOGGLE_ICONS).map(
@@ -837,7 +722,7 @@ var nishTheme = (() => {
837
722
  const close = document.createElement("button");
838
723
  close.type = "button";
839
724
  close.className = "nish-toast-close";
840
- 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);
841
726
  close.append(svgIcon(14, [["path", { d: "M18 6 6 18M6 6l12 12" }]]));
842
727
  close.addEventListener("click", hide);
843
728
  box.append(close);
@@ -888,7 +773,7 @@ var nishTheme = (() => {
888
773
  b.textContent = label;
889
774
  return b;
890
775
  };
891
- 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");
892
777
  const confirmBtn = button((_d = opts.confirmLabel) != null ? _d : "Confirm", `nish-btn ${danger ? "nish-btn--danger" : "nish-btn--primary"}`);
893
778
  (danger ? cancelBtn : confirmBtn).autofocus = true;
894
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.1.3" : "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,145 +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
- optionAdded: (l) => `Added ${l}`,
347
- optionRemoved: (l) => `Removed ${l}`,
348
- clearAll: "Clear all",
349
- maxSelected: (n) => `You can pick up to ${n}`,
350
- carouselRole: "carousel",
351
- slideRole: "slide",
352
- slideLabel: (n, c) => `${n} of ${c}`,
353
- previousSlide: "Previous slide",
354
- nextSlide: "Next slide",
355
- goToSlide: (n) => `Go to slide ${n}`,
356
- slidePicker: "Choose slide",
357
- startRotation: "Start slide rotation",
358
- stopRotation: "Stop slide rotation",
359
- searchPlaceholder: "Search\u2026",
360
- noResults: "No results",
361
- results: "Results",
362
- loading: "Loading",
363
- failedToLoad: "Failed to load",
364
- retry: "Retry",
365
- actions: "Actions",
366
- offline: "You're offline",
367
- nothingHere: "Nothing here yet",
368
- loadingNamed: (label) => `Loading ${label}`,
369
- sortBy: "Sort by",
370
- sortDefault: "Default",
371
- noData: "No data",
372
- noDataNamed: (label) => `${label}: no data`,
373
- filters: "Filters",
374
- clearFilters: "Clear filters",
375
- done: "Done",
376
- activeCount: (n) => `${n} active`,
377
- newCount: (value) => `${value} new`,
378
- sections: "Sections",
317
+ contextMenu: "Actions"
318
+ };
319
+ var THEME_STRINGS = {
379
320
  theme: "Theme",
380
- sidebar: "Sidebar",
381
- expandSidebar: "Expand sidebar",
382
- collapseSidebar: "Collapse sidebar",
383
- skipToContent: "Skip to content",
384
321
  themeSystem: "System",
385
322
  themeLight: "Light",
386
323
  themeDark: "Dark",
387
324
  themeToggleLabel: (current, next) => `Theme: ${current}. Switch to ${next}`,
388
325
  themePreset: "Theme preset",
389
- themePresetPlaceholder: "Preset\u2026",
390
- errorStaleTitle: "A new version is available",
391
- errorStaleBody: "Reload the page to get the latest version.",
392
- errorTitle: "Something went wrong",
393
- errorBody: "An unexpected error occurred.",
394
- errorDetails: "Details",
395
- errorTryAgain: "Try again",
396
- errorReload: "Reload page",
397
- saving: "Saving\u2026",
398
- saved: "Saved",
399
- saveFailed: "Could not save",
400
- enterNumber: "Enter a number",
401
- resizeColumns: "Resize columns",
402
- resizeRows: "Resize rows",
403
- layoutPresets: "Layout presets",
404
- live: "Live",
405
- offlineBadge: "Offline",
406
- progress: "Progress",
407
- workflow: "Workflow",
408
- activity: "Activity",
409
- other: "Other",
410
- waiting: "Waiting",
411
- noActivity: "No activity yet",
412
- systemMap: "System map",
413
- zoomOut: "Zoom out",
414
- zoomIn: "Zoom in",
415
- fitToScreen: "Fit to screen",
416
- followActivity: "Follow activity",
417
- canvasLines: "Lines",
418
- serviceTokens: "Service tokens",
419
- serviceTokensIntro: "Machine clients, like the nish MCP server, use these tokens to read this app. Revoking one stops it at once.",
420
- loadingServiceTokens: "Loading service tokens",
421
- tokenRevoke: "Revoke",
422
- tokenRevoked: "Revoked",
423
- tokenRevokedAt: (when) => `Revoked ${when}`,
424
- tokenRevokeNamed: (name) => `Revoke ${name}`,
425
- tokenRevokeTitle: (name) => `Revoke ${name}?`,
426
- tokenRevokeFailed: "Could not revoke the token.",
427
- inboxMarkHandled: "Mark handled",
428
- inboxSnooze: "Snooze",
429
- inboxActions: "Actions",
430
- inboxViews: "Inbox views",
431
- inboxOpen: "Open",
432
- inboxSnoozed: "Snoozed",
433
- inboxHandled: "Handled",
434
- inboxFilterBySource: "Filter by source",
435
- inboxHappened: (count) => `Happened ${count} times`,
436
- previousPage: "Previous page",
437
- nextPage: "Next page",
438
- pageLabel: (n) => `Page ${n}`,
439
- paginationLabel: "Pagination",
440
- breadcrumbs: "Breadcrumbs",
441
- removeTag: (tag) => `Remove ${tag}`,
442
- dropzoneLabel: "Drop files here or browse",
443
- browseFiles: "Browse files",
444
- removeFile: (name) => `Remove ${name}`,
445
- avatar: "Avatar",
446
- avatarMore: (count) => `${count} more`,
447
- sliderMin: "Minimum",
448
- sliderMax: "Maximum",
449
- accordion: "Accordion",
450
- 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`
451
336
  };
452
337
 
453
338
  // src/theme.ts
@@ -649,9 +534,9 @@ var TOGGLE_ICONS = {
649
534
  dark: [["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9" }]]
650
535
  };
651
536
  var defaultToggleLabels = () => ({
652
- system: DEFAULT_STRINGS.themeSystem,
653
- light: DEFAULT_STRINGS.themeLight,
654
- dark: DEFAULT_STRINGS.themeDark
537
+ system: THEME_STRINGS.themeSystem,
538
+ light: THEME_STRINGS.themeLight,
539
+ dark: THEME_STRINGS.themeDark
655
540
  });
656
541
  var DEFAULT_ELSEWHERE = "set on another site";
657
542
  function nextChoice(choice) {
@@ -665,7 +550,7 @@ function themeLabel(choice, words) {
665
550
  }
666
551
  function mountThemeToggle(button, opts = {}) {
667
552
  const words = { ...defaultToggleLabels(), ...opts.labels };
668
- const sentence = opts.strings?.themeToggleLabel ?? DEFAULT_STRINGS.themeToggleLabel;
553
+ const sentence = opts.strings?.themeToggleLabel ?? THEME_STRINGS.themeToggleLabel;
669
554
  const elsewhereWords = opts.elsewhereLabel ?? DEFAULT_ELSEWHERE;
670
555
  if (button.tagName === "BUTTON" && !button.getAttribute("type")) button.setAttribute("type", "button");
671
556
  const children = Object.keys(TOGGLE_ICONS).map(
@@ -789,7 +674,7 @@ function showToast(content, opts = {}) {
789
674
  const close = document.createElement("button");
790
675
  close.type = "button";
791
676
  close.className = "nish-toast-close";
792
- 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);
793
678
  close.append(svgIcon(14, [["path", { d: "M18 6 6 18M6 6l12 12" }]]));
794
679
  close.addEventListener("click", hide);
795
680
  box.append(close);
@@ -839,7 +724,7 @@ function confirmDialog(opts) {
839
724
  b.textContent = label;
840
725
  return b;
841
726
  };
842
- 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");
843
728
  const confirmBtn = button(opts.confirmLabel ?? "Confirm", `nish-btn ${danger ? "nish-btn--danger" : "nish-btn--primary"}`);
844
729
  (danger ? cancelBtn : confirmBtn).autofocus = true;
845
730
  actions.append(cancelBtn, confirmBtn);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nish-ui",
3
- "version": "2.1.3",
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",
@@ -1,183 +0,0 @@
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 as D, SystemCanvas as S, layoutSystem as l, pickLayout as p, routeEdges as r };
183
- export type { CanvasEdge as C, LayoutOptions as L, RoutedEdge as R, CanvasEdgeKind as a, CanvasGroup as b, CanvasHue as c, CanvasLabels as d, CanvasLayout as e, CanvasLayoutMode as f, CanvasNode as g, CanvasNodeKind as h, SystemCanvasProps as i };