@atlaskit/tokens 1.22.1 → 1.24.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/CHANGELOG.md +15 -0
- package/custom-themes/package.json +17 -0
- package/dist/cjs/artifacts/generated-pairs.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-legacy-dark.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-legacy-light.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-light.js +2 -2
- package/dist/cjs/artifacts/token-default-values.js +2 -1
- package/dist/cjs/artifacts/token-names.js +2 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +23 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-dark.js +23 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-legacy-light.js +23 -1
- package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +23 -1
- package/dist/cjs/constants.js +3 -1
- package/dist/cjs/custom-theme.js +45 -79
- package/dist/cjs/enable-global-theme.js +70 -0
- package/dist/cjs/entry-points/custom-themes.js +13 -0
- package/dist/cjs/get-token-value.js +1 -1
- package/dist/cjs/get-token.js +1 -1
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/load-custom-theme-styles.js +45 -0
- package/dist/cjs/set-global-theme.js +50 -94
- package/dist/cjs/theme-config.js +5 -0
- package/dist/cjs/tokens/atlassian-dark/color/text.js +3 -0
- package/dist/cjs/tokens/atlassian-legacy-dark/color/text.js +3 -0
- package/dist/cjs/tokens/atlassian-legacy-light/color/text.js +3 -0
- package/dist/cjs/tokens/atlassian-light/color/text.js +3 -0
- package/dist/cjs/tokens/default/color/text.js +8 -0
- package/dist/cjs/utils/color-mode-listeners.js +66 -0
- package/dist/cjs/utils/configure-page.js +34 -0
- package/dist/es2019/artifacts/generated-pairs.js +2 -2
- package/dist/es2019/artifacts/themes/atlassian-dark.js +2 -1
- package/dist/es2019/artifacts/themes/atlassian-legacy-dark.js +2 -1
- package/dist/es2019/artifacts/themes/atlassian-legacy-light.js +2 -1
- package/dist/es2019/artifacts/themes/atlassian-light.js +2 -1
- package/dist/es2019/artifacts/token-default-values.js +2 -1
- package/dist/es2019/artifacts/token-names.js +2 -1
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +23 -1
- package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-dark.js +23 -1
- package/dist/es2019/artifacts/tokens-raw/atlassian-legacy-light.js +23 -1
- package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +23 -1
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/custom-theme.js +4 -4
- package/dist/es2019/enable-global-theme.js +53 -0
- package/dist/es2019/entry-points/custom-themes.js +1 -0
- package/dist/es2019/get-token-value.js +1 -1
- package/dist/es2019/get-token.js +1 -1
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/load-custom-theme-styles.js +37 -0
- package/dist/es2019/set-global-theme.js +34 -65
- package/dist/es2019/theme-config.js +6 -0
- package/dist/es2019/tokens/atlassian-dark/color/text.js +3 -0
- package/dist/es2019/tokens/atlassian-legacy-dark/color/text.js +3 -0
- package/dist/es2019/tokens/atlassian-legacy-light/color/text.js +3 -0
- package/dist/es2019/tokens/atlassian-light/color/text.js +3 -0
- package/dist/es2019/tokens/default/color/text.js +8 -0
- package/dist/es2019/utils/color-mode-listeners.js +48 -0
- package/dist/es2019/utils/configure-page.js +22 -0
- package/dist/esm/artifacts/generated-pairs.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-legacy-dark.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-legacy-light.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-light.js +2 -2
- package/dist/esm/artifacts/token-default-values.js +2 -1
- package/dist/esm/artifacts/token-names.js +2 -1
- package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +23 -1
- package/dist/esm/artifacts/tokens-raw/atlassian-legacy-dark.js +23 -1
- package/dist/esm/artifacts/tokens-raw/atlassian-legacy-light.js +23 -1
- package/dist/esm/artifacts/tokens-raw/atlassian-light.js +23 -1
- package/dist/esm/constants.js +1 -0
- package/dist/esm/custom-theme.js +45 -78
- package/dist/esm/enable-global-theme.js +63 -0
- package/dist/esm/entry-points/custom-themes.js +1 -0
- package/dist/esm/get-token-value.js +1 -1
- package/dist/esm/get-token.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/load-custom-theme-styles.js +39 -0
- package/dist/esm/set-global-theme.js +49 -93
- package/dist/esm/theme-config.js +6 -0
- package/dist/esm/tokens/atlassian-dark/color/text.js +3 -0
- package/dist/esm/tokens/atlassian-legacy-dark/color/text.js +3 -0
- package/dist/esm/tokens/atlassian-legacy-light/color/text.js +3 -0
- package/dist/esm/tokens/atlassian-light/color/text.js +3 -0
- package/dist/esm/tokens/default/color/text.js +8 -0
- package/dist/esm/utils/color-mode-listeners.js +58 -0
- package/dist/esm/utils/configure-page.js +28 -0
- package/dist/types/artifacts/generated-pairs.d.ts +1 -1
- package/dist/types/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-legacy-dark.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-legacy-light.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types/artifacts/token-default-values.d.ts +2 -1
- package/dist/types/artifacts/token-names.d.ts +3 -1
- package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-legacy-light.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
- package/dist/types/artifacts/types-internal.d.ts +2 -2
- package/dist/types/artifacts/types.d.ts +2 -2
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/custom-theme.d.ts +3 -3
- package/dist/types/enable-global-theme.d.ts +25 -0
- package/dist/types/entry-points/custom-themes.d.ts +1 -0
- package/dist/types/get-global-theme.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/load-custom-theme-styles.d.ts +17 -0
- package/dist/types/set-global-theme.d.ts +1 -4
- package/dist/types/theme-config.d.ts +7 -0
- package/dist/types/theme-mutation-observer.d.ts +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/use-theme-observer.d.ts +1 -1
- package/dist/types/utils/color-mode-listeners.d.ts +13 -0
- package/dist/types/utils/configure-page.d.ts +6 -0
- package/dist/types-ts4.5/artifacts/generated-pairs.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-legacy-dark.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-legacy-light.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/token-default-values.d.ts +2 -1
- package/dist/types-ts4.5/artifacts/token-names.d.ts +3 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-legacy-dark.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-legacy-light.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/types-internal.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/types.d.ts +2 -2
- package/dist/types-ts4.5/constants.d.ts +1 -0
- package/dist/types-ts4.5/custom-theme.d.ts +3 -3
- package/dist/types-ts4.5/enable-global-theme.d.ts +25 -0
- package/dist/types-ts4.5/entry-points/custom-themes.d.ts +1 -0
- package/dist/types-ts4.5/get-global-theme.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/load-custom-theme-styles.d.ts +17 -0
- package/dist/types-ts4.5/set-global-theme.d.ts +1 -4
- package/dist/types-ts4.5/theme-config.d.ts +7 -0
- package/dist/types-ts4.5/theme-mutation-observer.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/dist/types-ts4.5/use-theme-observer.d.ts +1 -1
- package/dist/types-ts4.5/utils/color-mode-listeners.d.ts +13 -0
- package/dist/types-ts4.5/utils/configure-page.d.ts +6 -0
- package/figma/atlassian-dark.json +9 -0
- package/figma/atlassian-legacy-dark.json +9 -0
- package/figma/atlassian-legacy-light.json +9 -0
- package/figma/atlassian-light.json +9 -0
- package/package.json +3 -2
- package/report.api.md +20 -2
- package/tmp/api-report-tmp.d.ts +9 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::e988c9f1dbc5f3401409a53e6b2d71e2>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
export default `
|
|
@@ -42,6 +42,7 @@ html[data-color-mode="dark"][data-theme~="dark:dark"] {
|
|
|
42
42
|
--ds-text-subtle: #9FADBC;
|
|
43
43
|
--ds-link: #579DFF;
|
|
44
44
|
--ds-link-pressed: #85B8FF;
|
|
45
|
+
--ds-link-visited: #B8ACF6;
|
|
45
46
|
--ds-icon: #9FADBC;
|
|
46
47
|
--ds-icon-accent-lime: #82B536;
|
|
47
48
|
--ds-icon-accent-red: #EF5C48;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::cbc95efad14e4b8f73c4b91d9c616f52>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
export default `
|
|
@@ -42,6 +42,7 @@ html[data-color-mode="dark"][data-theme~="dark:legacy-dark"] {
|
|
|
42
42
|
--ds-text-subtle: #9FB0CC;
|
|
43
43
|
--ds-link: #0052CC;
|
|
44
44
|
--ds-link-pressed: #0065FF;
|
|
45
|
+
--ds-link-visited: #6554C0;
|
|
45
46
|
--ds-icon: #DCE5F5;
|
|
46
47
|
--ds-icon-accent-lime: #6A9A23;
|
|
47
48
|
--ds-icon-accent-red: #BF2600;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::864da039f8f9b771294919957d8579f4>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
export default `
|
|
@@ -42,6 +42,7 @@ html[data-color-mode="dark"][data-theme~="dark:legacy-light"] {
|
|
|
42
42
|
--ds-text-subtle: #42526E;
|
|
43
43
|
--ds-link: #0052CC;
|
|
44
44
|
--ds-link-pressed: #0747A6;
|
|
45
|
+
--ds-link-visited: #403294;
|
|
45
46
|
--ds-icon: #505F79;
|
|
46
47
|
--ds-icon-accent-lime: #6A9A23;
|
|
47
48
|
--ds-icon-accent-red: #FF5630;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::8c2806dec8e3f2fc93f7bc93229db8b9>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
export default `
|
|
@@ -42,6 +42,7 @@ html[data-color-mode="dark"][data-theme~="dark:light"] {
|
|
|
42
42
|
--ds-text-subtle: #44546F;
|
|
43
43
|
--ds-link: #0C66E4;
|
|
44
44
|
--ds-link-pressed: #0055CC;
|
|
45
|
+
--ds-link-visited: #5E4DB2;
|
|
45
46
|
--ds-icon: #44546F;
|
|
46
47
|
--ds-icon-accent-lime: #6A9A23;
|
|
47
48
|
--ds-icon-accent-red: #E34935;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Token names mapped to their value in the default Atlassian themes ('light').
|
|
8
8
|
* These default values are used by the Babel plugin to optionally provide automatic fallbacks.
|
|
9
9
|
*
|
|
10
|
-
* @codegen <<SignedSource::
|
|
10
|
+
* @codegen <<SignedSource::2055e9d3b964a68e35d40fda2189f30a>>
|
|
11
11
|
* @codegenCommand yarn build tokens
|
|
12
12
|
*/
|
|
13
13
|
const defaultTokenValues = {
|
|
@@ -46,6 +46,7 @@ const defaultTokenValues = {
|
|
|
46
46
|
'color.text.subtle': '#44546F',
|
|
47
47
|
'color.link': '#0C66E4',
|
|
48
48
|
'color.link.pressed': '#0055CC',
|
|
49
|
+
'color.link.visited': '#5E4DB2',
|
|
49
50
|
'color.icon': '#44546F',
|
|
50
51
|
'color.icon.accent.lime': '#6A9A23',
|
|
51
52
|
'color.icon.accent.red': '#E34935',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::85873830ffd9373b872fe41c841504eb>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
const tokens = {
|
|
@@ -39,6 +39,7 @@ const tokens = {
|
|
|
39
39
|
'color.text.subtle': '--ds-text-subtle',
|
|
40
40
|
'color.link': '--ds-link',
|
|
41
41
|
'color.link.pressed': '--ds-link-pressed',
|
|
42
|
+
'color.link.visited': '--ds-link-visited',
|
|
42
43
|
'color.icon': '--ds-icon',
|
|
43
44
|
'color.icon.accent.lime': '--ds-icon-accent-lime',
|
|
44
45
|
'color.icon.accent.red': '--ds-icon-accent-red',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::53fe3ce214e188eaafa0c96c9d57e282>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
const tokens = [{
|
|
@@ -773,6 +773,28 @@ const tokens = [{
|
|
|
773
773
|
"name": "color.link.pressed",
|
|
774
774
|
"path": ["color", "link", "pressed"],
|
|
775
775
|
"cleanName": "color.link.pressed"
|
|
776
|
+
}, {
|
|
777
|
+
"attributes": {
|
|
778
|
+
"group": "paint",
|
|
779
|
+
"state": "active",
|
|
780
|
+
"introduced": "1.23.0",
|
|
781
|
+
"description": "Use for links in a visited state."
|
|
782
|
+
},
|
|
783
|
+
"value": "#B8ACF6",
|
|
784
|
+
"filePath": "src/tokens/atlassian-dark/color/text.tsx",
|
|
785
|
+
"isSource": true,
|
|
786
|
+
"original": {
|
|
787
|
+
"attributes": {
|
|
788
|
+
"group": "paint",
|
|
789
|
+
"state": "active",
|
|
790
|
+
"introduced": "1.23.0",
|
|
791
|
+
"description": "Use for links in a visited state."
|
|
792
|
+
},
|
|
793
|
+
"value": "Purple300"
|
|
794
|
+
},
|
|
795
|
+
"name": "color.link.visited",
|
|
796
|
+
"path": ["color", "link", "visited"],
|
|
797
|
+
"cleanName": "color.link.visited"
|
|
776
798
|
}, {
|
|
777
799
|
"attributes": {
|
|
778
800
|
"group": "paint",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::bee85f1b04f33c290a4e90dad09a8602>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
const tokens = [{
|
|
@@ -773,6 +773,28 @@ const tokens = [{
|
|
|
773
773
|
"name": "color.link.pressed",
|
|
774
774
|
"path": ["color", "link", "pressed"],
|
|
775
775
|
"cleanName": "color.link.pressed"
|
|
776
|
+
}, {
|
|
777
|
+
"attributes": {
|
|
778
|
+
"group": "paint",
|
|
779
|
+
"state": "active",
|
|
780
|
+
"introduced": "1.23.0",
|
|
781
|
+
"description": "Use for links in a visited state."
|
|
782
|
+
},
|
|
783
|
+
"value": "#6554C0",
|
|
784
|
+
"filePath": "src/tokens/atlassian-legacy-dark/color/text.tsx",
|
|
785
|
+
"isSource": true,
|
|
786
|
+
"original": {
|
|
787
|
+
"attributes": {
|
|
788
|
+
"group": "paint",
|
|
789
|
+
"state": "active",
|
|
790
|
+
"introduced": "1.23.0",
|
|
791
|
+
"description": "Use for links in a visited state."
|
|
792
|
+
},
|
|
793
|
+
"value": "P300"
|
|
794
|
+
},
|
|
795
|
+
"name": "color.link.visited",
|
|
796
|
+
"path": ["color", "link", "visited"],
|
|
797
|
+
"cleanName": "color.link.visited"
|
|
776
798
|
}, {
|
|
777
799
|
"attributes": {
|
|
778
800
|
"group": "paint",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::3335668d6b974c0aae9b4e7246358fd2>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
const tokens = [{
|
|
@@ -773,6 +773,28 @@ const tokens = [{
|
|
|
773
773
|
"name": "color.link.pressed",
|
|
774
774
|
"path": ["color", "link", "pressed"],
|
|
775
775
|
"cleanName": "color.link.pressed"
|
|
776
|
+
}, {
|
|
777
|
+
"attributes": {
|
|
778
|
+
"group": "paint",
|
|
779
|
+
"state": "active",
|
|
780
|
+
"introduced": "1.23.0",
|
|
781
|
+
"description": "Use for links in a visited state."
|
|
782
|
+
},
|
|
783
|
+
"value": "#403294",
|
|
784
|
+
"filePath": "src/tokens/atlassian-legacy-light/color/text.tsx",
|
|
785
|
+
"isSource": true,
|
|
786
|
+
"original": {
|
|
787
|
+
"attributes": {
|
|
788
|
+
"group": "paint",
|
|
789
|
+
"state": "active",
|
|
790
|
+
"introduced": "1.23.0",
|
|
791
|
+
"description": "Use for links in a visited state."
|
|
792
|
+
},
|
|
793
|
+
"value": "P500"
|
|
794
|
+
},
|
|
795
|
+
"name": "color.link.visited",
|
|
796
|
+
"path": ["color", "link", "visited"],
|
|
797
|
+
"cleanName": "color.link.visited"
|
|
776
798
|
}, {
|
|
777
799
|
"attributes": {
|
|
778
800
|
"group": "paint",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::6009ba9010fc2a039dc1080a936d9f80>>
|
|
4
4
|
* @codegenCommand yarn build tokens
|
|
5
5
|
*/
|
|
6
6
|
const tokens = [{
|
|
@@ -773,6 +773,28 @@ const tokens = [{
|
|
|
773
773
|
"name": "color.link.pressed",
|
|
774
774
|
"path": ["color", "link", "pressed"],
|
|
775
775
|
"cleanName": "color.link.pressed"
|
|
776
|
+
}, {
|
|
777
|
+
"attributes": {
|
|
778
|
+
"group": "paint",
|
|
779
|
+
"state": "active",
|
|
780
|
+
"introduced": "1.23.0",
|
|
781
|
+
"description": "Use for links in a visited state."
|
|
782
|
+
},
|
|
783
|
+
"value": "#5E4DB2",
|
|
784
|
+
"filePath": "src/tokens/atlassian-light/color/text.tsx",
|
|
785
|
+
"isSource": true,
|
|
786
|
+
"original": {
|
|
787
|
+
"attributes": {
|
|
788
|
+
"group": "paint",
|
|
789
|
+
"state": "active",
|
|
790
|
+
"introduced": "1.23.0",
|
|
791
|
+
"description": "Use for links in a visited state."
|
|
792
|
+
},
|
|
793
|
+
"value": "Purple800"
|
|
794
|
+
},
|
|
795
|
+
"name": "color.link.visited",
|
|
796
|
+
"path": ["color", "link", "visited"],
|
|
797
|
+
"cleanName": "color.link.visited"
|
|
776
798
|
}, {
|
|
777
799
|
"attributes": {
|
|
778
800
|
"group": "paint",
|
package/dist/es2019/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const THEME_DATA_ATTRIBUTE = 'data-theme';
|
|
2
2
|
export const COLOR_MODE_ATTRIBUTE = 'data-color-mode';
|
|
3
3
|
export const CUSTOM_THEME_ATTRIBUTE = 'data-custom-theme';
|
|
4
|
+
export const DEFAULT_THEME = 'light';
|
|
4
5
|
export const CSS_PREFIX = 'ds';
|
|
5
6
|
export const CSS_VAR_FULL = ['opacity', 'font', 'space', 'border'];
|
|
6
7
|
export const TOKEN_NOT_FOUND_CSS_VAR = `--${CSS_PREFIX}-token-not-found`;
|
|
@@ -18,10 +18,10 @@ export const CUSTOM_STYLE_ELEMENTS_SIZE_THRESHOLD = 10;
|
|
|
18
18
|
* @param {string} themeState.colorMode Determines which color theme is applied
|
|
19
19
|
* @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
|
|
20
20
|
*
|
|
21
|
-
* @returns
|
|
21
|
+
* @returns An object array, containing theme IDs, data-attributes to attach to the theme, and the theme CSS.
|
|
22
22
|
* If an error is encountered while loading themes, the themes array will be empty.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export function getCustomThemeStyles(themeState) {
|
|
25
25
|
var _themeState$UNSAFE_th;
|
|
26
26
|
const brandColor = themeState === null || themeState === void 0 ? void 0 : (_themeState$UNSAFE_th = themeState.UNSAFE_themeOptions) === null || _themeState$UNSAFE_th === void 0 ? void 0 : _themeState$UNSAFE_th.brandColor;
|
|
27
27
|
const mode = (themeState === null || themeState === void 0 ? void 0 : themeState.colorMode) || themeStateDefaults['colorMode'];
|
|
@@ -64,8 +64,8 @@ html[${CUSTOM_THEME_ATTRIBUTE}="${uniqueId}"][${COLOR_MODE_ATTRIBUTE}="dark"][da
|
|
|
64
64
|
}
|
|
65
65
|
return themes;
|
|
66
66
|
}
|
|
67
|
-
export
|
|
68
|
-
const themes =
|
|
67
|
+
export function loadAndAppendCustomThemeCss(themeState) {
|
|
68
|
+
const themes = getCustomThemeStyles(themeState);
|
|
69
69
|
limitSizeOfCustomStyleElements(CUSTOM_STYLE_ELEMENTS_SIZE_THRESHOLD);
|
|
70
70
|
themes.map(theme => {
|
|
71
71
|
const styleTag = document.createElement('style');
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { themeStateDefaults } from './theme-config';
|
|
2
|
+
import configurePage from './utils/configure-page';
|
|
3
|
+
import { getThemePreferences } from './utils/get-theme-preferences';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Synchronously sets the theme globally at runtime. Themes are not loaded;
|
|
7
|
+
* use `getThemeStyles` and other server-side utilities to generate and load them.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object<string, string>} themeState The themes and color mode that should be applied.
|
|
10
|
+
* @param {string} themeState.colorMode Determines which color theme is applied. If set to `auto`, the theme applied will be determined by the OS setting.
|
|
11
|
+
* @param {string} themeState.dark The color theme to be applied when the color mode resolves to 'dark'.
|
|
12
|
+
* @param {string} themeState.light The color theme to be applied when the color mode resolves to 'light'.
|
|
13
|
+
* @param {string} themeState.shape The shape theme to be applied.
|
|
14
|
+
* @param {string} themeState.spacing The spacing theme to be applied.
|
|
15
|
+
* @param {string} themeState.typography The typography theme to be applied.
|
|
16
|
+
* @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
|
|
17
|
+
* @param {function} themeLoader Callback function used to override the default theme loading functionality.
|
|
18
|
+
*
|
|
19
|
+
* @returns An unbind function, that can be used to stop listening for changes to system theme.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* enableGlobalTheme({colorMode: 'auto', light: 'light', dark: 'dark', spacing: 'spacing'});
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
const enableGlobalTheme = ({
|
|
27
|
+
colorMode = themeStateDefaults['colorMode'],
|
|
28
|
+
dark = themeStateDefaults['dark'],
|
|
29
|
+
light = themeStateDefaults['light'],
|
|
30
|
+
shape = themeStateDefaults['shape'],
|
|
31
|
+
spacing = themeStateDefaults['spacing'],
|
|
32
|
+
typography = themeStateDefaults['typography'],
|
|
33
|
+
UNSAFE_themeOptions = themeStateDefaults['UNSAFE_themeOptions']
|
|
34
|
+
} = {}, themeLoader) => {
|
|
35
|
+
const themeState = {
|
|
36
|
+
colorMode,
|
|
37
|
+
dark,
|
|
38
|
+
light,
|
|
39
|
+
shape,
|
|
40
|
+
spacing,
|
|
41
|
+
typography,
|
|
42
|
+
UNSAFE_themeOptions: themeLoader ? undefined : UNSAFE_themeOptions
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Determine what to load and call theme loader
|
|
46
|
+
const themePreferences = getThemePreferences(themeState);
|
|
47
|
+
if (themeLoader) {
|
|
48
|
+
themePreferences.map(themeId => themeLoader(themeId));
|
|
49
|
+
}
|
|
50
|
+
const autoUnbind = configurePage(themeState);
|
|
51
|
+
return autoUnbind;
|
|
52
|
+
};
|
|
53
|
+
export default enableGlobalTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UNSAFE_loadCustomThemeStyles } from '../load-custom-theme-styles';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import warnOnce from '@atlaskit/ds-lib/warn-once';
|
|
2
2
|
import tokens from './artifacts/token-names';
|
|
3
3
|
const name = "@atlaskit/tokens";
|
|
4
|
-
const version = "1.
|
|
4
|
+
const version = "1.24.0";
|
|
5
5
|
/**
|
|
6
6
|
* Takes a dot-separated token name and and an optional fallback, and returns the current computed CSS value for the
|
|
7
7
|
* resulting CSS Custom Property.
|
package/dist/es2019/get-token.js
CHANGED
|
@@ -2,7 +2,7 @@ import warnOnce from '@atlaskit/ds-lib/warn-once';
|
|
|
2
2
|
import tokens from './artifacts/token-names';
|
|
3
3
|
import { TOKEN_NOT_FOUND_CSS_VAR } from './constants';
|
|
4
4
|
const name = "@atlaskit/tokens";
|
|
5
|
-
const version = "1.
|
|
5
|
+
const version = "1.24.0";
|
|
6
6
|
/**
|
|
7
7
|
* Takes a dot-separated token name and an optional fallback, and returns the CSS custom property for the corresponding token.
|
|
8
8
|
* This should be used to implement design decisions throughout your application.
|
package/dist/es2019/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as themeConfig } from './theme-config';
|
|
|
2
2
|
export { default as token } from './get-token';
|
|
3
3
|
export { default as getTokenValue } from './get-token-value';
|
|
4
4
|
export { default as setGlobalTheme } from './set-global-theme';
|
|
5
|
+
export { default as enableGlobalTheme } from './enable-global-theme';
|
|
5
6
|
export { default as getThemeStyles } from './get-theme-styles';
|
|
6
7
|
export { default as getThemeHtmlAttrs } from './get-theme-html-attrs';
|
|
7
8
|
export { default as getSSRAutoScript } from './get-ssr-auto-script';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { loadAndAppendCustomThemeCss } from './custom-theme';
|
|
2
|
+
import { themeStateDefaults } from './theme-config';
|
|
3
|
+
import { isValidBrandHex } from './utils/color-utils';
|
|
4
|
+
import { findMissingCustomStyleElements } from './utils/custom-theme-loading-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Synchronously generates and applies custom theme styles to the page.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object<string, string>} themeState The themes and color mode that should be applied.
|
|
10
|
+
* @param {Object} themeState.UNSAFE_themeOptions The custom branding options to be used for custom theme generation
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* UNSAFE_loadCustomThemeStyles({
|
|
15
|
+
* colorMode: 'auto',
|
|
16
|
+
* UNSAFE_themeOptions: { brandColor: '#FF0000' }
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
const UNSAFE_loadCustomThemeStyles = ({
|
|
21
|
+
colorMode = themeStateDefaults['colorMode'],
|
|
22
|
+
UNSAFE_themeOptions = themeStateDefaults['UNSAFE_themeOptions']
|
|
23
|
+
} = {}) => {
|
|
24
|
+
// Load custom theme styles
|
|
25
|
+
if (UNSAFE_themeOptions && isValidBrandHex(UNSAFE_themeOptions === null || UNSAFE_themeOptions === void 0 ? void 0 : UNSAFE_themeOptions.brandColor)) {
|
|
26
|
+
const attrOfMissingCustomStyles = findMissingCustomStyleElements(UNSAFE_themeOptions, colorMode);
|
|
27
|
+
if (attrOfMissingCustomStyles.length !== 0) {
|
|
28
|
+
loadAndAppendCustomThemeCss({
|
|
29
|
+
colorMode: attrOfMissingCustomStyles.length === 2 ? 'auto' :
|
|
30
|
+
// only load the missing custom theme styles
|
|
31
|
+
attrOfMissingCustomStyles[0],
|
|
32
|
+
UNSAFE_themeOptions
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export default UNSAFE_loadCustomThemeStyles;
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
import { bind } from 'bind-event-listener';
|
|
2
|
-
import noop from '@atlaskit/ds-lib/noop';
|
|
3
|
-
import { COLOR_MODE_ATTRIBUTE } from './constants';
|
|
4
|
-
import getThemeHtmlAttrs from './get-theme-html-attrs';
|
|
5
1
|
import { themeStateDefaults } from './theme-config';
|
|
6
2
|
import { isValidBrandHex } from './utils/color-utils';
|
|
3
|
+
import configurePage from './utils/configure-page';
|
|
7
4
|
import { findMissingCustomStyleElements } from './utils/custom-theme-loading-utils';
|
|
8
5
|
import { getThemePreferences } from './utils/get-theme-preferences';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
// Represents theme state once mounted to the page (auto is hidden from observers)
|
|
12
|
-
|
|
13
|
-
const isMatchMediaAvailable = typeof window !== 'undefined' && 'matchMedia' in window;
|
|
14
|
-
const darkModeMql = isMatchMediaAvailable && window.matchMedia(darkModeMediaQuery);
|
|
15
|
-
let unbindThemeChangeListener = noop;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Updates the current theme when the system theme changes. Should be bound
|
|
19
|
-
* to an event listener listening on the '(prefers-color-scheme: dark)' query
|
|
20
|
-
* @param e The event representing a change in system theme.
|
|
21
|
-
*/
|
|
22
|
-
const checkNativeListener = function (e) {
|
|
23
|
-
const element = document.documentElement;
|
|
24
|
-
element.setAttribute(COLOR_MODE_ATTRIBUTE, e.matches ? 'dark' : 'light');
|
|
25
|
-
};
|
|
6
|
+
import { loadAndAppendThemeCss } from './utils/theme-loading';
|
|
26
7
|
|
|
27
8
|
/**
|
|
28
9
|
* Sets the theme globally at runtime. This updates the `data-theme` and `data-color-mode` attributes on your page's <html> tag.
|
|
@@ -53,57 +34,45 @@ const setGlobalTheme = async ({
|
|
|
53
34
|
typography = themeStateDefaults['typography'],
|
|
54
35
|
UNSAFE_themeOptions = themeStateDefaults['UNSAFE_themeOptions']
|
|
55
36
|
} = {}, themeLoader) => {
|
|
56
|
-
const
|
|
37
|
+
const themeState = {
|
|
57
38
|
colorMode,
|
|
58
39
|
dark,
|
|
59
40
|
light,
|
|
60
41
|
shape,
|
|
61
42
|
spacing,
|
|
62
|
-
typography
|
|
63
|
-
|
|
43
|
+
typography,
|
|
44
|
+
UNSAFE_themeOptions: themeLoader ? undefined : UNSAFE_themeOptions
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Determine what to load and loading strategy
|
|
48
|
+
const themePreferences = getThemePreferences(themeState);
|
|
64
49
|
const loadingStrategy = themeLoader ? themeLoader : loadAndAppendThemeCss;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
50
|
+
|
|
51
|
+
// Load standard themes
|
|
52
|
+
const loadingTasks = themePreferences.map(async themeId => await loadingStrategy(themeId));
|
|
53
|
+
|
|
54
|
+
// Load custom themes if needed
|
|
55
|
+
if (!themeLoader && UNSAFE_themeOptions && isValidBrandHex(UNSAFE_themeOptions === null || UNSAFE_themeOptions === void 0 ? void 0 : UNSAFE_themeOptions.brandColor)) {
|
|
56
|
+
const mode = colorMode || themeStateDefaults['colorMode'];
|
|
57
|
+
const attrOfMissingCustomStyles = findMissingCustomStyleElements(UNSAFE_themeOptions, mode);
|
|
58
|
+
if (attrOfMissingCustomStyles.length > 0) {
|
|
59
|
+
// Load custom theme styles
|
|
60
|
+
loadingTasks.push((async () => {
|
|
61
|
+
const {
|
|
62
|
+
loadAndAppendCustomThemeCss
|
|
63
|
+
} = await import( /* webpackChunkName: "@atlaskit-internal_atlassian-custom-theme" */
|
|
64
|
+
'./custom-theme');
|
|
65
|
+
loadAndAppendCustomThemeCss({
|
|
66
|
+
colorMode: attrOfMissingCustomStyles.length === 2 ? 'auto' :
|
|
67
|
+
// only load the missing custom theme styles
|
|
68
|
+
attrOfMissingCustomStyles[0],
|
|
69
|
+
UNSAFE_themeOptions
|
|
70
|
+
});
|
|
71
|
+
})());
|
|
82
72
|
}
|
|
83
|
-
})()]);
|
|
84
|
-
if (colorMode === 'auto' && darkModeMql) {
|
|
85
|
-
colorMode = darkModeMql.matches ? 'dark' : 'light';
|
|
86
|
-
// Add an event listener for changes to the system theme.
|
|
87
|
-
// If the function exists, it will not be added again.
|
|
88
|
-
unbindThemeChangeListener = bind(darkModeMql, {
|
|
89
|
-
type: 'change',
|
|
90
|
-
listener: checkNativeListener
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
unbindThemeChangeListener();
|
|
94
73
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
light,
|
|
99
|
-
shape,
|
|
100
|
-
spacing,
|
|
101
|
-
typography,
|
|
102
|
-
UNSAFE_themeOptions: themeLoader ? undefined : UNSAFE_themeOptions
|
|
103
|
-
});
|
|
104
|
-
Object.entries(themeAttributes).forEach(([key, value]) => {
|
|
105
|
-
document.documentElement.setAttribute(key, value);
|
|
106
|
-
});
|
|
107
|
-
return unbindThemeChangeListener;
|
|
74
|
+
await Promise.all(loadingTasks);
|
|
75
|
+
const autoUnbind = configurePage(themeState);
|
|
76
|
+
return autoUnbind;
|
|
108
77
|
};
|
|
109
78
|
export default setGlobalTheme;
|
|
@@ -178,4 +178,10 @@ export const themeStateDefaults = {
|
|
|
178
178
|
typography: undefined,
|
|
179
179
|
UNSAFE_themeOptions: undefined
|
|
180
180
|
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Represents theme state once mounted to the page
|
|
184
|
+
* (the page doesn't have an "auto" color mode, it's either light or dark)
|
|
185
|
+
*/
|
|
186
|
+
|
|
181
187
|
export default themeConfig;
|
|
@@ -124,6 +124,14 @@ const color = {
|
|
|
124
124
|
introduced: '0.6.0',
|
|
125
125
|
description: 'Use for links in a pressed state.'
|
|
126
126
|
}
|
|
127
|
+
},
|
|
128
|
+
visited: {
|
|
129
|
+
attributes: {
|
|
130
|
+
group: 'paint',
|
|
131
|
+
state: 'active',
|
|
132
|
+
introduced: '1.23.0',
|
|
133
|
+
description: 'Use for links in a visited state.'
|
|
134
|
+
}
|
|
127
135
|
}
|
|
128
136
|
}
|
|
129
137
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { bind } from 'bind-event-listener';
|
|
3
|
+
import { COLOR_MODE_ATTRIBUTE } from '../constants';
|
|
4
|
+
import { darkModeMediaQuery } from './theme-loading';
|
|
5
|
+
const isMatchMediaAvailable = typeof window !== 'undefined' && 'matchMedia' in window;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Updates the current theme when the system theme changes. Should be bound
|
|
9
|
+
* to an event listener listening on the '(prefers-color-scheme: dark)' query
|
|
10
|
+
* @param e The event representing a change in system theme.
|
|
11
|
+
*/
|
|
12
|
+
function checkNativeListener(e) {
|
|
13
|
+
const element = document.documentElement;
|
|
14
|
+
element.setAttribute(COLOR_MODE_ATTRIBUTE, e.matches ? 'dark' : 'light');
|
|
15
|
+
}
|
|
16
|
+
const darkModeMql = isMatchMediaAvailable && window.matchMedia(darkModeMediaQuery);
|
|
17
|
+
class ColorModeObserver {
|
|
18
|
+
constructor() {
|
|
19
|
+
_defineProperty(this, "unbindThemeChangeListener", null);
|
|
20
|
+
}
|
|
21
|
+
getColorMode() {
|
|
22
|
+
if (!darkModeMql) {
|
|
23
|
+
return 'light';
|
|
24
|
+
}
|
|
25
|
+
return darkModeMql !== null && darkModeMql !== void 0 && darkModeMql.matches ? 'dark' : 'light';
|
|
26
|
+
}
|
|
27
|
+
bind() {
|
|
28
|
+
if (darkModeMql && this.unbindThemeChangeListener === null) {
|
|
29
|
+
this.unbindThemeChangeListener = bind(darkModeMql, {
|
|
30
|
+
type: 'change',
|
|
31
|
+
listener: checkNativeListener
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
unbind() {
|
|
36
|
+
if (this.unbindThemeChangeListener) {
|
|
37
|
+
this.unbindThemeChangeListener();
|
|
38
|
+
this.unbindThemeChangeListener = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A singleton color mode observer - binds "auto" switching logic to a single `mediaQueryList` listener
|
|
45
|
+
* that can be unbound by any consumer when no longer needed.
|
|
46
|
+
*/
|
|
47
|
+
const SingletonColorModeObserver = new ColorModeObserver();
|
|
48
|
+
export default SingletonColorModeObserver;
|