@wordpress/theme 0.1.1-next.2f1c7c01b.0 → 0.2.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/bin/terrazzo-plugin-ds-tokens-docs/index.ts +5 -24
- package/bin/terrazzo-plugin-inline-alias-values/index.ts +84 -0
- package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +19 -39
- package/build/color-ramps/lib/constants.js +4 -4
- package/build/color-ramps/lib/constants.js.map +2 -2
- package/build/color-ramps/lib/default-ramps.js +82 -82
- package/build/color-ramps/lib/default-ramps.js.map +1 -1
- package/build/color-ramps/lib/find-color-with-constraints.js +36 -53
- package/build/color-ramps/lib/find-color-with-constraints.js.map +2 -2
- package/build/color-ramps/lib/index.js +64 -63
- package/build/color-ramps/lib/index.js.map +2 -2
- package/build/color-ramps/lib/ramp-configs.js +3 -3
- package/build/color-ramps/lib/ramp-configs.js.map +1 -1
- package/build/color-ramps/lib/utils.js +63 -2
- package/build/color-ramps/lib/utils.js.map +2 -2
- package/build/prebuilt/js/design-tokens.js +5 -10
- package/build/prebuilt/js/design-tokens.js.map +2 -2
- package/build/prebuilt/json/figma.json +105 -905
- package/build/prebuilt/ts/color-tokens.js +137 -0
- package/build/prebuilt/ts/color-tokens.js.map +7 -0
- package/build/token-id.js +30 -0
- package/build/token-id.js.map +7 -0
- package/build/use-theme-provider-styles.js +18 -27
- package/build/use-theme-provider-styles.js.map +3 -3
- package/build-module/color-ramps/lib/constants.js +3 -3
- package/build-module/color-ramps/lib/constants.js.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.js +82 -82
- package/build-module/color-ramps/lib/default-ramps.js.map +1 -1
- package/build-module/color-ramps/lib/find-color-with-constraints.js +38 -60
- package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
- package/build-module/color-ramps/lib/index.js +68 -65
- package/build-module/color-ramps/lib/index.js.map +2 -2
- package/build-module/color-ramps/lib/ramp-configs.js +3 -3
- package/build-module/color-ramps/lib/ramp-configs.js.map +1 -1
- package/build-module/color-ramps/lib/utils.js +63 -2
- package/build-module/color-ramps/lib/utils.js.map +2 -2
- package/build-module/prebuilt/js/design-tokens.js +5 -10
- package/build-module/prebuilt/js/design-tokens.js.map +2 -2
- package/build-module/prebuilt/json/figma.json +105 -905
- package/build-module/prebuilt/ts/color-tokens.js +117 -0
- package/build-module/prebuilt/ts/color-tokens.js.map +7 -0
- package/build-module/token-id.js +6 -0
- package/build-module/token-id.js.map +7 -0
- package/build-module/use-theme-provider-styles.js +18 -27
- package/build-module/use-theme-provider-styles.js.map +2 -2
- package/build-types/color-ramps/lib/constants.d.ts +2 -2
- package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +2 -3
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/utils.d.ts +21 -2
- package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/prebuilt/ts/color-tokens.d.ts +7 -0
- package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts.map +1 -1
- package/build-types/theme-provider.d.ts.map +1 -1
- package/build-types/token-id.d.ts +9 -0
- package/build-types/token-id.d.ts.map +1 -0
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/docs/ds-tokens.md +10 -178
- package/package.json +4 -4
- package/src/color-ramps/lib/constants.ts +7 -5
- package/src/color-ramps/lib/default-ramps.ts +82 -82
- package/src/color-ramps/lib/find-color-with-constraints.ts +53 -77
- package/src/color-ramps/lib/index.ts +98 -102
- package/src/color-ramps/lib/ramp-configs.ts +3 -3
- package/src/color-ramps/lib/utils.ts +109 -5
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +45706 -360
- package/src/color-ramps/test/index.test.ts +41 -14
- package/src/prebuilt/css/design-tokens.css +88 -413
- package/src/prebuilt/js/design-tokens.js +5 -10
- package/src/prebuilt/json/figma.json +105 -905
- package/src/prebuilt/ts/color-tokens.ts +117 -0
- package/src/stories/index.story.tsx +4 -18
- package/src/test/token-id.test.ts +12 -0
- package/src/token-id.ts +9 -0
- package/src/use-theme-provider-styles.ts +20 -35
- package/terrazzo.config.ts +15 -12
- package/tokens/color.json +82 -82
- package/tokens/dimension.json +75 -0
- package/tsconfig.bin.tsbuildinfo +1 -1
- package/tsconfig.src.tsbuildinfo +1 -1
- package/build/prebuilt/ts/design-tokens.js +0 -391
- package/build/prebuilt/ts/design-tokens.js.map +0 -7
- package/build-module/prebuilt/ts/design-tokens.js +0 -371
- package/build-module/prebuilt/ts/design-tokens.js.map +0 -7
- package/build-types/prebuilt/ts/design-tokens.d.ts +0 -7
- package/build-types/prebuilt/ts/design-tokens.d.ts.map +0 -1
- package/src/prebuilt/ts/design-tokens.ts +0 -371
- package/tokens/spacing.json +0 -45
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// packages/theme/src/prebuilt/ts/color-tokens.ts
|
|
2
|
+
var color_tokens_default = {
|
|
3
|
+
"primary-bgFill1": ["bg-interactive-brand-strong"],
|
|
4
|
+
"primary-fgFill": [
|
|
5
|
+
"fg-interactive-brand-strong-active",
|
|
6
|
+
"fg-interactive-brand-strong"
|
|
7
|
+
],
|
|
8
|
+
"primary-bgFill2": ["bg-interactive-brand-strong-active"],
|
|
9
|
+
"primary-surface2": ["bg-interactive-brand-active"],
|
|
10
|
+
"primary-surface4": ["bg-interactive-brand-weak-active"],
|
|
11
|
+
"primary-fgSurface3": [
|
|
12
|
+
"fg-interactive-brand-active",
|
|
13
|
+
"fg-interactive-brand"
|
|
14
|
+
],
|
|
15
|
+
"primary-stroke3": [
|
|
16
|
+
"bg-thumb-brand-active",
|
|
17
|
+
"bg-thumb-brand",
|
|
18
|
+
"stroke-focus-brand",
|
|
19
|
+
"stroke-interactive-brand",
|
|
20
|
+
"stroke-surface-brand-strong"
|
|
21
|
+
],
|
|
22
|
+
"primary-stroke4": ["stroke-interactive-brand-active"],
|
|
23
|
+
"primary-stroke1": ["stroke-surface-brand"],
|
|
24
|
+
"primary-surface1": ["bg-surface-brand"],
|
|
25
|
+
"info-surface2": ["bg-surface-info-weak"],
|
|
26
|
+
"info-surface4": ["bg-surface-info"],
|
|
27
|
+
"info-fgSurface4": ["fg-content-info"],
|
|
28
|
+
"info-fgSurface3": ["fg-content-info-weak"],
|
|
29
|
+
"info-stroke3": ["stroke-surface-info-strong"],
|
|
30
|
+
"info-stroke1": ["stroke-surface-info"],
|
|
31
|
+
"success-surface2": ["bg-surface-success-weak"],
|
|
32
|
+
"success-surface4": ["bg-surface-success"],
|
|
33
|
+
"success-fgSurface4": ["fg-content-success"],
|
|
34
|
+
"success-fgSurface3": ["fg-content-success-weak"],
|
|
35
|
+
"success-stroke3": ["stroke-surface-success-strong"],
|
|
36
|
+
"success-stroke1": ["stroke-surface-success"],
|
|
37
|
+
"warning-surface2": ["bg-surface-warning-weak"],
|
|
38
|
+
"warning-surface4": ["bg-surface-warning"],
|
|
39
|
+
"warning-fgSurface4": ["fg-content-warning"],
|
|
40
|
+
"warning-fgSurface3": ["fg-content-warning-weak"],
|
|
41
|
+
"warning-stroke3": ["stroke-surface-warning-strong"],
|
|
42
|
+
"warning-stroke1": ["stroke-surface-warning"],
|
|
43
|
+
"error-surface2": ["bg-surface-error-weak"],
|
|
44
|
+
"error-surface4": ["bg-surface-error"],
|
|
45
|
+
"error-fgSurface4": ["fg-content-error"],
|
|
46
|
+
"error-fgSurface3": ["fg-content-error-weak"],
|
|
47
|
+
"error-stroke3": [
|
|
48
|
+
"stroke-interactive-error-strong",
|
|
49
|
+
"stroke-surface-error-strong"
|
|
50
|
+
],
|
|
51
|
+
"error-stroke1": ["stroke-surface-error"],
|
|
52
|
+
"bg-surface2": ["bg-surface-neutral"],
|
|
53
|
+
"bg-surface6": [
|
|
54
|
+
"bg-interactive-brand-strong-disabled",
|
|
55
|
+
"bg-interactive-neutral-strong-disabled"
|
|
56
|
+
],
|
|
57
|
+
"bg-surface5": [
|
|
58
|
+
"bg-interactive-brand-disabled",
|
|
59
|
+
"bg-interactive-brand-weak-disabled",
|
|
60
|
+
"bg-interactive-neutral-disabled",
|
|
61
|
+
"bg-interactive-neutral-weak-disabled"
|
|
62
|
+
],
|
|
63
|
+
"bg-surface4": [
|
|
64
|
+
"bg-interactive-neutral-active",
|
|
65
|
+
"bg-interactive-neutral-weak-active"
|
|
66
|
+
],
|
|
67
|
+
"bg-surface3": ["bg-surface-neutral-strong"],
|
|
68
|
+
"bg-fgSurface4": [
|
|
69
|
+
"fg-content-neutral",
|
|
70
|
+
"fg-interactive-neutral-active",
|
|
71
|
+
"fg-interactive-neutral"
|
|
72
|
+
],
|
|
73
|
+
"bg-fgSurface3": [
|
|
74
|
+
"fg-content-neutral-weak",
|
|
75
|
+
"fg-interactive-brand-strong-disabled",
|
|
76
|
+
"fg-interactive-neutral-strong-disabled",
|
|
77
|
+
"fg-interactive-neutral-weak"
|
|
78
|
+
],
|
|
79
|
+
"bg-fgSurface2": [
|
|
80
|
+
"fg-interactive-brand-disabled",
|
|
81
|
+
"fg-interactive-neutral-disabled",
|
|
82
|
+
"fg-interactive-neutral-weak-disabled"
|
|
83
|
+
],
|
|
84
|
+
"bg-stroke3": [
|
|
85
|
+
"bg-thumb-neutral-weak",
|
|
86
|
+
"stroke-interactive-neutral",
|
|
87
|
+
"stroke-surface-neutral-strong"
|
|
88
|
+
],
|
|
89
|
+
"bg-stroke4": [
|
|
90
|
+
"bg-thumb-neutral-weak-active",
|
|
91
|
+
"stroke-interactive-neutral-active",
|
|
92
|
+
"stroke-interactive-neutral-strong"
|
|
93
|
+
],
|
|
94
|
+
"bg-stroke2": [
|
|
95
|
+
"bg-thumb-brand-disabled",
|
|
96
|
+
"bg-track-neutral",
|
|
97
|
+
"stroke-interactive-brand-disabled",
|
|
98
|
+
"stroke-interactive-neutral-disabled",
|
|
99
|
+
"stroke-surface-neutral"
|
|
100
|
+
],
|
|
101
|
+
"bg-stroke1": ["bg-track-neutral-weak", "stroke-surface-neutral-weak"],
|
|
102
|
+
"bg-bgFillInverted2": ["bg-interactive-neutral-strong-active"],
|
|
103
|
+
"bg-bgFillInverted1": ["bg-interactive-neutral-strong"],
|
|
104
|
+
"bg-fgFillInverted": [
|
|
105
|
+
"fg-interactive-neutral-strong-active",
|
|
106
|
+
"fg-interactive-neutral-strong"
|
|
107
|
+
],
|
|
108
|
+
"bg-surface1": ["bg-surface-neutral-weak"],
|
|
109
|
+
"caution-surface2": ["bg-surface-caution-weak"],
|
|
110
|
+
"caution-surface4": ["bg-surface-caution"],
|
|
111
|
+
"caution-fgSurface4": ["fg-content-caution"],
|
|
112
|
+
"caution-fgSurface3": ["fg-content-caution-weak"]
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
color_tokens_default as default
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=color-tokens.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/prebuilt/ts/color-tokens.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This file is generated by the @wordpress/terrazzo-plugin-inline-alias-values plugin.\n * Do not edit this file directly.\n */\n\nexport default {\n\t'primary-bgFill1': [ 'bg-interactive-brand-strong' ],\n\t'primary-fgFill': [\n\t\t'fg-interactive-brand-strong-active',\n\t\t'fg-interactive-brand-strong',\n\t],\n\t'primary-bgFill2': [ 'bg-interactive-brand-strong-active' ],\n\t'primary-surface2': [ 'bg-interactive-brand-active' ],\n\t'primary-surface4': [ 'bg-interactive-brand-weak-active' ],\n\t'primary-fgSurface3': [\n\t\t'fg-interactive-brand-active',\n\t\t'fg-interactive-brand',\n\t],\n\t'primary-stroke3': [\n\t\t'bg-thumb-brand-active',\n\t\t'bg-thumb-brand',\n\t\t'stroke-focus-brand',\n\t\t'stroke-interactive-brand',\n\t\t'stroke-surface-brand-strong',\n\t],\n\t'primary-stroke4': [ 'stroke-interactive-brand-active' ],\n\t'primary-stroke1': [ 'stroke-surface-brand' ],\n\t'primary-surface1': [ 'bg-surface-brand' ],\n\t'info-surface2': [ 'bg-surface-info-weak' ],\n\t'info-surface4': [ 'bg-surface-info' ],\n\t'info-fgSurface4': [ 'fg-content-info' ],\n\t'info-fgSurface3': [ 'fg-content-info-weak' ],\n\t'info-stroke3': [ 'stroke-surface-info-strong' ],\n\t'info-stroke1': [ 'stroke-surface-info' ],\n\t'success-surface2': [ 'bg-surface-success-weak' ],\n\t'success-surface4': [ 'bg-surface-success' ],\n\t'success-fgSurface4': [ 'fg-content-success' ],\n\t'success-fgSurface3': [ 'fg-content-success-weak' ],\n\t'success-stroke3': [ 'stroke-surface-success-strong' ],\n\t'success-stroke1': [ 'stroke-surface-success' ],\n\t'warning-surface2': [ 'bg-surface-warning-weak' ],\n\t'warning-surface4': [ 'bg-surface-warning' ],\n\t'warning-fgSurface4': [ 'fg-content-warning' ],\n\t'warning-fgSurface3': [ 'fg-content-warning-weak' ],\n\t'warning-stroke3': [ 'stroke-surface-warning-strong' ],\n\t'warning-stroke1': [ 'stroke-surface-warning' ],\n\t'error-surface2': [ 'bg-surface-error-weak' ],\n\t'error-surface4': [ 'bg-surface-error' ],\n\t'error-fgSurface4': [ 'fg-content-error' ],\n\t'error-fgSurface3': [ 'fg-content-error-weak' ],\n\t'error-stroke3': [\n\t\t'stroke-interactive-error-strong',\n\t\t'stroke-surface-error-strong',\n\t],\n\t'error-stroke1': [ 'stroke-surface-error' ],\n\t'bg-surface2': [ 'bg-surface-neutral' ],\n\t'bg-surface6': [\n\t\t'bg-interactive-brand-strong-disabled',\n\t\t'bg-interactive-neutral-strong-disabled',\n\t],\n\t'bg-surface5': [\n\t\t'bg-interactive-brand-disabled',\n\t\t'bg-interactive-brand-weak-disabled',\n\t\t'bg-interactive-neutral-disabled',\n\t\t'bg-interactive-neutral-weak-disabled',\n\t],\n\t'bg-surface4': [\n\t\t'bg-interactive-neutral-active',\n\t\t'bg-interactive-neutral-weak-active',\n\t],\n\t'bg-surface3': [ 'bg-surface-neutral-strong' ],\n\t'bg-fgSurface4': [\n\t\t'fg-content-neutral',\n\t\t'fg-interactive-neutral-active',\n\t\t'fg-interactive-neutral',\n\t],\n\t'bg-fgSurface3': [\n\t\t'fg-content-neutral-weak',\n\t\t'fg-interactive-brand-strong-disabled',\n\t\t'fg-interactive-neutral-strong-disabled',\n\t\t'fg-interactive-neutral-weak',\n\t],\n\t'bg-fgSurface2': [\n\t\t'fg-interactive-brand-disabled',\n\t\t'fg-interactive-neutral-disabled',\n\t\t'fg-interactive-neutral-weak-disabled',\n\t],\n\t'bg-stroke3': [\n\t\t'bg-thumb-neutral-weak',\n\t\t'stroke-interactive-neutral',\n\t\t'stroke-surface-neutral-strong',\n\t],\n\t'bg-stroke4': [\n\t\t'bg-thumb-neutral-weak-active',\n\t\t'stroke-interactive-neutral-active',\n\t\t'stroke-interactive-neutral-strong',\n\t],\n\t'bg-stroke2': [\n\t\t'bg-thumb-brand-disabled',\n\t\t'bg-track-neutral',\n\t\t'stroke-interactive-brand-disabled',\n\t\t'stroke-interactive-neutral-disabled',\n\t\t'stroke-surface-neutral',\n\t],\n\t'bg-stroke1': [ 'bg-track-neutral-weak', 'stroke-surface-neutral-weak' ],\n\t'bg-bgFillInverted2': [ 'bg-interactive-neutral-strong-active' ],\n\t'bg-bgFillInverted1': [ 'bg-interactive-neutral-strong' ],\n\t'bg-fgFillInverted': [\n\t\t'fg-interactive-neutral-strong-active',\n\t\t'fg-interactive-neutral-strong',\n\t],\n\t'bg-surface1': [ 'bg-surface-neutral-weak' ],\n\t'caution-surface2': [ 'bg-surface-caution-weak' ],\n\t'caution-surface4': [ 'bg-surface-caution' ],\n\t'caution-fgSurface4': [ 'fg-content-caution' ],\n\t'caution-fgSurface3': [ 'fg-content-caution-weak' ],\n} as Record< string, string[] >;\n"],
|
|
5
|
+
"mappings": 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ent": ["/**\n * Normalizes a token ID by removing default states and visibility identifiers,\n * making it human-readable as a publicly-accessible variable name.\n *\n * @param id The token ID to normalize.\n * @return The normalized token ID.\n */\nexport const publicTokenId = ( id: string ) =>\n\tid.replace( /\\.(normal|resting|semantic|primitive)/g, '' );\n"],
|
|
5
|
+
"mappings": ";AAOO,IAAM,gBAAgB,CAAE,OAC9B,GAAG,QAAS,0CAA0C,EAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -11,7 +11,7 @@ import memoize from "memize";
|
|
|
11
11
|
import { useMemo, useContext } from "@wordpress/element";
|
|
12
12
|
import "./color-ramps/lib/register-color-spaces";
|
|
13
13
|
import { ThemeContext } from "./context";
|
|
14
|
-
import
|
|
14
|
+
import colorTokens from "./prebuilt/ts/color-tokens";
|
|
15
15
|
import {
|
|
16
16
|
buildBgRamp,
|
|
17
17
|
buildAccentRamp,
|
|
@@ -133,23 +133,21 @@ function legacyWpAdminThemeOverridesCSS(accent) {
|
|
|
133
133
|
]
|
|
134
134
|
];
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
]
|
|
152
|
-
);
|
|
136
|
+
function colorTokensCSS(computedColorRamps) {
|
|
137
|
+
const entries = [];
|
|
138
|
+
for (const [rampName, { ramp }] of computedColorRamps) {
|
|
139
|
+
for (const [tokenName, tokenValue] of Object.entries(ramp)) {
|
|
140
|
+
const key = `${rampName}-${tokenName}`;
|
|
141
|
+
const aliasedBy = colorTokens[key] ?? [];
|
|
142
|
+
for (const aliasedId of aliasedBy) {
|
|
143
|
+
entries.push([
|
|
144
|
+
`--wpds-color-${aliasedId}`,
|
|
145
|
+
tokenValue.color
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return entries;
|
|
153
151
|
}
|
|
154
152
|
function generateStyles({
|
|
155
153
|
primary,
|
|
@@ -157,15 +155,8 @@ function generateStyles({
|
|
|
157
155
|
}) {
|
|
158
156
|
return Object.fromEntries(
|
|
159
157
|
[
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
colorRampCSS(
|
|
163
|
-
computedColorRamp,
|
|
164
|
-
`--wpds-color-private-${rampName}-`
|
|
165
|
-
)
|
|
166
|
-
]).flat(2),
|
|
167
|
-
// Semantic color tokens (other semantic tokens for now are static)
|
|
168
|
-
semanticTokensCSS(([key]) => /color/.test(key)),
|
|
158
|
+
// Semantic color tokens
|
|
159
|
+
colorTokensCSS(computedColorRamps),
|
|
169
160
|
// Legacy overrides
|
|
170
161
|
legacyWpAdminThemeOverridesCSS(primary),
|
|
171
162
|
legacyWpComponentsOverridesCSS
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/use-theme-provider-styles.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport {\n\tparse,\n\tto,\n\tget,\n\tserialize,\n\tsRGB,\n\tHSL,\n\ttype ColorTypes,\n} from 'colorjs.io/fn';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport './color-ramps/lib/register-color-spaces';\nimport { ThemeContext } from './context';\nimport
|
|
5
|
-
"mappings": ";AAIA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,OAAO,aAAa;AAKpB,SAAS,SAAS,kBAAkB;AAKpC,OAAO;AACP,SAAS,oBAAoB;AAC7B,OAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport {\n\tparse,\n\tto,\n\tget,\n\tserialize,\n\tsRGB,\n\tHSL,\n\ttype ColorTypes,\n} from 'colorjs.io/fn';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport './color-ramps/lib/register-color-spaces';\nimport { ThemeContext } from './context';\nimport colorTokens from './prebuilt/ts/color-tokens';\nimport {\n\tbuildBgRamp,\n\tbuildAccentRamp,\n\tDEFAULT_SEED_COLORS,\n\ttype RampResult,\n} from './color-ramps';\nimport type { ThemeProviderProps } from './types';\n\ntype Entry = [ string, string ];\n\nconst getCachedBgRamp = memoize( buildBgRamp, { maxSize: 10 } );\nconst getCachedAccentRamp = memoize( buildAccentRamp, { maxSize: 10 } );\n\nconst legacyWpComponentsOverridesCSS: Entry[] = [\n\t[ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],\n\t[\n\t\t'--wp-components-color-accent-darker-10',\n\t\t'var(--wp-admin-theme-color-darker-10)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-darker-20',\n\t\t'var(--wp-admin-theme-color-darker-20)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-inverted',\n\t\t'var(--wpds-color-fg-interactive-brand-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-background',\n\t\t'var(--wpds-color-bg-surface-neutral-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground-inverted',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-100',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-200',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-300',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-400',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-600',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-700',\n\t\t'var(--wpds-color-fg-content-neutral-weak)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-800',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n];\n\nfunction customRgbFormat( color: ColorTypes ) {\n\tconst rgb = to( color, sRGB );\n\treturn [ get( rgb, 'srgb.r' ), get( rgb, 'srgb.g' ), get( rgb, 'srgb.b' ) ]\n\t\t.map( ( n ) => Math.round( n * 255 ) )\n\t\t.join( ', ' );\n}\n\nfunction legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {\n\tconst parsedAccent = to( parse( accent ), HSL );\n\n\tconst coords = parsedAccent.coords;\n\tconst darker10 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 5 ) ), // l (reduced by 5%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\tconst darker20 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 10 ) ), // l (reduced by 10%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\n\treturn [\n\t\t[\n\t\t\t'--wp-admin-theme-color',\n\t\t\tserialize( to( parsedAccent, sRGB ), { format: 'hex' } ),\n\t\t],\n\t\t[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10',\n\t\t\tserialize( darker10, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10--rgb',\n\t\t\tcustomRgbFormat( darker10 ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20',\n\t\t\tserialize( darker20, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20--rgb',\n\t\t\tcustomRgbFormat( darker20 ),\n\t\t],\n\t];\n}\n\nfunction colorTokensCSS(\n\tcomputedColorRamps: Map< string, RampResult >\n): Entry[] {\n\tconst entries: Entry[] = [];\n\n\tfor ( const [ rampName, { ramp } ] of computedColorRamps ) {\n\t\tfor ( const [ tokenName, tokenValue ] of Object.entries( ramp ) ) {\n\t\t\tconst key = `${ rampName }-${ tokenName }`;\n\t\t\tconst aliasedBy = colorTokens[ key ] ?? [];\n\t\t\tfor ( const aliasedId of aliasedBy ) {\n\t\t\t\tentries.push( [\n\t\t\t\t\t`--wpds-color-${ aliasedId }`,\n\t\t\t\t\ttokenValue.color,\n\t\t\t\t] );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn entries;\n}\n\nfunction generateStyles( {\n\tprimary,\n\tcomputedColorRamps,\n}: {\n\tprimary: string;\n\tcomputedColorRamps: Map< string, RampResult >;\n} ): CSSProperties {\n\treturn Object.fromEntries(\n\t\t[\n\t\t\t// Semantic color tokens\n\t\t\tcolorTokensCSS( computedColorRamps ),\n\t\t\t// Legacy overrides\n\t\t\tlegacyWpAdminThemeOverridesCSS( primary ),\n\t\t\tlegacyWpComponentsOverridesCSS,\n\t\t].flat()\n\t);\n}\n\nexport function useThemeProviderStyles( {\n\tcolor = {},\n}: {\n\tcolor?: ThemeProviderProps[ 'color' ];\n} = {} ) {\n\tconst { resolvedSettings: inheritedSettings } = useContext( ThemeContext );\n\n\t// Compute settings:\n\t// - used provided prop value;\n\t// - otherwise, use inherited value from parent instance;\n\t// - otherwise, use fallback value (where applicable).\n\tconst primary =\n\t\tcolor.primary ??\n\t\tinheritedSettings.color?.primary ??\n\t\tDEFAULT_SEED_COLORS.primary;\n\tconst bg =\n\t\tcolor.bg ?? inheritedSettings.color?.bg ?? DEFAULT_SEED_COLORS.bg;\n\n\tconst resolvedSettings = useMemo(\n\t\t() => ( {\n\t\t\tcolor: {\n\t\t\t\tprimary,\n\t\t\t\tbg,\n\t\t\t},\n\t\t} ),\n\t\t[ primary, bg ]\n\t);\n\n\tconst themeProviderStyles = useMemo( () => {\n\t\t// Determine which seeds are needed for generating ramps.\n\t\tconst seeds = {\n\t\t\t...DEFAULT_SEED_COLORS,\n\t\t\tbg,\n\t\t\tprimary,\n\t\t};\n\n\t\t// Generate ramps.\n\t\tconst computedColorRamps = new Map< string, RampResult >();\n\t\tconst bgRamp = getCachedBgRamp( seeds.bg );\n\t\tObject.entries( seeds ).forEach( ( [ rampName, seed ] ) => {\n\t\t\tif ( rampName === 'bg' ) {\n\t\t\t\tcomputedColorRamps.set( rampName, bgRamp );\n\t\t\t} else {\n\t\t\t\tcomputedColorRamps.set(\n\t\t\t\t\trampName,\n\t\t\t\t\tgetCachedAccentRamp( seed, bgRamp )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn generateStyles( {\n\t\t\tprimary: seeds.primary,\n\t\t\tcomputedColorRamps,\n\t\t} );\n\t}, [ primary, bg ] );\n\n\treturn {\n\t\tresolvedSettings,\n\t\tthemeProviderStyles,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAIA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AACP,OAAO,aAAa;AAKpB,SAAS,SAAS,kBAAkB;AAKpC,OAAO;AACP,SAAS,oBAAoB;AAC7B,OAAO,iBAAiB;AACxB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAEM;AAKP,IAAM,kBAAkB,QAAS,aAAa,EAAE,SAAS,GAAG,CAAE;AAC9D,IAAM,sBAAsB,QAAS,iBAAiB,EAAE,SAAS,GAAG,CAAE;AAEtE,IAAM,iCAA0C;AAAA,EAC/C,CAAE,gCAAgC,6BAA8B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K;AAAA,EACR;AACD;AAEO,SAAS,uBAAwB;AAAA,EACvC,QAAQ,CAAC;AACV,IAEI,CAAC,GAAI;AACR,QAAM,EAAE,kBAAkB,kBAAkB,IAAI,WAAY,YAAa;AAMzE,QAAM,UACL,MAAM,WACN,kBAAkB,OAAO,WACzB,oBAAoB;AACrB,QAAM,KACL,MAAM,MAAM,kBAAkB,OAAO,MAAM,oBAAoB;AAEhE,QAAM,mBAAmB;AAAA,IACxB,OAAQ;AAAA,MACP,OAAO;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,SAAS,EAAG;AAAA,EACf;AAEA,QAAM,sBAAsB,QAAS,MAAM;AAE1C,UAAM,QAAQ;AAAA,MACb,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACD;AAGA,UAAM,qBAAqB,oBAAI,IAA0B;AACzD,UAAM,SAAS,gBAAiB,MAAM,EAAG;AACzC,WAAO,QAAS,KAAM,EAAE,QAAS,CAAE,CAAE,UAAU,IAAK,MAAO;AAC1D,UAAK,aAAa,MAAO;AACxB,2BAAmB,IAAK,UAAU,MAAO;AAAA,MAC1C,OAAO;AACN,2BAAmB;AAAA,UAClB;AAAA,UACA,oBAAqB,MAAM,MAAO;AAAA,QACnC;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,eAAgB;AAAA,MACtB,SAAS,MAAM;AAAA,MACf;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,SAAS,EAAG,CAAE;AAEnB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ import './register-color-spaces';
|
|
|
5
5
|
import type { Ramp } from './types';
|
|
6
6
|
export declare const WHITE: import("colorjs.io/fn").PlainColorObject;
|
|
7
7
|
export declare const BLACK: import("colorjs.io/fn").PlainColorObject;
|
|
8
|
-
export declare const UNIVERSAL_CONTRAST_TOPUP = 0.
|
|
8
|
+
export declare const UNIVERSAL_CONTRAST_TOPUP = 0.012;
|
|
9
9
|
export declare const WHITE_TEXT_CONTRAST_MARGIN = 3.1;
|
|
10
10
|
export declare const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS: {
|
|
11
11
|
readonly lighter: {
|
|
@@ -17,7 +17,7 @@ export declare const ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS: {
|
|
|
17
17
|
readonly max: 0.98;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const CONTRAST_EPSILON = 0.004;
|
|
21
21
|
export declare const MAX_BISECTION_ITERATIONS = 10;
|
|
22
22
|
export declare const CONTRAST_COMBINATIONS: {
|
|
23
23
|
bgs: (keyof Ramp)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/constants.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,KAAK,0CAAuB,CAAC;AAC1C,eAAO,MAAM,KAAK,0CAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/constants.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,KAAK,0CAAuB,CAAC;AAC1C,eAAO,MAAM,KAAK,0CAAuB,CAAC;AAM1C,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAO9C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAO9C,eAAO,MAAM,sCAAsC;;;;;;;;;CAGzC,CAAC;AAGX,eAAO,MAAM,gBAAgB,QAAO,CAAC;AAErC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,qBAAqB,EAAE;IACnC,GAAG,EAAE,CAAE,MAAM,IAAI,CAAE,EAAE,CAAC;IACtB,GAAG,EAAE,CAAE,MAAM,IAAI,CAAE,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CACf,EA+BA,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC"}
|
|
@@ -18,22 +18,21 @@ import { type TaperChromaOptions } from './taper-chroma';
|
|
|
18
18
|
* @param target
|
|
19
19
|
* @param direction
|
|
20
20
|
* @param options
|
|
21
|
-
* @param options.strict
|
|
22
21
|
* @param options.lightnessConstraint
|
|
23
22
|
* @param options.lightnessConstraint.type
|
|
24
23
|
* @param options.lightnessConstraint.value
|
|
25
24
|
* @param options.taperChromaOptions
|
|
26
25
|
*/
|
|
27
|
-
export declare function findColorMeetingRequirements(reference: ColorTypes, seed: ColorTypes, target: number, direction: 'lighter' | 'darker', { lightnessConstraint, taperChromaOptions,
|
|
26
|
+
export declare function findColorMeetingRequirements(reference: ColorTypes, seed: ColorTypes, target: number, direction: 'lighter' | 'darker', { lightnessConstraint, taperChromaOptions, }?: {
|
|
28
27
|
lightnessConstraint?: {
|
|
29
28
|
type: 'force' | 'onlyIfSucceeds';
|
|
30
29
|
value: number;
|
|
31
30
|
};
|
|
32
31
|
taperChromaOptions?: TaperChromaOptions;
|
|
33
|
-
strict?: boolean;
|
|
34
32
|
}): {
|
|
35
33
|
color: ColorTypes;
|
|
36
34
|
reached: boolean;
|
|
37
35
|
achieved: number;
|
|
36
|
+
deficit?: number;
|
|
38
37
|
};
|
|
39
38
|
//# sourceMappingURL=find-color-with-constraints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-color-with-constraints.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/find-color-with-constraints.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,OAAO,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"find-color-with-constraints.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/find-color-with-constraints.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAIjC,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,gBAAgB,CAAC;AAatE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAC3C,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GAAG,QAAQ,EAC/B,EACC,mBAAmB,EACnB,kBAAkB,GAClB,GAAE;IACF,mBAAmB,CAAC,EAAE;QACrB,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACnC,GACJ;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAoG7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/index.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,OAAO,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/index.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAYjC,OAAO,KAAK,EAEX,IAAI,EACJ,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,SAAS,CAAC;AA+KjB,wBAAgB,SAAS,CACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,EAClB,EACC,aAAa,EACb,YAAY,EACZ,2BAAkC,GAClC,GAAE;IACF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE;QACd,QAAQ,EAAE,MAAM,IAAI,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACjC,GACJ,UAAU,CA0GZ"}
|
|
@@ -6,7 +6,7 @@ import { type ColorTypes } from 'colorjs.io/fn';
|
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
8
|
import './register-color-spaces';
|
|
9
|
-
import type { Ramp,
|
|
9
|
+
import type { Ramp, RampConfig, RampDirection } from './types';
|
|
10
10
|
/**
|
|
11
11
|
* Make sure that a color is valid in the p3 gamut, and converts it to oklch.
|
|
12
12
|
* @param c
|
|
@@ -16,7 +16,14 @@ export declare const clampToGamut: (c: ColorTypes) => import("colorjs.io/fn").Pl
|
|
|
16
16
|
* Topologically sort steps based on their dependencies
|
|
17
17
|
* @param config - The steps configuration object
|
|
18
18
|
*/
|
|
19
|
-
export declare function sortByDependency(config:
|
|
19
|
+
export declare function sortByDependency(config: RampConfig): (keyof Ramp)[];
|
|
20
|
+
/**
|
|
21
|
+
* Return minimal set of steps that are needed to calculate `stepName` from the seed.
|
|
22
|
+
* @param stepName Name of the step.
|
|
23
|
+
* @param config Configuration of the ramp.
|
|
24
|
+
* @return Array of steps that `stepName` depends on.
|
|
25
|
+
*/
|
|
26
|
+
export declare function stepsForStep(stepName: keyof Ramp, config: RampConfig): (keyof Ramp)[];
|
|
20
27
|
/**
|
|
21
28
|
* Finds out whether a lighter or a darker foreground color achieves a better
|
|
22
29
|
* contrast against the seed
|
|
@@ -39,4 +46,16 @@ export declare function adjustContrastTarget(target: number): number;
|
|
|
39
46
|
* @return The clamped lightness value
|
|
40
47
|
*/
|
|
41
48
|
export declare function clampAccentScaleReferenceLightness(rawLightness: number, direction: RampDirection): number;
|
|
49
|
+
/**
|
|
50
|
+
* Find the value of of `L` (luminance) that produces a `C` (color) that has a
|
|
51
|
+
* `value` (contrast delta) equal to zero.
|
|
52
|
+
* @param calculateC Calculate `C` from a given `L`.
|
|
53
|
+
* @param calculateValue Calculate value (delta) for a given `C`.
|
|
54
|
+
* @param initLowerL Initial lower value of `L`.
|
|
55
|
+
* @param initLowerValue Initial lower delta (negative).
|
|
56
|
+
* @param initUpperL Initial upper value of `L`.
|
|
57
|
+
* @param initUpperValue Initial upper delta (positive).
|
|
58
|
+
* @return Resulting value of type `C`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function solveWithBisect<C>(calculateC: (l: number) => C, calculateValue: (t: C) => number, initLowerL: number, initLowerValue: number, initUpperL: number, initUpperValue: number): C;
|
|
42
61
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAExE;;GAEG;AACH,OAAO,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAExE;;GAEG;AACH,OAAO,yBAAyB,CAAC;AAUjC,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG/D;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAK,GAAG,UAAU,6CACa,CAAC;AAwCzD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAE,MAAM,EAAE,UAAU,GAAI,CAAE,MAAM,IAAI,CAAE,EAAE,CAuCvE;AACD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,IAAI,EACpB,MAAM,EAAE,UAAU,GAChB,CAAE,MAAM,IAAI,CAAE,EAAE,CAqBlB;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC5C,IAAI,EAAE,UAAU,EAChB,aAAa,CAAC,EAAE,OAAO,GACrB;IACF,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,aAAa,CAAC;CACrB,CASA;AAED,wBAAgB,oBAAoB,CAAE,MAAM,EAAE,MAAM,UAOnD;AAED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CACjD,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,aAAa,UAIxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAE,CAAC,EACjC,UAAU,EAAE,CAAE,CAAC,EAAE,MAAM,KAAM,CAAC,EAC9B,cAAc,EAAE,CAAE,CAAC,EAAE,CAAC,KAAM,MAAM,EAClC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACpB,CAAC,CAqDH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AASvD,QAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/color-ramps/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AASvD,QAAA,MAAM,QAAQ,GAAK,OAAO;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,gCAEA,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAmBhC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,QAAQ,CA4H9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAE,OAAO,QAAQ,CAyFzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-tokens.d.ts","sourceRoot":"","sources":["../../../src/prebuilt/ts/color-tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;wBAiHE,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,CAAE;AA/G/B,wBA+GgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../src/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAavD;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,CAgBrC,CAAC;AACF,eAAe,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../src/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAavD;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,CAgBrC,CAAC;AACF,eAAe,IAAI,CAAC;AA2GpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,aAAa,CAInD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAE,OAAO,aAAa,CA+CtD,CAAC;AA6CF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAE,OAAO,aAAa,CAiDhE,CAAC;AA0EF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAE,OAAO,aAAa,CA6CzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../src/theme-provider.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAgClD,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../src/theme-provider.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAgClD,eAAO,MAAM,aAAa,GAAK,8BAI5B,kBAAkB,gCAmCpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a token ID by removing default states and visibility identifiers,
|
|
3
|
+
* making it human-readable as a publicly-accessible variable name.
|
|
4
|
+
*
|
|
5
|
+
* @param id The token ID to normalize.
|
|
6
|
+
* @return The normalized token ID.
|
|
7
|
+
*/
|
|
8
|
+
export declare const publicTokenId: (id: string) => string;
|
|
9
|
+
//# sourceMappingURL=token-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-id.d.ts","sourceRoot":"","sources":["../src/token-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAK,IAAI,MAAM,WACkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme-provider-styles.d.ts","sourceRoot":"","sources":["../src/use-theme-provider-styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAiB3C;;GAEG;AACH,OAAO,yCAAyC,CAAC;AASjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"use-theme-provider-styles.d.ts","sourceRoot":"","sources":["../src/use-theme-provider-styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAiB3C;;GAEG;AACH,OAAO,yCAAyC,CAAC;AASjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAiKlD,wBAAgB,sBAAsB,CAAE,EACvC,KAAU,GACV,GAAE;IACF,KAAK,CAAC,EAAE,kBAAkB,CAAE,OAAO,CAAE,CAAC;CACjC;;;;;;;;EAwDL"}
|