vintage-frames 0.14.0 → 0.15.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 (55) hide show
  1. package/README.md +16 -0
  2. package/custom-elements.json +271 -27
  3. package/dist/components/vf-button.d.ts +5 -1
  4. package/dist/components/vf-button.js +1 -1
  5. package/dist/components/vf-container.d.ts +3 -1
  6. package/dist/components/vf-container.js +34 -16
  7. package/dist/components/vf-desktop.d.ts +114 -12
  8. package/dist/components/vf-desktop.js +119 -58
  9. package/dist/components/vf-dialog.d.ts +7 -1
  10. package/dist/components/vf-icon-field.d.ts +1 -1
  11. package/dist/components/vf-icon.js +68 -61
  12. package/dist/components/vf-menu-bar.d.ts +5 -0
  13. package/dist/components/vf-menu-bar.js +67 -43
  14. package/dist/components/vf-window.d.ts +13 -0
  15. package/dist/components/vf-window.js +10 -1
  16. package/dist/events.d.ts +3 -2
  17. package/dist/events.js +3 -3
  18. package/dist/index.d.ts +3 -1
  19. package/dist/index.js +44 -43
  20. package/dist/modal-dialog.d.ts +31 -4
  21. package/dist/modal-dialog.js +98 -82
  22. package/dist/pattern-fill.d.ts +11 -8
  23. package/dist/pattern-fill.js +2 -4
  24. package/dist/position.d.ts +25 -7
  25. package/dist/position.js +31 -23
  26. package/dist/shell/alert.d.ts +40 -0
  27. package/dist/shell/alert.js +41 -0
  28. package/dist/shell/catalog.d.ts +168 -0
  29. package/dist/shell/catalog.js +278 -0
  30. package/dist/shell/clock.d.ts +16 -0
  31. package/dist/shell/clock.js +36 -0
  32. package/dist/shell/filing.d.ts +39 -0
  33. package/dist/shell/filing.js +68 -0
  34. package/dist/shell/finder.d.ts +156 -0
  35. package/dist/shell/finder.js +598 -0
  36. package/dist/shell/geometry.d.ts +196 -0
  37. package/dist/shell/geometry.js +241 -0
  38. package/dist/shell/index.d.ts +27 -0
  39. package/dist/shell/index.js +10 -0
  40. package/dist/shell/shell.d.ts +164 -0
  41. package/dist/shell/shell.js +234 -0
  42. package/dist/shell/state.d.ts +88 -0
  43. package/dist/shell/state.js +103 -0
  44. package/dist/shell/storage.d.ts +14 -0
  45. package/dist/shell/storage.js +41 -0
  46. package/dist/shell/windows.d.ts +234 -0
  47. package/dist/shell/windows.js +387 -0
  48. package/dist/text-control.d.ts +6 -0
  49. package/dist/text-control.js +2 -2
  50. package/dist/window-chrome.d.ts +43 -0
  51. package/dist/window-chrome.js +13 -0
  52. package/docs/SPEC.md +17 -16
  53. package/editor/vscode.html-custom-data.json +11 -6
  54. package/editor/web-types.json +55 -14
  55. package/package.json +10 -2
@@ -75,7 +75,11 @@ export declare class VfButton extends VfButton_base {
75
75
  type: 'button' | 'submit' | 'reset';
76
76
  /** Form field name; submitted as `name=value` when `type="submit"`. */
77
77
  name: string;
78
- /** Value submitted under `name` when `type="submit"`. */
78
+ /**
79
+ * Value submitted under `name` when `type="submit"`. In a
80
+ * `<form method="dialog">` inside a `vf-dialog`, the dialog's answer
81
+ * (`returnValue`), with or without a `name`.
82
+ */
79
83
  value: string;
80
84
  /**
81
85
  * The submission overrides native `<button>` carries, honored on
@@ -253,7 +253,7 @@ var S = "vf-submitter", C = class extends i(h) {
253
253
  let e = this.resolvedType;
254
254
  if (!this.internals.form || e === "button" || this.isDisabled) return;
255
255
  let t = document.createElement("button");
256
- t.type = e, t.slot = S, t.addEventListener("click", (e) => e.stopPropagation()), e === "submit" && (this.name && (t.name = this.name, t.value = this.value), this.formAction && (t.formAction = this.formAction), this.formEnctype && (t.formEnctype = this.formEnctype), this.formMethod && (t.formMethod = this.formMethod), this.formTarget && (t.formTarget = this.formTarget), t.formNoValidate = this.formNoValidate), this.#e = !0;
256
+ t.type = e, t.slot = S, t.addEventListener("click", (e) => e.stopPropagation()), e === "submit" && (this.name && (t.name = this.name), t.value = this.value, this.formAction && (t.formAction = this.formAction), this.formEnctype && (t.formEnctype = this.formEnctype), this.formMethod && (t.formMethod = this.formMethod), this.formTarget && (t.formTarget = this.formTarget), t.formNoValidate = this.formNoValidate), this.#e = !0;
257
257
  try {
258
258
  this.append(t), t.click();
259
259
  } finally {
@@ -43,7 +43,9 @@ declare const VfContainer_base: (new (...args: any[]) => import("../size.js").Vf
43
43
  *
44
44
  * **It paints nothing and means nothing** — unless `pattern` or `rule` say
45
45
  * what to paint. No role, keyboard behavior or selection; what it holds
46
- * decides what it is.
46
+ * decides what it is. A page that gives it a role and a `tabindex` — a
47
+ * pattern chooser's cells as radios — gets the kit's keyboard focus mark
48
+ * rather than the browser's ring: the dashed rule below the box.
47
49
  *
48
50
  * **`rule` draws the 1px rule on the edges it names** — `rule="bottom"` is
49
51
  * the menu bar's anatomy (the box's rows over one row of ink), `rule="top"`
@@ -4,16 +4,18 @@ import n from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/decorate.js
4
4
  import { VfPositioned as r } from "../position.js";
5
5
  import { vfBase as i } from "../styles/recipes/host.js";
6
6
  import { parsePattern as a } from "../patterns.js";
7
- import { parseRule as o, ruleClasses as s, vfRule as c } from "../styles/recipes/rule.js";
8
- import { PatternFillController as l, vfPatternFill as u } from "../pattern-fill.js";
9
- import { GridSnapController as d } from "../grid-snap.js";
10
- import { VfSized as f } from "../size.js";
11
- import { LitElement as p, css as m, html as h } from "lit";
12
- import { property as g, query as _ } from "lit/decorators.js";
7
+ import { vfStrokeInset as o } from "../styles/recipes/stroke.js";
8
+ import { parseRule as s, ruleClasses as c, vfRule as l } from "../styles/recipes/rule.js";
9
+ import { vfFocusUnderline as u } from "../styles/recipes/focus.js";
10
+ import { PatternFillController as d, vfPatternFill as f } from "../pattern-fill.js";
11
+ import { GridSnapController as p } from "../grid-snap.js";
12
+ import { VfSized as m } from "../size.js";
13
+ import { LitElement as h, css as g, html as _ } from "lit";
14
+ import { property as v, query as y } from "lit/decorators.js";
13
15
  //#region src/components/vf-container.ts
14
- var v = class extends f(r(p)) {
16
+ var b = class extends m(r(h)) {
15
17
  constructor(...e) {
16
- super(...e), this._pattern = null, this.#e = !1, this._rule = [], this.#t = !1, this.scale = new t(this), this.gridSnap = new d(this), this.patternFill = new l(this, {
18
+ super(...e), this._pattern = null, this.#e = !1, this._rule = [], this.#t = !1, this.scale = new t(this), this.gridSnap = new p(this), this.patternFill = new d(this, {
17
19
  getBox: () => this.box,
18
20
  getPattern: () => this._pattern
19
21
  });
@@ -21,9 +23,9 @@ var v = class extends f(r(p)) {
21
23
  static {
22
24
  this.styles = [
23
25
  i,
24
- u,
25
- c,
26
- m`
26
+ f,
27
+ l,
28
+ g`
27
29
  :host {
28
30
  display: block;
29
31
  /* Shrink-wrap an undeclared axis rather than claim the parent's
@@ -74,6 +76,22 @@ var v = class extends f(r(p)) {
74
76
  height: 100%;
75
77
  }
76
78
 
79
+ /* A box the page makes focusable — a pattern chooser's cells as
80
+ radios, say — wears the kit's focus mark, not the browser's ring: the
81
+ dashed rule below the box, one blank row under it, since a box like
82
+ that is nothing but fill (vf-swatch's placement). The rule spans the
83
+ box; under forced colors a ruled box's stroke is a border outside the
84
+ padding box the rule measures from, so the insets grow by it there. */
85
+ :host(:focus-visible) {
86
+ outline: none;
87
+ }
88
+ :host(:focus-visible) .box::after {
89
+ ${u}
90
+ bottom: ${o(-3)};
91
+ left: ${o(-1)};
92
+ right: ${o(-1)};
93
+ }
94
+
77
95
  /* The same two words a child uses, read about the host itself — for the
78
96
  parents that can give this box a size: a window body, a filled stack
79
97
  column, a grid cell. A percentage is the one fill a page can always
@@ -105,19 +123,19 @@ var v = class extends f(r(p)) {
105
123
  #t;
106
124
  willUpdate(e) {
107
125
  if (super.willUpdate(e), e.has("pattern") && (this._pattern = a(this.pattern), this._pattern === null && this.pattern?.trim() && !this.#e && (this.#e = !0, console.warn(`vf-container: unknown pattern "${this.pattern}" — a library name (docs/PATTERNS.md) or sixteen hex digits. Painting nothing.`))), e.has("rule")) {
108
- let e = o(this.rule);
126
+ let e = s(this.rule);
109
127
  this._rule = e ?? [], e === null && !this.#t && (this.#t = !0, console.warn(`vf-container: unknown rule "${this.rule}" — edge names (top, right, bottom, left) separated by spaces. Drawing none.`));
110
128
  }
111
129
  }
112
130
  render() {
113
- let e = s(this._rule);
114
- return h`<div
131
+ let e = c(this._rule);
132
+ return _`<div
115
133
  class="vf-snap box vf-pattern-fill${this._pattern ? " vf-patterned" : ""}${e ? ` ${e}` : ""}"
116
134
  >
117
135
  <slot></slot>
118
136
  </div>`;
119
137
  }
120
138
  };
121
- n([g()], v.prototype, "pattern", void 0), n([g()], v.prototype, "rule", void 0), n([_(".box")], v.prototype, "box", void 0), v = n([e("vf-container")], v);
139
+ n([v()], b.prototype, "pattern", void 0), n([v()], b.prototype, "rule", void 0), n([y(".box")], b.prototype, "box", void 0), b = n([e("vf-container")], b);
122
140
  //#endregion
123
- export { v as VfContainer };
141
+ export { b as VfContainer };
@@ -36,6 +36,25 @@ declare const VfDesktop_base: (new (...args: any[]) => import("../position.js").
36
36
  * reads the current holder, and every change of holder — including to and
37
37
  * from none — fires `vf-activate`.
38
38
  *
39
+ * **Hidden windows.** A window with `hidden` — closed by a page that hides
40
+ * its windows rather than removing them, through `vf-window.hide()` or the
41
+ * attribute itself — never holds the active state. One slotted hidden waits
42
+ * to be shown; `bringToFront()` on one gives it its place in the stack and
43
+ * activates nothing; the holder hiding hands the state to the topmost shown
44
+ * document window, or to none. A window shown into a tier where none is
45
+ * active, unless the tier was deliberately deactivated, takes it.
46
+ * {@link stackingOrder} lists the windows as they stand, bottom-most first.
47
+ *
48
+ * **The work area.** A slotted `vf-menu-bar` along the top takes its band
49
+ * off the screen: {@link workArea} is what is left, and the gestures on the
50
+ * screen stay in it — a window dragged up stops with its title bar under the
51
+ * bar, where it can still be grabbed, and an icon dropped, nudged or walked
52
+ * on the desktop lands below the bar. `window-top` deepens the area for
53
+ * windows alone ({@link windowArea}), for a page with a strip of its own
54
+ * under the bar. A gesture asks for the box it is clamped into with
55
+ * `vf-placement-bounds-request` (bubbles, non-composed), the drag surface's
56
+ * handshake, and the desktop answers for the hosts placed on its screen.
57
+ *
39
58
  * The desktop is a raster with an explicit size, always: **`width` and
40
59
  * `height`**, in system px, the way a WIND resource declared a window's —
41
60
  * the host box renders at the declared screen plus `2 × bezel` per axis, a
@@ -88,8 +107,8 @@ declare const VfDesktop_base: (new (...args: any[]) => import("../position.js").
88
107
  * @fires vf-activate - The active document-tier window changed. Detail
89
108
  * `{ window: HTMLElement | null }` — the new holder, or `null` when the
90
109
  * document tier deactivated (a {@link clearActive} call, or the active
91
- * window leaving the DOM with none behind it). Fired once per change of
92
- * holder, never for a re-assertion of the same one.
110
+ * window leaving the DOM or hiding with no shown window behind it). Fired
111
+ * once per change of holder, never for a re-assertion of the same one.
93
112
  * @csspart desktop - The patterned screen surface — the whole-system-px
94
113
  * raster (inset by `bezel` when one is set).
95
114
  * @cssprop [--vf-desktop=#808080] - base color under the desktop pattern —
@@ -139,6 +158,38 @@ export declare class VfDesktop extends VfDesktop_base {
139
158
  * keeps the dither.
140
159
  */
141
160
  pattern: string | null | undefined;
161
+ /**
162
+ * The least `top` a window may take, in system px from the screen's top —
163
+ * for a page that keeps a strip of its own under the menu bar, over the
164
+ * windows. A window dragged on this desktop stops there, and
165
+ * {@link windowArea} starts there; icons still stop at the menu bar. Below
166
+ * the bar's bottom it changes nothing. Unset, windows stop at the bar.
167
+ */
168
+ windowTop?: number | null;
169
+ /**
170
+ * The screen less a slotted `vf-menu-bar` along its top edge, in system
171
+ * px from the screen's corner (the bezel excluded, as for
172
+ * {@link placementAt}): `{ left, top, width, height }`. The desktop clamps
173
+ * the gestures on its screen into it — an icon dropped, nudged or walked
174
+ * on the desktop lands below the menu bar, where it can be grabbed again.
175
+ * Without a bar it is the whole screen. Measured at the call.
176
+ */
177
+ get workArea(): {
178
+ left: number;
179
+ top: number;
180
+ width: number;
181
+ height: number;
182
+ };
183
+ /**
184
+ * {@link workArea}, deepened to {@link windowTop} where that is lower: the
185
+ * area windows are dragged in. A window's title bar never goes above it.
186
+ */
187
+ get windowArea(): {
188
+ left: number;
189
+ top: number;
190
+ width: number;
191
+ height: number;
192
+ };
142
193
  /**
143
194
  * Size the screen to the largest whole-system-px raster whose host box —
144
195
  * bezel included — fits a CSS-px bound, and return what was set. The
@@ -223,10 +274,13 @@ export declare class VfDesktop extends VfDesktop_base {
223
274
  private readonly _gestureEnd;
224
275
  connectedCallback(): void;
225
276
  disconnectedCallback(): void;
226
- /** Whether a slotted window belongs to the floating (utility) tier. The
227
- * attribute is the source of truth here so a not-yet-upgraded element
228
- * still lands in the right tier (variant reflects, so an upgraded
229
- * property-set window agrees). */
277
+ /** Whether a slotted window belongs to the floating (utility) tier: the
278
+ * `variant` property where the window has one, else the attribute, so a
279
+ * not-yet-upgraded element still lands in the right tier. Not the
280
+ * attribute alone — it reflects in the window's next update, after a
281
+ * window made by script and appended in the same task has been slotted,
282
+ * and that palette would land in the document tier and lose its
283
+ * `active`. */
230
284
  private _isUtility;
231
285
  /**
232
286
  * Bring a slotted window to the front of its tier. A document-tier window
@@ -247,8 +301,17 @@ export declare class VfDesktop extends VfDesktop_base {
247
301
  */
248
302
  bringToFront(win: HTMLElement): void;
249
303
  /** The active document-tier window, or null while the tier is deactivated
250
- * (or has no windows). Utility windows are never the holder. */
304
+ * (or has no shown windows). Utility windows and hidden windows are never
305
+ * the holder. */
251
306
  get activeWindow(): HTMLElement | null;
307
+ /**
308
+ * The slotted windows in stacking order, bottom-most first: the document
309
+ * tier, then the floating tier above it, each in the order its windows
310
+ * were last raised. Hidden windows are included where they stand. This is
311
+ * the order the eye sees; the windows' light-DOM order catches up with it
312
+ * only once a gesture ends, and a raise by keyboard focus moves no node.
313
+ */
314
+ get stackingOrder(): HTMLElement[];
252
315
  /**
253
316
  * Deactivate the whole document tier — clear `active` from every document
254
317
  * window, leaving none the holder. Pages route "the user clicked the
@@ -258,7 +321,11 @@ export declare class VfDesktop extends VfDesktop_base {
258
321
  * slotted.
259
322
  */
260
323
  clearActive(): void;
261
- /** The z/active half of a raise, shared by every path. */
324
+ /**
325
+ * The z/active half of a raise, shared by every path. A hidden window
326
+ * takes its place in the stack and nothing else: it activates when it is
327
+ * shown and raised.
328
+ */
262
329
  private _restack;
263
330
  /**
264
331
  * Schedule the DOM-order sync: one task from now, coalesced, and never
@@ -316,6 +383,19 @@ export declare class VfDesktop extends VfDesktop_base {
316
383
  * detail alone.
317
384
  */
318
385
  private _onDragSurfaceRequest;
386
+ /**
387
+ * A gesture measuring the box it is clamped into (src/position.ts): for a
388
+ * host placed on this screen — a slotted window, an icon in an unplaced
389
+ * field — the screen, bezel excluded, and the work area's top as the
390
+ * floor: {@link windowArea}'s for a window, {@link workArea}'s for
391
+ * anything else. The floor is rounded up to the host's placement lattice,
392
+ * so a snapped landing never rounds above it. A host placed in a box of its
393
+ * own (a window body, a placed field) is that box's; an outer desktop
394
+ * leaves a filled detail alone.
395
+ */
396
+ private _onBoundsRequest;
397
+ /** The bottom of a slotted, shown menu bar along the screen's top edge, system px; else 0. */
398
+ private _menuBarFloor;
319
399
  /**
320
400
  * Delegated focusin: raise the window keyboard focus entered, so tabbing
321
401
  * into a background window brings it to front (and reveals its close/zoom
@@ -329,6 +409,19 @@ export declare class VfDesktop extends VfDesktop_base {
329
409
  private _windowFromEvent;
330
410
  /** Wire up newly slotted windows: seed z-indices, normalize `active`. */
331
411
  private _onSlotChange;
412
+ /**
413
+ * Resolve who should hold `active` after the window set or a window's
414
+ * visibility changed: a holder still slotted and shown keeps it, a
415
+ * deliberate deactivation is preserved (never promote a survivor over the
416
+ * user's "clicked the Finder"), and only then does the topmost shown
417
+ * window inherit — the active window left the DOM or was hidden, or a
418
+ * window was shown into a tier with none active. Applied even when null,
419
+ * so a stray `active` attribute on slotted markup, or on a hidden window,
420
+ * is normalized in the deactivated state too.
421
+ */
422
+ private _resolveActive;
423
+ /** Watch the `hidden` attribute of every slotted window, and no other. */
424
+ private _observeWindows;
332
425
  /**
333
426
  * Re-assert the single-active-window state after slotted `<vf-window>`
334
427
  * elements upgrade. One-shot: the flag collapses repeat slotchanges into a
@@ -365,15 +458,24 @@ export declare class VfDesktop extends VfDesktop_base {
365
458
  * Minimal-move: windows already in relative order are never touched (the
366
459
  * common case — after one raise, one window moves). Non-window siblings
367
460
  * (a menu bar, page content) keep their positions; only a window that must
368
- * cross the stack moves past them. Moving a node containing the focused
369
- * element drops focus to `<body>`, so it is restored afterwards — behind
370
- * `_restoringFocus`, because the restore re-fires focusin (see
371
- * {@link _onFocusIn}) on an element that may sit in a background window.
461
+ * cross the stack moves past them. `moveBefore()` keeps the focus inside a
462
+ * moved window where the browser has it ({@link _move}); re-inserting a
463
+ * node containing the focused element drops focus to `<body>`, so it is
464
+ * restored afterwards — behind `_restoringFocus`, because the restore
465
+ * re-fires focusin (see {@link _onFocusIn}) on an element that may sit in a
466
+ * background window.
372
467
  * Reached only through {@link _requestDomSync}'s task — after a pointer
373
468
  * gesture or a programmatic raise, never from a focus-driven one (see
374
469
  * {@link _raise} for why).
375
470
  */
376
471
  private _syncDomOrder;
472
+ /**
473
+ * Move a slotted window before `before`: with `Element.moveBefore()` where
474
+ * the browser has it, which keeps the focus inside the window — a rename
475
+ * field, a text field's caret — through the move; else by re-inserting it,
476
+ * and {@link _syncDomOrder} puts the focus back.
477
+ */
478
+ private _move;
377
479
  protected willUpdate(changed: PropertyValues<this>): void;
378
480
  protected updated(changed: Map<PropertyKey, unknown>): void;
379
481
  protected render(): unknown;