@dustin-riley/design 0.1.1 → 0.1.2

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/DESIGN.md CHANGED
@@ -26,7 +26,7 @@ This doc is the source of truth; the bundled `dustinriley-design` skill mirrors
26
26
  |---|---|
27
27
  | Design tokens (color, type, spacing, radius, shadow, motion) + focus ring — pure tokens, no element styling | `@dustin-riley/design/tokens.css` |
28
28
  | Component / primitive styles (buttons, container, panel, typographic helpers, etc.) | `@dustin-riley/design/core.css` |
29
- | Opt-in base element resets (link underline, boxed code, heading sizes, body) — import only if you have no base layer, and into a layer weaker than components | `@dustin-riley/design/reset.css` |
29
+ | Base element resets (link underline, boxed code, heading sizes, body) — `:where()` zero-specificity, plain import in every app; any app rule wins automatically | `@dustin-riley/design/reset.css` |
30
30
  | Tailwind v4 base + theme bridge + shadcn bridge | `@dustin-riley/design/tailwind.css` |
31
31
 
32
32
  **All design tokens are CSS custom properties prefixed `--ds-*`.** Always reference the token, never hard-code a hex / px value. If you need something the token set doesn't cover, that's a signal to push back on the design, not invent a one-off value.
package/README.md CHANGED
@@ -17,15 +17,17 @@ npm i @dustin-riley/design
17
17
  @import "@dustin-riley/design/tokens.css";
18
18
  @import "@dustin-riley/design/core.css";
19
19
 
20
- /* Tailwind v4 + shadcn projects instead just need: */
21
- @import "@dustin-riley/design/tailwind.css"; /* pulls in core + tokens */
20
+ /* base element styling (links, code, headings, body) plain import,
21
+ zero specificity (:where), so any app rule always wins. No @layer,
22
+ nothing to remember: */
23
+ @import "@dustin-riley/design/reset.css";
22
24
 
23
- /* ONLY if your project has no base element styling of its own —
24
- import it into a layer weaker than your components so specific
25
- rules still win: */
26
- @layer base { @import "@dustin-riley/design/reset.css"; }
25
+ /* Tailwind v4 + shadcn projects also need: */
26
+ @import "@dustin-riley/design/tailwind.css"; /* pulls in core + tokens */
27
27
  ```
28
28
 
29
+ Every app imports the same set — no per-app reasoning.
30
+
29
31
  ## What's in / out
30
32
 
31
33
  `tokens.css` — `--ds-*` custom properties + the focus ring. Pure tokens, no
@@ -34,13 +36,13 @@ element styling; safe to import anywhere/unlayered.
34
36
  `core.css` — generic primitives (`.ds-btn*`, `.ds-container`, `.ds-panel`,
35
37
  typographic helpers, `.kbd`, …). Imports `tokens.css`.
36
38
 
37
- `reset.css` — **opt-in** opinionated base element resets (link underline, boxed
38
- inline code, heading sizes, body defaults). These are *not* tokens they are
39
- project-level base opinions. Import only if you have no base layer of your own,
40
- and import it **into a cascade layer weaker than your components**; importing it
41
- unlayered makes it override your component rules. Projects that already style
42
- their own raw `a`/`code`/headings (e.g. via a prose/typography plugin) must NOT
43
- import it.
39
+ `reset.css` — base element styling (link underline, boxed inline code, heading
40
+ sizes, body defaults). These are *not* tokens. Every selector is wrapped in
41
+ `:where()`, giving it **zero specificity**, so *any* app rule a bare `a {}`,
42
+ a component class, a prose/typography plugin wins automatically. No `@layer`
43
+ (bundlers like Lightning CSS flatten a package-internal `@layer` pulled in via
44
+ `@import`); no consumer incantation. Plain `@import`, same in every app. It only
45
+ sets the baseline where nothing else applies. Requires tokens to be loaded.
44
46
 
45
47
  `tailwind.css` — optional Tailwind v4 `@theme` + shadcn HSL bridge (pulls in
46
48
  core + tokens). Does **not** include `reset.css`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dustin-riley/design",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Dustin Riley design system — warm mid-century modern tokens and primitives.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,11 +18,11 @@ Apply this whenever you add or change UI in a project importing `@dustin-riley/d
18
18
  ## How to consume
19
19
  - Always: `@import "@dustin-riley/design/tokens.css"; @import "@dustin-riley/design/core.css";`
20
20
  - Tailwind v4 + shadcn projects additionally: `@import "@dustin-riley/design/tailwind.css";`
21
- - `tokens.css` is pure tokens — safe unlayered. Opinionated base element
22
- resets are NOT in tokens.css; they live in opt-in `@dustin-riley/design/reset.css`.
23
- Import `reset.css` only if the project has no base element styling of its
24
- own, and inside a layer weaker than components: `@layer base { @import "@dustin-riley/design/reset.css"; }`.
25
- Never import reset.css unlayered it will override component rules.
21
+ - Base element styling: `@import "@dustin-riley/design/reset.css";` plain
22
+ import, same in every app. `tokens.css` is pure tokens (no element styling).
23
+ `reset.css` selectors are all `:where()` (zero specificity), so any app rule
24
+ (component class, bare element, prose plugin) wins automatically no
25
+ `@layer`, no per-app judgment. Requires tokens to be loaded.
26
26
 
27
27
  ## Vocabulary (prefer extending these over inventing parallels)
28
28
  Buttons `.ds-btn` + `.ds-btn-primary|secondary|ghost`; layout `.ds-container`,
package/src/reset.css CHANGED
@@ -1,27 +1,28 @@
1
- @import "./tokens.css";
2
-
3
1
  /* ============================================================
4
- @dustin-riley/design — base element resets (OPT-IN)
2
+ @dustin-riley/design — base element resets
5
3
 
6
4
  Opinionated base styling for raw elements (link underline,
7
- boxed inline code, heading sizes, body defaults). These are
8
- NOT tokens — they are project-level base opinions, so they
9
- ship separately and are opt-in.
5
+ boxed inline code, heading sizes, body defaults).
6
+
7
+ Every selector is wrapped in :where(), giving it ZERO
8
+ specificity. So ANY app rule — a bare `a {}`, a component
9
+ class, a prose/typography plugin — automatically wins, with
10
+ no cascade-layer plumbing required. (We do NOT use @layer:
11
+ bundlers like Lightning CSS flatten a package-internal
12
+ @layer pulled in via @import, which would make these rules
13
+ unexpectedly override your components.)
14
+
15
+ Uniform contract — every app, plain import, nothing to remember:
16
+
17
+ @import "@dustin-riley/design/reset.css";
10
18
 
11
- - Import this ONLY if your project has no base element layer
12
- of its own.
13
- - Import it into a cascade layer WEAKER than your component
14
- styles so specific rules (e.g. `.site-nav a {…}`) win, e.g.:
15
- @layer base { @import "@dustin-riley/design/reset.css"; }
16
- Importing it unlayered makes it beat every layered rule and
17
- will override your component overrides — don't.
18
- - Projects that already style their own base elements (raw
19
- `a` / `code` / headings) must NOT import this.
19
+ Requires the design tokens to be loaded (tokens.css / core.css /
20
+ tailwind.css) for the `var(--ds-*)` references to resolve.
20
21
  ============================================================ */
21
22
 
22
- html { font-size: 16px; }
23
+ :where(html) { font-size: 16px; }
23
24
 
24
- body {
25
+ :where(body) {
25
26
  background: var(--ds-bg);
26
27
  color: var(--ds-text);
27
28
  font-family: var(--ds-font-body);
@@ -32,48 +33,50 @@ body {
32
33
  overflow-x: clip;
33
34
  }
34
35
 
35
- h1, h2, h3, h4, h5, h6 {
36
+ :where(h1, h2, h3, h4, h5, h6) {
36
37
  font-family: var(--ds-font-display);
37
38
  color: var(--ds-text);
38
39
  font-weight: 600;
39
40
  }
40
41
 
41
- h1, .h1 {
42
+ :where(h1, .h1) {
42
43
  font-size: var(--ds-fs-h1);
43
44
  line-height: var(--ds-lh-h1);
44
45
  letter-spacing: var(--ds-tracking-h1);
45
46
  }
46
- h2, .h2 {
47
+ :where(h2, .h2) {
47
48
  font-size: var(--ds-fs-h2);
48
49
  line-height: var(--ds-lh-h2);
49
50
  letter-spacing: var(--ds-tracking-h2);
50
51
  }
51
- h3, .h3 {
52
+ :where(h3, .h3) {
52
53
  font-size: var(--ds-fs-h3);
53
54
  line-height: var(--ds-lh-h3);
54
55
  letter-spacing: var(--ds-tracking-h3);
55
56
  font-weight: 500;
56
57
  }
57
58
 
58
- a {
59
+ :where(a) {
59
60
  color: var(--ds-link);
60
61
  text-decoration: underline;
61
62
  text-decoration-thickness: 1px;
62
63
  text-underline-offset: 3px;
63
64
  transition: color var(--ds-duration-fast) var(--ds-ease-standard);
64
65
  }
65
- a:hover { color: var(--ds-link-hover); }
66
+ :where(a:hover) { color: var(--ds-link-hover); }
66
67
 
67
- code, pre, kbd, samp {
68
+ :where(code, pre, kbd, samp) {
68
69
  font-family: var(--ds-font-mono);
69
70
  font-size: 0.9em;
70
71
  }
71
72
 
72
- code {
73
+ :where(code) {
73
74
  background: var(--ds-surface-sunken);
74
75
  padding: 2px 6px;
75
76
  border-radius: var(--ds-radius-sm);
76
77
  border: 1px solid var(--ds-border);
77
78
  }
78
79
 
80
+ /* ::selection is a pseudo-element and cannot be wrapped in :where();
81
+ it has specificity (0,0,1) — an app ::selection rule still wins. */
79
82
  ::selection { background: rgba(184, 84, 28, 0.2); }