numori-ui 0.1.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 (130) hide show
  1. package/LICENSE +651 -0
  2. package/README.md +466 -0
  3. package/dist/components/Alert.js +137 -0
  4. package/dist/components/Alert.js.map +1 -0
  5. package/dist/components/Avatar.js +133 -0
  6. package/dist/components/Avatar.js.map +1 -0
  7. package/dist/components/Badge.js +93 -0
  8. package/dist/components/Badge.js.map +1 -0
  9. package/dist/components/Button.js +428 -0
  10. package/dist/components/Button.js.map +1 -0
  11. package/dist/components/ButtonsGroup.js +153 -0
  12. package/dist/components/ButtonsGroup.js.map +1 -0
  13. package/dist/components/Checkbox.js +93 -0
  14. package/dist/components/Checkbox.js.map +1 -0
  15. package/dist/components/Divider.js +79 -0
  16. package/dist/components/Divider.js.map +1 -0
  17. package/dist/components/Dropdown.js +166 -0
  18. package/dist/components/Dropdown.js.map +1 -0
  19. package/dist/components/DropdownItem.js +106 -0
  20. package/dist/components/DropdownItem.js.map +1 -0
  21. package/dist/components/DropdownRow.js +41 -0
  22. package/dist/components/DropdownRow.js.map +1 -0
  23. package/dist/components/DropdownSubmenu.js +142 -0
  24. package/dist/components/DropdownSubmenu.js.map +1 -0
  25. package/dist/components/FileInput.js +122 -0
  26. package/dist/components/FileInput.js.map +1 -0
  27. package/dist/components/FormField.js +112 -0
  28. package/dist/components/FormField.js.map +1 -0
  29. package/dist/components/Input.js +603 -0
  30. package/dist/components/Input.js.map +1 -0
  31. package/dist/components/Kbd.js +35 -0
  32. package/dist/components/Kbd.js.map +1 -0
  33. package/dist/components/ListMenu.js +143 -0
  34. package/dist/components/ListMenu.js.map +1 -0
  35. package/dist/components/ListMenuItem.js +189 -0
  36. package/dist/components/ListMenuItem.js.map +1 -0
  37. package/dist/components/Modal.js +206 -0
  38. package/dist/components/Modal.js.map +1 -0
  39. package/dist/components/Numpad.js +123 -0
  40. package/dist/components/Numpad.js.map +1 -0
  41. package/dist/components/Popup.js +170 -0
  42. package/dist/components/Popup.js.map +1 -0
  43. package/dist/components/ProgressBar.js +118 -0
  44. package/dist/components/ProgressBar.js.map +1 -0
  45. package/dist/components/Prompt.js +201 -0
  46. package/dist/components/Prompt.js.map +1 -0
  47. package/dist/components/Radio.js +81 -0
  48. package/dist/components/Radio.js.map +1 -0
  49. package/dist/components/Select.js +441 -0
  50. package/dist/components/Select.js.map +1 -0
  51. package/dist/components/Slider.js +116 -0
  52. package/dist/components/Slider.js.map +1 -0
  53. package/dist/components/Stepper.js +65 -0
  54. package/dist/components/Stepper.js.map +1 -0
  55. package/dist/components/Toggle.js +133 -0
  56. package/dist/components/Toggle.js.map +1 -0
  57. package/dist/components/Tooltip.js +120 -0
  58. package/dist/components/Tooltip.js.map +1 -0
  59. package/dist/components/index.js +81 -0
  60. package/dist/components/index.js.map +1 -0
  61. package/dist/composables/onClickOutside.js +51 -0
  62. package/dist/composables/onClickOutside.js.map +1 -0
  63. package/dist/composables/useBackButton.js +98 -0
  64. package/dist/composables/useBackButton.js.map +1 -0
  65. package/dist/composables/useEventListener.js +63 -0
  66. package/dist/composables/useEventListener.js.map +1 -0
  67. package/dist/icons/Icon.js +120 -0
  68. package/dist/icons/Icon.js.map +1 -0
  69. package/dist/icons/mdi.js +69 -0
  70. package/dist/icons/mdi.js.map +1 -0
  71. package/dist/icons/registry.js +63 -0
  72. package/dist/icons/registry.js.map +1 -0
  73. package/dist/icons/resolver.js +49 -0
  74. package/dist/icons/resolver.js.map +1 -0
  75. package/dist/index.d.ts +108 -0
  76. package/dist/index.js +157 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/manifest.js +89 -0
  79. package/dist/manifest.js.map +1 -0
  80. package/dist/numori-ui.css +184 -0
  81. package/dist/nuxt.d.ts +35 -0
  82. package/dist/nuxt.mjs +243 -0
  83. package/dist/nuxt.mjs.map +1 -0
  84. package/dist/vite.d.ts +29 -0
  85. package/dist/vite.mjs +187 -0
  86. package/dist/vite.mjs.map +1 -0
  87. package/package.json +138 -0
  88. package/src/components/Alert.vue +127 -0
  89. package/src/components/Avatar.vue +100 -0
  90. package/src/components/Badge.vue +77 -0
  91. package/src/components/Button.vue +419 -0
  92. package/src/components/ButtonsGroup.vue +140 -0
  93. package/src/components/Checkbox.vue +81 -0
  94. package/src/components/Divider.vue +64 -0
  95. package/src/components/Dropdown.vue +150 -0
  96. package/src/components/DropdownItem.vue +78 -0
  97. package/src/components/DropdownRow.vue +37 -0
  98. package/src/components/DropdownSubmenu.vue +127 -0
  99. package/src/components/FileInput.vue +107 -0
  100. package/src/components/FormField.vue +86 -0
  101. package/src/components/Input.vue +619 -0
  102. package/src/components/Kbd.vue +30 -0
  103. package/src/components/ListMenu.vue +127 -0
  104. package/src/components/ListMenuItem.vue +171 -0
  105. package/src/components/Modal.vue +209 -0
  106. package/src/components/Numpad.vue +118 -0
  107. package/src/components/Popup.vue +156 -0
  108. package/src/components/ProgressBar.vue +107 -0
  109. package/src/components/Prompt.vue +161 -0
  110. package/src/components/Radio.vue +50 -0
  111. package/src/components/Select.vue +470 -0
  112. package/src/components/Slider.vue +93 -0
  113. package/src/components/Stepper.vue +53 -0
  114. package/src/components/Toggle.vue +125 -0
  115. package/src/components/Tooltip.vue +113 -0
  116. package/src/components/index.js +109 -0
  117. package/src/composables/onClickOutside.js +61 -0
  118. package/src/composables/useBackButton.js +98 -0
  119. package/src/composables/useEventListener.js +65 -0
  120. package/src/icons/Icon.vue +139 -0
  121. package/src/icons/mdi.js +67 -0
  122. package/src/icons/registry.js +64 -0
  123. package/src/icons/resolver.js +48 -0
  124. package/src/index.js +167 -0
  125. package/src/manifest.js +86 -0
  126. package/src/nuxt.js +315 -0
  127. package/src/style.css +20 -0
  128. package/src/tailwind.css +18 -0
  129. package/src/theme.css +172 -0
  130. package/src/vite.js +235 -0
package/src/nuxt.js ADDED
@@ -0,0 +1,315 @@
1
+ import { existsSync, readFileSync } from 'node:fs'
2
+ import { createRequire } from 'node:module'
3
+ import { dirname, join } from 'node:path'
4
+ import { fileURLToPath, pathToFileURL } from 'node:url'
5
+ import {
6
+ addComponent,
7
+ addImports,
8
+ addPluginTemplate,
9
+ addTemplate,
10
+ defineNuxtModule,
11
+ useLogger,
12
+ } from '@nuxt/kit'
13
+ import { COMPONENT_NAMES, DEFAULT_PREFIX, componentEntries, prefixed } from './manifest.js'
14
+
15
+ /**
16
+ * Absolute path to the package's `src/` directory.
17
+ *
18
+ * Deliberately not derived with `createResolver(import.meta.url)`: that resolves
19
+ * relative to *this file*, which is `dist/nuxt.mjs` once built — so component
20
+ * paths would come out as `dist/components/Button.vue`, which does not exist.
21
+ * The module has to point at the shipped `src/` either way, because handing
22
+ * Nuxt the raw SFCs is what lets it compile and tree-shake them.
23
+ *
24
+ * `dist/` and `src/` are both direct children of the package root, so going up
25
+ * one level works whether this module is running from source (in-repo) or from
26
+ * the published build.
27
+ */
28
+ const SRC_DIR = join(dirname(dirname(fileURLToPath(import.meta.url))), 'src')
29
+
30
+ /**
31
+ * Resolve a path inside the package's `src/`.
32
+ * @param {string} relativePath e.g. 'components/Button.vue'
33
+ * @returns {string} Absolute path.
34
+ */
35
+ const fromSrc = (relativePath) => join(SRC_DIR, relativePath)
36
+
37
+ /**
38
+ * Import an optional peer dependency, resolved from the **Nuxt project** rather
39
+ * than from this package.
40
+ *
41
+ * A bare `import('@tailwindcss/vite')` resolves relative to this file, which is
42
+ * wrong for an optional peer: it lives in the app's `node_modules`, not ours.
43
+ * That lookup fails outright under pnpm's strict layout and whenever the package
44
+ * is linked (`file:`/`npm link`), because neither arrangement puts the app's
45
+ * dependencies on our resolution path.
46
+ *
47
+ * @param {string} specifier Module to load.
48
+ * @param {string} projectRoot Directory to resolve from (nuxt.options.rootDir).
49
+ * @returns {Promise<any | null>} The module, or null if it isn't installed.
50
+ */
51
+ async function importFromProject(specifier, projectRoot) {
52
+ try {
53
+ const require = createRequire(join(projectRoot, 'package.json'))
54
+ return await import(pathToFileURL(require.resolve(specifier)).href)
55
+ } catch {
56
+ // Fall back to our own resolution path, for layouts where the dependency is
57
+ // hoisted somewhere the project root cannot see.
58
+ try {
59
+ return await import(specifier)
60
+ } catch {
61
+ return null
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Numori UI — Nuxt module.
68
+ *
69
+ * Registers every component so templates can use `<UiButton>` with no import,
70
+ * exposes the library's composables to Nuxt's auto-import system, and can
71
+ * optionally stand up the whole Tailwind v4 pipeline.
72
+ *
73
+ * Components are registered from source (`.vue`), not from the bundled build,
74
+ * so Nuxt compiles them in the app's own Vite pass. That is what makes
75
+ * per-component tree-shaking work: Nuxt only emits the components a template
76
+ * actually references, so an app using three of them ships three.
77
+ *
78
+ * @example nuxt.config.ts
79
+ * export default defineNuxtConfig({
80
+ * modules: ['numori-ui/nuxt'],
81
+ * numoriUi: { prefix: 'Ui' },
82
+ * })
83
+ */
84
+ export default defineNuxtModule({
85
+ meta: {
86
+ name: 'numori-ui',
87
+ configKey: 'numoriUi',
88
+ compatibility: { nuxt: '>=3.0.0' },
89
+ },
90
+
91
+ defaults: {
92
+ /**
93
+ * Prefix for auto-registered component names.
94
+ * `'Ui'` gives `<UiButton>`, matching Numori Notes' existing templates.
95
+ */
96
+ prefix: DEFAULT_PREFIX,
97
+
98
+ /** Register only these base names. `null` registers all of them. */
99
+ include: null,
100
+
101
+ /** Skip these base names — use when the app has its own `<UiButton>`. */
102
+ exclude: [],
103
+
104
+ /** Auto-import the library's composables (`useBackButton`, ...). */
105
+ composables: true,
106
+
107
+ /**
108
+ * Set up Tailwind v4 for the whole app: registers `@tailwindcss/vite` and
109
+ * injects a stylesheet importing Tailwind plus the Numori tokens.
110
+ *
111
+ * Leave this off if the app already configures Tailwind; in that case add
112
+ * `@import "numori-ui/css";` to your own stylesheet instead.
113
+ */
114
+ tailwind: false,
115
+
116
+ /**
117
+ * Icon rendering. By default icons are inline SVGs from the subset bundled
118
+ * with the package.
119
+ *
120
+ * `component` takes the *name* of a globally registered component — e.g.
121
+ * `'Icon'` to render through `@nuxt/icon` — since nuxt.config cannot carry
122
+ * a component reference. `extra` adds raw path data to the bundled set.
123
+ */
124
+ icons: {
125
+ component: null,
126
+ extra: null,
127
+ },
128
+ },
129
+
130
+ async setup(options, nuxt) {
131
+ const logger = useLogger('numori-ui')
132
+
133
+ // See src/index.js: bare names make `Button` resolve its own `button` root
134
+ // element and recurse until the stack overflows, with an error message that
135
+ // gives no clue why. Fail the build instead.
136
+ if (typeof options.prefix !== 'string' || options.prefix.length === 0) {
137
+ throw new Error(
138
+ '[numori-ui] `numoriUi.prefix` must be a non-empty string. Registering components under ' +
139
+ 'their bare names would make <Button> resolve its own native `button` root element, ' +
140
+ 'recursing infinitely. Use a prefix such as "Ui" or "N".',
141
+ )
142
+ }
143
+
144
+ /* ── Components ─────────────────────────────────────────────────── *
145
+ * `mode: 'all'` keeps them usable in SSR and client-only trees alike.
146
+ * Registering by file path lets Nuxt handle transpiling and chunking. */
147
+ const skipped = []
148
+ for (const { name, file } of componentEntries()) {
149
+ const wanted =
150
+ (!options.include || options.include.includes(name)) && !options.exclude.includes(name)
151
+ if (!wanted) {
152
+ skipped.push(name)
153
+ continue
154
+ }
155
+ addComponent({
156
+ name: prefixed(name, options.prefix),
157
+ filePath: fromSrc(file),
158
+ mode: 'all',
159
+ })
160
+ }
161
+
162
+ if (skipped.length) logger.info(`Not registering: ${skipped.join(', ')}`)
163
+
164
+ /* ── Composables ────────────────────────────────────────────────── */
165
+ if (options.composables) {
166
+ addImports([
167
+ { name: 'useBackButton', from: fromSrc('composables/useBackButton.js') },
168
+ { name: 'onClickOutside', from: fromSrc('composables/onClickOutside.js') },
169
+ { name: 'useEventListener', from: fromSrc('composables/useEventListener.js') },
170
+ { name: 'registerIcons', from: fromSrc('icons/registry.js') },
171
+ { name: 'provideIconComponent', from: fromSrc('icons/resolver.js') },
172
+ ])
173
+ }
174
+
175
+ /* ── Icon delegation / extra icons ──────────────────────────────── *
176
+ * Needs a live Vue app: `provide` for the renderer and the runtime
177
+ * registry for extra paths, so it happens in a plugin.
178
+ *
179
+ * The renderer is provided as a bare string. `<component :is="'Icon'">`
180
+ * resolves a globally registered component by name, which means no proxy
181
+ * component is needed and registration order doesn't matter — the lookup
182
+ * happens at render time, long after every module has run. */
183
+ if (options.icons?.component || options.icons?.extra) {
184
+ const { component, extra } = options.icons
185
+ addPluginTemplate({
186
+ filename: 'numori-ui-icons.mjs',
187
+ getContents: () =>
188
+ [
189
+ `import { defineNuxtPlugin } from '#app'`,
190
+ `import { ICON_COMPONENT_KEY } from ${JSON.stringify(fromSrc('icons/resolver.js'))}`,
191
+ extra
192
+ ? `import { registerIcons } from ${JSON.stringify(fromSrc('icons/registry.js'))}`
193
+ : null,
194
+ ``,
195
+ `export default defineNuxtPlugin({`,
196
+ ` name: 'numori-ui:icons',`,
197
+ ` enforce: 'pre',`,
198
+ ` setup(nuxtApp) {`,
199
+ extra ? ` registerIcons(${JSON.stringify(extra)})` : null,
200
+ component
201
+ ? ` nuxtApp.vueApp.provide(ICON_COMPONENT_KEY, ${JSON.stringify(component)})`
202
+ : null,
203
+ ` },`,
204
+ `})`,
205
+ ``,
206
+ ]
207
+ .filter((line) => line !== null)
208
+ .join('\n'),
209
+ })
210
+ }
211
+
212
+ /* ── Tailwind v4 ────────────────────────────────────────────────── */
213
+ if (options.tailwind) {
214
+ await setupTailwind(nuxt, logger)
215
+ } else {
216
+ // The tokens live in CSS, so unlike a v3 preset there is nothing to
217
+ // inject on the app's behalf — `@theme` only has meaning inside a
218
+ // stylesheet that imports Tailwind. Nudge rather than fail silently.
219
+ nuxt.hook('build:before', () => {
220
+ if (!appImportsNumoriCss(nuxt)) {
221
+ logger.warn(
222
+ 'No stylesheet appears to import "numori-ui/css" — components may render unstyled.\n' +
223
+ ' Add to your Tailwind entry stylesheet:\n' +
224
+ ' @import "tailwindcss";\n' +
225
+ ' @import "numori-ui/css";\n' +
226
+ ' Or set `numoriUi: { tailwind: true }` to have this module configure Tailwind.',
227
+ )
228
+ }
229
+ })
230
+ }
231
+ },
232
+ })
233
+
234
+ /**
235
+ * Best-effort check that the app pulls the design tokens in somewhere.
236
+ * A missed detection only produces a warning, so it can never break a build.
237
+ *
238
+ * @param {object} nuxt
239
+ * @returns {boolean}
240
+ */
241
+ function appImportsNumoriCss(nuxt) {
242
+ for (const entry of nuxt.options.css || []) {
243
+ if (typeof entry !== 'string') continue
244
+ if (entry.includes('numori-ui')) return true
245
+ try {
246
+ const path = entry.startsWith('~')
247
+ ? entry.replace(/^~~?\/?/, `${nuxt.options.srcDir}/`)
248
+ : entry
249
+ if (existsSync(path) && readFileSync(path, 'utf8').includes('numori-ui')) return true
250
+ } catch {
251
+ // Unreadable or virtual entry — fall through to the warning.
252
+ }
253
+ }
254
+ return false
255
+ }
256
+
257
+ /**
258
+ * Register `@tailwindcss/vite` and generate a base stylesheet wiring Tailwind
259
+ * to the Numori tokens. Opt-in, because taking over an app's CSS pipeline
260
+ * should be a deliberate choice.
261
+ *
262
+ * The stylesheet is generated into Nuxt's buildDir with **absolute** `@source`
263
+ * paths. That matters: Tailwind v4 bases automatic source detection on the
264
+ * stylesheet's own location and skips `node_modules`, so a stylesheet shipped
265
+ * inside the package would scan the wrong tree and find none of the app's
266
+ * templates. Naming both roots explicitly removes the guesswork.
267
+ *
268
+ * `@tailwindcss/vite` is an optional peer — only this path needs it.
269
+ *
270
+ * @param {object} nuxt
271
+ * @param {ReturnType<typeof useLogger>} logger
272
+ */
273
+ async function setupTailwind(nuxt, logger) {
274
+ const tailwindMod = await importFromProject('@tailwindcss/vite', nuxt.options.rootDir)
275
+ if (!tailwindMod) {
276
+ logger.error(
277
+ '`numoriUi.tailwind` is enabled but @tailwindcss/vite could not be resolved.\n' +
278
+ ' Install it: npm i -D @tailwindcss/vite\n' +
279
+ ' Or set `numoriUi: { tailwind: false }` and configure Tailwind yourself.',
280
+ )
281
+ return
282
+ }
283
+ const tailwindVite = tailwindMod.default
284
+
285
+ nuxt.options.vite.plugins = nuxt.options.vite.plugins || []
286
+ nuxt.options.vite.plugins.push(tailwindVite())
287
+
288
+ const template = addTemplate({
289
+ filename: 'numori-ui-tailwind.css',
290
+ write: true,
291
+ getContents: () =>
292
+ [
293
+ '/* Generated by numori-ui/nuxt (numoriUi.tailwind = true). */',
294
+ '@import "tailwindcss";',
295
+ `@import ${JSON.stringify(fromSrc('theme.css'))};`,
296
+ '',
297
+ '/* The library, then the app. Absolute so neither depends on where',
298
+ ' * this generated file happens to sit. */',
299
+ `@source ${JSON.stringify(fromSrc('components'))};`,
300
+ `@source ${JSON.stringify(fromSrc('icons'))};`,
301
+ `@source ${JSON.stringify(nuxt.options.srcDir)};`,
302
+ ...(nuxt.options.rootDir !== nuxt.options.srcDir
303
+ ? [`@source ${JSON.stringify(nuxt.options.rootDir)};`]
304
+ : []),
305
+ '',
306
+ ].join('\n'),
307
+ })
308
+
309
+ nuxt.options.css = nuxt.options.css || []
310
+ if (!nuxt.options.css.includes(template.dst)) nuxt.options.css.unshift(template.dst)
311
+
312
+ logger.success('Tailwind v4 configured with the Numori UI theme.')
313
+ }
314
+
315
+ export { COMPONENT_NAMES, DEFAULT_PREFIX }
package/src/style.css ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Numori UI — full stylesheet (source form)
3
+ *
4
+ * Pulls in the design tokens and tells Tailwind where the library's own
5
+ * templates live, so the utilities the components use are generated in the
6
+ * consuming app's build.
7
+ *
8
+ * This is the in-repo version, used by the playgrounds. The published
9
+ * artefact is `dist/numori-ui.css` (exported as `numori-ui/css`), which the
10
+ * build generates from `theme.css` with the @source globs rewritten to be
11
+ * correct relative to `dist/`. Keep token changes in `theme.css` only.
12
+ */
13
+
14
+ @import './theme.css';
15
+
16
+ /* Tailwind resolves @source relative to this file. Only .vue files can
17
+ * contain utility classes, so the globs stay narrow — scanning the icon
18
+ * path data in icons/mdi.js would be pure noise. */
19
+ @source "./components/**/*.vue";
20
+ @source "./icons/**/*.vue";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Numori UI — Tailwind entry, for use inside this repo only.
3
+ *
4
+ * The playgrounds import this to get a complete Tailwind build with the Numori
5
+ * theme applied. Published consumers should NOT import this file: they own their
6
+ * own Tailwind entry and add just the tokens with
7
+ *
8
+ * @import "tailwindcss";
9
+ * @import "numori-ui/css";
10
+ *
11
+ * The Nuxt module's opt-in `tailwind: true` path does not use this file either —
12
+ * it generates an equivalent stylesheet with absolute @source paths, because
13
+ * Tailwind resolves relative @source against the stylesheet's own location and
14
+ * would otherwise never find the app's templates.
15
+ */
16
+
17
+ @import 'tailwindcss';
18
+ @import './style.css';
package/src/theme.css ADDED
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Numori UI — theme tokens (Tailwind CSS v4, CSS-first configuration)
3
+ *
4
+ * This is the design system's single source of truth. It replaces the
5
+ * `theme.extend` block of a Tailwind v3 `tailwind.config.js`: every custom
6
+ * value here is registered by Tailwind v4 as a real theme token, so it both
7
+ * generates utilities (`bg-primary-600`, `shadow-modal`) and is available as a
8
+ * plain CSS variable (`var(--color-primary-600)`).
9
+ *
10
+ * Import it AFTER `@import "tailwindcss"` in your app stylesheet — or just
11
+ * import `numori-ui/css`, which pulls this in and also registers the package's
12
+ * own template sources for class detection.
13
+ */
14
+
15
+ /* ------------------------------------------------------------------ *
16
+ * Dark mode
17
+ * ------------------------------------------------------------------ *
18
+ * Tailwind v4 dropped the `darkMode: 'class'` config key; the class-based
19
+ * strategy is now declared as a custom variant. Numori UI is built around a
20
+ * toggleable `.dark` class on <html> (what @nuxtjs/color-mode writes when
21
+ * `classSuffix: ''`), NOT the `prefers-color-scheme` default, so every
22
+ * `dark:` utility in the components resolves against that class.
23
+ */
24
+ @custom-variant dark (&:where(.dark, .dark *));
25
+
26
+ @theme {
27
+ /* ---------------------------------------------------------------- *
28
+ * Neutrals
29
+ * ---------------------------------------------------------------- *
30
+ * A warm neutral scale derived from the Numori dark palette. Dark mode
31
+ * uses the lower end of the scale, light mode the upper end. The 850 and
32
+ * 925 steps are non-standard additions: 925 is the primary dark surface
33
+ * and 850 sits between the background and its first dimmed step.
34
+ *
35
+ * Tailwind v4 ships its own `gray`; these declarations replace those
36
+ * tokens outright so `bg-gray-800` means the Numori neutral, not Tailwind's.
37
+ */
38
+ --color-gray-50: #fcfcfa; /* foreground */
39
+ --color-gray-100: #f5f4f2;
40
+ --color-gray-200: #e8e6e3;
41
+ --color-gray-300: #c1c0c0; /* dimmed 1 */
42
+ --color-gray-400: #939293; /* dimmed 2 */
43
+ --color-gray-500: #727072; /* dimmed 3 */
44
+ --color-gray-600: #5b595c; /* dimmed 4 */
45
+ --color-gray-700: #403e41; /* dimmed 5 */
46
+ --color-gray-800: #2d2a2e; /* background (elevated surface in dark) */
47
+ --color-gray-850: #272428; /* between bg and bg-dimmed-1 */
48
+ --color-gray-900: #221f22; /* bg dimmed 1 */
49
+ --color-gray-925: #2d2a2e; /* main dark bg — the primary surface */
50
+ --color-gray-950: #19181a; /* bg dimmed 2 (deepest) */
51
+
52
+ /* ---------------------------------------------------------------- *
53
+ * Primary accent
54
+ * ---------------------------------------------------------------- *
55
+ * The pink/rose keyword colour from the Numori syntax palette (400),
56
+ * extended into a full interactive scale.
57
+ */
58
+ --color-primary-50: #fff0f3;
59
+ --color-primary-100: #ffd9e1;
60
+ --color-primary-200: #ffb3c4;
61
+ --color-primary-300: #ff8da8;
62
+ --color-primary-400: #ff6188; /* keyword colour — the hero accent */
63
+ --color-primary-500: #e8456e;
64
+ --color-primary-600: #cc2d56;
65
+ --color-primary-700: #a61e42;
66
+ --color-primary-800: #801530;
67
+ --color-primary-900: #5c0e22;
68
+ --color-primary-950: #3a0715;
69
+
70
+ /* Success — built out from the palette's function colour (300). */
71
+ --color-success-50: #f0fdf4;
72
+ --color-success-100: #dcfce7;
73
+ --color-success-200: #bbf7d0;
74
+ --color-success-300: #a9dc76; /* function colour */
75
+ --color-success-400: #86c95a;
76
+ --color-success-500: #6bb33e;
77
+ --color-success-600: #539a2a;
78
+ --color-success-700: #3d7a1c;
79
+ --color-success-800: #2d5e14;
80
+ --color-success-900: #1f420e;
81
+ --color-success-950: #122808;
82
+
83
+ /* Warning — built out from the palette's string colour (300). */
84
+ --color-warning-50: #fffbeb;
85
+ --color-warning-100: #fff3c4;
86
+ --color-warning-200: #ffe68a;
87
+ --color-warning-300: #ffd866; /* string colour */
88
+ --color-warning-400: #fcc73e;
89
+ --color-warning-500: #f0b429;
90
+ --color-warning-600: #d99a06;
91
+ --color-warning-700: #b47d04;
92
+ --color-warning-800: #8c6103;
93
+ --color-warning-900: #664702;
94
+ --color-warning-950: #402d01;
95
+
96
+ /* Error — kept on Tailwind's red ramp for familiarity. */
97
+ --color-error-50: #fef2f2;
98
+ --color-error-100: #fee2e2;
99
+ --color-error-200: #fecaca;
100
+ --color-error-300: #fca5a5;
101
+ --color-error-400: #f87171;
102
+ --color-error-500: #ef4444;
103
+ --color-error-600: #dc2626;
104
+ --color-error-700: #b91c1c;
105
+ --color-error-800: #991b1b;
106
+ --color-error-900: #7f1d1d;
107
+ --color-error-950: #450a0a;
108
+
109
+ /* ---------------------------------------------------------------- *
110
+ * Typography
111
+ * ---------------------------------------------------------------- */
112
+ --font-sans: Inter, system-ui, sans-serif;
113
+
114
+ /* ---------------------------------------------------------------- *
115
+ * Spacing additions
116
+ * ---------------------------------------------------------------- *
117
+ * v4 derives spacing from --spacing, so only the non-multiples of the
118
+ * base step need declaring explicitly.
119
+ */
120
+ --spacing-18: 4.5rem;
121
+ --spacing-88: 22rem;
122
+
123
+ /* ---------------------------------------------------------------- *
124
+ * Radii — larger than Tailwind's defaults for these two steps.
125
+ * ---------------------------------------------------------------- */
126
+ --radius-xl: 1rem;
127
+ --radius-2xl: 1.5rem;
128
+
129
+ /* ---------------------------------------------------------------- *
130
+ * Elevation
131
+ * ---------------------------------------------------------------- */
132
+ --shadow-card: 0 1px 3px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
133
+ --shadow-card-hover: 0 4px 12px rgb(0 0 0 / 0.08);
134
+ --shadow-modal: 0 20px 60px rgb(0 0 0 / 0.25), 0 0 0 1px rgb(0 0 0 / 0.05);
135
+ }
136
+
137
+ /* ------------------------------------------------------------------ *
138
+ * Component CSS
139
+ * ------------------------------------------------------------------ *
140
+ * Everything else in Numori UI is expressed as utility classes, but these
141
+ * rules cannot be: `env(safe-area-inset-*)` has no utility equivalent, and the
142
+ * modal override needs `!important` to beat the panel's own max-height on
143
+ * small viewports.
144
+ *
145
+ * They live here rather than in a `<style scoped>` block inside Modal.vue on
146
+ * purpose. Numori UI is consumed both as source (Nuxt module, Vite plugin —
147
+ * the host compiles the SFCs) and as a prebuilt bundle. A scoped block would
148
+ * be compiled into the components on one path and emitted as a *second*
149
+ * stylesheet on the other, so consumers would have one CSS import to make in
150
+ * some setups and two in others. Keeping these rules in the single shipped
151
+ * stylesheet means `@import "numori-ui/css"` is always the whole story.
152
+ *
153
+ * Scoping is unnecessary anyway: both class names are applied by Modal.vue and
154
+ * namespaced to it.
155
+ */
156
+ @media (max-width: 767px) {
157
+ /* Fullscreen-on-mobile panels fill the viewport regardless of any
158
+ * max-height a caller set for larger screens. */
159
+ .modal-panel {
160
+ max-height: 100% !important;
161
+ }
162
+
163
+ /* Keeps content clear of notches, home indicators and rounded corners when
164
+ * the panel is edge-to-edge. Applied by Modal.vue only in its
165
+ * fullscreen-mobile layout. */
166
+ .modal-panel--safe-area {
167
+ padding-top: env(safe-area-inset-top);
168
+ padding-bottom: env(safe-area-inset-bottom);
169
+ padding-left: env(safe-area-inset-left);
170
+ padding-right: env(safe-area-inset-right);
171
+ }
172
+ }