vintage-frames 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/custom-elements.json +96 -7
  3. package/dist/build/app-file.d.ts +2 -2
  4. package/dist/build/app-file.js +1 -0
  5. package/dist/build/box.d.ts +3 -1
  6. package/dist/build/box.js +6 -3
  7. package/dist/build/frame.js +19 -17
  8. package/dist/build/plugins.d.ts +5 -4
  9. package/dist/build/plugins.js +69 -64
  10. package/dist/components/vf-icon.d.ts +7 -0
  11. package/dist/components/vf-icon.js +101 -81
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +15 -14
  14. package/dist/modal-dialog.d.ts +7 -6
  15. package/dist/modal-dialog.js +30 -22
  16. package/dist/shell/app-file.d.ts +43 -5
  17. package/dist/shell/app-file.js +90 -62
  18. package/dist/shell/catalog.d.ts +41 -1
  19. package/dist/shell/catalog.js +174 -153
  20. package/dist/shell/finder.d.ts +27 -9
  21. package/dist/shell/finder.js +335 -277
  22. package/dist/shell/geometry.d.ts +7 -0
  23. package/dist/shell/geometry.js +19 -3
  24. package/dist/shell/index.d.ts +4 -4
  25. package/dist/shell/index.js +12 -12
  26. package/dist/shell/pure.d.ts +1 -1
  27. package/dist/shell/pure.js +6 -6
  28. package/dist/shell/shell.d.ts +14 -10
  29. package/dist/shell/shell.js +144 -117
  30. package/dist/shell/version.d.ts +1 -1
  31. package/dist/shell/version.js +1 -1
  32. package/dist/styles/body-italic-font.d.ts +2 -0
  33. package/dist/styles/body-italic-font.js +10 -0
  34. package/dist/styles/register-embedded-font.d.ts +5 -4
  35. package/dist/styles/register-embedded-font.js +11 -10
  36. package/docs/SPEC.md +2 -2
  37. package/editor/vscode.html-custom-data.json +5 -0
  38. package/editor/web-types.json +11 -1
  39. package/package.json +7 -3
@@ -13,28 +13,29 @@ import { DragController as g } from "../drag.js";
13
13
  import { dragSlop as _, prefersReducedMotion as v, runOutlineTravel as y } from "../motion.js";
14
14
  import { deriveDragOutline as b, deriveOpenArt as x, dotOutline as S, penPhase as C, xorPenCanvas as w } from "../open-art.js";
15
15
  import { FocusRuleController as T } from "../focus-modality.js";
16
+ import "../styles/body-italic-font.js";
16
17
  import { LitElement as E, css as D, html as O, nothing as k } from "lit";
17
18
  import { property as A, state as j } from "lit/decorators.js";
18
19
  //#region src/components/vf-icon.ts
19
20
  var M, N = {
20
21
  large: 32,
21
22
  small: 16
22
- }, P = 1, F = 8, I = (e, t, n) => n <= t ? Math.max(e, t) : Math.min(Math.max(e, t), n), L = "vf-icon-field, [role=\"listbox\"]", R = (e) => e instanceof Element && e.matches(L), z = class extends c(E) {
23
+ }, P, F = 1, I = 8, L = (e, t, n) => n <= t ? Math.max(e, t) : Math.min(Math.max(e, t), n), R = "vf-icon-field, [role=\"listbox\"]", z = (e) => e instanceof Element && e.matches(R), B = class extends c(E) {
23
24
  static {
24
25
  M = this;
25
26
  }
26
27
  constructor(...t) {
27
- super(...t), this.label = "", this.size = "large", this.selectable = !1, this.selected = !1, this.target = !1, this.color = !1, this.open = !1, this.movable = !1, this.editable = !1, this.maxlength = 31, this.scale = new n(this), this.gridSnap = new m(this), this.focusRule = new T(this), this._editing = !1, this._draft = "", this.#e = 0, this._ghost = null, this.#t = null, this.#n = this.attachInternals(), this.#a = !1, this.#o = "", this.#s = "", this.#c = 0, this.#l = -Infinity, this.#u = !1, this.#d = null, this.#f = null, this.#p = new h(this, () => [[
28
+ super(...t), this.label = "", this.size = "large", this.selectable = !1, this.selected = !1, this.target = !1, this.color = !1, this.open = !1, this.alias = !1, this.movable = !1, this.editable = !1, this.maxlength = 31, this.scale = new n(this), this.gridSnap = new m(this), this.focusRule = new T(this), this._editing = !1, this._draft = "", this.#e = 0, this._ghost = null, this.#t = null, this.#n = this.attachInternals(), this.#a = !1, this.#o = "", this.#s = "", this.#c = 0, this.#l = -Infinity, this.#u = !1, this.#d = null, this.#f = null, this.#p = new h(this, () => [[
28
29
  document,
29
30
  "pointerdown",
30
- this.#ne,
31
+ this.#re,
31
32
  !0
32
33
  ]]), this.#m = (e, t, n) => this.#h() ? {
33
34
  x: Math.max(e, 0),
34
35
  y: Math.max(t, n.top)
35
36
  } : {
36
- x: I(e, 0, n.width - a(this.offsetWidth, this)),
37
- y: I(t, n.top, n.height - a(this.offsetHeight, this))
37
+ x: L(e, 0, n.width - a(this.offsetWidth, this)),
38
+ y: L(t, n.top, n.height - a(this.offsetHeight, this))
38
39
  }, this.#g = new s(this, (e, t, n) => this.#m(e, t, n)), this.#_ = null, this.#v = new g(this, {
39
40
  onDragStart: (e) => {
40
41
  if (!this.movable || e.button !== 0 || this._editing) return null;
@@ -85,20 +86,20 @@ var M, N = {
85
86
  this.#x?.finish();
86
87
  }, this.#w = (e) => {
87
88
  e.key !== "Escape" || !this.#x || (e.preventDefault(), e.stopPropagation(), this.#x.finish());
88
- }, this.#I = !1, this.#B = () => {
89
- this.#H(), this.#q();
90
- }, this.#V = () => {
91
- this.#U();
92
- }, this.#K = () => {
89
+ }, this.#I = !1, this.#V = () => {
90
+ this.#U(), this.#J();
91
+ }, this.#H = () => {
92
+ this.#W();
93
+ }, this.#q = () => {
93
94
  queueMicrotask(() => {
94
95
  if (!this._editing) return;
95
96
  let e = this.renderRoot.querySelector("input");
96
97
  e && this.renderRoot.activeElement === e || this.commitEditing();
97
98
  });
98
- }, this.#Q = (e) => {
99
+ }, this.#$ = (e) => {
99
100
  if (e.button !== 0 || this._editing) return;
100
101
  let t = e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("label")), n = this.selected, r = e.timeStamp - this.#l < 800;
101
- this.#l = e.timeStamp, this.#G();
102
+ this.#l = e.timeStamp, this.#K();
102
103
  let i = this.#f;
103
104
  this.#f = null, this.#u = e.pointerType !== "mouse", this.#d = this.#u && e.isPrimary ? {
104
105
  pointerId: e.pointerId,
@@ -108,44 +109,44 @@ var M, N = {
108
109
  second: i !== null && e.timeStamp - i.time <= 500 && Math.hypot(e.clientX - i.x, e.clientY - i.y) <= 24
109
110
  } : null;
110
111
  let a = !e.shiftKey && !e.metaKey;
111
- this.selectable && (a ? this.#Z(!0) : this.#Z(!this.selected)), this.#a = a && n && this.#i !== null, this.editable && t && n && !r && !e.shiftKey && !e.metaKey && this.#W(), this.#Y && (this.focus({ preventScroll: !0 }), this.focusRule.suppress()), this.#v.onPointerDown(e);
112
- }, this.#$ = () => {
112
+ this.selectable && (a ? this.#Q(!0) : this.#Q(!this.selected)), this.#a = a && n && this.#i !== null, this.editable && t && n && !r && !e.shiftKey && !e.metaKey && this.#G(), this.#X && (this.focus({ preventScroll: !0 }), this.focusRule.suppress()), this.#v.onPointerDown(e);
113
+ }, this.#ee = () => {
113
114
  this._editing || this.#u || e(this, "vf-open", {});
114
- }, this.#ee = (t) => {
115
+ }, this.#te = (t) => {
115
116
  let n = this.#_?.proposal != null;
116
117
  this.#v.onPointerUp(t);
117
- let r = this.#te(t, n);
118
+ let r = this.#ne(t, n);
118
119
  if (this.#a) {
119
120
  this.#a = !1;
120
121
  let e = t.type === "pointercancel" ? null : this.#i;
121
122
  for (let t of e?.querySelectorAll("vf-icon") ?? []) t !== this && t.selected && t.setSelected(!1);
122
123
  }
123
124
  r && e(this, "vf-open", {});
124
- }, this.#ne = (e) => {
125
+ }, this.#re = (e) => {
125
126
  let t = e.composedPath();
126
- if (t.includes(this) || (this.#G(), this.#f = null, e.shiftKey || e.metaKey)) return;
127
+ if (t.includes(this) || (this.#K(), this.#f = null, e.shiftKey || e.metaKey)) return;
127
128
  let n = this.#i;
128
129
  if (n !== null) {
129
130
  let e = t.find((e) => e instanceof M);
130
- if (!e && !t.some(R) || e?.selected && e.#i === n) return;
131
+ if (!e && !t.some(z) || e?.selected && e.#i === n) return;
131
132
  }
132
- this.#Z(!1);
133
- }, this.#re = (e) => {
133
+ this.#Q(!1);
134
+ }, this.#ie = (e) => {
134
135
  let t = e.target, n = e.data ?? e.dataTransfer?.getData("text") ?? "";
135
136
  if (n === "") return;
136
137
  let r = t.selectionStart ?? t.value.length, i = t.selectionEnd ?? r, a = t.value.slice(0, r) + n + t.value.slice(i);
137
- a.length > this.maxlength && this.#ae(a);
138
- }, this.#ie = (e) => {
138
+ a.length > this.maxlength && this.#oe(a);
139
+ }, this.#ae = (e) => {
139
140
  let t = e.target;
140
141
  if (t.value.length > this.maxlength) {
141
142
  let e = t.value, n = Math.min(t.selectionStart ?? this.maxlength, this.maxlength);
142
- t.value = e.slice(0, this.maxlength), t.setSelectionRange(n, n), this.#ae(e);
143
+ t.value = e.slice(0, this.maxlength), t.setSelectionRange(n, n), this.#oe(e);
143
144
  }
144
145
  this._draft = t.value;
145
- }, this.#oe = (e) => {
146
+ }, this.#se = (e) => {
146
147
  e.key === "Enter" ? (e.preventDefault(), this.commitEditing(), this.focus()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.cancelEditing(), this.focus());
147
- }, this.#se = (t) => {
148
- if (this.#G(), !(this._editing || t.defaultPrevented)) {
148
+ }, this.#ce = (t) => {
149
+ if (this.#K(), !(this._editing || t.defaultPrevented)) {
149
150
  if ((t.metaKey || t.ctrlKey) && !t.altKey && (t.key.toLowerCase() === "o" || t.key === "ArrowDown")) {
150
151
  t.preventDefault(), e(this, "vf-open", {});
151
152
  return;
@@ -157,7 +158,7 @@ var M, N = {
157
158
  return;
158
159
  case " ":
159
160
  if (!this.selectable) return;
160
- t.preventDefault(), this.focusRule.reveal(), this.#Z(!this.selected);
161
+ t.preventDefault(), this.focusRule.reveal(), this.#Q(!this.selected);
161
162
  return;
162
163
  case "ArrowLeft":
163
164
  case "ArrowRight":
@@ -165,7 +166,7 @@ var M, N = {
165
166
  case "ArrowDown": {
166
167
  if (!this.movable) return;
167
168
  t.preventDefault(), this.focusRule.reveal();
168
- let e = t.shiftKey ? F : P, n = t.key === "ArrowLeft" ? -e : t.key === "ArrowRight" ? e : 0, r = t.key === "ArrowUp" ? -e : t.key === "ArrowDown" ? e : 0;
169
+ let e = t.shiftKey ? I : F, n = t.key === "ArrowLeft" ? -e : t.key === "ArrowRight" ? e : 0, r = t.key === "ArrowUp" ? -e : t.key === "ArrowDown" ? e : 0;
169
170
  this.#L();
170
171
  let i = this.#g.seed();
171
172
  this.#g.moveTo(i.x + n, i.y + r);
@@ -302,6 +303,14 @@ var M, N = {
302
303
  padding: 0 calc(var(--vf-scale, 1) * 1px);
303
304
  text-align: left;
304
305
  }
306
+ /* An alias's name, plate and rename field alike: the body face's own
307
+ italic, slanted on the pixel grid. Never a synthesized oblique, which
308
+ would smear it; until the italic loads the name stands upright. */
309
+ :host([alias]) .label,
310
+ :host([alias]) .rename {
311
+ font-style: italic;
312
+ font-synthesis: none;
313
+ }
305
314
  :host([selected]) .name {
306
315
  /* Forced colors: exempt the inverted plate from the mode's text
307
316
  backplate, which would land a Canvas slab on the highlight bar —
@@ -411,7 +420,7 @@ var M, N = {
411
420
  return this.#i !== null;
412
421
  }
413
422
  get #i() {
414
- return this.closest(L);
423
+ return this.closest(R);
415
424
  }
416
425
  #a;
417
426
  #o;
@@ -489,7 +498,7 @@ var M, N = {
489
498
  clientY: r.clientY
490
499
  }, !i.proposal) {
491
500
  if (Math.hypot(r.clientX - i.press.clientX, r.clientY - i.press.clientY) < i.slop || t === i.origin.x && n === i.origin.y) return;
492
- this.#G(), this.#a = !1, i.proposal = {
501
+ this.#K(), this.#a = !1, i.proposal = {
493
502
  left: i.origin.x,
494
503
  top: i.origin.y
495
504
  }, this.#y.attach();
@@ -607,19 +616,19 @@ var M, N = {
607
616
  };
608
617
  }
609
618
  connectedCallback() {
610
- super.connectedCallback(), this.#X(), this.#q(), this.selectable && this.selected && this.#p.attach(), this.addEventListener("keydown", this.#se);
619
+ super.connectedCallback(), this.#Z(), this.#J(), this.selectable && this.selected && this.#p.attach(), this.addEventListener("keydown", this.#ce);
611
620
  }
612
621
  disconnectedCallback() {
613
- super.disconnectedCallback(), this.removeEventListener("keydown", this.#se), this.#G(), this.#_?.outline?.canvas.remove();
622
+ super.disconnectedCallback(), this.removeEventListener("keydown", this.#ce), this.#K(), this.#_?.outline?.canvas.remove();
614
623
  for (let e of this.#_?.followers ?? []) e.end();
615
624
  this.#_ = null, this.#x?.finish();
616
625
  }
617
626
  updated(e) {
618
- if (e.has("selectable") && this.#X(), (e.has("selectable") || e.has("selected") || e.has("label")) && this.#q(), (e.has("selected") || e.has("selectable")) && (this.selectable && this.selected ? this.#p.attach() : this.#p.detach()), e.has("_editing") && this._editing) {
627
+ if (e.has("selectable") && this.#Z(), (e.has("selectable") || e.has("selected") || e.has("label")) && this.#J(), (e.has("selected") || e.has("selectable")) && (this.selectable && this.selected ? this.#p.attach() : this.#p.detach()), e.has("_editing") && this._editing) {
619
628
  let e = this.renderRoot.querySelector("input");
620
629
  e?.focus(), e?.select();
621
630
  }
622
- (e.has("label") || e.has("_draft") || e.has("_editing")) && this.#R(), (e.has("open") || e.has("size")) && this.#H();
631
+ (e.has("label") || e.has("_draft") || e.has("_editing") || e.has("alias")) && this.#R(), (e.has("open") || e.has("size")) && this.#U();
623
632
  }
624
633
  #I;
625
634
  #L() {
@@ -639,15 +648,23 @@ var M, N = {
639
648
  let n = document.createRange();
640
649
  n.selectNodeContents(e), t = n.getBoundingClientRect().width, n.detach();
641
650
  }
642
- let n = t / r(this) + 2, i = Math.max(2, Math.ceil(n / 2) * 2);
643
- this.#e = this._editing && t === 0 ? Math.max(i, N[this.size]) : i, e.style.width = this.#z;
644
- }
645
- get #z() {
651
+ let n = t / r(this) + 2 + (this.alias ? this.#z(e) : 0), i = Math.max(2, Math.ceil(n / 2) * 2);
652
+ this.#e = this._editing && t === 0 ? Math.max(i, N[this.size]) : i, e.style.width = this.#B;
653
+ }
654
+ #z(e) {
655
+ let t = e.textContent ?? "";
656
+ if (P ??= document.createElement("canvas").getContext("2d"), !t || !P) return 0;
657
+ let { fontStyle: n, fontWeight: i, fontSize: a, fontFamily: o } = getComputedStyle(e);
658
+ P.font = `${n} ${i} ${a} ${o}`;
659
+ let s = P.measureText(t);
660
+ return Math.max(0, Math.ceil((s.actualBoundingBoxRight - s.width) / r(this)));
661
+ }
662
+ get #B() {
646
663
  return this.#e ? `calc(var(--vf-scale, 1) * ${this.#e}px)` : "";
647
664
  }
648
- #B;
649
665
  #V;
650
- #H() {
666
+ #H;
667
+ #U() {
651
668
  let e = this.renderRoot?.querySelector(`slot[name='${this.size}']`), t = null;
652
669
  for (let n of e?.assignedElements({ flatten: !0 }) ?? []) {
653
670
  let e = n instanceof HTMLImageElement || n instanceof HTMLCanvasElement ? n : n.querySelector("img, canvas");
@@ -656,9 +673,9 @@ var M, N = {
656
673
  break;
657
674
  }
658
675
  }
659
- t !== this.#t && (this.#t?.removeEventListener("load", this.#V), this.#t?.removeEventListener("error", this.#V), this.#t = t, t?.addEventListener("load", this.#V), t?.addEventListener("error", this.#V)), this.#U();
676
+ t !== this.#t && (this.#t?.removeEventListener("load", this.#H), this.#t?.removeEventListener("error", this.#H), this.#t = t, t?.addEventListener("load", this.#H), t?.addEventListener("error", this.#H)), this.#W();
660
677
  }
661
- #U() {
678
+ #W() {
662
679
  let e = this.#t, t = e instanceof HTMLImageElement ? e.complete && e.naturalWidth > 0 : e != null && e.width > 0;
663
680
  if (!this.open || e == null || !t) {
664
681
  this._ghost = null, this.#o = "";
@@ -674,16 +691,16 @@ var M, N = {
674
691
  }
675
692
  this._ghost = r, this.#o = r ? n : "";
676
693
  }
677
- #W() {
678
- this.#G(), this.#c = window.setTimeout(() => {
694
+ #G() {
695
+ this.#K(), this.#c = window.setTimeout(() => {
679
696
  this.#c = 0, this.startEditing();
680
697
  }, 800);
681
698
  }
682
- #G() {
699
+ #K() {
683
700
  this.#c &&= (clearTimeout(this.#c), 0);
684
701
  }
685
702
  startEditing() {
686
- this.#G(), !(!this.editable || this._editing) && (this.#s = this.label, this._draft = this.label, this._editing = !0);
703
+ this.#K(), !(!this.editable || this._editing) && (this.#s = this.label, this._draft = this.label, this._editing = !0);
687
704
  }
688
705
  commitEditing() {
689
706
  if (!this._editing) return;
@@ -702,7 +719,7 @@ var M, N = {
702
719
  previous: t
703
720
  }));
704
721
  }
705
- #K;
722
+ #q;
706
723
  cancelEditing() {
707
724
  this._editing && (this._editing = !1, this._draft = this.#s);
708
725
  }
@@ -712,15 +729,15 @@ var M, N = {
712
729
  class="frame vf-snap"
713
730
  part="frame"
714
731
  style=${o}
715
- @pointerdown=${this.#Q}
732
+ @pointerdown=${this.#$}
716
733
  @pointermove=${this.#v.onPointerMove}
717
- @pointerup=${this.#ee}
718
- @pointercancel=${this.#ee}
719
- @lostpointercapture=${this.#ee}
720
- @dblclick=${this.#$}
734
+ @pointerup=${this.#te}
735
+ @pointercancel=${this.#te}
736
+ @lostpointercapture=${this.#te}
737
+ @dblclick=${this.#ee}
721
738
  >
722
739
  <div class=${a} part="icon">
723
- ${this.size === "small" ? O`<slot name="small" @slotchange=${this.#B}></slot>` : O`<slot name="large" @slotchange=${this.#B}></slot>`}${this._ghost ?? k}
740
+ ${this.size === "small" ? O`<slot name="small" @slotchange=${this.#V}></slot>` : O`<slot name="large" @slotchange=${this.#V}></slot>`}${this._ghost ?? k}
724
741
  </div>
725
742
  ${r ? O`<div class=${i}>
726
743
  <!-- No whitespace around the span: it is the measured run, and a
@@ -728,7 +745,7 @@ var M, N = {
728
745
  <div class="label" part="label"><span
729
746
  class="name"
730
747
  part="plate"
731
- style=${this.#e ? `width: ${this.#z}` : ""}
748
+ style=${this.#e ? `width: ${this.#B}` : ""}
732
749
  >${t}</span
733
750
  ></div>
734
751
  ${e ? O`<div class="rename-box">
@@ -738,16 +755,16 @@ var M, N = {
738
755
  type="text"
739
756
  maxlength=${this.maxlength}
740
757
  .value=${this._draft}
741
- @beforeinput=${this.#re}
742
- @input=${this.#ie}
743
- @keydown=${this.#oe}
744
- @blur=${this.#K}
758
+ @beforeinput=${this.#ie}
759
+ @input=${this.#ae}
760
+ @keydown=${this.#se}
761
+ @blur=${this.#q}
745
762
  />
746
763
  </div>` : k}
747
764
  </div>` : k}
748
765
  </div>`;
749
766
  }
750
- #q() {
767
+ #J() {
751
768
  if (!this.selectable) {
752
769
  this.#n.role = null, this.#n.ariaSelected = null, this.#n.ariaLabel = null;
753
770
  return;
@@ -756,22 +773,22 @@ var M, N = {
756
773
  this.#n.role = "option", this.#n.ariaSelected = this.selected ? "true" : "false", this.#n.ariaLabel = null;
757
774
  return;
758
775
  }
759
- this.#n.role = "img", this.#n.ariaSelected = null, this.#n.ariaLabel = this.label || this.#J || null;
776
+ this.#n.role = "img", this.#n.ariaSelected = null, this.#n.ariaLabel = this.label || this.#Y || null;
760
777
  }
761
- get #J() {
778
+ get #Y() {
762
779
  return this.#t instanceof HTMLImageElement ? this.#t.alt : "";
763
780
  }
764
- get #Y() {
781
+ get #X() {
765
782
  return this.selectable;
766
783
  }
767
- #X() {
768
- this.hasAttribute("tabindex") || (this.#Y ? this.tabIndex = 0 : this.removeAttribute("tabindex"));
784
+ #Z() {
785
+ this.hasAttribute("tabindex") || (this.#X ? this.tabIndex = 0 : this.removeAttribute("tabindex"));
769
786
  }
770
- #Z(t) {
787
+ #Q(t) {
771
788
  t !== this.selected && (this.selected = t, e(this, "vf-select", { selected: t }));
772
789
  }
773
790
  setSelected(e) {
774
- this.#Z(e);
791
+ this.#Q(e);
775
792
  }
776
793
  touches(e) {
777
794
  let t = this.renderRoot;
@@ -801,10 +818,10 @@ var M, N = {
801
818
  }), this.#x = t, this.#S.attach();
802
819
  })) : (this.#g.moveTo(r.x, r.y), !1);
803
820
  }
804
- #Q;
805
821
  #$;
806
822
  #ee;
807
- #te(e, t) {
823
+ #te;
824
+ #ne(e, t) {
808
825
  let n = this.#d;
809
826
  return !n || n.pointerId !== e.pointerId || (this.#d = null, !(e.type !== "pointercancel" && !t && !this._editing && Math.hypot(e.clientX - n.x, e.clientY - n.y) < _(e))) ? !1 : n.second ? !0 : (this.#f = {
810
827
  time: n.time,
@@ -812,40 +829,43 @@ var M, N = {
812
829
  y: n.y
813
830
  }, !1);
814
831
  }
815
- #ne;
816
832
  #re;
817
833
  #ie;
818
- #ae(t) {
834
+ #ae;
835
+ #oe(t) {
819
836
  e(this, "vf-name-too-long", {
820
837
  attempted: t,
821
838
  accepted: t.slice(0, this.maxlength),
822
839
  limit: this.maxlength
823
840
  });
824
841
  }
825
- #oe;
826
842
  #se;
843
+ #ce;
827
844
  };
828
- o([A()], z.prototype, "label", void 0), o([A({ reflect: !0 })], z.prototype, "size", void 0), o([A({
845
+ o([A()], B.prototype, "label", void 0), o([A({ reflect: !0 })], B.prototype, "size", void 0), o([A({
846
+ type: Boolean,
847
+ reflect: !0
848
+ })], B.prototype, "selectable", void 0), o([A({
829
849
  type: Boolean,
830
850
  reflect: !0
831
- })], z.prototype, "selectable", void 0), o([A({
851
+ })], B.prototype, "selected", void 0), o([A({
832
852
  type: Boolean,
833
853
  reflect: !0
834
- })], z.prototype, "selected", void 0), o([A({
854
+ })], B.prototype, "target", void 0), o([A({
835
855
  type: Boolean,
836
856
  reflect: !0
837
- })], z.prototype, "target", void 0), o([A({
857
+ })], B.prototype, "color", void 0), o([A({
838
858
  type: Boolean,
839
859
  reflect: !0
840
- })], z.prototype, "color", void 0), o([A({
860
+ })], B.prototype, "open", void 0), o([A({
841
861
  type: Boolean,
842
862
  reflect: !0
843
- })], z.prototype, "open", void 0), o([A({
863
+ })], B.prototype, "alias", void 0), o([A({
844
864
  type: Boolean,
845
865
  reflect: !0
846
- })], z.prototype, "movable", void 0), o([A({
866
+ })], B.prototype, "movable", void 0), o([A({
847
867
  type: Boolean,
848
868
  reflect: !0
849
- })], z.prototype, "editable", void 0), o([A({ type: Number })], z.prototype, "width", void 0), o([A({ type: Number })], z.prototype, "maxlength", void 0), o([j()], z.prototype, "_editing", void 0), o([j()], z.prototype, "_draft", void 0), o([j()], z.prototype, "_ghost", void 0), z = M = o([t("vf-icon")], z);
869
+ })], B.prototype, "editable", void 0), o([A({ type: Number })], B.prototype, "width", void 0), o([A({ type: Number })], B.prototype, "maxlength", void 0), o([j()], B.prototype, "_editing", void 0), o([j()], B.prototype, "_draft", void 0), o([j()], B.prototype, "_ghost", void 0), B = M = o([t("vf-icon")], B);
850
870
  //#endregion
851
- export { z as VfIcon };
871
+ export { B as VfIcon };
package/dist/index.d.ts CHANGED
@@ -181,3 +181,4 @@ export { registerEmbeddedFont, PIXEL_GRID_METRICS } from './styles/register-embe
181
181
  export type { EmbeddedFontMetrics } from './styles/register-embedded-font.js';
182
182
  export { registerDisplayFace, VF_DISPLAY_FAMILY } from './styles/display-font.js';
183
183
  export { registerBodyFace, VF_BODY_FAMILY } from './styles/body-font.js';
184
+ export { registerBodyItalicFace } from './styles/body-italic-font.js';
package/dist/index.js CHANGED
@@ -61,17 +61,18 @@ import { VfSlider as nn } from "./components/vf-slider.js";
61
61
  import { VfLabel as rn } from "./components/vf-label.js";
62
62
  import { VfParagraph as an } from "./components/vf-paragraph.js";
63
63
  import { VfImg as on } from "./components/vf-img.js";
64
- import { VfIcon as sn } from "./components/vf-icon.js";
65
- import { VfIconField as cn } from "./components/vf-icon-field.js";
66
- import { VfMenuBar as ln } from "./components/vf-menu-bar.js";
67
- import { VfMenu as un } from "./components/vf-menu.js";
68
- import { VfMenuItem as dn } from "./components/vf-menu-item.js";
69
- import { VfList as fn } from "./components/vf-list.js";
70
- import { VfListItem as pn } from "./components/vf-list-item.js";
71
- import { VfFieldset as mn } from "./components/vf-fieldset.js";
72
- import { VfGrid as hn } from "./components/vf-grid.js";
73
- import { VfStack as gn } from "./components/vf-stack.js";
74
- import { VfContainer as _n } from "./components/vf-container.js";
75
- import { CURSOR_ARROW as vn, CURSOR_CROSSHAIR as yn, CURSOR_I_BEAM as bn, CURSOR_WAIT as xn } from "./cursor-art.js";
76
- import { applyCursor as Sn } from "./cursor.js";
77
- export { Ge as BLINK_FLIPS, Ke as BLINK_INTERVAL_MS, Ne as BUTTON_FACE, Pe as BUTTON_FRAME, ht as CARET_DOWN, gt as CARET_DOWN_SMALL, _t as CHECKBOX_X, vt as CHECKMARK, r as CLASSIC_DPI, i as CSS_REFERENCE_DPI, vn as CURSOR_ARROW, yn as CURSOR_CROSSHAIR, bn as CURSOR_I_BEAM, xn as CURSOR_WAIT, qe as DRAG_SLOP_COARSE_PX, Je as DRAG_SLOP_PX, Me as DocumentListenersController, We as DragController, Gt as FocusRuleController, Ae as GridSnapController, $ as PATTERNS, ee as PATTERN_NAMES, te as PATTERN_SIZE, D as PIXEL_GRID_METRICS, Ye as PRESS_HOLD_MS, Oe as PatternFillController, T as PlacementController, yt as RADIO_DOT, bt as RADIO_FACE, xt as RADIO_RING, St as RADIO_RING_PRESSED, Xe as RENAME_DELAY_MS, G as REPEAT_TILE, Fe as RING_FRAME, Ie as RING_HOLE, Le as RING_INSET, ge as RULE_EDGES, K as RepeatTileController, Re as SCREEN_CORNER, Ct as SLIDER_THUMB, wt as SLIDER_THUMB_FACE, Tt as STEPPER, Et as STEPPER_DOWN_FILL, Dt as STEPPER_UP_FILL, a as SYSTEM_PX_IN_CSS_PX, d as ScaleController, kt as ScrollRailController, mt as ScrollStateController, Ze as TAP_PAIR_MS, Qe as TAP_PAIR_SLOP_PX, R as TILE_LATTICE, en as TrackWidthController, k as VF_BODY_FAMILY, M as VF_DISPLAY_FAMILY, Rt as VfButton, zt as VfButtonGroup, Ht as VfCheckbox, _n as VfContainer, He as VfDesktop, Ft as VfDialog, mn as VfFieldset, Lt as VfFormControl, hn as VfGrid, sn as VfIcon, cn as VfIconField, on as VfImg, rn as VfLabel, fn as VfList, pn as VfListItem, un as VfMenu, ln as VfMenuBar, dn as VfMenuItem, Nt as VfModalDialog, Zt as VfNumberField, Qt as VfOption, an as VfParagraph, E as VfPositioned, tn as VfProgressBar, Ut as VfRadio, Wt as VfRadioGroup, jt as VfScrollArea, $t as VfSelect, It as VfSeparator, Ue as VfSized, nn as VfSlider, gn as VfStack, Bt as VfSwatch, Xt as VfTextArea, Jt as VfTextControlBase, Yt as VfTextField, Vt as VfToggleControl, Mt as VfWindow, $e as WALK_BEAT_MS, et as WALK_STEP_MS, tt as WALK_STEP_PX, dt as WINDOW_MIN_HEIGHT, ft as WINDOW_MIN_WIDTH, nt as WINDOW_RECTS_VISIBLE, rt as WINDOW_RECT_RATIO, it as WINDOW_RECT_STEPS, at as WINDOW_RECT_STEP_MS, Sn as applyCursor, f as applyScale, t as defineElement, q as devicePxAt, o as devicePxPerSystemPx, ot as dragSlop, p as effectiveScale, e as emit, Kt as focusModality, m as getScale, s as getZoom, Ot as glyphSvg, Pt as modalDialogStyles, h as onScaleChange, c as onZoomChange, ne as parsePattern, _e as parseRule, re as patternHex, ie as patternMotif, J as patternOverride, ae as patternRects, st as prefersReducedMotion, A as registerBodyFace, N as registerDisplayFace, O as registerEmbeddedFont, At as renderScrollRail, Y as repeatTile, je as requestGridSnap, l as resetZoomBaseline, ve as ruleClasses, ct as runOutlineTravel, lt as runSelectionBlink, g as snapSys, _ as snapToDevicePx, v as snapToSystemPx, ze as steppedCornerClip, Be as steppedRectClip, Ve as steppedRingClip, y as sys, b as sysLength, x as sysLengths, S as systemPxQuantum, X as tileGrid, z as tileImage, B as tileRaster, V as tileRects, H as tileSpan, C as toSys, w as toSysExact, qt as trackFocusModality, u as truePixelRatio, I as vfBase, j as vfBodyDecls, pe as vfChromeFrame, P as vfDisplay, F as vfDisplayDecls, oe as vfDots, n as vfElement, Ee as vfField, Se as vfFocus, Ce as vfFocusRing, we as vfFocusUnderline, ce as vfHardShadow, le as vfHardShadowDecls, me as vfModalFrame, he as vfPanel, ke as vfPatternFill, Z as vfRepeatTileSize, ye as vfRule, De as vfScrollRail, L as vfStaticText, se as vfStripes, ue as vfStrokeDecls, de as vfStrokeInset, fe as vfStrokeShadow, Q as vfTileGrid, U as vfTileMaskSize, W as vfTileSize, be as vfTitleBar, Te as vfToggle, xe as vfWindowWidgets, pt as windowChrome, ut as windowRectFraction };
64
+ import { registerBodyItalicFace as sn } from "./styles/body-italic-font.js";
65
+ import { VfIcon as cn } from "./components/vf-icon.js";
66
+ import { VfIconField as ln } from "./components/vf-icon-field.js";
67
+ import { VfMenuBar as un } from "./components/vf-menu-bar.js";
68
+ import { VfMenu as dn } from "./components/vf-menu.js";
69
+ import { VfMenuItem as fn } from "./components/vf-menu-item.js";
70
+ import { VfList as pn } from "./components/vf-list.js";
71
+ import { VfListItem as mn } from "./components/vf-list-item.js";
72
+ import { VfFieldset as hn } from "./components/vf-fieldset.js";
73
+ import { VfGrid as gn } from "./components/vf-grid.js";
74
+ import { VfStack as _n } from "./components/vf-stack.js";
75
+ import { VfContainer as vn } from "./components/vf-container.js";
76
+ import { CURSOR_ARROW as yn, CURSOR_CROSSHAIR as bn, CURSOR_I_BEAM as xn, CURSOR_WAIT as Sn } from "./cursor-art.js";
77
+ import { applyCursor as Cn } from "./cursor.js";
78
+ export { Ge as BLINK_FLIPS, Ke as BLINK_INTERVAL_MS, Ne as BUTTON_FACE, Pe as BUTTON_FRAME, ht as CARET_DOWN, gt as CARET_DOWN_SMALL, _t as CHECKBOX_X, vt as CHECKMARK, r as CLASSIC_DPI, i as CSS_REFERENCE_DPI, yn as CURSOR_ARROW, bn as CURSOR_CROSSHAIR, xn as CURSOR_I_BEAM, Sn as CURSOR_WAIT, qe as DRAG_SLOP_COARSE_PX, Je as DRAG_SLOP_PX, Me as DocumentListenersController, We as DragController, Gt as FocusRuleController, Ae as GridSnapController, $ as PATTERNS, ee as PATTERN_NAMES, te as PATTERN_SIZE, D as PIXEL_GRID_METRICS, Ye as PRESS_HOLD_MS, Oe as PatternFillController, T as PlacementController, yt as RADIO_DOT, bt as RADIO_FACE, xt as RADIO_RING, St as RADIO_RING_PRESSED, Xe as RENAME_DELAY_MS, G as REPEAT_TILE, Fe as RING_FRAME, Ie as RING_HOLE, Le as RING_INSET, ge as RULE_EDGES, K as RepeatTileController, Re as SCREEN_CORNER, Ct as SLIDER_THUMB, wt as SLIDER_THUMB_FACE, Tt as STEPPER, Et as STEPPER_DOWN_FILL, Dt as STEPPER_UP_FILL, a as SYSTEM_PX_IN_CSS_PX, d as ScaleController, kt as ScrollRailController, mt as ScrollStateController, Ze as TAP_PAIR_MS, Qe as TAP_PAIR_SLOP_PX, R as TILE_LATTICE, en as TrackWidthController, k as VF_BODY_FAMILY, M as VF_DISPLAY_FAMILY, Rt as VfButton, zt as VfButtonGroup, Ht as VfCheckbox, vn as VfContainer, He as VfDesktop, Ft as VfDialog, hn as VfFieldset, Lt as VfFormControl, gn as VfGrid, cn as VfIcon, ln as VfIconField, on as VfImg, rn as VfLabel, pn as VfList, mn as VfListItem, dn as VfMenu, un as VfMenuBar, fn as VfMenuItem, Nt as VfModalDialog, Zt as VfNumberField, Qt as VfOption, an as VfParagraph, E as VfPositioned, tn as VfProgressBar, Ut as VfRadio, Wt as VfRadioGroup, jt as VfScrollArea, $t as VfSelect, It as VfSeparator, Ue as VfSized, nn as VfSlider, _n as VfStack, Bt as VfSwatch, Xt as VfTextArea, Jt as VfTextControlBase, Yt as VfTextField, Vt as VfToggleControl, Mt as VfWindow, $e as WALK_BEAT_MS, et as WALK_STEP_MS, tt as WALK_STEP_PX, dt as WINDOW_MIN_HEIGHT, ft as WINDOW_MIN_WIDTH, nt as WINDOW_RECTS_VISIBLE, rt as WINDOW_RECT_RATIO, it as WINDOW_RECT_STEPS, at as WINDOW_RECT_STEP_MS, Cn as applyCursor, f as applyScale, t as defineElement, q as devicePxAt, o as devicePxPerSystemPx, ot as dragSlop, p as effectiveScale, e as emit, Kt as focusModality, m as getScale, s as getZoom, Ot as glyphSvg, Pt as modalDialogStyles, h as onScaleChange, c as onZoomChange, ne as parsePattern, _e as parseRule, re as patternHex, ie as patternMotif, J as patternOverride, ae as patternRects, st as prefersReducedMotion, A as registerBodyFace, sn as registerBodyItalicFace, N as registerDisplayFace, O as registerEmbeddedFont, At as renderScrollRail, Y as repeatTile, je as requestGridSnap, l as resetZoomBaseline, ve as ruleClasses, ct as runOutlineTravel, lt as runSelectionBlink, g as snapSys, _ as snapToDevicePx, v as snapToSystemPx, ze as steppedCornerClip, Be as steppedRectClip, Ve as steppedRingClip, y as sys, b as sysLength, x as sysLengths, S as systemPxQuantum, X as tileGrid, z as tileImage, B as tileRaster, V as tileRects, H as tileSpan, C as toSys, w as toSysExact, qt as trackFocusModality, u as truePixelRatio, I as vfBase, j as vfBodyDecls, pe as vfChromeFrame, P as vfDisplay, F as vfDisplayDecls, oe as vfDots, n as vfElement, Ee as vfField, Se as vfFocus, Ce as vfFocusRing, we as vfFocusUnderline, ce as vfHardShadow, le as vfHardShadowDecls, me as vfModalFrame, he as vfPanel, ke as vfPatternFill, Z as vfRepeatTileSize, ye as vfRule, De as vfScrollRail, L as vfStaticText, se as vfStripes, ue as vfStrokeDecls, de as vfStrokeInset, fe as vfStrokeShadow, Q as vfTileGrid, U as vfTileMaskSize, W as vfTileSize, be as vfTitleBar, Te as vfToggle, xe as vfWindowWidgets, pt as windowChrome, ut as windowRectFraction };
@@ -51,7 +51,10 @@ export declare const modalDialogStyles: import("lit").CSSResult;
51
51
  * the reason. Because every close path — Escape, `close()`, the opt-in
52
52
  * {@link lightDismiss} click outside — routes through the native `close`
53
53
  * event, an Escape-close no longer leaves a stale origin behind, so the next
54
- * open re-derives it.
54
+ * open re-derives it. That event is queued: a modal opened again before it
55
+ * comes (`close()` then `show()` in one turn) runs the funnel at the open,
56
+ * inside `show()`, so the close's `vf-close` still comes before the open's
57
+ * `vf-show`, and the late event changes nothing.
55
58
  *
56
59
  * It also owns the two keyboard rules every classic dialog followed (see
57
60
  * {@link defaultButton} and {@link initialFocusTarget}): Return or Enter
@@ -242,11 +245,9 @@ export declare class VfModalDialog extends LitElement {
242
245
  /** Native `cancel` (Escape): remember the reason; `close` follows. */
243
246
  protected _onNativeCancel(): void;
244
247
  /**
245
- * Native `close` — the single teardown funnel for every close path. Drops
246
- * the written origin so the next open re-derives it from the box it will
247
- * actually have (a stated `top`/`left` is the author's or the user's and
248
- * survives, and is re-applied by that open), syncs `open`, and fires
249
- * `vf-close` with the reason and the value the close carried.
248
+ * Native `close`, which every close path ends in: syncs `open` and runs the
249
+ * close funnel. An open that came before the event has run the funnel for
250
+ * this close already, and the event passes.
250
251
  */
251
252
  protected _onNativeClose(): void;
252
253
  }
@@ -112,7 +112,7 @@ var p = 24, m = /* @__PURE__ */ new Set([
112
112
  this.#o = null, !(!t || e.target !== this._dialog || !this.lightDismiss) && (this.#n = "outside", this.close());
113
113
  }, this.#f = () => {
114
114
  this.#o = null;
115
- }, this.#p = null, this.#y = () => this.settle(), this.addEventListener("submit", this.#a);
115
+ }, this.#p = null, this.#m = !1, this.#b = () => this.settle(), this.addEventListener("submit", this.#a);
116
116
  }
117
117
  #a;
118
118
  #o;
@@ -133,41 +133,42 @@ var p = 24, m = /* @__PURE__ */ new Set([
133
133
  #d;
134
134
  #f;
135
135
  #p;
136
+ #m;
136
137
  show() {
137
- this.open = !0, this.hasUpdated && this.#v();
138
+ this.open = !0, this.hasUpdated && this.#y();
138
139
  }
139
140
  close(e) {
140
- this.open && e !== void 0 && (this.#r = e), this.open = !1, this.hasUpdated && this.#v();
141
+ this.open && e !== void 0 && (this.#r = e), this.open = !1, this.hasUpdated && this.#y();
141
142
  }
142
143
  closeFromBox(e) {
143
144
  this.open && (this.#i = e), this.close();
144
145
  }
145
146
  updated(e) {
146
- e.has("open") && this.#v(), (e.has("top") || e.has("left")) && this.settle(), this.#t();
147
+ e.has("open") && this.#y(), (e.has("top") || e.has("left")) && this.settle(), this.#t();
147
148
  }
148
- #m() {
149
+ #h() {
149
150
  let e = document.documentElement;
150
151
  return {
151
152
  width: o(e.clientWidth || window.innerWidth, this),
152
153
  height: o(e.clientHeight || window.innerHeight, this)
153
154
  };
154
155
  }
155
- #h(e, t) {
156
- let n = this.#m(), r = o(this._dialog?.offsetWidth ?? 0, this);
156
+ #g(e, t) {
157
+ let n = this.#h(), r = o(this._dialog?.offsetWidth ?? 0, this);
157
158
  return {
158
159
  x: Math.min(Math.max(e, p - r), n.width - p),
159
160
  y: Math.min(Math.max(t, 0), Math.max(0, n.height - p))
160
161
  };
161
162
  }
162
- #g() {
163
- let e = this.#m(), t = this._dialog?.getBoundingClientRect();
163
+ #_() {
164
+ let e = this.#h(), t = this._dialog?.getBoundingClientRect();
164
165
  return {
165
166
  x: (e.width - o(t?.width ?? 0, this)) / 2,
166
167
  y: (e.height - o(t?.height ?? 0, this)) / 2
167
168
  };
168
169
  }
169
170
  placeAt(e, t) {
170
- let n = this.#h(e, t);
171
+ let n = this.#g(e, t);
171
172
  this.left = i(n.x, this), this.top = i(n.y, this);
172
173
  }
173
174
  settle() {
@@ -176,10 +177,10 @@ var p = 24, m = /* @__PURE__ */ new Set([
176
177
  let t = this.left != null || this.top != null ? {
177
178
  x: this.left ?? 0,
178
179
  y: this.top ?? 0
179
- } : this.#g(), n = this.#h(t.x, t.y);
180
+ } : this.#_(), n = this.#g(t.x, t.y);
180
181
  e.style.left = a(i(n.x, this)), e.style.top = a(i(n.y, this)), e.style.right = "auto", e.style.bottom = "auto", e.style.margin = "0";
181
182
  }
182
- #_() {
183
+ #v() {
183
184
  let e = this._dialog?.style;
184
185
  if (e) for (let t of [
185
186
  "left",
@@ -189,27 +190,31 @@ var p = 24, m = /* @__PURE__ */ new Set([
189
190
  "margin"
190
191
  ]) e.removeProperty(t);
191
192
  }
192
- #v() {
193
+ #y() {
193
194
  let e = this._dialog;
194
195
  if (e) {
195
196
  if (this.open && !e.open) {
196
- this.#p = document.activeElement, this.returnValue = "", e.showModal();
197
+ if (this.#m) {
198
+ this.#T(), this.#y();
199
+ return;
200
+ }
201
+ this.#p = document.activeElement, this.returnValue = "", this.#n = null, this.#r = null, this.#i = null, e.showModal(), this.#m = !0;
197
202
  let n = this.#c();
198
- this.settle(), this.#S(e), this.#s.attach(), t(this, "vf-show", { focus: n }), n && _(n) && n.select?.();
203
+ this.settle(), this.#C(e), this.#s.attach(), t(this, "vf-show", { focus: n }), n && _(n) && n.select?.();
199
204
  } else !this.open && e.open && e.close();
200
205
  }
201
206
  }
202
- #y;
203
207
  #b;
204
208
  #x;
205
- #S(e) {
206
- typeof ResizeObserver < "u" && !this.#b && (this.#b = new ResizeObserver(this.#y), this.#b.observe(e)), window.addEventListener("resize", this.#y), this.#x ??= r(this.#y);
209
+ #S;
210
+ #C(e) {
211
+ typeof ResizeObserver < "u" && !this.#x && (this.#x = new ResizeObserver(this.#b), this.#x.observe(e)), window.addEventListener("resize", this.#b), this.#S ??= r(this.#b);
207
212
  }
208
- #C() {
209
- this.#b?.disconnect(), this.#b = void 0, window.removeEventListener("resize", this.#y), this.#x?.(), this.#x = void 0;
213
+ #w() {
214
+ this.#x?.disconnect(), this.#x = void 0, window.removeEventListener("resize", this.#b), this.#S?.(), this.#S = void 0;
210
215
  }
211
216
  disconnectedCallback() {
212
- super.disconnectedCallback(), this.#C();
217
+ super.disconnectedCallback(), this.#w();
213
218
  let e = this._dialog;
214
219
  if (e?.open) {
215
220
  e.close();
@@ -222,8 +227,11 @@ var p = 24, m = /* @__PURE__ */ new Set([
222
227
  this.#n = "escape";
223
228
  }
224
229
  _onNativeClose() {
230
+ !this.#m || this._dialog?.open || (this.open = !1, this.#T());
231
+ }
232
+ #T() {
225
233
  let e = this.#n ?? "close", n = this.#r, r = this.#i;
226
- this.#n = null, this.#r = null, this.#i = null, n !== null && (this.returnValue = n), this.#p = null, this.#o = null, this.#s.detach(), this.#C(), this.open = !1, this.#_(), t(this, "vf-close", {
234
+ this.#n = null, this.#r = null, this.#i = null, this.#m = !1, n !== null && (this.returnValue = n), this.#p = null, this.#o = null, this.#s.detach(), this.#w(), this.#v(), t(this, "vf-close", {
227
235
  reason: e,
228
236
  returnValue: n,
229
237
  ...r