folder-pane 4.0.1-2 → 4.1.1-0

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.
Files changed (65) hide show
  1. package/README.md +4 -0
  2. package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js +14 -5
  3. package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js.map +1 -1
  4. package/dist/components/folder-pane-container/FolderPaneContainer.d.ts +11 -1
  5. package/dist/components/folder-pane-container/FolderPaneContainer.d.ts.map +1 -1
  6. package/dist/components/folder-pane-container/FolderPaneContainer.esm.js +174 -121
  7. package/dist/components/folder-pane-container/FolderPaneContainer.esm.js.map +1 -1
  8. package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js +1 -1
  9. package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js.map +1 -1
  10. package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js +1 -1
  11. package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js.map +1 -1
  12. package/dist/components/folder-pane-content/FolderPaneContent.cjs.js.map +1 -1
  13. package/dist/components/folder-pane-content/FolderPaneContent.esm.js.map +1 -1
  14. package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js.map +1 -1
  15. package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js.map +1 -1
  16. package/dist/components/folder-pane-provider/FolderPaneProvider.cjs.js.map +1 -1
  17. package/dist/components/folder-pane-provider/FolderPaneProvider.esm.js.map +1 -1
  18. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.cjs.js.map +1 -1
  19. package/dist/components/folder-pane-provider/FolderPaneProvider.styles.esm.js.map +1 -1
  20. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js +8 -7
  21. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js.map +1 -1
  22. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts +2 -0
  23. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts.map +1 -1
  24. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js +84 -77
  25. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js.map +1 -1
  26. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js +1 -1
  27. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js.map +1 -1
  28. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js +1 -1
  29. package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js.map +1 -1
  30. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.cjs.js.map +1 -1
  31. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.esm.js.map +1 -1
  32. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.cjs.js.map +1 -1
  33. package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.esm.js.map +1 -1
  34. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js +5 -5
  35. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js.map +1 -1
  36. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts +1 -0
  37. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts.map +1 -1
  38. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js +16 -10
  39. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js.map +1 -1
  40. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js +1 -1
  41. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js.map +1 -1
  42. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js +1 -1
  43. package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js.map +1 -1
  44. package/dist/components/folder-pane-view/FolderPaneView.cjs.js +2 -2
  45. package/dist/components/folder-pane-view/FolderPaneView.cjs.js.map +1 -1
  46. package/dist/components/folder-pane-view/FolderPaneView.d.ts +6 -0
  47. package/dist/components/folder-pane-view/FolderPaneView.d.ts.map +1 -1
  48. package/dist/components/folder-pane-view/FolderPaneView.esm.js +164 -118
  49. package/dist/components/folder-pane-view/FolderPaneView.esm.js.map +1 -1
  50. package/dist/folderPane.cjs.js +2 -2
  51. package/dist/folderPane.cjs.js.map +1 -1
  52. package/dist/folderPane.d.ts.map +1 -1
  53. package/dist/folderPane.esm.js +17 -15
  54. package/dist/folderPane.esm.js.map +1 -1
  55. package/dist/helpers.cjs.js.map +1 -1
  56. package/dist/helpers.d.ts +1 -1
  57. package/dist/helpers.d.ts.map +1 -1
  58. package/dist/helpers.esm.js.map +1 -1
  59. package/dist/resourceActionItems.cjs.js +1 -1
  60. package/dist/resourceActionItems.cjs.js.map +1 -1
  61. package/dist/resourceActionItems.d.ts +4 -5
  62. package/dist/resourceActionItems.d.ts.map +1 -1
  63. package/dist/resourceActionItems.esm.js +14 -14
  64. package/dist/resourceActionItems.esm.js.map +1 -1
  65. package/package.json +4 -4
@@ -11,17 +11,17 @@ import { invalidCreationNameMessage as u, isSafeCreationName as d } from "../../
11
11
  import { PaneMintError as f, mintPaneInstance as p, setMintStatus as m } from "../../mintPaneInstance.esm.js";
12
12
  import { error as h, warn as g } from "../../debug.esm.js";
13
13
  import { clearFailedResource as _ } from "./resourceLoad.esm.js";
14
- import { FILE_EXPLORER_BACK_EVENT as v, FILE_EXPLORER_OPEN_PANE_EVENT as y, WebComponent as b, aclControl as x, composeExplorer as S, customElement as C, getPreferredPane as w, getRelevantPanes as T, isExplorerEvent as E, log as D, ns as O, preparePaneMenuItems as k, showDialog as A, widgets as j } from "solid-ui";
15
- import { authSession as M, authn as N } from "solid-logic";
16
- import { html as P, nothing as ee } from "lit";
17
- import { property as F, query as I, state as L } from "lit/decorators.js";
14
+ import { FILE_EXPLORER_BACK_EVENT as v, FILE_EXPLORER_OPEN_PANE_EVENT as y, WebComponent as b, aclControl as x, composeExplorer as S, customElement as C, getPreferredPane as w, getRelevantPanes as T, isExplorerEvent as E, log as D, ns as O, preparePaneMenuItems as k, showDialog as A } from "solid-ui";
15
+ import { authSession as j, authn as M } from "solid-logic";
16
+ import { html as N, nothing as ee } from "lit";
17
+ import { property as P, query as F, state as I } from "lit/decorators.js";
18
18
  import "solid-ui/components/button";
19
19
  import "solid-ui/components/file-explorer-provider";
20
20
  import "solid-ui/components/error-state";
21
21
  import "solid-ui/components/file-explorer-header";
22
22
  // src/components/folder-pane-view/FolderPaneView.ts
23
23
  var te, ne, re, ie, ae, oe, se, ce, le, ue, de, fe, pe, me, he, ge, _e, ve, ye, be, xe, Se, Ce, we, Te, Ee, De, Oe, ke, Ae, je, Me, Ne, Pe, Fe, Ie, Le, Re, ze;
24
- function R(e, t, n) {
24
+ function L(e, t, n) {
25
25
  return (t = Ue(t)) in e ? Object.defineProperty(e, t, {
26
26
  value: n,
27
27
  enumerable: !0,
@@ -29,16 +29,16 @@ function R(e, t, n) {
29
29
  writable: !0
30
30
  }) : e[t] = n, e;
31
31
  }
32
- function z(e, t, n) {
32
+ function R(e, t, n) {
33
33
  Be(e, t), t.set(e, n);
34
34
  }
35
35
  function Be(e, t) {
36
36
  if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
37
37
  }
38
- function B(e, t, n) {
38
+ function z(e, t, n) {
39
39
  return e.set(Ve(e, t), n), n;
40
40
  }
41
- function V(e, t) {
41
+ function B(e, t) {
42
42
  return e.get(Ve(e, t));
43
43
  }
44
44
  function Ve(e, t, n) {
@@ -189,27 +189,27 @@ function Ke(e) {
189
189
  if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
190
190
  return e;
191
191
  }
192
- function H(e, t) {
192
+ function V(e, t) {
193
193
  if (!Number.isFinite(t) || t <= 320) return 256;
194
194
  let n = t - 320;
195
195
  return n < 180 ? 256 : Math.min(480, n, Math.max(180, Number.isFinite(e) ? e : 256));
196
196
  }
197
197
  ie = [C("folder-pane-view")];
198
- var qe, U = /*#__PURE__*/ new WeakMap(), W = /*#__PURE__*/ new WeakMap(), G = /*#__PURE__*/ new WeakMap(), K = /*#__PURE__*/ new WeakMap(), q = /*#__PURE__*/ new WeakMap(), J = /*#__PURE__*/ new WeakMap(), Y = /*#__PURE__*/ new WeakMap(), X = /*#__PURE__*/ new WeakMap(), Z = /*#__PURE__*/ new WeakMap(), Q = /*#__PURE__*/ new WeakMap(), Je = /*#__PURE__*/ new WeakMap(), Ye = /*#__PURE__*/ new WeakMap(), Xe = /*#__PURE__*/ new WeakMap(), Ze = /*#__PURE__*/ new WeakMap(), Qe = /*#__PURE__*/ new WeakMap(), $e = /*#__PURE__*/ new WeakMap(), $ = /*#__PURE__*/ new WeakMap();
199
- ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
198
+ var qe, H = /*#__PURE__*/ new WeakMap(), U = /*#__PURE__*/ new WeakMap(), W = /*#__PURE__*/ new WeakMap(), G = /*#__PURE__*/ new WeakMap(), K = /*#__PURE__*/ new WeakMap(), q = /*#__PURE__*/ new WeakMap(), J = /*#__PURE__*/ new WeakMap(), Y = /*#__PURE__*/ new WeakMap(), X = /*#__PURE__*/ new WeakMap(), Z = /*#__PURE__*/ new WeakMap(), Q = /*#__PURE__*/ new WeakMap(), Je = /*#__PURE__*/ new WeakMap(), Ye = /*#__PURE__*/ new WeakMap(), Xe = /*#__PURE__*/ new WeakMap(), Ze = /*#__PURE__*/ new WeakMap(), Qe = /*#__PURE__*/ new WeakMap(), $ = /*#__PURE__*/ new WeakMap();
199
+ ze = (ae = P({ attribute: !1 }), se = P({ attribute: !1 }), le = P({
200
200
  type: Boolean,
201
201
  attribute: "full-view"
202
- }), de = L(), pe = L(), he = L(), _e = L(), ye = L(), xe = L(), Ce = L(), Te = L(), De = L(), ke = L(), je = I("folder-pane-content"), Ne = I(".folder-pane-full-view"), Fe = I("folder-pane-sidebar"), Le = I(".folder-pane-status"), "browserContext"), te = class extends b {
202
+ }), de = I(), pe = I(), he = I(), _e = I(), ye = I(), xe = I(), Ce = I(), Te = I(), De = I(), ke = I(), je = F("folder-pane-content"), Ne = F(".folder-pane-full-view"), Fe = F("folder-pane-sidebar"), Le = F(".folder-pane-status"), "browserContext"), te = class extends b {
203
203
  constructor(...t) {
204
- super(...t), z(this, U, (ne(this), oe(this, void 0))), z(this, W, ce(this, void 0)), z(this, G, ue(this, !1)), z(this, K, fe(this, void 0)), z(this, q, me(this, void 0)), z(this, J, ge(this, "grid")), z(this, Y, ve(this, "")), z(this, X, be(this, !1)), z(this, Z, Se(this, 256)), z(this, Q, we(this, 480)), z(this, Je, Ee(this, void 0)), z(this, Ye, Oe(this, !1)), z(this, Xe, Ae(this, !1)), R(this, "initialLoadGeneration", 0), R(this, "renderGeneration", 0), R(this, "permissionGeneration", 0), R(this, "permissionRequest", void 0), R(this, "creationInFlight", !1), R(this, "authListenersAttached", !1), R(this, "dropProtectionAttached", !1), R(this, "sidebarResizeObserver", void 0), R(this, "responsiveLayoutInitialized", !1), R(this, "sidebarDrag", void 0), z(this, Ze, Me(this, null)), z(this, Qe, Pe(this, null)), z(this, $e, Ie(this, null)), z(this, $, Re(this, null)), R(this, "handleAuthChange", () => {
204
+ super(...t), R(this, H, (ne(this), oe(this, void 0))), R(this, U, ce(this, void 0)), R(this, W, ue(this, !1)), R(this, G, fe(this, void 0)), R(this, K, me(this, void 0)), R(this, q, ge(this, "grid")), R(this, J, ve(this, "")), R(this, Y, be(this, !1)), R(this, X, Se(this, 256)), R(this, Z, we(this, 480)), R(this, Q, Ee(this, void 0)), R(this, Je, Oe(this, !1)), R(this, Ye, Ae(this, !1)), L(this, "initialLoadGeneration", 0), L(this, "renderGeneration", 0), L(this, "permissionGeneration", 0), L(this, "permissionRequest", void 0), L(this, "creationInFlight", !1), L(this, "authListenersAttached", !1), L(this, "dropProtectionAttached", !1), L(this, "sidebarResizeObserver", void 0), L(this, "responsiveLayoutInitialized", !1), L(this, "sidebarDrag", void 0), R(this, Xe, Me(this, null)), R(this, Ze, Pe(this, null)), R(this, Qe, Ie(this, null)), R(this, $, Re(this, null)), L(this, "handleAuthChange", () => {
205
205
  e.clear(), this.refreshCreationPermission(!0), this.requestUpdate();
206
- }), R(this, "handleCreatePane", async (e) => {
207
- if (e.stopPropagation(), this.creationInFlight || !N.currentUser()) return;
206
+ }), L(this, "handleCreatePane", async (e) => {
207
+ if (e.stopPropagation(), this.creationInFlight || !M.currentUser()) return;
208
208
  let t = e.detail?.pane;
209
209
  if (!t?.mintNew) return;
210
210
  let n = this.getActiveContainer(), i = this.ownerDocument, a = this.statusArea;
211
211
  if (!n || !a) return;
212
- this.creationInFlight = !0;
212
+ this.creationInFlight = !0, this.updateUploadAvailability();
213
213
  let o = ++this.renderGeneration, s = r(t);
214
214
  try {
215
215
  let e = await new Promise((e) => {
@@ -218,7 +218,7 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
218
218
  onClose: e
219
219
  });
220
220
  });
221
- if (!e || !N.currentUser() || o !== this.renderGeneration || this.getActiveContainer()?.sameTerm(n) !== !0) return;
221
+ if (!e || !M.currentUser() || o !== this.renderGeneration || this.getActiveContainer()?.sameTerm(n) !== !0) return;
222
222
  if (!d(e)) {
223
223
  m(a, "error", u);
224
224
  return;
@@ -231,7 +231,7 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
231
231
  name: e,
232
232
  noun: s,
233
233
  statusArea: a,
234
- me: N.currentUser() ?? void 0,
234
+ me: M.currentUser() ?? void 0,
235
235
  dom: i
236
236
  }), c = o === this.renderGeneration && this.getActiveContainer()?.sameTerm(n) === !0;
237
237
  await this.showCreatedResource({
@@ -243,38 +243,35 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
243
243
  } catch (e) {
244
244
  h("Unable to create folder-pane resource", e), !(e instanceof f) && this.statusArea && m(this.statusArea, "error", `Unable to create ${s}: ${e instanceof Error ? e.message : String(e)}`);
245
245
  } finally {
246
- this.creationInFlight = !1;
246
+ this.creationInFlight = !1, this.updateUploadAvailability();
247
247
  }
248
- }), R(this, "handleUpload", (e) => {
249
- if (e.stopPropagation(), this.creationInFlight || !N.currentUser()) return;
250
- let t = this.getActiveContainer(), n = this.statusArea;
251
- if (!t || !n || !this.store) return;
252
- let r = this.ownerDocument.createElement("input");
253
- r.type = "file", r.multiple = !0, r.addEventListener("change", () => {
254
- let e = Array.from(r.files ?? []), i = e.filter((e) => d(e.name));
255
- if (e.filter((e) => !d(e.name)).forEach((e) => m(n, "error", `${e.name}: ${u}`)), !i.length) return;
256
- this.creationInFlight = !0;
257
- let a = this.renderGeneration, o = this.browserContext, s = i.length, c = Promise.resolve();
258
- m(n, "progress", `Uploading ${i.length} file${i.length === 1 ? "" : "s"}`);
259
- let l = () => {
260
- s--, s === 0 && (this.creationInFlight = !1, n.dataset.status === "progress" && n.replaceChildren());
261
- };
262
- j.uploadFiles(this.store.fetcher, i, t.uri, t.uri, (e, n) => {
263
- c = c.then(() => {
264
- let e = this.renderGeneration === a && this.browserContext === o;
265
- return this.showCreatedResource({
266
- container: t,
267
- containedResource: this.store.sym(n),
268
- newInstance: i.length === 1 && e ? this.store.sym(n) : void 0
269
- });
270
- }).finally(l);
271
- }, (e, t) => {
272
- m(n, "error", t), l();
273
- });
274
- }), r.click();
275
- }), R(this, "clearContentError", () => {
248
+ }), L(this, "handleUpload", (e) => {
249
+ if (e.stopPropagation(), this.creationInFlight || !M.currentUser()) return;
250
+ let t = this.ownerDocument.createElement("input");
251
+ t.type = "file", t.multiple = !0, t.addEventListener("change", () => {
252
+ this.uploadFiles(Array.from(t.files ?? []), !0);
253
+ }), t.click();
254
+ }), L(this, "handleDroppedFiles", (e) => {
255
+ e.stopPropagation();
256
+ let t = e.detail?.files ?? [];
257
+ this.uploadFiles(t, !1);
258
+ }), L(this, "handleUploadRejected", (e) => {
259
+ e.stopPropagation();
260
+ let t = e.detail?.message;
261
+ t && this.statusArea && m(this.statusArea, "error", t);
262
+ }), L(this, "handleResourceDeleted", (e) => {
263
+ let t = e.detail?.resource;
264
+ if (!t) return;
265
+ let n = t.dir(), r = this.getActiveContainer();
266
+ n && this.sidebar?.refreshResources?.(n);
267
+ let i = this.resourceTarget?.querySelector("folder-pane-container");
268
+ if (n && r?.sameTerm(n) && i?.refresh?.(), !this.selectedResource?.sameTerm(t)) return;
269
+ this.renderGeneration = s(this.renderGeneration);
270
+ let a = n ?? this.subject;
271
+ a ? (this.selectedResource = a, this.renderContainerView(a)) : this.selectedResource = void 0;
272
+ }), L(this, "clearContentError", () => {
276
273
  this.contentError = void 0;
277
- }), R(this, "retryContent", () => {
274
+ }), L(this, "retryContent", () => {
278
275
  let e = this.contentError?.retry;
279
276
  if (e) {
280
277
  this.clearContentError(), e();
@@ -282,29 +279,29 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
282
279
  }
283
280
  let t = this.selectedResource, n = this.subject;
284
281
  (t || n) && (this.clearContentError(), t ? this.showResourceInContentView(t, void 0, !1, !0) : n && (this.store && _(this.store.fetcher, n), this.showInitialContainer(n)));
285
- }), R(this, "handleResourceSelected", (e) => {
282
+ }), L(this, "handleResourceSelected", (e) => {
286
283
  let t = e.detail?.resource;
287
284
  t && (e.stopPropagation(), this.searchQuery = "", this.showSubject(t));
288
- }), R(this, "handleResourceOpenPane", (e) => {
285
+ }), L(this, "handleResourceOpenPane", (e) => {
289
286
  let t = e.detail?.resource, n = e.detail?.paneName, r = n ? this.browserContext?.session.paneRegistry.byName(n) : void 0;
290
- t && r && (e.stopPropagation(), this.searchQuery = "", r.name === "folder" ? this.showSubject(t, r) : this.showSubject(t, typeof r?.render == "function" ? r : void 0));
291
- }), R(this, "handleSelectHome", () => {
287
+ t && r && (e.stopPropagation(), this.searchQuery = "", r.name === "folder" ? this.showSubject(t, r, !0) : this.showSubject(t, typeof r?.render == "function" ? r : void 0, !0));
288
+ }), L(this, "handleSelectHome", () => {
292
289
  this.searchQuery = "";
293
290
  let e = this.subject && this.standaloneBreadcrumbRoot?.sameTerm(this.subject) ? this.subject : this.standaloneBreadcrumbRoot;
294
291
  e && this.showSubject(e);
295
- }), R(this, "handleSearch", (e) => {
292
+ }), L(this, "handleSearch", (e) => {
296
293
  e.stopPropagation(), this.searchQuery = e.detail?.query || "";
297
294
  let t = this.resourceTarget?.querySelector("folder-pane-container");
298
295
  t && (t.searchQuery = this.searchQuery);
299
- }), R(this, "handleSelectBreadcrumbResource", (e) => {
296
+ }), L(this, "handleSelectBreadcrumbResource", (e) => {
300
297
  let t = e.detail?.resource;
301
298
  t && (e.stopPropagation(), this.showSubject(t));
302
- }), R(this, "handleContainerViewChange", (e) => {
299
+ }), L(this, "handleContainerViewChange", (e) => {
303
300
  let t = e.detail?.view;
304
301
  t && (e.stopPropagation(), this.setContainerView(t));
305
- }), R(this, "updateSidebarBounds", () => {
306
- this.isConnected && (this.sidebarMaximumWidth = H(480, this.sidebarAvailableWidth), this.resizeSidebar(this.sidebarWidth));
307
- }), R(this, "handleSidebarPointerDown", (e) => {
302
+ }), L(this, "updateSidebarBounds", () => {
303
+ this.isConnected && (this.sidebarMaximumWidth = V(480, this.sidebarAvailableWidth), this.resizeSidebar(this.sidebarWidth));
304
+ }), L(this, "handleSidebarPointerDown", (e) => {
308
305
  if (!this.isConnected || this.sidebarCollapsed || this.sidebarDrag || e.button !== 0 || !e.isPrimary) return;
309
306
  e.preventDefault();
310
307
  let t = e.currentTarget;
@@ -314,12 +311,12 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
314
311
  startX: e.clientX,
315
312
  startWidth: this.sidebarWidth
316
313
  }, this.requestUpdate();
317
- }), R(this, "handleSidebarPointerMove", (e) => {
314
+ }), L(this, "handleSidebarPointerMove", (e) => {
318
315
  let t = this.sidebarDrag;
319
316
  this.isConnected && !this.sidebarCollapsed && t && t.pointerId === e.pointerId && this.resizeSidebar(t.startWidth + e.clientX - t.startX);
320
- }), R(this, "handleSidebarPointerEnd", (e) => {
317
+ }), L(this, "handleSidebarPointerEnd", (e) => {
321
318
  this.sidebarDrag?.pointerId === e.pointerId && this.finishSidebarResize();
322
- }), R(this, "handleSidebarResizeKey", (e) => {
319
+ }), L(this, "handleSidebarResizeKey", (e) => {
323
320
  if (!this.isConnected || this.sidebarCollapsed || this.sidebarDrag || e.altKey || e.ctrlKey || e.metaKey) return;
324
321
  let t;
325
322
  switch (e.key) {
@@ -338,11 +335,11 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
338
335
  default: return;
339
336
  }
340
337
  e.preventDefault(), e.stopPropagation(), this.resizeSidebar(t);
341
- }), R(this, "handleSidebarToggle", async (e) => {
338
+ }), L(this, "handleSidebarToggle", async (e) => {
342
339
  e.stopPropagation();
343
340
  let t = this.sidebar, n = this.renderRoot.querySelector(".folder-pane-sidebar-resize-handle"), r = !!t && (t.matches(":focus-within") || t.shadowRoot?.activeElement != null), i = n === this.ownerDocument.activeElement;
344
341
  this.finishSidebarResize(), this.sidebarCollapsed = !this.sidebarCollapsed, this.sidebarCollapsed && (r || i) && (await this.updateComplete, this.renderRoot.querySelector(".folder-pane-sidebar-toggle")?.focus());
345
- }), R(this, "handleFolderPaneResourceError", (e) => {
342
+ }), L(this, "handleFolderPaneResourceError", (e) => {
346
343
  e.stopPropagation();
347
344
  let t = e.detail?.title || "Unable to load this folder", n = e.detail?.message || "The folder could not be loaded. Try again.";
348
345
  this.showContentError({
@@ -353,19 +350,19 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
353
350
  });
354
351
  }
355
352
  get [ze]() {
356
- return V(U, this);
353
+ return B(H, this);
357
354
  }
358
355
  set browserContext(e) {
359
- B(U, this, e);
356
+ z(H, this, e);
360
357
  }
361
358
  get store() {
362
359
  return this.browserContext?.session.store;
363
360
  }
364
361
  get subject() {
365
- return V(W, this);
362
+ return B(U, this);
366
363
  }
367
364
  set subject(e) {
368
- B(W, this, e);
365
+ z(U, this, e);
369
366
  }
370
367
  get resourceLogic() {
371
368
  return this.browserContext?.session.logic.resource;
@@ -374,94 +371,94 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
374
371
  return this.selectedResource ?? this.subject;
375
372
  }
376
373
  get fullView() {
377
- return V(G, this);
374
+ return B(W, this);
378
375
  }
379
376
  set fullView(e) {
380
- B(G, this, e);
377
+ z(W, this, e);
381
378
  }
382
379
  get selectedResource() {
383
- return V(K, this);
380
+ return B(G, this);
384
381
  }
385
382
  set selectedResource(e) {
386
- B(K, this, e);
383
+ z(G, this, e);
387
384
  }
388
385
  get standaloneBreadcrumbRoot() {
389
- return V(q, this);
386
+ return B(K, this);
390
387
  }
391
388
  set standaloneBreadcrumbRoot(e) {
392
- B(q, this, e);
389
+ z(K, this, e);
393
390
  }
394
391
  get containerView() {
395
- return V(J, this);
392
+ return B(q, this);
396
393
  }
397
394
  set containerView(e) {
398
- B(J, this, e);
395
+ z(q, this, e);
399
396
  }
400
397
  get searchQuery() {
401
- return V(Y, this);
398
+ return B(J, this);
402
399
  }
403
400
  set searchQuery(e) {
404
- B(Y, this, e);
401
+ z(J, this, e);
405
402
  }
406
403
  get sidebarCollapsed() {
407
- return V(X, this);
404
+ return B(Y, this);
408
405
  }
409
406
  set sidebarCollapsed(e) {
410
- B(X, this, e);
407
+ z(Y, this, e);
411
408
  }
412
409
  get sidebarWidth() {
413
- return V(Z, this);
410
+ return B(X, this);
414
411
  }
415
412
  set sidebarWidth(e) {
416
- B(Z, this, e);
413
+ z(X, this, e);
417
414
  }
418
415
  get sidebarMaximumWidth() {
419
- return V(Q, this);
416
+ return B(Z, this);
420
417
  }
421
418
  set sidebarMaximumWidth(e) {
422
- B(Q, this, e);
419
+ z(Z, this, e);
423
420
  }
424
421
  get contentError() {
425
- return V(Je, this);
422
+ return B(Q, this);
426
423
  }
427
424
  set contentError(e) {
428
- B(Je, this, e);
425
+ z(Q, this, e);
429
426
  }
430
427
  get showingContainer() {
431
- return V(Ye, this);
428
+ return B(Je, this);
432
429
  }
433
430
  set showingContainer(e) {
434
- B(Ye, this, e);
431
+ z(Je, this, e);
435
432
  }
436
433
  get canCreate() {
437
- return V(Xe, this);
434
+ return B(Ye, this);
438
435
  }
439
436
  set canCreate(e) {
440
- B(Xe, this, e);
437
+ z(Ye, this, e);
441
438
  }
442
439
  get contentView() {
443
- return V(Ze, this);
440
+ return B(Xe, this);
444
441
  }
445
442
  set contentView(e) {
446
- B(Ze, this, e);
443
+ z(Xe, this, e);
447
444
  }
448
445
  get fullViewTarget() {
449
- return V(Qe, this);
446
+ return B(Ze, this);
450
447
  }
451
448
  set fullViewTarget(e) {
452
- B(Qe, this, e);
449
+ z(Ze, this, e);
453
450
  }
454
451
  get sidebar() {
455
- return V($e, this);
452
+ return B(Qe, this);
456
453
  }
457
454
  set sidebar(e) {
458
- B($e, this, e);
455
+ z(Qe, this, e);
459
456
  }
460
457
  get statusArea() {
461
- return V($, this);
458
+ return B($, this);
462
459
  }
463
460
  set statusArea(e) {
464
- B($, this, e);
461
+ z($, this, e);
465
462
  }
466
463
  createRenderRoot() {
467
464
  return this;
@@ -469,10 +466,10 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
469
466
  connectedCallback() {
470
467
  super.connectedCallback();
471
468
  let e = this.querySelector(".folder-pane-main-content");
472
- e && this.sidebarResizeObserver?.observe(e), this.dropProtectionAttached ||= (x.preventBrowserDropEvents(this.ownerDocument), !0), this.addEventListener("folder-pane-create-pane", this.handleCreatePane), this.addEventListener("folder-pane-upload", this.handleUpload), this.addEventListener("resource-open-pane", this.handleResourceOpenPane), this.authListenersAttached ||= (M.events.on("login", this.handleAuthChange), M.events.on("logout", this.handleAuthChange), !0);
469
+ e && this.sidebarResizeObserver?.observe(e), this.dropProtectionAttached ||= (x.preventBrowserDropEvents(this.ownerDocument), !0), this.addEventListener("folder-pane-create-pane", this.handleCreatePane), this.addEventListener("folder-pane-upload", this.handleUpload), this.addEventListener("folder-pane-upload-files", this.handleDroppedFiles), this.addEventListener("folder-pane-upload-rejected", this.handleUploadRejected), this.addEventListener("resource-open-pane", this.handleResourceOpenPane), this.ownerDocument.addEventListener("solid-resource-deleted", this.handleResourceDeleted), this.authListenersAttached ||= (j.events.on("login", this.handleAuthChange), j.events.on("logout", this.handleAuthChange), !0);
473
470
  }
474
471
  disconnectedCallback() {
475
- this.finishSidebarResize(), this.sidebarResizeObserver?.disconnect(), this.renderGeneration = s(this.renderGeneration), this.initialLoadGeneration++, this.removeEventListener("folder-pane-create-pane", this.handleCreatePane), this.removeEventListener("folder-pane-upload", this.handleUpload), this.removeEventListener("resource-open-pane", this.handleResourceOpenPane), this.authListenersAttached &&= (M.events.off("login", this.handleAuthChange), M.events.off("logout", this.handleAuthChange), !1), super.disconnectedCallback();
472
+ this.finishSidebarResize(), this.sidebarResizeObserver?.disconnect(), this.renderGeneration = s(this.renderGeneration), this.initialLoadGeneration++, this.removeEventListener("folder-pane-create-pane", this.handleCreatePane), this.removeEventListener("folder-pane-upload", this.handleUpload), this.removeEventListener("folder-pane-upload-files", this.handleDroppedFiles), this.removeEventListener("folder-pane-upload-rejected", this.handleUploadRejected), this.removeEventListener("resource-open-pane", this.handleResourceOpenPane), this.ownerDocument.removeEventListener("solid-resource-deleted", this.handleResourceDeleted), this.authListenersAttached &&= (j.events.off("login", this.handleAuthChange), j.events.off("logout", this.handleAuthChange), !1), super.disconnectedCallback();
476
473
  }
477
474
  firstUpdated() {
478
475
  if (this.updateSidebarBounds(), typeof ResizeObserver < "u") {
@@ -485,6 +482,45 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
485
482
  e && this.sidebarResizeObserver.observe(e), this.sidebarResizeObserver.observe(this);
486
483
  }
487
484
  }
485
+ async uploadFiles(e, t) {
486
+ if (this.creationInFlight || !M.currentUser() || !this.canCreate) return;
487
+ let n = this.getActiveContainer(), r = this.statusArea, i = this.resourceLogic;
488
+ if (!e.length || !n || !r || !this.store || !i) return;
489
+ let a = e.filter((e) => d(e.name)), o = e.filter((e) => !d(e.name)).map((e) => `${e.name}: ${u}`);
490
+ if (!a.length) {
491
+ o.length && m(r, "error", o.join("; "));
492
+ return;
493
+ }
494
+ this.creationInFlight = !0, this.updateUploadAvailability();
495
+ let s = this.renderGeneration, c = this.browserContext, l = a.length, f = () => {
496
+ l--, l === 0 && (this.creationInFlight = !1, this.updateUploadAvailability(), r.dataset.status === "progress" && r.replaceChildren());
497
+ };
498
+ m(r, "progress", `Uploading ${a.length} file${a.length === 1 ? "" : "s"}`);
499
+ try {
500
+ let e = await i.uploadFiles(a, n.uri);
501
+ for (let r of e) if (r.success) try {
502
+ let e = this.renderGeneration === s && this.browserContext === c;
503
+ await this.showCreatedResource({
504
+ container: n,
505
+ containedResource: this.store.sym(r.uploadedUri),
506
+ newInstance: t && a.length === 1 && e ? this.store.sym(r.uploadedUri) : void 0
507
+ });
508
+ } catch (e) {
509
+ let t = e instanceof Error ? e.message : String(e);
510
+ o.push(`Uploaded ${r.file.name}, but could not refresh the folder: ${t}`);
511
+ } finally {
512
+ f();
513
+ }
514
+ else {
515
+ let e = r.error.destinationUri ? `Upload failed while putting ${r.error.destinationUri}` : `Upload failed for ${r.file.name}`, t = r.error.status === 413 ? `${e}: storage quota was exceeded. ${r.error.message}` : r.error.status ? `${e} (HTTP ${r.error.status}). ${r.error.message}` : `${e}. ${r.error.message}`;
516
+ o.push(t), f();
517
+ }
518
+ } catch (e) {
519
+ let t = e instanceof Error ? e.message : String(e);
520
+ for (o.push(`Unable to upload files: ${t}`); l > 0;) f();
521
+ }
522
+ o.length && m(r, "error", o.join("; "));
523
+ }
488
524
  updated(e) {
489
525
  (e.has("subject") || e.has("browserContext")) && this.subject ? (this.standaloneBreadcrumbRoot = this.fullView ? this.getStandaloneBreadcrumbRoot(this.subject) : this.subject, (e.has("subject") || e.has("browserContext")) && (this.selectedResource = void 0, this.renderGeneration++, this.initialLoadGeneration++), this.refreshCreationPermission(), this.showInitialContainer(this.subject)) : (e.has("selectedResource") && this.refreshCreationPermission(), e.has("fullView") && e.get("fullView") !== void 0 && (this.subject && (this.standaloneBreadcrumbRoot = this.fullView ? this.getStandaloneBreadcrumbRoot(this.subject) : this.subject), this.selectedResource ? this.showResourceInContentView(this.selectedResource) : this.subject && this.renderContainerView(this.subject)));
490
526
  }
@@ -516,7 +552,7 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
516
552
  try {
517
553
  await r.load(e);
518
554
  } catch (n) {
519
- if (!t || !i(n) || !N.currentUser()) throw n;
555
+ if (!t || !i(n) || !M.currentUser()) throw n;
520
556
  await r.load(e, {
521
557
  force: !0,
522
558
  clearPreviousData: !0
@@ -529,24 +565,32 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
529
565
  this.showSubject(e, typeof n?.render == "function" ? n : void 0);
530
566
  }
531
567
  getActiveContainer() {
532
- let e = this.selectedResource;
568
+ let e = this.selectedResource, t = e ? n(e) : void 0;
569
+ if (t && this.store) return this.store.sym(t);
533
570
  if (e && this.resourceLogic && a(e, this.resourceLogic)) return e;
534
- let t = this.fullView ? this.standaloneBreadcrumbRoot : this.subject, n = e?.dir(), r = t?.uri.endsWith("/") ? t.uri : `${t?.uri}/`;
535
- return t && n && r && n.uri.startsWith(r) ? n : this.subject;
571
+ let r = this.fullView ? this.standaloneBreadcrumbRoot : this.subject, i = e?.dir(), o = r?.uri.endsWith("/") ? r.uri : `${r?.uri}/`;
572
+ return r && i && o && i.uri.startsWith(o) ? i : this.subject;
536
573
  }
537
574
  refreshCreationPermission(e = !1) {
538
575
  let t = this.getActiveContainer(), n = this.browserContext?.session.logic.resource;
539
576
  if (!e && t && n && this.permissionRequest?.containerUri === t.uri && this.permissionRequest.resourceLogic === n) return;
540
577
  let r = ++this.permissionGeneration;
541
- this.canCreate = !1, this.permissionRequest = t && n ? {
578
+ this.setCanCreate(!1), this.permissionRequest = t && n ? {
542
579
  containerUri: t.uri,
543
580
  resourceLogic: n
544
581
  } : void 0, t && n && n.fetchMetadata(t).then((e) => {
545
- r === this.permissionGeneration && this.getActiveContainer()?.sameTerm(t) === !0 && (this.canCreate = e.access.canEdit);
582
+ r === this.permissionGeneration && this.getActiveContainer()?.sameTerm(t) === !0 && this.setCanCreate(e.access.canEdit);
546
583
  }).catch((e) => {
547
584
  r === this.permissionGeneration && (this.permissionRequest = void 0, g("Unable to determine folder creation permission", e));
548
585
  });
549
586
  }
587
+ updateUploadAvailability() {
588
+ let e = this.resourceTarget?.querySelector("folder-pane-container"), t = this.getActiveContainer();
589
+ e && (e.canUpload = this.canCreate && !this.creationInFlight && !!t && e.subject?.sameTerm(t) === !0, e.uploadBusy = this.creationInFlight);
590
+ }
591
+ setCanCreate(e) {
592
+ this.canCreate = e, this.updateUploadAvailability();
593
+ }
550
594
  clearContentForCreation() {
551
595
  this.resourceTarget?.replaceChildren();
552
596
  }
@@ -577,7 +621,9 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
577
621
  if (!t) return;
578
622
  this.contentError = void 0;
579
623
  let n = document.createElement("folder-pane-container");
580
- n.subject = e, n.resourceLogic = this.resourceLogic ?? null, n.browserContext = this.browserContext, n.view = this.containerView, n.searchQuery = this.searchQuery, this.showingContainer = !0, t.replaceChildren(n);
624
+ n.subject = e, n.resourceLogic = this.resourceLogic ?? null, n.browserContext = this.browserContext;
625
+ let r = this.getActiveContainer();
626
+ n.canUpload = this.canCreate && !!r && e.sameTerm(r), n.uploadBusy = this.creationInFlight, n.view = this.containerView, n.searchQuery = this.searchQuery, this.showingContainer = !0, t.replaceChildren(n);
581
627
  }
582
628
  async showInitialContainer(e) {
583
629
  let t = ++this.initialLoadGeneration;
@@ -714,8 +760,8 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
714
760
  this.renderContainerView(e);
715
761
  return;
716
762
  }
717
- if (n?.name !== "sharing" && (r || this.resourceLogic.containerHasIndexDocument(e))) {
718
- let r = this.store.sym(t(e, n?.name));
763
+ if (!n && (r || this.resourceLogic.containerHasIndexDocument(e))) {
764
+ let r = this.store.sym(t(e));
719
765
  try {
720
766
  await this.loadResource(r.doc(), s);
721
767
  } catch (t) {
@@ -775,9 +821,9 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
775
821
  }
776
822
  }
777
823
  }
778
- showSubject(e, t) {
779
- let r = t?.name !== "sharing", i = r ? n(e) : void 0, o = i && this.store ? this.store.sym(i) : void 0, s = o ?? e, c = r && !o && !!this.resourceLogic && a(e, this.resourceLogic) && this.resourceLogic.containerHasIndexDocument(e);
780
- this.selectedResource = s, this.showResourceInContentView(s, t, !!o || c);
824
+ showSubject(e, t, r = !1) {
825
+ let i = !r && t?.name !== "sharing", o = i ? n(e) : void 0, s = o && this.store ? this.store.sym(o) : void 0, c = s ?? e, l = i && !s && !!this.resourceLogic && a(e, this.resourceLogic) && this.resourceLogic.containerHasIndexDocument(e);
826
+ this.selectedResource = c, this.showResourceInContentView(c, t, !!s || l);
781
827
  }
782
828
  setContainerView(e) {
783
829
  this.containerView = e;
@@ -789,14 +835,14 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
789
835
  return (e?.clientWidth ?? 0) - (t?.getBoundingClientRect().width ?? 0);
790
836
  }
791
837
  resizeSidebar(e) {
792
- this.sidebarWidth = H(e, this.sidebarAvailableWidth);
838
+ this.sidebarWidth = V(e, this.sidebarAvailableWidth);
793
839
  }
794
840
  finishSidebarResize() {
795
841
  let e = this.sidebarDrag;
796
842
  e && (this.sidebarDrag = void 0, e.separator.hasPointerCapture(e.pointerId) && e.separator.releasePointerCapture(e.pointerId), this.isConnected && this.requestUpdate());
797
843
  }
798
844
  render() {
799
- return this.fullView ? P`
845
+ return this.fullView ? N`
800
846
  <folder-pane-provider
801
847
  .rootResource=${this.subject}
802
848
  .displayedResource=${this.displayedResource}
@@ -814,7 +860,7 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
814
860
  ></div>
815
861
  <div class="folder-pane-status"></div>
816
862
  </folder-pane-provider>
817
- ` : P`
863
+ ` : N`
818
864
  <folder-pane-provider
819
865
  .rootResource=${this.subject}
820
866
  .displayedResource=${this.displayedResource}
@@ -886,11 +932,11 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
886
932
  `;
887
933
  }
888
934
  renderStorageHeader() {
889
- return P`
935
+ return N`
890
936
  <folder-pane-storage-header
891
937
  .subject=${this.subject}
892
938
  .breadcrumbRoot=${this.standaloneBreadcrumbRoot}
893
- .selectedResource=${this.displayedResource}
939
+ .selectedResource=${this.getActiveContainer()}
894
940
  .browserContext=${this.browserContext}
895
941
  .paneList=${this.browserContext?.session.paneRegistry.list ?? []}
896
942
  .view=${this.containerView}
@@ -904,7 +950,7 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
904
950
  `;
905
951
  }
906
952
  renderContentError() {
907
- return this.contentError ? P`
953
+ return this.contentError ? N`
908
954
  <div class="folder-pane-resource-error" role="status">
909
955
  <solid-ui-error-state
910
956
  .title=${this.contentError.title}
@@ -1003,6 +1049,6 @@ ze = (ae = F({ attribute: !1 }), se = F({ attribute: !1 }), le = F({
1003
1049
  "statusArea"
1004
1050
  ]
1005
1051
  ], ie, 0, void 0, b), re();
1006
- export { H as clampSidebarWidth, qe as default };
1052
+ export { V as clampSidebarWidth, qe as default };
1007
1053
 
1008
1054
  //# sourceMappingURL=FolderPaneView.esm.js.map