selfstore 1.8.13 → 1.8.15

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 CHANGED
@@ -796,10 +796,14 @@ declare class SelfstoreAccountElement extends FlowWidget {
796
796
  private anchor;
797
797
  }
798
798
 
799
+ /** A glyph per destination kind: a cloud for a hosted drive, a document for a
800
+ * file on the device, a server for WebDAV, a bucket for object storage. */
801
+ declare const defaultIcons: Record<ConnectKind, string>;
802
+
799
803
  /** Register the elements as <PREFIX-connect>, <PREFIX-share>, <PREFIX-join>,
800
804
  * <PREFIX-status>, <PREFIX-backups>, <PREFIX-gate> and
801
805
  * <PREFIX-destination> (default prefix 'selfstore'). Safe to call twice;
802
806
  * throws in environments without custom elements (browser code only). */
803
807
  declare function defineSelfstoreWidgets(prefix?: string): void;
804
808
 
805
- export { type BackupsAction, type DestinationAction, FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, type ShareAction, type WebdavPreset, type WidgetLabels, defineSelfstoreWidgets };
809
+ 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
@@ -2066,13 +2066,19 @@ var EN4 = {
2066
2066
  "destination.kind.file": "A file on this device",
2067
2067
  "destination.kind.webdav": "Your own server",
2068
2068
  "destination.kind.s3": "Your own bucket",
2069
- "destination.kind.device": "This device only"
2069
+ "destination.kind.device": "This device only",
2070
+ // A browser that cannot hold a writable file handle: the data is kept here
2071
+ // and a backup is written only when the user asks for one. It is a mode the
2072
+ // STORE itself falls back to, so the library owes it a name - without one, a
2073
+ // panel showed the raw key to the user.
2074
+ "destination.kind.file-manual": "A file you download"
2070
2075
  };
2071
2076
  var FR4 = {
2072
2077
  "destination.kind.file": "Un fichier sur cet appareil",
2073
2078
  "destination.kind.webdav": "Votre serveur",
2074
2079
  "destination.kind.s3": "Votre bucket",
2075
- "destination.kind.device": "Cet appareil seulement"
2080
+ "destination.kind.device": "Cet appareil seulement",
2081
+ "destination.kind.file-manual": "Un fichier, par t\xE9l\xE9chargement"
2076
2082
  };
2077
2083
 
2078
2084
  // src/widgets/status.ts
@@ -4069,7 +4075,8 @@ var EN9 = {
4069
4075
  "account.settings": "Settings",
4070
4076
  "account.change": "Change backup",
4071
4077
  "account.saved": "Saved {when}",
4072
- "account.justNow": "just now"
4078
+ "account.justNow": "just now",
4079
+ "error.generic": "Something went wrong."
4073
4080
  };
4074
4081
  var FR9 = {
4075
4082
  ...FR4,
@@ -4077,7 +4084,8 @@ var FR9 = {
4077
4084
  "account.settings": "Param\xE8tres",
4078
4085
  "account.change": "Changer de sauvegarde",
4079
4086
  "account.saved": "Enregistr\xE9 {when}",
4080
- "account.justNow": "\xE0 l'instant"
4087
+ "account.justNow": "\xE0 l'instant",
4088
+ "error.generic": "Quelque chose n'a pas fonctionn\xE9."
4081
4089
  };
4082
4090
  var ACCOUNT_STYLES = `
4083
4091
  :host { position: relative; display: inline-block; }
@@ -4188,11 +4196,13 @@ var ACCOUNT_STYLES = `
4188
4196
  [part~='account-change'] { color: var(--_danger); }
4189
4197
  [part~='account-change']:hover { background: color-mix(in srgb, var(--_danger) 10%, transparent); }
4190
4198
  [part~='account-sep'] { height: 1px; background: var(--_border); margin: 0.2rem 0.3rem; }
4199
+ [part~='account-error'] { margin: 0.15rem 0.55rem 0.3rem; font-size: 0.8125rem; color: var(--_danger); }
4191
4200
  `;
4192
4201
  var TICK_MS = 3e4;
4193
4202
  var SelfstoreAccountElement = class extends FlowWidget {
4194
4203
  #confirm = null;
4195
4204
  #open = false;
4205
+ #error = null;
4196
4206
  #timer = null;
4197
4207
  #away = null;
4198
4208
  defaults() {
@@ -4313,13 +4323,20 @@ var SelfstoreAccountElement = class extends FlowWidget {
4313
4323
  const host = this.hostOf();
4314
4324
  if (!host) return;
4315
4325
  this.open = false;
4326
+ this.#error = null;
4316
4327
  const label = host.engine.state.label;
4317
4328
  try {
4318
4329
  if (this.#confirm && !await this.#confirm({ type: "detach", label })) return;
4319
4330
  } catch {
4320
4331
  return;
4321
4332
  }
4322
- await host.engine.detachTarget();
4333
+ try {
4334
+ await host.engine.detachTarget();
4335
+ } catch {
4336
+ this.#error = this.t("error.generic");
4337
+ this.open = true;
4338
+ this.rerender();
4339
+ }
4323
4340
  }
4324
4341
  card(host) {
4325
4342
  const { targetKind } = host.engine.state;
@@ -4387,7 +4404,8 @@ var SelfstoreAccountElement = class extends FlowWidget {
4387
4404
  onclick: () => void this.change()
4388
4405
  },
4389
4406
  this.t("account.change")
4390
- )
4407
+ ),
4408
+ this.#error ? h("p", { part: "account-error", role: "alert" }, this.#error) : null
4391
4409
  ) : null;
4392
4410
  put(into, trigger, menu);
4393
4411
  if (menu) this.anchor(menu);
@@ -4426,6 +4444,6 @@ function defineSelfstoreWidgets(prefix = "selfstore") {
4426
4444
  define(`${prefix}-account`, SelfstoreAccountElement);
4427
4445
  }
4428
4446
 
4429
- export { FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, defineSelfstoreWidgets };
4447
+ export { FlowWidget, SelfstoreAccountElement, SelfstoreBackupsElement, SelfstoreConnectElement, SelfstoreDestinationElement, SelfstoreGateElement, SelfstoreJoinElement, SelfstoreShareElement, SelfstoreStatusElement, SelfstoreStorageElement, defaultIcons, defineSelfstoreWidgets };
4430
4448
  //# sourceMappingURL=widgets.js.map
4431
4449
  //# sourceMappingURL=widgets.js.map