@whatsaaaa/ui-vue 0.0.0-stage → 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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -2
  3. package/dist/color-mode.d.ts +14 -0
  4. package/dist/color-mode.js +34 -0
  5. package/dist/index.d.ts +12 -0
  6. package/dist/index.js +12 -0
  7. package/dist/theme/badge.d.ts +62 -0
  8. package/dist/theme/badge.js +123 -0
  9. package/dist/theme/button.d.ts +119 -0
  10. package/dist/theme/button.js +190 -0
  11. package/dist/theme/card.d.ts +29 -0
  12. package/dist/theme/card.js +44 -0
  13. package/dist/theme/checkbox.d.ts +159 -0
  14. package/dist/theme/checkbox.js +73 -0
  15. package/dist/theme/choice.d.ts +82 -0
  16. package/dist/theme/choice.js +124 -0
  17. package/dist/theme/field.d.ts +131 -0
  18. package/dist/theme/field.js +173 -0
  19. package/dist/theme/form-field.d.ts +44 -0
  20. package/dist/theme/form-field.js +34 -0
  21. package/dist/theme/index.d.ts +1288 -0
  22. package/dist/theme/index.js +112 -0
  23. package/dist/theme/input.d.ts +146 -0
  24. package/dist/theme/input.js +46 -0
  25. package/dist/theme/modal.d.ts +31 -0
  26. package/dist/theme/modal.js +44 -0
  27. package/dist/theme/radio-group.d.ts +177 -0
  28. package/dist/theme/radio-group.js +111 -0
  29. package/dist/theme/select-menu.d.ts +181 -0
  30. package/dist/theme/select-menu.js +22 -0
  31. package/dist/theme/select.d.ts +281 -0
  32. package/dist/theme/select.js +109 -0
  33. package/dist/theme/shared.d.ts +69 -0
  34. package/dist/theme/shared.js +103 -0
  35. package/dist/theme/table.d.ts +45 -0
  36. package/dist/theme/table.js +111 -0
  37. package/dist/theme/tabs.d.ts +95 -0
  38. package/dist/theme/tabs.js +144 -0
  39. package/package.json +65 -3
  40. package/src/index.css +123 -0
  41. package/src/nuxt-ui.css +148 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * What the component themes share. Tailwind finds the classes it builds by reading the
3
+ * compiled themes as text, so every class here and in the themes is written out whole: none is
4
+ * put together from parts, and each color has its own line.
5
+ *
6
+ * Every slot is a string, merged onto Nuxt UI's own classes, where a class of the same kind
7
+ * replaces Nuxt UI's: font-semibold its font-medium, disabled:opacity-100 its
8
+ * disabled:opacity-75. Nuxt UI can also take a function that replaces a slot whole, but its
9
+ * Vite plugin writes the config as JSON, so on Vue the function is lost.
10
+ */
11
+ /** The colors of the theme. Nuxt UI's secondary has no role in the design system. */
12
+ export const colors = ['primary', 'success', 'info', 'warning', 'error'];
13
+ /**
14
+ * The design system's focus ring, as base.css draws it: two pixels of the interactive color,
15
+ * three pixels out. Nuxt UI tints the outline with the component's color and widens it to
16
+ * three pixels; these replace that.
17
+ */
18
+ export const focusRing = 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3';
19
+ /*
20
+ * Forced colors, Windows' contrast themes, take box shadows away and paint every background in
21
+ * the page color. Nuxt UI draws the edge of a part with ring, a box shadow, and an icon as a mask
22
+ * over its background, so in forced colors the edges, the icons and the fill of a checked control
23
+ * are gone. These draw them again in the system's colors, and only in forced colors.
24
+ */
25
+ /** The edge of a control: a border in the button border color, gray when it is disabled. */
26
+ export const forcedControlEdge = 'forced-colors:border forced-colors:border-[ButtonBorder] forced-colors:disabled:border-[GrayText] forced-colors:aria-disabled:border-[GrayText]';
27
+ /** The edge of a panel or a tag: a border in the text color. */
28
+ export const forcedEdge = 'forced-colors:border forced-colors:border-[CanvasText]';
29
+ /**
30
+ * A checked control's fill: the selection's colors, gray in a disabled control, kept as they are,
31
+ * so that its mark, painted in the text color, keeps the fill's text color.
32
+ */
33
+ export const forcedChecked = 'forced-colors:bg-[Highlight] forced-colors:text-[HighlightText] forced-colors:forced-color-adjust-none forced-colors:in-disabled:bg-[GrayText] forced-colors:in-disabled:text-[Canvas]';
34
+ /**
35
+ * The mark of a checked control, where it is an icon drawn as a mask: in the fill's text color,
36
+ * where the stylesheet paints every icon in the text color of the page.
37
+ */
38
+ export const forcedMark = 'forced-colors:not-[svg]:bg-[HighlightText] forced-colors:in-disabled:not-[svg]:bg-[Canvas]';
39
+ /**
40
+ * An icon drawn as a mask, in the text color, gray inside a disabled control as its label is: a
41
+ * button, a select's trigger or a tab. An input's icons sit beside the input, not inside it, so
42
+ * they keep the text color when it is disabled. An icon drawn as an SVG, as Nuxt UI draws them on
43
+ * Vue, already takes the text color, and a fill behind it would hide it.
44
+ */
45
+ export const forcedIcon = 'forced-colors:not-[svg]:bg-[CanvasText] forced-colors:in-disabled:not-[svg]:bg-[GrayText] forced-colors:in-aria-disabled:not-[svg]:bg-[GrayText]';
46
+ /**
47
+ * Color changes on hover and focus, in the fast duration, unless the reader asks for less motion.
48
+ * Nuxt UI puts transition-colors on its controls; this adds it where it does not, and takes it
49
+ * off for a reader who asks for less motion.
50
+ */
51
+ export const transition = 'transition-colors motion-reduce:transition-none';
52
+ /**
53
+ * Text on a solid fill. The fill of a status is its text color, which reads on the page in both
54
+ * themes, so the page color reads on it: in the light theme every status fill is the text
55
+ * color, and the word on it carries the status. For danger that is the brand fill and the text
56
+ * on it, a pair the design system checks.
57
+ */
58
+ export const solid = {
59
+ primary: 'bg-interactive text-on-interactive',
60
+ success: 'bg-tip-text text-bg',
61
+ info: 'bg-note-text text-bg',
62
+ warning: 'bg-warning-text text-bg',
63
+ error: 'bg-danger-text text-bg',
64
+ neutral: 'bg-text text-bg',
65
+ };
66
+ /** A tint of the color under its text color: the tag, and the status blocks of the system. */
67
+ export const tint = {
68
+ primary: 'bg-tag-bg text-tag-text',
69
+ success: 'bg-tip-tint text-tip-text',
70
+ info: 'bg-note-tint text-note-text',
71
+ warning: 'bg-warning-tint text-warning-text',
72
+ error: 'bg-danger-tint text-danger-text',
73
+ neutral: 'bg-raised text-text',
74
+ };
75
+ /** The color as text on the page. A status takes its text color, which can differ from it. */
76
+ export const text = {
77
+ primary: 'text-interactive',
78
+ success: 'text-tip-text',
79
+ info: 'text-note-text',
80
+ warning: 'text-warning-text',
81
+ error: 'text-danger-text',
82
+ neutral: 'text-text',
83
+ };
84
+ /** The color as an outline drawn inside the box, which takes no room. */
85
+ export const ring = {
86
+ primary: 'ring-interactive',
87
+ success: 'ring-tip',
88
+ info: 'ring-note',
89
+ warning: 'ring-warning',
90
+ error: 'ring-danger',
91
+ neutral: 'ring-field-border',
92
+ };
93
+ /**
94
+ * One compound variant for each color, from a class list for each. With a slot the classes go
95
+ * to that slot, without one to the component's first.
96
+ */
97
+ export function byColor(classes, conditions, slot) {
98
+ return Object.keys(classes).map((color) => ({
99
+ color,
100
+ ...conditions,
101
+ class: slot ? { [slot]: classes[color] } : classes[color],
102
+ }));
103
+ }
@@ -0,0 +1,45 @@
1
+ declare const _default: {
2
+ slots: {
3
+ root: string;
4
+ tbody: string;
5
+ tr: string;
6
+ th: string;
7
+ td: string;
8
+ separator: string;
9
+ empty: string;
10
+ };
11
+ variants: {
12
+ pinned: {
13
+ true: {
14
+ th: string;
15
+ td: string;
16
+ };
17
+ };
18
+ sticky: {
19
+ true: {
20
+ thead: string;
21
+ tfoot: string;
22
+ };
23
+ header: {
24
+ thead: string;
25
+ };
26
+ footer: {
27
+ tfoot: string;
28
+ };
29
+ };
30
+ };
31
+ compoundVariants: ({
32
+ loading: boolean;
33
+ class: {
34
+ thead: string;
35
+ };
36
+ loadingColor?: undefined;
37
+ } | {
38
+ loading: boolean;
39
+ loadingColor: string;
40
+ class: {
41
+ thead: string;
42
+ };
43
+ })[];
44
+ };
45
+ export default _default;
@@ -0,0 +1,111 @@
1
+ import { focusRing } from "./shared.js";
2
+ /*
3
+ * The table of the design system's table spec, specs/table.spec.json: the table of the system's
4
+ * prose, in a border with the large radius, scrolling inside it. The head is on the surface, as
5
+ * an overline, and the rows on the page color, so the head stands out on a panel too; a cell is
6
+ * small body text, the rows apart by a line. It reads the table tier by name, --ws-table-*, so a
7
+ * change of the tier reaches it.
8
+ *
9
+ * The lines are borders, which forced colors keep: the head's is the border of its cells, where
10
+ * Nuxt UI draws a row of its own filled with the border color, and the foot's the same.
11
+ *
12
+ * Rows are chosen by a checkbox in each row's first cell, as the spec has it: a row with one is
13
+ * raised under the pointer, takes the selection color once chosen, the line under it a step
14
+ * darker in the light theme, and is ringed inside while its checkbox has the focus, not while
15
+ * another control in the row has it. A row Nuxt UI makes a stop of its own, with a handler for
16
+ * the row, is raised and ringed too: those classes have Nuxt UI's variants exactly, so they
17
+ * replace Nuxt UI's own.
18
+ */
19
+ /** A row that can be chosen, by the checkbox in its first cell or by Nuxt UI's handler. */
20
+ const hover = '[&>tr]:has-[>td:first-child_[role=checkbox]]:hover:bg-(--ws-table-row-bg-hover) [&>tr]:data-[selectable=true]:hover:bg-(--ws-table-row-bg-hover)';
21
+ /**
22
+ * The ring inside a row, while the checkbox in its first cell has the focus or the row itself
23
+ * does. The row with its checkbox has the focus in it, but not in another cell: written so, the
24
+ * focus a gallery draws on the checkbox with the focus-visible variant rings the row too.
25
+ *
26
+ * A ringed row also says how wide its ring is, in --table-row-ring, and how far inside the row
27
+ * a cell that lies over the ring has to start for the ring to show, in --table-row-ring-clip: a
28
+ * pinned cell reads both. The clip is a thin border wider than the ring: a cell starts inside
29
+ * its row by a part of the line between the rows, which the browser rounds to a pixel or to none,
30
+ * and what the clip bares past the ring is the row's fill. In a row without a ring the ring is
31
+ * nothing and the clip far outside the cell.
32
+ *
33
+ * In forced colors the ring of a chosen row is HighlightText, the row's text color there, on its
34
+ * Highlight. Left to the browser, the outline of a row that has the focus itself would be in the
35
+ * browser's color for what has the focus, Highlight on Highlight.
36
+ */
37
+ const focus = '[&>tr]:outline-interactive [&>tr]:-outline-offset-(--ws-border-width-medium) [&>tr]:[--table-row-ring:0px] [&>tr]:[--table-row-ring-clip:-100vmax] [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:outline-2 [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:outline-solid [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:[--table-row-ring:var(--ws-border-width-medium)] [&>tr]:has-[>td:first-child_[role=checkbox]]:has-focus-visible:not-has-[>td:not(:first-child)_:focus-visible]:[--table-row-ring-clip:calc(var(--ws-border-width-medium)_+_var(--ws-border-width-thin))] [&>tr]:data-[selectable=true]:outline-interactive [&>tr]:data-[selectable=true]:-outline-offset-(--ws-border-width-medium) [&>tr]:data-[selectable=true]:focus-visible:outline-2 [&>tr]:data-[selectable=true]:focus-visible:outline-solid [&>tr]:data-[selectable=true]:focus-visible:[--table-row-ring:var(--ws-border-width-medium)] [&>tr]:data-[selectable=true]:focus-visible:[--table-row-ring-clip:calc(var(--ws-border-width-medium)_+_var(--ws-border-width-thin))] forced-colors:[&>tr]:data-[selected=true]:outline-[HighlightText]';
38
+ /**
39
+ * A cell's measures. Nuxt UI takes the end padding off a cell with a checkbox, the spec does not;
40
+ * the first cell of a row that can be chosen is only as wide as its checkbox, where a table wider
41
+ * than its columns would widen it as it widens the others.
42
+ */
43
+ const cell = 'px-(--ws-table-cell-padding-inline) py-(--ws-table-cell-padding-block) [&:has([role=checkbox])]:pe-(--ws-table-cell-padding-inline) first:[&:has([role=checkbox])]:w-px';
44
+ /**
45
+ * A cell of a chosen row in forced colors, in HighlightText. Forced colors put a plate of the
46
+ * page color behind each line of text, which would hide it, as HighlightText is near the page
47
+ * color: the cell keeps its colors as they are, and so does the text in it. The parts of Nuxt
48
+ * UI's components in it draw colors of their own, such as a badge's or a button's, and keep the
49
+ * forced colors as they do everywhere, unless a part keeps its own, as a checked box does. An
50
+ * icon of the cell itself, outside any such part, is in HighlightText as the text is, where the
51
+ * stylesheet paints every icon in the text color of the page.
52
+ */
53
+ const chosenCell = 'forced-colors:in-data-[selected=true]:text-[HighlightText] forced-colors:in-data-[selected=true]:forced-color-adjust-none forced-colors:in-data-[selected=true]:[:where(&_[data-slot])]:forced-color-adjust-auto forced-colors:in-data-[selected=true]:[:where(&_.iconify:not(svg,:is(&_[data-slot]_*)))]:bg-[HighlightText]';
54
+ /**
55
+ * The ring of a row over a pinned cell. The cell's fill, which hides what scrolls under it, lies
56
+ * over the row's outline too. So in a ringed row the cell gives way to the outline's lines above
57
+ * and below it: it is clipped there by its row's --table-row-ring-clip, which in every other row
58
+ * is far outside the cell and clips nothing. The first or the last cell of the row keeps its
59
+ * whole height where the ring ends, as wide as --table-row-ring, and draws the end itself: the
60
+ * row's own may have scrolled away under it. A pinned cell between them draws none: Tailwind's
61
+ * after: gives a content to whatever it styles, so those cells are told to have none. The end is
62
+ * a border, which forced colors keep, in the color the outline has there: the text color, or
63
+ * Highlight on a row that has the focus itself and is not chosen, the color the browser gives
64
+ * the outline of what has the focus.
65
+ */
66
+ const pinnedRing = "[clip-path:inset(var(--table-row-ring-clip)_-100vmax)] first:[clip-path:polygon(-100vmax_-100vmax,var(--table-row-ring)_-100vmax,var(--table-row-ring)_var(--table-row-ring-clip),calc(100%_+_100vmax)_var(--table-row-ring-clip),calc(100%_+_100vmax)_calc(100%_-_var(--table-row-ring-clip)),var(--table-row-ring)_calc(100%_-_var(--table-row-ring-clip)),var(--table-row-ring)_calc(100%_+_100vmax),-100vmax_calc(100%_+_100vmax))] last:[clip-path:polygon(-100vmax_var(--table-row-ring-clip),calc(100%_-_var(--table-row-ring))_var(--table-row-ring-clip),calc(100%_-_var(--table-row-ring))_-100vmax,calc(100%_+_100vmax)_-100vmax,calc(100%_+_100vmax)_calc(100%_+_100vmax),calc(100%_-_var(--table-row-ring))_calc(100%_+_100vmax),calc(100%_-_var(--table-row-ring))_calc(100%_-_var(--table-row-ring-clip)),-100vmax_calc(100%_-_var(--table-row-ring-clip)))] after:content-none first:after:content-[''] last:after:content-[''] after:absolute after:inset-y-0 first:after:left-0 last:after:right-0 after:pointer-events-none after:border-s-[length:var(--table-row-ring,0px)] after:border-interactive forced-colors:after:border-current forced-colors:[tr[data-selectable=true]:focus-visible:not([data-selected=true])>&]:after:border-[Highlight]";
67
+ /**
68
+ * A pinned cell hides what scrolls under it: on the page color, or its row's fill, raised under
69
+ * the pointer where the row is, or chosen.
70
+ */
71
+ const pinnedCell = `sticky bg-bg z-1 ${pinnedRing} [@media(hover:hover)]:[tr:has(>td:first-child_[role=checkbox]):hover>&]:bg-(--ws-table-row-bg-hover) [@media(hover:hover)]:[tr[data-selectable=true]:hover>&]:bg-(--ws-table-row-bg-hover) in-data-[selected=true]:bg-(--ws-table-row-bg-selected)! forced-colors:in-data-[selected=true]:bg-[Highlight]!`;
72
+ export default {
73
+ slots: {
74
+ root: `rounded-lg border-thin border-border bg-bg ${focusRing}`,
75
+ tbody: `divide-y-thin divide-border ${hover} ${focus}`,
76
+ // A chosen row keeps its fill under the pointer. In forced colors it is in the selection
77
+ // colors, the system's own, which forced colors keep: Highlight under HighlightText, the
78
+ // color its ring is given, with the ring's other rules. Over a row that is not chosen its
79
+ // line is CanvasText, as the line under every other row is there: forced colors would draw
80
+ // it in the row's HighlightText, the page's color, and the line would vanish over that row.
81
+ // Over a chosen row it stays HighlightText, which reads on the Highlight of both.
82
+ tr: 'data-[selected=true]:bg-(--ws-table-row-bg-selected)! data-[selected=true]:border-b-selection-border forced-colors:data-[selected=true]:bg-[Highlight]! forced-colors:data-[selected=true]:text-[HighlightText] forced-colors:data-[selected=true]:not-has-[+[data-selected=true]]:border-b-[CanvasText]',
83
+ th: `${cell} align-middle bg-(--ws-table-head-bg-rest) font-mono font-bold text-overline uppercase text-(--ws-table-head-text-rest) whitespace-nowrap in-[thead]:border-b-thin in-[thead]:border-border in-[tfoot]:border-t-thin in-[tfoot]:border-border`,
84
+ td: `${cell} align-top font-sans text-body-sm text-(--ws-table-row-text-rest) ${chosenCell}`,
85
+ separator: 'hidden',
86
+ empty: 'font-sans text-body-sm text-text-secondary',
87
+ },
88
+ variants: {
89
+ pinned: {
90
+ true: { th: 'sticky bg-(--ws-table-head-bg-rest) z-1', td: pinnedCell },
91
+ },
92
+ sticky: {
93
+ true: {
94
+ thead: 'sticky top-0 inset-x-0 bg-(--ws-table-head-bg-rest) backdrop-blur-none z-1',
95
+ tfoot: 'sticky bottom-0 inset-x-0 bg-bg backdrop-blur-none z-1',
96
+ },
97
+ header: {
98
+ thead: 'sticky top-0 inset-x-0 bg-(--ws-table-head-bg-rest) backdrop-blur-none z-1',
99
+ },
100
+ footer: { tfoot: 'sticky bottom-0 inset-x-0 bg-bg backdrop-blur-none z-1' },
101
+ },
102
+ },
103
+ compoundVariants: [
104
+ // The loading line is a thin border's height, over the line under the head.
105
+ { loading: true, class: { thead: 'after:bottom-0 after:h-(--ws-border-width-thin)' } },
106
+ { loading: true, loadingColor: 'primary', class: { thead: 'after:bg-interactive' } },
107
+ { loading: true, loadingColor: 'neutral', class: { thead: 'after:bg-text' } },
108
+ // In forced colors the loading bar is in the text color.
109
+ { loading: true, class: { thead: 'forced-colors:after:bg-[CanvasText]' } },
110
+ ],
111
+ };
@@ -0,0 +1,95 @@
1
+ declare const _default: {
2
+ slots: {
3
+ root: string;
4
+ indicator: string;
5
+ leadingIcon: string;
6
+ trigger: string;
7
+ content: string;
8
+ };
9
+ variants: {
10
+ variant: {
11
+ pill: {
12
+ list: string;
13
+ trigger: string;
14
+ indicator: string;
15
+ };
16
+ link: {
17
+ list: string;
18
+ indicator: string;
19
+ trigger: string;
20
+ };
21
+ };
22
+ size: {
23
+ xs: {
24
+ trigger: string;
25
+ leadingIcon: string;
26
+ };
27
+ sm: {
28
+ trigger: string;
29
+ leadingIcon: string;
30
+ };
31
+ md: {
32
+ trigger: string;
33
+ leadingIcon: string;
34
+ };
35
+ lg: {
36
+ trigger: string;
37
+ leadingIcon: string;
38
+ };
39
+ xl: {
40
+ trigger: string;
41
+ leadingIcon: string;
42
+ };
43
+ };
44
+ };
45
+ compoundVariants: (({
46
+ variant: string;
47
+ } & {
48
+ color: import("./shared.ts").Color;
49
+ class: string | Record<string, string>;
50
+ }) | {
51
+ orientation: string;
52
+ class: {
53
+ list: string;
54
+ trigger?: undefined;
55
+ indicator?: undefined;
56
+ content?: undefined;
57
+ };
58
+ variant?: undefined;
59
+ size?: undefined;
60
+ } | {
61
+ variant: string;
62
+ size: string;
63
+ class: {
64
+ trigger: string;
65
+ list?: undefined;
66
+ indicator?: undefined;
67
+ content?: undefined;
68
+ };
69
+ orientation?: undefined;
70
+ } | {
71
+ orientation: string;
72
+ variant: string;
73
+ class: {
74
+ list: string;
75
+ indicator: string;
76
+ trigger: string;
77
+ content?: undefined;
78
+ };
79
+ size?: undefined;
80
+ } | {
81
+ class: {
82
+ trigger: string;
83
+ content: string;
84
+ list?: undefined;
85
+ indicator?: undefined;
86
+ };
87
+ orientation?: undefined;
88
+ variant?: undefined;
89
+ size?: undefined;
90
+ })[];
91
+ defaultVariants: {
92
+ variant: string;
93
+ };
94
+ };
95
+ export default _default;
@@ -0,0 +1,144 @@
1
+ import { byColor, forcedEdge, forcedIcon, transition } from "./shared.js";
2
+ /*
3
+ * Tabs read like the tabs of the frame, as the design system's tabs spec, specs/tabs.spec.json,
4
+ * draws them: a row of mono labels over a line, the idle ones in the secondary text color, whose
5
+ * current tab is marked in the brand color, as the frame marks its current tab. That is the link,
6
+ * and tabs are links unless they ask for a pill: a bar on the page color whose current tab is
7
+ * raised, which the spec leaves to the system's segmented control. The focus ring is drawn inside
8
+ * the tab, as the frame draws it. A tab is as tall as a control, and reads the control tier by
9
+ * name, --ws-control-*, so a change of the tier reaches it; a pill's tab is shorter, inside its
10
+ * bar.
11
+ *
12
+ * Until the indicator is in the page, as in the HTML from the server, the current tab draws it
13
+ * itself: the classes that start with in-[[data-slot=list]...] do that.
14
+ *
15
+ * A tab keeps its whole label: tabs that do not fit their row scroll inside it, as a table does,
16
+ * and the marker of a link is drawn inside the row, over its line.
17
+ *
18
+ * In forced colors the current tab is marked in the selection color: a pill's outlined, a link's
19
+ * underlined, and the bar of the pills is outlined. The pill's mark is a ring, which the
20
+ * stylesheet outlines in the text color there: the outline takes the selection color too.
21
+ */
22
+ /**
23
+ * The current tab of a pill is raised and outlined: the raised fill alone is too close to the bar
24
+ * to be seen, the outline is in a color that reads on it.
25
+ */
26
+ const pill = {
27
+ primary: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-raised in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-field-border',
28
+ success: 'data-[state=active]:text-tip-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-tip-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-tip',
29
+ info: 'data-[state=active]:text-note-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-note-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-note',
30
+ warning: 'data-[state=active]:text-warning-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-warning-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-warning',
31
+ error: 'data-[state=active]:text-danger-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-danger-tint in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-danger',
32
+ neutral: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:bg-raised in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-field-border',
33
+ };
34
+ const pillIndicator = {
35
+ primary: 'bg-raised ring ring-inset ring-field-border',
36
+ success: 'bg-tip-tint ring ring-inset ring-tip',
37
+ info: 'bg-note-tint ring ring-inset ring-note',
38
+ warning: 'bg-warning-tint ring ring-inset ring-warning',
39
+ error: 'bg-danger-tint ring ring-inset ring-danger',
40
+ neutral: 'bg-raised ring ring-inset ring-field-border',
41
+ };
42
+ const link = {
43
+ primary: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-brand',
44
+ success: 'data-[state=active]:text-tip-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-tip',
45
+ info: 'data-[state=active]:text-note-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-note',
46
+ warning: 'data-[state=active]:text-warning-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-warning',
47
+ error: 'data-[state=active]:text-danger-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-danger',
48
+ neutral: 'data-[state=active]:text-text in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-text',
49
+ };
50
+ const linkIndicator = {
51
+ primary: 'bg-brand',
52
+ success: 'bg-tip',
53
+ info: 'bg-note',
54
+ warning: 'bg-warning',
55
+ error: 'bg-danger',
56
+ neutral: 'bg-text',
57
+ };
58
+ /** The ring inside the tab. */
59
+ const focus = 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2';
60
+ export default {
61
+ slots: {
62
+ root: 'gap-4',
63
+ // the indicator moves only for a reader who has not asked for less motion, as Nuxt UI has it
64
+ indicator: 'transition-[translate,width,height] duration-(--ws-motion-duration-base) ease-standard',
65
+ leadingIcon: forcedIcon,
66
+ trigger: `font-mono font-normal cursor-pointer data-[state=inactive]:text-text-secondary hover:data-[state=inactive]:not-disabled:text-text disabled:opacity-100 data-[state=inactive]:disabled:text-text-faint ${transition} ${focus}`,
67
+ content: 'outline-interactive focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-3',
68
+ },
69
+ variants: {
70
+ variant: {
71
+ pill: {
72
+ list: `bg-bg ring ring-inset ring-border rounded-md p-1 ${forcedEdge}`,
73
+ trigger: "grow shrink-0 rounded-sm in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:absolute in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:inset-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:rounded-sm in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:ring-inset in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:-z-10 forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:border-2 forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:border-[Highlight] forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:before:outline-[Highlight] isolate",
74
+ indicator: 'rounded-sm forced-colors:border-2 forced-colors:border-[Highlight] forced-colors:outline-[Highlight]',
75
+ },
76
+ link: {
77
+ list: 'p-0 border-border',
78
+ indicator: 'rounded-none forced-colors:bg-[Highlight]',
79
+ trigger: "shrink-0 rounded-none in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:content-[''] in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:absolute forced-colors:in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bg-[Highlight]",
80
+ },
81
+ },
82
+ size: {
83
+ xs: {
84
+ trigger: 'h-(--ws-control-height-xs) px-(--ws-space-8) gap-(--ws-control-gap-xs) text-label-sm',
85
+ leadingIcon: 'size-(--ws-control-icon-size-xs)',
86
+ },
87
+ sm: {
88
+ trigger: 'h-(--ws-control-height-sm) px-(--ws-space-10) gap-(--ws-control-gap-sm) text-label-sm',
89
+ leadingIcon: 'size-(--ws-control-icon-size-sm)',
90
+ },
91
+ md: {
92
+ trigger: 'h-(--ws-control-height-md) px-(--ws-space-14) gap-(--ws-control-gap-md) text-label',
93
+ leadingIcon: 'size-(--ws-control-icon-size-md)',
94
+ },
95
+ lg: {
96
+ trigger: 'h-(--ws-control-height-lg) px-(--ws-space-16) gap-(--ws-control-gap-lg) text-label',
97
+ leadingIcon: 'size-(--ws-control-icon-size-lg)',
98
+ },
99
+ xl: {
100
+ trigger: 'h-(--ws-control-height-xl) px-(--ws-space-16) gap-(--ws-control-gap-xl) text-label',
101
+ leadingIcon: 'size-(--ws-control-icon-size-xl)',
102
+ },
103
+ },
104
+ },
105
+ compoundVariants: [
106
+ // A row of tabs that does not fit scrolls inside itself. A column keeps its width.
107
+ { orientation: 'horizontal', class: { list: 'overflow-x-auto' } },
108
+ ...byColor(pill, { variant: 'pill' }, 'trigger'),
109
+ ...byColor(pillIndicator, { variant: 'pill' }, 'indicator'),
110
+ ...byColor(link, { variant: 'link' }, 'trigger'),
111
+ ...byColor(linkIndicator, { variant: 'link' }, 'indicator'),
112
+ // A pill's tab is inside its bar, which has a padding of 4 pixels.
113
+ { variant: 'pill', size: 'xs', class: { trigger: 'h-6' } },
114
+ { variant: 'pill', size: 'sm', class: { trigger: 'h-7' } },
115
+ { variant: 'pill', size: 'md', class: { trigger: 'h-8' } },
116
+ { variant: 'pill', size: 'lg', class: { trigger: 'h-9' } },
117
+ { variant: 'pill', size: 'xl', class: { trigger: 'h-10' } },
118
+ // A link's marker is a medium border wide, just over the line.
119
+ {
120
+ orientation: 'horizontal',
121
+ variant: 'link',
122
+ class: {
123
+ list: 'border-b-thin',
124
+ indicator: 'bottom-0 h-(--ws-border-width-medium)',
125
+ trigger: 'in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:bottom-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:h-(--ws-border-width-medium)',
126
+ },
127
+ },
128
+ {
129
+ orientation: 'vertical',
130
+ variant: 'link',
131
+ class: {
132
+ list: 'border-s-thin',
133
+ indicator: 'start-0 w-(--ws-border-width-medium)',
134
+ trigger: 'justify-start in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:start-0 in-[[data-slot=list]:not(:has([data-slot=indicator]))]:data-[state=active]:after:w-(--ws-border-width-medium)',
135
+ },
136
+ },
137
+ // Nuxt UI tints the focus outline of a tab and of its panel with the color: the ring is the
138
+ // system's.
139
+ { class: { trigger: focus, content: 'outline-interactive' } },
140
+ ],
141
+ defaultVariants: {
142
+ variant: 'link',
143
+ },
144
+ };
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@whatsaaaa/ui-vue",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Nuxt UI themed with the Whatsaaaa design system, for Vue and Nuxt",
5
+ "keywords": [
6
+ "design-system",
7
+ "nuxt",
8
+ "nuxt-ui",
9
+ "tailwindcss",
10
+ "theme",
11
+ "vue"
12
+ ],
13
+ "homepage": "https://github.com/whatsaaaa/ui-vue/tree/main/packages/ui-vue#readme",
14
+ "bugs": "https://github.com/whatsaaaa/ui-vue/issues",
15
+ "license": "MIT",
16
+ "author": "Whatsaaaa",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/whatsaaaa/ui-vue.git",
20
+ "directory": "packages/ui-vue"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "src/*.css"
25
+ ],
26
+ "type": "module",
27
+ "sideEffects": [
28
+ "**/*.css"
29
+ ],
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./color-mode": {
36
+ "types": "./dist/color-mode.d.ts",
37
+ "default": "./dist/color-mode.js"
38
+ },
39
+ "./index.css": "./src/index.css",
40
+ "./package.json": "./package.json"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "devDependencies": {
46
+ "@nuxt/ui": "4.13.0",
47
+ "@types/node": "^24.19.2",
48
+ "@whatsaaaa/design-system": "^1.0.0",
49
+ "@whatsaaaa/tsconfig": "^1.0.0",
50
+ "tailwindcss": "^4.3.5",
51
+ "typescript": "~6.0.3",
52
+ "vue": "^3.5.45"
53
+ },
54
+ "peerDependencies": {
55
+ "@nuxt/ui": "~4.13.0",
56
+ "@whatsaaaa/design-system": "^1.0.0",
57
+ "tailwindcss": "^4.3.5",
58
+ "vue": "^3.5.0"
59
+ },
60
+ "engines": {
61
+ "node": "^22.18.0 || >=24.12.0"
62
+ },
63
+ "scripts": {
64
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
65
+ "build": "node --eval \"fs.rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json",
66
+ "lint:package": "publint --strict && pnpm pack --out .attw/package.tgz && attw .attw/package.tgz --profile esm-only --exclude-entrypoints index.css"
67
+ }
6
68
  }