selfstore 1.8.12 → 1.8.14

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
@@ -656,10 +656,6 @@ declare class SelfstoreDestinationElement extends FlowWidget {
656
656
  /** Stop saving to this destination. The local data stays, and so does the
657
657
  * backup already written: this detaches, it never deletes. */
658
658
  private detach;
659
- /** The connect journey, in place. Built like the gate builds it, so the
660
- * destinations, the password step and the cancel path are the library's
661
- * tested ones rather than a second implementation. */
662
- private connectView;
663
659
  protected view(into: HTMLElement): void;
664
660
  }
665
661
 
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
@@ -3717,7 +3723,7 @@ var EN8 = {
3717
3723
  "destination.exported": "The copy is written.",
3718
3724
  "destination.exportCancelled": "Nothing was written.",
3719
3725
  "destination.restore": "Restore a copy",
3720
- "destination.change": "Change destination",
3726
+ "destination.change": "Change backup",
3721
3727
  "destination.detach": "Stop saving here",
3722
3728
  "destination.detached": "Stopped. Your data stays on this device.",
3723
3729
  "destination.back": "Back",
@@ -3760,7 +3766,6 @@ var SelfstoreDestinationElement = class extends FlowWidget {
3760
3766
  #targets = null;
3761
3767
  #account = null;
3762
3768
  #confirm = null;
3763
- #changing = false;
3764
3769
  #busy = false;
3765
3770
  #message = null;
3766
3771
  defaults() {
@@ -3850,37 +3855,9 @@ var SelfstoreDestinationElement = class extends FlowWidget {
3850
3855
  return this.t("destination.detached");
3851
3856
  });
3852
3857
  }
3853
- /** The connect journey, in place. Built like the gate builds it, so the
3854
- * destinations, the password step and the cancel path are the library's
3855
- * tested ones rather than a second implementation. */
3856
- connectView(into) {
3857
- const el = document.createElement(
3858
- siblingTag(this.localName, "destination", "connect")
3859
- );
3860
- el.store = this.store;
3861
- el.targets = this.#targets;
3862
- el.icons = this.icons;
3863
- el.labels = this.labels;
3864
- const done = () => {
3865
- this.#changing = false;
3866
- this.rerender();
3867
- };
3868
- el.addEventListener("selfstore-connected", done);
3869
- el.addEventListener("selfstore-cancelled", done);
3870
- put(
3871
- into,
3872
- h(
3873
- "button",
3874
- { part: "link destination-back", type: "button", onclick: done },
3875
- this.t("destination.back")
3876
- ),
3877
- el
3878
- );
3879
- }
3880
3858
  view(into) {
3881
3859
  const host = this.hostOf();
3882
3860
  if (!host) return;
3883
- if (this.#changing && this.#targets) return this.connectView(into);
3884
3861
  const { targetKind, label, encrypted } = host.engine.state;
3885
3862
  const kind = this.t(`destination.kind.${targetKind}`);
3886
3863
  const title = kind === `destination.kind.${targetKind}` ? label ?? targetKind : kind;
@@ -3941,10 +3918,12 @@ var SelfstoreDestinationElement = class extends FlowWidget {
3941
3918
  "destination-restore",
3942
3919
  () => this.emit("selfstore-destination-action", { action: "restore" })
3943
3920
  ),
3944
- this.#targets ? act("destination.change", "destination-change", () => {
3945
- this.#changing = true;
3946
- this.rerender();
3947
- }) : null,
3921
+ // Changing backup lets the destination go and stops there: the
3922
+ // first-run screen the app already mounts is what asks where to go
3923
+ // next. A second connect journey inside this panel gave the same
3924
+ // decision two mechanics depending on which control was pressed, and
3925
+ // only one of them could be reached from anywhere in the app.
3926
+ this.#targets ? act("destination.change", "destination-change", () => void this.detach(label)) : null,
3948
3927
  act("destination.detach", "destination-detach", () => void this.detach(label))
3949
3928
  ),
3950
3929
  this.#message ? h("div", { part: "sub destination-message", role: "status" }, this.#message) : null
@@ -4096,7 +4075,8 @@ var EN9 = {
4096
4075
  "account.settings": "Settings",
4097
4076
  "account.change": "Change backup",
4098
4077
  "account.saved": "Saved {when}",
4099
- "account.justNow": "just now"
4078
+ "account.justNow": "just now",
4079
+ "error.generic": "Something went wrong."
4100
4080
  };
4101
4081
  var FR9 = {
4102
4082
  ...FR4,
@@ -4104,7 +4084,8 @@ var FR9 = {
4104
4084
  "account.settings": "Param\xE8tres",
4105
4085
  "account.change": "Changer de sauvegarde",
4106
4086
  "account.saved": "Enregistr\xE9 {when}",
4107
- "account.justNow": "\xE0 l'instant"
4087
+ "account.justNow": "\xE0 l'instant",
4088
+ "error.generic": "Quelque chose n'a pas fonctionn\xE9."
4108
4089
  };
4109
4090
  var ACCOUNT_STYLES = `
4110
4091
  :host { position: relative; display: inline-block; }
@@ -4193,20 +4174,35 @@ var ACCOUNT_STYLES = `
4193
4174
  text-overflow: ellipsis;
4194
4175
  white-space: nowrap;
4195
4176
  }
4177
+ /* A menu item is a plain line of text, not a link: underlined blue links in a
4178
+ menu read as four different destinations to weigh, which is exactly the
4179
+ feeling this menu exists to remove. */
4196
4180
  [part~='account-item'] {
4197
4181
  text-align: start;
4198
- padding: 0.4rem 0.6rem;
4182
+ padding: 0.5rem 0.55rem;
4183
+ border: none;
4184
+ background: none;
4199
4185
  border-radius: calc(var(--_radius) * 0.75);
4186
+ font: inherit;
4187
+ font-size: 0.8125rem;
4200
4188
  text-decoration: none;
4201
4189
  color: inherit;
4190
+ cursor: pointer;
4191
+ white-space: nowrap;
4202
4192
  }
4203
4193
  [part~='account-item']:hover { background: color-mix(in srgb, currentColor 7%, transparent); }
4194
+ /* Letting a destination go is the one gesture here that takes something away:
4195
+ it wears the colour every other screen uses for that, and nothing else does. */
4196
+ [part~='account-change'] { color: var(--_danger); }
4197
+ [part~='account-change']:hover { background: color-mix(in srgb, var(--_danger) 10%, transparent); }
4204
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); }
4205
4200
  `;
4206
4201
  var TICK_MS = 3e4;
4207
4202
  var SelfstoreAccountElement = class extends FlowWidget {
4208
4203
  #confirm = null;
4209
4204
  #open = false;
4205
+ #error = null;
4210
4206
  #timer = null;
4211
4207
  #away = null;
4212
4208
  defaults() {
@@ -4327,13 +4323,20 @@ var SelfstoreAccountElement = class extends FlowWidget {
4327
4323
  const host = this.hostOf();
4328
4324
  if (!host) return;
4329
4325
  this.open = false;
4326
+ this.#error = null;
4330
4327
  const label = host.engine.state.label;
4331
4328
  try {
4332
4329
  if (this.#confirm && !await this.#confirm({ type: "detach", label })) return;
4333
4330
  } catch {
4334
4331
  return;
4335
4332
  }
4336
- 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
+ }
4337
4340
  }
4338
4341
  card(host) {
4339
4342
  const { targetKind } = host.engine.state;
@@ -4385,7 +4388,7 @@ var SelfstoreAccountElement = class extends FlowWidget {
4385
4388
  h(
4386
4389
  "button",
4387
4390
  {
4388
- part: "link account-item",
4391
+ part: "account-item",
4389
4392
  type: "button",
4390
4393
  role: "menuitem",
4391
4394
  onclick: () => this.settings()
@@ -4395,13 +4398,14 @@ var SelfstoreAccountElement = class extends FlowWidget {
4395
4398
  h(
4396
4399
  "button",
4397
4400
  {
4398
- part: "link account-item account-change",
4401
+ part: "account-item account-change",
4399
4402
  type: "button",
4400
4403
  role: "menuitem",
4401
4404
  onclick: () => void this.change()
4402
4405
  },
4403
4406
  this.t("account.change")
4404
- )
4407
+ ),
4408
+ this.#error ? h("p", { part: "account-error", role: "alert" }, this.#error) : null
4405
4409
  ) : null;
4406
4410
  put(into, trigger, menu);
4407
4411
  if (menu) this.anchor(menu);