@whatsaaaa/design-system 0.6.1 → 0.7.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
@@ -62,10 +62,10 @@ A pull request that changes what the package ships adds a changeset with `pnpm c
62
62
  CI runs on every pull request:
63
63
 
64
64
  - formatting, lint and types,
65
- - the unit tests, with the contrast of every role pair in both themes, and the comments of the stylesheets in the built ones,
65
+ - the unit tests, with the contrast of every role pair in both themes, the comments of the stylesheets in the built ones, and Nuxt UI's colors read from tokens outside any layer,
66
66
  - that `assets/` is what the sources produce,
67
67
  - that the package and the style guide build,
68
- - the browser tests: no page overflows sideways at phone, tablet and desktop width in either theme, and no terminal window or bar of one cuts off its content, no page logs an error when it loads, the easter egg works with the mouse, the keyboard and reduced motion, the keys of the status line work and their switch turns them off, the numbers of the tabs show only while their keys work and keep their place while the keys load, the path of the status line gives way at every width from 320 px and the theme button switches the theme, a `dark` or `light` class chooses the theme as `data-theme` does, an element for one theme shows only in it, the browser's theme-color follows the theme, a control that takes the focus is not left under the status line and no bar or corner of the window cuts off its focus ring, a radius of the page's own wins over the focus ring's and a button without one takes its small corners, with index.css and with tailwind.css, a state lines up with the text beside it, a prompt that wraps keeps its chevron on its first line at every width from 320 px, assistive technology reads the parts of the path above a page title as words of their own, the first tab starts on the border of the sidebar, the pieces of a form fit every width from 320 px (a segmented control works with the keyboard, stands out at 3:1 and takes the selection colors in forced colors, amounts line up at the right in figures of one width, a number field has no spin buttons and its arrow keys step it, wrapped code hangs and stays inside its block, a long email breaks after its @, and the check icon and the ghost files draw), both fonts draw Serbian Latin, an app built on the Tailwind entry takes its utilities, layers and `dark:` and `light:` from the tokens and their theme, and the pages of the style guide look like their stored screenshots.
68
+ - the browser tests: no page overflows sideways at phone, tablet and desktop width in either theme, and no terminal window or bar of one cuts off its content, no page logs an error when it loads, the easter egg works with the mouse, the keyboard and reduced motion, the keys of the status line work and their switch turns them off, the numbers of the tabs show only while their keys work and keep their place while the keys load, the path of the status line gives way at every width from 320 px and the theme button switches the theme, a `dark` or `light` class chooses the theme as `data-theme` does, an element for one theme shows only in it, the browser's theme-color follows the theme, a control that takes the focus is not left under the status line and no bar or corner of the window cuts off its focus ring, a radius of the page's own wins over the focus ring's and a button without one takes its small corners, with index.css and with tailwind.css, a state lines up with the text beside it, a prompt that wraps keeps its chevron on its first line at every width from 320 px, assistive technology reads the parts of the path above a page title as words of their own, the first tab starts on the border of the sidebar, the pieces of a form fit every width from 320 px (a segmented control works with the keyboard, stands out at 3:1 and takes the selection colors in forced colors, amounts line up at the right in figures of one width, a number field has no spin buttons and its arrow keys step it, wrapped code hangs and stays inside its block, a long email breaks after its @, and the check icon and the ghost files draw), both fonts draw Serbian Latin, an app built on the Tailwind entry takes its utilities, layers and `dark:` and `light:` from the tokens and their theme, Nuxt UI's colors take the roles of the theme chosen around them, and the pages of the style guide look like their stored screenshots.
69
69
 
70
70
  The screenshots are in `tests/browser/__screenshots__/` and are taken on Linux, in the Playwright container, so they are the same on every machine. After a change that is meant to be seen, update them:
71
71
 
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Nuxt UI's theme variables, pointed at the design system's roles. Both themes follow by
3
+ * themselves: the roles switch, and these read them.
4
+ *
5
+ * Outside any layer, so it wins over Nuxt UI's own values, which it keeps in its theme layer
6
+ * and in a style it adds at runtime. Declared again on every element with a data-theme or a dark
7
+ * or light class, where Nuxt UI puts its own, so a part of a page kept in one theme, either way,
8
+ * reads that theme's roles, as the tokens do.
9
+ *
10
+ * Where Nuxt UI wants a step the system has no role for, it is mixed from the roles around it
11
+ * in oklab. The shade scales Nuxt UI makes of each color run from the page (50) through the
12
+ * color (500) to the text (950), so a low shade is a faint tint in both themes.
13
+ *
14
+ * It reads the tokens and comes after Nuxt UI's own stylesheet, so it is not in index.css or
15
+ * tailwind.css. An app's stylesheet ends its imports with it:
16
+ *
17
+ * @import '@whatsaaaa/design-system/tailwind.css';
18
+ * @import '@nuxt/ui';
19
+ * @import '@whatsaaaa/design-system/tailwind/variants.css';
20
+ * @import '@whatsaaaa/design-system/css/nuxt-ui.css';
21
+ */
22
+ :root, :host, [data-theme], .dark, .light {
23
+ --ui-text-dimmed: var(--ws-color-text-faint);
24
+ --ui-text-muted: var(--ws-color-text-secondary);
25
+ --ui-text-toned: color-mix(in oklab, var(--ws-color-text-secondary), var(--ws-color-text));
26
+ --ui-text: var(--ws-color-text);
27
+ --ui-text-highlighted: var(--ws-color-text);
28
+ --ui-text-inverted: var(--ws-color-bg);
29
+ --ui-bg: var(--ws-color-bg);
30
+ --ui-bg-muted: var(--ws-color-surface);
31
+ --ui-bg-elevated: var(--ws-color-raised);
32
+ --ui-bg-accented: color-mix(in oklab, var(--ws-color-raised) 85%, var(--ws-color-text));
33
+ --ui-bg-inverted: var(--ws-color-text);
34
+ --ui-border: var(--ws-color-border);
35
+ --ui-border-muted: var(--ws-color-border);
36
+ --ui-border-accented: var(--ws-color-field-border);
37
+ --ui-border-inverted: var(--ws-color-text);
38
+ --ui-primary: var(--ws-color-interactive);
39
+ --ui-success: var(--ws-color-tip);
40
+ --ui-info: var(--ws-color-note);
41
+ --ui-warning: var(--ws-color-warning);
42
+ --ui-error: var(--ws-color-danger);
43
+ --ui-color-primary-50: color-mix(in oklab, var(--ws-color-interactive) 10%, var(--ws-color-bg));
44
+ --ui-color-primary-100: color-mix(in oklab, var(--ws-color-interactive) 20%, var(--ws-color-bg));
45
+ --ui-color-primary-200: color-mix(in oklab, var(--ws-color-interactive) 40%, var(--ws-color-bg));
46
+ --ui-color-primary-300: color-mix(in oklab, var(--ws-color-interactive) 60%, var(--ws-color-bg));
47
+ --ui-color-primary-400: color-mix(in oklab, var(--ws-color-interactive) 80%, var(--ws-color-bg));
48
+ --ui-color-primary-500: var(--ws-color-interactive);
49
+ --ui-color-primary-600: color-mix(in oklab,
50
+ var(--ws-color-interactive) 80%,
51
+ var(--ws-color-text));
52
+ --ui-color-primary-700: color-mix(in oklab,
53
+ var(--ws-color-interactive) 60%,
54
+ var(--ws-color-text));
55
+ --ui-color-primary-800: color-mix(in oklab,
56
+ var(--ws-color-interactive) 40%,
57
+ var(--ws-color-text));
58
+ --ui-color-primary-900: color-mix(in oklab,
59
+ var(--ws-color-interactive) 20%,
60
+ var(--ws-color-text));
61
+ --ui-color-primary-950: color-mix(in oklab,
62
+ var(--ws-color-interactive) 10%,
63
+ var(--ws-color-text));
64
+ --ui-color-success-50: color-mix(in oklab, var(--ws-color-tip) 10%, var(--ws-color-bg));
65
+ --ui-color-success-100: color-mix(in oklab, var(--ws-color-tip) 20%, var(--ws-color-bg));
66
+ --ui-color-success-200: color-mix(in oklab, var(--ws-color-tip) 40%, var(--ws-color-bg));
67
+ --ui-color-success-300: color-mix(in oklab, var(--ws-color-tip) 60%, var(--ws-color-bg));
68
+ --ui-color-success-400: color-mix(in oklab, var(--ws-color-tip) 80%, var(--ws-color-bg));
69
+ --ui-color-success-500: var(--ws-color-tip);
70
+ --ui-color-success-600: color-mix(in oklab, var(--ws-color-tip) 80%, var(--ws-color-text));
71
+ --ui-color-success-700: color-mix(in oklab, var(--ws-color-tip) 60%, var(--ws-color-text));
72
+ --ui-color-success-800: color-mix(in oklab, var(--ws-color-tip) 40%, var(--ws-color-text));
73
+ --ui-color-success-900: color-mix(in oklab, var(--ws-color-tip) 20%, var(--ws-color-text));
74
+ --ui-color-success-950: color-mix(in oklab, var(--ws-color-tip) 10%, var(--ws-color-text));
75
+ --ui-color-info-50: color-mix(in oklab, var(--ws-color-note) 10%, var(--ws-color-bg));
76
+ --ui-color-info-100: color-mix(in oklab, var(--ws-color-note) 20%, var(--ws-color-bg));
77
+ --ui-color-info-200: color-mix(in oklab, var(--ws-color-note) 40%, var(--ws-color-bg));
78
+ --ui-color-info-300: color-mix(in oklab, var(--ws-color-note) 60%, var(--ws-color-bg));
79
+ --ui-color-info-400: color-mix(in oklab, var(--ws-color-note) 80%, var(--ws-color-bg));
80
+ --ui-color-info-500: var(--ws-color-note);
81
+ --ui-color-info-600: color-mix(in oklab, var(--ws-color-note) 80%, var(--ws-color-text));
82
+ --ui-color-info-700: color-mix(in oklab, var(--ws-color-note) 60%, var(--ws-color-text));
83
+ --ui-color-info-800: color-mix(in oklab, var(--ws-color-note) 40%, var(--ws-color-text));
84
+ --ui-color-info-900: color-mix(in oklab, var(--ws-color-note) 20%, var(--ws-color-text));
85
+ --ui-color-info-950: color-mix(in oklab, var(--ws-color-note) 10%, var(--ws-color-text));
86
+ --ui-color-warning-50: color-mix(in oklab, var(--ws-color-warning) 10%, var(--ws-color-bg));
87
+ --ui-color-warning-100: color-mix(in oklab, var(--ws-color-warning) 20%, var(--ws-color-bg));
88
+ --ui-color-warning-200: color-mix(in oklab, var(--ws-color-warning) 40%, var(--ws-color-bg));
89
+ --ui-color-warning-300: color-mix(in oklab, var(--ws-color-warning) 60%, var(--ws-color-bg));
90
+ --ui-color-warning-400: color-mix(in oklab, var(--ws-color-warning) 80%, var(--ws-color-bg));
91
+ --ui-color-warning-500: var(--ws-color-warning);
92
+ --ui-color-warning-600: color-mix(in oklab, var(--ws-color-warning) 80%, var(--ws-color-text));
93
+ --ui-color-warning-700: color-mix(in oklab, var(--ws-color-warning) 60%, var(--ws-color-text));
94
+ --ui-color-warning-800: color-mix(in oklab, var(--ws-color-warning) 40%, var(--ws-color-text));
95
+ --ui-color-warning-900: color-mix(in oklab, var(--ws-color-warning) 20%, var(--ws-color-text));
96
+ --ui-color-warning-950: color-mix(in oklab, var(--ws-color-warning) 10%, var(--ws-color-text));
97
+ --ui-color-error-50: color-mix(in oklab, var(--ws-color-danger) 10%, var(--ws-color-bg));
98
+ --ui-color-error-100: color-mix(in oklab, var(--ws-color-danger) 20%, var(--ws-color-bg));
99
+ --ui-color-error-200: color-mix(in oklab, var(--ws-color-danger) 40%, var(--ws-color-bg));
100
+ --ui-color-error-300: color-mix(in oklab, var(--ws-color-danger) 60%, var(--ws-color-bg));
101
+ --ui-color-error-400: color-mix(in oklab, var(--ws-color-danger) 80%, var(--ws-color-bg));
102
+ --ui-color-error-500: var(--ws-color-danger);
103
+ --ui-color-error-600: color-mix(in oklab, var(--ws-color-danger) 80%, var(--ws-color-text));
104
+ --ui-color-error-700: color-mix(in oklab, var(--ws-color-danger) 60%, var(--ws-color-text));
105
+ --ui-color-error-800: color-mix(in oklab, var(--ws-color-danger) 40%, var(--ws-color-text));
106
+ --ui-color-error-900: color-mix(in oklab, var(--ws-color-danger) 20%, var(--ws-color-text));
107
+ --ui-color-error-950: color-mix(in oklab, var(--ws-color-danger) 10%, var(--ws-color-text));
108
+ --ui-color-neutral-50: color-mix(in oklab, var(--ws-color-text) 5%, var(--ws-color-bg));
109
+ --ui-color-neutral-100: color-mix(in oklab, var(--ws-color-text) 10%, var(--ws-color-bg));
110
+ --ui-color-neutral-200: color-mix(in oklab, var(--ws-color-text) 20%, var(--ws-color-bg));
111
+ --ui-color-neutral-300: color-mix(in oklab, var(--ws-color-text) 30%, var(--ws-color-bg));
112
+ --ui-color-neutral-400: color-mix(in oklab, var(--ws-color-text) 40%, var(--ws-color-bg));
113
+ --ui-color-neutral-500: color-mix(in oklab, var(--ws-color-text) 50%, var(--ws-color-bg));
114
+ --ui-color-neutral-600: color-mix(in oklab, var(--ws-color-text) 60%, var(--ws-color-bg));
115
+ --ui-color-neutral-700: color-mix(in oklab, var(--ws-color-text) 70%, var(--ws-color-bg));
116
+ --ui-color-neutral-800: color-mix(in oklab, var(--ws-color-text) 80%, var(--ws-color-bg));
117
+ --ui-color-neutral-900: color-mix(in oklab, var(--ws-color-text) 90%, var(--ws-color-bg));
118
+ --ui-color-neutral-950: color-mix(in oklab, var(--ws-color-text) 95%, var(--ws-color-bg));
119
+ --ui-radius: var(--ws-radius-sm);
120
+ --ui-header-height: var(--ws-size-tab-bar);
121
+ }
package/docs/usage.md CHANGED
@@ -32,8 +32,9 @@ Or take pieces. `tokens.css` and `fonts.css` first, then what you use:
32
32
  | `@whatsaaaa/design-system/css/theme.css` | `ws-theme-dark` and `ws-theme-light`, for an element of one theme only |
33
33
  | `@whatsaaaa/design-system/css/ghost.css` | Styles of `<ws-ghost>` |
34
34
  | `@whatsaaaa/design-system/css/icons.css` | The icons the callouts and prompts draw, and `--ws-icon-check`, the tick of a form. Needed with `callout.css` and `terminal.css`, and for the tick |
35
+ | `@whatsaaaa/design-system/css/nuxt-ui.css` | Nuxt UI's colors on the roles. Only in an app on Nuxt UI, after it: see With Tailwind CSS below |
35
36
 
36
- Everything is prefixed: classes with `ws-`, variables with `--ws-`.
37
+ Everything is prefixed: classes with `ws-`, variables with `--ws-`. Only `nuxt-ui.css` sets variables of another prefix, Nuxt UI's `--ui-*`.
37
38
 
38
39
  ### With Tailwind CSS
39
40
 
@@ -47,21 +48,19 @@ An app on Tailwind CSS v4, such as one on Nuxt UI, imports the Tailwind entry in
47
48
 
48
49
  Install `tailwindcss` 4.3.5 or a later 4.x next to the package. Only this entry needs it.
49
50
 
50
- The entry gives Nuxt UI the system's fonts, weights, radii and spacing, but not its colors. Nuxt UI takes its colors from its own `--ui-*` variables, which fall back to its green and slate, and without `--ui-bg` it paints the body in its own background. Pointing them at the roles is the app's job, in its stylesheet outside any layer. A variable takes the role's value where it is set, so set it on `:root`, which follows the system, and on every element that chooses a theme, with `data-theme` or the `dark` or `light` class:
51
+ The entry gives Nuxt UI the system's fonts, weights, radii and spacing, but not its colors. Nuxt UI takes its colors from its own `--ui-*` variables, which fall back to its green and slate, and without `--ui-bg` it paints the body in its own background. `css/nuxt-ui.css` points them at the roles. It is not in the entry, as it has to come after Nuxt UI, so an app on Nuxt UI imports it last:
51
52
 
52
53
  ```css
53
- :root,
54
- [data-theme],
55
- .dark,
56
- .light {
57
- --ui-primary: var(--ws-color-interactive);
58
- --ui-bg: var(--ws-color-bg);
59
- --ui-text: var(--ws-color-text);
60
- --ui-border: var(--ws-color-border);
61
- /* and the rest of Nuxt UI's colors, such as --ui-error and --ui-bg-elevated */
62
- }
54
+ @import '@whatsaaaa/design-system/tailwind.css';
55
+ @import '@nuxt/ui';
56
+ @import '@whatsaaaa/design-system/tailwind/variants.css';
57
+ @import '@whatsaaaa/design-system/css/nuxt-ui.css';
63
58
  ```
64
59
 
60
+ It sets them outside any layer, so they win over Nuxt UI's own, which it keeps in its theme layer and in a style it adds at runtime. A variable takes the role's value where it is set, so it sets them on `:root`, which follows the system, and again on every element that chooses a theme, with `data-theme` or the `dark` or `light` class, where Nuxt UI sets its own. The primary color is `--ws-color-interactive`, success, info, warning and error are tip, note, warning and danger, and `secondary` has no role, so it is left out. A step the system has no role for, such as `--ui-bg-accented` or a shade of a color other than 500, is mixed from the roles around it in oklab: a color's shades run from the page at 50 through the color at 500 to the text at 950, so a low shade is a faint tint in both themes. It also sets `--ui-radius` to `--ws-radius-sm`, and `--ui-header-height` to the height of the tab bar, 3rem where Nuxt UI's own is 4rem. Nuxt UI makes its headers that tall: the app's `UHeader`, a dashboard's navbar and the header of its sidebar, and at least the header of a modal, a slideover or a sidebar. It also leaves room for the app's header by it: `UMain` and `UError` are at least the height of the window less it, and `UPageAside`, `UContentToc` and a heading scrolled to stop below it.
61
+
62
+ To change one of them, set it after the import, outside any layer, on the same selectors: `:root, :host, [data-theme], .dark, .light`. On `:root` alone it holds only where no element around chooses a theme, as the stylesheet sets its own value again on each one that does.
63
+
65
64
  The entry brings Tailwind and everything `index.css` brings, in cascade layers, so a utility wins over a class of the system and the app's rules outside any layer win over both:
66
65
 
67
66
  | Layer | What it has, the later winning |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatsaaaa/design-system",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Whatsaaaa's design system: brand identity, design tokens, typography, docs theme and asset kit",
5
5
  "homepage": "https://github.com/whatsaaaa/design-system#readme",
6
6
  "bugs": "https://github.com/whatsaaaa/design-system/issues",