@designtools/tokens 0.11.0 → 0.11.1
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/CHANGELOG.md +6 -0
- package/dist/{chunk-RQGC7LES.js → chunk-2UR5FIHQ.js} +3 -2
- package/dist/cli.js +7 -5
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to `@designtools/tokens`. Dates are release dates; versions follow semver, with breaking changes in the minor slot while the package is pre-1.0.
|
|
4
4
|
|
|
5
|
+
## 0.11.1
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- 7074755: `--merge` lists only the tokens the merged file is missing. Refreshing grounds into a full file (`--only grounds --merge`) printed about 50 tokens as "defined elsewhere", every one of them already in the file, which read as a failure when nothing was wrong. After a merge, the slice's references are now checked against the merged file, and the warning names the file: `slice references 1 token that tokens.css does not define`. `externalReferences(css, against?)` takes the target's CSS as an optional second argument to do the same in code. A slice written to stdout or `--out` without `--merge` still lists everything it leans on, since there is no target to check against.
|
|
10
|
+
|
|
5
11
|
## 0.11.0
|
|
6
12
|
|
|
7
13
|
### Minor Changes
|
|
@@ -2187,9 +2187,10 @@ var SECTIONED_FORMATS = ["css", "tailwind-v4"];
|
|
|
2187
2187
|
function tokenFamilies(tokens) {
|
|
2188
2188
|
return Object.entries(tokens.primitives).filter(([, scale]) => typeof scale !== "string").map(([name]) => name);
|
|
2189
2189
|
}
|
|
2190
|
-
function externalReferences(css) {
|
|
2190
|
+
function externalReferences(css, against) {
|
|
2191
2191
|
const defined = /* @__PURE__ */ new Set();
|
|
2192
|
-
for (const line of css
|
|
2192
|
+
for (const line of `${css}
|
|
2193
|
+
${against ?? ""}`.split("\n")) {
|
|
2193
2194
|
const m = /^\s*(--[a-z0-9-]+)\s*:/i.exec(line);
|
|
2194
2195
|
if (m) defined.add(m[1]);
|
|
2195
2196
|
}
|
package/dist/cli.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
tokenFamilies,
|
|
37
37
|
usageReport,
|
|
38
38
|
withJsonProvenance
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-2UR5FIHQ.js";
|
|
40
40
|
|
|
41
41
|
// src/cli.ts
|
|
42
42
|
import { parseArgs } from "util";
|
|
@@ -937,11 +937,13 @@ step contract (does a step mean the same in every colour?)
|
|
|
937
937
|
}
|
|
938
938
|
var formats = format === "all" ? Object.keys(FILE_NAMES) : [format];
|
|
939
939
|
var isSlice = families.length > 0 || sections.length > 0;
|
|
940
|
-
function reportExternalReferences(css) {
|
|
941
|
-
const external = externalReferences(css);
|
|
940
|
+
function reportExternalReferences(css, merged) {
|
|
941
|
+
const external = externalReferences(css, merged?.css);
|
|
942
942
|
if (external.length === 0) return;
|
|
943
|
+
const count = `${external.length} token${external.length === 1 ? "" : "s"}`;
|
|
943
944
|
process.stderr.write(
|
|
944
|
-
`slice references ${
|
|
945
|
+
merged ? `slice references ${count} that ${merged.target} does not define:
|
|
946
|
+
` : `slice references ${count} defined elsewhere:
|
|
945
947
|
`
|
|
946
948
|
);
|
|
947
949
|
for (const name of external) process.stderr.write(` ${name}
|
|
@@ -1026,7 +1028,7 @@ if (values.check) {
|
|
|
1026
1028
|
`merged into ${target}: ${result.updated.length} updated, ${result.added.length} added, ${result.unchanged.length} already current
|
|
1027
1029
|
`
|
|
1028
1030
|
);
|
|
1029
|
-
reportExternalReferences(slice);
|
|
1031
|
+
reportExternalReferences(slice, { target, css: result.css });
|
|
1030
1032
|
} else if (format === "all") {
|
|
1031
1033
|
const dir = values.out ?? ".";
|
|
1032
1034
|
mkdirSync(dir, { recursive: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -950,8 +950,11 @@ declare function tokenFamilies(tokens: TokenSystem): string[];
|
|
|
950
950
|
* A family-scoped slice is not self-contained — a foreground search can land on
|
|
951
951
|
* a neutral shade or on black — so a caller splicing one needs to know which
|
|
952
952
|
* tokens have to already exist in the target.
|
|
953
|
+
*
|
|
954
|
+
* Pass the file a slice was merged into as `against`, and its definitions count
|
|
955
|
+
* too: only what the merged file still lacks is reported.
|
|
953
956
|
*/
|
|
954
|
-
declare function externalReferences(css: string): string[];
|
|
957
|
+
declare function externalReferences(css: string, against?: string): string[];
|
|
955
958
|
/**
|
|
956
959
|
* Narrow a TokenSystem to the requested sections, for the `json` output.
|
|
957
960
|
*
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designtools/tokens",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Turn one brand colour into a complete design-token system: perceptual OKLCH ramps, contrast-checked semantic tokens (WCAG or APCA), light and dark, as CSS custom properties, Tailwind v4/v3 or DTCG. Deterministic CLI, safe for agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|