@texturehq/edges 1.0.2 → 1.1.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/dist/components.manifest.json +320 -23
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1229 -10
- package/dist/index.d.ts +1229 -10
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{server-DmvMh5XJ.d.cts → server-DkP8PI1p.d.cts} +106 -148
- package/dist/{server-DmvMh5XJ.d.ts → server-DkP8PI1p.d.ts} +106 -148
- package/dist/server.cjs +11 -12
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +11 -12
- package/dist/server.js.map +1 -1
- package/dist/styles/utilities.css +10 -7
- package/dist/styles.css +1208 -96
- package/package.json +3 -1
- package/scripts/copy-assets.js +9 -2
- package/scripts/generate-components-manifest.js +19 -8
- package/scripts/setup-cursor-rules-manual.js +66 -57
- package/scripts/setup-cursor-rules.js +103 -89
- package/scripts/validate-tokens.js +46 -48
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
* https://tr.designtokens.org/format/
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { readdirSync, readFileSync, statSync } from "fs";
|
|
9
|
+
import { extname, join } from "path";
|
|
10
10
|
|
|
11
|
-
const TOKENS_DIR =
|
|
12
|
-
const
|
|
11
|
+
const TOKENS_DIR = "./tokens";
|
|
12
|
+
const _REQUIRED_SCHEMA = "https://tr.designtokens.org/format/0.1/";
|
|
13
13
|
|
|
14
14
|
// DTCG spec required properties for different token types
|
|
15
15
|
const TOKEN_TYPE_REQUIREMENTS = {
|
|
16
|
-
color: [
|
|
17
|
-
dimension: [
|
|
18
|
-
fontFamily: [
|
|
19
|
-
fontWeight: [
|
|
20
|
-
duration: [
|
|
21
|
-
number: [
|
|
16
|
+
color: ["$value"],
|
|
17
|
+
dimension: ["$value"],
|
|
18
|
+
fontFamily: ["$value"],
|
|
19
|
+
fontWeight: ["$value"],
|
|
20
|
+
duration: ["$value"],
|
|
21
|
+
number: ["$value"],
|
|
22
22
|
// Add more as needed
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// Valid top-level properties
|
|
26
|
-
const
|
|
26
|
+
const _VALID_TOP_LEVEL = ["$schema", "$name", "$description", "$type", "$value", "$extensions"];
|
|
27
27
|
|
|
28
28
|
// Validation results
|
|
29
29
|
const errors = [];
|
|
@@ -36,18 +36,18 @@ const successes = [];
|
|
|
36
36
|
function getTokenFiles(dir) {
|
|
37
37
|
const files = [];
|
|
38
38
|
const items = readdirSync(dir);
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
for (const item of items) {
|
|
41
41
|
const path = join(dir, item);
|
|
42
42
|
const stat = statSync(path);
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
if (stat.isDirectory()) {
|
|
45
45
|
files.push(...getTokenFiles(path));
|
|
46
|
-
} else if (extname(path) ===
|
|
46
|
+
} else if (extname(path) === ".json") {
|
|
47
47
|
files.push(path);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
return files;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -56,13 +56,13 @@ function getTokenFiles(dir) {
|
|
|
56
56
|
*/
|
|
57
57
|
function validateToken(token, path, parentType = null) {
|
|
58
58
|
const type = token.$type || parentType;
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
// Check for $value
|
|
61
61
|
if (!token.$value && !hasNestedTokens(token)) {
|
|
62
62
|
errors.push(`${path}: Token missing $value property`);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
// If has $value, validate based on type
|
|
67
67
|
if (token.$value && type) {
|
|
68
68
|
const requirements = TOKEN_TYPE_REQUIREMENTS[type];
|
|
@@ -74,15 +74,15 @@ function validateToken(token, path, parentType = null) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
// Check for $description (recommended but not required)
|
|
79
79
|
if (!token.$description && token.$value) {
|
|
80
80
|
warnings.push(`${path}: Token missing $description (recommended)`);
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
// Validate nested tokens
|
|
84
84
|
for (const key in token) {
|
|
85
|
-
if (!key.startsWith(
|
|
85
|
+
if (!key.startsWith("$") && typeof token[key] === "object") {
|
|
86
86
|
validateToken(token[key], `${path}.${key}`, type);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -93,7 +93,7 @@ function validateToken(token, path, parentType = null) {
|
|
|
93
93
|
*/
|
|
94
94
|
function hasNestedTokens(obj) {
|
|
95
95
|
for (const key in obj) {
|
|
96
|
-
if (!key.startsWith(
|
|
96
|
+
if (!key.startsWith("$") && typeof obj[key] === "object") {
|
|
97
97
|
return true;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -105,32 +105,31 @@ function hasNestedTokens(obj) {
|
|
|
105
105
|
*/
|
|
106
106
|
function validateFile(filepath) {
|
|
107
107
|
console.log(`\nValidating: ${filepath}`);
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
try {
|
|
110
|
-
const content = readFileSync(filepath,
|
|
110
|
+
const content = readFileSync(filepath, "utf8");
|
|
111
111
|
const tokens = JSON.parse(content);
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
// Check for $schema
|
|
114
114
|
if (!tokens.$schema) {
|
|
115
115
|
warnings.push(`${filepath}: Missing $schema declaration`);
|
|
116
|
-
} else if (!tokens.$schema.includes(
|
|
116
|
+
} else if (!tokens.$schema.includes("designtokens.org")) {
|
|
117
117
|
warnings.push(`${filepath}: Non-standard schema: ${tokens.$schema}`);
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
// Check for $name
|
|
121
121
|
if (!tokens.$name) {
|
|
122
122
|
warnings.push(`${filepath}: Missing $name property (recommended)`);
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
// Validate all tokens
|
|
126
126
|
for (const key in tokens) {
|
|
127
|
-
if (!key.startsWith(
|
|
127
|
+
if (!key.startsWith("$") && typeof tokens[key] === "object") {
|
|
128
128
|
validateToken(tokens[key], `${filepath}:${key}`, tokens.$type);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
successes.push(`${filepath}: Valid DTCG token file`);
|
|
133
|
-
|
|
134
133
|
} catch (error) {
|
|
135
134
|
errors.push(`${filepath}: ${error.message}`);
|
|
136
135
|
}
|
|
@@ -140,39 +139,38 @@ function validateFile(filepath) {
|
|
|
140
139
|
* Main validation
|
|
141
140
|
*/
|
|
142
141
|
function main() {
|
|
143
|
-
console.log(
|
|
144
|
-
console.log(
|
|
145
|
-
|
|
142
|
+
console.log("🔍 DTCG Token Validation\n");
|
|
143
|
+
console.log("==========================");
|
|
144
|
+
|
|
146
145
|
const files = getTokenFiles(TOKENS_DIR);
|
|
147
146
|
console.log(`Found ${files.length} token files\n`);
|
|
148
|
-
|
|
147
|
+
|
|
149
148
|
for (const file of files) {
|
|
150
149
|
validateFile(file);
|
|
151
150
|
}
|
|
152
|
-
|
|
151
|
+
|
|
153
152
|
// Report results
|
|
154
|
-
console.log(
|
|
155
|
-
console.log(
|
|
156
|
-
|
|
153
|
+
console.log("\n==========================");
|
|
154
|
+
console.log("📊 Validation Results\n");
|
|
155
|
+
|
|
157
156
|
if (successes.length > 0) {
|
|
158
|
-
console.log(
|
|
159
|
-
successes.forEach(s => console.log(` ${s}`));
|
|
157
|
+
console.log("✅ Valid Files:");
|
|
158
|
+
successes.forEach((s) => console.log(` ${s}`));
|
|
160
159
|
}
|
|
161
|
-
|
|
160
|
+
|
|
162
161
|
if (warnings.length > 0) {
|
|
163
|
-
console.log(
|
|
164
|
-
warnings.forEach(w => console.log(` ${w}`));
|
|
162
|
+
console.log("\n⚠️ Warnings:");
|
|
163
|
+
warnings.forEach((w) => console.log(` ${w}`));
|
|
165
164
|
}
|
|
166
|
-
|
|
165
|
+
|
|
167
166
|
if (errors.length > 0) {
|
|
168
|
-
console.log(
|
|
169
|
-
errors.forEach(e => console.log(` ${e}`));
|
|
167
|
+
console.log("\n❌ Errors:");
|
|
168
|
+
errors.forEach((e) => console.log(` ${e}`));
|
|
170
169
|
process.exit(1);
|
|
171
170
|
} else {
|
|
172
|
-
console.log(
|
|
171
|
+
console.log("\n✨ All tokens are DTCG compliant!");
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
|
|
176
175
|
// Run validation
|
|
177
176
|
main();
|
|
178
|
-
|