@atlaskit/tokens 1.11.2 → 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 (116) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/artifacts/atlassian-dark-token-value-for-contrast-check.js +24 -0
  3. package/dist/cjs/artifacts/atlassian-light-token-value-for-contrast-check.js +24 -0
  4. package/dist/cjs/artifacts/themes/atlassian-dark-new-input-border.js +2 -2
  5. package/dist/cjs/artifacts/tokens-raw/atlassian-dark-new-input-border.js +3 -3
  6. package/dist/cjs/constants.js +3 -1
  7. package/dist/cjs/custom-theme.js +108 -0
  8. package/dist/cjs/get-token-value.js +1 -1
  9. package/dist/cjs/get-token.js +1 -1
  10. package/dist/cjs/set-global-theme.js +156 -59
  11. package/dist/cjs/tokens/atlassian-dark-new-input-border/color/border.js +1 -1
  12. package/dist/cjs/utils/color-utils.js +178 -0
  13. package/dist/cjs/utils/custom-theme-loading-utils.js +47 -0
  14. package/dist/cjs/utils/custom-theme-token-contrast-check.js +74 -0
  15. package/dist/cjs/utils/generate-custom-color-ramp.js +213 -0
  16. package/dist/cjs/utils/hash.js +17 -0
  17. package/dist/cjs/utils/hct-color-utils/color-utils.js +310 -0
  18. package/dist/cjs/utils/hct-color-utils/contrast.js +188 -0
  19. package/dist/cjs/utils/hct-color-utils/hct.js +1036 -0
  20. package/dist/cjs/utils/hct-color-utils/index.js +32 -0
  21. package/dist/cjs/utils/hct-color-utils/math-utils.js +159 -0
  22. package/dist/cjs/utils/theme-loading.js +1 -1
  23. package/dist/cjs/utils/theme-state-transformer.js +1 -1
  24. package/dist/cjs/version.json +1 -1
  25. package/dist/es2019/artifacts/atlassian-dark-token-value-for-contrast-check.js +17 -0
  26. package/dist/es2019/artifacts/atlassian-light-token-value-for-contrast-check.js +17 -0
  27. package/dist/es2019/artifacts/themes/atlassian-dark-new-input-border.js +2 -2
  28. package/dist/es2019/artifacts/tokens-raw/atlassian-dark-new-input-border.js +3 -3
  29. package/dist/es2019/constants.js +1 -0
  30. package/dist/es2019/custom-theme.js +77 -0
  31. package/dist/es2019/get-token-value.js +1 -1
  32. package/dist/es2019/get-token.js +1 -1
  33. package/dist/es2019/set-global-theme.js +67 -13
  34. package/dist/es2019/tokens/atlassian-dark-new-input-border/color/border.js +1 -1
  35. package/dist/es2019/utils/color-utils.js +154 -0
  36. package/dist/es2019/utils/custom-theme-loading-utils.js +31 -0
  37. package/dist/es2019/utils/custom-theme-token-contrast-check.js +68 -0
  38. package/dist/es2019/utils/generate-custom-color-ramp.js +187 -0
  39. package/dist/es2019/utils/hash.js +10 -0
  40. package/dist/es2019/utils/hct-color-utils/color-utils.js +286 -0
  41. package/dist/es2019/utils/hct-color-utils/contrast.js +161 -0
  42. package/dist/es2019/utils/hct-color-utils/hct.js +931 -0
  43. package/dist/es2019/utils/hct-color-utils/index.js +3 -0
  44. package/dist/es2019/utils/hct-color-utils/math-utils.js +145 -0
  45. package/dist/es2019/utils/theme-loading.js +2 -2
  46. package/dist/es2019/utils/theme-state-transformer.js +3 -1
  47. package/dist/es2019/version.json +1 -1
  48. package/dist/esm/artifacts/atlassian-dark-token-value-for-contrast-check.js +17 -0
  49. package/dist/esm/artifacts/atlassian-light-token-value-for-contrast-check.js +17 -0
  50. package/dist/esm/artifacts/themes/atlassian-dark-new-input-border.js +2 -2
  51. package/dist/esm/artifacts/tokens-raw/atlassian-dark-new-input-border.js +3 -3
  52. package/dist/esm/constants.js +1 -0
  53. package/dist/esm/custom-theme.js +98 -0
  54. package/dist/esm/get-token-value.js +1 -1
  55. package/dist/esm/get-token.js +1 -1
  56. package/dist/esm/set-global-theme.js +149 -60
  57. package/dist/esm/tokens/atlassian-dark-new-input-border/color/border.js +1 -1
  58. package/dist/esm/utils/color-utils.js +162 -0
  59. package/dist/esm/utils/custom-theme-loading-utils.js +38 -0
  60. package/dist/esm/utils/custom-theme-token-contrast-check.js +65 -0
  61. package/dist/esm/utils/generate-custom-color-ramp.js +202 -0
  62. package/dist/esm/utils/hash.js +10 -0
  63. package/dist/esm/utils/hct-color-utils/color-utils.js +285 -0
  64. package/dist/esm/utils/hct-color-utils/contrast.js +181 -0
  65. package/dist/esm/utils/hct-color-utils/hct.js +1029 -0
  66. package/dist/esm/utils/hct-color-utils/index.js +3 -0
  67. package/dist/esm/utils/hct-color-utils/math-utils.js +145 -0
  68. package/dist/esm/utils/theme-loading.js +2 -2
  69. package/dist/esm/utils/theme-state-transformer.js +1 -1
  70. package/dist/esm/version.json +1 -1
  71. package/dist/types/artifacts/atlassian-dark-token-value-for-contrast-check.d.ts +17 -0
  72. package/dist/types/artifacts/atlassian-light-token-value-for-contrast-check.d.ts +17 -0
  73. package/dist/types/artifacts/themes/atlassian-dark-new-input-border.d.ts +2 -2
  74. package/dist/types/artifacts/tokens-raw/atlassian-dark-new-input-border.d.ts +1 -1
  75. package/dist/types/constants.d.ts +1 -0
  76. package/dist/types/custom-theme.d.ts +30 -0
  77. package/dist/types/index.d.ts +1 -0
  78. package/dist/types/set-global-theme.d.ts +9 -3
  79. package/dist/types/tokens/atlassian-dark/utility/utility.d.ts +1 -1
  80. package/dist/types/tokens/atlassian-light/utility/utility.d.ts +1 -1
  81. package/dist/types/tokens/default/utility/utility.d.ts +1 -1
  82. package/dist/types/utils/color-utils.d.ts +10 -0
  83. package/dist/types/utils/custom-theme-loading-utils.d.ts +11 -0
  84. package/dist/types/utils/custom-theme-token-contrast-check.d.ts +20 -0
  85. package/dist/types/utils/generate-custom-color-ramp.d.ts +19 -0
  86. package/dist/types/utils/hash.d.ts +1 -0
  87. package/dist/types/utils/hct-color-utils/color-utils.d.ts +131 -0
  88. package/dist/types/utils/hct-color-utils/contrast.d.ts +78 -0
  89. package/dist/types/utils/hct-color-utils/hct.d.ts +137 -0
  90. package/dist/types/utils/hct-color-utils/index.d.ts +3 -0
  91. package/dist/types/utils/hct-color-utils/math-utils.d.ts +86 -0
  92. package/dist/types-ts4.5/artifacts/atlassian-dark-token-value-for-contrast-check.d.ts +17 -0
  93. package/dist/types-ts4.5/artifacts/atlassian-light-token-value-for-contrast-check.d.ts +17 -0
  94. package/dist/types-ts4.5/artifacts/themes/atlassian-dark-new-input-border.d.ts +2 -2
  95. package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-new-input-border.d.ts +1 -1
  96. package/dist/types-ts4.5/constants.d.ts +1 -0
  97. package/dist/types-ts4.5/custom-theme.d.ts +30 -0
  98. package/dist/types-ts4.5/index.d.ts +1 -0
  99. package/dist/types-ts4.5/set-global-theme.d.ts +9 -3
  100. package/dist/types-ts4.5/tokens/atlassian-dark/utility/utility.d.ts +1 -1
  101. package/dist/types-ts4.5/tokens/atlassian-light/utility/utility.d.ts +1 -1
  102. package/dist/types-ts4.5/tokens/default/utility/utility.d.ts +1 -1
  103. package/dist/types-ts4.5/utils/color-utils.d.ts +27 -0
  104. package/dist/types-ts4.5/utils/custom-theme-loading-utils.d.ts +11 -0
  105. package/dist/types-ts4.5/utils/custom-theme-token-contrast-check.d.ts +20 -0
  106. package/dist/types-ts4.5/utils/generate-custom-color-ramp.d.ts +19 -0
  107. package/dist/types-ts4.5/utils/hash.d.ts +1 -0
  108. package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +131 -0
  109. package/dist/types-ts4.5/utils/hct-color-utils/contrast.d.ts +78 -0
  110. package/dist/types-ts4.5/utils/hct-color-utils/hct.d.ts +137 -0
  111. package/dist/types-ts4.5/utils/hct-color-utils/index.d.ts +3 -0
  112. package/dist/types-ts4.5/utils/hct-color-utils/math-utils.d.ts +86 -0
  113. package/figma/atlassian-dark-new-input-border.json +1 -1
  114. package/package.json +35 -40
  115. package/report.api.md +24 -1
  116. package/tmp/api-report-tmp.d.ts +0 -1132
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Below lines are copied from @material/material-color-utilities.
3
+ * Do not modify it.
4
+ */
5
+ /**
6
+ * Utility methods for calculating contrast given two colors, or calculating a
7
+ * color given one color and a contrast ratio.
8
+ *
9
+ * Contrast ratio is calculated using XYZ's Y. When linearized to match human
10
+ * perception, Y becomes HCT's tone and L*a*b*'s' L*. Informally, this is the
11
+ * lightness of a color.
12
+ *
13
+ * Methods refer to tone, T in the the HCT color space.
14
+ * Tone is equivalent to L* in the L*a*b* color space, or L in the LCH color
15
+ * space.
16
+ */
17
+ export declare class Contrast {
18
+ /**
19
+ * Returns a contrast ratio, which ranges from 1 to 21.
20
+ *
21
+ * @param toneA Tone between 0 and 100. Values outside will be clamped.
22
+ * @param toneB Tone between 0 and 100. Values outside will be clamped.
23
+ */
24
+ static ratioOfTones(toneA: number, toneB: number): number;
25
+ static ratioOfYs(y1: number, y2: number): number;
26
+ /**
27
+ * Returns a tone >= tone parameter that ensures ratio parameter.
28
+ * Return value is between 0 and 100.
29
+ * Returns -1 if ratio cannot be achieved with tone parameter.
30
+ *
31
+ * @param tone Tone return value must contrast with.
32
+ * Range is 0 to 100. Invalid values will result in -1 being returned.
33
+ * @param ratio Contrast ratio of return value and tone.
34
+ * Range is 1 to 21, invalid values have undefined behavior.
35
+ */
36
+ static lighter(tone: number, ratio: number): number;
37
+ /**
38
+ * Returns a tone <= tone parameter that ensures ratio parameter.
39
+ * Return value is between 0 and 100.
40
+ * Returns -1 if ratio cannot be achieved with tone parameter.
41
+ *
42
+ * @param tone Tone return value must contrast with.
43
+ * Range is 0 to 100. Invalid values will result in -1 being returned.
44
+ * @param ratio Contrast ratio of return value and tone.
45
+ * Range is 1 to 21, invalid values have undefined behavior.
46
+ */
47
+ static darker(tone: number, ratio: number): number;
48
+ /**
49
+ * Returns a tone >= tone parameter that ensures ratio parameter.
50
+ * Return value is between 0 and 100.
51
+ * Returns 100 if ratio cannot be achieved with tone parameter.
52
+ *
53
+ * This method is unsafe because the returned value is guaranteed to be in
54
+ * bounds for tone, i.e. between 0 and 100. However, that value may not reach
55
+ * the ratio with tone. For example, there is no color lighter than T100.
56
+ *
57
+ * @param tone Tone return value must contrast with.
58
+ * Range is 0 to 100. Invalid values will result in 100 being returned.
59
+ * @param ratio Desired contrast ratio of return value and tone parameter.
60
+ * Range is 1 to 21, invalid values have undefined behavior.
61
+ */
62
+ static lighterUnsafe(tone: number, ratio: number): number;
63
+ /**
64
+ * Returns a tone >= tone parameter that ensures ratio parameter.
65
+ * Return value is between 0 and 100.
66
+ * Returns 100 if ratio cannot be achieved with tone parameter.
67
+ *
68
+ * This method is unsafe because the returned value is guaranteed to be in
69
+ * bounds for tone, i.e. between 0 and 100. However, that value may not reach
70
+ * the [ratio with [tone]. For example, there is no color darker than T0.
71
+ *
72
+ * @param tone Tone return value must contrast with.
73
+ * Range is 0 to 100. Invalid values will result in 0 being returned.
74
+ * @param ratio Desired contrast ratio of return value and tone parameter.
75
+ * Range is 1 to 21, invalid values have undefined behavior.
76
+ */
77
+ static darkerUnsafe(tone: number, ratio: number): number;
78
+ }
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Below lines are copied from @material/material-color-utilities.
3
+ * Do not modify it.
4
+ */
5
+ /**
6
+ * A color system built using CAM16 hue and chroma, and L* from
7
+ * L*a*b*.
8
+ *
9
+ * Using L* creates a link between the color system, contrast, and thus
10
+ * accessibility. Contrast ratio depends on relative luminance, or Y in the XYZ
11
+ * color space. L*, or perceptual luminance can be calculated from Y.
12
+ *
13
+ * Unlike Y, L* is linear to human perception, allowing trivial creation of
14
+ * accurate color tones.
15
+ *
16
+ * Unlike contrast ratio, measuring contrast in L* is linear, and simple to
17
+ * calculate. A difference of 40 in HCT tone guarantees a contrast ratio >= 3.0,
18
+ * and a difference of 50 guarantees a contrast ratio >= 4.5.
19
+ */
20
+ /**
21
+ * HCT, hue, chroma, and tone. A color system that provides a perceptually
22
+ * accurate color measurement system that can also accurately render what colors
23
+ * will appear as in different lighting environments.
24
+ */
25
+ export declare class Hct {
26
+ private argb;
27
+ /**
28
+ * @param hue 0 <= hue < 360; invalid values are corrected.
29
+ * @param chroma 0 <= chroma < ?; Informally, colorfulness. The color
30
+ * returned may be lower than the requested chroma. Chroma has a different
31
+ * maximum for any given hue and tone.
32
+ * @param tone 0 <= tone <= 100; invalid values are corrected.
33
+ * @return HCT representation of a color in default viewing conditions.
34
+ */
35
+ internalHue: number;
36
+ internalChroma: number;
37
+ internalTone: number;
38
+ static from(hue: number, chroma: number, tone: number): Hct;
39
+ /**
40
+ * @param argb ARGB representation of a color.
41
+ * @return HCT representation of a color in default viewing conditions
42
+ */
43
+ static fromInt(argb: number): Hct;
44
+ toInt(): number;
45
+ /**
46
+ * A number, in degrees, representing ex. red, orange, yellow, etc.
47
+ * Ranges from 0 <= hue < 360.
48
+ */
49
+ get hue(): number;
50
+ /**
51
+ * @param newHue 0 <= newHue < 360; invalid values are corrected.
52
+ * Chroma may decrease because chroma has a different maximum for any given
53
+ * hue and tone.
54
+ */
55
+ set hue(newHue: number);
56
+ get chroma(): number;
57
+ /**
58
+ * @param newChroma 0 <= newChroma < ?
59
+ * Chroma may decrease because chroma has a different maximum for any given
60
+ * hue and tone.
61
+ */
62
+ set chroma(newChroma: number);
63
+ /**
64
+ * Lightness. Ranges from 0 to 100.
65
+ */
66
+ get tone(): number;
67
+ /**
68
+ * @param newTone 0 <= newTone <= 100; invalid valids are corrected.
69
+ * Chroma may decrease because chroma has a different maximum for any given
70
+ * hue and tone.
71
+ */
72
+ set tone(newTone: number);
73
+ private constructor();
74
+ private setInternalState;
75
+ /**
76
+ * Translates a color into different [ViewingConditions].
77
+ *
78
+ * Colors change appearance. They look different with lights on versus off,
79
+ * the same color, as in hex code, on white looks different when on black.
80
+ * This is called color relativity, most famously explicated by Josef Albers
81
+ * in Interaction of Color.
82
+ *
83
+ * In color science, color appearance models can account for this and
84
+ * calculate the appearance of a color in different settings. HCT is based on
85
+ * CAM16, a color appearance model, and uses it to make these calculations.
86
+ *
87
+ * See [ViewingConditions.make] for parameters affecting color appearance.
88
+ */
89
+ inViewingConditions(vc: ViewingConditions): Hct;
90
+ }
91
+ export declare class ViewingConditions {
92
+ n: number;
93
+ aw: number;
94
+ nbb: number;
95
+ ncb: number;
96
+ c: number;
97
+ nc: number;
98
+ rgbD: number[];
99
+ fl: number;
100
+ fLRoot: number;
101
+ z: number;
102
+ /**
103
+ * sRGB-like viewing conditions.
104
+ */
105
+ static DEFAULT: ViewingConditions;
106
+ /**
107
+ * Create ViewingConditions from a simple, physically relevant, set of
108
+ * parameters.
109
+ *
110
+ * @param whitePoint White point, measured in the XYZ color space.
111
+ * default = D65, or sunny day afternoon
112
+ * @param adaptingLuminance The luminance of the adapting field. Informally,
113
+ * how bright it is in the room where the color is viewed. Can be
114
+ * calculated from lux by multiplying lux by 0.0586. default = 11.72,
115
+ * or 200 lux.
116
+ * @param backgroundLstar The lightness of the area surrounding the color.
117
+ * measured by L* in L*a*b*. default = 50.0
118
+ * @param surround A general description of the lighting surrounding the
119
+ * color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a
120
+ * dimly light room, like watching TV at home at night. 2.0 means there
121
+ * is no difference between the lighting on the color and around it.
122
+ * default = 2.0
123
+ * @param discountingIlluminant Whether the eye accounts for the tint of the
124
+ * ambient lighting, such as knowing an apple is still red in green light.
125
+ * default = false, the eye does not perform this process on
126
+ * self-luminous objects like displays.
127
+ */
128
+ static make(whitePoint?: number[], adaptingLuminance?: number, backgroundLstar?: number, surround?: number, discountingIlluminant?: boolean): ViewingConditions;
129
+ /**
130
+ * Parameters are intermediate values of the CAM16 conversion process. Their
131
+ * names are shorthand for technical color science terminology, this class
132
+ * would not benefit from documenting them individually. A brief overview
133
+ * is available in the CAM16 specification, and a complete overview requires
134
+ * a color science textbook, such as Fairchild's Color Appearance Models.
135
+ */
136
+ private constructor();
137
+ }
@@ -0,0 +1,3 @@
1
+ export { Hct } from './hct';
2
+ export { Contrast } from './contrast';
3
+ export { argbFromRgba, rgbaFromArgb } from './color-utils';
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Below lines are copied from @material/material-color-utilities.
3
+ * Do not modify it.
4
+ */
5
+ /**
6
+ * @license
7
+ * Copyright 2021 Google LLC
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ /**
22
+ * Utility methods for mathematical operations.
23
+ */
24
+ /**
25
+ * The signum function.
26
+ *
27
+ * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
28
+ */
29
+ export declare function signum(num: number): number;
30
+ /**
31
+ * The linear interpolation function.
32
+ *
33
+ * @return start if amount = 0 and stop if amount = 1
34
+ */
35
+ export declare function lerp(start: number, stop: number, amount: number): number;
36
+ /**
37
+ * Clamps an integer between two integers.
38
+ *
39
+ * @return input when min <= input <= max, and either min or max
40
+ * otherwise.
41
+ */
42
+ export declare function clampInt(min: number, max: number, input: number): number;
43
+ /**
44
+ * Clamps an integer between two floating-point numbers.
45
+ *
46
+ * @return input when min <= input <= max, and either min or max
47
+ * otherwise.
48
+ */
49
+ export declare function clampDouble(min: number, max: number, input: number): number;
50
+ /**
51
+ * Sanitizes a degree measure as an integer.
52
+ *
53
+ * @return a degree measure between 0 (inclusive) and 360
54
+ * (exclusive).
55
+ */
56
+ export declare function sanitizeDegreesInt(degrees: number): number;
57
+ /**
58
+ * Sanitizes a degree measure as a floating-point number.
59
+ *
60
+ * @return a degree measure between 0.0 (inclusive) and 360.0
61
+ * (exclusive).
62
+ */
63
+ export declare function sanitizeDegreesDouble(degrees: number): number;
64
+ /**
65
+ * Sign of direction change needed to travel from one angle to
66
+ * another.
67
+ *
68
+ * For angles that are 180 degrees apart from each other, both
69
+ * directions have the same travel distance, so either direction is
70
+ * shortest. The value 1.0 is returned in this case.
71
+ *
72
+ * @param from The angle travel starts from, in degrees.
73
+ * @param to The angle travel ends at, in degrees.
74
+ * @return -1 if decreasing from leads to the shortest travel
75
+ * distance, 1 if increasing from leads to the shortest travel
76
+ * distance.
77
+ */
78
+ export declare function rotationDirection(from: number, to: number): number;
79
+ /**
80
+ * Distance of two points on a circle, represented using degrees.
81
+ */
82
+ export declare function differenceDegrees(a: number, b: number): number;
83
+ /**
84
+ * Multiplies a 1x3 row vector with a 3x3 matrix.
85
+ */
86
+ export declare function matrixMultiply(row: number[], matrix: number[][]): number[];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Token names mapped to their values, used for contrast checking when generating custom themes
5
+ *
6
+ * @codegen <<SignedSource::1ddd5cd744975e8df5a191332ec8a42c>>
7
+ * @codegenCommand yarn build tokens
8
+ */
9
+ declare const tokenValues: {
10
+ readonly 'color.text.brand': "#579DFF";
11
+ readonly 'elevation.surface.overlay': "#282E33";
12
+ readonly 'color.text.selected': "#579DFF";
13
+ readonly 'color.background.selected': "#092957";
14
+ readonly 'color.border.brand': "#579DFF";
15
+ readonly 'color.chart.brand': "#388BFF";
16
+ };
17
+ export default tokenValues;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ *
4
+ * Token names mapped to their values, used for contrast checking when generating custom themes
5
+ *
6
+ * @codegen <<SignedSource::b59877585fad151840dbf6c212c56e34>>
7
+ * @codegenCommand yarn build tokens
8
+ */
9
+ declare const tokenValues: {
10
+ readonly 'color.text.brand': "#0C66E4";
11
+ readonly 'elevation.surface.sunken': "#F7F8F9";
12
+ readonly 'color.text.selected': "#0C66E4";
13
+ readonly 'color.background.selected': "#E9F2FF";
14
+ readonly 'color.border.brand': "#0C66E4";
15
+ readonly 'color.chart.brand': "#1D7AFC";
16
+ };
17
+ export default tokenValues;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::b255ff03ae4f781bb3016003a111bed0>>
3
+ * @codegen <<SignedSource::cadad94754b78a066c340ab42eca9721>>
4
4
  * @codegenCommand yarn build tokens
5
5
  */
6
- declare const _default: "\nhtml[data-color-mode=\"light\"][data-theme~=\"light:dark\"],\nhtml[data-color-mode=\"dark\"][data-theme~=\"dark:dark\"] {\n color-scheme: dark;\n --ds-border-input: #596773;\n}\n";
6
+ declare const _default: "\nhtml[data-color-mode=\"light\"][data-theme~=\"light:dark\"],\nhtml[data-color-mode=\"dark\"][data-theme~=\"dark:dark\"] {\n color-scheme: dark;\n --ds-border-input: #738496;\n}\n";
7
7
  export default _default;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::2c7e6a36e75ad8b32981cc4bbaa378db>>
3
+ * @codegen <<SignedSource::a87638614efbe4415e8ffd370dd4ce76>>
4
4
  * @codegenCommand yarn build tokens
5
5
  */
6
6
  declare const tokens: {
@@ -1,5 +1,6 @@
1
1
  export declare const THEME_DATA_ATTRIBUTE = "data-theme";
2
2
  export declare const COLOR_MODE_ATTRIBUTE = "data-color-mode";
3
+ export declare const CUSTOM_THEME_ATTRIBUTE = "data-custom-theme";
3
4
  export declare const DEFAULT_THEME = "light";
4
5
  export declare const CSS_PREFIX = "ds";
5
6
  export declare const CSS_VAR_FULL: string[];
@@ -0,0 +1,30 @@
1
+ import { ThemeState, ThemeStyles } from './set-global-theme';
2
+ export declare const CUSTOM_STYLE_ELEMENTS_SIZE_THRESHOLD = 10;
3
+ type HEX = `#${string}`;
4
+ export type CSSColor = HEX;
5
+ export interface CustomBrandSchema {
6
+ brandColor: CSSColor;
7
+ }
8
+ /**
9
+ *
10
+ * @param themeSchema The schema of available themes
11
+ * @returns a string with the CSS for the custom theme
12
+ */
13
+ /**
14
+ * Takes a color mode and custom branding options, and returns an array of objects for use in applying custom styles to the document head.
15
+ * Only supplies the color themes necessary for initial render, based on the current themeState. I.e. if in light mode, dark mode themes are not returned.
16
+ *
17
+ * @param {Object<string, string>} themeState The themes and color mode that should be applied.
18
+ * @param {string} themeState.colorMode Determines which color theme is applied
19
+ * @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
20
+ *
21
+ * @returns A Promise of an object array, containing theme IDs, data-attributes to attach to the theme, and the theme CSS.
22
+ * If an error is encountered while loading themes, the themes array will be empty.
23
+ */
24
+ export declare function getCustomThemeStyles(themeState: Partial<ThemeState> & {
25
+ UNSAFE_themeOptions: CustomBrandSchema;
26
+ }): Promise<ThemeStyles[]>;
27
+ export declare function loadAndAppendCustomThemeCss(themeState: Partial<ThemeState> & {
28
+ UNSAFE_themeOptions: CustomBrandSchema;
29
+ }): Promise<void>;
30
+ export {};
@@ -6,6 +6,7 @@ export type { CSSToken } from './artifacts/token-names';
6
6
  export type { ActiveTokens } from './artifacts/types';
7
7
  export type { ThemeColorModes, Themes, ThemeIds } from './theme-config';
8
8
  export type { Groups, OpacityToken, PaintToken, RawToken, ShadowToken, SpacingToken, ShapeToken, } from './types';
9
+ export type { CustomBrandSchema } from './custom-theme';
9
10
  export { default as themeConfig } from './theme-config';
10
11
  export { useThemeObserver } from './use-theme-observer';
11
12
  export { ThemeMutationObserver } from './theme-mutation-observer';
@@ -1,4 +1,5 @@
1
1
  import { UnbindFn } from 'bind-event-listener';
2
+ import { CustomBrandSchema } from './custom-theme';
2
3
  import { ThemeColorModes, ThemeIds, ThemeIdsWithOverrides } from './theme-config';
3
4
  export interface ThemeState {
4
5
  light: Extract<ThemeIds, 'light' | 'dark' | 'legacy-dark' | 'legacy-light'>;
@@ -7,10 +8,12 @@ export interface ThemeState {
7
8
  shape?: Extract<ThemeIds, 'shape'>;
8
9
  spacing?: Extract<ThemeIds, 'spacing'>;
9
10
  typography?: Extract<ThemeIds, 'typography'>;
11
+ UNSAFE_themeOptions?: CustomBrandSchema;
10
12
  }
11
13
  export interface ActiveThemeState extends ThemeState {
12
14
  colorMode: Exclude<ThemeColorModes, 'auto'>;
13
15
  }
16
+ export declare const themeStateDefaults: ThemeState;
14
17
  /**
15
18
  * Sets the theme globally at runtime. This updates the `data-theme` and `data-color-mode` attributes on your page's <html> tag.
16
19
  *
@@ -21,6 +24,7 @@ export interface ActiveThemeState extends ThemeState {
21
24
  * @param {string} themeState.shape The shape theme to be applied.
22
25
  * @param {string} themeState.spacing The spacing theme to be applied.
23
26
  * @param {string} themeState.typography The typography theme to be applied.
27
+ * @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
24
28
  * @param {function} themeLoader Callback function used to override the default theme loading functionality.
25
29
  *
26
30
  * @returns A Promise of an unbind function, that can be used to stop listening for changes to system theme.
@@ -30,7 +34,7 @@ export interface ActiveThemeState extends ThemeState {
30
34
  * setGlobalTheme({colorMode: 'auto', light: 'light', dark: 'dark', spacing: 'spacing'});
31
35
  * ```
32
36
  */
33
- declare const setGlobalTheme: ({ colorMode, dark, light, shape, spacing, typography, }?: Partial<ThemeState>, themeLoader?: ((id: ThemeIdsWithOverrides) => void | Promise<void>) | undefined) => Promise<UnbindFn>;
37
+ declare const setGlobalTheme: ({ colorMode, dark, light, shape, spacing, typography, UNSAFE_themeOptions, }?: Partial<ThemeState>, themeLoader?: ((id: ThemeIdsWithOverrides) => void | Promise<void>) | undefined) => Promise<UnbindFn>;
34
38
  export interface ThemeStyles {
35
39
  id: ThemeIdsWithOverrides;
36
40
  attrs: Record<string, string>;
@@ -47,9 +51,10 @@ export interface ThemeStyles {
47
51
  * @param {string} themeState.shape The shape theme to be applied.
48
52
  * @param {string} themeState.spacing The spacing theme to be applied.
49
53
  * @param {string} themeState.typography The typography theme to be applied.
54
+ * @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
50
55
  *
51
56
  * @returns A Promise of an object array, containing theme IDs, data-attributes to attach to the theme, and the theme CSS.
52
- * If an error is encountered while loading themes, the themes arrav will be emptv.
57
+ * If an error is encountered while loading themes, the themes array will be empty.
53
58
  */
54
59
  export declare const getThemeStyles: (preferences?: Partial<ThemeState> | 'all') => Promise<ThemeStyles[]>;
55
60
  /**
@@ -62,10 +67,11 @@ export declare const getThemeStyles: (preferences?: Partial<ThemeState> | 'all')
62
67
  * @param {string} themeState.light The color theme to be applied when the color mode resolves to 'light'.
63
68
  * @param {string} themeState.spacing The spacing theme to be applied.
64
69
  * @param {string} themeState.typography The typography theme to be applied.
70
+ * @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
65
71
  *
66
72
  * @returns {Object} Object of HTML attributes to be applied to the document root
67
73
  */
68
- export declare const getThemeHtmlAttrs: ({ colorMode, dark, light, shape, spacing, typography, }?: Partial<ThemeState>) => Record<string, string>;
74
+ export declare const getThemeHtmlAttrs: ({ colorMode, dark, light, shape, spacing, typography, UNSAFE_themeOptions, }?: Partial<ThemeState>) => Record<string, string>;
69
75
  /**
70
76
  * Provides a script that, when executed before paint, sets the `data-color-mode` attribute based on the current system theme,
71
77
  * to enable SSR support for automatic theme switching, avoid a flash of un-themed content on first paint.
@@ -1,5 +1,5 @@
1
1
  import type { UtilTokenSchema, ValueSchema } from '../../../types';
2
2
  declare const _default: {
3
- utility: ValueSchema<UtilTokenSchema<"Lime100" | "Lime200" | "Lime300" | "Lime400" | "Lime500" | "Lime600" | "Lime700" | "Lime800" | "Lime900" | "Lime1000" | "Red100" | "Red200" | "Red300" | "Red400" | "Red500" | "Red600" | "Red700" | "Red800" | "Red900" | "Red1000" | "Orange100" | "Orange200" | "Orange300" | "Orange400" | "Orange500" | "Orange600" | "Orange700" | "Orange800" | "Orange900" | "Orange1000" | "Yellow100" | "Yellow200" | "Yellow300" | "Yellow400" | "Yellow500" | "Yellow600" | "Yellow700" | "Yellow800" | "Yellow900" | "Yellow1000" | "Green100" | "Green200" | "Green300" | "Green400" | "Green500" | "Green600" | "Green700" | "Green800" | "Green900" | "Green1000" | "Teal100" | "Teal200" | "Teal300" | "Teal400" | "Teal500" | "Teal600" | "Teal700" | "Teal800" | "Teal900" | "Teal1000" | "Blue100" | "Blue200" | "Blue300" | "Blue400" | "Blue500" | "Blue600" | "Blue700" | "Blue800" | "Blue900" | "Blue1000" | "Purple100" | "Purple200" | "Purple300" | "Purple400" | "Purple500" | "Purple600" | "Purple700" | "Purple800" | "Purple900" | "Purple1000" | "Magenta100" | "Magenta200" | "Magenta300" | "Magenta400" | "Magenta500" | "Magenta600" | "Magenta700" | "Magenta800" | "Magenta900" | "Magenta1000" | "Neutral0" | "Neutral100" | "Neutral200" | "Neutral300" | "Neutral400" | "Neutral500" | "Neutral600" | "Neutral700" | "Neutral800" | "Neutral900" | "Neutral1000" | "Neutral1100" | "Neutral100A" | "Neutral200A" | "Neutral300A" | "Neutral400A" | "Neutral500A" | "DarkNeutral-100" | "DarkNeutral0" | "DarkNeutral100" | "DarkNeutral200" | "DarkNeutral250" | "DarkNeutral300" | "DarkNeutral350" | "DarkNeutral400" | "DarkNeutral500" | "DarkNeutral600" | "DarkNeutral700" | "DarkNeutral800" | "DarkNeutral900" | "DarkNeutral1000" | "DarkNeutral1100" | "DarkNeutral-100A" | "DarkNeutral100A" | "DarkNeutral200A" | "DarkNeutral250A" | "DarkNeutral300A" | "DarkNeutral350A" | "DarkNeutral400A" | "DarkNeutral500A">>;
3
+ utility: ValueSchema<UtilTokenSchema<"DarkNeutral900" | "Lime300" | "Lime200" | "Red300" | "Red200" | "Orange300" | "Orange200" | "Yellow300" | "Yellow200" | "Green300" | "Green200" | "Teal300" | "Teal200" | "Blue300" | "Blue200" | "Purple300" | "Purple200" | "Magenta300" | "Magenta200" | "DarkNeutral800" | "DarkNeutral1100" | "DarkNeutral400A" | "DarkNeutral100" | "Blue400" | "DarkNeutral700" | "Lime500" | "Red500" | "Orange500" | "Yellow500" | "Green500" | "Teal500" | "Blue500" | "Purple500" | "Magenta500" | "DarkNeutral600" | "DarkNeutral300A" | "DarkNeutral200A" | "DarkNeutral0" | "Lime1000" | "Lime900" | "Lime800" | "Lime400" | "Red1000" | "Red900" | "Red800" | "Red400" | "Orange1000" | "Orange900" | "Orange800" | "Orange400" | "Yellow1000" | "Yellow900" | "Yellow800" | "Yellow400" | "Green1000" | "Green900" | "Green800" | "Green400" | "Teal1000" | "Teal900" | "Teal800" | "Teal400" | "Blue1000" | "Blue900" | "Blue800" | "Purple1000" | "Purple900" | "Purple800" | "Purple400" | "Magenta1000" | "Magenta900" | "Magenta800" | "Magenta400" | "DarkNeutral300" | "DarkNeutral400" | "DarkNeutral500" | "DarkNeutral100A" | "DarkNeutral200" | "DarkNeutral250" | "DarkNeutral1000" | "Teal600" | "Orange600" | "Blue100" | "Purple600" | "Magenta100" | "Red600" | "Blue600" | "Magenta600" | "DarkNeutral350" | "DarkNeutral-100A" | "Lime100" | "Lime600" | "Lime700" | "Red100" | "Red700" | "Orange100" | "Orange700" | "Yellow100" | "Yellow600" | "Yellow700" | "Green100" | "Green600" | "Green700" | "Teal100" | "Teal700" | "Blue700" | "Purple100" | "Purple700" | "Magenta700" | "Neutral0" | "Neutral100" | "Neutral200" | "Neutral300" | "Neutral400" | "Neutral500" | "Neutral600" | "Neutral700" | "Neutral800" | "Neutral900" | "Neutral1000" | "Neutral1100" | "Neutral100A" | "Neutral200A" | "Neutral300A" | "Neutral400A" | "Neutral500A" | "DarkNeutral-100" | "DarkNeutral250A" | "DarkNeutral350A" | "DarkNeutral500A">>;
4
4
  };
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import type { UtilTokenSchema, ValueSchema } from '../../../types';
2
2
  declare const _default: {
3
- utility: ValueSchema<UtilTokenSchema<"Lime100" | "Lime200" | "Lime300" | "Lime400" | "Lime500" | "Lime600" | "Lime700" | "Lime800" | "Lime900" | "Lime1000" | "Red100" | "Red200" | "Red300" | "Red400" | "Red500" | "Red600" | "Red700" | "Red800" | "Red900" | "Red1000" | "Orange100" | "Orange200" | "Orange300" | "Orange400" | "Orange500" | "Orange600" | "Orange700" | "Orange800" | "Orange900" | "Orange1000" | "Yellow100" | "Yellow200" | "Yellow300" | "Yellow400" | "Yellow500" | "Yellow600" | "Yellow700" | "Yellow800" | "Yellow900" | "Yellow1000" | "Green100" | "Green200" | "Green300" | "Green400" | "Green500" | "Green600" | "Green700" | "Green800" | "Green900" | "Green1000" | "Teal100" | "Teal200" | "Teal300" | "Teal400" | "Teal500" | "Teal600" | "Teal700" | "Teal800" | "Teal900" | "Teal1000" | "Blue100" | "Blue200" | "Blue300" | "Blue400" | "Blue500" | "Blue600" | "Blue700" | "Blue800" | "Blue900" | "Blue1000" | "Purple100" | "Purple200" | "Purple300" | "Purple400" | "Purple500" | "Purple600" | "Purple700" | "Purple800" | "Purple900" | "Purple1000" | "Magenta100" | "Magenta200" | "Magenta300" | "Magenta400" | "Magenta500" | "Magenta600" | "Magenta700" | "Magenta800" | "Magenta900" | "Magenta1000" | "Neutral0" | "Neutral100" | "Neutral200" | "Neutral300" | "Neutral400" | "Neutral500" | "Neutral600" | "Neutral700" | "Neutral800" | "Neutral900" | "Neutral1000" | "Neutral1100" | "Neutral100A" | "Neutral200A" | "Neutral300A" | "Neutral400A" | "Neutral500A" | "DarkNeutral-100" | "DarkNeutral0" | "DarkNeutral100" | "DarkNeutral200" | "DarkNeutral250" | "DarkNeutral300" | "DarkNeutral350" | "DarkNeutral400" | "DarkNeutral500" | "DarkNeutral600" | "DarkNeutral700" | "DarkNeutral800" | "DarkNeutral900" | "DarkNeutral1000" | "DarkNeutral1100" | "DarkNeutral-100A" | "DarkNeutral100A" | "DarkNeutral200A" | "DarkNeutral250A" | "DarkNeutral300A" | "DarkNeutral350A" | "DarkNeutral400A" | "DarkNeutral500A">>;
3
+ utility: ValueSchema<UtilTokenSchema<"DarkNeutral900" | "Lime300" | "Lime200" | "Red300" | "Red200" | "Orange300" | "Orange200" | "Yellow300" | "Yellow200" | "Green300" | "Green200" | "Teal300" | "Teal200" | "Blue300" | "Blue200" | "Purple300" | "Purple200" | "Magenta300" | "Magenta200" | "DarkNeutral800" | "DarkNeutral1100" | "DarkNeutral400A" | "DarkNeutral100" | "Blue400" | "DarkNeutral700" | "Lime500" | "Red500" | "Orange500" | "Yellow500" | "Green500" | "Teal500" | "Blue500" | "Purple500" | "Magenta500" | "DarkNeutral600" | "DarkNeutral300A" | "DarkNeutral200A" | "DarkNeutral0" | "Lime1000" | "Lime900" | "Lime800" | "Lime400" | "Red1000" | "Red900" | "Red800" | "Red400" | "Orange1000" | "Orange900" | "Orange800" | "Orange400" | "Yellow1000" | "Yellow900" | "Yellow800" | "Yellow400" | "Green1000" | "Green900" | "Green800" | "Green400" | "Teal1000" | "Teal900" | "Teal800" | "Teal400" | "Blue1000" | "Blue900" | "Blue800" | "Purple1000" | "Purple900" | "Purple800" | "Purple400" | "Magenta1000" | "Magenta900" | "Magenta800" | "Magenta400" | "DarkNeutral300" | "DarkNeutral400" | "DarkNeutral500" | "DarkNeutral100A" | "DarkNeutral200" | "DarkNeutral250" | "DarkNeutral1000" | "Teal600" | "Orange600" | "Blue100" | "Purple600" | "Magenta100" | "Red600" | "Blue600" | "Magenta600" | "DarkNeutral350" | "DarkNeutral-100A" | "Lime100" | "Lime600" | "Lime700" | "Red100" | "Red700" | "Orange100" | "Orange700" | "Yellow100" | "Yellow600" | "Yellow700" | "Green100" | "Green600" | "Green700" | "Teal100" | "Teal700" | "Blue700" | "Purple100" | "Purple700" | "Magenta700" | "Neutral0" | "Neutral100" | "Neutral200" | "Neutral300" | "Neutral400" | "Neutral500" | "Neutral600" | "Neutral700" | "Neutral800" | "Neutral900" | "Neutral1000" | "Neutral1100" | "Neutral100A" | "Neutral200A" | "Neutral300A" | "Neutral400A" | "Neutral500A" | "DarkNeutral-100" | "DarkNeutral250A" | "DarkNeutral350A" | "DarkNeutral500A">>;
4
4
  };
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import type { AttributeSchema, UtilTokenSchema } from '../../../types';
2
2
  declare const _default: {
3
- utility: AttributeSchema<UtilTokenSchema<"Lime100" | "Lime200" | "Lime300" | "Lime400" | "Lime500" | "Lime600" | "Lime700" | "Lime800" | "Lime900" | "Lime1000" | "Red100" | "Red200" | "Red300" | "Red400" | "Red500" | "Red600" | "Red700" | "Red800" | "Red900" | "Red1000" | "Orange100" | "Orange200" | "Orange300" | "Orange400" | "Orange500" | "Orange600" | "Orange700" | "Orange800" | "Orange900" | "Orange1000" | "Yellow100" | "Yellow200" | "Yellow300" | "Yellow400" | "Yellow500" | "Yellow600" | "Yellow700" | "Yellow800" | "Yellow900" | "Yellow1000" | "Green100" | "Green200" | "Green300" | "Green400" | "Green500" | "Green600" | "Green700" | "Green800" | "Green900" | "Green1000" | "Teal100" | "Teal200" | "Teal300" | "Teal400" | "Teal500" | "Teal600" | "Teal700" | "Teal800" | "Teal900" | "Teal1000" | "Blue100" | "Blue200" | "Blue300" | "Blue400" | "Blue500" | "Blue600" | "Blue700" | "Blue800" | "Blue900" | "Blue1000" | "Purple100" | "Purple200" | "Purple300" | "Purple400" | "Purple500" | "Purple600" | "Purple700" | "Purple800" | "Purple900" | "Purple1000" | "Magenta100" | "Magenta200" | "Magenta300" | "Magenta400" | "Magenta500" | "Magenta600" | "Magenta700" | "Magenta800" | "Magenta900" | "Magenta1000" | "Neutral0" | "Neutral100" | "Neutral200" | "Neutral300" | "Neutral400" | "Neutral500" | "Neutral600" | "Neutral700" | "Neutral800" | "Neutral900" | "Neutral1000" | "Neutral1100" | "Neutral100A" | "Neutral200A" | "Neutral300A" | "Neutral400A" | "Neutral500A" | "DarkNeutral-100" | "DarkNeutral0" | "DarkNeutral100" | "DarkNeutral200" | "DarkNeutral250" | "DarkNeutral300" | "DarkNeutral350" | "DarkNeutral400" | "DarkNeutral500" | "DarkNeutral600" | "DarkNeutral700" | "DarkNeutral800" | "DarkNeutral900" | "DarkNeutral1000" | "DarkNeutral1100" | "DarkNeutral-100A" | "DarkNeutral100A" | "DarkNeutral200A" | "DarkNeutral250A" | "DarkNeutral300A" | "DarkNeutral350A" | "DarkNeutral400A" | "DarkNeutral500A">>;
3
+ utility: AttributeSchema<UtilTokenSchema<"DarkNeutral900" | "Lime300" | "Lime200" | "Red300" | "Red200" | "Orange300" | "Orange200" | "Yellow300" | "Yellow200" | "Green300" | "Green200" | "Teal300" | "Teal200" | "Blue300" | "Blue200" | "Purple300" | "Purple200" | "Magenta300" | "Magenta200" | "DarkNeutral800" | "DarkNeutral1100" | "DarkNeutral400A" | "DarkNeutral100" | "Blue400" | "DarkNeutral700" | "Lime500" | "Red500" | "Orange500" | "Yellow500" | "Green500" | "Teal500" | "Blue500" | "Purple500" | "Magenta500" | "DarkNeutral600" | "DarkNeutral300A" | "DarkNeutral200A" | "DarkNeutral0" | "Lime1000" | "Lime900" | "Lime800" | "Lime400" | "Red1000" | "Red900" | "Red800" | "Red400" | "Orange1000" | "Orange900" | "Orange800" | "Orange400" | "Yellow1000" | "Yellow900" | "Yellow800" | "Yellow400" | "Green1000" | "Green900" | "Green800" | "Green400" | "Teal1000" | "Teal900" | "Teal800" | "Teal400" | "Blue1000" | "Blue900" | "Blue800" | "Purple1000" | "Purple900" | "Purple800" | "Purple400" | "Magenta1000" | "Magenta900" | "Magenta800" | "Magenta400" | "DarkNeutral300" | "DarkNeutral400" | "DarkNeutral500" | "DarkNeutral100A" | "DarkNeutral200" | "DarkNeutral250" | "DarkNeutral1000" | "Teal600" | "Orange600" | "Blue100" | "Purple600" | "Magenta100" | "Red600" | "Blue600" | "Magenta600" | "DarkNeutral350" | "DarkNeutral-100A" | "Lime100" | "Lime600" | "Lime700" | "Red100" | "Red700" | "Orange100" | "Orange700" | "Yellow100" | "Yellow600" | "Yellow700" | "Green100" | "Green600" | "Green700" | "Teal100" | "Teal700" | "Blue700" | "Purple100" | "Purple700" | "Magenta700" | "Neutral0" | "Neutral100" | "Neutral200" | "Neutral300" | "Neutral400" | "Neutral500" | "Neutral600" | "Neutral700" | "Neutral800" | "Neutral900" | "Neutral1000" | "Neutral1100" | "Neutral100A" | "Neutral200A" | "Neutral300A" | "Neutral400A" | "Neutral500A" | "DarkNeutral-100" | "DarkNeutral250A" | "DarkNeutral350A" | "DarkNeutral500A">>;
4
4
  };
5
5
  export default _default;
@@ -0,0 +1,27 @@
1
+ export declare const isValidBrandHex: (hex: string) => boolean;
2
+ export declare function rgbToHex(r: number, g: number, b: number): string;
3
+ export declare function getAlpha(hex: string): number;
4
+ export declare function hexToRgbA(hex: string): [
5
+ number,
6
+ number,
7
+ number,
8
+ number
9
+ ];
10
+ export declare function hexToRgb(hex: string): [
11
+ number,
12
+ number,
13
+ number
14
+ ];
15
+ export declare function hexToHSL(hex: string): [
16
+ number,
17
+ number,
18
+ number
19
+ ];
20
+ export declare function HSLToRGB(h: number, s: number, l: number): [
21
+ number,
22
+ number,
23
+ number
24
+ ];
25
+ export declare function relativeLuminanceW3C(r: number, g: number, b: number): number;
26
+ export declare function getContrastRatio(foreground: string, background: string): number;
27
+ export declare function deltaE(rgbA: number[], rgbB: number[]): number;
@@ -0,0 +1,11 @@
1
+ import tokens from '../artifacts/token-names';
2
+ import { CustomBrandSchema } from '../custom-theme';
3
+ import { ThemeColorModes } from '../theme-config';
4
+ type Token = keyof typeof tokens;
5
+ type ThemeAttributeId = 'light' | 'dark';
6
+ export declare function findMissingCustomStyleElements(UNSAFE_themeOptions: CustomBrandSchema, mode: ThemeColorModes): ThemeAttributeId[];
7
+ export declare function limitSizeOfCustomStyleElements(sizeThreshold: number): void;
8
+ export declare function reduceTokenMap(tokenMap: {
9
+ [key in Token]?: number;
10
+ }, themeRamp: string[]): string;
11
+ export {};
@@ -0,0 +1,20 @@
1
+ import tokens from '../artifacts/token-names';
2
+ type Token = keyof typeof tokens;
3
+ interface AdditionalContrastCheck {
4
+ foreground: Token;
5
+ backgroundLight: Token;
6
+ backgroundDark: Token;
7
+ desiredContrast: number;
8
+ updatedTokens: Token[];
9
+ }
10
+ export declare const additionalChecks: AdditionalContrastCheck[];
11
+ export declare const additionalContrastChecker: ({ customThemeTokenMap, mode, themeRamp, }: {
12
+ customThemeTokenMap: {
13
+ [key: string]: number;
14
+ };
15
+ mode: 'light' | 'dark';
16
+ themeRamp: string[];
17
+ }) => {
18
+ [key: string]: number;
19
+ };
20
+ export {};
@@ -0,0 +1,19 @@
1
+ import tokens from '../artifacts/token-names';
2
+ import { CSSColor } from '../custom-theme';
3
+ import { ThemeColorModes } from '../theme-config';
4
+ type Token = keyof typeof tokens;
5
+ type TokenMap = {
6
+ [key in Token]?: number;
7
+ };
8
+ type Mode = 'light' | 'dark';
9
+ export declare const getClosestColorIndex: (themeRamp: CSSColor[], brandColor: CSSColor) => number;
10
+ export declare const generateColors: (brandColor: CSSColor) => CSSColor[];
11
+ export declare const generateTokenMap: (brandColor: CSSColor, mode: ThemeColorModes, themeRamp?: CSSColor[]) => {
12
+ light?: TokenMap | undefined;
13
+ dark?: TokenMap | undefined;
14
+ };
15
+ export declare const generateTokenMapWithContrastCheck: (brandColor: CSSColor, mode: ThemeColorModes, themeRamp?: CSSColor[]) => {
16
+ light?: TokenMap | undefined;
17
+ dark?: TokenMap | undefined;
18
+ };
19
+ export {};
@@ -0,0 +1 @@
1
+ export declare const hash: (str: string) => string;