folder-pane 4.0.1-2 → 4.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.
- package/README.md +4 -0
- package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js +14 -5
- package/dist/components/folder-pane-container/FolderPaneContainer.cjs.js.map +1 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.d.ts +11 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.d.ts.map +1 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.esm.js +174 -121
- package/dist/components/folder-pane-container/FolderPaneContainer.esm.js.map +1 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js +1 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.cjs.js.map +1 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js +1 -1
- package/dist/components/folder-pane-container/FolderPaneContainer.styles.esm.js.map +1 -1
- package/dist/components/folder-pane-content/FolderPaneContent.cjs.js.map +1 -1
- package/dist/components/folder-pane-content/FolderPaneContent.esm.js.map +1 -1
- package/dist/components/folder-pane-content/FolderPaneContent.styles.cjs.js.map +1 -1
- package/dist/components/folder-pane-content/FolderPaneContent.styles.esm.js.map +1 -1
- package/dist/components/folder-pane-provider/FolderPaneProvider.cjs.js.map +1 -1
- package/dist/components/folder-pane-provider/FolderPaneProvider.esm.js.map +1 -1
- package/dist/components/folder-pane-provider/FolderPaneProvider.styles.cjs.js.map +1 -1
- package/dist/components/folder-pane-provider/FolderPaneProvider.styles.esm.js.map +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js +8 -7
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.cjs.js.map +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts +2 -0
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.d.ts.map +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js +84 -77
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.esm.js.map +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.cjs.js.map +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js +1 -1
- package/dist/components/folder-pane-sidebar/FolderPaneSidebar.styles.esm.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.cjs.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.esm.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.cjs.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneCreateDialog.styles.esm.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js +5 -5
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.cjs.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts +1 -0
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.d.ts.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js +16 -10
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.esm.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.cjs.js.map +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js +1 -1
- package/dist/components/folder-pane-storage-header/FolderPaneStorageHeader.styles.esm.js.map +1 -1
- package/dist/components/folder-pane-view/FolderPaneView.cjs.js +2 -2
- package/dist/components/folder-pane-view/FolderPaneView.cjs.js.map +1 -1
- package/dist/components/folder-pane-view/FolderPaneView.d.ts +6 -0
- package/dist/components/folder-pane-view/FolderPaneView.d.ts.map +1 -1
- package/dist/components/folder-pane-view/FolderPaneView.esm.js +164 -118
- package/dist/components/folder-pane-view/FolderPaneView.esm.js.map +1 -1
- package/dist/folderPane.cjs.js +2 -2
- package/dist/folderPane.cjs.js.map +1 -1
- package/dist/folderPane.d.ts.map +1 -1
- package/dist/folderPane.esm.js +17 -15
- package/dist/folderPane.esm.js.map +1 -1
- package/dist/helpers.cjs.js.map +1 -1
- package/dist/helpers.d.ts +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.esm.js.map +1 -1
- package/dist/resourceActionItems.cjs.js +1 -1
- package/dist/resourceActionItems.cjs.js.map +1 -1
- package/dist/resourceActionItems.d.ts +4 -5
- package/dist/resourceActionItems.d.ts.map +1 -1
- package/dist/resourceActionItems.esm.js +14 -14
- package/dist/resourceActionItems.esm.js.map +1 -1
- 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
|
|
15
|
-
import { authSession as
|
|
16
|
-
import { html as
|
|
17
|
-
import { property as
|
|
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
|
|
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
|
|
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
|
|
38
|
+
function z(e, t, n) {
|
|
39
39
|
return e.set(Ve(e, t), n), n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
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
|
|
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(), $
|
|
199
|
-
ze = (ae =
|
|
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 =
|
|
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),
|
|
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
|
-
}),
|
|
207
|
-
if (e.stopPropagation(), this.creationInFlight || !
|
|
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 || !
|
|
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:
|
|
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
|
-
}),
|
|
249
|
-
if (e.stopPropagation(), this.creationInFlight || !
|
|
250
|
-
let t = this.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
282
|
+
}), L(this, "handleResourceSelected", (e) => {
|
|
286
283
|
let t = e.detail?.resource;
|
|
287
284
|
t && (e.stopPropagation(), this.searchQuery = "", this.showSubject(t));
|
|
288
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
296
|
+
}), L(this, "handleSelectBreadcrumbResource", (e) => {
|
|
300
297
|
let t = e.detail?.resource;
|
|
301
298
|
t && (e.stopPropagation(), this.showSubject(t));
|
|
302
|
-
}),
|
|
299
|
+
}), L(this, "handleContainerViewChange", (e) => {
|
|
303
300
|
let t = e.detail?.view;
|
|
304
301
|
t && (e.stopPropagation(), this.setContainerView(t));
|
|
305
|
-
}),
|
|
306
|
-
this.isConnected && (this.sidebarMaximumWidth =
|
|
307
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
317
|
+
}), L(this, "handleSidebarPointerEnd", (e) => {
|
|
321
318
|
this.sidebarDrag?.pointerId === e.pointerId && this.finishSidebarResize();
|
|
322
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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
|
|
353
|
+
return B(H, this);
|
|
357
354
|
}
|
|
358
355
|
set browserContext(e) {
|
|
359
|
-
|
|
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
|
|
362
|
+
return B(U, this);
|
|
366
363
|
}
|
|
367
364
|
set subject(e) {
|
|
368
|
-
|
|
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
|
|
374
|
+
return B(W, this);
|
|
378
375
|
}
|
|
379
376
|
set fullView(e) {
|
|
380
|
-
|
|
377
|
+
z(W, this, e);
|
|
381
378
|
}
|
|
382
379
|
get selectedResource() {
|
|
383
|
-
return
|
|
380
|
+
return B(G, this);
|
|
384
381
|
}
|
|
385
382
|
set selectedResource(e) {
|
|
386
|
-
|
|
383
|
+
z(G, this, e);
|
|
387
384
|
}
|
|
388
385
|
get standaloneBreadcrumbRoot() {
|
|
389
|
-
return
|
|
386
|
+
return B(K, this);
|
|
390
387
|
}
|
|
391
388
|
set standaloneBreadcrumbRoot(e) {
|
|
392
|
-
|
|
389
|
+
z(K, this, e);
|
|
393
390
|
}
|
|
394
391
|
get containerView() {
|
|
395
|
-
return
|
|
392
|
+
return B(q, this);
|
|
396
393
|
}
|
|
397
394
|
set containerView(e) {
|
|
398
|
-
|
|
395
|
+
z(q, this, e);
|
|
399
396
|
}
|
|
400
397
|
get searchQuery() {
|
|
401
|
-
return
|
|
398
|
+
return B(J, this);
|
|
402
399
|
}
|
|
403
400
|
set searchQuery(e) {
|
|
404
|
-
|
|
401
|
+
z(J, this, e);
|
|
405
402
|
}
|
|
406
403
|
get sidebarCollapsed() {
|
|
407
|
-
return
|
|
404
|
+
return B(Y, this);
|
|
408
405
|
}
|
|
409
406
|
set sidebarCollapsed(e) {
|
|
410
|
-
|
|
407
|
+
z(Y, this, e);
|
|
411
408
|
}
|
|
412
409
|
get sidebarWidth() {
|
|
413
|
-
return
|
|
410
|
+
return B(X, this);
|
|
414
411
|
}
|
|
415
412
|
set sidebarWidth(e) {
|
|
416
|
-
|
|
413
|
+
z(X, this, e);
|
|
417
414
|
}
|
|
418
415
|
get sidebarMaximumWidth() {
|
|
419
|
-
return
|
|
416
|
+
return B(Z, this);
|
|
420
417
|
}
|
|
421
418
|
set sidebarMaximumWidth(e) {
|
|
422
|
-
|
|
419
|
+
z(Z, this, e);
|
|
423
420
|
}
|
|
424
421
|
get contentError() {
|
|
425
|
-
return
|
|
422
|
+
return B(Q, this);
|
|
426
423
|
}
|
|
427
424
|
set contentError(e) {
|
|
428
|
-
|
|
425
|
+
z(Q, this, e);
|
|
429
426
|
}
|
|
430
427
|
get showingContainer() {
|
|
431
|
-
return
|
|
428
|
+
return B(Je, this);
|
|
432
429
|
}
|
|
433
430
|
set showingContainer(e) {
|
|
434
|
-
|
|
431
|
+
z(Je, this, e);
|
|
435
432
|
}
|
|
436
433
|
get canCreate() {
|
|
437
|
-
return
|
|
434
|
+
return B(Ye, this);
|
|
438
435
|
}
|
|
439
436
|
set canCreate(e) {
|
|
440
|
-
|
|
437
|
+
z(Ye, this, e);
|
|
441
438
|
}
|
|
442
439
|
get contentView() {
|
|
443
|
-
return
|
|
440
|
+
return B(Xe, this);
|
|
444
441
|
}
|
|
445
442
|
set contentView(e) {
|
|
446
|
-
|
|
443
|
+
z(Xe, this, e);
|
|
447
444
|
}
|
|
448
445
|
get fullViewTarget() {
|
|
449
|
-
return
|
|
446
|
+
return B(Ze, this);
|
|
450
447
|
}
|
|
451
448
|
set fullViewTarget(e) {
|
|
452
|
-
|
|
449
|
+
z(Ze, this, e);
|
|
453
450
|
}
|
|
454
451
|
get sidebar() {
|
|
455
|
-
return
|
|
452
|
+
return B(Qe, this);
|
|
456
453
|
}
|
|
457
454
|
set sidebar(e) {
|
|
458
|
-
|
|
455
|
+
z(Qe, this, e);
|
|
459
456
|
}
|
|
460
457
|
get statusArea() {
|
|
461
|
-
return
|
|
458
|
+
return B($, this);
|
|
462
459
|
}
|
|
463
460
|
set statusArea(e) {
|
|
464
|
-
|
|
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 ||= (
|
|
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 &&= (
|
|
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) || !
|
|
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
|
|
535
|
-
return
|
|
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.
|
|
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 &&
|
|
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
|
|
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
|
|
718
|
-
let r = this.store.sym(t(e
|
|
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
|
|
780
|
-
this.selectedResource =
|
|
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 =
|
|
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 ?
|
|
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
|
-
` :
|
|
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
|
|
935
|
+
return N`
|
|
890
936
|
<folder-pane-storage-header
|
|
891
937
|
.subject=${this.subject}
|
|
892
938
|
.breadcrumbRoot=${this.standaloneBreadcrumbRoot}
|
|
893
|
-
.selectedResource=${this.
|
|
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 ?
|
|
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 {
|
|
1052
|
+
export { V as clampSidebarWidth, qe as default };
|
|
1007
1053
|
|
|
1008
1054
|
//# sourceMappingURL=FolderPaneView.esm.js.map
|