@atlaskit/tokens 13.1.0 → 13.1.1
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/CHANGELOG.md +8 -0
- package/codemods/css-to-design-tokens/lib/colors.tsx +3 -8
- package/codemods/css-to-design-tokens/lib/declaration.tsx +3 -13
- package/codemods/css-to-design-tokens/lib/extract-between-parentheses.tsx +4 -0
- package/codemods/css-to-design-tokens/lib/extract-less-var-name.tsx +3 -0
- package/codemods/css-to-design-tokens/lib/get-css-var-meta.tsx +13 -0
- package/codemods/css-to-design-tokens/lib/get-named-color-meta.tsx +5 -0
- package/codemods/css-to-design-tokens/lib/get-raw-color-meta.tsx +11 -0
- package/codemods/css-to-design-tokens/lib/is-css-declaration.tsx +3 -0
- package/codemods/css-to-design-tokens/lib/is-known-css-variable.tsx +5 -0
- package/codemods/css-to-design-tokens/lib/known-named-colors.tsx +150 -0
- package/codemods/css-to-design-tokens/lib/known-raw-colors.tsx +17 -0
- package/codemods/css-to-design-tokens/lib/known-variables.tsx +167 -0
- package/codemods/css-to-design-tokens/lib/legacy-colors.tsx +3 -335
- package/codemods/css-to-design-tokens/lib/meta.tsx +3 -28
- package/codemods/css-to-design-tokens/lib/split-css-value.tsx +4 -0
- package/codemods/css-to-design-tokens/lib/value.tsx +6 -9
- package/codemods/css-to-design-tokens/transform.tsx +3 -1
- package/dist/cjs/artifacts/palettes-raw/palette.js +35 -1
- package/dist/cjs/entry-points/theme-state-transformer.js +4 -3
- package/dist/cjs/get-custom-theme-styles.js +7 -6
- package/dist/cjs/get-global-theme.js +2 -2
- package/dist/cjs/get-theme-html-attrs.js +2 -2
- package/dist/cjs/index.js +4 -3
- package/dist/cjs/is-color-mode.js +9 -0
- package/dist/cjs/is-theme-ids.js +12 -0
- package/dist/cjs/is-theme-kind.js +12 -0
- package/dist/cjs/theme-config.js +8 -44
- package/dist/cjs/theme-object-to-string.js +42 -0
- package/dist/cjs/theme-options-schema.js +1 -0
- package/dist/cjs/theme-state-defaults.js +39 -0
- package/dist/cjs/theme-state.js +5 -0
- package/dist/cjs/theme-string-to-object.js +51 -0
- package/dist/cjs/utils/additional-contrast-checker.js +43 -0
- package/dist/cjs/utils/custom-theme-loading-utils.js +0 -22
- package/dist/cjs/utils/custom-theme-token-contrast-check.js +2 -40
- package/dist/cjs/utils/delta-e.js +26 -0
- package/dist/cjs/utils/generate-colors.js +47 -0
- package/dist/cjs/utils/generate-token-map-with-contrast-check.js +32 -0
- package/dist/cjs/utils/{generate-custom-color-ramp.js → generate-token-map.js} +6 -75
- package/dist/cjs/utils/get-closest-color-index.js +3 -2
- package/dist/cjs/utils/get-contrast-ratio.js +22 -0
- package/dist/cjs/utils/hct-color-utils/alpha-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-linrgb.js +17 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-lstar.js +21 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-rgba.js +24 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-xyz.js +29 -0
- package/dist/cjs/utils/hct-color-utils/blue-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/clamp-component.js +15 -0
- package/dist/cjs/utils/hct-color-utils/contrast.js +10 -11
- package/dist/cjs/utils/hct-color-utils/green-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/hct.js +18 -12
- package/dist/cjs/utils/hct-color-utils/index.js +4 -3
- package/dist/cjs/utils/hct-color-utils/lab-f.js +15 -0
- package/dist/cjs/utils/hct-color-utils/lab-invf.js +16 -0
- package/dist/cjs/utils/hct-color-utils/lstar-from-argb.js +34 -0
- package/dist/cjs/utils/hct-color-utils/lstar-from-y.js +21 -0
- package/dist/cjs/utils/hct-color-utils/red-from-argb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/rgba-from-argb.js +28 -0
- package/dist/cjs/utils/hct-color-utils/rgba.js +1 -0
- package/dist/cjs/utils/hct-color-utils/viewing-conditions.js +5 -4
- package/dist/cjs/utils/hct-color-utils/white-point-d65.js +14 -0
- package/dist/cjs/utils/hct-color-utils/y-from-lstar.js +21 -0
- package/dist/cjs/utils/hex-to-hsl.js +52 -0
- package/dist/cjs/utils/hex-to-rgb-a.js +20 -0
- package/dist/cjs/utils/hex-to-rgb.js +19 -0
- package/dist/cjs/utils/is-valid-hex.js +10 -0
- package/dist/cjs/utils/reduce-token-map.js +18 -0
- package/dist/cjs/utils/rgb-to-lab.js +24 -0
- package/dist/es2019/artifacts/palettes-raw/palette.js +35 -1
- package/dist/es2019/entry-points/theme-state-transformer.js +2 -1
- package/dist/es2019/get-custom-theme-styles.js +3 -2
- package/dist/es2019/get-global-theme.js +1 -1
- package/dist/es2019/get-theme-html-attrs.js +1 -1
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/is-color-mode.js +3 -0
- package/dist/es2019/is-theme-ids.js +4 -0
- package/dist/es2019/is-theme-kind.js +4 -0
- package/dist/es2019/theme-config.js +4 -45
- package/dist/es2019/theme-object-to-string.js +28 -0
- package/dist/es2019/theme-options-schema.js +0 -0
- package/dist/es2019/theme-state-defaults.js +34 -0
- package/dist/es2019/theme-state.js +1 -0
- package/dist/es2019/theme-string-to-object.js +38 -0
- package/dist/es2019/utils/additional-contrast-checker.js +39 -0
- package/dist/es2019/utils/custom-theme-loading-utils.js +1 -11
- package/dist/es2019/utils/custom-theme-token-contrast-check.js +1 -41
- package/dist/es2019/utils/delta-e.js +20 -0
- package/dist/es2019/utils/generate-colors.js +39 -0
- package/dist/es2019/utils/generate-token-map-with-contrast-check.js +21 -0
- package/dist/es2019/utils/{generate-custom-color-ramp.js → generate-token-map.js} +3 -63
- package/dist/es2019/utils/get-closest-color-index.js +2 -1
- package/dist/es2019/utils/get-contrast-ratio.js +16 -0
- package/dist/es2019/utils/hct-color-utils/alpha-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-linrgb.js +12 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-lstar.js +16 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-rgba.js +19 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-xyz.js +24 -0
- package/dist/es2019/utils/hct-color-utils/blue-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/clamp-component.js +9 -0
- package/dist/es2019/utils/hct-color-utils/contrast.js +10 -10
- package/dist/es2019/utils/hct-color-utils/green-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/hct.js +19 -12
- package/dist/es2019/utils/hct-color-utils/index.js +2 -1
- package/dist/es2019/utils/hct-color-utils/lab-f.js +9 -0
- package/dist/es2019/utils/hct-color-utils/lab-invf.js +10 -0
- package/dist/es2019/utils/hct-color-utils/lstar-from-argb.js +28 -0
- package/dist/es2019/utils/hct-color-utils/lstar-from-y.js +16 -0
- package/dist/es2019/utils/hct-color-utils/red-from-argb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/rgba-from-argb.js +22 -0
- package/dist/es2019/utils/hct-color-utils/rgba.js +0 -0
- package/dist/es2019/utils/hct-color-utils/viewing-conditions.js +4 -3
- package/dist/es2019/utils/hct-color-utils/white-point-d65.js +8 -0
- package/dist/es2019/utils/hct-color-utils/y-from-lstar.js +16 -0
- package/dist/es2019/utils/hex-to-hsl.js +46 -0
- package/dist/es2019/utils/hex-to-rgb-a.js +14 -0
- package/dist/es2019/utils/hex-to-rgb.js +13 -0
- package/dist/es2019/utils/is-valid-hex.js +2 -0
- package/dist/es2019/utils/reduce-token-map.js +7 -0
- package/dist/es2019/utils/rgb-to-lab.js +18 -0
- package/dist/esm/artifacts/palettes-raw/palette.js +35 -1
- package/dist/esm/entry-points/theme-state-transformer.js +2 -1
- package/dist/esm/get-custom-theme-styles.js +3 -2
- package/dist/esm/get-global-theme.js +1 -1
- package/dist/esm/get-theme-html-attrs.js +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/is-color-mode.js +3 -0
- package/dist/esm/is-theme-ids.js +6 -0
- package/dist/esm/is-theme-kind.js +6 -0
- package/dist/esm/theme-config.js +4 -45
- package/dist/esm/theme-object-to-string.js +35 -0
- package/dist/esm/theme-options-schema.js +0 -0
- package/dist/esm/theme-state-defaults.js +34 -0
- package/dist/esm/theme-state.js +1 -0
- package/dist/esm/theme-string-to-object.js +44 -0
- package/dist/esm/utils/additional-contrast-checker.js +36 -0
- package/dist/esm/utils/custom-theme-loading-utils.js +1 -15
- package/dist/esm/utils/custom-theme-token-contrast-check.js +1 -38
- package/dist/esm/utils/delta-e.js +20 -0
- package/dist/esm/utils/generate-colors.js +40 -0
- package/dist/esm/utils/generate-token-map-with-contrast-check.js +25 -0
- package/dist/esm/utils/{generate-custom-color-ramp.js → generate-token-map.js} +3 -67
- package/dist/esm/utils/get-closest-color-index.js +2 -1
- package/dist/esm/utils/get-contrast-ratio.js +16 -0
- package/dist/esm/utils/hct-color-utils/alpha-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/argb-from-linrgb.js +12 -0
- package/dist/esm/utils/hct-color-utils/argb-from-lstar.js +16 -0
- package/dist/esm/utils/hct-color-utils/argb-from-rgba.js +18 -0
- package/dist/esm/utils/hct-color-utils/argb-from-xyz.js +24 -0
- package/dist/esm/utils/hct-color-utils/blue-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/clamp-component.js +9 -0
- package/dist/esm/utils/hct-color-utils/contrast.js +10 -10
- package/dist/esm/utils/hct-color-utils/green-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/hct.js +19 -12
- package/dist/esm/utils/hct-color-utils/index.js +2 -1
- package/dist/esm/utils/hct-color-utils/lab-f.js +9 -0
- package/dist/esm/utils/hct-color-utils/lab-invf.js +10 -0
- package/dist/esm/utils/hct-color-utils/lstar-from-argb.js +28 -0
- package/dist/esm/utils/hct-color-utils/lstar-from-y.js +16 -0
- package/dist/esm/utils/hct-color-utils/red-from-argb.js +6 -0
- package/dist/esm/utils/hct-color-utils/rgba-from-argb.js +22 -0
- package/dist/esm/utils/hct-color-utils/rgba.js +0 -0
- package/dist/esm/utils/hct-color-utils/viewing-conditions.js +5 -4
- package/dist/esm/utils/hct-color-utils/white-point-d65.js +8 -0
- package/dist/esm/utils/hct-color-utils/y-from-lstar.js +16 -0
- package/dist/esm/utils/hex-to-hsl.js +46 -0
- package/dist/esm/utils/hex-to-rgb-a.js +14 -0
- package/dist/esm/utils/hex-to-rgb.js +13 -0
- package/dist/esm/utils/is-valid-hex.js +4 -0
- package/dist/esm/utils/reduce-token-map.js +11 -0
- package/dist/esm/utils/rgb-to-lab.js +18 -0
- package/dist/types/artifacts/palettes-raw/palette.d.ts +1 -1
- package/dist/types/entry-points/theme-state-transformer.d.ts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/is-color-mode.d.ts +2 -0
- package/dist/types/is-theme-ids.d.ts +2 -0
- package/dist/types/is-theme-kind.d.ts +4 -0
- package/dist/types/theme-color-modes.d.ts +1 -0
- package/dist/types/theme-config.d.ts +8 -40
- package/dist/types/theme-ids.d.ts +1 -0
- package/dist/types/theme-object-to-string.d.ts +13 -0
- package/dist/types/theme-options-schema.d.ts +7 -0
- package/dist/types/theme-state-defaults.d.ts +14 -0
- package/dist/types/theme-state.d.ts +17 -0
- package/dist/types/{theme-state-transformer.d.ts → theme-string-to-object.d.ts} +0 -12
- package/dist/types/utils/additional-contrast-checker.d.ts +9 -0
- package/dist/types/utils/custom-theme-loading-utils.d.ts +1 -6
- package/dist/types/utils/custom-theme-token-contrast-check.d.ts +0 -9
- package/dist/types/utils/delta-e.d.ts +1 -0
- package/dist/types/utils/generate-colors.d.ts +5 -0
- package/dist/types/utils/{generate-custom-color-ramp.d.ts → generate-token-map-with-contrast-check.d.ts} +1 -6
- package/dist/types/utils/generate-token-map.d.ts +9 -0
- package/dist/types/utils/get-contrast-ratio.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/alpha-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/argb-from-linrgb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/argb-from-lstar.d.ts +8 -0
- package/dist/types/utils/hct-color-utils/argb-from-rgba.d.ts +8 -0
- package/dist/types/utils/hct-color-utils/argb-from-xyz.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/blue-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/clamp-component.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/green-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/index.d.ts +2 -1
- package/dist/types/utils/hct-color-utils/lab-f.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/lab-invf.d.ts +1 -0
- package/dist/types/utils/hct-color-utils/lstar-from-argb.d.ts +7 -0
- package/dist/types/utils/hct-color-utils/lstar-from-y.d.ts +12 -0
- package/dist/types/utils/hct-color-utils/red-from-argb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/rgba-from-argb.d.ts +8 -0
- package/dist/types/utils/hct-color-utils/rgba.d.ts +14 -0
- package/dist/types/utils/hct-color-utils/white-point-d65.d.ts +6 -0
- package/dist/types/utils/hct-color-utils/y-from-lstar.d.ts +12 -0
- package/dist/types/utils/hex-to-hsl.d.ts +1 -0
- package/dist/types/utils/hex-to-rgb-a.d.ts +1 -0
- package/dist/types/utils/hex-to-rgb.d.ts +1 -0
- package/dist/types/utils/is-valid-hex.d.ts +1 -0
- package/dist/types/utils/reduce-token-map.d.ts +6 -0
- package/dist/types/utils/rgb-to-lab.d.ts +1 -0
- package/dist/types-ts4.5/artifacts/palettes-raw/palette.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/theme-state-transformer.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/is-color-mode.d.ts +2 -0
- package/dist/types-ts4.5/is-theme-ids.d.ts +2 -0
- package/dist/types-ts4.5/is-theme-kind.d.ts +11 -0
- package/dist/types-ts4.5/theme-color-modes.d.ts +1 -0
- package/dist/types-ts4.5/theme-config.d.ts +8 -40
- package/dist/types-ts4.5/theme-ids.d.ts +1 -0
- package/dist/types-ts4.5/theme-object-to-string.d.ts +13 -0
- package/dist/types-ts4.5/theme-options-schema.d.ts +7 -0
- package/dist/types-ts4.5/theme-state-defaults.d.ts +14 -0
- package/dist/types-ts4.5/theme-state.d.ts +17 -0
- package/dist/types-ts4.5/{theme-state-transformer.d.ts → theme-string-to-object.d.ts} +0 -12
- package/dist/types-ts4.5/utils/additional-contrast-checker.d.ts +9 -0
- package/dist/types-ts4.5/utils/custom-theme-loading-utils.d.ts +1 -6
- package/dist/types-ts4.5/utils/custom-theme-token-contrast-check.d.ts +0 -9
- package/dist/types-ts4.5/utils/delta-e.d.ts +1 -0
- package/dist/types-ts4.5/utils/generate-colors.d.ts +5 -0
- package/dist/types-ts4.5/utils/{generate-custom-color-ramp.d.ts → generate-token-map-with-contrast-check.d.ts} +1 -8
- package/dist/types-ts4.5/utils/generate-token-map.d.ts +11 -0
- package/dist/types-ts4.5/utils/get-contrast-ratio.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/alpha-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-linrgb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-lstar.d.ts +8 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-rgba.d.ts +8 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-xyz.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/blue-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/clamp-component.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/green-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/index.d.ts +2 -1
- package/dist/types-ts4.5/utils/hct-color-utils/lab-f.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/lab-invf.d.ts +1 -0
- package/dist/types-ts4.5/utils/hct-color-utils/lstar-from-argb.d.ts +7 -0
- package/dist/types-ts4.5/utils/hct-color-utils/lstar-from-y.d.ts +12 -0
- package/dist/types-ts4.5/utils/hct-color-utils/red-from-argb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/rgba-from-argb.d.ts +8 -0
- package/dist/types-ts4.5/utils/hct-color-utils/rgba.d.ts +14 -0
- package/dist/types-ts4.5/utils/hct-color-utils/white-point-d65.d.ts +6 -0
- package/dist/types-ts4.5/utils/hct-color-utils/y-from-lstar.d.ts +12 -0
- package/dist/types-ts4.5/utils/hex-to-hsl.d.ts +5 -0
- package/dist/types-ts4.5/utils/hex-to-rgb-a.d.ts +6 -0
- package/dist/types-ts4.5/utils/hex-to-rgb.d.ts +5 -0
- package/dist/types-ts4.5/utils/is-valid-hex.d.ts +1 -0
- package/dist/types-ts4.5/utils/reduce-token-map.d.ts +6 -0
- package/dist/types-ts4.5/utils/rgb-to-lab.d.ts +5 -0
- package/package.json +5 -5
- package/dist/cjs/theme-state-transformer.js +0 -93
- package/dist/cjs/utils/color-utils.js +0 -176
- package/dist/cjs/utils/hct-color-utils/color-utils.js +0 -279
- package/dist/es2019/theme-state-transformer.js +0 -70
- package/dist/es2019/utils/color-utils.js +0 -136
- package/dist/es2019/utils/hct-color-utils/color-utils.js +0 -249
- package/dist/esm/theme-state-transformer.js +0 -86
- package/dist/esm/utils/color-utils.js +0 -138
- package/dist/esm/utils/hct-color-utils/color-utils.js +0 -248
- package/dist/types/utils/color-utils.d.ts +0 -10
- package/dist/types/utils/hct-color-utils/color-utils.d.ts +0 -88
- package/dist/types-ts4.5/utils/color-utils.d.ts +0 -23
- package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +0 -88
|
@@ -1,336 +1,4 @@
|
|
|
1
|
-
export const knownVariables: Record<string, string[]> = {
|
|
2
|
-
'--adg3-color-R50': ['danger'],
|
|
3
|
-
'--adg3-color-R75': ['danger'],
|
|
4
|
-
'--adg3-color-R100': ['danger'],
|
|
5
|
-
'--adg3-color-R200': ['danger'],
|
|
6
|
-
'--adg3-color-R300': ['danger'],
|
|
7
|
-
'--adg3-color-R400': ['danger'],
|
|
8
|
-
'--adg3-color-R500': ['danger'],
|
|
9
|
-
'--adg3-color-Y50': ['warning'],
|
|
10
|
-
'--adg3-color-Y75': ['warning'],
|
|
11
|
-
'--adg3-color-Y100': ['warning'],
|
|
12
|
-
'--adg3-color-Y200': ['warning'],
|
|
13
|
-
'--adg3-color-Y300': ['warning'],
|
|
14
|
-
'--adg3-color-Y400': ['warning'],
|
|
15
|
-
'--adg3-color-Y500': ['warning'],
|
|
16
|
-
'--adg3-color-G50': ['success'],
|
|
17
|
-
'--adg3-color-G75': ['success'],
|
|
18
|
-
'--adg3-color-G100': ['success'],
|
|
19
|
-
'--adg3-color-G200': ['success'],
|
|
20
|
-
'--adg3-color-G300': ['success'],
|
|
21
|
-
'--adg3-color-G400': ['success'],
|
|
22
|
-
'--adg3-color-G500': ['success'],
|
|
23
|
-
'--adg3-color-B50': ['brand'],
|
|
24
|
-
'--adg3-color-B75': ['brand'],
|
|
25
|
-
'--adg3-color-B100': ['brand'],
|
|
26
|
-
'--adg3-color-B200': ['brand'],
|
|
27
|
-
'--adg3-color-B300': ['brand'],
|
|
28
|
-
'--adg3-color-B400': ['brand'],
|
|
29
|
-
'--adg3-color-B500': ['brand'],
|
|
30
|
-
'--adg3-color-P50': ['discovery'],
|
|
31
|
-
'--adg3-color-P75': ['discovery'],
|
|
32
|
-
'--adg3-color-P100': ['discovery'],
|
|
33
|
-
'--adg3-color-P200': ['discovery'],
|
|
34
|
-
'--adg3-color-P300': ['discovery'],
|
|
35
|
-
'--adg3-color-P400': ['discovery'],
|
|
36
|
-
'--adg3-color-P500': ['discovery'],
|
|
37
|
-
'--adg3-color-T50': ['accent', 'teal'],
|
|
38
|
-
'--adg3-color-T75': ['accent', 'teal'],
|
|
39
|
-
'--adg3-color-T100': ['accent', 'teal'],
|
|
40
|
-
'--adg3-color-T200': ['accent', 'teal'],
|
|
41
|
-
'--adg3-color-T300': ['accent', 'teal'],
|
|
42
|
-
'--adg3-color-T400': ['accent', 'teal'],
|
|
43
|
-
'--adg3-color-T500': ['accent', 'teal'],
|
|
44
|
-
'--adg3-color-N0': ['inverse'],
|
|
45
|
-
'--adg3-color-N10': [],
|
|
46
|
-
'--adg3-color-N20': [],
|
|
47
|
-
'--adg3-color-N30': [],
|
|
48
|
-
'--adg3-color-N40': [],
|
|
49
|
-
'--adg3-color-N50': [],
|
|
50
|
-
'--adg3-color-N60': [],
|
|
51
|
-
'--adg3-color-N70': [],
|
|
52
|
-
'--adg3-color-N80': [],
|
|
53
|
-
'--adg3-color-N90': [],
|
|
54
|
-
'--adg3-color-N100': [],
|
|
55
|
-
'--adg3-color-N200': ['text', 'subtlest'],
|
|
56
|
-
'--adg3-color-N300': [],
|
|
57
|
-
'--adg3-color-N400': ['text', 'subtle'],
|
|
58
|
-
'--adg3-color-N500': [],
|
|
59
|
-
'--adg3-color-N600': [],
|
|
60
|
-
'--adg3-color-N700': ['text'],
|
|
61
|
-
'--adg3-color-N800': ['text'],
|
|
62
|
-
'--adg3-color-N900': ['text'],
|
|
63
|
-
'--adg3-color-N10A': [],
|
|
64
|
-
'--adg3-color-N20A': [],
|
|
65
|
-
'--adg3-color-N30A': [],
|
|
66
|
-
'--adg3-color-N40A': [],
|
|
67
|
-
'--adg3-color-N50A': [],
|
|
68
|
-
'--adg3-color-N60A': [],
|
|
69
|
-
'--adg3-color-N70A': [],
|
|
70
|
-
'--adg3-color-N80A': [],
|
|
71
|
-
'--adg3-color-N90A': [],
|
|
72
|
-
'--adg3-color-N100A': [],
|
|
73
|
-
'--adg3-color-N200A': [],
|
|
74
|
-
'--adg3-color-N300A': [],
|
|
75
|
-
'--adg3-color-N400A': [],
|
|
76
|
-
'--adg3-color-N500A': [],
|
|
77
|
-
'--adg3-color-N600A': [],
|
|
78
|
-
'--adg3-color-N700A': [],
|
|
79
|
-
'--adg3-color-N800A': [],
|
|
80
|
-
'--adg3-color-DN900': [],
|
|
81
|
-
'--adg3-color-DN800': [],
|
|
82
|
-
'--adg3-color-DN700': [],
|
|
83
|
-
'--adg3-color-DN600': [],
|
|
84
|
-
'--adg3-color-DN500': [],
|
|
85
|
-
'--adg3-color-DN400': [],
|
|
86
|
-
'--adg3-color-DN300': [],
|
|
87
|
-
'--adg3-color-DN200': [],
|
|
88
|
-
'--adg3-color-DN100': [],
|
|
89
|
-
'--adg3-color-DN90': [],
|
|
90
|
-
'--adg3-color-DN80': [],
|
|
91
|
-
'--adg3-color-DN70': [],
|
|
92
|
-
'--adg3-color-DN60': [],
|
|
93
|
-
'--adg3-color-DN50': [],
|
|
94
|
-
'--adg3-color-DN40': [],
|
|
95
|
-
'--adg3-color-DN30': [],
|
|
96
|
-
'--adg3-color-DN20': [],
|
|
97
|
-
'--adg3-color-DN10': [],
|
|
98
|
-
'--adg3-color-DN0': [],
|
|
99
|
-
'--adg3-color-DN800A': [],
|
|
100
|
-
'--adg3-color-DN700A': [],
|
|
101
|
-
'--adg3-color-DN600A': [],
|
|
102
|
-
'--adg3-color-DN500A': [],
|
|
103
|
-
'--adg3-color-DN400A': [],
|
|
104
|
-
'--adg3-color-DN300A': [],
|
|
105
|
-
'--adg3-color-DN200A': [],
|
|
106
|
-
'--adg3-color-DN100A': [],
|
|
107
|
-
'--adg3-color-DN90A': [],
|
|
108
|
-
'--adg3-color-DN80A': [],
|
|
109
|
-
'--adg3-color-DN70A': [],
|
|
110
|
-
'--adg3-color-DN60A': [],
|
|
111
|
-
'--adg3-color-DN50A': [],
|
|
112
|
-
'--adg3-color-DN40A': [],
|
|
113
|
-
'--adg3-color-DN30A': [],
|
|
114
|
-
'--adg3-color-DN20A': [],
|
|
115
|
-
'--adg3-color-DN10A': [],
|
|
116
1
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
'--adg3-color-text-dark': ['text'],
|
|
121
|
-
'--adg3-color-subtleText-light': ['text', 'subtle'],
|
|
122
|
-
'--adg3-color-subtleText-dark': ['text', 'subtle'],
|
|
123
|
-
'--adg3-color-placeholderText-light': ['text', 'subtlest'],
|
|
124
|
-
'--adg3-color-placeholderText-dark': ['text', 'subtlest'],
|
|
125
|
-
'--adg3-color-heading-light': ['text'],
|
|
126
|
-
'--adg3-color-heading-dark': ['text'],
|
|
127
|
-
'--adg3-color-subtleHeading-light': ['text', 'subtle'],
|
|
128
|
-
'--adg3-color-subtleHeading-dark': ['text', 'subtle'],
|
|
129
|
-
'--adg3-color-codeBlock-light': ['elevation', 'surface', 'sunken'],
|
|
130
|
-
'--adg3-color-codeBlock-dark': ['elevation', 'surface', 'sunken'],
|
|
131
|
-
'--adg3-color-link-light': ['link'],
|
|
132
|
-
'--adg3-color-link-dark': ['link'],
|
|
133
|
-
'--adg3-color-linkHover-light': ['link'],
|
|
134
|
-
'--adg3-color-linkHover-dark': ['link'],
|
|
135
|
-
'--adg3-color-linkActive-light': ['link', 'pressed'],
|
|
136
|
-
'--adg3-color-linkActive-dark': ['link', 'pressed'],
|
|
137
|
-
'--adg3-color-linkOutline-light': ['link', 'focused'],
|
|
138
|
-
'--adg3-color-linkOutline-dark': ['link', 'focused'],
|
|
139
|
-
'--adg3-color-primary-light': ['brand'],
|
|
140
|
-
'--adg3-color-primary-dark': ['brand'],
|
|
141
|
-
'--adg3-color-blue-light': ['accent', 'subtler', 'blue'],
|
|
142
|
-
'--adg3-color-blue-dark': ['accent', 'bolder', 'blue'],
|
|
143
|
-
'--adg3-color-teal-light': ['accent', 'subtler', 'teal'],
|
|
144
|
-
'--adg3-color-teal-dark': ['accent', 'bolder', 'teal'],
|
|
145
|
-
'--adg3-color-purple-light': ['accent', 'subtler', 'purple'],
|
|
146
|
-
'--adg3-color-purple-dark': ['accent', 'bolder', 'purple'],
|
|
147
|
-
'--adg3-color-red-light': ['accent', 'subtler', 'red'],
|
|
148
|
-
'--adg3-color-red-dark': ['accent', 'bolder', 'red'],
|
|
149
|
-
'--adg3-color-yellow-light': ['accent', 'subtler', 'yellow'],
|
|
150
|
-
'--adg3-color-yellow-dark': ['accent', 'bolder', 'yellow'],
|
|
151
|
-
'--adg3-color-green-light': ['accent', 'subtler', 'green'],
|
|
152
|
-
'--adg3-color-green-dark': ['accent', 'bolder', 'green'],
|
|
153
|
-
'--adg3-color-N20-transparent': [],
|
|
154
|
-
|
|
155
|
-
/* Alias variables */
|
|
156
|
-
'--jpo-theme-color': ['brand'],
|
|
157
|
-
'--jpo-text-default-color': ['text'],
|
|
158
|
-
'--jpo-text-secondary-color': ['text', 'subtle'],
|
|
159
|
-
'--jpo-text-muted-color': ['text', 'disabled'],
|
|
160
|
-
'--jpo-text-error-color': ['text', 'danger'],
|
|
161
|
-
'--jpo-bg-default-color': ['elevation', 'surface'],
|
|
162
|
-
'--jpo-bg-reverse-color': ['background', 'inverse'],
|
|
163
|
-
'--jpo-bg-warning-color': ['background', 'warning', 'subtle'],
|
|
164
|
-
'--jpo-bg-dark-color': ['background', 'netural', 'bold'],
|
|
165
|
-
'--jpo-border-default-color': ['border'],
|
|
166
|
-
'--jpo-border-secondary-color': ['border', 'subtle'],
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export const knownNamedColors: Record<string, string[]> = {
|
|
170
|
-
aliceblue: ['blue'],
|
|
171
|
-
antiquewhite: [],
|
|
172
|
-
aqua: ['teal'],
|
|
173
|
-
aquamarine: ['teal'],
|
|
174
|
-
azure: ['teal', 'subtlest'],
|
|
175
|
-
beige: [],
|
|
176
|
-
bisque: [],
|
|
177
|
-
black: [],
|
|
178
|
-
blanchedalmond: [],
|
|
179
|
-
blue: ['blue'],
|
|
180
|
-
blueviolet: ['blue'],
|
|
181
|
-
brown: [],
|
|
182
|
-
burlywood: [],
|
|
183
|
-
cadetblue: ['blue'],
|
|
184
|
-
chartreuse: [],
|
|
185
|
-
chocolate: [],
|
|
186
|
-
coral: [],
|
|
187
|
-
cornflowerblue: ['blue'],
|
|
188
|
-
cornsilk: [],
|
|
189
|
-
crimson: ['red'],
|
|
190
|
-
cyan: ['accent', 'teal', 'subtle'],
|
|
191
|
-
darkblue: ['accent', 'blue', 'bold'],
|
|
192
|
-
darkcyan: ['accent', 'teal', 'bold'],
|
|
193
|
-
darkgoldenrod: [],
|
|
194
|
-
darkgray: [],
|
|
195
|
-
darkgrey: [],
|
|
196
|
-
darkgreen: ['green'],
|
|
197
|
-
darkkhaki: [],
|
|
198
|
-
darkmagenta: ['magenta', 'bold'],
|
|
199
|
-
darkolivegreen: ['green'],
|
|
200
|
-
darkorange: [],
|
|
201
|
-
darkorchid: [],
|
|
202
|
-
darkred: ['accent', 'red', 'bold'],
|
|
203
|
-
darksalmon: [],
|
|
204
|
-
darkseagreen: ['green'],
|
|
205
|
-
darkslateblue: [],
|
|
206
|
-
darkslategray: [],
|
|
207
|
-
darkslategrey: [],
|
|
208
|
-
darkturquoise: ['teal', 'bold'],
|
|
209
|
-
darkviolet: ['purple', 'bold'],
|
|
210
|
-
deeppink: ['magenta'],
|
|
211
|
-
deepskyblue: ['blue'],
|
|
212
|
-
dimgray: [],
|
|
213
|
-
dimgrey: [],
|
|
214
|
-
dodgerblue: [],
|
|
215
|
-
firebrick: ['red', 'bold'],
|
|
216
|
-
floralwhite: [],
|
|
217
|
-
forestgreen: ['green'],
|
|
218
|
-
fuchsia: ['magenta', 'subtle'],
|
|
219
|
-
gainsboro: [],
|
|
220
|
-
ghostwhite: [],
|
|
221
|
-
gold: ['yellow'],
|
|
222
|
-
goldenrod: [],
|
|
223
|
-
gray: [],
|
|
224
|
-
grey: [],
|
|
225
|
-
green: ['green'],
|
|
226
|
-
greenyellow: [],
|
|
227
|
-
honeydew: [],
|
|
228
|
-
hotpink: ['magenta'],
|
|
229
|
-
indianred: [],
|
|
230
|
-
indigo: ['purple'],
|
|
231
|
-
ivory: [],
|
|
232
|
-
khaki: [],
|
|
233
|
-
lavender: ['purple'],
|
|
234
|
-
lavenderblush: ['purple'],
|
|
235
|
-
lawngreen: ['green'],
|
|
236
|
-
lemonchiffon: [],
|
|
237
|
-
lightblue: [],
|
|
238
|
-
lightcoral: [],
|
|
239
|
-
lightcyan: [],
|
|
240
|
-
lightgoldenrodyellow: [],
|
|
241
|
-
lightgray: [],
|
|
242
|
-
lightgrey: [],
|
|
243
|
-
lightgreen: ['green', 'accent'],
|
|
244
|
-
lightpink: ['magenta'],
|
|
245
|
-
lightsalmon: ['pink', 'subtler'],
|
|
246
|
-
lightseagreen: ['green'],
|
|
247
|
-
lightskyblue: ['blue', 'accent'],
|
|
248
|
-
lightslategray: [],
|
|
249
|
-
lightslategrey: [],
|
|
250
|
-
lightsteelblue: ['blue'],
|
|
251
|
-
lightyellow: [],
|
|
252
|
-
lime: ['green', 'subtler'],
|
|
253
|
-
limegreen: ['green'],
|
|
254
|
-
linen: [],
|
|
255
|
-
magenta: ['magenta'],
|
|
256
|
-
maroon: [],
|
|
257
|
-
mediumaquamarine: [],
|
|
258
|
-
mediumblue: [],
|
|
259
|
-
mediumorchid: [],
|
|
260
|
-
mediumpurple: [],
|
|
261
|
-
mediumseagreen: ['green'],
|
|
262
|
-
mediumslateblue: [],
|
|
263
|
-
mediumspringgreen: ['green'],
|
|
264
|
-
mediumturquoise: [],
|
|
265
|
-
mediumvioletred: [],
|
|
266
|
-
midnightblue: [],
|
|
267
|
-
mintcream: [],
|
|
268
|
-
mistyrose: [],
|
|
269
|
-
moccasin: [],
|
|
270
|
-
navajowhite: [],
|
|
271
|
-
navy: ['blue', 'bold'],
|
|
272
|
-
oldlace: [],
|
|
273
|
-
olive: [],
|
|
274
|
-
olivedrab: [],
|
|
275
|
-
orange: [],
|
|
276
|
-
orangered: [],
|
|
277
|
-
orchid: ['purple'],
|
|
278
|
-
palegoldenrod: [],
|
|
279
|
-
palegreen: ['green'],
|
|
280
|
-
paleturquoise: [],
|
|
281
|
-
palevioletred: [],
|
|
282
|
-
papayawhip: [],
|
|
283
|
-
peachpuff: [],
|
|
284
|
-
peru: [],
|
|
285
|
-
pink: ['magenta'],
|
|
286
|
-
plum: [],
|
|
287
|
-
powderblue: ['blue', 'subtle'],
|
|
288
|
-
purple: ['purple'],
|
|
289
|
-
rebeccapurple: ['purple', 'accent'],
|
|
290
|
-
red: ['red', 'accent'],
|
|
291
|
-
rosybrown: [],
|
|
292
|
-
royalblue: [],
|
|
293
|
-
saddlebrown: [],
|
|
294
|
-
salmon: [],
|
|
295
|
-
sandybrown: [],
|
|
296
|
-
seagreen: ['green'],
|
|
297
|
-
seashell: [],
|
|
298
|
-
sienna: [],
|
|
299
|
-
silver: [],
|
|
300
|
-
skyblue: ['blue', 'subtlest'],
|
|
301
|
-
slateblue: [],
|
|
302
|
-
slategray: [],
|
|
303
|
-
slategrey: [],
|
|
304
|
-
snow: [],
|
|
305
|
-
springgreen: ['green'],
|
|
306
|
-
steelblue: ['blue'],
|
|
307
|
-
tan: [],
|
|
308
|
-
teal: ['accent', 'teal'],
|
|
309
|
-
thistle: [],
|
|
310
|
-
tomato: ['red'],
|
|
311
|
-
turquoise: [],
|
|
312
|
-
violet: ['purple'],
|
|
313
|
-
wheat: [],
|
|
314
|
-
white: ['elevation', 'surface'],
|
|
315
|
-
whitesmoke: [],
|
|
316
|
-
yellow: ['yellow'],
|
|
317
|
-
yellowgreen: ['yellow'],
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
export const knownRawColors: Record<string, string[]> = {
|
|
321
|
-
'#cccccc': ['gray'],
|
|
322
|
-
'#aaaaaa': ['gray', 'subtlest'],
|
|
323
|
-
'#bbbbbb': ['gray', 'subtle'],
|
|
324
|
-
'#ffffff': ['elevation', 'surface'],
|
|
325
|
-
'#f0f0f0': ['elevation', 'surface'],
|
|
326
|
-
'#eeeeee': ['elevation', 'surface', 'sunken'],
|
|
327
|
-
'#ff0000': ['danger'],
|
|
328
|
-
'#d04437': ['danger'],
|
|
329
|
-
'#c00c00': ['danger'],
|
|
330
|
-
'#5243aa': ['discovery'],
|
|
331
|
-
'#ffc712': ['warning'],
|
|
332
|
-
'#00f00f': ['brand'],
|
|
333
|
-
'#3b73af': ['brand'],
|
|
334
|
-
'#326ca6': ['brand'],
|
|
335
|
-
'#0052cc': ['brand'],
|
|
336
|
-
};
|
|
2
|
+
export { knownVariables } from './known-variables';
|
|
3
|
+
export { knownNamedColors } from './known-named-colors';
|
|
4
|
+
export { knownRawColors } from './known-raw-colors';
|
|
@@ -2,9 +2,6 @@ import type { Declaration, Node, Rule } from 'postcss';
|
|
|
2
2
|
|
|
3
3
|
import { uniqueWordsFromTokens } from '../../utils/unique-words-from-tokens';
|
|
4
4
|
|
|
5
|
-
import { extractCssVarName } from './declaration';
|
|
6
|
-
import { knownNamedColors, knownRawColors, knownVariables } from './legacy-colors';
|
|
7
|
-
|
|
8
5
|
function filterDuplicateFoundations(meta: string[]) {
|
|
9
6
|
const foundations = ['text', 'background', 'shadow', 'border'];
|
|
10
7
|
let hasFoundation = false;
|
|
@@ -140,28 +137,6 @@ function getParentSelectors(node: Node): string {
|
|
|
140
137
|
|
|
141
138
|
return '';
|
|
142
139
|
}
|
|
143
|
-
|
|
144
|
-
export
|
|
145
|
-
|
|
146
|
-
const meta = knownVariables[tokenName];
|
|
147
|
-
|
|
148
|
-
if (!meta || meta.length === 0) {
|
|
149
|
-
return tokenName.split('-');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return meta;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export function getRawColorMeta(rawColor: string): string[] {
|
|
156
|
-
let cleanColor = rawColor.toLowerCase();
|
|
157
|
-
|
|
158
|
-
if (cleanColor.length === 4) {
|
|
159
|
-
cleanColor = cleanColor + cleanColor.substring(cleanColor.indexOf('#') + 1);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return knownRawColors[cleanColor] ?? [];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export function getNamedColorMeta(namedColor: string): string[] {
|
|
166
|
-
return knownNamedColors[namedColor] ?? [];
|
|
167
|
-
}
|
|
140
|
+
export { getCssVarMeta } from './get-css-var-meta';
|
|
141
|
+
export { getRawColorMeta } from './get-raw-color-meta';
|
|
142
|
+
export { getNamedColorMeta } from './get-named-color-meta';
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
extractBetweenParentheses,
|
|
3
|
-
isGradient,
|
|
4
|
-
isKnownCssVariable,
|
|
5
|
-
isLessFunction,
|
|
6
|
-
isNamedColor,
|
|
7
|
-
isRawColor,
|
|
8
|
-
} from './colors';
|
|
1
|
+
import { isGradient, isLessFunction, isNamedColor, isRawColor } from './colors';
|
|
9
2
|
import { extractCssVarName } from './declaration';
|
|
10
|
-
import {
|
|
3
|
+
import { extractBetweenParentheses } from './extract-between-parentheses';
|
|
4
|
+
import { getCssVarMeta } from './get-css-var-meta';
|
|
5
|
+
import { getNamedColorMeta } from './get-named-color-meta';
|
|
6
|
+
import { getRawColorMeta } from './get-raw-color-meta';
|
|
7
|
+
import { isKnownCssVariable } from './is-known-css-variable';
|
|
11
8
|
import findToken from './tokens';
|
|
12
9
|
|
|
13
10
|
interface Value {
|
|
@@ -3,8 +3,10 @@ import postcss, { type Plugin } from 'postcss';
|
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import lessSyntax from 'postcss-less';
|
|
5
5
|
|
|
6
|
-
import { isColorRelatedProperty
|
|
6
|
+
import { isColorRelatedProperty } from './lib/declaration';
|
|
7
|
+
import { isCssDeclaration } from './lib/is-css-declaration';
|
|
7
8
|
import { getBaseDeclarationMeta } from './lib/meta';
|
|
9
|
+
import { splitCssValue } from './lib/split-css-value';
|
|
8
10
|
import findToken from './lib/tokens';
|
|
9
11
|
import parseValue from './lib/value';
|
|
10
12
|
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
9
|
-
* @codegen <<SignedSource::
|
|
9
|
+
* @codegen <<SignedSource::53794f446833e9543b9fc09809fc6844>>
|
|
10
10
|
* @codegenCommand yarn build tokens
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -2050,6 +2050,23 @@ var tokens = [{
|
|
|
2050
2050
|
},
|
|
2051
2051
|
"name": "color.palette.Neutral1100",
|
|
2052
2052
|
"path": ["color", "palette", "Neutral1100"]
|
|
2053
|
+
}, {
|
|
2054
|
+
"value": "#000000",
|
|
2055
|
+
"attributes": {
|
|
2056
|
+
"group": "palette",
|
|
2057
|
+
"category": "light mode neutral"
|
|
2058
|
+
},
|
|
2059
|
+
"filePath": "schema/palettes/palette.tsx",
|
|
2060
|
+
"isSource": true,
|
|
2061
|
+
"original": {
|
|
2062
|
+
"value": "#000000",
|
|
2063
|
+
"attributes": {
|
|
2064
|
+
"group": "palette",
|
|
2065
|
+
"category": "light mode neutral"
|
|
2066
|
+
}
|
|
2067
|
+
},
|
|
2068
|
+
"name": "color.palette.Neutral1200",
|
|
2069
|
+
"path": ["color", "palette", "Neutral1200"]
|
|
2053
2070
|
}, {
|
|
2054
2071
|
"value": "#17171708",
|
|
2055
2072
|
"attributes": {
|
|
@@ -2390,6 +2407,23 @@ var tokens = [{
|
|
|
2390
2407
|
},
|
|
2391
2408
|
"name": "color.palette.DarkNeutral1100",
|
|
2392
2409
|
"path": ["color", "palette", "DarkNeutral1100"]
|
|
2410
|
+
}, {
|
|
2411
|
+
"value": "#FFFFFF",
|
|
2412
|
+
"attributes": {
|
|
2413
|
+
"group": "palette",
|
|
2414
|
+
"category": "dark mode neutral"
|
|
2415
|
+
},
|
|
2416
|
+
"filePath": "schema/palettes/palette.tsx",
|
|
2417
|
+
"isSource": true,
|
|
2418
|
+
"original": {
|
|
2419
|
+
"value": "#FFFFFF",
|
|
2420
|
+
"attributes": {
|
|
2421
|
+
"group": "palette",
|
|
2422
|
+
"category": "dark mode neutral"
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
"name": "color.palette.DarkNeutral1200",
|
|
2426
|
+
"path": ["color", "palette", "DarkNeutral1200"]
|
|
2393
2427
|
}, {
|
|
2394
2428
|
"value": "#01040475",
|
|
2395
2429
|
"attributes": {
|
|
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "themeObjectToString", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _themeObjectToString.themeObjectToString;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "themeStringToObject", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _themeStringToObject.themeStringToObject;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
var
|
|
18
|
+
var _themeStringToObject = require("../theme-string-to-object");
|
|
19
|
+
var _themeObjectToString = require("../theme-object-to-string");
|
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getCustomThemeStyles = getCustomThemeStyles;
|
|
7
7
|
var _constants = require("./constants");
|
|
8
8
|
var _themeConfig = require("./theme-config");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _generateColors = require("./utils/generate-colors");
|
|
10
|
+
var _generateTokenMapWithContrastCheck = require("./utils/generate-token-map-with-contrast-check");
|
|
11
11
|
var _hash = require("./utils/hash");
|
|
12
|
+
var _reduceTokenMap = require("./utils/reduce-token-map");
|
|
12
13
|
/**
|
|
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.
|
|
14
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.
|
|
@@ -26,11 +27,11 @@ function getCustomThemeStyles(themeState) {
|
|
|
26
27
|
var mode = (themeState === null || themeState === void 0 ? void 0 : themeState.colorMode) || _themeConfig.themeStateDefaults['colorMode'];
|
|
27
28
|
var optionString = JSON.stringify(themeState === null || themeState === void 0 ? void 0 : themeState.UNSAFE_themeOptions);
|
|
28
29
|
var uniqueId = (0, _hash.hash)(optionString);
|
|
29
|
-
var themeRamp = (0,
|
|
30
|
+
var themeRamp = (0, _generateColors.generateColors)(brandColor).ramp;
|
|
30
31
|
|
|
31
32
|
// outputs object to generate to CSS from
|
|
32
33
|
var themes = [];
|
|
33
|
-
var tokenMaps = (0,
|
|
34
|
+
var tokenMaps = (0, _generateTokenMapWithContrastCheck.generateTokenMapWithContrastCheck)(brandColor, mode, themeRamp);
|
|
34
35
|
if ((mode === 'light' || mode === 'auto') && tokenMaps.light) {
|
|
35
36
|
// Light mode theming
|
|
36
37
|
themes.push({
|
|
@@ -39,7 +40,7 @@ function getCustomThemeStyles(themeState) {
|
|
|
39
40
|
'data-theme': 'light',
|
|
40
41
|
'data-custom-theme': uniqueId
|
|
41
42
|
},
|
|
42
|
-
css: "\nhtml[".concat(_constants.CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(_constants.COLOR_MODE_ATTRIBUTE, "=\"light\"][data-theme~=\"light:light\"] {\n /* Branded tokens */\n ").concat((0,
|
|
43
|
+
css: "\nhtml[".concat(_constants.CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(_constants.COLOR_MODE_ATTRIBUTE, "=\"light\"][data-theme~=\"light:light\"] {\n /* Branded tokens */\n ").concat((0, _reduceTokenMap.reduceTokenMap)(tokenMaps.light, themeRamp), "\n}")
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
if ((mode === 'dark' || mode === 'auto') && tokenMaps.dark) {
|
|
@@ -50,7 +51,7 @@ function getCustomThemeStyles(themeState) {
|
|
|
50
51
|
'data-theme': 'dark',
|
|
51
52
|
'data-custom-theme': uniqueId
|
|
52
53
|
},
|
|
53
|
-
css: "\nhtml[".concat(_constants.CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(_constants.COLOR_MODE_ATTRIBUTE, "=\"dark\"][data-theme~=\"dark:dark\"] {\n /* Branded tokens */\n ").concat((0,
|
|
54
|
+
css: "\nhtml[".concat(_constants.CUSTOM_THEME_ATTRIBUTE, "=\"").concat(uniqueId, "\"][").concat(_constants.COLOR_MODE_ATTRIBUTE, "=\"dark\"][data-theme~=\"dark:dark\"] {\n /* Branded tokens */\n ").concat((0, _reduceTokenMap.reduceTokenMap)(tokenMaps.dark, themeRamp), "\n}")
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
return themes;
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _constants = require("./constants");
|
|
10
10
|
var _themeColorModes = require("./theme-color-modes");
|
|
11
|
-
var
|
|
11
|
+
var _themeStringToObject = require("./theme-string-to-object");
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
var isThemeColorMode = function isThemeColorMode(colorMode) {
|
|
@@ -23,7 +23,7 @@ var getGlobalTheme = function getGlobalTheme() {
|
|
|
23
23
|
var element = document.documentElement;
|
|
24
24
|
var colorMode = element.getAttribute(_constants.COLOR_MODE_ATTRIBUTE) || '';
|
|
25
25
|
var theme = element.getAttribute(_constants.THEME_DATA_ATTRIBUTE) || '';
|
|
26
|
-
return _objectSpread(_objectSpread({}, (0,
|
|
26
|
+
return _objectSpread(_objectSpread({}, (0, _themeStringToObject.themeStringToObject)(theme)), isThemeColorMode(colorMode) && {
|
|
27
27
|
colorMode: colorMode
|
|
28
28
|
});
|
|
29
29
|
};
|
|
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
10
|
var _constants = require("./constants");
|
|
11
11
|
var _themeConfig = require("./theme-config");
|
|
12
|
-
var
|
|
12
|
+
var _themeObjectToString = require("./theme-object-to-string");
|
|
13
13
|
var _hash = require("./utils/hash");
|
|
14
14
|
var _isValidBrandHex = require("./utils/is-valid-brand-hex");
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -52,7 +52,7 @@ var getThemeHtmlAttrs = function getThemeHtmlAttrs() {
|
|
|
52
52
|
typography = _ref$typography === void 0 ? _themeConfig.themeStateDefaults['typography'] : _ref$typography,
|
|
53
53
|
_ref$UNSAFE_themeOpti = _ref.UNSAFE_themeOptions,
|
|
54
54
|
UNSAFE_themeOptions = _ref$UNSAFE_themeOpti === void 0 ? _themeConfig.themeStateDefaults['UNSAFE_themeOptions'] : _ref$UNSAFE_themeOpti;
|
|
55
|
-
var themeAttribute = (0,
|
|
55
|
+
var themeAttribute = (0, _themeObjectToString.themeObjectToString)({
|
|
56
56
|
dark: dark,
|
|
57
57
|
light: light,
|
|
58
58
|
motion: motion,
|
package/dist/cjs/index.js
CHANGED
|
@@ -91,13 +91,13 @@ Object.defineProperty(exports, "themeImportMap", {
|
|
|
91
91
|
Object.defineProperty(exports, "themeObjectToString", {
|
|
92
92
|
enumerable: true,
|
|
93
93
|
get: function get() {
|
|
94
|
-
return
|
|
94
|
+
return _themeObjectToString.themeObjectToString;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
Object.defineProperty(exports, "themeStringToObject", {
|
|
98
98
|
enumerable: true,
|
|
99
99
|
get: function get() {
|
|
100
|
-
return
|
|
100
|
+
return _themeStringToObject.themeStringToObject;
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "token", {
|
|
@@ -123,6 +123,7 @@ var _getSsrAutoScript = _interopRequireDefault(require("./get-ssr-auto-script"))
|
|
|
123
123
|
var _useThemeObserver = _interopRequireDefault(require("./use-theme-observer"));
|
|
124
124
|
var _themeMutationObserver = _interopRequireDefault(require("./theme-mutation-observer"));
|
|
125
125
|
var _getGlobalTheme = _interopRequireDefault(require("./get-global-theme"));
|
|
126
|
-
var
|
|
126
|
+
var _themeStringToObject = require("./theme-string-to-object");
|
|
127
|
+
var _themeObjectToString = require("./theme-object-to-string");
|
|
127
128
|
var _themeImportMap = _interopRequireDefault(require("./artifacts/theme-import-map"));
|
|
128
129
|
var _constants = require("./constants");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isThemeIds = void 0;
|
|
7
|
+
var _themeIds = require("./theme-ids");
|
|
8
|
+
var isThemeIds = exports.isThemeIds = function isThemeIds(themeId) {
|
|
9
|
+
return _themeIds.themeIds.find(function (id) {
|
|
10
|
+
return id === themeId;
|
|
11
|
+
}) !== undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isThemeKind = void 0;
|
|
7
|
+
var themeKinds = ['light', 'dark', 'spacing', 'typography', 'shape', 'motion'];
|
|
8
|
+
var isThemeKind = exports.isThemeKind = function isThemeKind(themeKind) {
|
|
9
|
+
return themeKinds.find(function (kind) {
|
|
10
|
+
return kind === themeKind;
|
|
11
|
+
}) !== undefined;
|
|
12
|
+
};
|