style-dictionary 4.2.0 → 4.3.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.
Files changed (145) hide show
  1. package/README.md +8 -5
  2. package/bin/style-dictionary.d.ts +8 -0
  3. package/bin/style-dictionary.js +38 -10
  4. package/examples/advanced/assets-base64-embed/package.json +1 -1
  5. package/examples/advanced/create-react-app/package.json +1 -1
  6. package/examples/advanced/create-react-native-app/package.json +1 -1
  7. package/examples/advanced/create-react-native-app/src/App.js +0 -1
  8. package/examples/advanced/custom-parser/package.json +1 -1
  9. package/examples/advanced/custom-parser/sd.config.js +3 -2
  10. package/examples/advanced/custom-transforms/README.md +1 -1
  11. package/examples/advanced/custom-transforms/build.js +11 -8
  12. package/examples/advanced/custom-transforms/package.json +1 -1
  13. package/examples/advanced/font-face-rules/package.json +1 -1
  14. package/examples/advanced/font-face-rules/sd.config.js +2 -1
  15. package/examples/advanced/format-helpers/package.json +1 -1
  16. package/examples/advanced/format-helpers/sd.config.js +3 -2
  17. package/examples/advanced/matching-build-files/config.js +15 -10
  18. package/examples/advanced/matching-build-files/package.json +1 -1
  19. package/examples/advanced/multi-brand-multi-platform/build.js +10 -7
  20. package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
  21. package/examples/advanced/node-modules-as-config-and-properties/config.js +17 -12
  22. package/examples/advanced/node-modules-as-config-and-properties/package.json +1 -1
  23. package/examples/advanced/npm-module/package.json +1 -1
  24. package/examples/advanced/referencing_aliasing/package.json +1 -1
  25. package/examples/advanced/s3/package.json +1 -1
  26. package/examples/advanced/tailwind-preset/README.md +94 -0
  27. package/examples/advanced/tailwind-preset/config/filter.js +3 -0
  28. package/examples/advanced/tailwind-preset/config/filter.test.js +12 -0
  29. package/examples/advanced/tailwind-preset/config/format.js +60 -0
  30. package/examples/advanced/tailwind-preset/config/transform.js +21 -0
  31. package/examples/advanced/tailwind-preset/config/transform.test.js +37 -0
  32. package/examples/advanced/tailwind-preset/config.js +55 -0
  33. package/examples/advanced/tailwind-preset/demo/index.html +27 -0
  34. package/examples/advanced/tailwind-preset/demo/input.css +3 -0
  35. package/examples/advanced/tailwind-preset/package.json +18 -0
  36. package/examples/advanced/tailwind-preset/tailwind.config.js +11 -0
  37. package/examples/advanced/tailwind-preset/tokens/tokens.json +49 -0
  38. package/examples/advanced/tokens-deprecation/build.js +2 -1
  39. package/examples/advanced/tokens-deprecation/package.json +1 -1
  40. package/examples/advanced/transitive-transforms/package.json +1 -1
  41. package/examples/advanced/transitive-transforms/sd.config.js +12 -9
  42. package/examples/advanced/variables-in-outputs/package.json +1 -1
  43. package/examples/advanced/variables-in-outputs/sd.config.js +10 -5
  44. package/examples/advanced/yaml-tokens/package.json +1 -1
  45. package/examples/advanced/yaml-tokens/sd.config.js +3 -2
  46. package/lib/Register.d.ts +2 -2
  47. package/lib/Register.js +6 -3
  48. package/lib/StyleDictionary.d.ts +20 -18
  49. package/lib/StyleDictionary.js +89 -71
  50. package/lib/cleanActions.d.ts +1 -1
  51. package/lib/cleanDir.d.ts +1 -1
  52. package/lib/cleanDir.js +2 -1
  53. package/lib/cleanDirs.d.ts +1 -1
  54. package/lib/cleanFile.d.ts +1 -6
  55. package/lib/cleanFile.js +5 -2
  56. package/lib/cleanFiles.d.ts +1 -1
  57. package/lib/common/actions.d.ts +20 -1
  58. package/lib/common/actions.js +8 -4
  59. package/lib/common/filters.d.ts +7 -1
  60. package/lib/common/formatHelpers/createPropertyFormatter.d.ts +3 -1
  61. package/lib/common/formatHelpers/createPropertyFormatter.js +26 -19
  62. package/lib/common/formatHelpers/fileHeader.d.ts +1 -1
  63. package/lib/common/formatHelpers/fileHeader.js +4 -2
  64. package/lib/common/formatHelpers/formattedVariables.d.ts +3 -1
  65. package/lib/common/formatHelpers/formattedVariables.js +3 -1
  66. package/lib/common/formatHelpers/getTypeScriptType.d.ts +2 -2
  67. package/lib/common/formatHelpers/minifyDictionary.d.ts +1 -1
  68. package/lib/common/formatHelpers/setComposeObjectProperties.d.ts +1 -1
  69. package/lib/common/formatHelpers/setSwiftFileProperties.d.ts +1 -1
  70. package/lib/common/formatHelpers/sortByReference.d.ts +1 -1
  71. package/lib/common/formats.js +235 -162
  72. package/lib/common/templates/compose/object.kt.template.js +8 -4
  73. package/lib/common/templates/css/fonts.css.template.js +2 -2
  74. package/lib/common/templates/scss/map-flat.template.js +4 -3
  75. package/lib/common/transformGroups.d.ts +209 -1
  76. package/lib/common/transformGroups.js +139 -93
  77. package/lib/common/transforms.d.ts +961 -1
  78. package/lib/common/transforms.js +113 -111
  79. package/lib/enums/actions.d.ts +4 -0
  80. package/lib/enums/actions.js +4 -0
  81. package/lib/enums/commentPositions.d.ts +4 -0
  82. package/lib/enums/commentPositions.js +4 -0
  83. package/lib/enums/commentStyles.d.ts +5 -0
  84. package/lib/enums/commentStyles.js +5 -0
  85. package/lib/enums/fileHeaderCommentStyles.d.ts +5 -0
  86. package/lib/enums/fileHeaderCommentStyles.js +5 -0
  87. package/lib/enums/formats.d.ts +46 -0
  88. package/lib/enums/formats.js +50 -0
  89. package/lib/enums/index.d.ts +12 -0
  90. package/lib/enums/index.js +12 -0
  91. package/lib/enums/logBrokenReferenceLevels.d.ts +5 -0
  92. package/lib/enums/logBrokenReferenceLevels.js +4 -0
  93. package/lib/enums/logVerbosityLevels.d.ts +6 -0
  94. package/lib/enums/logVerbosityLevels.js +5 -0
  95. package/lib/enums/logWarningLevels.d.ts +5 -0
  96. package/lib/enums/logWarningLevels.js +5 -0
  97. package/lib/enums/propertyFormatNames.d.ts +6 -0
  98. package/lib/enums/propertyFormatNames.js +6 -0
  99. package/lib/enums/transformGroups.d.ts +17 -0
  100. package/lib/enums/transformGroups.js +17 -0
  101. package/lib/enums/transformTypes.d.ts +5 -0
  102. package/lib/enums/transformTypes.js +5 -0
  103. package/lib/enums/transforms.d.ts +57 -0
  104. package/lib/enums/transforms.js +57 -0
  105. package/lib/filterTokens.d.ts +1 -1
  106. package/lib/filterTokens.js +5 -0
  107. package/lib/fs.d.ts +1 -1
  108. package/lib/fs.js +1 -1
  109. package/lib/performActions.d.ts +1 -1
  110. package/lib/resolve.d.ts +1 -1
  111. package/lib/resolve.js +4 -3
  112. package/lib/transform/config.js +3 -2
  113. package/lib/transform/object.d.ts +1 -1
  114. package/lib/transform/token.d.ts +1 -9
  115. package/lib/transform/token.js +10 -3
  116. package/lib/utils/cleanActions.d.ts +1 -1
  117. package/lib/utils/combineJSON.d.ts +1 -1
  118. package/lib/utils/combineJSON.js +12 -32
  119. package/lib/utils/convertToBase64.d.ts +1 -1
  120. package/lib/utils/convertToDTCG.d.ts +3 -3
  121. package/lib/utils/convertTokenData.d.ts +30 -0
  122. package/lib/utils/convertTokenData.js +123 -0
  123. package/lib/utils/deepExtend.d.ts +1 -1
  124. package/lib/utils/deepmerge.d.ts +1 -1
  125. package/lib/utils/expandObjectTokens.d.ts +2 -2
  126. package/lib/utils/expandObjectTokens.js +1 -1
  127. package/lib/utils/flattenTokens.d.ts +9 -5
  128. package/lib/utils/flattenTokens.js +28 -16
  129. package/lib/utils/index.d.ts +2 -1
  130. package/lib/utils/index.js +3 -0
  131. package/lib/utils/loadFile.d.ts +13 -0
  132. package/lib/utils/loadFile.js +89 -0
  133. package/lib/utils/preprocess.d.ts +1 -1
  134. package/lib/utils/references/defaults.d.ts +5 -1
  135. package/lib/utils/references/getName.d.ts +1 -1
  136. package/lib/utils/references/getReferences.d.ts +1 -1
  137. package/lib/utils/references/outputReferencesTransformed.js +1 -1
  138. package/lib/utils/references/resolveReferences.d.ts +2 -2
  139. package/lib/utils/references/usesReferences.d.ts +1 -1
  140. package/package.json +27 -16
  141. package/types/Config.d.ts +9 -3
  142. package/types/DesignToken.d.ts +6 -0
  143. package/types/File.d.ts +6 -2
  144. package/types/Format.d.ts +4 -1
  145. package/types/Transform.d.ts +4 -3
@@ -16,6 +16,7 @@ import { join } from 'path-unified';
16
16
  import { snakeCase, kebabCase, camelCase } from 'change-case';
17
17
  import convertToBase64 from '../utils/convertToBase64.js';
18
18
  import GroupMessages from '../utils/groupMessages.js';
19
+ import { transforms, transformTypes } from '../enums/index.js';
19
20
 
20
21
  /**
21
22
  * @typedef {import('../../types/Transform.d.ts').Transform} Transform
@@ -25,6 +26,7 @@ import GroupMessages from '../utils/groupMessages.js';
25
26
  */
26
27
 
27
28
  const UNKNOWN_CSS_FONT_PROPS_WARNINGS = GroupMessages.GROUP.UnknownCSSFontProperties;
29
+ const { value, name, attribute } = transformTypes;
28
30
 
29
31
  /**
30
32
  * @param {string} str
@@ -222,8 +224,8 @@ export default {
222
224
  *
223
225
  * @memberof Transforms
224
226
  */
225
- 'attribute/cti': {
226
- type: 'attribute',
227
+ [transforms.attributeCti]: {
228
+ type: attribute,
227
229
  transform: function (token) {
228
230
  const attrNames = ['category', 'type', 'item', 'subitem', 'state'];
229
231
  const originalAttrs = token.attributes || {};
@@ -254,8 +256,8 @@ export default {
254
256
  *
255
257
  * @memberof Transforms
256
258
  */
257
- 'attribute/color': {
258
- type: 'attribute',
259
+ [transforms.attributeColor]: {
260
+ type: attribute,
259
261
  filter: isColor,
260
262
  transform: function (token, _, options) {
261
263
  const color = Color(options.usesDtcg ? token.$value : token.value);
@@ -279,8 +281,8 @@ export default {
279
281
  *
280
282
  * @memberof Transforms
281
283
  */
282
- 'name/human': {
283
- type: 'name',
284
+ [transforms.nameHuman]: {
285
+ type: name,
284
286
  transform: function (token) {
285
287
  return [token.attributes?.item, token.attributes?.subitem].join(' ');
286
288
  },
@@ -298,8 +300,8 @@ export default {
298
300
  *
299
301
  * @memberof Transforms
300
302
  */
301
- 'name/camel': {
302
- type: 'name',
303
+ [transforms.nameCamel]: {
304
+ type: name,
303
305
  transform: function (token, config) {
304
306
  return camelCase([config.prefix].concat(token.path).join(' '), camelOpts);
305
307
  },
@@ -317,8 +319,8 @@ export default {
317
319
  *
318
320
  * @memberof Transforms
319
321
  */
320
- 'name/kebab': {
321
- type: 'name',
322
+ [transforms.nameKebab]: {
323
+ type: name,
322
324
  transform: function (token, config) {
323
325
  return kebabCase([config.prefix].concat(token.path).join(' '));
324
326
  },
@@ -336,8 +338,8 @@ export default {
336
338
  *
337
339
  * @memberof Transforms
338
340
  */
339
- 'name/snake': {
340
- type: 'name',
341
+ [transforms.nameSnake]: {
342
+ type: name,
341
343
  transform: function (token, config) {
342
344
  return snakeCase([config.prefix].concat(token.path).join(' '));
343
345
  },
@@ -355,8 +357,8 @@ export default {
355
357
  *
356
358
  * @memberof Transforms
357
359
  */
358
- 'name/constant': {
359
- type: 'name',
360
+ [transforms.nameConstant]: {
361
+ type: name,
360
362
  transform: function (token, config) {
361
363
  return snakeCase([config.prefix].concat(token.path).join(' ')).toUpperCase();
362
364
  },
@@ -374,8 +376,8 @@ export default {
374
376
  *
375
377
  * @memberof Transforms
376
378
  */
377
- 'name/pascal': {
378
- type: 'name',
379
+ [transforms.namePascal]: {
380
+ type: name,
379
381
  transform: function (token, config) {
380
382
  /** @param {string} str */
381
383
  const upperFirst = function (str) {
@@ -396,8 +398,8 @@ export default {
396
398
  *
397
399
  * @memberof Transforms
398
400
  */
399
- 'color/rgb': {
400
- type: 'value',
401
+ [transforms.colorRgb]: {
402
+ type: value,
401
403
  filter: isColor,
402
404
  transform: function (token, _, options) {
403
405
  return Color(options.usesDtcg ? token.$value : token.value).toRgbString();
@@ -416,8 +418,8 @@ export default {
416
418
  *
417
419
  * @memberof Transforms
418
420
  */
419
- 'color/hsl': {
420
- type: 'value',
421
+ [transforms.colorHsl]: {
422
+ type: value,
421
423
  filter: isColor,
422
424
  transform: function (token, _, options) {
423
425
  return Color(options.usesDtcg ? token.$value : token.value).toHslString();
@@ -436,8 +438,8 @@ export default {
436
438
  *
437
439
  * @memberof Transforms
438
440
  */
439
- 'color/hsl-4': {
440
- type: 'value',
441
+ [transforms.colorHsl4]: {
442
+ type: value,
441
443
  filter: isColor,
442
444
  transform: function (token, _, options) {
443
445
  const color = Color(options.usesDtcg ? token.$value : token.value);
@@ -462,8 +464,8 @@ export default {
462
464
  *
463
465
  * @memberof Transforms
464
466
  */
465
- 'color/hex': {
466
- type: 'value',
467
+ [transforms.colorHex]: {
468
+ type: value,
467
469
  filter: isColor,
468
470
  transform: function (token, _, options) {
469
471
  return Color(options.usesDtcg ? token.$value : token.value).toHexString();
@@ -481,8 +483,8 @@ export default {
481
483
  *
482
484
  * @memberof Transforms
483
485
  */
484
- 'color/hex8': {
485
- type: 'value',
486
+ [transforms.colorHex8]: {
487
+ type: value,
486
488
  filter: isColor,
487
489
  transform: function (token, _, options) {
488
490
  return Color(options.usesDtcg ? token.$value : token.value).toHex8String();
@@ -500,8 +502,8 @@ export default {
500
502
  *
501
503
  * @memberof Transforms
502
504
  */
503
- 'color/hex8android': {
504
- type: 'value',
505
+ [transforms.colorHex8android]: {
506
+ type: value,
505
507
  filter: isColor,
506
508
  transform: function (token, _, options) {
507
509
  const str = Color(options.usesDtcg ? token.$value : token.value).toHex8();
@@ -520,8 +522,8 @@ export default {
520
522
  *
521
523
  * @memberof Transforms
522
524
  */
523
- 'color/composeColor': {
524
- type: 'value',
525
+ [transforms.colorComposeColor]: {
526
+ type: value,
525
527
  filter: isColor,
526
528
  transform: function (token, _, options) {
527
529
  const str = Color(options.usesDtcg ? token.$value : token.value).toHex8();
@@ -540,8 +542,8 @@ export default {
540
542
  *
541
543
  * @memberof Transforms
542
544
  */
543
- 'color/UIColor': {
544
- type: 'value',
545
+ [transforms.colorUIColor]: {
546
+ type: value,
545
547
  filter: isColor,
546
548
  transform: function (token, _, options) {
547
549
  const rgb = Color(options.usesDtcg ? token.$value : token.value).toRgb();
@@ -573,8 +575,8 @@ export default {
573
575
  *
574
576
  * @memberof Transforms
575
577
  */
576
- 'color/UIColorSwift': {
577
- type: 'value',
578
+ [transforms.colorUIColorSwift]: {
579
+ type: value,
578
580
  filter: isColor,
579
581
  transform: function (token, _, options) {
580
582
  const { r, g, b, a } = Color(options.usesDtcg ? token.$value : token.value).toRgb();
@@ -596,8 +598,8 @@ export default {
596
598
  *
597
599
  * @memberof Transforms
598
600
  */
599
- 'color/ColorSwiftUI': {
600
- type: 'value',
601
+ [transforms.colorColorSwiftUI]: {
602
+ type: value,
601
603
  filter: isColor,
602
604
  transform: function (token, _, options) {
603
605
  const { r, g, b, a } = Color(options.usesDtcg ? token.$value : token.value).toRgb();
@@ -620,8 +622,8 @@ export default {
620
622
  *
621
623
  * @memberof Transforms
622
624
  */
623
- 'color/css': {
624
- type: 'value',
625
+ [transforms.colorCss]: {
626
+ type: value,
625
627
  filter: isColor,
626
628
  transform: function (token, _, options) {
627
629
  const color = Color(options.usesDtcg ? token.$value : token.value);
@@ -651,8 +653,8 @@ export default {
651
653
  * ```
652
654
  * @memberof Transforms
653
655
  */
654
- 'color/sketch': {
655
- type: 'value',
656
+ [transforms.colorSketch]: {
657
+ type: value,
656
658
  filter: isColor,
657
659
  transform: function (token, _, options) {
658
660
  let color = Color(options.usesDtcg ? token.$value : token.value).toRgb();
@@ -676,8 +678,8 @@ export default {
676
678
  *
677
679
  * @memberof Transforms
678
680
  */
679
- 'size/sp': {
680
- type: 'value',
681
+ [transforms.sizeSp]: {
682
+ type: value,
681
683
  filter: isFontSize,
682
684
  transform: function (token, _, options) {
683
685
  const nonParsedVal = options.usesDtcg ? token.$value : token.value;
@@ -698,8 +700,8 @@ export default {
698
700
  *
699
701
  * @memberof Transforms
700
702
  */
701
- 'size/dp': {
702
- type: 'value',
703
+ [transforms.sizeDp]: {
704
+ type: value,
703
705
  filter: isDimension,
704
706
  transform: function (token, _, options) {
705
707
  const nonParsedVal = options.usesDtcg ? token.$value : token.value;
@@ -725,8 +727,8 @@ export default {
725
727
  *
726
728
  * @memberof Transforms
727
729
  */
728
- 'size/object': {
729
- type: 'value',
730
+ [transforms.sizeObject]: {
731
+ type: value,
730
732
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
731
733
  transform: function (token, config, options) {
732
734
  const value = options.usesDtcg ? token.$value : token.value;
@@ -753,8 +755,8 @@ export default {
753
755
  *
754
756
  * @memberof Transforms
755
757
  */
756
- 'size/remToSp': {
757
- type: 'value',
758
+ [transforms.sizeRemToSp]: {
759
+ type: value,
758
760
  filter: isFontSize,
759
761
  transform: function (token, config, options) {
760
762
  const value = options.usesDtcg ? token.$value : token.value;
@@ -776,8 +778,8 @@ export default {
776
778
  *
777
779
  * @memberof Transforms
778
780
  */
779
- 'size/remToDp': {
780
- type: 'value',
781
+ [transforms.sizeRemToDp]: {
782
+ type: value,
781
783
  filter: isDimension,
782
784
  transform: function (token, config, options) {
783
785
  const value = options.usesDtcg ? token.$value : token.value;
@@ -799,8 +801,8 @@ export default {
799
801
  *
800
802
  * @memberof Transforms
801
803
  */
802
- 'size/px': {
803
- type: 'value',
804
+ [transforms.sizePx]: {
805
+ type: value,
804
806
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
805
807
  transform: function (token, _, options) {
806
808
  const value = options.usesDtcg ? token.$value : token.value;
@@ -821,13 +823,13 @@ export default {
821
823
  *
822
824
  * @memberof Transforms
823
825
  */
824
- 'size/rem': {
825
- type: 'value',
826
+ [transforms.sizeRem]: {
827
+ type: value,
826
828
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
827
829
  transform: function (token, _, options) {
828
830
  const nonParsed = options.usesDtcg ? token.$value : token.value;
829
831
  // if the dimension already has a unit (non-digit / . period character)
830
- if (`${nonParsed}`.match(/[^0-9.]/g)) {
832
+ if (`${nonParsed}`.match(/^[^0-9.-]+$/)) {
831
833
  return nonParsed;
832
834
  }
833
835
  const parsedVal = parseFloat(nonParsed);
@@ -848,8 +850,8 @@ export default {
848
850
  *
849
851
  * @memberof Transforms
850
852
  */
851
- 'size/remToPt': {
852
- type: 'value',
853
+ [transforms.sizeRemToPt]: {
854
+ type: value,
853
855
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
854
856
  transform: function (token, config, options) {
855
857
  const value = options.usesDtcg ? token.$value : token.value;
@@ -871,8 +873,8 @@ export default {
871
873
  *
872
874
  * @memberof Transforms
873
875
  */
874
- 'size/compose/remToSp': {
875
- type: 'value',
876
+ [transforms.sizeComposeRemToSp]: {
877
+ type: value,
876
878
  filter: isFontSize,
877
879
  transform: function (token, config, options) {
878
880
  const value = options.usesDtcg ? token.$value : token.value;
@@ -894,8 +896,8 @@ export default {
894
896
  *
895
897
  * @memberof Transforms
896
898
  */
897
- 'size/compose/remToDp': {
898
- type: 'value',
899
+ [transforms.sizeComposeRemToDp]: {
900
+ type: value,
899
901
  filter: isDimension,
900
902
  transform: function (token, config, options) {
901
903
  const value = options.usesDtcg ? token.$value : token.value;
@@ -917,8 +919,8 @@ export default {
917
919
  *
918
920
  * @memberof Transforms
919
921
  */
920
- 'size/compose/em': {
921
- type: 'value',
922
+ [transforms.sizeComposeEm]: {
923
+ type: value,
922
924
  filter: isFontSize,
923
925
  transform: function (token, _, options) {
924
926
  const value = options.usesDtcg ? token.$value : token.value;
@@ -938,8 +940,8 @@ export default {
938
940
  *
939
941
  * @memberof Transforms
940
942
  */
941
- 'size/swift/remToCGFloat': {
942
- type: 'value',
943
+ [transforms.sizeSwiftRemToCGFloat]: {
944
+ type: value,
943
945
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
944
946
  transform: function (token, config, options) {
945
947
  const value = options.usesDtcg ? token.$value : token.value;
@@ -961,8 +963,8 @@ export default {
961
963
  *
962
964
  * @memberof Transforms
963
965
  */
964
- 'size/remToPx': {
965
- type: 'value',
966
+ [transforms.sizeRemToPx]: {
967
+ type: value,
966
968
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
967
969
  transform: function (token, config, options) {
968
970
  const value = options.usesDtcg ? token.$value : token.value;
@@ -985,8 +987,8 @@ export default {
985
987
  *
986
988
  * @memberof Transforms
987
989
  */
988
- 'size/pxToRem': {
989
- type: 'value',
990
+ [transforms.sizePxToRem]: {
991
+ type: value,
990
992
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
991
993
  transform: (token, config, options) => {
992
994
  const value = options.usesDtcg ? token.$value : token.value;
@@ -1016,8 +1018,8 @@ export default {
1016
1018
  *
1017
1019
  * @memberof Transforms
1018
1020
  */
1019
- 'html/icon': {
1020
- type: 'value',
1021
+ [transforms.htmlIcon]: {
1022
+ type: value,
1021
1023
  filter: function (token, options) {
1022
1024
  return (options.usesDtcg ? token.$type : token.type) === 'html';
1023
1025
  },
@@ -1045,8 +1047,8 @@ export default {
1045
1047
  *
1046
1048
  * @memberof Transforms
1047
1049
  */
1048
- 'content/quote': {
1049
- type: 'value',
1050
+ [transforms.contentQuote]: {
1051
+ type: value,
1050
1052
  filter: isContent,
1051
1053
  transform: function (token, _, options) {
1052
1054
  return wrapValueWith("'", token, options);
@@ -1064,8 +1066,8 @@ export default {
1064
1066
  *
1065
1067
  * @memberof Transforms
1066
1068
  */
1067
- 'content/objC/literal': {
1068
- type: 'value',
1069
+ [transforms.contentObjCLiteral]: {
1070
+ type: value,
1069
1071
  filter: isContent,
1070
1072
  transform: function (token, _, options) {
1071
1073
  return '@' + wrapValueWithDoubleQuote(token, options);
@@ -1083,8 +1085,8 @@ export default {
1083
1085
  *
1084
1086
  * @memberof Transforms
1085
1087
  */
1086
- 'content/swift/literal': {
1087
- type: 'value',
1088
+ [transforms.contentSwiftLiteral]: {
1089
+ type: value,
1088
1090
  filter: isContent,
1089
1091
  transform: (token, _, options) => wrapValueWithDoubleQuote(token, options),
1090
1092
  },
@@ -1100,8 +1102,8 @@ export default {
1100
1102
  *
1101
1103
  * @memberof Transforms
1102
1104
  */
1103
- 'time/seconds': {
1104
- type: 'value',
1105
+ [transforms.timeSeconds]: {
1106
+ type: value,
1105
1107
  filter: function (token, options) {
1106
1108
  return (options.usesDtcg ? token.$type : token.type) === 'time';
1107
1109
  },
@@ -1123,8 +1125,8 @@ export default {
1123
1125
  *
1124
1126
  * @memberof Transforms
1125
1127
  */
1126
- 'fontFamily/css': {
1127
- type: 'value',
1128
+ [transforms.fontFamilyCss]: {
1129
+ type: value,
1128
1130
  // typography properties can be references, while fontFamily prop might not
1129
1131
  transitive: true,
1130
1132
  filter: (token, options) => {
@@ -1149,8 +1151,8 @@ export default {
1149
1151
  *
1150
1152
  * @memberof Transforms
1151
1153
  */
1152
- 'cubicBezier/css': {
1153
- type: 'value',
1154
+ [transforms.cubicBezierCss]: {
1155
+ type: value,
1154
1156
  // transition properties can be references, while timingFunction might not be
1155
1157
  transitive: true,
1156
1158
  filter: (token, options) => {
@@ -1175,8 +1177,8 @@ export default {
1175
1177
  *
1176
1178
  * @memberof Transforms
1177
1179
  */
1178
- 'strokeStyle/css/shorthand': {
1179
- type: 'value',
1180
+ [transforms.strokeStyleCssShorthand]: {
1181
+ type: value,
1180
1182
  // border properties can be references, while style property might not be
1181
1183
  transitive: true,
1182
1184
  filter: (token, options) => (options.usesDtcg ? token.$type : token.type) === 'strokeStyle',
@@ -1202,8 +1204,8 @@ export default {
1202
1204
  *
1203
1205
  * @memberof Transforms
1204
1206
  */
1205
- 'border/css/shorthand': {
1206
- type: 'value',
1207
+ [transforms.borderCssShorthand]: {
1208
+ type: value,
1207
1209
  // border properties can be references
1208
1210
  transitive: true,
1209
1211
  filter: (token, options) => (options.usesDtcg ? token.$type : token.type) === 'border',
@@ -1242,8 +1244,8 @@ export default {
1242
1244
  *
1243
1245
  * @memberof Transforms
1244
1246
  */
1245
- 'typography/css/shorthand': {
1246
- type: 'value',
1247
+ [transforms.typographyCssShorthand]: {
1248
+ type: value,
1247
1249
  // typography properties can be references
1248
1250
  transitive: true,
1249
1251
  filter: (token, options) => (options.usesDtcg ? token.$type : token.type) === 'typography',
@@ -1298,8 +1300,8 @@ export default {
1298
1300
  *
1299
1301
  * @memberof Transforms
1300
1302
  */
1301
- 'transition/css/shorthand': {
1302
- type: 'value',
1303
+ [transforms.transitionCssShorthand]: {
1304
+ type: value,
1303
1305
  // transition properties can be references
1304
1306
  transitive: true,
1305
1307
  filter: (token, options) => (options.usesDtcg ? token.$type : token.type) === 'transition',
@@ -1327,8 +1329,8 @@ export default {
1327
1329
  *
1328
1330
  * @memberof Transforms
1329
1331
  */
1330
- 'shadow/css/shorthand': {
1331
- type: 'value',
1332
+ [transforms.shadowCssShorthand]: {
1333
+ type: value,
1332
1334
  // shadow properties can be references
1333
1335
  transitive: true,
1334
1336
  filter: (token, options) => (options.usesDtcg ? token.$type : token.type) === 'shadow',
@@ -1369,8 +1371,8 @@ export default {
1369
1371
  *
1370
1372
  * @memberof Transforms
1371
1373
  */
1372
- 'asset/url': {
1373
- type: 'value',
1374
+ [transforms.assetUrl]: {
1375
+ type: value,
1374
1376
  filter: isAsset,
1375
1377
  transform: function (token, _, options) {
1376
1378
  return `url("${(options.usesDtcg ? token.$value : token.value).replace(/"/g, `\\"`)}")`;
@@ -1388,8 +1390,8 @@ export default {
1388
1390
  *
1389
1391
  * @memberof Transforms
1390
1392
  */
1391
- 'asset/base64': {
1392
- type: 'value',
1393
+ [transforms.assetBase64]: {
1394
+ type: value,
1393
1395
  filter: isAsset,
1394
1396
  transform: function (token, _, options, vol) {
1395
1397
  return convertToBase64(options.usesDtcg ? token.$value : token.value, vol);
@@ -1407,8 +1409,8 @@ export default {
1407
1409
  *
1408
1410
  * @memberof Transforms
1409
1411
  */
1410
- 'asset/path': {
1411
- type: 'value',
1412
+ [transforms.assetPath]: {
1413
+ type: value,
1412
1414
  filter: isAsset,
1413
1415
  transform: function (token, _, options) {
1414
1416
  return join(process?.cwd() ?? '/', options.usesDtcg ? token.$value : token.value);
@@ -1425,8 +1427,8 @@ export default {
1425
1427
  *
1426
1428
  * @memberof Transforms
1427
1429
  */
1428
- 'asset/objC/literal': {
1429
- type: 'value',
1430
+ [transforms.assetObjCLiteral]: {
1431
+ type: value,
1430
1432
  filter: isAsset,
1431
1433
  transform: function (token, _, options) {
1432
1434
  return '@' + wrapValueWithDoubleQuote(token, options);
@@ -1443,8 +1445,8 @@ export default {
1443
1445
  *
1444
1446
  * @memberof Transforms
1445
1447
  */
1446
- 'asset/swift/literal': {
1447
- type: 'value',
1448
+ [transforms.assetSwiftLiteral]: {
1449
+ type: value,
1448
1450
  filter: isAsset,
1449
1451
  transform: (token, _, options) => wrapValueWithDoubleQuote(token, options),
1450
1452
  },
@@ -1459,8 +1461,8 @@ export default {
1459
1461
  * @memberof Transforms
1460
1462
  *
1461
1463
  */
1462
- 'color/hex8flutter': {
1463
- type: 'value',
1464
+ [transforms.colorHex8flutter]: {
1465
+ type: value,
1464
1466
  filter: isColor,
1465
1467
  transform: function (token, _, options) {
1466
1468
  const str = Color(options.usesDtcg ? token.$value : token.value)
@@ -1480,8 +1482,8 @@ export default {
1480
1482
  *
1481
1483
  * @memberof Transforms
1482
1484
  */
1483
- 'content/flutter/literal': {
1484
- type: 'value',
1485
+ [transforms.contentFlutterLiteral]: {
1486
+ type: value,
1485
1487
  filter: isContent,
1486
1488
  transform: (token, _, options) => wrapValueWithDoubleQuote(token, options),
1487
1489
  },
@@ -1496,8 +1498,8 @@ export default {
1496
1498
  *
1497
1499
  * @memberof Transforms
1498
1500
  */
1499
- 'asset/flutter/literal': {
1500
- type: 'value',
1501
+ [transforms.assetFlutterLiteral]: {
1502
+ type: value,
1501
1503
  filter: isAsset,
1502
1504
  transform: (token, _, options) => wrapValueWithDoubleQuote(token, options),
1503
1505
  },
@@ -1512,8 +1514,8 @@ export default {
1512
1514
  *
1513
1515
  * @memberof Transforms
1514
1516
  */
1515
- 'size/flutter/remToDouble': {
1516
- type: 'value',
1517
+ [transforms.sizeFlutterRemToDouble]: {
1518
+ type: value,
1517
1519
  filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
1518
1520
  transform: function (token, config, options) {
1519
1521
  const baseFont = getBasePxFontSize(config);
@@ -0,0 +1,4 @@
1
+ export namespace actions {
2
+ let androidCopyImages: "android/copyImages";
3
+ let copyAssets: "copy_assets";
4
+ }
@@ -0,0 +1,4 @@
1
+ export const actions = {
2
+ androidCopyImages: /** @type {'android/copyImages'} */ ('android/copyImages'),
3
+ copyAssets: /** @type {'copy_assets'} */ ('copy_assets'),
4
+ };
@@ -0,0 +1,4 @@
1
+ export namespace commentPositions {
2
+ let above: "above";
3
+ let inline: "inline";
4
+ }
@@ -0,0 +1,4 @@
1
+ export const commentPositions = {
2
+ above: /** @type {'above'} */ ('above'),
3
+ inline: /** @type {'inline'} */ ('inline'),
4
+ };
@@ -0,0 +1,5 @@
1
+ export namespace commentStyles {
2
+ let short: "short";
3
+ let long: "long";
4
+ let none: "none";
5
+ }
@@ -0,0 +1,5 @@
1
+ export const commentStyles = {
2
+ short: /** @type {'short'} */ ('short'),
3
+ long: /** @type {'long'} */ ('long'),
4
+ none: /** @type {'none'} */ ('none'),
5
+ };
@@ -0,0 +1,5 @@
1
+ export namespace fileHeaderCommentStyles {
2
+ let short: "short";
3
+ let long: "long";
4
+ let xml: "xml";
5
+ }
@@ -0,0 +1,5 @@
1
+ export const fileHeaderCommentStyles = {
2
+ short: /** @type {'short'} */ ('short'),
3
+ long: /** @type {'long'} */ ('long'),
4
+ xml: /** @type {'xml'} */ ('xml'),
5
+ };