selfstore 1.8.14 → 1.8.16
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/dist/widgets.d.ts +24 -10
- package/dist/widgets.js +62 -24
- package/dist/widgets.js.map +1 -1
- package/package.json +1 -1
package/dist/widgets.d.ts
CHANGED
|
@@ -356,9 +356,13 @@ declare class SelfstoreStatusElement extends FlowWidget {
|
|
|
356
356
|
static get observedAttributes(): string[];
|
|
357
357
|
protected defaults(): WidgetLabels;
|
|
358
358
|
protected packs(): Record<string, WidgetLabels>;
|
|
359
|
-
/**
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
/**
|
|
360
|
+
* 'row' (a tinted box: dot, text, action button - for a settings page),
|
|
361
|
+
* 'line' (one line and a link - for a menu, where a box eats the surface),
|
|
362
|
+
* or 'dot' (the dot alone, for a header corner). Also the attribute.
|
|
363
|
+
*/
|
|
364
|
+
get variant(): 'row' | 'line' | 'dot';
|
|
365
|
+
set variant(v: 'row' | 'line' | 'dot' | null);
|
|
362
366
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
363
367
|
connectedCallback(): void;
|
|
364
368
|
protected view(into: HTMLElement): void;
|
|
@@ -767,13 +771,19 @@ declare class SelfstoreAccountElement extends FlowWidget {
|
|
|
767
771
|
* shipped name: its own label is a better answer than the raw key. */
|
|
768
772
|
private named;
|
|
769
773
|
/**
|
|
770
|
-
* The one line
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
* (reconnect, unlock, changes to download) belongs to <selfstore-status>,
|
|
774
|
-
* which owns both the wording and the button that resolves it.
|
|
774
|
+
* The one line this element words itself: a plain "saved", the only state
|
|
775
|
+
* with nothing to do about it and the only one where WHEN is the whole
|
|
776
|
+
* information. Null in every other state.
|
|
775
777
|
*/
|
|
776
|
-
private
|
|
778
|
+
private saved;
|
|
779
|
+
/**
|
|
780
|
+
* Anything that is NOT a plain "saved" - reconnect, unlock, changes to
|
|
781
|
+
* export - belongs to <selfstore-status>, which owns both the wording and
|
|
782
|
+
* the gesture. It goes under the card and across the whole menu, never
|
|
783
|
+
* inside the card's text column: that column is sized for an address, and a
|
|
784
|
+
* sentence wrapping in 167 px turned a three-word notice into 247 px of box.
|
|
785
|
+
*/
|
|
786
|
+
private attention;
|
|
777
787
|
/** Ask for the settings. The host owns the route, so this only says that it
|
|
778
788
|
* was asked - and closes, because a menu that stays open behind a page
|
|
779
789
|
* transition reads as a failed click. */
|
|
@@ -796,10 +806,14 @@ declare class SelfstoreAccountElement extends FlowWidget {
|
|
|
796
806
|
private anchor;
|
|
797
807
|
}
|
|
798
808
|
|
|
809
|
+
/** A glyph per destination kind: a cloud for a hosted drive, a document for a
|
|
810
|
+
* file on the device, a server for WebDAV, a bucket for object storage. */
|
|
811
|
+
declare const defaultIcons: Record<ConnectKind, string>;
|
|
812
|
+
|
|
799
813
|
/** Register the elements as <PREFIX-connect>, <PREFIX-share>, <PREFIX-join>,
|
|
800
814
|
* <PREFIX-status>, <PREFIX-backups>, <PREFIX-gate> and
|
|
801
815
|
* <PREFIX-destination> (default prefix 'selfstore'). Safe to call twice;
|
|
802
816
|
* throws in environments without custom elements (browser code only). */
|
|
803
817
|
declare function defineSelfstoreWidgets(prefix?: string): void;
|
|
804
818
|
|
|
805
|
-
export { type BackupsAction, type DestinationAction, FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, type ShareAction, type WebdavPreset, type WidgetLabels, defineSelfstoreWidgets };
|
|
819
|
+
export { type BackupsAction, type DestinationAction, FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, type ShareAction, type WebdavPreset, type WidgetLabels, defaultIcons, defineSelfstoreWidgets };
|
package/dist/widgets.js
CHANGED
|
@@ -2071,14 +2071,14 @@ var EN4 = {
|
|
|
2071
2071
|
// and a backup is written only when the user asks for one. It is a mode the
|
|
2072
2072
|
// STORE itself falls back to, so the library owes it a name - without one, a
|
|
2073
2073
|
// panel showed the raw key to the user.
|
|
2074
|
-
"destination.kind.file-manual": "A file
|
|
2074
|
+
"destination.kind.file-manual": "A file"
|
|
2075
2075
|
};
|
|
2076
2076
|
var FR4 = {
|
|
2077
2077
|
"destination.kind.file": "Un fichier sur cet appareil",
|
|
2078
2078
|
"destination.kind.webdav": "Votre serveur",
|
|
2079
2079
|
"destination.kind.s3": "Votre bucket",
|
|
2080
2080
|
"destination.kind.device": "Cet appareil seulement",
|
|
2081
|
-
"destination.kind.file-manual": "Un fichier
|
|
2081
|
+
"destination.kind.file-manual": "Un fichier"
|
|
2082
2082
|
};
|
|
2083
2083
|
|
|
2084
2084
|
// src/widgets/status.ts
|
|
@@ -2125,12 +2125,16 @@ var SelfstoreStatusElement = class extends FlowWidget {
|
|
|
2125
2125
|
packs() {
|
|
2126
2126
|
return { fr: FR5 };
|
|
2127
2127
|
}
|
|
2128
|
-
/**
|
|
2128
|
+
/**
|
|
2129
|
+
* 'row' (a tinted box: dot, text, action button - for a settings page),
|
|
2130
|
+
* 'line' (one line and a link - for a menu, where a box eats the surface),
|
|
2131
|
+
* or 'dot' (the dot alone, for a header corner). Also the attribute.
|
|
2132
|
+
*/
|
|
2129
2133
|
get variant() {
|
|
2130
2134
|
return this.#variant;
|
|
2131
2135
|
}
|
|
2132
2136
|
set variant(v) {
|
|
2133
|
-
this.#variant = v === "dot"
|
|
2137
|
+
this.#variant = v === "dot" || v === "line" ? v : "row";
|
|
2134
2138
|
this.rerender();
|
|
2135
2139
|
}
|
|
2136
2140
|
attributeChangedCallback(name, _old, value) {
|
|
@@ -2138,7 +2142,8 @@ var SelfstoreStatusElement = class extends FlowWidget {
|
|
|
2138
2142
|
}
|
|
2139
2143
|
connectedCallback() {
|
|
2140
2144
|
super.connectedCallback();
|
|
2141
|
-
if (this.hasAttribute("variant"))
|
|
2145
|
+
if (this.hasAttribute("variant"))
|
|
2146
|
+
this.variant = this.getAttribute("variant");
|
|
2142
2147
|
this.follow(this.hostOf());
|
|
2143
2148
|
}
|
|
2144
2149
|
view(into) {
|
|
@@ -2156,6 +2161,9 @@ var SelfstoreStatusElement = class extends FlowWidget {
|
|
|
2156
2161
|
part: `status-dot sev-${status.severity}`,
|
|
2157
2162
|
"aria-hidden": "true"
|
|
2158
2163
|
});
|
|
2164
|
+
const GLYPH = { ok: "\u2713", warn: "!", danger: "!", info: "" };
|
|
2165
|
+
const glyph = GLYPH[status.severity];
|
|
2166
|
+
const sign = glyph ? h("span", { part: `status-glyph sev-${status.severity}`, "aria-hidden": "true" }, glyph) : dot;
|
|
2159
2167
|
if (this.#variant === "dot") {
|
|
2160
2168
|
into.append(
|
|
2161
2169
|
h(
|
|
@@ -2171,14 +2179,33 @@ var SelfstoreStatusElement = class extends FlowWidget {
|
|
|
2171
2179
|
);
|
|
2172
2180
|
return;
|
|
2173
2181
|
}
|
|
2182
|
+
if (this.#variant === "line") {
|
|
2183
|
+
put(
|
|
2184
|
+
into,
|
|
2185
|
+
h(
|
|
2186
|
+
"div",
|
|
2187
|
+
{ part: "row status-line" },
|
|
2188
|
+
sign,
|
|
2189
|
+
h("span", { part: "status-line-text" }, text),
|
|
2190
|
+
status.actionable && status.action ? h(
|
|
2191
|
+
"button",
|
|
2192
|
+
{
|
|
2193
|
+
part: "link status-action",
|
|
2194
|
+
type: "button",
|
|
2195
|
+
onclick: () => this.emit("selfstore-status-action", { action: status.action })
|
|
2196
|
+
},
|
|
2197
|
+
this.t(`status.action.${status.action}`)
|
|
2198
|
+
) : null
|
|
2199
|
+
)
|
|
2200
|
+
);
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2174
2203
|
const TINT = {
|
|
2175
2204
|
ok: "status-ok",
|
|
2176
2205
|
warn: "status-warn",
|
|
2177
2206
|
danger: "status-error",
|
|
2178
2207
|
info: ""
|
|
2179
2208
|
};
|
|
2180
|
-
const GLYPH = { ok: "\u2713", warn: "!", danger: "!", info: "" };
|
|
2181
|
-
const glyph = GLYPH[status.severity];
|
|
2182
2209
|
const icon = this.icons[targetKind];
|
|
2183
2210
|
const where = this.t(`status.where.${targetKind}`);
|
|
2184
2211
|
const kindName = this.t(`destination.kind.${targetKind}`);
|
|
@@ -2193,9 +2220,9 @@ var SelfstoreStatusElement = class extends FlowWidget {
|
|
|
2193
2220
|
h(
|
|
2194
2221
|
"div",
|
|
2195
2222
|
{ part: `status row status-row ${TINT[status.severity] ?? ""}` },
|
|
2196
|
-
// The severity colors the
|
|
2223
|
+
// The severity colors the sign, not the box: tinting the whole line
|
|
2197
2224
|
// turns a title into a warning about itself.
|
|
2198
|
-
|
|
2225
|
+
sign,
|
|
2199
2226
|
icon ? h("img", { part: "icon", src: icon, alt: "" }) : null,
|
|
2200
2227
|
h(
|
|
2201
2228
|
"div",
|
|
@@ -4196,6 +4223,7 @@ var ACCOUNT_STYLES = `
|
|
|
4196
4223
|
[part~='account-change'] { color: var(--_danger); }
|
|
4197
4224
|
[part~='account-change']:hover { background: color-mix(in srgb, var(--_danger) 10%, transparent); }
|
|
4198
4225
|
[part~='account-sep'] { height: 1px; background: var(--_border); margin: 0.2rem 0.3rem; }
|
|
4226
|
+
[part~='account-status'] { display: block; padding: 0 0.6rem 0.2rem; font-size: 0.8125rem; }
|
|
4199
4227
|
[part~='account-error'] { margin: 0.15rem 0.55rem 0.3rem; font-size: 0.8125rem; color: var(--_danger); }
|
|
4200
4228
|
`;
|
|
4201
4229
|
var TICK_MS = 3e4;
|
|
@@ -4287,24 +4315,33 @@ var SelfstoreAccountElement = class extends FlowWidget {
|
|
|
4287
4315
|
return kind === `destination.kind.${targetKind}` ? label ?? targetKind : kind;
|
|
4288
4316
|
}
|
|
4289
4317
|
/**
|
|
4290
|
-
* The one line
|
|
4291
|
-
*
|
|
4292
|
-
*
|
|
4293
|
-
* (reconnect, unlock, changes to download) belongs to <selfstore-status>,
|
|
4294
|
-
* which owns both the wording and the button that resolves it.
|
|
4318
|
+
* The one line this element words itself: a plain "saved", the only state
|
|
4319
|
+
* with nothing to do about it and the only one where WHEN is the whole
|
|
4320
|
+
* information. Null in every other state.
|
|
4295
4321
|
*/
|
|
4296
|
-
|
|
4322
|
+
saved(host) {
|
|
4297
4323
|
const { status, lastSavedAt } = host.engine.state;
|
|
4298
|
-
if (status.state
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4324
|
+
if (status.state !== "saved" || !lastSavedAt || "status.saved" in this.labels) return null;
|
|
4325
|
+
return h(
|
|
4326
|
+
"span",
|
|
4327
|
+
{ part: "account-line" },
|
|
4328
|
+
this.t("account.saved", { when: this.since(lastSavedAt, this.t("account.justNow")) })
|
|
4329
|
+
);
|
|
4330
|
+
}
|
|
4331
|
+
/**
|
|
4332
|
+
* Anything that is NOT a plain "saved" - reconnect, unlock, changes to
|
|
4333
|
+
* export - belongs to <selfstore-status>, which owns both the wording and
|
|
4334
|
+
* the gesture. It goes under the card and across the whole menu, never
|
|
4335
|
+
* inside the card's text column: that column is sized for an address, and a
|
|
4336
|
+
* sentence wrapping in 167 px turned a three-word notice into 247 px of box.
|
|
4337
|
+
*/
|
|
4338
|
+
attention(host) {
|
|
4339
|
+
if (this.saved(host)) return null;
|
|
4304
4340
|
const el = document.createElement(
|
|
4305
4341
|
siblingTag(this.localName, "account", "status")
|
|
4306
4342
|
);
|
|
4307
|
-
el.setAttribute("variant", "
|
|
4343
|
+
el.setAttribute("variant", "line");
|
|
4344
|
+
el.setAttribute("part", "account-status");
|
|
4308
4345
|
el.labels = this.labels;
|
|
4309
4346
|
el.icons = this.icons;
|
|
4310
4347
|
el.store = this.store;
|
|
@@ -4357,7 +4394,7 @@ var SelfstoreAccountElement = class extends FlowWidget {
|
|
|
4357
4394
|
{ part: "account-text" },
|
|
4358
4395
|
h("span", { part: "account-title" }, this.named(host)),
|
|
4359
4396
|
mail ? h("span", { part: "account-mail" }, mail) : null,
|
|
4360
|
-
this.
|
|
4397
|
+
this.saved(host)
|
|
4361
4398
|
)
|
|
4362
4399
|
);
|
|
4363
4400
|
}
|
|
@@ -4384,6 +4421,7 @@ var SelfstoreAccountElement = class extends FlowWidget {
|
|
|
4384
4421
|
"div",
|
|
4385
4422
|
{ part: "card account-menu", role: "menu" },
|
|
4386
4423
|
this.card(host),
|
|
4424
|
+
this.attention(host),
|
|
4387
4425
|
h("div", { part: "account-sep" }),
|
|
4388
4426
|
h(
|
|
4389
4427
|
"button",
|
|
@@ -4444,6 +4482,6 @@ function defineSelfstoreWidgets(prefix = "selfstore") {
|
|
|
4444
4482
|
define(`${prefix}-account`, SelfstoreAccountElement);
|
|
4445
4483
|
}
|
|
4446
4484
|
|
|
4447
|
-
export { FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, defineSelfstoreWidgets };
|
|
4485
|
+
export { FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, defaultIcons, defineSelfstoreWidgets };
|
|
4448
4486
|
//# sourceMappingURL=widgets.js.map
|
|
4449
4487
|
//# sourceMappingURL=widgets.js.map
|