@mevbg/design-essentials-vendor 2.0.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.
Files changed (143) hide show
  1. package/README.md +2340 -0
  2. package/dist/defaults.d.ts +8 -0
  3. package/dist/defaults.js +137 -0
  4. package/dist/defaults.js.map +1 -0
  5. package/dist/generators/favicons/favicons.generator.d.ts +4 -0
  6. package/dist/generators/favicons/favicons.generator.js +58 -0
  7. package/dist/generators/favicons/favicons.generator.js.map +1 -0
  8. package/dist/generators/favicons/favicons.types.d.ts +7 -0
  9. package/dist/generators/favicons/favicons.types.js +5 -0
  10. package/dist/generators/favicons/favicons.types.js.map +1 -0
  11. package/dist/generators/font-faces/font-faces.generator.d.ts +2 -0
  12. package/dist/generators/font-faces/font-faces.generator.js +123 -0
  13. package/dist/generators/font-faces/font-faces.generator.js.map +1 -0
  14. package/dist/generators/font-faces/font-faces.types.d.ts +11 -0
  15. package/dist/generators/font-faces/font-faces.types.js +5 -0
  16. package/dist/generators/font-faces/font-faces.types.js.map +1 -0
  17. package/dist/generators/icons/icons.generator.d.ts +2 -0
  18. package/dist/generators/icons/icons.generator.js +47 -0
  19. package/dist/generators/icons/icons.generator.js.map +1 -0
  20. package/dist/generators/icons/icons.types.d.ts +6 -0
  21. package/dist/generators/icons/icons.types.js +5 -0
  22. package/dist/generators/icons/icons.types.js.map +1 -0
  23. package/dist/generators/index.d.ts +7 -0
  24. package/dist/generators/index.js +13 -0
  25. package/dist/generators/index.js.map +1 -0
  26. package/dist/generators/master/master.generator.d.ts +3 -0
  27. package/dist/generators/master/master.generator.js +73 -0
  28. package/dist/generators/master/master.generator.js.map +1 -0
  29. package/dist/generators/master/master.types.d.ts +14 -0
  30. package/dist/generators/master/master.types.js +5 -0
  31. package/dist/generators/master/master.types.js.map +1 -0
  32. package/dist/generators/scrollbar/scrollbar.generator.d.ts +2 -0
  33. package/dist/generators/scrollbar/scrollbar.generator.js +109 -0
  34. package/dist/generators/scrollbar/scrollbar.generator.js.map +1 -0
  35. package/dist/generators/scrollbar/scrollbar.types.d.ts +11 -0
  36. package/dist/generators/scrollbar/scrollbar.types.js +5 -0
  37. package/dist/generators/scrollbar/scrollbar.types.js.map +1 -0
  38. package/dist/generators/tokens/handlers/basic.handler.d.ts +2 -0
  39. package/dist/generators/tokens/handlers/basic.handler.js +57 -0
  40. package/dist/generators/tokens/handlers/basic.handler.js.map +1 -0
  41. package/dist/generators/tokens/handlers/color.handler.d.ts +2 -0
  42. package/dist/generators/tokens/handlers/color.handler.js +117 -0
  43. package/dist/generators/tokens/handlers/color.handler.js.map +1 -0
  44. package/dist/generators/tokens/handlers/index.d.ts +3 -0
  45. package/dist/generators/tokens/handlers/index.js +7 -0
  46. package/dist/generators/tokens/handlers/index.js.map +1 -0
  47. package/dist/generators/tokens/handlers/utopia.handler.d.ts +2 -0
  48. package/dist/generators/tokens/handlers/utopia.handler.js +79 -0
  49. package/dist/generators/tokens/handlers/utopia.handler.js.map +1 -0
  50. package/dist/generators/tokens/platforms/css/formats.d.ts +2 -0
  51. package/dist/generators/tokens/platforms/css/formats.js +20 -0
  52. package/dist/generators/tokens/platforms/css/formats.js.map +1 -0
  53. package/dist/generators/tokens/platforms/css/index.d.ts +2 -0
  54. package/dist/generators/tokens/platforms/css/index.js +20 -0
  55. package/dist/generators/tokens/platforms/css/index.js.map +1 -0
  56. package/dist/generators/tokens/platforms/css/utils.d.ts +3 -0
  57. package/dist/generators/tokens/platforms/css/utils.js +12 -0
  58. package/dist/generators/tokens/platforms/css/utils.js.map +1 -0
  59. package/dist/generators/tokens/platforms/formats.d.ts +3 -0
  60. package/dist/generators/tokens/platforms/formats.js +7 -0
  61. package/dist/generators/tokens/platforms/formats.js.map +1 -0
  62. package/dist/generators/tokens/platforms/index.d.ts +8 -0
  63. package/dist/generators/tokens/platforms/index.js +83 -0
  64. package/dist/generators/tokens/platforms/index.js.map +1 -0
  65. package/dist/generators/tokens/platforms/js/formats.d.ts +2 -0
  66. package/dist/generators/tokens/platforms/js/formats.js +15 -0
  67. package/dist/generators/tokens/platforms/js/formats.js.map +1 -0
  68. package/dist/generators/tokens/platforms/js/index.d.ts +2 -0
  69. package/dist/generators/tokens/platforms/js/index.js +18 -0
  70. package/dist/generators/tokens/platforms/js/index.js.map +1 -0
  71. package/dist/generators/tokens/platforms/js/utils.d.ts +3 -0
  72. package/dist/generators/tokens/platforms/js/utils.js +20 -0
  73. package/dist/generators/tokens/platforms/js/utils.js.map +1 -0
  74. package/dist/generators/tokens/platforms/json/index.d.ts +2 -0
  75. package/dist/generators/tokens/platforms/json/index.js +24 -0
  76. package/dist/generators/tokens/platforms/json/index.js.map +1 -0
  77. package/dist/generators/tokens/platforms/scss/formats.d.ts +2 -0
  78. package/dist/generators/tokens/platforms/scss/formats.js +15 -0
  79. package/dist/generators/tokens/platforms/scss/formats.js.map +1 -0
  80. package/dist/generators/tokens/platforms/scss/index.d.ts +2 -0
  81. package/dist/generators/tokens/platforms/scss/index.js +15 -0
  82. package/dist/generators/tokens/platforms/scss/index.js.map +1 -0
  83. package/dist/generators/tokens/platforms/scss/utils.d.ts +3 -0
  84. package/dist/generators/tokens/platforms/scss/utils.js +15 -0
  85. package/dist/generators/tokens/platforms/scss/utils.js.map +1 -0
  86. package/dist/generators/tokens/tokens.generator.d.ts +3 -0
  87. package/dist/generators/tokens/tokens.generator.js +52 -0
  88. package/dist/generators/tokens/tokens.generator.js.map +1 -0
  89. package/dist/generators/tokens/tokens.types.d.ts +17 -0
  90. package/dist/generators/tokens/tokens.types.js +12 -0
  91. package/dist/generators/tokens/tokens.types.js.map +1 -0
  92. package/dist/generators/tokens/types/color-scheme.types.d.ts +13 -0
  93. package/dist/generators/tokens/types/color-scheme.types.js +29 -0
  94. package/dist/generators/tokens/types/color-scheme.types.js.map +1 -0
  95. package/dist/generators/tokens/types/format.types.d.ts +52 -0
  96. package/dist/generators/tokens/types/format.types.js +35 -0
  97. package/dist/generators/tokens/types/format.types.js.map +1 -0
  98. package/dist/generators/tokens/types/platform.types.d.ts +33 -0
  99. package/dist/generators/tokens/types/platform.types.js +36 -0
  100. package/dist/generators/tokens/types/platform.types.js.map +1 -0
  101. package/dist/generators/tokens/types/tokens.types.d.ts +27 -0
  102. package/dist/generators/tokens/types/tokens.types.js +41 -0
  103. package/dist/generators/tokens/types/tokens.types.js.map +1 -0
  104. package/dist/generators/tokens/types/utopia-scheme.types.d.ts +4 -0
  105. package/dist/generators/tokens/types/utopia-scheme.types.js +5 -0
  106. package/dist/generators/tokens/types/utopia-scheme.types.js.map +1 -0
  107. package/dist/generators/tokens/utils/color-tokens.utils.d.ts +8 -0
  108. package/dist/generators/tokens/utils/color-tokens.utils.js +24 -0
  109. package/dist/generators/tokens/utils/color-tokens.utils.js.map +1 -0
  110. package/dist/generators/tokens/utils/formats.utils.d.ts +17 -0
  111. package/dist/generators/tokens/utils/formats.utils.js +164 -0
  112. package/dist/generators/tokens/utils/formats.utils.js.map +1 -0
  113. package/dist/generators/tokens/utils/utopia-tokens.utils.d.ts +10 -0
  114. package/dist/generators/tokens/utils/utopia-tokens.utils.js +56 -0
  115. package/dist/generators/tokens/utils/utopia-tokens.utils.js.map +1 -0
  116. package/dist/generators/viewport-scaler/viewport-scaler.generator.d.ts +2 -0
  117. package/dist/generators/viewport-scaler/viewport-scaler.generator.js +56 -0
  118. package/dist/generators/viewport-scaler/viewport-scaler.generator.js.map +1 -0
  119. package/dist/generators/viewport-scaler/viewport-scaler.types.d.ts +7 -0
  120. package/dist/generators/viewport-scaler/viewport-scaler.types.js +5 -0
  121. package/dist/generators/viewport-scaler/viewport-scaler.types.js.map +1 -0
  122. package/dist/index.d.ts +2 -0
  123. package/dist/index.js +11 -0
  124. package/dist/index.js.map +1 -0
  125. package/dist/types/generator.types.d.ts +2 -0
  126. package/dist/types/generator.types.js +5 -0
  127. package/dist/types/generator.types.js.map +1 -0
  128. package/dist/types/index.d.ts +8 -0
  129. package/dist/types/index.js +12 -0
  130. package/dist/types/index.js.map +1 -0
  131. package/dist/types/utils.types.d.ts +2 -0
  132. package/dist/types/utils.types.js +5 -0
  133. package/dist/types/utils.types.js.map +1 -0
  134. package/dist/utils/formats.utils.d.ts +14 -0
  135. package/dist/utils/formats.utils.js +24 -0
  136. package/dist/utils/formats.utils.js.map +1 -0
  137. package/dist/utils/generators.utils.d.ts +2 -0
  138. package/dist/utils/generators.utils.js +39 -0
  139. package/dist/utils/generators.utils.js.map +1 -0
  140. package/dist/utils/strings.utils.d.ts +5 -0
  141. package/dist/utils/strings.utils.js +46 -0
  142. package/dist/utils/strings.utils.js.map +1 -0
  143. package/package.json +91 -0
@@ -0,0 +1,83 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS */
3
+ /* =================================================== */
4
+ import path from 'path';
5
+ import { toKebabCase } from '../../../utils/strings.utils.js';
6
+ import { CommonPlatformFileType, CoreToken } from '../tokens.types.js';
7
+ import { CustomFormatterCategory } from '../types/format.types.js';
8
+ import { getCategoryFormatterName, getDestinationFileName } from '../utils/formats.utils.js';
9
+ // getPlatformConfigs is a function that is responsible
10
+ // for preparing the configurations for the Style Dictionary platforms object.
11
+ // It iterates through the provided list of platform names,
12
+ // dynamically imports the platform context getters for each given platform type,
13
+ // runs them and returns the platform configs based on the context received.
14
+ export const getPlatformConfigs = async ({ platforms, buildPath, designData, prefix }) => {
15
+ // Dynamically import the platform context getters for each given platform type
16
+ const platformContextImports = platforms.map((platformType) => import(`./${platformType}/index.js`));
17
+ const platformContextGetters = await Promise.all(platformContextImports);
18
+ // Return "platforms" object with the configs,
19
+ // by iterating over the platform context getters,
20
+ // preparing the platform configs with the received context
21
+ // and returning them as a key-value pair [PlatformType, PlatformConfig]
22
+ // which is then converted to an object with the PlatformType as the key
23
+ // and the PlatformConfig as the value.
24
+ return Object.fromEntries(platformContextGetters.map((item, index) => {
25
+ // Get the platform type
26
+ const platformType = platforms[index];
27
+ // Get the PlatformContextGetter function for the given platform type
28
+ const getPlatformContext = item[platformType];
29
+ // Get the platform context
30
+ const { config, customFiles = [], allTokensFile, tokenTypeFiles } = getPlatformContext({
31
+ designData,
32
+ prefix
33
+ });
34
+ // It is necessary to define the formatter category (based on the platform type),
35
+ // because the getCategoryFormatterName function expects CustomFormatterCategory as the first argument
36
+ // and the platform type is not a valid CustomFormatterCategory.
37
+ const formatterCategory = Object.values(CustomFormatterCategory).find((category) => category === platformType);
38
+ // Prepare the platform config with the received context
39
+ const platformConfig = {
40
+ transformGroup: platformType,
41
+ buildPath: `${path.resolve(buildPath)}`,
42
+ files: [
43
+ // if allTokensFile is true, a file with all tokens should be created
44
+ ...(allTokensFile
45
+ ? [
46
+ {
47
+ destination: getDestinationFileName(platformType, CommonPlatformFileType.ALL),
48
+ format: getCategoryFormatterName(formatterCategory, CommonPlatformFileType.ALL)
49
+ }
50
+ ]
51
+ : []),
52
+ // if tokenTypeFiles is true, a file for each token type should be created
53
+ ...(tokenTypeFiles
54
+ ? Object.values(CoreToken).map((key) => ({
55
+ destination: getDestinationFileName(platformType, toKebabCase(key)),
56
+ format: getCategoryFormatterName(formatterCategory, CommonPlatformFileType.CORE),
57
+ filter: (token) => token.$type === key
58
+ }))
59
+ : []),
60
+ // if tokenTypeFiles is true, a file for "others" (if such, not in the core list) should be created
61
+ ...(tokenTypeFiles
62
+ ? [
63
+ {
64
+ destination: getDestinationFileName(platformType, CommonPlatformFileType.OTHERS),
65
+ format: getCategoryFormatterName(formatterCategory, CommonPlatformFileType.OTHERS),
66
+ filter: (token) => !Object.values(CoreToken).includes(token.$type)
67
+ }
68
+ ]
69
+ : []),
70
+ // if customFiles is provided, a file for each one of them should be created
71
+ // Note to myself: JS files are customFiles
72
+ ...customFiles.map((file) => ({
73
+ destination: getDestinationFileName(platformType, file),
74
+ format: getCategoryFormatterName(formatterCategory, file)
75
+ }))
76
+ ],
77
+ // Spread the specific platform config (if any)
78
+ ...config
79
+ };
80
+ return [platformType, platformConfig];
81
+ }));
82
+ };
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1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ChF,MAAM,EAAE,wBAAwB,CAC9B,iBAAiB,EACjB,sBAAsB,CAAC,MAAM,CAC9B;4BACD,MAAM,EAAE,CAAC,KAAuB,EAAE,EAAE,CAClC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAkB,CAAC;yBAC/D;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBAEP,4EAA4E;gBAC5E,2CAA2C;gBAC3C,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAC5B,WAAW,EAAE,sBAAsB,CAAC,YAAY,EAAE,IAAwB,CAAC;oBAC3E,MAAM,EAAE,wBAAwB,CAAC,iBAAiB,EAAE,IAAI,CAAC;iBAC1D,CAAC,CAAC;aACJ;YAED,+CAA+C;YAC/C,GAAG,MAAM;SACV,CAAC;QAEF,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACxC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Format } from 'style-dictionary/types';
2
+ export declare const jsFormatters: Format[];
@@ -0,0 +1,15 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → JS → FORMATS */
3
+ /* =================================================== */
4
+ import { CustomFormatterCategory, JsCustomFormatterType } from '../../tokens.types.js';
5
+ import { allFormatterTemplate } from '../../utils/formats.utils.js';
6
+ // This is the list of formatters for the JS platform.
7
+ export const jsFormatters = [
8
+ JsCustomFormatterType.STATIC,
9
+ JsCustomFormatterType.VARIABLE
10
+ ].map((item) => allFormatterTemplate({
11
+ name: item,
12
+ type: item,
13
+ category: CustomFormatterCategory.JS
14
+ }));
15
+ //# sourceMappingURL=formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/js/formats.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,uCAAuC;AACvC,yDAAyD;AAGzD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,sDAAsD;AACtD,MAAM,CAAC,MAAM,YAAY,GAAa;IACpC,qBAAqB,CAAC,MAAM;IAC5B,qBAAqB,CAAC,QAAQ;CAC/B,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACb,oBAAoB,CAAC;IACnB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,uBAAuB,CAAC,EAAE;CACrC,CAAC,CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { PlatformContextGetter } from '../../tokens.types.js';
2
+ export declare const js: PlatformContextGetter;
@@ -0,0 +1,18 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → JS */
3
+ /* =================================================== */
4
+ import { JsCustomPlatformFileType } from '../../tokens.types.js';
5
+ // This is the platform context getter for the JS platform.
6
+ // It returns the platform context that brings the following info:
7
+ // • two custom files (static and variable) should be created;
8
+ // • no other files should be created.
9
+ export const js = ({ prefix, designData }) => ({
10
+ config: {
11
+ options: {
12
+ prefix,
13
+ designData
14
+ }
15
+ },
16
+ customFiles: Object.values(JsCustomPlatformFileType)
17
+ });
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/js/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,6BAA6B;AAC7B,yDAAyD;AAEzD,OAAO,EAAE,wBAAwB,EAAyB,MAAM,uBAAuB,CAAC;AAExF,2DAA2D;AAC3D,kEAAkE;AAClE,8DAA8D;AAC9D,sCAAsC;AACtC,MAAM,CAAC,MAAM,EAAE,GAA0B,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACpE,MAAM,EAAE;QACN,OAAO,EAAE;YACP,MAAM;YACN,UAAU;SACX;KACF;IACD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC;CACrD,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DefinerParams, WrapperParams } from '../../tokens.types.js';
2
+ export declare const wrapper: ({ name, code, indent }: WrapperParams) => string;
3
+ export declare const definer: ({ type, tokens, options, indent }: DefinerParams) => string;
@@ -0,0 +1,20 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → JS → UTILS */
3
+ /* =================================================== */
4
+ import { capitalize, spaceCaseToCamelCase, toCamelCase, toKebabCase } from '../../../../utils/strings.utils.js';
5
+ import { JsCustomFormatterType } from '../../tokens.types.js';
6
+ //
7
+ // ---------------------------------------------------
8
+ // OUTPUT FUNCTIONS
9
+ // This function wraps a code block in a JS object.
10
+ // It could be a nested object or a root object, defined as a const.
11
+ export const wrapper = ({ name = '', code, indent = '' }) => (!indent ? `export const ${spaceCaseToCamelCase(name)} =` : `${indent}${name}:`) +
12
+ ` {\n${code}\n${indent}}${!indent ? ';' : ''}`;
13
+ // This function defines the list of properties in a JS object.
14
+ // The values may contain static or variable kind of data, depending on the formatter type.
15
+ export const definer = ({ type, tokens, options, indent = ' ' }) => tokens
16
+ .map(({ name, path, $type = '', $value }, index) => type === JsCustomFormatterType.STATIC
17
+ ? `${indent}'${toCamelCase(name.replace(capitalize($type), ''))}': '${$value}'${index < tokens.length - 1 ? ',' : ''}`
18
+ : `${indent}'${toKebabCase(toCamelCase(name.replace(capitalize($type), '')))}': 'var(--${options?.prefix}-${toKebabCase(path.join('-')).replace('$', '')})'${index < tokens.length - 1 ? ',' : ''}`)
19
+ .join('\n');
20
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/js/utils.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,yDAAyD;AAEzD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AC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,OAAO,EAAE,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACtM;KACA,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { PlatformContextGetter } from '../../types/platform.types.js';
2
+ export declare const json: PlatformContextGetter;
@@ -0,0 +1,24 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → JSON */
3
+ /* =================================================== */
4
+ import { CommonPlatformFileType, PlatformType } from '../../types/platform.types.js';
5
+ import { getDestinationFileName } from '../../utils/formats.utils.js';
6
+ // This is the platform context getter for the JSON platform.
7
+ // It returns only the native PlatformConfig as a "config" property,
8
+ // because it doesn't use custom formatters that require any other info.
9
+ export const json = ({ prefix }) => ({
10
+ config: {
11
+ transformGroup: PlatformType.JS,
12
+ options: {
13
+ prefix,
14
+ showFileHeader: false
15
+ },
16
+ files: [
17
+ {
18
+ destination: getDestinationFileName(PlatformType.JSON, CommonPlatformFileType.ALL),
19
+ format: 'json/nested'
20
+ }
21
+ ]
22
+ }
23
+ });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/json/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,+BAA+B;AAC/B,yDAAyD;AAEzD,OAAO,EACL,sBAAsB,EAEtB,YAAY,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,6DAA6D;AAC7D,oEAAoE;AACpE,wEAAwE;AACxE,MAAM,CAAC,MAAM,IAAI,GAA0B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1D,MAAM,EAAE;QACN,cAAc,EAAE,YAAY,CAAC,EAAE;QAC/B,OAAO,EAAE;YACP,MAAM;YACN,cAAc,EAAE,KAAK;SACtB;QACD,KAAK,EAAE;YACL;gBACE,WAAW,EAAE,sBAAsB,CAAC,YAAY,CAAC,IAAI,EAAE,sBAAsB,CAAC,GAAG,CAAC;gBAClF,MAAM,EAAE,aAAa;aACtB;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Format } from 'style-dictionary/types';
2
+ export declare const scssFormatters: Format[];
@@ -0,0 +1,15 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → SCSS → FORMATS */
3
+ /* =================================================== */
4
+ import { CustomFormatterCategory } from '../../tokens.types.js';
5
+ import { allFormatterTemplate, coreFormatterTemplate, othersFormatterTemplate } from '../../utils/formats.utils.js';
6
+ // This is the list of formatters for the SCSS platform.
7
+ export const scssFormatters = Object.entries({
8
+ all: allFormatterTemplate, // Formatter for all tokens
9
+ core: coreFormatterTemplate, // Formatter for core tokens
10
+ others: othersFormatterTemplate // Formatter for non-core tokens
11
+ }).map(([name, getFormatter]) => getFormatter({
12
+ name,
13
+ category: CustomFormatterCategory.SCSS
14
+ }));
15
+ //# sourceMappingURL=formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/scss/formats.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,yCAAyC;AACzC,yDAAyD;AAGzD,OAAO,EAAE,uBAAuB,EAAuB,MAAM,uBAAuB,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AAEtC,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAa,MAAM,CAAC,OAAO,CAAC;IACrD,GAAG,EAAE,oBAAoB,EAAE,2BAA2B;IACtD,IAAI,EAAE,qBAAqB,EAAE,4BAA4B;IACzD,MAAM,EAAE,uBAAuB,CAAC,gCAAgC;CACjE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,CAAgC,EAAE,EAAE,CAC7D,YAAY,CAAC;IACX,IAAI;IACJ,QAAQ,EAAE,uBAAuB,CAAC,IAAI;CACvC,CAAC,CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { PlatformContextGetter } from '../../tokens.types.js';
2
+ export declare const scss: PlatformContextGetter;
@@ -0,0 +1,15 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → SCSS */
3
+ /* =================================================== */
4
+ // This is the platform context getter for the SCSS platform.
5
+ // It returns the platform context that brings the following info:
6
+ // • a file with all tokens should be created;
7
+ // • a file for each token type should be created;
8
+ export const scss = ({ designData }) => ({
9
+ config: {
10
+ options: { designData }
11
+ },
12
+ allTokensFile: true,
13
+ tokenTypeFiles: true
14
+ });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/scss/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,+BAA+B;AAC/B,yDAAyD;AAIzD,6DAA6D;AAC7D,kEAAkE;AAClE,8CAA8C;AAC9C,kDAAkD;AAClD,MAAM,CAAC,MAAM,IAAI,GAA0B,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9D,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,UAAU,EAAE;KACxB;IACD,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;CACrB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { DefinerParams, WrapperParams } from '../../tokens.types.js';
2
+ export declare const wrapper: ({ name, code, indent }: WrapperParams) => string;
3
+ export declare const definer: ({ tokens, indent }: DefinerParams) => string;
@@ -0,0 +1,15 @@
1
+ /* =================================================== */
2
+ /* TOKENS → PLATFORMS → SCSS → UTILS */
3
+ /* =================================================== */
4
+ import { toKebabCase } from '../../../../utils/strings.utils.js';
5
+ //
6
+ // ---------------------------------------------------
7
+ // OUTPUT FUNCTIONS
8
+ // This function wraps a code block in a Sass map.
9
+ // It may be a nested map or a root map, defined as a Sass variable.
10
+ export const wrapper = ({ name = '', code, indent = '' }) => `${indent}${indent ? '' : '$'}${name.toLowerCase().split(' ').join('-')}: (\n${code}\n${indent})${indent ? ',' : ';'}`;
11
+ // This function defines the list of values in a Sass map.
12
+ export const definer = ({ tokens, indent = ' ' }) => tokens
13
+ .map(({ name, $type, $value }, index) => `${indent}'${name.replace(toKebabCase($type || '') + '-', '')}': ${$type === 'fontFamily' ? `'${$value}'` : $value}${index < tokens.length - 1 ? ',' : ''}`)
14
+ .join('\n');
15
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/generators/tokens/platforms/scss/utils.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,uCAAuC;AACvC,yDAAyD;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,EAAE;AACF,sDAAsD;AACtD,mBAAmB;AAEnB,kDAAkD;AAClD,oEAAoE;AACpE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,EAAiB,EAAU,EAAE,CACjF,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAEzH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAiB,EAAU,EAAE,CAC1E,MAAM;KACH,GAAG,CACF,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CACjC,GAAG,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9J;KACA,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GeneratorFn } from '../../types/index.js';
2
+ import type { TokensGeneratorParams } from './tokens.types.js';
3
+ export declare const tokensGenerator: GeneratorFn<TokensGeneratorParams>;
@@ -0,0 +1,52 @@
1
+ /* =================================================== */
2
+ /* TOKENS → GENERATOR */
3
+ /* =================================================== */
4
+ import path from 'path';
5
+ import StyleDictionary from 'style-dictionary';
6
+ import { tokensGeneratorDefaultParams } from '../../defaults.js';
7
+ import * as formats from './platforms/formats.js';
8
+ import { getPlatformConfigs } from './platforms/index.js';
9
+ //
10
+ // ---------------------------------------------------
11
+ // GENERATOR FUNCTION
12
+ // This function generates the design tokens
13
+ export const tokensGenerator = async (params) => {
14
+ const { buildPath, prefix, baseFontSize, sourcePath, platforms, utopiaScheme, colorScheme } = {
15
+ ...tokensGeneratorDefaultParams,
16
+ ...params
17
+ };
18
+ const designData = {
19
+ baseFontSize,
20
+ colorScheme,
21
+ utopiaScheme
22
+ };
23
+ // All custom formats are defined in separated files
24
+ // based on the platform type (platforms/**/formats.ts)
25
+ // and are collected and exported by the formats.ts file
26
+ // so to be imported all at once in here,
27
+ // where they get registered in the StyleDictionary instance,
28
+ // by being gathered in a flat array and iterated over.
29
+ Object.values(formats)
30
+ .flatMap((formatterGroup) => Object.values(formatterGroup))
31
+ .forEach((format) => {
32
+ StyleDictionary.registerFormat(format);
33
+ });
34
+ // Resolve the source path
35
+ const source = [path.resolve(sourcePath)];
36
+ // Get the platform configs
37
+ const platformConfigs = await getPlatformConfigs({
38
+ platforms,
39
+ buildPath,
40
+ designData,
41
+ prefix
42
+ });
43
+ // Define the StyleDictionary instance
44
+ // with the resolved source path and the platform configs
45
+ const dictionary = new StyleDictionary({
46
+ source,
47
+ platforms: platformConfigs
48
+ });
49
+ // Generate the design tokens and return the StyleDictionary instance
50
+ return dictionary.buildAllPlatforms();
51
+ };
52
+ //# sourceMappingURL=tokens.generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.generator.js","sourceRoot":"","sources":["../../../src/generators/tokens/tokens.generator.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,wBAAwB;AACxB,yDAAyD;AAEzD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,EAAE;AACF,sDAAsD;AACtD,qBAAqB;AAErB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAuC,KAAK,EAAE,MAAM,EAAE,EAAE;IAClF,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG;QAC5F,GAAG,4BAA4B;QAC/B,GAAG,MAAM;KACyB,CAAC;IAErC,MAAM,UAAU,GAAqB;QACnC,YAAY;QACZ,WAAW;QACX,YAAY;KACb,CAAC;IAEF,oDAAoD;IACpD,uDAAuD;IACvD,wDAAwD;IACxD,yCAAyC;IACzC,6DAA6D;IAC7D,uDAAuD;IACvD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;SACnB,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;SAC1D,OAAO,CAAC,CAAC,MAAc,EAAE,EAAE;QAC1B,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEL,0BAA0B;IAC1B,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,2BAA2B;IAC3B,MAAM,eAAe,GAAG,MAAM,kBAAkB,CAAC;QAC/C,SAAS;QACT,SAAS;QACT,UAAU;QACV,MAAM;KACP,CAAC,CAAC;IAEH,sCAAsC;IACtC,yDAAyD;IACzD,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC;QACrC,MAAM;QACN,SAAS,EAAE,eAAe;KAC3B,CAAC,CAAC;IAEH,qEAAqE;IACrE,OAAO,UAAU,CAAC,iBAAiB,EAAE,CAAC;AACxC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ColorSchemeParams } from './types/color-scheme.types.js';
2
+ import type { PlatformType } from './types/platform.types.js';
3
+ import type { UtopiaSchemeParams } from './types/utopia-scheme.types.js';
4
+ export type TokensGeneratorParams = {
5
+ sourcePath: string;
6
+ platforms?: PlatformType[];
7
+ prefix?: string;
8
+ baseFontSize?: number;
9
+ colorScheme?: ColorSchemeParams;
10
+ utopiaScheme?: UtopiaSchemeParams;
11
+ buildPath?: string;
12
+ };
13
+ export * from './types/color-scheme.types.js';
14
+ export * from './types/format.types.js';
15
+ export * from './types/platform.types.js';
16
+ export * from './types/tokens.types.js';
17
+ export * from './types/utopia-scheme.types.js';
@@ -0,0 +1,12 @@
1
+ /* =================================================== */
2
+ /* TOKENS → TYPES */
3
+ /* =================================================== */
4
+ //
5
+ // ---------------------------------------------------
6
+ // EXPORT TYPES
7
+ export * from './types/color-scheme.types.js';
8
+ export * from './types/format.types.js';
9
+ export * from './types/platform.types.js';
10
+ export * from './types/tokens.types.js';
11
+ export * from './types/utopia-scheme.types.js';
12
+ //# sourceMappingURL=tokens.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.types.js","sourceRoot":"","sources":["../../../src/generators/tokens/tokens.types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oBAAoB;AACpB,yDAAyD;AAsBzD,EAAE;AACF,sDAAsD;AACtD,eAAe;AAEf,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare enum ColorSchemeType {
2
+ LIGHT = "light",
3
+ DARK = "dark"
4
+ }
5
+ export declare enum ColorSchemeMethod {
6
+ MEDIA = "media",
7
+ CLASS = "class",
8
+ COMBINED = "combined"
9
+ }
10
+ export type ColorSchemeParams = {
11
+ default?: ColorSchemeType;
12
+ method?: ColorSchemeMethod;
13
+ };
@@ -0,0 +1,29 @@
1
+ /* =================================================== */
2
+ /* TOKENS → TYPES → COLOR SCHEME */
3
+ /* =================================================== */
4
+ //
5
+ // ---------------------------------------------------
6
+ // COLOR SCHEME TYPE
7
+ // These are the only available native color schemes that can be used.
8
+ export var ColorSchemeType;
9
+ (function (ColorSchemeType) {
10
+ ColorSchemeType["LIGHT"] = "light";
11
+ ColorSchemeType["DARK"] = "dark";
12
+ })(ColorSchemeType || (ColorSchemeType = {}));
13
+ //
14
+ // ---------------------------------------------------
15
+ // COLOR SCHEME METHOD
16
+ // These are the methods that can be used to define the color scheme behavior.
17
+ export var ColorSchemeMethod;
18
+ (function (ColorSchemeMethod) {
19
+ // The color scheme is defined based on the "prefers-color-scheme" media query.
20
+ // Using this method means only @media-related code will be generated in the CSS output.
21
+ ColorSchemeMethod["MEDIA"] = "media";
22
+ // The color scheme is defined based on a class name (light/dark) applied to the root element.
23
+ // Using this method means only html.class-related code will be generated in the CSS output.
24
+ ColorSchemeMethod["CLASS"] = "class";
25
+ // The color scheme is defined based on the media query and class name where the class method has priority over the media query.
26
+ // Using this method means both @media-related and html.class-related code will be generated in the CSS output.
27
+ ColorSchemeMethod["COMBINED"] = "combined";
28
+ })(ColorSchemeMethod || (ColorSchemeMethod = {}));
29
+ //# sourceMappingURL=color-scheme.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-scheme.types.js","sourceRoot":"","sources":["../../../../src/generators/tokens/types/color-scheme.types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,mCAAmC;AACnC,yDAAyD;AAEzD,EAAE;AACF,sDAAsD;AACtD,oBAAoB;AAEpB,sEAAsE;AACtE,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,EAAE;AACF,sDAAsD;AACtD,sBAAsB;AAEtB,8EAA8E;AAC9E,MAAM,CAAN,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,+EAA+E;IAC/E,wFAAwF;IACxF,oCAAe,CAAA;IAEf,8FAA8F;IAC9F,4FAA4F;IAC5F,oCAAe,CAAA;IAEf,gIAAgI;IAChI,+GAA+G;IAC/G,0CAAqB,CAAA;AACvB,CAAC,EAZW,iBAAiB,KAAjB,iBAAiB,QAY5B"}
@@ -0,0 +1,52 @@
1
+ import type { Format, FormatFnArguments, TransformedToken } from 'style-dictionary/types';
2
+ import { CoreToken } from './tokens.types.js';
3
+ export declare enum CustomFormatterCategory {
4
+ CSS = "css",
5
+ SCSS = "scss",
6
+ JS = "js"
7
+ }
8
+ export declare enum CssCustomFormatterType {
9
+ ALL = "all",
10
+ CORE = "core",
11
+ OTHERS = "others"
12
+ }
13
+ export declare enum ScssCustomFormatterType {
14
+ ALL = "all",
15
+ CORE = "core",
16
+ OTHERS = "others"
17
+ }
18
+ export declare enum JsCustomFormatterType {
19
+ STATIC = "static",
20
+ VARIABLE = "variable"
21
+ }
22
+ export type CustomFormatterType = CssCustomFormatterType | ScssCustomFormatterType | JsCustomFormatterType;
23
+ export type FormatterTemplateFn = (params: {
24
+ name: string;
25
+ category: CustomFormatterCategory;
26
+ type?: CustomFormatterType;
27
+ }) => Format;
28
+ export type OutputConfig = {
29
+ noChapterTitle?: boolean;
30
+ prefix?: string;
31
+ };
32
+ export type HandlerResolver = (formatArgs: FormatFnArguments, tokens: TransformedToken[], config?: OutputConfig) => Promise<string>;
33
+ export type CoreTokensHandlerResolvers = Record<CoreToken, HandlerResolver>;
34
+ export type CommonHandlerParams = {
35
+ name: string;
36
+ category: CustomFormatterCategory;
37
+ type?: CustomFormatterType;
38
+ formatArgs: FormatFnArguments;
39
+ tokens: TransformedToken[];
40
+ config?: OutputConfig;
41
+ };
42
+ export type WrapperParams = {
43
+ code: string;
44
+ name?: string;
45
+ indent?: string;
46
+ };
47
+ export type DefinerParams = {
48
+ type?: CustomFormatterType;
49
+ tokens: TransformedToken[];
50
+ options?: FormatFnArguments['options'];
51
+ indent?: string;
52
+ };
@@ -0,0 +1,35 @@
1
+ /* =================================================== */
2
+ /* TOKENS → TYPES → FORMATS */
3
+ /* =================================================== */
4
+ //
5
+ // ---------------------------------------------------
6
+ // CUSTOM FORMATTER CATEGORIES
7
+ // This enum contains the categories of custom formatters.
8
+ export var CustomFormatterCategory;
9
+ (function (CustomFormatterCategory) {
10
+ CustomFormatterCategory["CSS"] = "css";
11
+ CustomFormatterCategory["SCSS"] = "scss";
12
+ CustomFormatterCategory["JS"] = "js";
13
+ })(CustomFormatterCategory || (CustomFormatterCategory = {}));
14
+ //
15
+ // ---------------------------------------------------
16
+ // CUSTOM FORMATTER TYPES
17
+ // This enum contains the types of custom formatters.
18
+ export var CssCustomFormatterType;
19
+ (function (CssCustomFormatterType) {
20
+ CssCustomFormatterType["ALL"] = "all";
21
+ CssCustomFormatterType["CORE"] = "core";
22
+ CssCustomFormatterType["OTHERS"] = "others";
23
+ })(CssCustomFormatterType || (CssCustomFormatterType = {}));
24
+ export var ScssCustomFormatterType;
25
+ (function (ScssCustomFormatterType) {
26
+ ScssCustomFormatterType["ALL"] = "all";
27
+ ScssCustomFormatterType["CORE"] = "core";
28
+ ScssCustomFormatterType["OTHERS"] = "others";
29
+ })(ScssCustomFormatterType || (ScssCustomFormatterType = {}));
30
+ export var JsCustomFormatterType;
31
+ (function (JsCustomFormatterType) {
32
+ JsCustomFormatterType["STATIC"] = "static";
33
+ JsCustomFormatterType["VARIABLE"] = "variable";
34
+ })(JsCustomFormatterType || (JsCustomFormatterType = {}));
35
+ //# sourceMappingURL=format.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.types.js","sourceRoot":"","sources":["../../../../src/generators/tokens/types/format.types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,8BAA8B;AAC9B,yDAAyD;AAMzD,EAAE;AACF,sDAAsD;AACtD,8BAA8B;AAE9B,0DAA0D;AAC1D,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,sCAAW,CAAA;IACX,wCAAa,CAAA;IACb,oCAAS,CAAA;AACX,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC;AAED,EAAE;AACF,sDAAsD;AACtD,yBAAyB;AAEzB,qDAAqD;AACrD,MAAM,CAAN,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,qCAAgC,CAAA;IAChC,uCAAkC,CAAA;IAClC,2CAAsC,CAAA;AACxC,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,QAIjC;AAED,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,sCAAgC,CAAA;IAChC,wCAAkC,CAAA;IAClC,4CAAsC,CAAA;AACxC,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC;AAED,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,0CAAwC,CAAA;IACxC,8CAA4C,CAAA;AAC9C,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC"}
@@ -0,0 +1,33 @@
1
+ import { PlatformConfig } from 'style-dictionary/types';
2
+ import { CoreTokenKebabValues, TokensDesignData } from './tokens.types.js';
3
+ export declare enum PlatformType {
4
+ CSS = "css",
5
+ SCSS = "scss",
6
+ JS = "js",
7
+ JSON = "json"
8
+ }
9
+ export type PlatformContext = {
10
+ config: PlatformConfig;
11
+ allTokensFile?: boolean;
12
+ tokenTypeFiles?: boolean;
13
+ customFiles?: string[];
14
+ };
15
+ export type PlatformContextGetter = (params: {
16
+ designData: TokensDesignData;
17
+ prefix?: string;
18
+ }) => PlatformContext;
19
+ export declare enum CommonPlatformFileType {
20
+ ALL = "all",
21
+ CORE = "core",
22
+ OTHERS = "others"
23
+ }
24
+ export declare enum JsCustomPlatformFileType {
25
+ STATIC = "static",
26
+ VARIABLE = "variable"
27
+ }
28
+ type CssPlatformFilename = CommonPlatformFileType.ALL | CommonPlatformFileType.OTHERS | CoreTokenKebabValues;
29
+ type ScssPlatformFilename = CommonPlatformFileType.ALL | CommonPlatformFileType.OTHERS | CoreTokenKebabValues;
30
+ type JsPlatformFilename = JsCustomPlatformFileType.STATIC | JsCustomPlatformFileType.VARIABLE;
31
+ type JsonPlatformFilename = CommonPlatformFileType.ALL;
32
+ export type PlatformFilename = CssPlatformFilename | ScssPlatformFilename | JsPlatformFilename | JsonPlatformFilename;
33
+ export {};
@@ -0,0 +1,36 @@
1
+ /* =================================================== */
2
+ /* TOKENS → TYPES → PLATFORMS */
3
+ /* =================================================== */
4
+ //
5
+ // ---------------------------------------------------
6
+ // PLATFORM TYPES
7
+ // This enum contains the types of platforms that are supported.
8
+ export var PlatformType;
9
+ (function (PlatformType) {
10
+ PlatformType["CSS"] = "css";
11
+ PlatformType["SCSS"] = "scss";
12
+ PlatformType["JS"] = "js";
13
+ PlatformType["JSON"] = "json";
14
+ })(PlatformType || (PlatformType = {}));
15
+ //
16
+ // ---------------------------------------------------
17
+ // FILE TYPES
18
+ // This type determines the common file types for CSS & SCSS platforms
19
+ export var CommonPlatformFileType;
20
+ (function (CommonPlatformFileType) {
21
+ // file that contains all tokens
22
+ CommonPlatformFileType["ALL"] = "all";
23
+ // individual files for each token type in the core list
24
+ CommonPlatformFileType["CORE"] = "core";
25
+ // conditional file that depends on whether a token type that is not in the core list is used
26
+ CommonPlatformFileType["OTHERS"] = "others";
27
+ })(CommonPlatformFileType || (CommonPlatformFileType = {}));
28
+ // This type determines the custom file types for the JS platform
29
+ export var JsCustomPlatformFileType;
30
+ (function (JsCustomPlatformFileType) {
31
+ // file that contains all tokens with printed static values
32
+ JsCustomPlatformFileType["STATIC"] = "static";
33
+ // file that contains all tokens with printed CSS custom properties as values
34
+ JsCustomPlatformFileType["VARIABLE"] = "variable";
35
+ })(JsCustomPlatformFileType || (JsCustomPlatformFileType = {}));
36
+ //# sourceMappingURL=platform.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.types.js","sourceRoot":"","sources":["../../../../src/generators/tokens/types/platform.types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,gCAAgC;AAChC,yDAAyD;AAKzD,EAAE;AACF,sDAAsD;AACtD,iBAAiB;AAEjB,gEAAgE;AAChE,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,yBAAS,CAAA;IACT,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AA6BD,EAAE;AACF,sDAAsD;AACtD,aAAa;AAEb,sEAAsE;AACtE,MAAM,CAAN,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,gCAAgC;IAChC,qCAAW,CAAA;IAEX,wDAAwD;IACxD,uCAAa,CAAA;IAEb,6FAA6F;IAC7F,2CAAiB,CAAA;AACnB,CAAC,EATW,sBAAsB,KAAtB,sBAAsB,QASjC;AAED,iEAAiE;AACjE,MAAM,CAAN,IAAY,wBAMX;AAND,WAAY,wBAAwB;IAClC,2DAA2D;IAC3D,6CAAiB,CAAA;IAEjB,6EAA6E;IAC7E,iDAAqB,CAAA;AACvB,CAAC,EANW,wBAAwB,KAAxB,wBAAwB,QAMnC"}