nish-ui 3.2.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 (95) hide show
  1. package/README.md +7 -3
  2. package/dist/base-tailwind.css +30 -15
  3. package/dist/base.css +30 -15
  4. package/dist/elements-all.js +78 -78
  5. package/dist/elements-charts.js +39 -38
  6. package/dist/elements-data.d.ts +10 -0
  7. package/dist/elements-data.js +4 -5
  8. package/dist/elements-forms.js +5 -5
  9. package/dist/elements.d.ts +1 -0
  10. package/dist/elements.js +4 -4
  11. package/dist/esm/command-filter.js +55 -4
  12. package/dist/esm/components/accordion.js +3 -2
  13. package/dist/esm/components/app-shell.js +8 -4
  14. package/dist/esm/components/breadcrumbs.js +7 -3
  15. package/dist/esm/components/calendar-base.js +32 -5
  16. package/dist/esm/components/calendar-classes.js +14 -2
  17. package/dist/esm/components/canvas/follow-caption.js +31 -21
  18. package/dist/esm/components/canvas/follow.js +5 -6
  19. package/dist/esm/components/canvas/minimap.js +3 -3
  20. package/dist/esm/components/canvas/system-canvas.js +3 -1
  21. package/dist/esm/components/canvas/view.js +0 -2
  22. package/dist/esm/components/carousel.js +2 -3
  23. package/dist/esm/components/charts.js +18 -7
  24. package/dist/esm/components/combobox.js +18 -7
  25. package/dist/esm/components/command.js +23 -61
  26. package/dist/esm/components/context-menu.js +2 -1
  27. package/dist/esm/components/data-classes.js +5 -4
  28. package/dist/esm/components/data.js +19 -10
  29. package/dist/esm/components/display.js +20 -11
  30. package/dist/esm/components/drawer.js +17 -4
  31. package/dist/esm/components/error-boundary.js +3 -3
  32. package/dist/esm/components/feedback.js +3 -3
  33. package/dist/esm/components/file-dropzone.js +16 -6
  34. package/dist/esm/components/filters.js +42 -1
  35. package/dist/esm/components/flow.js +8 -5
  36. package/dist/esm/components/forms-classes.js +2 -0
  37. package/dist/esm/components/forms.js +2 -2
  38. package/dist/esm/components/hooks.js +47 -13
  39. package/dist/esm/components/hover-card.js +2 -1
  40. package/dist/esm/components/inbox.js +5 -1
  41. package/dist/esm/components/latest.js +4 -2
  42. package/dist/esm/components/layout.js +7 -4
  43. package/dist/esm/components/menu.js +10 -1
  44. package/dist/esm/components/modal.js +17 -4
  45. package/dist/esm/components/multi-select.js +5 -5
  46. package/dist/esm/components/nav.js +30 -11
  47. package/dist/esm/components/navigate.js +1 -1
  48. package/dist/esm/components/overlay-dialog.js +35 -1
  49. package/dist/esm/components/pagination.js +1 -1
  50. package/dist/esm/components/primitives.js +17 -4
  51. package/dist/esm/components/progress.js +2 -1
  52. package/dist/esm/components/resource.js +14 -4
  53. package/dist/esm/components/segmented.js +2 -0
  54. package/dist/esm/components/separator.js +6 -1
  55. package/dist/esm/components/service-tokens.js +18 -7
  56. package/dist/esm/components/settings.js +16 -0
  57. package/dist/esm/components/slider.js +5 -1
  58. package/dist/esm/components/split.js +4 -2
  59. package/dist/esm/components/strings.js +17 -4
  60. package/dist/esm/components/table.js +15 -3
  61. package/dist/esm/components/tag-input.js +5 -1
  62. package/dist/esm/components/time-field.js +15 -7
  63. package/dist/esm/components/toast-card.js +5 -3
  64. package/dist/esm/components/toast.js +4 -1
  65. package/dist/esm/components/tooltip.js +3 -2
  66. package/dist/esm/components/url-state.js +3 -1
  67. package/dist/esm/components/virtual-table.js +2 -2
  68. package/dist/esm/components/virtual.js +8 -4
  69. package/dist/esm/format.js +3 -2
  70. package/dist/esm/runtime.js +1 -1
  71. package/dist/esm/server/inbox/client.js +4 -0
  72. package/dist/esm/theme.js +38 -15
  73. package/dist/esm/tokens.mjs +1 -1
  74. package/dist/format.d.ts +5 -3
  75. package/dist/format.js +4 -3
  76. package/dist/inbox-client.d.ts +1 -1
  77. package/dist/inbox-client.js +4 -0
  78. package/dist/index.d.ts +61 -29
  79. package/dist/nish-components.css +59 -21
  80. package/dist/nish-components.min.css +1 -1
  81. package/dist/nish.css +30 -15
  82. package/dist/nish.min.css +1 -1
  83. package/dist/node/vite.js +1 -1
  84. package/dist/server/hono.d.ts +9 -2
  85. package/dist/server/hono.js +17 -4
  86. package/dist/server/index.d.ts +3 -3
  87. package/dist/server/index.js +7 -2
  88. package/dist/service-tokens.d.ts +4 -4
  89. package/dist/{spa-BfRDo38r.d.ts → spa-FwS7yZ8p.d.ts} +4 -3
  90. package/dist/system-canvas.d.ts +11 -10
  91. package/dist/theme.d.ts +30 -2
  92. package/dist/theme.global.js +45 -18
  93. package/dist/theme.js +45 -18
  94. package/package.json +3 -2
  95. package/dist/tokens.js +0 -425
package/dist/tokens.js DELETED
@@ -1,425 +0,0 @@
1
- // The one source of truth for every design token. scripts/build.mjs turns this into
2
- // dist/tokens.css (--nish-* custom properties), tools/contrast.mjs checks it, and
3
- // src/theme.ts reads PRESETS from it. Edit values here, never in generated CSS.
4
- //
5
- // Colors are plain hex so static pages can use them as-is; Tailwind opacity
6
- // modifiers (bg-th-surface/50) work through color-mix in Tailwind 4.
7
-
8
- /** Roles every theme must define. Soft tints are derived, not listed here. */
9
- export const COLOR_ROLES = [
10
- 'bg', // page background
11
- 'surface', // cards, panels, table bodies
12
- 'elevated', // popovers, hovered rows, inputs, raised things inside cards
13
- 'overlay', // the deepest inner layer: chips inside raised things, skeleton sheen
14
- 'line', // borders and dividers
15
- 'line-strong', // strong dividers, focused outlines that are not the accent
16
- 'line-control', // form-control borders: at least 3:1 on surface and elevated
17
- 'hi', // primary text
18
- 'hi2', // secondary text
19
- 'hi3', // tertiary text, labels
20
- 'ghost', // placeholders, disabled, decorative icons (not for body text)
21
- 'accent', // links, primary buttons, active nav, focus ring
22
- 'accent2', // a second accent for paired highlights and the 2nd chart series
23
- 'on-accent', // text and icons on an accent fill
24
- 'on-accent2', // text and icons on an accent2 fill
25
- 'on-ok', // text and icons on a solid ok-fill
26
- 'on-loss', // ... on loss-fill and loss (danger buttons)
27
- 'on-warn', // ... on warn-fill
28
- 'on-info', // ... on info-fill
29
- 'ok', // success, gains
30
- 'loss', // errors, losses, destructive
31
- 'warn', // warnings, pending
32
- 'info', // neutral notices
33
- 'ok-fill', // status colors for bars, meters and chart lines: brighter than the
34
- 'loss-fill', // text versions in light themes, where text-safe colors look muddy as fills
35
- 'warn-fill',
36
- 'info-fill',
37
- 'scrim', // modal and drawer backdrop tone
38
- 'invert-bg', // inverted pill (today marker, active segmented control)
39
- 'invert-text',
40
- 'chart-1',
41
- 'chart-2',
42
- 'chart-3',
43
- 'chart-4',
44
- 'chart-5',
45
- 'chart-6',
46
- 'chart-7',
47
- 'chart-8',
48
- 'emerald',
49
- 'indigo',
50
- 'amber',
51
- 'lime',
52
- 'rose',
53
- 'sky',
54
- 'violet',
55
- 'teal',
56
- ];
57
-
58
- /** Color roles with no meaning: tags, tiles, stores, calendar dots. */
59
- export const HUE_ROLES = ['emerald', 'indigo', 'amber', 'lime', 'rose', 'sky', 'violet', 'teal'];
60
-
61
- /** Tints mixed from a role over transparent (14%), for badges, banners and soft fills:
62
- * --nish-<role>-soft and Tailwind th-<role>-soft. The status roles first, then the hues. */
63
- export const SOFT_ROLES = ['accent', 'ok', 'loss', 'warn', 'info', ...HUE_ROLES];
64
-
65
- const DARK_HUES = {
66
- emerald: '#34d399',
67
- indigo: '#8b93ff',
68
- amber: '#fbbf24',
69
- lime: '#a3e635',
70
- rose: '#fb7185',
71
- sky: '#38bdf8',
72
- violet: '#c084fc',
73
- teal: '#2dd4bf',
74
- };
75
-
76
- const LIGHT_HUES = {
77
- emerald: '#046d4f',
78
- indigo: '#4e45e3',
79
- amber: '#9b4708',
80
- lime: '#41690d',
81
- rose: '#b8113a',
82
- sky: '#036499',
83
- violet: '#7e22ce',
84
- teal: '#0e6b64',
85
- };
86
-
87
- // Categorical series ordered so neighbors never share a hue family.
88
- const DARK_CHART = ['#8b93ff', '#34d399', '#fbbf24', '#fb7185', '#38bdf8', '#c084fc', '#fb923c', '#a3e635'];
89
- // Light series are the most vivid shades that still clear 3:1 (chart marks, not text)
90
- // on bg, surface and elevated; darker text-safe shades read as muddy lines.
91
- const LIGHT_CHART = ['#6366f1', '#059669', '#c96d06', '#f43f5e', '#0284c7', '#a855f7', '#ea580c', '#5a910c'];
92
-
93
- const chart = (list) => Object.fromEntries(list.map((c, i) => [`chart-${i + 1}`, c]));
94
-
95
- /**
96
- * Every theme. `scheme` is what a page that only knows light/dark falls back to.
97
- * The first entry is the default.
98
- */
99
- const RAW_THEMES = {
100
- dark: {
101
- label: 'Dark',
102
- scheme: 'dark',
103
- colors: {
104
- bg: '#0a0b0f',
105
- surface: '#111218',
106
- elevated: '#191b23',
107
- overlay: '#22252f',
108
- line: '#262935',
109
- 'line-strong': '#3a3e4d',
110
- 'line-control': '#666975',
111
- hi: '#ececf1',
112
- hi2: '#a8aab7',
113
- hi3: '#8a8d9b',
114
- ghost: '#6b6e7c',
115
- accent: '#8b93ff',
116
- accent2: '#c084fc',
117
- 'on-accent': '#0a0b0f',
118
- ok: '#34d399',
119
- loss: '#f87171',
120
- warn: '#fbbf24',
121
- info: '#38bdf8',
122
- scrim: '#000000',
123
- 'invert-bg': '#ececf1',
124
- 'invert-text': '#111218',
125
- ...chart(DARK_CHART),
126
- ...DARK_HUES,
127
- },
128
- },
129
- light: {
130
- label: 'Light',
131
- scheme: 'light',
132
- colors: {
133
- bg: '#f7f6f3',
134
- surface: '#ffffff',
135
- elevated: '#f1f0ec',
136
- overlay: '#e6e4de',
137
- line: '#e2e0da',
138
- 'line-strong': '#c9c6bd',
139
- 'line-control': '#8a8881',
140
- hi: '#17171c',
141
- hi2: '#4f515c',
142
- hi3: '#626470',
143
- ghost: '#8a8c98',
144
- accent: '#4338ca',
145
- accent2: '#7e22ce',
146
- 'on-accent': '#ffffff',
147
- // Light fills are mid-tones: white only clears 4.5:1 on loss and accent2.
148
- 'on-accent2': '#ffffff',
149
- 'on-ok': '#0a0a0c',
150
- 'on-loss': '#ffffff',
151
- 'on-warn': '#0a0a0c',
152
- 'on-info': '#0a0a0c',
153
- ok: '#065f46',
154
- 'ok-fill': '#059669',
155
- 'loss-fill': '#dc2626',
156
- 'warn-fill': '#c96d06',
157
- 'info-fill': '#0284c7',
158
- loss: '#a91b1b',
159
- warn: '#92400e',
160
- info: '#075985',
161
- scrim: '#17171c',
162
- 'invert-bg': '#17171c',
163
- 'invert-text': '#f7f6f3',
164
- ...chart(LIGHT_CHART),
165
- ...LIGHT_HUES,
166
- },
167
- },
168
- slate: {
169
- label: 'Slate',
170
- scheme: 'dark',
171
- colors: {
172
- bg: '#18181b',
173
- surface: '#202024',
174
- elevated: '#2c2c32',
175
- overlay: '#36363d',
176
- line: '#3a3a42',
177
- 'line-strong': '#52525b',
178
- 'line-control': '#77777e',
179
- hi: '#f4f4f5',
180
- hi2: '#b8b8c0',
181
- hi3: '#a0a0a8',
182
- ghost: '#71717a',
183
- accent: '#a5b4fc',
184
- accent2: '#c084fc',
185
- 'on-accent': '#18181b',
186
- ok: '#4ade80',
187
- loss: '#fda4af',
188
- warn: '#facc15',
189
- info: '#38bdf8',
190
- scrim: '#000000',
191
- 'invert-bg': '#f4f4f5',
192
- 'invert-text': '#202024',
193
- ...chart(['#818cf8', '#4ade80', '#facc15', '#fb7185', '#38bdf8', '#c084fc', '#fb923c', '#a3e635']),
194
- ...DARK_HUES,
195
- // Lifted so tinted chips stay readable on this theme's lighter cards.
196
- indigo: '#9aa1ff', rose: '#fc8395', violet: '#c792fc',
197
- },
198
- },
199
- terminal: {
200
- label: 'Terminal',
201
- scheme: 'dark',
202
- colors: {
203
- bg: '#050807',
204
- surface: '#0c110e',
205
- elevated: '#141c17',
206
- overlay: '#1c2820',
207
- line: '#233028',
208
- 'line-strong': '#34483b',
209
- 'line-control': '#5c6c61',
210
- hi: '#d1fae5',
211
- hi2: '#8fc4a8',
212
- hi3: '#74a68b',
213
- ghost: '#4f7a62',
214
- accent: '#34d399',
215
- accent2: '#2dd4bf',
216
- 'on-accent': '#050807',
217
- ok: '#4ade80',
218
- loss: '#f87171',
219
- warn: '#fbbf24',
220
- info: '#67e8f9',
221
- scrim: '#000000',
222
- 'invert-bg': '#d1fae5',
223
- 'invert-text': '#0c110e',
224
- ...chart(['#34d399', '#67e8f9', '#fbbf24', '#f87171', '#a3e635', '#c084fc', '#fb923c', '#2dd4bf']),
225
- ...DARK_HUES,
226
- },
227
- },
228
- mocha: {
229
- label: 'Mocha',
230
- scheme: 'dark',
231
- colors: {
232
- bg: '#1c1917',
233
- surface: '#292524',
234
- elevated: '#393432',
235
- overlay: '#44403c',
236
- line: '#44403c',
237
- 'line-strong': '#57534e',
238
- 'line-control': '#83807c',
239
- hi: '#f5f0eb',
240
- hi2: '#c6c0bb',
241
- hi3: '#b2ada8',
242
- ghost: '#78716c',
243
- accent: '#fdba74',
244
- accent2: '#f472b6',
245
- 'on-accent': '#1c1917',
246
- ok: '#4ade80',
247
- loss: '#fca5a5',
248
- warn: '#facc15',
249
- info: '#7dd3fc',
250
- scrim: '#000000',
251
- 'invert-bg': '#f5f0eb',
252
- 'invert-text': '#292524',
253
- ...chart(['#fb923c', '#4ade80', '#facc15', '#f472b6', '#7dd3fc', '#c4b5fd', '#f87171', '#bef264']),
254
- ...DARK_HUES,
255
- // Lifted so tinted chips stay readable on this theme's lighter cards.
256
- indigo: '#a9afff', rose: '#fc99a7', sky: '#3ebff8', violet: '#cfa2fd',
257
- },
258
- },
259
- ocean: {
260
- label: 'Ocean',
261
- scheme: 'dark',
262
- colors: {
263
- bg: '#020c18',
264
- surface: '#061528',
265
- elevated: '#0a243e',
266
- overlay: '#103658',
267
- line: '#123050',
268
- 'line-strong': '#1f4a72',
269
- 'line-control': '#507291',
270
- hi: '#e0f2fe',
271
- hi2: '#9ccde6',
272
- hi3: '#6fa9c6',
273
- ghost: '#3f7392',
274
- accent: '#38bdf8',
275
- accent2: '#a78bfa',
276
- 'on-accent': '#020c18',
277
- ok: '#34d399',
278
- loss: '#fb7185',
279
- warn: '#fbbf24',
280
- info: '#7dd3fc',
281
- scrim: '#000000',
282
- 'invert-bg': '#38bdf8',
283
- 'invert-text': '#020c18',
284
- ...chart(['#38bdf8', '#34d399', '#fbbf24', '#fb7185', '#a78bfa', '#2dd4bf', '#fb923c', '#a3e635']),
285
- ...DARK_HUES,
286
- },
287
- },
288
- contrast: {
289
- label: 'High contrast',
290
- scheme: 'dark',
291
- colors: {
292
- bg: '#000000',
293
- surface: '#080808',
294
- elevated: '#141414',
295
- overlay: '#222222',
296
- line: '#4a4a4a',
297
- 'line-strong': '#8a8a8a',
298
- 'line-control': '#8a8a8a',
299
- hi: '#ffffff',
300
- hi2: '#d4d4d4',
301
- hi3: '#bdbdbd',
302
- ghost: '#8f8f8f',
303
- accent: '#ffd60a',
304
- accent2: '#7dd3fc',
305
- 'on-accent': '#000000',
306
- ok: '#4ade80',
307
- loss: '#ff6b6b',
308
- warn: '#ffd60a',
309
- info: '#7dd3fc',
310
- scrim: '#000000',
311
- 'invert-bg': '#ffffff',
312
- 'invert-text': '#000000',
313
- ...chart(['#ffd60a', '#4ade80', '#7dd3fc', '#ff6b6b', '#c4b5fd', '#fb923c', '#f9a8d4', '#bef264']),
314
- ...DARK_HUES,
315
- },
316
- },
317
- };
318
-
319
- // Dark themes use their status colors as fills too, with the same dark ink on every
320
- // fill; only light themes override them. tools/contrast.mjs checks each on-* color on
321
- // its fill (4.5:1).
322
- const withFills = (t) => {
323
- const c = t.colors;
324
- const fills = Object.fromEntries(
325
- ['ok', 'loss', 'warn', 'info'].flatMap((r) => [
326
- [`${r}-fill`, c[`${r}-fill`] ?? c[r]],
327
- [`on-${r}`, c[`on-${r}`] ?? c['on-accent']],
328
- ]),
329
- );
330
- return { ...t, colors: { ...c, ...fills, 'on-accent2': c['on-accent2'] ?? c['on-accent'] } };
331
- };
332
-
333
- export const THEMES = /* @__PURE__ */ Object.fromEntries(
334
- Object.entries(RAW_THEMES).map(([name, t]) => [name, withFills(t)]),
335
- );
336
-
337
- export const DEFAULT_THEME = 'dark';
338
-
339
- /** Everything that is not a color. Same in every theme. */
340
- export const SCALE = {
341
- // Inter Variable is self-hosted (fonts.css). Sites with their own display face
342
- // (mc's pixel font, trips' serif) set it locally and keep these for UI text.
343
- 'font-sans': "'Inter Variable', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
344
- 'font-mono': "ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace",
345
-
346
- // Dense UI only (widget chrome, table meta, keyboard hints): never body text.
347
- 'text-3xs': '0.625rem',
348
- 'text-3xs-lh': '0.875rem',
349
- 'text-2xs': '0.6875rem',
350
- 'text-2xs-lh': '1rem',
351
- 'text-xs': '0.75rem',
352
- 'text-xs-lh': '1.1rem',
353
- 'text-sm': '0.875rem',
354
- 'text-sm-lh': '1.35rem',
355
- 'text-base': '1rem',
356
- 'text-base-lh': '1.55rem',
357
- 'text-lg': '1.125rem',
358
- 'text-lg-lh': '1.65rem',
359
- 'text-xl': '1.25rem',
360
- 'text-xl-lh': '1.75rem',
361
- 'text-2xl': '1.5rem',
362
- 'text-2xl-lh': '2rem',
363
- 'text-3xl': '1.875rem',
364
- 'text-3xl-lh': '2.3rem',
365
- 'text-4xl': '2.25rem',
366
- 'text-4xl-lh': '2.6rem',
367
- 'weight-normal': '400',
368
- 'weight-medium': '500',
369
- 'weight-semibold': '600',
370
- 'weight-bold': '700',
371
- 'tracking-tight': '-0.015em',
372
- 'tracking-caps': '0.08em',
373
-
374
- // 4px grid
375
- 'space-1': '4px',
376
- 'space-2': '8px',
377
- 'space-3': '12px',
378
- 'space-4': '16px',
379
- 'space-5': '20px',
380
- 'space-6': '24px',
381
- 'space-8': '32px',
382
- 'space-10': '40px',
383
- 'space-12': '48px',
384
- 'space-16': '64px',
385
-
386
- 'radius-xs': '4px',
387
- 'radius-sm': '8px',
388
- // Card is 12px (Tailwind rounded-xl). Controls use radius-sm (rounded-lg), dialogs
389
- // 16px (rounded-2xl), pills radius-pill (rounded-full).
390
- 'radius-card': '12px',
391
- 'radius-md': '14px',
392
- 'radius-lg': '20px',
393
- 'radius-pill': '999px',
394
-
395
- 'ease-out': 'cubic-bezier(0.22, 1, 0.36, 1)',
396
- 'ease-in-out': 'cubic-bezier(0.65, 0, 0.35, 1)',
397
- 'dur-fast': '160ms',
398
- 'dur-med': '320ms',
399
-
400
- 'z-base': '0',
401
- 'z-sticky': '20',
402
- 'z-dropdown': '40',
403
- 'z-modal': '50',
404
- 'z-toast': '60',
405
- 'z-tooltip': '100',
406
-
407
- 'page-max': '1120px',
408
- gutter: '16px',
409
- 'tap-min': '44px',
410
- 'focus-width': '2px',
411
- 'focus-offset': '2px',
412
-
413
- // Breakpoints for reference in JS and media queries (CSS vars cannot drive @media).
414
- 'bp-sm': '640px',
415
- 'bp-md': '768px',
416
- 'bp-lg': '1024px',
417
- 'bp-xl': '1280px',
418
- };
419
-
420
- /** Shadows reference --nish-scrim so the same recipe is faint on dark and soft on light. */
421
- export const SHADOWS = {
422
- card: '0 1px 2px color-mix(in srgb, var(--nish-scrim) 10%, transparent), 0 6px 20px -8px color-mix(in srgb, var(--nish-scrim) 22%, transparent)',
423
- pop: '0 4px 12px -2px color-mix(in srgb, var(--nish-scrim) 24%, transparent), 0 12px 32px -8px color-mix(in srgb, var(--nish-scrim) 30%, transparent)',
424
- modal: '0 24px 64px -16px color-mix(in srgb, var(--nish-scrim) 45%, transparent)',
425
- };