@carbon/themes 11.74.0 → 11.75.0-rc.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.
- package/es/index.js +68 -101
- package/lib/component-tokens/button/index.d.ts +7 -0
- package/lib/component-tokens/button/tokens.d.ts +98 -0
- package/{src/component-tokens/content-switcher/index.js → lib/component-tokens/content-switcher/index.d.ts} +1 -1
- package/lib/component-tokens/content-switcher/tokens.d.ts +24 -0
- package/lib/component-tokens/notification/index.d.ts +7 -0
- package/lib/component-tokens/notification/tokens.d.ts +64 -0
- package/lib/component-tokens/status/index.d.ts +7 -0
- package/lib/component-tokens/status/tokens.d.ts +62 -0
- package/lib/component-tokens/tag/index.d.ts +7 -0
- package/lib/component-tokens/tag/tokens.d.ts +246 -0
- package/lib/g10.d.ts +242 -0
- package/lib/g100.d.ts +242 -0
- package/lib/g90.d.ts +242 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +68 -101
- package/lib/tokens/Token.d.ts +20 -0
- package/lib/tokens/TokenFormat.d.ts +15 -0
- package/lib/tokens/TokenGroup.d.ts +57 -0
- package/lib/tokens/TokenSet.d.ts +30 -0
- package/lib/tokens/components.d.ts +12 -0
- package/lib/tokens/index.d.ts +21 -0
- package/lib/tokens/layout.d.ts +8 -0
- package/lib/tokens/type.d.ts +8 -0
- package/lib/tokens/types.d.ts +23 -0
- package/lib/tokens/v10.d.ts +10 -0
- package/lib/tokens/v11TokenGroup.d.ts +21 -0
- package/lib/tokens/v11TokenSet.d.ts +8 -0
- package/lib/tools.d.ts +17 -0
- package/lib/v10/g10.d.ts +154 -0
- package/lib/v10/g100.d.ts +154 -0
- package/lib/v10/g90.d.ts +154 -0
- package/lib/v10/index.d.ts +19 -0
- package/lib/v10/tokens.d.ts +18 -0
- package/lib/v10/white.d.ts +155 -0
- package/lib/white.d.ts +243 -0
- package/package.json +10 -5
- package/src/component-tokens/button/{index.js → index.ts} +1 -1
- package/src/component-tokens/button/{tokens.js → tokens.ts} +1 -1
- package/src/component-tokens/content-switcher/index.ts +7 -0
- package/src/component-tokens/content-switcher/{tokens.js → tokens.ts} +1 -1
- package/src/component-tokens/notification/{index.js → index.ts} +1 -1
- package/src/component-tokens/notification/{tokens.js → tokens.ts} +1 -1
- package/src/component-tokens/status/{index.js → index.ts} +1 -1
- package/src/component-tokens/status/{tokens.js → tokens.ts} +1 -1
- package/src/component-tokens/tag/{index.js → index.ts} +1 -1
- package/src/component-tokens/tag/{tokens.js → tokens.ts} +1 -1
- package/src/{g10.js → g10.ts} +1 -1
- package/src/{g100.js → g100.ts} +1 -1
- package/src/{g90.js → g90.ts} +1 -1
- package/src/{index.js → index.ts} +1 -1
- package/src/tokens/{Token.js → Token.ts} +10 -4
- package/src/tokens/{TokenFormat.js → TokenFormat.ts} +12 -7
- package/src/tokens/{TokenGroup.js → TokenGroup.ts} +38 -16
- package/src/tokens/{TokenSet.js → TokenSet.ts} +22 -8
- package/src/tokens/{components.js → components.ts} +1 -1
- package/src/tokens/{index.js → index.ts} +13 -22
- package/src/tokens/{layout.js → layout.ts} +1 -1
- package/src/tokens/{type.js → type.ts} +1 -1
- package/src/tokens/types.ts +28 -0
- package/src/tokens/{v10.js → v10.ts} +1 -1
- package/src/tokens/{v11TokenGroup.js → v11TokenGroup.ts} +1 -1
- package/src/tokens/v11TokenSet.ts +93 -0
- package/src/{tools.js → tools.ts} +7 -15
- package/src/v10/{g10.js → g10.ts} +1 -1
- package/src/v10/{g100.js → g100.ts} +1 -1
- package/src/v10/{g90.js → g90.ts} +1 -1
- package/src/v10/{index.js → index.ts} +1 -1
- package/src/v10/{tokens.js → tokens.ts} +1 -1
- package/src/v10/{white.js → white.ts} +1 -1
- package/src/{white.js → white.ts} +1 -1
- package/tsconfig.json +8 -0
- package/tsconfig.types.json +9 -0
- package/umd/index.js +68 -101
- package/src/tokens/v11TokenSet.js +0 -94
package/lib/index.js
CHANGED
|
@@ -35,9 +35,9 @@ let color = require("color");
|
|
|
35
35
|
color = __toESM(color);
|
|
36
36
|
let _carbon_type = require("@carbon/type");
|
|
37
37
|
let _carbon_layout = require("@carbon/layout");
|
|
38
|
-
//#region src/tools.
|
|
38
|
+
//#region src/tools.ts
|
|
39
39
|
/**
|
|
40
|
-
* Copyright IBM Corp. 2016,
|
|
40
|
+
* Copyright IBM Corp. 2016, 2026
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -47,28 +47,22 @@ let _carbon_layout = require("@carbon/layout");
|
|
|
47
47
|
* Example: token = hsl(10, 10, 10);
|
|
48
48
|
* adjustLightness(token, 5) === hsl(10, 10, 15);
|
|
49
49
|
* adjustLightness(token, -5) === hsl(10, 10, 5);
|
|
50
|
-
* @param {string} token
|
|
51
|
-
* @param {integer} shift The number of percentage points (positive or negative) by which to shift the lightness of a token.
|
|
52
|
-
* @returns {string}
|
|
53
50
|
*/
|
|
54
|
-
|
|
51
|
+
const adjustLightness = (token, shift) => {
|
|
55
52
|
const original = (0, color.default)(token).hsl().object();
|
|
56
53
|
return (0, color.default)({
|
|
57
54
|
...original,
|
|
58
55
|
l: original.l += shift
|
|
59
56
|
}).round().hex().toLowerCase();
|
|
60
|
-
}
|
|
57
|
+
};
|
|
61
58
|
/**
|
|
62
59
|
* Adjust a given token's alpha by a specified amount
|
|
63
60
|
* Example: token = rgba(10, 10, 10, 1.0);
|
|
64
61
|
* adjustAlpha(token, 0.3) === rgba(10, 10, 10, 0.3);
|
|
65
|
-
* @param {string} token
|
|
66
|
-
* @param {float} alpha
|
|
67
|
-
* @returns {string}
|
|
68
62
|
*/
|
|
69
|
-
|
|
63
|
+
const adjustAlpha = (token, alpha) => {
|
|
70
64
|
return (0, color.default)(token).rgb().alpha(alpha).string();
|
|
71
|
-
}
|
|
65
|
+
};
|
|
72
66
|
const numbers = [
|
|
73
67
|
"0",
|
|
74
68
|
"1",
|
|
@@ -83,10 +77,8 @@ const numbers = [
|
|
|
83
77
|
];
|
|
84
78
|
/**
|
|
85
79
|
* Format a given token into the format expected in CSS/SCSS-based projects.
|
|
86
|
-
* @param {string} token
|
|
87
|
-
* @returns {string}
|
|
88
80
|
*/
|
|
89
|
-
|
|
81
|
+
const formatTokenName = (token) => {
|
|
90
82
|
let string = "";
|
|
91
83
|
for (let i = 0; i < token.length; i++) {
|
|
92
84
|
if (numbers.indexOf(token[i]) !== -1) {
|
|
@@ -104,11 +96,11 @@ function formatTokenName(token) {
|
|
|
104
96
|
string += token[i];
|
|
105
97
|
}
|
|
106
98
|
return string;
|
|
107
|
-
}
|
|
99
|
+
};
|
|
108
100
|
//#endregion
|
|
109
|
-
//#region src/white.
|
|
101
|
+
//#region src/white.ts
|
|
110
102
|
/**
|
|
111
|
-
* Copyright IBM Corp. 2018,
|
|
103
|
+
* Copyright IBM Corp. 2018, 2026
|
|
112
104
|
*
|
|
113
105
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
114
106
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -657,9 +649,9 @@ const chatButtonActive = backgroundActive;
|
|
|
657
649
|
const chatButtonSelected = backgroundSelected;
|
|
658
650
|
const chatButtonTextSelected = textSecondary;
|
|
659
651
|
//#endregion
|
|
660
|
-
//#region src/g10.
|
|
652
|
+
//#region src/g10.ts
|
|
661
653
|
/**
|
|
662
|
-
* Copyright IBM Corp. 2018,
|
|
654
|
+
* Copyright IBM Corp. 2018, 2026
|
|
663
655
|
*
|
|
664
656
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
665
657
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -1208,9 +1200,9 @@ const chatButtonActive$3 = backgroundActive$7;
|
|
|
1208
1200
|
const chatButtonSelected$3 = backgroundSelected$7;
|
|
1209
1201
|
const chatButtonTextSelected$3 = textSecondary$7;
|
|
1210
1202
|
//#endregion
|
|
1211
|
-
//#region src/g90.
|
|
1203
|
+
//#region src/g90.ts
|
|
1212
1204
|
/**
|
|
1213
|
-
* Copyright IBM Corp. 2018,
|
|
1205
|
+
* Copyright IBM Corp. 2018, 2026
|
|
1214
1206
|
*
|
|
1215
1207
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
1216
1208
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -1759,9 +1751,9 @@ const chatButtonActive$2 = backgroundActive$6;
|
|
|
1759
1751
|
const chatButtonSelected$2 = backgroundSelected$6;
|
|
1760
1752
|
const chatButtonTextSelected$2 = textSecondary$6;
|
|
1761
1753
|
//#endregion
|
|
1762
|
-
//#region src/g100.
|
|
1754
|
+
//#region src/g100.ts
|
|
1763
1755
|
/**
|
|
1764
|
-
* Copyright IBM Corp. 2018,
|
|
1756
|
+
* Copyright IBM Corp. 2018, 2026
|
|
1765
1757
|
*
|
|
1766
1758
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
1767
1759
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -2310,9 +2302,9 @@ const chatButtonActive$1 = backgroundActive$5;
|
|
|
2310
2302
|
const chatButtonSelected$1 = backgroundSelected$5;
|
|
2311
2303
|
const chatButtonTextSelected$1 = textSecondary$5;
|
|
2312
2304
|
//#endregion
|
|
2313
|
-
//#region src/v10/white.
|
|
2305
|
+
//#region src/v10/white.ts
|
|
2314
2306
|
/**
|
|
2315
|
-
* Copyright IBM Corp. 2018,
|
|
2307
|
+
* Copyright IBM Corp. 2018, 2026
|
|
2316
2308
|
*
|
|
2317
2309
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
2318
2310
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -2709,9 +2701,9 @@ const active01$3 = activeUI$3;
|
|
|
2709
2701
|
const hoverField$3 = hoverUI$3;
|
|
2710
2702
|
const danger$3 = danger01$3;
|
|
2711
2703
|
//#endregion
|
|
2712
|
-
//#region src/v10/g10.
|
|
2704
|
+
//#region src/v10/g10.ts
|
|
2713
2705
|
/**
|
|
2714
|
-
* Copyright IBM Corp. 2018,
|
|
2706
|
+
* Copyright IBM Corp. 2018, 2026
|
|
2715
2707
|
*
|
|
2716
2708
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
2717
2709
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -3108,9 +3100,9 @@ const active01$2 = activeUI$2;
|
|
|
3108
3100
|
const hoverField$2 = hoverUI$2;
|
|
3109
3101
|
const danger$2 = danger01$2;
|
|
3110
3102
|
//#endregion
|
|
3111
|
-
//#region src/v10/g90.
|
|
3103
|
+
//#region src/v10/g90.ts
|
|
3112
3104
|
/**
|
|
3113
|
-
* Copyright IBM Corp. 2018,
|
|
3105
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3114
3106
|
*
|
|
3115
3107
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
3116
3108
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -3507,9 +3499,9 @@ const active01$1 = activeUI$1;
|
|
|
3507
3499
|
const hoverField$1 = hoverUI$1;
|
|
3508
3500
|
const danger$1 = danger01$1;
|
|
3509
3501
|
//#endregion
|
|
3510
|
-
//#region src/v10/g100.
|
|
3502
|
+
//#region src/v10/g100.ts
|
|
3511
3503
|
/**
|
|
3512
|
-
* Copyright IBM Corp. 2018,
|
|
3504
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3513
3505
|
*
|
|
3514
3506
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
3515
3507
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4059,9 +4051,9 @@ const tokens = {
|
|
|
4059
4051
|
layout: _carbon_layout.unstable_tokens
|
|
4060
4052
|
};
|
|
4061
4053
|
//#endregion
|
|
4062
|
-
//#region src/v10/index.
|
|
4054
|
+
//#region src/v10/index.ts
|
|
4063
4055
|
/**
|
|
4064
|
-
* Copyright IBM Corp. 2018,
|
|
4056
|
+
* Copyright IBM Corp. 2018, 2026
|
|
4065
4057
|
*
|
|
4066
4058
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4067
4059
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4323,7 +4315,7 @@ const themes$1 = {
|
|
|
4323
4315
|
g100: g100_exports$1
|
|
4324
4316
|
};
|
|
4325
4317
|
//#endregion
|
|
4326
|
-
//#region src/component-tokens/button/tokens.
|
|
4318
|
+
//#region src/component-tokens/button/tokens.ts
|
|
4327
4319
|
var tokens_exports$4 = /* @__PURE__ */ __exportAll({
|
|
4328
4320
|
buttonDangerActive: () => buttonDangerActive,
|
|
4329
4321
|
buttonDangerHover: () => buttonDangerHover,
|
|
@@ -4342,7 +4334,7 @@ var tokens_exports$4 = /* @__PURE__ */ __exportAll({
|
|
|
4342
4334
|
buttonTertiaryHover: () => buttonTertiaryHover
|
|
4343
4335
|
});
|
|
4344
4336
|
/**
|
|
4345
|
-
* Copyright IBM Corp. 2022
|
|
4337
|
+
* Copyright IBM Corp. 2022, 2026
|
|
4346
4338
|
*
|
|
4347
4339
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4348
4340
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4439,12 +4431,12 @@ const buttonDisabled = {
|
|
|
4439
4431
|
g100: "rgb(141 141 141 / 30%)"
|
|
4440
4432
|
};
|
|
4441
4433
|
//#endregion
|
|
4442
|
-
//#region src/component-tokens/button/index.
|
|
4434
|
+
//#region src/component-tokens/button/index.ts
|
|
4443
4435
|
var button_exports = /* @__PURE__ */ __exportAll({ buttonTokens: () => tokens_exports$4 });
|
|
4444
4436
|
//#endregion
|
|
4445
|
-
//#region src/component-tokens/tag/tokens.
|
|
4437
|
+
//#region src/component-tokens/tag/tokens.ts
|
|
4446
4438
|
/**
|
|
4447
|
-
* Copyright IBM Corp. 2022,
|
|
4439
|
+
* Copyright IBM Corp. 2022, 2026
|
|
4448
4440
|
*
|
|
4449
4441
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4450
4442
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4732,12 +4724,12 @@ const tagBorderWarmGray = {
|
|
|
4732
4724
|
g100: _carbon_colors.warmGray50
|
|
4733
4725
|
};
|
|
4734
4726
|
//#endregion
|
|
4735
|
-
//#region src/component-tokens/tag/index.
|
|
4727
|
+
//#region src/component-tokens/tag/index.ts
|
|
4736
4728
|
var tag_exports = /* @__PURE__ */ __exportAll({ tagTokens: () => tokens_exports$3 });
|
|
4737
4729
|
//#endregion
|
|
4738
|
-
//#region src/component-tokens/notification/tokens.
|
|
4730
|
+
//#region src/component-tokens/notification/tokens.ts
|
|
4739
4731
|
/**
|
|
4740
|
-
* Copyright IBM Corp. 2022,
|
|
4732
|
+
* Copyright IBM Corp. 2022, 2026
|
|
4741
4733
|
*
|
|
4742
4734
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4743
4735
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4813,12 +4805,12 @@ const notificationActionTertiaryInverseTextOnColorDisabled = {
|
|
|
4813
4805
|
g100: textOnColorDisabled
|
|
4814
4806
|
};
|
|
4815
4807
|
//#endregion
|
|
4816
|
-
//#region src/component-tokens/notification/index.
|
|
4808
|
+
//#region src/component-tokens/notification/index.ts
|
|
4817
4809
|
var notification_exports = /* @__PURE__ */ __exportAll({ notificationTokens: () => tokens_exports$2 });
|
|
4818
4810
|
//#endregion
|
|
4819
|
-
//#region src/component-tokens/status/tokens.
|
|
4811
|
+
//#region src/component-tokens/status/tokens.ts
|
|
4820
4812
|
/**
|
|
4821
|
-
* Copyright IBM Corp. 2025
|
|
4813
|
+
* Copyright IBM Corp. 2025, 2026
|
|
4822
4814
|
*
|
|
4823
4815
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4824
4816
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4892,12 +4884,12 @@ const statusAccessibilityBackground = {
|
|
|
4892
4884
|
g100: _carbon_colors.gray100
|
|
4893
4885
|
};
|
|
4894
4886
|
//#endregion
|
|
4895
|
-
//#region src/component-tokens/status/index.
|
|
4887
|
+
//#region src/component-tokens/status/index.ts
|
|
4896
4888
|
var status_exports = /* @__PURE__ */ __exportAll({ statusTokens: () => tokens_exports$1 });
|
|
4897
4889
|
//#endregion
|
|
4898
|
-
//#region src/component-tokens/content-switcher/tokens.
|
|
4890
|
+
//#region src/component-tokens/content-switcher/tokens.ts
|
|
4899
4891
|
/**
|
|
4900
|
-
* Copyright IBM Corp. 2025
|
|
4892
|
+
* Copyright IBM Corp. 2025, 2026
|
|
4901
4893
|
*
|
|
4902
4894
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4903
4895
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4927,21 +4919,10 @@ const contentSwitcherBackgroundHover = {
|
|
|
4927
4919
|
g100: (0, _carbon_colors.rgba)(_carbon_colors.gray50, .12)
|
|
4928
4920
|
};
|
|
4929
4921
|
//#endregion
|
|
4930
|
-
//#region src/component-tokens/content-switcher/index.
|
|
4922
|
+
//#region src/component-tokens/content-switcher/index.ts
|
|
4931
4923
|
var content_switcher_exports = /* @__PURE__ */ __exportAll({ contentSwitcherTokens: () => tokens_exports });
|
|
4932
4924
|
//#endregion
|
|
4933
|
-
//#region src/tokens/Token.
|
|
4934
|
-
/**
|
|
4935
|
-
* Copyright IBM Corp. 2018, 2025
|
|
4936
|
-
*
|
|
4937
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
4938
|
-
* LICENSE file in the root directory of this source tree.
|
|
4939
|
-
*/
|
|
4940
|
-
/**
|
|
4941
|
-
* A Token is the simplest unit in our theme. It can have a name, properties
|
|
4942
|
-
* that it applies to like border or background, along with a state if the
|
|
4943
|
-
* token should only be used for specific states like hover or focus.
|
|
4944
|
-
*/
|
|
4925
|
+
//#region src/tokens/Token.ts
|
|
4945
4926
|
var Token = class Token {
|
|
4946
4927
|
static create(token) {
|
|
4947
4928
|
if (typeof token === "string") return new Token(token);
|
|
@@ -4955,9 +4936,9 @@ var Token = class Token {
|
|
|
4955
4936
|
}
|
|
4956
4937
|
};
|
|
4957
4938
|
//#endregion
|
|
4958
|
-
//#region src/tokens/TokenGroup.
|
|
4939
|
+
//#region src/tokens/TokenGroup.ts
|
|
4959
4940
|
/**
|
|
4960
|
-
* Copyright IBM Corp. 2018,
|
|
4941
|
+
* Copyright IBM Corp. 2018, 2026
|
|
4961
4942
|
*
|
|
4962
4943
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
4963
4944
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -4982,7 +4963,7 @@ var TokenGroup = class TokenGroup {
|
|
|
4982
4963
|
this.name = name;
|
|
4983
4964
|
if (properties) this.properties = properties;
|
|
4984
4965
|
this.children = tokens.map((child) => {
|
|
4985
|
-
if (child.kind === "TokenGroup") return child;
|
|
4966
|
+
if (typeof child !== "string" && "kind" in child && child.kind === "TokenGroup") return child;
|
|
4986
4967
|
return Token.create(child);
|
|
4987
4968
|
});
|
|
4988
4969
|
}
|
|
@@ -4996,7 +4977,6 @@ var TokenGroup = class TokenGroup {
|
|
|
4996
4977
|
/**
|
|
4997
4978
|
* Get all the tokens available in every Token Group in this TokenGroup,
|
|
4998
4979
|
* including itself.
|
|
4999
|
-
* @returns {Array<Token>}
|
|
5000
4980
|
*/
|
|
5001
4981
|
getTokens(parentContext = {}) {
|
|
5002
4982
|
const context = {
|
|
@@ -5018,7 +4998,6 @@ var TokenGroup = class TokenGroup {
|
|
|
5018
4998
|
/**
|
|
5019
4999
|
* Get a specific token from the TokenGroup, or form one of its nested
|
|
5020
5000
|
* TokenGroups
|
|
5021
|
-
* @returns {Token}
|
|
5022
5001
|
*/
|
|
5023
5002
|
getToken(tokenOrName) {
|
|
5024
5003
|
const name = typeof tokenOrName === "string" ? tokenOrName : tokenOrName.name;
|
|
@@ -5030,7 +5009,6 @@ var TokenGroup = class TokenGroup {
|
|
|
5030
5009
|
}
|
|
5031
5010
|
/**
|
|
5032
5011
|
* Get all the unique groups in the token group, including this group
|
|
5033
|
-
* @returns {Array<TokenGroup>}
|
|
5034
5012
|
*/
|
|
5035
5013
|
getTokenGroups() {
|
|
5036
5014
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -5042,7 +5020,6 @@ var TokenGroup = class TokenGroup {
|
|
|
5042
5020
|
}
|
|
5043
5021
|
/**
|
|
5044
5022
|
* Get all the unique properties in the token group, including this group
|
|
5045
|
-
* @returns {Array<string>}
|
|
5046
5023
|
*/
|
|
5047
5024
|
getTokenProperties() {
|
|
5048
5025
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -5054,7 +5031,6 @@ var TokenGroup = class TokenGroup {
|
|
|
5054
5031
|
}
|
|
5055
5032
|
/**
|
|
5056
5033
|
* Get all the unique states in the token group, including this group
|
|
5057
|
-
* @returns {Array<string>}
|
|
5058
5034
|
*/
|
|
5059
5035
|
getTokenStates() {
|
|
5060
5036
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -5066,9 +5042,9 @@ var TokenGroup = class TokenGroup {
|
|
|
5066
5042
|
}
|
|
5067
5043
|
};
|
|
5068
5044
|
//#endregion
|
|
5069
|
-
//#region src/tokens/v11TokenGroup.
|
|
5045
|
+
//#region src/tokens/v11TokenGroup.ts
|
|
5070
5046
|
/**
|
|
5071
|
-
* Copyright IBM Corp. 2018,
|
|
5047
|
+
* Copyright IBM Corp. 2018, 2026
|
|
5072
5048
|
*
|
|
5073
5049
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5074
5050
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -5543,9 +5519,9 @@ const group = TokenGroup.create({
|
|
|
5543
5519
|
]
|
|
5544
5520
|
});
|
|
5545
5521
|
//#endregion
|
|
5546
|
-
//#region src/tokens/components.
|
|
5522
|
+
//#region src/tokens/components.ts
|
|
5547
5523
|
/**
|
|
5548
|
-
* Copyright IBM Corp. 2018,
|
|
5524
|
+
* Copyright IBM Corp. 2018, 2026
|
|
5549
5525
|
*
|
|
5550
5526
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5551
5527
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -5665,9 +5641,9 @@ const contentSwitcher = TokenGroup.create({
|
|
|
5665
5641
|
]
|
|
5666
5642
|
});
|
|
5667
5643
|
//#endregion
|
|
5668
|
-
//#region src/tokens/type.
|
|
5644
|
+
//#region src/tokens/type.ts
|
|
5669
5645
|
/**
|
|
5670
|
-
* Copyright IBM Corp. 2018,
|
|
5646
|
+
* Copyright IBM Corp. 2018, 2026
|
|
5671
5647
|
*
|
|
5672
5648
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5673
5649
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -5713,9 +5689,9 @@ const type$1 = TokenGroup.create({
|
|
|
5713
5689
|
]
|
|
5714
5690
|
});
|
|
5715
5691
|
//#endregion
|
|
5716
|
-
//#region src/tokens/layout.
|
|
5692
|
+
//#region src/tokens/layout.ts
|
|
5717
5693
|
/**
|
|
5718
|
-
* Copyright IBM Corp. 2018,
|
|
5694
|
+
* Copyright IBM Corp. 2018, 2026
|
|
5719
5695
|
*
|
|
5720
5696
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5721
5697
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -5751,9 +5727,9 @@ const layout$1 = TokenGroup.create({
|
|
|
5751
5727
|
]
|
|
5752
5728
|
});
|
|
5753
5729
|
//#endregion
|
|
5754
|
-
//#region src/tokens/v10.
|
|
5730
|
+
//#region src/tokens/v10.ts
|
|
5755
5731
|
/**
|
|
5756
|
-
* Copyright IBM Corp. 2018,
|
|
5732
|
+
* Copyright IBM Corp. 2018, 2026
|
|
5757
5733
|
*
|
|
5758
5734
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5759
5735
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -5933,47 +5909,38 @@ const v10 = [
|
|
|
5933
5909
|
};
|
|
5934
5910
|
})
|
|
5935
5911
|
];
|
|
5912
|
+
//#endregion
|
|
5913
|
+
//#region src/tokens/index.ts
|
|
5914
|
+
const formatMetadata = (name, type) => ({
|
|
5915
|
+
name,
|
|
5916
|
+
type
|
|
5917
|
+
});
|
|
5936
5918
|
const unstable_metadata = {
|
|
5937
5919
|
v11: [
|
|
5938
5920
|
...group.getTokens().map((token) => {
|
|
5939
|
-
return
|
|
5940
|
-
name: token.name,
|
|
5941
|
-
type: "color"
|
|
5942
|
-
};
|
|
5921
|
+
return formatMetadata(token.name, "color");
|
|
5943
5922
|
}),
|
|
5944
5923
|
...contextual.getTokens().map((token) => {
|
|
5945
|
-
return
|
|
5946
|
-
name: token.name,
|
|
5947
|
-
type: "color"
|
|
5948
|
-
};
|
|
5924
|
+
return formatMetadata(token.name, "color");
|
|
5949
5925
|
}),
|
|
5950
5926
|
...Object.values(components_exports).flatMap((group) => {
|
|
5951
5927
|
return group.getTokens().map((token) => {
|
|
5952
|
-
return
|
|
5953
|
-
name: token.name,
|
|
5954
|
-
type: "color"
|
|
5955
|
-
};
|
|
5928
|
+
return formatMetadata(token.name, "color");
|
|
5956
5929
|
});
|
|
5957
5930
|
}),
|
|
5958
5931
|
...type$1.getTokens().map((token) => {
|
|
5959
|
-
return
|
|
5960
|
-
name: token.name,
|
|
5961
|
-
type: "type"
|
|
5962
|
-
};
|
|
5932
|
+
return formatMetadata(token.name, "type");
|
|
5963
5933
|
}),
|
|
5964
5934
|
...layout$1.getTokens().map((token) => {
|
|
5965
|
-
return
|
|
5966
|
-
name: token.name,
|
|
5967
|
-
type: "layout"
|
|
5968
|
-
};
|
|
5935
|
+
return formatMetadata(token.name, "layout");
|
|
5969
5936
|
})
|
|
5970
5937
|
],
|
|
5971
5938
|
v10
|
|
5972
5939
|
};
|
|
5973
5940
|
//#endregion
|
|
5974
|
-
//#region src/index.
|
|
5941
|
+
//#region src/index.ts
|
|
5975
5942
|
/**
|
|
5976
|
-
* Copyright IBM Corp. 2018,
|
|
5943
|
+
* Copyright IBM Corp. 2018, 2026
|
|
5977
5944
|
*
|
|
5978
5945
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5979
5946
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A Token is the simplest unit in our theme. It can have a name, properties
|
|
9
|
+
* that it applies to like border or background, along with a state if the
|
|
10
|
+
* token should only be used for specific states like hover or focus.
|
|
11
|
+
*/
|
|
12
|
+
import type { TokenDefinition, TokenProperties } from './types';
|
|
13
|
+
export declare class Token {
|
|
14
|
+
kind: 'Token';
|
|
15
|
+
name: string;
|
|
16
|
+
properties?: TokenProperties;
|
|
17
|
+
state?: string;
|
|
18
|
+
static create(token: string | TokenDefinition): Token;
|
|
19
|
+
constructor(name: string, properties?: TokenProperties, state?: string);
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { TokenDefinition } from './types';
|
|
8
|
+
type TokenFormatName = 'javascript' | 'scss';
|
|
9
|
+
export declare const TokenFormat: {
|
|
10
|
+
formats: Record<"scss" | "js", TokenFormatName>;
|
|
11
|
+
convert({ name, format, }: Pick<TokenDefinition, "name"> & {
|
|
12
|
+
format?: TokenFormatName;
|
|
13
|
+
}): string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Token } from './Token';
|
|
8
|
+
import type { ResolvedToken, TokenContext, TokenDefinition, TokenProperties } from './types';
|
|
9
|
+
type TokenGroupChild = Token | TokenGroup;
|
|
10
|
+
type TokenGroupDefinition = {
|
|
11
|
+
name: string;
|
|
12
|
+
properties?: TokenProperties;
|
|
13
|
+
tokens?: Array<Token | TokenDefinition | TokenGroup | string>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A TokenGroup allows us to group up a collection of tokens and nested token
|
|
17
|
+
* groups. A group allows us to colocate related tokens and write information
|
|
18
|
+
* once that applies to the entire collection of tokens. For example, if all the
|
|
19
|
+
* tokens apply to the `border` color property then we can specify this property
|
|
20
|
+
* at the group level
|
|
21
|
+
*
|
|
22
|
+
* A TokenGroup allows us to colocate all this information while also providing
|
|
23
|
+
* ways to get information about the entire group, including properties and
|
|
24
|
+
* states
|
|
25
|
+
*/
|
|
26
|
+
export declare class TokenGroup {
|
|
27
|
+
kind: 'TokenGroup';
|
|
28
|
+
name: string;
|
|
29
|
+
properties?: TokenProperties;
|
|
30
|
+
children: TokenGroupChild[];
|
|
31
|
+
static create({ name, properties, tokens }: TokenGroupDefinition): TokenGroup;
|
|
32
|
+
constructor(name: string, tokens: Array<Token | TokenDefinition | TokenGroup | string>, properties?: TokenProperties);
|
|
33
|
+
[Symbol.iterator](): Generator<TokenGroupChild, void, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Get all the tokens available in every Token Group in this TokenGroup,
|
|
36
|
+
* including itself.
|
|
37
|
+
*/
|
|
38
|
+
getTokens(parentContext?: TokenContext): ResolvedToken[];
|
|
39
|
+
/**
|
|
40
|
+
* Get a specific token from the TokenGroup, or form one of its nested
|
|
41
|
+
* TokenGroups
|
|
42
|
+
*/
|
|
43
|
+
getToken(tokenOrName: Token | string): Token | null;
|
|
44
|
+
/**
|
|
45
|
+
* Get all the unique groups in the token group, including this group
|
|
46
|
+
*/
|
|
47
|
+
getTokenGroups(): TokenGroup[];
|
|
48
|
+
/**
|
|
49
|
+
* Get all the unique properties in the token group, including this group
|
|
50
|
+
*/
|
|
51
|
+
getTokenProperties(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Get all the unique states in the token group, including this group
|
|
54
|
+
*/
|
|
55
|
+
getTokenStates(): string[];
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A token set is a collection of tokens which should be along with each other.
|
|
9
|
+
* For example, we have tokens that correspond to a layer level in a UI. A
|
|
10
|
+
* token set allows us to group these tokens together in a way that's different
|
|
11
|
+
* than their token group.
|
|
12
|
+
*/
|
|
13
|
+
import { Token } from './Token';
|
|
14
|
+
type TokenSetChild = Token | TokenSet;
|
|
15
|
+
type TokenSetDefinition = {
|
|
16
|
+
name: string;
|
|
17
|
+
tokens?: TokenSetChild[];
|
|
18
|
+
};
|
|
19
|
+
export declare class TokenSet {
|
|
20
|
+
kind: 'TokenSet';
|
|
21
|
+
name: string;
|
|
22
|
+
children: TokenSetChild[];
|
|
23
|
+
static create({ name, tokens }: TokenSetDefinition): TokenSet;
|
|
24
|
+
constructor(name: string, tokens: TokenSetChild[]);
|
|
25
|
+
[Symbol.iterator](): Generator<TokenSetChild, void, unknown>;
|
|
26
|
+
getTokenSets(): TokenSet[];
|
|
27
|
+
getTokenSet(name: string): TokenSet | null;
|
|
28
|
+
hasToken(tokenOrName: Token | string): boolean;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { TokenGroup } from './TokenGroup';
|
|
8
|
+
export declare const button: TokenGroup;
|
|
9
|
+
export declare const notification: TokenGroup;
|
|
10
|
+
export declare const tag: TokenGroup;
|
|
11
|
+
export declare const status: TokenGroup;
|
|
12
|
+
export declare const contentSwitcher: TokenGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Token } from './Token';
|
|
8
|
+
import { TokenFormat } from './TokenFormat';
|
|
9
|
+
import { TokenGroup } from './TokenGroup';
|
|
10
|
+
import { TokenSet } from './TokenSet';
|
|
11
|
+
import { group } from './v11TokenGroup';
|
|
12
|
+
import { set } from './v11TokenSet';
|
|
13
|
+
import type { TokenMetadata } from './types';
|
|
14
|
+
export { Token, TokenFormat, TokenGroup, TokenSet, group, set };
|
|
15
|
+
export declare const unstable_metadata: {
|
|
16
|
+
v11: TokenMetadata[];
|
|
17
|
+
v10: {
|
|
18
|
+
name: string;
|
|
19
|
+
type: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { TokenGroup } from './TokenGroup';
|
|
8
|
+
export declare const layout: TokenGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { TokenGroup } from './TokenGroup';
|
|
8
|
+
export declare const type: TokenGroup;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export type TokenProperties = string[];
|
|
8
|
+
export type TokenDefinition = {
|
|
9
|
+
name: string;
|
|
10
|
+
properties?: TokenProperties;
|
|
11
|
+
state?: string;
|
|
12
|
+
};
|
|
13
|
+
export type TokenContext = {
|
|
14
|
+
groups?: string[];
|
|
15
|
+
properties?: TokenProperties;
|
|
16
|
+
};
|
|
17
|
+
export type ResolvedToken = TokenDefinition & {
|
|
18
|
+
groups: string[];
|
|
19
|
+
};
|
|
20
|
+
export type TokenMetadata = {
|
|
21
|
+
name: string;
|
|
22
|
+
type: 'color' | 'layout' | 'type';
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { TokenGroup } from './TokenGroup';
|
|
8
|
+
export declare const background: TokenGroup;
|
|
9
|
+
export declare const layer: TokenGroup;
|
|
10
|
+
export declare const field: TokenGroup;
|
|
11
|
+
export declare const border: TokenGroup;
|
|
12
|
+
export declare const text: TokenGroup;
|
|
13
|
+
export declare const link: TokenGroup;
|
|
14
|
+
export declare const icon: TokenGroup;
|
|
15
|
+
export declare const support: TokenGroup;
|
|
16
|
+
export declare const focus: TokenGroup;
|
|
17
|
+
export declare const skeleton: TokenGroup;
|
|
18
|
+
export declare const contextual: TokenGroup;
|
|
19
|
+
export declare const syntaxHighlight: TokenGroup;
|
|
20
|
+
export declare const ai: TokenGroup;
|
|
21
|
+
export declare const group: TokenGroup;
|