vintage-frames 0.9.0 → 0.10.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.
@@ -9,36 +9,39 @@ import { vfFocusUnderline as f } from "../styles/recipes/focus.js";
9
9
  import { GridSnapController as p } from "../grid-snap.js";
10
10
  import { DocumentListenersController as m } from "../document-listeners.js";
11
11
  import { DragController as h } from "../drag.js";
12
- import "../motion.js";
13
- import { FocusRuleController as g } from "../focus-modality.js";
14
- import { deriveDragOutline as _, deriveOpenArt as v, dotOutline as y, penPhase as b } from "../open-art.js";
15
- import { LitElement as x, css as S, html as C, nothing as w } from "lit";
16
- import { property as T, state as E } from "lit/decorators.js";
12
+ import { prefersReducedMotion as g, runOutlineTravel as _ } from "../motion.js";
13
+ import { FocusRuleController as v } from "../focus-modality.js";
14
+ import { deriveDragOutline as y, deriveOpenArt as b, dotOutline as x, penPhase as S } from "../open-art.js";
15
+ import { LitElement as C, css as w, html as T, nothing as E } from "lit";
16
+ import { property as D, state as O } from "lit/decorators.js";
17
17
  //#region src/components/vf-icon.ts
18
- var D, O = {
18
+ var k, A = {
19
19
  large: 32,
20
20
  small: 16
21
- }, k = 1, A = 8, j = (e, t) => t <= 0 ? Math.max(e, 0) : Math.min(Math.max(e, 0), t), M = class extends c(x) {
21
+ }, j = 1, M = 8, N = (e, t) => t <= 0 ? Math.max(e, 0) : Math.min(Math.max(e, 0), t), P = class extends c(C) {
22
22
  static {
23
- D = this;
23
+ k = this;
24
24
  }
25
25
  constructor(...t) {
26
- 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 p(this), this.focusRule = new g(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 = new m(this, () => [[
26
+ 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 p(this), this.focusRule = new v(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 = new m(this, () => [[
27
27
  document,
28
28
  "pointerdown",
29
- this.#K,
29
+ this.#Z,
30
30
  !0
31
- ]]), this.#d = (e, t, n) => ({
32
- x: j(e, n.width - a(this.offsetWidth, this)),
33
- y: j(t, n.height - a(this.offsetHeight, this))
34
- }), this.#f = new s(this, (e, t, n) => this.#d(e, t, n)), this.#p = null, this.#m = new h(this, {
31
+ ]]), this.#d = (e, t, n) => this.#f() ? {
32
+ x: Math.max(e, 0),
33
+ y: Math.max(t, 0)
34
+ } : {
35
+ x: N(e, n.width - a(this.offsetWidth, this)),
36
+ y: N(t, n.height - a(this.offsetHeight, this))
37
+ }, this.#p = new s(this, (e, t, n) => this.#d(e, t, n)), this.#m = null, this.#h = new h(this, {
35
38
  onDragStart: (e) => {
36
39
  if (!this.movable || e.button !== 0 || this._editing) return null;
37
- this.#k();
38
- let t = this.#f.seed();
39
- return this.#p = {
40
+ this.#P();
41
+ let t = this.#p.seed();
42
+ return this.#m = {
40
43
  origin: t,
41
- frame: this.#_(),
44
+ frame: this.#S(),
42
45
  pointer: {
43
46
  clientX: e.clientX,
44
47
  clientY: e.clientY
@@ -46,63 +49,77 @@ var D, O = {
46
49
  proposal: null,
47
50
  outline: null,
48
51
  followers: [],
49
- size: this.#v()
52
+ size: this.#C()
50
53
  }, t;
51
54
  },
52
55
  onDrag: (e, t, n) => {
53
- this.#x(e, t, n);
56
+ this.#E(e, t, n);
54
57
  },
55
58
  onDragEnd: (e, t) => {
56
- this.#S(e, t);
59
+ this.#D(e, t);
57
60
  }
58
- }), this.#h = new m(this, () => [[
61
+ }), this.#g = new m(this, () => [[
59
62
  document,
60
63
  "keydown",
61
- this.#g,
64
+ this.#_,
62
65
  !0
63
- ]]), this.#g = (e) => {
64
- e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.#m.cancel());
65
- }, this.#O = !1, this.#M = () => {
66
- this.#P(), this.#R();
67
- }, this.#N = () => {
68
- this.#F();
69
- }, this.#U = (e) => {
66
+ ]]), this.#_ = (e) => {
67
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.#h.cancel());
68
+ }, this.#v = null, this.#y = new m(this, () => [[
69
+ document,
70
+ "pointerdown",
71
+ this.#b,
72
+ !0
73
+ ], [
74
+ document,
75
+ "keydown",
76
+ this.#x,
77
+ !0
78
+ ]]), this.#b = () => {
79
+ this.#v?.finish();
80
+ }, this.#x = (e) => {
81
+ e.key !== "Escape" || !this.#v || (e.preventDefault(), e.stopPropagation(), this.#v.finish());
82
+ }, this.#N = !1, this.#L = () => {
83
+ this.#z(), this.#U();
84
+ }, this.#R = () => {
85
+ this.#B();
86
+ }, this.#J = (e) => {
70
87
  if (e.button !== 0 || this._editing) return;
71
88
  let t = e.composedPath().some((e) => e instanceof HTMLElement && e.classList.contains("label")), n = this.selected, r = e.timeStamp - this.#l < 800;
72
- this.#l = e.timeStamp, this.#L();
89
+ this.#l = e.timeStamp, this.#H();
73
90
  let i = !e.shiftKey && !e.metaKey;
74
- this.selectable && (i ? this.#H(!0) : this.#H(!this.selected)), this.#a = i && n && this.#i !== null, this.editable && t && n && !r && !e.shiftKey && !e.metaKey && this.#I(), this.#B && (this.focus({ preventScroll: !0 }), this.focusRule.suppress()), this.#m.onPointerDown(e);
75
- }, this.#W = () => {
91
+ this.selectable && (i ? this.#q(!0) : this.#q(!this.selected)), this.#a = i && n && this.#i !== null, this.editable && t && n && !r && !e.shiftKey && !e.metaKey && this.#V(), this.#G && (this.focus({ preventScroll: !0 }), this.focusRule.suppress()), this.#h.onPointerDown(e);
92
+ }, this.#Y = () => {
76
93
  this._editing || e(this, "vf-open", {});
77
- }, this.#G = (e) => {
78
- if (this.#m.onPointerUp(e), !this.#a || (this.#a = !1, e.type !== "pointerup")) return;
94
+ }, this.#X = (e) => {
95
+ if (this.#h.onPointerUp(e), !this.#a || (this.#a = !1, e.type !== "pointerup")) return;
79
96
  let t = this.#i;
80
97
  if (t) for (let e of t.querySelectorAll("vf-icon")) e !== this && e.selected && e.setSelected(!1);
81
- }, this.#K = (e) => {
98
+ }, this.#Z = (e) => {
82
99
  let t = e.composedPath();
83
- if (t.includes(this) || (this.#L(), e.shiftKey || e.metaKey)) return;
100
+ if (t.includes(this) || (this.#H(), e.shiftKey || e.metaKey)) return;
84
101
  let n = this.#i;
85
102
  if (n !== null) {
86
- let e = t.find((e) => e instanceof D);
103
+ let e = t.find((e) => e instanceof k);
87
104
  if (e?.selected && e.#i === n) return;
88
105
  }
89
- this.#H(!1);
90
- }, this.#q = (e) => {
106
+ this.#q(!1);
107
+ }, this.#Q = (e) => {
91
108
  let t = e.target, n = e.data ?? e.dataTransfer?.getData("text") ?? "";
92
109
  if (n === "") return;
93
110
  let r = t.selectionStart ?? t.value.length, i = t.selectionEnd ?? r, a = t.value.slice(0, r) + n + t.value.slice(i);
94
- a.length > this.maxlength && this.#Y(a);
95
- }, this.#J = (e) => {
111
+ a.length > this.maxlength && this.#ee(a);
112
+ }, this.#$ = (e) => {
96
113
  let t = e.target;
97
114
  if (t.value.length > this.maxlength) {
98
115
  let e = t.value, n = Math.min(t.selectionStart ?? this.maxlength, this.maxlength);
99
- t.value = e.slice(0, this.maxlength), t.setSelectionRange(n, n), this.#Y(e);
116
+ t.value = e.slice(0, this.maxlength), t.setSelectionRange(n, n), this.#ee(e);
100
117
  }
101
118
  this._draft = t.value;
102
- }, this.#X = (e) => {
119
+ }, this.#te = (e) => {
103
120
  e.key === "Enter" ? (e.preventDefault(), this.commitEditing(), this.focus()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.cancelEditing(), this.focus());
104
- }, this.#Z = (t) => {
105
- if (this.#L(), !(this._editing || t.defaultPrevented)) {
121
+ }, this.#ne = (t) => {
122
+ if (this.#H(), !(this._editing || t.defaultPrevented)) {
106
123
  if ((t.metaKey || t.ctrlKey) && !t.altKey && (t.key.toLowerCase() === "o" || t.key === "ArrowDown")) {
107
124
  t.preventDefault(), e(this, "vf-open", {});
108
125
  return;
@@ -114,7 +131,7 @@ var D, O = {
114
131
  return;
115
132
  case " ":
116
133
  if (!this.selectable) return;
117
- t.preventDefault(), this.focusRule.reveal(), this.#H(!this.selected);
134
+ t.preventDefault(), this.focusRule.reveal(), this.#q(!this.selected);
118
135
  return;
119
136
  case "ArrowLeft":
120
137
  case "ArrowRight":
@@ -122,17 +139,17 @@ var D, O = {
122
139
  case "ArrowDown": {
123
140
  if (!this.movable) return;
124
141
  t.preventDefault(), this.focusRule.reveal();
125
- let e = t.shiftKey ? A : k, n = t.key === "ArrowLeft" ? -e : t.key === "ArrowRight" ? e : 0, r = t.key === "ArrowUp" ? -e : t.key === "ArrowDown" ? e : 0;
126
- this.#k();
127
- let i = this.#f.seed();
128
- this.#f.moveTo(i.x + n, i.y + r);
142
+ let e = t.shiftKey ? M : j, n = t.key === "ArrowLeft" ? -e : t.key === "ArrowRight" ? e : 0, r = t.key === "ArrowUp" ? -e : t.key === "ArrowDown" ? e : 0;
143
+ this.#P();
144
+ let i = this.#p.seed();
145
+ this.#p.moveTo(i.x + n, i.y + r);
129
146
  }
130
147
  }
131
148
  }
132
149
  };
133
150
  }
134
151
  static {
135
- this.styles = [d, S`
152
+ this.styles = [d, w`
136
153
  :host {
137
154
  display: inline-block;
138
155
  cursor: var(--vf-cursor, default);
@@ -375,15 +392,27 @@ var D, O = {
375
392
  #l;
376
393
  #u;
377
394
  #d;
378
- #f;
395
+ #f() {
396
+ let e = this.offsetParent, t = this.assignedSlot ?? this.parentNode;
397
+ for (; t && t !== e;) if (t instanceof Element) {
398
+ if (t.localName === "vf-scroll-area") return !0;
399
+ t = t.assignedSlot ?? t.parentNode;
400
+ } else t = t instanceof ShadowRoot ? t.host : null;
401
+ return !1;
402
+ }
379
403
  #p;
380
404
  #m;
381
405
  #h;
382
406
  #g;
383
- #_() {
407
+ #_;
408
+ #v;
409
+ #y;
410
+ #b;
411
+ #x;
412
+ #S() {
384
413
  return this.renderRoot?.querySelector(".frame")?.getBoundingClientRect() ?? this.getBoundingClientRect();
385
414
  }
386
- #v() {
415
+ #C() {
387
416
  return {
388
417
  width: a(this.offsetWidth, this),
389
418
  height: a(this.offsetHeight, this)
@@ -391,22 +420,22 @@ var D, O = {
391
420
  }
392
421
  followDrag(e) {
393
422
  if (!this.movable || this._editing) return null;
394
- let t = this.#f.seed(), n = this.#T(this.#_(), e);
423
+ let t = this.#p.seed(), n = this.#A(this.#S(), e);
395
424
  return {
396
425
  icon: this,
397
426
  origin: t,
398
- offset: this.#f.offset,
399
- size: this.#v(),
427
+ offset: this.#p.offset,
428
+ size: this.#C(),
400
429
  move: (e, t) => {
401
- n && this.#E(n, e, t);
430
+ n && this.#j(n, e, t);
402
431
  },
403
432
  drop: (e, n) => {
404
- this.#f.moveTo(t.x + e, t.y + n);
433
+ this.#p.moveTo(t.x + e, t.y + n);
405
434
  },
406
435
  end: () => n?.canvas.remove()
407
436
  };
408
437
  }
409
- #y(e) {
438
+ #w(e) {
410
439
  if (!this.selected) return [];
411
440
  let t = this.#i;
412
441
  if (!t) return [];
@@ -418,26 +447,26 @@ var D, O = {
418
447
  }
419
448
  return n;
420
449
  }
421
- #b(e) {
450
+ #T(e) {
422
451
  return [this, ...e.followers.map((e) => e.icon)];
423
452
  }
424
- #x(t, n, r) {
425
- let i = this.#p;
453
+ #E(t, n, r) {
454
+ let i = this.#m;
426
455
  if (!i) return;
427
456
  if (i.pointer = {
428
457
  clientX: r.clientX,
429
458
  clientY: r.clientY
430
459
  }, !i.proposal) {
431
460
  if (t === i.origin.x && n === i.origin.y) return;
432
- this.#L(), this.#a = !1, i.proposal = {
461
+ this.#H(), this.#a = !1, i.proposal = {
433
462
  left: i.origin.x,
434
463
  top: i.origin.y
435
- }, this.#h.attach();
436
- let r = this.#w();
437
- i.outline = this.#T(i.frame, r), i.followers = this.#y(r), e(this, "vf-drag-start", {
464
+ }, this.#g.attach();
465
+ let r = this.#k();
466
+ i.outline = this.#A(i.frame, r), i.followers = this.#w(r), e(this, "vf-drag-start", {
438
467
  left: i.origin.x,
439
468
  top: i.origin.y,
440
- icons: this.#b(i)
469
+ icons: this.#T(i)
441
470
  });
442
471
  }
443
472
  if (t === i.proposal.left && n === i.proposal.top) return;
@@ -446,14 +475,14 @@ var D, O = {
446
475
  top: n
447
476
  };
448
477
  let a = t - i.origin.x, o = n - i.origin.y;
449
- i.outline && this.#E(i.outline, a, o);
478
+ i.outline && this.#j(i.outline, a, o);
450
479
  for (let e of i.followers) e.move(a, o);
451
- e(this, "vf-drag", this.#D(i));
480
+ e(this, "vf-drag", this.#M(i));
452
481
  }
453
- #S(t, n) {
454
- let r = this.#p;
455
- if (this.#p = null, !r?.proposal) return;
456
- this.#h.detach(), r.outline?.canvas.remove();
482
+ #D(t, n) {
483
+ let r = this.#m;
484
+ if (this.#m = null, !r?.proposal) return;
485
+ this.#g.detach(), r.outline?.canvas.remove();
457
486
  for (let e of r.followers) e.end();
458
487
  if (t && (r.pointer = {
459
488
  clientX: t.clientX,
@@ -462,36 +491,36 @@ var D, O = {
462
491
  e(this, "vf-drag-cancel", {});
463
492
  return;
464
493
  }
465
- let i = this.#D(r);
466
- e(this, "vf-drop", i, { cancelable: !0 }) && this.#C(r, i);
494
+ let i = this.#M(r);
495
+ e(this, "vf-drop", i, { cancelable: !0 }) && this.#O(r, i);
467
496
  }
468
- #C(e, t) {
497
+ #O(e, t) {
469
498
  if (e.followers.length === 0) {
470
- this.#f.moveTo(t.left, t.top);
499
+ this.#p.moveTo(t.left, t.top);
471
500
  return;
472
501
  }
473
- let n = this.#f.bounds, r = (e, t) => ({
502
+ let n = this.#p.bounds, r = (e, t) => ({
474
503
  x: e.x - t.x,
475
504
  y: e.y - t.y
476
505
  }), i = [{
477
- corner: r(e.origin, this.#f.offset),
506
+ corner: r(e.origin, this.#p.offset),
478
507
  size: e.size
479
508
  }, ...e.followers.map((e) => ({
480
509
  corner: r(e.origin, e.offset),
481
510
  size: e.size
482
- }))], a = (e, t, n, r) => {
483
- let a = -Infinity, o = Infinity;
484
- for (let e of i) a = Math.max(a, -t(e)), o = Math.min(o, r - n(e) - t(e));
485
- return o < a && (o = Infinity), Math.min(Math.max(e, a), o);
486
- }, o = a(t.left - e.origin.x, (e) => e.corner.x, (e) => e.size.width, n.width), s = a(t.top - e.origin.y, (e) => e.corner.y, (e) => e.size.height, n.height);
487
- this.#f.moveTo(e.origin.x + o, e.origin.y + s);
488
- for (let t of e.followers) t.drop(o, s);
489
- }
490
- #w() {
511
+ }))], a = this.#f(), o = (e, t, n, r) => {
512
+ let o = -Infinity, s = Infinity;
513
+ for (let e of i) o = Math.max(o, -t(e)), a || (s = Math.min(s, r - n(e) - t(e)));
514
+ return s < o && (s = Infinity), Math.min(Math.max(e, o), s);
515
+ }, s = o(t.left - e.origin.x, (e) => e.corner.x, (e) => e.size.width, n.width), c = o(t.top - e.origin.y, (e) => e.corner.y, (e) => e.size.height, n.height);
516
+ this.#p.moveTo(e.origin.x + s, e.origin.y + c);
517
+ for (let t of e.followers) t.drop(s, c);
518
+ }
519
+ #k() {
491
520
  let t = { surface: null };
492
521
  return e(this, "vf-drag-surface-request", t, { composed: !1 }), t.surface;
493
522
  }
494
- #T(e, t) {
523
+ #A(e, t) {
495
524
  let n = this.renderRoot, a = n?.querySelector(".frame");
496
525
  if (!a) return null;
497
526
  let o = r(this), s = n.querySelector(".art"), c = n.querySelector(".name")?.getBoundingClientRect() ?? null, l = c ? Math.min(e.left, c.left) : e.left, u = c ? Math.min(e.top, c.top) : e.top, d = c ? Math.max(e.right, c.right) : e.right, f = c ? Math.max(e.bottom, c.bottom) : e.bottom, p = (e) => ({
@@ -499,10 +528,10 @@ var D, O = {
499
528
  y: Math.round((e.top - u) / o),
500
529
  width: Math.round(e.width / o),
501
530
  height: Math.round(e.height / o)
502
- }), m = Math.round((d - l) / o), h = Math.round((f - u) / o), g = this.open && this._ghost ? this._ghost : this.#t, v = g != null && (g instanceof HTMLCanvasElement ? g.width > 0 : g.complete && g.naturalWidth > 0), y = v ? g.getBoundingClientRect() : null, b = _(v ? g : null, {
531
+ }), m = Math.round((d - l) / o), h = Math.round((f - u) / o), g = this.open && this._ghost ? this._ghost : this.#t, _ = g != null && (g instanceof HTMLCanvasElement ? g.width > 0 : g.complete && g.naturalWidth > 0), v = _ ? g.getBoundingClientRect() : null, b = y(_ ? g : null, {
503
532
  width: m,
504
533
  height: h,
505
- art: y && y.width > 0 ? p(y) : null,
534
+ art: v && v.width > 0 ? p(v) : null,
506
535
  cell: s ? p(s.getBoundingClientRect()) : {
507
536
  x: 0,
508
537
  y: 0,
@@ -527,13 +556,13 @@ var D, O = {
527
556
  phase: -1
528
557
  };
529
558
  }
530
- #E(e, t, n) {
559
+ #j(e, t, n) {
531
560
  let r = e.base.x + t, a = e.base.y + n;
532
561
  e.canvas.style.left = i(r), e.canvas.style.top = i(a);
533
- let o = b(r, a);
534
- o !== e.phase && (e.phase = o, y(e.ring, e.canvas, o));
562
+ let o = S(r, a);
563
+ o !== e.phase && (e.phase = o, x(e.ring, e.canvas, o));
535
564
  }
536
- #D(e) {
565
+ #M(e) {
537
566
  let { left: t, top: n } = e.proposal ?? {
538
567
  left: e.origin.x,
539
568
  top: e.origin.y
@@ -545,32 +574,32 @@ var D, O = {
545
574
  top: n,
546
575
  x: e.frame.left + (t - e.origin.x) * i,
547
576
  y: e.frame.top + (n - e.origin.y) * i,
548
- icons: this.#b(e)
577
+ icons: this.#T(e)
549
578
  };
550
579
  }
551
580
  connectedCallback() {
552
- super.connectedCallback(), this.#V(), this.#R(), this.selectable && this.selected && this.#u.attach(), this.addEventListener("keydown", this.#Z);
581
+ super.connectedCallback(), this.#K(), this.#U(), this.selectable && this.selected && this.#u.attach(), this.addEventListener("keydown", this.#ne);
553
582
  }
554
583
  disconnectedCallback() {
555
- super.disconnectedCallback(), this.removeEventListener("keydown", this.#Z), this.#L(), this.#p?.outline?.canvas.remove();
556
- for (let e of this.#p?.followers ?? []) e.end();
557
- this.#p = null;
584
+ super.disconnectedCallback(), this.removeEventListener("keydown", this.#ne), this.#H(), this.#m?.outline?.canvas.remove();
585
+ for (let e of this.#m?.followers ?? []) e.end();
586
+ this.#m = null, this.#v?.finish();
558
587
  }
559
588
  updated(e) {
560
- if (e.has("selectable") && this.#V(), (e.has("selectable") || e.has("selected") || e.has("label")) && this.#R(), (e.has("selected") || e.has("selectable")) && (this.selectable && this.selected ? this.#u.attach() : this.#u.detach()), e.has("_editing") && this._editing) {
589
+ if (e.has("selectable") && this.#K(), (e.has("selectable") || e.has("selected") || e.has("label")) && this.#U(), (e.has("selected") || e.has("selectable")) && (this.selectable && this.selected ? this.#u.attach() : this.#u.detach()), e.has("_editing") && this._editing) {
561
590
  let e = this.renderRoot.querySelector("input");
562
591
  e?.focus(), e?.select();
563
592
  }
564
- (e.has("label") || e.has("_draft") || e.has("_editing")) && this.#A(), (e.has("open") || e.has("size")) && this.#P();
593
+ (e.has("label") || e.has("_draft") || e.has("_editing")) && this.#F(), (e.has("open") || e.has("size")) && this.#z();
565
594
  }
566
- #O;
567
- #k() {
568
- this.#O ||= l(this, `vf-icon${this.label ? ` ("${this.label}")` : ""}`, "<vf-icon movable label=\"Read Me\" width=\"64\" top=\"16\" left=\"16\">");
595
+ #N;
596
+ #P() {
597
+ this.#N ||= l(this, `vf-icon${this.label ? ` ("${this.label}")` : ""}`, "<vf-icon movable label=\"Read Me\" width=\"64\" top=\"16\" left=\"16\">");
569
598
  }
570
599
  firstUpdated() {
571
- document.fonts.ready.then(() => this.#A());
600
+ document.fonts.ready.then(() => this.#F());
572
601
  }
573
- #A() {
602
+ #F() {
574
603
  let e = this.renderRoot?.querySelector(".name");
575
604
  if (!e) {
576
605
  this.#e = 0;
@@ -582,14 +611,14 @@ var D, O = {
582
611
  n.selectNodeContents(e), t = n.getBoundingClientRect().width, n.detach();
583
612
  }
584
613
  let n = t / r(this) + 2, i = Math.max(2, Math.ceil(n / 2) * 2);
585
- this.#e = this._editing && t === 0 ? Math.max(i, O[this.size]) : i, e.style.width = this.#j;
614
+ this.#e = this._editing && t === 0 ? Math.max(i, A[this.size]) : i, e.style.width = this.#I;
586
615
  }
587
- get #j() {
616
+ get #I() {
588
617
  return this.#e ? `calc(var(--vf-scale, 1) * ${this.#e}px)` : "";
589
618
  }
590
- #M;
591
- #N;
592
- #P() {
619
+ #L;
620
+ #R;
621
+ #z() {
593
622
  let e = this.renderRoot?.querySelector(`slot[name='${this.size}']`), t = null;
594
623
  for (let n of e?.assignedElements({ flatten: !0 }) ?? []) {
595
624
  let e = n instanceof HTMLImageElement || n instanceof HTMLCanvasElement ? n : n.querySelector("img, canvas");
@@ -598,9 +627,9 @@ var D, O = {
598
627
  break;
599
628
  }
600
629
  }
601
- t !== this.#t && (this.#t?.removeEventListener("load", this.#N), this.#t?.removeEventListener("error", this.#N), this.#t = t, t?.addEventListener("load", this.#N), t?.addEventListener("error", this.#N)), this.#F();
630
+ t !== this.#t && (this.#t?.removeEventListener("load", this.#R), this.#t?.removeEventListener("error", this.#R), this.#t = t, t?.addEventListener("load", this.#R), t?.addEventListener("error", this.#R)), this.#B();
602
631
  }
603
- #F() {
632
+ #B() {
604
633
  let e = this.#t, t = e instanceof HTMLImageElement ? e.complete && e.naturalWidth > 0 : e != null && e.width > 0;
605
634
  if (!this.open || e == null || !t) {
606
635
  this._ghost = null, this.#o = "";
@@ -608,7 +637,7 @@ var D, O = {
608
637
  }
609
638
  let n = e instanceof HTMLImageElement ? `${this.size} ${e.currentSrc}` : "";
610
639
  if (n !== "" && n === this.#o && this._ghost) return;
611
- let r = v(e);
640
+ let r = b(e);
612
641
  if (r) {
613
642
  r.className = "ghost", r.style.width = `calc(var(--vf-scale, 1) * ${r.width}px)`, r.style.height = `calc(var(--vf-scale, 1) * ${r.height}px)`;
614
643
  let t = e instanceof HTMLImageElement ? e.alt : "";
@@ -616,16 +645,16 @@ var D, O = {
616
645
  }
617
646
  this._ghost = r, this.#o = r ? n : "";
618
647
  }
619
- #I() {
620
- this.#L(), this.#c = window.setTimeout(() => {
648
+ #V() {
649
+ this.#H(), this.#c = window.setTimeout(() => {
621
650
  this.#c = 0, this.startEditing();
622
651
  }, 800);
623
652
  }
624
- #L() {
653
+ #H() {
625
654
  this.#c &&= (clearTimeout(this.#c), 0);
626
655
  }
627
656
  startEditing() {
628
- this.#L(), !(!this.editable || this._editing) && (this.#s = this.label, this._draft = this.label, this._editing = !0);
657
+ this.#H(), !(!this.editable || this._editing) && (this.#s = this.label, this._draft = this.label, this._editing = !0);
629
658
  }
630
659
  commitEditing() {
631
660
  if (!this._editing) return;
@@ -649,45 +678,45 @@ var D, O = {
649
678
  }
650
679
  render() {
651
680
  let e = this._editing, t = e ? this._draft : this.label, n = this.focusRule.marked && !e, r = t !== "" || e, i = `caption${e ? " editing" : ""}${n && t ? " focus-rule" : ""}`, a = `art${this.open && this._ghost ? " open" : ""}${n && !t ? " focus-rule" : ""}`, o = this.width ? `width: calc(var(--vf-scale, 1) * ${this.width}px)` : "";
652
- return C`<div
681
+ return T`<div
653
682
  class="frame vf-snap"
654
683
  part="frame"
655
684
  style=${o}
656
- @pointerdown=${this.#U}
657
- @pointermove=${this.#m.onPointerMove}
658
- @pointerup=${this.#G}
659
- @pointercancel=${this.#G}
660
- @dblclick=${this.#W}
685
+ @pointerdown=${this.#J}
686
+ @pointermove=${this.#h.onPointerMove}
687
+ @pointerup=${this.#X}
688
+ @pointercancel=${this.#X}
689
+ @dblclick=${this.#Y}
661
690
  >
662
691
  <div class=${a} part="icon">
663
- ${this.size === "small" ? C`<slot name="small" @slotchange=${this.#M}></slot>` : C`<slot name="large" @slotchange=${this.#M}></slot>`}${this._ghost ?? w}
692
+ ${this.size === "small" ? T`<slot name="small" @slotchange=${this.#L}></slot>` : T`<slot name="large" @slotchange=${this.#L}></slot>`}${this._ghost ?? E}
664
693
  </div>
665
- ${r ? C`<div class=${i}>
694
+ ${r ? T`<div class=${i}>
666
695
  <!-- No whitespace around the span: it is the measured run, and a
667
696
  stray space would widen it. -->
668
697
  <div class="label" part="label"><span
669
698
  class="name"
670
699
  part="plate"
671
- style=${this.#e ? `width: ${this.#j}` : ""}
700
+ style=${this.#e ? `width: ${this.#I}` : ""}
672
701
  >${t}</span
673
702
  ></div>
674
- ${e ? C`<div class="rename-box">
703
+ ${e ? T`<div class="rename-box">
675
704
  <input
676
705
  class="rename"
677
706
  part="input"
678
707
  type="text"
679
708
  maxlength=${this.maxlength}
680
709
  .value=${this._draft}
681
- @beforeinput=${this.#q}
682
- @input=${this.#J}
683
- @keydown=${this.#X}
710
+ @beforeinput=${this.#Q}
711
+ @input=${this.#$}
712
+ @keydown=${this.#te}
684
713
  @blur=${this.commitEditing}
685
714
  />
686
- </div>` : w}
687
- </div>` : w}
715
+ </div>` : E}
716
+ </div>` : E}
688
717
  </div>`;
689
718
  }
690
- #R() {
719
+ #U() {
691
720
  if (!this.selectable) {
692
721
  this.#n.role = null, this.#n.ariaSelected = null, this.#n.ariaLabel = null;
693
722
  return;
@@ -696,22 +725,22 @@ var D, O = {
696
725
  this.#n.role = "option", this.#n.ariaSelected = this.selected ? "true" : "false", this.#n.ariaLabel = null;
697
726
  return;
698
727
  }
699
- this.#n.role = "img", this.#n.ariaSelected = null, this.#n.ariaLabel = this.label || this.#z || null;
728
+ this.#n.role = "img", this.#n.ariaSelected = null, this.#n.ariaLabel = this.label || this.#W || null;
700
729
  }
701
- get #z() {
730
+ get #W() {
702
731
  return this.#t instanceof HTMLImageElement ? this.#t.alt : "";
703
732
  }
704
- get #B() {
733
+ get #G() {
705
734
  return this.selectable;
706
735
  }
707
- #V() {
708
- this.hasAttribute("tabindex") || (this.#B ? this.tabIndex = 0 : this.removeAttribute("tabindex"));
736
+ #K() {
737
+ this.hasAttribute("tabindex") || (this.#G ? this.tabIndex = 0 : this.removeAttribute("tabindex"));
709
738
  }
710
- #H(t) {
739
+ #q(t) {
711
740
  t !== this.selected && (this.selected = t, e(this, "vf-select", { selected: t }));
712
741
  }
713
742
  setSelected(e) {
714
- this.#H(e);
743
+ this.#q(e);
715
744
  }
716
745
  touches(e) {
717
746
  let t = this.renderRoot;
@@ -724,43 +753,57 @@ var D, O = {
724
753
  }
725
754
  return !1;
726
755
  }
727
- #U;
728
- #W;
729
- #G;
730
- #K;
731
- #q;
756
+ moveTo(e, t) {
757
+ this.#v?.finish(), this.#P(), this.#p.seed(), this.#p.moveTo(e, t);
758
+ }
759
+ async dragTo(e, t) {
760
+ if (this.#v?.finish(), await this.updateComplete, this.#v?.finish(), !this.isConnected) return !1;
761
+ this.#P();
762
+ let n = this.#p.seed(), r = this.#p.resolve(e, t), i = r.x - n.x, a = r.y - n.y, o = i === 0 && a === 0 || g() || this._editing || this.#m !== null ? null : this.#A(this.#S(), this.#k());
763
+ return o ? (this.#j(o, 0, 0), new Promise((e) => {
764
+ let t = null;
765
+ t = _(Math.hypot(i, a), (e) => this.#j(o, Math.round(i * e), Math.round(a * e)), () => {
766
+ this.#v === t && (this.#v = null, this.#y.detach()), o.canvas.remove(), this.isConnected && this.#p.moveTo(r.x, r.y), e(!0);
767
+ }), this.#v = t, this.#y.attach();
768
+ })) : (this.#p.moveTo(r.x, r.y), !1);
769
+ }
732
770
  #J;
733
- #Y(t) {
771
+ #Y;
772
+ #X;
773
+ #Z;
774
+ #Q;
775
+ #$;
776
+ #ee(t) {
734
777
  e(this, "vf-name-too-long", {
735
778
  attempted: t,
736
779
  accepted: t.slice(0, this.maxlength),
737
780
  limit: this.maxlength
738
781
  });
739
782
  }
740
- #X;
741
- #Z;
783
+ #te;
784
+ #ne;
742
785
  };
743
- o([T()], M.prototype, "label", void 0), o([T({ reflect: !0 })], M.prototype, "size", void 0), o([T({
786
+ o([D()], P.prototype, "label", void 0), o([D({ reflect: !0 })], P.prototype, "size", void 0), o([D({
744
787
  type: Boolean,
745
788
  reflect: !0
746
- })], M.prototype, "selectable", void 0), o([T({
789
+ })], P.prototype, "selectable", void 0), o([D({
747
790
  type: Boolean,
748
791
  reflect: !0
749
- })], M.prototype, "selected", void 0), o([T({
792
+ })], P.prototype, "selected", void 0), o([D({
750
793
  type: Boolean,
751
794
  reflect: !0
752
- })], M.prototype, "target", void 0), o([T({
795
+ })], P.prototype, "target", void 0), o([D({
753
796
  type: Boolean,
754
797
  reflect: !0
755
- })], M.prototype, "color", void 0), o([T({
798
+ })], P.prototype, "color", void 0), o([D({
756
799
  type: Boolean,
757
800
  reflect: !0
758
- })], M.prototype, "open", void 0), o([T({
801
+ })], P.prototype, "open", void 0), o([D({
759
802
  type: Boolean,
760
803
  reflect: !0
761
- })], M.prototype, "movable", void 0), o([T({
804
+ })], P.prototype, "movable", void 0), o([D({
762
805
  type: Boolean,
763
806
  reflect: !0
764
- })], M.prototype, "editable", void 0), o([T({ type: Number })], M.prototype, "width", void 0), o([T({ type: Number })], M.prototype, "maxlength", void 0), o([E()], M.prototype, "_editing", void 0), o([E()], M.prototype, "_draft", void 0), o([E()], M.prototype, "_ghost", void 0), M = D = o([t("vf-icon")], M);
807
+ })], P.prototype, "editable", void 0), o([D({ type: Number })], P.prototype, "width", void 0), o([D({ type: Number })], P.prototype, "maxlength", void 0), o([O()], P.prototype, "_editing", void 0), o([O()], P.prototype, "_draft", void 0), o([O()], P.prototype, "_ghost", void 0), P = k = o([t("vf-icon")], P);
765
808
  //#endregion
766
- export { M as VfIcon };
809
+ export { P as VfIcon };