@mintplayer/web-components 2.1.1 → 2.3.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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.d.ts +1 -0
- package/accordion/index.mjs +549 -0
- package/accordion/src/components/index.d.ts +3 -0
- package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
- package/accordion/src/components/mp-accordion.d.ts +66 -0
- package/accordion/src/index.d.ts +3 -0
- package/accordion/src/styles/index.d.ts +1 -0
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.d.ts +1 -0
- package/carousel/index.mjs +994 -0
- package/carousel/src/components/index.d.ts +1 -0
- package/carousel/src/components/mp-carousel.d.ts +58 -0
- package/carousel/src/index.d.ts +3 -0
- package/carousel/src/styles/index.d.ts +1 -0
- package/carousel/src/types/carousel.d.ts +10 -0
- package/carousel/src/types/index.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +21 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/splitter/src/index.d.ts +1 -1
- package/swiper-core/index.d.ts +1 -0
- package/swiper-core/index.mjs +184 -0
- package/swiper-core/src/index-machine.d.ts +59 -0
- package/swiper-core/src/index.d.ts +4 -0
- package/swiper-core/src/keymap.d.ts +2 -0
- package/swiper-core/src/models/index.d.ts +1 -0
- package/swiper-core/src/models/types.d.ts +99 -0
- package/swiper-core/src/pointer-arbiter.d.ts +45 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
- package/dropdown/src/styles/dropdown.styles.d.ts +0 -2
package/file-manager/index.mjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import {
|
|
1
|
+
import { unsafeCSS as g, LitElement as _, html as d, nothing as c } from "lit";
|
|
2
|
+
import { L as m } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
3
|
+
import { d as v } from "../chunks/focus-restore-DxuP1Oe2.mjs";
|
|
4
|
+
import { R as w } from "../chunks/roving-focus-CrL9982a.mjs";
|
|
5
|
+
import { repeat as y } from "lit/directives/repeat.js";
|
|
3
6
|
import { unsafeHTML as u } from "lit/directives/unsafe-html.js";
|
|
4
|
-
import { createRef as
|
|
5
|
-
import { styleMap as
|
|
6
|
-
import "../chunks/mp-splitter-
|
|
7
|
-
import "../chunks/mp-treeview-
|
|
8
|
-
import "../chunks/mp-datatable-
|
|
9
|
-
const
|
|
7
|
+
import { createRef as $, ref as x } from "lit/directives/ref.js";
|
|
8
|
+
import { styleMap as C } from "lit/directives/style-map.js";
|
|
9
|
+
import "../chunks/mp-splitter-LszuRDbR.mjs";
|
|
10
|
+
import "../chunks/mp-treeview-tkWu28iF.mjs";
|
|
11
|
+
import "../chunks/mp-datatable-BwTlh9A_.mjs";
|
|
12
|
+
const k = g(`:host {
|
|
10
13
|
display: flex;
|
|
11
14
|
flex-direction: column;
|
|
12
15
|
width: 100%;
|
|
@@ -35,7 +38,10 @@ const $ = b(`:host {
|
|
|
35
38
|
.toolbar button {
|
|
36
39
|
display: inline-flex;
|
|
37
40
|
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
38
42
|
gap: 0.25rem;
|
|
43
|
+
min-width: 24px;
|
|
44
|
+
min-height: 24px;
|
|
39
45
|
padding: 0.3rem 0.6rem;
|
|
40
46
|
background-color: transparent;
|
|
41
47
|
border: 1px solid var(--mp-file-manager-border-color);
|
|
@@ -344,35 +350,44 @@ mp-datatable {
|
|
|
344
350
|
noFilesOrFolders: "No files or folders",
|
|
345
351
|
dropFilesToUpload: "↓ Drop files to upload ↓",
|
|
346
352
|
fileDropZone: "File drop zone",
|
|
347
|
-
deleteConfirm: (
|
|
353
|
+
deleteConfirm: (a) => `Delete ${a} item${a === 1 ? "" : "s"}?`,
|
|
348
354
|
folderNamePrompt: "Folder name",
|
|
349
355
|
defaultNewFolderName: "New folder",
|
|
350
|
-
conflictMessage: (
|
|
356
|
+
conflictMessage: (a) => `"${a}" already exists. Replace?`,
|
|
351
357
|
conflictReplace: "Replace",
|
|
352
358
|
conflictSkip: "Skip",
|
|
353
359
|
conflictRename: "Keep both",
|
|
360
|
+
announceDeleted: (a) => a === 1 ? "1 item deleted." : `${a} items deleted.`,
|
|
361
|
+
announcePasted: (a) => a === 1 ? "1 item pasted." : `${a} items pasted.`,
|
|
362
|
+
announceNewFolder: (a) => `Folder ${a} created.`,
|
|
363
|
+
announceRenamed: (a, e) => `${a} renamed to ${e}.`,
|
|
364
|
+
announceUploadDone: (a) => `Upload of ${a} complete.`,
|
|
365
|
+
announceUploadFailed: (a) => `Upload of ${a} failed.`,
|
|
366
|
+
announceSearchResults: (a) => a === 1 ? "1 result." : `${a} results.`,
|
|
354
367
|
ariaToolbar: "File manager toolbar",
|
|
368
|
+
ariaFileOperations: "File operations",
|
|
369
|
+
ariaViewMode: "View mode",
|
|
355
370
|
ariaBreadcrumb: "Breadcrumb",
|
|
356
371
|
ariaFileList: "Files and folders",
|
|
357
372
|
ariaFileManager: "File manager"
|
|
358
373
|
};
|
|
359
|
-
function
|
|
360
|
-
return
|
|
374
|
+
function E(a) {
|
|
375
|
+
return a ? { ...p, ...a } : p;
|
|
361
376
|
}
|
|
362
|
-
let
|
|
363
|
-
const
|
|
364
|
-
class
|
|
377
|
+
let T = 0;
|
|
378
|
+
const f = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H2.454l-.913-3.13a.5.5 0 0 1 .013-.087.5.5 0 0 1-.014-.913zM13.81 4H2.19l-.572 6 1.193 4 11.078-2.5L15.81 5.66A1 1 0 0 0 14.81 4z"/></svg>', M = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/></svg>', F = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/></svg>', I = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5v-3zm8 0A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5v-3zm-8 8A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5v-3zm8 0A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5v-3z"/></svg>';
|
|
379
|
+
class S extends _ {
|
|
365
380
|
constructor() {
|
|
366
|
-
super(...arguments), this.instanceId = `mp-file-manager-${++
|
|
381
|
+
super(...arguments), this.instanceId = `mp-file-manager-${++T}`, this._nodes = [], this._rootFolderId = null, this._currentFolderId = null, this._allowUpload = !1, this._allowOperations = !0, this._viewMode = "list", this._selectionMode = "multiple", this._searchPlaceholder = "", this._messages = p, this._selection = /* @__PURE__ */ new Set(), this._expandedTreeIds = /* @__PURE__ */ new Set(), this._clipboard = null, this._searchQuery = "", this._searchAnnounceTimer = null, this._iconFocusId = null, this.liveAnnouncer = new m(this), this.alertAnnouncer = new m(this, { politeness: "assertive" }), this._renameTarget = null, this._renameInputRef = $(), this._dragDepth = 0, this._contextMenu = null, this._isTouchMode = !1, this._touchHoldTimer = null, this._touchHoldTarget = null, this._pendingOps = /* @__PURE__ */ new Map(), this._uploads = [], this._loadedFolders = /* @__PURE__ */ new Set(), this.onTouchStart = (e) => {
|
|
367
382
|
if (e.touches.length !== 1) return;
|
|
368
|
-
const t = e.touches[0],
|
|
369
|
-
(
|
|
383
|
+
const t = e.touches[0], n = (e.composedPath().find(
|
|
384
|
+
(s) => s instanceof HTMLElement && s.hasAttribute("data-node-id")
|
|
370
385
|
) ?? this.shadowRoot?.elementFromPoint(t.clientX, t.clientY)?.closest("[data-node-id]"))?.getAttribute("data-node-id");
|
|
371
|
-
if (!
|
|
372
|
-
this._touchHoldTarget =
|
|
373
|
-
const
|
|
386
|
+
if (!n) return;
|
|
387
|
+
this._touchHoldTarget = n;
|
|
388
|
+
const o = t.clientX, r = t.clientY;
|
|
374
389
|
this._touchHoldTimer = setTimeout(() => {
|
|
375
|
-
this._touchHoldTarget ===
|
|
390
|
+
this._touchHoldTarget === n && (this._touchHoldTimer = null, this._selectionMode !== "none" && !this._selection.has(n) && (this._selection = /* @__PURE__ */ new Set([n]), this.emitSelectionChange()), this.openContextMenu(n, o, r));
|
|
376
391
|
}, 600);
|
|
377
392
|
}, this.onTouchMove = () => {
|
|
378
393
|
this._touchHoldTimer && (clearTimeout(this._touchHoldTimer), this._touchHoldTimer = null), this._touchHoldTarget = null;
|
|
@@ -385,6 +400,12 @@ class F extends g {
|
|
|
385
400
|
const t = Array.from(e.files ?? []);
|
|
386
401
|
t.length > 0 && this.handleFiles(t), e.remove();
|
|
387
402
|
}), document.body.appendChild(e), e.click();
|
|
403
|
+
}, this._contextMenuReturnTarget = null, this.contextMenuRoving = new w({
|
|
404
|
+
items: () => Array.from(this.renderRoot?.querySelectorAll(".context-menu .menu-item:not([disabled])") ?? []),
|
|
405
|
+
orientation: "vertical",
|
|
406
|
+
wrap: !0
|
|
407
|
+
}), this.onContextMenuKeydown = (e) => {
|
|
408
|
+
this.contextMenuRoving.onKeydown(e) && e.preventDefault();
|
|
388
409
|
}, this.onTreeNodeSelect = (e) => {
|
|
389
410
|
const t = e.detail;
|
|
390
411
|
this.navigateTo(t.node.id);
|
|
@@ -406,35 +427,56 @@ class F extends g {
|
|
|
406
427
|
const t = e.detail, i = t.originalEvent;
|
|
407
428
|
i.preventDefault(), this.openContextMenu(t.rowKey, i.clientX, i.clientY);
|
|
408
429
|
}, this.onContentKeydown = (e) => {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
430
|
+
const t = e.composedPath()[0];
|
|
431
|
+
if (!(t instanceof HTMLElement && t.closest("input, textarea, [contenteditable]"))) {
|
|
432
|
+
if (e.key === "Enter") {
|
|
433
|
+
const i = t instanceof HTMLElement && t.classList.contains("icon-card") ? t : null, n = i ? i.dataset.nodeId : this._selection.size === 1 ? [...this._selection][0] : void 0, o = n != null ? this._nodes.find((r) => r.id === n) : void 0;
|
|
434
|
+
if (!o) return;
|
|
435
|
+
e.preventDefault(), i && this._selectionMode !== "none" && (this._selection = /* @__PURE__ */ new Set([o.id]), this.emitSelectionChange(), this.requestUpdate()), this.activateNode(o);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if ((e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) && this._selection.size > 0) {
|
|
439
|
+
e.preventDefault();
|
|
440
|
+
const n = e.target?.getBoundingClientRect(), o = n ? n.left + n.width / 2 : 100, r = n ? n.bottom : 100, [s] = this._selection;
|
|
441
|
+
this.openContextMenu(s, o, r);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (e.key === "Delete" && this._selection.size > 0 && this.opEnabled("delete")) {
|
|
445
|
+
e.preventDefault(), this.deleteSelection();
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (e.key === "F2" && this._selection.size === 1 && this.opEnabled("rename")) {
|
|
449
|
+
e.preventDefault(), this.beginRenameFromToolbar();
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "x" && this._selection.size > 0 && this.opEnabled("cut")) {
|
|
453
|
+
e.preventDefault(), this.setClipboard("cut");
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "c" && this._selection.size > 0 && this.opEnabled("copy")) {
|
|
457
|
+
e.preventDefault(), this.setClipboard("copy");
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "v" && this._clipboard && this.opEnabled("paste")) {
|
|
461
|
+
e.preventDefault(), this.paste();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if ((e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === "N" || e.key === "n") && this.opEnabled("newFolder")) {
|
|
465
|
+
e.preventDefault(), this.promptNewFolder();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp", "Home", "End"].includes(e.key)) {
|
|
469
|
+
const i = e.composedPath()[0];
|
|
470
|
+
if (!(i instanceof HTMLElement) || !i.classList.contains("icon-card")) return;
|
|
471
|
+
const n = i.closest(".icon-grid");
|
|
472
|
+
if (!n) return;
|
|
473
|
+
const o = [...n.querySelectorAll(".icon-card")], r = o.indexOf(i);
|
|
474
|
+
if (r < 0) return;
|
|
475
|
+
e.preventDefault();
|
|
476
|
+
let s;
|
|
477
|
+
e.key === "Home" ? s = 0 : e.key === "End" ? s = o.length - 1 : e.key === "ArrowRight" || e.key === "ArrowDown" ? s = Math.min(o.length - 1, r + 1) : s = Math.max(0, r - 1), this._iconFocusId = o[s].dataset.nodeId ?? null, o[s].focus(), this.requestUpdate();
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
438
480
|
}
|
|
439
481
|
}, this.promptNewFolder = async () => {
|
|
440
482
|
if (!this.opEnabled("newFolder")) return;
|
|
@@ -443,13 +485,13 @@ class F extends g {
|
|
|
443
485
|
label: e.folderNamePrompt,
|
|
444
486
|
defaultValue: e.defaultNewFolderName
|
|
445
487
|
});
|
|
446
|
-
typeof t != "string" || !t.trim() || this.dispatchEvent(
|
|
488
|
+
typeof t != "string" || !t.trim() || (this.liveAnnouncer.announce(this._messages.announceNewFolder(t.trim())), this.dispatchEvent(
|
|
447
489
|
new CustomEvent("mp-operation", {
|
|
448
490
|
detail: { kind: "new-folder", parentId: this._currentFolderId, name: t.trim() },
|
|
449
491
|
bubbles: !0,
|
|
450
492
|
composed: !0
|
|
451
493
|
})
|
|
452
|
-
);
|
|
494
|
+
));
|
|
453
495
|
}, this.beginRenameFromToolbar = () => {
|
|
454
496
|
if (this._selection.size !== 1) return;
|
|
455
497
|
const [e] = this._selection;
|
|
@@ -463,7 +505,7 @@ class F extends g {
|
|
|
463
505
|
message: this._messages.deleteConfirm(this._selection.size)
|
|
464
506
|
})) return;
|
|
465
507
|
const t = [...this._selection];
|
|
466
|
-
this._selection.clear(), this.requestUpdate(), this.dispatchEvent(
|
|
508
|
+
this._selection.clear(), this.liveAnnouncer.announce(this._messages.announceDeleted(t.length)), this.requestUpdate(), this.dispatchEvent(
|
|
467
509
|
new CustomEvent("mp-operation", {
|
|
468
510
|
detail: { kind: "delete", nodeIds: t },
|
|
469
511
|
bubbles: !0,
|
|
@@ -473,7 +515,7 @@ class F extends g {
|
|
|
473
515
|
}, this.paste = async () => {
|
|
474
516
|
if (!this._clipboard || !this.opEnabled("paste")) return;
|
|
475
517
|
const { mode: e, ids: t } = this._clipboard, i = await this.resolveConflictsForPaste(t, this._currentFolderId);
|
|
476
|
-
i !== null && (this.dispatchEvent(
|
|
518
|
+
i !== null && (this.liveAnnouncer.announce(this._messages.announcePasted(t.length)), this.dispatchEvent(
|
|
477
519
|
new CustomEvent("mp-operation", {
|
|
478
520
|
detail: {
|
|
479
521
|
kind: "paste",
|
|
@@ -499,7 +541,7 @@ class F extends g {
|
|
|
499
541
|
};
|
|
500
542
|
}
|
|
501
543
|
static {
|
|
502
|
-
this.styles = [
|
|
544
|
+
this.styles = [k];
|
|
503
545
|
}
|
|
504
546
|
static get observedAttributes() {
|
|
505
547
|
return [
|
|
@@ -575,7 +617,7 @@ class F extends g {
|
|
|
575
617
|
return this._messages;
|
|
576
618
|
}
|
|
577
619
|
set messages(e) {
|
|
578
|
-
this._messages =
|
|
620
|
+
this._messages = E(e), this.hasAttribute("aria-label") && this.setAttribute("aria-label", this._messages.ariaFileManager), this.requestUpdate();
|
|
579
621
|
}
|
|
580
622
|
/**
|
|
581
623
|
* Replacement for `window.confirm` / `window.prompt`. When unset, falls
|
|
@@ -647,11 +689,11 @@ class F extends g {
|
|
|
647
689
|
* their upload-pipeline progress callback so the WC can render a
|
|
648
690
|
* progress bar / completed state.
|
|
649
691
|
*/
|
|
650
|
-
reportUploadProgress(e, t, i,
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
653
|
-
const
|
|
654
|
-
this._uploads = [...this._uploads.slice(0,
|
|
692
|
+
reportUploadProgress(e, t, i, n) {
|
|
693
|
+
const o = this._uploads.findIndex((l) => l.id === e);
|
|
694
|
+
if (o < 0) return;
|
|
695
|
+
const r = this._uploads[o], s = { ...r, progress: t, ...i ? { status: i } : {}, ...n ? { error: n } : {} };
|
|
696
|
+
this._uploads = [...this._uploads.slice(0, o), s, ...this._uploads.slice(o + 1)], r.status !== s.status && (s.status === "done" ? this.liveAnnouncer.announce(this._messages.announceUploadDone(s.file.name)) : s.status === "error" && this.alertAnnouncer.announce(this._messages.announceUploadFailed(s.file.name))), this.requestUpdate();
|
|
655
697
|
}
|
|
656
698
|
/** Remove a finished/aborted upload from the tracking list. */
|
|
657
699
|
clearUpload(e) {
|
|
@@ -703,8 +745,8 @@ class F extends g {
|
|
|
703
745
|
if (this._allowOperations === !1) return !1;
|
|
704
746
|
const i = this._allowOperations === !0 ? !0 : this._allowOperations[e] !== !1;
|
|
705
747
|
if (!t) return i;
|
|
706
|
-
const
|
|
707
|
-
return
|
|
748
|
+
const o = this._nodes.find((r) => r.id === t)?.allowOperations?.[e];
|
|
749
|
+
return o === void 0 ? i : o !== !1;
|
|
708
750
|
}
|
|
709
751
|
/** True iff EVERY selected node permits the given operation. */
|
|
710
752
|
opEnabledOnSelection(e) {
|
|
@@ -715,25 +757,25 @@ class F extends g {
|
|
|
715
757
|
}
|
|
716
758
|
// ─── Derived collections ─────────────────────────────────────────────────
|
|
717
759
|
getTreeItems() {
|
|
718
|
-
const e = this._nodes.filter((
|
|
719
|
-
for (const
|
|
720
|
-
const
|
|
721
|
-
|
|
760
|
+
const e = this._nodes.filter((r) => r.type === "folder"), t = /* @__PURE__ */ new Map();
|
|
761
|
+
for (const r of e) {
|
|
762
|
+
const s = t.get(r.parentId) ?? [];
|
|
763
|
+
s.push(r), t.set(r.parentId, s);
|
|
722
764
|
}
|
|
723
|
-
const i = !!this._loadChildren,
|
|
724
|
-
const
|
|
725
|
-
return
|
|
726
|
-
const
|
|
765
|
+
const i = !!this._loadChildren, n = (r) => {
|
|
766
|
+
const s = t.get(r);
|
|
767
|
+
return s ? s.map((l) => {
|
|
768
|
+
const h = n(l.id), b = i && h.length === 0 && !this._loadedFolders.has(l.id);
|
|
727
769
|
return {
|
|
728
|
-
id:
|
|
729
|
-
label:
|
|
730
|
-
iconKey:
|
|
731
|
-
children:
|
|
732
|
-
lazy:
|
|
770
|
+
id: l.id,
|
|
771
|
+
label: l.name,
|
|
772
|
+
iconKey: l.iconKey ?? "folder",
|
|
773
|
+
children: h,
|
|
774
|
+
lazy: b || void 0
|
|
733
775
|
};
|
|
734
776
|
}) : [];
|
|
735
|
-
},
|
|
736
|
-
return o
|
|
777
|
+
}, o = this._rootFolderId;
|
|
778
|
+
return n(o === null ? null : o);
|
|
737
779
|
}
|
|
738
780
|
/**
|
|
739
781
|
* Bridge `mp-treeview`'s `loadChildren` to the consumer's `loadChildren`
|
|
@@ -743,31 +785,31 @@ class F extends g {
|
|
|
743
785
|
*/
|
|
744
786
|
async loadTreeChildren(e) {
|
|
745
787
|
if (!this._loadChildren) return [];
|
|
746
|
-
const t = await this._loadChildren(e), i = new Set(this._nodes.map((
|
|
747
|
-
return this._nodes = [...this._nodes, ...
|
|
788
|
+
const t = await this._loadChildren(e), i = new Set(this._nodes.map((o) => o.id)), n = t.filter((o) => !i.has(o.id));
|
|
789
|
+
return this._nodes = [...this._nodes, ...n], this._loadedFolders.add(e), this.requestUpdate(), this.dispatchEvent(
|
|
748
790
|
new CustomEvent("mp-children-loaded", {
|
|
749
791
|
detail: { parentId: e, children: t },
|
|
750
792
|
bubbles: !0,
|
|
751
793
|
composed: !0
|
|
752
794
|
})
|
|
753
|
-
),
|
|
754
|
-
id:
|
|
755
|
-
label:
|
|
756
|
-
iconKey:
|
|
795
|
+
), n.filter((o) => o.type === "folder").map((o) => ({
|
|
796
|
+
id: o.id,
|
|
797
|
+
label: o.name,
|
|
798
|
+
iconKey: o.iconKey ?? "folder",
|
|
757
799
|
children: [],
|
|
758
800
|
lazy: !0
|
|
759
801
|
}));
|
|
760
802
|
}
|
|
761
803
|
getCurrentChildren() {
|
|
762
|
-
const e = this._currentFolderId, t = this._nodes.filter((
|
|
763
|
-
return (i ? t.filter((
|
|
804
|
+
const e = this._currentFolderId, t = this._nodes.filter((o) => o.parentId === e), i = this._searchQuery.trim().toLowerCase();
|
|
805
|
+
return (i ? t.filter((o) => o.name.toLowerCase().includes(i)) : t).slice().sort((o, r) => o.type !== r.type ? o.type === "folder" ? -1 : 1 : o.name.localeCompare(r.name));
|
|
764
806
|
}
|
|
765
807
|
getBreadcrumb() {
|
|
766
808
|
if (this._currentFolderId === null) return [];
|
|
767
809
|
const e = [];
|
|
768
810
|
let t = this._currentFolderId;
|
|
769
811
|
for (; t !== null; ) {
|
|
770
|
-
const i = this._nodes.find((
|
|
812
|
+
const i = this._nodes.find((n) => n.id === t);
|
|
771
813
|
if (!i) break;
|
|
772
814
|
e.unshift(i), t = i.parentId;
|
|
773
815
|
}
|
|
@@ -776,7 +818,9 @@ class F extends g {
|
|
|
776
818
|
// ─── Render ──────────────────────────────────────────────────────────────
|
|
777
819
|
render() {
|
|
778
820
|
const e = this.getTreeItems(), t = this.getCurrentChildren(), i = this.getBreadcrumb();
|
|
779
|
-
return
|
|
821
|
+
return d`
|
|
822
|
+
${this.liveAnnouncer.template()}
|
|
823
|
+
${this.alertAnnouncer.template()}
|
|
780
824
|
${this.renderToolbar()}
|
|
781
825
|
${this.renderBreadcrumb(i)}
|
|
782
826
|
<div class="split-area">
|
|
@@ -786,8 +830,8 @@ class F extends g {
|
|
|
786
830
|
.items=${e}
|
|
787
831
|
.expandedIds=${[...this._expandedTreeIds]}
|
|
788
832
|
.selectedIds=${this._currentFolderId ? [this._currentFolderId] : []}
|
|
789
|
-
.iconResolver=${(
|
|
790
|
-
.loadChildren=${this._loadChildren ? (
|
|
833
|
+
.iconResolver=${(n, o) => this.resolveIconForTree(n, o)}
|
|
834
|
+
.loadChildren=${this._loadChildren ? (n) => this.loadTreeChildren(n) : void 0}
|
|
791
835
|
hide-borders
|
|
792
836
|
selection-mode="single"
|
|
793
837
|
@tree-node-select=${this.onTreeNodeSelect}
|
|
@@ -805,7 +849,10 @@ class F extends g {
|
|
|
805
849
|
<div class="content-body">
|
|
806
850
|
${this._viewMode === "list" ? this.renderListView(t) : this.renderIconGridView(t)}
|
|
807
851
|
</div>
|
|
808
|
-
|
|
852
|
+
<!-- No aria-live/aria-label: a static always-rendered overlay never
|
|
853
|
+
changes text, so the live region was pure noise; drag feedback
|
|
854
|
+
is visual, and the upload path announces its own outcomes. -->
|
|
855
|
+
<div class="drop-overlay" aria-hidden="true">${this._messages.dropFilesToUpload}</div>
|
|
809
856
|
</div>
|
|
810
857
|
</mp-splitter>
|
|
811
858
|
</div>
|
|
@@ -814,120 +861,124 @@ class F extends g {
|
|
|
814
861
|
}
|
|
815
862
|
renderContextMenu() {
|
|
816
863
|
const e = this._contextMenu;
|
|
817
|
-
if (!e) return
|
|
818
|
-
const t = this._messages, i = this._selection.size > 0,
|
|
819
|
-
return
|
|
864
|
+
if (!e) return d``;
|
|
865
|
+
const t = this._messages, i = this._selection.size > 0, n = this._clipboard !== null;
|
|
866
|
+
return d`
|
|
820
867
|
<ul
|
|
821
868
|
class="context-menu"
|
|
822
869
|
role="menu"
|
|
823
|
-
aria-label
|
|
824
|
-
style=${
|
|
825
|
-
@click=${(
|
|
870
|
+
aria-label=${this._messages.ariaFileOperations}
|
|
871
|
+
style=${C({ left: `${e.x}px`, top: `${e.y}px` })}
|
|
872
|
+
@click=${(o) => o.stopPropagation()}
|
|
873
|
+
@keydown=${this.onContextMenuKeydown}
|
|
826
874
|
>
|
|
827
|
-
${this.opEnabled("rename") ?
|
|
875
|
+
${this.opEnabled("rename") ? d`<li role="none"><button class="menu-item" role="menuitem" ?disabled=${this._selection.size !== 1 || !this.opEnabledOnSelection("rename")} @click=${() => {
|
|
828
876
|
this.closeContextMenu(), this.beginRenameFromToolbar();
|
|
829
|
-
}}>${t.rename}</button></li>` :
|
|
830
|
-
${this.opEnabled("delete") ?
|
|
877
|
+
}}>${t.rename}</button></li>` : c}
|
|
878
|
+
${this.opEnabled("delete") ? d`<li role="none"><button class="menu-item" role="menuitem" ?disabled=${!i || !this.opEnabledOnSelection("delete")} @click=${() => {
|
|
831
879
|
this.closeContextMenu(), this.deleteSelection();
|
|
832
|
-
}}>${t.delete}</button></li>` :
|
|
880
|
+
}}>${t.delete}</button></li>` : c}
|
|
833
881
|
<li role="separator" class="menu-separator"></li>
|
|
834
|
-
${this.opEnabled("cut") ?
|
|
882
|
+
${this.opEnabled("cut") ? d`<li role="none"><button class="menu-item" role="menuitem" ?disabled=${!i || !this.opEnabledOnSelection("cut")} @click=${() => {
|
|
835
883
|
this.closeContextMenu(), this.setClipboard("cut");
|
|
836
|
-
}}>${t.cut}</button></li>` :
|
|
837
|
-
${this.opEnabled("copy") ?
|
|
884
|
+
}}>${t.cut}</button></li>` : c}
|
|
885
|
+
${this.opEnabled("copy") ? d`<li role="none"><button class="menu-item" role="menuitem" ?disabled=${!i || !this.opEnabledOnSelection("copy")} @click=${() => {
|
|
838
886
|
this.closeContextMenu(), this.setClipboard("copy");
|
|
839
|
-
}}>${t.copy}</button></li>` :
|
|
840
|
-
${this.opEnabled("paste") ?
|
|
887
|
+
}}>${t.copy}</button></li>` : c}
|
|
888
|
+
${this.opEnabled("paste") ? d`<li role="none"><button class="menu-item" role="menuitem" ?disabled=${!n} @click=${() => {
|
|
841
889
|
this.closeContextMenu(), this.paste();
|
|
842
|
-
}}>${t.paste}</button></li>` :
|
|
890
|
+
}}>${t.paste}</button></li>` : c}
|
|
843
891
|
<li role="separator" class="menu-separator"></li>
|
|
844
|
-
${this.opEnabled("newFolder") ?
|
|
892
|
+
${this.opEnabled("newFolder") ? d`<li role="none"><button class="menu-item" role="menuitem" @click=${() => {
|
|
845
893
|
this.closeContextMenu(), this.promptNewFolder();
|
|
846
|
-
}}>${t.newFolder}</button></li>` :
|
|
894
|
+
}}>${t.newFolder}</button></li>` : c}
|
|
847
895
|
</ul>
|
|
848
896
|
`;
|
|
849
897
|
}
|
|
850
898
|
openContextMenu(e, t, i) {
|
|
851
|
-
this._allowOperations
|
|
899
|
+
if (this._allowOperations === !1) return;
|
|
900
|
+
const n = v();
|
|
901
|
+
this._contextMenuReturnTarget = n instanceof HTMLElement && n !== n.ownerDocument.body ? n : null, this._contextMenu = { x: t, y: i, targetId: e }, this.requestUpdate(), this.updateComplete.then(() => {
|
|
902
|
+
this.contextMenuRoving.sync(), this.contextMenuRoving.moveTo(0);
|
|
852
903
|
const o = (r) => {
|
|
853
904
|
r instanceof KeyboardEvent && r.key !== "Escape" || (this.closeContextMenu(), document.removeEventListener("click", o, !0), document.removeEventListener("contextmenu", o, !0), document.removeEventListener("keydown", o, !0));
|
|
854
905
|
};
|
|
855
906
|
document.addEventListener("click", o, !0), document.addEventListener("contextmenu", o, !0), document.addEventListener("keydown", o, !0);
|
|
856
|
-
})
|
|
907
|
+
});
|
|
857
908
|
}
|
|
858
909
|
closeContextMenu() {
|
|
859
|
-
this._contextMenu && (this._contextMenu = null, this.requestUpdate());
|
|
910
|
+
this._contextMenu && (this._contextMenu = null, this.requestUpdate(), this._contextMenuReturnTarget?.focus(), this._contextMenuReturnTarget = null);
|
|
860
911
|
}
|
|
861
912
|
renderToolbar() {
|
|
862
|
-
const e = this._messages, t = this._selection.size > 0, i = this._clipboard !== null,
|
|
863
|
-
return
|
|
913
|
+
const e = this._messages, t = this._selection.size > 0, i = this._clipboard !== null, n = this._searchPlaceholder || e.searchPlaceholder;
|
|
914
|
+
return d`
|
|
864
915
|
<div class="toolbar" role="toolbar" aria-label=${e.ariaToolbar}>
|
|
865
|
-
${this.opEnabled("newFolder") ?
|
|
866
|
-
${this.opEnabled("rename") ?
|
|
916
|
+
${this.opEnabled("newFolder") ? d`<button type="button" @click=${this.promptNewFolder} aria-label=${e.newFolder}>📁 ${e.newFolder}</button>` : c}
|
|
917
|
+
${this.opEnabled("rename") ? d`<button
|
|
867
918
|
type="button"
|
|
868
919
|
?disabled=${!t || this._selection.size !== 1 || !this.opEnabledOnSelection("rename")}
|
|
869
920
|
@click=${this.beginRenameFromToolbar}
|
|
870
921
|
aria-label=${e.rename}
|
|
871
|
-
>✏️ ${e.rename}</button>` :
|
|
872
|
-
${this.opEnabled("delete") ?
|
|
922
|
+
>✏️ ${e.rename}</button>` : c}
|
|
923
|
+
${this.opEnabled("delete") ? d`<button
|
|
873
924
|
type="button"
|
|
874
925
|
?disabled=${!t || !this.opEnabledOnSelection("delete")}
|
|
875
926
|
@click=${this.deleteSelection}
|
|
876
927
|
aria-label=${e.delete}
|
|
877
|
-
>🗑 ${e.delete}</button>` :
|
|
878
|
-
${this.opEnabled("cut") ?
|
|
928
|
+
>🗑 ${e.delete}</button>` : c}
|
|
929
|
+
${this.opEnabled("cut") ? d`<button
|
|
879
930
|
type="button"
|
|
880
931
|
?disabled=${!t || !this.opEnabledOnSelection("cut")}
|
|
881
932
|
@click=${() => this.setClipboard("cut")}
|
|
882
933
|
aria-label=${e.cut}
|
|
883
|
-
>✂ ${e.cut}</button>` :
|
|
884
|
-
${this.opEnabled("copy") ?
|
|
934
|
+
>✂ ${e.cut}</button>` : c}
|
|
935
|
+
${this.opEnabled("copy") ? d`<button
|
|
885
936
|
type="button"
|
|
886
937
|
?disabled=${!t || !this.opEnabledOnSelection("copy")}
|
|
887
938
|
@click=${() => this.setClipboard("copy")}
|
|
888
939
|
aria-label=${e.copy}
|
|
889
|
-
>📋 ${e.copy}</button>` :
|
|
890
|
-
${this.opEnabled("paste") ?
|
|
940
|
+
>📋 ${e.copy}</button>` : c}
|
|
941
|
+
${this.opEnabled("paste") ? d`<button
|
|
891
942
|
type="button"
|
|
892
943
|
?disabled=${!i}
|
|
893
944
|
@click=${this.paste}
|
|
894
945
|
aria-label=${e.paste}
|
|
895
|
-
>📥 ${e.paste}</button>` :
|
|
896
|
-
${this._allowUpload
|
|
946
|
+
>📥 ${e.paste}</button>` : c}
|
|
947
|
+
${this._allowUpload ? d`<button
|
|
897
948
|
type="button"
|
|
898
949
|
@click=${this.openUploadPicker}
|
|
899
950
|
aria-label=${e.upload}
|
|
900
|
-
>📤 ${e.upload}</button>` :
|
|
951
|
+
>📤 ${e.upload}</button>` : c}
|
|
901
952
|
<span class="spacer"></span>
|
|
902
953
|
<input
|
|
903
954
|
type="search"
|
|
904
955
|
class="search-input"
|
|
905
956
|
.value=${this._searchQuery}
|
|
906
|
-
placeholder=${
|
|
907
|
-
@input=${(
|
|
957
|
+
placeholder=${n}
|
|
958
|
+
@input=${(o) => this.onSearchInput(o)}
|
|
908
959
|
aria-label=${e.searchPlaceholder}
|
|
909
960
|
/>
|
|
910
|
-
<div class="view-toggle" role="group" aria-label
|
|
961
|
+
<div class="view-toggle" role="group" aria-label=${this._messages.ariaViewMode}>
|
|
911
962
|
<button
|
|
912
963
|
type="button"
|
|
913
964
|
data-active=${this._viewMode === "list" ? "true" : "false"}
|
|
914
965
|
@click=${() => this.setViewMode("list")}
|
|
915
966
|
aria-label=${e.listView}
|
|
916
967
|
aria-pressed=${this._viewMode === "list"}
|
|
917
|
-
>${u(
|
|
968
|
+
>${u(F)}</button>
|
|
918
969
|
<button
|
|
919
970
|
type="button"
|
|
920
971
|
data-active=${this._viewMode === "icons" ? "true" : "false"}
|
|
921
972
|
@click=${() => this.setViewMode("icons")}
|
|
922
973
|
aria-label=${e.iconsView}
|
|
923
974
|
aria-pressed=${this._viewMode === "icons"}
|
|
924
|
-
>${u(
|
|
975
|
+
>${u(I)}</button>
|
|
925
976
|
</div>
|
|
926
977
|
</div>
|
|
927
978
|
`;
|
|
928
979
|
}
|
|
929
980
|
renderBreadcrumb(e) {
|
|
930
|
-
return
|
|
981
|
+
return d`
|
|
931
982
|
<nav class="breadcrumb-bar" aria-label=${this._messages.ariaBreadcrumb}>
|
|
932
983
|
<button
|
|
933
984
|
class="breadcrumb-segment"
|
|
@@ -937,13 +988,13 @@ class F extends g {
|
|
|
937
988
|
type="button"
|
|
938
989
|
>${this._messages.home}</button>
|
|
939
990
|
${e.map((t, i) => {
|
|
940
|
-
const
|
|
941
|
-
return
|
|
991
|
+
const n = i === e.length - 1;
|
|
992
|
+
return d`
|
|
942
993
|
<span class="breadcrumb-separator" aria-hidden="true">›</span>
|
|
943
994
|
<button
|
|
944
995
|
class="breadcrumb-segment"
|
|
945
|
-
data-current=${
|
|
946
|
-
aria-current=${
|
|
996
|
+
data-current=${n ? "true" : "false"}
|
|
997
|
+
aria-current=${n ? "page" : "false"}
|
|
947
998
|
@click=${() => this.navigateTo(t.id)}
|
|
948
999
|
type="button"
|
|
949
1000
|
>${t.name}</button>
|
|
@@ -959,36 +1010,36 @@ class F extends g {
|
|
|
959
1010
|
label: t.name,
|
|
960
1011
|
sortable: !0,
|
|
961
1012
|
cellClass: "text-nowrap",
|
|
962
|
-
cellRenderer: (
|
|
1013
|
+
cellRenderer: (n) => this.renderNameCell(n)
|
|
963
1014
|
},
|
|
964
1015
|
{
|
|
965
1016
|
name: "size",
|
|
966
1017
|
label: t.size,
|
|
967
1018
|
sortable: !0,
|
|
968
1019
|
cellClass: "text-nowrap",
|
|
969
|
-
cellRenderer: (
|
|
1020
|
+
cellRenderer: (n) => this.formatSize(n)
|
|
970
1021
|
},
|
|
971
1022
|
{
|
|
972
1023
|
name: "modifiedAt",
|
|
973
1024
|
label: t.modified,
|
|
974
1025
|
sortable: !0,
|
|
975
1026
|
cellClass: "text-nowrap",
|
|
976
|
-
cellRenderer: (
|
|
1027
|
+
cellRenderer: (n) => this.formatDate(n)
|
|
977
1028
|
},
|
|
978
1029
|
{
|
|
979
1030
|
name: "type",
|
|
980
1031
|
label: t.type,
|
|
981
1032
|
sortable: !0,
|
|
982
1033
|
cellClass: "text-nowrap",
|
|
983
|
-
cellRenderer: (
|
|
1034
|
+
cellRenderer: (n) => n.type === "folder" ? t.folder : n.mimeType ?? t.file
|
|
984
1035
|
}
|
|
985
1036
|
];
|
|
986
|
-
return
|
|
1037
|
+
return d`
|
|
987
1038
|
<mp-datatable
|
|
988
1039
|
.columns=${i}
|
|
989
1040
|
.data=${e}
|
|
990
1041
|
.selectedIds=${[...this._selection]}
|
|
991
|
-
.rowKey=${(
|
|
1042
|
+
.rowKey=${(n) => n.id}
|
|
992
1043
|
selection-mode=${this._selectionMode}
|
|
993
1044
|
resizable-columns
|
|
994
1045
|
virtual-scroll
|
|
@@ -1004,11 +1055,11 @@ class F extends g {
|
|
|
1004
1055
|
}
|
|
1005
1056
|
renderNameCell(e) {
|
|
1006
1057
|
const t = this.resolveIcon(e);
|
|
1007
|
-
return this._renameTarget === e.id ?
|
|
1058
|
+
return this._renameTarget === e.id ? d`
|
|
1008
1059
|
<span class="row-cell">
|
|
1009
|
-
<span class="row-icon" aria-hidden="true">${t ? u(t) :
|
|
1060
|
+
<span class="row-icon" aria-hidden="true">${t ? u(t) : c}</span>
|
|
1010
1061
|
<input
|
|
1011
|
-
${
|
|
1062
|
+
${x(this._renameInputRef)}
|
|
1012
1063
|
type="text"
|
|
1013
1064
|
class="rename-input"
|
|
1014
1065
|
.value=${e.name}
|
|
@@ -1017,40 +1068,50 @@ class F extends g {
|
|
|
1017
1068
|
@blur=${(i) => this.commitRename(e, i.target.value)}
|
|
1018
1069
|
/>
|
|
1019
1070
|
</span>
|
|
1020
|
-
` :
|
|
1071
|
+
` : d`
|
|
1021
1072
|
<span class="row-cell">
|
|
1022
|
-
<span class="row-icon" aria-hidden="true">${t ? u(t) :
|
|
1073
|
+
<span class="row-icon" aria-hidden="true">${t ? u(t) : c}</span>
|
|
1023
1074
|
<span>${e.name}</span>
|
|
1024
1075
|
</span>
|
|
1025
1076
|
`;
|
|
1026
1077
|
}
|
|
1078
|
+
/**
|
|
1079
|
+
* listbox/option, not grid/gridcell (Phase E): the cards were gridcells
|
|
1080
|
+
* with no row chain — an invalid grid — and the wrap-reflow layout has no
|
|
1081
|
+
* stable row/column geometry to expose anyway. Options rove: one tab stop
|
|
1082
|
+
* for the whole surface, arrows move between cards.
|
|
1083
|
+
*/
|
|
1027
1084
|
renderIconGridView(e) {
|
|
1028
|
-
return
|
|
1029
|
-
<div class="icon-grid" role="
|
|
1030
|
-
${
|
|
1085
|
+
return d`
|
|
1086
|
+
<div class="icon-grid" role="listbox" aria-multiselectable="true" aria-label=${this._messages.ariaFileList} @keydown=${this.onContentKeydown}>
|
|
1087
|
+
${y(
|
|
1031
1088
|
e,
|
|
1032
1089
|
(t) => t.id,
|
|
1033
|
-
(t) => this.renderIconCard(t)
|
|
1090
|
+
(t, i) => this.renderIconCard(t, i, e)
|
|
1034
1091
|
)}
|
|
1035
1092
|
</div>
|
|
1036
1093
|
`;
|
|
1037
1094
|
}
|
|
1038
|
-
renderIconCard(e) {
|
|
1039
|
-
const
|
|
1040
|
-
return
|
|
1095
|
+
renderIconCard(e, t, i) {
|
|
1096
|
+
const n = this._selection.has(e.id), o = this._clipboard?.mode === "cut" && this._clipboard.ids.includes(e.id), r = this.resolveIcon(e), s = this._iconFocusId && i.some((l) => l.id === this._iconFocusId) ? this._iconFocusId : i.find((l) => this._selection.has(l.id))?.id ?? i[0]?.id;
|
|
1097
|
+
return d`
|
|
1041
1098
|
<button
|
|
1042
1099
|
class="icon-card"
|
|
1043
1100
|
type="button"
|
|
1044
|
-
role="
|
|
1101
|
+
role="option"
|
|
1102
|
+
tabindex=${e.id === s ? "0" : "-1"}
|
|
1045
1103
|
data-node-id=${e.id}
|
|
1046
|
-
data-selected=${
|
|
1047
|
-
data-cut=${
|
|
1048
|
-
aria-selected=${
|
|
1049
|
-
@
|
|
1104
|
+
data-selected=${n ? "true" : "false"}
|
|
1105
|
+
data-cut=${o ? "true" : "false"}
|
|
1106
|
+
aria-selected=${n ? "true" : "false"}
|
|
1107
|
+
@focus=${() => {
|
|
1108
|
+
this._iconFocusId = e.id;
|
|
1109
|
+
}}
|
|
1110
|
+
@click=${(l) => this.onIconCardClick(e, l)}
|
|
1050
1111
|
@dblclick=${() => this.activateNode(e)}
|
|
1051
|
-
@contextmenu=${(
|
|
1112
|
+
@contextmenu=${(l) => this.onIconCardContextMenu(e, l)}
|
|
1052
1113
|
>
|
|
1053
|
-
<span class="file-icon" aria-hidden="true">${
|
|
1114
|
+
<span class="file-icon" aria-hidden="true">${r ? u(r) : c}</span>
|
|
1054
1115
|
<span class="file-name">${e.name}</span>
|
|
1055
1116
|
</button>
|
|
1056
1117
|
`;
|
|
@@ -1062,15 +1123,15 @@ class F extends g {
|
|
|
1062
1123
|
const i = this._iconResolver(t, e);
|
|
1063
1124
|
if (i) return i;
|
|
1064
1125
|
}
|
|
1065
|
-
return e.type === "folder" ?
|
|
1126
|
+
return e.type === "folder" ? f : M;
|
|
1066
1127
|
}
|
|
1067
1128
|
resolveIconForTree(e, t) {
|
|
1068
|
-
const i = this._nodes.find((
|
|
1129
|
+
const i = this._nodes.find((n) => n.id === t.id);
|
|
1069
1130
|
if (this._iconResolver) {
|
|
1070
|
-
const
|
|
1071
|
-
if (
|
|
1131
|
+
const n = this._iconResolver(e, i);
|
|
1132
|
+
if (n) return n;
|
|
1072
1133
|
}
|
|
1073
|
-
return
|
|
1134
|
+
return f;
|
|
1074
1135
|
}
|
|
1075
1136
|
onIconCardContextMenu(e, t) {
|
|
1076
1137
|
t.preventDefault(), this._selectionMode !== "none" && !this._selection.has(e.id) && (this._selection = /* @__PURE__ */ new Set([e.id]), this.emitSelectionChange()), this.openContextMenu(e.id, t.clientX, t.clientY);
|
|
@@ -1080,10 +1141,10 @@ class F extends g {
|
|
|
1080
1141
|
if (this._selectionMode === "multiple" && (t.ctrlKey || t.metaKey))
|
|
1081
1142
|
this._selection.has(e.id) ? this._selection.delete(e.id) : this._selection.add(e.id);
|
|
1082
1143
|
else if (this._selectionMode === "multiple" && t.shiftKey && this._selection.size > 0) {
|
|
1083
|
-
const i = this.getCurrentChildren(),
|
|
1084
|
-
if (
|
|
1085
|
-
const [
|
|
1086
|
-
for (let
|
|
1144
|
+
const i = this.getCurrentChildren(), n = [...this._selection][this._selection.size - 1], o = i.findIndex((s) => s.id === n), r = i.findIndex((s) => s.id === e.id);
|
|
1145
|
+
if (o >= 0 && r >= 0) {
|
|
1146
|
+
const [s, l] = o < r ? [o, r] : [r, o];
|
|
1147
|
+
for (let h = s; h <= l; h++) this._selection.add(i[h].id);
|
|
1087
1148
|
}
|
|
1088
1149
|
} else
|
|
1089
1150
|
this._selection = /* @__PURE__ */ new Set([e.id]);
|
|
@@ -1100,7 +1161,11 @@ class F extends g {
|
|
|
1100
1161
|
);
|
|
1101
1162
|
}
|
|
1102
1163
|
onSearchInput(e) {
|
|
1103
|
-
this._searchQuery = e.target.value, this.requestUpdate()
|
|
1164
|
+
this._searchQuery = e.target.value, this.requestUpdate(), this._searchAnnounceTimer && clearTimeout(this._searchAnnounceTimer), this._searchAnnounceTimer = setTimeout(() => {
|
|
1165
|
+
this._searchAnnounceTimer = null, this._searchQuery.trim() && this.liveAnnouncer.announce(
|
|
1166
|
+
this._messages.announceSearchResults(this.getCurrentChildren().length)
|
|
1167
|
+
);
|
|
1168
|
+
}, 500);
|
|
1104
1169
|
}
|
|
1105
1170
|
setViewMode(e) {
|
|
1106
1171
|
this.viewMode = e;
|
|
@@ -1108,11 +1173,11 @@ class F extends g {
|
|
|
1108
1173
|
// ─── Navigation ─────────────────────────────────────────────────────────
|
|
1109
1174
|
navigateTo(e) {
|
|
1110
1175
|
if (e !== null) {
|
|
1111
|
-
const i = this._nodes.find((
|
|
1176
|
+
const i = this._nodes.find((o) => o.id === e);
|
|
1112
1177
|
if (!i || i.type !== "folder") return;
|
|
1113
|
-
let
|
|
1114
|
-
for (;
|
|
1115
|
-
this._expandedTreeIds.add(
|
|
1178
|
+
let n = i.parentId;
|
|
1179
|
+
for (; n !== null; )
|
|
1180
|
+
this._expandedTreeIds.add(n), n = this._nodes.find((r) => r.id === n)?.parentId ?? null;
|
|
1116
1181
|
this._expandedTreeIds.add(e);
|
|
1117
1182
|
}
|
|
1118
1183
|
if (this._currentFolderId === e) return;
|
|
@@ -1132,13 +1197,13 @@ class F extends g {
|
|
|
1132
1197
|
commitRename(e, t) {
|
|
1133
1198
|
if (this._renameTarget !== e.id) return;
|
|
1134
1199
|
const i = t.trim();
|
|
1135
|
-
this._renameTarget = null, this.requestUpdate(), !(!i || i === e.name) && this.dispatchEvent(
|
|
1200
|
+
this._renameTarget = null, this.requestUpdate(), !(!i || i === e.name) && (this.liveAnnouncer.announce(this._messages.announceRenamed(e.name, i)), this.dispatchEvent(
|
|
1136
1201
|
new CustomEvent("mp-operation", {
|
|
1137
1202
|
detail: { kind: "rename", nodeId: e.id, previousName: e.name, newName: i },
|
|
1138
1203
|
bubbles: !0,
|
|
1139
1204
|
composed: !0
|
|
1140
1205
|
})
|
|
1141
|
-
);
|
|
1206
|
+
));
|
|
1142
1207
|
}
|
|
1143
1208
|
onRenameKeydown(e, t) {
|
|
1144
1209
|
if (e.key === "Enter") {
|
|
@@ -1159,18 +1224,18 @@ class F extends g {
|
|
|
1159
1224
|
*/
|
|
1160
1225
|
async resolveConflictsForPaste(e, t) {
|
|
1161
1226
|
if (!this._conflictResolver) return {};
|
|
1162
|
-
const i = {},
|
|
1163
|
-
for (const
|
|
1164
|
-
const
|
|
1165
|
-
if (!
|
|
1166
|
-
const
|
|
1167
|
-
if (!
|
|
1168
|
-
const
|
|
1169
|
-
existingNode:
|
|
1170
|
-
incomingName:
|
|
1227
|
+
const i = {}, n = this._nodes.filter((o) => o.parentId === t);
|
|
1228
|
+
for (const o of e) {
|
|
1229
|
+
const r = this._nodes.find((h) => h.id === o);
|
|
1230
|
+
if (!r) continue;
|
|
1231
|
+
const s = n.find((h) => h.name === r.name && h.id !== o);
|
|
1232
|
+
if (!s) continue;
|
|
1233
|
+
const l = await this._conflictResolver({
|
|
1234
|
+
existingNode: s,
|
|
1235
|
+
incomingName: r.name,
|
|
1171
1236
|
mode: "paste"
|
|
1172
1237
|
});
|
|
1173
|
-
i[
|
|
1238
|
+
i[o] = l;
|
|
1174
1239
|
}
|
|
1175
1240
|
return i;
|
|
1176
1241
|
}
|
|
@@ -1181,40 +1246,40 @@ class F extends g {
|
|
|
1181
1246
|
* emits `mp-upload-request` with one resolved file per kept entry.
|
|
1182
1247
|
*/
|
|
1183
1248
|
async handleFiles(e) {
|
|
1184
|
-
const t = this._currentFolderId, i = this._nodes.filter((
|
|
1185
|
-
for (const
|
|
1186
|
-
const
|
|
1187
|
-
if (
|
|
1188
|
-
const
|
|
1189
|
-
existingNode:
|
|
1190
|
-
incomingName:
|
|
1249
|
+
const t = this._currentFolderId, i = this._nodes.filter((r) => r.parentId === t), n = [];
|
|
1250
|
+
for (const r of e) {
|
|
1251
|
+
const s = i.find((l) => l.name === r.name);
|
|
1252
|
+
if (s && this._conflictResolver) {
|
|
1253
|
+
const l = await this._conflictResolver({
|
|
1254
|
+
existingNode: s,
|
|
1255
|
+
incomingName: r.name,
|
|
1191
1256
|
mode: "upload"
|
|
1192
1257
|
});
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1195
|
-
file:
|
|
1258
|
+
if (l.action === "skip") continue;
|
|
1259
|
+
n.push({
|
|
1260
|
+
file: r,
|
|
1196
1261
|
entryId: this.makeUploadId(),
|
|
1197
|
-
conflict:
|
|
1198
|
-
renamedTo:
|
|
1262
|
+
conflict: l.action,
|
|
1263
|
+
renamedTo: l.newName
|
|
1199
1264
|
});
|
|
1200
1265
|
} else
|
|
1201
|
-
|
|
1266
|
+
n.push({ file: r, entryId: this.makeUploadId() });
|
|
1202
1267
|
}
|
|
1203
|
-
if (
|
|
1204
|
-
const
|
|
1205
|
-
id:
|
|
1206
|
-
file:
|
|
1268
|
+
if (n.length === 0) return;
|
|
1269
|
+
const o = n.map((r) => ({
|
|
1270
|
+
id: r.entryId,
|
|
1271
|
+
file: r.file,
|
|
1207
1272
|
targetFolderId: t,
|
|
1208
1273
|
progress: 0,
|
|
1209
1274
|
status: "pending"
|
|
1210
1275
|
}));
|
|
1211
|
-
this._uploads = [...this._uploads, ...
|
|
1276
|
+
this._uploads = [...this._uploads, ...o], this.requestUpdate(), this.dispatchEvent(
|
|
1212
1277
|
new CustomEvent("mp-upload-request", {
|
|
1213
1278
|
detail: {
|
|
1214
|
-
files:
|
|
1279
|
+
files: n.map((r) => r.file),
|
|
1215
1280
|
targetFolderId: t,
|
|
1216
|
-
uploads:
|
|
1217
|
-
conflictResolutions:
|
|
1281
|
+
uploads: o,
|
|
1282
|
+
conflictResolutions: n.filter((r) => r.conflict).map((r) => ({ fileName: r.file.name, action: r.conflict, newName: r.renamedTo }))
|
|
1218
1283
|
},
|
|
1219
1284
|
bubbles: !0,
|
|
1220
1285
|
composed: !0
|
|
@@ -1255,10 +1320,10 @@ class F extends g {
|
|
|
1255
1320
|
}
|
|
1256
1321
|
}
|
|
1257
1322
|
}
|
|
1258
|
-
typeof customElements < "u" && !customElements.get("mp-file-manager") && customElements.define("mp-file-manager",
|
|
1323
|
+
typeof customElements < "u" && !customElements.get("mp-file-manager") && customElements.define("mp-file-manager", S);
|
|
1259
1324
|
export {
|
|
1260
1325
|
p as DEFAULT_FILE_MANAGER_MESSAGES,
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1326
|
+
S as MpFileManager,
|
|
1327
|
+
k as fileManagerStyles,
|
|
1328
|
+
E as mergeMessages
|
|
1264
1329
|
};
|