selfstore 1.7.2 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/advanced.js +1 -1
- package/dist/{chunk-MZMMOEFW.js → chunk-ZV2S3I76.js} +23 -3
- package/dist/chunk-ZV2S3I76.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/widgets.d.ts +4 -18
- package/dist/widgets.js +41 -1
- package/dist/widgets.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-MZMMOEFW.js.map +0 -1
package/dist/widgets.js
CHANGED
|
@@ -7,6 +7,24 @@ import './chunk-QBCU7OOP.js';
|
|
|
7
7
|
import './chunk-CM3HSBCE.js';
|
|
8
8
|
import './chunk-SFF7KKM4.js';
|
|
9
9
|
|
|
10
|
+
// src/widgets/icons.ts
|
|
11
|
+
var INK = "#8a8f98";
|
|
12
|
+
var svg = (body) => `data:image/svg+xml,${encodeURIComponent(
|
|
13
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${INK}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`
|
|
14
|
+
)}`;
|
|
15
|
+
var defaultIcons = {
|
|
16
|
+
drive: svg('<path d="M7 18h10a4 4 0 0 0 .6-7.96A6 6 0 0 0 6.2 9.2 3.9 3.9 0 0 0 7 18Z"/>'),
|
|
17
|
+
file: svg(
|
|
18
|
+
'<path d="M14 3H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7Z"/><path d="M14 3v4h4"/>'
|
|
19
|
+
),
|
|
20
|
+
webdav: svg(
|
|
21
|
+
'<rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.5h.01M7 16.5h.01"/>'
|
|
22
|
+
),
|
|
23
|
+
s3: svg(
|
|
24
|
+
'<path d="M4.5 6h15l-1.4 13a2 2 0 0 1-2 1.8H7.9a2 2 0 0 1-2-1.8Z"/><path d="M4.5 6c0-1.1 3.4-2 7.5-2s7.5.9 7.5 2"/>'
|
|
25
|
+
)
|
|
26
|
+
};
|
|
27
|
+
|
|
10
28
|
// src/widgets/base.ts
|
|
11
29
|
var baseStyles = `
|
|
12
30
|
:host {
|
|
@@ -337,6 +355,16 @@ function h(tag, attrs = {}, ...children) {
|
|
|
337
355
|
}
|
|
338
356
|
return el;
|
|
339
357
|
}
|
|
358
|
+
function upgradeOwnProperties(el) {
|
|
359
|
+
const proto = Object.getPrototypeOf(el);
|
|
360
|
+
const bag = el;
|
|
361
|
+
for (const name of Object.getOwnPropertyNames(el)) {
|
|
362
|
+
if (!(name in proto)) continue;
|
|
363
|
+
const value = bag[name];
|
|
364
|
+
delete bag[name];
|
|
365
|
+
bag[name] = value;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
340
368
|
var FlowWidget = class extends HTMLElement {
|
|
341
369
|
root;
|
|
342
370
|
styleEl;
|
|
@@ -404,6 +432,12 @@ var FlowWidget = class extends HTMLElement {
|
|
|
404
432
|
}
|
|
405
433
|
return this.t("error.generic");
|
|
406
434
|
}
|
|
435
|
+
/** Hands back whatever the host set before this class existed, then the
|
|
436
|
+
* subclass reads its attributes and wires itself. Subclasses override this
|
|
437
|
+
* and call `super.connectedCallback()` FIRST, for that reason. */
|
|
438
|
+
connectedCallback() {
|
|
439
|
+
upgradeOwnProperties(this);
|
|
440
|
+
}
|
|
407
441
|
emit(name, detail) {
|
|
408
442
|
this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
|
|
409
443
|
}
|
|
@@ -674,6 +708,7 @@ var SelfstoreConnectElement = class extends FlowWidget {
|
|
|
674
708
|
}
|
|
675
709
|
}
|
|
676
710
|
connectedCallback() {
|
|
711
|
+
super.connectedCallback();
|
|
677
712
|
if (this.#recommended === null && this.hasAttribute("recommended")) {
|
|
678
713
|
this.recommended = this.getAttribute("recommended");
|
|
679
714
|
}
|
|
@@ -911,7 +946,7 @@ var SelfstoreConnectElement = class extends FlowWidget {
|
|
|
911
946
|
return h("label", { part: "labelled" }, h("span", { part: "label" }, this.t(labelKey)), input);
|
|
912
947
|
}
|
|
913
948
|
destCard(kind) {
|
|
914
|
-
const icon = this.#icons[kind];
|
|
949
|
+
const icon = this.#icons[kind] ?? defaultIcons[kind];
|
|
915
950
|
const head = icon ? h("img", { part: "icon", src: icon, alt: "" }) : null;
|
|
916
951
|
const title = h(
|
|
917
952
|
"div",
|
|
@@ -1391,6 +1426,7 @@ var SelfstoreShareElement = class extends FlowWidget {
|
|
|
1391
1426
|
if (name === "with-members") this.withMembers = value == null || !isOff(value);
|
|
1392
1427
|
}
|
|
1393
1428
|
connectedCallback() {
|
|
1429
|
+
super.connectedCallback();
|
|
1394
1430
|
this.wire();
|
|
1395
1431
|
}
|
|
1396
1432
|
wire() {
|
|
@@ -1679,6 +1715,7 @@ var SelfstoreJoinElement = class extends FlowWidget {
|
|
|
1679
1715
|
if (name === "variant") this.variant = value ?? "card";
|
|
1680
1716
|
}
|
|
1681
1717
|
connectedCallback() {
|
|
1718
|
+
super.connectedCallback();
|
|
1682
1719
|
if (!this.#link && this.hasAttribute("link")) this.#link = this.getAttribute("link");
|
|
1683
1720
|
if (this.hasAttribute("variant")) {
|
|
1684
1721
|
this.#variant = this.getAttribute("variant") === "banner" ? "banner" : "card";
|
|
@@ -1905,6 +1942,7 @@ var SelfstoreStatusElement = class extends FlowWidget {
|
|
|
1905
1942
|
if (name === "variant") this.variant = value;
|
|
1906
1943
|
}
|
|
1907
1944
|
connectedCallback() {
|
|
1945
|
+
super.connectedCallback();
|
|
1908
1946
|
if (this.hasAttribute("variant")) this.variant = this.getAttribute("variant");
|
|
1909
1947
|
this.wire();
|
|
1910
1948
|
}
|
|
@@ -2259,6 +2297,7 @@ var SelfstoreBackupsElement = class extends FlowWidget {
|
|
|
2259
2297
|
if (name === "with-shared") this.withShared = on;
|
|
2260
2298
|
}
|
|
2261
2299
|
connectedCallback() {
|
|
2300
|
+
super.connectedCallback();
|
|
2262
2301
|
this.wire();
|
|
2263
2302
|
}
|
|
2264
2303
|
/** Re-list the rows from the destination (the host calls this after a
|
|
@@ -3342,6 +3381,7 @@ var SelfstoreGateElement = class extends FlowWidget {
|
|
|
3342
3381
|
if (name === "deferrable") this.deferrable = value !== "false";
|
|
3343
3382
|
}
|
|
3344
3383
|
connectedCallback() {
|
|
3384
|
+
super.connectedCallback();
|
|
3345
3385
|
if (this.hasAttribute("armed")) this.armed = this.getAttribute("armed") !== "false";
|
|
3346
3386
|
if (this.hasAttribute("deferrable")) {
|
|
3347
3387
|
this.deferrable = this.getAttribute("deferrable") !== "false";
|