@phcdevworks/spectre-tokens 4.10.0 → 4.11.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 +52 -17
- package/dist/index.cjs +34 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +41 -3
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +32 -0
- package/package.json +5 -4
- package/tokens/modes.json +38 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ contracts for specific frameworks and runtimes.
|
|
|
17
17
|
| Project team | `project-design` |
|
|
18
18
|
| Repository role | Spectre L1 design-token contract |
|
|
19
19
|
| Package/artifact | `@phcdevworks/spectre-tokens` |
|
|
20
|
-
| Current version/status | 4.
|
|
20
|
+
| Current version/status | 4.11.0 |
|
|
21
21
|
|
|
22
22
|
## Standard Workflow
|
|
23
23
|
|
|
@@ -30,18 +30,20 @@ contracts for specific frameworks and runtimes.
|
|
|
30
30
|
|
|
31
31
|
## Documentation Map
|
|
32
32
|
|
|
33
|
-
| Guide
|
|
34
|
-
|
|
|
35
|
-
| Agent rules
|
|
36
|
-
| Claude Code
|
|
37
|
-
| Codex
|
|
38
|
-
| Copilot
|
|
39
|
-
| Jules
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
33
|
+
| Guide | Path |
|
|
34
|
+
| ----------------- | -------------------------------------------- |
|
|
35
|
+
| Agent rules | [AGENTS.md](AGENTS.md) |
|
|
36
|
+
| Claude Code | [CLAUDE.md](CLAUDE.md) |
|
|
37
|
+
| Codex | [CODEX.md](CODEX.md) |
|
|
38
|
+
| Copilot | [COPILOT.md](COPILOT.md) |
|
|
39
|
+
| Jules | [JULES.md](JULES.md) |
|
|
40
|
+
| Grok | [GROK.md](GROK.md) |
|
|
41
|
+
| Roadmap | [ROADMAP.md](ROADMAP.md) |
|
|
42
|
+
| Todo | [TODO.md](TODO.md) |
|
|
43
|
+
| Token reference | [TOKEN_REFERENCE.md](TOKEN_REFERENCE.md) |
|
|
44
|
+
| Downstream parity | [DOWNSTREAM_PARITY.md](DOWNSTREAM_PARITY.md) |
|
|
45
|
+
| Changelog | [CHANGELOG.md](CHANGELOG.md) |
|
|
46
|
+
| Security | [SECURITY.md](SECURITY.md) |
|
|
45
47
|
|
|
46
48
|
[](https://www.npmjs.com/package/@phcdevworks/spectre-tokens)
|
|
47
49
|
[](https://github.com/phcdevworks/spectre-tokens/actions/workflows/ci.yml)
|
|
@@ -262,17 +264,40 @@ body {
|
|
|
262
264
|
font-weight: var(--sp-body-weight);
|
|
263
265
|
letter-spacing: var(--sp-body-letter-spacing);
|
|
264
266
|
}
|
|
267
|
+
|
|
268
|
+
.hero-title {
|
|
269
|
+
font-size: var(--sp-display-1-size);
|
|
270
|
+
line-height: var(--sp-display-1-line-height);
|
|
271
|
+
font-weight: var(--sp-display-1-weight);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.intro {
|
|
275
|
+
font-size: var(--sp-lead-size);
|
|
276
|
+
line-height: var(--sp-lead-line-height);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
input {
|
|
280
|
+
background: var(--sp-form-default-bg);
|
|
281
|
+
color: var(--sp-form-default-text);
|
|
282
|
+
}
|
|
265
283
|
```
|
|
266
284
|
|
|
267
285
|
The CSS entry point is intended for consumers that want the token contract as
|
|
268
286
|
variables rather than reading values in JavaScript.
|
|
269
287
|
|
|
270
|
-
`typography.heading.{h1..h6}
|
|
271
|
-
each a complete
|
|
288
|
+
`typography.heading.{h1..h6}`, `typography.body`, `typography.display.{1..6}`,
|
|
289
|
+
and `typography.lead` are semantic role tokens — each a complete
|
|
272
290
|
`{ fontFamily, fontSize, lineHeight, fontWeight, letterSpacing }` object
|
|
273
291
|
referencing `typography.scale.*` and `typography.families.*` — so downstream
|
|
274
|
-
consumers get a
|
|
275
|
-
`typography.scale` step per heading level.
|
|
292
|
+
consumers get a text-role contract instead of hand-picking a raw
|
|
293
|
+
`typography.scale` step per heading level. Each role emits
|
|
294
|
+
`--sp-<role>-{family,size,line-height,weight,letter-spacing}` (for example
|
|
295
|
+
`--sp-heading-h1-size`, `--sp-display-1-size`, `--sp-lead-size`).
|
|
296
|
+
|
|
297
|
+
`--sp-form-default-{bg,text,placeholder}` are redeclared in the
|
|
298
|
+
`[data-spectre-theme="dark"]` block from `modes.dark.forms.default.*`, so they
|
|
299
|
+
follow the active mode. Other `forms.*` variables, including
|
|
300
|
+
`--sp-form-default-border`, are declared once in `:root`.
|
|
276
301
|
|
|
277
302
|
### Token model
|
|
278
303
|
|
|
@@ -310,6 +335,12 @@ internal generation details and are not part of the public package contract.
|
|
|
310
335
|
See [TOKEN_REFERENCE.md](TOKEN_REFERENCE.md) for the exhaustive, generated list
|
|
311
336
|
of every token path, resolved value, and usage note.
|
|
312
337
|
|
|
338
|
+
Downstream packages building recipes on the CSS output should use
|
|
339
|
+
[DOWNSTREAM_PARITY.md](DOWNSTREAM_PARITY.md), which groups every published
|
|
340
|
+
`--sp-*` variable into the family a recipe or stylesheet consumes. Run
|
|
341
|
+
`npm run audit:parity` (optionally `-- <sibling-repo>`) for a checklist of the
|
|
342
|
+
families a checked-out downstream repo has not consumed yet.
|
|
343
|
+
|
|
313
344
|
The `layout` namespace includes section, stack, and container spacing tokens,
|
|
314
345
|
plus fixed layout width tokens for common consumer shells:
|
|
315
346
|
`layout.container.maxWidth`, `layout.container.maxWidthProse`,
|
|
@@ -343,8 +374,12 @@ import tokens from '@phcdevworks/spectre-tokens'
|
|
|
343
374
|
|
|
344
375
|
const darkPage = tokens.modes.dark.surface.page
|
|
345
376
|
const darkText = tokens.modes.dark.text.onPage.default
|
|
377
|
+
const darkInputBg = tokens.modes.dark.forms.default.bg
|
|
346
378
|
```
|
|
347
379
|
|
|
380
|
+
Top-level `forms.default.{bg,text,placeholder}` hold the default (light)
|
|
381
|
+
values; read `modes.dark.forms.default.*` for their dark equivalents.
|
|
382
|
+
|
|
348
383
|
Guidance:
|
|
349
384
|
|
|
350
385
|
- Prefer semantic tokens for theme-aware UI.
|
package/dist/index.cjs
CHANGED
|
@@ -888,6 +888,13 @@ var coreTokens = {
|
|
|
888
888
|
"brand": "{colors.brand.600}"
|
|
889
889
|
}
|
|
890
890
|
},
|
|
891
|
+
"forms": {
|
|
892
|
+
"default": {
|
|
893
|
+
"bg": "{colors.white}",
|
|
894
|
+
"text": "{colors.neutral.900}",
|
|
895
|
+
"placeholder": "{colors.neutral.500}"
|
|
896
|
+
}
|
|
897
|
+
},
|
|
891
898
|
"component": {
|
|
892
899
|
"card": {
|
|
893
900
|
"text": "{colors.neutral.900}",
|
|
@@ -1551,6 +1558,13 @@ var coreTokens = {
|
|
|
1551
1558
|
"brand": "{colors.brand.400}"
|
|
1552
1559
|
}
|
|
1553
1560
|
},
|
|
1561
|
+
"forms": {
|
|
1562
|
+
"default": {
|
|
1563
|
+
"bg": "{colors.neutral.700}",
|
|
1564
|
+
"text": "{colors.neutral.100}",
|
|
1565
|
+
"placeholder": "{colors.neutral.300}"
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1554
1568
|
"component": {
|
|
1555
1569
|
"card": {
|
|
1556
1570
|
"text": "{colors.neutral.100}",
|
|
@@ -3471,6 +3485,16 @@ var createCssVariableMap = (tokens2, options = {}) => {
|
|
|
3471
3485
|
if (body) {
|
|
3472
3486
|
assignRole(["body"], body);
|
|
3473
3487
|
}
|
|
3488
|
+
const display = baseTokens.typography?.display;
|
|
3489
|
+
if (display) {
|
|
3490
|
+
Object.entries(display).forEach(([level, entry]) => {
|
|
3491
|
+
assignRole(["display", level], entry);
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
const lead = baseTokens.typography?.lead;
|
|
3495
|
+
if (lead) {
|
|
3496
|
+
assignRole(["lead"], lead);
|
|
3497
|
+
}
|
|
3474
3498
|
Object.entries(baseTokens.shadows).forEach(([key, value]) => {
|
|
3475
3499
|
if (typeof value === "string") {
|
|
3476
3500
|
assign(toVariableName(prefix, "shadow", key), value);
|
|
@@ -3536,7 +3560,6 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
3536
3560
|
const selector = options.selector ?? DEFAULT_SELECTOR;
|
|
3537
3561
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
3538
3562
|
const declarations = createCssVariableMap(tokens2, { ...options, prefix });
|
|
3539
|
-
const mapLines = Object.entries(declarations).map(([name, value]) => ` ${name}: ${value};`);
|
|
3540
3563
|
const defaultMode = tokens2.modes?.default ?? {};
|
|
3541
3564
|
const darkMode = tokens2.modes?.dark ?? {};
|
|
3542
3565
|
const surfaceAliases = tokens2.surface ?? {};
|
|
@@ -3546,8 +3569,11 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
3546
3569
|
const componentVarParts = (group, kebabGroup, path) => LEGACY_COMPONENT_PREFIX_GROUPS.has(group) ? ["component", kebabGroup, ...path] : [kebabGroup, ...path];
|
|
3547
3570
|
const baseLines = [];
|
|
3548
3571
|
const darkLines = [];
|
|
3572
|
+
const modeScopedNames = /* @__PURE__ */ new Set();
|
|
3549
3573
|
const addBase = (name, value) => {
|
|
3550
|
-
if (value
|
|
3574
|
+
if (value === void 0) return;
|
|
3575
|
+
modeScopedNames.add(name);
|
|
3576
|
+
baseLines.push(` ${name}: ${value};`);
|
|
3551
3577
|
};
|
|
3552
3578
|
const addDark = (name, value) => {
|
|
3553
3579
|
if (value !== void 0) darkLines.push(` ${name}: ${value};`);
|
|
@@ -3602,12 +3628,18 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
3602
3628
|
},
|
|
3603
3629
|
componentAliases
|
|
3604
3630
|
);
|
|
3631
|
+
walkSemanticGroup(
|
|
3632
|
+
"forms",
|
|
3633
|
+
(path) => ["form", ...path.map(kebabPathSegment)],
|
|
3634
|
+
void 0
|
|
3635
|
+
);
|
|
3605
3636
|
Object.entries(linkTokens).forEach(([key, value]) => {
|
|
3606
3637
|
const varName = toVariableName(prefix, "link", kebabPathSegment(key));
|
|
3607
3638
|
const resolved = pickSemantic(tokens2, value);
|
|
3608
3639
|
addBase(varName, resolved);
|
|
3609
3640
|
addDark(varName, resolved);
|
|
3610
3641
|
});
|
|
3642
|
+
const mapLines = Object.entries(declarations).filter(([name]) => !modeScopedNames.has(name)).map(([name, value]) => ` ${name}: ${value};`);
|
|
3611
3643
|
const rootBlock = `${selector} {
|
|
3612
3644
|
${[...baseLines, ...mapLines].join("\n")}
|
|
3613
3645
|
}`;
|