@spectrum-web-components/story-decorator 0.6.4 → 0.6.6-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/decorator.dev.js +32 -0
- package/decorator.dev.js.map +7 -0
- package/decorator.js +12 -23
- package/decorator.js.map +7 -1
- package/package.json +33 -12
- package/sp-story-decorator.dev.js +3 -0
- package/sp-story-decorator.dev.js.map +7 -0
- package/sp-story-decorator.js +3 -14
- package/sp-story-decorator.js.map +7 -1
- package/src/StoryDecorator.dev.js +355 -0
- package/src/StoryDecorator.dev.js.map +7 -0
- package/src/StoryDecorator.js +168 -175
- package/src/StoryDecorator.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/types.dev.js +1 -0
- package/src/types.dev.js.map +7 -0
- package/src/types.js +1 -2
- package/src/types.js.map +7 -1
package/decorator.dev.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { html, render } from "@spectrum-web-components/base";
|
|
2
|
+
import "./sp-story-decorator.dev.js";
|
|
3
|
+
export const themeStyles = html`
|
|
4
|
+
<style>
|
|
5
|
+
#root {
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
.docs-story sp-story-decorator::part(container) {
|
|
9
|
+
min-height: auto;
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
.docs-story sp-story-decorator::part(controls) {
|
|
13
|
+
position: absolute;
|
|
14
|
+
}
|
|
15
|
+
</style>
|
|
16
|
+
`;
|
|
17
|
+
export const swcThemeDecoratorWithConfig = ({ bundled } = { bundled: true }) => (story) => {
|
|
18
|
+
if (!bundled) {
|
|
19
|
+
requestAnimationFrame(() => {
|
|
20
|
+
const decorator = document.querySelector("sp-story-decorator");
|
|
21
|
+
render(story(), decorator);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return html`
|
|
25
|
+
${themeStyles}
|
|
26
|
+
<sp-story-decorator>
|
|
27
|
+
${bundled ? story() : html``}
|
|
28
|
+
</sp-story-decorator>
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
export const swcThemeDecorator = swcThemeDecoratorWithConfig();
|
|
32
|
+
//# sourceMappingURL=decorator.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["decorator.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 { html, render, TemplateResult } from '@spectrum-web-components/base';\nimport './sp-story-decorator.dev.js'\n\nexport const themeStyles = html`\n <style>\n #root {\n padding: 0;\n }\n .docs-story sp-story-decorator::part(container) {\n min-height: auto;\n position: relative;\n }\n .docs-story sp-story-decorator::part(controls) {\n position: absolute;\n }\n </style>\n`;\n\nexport const swcThemeDecoratorWithConfig =\n ({ bundled } = { bundled: true }) =>\n (story: () => TemplateResult) => {\n if (!bundled) {\n requestAnimationFrame(() => {\n const decorator = document.querySelector(\n 'sp-story-decorator'\n ) as HTMLElement;\n render(story(), decorator);\n });\n }\n return html`\n ${themeStyles}\n <sp-story-decorator>\n ${bundled ? story() : html``}\n </sp-story-decorator>\n `;\n };\n\nexport const swcThemeDecorator = swcThemeDecoratorWithConfig();\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AAEO,aAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAepB,aAAM,8BACT,CAAC,EAAE,YAAY,EAAE,SAAS,KAAK,MAC/B,CAAC,UAAgC;AAC7B,MAAI,CAAC,SAAS;AACV,0BAAsB,MAAM;AACxB,YAAM,YAAY,SAAS,cACvB,oBACJ;AACA,aAAO,MAAM,GAAG,SAAS;AAAA,IAC7B,CAAC;AAAA,EACL;AACA,SAAO;AAAA,cACD;AAAA;AAAA,kBAEI,UAAU,MAAM,IAAI;AAAA;AAAA;AAGlC;AAEG,aAAM,oBAAoB,4BAA4B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/decorator.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
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 { html, render } from '@spectrum-web-components/base';
|
|
13
|
-
import './sp-story-decorator.js';
|
|
14
|
-
export const themeStyles = html `
|
|
1
|
+
import { html, render } from "@spectrum-web-components/base";
|
|
2
|
+
import "./sp-story-decorator.js";
|
|
3
|
+
export const themeStyles = html`
|
|
15
4
|
<style>
|
|
16
5
|
#root {
|
|
17
6
|
padding: 0;
|
|
@@ -26,18 +15,18 @@ export const themeStyles = html `
|
|
|
26
15
|
</style>
|
|
27
16
|
`;
|
|
28
17
|
export const swcThemeDecoratorWithConfig = ({ bundled } = { bundled: true }) => (story) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
if (!bundled) {
|
|
19
|
+
requestAnimationFrame(() => {
|
|
20
|
+
const decorator = document.querySelector("sp-story-decorator");
|
|
21
|
+
render(story(), decorator);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return html`
|
|
36
25
|
${themeStyles}
|
|
37
26
|
<sp-story-decorator>
|
|
38
|
-
${bundled ? story() : html
|
|
27
|
+
${bundled ? story() : html``}
|
|
39
28
|
</sp-story-decorator>
|
|
40
29
|
`;
|
|
41
30
|
};
|
|
42
31
|
export const swcThemeDecorator = swcThemeDecoratorWithConfig();
|
|
43
|
-
//# sourceMappingURL=decorator.js.map
|
|
32
|
+
//# sourceMappingURL=decorator.js.map
|
package/decorator.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["decorator.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 { html, render, TemplateResult } from '@spectrum-web-components/base';\nimport './sp-story-decorator.js';\n\nexport const themeStyles = html`\n <style>\n #root {\n padding: 0;\n }\n .docs-story sp-story-decorator::part(container) {\n min-height: auto;\n position: relative;\n }\n .docs-story sp-story-decorator::part(controls) {\n position: absolute;\n }\n </style>\n`;\n\nexport const swcThemeDecoratorWithConfig =\n ({ bundled } = { bundled: true }) =>\n (story: () => TemplateResult) => {\n if (!bundled) {\n requestAnimationFrame(() => {\n const decorator = document.querySelector(\n 'sp-story-decorator'\n ) as HTMLElement;\n render(story(), decorator);\n });\n }\n return html`\n ${themeStyles}\n <sp-story-decorator>\n ${bundled ? story() : html``}\n </sp-story-decorator>\n `;\n };\n\nexport const swcThemeDecorator = swcThemeDecoratorWithConfig();\n"],
|
|
5
|
+
"mappings": "AAYA;AACA;AAEO,aAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAepB,aAAM,8BACT,CAAC,EAAE,YAAY,EAAE,SAAS,KAAK,MAC/B,CAAC,UAAgC;AAC7B,MAAI,CAAC,SAAS;AACV,0BAAsB,MAAM;AACxB,YAAM,YAAY,SAAS,cACvB,oBACJ;AACA,aAAO,MAAM,GAAG,SAAS;AAAA,IAC7B,CAAC;AAAA,EACL;AACA,SAAO;AAAA,cACD;AAAA;AAAA,kBAEI,UAAU,MAAM,IAAI;AAAA;AAAA;AAGlC;AAEG,aAAM,oBAAoB,4BAA4B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/story-decorator",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6-devmode.7+8303f3a2a",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,12 +20,33 @@
|
|
|
20
20
|
"module": "./src/index.js",
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
|
-
"
|
|
23
|
+
".": {
|
|
24
|
+
"development": "./src/index.dev.js",
|
|
25
|
+
"default": "./src/index.js"
|
|
26
|
+
},
|
|
24
27
|
"./package.json": "./package.json",
|
|
28
|
+
"./src/StoryDecorator.js": {
|
|
29
|
+
"development": "./src/StoryDecorator.dev.js",
|
|
30
|
+
"default": "./src/StoryDecorator.js"
|
|
31
|
+
},
|
|
32
|
+
"./src/index.js": {
|
|
33
|
+
"development": "./src/index.dev.js",
|
|
34
|
+
"default": "./src/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./src/types.js": {
|
|
37
|
+
"development": "./src/types.dev.js",
|
|
38
|
+
"default": "./src/types.js"
|
|
39
|
+
},
|
|
25
40
|
"./decorator": "./decorator.js",
|
|
26
|
-
"./decorator.js":
|
|
41
|
+
"./decorator.js": {
|
|
42
|
+
"development": "./decorator.dev.js",
|
|
43
|
+
"default": "./decorator.js"
|
|
44
|
+
},
|
|
27
45
|
"./sp-story-decorator": "./sp-story-decorator.js",
|
|
28
|
-
"./sp-story-decorator.js":
|
|
46
|
+
"./sp-story-decorator.js": {
|
|
47
|
+
"development": "./sp-story-decorator.dev.js",
|
|
48
|
+
"default": "./sp-story-decorator.js"
|
|
49
|
+
}
|
|
29
50
|
},
|
|
30
51
|
"scripts": {
|
|
31
52
|
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
@@ -45,13 +66,13 @@
|
|
|
45
66
|
"lit-html"
|
|
46
67
|
],
|
|
47
68
|
"dependencies": {
|
|
48
|
-
"@spectrum-web-components/base": "^0.5.
|
|
49
|
-
"@spectrum-web-components/field-label": "^0.7.
|
|
50
|
-
"@spectrum-web-components/menu": "^0.14.
|
|
51
|
-
"@spectrum-web-components/overlay": "^0.16.
|
|
52
|
-
"@spectrum-web-components/picker": "^0.11.
|
|
53
|
-
"@spectrum-web-components/switch": "^0.9.
|
|
54
|
-
"@spectrum-web-components/theme": "^0.
|
|
69
|
+
"@spectrum-web-components/base": "^0.5.9-devmode.31+8303f3a2a",
|
|
70
|
+
"@spectrum-web-components/field-label": "^0.7.14-devmode.7+8303f3a2a",
|
|
71
|
+
"@spectrum-web-components/menu": "^0.14.5-devmode.7+8303f3a2a",
|
|
72
|
+
"@spectrum-web-components/overlay": "^0.16.6-devmode.7+8303f3a2a",
|
|
73
|
+
"@spectrum-web-components/picker": "^0.11.6-devmode.7+8303f3a2a",
|
|
74
|
+
"@spectrum-web-components/switch": "^0.9.14-devmode.7+8303f3a2a",
|
|
75
|
+
"@spectrum-web-components/theme": "^0.12.1-devmode.7+8303f3a2a",
|
|
55
76
|
"tslib": "^2.0.0"
|
|
56
77
|
},
|
|
57
78
|
"types": "./src/index.d.ts",
|
|
@@ -60,5 +81,5 @@
|
|
|
60
81
|
"./sp-*.js",
|
|
61
82
|
"./sp-*.ts"
|
|
62
83
|
],
|
|
63
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "8303f3a2a90b0aedc15158797662ccfa8f4a2031"
|
|
64
85
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-story-decorator.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 { StoryDecorator } from './src/StoryDecorator.dev.js'\n\ncustomElements.define('sp-story-decorator', StoryDecorator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-story-decorator': StoryDecorator;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAYA;AAEA,eAAe,OAAO,sBAAsB,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-story-decorator.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 { StoryDecorator } from './src/StoryDecorator.js';
|
|
13
|
-
customElements.define('sp-story-decorator', StoryDecorator);
|
|
14
|
-
//# sourceMappingURL=sp-story-decorator.js.map
|
|
1
|
+
import { StoryDecorator } from "./src/StoryDecorator.js";
|
|
2
|
+
customElements.define("sp-story-decorator", StoryDecorator);
|
|
3
|
+
//# sourceMappingURL=sp-story-decorator.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-story-decorator.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 { StoryDecorator } from './src/StoryDecorator.js';\n\ncustomElements.define('sp-story-decorator', StoryDecorator);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-story-decorator': StoryDecorator;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAYA;AAEA,eAAe,OAAO,sBAAsB,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
css,
|
|
14
|
+
html,
|
|
15
|
+
nothing,
|
|
16
|
+
SpectrumElement
|
|
17
|
+
} from "@spectrum-web-components/base";
|
|
18
|
+
import {
|
|
19
|
+
property,
|
|
20
|
+
queryAsync
|
|
21
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
22
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
23
|
+
import "@spectrum-web-components/theme/sp-theme.js";
|
|
24
|
+
import "@spectrum-web-components/theme/src/themes.js";
|
|
25
|
+
import "@spectrum-web-components/theme/src/express/themes.js";
|
|
26
|
+
import "@spectrum-web-components/field-label/sp-field-label.js";
|
|
27
|
+
import "@spectrum-web-components/picker/sp-picker.js";
|
|
28
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
29
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
30
|
+
import "@spectrum-web-components/switch/sp-switch.js";
|
|
31
|
+
import {
|
|
32
|
+
Theme
|
|
33
|
+
} from "@spectrum-web-components/theme";
|
|
34
|
+
import { ActiveOverlay } from "@spectrum-web-components/overlay";
|
|
35
|
+
import "./types.dev.js";
|
|
36
|
+
const queryString = window.location.search;
|
|
37
|
+
const urlParams = new URLSearchParams(queryString);
|
|
38
|
+
export let dir = urlParams.get("sp_dir") || "ltr";
|
|
39
|
+
export let theme = urlParams.get("sp_theme") || "spectrum";
|
|
40
|
+
export let color = urlParams.get("sp_color") || "light";
|
|
41
|
+
export let scale = urlParams.get("sp_scale") || "medium";
|
|
42
|
+
export let reduceMotion = urlParams.get("sp_reduceMotion") === "true";
|
|
43
|
+
window.__swc_hack_knobs__ = window.__swc_hack_knobs__ || {
|
|
44
|
+
defaultThemeVariant: theme,
|
|
45
|
+
defaultColor: color,
|
|
46
|
+
defaultScale: scale,
|
|
47
|
+
defaultDirection: dir,
|
|
48
|
+
defaultReduceMotion: reduceMotion
|
|
49
|
+
};
|
|
50
|
+
const reduceMotionProperties = css`
|
|
51
|
+
--spectrum-global-animation-duration-100: 0ms;
|
|
52
|
+
--spectrum-global-animation-duration-200: 0ms;
|
|
53
|
+
--spectrum-global-animation-duration-300: 0ms;
|
|
54
|
+
--spectrum-global-animation-duration-400: 0ms;
|
|
55
|
+
--spectrum-global-animation-duration-500: 0ms;
|
|
56
|
+
--spectrum-global-animation-duration-600: 0ms;
|
|
57
|
+
--spectrum-global-animation-duration-700: 0ms;
|
|
58
|
+
--spectrum-global-animation-duration-800: 0ms;
|
|
59
|
+
--spectrum-global-animation-duration-900: 0ms;
|
|
60
|
+
--spectrum-global-animation-duration-1000: 0ms;
|
|
61
|
+
--spectrum-global-animation-duration-2000: 0ms;
|
|
62
|
+
--spectrum-global-animation-duration-4000: 0ms;
|
|
63
|
+
--spectrum-coachmark-animation-indicator-ring-duration: 0ms;
|
|
64
|
+
--swc-test-duration: 1ms;
|
|
65
|
+
`;
|
|
66
|
+
ActiveOverlay.prototype.renderTheme = function(content) {
|
|
67
|
+
const { color: color2, scale: scale2, theme: theme2, lang } = this.theme;
|
|
68
|
+
return html`
|
|
69
|
+
${window.__swc_hack_knobs__.defaultReduceMotion ? html`
|
|
70
|
+
<style>
|
|
71
|
+
sp-theme {
|
|
72
|
+
${reduceMotionProperties}
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
` : html``}
|
|
76
|
+
<sp-theme
|
|
77
|
+
theme=${ifDefined(theme2)}
|
|
78
|
+
color=${ifDefined(color2)}
|
|
79
|
+
scale=${ifDefined(scale2)}
|
|
80
|
+
lang=${ifDefined(lang)}
|
|
81
|
+
part="theme"
|
|
82
|
+
>
|
|
83
|
+
${content}
|
|
84
|
+
</sp-theme>
|
|
85
|
+
`;
|
|
86
|
+
};
|
|
87
|
+
export class StoryDecorator extends SpectrumElement {
|
|
88
|
+
constructor() {
|
|
89
|
+
super(...arguments);
|
|
90
|
+
this.theme = window.__swc_hack_knobs__.defaultThemeVariant;
|
|
91
|
+
this.color = window.__swc_hack_knobs__.defaultColor;
|
|
92
|
+
this.scale = window.__swc_hack_knobs__.defaultScale;
|
|
93
|
+
this.direction = window.__swc_hack_knobs__.defaultDirection;
|
|
94
|
+
this.reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion;
|
|
95
|
+
this.screenshot = false;
|
|
96
|
+
this.ready = false;
|
|
97
|
+
}
|
|
98
|
+
static get styles() {
|
|
99
|
+
return [
|
|
100
|
+
css`
|
|
101
|
+
:host(:focus) {
|
|
102
|
+
outline: none;
|
|
103
|
+
}
|
|
104
|
+
sp-theme {
|
|
105
|
+
overflow-x: hidden;
|
|
106
|
+
display: block;
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
width: 100%;
|
|
109
|
+
min-height: 100vh;
|
|
110
|
+
padding: var(--spectrum-global-dimension-size-100)
|
|
111
|
+
var(--spectrum-global-dimension-size-100)
|
|
112
|
+
calc(
|
|
113
|
+
2 * var(--spectrum-alias-focus-ring-size) +
|
|
114
|
+
var(--spectrum-alias-item-height-m)
|
|
115
|
+
);
|
|
116
|
+
box-sizing: border-box;
|
|
117
|
+
background-color: var(--spectrum-global-color-gray-100);
|
|
118
|
+
color: var(
|
|
119
|
+
--spectrum-body-text-color,
|
|
120
|
+
var(--spectrum-alias-text-color)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
:host([screenshot]) sp-theme {
|
|
124
|
+
padding: var(--spectrum-global-dimension-size-100);
|
|
125
|
+
}
|
|
126
|
+
:host([reduce-motion]) sp-theme {
|
|
127
|
+
${reduceMotionProperties}
|
|
128
|
+
}
|
|
129
|
+
.manage-theme {
|
|
130
|
+
position: fixed;
|
|
131
|
+
bottom: 0;
|
|
132
|
+
left: var(--spectrum-global-dimension-size-200);
|
|
133
|
+
right: var(--spectrum-global-dimension-size-200);
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: flex-end;
|
|
137
|
+
box-sizing: border-box;
|
|
138
|
+
background-color: var(--spectrum-global-color-gray-100);
|
|
139
|
+
padding-bottom: calc(
|
|
140
|
+
2 * var(--spectrum-alias-focus-ring-size)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
[dir='ltr'] sp-field-label {
|
|
144
|
+
padding-left: 0;
|
|
145
|
+
padding-right: var(
|
|
146
|
+
--spectrum-fieldlabel-side-padding-x,
|
|
147
|
+
var(--spectrum-global-dimension-size-100)
|
|
148
|
+
);
|
|
149
|
+
margin-left: var(--spectrum-global-dimension-size-400);
|
|
150
|
+
}
|
|
151
|
+
[dir='ltr'] sp-switch {
|
|
152
|
+
margin-left: var(--spectrum-global-dimension-size-400);
|
|
153
|
+
margin-right: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
}
|
|
156
|
+
[dir='rtl'] sp-field-label {
|
|
157
|
+
padding-right: 0;
|
|
158
|
+
padding-left: var(
|
|
159
|
+
--spectrum-fieldlabel-side-padding-x,
|
|
160
|
+
var(--spectrum-global-dimension-size-100)
|
|
161
|
+
);
|
|
162
|
+
margin-right: var(--spectrum-global-dimension-size-400);
|
|
163
|
+
}
|
|
164
|
+
[dir='rtl'] sp-switch {
|
|
165
|
+
margin-right: var(--spectrum-global-dimension-size-400);
|
|
166
|
+
margin-left: 0;
|
|
167
|
+
padding: 0;
|
|
168
|
+
}
|
|
169
|
+
`
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
async startManagingContentDirection(el) {
|
|
173
|
+
(await this.themeRoot).startManagingContentDirection(el);
|
|
174
|
+
}
|
|
175
|
+
async stopManagingContentDirection(el) {
|
|
176
|
+
(await this.themeRoot).stopManagingContentDirection(el);
|
|
177
|
+
}
|
|
178
|
+
updateTheme({ target }) {
|
|
179
|
+
const { id } = target;
|
|
180
|
+
const { value } = target;
|
|
181
|
+
const { checked } = target;
|
|
182
|
+
switch (id) {
|
|
183
|
+
case "theme":
|
|
184
|
+
this.theme = theme = window.__swc_hack_knobs__.defaultThemeVariant = value;
|
|
185
|
+
break;
|
|
186
|
+
case "color":
|
|
187
|
+
this.color = color = window.__swc_hack_knobs__.defaultColor = value;
|
|
188
|
+
break;
|
|
189
|
+
case "scale":
|
|
190
|
+
this.scale = scale = window.__swc_hack_knobs__.defaultScale = value;
|
|
191
|
+
break;
|
|
192
|
+
case "dir":
|
|
193
|
+
this.direction = dir = window.__swc_hack_knobs__.defaultDirection = value;
|
|
194
|
+
document.documentElement.dir = dir;
|
|
195
|
+
break;
|
|
196
|
+
case "reduceMotion":
|
|
197
|
+
this.reduceMotion = reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion = checked;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
handleKeydown(event) {
|
|
202
|
+
const path = event.composedPath();
|
|
203
|
+
const hasInput = path.some((node) => node instanceof HTMLInputElement);
|
|
204
|
+
if (hasInput) {
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
render() {
|
|
209
|
+
return html`
|
|
210
|
+
<sp-theme
|
|
211
|
+
theme=${this.theme}
|
|
212
|
+
color=${this.color}
|
|
213
|
+
scale=${this.scale}
|
|
214
|
+
dir=${this.direction}
|
|
215
|
+
part="container"
|
|
216
|
+
@keydown=${this.handleKeydown}
|
|
217
|
+
>
|
|
218
|
+
<slot @slotchange=${this.checkReady}></slot>
|
|
219
|
+
${this.screenshot ? nothing : this.manageTheme}
|
|
220
|
+
</sp-theme>
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
async checkReady({
|
|
224
|
+
target
|
|
225
|
+
}) {
|
|
226
|
+
this.ready = false;
|
|
227
|
+
const descendents = target.assignedElements({
|
|
228
|
+
flatten: true
|
|
229
|
+
});
|
|
230
|
+
const litElementDescendents = descendents.filter((el) => el.tagName.search("-") !== -1 && typeof el.updateComplete !== "undefined");
|
|
231
|
+
const updates = litElementDescendents.map((el) => el.updateComplete);
|
|
232
|
+
await Promise.all(updates);
|
|
233
|
+
new Promise((res) => {
|
|
234
|
+
setTimeout(res);
|
|
235
|
+
}).then(async () => {
|
|
236
|
+
await (document.fonts ? document.fonts.ready : Promise.resolve());
|
|
237
|
+
setTimeout(() => this.ready = true);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
get manageTheme() {
|
|
241
|
+
return html`
|
|
242
|
+
<div class="manage-theme" part="controls">
|
|
243
|
+
${this.themeControl} ${this.colorControl} ${this.scaleControl}
|
|
244
|
+
${this.dirControl} ${this.reduceMotionControl}
|
|
245
|
+
</div>
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
get themeControl() {
|
|
249
|
+
return html`
|
|
250
|
+
<sp-field-label for="theme">Spectrum</sp-field-label>
|
|
251
|
+
<sp-picker
|
|
252
|
+
id="theme"
|
|
253
|
+
placement="top"
|
|
254
|
+
quiet
|
|
255
|
+
.value=${this.theme}
|
|
256
|
+
@change=${this.updateTheme}
|
|
257
|
+
>
|
|
258
|
+
<sp-menu-item value="spectrum">Classic</sp-menu-item>
|
|
259
|
+
<sp-menu-item value="express">Express</sp-menu-item>
|
|
260
|
+
</sp-picker>
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
263
|
+
get colorControl() {
|
|
264
|
+
return html`
|
|
265
|
+
<sp-field-label for="color">Theme</sp-field-label>
|
|
266
|
+
<sp-picker
|
|
267
|
+
id="color"
|
|
268
|
+
placement="top"
|
|
269
|
+
quiet
|
|
270
|
+
.value=${this.color}
|
|
271
|
+
@change=${this.updateTheme}
|
|
272
|
+
>
|
|
273
|
+
<sp-menu-item value="lightest">Lightest</sp-menu-item>
|
|
274
|
+
<sp-menu-item value="light">Light</sp-menu-item>
|
|
275
|
+
<sp-menu-item value="dark">Dark</sp-menu-item>
|
|
276
|
+
<sp-menu-item value="darkest">Darkest</sp-menu-item>
|
|
277
|
+
</sp-picker>
|
|
278
|
+
`;
|
|
279
|
+
}
|
|
280
|
+
get scaleControl() {
|
|
281
|
+
return html`
|
|
282
|
+
<sp-field-label for="scale">Scale</sp-field-label>
|
|
283
|
+
<sp-picker
|
|
284
|
+
id="scale"
|
|
285
|
+
label="Scale"
|
|
286
|
+
placement="top"
|
|
287
|
+
quiet
|
|
288
|
+
.value=${this.scale}
|
|
289
|
+
@change=${this.updateTheme}
|
|
290
|
+
>
|
|
291
|
+
<sp-menu-item value="medium">Medium</sp-menu-item>
|
|
292
|
+
<sp-menu-item value="large">Large</sp-menu-item>
|
|
293
|
+
</sp-picker>
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
get dirControl() {
|
|
297
|
+
return html`
|
|
298
|
+
<sp-field-label for="dir">Direction</sp-field-label>
|
|
299
|
+
<sp-picker
|
|
300
|
+
id="dir"
|
|
301
|
+
label="Direction"
|
|
302
|
+
placement="top"
|
|
303
|
+
quiet
|
|
304
|
+
.value=${this.direction}
|
|
305
|
+
@change=${this.updateTheme}
|
|
306
|
+
>
|
|
307
|
+
<sp-menu-item value="ltr">LTR</sp-menu-item>
|
|
308
|
+
<sp-menu-item value="rtl">RTL</sp-menu-item>
|
|
309
|
+
</sp-picker>
|
|
310
|
+
`;
|
|
311
|
+
}
|
|
312
|
+
get reduceMotionControl() {
|
|
313
|
+
return html`
|
|
314
|
+
<sp-switch
|
|
315
|
+
id="reduceMotion"
|
|
316
|
+
?checked=${this.reduceMotion}
|
|
317
|
+
@change=${this.updateTheme}
|
|
318
|
+
>
|
|
319
|
+
Reduce Motion
|
|
320
|
+
</sp-switch>
|
|
321
|
+
`;
|
|
322
|
+
}
|
|
323
|
+
willUpdate(changes) {
|
|
324
|
+
if (changes.has("screenshot") && this.screenshot) {
|
|
325
|
+
Theme.registerThemeFragment("app", "app", css`
|
|
326
|
+
:host {
|
|
327
|
+
--swc-test-caret-color: transparent;
|
|
328
|
+
--swc-test-forced-color-adjust: none;
|
|
329
|
+
}
|
|
330
|
+
`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
__decorateClass([
|
|
335
|
+
property({ type: String })
|
|
336
|
+
], StoryDecorator.prototype, "theme", 2);
|
|
337
|
+
__decorateClass([
|
|
338
|
+
property({ type: String })
|
|
339
|
+
], StoryDecorator.prototype, "color", 2);
|
|
340
|
+
__decorateClass([
|
|
341
|
+
property({ type: String })
|
|
342
|
+
], StoryDecorator.prototype, "scale", 2);
|
|
343
|
+
__decorateClass([
|
|
344
|
+
property({ type: String, reflect: true, attribute: "dir" })
|
|
345
|
+
], StoryDecorator.prototype, "direction", 2);
|
|
346
|
+
__decorateClass([
|
|
347
|
+
property({ type: Boolean, attribute: "reduce-motion", reflect: true })
|
|
348
|
+
], StoryDecorator.prototype, "reduceMotion", 2);
|
|
349
|
+
__decorateClass([
|
|
350
|
+
property({ type: Boolean, reflect: true })
|
|
351
|
+
], StoryDecorator.prototype, "screenshot", 2);
|
|
352
|
+
__decorateClass([
|
|
353
|
+
queryAsync("sp-theme")
|
|
354
|
+
], StoryDecorator.prototype, "themeRoot", 2);
|
|
355
|
+
//# sourceMappingURL=StoryDecorator.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["StoryDecorator.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 {\n css,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n queryAsync,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/theme/src/express/themes.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport '@spectrum-web-components/picker/sp-picker.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/switch/sp-switch.js';\nimport { Picker } from '@spectrum-web-components/picker';\nimport { Switch } from '@spectrum-web-components/switch';\nimport {\n Color,\n Scale,\n Theme,\n ThemeVariant,\n} from '@spectrum-web-components/theme';\nimport { ActiveOverlay } from '@spectrum-web-components/overlay';\nimport './types.dev.js'\n\nconst queryString = window.location.search;\nconst urlParams = new URLSearchParams(queryString);\n\nexport let dir: 'ltr' | 'rtl' =\n (urlParams.get('sp_dir') as 'ltr' | 'rtl') || 'ltr';\nexport let theme: ThemeVariant =\n (urlParams.get('sp_theme') as ThemeVariant) || 'spectrum';\nexport let color: Color = (urlParams.get('sp_color') as Color) || 'light';\nexport let scale: Scale = (urlParams.get('sp_scale') as Scale) || 'medium';\nexport let reduceMotion = urlParams.get('sp_reduceMotion') === 'true';\n\nwindow.__swc_hack_knobs__ = window.__swc_hack_knobs__ || {\n defaultThemeVariant: theme,\n defaultColor: color,\n defaultScale: scale,\n defaultDirection: dir,\n defaultReduceMotion: reduceMotion,\n};\n\nconst reduceMotionProperties = css`\n --spectrum-global-animation-duration-100: 0ms;\n --spectrum-global-animation-duration-200: 0ms;\n --spectrum-global-animation-duration-300: 0ms;\n --spectrum-global-animation-duration-400: 0ms;\n --spectrum-global-animation-duration-500: 0ms;\n --spectrum-global-animation-duration-600: 0ms;\n --spectrum-global-animation-duration-700: 0ms;\n --spectrum-global-animation-duration-800: 0ms;\n --spectrum-global-animation-duration-900: 0ms;\n --spectrum-global-animation-duration-1000: 0ms;\n --spectrum-global-animation-duration-2000: 0ms;\n --spectrum-global-animation-duration-4000: 0ms;\n --spectrum-coachmark-animation-indicator-ring-duration: 0ms;\n --swc-test-duration: 1ms;\n`;\n\nActiveOverlay.prototype.renderTheme = function (\n content: TemplateResult\n): TemplateResult {\n const { color, scale, theme, lang } = this.theme;\n return html`\n ${window.__swc_hack_knobs__.defaultReduceMotion\n ? html`\n <style>\n sp-theme {\n ${reduceMotionProperties}\n }\n </style>\n `\n : html``}\n <sp-theme\n theme=${ifDefined(theme)}\n color=${ifDefined(color)}\n scale=${ifDefined(scale)}\n lang=${ifDefined(lang)}\n part=\"theme\"\n >\n ${content}\n </sp-theme>\n `;\n};\n\nexport class StoryDecorator extends SpectrumElement {\n static override get styles() {\n return [\n css`\n :host(:focus) {\n outline: none;\n }\n sp-theme {\n overflow-x: hidden;\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 100vh;\n padding: var(--spectrum-global-dimension-size-100)\n var(--spectrum-global-dimension-size-100)\n calc(\n 2 * var(--spectrum-alias-focus-ring-size) +\n var(--spectrum-alias-item-height-m)\n );\n box-sizing: border-box;\n background-color: var(--spectrum-global-color-gray-100);\n color: var(\n --spectrum-body-text-color,\n var(--spectrum-alias-text-color)\n );\n }\n :host([screenshot]) sp-theme {\n padding: var(--spectrum-global-dimension-size-100);\n }\n :host([reduce-motion]) sp-theme {\n ${reduceMotionProperties}\n }\n .manage-theme {\n position: fixed;\n bottom: 0;\n left: var(--spectrum-global-dimension-size-200);\n right: var(--spectrum-global-dimension-size-200);\n display: flex;\n align-items: center;\n justify-content: flex-end;\n box-sizing: border-box;\n background-color: var(--spectrum-global-color-gray-100);\n padding-bottom: calc(\n 2 * var(--spectrum-alias-focus-ring-size)\n );\n }\n [dir='ltr'] sp-field-label {\n padding-left: 0;\n padding-right: var(\n --spectrum-fieldlabel-side-padding-x,\n var(--spectrum-global-dimension-size-100)\n );\n margin-left: var(--spectrum-global-dimension-size-400);\n }\n [dir='ltr'] sp-switch {\n margin-left: var(--spectrum-global-dimension-size-400);\n margin-right: 0;\n padding: 0;\n }\n [dir='rtl'] sp-field-label {\n padding-right: 0;\n padding-left: var(\n --spectrum-fieldlabel-side-padding-x,\n var(--spectrum-global-dimension-size-100)\n );\n margin-right: var(--spectrum-global-dimension-size-400);\n }\n [dir='rtl'] sp-switch {\n margin-right: var(--spectrum-global-dimension-size-400);\n margin-left: 0;\n padding: 0;\n }\n `,\n ];\n }\n\n @property({ type: String })\n public theme: ThemeVariant = window.__swc_hack_knobs__.defaultThemeVariant;\n\n @property({ type: String })\n public color: Color = window.__swc_hack_knobs__.defaultColor;\n\n @property({ type: String })\n public scale: Scale = window.__swc_hack_knobs__.defaultScale;\n\n @property({ type: String, reflect: true, attribute: 'dir' })\n public direction: 'ltr' | 'rtl' =\n window.__swc_hack_knobs__.defaultDirection;\n\n @property({ type: Boolean, attribute: 'reduce-motion', reflect: true })\n public reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion;\n\n @property({ type: Boolean, reflect: true })\n public screenshot = false;\n\n @queryAsync('sp-theme')\n private themeRoot!: Theme;\n\n public ready = false;\n\n public async startManagingContentDirection(el: HTMLElement): Promise<void> {\n (await this.themeRoot).startManagingContentDirection(el);\n }\n\n public async stopManagingContentDirection(el: HTMLElement): Promise<void> {\n (await this.themeRoot).stopManagingContentDirection(el);\n }\n\n private updateTheme({ target }: Event & { target: Picker | Switch }): void {\n const { id } = target;\n const { value } = target as Picker;\n const { checked } = target as Switch;\n switch (id) {\n case 'theme':\n this.theme =\n theme =\n window.__swc_hack_knobs__.defaultThemeVariant =\n value as ThemeVariant;\n break;\n case 'color':\n this.color =\n color =\n window.__swc_hack_knobs__.defaultColor =\n value as Color;\n break;\n case 'scale':\n this.scale =\n scale =\n window.__swc_hack_knobs__.defaultScale =\n value as Scale;\n break;\n case 'dir':\n this.direction =\n dir =\n window.__swc_hack_knobs__.defaultDirection =\n value as 'ltr' | 'rtl';\n document.documentElement.dir = dir;\n break;\n case 'reduceMotion':\n this.reduceMotion =\n reduceMotion =\n window.__swc_hack_knobs__.defaultReduceMotion =\n checked as boolean;\n break;\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const path = event.composedPath();\n const hasInput = path.some((node) => node instanceof HTMLInputElement);\n if (hasInput) {\n event.stopPropagation();\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-theme\n theme=${this.theme}\n color=${this.color}\n scale=${this.scale}\n dir=${this.direction}\n part=\"container\"\n @keydown=${this.handleKeydown}\n >\n <slot @slotchange=${this.checkReady}></slot>\n ${this.screenshot ? nothing : this.manageTheme}\n </sp-theme>\n `;\n }\n\n protected async checkReady({\n target,\n }: Event & { target: HTMLSlotElement }): Promise<void> {\n this.ready = false;\n const descendents = target.assignedElements({\n flatten: true,\n }) as SpectrumElement[];\n const litElementDescendents = descendents.filter(\n (el) =>\n el.tagName.search('-') !== -1 &&\n typeof el.updateComplete !== 'undefined'\n );\n const updates = litElementDescendents.map((el) => el.updateComplete);\n await Promise.all(updates);\n new Promise((res) => {\n setTimeout(res);\n }).then(async () => {\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n setTimeout(() => (this.ready = true));\n });\n }\n\n private get manageTheme(): TemplateResult {\n return html`\n <div class=\"manage-theme\" part=\"controls\">\n ${this.themeControl} ${this.colorControl} ${this.scaleControl}\n ${this.dirControl} ${this.reduceMotionControl}\n </div>\n `;\n }\n\n private get themeControl(): TemplateResult {\n return html`\n <sp-field-label for=\"theme\">Spectrum</sp-field-label>\n <sp-picker\n id=\"theme\"\n placement=\"top\"\n quiet\n .value=${this.theme}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"spectrum\">Classic</sp-menu-item>\n <sp-menu-item value=\"express\">Express</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get colorControl(): TemplateResult {\n return html`\n <sp-field-label for=\"color\">Theme</sp-field-label>\n <sp-picker\n id=\"color\"\n placement=\"top\"\n quiet\n .value=${this.color}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"lightest\">Lightest</sp-menu-item>\n <sp-menu-item value=\"light\">Light</sp-menu-item>\n <sp-menu-item value=\"dark\">Dark</sp-menu-item>\n <sp-menu-item value=\"darkest\">Darkest</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get scaleControl(): TemplateResult {\n return html`\n <sp-field-label for=\"scale\">Scale</sp-field-label>\n <sp-picker\n id=\"scale\"\n label=\"Scale\"\n placement=\"top\"\n quiet\n .value=${this.scale}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"medium\">Medium</sp-menu-item>\n <sp-menu-item value=\"large\">Large</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get dirControl(): TemplateResult {\n return html`\n <sp-field-label for=\"dir\">Direction</sp-field-label>\n <sp-picker\n id=\"dir\"\n label=\"Direction\"\n placement=\"top\"\n quiet\n .value=${this.direction}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"ltr\">LTR</sp-menu-item>\n <sp-menu-item value=\"rtl\">RTL</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get reduceMotionControl(): TemplateResult {\n return html`\n <sp-switch\n id=\"reduceMotion\"\n ?checked=${this.reduceMotion}\n @change=${this.updateTheme}\n >\n Reduce Motion\n </sp-switch>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('screenshot') && this.screenshot) {\n Theme.registerThemeFragment(\n 'app',\n 'app',\n css`\n :host {\n --swc-test-caret-color: transparent;\n --swc-test-forced-color-adjust: none;\n }\n `\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA;AAAA;AAMA;AACA;AAEA,MAAM,cAAc,OAAO,SAAS;AACpC,MAAM,YAAY,IAAI,gBAAgB,WAAW;AAE1C,WAAI,MACN,UAAU,IAAI,QAAQ,KAAuB;AAC3C,WAAI,QACN,UAAU,IAAI,UAAU,KAAsB;AAC5C,WAAI,QAAgB,UAAU,IAAI,UAAU,KAAe;AA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21
|
-
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
css,
|
|
14
|
+
html,
|
|
15
|
+
nothing,
|
|
16
|
+
SpectrumElement
|
|
17
|
+
} from "@spectrum-web-components/base";
|
|
18
|
+
import {
|
|
19
|
+
property,
|
|
20
|
+
queryAsync
|
|
21
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
22
|
+
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
23
|
+
import "@spectrum-web-components/theme/sp-theme.js";
|
|
24
|
+
import "@spectrum-web-components/theme/src/themes.js";
|
|
25
|
+
import "@spectrum-web-components/theme/src/express/themes.js";
|
|
26
|
+
import "@spectrum-web-components/field-label/sp-field-label.js";
|
|
27
|
+
import "@spectrum-web-components/picker/sp-picker.js";
|
|
28
|
+
import "@spectrum-web-components/menu/sp-menu.js";
|
|
29
|
+
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
30
|
+
import "@spectrum-web-components/switch/sp-switch.js";
|
|
31
|
+
import {
|
|
32
|
+
Theme
|
|
33
|
+
} from "@spectrum-web-components/theme";
|
|
34
|
+
import { ActiveOverlay } from "@spectrum-web-components/overlay";
|
|
35
|
+
import "./types.js";
|
|
27
36
|
const queryString = window.location.search;
|
|
28
37
|
const urlParams = new URLSearchParams(queryString);
|
|
29
|
-
export let dir = urlParams.get(
|
|
30
|
-
export let theme = urlParams.get(
|
|
31
|
-
export let color = urlParams.get(
|
|
32
|
-
export let scale = urlParams.get(
|
|
33
|
-
export let reduceMotion = urlParams.get(
|
|
38
|
+
export let dir = urlParams.get("sp_dir") || "ltr";
|
|
39
|
+
export let theme = urlParams.get("sp_theme") || "spectrum";
|
|
40
|
+
export let color = urlParams.get("sp_color") || "light";
|
|
41
|
+
export let scale = urlParams.get("sp_scale") || "medium";
|
|
42
|
+
export let reduceMotion = urlParams.get("sp_reduceMotion") === "true";
|
|
34
43
|
window.__swc_hack_knobs__ = window.__swc_hack_knobs__ || {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
defaultThemeVariant: theme,
|
|
45
|
+
defaultColor: color,
|
|
46
|
+
defaultScale: scale,
|
|
47
|
+
defaultDirection: dir,
|
|
48
|
+
defaultReduceMotion: reduceMotion
|
|
40
49
|
};
|
|
41
|
-
const reduceMotionProperties = css
|
|
50
|
+
const reduceMotionProperties = css`
|
|
42
51
|
--spectrum-global-animation-duration-100: 0ms;
|
|
43
52
|
--spectrum-global-animation-duration-200: 0ms;
|
|
44
53
|
--spectrum-global-animation-duration-300: 0ms;
|
|
@@ -54,22 +63,20 @@ const reduceMotionProperties = css `
|
|
|
54
63
|
--spectrum-coachmark-animation-indicator-ring-duration: 0ms;
|
|
55
64
|
--swc-test-duration: 1ms;
|
|
56
65
|
`;
|
|
57
|
-
ActiveOverlay.prototype.renderTheme = function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
${window.__swc_hack_knobs__.defaultReduceMotion
|
|
61
|
-
? html `
|
|
66
|
+
ActiveOverlay.prototype.renderTheme = function(content) {
|
|
67
|
+
const { color: color2, scale: scale2, theme: theme2, lang } = this.theme;
|
|
68
|
+
return html`
|
|
69
|
+
${window.__swc_hack_knobs__.defaultReduceMotion ? html`
|
|
62
70
|
<style>
|
|
63
71
|
sp-theme {
|
|
64
72
|
${reduceMotionProperties}
|
|
65
73
|
}
|
|
66
74
|
</style>
|
|
67
|
-
`
|
|
68
|
-
: html ``}
|
|
75
|
+
` : html``}
|
|
69
76
|
<sp-theme
|
|
70
|
-
theme=${ifDefined(
|
|
71
|
-
color=${ifDefined(
|
|
72
|
-
scale=${ifDefined(
|
|
77
|
+
theme=${ifDefined(theme2)}
|
|
78
|
+
color=${ifDefined(color2)}
|
|
79
|
+
scale=${ifDefined(scale2)}
|
|
73
80
|
lang=${ifDefined(lang)}
|
|
74
81
|
part="theme"
|
|
75
82
|
>
|
|
@@ -78,19 +85,19 @@ ActiveOverlay.prototype.renderTheme = function (content) {
|
|
|
78
85
|
`;
|
|
79
86
|
};
|
|
80
87
|
export class StoryDecorator extends SpectrumElement {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
constructor() {
|
|
89
|
+
super(...arguments);
|
|
90
|
+
this.theme = window.__swc_hack_knobs__.defaultThemeVariant;
|
|
91
|
+
this.color = window.__swc_hack_knobs__.defaultColor;
|
|
92
|
+
this.scale = window.__swc_hack_knobs__.defaultScale;
|
|
93
|
+
this.direction = window.__swc_hack_knobs__.defaultDirection;
|
|
94
|
+
this.reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion;
|
|
95
|
+
this.screenshot = false;
|
|
96
|
+
this.ready = false;
|
|
97
|
+
}
|
|
98
|
+
static get styles() {
|
|
99
|
+
return [
|
|
100
|
+
css`
|
|
94
101
|
:host(:focus) {
|
|
95
102
|
outline: none;
|
|
96
103
|
}
|
|
@@ -159,62 +166,47 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
159
166
|
margin-left: 0;
|
|
160
167
|
padding: 0;
|
|
161
168
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
`
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
async startManagingContentDirection(el) {
|
|
173
|
+
(await this.themeRoot).startManagingContentDirection(el);
|
|
174
|
+
}
|
|
175
|
+
async stopManagingContentDirection(el) {
|
|
176
|
+
(await this.themeRoot).stopManagingContentDirection(el);
|
|
177
|
+
}
|
|
178
|
+
updateTheme({ target }) {
|
|
179
|
+
const { id } = target;
|
|
180
|
+
const { value } = target;
|
|
181
|
+
const { checked } = target;
|
|
182
|
+
switch (id) {
|
|
183
|
+
case "theme":
|
|
184
|
+
this.theme = theme = window.__swc_hack_knobs__.defaultThemeVariant = value;
|
|
185
|
+
break;
|
|
186
|
+
case "color":
|
|
187
|
+
this.color = color = window.__swc_hack_knobs__.defaultColor = value;
|
|
188
|
+
break;
|
|
189
|
+
case "scale":
|
|
190
|
+
this.scale = scale = window.__swc_hack_knobs__.defaultScale = value;
|
|
191
|
+
break;
|
|
192
|
+
case "dir":
|
|
193
|
+
this.direction = dir = window.__swc_hack_knobs__.defaultDirection = value;
|
|
194
|
+
document.documentElement.dir = dir;
|
|
195
|
+
break;
|
|
196
|
+
case "reduceMotion":
|
|
197
|
+
this.reduceMotion = reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion = checked;
|
|
198
|
+
break;
|
|
170
199
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.theme =
|
|
178
|
-
theme =
|
|
179
|
-
window.__swc_hack_knobs__.defaultThemeVariant =
|
|
180
|
-
value;
|
|
181
|
-
break;
|
|
182
|
-
case 'color':
|
|
183
|
-
this.color =
|
|
184
|
-
color =
|
|
185
|
-
window.__swc_hack_knobs__.defaultColor =
|
|
186
|
-
value;
|
|
187
|
-
break;
|
|
188
|
-
case 'scale':
|
|
189
|
-
this.scale =
|
|
190
|
-
scale =
|
|
191
|
-
window.__swc_hack_knobs__.defaultScale =
|
|
192
|
-
value;
|
|
193
|
-
break;
|
|
194
|
-
case 'dir':
|
|
195
|
-
this.direction =
|
|
196
|
-
dir =
|
|
197
|
-
window.__swc_hack_knobs__.defaultDirection =
|
|
198
|
-
value;
|
|
199
|
-
document.documentElement.dir = dir;
|
|
200
|
-
break;
|
|
201
|
-
case 'reduceMotion':
|
|
202
|
-
this.reduceMotion =
|
|
203
|
-
reduceMotion =
|
|
204
|
-
window.__swc_hack_knobs__.defaultReduceMotion =
|
|
205
|
-
checked;
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
200
|
+
}
|
|
201
|
+
handleKeydown(event) {
|
|
202
|
+
const path = event.composedPath();
|
|
203
|
+
const hasInput = path.some((node) => node instanceof HTMLInputElement);
|
|
204
|
+
if (hasInput) {
|
|
205
|
+
event.stopPropagation();
|
|
208
206
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (hasInput) {
|
|
213
|
-
event.stopPropagation();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
render() {
|
|
217
|
-
return html `
|
|
207
|
+
}
|
|
208
|
+
render() {
|
|
209
|
+
return html`
|
|
218
210
|
<sp-theme
|
|
219
211
|
theme=${this.theme}
|
|
220
212
|
color=${this.color}
|
|
@@ -227,33 +219,34 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
227
219
|
${this.screenshot ? nothing : this.manageTheme}
|
|
228
220
|
</sp-theme>
|
|
229
221
|
`;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
222
|
+
}
|
|
223
|
+
async checkReady({
|
|
224
|
+
target
|
|
225
|
+
}) {
|
|
226
|
+
this.ready = false;
|
|
227
|
+
const descendents = target.assignedElements({
|
|
228
|
+
flatten: true
|
|
229
|
+
});
|
|
230
|
+
const litElementDescendents = descendents.filter((el) => el.tagName.search("-") !== -1 && typeof el.updateComplete !== "undefined");
|
|
231
|
+
const updates = litElementDescendents.map((el) => el.updateComplete);
|
|
232
|
+
await Promise.all(updates);
|
|
233
|
+
new Promise((res) => {
|
|
234
|
+
setTimeout(res);
|
|
235
|
+
}).then(async () => {
|
|
236
|
+
await (document.fonts ? document.fonts.ready : Promise.resolve());
|
|
237
|
+
setTimeout(() => this.ready = true);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
get manageTheme() {
|
|
241
|
+
return html`
|
|
249
242
|
<div class="manage-theme" part="controls">
|
|
250
243
|
${this.themeControl} ${this.colorControl} ${this.scaleControl}
|
|
251
244
|
${this.dirControl} ${this.reduceMotionControl}
|
|
252
245
|
</div>
|
|
253
246
|
`;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
247
|
+
}
|
|
248
|
+
get themeControl() {
|
|
249
|
+
return html`
|
|
257
250
|
<sp-field-label for="theme">Spectrum</sp-field-label>
|
|
258
251
|
<sp-picker
|
|
259
252
|
id="theme"
|
|
@@ -266,9 +259,9 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
266
259
|
<sp-menu-item value="express">Express</sp-menu-item>
|
|
267
260
|
</sp-picker>
|
|
268
261
|
`;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
262
|
+
}
|
|
263
|
+
get colorControl() {
|
|
264
|
+
return html`
|
|
272
265
|
<sp-field-label for="color">Theme</sp-field-label>
|
|
273
266
|
<sp-picker
|
|
274
267
|
id="color"
|
|
@@ -283,9 +276,9 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
283
276
|
<sp-menu-item value="darkest">Darkest</sp-menu-item>
|
|
284
277
|
</sp-picker>
|
|
285
278
|
`;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
279
|
+
}
|
|
280
|
+
get scaleControl() {
|
|
281
|
+
return html`
|
|
289
282
|
<sp-field-label for="scale">Scale</sp-field-label>
|
|
290
283
|
<sp-picker
|
|
291
284
|
id="scale"
|
|
@@ -299,9 +292,9 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
299
292
|
<sp-menu-item value="large">Large</sp-menu-item>
|
|
300
293
|
</sp-picker>
|
|
301
294
|
`;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
295
|
+
}
|
|
296
|
+
get dirControl() {
|
|
297
|
+
return html`
|
|
305
298
|
<sp-field-label for="dir">Direction</sp-field-label>
|
|
306
299
|
<sp-picker
|
|
307
300
|
id="dir"
|
|
@@ -315,9 +308,9 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
315
308
|
<sp-menu-item value="rtl">RTL</sp-menu-item>
|
|
316
309
|
</sp-picker>
|
|
317
310
|
`;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
311
|
+
}
|
|
312
|
+
get reduceMotionControl() {
|
|
313
|
+
return html`
|
|
321
314
|
<sp-switch
|
|
322
315
|
id="reduceMotion"
|
|
323
316
|
?checked=${this.reduceMotion}
|
|
@@ -326,37 +319,37 @@ export class StoryDecorator extends SpectrumElement {
|
|
|
326
319
|
Reduce Motion
|
|
327
320
|
</sp-switch>
|
|
328
321
|
`;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
322
|
+
}
|
|
323
|
+
willUpdate(changes) {
|
|
324
|
+
if (changes.has("screenshot") && this.screenshot) {
|
|
325
|
+
Theme.registerThemeFragment("app", "app", css`
|
|
333
326
|
:host {
|
|
334
327
|
--swc-test-caret-color: transparent;
|
|
335
328
|
--swc-test-forced-color-adjust: none;
|
|
336
329
|
}
|
|
337
330
|
`);
|
|
338
|
-
}
|
|
339
331
|
}
|
|
332
|
+
}
|
|
340
333
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
], StoryDecorator.prototype, "theme",
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
], StoryDecorator.prototype, "color",
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
], StoryDecorator.prototype, "scale",
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
], StoryDecorator.prototype, "direction",
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
], StoryDecorator.prototype, "reduceMotion",
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
], StoryDecorator.prototype, "screenshot",
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
], StoryDecorator.prototype, "themeRoot",
|
|
362
|
-
//# sourceMappingURL=StoryDecorator.js.map
|
|
334
|
+
__decorateClass([
|
|
335
|
+
property({ type: String })
|
|
336
|
+
], StoryDecorator.prototype, "theme", 2);
|
|
337
|
+
__decorateClass([
|
|
338
|
+
property({ type: String })
|
|
339
|
+
], StoryDecorator.prototype, "color", 2);
|
|
340
|
+
__decorateClass([
|
|
341
|
+
property({ type: String })
|
|
342
|
+
], StoryDecorator.prototype, "scale", 2);
|
|
343
|
+
__decorateClass([
|
|
344
|
+
property({ type: String, reflect: true, attribute: "dir" })
|
|
345
|
+
], StoryDecorator.prototype, "direction", 2);
|
|
346
|
+
__decorateClass([
|
|
347
|
+
property({ type: Boolean, attribute: "reduce-motion", reflect: true })
|
|
348
|
+
], StoryDecorator.prototype, "reduceMotion", 2);
|
|
349
|
+
__decorateClass([
|
|
350
|
+
property({ type: Boolean, reflect: true })
|
|
351
|
+
], StoryDecorator.prototype, "screenshot", 2);
|
|
352
|
+
__decorateClass([
|
|
353
|
+
queryAsync("sp-theme")
|
|
354
|
+
], StoryDecorator.prototype, "themeRoot", 2);
|
|
355
|
+
//# sourceMappingURL=StoryDecorator.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"file":"StoryDecorator.js","sourceRoot":"","sources":["StoryDecorator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EACH,GAA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;iBAKF,CACJ,CAAC;SACL;IACL,CAAC;CACJ;AA3NG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACkC;AAG7D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACkC;AAG7D;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAEb;AAG/C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACH;AAGpE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACjB;AAG1B;IADC,UAAU,CAAC,UAAU,CAAC;iDACG","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 {\n css,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n queryAsync,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/theme/src/express/themes.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport '@spectrum-web-components/picker/sp-picker.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/switch/sp-switch.js';\nimport { Picker } from '@spectrum-web-components/picker';\nimport { Switch } from '@spectrum-web-components/switch';\nimport {\n Color,\n Scale,\n Theme,\n ThemeVariant,\n} from '@spectrum-web-components/theme';\nimport { ActiveOverlay } from '@spectrum-web-components/overlay';\nimport './types.js';\n\nconst queryString = window.location.search;\nconst urlParams = new URLSearchParams(queryString);\n\nexport let dir: 'ltr' | 'rtl' =\n (urlParams.get('sp_dir') as 'ltr' | 'rtl') || 'ltr';\nexport let theme: ThemeVariant =\n (urlParams.get('sp_theme') as ThemeVariant) || 'spectrum';\nexport let color: Color = (urlParams.get('sp_color') as Color) || 'light';\nexport let scale: Scale = (urlParams.get('sp_scale') as Scale) || 'medium';\nexport let reduceMotion = urlParams.get('sp_reduceMotion') === 'true';\n\nwindow.__swc_hack_knobs__ = window.__swc_hack_knobs__ || {\n defaultThemeVariant: theme,\n defaultColor: color,\n defaultScale: scale,\n defaultDirection: dir,\n defaultReduceMotion: reduceMotion,\n};\n\nconst reduceMotionProperties = css`\n --spectrum-global-animation-duration-100: 0ms;\n --spectrum-global-animation-duration-200: 0ms;\n --spectrum-global-animation-duration-300: 0ms;\n --spectrum-global-animation-duration-400: 0ms;\n --spectrum-global-animation-duration-500: 0ms;\n --spectrum-global-animation-duration-600: 0ms;\n --spectrum-global-animation-duration-700: 0ms;\n --spectrum-global-animation-duration-800: 0ms;\n --spectrum-global-animation-duration-900: 0ms;\n --spectrum-global-animation-duration-1000: 0ms;\n --spectrum-global-animation-duration-2000: 0ms;\n --spectrum-global-animation-duration-4000: 0ms;\n --spectrum-coachmark-animation-indicator-ring-duration: 0ms;\n --swc-test-duration: 1ms;\n`;\n\nActiveOverlay.prototype.renderTheme = function (\n content: TemplateResult\n): TemplateResult {\n const { color, scale, theme, lang } = this.theme;\n return html`\n ${window.__swc_hack_knobs__.defaultReduceMotion\n ? html`\n <style>\n sp-theme {\n ${reduceMotionProperties}\n }\n </style>\n `\n : html``}\n <sp-theme\n theme=${ifDefined(theme)}\n color=${ifDefined(color)}\n scale=${ifDefined(scale)}\n lang=${ifDefined(lang)}\n part=\"theme\"\n >\n ${content}\n </sp-theme>\n `;\n};\n\nexport class StoryDecorator extends SpectrumElement {\n static override get styles() {\n return [\n css`\n :host(:focus) {\n outline: none;\n }\n sp-theme {\n overflow-x: hidden;\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 100vh;\n padding: var(--spectrum-global-dimension-size-100)\n var(--spectrum-global-dimension-size-100)\n calc(\n 2 * var(--spectrum-alias-focus-ring-size) +\n var(--spectrum-alias-item-height-m)\n );\n box-sizing: border-box;\n background-color: var(--spectrum-global-color-gray-100);\n color: var(\n --spectrum-body-text-color,\n var(--spectrum-alias-text-color)\n );\n }\n :host([screenshot]) sp-theme {\n padding: var(--spectrum-global-dimension-size-100);\n }\n :host([reduce-motion]) sp-theme {\n ${reduceMotionProperties}\n }\n .manage-theme {\n position: fixed;\n bottom: 0;\n left: var(--spectrum-global-dimension-size-200);\n right: var(--spectrum-global-dimension-size-200);\n display: flex;\n align-items: center;\n justify-content: flex-end;\n box-sizing: border-box;\n background-color: var(--spectrum-global-color-gray-100);\n padding-bottom: calc(\n 2 * var(--spectrum-alias-focus-ring-size)\n );\n }\n [dir='ltr'] sp-field-label {\n padding-left: 0;\n padding-right: var(\n --spectrum-fieldlabel-side-padding-x,\n var(--spectrum-global-dimension-size-100)\n );\n margin-left: var(--spectrum-global-dimension-size-400);\n }\n [dir='ltr'] sp-switch {\n margin-left: var(--spectrum-global-dimension-size-400);\n margin-right: 0;\n padding: 0;\n }\n [dir='rtl'] sp-field-label {\n padding-right: 0;\n padding-left: var(\n --spectrum-fieldlabel-side-padding-x,\n var(--spectrum-global-dimension-size-100)\n );\n margin-right: var(--spectrum-global-dimension-size-400);\n }\n [dir='rtl'] sp-switch {\n margin-right: var(--spectrum-global-dimension-size-400);\n margin-left: 0;\n padding: 0;\n }\n `,\n ];\n }\n\n @property({ type: String })\n public theme: ThemeVariant = window.__swc_hack_knobs__.defaultThemeVariant;\n\n @property({ type: String })\n public color: Color = window.__swc_hack_knobs__.defaultColor;\n\n @property({ type: String })\n public scale: Scale = window.__swc_hack_knobs__.defaultScale;\n\n @property({ type: String, reflect: true, attribute: 'dir' })\n public direction: 'ltr' | 'rtl' =\n window.__swc_hack_knobs__.defaultDirection;\n\n @property({ type: Boolean, attribute: 'reduce-motion', reflect: true })\n public reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion;\n\n @property({ type: Boolean, reflect: true })\n public screenshot = false;\n\n @queryAsync('sp-theme')\n private themeRoot!: Theme;\n\n public ready = false;\n\n public async startManagingContentDirection(el: HTMLElement): Promise<void> {\n (await this.themeRoot).startManagingContentDirection(el);\n }\n\n public async stopManagingContentDirection(el: HTMLElement): Promise<void> {\n (await this.themeRoot).stopManagingContentDirection(el);\n }\n\n private updateTheme({ target }: Event & { target: Picker | Switch }): void {\n const { id } = target;\n const { value } = target as Picker;\n const { checked } = target as Switch;\n switch (id) {\n case 'theme':\n this.theme =\n theme =\n window.__swc_hack_knobs__.defaultThemeVariant =\n value as ThemeVariant;\n break;\n case 'color':\n this.color =\n color =\n window.__swc_hack_knobs__.defaultColor =\n value as Color;\n break;\n case 'scale':\n this.scale =\n scale =\n window.__swc_hack_knobs__.defaultScale =\n value as Scale;\n break;\n case 'dir':\n this.direction =\n dir =\n window.__swc_hack_knobs__.defaultDirection =\n value as 'ltr' | 'rtl';\n document.documentElement.dir = dir;\n break;\n case 'reduceMotion':\n this.reduceMotion =\n reduceMotion =\n window.__swc_hack_knobs__.defaultReduceMotion =\n checked as boolean;\n break;\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const path = event.composedPath();\n const hasInput = path.some((node) => node instanceof HTMLInputElement);\n if (hasInput) {\n event.stopPropagation();\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-theme\n theme=${this.theme}\n color=${this.color}\n scale=${this.scale}\n dir=${this.direction}\n part=\"container\"\n @keydown=${this.handleKeydown}\n >\n <slot @slotchange=${this.checkReady}></slot>\n ${this.screenshot ? nothing : this.manageTheme}\n </sp-theme>\n `;\n }\n\n protected async checkReady({\n target,\n }: Event & { target: HTMLSlotElement }): Promise<void> {\n this.ready = false;\n const descendents = target.assignedElements({\n flatten: true,\n }) as SpectrumElement[];\n const litElementDescendents = descendents.filter(\n (el) =>\n el.tagName.search('-') !== -1 &&\n typeof el.updateComplete !== 'undefined'\n );\n const updates = litElementDescendents.map((el) => el.updateComplete);\n await Promise.all(updates);\n new Promise((res) => {\n setTimeout(res);\n }).then(async () => {\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n setTimeout(() => (this.ready = true));\n });\n }\n\n private get manageTheme(): TemplateResult {\n return html`\n <div class=\"manage-theme\" part=\"controls\">\n ${this.themeControl} ${this.colorControl} ${this.scaleControl}\n ${this.dirControl} ${this.reduceMotionControl}\n </div>\n `;\n }\n\n private get themeControl(): TemplateResult {\n return html`\n <sp-field-label for=\"theme\">Spectrum</sp-field-label>\n <sp-picker\n id=\"theme\"\n placement=\"top\"\n quiet\n .value=${this.theme}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"spectrum\">Classic</sp-menu-item>\n <sp-menu-item value=\"express\">Express</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get colorControl(): TemplateResult {\n return html`\n <sp-field-label for=\"color\">Theme</sp-field-label>\n <sp-picker\n id=\"color\"\n placement=\"top\"\n quiet\n .value=${this.color}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"lightest\">Lightest</sp-menu-item>\n <sp-menu-item value=\"light\">Light</sp-menu-item>\n <sp-menu-item value=\"dark\">Dark</sp-menu-item>\n <sp-menu-item value=\"darkest\">Darkest</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get scaleControl(): TemplateResult {\n return html`\n <sp-field-label for=\"scale\">Scale</sp-field-label>\n <sp-picker\n id=\"scale\"\n label=\"Scale\"\n placement=\"top\"\n quiet\n .value=${this.scale}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"medium\">Medium</sp-menu-item>\n <sp-menu-item value=\"large\">Large</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get dirControl(): TemplateResult {\n return html`\n <sp-field-label for=\"dir\">Direction</sp-field-label>\n <sp-picker\n id=\"dir\"\n label=\"Direction\"\n placement=\"top\"\n quiet\n .value=${this.direction}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"ltr\">LTR</sp-menu-item>\n <sp-menu-item value=\"rtl\">RTL</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get reduceMotionControl(): TemplateResult {\n return html`\n <sp-switch\n id=\"reduceMotion\"\n ?checked=${this.reduceMotion}\n @change=${this.updateTheme}\n >\n Reduce Motion\n </sp-switch>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('screenshot') && this.screenshot) {\n Theme.registerThemeFragment(\n 'app',\n 'app',\n css`\n :host {\n --swc-test-caret-color: transparent;\n --swc-test-forced-color-adjust: none;\n }\n `\n );\n }\n }\n}\n"]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["StoryDecorator.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 {\n css,\n html,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n queryAsync,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/theme/sp-theme.js';\nimport '@spectrum-web-components/theme/src/themes.js';\nimport '@spectrum-web-components/theme/src/express/themes.js';\nimport '@spectrum-web-components/field-label/sp-field-label.js';\nimport '@spectrum-web-components/picker/sp-picker.js';\nimport '@spectrum-web-components/menu/sp-menu.js';\nimport '@spectrum-web-components/menu/sp-menu-item.js';\nimport '@spectrum-web-components/switch/sp-switch.js';\nimport { Picker } from '@spectrum-web-components/picker';\nimport { Switch } from '@spectrum-web-components/switch';\nimport {\n Color,\n Scale,\n Theme,\n ThemeVariant,\n} from '@spectrum-web-components/theme';\nimport { ActiveOverlay } from '@spectrum-web-components/overlay';\nimport './types.js';\n\nconst queryString = window.location.search;\nconst urlParams = new URLSearchParams(queryString);\n\nexport let dir: 'ltr' | 'rtl' =\n (urlParams.get('sp_dir') as 'ltr' | 'rtl') || 'ltr';\nexport let theme: ThemeVariant =\n (urlParams.get('sp_theme') as ThemeVariant) || 'spectrum';\nexport let color: Color = (urlParams.get('sp_color') as Color) || 'light';\nexport let scale: Scale = (urlParams.get('sp_scale') as Scale) || 'medium';\nexport let reduceMotion = urlParams.get('sp_reduceMotion') === 'true';\n\nwindow.__swc_hack_knobs__ = window.__swc_hack_knobs__ || {\n defaultThemeVariant: theme,\n defaultColor: color,\n defaultScale: scale,\n defaultDirection: dir,\n defaultReduceMotion: reduceMotion,\n};\n\nconst reduceMotionProperties = css`\n --spectrum-global-animation-duration-100: 0ms;\n --spectrum-global-animation-duration-200: 0ms;\n --spectrum-global-animation-duration-300: 0ms;\n --spectrum-global-animation-duration-400: 0ms;\n --spectrum-global-animation-duration-500: 0ms;\n --spectrum-global-animation-duration-600: 0ms;\n --spectrum-global-animation-duration-700: 0ms;\n --spectrum-global-animation-duration-800: 0ms;\n --spectrum-global-animation-duration-900: 0ms;\n --spectrum-global-animation-duration-1000: 0ms;\n --spectrum-global-animation-duration-2000: 0ms;\n --spectrum-global-animation-duration-4000: 0ms;\n --spectrum-coachmark-animation-indicator-ring-duration: 0ms;\n --swc-test-duration: 1ms;\n`;\n\nActiveOverlay.prototype.renderTheme = function (\n content: TemplateResult\n): TemplateResult {\n const { color, scale, theme, lang } = this.theme;\n return html`\n ${window.__swc_hack_knobs__.defaultReduceMotion\n ? html`\n <style>\n sp-theme {\n ${reduceMotionProperties}\n }\n </style>\n `\n : html``}\n <sp-theme\n theme=${ifDefined(theme)}\n color=${ifDefined(color)}\n scale=${ifDefined(scale)}\n lang=${ifDefined(lang)}\n part=\"theme\"\n >\n ${content}\n </sp-theme>\n `;\n};\n\nexport class StoryDecorator extends SpectrumElement {\n static override get styles() {\n return [\n css`\n :host(:focus) {\n outline: none;\n }\n sp-theme {\n overflow-x: hidden;\n display: block;\n box-sizing: border-box;\n width: 100%;\n min-height: 100vh;\n padding: var(--spectrum-global-dimension-size-100)\n var(--spectrum-global-dimension-size-100)\n calc(\n 2 * var(--spectrum-alias-focus-ring-size) +\n var(--spectrum-alias-item-height-m)\n );\n box-sizing: border-box;\n background-color: var(--spectrum-global-color-gray-100);\n color: var(\n --spectrum-body-text-color,\n var(--spectrum-alias-text-color)\n );\n }\n :host([screenshot]) sp-theme {\n padding: var(--spectrum-global-dimension-size-100);\n }\n :host([reduce-motion]) sp-theme {\n ${reduceMotionProperties}\n }\n .manage-theme {\n position: fixed;\n bottom: 0;\n left: var(--spectrum-global-dimension-size-200);\n right: var(--spectrum-global-dimension-size-200);\n display: flex;\n align-items: center;\n justify-content: flex-end;\n box-sizing: border-box;\n background-color: var(--spectrum-global-color-gray-100);\n padding-bottom: calc(\n 2 * var(--spectrum-alias-focus-ring-size)\n );\n }\n [dir='ltr'] sp-field-label {\n padding-left: 0;\n padding-right: var(\n --spectrum-fieldlabel-side-padding-x,\n var(--spectrum-global-dimension-size-100)\n );\n margin-left: var(--spectrum-global-dimension-size-400);\n }\n [dir='ltr'] sp-switch {\n margin-left: var(--spectrum-global-dimension-size-400);\n margin-right: 0;\n padding: 0;\n }\n [dir='rtl'] sp-field-label {\n padding-right: 0;\n padding-left: var(\n --spectrum-fieldlabel-side-padding-x,\n var(--spectrum-global-dimension-size-100)\n );\n margin-right: var(--spectrum-global-dimension-size-400);\n }\n [dir='rtl'] sp-switch {\n margin-right: var(--spectrum-global-dimension-size-400);\n margin-left: 0;\n padding: 0;\n }\n `,\n ];\n }\n\n @property({ type: String })\n public theme: ThemeVariant = window.__swc_hack_knobs__.defaultThemeVariant;\n\n @property({ type: String })\n public color: Color = window.__swc_hack_knobs__.defaultColor;\n\n @property({ type: String })\n public scale: Scale = window.__swc_hack_knobs__.defaultScale;\n\n @property({ type: String, reflect: true, attribute: 'dir' })\n public direction: 'ltr' | 'rtl' =\n window.__swc_hack_knobs__.defaultDirection;\n\n @property({ type: Boolean, attribute: 'reduce-motion', reflect: true })\n public reduceMotion = window.__swc_hack_knobs__.defaultReduceMotion;\n\n @property({ type: Boolean, reflect: true })\n public screenshot = false;\n\n @queryAsync('sp-theme')\n private themeRoot!: Theme;\n\n public ready = false;\n\n public async startManagingContentDirection(el: HTMLElement): Promise<void> {\n (await this.themeRoot).startManagingContentDirection(el);\n }\n\n public async stopManagingContentDirection(el: HTMLElement): Promise<void> {\n (await this.themeRoot).stopManagingContentDirection(el);\n }\n\n private updateTheme({ target }: Event & { target: Picker | Switch }): void {\n const { id } = target;\n const { value } = target as Picker;\n const { checked } = target as Switch;\n switch (id) {\n case 'theme':\n this.theme =\n theme =\n window.__swc_hack_knobs__.defaultThemeVariant =\n value as ThemeVariant;\n break;\n case 'color':\n this.color =\n color =\n window.__swc_hack_knobs__.defaultColor =\n value as Color;\n break;\n case 'scale':\n this.scale =\n scale =\n window.__swc_hack_knobs__.defaultScale =\n value as Scale;\n break;\n case 'dir':\n this.direction =\n dir =\n window.__swc_hack_knobs__.defaultDirection =\n value as 'ltr' | 'rtl';\n document.documentElement.dir = dir;\n break;\n case 'reduceMotion':\n this.reduceMotion =\n reduceMotion =\n window.__swc_hack_knobs__.defaultReduceMotion =\n checked as boolean;\n break;\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const path = event.composedPath();\n const hasInput = path.some((node) => node instanceof HTMLInputElement);\n if (hasInput) {\n event.stopPropagation();\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <sp-theme\n theme=${this.theme}\n color=${this.color}\n scale=${this.scale}\n dir=${this.direction}\n part=\"container\"\n @keydown=${this.handleKeydown}\n >\n <slot @slotchange=${this.checkReady}></slot>\n ${this.screenshot ? nothing : this.manageTheme}\n </sp-theme>\n `;\n }\n\n protected async checkReady({\n target,\n }: Event & { target: HTMLSlotElement }): Promise<void> {\n this.ready = false;\n const descendents = target.assignedElements({\n flatten: true,\n }) as SpectrumElement[];\n const litElementDescendents = descendents.filter(\n (el) =>\n el.tagName.search('-') !== -1 &&\n typeof el.updateComplete !== 'undefined'\n );\n const updates = litElementDescendents.map((el) => el.updateComplete);\n await Promise.all(updates);\n new Promise((res) => {\n setTimeout(res);\n }).then(async () => {\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n setTimeout(() => (this.ready = true));\n });\n }\n\n private get manageTheme(): TemplateResult {\n return html`\n <div class=\"manage-theme\" part=\"controls\">\n ${this.themeControl} ${this.colorControl} ${this.scaleControl}\n ${this.dirControl} ${this.reduceMotionControl}\n </div>\n `;\n }\n\n private get themeControl(): TemplateResult {\n return html`\n <sp-field-label for=\"theme\">Spectrum</sp-field-label>\n <sp-picker\n id=\"theme\"\n placement=\"top\"\n quiet\n .value=${this.theme}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"spectrum\">Classic</sp-menu-item>\n <sp-menu-item value=\"express\">Express</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get colorControl(): TemplateResult {\n return html`\n <sp-field-label for=\"color\">Theme</sp-field-label>\n <sp-picker\n id=\"color\"\n placement=\"top\"\n quiet\n .value=${this.color}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"lightest\">Lightest</sp-menu-item>\n <sp-menu-item value=\"light\">Light</sp-menu-item>\n <sp-menu-item value=\"dark\">Dark</sp-menu-item>\n <sp-menu-item value=\"darkest\">Darkest</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get scaleControl(): TemplateResult {\n return html`\n <sp-field-label for=\"scale\">Scale</sp-field-label>\n <sp-picker\n id=\"scale\"\n label=\"Scale\"\n placement=\"top\"\n quiet\n .value=${this.scale}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"medium\">Medium</sp-menu-item>\n <sp-menu-item value=\"large\">Large</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get dirControl(): TemplateResult {\n return html`\n <sp-field-label for=\"dir\">Direction</sp-field-label>\n <sp-picker\n id=\"dir\"\n label=\"Direction\"\n placement=\"top\"\n quiet\n .value=${this.direction}\n @change=${this.updateTheme}\n >\n <sp-menu-item value=\"ltr\">LTR</sp-menu-item>\n <sp-menu-item value=\"rtl\">RTL</sp-menu-item>\n </sp-picker>\n `;\n }\n\n private get reduceMotionControl(): TemplateResult {\n return html`\n <sp-switch\n id=\"reduceMotion\"\n ?checked=${this.reduceMotion}\n @change=${this.updateTheme}\n >\n Reduce Motion\n </sp-switch>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (changes.has('screenshot') && this.screenshot) {\n Theme.registerThemeFragment(\n 'app',\n 'app',\n css`\n :host {\n --swc-test-caret-color: transparent;\n --swc-test-forced-color-adjust: none;\n }\n `\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAA;AAAA;AAMA;AACA;AAEA,MAAM,cAAc,OAAO,SAAS;AACpC,MAAM,YAAY,IAAI,gBAAgB,WAAW;AAE1C,WAAI,MACN,UAAU,IAAI,QAAQ,KAAuB;AAC3C,WAAI,QACN,UAAU,IAAI,UAAU,KAAsB;AAC5C,WAAI,QAAgB,UAA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AAAA,EAM3B;AAAA,MAEY,sBAAsC;AAC9C,WAAO;AAAA;AAAA;AAAA,2BAGY,KAAK;AAAA,0BACN,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAK3B;AAAA,EAEmB,WAAW,SAAqC;AAC/D,QAAI,QAAQ,IAAI,YAAY,KAAK,KAAK,YAAY;AAC9C,YAAM,sBACF,OACA,OACA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAMJ;AAAA,IACJ;AAAA,EACJ;AACJ;AA3NW;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AA7EJ,eA6EI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAhFJ,eAgFI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAnFJ,eAmFI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,MAAM,CAAC;AAAA,GACpD,AAtFJ,eAsFI;AAIA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,WAAW,iBAAiB,SAAS,KAAK,CAAC;AAAA,GAC/D,AA1FJ,eA0FI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AA7FJ,eA6FI;AAGC;AAAA,EADR,AAAC,WAAW,UAAU;AAAA,GACd,AAhGL,eAgGK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.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\nexport * from './StoryDecorator.dev.js'\n"],
|
|
5
|
+
"mappings": "AAYA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
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
|
-
export * from './StoryDecorator.js';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./StoryDecorator.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.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\nexport * from './StoryDecorator.js';\n"],
|
|
5
|
+
"mappings": "AAYA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/types.dev.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.dev.js.map
|
package/src/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
package/src/types.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|