godown 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/event-collection.d.ts +1 -1
- package/package.json +4 -4
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +0 -3
- package/react/index.js.map +1 -1
- package/web-components/a/avatar-a.js +40 -40
- package/web-components/a/avatar-a.js.map +1 -1
- package/web-components/a/super-a.js +22 -22
- package/web-components/a/super-a.js.map +1 -1
- package/web-components/button/base-button.js +86 -86
- package/web-components/button/base-button.js.map +1 -1
- package/web-components/carousel/carousel-slider.d.ts +1 -1
- package/web-components/carousel/carousel-slider.d.ts.map +1 -1
- package/web-components/carousel/carousel-slider.js +70 -70
- package/web-components/carousel/carousel-slider.js.map +1 -1
- package/web-components/form/base-form.js +15 -15
- package/web-components/form/base-form.js.map +1 -1
- package/web-components/group/avatar-group.js +13 -13
- package/web-components/group/avatar-group.js.map +1 -1
- package/web-components/group/details-group.js +7 -7
- package/web-components/group/details-group.js.map +1 -1
- package/web-components/group/tab-group.js +45 -45
- package/web-components/group/tab-group.js.map +1 -1
- package/web-components/index.d.ts +0 -1
- package/web-components/index.d.ts.map +1 -1
- package/web-components/index.js +0 -1
- package/web-components/index.js.map +1 -1
- package/web-components/input/base-input.js +73 -73
- package/web-components/input/base-input.js.map +1 -1
- package/web-components/input/input.js +15 -15
- package/web-components/input/input.js.map +1 -1
- package/web-components/input/label-input.js +49 -49
- package/web-components/input/label-input.js.map +1 -1
- package/web-components/input/search-input.js +53 -53
- package/web-components/input/search-input.js.map +1 -1
- package/web-components/input/select-input.js +88 -88
- package/web-components/input/select-input.js.map +1 -1
- package/web-components/input/split-input.js +51 -51
- package/web-components/input/split-input.js.map +1 -1
- package/web-components/input/switch-input.js +36 -36
- package/web-components/input/switch-input.js.map +1 -1
- package/web-components/items/alert-item.js +32 -33
- package/web-components/items/alert-item.js.map +1 -1
- package/web-components/items/card-item.js +54 -54
- package/web-components/items/card-item.js.map +1 -1
- package/web-components/items/drag-box.js +8 -8
- package/web-components/items/drag-box.js.map +1 -1
- package/web-components/items/time-bar.js +8 -9
- package/web-components/items/time-bar.js.map +1 -1
- package/web-components/layout/divider-line.js +11 -11
- package/web-components/layout/divider-line.js.map +1 -1
- package/web-components/layout/flex-flow.js +7 -7
- package/web-components/layout/flex-flow.js.map +1 -1
- package/web-components/layout/nav-aside.js +14 -14
- package/web-components/layout/nav-aside.js.map +1 -1
- package/web-components/layout/nav-layout.js +26 -26
- package/web-components/layout/nav-layout.js.map +1 -1
- package/web-components/loading/loading-progress.d.ts +1 -1
- package/web-components/loading/loading-progress.d.ts.map +1 -1
- package/web-components/loading/loading-progress.js +28 -28
- package/web-components/loading/loading-progress.js.map +1 -1
- package/web-components/loading/skeleton-screen.js +19 -19
- package/web-components/loading/skeleton-screen.js.map +1 -1
- package/web-components/open/open-details.d.ts.map +1 -1
- package/web-components/open/open-details.js +73 -22
- package/web-components/open/open-details.js.map +1 -1
- package/web-components/open/open-dialog.d.ts +5 -16
- package/web-components/open/open-dialog.d.ts.map +1 -1
- package/web-components/open/open-dialog.js +92 -102
- package/web-components/open/open-dialog.js.map +1 -1
- package/web-components/open/open-offset.d.ts +0 -1
- package/web-components/open/open-offset.d.ts.map +1 -1
- package/web-components/open/open-offset.js +50 -53
- package/web-components/open/open-offset.js.map +1 -1
- package/web-components/open/open-tooltip.d.ts +2 -2
- package/web-components/open/open-tooltip.d.ts.map +1 -1
- package/web-components/open/open-tooltip.js +14 -15
- package/web-components/open/open-tooltip.js.map +1 -1
- package/web-components/open/open.d.ts +3 -2
- package/web-components/open/open.d.ts.map +1 -1
- package/web-components/open/open.js +13 -59
- package/web-components/open/open.js.map +1 -1
- package/web-components/text/clip-text.js +8 -8
- package/web-components/text/clip-text.js.map +1 -1
- package/web-components/text/overbreath-text.js +17 -17
- package/web-components/text/overbreath-text.js.map +1 -1
- package/web-components/text/typewriter-text.js +32 -32
- package/web-components/text/typewriter-text.js.map +1 -1
- package/web-components/view/route-view.d.ts +2 -2
- package/web-components/view/route-view.js +7 -7
- package/web-components/view/route-view.js.map +1 -1
- package/web-components/view/scroll-x.js +29 -29
- package/web-components/view/scroll-x.js.map +1 -1
- package/web-components/view/wrap-view.d.ts +1 -1
- package/web-components/view/wrap-view.js +15 -15
- package/web-components/view/wrap-view.js.map +1 -1
- package/open-list.d.ts +0 -2
- package/open-list.d.ts.map +0 -1
- package/open-list.js +0 -2
- package/open-list.js.map +0 -1
- package/web-components/layout/index.d.ts +0 -5
- package/web-components/layout/index.d.ts.map +0 -1
- package/web-components/layout/index.js +0 -6
- package/web-components/layout/index.js.map +0 -1
- package/web-components/open/open-list.d.ts +0 -20
- package/web-components/open/open-list.d.ts.map +0 -1
- package/web-components/open/open-list.js +0 -71
- package/web-components/open/open-list.js.map +0 -1
@@ -21,9 +21,33 @@ let LoadingProgress = class LoadingProgress extends GodownElement {
|
|
21
21
|
*/
|
22
22
|
this.value = null;
|
23
23
|
}
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
render() {
|
25
|
+
let width = 20;
|
26
|
+
let className;
|
27
|
+
if (this.value !== null) {
|
28
|
+
width = this.parsePercent(this.value);
|
29
|
+
className = "v";
|
30
|
+
}
|
31
|
+
return html `<div class="${className}">
|
32
|
+
<i style="width:${width}%;"></i>
|
33
|
+
</div>`;
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* Convert s to a percentage without a percent sign.
|
37
|
+
*
|
38
|
+
* @param s String or number to convert.
|
39
|
+
* @returns Percentage without a percent sign.
|
40
|
+
*/
|
41
|
+
parsePercent(s = "0") {
|
42
|
+
if (String(s).includes("%")) {
|
43
|
+
return parseFloat(String(s));
|
44
|
+
}
|
45
|
+
return (parseFloat(String(s)) / (this.max - this.min)) * 100;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
LoadingProgress.styles = [
|
49
|
+
GodownElement.styles,
|
50
|
+
css `
|
27
51
|
:host,
|
28
52
|
div {
|
29
53
|
display: inline-flex;
|
@@ -60,31 +84,7 @@ let LoadingProgress = class LoadingProgress extends GodownElement {
|
|
60
84
|
animation: none;
|
61
85
|
}
|
62
86
|
`,
|
63
|
-
|
64
|
-
render() {
|
65
|
-
let width = 20;
|
66
|
-
let className;
|
67
|
-
if (this.value !== null) {
|
68
|
-
width = this.parsePercent(this.value);
|
69
|
-
className = "v";
|
70
|
-
}
|
71
|
-
return html `<div class="${className}">
|
72
|
-
<i style="width:${width}%;"></i>
|
73
|
-
</div>`;
|
74
|
-
}
|
75
|
-
/**
|
76
|
-
* Convert s to a percentage without a percent sign.
|
77
|
-
*
|
78
|
-
* @param s String or number to convert.
|
79
|
-
* @returns Percentage without a percent sign.
|
80
|
-
*/
|
81
|
-
parsePercent(s = "0") {
|
82
|
-
if (String(s).includes("%")) {
|
83
|
-
return parseFloat(String(s));
|
84
|
-
}
|
85
|
-
return (parseFloat(String(s)) / (this.max - this.min)) * 100;
|
86
|
-
}
|
87
|
-
};
|
87
|
+
];
|
88
88
|
__decorate([
|
89
89
|
property({ type: Number })
|
90
90
|
], LoadingProgress.prototype, "max", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"loading-progress.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/loading/loading-progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;GAEG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,aAAa;IAA3C;;QACL;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACwC,UAAK,GAAG,IAAI,CAAC;IAmE1D,CAAC;
|
1
|
+
{"version":3,"file":"loading-progress.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/loading/loading-progress.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;GAEG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,aAAa;IAA3C;;QACL;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACyB,QAAG,GAAG,CAAC,CAAC;QACpC;;WAEG;QACwC,UAAK,GAAG,IAAI,CAAC;IAmE1D,CAAC;IAxBW,MAAM;QACd,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,SAAiB,CAAC;QACtB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxB,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,SAAS,GAAG,GAAG,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAA,eAAe,SAAS;wBACf,KAAK;WAClB,CAAC;IACV,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAqB,GAAG;QACnC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC/D,CAAC;;AAhEM,sBAAM,GAAG;IACd,aAAa,CAAC,MAAM;IACpB,GAAG,CAAA;;;;;;;;0BAQmB,YAAY,CAAC,KAAK;;;;;;;;;;0BAUlB,YAAY,CAAC,MAAM;;;;;;;;;;;;;;;;;;KAkBxC;CACgB,AAvCN,CAuCO;AAjDQ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAS;AAIR;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAS;AAIO;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAc;AAZ7C,eAAe;IAD3B,MAAM,CAAC,UAAU,CAAC;GACN,eAAe,CA+E3B;;AAED,eAAe,eAAe,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property } from \"../../deps.js\";\nimport { type HTMLTemplate } from \"../../lib/templates.js\";\nimport { cssvarValues, define, GodownElement } from \"../../root.js\";\n\nconst defineName = \"loading-progress\";\n\n/**\n * LoadProgress similar to progress.\n */\n@define(defineName)\nexport class LoadingProgress extends GodownElement {\n /**\n * Maximum.\n */\n @property({ type: Number }) max = 1;\n /**\n * Minimum.\n */\n @property({ type: Number }) min = 0;\n /**\n * Input value.\n */\n @property({ type: Number, reflect: true }) value = null;\n\n static styles = [\n GodownElement.styles,\n css`\n :host,\n div {\n display: inline-flex;\n position: relative;\n width: 10em;\n height: 0.5em;\n border-radius: 0.25em;\n background: var(${cssvarValues.input}--false);\n z-index: 1;\n }\n\n div i {\n position: absolute;\n border-radius: inherit;\n top: 0;\n left: 0;\n height: 100%;\n background: var(${cssvarValues.cssvar}--accept);\n z-index: 2;\n transition: all 0.3s;\n animation: progress 1.5s ease-in-out infinite alternate;\n }\n\n @keyframes progress {\n from {\n left: 0;\n }\n to {\n left: 80%;\n }\n }\n\n div.v i {\n animation: none;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n let width = 20;\n let className: string;\n if (this.value !== null) {\n width = this.parsePercent(this.value);\n className = \"v\";\n }\n return html`<div class=\"${className}\">\n <i style=\"width:${width}%;\"></i>\n </div>`;\n }\n\n /**\n * Convert s to a percentage without a percent sign.\n *\n * @param s String or number to convert.\n * @returns Percentage without a percent sign.\n */\n parsePercent(s: string | number = \"0\"): number {\n if (String(s).includes(\"%\")) {\n return parseFloat(String(s));\n }\n return (parseFloat(String(s)) / (this.max - this.min)) * 100;\n }\n}\n\nexport default LoadingProgress;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"loading-progress\": LoadingProgress;\n }\n}\n"]}
|
@@ -25,9 +25,24 @@ let SkeletonScreen = class SkeletonScreen extends GodownElement {
|
|
25
25
|
*/
|
26
26
|
this.loading = true;
|
27
27
|
}
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
render() {
|
29
|
+
if (this.loading) {
|
30
|
+
return html `<p class="${this.animation}">${this.renderIcon()}</p>`;
|
31
|
+
}
|
32
|
+
return htmlSlot();
|
33
|
+
}
|
34
|
+
renderIcon() {
|
35
|
+
switch (this.type) {
|
36
|
+
case "text":
|
37
|
+
return htmlSlot("icon");
|
38
|
+
case "image":
|
39
|
+
return svgImage();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
};
|
43
|
+
SkeletonScreen.styles = [
|
44
|
+
GodownElement.styles,
|
45
|
+
css `
|
31
46
|
:host {
|
32
47
|
display: block;
|
33
48
|
min-height: 1.5em;
|
@@ -104,22 +119,7 @@ let SkeletonScreen = class SkeletonScreen extends GodownElement {
|
|
104
119
|
justify-content: center;
|
105
120
|
}
|
106
121
|
`,
|
107
|
-
|
108
|
-
render() {
|
109
|
-
if (this.loading) {
|
110
|
-
return html `<p class="${this.animation}">${this.renderIcon()}</p>`;
|
111
|
-
}
|
112
|
-
return htmlSlot();
|
113
|
-
}
|
114
|
-
renderIcon() {
|
115
|
-
switch (this.type) {
|
116
|
-
case "text":
|
117
|
-
return htmlSlot("icon");
|
118
|
-
case "image":
|
119
|
-
return svgImage();
|
120
|
-
}
|
121
|
-
}
|
122
|
-
};
|
122
|
+
];
|
123
123
|
__decorate([
|
124
124
|
property()
|
125
125
|
], SkeletonScreen.prototype, "type", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"skeleton-screen.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/loading/skeleton-screen.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEjF,MAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C;;;;GAIG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,aAAa;IAA1C;;QACL;;WAEG;QACS,SAAI,GAAqB,MAAM,CAAC;QAC5C;;WAEG;QACS,cAAS,GAA2B,UAAU,CAAC;QAC3D;;WAEG;QACM,YAAO,GAAG,IAAI,CAAC;IAkG1B,CAAC;
|
1
|
+
{"version":3,"file":"skeleton-screen.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/loading/skeleton-screen.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEjF,MAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C;;;;GAIG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,aAAa;IAA1C;;QACL;;WAEG;QACS,SAAI,GAAqB,MAAM,CAAC;QAC5C;;WAEG;QACS,cAAS,GAA2B,UAAU,CAAC;QAC3D;;WAEG;QACM,YAAO,GAAG,IAAI,CAAC;IAkG1B,CAAC;IAfW,MAAM;QACd,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,IAAI,CAAA,aAAa,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;QACrE,CAAC;QACD,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAEO,UAAU;QAChB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,MAAM;gBACT,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1B,KAAK,OAAO;gBACV,OAAO,QAAQ,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;;AA/FM,qBAAM,GAAG;IACd,aAAa,CAAC,MAAM;IACpB,GAAG,CAAA;;;;;;UAMG,WAAW,mBAAmB,YAAY,CAAC,OAAO;UAClD,WAAW,iBAAiB,YAAY,CAAC,OAAO;UAChD,WAAW;UACX,WAAW,oBAAoB,YAAY,CAAC,OAAO;UACnD,WAAW,qBAAqB,YAAY,CAAC,IAAI;UACjD,WAAW;UACX,WAAW;UACX,WAAW;UACX,WAAW;qBACA,WAAW;0BACN,WAAW;;;;;;yBAMZ,WAAW;;;;gDAIY,WAAW,eAAe,WAAW,oBAAoB,WAAW,kBAAkB,WAAW;;;;;;;;;;;;;;;;0BAgBvH,WAAW;;;;;;;;;;;;;;;oBAejB,WAAW;;;;;qBAKV,WAAW;sBACV,WAAW;;;;sBAIX,WAAW;;;;;;;;;KAS5B;CACgB,AA/EN,CA+EO;AAzFR;IAAX,QAAQ,EAAE;4CAAiC;AAIhC;IAAX,QAAQ,EAAE;iDAAgD;AAIlD;IAAR,KAAK,EAAE;+CAAgB;AAZb,cAAc;IAD1B,MAAM,CAAC,UAAU,CAAC;GACN,cAAc,CA8G1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, state } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate, svgImage } from \"../../lib/templates.js\";\nimport { createScope, cssvarValues, define, GodownElement } from \"../../root.js\";\n\nconst defineName = \"skeleton-screen\";\nconst cssvarScope = createScope(defineName);\n\n/**\n * SkeletonScreen renders a skeleton screen.\n *\n * Inspired by Ant-design.\n */\n@define(defineName)\nexport class SkeletonScreen extends GodownElement {\n /**\n * Skeleton type.\n */\n @property() type: \"text\" | \"image\" = \"text\";\n /**\n * Animation type.\n */\n @property() animation: \"position\" | \"opacity\" = \"position\";\n /**\n * If false, hidden.\n */\n @state() loading = true;\n\n static styles = [\n GodownElement.styles,\n css`\n :host {\n display: block;\n min-height: 1.5em;\n width: 100%;\n overflow: hidden;\n ${cssvarScope}--from: rgb(var(${cssvarValues.textRGB}) / 7.5%);\n ${cssvarScope}--to: rgb(var(${cssvarValues.textRGB}) / 20%);\n ${cssvarScope}--deg: 94deg;\n ${cssvarScope}--color: rgb(var(${cssvarValues.textRGB}) / 50%);\n ${cssvarScope}--background: var(${cssvarValues.main});\n ${cssvarScope}--duration: 1.5s;\n ${cssvarScope}--icon-width: 5em;\n ${cssvarScope}--icon-height: 5em;\n ${cssvarScope}--icon-margin: .75em;\n color: var(${cssvarScope}--color);\n background: var(${cssvarScope}--background);\n }\n\n p {\n height: 100%;\n min-height: inherit;\n animation: var(${cssvarScope}--duration) ease-in-out 0s infinite none running;\n }\n\n p.position {\n background-image: linear-gradient(var(${cssvarScope}--deg), var(${cssvarScope}--from) 36%, var(${cssvarScope}--to) 50%, var(${cssvarScope}--from) 64%);\n background-color: transparent;\n background-size: 200% 100%;\n animation-name: po;\n }\n\n @keyframes po {\n from {\n background-position: 150% center;\n }\n to {\n background-position: -50% center;\n }\n }\n\n p.opacity {\n background: var(${cssvarScope}--from);\n animation-name: op;\n animation-direction: alternate;\n }\n\n @keyframes op {\n 50% {\n opacity: 0.2;\n }\n to {\n opacity: 1;\n }\n }\n\n path {\n fill: var(${cssvarScope}--color);\n }\n\n svg,\n slot {\n width: var(${cssvarScope}--icon-width);\n height: var(${cssvarScope}--icon-height);\n }\n\n svg {\n margin: var(${cssvarScope}--icon-margin);\n }\n\n p,\n svg {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n if (this.loading) {\n return html`<p class=\"${this.animation}\">${this.renderIcon()}</p>`;\n }\n return htmlSlot();\n }\n\n private renderIcon(): HTMLTemplate {\n switch (this.type) {\n case \"text\":\n return htmlSlot(\"icon\");\n case \"image\":\n return svgImage();\n }\n }\n}\n\nexport default SkeletonScreen;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"skeleton-screen\": SkeletonScreen;\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"open-details.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/open/open-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAyB,MAAM,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"open-details.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/open/open-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,cAAc,EAAyB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAY,KAAK,YAAY,EAAkB,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5C;;GAEG;AACH,qBACa,WAAY,SAAQ,eAAe;IAC9C;;OAEG;IAC0B,IAAI,UAAS;IAC1C;;OAEG;IAC0B,OAAO,UAAS;IAEhC,GAAG,EAAE,mBAAmB,CAAC;IAEtC,MAAM,CAAC,MAAM,iBAoEO;IAEpB,SAAS,CAAC,MAAM,IAAI,YAAY;IAYhC,OAAO,CAAC,UAAU;IAOlB,SAAS,CAAC,YAAY;CAKvB;AAED,eAAe,WAAW,CAAC;AAE3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
2
|
import { css, html, property, query } from "../../deps.js";
|
3
|
-
import { ifValue } from "../../lib/directives.js";
|
4
3
|
import { htmlSlot, svgDeltaSmooth } from "../../lib/templates.js";
|
5
|
-
import { define } from "../../root.js";
|
4
|
+
import { createScope, cssvarValues, define } from "../../root.js";
|
6
5
|
import { OpenableElement } from "./open.js";
|
7
6
|
const defineName = "open-details";
|
7
|
+
const cssvarScope = createScope(defineName);
|
8
8
|
/**
|
9
9
|
* OpenDetails similar to details.
|
10
10
|
*/
|
@@ -20,29 +20,11 @@ let OpenDetails = class OpenDetails extends OpenableElement {
|
|
20
20
|
*/
|
21
21
|
this.reverse = false;
|
22
22
|
}
|
23
|
-
static { this.styles = [
|
24
|
-
OpenableElement.styles,
|
25
|
-
css `
|
26
|
-
i {
|
27
|
-
height: 1.2em;
|
28
|
-
min-width: 1.2em;
|
29
|
-
aspect-ratio: 1/1;
|
30
|
-
display: flex;
|
31
|
-
margin-left: auto;
|
32
|
-
-webkit-backface-visibility: hidden;
|
33
|
-
backface-visibility: hidden;
|
34
|
-
}
|
35
|
-
|
36
|
-
:host([open]) i {
|
37
|
-
transform: rotate(-90deg) !important;
|
38
|
-
}
|
39
|
-
`,
|
40
|
-
]; }
|
41
23
|
render() {
|
42
24
|
return html `<dl>
|
43
|
-
<dt @click="${this._handelClick}"
|
25
|
+
<dt @click="${this._handelClick}">
|
44
26
|
<span> ${this.summary || htmlSlot("summary")} </span>
|
45
|
-
<i
|
27
|
+
<i>${this.renderIcon()}</i>
|
46
28
|
</dt>
|
47
29
|
<dd>
|
48
30
|
<section>${htmlSlot()}</section>
|
@@ -61,6 +43,75 @@ let OpenDetails = class OpenDetails extends OpenableElement {
|
|
61
43
|
}
|
62
44
|
}
|
63
45
|
};
|
46
|
+
OpenDetails.styles = [
|
47
|
+
OpenableElement.styles,
|
48
|
+
css `
|
49
|
+
:host {
|
50
|
+
color: var(${cssvarValues.text});
|
51
|
+
${cssvarScope}--icon-deg-open: -90deg;
|
52
|
+
${cssvarScope}--icon-deg: 0deg;
|
53
|
+
${cssvarScope}--summary-direction: row;
|
54
|
+
}
|
55
|
+
span {
|
56
|
+
display: inline-flex;
|
57
|
+
align-items: center;
|
58
|
+
white-space: nowrap;
|
59
|
+
}
|
60
|
+
|
61
|
+
dl {
|
62
|
+
height: 100%;
|
63
|
+
position: relative;
|
64
|
+
overflow: hidden;
|
65
|
+
}
|
66
|
+
|
67
|
+
dt {
|
68
|
+
display: flex;
|
69
|
+
flex-wrap: nowrap;
|
70
|
+
justify-content: space-between;
|
71
|
+
background: inherit;
|
72
|
+
align-items: center;
|
73
|
+
height: 100%;
|
74
|
+
flex-direction: var(${cssvarScope}--summary-direction);
|
75
|
+
}
|
76
|
+
|
77
|
+
dd {
|
78
|
+
overflow: hidden;
|
79
|
+
display: grid;
|
80
|
+
grid-template-rows: 0fr;
|
81
|
+
}
|
82
|
+
|
83
|
+
* {
|
84
|
+
transition: inherit;
|
85
|
+
}
|
86
|
+
|
87
|
+
section {
|
88
|
+
min-height: 0;
|
89
|
+
overflow: hidden;
|
90
|
+
}
|
91
|
+
|
92
|
+
i {
|
93
|
+
height: 1em;
|
94
|
+
wdith: 1em;
|
95
|
+
display: flex;
|
96
|
+
-webkit-backface-visibility: hidden;
|
97
|
+
backface-visibility: hidden;
|
98
|
+
transform: rotate(var(${cssvarScope}--icon-deg));
|
99
|
+
}
|
100
|
+
|
101
|
+
:host([open]) dd {
|
102
|
+
grid-template-rows: 1fr;
|
103
|
+
}
|
104
|
+
|
105
|
+
:host([float]) dd {
|
106
|
+
top: 100%;
|
107
|
+
position: absolute;
|
108
|
+
}
|
109
|
+
|
110
|
+
:host([open]) i {
|
111
|
+
transform: rotate(var(${cssvarScope}--icon-deg-open));
|
112
|
+
}
|
113
|
+
`,
|
114
|
+
];
|
64
115
|
__decorate([
|
65
116
|
property({ type: Boolean })
|
66
117
|
], OpenDetails.prototype, "fill", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"open-details.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/open/open-details.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"open-details.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/open/open-details.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,eAAe;IAAzC;;QACL;;WAEG;QAC0B,SAAI,GAAG,KAAK,CAAC;QAC1C;;WAEG;QAC0B,YAAO,GAAG,KAAK,CAAC;IAkG/C,CAAC;IAxBW,MAAM;QACd,OAAO,IAAI,CAAA;oBACK,IAAI,CAAC,YAAY;iBACpB,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC;aACvC,IAAI,CAAC,UAAU,EAAE;;;mBAGX,QAAQ,EAAE;;UAEnB,CAAC;IACT,CAAC;IAEO,UAAU;QAChB,IAAI,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC1C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,cAAc,EAAE,CAAC;IAC1B,CAAC;IAES,YAAY;QACpB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;;AA7FM,kBAAM,GAAG;IACd,eAAe,CAAC,MAAM;IACtB,GAAG,CAAA;;qBAEc,YAAY,CAAC,IAAI;UAC5B,WAAW;UACX,WAAW;UACX,WAAW;;;;;;;;;;;;;;;;;;;;;8BAqBS,WAAW;;;;;;;;;;;;;;;;;;;;;;;;gCAwBT,WAAW;;;;;;;;;;;;;gCAaX,WAAW;;KAEtC;CACgB,AApEN,CAoEO;AA5ES;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAc;AAIb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAiB;AAEhC;IAAZ,KAAK,CAAC,IAAI,CAAC;wCAA0B;AAV3B,WAAW;IADvB,MAAM,CAAC,UAAU,CAAC;GACN,WAAW,CA0GvB;;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate, svgDeltaSmooth } from \"../../lib/templates.js\";\nimport { createScope, cssvarValues, define } from \"../../root.js\";\nimport { OpenableElement } from \"./open.js\";\n\nconst defineName = \"open-details\";\n\nconst cssvarScope = createScope(defineName);\n\n/**\n * OpenDetails similar to details.\n */\n@define(defineName)\nexport class OpenDetails extends OpenableElement {\n /**\n * If it is true, the summary event scope will fill the element.\n */\n @property({ type: Boolean }) fill = false;\n /**\n * Reverse summary.\n */\n @property({ type: Boolean }) reverse = false;\n\n @query(\"dd\") _dd: HTMLDataListElement;\n\n static styles = [\n OpenableElement.styles,\n css`\n :host {\n color: var(${cssvarValues.text});\n ${cssvarScope}--icon-deg-open: -90deg;\n ${cssvarScope}--icon-deg: 0deg;\n ${cssvarScope}--summary-direction: row;\n }\n span {\n display: inline-flex;\n align-items: center;\n white-space: nowrap;\n }\n\n dl {\n height: 100%;\n position: relative;\n overflow: hidden;\n }\n\n dt {\n display: flex;\n flex-wrap: nowrap;\n justify-content: space-between;\n background: inherit;\n align-items: center;\n height: 100%;\n flex-direction: var(${cssvarScope}--summary-direction);\n }\n\n dd {\n overflow: hidden;\n display: grid;\n grid-template-rows: 0fr;\n }\n\n * {\n transition: inherit;\n }\n\n section {\n min-height: 0;\n overflow: hidden;\n }\n\n i {\n height: 1em;\n wdith: 1em;\n display: flex;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n transform: rotate(var(${cssvarScope}--icon-deg));\n }\n\n :host([open]) dd {\n grid-template-rows: 1fr;\n }\n\n :host([float]) dd {\n top: 100%;\n position: absolute;\n }\n\n :host([open]) i {\n transform: rotate(var(${cssvarScope}--icon-deg-open));\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n return html`<dl>\n <dt @click=\"${this._handelClick}\">\n <span> ${this.summary || htmlSlot(\"summary\")} </span>\n <i>${this.renderIcon()}</i>\n </dt>\n <dd>\n <section>${htmlSlot()}</section>\n </dd>\n </dl>`;\n }\n\n private renderIcon(): HTMLTemplate {\n if (this.querySelector(\"slot[name=icon]\")) {\n return htmlSlot(\"icon\");\n }\n return svgDeltaSmooth();\n }\n\n protected firstUpdated() {\n if (this.fill) {\n this.addEvent(this._dd, \"click\", () => this.toggle());\n }\n }\n}\n\nexport default OpenDetails;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"open-details\": OpenDetails;\n }\n}\n"]}
|
@@ -1,19 +1,15 @@
|
|
1
|
-
import {
|
1
|
+
import { CSSResultGroup } from "../../deps.js";
|
2
2
|
import { type HTMLTemplate } from "../../lib/templates.js";
|
3
|
-
import {
|
4
|
-
type Direction5 = "left" | "center" | "right" | "top" | "bottom";
|
3
|
+
import OpenableElement, { Direction9 } from "./open.js";
|
5
4
|
/**
|
6
5
|
* OpenDialog similar to dialog.
|
7
6
|
*/
|
8
|
-
export declare class OpenDialog extends
|
7
|
+
export declare class OpenDialog extends OpenableElement {
|
8
|
+
direction: Direction9;
|
9
9
|
/**
|
10
10
|
* Enable modal.
|
11
11
|
*/
|
12
12
|
modal: boolean;
|
13
|
-
/**
|
14
|
-
* Whether this element is activated.
|
15
|
-
*/
|
16
|
-
open: boolean;
|
17
13
|
/**
|
18
14
|
* Enable scale.
|
19
15
|
*/
|
@@ -26,18 +22,11 @@ export declare class OpenDialog extends GodownElement {
|
|
26
22
|
* Exit key, which can be multiple.
|
27
23
|
*/
|
28
24
|
key: string;
|
29
|
-
/**
|
30
|
-
* The direction in which it appears.
|
31
|
-
*/
|
32
|
-
direction: Direction5;
|
33
25
|
_div: HTMLDivElement;
|
34
|
-
static styles:
|
26
|
+
static styles: CSSResultGroup;
|
35
27
|
protected render(): HTMLTemplate;
|
36
28
|
connectedCallback(): void;
|
37
|
-
show(): void;
|
38
29
|
showModal(): void;
|
39
|
-
close(): void;
|
40
|
-
protected updated(changedProperties: PropertyValueMap<this>): void;
|
41
30
|
protected _handleWheel(e: any): void;
|
42
31
|
protected _handleKeydown(e: KeyboardEvent): void;
|
43
32
|
protected _handelSubmit(e: SubmitEvent): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"open-dialog.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/open/open-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"open-dialog.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/open/open-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAyB,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,eAAe,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIxD;;GAEG;AACH,qBACa,UAAW,SAAQ,eAAe;IAC7C,SAAS,EAAE,UAAU,CAAY;IACjC;;OAEG;IACyC,KAAK,UAAS;IAC1D;;OAEG;IAC0B,KAAK,UAAS;IAC3C;;OAEG;IACyB,GAAG,SAAO;IACtC;;OAEG;IACyB,GAAG,SAAY;IAE7B,IAAI,EAAE,cAAc,CAAC;IAEnC,MAAM,CAAC,MAAM,EAAE,cAAc,CAkG3B;IAEF,SAAS,CAAC,MAAM,IAAI,YAAY;IAIhC,iBAAiB;IAcjB,SAAS;IAKT,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,GAAG;IAU7B,SAAS,CAAC,cAAc,CAAC,CAAC,EAAE,aAAa;IAOzC,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW;CAKvC;AAED,eAAe,UAAU,CAAC;AAE1B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
@@ -1,21 +1,20 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
2
|
import { css, html, property, query } from "../../deps.js";
|
3
|
-
import {
|
3
|
+
import { htmlSlot } from "../../lib/templates.js";
|
4
|
+
import { cssvar, cssvarValues, define } from "../../root.js";
|
5
|
+
import OpenableElement from "./open.js";
|
4
6
|
const defineName = "open-dialog";
|
5
7
|
/**
|
6
8
|
* OpenDialog similar to dialog.
|
7
9
|
*/
|
8
|
-
let OpenDialog = class OpenDialog extends
|
10
|
+
let OpenDialog = class OpenDialog extends OpenableElement {
|
9
11
|
constructor() {
|
10
12
|
super(...arguments);
|
13
|
+
this.direction = "center";
|
11
14
|
/**
|
12
15
|
* Enable modal.
|
13
16
|
*/
|
14
17
|
this.modal = false;
|
15
|
-
/**
|
16
|
-
* Whether this element is activated.
|
17
|
-
*/
|
18
|
-
this.open = false;
|
19
18
|
/**
|
20
19
|
* Enable scale.
|
21
20
|
*/
|
@@ -23,19 +22,70 @@ let OpenDialog = class OpenDialog extends GodownElement {
|
|
23
22
|
/**
|
24
23
|
* Scale gap.
|
25
24
|
*/
|
26
|
-
this.gap = 0.
|
25
|
+
this.gap = 0.2;
|
27
26
|
/**
|
28
27
|
* Exit key, which can be multiple.
|
29
28
|
*/
|
30
29
|
this.key = "Escape";
|
31
|
-
/**
|
32
|
-
* The direction in which it appears.
|
33
|
-
*/
|
34
|
-
this.direction = "center";
|
35
30
|
}
|
36
|
-
|
37
|
-
|
31
|
+
render() {
|
32
|
+
return html `<div style="--s:1" class="${this.direction}">${htmlSlot()}</div>`;
|
33
|
+
}
|
34
|
+
connectedCallback() {
|
35
|
+
super.connectedCallback();
|
36
|
+
this.addEvent(this, "submit", this._handelSubmit);
|
37
|
+
if (this.scale && this.direction === "center") {
|
38
|
+
this.addEvent(this, "wheel", this._handleWheel);
|
39
|
+
}
|
40
|
+
if (this.key) {
|
41
|
+
this.addEvent(document, "keydown", this._handleKeydown.bind(this));
|
42
|
+
}
|
43
|
+
if (this.open) {
|
44
|
+
this.show();
|
45
|
+
}
|
46
|
+
}
|
47
|
+
showModal() {
|
48
|
+
this.modal = true;
|
49
|
+
this.show();
|
50
|
+
}
|
51
|
+
_handleWheel(e) {
|
52
|
+
let scale = Number(this._div.style.getPropertyValue("--s"));
|
53
|
+
if (e.deltaY > 0) {
|
54
|
+
scale -= this.gap;
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
scale += this.gap;
|
58
|
+
}
|
59
|
+
this._div.style.setProperty("--s", `${scale}`);
|
60
|
+
}
|
61
|
+
_handleKeydown(e) {
|
62
|
+
const keys = this.key.split(/[^a-zA-Z0-9]/).filter((s) => s);
|
63
|
+
if (keys.includes(e.key) || keys.includes(e.code)) {
|
64
|
+
this.close();
|
65
|
+
}
|
66
|
+
}
|
67
|
+
_handelSubmit(e) {
|
68
|
+
if (e.target.method === "dialog") {
|
69
|
+
this.close();
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
OpenDialog.styles = [
|
74
|
+
OpenableElement.styles,
|
75
|
+
css `
|
76
|
+
:host {
|
77
|
+
display: block;
|
78
|
+
transition:
|
79
|
+
all 0.3s ease-in-out,
|
80
|
+
color 0s,
|
81
|
+
background 0s;
|
82
|
+
height: fit-content;
|
83
|
+
}
|
84
|
+
`,
|
85
|
+
css `
|
38
86
|
:host {
|
87
|
+
${cssvar}--background: rgb(var(${cssvarValues.mainRGB}) / 0%);
|
88
|
+
${cssvar}--background-modal: rgb(var(${cssvarValues.mainRGB}) / 15%);
|
39
89
|
position: fixed;
|
40
90
|
height: 100%;
|
41
91
|
width: 100%;
|
@@ -46,7 +96,7 @@ let OpenDialog = class OpenDialog extends GodownElement {
|
|
46
96
|
transition: all 0.3s;
|
47
97
|
display: flex;
|
48
98
|
visibility: hidden;
|
49
|
-
background:
|
99
|
+
background: var(${cssvar}--background);
|
50
100
|
pointer-events: none;
|
51
101
|
}
|
52
102
|
|
@@ -57,7 +107,7 @@ let OpenDialog = class OpenDialog extends GodownElement {
|
|
57
107
|
:host([open][modal]) {
|
58
108
|
pointer-events: all;
|
59
109
|
backdrop-filter: blur(0.25px);
|
60
|
-
background:
|
110
|
+
background: var(${cssvar}--background-modal);
|
61
111
|
}
|
62
112
|
|
63
113
|
:host([open]) slot {
|
@@ -70,6 +120,7 @@ let OpenDialog = class OpenDialog extends GodownElement {
|
|
70
120
|
width: 100%;
|
71
121
|
display: flex;
|
72
122
|
transition: inherit;
|
123
|
+
transform: scale(var(--s));
|
73
124
|
}
|
74
125
|
|
75
126
|
slot {
|
@@ -82,103 +133,45 @@ let OpenDialog = class OpenDialog extends GodownElement {
|
|
82
133
|
pointer-events: all;
|
83
134
|
}
|
84
135
|
|
85
|
-
|
86
|
-
|
136
|
+
div {
|
137
|
+
position: relative;
|
87
138
|
}
|
88
139
|
|
89
|
-
|
90
|
-
|
91
|
-
margin-top: 0;
|
92
|
-
transform: translateY(-15%);
|
140
|
+
slot {
|
141
|
+
position: absolute;
|
93
142
|
}
|
94
143
|
|
95
|
-
|
96
|
-
|
97
|
-
margin-right: 0;
|
98
|
-
transform: translateX(15%);
|
144
|
+
[class^="top"] slot {
|
145
|
+
top: 0;
|
99
146
|
}
|
100
147
|
|
101
|
-
|
102
|
-
|
103
|
-
margin-bottom: 0;
|
104
|
-
transform: translateY(15%);
|
148
|
+
[class^="bottom"] slot {
|
149
|
+
bottom: 0;
|
105
150
|
}
|
106
151
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
152
|
+
[class$="right"] slot {
|
153
|
+
right: 0%;
|
154
|
+
}
|
155
|
+
|
156
|
+
[class$="left"] slot {
|
157
|
+
left: 0%;
|
158
|
+
}
|
159
|
+
|
160
|
+
div[class$="center"],
|
161
|
+
.top,
|
162
|
+
.left,
|
163
|
+
.right,
|
164
|
+
.bottom {
|
165
|
+
align-items: center;
|
166
|
+
justify-content: center;
|
167
|
+
align-items: center;
|
168
|
+
justify-content: center;
|
111
169
|
}
|
112
170
|
`,
|
113
|
-
|
114
|
-
render() {
|
115
|
-
return html `<div>
|
116
|
-
<slot class="${this.direction}"></slot>
|
117
|
-
</div>`;
|
118
|
-
}
|
119
|
-
connectedCallback() {
|
120
|
-
super.connectedCallback();
|
121
|
-
this.addEvent(this, "submit", this._handelSubmit);
|
122
|
-
if (this.scale) {
|
123
|
-
this.addEvent(this, "wheel", this._handleWheel);
|
124
|
-
}
|
125
|
-
if (this.key) {
|
126
|
-
this.addEvent(document, "keydown", this._handleKeydown.bind(this));
|
127
|
-
}
|
128
|
-
if (this.open) {
|
129
|
-
this.show();
|
130
|
-
}
|
131
|
-
}
|
132
|
-
show() {
|
133
|
-
this.open = true;
|
134
|
-
}
|
135
|
-
showModal() {
|
136
|
-
this.modal = true;
|
137
|
-
this.show();
|
138
|
-
}
|
139
|
-
close() {
|
140
|
-
this.open = false;
|
141
|
-
}
|
142
|
-
updated(changedProperties) {
|
143
|
-
const hasOpen = changedProperties.has("open");
|
144
|
-
if (hasOpen) {
|
145
|
-
this.dispatchEvent(new CustomEvent(this.open ? "open" : "close"));
|
146
|
-
}
|
147
|
-
}
|
148
|
-
_handleWheel(e) {
|
149
|
-
if (this.scale) {
|
150
|
-
const s = this._div.style.transform.match(/scale\((.*)\)/);
|
151
|
-
let scale = 1;
|
152
|
-
if (s) {
|
153
|
-
scale = Number(s[1]);
|
154
|
-
}
|
155
|
-
if (e.deltaY > 0) {
|
156
|
-
scale -= this.gap;
|
157
|
-
}
|
158
|
-
else {
|
159
|
-
scale += this.gap;
|
160
|
-
}
|
161
|
-
this._div.style.transform = `scale(${scale})`;
|
162
|
-
}
|
163
|
-
}
|
164
|
-
_handleKeydown(e) {
|
165
|
-
const keys = this.key.split(/[^a-zA-Z0-9]/).filter((s) => s);
|
166
|
-
if (keys.includes(e.key) || keys.includes(e.code)) {
|
167
|
-
this.close();
|
168
|
-
}
|
169
|
-
}
|
170
|
-
_handelSubmit(e) {
|
171
|
-
if (e.target.method === "dialog") {
|
172
|
-
this.close();
|
173
|
-
}
|
174
|
-
}
|
175
|
-
};
|
171
|
+
];
|
176
172
|
__decorate([
|
177
173
|
property({ type: Boolean, reflect: true })
|
178
174
|
], OpenDialog.prototype, "modal", void 0);
|
179
|
-
__decorate([
|
180
|
-
property({ type: Boolean, reflect: true })
|
181
|
-
], OpenDialog.prototype, "open", void 0);
|
182
175
|
__decorate([
|
183
176
|
property({ type: Boolean })
|
184
177
|
], OpenDialog.prototype, "scale", void 0);
|
@@ -188,9 +181,6 @@ __decorate([
|
|
188
181
|
__decorate([
|
189
182
|
property({ type: String })
|
190
183
|
], OpenDialog.prototype, "key", void 0);
|
191
|
-
__decorate([
|
192
|
-
property({ type: String })
|
193
|
-
], OpenDialog.prototype, "direction", void 0);
|
194
184
|
__decorate([
|
195
185
|
query("div")
|
196
186
|
], OpenDialog.prototype, "_div", void 0);
|