vintage-frames 0.16.0 → 0.16.2
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/custom-elements.json +203 -11
- package/dist/components/vf-dialog.d.ts +9 -8
- package/dist/modal-dialog.d.ts +10 -6
- package/dist/modal-dialog.js +10 -10
- package/dist/shell/catalog.d.ts +5 -1
- package/dist/shell/catalog.js +90 -86
- package/dist/shell/finder.js +252 -252
- package/dist/shell/index.d.ts +2 -2
- package/dist/shell/index.js +7 -7
- package/dist/shell/pure.js +4 -4
- package/dist/shell/shell.d.ts +0 -4
- package/dist/shell/shell.js +40 -44
- package/dist/shell/windows.d.ts +16 -10
- package/dist/shell/windows.js +159 -156
- package/dist/text-control.d.ts +23 -3
- package/dist/text-control.js +10 -3
- package/docs/SPEC.md +7 -7
- package/editor/vscode.html-custom-data.json +16 -1
- package/editor/web-types.json +34 -4
- package/package.json +1 -1
package/dist/shell/windows.js
CHANGED
|
@@ -24,38 +24,38 @@ function h() {
|
|
|
24
24
|
var g = (e) => {
|
|
25
25
|
let t = document.activeElement;
|
|
26
26
|
return !!t && (t === e || e.contains(t));
|
|
27
|
-
};
|
|
28
|
-
async function ee(e, { when: t } = {}) {
|
|
29
|
-
let
|
|
30
|
-
if (await Promise.all([e, ...
|
|
31
|
-
let
|
|
32
|
-
if (
|
|
33
|
-
for (let t of
|
|
27
|
+
}, _ = (e) => e.autoselect ?? e.hasAttribute("autoselect");
|
|
28
|
+
async function ee(e, { when: t, select: n = !1 } = {}) {
|
|
29
|
+
let r = [...e.querySelectorAll("*")];
|
|
30
|
+
if (await Promise.all([e, ...r].map((e) => e.updateComplete)), !e.isConnected || t && !t()) return !1;
|
|
31
|
+
let i = (e) => !e.closest("[hidden]") && e.checkVisibility(), a = r.find((e) => (e.hasAttribute("autofocus") || _(e)) && i(e));
|
|
32
|
+
if (a && (a.focus({ preventScroll: !0 }), n && _(a) && g(a) && a.select?.(), g(e))) return !0;
|
|
33
|
+
for (let t of r) if (!(!i(t) || Number(t.getAttribute("tabindex")) < 0) && !(t.tabIndex < 0 && !t.localName.startsWith("vf-")) && (t.focus({ preventScroll: !0 }), g(e))) return !0;
|
|
34
34
|
return !1;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
let { defaultApp:
|
|
38
|
-
e.addEventListener(t, n),
|
|
39
|
-
},
|
|
36
|
+
function v(h, _) {
|
|
37
|
+
let { defaultApp: v, savedPin: te = () => null } = _, y = [], b = (e, t, n) => {
|
|
38
|
+
e.addEventListener(t, n), y.push(() => e.removeEventListener(t, n));
|
|
39
|
+
}, x = () => ({
|
|
40
40
|
width: h.width,
|
|
41
41
|
height: h.height
|
|
42
|
-
}),
|
|
43
|
-
if (!
|
|
44
|
-
},
|
|
45
|
-
for (let e of [...
|
|
46
|
-
},
|
|
47
|
-
for (let t = e; t; t = t.parentElement) if (
|
|
42
|
+
}), S = () => h.windowArea, C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), re = {}, k = () => a(S().top, re), A = /* @__PURE__ */ new Set(), j = !1, M = () => {
|
|
43
|
+
if (!j) for (let e of [...A]) e();
|
|
44
|
+
}, N = /* @__PURE__ */ new Set(), P = () => {
|
|
45
|
+
for (let e of [...N]) e();
|
|
46
|
+
}, F = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Map(), B = [], ie = (e) => {
|
|
47
|
+
for (let t = e; t; t = t.parentElement) if (z.has(t)) return t;
|
|
48
48
|
return null;
|
|
49
|
-
},
|
|
50
|
-
let e =
|
|
51
|
-
for (let t of
|
|
52
|
-
if (!(e.length ===
|
|
53
|
-
|
|
54
|
-
for (let e of [...
|
|
49
|
+
}, ae = (e) => e.isConnected && (e.matches("vf-dialog[open]") || !!e.querySelector("vf-dialog[open]")), V = () => {
|
|
50
|
+
let e = B.filter((e) => z.has(e) && ae(e));
|
|
51
|
+
for (let t of z.keys()) !e.includes(t) && ae(t) && e.push(t);
|
|
52
|
+
if (!(e.length === B.length && e.every((e, t) => e === B[t]))) {
|
|
53
|
+
B = e;
|
|
54
|
+
for (let e of [...R]) e();
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
function
|
|
58
|
-
let i =
|
|
56
|
+
}, H = () => null, U = () => !1;
|
|
57
|
+
function W(n, r) {
|
|
58
|
+
let i = S(), a = t(n), o = (e) => Math.floor(e / a) * a, s = Math.ceil(i.top / a) * a, c = i.left + i.width, l = i.top + i.height, { width: u, height: d } = r;
|
|
59
59
|
n.resizable && (u != null && Number.isFinite(u) && (u = Math.min(u, o(i.width))), d != null && Number.isFinite(d) && (d = Math.min(d, o(Math.max(0, l - s)))));
|
|
60
60
|
let p = u ?? n.width ?? 0, m = d ?? n.height ?? 0;
|
|
61
61
|
return {
|
|
@@ -65,13 +65,13 @@ function te(h, te) {
|
|
|
65
65
|
height: d
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
let
|
|
69
|
-
t.left = e(n.left, t), t.top = e(n.top, t), n.width != null && Number.isFinite(n.width) && (t.width = n.width), n.height != null && Number.isFinite(n.height) && (t.height = n.height),
|
|
70
|
-
},
|
|
71
|
-
let t =
|
|
72
|
-
return t ?
|
|
73
|
-
},
|
|
74
|
-
let n =
|
|
68
|
+
let G = (t, n) => {
|
|
69
|
+
t.left = e(n.left, t), t.top = e(n.top, t), n.width != null && Number.isFinite(n.width) && (t.width = n.width), n.height != null && Number.isFinite(n.height) && (t.height = n.height), O.delete(t);
|
|
70
|
+
}, K = (e) => {
|
|
71
|
+
let t = C.get(e)?.place;
|
|
72
|
+
return t ? W(e, t(S())) : null;
|
|
73
|
+
}, q = (e, t = S()) => {
|
|
74
|
+
let n = C.get(e)?.zoom;
|
|
75
75
|
if (!n) return null;
|
|
76
76
|
let r = p(e), i = n(t, r);
|
|
77
77
|
return {
|
|
@@ -80,8 +80,8 @@ function te(h, te) {
|
|
|
80
80
|
width: i.width ?? r.width,
|
|
81
81
|
height: i.height ?? r.height
|
|
82
82
|
};
|
|
83
|
-
},
|
|
84
|
-
let n =
|
|
83
|
+
}, J = (e, t) => {
|
|
84
|
+
let n = C.get(e)?.policy;
|
|
85
85
|
if (n) return n(t);
|
|
86
86
|
if (!e.resizable) return { size: {
|
|
87
87
|
width: t.width,
|
|
@@ -92,7 +92,7 @@ function te(h, te) {
|
|
|
92
92
|
width: r,
|
|
93
93
|
height: i
|
|
94
94
|
} };
|
|
95
|
-
},
|
|
95
|
+
}, oe = (e, t, n = J(e, p(e))) => W(e, c(t, x(), k(), n)), se = (e, t) => {
|
|
96
96
|
let n = p(e);
|
|
97
97
|
return [
|
|
98
98
|
"left",
|
|
@@ -104,89 +104,92 @@ function te(h, te) {
|
|
|
104
104
|
return r == null || !Number.isFinite(r) || n[e] === r;
|
|
105
105
|
});
|
|
106
106
|
}, ce = (e) => {
|
|
107
|
-
let t = [...
|
|
108
|
-
return r(l(
|
|
109
|
-
}, Y =
|
|
107
|
+
let t = [...C].filter(([t, n]) => t !== e && !t.hidden && !n.palette).map(([e]) => p(e));
|
|
108
|
+
return r(l(S()), t).slot;
|
|
109
|
+
}, Y = v, le = (e) => e instanceof n && C.get(e)?.app || v;
|
|
110
110
|
function ue() {
|
|
111
111
|
let e = !1;
|
|
112
|
-
for (let [t, n] of
|
|
112
|
+
for (let [t, n] of C) {
|
|
113
113
|
if (!n.palette) continue;
|
|
114
114
|
let r = n.app === Y && n.palette();
|
|
115
115
|
t.hidden !== !r && (t.hidden = !r, r && h.bringToFront(t), e = !0);
|
|
116
116
|
}
|
|
117
|
-
e &&
|
|
117
|
+
e && M();
|
|
118
118
|
}
|
|
119
119
|
let de = (e) => {
|
|
120
120
|
let t = document.activeElement?.closest("vf-window");
|
|
121
|
-
!(t instanceof n) || t === e || !
|
|
122
|
-
}, X = (e
|
|
121
|
+
!(t instanceof n) || t === e || !C.has(t) || C.get(t).palette || (e ? X(e) : U(null, null));
|
|
122
|
+
}, X = (e, t = !1) => void ee(e, {
|
|
123
|
+
when: () => h.activeWindow === e,
|
|
124
|
+
select: t
|
|
125
|
+
}), fe = (e) => {
|
|
123
126
|
de(e);
|
|
124
|
-
for (let t of [...
|
|
127
|
+
for (let t of [...I]) t(e);
|
|
125
128
|
let t = le(e);
|
|
126
129
|
if (t !== Y) {
|
|
127
130
|
Y = t, ue();
|
|
128
|
-
for (let e of [...
|
|
131
|
+
for (let e of [...L]) e(Y);
|
|
129
132
|
}
|
|
130
133
|
};
|
|
131
|
-
|
|
132
|
-
let t = e.target, r = t instanceof n ?
|
|
134
|
+
b(h, "vf-activate", (e) => fe(e.detail.window)), b(h, "vf-close", (e) => {
|
|
135
|
+
let t = e.target, r = t instanceof n ? C.get(t) : void 0;
|
|
133
136
|
if (!r) return;
|
|
134
137
|
let i = e.detail ?? {};
|
|
135
138
|
i.altKey && !r.palette ? $.closeAll(r.app, i) : $.requestClose(t, i);
|
|
136
139
|
});
|
|
137
140
|
let Z = 0, pe = (e) => {
|
|
138
|
-
!(e.target instanceof n) || !
|
|
139
|
-
Z = 0,
|
|
141
|
+
!(e.target instanceof n) || !C.has(e.target) || Z || (Z = window.setTimeout(() => {
|
|
142
|
+
Z = 0, M();
|
|
140
143
|
}, 0));
|
|
141
144
|
};
|
|
142
|
-
h.addEventListener("vf-placement-change", pe),
|
|
145
|
+
h.addEventListener("vf-placement-change", pe), y.push(() => h.removeEventListener("vf-placement-change", pe)), b(h, "vf-zoom", (e) => {
|
|
143
146
|
let t = e.target;
|
|
144
|
-
t instanceof n &&
|
|
145
|
-
}),
|
|
146
|
-
e.detail?.commit &&
|
|
147
|
+
t instanceof n && C.get(t)?.zoom && $.zoom(t);
|
|
148
|
+
}), b(h, "vf-resize", (e) => {
|
|
149
|
+
e.detail?.commit && M();
|
|
147
150
|
});
|
|
148
151
|
let me = (e) => {
|
|
149
|
-
let t =
|
|
150
|
-
t && (
|
|
152
|
+
let t = C.get(e);
|
|
153
|
+
t && (C.delete(e), O.delete(e), t.palette || P(), M());
|
|
151
154
|
}, he = (n, r, i, a) => {
|
|
152
|
-
let l = p(n), u =
|
|
155
|
+
let l = p(n), u = C.get(n);
|
|
153
156
|
if (u?.keep && o(l, u.keep(a))) {
|
|
154
|
-
|
|
157
|
+
G(n, W(n, u.keep(S())));
|
|
155
158
|
return;
|
|
156
159
|
}
|
|
157
|
-
let d =
|
|
160
|
+
let d = q(n, a);
|
|
158
161
|
if (d && o(l, d)) {
|
|
159
|
-
|
|
162
|
+
G(n, W(n, q(n)));
|
|
160
163
|
return;
|
|
161
164
|
}
|
|
162
|
-
let f =
|
|
165
|
+
let f = O.get(n), m = !!f && n.resizable && (f.width !== l.width || f.height !== l.height), h = !f || f.left !== l.left || f.top !== l.top || m || !f ? s(l, r, k()) : f.pin, g = c(h, i, k(), J(n, l));
|
|
163
166
|
if (n.left = e(g.left, n), n.top = e(g.top, n), n.resizable) {
|
|
164
|
-
let r = t(n), i =
|
|
167
|
+
let r = t(n), i = S(), a = Math.ceil(i.top / r) * r, o = Math.floor(i.width / r) * r, s = Math.floor(Math.max(0, i.top + i.height - a) / r) * r;
|
|
165
168
|
n.width = Math.min(e(g.width, n), o), n.height = Math.min(e(g.height, n), s);
|
|
166
169
|
}
|
|
167
|
-
|
|
170
|
+
O.set(n, {
|
|
168
171
|
pin: h,
|
|
169
172
|
...p(n)
|
|
170
173
|
});
|
|
171
174
|
}, ge = (e, t) => {
|
|
172
|
-
let n = t ?
|
|
173
|
-
n &&
|
|
175
|
+
let n = t ? oe(e, t) : K(e);
|
|
176
|
+
n && G(e, n);
|
|
174
177
|
}, _e = !1, Q = /* @__PURE__ */ new Map();
|
|
175
178
|
m(h).then(() => {
|
|
176
179
|
_e = !0;
|
|
177
|
-
for (let [e, t] of Q)
|
|
178
|
-
Q.size &&
|
|
180
|
+
for (let [e, t] of Q) C.has(e) && ge(e, t);
|
|
181
|
+
Q.size && M(), Q.clear();
|
|
179
182
|
});
|
|
180
183
|
let $ = {
|
|
181
184
|
get area() {
|
|
182
|
-
return
|
|
185
|
+
return S();
|
|
183
186
|
},
|
|
184
187
|
get front() {
|
|
185
188
|
return Y;
|
|
186
189
|
},
|
|
187
190
|
adopt(e, t) {
|
|
188
191
|
let n = t.palette;
|
|
189
|
-
if (
|
|
192
|
+
if (C.set(e, {
|
|
190
193
|
app: t.app,
|
|
191
194
|
item: t.item ?? null,
|
|
192
195
|
place: t.place ?? null,
|
|
@@ -196,10 +199,10 @@ function te(h, te) {
|
|
|
196
199
|
palette: n ? n === !0 ? () => !0 : n : null,
|
|
197
200
|
close: t.close ?? null
|
|
198
201
|
}), ge(e, t.pin ?? null), _e || Q.set(e, t.pin ?? null), n) {
|
|
199
|
-
let t =
|
|
202
|
+
let t = C.get(e);
|
|
200
203
|
e.hidden = !(t.app === Y && t.palette());
|
|
201
204
|
}
|
|
202
|
-
h.activeWindow === e && fe(e), n ||
|
|
205
|
+
h.activeWindow === e && fe(e), n || P(), M();
|
|
203
206
|
},
|
|
204
207
|
open(e) {
|
|
205
208
|
let t = e.item == null ? null : $.windowFor(e.item);
|
|
@@ -214,180 +217,180 @@ function te(h, te) {
|
|
|
214
217
|
app: e.app,
|
|
215
218
|
item: o,
|
|
216
219
|
place: e.place ?? ((e) => i(e, r, l(e), a)),
|
|
217
|
-
pin: o == null ? null :
|
|
220
|
+
pin: o == null ? null : T.get(o)?.pin ?? te(o),
|
|
218
221
|
policy: e.policy ?? null,
|
|
219
222
|
keep: e.keep ?? null,
|
|
220
223
|
zoom: e.zoom ?? null,
|
|
221
224
|
close: e.close ?? null
|
|
222
|
-
}), o != null &&
|
|
225
|
+
}), o != null && T.delete(o), h.bringToFront(n), e.from && n.show({ from: e.from }), X(n, !0), n;
|
|
223
226
|
},
|
|
224
227
|
close(e, { to: t } = {}) {
|
|
225
|
-
let n =
|
|
226
|
-
r != null && i != null &&
|
|
228
|
+
let n = C.get(e), r = n?.item ?? null, i = n?.app ?? null, a = t === void 0 ? i == null ? null : H(r, i) : t, o = h.activeWindow === e || g(e);
|
|
229
|
+
r != null && i != null && T.set(r, {
|
|
227
230
|
app: i,
|
|
228
|
-
pin: s(p(e),
|
|
231
|
+
pin: s(p(e), x(), k())
|
|
229
232
|
});
|
|
230
233
|
let c = e.hide({ to: a });
|
|
231
|
-
r != null && u(
|
|
234
|
+
r != null && u(E, r), i != null && !n?.palette && u(D, i);
|
|
232
235
|
let l = () => {
|
|
233
|
-
r != null && d(
|
|
236
|
+
r != null && d(E, r), i != null && !n?.palette && d(D, i), P();
|
|
234
237
|
};
|
|
235
238
|
return c.then(l, l), me(e), e.remove(), o && queueMicrotask(() => {
|
|
236
239
|
let e = h.activeWindow;
|
|
237
|
-
e ? X(e) :
|
|
240
|
+
e ? X(e) : U(r, i) || U(null, null);
|
|
238
241
|
}), c;
|
|
239
242
|
},
|
|
240
243
|
async requestClose(e, t = {}) {
|
|
241
|
-
let n =
|
|
242
|
-
return n ? await n(e, t) : $.close(e), !
|
|
244
|
+
let n = C.get(e)?.close;
|
|
245
|
+
return n ? await n(e, t) : $.close(e), !C.has(e);
|
|
243
246
|
},
|
|
244
247
|
async closeAll(e, t = {}) {
|
|
245
|
-
let n = $.windowsOf(e).filter((e) => !
|
|
246
|
-
for (let e of n) if (
|
|
248
|
+
let n = $.windowsOf(e).filter((e) => !C.get(e)?.palette).reverse();
|
|
249
|
+
for (let e of n) if (C.has(e) && !await $.requestClose(e, t)) return !1;
|
|
247
250
|
return !0;
|
|
248
251
|
},
|
|
249
252
|
windowFor(e) {
|
|
250
|
-
for (let [t, n] of
|
|
253
|
+
for (let [t, n] of C) if (n.item === e) return t;
|
|
251
254
|
return null;
|
|
252
255
|
},
|
|
253
256
|
windowsOf(e) {
|
|
254
|
-
return h.stackingOrder.filter((t) => t instanceof n &&
|
|
257
|
+
return h.stackingOrder.filter((t) => t instanceof n && C.get(t)?.app === e);
|
|
255
258
|
},
|
|
256
259
|
itemOf(e) {
|
|
257
|
-
return e instanceof n ?
|
|
260
|
+
return e instanceof n ? C.get(e)?.item ?? null : null;
|
|
258
261
|
},
|
|
259
262
|
appOf(e) {
|
|
260
|
-
if (e instanceof n) return
|
|
261
|
-
let t =
|
|
262
|
-
return t ?
|
|
263
|
+
if (e instanceof n) return C.get(e)?.app ?? null;
|
|
264
|
+
let t = ie(e);
|
|
265
|
+
return t ? z.get(t).app : null;
|
|
263
266
|
},
|
|
264
267
|
holdDialog(e, { app: t }) {
|
|
265
|
-
let n =
|
|
268
|
+
let n = z.get(e);
|
|
266
269
|
if (n) n.app = t;
|
|
267
270
|
else {
|
|
268
|
-
let n = new MutationObserver(
|
|
271
|
+
let n = new MutationObserver(V);
|
|
269
272
|
n.observe(e, {
|
|
270
273
|
attributes: !0,
|
|
271
274
|
attributeFilter: ["open"],
|
|
272
275
|
subtree: !0
|
|
273
|
-
}),
|
|
276
|
+
}), z.set(e, {
|
|
274
277
|
app: t,
|
|
275
278
|
observer: n
|
|
276
279
|
});
|
|
277
280
|
}
|
|
278
|
-
h.contains(e) || h.append(e),
|
|
281
|
+
h.contains(e) || h.append(e), V();
|
|
279
282
|
},
|
|
280
283
|
releaseDialog(e) {
|
|
281
|
-
let t =
|
|
282
|
-
t && (t.observer.disconnect(),
|
|
284
|
+
let t = z.get(e);
|
|
285
|
+
t && (t.observer.disconnect(), z.delete(e), V());
|
|
283
286
|
},
|
|
284
287
|
dialogsOf(e) {
|
|
285
|
-
return [...
|
|
288
|
+
return [...z].filter(([, t]) => t.app === e).map(([e]) => e);
|
|
286
289
|
},
|
|
287
290
|
get asking() {
|
|
288
|
-
let e =
|
|
289
|
-
return e ?
|
|
291
|
+
let e = B[B.length - 1];
|
|
292
|
+
return e ? z.get(e).app : null;
|
|
290
293
|
},
|
|
291
294
|
isPalette(e) {
|
|
292
|
-
return e instanceof n && !!
|
|
295
|
+
return e instanceof n && !!C.get(e)?.palette;
|
|
293
296
|
},
|
|
294
297
|
setItem(e, t) {
|
|
295
|
-
let n =
|
|
296
|
-
!n || n.item === t || (n.item = t,
|
|
298
|
+
let n = C.get(e);
|
|
299
|
+
!n || n.item === t || (n.item = t, P());
|
|
297
300
|
},
|
|
298
301
|
isOpen(e) {
|
|
299
|
-
return
|
|
302
|
+
return E.has(e) || $.windowFor(e) !== null;
|
|
300
303
|
},
|
|
301
304
|
hasWindows(e) {
|
|
302
|
-
if (
|
|
303
|
-
for (let [, t] of
|
|
305
|
+
if (D.has(e)) return !0;
|
|
306
|
+
for (let [, t] of C) if (t.app === e && !t.palette) return !0;
|
|
304
307
|
return !1;
|
|
305
308
|
},
|
|
306
309
|
palettesChanged() {
|
|
307
310
|
ue();
|
|
308
311
|
},
|
|
309
312
|
write(e, t) {
|
|
310
|
-
|
|
313
|
+
G(e, t), M();
|
|
311
314
|
},
|
|
312
315
|
zoom(e) {
|
|
313
|
-
let t =
|
|
316
|
+
let t = q(e);
|
|
314
317
|
if (!t) return;
|
|
315
|
-
let n = p(e), r =
|
|
318
|
+
let n = p(e), r = W(e, t);
|
|
316
319
|
if (o(n, {
|
|
317
320
|
...n,
|
|
318
321
|
...r
|
|
319
322
|
})) {
|
|
320
|
-
let t =
|
|
321
|
-
|
|
322
|
-
let n = t ?
|
|
323
|
-
n &&
|
|
324
|
-
} else
|
|
325
|
-
pin: s(n,
|
|
323
|
+
let t = ne.get(e);
|
|
324
|
+
ne.delete(e);
|
|
325
|
+
let n = t ? oe(e, t.pin, J(e, t.box)) : K(e);
|
|
326
|
+
n && G(e, n);
|
|
327
|
+
} else ne.set(e, {
|
|
328
|
+
pin: s(n, x(), k()),
|
|
326
329
|
box: n
|
|
327
|
-
}),
|
|
328
|
-
|
|
330
|
+
}), G(e, r);
|
|
331
|
+
M();
|
|
329
332
|
},
|
|
330
333
|
clamped(e, t) {
|
|
331
|
-
return
|
|
334
|
+
return W(e, t);
|
|
332
335
|
},
|
|
333
336
|
placed(e) {
|
|
334
|
-
return
|
|
337
|
+
return K(e);
|
|
335
338
|
},
|
|
336
339
|
pinOf(e) {
|
|
337
|
-
return s(p(e),
|
|
340
|
+
return s(p(e), x(), k());
|
|
338
341
|
},
|
|
339
342
|
fromPin(e, t, n) {
|
|
340
|
-
return
|
|
343
|
+
return oe(e, t, n);
|
|
341
344
|
},
|
|
342
345
|
setFrameBands(e) {
|
|
343
|
-
|
|
346
|
+
re = { ...e }, O = /* @__PURE__ */ new WeakMap();
|
|
344
347
|
},
|
|
345
348
|
arrangeWith(e, t) {
|
|
346
|
-
return
|
|
347
|
-
|
|
349
|
+
return w.set(e, t), M(), () => {
|
|
350
|
+
w.get(e) === t && w.delete(e), M();
|
|
348
351
|
};
|
|
349
352
|
},
|
|
350
353
|
arrange() {
|
|
351
|
-
|
|
354
|
+
j = !0;
|
|
352
355
|
try {
|
|
353
|
-
for (let e of
|
|
354
|
-
for (let e of
|
|
355
|
-
let t =
|
|
356
|
-
t &&
|
|
356
|
+
for (let e of w.values()) e.arrange();
|
|
357
|
+
for (let e of C.keys()) {
|
|
358
|
+
let t = K(e);
|
|
359
|
+
t && G(e, t);
|
|
357
360
|
}
|
|
358
361
|
} finally {
|
|
359
|
-
|
|
362
|
+
j = !1;
|
|
360
363
|
}
|
|
361
|
-
|
|
364
|
+
M();
|
|
362
365
|
},
|
|
363
366
|
arranged() {
|
|
364
|
-
for (let e of
|
|
365
|
-
for (let e of
|
|
366
|
-
let t =
|
|
367
|
+
for (let e of w.values()) if (!e.arranged()) return !1;
|
|
368
|
+
for (let e of C.keys()) {
|
|
369
|
+
let t = K(e);
|
|
367
370
|
if (t && !e.hidden && !se(e, t)) return !1;
|
|
368
371
|
}
|
|
369
372
|
return !0;
|
|
370
373
|
},
|
|
371
374
|
resized(e) {
|
|
372
|
-
let t =
|
|
375
|
+
let t = x();
|
|
373
376
|
if (e.width === t.width && e.height === t.height) return;
|
|
374
|
-
let n =
|
|
377
|
+
let n = S(), r = {
|
|
375
378
|
left: n.left,
|
|
376
379
|
top: n.top,
|
|
377
380
|
width: e.width - n.left,
|
|
378
381
|
height: Math.max(0, e.height - n.top)
|
|
379
382
|
};
|
|
380
|
-
for (let n of
|
|
381
|
-
for (let n of [...
|
|
382
|
-
|
|
383
|
+
for (let n of C.keys()) he(n, e, t, r);
|
|
384
|
+
for (let n of [...F]) n(e, t);
|
|
385
|
+
M();
|
|
383
386
|
},
|
|
384
387
|
snapshot() {
|
|
385
388
|
let e = {};
|
|
386
|
-
for (let [t, n] of
|
|
389
|
+
for (let [t, n] of T) e[t] = { ...n };
|
|
387
390
|
let t = h.stackingOrder;
|
|
388
|
-
for (let [n, r] of
|
|
391
|
+
for (let [n, r] of C) {
|
|
389
392
|
if (r.item == null) continue;
|
|
390
|
-
let i = s(p(n),
|
|
393
|
+
let i = s(p(n), x(), k());
|
|
391
394
|
e[r.item] = r.palette ? {
|
|
392
395
|
app: r.app,
|
|
393
396
|
pin: i
|
|
@@ -400,45 +403,45 @@ function te(h, te) {
|
|
|
400
403
|
return e;
|
|
401
404
|
},
|
|
402
405
|
rememberedPin(e) {
|
|
403
|
-
return
|
|
406
|
+
return T.get(e)?.pin ?? null;
|
|
404
407
|
},
|
|
405
408
|
layoutChanged() {
|
|
406
|
-
|
|
409
|
+
M();
|
|
407
410
|
},
|
|
408
411
|
setHome(e, t) {
|
|
409
|
-
return
|
|
410
|
-
|
|
412
|
+
return H = e, U = t, () => {
|
|
413
|
+
H = () => null, U = () => !1;
|
|
411
414
|
};
|
|
412
415
|
},
|
|
413
416
|
onLayout(e) {
|
|
414
|
-
return
|
|
417
|
+
return A.add(e), () => void A.delete(e);
|
|
415
418
|
},
|
|
416
419
|
onWindows(e) {
|
|
417
|
-
return
|
|
420
|
+
return N.add(e), () => void N.delete(e);
|
|
418
421
|
},
|
|
419
422
|
onRaster(e) {
|
|
420
|
-
return
|
|
423
|
+
return F.add(e), () => void F.delete(e);
|
|
421
424
|
},
|
|
422
425
|
beforeFront(e) {
|
|
423
|
-
return
|
|
426
|
+
return I.add(e), () => void I.delete(e);
|
|
424
427
|
},
|
|
425
428
|
onFront(e) {
|
|
426
|
-
return
|
|
429
|
+
return L.add(e), () => void L.delete(e);
|
|
427
430
|
},
|
|
428
431
|
onDialogs(e) {
|
|
429
|
-
return
|
|
432
|
+
return R.add(e), () => void R.delete(e);
|
|
430
433
|
},
|
|
431
434
|
dispose() {
|
|
432
435
|
clearTimeout(Z);
|
|
433
|
-
for (let e of
|
|
434
|
-
|
|
435
|
-
for (let { observer: e } of
|
|
436
|
-
|
|
437
|
-
for (let e of
|
|
438
|
-
|
|
436
|
+
for (let e of y) e();
|
|
437
|
+
A.clear(), N.clear(), F.clear(), I.clear(), L.clear(), R.clear();
|
|
438
|
+
for (let { observer: e } of z.values()) e.disconnect();
|
|
439
|
+
z.clear(), B = [], w.clear();
|
|
440
|
+
for (let e of C.keys()) e.remove();
|
|
441
|
+
C.clear();
|
|
439
442
|
}
|
|
440
443
|
};
|
|
441
444
|
return Y = le(h.activeWindow), $;
|
|
442
445
|
}
|
|
443
446
|
//#endregion
|
|
444
|
-
export {
|
|
447
|
+
export { v as createWindowManager, h as deepActiveElement, m as desktopRendered, ee as focusInto };
|
package/dist/text-control.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ import { FocusRuleController } from './focus-modality.js';
|
|
|
11
11
|
* the name/description bridge every field needs, its role sitting on the inner
|
|
12
12
|
* native control) and adds the value/label scaffolding
|
|
13
13
|
* every field repeated: the reflected `name`, the `value`/`placeholder`/
|
|
14
|
-
* `readonly`/`label` props, the captured default restored on
|
|
15
|
-
* `updated()` → {@link VfShadowRoleControl.syncFormValue}
|
|
14
|
+
* `readonly`/`autoselect`/`label` props, the captured default restored on
|
|
15
|
+
* form reset, the `updated()` → {@link VfShadowRoleControl.syncFormValue}
|
|
16
|
+
* funnel, `select()` and `focus()` on the inner control, and the display-
|
|
16
17
|
* scaling controller. Pairs with the `vfField` css fragment (the white-well
|
|
17
18
|
* skin) in styles/base.ts.
|
|
18
19
|
*
|
|
@@ -29,6 +30,14 @@ export declare class VfTextControlBase extends VfShadowRoleControl {
|
|
|
29
30
|
placeholder: string;
|
|
30
31
|
/** Makes the field read-only (focusable, not editable). */
|
|
31
32
|
readonly: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Opens with the whole text selected, so typing replaces it. Implies
|
|
35
|
+
* `autofocus`: the first control carrying either takes the opening focus of
|
|
36
|
+
* its `vf-dialog`, or of a window the shell's window manager opens. A dialog
|
|
37
|
+
* selects the text on every open, a window on its first open only. A click
|
|
38
|
+
* still places the caret.
|
|
39
|
+
*/
|
|
40
|
+
autoselect: boolean;
|
|
32
41
|
/** Form field name used when submitting the associated form. */
|
|
33
42
|
name: string;
|
|
34
43
|
/**
|
|
@@ -97,7 +106,18 @@ export declare class VfTextControlBase extends VfShadowRoleControl {
|
|
|
97
106
|
constructor();
|
|
98
107
|
/** The inner native control every field renders, tagged `vf-field`. */
|
|
99
108
|
protected get control(): HTMLInputElement | HTMLTextAreaElement | null;
|
|
100
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Focuses the inner control, keeping its caret where it was. Chromium
|
|
111
|
+
* selects all of an input's text when the host hands the focus on, as a Tab
|
|
112
|
+
* does; `select()` and {@link autoselect} are how a field opens selected.
|
|
113
|
+
*/
|
|
114
|
+
focus(options?: FocusOptions): void;
|
|
115
|
+
/**
|
|
116
|
+
* Select all of the field's text, as a native field's `select()` does. With
|
|
117
|
+
* a new value not yet rendered, once it has: writing the value into the
|
|
118
|
+
* input drops its selection, so `field.value = x; field.select()` selects
|
|
119
|
+
* `x`, as on a native field.
|
|
120
|
+
*/
|
|
101
121
|
select(): void;
|
|
102
122
|
connectedCallback(): void;
|
|
103
123
|
/**
|
package/dist/text-control.js
CHANGED
|
@@ -40,7 +40,7 @@ var l = class extends a {
|
|
|
40
40
|
return `vf-field-well vf-snap${this.focusRule.marked ? " vf-focus-rule" : ""}`;
|
|
41
41
|
}
|
|
42
42
|
constructor() {
|
|
43
|
-
super(), this.value = "", this.placeholder = "", this.readonly = !1, this.name = "", this.label = "", this.scale = new n(this), this.gridSnap = new i(this), this.focusRule = new o(this), this.committed = null, this.addEventListener("focusin", () => {
|
|
43
|
+
super(), this.value = "", this.placeholder = "", this.readonly = !1, this.autoselect = !1, this.name = "", this.label = "", this.scale = new n(this), this.gridSnap = new i(this), this.focusRule = new o(this), this.committed = null, this.addEventListener("focusin", () => {
|
|
44
44
|
this.committed = this.value;
|
|
45
45
|
}), this.addEventListener("focusout", () => {
|
|
46
46
|
let e = this.control;
|
|
@@ -50,8 +50,12 @@ var l = class extends a {
|
|
|
50
50
|
get control() {
|
|
51
51
|
return this.renderRoot.querySelector(".vf-field");
|
|
52
52
|
}
|
|
53
|
+
focus(e) {
|
|
54
|
+
this.control?.focus(e);
|
|
55
|
+
}
|
|
53
56
|
select() {
|
|
54
|
-
this.control
|
|
57
|
+
let e = this.control;
|
|
58
|
+
e && e.value === this.value ? e.select() : this.updateComplete.then(() => this.control?.select());
|
|
55
59
|
}
|
|
56
60
|
connectedCallback() {
|
|
57
61
|
super.connectedCallback(), this.latchFormDefault(this.value);
|
|
@@ -94,6 +98,9 @@ var l = class extends a {
|
|
|
94
98
|
r([c()], l.prototype, "value", void 0), r([c()], l.prototype, "placeholder", void 0), r([c({
|
|
95
99
|
type: Boolean,
|
|
96
100
|
reflect: !0
|
|
97
|
-
})], l.prototype, "readonly", void 0), r([c({
|
|
101
|
+
})], l.prototype, "readonly", void 0), r([c({
|
|
102
|
+
type: Boolean,
|
|
103
|
+
reflect: !0
|
|
104
|
+
})], l.prototype, "autoselect", void 0), r([c({ reflect: !0 })], l.prototype, "name", void 0), r([c()], l.prototype, "label", void 0);
|
|
98
105
|
//#endregion
|
|
99
106
|
export { l as VfTextControlBase };
|