@phcdevworks/spectre-tokens 3.1.0 → 3.3.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 +28 -1
- package/dist/index.cjs +215 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +66 -0
- package/dist/index.d.cts +185 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +215 -0
- package/dist/index.js.map +1 -1
- package/dist/tokens.dtcg.json +464 -0
- package/package.json +9 -8
- package/tokens/components.json +177 -0
- package/tokens/modes.json +328 -0
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
| Project team | `project-design` |
|
|
8
8
|
| Repository role | Spectre L1 design-token contract |
|
|
9
9
|
| Package/artifact | `@phcdevworks/spectre-tokens` |
|
|
10
|
-
| Current version/status |
|
|
10
|
+
| Current version/status | 3.3.0 |
|
|
11
11
|
|
|
12
12
|
## Standard Workflow
|
|
13
13
|
|
|
@@ -136,6 +136,7 @@ import tokens from '@phcdevworks/spectre-tokens'
|
|
|
136
136
|
const card = {
|
|
137
137
|
background: tokens.surface.page,
|
|
138
138
|
color: tokens.text.onPage.default,
|
|
139
|
+
maxWidth: tokens.layout.container.maxWidthProse,
|
|
139
140
|
padding: tokens.space['16'],
|
|
140
141
|
borderRadius: tokens.radii.md
|
|
141
142
|
}
|
|
@@ -219,6 +220,7 @@ const card = {
|
|
|
219
220
|
background: tokens.surface.card,
|
|
220
221
|
color: tokens.text.onSurface.default,
|
|
221
222
|
borderColor: tokens.component.iconBox.border,
|
|
223
|
+
maxWidth: tokens.layout.container.maxWidthProse,
|
|
222
224
|
padding: tokens.space['16']
|
|
223
225
|
}
|
|
224
226
|
```
|
|
@@ -246,6 +248,11 @@ CSS variable contract.
|
|
|
246
248
|
.card {
|
|
247
249
|
background: var(--sp-surface-card);
|
|
248
250
|
color: var(--sp-text-on-surface-default);
|
|
251
|
+
max-width: var(--sp-layout-container-max-width-prose);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.app-shell {
|
|
255
|
+
width: var(--sp-layout-sidebar-width);
|
|
249
256
|
}
|
|
250
257
|
```
|
|
251
258
|
|
|
@@ -268,6 +275,21 @@ export default {
|
|
|
268
275
|
Use `tailwindTheme` directly only when a consumer needs the generated theme
|
|
269
276
|
object outside the preset shape.
|
|
270
277
|
|
|
278
|
+
The generated Tailwind theme includes the layout width mappings
|
|
279
|
+
`maxWidth.container`, `maxWidth.prose`, and `width.sidebar`, derived from
|
|
280
|
+
`layout.container.maxWidth`, `layout.container.maxWidthProse`, and
|
|
281
|
+
`layout.sidebar.width`.
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
export function ArticleShell() {
|
|
285
|
+
return (
|
|
286
|
+
<main className="mx-auto max-w-prose">
|
|
287
|
+
<aside className="w-sidebar" />
|
|
288
|
+
</main>
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
271
293
|
### Token model
|
|
272
294
|
|
|
273
295
|
The generated token object includes these namespaces:
|
|
@@ -300,6 +322,11 @@ The exported runtime token object is a flattened string-based tree generated
|
|
|
300
322
|
from `tokens/`. Source-only wrapper fields such as `value` and `metadata` are
|
|
301
323
|
internal generation details and are not part of the public package contract.
|
|
302
324
|
|
|
325
|
+
The `layout` namespace includes section, stack, and container spacing tokens,
|
|
326
|
+
plus fixed layout width tokens for common consumer shells:
|
|
327
|
+
`layout.container.maxWidth`, `layout.container.maxWidthProse`, and
|
|
328
|
+
`layout.sidebar.width`.
|
|
329
|
+
|
|
303
330
|
## Public contract guarantees
|
|
304
331
|
|
|
305
332
|
`contract.manifest.json` is the machine-readable contract authority for this
|
package/dist/index.cjs
CHANGED
|
@@ -147,6 +147,59 @@ var coreTokens = {
|
|
|
147
147
|
"active": "{colors.info.50}",
|
|
148
148
|
"text": "{colors.neutral.900}"
|
|
149
149
|
}
|
|
150
|
+
},
|
|
151
|
+
"checkbox": {
|
|
152
|
+
"bg": "{colors.white}",
|
|
153
|
+
"border": "{colors.neutral.300}",
|
|
154
|
+
"checkedBg": "{colors.info.600}",
|
|
155
|
+
"checkedBorder": "{colors.info.600}",
|
|
156
|
+
"text": "{colors.white}",
|
|
157
|
+
"disabledBg": "{colors.neutral.50}",
|
|
158
|
+
"disabledBorder": "{colors.neutral.200}"
|
|
159
|
+
},
|
|
160
|
+
"radio": {
|
|
161
|
+
"bg": "{colors.white}",
|
|
162
|
+
"border": "{colors.neutral.300}",
|
|
163
|
+
"checkedBg": "{colors.info.600}",
|
|
164
|
+
"checkedBorder": "{colors.info.600}",
|
|
165
|
+
"text": "{colors.white}",
|
|
166
|
+
"disabledBg": "{colors.neutral.50}",
|
|
167
|
+
"disabledBorder": "{colors.neutral.200}"
|
|
168
|
+
},
|
|
169
|
+
"select": {
|
|
170
|
+
"bg": "{colors.white}",
|
|
171
|
+
"border": "{colors.neutral.300}",
|
|
172
|
+
"text": "{colors.neutral.900}",
|
|
173
|
+
"placeholderText": "{colors.neutral.500}",
|
|
174
|
+
"disabledBg": "{colors.neutral.50}",
|
|
175
|
+
"disabledBorder": "{colors.neutral.200}",
|
|
176
|
+
"focusBorder": "{colors.info.500}",
|
|
177
|
+
"borderInvalid": "{colors.error.500}",
|
|
178
|
+
"bgInvalid": "{colors.error.50}",
|
|
179
|
+
"borderSuccess": "{colors.success.500}",
|
|
180
|
+
"bgSuccess": "{colors.success.50}"
|
|
181
|
+
},
|
|
182
|
+
"textarea": {
|
|
183
|
+
"bg": "{colors.white}",
|
|
184
|
+
"border": "{colors.neutral.300}",
|
|
185
|
+
"text": "{colors.neutral.900}",
|
|
186
|
+
"placeholder": "{colors.neutral.500}",
|
|
187
|
+
"disabledBg": "{colors.neutral.50}",
|
|
188
|
+
"disabledBorder": "{colors.neutral.200}",
|
|
189
|
+
"focusBorder": "{colors.info.500}",
|
|
190
|
+
"borderInvalid": "{colors.error.500}",
|
|
191
|
+
"bgInvalid": "{colors.error.50}",
|
|
192
|
+
"borderSuccess": "{colors.success.500}",
|
|
193
|
+
"bgSuccess": "{colors.success.50}"
|
|
194
|
+
},
|
|
195
|
+
"fieldset": {
|
|
196
|
+
"border": "{colors.neutral.200}",
|
|
197
|
+
"legendText": "{colors.neutral.900}"
|
|
198
|
+
},
|
|
199
|
+
"label": {
|
|
200
|
+
"text": "{colors.neutral.900}",
|
|
201
|
+
"disabledText": "{colors.neutral.400}",
|
|
202
|
+
"requiredIndicatorText": "{colors.error.600}"
|
|
150
203
|
}
|
|
151
204
|
},
|
|
152
205
|
"buttons": {
|
|
@@ -401,6 +454,51 @@ var coreTokens = {
|
|
|
401
454
|
"active": "{colors.info.50}",
|
|
402
455
|
"text": "{colors.neutral.900}"
|
|
403
456
|
}
|
|
457
|
+
},
|
|
458
|
+
"checkbox": {
|
|
459
|
+
"bg": "{colors.white}",
|
|
460
|
+
"border": "{colors.neutral.300}",
|
|
461
|
+
"checkedBg": "{colors.info.600}",
|
|
462
|
+
"checkedBorder": "{colors.info.600}",
|
|
463
|
+
"text": "{colors.white}",
|
|
464
|
+
"disabledBg": "{colors.neutral.50}",
|
|
465
|
+
"disabledBorder": "{colors.neutral.200}"
|
|
466
|
+
},
|
|
467
|
+
"radio": {
|
|
468
|
+
"bg": "{colors.white}",
|
|
469
|
+
"border": "{colors.neutral.300}",
|
|
470
|
+
"checkedBg": "{colors.info.600}",
|
|
471
|
+
"checkedBorder": "{colors.info.600}",
|
|
472
|
+
"text": "{colors.white}",
|
|
473
|
+
"disabledBg": "{colors.neutral.50}",
|
|
474
|
+
"disabledBorder": "{colors.neutral.200}"
|
|
475
|
+
},
|
|
476
|
+
"select": {
|
|
477
|
+
"bg": "{colors.white}",
|
|
478
|
+
"border": "{colors.neutral.300}",
|
|
479
|
+
"text": "{colors.neutral.900}",
|
|
480
|
+
"placeholderText": "{colors.neutral.500}",
|
|
481
|
+
"disabledBg": "{colors.neutral.50}",
|
|
482
|
+
"disabledBorder": "{colors.neutral.200}",
|
|
483
|
+
"focusBorder": "{colors.info.500}"
|
|
484
|
+
},
|
|
485
|
+
"textarea": {
|
|
486
|
+
"bg": "{colors.white}",
|
|
487
|
+
"border": "{colors.neutral.300}",
|
|
488
|
+
"text": "{colors.neutral.900}",
|
|
489
|
+
"placeholder": "{colors.neutral.500}",
|
|
490
|
+
"disabledBg": "{colors.neutral.50}",
|
|
491
|
+
"disabledBorder": "{colors.neutral.200}",
|
|
492
|
+
"focusBorder": "{colors.info.500}"
|
|
493
|
+
},
|
|
494
|
+
"fieldset": {
|
|
495
|
+
"border": "{colors.neutral.200}",
|
|
496
|
+
"legendText": "{colors.neutral.900}"
|
|
497
|
+
},
|
|
498
|
+
"label": {
|
|
499
|
+
"text": "{colors.neutral.900}",
|
|
500
|
+
"disabledText": "{colors.neutral.400}",
|
|
501
|
+
"requiredIndicatorText": "{colors.error.600}"
|
|
404
502
|
}
|
|
405
503
|
}
|
|
406
504
|
},
|
|
@@ -550,6 +648,51 @@ var coreTokens = {
|
|
|
550
648
|
"active": "{colors.info.900}",
|
|
551
649
|
"text": "{colors.neutral.100}"
|
|
552
650
|
}
|
|
651
|
+
},
|
|
652
|
+
"checkbox": {
|
|
653
|
+
"bg": "{colors.neutral.800}",
|
|
654
|
+
"border": "{colors.neutral.600}",
|
|
655
|
+
"checkedBg": "{colors.info.600}",
|
|
656
|
+
"checkedBorder": "{colors.info.600}",
|
|
657
|
+
"text": "{colors.white}",
|
|
658
|
+
"disabledBg": "{colors.neutral.900}",
|
|
659
|
+
"disabledBorder": "{colors.neutral.700}"
|
|
660
|
+
},
|
|
661
|
+
"radio": {
|
|
662
|
+
"bg": "{colors.neutral.800}",
|
|
663
|
+
"border": "{colors.neutral.600}",
|
|
664
|
+
"checkedBg": "{colors.info.600}",
|
|
665
|
+
"checkedBorder": "{colors.info.600}",
|
|
666
|
+
"text": "{colors.white}",
|
|
667
|
+
"disabledBg": "{colors.neutral.900}",
|
|
668
|
+
"disabledBorder": "{colors.neutral.700}"
|
|
669
|
+
},
|
|
670
|
+
"select": {
|
|
671
|
+
"bg": "{colors.neutral.800}",
|
|
672
|
+
"border": "{colors.neutral.600}",
|
|
673
|
+
"text": "{colors.neutral.50}",
|
|
674
|
+
"placeholderText": "{colors.neutral.400}",
|
|
675
|
+
"disabledBg": "{colors.neutral.900}",
|
|
676
|
+
"disabledBorder": "{colors.neutral.700}",
|
|
677
|
+
"focusBorder": "{colors.info.400}"
|
|
678
|
+
},
|
|
679
|
+
"textarea": {
|
|
680
|
+
"bg": "{colors.neutral.800}",
|
|
681
|
+
"border": "{colors.neutral.600}",
|
|
682
|
+
"text": "{colors.neutral.50}",
|
|
683
|
+
"placeholder": "{colors.neutral.400}",
|
|
684
|
+
"disabledBg": "{colors.neutral.900}",
|
|
685
|
+
"disabledBorder": "{colors.neutral.700}",
|
|
686
|
+
"focusBorder": "{colors.info.400}"
|
|
687
|
+
},
|
|
688
|
+
"fieldset": {
|
|
689
|
+
"border": "{colors.neutral.700}",
|
|
690
|
+
"legendText": "{colors.neutral.50}"
|
|
691
|
+
},
|
|
692
|
+
"label": {
|
|
693
|
+
"text": "{colors.neutral.50}",
|
|
694
|
+
"disabledText": "{colors.neutral.600}",
|
|
695
|
+
"requiredIndicatorText": "{colors.error.400}"
|
|
553
696
|
}
|
|
554
697
|
}
|
|
555
698
|
}
|
|
@@ -1128,6 +1271,42 @@ var DROPDOWN_FIELDS = [
|
|
|
1128
1271
|
{ name: "item-active", modePath: ["item", "active"], aliasPath: ["item", "active"] },
|
|
1129
1272
|
{ name: "item-text", modePath: ["item", "text"], aliasPath: ["item", "text"] }
|
|
1130
1273
|
];
|
|
1274
|
+
var SELECTION_CONTROL_FIELDS = [
|
|
1275
|
+
{ name: "bg", tokenKey: "bg" },
|
|
1276
|
+
{ name: "border", tokenKey: "border" },
|
|
1277
|
+
{ name: "checked-bg", tokenKey: "checkedBg" },
|
|
1278
|
+
{ name: "checked-border", tokenKey: "checkedBorder" },
|
|
1279
|
+
{ name: "text", tokenKey: "text" },
|
|
1280
|
+
{ name: "disabled-bg", tokenKey: "disabledBg" },
|
|
1281
|
+
{ name: "disabled-border", tokenKey: "disabledBorder" }
|
|
1282
|
+
];
|
|
1283
|
+
var SELECT_FIELDS = [
|
|
1284
|
+
{ name: "bg", tokenKey: "bg" },
|
|
1285
|
+
{ name: "border", tokenKey: "border" },
|
|
1286
|
+
{ name: "text", tokenKey: "text" },
|
|
1287
|
+
{ name: "placeholder-text", tokenKey: "placeholderText" },
|
|
1288
|
+
{ name: "disabled-bg", tokenKey: "disabledBg" },
|
|
1289
|
+
{ name: "disabled-border", tokenKey: "disabledBorder" },
|
|
1290
|
+
{ name: "focus-border", tokenKey: "focusBorder" }
|
|
1291
|
+
];
|
|
1292
|
+
var TEXTAREA_FIELDS = [
|
|
1293
|
+
{ name: "bg", tokenKey: "bg" },
|
|
1294
|
+
{ name: "border", tokenKey: "border" },
|
|
1295
|
+
{ name: "text", tokenKey: "text" },
|
|
1296
|
+
{ name: "placeholder", tokenKey: "placeholder" },
|
|
1297
|
+
{ name: "disabled-bg", tokenKey: "disabledBg" },
|
|
1298
|
+
{ name: "disabled-border", tokenKey: "disabledBorder" },
|
|
1299
|
+
{ name: "focus-border", tokenKey: "focusBorder" }
|
|
1300
|
+
];
|
|
1301
|
+
var FIELDSET_FIELDS = [
|
|
1302
|
+
{ name: "border", tokenKey: "border" },
|
|
1303
|
+
{ name: "legend-text", tokenKey: "legendText" }
|
|
1304
|
+
];
|
|
1305
|
+
var LABEL_FIELDS = [
|
|
1306
|
+
{ name: "text", tokenKey: "text" },
|
|
1307
|
+
{ name: "disabled-text", tokenKey: "disabledText" },
|
|
1308
|
+
{ name: "required-indicator-text", tokenKey: "requiredIndicatorText" }
|
|
1309
|
+
];
|
|
1131
1310
|
var resolveTokenReference = (tokens2, reference) => {
|
|
1132
1311
|
const path = reference.slice(1, -1).split(".");
|
|
1133
1312
|
let current = tokens2;
|
|
@@ -1410,6 +1589,42 @@ var generateCssVariables = (tokens2, options = {}) => {
|
|
|
1410
1589
|
modePath: ["component", "dropdown", ...modePath],
|
|
1411
1590
|
aliasSrc: componentAliases,
|
|
1412
1591
|
aliasPath: ["dropdown", ...aliasPath]
|
|
1592
|
+
})),
|
|
1593
|
+
...SELECTION_CONTROL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1594
|
+
varParts: ["checkbox", name],
|
|
1595
|
+
modePath: ["component", "checkbox", tokenKey],
|
|
1596
|
+
aliasSrc: componentAliases,
|
|
1597
|
+
aliasPath: ["checkbox", tokenKey]
|
|
1598
|
+
})),
|
|
1599
|
+
...SELECTION_CONTROL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1600
|
+
varParts: ["radio", name],
|
|
1601
|
+
modePath: ["component", "radio", tokenKey],
|
|
1602
|
+
aliasSrc: componentAliases,
|
|
1603
|
+
aliasPath: ["radio", tokenKey]
|
|
1604
|
+
})),
|
|
1605
|
+
...SELECT_FIELDS.map(({ name, tokenKey }) => ({
|
|
1606
|
+
varParts: ["select", name],
|
|
1607
|
+
modePath: ["component", "select", tokenKey],
|
|
1608
|
+
aliasSrc: componentAliases,
|
|
1609
|
+
aliasPath: ["select", tokenKey]
|
|
1610
|
+
})),
|
|
1611
|
+
...TEXTAREA_FIELDS.map(({ name, tokenKey }) => ({
|
|
1612
|
+
varParts: ["textarea", name],
|
|
1613
|
+
modePath: ["component", "textarea", tokenKey],
|
|
1614
|
+
aliasSrc: componentAliases,
|
|
1615
|
+
aliasPath: ["textarea", tokenKey]
|
|
1616
|
+
})),
|
|
1617
|
+
...FIELDSET_FIELDS.map(({ name, tokenKey }) => ({
|
|
1618
|
+
varParts: ["fieldset", name],
|
|
1619
|
+
modePath: ["component", "fieldset", tokenKey],
|
|
1620
|
+
aliasSrc: componentAliases,
|
|
1621
|
+
aliasPath: ["fieldset", tokenKey]
|
|
1622
|
+
})),
|
|
1623
|
+
...LABEL_FIELDS.map(({ name, tokenKey }) => ({
|
|
1624
|
+
varParts: ["label", name],
|
|
1625
|
+
modePath: ["component", "label", tokenKey],
|
|
1626
|
+
aliasSrc: componentAliases,
|
|
1627
|
+
aliasPath: ["label", tokenKey]
|
|
1413
1628
|
}))
|
|
1414
1629
|
];
|
|
1415
1630
|
const baseLines = [];
|