nish-ui 0.0.0-stage → 1.4.1
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/LICENSE +21 -0
- package/README.md +158 -2
- package/dist/base.css +1612 -0
- package/dist/chart.d.ts +44 -0
- package/dist/chart.js +406 -0
- package/dist/chart.js.map +1 -0
- package/dist/files.json +11 -0
- package/dist/fonts/inter-latin-ext-wght-normal.34b9c504.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.3100e775.woff2 +0 -0
- package/dist/fonts.css +22 -0
- package/dist/format.d.ts +59 -0
- package/dist/format.js +202 -0
- package/dist/format.js.map +1 -0
- package/dist/inbox-client.d.ts +226 -0
- package/dist/inbox-client.js +318 -0
- package/dist/inbox-client.js.map +1 -0
- package/dist/index.d.ts +3302 -0
- package/dist/index.js +9912 -0
- package/dist/index.js.map +1 -0
- package/dist/nish-components.css +2242 -0
- package/dist/nish.css +2134 -0
- package/dist/node/eslint.d.ts +70 -0
- package/dist/node/eslint.js +441 -0
- package/dist/node/th-check.d.ts +8 -0
- package/dist/node/th-check.js +411 -0
- package/dist/node/vite.d.ts +30 -0
- package/dist/node/vite.js +28 -0
- package/dist/server/hono.d.ts +70 -0
- package/dist/server/hono.js +276 -0
- package/dist/server/hono.js.map +1 -0
- package/dist/server/index.d.ts +192 -0
- package/dist/server/index.js +797 -0
- package/dist/server/index.js.map +1 -0
- package/dist/spa-EPM1E0Va.d.ts +239 -0
- package/dist/split-layout.d.ts +59 -0
- package/dist/split-layout.js +420 -0
- package/dist/split-layout.js.map +1 -0
- package/dist/system-canvas.d.ts +168 -0
- package/dist/system-canvas.js +2204 -0
- package/dist/system-canvas.js.map +1 -0
- package/dist/tailwind.css +120 -0
- package/dist/theme-init.js +52 -0
- package/dist/theme.d.ts +176 -0
- package/dist/theme.global.js +984 -0
- package/dist/theme.global.js.map +1 -0
- package/dist/theme.js +946 -0
- package/dist/theme.js.map +1 -0
- package/dist/tokens.css +496 -0
- package/dist/tokens.d.ts +17 -0
- package/dist/tokens.js +410 -0
- package/package.json +154 -4
- package/tsconfig/base.json +20 -0
- package/tsconfig/node.json +10 -0
- package/tsconfig/react.json +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nishant Arora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,159 @@
|
|
|
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.
|
|
6
|
+
|
|
7
|
+
**See every component and token live, in every theme: [design.nish.software](https://design.nish.software)**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/nish-ui)
|
|
10
|
+
[](https://github.com/nishant/ui/blob/master/LICENSE)
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install nish-ui
|
|
16
|
+
```
|
|
17
|
+
|
|
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.
|
|
21
|
+
|
|
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 a git tag instead, which carries the same built files:
|
|
30
|
+
`"@nish/ui": "https://codeload.github.com/nishant/ui/tar.gz/refs/tags/vX.Y.Z"`. The release
|
|
31
|
+
fan-out keeps that pin current, so the version is never written by hand.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### React + Tailwind 4
|
|
36
|
+
|
|
37
|
+
```css
|
|
38
|
+
/* src/index.css */
|
|
39
|
+
@import 'tailwindcss';
|
|
40
|
+
@import 'nish-ui/tailwind.css';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
// vite.config.ts: inlines theme-init.js at the top of <head>, so there is no flash of the wrong theme
|
|
45
|
+
import { nishThemeInit } from 'nish-ui/vite';
|
|
46
|
+
// plugins: [nishThemeInit(), react(), tailwindcss()]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { initTheme, ThemeToggle, Toaster, Button, toast } from 'nish-ui';
|
|
51
|
+
|
|
52
|
+
initTheme(); // once, before render
|
|
53
|
+
|
|
54
|
+
<ThemeToggle presets />
|
|
55
|
+
<Toaster />
|
|
56
|
+
<Button variant="primary" onClick={() => toast.success('Saved')}>Save</Button>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Style with color roles, never raw palette classes: `bg-th-surface text-th-hi border-th-line`.
|
|
60
|
+
They change with the theme. [Getting started](https://design.nish.software/#/getting-started)
|
|
61
|
+
covers the full setup, Electron included.
|
|
62
|
+
|
|
63
|
+
### Plain CSS and static HTML
|
|
64
|
+
|
|
65
|
+
Copy the files listed in `dist/files.json` (CSS, `theme-init.js`, `theme.js` and the fonts),
|
|
66
|
+
then:
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<head>
|
|
70
|
+
<script src="nish/theme-init.js"></script>
|
|
71
|
+
<link rel="stylesheet" href="nish/nish.css">
|
|
72
|
+
<link rel="stylesheet" href="nish/nish-components.css"> <!-- optional: .nish-btn, .nish-card, ... -->
|
|
73
|
+
</head>
|
|
74
|
+
<body>
|
|
75
|
+
<button id="theme" type="button" class="nish-theme-btn"></button>
|
|
76
|
+
<script type="module">
|
|
77
|
+
import { initTheme, mountThemeToggle } from './nish/theme.js';
|
|
78
|
+
initTheme();
|
|
79
|
+
mountThemeToggle(document.querySelector('#theme'));
|
|
80
|
+
</script>
|
|
81
|
+
</body>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
.panel { background: var(--nish-surface); color: var(--nish-hi2); }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
A classic-script build (`theme.global.js`, `window.nishTheme`) covers pages that cannot use
|
|
89
|
+
modules. See [Static sites](https://design.nish.software/#/static-sites).
|
|
90
|
+
|
|
91
|
+
## Theming
|
|
92
|
+
|
|
93
|
+
Seven themes: `dark` (the default), `light`, and the presets `slate`, `terminal`, `mocha`,
|
|
94
|
+
`ocean` and `contrast`. Each preset is dark or light, so a page limited to those two shows
|
|
95
|
+
the one it is based on.
|
|
96
|
+
|
|
97
|
+
- **Before first paint.** `theme-init.js` puts the saved theme on `<html>` before anything
|
|
98
|
+
renders, then the page follows the OS when the choice is `system`.
|
|
99
|
+
- **Across subdomains.** The choice is saved to `localStorage` and, on nish.software or the
|
|
100
|
+
domain named by `<html data-nish-domain="example.com">`, to a cookie on that domain, so
|
|
101
|
+
picking Mocha on one app opens its sibling apps in Mocha too.
|
|
102
|
+
- **Scoped.** `<div data-theme="light" data-scheme="light">` themes one subtree.
|
|
103
|
+
- **Your own themes.** `registerThemes({ rose: 'dark' })` plus `[data-theme='rose']` CSS.
|
|
104
|
+
- **Canvas and charts.** `readToken('chart-1')` and `onThemeChange()`, or `nish-ui/chart`.
|
|
105
|
+
|
|
106
|
+
Every role and its value in each theme: [Color](https://design.nish.software/#/color) and
|
|
107
|
+
[Themes](https://design.nish.software/#/themes).
|
|
108
|
+
|
|
109
|
+
## What's in it
|
|
110
|
+
|
|
111
|
+
More than 60 components, each with live stories, props and guidelines on the
|
|
112
|
+
[docs site](https://design.nish.software/#/components):
|
|
113
|
+
|
|
114
|
+
- **Actions and inputs:** Button, IconButton, Input, Textarea, Select, Combobox, Checkbox,
|
|
115
|
+
Switch, Segmented, Chip, SearchInput, Field
|
|
116
|
+
- **Feedback:** Toast, Callout, Spinner, Skeleton, EmptyState, ErrorState, StatusDot, Meter
|
|
117
|
+
- **Overlays:** Modal, Drawer, ConfirmDialog, Popover, DropdownMenu, Tooltip
|
|
118
|
+
- **Layout and navigation:** AppShell, AppHeader, BottomNav, NavRail, MoreSheet, Tabs,
|
|
119
|
+
PageHeader, Card, Table, FilterBar, SplitStage
|
|
120
|
+
- **Data and motion:** Stat, Sparkline, MediaRow, ActivityFeed, WorkflowBoard, SystemCanvas,
|
|
121
|
+
AnimatedList
|
|
122
|
+
|
|
123
|
+
Entry points:
|
|
124
|
+
|
|
125
|
+
| Import | What |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `nish-ui` | React components, hooks, theme functions |
|
|
128
|
+
| `nish-ui/tailwind.css` | Tailwind 4 theme and base styles |
|
|
129
|
+
| `nish-ui/nish.css` | The same without Tailwind |
|
|
130
|
+
| `nish-ui/theme` | Theme switching, React-free |
|
|
131
|
+
| `nish-ui/format` | Money, percent, date formatters |
|
|
132
|
+
| `nish-ui/chart` | Chart colors for any library |
|
|
133
|
+
| `nish-ui/vite` | The theme-init Vite plugin |
|
|
134
|
+
| `nish-ui/eslint` | Lint rules for theme classes |
|
|
135
|
+
|
|
136
|
+
Also `nish-ui/tokens` (token data for Node), `nish-ui/tsconfig/*` (strict presets), the
|
|
137
|
+
`nish-th-check` CLI, and `nish-ui/server`, `nish-ui/server/hono` and `nish-ui/inbox-client`
|
|
138
|
+
(the nish.software apps' login and inbox kit, which other projects can ignore).
|
|
139
|
+
Details: [Vite plugin and lint](https://design.nish.software/#/components/vite-plugin).
|
|
140
|
+
|
|
141
|
+
## Accessibility
|
|
142
|
+
|
|
143
|
+
- Every theme passes WCAG contrast (4.5:1 text, 3:1 graphics), checked in CI and shown as a
|
|
144
|
+
matrix on [Themes](https://design.nish.software/#/themes).
|
|
145
|
+
- Controls grow to 44px tap targets on touch screens and stay compact under a mouse.
|
|
146
|
+
- Visible focus rings, focus traps in dialogs, live regions for toasts, and reduced motion
|
|
147
|
+
respected everywhere.
|
|
148
|
+
- Every component is checked at 360px, 840px and desktop widths, in light and dark.
|
|
149
|
+
|
|
150
|
+
## Links
|
|
151
|
+
|
|
152
|
+
- Docs and live components: [design.nish.software](https://design.nish.software)
|
|
153
|
+
- Changelog: [CHANGELOG.md](https://github.com/nishant/ui/blob/master/CHANGELOG.md)
|
|
154
|
+
- Releasing (CI, the app fan-out, npm): [docs/RELEASING.md](https://github.com/nishant/ui/blob/master/docs/RELEASING.md)
|
|
155
|
+
- Working on this repo: [docs/DEVELOPING.md](https://github.com/nishant/ui/blob/master/docs/DEVELOPING.md)
|
|
156
|
+
- Troubleshooting and versioning: [Getting started](https://design.nish.software/#/getting-started)
|
|
157
|
+
- Issues: [github.com/nishant/ui/issues](https://github.com/nishant/ui/issues)
|
|
158
|
+
|
|
159
|
+
MIT licensed.
|