godown 2.6.0 → 2.6.2
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/directives.d.ts +2 -4
- package/lib/directives.d.ts.map +1 -1
- package/lib/directives.js.map +1 -1
- package/lib/event-collection.d.ts +1 -1
- package/lib/utils.d.ts +2 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +11 -0
- package/lib/utils.js.map +1 -1
- package/package.json +4 -6
- package/react/index.d.ts +0 -3
- package/react/index.d.ts.map +1 -1
- package/react/index.js +0 -9
- package/react/index.js.map +1 -1
- package/root.d.ts.map +1 -1
- package/root.js +1 -0
- package/root.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 +15 -15
- 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 -3
- package/web-components/index.d.ts.map +1 -1
- package/web-components/index.js +0 -3
- 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-layout.d.ts +10 -3
- package/web-components/layout/nav-layout.d.ts.map +1 -1
- package/web-components/layout/nav-layout.js +31 -101
- 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/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/nav-aside.d.ts +0 -2
- package/nav-aside.d.ts.map +0 -1
- package/nav-aside.js +0 -2
- package/nav-aside.js.map +0 -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/scroll-x.d.ts +0 -2
- package/scroll-x.d.ts.map +0 -1
- package/scroll-x.js +0 -2
- package/scroll-x.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/layout/nav-aside.d.ts +0 -25
- package/web-components/layout/nav-aside.d.ts.map +0 -1
- package/web-components/layout/nav-aside.js +0 -70
- package/web-components/layout/nav-aside.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
- package/web-components/view/scroll-x.d.ts +0 -25
- package/web-components/view/scroll-x.d.ts.map +0 -1
- package/web-components/view/scroll-x.js +0 -97
- package/web-components/view/scroll-x.js.map +0 -1
@@ -92,9 +92,90 @@ let BaseButton = class BaseButton extends GodownElement {
|
|
92
92
|
*/
|
93
93
|
this.text = "";
|
94
94
|
}
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
render() {
|
96
|
+
return html `
|
97
|
+
<div color="${this.nextColor()}">
|
98
|
+
<b></b>
|
99
|
+
<p>${this.text || htmlSlot()}</p>
|
100
|
+
</div>
|
101
|
+
`;
|
102
|
+
}
|
103
|
+
focus() {
|
104
|
+
if (this.disabled) {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
this.active = true;
|
108
|
+
}
|
109
|
+
blur() {
|
110
|
+
this.active = false;
|
111
|
+
}
|
112
|
+
firstUpdated() {
|
113
|
+
if (this.scale) {
|
114
|
+
this.addEvent(this, "mousedown", this.focus);
|
115
|
+
this.addEvent(this, "mouseup", (e) => {
|
116
|
+
if (this.disabled) {
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
this.blur();
|
120
|
+
this._handleModal(e);
|
121
|
+
});
|
122
|
+
this.addEvent(this, "mouseleave", this.blur);
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
else {
|
126
|
+
this.addEvent(document, "click", this._handelClick.bind(this));
|
127
|
+
}
|
128
|
+
}
|
129
|
+
_handleModal(e) {
|
130
|
+
const a = this._div.offsetHeight + 1;
|
131
|
+
const b = this._div.offsetWidth + 1;
|
132
|
+
const size = `${Math.sqrt(a * a + b * b) * 2}px`;
|
133
|
+
const translate = `translate(calc(-50% + ${e.offsetX}px), calc(-50% + ${e.offsetY}px))`;
|
134
|
+
this._b.style.width = size;
|
135
|
+
this._b.style.height = size;
|
136
|
+
this._b.style.transform = translate;
|
137
|
+
const i = document.createElement("i");
|
138
|
+
i.style.animationName = "i";
|
139
|
+
this._b.appendChild(i);
|
140
|
+
setTimeout(() => {
|
141
|
+
i.remove();
|
142
|
+
}, 2000);
|
143
|
+
}
|
144
|
+
_handelClick(e) {
|
145
|
+
if (this.disabled) {
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
if (e.target === this) {
|
149
|
+
this._handleModal(e);
|
150
|
+
this.focus();
|
151
|
+
}
|
152
|
+
else {
|
153
|
+
this.blur();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Get the color to render, default is this.color.
|
158
|
+
*
|
159
|
+
* @returns New color.
|
160
|
+
*
|
161
|
+
* Colors can be set for different states.
|
162
|
+
*
|
163
|
+
* The matching selector is `[color=COLOR]`.
|
164
|
+
*
|
165
|
+
* @example
|
166
|
+
* ```ts
|
167
|
+
* button.adoptStyles("[color=COLOR1]{...}")
|
168
|
+
* button.adoptStyles("[color=COLOR2]{...}")
|
169
|
+
* button.nextColor = () => state ? COLOR1 : COLOR2
|
170
|
+
* ```
|
171
|
+
*/
|
172
|
+
nextColor() {
|
173
|
+
return this.color;
|
174
|
+
}
|
175
|
+
};
|
176
|
+
BaseButton.styles = [
|
177
|
+
unsafeCSS(constructCSS(vars, colors, (raw) => `[color=${raw}]`, (k, v) => `${cssvarScope}--${k}:${v}`)),
|
178
|
+
css `
|
98
179
|
:host {
|
99
180
|
${cssvarScope}--padding: .075em .25em;
|
100
181
|
${cssvarScope}--deg: .075em .25em;
|
@@ -169,7 +250,7 @@ let BaseButton = class BaseButton extends GodownElement {
|
|
169
250
|
${cssvarScope}--padding: .075em .5em;
|
170
251
|
}
|
171
252
|
`,
|
172
|
-
|
253
|
+
css `
|
173
254
|
i {
|
174
255
|
position: absolute;
|
175
256
|
top: 0;
|
@@ -204,88 +285,7 @@ let BaseButton = class BaseButton extends GodownElement {
|
|
204
285
|
}
|
205
286
|
}
|
206
287
|
`,
|
207
|
-
|
208
|
-
render() {
|
209
|
-
return html `
|
210
|
-
<div color="${this.nextColor()}">
|
211
|
-
<b></b>
|
212
|
-
<p>${this.text || htmlSlot()}</p>
|
213
|
-
</div>
|
214
|
-
`;
|
215
|
-
}
|
216
|
-
focus() {
|
217
|
-
if (this.disabled) {
|
218
|
-
return;
|
219
|
-
}
|
220
|
-
this.active = true;
|
221
|
-
}
|
222
|
-
blur() {
|
223
|
-
this.active = false;
|
224
|
-
}
|
225
|
-
firstUpdated() {
|
226
|
-
if (this.scale) {
|
227
|
-
this.addEvent(this, "mousedown", this.focus);
|
228
|
-
this.addEvent(this, "mouseup", (e) => {
|
229
|
-
if (this.disabled) {
|
230
|
-
return;
|
231
|
-
}
|
232
|
-
this.blur();
|
233
|
-
this._handleModal(e);
|
234
|
-
});
|
235
|
-
this.addEvent(this, "mouseleave", this.blur);
|
236
|
-
return;
|
237
|
-
}
|
238
|
-
else {
|
239
|
-
this.addEvent(document, "click", this._handelClick.bind(this));
|
240
|
-
}
|
241
|
-
}
|
242
|
-
_handleModal(e) {
|
243
|
-
const a = this._div.offsetHeight + 1;
|
244
|
-
const b = this._div.offsetWidth + 1;
|
245
|
-
const size = `${Math.sqrt(a * a + b * b) * 2}px`;
|
246
|
-
const translate = `translate(calc(-50% + ${e.offsetX}px), calc(-50% + ${e.offsetY}px))`;
|
247
|
-
this._b.style.width = size;
|
248
|
-
this._b.style.height = size;
|
249
|
-
this._b.style.transform = translate;
|
250
|
-
const i = document.createElement("i");
|
251
|
-
i.style.animationName = "i";
|
252
|
-
this._b.appendChild(i);
|
253
|
-
setTimeout(() => {
|
254
|
-
i.remove();
|
255
|
-
}, 2000);
|
256
|
-
}
|
257
|
-
_handelClick(e) {
|
258
|
-
if (this.disabled) {
|
259
|
-
return;
|
260
|
-
}
|
261
|
-
if (e.target === this) {
|
262
|
-
this._handleModal(e);
|
263
|
-
this.focus();
|
264
|
-
}
|
265
|
-
else {
|
266
|
-
this.blur();
|
267
|
-
}
|
268
|
-
}
|
269
|
-
/**
|
270
|
-
* Get the color to render, default is this.color.
|
271
|
-
*
|
272
|
-
* @returns New color.
|
273
|
-
*
|
274
|
-
* Colors can be set for different states.
|
275
|
-
*
|
276
|
-
* The matching selector is `[color=COLOR]`.
|
277
|
-
*
|
278
|
-
* @example
|
279
|
-
* ```ts
|
280
|
-
* button.adoptStyles("[color=COLOR1]{...}")
|
281
|
-
* button.adoptStyles("[color=COLOR2]{...}")
|
282
|
-
* button.nextColor = () => state ? COLOR1 : COLOR2
|
283
|
-
* ```
|
284
|
-
*/
|
285
|
-
nextColor() {
|
286
|
-
return this.color;
|
287
|
-
}
|
288
|
-
};
|
288
|
+
];
|
289
289
|
__decorate([
|
290
290
|
property({ type: Boolean, reflect: true })
|
291
291
|
], BaseButton.prototype, "disabled", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base-button.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/button/base-button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,UAAU,GAAG,aAAa,CAAC;AACjC,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AACzC,MAAM,GAAG,GAAG,MAAM,CAAC;AACnB,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG;IACb,KAAK,EAAE;QACL,GAAG,EAAE,EAAE;QACP,GAAG,cAAc,uCAAuC;QACxD,GAAG,OAAO,sBAAsB,OAAO,sBAAsB;QAC7D,eAAe;KAChB;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,EAAE;QACP,GAAG,cAAc,2CAA2C;QAC5D,GAAG,OAAO,sBAAsB,OAAO,sBAAsB;QAC7D,eAAe;KAChB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,EAAE;QACR,GAAG,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CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;;AAzO2C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAIjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAe;AAId;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAgB;AAIf;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAgB;AAIf;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAe;AAI9C;IAAX,QAAQ,EAAE;yCAAkC;AAIjC;IAAX,QAAQ,EAAE;wCAAW;AAEV;IAAX,KAAK,CAAC,GAAG,CAAC;sCAAiB;AACd;IAAb,KAAK,CAAC,KAAK,CAAC;wCAAyB;AA/B3B,UAAU;IADtB,MAAM,CAAC,UAAU,CAAC;GACN,UAAU,CA8OtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["import { css, html, property, query, unsafeCSS } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { constructCSS } from \"../../lib/utils.js\";\nimport { createScope, define, GodownElement } from \"../../root.js\";\n\nconst defineName = \"base-button\";\nconst cssvarScope = createScope(defineName);\n\nconst shadow1 = \"-2px 2px 5px -2px\";\nconst shadow2 = \"2px -2px 5px -2px\";\nconst linearGradient = \"linear-gradient\";\nconst fff = \"#fff\";\nconst _000 = \"#000\";\n\nconst vars = [\"color\", \"background\", \"box-shadow\", \"ghost-color\"];\nconst colors = {\n black: [\n fff, //\n `${linearGradient}(45deg, rgb(30 30 30), rgb(65 65 65))`,\n `${shadow1} rgb(0 0 0 / 20%), ${shadow2} rgb(99 99 99 / 20%)`,\n \"rgb(22 20 20)\",\n ],\n gary: [\n fff, //\n `${linearGradient}(45deg, rgb(65 65 65), rgb(100 100 100))`,\n `${shadow1} rgb(0 0 0 / 20%), ${shadow2} rgb(99 99 99 / 20%)`,\n \"rgb(56 56 56)\",\n ],\n white: [\n _000, //\n `${linearGradient}(45deg, rgb(225 225 225), rgb(240 240 240))`,\n `${shadow1} rgb(255 255 255 / 20%), ${shadow2} rgb(165 165 165 / 20%)`,\n \"rgb(212 212 212)\",\n ],\n red: [\n fff, //\n `${linearGradient}(45deg, rgb(215 57 68), rgb(250 141 106))`,\n `${shadow1} rgb(181 35 44 / 20%), ${shadow2} rgb(234 130 174 / 20%)`,\n \"rgb(214 11 23)\",\n ],\n green: [\n _000, //\n `${linearGradient}(45deg, rgb(21 206 71), rgb(99 253 122))`,\n `${shadow1} rgb(63 179 69 / 20%), ${shadow2} rgb(136 225 142 / 20%)`,\n \"rgb(60 214 68)\",\n ],\n blue: [\n fff, //\n `${linearGradient}(45deg, rgb(14 143 255), rgb(121 211 255))`,\n `${shadow1} rgb(92 182 255 / 20%), ${shadow2} rgb(135 232 222 / 20%)`,\n \"rgb(42 141 221)\",\n ],\n yellow: [\n _000, //\n `${linearGradient}(45deg, rgb(255 190 54), rgb(255 249 68))`,\n `${shadow1} rgb(214 203 55 / 20%), ${shadow2} rgb(202 203 137 / 20%)`,\n \"rgb(255 235 59)\",\n ],\n};\n\ntype Colors = keyof typeof colors;\n\n/**\n * BaseButton.\n *\n * Inspired by Next-ui.\n */\n@define(defineName)\nexport class BaseButton extends GodownElement {\n /**\n * Whether to disable this element.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /**\n * Invert font and background color.\n */\n @property({ type: Boolean, reflect: true }) ghost = false;\n /**\n * Whether this element is active or not.\n */\n @property({ type: Boolean, reflect: true }) active = false;\n /**\n * Enables rounded corners to appear capsule shaped.\n */\n @property({ type: Boolean, reflect: true }) radius = false;\n /**\n * Enables scale when mousedown.\n */\n @property({ type: Boolean, reflect: true }) scale = false;\n /**\n * The primary color.\n */\n @property() color: \"none\" | Colors = \"black\";\n /**\n * Text inside.\n */\n @property() text = \"\";\n\n @query(\"b\") _b: HTMLElement;\n @query(\"div\") _div: HTMLButtonElement;\n\n static styles = [\n unsafeCSS(\n constructCSS(\n vars,\n colors,\n (raw) => `[color=${raw}]`,\n (k, v) => `${cssvarScope}--${k}:${v}`,\n ),\n ),\n css`\n :host {\n ${cssvarScope}--padding: .075em .25em;\n ${cssvarScope}--deg: .075em .25em;\n ${cssvarScope}--ghost-width: .09em;\n ${cssvarScope}--modal-opacity: .15;\n ${cssvarScope}--modal-opacity-end: 0;\n ${cssvarScope}--modal-animation-duration: 1s;\n ${cssvarScope}--focus-scale: .975;\n transition: 0.1s;\n display: flex;\n width: fit-content;\n border-radius: 0.25em;\n cursor: pointer;\n background: none !important;\n }\n\n :host([disabled]) {\n cursor: not-allowed;\n }\n\n :host([active][scale]) div {\n scale: var(${cssvarScope}--focus-scale);\n }\n\n slot {\n display: flow-root;\n }\n\n div {\n background: var(${cssvarScope}--background);\n box-shadow: var(${cssvarScope}--box-shadow);\n color: var(${cssvarScope}--color, inherit);\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n border-radius: inherit;\n transition-duration: inherit;\n transition-property: scale;\n pointer-events: none;\n }\n\n b {\n pointer-events: none;\n transform: translate(-50%, -50%);\n position: absolute;\n visibility: hidden;\n }\n\n p {\n padding: var(${cssvarScope}--padding);\n margin: 0;\n user-select: none;\n transition: 0;\n }\n\n :host([ghost]) p {\n background-image: var(${cssvarScope}--background);\n margin: calc(-1 * var(${cssvarScope}--ghost-width));\n background-clip: text;\n -webkit-background-clip: text;\n color: transparent;\n }\n\n :host([ghost]) div {\n background: transparent;\n border: var(${cssvarScope}--ghost-width) solid var(${cssvarScope}--ghost-color);\n }\n\n :host([radius]) {\n border-radius: calc(infinity * 1px);\n ${cssvarScope}--padding: .075em .5em;\n }\n `,\n css`\n i {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n border-radius: 50%;\n transform: translate(0, 0);\n background: currentColor;\n opacity: var(${cssvarScope}--modal-opacity-end);\n visibility: visible;\n animation-duration: min(var(${cssvarScope}--modal-animation-duration), 2s);\n }\n\n :host([ghost]) i {\n background: var(${cssvarScope}--ghost-color);\n }\n\n @keyframes i {\n 0% {\n transform: scale(0);\n opacity: var(${cssvarScope}--modal-opacity);\n }\n 80% {\n transform: scale(1);\n }\n 100% {\n opacity: var(${cssvarScope}--modal-opacity-end);\n }\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n return html`\n <div color=\"${this.nextColor()}\">\n <b></b>\n <p>${this.text || htmlSlot()}</p>\n </div>\n `;\n }\n\n focus() {\n if (this.disabled) {\n return;\n }\n this.active = true;\n }\n\n blur() {\n this.active = false;\n }\n\n protected firstUpdated() {\n if (this.scale) {\n this.addEvent(this, \"mousedown\", this.focus);\n this.addEvent(this, \"mouseup\", (e: MouseEvent) => {\n if (this.disabled) {\n return;\n }\n this.blur();\n this._handleModal(e);\n });\n this.addEvent(this, \"mouseleave\", this.blur);\n return;\n } else {\n this.addEvent(document, \"click\", this._handelClick.bind(this));\n }\n }\n\n protected _handleModal(e: MouseEvent) {\n const a = this._div.offsetHeight + 1;\n const b = this._div.offsetWidth + 1;\n const size = `${Math.sqrt(a * a + b * b) * 2}px`;\n const translate = `translate(calc(-50% + ${e.offsetX}px), calc(-50% + ${e.offsetY}px))`;\n this._b.style.width = size;\n this._b.style.height = size;\n this._b.style.transform = translate;\n const i = document.createElement(\"i\");\n i.style.animationName = \"i\";\n this._b.appendChild(i);\n setTimeout(() => {\n i.remove();\n }, 2000);\n }\n\n protected _handelClick(e: MouseEvent) {\n if (this.disabled) {\n return;\n }\n if (e.target === this) {\n this._handleModal(e);\n this.focus();\n } else {\n this.blur();\n }\n }\n\n /**\n * Get the color to render, default is this.color.\n *\n * @returns New color.\n *\n * Colors can be set for different states.\n *\n * The matching selector is `[color=COLOR]`.\n *\n * @example\n * ```ts\n * button.adoptStyles(\"[color=COLOR1]{...}\")\n * button.adoptStyles(\"[color=COLOR2]{...}\")\n * button.nextColor = () => state ? COLOR1 : COLOR2\n * ```\n */\n nextColor(): Colors | string {\n return this.color;\n }\n}\n\nexport default BaseButton;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-button\": BaseButton;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"base-button.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/button/base-button.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,UAAU,GAAG,aAAa,CAAC;AACjC,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAE5C,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC,MAAM,OAAO,GAAG,mBAAmB,CAAC;AACpC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AACzC,MAAM,GAAG,GAAG,MAAM,CAAC;AACnB,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG;IACb,KAA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,CAAC","sourcesContent":["import { css, html, property, query, unsafeCSS } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { constructCSS } from \"../../lib/utils.js\";\nimport { createScope, define, GodownElement } from \"../../root.js\";\n\nconst defineName = \"base-button\";\nconst cssvarScope = createScope(defineName);\n\nconst shadow1 = \"-2px 2px 5px -2px\";\nconst shadow2 = \"2px -2px 5px -2px\";\nconst linearGradient = \"linear-gradient\";\nconst fff = \"#fff\";\nconst _000 = \"#000\";\n\nconst vars = [\"color\", \"background\", \"box-shadow\", \"ghost-color\"];\nconst colors = {\n black: [\n fff, //\n `${linearGradient}(45deg, rgb(30 30 30), rgb(65 65 65))`,\n `${shadow1} rgb(0 0 0 / 20%), ${shadow2} rgb(99 99 99 / 20%)`,\n \"rgb(22 20 20)\",\n ],\n gary: [\n fff, //\n `${linearGradient}(45deg, rgb(65 65 65), rgb(100 100 100))`,\n `${shadow1} rgb(0 0 0 / 20%), ${shadow2} rgb(99 99 99 / 20%)`,\n \"rgb(56 56 56)\",\n ],\n white: [\n _000, //\n `${linearGradient}(45deg, rgb(225 225 225), rgb(240 240 240))`,\n `${shadow1} rgb(255 255 255 / 20%), ${shadow2} rgb(165 165 165 / 20%)`,\n \"rgb(212 212 212)\",\n ],\n red: [\n fff, //\n `${linearGradient}(45deg, rgb(215 57 68), rgb(250 141 106))`,\n `${shadow1} rgb(181 35 44 / 20%), ${shadow2} rgb(234 130 174 / 20%)`,\n \"rgb(214 11 23)\",\n ],\n green: [\n _000, //\n `${linearGradient}(45deg, rgb(21 206 71), rgb(99 253 122))`,\n `${shadow1} rgb(63 179 69 / 20%), ${shadow2} rgb(136 225 142 / 20%)`,\n \"rgb(60 214 68)\",\n ],\n blue: [\n fff, //\n `${linearGradient}(45deg, rgb(14 143 255), rgb(121 211 255))`,\n `${shadow1} rgb(92 182 255 / 20%), ${shadow2} rgb(135 232 222 / 20%)`,\n \"rgb(42 141 221)\",\n ],\n yellow: [\n _000, //\n `${linearGradient}(45deg, rgb(255 190 54), rgb(255 249 68))`,\n `${shadow1} rgb(214 203 55 / 20%), ${shadow2} rgb(202 203 137 / 20%)`,\n \"rgb(255 235 59)\",\n ],\n};\n\ntype Colors = keyof typeof colors;\n\n/**\n * BaseButton.\n *\n * Inspired by Next-ui.\n */\n@define(defineName)\nexport class BaseButton extends GodownElement {\n /**\n * Whether to disable this element.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /**\n * Invert font and background color.\n */\n @property({ type: Boolean, reflect: true }) ghost = false;\n /**\n * Whether this element is active or not.\n */\n @property({ type: Boolean, reflect: true }) active = false;\n /**\n * Enables rounded corners to appear capsule shaped.\n */\n @property({ type: Boolean, reflect: true }) radius = false;\n /**\n * Enables scale when mousedown.\n */\n @property({ type: Boolean, reflect: true }) scale = false;\n /**\n * The primary color.\n */\n @property() color: \"none\" | Colors = \"black\";\n /**\n * Text inside.\n */\n @property() text = \"\";\n\n @query(\"b\") _b: HTMLElement;\n @query(\"div\") _div: HTMLButtonElement;\n\n static styles = [\n unsafeCSS(\n constructCSS(\n vars,\n colors,\n (raw) => `[color=${raw}]`,\n (k, v) => `${cssvarScope}--${k}:${v}`,\n ),\n ),\n css`\n :host {\n ${cssvarScope}--padding: .075em .25em;\n ${cssvarScope}--deg: .075em .25em;\n ${cssvarScope}--ghost-width: .09em;\n ${cssvarScope}--modal-opacity: .15;\n ${cssvarScope}--modal-opacity-end: 0;\n ${cssvarScope}--modal-animation-duration: 1s;\n ${cssvarScope}--focus-scale: .975;\n transition: 0.1s;\n display: flex;\n width: fit-content;\n border-radius: 0.25em;\n cursor: pointer;\n background: none !important;\n }\n\n :host([disabled]) {\n cursor: not-allowed;\n }\n\n :host([active][scale]) div {\n scale: var(${cssvarScope}--focus-scale);\n }\n\n slot {\n display: flow-root;\n }\n\n div {\n background: var(${cssvarScope}--background);\n box-shadow: var(${cssvarScope}--box-shadow);\n color: var(${cssvarScope}--color, inherit);\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n border-radius: inherit;\n transition-duration: inherit;\n transition-property: scale;\n pointer-events: none;\n }\n\n b {\n pointer-events: none;\n transform: translate(-50%, -50%);\n position: absolute;\n visibility: hidden;\n }\n\n p {\n padding: var(${cssvarScope}--padding);\n margin: 0;\n user-select: none;\n transition: 0;\n }\n\n :host([ghost]) p {\n background-image: var(${cssvarScope}--background);\n margin: calc(-1 * var(${cssvarScope}--ghost-width));\n background-clip: text;\n -webkit-background-clip: text;\n color: transparent;\n }\n\n :host([ghost]) div {\n background: transparent;\n border: var(${cssvarScope}--ghost-width) solid var(${cssvarScope}--ghost-color);\n }\n\n :host([radius]) {\n border-radius: calc(infinity * 1px);\n ${cssvarScope}--padding: .075em .5em;\n }\n `,\n css`\n i {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n border-radius: 50%;\n transform: translate(0, 0);\n background: currentColor;\n opacity: var(${cssvarScope}--modal-opacity-end);\n visibility: visible;\n animation-duration: min(var(${cssvarScope}--modal-animation-duration), 2s);\n }\n\n :host([ghost]) i {\n background: var(${cssvarScope}--ghost-color);\n }\n\n @keyframes i {\n 0% {\n transform: scale(0);\n opacity: var(${cssvarScope}--modal-opacity);\n }\n 80% {\n transform: scale(1);\n }\n 100% {\n opacity: var(${cssvarScope}--modal-opacity-end);\n }\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n return html`\n <div color=\"${this.nextColor()}\">\n <b></b>\n <p>${this.text || htmlSlot()}</p>\n </div>\n `;\n }\n\n focus() {\n if (this.disabled) {\n return;\n }\n this.active = true;\n }\n\n blur() {\n this.active = false;\n }\n\n protected firstUpdated() {\n if (this.scale) {\n this.addEvent(this, \"mousedown\", this.focus);\n this.addEvent(this, \"mouseup\", (e: MouseEvent) => {\n if (this.disabled) {\n return;\n }\n this.blur();\n this._handleModal(e);\n });\n this.addEvent(this, \"mouseleave\", this.blur);\n return;\n } else {\n this.addEvent(document, \"click\", this._handelClick.bind(this));\n }\n }\n\n protected _handleModal(e: MouseEvent) {\n const a = this._div.offsetHeight + 1;\n const b = this._div.offsetWidth + 1;\n const size = `${Math.sqrt(a * a + b * b) * 2}px`;\n const translate = `translate(calc(-50% + ${e.offsetX}px), calc(-50% + ${e.offsetY}px))`;\n this._b.style.width = size;\n this._b.style.height = size;\n this._b.style.transform = translate;\n const i = document.createElement(\"i\");\n i.style.animationName = \"i\";\n this._b.appendChild(i);\n setTimeout(() => {\n i.remove();\n }, 2000);\n }\n\n protected _handelClick(e: MouseEvent) {\n if (this.disabled) {\n return;\n }\n if (e.target === this) {\n this._handleModal(e);\n this.focus();\n } else {\n this.blur();\n }\n }\n\n /**\n * Get the color to render, default is this.color.\n *\n * @returns New color.\n *\n * Colors can be set for different states.\n *\n * The matching selector is `[color=COLOR]`.\n *\n * @example\n * ```ts\n * button.adoptStyles(\"[color=COLOR1]{...}\")\n * button.adoptStyles(\"[color=COLOR2]{...}\")\n * button.nextColor = () => state ? COLOR1 : COLOR2\n * ```\n */\n nextColor(): Colors | string {\n return this.color;\n }\n}\n\nexport default BaseButton;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-button\": BaseButton;\n }\n}\n"]}
|
@@ -32,7 +32,7 @@ export declare class CarouselSlider extends GodownElement {
|
|
32
32
|
export default CarouselSlider;
|
33
33
|
declare global {
|
34
34
|
interface HTMLElementTagNameMap {
|
35
|
-
"
|
35
|
+
"carousel-slider": CarouselSlider;
|
36
36
|
}
|
37
37
|
}
|
38
38
|
//# sourceMappingURL=carousel-slider.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"carousel-slider.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/carousel/carousel-slider.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,YAAY,EAAY,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C;;GAEG;AACH,qBACa,cAAe,SAAQ,aAAa;IAC/C;;OAEG;IACyB,KAAK,SAAK;IACtC;;OAEG;IACyB,UAAU,SAAK;IAC3C;;OAEG;IACS,KAAK,SAAM;IAEL,QAAQ,EAAE,WAAW,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,EAAE,CAAM;IAE3B,MAAM,CAAC,MAAM,4BAqEX;IAEF,SAAS,CAAC,MAAM,IAAI,YAAY;IAUhC,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM;IAOtB,SAAS,CAAC,YAAY;IAwBtB,oBAAoB;IAIpB,IAAI,CAAC,CAAC,EAAE,MAAM;IAMd,IAAI;IAWJ,IAAI;CAUL;AAED,eAAe,cAAc,CAAC;AAE9B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,
|
1
|
+
{"version":3,"file":"carousel-slider.d.ts","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/carousel/carousel-slider.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,YAAY,EAAY,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAI9C;;GAEG;AACH,qBACa,cAAe,SAAQ,aAAa;IAC/C;;OAEG;IACyB,KAAK,SAAK;IACtC;;OAEG;IACyB,UAAU,SAAK;IAC3C;;OAEG;IACS,KAAK,SAAM;IAEL,QAAQ,EAAE,WAAW,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,EAAE,CAAM;IAE3B,MAAM,CAAC,MAAM,4BAqEX;IAEF,SAAS,CAAC,MAAM,IAAI,YAAY;IAUhC,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM;IAOtB,SAAS,CAAC,YAAY;IAwBtB,oBAAoB;IAIpB,IAAI,CAAC,CAAC,EAAE,MAAM;IAMd,IAAI;IAWJ,IAAI;CAUL;AAED,eAAe,cAAc,CAAC;AAE9B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,cAAc,CAAC;KACnC;CACF"}
|
@@ -24,76 +24,6 @@ let CarouselSlider = class CarouselSlider extends GodownElement {
|
|
24
24
|
this.width = "";
|
25
25
|
this._clone = [];
|
26
26
|
}
|
27
|
-
static { this.styles = [
|
28
|
-
css `
|
29
|
-
:host {
|
30
|
-
display: block;
|
31
|
-
transition: all 0.2s;
|
32
|
-
}
|
33
|
-
|
34
|
-
div {
|
35
|
-
overflow: hidden;
|
36
|
-
}
|
37
|
-
|
38
|
-
div,
|
39
|
-
section {
|
40
|
-
width: 100%;
|
41
|
-
display: flex;
|
42
|
-
position: relative;
|
43
|
-
transition: inherit;
|
44
|
-
}
|
45
|
-
|
46
|
-
a {
|
47
|
-
position: absolute;
|
48
|
-
height: 100%;
|
49
|
-
width: fit-content;
|
50
|
-
z-index: 1;
|
51
|
-
display: flex;
|
52
|
-
align-items: center;
|
53
|
-
}
|
54
|
-
|
55
|
-
.prev {
|
56
|
-
left: 0;
|
57
|
-
}
|
58
|
-
|
59
|
-
.prev svg {
|
60
|
-
transform: rotate(180deg);
|
61
|
-
}
|
62
|
-
|
63
|
-
.next {
|
64
|
-
right: 0;
|
65
|
-
}
|
66
|
-
|
67
|
-
i {
|
68
|
-
position: relative;
|
69
|
-
display: flex;
|
70
|
-
align-items: center;
|
71
|
-
justify-content: center;
|
72
|
-
transition: 0.3s;
|
73
|
-
width: 2em;
|
74
|
-
height: 100%;
|
75
|
-
}
|
76
|
-
|
77
|
-
svg {
|
78
|
-
flex: 1;
|
79
|
-
max-height: 100%;
|
80
|
-
max-width: 100%;
|
81
|
-
}
|
82
|
-
|
83
|
-
a:hover i {
|
84
|
-
background-color: #0000001a;
|
85
|
-
width: 2.2em;
|
86
|
-
}
|
87
|
-
|
88
|
-
i svg path {
|
89
|
-
stroke-width: 4;
|
90
|
-
}
|
91
|
-
|
92
|
-
slot::slotted(*) {
|
93
|
-
flex-shrink: 0 !important;
|
94
|
-
}
|
95
|
-
`,
|
96
|
-
]; }
|
97
27
|
render() {
|
98
28
|
const style = this.width && `:host{width:${this.width.split(";")[0]};}`;
|
99
29
|
return html `<div>
|
@@ -169,6 +99,76 @@ let CarouselSlider = class CarouselSlider extends GodownElement {
|
|
169
99
|
}
|
170
100
|
}
|
171
101
|
};
|
102
|
+
CarouselSlider.styles = [
|
103
|
+
css `
|
104
|
+
:host {
|
105
|
+
display: block;
|
106
|
+
transition: all 0.2s;
|
107
|
+
}
|
108
|
+
|
109
|
+
div {
|
110
|
+
overflow: hidden;
|
111
|
+
}
|
112
|
+
|
113
|
+
div,
|
114
|
+
section {
|
115
|
+
width: 100%;
|
116
|
+
display: flex;
|
117
|
+
position: relative;
|
118
|
+
transition: inherit;
|
119
|
+
}
|
120
|
+
|
121
|
+
a {
|
122
|
+
position: absolute;
|
123
|
+
height: 100%;
|
124
|
+
width: fit-content;
|
125
|
+
z-index: 1;
|
126
|
+
display: flex;
|
127
|
+
align-items: center;
|
128
|
+
}
|
129
|
+
|
130
|
+
.prev {
|
131
|
+
left: 0;
|
132
|
+
}
|
133
|
+
|
134
|
+
.prev svg {
|
135
|
+
transform: rotate(180deg);
|
136
|
+
}
|
137
|
+
|
138
|
+
.next {
|
139
|
+
right: 0;
|
140
|
+
}
|
141
|
+
|
142
|
+
i {
|
143
|
+
position: relative;
|
144
|
+
display: flex;
|
145
|
+
align-items: center;
|
146
|
+
justify-content: center;
|
147
|
+
transition: 0.3s;
|
148
|
+
width: 2em;
|
149
|
+
height: 100%;
|
150
|
+
}
|
151
|
+
|
152
|
+
svg {
|
153
|
+
flex: 1;
|
154
|
+
max-height: 100%;
|
155
|
+
max-width: 100%;
|
156
|
+
}
|
157
|
+
|
158
|
+
a:hover i {
|
159
|
+
background-color: #0000001a;
|
160
|
+
width: 2.2em;
|
161
|
+
}
|
162
|
+
|
163
|
+
i svg path {
|
164
|
+
stroke-width: 4;
|
165
|
+
}
|
166
|
+
|
167
|
+
slot::slotted(*) {
|
168
|
+
flex-shrink: 0 !important;
|
169
|
+
}
|
170
|
+
`,
|
171
|
+
];
|
172
172
|
__decorate([
|
173
173
|
property({ type: Number })
|
174
174
|
], CarouselSlider.prototype, "index", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"carousel-slider.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/carousel/carousel-slider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAqB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAErC;;GAEG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,aAAa;IAA1C;;QACL;;WAEG;QACyB,UAAK,GAAG,CAAC,CAAC;QACtC;;WAEG;QACyB,eAAU,GAAG,CAAC,CAAC;QAC3C;;WAEG;QACS,UAAK,GAAG,EAAE,CAAC;QAIvB,WAAM,GAAkB,EAAE,CAAC;IAwJ7B,CAAC;
|
1
|
+
{"version":3,"file":"carousel-slider.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/carousel/carousel-slider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAqB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE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B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAW;AAIV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAgB;AAI/B;IAAX,QAAQ,EAAE;6CAAY;AAEL;IAAjB,KAAK,CAAC,SAAS,CAAC;gDAAuB;AAd7B,cAAc;IAD1B,MAAM,CAAC,UAAU,CAAC;GACN,cAAc,CAwK1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["import { css, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, htmlStyle, type HTMLTemplate, svgArrow } from \"../../lib/templates.js\";\nimport { define } from \"../../root.js\";\nimport { GodownElement } from \"../../root.js\";\n\nconst defineName = \"carousel-slider\";\n\n/**\n * CarouselSlider rotates child elements.\n */\n@define(defineName)\nexport class CarouselSlider extends GodownElement {\n /**\n * The index of the element is displayed for the first time.\n */\n @property({ type: Number }) index = 0;\n /**\n * If autochangee > 0, the rotation will be automated.\n */\n @property({ type: Number }) autochange = 0;\n /**\n * Width.\n */\n @property() width = \"\";\n\n @query(\"section\") _section: HTMLElement;\n intervalID: number;\n _clone: HTMLElement[] = [];\n\n static styles = [\n css`\n :host {\n display: block;\n transition: all 0.2s;\n }\n\n div {\n overflow: hidden;\n }\n\n div,\n section {\n width: 100%;\n display: flex;\n position: relative;\n transition: inherit;\n }\n\n a {\n position: absolute;\n height: 100%;\n width: fit-content;\n z-index: 1;\n display: flex;\n align-items: center;\n }\n\n .prev {\n left: 0;\n }\n\n .prev svg {\n transform: rotate(180deg);\n }\n\n .next {\n right: 0;\n }\n\n i {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: 0.3s;\n width: 2em;\n height: 100%;\n }\n\n svg {\n flex: 1;\n max-height: 100%;\n max-width: 100%;\n }\n\n a:hover i {\n background-color: #0000001a;\n width: 2.2em;\n }\n\n i svg path {\n stroke-width: 4;\n }\n\n slot::slotted(*) {\n flex-shrink: 0 !important;\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n const style = this.width && `:host{width:${this.width.split(\";\")[0]};}`;\n return html`<div>\n <a class=\"prev\" @click=\"${this.prev}\">${this.renderA(\"pre\")}</a>\n <section>${htmlSlot()}</section>\n ${htmlStyle(style)}\n <a class=\"next\" @click=\"${this.next}\">${this.renderA(\"suf\")}</a>\n </div>`;\n }\n\n private renderA(slot: string): HTMLTemplate {\n if (this.querySelector(`[slot=${slot}]`)) {\n return htmlSlot(slot);\n }\n return html`<i>${svgArrow()}</i>`;\n }\n\n remount(index?: number) {\n super.remount(undefined);\n if (index !== undefined) {\n this.show(index);\n }\n }\n\n protected firstUpdated() {\n if (this.assigned.length) {\n if (!this.width) {\n this.width = `${this.assigned[0].offsetWidth}px`;\n }\n if (this._clone.length) {\n this._clone.forEach((element) => element.remove());\n this._clone = [];\n }\n const last = this.assigned[0].cloneNode(true) as HTMLElement;\n const first = this.assigned[this.assigned.length - 1].cloneNode(true) as HTMLElement;\n first.style.marginLeft = \"-100%\";\n this._clone.push(first, last);\n this.appendChild(last);\n this.insertBefore(first, this.firstElementChild);\n this.show(this.index);\n }\n if (this.autochange) {\n this.intervalID = setInterval(() => {\n this.next();\n }, this.autochange);\n }\n }\n\n disconnectedCallback() {\n clearInterval(this.intervalID);\n }\n\n show(i: number) {\n this.index = i;\n this._section.style.transform = `translateX(-${i}00%)`;\n this._section.style.transition = \"inherit\";\n }\n\n next() {\n if (this.index === this.assigned.length - 3) {\n this._section.style.transform = `translateX(100%)`;\n this._section.style.transition = \"none\";\n this._section.getBoundingClientRect();\n this.show(0);\n } else {\n this.show(this.index + 1);\n }\n }\n\n prev() {\n if (this.index === 0) {\n this._section.style.transform = `translateX(-${this.assigned.length - 2}00%)`;\n this._section.style.transition = `none`;\n this._section.getBoundingClientRect();\n this.show(this.assigned.length - 3);\n } else {\n this.show(this.index - 1);\n }\n }\n}\n\nexport default CarouselSlider;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"carousel-slider\": CarouselSlider;\n }\n}\n"]}
|
@@ -17,21 +17,6 @@ let BaseForm = class BaseForm extends GodownElement {
|
|
17
17
|
*/
|
18
18
|
this.enctype = "multipart/form-data";
|
19
19
|
}
|
20
|
-
static { this.styles = [
|
21
|
-
css `
|
22
|
-
form {
|
23
|
-
display: flex;
|
24
|
-
flex-direction: column;
|
25
|
-
align-items: center;
|
26
|
-
margin: 0;
|
27
|
-
}
|
28
|
-
|
29
|
-
main {
|
30
|
-
display: flex;
|
31
|
-
flex-direction: column;
|
32
|
-
}
|
33
|
-
`,
|
34
|
-
]; }
|
35
20
|
render() {
|
36
21
|
return html `<form enctype="${this.enctype}">
|
37
22
|
${htmlSlot("pre")}
|
@@ -128,6 +113,21 @@ let BaseForm = class BaseForm extends GodownElement {
|
|
128
113
|
return formData;
|
129
114
|
}
|
130
115
|
};
|
116
|
+
BaseForm.styles = [
|
117
|
+
css `
|
118
|
+
form {
|
119
|
+
display: flex;
|
120
|
+
flex-direction: column;
|
121
|
+
align-items: center;
|
122
|
+
margin: 0;
|
123
|
+
}
|
124
|
+
|
125
|
+
main {
|
126
|
+
display: flex;
|
127
|
+
flex-direction: column;
|
128
|
+
}
|
129
|
+
`,
|
130
|
+
];
|
131
131
|
__decorate([
|
132
132
|
property()
|
133
133
|
], BaseForm.prototype, "name", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base-form.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/form/base-form.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAoC,SAAQ,aAAa;IAA/D;;QACO,SAAI,GAAG,EAAE,CAAC;QACM,UAAK,GAAG,EAAO,CAAC;QAE5C,cAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnC;;WAEG;QACS,YAAO,GAA+E,qBAAqB,CAAC;IAoH1H,CAAC;
|
1
|
+
{"version":3,"file":"base-form.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/form/base-form.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAuB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAqB,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAoC,SAAQ,aAAa;IAA/D;;QACO,SAAI,GAAG,EAAE,CAAC;QACM,UAAK,GAAG,EAAO,CAAC;QAE5C,cAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACnC;;WAEG;QACS,YAAO,GAA+E,qBAAqB,CAAC;IAoH1H,CAAC;IAhGW,MAAM;QACd,OAAO,IAAI,CAAA,kBAAkB,IAAI,CAAC,OAAO;QACrC,QAAQ,CAAC,KAAK,CAAC;cACT,QAAQ,EAAE;QAChB,QAAQ,CAAC,KAAK,CAAC;YACX,CAAC;IACX,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAgC,EAAE,EAAE;YACpD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAQ,QAAQ,CAAC,aAAa,CAAC,MAAM,CAA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ACP,QAAQ,CA4HpB;;AACD,eAAe,QAAQ,CAAC","sourcesContent":["import { css, type CSSResultGroup, html, property, query } from \"../../deps.js\";\nimport { htmlSlot, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { each } from \"../../lib/utils.js\";\nimport { define, GodownElement } from \"../../root.js\";\n\n/**\n * BaseForm gets all the names and actual values of the child element.\n */\n@define(\"base-form\")\nexport class BaseForm<T extends object = object> extends GodownElement {\n @property() name = \"\";\n @property({ type: Object }) value = {} as T;\n\n nameValue = () => this.namevalue();\n /**\n * Form enctype.\n */\n @property() enctype: \"application/x-www-form-urlencoded\" | \"multipart/form-data\" | \"text/plain\" = \"multipart/form-data\";\n\n @query(\"form\") _form: HTMLFormElement;\n\n static styles = [\n css`\n form {\n display: flex;\n flex-direction: column;\n align-items: center;\n margin: 0;\n }\n\n main {\n display: flex;\n flex-direction: column;\n }\n `,\n ] as CSSResultGroup;\n\n protected render(): HTMLTemplate {\n return html`<form enctype=\"${this.enctype}\">\n ${htmlSlot(\"pre\")}\n <main>${htmlSlot()}</main>\n ${htmlSlot(\"suf\")}\n </form>`;\n }\n\n reset() {\n each(this._form, (node: HTMLFormElement | BaseForm) => {\n if (node.reset) {\n node.reset();\n }\n });\n const form: any = document.createElement(\"form\");\n for (const slot of this.shadowRoot.querySelectorAll(\"slot\")) {\n for (const i of slot.assignedNodes() as any) {\n if (i.reset) {\n i.reset();\n }\n form.appendChild(i.cloneNode(true));\n }\n }\n form.reset();\n for (const slot of this.shadowRoot.querySelectorAll(\"slot\")) {\n for (const i of slot.assignedNodes() as any) {\n if (i.name && form[i.name]) {\n i.value = form[i.name].value;\n }\n }\n }\n form.remove();\n }\n\n namevalue(enctype = this.enctype): [string, Record<string, any>] {\n const result = {};\n const tempForm = document.createElement(\"form\");\n tempForm.enctype = enctype;\n for (const slot of this.shadowRoot.querySelectorAll(\"slot\")) {\n for (const i of slot.assignedNodes() as any) {\n if (i.namevalue) {\n const [name, value] = i.namevalue();\n if (name) {\n result[name] = value;\n }\n } else {\n tempForm.appendChild(i.cloneNode(true));\n }\n }\n }\n const formData = new FormData(tempForm);\n for (const [key, value] of formData) {\n result[key] = value;\n }\n each(this._form, (node: any) => {\n if (node.namevalue) {\n const [name, value] = node.namevalue();\n if (name) {\n result[name] = value;\n }\n }\n });\n tempForm.remove();\n return [this.name, result];\n }\n\n FormData(): FormData {\n const temp = {};\n const tempForm = document.createElement(\"form\");\n tempForm.enctype = this.enctype;\n for (const slot of this._slots) {\n for (const i of slot.assignedNodes() as any) {\n if (i.FormData) {\n for (const [key, value] of i.FormData()) {\n temp[key] = value;\n }\n } else {\n tempForm.appendChild(i.cloneNode(true));\n }\n }\n }\n const formData = new FormData(tempForm);\n each(this._form, (node: any) => {\n if (node.namevalue) {\n const [name, value] = node.namevalue();\n if (name) {\n formData.append(name, value);\n }\n }\n });\n for (const key in temp) {\n formData.append(key, temp[key]);\n }\n tempForm.remove();\n return formData;\n }\n}\nexport default BaseForm;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"base-form\": BaseForm;\n }\n}\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
|
-
import { css, html,
|
2
|
+
import { css, html, property } from "../../deps.js";
|
3
3
|
import { ifValue } from "../../lib/directives.js";
|
4
4
|
import { htmlSlot, htmlStyle } from "../../lib/templates.js";
|
5
5
|
import { append } from "../../lib/utils.js";
|
@@ -21,22 +21,9 @@ let AvatarGroup = class AvatarGroup extends GodownElement {
|
|
21
21
|
*/
|
22
22
|
this.more = 0;
|
23
23
|
}
|
24
|
-
static { this.styles = [
|
25
|
-
css `
|
26
|
-
:host {
|
27
|
-
display: flex;
|
28
|
-
width: 100%;
|
29
|
-
height: 100%;
|
30
|
-
}
|
31
|
-
|
32
|
-
div {
|
33
|
-
display: contents;
|
34
|
-
}
|
35
|
-
`,
|
36
|
-
]; }
|
37
24
|
render() {
|
38
25
|
const cssStr = `slot::slotted(:nth-of-type(n + ${(this.max || 0) + 1})) {display: none;}`;
|
39
|
-
return html `${htmlSlot()} ${htmlStyle(cssStr)} ${ifValue(this.more > 0, new AvatarA({ more: this.more })
|
26
|
+
return html `${htmlSlot()} ${htmlStyle(cssStr)} ${ifValue(this.more > 0, new AvatarA({ more: this.more }))}`;
|
40
27
|
}
|
41
28
|
firstUpdated() {
|
42
29
|
if (!this.more && this.assigned.length > this.max) {
|
@@ -73,6 +60,19 @@ let AvatarGroup = class AvatarGroup extends GodownElement {
|
|
73
60
|
}
|
74
61
|
}
|
75
62
|
};
|
63
|
+
AvatarGroup.styles = [
|
64
|
+
css `
|
65
|
+
:host {
|
66
|
+
display: flex;
|
67
|
+
width: 100%;
|
68
|
+
height: 100%;
|
69
|
+
}
|
70
|
+
|
71
|
+
div {
|
72
|
+
display: contents;
|
73
|
+
}
|
74
|
+
`,
|
75
|
+
];
|
76
76
|
__decorate([
|
77
77
|
property({ type: Number })
|
78
78
|
], AvatarGroup.prototype, "max", void 0);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"avatar-group.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/group/avatar-group.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,
|
1
|
+
{"version":3,"file":"avatar-group.js","sourceRoot":"https://github.com/startracex/godown/tree/main/src/","sources":["web-components/group/avatar-group.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAqB,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,UAAU,GAAG,c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QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvD,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC3C,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;YACvC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,OAAO;QACT,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;;AAnDM,kBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;KAUF;CACF,AAZY,CAYX;AAlB0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAU;AAIT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAR1B,WAAW;IADvB,MAAM,CAAC,UAAU,CAAC;GACN,WAAW,CA8DvB;;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { css, html, property } from \"../../deps.js\";\nimport { ifValue } from \"../../lib/directives.js\";\nimport { htmlSlot, htmlStyle, type HTMLTemplate } from \"../../lib/templates.js\";\nimport { append } from \"../../lib/utils.js\";\nimport { define, GodownElement } from \"../../root.js\";\nimport AvatarA from \"../a/avatar-a.js\";\n\nconst defineName = \"avatar-group\";\n\n/**\n * AvatarGroup ensure that the display content does not exceed the maximum value, and display the excess quantity.\n */\n@define(defineName)\nexport class AvatarGroup extends GodownElement {\n /**\n * The maximum number of elements that can be accepted for this element.\n */\n @property({ type: Number }) max = 99;\n /**\n * When the content overflows, create an {@linkcode AvatarA} with the same {@linkcode AvatarA.more} attribute as more.\n */\n @property({ type: Number }) more = 0;\n\n static styles = [\n css`\n :host {\n display: flex;\n width: 100%;\n height: 100%;\n }\n\n div {\n display: contents;\n }\n `,\n ];\n\n protected render(): HTMLTemplate {\n const cssStr = `slot::slotted(:nth-of-type(n + ${(this.max || 0) + 1})) {display: none;}`;\n return html`${htmlSlot()} ${htmlStyle(cssStr)} ${ifValue(this.more > 0, new AvatarA({ more: this.more }))}`;\n }\n\n protected firstUpdated() {\n if (!this.more && this.assigned.length > this.max) {\n this.more = this.assigned.length - this.max;\n }\n }\n\n append(args = new AvatarA()) {\n if (this.max && this.assigned.length === this.max) {\n this.assigned.pop().style.display = \"none\";\n append(this, args);\n this.assigned.pop().style.display = \"none\";\n this.more = 2;\n } else if (this.max && this.assigned.length > this.max) {\n append(this, args);\n this.assigned.pop().style.display = \"none\";\n this.more += 1;\n } else {\n append(this, args);\n }\n }\n\n subtract() {\n if (this.more === 2) {\n this.assigned.pop().style.display = \"\";\n this.more = 0;\n return;\n } else if (this.more > 0) {\n this.more -= 1;\n }\n if (this.assigned.length) {\n this.assigned.pop().remove();\n }\n }\n}\n\nexport default AvatarGroup;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"avatar-group\": AvatarGroup;\n }\n}\n"]}
|
@@ -18,13 +18,6 @@ let DetailsGroup = class DetailsGroup extends GodownElement {
|
|
18
18
|
*/
|
19
19
|
this.only = false;
|
20
20
|
}
|
21
|
-
static { this.styles = [
|
22
|
-
css `
|
23
|
-
:host {
|
24
|
-
display: block;
|
25
|
-
}
|
26
|
-
`,
|
27
|
-
]; }
|
28
21
|
render() {
|
29
22
|
return htmlSlot();
|
30
23
|
}
|
@@ -44,6 +37,13 @@ let DetailsGroup = class DetailsGroup extends GodownElement {
|
|
44
37
|
this.index = this.assigned.indexOf(e.target);
|
45
38
|
}
|
46
39
|
};
|
40
|
+
DetailsGroup.styles = [
|
41
|
+
css `
|
42
|
+
:host {
|
43
|
+
display: block;
|
44
|
+
}
|
45
|
+
`,
|
46
|
+
];
|
47
47
|
__decorate([
|
48
48
|
property({ type: Number })
|
49
49
|
], DetailsGroup.prototype, "index", void 0);
|