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.
- package/README.md +218 -58
- package/dist/base-tailwind.css +1757 -0
- package/dist/base.css +1590 -1445
- package/dist/chart.d.ts +4 -1
- package/dist/chart.js +122 -49
- package/dist/elements-all.d.ts +8 -0
- package/dist/elements-all.js +178 -0
- package/dist/elements-charts.d.ts +71 -0
- package/dist/elements-charts.js +56 -57
- package/dist/elements-data.d.ts +71 -0
- package/dist/elements-data.js +5 -6
- package/dist/elements-forms.d.ts +71 -0
- package/dist/elements-forms.js +24 -25
- package/dist/elements.d.ts +71 -0
- package/dist/elements.js +4 -5
- package/dist/esm/chart-values.js +58 -0
- package/dist/esm/chart.js +10 -0
- package/dist/esm/cn.js +19 -0
- package/dist/esm/combobox-filter.js +13 -0
- package/dist/esm/components/accordion.js +166 -0
- package/dist/esm/components/app-shell.js +198 -0
- package/dist/esm/components/avatar-classes.js +28 -0
- package/dist/esm/components/avatar.js +113 -0
- package/dist/esm/components/breadcrumbs.js +154 -0
- package/dist/esm/components/canvas/follow-caption.js +32 -0
- package/dist/esm/components/canvas/follow.js +119 -0
- package/dist/esm/components/canvas/icons.js +70 -0
- package/dist/esm/components/canvas/index.js +10 -0
- package/dist/esm/components/canvas/layout.js +258 -0
- package/dist/esm/components/canvas/legend.js +93 -0
- package/dist/esm/components/canvas/minimap.js +127 -0
- package/dist/esm/components/canvas/node.js +87 -0
- package/dist/esm/components/canvas/route.js +262 -0
- package/dist/esm/components/canvas/system-canvas.js +837 -0
- package/dist/esm/components/canvas/types.js +10 -0
- package/dist/esm/components/canvas/view.js +47 -0
- package/dist/esm/components/chart-hooks.js +19 -0
- package/dist/esm/components/charts.js +467 -0
- package/dist/esm/components/client.js +24 -0
- package/dist/esm/components/combobox.js +343 -0
- package/dist/esm/components/command.js +403 -0
- package/dist/esm/components/data-classes.js +159 -0
- package/dist/esm/components/data.js +517 -0
- package/dist/esm/components/display-classes.js +130 -0
- package/dist/esm/components/display.js +755 -0
- package/dist/esm/components/error-boundary.js +64 -0
- package/dist/esm/components/feedback.js +136 -0
- package/dist/esm/components/file-dropzone.js +184 -0
- package/dist/esm/components/filters.js +108 -0
- package/dist/esm/components/flow.js +746 -0
- package/dist/esm/components/forms-classes.js +43 -0
- package/dist/esm/components/forms.js +581 -0
- package/dist/esm/components/hooks-classes.js +9 -0
- package/dist/esm/components/hooks.js +236 -0
- package/dist/esm/components/icons.js +96 -0
- package/dist/esm/components/inbox-classes.js +29 -0
- package/dist/esm/components/inbox.js +257 -0
- package/dist/esm/components/latest.js +13 -0
- package/dist/esm/components/layout-vars.js +96 -0
- package/dist/esm/components/layout.js +272 -0
- package/dist/esm/components/media.js +143 -0
- package/dist/esm/components/nav.js +614 -0
- package/dist/esm/components/overlay-classes.js +66 -0
- package/dist/esm/components/overlay.js +1447 -0
- package/dist/esm/components/pagination-classes.js +29 -0
- package/dist/esm/components/pagination.js +154 -0
- package/dist/esm/components/portal.js +16 -0
- package/dist/esm/components/primitives-classes.js +198 -0
- package/dist/esm/components/primitives.js +268 -0
- package/dist/esm/components/progress.js +77 -0
- package/dist/esm/components/provider.js +32 -0
- package/dist/esm/components/radio-group.js +186 -0
- package/dist/esm/components/resource-classes.js +133 -0
- package/dist/esm/components/resource.js +209 -0
- package/dist/esm/components/segmented.js +178 -0
- package/dist/esm/components/separator.js +38 -0
- package/dist/esm/components/service-tokens.js +221 -0
- package/dist/esm/components/settings.js +301 -0
- package/dist/esm/components/slider.js +262 -0
- package/dist/esm/components/split-classes.js +8 -0
- package/dist/esm/components/split.js +411 -0
- package/dist/esm/components/strings.js +119 -0
- package/dist/esm/components/table.js +144 -0
- package/dist/esm/components/tabs-classes.js +21 -0
- package/dist/esm/components/tabs.js +201 -0
- package/dist/esm/components/tag-input.js +257 -0
- package/dist/esm/components/theme-toggle.js +177 -0
- package/dist/esm/components/toast.js +361 -0
- package/dist/esm/components/url-state.js +118 -0
- package/dist/esm/components/visually-hidden.js +20 -0
- package/dist/esm/format.js +320 -0
- package/dist/esm/inbox-client.js +2 -0
- package/dist/esm/inbox-types.js +2 -0
- package/dist/esm/index.js +320 -0
- package/dist/esm/runtime.js +37 -0
- package/dist/esm/server/inbox/client.js +297 -0
- package/dist/esm/server/inbox/types.js +24 -0
- package/dist/esm/sparkline-path.js +59 -0
- package/dist/esm/split-layout.js +419 -0
- package/dist/esm/system-canvas.js +2 -0
- package/dist/esm/theme.js +804 -0
- package/dist/esm/tokens.mjs +425 -0
- package/dist/esm/url.js +20 -0
- package/dist/files.json +5 -1
- package/dist/fonts/LICENSE-Inter.txt +93 -0
- package/dist/format.d.ts +32 -18
- package/dist/format.js +227 -82
- package/dist/inbox-client.js +3 -1
- package/dist/index.d.ts +1686 -667
- package/dist/nish-components.css +4649 -4506
- package/dist/nish-components.min.css +1 -0
- package/dist/nish.css +1603 -1450
- package/dist/nish.min.css +1 -0
- package/dist/node/eslint.js +29 -14
- package/dist/node/th-check.js +29 -14
- package/dist/node/vite.d.ts +12 -0
- package/dist/node/vite.js +12 -2
- package/dist/server/hono.d.ts +15 -6
- package/dist/server/hono.js +30 -25
- package/dist/server/index.d.ts +3 -10
- package/dist/server/index.js +71 -38
- package/dist/{spa-DuVB5O7S.d.ts → spa-BLlMc0eI.d.ts} +38 -5
- package/dist/system-canvas-BLuWd69H.d.ts +183 -0
- package/dist/system-canvas.d.ts +2 -168
- package/dist/tailwind-core.css +114 -0
- package/dist/tailwind.css +3 -7
- package/dist/theme-init.js +23 -9
- package/dist/theme-init.sha256 +1 -0
- package/dist/theme.d.ts +243 -4
- package/dist/theme.global.js +356 -89
- package/dist/theme.js +337 -67
- package/dist/tokens.css +14 -6
- package/dist/tokens.dtcg.json +1513 -0
- package/dist/tokens.js +29 -14
- package/dist/tokens.json +512 -0
- package/package.json +51 -13
- package/dist/chart.js.map +0 -1
- package/dist/elements-charts.js.map +0 -1
- package/dist/elements-data.js.map +0 -1
- package/dist/elements-forms.js.map +0 -1
- package/dist/elements.js.map +0 -1
- package/dist/format.js.map +0 -1
- package/dist/inbox-client.js.map +0 -1
- package/dist/index.js +0 -10260
- package/dist/index.js.map +0 -1
- package/dist/server/hono.js.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/split-layout.js.map +0 -1
- package/dist/system-canvas.js +0 -2204
- package/dist/system-canvas.js.map +0 -1
- package/dist/theme.global.js.map +0 -1
- package/dist/theme.js.map +0 -1
|
@@ -0,0 +1,425 @@
|
|
|
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
|
+
};
|
package/dist/esm/url.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/url.ts
|
|
2
|
+
function safeUrl(href) {
|
|
3
|
+
if (href == null) return null;
|
|
4
|
+
const raw = String(href);
|
|
5
|
+
let start = 0;
|
|
6
|
+
let end = raw.length;
|
|
7
|
+
while (start < end && raw.charCodeAt(start) <= 32) start++;
|
|
8
|
+
while (end > start && raw.charCodeAt(end - 1) <= 32) end--;
|
|
9
|
+
const out = raw.slice(start, end).replace(/[\t\n\r]/g, "");
|
|
10
|
+
if (out === "") return null;
|
|
11
|
+
if (out !== out.trim()) return null;
|
|
12
|
+
if (/[\u0000-\u001f\u007f]/.test(out)) return null;
|
|
13
|
+
const m = /^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(out);
|
|
14
|
+
if (!m) return out;
|
|
15
|
+
const scheme = m[1].toLowerCase();
|
|
16
|
+
return scheme === "http" || scheme === "https" || scheme === "mailto" || scheme === "tel" ? out : null;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
safeUrl
|
|
20
|
+
};
|
package/dist/files.json
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"static": [
|
|
3
3
|
"nish.css",
|
|
4
4
|
"nish-components.css",
|
|
5
|
+
"nish.min.css",
|
|
6
|
+
"nish-components.min.css",
|
|
5
7
|
"theme-init.js",
|
|
6
8
|
"theme.js",
|
|
7
9
|
"theme.global.js",
|
|
@@ -9,7 +11,9 @@
|
|
|
9
11
|
"elements-forms.js",
|
|
10
12
|
"elements-data.js",
|
|
11
13
|
"elements-charts.js",
|
|
14
|
+
"elements-all.js",
|
|
12
15
|
"fonts/inter-latin-wght-normal.3100e775.woff2",
|
|
13
16
|
"fonts/inter-latin-ext-wght-normal.34b9c504.woff2"
|
|
14
|
-
]
|
|
17
|
+
],
|
|
18
|
+
"themeInitHash": "sha256-rGP+jF8KBMsf35Md4+Zv+b6LagiGzxoV8QzAVcU6RIg="
|
|
15
19
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
package/dist/format.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/** Sets the locale every formatter uses when it is not given one. Default 'en-US'. */
|
|
2
|
+
declare function setDefaultLocale(locale: string): void;
|
|
3
|
+
/** The locale formatters use when not given one. */
|
|
4
|
+
declare function getDefaultLocale(): string;
|
|
5
|
+
/** Options every formatter accepts. */
|
|
6
|
+
interface LocaleOptions {
|
|
7
|
+
/** BCP 47 tag, e.g. 'de-DE'. Default getDefaultLocale() ('en-US'). */
|
|
8
|
+
locale?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Options for the date formatters. */
|
|
11
|
+
interface DateOptions extends LocaleOptions {
|
|
12
|
+
/** IANA zone such as 'UTC'. Default the viewer's zone. A bare YYYY-MM-DD string is a calendar day and ignores it. */
|
|
13
|
+
timeZone?: string;
|
|
14
|
+
}
|
|
15
|
+
interface MoneyOptions extends LocaleOptions {
|
|
2
16
|
/** 'auto' (default) shows cents when |v| < 1000 or v has cents; 'always'; 'never'. */
|
|
3
17
|
cents?: 'auto' | 'always' | 'never';
|
|
4
18
|
/** Short form: $12.3k, $4.5M. */
|
|
@@ -6,11 +20,11 @@ interface MoneyOptions {
|
|
|
6
20
|
/** ISO 4217 code. Default USD. */
|
|
7
21
|
currency?: string;
|
|
8
22
|
}
|
|
9
|
-
/** Money: 1234.56 → "$1,234.56"; negatives use a true minus sign. */
|
|
23
|
+
/** Money: 1234.56 → "$1,234.56"; negatives use a true minus sign. The symbol always comes first. */
|
|
10
24
|
declare function money(v: number | null | undefined, o?: MoneyOptions): string;
|
|
11
25
|
/** Signed money: "+$12.30", "−$4.00", and "No change" when |v| < 0.005. */
|
|
12
26
|
declare function signedMoney(v: number | null | undefined, o?: MoneyOptions): string;
|
|
13
|
-
interface PctOptions {
|
|
27
|
+
interface PctOptions extends LocaleOptions {
|
|
14
28
|
/** Fraction digits. Default 1. */
|
|
15
29
|
digits?: number;
|
|
16
30
|
/** True (default): the value is a ratio, 0.123 → "12.3%". False: it is already a percent. */
|
|
@@ -20,7 +34,7 @@ interface PctOptions {
|
|
|
20
34
|
}
|
|
21
35
|
/** Percent: 0.123 → "12.3%". */
|
|
22
36
|
declare function pct(v: number | null | undefined, o?: PctOptions): string;
|
|
23
|
-
interface NumOptions {
|
|
37
|
+
interface NumOptions extends LocaleOptions {
|
|
24
38
|
/** Fixed fraction digits. Default: up to 2, trailing zeros trimmed (1 when compact). */
|
|
25
39
|
digits?: number;
|
|
26
40
|
/** Short form: 12.3k, 4.5M. */
|
|
@@ -29,31 +43,31 @@ interface NumOptions {
|
|
|
29
43
|
/** A plain number with thousands separators: 1234.5 → "1,234.5". */
|
|
30
44
|
declare function num(v: number | null | undefined, o?: NumOptions): string;
|
|
31
45
|
/** A number with an explicit sign: "+1.20", "−0.40". Digits default 2. */
|
|
32
|
-
declare function signed(v: number | null | undefined, o?: {
|
|
46
|
+
declare function signed(v: number | null | undefined, o?: LocaleOptions & {
|
|
33
47
|
digits?: number;
|
|
34
48
|
}): string;
|
|
35
49
|
/** File sizes in 1024 steps: 1258291 → "1.2 MB". */
|
|
36
|
-
declare function bytes(v: number | null | undefined): string;
|
|
50
|
+
declare function bytes(v: number | null | undefined, o?: LocaleOptions): string;
|
|
37
51
|
/** A length of time from seconds, two largest units: 24000 → "6h 40m" (long: "6 hours 40 minutes"). */
|
|
38
|
-
declare function duration(seconds: number | null | undefined, o?: {
|
|
52
|
+
declare function duration(seconds: number | null | undefined, o?: LocaleOptions & {
|
|
39
53
|
style?: 'short' | 'long';
|
|
40
54
|
}): string;
|
|
41
55
|
type DateInput = Date | number | string;
|
|
42
|
-
|
|
43
|
-
declare function ago(t: DateInput | null | undefined, o?: {
|
|
56
|
+
interface AgoOptions extends LocaleOptions {
|
|
44
57
|
now?: number;
|
|
45
58
|
style?: 'short' | 'long';
|
|
46
|
-
}
|
|
59
|
+
}
|
|
60
|
+
/** How long ago (or from now): "just now", "3m ago", "in 2h". Long style: "3 minutes ago". Other languages use Intl.RelativeTimeFormat. */
|
|
61
|
+
declare function ago(t: DateInput | null | undefined, o?: AgoOptions): string;
|
|
62
|
+
type DateStyle = 'short' | 'medium' | 'long' | 'weekday';
|
|
47
63
|
/** A calendar date: 'short' "Oct 28", 'medium' "Oct 28, 2026", 'long' "Wednesday, October 28, 2026", 'weekday' "Wed 10/28". */
|
|
48
|
-
declare function date(t: DateInput | null | undefined, style?:
|
|
64
|
+
declare function date(t: DateInput | null | undefined, style?: DateStyle, o?: DateOptions): string;
|
|
49
65
|
/** Time of day: "7:42 AM". Pass timeZone for a zone other than the viewer's. */
|
|
50
|
-
declare function time(t: DateInput | null | undefined, o?:
|
|
51
|
-
timeZone?: string;
|
|
52
|
-
}): string;
|
|
66
|
+
declare function time(t: DateInput | null | undefined, o?: DateOptions): string;
|
|
53
67
|
/** Date and time: "Oct 28, 7:42 AM". */
|
|
54
|
-
declare function dateTime(t: DateInput | null | undefined): string;
|
|
68
|
+
declare function dateTime(t: DateInput | null | undefined, o?: DateOptions): string;
|
|
55
69
|
/** A span of days: "Dec 12 – 16", "Dec 30 – Jan 2", "Dec 30, 2026 – Jan 2, 2027". */
|
|
56
|
-
declare function dateRange(a: DateInput | null | undefined, b: DateInput | null | undefined): string;
|
|
70
|
+
declare function dateRange(a: DateInput | null | undefined, b: DateInput | null | undefined, o?: DateOptions): string;
|
|
57
71
|
|
|
58
|
-
export { ago, bytes, date, dateRange, dateTime, duration, money, num, pct, signed, signedMoney, time };
|
|
59
|
-
export type { MoneyOptions, NumOptions, PctOptions };
|
|
72
|
+
export { ago, bytes, date, dateRange, dateTime, duration, getDefaultLocale, money, num, pct, setDefaultLocale, signed, signedMoney, time };
|
|
73
|
+
export type { AgoOptions, DateOptions, LocaleOptions, MoneyOptions, NumOptions, PctOptions };
|