vintage-frames 0.14.1 → 0.16.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/custom-elements.json +770 -74
- package/dist/chrome.d.ts +10 -1
- package/dist/chrome.js +8 -3
- package/dist/components/vf-button.d.ts +5 -1
- package/dist/components/vf-button.js +1 -1
- package/dist/components/vf-desktop.d.ts +5 -2
- package/dist/components/vf-desktop.js +5 -5
- package/dist/components/vf-dialog.d.ts +13 -2
- package/dist/components/vf-dialog.js +27 -27
- package/dist/components/vf-menu-bar.js +9 -10
- package/dist/components/vf-menu-item.js +18 -13
- package/dist/components/vf-menu.d.ts +8 -3
- package/dist/components/vf-menu.js +85 -61
- package/dist/components/vf-number-field.d.ts +4 -0
- package/dist/components/vf-number-field.js +28 -25
- package/dist/components/vf-paragraph.d.ts +3 -1
- package/dist/components/vf-paragraph.js +7 -0
- package/dist/components/vf-scroll-area.d.ts +16 -1
- package/dist/components/vf-scroll-area.js +39 -29
- package/dist/components/vf-select.d.ts +5 -4
- package/dist/components/vf-select.js +26 -17
- package/dist/components/vf-text-field.d.ts +5 -5
- package/dist/components/vf-text-field.js +1 -1
- package/dist/components/vf-window.d.ts +22 -5
- package/dist/components/vf-window.js +113 -98
- package/dist/cursor.d.ts +8 -0
- package/dist/cursor.js +70 -73
- package/dist/events.d.ts +3 -2
- package/dist/events.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/modal-dialog.d.ts +49 -4
- package/dist/modal-dialog.js +115 -87
- package/dist/position.js +25 -20
- package/dist/shell/alert.d.ts +17 -9
- package/dist/shell/alert.js +25 -28
- package/dist/shell/catalog.d.ts +1 -1
- package/dist/shell/catalog.js +32 -18
- package/dist/shell/finder.d.ts +46 -1
- package/dist/shell/finder.js +166 -126
- package/dist/shell/index.d.ts +2 -4
- package/dist/shell/index.js +5 -6
- package/dist/shell/pure.d.ts +10 -0
- package/dist/shell/pure.js +4 -0
- package/dist/shell/shell.d.ts +40 -13
- package/dist/shell/shell.js +87 -51
- package/dist/shell/windows.d.ts +69 -12
- package/dist/shell/windows.js +245 -144
- package/dist/text-control.d.ts +30 -1
- package/dist/text-control.js +27 -6
- package/dist/top-layer.d.ts +13 -0
- package/dist/top-layer.js +16 -0
- package/docs/SPEC.md +25 -24
- package/editor/vscode.html-custom-data.json +22 -12
- package/editor/web-types.json +58 -25
- package/package.json +5 -1
package/dist/shell/windows.js
CHANGED
|
@@ -12,34 +12,50 @@ var u = (e, t) => e.set(t, (e.get(t) ?? 0) + 1), d = (e, t) => {
|
|
|
12
12
|
width: e.width ?? 0,
|
|
13
13
|
height: e.height ?? 0
|
|
14
14
|
});
|
|
15
|
-
function m() {
|
|
15
|
+
async function m(e) {
|
|
16
|
+
let t = e.querySelector(":scope > vf-menu-bar");
|
|
17
|
+
await Promise.all([e.updateComplete, t?.updateComplete]);
|
|
18
|
+
}
|
|
19
|
+
function h() {
|
|
16
20
|
let e = document.activeElement;
|
|
17
21
|
for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
|
|
18
22
|
return e;
|
|
19
23
|
}
|
|
20
|
-
var
|
|
24
|
+
var g = (e) => {
|
|
21
25
|
let t = document.activeElement;
|
|
22
26
|
return !!t && (t === e || e.contains(t));
|
|
23
27
|
};
|
|
24
|
-
async function
|
|
28
|
+
async function ee(e, { when: t } = {}) {
|
|
25
29
|
let n = [...e.querySelectorAll("*")];
|
|
26
30
|
if (await Promise.all([e, ...n].map((e) => e.updateComplete)), !e.isConnected || t && !t()) return !1;
|
|
27
|
-
|
|
31
|
+
let r = (e) => !e.closest("[hidden]") && e.checkVisibility(), i = n.find((e) => e.hasAttribute("autofocus") && r(e));
|
|
32
|
+
if (i && (i.focus({ preventScroll: !0 }), g(e))) return !0;
|
|
33
|
+
for (let t of n) if (!(!r(t) || Number(t.getAttribute("tabindex")) < 0) && !(t.tabIndex < 0 && !t.localName.startsWith("vf-")) && (t.focus({ preventScroll: !0 }), g(e))) return !0;
|
|
28
34
|
return !1;
|
|
29
35
|
}
|
|
30
|
-
function
|
|
31
|
-
let { defaultApp:
|
|
32
|
-
e.addEventListener(t, n),
|
|
33
|
-
},
|
|
34
|
-
width:
|
|
35
|
-
height:
|
|
36
|
-
}),
|
|
37
|
-
if (!
|
|
38
|
-
},
|
|
39
|
-
for (let e of [...
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
function te(h, te) {
|
|
37
|
+
let { defaultApp: ne, savedPin: re = () => null } = te, _ = [], v = (e, t, n) => {
|
|
38
|
+
e.addEventListener(t, n), _.push(() => e.removeEventListener(t, n));
|
|
39
|
+
}, y = () => ({
|
|
40
|
+
width: h.width,
|
|
41
|
+
height: h.height
|
|
42
|
+
}), b = () => h.windowArea, x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), ie = {}, O = () => a(b().top, ie), k = /* @__PURE__ */ new Set(), A = !1, j = () => {
|
|
43
|
+
if (!A) for (let e of [...k]) e();
|
|
44
|
+
}, M = /* @__PURE__ */ new Set(), N = () => {
|
|
45
|
+
for (let e of [...M]) e();
|
|
46
|
+
}, P = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map(), z = [], ae = (e) => {
|
|
47
|
+
for (let t = e; t; t = t.parentElement) if (R.has(t)) return t;
|
|
48
|
+
return null;
|
|
49
|
+
}, oe = (e) => e.isConnected && (e.matches("vf-dialog[open]") || !!e.querySelector("vf-dialog[open]")), B = () => {
|
|
50
|
+
let e = z.filter((e) => R.has(e) && oe(e));
|
|
51
|
+
for (let t of R.keys()) !e.includes(t) && oe(t) && e.push(t);
|
|
52
|
+
if (!(e.length === z.length && e.every((e, t) => e === z[t]))) {
|
|
53
|
+
z = e;
|
|
54
|
+
for (let e of [...L]) e();
|
|
55
|
+
}
|
|
56
|
+
}, V = () => null, H = () => !1;
|
|
57
|
+
function U(n, r) {
|
|
58
|
+
let i = b(), 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;
|
|
43
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)))));
|
|
44
60
|
let p = u ?? n.width ?? 0, m = d ?? n.height ?? 0;
|
|
45
61
|
return {
|
|
@@ -49,13 +65,23 @@ function _(m, _) {
|
|
|
49
65
|
height: d
|
|
50
66
|
};
|
|
51
67
|
}
|
|
52
|
-
let
|
|
53
|
-
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),
|
|
54
|
-
},
|
|
55
|
-
let t =
|
|
56
|
-
return t ?
|
|
57
|
-
},
|
|
58
|
-
let n =
|
|
68
|
+
let W = (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), E.delete(t);
|
|
70
|
+
}, G = (e) => {
|
|
71
|
+
let t = x.get(e)?.place;
|
|
72
|
+
return t ? U(e, t(b())) : null;
|
|
73
|
+
}, K = (e, t = b()) => {
|
|
74
|
+
let n = x.get(e)?.zoom;
|
|
75
|
+
if (!n) return null;
|
|
76
|
+
let r = p(e), i = n(t, r);
|
|
77
|
+
return {
|
|
78
|
+
left: i.left ?? r.left,
|
|
79
|
+
top: i.top ?? r.top,
|
|
80
|
+
width: i.width ?? r.width,
|
|
81
|
+
height: i.height ?? r.height
|
|
82
|
+
};
|
|
83
|
+
}, q = (e, t) => {
|
|
84
|
+
let n = x.get(e)?.policy;
|
|
59
85
|
if (n) return n(t);
|
|
60
86
|
if (!e.resizable) return { size: {
|
|
61
87
|
width: t.width,
|
|
@@ -66,7 +92,7 @@ function _(m, _) {
|
|
|
66
92
|
width: r,
|
|
67
93
|
height: i
|
|
68
94
|
} };
|
|
69
|
-
},
|
|
95
|
+
}, J = (e, t, n = q(e, p(e))) => U(e, c(t, y(), O(), n)), se = (e, t) => {
|
|
70
96
|
let n = p(e);
|
|
71
97
|
return [
|
|
72
98
|
"left",
|
|
@@ -77,223 +103,291 @@ function _(m, _) {
|
|
|
77
103
|
let r = t[e];
|
|
78
104
|
return r == null || !Number.isFinite(r) || n[e] === r;
|
|
79
105
|
});
|
|
80
|
-
},
|
|
81
|
-
let t = [...
|
|
82
|
-
return r(l(
|
|
83
|
-
},
|
|
84
|
-
function
|
|
106
|
+
}, ce = (e) => {
|
|
107
|
+
let t = [...x].filter(([t, n]) => t !== e && !t.hidden && !n.palette).map(([e]) => p(e));
|
|
108
|
+
return r(l(b()), t).slot;
|
|
109
|
+
}, Y = ne, le = (e) => e instanceof n && x.get(e)?.app || ne;
|
|
110
|
+
function ue() {
|
|
85
111
|
let e = !1;
|
|
86
|
-
for (let [t, n] of
|
|
112
|
+
for (let [t, n] of x) {
|
|
87
113
|
if (!n.palette) continue;
|
|
88
|
-
let r = n.app ===
|
|
89
|
-
t.hidden !== !r && (t.hidden = !r, r &&
|
|
114
|
+
let r = n.app === Y && n.palette();
|
|
115
|
+
t.hidden !== !r && (t.hidden = !r, r && h.bringToFront(t), e = !0);
|
|
90
116
|
}
|
|
91
|
-
e &&
|
|
117
|
+
e && j();
|
|
92
118
|
}
|
|
93
|
-
let
|
|
119
|
+
let de = (e) => {
|
|
94
120
|
let t = document.activeElement?.closest("vf-window");
|
|
95
|
-
!(t instanceof n) || t === e || !
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
for (let t of [...
|
|
99
|
-
let t =
|
|
100
|
-
if (t !==
|
|
101
|
-
|
|
102
|
-
for (let e of [...
|
|
121
|
+
!(t instanceof n) || t === e || !x.has(t) || x.get(t).palette || (e ? X(e) : H(null, null));
|
|
122
|
+
}, X = (e) => void ee(e, { when: () => h.activeWindow === e }), fe = (e) => {
|
|
123
|
+
de(e);
|
|
124
|
+
for (let t of [...F]) t(e);
|
|
125
|
+
let t = le(e);
|
|
126
|
+
if (t !== Y) {
|
|
127
|
+
Y = t, ue();
|
|
128
|
+
for (let e of [...I]) e(Y);
|
|
103
129
|
}
|
|
104
130
|
};
|
|
105
|
-
|
|
106
|
-
let t = e.target;
|
|
107
|
-
|
|
131
|
+
v(h, "vf-activate", (e) => fe(e.detail.window)), v(h, "vf-close", (e) => {
|
|
132
|
+
let t = e.target, r = t instanceof n ? x.get(t) : void 0;
|
|
133
|
+
if (!r) return;
|
|
134
|
+
let i = e.detail ?? {};
|
|
135
|
+
i.altKey && !r.palette ? $.closeAll(r.app, i) : $.requestClose(t, i);
|
|
108
136
|
});
|
|
109
|
-
let Z = 0,
|
|
110
|
-
!(e.target instanceof n) || !
|
|
111
|
-
Z = 0,
|
|
137
|
+
let Z = 0, pe = (e) => {
|
|
138
|
+
!(e.target instanceof n) || !x.has(e.target) || Z || (Z = window.setTimeout(() => {
|
|
139
|
+
Z = 0, j();
|
|
112
140
|
}, 0));
|
|
113
141
|
};
|
|
114
|
-
|
|
115
|
-
e.
|
|
142
|
+
h.addEventListener("vf-placement-change", pe), _.push(() => h.removeEventListener("vf-placement-change", pe)), v(h, "vf-zoom", (e) => {
|
|
143
|
+
let t = e.target;
|
|
144
|
+
t instanceof n && x.get(t)?.zoom && $.zoom(t);
|
|
145
|
+
}), v(h, "vf-resize", (e) => {
|
|
146
|
+
e.detail?.commit && j();
|
|
116
147
|
});
|
|
117
|
-
let
|
|
118
|
-
let t =
|
|
119
|
-
t && (
|
|
120
|
-
},
|
|
121
|
-
let l = p(n), u =
|
|
148
|
+
let me = (e) => {
|
|
149
|
+
let t = x.get(e);
|
|
150
|
+
t && (x.delete(e), E.delete(e), t.palette || N(), j());
|
|
151
|
+
}, he = (n, r, i, a) => {
|
|
152
|
+
let l = p(n), u = x.get(n);
|
|
122
153
|
if (u?.keep && o(l, u.keep(a))) {
|
|
123
|
-
|
|
154
|
+
W(n, U(n, u.keep(b())));
|
|
124
155
|
return;
|
|
125
156
|
}
|
|
126
|
-
let d =
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
|
|
157
|
+
let d = K(n, a);
|
|
158
|
+
if (d && o(l, d)) {
|
|
159
|
+
W(n, U(n, K(n)));
|
|
160
|
+
return;
|
|
130
161
|
}
|
|
131
|
-
O.
|
|
132
|
-
|
|
162
|
+
let f = E.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, O()) : f.pin, g = c(h, i, O(), q(n, l));
|
|
163
|
+
if (n.left = e(g.left, n), n.top = e(g.top, n), n.resizable) {
|
|
164
|
+
let r = t(n), i = b(), 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
|
+
n.width = Math.min(e(g.width, n), o), n.height = Math.min(e(g.height, n), s);
|
|
166
|
+
}
|
|
167
|
+
E.set(n, {
|
|
168
|
+
pin: h,
|
|
133
169
|
...p(n)
|
|
134
170
|
});
|
|
135
|
-
},
|
|
171
|
+
}, ge = (e, t) => {
|
|
172
|
+
let n = t ? J(e, t) : G(e);
|
|
173
|
+
n && W(e, n);
|
|
174
|
+
}, _e = !1, Q = /* @__PURE__ */ new Map();
|
|
175
|
+
m(h).then(() => {
|
|
176
|
+
_e = !0;
|
|
177
|
+
for (let [e, t] of Q) x.has(e) && ge(e, t);
|
|
178
|
+
Q.size && j(), Q.clear();
|
|
179
|
+
});
|
|
180
|
+
let $ = {
|
|
136
181
|
get area() {
|
|
137
|
-
return
|
|
182
|
+
return b();
|
|
138
183
|
},
|
|
139
184
|
get front() {
|
|
140
|
-
return
|
|
185
|
+
return Y;
|
|
141
186
|
},
|
|
142
187
|
adopt(e, t) {
|
|
143
188
|
let n = t.palette;
|
|
144
|
-
if (
|
|
189
|
+
if (x.set(e, {
|
|
145
190
|
app: t.app,
|
|
146
191
|
item: t.item ?? null,
|
|
147
192
|
place: t.place ?? null,
|
|
148
193
|
policy: t.policy ?? null,
|
|
149
194
|
keep: t.keep ?? null,
|
|
195
|
+
zoom: t.zoom ?? null,
|
|
150
196
|
palette: n ? n === !0 ? () => !0 : n : null,
|
|
151
197
|
close: t.close ?? null
|
|
152
|
-
}), t.pin)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
t && H(e, t);
|
|
198
|
+
}), ge(e, t.pin ?? null), _e || Q.set(e, t.pin ?? null), n) {
|
|
199
|
+
let t = x.get(e);
|
|
200
|
+
e.hidden = !(t.app === Y && t.palette());
|
|
156
201
|
}
|
|
157
|
-
|
|
158
|
-
let t = C.get(e);
|
|
159
|
-
e.hidden = !(t.app === K && t.palette());
|
|
160
|
-
}
|
|
161
|
-
m.activeWindow === e && X(e), n || F(), N();
|
|
202
|
+
h.activeWindow === e && fe(e), n || N(), j();
|
|
162
203
|
},
|
|
163
204
|
open(e) {
|
|
164
205
|
let t = e.item == null ? null : $.windowFor(e.item);
|
|
165
|
-
if (t) return
|
|
206
|
+
if (t) return h.bringToFront(t), X(t), t;
|
|
166
207
|
let n = e.create(), r = {
|
|
167
208
|
width: n.width ?? 0,
|
|
168
209
|
height: n.height ?? 0
|
|
169
|
-
}, a =
|
|
170
|
-
|
|
210
|
+
}, a = ce();
|
|
211
|
+
h.append(n);
|
|
171
212
|
let o = e.item ?? null;
|
|
172
213
|
return $.adopt(n, {
|
|
173
214
|
app: e.app,
|
|
174
215
|
item: o,
|
|
175
216
|
place: e.place ?? ((e) => i(e, r, l(e), a)),
|
|
176
|
-
pin: o == null ? null :
|
|
217
|
+
pin: o == null ? null : C.get(o)?.pin ?? re(o),
|
|
177
218
|
policy: e.policy ?? null,
|
|
178
219
|
keep: e.keep ?? null,
|
|
220
|
+
zoom: e.zoom ?? null,
|
|
179
221
|
close: e.close ?? null
|
|
180
|
-
}), o != null &&
|
|
222
|
+
}), o != null && C.delete(o), h.bringToFront(n), e.from && n.show({ from: e.from }), X(n), n;
|
|
181
223
|
},
|
|
182
224
|
close(e, { to: t } = {}) {
|
|
183
|
-
let n =
|
|
184
|
-
r != null && i != null &&
|
|
225
|
+
let n = x.get(e), r = n?.item ?? null, i = n?.app ?? null, a = t === void 0 ? i == null ? null : V(r, i) : t, o = h.activeWindow === e || g(e);
|
|
226
|
+
r != null && i != null && C.set(r, {
|
|
185
227
|
app: i,
|
|
186
|
-
pin: s(p(e),
|
|
228
|
+
pin: s(p(e), y(), O())
|
|
187
229
|
});
|
|
188
230
|
let c = e.hide({ to: a });
|
|
189
|
-
r != null && u(
|
|
231
|
+
r != null && u(w, r), i != null && !n?.palette && u(T, i);
|
|
190
232
|
let l = () => {
|
|
191
|
-
r != null && d(
|
|
233
|
+
r != null && d(w, r), i != null && !n?.palette && d(T, i), N();
|
|
192
234
|
};
|
|
193
|
-
return c.then(l, l),
|
|
194
|
-
let e =
|
|
195
|
-
e ?
|
|
235
|
+
return c.then(l, l), me(e), e.remove(), o && queueMicrotask(() => {
|
|
236
|
+
let e = h.activeWindow;
|
|
237
|
+
e ? X(e) : H(r, i) || H(null, null);
|
|
196
238
|
}), c;
|
|
197
239
|
},
|
|
198
|
-
requestClose(e) {
|
|
199
|
-
let
|
|
200
|
-
|
|
240
|
+
async requestClose(e, t = {}) {
|
|
241
|
+
let n = x.get(e)?.close;
|
|
242
|
+
return n ? await n(e, t) : $.close(e), !x.has(e);
|
|
243
|
+
},
|
|
244
|
+
async closeAll(e, t = {}) {
|
|
245
|
+
let n = $.windowsOf(e).filter((e) => !x.get(e)?.palette).reverse();
|
|
246
|
+
for (let e of n) if (x.has(e) && !await $.requestClose(e, t)) return !1;
|
|
247
|
+
return !0;
|
|
201
248
|
},
|
|
202
249
|
windowFor(e) {
|
|
203
|
-
for (let [t, n] of
|
|
250
|
+
for (let [t, n] of x) if (n.item === e) return t;
|
|
204
251
|
return null;
|
|
205
252
|
},
|
|
206
253
|
windowsOf(e) {
|
|
207
|
-
return
|
|
254
|
+
return h.stackingOrder.filter((t) => t instanceof n && x.get(t)?.app === e);
|
|
208
255
|
},
|
|
209
256
|
itemOf(e) {
|
|
210
|
-
return e instanceof n ?
|
|
257
|
+
return e instanceof n ? x.get(e)?.item ?? null : null;
|
|
211
258
|
},
|
|
212
259
|
appOf(e) {
|
|
213
|
-
|
|
260
|
+
if (e instanceof n) return x.get(e)?.app ?? null;
|
|
261
|
+
let t = ae(e);
|
|
262
|
+
return t ? R.get(t).app : null;
|
|
263
|
+
},
|
|
264
|
+
holdDialog(e, { app: t }) {
|
|
265
|
+
let n = R.get(e);
|
|
266
|
+
if (n) n.app = t;
|
|
267
|
+
else {
|
|
268
|
+
let n = new MutationObserver(B);
|
|
269
|
+
n.observe(e, {
|
|
270
|
+
attributes: !0,
|
|
271
|
+
attributeFilter: ["open"],
|
|
272
|
+
subtree: !0
|
|
273
|
+
}), R.set(e, {
|
|
274
|
+
app: t,
|
|
275
|
+
observer: n
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
h.contains(e) || h.append(e), B();
|
|
279
|
+
},
|
|
280
|
+
releaseDialog(e) {
|
|
281
|
+
let t = R.get(e);
|
|
282
|
+
t && (t.observer.disconnect(), R.delete(e), B());
|
|
283
|
+
},
|
|
284
|
+
dialogsOf(e) {
|
|
285
|
+
return [...R].filter(([, t]) => t.app === e).map(([e]) => e);
|
|
286
|
+
},
|
|
287
|
+
get asking() {
|
|
288
|
+
let e = z[z.length - 1];
|
|
289
|
+
return e ? R.get(e).app : null;
|
|
214
290
|
},
|
|
215
291
|
isPalette(e) {
|
|
216
|
-
return e instanceof n && !!
|
|
292
|
+
return e instanceof n && !!x.get(e)?.palette;
|
|
217
293
|
},
|
|
218
294
|
setItem(e, t) {
|
|
219
|
-
let n =
|
|
220
|
-
!n || n.item === t || (n.item = t,
|
|
295
|
+
let n = x.get(e);
|
|
296
|
+
!n || n.item === t || (n.item = t, N());
|
|
221
297
|
},
|
|
222
298
|
isOpen(e) {
|
|
223
|
-
return
|
|
299
|
+
return w.has(e) || $.windowFor(e) !== null;
|
|
224
300
|
},
|
|
225
301
|
hasWindows(e) {
|
|
226
|
-
if (
|
|
227
|
-
for (let [, t] of
|
|
302
|
+
if (T.has(e)) return !0;
|
|
303
|
+
for (let [, t] of x) if (t.app === e && !t.palette) return !0;
|
|
228
304
|
return !1;
|
|
229
305
|
},
|
|
230
306
|
palettesChanged() {
|
|
231
|
-
|
|
307
|
+
ue();
|
|
232
308
|
},
|
|
233
309
|
write(e, t) {
|
|
234
|
-
|
|
310
|
+
W(e, t), j();
|
|
311
|
+
},
|
|
312
|
+
zoom(e) {
|
|
313
|
+
let t = K(e);
|
|
314
|
+
if (!t) return;
|
|
315
|
+
let n = p(e), r = U(e, t);
|
|
316
|
+
if (o(n, {
|
|
317
|
+
...n,
|
|
318
|
+
...r
|
|
319
|
+
})) {
|
|
320
|
+
let t = D.get(e);
|
|
321
|
+
D.delete(e);
|
|
322
|
+
let n = t ? J(e, t.pin, q(e, t.box)) : G(e);
|
|
323
|
+
n && W(e, n);
|
|
324
|
+
} else D.set(e, {
|
|
325
|
+
pin: s(n, y(), O()),
|
|
326
|
+
box: n
|
|
327
|
+
}), W(e, r);
|
|
328
|
+
j();
|
|
235
329
|
},
|
|
236
330
|
clamped(e, t) {
|
|
237
|
-
return
|
|
331
|
+
return U(e, t);
|
|
238
332
|
},
|
|
239
333
|
placed(e) {
|
|
240
|
-
return
|
|
334
|
+
return G(e);
|
|
241
335
|
},
|
|
242
336
|
pinOf(e) {
|
|
243
|
-
return s(p(e),
|
|
337
|
+
return s(p(e), y(), O());
|
|
244
338
|
},
|
|
245
339
|
fromPin(e, t, n) {
|
|
246
|
-
return
|
|
340
|
+
return J(e, t, n);
|
|
247
341
|
},
|
|
248
342
|
setFrameBands(e) {
|
|
249
|
-
|
|
343
|
+
ie = { ...e }, E = /* @__PURE__ */ new WeakMap();
|
|
250
344
|
},
|
|
251
345
|
arrangeWith(e, t) {
|
|
252
|
-
return
|
|
253
|
-
|
|
346
|
+
return S.set(e, t), j(), () => {
|
|
347
|
+
S.get(e) === t && S.delete(e), j();
|
|
254
348
|
};
|
|
255
349
|
},
|
|
256
350
|
arrange() {
|
|
257
|
-
|
|
351
|
+
A = !0;
|
|
258
352
|
try {
|
|
259
|
-
for (let e of
|
|
260
|
-
for (let e of
|
|
261
|
-
let t =
|
|
262
|
-
t &&
|
|
353
|
+
for (let e of S.values()) e.arrange();
|
|
354
|
+
for (let e of x.keys()) {
|
|
355
|
+
let t = G(e);
|
|
356
|
+
t && W(e, t);
|
|
263
357
|
}
|
|
264
358
|
} finally {
|
|
265
|
-
|
|
359
|
+
A = !1;
|
|
266
360
|
}
|
|
267
|
-
|
|
361
|
+
j();
|
|
268
362
|
},
|
|
269
363
|
arranged() {
|
|
270
|
-
for (let e of
|
|
271
|
-
for (let e of
|
|
272
|
-
let t =
|
|
273
|
-
if (t && !e.hidden && !
|
|
364
|
+
for (let e of S.values()) if (!e.arranged()) return !1;
|
|
365
|
+
for (let e of x.keys()) {
|
|
366
|
+
let t = G(e);
|
|
367
|
+
if (t && !e.hidden && !se(e, t)) return !1;
|
|
274
368
|
}
|
|
275
369
|
return !0;
|
|
276
370
|
},
|
|
277
371
|
resized(e) {
|
|
278
|
-
let t =
|
|
372
|
+
let t = y();
|
|
279
373
|
if (e.width === t.width && e.height === t.height) return;
|
|
280
|
-
let n =
|
|
374
|
+
let n = b(), r = {
|
|
281
375
|
left: n.left,
|
|
282
376
|
top: n.top,
|
|
283
377
|
width: e.width - n.left,
|
|
284
378
|
height: Math.max(0, e.height - n.top)
|
|
285
379
|
};
|
|
286
|
-
for (let n of
|
|
287
|
-
for (let n of [...
|
|
288
|
-
|
|
380
|
+
for (let n of x.keys()) he(n, e, t, r);
|
|
381
|
+
for (let n of [...P]) n(e, t);
|
|
382
|
+
j();
|
|
289
383
|
},
|
|
290
384
|
snapshot() {
|
|
291
385
|
let e = {};
|
|
292
|
-
for (let [t, n] of
|
|
293
|
-
let t =
|
|
294
|
-
for (let [n, r] of
|
|
386
|
+
for (let [t, n] of C) e[t] = { ...n };
|
|
387
|
+
let t = h.stackingOrder;
|
|
388
|
+
for (let [n, r] of x) {
|
|
295
389
|
if (r.item == null) continue;
|
|
296
|
-
let i = s(p(n),
|
|
390
|
+
let i = s(p(n), y(), O());
|
|
297
391
|
e[r.item] = r.palette ? {
|
|
298
392
|
app: r.app,
|
|
299
393
|
pin: i
|
|
@@ -306,38 +400,45 @@ function _(m, _) {
|
|
|
306
400
|
return e;
|
|
307
401
|
},
|
|
308
402
|
rememberedPin(e) {
|
|
309
|
-
return
|
|
403
|
+
return C.get(e)?.pin ?? null;
|
|
310
404
|
},
|
|
311
405
|
layoutChanged() {
|
|
312
|
-
|
|
406
|
+
j();
|
|
313
407
|
},
|
|
314
408
|
setHome(e, t) {
|
|
315
|
-
return
|
|
316
|
-
|
|
409
|
+
return V = e, H = t, () => {
|
|
410
|
+
V = () => null, H = () => !1;
|
|
317
411
|
};
|
|
318
412
|
},
|
|
319
413
|
onLayout(e) {
|
|
320
|
-
return
|
|
414
|
+
return k.add(e), () => void k.delete(e);
|
|
321
415
|
},
|
|
322
416
|
onWindows(e) {
|
|
323
|
-
return
|
|
417
|
+
return M.add(e), () => void M.delete(e);
|
|
324
418
|
},
|
|
325
419
|
onRaster(e) {
|
|
326
|
-
return
|
|
420
|
+
return P.add(e), () => void P.delete(e);
|
|
327
421
|
},
|
|
328
422
|
beforeFront(e) {
|
|
329
|
-
return
|
|
423
|
+
return F.add(e), () => void F.delete(e);
|
|
330
424
|
},
|
|
331
425
|
onFront(e) {
|
|
332
|
-
return
|
|
426
|
+
return I.add(e), () => void I.delete(e);
|
|
427
|
+
},
|
|
428
|
+
onDialogs(e) {
|
|
429
|
+
return L.add(e), () => void L.delete(e);
|
|
333
430
|
},
|
|
334
431
|
dispose() {
|
|
335
432
|
clearTimeout(Z);
|
|
336
|
-
for (let e of
|
|
337
|
-
|
|
433
|
+
for (let e of _) e();
|
|
434
|
+
k.clear(), M.clear(), P.clear(), F.clear(), I.clear(), L.clear();
|
|
435
|
+
for (let { observer: e } of R.values()) e.disconnect();
|
|
436
|
+
R.clear(), z = [], S.clear();
|
|
437
|
+
for (let e of x.keys()) e.remove();
|
|
438
|
+
x.clear();
|
|
338
439
|
}
|
|
339
440
|
};
|
|
340
|
-
return
|
|
441
|
+
return Y = le(h.activeWindow), $;
|
|
341
442
|
}
|
|
342
443
|
//#endregion
|
|
343
|
-
export {
|
|
444
|
+
export { te as createWindowManager, h as deepActiveElement, m as desktopRendered, ee as focusInto };
|
package/dist/text-control.d.ts
CHANGED
|
@@ -87,6 +87,18 @@ export declare class VfTextControlBase extends VfShadowRoleControl {
|
|
|
87
87
|
* wrapper once and can't drift on what turns the rule on.
|
|
88
88
|
*/
|
|
89
89
|
protected get wellClass(): string;
|
|
90
|
+
/**
|
|
91
|
+
* The text as last committed: taken when the field gains focus, then at
|
|
92
|
+
* each commit. A commit that brings nothing new isn't announced, so the
|
|
93
|
+
* native `change` that follows a Return commit, or a step, is not a second
|
|
94
|
+
* one.
|
|
95
|
+
*/
|
|
96
|
+
protected committed: string | null;
|
|
97
|
+
constructor();
|
|
98
|
+
/** The inner native control every field renders, tagged `vf-field`. */
|
|
99
|
+
protected get control(): HTMLInputElement | HTMLTextAreaElement | null;
|
|
100
|
+
/** Select all of the field's text, as a native field's `select()` does. */
|
|
101
|
+
select(): void;
|
|
90
102
|
connectedCallback(): void;
|
|
91
103
|
/**
|
|
92
104
|
* Re-submit the value only when it (or the disabled state gating it) actually
|
|
@@ -117,6 +129,12 @@ export declare class VfTextControlBase extends VfShadowRoleControl {
|
|
|
117
129
|
* disabled default button means no submission at all, as in HTML; a form
|
|
118
130
|
* with no submit button falls back to the bare call, also as in HTML.
|
|
119
131
|
*
|
|
132
|
+
* One departure: a submit `vf-button variant="default"`, the button with
|
|
133
|
+
* the ring, is the default button when the form has one, ahead of the
|
|
134
|
+
* first in tree order. A Cancel/OK row puts Cancel first, and Return
|
|
135
|
+
* should press the button the ring marks — the one a modal's own Return
|
|
136
|
+
* rule presses (`VfModalDialog`).
|
|
137
|
+
*
|
|
120
138
|
* Returns whether a form owner took the press — true even when a disabled
|
|
121
139
|
* default button meant no submission, since HTML gave the press to the form
|
|
122
140
|
* either way. The callers cancel the keydown on true, so a modal shell
|
|
@@ -133,6 +151,17 @@ export declare class VfTextControlBase extends VfShadowRoleControl {
|
|
|
133
151
|
protected emitValue(type: 'vf-input' | 'vf-change', detail?: Record<string, unknown>): void;
|
|
134
152
|
/** Mirror the native control's value into `value` and announce a keystroke. */
|
|
135
153
|
protected handleInput(event: Event): void;
|
|
136
|
-
/**
|
|
154
|
+
/** The committed form of typed text: as typed here; `vf-number-field` clamps and rounds it. */
|
|
155
|
+
protected committedText(raw: string): string;
|
|
156
|
+
/** Commit typed text: its committed form into `value`, announced unless it is what was last committed. */
|
|
157
|
+
protected commit(raw: string): void;
|
|
158
|
+
/** The native control's commit. */
|
|
137
159
|
protected handleChange(event: Event): void;
|
|
160
|
+
/**
|
|
161
|
+
* A plain Return in a single-line field with a form: commit, then the
|
|
162
|
+
* form's implicit submission, the order a native input keeps (its `change`
|
|
163
|
+
* comes before the submission). The keydown is cancelled, so an enclosing
|
|
164
|
+
* modal does not route the same press to its default button as well.
|
|
165
|
+
*/
|
|
166
|
+
protected submitOnEnter(event: KeyboardEvent): void;
|
|
138
167
|
}
|