@m3ui-vue/m3ui-vue 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/m3ui.js CHANGED
@@ -10078,6 +10078,14 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10078
10078
  default: !0
10079
10079
  },
10080
10080
  decorKinds: {},
10081
+ rotatable: {
10082
+ type: Boolean,
10083
+ default: !0
10084
+ },
10085
+ dragMerged: {
10086
+ type: Boolean,
10087
+ default: !1
10088
+ },
10081
10089
  selectable: { default: "none" },
10082
10090
  canMerge: {},
10083
10091
  label: {}
@@ -10306,7 +10314,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10306
10314
  re = !1, clearTimeout(ne), n ? ne = window.setTimeout(() => {
10307
10315
  M && !M.moved && (re = !0, o.value = o.value.includes(t.id) ? o.value.filter((e) => e !== t.id) : [...o.value, t.id], navigator.vibrate?.(10));
10308
10316
  }, 450) : o.value.includes(t.id) || (o.value = e.shiftKey || e.ctrlKey || e.metaKey ? [...o.value, t.id] : [t.id]);
10309
- let a = o.value.includes(t.id) ? o.value : [t.id];
10317
+ let a = le(o.value.includes(t.id) ? o.value : [t.id]);
10310
10318
  M = {
10311
10319
  id: e.pointerId,
10312
10320
  sx: e.clientX,
@@ -10346,7 +10354,13 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10346
10354
  function ce(e, t) {
10347
10355
  te || (r.editable && !(e.shiftKey || e.ctrlKey || e.metaKey) ? o.value = [t.id] : !r.editable && r.selectable === "single" ? o.value = o.value.length === 1 && o.value[0] === t.id ? [] : [t.id] : !r.editable && r.selectable === "multiple" && (o.value = o.value.includes(t.id) ? o.value.filter((e) => e !== t.id) : [...o.value, t.id]), b("table-click", t, e));
10348
10356
  }
10349
- function le(e, t) {
10357
+ function le(e) {
10358
+ if (!r.dragMerged) return e;
10359
+ let t = new Set(e);
10360
+ for (let n of e) for (let e of a.value) e.tables.includes(n) && e.tables.forEach((e) => t.add(e));
10361
+ return [...t];
10362
+ }
10363
+ function ue(e, t) {
10350
10364
  if (e.key === "Enter" || e.key === " ") {
10351
10365
  e.preventDefault(), b("table-click", t, e);
10352
10366
  return;
@@ -10359,13 +10373,13 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10359
10373
  }[e.key];
10360
10374
  if (!n || !r.editable) return;
10361
10375
  e.preventDefault();
10362
- let a = (r.grid || 1) * (e.shiftKey ? 5 : 1), s = o.value.includes(t.id) ? o.value : [t.id];
10376
+ let a = (r.grid || 1) * (e.shiftKey ? 5 : 1), s = le(o.value.includes(t.id) ? o.value : [t.id]);
10363
10377
  se(new Map(i.value.filter((e) => s.includes(e.id)).map((e) => [e.id, P(e, e.x + n[0] * a, e.y + n[1] * a)])));
10364
10378
  }
10365
10379
  Ge(() => {
10366
10380
  window.removeEventListener("pointermove", ae), window.removeEventListener("pointerup", oe), window.removeEventListener("pointercancel", oe);
10367
10381
  });
10368
- let ue = {
10382
+ let de = {
10369
10383
  door: {
10370
10384
  label: "Door",
10371
10385
  icon: "door_front",
@@ -10423,21 +10437,21 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10423
10437
  height: 30,
10424
10438
  shape: "text"
10425
10439
  }
10426
- }, de = L(() => {
10427
- let e = { ...ue };
10440
+ }, fe = L(() => {
10441
+ let e = { ...de };
10428
10442
  for (let [t, n] of Object.entries(r.decorKinds ?? {})) e[t] = {
10429
10443
  ...e[t],
10430
10444
  ...n
10431
10445
  };
10432
10446
  return e;
10433
- }), fe = (e) => de.value[e.kind] ?? {
10447
+ }), pe = (e) => fe.value[e.kind] ?? {
10434
10448
  width: 40,
10435
10449
  height: 40
10436
- }, pe = (e) => ({
10437
- w: e.width ?? fe(e).width,
10438
- h: e.height ?? fe(e).height
10450
+ }, me = (e) => ({
10451
+ w: e.width ?? pe(e).width,
10452
+ h: e.height ?? pe(e).height
10439
10453
  });
10440
- function me(e) {
10454
+ function he(e) {
10441
10455
  let t = e.shape ?? "box";
10442
10456
  if (t === "text") return {};
10443
10457
  let n = e.color ?? (t === "bar" ? "surface-container-highest" : "surface-container-high");
@@ -10446,7 +10460,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10446
10460
  borderRadius: t === "round" ? "9999px" : t === "bar" ? "2px" : "8px"
10447
10461
  };
10448
10462
  }
10449
- function he(e) {
10463
+ function ge(e) {
10450
10464
  let t = e ?? "secondary";
10451
10465
  return k.has(t) ? {
10452
10466
  background: `color-mix(in srgb, var(--color-${t}-container) 45%, transparent)`,
@@ -10456,14 +10470,14 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10456
10470
  borderColor: t
10457
10471
  };
10458
10472
  }
10459
- let ge = (e, t) => f.value?.kind === e && f.value.id === t, _e = (e) => {
10473
+ let _e = (e, t) => f.value?.kind === e && f.value.id === t, ve = (e) => {
10460
10474
  let t = S.value.getBoundingClientRect();
10461
10475
  return {
10462
10476
  x: (e.clientX - t.left) / w.value,
10463
10477
  y: (e.clientY - t.top) / w.value
10464
10478
  };
10465
10479
  };
10466
- function ve(e, t, n) {
10480
+ function ye(e, t, n) {
10467
10481
  S.value?.focus({ preventScroll: !0 });
10468
10482
  let r = e.clientX, i = e.clientY, a = !1, o = (n) => {
10469
10483
  n.pointerId === e.pointerId && (!a && Math.hypot(n.clientX - r, n.clientY - i) < 4 || (a = !0, t((n.clientX - r) / w.value, (n.clientY - i) / w.value)));
@@ -10472,14 +10486,14 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10472
10486
  };
10473
10487
  window.addEventListener("pointermove", o), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s);
10474
10488
  }
10475
- let ye = tt(null), be = L(() => s.value.map((e) => ye.value?.id === e.id ? ye.value : e).concat(ye.value && !s.value.some((e) => e.id === ye.value.id) ? [ye.value] : []));
10476
- function xe(e, t, n) {
10489
+ let be = tt(null), xe = L(() => s.value.map((e) => be.value?.id === e.id ? be.value : e).concat(be.value && !s.value.some((e) => e.id === be.value.id) ? [be.value] : []));
10490
+ function Se(e, t, n) {
10477
10491
  r.editable && d.value === "select" && e.button === 0 && (e.stopPropagation(), f.value = {
10478
10492
  kind: "area",
10479
10493
  id: t.id
10480
- }, o.value = [], ve(e, (e, i) => {
10494
+ }, o.value = [], ye(e, (e, i) => {
10481
10495
  if (!n) {
10482
- ye.value = {
10496
+ be.value = {
10483
10497
  ...t,
10484
10498
  x: t.x + e,
10485
10499
  y: t.y + i
@@ -10487,7 +10501,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10487
10501
  return;
10488
10502
  }
10489
10503
  let a = r.grid || 20, o = n.includes("w"), s = n[0] === "n", c = Math.max(a, t.width + (o ? -e : e)), l = Math.max(a, t.height + (s ? -i : i));
10490
- ye.value = {
10504
+ be.value = {
10491
10505
  ...t,
10492
10506
  x: o ? t.x + t.width - c : t.x,
10493
10507
  y: s ? t.y + t.height - l : t.y,
@@ -10495,8 +10509,8 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10495
10509
  height: l
10496
10510
  };
10497
10511
  }, () => {
10498
- let e = ye.value;
10499
- ye.value = null, g(), s.value = s.value.map((n) => n.id === t.id ? {
10512
+ let e = be.value;
10513
+ be.value = null, g(), s.value = s.value.map((n) => n.id === t.id ? {
10500
10514
  ...e,
10501
10515
  x: N(e.x),
10502
10516
  y: N(e.y),
@@ -10505,15 +10519,15 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10505
10519
  } : n);
10506
10520
  }));
10507
10521
  }
10508
- let Se = tt(null), Ce = L(() => u.value.map((e) => Se.value?.id === e.id ? Se.value : e));
10509
- function we(e, t, n = !1) {
10522
+ let Ce = tt(null), we = L(() => u.value.map((e) => Ce.value?.id === e.id ? Ce.value : e));
10523
+ function Te(e, t, n = !1) {
10510
10524
  if (!r.editable || d.value !== "select" || e.button !== 0) return;
10511
10525
  e.stopPropagation(), f.value = {
10512
10526
  kind: "decor",
10513
10527
  id: t.id
10514
10528
  }, o.value = [];
10515
- let i = pe(t);
10516
- ve(e, (e, r) => Se.value = n ? {
10529
+ let i = me(t);
10530
+ ye(e, (e, r) => Ce.value = n ? {
10517
10531
  ...t,
10518
10532
  width: Math.max(10, i.w + e * 2),
10519
10533
  height: Math.max(6, i.h + r * 2)
@@ -10522,8 +10536,8 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10522
10536
  x: t.x + e,
10523
10537
  y: t.y + r
10524
10538
  }, () => {
10525
- let e = Se.value;
10526
- Se.value = null, g(), u.value = u.value.map((r) => r.id === t.id ? n ? {
10539
+ let e = Ce.value;
10540
+ Ce.value = null, g(), u.value = u.value.map((r) => r.id === t.id ? n ? {
10527
10541
  ...e,
10528
10542
  width: Math.round(e.width),
10529
10543
  height: Math.round(e.height)
@@ -10534,53 +10548,53 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10534
10548
  } : r);
10535
10549
  });
10536
10550
  }
10537
- let Te = tt(null), Ee = L(() => l.value.map((e) => Te.value?.id === e.id ? Te.value : e)), De = (e) => e.points.map(([e, t], n) => `${n ? "L" : "M"}${e * w.value} ${t * w.value}`).join("");
10538
- function Oe(e, t, n = -1) {
10551
+ let Ee = tt(null), De = L(() => l.value.map((e) => Ee.value?.id === e.id ? Ee.value : e)), Oe = (e) => e.points.map(([e, t], n) => `${n ? "L" : "M"}${e * w.value} ${t * w.value}`).join("");
10552
+ function ke(e, t, n = -1) {
10539
10553
  r.editable && d.value === "select" && e.button === 0 && (e.stopPropagation(), f.value = {
10540
10554
  kind: "wall",
10541
10555
  id: t.id,
10542
10556
  ...n >= 0 && { vertex: n }
10543
- }, o.value = [], ve(e, (e, r) => {
10544
- Te.value = {
10557
+ }, o.value = [], ye(e, (e, r) => {
10558
+ Ee.value = {
10545
10559
  ...t,
10546
10560
  points: t.points.map(([t, i], a) => n < 0 || a === n ? [t + e, i + r] : [t, i])
10547
10561
  };
10548
10562
  }, () => {
10549
- let e = Te.value;
10550
- Te.value = null, g(), l.value = l.value.map((n) => n.id === t.id ? {
10563
+ let e = Ee.value;
10564
+ Ee.value = null, g(), l.value = l.value.map((n) => n.id === t.id ? {
10551
10565
  ...e,
10552
10566
  points: e.points.map(([e, t]) => [N(e), N(t)])
10553
10567
  } : n);
10554
10568
  }));
10555
10569
  }
10556
- let ke = q(null), Ae = q(null), je = 0, Me = (e) => `${e}${Date.now().toString(36)}${je++}`;
10557
- function Ne(e) {
10570
+ let Ae = q(null), je = q(null), Me = 0, Ne = (e) => `${e}${Date.now().toString(36)}${Me++}`;
10571
+ function Pe(e) {
10558
10572
  if (!r.editable) return;
10559
10573
  if (d.value === "select") {
10560
- (e.target === e.currentTarget || e.target.closest("svg") === U.value) && (o.value = [], f.value = null);
10574
+ (e.target === e.currentTarget || e.target.closest("svg") === Le.value) && (o.value = [], f.value = null);
10561
10575
  return;
10562
10576
  }
10563
- let t = _e(e), n = [N(t.x), N(t.y)];
10577
+ let t = ve(e), n = [N(t.x), N(t.y)];
10564
10578
  if (d.value === "wall") {
10565
- ke.value = [...ke.value ?? [n], n];
10579
+ Ae.value = [...Ae.value ?? [n], n];
10566
10580
  return;
10567
10581
  }
10568
- let i = Me("area");
10569
- ye.value = {
10582
+ let i = Ne("area");
10583
+ be.value = {
10570
10584
  id: i,
10571
10585
  x: n[0],
10572
10586
  y: n[1],
10573
10587
  width: 0,
10574
10588
  height: 0
10575
- }, ve(e, (e, t) => ye.value = {
10589
+ }, ye(e, (e, t) => be.value = {
10576
10590
  id: i,
10577
10591
  x: Math.min(n[0], n[0] + e),
10578
10592
  y: Math.min(n[1], n[1] + t),
10579
10593
  width: Math.abs(e),
10580
10594
  height: Math.abs(t)
10581
10595
  }, () => {
10582
- let e = ye.value;
10583
- ye.value = null, e.width > 10 && e.height > 10 && (g(), s.value = [...s.value, {
10596
+ let e = be.value;
10597
+ be.value = null, e.width > 10 && e.height > 10 && (g(), s.value = [...s.value, {
10584
10598
  ...e,
10585
10599
  x: N(e.x),
10586
10600
  y: N(e.y),
@@ -10592,22 +10606,22 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10592
10606
  });
10593
10607
  });
10594
10608
  }
10595
- function Pe(e) {
10596
- if (ke.value) {
10597
- let t = _e(e);
10598
- Ae.value = [N(t.x), N(t.y)];
10609
+ function Fe(e) {
10610
+ if (Ae.value) {
10611
+ let t = ve(e);
10612
+ je.value = [N(t.x), N(t.y)];
10599
10613
  }
10600
10614
  }
10601
- function Fe() {
10602
- let e = ke.value?.filter((e, t, n) => !t || e[0] !== n[t - 1][0] || e[1] !== n[t - 1][1]);
10603
- ke.value = null, Ae.value = null, e && e.length > 1 && g(), e && e.length > 1 && (l.value = [...l.value, {
10604
- id: Me("wall"),
10615
+ function Ie() {
10616
+ let e = Ae.value?.filter((e, t, n) => !t || e[0] !== n[t - 1][0] || e[1] !== n[t - 1][1]);
10617
+ Ae.value = null, je.value = null, e && e.length > 1 && g(), e && e.length > 1 && (l.value = [...l.value, {
10618
+ id: Ne("wall"),
10605
10619
  points: e
10606
10620
  }]);
10607
10621
  }
10608
- function Ie(e) {
10609
- if (ke.value && (e.key === "Enter" || e.key === "Escape")) {
10610
- e.preventDefault(), e.key === "Enter" ? Fe() : ke.value = null;
10622
+ function H(e) {
10623
+ if (Ae.value && (e.key === "Enter" || e.key === "Escape")) {
10624
+ e.preventDefault(), e.key === "Enter" ? Ie() : Ae.value = null;
10611
10625
  return;
10612
10626
  }
10613
10627
  if (!r.editable) return;
@@ -10621,14 +10635,14 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10621
10635
  return;
10622
10636
  }
10623
10637
  if (t && n === "d") {
10624
- e.preventDefault(), Re();
10638
+ e.preventDefault(), ze();
10625
10639
  return;
10626
10640
  }
10627
- (e.key === "Delete" || e.key === "Backspace") && (f.value || o.value.length) && (e.preventDefault(), H());
10641
+ (e.key === "Delete" || e.key === "Backspace") && (f.value || o.value.length) && (e.preventDefault(), U());
10628
10642
  }
10629
- function H() {
10643
+ function U() {
10630
10644
  if (!f.value) {
10631
- o.value.length && Le(o.value);
10645
+ o.value.length && Re(o.value);
10632
10646
  return;
10633
10647
  }
10634
10648
  let { kind: e, id: t, vertex: n } = f.value;
@@ -10648,19 +10662,19 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10648
10662
  }
10649
10663
  e === "decor" && (u.value = u.value.filter((e) => e.id !== t)), f.value = null;
10650
10664
  }
10651
- let U = q();
10652
- function Le(e) {
10665
+ let Le = q();
10666
+ function Re(e) {
10653
10667
  g(), i.value = i.value.filter((t) => !e.includes(t.id)), a.value = a.value.map((t) => ({
10654
10668
  ...t,
10655
10669
  tables: t.tables.filter((t) => !e.includes(t))
10656
10670
  })).filter((e) => e.tables.length > 1), o.value = [];
10657
10671
  }
10658
- function Re() {
10672
+ function ze() {
10659
10673
  let e = Math.max(20, (r.grid || 10) * 2);
10660
10674
  if (o.value.length) {
10661
10675
  let t = i.value.filter((e) => o.value.includes(e.id)).map((t) => ({
10662
10676
  ...t,
10663
- id: Me("table"),
10677
+ id: Ne("table"),
10664
10678
  x: t.x + e,
10665
10679
  y: t.y + e,
10666
10680
  status: void 0,
@@ -10675,7 +10689,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10675
10689
  if (!n) return;
10676
10690
  let r = {
10677
10691
  ...n,
10678
- id: Me("area"),
10692
+ id: Ne("area"),
10679
10693
  x: n.x + e,
10680
10694
  y: n.y + e
10681
10695
  };
@@ -10688,7 +10702,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10688
10702
  if (!n) return;
10689
10703
  let r = {
10690
10704
  ...n,
10691
- id: Me("decor"),
10705
+ id: Ne("decor"),
10692
10706
  x: n.x + e,
10693
10707
  y: n.y + e
10694
10708
  };
@@ -10698,14 +10712,14 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10698
10712
  };
10699
10713
  }
10700
10714
  }
10701
- let ze = tt(null);
10702
- function Be(e, t, n, a, o) {
10715
+ let Be = tt(null);
10716
+ function Ve(e, t, n, a, o) {
10703
10717
  if (!r.editable || e.button !== 0) return;
10704
10718
  e.stopPropagation(), e.preventDefault();
10705
10719
  let s = S.value.getBoundingClientRect(), c = (e) => Math.atan2(e.clientY - (s.top + o * w.value), e.clientX - (s.left + a * w.value)) * 180 / Math.PI + 90, l = (r) => {
10706
10720
  if (r.pointerId !== e.pointerId) return;
10707
10721
  let i = (c(r) % 360 + 360) % 360;
10708
- r.shiftKey || (i = Math.round(i / 15) * 15 % 360), ze.value = {
10722
+ r.shiftKey || (i = Math.round(i / 15) * 15 % 360), Be.value = {
10709
10723
  id: n,
10710
10724
  kind: t,
10711
10725
  deg: i
@@ -10713,8 +10727,8 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10713
10727
  }, d = (r) => {
10714
10728
  if (r.pointerId !== e.pointerId) return;
10715
10729
  window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", d);
10716
- let a = ze.value;
10717
- ze.value = null, a && (g(), t === "table" ? i.value = i.value.map((e) => e.id === n ? {
10730
+ let a = Be.value;
10731
+ Be.value = null, a && (g(), t === "table" ? i.value = i.value.map((e) => e.id === n ? {
10718
10732
  ...e,
10719
10733
  rotation: a.deg
10720
10734
  } : e) : u.value = u.value.map((e) => e.id === n ? {
@@ -10724,30 +10738,30 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10724
10738
  };
10725
10739
  window.addEventListener("pointermove", l), window.addEventListener("pointerup", d), window.addEventListener("pointercancel", d);
10726
10740
  }
10727
- let Ve = (e, t, n) => ze.value?.kind === e && ze.value.id === t ? ze.value.deg : n ?? 0;
10728
- function He(e = o.value, t) {
10741
+ let He = (e, t, n) => Be.value?.kind === e && Be.value.id === t ? Be.value.deg : n ?? 0;
10742
+ function Ue(e = o.value, t) {
10729
10743
  let n = [...new Set(e.flatMap((e) => a.value.find((t) => t.tables.includes(e))?.tables ?? [e]))];
10730
10744
  if (n.length < 2) return null;
10731
10745
  let s = r.canMerge?.(n) ?? !0;
10732
10746
  if (s !== !0) return b("merge-refused", n, typeof s == "string" ? s : ""), null;
10733
10747
  let c = t ?? n.map((e) => i.value.find((t) => t.id === e)?.label ?? e).join(" + "), l = {
10734
- id: Me("merge"),
10748
+ id: Ne("merge"),
10735
10749
  tables: n,
10736
10750
  label: c
10737
10751
  };
10738
10752
  return g(), a.value = [...a.value.filter((e) => !e.tables.some((e) => n.includes(e))), l], o.value = [], b("merge", l), l;
10739
10753
  }
10740
- function Ue(e) {
10754
+ function We(e) {
10741
10755
  let t = a.value.find((t) => t.id === e) ?? a.value.find((t) => t.tables.includes(e));
10742
10756
  t && (g(), a.value = a.value.filter((e) => e !== t), b("split", t));
10743
10757
  }
10744
- let We = {
10758
+ let Ke = {
10745
10759
  key: "",
10746
10760
  at: 0
10747
10761
  };
10748
- function Ke(e, t, n) {
10762
+ function Je(e, t, n) {
10749
10763
  let r = `${e}:${t}:${Object.keys(n).sort().join()}`, a = performance.now();
10750
- (r !== We.key || a - We.at > 1e3) && g(), We = {
10764
+ (r !== Ke.key || a - Ke.at > 1e3) && g(), Ke = {
10751
10765
  key: r,
10752
10766
  at: a
10753
10767
  };
@@ -10757,9 +10771,9 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10757
10771
  } : e);
10758
10772
  e === "table" ? i.value = o(i.value) : e === "area" ? s.value = o(s.value) : e === "wall" ? l.value = o(l.value) : u.value = o(u.value);
10759
10773
  }
10760
- function Je(e = {}) {
10774
+ function Ye(e = {}) {
10761
10775
  let t = Math.max(0, ...i.value.map((e) => Number(e.label)).filter((e) => Number.isFinite(e))) + 1, n = {
10762
- id: Me("table"),
10776
+ id: Ne("table"),
10763
10777
  label: String(t),
10764
10778
  x: N(r.width / 2),
10765
10779
  y: N(r.height / 2),
@@ -10769,13 +10783,13 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10769
10783
  };
10770
10784
  return g(), i.value = [...i.value, n], o.value = [n.id], f.value = null, n;
10771
10785
  }
10772
- function Ye(e, t = {}) {
10786
+ function Ze(e, t = {}) {
10773
10787
  let n = {
10774
- id: Me("decor"),
10788
+ id: Ne("decor"),
10775
10789
  kind: e,
10776
10790
  x: N(r.width / 2),
10777
10791
  y: N(r.height / 2),
10778
- ...de.value[e]?.shape === "text" && { label: de.value[e]?.label ?? e },
10792
+ ...fe.value[e]?.shape === "text" && { label: fe.value[e]?.label ?? e },
10779
10793
  ...t
10780
10794
  };
10781
10795
  return g(), u.value = [...u.value, n], f.value = {
@@ -10783,7 +10797,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10783
10797
  id: n.id
10784
10798
  }, o.value = [], n;
10785
10799
  }
10786
- let Ze = {
10800
+ let Qe = {
10787
10801
  tables: i,
10788
10802
  areas: s,
10789
10803
  walls: l,
@@ -10793,12 +10807,12 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10793
10807
  picked: f,
10794
10808
  tool: d,
10795
10809
  editable: L(() => r.editable),
10796
- drawingWall: L(() => !!ke.value),
10797
- finishWall: Fe,
10810
+ drawingWall: L(() => !!Ae.value),
10811
+ finishWall: Ie,
10798
10812
  cancelWall: () => {
10799
- ke.value = null, Ae.value = null;
10813
+ Ae.value = null, je.value = null;
10800
10814
  },
10801
- kinds: de,
10815
+ kinds: fe,
10802
10816
  statuses: L(() => r.statuses),
10803
10817
  size: L(() => ({
10804
10818
  width: r.width,
@@ -10808,34 +10822,34 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10808
10822
  canRedo: L(() => m.value.length > 0),
10809
10823
  undo: v,
10810
10824
  redo: y,
10811
- addTable: Je,
10812
- addDecor: Ye,
10813
- update: Ke,
10814
- removeSelected: H,
10815
- removeTables: Le,
10816
- duplicate: Re,
10817
- merge: He,
10818
- split: Ue
10825
+ addTable: Ye,
10826
+ addDecor: Ze,
10827
+ update: Je,
10828
+ removeSelected: U,
10829
+ removeTables: Re,
10830
+ duplicate: ze,
10831
+ merge: Ue,
10832
+ split: We
10819
10833
  };
10820
- Xe(ah, Ze), t({
10821
- context: Ze,
10822
- addTable: Je,
10823
- addDecor: Ye,
10824
- update: Ke,
10825
- removeSelected: H,
10826
- merge: He,
10827
- split: Ue,
10834
+ Xe(ah, Qe), t({
10835
+ context: Qe,
10836
+ addTable: Ye,
10837
+ addDecor: Ze,
10838
+ update: Je,
10839
+ removeSelected: U,
10840
+ merge: Ue,
10841
+ split: We,
10828
10842
  undo: v,
10829
10843
  redo: y,
10830
10844
  canUndo: L(() => p.value.length > 0),
10831
10845
  canRedo: L(() => m.value.length > 0),
10832
- duplicate: Re,
10833
- removeTables: Le
10846
+ duplicate: ze,
10847
+ removeTables: Re
10834
10848
  });
10835
- function Qe(e, t) {
10849
+ function $e(e, t) {
10836
10850
  if (!r.editable || d.value !== "select") return;
10837
10851
  e.stopPropagation();
10838
- let n = _e(e), i = 0, a = Infinity;
10852
+ let n = ve(e), i = 0, a = Infinity;
10839
10853
  for (let e = 1; e < t.points.length; e++) {
10840
10854
  let [r, o] = t.points[e - 1], [s, c] = t.points[e], l = (s - r) ** 2 + (c - o) ** 2, u = l ? Math.max(0, Math.min(1, ((n.x - r) * (s - r) + (n.y - o) * (c - o)) / l)) : 0, d = Math.hypot(r + u * (s - r) - n.x, o + u * (c - o) - n.y);
10841
10855
  d < a && (a = d, i = e);
@@ -10854,12 +10868,12 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10854
10868
  vertex: i
10855
10869
  };
10856
10870
  }
10857
- let $e = (e) => [
10871
+ let et = (e) => [
10858
10872
  e.t.label,
10859
10873
  e.status?.label,
10860
10874
  e.t.seats ? x.floorSeats.replace("{n}", String(e.t.seats)) : "",
10861
10875
  e.t.badge === void 0 ? "" : String(e.t.badge)
10862
- ].filter(Boolean).join(", "), et = L(() => {
10876
+ ].filter(Boolean).join(", "), nt = L(() => {
10863
10877
  let e = (r.grid >= 10 ? r.grid : r.grid * Math.ceil(10 / Math.max(1, r.grid))) * w.value;
10864
10878
  return r.editable && r.showGrid && r.grid ? {
10865
10879
  backgroundImage: "radial-gradient(circle, var(--color-outline-variant) 1px, transparent 1.2px)",
@@ -10872,32 +10886,32 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10872
10886
  class: W(["m3-floor-plan select-none", e.editable && d.value !== "select" && "cursor-crosshair"]),
10873
10887
  style: G({
10874
10888
  aspectRatio: `${e.width} / ${e.height}`,
10875
- ...et.value
10889
+ ...nt.value
10876
10890
  }),
10877
10891
  role: "group",
10878
10892
  tabindex: "-1",
10879
10893
  "aria-label": e.label ?? Z(x).floorPlan,
10880
- onPointerdown: Ne,
10881
- onPointermove: Pe,
10882
- onDblclick: n[0] ||= (e) => ke.value && Fe(),
10883
- onKeydown: Ie
10894
+ onPointerdown: Pe,
10895
+ onPointermove: Fe,
10896
+ onDblclick: n[0] ||= (e) => Ae.value && Ie(),
10897
+ onKeydown: H
10884
10898
  }, [
10885
- (K(!0), B(I, null, J(be.value, (n) => (K(), B("div", {
10899
+ (K(!0), B(I, null, J(xe.value, (n) => (K(), B("div", {
10886
10900
  key: `a${n.id}`,
10887
- class: W(["absolute rounded-lg border", [e.editable && d.value === "select" ? "cursor-move touch-none" : "pointer-events-none", ge("area", n.id) && "ring-2 ring-primary"]]),
10901
+ class: W(["absolute rounded-lg border", [e.editable && d.value === "select" ? "cursor-move touch-none" : "pointer-events-none", _e("area", n.id) && "ring-2 ring-primary"]]),
10888
10902
  style: G({
10889
10903
  left: `${n.x * w.value}px`,
10890
10904
  top: `${n.y * w.value}px`,
10891
10905
  width: `${n.width * w.value}px`,
10892
10906
  height: `${n.height * w.value}px`,
10893
- ...he(n.color)
10907
+ ...ge(n.color)
10894
10908
  }),
10895
- onPointerdown: (e) => xe(e, n, null)
10909
+ onPointerdown: (e) => Se(e, n, null)
10896
10910
  }, [Y(t.$slots, "area", {
10897
10911
  area: n,
10898
- picked: ge("area", n.id),
10912
+ picked: _e("area", n.id),
10899
10913
  scale: w.value
10900
- }, () => [n.label ? (K(), B("span", fh, X(n.label), 1)) : z("", !0)]), e.editable && ge("area", n.id) ? (K(), B(I, { key: 0 }, J([
10914
+ }, () => [n.label ? (K(), B("span", fh, X(n.label), 1)) : z("", !0)]), e.editable && _e("area", n.id) ? (K(), B(I, { key: 0 }, J([
10901
10915
  "nw",
10902
10916
  "ne",
10903
10917
  "sw",
@@ -10910,34 +10924,34 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10910
10924
  e === "nw" || e === "se" ? "cursor-nwse-resize" : "cursor-nesw-resize"
10911
10925
  ]]),
10912
10926
  "data-corner": e,
10913
- onPointerdown: (t) => xe(t, n, e)
10927
+ onPointerdown: (t) => Se(t, n, e)
10914
10928
  }, null, 42, ph)), 64)) : z("", !0)], 46, dh))), 128)),
10915
10929
  (K(), B("svg", {
10916
10930
  ref_key: "svgEl",
10917
- ref: U,
10931
+ ref: Le,
10918
10932
  class: "pointer-events-none absolute inset-0 size-full overflow-visible"
10919
- }, [(K(!0), B(I, null, J(Ee.value, (t) => (K(), B("g", { key: `w${t.id}` }, [V("path", {
10920
- d: De(t),
10933
+ }, [(K(!0), B(I, null, J(De.value, (t) => (K(), B("g", { key: `w${t.id}` }, [V("path", {
10934
+ d: Oe(t),
10921
10935
  fill: "none",
10922
10936
  "stroke-linecap": "round",
10923
10937
  "stroke-linejoin": "round",
10924
- class: W(["m3-floor-wall", [e.editable && d.value === "select" && "pointer-events-auto cursor-move touch-none", ge("wall", t.id) && "m3-floor-wall-picked"]]),
10938
+ class: W(["m3-floor-wall", [e.editable && d.value === "select" && "pointer-events-auto cursor-move touch-none", _e("wall", t.id) && "m3-floor-wall-picked"]]),
10925
10939
  "stroke-width": (t.thickness ?? 8) * w.value,
10926
- onPointerdown: (e) => Oe(e, t),
10927
- onDblclick: (e) => Qe(e, t)
10928
- }, null, 42, mh), e.editable && ge("wall", t.id) ? (K(!0), B(I, { key: 0 }, J(t.points, (e, n) => (K(), B("circle", {
10940
+ onPointerdown: (e) => ke(e, t),
10941
+ onDblclick: (e) => $e(e, t)
10942
+ }, null, 42, mh), e.editable && _e("wall", t.id) ? (K(!0), B(I, { key: 0 }, J(t.points, (e, n) => (K(), B("circle", {
10929
10943
  key: n,
10930
10944
  cx: e[0] * w.value,
10931
10945
  cy: e[1] * w.value,
10932
10946
  r: (f.value?.vertex === n ? 8 : 6) * (C.value ? 1.6 : 1),
10933
10947
  class: W(["pointer-events-auto cursor-move touch-none stroke-primary", f.value?.vertex === n ? "fill-primary" : "fill-surface"]),
10934
10948
  "stroke-width": "2",
10935
- onPointerdown: (e) => Oe(e, t, n)
10936
- }, null, 42, hh))), 128)) : z("", !0)]))), 128)), ke.value ? (K(), B("path", {
10949
+ onPointerdown: (e) => ke(e, t, n)
10950
+ }, null, 42, hh))), 128)) : z("", !0)]))), 128)), Ae.value ? (K(), B("path", {
10937
10951
  key: 0,
10938
- d: De({
10952
+ d: Oe({
10939
10953
  id: "new",
10940
- points: Ae.value ? [...ke.value, Ae.value] : ke.value
10954
+ points: je.value ? [...Ae.value, je.value] : Ae.value
10941
10955
  }),
10942
10956
  fill: "none",
10943
10957
  class: "stroke-primary",
@@ -10945,47 +10959,47 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
10945
10959
  "stroke-linecap": "round",
10946
10960
  "stroke-width": 8 * w.value
10947
10961
  }, null, 8, gh)) : z("", !0)], 512)),
10948
- (K(!0), B(I, null, J(Ce.value, (n) => (K(), B("div", {
10962
+ (K(!0), B(I, null, J(we.value, (n) => (K(), B("div", {
10949
10963
  key: `d${n.id}`,
10950
- class: W(["absolute flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-on-surface-variant", [e.editable && d.value === "select" ? "cursor-move touch-none" : "pointer-events-none", ge("decor", n.id) && "ring-2 ring-primary"]]),
10964
+ class: W(["absolute flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-on-surface-variant", [e.editable && d.value === "select" ? "cursor-move touch-none" : "pointer-events-none", _e("decor", n.id) && "ring-2 ring-primary"]]),
10951
10965
  style: G({
10952
10966
  left: `${n.x * w.value}px`,
10953
10967
  top: `${n.y * w.value}px`,
10954
- width: `${pe(n).w * w.value}px`,
10955
- height: `${pe(n).h * w.value}px`,
10956
- rotate: `${Ve("decor", n.id, n.rotation)}deg`,
10957
- ...me(fe(n))
10968
+ width: `${me(n).w * w.value}px`,
10969
+ height: `${me(n).h * w.value}px`,
10970
+ rotate: `${He("decor", n.id, n.rotation)}deg`,
10971
+ ...he(pe(n))
10958
10972
  }),
10959
- "aria-label": n.label ?? fe(n).label ?? n.kind,
10973
+ "aria-label": n.label ?? pe(n).label ?? n.kind,
10960
10974
  role: "img",
10961
- onPointerdown: (e) => we(e, n)
10975
+ onPointerdown: (e) => Te(e, n)
10962
10976
  }, [
10963
10977
  Y(t.$slots, "decor", {
10964
10978
  item: n,
10965
- kind: fe(n),
10966
- picked: ge("decor", n.id),
10979
+ kind: pe(n),
10980
+ picked: _e("decor", n.id),
10967
10981
  scale: w.value
10968
- }, () => [fe(n).icon && fe(n).shape !== "bar" ? (K(), R(F, {
10982
+ }, () => [pe(n).icon && pe(n).shape !== "bar" ? (K(), R(F, {
10969
10983
  key: 0,
10970
- name: fe(n).icon,
10971
- size: Math.max(12, Math.min(pe(n).w, pe(n).h) * .6 * w.value)
10972
- }, null, 8, ["name", "size"])) : z("", !0), fe(n).shape === "text" ? (K(), B("span", {
10984
+ name: pe(n).icon,
10985
+ size: Math.max(12, Math.min(me(n).w, me(n).h) * .6 * w.value)
10986
+ }, null, 8, ["name", "size"])) : z("", !0), pe(n).shape === "text" ? (K(), B("span", {
10973
10987
  key: 1,
10974
10988
  class: "truncate text-title-small text-on-surface-variant",
10975
10989
  style: G({ fontSize: `${Math.max(10, 16 * w.value)}px` })
10976
10990
  }, X(n.label), 5)) : z("", !0)]),
10977
- e.editable && ge("decor", n.id) ? (K(), B("span", {
10991
+ e.editable && _e("decor", n.id) ? (K(), B("span", {
10978
10992
  key: 0,
10979
10993
  class: "m3-floor-handle absolute -right-1.5 -bottom-1.5 size-3 cursor-nwse-resize rounded-xs border-2 border-primary bg-surface",
10980
10994
  "data-resize": "",
10981
- onPointerdown: (e) => we(e, n, !0)
10995
+ onPointerdown: (e) => Te(e, n, !0)
10982
10996
  }, null, 40, vh)) : z("", !0),
10983
- e.editable && ge("decor", n.id) ? (K(), B("span", {
10997
+ e.editable && e.rotatable && _e("decor", n.id) ? (K(), B("span", {
10984
10998
  key: 1,
10985
10999
  class: "m3-floor-handle absolute -top-6 left-1/2 size-3.5 -translate-x-1/2 cursor-grab rounded-full border-2 border-primary bg-surface",
10986
11000
  "aria-label": Z(x).floorRotate,
10987
11001
  "data-rotate": "",
10988
- onPointerdown: (e) => Be(e, "decor", n.id, n.x, n.y)
11002
+ onPointerdown: (e) => Ve(e, "decor", n.id, n.x, n.y)
10989
11003
  }, null, 40, yh)) : z("", !0)
10990
11004
  ], 46, _h))), 128)),
10991
11005
  j.value.some((e) => e.links.length) ? (K(), B("svg", bh, [(K(!0), B(I, null, J(j.value, (e) => (K(), B(I, { key: `ml${e.m.id}` }, [(K(!0), B(I, null, J(e.links, (e, t) => (K(), B("line", {
@@ -11018,10 +11032,10 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11018
11032
  style: G({
11019
11033
  left: `${n.x * w.value}px`,
11020
11034
  top: `${n.y * w.value}px`,
11021
- transform: `rotate(${Ve("table", n.t.id, n.t.rotation)}deg)`
11035
+ transform: `rotate(${He("table", n.t.id, n.t.rotation)}deg)`
11022
11036
  })
11023
11037
  }, [
11024
- e.editable && o.value.length === 1 && o.value[0] === n.t.id && d.value === "select" ? (K(), B("span", {
11038
+ e.editable && e.rotatable && o.value.length === 1 && o.value[0] === n.t.id && d.value === "select" ? (K(), B("span", {
11025
11039
  key: 0,
11026
11040
  class: "m3-floor-handle absolute z-10 size-3.5 -translate-x-1/2 -translate-y-1/2 cursor-grab rounded-full border-2 border-primary bg-surface",
11027
11041
  style: G({
@@ -11030,7 +11044,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11030
11044
  }),
11031
11045
  "aria-label": Z(x).floorRotate,
11032
11046
  "data-rotate": "",
11033
- onPointerdown: (e) => Be(e, "table", n.t.id, n.x, n.y)
11047
+ onPointerdown: (e) => Ve(e, "table", n.t.id, n.x, n.y)
11034
11048
  }, null, 44, Ch)) : z("", !0),
11035
11049
  (K(!0), B(I, null, J(n.chairs, (e, t) => (K(), B("span", {
11036
11050
  key: t,
@@ -11058,14 +11072,14 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11058
11072
  ...A(n.status),
11059
11073
  fontSize: `${Math.max(9, 14 * w.value)}px`
11060
11074
  }),
11061
- "aria-label": $e(n),
11075
+ "aria-label": et(n),
11062
11076
  "aria-pressed": e.editable ? o.value.includes(n.t.id) : void 0,
11063
11077
  onPointerdown: (e) => ie(e, n.t),
11064
11078
  onClick: (e) => ce(e, n.t),
11065
- onKeydown: (e) => le(e, n.t)
11079
+ onKeydown: (e) => ue(e, n.t)
11066
11080
  }, [V("span", {
11067
11081
  class: "flex flex-col items-center justify-center gap-0.5",
11068
- style: G({ transform: `rotate(${-Ve("table", n.t.id, n.t.rotation)}deg)` })
11082
+ style: G({ transform: `rotate(${-He("table", n.t.id, n.t.rotation)}deg)` })
11069
11083
  }, [Y(t.$slots, "table", {
11070
11084
  table: n.t,
11071
11085
  status: n.status,
@@ -11078,7 +11092,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11078
11092
  }, null, 8, ["name", "size"])) : z("", !0), V("span", Th, X(n.t.label), 1)])], 4), n.t.badge === void 0 ? z("", !0) : (K(), B("span", {
11079
11093
  key: 0,
11080
11094
  class: "absolute -top-2 -right-2 min-w-5 rounded-full bg-error px-1.5 text-center text-label-small leading-5 text-on-error",
11081
- style: G({ transform: `rotate(${-Ve("table", n.t.id, n.t.rotation)}deg)` })
11095
+ style: G({ transform: `rotate(${-He("table", n.t.id, n.t.rotation)}deg)` })
11082
11096
  }, X(n.t.badge), 5))], 46, wh)
11083
11097
  ], 6))), 128)),
11084
11098
  Y(t.$slots, "overlay", {
@@ -11187,7 +11201,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11187
11201
  }, null, 8, ["label"])]),
11188
11202
  _: 1
11189
11203
  }, 8, ["text"])], 64)) : z("", !0),
11190
- H(Se, null, {
11204
+ e.tables.length ? (K(), R(Se, { key: 2 }, {
11191
11205
  trigger: $(() => [H(P, {
11192
11206
  text: Z(i).floorAddTable,
11193
11207
  placement: "top"
@@ -11207,8 +11221,8 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11207
11221
  _: 2
11208
11222
  }, 1032, ["icon", "onClick"]))), 128))]),
11209
11223
  _: 1
11210
- }),
11211
- a.value.length ? (K(), R(Se, { key: 2 }, {
11224
+ })) : z("", !0),
11225
+ a.value.length ? (K(), R(Se, { key: 3 }, {
11212
11226
  trigger: $(() => [H(P, {
11213
11227
  text: Z(i).floorAddDecor,
11214
11228
  placement: "top"
@@ -11254,7 +11268,7 @@ var uh = ["aria-label"], dh = ["onPointerdown"], fh = {
11254
11268
  }, null, 8, ["label", "disabled"])]),
11255
11269
  _: 1
11256
11270
  }, 8, ["text"]),
11257
- e.history ? (K(), B(I, { key: 3 }, [
11271
+ e.history ? (K(), B(I, { key: 4 }, [
11258
11272
  n[7] ||= V("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
11259
11273
  H(P, {
11260
11274
  text: Z(i).floorUndo,