@viasat/beam-tokens 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +275 -0
  2. package/components/Accordion.css +108 -0
  3. package/components/ActionList.css +150 -0
  4. package/components/Alert.css +244 -0
  5. package/components/Avatar.css +124 -0
  6. package/components/Badge.css +542 -0
  7. package/components/BadgeDot.css +150 -0
  8. package/components/BatchActions.css +34 -0
  9. package/components/Breadcrumb.css +44 -0
  10. package/components/Button.css +466 -0
  11. package/components/Card.css +102 -0
  12. package/components/Chip.css +102 -0
  13. package/components/CloseButton.css +42 -0
  14. package/components/DataTable.css +214 -0
  15. package/components/Dialog.css +150 -0
  16. package/components/Divider.css +32 -0
  17. package/components/EmptyState.css +56 -0
  18. package/components/FileUpload.css +204 -0
  19. package/components/Header.css +94 -0
  20. package/components/HelperText.css +100 -0
  21. package/components/Input.css +328 -0
  22. package/components/Label.css +46 -0
  23. package/components/Link.css +102 -0
  24. package/components/List.css +22 -0
  25. package/components/Menu.css +14 -0
  26. package/components/Pagination.css +58 -0
  27. package/components/Panel.css +74 -0
  28. package/components/Popover.css +56 -0
  29. package/components/ProgressBar.css +78 -0
  30. package/components/SegmentedControl.css +56 -0
  31. package/components/SideNav.css +28 -0
  32. package/components/Slider.css +78 -0
  33. package/components/Spinner.css +120 -0
  34. package/components/Stepper.css +248 -0
  35. package/components/Tabs.css +106 -0
  36. package/components/Toast.css +190 -0
  37. package/components/Tooltip.css +70 -0
  38. package/index.cjs +2 -0
  39. package/index.js +2258 -0
  40. package/package.json +63 -0
  41. package/themes/blue.css +32 -0
  42. package/themes/green.css +44 -0
  43. package/themes/neutral.css +32 -0
  44. package/themes/onefi.css +6069 -0
  45. package/themes/orange.css +32 -0
  46. package/themes/pink.css +32 -0
  47. package/themes/violet.css +32 -0
  48. package/tokens.css +3573 -0
  49. package/tokens.scss +3889 -0
  50. package/types/configs/colors/colors.format.d.ts +11 -0
  51. package/types/configs/colors/colors.transformers.d.ts +9 -0
  52. package/types/configs/colors/colors.utils.d.ts +21 -0
  53. package/types/configs/colors/index.d.ts +5 -0
  54. package/types/configs/colors/sd.colors.config.d.ts +7 -0
  55. package/types/configs/components/components.format.css.d.ts +16 -0
  56. package/types/configs/components/components.transformers.d.ts +4 -0
  57. package/types/configs/components/index.d.ts +2 -0
  58. package/types/configs/components/sd.components.config.d.ts +11 -0
  59. package/types/configs/dimensions/dimension.format.css.d.ts +8 -0
  60. package/types/configs/dimensions/dimensions.transformers.d.ts +9 -0
  61. package/types/configs/dimensions/dimensions.utils.d.ts +55 -0
  62. package/types/configs/dimensions/index.d.ts +7 -0
  63. package/types/configs/dimensions/sd.dimension.config.d.ts +15 -0
  64. package/types/configs/expressive/expressive.format.d.ts +11 -0
  65. package/types/configs/expressive/index.d.ts +3 -0
  66. package/types/configs/expressive/sd.expressive.config.d.ts +6 -0
  67. package/types/configs/index.d.ts +7 -0
  68. package/types/configs/js/index.d.ts +4 -0
  69. package/types/configs/js/js.formatters.d.ts +3 -0
  70. package/types/configs/js/js.transformers.d.ts +10 -0
  71. package/types/configs/js/js.utils.d.ts +2 -0
  72. package/types/configs/js/sd.js.config.d.ts +6 -0
  73. package/types/configs/language/formatters/css.d.ts +17 -0
  74. package/types/configs/language/formatters/index.d.ts +3 -0
  75. package/types/configs/language/index.d.ts +6 -0
  76. package/types/configs/language/sd.language.config.d.ts +7 -0
  77. package/types/configs/language/transformers/attribute.d.ts +10 -0
  78. package/types/configs/language/transformers/index.d.ts +5 -0
  79. package/types/configs/product-type/index.d.ts +5 -0
  80. package/types/configs/product-type/product-type.format.css.d.ts +8 -0
  81. package/types/configs/product-type/product-type.transformers.d.ts +2 -0
  82. package/types/configs/product-type/sd.product-tokens.config.d.ts +7 -0
  83. package/types/configs/shadows/index.d.ts +7 -0
  84. package/types/configs/shadows/sd.shadow.config.d.ts +9 -0
  85. package/types/configs/shadows/shadow.transformers.d.ts +7 -0
  86. package/types/configs/shadows/shadows.format.css.d.ts +8 -0
  87. package/types/configs/shadows/shadows.utils.d.ts +11 -0
  88. package/types/configs/storybook/index.d.ts +4 -0
  89. package/types/configs/storybook/js.formatters.d.ts +3 -0
  90. package/types/configs/storybook/js.transformers.d.ts +5 -0
  91. package/types/configs/storybook/js.utils.d.ts +2 -0
  92. package/types/configs/storybook/sd.storybook.config.d.ts +6 -0
  93. package/types/configs/themes/generateThemes.d.ts +2 -0
  94. package/types/configs/themes/index.d.ts +1 -0
  95. package/types/configs/themes/sd.theme.config.d.ts +3 -0
  96. package/types/configs/themes/theme.utils.d.ts +18 -0
  97. package/types/configs/typography/formatters/css.d.ts +20 -0
  98. package/types/configs/typography/formatters/index.d.ts +3 -0
  99. package/types/configs/typography/helpers.d.ts +84 -0
  100. package/types/configs/typography/index.d.ts +6 -0
  101. package/types/configs/typography/sd.typography.config.d.ts +5 -0
  102. package/types/configs/typography/transformers/attribute.d.ts +16 -0
  103. package/types/configs/typography/transformers/index.d.ts +5 -0
  104. package/types/configs/typography/transformers/value.d.ts +4 -0
  105. package/types/lib/index.d.ts +8 -0
  106. package/types/lib/js/tokens.d.ts +1462 -0
  107. package/types/lib/js/tokensObj.d.ts +15888 -0
  108. package/types/lib/storybook-token-table/tokens.d.ts +9980 -0
  109. package/types/utils/build-tokens.d.ts +1 -0
  110. package/types/utils/constants/class-names.d.ts +19 -0
  111. package/types/utils/constants/index.d.ts +7 -0
  112. package/types/utils/constants/math.d.ts +1 -0
  113. package/types/utils/constants/paths.d.ts +27 -0
  114. package/types/utils/constants/theme.d.ts +24 -0
  115. package/types/utils/constants/token-types.d.ts +48 -0
  116. package/types/utils/constants/types.d.ts +114 -0
  117. package/types/utils/constants/typography.d.ts +39 -0
  118. package/types/utils/dataviz.d.ts +68 -0
  119. package/types/utils/files/cleanup.d.ts +11 -0
  120. package/types/utils/files/index.d.ts +5 -0
  121. package/types/utils/files/merge.d.ts +20 -0
  122. package/types/utils/files/paths.d.ts +25 -0
  123. package/types/utils/files/scan.d.ts +38 -0
  124. package/types/utils/files/validate.d.ts +13 -0
  125. package/types/utils/formatters/className.d.ts +13 -0
  126. package/types/utils/formatters/format.css.d.ts +19 -0
  127. package/types/utils/formatters/format.scss.d.ts +12 -0
  128. package/types/utils/formatters/index.d.ts +4 -0
  129. package/types/utils/formatters/token.utils.css.d.ts +50 -0
  130. package/types/utils/functions.d.ts +13 -0
  131. package/types/utils/index.d.ts +8 -0
  132. package/types/utils/occurrences.d.ts +32 -0
  133. package/types/utils/tokens.d.ts +34 -0
  134. package/types/utils/transformers.d.ts +11 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ClassName } from './types';
2
+ export declare const DEFAULT_BRAND = "beam";
3
+ export declare const BEAM_PREFIX = "bm";
4
+ export declare const BEAM_LIGHT_THEME = "bm-light";
5
+ export declare const BEAM_DARK_THEME = "bm-dark";
6
+ export declare const BEAM_CONSUMER_THEME = "bm-consumer";
7
+ export declare const BEAM_ENTERPRISE_THEME = "bm-enterprise";
8
+ export declare const BEAM_LANGUAGE_PREFIX = "bm-lang";
9
+ export declare const BEAM_EXPRESSIVE_PREFIX = "bm-expressive";
10
+ export declare const BEAM_INVERSE_PREFIX = "bm-inverse";
11
+ export declare const BEAM_PREFIX_REGEX: RegExp;
12
+ export declare const BEAM_LIGHT_THEME_CLASS_OBJ: ClassName;
13
+ export declare const BEAM_LIGHT_INVERSE_THEME_CLASS_OBJ: ClassName;
14
+ export declare const BEAM_DARK_THEME_CLASS_OBJ: ClassName;
15
+ export declare const BEAM_DARK_INVERSE_THEME_CLASS_OBJ: ClassName;
16
+ export declare const BEAM_LIGHT_AND_DARK_THEME_CLASS_OBJ: ClassName;
17
+ export declare const BEAM_ENTERPRISE_THEME_CLASS_OBJ: ClassName;
18
+ export declare const BEAM_CONSUMER_THEME_CLASS_OBJ: ClassName;
19
+ export declare const CLASS_NAME: ClassName;
@@ -0,0 +1,7 @@
1
+ export * from './class-names';
2
+ export * from './math';
3
+ export * from './paths';
4
+ export * from './token-types';
5
+ export * from './theme';
6
+ export * from './types';
7
+ export * from './typography';
@@ -0,0 +1 @@
1
+ export declare const MATH_SYMBOLS: readonly ["*", "/"];
@@ -0,0 +1,27 @@
1
+ export declare const TOKEN_ROOT_PATH: string;
2
+ export declare const LIB_ROOT_PATH: string;
3
+ export declare const tailwindRootPath: string;
4
+ export declare const ACCENT_THEMES_ROOT_PATH: string;
5
+ export declare const BRAND_THEMES_ROOT_PATH: string;
6
+ export declare const COMP_TOKEN_PATH: string;
7
+ export declare const EXPRESSIVE_TOKEN_PATH: string;
8
+ export declare const DEFAULT_TOKENS_FILE_NAME = "tokens";
9
+ export declare const TOKEN_FILE_NAMES: {
10
+ readonly primitive: "primitives.json";
11
+ readonly sem: "semantic.json";
12
+ readonly comp: readonly ["components.json", "light.json", "dark.json"];
13
+ readonly light: "light.json";
14
+ readonly dark: "dark.json";
15
+ readonly theme: "theme.json";
16
+ readonly color: readonly ["light.json", "dark.json", "opacity.json", "theme.json"];
17
+ readonly dimension: readonly ["space.json", "size.json", "border-width.json", "radius.json", "components.json"];
18
+ readonly shadow: readonly ["light.json", "dark.json", "components.json"];
19
+ readonly typography: "typography.json";
20
+ readonly language: "typography.json";
21
+ readonly consumer: "consumer.json";
22
+ readonly enterprise: "enterprise.json";
23
+ };
24
+ export declare const LIGHT_MODE_SOURCE: string[];
25
+ export declare const DARK_MODE_SOURCE: string[];
26
+ export declare const ENTERPRISE_SOURCE: string[];
27
+ export declare const CONSUMER_SOURCE: string[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Color themes we support
3
+ */
4
+ export declare const BASE_COLOR_THEMES: {
5
+ readonly light: "light";
6
+ readonly dark: "dark";
7
+ };
8
+ /**
9
+ * Shapes themes we support
10
+ */
11
+ export declare const BASE_SHAPE_THEMES: {
12
+ readonly consumer: "consumer";
13
+ readonly enterprise: "enterprise";
14
+ };
15
+ /**
16
+ * Language that are supported. Update this list as needed
17
+ */
18
+ export declare const SUPPORTED_LANGUAGE_CODES: {
19
+ readonly ar: "ar";
20
+ readonly he: "he";
21
+ readonly ja: "ja";
22
+ readonly zh: "zh";
23
+ };
24
+ export declare const SUPPORT_LANGUAGES: ("ar" | "he" | "ja" | "zh")[];
@@ -0,0 +1,48 @@
1
+ import { TOKEN_CATEGORY } from './types';
2
+ export declare const TOKEN_CATEGORIES_SEM: {
3
+ readonly sem: "sem";
4
+ readonly utility: "utility";
5
+ readonly expressive: "expressive";
6
+ readonly theme: "theme";
7
+ readonly dataviz: "dataviz";
8
+ };
9
+ /**
10
+ * The top level token categories we support. These come right after
11
+ * the `bm` prefix
12
+ * @example primitive, sem, comp, utility, etc.
13
+ */
14
+ export declare const TOKEN_CATEGORIES: {
15
+ readonly comp: "comp";
16
+ readonly sem: "sem";
17
+ readonly utility: "utility";
18
+ readonly expressive: "expressive";
19
+ readonly theme: "theme";
20
+ readonly dataviz: "dataviz";
21
+ readonly primitive: "primitive";
22
+ };
23
+ /**
24
+ * The top level token categories we support with `bm` prefix
25
+ * @example bm-primitive, bm-sem, bm-comp, bm-utility, etc.
26
+ */
27
+ export declare const TOKEN_CATEGORIES_PREFIXED: Record<TOKEN_CATEGORY, string>;
28
+ export declare const SUPPORTED_TOKEN_TYPES: {
29
+ readonly color: "color";
30
+ readonly dimension: "dimension";
31
+ readonly js: "js";
32
+ readonly language: "language";
33
+ readonly productType: "productType";
34
+ readonly typography: "typography";
35
+ readonly shadow: "shadow";
36
+ readonly expressive: "expressive";
37
+ };
38
+ export declare const EXPRESSIVE_THEMES: {
39
+ readonly accent: "accent";
40
+ readonly blue: "blue";
41
+ readonly gray: "gray";
42
+ readonly green: "green";
43
+ readonly orange: "orange";
44
+ readonly pink: "pink";
45
+ readonly red: "red";
46
+ readonly teal: "teal";
47
+ readonly violet: "violet";
48
+ };
@@ -0,0 +1,114 @@
1
+ import { Config, Format, Named, Platform, Transform, TransformGroup, File, TransformedToken } from 'style-dictionary';
2
+ import { TOKEN_FILE_NAMES } from './paths';
3
+ import { EXPRESSIVE_THEMES, SUPPORTED_TOKEN_TYPES, TOKEN_CATEGORIES } from './token-types';
4
+ import { BASE_COLOR_THEMES, BASE_SHAPE_THEMES, SUPPORTED_LANGUAGE_CODES } from './theme';
5
+ export type TOKEN_FILE_NAME_KEYS = keyof typeof TOKEN_FILE_NAMES;
6
+ export type VALID_TOKEN_TYPES = keyof typeof SUPPORTED_TOKEN_TYPES;
7
+ export type TOKEN_CATEGORY = keyof typeof TOKEN_CATEGORIES;
8
+ /**
9
+ * Theming
10
+ */
11
+ export type BaseColorTheme = typeof BASE_COLOR_THEMES[keyof typeof BASE_COLOR_THEMES];
12
+ export type BaseShapeTheme = typeof BASE_SHAPE_THEMES[keyof typeof BASE_SHAPE_THEMES];
13
+ export type SupportedLanguages = typeof SUPPORTED_LANGUAGE_CODES[keyof typeof SUPPORTED_LANGUAGE_CODES];
14
+ export type ComponentTokenPaths = typeof TOKEN_FILE_NAMES[Extract<TOKEN_CATEGORY, 'comp'>];
15
+ export type PrimitiveAndCompTokenCategories = Extract<TOKEN_CATEGORY, 'primitive' | 'comp'>;
16
+ export type TokenOutputPaths = Record<TOKEN_FILE_NAME_KEYS | PrimitiveAndCompTokenCategories | BaseColorTheme, string | ComponentTokenPaths | TOKEN_FILE_NAME_KEYS[]>;
17
+ export type ThemeConfig = Partial<{
18
+ [k in VALID_TOKEN_TYPES | PrimitiveAndCompTokenCategories]: boolean | BuildConfig;
19
+ }> & {
20
+ brandName: string;
21
+ themeName: string;
22
+ themeRootPath: string;
23
+ colorThemes: BaseColorTheme[];
24
+ shapeThemes?: BaseShapeTheme[];
25
+ storybook?: BuildConfig;
26
+ };
27
+ export type ThemeConfigurationGenerator = {
28
+ theme: ThemeConfig;
29
+ commonConfig: CommonConfig;
30
+ tokenFilter: (token: TransformedToken) => boolean;
31
+ languages?: SupportedLanguages[];
32
+ };
33
+ export type ExpressThemes = typeof EXPRESSIVE_THEMES[keyof typeof EXPRESSIVE_THEMES];
34
+ export type OrganizedThemes = Record<string, Record<VALID_TOKEN_TYPES, BuildConfig[]>>;
35
+ /**
36
+ * SD.Configs
37
+ */
38
+ export type CommonConfig = {
39
+ transformGroup: Platform['transformGroup'];
40
+ buildPath: Platform['buildPath'];
41
+ format: File['format'];
42
+ options?: Platform['options'];
43
+ };
44
+ export type CssVarsFormatters = Named<Format>[];
45
+ export type TokenTransformers = {
46
+ transformGroup: Named<TransformGroup>;
47
+ transformers: Named<Transform>[];
48
+ };
49
+ export type OutPutFilesPaths = {
50
+ css?: string[];
51
+ scss?: string[];
52
+ };
53
+ export type BuildConfig = {
54
+ transformers: TokenTransformers;
55
+ formatters: CssVarsFormatters;
56
+ configs: Config[];
57
+ outputFilesPaths: OutPutFilesPaths;
58
+ };
59
+ export declare const shadowTypes: readonly ["dropShadow", "boxShadow", "innerShadow", "shadow"];
60
+ export type ShadowType = typeof shadowTypes[number];
61
+ export type ShadowTokenValue = {
62
+ x: string;
63
+ y: string;
64
+ blur: string;
65
+ spread: string;
66
+ color: string;
67
+ type?: ShadowType;
68
+ };
69
+ export declare const colorTypes: readonly ["color", "gradient", "opacity"];
70
+ export type ColorType = typeof colorTypes[number];
71
+ export declare const dimensionTypes: readonly ["dimension", "space", "radius", "size", "border-width"];
72
+ export type DimensionType = typeof dimensionTypes[number];
73
+ export declare const utilityTypes: readonly ["utility", "other", "number"];
74
+ export type UtilityType = typeof utilityTypes[number];
75
+ export declare const tokenTypes: readonly ["color", "gradient", "opacity", "dropShadow", "boxShadow", "innerShadow", "shadow", "dimension", "space", "radius", "size", "border-width", "utility", "other", "number", "typography", ...("fontFamilies" | "fontWeights" | "lineHeights" | "letterSpacing" | "paragraphSpacing" | "textCase" | "textDecoration" | "fontSizes")[]];
76
+ export type TokenType = typeof tokenTypes[number];
77
+ export type ClassName = {
78
+ /**
79
+ * The base Beam theme
80
+ * @example bm-light bm-dark
81
+ */
82
+ base?: string;
83
+ /**
84
+ * Brand specific class name
85
+ * @example bm-onefi
86
+ */
87
+ brand?: string;
88
+ /**
89
+ * Sub brand specific class name
90
+ * @example bm-onefi-starlux bm-onefi-rja
91
+ */
92
+ subBrand?: string;
93
+ /**
94
+ * Language specific class name
95
+ * @example bm-lang-en bm-lang-es
96
+ */
97
+ lang?: string;
98
+ };
99
+ /**
100
+ * Represents the number of occurrences for each token category.
101
+ *
102
+ * This type is used to keep track of how many times each token category appears.
103
+ *
104
+ * @example
105
+ * const occurrences: OccurrenceCounts = {
106
+ * primitive: 2,
107
+ * sem: 1,
108
+ * utility: 0,
109
+ * comp: 3,
110
+ * expressive: 0,
111
+ * theme: 1,
112
+ * };
113
+ */
114
+ export type OccurrenceCounts = Record<TOKEN_CATEGORY, number>;
@@ -0,0 +1,39 @@
1
+ export declare const FONT_WEIGHT: {
2
+ readonly Thin: "100";
3
+ readonly ExtraLight: "200";
4
+ readonly UltraLight: "200";
5
+ readonly Light: "300";
6
+ readonly Book: "350";
7
+ readonly Normal: "400";
8
+ readonly Regular: "400";
9
+ readonly Roman: "400";
10
+ readonly Medium: "500";
11
+ readonly SemiBold: "600";
12
+ readonly DemiBold: "600";
13
+ readonly Bold: "700";
14
+ /**
15
+ * This should probably be '900' however we
16
+ * control the font definitions in our @font-faces
17
+ * so it's not a problem... Unless someone loads
18
+ * our fonts with a different definition.
19
+ */
20
+ readonly Heavy: "800";
21
+ readonly ExtraBold: "800";
22
+ readonly UltraBold: "800";
23
+ readonly Black: "900";
24
+ readonly Italic: "italic";
25
+ };
26
+ export type Font_Weights = keyof typeof FONT_WEIGHT;
27
+ export declare const TYPO_CSS_ATTRIBUTES: {
28
+ readonly fontFamilies: "fontFamilies";
29
+ readonly fontWeights: "fontWeights";
30
+ readonly lineHeights: "lineHeights";
31
+ readonly letterSpacing: "letterSpacing";
32
+ readonly paragraphSpacing: "paragraphSpacing";
33
+ readonly textCase: "textCase";
34
+ readonly textDecoration: "textDecoration";
35
+ readonly fontSizes: "fontSizes";
36
+ };
37
+ export type Typo_Css_Attributes = typeof TYPO_CSS_ATTRIBUTES[keyof typeof TYPO_CSS_ATTRIBUTES];
38
+ export declare const TYPO_TOKENS: readonly ["typography", ...("fontFamilies" | "fontWeights" | "lineHeights" | "letterSpacing" | "paragraphSpacing" | "textCase" | "textDecoration" | "fontSizes")[]];
39
+ export type Typo_Tokens = typeof TYPO_TOKENS[number];
@@ -0,0 +1,68 @@
1
+ export declare const DatavizGradients: {
2
+ SequentialOpt1: {
3
+ 0: string;
4
+ 14: string;
5
+ 28: string;
6
+ 42: string;
7
+ 56: string;
8
+ 70: string;
9
+ 84: string;
10
+ 100: string;
11
+ };
12
+ DivergingOpt1: {
13
+ 0: string;
14
+ 10: string;
15
+ 20: string;
16
+ 30: string;
17
+ 40: string;
18
+ 50: string;
19
+ 60: string;
20
+ 70: string;
21
+ 80: string;
22
+ 90: string;
23
+ 100: string;
24
+ };
25
+ DivergingOpt2: {
26
+ 0: string;
27
+ 10: string;
28
+ 20: string;
29
+ 30: string;
30
+ 40: string;
31
+ 50: string;
32
+ 60: string;
33
+ 70: string;
34
+ 80: string;
35
+ 90: string;
36
+ 100: string;
37
+ };
38
+ };
39
+ export interface GetGradientColorValueProps {
40
+ /**
41
+ * Starting value of the data range
42
+ */
43
+ start: number;
44
+ /**
45
+ * Ending value of the data range
46
+ */
47
+ end: number;
48
+ /**
49
+ * Value between start and end to calculate the gradient color for
50
+ */
51
+ value: number;
52
+ /**
53
+ * True if result color is binned by color stop, false for actual linear gradient
54
+ */
55
+ binned: boolean;
56
+ /**
57
+ * The desired gradient style to use
58
+ */
59
+ gradientOption: keyof typeof DatavizGradients;
60
+ }
61
+ /**
62
+ * Given a start and end data range and a specific value, computes the appropriate
63
+ * color result as an RGB() string for the requested gradient option. Use binned = true
64
+ * to return the color stop closest to the given value, otherwise false for an
65
+ * interpolated result between the two closest color stops along the gradient.
66
+ */
67
+ export declare const getGradientColorValue: ({ start, end, value, binned, gradientOption, }: GetGradientColorValueProps) => string | undefined;
68
+ export declare const getValueAsPercent: (start: number, end: number, value: number) => number;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Cleans directories in the library folder except for index.ts
3
+ * @param dirPath - Directory path to clean
4
+ */
5
+ export declare const cleanLibsDir: (dirPath: string) => Promise<void>;
6
+ /**
7
+ * Removes duplicate Sass variables from file content
8
+ * @param fileContent - SCSS file content with potential duplicates
9
+ * @returns Deduplicated content
10
+ */
11
+ export declare const removeDuplicateSassVariables: (fileContent: string) => string;
@@ -0,0 +1,5 @@
1
+ export * from './cleanup';
2
+ export * from './merge';
3
+ export * from './paths';
4
+ export * from './scan';
5
+ export * from './validate';
@@ -0,0 +1,20 @@
1
+ import { BuiltInParserName, CustomParser, LiteralUnion } from 'prettier';
2
+ import { BuildConfig, VALID_TOKEN_TYPES } from '../constants/types';
3
+ /**
4
+ * Merges multiple files into a single output file
5
+ * @param outputPaths - Array of paths to input files
6
+ * @param outPutPath - Path to the output file
7
+ * @param outPutType - Type of the output file for formatting
8
+ */
9
+ export declare const mergeFiles: (outputPaths: string[] | undefined, outPutPath: string, outPutType: LiteralUnion<BuiltInParserName, string> | CustomParser | undefined) => Promise<void>;
10
+ /**
11
+ * Merges output files for each brand and all SCSS files into single files
12
+ * @param groupedBuildConfigs - Grouped build configurations by brand and token type
13
+ */
14
+ export declare const mergeOutputFiles: (groupedBuildConfigs: Record<string, Record<VALID_TOKEN_TYPES, BuildConfig[]>>) => Promise<void>;
15
+ /**
16
+ * Merges light and dark component CSS files into single files
17
+ * Processes all files in parallel for better performance
18
+ * @param componentDir - Directory containing the temporary component files
19
+ */
20
+ export declare const mergeComponentFiles: (componentDir: string) => Promise<void>;
@@ -0,0 +1,25 @@
1
+ import { Config } from 'style-dictionary';
2
+ import { OutPutFilesPaths, BuildConfig, ThemeConfig, OrganizedThemes } from '../constants/types';
3
+ /**
4
+ * Generates a list of output file paths from Style Dictionary configs
5
+ * @param configs - Array of Style Dictionary configurations
6
+ * @param fileType - File type to filter for (e.g., 'css', 'scss')
7
+ * @returns Array of file paths
8
+ */
9
+ export declare const generateOutputFileList: (configs: Config[], fileType: string) => string[];
10
+ /**
11
+ * Groups themes by brand, organizing configurations by token type
12
+ * @param themes - Array of theme configurations
13
+ * @returns Organized themes grouped by brand and token type
14
+ */
15
+ export declare const groupThemesByBrand: (themes: ThemeConfig[]) => OrganizedThemes;
16
+ /**
17
+ * Generates filtered output file paths based on build configurations
18
+ * @param buildConfigs - Array of build configurations
19
+ * @param brandName - Optional brand name to filter by
20
+ * @returns Filtered output paths for CSS and SCSS files
21
+ */
22
+ export declare const generateFilteredOutputPaths: ({ buildConfigs, brandName, }: {
23
+ buildConfigs: BuildConfig[];
24
+ brandName?: string;
25
+ }) => OutPutFilesPaths;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Type definition for component metadata
3
+ */
4
+ export interface ComponentInfo {
5
+ fileName: string;
6
+ tokenKey: string;
7
+ }
8
+ /**
9
+ * Checks if a directory contains subdirectories
10
+ * @param dirPath - Directory path to check
11
+ * @returns True if subdirectories exist
12
+ */
13
+ export declare const hasSubDirectories: (dirPath: string) => boolean;
14
+ /**
15
+ * Recursively retrieves theme directories
16
+ * @param source - Base directory to search
17
+ * @param parentPath - Relative path to append (used for recursion)
18
+ * @returns Array of theme directory paths
19
+ */
20
+ export declare const getThemeDirectories: (source: string, parentPath?: string) => string[];
21
+ /**
22
+ * Gets expressive theme files from a directory
23
+ * @param source - Directory containing expressive theme files
24
+ * @returns Array of file names
25
+ */
26
+ export declare const getExpressiveThemeFiles: (source: string) => string[];
27
+ /**
28
+ * Extracts the token key from a component JSON file
29
+ * @param filePath - Path to the component JSON file
30
+ * @returns The token key or null if not found
31
+ */
32
+ export declare const extractTokenKeyFromFile: (filePath: string) => string | null;
33
+ /**
34
+ * Scans the components directory and returns all component metadata
35
+ * @param componentsDir - Path to the components directory
36
+ * @returns Array of component information with fileName and tokenKey
37
+ */
38
+ export declare const getComponentNames: (componentsDir: string) => ComponentInfo[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Checks if a file contains a specific substring
3
+ * @param filePath - Path to the file
4
+ * @param searchString - Substring to search for
5
+ * @returns True if the substring exists
6
+ */
7
+ export declare const doesFileIncludeSubString: (filePath: string, searchString: string) => boolean;
8
+ /**
9
+ * Checks if a JSON file is empty
10
+ * @param filePath - Path to the JSON file
11
+ * @returns True if the JSON is empty
12
+ */
13
+ export declare const fileIsEmptyJson: (filePath: string) => boolean;
@@ -0,0 +1,13 @@
1
+ import { BaseColorTheme, ClassName } from '../../utils/constants';
2
+ /**
3
+ * Creates a theme class name object.
4
+ */
5
+ export declare const createThemeClassNameObj: (colorTheme: BaseColorTheme, brandName: string, themeName: string) => ClassName;
6
+ /**
7
+ * Generates a formatted CSS class selector string for themes.
8
+ */
9
+ export declare const createThemeClassName: (classObj: ClassName) => string;
10
+ /**
11
+ * Creates a theme attribute selector string for a given theme defined by the classObj.
12
+ */
13
+ export declare const createThemeAttributeSelector: (classObj: ClassName) => string;
@@ -0,0 +1,19 @@
1
+ import { TransformedToken, Dictionary, Options } from 'style-dictionary';
2
+ import { TOKEN_CATEGORIES, TOKEN_CATEGORY } from '../constants';
3
+ /**
4
+ * Generates CSS variables for a given set of tokens.
5
+ * @param dictionary - The list of transformed tokens.
6
+ * @returns A string of CSS variables.
7
+ */
8
+ export declare const generateCssVariables: ({ dictionary, }: {
9
+ dictionary: TransformedToken[];
10
+ }) => string;
11
+ type testFilter = {
12
+ [TOKEN_CATEGORIES.sem]: TOKEN_CATEGORY[];
13
+ };
14
+ export declare const cssVariableFormatter: ({ dictionary, options, filter, }: {
15
+ dictionary: Dictionary;
16
+ options: Options;
17
+ filter: testFilter;
18
+ }) => string;
19
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Format, Named, TransformedToken } from 'style-dictionary';
2
+ import { CssVarsFormatters } from '../constants/types';
3
+ export declare const createScssVariables: ({ dictionary, }: {
4
+ dictionary: TransformedToken[];
5
+ }) => string;
6
+ /**
7
+ * This formatter is used to generate scss variables for all Beam tokens
8
+ * @param {StyleDictionary.Dictionary} dictionary - The style dictionary dictionary object
9
+ * @param {StyleDictionary.Options} options - optional formatter options
10
+ **/
11
+ export declare const scssVarsFormatter: Named<Format>;
12
+ export declare const scssVarsFormatters: CssVarsFormatters;
@@ -0,0 +1,4 @@
1
+ export * from './className';
2
+ export * from './format.css';
3
+ export * from './format.scss';
4
+ export * from './token.utils.css';
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Some tokens have code in them to indicate that they are code tokens
3
+ * but we don't want that in the css class name
4
+ * @param tokenCssName
5
+ * @returns string - the tokenCssName without the code- prefix
6
+ */
7
+ export declare const removeCodeFromTokenCssName: (tokenCssName: string) => string;
8
+ /**
9
+ * Wraps a string in a CSS var wrapper.
10
+ * @param value
11
+ * @param fallback - Optional. If provided, adds a fallback value to the CSS variable. Defaults to undefined.
12
+ * @returns string - value wrapped in a CSS var
13
+ * @example var(--value)
14
+ */
15
+ export declare const wrapInVar: (value: string, fallback?: string) => string;
16
+ /**
17
+ * Generates a CSS attribute string.
18
+ *
19
+ * @param attr - The CSS attribute name.
20
+ * @param value - The value for the CSS attribute.
21
+ * @param wrapValue - Optional. If true, wraps the value in a CSS variable function. Defaults to true.
22
+ * @param fallback - Optional. If provided, adds a fallback value to the CSS attribute. Defaults to undefined.
23
+ * @returns The formatted CSS attribute string.
24
+ * @example attr: value;
25
+ * @example attr: var(--value);
26
+ */
27
+ export declare const makeCssAttribute: (attr: string, value: string, wrapValue?: boolean, fallback?: string) => string;
28
+ /**
29
+ * Generates a CSS variable attribute string.
30
+ *
31
+ * @param attr - The CSS attribute name.
32
+ * @param value - The value for the CSS attribute.
33
+ * @param wrapValue - Optional. If true, wraps the value in a CSS variable function. Defaults to true.
34
+ * @returns The formatted CSS attribute string.
35
+ * @example --attr: value;
36
+ * @example --attr: var(--value);
37
+ */
38
+ export declare const makeCssVarAttribute: (attr: string, value: string, wrapValue?: boolean) => string;
39
+ /**
40
+ * Converts a token name into a CSS variable format.
41
+ *
42
+ * @param tokenName - The raw token name to be formatted.
43
+ * @param delimiter - The character used to separate token name segments.
44
+ * @param base - The base namespace for the token.
45
+ * @param useCssVarWrapper - Whether to wrap the result in a CSS variable (`var(--tokenName)`).
46
+ * @param useRgbaWrapper - Whether to wrap the result in an RGBA function (`rgba(var(--tokenName))`).
47
+ * @param fallback - An optional fallback value for the CSS variable.
48
+ * @returns A formatted CSS variable name, optionally wrapped in `var()` or `rgba()`.
49
+ */
50
+ export declare const convertTokenNameToCssVarFormat: (tokenName: string, delimiter: string, base: string, useCssVarWrapper?: boolean, useRgbaWrapper?: boolean, fallback?: string) => string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Capitalizes the first letter of a string
3
+ */
4
+ export declare const lowerCaseFirstLetter: (string: string) => string;
5
+ /**
6
+ * Removes the braces from a string
7
+ */
8
+ export declare const stripBraces: (value: string) => string;
9
+ /**
10
+ * Removes the parentheses from a string
11
+ */
12
+ export declare const stripParentheses: (value: string) => string;
13
+ export declare const stripApostrophe: (value: string) => string;
@@ -0,0 +1,8 @@
1
+ export * from './constants';
2
+ export * from './files';
3
+ export * from './formatters';
4
+ export * from './functions';
5
+ export * from './occurrences';
6
+ export * from './tokens';
7
+ export * from './transformers';
8
+ export * from './dataviz';
@@ -0,0 +1,32 @@
1
+ import { OccurrenceCounts } from './constants';
2
+ /**
3
+ * Counts the number of occurrences of a string in another string.
4
+ * Uses word boundaries to ensure we match complete token segments, not substrings.
5
+ * For example, "comp" should not match inside "compact".
6
+ */
7
+ export declare const numberOfOccurrence: (string: string, tokenValue: string) => number;
8
+ /**
9
+ * Calculates the number of occurrences for each token type.
10
+ */
11
+ export declare const calculateOccurrences: (tokenValue: string) => OccurrenceCounts;
12
+ /**
13
+ * Checks if the occurrences represent a single occurrence.
14
+ */
15
+ export declare const isSingleOccurrence: (occurrences: OccurrenceCounts) => {
16
+ isSingle: boolean;
17
+ values: number[];
18
+ onesCount: number;
19
+ zerosCount: number;
20
+ };
21
+ /**
22
+ * Checks if the occurrences represent multiple occurrences.
23
+ */
24
+ export declare const isMultipleOccurrence: (occurrences: OccurrenceCounts) => boolean;
25
+ /**
26
+ * Checks if the occurrences has a comp token that points to another comp token
27
+ */
28
+ export declare const has2CompOccurrences: (occurrences: OccurrenceCounts) => boolean;
29
+ /**
30
+ * Checks if the occurrences has a comp token and a utility token
31
+ */
32
+ export declare const hasCompAndUtilityOccurrences: (occurrences: OccurrenceCounts) => boolean;