nish-ui 1.9.0 → 2.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 (152) hide show
  1. package/README.md +218 -58
  2. package/dist/base-tailwind.css +1757 -0
  3. package/dist/base.css +1590 -1445
  4. package/dist/chart.d.ts +4 -1
  5. package/dist/chart.js +122 -49
  6. package/dist/elements-all.d.ts +8 -0
  7. package/dist/elements-all.js +178 -0
  8. package/dist/elements-charts.d.ts +71 -0
  9. package/dist/elements-charts.js +56 -57
  10. package/dist/elements-data.d.ts +71 -0
  11. package/dist/elements-data.js +5 -6
  12. package/dist/elements-forms.d.ts +71 -0
  13. package/dist/elements-forms.js +24 -25
  14. package/dist/elements.d.ts +71 -0
  15. package/dist/elements.js +4 -5
  16. package/dist/esm/chart-values.js +58 -0
  17. package/dist/esm/chart.js +10 -0
  18. package/dist/esm/cn.js +19 -0
  19. package/dist/esm/combobox-filter.js +13 -0
  20. package/dist/esm/components/accordion.js +166 -0
  21. package/dist/esm/components/app-shell.js +198 -0
  22. package/dist/esm/components/avatar-classes.js +28 -0
  23. package/dist/esm/components/avatar.js +113 -0
  24. package/dist/esm/components/breadcrumbs.js +154 -0
  25. package/dist/esm/components/canvas/follow-caption.js +32 -0
  26. package/dist/esm/components/canvas/follow.js +119 -0
  27. package/dist/esm/components/canvas/icons.js +70 -0
  28. package/dist/esm/components/canvas/index.js +10 -0
  29. package/dist/esm/components/canvas/layout.js +258 -0
  30. package/dist/esm/components/canvas/legend.js +93 -0
  31. package/dist/esm/components/canvas/minimap.js +127 -0
  32. package/dist/esm/components/canvas/node.js +87 -0
  33. package/dist/esm/components/canvas/route.js +262 -0
  34. package/dist/esm/components/canvas/system-canvas.js +837 -0
  35. package/dist/esm/components/canvas/types.js +10 -0
  36. package/dist/esm/components/canvas/view.js +47 -0
  37. package/dist/esm/components/chart-hooks.js +19 -0
  38. package/dist/esm/components/charts.js +467 -0
  39. package/dist/esm/components/client.js +24 -0
  40. package/dist/esm/components/combobox.js +343 -0
  41. package/dist/esm/components/command.js +403 -0
  42. package/dist/esm/components/data-classes.js +159 -0
  43. package/dist/esm/components/data.js +517 -0
  44. package/dist/esm/components/display-classes.js +130 -0
  45. package/dist/esm/components/display.js +755 -0
  46. package/dist/esm/components/error-boundary.js +64 -0
  47. package/dist/esm/components/feedback.js +136 -0
  48. package/dist/esm/components/file-dropzone.js +184 -0
  49. package/dist/esm/components/filters.js +108 -0
  50. package/dist/esm/components/flow.js +746 -0
  51. package/dist/esm/components/forms-classes.js +43 -0
  52. package/dist/esm/components/forms.js +581 -0
  53. package/dist/esm/components/hooks-classes.js +9 -0
  54. package/dist/esm/components/hooks.js +236 -0
  55. package/dist/esm/components/icons.js +96 -0
  56. package/dist/esm/components/inbox-classes.js +29 -0
  57. package/dist/esm/components/inbox.js +257 -0
  58. package/dist/esm/components/latest.js +13 -0
  59. package/dist/esm/components/layout-vars.js +96 -0
  60. package/dist/esm/components/layout.js +272 -0
  61. package/dist/esm/components/media.js +143 -0
  62. package/dist/esm/components/nav.js +614 -0
  63. package/dist/esm/components/overlay-classes.js +66 -0
  64. package/dist/esm/components/overlay.js +1447 -0
  65. package/dist/esm/components/pagination-classes.js +29 -0
  66. package/dist/esm/components/pagination.js +154 -0
  67. package/dist/esm/components/portal.js +16 -0
  68. package/dist/esm/components/primitives-classes.js +198 -0
  69. package/dist/esm/components/primitives.js +268 -0
  70. package/dist/esm/components/progress.js +77 -0
  71. package/dist/esm/components/provider.js +32 -0
  72. package/dist/esm/components/radio-group.js +186 -0
  73. package/dist/esm/components/resource-classes.js +133 -0
  74. package/dist/esm/components/resource.js +209 -0
  75. package/dist/esm/components/segmented.js +178 -0
  76. package/dist/esm/components/separator.js +38 -0
  77. package/dist/esm/components/service-tokens.js +221 -0
  78. package/dist/esm/components/settings.js +301 -0
  79. package/dist/esm/components/slider.js +262 -0
  80. package/dist/esm/components/split-classes.js +8 -0
  81. package/dist/esm/components/split.js +411 -0
  82. package/dist/esm/components/strings.js +119 -0
  83. package/dist/esm/components/table.js +144 -0
  84. package/dist/esm/components/tabs-classes.js +21 -0
  85. package/dist/esm/components/tabs.js +201 -0
  86. package/dist/esm/components/tag-input.js +257 -0
  87. package/dist/esm/components/theme-toggle.js +177 -0
  88. package/dist/esm/components/toast.js +361 -0
  89. package/dist/esm/components/url-state.js +118 -0
  90. package/dist/esm/components/visually-hidden.js +20 -0
  91. package/dist/esm/format.js +320 -0
  92. package/dist/esm/inbox-client.js +2 -0
  93. package/dist/esm/inbox-types.js +2 -0
  94. package/dist/esm/index.js +320 -0
  95. package/dist/esm/runtime.js +37 -0
  96. package/dist/esm/server/inbox/client.js +297 -0
  97. package/dist/esm/server/inbox/types.js +24 -0
  98. package/dist/esm/sparkline-path.js +59 -0
  99. package/dist/esm/split-layout.js +419 -0
  100. package/dist/esm/system-canvas.js +2 -0
  101. package/dist/esm/theme.js +804 -0
  102. package/dist/esm/tokens.mjs +425 -0
  103. package/dist/esm/url.js +20 -0
  104. package/dist/files.json +5 -1
  105. package/dist/fonts/LICENSE-Inter.txt +93 -0
  106. package/dist/format.d.ts +32 -18
  107. package/dist/format.js +227 -82
  108. package/dist/inbox-client.js +3 -1
  109. package/dist/index.d.ts +1686 -667
  110. package/dist/nish-components.css +4649 -4506
  111. package/dist/nish-components.min.css +1 -0
  112. package/dist/nish.css +1603 -1450
  113. package/dist/nish.min.css +1 -0
  114. package/dist/node/eslint.js +29 -14
  115. package/dist/node/th-check.js +29 -14
  116. package/dist/node/vite.d.ts +12 -0
  117. package/dist/node/vite.js +12 -2
  118. package/dist/server/hono.d.ts +15 -6
  119. package/dist/server/hono.js +30 -25
  120. package/dist/server/index.d.ts +3 -10
  121. package/dist/server/index.js +71 -38
  122. package/dist/{spa-DuVB5O7S.d.ts → spa-BLlMc0eI.d.ts} +38 -5
  123. package/dist/system-canvas-BLuWd69H.d.ts +183 -0
  124. package/dist/system-canvas.d.ts +2 -168
  125. package/dist/tailwind-core.css +114 -0
  126. package/dist/tailwind.css +3 -7
  127. package/dist/theme-init.js +23 -9
  128. package/dist/theme-init.sha256 +1 -0
  129. package/dist/theme.d.ts +243 -4
  130. package/dist/theme.global.js +356 -89
  131. package/dist/theme.js +337 -67
  132. package/dist/tokens.css +14 -6
  133. package/dist/tokens.dtcg.json +1513 -0
  134. package/dist/tokens.js +29 -14
  135. package/dist/tokens.json +512 -0
  136. package/package.json +51 -13
  137. package/dist/chart.js.map +0 -1
  138. package/dist/elements-charts.js.map +0 -1
  139. package/dist/elements-data.js.map +0 -1
  140. package/dist/elements-forms.js.map +0 -1
  141. package/dist/elements.js.map +0 -1
  142. package/dist/format.js.map +0 -1
  143. package/dist/inbox-client.js.map +0 -1
  144. package/dist/index.js +0 -10260
  145. package/dist/index.js.map +0 -1
  146. package/dist/server/hono.js.map +0 -1
  147. package/dist/server/index.js.map +0 -1
  148. package/dist/split-layout.js.map +0 -1
  149. package/dist/system-canvas.js +0 -2204
  150. package/dist/system-canvas.js.map +0 -1
  151. package/dist/theme.global.js.map +0 -1
  152. package/dist/theme.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # nish-ui
2
2
 
3
3
  Design tokens, seven themes, flash-free theme switching and accessible React 19 components,
4
- built for Tailwind 4 and usable from plain CSS and static HTML. It is the design system
5
- behind every `*.nish.software` app.
4
+ built for Tailwind 4 and usable from plain CSS and static HTML. Works in Vite, Next.js (App
5
+ Router and server components), plain HTML and anything that renders React 19.
6
6
 
7
7
  **See every component and token live, in every theme: [design.nish.software](https://design.nish.software)**
8
8
 
@@ -13,32 +13,23 @@ behind every `*.nish.software` app.
13
13
 
14
14
  ```bash
15
15
  npm install nish-ui
16
+ npm install -D tailwindcss @tailwindcss/vite # for the React + Tailwind path (Next.js: @tailwindcss/postcss)
16
17
  ```
17
18
 
18
- React and react-dom are optional peers (19 or later), so a static site or a Node tool that
19
- only uses the CSS and `nish-ui/theme` never gets React. The package ships built files, with
20
- no install or build step.
19
+ - **ESM only.** Node 20.19 or later. `import` works everywhere; `require('nish-ui')` works on
20
+ Node 20.19+ and 22.12+ (they load ES modules from `require`).
21
+ - **React 19** (and react-dom) are optional peers, so a static site or a Node tool that only
22
+ uses the CSS and `nish-ui/theme` never gets React. Tailwind 4 is needed only for
23
+ `nish-ui/tailwind.css`.
24
+ - The package ships built files: no install or build step. Types are bundled.
21
25
 
22
- The docs site and the nish.software apps write the package as `@nish/ui`. To use their
23
- examples exactly as written, install it under that name with an npm alias:
24
-
25
- ```bash
26
- npm install @nish/ui@npm:nish-ui
27
- ```
28
-
29
- The nish.software apps pin that alias to an exact version,
30
- `"@nish/ui": "npm:nish-ui@X.Y.Z"`. The release fan-out keeps the pin current, so the version is
31
- never written by hand.
32
-
33
- ### Fallback: without the npm registry
34
-
35
- Every release tag carries the same built files, so a machine that cannot reach npm can pin the
36
- tag's tarball, which needs only HTTPS:
37
- `"@nish/ui": "https://codeload.github.com/nishant/ui/tar.gz/refs/tags/vX.Y.Z"`.
26
+ Browser support: the latest two versions of Chrome, Edge, Firefox and Safari (Safari 16.4 or
27
+ later). The CSS needs `color-mix()`, `:has()`, the `inert` attribute and container queries.
28
+ Older browsers get no polyfills.
38
29
 
39
30
  ## Usage
40
31
 
41
- ### React + Tailwind 4
32
+ ### React + Tailwind 4 (Vite)
42
33
 
43
34
  ```css
44
35
  /* src/index.css */
@@ -66,6 +57,67 @@ Style with color roles, never raw palette classes: `bg-th-surface text-th-hi bor
66
57
  They change with the theme. [Getting started](https://design.nish.software/#/getting-started)
67
58
  covers the full setup, Electron included.
68
59
 
60
+ `nish-ui/tailwind.css` scans the package's own components for class names. An app that wants
61
+ Tailwind to scan only the modules it uses imports `nish-ui/tailwind-core.css` (same theme, no
62
+ `@source` line) and adds its own `@source` lines for `node_modules/nish-ui/dist/esm/components/<module>.js`.
63
+
64
+ ### Next.js (App Router)
65
+
66
+ Every component module that uses state, effects or browser APIs starts with `"use client"`,
67
+ so you import components straight into a server component. `cn`, `buttonClass`, `Card`,
68
+ `Badge` and the other pure helpers also work there.
69
+
70
+ ```tsx
71
+ // app/layout.tsx
72
+ import 'nish-ui/tailwind.css'; // after @import 'tailwindcss' in your global CSS, or import both there
73
+ import { NishProvider, Toaster } from 'nish-ui';
74
+
75
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
76
+ return (
77
+ // suppressHydrationWarning: theme-init.js sets data-theme on <html> before React hydrates
78
+ <html lang="en" suppressHydrationWarning>
79
+ <head>
80
+ <script src="/theme-init.js" /> {/* copy node_modules/nish-ui/dist/theme-init.js to public/ */}
81
+ </head>
82
+ <body>
83
+ <NishProvider>
84
+ {children}
85
+ <Toaster />
86
+ </NishProvider>
87
+ </body>
88
+ </html>
89
+ );
90
+ }
91
+ ```
92
+
93
+ ```tsx
94
+ // app/page.tsx: a server component
95
+ import { Button, Card, cn } from 'nish-ui';
96
+
97
+ export default function Page() {
98
+ return (
99
+ <Card className={cn('m-4')}>
100
+ <Button variant="primary">Server-rendered button</Button>
101
+ </Card>
102
+ );
103
+ }
104
+ ```
105
+
106
+ Plain Tailwind in Next.js is `@import 'tailwindcss'; @import 'nish-ui/tailwind.css';` in
107
+ `app/globals.css` with `@tailwindcss/postcss`. Instead of `<script src>` you can inline the file's
108
+ contents with `dangerouslySetInnerHTML`; see Content Security Policy below for the hash.
109
+
110
+ ### Server rendering
111
+
112
+ - Every export renders under `renderToString` in Node without touching `window` or `document`,
113
+ and the first client render equals the server render, so hydration does not warn.
114
+ - Overlays (Modal, Drawer, ConfirmDialog, Popover) render nothing on the server and portal into
115
+ `document.body` (or `<NishProvider portalContainer>`) after hydration.
116
+ - Put `suppressHydrationWarning` on `<html>`: `theme-init.js` writes `data-theme`,
117
+ `data-scheme` and `style="color-scheme"` before React runs.
118
+ - Theme state, the overlay stack and the toast store live on `globalThis`, so every entry
119
+ (`nish-ui`, `nish-ui/theme`, `nish-ui/chart`) and every copy of the package on a page share one.
120
+
69
121
  ### Plain CSS and static HTML
70
122
 
71
123
  Copy the files listed in `dist/files.json` (CSS, `theme-init.js`, `theme.js` and the fonts),
@@ -91,8 +143,10 @@ then:
91
143
  .panel { background: var(--nish-surface); color: var(--nish-hi2); }
92
144
  ```
93
145
 
94
- A classic-script build (`theme.global.js`, `window.nishTheme`) covers pages that cannot use
95
- modules. See [Static sites](https://design.nish.software/#/static-sites).
146
+ The plain CSS is in cascade layers (`nish.base`, `nish.components`), so your own unlayered rules
147
+ win without specificity fights. `nish.min.css` and `nish-components.min.css` are the minified
148
+ copies. A classic-script build (`theme.global.js`, `window.nishTheme`) covers pages that cannot
149
+ use modules. See [Static sites](https://design.nish.software/#/static-sites).
96
150
 
97
151
  ### Without React
98
152
 
@@ -102,18 +156,18 @@ elements for pages that have no React: `<nish-theme-toggle>`, `<nish-sheet>`,
102
156
  and Claude artifacts. They use the same `nish-*` classes as above, so link the stylesheets too.
103
157
 
104
158
  ```html
105
- <script src="https://cdn.jsdelivr.net/npm/nish-ui@X.Y.Z/dist/theme-init.js"></script>
106
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nish-ui@X.Y.Z/dist/nish.css">
107
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nish-ui@X.Y.Z/dist/nish-components.css">
108
- <script type="module" src="https://cdn.jsdelivr.net/npm/nish-ui@X.Y.Z/dist/elements.js"></script>
159
+ <script src="https://cdn.jsdelivr.net/npm/nish-ui@2/dist/theme-init.js"></script>
160
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nish-ui@2/dist/nish.css">
161
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nish-ui@2/dist/nish-components.css">
162
+ <script type="module" src="https://cdn.jsdelivr.net/npm/nish-ui@2/dist/elements.js"></script>
109
163
 
110
164
  <nish-theme-toggle pill></nish-theme-toggle>
111
165
  ```
112
166
 
113
167
  With a bundler: `import 'nish-ui/elements';` and `import { toast } from 'nish-ui/elements';`.
168
+ Pin an exact version (`nish-ui@2.0.0`) in production.
114
169
 
115
- Each entry file is self-contained (about 20 KB gzipped at most), so load only the ones whose
116
- tags the page uses:
170
+ Each entry file is self-contained, so load only the ones whose tags the page uses:
117
171
 
118
172
  - `elements.js` (`nish-ui/elements`): `<nish-theme-toggle>`, `<nish-sheet>`, `<nish-dialog>`,
119
173
  `<nish-bottom-nav>` and `toast()`.
@@ -124,8 +178,11 @@ tags the page uses:
124
178
  `<nish-split>`, `<nish-nav-rail>`, `<nish-scroll-row>`, `<nish-section-nav>` and
125
179
  `<nish-command-palette>`.
126
180
  - `elements-charts.js` (`nish-ui/elements/charts`): `<nish-line-chart>` and `<nish-bar-chart>`.
181
+ - `elements-all.js` (`nish-ui/elements/all`): all four in one file with one copy of Lit, for a
182
+ page that uses elements from several of them.
127
183
 
128
- Most component pages on the docs site, including all the form, feedback and display pages, have an HTML tab with the markup, running live. More in
184
+ Words the elements print come from `configureStrings({ ... })`, exported by every entry.
185
+ Most component pages on the docs site have an HTML tab with the markup, running live. More in
129
186
  [Static sites](https://design.nish.software/#/static-sites).
130
187
 
131
188
  ## Theming
@@ -136,65 +193,168 @@ the one it is based on.
136
193
 
137
194
  - **Before first paint.** `theme-init.js` puts the saved theme on `<html>` before anything
138
195
  renders, then the page follows the OS when the choice is `system`.
139
- - **Across subdomains.** The choice is saved to `localStorage` and, on nish.software or the
140
- domain named by `<html data-nish-domain="example.com">`, to a cookie on that domain, so
141
- picking Mocha on one app opens its sibling apps in Mocha too.
196
+ - **Across subdomains.** The choice is saved to `localStorage` and, on the domain named by
197
+ `<html data-nish-domain="example.com">`, to a cookie on that domain, so picking Mocha on one
198
+ app opens its sibling apps in Mocha too. `data-nish-storage-key="x"` renames the key.
142
199
  - **Scoped.** `<div data-theme="light" data-scheme="light">` themes one subtree.
143
200
  - **Your own themes.** `registerThemes({ rose: 'dark' })` plus `[data-theme='rose']` CSS.
144
201
  - **Canvas and charts.** `readToken('chart-1')` and `onThemeChange()`, or `nish-ui/chart`.
202
+ - **Tokens as data.** `nish-ui/tokens`, `nish-ui/tokens.json` and the W3C Design Tokens file
203
+ `nish-ui/tokens.dtcg.json`.
145
204
 
146
205
  Every role and its value in each theme: [Color](https://design.nish.software/#/color) and
147
- [Themes](https://design.nish.software/#/themes).
206
+ [Themes](https://design.nish.software/#/themes). Every theme function:
207
+ [Theming API](https://design.nish.software/#/theming-api).
208
+
209
+ ## Content Security Policy
210
+
211
+ `theme-init.js` is the only inline script the package asks for. Allow it with a hash, or with a
212
+ nonce:
213
+
214
+ - Hash: `nish-ui/theme-init.sha256` holds `sha256-...` for the shipped `theme-init.js`. Put it
215
+ in `script-src 'sha256-...'` when you inline the file exactly as shipped. The hash is also in
216
+ `dist/files.json` as `themeInitHash`.
217
+ `theme-init.sha256` covers only the file as shipped. The Vite plugin changes the script (comments
218
+ removed, optional prelude and legacyKey code), so for Vite use the plugin's `hash` property
219
+ (`nishThemeInit().hash`) instead.
220
+ - Nonce: `nishThemeInit({ nonce: '__NISH_CSP_NONCE__' })` in `nish-ui/vite` writes that placeholder
221
+ into the injected tag at build time; have your server replace it with a fresh random value on every
222
+ response. Vite runs the transform once per build, so a fixed real nonce (or a function) is baked into
223
+ the file and gives no protection outside the dev server. In other setups give your own
224
+ `<script nonce>` the file's contents.
225
+ - The components set no inline styles that need `style-src 'unsafe-inline'` beyond CSS custom
226
+ properties on elements, and build their DOM without `innerHTML`, so a Trusted Types policy
227
+ (`require-trusted-types-for 'script'`) passes.
228
+ - Fonts are served from the package (`nish-ui/fonts/*`), and Favicon makes no third-party
229
+ request unless you configure one.
230
+
231
+ ## Languages and right-to-left
232
+
233
+ ```tsx
234
+ import { NishProvider } from 'nish-ui';
235
+
236
+ <NishProvider locale="de-DE" dir="ltr" strings={{ close: 'Schließen', cancel: 'Abbrechen', search: 'Suchen' }}>
237
+ <App />
238
+ </NishProvider>
239
+ ```
240
+
241
+ - `strings` replaces any of the English defaults (`DEFAULT_STRINGS` lists every key with the
242
+ components that use it); a prop on one component still wins. Providers nest.
243
+ - `locale` feeds `RelativeTime` and chart axes. `setDefaultLocale('de-DE')` from `nish-ui/format`
244
+ sets it for the formatters outside React (default `en-US`, so output is unchanged until you ask).
245
+ - Layout uses logical properties and arrow keys mirror when the element's computed `direction`
246
+ is `rtl`. Set `dir="rtl"` on `<html>` (or any ancestor) and everything follows.
247
+
248
+ ## Testing your app
249
+
250
+ - **Vitest** (recommended): works as is. Use the `happy-dom` or `jsdom` environment.
251
+ - **Jest** does not load ES modules from `node_modules` by default. Either run it with
252
+ `--experimental-vm-modules`, or add `transformIgnorePatterns: ['/node_modules/(?!nish-ui)']`
253
+ with a transform for `.js` files (babel-jest or `@swc/jest`).
254
+ - No setup is needed for `matchMedia`, `ResizeObserver` or storage; the components guard their use.
255
+ - Overlays portal to `document.body`; query with `screen`, not `container`.
148
256
 
149
257
  ## What's in it
150
258
 
151
- More than 60 components, each with live stories, props and guidelines on the
259
+ More than 100 components, each with live stories, props and guidelines on the
152
260
  [docs site](https://design.nish.software/#/components):
153
261
 
154
262
  - **Actions and inputs:** Button, IconButton, Input, Textarea, Select, Combobox, Checkbox,
155
- Switch, Segmented, Chip, SearchInput, Field
156
- - **Feedback:** Toast, Callout, Spinner, Skeleton, EmptyState, ErrorState, StatusDot, Meter
157
- - **Overlays:** Modal, Drawer, ConfirmDialog, Popover, DropdownMenu, Tooltip
158
- - **Settings:** SettingsSection, SettingRow, NumberField, ServiceTokensSection (list and revoke
159
- service tokens)
160
- - **Layout and navigation:** AppShell (bottom bar, rail and a collapsible sidebar), AppHeader, BottomNav, NavRail, MoreSheet, Tabs,
161
- PageHeader, Card, Table, FilterBar, SplitStage
162
- - **Data and motion:** Stat, Sparkline, MediaRow, ActivityFeed, WorkflowBoard, SystemCanvas,
163
- AnimatedList
263
+ Switch, RadioGroup, Slider, TagInput, FileDropzone, NumberField, Segmented, Chip, SearchInput,
264
+ Field, FieldGroup, Label
265
+ - **Feedback:** Toast, Callout, Spinner, Skeleton, Progress, EmptyState, ErrorState, StatusDot,
266
+ Meter, LoadingBar, ConnectionBanner, AppErrorBoundary
267
+ - **Overlays:** Modal, Drawer, ConfirmDialog, Popover, DropdownMenu, Tooltip, CommandPalette,
268
+ Portal
269
+ - **Settings:** SettingsSection, SettingRow, ServiceTokensSection (list and revoke service
270
+ tokens)
271
+ - **Layout and navigation:** AppShell (bottom bar, rail and a collapsible sidebar), AppHeader,
272
+ BottomNav, NavRail, MoreSheet, SectionNav, Tabs, Pagination, Breadcrumbs, Accordion,
273
+ Disclosure, PageHeader, PageContainer, SectionHeader, Card, Separator, StickyBar,
274
+ StickyActionBar, ScrollRow
275
+ - **Data and display:** Table, ResponsiveTable, FilterBar, Stat, Badge, Avatar, AvatarGroup,
276
+ Kbd, KeyValueList, ListRow, LinkCard, Favicon, RelativeTime, CopyButton, LineChart, BarChart,
277
+ Sparkline, ChartLegend, RangeBar, MediaRow, ActivityFeed, Inbox, VisuallyHidden
278
+ - **Flow and canvas:** SplitStage, WorkflowBoard, StepBar, FlowSteps, AgentNode, AnimatedList,
279
+ TickerText, SystemCanvas
280
+ - **Runtime:** NishProvider (strings, locale, direction, portal container), hooks such as
281
+ `useMediaQuery`, `useLocalStorage`, `useUrlState` and `useResource`
164
282
 
165
283
  Entry points:
166
284
 
167
285
  | Import | What |
168
286
  |---|---|
169
287
  | `nish-ui` | React components, hooks, theme functions |
170
- | `nish-ui/tailwind.css` | Tailwind 4 theme and base styles |
171
- | `nish-ui/nish.css` | The same without Tailwind |
172
- | `nish-ui/theme` | Theme switching, React-free |
173
- | `nish-ui/format` | Money, percent, date formatters |
288
+ | `nish-ui/tailwind.css` | Tailwind 4 theme, base styles, component scan |
289
+ | `nish-ui/tailwind-core.css` | The same without the component scan |
290
+ | `nish-ui/nish.css` | The theme and base styles without Tailwind |
291
+ | `nish-ui/nish-components.css` | `.nish-btn`, `.nish-card` and the other classes |
292
+ | `nish-ui/theme` | Theme switching and static-page helpers, React-free |
293
+ | `nish-ui/format` | Money, percent, date formatters (locale-aware) |
174
294
  | `nish-ui/chart` | Chart colors for any library |
295
+ | `nish-ui/tokens` | Token data for Node and build tools |
296
+ | `nish-ui/tokens.json` | The same as JSON, and `tokens.dtcg.json` for design tools |
297
+ | `nish-ui/system-canvas` | The node-and-edge canvas component |
298
+ | `nish-ui/split-layout` | Split-pane layout math, React-free |
299
+ | `nish-ui/elements` | Custom elements; also `/forms`, `/data`, `/charts`, `/all` |
175
300
  | `nish-ui/vite` | The theme-init Vite plugin |
176
301
  | `nish-ui/eslint` | Lint rules for theme classes |
177
302
 
178
- Also `nish-ui/tokens` (token data for Node), `nish-ui/tsconfig/*` (strict presets), the
179
- `nish-th-check` CLI, and `nish-ui/server`, `nish-ui/server/hono` and `nish-ui/inbox-client`
180
- (the nish.software apps' login and inbox kit, which other projects can ignore).
303
+ Also `nish-ui/theme-init.js` and `theme-init.sha256`, `nish-ui/theme.global.js`,
304
+ `nish-ui/fonts/*`, `nish-ui/tsconfig/*` (strict presets), the `nish-th-check` CLI, and
305
+ `nish-ui/server`, `nish-ui/server/hono` and `nish-ui/inbox-client` (a login, session and inbox
306
+ kit for Hono servers; other projects can ignore it).
181
307
  Details: [Vite plugin and lint](https://design.nish.software/#/components/vite-plugin).
182
308
 
309
+ ## Bundle size
310
+
311
+ Measured with esbuild (minified, React external) from `dist/esm` on every pull request by
312
+ `npm run size`, which fails the build when a budget is passed:
313
+
314
+ | Import | Gzip |
315
+ |---|---|
316
+ | `cn` | under 10 KB |
317
+ | `Button` | under 11 KB |
318
+ | `useMediaQuery` | under 1.5 KB |
319
+ | `nish-ui/theme` | under 12 KB |
320
+ | `nish-ui/format` | under 4 KB |
321
+
322
+ The JavaScript is one file per source module with `/* @__PURE__ */` annotations and a
323
+ `sideEffects` list, so an import costs what it uses. The budgets are in
324
+ `tools/size-budgets.json`; the whole package is checked against a 2.5 MB tarball limit.
325
+
183
326
  ## Accessibility
184
327
 
185
- - Every theme passes WCAG contrast (4.5:1 text, 3:1 graphics), checked in CI and shown as a
186
- matrix on [Themes](https://design.nish.software/#/themes).
328
+ - Every theme passes WCAG contrast (4.5:1 text, 3:1 graphics and form-control borders), checked
329
+ in CI and shown as a matrix on [Themes](https://design.nish.software/#/themes).
187
330
  - Controls grow to 44px tap targets on touch screens and stay compact under a mouse.
188
- - Visible focus rings, focus traps in dialogs, live regions for toasts, and reduced motion
189
- respected everywhere.
190
- - Every component is checked at 360px, 840px and desktop widths, in light and dark.
331
+ - Visible focus rings, focus traps in dialogs, live regions for toasts and loading states,
332
+ forced-colors (Windows High Contrast) rules and reduced motion respected everywhere.
333
+ - Tooltip follows WCAG 1.4.13: it opens on focus and hover, closes with Escape and can be
334
+ hovered, with no extra Tab stop.
335
+
336
+ ## What CI checks
337
+
338
+ Every pull request runs: typecheck, lint, the WCAG contrast check over every theme, the unit
339
+ tests (Vitest, in a DOM and in plain Node with no DOM, including server rendering of every
340
+ export and two copies of the package on one page), Playwright specs for overlays, custom
341
+ elements, hydration, Content Security Policy and Trusted Types, an axe accessibility scan with
342
+ zero serious or critical findings, a consumer build in Next.js (App Router), Vite and a
343
+ TypeScript matrix (5.4, 5.9 and 6.0 with `bundler` and `node16` resolution), the bundle size
344
+ budgets, a screenshot check of the docs site at 360, 840 and 1440 px in light and dark, and an
345
+ exports snapshot that fails when a public name or `.nish-*` class disappears. Releases publish to
346
+ npm with provenance. The docs site is checked at 360, 840 and 1440 px; not every component is
347
+ checked in every theme on every pull request.
191
348
 
192
349
  ## Links
193
350
 
194
351
  - Docs and live components: [design.nish.software](https://design.nish.software)
195
352
  - Changelog: [CHANGELOG.md](https://github.com/nishant/ui/blob/master/CHANGELOG.md)
196
- - Releasing (CI, the app fan-out, npm): [docs/RELEASING.md](https://github.com/nishant/ui/blob/master/docs/RELEASING.md)
353
+ - Moving from 1.x: [docs/MIGRATING-2.0.md](https://github.com/nishant/ui/blob/master/docs/MIGRATING-2.0.md)
354
+ - Contributing: [CONTRIBUTING.md](https://github.com/nishant/ui/blob/master/CONTRIBUTING.md)
355
+ - Security: [SECURITY.md](https://github.com/nishant/ui/blob/master/SECURITY.md)
197
356
  - Working on this repo: [docs/DEVELOPING.md](https://github.com/nishant/ui/blob/master/docs/DEVELOPING.md)
357
+ - Releasing: [docs/RELEASING.md](https://github.com/nishant/ui/blob/master/docs/RELEASING.md)
198
358
  - Troubleshooting and versioning: [Getting started](https://design.nish.software/#/getting-started)
199
359
  - Issues: [github.com/nishant/ui/issues](https://github.com/nishant/ui/issues)
200
360