vintage-frames 0.18.0 → 0.19.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 +1 -1
- package/custom-elements.json +39 -0
- 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/index.d.ts +1 -0
- package/dist/index.js +15 -14
- package/dist/shell/app-file.d.ts +20 -4
- package/dist/shell/app-file.js +65 -53
- package/dist/shell/catalog.d.ts +41 -1
- package/dist/shell/catalog.js +174 -153
- package/dist/shell/finder.d.ts +27 -9
- package/dist/shell/finder.js +335 -277
- 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 +143 -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 +1 -1
- package/editor/vscode.html-custom-data.json +5 -0
- package/editor/web-types.json +11 -1
- package/package.json +7 -3
package/dist/shell/catalog.js
CHANGED
|
@@ -1,289 +1,310 @@
|
|
|
1
1
|
//#region src/shell/catalog.ts
|
|
2
|
-
var e = "trash", t = "disk", n = "folder", r = "
|
|
3
|
-
function
|
|
2
|
+
var e = "trash", t = "disk", n = "system-folder", r = "apple-menu-items", i = "startup-items", a = "folder", o = "app", s = "alias", c = "untitled folder", l = "#seeded", u = (e) => e === "folder" || e === "trash" || e === "disk", d = (e) => e === "trash" || e === "disk", f = (e) => d(e) || e === "system-folder" || e === "apple-menu-items" || e === "startup-items";
|
|
3
|
+
function p(e) {
|
|
4
4
|
let t = e.data;
|
|
5
5
|
return typeof t?.app == "string" ? t.app : null;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function m(e) {
|
|
8
|
+
if (e.kind !== "alias") return null;
|
|
9
|
+
let t = e.data;
|
|
10
|
+
return typeof t?.original == "string" ? t.original : null;
|
|
11
|
+
}
|
|
12
|
+
function h(e, t) {
|
|
8
13
|
return t == null ? null : e.items.find((e) => e.id === t) ?? null;
|
|
9
14
|
}
|
|
10
|
-
function
|
|
11
|
-
let n =
|
|
12
|
-
|
|
15
|
+
function g(e, t) {
|
|
16
|
+
let n = /* @__PURE__ */ new Set(), r = h(e, t);
|
|
17
|
+
for (; r?.kind === s;) {
|
|
18
|
+
if (n.has(r.id)) return null;
|
|
19
|
+
n.add(r.id), r = h(e, m(r));
|
|
20
|
+
}
|
|
21
|
+
return r;
|
|
13
22
|
}
|
|
14
|
-
function
|
|
15
|
-
let n =
|
|
16
|
-
return
|
|
23
|
+
function _(e, t) {
|
|
24
|
+
let n = h(e, t);
|
|
25
|
+
return n && u(n.kind) ? n.id : null;
|
|
17
26
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
27
|
+
function v(e, t) {
|
|
28
|
+
let n = _(e, t);
|
|
29
|
+
return e.items.filter((t) => t.id !== n && _(e, t.parent) === n);
|
|
20
30
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
function y(e, t) {
|
|
32
|
+
return v(e, t).length;
|
|
33
|
+
}
|
|
34
|
+
var b = (e, t) => _(e, h(e, t)?.parent ?? null);
|
|
35
|
+
function x(e, t, n) {
|
|
36
|
+
let r = /* @__PURE__ */ new Set(), i = b(e, t);
|
|
24
37
|
for (; i != null && !r.has(i);) {
|
|
25
38
|
if (i === n) return !0;
|
|
26
|
-
r.add(i), i =
|
|
39
|
+
r.add(i), i = b(e, i);
|
|
27
40
|
}
|
|
28
41
|
return !1;
|
|
29
42
|
}
|
|
30
|
-
function
|
|
31
|
-
let n = [], r = /* @__PURE__ */ new Set(), i =
|
|
32
|
-
for (; i != null && !r.has(i);) n.push(i), r.add(i), i =
|
|
43
|
+
function S(e, t) {
|
|
44
|
+
let n = [], r = /* @__PURE__ */ new Set(), i = _(e, t ?? null);
|
|
45
|
+
for (; i != null && !r.has(i);) n.push(i), r.add(i), i = b(e, i);
|
|
33
46
|
return n;
|
|
34
47
|
}
|
|
35
|
-
function
|
|
36
|
-
return t == null ? !1 : t === "trash" ||
|
|
48
|
+
function C(e, t) {
|
|
49
|
+
return t == null ? !1 : t === "trash" || x(e, t, "trash");
|
|
37
50
|
}
|
|
38
|
-
function
|
|
51
|
+
function w(e, t) {
|
|
39
52
|
let n = [], r = /* @__PURE__ */ new Set(), i = (t) => {
|
|
40
|
-
for (let a of
|
|
53
|
+
for (let a of v(e, t)) r.has(a.id) || (r.add(a.id), n.push(a), u(a.kind) && i(a.id));
|
|
41
54
|
};
|
|
42
|
-
return i(
|
|
55
|
+
return i(_(e, t)), n;
|
|
43
56
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
if (!
|
|
57
|
+
function T(e, t) {
|
|
58
|
+
let n = new Set(v(e, t).filter((e) => e.kind === a).map((e) => e.name));
|
|
59
|
+
if (!n.has("untitled folder")) return c;
|
|
47
60
|
for (let e = 2;; e++) {
|
|
48
|
-
let t = `${
|
|
49
|
-
if (!
|
|
61
|
+
let t = `${c} ${e}`;
|
|
62
|
+
if (!n.has(t)) return t;
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
|
-
var
|
|
53
|
-
function
|
|
54
|
-
let i = new Set(
|
|
65
|
+
var E = (e) => e.replace(/ copy( \d+)?$/, "");
|
|
66
|
+
function D(e, t, n, r) {
|
|
67
|
+
let i = new Set(v(e, t).filter((e) => e.kind === r).map((e) => e.name));
|
|
55
68
|
if (!i.has(n)) return n;
|
|
56
|
-
let a =
|
|
69
|
+
let a = E(n);
|
|
57
70
|
if (!i.has(`${a} copy`)) return `${a} copy`;
|
|
58
71
|
for (let e = 2;; e++) {
|
|
59
72
|
let t = `${a} copy ${e}`;
|
|
60
73
|
if (!i.has(t)) return t;
|
|
61
74
|
}
|
|
62
75
|
}
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
function O(e, t, n) {
|
|
77
|
+
let r = new Set(v(e, t).filter((e) => e.kind === s).map((e) => e.name)), i = `${n} alias`;
|
|
78
|
+
if (!r.has(i)) return i;
|
|
79
|
+
for (let e = 2;; e++) {
|
|
80
|
+
let t = `${i} ${e}`;
|
|
81
|
+
if (!r.has(t)) return t;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
var k = new Intl.Collator("en");
|
|
85
|
+
function A(e, t) {
|
|
86
|
+
return h(e, t) ? v(e, t).sort((e, t) => k.compare(e.name, t.name) || N(e, t)) : [];
|
|
87
|
+
}
|
|
88
|
+
var j = (e) => A(e, r), M = (e) => A(e, i), N = (e, t) => e.createdAt - t.createdAt || (e.id < t.id ? -1 : 1);
|
|
89
|
+
function P(e, t) {
|
|
65
90
|
let n = { ...e };
|
|
66
91
|
return t ? (n.left = t.left, n.top = t.top) : (delete n.left, delete n.top), n;
|
|
67
92
|
}
|
|
68
|
-
function
|
|
69
|
-
let { storage:
|
|
70
|
-
i.disk && y.push({
|
|
71
|
-
id: t,
|
|
72
|
-
name: i.disk,
|
|
73
|
-
kind: t,
|
|
74
|
-
parent: null,
|
|
75
|
-
createdAt: 0,
|
|
76
|
-
modifiedAt: 0
|
|
77
|
-
}), i.trash !== !1 && y.push({
|
|
93
|
+
function F(o) {
|
|
94
|
+
let { storage: s, volumes: c = {}, system: d, listed: p = () => !0, hooks: g = () => void 0, placeDelay: v = 400 } = o, y = () => (o.now ?? Date.now)(), b = () => o.newId ? o.newId() : crypto.randomUUID(), S = [], E = (e, t, n, r) => S.push({
|
|
78
95
|
id: e,
|
|
79
|
-
name:
|
|
80
|
-
kind:
|
|
81
|
-
parent:
|
|
96
|
+
name: t,
|
|
97
|
+
kind: n,
|
|
98
|
+
parent: r,
|
|
82
99
|
createdAt: 0,
|
|
83
100
|
modifiedAt: 0
|
|
84
101
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
c.disk && E(t, c.disk, t, null), c.trash !== !1 && E(e, c.trash ?? "Trash", e, null), d && (E(n, d.folder, a, c.disk ? t : null), E(r, d.appleMenu, a, n), E(i, d.startup, a, n));
|
|
103
|
+
let O = /* @__PURE__ */ new Map(), k = !1, A = !1, j = F(), M = /* @__PURE__ */ new Set();
|
|
104
|
+
function F() {
|
|
105
|
+
let e = S.map((e) => {
|
|
106
|
+
let t = O.get(e.id);
|
|
89
107
|
return t?.left != null && t.top != null ? {
|
|
90
108
|
...e,
|
|
91
109
|
left: t.left,
|
|
92
110
|
top: t.top
|
|
93
111
|
} : e;
|
|
94
|
-
}), t = [...
|
|
112
|
+
}), t = [...O.values()].filter((e) => !f(e.id) && (e.kind === "folder" || p(e.kind))).sort(N);
|
|
95
113
|
return {
|
|
96
|
-
available:
|
|
114
|
+
available: k,
|
|
97
115
|
items: [...e, ...t]
|
|
98
116
|
};
|
|
99
117
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
for (let e of [...
|
|
118
|
+
function I() {
|
|
119
|
+
j = F();
|
|
120
|
+
for (let e of [...M]) e(j);
|
|
103
121
|
}
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
106
|
-
return
|
|
122
|
+
let L = () => {
|
|
123
|
+
if (!s) throw Error("storage is unavailable");
|
|
124
|
+
return s;
|
|
107
125
|
};
|
|
108
|
-
async function
|
|
109
|
-
await
|
|
126
|
+
async function R(e) {
|
|
127
|
+
await L().put(e), O.set(e.id, e);
|
|
110
128
|
}
|
|
111
|
-
let
|
|
112
|
-
async function
|
|
113
|
-
|
|
114
|
-
let e = [...
|
|
115
|
-
if (
|
|
116
|
-
let e =
|
|
117
|
-
e && await
|
|
129
|
+
let z = /* @__PURE__ */ new Set(), B = null;
|
|
130
|
+
async function V() {
|
|
131
|
+
B && clearTimeout(B), B = null;
|
|
132
|
+
let e = [...z];
|
|
133
|
+
if (z.clear(), !(!s || !k)) for (let t of e) {
|
|
134
|
+
let e = O.get(t);
|
|
135
|
+
e && await s.put(e).catch(() => {});
|
|
118
136
|
}
|
|
119
137
|
}
|
|
120
|
-
let
|
|
121
|
-
let t =
|
|
122
|
-
return
|
|
138
|
+
let H = (e) => {
|
|
139
|
+
let t = S.find((t) => t.id === e);
|
|
140
|
+
return O.get(e) ?? {
|
|
123
141
|
...t,
|
|
124
142
|
name: ""
|
|
125
143
|
};
|
|
126
144
|
};
|
|
127
|
-
async function
|
|
128
|
-
|
|
129
|
-
for (let e of await
|
|
130
|
-
|
|
145
|
+
async function U() {
|
|
146
|
+
z.clear();
|
|
147
|
+
for (let e of await L().list()) e.id !== l && (await L().remove(e.id), O.delete(e.id));
|
|
148
|
+
O = /* @__PURE__ */ new Map();
|
|
131
149
|
}
|
|
132
|
-
let
|
|
133
|
-
get: () =>
|
|
150
|
+
let W = {
|
|
151
|
+
get: () => j,
|
|
134
152
|
subscribe(e) {
|
|
135
|
-
return
|
|
136
|
-
|
|
153
|
+
return M.add(e), () => {
|
|
154
|
+
M.delete(e);
|
|
137
155
|
};
|
|
138
156
|
},
|
|
139
|
-
item: (e) =>
|
|
157
|
+
item: (e) => h(j, e),
|
|
140
158
|
async refresh() {
|
|
141
|
-
if (!
|
|
142
|
-
|
|
159
|
+
if (!s) {
|
|
160
|
+
O = /* @__PURE__ */ new Map(), k = !1, I();
|
|
143
161
|
return;
|
|
144
162
|
}
|
|
145
163
|
try {
|
|
146
|
-
let e = await
|
|
147
|
-
|
|
148
|
-
for (let t of e) t.id ===
|
|
149
|
-
|
|
164
|
+
let e = await s.list();
|
|
165
|
+
O = /* @__PURE__ */ new Map(), A = !1;
|
|
166
|
+
for (let t of e) t.id === l ? A = !0 : O.set(t.id, t);
|
|
167
|
+
k = !0;
|
|
150
168
|
} catch (e) {
|
|
151
|
-
console.warn("vintage-frames/shell: the catalog could not be read —", e),
|
|
169
|
+
console.warn("vintage-frames/shell: the catalog could not be read —", e), O = /* @__PURE__ */ new Map(), k = !1;
|
|
152
170
|
}
|
|
153
|
-
|
|
171
|
+
I();
|
|
154
172
|
},
|
|
155
173
|
async seed(e) {
|
|
156
|
-
return !
|
|
157
|
-
id:
|
|
174
|
+
return !s || !k || A ? !1 : (await e(W), await s.put({
|
|
175
|
+
id: l,
|
|
158
176
|
name: "",
|
|
159
|
-
kind:
|
|
177
|
+
kind: l,
|
|
160
178
|
parent: null,
|
|
161
|
-
createdAt:
|
|
162
|
-
modifiedAt:
|
|
163
|
-
}),
|
|
179
|
+
createdAt: y(),
|
|
180
|
+
modifiedAt: y()
|
|
181
|
+
}), A = !0, !0);
|
|
164
182
|
},
|
|
165
183
|
async create(e = {}) {
|
|
166
|
-
let t =
|
|
167
|
-
if (
|
|
168
|
-
let n = e.kind ?? "folder", r = e.at ??
|
|
169
|
-
id:
|
|
170
|
-
name: e.name ?? (n === "folder" ?
|
|
184
|
+
let t = _(j, e.parent ?? null);
|
|
185
|
+
if (C(j, t)) return null;
|
|
186
|
+
let n = e.kind ?? "folder", r = e.at ?? y(), i = {
|
|
187
|
+
id: b(),
|
|
188
|
+
name: e.name ?? (n === "folder" ? T(j, t) : "untitled"),
|
|
171
189
|
kind: n,
|
|
172
190
|
parent: t,
|
|
173
191
|
createdAt: r,
|
|
174
192
|
modifiedAt: r
|
|
175
193
|
};
|
|
176
|
-
return e.data !== void 0 && (i.data = e.data), e.left != null && e.top != null && (i =
|
|
194
|
+
return e.data !== void 0 && (i.data = e.data), e.left != null && e.top != null && (i = P(i, {
|
|
177
195
|
left: e.left,
|
|
178
196
|
top: e.top
|
|
179
|
-
})), await
|
|
197
|
+
})), await R(i), I(), i;
|
|
180
198
|
},
|
|
181
199
|
async rename(e, t) {
|
|
182
|
-
let n =
|
|
183
|
-
return !n ||
|
|
200
|
+
let n = O.get(e);
|
|
201
|
+
return !n || f(e) || n.name === t ? !1 : (await R({
|
|
184
202
|
...n,
|
|
185
203
|
name: t,
|
|
186
|
-
modifiedAt:
|
|
187
|
-
}),
|
|
204
|
+
modifiedAt: y()
|
|
205
|
+
}), I(), !0);
|
|
188
206
|
},
|
|
189
207
|
async update(e, t) {
|
|
190
|
-
let n =
|
|
191
|
-
return !n ||
|
|
208
|
+
let n = O.get(e);
|
|
209
|
+
return !n || f(e) ? !1 : (await R({
|
|
192
210
|
...n,
|
|
193
211
|
data: t,
|
|
194
|
-
modifiedAt:
|
|
195
|
-
}),
|
|
212
|
+
modifiedAt: y()
|
|
213
|
+
}), I(), !0);
|
|
196
214
|
},
|
|
197
215
|
async move(e, t, n) {
|
|
198
|
-
let r =
|
|
216
|
+
let r = _(j, t), i = [];
|
|
199
217
|
for (let t of e) {
|
|
200
|
-
let e =
|
|
201
|
-
!e ||
|
|
218
|
+
let e = O.get(t);
|
|
219
|
+
!e || f(t) || r === t || r != null && u(e.kind) && x(j, r, t) || _(j, e.parent) !== r && (z.delete(t), await R(P({
|
|
202
220
|
...e,
|
|
203
221
|
parent: r
|
|
204
222
|
}, n?.get(t) ?? null)), i.push(t));
|
|
205
223
|
}
|
|
206
|
-
return i.length &&
|
|
224
|
+
return i.length && I(), i;
|
|
207
225
|
},
|
|
208
226
|
place(e) {
|
|
209
227
|
let t = !1;
|
|
210
228
|
for (let [n, r] of e) {
|
|
211
|
-
let e =
|
|
212
|
-
!e || e.left === r.left && e.top === r.top || (
|
|
229
|
+
let e = f(n) ? S.some((e) => e.id === n) ? H(n) : null : O.get(n);
|
|
230
|
+
!e || e.left === r.left && e.top === r.top || (O.set(n, P(e, r)), z.add(n), t = !0);
|
|
213
231
|
}
|
|
214
|
-
t && (
|
|
232
|
+
t && (I(), B && clearTimeout(B), B = setTimeout(() => void V(), v));
|
|
215
233
|
},
|
|
216
|
-
flush:
|
|
234
|
+
flush: V,
|
|
217
235
|
async copy(e, t) {
|
|
218
|
-
let n =
|
|
219
|
-
if (
|
|
236
|
+
let n = _(j, t);
|
|
237
|
+
if (C(j, n)) return [];
|
|
220
238
|
let r = [];
|
|
221
239
|
for (let t of e) {
|
|
222
|
-
let e =
|
|
223
|
-
if (!e ||
|
|
224
|
-
let i =
|
|
225
|
-
let r =
|
|
240
|
+
let e = h(j, t);
|
|
241
|
+
if (!e || f(t)) continue;
|
|
242
|
+
let i = u(e.kind) ? w(j, t) : [], a = /* @__PURE__ */ new Map(), o = async (e, t, n) => {
|
|
243
|
+
let r = y(), i = {
|
|
226
244
|
...e,
|
|
227
|
-
id:
|
|
228
|
-
name: n ?
|
|
245
|
+
id: b(),
|
|
246
|
+
name: n ? D(j, t, e.name, e.kind) : e.name,
|
|
229
247
|
parent: t,
|
|
230
248
|
createdAt: r,
|
|
231
249
|
modifiedAt: r
|
|
232
250
|
};
|
|
233
|
-
return n && (i =
|
|
251
|
+
return n && (i = P(i, null)), a.set(e.id, i.id), await R(i), await g(e.kind)?.copy?.(e, i), i;
|
|
234
252
|
};
|
|
235
|
-
r.push(await
|
|
236
|
-
for (let e of i) await
|
|
237
|
-
|
|
253
|
+
r.push(await o(e, n, !0));
|
|
254
|
+
for (let e of i) await o(e, a.get(_(j, e.parent) ?? "") ?? null, !1);
|
|
255
|
+
I();
|
|
238
256
|
}
|
|
239
257
|
return r;
|
|
240
258
|
},
|
|
241
259
|
async emptyTrash() {
|
|
242
|
-
let t =
|
|
243
|
-
for (let e of t) await
|
|
244
|
-
return t.length &&
|
|
260
|
+
let t = w(j, e);
|
|
261
|
+
for (let e of t) await L().remove(e.id), O.delete(e.id), z.delete(e.id), await g(e.kind)?.onRemove?.(e);
|
|
262
|
+
return t.length && I(), t;
|
|
245
263
|
},
|
|
246
264
|
trashSize() {
|
|
247
|
-
return
|
|
265
|
+
return w(j, e).reduce((e, t) => e + (g(t.kind)?.size?.(t) ?? 0), 0);
|
|
248
266
|
},
|
|
249
267
|
dump() {
|
|
250
|
-
return { items: [...
|
|
268
|
+
return { items: [...O.values()] };
|
|
251
269
|
},
|
|
252
270
|
async clear() {
|
|
253
|
-
if (
|
|
254
|
-
await
|
|
271
|
+
if (s) try {
|
|
272
|
+
await U();
|
|
255
273
|
} finally {
|
|
256
|
-
|
|
274
|
+
I();
|
|
257
275
|
}
|
|
258
276
|
},
|
|
259
277
|
async import(e, { mode: t = "merge" } = {}) {
|
|
260
|
-
let n = /* @__PURE__ */ new Map(),
|
|
261
|
-
if (!
|
|
262
|
-
let
|
|
263
|
-
for (let e of
|
|
264
|
-
let
|
|
278
|
+
let n = /* @__PURE__ */ new Map(), r = e.items.filter((e) => e.id !== l && !f(e.id));
|
|
279
|
+
if (!r.length || !s) return n;
|
|
280
|
+
let i = t === "replace", a = /* @__PURE__ */ new Map();
|
|
281
|
+
for (let e of r) a.set(e.id, i ? e.id : b());
|
|
282
|
+
let o = (e) => e == null || f(e) ? e : a.get(e) ?? null;
|
|
265
283
|
try {
|
|
266
|
-
|
|
267
|
-
for (let e of
|
|
284
|
+
i && await U();
|
|
285
|
+
for (let e of r) {
|
|
268
286
|
let t = {
|
|
269
287
|
...e,
|
|
270
|
-
id:
|
|
271
|
-
parent:
|
|
272
|
-
};
|
|
273
|
-
|
|
288
|
+
id: a.get(e.id),
|
|
289
|
+
parent: o(e.parent)
|
|
290
|
+
}, r = m(e);
|
|
291
|
+
r != null && a.has(r) && (t.data = {
|
|
292
|
+
...e.data,
|
|
293
|
+
original: a.get(r)
|
|
294
|
+
}), await R(t), n.set(e.id, t);
|
|
274
295
|
}
|
|
275
296
|
} finally {
|
|
276
|
-
|
|
297
|
+
I();
|
|
277
298
|
}
|
|
278
299
|
return n;
|
|
279
300
|
},
|
|
280
301
|
async dispose() {
|
|
281
|
-
await
|
|
302
|
+
await V(), M.clear();
|
|
282
303
|
}
|
|
283
304
|
};
|
|
284
|
-
return
|
|
305
|
+
return W;
|
|
285
306
|
}
|
|
286
|
-
function
|
|
307
|
+
function I(e = []) {
|
|
287
308
|
let t = new Map(e.map((e) => [e.id, e]));
|
|
288
309
|
return {
|
|
289
310
|
records: t,
|
|
@@ -293,4 +314,4 @@ function w(e = []) {
|
|
|
293
314
|
};
|
|
294
315
|
}
|
|
295
316
|
//#endregion
|
|
296
|
-
export { r as APP_KIND, t as DISK,
|
|
317
|
+
export { s as ALIAS_KIND, r as APPLE_MENU_ITEMS, o as APP_KIND, t as DISK, a as FOLDER, i as STARTUP_ITEMS, n as SYSTEM_FOLDER, e as TRASH, c as UNTITLED_FOLDER, O as aliasName, p as appIdOf, j as appleMenuItemsOf, v as childrenOf, _ as containerOf, D as copyName, F as createCatalog, w as descendantsOf, S as enclosingFolders, u as isContainerKind, x as isInside, f as isKept, C as isTrashed, d as isVolume, y as itemCount, h as itemOf, I as memoryStorage, T as nextFolderName, m as originalOf, g as resolve, M as startupItemsOf };
|
package/dist/shell/finder.d.ts
CHANGED
|
@@ -19,16 +19,19 @@
|
|
|
19
19
|
* around it. An application's icon stands for the application: it is drawn
|
|
20
20
|
* open while the application has a window open, and the application's own
|
|
21
21
|
* windows close into it.
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* - An alias wears its original's art with its name in italics, and opens
|
|
23
|
+
* its original; with the original gone, an alert says so. Make Alias makes
|
|
24
|
+
* one beside each selected application or document.
|
|
25
|
+
* - Menus: File (Open, New Folder, Close, Make Alias), Edit (Copy, Paste,
|
|
26
|
+
* Select All), View (Arrange Windows), Special (Clean Up, Empty Trash…),
|
|
27
|
+
* each disabled while it has nothing to act on. A site switches commands
|
|
28
|
+
* off and adds its own.
|
|
26
29
|
* - Alerts are the Finder's own, composed with the site's caution art and
|
|
27
30
|
* held by it while they are up. A site answers any of them with its own
|
|
28
31
|
* dialog through `alertWith`.
|
|
29
32
|
*/
|
|
30
33
|
import type { VfIcon, VfMenuItem, VfViewportBox } from '../index.js';
|
|
31
|
-
import type { Catalog, CatalogStorage, Item, Volumes } from './catalog.js';
|
|
34
|
+
import type { Catalog, CatalogStorage, Item, SystemFolders, Volumes } from './catalog.js';
|
|
32
35
|
import type { LatticeOptions, Size } from './geometry.js';
|
|
33
36
|
import type { AppContext, AppDefinition } from './shell.js';
|
|
34
37
|
/** The Finder's application id. */
|
|
@@ -44,13 +47,17 @@ export interface FinderArt {
|
|
|
44
47
|
document: string;
|
|
45
48
|
/** The startup disk; the folder's art without it. */
|
|
46
49
|
disk?: string;
|
|
50
|
+
/** The System Folder and its two folders; the folder's art without them. */
|
|
51
|
+
systemFolder?: string;
|
|
52
|
+
appleMenuItems?: string;
|
|
53
|
+
startupItems?: string;
|
|
47
54
|
/** 12×12: the mark before the item count in the Trash's window and trashed folders. */
|
|
48
55
|
trashMark?: string;
|
|
49
56
|
/** 32×32: beside the message in the Finder's alerts. Without it they have no art. */
|
|
50
57
|
caution?: string;
|
|
51
58
|
}
|
|
52
59
|
/** What a failed command was, in the `failed` alert. */
|
|
53
|
-
export type FinderFailedAction = 'new-folder' | 'empty-trash' | 'paste' | 'add-file';
|
|
60
|
+
export type FinderFailedAction = 'new-folder' | 'empty-trash' | 'paste' | 'add-file' | 'make-alias';
|
|
54
61
|
/** The Finder's alerts, by id, with the details each one's handler gets. */
|
|
55
62
|
export interface FinderAlerts {
|
|
56
63
|
/** Special → Empty Trash…: an answer of `'ok'` empties the Trash. */
|
|
@@ -70,7 +77,11 @@ export interface FinderAlerts {
|
|
|
70
77
|
'move-failed': {
|
|
71
78
|
error: Error;
|
|
72
79
|
};
|
|
73
|
-
/**
|
|
80
|
+
/** Opening an alias whose original is gone. */
|
|
81
|
+
'original-missing': {
|
|
82
|
+
alias: Item;
|
|
83
|
+
};
|
|
84
|
+
/** New Folder, Empty Trash, Paste, Make Alias or a dropped file failed. */
|
|
74
85
|
failed: {
|
|
75
86
|
action: FinderFailedAction;
|
|
76
87
|
error: Error;
|
|
@@ -81,7 +92,7 @@ export type FinderAlert = keyof FinderAlerts;
|
|
|
81
92
|
/** Answers one of the Finder's alerts: resolves the answer, or null. */
|
|
82
93
|
export type FinderAlertHandler<K extends FinderAlert> = (details: FinderAlerts[K]) => string | null | Promise<string | null>;
|
|
83
94
|
/** The Finder's own commands, each of which a site can switch off. */
|
|
84
|
-
export type FinderCommand = 'open' | 'new-folder' | 'close' | 'copy' | 'paste' | 'select-all' | 'arrange' | 'clean-up' | 'empty-trash';
|
|
95
|
+
export type FinderCommand = 'open' | 'new-folder' | 'close' | 'make-alias' | 'copy' | 'paste' | 'select-all' | 'arrange' | 'clean-up' | 'empty-trash';
|
|
85
96
|
/** The Finder's menus, by `data-menu`. */
|
|
86
97
|
export type FinderMenu = 'file' | 'edit' | 'view' | 'special';
|
|
87
98
|
/** A command a site adds to the Finder's menus. */
|
|
@@ -135,10 +146,17 @@ export interface FinderOptions {
|
|
|
135
146
|
art: FinderArt;
|
|
136
147
|
/** The volumes: the Trash by default, and a startup disk when named. */
|
|
137
148
|
volumes?: Volumes;
|
|
149
|
+
/**
|
|
150
|
+
* The System Folder and its folders, named: what Apple Menu Items holds is
|
|
151
|
+
* the Apple menu, and what Startup Items holds opens at startup. Unset, none.
|
|
152
|
+
*/
|
|
153
|
+
system?: SystemFolders;
|
|
138
154
|
/**
|
|
139
155
|
* What the catalog starts with, stored once per storage: `'markup'` reads
|
|
140
156
|
* the `<vf-icon data-app>` and `<template data-folder="Name">` the page
|
|
141
|
-
* put in the desktop's field
|
|
157
|
+
* put in the desktop's field, and a `<template data-system="apple-menu-items">`
|
|
158
|
+
* files what it holds in that folder of the System Folder; a function
|
|
159
|
+
* stores the site's defaults.
|
|
142
160
|
*/
|
|
143
161
|
seed?: 'markup' | ((catalog: Catalog) => void | Promise<void>);
|
|
144
162
|
/** The lattices' cells, pitches and insets (default: 64px cells, 80px columns, 72px rows, 16px insets). */
|