kmcom-nuxt-layers 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
and the resulting HMR layout shift on first load. */
|
|
4
4
|
@custom-variant dark (&:where([data-theme-mode="dark"], [data-theme-mode="dark"] *));
|
|
5
5
|
|
|
6
|
+
/* Explicit cascade-layer priority (low -> high). Tailwind's own
|
|
7
|
+
`@import 'tailwindcss'` and `@nuxt/ui` already register into this same
|
|
8
|
+
`theme`/`base`/`components`/`utilities` order internally — this statement
|
|
9
|
+
pins that order explicitly rather than relying on Tailwind/Nuxt UI's own
|
|
10
|
+
internal default, so a future re-ordering of the @import statements below,
|
|
11
|
+
or a change to how Tailwind/Nuxt UI register their layers, can't silently
|
|
12
|
+
change which of these four layers wins over another.
|
|
13
|
+
This only fixes ordering BETWEEN the four named layers — it does NOT
|
|
14
|
+
control precedence WITHIN a layer. base.css registers into `base` and
|
|
15
|
+
layout.css into `components`, the same layers Nuxt UI's own CSS uses;
|
|
16
|
+
between project rules and Nuxt UI rules inside the same layer, plain
|
|
17
|
+
source/import order still decides the winner. */
|
|
18
|
+
@layer theme, base, components, utilities;
|
|
19
|
+
|
|
6
20
|
@import 'tailwindcss';
|
|
7
21
|
@import '@nuxt/ui';
|
|
8
22
|
|
|
@@ -26,3 +40,15 @@
|
|
|
26
40
|
typography.css's header comment), and must resolve even for consumers that
|
|
27
41
|
only extend core, since it lives in the same single published package. */
|
|
28
42
|
@import '../../../../design-system/typography/app/assets/css/typography.css';
|
|
43
|
+
|
|
44
|
+
/* Same relative-path requirement as typography.css above. tokens.css defines
|
|
45
|
+
an `@theme static` block (radius/shadow/duration) — per the CSS
|
|
46
|
+
single-build-root rule, that only merges into Tailwind's theme if Tailwind's
|
|
47
|
+
own PostCSS pipeline actually processes the file via @import from this one
|
|
48
|
+
root. It previously was NOT imported here — only registered as a standalone
|
|
49
|
+
stylesheet via theming/nuxt.config.ts's `css:` array — so its @theme block
|
|
50
|
+
was silently inert: the browser just ignores the unrecognized at-rule, and
|
|
51
|
+
every rounded-, shadow-, duration- utility fell back to Tailwind's stock
|
|
52
|
+
defaults instead of this file's values. Confirmed via compiled dev output:
|
|
53
|
+
the custom --shadow-sm value never appeared; Tailwind's built-in default did. */
|
|
54
|
+
@import '../../../../design-system/theming/app/assets/css/tokens.css';
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
@layer components {
|
|
2
|
-
table {
|
|
3
|
-
border-color: inherit;
|
|
4
|
-
border-collapse: collapse;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
2
|
th {
|
|
8
3
|
vertical-align: top;
|
|
9
4
|
padding: 0;
|
|
@@ -20,8 +15,6 @@
|
|
|
20
15
|
margin: 1rem 0;
|
|
21
16
|
border: 0;
|
|
22
17
|
border-top: 1px solid #ccc;
|
|
23
|
-
height: 0;
|
|
24
|
-
color: inherit;
|
|
25
18
|
}
|
|
26
19
|
|
|
27
20
|
img,
|
|
@@ -1,26 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Shadow/duration — vanilla custom properties are the source of truth
|
|
3
|
+
* (:root block below); the @theme static block bridges them into
|
|
4
|
+
* Tailwind's namespace so `shadow-lg`, `duration-base`, etc. and any
|
|
5
|
+
* future non-Tailwind consumer read the same values from one place.
|
|
6
|
+
* `static` is required — Tailwind v4 tree-shakes @theme entries that no
|
|
7
|
+
* utility in the scanned source actually uses; without it, an unused
|
|
8
|
+
* shade here silently disappears from the theme namespace instead of
|
|
9
|
+
* just being unused. Mirrors the font-token pattern in
|
|
10
|
+
* layers/design-system/typography/app/assets/css/typography.css.
|
|
11
|
+
*
|
|
12
|
+
* Radius is deliberately NOT here. Nuxt UI already owns the rounded-*
|
|
13
|
+
* scale via its own --ui-radius-based overrides (rounded-sm through
|
|
14
|
+
* rounded-3xl all resolve to calc(var(--ui-radius) * N)), registered in
|
|
15
|
+
* a lower-priority cascade layer than Tailwind's own generated
|
|
16
|
+
* utilities. Defining --radius-* in @theme here made Tailwind generate
|
|
17
|
+
* competing utilities-layer rules for rounded-sm/md/lg/xl that silently
|
|
18
|
+
* beat Nuxt UI's design-system scaling app-wide (confirmed: every Nuxt
|
|
19
|
+
* UI component's corner radius changed), while rounded-2xl/3xl (never
|
|
20
|
+
* given a --radius-* entry here) stayed on Nuxt UI's scale — a visible,
|
|
21
|
+
* inconsistent split. Bridging radius through this file needs its
|
|
22
|
+
* values aligned to --ui-radius's own multipliers to avoid this, which
|
|
23
|
+
* is out of scope here; until then, Nuxt UI stays the single source of
|
|
24
|
+
* truth for radius.
|
|
25
|
+
*
|
|
26
|
+
* Shadow is bridged in the OPPOSITE direction from duration: @theme
|
|
27
|
+
* static holds the literal shadow values, and :root's --shadow-token-*
|
|
28
|
+
* point at them via var(). Tailwind v4's box-shadow utility parses each
|
|
29
|
+
* shadow's resolved theme value at BUILD TIME to rewrite its color into
|
|
30
|
+
* a `var(--tw-shadow-color, <original>)` slot — that's the mechanism
|
|
31
|
+
* behind `shadow-primary/25` and other shadow-color opacity modifiers.
|
|
32
|
+
* A var() indirection in @theme is opaque to that build-time parser, so
|
|
33
|
+
* pointing --shadow-md etc. at --shadow-token-md (as duration does)
|
|
34
|
+
* would silently drop the --tw-shadow-color slot and opacity modifiers
|
|
35
|
+
* would render a plain black shadow. Duration doesn't have this
|
|
36
|
+
* constraint — it resolves purely via var() at use time, with no
|
|
37
|
+
* build-time parsing involved. Nuxt UI doesn't override shadow-*, so
|
|
38
|
+
* this collision risk doesn't apply to it.
|
|
39
|
+
*
|
|
40
|
+
* Colours are NOT here — they're already single-sourced dynamically via
|
|
41
|
+
* accent-css.ts's per-accent --ui-color-* generation (runtime accent
|
|
42
|
+
* switching), a different mechanism this file does not touch.
|
|
6
43
|
*/
|
|
7
|
-
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
--
|
|
12
|
-
--
|
|
13
|
-
--radius-full: 9999px;
|
|
44
|
+
:root {
|
|
45
|
+
--shadow-token-none: var(--shadow-none);
|
|
46
|
+
--shadow-token-sm: var(--shadow-sm);
|
|
47
|
+
--shadow-token-md: var(--shadow-md);
|
|
48
|
+
--shadow-token-lg: var(--shadow-lg);
|
|
49
|
+
--shadow-token-xl: var(--shadow-xl);
|
|
14
50
|
|
|
51
|
+
/* --duration-token-base matches theme.css's .theme-transition value —
|
|
52
|
+
not a new default, just giving the real value in use a named token. */
|
|
53
|
+
--duration-token-fast: 150ms;
|
|
54
|
+
--duration-token-base: 700ms;
|
|
55
|
+
--duration-token-slow: 1000ms;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@theme static {
|
|
15
59
|
--shadow-none: none;
|
|
16
60
|
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
17
61
|
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
18
62
|
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
19
63
|
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
--duration-fast: 150ms;
|
|
24
|
-
--duration-base: 700ms;
|
|
25
|
-
--duration-slow: 1000ms;
|
|
64
|
+
--duration-fast: var(--duration-token-fast);
|
|
65
|
+
--duration-base: var(--duration-token-base);
|
|
66
|
+
--duration-slow: var(--duration-token-slow);
|
|
26
67
|
}
|
|
@@ -25,7 +25,10 @@ export default defineNuxtConfig({
|
|
|
25
25
|
'#layers/theming/types': `${import.meta.dirname}/app/types`,
|
|
26
26
|
},
|
|
27
27
|
|
|
28
|
-
css
|
|
28
|
+
// tokens.css is NOT listed here — it defines a Tailwind `@theme static` block, so per the
|
|
29
|
+
// CSS single-build-root rule (see .claude/rules/nuxt-layers.md) it must fold into core.css's
|
|
30
|
+
// @import chain via relative path instead, or its @theme block is silently inert.
|
|
31
|
+
css: ['#layers/theming/app/assets/css/theme.css'],
|
|
29
32
|
|
|
30
33
|
plugins: ['#layers/theming/app/plugins/theme.client.ts'],
|
|
31
34
|
|
package/package.json
CHANGED