nuxt-ui-ink 0.1.0 → 0.2.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 CHANGED
@@ -3,7 +3,8 @@
3
3
  A theme for [Nuxt UI](https://ui.nuxt.com) 4, as a Nuxt layer. Monochrome, with one blue accent, in light and dark.
4
4
 
5
5
  Surfaces have no border: a card, a field or a menu is drawn by a half-pixel line and a small shadow. The primary
6
- button is a dark chip. A focused field darkens its edge instead of growing a ring.
6
+ button is a dark chip. A focused field darkens its edge instead of growing a ring. Controls are a little smaller
7
+ than Nuxt UI's.
7
8
 
8
9
  ## Install
9
10
 
@@ -40,6 +41,7 @@ Inter font. The stylesheet has to be imported from yours so Tailwind compiles bo
40
41
  | `bg-raised` | A surface on a tinted track, such as the knob of a segmented control. |
41
42
  | `ring-stroke`, `border-stroke`, `divide-stroke` | Lines between things. |
42
43
  | `ring-edge`, `border-edge` | A firmer line, as on a checkbox. |
44
+ | `outline-focus` | The keyboard-focus ring. |
43
45
  | `shadow-card`, `shadow-card-hover` | A surface at rest and hovered. |
44
46
  | `shadow-focus` | A focused field. |
45
47
  | `shadow-lift` | A hovered card that links somewhere. |
@@ -83,7 +85,11 @@ export default defineAppConfig({
83
85
  and on white cards alike. Two of them stacked get darker, and they do not hide what is behind them. Use
84
86
  `bg-(--ink-solid)` where that matters.
85
87
  - The half-pixel lines are sharp on high-density screens and can look softer on a 1x display.
86
- - Component sizes are Nuxt UI's own. Only color, shape and shadow change.
88
+ - Sizes keep Nuxt UI's names but are smaller. Buttons are 20, 24, 28, 32 and 36px high (`xs` to `xl`), four less
89
+ than Nuxt UI's, with 13px text at `md`. Fields keep their height (32px at `md`) and use 13px text on desktop; on
90
+ phones they stay at 16px so the browser does not zoom. A button joined to a field in a `UFieldGroup` takes the
91
+ field's height.
92
+ - Keyboard focus shows as a blue ring (`--ink-focus`).
87
93
 
88
94
  ## Development
89
95
 
package/app/app.config.ts CHANGED
@@ -17,6 +17,7 @@ const rowByState = 'data-highlighted:before:bg-elevated data-[state=open]:before
17
17
 
18
18
  /** A field at rest and hovered */
19
19
  const field = 'bg-default ring-0 shadow-card hover:shadow-card-hover disabled:shadow-card'
20
+ const fieldBase = 'rounded-[7px] transition-[box-shadow,background-color]'
20
21
  const fieldSoft = 'bg-elevated hover:bg-accented focus:bg-accented has-focus:bg-accented'
21
22
  const fieldSubtle = 'ring-stroke'
22
23
 
@@ -24,6 +25,39 @@ const fieldSubtle = 'ring-stroke'
24
25
  const focus = { color: 'primary' as const, variant: 'outline' as const, class: 'outline-0 focus-visible:outline-0 focus-visible:shadow-focus' }
25
26
  const focusWithin = { color: 'primary' as const, variant: 'outline' as const, class: 'outline-0 has-focus-visible:outline-0 has-focus-visible:shadow-focus' }
26
27
 
28
+ /** Controls are set in 13px, one step under Nuxt UI's 14px (phones keep 16px in fields, so they do not zoom) */
29
+ const small = 'text-[13px]/5'
30
+
31
+ /** A field's text and icons at the two middle sizes, and the room its icons take */
32
+ const fieldSizes = {
33
+ md: { leadingIcon: 'size-4', trailingIcon: 'size-4' },
34
+ lg: { leadingIcon: 'size-4', trailingIcon: 'size-4' }
35
+ }
36
+ const fieldText = [
37
+ { fixed: false, size: 'md' as const, class: 'md:text-[13px]/5' },
38
+ { fixed: false, size: 'lg' as const, class: 'md:text-[13px]/5' }
39
+ ]
40
+ const fieldIcons = [
41
+ { leading: true, size: 'md' as const, class: 'ps-8' },
42
+ { trailing: true, size: 'md' as const, class: 'pe-8' },
43
+ { leading: true, size: 'lg' as const, class: 'ps-9' },
44
+ { trailing: true, size: 'lg' as const, class: 'pe-9' }
45
+ ]
46
+
47
+ /** A field that opens a menu: its rows follow */
48
+ const pickerSizes = {
49
+ md: { ...fieldSizes.md, item: small, itemLeadingIcon: 'size-4 my-0.5', itemTrailingIcon: 'size-4 my-0.5' },
50
+ lg: fieldSizes.lg
51
+ }
52
+
53
+ /** A menu row at the default size */
54
+ // A 16px icon beside a 20px line sits in its middle
55
+ const rowSizes = { md: { label: 'text-xs', item: small, itemLeadingIcon: 'size-4 my-0.5', itemTrailingIcon: 'size-4 my-0.5' } }
56
+
57
+ /** The ring around what the keyboard is on */
58
+ const ring = 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus'
59
+ const everyColor = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'neutral'] as const
60
+
27
61
  /** A tag inside a field */
28
62
  const tag = 'rounded-sm ring-0 bg-accented'
29
63
 
@@ -118,10 +152,20 @@ export default defineAppConfig({
118
152
 
119
153
  /* ── Elements ─────────────────────────────────────────────────────────────────────────────────────────── */
120
154
 
155
+ // Four pixels shorter than Nuxt UI's at every size: 20, 24, 28, 32 and 36 high
121
156
  button: {
122
157
  slots: {
123
158
  base: 'font-medium transition-[background-color,color,box-shadow,scale] active:scale-[0.98]'
124
159
  },
160
+ variants: {
161
+ size: {
162
+ xs: { base: 'px-1.5 py-0.5 text-xs gap-1', leadingIcon: 'size-3.5', trailingIcon: 'size-3.5' },
163
+ sm: { base: 'px-2 py-1 text-xs gap-1', leadingIcon: 'size-3.5', trailingIcon: 'size-3.5' },
164
+ md: { base: `px-2.5 py-1 ${small} gap-1.5`, leadingIcon: 'size-4', trailingIcon: 'size-4' },
165
+ lg: { base: `px-3 py-1.5 ${small} gap-1.5`, leadingIcon: 'size-4', trailingIcon: 'size-4' },
166
+ xl: { base: 'px-3.5 py-2 text-sm gap-2', leadingIcon: 'size-5', trailingIcon: 'size-5' }
167
+ }
168
+ },
125
169
  compoundVariants: [
126
170
  // A dark chip
127
171
  { color: 'primary', variant: 'solid', class: 'hover:bg-primary/90 active:bg-primary/90' },
@@ -130,7 +174,18 @@ export default defineAppConfig({
130
174
  { color: 'neutral', variant: 'soft', class: 'bg-elevated text-highlighted hover:bg-accented active:bg-accented' },
131
175
  { color: 'neutral', variant: 'subtle', class: 'bg-elevated text-highlighted ring-stroke hover:bg-accented' },
132
176
  // A muted label until hovered
133
- { color: 'neutral', variant: 'ghost', class: 'text-toned hover:text-highlighted hover:bg-elevated active:bg-elevated' }
177
+ { color: 'neutral', variant: 'ghost', class: 'text-toned hover:text-highlighted hover:bg-elevated active:bg-elevated' },
178
+ { color: [...everyColor], class: ring },
179
+ // An icon alone makes a square of the same height
180
+ { size: 'xs', square: true, class: 'p-[3px]' },
181
+ { size: 'sm', square: true, class: 'p-[5px]' },
182
+ // Joined to a field, a button takes the field's height
183
+ { fieldGroup: ['horizontal', 'vertical'], size: 'xs', class: 'py-1' },
184
+ { fieldGroup: ['horizontal', 'vertical'], size: 'sm', class: 'py-1.5' },
185
+ { fieldGroup: ['horizontal', 'vertical'], size: 'md', class: 'py-1.5' },
186
+ { fieldGroup: ['horizontal', 'vertical'], size: 'lg', class: 'py-2' },
187
+ { fieldGroup: ['horizontal', 'vertical'], size: 'xl', class: 'py-2.5' },
188
+ { fieldGroup: ['horizontal', 'vertical'], size: 'md', square: true, class: 'p-2' }
134
189
  ]
135
190
  },
136
191
 
@@ -138,6 +193,13 @@ export default defineAppConfig({
138
193
  slots: {
139
194
  base: 'rounded-sm font-medium'
140
195
  },
196
+ variants: {
197
+ size: {
198
+ sm: { base: 'px-1 py-0.5 text-[10px]/3.5' },
199
+ md: { base: 'px-1.5 py-0.5 text-xs' },
200
+ lg: { base: 'px-2 py-0.5 text-[13px]/5' }
201
+ }
202
+ },
141
203
  compoundVariants: [
142
204
  { color: 'neutral', variant: 'outline', class: 'bg-default text-toned ring-0 shadow-card' },
143
205
  { color: 'neutral', variant: 'soft', class: 'bg-accented text-toned' },
@@ -222,119 +284,127 @@ export default defineAppConfig({
222
284
 
223
285
  input: {
224
286
  slots: {
225
- base: 'transition-[box-shadow,background-color]'
287
+ base: fieldBase
226
288
  },
227
289
  variants: {
290
+ size: fieldSizes,
228
291
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
229
292
  },
230
- compoundVariants: [focus]
293
+ compoundVariants: [focus, ...fieldText, ...fieldIcons]
231
294
  },
232
295
 
233
296
  textarea: {
234
297
  slots: {
235
- base: 'transition-[box-shadow,background-color]'
298
+ base: fieldBase
236
299
  },
237
300
  variants: {
301
+ size: fieldSizes,
238
302
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
239
303
  },
240
- compoundVariants: [focus]
304
+ compoundVariants: [focus, ...fieldText, ...fieldIcons]
241
305
  },
242
306
 
243
307
  inputNumber: {
244
308
  slots: {
245
- base: 'transition-[box-shadow,background-color]'
309
+ base: fieldBase
246
310
  },
247
311
  variants: {
248
312
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
249
313
  },
250
- compoundVariants: [focus]
314
+ compoundVariants: [focus, ...fieldText]
251
315
  },
252
316
 
253
317
  pinInput: {
254
318
  slots: {
255
- base: 'transition-[box-shadow,background-color]'
319
+ base: fieldBase
256
320
  },
257
321
  variants: {
258
322
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
259
323
  },
260
- compoundVariants: [focus]
324
+ compoundVariants: [focus, ...fieldText]
261
325
  },
262
326
 
263
327
  inputTags: {
264
328
  slots: {
265
- base: 'transition-[box-shadow,background-color]',
329
+ base: fieldBase,
266
330
  item: tag
267
331
  },
268
332
  variants: {
333
+ size: fieldSizes,
269
334
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
270
335
  },
271
- compoundVariants: [focusWithin]
336
+ compoundVariants: [focusWithin, ...fieldText, ...fieldIcons]
272
337
  },
273
338
 
274
339
  inputDate: {
275
340
  slots: {
276
- base: 'transition-[box-shadow,background-color]'
341
+ base: fieldBase
277
342
  },
278
343
  variants: {
344
+ size: fieldSizes,
279
345
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
280
346
  },
281
- compoundVariants: [focusWithin]
347
+ compoundVariants: [focusWithin, ...fieldText, ...fieldIcons]
282
348
  },
283
349
 
284
350
  inputTime: {
285
351
  slots: {
286
- base: 'transition-[box-shadow,background-color]'
352
+ base: fieldBase
287
353
  },
288
354
  variants: {
355
+ size: fieldSizes,
289
356
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
290
357
  },
291
- compoundVariants: [focusWithin]
358
+ compoundVariants: [focusWithin, ...fieldText, ...fieldIcons]
292
359
  },
293
360
 
294
361
  inputMenu: {
295
362
  slots: {
296
- base: 'transition-[box-shadow,background-color]',
363
+ base: fieldBase,
297
364
  content: pop,
298
365
  item: row,
299
366
  separator: line,
300
367
  tagsItem: tag
301
368
  },
302
369
  variants: {
370
+ size: pickerSizes,
303
371
  variant: { outline: field, soft: fieldSoft, subtle: fieldSubtle }
304
372
  },
305
- compoundVariants: [focusWithin]
373
+ compoundVariants: [focusWithin, ...fieldText, ...fieldIcons]
306
374
  },
307
375
 
308
376
  select: {
309
377
  slots: {
310
- base: 'transition-[box-shadow,background-color]',
378
+ base: fieldBase,
311
379
  content: pop,
312
380
  item: row,
313
381
  separator: line
314
382
  },
315
383
  variants: {
384
+ size: pickerSizes,
316
385
  variant: { outline: `${field} hover:bg-default`, soft: fieldSoft, subtle: fieldSubtle }
317
386
  },
318
- compoundVariants: [focus]
387
+ compoundVariants: [focus, ...fieldText, ...fieldIcons]
319
388
  },
320
389
 
321
390
  selectMenu: {
322
391
  slots: {
323
- base: 'transition-[box-shadow,background-color]',
392
+ base: fieldBase,
324
393
  content: pop,
325
394
  item: row,
326
395
  separator: line,
327
396
  input: 'border-stroke'
328
397
  },
329
398
  variants: {
399
+ size: pickerSizes,
330
400
  variant: { outline: `${field} hover:bg-default`, soft: fieldSoft, subtle: fieldSubtle }
331
401
  },
332
- compoundVariants: [focus]
402
+ compoundVariants: [focus, ...fieldText, ...fieldIcons]
333
403
  },
334
404
 
335
405
  checkbox: {
336
406
  slots: {
337
- base: 'rounded-[4.5px] bg-default ring-edge'
407
+ base: `rounded-[4.5px] bg-default ring-edge ${ring}`
338
408
  },
339
409
  variants: {
340
410
  variant: {
@@ -359,7 +429,7 @@ export default defineAppConfig({
359
429
 
360
430
  radioGroup: {
361
431
  slots: {
362
- base: 'bg-default ring-edge'
432
+ base: `bg-default ring-edge ${ring}`
363
433
  },
364
434
  variants: {
365
435
  variant: {
@@ -372,10 +442,19 @@ export default defineAppConfig({
372
442
  ]
373
443
  },
374
444
 
445
+ // 32 by 20 at the default size
375
446
  switch: {
376
447
  slots: {
377
- base: 'data-[state=unchecked]:bg-(--ink-track)',
448
+ base: `data-[state=unchecked]:bg-(--ink-track) ${ring}`,
378
449
  thumb: 'shadow-knob'
450
+ },
451
+ variants: {
452
+ size: {
453
+ md: {
454
+ base: 'w-8',
455
+ thumb: 'group-active/switch:w-4.5 data-[state=checked]:translate-x-3 data-[state=checked]:group-active/switch:translate-x-2.5 data-[state=checked]:rtl:-translate-x-3 data-[state=checked]:rtl:group-active/switch:-translate-x-2.5'
456
+ }
457
+ }
379
458
  }
380
459
  },
381
460
 
@@ -455,18 +534,32 @@ export default defineAppConfig({
455
534
 
456
535
  /* ── Navigation ───────────────────────────────────────────────────────────────────────────────────────── */
457
536
 
458
- // Pill tabs as a segmented control: a raised knob on a tinted track
537
+ // Pill tabs as a segmented control: a raised knob on a tinted track, 28px high at the default size
459
538
  tabs: {
539
+ slots: {
540
+ trigger: ring
541
+ },
542
+ variants: {
543
+ size: {
544
+ xs: { trigger: 'px-1.5 py-px text-xs gap-1', leadingIcon: 'size-3.5' },
545
+ sm: { trigger: 'px-2 py-0.5 text-xs gap-1', leadingIcon: 'size-3.5' },
546
+ md: { trigger: `px-2.5 py-0.5 ${small} gap-1.5`, leadingIcon: 'size-4' },
547
+ lg: { trigger: `px-3 py-1 ${small} gap-1.5`, leadingIcon: 'size-4' },
548
+ xl: { trigger: 'px-3 py-1.5 text-sm gap-2', leadingIcon: 'size-5' }
549
+ }
550
+ },
460
551
  compoundVariants: [
461
552
  {
462
553
  color: ['primary', 'neutral'],
463
554
  variant: 'pill',
464
555
  class: {
465
- list: 'bg-elevated',
556
+ list: 'bg-elevated p-0.5',
466
557
  indicator: 'bg-raised shadow-card',
467
558
  trigger: 'data-[state=active]:text-highlighted data-[state=inactive]:text-toned'
468
559
  }
469
- }
560
+ },
561
+ { orientation: 'horizontal', variant: 'pill', class: { indicator: 'inset-y-0.5' } },
562
+ { orientation: 'vertical', variant: 'pill', class: { indicator: 'inset-x-0.5' } }
470
563
  ]
471
564
  },
472
565
 
@@ -512,11 +605,13 @@ export default defineAppConfig({
512
605
  dropdownMenu: {
513
606
  slots: {
514
607
  content: pop,
608
+ label: 'font-medium text-muted',
515
609
  item: 'before:rounded-lg',
516
610
  input: 'border-stroke',
517
611
  separator: line
518
612
  },
519
613
  variants: {
614
+ size: rowSizes,
520
615
  active: {
521
616
  false: { item: rowByState }
522
617
  }
@@ -526,10 +621,12 @@ export default defineAppConfig({
526
621
  contextMenu: {
527
622
  slots: {
528
623
  content: pop,
624
+ label: 'font-medium text-muted',
529
625
  item: 'before:rounded-lg',
530
626
  separator: line
531
627
  },
532
628
  variants: {
629
+ size: rowSizes,
533
630
  active: {
534
631
  false: { item: rowByState }
535
632
  }
@@ -552,7 +649,7 @@ export default defineAppConfig({
552
649
  modal: {
553
650
  slots: {
554
651
  content: 'divide-stroke',
555
- title: 'font-medium'
652
+ title: 'text-[15px] font-medium'
556
653
  },
557
654
  variants: {
558
655
  fullscreen: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-ink",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A monochrome theme for Nuxt UI, as a Nuxt layer.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/theme.css CHANGED
@@ -35,6 +35,7 @@
35
35
  --color-raised: var(--ink-raised);
36
36
  --color-stroke: var(--ink-stroke);
37
37
  --color-edge: var(--ink-edge);
38
+ --color-focus: var(--ink-focus);
38
39
 
39
40
  /* `rounded-card` and `rounded-dialog` sit between Nuxt UI's steps */
40
41
  --radius-card: calc(var(--ui-radius) * 2.5);
@@ -55,7 +56,7 @@
55
56
 
56
57
  /* Light */
57
58
  :root {
58
- /* Buttons and fields 6px (md), menu rows 8px (lg), cards 10px, menus 12px (xl), dialogs 14px */
59
+ /* Buttons 6px (md), fields 7px, menu rows 8px (lg), cards 10px, menus 12px (xl), dialogs 14px */
59
60
  --ui-radius: 0.25rem;
60
61
 
61
62
  --ui-primary: #1f1f1f;
@@ -101,6 +102,8 @@
101
102
  --ink-track: rgb(0 0 0 / 0.12);
102
103
  /* What dims the page behind a dialog */
103
104
  --ink-scrim: rgb(0 0 0 / 0.16);
105
+ /* The ring around what the keyboard is on */
106
+ --ink-focus: rgb(0 96 226 / 0.7);
104
107
 
105
108
  /* A surface is drawn by its shadow: a half-pixel edge and a small drop, no border */
106
109
  --ink-shadow-card: 0 0 0 0.5px rgb(0 0 0 / 0.08), 0 1px 1px -1px rgb(0 0 0 / 0.1), 0 1px 2px 0 rgb(0 0 0 / 0.05);
@@ -160,6 +163,7 @@
160
163
  --ink-edge: rgb(255 255 255 / 0.22);
161
164
  --ink-track: rgb(255 255 255 / 0.16);
162
165
  --ink-scrim: rgb(0 0 0 / 0.5);
166
+ --ink-focus: rgb(77 141 255 / 0.8);
163
167
 
164
168
  --ink-shadow-card: 0 0 0 0.5px rgb(255 255 255 / 0.12), 0 1px 2px 0 rgb(0 0 0 / 0.4);
165
169
  --ink-shadow-card-hover: 0 0 0 0.5px rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(0 0 0 / 0.4);