@nubisco/ui 1.26.2 → 1.27.1

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/index.mjs CHANGED
@@ -17807,11 +17807,11 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
17807
17807
  let n = t.namespace ?? "";
17808
17808
  e.has(n) || e.set(n, []), e.get(n).push(t);
17809
17809
  }
17810
- return Array.from(e.entries()).map(([e, t]) => ({
17810
+ return Array.from(e.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => ({
17811
17811
  namespace: e,
17812
- commands: t
17812
+ commands: t.sort((e, t) => e.label.localeCompare(t.label))
17813
17813
  }));
17814
- }), w = o(() => v.value);
17814
+ }), w = o(() => x.value.flatMap((e) => e.commands));
17815
17815
  function E(e) {
17816
17816
  i.close(), p.value = "", e.handler();
17817
17817
  }
@@ -20331,7 +20331,7 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20331
20331
  ae(e, t);
20332
20332
  return;
20333
20333
  }
20334
- de(e);
20334
+ fe(e);
20335
20335
  }
20336
20336
  function R(e) {
20337
20337
  N = !0, P = e.clientX - d.value, I = e.clientY - f.value, document.addEventListener("mousemove", ee), document.addEventListener("mouseup", te);
@@ -20424,8 +20424,23 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20424
20424
  width: `${Math.abs(n - e)}px`,
20425
20425
  height: `${Math.abs(r - t)}px`
20426
20426
  };
20427
+ }), de = o(() => {
20428
+ if (m.value, h.value.size < 2 || !s.value || G.value) return null;
20429
+ let e = s.value.getBoundingClientRect(), t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
20430
+ for (let a of h.value) {
20431
+ let o = s.value.querySelector(`[data-card-id="${a}"]`);
20432
+ if (!o) continue;
20433
+ let c = o.getBoundingClientRect(), l = c.left - e.left, u = c.top - e.top;
20434
+ t = Math.min(t, l), n = Math.min(n, u), r = Math.max(r, l + c.width), i = Math.max(i, u + c.height);
20435
+ }
20436
+ return t === Infinity ? null : {
20437
+ left: `${t - 8}px`,
20438
+ top: `${n - 8}px`,
20439
+ width: `${r - t + 16}px`,
20440
+ height: `${i - n + 16}px`
20441
+ };
20427
20442
  });
20428
- function de(e) {
20443
+ function fe(e) {
20429
20444
  if (!s.value) return;
20430
20445
  let t = s.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
20431
20446
  le = e.shiftKey, le || v([]), G.value = {
@@ -20433,15 +20448,15 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20433
20448
  y1: r,
20434
20449
  x2: n,
20435
20450
  y2: r
20436
- }, document.addEventListener("mousemove", fe), document.addEventListener("mouseup", pe);
20451
+ }, document.addEventListener("mousemove", pe), document.addEventListener("mouseup", me);
20437
20452
  }
20438
- function fe(e) {
20453
+ function pe(e) {
20439
20454
  if (!G.value || !s.value) return;
20440
20455
  let t = s.value.getBoundingClientRect();
20441
20456
  G.value.x2 = e.clientX - t.left, G.value.y2 = e.clientY - t.top;
20442
20457
  }
20443
- function pe() {
20444
- if (document.removeEventListener("mousemove", fe), document.removeEventListener("mouseup", pe), !G.value || !s.value) {
20458
+ function me() {
20459
+ if (document.removeEventListener("mousemove", pe), document.removeEventListener("mouseup", me), !G.value || !s.value) {
20445
20460
  G.value = null;
20446
20461
  return;
20447
20462
  }
@@ -20459,31 +20474,31 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20459
20474
  }
20460
20475
  }), v(u), G.value = null;
20461
20476
  }
20462
- let me = O(null), he = null;
20463
- function K(e) {
20464
- he = e, document.addEventListener("mousemove", ge), document.addEventListener("mouseup", _e);
20465
- }
20477
+ let he = O(null), K = null;
20466
20478
  function ge(e) {
20467
- if (!he || !s.value) return;
20468
- let t = s.value.getBoundingClientRect(), n = (e.clientX - t.left - d.value) / p.value, r = (e.clientY - t.top - f.value) / p.value, i = s.value.querySelector(`[data-port="${he.nodeId}:${he.portId}"]`);
20479
+ K = e, document.addEventListener("mousemove", _e), document.addEventListener("mouseup", ve);
20480
+ }
20481
+ function _e(e) {
20482
+ if (!K || !s.value) return;
20483
+ let t = s.value.getBoundingClientRect(), n = (e.clientX - t.left - d.value) / p.value, r = (e.clientY - t.top - f.value) / p.value, i = s.value.querySelector(`[data-port="${K.nodeId}:${K.portId}"]`);
20469
20484
  if (!i) return;
20470
20485
  let a = i.getBoundingClientRect(), o = (a.left + a.width / 2 - t.left - d.value) / p.value, c = (a.top + a.height / 2 - t.top - f.value) / p.value, l = Math.abs(n - o) * .5;
20471
- me.value = `M ${o} ${c} C ${o + l} ${c}, ${n - l} ${r}, ${n} ${r}`;
20486
+ he.value = `M ${o} ${c} C ${o + l} ${c}, ${n - l} ${r}, ${n} ${r}`;
20472
20487
  }
20473
- function _e() {
20474
- he = null, me.value = null, document.removeEventListener("mousemove", ge), document.removeEventListener("mouseup", _e);
20488
+ function ve() {
20489
+ K = null, he.value = null, document.removeEventListener("mousemove", _e), document.removeEventListener("mouseup", ve);
20475
20490
  }
20476
- function ve(e) {
20477
- if (!he || he.nodeId === e.nodeId || he.type === e.type) return;
20478
- let t = he.type === "output" ? he : e, n = he.type === "output" ? e : he;
20491
+ function ye(e) {
20492
+ if (!K || K.nodeId === e.nodeId || K.type === e.type) return;
20493
+ let t = K.type === "output" ? K : e, n = K.type === "output" ? e : K;
20479
20494
  a("connect", {
20480
20495
  fromNode: t.nodeId,
20481
20496
  fromPort: t.portId,
20482
20497
  toNode: n.nodeId,
20483
20498
  toPort: n.portId
20484
- }), he = null, me.value = null;
20499
+ }), K = null, he.value = null;
20485
20500
  }
20486
- function ye(e) {
20501
+ function be(e) {
20487
20502
  let t = e.closest(".nb-blueprint-card");
20488
20503
  if (t) {
20489
20504
  let e = getComputedStyle(t).getPropertyValue("--nb-card-color").trim();
@@ -20491,7 +20506,7 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20491
20506
  }
20492
20507
  return "var(--nb-c-primary)";
20493
20508
  }
20494
- let be = o(() => {
20509
+ let xe = o(() => {
20495
20510
  if (m.value, !s.value) return [];
20496
20511
  let e = s.value.getBoundingClientRect();
20497
20512
  return i.connections.map((t) => {
@@ -20501,11 +20516,11 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20501
20516
  return {
20502
20517
  path: `M ${o} ${c} C ${o + m} ${c}, ${l - m} ${u}, ${l} ${u}`,
20503
20518
  conn: t,
20504
- color: ye(n)
20519
+ color: be(n)
20505
20520
  };
20506
20521
  }).filter(Boolean);
20507
20522
  });
20508
- function xe() {
20523
+ function Se() {
20509
20524
  if (!s.value) return null;
20510
20525
  let e = s.value.querySelectorAll("[data-card-id]");
20511
20526
  if (e.length === 0) return null;
@@ -20520,9 +20535,9 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20520
20535
  maxY: i
20521
20536
  };
20522
20537
  }
20523
- function Se() {
20538
+ function Ce() {
20524
20539
  if (p.value = 1, !s.value) return;
20525
- let e = xe();
20540
+ let e = Se();
20526
20541
  if (!e) {
20527
20542
  d.value = 0, f.value = 0;
20528
20543
  return;
@@ -20530,25 +20545,25 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20530
20545
  let t = s.value.getBoundingClientRect(), n = (e.minX + e.maxX) / 2, r = (e.minY + e.maxY) / 2;
20531
20546
  d.value = t.width / 2 - n, f.value = t.height / 2 - r;
20532
20547
  }
20533
- function Ce(e = 40) {
20548
+ function we(e = 40) {
20534
20549
  if (!s.value) return;
20535
- let t = xe();
20550
+ let t = Se();
20536
20551
  if (!t) {
20537
- we();
20552
+ Te();
20538
20553
  return;
20539
20554
  }
20540
20555
  let n = s.value.getBoundingClientRect(), r = t.maxX - t.minX, i = t.maxY - t.minY;
20541
20556
  if (r <= 0 || i <= 0) {
20542
- Se();
20557
+ Ce();
20543
20558
  return;
20544
20559
  }
20545
20560
  let a = n.width - e * 2, o = n.height - e * 2, c = a / r, l = o / i, u = Math.max(z9, Math.min(B9, Math.min(c, l))), m = (t.minX + t.maxX) / 2, h = (t.minY + t.maxY) / 2;
20546
20561
  p.value = u, d.value = n.width / 2 - m * u, f.value = n.height / 2 - h * u;
20547
20562
  }
20548
- function we() {
20563
+ function Te() {
20549
20564
  d.value = 0, f.value = 0, p.value = 1;
20550
20565
  }
20551
- function Te() {
20566
+ function Ee() {
20552
20567
  if (!s.value) return [];
20553
20568
  let e = [];
20554
20569
  for (let t of h.value) {
@@ -20566,7 +20581,7 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20566
20581
  }
20567
20582
  return e;
20568
20583
  }
20569
- function Ee(e) {
20584
+ function De(e) {
20570
20585
  let t = [];
20571
20586
  for (let n of e) ie(n.el, n.x, n.y), t.push({
20572
20587
  id: n.id,
@@ -20575,59 +20590,59 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20575
20590
  });
20576
20591
  t.length && (m.value++, a("move", t));
20577
20592
  }
20578
- function De() {
20579
- let e = Te();
20593
+ function Oe() {
20594
+ let e = Ee();
20580
20595
  if (e.length < 2) return;
20581
20596
  let t = Math.min(...e.map((e) => e.x));
20582
- e.forEach((e) => e.x = t), Ee(e);
20597
+ e.forEach((e) => e.x = t), De(e);
20583
20598
  }
20584
- function Oe() {
20585
- let e = Te();
20599
+ function ke() {
20600
+ let e = Ee();
20586
20601
  if (e.length < 2) return;
20587
20602
  let t = e.map((e) => e.x + e.w / 2), n = t.reduce((e, t) => e + t, 0) / t.length;
20588
- e.forEach((e) => e.x = n - e.w / 2), Ee(e);
20603
+ e.forEach((e) => e.x = n - e.w / 2), De(e);
20589
20604
  }
20590
- function ke() {
20591
- let e = Te();
20605
+ function Ae() {
20606
+ let e = Ee();
20592
20607
  if (e.length < 2) return;
20593
20608
  let t = Math.max(...e.map((e) => e.x + e.w));
20594
- e.forEach((e) => e.x = t - e.w), Ee(e);
20609
+ e.forEach((e) => e.x = t - e.w), De(e);
20595
20610
  }
20596
- function Ae() {
20597
- let e = Te();
20611
+ function je() {
20612
+ let e = Ee();
20598
20613
  if (e.length < 2) return;
20599
20614
  let t = Math.min(...e.map((e) => e.y));
20600
- e.forEach((e) => e.y = t), Ee(e);
20615
+ e.forEach((e) => e.y = t), De(e);
20601
20616
  }
20602
- function je() {
20603
- let e = Te();
20617
+ function Me() {
20618
+ let e = Ee();
20604
20619
  if (e.length < 2) return;
20605
20620
  let t = e.map((e) => e.y + e.h / 2), n = t.reduce((e, t) => e + t, 0) / t.length;
20606
- e.forEach((e) => e.y = n - e.h / 2), Ee(e);
20621
+ e.forEach((e) => e.y = n - e.h / 2), De(e);
20607
20622
  }
20608
- function Me() {
20609
- let e = Te();
20623
+ function Ne() {
20624
+ let e = Ee();
20610
20625
  if (e.length < 2) return;
20611
20626
  let t = Math.max(...e.map((e) => e.y + e.h));
20612
- e.forEach((e) => e.y = t - e.h), Ee(e);
20627
+ e.forEach((e) => e.y = t - e.h), De(e);
20613
20628
  }
20614
- function Ne() {
20615
- let e = Te();
20629
+ function Pe() {
20630
+ let e = Ee();
20616
20631
  if (e.length < 3) return;
20617
20632
  e.sort((e, t) => e.x - t.x);
20618
20633
  let t = e[0], n = e[e.length - 1], r = e.reduce((e, t) => e + t.w, 0), i = (n.x + n.w - t.x - r) / (e.length - 1), a = t.x + t.w + i;
20619
20634
  for (let t = 1; t < e.length - 1; t++) e[t].x = a, a += e[t].w + i;
20620
- Ee(e);
20635
+ De(e);
20621
20636
  }
20622
- function Pe() {
20623
- let e = Te();
20637
+ function Fe() {
20638
+ let e = Ee();
20624
20639
  if (e.length < 3) return;
20625
20640
  e.sort((e, t) => e.y - t.y);
20626
20641
  let t = e[0], n = e[e.length - 1], r = e.reduce((e, t) => e + t.h, 0), i = (n.y + n.h - t.y - r) / (e.length - 1), a = t.y + t.h + i;
20627
20642
  for (let t = 1; t < e.length - 1; t++) e[t].y = a, a += e[t].h + i;
20628
- Ee(e);
20643
+ De(e);
20629
20644
  }
20630
- function Fe(e) {
20645
+ function Ie(e) {
20631
20646
  if (!s.value) return;
20632
20647
  let t = e?.gapX ?? 80, n = e?.gapY ?? 40, r = e?.padding ?? 60, a = [];
20633
20648
  if (s.value.querySelectorAll("[data-card-id]").forEach((e) => {
@@ -20668,38 +20683,38 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20668
20683
  for (let e of s) e.x = m, e.y = a, a += e.h + n, i = Math.max(i, e.w);
20669
20684
  m += i + t;
20670
20685
  }
20671
- Ee(a);
20686
+ De(a);
20672
20687
  }
20673
- let Ie = new MutationObserver(() => {
20688
+ let Le = new MutationObserver(() => {
20674
20689
  m.value++;
20675
20690
  });
20676
20691
  return C(() => {
20677
- s.value && Ie.observe(s.value, {
20692
+ s.value && Le.observe(s.value, {
20678
20693
  childList: !0,
20679
20694
  subtree: !0,
20680
20695
  attributes: !0
20681
- }), window.addEventListener("keydown", j), window.addEventListener("keyup", M), y(() => y(Ce));
20696
+ }), window.addEventListener("keydown", j), window.addEventListener("keyup", M), y(() => y(we));
20682
20697
  }), S(() => {
20683
- Ie.disconnect(), window.removeEventListener("keydown", j), window.removeEventListener("keyup", M);
20698
+ Le.disconnect(), window.removeEventListener("keydown", j), window.removeEventListener("keyup", M);
20684
20699
  }), t({
20685
- centerView: Se,
20686
- fitToView: Ce,
20687
- resetView: we,
20700
+ centerView: Ce,
20701
+ fitToView: we,
20702
+ resetView: Te,
20688
20703
  selectedIds: h,
20689
20704
  focusedId: g,
20690
20705
  selectAll: w,
20691
20706
  deselectAll: E,
20692
- alignLeft: De,
20693
- alignCenter: Oe,
20694
- alignRight: ke,
20695
- alignTop: Ae,
20696
- alignMiddle: je,
20697
- alignBottom: Me,
20698
- distributeHorizontally: Ne,
20699
- distributeVertically: Pe,
20700
- autoLayout: Fe,
20701
- onPortMouseDown: K,
20702
- onPortMouseUp: ve,
20707
+ alignLeft: Oe,
20708
+ alignCenter: ke,
20709
+ alignRight: Ae,
20710
+ alignTop: je,
20711
+ alignMiddle: Me,
20712
+ alignBottom: Ne,
20713
+ distributeHorizontally: Pe,
20714
+ distributeVertically: Fe,
20715
+ autoLayout: Ie,
20716
+ onPortMouseDown: ge,
20717
+ onPortMouseUp: ye,
20703
20718
  panX: d,
20704
20719
  panY: f,
20705
20720
  zoom: p
@@ -20713,7 +20728,7 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20713
20728
  onMousedown: L,
20714
20729
  onWheel: W(ne, ["prevent"])
20715
20730
  }, [
20716
- t[0] ||= u("div", { class: "nb-blueprint__ambient" }, null, -1),
20731
+ t[1] ||= u("div", { class: "nb-blueprint__ambient" }, null, -1),
20717
20732
  u("div", {
20718
20733
  class: "nb-blueprint__grid",
20719
20734
  style: x({ transform: `translate(${d.value}px, ${f.value}px) scale(${p.value})` })
@@ -20725,7 +20740,7 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20725
20740
  transformOrigin: "0 0"
20726
20741
  })
20727
20742
  }, [(T(), l("svg", _Xt, [
20728
- (T(!0), l(n, null, k(be.value, (t, n) => (T(), l("path", {
20743
+ (T(!0), l(n, null, k(xe.value, (t, n) => (T(), l("path", {
20729
20744
  key: n,
20730
20745
  d: t.path,
20731
20746
  fill: "none",
@@ -20735,7 +20750,7 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20735
20750
  style: x({ filter: `drop-shadow(0 0 6px ${t.color})` }),
20736
20751
  onClick: (n) => e.$emit("disconnect", t.conn)
20737
20752
  }, null, 12, vXt))), 128)),
20738
- (T(!0), l(n, null, k(be.value, (e, t) => (T(), l("path", {
20753
+ (T(!0), l(n, null, k(xe.value, (e, t) => (T(), l("path", {
20739
20754
  key: `flow-${t}`,
20740
20755
  d: e.path,
20741
20756
  fill: "none",
@@ -20745,9 +20760,9 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20745
20760
  class: "nb-blueprint__wire-flow",
20746
20761
  "pointer-events": "none"
20747
20762
  }, null, 8, yXt))), 128)),
20748
- me.value ? (T(), l("path", {
20763
+ he.value ? (T(), l("path", {
20749
20764
  key: 0,
20750
- d: me.value,
20765
+ d: he.value,
20751
20766
  fill: "none",
20752
20767
  stroke: "var(--nb-c-primary)",
20753
20768
  "stroke-width": "2",
@@ -20757,12 +20772,29 @@ var pJt = { class: "nb-command-palette__input-row" }, mJt = ["placeholder"], hJt
20757
20772
  ])), A(e.$slots, "default", {}, void 0, !0)], 4),
20758
20773
  G.value ? (T(), l("div", {
20759
20774
  key: 0,
20760
- class: "nb-blueprint__marquee",
20775
+ class: "nb-blueprint__marquee nb-blueprint__marquee--dragging",
20761
20776
  style: x(ue.value)
20762
- }, null, 4)) : c("", !0)
20777
+ }, null, 4)) : c("", !0),
20778
+ de.value ? (T(), l("svg", {
20779
+ key: 1,
20780
+ class: "nb-blueprint__selection-box",
20781
+ style: x(de.value)
20782
+ }, [...t[0] ||= [u("rect", {
20783
+ x: "0.75",
20784
+ y: "0.75",
20785
+ width: "calc(100% - 1.5px)",
20786
+ height: "calc(100% - 1.5px)",
20787
+ rx: "4",
20788
+ ry: "4",
20789
+ fill: "none",
20790
+ stroke: "var(--nb-blueprint-marquee-border, var(--nb-c-primary, #6366f1))",
20791
+ "stroke-width": "1.5",
20792
+ "stroke-dasharray": "6 4",
20793
+ class: "nb-blueprint__selection-ants"
20794
+ }, null, -1)]], 4)) : c("", !0)
20763
20795
  ], 34));
20764
20796
  }
20765
- }), [["__scopeId", "data-v-00b9225f"]]), xXt = ["data-card-id"], SXt = { class: "nb-blueprint-card__ports nb-blueprint-card__ports--left" }, CXt = [
20797
+ }), [["__scopeId", "data-v-7c73cc61"]]), xXt = ["data-card-id"], SXt = { class: "nb-blueprint-card__ports nb-blueprint-card__ports--left" }, CXt = [
20766
20798
  "data-port",
20767
20799
  "title",
20768
20800
  "onMousedown",