@polyxd/ds-kit 0.1.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/LICENSE +202 -0
- package/NOTICE +177 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +216 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +274 -0
- package/dist/index.js.map +1 -0
- package/dist/infer.d.ts +27 -0
- package/dist/infer.js +201 -0
- package/dist/infer.js.map +1 -0
- package/dist/polyxd.d.ts +2 -0
- package/dist/polyxd.js +45 -0
- package/dist/polyxd.js.map +1 -0
- package/package.json +52 -0
package/dist/polyxd.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The `polyxd` command.
|
|
4
|
+
*
|
|
5
|
+
* polyxd pack ./tokens.css make a design-system pack out of your own tokens
|
|
6
|
+
* polyxd check ./manifest.json check a pack against the semantic token contract
|
|
7
|
+
*
|
|
8
|
+
* Two commands, because those are the two things a team does before anything else works: point
|
|
9
|
+
* Polyxd at their design system, and find out what it still needs.
|
|
10
|
+
*/
|
|
11
|
+
const [command, ...rest] = process.argv.slice(2);
|
|
12
|
+
process.argv = [process.argv[0], process.argv[1], ...rest];
|
|
13
|
+
switch (command) {
|
|
14
|
+
case "pack":
|
|
15
|
+
await import("./cli.js");
|
|
16
|
+
break;
|
|
17
|
+
case "check": {
|
|
18
|
+
// Through @polyxd/spec's published API: a relative path into the monorepo exists in a
|
|
19
|
+
// checkout and nowhere else.
|
|
20
|
+
const { checkDesignSystem } = await import("@polyxd/spec");
|
|
21
|
+
const manifest = rest[0];
|
|
22
|
+
if (!manifest) {
|
|
23
|
+
console.log("usage: polyxd check <manifest.json>");
|
|
24
|
+
process.exit(2);
|
|
25
|
+
}
|
|
26
|
+
const issues = await checkDesignSystem(manifest);
|
|
27
|
+
for (const i of issues)
|
|
28
|
+
console.log(`${i.mode ? `[${i.mode}] ` : ""}${i.token}: ${i.message}`);
|
|
29
|
+
console.log(issues.length ? `\n${issues.length} issue(s)` : "Design system satisfies the semantic token contract.");
|
|
30
|
+
process.exit(issues.length ? 1 : 0);
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
console.log(`polyxd <command>
|
|
34
|
+
|
|
35
|
+
pack <tokens.css> [--dark <dark.css>] [--name <name>] [--out <dir>]
|
|
36
|
+
Reads your design system's variables and drafts a Polyxd pack, plus a mapping file
|
|
37
|
+
recording every guess. Correct it, run again; it prints what is still missing and why.
|
|
38
|
+
|
|
39
|
+
check <manifest.json>
|
|
40
|
+
Checks a pack against the semantic token contract: every token present and correctly
|
|
41
|
+
typed, every contrast pair measured, every constraint met.`);
|
|
42
|
+
process.exit(command ? 1 : 0);
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=polyxd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyxd.js","sourceRoot":"","sources":["../src/polyxd.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjD,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAE3D,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,MAAM;QACT,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QACzB,MAAM;IACR,KAAK,OAAO,EAAE,CAAC;QACb,sFAAsF;QACtF,6BAA6B;QAC7B,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACjD,KAAK,MAAM,CAAC,IAAI,MAAM;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC,CAAC,sDAAsD,CAAC,CAAC;QACpH,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IACD;QACE,OAAO,CAAC,GAAG,CAAC;;;;;;;;iEAQiD,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@polyxd/ds-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared parts of building a Polyxd design-system pack: CSS variable reading, DTCG conversion, manifest writing",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./infer": {
|
|
13
|
+
"types": "./dist/infer.d.ts",
|
|
14
|
+
"default": "./dist/infer.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
"./polyxd": {
|
|
18
|
+
"types": "./dist/polyxd.d.ts",
|
|
19
|
+
"default": "./dist/polyxd.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@polyxd/spec": "^0.1.0"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"polyxd": "dist/polyxd.js"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"pack": "node src/cli.ts",
|
|
30
|
+
"test": "node --test \"test/*.test.ts\"",
|
|
31
|
+
"build": "tsc -b"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"NOTICE"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@polyxd/spec": "^0.1.0"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/visualfart/polyxd.git",
|
|
45
|
+
"directory": "packages/ds-kit"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://polyxd.com",
|
|
48
|
+
"bugs": "https://github.com/visualfart/polyxd/issues",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
}
|
|
52
|
+
}
|