nish-ui 3.1.0 → 3.3.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 (107) hide show
  1. package/README.md +13 -6
  2. package/dist/base-tailwind.css +30 -15
  3. package/dist/base.css +30 -15
  4. package/dist/chart.js +2 -2
  5. package/dist/elements-all.js +78 -78
  6. package/dist/elements-charts.d.ts +1 -1
  7. package/dist/elements-charts.js +43 -42
  8. package/dist/elements-data.d.ts +10 -0
  9. package/dist/elements-data.js +4 -5
  10. package/dist/elements-forms.js +9 -9
  11. package/dist/elements.d.ts +1 -0
  12. package/dist/elements.js +4 -4
  13. package/dist/esm/chart-values.js +2 -1
  14. package/dist/esm/combobox-filter.js +6 -5
  15. package/dist/esm/command-filter.js +83 -0
  16. package/dist/esm/components/accordion.js +5 -3
  17. package/dist/esm/components/app-shell.js +9 -5
  18. package/dist/esm/components/breadcrumbs.js +8 -4
  19. package/dist/esm/components/calendar-base.js +33 -6
  20. package/dist/esm/components/calendar-classes.js +14 -2
  21. package/dist/esm/components/canvas/follow-caption.js +31 -21
  22. package/dist/esm/components/canvas/follow.js +5 -6
  23. package/dist/esm/components/canvas/minimap.js +3 -3
  24. package/dist/esm/components/canvas/system-canvas.js +3 -1
  25. package/dist/esm/components/canvas/view.js +0 -2
  26. package/dist/esm/components/carousel.js +2 -3
  27. package/dist/esm/components/charts.js +18 -7
  28. package/dist/esm/components/combobox.js +20 -9
  29. package/dist/esm/components/command.js +25 -63
  30. package/dist/esm/components/context-menu.js +2 -1
  31. package/dist/esm/components/data-classes.js +23 -8
  32. package/dist/esm/components/data.js +19 -10
  33. package/dist/esm/components/display.js +24 -15
  34. package/dist/esm/components/drawer.js +17 -4
  35. package/dist/esm/components/error-boundary.js +3 -3
  36. package/dist/esm/components/feedback.js +4 -4
  37. package/dist/esm/components/file-dropzone.js +39 -7
  38. package/dist/esm/components/filters.js +42 -1
  39. package/dist/esm/components/flow.js +12 -9
  40. package/dist/esm/components/forms-classes.js +3 -1
  41. package/dist/esm/components/forms.js +8 -6
  42. package/dist/esm/components/hooks.js +47 -13
  43. package/dist/esm/components/hover-card.js +2 -1
  44. package/dist/esm/components/inbox.js +9 -2
  45. package/dist/esm/components/latest.js +4 -2
  46. package/dist/esm/components/layout.js +7 -4
  47. package/dist/esm/components/menu.js +14 -1
  48. package/dist/esm/components/modal.js +17 -4
  49. package/dist/esm/components/multi-select.js +7 -7
  50. package/dist/esm/components/nav-classes.js +9 -0
  51. package/dist/esm/components/nav.js +32 -12
  52. package/dist/esm/components/navigate.js +1 -1
  53. package/dist/esm/components/overlay-dialog.js +35 -1
  54. package/dist/esm/components/pagination.js +1 -1
  55. package/dist/esm/components/primitives-classes.js +4 -4
  56. package/dist/esm/components/primitives.js +18 -5
  57. package/dist/esm/components/progress.js +2 -1
  58. package/dist/esm/components/radio-group.js +1 -1
  59. package/dist/esm/components/resource-classes.js +7 -3
  60. package/dist/esm/components/resource.js +17 -6
  61. package/dist/esm/components/segmented.js +2 -0
  62. package/dist/esm/components/separator.js +6 -1
  63. package/dist/esm/components/service-tokens.js +18 -7
  64. package/dist/esm/components/settings.js +21 -1
  65. package/dist/esm/components/slider.js +5 -1
  66. package/dist/esm/components/split.js +4 -2
  67. package/dist/esm/components/strings.js +17 -4
  68. package/dist/esm/components/table.js +15 -3
  69. package/dist/esm/components/tabs.js +3 -2
  70. package/dist/esm/components/tag-input.js +5 -1
  71. package/dist/esm/components/time-field.js +15 -7
  72. package/dist/esm/components/toast-card.js +5 -3
  73. package/dist/esm/components/toast-store.js +16 -4
  74. package/dist/esm/components/toast.js +4 -1
  75. package/dist/esm/components/tooltip.js +3 -2
  76. package/dist/esm/components/url-state.js +5 -2
  77. package/dist/esm/components/virtual-table.js +2 -2
  78. package/dist/esm/components/virtual.js +8 -4
  79. package/dist/esm/format.js +27 -4
  80. package/dist/esm/runtime.js +9 -2
  81. package/dist/esm/server/inbox/client.js +4 -0
  82. package/dist/esm/split-layout.js +2 -1
  83. package/dist/esm/theme.js +38 -15
  84. package/dist/esm/tokens.mjs +1 -1
  85. package/dist/format.d.ts +5 -3
  86. package/dist/format.js +36 -7
  87. package/dist/inbox-client.d.ts +6 -2
  88. package/dist/inbox-client.js +4 -1
  89. package/dist/index.d.ts +65 -30
  90. package/dist/nish-components.css +70 -23
  91. package/dist/nish-components.min.css +1 -1
  92. package/dist/nish.css +30 -15
  93. package/dist/nish.min.css +1 -1
  94. package/dist/node/vite.js +1 -1
  95. package/dist/server/hono.d.ts +10 -3
  96. package/dist/server/hono.js +108 -11
  97. package/dist/server/index.d.ts +21 -13
  98. package/dist/server/index.js +124 -29
  99. package/dist/service-tokens.d.ts +4 -4
  100. package/dist/{spa-7myD4xvA.d.ts → spa-FwS7yZ8p.d.ts} +36 -7
  101. package/dist/split-layout.js +2 -2
  102. package/dist/system-canvas.d.ts +11 -10
  103. package/dist/theme.d.ts +30 -2
  104. package/dist/theme.global.js +53 -21
  105. package/dist/theme.js +53 -20
  106. package/package.json +3 -2
  107. package/dist/tokens.js +0 -425
package/README.md CHANGED
@@ -222,6 +222,10 @@ nonce:
222
222
  response. Vite runs the transform once per build, so a fixed real nonce (or a function) is baked into
223
223
  the file and gives no protection outside the dev server. In other setups give your own
224
224
  `<script nonce>` the file's contents.
225
+ - `serveSpa({ dir, csp: 'strict' })` (and `createSpaHandler`) from `nish-ui/server` sends a strict policy
226
+ on HTML answers, hashing every inline script in the built index.html (so the Vite plugin's theme-init
227
+ script is allowed without copying its hash); pass `connect`/`img` for extra origins and
228
+ `reportOnly: true` to try it first.
225
229
  - The components set no inline styles that need `style-src 'unsafe-inline'` beyond CSS custom
226
230
  properties on elements, and build their DOM without `innerHTML`, so a Trusted Types policy
227
231
  (`require-trusted-types-for 'script'`) passes.
@@ -289,6 +293,10 @@ Entry points:
289
293
  | `nish-ui/tailwind-core.css` | The same without the component scan |
290
294
  | `nish-ui/nish.css` | The theme and base styles without Tailwind |
291
295
  | `nish-ui/nish-components.css` | `.nish-btn`, `.nish-card` and the other classes |
296
+ | `nish-ui/nish.min.css`, `nish-ui/nish-components.min.css` | The same two files, minified |
297
+ | `nish-ui/tokens.css` | Only the design tokens as CSS variables (`--nish-*`) |
298
+ | `nish-ui/fonts.css` | Only the `@font-face` rules for the bundled fonts |
299
+ | `nish-ui/base.css` | Only the base element styles; `nish.css` is these three together |
292
300
  | `nish-ui/theme` | Theme switching and static-page helpers, React-free |
293
301
  | `nish-ui/format` | Money, percent, date formatters (locale-aware) |
294
302
  | `nish-ui/chart` | Chart colors for any library |
@@ -327,10 +335,10 @@ Measured with esbuild (minified, React external) from `dist/esm` on every pull r
327
335
  | Import | Gzip |
328
336
  |---|---|
329
337
  | `cn` | under 10 KB |
330
- | `Button` | under 11 KB |
338
+ | `Button` | under 10 KB |
331
339
  | `AppShell` | under 34 KB |
332
- | `useMediaQuery` | under 1.5 KB |
333
- | `nish-ui/theme` | under 12 KB |
340
+ | `useMediaQuery` | under 1 KB |
341
+ | `nish-ui/theme` | under 9 KB |
334
342
  | `nish-ui/format` | under 4 KB |
335
343
 
336
344
  The JavaScript is one file per source module with `/* @__PURE__ */` annotations and a
@@ -355,10 +363,9 @@ export and two copies of the package on one page), Playwright specs for overlays
355
363
  elements, hydration, Content Security Policy and Trusted Types, an axe accessibility scan with
356
364
  zero serious or critical findings, a consumer build in Next.js (App Router), Vite and a
357
365
  TypeScript matrix (5.4, 5.9 and 6.0 with `bundler` and `node16` resolution), the bundle size
358
- budgets, a screenshot check of the docs site at 360, 840 and 1440 px in light and dark, and an
366
+ budgets, a screenshot check of the docs site at 390 and 1440 px, a Fold check on pull requests (its pages at 360, 840 and 1440 px in light and dark), and an
359
367
  exports snapshot that fails when a public name or `.nish-*` class disappears. Releases publish to
360
- npm with provenance. The docs site is checked at 360, 840 and 1440 px; not every component is
361
- checked in every theme on every pull request.
368
+ npm with provenance. Not every component is checked in every theme on every pull request.
362
369
 
363
370
  ## Links
364
371
 
@@ -53,10 +53,15 @@
53
53
  .nish-scroll-fade[data-at-end='false'] {
54
54
  --nish-fade-end: transparent;
55
55
  }
56
- .nish-no-scrollbar {
56
+ /* Scrolls, but draws no scrollbar: tab strips, chip rows, carousels. .nish-no-scrollbar is
57
+ the preferred name; .scrollbar-none is the same utility under its older name. */
58
+ .nish-no-scrollbar,
59
+ .scrollbar-none {
57
60
  scrollbar-width: none;
61
+ -ms-overflow-style: none;
58
62
  }
59
- .nish-no-scrollbar::-webkit-scrollbar {
63
+ .nish-no-scrollbar::-webkit-scrollbar,
64
+ .scrollbar-none::-webkit-scrollbar {
60
65
  display: none;
61
66
  }
62
67
  /* Bottom padding that clears bottom bars (the nav already includes the safe area). It is in
@@ -194,15 +199,6 @@
194
199
  white-space: nowrap;
195
200
  }
196
201
 
197
- /* Scrolls, but draws no scrollbar: tab strips, chip rows, carousels. */
198
- .scrollbar-none {
199
- scrollbar-width: none;
200
- -ms-overflow-style: none;
201
- }
202
- .scrollbar-none::-webkit-scrollbar {
203
- display: none;
204
- }
205
-
206
202
  /* First thing in <body>: <a class="nish-skip-link" href="#main">Skip to content</a>.
207
203
  Parked above the top edge (still read by screen readers) until a keyboard user tabs
208
204
  to it, then a pill at the top left. */
@@ -1103,7 +1099,12 @@
1103
1099
  .nish-prose :where(table) {
1104
1100
  width: 100%;
1105
1101
  border-collapse: collapse;
1106
- display: block;
1102
+ /* Stays display:table so the table role and row/column navigation survive (WebKit and
1103
+ VoiceOver drop them on display:block). Long words wrap instead of scrolling the page;
1104
+ a wide table can sit in a wrapper that scrolls: any element with data-nish-table-wrap. */
1105
+ overflow-wrap: anywhere;
1106
+ }
1107
+ .nish-prose :where([data-nish-table-wrap]) {
1107
1108
  overflow-x: auto;
1108
1109
  }
1109
1110
  .nish-prose :where(th, td) {
@@ -1141,14 +1142,15 @@
1141
1142
  @media (prefers-reduced-motion: reduce) {
1142
1143
  .nish-spin,
1143
1144
  [data-nish-spin],
1144
- .nish-spinner {
1145
+ .nish-spinner,
1146
+ .nish-btn[aria-busy='true']::after {
1145
1147
  animation: nish-pulse 1.6s ease-in-out infinite !important;
1146
1148
  animation-iteration-count: infinite !important;
1147
1149
  animation-duration: 1.6s !important;
1148
1150
  }
1149
1151
  }
1150
1152
 
1151
- /* SystemCanvas (src/components/canvas.tsx). The viewport is the graph paper: its
1153
+ /* SystemCanvas (src/components/canvas/system-canvas.tsx). The viewport is the graph paper: its
1152
1154
  background position and size follow the pan and zoom (the component writes them directly, no inherited
1153
1155
  variables). Every rule that moves, loops or fades is
1154
1156
  inside prefers-reduced-motion: no-preference; under reduced motion the active look is
@@ -1489,7 +1491,7 @@
1489
1491
  border-radius: 14px;
1490
1492
  border: 1px solid var(--nish-line);
1491
1493
  background: var(--nish-surface);
1492
- box-shadow: var(--nish-shadow-md, 0 4px 14px rgb(0 0 0 / 0.18));
1494
+ box-shadow: var(--nish-shadow-pop);
1493
1495
  cursor: default;
1494
1496
  }
1495
1497
  .nish-canvas-zoom {
@@ -1651,6 +1653,19 @@
1651
1653
  forced-color-adjust: none;
1652
1654
  background-color: GrayText;
1653
1655
  }
1656
+ /* Canvas live and active states are drawn with background, border colour and shadow,
1657
+ which forced colors flatten: redraw them with Highlight and a thicker border. */
1658
+ .nish-canvas-live {
1659
+ forced-color-adjust: none;
1660
+ background: Highlight;
1661
+ box-shadow: none;
1662
+ }
1663
+ .nish-canvas-group[data-live],
1664
+ .nish-canvas-node[data-active] {
1665
+ forced-color-adjust: none;
1666
+ border-color: Highlight;
1667
+ border-width: 2px;
1668
+ }
1654
1669
  }
1655
1670
 
1656
1671
  /* ThemeProvider sets data-nish-theme-switching on <html> for one frame while it swaps the
package/dist/base.css CHANGED
@@ -53,10 +53,15 @@
53
53
  .nish-scroll-fade[data-at-end='false'] {
54
54
  --nish-fade-end: transparent;
55
55
  }
56
- .nish-no-scrollbar {
56
+ /* Scrolls, but draws no scrollbar: tab strips, chip rows, carousels. .nish-no-scrollbar is
57
+ the preferred name; .scrollbar-none is the same utility under its older name. */
58
+ .nish-no-scrollbar,
59
+ .scrollbar-none {
57
60
  scrollbar-width: none;
61
+ -ms-overflow-style: none;
58
62
  }
59
- .nish-no-scrollbar::-webkit-scrollbar {
63
+ .nish-no-scrollbar::-webkit-scrollbar,
64
+ .scrollbar-none::-webkit-scrollbar {
60
65
  display: none;
61
66
  }
62
67
  /* Bottom padding that clears bottom bars (the nav already includes the safe area). It is in
@@ -194,15 +199,6 @@
194
199
  white-space: nowrap;
195
200
  }
196
201
 
197
- /* Scrolls, but draws no scrollbar: tab strips, chip rows, carousels. */
198
- .scrollbar-none {
199
- scrollbar-width: none;
200
- -ms-overflow-style: none;
201
- }
202
- .scrollbar-none::-webkit-scrollbar {
203
- display: none;
204
- }
205
-
206
202
  /* First thing in <body>: <a class="nish-skip-link" href="#main">Skip to content</a>.
207
203
  Parked above the top edge (still read by screen readers) until a keyboard user tabs
208
204
  to it, then a pill at the top left. */
@@ -1103,7 +1099,12 @@
1103
1099
  .nish-prose :where(table) {
1104
1100
  width: 100%;
1105
1101
  border-collapse: collapse;
1106
- display: block;
1102
+ /* Stays display:table so the table role and row/column navigation survive (WebKit and
1103
+ VoiceOver drop them on display:block). Long words wrap instead of scrolling the page;
1104
+ a wide table can sit in a wrapper that scrolls: any element with data-nish-table-wrap. */
1105
+ overflow-wrap: anywhere;
1106
+ }
1107
+ .nish-prose :where([data-nish-table-wrap]) {
1107
1108
  overflow-x: auto;
1108
1109
  }
1109
1110
  .nish-prose :where(th, td) {
@@ -1141,14 +1142,15 @@
1141
1142
  @media (prefers-reduced-motion: reduce) {
1142
1143
  .nish-spin,
1143
1144
  [data-nish-spin],
1144
- .nish-spinner {
1145
+ .nish-spinner,
1146
+ .nish-btn[aria-busy='true']::after {
1145
1147
  animation: nish-pulse 1.6s ease-in-out infinite !important;
1146
1148
  animation-iteration-count: infinite !important;
1147
1149
  animation-duration: 1.6s !important;
1148
1150
  }
1149
1151
  }
1150
1152
 
1151
- /* SystemCanvas (src/components/canvas.tsx). The viewport is the graph paper: its
1153
+ /* SystemCanvas (src/components/canvas/system-canvas.tsx). The viewport is the graph paper: its
1152
1154
  background position and size follow the pan and zoom (the component writes them directly, no inherited
1153
1155
  variables). Every rule that moves, loops or fades is
1154
1156
  inside prefers-reduced-motion: no-preference; under reduced motion the active look is
@@ -1489,7 +1491,7 @@
1489
1491
  border-radius: 14px;
1490
1492
  border: 1px solid var(--nish-line);
1491
1493
  background: var(--nish-surface);
1492
- box-shadow: var(--nish-shadow-md, 0 4px 14px rgb(0 0 0 / 0.18));
1494
+ box-shadow: var(--nish-shadow-pop);
1493
1495
  cursor: default;
1494
1496
  }
1495
1497
  .nish-canvas-zoom {
@@ -1651,6 +1653,19 @@
1651
1653
  forced-color-adjust: none;
1652
1654
  background-color: GrayText;
1653
1655
  }
1656
+ /* Canvas live and active states are drawn with background, border colour and shadow,
1657
+ which forced colors flatten: redraw them with Highlight and a thicker border. */
1658
+ .nish-canvas-live {
1659
+ forced-color-adjust: none;
1660
+ background: Highlight;
1661
+ box-shadow: none;
1662
+ }
1663
+ .nish-canvas-group[data-live],
1664
+ .nish-canvas-node[data-active] {
1665
+ forced-color-adjust: none;
1666
+ border-color: Highlight;
1667
+ border-width: 2px;
1668
+ }
1654
1669
  }
1655
1670
 
1656
1671
  /* ThemeProvider sets data-nish-theme-switching on <html> for one frame while it swaps the
package/dist/chart.js CHANGED
@@ -6,7 +6,8 @@ function readToken(name) {
6
6
 
7
7
  // src/chart-values.ts
8
8
  function seriesColor(i) {
9
- const n = (Math.trunc(i) % 8 + 8) % 8;
9
+ const k = Number.isFinite(i) ? Math.trunc(i) : 0;
10
+ const n = (k % 8 + 8) % 8;
10
11
  return `var(--nish-chart-${n + 1})`;
11
12
  }
12
13
  var CHART = {
@@ -61,4 +62,3 @@ export {
61
62
  seriesColor,
62
63
  tooltipStyle
63
64
  };
64
- //# sourceMappingURL=chart.js.map