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.
- package/README.md +10 -6
- package/dist/chart.d.ts +8 -3
- package/dist/chart.js +2 -417
- package/dist/elements-all.js +81 -80
- package/dist/elements-charts.d.ts +7 -1
- package/dist/elements-charts.js +16 -16
- package/dist/elements-data.d.ts +7 -1
- package/dist/elements-data.js +5 -5
- package/dist/elements-forms.d.ts +7 -1
- package/dist/elements-forms.js +18 -17
- package/dist/elements.d.ts +7 -1
- package/dist/elements.js +4 -4
- package/dist/esm/components/accordion.js +3 -2
- package/dist/esm/components/app-shell.js +3 -2
- package/dist/esm/components/avatar.js +6 -5
- package/dist/esm/components/breadcrumbs.js +3 -2
- package/dist/esm/components/calendar-base.js +4 -3
- package/dist/esm/components/canvas/legend.js +7 -6
- package/dist/esm/components/canvas/node.js +3 -2
- package/dist/esm/components/canvas/system-canvas.js +27 -3
- package/dist/esm/components/carousel.js +24 -5
- package/dist/esm/components/charts.js +29 -20
- package/dist/esm/components/combobox.js +4 -3
- package/dist/esm/components/command.js +4 -3
- package/dist/esm/components/context-menu.js +3 -2
- package/dist/esm/components/data-classes.js +5 -4
- package/dist/esm/components/data.js +5 -8
- package/dist/esm/components/date-picker.js +5 -3
- package/dist/esm/components/date-range-picker.js +5 -3
- package/dist/esm/components/display.js +10 -9
- package/dist/esm/components/drawer.js +3 -2
- package/dist/esm/components/error-boundary.js +4 -2
- package/dist/esm/components/feedback.js +7 -6
- package/dist/esm/components/file-dropzone.js +24 -3
- package/dist/esm/components/filters.js +7 -4
- package/dist/esm/components/flow.js +17 -15
- package/dist/esm/components/forms.js +37 -10
- package/dist/esm/components/hooks.js +22 -19
- package/dist/esm/components/hover-card.js +2 -2
- package/dist/esm/components/inbox.js +12 -8
- package/dist/esm/components/layout-vars.js +10 -7
- package/dist/esm/components/layout.js +5 -4
- package/dist/esm/components/media.js +3 -2
- package/dist/esm/components/menu.js +12 -8
- package/dist/esm/components/modal.js +4 -3
- package/dist/esm/components/more-sheet.js +3 -2
- package/dist/esm/components/multi-select.js +10 -6
- package/dist/esm/components/nav-items.js +4 -3
- package/dist/esm/components/nav.js +5 -4
- package/dist/esm/components/overlay-core.js +31 -10
- package/dist/esm/components/overlay-dialog.js +20 -4
- package/dist/esm/components/pagination.js +7 -3
- package/dist/esm/components/popover.js +17 -11
- package/dist/esm/components/portal.js +2 -2
- package/dist/esm/components/primitives.js +1 -1
- package/dist/esm/components/progress.js +5 -2
- package/dist/esm/components/provider.js +34 -5
- package/dist/esm/components/range-calendar.js +4 -3
- package/dist/esm/components/resource-classes.js +34 -16
- package/dist/esm/components/resource.js +5 -4
- package/dist/esm/components/service-tokens.js +4 -3
- package/dist/esm/components/settings.js +8 -5
- package/dist/esm/components/slider.js +4 -2
- package/dist/esm/components/split.js +4 -3
- package/dist/esm/components/strings.js +182 -65
- package/dist/esm/components/tag-input.js +18 -9
- package/dist/esm/components/theme-toggle.js +3 -2
- package/dist/esm/components/time-field-classes.js +5 -2
- package/dist/esm/components/time-field.js +19 -10
- package/dist/esm/components/toast-card.js +155 -0
- package/dist/esm/components/toast-store.js +136 -0
- package/dist/esm/components/toast.js +38 -241
- package/dist/esm/components/tooltip.js +3 -3
- package/dist/esm/components/url-state.js +1 -0
- package/dist/esm/components/virtual-table.js +11 -4
- package/dist/esm/components/virtual.js +16 -2
- package/dist/esm/format.js +17 -14
- package/dist/esm/index.js +0 -20
- package/dist/esm/runtime.js +1 -1
- package/dist/esm/server/inbox/client.js +1 -1
- package/dist/esm/system-canvas.js +4 -0
- package/dist/esm/theme.js +73 -13
- package/dist/format.js +18 -15
- package/dist/inbox-client.js +1 -1
- package/dist/index.d.ts +43 -21
- package/dist/nish-components.css +41 -1
- package/dist/nish-components.min.css +1 -1
- package/dist/node/th-check.js +12 -3
- package/dist/server/hono.d.ts +1 -1
- package/dist/server/hono.js +20 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +19 -5
- package/dist/{spa-BLlMc0eI.d.ts → spa-7myD4xvA.d.ts} +3 -2
- package/dist/system-canvas.d.ts +179 -2
- package/dist/theme.d.ts +23 -5
- package/dist/theme.global.js +87 -151
- package/dist/theme.js +87 -151
- package/package.json +1 -1
- package/dist/system-canvas-BLuWd69H.d.ts +0 -183
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 ? "
|
|
267
|
+
var version = true ? "3.1.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
|
|
312
|
+
var OVERLAY_STRINGS = {
|
|
313
313
|
close: "Close",
|
|
314
314
|
cancel: "Cancel",
|
|
315
315
|
menu: "Menu",
|
|
316
316
|
back: "Back: ",
|
|
317
|
-
contextMenu: "Actions"
|
|
318
|
-
|
|
319
|
-
|
|
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
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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:
|
|
662
|
-
light:
|
|
663
|
-
dark:
|
|
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 ??
|
|
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 ??
|
|
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 ??
|
|
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);
|
|
@@ -1105,7 +981,8 @@ function mountStuck(el, onChange) {
|
|
|
1105
981
|
};
|
|
1106
982
|
}
|
|
1107
983
|
function mountScrollspy(nav, o = {}) {
|
|
1108
|
-
|
|
984
|
+
const noop = Object.assign(() => void 0, { lock: (_id) => void 0 });
|
|
985
|
+
if (typeof document === "undefined") return noop;
|
|
1109
986
|
const links = Array.from(nav.querySelectorAll('a[href^="#"]')).filter((a) => a.hash.length > 1);
|
|
1110
987
|
const target = (a) => {
|
|
1111
988
|
try {
|
|
@@ -1116,13 +993,16 @@ function mountScrollspy(nav, o = {}) {
|
|
|
1116
993
|
};
|
|
1117
994
|
const unheight = o.height === false ? () => void 0 : mountHeightVar(nav, "--nish-sticky-extra");
|
|
1118
995
|
let current = null;
|
|
996
|
+
let locked = null;
|
|
997
|
+
let unlockListeners = null;
|
|
1119
998
|
const edges = () => {
|
|
1120
999
|
const max = nav.scrollWidth - nav.clientWidth;
|
|
1121
|
-
|
|
1122
|
-
nav.dataset.
|
|
1000
|
+
const left = getComputedStyle(nav).direction === "rtl" ? nav.scrollLeft + max : nav.scrollLeft;
|
|
1001
|
+
nav.dataset.atStart = String(left <= 1);
|
|
1002
|
+
nav.dataset.atEnd = String(max <= 1 || left >= max - 1);
|
|
1123
1003
|
};
|
|
1124
1004
|
const reveal = (a) => {
|
|
1125
|
-
const left = a.
|
|
1005
|
+
const left = a.getBoundingClientRect().left - nav.getBoundingClientRect().left + nav.scrollLeft - nav.clientLeft;
|
|
1126
1006
|
const view = nav.clientWidth;
|
|
1127
1007
|
if (left < nav.scrollLeft + 24) nav.scrollLeft = Math.max(0, left - 24);
|
|
1128
1008
|
else if (left + a.offsetWidth > nav.scrollLeft + view - 24) nav.scrollLeft = left + a.offsetWidth - view + 24;
|
|
@@ -1148,7 +1028,61 @@ function mountScrollspy(nav, o = {}) {
|
|
|
1148
1028
|
if (window.innerHeight + window.scrollY >= de.scrollHeight - 2) {
|
|
1149
1029
|
for (const a of links) if (target(a)) found = a;
|
|
1150
1030
|
}
|
|
1151
|
-
activate(found);
|
|
1031
|
+
activate(locked ?? found);
|
|
1032
|
+
};
|
|
1033
|
+
const unlock = () => {
|
|
1034
|
+
unlockListeners?.();
|
|
1035
|
+
unlockListeners = null;
|
|
1036
|
+
locked = null;
|
|
1037
|
+
};
|
|
1038
|
+
const lock = (id) => {
|
|
1039
|
+
const a = links.find((l) => {
|
|
1040
|
+
try {
|
|
1041
|
+
return decodeURIComponent(l.hash.slice(1)) === id;
|
|
1042
|
+
} catch {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
if (!a) return;
|
|
1047
|
+
unlock();
|
|
1048
|
+
locked = a;
|
|
1049
|
+
activate(a);
|
|
1050
|
+
const release = () => {
|
|
1051
|
+
unlock();
|
|
1052
|
+
schedule();
|
|
1053
|
+
};
|
|
1054
|
+
const onKey = (e) => {
|
|
1055
|
+
if (["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "].includes(e.key)) release();
|
|
1056
|
+
};
|
|
1057
|
+
let settled = false;
|
|
1058
|
+
const settle = () => {
|
|
1059
|
+
settled = true;
|
|
1060
|
+
};
|
|
1061
|
+
let t = setTimeout(settle, 400);
|
|
1062
|
+
const onScroll = () => {
|
|
1063
|
+
if (settled) release();
|
|
1064
|
+
else {
|
|
1065
|
+
clearTimeout(t);
|
|
1066
|
+
t = setTimeout(settle, 200);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
const onScrollEnd = () => {
|
|
1070
|
+
clearTimeout(t);
|
|
1071
|
+
t = setTimeout(settle, 50);
|
|
1072
|
+
};
|
|
1073
|
+
window.addEventListener("wheel", release, { passive: true });
|
|
1074
|
+
window.addEventListener("touchstart", release, { passive: true });
|
|
1075
|
+
window.addEventListener("keydown", onKey);
|
|
1076
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
1077
|
+
window.addEventListener("scrollend", onScrollEnd);
|
|
1078
|
+
unlockListeners = () => {
|
|
1079
|
+
clearTimeout(t);
|
|
1080
|
+
window.removeEventListener("wheel", release);
|
|
1081
|
+
window.removeEventListener("touchstart", release);
|
|
1082
|
+
window.removeEventListener("keydown", onKey);
|
|
1083
|
+
window.removeEventListener("scroll", onScroll);
|
|
1084
|
+
window.removeEventListener("scrollend", onScrollEnd);
|
|
1085
|
+
};
|
|
1152
1086
|
};
|
|
1153
1087
|
let frame = 0;
|
|
1154
1088
|
const schedule = () => {
|
|
@@ -1176,7 +1110,8 @@ function mountScrollspy(nav, o = {}) {
|
|
|
1176
1110
|
});
|
|
1177
1111
|
ro.observe(nav);
|
|
1178
1112
|
}
|
|
1179
|
-
|
|
1113
|
+
const stop = () => {
|
|
1114
|
+
unlock();
|
|
1180
1115
|
if (frame) cancelAnimationFrame(frame);
|
|
1181
1116
|
window.removeEventListener("scroll", schedule);
|
|
1182
1117
|
window.removeEventListener("resize", schedule);
|
|
@@ -1188,6 +1123,7 @@ function mountScrollspy(nav, o = {}) {
|
|
|
1188
1123
|
delete nav.dataset.atStart;
|
|
1189
1124
|
delete nav.dataset.atEnd;
|
|
1190
1125
|
};
|
|
1126
|
+
return Object.assign(stop, { lock });
|
|
1191
1127
|
}
|
|
1192
1128
|
function mountChecklist(list) {
|
|
1193
1129
|
if (typeof document === "undefined") return () => void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nish-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.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 };
|