vintage-frames 0.15.0 → 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.
Files changed (47) hide show
  1. package/custom-elements.json +681 -65
  2. package/dist/chrome.d.ts +10 -1
  3. package/dist/chrome.js +8 -3
  4. package/dist/components/vf-desktop.d.ts +5 -2
  5. package/dist/components/vf-desktop.js +5 -5
  6. package/dist/components/vf-dialog.d.ts +7 -2
  7. package/dist/components/vf-dialog.js +27 -27
  8. package/dist/components/vf-menu-bar.js +9 -10
  9. package/dist/components/vf-menu-item.js +18 -13
  10. package/dist/components/vf-menu.d.ts +8 -3
  11. package/dist/components/vf-menu.js +85 -61
  12. package/dist/components/vf-number-field.d.ts +4 -0
  13. package/dist/components/vf-number-field.js +28 -25
  14. package/dist/components/vf-paragraph.d.ts +3 -1
  15. package/dist/components/vf-paragraph.js +7 -0
  16. package/dist/components/vf-scroll-area.d.ts +16 -1
  17. package/dist/components/vf-scroll-area.js +39 -29
  18. package/dist/components/vf-select.d.ts +5 -4
  19. package/dist/components/vf-select.js +26 -17
  20. package/dist/components/vf-text-field.d.ts +5 -5
  21. package/dist/components/vf-text-field.js +1 -1
  22. package/dist/components/vf-window.d.ts +22 -5
  23. package/dist/components/vf-window.js +113 -98
  24. package/dist/cursor.d.ts +8 -0
  25. package/dist/cursor.js +70 -73
  26. package/dist/index.d.ts +2 -1
  27. package/dist/modal-dialog.d.ts +20 -2
  28. package/dist/modal-dialog.js +63 -51
  29. package/dist/shell/catalog.d.ts +1 -1
  30. package/dist/shell/catalog.js +32 -18
  31. package/dist/shell/finder.d.ts +6 -1
  32. package/dist/shell/finder.js +182 -176
  33. package/dist/shell/index.d.ts +1 -1
  34. package/dist/shell/pure.d.ts +10 -0
  35. package/dist/shell/pure.js +4 -0
  36. package/dist/shell/shell.d.ts +16 -3
  37. package/dist/shell/shell.js +141 -126
  38. package/dist/shell/windows.d.ts +48 -10
  39. package/dist/shell/windows.js +142 -85
  40. package/dist/text-control.d.ts +24 -1
  41. package/dist/text-control.js +25 -4
  42. package/dist/top-layer.d.ts +13 -0
  43. package/dist/top-layer.js +16 -0
  44. package/docs/SPEC.md +23 -22
  45. package/editor/vscode.html-custom-data.json +21 -11
  46. package/editor/web-types.json +51 -23
  47. package/package.json +5 -1
@@ -12,43 +12,49 @@ 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 h = (e) => {
24
+ var g = (e) => {
21
25
  let t = document.activeElement;
22
26
  return !!t && (t === e || e.contains(t));
23
27
  };
24
- async function g(e, { when: t } = {}) {
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
- for (let t of n) if (!(t.closest("[hidden]") || !t.checkVisibility()) && !(t.tabIndex < 0 && !t.localName.startsWith("vf-")) && (t.focus({ preventScroll: !0 }), h(e))) return !0;
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 ee(m, ee) {
31
- let { defaultApp: te, savedPin: ne = () => null } = ee, _ = [], v = (e, t, n) => {
36
+ function te(h, te) {
37
+ let { defaultApp: ne, savedPin: re = () => null } = te, _ = [], v = (e, t, n) => {
32
38
  e.addEventListener(t, n), _.push(() => e.removeEventListener(t, n));
33
39
  }, y = () => ({
34
- width: m.width,
35
- height: m.height
36
- }), b = () => m.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 = {}, O = () => a(b().top, D), k = /* @__PURE__ */ new Set(), A = !1, j = () => {
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 = () => {
37
43
  if (!A) for (let e of [...k]) e();
38
44
  }, M = /* @__PURE__ */ new Set(), N = () => {
39
45
  for (let e of [...M]) e();
40
- }, P = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map(), z = [], re = (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) => {
41
47
  for (let t = e; t; t = t.parentElement) if (R.has(t)) return t;
42
48
  return null;
43
- }, B = (e) => e.isConnected && (e.matches("vf-dialog[open]") || !!e.querySelector("vf-dialog[open]")), V = () => {
44
- let e = z.filter((e) => R.has(e) && B(e));
45
- for (let t of R.keys()) !e.includes(t) && B(t) && e.push(t);
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);
46
52
  if (!(e.length === z.length && e.every((e, t) => e === z[t]))) {
47
53
  z = e;
48
54
  for (let e of [...L]) e();
49
55
  }
50
- }, H = () => null, U = () => !1;
51
- function W(n, r) {
56
+ }, V = () => null, H = () => !1;
57
+ function U(n, r) {
52
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;
53
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)))));
54
60
  let p = u ?? n.width ?? 0, m = d ?? n.height ?? 0;
@@ -59,11 +65,21 @@ function ee(m, ee) {
59
65
  height: d
60
66
  };
61
67
  }
62
- let G = (t, n) => {
68
+ let W = (t, n) => {
63
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);
64
- }, K = (e) => {
70
+ }, G = (e) => {
65
71
  let t = x.get(e)?.place;
66
- return t ? W(e, t(b())) : null;
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
+ };
67
83
  }, q = (e, t) => {
68
84
  let n = x.get(e)?.policy;
69
85
  if (n) return n(t);
@@ -76,7 +92,7 @@ function ee(m, ee) {
76
92
  width: r,
77
93
  height: i
78
94
  } };
79
- }, J = (e, t, n = q(e, p(e))) => W(e, c(t, y(), O(), n)), ie = (e, t) => {
95
+ }, J = (e, t, n = q(e, p(e))) => U(e, c(t, y(), O(), n)), se = (e, t) => {
80
96
  let n = p(e);
81
97
  return [
82
98
  "left",
@@ -87,62 +103,81 @@ function ee(m, ee) {
87
103
  let r = t[e];
88
104
  return r == null || !Number.isFinite(r) || n[e] === r;
89
105
  });
90
- }, ae = (e) => {
106
+ }, ce = (e) => {
91
107
  let t = [...x].filter(([t, n]) => t !== e && !t.hidden && !n.palette).map(([e]) => p(e));
92
108
  return r(l(b()), t).slot;
93
- }, Y = te, X = (e) => e instanceof n && x.get(e)?.app || te;
94
- function oe() {
109
+ }, Y = ne, le = (e) => e instanceof n && x.get(e)?.app || ne;
110
+ function ue() {
95
111
  let e = !1;
96
112
  for (let [t, n] of x) {
97
113
  if (!n.palette) continue;
98
114
  let r = n.app === Y && n.palette();
99
- t.hidden !== !r && (t.hidden = !r, r && m.bringToFront(t), e = !0);
115
+ t.hidden !== !r && (t.hidden = !r, r && h.bringToFront(t), e = !0);
100
116
  }
101
117
  e && j();
102
118
  }
103
- let se = (e) => {
119
+ let de = (e) => {
104
120
  let t = document.activeElement?.closest("vf-window");
105
- !(t instanceof n) || t === e || !x.has(t) || x.get(t).palette || (e ? Z(e) : U(null, null));
106
- }, Z = (e) => void g(e, { when: () => m.activeWindow === e }), ce = (e) => {
107
- se(e);
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);
108
124
  for (let t of [...F]) t(e);
109
- let t = X(e);
125
+ let t = le(e);
110
126
  if (t !== Y) {
111
- Y = t, oe();
127
+ Y = t, ue();
112
128
  for (let e of [...I]) e(Y);
113
129
  }
114
130
  };
115
- v(m, "vf-activate", (e) => ce(e.detail.window)), v(m, "vf-close", (e) => {
116
- let t = e.target;
117
- t instanceof n && x.has(t) && $.requestClose(t);
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);
118
136
  });
119
- let Q = 0, le = (e) => {
120
- !(e.target instanceof n) || !x.has(e.target) || Q || (Q = window.setTimeout(() => {
121
- Q = 0, j();
137
+ let Z = 0, pe = (e) => {
138
+ !(e.target instanceof n) || !x.has(e.target) || Z || (Z = window.setTimeout(() => {
139
+ Z = 0, j();
122
140
  }, 0));
123
141
  };
124
- m.addEventListener("vf-placement-change", le), _.push(() => m.removeEventListener("vf-placement-change", le)), v(m, "vf-resize", (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) => {
125
146
  e.detail?.commit && j();
126
147
  });
127
- let ue = (e) => {
148
+ let me = (e) => {
128
149
  let t = x.get(e);
129
150
  t && (x.delete(e), E.delete(e), t.palette || N(), j());
130
- }, de = (n, r, i, a) => {
151
+ }, he = (n, r, i, a) => {
131
152
  let l = p(n), u = x.get(n);
132
153
  if (u?.keep && o(l, u.keep(a))) {
133
- G(n, W(n, u.keep(b())));
154
+ W(n, U(n, u.keep(b())));
155
+ return;
156
+ }
157
+ let d = K(n, a);
158
+ if (d && o(l, d)) {
159
+ W(n, U(n, K(n)));
134
160
  return;
135
161
  }
136
- let d = E.get(n), f = !!d && n.resizable && (d.width !== l.width || d.height !== l.height), m = !d || d.left !== l.left || d.top !== l.top || f || !d ? s(l, r, O()) : d.pin, h = c(m, i, O(), q(n, l));
137
- if (n.left = e(h.left, n), n.top = e(h.top, n), n.resizable) {
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) {
138
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;
139
- n.width = Math.min(e(h.width, n), o), n.height = Math.min(e(h.height, n), s);
165
+ n.width = Math.min(e(g.width, n), o), n.height = Math.min(e(g.height, n), s);
140
166
  }
141
167
  E.set(n, {
142
- pin: m,
168
+ pin: h,
143
169
  ...p(n)
144
170
  });
145
- }, $ = {
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 $ = {
146
181
  get area() {
147
182
  return b();
148
183
  },
@@ -157,40 +192,37 @@ function ee(m, ee) {
157
192
  place: t.place ?? null,
158
193
  policy: t.policy ?? null,
159
194
  keep: t.keep ?? null,
195
+ zoom: t.zoom ?? null,
160
196
  palette: n ? n === !0 ? () => !0 : n : null,
161
197
  close: t.close ?? null
162
- }), t.pin) G(e, J(e, t.pin));
163
- else {
164
- let t = K(e);
165
- t && G(e, t);
166
- }
167
- if (n) {
198
+ }), ge(e, t.pin ?? null), _e || Q.set(e, t.pin ?? null), n) {
168
199
  let t = x.get(e);
169
200
  e.hidden = !(t.app === Y && t.palette());
170
201
  }
171
- m.activeWindow === e && ce(e), n || N(), j();
202
+ h.activeWindow === e && fe(e), n || N(), j();
172
203
  },
173
204
  open(e) {
174
205
  let t = e.item == null ? null : $.windowFor(e.item);
175
- if (t) return m.bringToFront(t), Z(t), t;
206
+ if (t) return h.bringToFront(t), X(t), t;
176
207
  let n = e.create(), r = {
177
208
  width: n.width ?? 0,
178
209
  height: n.height ?? 0
179
- }, a = ae();
180
- m.append(n);
210
+ }, a = ce();
211
+ h.append(n);
181
212
  let o = e.item ?? null;
182
213
  return $.adopt(n, {
183
214
  app: e.app,
184
215
  item: o,
185
216
  place: e.place ?? ((e) => i(e, r, l(e), a)),
186
- pin: o == null ? null : C.get(o)?.pin ?? ne(o),
217
+ pin: o == null ? null : C.get(o)?.pin ?? re(o),
187
218
  policy: e.policy ?? null,
188
219
  keep: e.keep ?? null,
220
+ zoom: e.zoom ?? null,
189
221
  close: e.close ?? null
190
- }), o != null && C.delete(o), m.bringToFront(n), e.from && n.show({ from: e.from }), Z(n), n;
222
+ }), o != null && C.delete(o), h.bringToFront(n), e.from && n.show({ from: e.from }), X(n), n;
191
223
  },
192
224
  close(e, { to: t } = {}) {
193
- let n = x.get(e), r = n?.item ?? null, i = n?.app ?? null, a = t === void 0 ? i == null ? null : H(r, i) : t, o = m.activeWindow === e || h(e);
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);
194
226
  r != null && i != null && C.set(r, {
195
227
  app: i,
196
228
  pin: s(p(e), y(), O())
@@ -200,35 +232,40 @@ function ee(m, ee) {
200
232
  let l = () => {
201
233
  r != null && d(w, r), i != null && !n?.palette && d(T, i), N();
202
234
  };
203
- return c.then(l, l), ue(e), e.remove(), o && queueMicrotask(() => {
204
- let e = m.activeWindow;
205
- e ? Z(e) : U(r, i) || U(null, null);
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);
206
238
  }), c;
207
239
  },
208
- requestClose(e) {
209
- let t = x.get(e)?.close;
210
- t ? t(e) : $.close(e);
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;
211
248
  },
212
249
  windowFor(e) {
213
250
  for (let [t, n] of x) if (n.item === e) return t;
214
251
  return null;
215
252
  },
216
253
  windowsOf(e) {
217
- return m.stackingOrder.filter((t) => t instanceof n && x.get(t)?.app === e);
254
+ return h.stackingOrder.filter((t) => t instanceof n && x.get(t)?.app === e);
218
255
  },
219
256
  itemOf(e) {
220
257
  return e instanceof n ? x.get(e)?.item ?? null : null;
221
258
  },
222
259
  appOf(e) {
223
260
  if (e instanceof n) return x.get(e)?.app ?? null;
224
- let t = re(e);
261
+ let t = ae(e);
225
262
  return t ? R.get(t).app : null;
226
263
  },
227
264
  holdDialog(e, { app: t }) {
228
265
  let n = R.get(e);
229
266
  if (n) n.app = t;
230
267
  else {
231
- let n = new MutationObserver(V);
268
+ let n = new MutationObserver(B);
232
269
  n.observe(e, {
233
270
  attributes: !0,
234
271
  attributeFilter: ["open"],
@@ -238,11 +275,11 @@ function ee(m, ee) {
238
275
  observer: n
239
276
  });
240
277
  }
241
- m.contains(e) || m.append(e), V();
278
+ h.contains(e) || h.append(e), B();
242
279
  },
243
280
  releaseDialog(e) {
244
281
  let t = R.get(e);
245
- t && (t.observer.disconnect(), R.delete(e), V());
282
+ t && (t.observer.disconnect(), R.delete(e), B());
246
283
  },
247
284
  dialogsOf(e) {
248
285
  return [...R].filter(([, t]) => t.app === e).map(([e]) => e);
@@ -267,16 +304,34 @@ function ee(m, ee) {
267
304
  return !1;
268
305
  },
269
306
  palettesChanged() {
270
- oe();
307
+ ue();
271
308
  },
272
309
  write(e, t) {
273
- G(e, t), j();
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();
274
329
  },
275
330
  clamped(e, t) {
276
- return W(e, t);
331
+ return U(e, t);
277
332
  },
278
333
  placed(e) {
279
- return K(e);
334
+ return G(e);
280
335
  },
281
336
  pinOf(e) {
282
337
  return s(p(e), y(), O());
@@ -285,7 +340,7 @@ function ee(m, ee) {
285
340
  return J(e, t, n);
286
341
  },
287
342
  setFrameBands(e) {
288
- D = { ...e }, E = /* @__PURE__ */ new WeakMap();
343
+ ie = { ...e }, E = /* @__PURE__ */ new WeakMap();
289
344
  },
290
345
  arrangeWith(e, t) {
291
346
  return S.set(e, t), j(), () => {
@@ -297,8 +352,8 @@ function ee(m, ee) {
297
352
  try {
298
353
  for (let e of S.values()) e.arrange();
299
354
  for (let e of x.keys()) {
300
- let t = K(e);
301
- t && G(e, t);
355
+ let t = G(e);
356
+ t && W(e, t);
302
357
  }
303
358
  } finally {
304
359
  A = !1;
@@ -308,8 +363,8 @@ function ee(m, ee) {
308
363
  arranged() {
309
364
  for (let e of S.values()) if (!e.arranged()) return !1;
310
365
  for (let e of x.keys()) {
311
- let t = K(e);
312
- if (t && !e.hidden && !ie(e, t)) return !1;
366
+ let t = G(e);
367
+ if (t && !e.hidden && !se(e, t)) return !1;
313
368
  }
314
369
  return !0;
315
370
  },
@@ -322,14 +377,14 @@ function ee(m, ee) {
322
377
  width: e.width - n.left,
323
378
  height: Math.max(0, e.height - n.top)
324
379
  };
325
- for (let n of x.keys()) de(n, e, t, r);
380
+ for (let n of x.keys()) he(n, e, t, r);
326
381
  for (let n of [...P]) n(e, t);
327
382
  j();
328
383
  },
329
384
  snapshot() {
330
385
  let e = {};
331
386
  for (let [t, n] of C) e[t] = { ...n };
332
- let t = m.stackingOrder;
387
+ let t = h.stackingOrder;
333
388
  for (let [n, r] of x) {
334
389
  if (r.item == null) continue;
335
390
  let i = s(p(n), y(), O());
@@ -351,8 +406,8 @@ function ee(m, ee) {
351
406
  j();
352
407
  },
353
408
  setHome(e, t) {
354
- return H = e, U = t, () => {
355
- H = () => null, U = () => !1;
409
+ return V = e, H = t, () => {
410
+ V = () => null, H = () => !1;
356
411
  };
357
412
  },
358
413
  onLayout(e) {
@@ -374,14 +429,16 @@ function ee(m, ee) {
374
429
  return L.add(e), () => void L.delete(e);
375
430
  },
376
431
  dispose() {
377
- clearTimeout(Q);
432
+ clearTimeout(Z);
378
433
  for (let e of _) e();
379
434
  k.clear(), M.clear(), P.clear(), F.clear(), I.clear(), L.clear();
380
435
  for (let { observer: e } of R.values()) e.disconnect();
381
- R.clear(), z = [], S.clear(), x.clear();
436
+ R.clear(), z = [], S.clear();
437
+ for (let e of x.keys()) e.remove();
438
+ x.clear();
382
439
  }
383
440
  };
384
- return Y = X(m.activeWindow), $;
441
+ return Y = le(h.activeWindow), $;
385
442
  }
386
443
  //#endregion
387
- export { ee as createWindowManager, m as deepActiveElement, g as focusInto };
444
+ export { te as createWindowManager, h as deepActiveElement, m as desktopRendered, ee as focusInto };
@@ -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
@@ -139,6 +151,17 @@ export declare class VfTextControlBase extends VfShadowRoleControl {
139
151
  protected emitValue(type: 'vf-input' | 'vf-change', detail?: Record<string, unknown>): void;
140
152
  /** Mirror the native control's value into `value` and announce a keystroke. */
141
153
  protected handleInput(event: Event): void;
142
- /** Mirror the native control's value into `value` and announce a commit. */
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. */
143
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;
144
167
  }
@@ -8,9 +8,6 @@ import { nothing as s } from "lit";
8
8
  import { property as c } from "lit/decorators.js";
9
9
  //#region src/text-control.ts
10
10
  var l = class extends a {
11
- constructor(...e) {
12
- super(...e), 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);
13
- }
14
11
  static {
15
12
  this.shadowRootOptions = {
16
13
  ...a.shadowRootOptions,
@@ -42,6 +39,20 @@ var l = class extends a {
42
39
  get wellClass() {
43
40
  return `vf-field-well vf-snap${this.focusRule.marked ? " vf-focus-rule" : ""}`;
44
41
  }
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", () => {
44
+ this.committed = this.value;
45
+ }), this.addEventListener("focusout", () => {
46
+ let e = this.control;
47
+ e && this.commit(e.value);
48
+ });
49
+ }
50
+ get control() {
51
+ return this.renderRoot.querySelector(".vf-field");
52
+ }
53
+ select() {
54
+ this.control?.select();
55
+ }
45
56
  connectedCallback() {
46
57
  super.connectedCallback(), this.latchFormDefault(this.value);
47
58
  }
@@ -66,8 +77,18 @@ var l = class extends a {
66
77
  handleInput(e) {
67
78
  this.value = e.target.value, this.emitValue("vf-input");
68
79
  }
80
+ committedText(e) {
81
+ return e;
82
+ }
83
+ commit(e) {
84
+ let n = this.committedText(e);
85
+ this.value = n, n !== this.committed && (this.committed = n, this.emitValue("vf-change"), t(this, "change"));
86
+ }
69
87
  handleChange(e) {
70
- this.value = e.target.value, this.emitValue("vf-change"), t(this, "change");
88
+ this.commit(e.target.value);
89
+ }
90
+ submitOnEnter(e) {
91
+ !this.isSubmitEnter(e) || !this.internals.form || (this.commit(e.target.value), this.requestImplicitSubmit() && e.preventDefault());
71
92
  }
72
93
  };
73
94
  r([c()], l.prototype, "value", void 0), r([c()], l.prototype, "placeholder", void 0), r([c({
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The kit's entries into the top layer. Whatever enters the top layer later
3
+ * paints over what entered before, so an overlay that must stay above
4
+ * everything — the drawn cursor (src/cursor.ts) — re-promotes itself after
5
+ * each kit entry. A popup shown here escapes every stacking context on its
6
+ * way up: a window's z-index can't hold it under a palette.
7
+ */
8
+ /** Show a manual popover in the top layer, then let the overlays above it re-promote. */
9
+ export declare function showInTopLayer(el: HTMLElement): void;
10
+ /** Take a popover {@link showInTopLayer} showed back out of the top layer. */
11
+ export declare function hideFromTopLayer(el: HTMLElement): void;
12
+ /** Run `fn` after every kit entry into the top layer. Returns the unsubscribe. */
13
+ export declare function onTopLayerEntry(fn: () => void): () => void;
@@ -0,0 +1,16 @@
1
+ //#region src/top-layer.ts
2
+ var e = /* @__PURE__ */ new Set();
3
+ function t(t) {
4
+ if (!(!("showPopover" in t) || !t.isConnected || t.matches(":popover-open"))) {
5
+ t.showPopover();
6
+ for (let t of [...e]) t();
7
+ }
8
+ }
9
+ function n(e) {
10
+ "hidePopover" in e && e.matches(":popover-open") && e.hidePopover();
11
+ }
12
+ function r(t) {
13
+ return e.add(t), () => void e.delete(t);
14
+ }
15
+ //#endregion
16
+ export { n as hideFromTopLayer, r as onTopLayerEntry, t as showInTopLayer };