@servicetitan/hammer-token 0.0.0-rc-1.47.0-20251104205759 → 0.0.0-rc-3.0.0-20260114215531

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/README.md +222 -0
  3. package/build/web/core/component-variables.scss +114 -130
  4. package/build/web/core/component.d.ts +65 -0
  5. package/build/web/core/component.js +248 -267
  6. package/build/web/core/component.scss +63 -69
  7. package/build/web/core/css-utils/a2-border.css +39 -41
  8. package/build/web/core/css-utils/a2-color.css +351 -227
  9. package/build/web/core/css-utils/a2-font.css +0 -2
  10. package/build/web/core/css-utils/a2-spacing.css +0 -2
  11. package/build/web/core/css-utils/a2-utils.css +418 -292
  12. package/build/web/core/css-utils/border.css +39 -41
  13. package/build/web/core/css-utils/color.css +351 -227
  14. package/build/web/core/css-utils/font.css +0 -2
  15. package/build/web/core/css-utils/spacing.css +0 -2
  16. package/build/web/core/css-utils/utils.css +418 -292
  17. package/build/web/core/index.d.ts +6 -0
  18. package/build/web/core/index.js +1 -1
  19. package/build/web/core/primitive-variables.scss +130 -71
  20. package/build/web/core/primitive.d.ts +185 -0
  21. package/build/web/core/primitive.js +328 -72
  22. package/build/web/core/primitive.scss +183 -124
  23. package/build/web/core/semantic-variables.scss +287 -220
  24. package/build/web/core/semantic.d.ts +194 -0
  25. package/build/web/core/semantic.js +875 -347
  26. package/build/web/core/semantic.scss +192 -140
  27. package/build/web/index.d.ts +3 -4
  28. package/build/web/index.js +0 -1
  29. package/build/web/types.d.ts +17 -0
  30. package/config.js +121 -496
  31. package/package.json +5 -4
  32. package/src/global/primitive/breakpoint.tokens.json +39 -0
  33. package/src/global/primitive/color.tokens.json +536 -0
  34. package/src/global/primitive/duration.tokens.json +32 -0
  35. package/src/global/primitive/font.tokens.json +103 -0
  36. package/src/global/primitive/radius.tokens.json +67 -0
  37. package/src/global/primitive/size.tokens.json +123 -0
  38. package/src/global/primitive/transition.tokens.json +20 -0
  39. package/src/theme/core/background.tokens.json +981 -0
  40. package/src/theme/core/border.tokens.json +148 -0
  41. package/src/theme/core/charts.tokens.json +802 -0
  42. package/src/theme/core/component/button.tokens.json +752 -0
  43. package/src/theme/core/component/checkbox.tokens.json +292 -0
  44. package/src/theme/core/focus.tokens.json +48 -0
  45. package/src/theme/core/foreground.tokens.json +288 -0
  46. package/src/theme/core/shadow.tokens.json +43 -0
  47. package/src/theme/core/status.tokens.json +70 -0
  48. package/src/theme/core/typography.tokens.json +100 -0
  49. package/src/utils/copy-css-utils-cli.js +13 -0
  50. package/src/utils/css-utils-format-utils.js +98 -1
  51. package/src/utils/sd-build-configs.js +372 -0
  52. package/src/utils/sd-formats.js +752 -0
  53. package/src/utils/sd-transforms.js +126 -0
  54. package/src/utils/token-helpers.js +555 -0
  55. package/tsconfig.json +18 -0
  56. package/.turbo/turbo-build.log +0 -37
  57. package/build/web/core/raw.js +0 -234
  58. package/src/global/primitive/breakpoint.js +0 -19
  59. package/src/global/primitive/color.js +0 -231
  60. package/src/global/primitive/duration.js +0 -16
  61. package/src/global/primitive/font.js +0 -60
  62. package/src/global/primitive/radius.js +0 -31
  63. package/src/global/primitive/size.js +0 -55
  64. package/src/global/primitive/transition.js +0 -16
  65. package/src/theme/core/background.js +0 -170
  66. package/src/theme/core/border.js +0 -103
  67. package/src/theme/core/charts.js +0 -464
  68. package/src/theme/core/component/button.js +0 -708
  69. package/src/theme/core/component/checkbox.js +0 -405
  70. package/src/theme/core/focus.js +0 -35
  71. package/src/theme/core/foreground.js +0 -148
  72. package/src/theme/core/overlay.js +0 -137
  73. package/src/theme/core/shadow.js +0 -29
  74. package/src/theme/core/status.js +0 -49
  75. package/src/theme/core/typography.js +0 -82
  76. package/type/types.ts +0 -344
package/config.js CHANGED
@@ -1,504 +1,129 @@
1
1
  /* eslint-disable @typescript-eslint/no-require-imports */
2
- const StyleDictionary = require("style-dictionary");
3
2
  const fs = require("fs-extra");
4
- const {
5
- cssUtilsFormatter,
6
- getVarValue,
7
- generateBorderClasses,
8
- generateColorClasses,
9
- generateFontClasses,
10
- generateSpacingClasses,
11
- } = require("./src/utils/css-utils-format-utils");
12
-
13
- StyleDictionary.registerFormat({
14
- name: `custom/SCSSVariable`,
15
- formatter: function ({ dictionary }) {
16
- return dictionary.allTokens
17
- .map((token) => {
18
- const value = token.value;
19
- const name = `${token.name.replace("-default", "")}`;
20
- if (token.name.includes("font-family"))
21
- return `$${name}: var(--${name}, ${value});`;
22
- if (token.attributes.appearance) {
23
- return `$${name}: var(--${name}, ${value});`;
24
- }
25
- return `$${name}: ${value};`;
26
- })
27
- .join(`\n`);
28
- },
29
- });
30
-
31
- const nonColorTokens = [
32
- "border-radius",
33
- "font-family",
34
- "font-weight",
35
- "size",
36
- "width",
37
- ];
38
-
39
- StyleDictionary.registerFormat({
40
- name: `custom/variables-map`,
41
- formatter: function ({ dictionary }) {
42
- const light = dictionary.allTokens
43
- .filter((token) => {
44
- let isColor = true;
45
- nonColorTokens.forEach((t) => {
46
- if (token.name.includes(t)) {
47
- isColor = false;
48
- }
49
- });
50
- return isColor;
51
- })
52
- .map((token) => {
53
- const value = token.value;
54
- const name = `${token.name.replace("-default", "")}`;
55
- return ` ${name}: ${value},`;
56
- })
57
- .join(`\n`);
58
-
59
- const dark = dictionary.allTokens
60
- .filter((token) => {
61
- let isColor = true;
62
- nonColorTokens.forEach((t) => {
63
- if (token.name.includes(t)) {
64
- isColor = false;
65
- }
66
- });
67
- return isColor;
68
- })
69
- .map((token) => {
70
- const value = token.value;
71
- const name = `${token.name.replace("-default", "")}`;
72
- if (token.attributes.appearance) {
73
- return ` ${name}: ${token.attributes.appearance.dark.value},`;
74
- }
75
- return ` ${name}: ${value},`;
76
- })
77
- .join(`\n`);
3
+ const path = require("path");
4
+ const { registerTransforms } = require("./src/utils/sd-transforms");
5
+ const { registerFormats } = require("./src/utils/sd-formats");
78
6
 
79
- const nonColor = dictionary.allTokens
80
- .filter((token) => {
81
- let isColor = true;
82
- nonColorTokens.forEach((t) => {
83
- if (token.name.includes(t)) {
84
- isColor = false;
85
- }
86
- });
87
- return !isColor;
88
- })
89
- .map((token) => {
90
- const value = token.value;
91
- const name = `${token.name.replace("-default", "")}`;
92
- if (token.name.includes("font-family")) return ` ${name}: "${value}",`;
93
- return ` ${name}: ${value},`;
94
- })
95
- .join(`\n`);
96
-
97
- return [
98
- `$light: (`,
99
- light,
100
- `);`,
101
- `$dark: (`,
102
- dark,
103
- `);`,
104
- `$nonColor: (`,
105
- nonColor,
106
- `);`,
107
- ].join(`\n`);
108
- },
109
- });
110
-
111
- StyleDictionary.registerFormat({
112
- name: `custom/primitive-variables`,
113
- formatter: function ({ dictionary }) {
114
- const vars = dictionary.allTokens
115
- .map((token) => {
116
- const value = token.value;
117
- const name = `${token.name.replace("-default", "")}`;
118
- if (token.name.includes("font-family")) return ` ${name}: "${value}",`;
119
- return ` ${name}: ${value},`;
120
- })
121
- .join(`\n`);
122
-
123
- return [`$token: (`, vars, `);`].join(`\n`);
124
- },
125
- });
126
-
127
- StyleDictionary.registerFormat({
128
- name: `custom/es6`,
129
- formatter: function ({ dictionary }) {
130
- const light = dictionary.allTokens
131
- .filter((token) => !!token.attributes.appearance)
132
- .map((token) => {
133
- const value = JSON.stringify(token.value);
134
- const name = token.name.replace("Default", "");
135
- return `\t${name}: ${value}`;
136
- })
137
- .join(`,\n`);
138
- const dark = dictionary.allTokens
139
- .filter((token) => !!token.attributes.appearance)
140
- .map((token) => {
141
- const value = JSON.stringify(token.attributes.appearance.dark.value);
142
- const name = token.name.replace("Default", "");
143
- return `\t${name}: ${value}`;
144
- })
145
- .join(`,\n`);
146
- const common = dictionary.allTokens
147
- .filter((token) => !token.attributes.appearance)
148
- .map((token) => {
149
- const value = JSON.stringify(token.value);
150
- const name = token.name.replace("Default", "");
151
- return `\t${name}: ${value}`;
152
- })
153
- .join(`,\n`);
154
- return `export const common = {\n${common}\n}\nexport const light = {\n${light}\n}\nexport const dark = {\n${dark}\n}\n`;
155
- },
156
- });
157
-
158
- StyleDictionary.registerFormat({
159
- name: `custom/es6Variable`,
160
- formatter: function ({ dictionary }) {
161
- return dictionary.allTokens
162
- .map((token) => {
163
- const value = token.value;
164
- const name = `${token.name.replace("Default", "")}`;
165
- if (token.attributes.appearance) {
166
- return `export const ${name} = {
167
- value: "${value}",
168
- attributes: {
169
- appearance: {
7
+ // Prefix for CSS variable names (e.g., --a2-border-radius-medium)
8
+ const CSS_VAR_PREFIX = "a2-";
9
+ const {
10
+ createPrimitiveConfig,
11
+ createThemeConfig,
12
+ createComponentConfig,
13
+ } = require("./src/utils/sd-build-configs");
14
+
15
+ // Use dynamic import for Style Dictionary v5 (ESM)
16
+ (async () => {
17
+ const StyleDictionary = (await import("style-dictionary")).default;
18
+ const { resolveReferences, usesReferences } =
19
+ await import("style-dictionary/utils");
20
+
21
+ // Register transforms and formats
22
+ registerTransforms(StyleDictionary);
23
+ registerFormats(
24
+ StyleDictionary,
25
+ usesReferences,
26
+ resolveReferences,
27
+ CSS_VAR_PREFIX,
28
+ );
29
+
30
+ // Build primitive tokens
31
+ const sdPrimitive = new StyleDictionary(createPrimitiveConfig());
32
+ await sdPrimitive.buildAllPlatforms();
33
+
34
+ // Build theme tokens (includes primitives, excludes components)
35
+ const sdTheme = new StyleDictionary(createThemeConfig());
36
+ await sdTheme.buildAllPlatforms();
37
+
38
+ // Build component tokens
39
+ const sdComponent = new StyleDictionary(createComponentConfig());
40
+ await sdComponent.buildAllPlatforms();
41
+
42
+ // Post-build: Generate index files
43
+ const buildWebPath = path.join(process.cwd(), "build/web");
44
+ const buildCorePath = path.join(buildWebPath, "core");
45
+ const indexJsPath = path.join(buildWebPath, "index.js");
46
+ const coreIndexJsPath = path.join(buildCorePath, "index.js");
47
+
48
+ const coreIndexJsContent = `import * as primitive from './primitive';
49
+ import * as semantic from './semantic';
50
+ import * as component from './component';
51
+ const name = 'core';
52
+ export { primitive, semantic, component, name };
53
+ `;
54
+
55
+ const indexJsContent = `import * as core from './core';
56
+ export { core };
57
+ `;
58
+
59
+ // Type definitions
60
+ const typesContent = `export type TokenObj = {
61
+ value: string;
62
+ extensions?: {
63
+ appearance?: {
170
64
  dark: {
171
- value: "${token.attributes.appearance.dark.value}"
172
- }
65
+ value: string;
66
+ };
67
+ };
68
+ };
69
+ };
70
+
71
+ export type Token = {
72
+ primitive: any;
73
+ semantic: any;
74
+ component: any;
75
+ name: string;
76
+ };
77
+ `;
78
+
79
+ const indexDtsContent = `export * from './types';
80
+ import * as core from './core';
81
+ export { core };
82
+ `;
83
+
84
+ const coreIndexDtsContent = `export * from '../types';
85
+ import * as primitive from './primitive';
86
+ import * as semantic from './semantic';
87
+ import * as component from './component';
88
+ export declare const name: string;
89
+ export { primitive, semantic, component };
90
+ `;
91
+
92
+ await fs.ensureDir(buildWebPath);
93
+ await fs.ensureDir(buildCorePath);
94
+
95
+ await fs.writeFile(coreIndexJsPath, coreIndexJsContent);
96
+ await fs.writeFile(indexJsPath, indexJsContent);
97
+
98
+ // Write type definition files
99
+ await fs.writeFile(path.join(buildWebPath, "types.d.ts"), typesContent);
100
+ await fs.writeFile(path.join(buildWebPath, "index.d.ts"), indexDtsContent);
101
+ await fs.writeFile(
102
+ path.join(buildCorePath, "index.d.ts"),
103
+ coreIndexDtsContent,
104
+ );
105
+
106
+ // Generate .d.ts for each token file based on their .js exports
107
+ const tokenFiles = ["primitive", "semantic", "component"];
108
+ for (const file of tokenFiles) {
109
+ const jsPath = path.join(buildCorePath, `${file}.js`);
110
+ const jsContent = await fs.readFile(jsPath, "utf8");
111
+
112
+ // Extract export names
113
+ const exportRegex = /export const (\w+) = \{/g;
114
+ const exports = [];
115
+ let match;
116
+ while ((match = exportRegex.exec(jsContent)) !== null) {
117
+ exports.push(match[1]);
173
118
  }
174
- }
175
- };`;
176
- }
177
- return `export const ${name} = { value: "${value}" };`;
178
- })
179
- .join(`\n`);
180
- },
181
- });
182
-
183
- const CSS_UTILS_PREFIXES = ["", "a2-"];
184
-
185
- for (const prefix of CSS_UTILS_PREFIXES) {
186
- StyleDictionary.registerFormat({
187
- name: `custom/CSSUtils/${prefix}All`,
188
- formatter: function ({ dictionary }) {
189
- const colorTokens = dictionary.allTokens
190
- .map((token) => {
191
- const value = getVarValue(dictionary, token);
192
- const name = `${token.name.replace("Default", "")}`;
193
-
194
- if (
195
- // name.startsWith("color") || // primitives
196
- name.startsWith("status-color") ||
197
- name.startsWith("foreground-color") ||
198
- name.startsWith("background-color") ||
199
- name.startsWith("overlay-color")
200
- ) {
201
- const darkValue = getVarValue(dictionary, token, { isDark: true });
202
- return generateColorClasses(name, value, { darkValue, prefix });
203
- }
204
- if (name.startsWith("border-color")) {
205
- const darkValue = getVarValue(dictionary, token, { isDark: true });
206
- return generateBorderClasses(name, value, { darkValue, prefix });
207
- }
208
- return null;
209
- })
210
- .flat()
211
- .filter((t) => t != null)
212
- .map((t) => `${t}`)
213
- .sort((a, b) => a.localeCompare(b))
214
- .join(`\n`);
215
- const nonColorTokens = dictionary.allTokens
216
- .map((token) => {
217
- const value = getVarValue(dictionary, token);
218
- const name = `${token.name.replace("Default", "")}`;
219
-
220
- if (name.startsWith("border")) {
221
- return generateBorderClasses(name, value, { prefix });
222
- }
223
- if (name.startsWith("typography")) {
224
- return generateFontClasses(name, value, { prefix });
225
- }
226
- if (name.startsWith("size")) {
227
- return generateSpacingClasses(name, value, { prefix });
228
- }
229
- return null;
230
- })
231
- .flat()
232
- .filter((t) => t != null)
233
- .map((t) => `${t}`)
234
- .sort((a, b) => a.localeCompare(b))
235
- .join(`\n`);
236
119
 
237
- const colorFallbackTokens = dictionary.allTokens
238
- .map((token) => {
239
- const value = getVarValue(dictionary, token);
240
- const name = `${token.name.replace("Default", "")}`;
120
+ const dtsContent = `import { TokenObj } from '../types';
241
121
 
242
- if (
243
- name.startsWith("status-color") ||
244
- name.startsWith("foreground-color") ||
245
- name.startsWith("background-color") ||
246
- name.startsWith("overlay-color")
247
- ) {
248
- return generateColorClasses(name, value, { prefix });
249
- }
250
- if (name.startsWith("border-color")) {
251
- return generateBorderClasses(name, value, { prefix });
252
- }
253
- return null;
254
- })
255
- .flat()
256
- .filter((t) => t != null)
257
- .map((t) => `${t}`)
258
- .sort((a, b) => a.localeCompare(b))
259
- .join(`\n`);
260
-
261
- // Manually adding .sr-only
262
- const withSr = nonColorTokens.concat(
263
- "\n",
264
- ".sr-only {border: 0; clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; padding-block: 0; padding-inline: 0; position: absolute; white-space: nowrap; width: 1px;}",
265
- );
266
-
267
- return `@layer starter, reset, base, state, application;
268
-
269
- ${withSr}
270
- ${colorFallbackTokens}
271
-
272
- @supports (color: light-dark(#fff, #000)) {
273
- ${colorTokens.replaceAll("\n", "\n ")}
274
- }
275
-
276
- @layer application {
277
- ${withSr.replaceAll("\n", "\n ")}
278
- ${colorFallbackTokens.replaceAll("\n", "\n ")}
279
-
280
- @supports (color: light-dark(#fff, #000)) {
281
- ${colorTokens.replaceAll("\n", "\n ")}
282
- }
283
- }`;
284
- },
285
- });
286
-
287
- StyleDictionary.registerFormat({
288
- name: `custom/CSSUtils/${prefix}Borders`,
289
- formatter: function ({ dictionary }) {
290
- return cssUtilsFormatter(dictionary, generateBorderClasses, {
291
- hasDark: true,
292
- prefix,
293
- });
294
- },
295
- });
296
-
297
- StyleDictionary.registerFormat({
298
- name: `custom/CSSUtils/${prefix}Colors`,
299
- formatter: function ({ dictionary }) {
300
- return cssUtilsFormatter(dictionary, generateColorClasses, {
301
- hasDark: true,
302
- prefix,
303
- });
304
- },
305
- });
306
-
307
- StyleDictionary.registerFormat({
308
- name: `custom/CSSUtils/${prefix}Fonts`,
309
- formatter: function ({ dictionary }) {
310
- return cssUtilsFormatter(dictionary, generateFontClasses, { prefix });
311
- },
312
- });
313
-
314
- StyleDictionary.registerFormat({
315
- name: `custom/CSSUtils/${prefix}Spacing`,
316
- formatter: function ({ dictionary }) {
317
- return cssUtilsFormatter(dictionary, generateSpacingClasses, { prefix });
318
- },
319
- });
320
- }
321
-
322
- const getDirectories = (source) =>
323
- fs
324
- .readdirSync(source, { withFileTypes: true })
325
- .filter((dirent) => dirent.isDirectory())
326
- .map((dirent) => dirent.name);
327
-
328
- const themes = getDirectories(`src/theme`);
329
-
330
- themes.forEach((theme) => {
331
- StyleDictionary.extend({
332
- source: [`src/theme/${theme}/*.js`, `src/theme/${theme}/component/*.js`],
333
- include: ["src/global/primitive/*.js"],
334
- platforms: {
335
- css: {
336
- transformGroup: "css",
337
- buildPath: `build/web/${theme}/css-utils/`,
338
- files: CSS_UTILS_PREFIXES.flatMap((prefix) => [
339
- {
340
- destination: `${prefix}utils.css`,
341
- format: `custom/CSSUtils/${prefix}All`,
342
- },
343
- {
344
- destination: `${prefix}border.css`,
345
- format: `custom/CSSUtils/${prefix}Borders`,
346
- filter: function (token) {
347
- return token.filePath.includes("border");
348
- },
349
- },
350
- {
351
- destination: `${prefix}color.css`,
352
- format: `custom/CSSUtils/${prefix}Colors`,
353
- filter: function (token) {
354
- return (
355
- token.filePath.includes("primitive/color") ||
356
- token.name.includes("color")
357
- );
358
- },
359
- },
360
- {
361
- destination: `${prefix}font.css`,
362
- format: `custom/CSSUtils/${prefix}Fonts`,
363
- filter: function (token) {
364
- return (
365
- token.filePath.includes("primitive/font") ||
366
- token.filePath.includes("typography")
367
- );
368
- },
369
- },
370
- {
371
- destination: `${prefix}spacing.css`,
372
- format: `custom/CSSUtils/${prefix}Spacing`,
373
- filter: function (token) {
374
- return token.filePath.startsWith("src/global/primitive/size");
375
- },
376
- },
377
- ]),
378
- },
379
- scss: {
380
- transformGroup: "scss",
381
- buildPath: `build/web/${theme}/`,
382
- files: [
383
- {
384
- destination: "primitive.scss",
385
- format: "custom/SCSSVariable",
386
- filter: function (token) {
387
- return token.filePath.startsWith("src/global/primitive");
388
- },
389
- },
390
- {
391
- destination: "primitive-variables.scss",
392
- format: "custom/primitive-variables",
393
- filter: function (token) {
394
- return token.filePath.startsWith("src/global/primitive");
395
- },
396
- },
397
- {
398
- destination: "semantic.scss",
399
- format: "custom/SCSSVariable",
400
- filter: function (token) {
401
- return (
402
- token.filePath.startsWith(`src/theme/${theme}`) &&
403
- !token.filePath.startsWith(`src/theme/${theme}/component`)
404
- );
405
- },
406
- },
407
- {
408
- destination: "semantic-variables.scss",
409
- format: "custom/variables-map",
410
- filter: function (token) {
411
- return (
412
- token.filePath.startsWith(`src/theme/${theme}`) &&
413
- !token.filePath.startsWith(`src/theme/${theme}/component`)
414
- );
415
- },
416
- },
417
- {
418
- destination: "component.scss",
419
- format: "custom/SCSSVariable",
420
- filter: function (token) {
421
- return token.filePath.startsWith(`src/theme/${theme}/component`);
422
- },
423
- },
424
- {
425
- destination: "component-variables.scss",
426
- format: "custom/variables-map",
427
- filter: function (token) {
428
- return token.filePath.startsWith(`src/theme/${theme}/component`);
429
- },
430
- },
431
- ],
432
- },
433
- tsLight: {
434
- transformGroup: "js",
435
- buildPath: `build/web/${theme}/`,
436
- files: [
437
- {
438
- format: "custom/es6Variable",
439
- destination: "primitive.js",
440
- filter: function (token) {
441
- return token.filePath.startsWith("src/global/primitive");
442
- },
443
- },
444
- {
445
- format: "custom/es6",
446
- destination: "raw.js",
447
- filter: function (token) {
448
- return (
449
- token.filePath.startsWith(`src/theme/${theme}`) &&
450
- !token.filePath.startsWith(`src/theme/${theme}/component`)
451
- );
452
- },
453
- },
454
- {
455
- format: "custom/es6Variable",
456
- destination: "semantic.js",
457
- filter: function (token) {
458
- return (
459
- token.filePath.startsWith(`src/theme/${theme}`) &&
460
- !token.filePath.startsWith(`src/theme/${theme}/component`)
461
- );
462
- },
463
- },
464
- {
465
- format: "custom/es6Variable",
466
- destination: "component.js",
467
- filter: function (token) {
468
- return token.filePath.startsWith(`src/theme/${theme}/component`);
469
- },
470
- },
471
- ],
472
- },
473
- },
474
- }).buildAllPlatforms();
475
- });
476
-
477
- console.log("\n==============================================");
478
- console.log("Building index files...\n");
479
- const mainJS = fs.createWriteStream(`build/web/index.js`);
480
-
481
- const mainType = fs.createWriteStream(`build/web/index.d.ts`);
482
- mainType.write(`import Token from '../../type/types';\n`);
483
-
484
- themes.forEach((theme) => {
485
- const indexJS = fs.createWriteStream(`build/web/${theme}/index.js`);
486
- indexJS.write(`import * as semantic from './semantic';\n`);
487
- indexJS.write(`import * as primitive from './primitive';\n`);
488
- indexJS.write(`import * as component from './component';\n`);
489
- indexJS.write(`const name = '${theme}';\n`);
490
- indexJS.write(`export { primitive, semantic, component, name };\n`);
491
- indexJS.end();
492
- mainType.write(`declare const ${theme}: Token;\n`);
493
- mainJS.write(`import * as ${theme} from './${theme}';\n`);
122
+ ${exports.map((name) => `export declare const ${name}: TokenObj;`).join("\n")}
123
+ `;
124
+ await fs.writeFile(path.join(buildCorePath, `${file}.d.ts`), dtsContent);
125
+ }
126
+ })().catch((error) => {
127
+ console.error("Error building tokens:", error);
128
+ process.exit(1);
494
129
  });
495
-
496
- mainType.write(`export { Token }\n`);
497
- mainType.write(`export { ${themes.join(", ")} }\n`);
498
- mainType.end();
499
-
500
- mainJS.write(`export * as Token from '../../type/types';\n`);
501
- mainJS.write(`export { ${themes.join(", ")} };\n`);
502
- mainJS.end();
503
- console.log(`Index built!`);
504
- console.log("==============================================\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/hammer-token",
3
- "version": "0.0.0-rc-1.47.0-20251104205759",
3
+ "version": "0.0.0-rc-3.0.0-20260114215531",
4
4
  "description": "",
5
5
  "main": "build/web/index.js",
6
6
  "types": "build/web/index.d.ts",
@@ -12,11 +12,12 @@
12
12
  },
13
13
  "devDependencies": {
14
14
  "fs-extra": "^11.2.0",
15
- "style-dictionary": "^3",
16
- "tinycolor2": "^1.6.0"
15
+ "style-dictionary": "^5.1.1",
16
+ "tinycolor2": "^1.6.0",
17
+ "typescript": "^5.0.0"
17
18
  },
18
19
  "scripts": {
19
- "build": "node ./config.js",
20
+ "build": "pnpm clean && node ./config.js",
20
21
  "dev": "pnpm build && chokidar \"./src\" -c \"pnpm build\"",
21
22
  "clean": "rimraf build .turbo",
22
23
  "lint": "eslint .",
@@ -0,0 +1,39 @@
1
+ {
2
+ "breakpoint": {
3
+ "sm": {
4
+ "$type": "dimension",
5
+ "$value": {
6
+ "value": 640,
7
+ "unit": "px"
8
+ }
9
+ },
10
+ "md": {
11
+ "$type": "dimension",
12
+ "$value": {
13
+ "value": 768,
14
+ "unit": "px"
15
+ }
16
+ },
17
+ "lg": {
18
+ "$type": "dimension",
19
+ "$value": {
20
+ "value": 1024,
21
+ "unit": "px"
22
+ }
23
+ },
24
+ "xl": {
25
+ "$type": "dimension",
26
+ "$value": {
27
+ "value": 1280,
28
+ "unit": "px"
29
+ }
30
+ },
31
+ "xxl": {
32
+ "$type": "dimension",
33
+ "$value": {
34
+ "value": 1536,
35
+ "unit": "px"
36
+ }
37
+ }
38
+ }
39
+ }