@spectrum-web-components/theme 0.11.3 → 0.12.1-devmode.7
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/README.md +17 -0
- package/core.dev.js +4 -0
- package/core.dev.js.map +7 -0
- package/core.js +4 -15
- package/core.js.map +7 -1
- package/custom-elements.json +46 -13
- package/express/scale-large.dev.js +5 -0
- package/express/scale-large.dev.js.map +7 -0
- package/express/scale-large.js +5 -16
- package/express/scale-large.js.map +7 -1
- package/express/scale-medium.dev.js +5 -0
- package/express/scale-medium.dev.js.map +7 -0
- package/express/scale-medium.js +5 -16
- package/express/scale-medium.js.map +7 -1
- package/express/theme-dark.dev.js +5 -0
- package/express/theme-dark.dev.js.map +7 -0
- package/express/theme-dark.js +5 -16
- package/express/theme-dark.js.map +7 -1
- package/express/theme-darkest.dev.js +5 -0
- package/express/theme-darkest.dev.js.map +7 -0
- package/express/theme-darkest.js +5 -16
- package/express/theme-darkest.js.map +7 -1
- package/express/theme-light.dev.js +5 -0
- package/express/theme-light.dev.js.map +7 -0
- package/express/theme-light.js +5 -16
- package/express/theme-light.js.map +7 -1
- package/express/theme-lightest.dev.js +5 -0
- package/express/theme-lightest.dev.js.map +7 -0
- package/express/theme-lightest.js +5 -16
- package/express/theme-lightest.js.map +7 -1
- package/package.json +97 -24
- package/scale-large.dev.js +5 -0
- package/scale-large.dev.js.map +7 -0
- package/scale-large.js +5 -16
- package/scale-large.js.map +7 -1
- package/scale-medium.dev.js +5 -0
- package/scale-medium.dev.js.map +7 -0
- package/scale-medium.js +5 -16
- package/scale-medium.js.map +7 -1
- package/sp-theme.dev.js +3 -0
- package/sp-theme.dev.js.map +7 -0
- package/sp-theme.js +3 -14
- package/sp-theme.js.map +7 -1
- package/src/Theme.d.ts +27 -0
- package/src/Theme.dev.js +297 -0
- package/src/Theme.dev.js.map +7 -0
- package/src/Theme.js +275 -313
- package/src/Theme.js.map +7 -1
- package/src/express/core.dev.js +4 -0
- package/src/express/core.dev.js.map +7 -0
- package/src/express/core.js +4 -15
- package/src/express/core.js.map +7 -1
- package/src/express/scale-large.css.dev.js +182 -0
- package/src/express/scale-large.css.dev.js.map +7 -0
- package/src/express/scale-large.css.js +5 -18
- package/src/express/scale-large.css.js.map +7 -1
- package/src/express/scale-medium.css.dev.js +190 -0
- package/src/express/scale-medium.css.dev.js.map +7 -0
- package/src/express/scale-medium.css.js +5 -18
- package/src/express/scale-medium.css.js.map +7 -1
- package/src/express/theme-dark.css.dev.js +56 -0
- package/src/express/theme-dark.css.dev.js.map +7 -0
- package/src/express/theme-dark.css.js +36 -15
- package/src/express/theme-dark.css.js.map +7 -1
- package/src/express/theme-light.css.dev.js +56 -0
- package/src/express/theme-light.css.dev.js.map +7 -0
- package/src/express/theme-light.css.js +36 -15
- package/src/express/theme-light.css.js.map +7 -1
- package/src/express/theme.css.dev.js +1846 -0
- package/src/express/theme.css.dev.js.map +7 -0
- package/src/express/theme.css.js +157 -16
- package/src/express/theme.css.js.map +7 -1
- package/src/express/themes.dev.js +7 -0
- package/src/express/themes.dev.js.map +7 -0
- package/src/express/themes.js +7 -18
- package/src/express/themes.js.map +7 -1
- package/src/index.dev.js +2 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -13
- package/src/index.js.map +7 -1
- package/src/scale-large.css.dev.js +190 -0
- package/src/scale-large.css.dev.js.map +7 -0
- package/src/scale-large.css.js +4 -17
- package/src/scale-large.css.js.map +7 -1
- package/src/scale-medium.css.dev.js +192 -0
- package/src/scale-medium.css.dev.js.map +7 -0
- package/src/scale-medium.css.js +4 -17
- package/src/scale-medium.css.js.map +7 -1
- package/src/theme-dark.css.dev.js +58 -0
- package/src/theme-dark.css.dev.js.map +7 -0
- package/src/theme-dark.css.js +36 -15
- package/src/theme-dark.css.js.map +7 -1
- package/src/theme-darkest.css.dev.js +58 -0
- package/src/theme-darkest.css.dev.js.map +7 -0
- package/src/theme-darkest.css.js +36 -15
- package/src/theme-darkest.css.js.map +7 -1
- package/src/theme-light.css.dev.js +58 -0
- package/src/theme-light.css.dev.js.map +7 -0
- package/src/theme-light.css.js +36 -15
- package/src/theme-light.css.js.map +7 -1
- package/src/theme-lightest.css.dev.js +52 -0
- package/src/theme-lightest.css.dev.js.map +7 -0
- package/src/theme-lightest.css.js +36 -15
- package/src/theme-lightest.css.js.map +7 -1
- package/src/theme.css.dev.js +1840 -0
- package/src/theme.css.dev.js.map +7 -0
- package/src/theme.css.js +171 -16
- package/src/theme.css.js.map +7 -1
- package/src/themes.dev.js +7 -0
- package/src/themes.dev.js.map +7 -0
- package/src/themes.js +7 -18
- package/src/themes.js.map +7 -1
- package/src/typography.css.dev.js +946 -0
- package/src/typography.css.dev.js.map +7 -0
- package/src/typography.css.js +3 -14
- package/src/typography.css.js.map +7 -1
- package/stories/theme.stories.js +38 -43
- package/stories/theme.stories.js.map +7 -1
- package/test/theme-lazy.test.js +90 -108
- package/test/theme-lazy.test.js.map +7 -1
- package/test/theme.test-vrt.js +4 -15
- package/test/theme.test-vrt.js.map +7 -1
- package/test/themes.test.js +103 -120
- package/test/themes.test.js.map +7 -1
- package/theme-dark.dev.js +5 -0
- package/theme-dark.dev.js.map +7 -0
- package/theme-dark.js +5 -16
- package/theme-dark.js.map +7 -1
- package/theme-darkest.dev.js +5 -0
- package/theme-darkest.dev.js.map +7 -0
- package/theme-darkest.js +5 -16
- package/theme-darkest.js.map +7 -1
- package/theme-light.dev.js +5 -0
- package/theme-light.dev.js.map +7 -0
- package/theme-light.js +5 -16
- package/theme-light.js.map +7 -1
- package/theme-lightest.dev.js +5 -0
- package/theme-lightest.dev.js.map +7 -0
- package/theme-lightest.js +5 -16
- package/theme-lightest.js.map +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1-devmode.7+8303f3a2a",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,27 +20,100 @@
|
|
|
20
20
|
"module": "./src/index.js",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
|
-
".":
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
".": {
|
|
24
|
+
"development": "./src/index.dev.js",
|
|
25
|
+
"default": "./src/index.js"
|
|
26
|
+
},
|
|
27
27
|
"./package.json": "./package.json",
|
|
28
|
-
"./
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"./
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"./
|
|
37
|
-
"./
|
|
38
|
-
"./theme-
|
|
39
|
-
"./theme-
|
|
40
|
-
"./theme-
|
|
41
|
-
"./theme-
|
|
42
|
-
"./theme
|
|
43
|
-
"./
|
|
28
|
+
"./src/Theme.js": {
|
|
29
|
+
"development": "./src/Theme.dev.js",
|
|
30
|
+
"default": "./src/Theme.js"
|
|
31
|
+
},
|
|
32
|
+
"./src/index.js": {
|
|
33
|
+
"development": "./src/index.dev.js",
|
|
34
|
+
"default": "./src/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./src/scale-large.css.js": "./src/scale-large.css.js",
|
|
37
|
+
"./src/scale-medium.css.js": "./src/scale-medium.css.js",
|
|
38
|
+
"./src/theme-dark.css.js": "./src/theme-dark.css.js",
|
|
39
|
+
"./src/theme-darkest.css.js": "./src/theme-darkest.css.js",
|
|
40
|
+
"./src/theme-light.css.js": "./src/theme-light.css.js",
|
|
41
|
+
"./src/theme-lightest.css.js": "./src/theme-lightest.css.js",
|
|
42
|
+
"./src/theme.css.js": "./src/theme.css.js",
|
|
43
|
+
"./src/themes.js": {
|
|
44
|
+
"development": "./src/themes.dev.js",
|
|
45
|
+
"default": "./src/themes.js"
|
|
46
|
+
},
|
|
47
|
+
"./src/typography.css.js": "./src/typography.css.js",
|
|
48
|
+
"./express/scale-large.js": {
|
|
49
|
+
"development": "./express/scale-large.dev.js",
|
|
50
|
+
"default": "./express/scale-large.js"
|
|
51
|
+
},
|
|
52
|
+
"./express/scale-medium.js": {
|
|
53
|
+
"development": "./express/scale-medium.dev.js",
|
|
54
|
+
"default": "./express/scale-medium.js"
|
|
55
|
+
},
|
|
56
|
+
"./express/theme-dark.js": {
|
|
57
|
+
"development": "./express/theme-dark.dev.js",
|
|
58
|
+
"default": "./express/theme-dark.js"
|
|
59
|
+
},
|
|
60
|
+
"./express/theme-darkest.js": {
|
|
61
|
+
"development": "./express/theme-darkest.dev.js",
|
|
62
|
+
"default": "./express/theme-darkest.js"
|
|
63
|
+
},
|
|
64
|
+
"./express/theme-light.js": {
|
|
65
|
+
"development": "./express/theme-light.dev.js",
|
|
66
|
+
"default": "./express/theme-light.js"
|
|
67
|
+
},
|
|
68
|
+
"./express/theme-lightest.js": {
|
|
69
|
+
"development": "./express/theme-lightest.dev.js",
|
|
70
|
+
"default": "./express/theme-lightest.js"
|
|
71
|
+
},
|
|
72
|
+
"./src/express/core.js": {
|
|
73
|
+
"development": "./src/express/core.dev.js",
|
|
74
|
+
"default": "./src/express/core.js"
|
|
75
|
+
},
|
|
76
|
+
"./src/express/scale-large.css.js": "./src/express/scale-large.css.js",
|
|
77
|
+
"./src/express/scale-medium.css.js": "./src/express/scale-medium.css.js",
|
|
78
|
+
"./src/express/theme-dark.css.js": "./src/express/theme-dark.css.js",
|
|
79
|
+
"./src/express/theme-light.css.js": "./src/express/theme-light.css.js",
|
|
80
|
+
"./src/express/theme.css.js": "./src/express/theme.css.js",
|
|
81
|
+
"./src/express/themes.js": {
|
|
82
|
+
"development": "./src/express/themes.dev.js",
|
|
83
|
+
"default": "./src/express/themes.js"
|
|
84
|
+
},
|
|
85
|
+
"./core.js": {
|
|
86
|
+
"development": "./core.dev.js",
|
|
87
|
+
"default": "./core.js"
|
|
88
|
+
},
|
|
89
|
+
"./sp-theme.js": {
|
|
90
|
+
"development": "./sp-theme.dev.js",
|
|
91
|
+
"default": "./sp-theme.js"
|
|
92
|
+
},
|
|
93
|
+
"./scale-medium.js": {
|
|
94
|
+
"development": "./scale-medium.dev.js",
|
|
95
|
+
"default": "./scale-medium.js"
|
|
96
|
+
},
|
|
97
|
+
"./scale-large.js": {
|
|
98
|
+
"development": "./scale-large.dev.js",
|
|
99
|
+
"default": "./scale-large.js"
|
|
100
|
+
},
|
|
101
|
+
"./theme-lightest.js": {
|
|
102
|
+
"development": "./theme-lightest.dev.js",
|
|
103
|
+
"default": "./theme-lightest.js"
|
|
104
|
+
},
|
|
105
|
+
"./theme-light.js": {
|
|
106
|
+
"development": "./theme-light.dev.js",
|
|
107
|
+
"default": "./theme-light.js"
|
|
108
|
+
},
|
|
109
|
+
"./theme-dark.js": {
|
|
110
|
+
"development": "./theme-dark.dev.js",
|
|
111
|
+
"default": "./theme-dark.js"
|
|
112
|
+
},
|
|
113
|
+
"./theme-darkest.js": {
|
|
114
|
+
"development": "./theme-darkest.dev.js",
|
|
115
|
+
"default": "./theme-darkest.js"
|
|
116
|
+
}
|
|
44
117
|
},
|
|
45
118
|
"scripts": {
|
|
46
119
|
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
@@ -60,8 +133,8 @@
|
|
|
60
133
|
"lit-html"
|
|
61
134
|
],
|
|
62
135
|
"dependencies": {
|
|
63
|
-
"@spectrum-web-components/base": "^0.5.
|
|
64
|
-
"@spectrum-web-components/styles": "^0.
|
|
136
|
+
"@spectrum-web-components/base": "^0.5.9-devmode.31+8303f3a2a",
|
|
137
|
+
"@spectrum-web-components/styles": "^0.15.1-devmode.7+8303f3a2a",
|
|
65
138
|
"tslib": "^2.0.0"
|
|
66
139
|
},
|
|
67
140
|
"types": "./src/index.d.ts",
|
|
@@ -77,5 +150,5 @@
|
|
|
77
150
|
"./src/express/core.js",
|
|
78
151
|
"./src/express/themes.js"
|
|
79
152
|
],
|
|
80
|
-
"gitHead": "
|
|
153
|
+
"gitHead": "8303f3a2a90b0aedc15158797662ccfa8f4a2031"
|
|
81
154
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["scale-large.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport largeStyles from './src/scale-large.css.js';\nimport { Theme } from './src/Theme.dev.js'\nimport './core.dev.js'\n\nTheme.registerThemeFragment('large', 'scale', largeStyles);\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AACA;AAEA,MAAM,sBAAsB,SAAS,SAAS,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/scale-large.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import largeStyles from './src/scale-large.css.js';
|
|
13
|
-
import { Theme } from './src/Theme.js';
|
|
14
|
-
import './core.js';
|
|
15
|
-
Theme.registerThemeFragment('large', 'scale', largeStyles);
|
|
16
|
-
//# sourceMappingURL=scale-large.js.map
|
|
1
|
+
import largeStyles from "./src/scale-large.css.js";
|
|
2
|
+
import { Theme } from "./src/Theme.js";
|
|
3
|
+
import "./core.js";
|
|
4
|
+
Theme.registerThemeFragment("large", "scale", largeStyles);
|
|
5
|
+
//# sourceMappingURL=scale-large.js.map
|
package/scale-large.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["scale-large.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport largeStyles from './src/scale-large.css.js';\nimport { Theme } from './src/Theme.js';\nimport './core.js';\n\nTheme.registerThemeFragment('large', 'scale', largeStyles);\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AACA;AAEA,MAAM,sBAAsB,SAAS,SAAS,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["scale-medium.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport mediumStyles from './src/scale-medium.css.js';\nimport { Theme } from './src/Theme.dev.js'\nimport './core.dev.js'\n\nTheme.registerThemeFragment('medium', 'scale', mediumStyles);\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AACA;AAEA,MAAM,sBAAsB,UAAU,SAAS,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/scale-medium.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import mediumStyles from './src/scale-medium.css.js';
|
|
13
|
-
import { Theme } from './src/Theme.js';
|
|
14
|
-
import './core.js';
|
|
15
|
-
Theme.registerThemeFragment('medium', 'scale', mediumStyles);
|
|
16
|
-
//# sourceMappingURL=scale-medium.js.map
|
|
1
|
+
import mediumStyles from "./src/scale-medium.css.js";
|
|
2
|
+
import { Theme } from "./src/Theme.js";
|
|
3
|
+
import "./core.js";
|
|
4
|
+
Theme.registerThemeFragment("medium", "scale", mediumStyles);
|
|
5
|
+
//# sourceMappingURL=scale-medium.js.map
|
package/scale-medium.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["scale-medium.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport mediumStyles from './src/scale-medium.css.js';\nimport { Theme } from './src/Theme.js';\nimport './core.js';\n\nTheme.registerThemeFragment('medium', 'scale', mediumStyles);\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AACA;AAEA,MAAM,sBAAsB,UAAU,SAAS,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-theme.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-theme.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Theme } from './src/Theme.dev.js'\n\ncustomElements.define('sp-theme', Theme);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-theme': Theme;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWA;AAEA,eAAe,OAAO,YAAY,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-theme.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { Theme } from './src/Theme.js';
|
|
13
|
-
customElements.define('sp-theme', Theme);
|
|
14
|
-
//# sourceMappingURL=sp-theme.js.map
|
|
1
|
+
import { Theme } from "./src/Theme.js";
|
|
2
|
+
customElements.define("sp-theme", Theme);
|
|
3
|
+
//# sourceMappingURL=sp-theme.js.map
|
package/sp-theme.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-theme.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Theme } from './src/Theme.js';\n\ncustomElements.define('sp-theme', Theme);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-theme': Theme;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWA;AAEA,eAAe,OAAO,YAAY,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Theme.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface ProvideLang {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* @element sp-theme
|
|
42
|
+
* @attr {string} [lang=""] - The language of the content scoped to this `sp-theme` element, see: <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang" target="_blank">MDN reference</a>.
|
|
42
43
|
*
|
|
43
44
|
* @slot - Content on which to apply the CSS Custom Properties defined by the current theme configuration
|
|
44
45
|
*/
|
|
@@ -50,17 +51,43 @@ export declare class Theme extends HTMLElement implements ThemeKindProvider {
|
|
|
50
51
|
static get observedAttributes(): string[];
|
|
51
52
|
_dir: 'ltr' | 'rtl' | '';
|
|
52
53
|
set dir(dir: 'ltr' | 'rtl' | '');
|
|
54
|
+
/**
|
|
55
|
+
* Reading direction of the content scoped to this `sp-theme` element.
|
|
56
|
+
* @type {"ltr" | "rtl" | ""}
|
|
57
|
+
* @attr
|
|
58
|
+
*/
|
|
53
59
|
get dir(): 'ltr' | 'rtl' | '';
|
|
54
60
|
protected attributeChangedCallback(attrName: SettableFragmentTypes | 'lang' | 'dir', old: string | null, value: string | null): void;
|
|
55
61
|
private requestUpdate;
|
|
56
62
|
shadowRoot: ShadowRootWithAdoptedStyleSheets;
|
|
57
63
|
private _theme;
|
|
64
|
+
/**
|
|
65
|
+
* The Spectrum theme that is applied to the content scoped to this `sp-theme` element.
|
|
66
|
+
*
|
|
67
|
+
* A value is requried.
|
|
68
|
+
* @type {"spectrum" | "express" | ""}
|
|
69
|
+
* @attr
|
|
70
|
+
*/
|
|
58
71
|
get theme(): ThemeVariant | '';
|
|
59
72
|
set theme(newValue: ThemeVariant | '');
|
|
60
73
|
private _color;
|
|
74
|
+
/**
|
|
75
|
+
* The Spectrum color stops to apply to content scoped by this `sp-theme` element.
|
|
76
|
+
*
|
|
77
|
+
* A value is requried.
|
|
78
|
+
* @type {"lightest" | "light" | "dark" | "darkest" | ""}
|
|
79
|
+
* @attr
|
|
80
|
+
*/
|
|
61
81
|
get color(): Color | '';
|
|
62
82
|
set color(newValue: Color | '');
|
|
63
83
|
private _scale;
|
|
84
|
+
/**
|
|
85
|
+
* The Spectrum platform scale to apply to content scoped by this `sp-theme` element.
|
|
86
|
+
*
|
|
87
|
+
* A value is requried.
|
|
88
|
+
* @type {"medium" | "large" | ""}
|
|
89
|
+
* @attr
|
|
90
|
+
*/
|
|
64
91
|
get scale(): Scale | '';
|
|
65
92
|
set scale(newValue: Scale | '');
|
|
66
93
|
private get styles();
|
package/src/Theme.dev.js
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import {
|
|
2
|
+
supportsAdoptingStyleSheets
|
|
3
|
+
} from "@spectrum-web-components/base";
|
|
4
|
+
const ThemeVariantValues = ["spectrum", "express"];
|
|
5
|
+
const ScaleValues = ["medium", "large", "medium-express", "large-express"];
|
|
6
|
+
const ColorValues = [
|
|
7
|
+
"light",
|
|
8
|
+
"lightest",
|
|
9
|
+
"dark",
|
|
10
|
+
"darkest",
|
|
11
|
+
"light-express",
|
|
12
|
+
"lightest-express",
|
|
13
|
+
"dark-express",
|
|
14
|
+
"darkest-express"
|
|
15
|
+
];
|
|
16
|
+
const _Theme = class extends HTMLElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this._dir = "";
|
|
20
|
+
this._theme = "spectrum";
|
|
21
|
+
this._color = "";
|
|
22
|
+
this._scale = "";
|
|
23
|
+
this.trackedChildren = /* @__PURE__ */ new Set();
|
|
24
|
+
this._updateRequested = false;
|
|
25
|
+
this._contextConsumers = /* @__PURE__ */ new Map();
|
|
26
|
+
this.attachShadow({ mode: "open" });
|
|
27
|
+
const node = document.importNode(_Theme.template.content, true);
|
|
28
|
+
this.shadowRoot.appendChild(node);
|
|
29
|
+
this.shouldAdoptStyles();
|
|
30
|
+
this.addEventListener("sp-query-theme", this.onQueryTheme);
|
|
31
|
+
this.addEventListener("sp-language-context", this._handleContextPresence);
|
|
32
|
+
this.updateComplete = this.__createDeferredPromise();
|
|
33
|
+
}
|
|
34
|
+
static get observedAttributes() {
|
|
35
|
+
return ["color", "scale", "theme", "lang", "dir"];
|
|
36
|
+
}
|
|
37
|
+
set dir(dir) {
|
|
38
|
+
if (dir === this.dir)
|
|
39
|
+
return;
|
|
40
|
+
this.setAttribute("dir", dir);
|
|
41
|
+
this._dir = dir;
|
|
42
|
+
const targetDir = dir === "rtl" ? dir : "ltr";
|
|
43
|
+
this.trackedChildren.forEach((el) => {
|
|
44
|
+
el.setAttribute("dir", targetDir);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
get dir() {
|
|
48
|
+
return this._dir;
|
|
49
|
+
}
|
|
50
|
+
attributeChangedCallback(attrName, old, value) {
|
|
51
|
+
if (old === value) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (attrName === "color") {
|
|
55
|
+
this.color = value;
|
|
56
|
+
} else if (attrName === "scale") {
|
|
57
|
+
this.scale = value;
|
|
58
|
+
} else if (attrName === "lang" && !!value) {
|
|
59
|
+
this.lang = value;
|
|
60
|
+
this._provideContext();
|
|
61
|
+
} else if (attrName === "theme") {
|
|
62
|
+
this.theme = value;
|
|
63
|
+
} else if (attrName === "dir") {
|
|
64
|
+
this.dir = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
requestUpdate() {
|
|
68
|
+
if (window.ShadyCSS !== void 0 && !window.ShadyCSS.nativeShadow) {
|
|
69
|
+
window.ShadyCSS.styleElement(this);
|
|
70
|
+
} else {
|
|
71
|
+
this.shouldAdoptStyles();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
get theme() {
|
|
75
|
+
const themeFragments = _Theme.themeFragmentsByKind.get("theme");
|
|
76
|
+
const { name } = themeFragments && themeFragments.get("default") || {};
|
|
77
|
+
return this._theme || name || "";
|
|
78
|
+
}
|
|
79
|
+
set theme(newValue) {
|
|
80
|
+
if (newValue === this._theme)
|
|
81
|
+
return;
|
|
82
|
+
const theme = !!newValue && ThemeVariantValues.includes(newValue) ? newValue : this.theme;
|
|
83
|
+
if (theme !== this._theme) {
|
|
84
|
+
this._theme = theme;
|
|
85
|
+
this.requestUpdate();
|
|
86
|
+
}
|
|
87
|
+
if (theme) {
|
|
88
|
+
this.setAttribute("theme", theme);
|
|
89
|
+
} else {
|
|
90
|
+
this.removeAttribute("theme");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
get color() {
|
|
94
|
+
const themeFragments = _Theme.themeFragmentsByKind.get("color");
|
|
95
|
+
const { name } = themeFragments && themeFragments.get("default") || {};
|
|
96
|
+
return this._color || name || "";
|
|
97
|
+
}
|
|
98
|
+
set color(newValue) {
|
|
99
|
+
if (newValue === this._color)
|
|
100
|
+
return;
|
|
101
|
+
const color = !!newValue && ColorValues.includes(newValue) ? newValue : this.color;
|
|
102
|
+
if (color !== this._color) {
|
|
103
|
+
this._color = color;
|
|
104
|
+
this.requestUpdate();
|
|
105
|
+
}
|
|
106
|
+
if (color) {
|
|
107
|
+
this.setAttribute("color", color);
|
|
108
|
+
} else {
|
|
109
|
+
this.removeAttribute("color");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
get scale() {
|
|
113
|
+
const themeFragments = _Theme.themeFragmentsByKind.get("scale");
|
|
114
|
+
const { name } = themeFragments && themeFragments.get("default") || {};
|
|
115
|
+
return this._scale || name || "";
|
|
116
|
+
}
|
|
117
|
+
set scale(newValue) {
|
|
118
|
+
if (newValue === this._scale)
|
|
119
|
+
return;
|
|
120
|
+
const scale = !!newValue && ScaleValues.includes(newValue) ? newValue : this.scale;
|
|
121
|
+
if (scale !== this._scale) {
|
|
122
|
+
this._scale = scale;
|
|
123
|
+
this.requestUpdate();
|
|
124
|
+
}
|
|
125
|
+
if (scale) {
|
|
126
|
+
this.setAttribute("scale", scale);
|
|
127
|
+
} else {
|
|
128
|
+
this.removeAttribute("scale");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
get styles() {
|
|
132
|
+
const themeKinds = [
|
|
133
|
+
..._Theme.themeFragmentsByKind.keys()
|
|
134
|
+
];
|
|
135
|
+
const getStyle = (fragments, name, kind) => {
|
|
136
|
+
const currentStyles = kind && kind !== "theme" && this.theme === "express" ? fragments.get(`${name}-express`) : fragments.get(name);
|
|
137
|
+
const isAppliedFragment = name === "spectrum" || !kind || this.hasAttribute(kind);
|
|
138
|
+
if (currentStyles && isAppliedFragment) {
|
|
139
|
+
return currentStyles.styles;
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
};
|
|
143
|
+
const styles = themeKinds.reduce((acc, kind) => {
|
|
144
|
+
const kindFragments = _Theme.themeFragmentsByKind.get(kind);
|
|
145
|
+
let style;
|
|
146
|
+
if (kind === "app" || kind === "core") {
|
|
147
|
+
style = getStyle(kindFragments, kind);
|
|
148
|
+
} else {
|
|
149
|
+
const { [kind]: name } = this;
|
|
150
|
+
style = getStyle(kindFragments, name, kind);
|
|
151
|
+
}
|
|
152
|
+
if (style) {
|
|
153
|
+
acc.push(style);
|
|
154
|
+
}
|
|
155
|
+
return acc;
|
|
156
|
+
}, []);
|
|
157
|
+
if (true) {
|
|
158
|
+
const issues = [];
|
|
159
|
+
const checkForAttribute = (name, resolvedValue, actualValue) => {
|
|
160
|
+
var _a;
|
|
161
|
+
const themeModifier = this.theme && this.theme !== "spectrum" ? `-${this.theme}` : "";
|
|
162
|
+
if (!resolvedValue) {
|
|
163
|
+
issues.push(`You have not explicitly set the "${name}" attribute and there is no default value on which to fallback.`);
|
|
164
|
+
} else if (!actualValue) {
|
|
165
|
+
issues.push(`You have not explicitly set the "${name}" attribute, the default value ("${resolvedValue}") is being used as a fallback.`);
|
|
166
|
+
} else if (!((_a = _Theme.themeFragmentsByKind.get(name)) == null ? void 0 : _a.get(resolvedValue + themeModifier))) {
|
|
167
|
+
issues.push(`You have set "${name}=${resolvedValue}" but the associated theme fragment has not been loaded.`);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
checkForAttribute("theme", this.theme, this._theme);
|
|
171
|
+
checkForAttribute("color", this.color, this._color);
|
|
172
|
+
checkForAttribute("scale", this.scale, this._scale);
|
|
173
|
+
if (issues.length) {
|
|
174
|
+
window.__swc.issueWarning("theme:api:default", "You are leveraging an <sp-theme> element and the following issues may disrupt your theme delivery:", "https://opensource.adobe.com/spectrum-web-components/components/theme/#example", issues);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return [...styles];
|
|
178
|
+
}
|
|
179
|
+
static get template() {
|
|
180
|
+
if (!this.templateElement) {
|
|
181
|
+
this.templateElement = document.createElement("template");
|
|
182
|
+
this.templateElement.innerHTML = "<slot></slot>";
|
|
183
|
+
}
|
|
184
|
+
return this.templateElement;
|
|
185
|
+
}
|
|
186
|
+
__createDeferredPromise() {
|
|
187
|
+
return new Promise((resolve) => {
|
|
188
|
+
this.__resolve = resolve;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
onQueryTheme(event) {
|
|
192
|
+
if (event.defaultPrevented) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
event.preventDefault();
|
|
196
|
+
const { detail: theme } = event;
|
|
197
|
+
theme.color = this.color || void 0;
|
|
198
|
+
theme.scale = this.scale || void 0;
|
|
199
|
+
theme.lang = this.lang || document.documentElement.lang || navigator.language;
|
|
200
|
+
theme.theme = this.theme || void 0;
|
|
201
|
+
}
|
|
202
|
+
connectedCallback() {
|
|
203
|
+
this.shouldAdoptStyles();
|
|
204
|
+
if (window.ShadyCSS !== void 0) {
|
|
205
|
+
window.ShadyCSS.styleElement(this);
|
|
206
|
+
}
|
|
207
|
+
_Theme.instances.add(this);
|
|
208
|
+
if (!this.hasAttribute("dir")) {
|
|
209
|
+
let dirParent = this.assignedSlot || this.parentNode;
|
|
210
|
+
while (dirParent !== document.documentElement && !(dirParent instanceof _Theme)) {
|
|
211
|
+
dirParent = dirParent.assignedSlot || dirParent.parentNode || dirParent.host;
|
|
212
|
+
}
|
|
213
|
+
this.dir = dirParent.dir === "rtl" ? dirParent.dir : "ltr";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
disconnectedCallback() {
|
|
217
|
+
_Theme.instances.delete(this);
|
|
218
|
+
}
|
|
219
|
+
startManagingContentDirection(el) {
|
|
220
|
+
this.trackedChildren.add(el);
|
|
221
|
+
}
|
|
222
|
+
stopManagingContentDirection(el) {
|
|
223
|
+
this.trackedChildren.delete(el);
|
|
224
|
+
}
|
|
225
|
+
async shouldAdoptStyles() {
|
|
226
|
+
if (!this._updateRequested) {
|
|
227
|
+
this.updateComplete = this.__createDeferredPromise();
|
|
228
|
+
this._updateRequested = true;
|
|
229
|
+
this._updateRequested = await false;
|
|
230
|
+
this.adoptStyles();
|
|
231
|
+
this.__resolve(true);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
adoptStyles() {
|
|
235
|
+
const styles = this.styles;
|
|
236
|
+
if (window.ShadyCSS !== void 0 && !window.ShadyCSS.nativeShadow && window.ShadyCSS.ScopingShim) {
|
|
237
|
+
const fragmentCSS = [];
|
|
238
|
+
for (const [kind, fragments] of _Theme.themeFragmentsByKind) {
|
|
239
|
+
for (const [name, { styles: styles2 }] of fragments) {
|
|
240
|
+
if (name === "default")
|
|
241
|
+
continue;
|
|
242
|
+
let cssText = styles2.cssText;
|
|
243
|
+
if (!_Theme.defaultFragments.has(name)) {
|
|
244
|
+
cssText = cssText.replace(":host", `:host([${kind}='${name}'])`);
|
|
245
|
+
}
|
|
246
|
+
fragmentCSS.push(cssText);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
window.ShadyCSS.ScopingShim.prepareAdoptedCssText(fragmentCSS, this.localName);
|
|
250
|
+
window.ShadyCSS.prepareTemplate(_Theme.template, this.localName);
|
|
251
|
+
} else if (supportsAdoptingStyleSheets) {
|
|
252
|
+
const styleSheets = [];
|
|
253
|
+
for (const style of styles) {
|
|
254
|
+
styleSheets.push(style.styleSheet);
|
|
255
|
+
}
|
|
256
|
+
this.shadowRoot.adoptedStyleSheets = styleSheets;
|
|
257
|
+
} else {
|
|
258
|
+
const styleNodes = this.shadowRoot.querySelectorAll("style");
|
|
259
|
+
styleNodes.forEach((element) => element.remove());
|
|
260
|
+
styles.forEach((s) => {
|
|
261
|
+
const style = document.createElement("style");
|
|
262
|
+
style.textContent = s.cssText;
|
|
263
|
+
this.shadowRoot.appendChild(style);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
static registerThemeFragment(name, kind, styles) {
|
|
268
|
+
const fragmentMap = _Theme.themeFragmentsByKind.get(kind) || /* @__PURE__ */ new Map();
|
|
269
|
+
if (fragmentMap.size === 0) {
|
|
270
|
+
_Theme.themeFragmentsByKind.set(kind, fragmentMap);
|
|
271
|
+
fragmentMap.set("default", { name, styles });
|
|
272
|
+
_Theme.defaultFragments.add(name);
|
|
273
|
+
}
|
|
274
|
+
fragmentMap.set(name, { name, styles });
|
|
275
|
+
_Theme.instances.forEach((instance) => instance.shouldAdoptStyles());
|
|
276
|
+
}
|
|
277
|
+
_provideContext() {
|
|
278
|
+
this._contextConsumers.forEach((consume) => consume(this.lang));
|
|
279
|
+
}
|
|
280
|
+
_handleContextPresence(event) {
|
|
281
|
+
const target = event.composedPath()[0];
|
|
282
|
+
if (this._contextConsumers.has(target)) {
|
|
283
|
+
this._contextConsumers.delete(target);
|
|
284
|
+
} else {
|
|
285
|
+
this._contextConsumers.set(target, event.detail.callback);
|
|
286
|
+
const callback = this._contextConsumers.get(target);
|
|
287
|
+
if (callback) {
|
|
288
|
+
callback(this.lang || document.documentElement.lang || navigator.language);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
export let Theme = _Theme;
|
|
294
|
+
Theme.themeFragmentsByKind = /* @__PURE__ */ new Map();
|
|
295
|
+
Theme.defaultFragments = /* @__PURE__ */ new Set(["spectrum"]);
|
|
296
|
+
Theme.instances = /* @__PURE__ */ new Set();
|
|
297
|
+
//# sourceMappingURL=Theme.dev.js.map
|