@digdir/designsystemet 1.11.1 → 1.12.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 (100) hide show
  1. package/dist/bin/config.js +24 -4
  2. package/dist/bin/designsystemet.js +909 -1220
  3. package/dist/src/colors/index.js +27 -1
  4. package/dist/src/colors/types.d.ts +24 -21
  5. package/dist/src/colors/types.d.ts.map +1 -1
  6. package/dist/src/colors/types.js +27 -0
  7. package/dist/src/config.js +24 -4
  8. package/dist/src/index.js +815 -1119
  9. package/dist/src/scripts/createJsonSchema.js +24 -4
  10. package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
  11. package/dist/src/scripts/update-preview-tokens.js +1356 -1662
  12. package/dist/src/tokens/build.js +4 -5
  13. package/dist/src/tokens/create/generators/$designsystemet.js +4 -5
  14. package/dist/src/tokens/create/generators/$metadata.d.ts +2 -2
  15. package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
  16. package/dist/src/tokens/create/generators/$metadata.js +3 -7
  17. package/dist/src/tokens/create/generators/$themes.d.ts +17 -2
  18. package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
  19. package/dist/src/tokens/create/generators/$themes.js +3 -3
  20. package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts +5 -0
  21. package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts.map +1 -0
  22. package/dist/src/tokens/create/generators/{color.js → primitives/color-scheme.js} +29 -6
  23. package/dist/src/tokens/create/generators/primitives/globals.d.ts +3 -0
  24. package/dist/src/tokens/create/generators/primitives/globals.d.ts.map +1 -0
  25. package/dist/src/tokens/create/generators/primitives/globals.js +148 -0
  26. package/dist/src/tokens/create/generators/primitives/size.d.ts +4 -0
  27. package/dist/src/tokens/create/generators/primitives/size.d.ts.map +1 -0
  28. package/dist/src/tokens/create/generators/primitives/size.js +157 -0
  29. package/dist/src/tokens/create/generators/primitives/typography.d.ts +4 -0
  30. package/dist/src/tokens/create/generators/primitives/typography.d.ts.map +1 -0
  31. package/dist/src/tokens/create/generators/primitives/typography.js +220 -0
  32. package/dist/src/tokens/create/generators/semantic/color-modes.d.ts +8 -0
  33. package/dist/src/tokens/create/generators/semantic/color-modes.d.ts.map +1 -0
  34. package/dist/src/tokens/create/generators/semantic/color-modes.js +61 -0
  35. package/dist/src/tokens/create/generators/semantic/color.d.ts +5 -0
  36. package/dist/src/tokens/create/generators/semantic/color.d.ts.map +1 -0
  37. package/dist/src/tokens/create/generators/{semantic.js → semantic/color.js} +50 -194
  38. package/dist/src/tokens/create/generators/semantic/style.d.ts +3 -0
  39. package/dist/src/tokens/create/generators/semantic/style.d.ts.map +1 -0
  40. package/dist/src/tokens/create/generators/semantic/style.js +384 -0
  41. package/dist/src/tokens/create/generators/{theme.d.ts → themes/theme.d.ts} +1 -1
  42. package/dist/src/tokens/create/generators/themes/theme.d.ts.map +1 -0
  43. package/dist/src/tokens/create/generators/{theme.js → themes/theme.js} +87 -129
  44. package/dist/src/tokens/create/write.d.ts.map +1 -1
  45. package/dist/src/tokens/create/write.js +13 -17
  46. package/dist/src/tokens/create.d.ts +1 -1
  47. package/dist/src/tokens/create.d.ts.map +1 -1
  48. package/dist/src/tokens/create.js +1340 -1647
  49. package/dist/src/tokens/format.d.ts.map +1 -1
  50. package/dist/src/tokens/format.js +1360 -1667
  51. package/dist/src/tokens/index.js +1360 -1667
  52. package/dist/src/tokens/process/output/declarations.js +4 -5
  53. package/dist/src/tokens/process/output/theme.js +4 -5
  54. package/dist/src/tokens/types.d.ts +7 -0
  55. package/dist/src/tokens/types.d.ts.map +1 -1
  56. package/package.json +5 -6
  57. package/dist/color.base.template-Z7YWN2TF.json +0 -22
  58. package/dist/color.template-LMPUQ72A.json +0 -66
  59. package/dist/color.template-XQNSHLTU.json +0 -66
  60. package/dist/global-Y35YADVH.json +0 -100
  61. package/dist/globals-76VAFMDF.json +0 -143
  62. package/dist/large-CIIHO7AY.json +0 -96
  63. package/dist/large-UUOZ6DYI.json +0 -16
  64. package/dist/medium-OQ7S7P4P.json +0 -16
  65. package/dist/medium-VSB2S4X3.json +0 -96
  66. package/dist/small-AEXJ6U7Z.json +0 -96
  67. package/dist/small-ZY4KOJWX.json +0 -16
  68. package/dist/src/scripts/update-template.d.ts +0 -2
  69. package/dist/src/scripts/update-template.d.ts.map +0 -1
  70. package/dist/src/scripts/update-template.js +0 -1366
  71. package/dist/src/tokens/create/defaults.d.ts +0 -7
  72. package/dist/src/tokens/create/defaults.d.ts.map +0 -1
  73. package/dist/src/tokens/create/defaults.js +0 -998
  74. package/dist/src/tokens/create/generators/color.d.ts +0 -5
  75. package/dist/src/tokens/create/generators/color.d.ts.map +0 -1
  76. package/dist/src/tokens/create/generators/semantic.d.ts +0 -32
  77. package/dist/src/tokens/create/generators/semantic.d.ts.map +0 -1
  78. package/dist/src/tokens/create/generators/theme.d.ts.map +0 -1
  79. package/dist/src/tokens/create/generators/typography.d.ts +0 -3
  80. package/dist/src/tokens/create/generators/typography.d.ts.map +0 -1
  81. package/dist/src/tokens/create/generators/typography.js +0 -33
  82. package/dist/src/tokens/template/design-tokens/primitives/globals.js +0 -5
  83. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +0 -5
  84. package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +0 -5
  85. package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +0 -5
  86. package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +0 -5
  87. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +0 -5
  88. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +0 -5
  89. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +0 -5
  90. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +0 -5
  91. package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +0 -5
  92. package/dist/src/tokens/template/design-tokens/semantic/color.template.js +0 -5
  93. package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +0 -5
  94. package/dist/src/tokens/template/design-tokens/semantic/style.js +0 -5
  95. package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +0 -5
  96. package/dist/src/tokens/template/design-tokens/themes/theme.template.js +0 -5
  97. package/dist/style-FP5XVCUD.json +0 -378
  98. package/dist/theme.base.template-Y4RMFBQY.json +0 -55
  99. package/dist/theme.template-CTQRNOMO.json +0 -66
  100. package/dist/typography.template-4N5YLH7F.json +0 -22
package/dist/src/index.js CHANGED
@@ -465,17 +465,123 @@ var getCssVariable = (colorType, colorNumber) => {
465
465
  return `--ds-color-${colorType}-${getColorMetadataByNumber(colorNumber).displayName.toLowerCase().replace(/\s/g, "-")}`;
466
466
  };
467
467
 
468
+ // src/colors/types.ts
469
+ import * as R3 from "ramda";
470
+ var semanticColorMap = {
471
+ "background-default": 1,
472
+ "background-tinted": 2,
473
+ "surface-default": 3,
474
+ "surface-tinted": 4,
475
+ "surface-hover": 5,
476
+ "surface-active": 6,
477
+ "border-subtle": 7,
478
+ "border-default": 8,
479
+ "border-strong": 9,
480
+ "text-subtle": 10,
481
+ "text-default": 11,
482
+ "base-default": 12,
483
+ "base-hover": 13,
484
+ "base-active": 14,
485
+ "base-contrast-subtle": 15,
486
+ "base-contrast-default": 16
487
+ };
488
+ var semanticColorNames = R3.keys(semanticColorMap);
489
+ var semanticColorNumbers = R3.values(semanticColorMap);
490
+
468
491
  // src/config.ts
469
492
  import pc from "picocolors";
470
493
  import * as R7 from "ramda";
471
494
  import { z } from "zod";
472
495
  import { fromError } from "zod-validation-error";
473
496
 
474
- // src/tokens/create/defaults.ts
475
- import * as R3 from "ramda";
497
+ // src/tokens/create/generators/primitives/color-scheme.ts
498
+ import * as R4 from "ramda";
499
+ var generateColor = (colorArray, overrides) => {
500
+ const obj = {};
501
+ const $type = "color";
502
+ for (const index in colorArray) {
503
+ const position = Number(index) + 1;
504
+ const overrideValue = overrides?.[position];
505
+ obj[position] = {
506
+ $type,
507
+ $value: overrideValue || colorArray[index].hex
508
+ };
509
+ }
510
+ return obj;
511
+ };
512
+ var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
513
+ const createColorOverrides = (colorName) => {
514
+ if (!overrides?.colors || !(colorName in overrides.colors)) {
515
+ return void 0;
516
+ }
517
+ const colorOverrides = overrides.colors[colorName];
518
+ const positionOverrides = {};
519
+ Object.entries(colorOverrides).forEach(([semanticTokenName, modeOverrides]) => {
520
+ const position = colorMetadata[semanticTokenName].number;
521
+ if (position) {
522
+ let overrideValue;
523
+ if (colorScheme2 === "light" && modeOverrides.light) {
524
+ overrideValue = modeOverrides.light;
525
+ } else if (colorScheme2 === "dark" && modeOverrides.dark) {
526
+ overrideValue = modeOverrides.dark;
527
+ }
528
+ if (overrideValue) {
529
+ positionOverrides[position] = overrideValue;
530
+ }
531
+ }
532
+ });
533
+ return Object.keys(positionOverrides).length > 0 ? positionOverrides : void 0;
534
+ };
535
+ const main = R4.mapObjIndexed(
536
+ (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
537
+ colors.main
538
+ );
539
+ const support = R4.mapObjIndexed(
540
+ (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
541
+ colors.support
542
+ );
543
+ const neutralColorScale = generateColorScale(colors.neutral, colorScheme2);
544
+ const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
545
+ const baseColorsWithOverrides = {
546
+ ...baseColors,
547
+ ...overrides?.severity
548
+ };
549
+ const globalColors = R4.mapObjIndexed(
550
+ (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
551
+ baseColorsWithOverrides
552
+ );
553
+ const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
554
+ const defaultLinkVisited = linkColor[12];
555
+ const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
556
+ const defaultFocusInner = neutralColorScale[0].hex;
557
+ const defaultFocusOuter = neutralColorScale[10].hex;
558
+ const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
559
+ const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
560
+ return {
561
+ [themeName]: {
562
+ ...main,
563
+ ...support,
564
+ neutral,
565
+ ...globalColors,
566
+ link: {
567
+ visited: linkOverride || defaultLinkVisited
568
+ },
569
+ focus: {
570
+ inner: {
571
+ $type: "color",
572
+ $value: focusInnerOverride || defaultFocusInner
573
+ },
574
+ outer: {
575
+ $type: "color",
576
+ $value: focusOuterOverride || defaultFocusOuter
577
+ }
578
+ }
579
+ }
580
+ };
581
+ };
476
582
 
477
- // src/tokens/template/design-tokens/primitives/globals.json with { type: 'json' }
478
- var globals_default = {
583
+ // src/tokens/create/generators/primitives/globals.ts
584
+ var globals = {
479
585
  "border-width": {
480
586
  "1": {
481
587
  $type: "borderWidth",
@@ -618,9 +724,10 @@ var globals_default = {
618
724
  }
619
725
  }
620
726
  };
727
+ var generateGlobals = () => globals;
621
728
 
622
- // src/tokens/template/design-tokens/primitives/modes/size/global.json with { type: 'json' }
623
- var global_default = {
729
+ // src/tokens/create/generators/primitives/size.ts
730
+ var global = {
624
731
  _size: {
625
732
  "0": {
626
733
  $type: "dimension",
@@ -720,540 +827,444 @@ var global_default = {
720
827
  }
721
828
  }
722
829
  };
723
-
724
- // src/tokens/template/design-tokens/primitives/modes/size/large.json with { type: 'json' }
725
- var large_default = {
726
- size: {
727
- "_mode-font-size": {
728
- $type: "dimension",
729
- $value: "21"
730
- },
731
- _base: {
732
- $type: "dimension",
733
- $value: "18"
734
- },
735
- _step: {
736
- $type: "dimension",
737
- $value: "4"
830
+ var sizeModes = {
831
+ large: {
832
+ size: {
833
+ "_mode-font-size": {
834
+ $type: "dimension",
835
+ $value: "21"
836
+ },
837
+ _base: {
838
+ $type: "dimension",
839
+ $value: "18"
840
+ },
841
+ _step: {
842
+ $type: "dimension",
843
+ $value: "4"
844
+ }
845
+ }
846
+ },
847
+ medium: {
848
+ size: {
849
+ "_mode-font-size": {
850
+ $type: "dimension",
851
+ $value: "18"
852
+ },
853
+ _base: {
854
+ $type: "dimension",
855
+ $value: "18"
856
+ },
857
+ _step: {
858
+ $type: "dimension",
859
+ $value: "4"
860
+ }
861
+ }
862
+ },
863
+ small: {
864
+ size: {
865
+ "_mode-font-size": {
866
+ $type: "dimension",
867
+ $value: "16"
868
+ },
869
+ _base: {
870
+ $type: "dimension",
871
+ $value: "18"
872
+ },
873
+ _step: {
874
+ $type: "dimension",
875
+ $value: "4"
876
+ }
738
877
  }
739
878
  }
740
879
  };
880
+ var generateSize = (size2) => sizeModes[size2];
881
+ var generateSizeGlobal = () => global;
741
882
 
742
- // src/tokens/template/design-tokens/primitives/modes/size/medium.json with { type: 'json' }
743
- var medium_default = {
744
- size: {
745
- "_mode-font-size": {
746
- $type: "dimension",
747
- $value: "18"
748
- },
749
- _base: {
750
- $type: "dimension",
751
- $value: "18"
883
+ // src/tokens/create/generators/primitives/typography.ts
884
+ var generateTypography = (themeName, { fontFamily }) => ({
885
+ [themeName]: {
886
+ "font-family": {
887
+ $type: "fontFamilies",
888
+ $value: fontFamily
752
889
  },
753
- _step: {
754
- $type: "dimension",
755
- $value: "4"
890
+ "font-weight": {
891
+ medium: {
892
+ $type: "fontWeights",
893
+ $value: "Medium"
894
+ },
895
+ semibold: {
896
+ $type: "fontWeights",
897
+ $value: "Semi bold"
898
+ },
899
+ regular: {
900
+ $type: "fontWeights",
901
+ $value: "Regular"
902
+ }
756
903
  }
757
904
  }
905
+ });
906
+ var generateFontSizes = (size2) => fontSizes[size2];
907
+ var lineHeights = {
908
+ sm: {
909
+ $type: "lineHeights",
910
+ $value: "130%"
911
+ },
912
+ md: {
913
+ $type: "lineHeights",
914
+ $value: "150%"
915
+ },
916
+ lg: {
917
+ $type: "lineHeights",
918
+ $value: "170%"
919
+ }
758
920
  };
759
-
760
- // src/tokens/template/design-tokens/primitives/modes/size/small.json with { type: 'json' }
761
- var small_default = {
762
- size: {
763
- "_mode-font-size": {
764
- $type: "dimension",
765
- $value: "16"
921
+ var letterSpacings = {
922
+ "1": {
923
+ $type: "letterSpacing",
924
+ $value: "-1%"
925
+ },
926
+ "2": {
927
+ $type: "letterSpacing",
928
+ $value: "-0.5%"
929
+ },
930
+ "3": {
931
+ $type: "letterSpacing",
932
+ $value: "-0.25%"
933
+ },
934
+ "4": {
935
+ $type: "letterSpacing",
936
+ $value: "-0.15%"
937
+ },
938
+ "5": {
939
+ $type: "letterSpacing",
940
+ $value: "0%"
941
+ },
942
+ "6": {
943
+ $type: "letterSpacing",
944
+ $value: "0.15%"
945
+ },
946
+ "7": {
947
+ $type: "letterSpacing",
948
+ $value: "0.25%"
949
+ },
950
+ "8": {
951
+ $type: "letterSpacing",
952
+ $value: "0.5%"
953
+ },
954
+ "9": {
955
+ $type: "letterSpacing",
956
+ $value: "1.5%"
957
+ }
958
+ };
959
+ var fontSizes = {
960
+ large: {
961
+ "line-height": lineHeights,
962
+ "font-size": {
963
+ "1": {
964
+ $type: "fontSizes",
965
+ $value: "13"
966
+ },
967
+ "2": {
968
+ $type: "fontSizes",
969
+ $value: "16"
970
+ },
971
+ "3": {
972
+ $type: "fontSizes",
973
+ $value: "18"
974
+ },
975
+ "4": {
976
+ $type: "fontSizes",
977
+ $value: "21"
978
+ },
979
+ "5": {
980
+ $type: "fontSizes",
981
+ $value: "24"
982
+ },
983
+ "6": {
984
+ $type: "fontSizes",
985
+ $value: "30"
986
+ },
987
+ "7": {
988
+ $type: "fontSizes",
989
+ $value: "36"
990
+ },
991
+ "8": {
992
+ $type: "fontSizes",
993
+ $value: "48"
994
+ },
995
+ "9": {
996
+ $type: "fontSizes",
997
+ $value: "60"
998
+ },
999
+ "10": {
1000
+ $type: "fontSizes",
1001
+ $value: "72"
1002
+ }
766
1003
  },
767
- _base: {
768
- $type: "dimension",
769
- $value: "18"
1004
+ "letter-spacing": letterSpacings
1005
+ },
1006
+ medium: {
1007
+ "line-height": lineHeights,
1008
+ "font-size": {
1009
+ "1": {
1010
+ $type: "fontSizes",
1011
+ $value: "12"
1012
+ },
1013
+ "2": {
1014
+ $type: "fontSizes",
1015
+ $value: "14"
1016
+ },
1017
+ "3": {
1018
+ $type: "fontSizes",
1019
+ $value: "16"
1020
+ },
1021
+ "4": {
1022
+ $type: "fontSizes",
1023
+ $value: "18"
1024
+ },
1025
+ "5": {
1026
+ $type: "fontSizes",
1027
+ $value: "21"
1028
+ },
1029
+ "6": {
1030
+ $type: "fontSizes",
1031
+ $value: "24"
1032
+ },
1033
+ "7": {
1034
+ $type: "fontSizes",
1035
+ $value: "30"
1036
+ },
1037
+ "8": {
1038
+ $type: "fontSizes",
1039
+ $value: "36"
1040
+ },
1041
+ "9": {
1042
+ $type: "fontSizes",
1043
+ $value: "48"
1044
+ },
1045
+ "10": {
1046
+ $type: "fontSizes",
1047
+ $value: "60"
1048
+ }
770
1049
  },
771
- _step: {
772
- $type: "dimension",
773
- $value: "4"
774
- }
1050
+ "letter-spacing": letterSpacings
1051
+ },
1052
+ small: {
1053
+ "line-height": lineHeights,
1054
+ "font-size": {
1055
+ "1": {
1056
+ $type: "fontSizes",
1057
+ $value: "11"
1058
+ },
1059
+ "2": {
1060
+ $type: "fontSizes",
1061
+ $value: "13"
1062
+ },
1063
+ "3": {
1064
+ $type: "fontSizes",
1065
+ $value: "14"
1066
+ },
1067
+ "4": {
1068
+ $type: "fontSizes",
1069
+ $value: "16"
1070
+ },
1071
+ "5": {
1072
+ $type: "fontSizes",
1073
+ $value: "18"
1074
+ },
1075
+ "6": {
1076
+ $type: "fontSizes",
1077
+ $value: "21"
1078
+ },
1079
+ "7": {
1080
+ $type: "fontSizes",
1081
+ $value: "24"
1082
+ },
1083
+ "8": {
1084
+ $type: "fontSizes",
1085
+ $value: "30"
1086
+ },
1087
+ "9": {
1088
+ $type: "fontSizes",
1089
+ $value: "36"
1090
+ },
1091
+ "10": {
1092
+ $type: "fontSizes",
1093
+ $value: "48"
1094
+ }
1095
+ },
1096
+ "letter-spacing": letterSpacings
775
1097
  }
776
1098
  };
777
1099
 
778
- // src/tokens/template/design-tokens/primitives/modes/typography/size/large.json with { type: 'json' }
779
- var large_default2 = {
780
- "line-height": {
781
- sm: {
782
- $type: "lineHeights",
783
- $value: "130%"
784
- },
785
- md: {
786
- $type: "lineHeights",
787
- $value: "150%"
788
- },
789
- lg: {
790
- $type: "lineHeights",
791
- $value: "170%"
1100
+ // src/tokens/create/generators/semantic/color.ts
1101
+ import * as R5 from "ramda";
1102
+ var generateSemanticColors = (colors, _themeName) => {
1103
+ const mainColorNames = Object.keys(colors.main);
1104
+ const supportColorNames = Object.keys(colors.support);
1105
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames];
1106
+ const allColors = [...customColors, ...baseColorNames];
1107
+ const semanticColorTokens = allColors.map((colorName) => [colorName, generateColorScaleTokens(colorName)]);
1108
+ return {
1109
+ ...baseColorTemplate,
1110
+ color: {
1111
+ ...Object.fromEntries(semanticColorTokens),
1112
+ ...baseColorTemplate.color
792
1113
  }
793
- },
794
- "font-size": {
795
- "1": {
796
- $type: "fontSizes",
797
- $value: "13"
798
- },
799
- "2": {
800
- $type: "fontSizes",
801
- $value: "16"
802
- },
803
- "3": {
804
- $type: "fontSizes",
805
- $value: "18"
806
- },
807
- "4": {
808
- $type: "fontSizes",
809
- $value: "21"
810
- },
811
- "5": {
812
- $type: "fontSizes",
813
- $value: "24"
814
- },
815
- "6": {
816
- $type: "fontSizes",
817
- $value: "30"
818
- },
819
- "7": {
820
- $type: "fontSizes",
821
- $value: "36"
822
- },
823
- "8": {
824
- $type: "fontSizes",
825
- $value: "48"
826
- },
827
- "9": {
828
- $type: "fontSizes",
829
- $value: "60"
830
- },
831
- "10": {
832
- $type: "fontSizes",
833
- $value: "72"
1114
+ };
1115
+ };
1116
+ var baseColorTemplate = {
1117
+ color: {
1118
+ focus: {
1119
+ inner: {
1120
+ $type: "color",
1121
+ $value: "{color.focus.inner-color}"
1122
+ },
1123
+ outer: {
1124
+ $type: "color",
1125
+ $value: "{color.focus.outer-color}"
1126
+ }
834
1127
  }
835
1128
  },
836
- "letter-spacing": {
837
- "1": {
838
- $type: "letterSpacing",
839
- $value: "-1%"
840
- },
841
- "2": {
842
- $type: "letterSpacing",
843
- $value: "-0.5%"
844
- },
845
- "3": {
846
- $type: "letterSpacing",
847
- $value: "-0.25%"
848
- },
849
- "4": {
850
- $type: "letterSpacing",
851
- $value: "-0.15%"
852
- },
853
- "5": {
854
- $type: "letterSpacing",
855
- $value: "0%"
856
- },
857
- "6": {
858
- $type: "letterSpacing",
859
- $value: "0.15%"
860
- },
861
- "7": {
862
- $type: "letterSpacing",
863
- $value: "0.25%"
864
- },
865
- "8": {
866
- $type: "letterSpacing",
867
- $value: "0.5%"
868
- },
869
- "9": {
870
- $type: "letterSpacing",
871
- $value: "1.5%"
1129
+ link: {
1130
+ color: {
1131
+ visited: {
1132
+ $type: "color",
1133
+ $value: "{color.link.visited}"
1134
+ }
872
1135
  }
873
1136
  }
874
1137
  };
1138
+ var generateColorScaleTokens = (colorName) => {
1139
+ const colorScale = {};
1140
+ for (const [colorSemantic, colorNumber] of R5.toPairs(semanticColorMap)) {
1141
+ colorScale[colorSemantic] = {
1142
+ $type: "color",
1143
+ $value: `{color.${colorName}.${colorNumber}}`
1144
+ };
1145
+ }
1146
+ return colorScale;
1147
+ };
875
1148
 
876
- // src/tokens/template/design-tokens/primitives/modes/typography/size/medium.json with { type: 'json' }
877
- var medium_default2 = {
878
- "line-height": {
879
- sm: {
880
- $type: "lineHeights",
881
- $value: "130%"
882
- },
883
- md: {
884
- $type: "lineHeights",
885
- $value: "150%"
886
- },
887
- lg: {
888
- $type: "lineHeights",
889
- $value: "170%"
890
- }
891
- },
892
- "font-size": {
893
- "1": {
894
- $type: "fontSizes",
895
- $value: "12"
896
- },
897
- "2": {
898
- $type: "fontSizes",
899
- $value: "14"
900
- },
901
- "3": {
902
- $type: "fontSizes",
903
- $value: "16"
904
- },
905
- "4": {
906
- $type: "fontSizes",
907
- $value: "18"
908
- },
909
- "5": {
910
- $type: "fontSizes",
911
- $value: "21"
912
- },
913
- "6": {
914
- $type: "fontSizes",
915
- $value: "24"
916
- },
917
- "7": {
918
- $type: "fontSizes",
919
- $value: "30"
920
- },
921
- "8": {
922
- $type: "fontSizes",
923
- $value: "36"
924
- },
925
- "9": {
926
- $type: "fontSizes",
927
- $value: "48"
928
- },
929
- "10": {
930
- $type: "fontSizes",
931
- $value: "60"
932
- }
933
- },
934
- "letter-spacing": {
935
- "1": {
936
- $type: "letterSpacing",
937
- $value: "-1%"
938
- },
939
- "2": {
940
- $type: "letterSpacing",
941
- $value: "-0.5%"
942
- },
943
- "3": {
944
- $type: "letterSpacing",
945
- $value: "-0.25%"
946
- },
947
- "4": {
948
- $type: "letterSpacing",
949
- $value: "-0.15%"
950
- },
951
- "5": {
952
- $type: "letterSpacing",
953
- $value: "0%"
954
- },
955
- "6": {
956
- $type: "letterSpacing",
957
- $value: "0.15%"
958
- },
959
- "7": {
960
- $type: "letterSpacing",
961
- $value: "0.25%"
962
- },
963
- "8": {
964
- $type: "letterSpacing",
965
- $value: "0.5%"
966
- },
967
- "9": {
968
- $type: "letterSpacing",
969
- $value: "1.5%"
1149
+ // src/tokens/create/generators/semantic/color-modes.ts
1150
+ var generateColorModes = (colors, _themeName) => {
1151
+ const mainColorNames = Object.keys(colors.main);
1152
+ const supportColorNames = Object.keys(colors.support);
1153
+ const modes = {
1154
+ "main-color": {},
1155
+ "support-color": {}
1156
+ };
1157
+ const categories = [
1158
+ ["main-color", mainColorNames],
1159
+ ["support-color", supportColorNames]
1160
+ ];
1161
+ for (const [colorCategory2, colorNames2] of categories) {
1162
+ for (const colorName of colorNames2) {
1163
+ const category = colorCategory2.replace("-color", "");
1164
+ const customColorTokens = {
1165
+ color: {
1166
+ [category]: generateColorScaleTokens2(colorName)
1167
+ }
1168
+ };
1169
+ modes[colorCategory2][colorName] = customColorTokens;
970
1170
  }
971
1171
  }
972
- };
973
-
974
- // src/tokens/template/design-tokens/primitives/modes/typography/size/small.json with { type: 'json' }
975
- var small_default2 = {
976
- "line-height": {
977
- sm: {
978
- $type: "lineHeights",
979
- $value: "130%"
980
- },
981
- md: {
982
- $type: "lineHeights",
983
- $value: "150%"
984
- },
985
- lg: {
986
- $type: "lineHeights",
987
- $value: "170%"
988
- }
989
- },
990
- "font-size": {
991
- "1": {
992
- $type: "fontSizes",
993
- $value: "11"
994
- },
995
- "2": {
996
- $type: "fontSizes",
997
- $value: "13"
998
- },
999
- "3": {
1000
- $type: "fontSizes",
1001
- $value: "14"
1002
- },
1003
- "4": {
1004
- $type: "fontSizes",
1005
- $value: "16"
1006
- },
1007
- "5": {
1008
- $type: "fontSizes",
1009
- $value: "18"
1010
- },
1011
- "6": {
1012
- $type: "fontSizes",
1013
- $value: "21"
1014
- },
1015
- "7": {
1016
- $type: "fontSizes",
1017
- $value: "24"
1018
- },
1019
- "8": {
1020
- $type: "fontSizes",
1021
- $value: "30"
1022
- },
1023
- "9": {
1024
- $type: "fontSizes",
1025
- $value: "36"
1026
- },
1027
- "10": {
1028
- $type: "fontSizes",
1029
- $value: "48"
1030
- }
1031
- },
1032
- "letter-spacing": {
1033
- "1": {
1034
- $type: "letterSpacing",
1035
- $value: "-1%"
1036
- },
1037
- "2": {
1038
- $type: "letterSpacing",
1039
- $value: "-0.5%"
1040
- },
1041
- "3": {
1042
- $type: "letterSpacing",
1043
- $value: "-0.25%"
1044
- },
1045
- "4": {
1046
- $type: "letterSpacing",
1047
- $value: "-0.15%"
1048
- },
1049
- "5": {
1050
- $type: "letterSpacing",
1051
- $value: "0%"
1052
- },
1053
- "6": {
1054
- $type: "letterSpacing",
1055
- $value: "0.15%"
1056
- },
1057
- "7": {
1058
- $type: "letterSpacing",
1059
- $value: "0.25%"
1060
- },
1061
- "8": {
1062
- $type: "letterSpacing",
1063
- $value: "0.5%"
1064
- },
1065
- "9": {
1066
- $type: "letterSpacing",
1067
- $value: "1.5%"
1068
- }
1172
+ return modes;
1173
+ };
1174
+ var generateColorScaleTokens2 = (colorName) => {
1175
+ const colorScale = {};
1176
+ for (const colorSemantic of semanticColorNames) {
1177
+ colorScale[colorSemantic] = {
1178
+ $type: "color",
1179
+ $value: `{color.${colorName}.${colorSemantic}}`
1180
+ };
1069
1181
  }
1182
+ return colorScale;
1070
1183
  };
1071
1184
 
1072
- // src/tokens/template/design-tokens/semantic/style.json with { type: 'json' }
1073
- var style_default = {
1074
- typography: {
1075
- heading: {
1076
- "2xl": {
1077
- $type: "typography",
1078
- $value: {
1079
- fontFamily: "{font-family}",
1080
- fontWeight: "{font-weight.medium}",
1081
- lineHeight: "{line-height.sm}",
1082
- fontSize: "{font-size.10}",
1083
- letterSpacing: "{letter-spacing.1}"
1084
- }
1085
- },
1086
- xl: {
1087
- $type: "typography",
1088
- $value: {
1089
- fontFamily: "{font-family}",
1090
- fontWeight: "{font-weight.medium}",
1091
- lineHeight: "{line-height.sm}",
1092
- fontSize: "{font-size.9}",
1093
- letterSpacing: "{letter-spacing.1}"
1094
- }
1095
- },
1096
- lg: {
1097
- $type: "typography",
1098
- $value: {
1099
- fontFamily: "{font-family}",
1100
- fontWeight: "{font-weight.medium}",
1101
- lineHeight: "{line-height.sm}",
1102
- fontSize: "{font-size.8}",
1103
- letterSpacing: "{letter-spacing.2}"
1104
- }
1105
- },
1106
- md: {
1107
- $type: "typography",
1108
- $value: {
1109
- fontFamily: "{font-family}",
1110
- fontWeight: "{font-weight.medium}",
1111
- lineHeight: "{line-height.sm}",
1112
- fontSize: "{font-size.7}",
1113
- letterSpacing: "{letter-spacing.3}"
1114
- }
1115
- },
1116
- sm: {
1117
- $type: "typography",
1118
- $value: {
1119
- fontFamily: "{font-family}",
1120
- fontWeight: "{font-weight.medium}",
1121
- lineHeight: "{line-height.sm}",
1122
- fontSize: "{font-size.6}",
1123
- letterSpacing: "{letter-spacing.5}"
1124
- }
1125
- },
1126
- xs: {
1127
- $type: "typography",
1128
- $value: {
1129
- fontFamily: "{font-family}",
1130
- fontWeight: "{font-weight.medium}",
1131
- lineHeight: "{line-height.sm}",
1132
- fontSize: "{font-size.5}",
1133
- letterSpacing: "{letter-spacing.6}"
1134
- }
1135
- },
1136
- "2xs": {
1137
- $type: "typography",
1138
- $value: {
1139
- fontFamily: "{font-family}",
1140
- fontWeight: "{font-weight.medium}",
1141
- lineHeight: "{line-height.sm}",
1142
- fontSize: "{font-size.4}",
1143
- letterSpacing: "{letter-spacing.6}"
1144
- }
1145
- }
1146
- },
1147
- body: {
1148
- xl: {
1149
- $type: "typography",
1150
- $value: {
1151
- fontFamily: "{font-family}",
1152
- fontWeight: "{font-weight.regular}",
1153
- lineHeight: "{line-height.md}",
1154
- fontSize: "{font-size.6}",
1155
- letterSpacing: "{letter-spacing.8}"
1156
- }
1157
- },
1158
- lg: {
1159
- $type: "typography",
1160
- $value: {
1161
- fontFamily: "{font-family}",
1162
- fontWeight: "{font-weight.regular}",
1163
- lineHeight: "{line-height.md}",
1164
- fontSize: "{font-size.5}",
1165
- letterSpacing: "{letter-spacing.8}"
1166
- }
1167
- },
1168
- md: {
1169
- $type: "typography",
1170
- $value: {
1171
- fontFamily: "{font-family}",
1172
- fontWeight: "{font-weight.regular}",
1173
- lineHeight: "{line-height.md}",
1174
- fontSize: "{font-size.4}",
1175
- letterSpacing: "{letter-spacing.8}"
1176
- }
1177
- },
1178
- sm: {
1179
- $type: "typography",
1180
- $value: {
1181
- fontFamily: "{font-family}",
1182
- fontWeight: "{font-weight.regular}",
1183
- lineHeight: "{line-height.md}",
1184
- fontSize: "{font-size.3}",
1185
- letterSpacing: "{letter-spacing.7}"
1186
- }
1187
- },
1188
- xs: {
1189
- $type: "typography",
1190
- $value: {
1191
- fontFamily: "{font-family}",
1192
- fontWeight: "{font-weight.regular}",
1193
- lineHeight: "{line-height.md}",
1194
- fontSize: "{font-size.2}",
1195
- letterSpacing: "{letter-spacing.6}"
1196
- }
1197
- },
1198
- short: {
1185
+ // src/tokens/create/generators/semantic/style.ts
1186
+ function generateSemanticStyle() {
1187
+ return {
1188
+ typography: {
1189
+ heading: {
1190
+ "2xl": {
1191
+ $type: "typography",
1192
+ $value: {
1193
+ fontFamily: "{font-family}",
1194
+ fontWeight: "{font-weight.medium}",
1195
+ lineHeight: "{line-height.sm}",
1196
+ fontSize: "{font-size.10}",
1197
+ letterSpacing: "{letter-spacing.1}"
1198
+ }
1199
+ },
1199
1200
  xl: {
1200
1201
  $type: "typography",
1201
1202
  $value: {
1202
1203
  fontFamily: "{font-family}",
1203
- fontWeight: "{font-weight.regular}",
1204
+ fontWeight: "{font-weight.medium}",
1204
1205
  lineHeight: "{line-height.sm}",
1205
- fontSize: "{font-size.6}",
1206
- letterSpacing: "{letter-spacing.8}"
1206
+ fontSize: "{font-size.9}",
1207
+ letterSpacing: "{letter-spacing.1}"
1207
1208
  }
1208
1209
  },
1209
1210
  lg: {
1210
1211
  $type: "typography",
1211
1212
  $value: {
1212
1213
  fontFamily: "{font-family}",
1213
- fontWeight: "{font-weight.regular}",
1214
+ fontWeight: "{font-weight.medium}",
1214
1215
  lineHeight: "{line-height.sm}",
1215
- fontSize: "{font-size.5}",
1216
- letterSpacing: "{letter-spacing.8}"
1216
+ fontSize: "{font-size.8}",
1217
+ letterSpacing: "{letter-spacing.2}"
1217
1218
  }
1218
1219
  },
1219
1220
  md: {
1220
1221
  $type: "typography",
1221
1222
  $value: {
1222
1223
  fontFamily: "{font-family}",
1223
- fontWeight: "{font-weight.regular}",
1224
+ fontWeight: "{font-weight.medium}",
1224
1225
  lineHeight: "{line-height.sm}",
1225
- fontSize: "{font-size.4}",
1226
- letterSpacing: "{letter-spacing.8}"
1226
+ fontSize: "{font-size.7}",
1227
+ letterSpacing: "{letter-spacing.3}"
1227
1228
  }
1228
1229
  },
1229
1230
  sm: {
1230
1231
  $type: "typography",
1231
1232
  $value: {
1232
1233
  fontFamily: "{font-family}",
1233
- fontWeight: "{font-weight.regular}",
1234
+ fontWeight: "{font-weight.medium}",
1234
1235
  lineHeight: "{line-height.sm}",
1235
- fontSize: "{font-size.3}",
1236
- letterSpacing: "{letter-spacing.7}"
1236
+ fontSize: "{font-size.6}",
1237
+ letterSpacing: "{letter-spacing.5}"
1237
1238
  }
1238
1239
  },
1239
1240
  xs: {
1240
1241
  $type: "typography",
1241
1242
  $value: {
1242
1243
  fontFamily: "{font-family}",
1243
- fontWeight: "{font-weight.regular}",
1244
+ fontWeight: "{font-weight.medium}",
1244
1245
  lineHeight: "{line-height.sm}",
1245
- fontSize: "{font-size.2}",
1246
+ fontSize: "{font-size.5}",
1247
+ letterSpacing: "{letter-spacing.6}"
1248
+ }
1249
+ },
1250
+ "2xs": {
1251
+ $type: "typography",
1252
+ $value: {
1253
+ fontFamily: "{font-family}",
1254
+ fontWeight: "{font-weight.medium}",
1255
+ lineHeight: "{line-height.sm}",
1256
+ fontSize: "{font-size.4}",
1246
1257
  letterSpacing: "{letter-spacing.6}"
1247
1258
  }
1248
1259
  }
1249
1260
  },
1250
- long: {
1261
+ body: {
1251
1262
  xl: {
1252
1263
  $type: "typography",
1253
1264
  $value: {
1254
1265
  fontFamily: "{font-family}",
1255
1266
  fontWeight: "{font-weight.regular}",
1256
- lineHeight: "{line-height.lg}",
1267
+ lineHeight: "{line-height.md}",
1257
1268
  fontSize: "{font-size.6}",
1258
1269
  letterSpacing: "{letter-spacing.8}"
1259
1270
  }
@@ -1263,7 +1274,7 @@ var style_default = {
1263
1274
  $value: {
1264
1275
  fontFamily: "{font-family}",
1265
1276
  fontWeight: "{font-weight.regular}",
1266
- lineHeight: "{line-height.lg}",
1277
+ lineHeight: "{line-height.md}",
1267
1278
  fontSize: "{font-size.5}",
1268
1279
  letterSpacing: "{letter-spacing.8}"
1269
1280
  }
@@ -1273,7 +1284,7 @@ var style_default = {
1273
1284
  $value: {
1274
1285
  fontFamily: "{font-family}",
1275
1286
  fontWeight: "{font-weight.regular}",
1276
- lineHeight: "{line-height.lg}",
1287
+ lineHeight: "{line-height.md}",
1277
1288
  fontSize: "{font-size.4}",
1278
1289
  letterSpacing: "{letter-spacing.8}"
1279
1290
  }
@@ -1283,7 +1294,7 @@ var style_default = {
1283
1294
  $value: {
1284
1295
  fontFamily: "{font-family}",
1285
1296
  fontWeight: "{font-weight.regular}",
1286
- lineHeight: "{line-height.lg}",
1297
+ lineHeight: "{line-height.md}",
1287
1298
  fontSize: "{font-size.3}",
1288
1299
  letterSpacing: "{letter-spacing.7}"
1289
1300
  }
@@ -1293,505 +1304,333 @@ var style_default = {
1293
1304
  $value: {
1294
1305
  fontFamily: "{font-family}",
1295
1306
  fontWeight: "{font-weight.regular}",
1296
- lineHeight: "{line-height.lg}",
1307
+ lineHeight: "{line-height.md}",
1297
1308
  fontSize: "{font-size.2}",
1298
1309
  letterSpacing: "{letter-spacing.6}"
1299
1310
  }
1311
+ },
1312
+ short: {
1313
+ xl: {
1314
+ $type: "typography",
1315
+ $value: {
1316
+ fontFamily: "{font-family}",
1317
+ fontWeight: "{font-weight.regular}",
1318
+ lineHeight: "{line-height.sm}",
1319
+ fontSize: "{font-size.6}",
1320
+ letterSpacing: "{letter-spacing.8}"
1321
+ }
1322
+ },
1323
+ lg: {
1324
+ $type: "typography",
1325
+ $value: {
1326
+ fontFamily: "{font-family}",
1327
+ fontWeight: "{font-weight.regular}",
1328
+ lineHeight: "{line-height.sm}",
1329
+ fontSize: "{font-size.5}",
1330
+ letterSpacing: "{letter-spacing.8}"
1331
+ }
1332
+ },
1333
+ md: {
1334
+ $type: "typography",
1335
+ $value: {
1336
+ fontFamily: "{font-family}",
1337
+ fontWeight: "{font-weight.regular}",
1338
+ lineHeight: "{line-height.sm}",
1339
+ fontSize: "{font-size.4}",
1340
+ letterSpacing: "{letter-spacing.8}"
1341
+ }
1342
+ },
1343
+ sm: {
1344
+ $type: "typography",
1345
+ $value: {
1346
+ fontFamily: "{font-family}",
1347
+ fontWeight: "{font-weight.regular}",
1348
+ lineHeight: "{line-height.sm}",
1349
+ fontSize: "{font-size.3}",
1350
+ letterSpacing: "{letter-spacing.7}"
1351
+ }
1352
+ },
1353
+ xs: {
1354
+ $type: "typography",
1355
+ $value: {
1356
+ fontFamily: "{font-family}",
1357
+ fontWeight: "{font-weight.regular}",
1358
+ lineHeight: "{line-height.sm}",
1359
+ fontSize: "{font-size.2}",
1360
+ letterSpacing: "{letter-spacing.6}"
1361
+ }
1362
+ }
1363
+ },
1364
+ long: {
1365
+ xl: {
1366
+ $type: "typography",
1367
+ $value: {
1368
+ fontFamily: "{font-family}",
1369
+ fontWeight: "{font-weight.regular}",
1370
+ lineHeight: "{line-height.lg}",
1371
+ fontSize: "{font-size.6}",
1372
+ letterSpacing: "{letter-spacing.8}"
1373
+ }
1374
+ },
1375
+ lg: {
1376
+ $type: "typography",
1377
+ $value: {
1378
+ fontFamily: "{font-family}",
1379
+ fontWeight: "{font-weight.regular}",
1380
+ lineHeight: "{line-height.lg}",
1381
+ fontSize: "{font-size.5}",
1382
+ letterSpacing: "{letter-spacing.8}"
1383
+ }
1384
+ },
1385
+ md: {
1386
+ $type: "typography",
1387
+ $value: {
1388
+ fontFamily: "{font-family}",
1389
+ fontWeight: "{font-weight.regular}",
1390
+ lineHeight: "{line-height.lg}",
1391
+ fontSize: "{font-size.4}",
1392
+ letterSpacing: "{letter-spacing.8}"
1393
+ }
1394
+ },
1395
+ sm: {
1396
+ $type: "typography",
1397
+ $value: {
1398
+ fontFamily: "{font-family}",
1399
+ fontWeight: "{font-weight.regular}",
1400
+ lineHeight: "{line-height.lg}",
1401
+ fontSize: "{font-size.3}",
1402
+ letterSpacing: "{letter-spacing.7}"
1403
+ }
1404
+ },
1405
+ xs: {
1406
+ $type: "typography",
1407
+ $value: {
1408
+ fontFamily: "{font-family}",
1409
+ fontWeight: "{font-weight.regular}",
1410
+ lineHeight: "{line-height.lg}",
1411
+ fontSize: "{font-size.2}",
1412
+ letterSpacing: "{letter-spacing.6}"
1413
+ }
1414
+ }
1300
1415
  }
1301
1416
  }
1302
- }
1303
- },
1304
- opacity: {
1305
- disabled: {
1306
- $type: "opacity",
1307
- $value: "{opacity.30}"
1308
- }
1309
- },
1310
- "border-width": {
1311
- default: {
1312
- $type: "borderWidth",
1313
- $value: "{border-width.1}"
1314
1417
  },
1315
- focus: {
1316
- $type: "borderWidth",
1317
- $value: "{border-width.3}"
1318
- }
1319
- },
1320
- shadow: {
1321
- xs: {
1322
- $type: "boxShadow",
1323
- $value: "{shadow.100}"
1418
+ opacity: {
1419
+ disabled: {
1420
+ $type: "opacity",
1421
+ $value: "{opacity.30}"
1422
+ }
1324
1423
  },
1325
- sm: {
1326
- $type: "boxShadow",
1327
- $value: "{shadow.200}"
1424
+ "border-width": {
1425
+ default: {
1426
+ $type: "borderWidth",
1427
+ $value: "{border-width.1}"
1428
+ },
1429
+ focus: {
1430
+ $type: "borderWidth",
1431
+ $value: "{border-width.3}"
1432
+ }
1328
1433
  },
1329
- md: {
1330
- $type: "boxShadow",
1331
- $value: "{shadow.300}"
1434
+ shadow: {
1435
+ xs: {
1436
+ $type: "boxShadow",
1437
+ $value: "{shadow.100}"
1438
+ },
1439
+ sm: {
1440
+ $type: "boxShadow",
1441
+ $value: "{shadow.200}"
1442
+ },
1443
+ md: {
1444
+ $type: "boxShadow",
1445
+ $value: "{shadow.300}"
1446
+ },
1447
+ lg: {
1448
+ $type: "boxShadow",
1449
+ $value: "{shadow.400}"
1450
+ },
1451
+ xl: {
1452
+ $type: "boxShadow",
1453
+ $value: "{shadow.500}"
1454
+ }
1332
1455
  },
1333
- lg: {
1334
- $type: "boxShadow",
1335
- $value: "{shadow.400}"
1456
+ "border-radius": {
1457
+ sm: {
1458
+ $type: "dimension",
1459
+ $value: "{border-radius.1}"
1460
+ },
1461
+ md: {
1462
+ $type: "dimension",
1463
+ $value: "{border-radius.2}"
1464
+ },
1465
+ lg: {
1466
+ $type: "dimension",
1467
+ $value: "{border-radius.3}"
1468
+ },
1469
+ xl: {
1470
+ $type: "dimension",
1471
+ $value: "{border-radius.4}"
1472
+ },
1473
+ default: {
1474
+ $type: "dimension",
1475
+ $value: "{border-radius.5}"
1476
+ },
1477
+ full: {
1478
+ $type: "dimension",
1479
+ $value: "{border-radius.6}"
1480
+ }
1336
1481
  },
1337
- xl: {
1338
- $type: "boxShadow",
1339
- $value: "{shadow.500}"
1482
+ size: {
1483
+ "0": {
1484
+ $type: "dimension",
1485
+ $value: "{_size.0}"
1486
+ },
1487
+ "1": {
1488
+ $type: "dimension",
1489
+ $value: "{_size.1}"
1490
+ },
1491
+ "2": {
1492
+ $type: "dimension",
1493
+ $value: "{_size.2}"
1494
+ },
1495
+ "3": {
1496
+ $type: "dimension",
1497
+ $value: "{_size.3}"
1498
+ },
1499
+ "4": {
1500
+ $type: "dimension",
1501
+ $value: "{_size.4}"
1502
+ },
1503
+ "5": {
1504
+ $type: "dimension",
1505
+ $value: "{_size.5}"
1506
+ },
1507
+ "6": {
1508
+ $type: "dimension",
1509
+ $value: "{_size.6}"
1510
+ },
1511
+ "7": {
1512
+ $type: "dimension",
1513
+ $value: "{_size.7}"
1514
+ },
1515
+ "8": {
1516
+ $type: "dimension",
1517
+ $value: "{_size.8}"
1518
+ },
1519
+ "9": {
1520
+ $type: "dimension",
1521
+ $value: "{_size.9}"
1522
+ },
1523
+ "10": {
1524
+ $type: "dimension",
1525
+ $value: "{_size.10}"
1526
+ },
1527
+ "11": {
1528
+ $type: "dimension",
1529
+ $value: "{_size.11}"
1530
+ },
1531
+ "12": {
1532
+ $type: "dimension",
1533
+ $value: "{_size.12}"
1534
+ },
1535
+ "13": {
1536
+ $type: "dimension",
1537
+ $value: "{_size.13}"
1538
+ },
1539
+ "14": {
1540
+ $type: "dimension",
1541
+ $value: "{_size.14}"
1542
+ },
1543
+ "15": {
1544
+ $type: "dimension",
1545
+ $value: "{_size.15}"
1546
+ },
1547
+ "18": {
1548
+ $type: "dimension",
1549
+ $value: "{_size.18}"
1550
+ },
1551
+ "22": {
1552
+ $type: "dimension",
1553
+ $value: "{_size.22}"
1554
+ },
1555
+ "26": {
1556
+ $type: "dimension",
1557
+ $value: "{_size.26}"
1558
+ },
1559
+ "30": {
1560
+ $type: "dimension",
1561
+ $value: "{_size.30}"
1562
+ }
1340
1563
  }
1341
- },
1342
- "border-radius": {
1343
- sm: {
1344
- $type: "dimension",
1345
- $value: "{border-radius.1}"
1346
- },
1347
- md: {
1348
- $type: "dimension",
1349
- $value: "{border-radius.2}"
1350
- },
1351
- lg: {
1352
- $type: "dimension",
1353
- $value: "{border-radius.3}"
1354
- },
1355
- xl: {
1356
- $type: "dimension",
1357
- $value: "{border-radius.4}"
1358
- },
1359
- default: {
1360
- $type: "dimension",
1361
- $value: "{border-radius.5}"
1362
- },
1363
- full: {
1364
- $type: "dimension",
1365
- $value: "{border-radius.6}"
1366
- }
1367
- },
1368
- size: {
1369
- "0": {
1370
- $type: "dimension",
1371
- $value: "{_size.0}"
1372
- },
1373
- "1": {
1374
- $type: "dimension",
1375
- $value: "{_size.1}"
1376
- },
1377
- "2": {
1378
- $type: "dimension",
1379
- $value: "{_size.2}"
1380
- },
1381
- "3": {
1382
- $type: "dimension",
1383
- $value: "{_size.3}"
1384
- },
1385
- "4": {
1386
- $type: "dimension",
1387
- $value: "{_size.4}"
1388
- },
1389
- "5": {
1390
- $type: "dimension",
1391
- $value: "{_size.5}"
1392
- },
1393
- "6": {
1394
- $type: "dimension",
1395
- $value: "{_size.6}"
1396
- },
1397
- "7": {
1398
- $type: "dimension",
1399
- $value: "{_size.7}"
1400
- },
1401
- "8": {
1402
- $type: "dimension",
1403
- $value: "{_size.8}"
1404
- },
1405
- "9": {
1406
- $type: "dimension",
1407
- $value: "{_size.9}"
1408
- },
1409
- "10": {
1410
- $type: "dimension",
1411
- $value: "{_size.10}"
1412
- },
1413
- "11": {
1414
- $type: "dimension",
1415
- $value: "{_size.11}"
1416
- },
1417
- "12": {
1418
- $type: "dimension",
1419
- $value: "{_size.12}"
1420
- },
1421
- "13": {
1422
- $type: "dimension",
1423
- $value: "{_size.13}"
1424
- },
1425
- "14": {
1426
- $type: "dimension",
1427
- $value: "{_size.14}"
1428
- },
1429
- "15": {
1430
- $type: "dimension",
1431
- $value: "{_size.15}"
1432
- },
1433
- "18": {
1434
- $type: "dimension",
1435
- $value: "{_size.18}"
1436
- },
1437
- "22": {
1438
- $type: "dimension",
1439
- $value: "{_size.22}"
1440
- },
1441
- "26": {
1442
- $type: "dimension",
1443
- $value: "{_size.26}"
1444
- },
1445
- "30": {
1446
- $type: "dimension",
1447
- $value: "{_size.30}"
1448
- }
1449
- }
1450
- };
1451
-
1452
- // src/tokens/create/defaults.ts
1453
- var defaultTokens = {
1454
- "primitives/globals": globals_default,
1455
- "primitives/modes/size/small": small_default,
1456
- "primitives/modes/size/medium": medium_default,
1457
- "primitives/modes/size/large": large_default,
1458
- "primitives/modes/size/global": global_default,
1459
- "primitives/modes/typography/size/small": small_default2,
1460
- "primitives/modes/typography/size/medium": medium_default2,
1461
- "primitives/modes/typography/size/large": large_default2,
1462
- "semantic/style": style_default
1463
- };
1464
- var getDefaultTokens = (tokenSets) => Object.entries(R3.pick(tokenSets, defaultTokens));
1465
- var getDefaultToken = (tokenPath) => {
1466
- return [tokenPath, defaultTokens[tokenPath]];
1467
- };
1468
-
1469
- // src/tokens/create/generators/color.ts
1470
- import * as R4 from "ramda";
1471
- var generateColor = (colorArray, overrides) => {
1472
- const obj = {};
1473
- const $type = "color";
1474
- for (const index in colorArray) {
1475
- const position = Number(index) + 1;
1476
- const overrideValue = overrides?.[position];
1477
- obj[position] = {
1478
- $type,
1479
- $value: overrideValue || colorArray[index].hex
1480
- };
1481
- }
1482
- return obj;
1483
- };
1484
- var generateColorScheme = (themeName, colorScheme2, colors, overrides) => {
1485
- const createColorOverrides = (colorName) => {
1486
- if (!overrides?.colors || !(colorName in overrides.colors)) {
1487
- return void 0;
1488
- }
1489
- const colorOverrides = overrides.colors[colorName];
1490
- const positionOverrides = {};
1491
- Object.entries(colorOverrides).forEach(([semanticTokenName, modeOverrides]) => {
1492
- const position = colorMetadata[semanticTokenName].number;
1493
- if (position) {
1494
- let overrideValue;
1495
- if (colorScheme2 === "light" && modeOverrides.light) {
1496
- overrideValue = modeOverrides.light;
1497
- } else if (colorScheme2 === "dark" && modeOverrides.dark) {
1498
- overrideValue = modeOverrides.dark;
1499
- }
1500
- if (overrideValue) {
1501
- positionOverrides[position] = overrideValue;
1502
- }
1503
- }
1504
- });
1505
- return Object.keys(positionOverrides).length > 0 ? positionOverrides : void 0;
1506
- };
1507
- const main = R4.mapObjIndexed(
1508
- (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
1509
- colors.main
1510
- );
1511
- const support = R4.mapObjIndexed(
1512
- (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
1513
- colors.support
1514
- );
1515
- const neutralColorScale = generateColorScale(colors.neutral, colorScheme2);
1516
- const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
1517
- const baseColorsWithOverrides = {
1518
- ...baseColors,
1519
- ...overrides?.severity
1520
1564
  };
1521
- const globalColors = R4.mapObjIndexed(
1522
- (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
1523
- baseColorsWithOverrides
1565
+ }
1566
+
1567
+ // src/tokens/create/generators/themes/theme.ts
1568
+ import * as R6 from "ramda";
1569
+ var generateTheme = (colors, themeName, borderRadius) => {
1570
+ const mainColorNames = Object.keys(colors.main);
1571
+ const supportColorNames = Object.keys(colors.support);
1572
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
1573
+ const themeColorTokens = Object.fromEntries(
1574
+ customColors.map((colorName) => [colorName, generateColorScaleTokens3(colorName, themeName)])
1524
1575
  );
1525
- const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
1526
- const defaultLinkVisited = linkColor[12];
1527
- const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
1528
- const defaultFocusInner = neutralColorScale[0].hex;
1529
- const defaultFocusOuter = neutralColorScale[10].hex;
1530
- const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
1531
- const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
1532
- return {
1533
- [themeName]: {
1534
- ...main,
1535
- ...support,
1536
- neutral,
1537
- ...globalColors,
1576
+ const { color: themeBaseFileColor, ...remainingThemeFile } = generateBase(themeName);
1577
+ const themeFile = {
1578
+ color: {
1579
+ ...themeColorTokens,
1580
+ ...themeBaseFileColor,
1538
1581
  link: {
1539
- visited: linkOverride || defaultLinkVisited
1582
+ visited: {
1583
+ $type: "color",
1584
+ $value: `{${themeName}.link.visited}`
1585
+ }
1540
1586
  },
1541
1587
  focus: {
1542
- inner: {
1588
+ "inner-color": {
1543
1589
  $type: "color",
1544
- $value: focusInnerOverride || defaultFocusInner
1590
+ $value: `{${themeName}.focus.inner}`
1545
1591
  },
1546
- outer: {
1592
+ "outer-color": {
1547
1593
  $type: "color",
1548
- $value: focusOuterOverride || defaultFocusOuter
1594
+ $value: `{${themeName}.focus.outer}`
1549
1595
  }
1550
1596
  }
1551
- }
1552
- };
1553
- };
1554
-
1555
- // src/tokens/create/generators/semantic.ts
1556
- import * as R5 from "ramda";
1557
-
1558
- // src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
1559
- var color_base_template_default = {
1560
- color: {
1561
- focus: {
1562
- inner: {
1563
- $type: "color",
1564
- $value: "{color.focus.inner-color}"
1565
- },
1566
- outer: {
1567
- $type: "color",
1568
- $value: "{color.focus.outer-color}"
1569
- }
1570
- }
1571
- },
1572
- link: {
1573
- color: {
1574
- visited: {
1575
- $type: "color",
1576
- $value: "{color.link.visited}"
1577
- }
1578
- }
1579
- }
1580
- };
1581
-
1582
- // src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
1583
- var color_template_default = {
1584
- "background-default": {
1585
- $type: "color",
1586
- $value: "{color.<color>.1}"
1587
- },
1588
- "background-tinted": {
1589
- $type: "color",
1590
- $value: "{color.<color>.2}"
1591
- },
1592
- "surface-default": {
1593
- $type: "color",
1594
- $value: "{color.<color>.3}"
1595
- },
1596
- "surface-tinted": {
1597
- $type: "color",
1598
- $value: "{color.<color>.4}"
1599
- },
1600
- "surface-hover": {
1601
- $type: "color",
1602
- $value: "{color.<color>.5}"
1603
- },
1604
- "surface-active": {
1605
- $type: "color",
1606
- $value: "{color.<color>.6}"
1607
- },
1608
- "border-subtle": {
1609
- $type: "color",
1610
- $value: "{color.<color>.7}"
1611
- },
1612
- "border-default": {
1613
- $type: "color",
1614
- $value: "{color.<color>.8}"
1615
- },
1616
- "border-strong": {
1617
- $type: "color",
1618
- $value: "{color.<color>.9}"
1619
- },
1620
- "text-subtle": {
1621
- $type: "color",
1622
- $value: "{color.<color>.10}"
1623
- },
1624
- "text-default": {
1625
- $type: "color",
1626
- $value: "{color.<color>.11}"
1627
- },
1628
- "base-default": {
1629
- $type: "color",
1630
- $value: "{color.<color>.12}"
1631
- },
1632
- "base-hover": {
1633
- $type: "color",
1634
- $value: "{color.<color>.13}"
1635
- },
1636
- "base-active": {
1637
- $type: "color",
1638
- $value: "{color.<color>.14}"
1639
- },
1640
- "base-contrast-subtle": {
1641
- $type: "color",
1642
- $value: "{color.<color>.15}"
1643
- },
1644
- "base-contrast-default": {
1645
- $type: "color",
1646
- $value: "{color.<color>.16}"
1647
- }
1648
- };
1649
-
1650
- // src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
1651
- var color_template_default2 = {
1652
- "background-default": {
1653
- $type: "color",
1654
- $value: "{color.<color>.background-default}"
1655
- },
1656
- "background-tinted": {
1657
- $type: "color",
1658
- $value: "{color.<color>.background-tinted}"
1659
- },
1660
- "surface-default": {
1661
- $type: "color",
1662
- $value: "{color.<color>.surface-default}"
1663
- },
1664
- "surface-tinted": {
1665
- $type: "color",
1666
- $value: "{color.<color>.surface-tinted}"
1667
- },
1668
- "surface-hover": {
1669
- $type: "color",
1670
- $value: "{color.<color>.surface-hover}"
1671
- },
1672
- "surface-active": {
1673
- $type: "color",
1674
- $value: "{color.<color>.surface-active}"
1675
- },
1676
- "border-subtle": {
1677
- $type: "color",
1678
- $value: "{color.<color>.border-subtle}"
1679
- },
1680
- "border-default": {
1681
- $type: "color",
1682
- $value: "{color.<color>.border-default}"
1683
- },
1684
- "border-strong": {
1685
- $type: "color",
1686
- $value: "{color.<color>.border-strong}"
1687
- },
1688
- "text-subtle": {
1689
- $type: "color",
1690
- $value: "{color.<color>.text-subtle}"
1691
- },
1692
- "text-default": {
1693
- $type: "color",
1694
- $value: "{color.<color>.text-default}"
1695
- },
1696
- "base-default": {
1697
- $type: "color",
1698
- $value: "{color.<color>.base-default}"
1699
- },
1700
- "base-hover": {
1701
- $type: "color",
1702
- $value: "{color.<color>.base-hover}"
1703
- },
1704
- "base-active": {
1705
- $type: "color",
1706
- $value: "{color.<color>.base-active}"
1707
- },
1708
- "base-contrast-subtle": {
1709
- $type: "color",
1710
- $value: "{color.<color>.base-contrast-subtle}"
1711
- },
1712
- "base-contrast-default": {
1713
- $type: "color",
1714
- $value: "{color.<color>.base-contrast-default}"
1715
- }
1716
- };
1717
-
1718
- // src/tokens/create/generators/semantic.ts
1719
- var generateSemantic = (colors, _themeName) => {
1720
- const mainColorNames = Object.keys(colors.main);
1721
- const supportColorNames = Object.keys(colors.support);
1722
- const modes = {
1723
- "main-color": {},
1724
- "support-color": {}
1597
+ },
1598
+ ...remainingThemeFile
1725
1599
  };
1726
- const categories = [
1727
- ["main-color", mainColorNames],
1728
- ["support-color", supportColorNames]
1729
- ];
1730
- for (const [colorCategory2, colorNames2] of categories) {
1731
- for (const colorName of colorNames2) {
1732
- const category = colorCategory2.replace("-color", "");
1733
- const customColorTokens = {
1734
- color: {
1735
- [category]: JSON.parse(
1736
- JSON.stringify(
1737
- color_template_default2,
1738
- (key, value) => {
1739
- if (key === "$value") {
1740
- return value.replace("<color>", colorName);
1741
- }
1742
- return value;
1743
- },
1744
- 2
1745
- )
1746
- )
1600
+ const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
1601
+ const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
1602
+ const token = JSON.parse(
1603
+ JSON.stringify(
1604
+ updatedThemeFile,
1605
+ (key, value) => {
1606
+ if (key === "$value") {
1607
+ return value.replace("<theme>", themeName);
1747
1608
  }
1748
- };
1749
- modes[colorCategory2][colorName] = customColorTokens;
1750
- }
1751
- }
1752
- const customColors = [...mainColorNames, "neutral", ...supportColorNames];
1753
- const allColors = [...customColors, ...baseColorNames];
1754
- const semanticColorTokens = allColors.map(
1755
- (colorName) => [
1756
- colorName,
1757
- R5.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
1758
- ]
1609
+ return value;
1610
+ },
1611
+ 2
1612
+ )
1759
1613
  );
1760
- const color = {
1761
- ...color_base_template_default,
1762
- color: {
1763
- ...Object.fromEntries(semanticColorTokens),
1764
- ...color_base_template_default.color
1765
- }
1766
- };
1767
- return {
1768
- modes,
1769
- color
1770
- };
1614
+ return token;
1771
1615
  };
1772
-
1773
- // src/tokens/create/generators/theme.ts
1774
- import * as R6 from "ramda";
1775
-
1776
- // src/tokens/template/design-tokens/themes/theme.base.template.json with { type: 'json' }
1777
- var theme_base_template_default = {
1616
+ var generateBase = (themeName) => ({
1778
1617
  color: {},
1779
1618
  "font-family": {
1780
1619
  $type: "fontFamilies",
1781
- $value: "{<theme>.font-family}"
1620
+ $value: `{${themeName}.font-family}`
1782
1621
  },
1783
1622
  "font-weight": {
1784
1623
  medium: {
1785
1624
  $type: "fontWeights",
1786
- $value: "{<theme>.font-weight.medium}"
1625
+ $value: `{${themeName}.font-weight.medium}`
1787
1626
  },
1788
1627
  semibold: {
1789
1628
  $type: "fontWeights",
1790
- $value: "{<theme>.font-weight.semibold}"
1629
+ $value: `{${themeName}.font-weight.semibold}`
1791
1630
  },
1792
1631
  regular: {
1793
1632
  $type: "fontWeights",
1794
- $value: "{<theme>.font-weight.regular}"
1633
+ $value: `{${themeName}.font-weight.regular}`
1795
1634
  }
1796
1635
  },
1797
1636
  "border-radius": {
@@ -1828,159 +1667,16 @@ var theme_base_template_default = {
1828
1667
  $value: "4"
1829
1668
  }
1830
1669
  }
1831
- };
1832
-
1833
- // src/tokens/template/design-tokens/themes/theme.template.json with { type: 'json' }
1834
- var theme_template_default = {
1835
- "1": {
1836
- $type: "color",
1837
- $value: "{<theme>.<color>.1}"
1838
- },
1839
- "2": {
1840
- $type: "color",
1841
- $value: "{<theme>.<color>.2}"
1842
- },
1843
- "3": {
1844
- $type: "color",
1845
- $value: "{<theme>.<color>.3}"
1846
- },
1847
- "4": {
1848
- $type: "color",
1849
- $value: "{<theme>.<color>.4}"
1850
- },
1851
- "5": {
1852
- $type: "color",
1853
- $value: "{<theme>.<color>.5}"
1854
- },
1855
- "6": {
1856
- $type: "color",
1857
- $value: "{<theme>.<color>.6}"
1858
- },
1859
- "7": {
1860
- $type: "color",
1861
- $value: "{<theme>.<color>.7}"
1862
- },
1863
- "8": {
1864
- $type: "color",
1865
- $value: "{<theme>.<color>.8}"
1866
- },
1867
- "9": {
1868
- $type: "color",
1869
- $value: "{<theme>.<color>.9}"
1870
- },
1871
- "10": {
1872
- $type: "color",
1873
- $value: "{<theme>.<color>.10}"
1874
- },
1875
- "11": {
1876
- $type: "color",
1877
- $value: "{<theme>.<color>.11}"
1878
- },
1879
- "12": {
1880
- $type: "color",
1881
- $value: "{<theme>.<color>.12}"
1882
- },
1883
- "13": {
1884
- $type: "color",
1885
- $value: "{<theme>.<color>.13}"
1886
- },
1887
- "14": {
1888
- $type: "color",
1889
- $value: "{<theme>.<color>.14}"
1890
- },
1891
- "15": {
1892
- $type: "color",
1893
- $value: "{<theme>.<color>.15}"
1894
- },
1895
- "16": {
1896
- $type: "color",
1897
- $value: "{<theme>.<color>.16}"
1898
- }
1899
- };
1900
-
1901
- // src/tokens/create/generators/theme.ts
1902
- var generateTheme = (colors, themeName, borderRadius) => {
1903
- const mainColorNames = Object.keys(colors.main);
1904
- const supportColorNames = Object.keys(colors.support);
1905
- const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
1906
- const themeColorTokens = Object.fromEntries(
1907
- customColors.map(
1908
- (colorName) => [
1909
- colorName,
1910
- R6.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
1911
- ]
1912
- )
1913
- );
1914
- const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
1915
- const themeFile = {
1916
- color: {
1917
- ...themeColorTokens,
1918
- ...themeBaseFileColor,
1919
- link: {
1920
- visited: {
1921
- $type: "color",
1922
- $value: `{${themeName}.link.visited}`
1923
- }
1924
- },
1925
- focus: {
1926
- "inner-color": {
1927
- $type: "color",
1928
- $value: `{${themeName}.focus.inner}`
1929
- },
1930
- "outer-color": {
1931
- $type: "color",
1932
- $value: `{${themeName}.focus.outer}`
1933
- }
1934
- }
1935
- },
1936
- ...remainingThemeFile
1937
- };
1938
- const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
1939
- const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
1940
- const token = JSON.parse(
1941
- JSON.stringify(
1942
- updatedThemeFile,
1943
- (key, value) => {
1944
- if (key === "$value") {
1945
- return value.replace("<theme>", themeName);
1946
- }
1947
- return value;
1948
- },
1949
- 2
1950
- )
1951
- );
1952
- return token;
1953
- };
1954
-
1955
- // src/tokens/template/design-tokens/primitives/modes/typography/typography.template.json with { type: 'json' }
1956
- var typography_template_default = {
1957
- "<theme>": {
1958
- "font-family": {
1959
- $type: "fontFamilies",
1960
- $value: "<font-family>"
1961
- },
1962
- "font-weight": {
1963
- medium: {
1964
- $type: "fontWeights",
1965
- $value: "Medium"
1966
- },
1967
- semibold: {
1968
- $type: "fontWeights",
1969
- $value: "Semi bold"
1970
- },
1971
- regular: {
1972
- $type: "fontWeights",
1973
- $value: "Regular"
1974
- }
1975
- }
1670
+ });
1671
+ var generateColorScaleTokens3 = (colorName, themeName) => {
1672
+ const colorScale = {};
1673
+ for (const [_, colorNumber] of R6.toPairs(semanticColorMap)) {
1674
+ colorScale[colorNumber] = {
1675
+ $type: "color",
1676
+ $value: `{${themeName}.${colorName}.${colorNumber}}`
1677
+ };
1976
1678
  }
1977
- };
1978
-
1979
- // src/tokens/create/generators/typography.ts
1980
- var generateTypography = (themeName, { fontFamily }) => {
1981
- return JSON.parse(
1982
- JSON.stringify(typography_template_default).replaceAll(/<font-family>/g, fontFamily).replaceAll(/<theme>/g, themeName)
1983
- );
1679
+ return colorScale;
1984
1680
  };
1985
1681
 
1986
1682
  // src/tokens/create.ts
@@ -2000,20 +1696,17 @@ var cliOptions = {
2000
1696
  borderRadius: "border-radius"
2001
1697
  }
2002
1698
  };
2003
- var createTokens = async (opts) => {
2004
- const { colors, typography: typography2, name, borderRadius, overrides } = opts;
1699
+ var createTokens = async (theme) => {
1700
+ const { colors, typography: typography2, name, borderRadius, overrides } = theme;
2005
1701
  const colorSchemes = ["light", "dark"];
2006
- const semantic2 = generateSemantic(colors, name);
1702
+ const sizeModes2 = ["small", "medium", "large"];
2007
1703
  const tokenSets = new Map([
2008
- ...getDefaultTokens([
2009
- "primitives/globals",
2010
- "primitives/modes/size/small",
2011
- "primitives/modes/size/medium",
2012
- "primitives/modes/size/large",
2013
- "primitives/modes/size/global",
2014
- "primitives/modes/typography/size/small",
2015
- "primitives/modes/typography/size/medium",
2016
- "primitives/modes/typography/size/large"
1704
+ ["primitives/globals", generateGlobals()],
1705
+ ...sizeModes2.map((size2) => [`primitives/modes/size/${size2}`, generateSize(size2)]),
1706
+ ["primitives/modes/size/global", generateSizeGlobal()],
1707
+ ...sizeModes2.map((size2) => [
1708
+ `primitives/modes/typography/size/${size2}`,
1709
+ generateFontSizes(size2)
2017
1710
  ]),
2018
1711
  [`primitives/modes/typography/primary/${name}`, generateTypography(name, typography2)],
2019
1712
  [`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography2)],
@@ -2021,12 +1714,12 @@ var createTokens = async (opts) => {
2021
1714
  [`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]
2022
1715
  ]),
2023
1716
  [`themes/${name}`, generateTheme(colors, name, borderRadius)],
2024
- ["semantic/color", semantic2.color],
1717
+ ["semantic/color", generateSemanticColors(colors, name)],
2025
1718
  // maps out semantic modes, ieg 'semantic/modes/main-color/accent', and 'semantic/modes/support-color/brand1'
2026
- ...Object.entries(semantic2.modes).flatMap(
1719
+ ...Object.entries(generateColorModes(colors, name)).flatMap(
2027
1720
  ([mode, colors2]) => Object.entries(colors2).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])
2028
1721
  ),
2029
- getDefaultToken("semantic/style")
1722
+ [`semantic/style`, generateSemanticStyle()]
2030
1723
  ]);
2031
1724
  return { tokenSets };
2032
1725
  };
@@ -2280,9 +1973,9 @@ async function createHash(text, algo = "SHA-1") {
2280
1973
  (byte) => byte.toString(16).padStart(2, "0")
2281
1974
  ).join("");
2282
1975
  }
2283
- async function generate$Themes(colorSchemes, themes, colors) {
1976
+ async function generate$Themes(colorSchemes, themes, colors, sizeModes2) {
2284
1977
  return [
2285
- ...generateSizeGroup(),
1978
+ ...generateSizeGroup(sizeModes2),
2286
1979
  ...await generateThemesGroup(themes),
2287
1980
  ...generateTypographyGroup(themes),
2288
1981
  ...generateColorSchemesGroup(colorSchemes, themes),
@@ -2291,7 +1984,7 @@ async function generate$Themes(colorSchemes, themes, colors) {
2291
1984
  ...await generateColorGroup("support", colors)
2292
1985
  ];
2293
1986
  }
2294
- function generateSizeGroup() {
1987
+ function generateSizeGroup(_sizes) {
2295
1988
  return [
2296
1989
  {
2297
1990
  id: "8b2c8cc86611a34b135cb22948666779361fd729",
@@ -2445,7 +2138,7 @@ import * as R9 from "ramda";
2445
2138
  // package.json
2446
2139
  var package_default = {
2447
2140
  name: "@digdir/designsystemet",
2448
- version: "1.11.1",
2141
+ version: "1.12.0",
2449
2142
  description: "CLI for Designsystemet",
2450
2143
  author: "Designsystemet team",
2451
2144
  engines: {
@@ -2497,9 +2190,8 @@ var package_default = {
2497
2190
  "test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
2498
2191
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
2499
2192
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
2500
- "test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../internal/digdir/design-tokens --dry",
2193
+ "test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../design-tokens --dry",
2501
2194
  test: "node -v && pnpm test:tokens-create-and-build-options && pnpm test:generate-config-from-tokens && pnpm test:tokens-create-and-build-config",
2502
- "update:template": "tsx ./src/scripts/update-template.ts",
2503
2195
  "update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
2504
2196
  verify: "pnpm test && pnpm update:template && pnpm --filter @internal/digdir update:theme-digdir"
2505
2197
  },
@@ -2516,14 +2208,14 @@ var package_default = {
2516
2208
  picocolors: "^1.1.1",
2517
2209
  postcss: "^8.5.6",
2518
2210
  ramda: "^0.32.0",
2519
- "style-dictionary": "^5.2.0",
2211
+ "style-dictionary": "^5.3.0",
2520
2212
  zod: "^4.3.6",
2521
2213
  "zod-validation-error": "^5.0.0"
2522
2214
  },
2523
2215
  devDependencies: {
2524
2216
  "@tokens-studio/types": "0.5.2",
2525
2217
  "@types/chroma-js": "^3.1.2",
2526
- "@types/node": "^24.10.9",
2218
+ "@types/node": "^24.10.13",
2527
2219
  "@types/object-hash": "^3.0.6",
2528
2220
  "@types/ramda": "^0.31.1",
2529
2221
  tsup: "^8.5.1",
@@ -3486,8 +3178,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
3486
3178
  const grouped$themes = groupThemes(processed$themes);
3487
3179
  const permutations = permutateThemes(grouped$themes);
3488
3180
  const ALL_DEPENDENT_ON = ["theme"];
3489
- const keys2 = R21.keys(grouped$themes);
3490
- const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
3181
+ const keys3 = R21.keys(grouped$themes);
3182
+ const nonDependentKeys = keys3.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
3491
3183
  if (verboseLogging) {
3492
3184
  console.log(pc3.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
3493
3185
  console.log(pc3.cyan(` (ignoring permutations for ${nonDependentKeys})`));
@@ -3748,10 +3440,10 @@ async function processPlatform(options) {
3748
3440
  console.log(`
3749
3441
  \u{1F3A8} Using ${pc4.blue(buildOptions.defaultColor)} as default color`);
3750
3442
  }
3751
- const sizeModes = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
3752
- buildOptions.sizeModes = sizeModes;
3443
+ const sizeModes2 = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
3444
+ buildOptions.sizeModes = sizeModes2;
3753
3445
  if (!buildOptions.defaultSize) {
3754
- const defaultSize = R23.head(sizeModes);
3446
+ const defaultSize = R23.head(sizeModes2);
3755
3447
  buildOptions.defaultSize = defaultSize;
3756
3448
  }
3757
3449
  if (buildOptions.defaultSize) {
@@ -3841,7 +3533,8 @@ var formatTokens = async (options) => {
3841
3533
  };
3842
3534
  var formatTheme = async (themeConfig) => {
3843
3535
  const { tokenSets } = await createTokens(themeConfig);
3844
- const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors);
3536
+ const sizeModes2 = ["small", "medium", "large"];
3537
+ const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors, sizeModes2);
3845
3538
  const processed$themes = $themes.map(processThemeObject);
3846
3539
  const processedBuilds = await formatTokens({
3847
3540
  tokenSets,
@@ -3888,5 +3581,8 @@ export {
3888
3581
  hexToRgb,
3889
3582
  hslArrToCss,
3890
3583
  isHexColor,
3891
- rgbToHex
3584
+ rgbToHex,
3585
+ semanticColorMap,
3586
+ semanticColorNames,
3587
+ semanticColorNumbers
3892
3588
  };