vintage-frames 0.18.0 → 0.19.1
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 +1 -1
- package/custom-elements.json +278 -51
- package/dist/build/app-file.d.ts +2 -2
- package/dist/build/app-file.js +1 -0
- package/dist/build/plugins.d.ts +2 -2
- package/dist/build/plugins.js +62 -59
- package/dist/components/vf-icon.d.ts +7 -0
- package/dist/components/vf-icon.js +101 -81
- package/dist/components/vf-menu-bar.d.ts +6 -4
- package/dist/components/vf-menu-bar.js +26 -56
- package/dist/components/vf-menu-item.d.ts +33 -5
- package/dist/components/vf-menu-item.js +128 -61
- package/dist/components/vf-menu.d.ts +35 -0
- package/dist/components/vf-menu.js +171 -111
- package/dist/glyphs.d.ts +6 -0
- package/dist/glyphs.js +18 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -14
- package/dist/menu-navigation.d.ts +34 -0
- package/dist/menu-navigation.js +53 -0
- package/dist/menu-press.d.ts +25 -7
- package/dist/menu-press.js +78 -44
- package/dist/motion.d.ts +10 -0
- package/dist/shell/app-file.d.ts +20 -4
- package/dist/shell/app-file.js +65 -53
- package/dist/shell/catalog.d.ts +79 -1
- package/dist/shell/catalog.js +206 -153
- package/dist/shell/finder.d.ts +28 -9
- package/dist/shell/finder.js +339 -267
- package/dist/shell/geometry.d.ts +7 -0
- package/dist/shell/geometry.js +19 -3
- package/dist/shell/index.d.ts +4 -4
- package/dist/shell/index.js +12 -12
- package/dist/shell/pure.d.ts +1 -1
- package/dist/shell/pure.js +6 -6
- package/dist/shell/shell.d.ts +14 -10
- package/dist/shell/shell.js +148 -116
- package/dist/shell/version.d.ts +1 -1
- package/dist/shell/version.js +1 -1
- package/dist/styles/body-italic-font.d.ts +2 -0
- package/dist/styles/body-italic-font.js +10 -0
- package/dist/styles/register-embedded-font.d.ts +5 -4
- package/dist/styles/register-embedded-font.js +11 -10
- package/docs/SPEC.md +11 -7
- package/editor/vscode.html-custom-data.json +15 -5
- package/editor/web-types.json +55 -9
- package/package.json +7 -3
package/dist/shell/finder.js
CHANGED
|
@@ -2,31 +2,32 @@ import { snapSys as e, systemPxQuantum as t } from "../scale.js";
|
|
|
2
2
|
import { prefersReducedMotion as n } from "../motion.js";
|
|
3
3
|
import { windowChrome as r } from "../window-chrome.js";
|
|
4
4
|
import "../index.js";
|
|
5
|
-
import {
|
|
6
|
-
import { cleanUp as
|
|
7
|
-
import { desktopRendered as
|
|
8
|
-
import { defineApp as
|
|
9
|
-
import { fileByDrag as
|
|
10
|
-
import { composeAlert as
|
|
5
|
+
import { ALIAS_KIND as i, APPLE_MENU_ITEMS as a, FOLDER as o, STARTUP_ITEMS as s, SYSTEM_FOLDER as c, TRASH as l, aliasName as u, appIdOf as d, canAlias as ee, childrenOf as te, containerOf as ne, dropTargetOf as f, enclosingFolders as re, isContainerKind as ie, isInside as ae, isKept as p, isTrashed as m, itemCount as h, resolve as oe } from "./catalog.js";
|
|
6
|
+
import { cleanUp as se, collisions as ce, desktopLattice as le, fieldExtent as ue, fillOrder as de, folderLattice as fe, frameOf as pe, freeCellNear as me, nextFreeCell as he, pinOf as ge, pinTo as _e, trashCell as ve } from "./geometry.js";
|
|
7
|
+
import { desktopRendered as ye } from "./windows.js";
|
|
8
|
+
import { defineApp as g } from "./shell.js";
|
|
9
|
+
import { fileByDrag as be } from "./filing.js";
|
|
10
|
+
import { composeAlert as xe } from "./alert.js";
|
|
11
11
|
//#region src/shell/finder.ts
|
|
12
|
-
var
|
|
12
|
+
var _ = "finder", Se = 306, Ce = 300, we = {
|
|
13
13
|
"new-folder": "New Folder",
|
|
14
14
|
"empty-trash": "Empty Trash",
|
|
15
15
|
paste: "Paste",
|
|
16
|
-
"add-file": "Adding the file"
|
|
17
|
-
|
|
16
|
+
"add-file": "Adding the file",
|
|
17
|
+
"make-alias": "Make Alias"
|
|
18
|
+
}, Te = 20, Ee = 18, v = {
|
|
18
19
|
left: 8,
|
|
19
20
|
top: 2
|
|
20
|
-
},
|
|
21
|
+
}, y = {
|
|
21
22
|
width: 12,
|
|
22
23
|
height: 12
|
|
23
|
-
},
|
|
24
|
-
left:
|
|
25
|
-
top:
|
|
26
|
-
},
|
|
27
|
-
left:
|
|
28
|
-
top:
|
|
29
|
-
},
|
|
24
|
+
}, b = {
|
|
25
|
+
left: v.left - 1,
|
|
26
|
+
top: v.top
|
|
27
|
+
}, De = {
|
|
28
|
+
left: b.left + y.width + 3,
|
|
29
|
+
top: v.top
|
|
30
|
+
}, x = [
|
|
30
31
|
{
|
|
31
32
|
menu: "file",
|
|
32
33
|
label: "File",
|
|
@@ -41,6 +42,11 @@ var h = "finder", me = 306, he = 300, ge = {
|
|
|
41
42
|
"close",
|
|
42
43
|
"Close",
|
|
43
44
|
"⌃W"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"make-alias",
|
|
48
|
+
"Make Alias",
|
|
49
|
+
"⌘M"
|
|
44
50
|
]
|
|
45
51
|
]
|
|
46
52
|
},
|
|
@@ -79,24 +85,29 @@ var h = "finder", me = 306, he = 300, ge = {
|
|
|
79
85
|
label: "Special",
|
|
80
86
|
items: [["clean-up", "Clean Up Desktop"], ["empty-trash", "Empty Trash…"]]
|
|
81
87
|
}
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
], S = [
|
|
89
|
+
c,
|
|
90
|
+
a,
|
|
91
|
+
s
|
|
92
|
+
], Oe = /* @__PURE__ */ new Set(["close", "make-alias"]);
|
|
93
|
+
function C(e) {
|
|
94
|
+
return x.map(({ menu: t, label: n, items: r }) => {
|
|
95
|
+
let i = r.filter(([t]) => e(t)).map(([e, t, n], r) => `${Oe.has(e) && r > 0 ? "<vf-separator></vf-separator>" : ""}<vf-menu-item value="${e}"${n ? ` shortcut="${n}"` : ""}>${t}</vf-menu-item>`);
|
|
86
96
|
return i.length ? `<vf-menu data-menu="${t}" label="${n}">${i.join("")}</vf-menu>` : "";
|
|
87
97
|
}).join("");
|
|
88
98
|
}
|
|
89
|
-
var
|
|
90
|
-
function
|
|
99
|
+
var ke = (e) => e.localName === "vf-icon" && e.dataset.app != null || e instanceof HTMLTemplateElement && (e.dataset.folder != null || e.dataset.system != null);
|
|
100
|
+
function Ae(e) {
|
|
91
101
|
let t = (e, t) => e != null && t != null && Number.isFinite(+e) && Number.isFinite(+t) ? {
|
|
92
102
|
left: +e,
|
|
93
103
|
top: +t
|
|
94
104
|
} : void 0, n = [];
|
|
95
|
-
for (let r of [...e.children].filter(
|
|
96
|
-
kind:
|
|
105
|
+
for (let r of [...e.children].filter(ke)) r instanceof HTMLTemplateElement ? n.push({
|
|
106
|
+
kind: o,
|
|
97
107
|
name: r.dataset.folder ?? null,
|
|
98
108
|
at: t(r.dataset.left, r.dataset.top),
|
|
99
|
-
|
|
109
|
+
into: r.dataset.system,
|
|
110
|
+
children: Ae(r.content)
|
|
100
111
|
}) : n.push({
|
|
101
112
|
kind: "app",
|
|
102
113
|
name: r.getAttribute("label"),
|
|
@@ -106,13 +117,17 @@ function xe(e) {
|
|
|
106
117
|
});
|
|
107
118
|
return n;
|
|
108
119
|
}
|
|
109
|
-
function
|
|
110
|
-
let
|
|
120
|
+
function w(a) {
|
|
121
|
+
let o = a.volumes?.trash !== !1, s = (e) => a.commands?.[e] !== !1 && (e !== "empty-trash" || o), c = [], Oe = (e) => e, w = a.seed === "markup" ? async (e) => {
|
|
111
122
|
let t = Date.now(), n = async (r, i) => {
|
|
112
123
|
for (let a of r) {
|
|
124
|
+
if (a.into != null) {
|
|
125
|
+
S.includes(a.into) && e.item(a.into) && await n(a.children, a.into);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
113
128
|
let r = await e.create({
|
|
114
129
|
kind: a.kind,
|
|
115
|
-
name: a.name ?? (a.app == null ? void 0 :
|
|
130
|
+
name: a.name ?? (a.app == null ? void 0 : Oe(a.app)),
|
|
116
131
|
parent: i,
|
|
117
132
|
...a.at,
|
|
118
133
|
...a.app == null ? {} : { data: { app: a.app } },
|
|
@@ -121,90 +136,98 @@ function x(i) {
|
|
|
121
136
|
r && a.children.length && await n(a.children, r.id);
|
|
122
137
|
}
|
|
123
138
|
};
|
|
124
|
-
await n(
|
|
125
|
-
} :
|
|
126
|
-
return
|
|
127
|
-
id:
|
|
139
|
+
await n(c, null);
|
|
140
|
+
} : a.seed;
|
|
141
|
+
return g({
|
|
142
|
+
id: _,
|
|
128
143
|
name: "Finder",
|
|
129
|
-
menus:
|
|
130
|
-
dialogs:
|
|
144
|
+
menus: C(s),
|
|
145
|
+
dialogs: a.dialogs,
|
|
131
146
|
catalog: {
|
|
132
|
-
storage:
|
|
133
|
-
volumes:
|
|
134
|
-
|
|
147
|
+
storage: a.storage,
|
|
148
|
+
volumes: a.volumes,
|
|
149
|
+
system: a.system,
|
|
150
|
+
seed: w
|
|
135
151
|
},
|
|
136
|
-
init(
|
|
137
|
-
let { desktop:
|
|
138
|
-
|
|
139
|
-
let E =
|
|
152
|
+
init(g) {
|
|
153
|
+
let { desktop: S, windows: C } = g, w = g.catalog, T = a.art;
|
|
154
|
+
Oe = (e) => g.app(e)?.name ?? e;
|
|
155
|
+
let E = a.lattice?.desktop?.cell ?? 64, D = a.lattice?.folder?.cell ?? 64, je = a.window ?? {
|
|
140
156
|
width: 320,
|
|
141
157
|
height: 223
|
|
142
|
-
},
|
|
158
|
+
}, O = r({
|
|
143
159
|
scrollbars: "both",
|
|
144
|
-
headerHeight:
|
|
145
|
-
}),
|
|
146
|
-
async function
|
|
147
|
-
let i =
|
|
160
|
+
headerHeight: Te
|
|
161
|
+
}), Me = /* @__PURE__ */ new Map();
|
|
162
|
+
async function k(e, t, n, r = {}) {
|
|
163
|
+
let i = Me.get(e);
|
|
148
164
|
if (i) return i(t);
|
|
149
|
-
let a =
|
|
165
|
+
let a = xe(n, {
|
|
150
166
|
art: T.caution ?? null,
|
|
151
167
|
...r
|
|
152
168
|
});
|
|
153
|
-
|
|
169
|
+
g.hold(a.dialog);
|
|
154
170
|
try {
|
|
155
171
|
await a.rendered();
|
|
156
|
-
let e =
|
|
172
|
+
let e = g.ask(a.dialog);
|
|
157
173
|
return a.fit(), await e;
|
|
158
174
|
} finally {
|
|
159
|
-
|
|
175
|
+
g.release(a.dialog);
|
|
160
176
|
}
|
|
161
177
|
}
|
|
162
|
-
let
|
|
178
|
+
let A = (e) => (t) => {
|
|
163
179
|
let n = t;
|
|
164
|
-
|
|
180
|
+
k("failed", {
|
|
165
181
|
action: e,
|
|
166
182
|
error: n
|
|
167
|
-
}, `${
|
|
168
|
-
},
|
|
169
|
-
if (!
|
|
170
|
-
|
|
171
|
-
let e =
|
|
172
|
-
e ? e.after(
|
|
183
|
+
}, `${we[e]} failed: ${n.message}.`);
|
|
184
|
+
}, j = S.querySelector(":scope > vf-icon-field"), Ne = !j;
|
|
185
|
+
if (!j) {
|
|
186
|
+
j = document.createElement("vf-icon-field"), j.label = "Desktop", j.toggleAttribute("fill-width", !0), j.toggleAttribute("fill-height", !0);
|
|
187
|
+
let e = S.querySelector(":scope > vf-menu-bar");
|
|
188
|
+
e ? e.after(j) : S.prepend(j);
|
|
173
189
|
}
|
|
174
|
-
let
|
|
175
|
-
|
|
176
|
-
for (let e of
|
|
177
|
-
let
|
|
178
|
-
let n =
|
|
190
|
+
let M = j, Pe = [...M.children].filter(ke);
|
|
191
|
+
c = Ae(M);
|
|
192
|
+
for (let e of Pe) e.remove();
|
|
193
|
+
let Fe = () => C.windowsOf(_).map((e) => [C.itemOf(e), e]).filter((e) => e[0] != null), N = (e) => e.querySelector(":scope > vf-icon-field"), P = () => [[null, M], ...Fe().flatMap(([e, t]) => {
|
|
194
|
+
let n = N(t);
|
|
179
195
|
return n ? [[e, n]] : [];
|
|
180
|
-
})],
|
|
196
|
+
})], F = (e) => P().find(([t]) => t === e)?.[1] ?? null, I = (e) => [...e.querySelectorAll(":scope > vf-icon[data-id]")], L = () => P().flatMap(([, e]) => I(e)), R = (e) => e.dataset.id, z = (e) => L().find((t) => R(t) === e) ?? null, B = (e) => ({
|
|
181
197
|
left: e.left ?? 0,
|
|
182
198
|
top: e.top ?? 0
|
|
183
|
-
}),
|
|
184
|
-
width: Math.max(0, (e.width ?? 0) -
|
|
185
|
-
height: Math.max(0, (e.height ?? 0) -
|
|
186
|
-
}),
|
|
187
|
-
if (e == null) return
|
|
199
|
+
}), Ie = (e) => C.itemOf(e.closest("vf-window")), Le = (e) => ({
|
|
200
|
+
width: Math.max(0, (e.width ?? 0) - O.left - O.right),
|
|
201
|
+
height: Math.max(0, (e.height ?? 0) - O.top - O.bottom)
|
|
202
|
+
}), V = (e) => {
|
|
203
|
+
if (e == null) return le(S.workArea, a.lattice?.desktop);
|
|
188
204
|
let t = C.windowFor(e);
|
|
189
|
-
return
|
|
190
|
-
},
|
|
191
|
-
let t = C.windowFor(e), n = t &&
|
|
205
|
+
return fe(t ? Le(t).width : 0, a.lattice?.folder);
|
|
206
|
+
}, Re = (e) => {
|
|
207
|
+
let t = C.windowFor(e), n = t && N(t);
|
|
192
208
|
if (!t || !n) return;
|
|
193
|
-
let r =
|
|
209
|
+
let r = ue(I(n).map(B), Le(t), { cell: D });
|
|
194
210
|
n.width !== r.width && (n.width = r.width), n.height !== r.height && (n.height = r.height);
|
|
195
|
-
},
|
|
211
|
+
}, ze = (n, r, i) => {
|
|
196
212
|
if (r == null) {
|
|
197
|
-
let r =
|
|
213
|
+
let r = S.workArea, a = t(n), o = (e) => Math.floor(e / a) * a, s = Math.ceil(r.top / a) * a, c = Math.max(r.left, o(r.left + r.width - E)), l = Math.max(s, o(r.top + r.height - E));
|
|
198
214
|
n.left = Math.min(Math.max(e(i.left, n), r.left), c), n.top = Math.min(Math.max(e(i.top, n), s), l);
|
|
199
215
|
} else n.left = e(Math.max(0, i.left), n), n.top = e(Math.max(0, i.top), n);
|
|
200
|
-
},
|
|
216
|
+
}, Be = (e) => {
|
|
217
|
+
if (e.id === "system-folder") return T.systemFolder ?? T.folder;
|
|
218
|
+
if (e.id === "apple-menu-items") return T.appleMenuItems ?? T.folder;
|
|
219
|
+
if (e.id === "startup-items") return T.startupItems ?? T.folder;
|
|
201
220
|
if (e.kind === "folder") return T.folder;
|
|
202
|
-
if (e.kind === "trash") return
|
|
221
|
+
if (e.kind === "trash") return h(w.get(), "trash") ? T.trashFull : T.trash;
|
|
203
222
|
if (e.kind === "disk") return T.disk ?? T.folder;
|
|
204
|
-
|
|
223
|
+
if (e.kind === "alias") {
|
|
224
|
+
let t = oe(w.get(), e.id);
|
|
225
|
+
return t ? Be(t) : f(w.get(), e.id) ? T.folder : T.document;
|
|
226
|
+
}
|
|
227
|
+
let t = g.kind(e.kind);
|
|
205
228
|
return (typeof t?.art == "function" ? t.art(e) : t?.art) || T.document;
|
|
206
229
|
};
|
|
207
|
-
function
|
|
230
|
+
function Ve(e, t) {
|
|
208
231
|
let n = e.querySelector(":scope > vf-img > img");
|
|
209
232
|
if (!n) {
|
|
210
233
|
let t = document.createElement("vf-img");
|
|
@@ -212,225 +235,273 @@ function x(i) {
|
|
|
212
235
|
}
|
|
213
236
|
n.getAttribute("src") !== t && (n.src = t);
|
|
214
237
|
}
|
|
215
|
-
function
|
|
238
|
+
function He(e) {
|
|
216
239
|
let t = document.createElement("vf-icon");
|
|
217
|
-
return t.dataset.id = e.id, t.label = e.name, t.width = E, t.selectable = !0, t.movable = !0,
|
|
240
|
+
return t.dataset.id = e.id, t.label = e.name, t.width = E, t.selectable = !0, t.movable = !0, t;
|
|
241
|
+
}
|
|
242
|
+
function Ue(e, t) {
|
|
243
|
+
let n = f(w.get(), t.id), r = n == null ? void 0 : "folder" in n ? n.folder : t.id;
|
|
244
|
+
r === void 0 ? delete e.dataset.folder : e.dataset.folder !== r && (e.dataset.folder = r);
|
|
218
245
|
}
|
|
219
|
-
let
|
|
220
|
-
function
|
|
246
|
+
let H = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new WeakMap();
|
|
247
|
+
function We(e, t, n, r) {
|
|
221
248
|
if (t.left != null && t.top != null) {
|
|
222
249
|
let r = `${t.left},${t.top}`;
|
|
223
|
-
if (
|
|
224
|
-
|
|
250
|
+
if (U.get(e) === r) return;
|
|
251
|
+
U.set(e, r), (e.left !== t.left || e.top !== t.top) && ze(e, n, {
|
|
225
252
|
left: t.left,
|
|
226
253
|
top: t.top
|
|
227
254
|
});
|
|
228
255
|
return;
|
|
229
256
|
}
|
|
230
|
-
let
|
|
231
|
-
|
|
257
|
+
let i = I(r).filter((t) => t !== e && t.left != null && t.top != null).map(B), o = n == null && t.id === "trash" ? ve(S.workArea, a.lattice?.desktop) : he(V(n), i, n == null ? E : D);
|
|
258
|
+
ze(e, n, o), H.add(e);
|
|
232
259
|
}
|
|
233
|
-
let
|
|
234
|
-
function
|
|
235
|
-
if (!(
|
|
236
|
-
|
|
260
|
+
let Ge = !1, W = !1;
|
|
261
|
+
function G() {
|
|
262
|
+
if (!(W || !Ge)) {
|
|
263
|
+
W = !0;
|
|
237
264
|
try {
|
|
238
|
-
let e = w.get(), t = new Map(
|
|
239
|
-
for (let [
|
|
240
|
-
let e = t.get(
|
|
241
|
-
e.parentElement !==
|
|
242
|
-
let
|
|
243
|
-
e.open !==
|
|
244
|
-
let u = () =>
|
|
245
|
-
|
|
265
|
+
let e = w.get(), t = new Map(L().map((e) => [R(e), e])), n = /* @__PURE__ */ new Set(), r = [], a = [];
|
|
266
|
+
for (let [o, s] of P()) for (let c of te(e, o)) {
|
|
267
|
+
let e = t.get(c.id) ?? He(c);
|
|
268
|
+
e.parentElement !== s && (s.append(e), e.left = void 0, e.top = void 0, U.delete(e)), n.add(e), e.label !== c.name && (e.label = c.name), e.editable = !p(c.id) && g.kind(c.kind)?.editable !== !1, e.alias = c.kind === i, Ue(e, c), Ve(e, Be(c));
|
|
269
|
+
let l = c.kind === "app" ? C.hasWindows(d(c) ?? "") : C.isOpen(c.id);
|
|
270
|
+
e.open !== l && (e.open = l);
|
|
271
|
+
let u = () => We(e, c, o, s);
|
|
272
|
+
c.left != null && c.top != null ? r.push(u) : a.push(u);
|
|
246
273
|
}
|
|
247
274
|
for (let e of t.values()) n.has(e) || e.remove();
|
|
248
|
-
for (let e of [...r, ...
|
|
249
|
-
for (let [e, t] of
|
|
250
|
-
let n =
|
|
251
|
-
n && r != null && n.label !== r && (n.label = r),
|
|
275
|
+
for (let e of [...r, ...a]) e();
|
|
276
|
+
for (let [e, t] of Fe()) {
|
|
277
|
+
let n = N(t), r = w.item(e)?.name;
|
|
278
|
+
n && r != null && n.label !== r && (n.label = r), Je(e), Re(e);
|
|
252
279
|
}
|
|
253
280
|
} finally {
|
|
254
|
-
|
|
281
|
+
W = !1;
|
|
255
282
|
}
|
|
256
|
-
|
|
283
|
+
Ke();
|
|
257
284
|
}
|
|
258
285
|
}
|
|
259
|
-
let
|
|
260
|
-
function
|
|
261
|
-
if (
|
|
286
|
+
let K = !1;
|
|
287
|
+
function Ke() {
|
|
288
|
+
if (K = !1, !H.size) return;
|
|
262
289
|
let e = /* @__PURE__ */ new Map();
|
|
263
|
-
for (let t of
|
|
264
|
-
|
|
290
|
+
for (let t of H) t.isConnected && t.left != null && t.top != null && e.set(R(t), B(t));
|
|
291
|
+
H.clear(), w.place(e);
|
|
265
292
|
}
|
|
266
|
-
|
|
293
|
+
g.on(S, "vf-placement-change", (e) => {
|
|
267
294
|
let t = e.target;
|
|
268
|
-
t.localName === "vf-icon" && t.dataset.id != null && (
|
|
269
|
-
}),
|
|
270
|
-
function
|
|
295
|
+
t.localName === "vf-icon" && t.dataset.id != null && (H.add(t), !K && (K = !0, queueMicrotask(Ke)));
|
|
296
|
+
}), g.onDispose(w.subscribe(G)), g.onDispose(C.onWindows(G));
|
|
297
|
+
function qe() {
|
|
271
298
|
let e = document.createElement("vf-img");
|
|
272
|
-
e.dataset.trashMark = "", e.width =
|
|
299
|
+
e.dataset.trashMark = "", e.width = y.width, e.height = y.height, e.left = b.left, e.top = b.top;
|
|
273
300
|
let t = document.createElement("img");
|
|
274
301
|
return t.alt = "in the Trash", t.src = T.trashMark, e.append(t), e;
|
|
275
302
|
}
|
|
276
|
-
function
|
|
303
|
+
function Je(e) {
|
|
277
304
|
let t = C.windowFor(e)?.querySelector(":scope > [slot=\"header\"]"), n = t?.querySelector(":scope > vf-label[data-count]");
|
|
278
305
|
if (!t || !n) return;
|
|
279
|
-
let r = w.get(), i =
|
|
306
|
+
let r = w.get(), i = h(r, e), a = `${i} item${i === 1 ? "" : "s"}`;
|
|
280
307
|
n.textContent !== a && (n.textContent = a);
|
|
281
|
-
let o = !!T.trashMark &&
|
|
282
|
-
o && !s ? t.prepend(
|
|
283
|
-
let c = o ?
|
|
308
|
+
let o = !!T.trashMark && m(r, e), s = t.querySelector(":scope > vf-img[data-trash-mark]");
|
|
309
|
+
o && !s ? t.prepend(qe()) : !o && s && s.remove();
|
|
310
|
+
let c = o ? De : v;
|
|
284
311
|
n.left !== c.left && (n.left = c.left);
|
|
285
312
|
}
|
|
286
|
-
function
|
|
313
|
+
function Ye(e) {
|
|
287
314
|
let t = w.item(e)?.name ?? "", n = document.createElement("vf-window");
|
|
288
|
-
n.heading = t, n.closable = !0, n.movable = !0, n.outlineDrag = !0, n.resizable = !0, n.scrollbars = "both", n.headerHeight =
|
|
315
|
+
n.heading = t, n.closable = !0, n.movable = !0, n.outlineDrag = !0, n.resizable = !0, n.scrollbars = "both", n.headerHeight = Te, n.width = je.width, n.height = je.height;
|
|
289
316
|
let r = document.createElement("vf-container");
|
|
290
|
-
r.slot = "header", r.toggleAttribute("fill-width", !0), r.height =
|
|
317
|
+
r.slot = "header", r.toggleAttribute("fill-width", !0), r.height = Ee, r.rule = "bottom";
|
|
291
318
|
let i = document.createElement("vf-label");
|
|
292
|
-
i.face = "body", i.dataset.count = "", i.left =
|
|
319
|
+
i.face = "body", i.dataset.count = "", i.left = v.left, i.top = v.top, r.append(i);
|
|
293
320
|
let a = document.createElement("vf-icon-field");
|
|
294
321
|
return a.label = t, a.left = 0, a.top = 0, n.append(r, a), n;
|
|
295
322
|
}
|
|
296
|
-
|
|
323
|
+
g.on(S, "vf-resize", (e) => {
|
|
297
324
|
if (!e.detail?.commit || C.appOf(e.target) !== "finder") return;
|
|
298
325
|
let t = C.itemOf(e.target);
|
|
299
|
-
t != null &&
|
|
326
|
+
t != null && Re(t);
|
|
300
327
|
});
|
|
301
|
-
function
|
|
328
|
+
function Xe(e) {
|
|
329
|
+
k("original-missing", { alias: e }, `The alias “${e.name}” could not be opened, because the original item could not be found.`);
|
|
330
|
+
}
|
|
331
|
+
function Ze(e, t) {
|
|
302
332
|
let n = w.item(e);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
333
|
+
if (!n) return;
|
|
334
|
+
let r = oe(w.get(), e);
|
|
335
|
+
if (!r) {
|
|
336
|
+
Xe(n);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
ie(r.kind) ? C.open({
|
|
340
|
+
app: _,
|
|
341
|
+
item: r.id,
|
|
306
342
|
from: t,
|
|
307
|
-
create: () =>
|
|
308
|
-
}) :
|
|
343
|
+
create: () => Ye(r.id)
|
|
344
|
+
}) : g.kind(r.kind)?.open(r, t);
|
|
309
345
|
}
|
|
310
|
-
|
|
346
|
+
g.on(S, "vf-open", (e) => {
|
|
311
347
|
let t = e.target;
|
|
312
|
-
t.localName === "vf-icon" && t.dataset.id != null && (t.selected && J().length > 1 ?
|
|
348
|
+
t.localName === "vf-icon" && t.dataset.id != null && (t.selected && J().length > 1 ? it() : Ze(R(t), t.cellRect()));
|
|
313
349
|
});
|
|
314
|
-
let
|
|
315
|
-
let t = w.get().items.filter((t) => t.kind === "app" &&
|
|
316
|
-
return t.find((e) =>
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
let n =
|
|
350
|
+
let Qe = (e) => {
|
|
351
|
+
let t = w.get().items.filter((t) => t.kind === "app" && d(t) === e);
|
|
352
|
+
return t.find((e) => z(e.id)) ?? t[0] ?? null;
|
|
353
|
+
}, $e = (e, t) => w.item(e) ?? (t == null ? null : Qe(t));
|
|
354
|
+
g.onDispose(C.setHome((e, t) => {
|
|
355
|
+
let n = $e(e, t);
|
|
320
356
|
if (!n) return null;
|
|
321
|
-
let r =
|
|
357
|
+
let r = z(n.id)?.cellRect();
|
|
322
358
|
if (r) return r;
|
|
323
|
-
for (let e of
|
|
324
|
-
let t =
|
|
359
|
+
for (let e of re(w.get(), n.parent)) {
|
|
360
|
+
let t = z(e)?.cellRect();
|
|
325
361
|
if (t) return t;
|
|
326
362
|
}
|
|
327
363
|
return null;
|
|
328
364
|
}, (e, t) => {
|
|
329
|
-
let n = e == null && t == null ? null :
|
|
365
|
+
let n = e == null && t == null ? null : $e(e, t), r = I(M), i = n ? z(n.id) : r.find((e) => e.selected) ?? r[0] ?? null;
|
|
330
366
|
return i?.checkVisibility() ? (i.focus({ preventScroll: !0 }), !0) : !1;
|
|
331
|
-
})),
|
|
332
|
-
let
|
|
367
|
+
})), g.on(M, "pointerdown", () => S.clearActive());
|
|
368
|
+
let et = (e) => {
|
|
333
369
|
let t = e.target;
|
|
334
370
|
return t.localName === "vf-icon" && t.dataset.id != null;
|
|
335
371
|
};
|
|
336
|
-
|
|
337
|
-
if (!
|
|
372
|
+
g.on(S, "vf-change", (e) => {
|
|
373
|
+
if (!et(e)) return;
|
|
338
374
|
let t = e.target, { label: n, previous: r } = e.detail;
|
|
339
|
-
w.rename(
|
|
375
|
+
w.rename(R(t), n).catch(() => {
|
|
340
376
|
t.label = r;
|
|
341
377
|
});
|
|
342
378
|
});
|
|
343
|
-
let
|
|
344
|
-
|
|
345
|
-
if (!
|
|
346
|
-
|
|
379
|
+
let tt = !1;
|
|
380
|
+
g.on(S, "vf-name-too-long", (e) => {
|
|
381
|
+
if (!et(e) || tt) return;
|
|
382
|
+
tt = !0;
|
|
347
383
|
let { limit: t } = e.detail;
|
|
348
|
-
|
|
349
|
-
|
|
384
|
+
k("name-too-long", { limit: t }, `That name is too long. A name can have up to ${t} characters.`).finally(() => {
|
|
385
|
+
tt = !1;
|
|
350
386
|
});
|
|
351
|
-
}),
|
|
352
|
-
|
|
353
|
-
}),
|
|
387
|
+
}), g.on(S, "vf-name-rejected", (e) => {
|
|
388
|
+
et(e) && k("name-rejected", {}, "An item needs a name.");
|
|
389
|
+
}), g.onDispose(be(S, {
|
|
354
390
|
folderOfWindow: (e) => C.appOf(e) === "finder" ? C.itemOf(e) ?? void 0 : void 0,
|
|
355
391
|
folderOfIcon: (e) => e.dataset.folder,
|
|
356
|
-
containerOf: (e) => e.dataset.id == null ? void 0 :
|
|
392
|
+
containerOf: (e) => e.dataset.id == null ? void 0 : Ie(e),
|
|
357
393
|
canFile: (e, t) => {
|
|
358
|
-
let n = w.get();
|
|
359
|
-
return e.every((e) => {
|
|
360
|
-
let
|
|
361
|
-
return
|
|
394
|
+
let n = w.get(), r = t == null ? null : f(n, t);
|
|
395
|
+
return t != null && !r ? !1 : e.every((e) => {
|
|
396
|
+
let t = e.dataset.id;
|
|
397
|
+
return t == null || p(t) ? !1 : !r || "missing" in r || t !== r.folder && !ae(n, r.folder, t);
|
|
362
398
|
});
|
|
363
399
|
},
|
|
364
400
|
file: (e, t, n) => {
|
|
365
|
-
let r =
|
|
366
|
-
|
|
367
|
-
|
|
401
|
+
let r = null;
|
|
402
|
+
if (t != null) {
|
|
403
|
+
let e = f(w.get(), t);
|
|
404
|
+
if (!e) return;
|
|
405
|
+
if ("missing" in e) return Xe(e.missing);
|
|
406
|
+
r = e.folder;
|
|
407
|
+
}
|
|
408
|
+
let i = new Map([...n].map(([e, t]) => [R(e), t]));
|
|
409
|
+
w.move(e.map(R), r, i).catch((e) => {
|
|
410
|
+
k("move-failed", { error: e }, `The items couldn’t be moved: ${e.message}.`);
|
|
368
411
|
});
|
|
369
412
|
}
|
|
370
413
|
}));
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
|
|
414
|
+
let nt = /* @__PURE__ */ new WeakMap(), q = 0;
|
|
415
|
+
g.onDispose(C.onRaster((t, n) => {
|
|
416
|
+
M.dragIcons([]);
|
|
374
417
|
let r = {
|
|
375
418
|
width: E,
|
|
376
419
|
height: E
|
|
377
|
-
},
|
|
378
|
-
for (let
|
|
420
|
+
}, i = pe(S.workArea.top);
|
|
421
|
+
for (let a of I(M)) {
|
|
379
422
|
let o = {
|
|
380
|
-
...
|
|
423
|
+
...B(a),
|
|
381
424
|
...r
|
|
382
|
-
}, s =
|
|
383
|
-
|
|
425
|
+
}, s = nt.get(a), c = !s || s.left !== o.left || s.top !== o.top ? ge(o, t, i) : s.pin, l = _e(c, n, i, { size: r });
|
|
426
|
+
a.left = e(l.left, a), a.top = e(l.top, a), nt.set(a, {
|
|
384
427
|
pin: c,
|
|
385
|
-
left:
|
|
386
|
-
top:
|
|
428
|
+
left: a.left,
|
|
429
|
+
top: a.top
|
|
387
430
|
});
|
|
388
431
|
}
|
|
389
|
-
|
|
390
|
-
q = 0,
|
|
391
|
-
...
|
|
432
|
+
a.cleanUpAfterResize && (window.clearTimeout(q), q = window.setTimeout(() => {
|
|
433
|
+
q = 0, ce(I(M).map((e) => ({
|
|
434
|
+
...B(e),
|
|
392
435
|
...r
|
|
393
|
-
}))).size &&
|
|
394
|
-
},
|
|
395
|
-
})),
|
|
436
|
+
}))).size && rt(null);
|
|
437
|
+
}, Ce));
|
|
438
|
+
})), g.onDispose(() => window.clearTimeout(q));
|
|
396
439
|
let J = () => {
|
|
397
|
-
let e = new Set(
|
|
440
|
+
let e = new Set(L().filter((e) => e.selected).map(R));
|
|
398
441
|
return w.get().items.filter((t) => e.has(t.id));
|
|
399
442
|
}, Y = (e) => {
|
|
400
443
|
let t = new Set(e);
|
|
401
|
-
for (let e of
|
|
444
|
+
for (let e of L()) e.setSelected(t.has(R(e)));
|
|
402
445
|
}, X = () => {
|
|
403
|
-
let e =
|
|
446
|
+
let e = S.activeWindow;
|
|
404
447
|
return e && C.appOf(e) === "finder" ? C.itemOf(e) : null;
|
|
405
448
|
};
|
|
406
|
-
async function
|
|
407
|
-
let t =
|
|
449
|
+
async function rt(e) {
|
|
450
|
+
let t = F(e);
|
|
408
451
|
if (!t) return;
|
|
409
|
-
let n =
|
|
452
|
+
let n = V(e), r = I(t), i = se(n, r.map(B)), a = r.map((e, t) => ({
|
|
410
453
|
icon: e,
|
|
411
454
|
...i[t]
|
|
412
|
-
})).sort((e, t) =>
|
|
455
|
+
})).sort((e, t) => de(n, e, t));
|
|
413
456
|
await t.dragIcons(a);
|
|
414
457
|
}
|
|
415
|
-
async function
|
|
416
|
-
let e = n() ? 0 :
|
|
417
|
-
for (let [t, n] of J().entries()) t && e && await new Promise((t) => setTimeout(t, e)),
|
|
458
|
+
async function it() {
|
|
459
|
+
let e = n() ? 0 : Se;
|
|
460
|
+
for (let [t, n] of J().entries()) t && e && await new Promise((t) => setTimeout(t, e)), Ze(n.id, z(n.id)?.cellRect() ?? null);
|
|
418
461
|
}
|
|
419
|
-
async function
|
|
420
|
-
let t =
|
|
462
|
+
async function at(e) {
|
|
463
|
+
let t = z(e);
|
|
421
464
|
t && (Y([e]), await t.updateComplete, t.startEditing());
|
|
422
465
|
}
|
|
423
|
-
let Z = () => w.get().available ? !0 : (
|
|
424
|
-
async function
|
|
466
|
+
let Z = () => w.get().available ? !0 : (k("storage-unavailable", {}, "Files can’t be saved in this browser session. A private window, perhaps.", { label: "Storage Unavailable" }), !1);
|
|
467
|
+
async function ot() {
|
|
425
468
|
if (!Z()) return;
|
|
426
|
-
let e = await w.create({ parent: X() }).catch(
|
|
427
|
-
e && await
|
|
469
|
+
let e = await w.create({ parent: X() }).catch(A("new-folder"));
|
|
470
|
+
e && await at(e.id);
|
|
471
|
+
}
|
|
472
|
+
let st = (e) => ee(w.get(), e.id);
|
|
473
|
+
async function ct() {
|
|
474
|
+
if (!Z()) return;
|
|
475
|
+
let e = /* @__PURE__ */ new Map(), t = [];
|
|
476
|
+
try {
|
|
477
|
+
for (let n of J().filter(st)) {
|
|
478
|
+
let r = w.get(), a = oe(r, n.id), o = ne(r, n.parent), s = z(n.id), c = F(o), l;
|
|
479
|
+
if (s && c) {
|
|
480
|
+
let t = e.get(o) ?? I(c).map(B);
|
|
481
|
+
l = me(V(o), B(s), t, o == null ? E : D), e.set(o, [...t, l]);
|
|
482
|
+
}
|
|
483
|
+
let d = await w.create({
|
|
484
|
+
kind: i,
|
|
485
|
+
name: u(r, o, n.name),
|
|
486
|
+
parent: o,
|
|
487
|
+
data: {
|
|
488
|
+
original: a.id,
|
|
489
|
+
kind: a.kind
|
|
490
|
+
},
|
|
491
|
+
...l
|
|
492
|
+
});
|
|
493
|
+
d && t.push(d.id);
|
|
494
|
+
}
|
|
495
|
+
} catch (e) {
|
|
496
|
+
A("make-alias")(e);
|
|
497
|
+
}
|
|
498
|
+
t.length && Y(t);
|
|
428
499
|
}
|
|
429
|
-
async function
|
|
430
|
-
let e =
|
|
431
|
-
if (!
|
|
500
|
+
async function lt() {
|
|
501
|
+
let e = h(w.get(), l);
|
|
502
|
+
if (!o || !e) return;
|
|
432
503
|
let t = w.trashSize(), n = Math.ceil(t / 1024), r = e === 1 ? `The Trash contains 1 item, which uses ${n}K of disk space. Are you sure you want to permanently remove it?` : `The Trash contains ${e} items, which use ${n}K of disk space. Are you sure you want to permanently remove these items?`;
|
|
433
|
-
await
|
|
504
|
+
await k("empty-trash", {
|
|
434
505
|
count: e,
|
|
435
506
|
bytes: t
|
|
436
507
|
}, r, {
|
|
@@ -443,23 +514,23 @@ function x(i) {
|
|
|
443
514
|
value: "ok",
|
|
444
515
|
default: !0
|
|
445
516
|
}]
|
|
446
|
-
}) === "ok" && await w.emptyTrash().catch(
|
|
517
|
+
}) === "ok" && await w.emptyTrash().catch(A("empty-trash"));
|
|
447
518
|
}
|
|
448
519
|
let Q = {
|
|
449
520
|
ids: [],
|
|
450
521
|
text: ""
|
|
451
|
-
},
|
|
452
|
-
async function
|
|
453
|
-
let e = J().filter((e) => !
|
|
522
|
+
}, ut = (e) => e.replace(/\r\n?/g, "\n").trimEnd();
|
|
523
|
+
async function dt() {
|
|
524
|
+
let e = J().filter((e) => !p(e.id));
|
|
454
525
|
if (!e.length) return;
|
|
455
526
|
let t = e.map((e) => e.name).join("\n");
|
|
456
527
|
Q = {
|
|
457
528
|
ids: e.map((e) => e.id),
|
|
458
529
|
text: t
|
|
459
530
|
};
|
|
460
|
-
let n = e.find((e) =>
|
|
531
|
+
let n = e.find((e) => g.kind(e.kind)?.export);
|
|
461
532
|
try {
|
|
462
|
-
let e = n ? await
|
|
533
|
+
let e = n ? await g.kind(n.kind).export(n) : null;
|
|
463
534
|
if (e?.type && e.type !== "text/plain" && typeof ClipboardItem < "u") {
|
|
464
535
|
await navigator.clipboard.write([new ClipboardItem({
|
|
465
536
|
"text/plain": new Blob([t], { type: "text/plain" }),
|
|
@@ -472,12 +543,12 @@ function x(i) {
|
|
|
472
543
|
await navigator.clipboard?.writeText(t);
|
|
473
544
|
} catch {}
|
|
474
545
|
}
|
|
475
|
-
async function
|
|
476
|
-
for (let n of
|
|
546
|
+
async function ft(e, t) {
|
|
547
|
+
for (let n of g.kinds.values()) if (n.claim && await n.claim(e, t)) return !0;
|
|
477
548
|
return !1;
|
|
478
549
|
}
|
|
479
|
-
let
|
|
480
|
-
async function
|
|
550
|
+
let pt = () => [...g.kinds.values()].some((e) => e.claim);
|
|
551
|
+
async function mt() {
|
|
481
552
|
try {
|
|
482
553
|
if (navigator.clipboard?.read) {
|
|
483
554
|
let e = null, t = [];
|
|
@@ -497,108 +568,109 @@ function x(i) {
|
|
|
497
568
|
} catch {}
|
|
498
569
|
return null;
|
|
499
570
|
}
|
|
500
|
-
async function
|
|
571
|
+
async function ht(e) {
|
|
501
572
|
if (!Z()) return;
|
|
502
573
|
let t = X();
|
|
503
|
-
if (
|
|
504
|
-
let n = e === void 0 ? await
|
|
574
|
+
if (m(w.get(), t)) return;
|
|
575
|
+
let n = e === void 0 ? await mt() : e, r = Q.ids.length > 0 && (n == null || n.text != null && ut(n.text) === ut(Q.text));
|
|
505
576
|
try {
|
|
506
577
|
if (r) {
|
|
507
578
|
let e = await w.copy(Q.ids, t);
|
|
508
579
|
e.length && Y(e.map((e) => e.id));
|
|
509
|
-
} else for (let e of n?.files ?? []) await
|
|
580
|
+
} else for (let e of n?.files ?? []) await ft(e, t);
|
|
510
581
|
} catch (e) {
|
|
511
|
-
|
|
582
|
+
A("paste")(e);
|
|
512
583
|
}
|
|
513
584
|
}
|
|
514
|
-
|
|
515
|
-
if (!
|
|
585
|
+
g.on(document, "paste", (e) => {
|
|
586
|
+
if (!s("paste") || C.front !== "finder" || g.modalOpen() || g.typing()) return;
|
|
516
587
|
let t = e.clipboardData;
|
|
517
|
-
t && (e.preventDefault(),
|
|
588
|
+
t && (e.preventDefault(), ht({
|
|
518
589
|
text: t.getData("text/plain") || null,
|
|
519
590
|
files: [...t.files]
|
|
520
591
|
}));
|
|
521
592
|
});
|
|
522
|
-
let
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}),
|
|
526
|
-
if (!
|
|
593
|
+
let gt = (e) => [...e.dataTransfer?.types ?? []].includes("Files");
|
|
594
|
+
g.on(S, "dragover", (e) => {
|
|
595
|
+
gt(e) && pt() && e.preventDefault();
|
|
596
|
+
}), g.on(S, "drop", (e) => {
|
|
597
|
+
if (!gt(e) || !pt()) return;
|
|
527
598
|
e.preventDefault();
|
|
528
599
|
let t = e, n = [...t.dataTransfer?.files ?? []], r = document.elementsFromPoint(t.clientX, t.clientY).find((e) => e.localName === "vf-window");
|
|
529
|
-
if (r && C.appOf(r) !== "finder" || (r ?
|
|
600
|
+
if (r && C.appOf(r) !== "finder" || (r ? S.bringToFront(r) : S.clearActive(), !Z())) return;
|
|
530
601
|
let i = r ? C.itemOf(r) : null;
|
|
531
|
-
|
|
532
|
-
for (let e of n) await
|
|
533
|
-
})().catch(
|
|
602
|
+
m(w.get(), i) || (async () => {
|
|
603
|
+
for (let e of n) await ft(e, i);
|
|
604
|
+
})().catch(A("add-file"));
|
|
534
605
|
});
|
|
535
|
-
let
|
|
536
|
-
open: () => void
|
|
537
|
-
"new-folder": () => void
|
|
606
|
+
let _t = {
|
|
607
|
+
open: () => void it(),
|
|
608
|
+
"new-folder": () => void ot(),
|
|
538
609
|
close: () => {
|
|
539
610
|
let e = X(), t = e == null ? null : C.windowFor(e);
|
|
540
611
|
t && C.requestClose(t);
|
|
541
612
|
},
|
|
542
|
-
|
|
543
|
-
|
|
613
|
+
"make-alias": () => void ct(),
|
|
614
|
+
copy: () => void dt(),
|
|
615
|
+
paste: () => void ht(),
|
|
544
616
|
"select-all": () => {
|
|
545
|
-
let e =
|
|
546
|
-
e && Y(
|
|
617
|
+
let e = F(X());
|
|
618
|
+
e && Y(I(e).map(R));
|
|
547
619
|
},
|
|
548
620
|
arrange: () => C.arrange(),
|
|
549
|
-
"clean-up": () => void
|
|
550
|
-
"empty-trash": () => void
|
|
621
|
+
"clean-up": () => void rt(X()),
|
|
622
|
+
"empty-trash": () => void lt()
|
|
551
623
|
}, $ = (e, t) => {
|
|
552
|
-
|
|
624
|
+
s(e) && g.gate(g.item(e), t);
|
|
553
625
|
};
|
|
554
|
-
if ($("open", () => !
|
|
555
|
-
let e =
|
|
556
|
-
|
|
626
|
+
if ($("open", () => !g.typing() && J().length > 0), $("new-folder", () => !m(w.get(), X())), $("close", () => X() != null), $("make-alias", () => !g.typing() && J().some(st)), $("copy", () => !g.typing() && J().some((e) => !p(e.id))), $("paste", () => !g.typing() && !m(w.get(), X())), $("select-all", () => !g.typing()), $("arrange", () => !C.arranged()), $("empty-trash", () => h(w.get(), l) > 0), s("clean-up")) {
|
|
627
|
+
let e = g.item("clean-up");
|
|
628
|
+
g.gate(e, () => {
|
|
557
629
|
let t = X() == null ? "Clean Up Desktop" : "Clean Up Window";
|
|
558
630
|
return e.textContent !== t && (e.textContent = t), !0;
|
|
559
631
|
});
|
|
560
632
|
}
|
|
561
|
-
let
|
|
562
|
-
let t =
|
|
633
|
+
let vt = !0, yt = (e) => {
|
|
634
|
+
let t = g.menus.find((t) => t.dataset.menu === e);
|
|
563
635
|
if (t) return t;
|
|
564
|
-
if (!
|
|
636
|
+
if (!vt) throw Error(`vintage-frames/shell (finder): no ${e} menu; add to it from extend`);
|
|
565
637
|
let n = document.createElement("vf-menu");
|
|
566
|
-
n.dataset.menu = e, n.label =
|
|
567
|
-
let r =
|
|
568
|
-
return
|
|
569
|
-
},
|
|
638
|
+
n.dataset.menu = e, n.label = x.find((t) => t.menu === e).label;
|
|
639
|
+
let r = x.map((e) => e.menu), i = g.menus.findIndex((t) => r.indexOf(t.dataset.menu) > r.indexOf(e));
|
|
640
|
+
return g.menus.splice(i < 0 ? g.menus.length : i, 0, n), n;
|
|
641
|
+
}, bt = {
|
|
570
642
|
catalog: w,
|
|
571
643
|
selection: J,
|
|
572
644
|
select: Y,
|
|
573
645
|
activeFolder: X,
|
|
574
646
|
open: ({ item: e, from: t = null } = {}) => {
|
|
575
|
-
e != null &&
|
|
647
|
+
e != null && Ze(e, t);
|
|
576
648
|
},
|
|
577
|
-
rename:
|
|
578
|
-
cleanUp:
|
|
579
|
-
iconFor:
|
|
649
|
+
rename: at,
|
|
650
|
+
cleanUp: rt,
|
|
651
|
+
iconFor: z,
|
|
580
652
|
addCommand(e) {
|
|
581
|
-
let t =
|
|
653
|
+
let t = yt(e.menu);
|
|
582
654
|
e.separator && t.append(document.createElement("vf-separator"));
|
|
583
655
|
let n = document.createElement("vf-menu-item");
|
|
584
|
-
return n.setAttribute("value", e.value), e.shortcut && n.setAttribute("shortcut", e.shortcut), n.textContent = e.label, t.append(n),
|
|
656
|
+
return n.setAttribute("value", e.value), e.shortcut && n.setAttribute("shortcut", e.shortcut), n.textContent = e.label, t.append(n), _t[e.value] = e.run, e.enabled && g.gate(n, e.enabled), n;
|
|
585
657
|
},
|
|
586
658
|
alertWith(e, t) {
|
|
587
|
-
|
|
659
|
+
Me.set(e, t);
|
|
588
660
|
},
|
|
589
661
|
storageReady: Z
|
|
590
662
|
};
|
|
591
|
-
|
|
592
|
-
let
|
|
593
|
-
return
|
|
594
|
-
|
|
595
|
-
for (let e of
|
|
596
|
-
|
|
597
|
-
}),
|
|
598
|
-
|
|
599
|
-
}),
|
|
663
|
+
a.extend?.(bt, g), vt = !1, g.onMenu((e) => _t[e]?.());
|
|
664
|
+
let xt = !1;
|
|
665
|
+
return g.onDispose(() => {
|
|
666
|
+
xt = !0;
|
|
667
|
+
for (let e of I(M)) e.remove();
|
|
668
|
+
Ne ? M.remove() : M.append(...Pe);
|
|
669
|
+
}), ye(S).then(() => {
|
|
670
|
+
xt || (Ge = !0, G());
|
|
671
|
+
}), bt;
|
|
600
672
|
}
|
|
601
673
|
});
|
|
602
674
|
}
|
|
603
675
|
//#endregion
|
|
604
|
-
export {
|
|
676
|
+
export { _ as FINDER, w as finder };
|