@sigx/terminal 0.2.3 → 0.2.5
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.js +123 -121
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -463,7 +463,7 @@ function ge(e) {
|
|
|
463
463
|
return t.currentSuspenseBoundary = e, n;
|
|
464
464
|
}
|
|
465
465
|
//#endregion
|
|
466
|
-
//#region ../runtime-core/src/component.ts
|
|
466
|
+
//#region ../runtime-core/src/component-lifecycle.ts
|
|
467
467
|
var M = null;
|
|
468
468
|
function _e() {
|
|
469
469
|
return pe() ?? M;
|
|
@@ -484,6 +484,8 @@ function ye(e) {
|
|
|
484
484
|
function be(e) {
|
|
485
485
|
M ? M.onUpdated(e) : console.warn("onUpdated called outside of component setup");
|
|
486
486
|
}
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region ../runtime-core/src/component.ts
|
|
487
489
|
var xe = /* @__PURE__ */ new Map();
|
|
488
490
|
function Se(e) {
|
|
489
491
|
return xe.get(e);
|
|
@@ -1212,7 +1214,34 @@ function Ot(e) {
|
|
|
1212
1214
|
}
|
|
1213
1215
|
//#endregion
|
|
1214
1216
|
//#region ../runtime-core/src/renderer.ts
|
|
1215
|
-
function
|
|
1217
|
+
function q(e, t) {
|
|
1218
|
+
let n = e.key == null ? null : e.key, r = t.key == null ? null : t.key;
|
|
1219
|
+
return e.type === t.type ? n === r ? !0 : String(n) === String(r) : !1;
|
|
1220
|
+
}
|
|
1221
|
+
function kt(e, t, n) {
|
|
1222
|
+
let r = /* @__PURE__ */ new Map();
|
|
1223
|
+
for (let i = t; i <= n; i++) {
|
|
1224
|
+
let t = e[i]?.key;
|
|
1225
|
+
if (t != null) {
|
|
1226
|
+
let e = String(t);
|
|
1227
|
+
process.env.NODE_ENV !== "production" && r.has(e) && console.warn(`[SignalX] Duplicate key "${t}" detected in list. Keys should be unique among siblings to ensure correct reconciliation. This may cause unexpected behavior when items are reordered, added, or removed.`), r.set(e, i);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
return r;
|
|
1231
|
+
}
|
|
1232
|
+
function At(e, t, n, r) {
|
|
1233
|
+
for (let i = n; i <= r; i++) if (e[i] && q(e[i], t)) return i;
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
function jt(e) {
|
|
1237
|
+
if (process.env.NODE_ENV === "production") return;
|
|
1238
|
+
let t = /* @__PURE__ */ new Set();
|
|
1239
|
+
for (let n of e) if (n?.key != null) {
|
|
1240
|
+
let e = String(n.key);
|
|
1241
|
+
t.has(e) && console.warn(`[SignalX] Duplicate key "${n.key}" detected in list. Keys should be unique among siblings to ensure correct reconciliation. This may cause unexpected behavior when items are reordered, added, or removed.`), t.add(e);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
function Mt(e) {
|
|
1216
1245
|
let { insert: t, remove: n, patchProp: r, createElement: i, createText: a, createComment: o, setText: s, setElementText: c, parentNode: l, nextSibling: u, cloneNode: d, insertStaticContent: m, patchDirective: h, onElementMounted: g, onElementUnmounted: _, getActiveElement: v, restoreFocus: ee } = e, y = null;
|
|
1217
1246
|
function te(e, t, n) {
|
|
1218
1247
|
n && (y = n);
|
|
@@ -1254,7 +1283,7 @@ function kt(e) {
|
|
|
1254
1283
|
return;
|
|
1255
1284
|
}
|
|
1256
1285
|
if (B(e.type)) {
|
|
1257
|
-
|
|
1286
|
+
E(e, n, s, e.type.__setup);
|
|
1258
1287
|
return;
|
|
1259
1288
|
}
|
|
1260
1289
|
let l = e.type, u = l === "svg" || c && l !== "foreignObject", d = i(l, u);
|
|
@@ -1292,7 +1321,7 @@ function kt(e) {
|
|
|
1292
1321
|
}
|
|
1293
1322
|
function C(e, n, i) {
|
|
1294
1323
|
if (e === n) return;
|
|
1295
|
-
if (!
|
|
1324
|
+
if (!q(e, n)) {
|
|
1296
1325
|
let t = l(e.dom) || i, r = e.dom ? u(e.dom) : null;
|
|
1297
1326
|
S(e, t), x(n, t, r);
|
|
1298
1327
|
return;
|
|
@@ -1363,34 +1392,26 @@ function kt(e) {
|
|
|
1363
1392
|
}
|
|
1364
1393
|
function w(e, t, n, r = !1) {
|
|
1365
1394
|
let i = e.children, a = t.children;
|
|
1366
|
-
a.forEach((e) => e.parent = t),
|
|
1367
|
-
}
|
|
1368
|
-
function T(e) {
|
|
1369
|
-
if (process.env.NODE_ENV === "production") return;
|
|
1370
|
-
let t = /* @__PURE__ */ new Set();
|
|
1371
|
-
for (let n of e) if (n?.key != null) {
|
|
1372
|
-
let e = String(n.key);
|
|
1373
|
-
t.has(e) && console.warn(`[SignalX] Duplicate key "${n.key}" detected in list. Keys should be unique among siblings to ensure correct reconciliation. This may cause unexpected behavior when items are reordered, added, or removed.`), t.add(e);
|
|
1374
|
-
}
|
|
1395
|
+
a.forEach((e) => e.parent = t), T(n, i, a, r);
|
|
1375
1396
|
}
|
|
1376
|
-
function
|
|
1377
|
-
process.env.NODE_ENV !== "production" &&
|
|
1397
|
+
function T(e, n, r, i = !1) {
|
|
1398
|
+
process.env.NODE_ENV !== "production" && jt(r);
|
|
1378
1399
|
let a = 0, o = n.length - 1, s = n[0], c = n[o], l = 0, d = r.length - 1, f = r[0], p = r[d], m;
|
|
1379
1400
|
for (; a <= o && l <= d;) if (s == null) s = n[++a];
|
|
1380
1401
|
else if (c == null) c = n[--o];
|
|
1381
|
-
else if (
|
|
1382
|
-
else if (
|
|
1383
|
-
else if (
|
|
1402
|
+
else if (q(s, f)) C(s, f, e), s = n[++a], f = r[++l];
|
|
1403
|
+
else if (q(c, p)) C(c, p, e), c = n[--o], p = r[--d];
|
|
1404
|
+
else if (q(s, p)) {
|
|
1384
1405
|
C(s, p, e);
|
|
1385
1406
|
let i = s.dom, o = c.dom ? u(c.dom) : null;
|
|
1386
1407
|
i && t(i, e, o), s = n[++a], p = r[--d];
|
|
1387
|
-
} else if (
|
|
1408
|
+
} else if (q(c, f)) {
|
|
1388
1409
|
C(c, f, e);
|
|
1389
1410
|
let i = c.dom, a = s.dom ?? null;
|
|
1390
1411
|
i && t(i, e, a), c = n[--o], f = r[++l];
|
|
1391
1412
|
} else {
|
|
1392
|
-
m ||=
|
|
1393
|
-
let c = f.key == null ?
|
|
1413
|
+
m ||= kt(n, a, o);
|
|
1414
|
+
let c = f.key == null ? At(n, f, a, o) : m.get(String(f.key));
|
|
1394
1415
|
if (c != null) {
|
|
1395
1416
|
let r = n[c];
|
|
1396
1417
|
C(r, f, e), n[c] = void 0, r.dom && s.dom && t(r.dom, e, s.dom);
|
|
@@ -1404,26 +1425,7 @@ function kt(e) {
|
|
|
1404
1425
|
}
|
|
1405
1426
|
} else if (l > d) for (let t = a; t <= o; t++) n[t] && S(n[t], e);
|
|
1406
1427
|
}
|
|
1407
|
-
function
|
|
1408
|
-
let n = e.key == null ? null : e.key, r = t.key == null ? null : t.key;
|
|
1409
|
-
return e.type === t.type ? n === r ? !0 : String(n) === String(r) : !1;
|
|
1410
|
-
}
|
|
1411
|
-
function O(e, t, n) {
|
|
1412
|
-
let r = /* @__PURE__ */ new Map();
|
|
1413
|
-
for (let i = t; i <= n; i++) {
|
|
1414
|
-
let t = e[i]?.key;
|
|
1415
|
-
if (t != null) {
|
|
1416
|
-
let e = String(t);
|
|
1417
|
-
process.env.NODE_ENV !== "production" && r.has(e) && console.warn(`[SignalX] Duplicate key "${t}" detected in list. Keys should be unique among siblings to ensure correct reconciliation. This may cause unexpected behavior when items are reordered, added, or removed.`), r.set(e, i);
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
return r;
|
|
1421
|
-
}
|
|
1422
|
-
function A(e, t, n, r) {
|
|
1423
|
-
for (let i = n; i <= r; i++) if (e[i] && D(e[i], t)) return i;
|
|
1424
|
-
return null;
|
|
1425
|
-
}
|
|
1426
|
-
function re(e, n, r, i) {
|
|
1428
|
+
function E(e, n, r, i) {
|
|
1427
1429
|
let a = o("");
|
|
1428
1430
|
e.dom = a, a.__vnode = e, t(a, n, r);
|
|
1429
1431
|
let s = null, c = !1, { children: l, slots: u, $models: d, ...m } = e.props || {}, h = { ...m };
|
|
@@ -1519,34 +1521,34 @@ function kt(e) {
|
|
|
1519
1521
|
patch: C,
|
|
1520
1522
|
mount: x,
|
|
1521
1523
|
unmount: S,
|
|
1522
|
-
mountComponent:
|
|
1524
|
+
mountComponent: E
|
|
1523
1525
|
};
|
|
1524
1526
|
}
|
|
1525
1527
|
//#endregion
|
|
1526
1528
|
//#region ../runtime-terminal/src/focus.ts
|
|
1527
|
-
var
|
|
1528
|
-
function Y(e) {
|
|
1529
|
-
q.add(e), J.activeId === null && (J.activeId = e);
|
|
1530
|
-
}
|
|
1529
|
+
var J = /* @__PURE__ */ new Set(), Y = k({ activeId: null });
|
|
1531
1530
|
function X(e) {
|
|
1532
|
-
|
|
1531
|
+
J.add(e), Y.activeId === null && (Y.activeId = e);
|
|
1532
|
+
}
|
|
1533
|
+
function Z(e) {
|
|
1534
|
+
J.delete(e), Y.activeId === e && (Y.activeId = null, J.size > 0 && (Y.activeId = J.values().next().value || null));
|
|
1533
1535
|
}
|
|
1534
|
-
function
|
|
1535
|
-
|
|
1536
|
+
function Nt(e) {
|
|
1537
|
+
J.has(e) && (Y.activeId = e);
|
|
1536
1538
|
}
|
|
1537
|
-
function
|
|
1538
|
-
if (
|
|
1539
|
-
let e = Array.from(
|
|
1540
|
-
|
|
1539
|
+
function Pt() {
|
|
1540
|
+
if (J.size === 0) return;
|
|
1541
|
+
let e = Array.from(J);
|
|
1542
|
+
Y.activeId = e[((Y.activeId ? e.indexOf(Y.activeId) : -1) + 1) % e.length];
|
|
1541
1543
|
}
|
|
1542
|
-
function
|
|
1543
|
-
if (
|
|
1544
|
-
let e = Array.from(
|
|
1545
|
-
|
|
1544
|
+
function Ft() {
|
|
1545
|
+
if (J.size === 0) return;
|
|
1546
|
+
let e = Array.from(J);
|
|
1547
|
+
Y.activeId = e[((Y.activeId ? e.indexOf(Y.activeId) : -1) - 1 + e.length) % e.length];
|
|
1546
1548
|
}
|
|
1547
1549
|
//#endregion
|
|
1548
1550
|
//#region ../runtime-terminal/src/utils.ts
|
|
1549
|
-
function
|
|
1551
|
+
function It(e) {
|
|
1550
1552
|
switch (e) {
|
|
1551
1553
|
case "red": return "\x1B[31m";
|
|
1552
1554
|
case "green": return "\x1B[32m";
|
|
@@ -1558,7 +1560,7 @@ function Nt(e) {
|
|
|
1558
1560
|
default: return "";
|
|
1559
1561
|
}
|
|
1560
1562
|
}
|
|
1561
|
-
function
|
|
1563
|
+
function Lt(e) {
|
|
1562
1564
|
switch (e) {
|
|
1563
1565
|
case "red": return "\x1B[41m";
|
|
1564
1566
|
case "green": return "\x1B[42m";
|
|
@@ -1570,13 +1572,13 @@ function Pt(e) {
|
|
|
1570
1572
|
default: return "";
|
|
1571
1573
|
}
|
|
1572
1574
|
}
|
|
1573
|
-
function
|
|
1575
|
+
function Rt(e) {
|
|
1574
1576
|
return e.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
1575
1577
|
}
|
|
1576
1578
|
//#endregion
|
|
1577
1579
|
//#region ../runtime-terminal/src/components/Input.tsx
|
|
1578
|
-
var
|
|
1579
|
-
let n = Math.random().toString(36).slice(2), r = !1, i = () =>
|
|
1580
|
+
var zt = F(({ props: e, emit: t }) => {
|
|
1581
|
+
let n = Math.random().toString(36).slice(2), r = !1, i = () => Y.activeId === n, a = () => e.model?.value || "", o = (n) => {
|
|
1580
1582
|
if (!i() || !r) return;
|
|
1581
1583
|
if (n === "\r") {
|
|
1582
1584
|
t("submit", a());
|
|
@@ -1596,11 +1598,11 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1596
1598
|
e.model && (e.model.value = o), t("input", o);
|
|
1597
1599
|
}, s = null;
|
|
1598
1600
|
return N(() => {
|
|
1599
|
-
|
|
1601
|
+
X(n), e.autofocus && Nt(n), s = $(o), setTimeout(() => {
|
|
1600
1602
|
r = !0;
|
|
1601
1603
|
}, 50);
|
|
1602
1604
|
}), P(() => {
|
|
1603
|
-
s && s(),
|
|
1605
|
+
s && s(), Z(n);
|
|
1604
1606
|
}), () => {
|
|
1605
1607
|
let t = a().replace(/[\r\n]+/g, " "), n = (e.placeholder || "").replace(/[\r\n]+/g, " "), r = i();
|
|
1606
1608
|
return /* @__PURE__ */ K("box", {
|
|
@@ -1613,19 +1615,19 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1613
1615
|
})]
|
|
1614
1616
|
});
|
|
1615
1617
|
};
|
|
1616
|
-
}, { name: "Input" }),
|
|
1617
|
-
let t = e.value || 0, n = e.max || 100, r = e.width || 20, i = e.char || "█", a = e.emptyChar || "░", o = e.color, s = o ?
|
|
1618
|
+
}, { name: "Input" }), Bt = F(({ props: e }) => () => {
|
|
1619
|
+
let t = e.value || 0, n = e.max || 100, r = e.width || 20, i = e.char || "█", a = e.emptyChar || "░", o = e.color, s = o ? It(o) : "", c = o ? "\x1B[0m" : "", l = Math.min(Math.max(t / n, 0), 1), u = Math.round(r * l), d = r - u;
|
|
1618
1620
|
return /* @__PURE__ */ G("box", { children: /* @__PURE__ */ G("text", { children: s + i.repeat(u) + a.repeat(d) + c + ` ${Math.round(l * 100)}%` }) });
|
|
1619
|
-
}, { name: "ProgressBar" }),
|
|
1620
|
-
let n = Math.random().toString(36).slice(2), r = () =>
|
|
1621
|
+
}, { name: "ProgressBar" }), Vt = F(({ props: e, emit: t }) => {
|
|
1622
|
+
let n = Math.random().toString(36).slice(2), r = () => Y.activeId === n, i = k({ value: !1 }), a = (e) => {
|
|
1621
1623
|
r() && (e === "\r" || e === " ") && (i.value = !0, s && clearTimeout(s), s = setTimeout(() => {
|
|
1622
1624
|
i.value = !1, s = null;
|
|
1623
1625
|
}, 120), t("click"));
|
|
1624
1626
|
}, o = null, s = null;
|
|
1625
1627
|
return N(() => {
|
|
1626
|
-
|
|
1628
|
+
X(n), o = $(a);
|
|
1627
1629
|
}), P(() => {
|
|
1628
|
-
o && o(),
|
|
1630
|
+
o && o(), Z(n), s && clearTimeout(s);
|
|
1629
1631
|
}), () => {
|
|
1630
1632
|
let t = r(), n = e.label || "Button", a = i.value;
|
|
1631
1633
|
return /* @__PURE__ */ G("box", {
|
|
@@ -1639,17 +1641,17 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1639
1641
|
})
|
|
1640
1642
|
});
|
|
1641
1643
|
};
|
|
1642
|
-
}, { name: "Button" }),
|
|
1643
|
-
let n = Math.random().toString(36).slice(2), r = () =>
|
|
1644
|
+
}, { name: "Button" }), Ht = F(({ props: e, emit: t }) => {
|
|
1645
|
+
let n = Math.random().toString(36).slice(2), r = () => Y.activeId === n, i = () => !!e.model?.value, a = (n) => {
|
|
1644
1646
|
if (r() && !e.disabled && (n === "\r" || n === " ")) {
|
|
1645
1647
|
let n = !i();
|
|
1646
1648
|
e.model && (e.model.value = n), t("change", n);
|
|
1647
1649
|
}
|
|
1648
1650
|
}, o = null;
|
|
1649
1651
|
return N(() => {
|
|
1650
|
-
|
|
1652
|
+
X(n), e.autofocus && Nt(n), o = $(a);
|
|
1651
1653
|
}), P(() => {
|
|
1652
|
-
o && o(),
|
|
1654
|
+
o && o(), Z(n);
|
|
1653
1655
|
}), () => {
|
|
1654
1656
|
let t = e.label || "", n = r(), a = i(), o = !!e.disabled;
|
|
1655
1657
|
return /* @__PURE__ */ K("box", { children: [
|
|
@@ -1671,8 +1673,8 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1671
1673
|
})
|
|
1672
1674
|
] });
|
|
1673
1675
|
};
|
|
1674
|
-
}, { name: "Checkbox" }),
|
|
1675
|
-
let n = Math.random().toString(36).slice(2), r = !1, i = () =>
|
|
1676
|
+
}, { name: "Checkbox" }), Ut = F(({ props: e, emit: t }) => {
|
|
1677
|
+
let n = Math.random().toString(36).slice(2), r = !1, i = () => Y.activeId === n, a = () => {
|
|
1676
1678
|
let t = (e.options || []).findIndex((t) => t.value === e.model?.value);
|
|
1677
1679
|
return t >= 0 ? t : 0;
|
|
1678
1680
|
}, o = (n) => {
|
|
@@ -1696,11 +1698,11 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1696
1698
|
}
|
|
1697
1699
|
}, s = null;
|
|
1698
1700
|
return N(() => {
|
|
1699
|
-
|
|
1701
|
+
X(n), e.autofocus && Nt(n), s = $(o), setTimeout(() => {
|
|
1700
1702
|
r = !0;
|
|
1701
1703
|
}, 50);
|
|
1702
1704
|
}), P(() => {
|
|
1703
|
-
s && s(),
|
|
1705
|
+
s && s(), Z(n);
|
|
1704
1706
|
}), () => {
|
|
1705
1707
|
let t = e.options || [], n = i(), r = e.model?.value || t[0]?.value || "", a = e.label, o = t.find((e) => e.value === r), s = t.map((e) => {
|
|
1706
1708
|
let t = e.value === r;
|
|
@@ -1723,21 +1725,21 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1723
1725
|
children: s
|
|
1724
1726
|
}), c] });
|
|
1725
1727
|
};
|
|
1726
|
-
}, { name: "Select" }), { render:
|
|
1728
|
+
}, { name: "Select" }), { render: Wt } = Mt({
|
|
1727
1729
|
patchProp: (e, t, n, r) => {
|
|
1728
|
-
e.props[t] = r,
|
|
1730
|
+
e.props[t] = r, Kt();
|
|
1729
1731
|
},
|
|
1730
1732
|
insert: (e, t, n) => {
|
|
1731
1733
|
e.parentNode = t;
|
|
1732
1734
|
let r = n ? t.children.indexOf(n) : -1;
|
|
1733
|
-
r > -1 ? t.children.splice(r, 0, e) : t.children.push(e),
|
|
1735
|
+
r > -1 ? t.children.splice(r, 0, e) : t.children.push(e), Kt();
|
|
1734
1736
|
},
|
|
1735
1737
|
remove: (e) => {
|
|
1736
1738
|
if (e.parentNode) {
|
|
1737
1739
|
let t = e.parentNode.children.indexOf(e);
|
|
1738
1740
|
t > -1 && e.parentNode.children.splice(t, 1), e.parentNode = null;
|
|
1739
1741
|
}
|
|
1740
|
-
|
|
1742
|
+
Kt();
|
|
1741
1743
|
},
|
|
1742
1744
|
createElement: (e) => ({
|
|
1743
1745
|
type: "element",
|
|
@@ -1758,7 +1760,7 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1758
1760
|
children: []
|
|
1759
1761
|
}),
|
|
1760
1762
|
setText: (e, t) => {
|
|
1761
|
-
e.text = t,
|
|
1763
|
+
e.text = t, Kt();
|
|
1762
1764
|
},
|
|
1763
1765
|
setElementText: (e, t) => {
|
|
1764
1766
|
e.children = [{
|
|
@@ -1767,7 +1769,7 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1767
1769
|
props: {},
|
|
1768
1770
|
children: [],
|
|
1769
1771
|
parentNode: e
|
|
1770
|
-
}],
|
|
1772
|
+
}], Kt();
|
|
1771
1773
|
},
|
|
1772
1774
|
parentNode: (e) => e.parentNode || null,
|
|
1773
1775
|
nextSibling: (e) => {
|
|
@@ -1779,41 +1781,41 @@ var It = F(({ props: e, emit: t }) => {
|
|
|
1779
1781
|
...e,
|
|
1780
1782
|
children: []
|
|
1781
1783
|
})
|
|
1782
|
-
}), Q = null,
|
|
1783
|
-
function
|
|
1784
|
-
|
|
1785
|
-
|
|
1784
|
+
}), Q = null, Gt = !1;
|
|
1785
|
+
function Kt() {
|
|
1786
|
+
Gt || (Gt = !0, setTimeout(() => {
|
|
1787
|
+
qt(), Gt = !1;
|
|
1786
1788
|
}, 10));
|
|
1787
1789
|
}
|
|
1788
|
-
function
|
|
1790
|
+
function qt() {
|
|
1789
1791
|
if (!Q) return;
|
|
1790
1792
|
process.stdout.write("\x1B[H");
|
|
1791
|
-
let e =
|
|
1793
|
+
let e = Yt(Q);
|
|
1792
1794
|
process.stdout.write(e.join("\x1B[K\n") + "\x1B[K"), process.stdout.write("\x1B[J");
|
|
1793
1795
|
}
|
|
1794
|
-
function
|
|
1796
|
+
function Jt(e) {
|
|
1795
1797
|
for (let t of e.children) if (t.tag === "box") return !0;
|
|
1796
1798
|
return !1;
|
|
1797
1799
|
}
|
|
1798
|
-
function
|
|
1800
|
+
function Yt(e) {
|
|
1799
1801
|
if (e.type === "text") return [e.text || ""];
|
|
1800
1802
|
if (e.type === "comment") return [];
|
|
1801
|
-
let t = [""], n = e.props.color, r = n ? "\x1B[0m" : "", i =
|
|
1803
|
+
let t = [""], n = e.props.color, r = n ? "\x1B[0m" : "", i = It(n);
|
|
1802
1804
|
for (let n of e.children) if (n.type === "text") t[t.length - 1] += i + (n.text || "") + r;
|
|
1803
1805
|
else if (n.tag === "br") t.push("");
|
|
1804
1806
|
else {
|
|
1805
|
-
let e =
|
|
1806
|
-
if (n.tag === "box" ||
|
|
1807
|
+
let e = Yt(n);
|
|
1808
|
+
if (n.tag === "box" || Jt(n)) t.length === 1 && t[0] === "" ? t = e : t.push(...e);
|
|
1807
1809
|
else if (e.length > 0) if (e.length > 1) t.length === 1 && t[0] === "" ? t = e : t.push(...e);
|
|
1808
1810
|
else {
|
|
1809
1811
|
t[t.length - 1] += e[0];
|
|
1810
1812
|
for (let n = 1; n < e.length; n++) t.push(e[n]);
|
|
1811
1813
|
}
|
|
1812
1814
|
}
|
|
1813
|
-
return e.tag === "box" && e.props.border ?
|
|
1815
|
+
return e.tag === "box" && e.props.border ? Xt(t, e.props.border, e.props.borderColor, e.props.backgroundColor, e.props.dropShadow, e.props.label) : t;
|
|
1814
1816
|
}
|
|
1815
|
-
function
|
|
1816
|
-
let o =
|
|
1817
|
+
function Xt(e, t, n, r, i, a) {
|
|
1818
|
+
let o = Zt(t), s = n ? It(n) : "", c = r ? Lt(r) : "", l = n || r ? "\x1B[0m" : "", u = e.reduce((e, t) => Math.max(e, Rt(t).length), 0), d = a || "", f = Rt(d).length, p = Math.max(u, f + 2), m = "";
|
|
1817
1819
|
if (d) {
|
|
1818
1820
|
let e = p - f - 2, t = Math.floor(e / 2), n = e - t;
|
|
1819
1821
|
m = o.h.repeat(t) + " " + d + " " + o.h.repeat(n);
|
|
@@ -1821,7 +1823,7 @@ function Gt(e, t, n, r, i, a) {
|
|
|
1821
1823
|
let h = c + s + o.tl + m + o.tr + l, g = c + s + o.bl + o.h.repeat(p) + o.br + l, _ = [];
|
|
1822
1824
|
_.push(h);
|
|
1823
1825
|
for (let t of e) {
|
|
1824
|
-
let e =
|
|
1826
|
+
let e = Rt(t).length, n = " ".repeat(p - e), r = c + t.replace(/\x1b\[0m/g, `\x1b[0m${c}`);
|
|
1825
1827
|
_.push(c + s + o.v + l + r + c + n + s + o.v + l);
|
|
1826
1828
|
}
|
|
1827
1829
|
if (_.push(g), i) {
|
|
@@ -1832,7 +1834,7 @@ function Gt(e, t, n, r, i, a) {
|
|
|
1832
1834
|
}
|
|
1833
1835
|
return _;
|
|
1834
1836
|
}
|
|
1835
|
-
function
|
|
1837
|
+
function Zt(e) {
|
|
1836
1838
|
return e === "double" ? {
|
|
1837
1839
|
tl: "╔",
|
|
1838
1840
|
tr: "╗",
|
|
@@ -1856,58 +1858,58 @@ function Kt(e) {
|
|
|
1856
1858
|
v: "│"
|
|
1857
1859
|
};
|
|
1858
1860
|
}
|
|
1859
|
-
var
|
|
1860
|
-
function
|
|
1861
|
-
return
|
|
1861
|
+
var Qt = /* @__PURE__ */ new Set();
|
|
1862
|
+
function $(e) {
|
|
1863
|
+
return Qt.add(e), () => Qt.delete(e);
|
|
1862
1864
|
}
|
|
1863
|
-
function
|
|
1865
|
+
function $t(e) {
|
|
1864
1866
|
if (e === "" && (process.stdout.write("\x1B[?25h"), process.exit()), e === " ") {
|
|
1865
|
-
|
|
1867
|
+
Pt();
|
|
1866
1868
|
return;
|
|
1867
1869
|
}
|
|
1868
1870
|
if (e === "\x1B[Z") {
|
|
1869
|
-
|
|
1871
|
+
Ft();
|
|
1870
1872
|
return;
|
|
1871
1873
|
}
|
|
1872
|
-
for (let t of
|
|
1874
|
+
for (let t of Qt) t(e);
|
|
1873
1875
|
}
|
|
1874
|
-
function
|
|
1876
|
+
function en(e, t = {}) {
|
|
1875
1877
|
Q = {
|
|
1876
1878
|
type: "root",
|
|
1877
1879
|
props: {},
|
|
1878
1880
|
children: []
|
|
1879
1881
|
};
|
|
1880
1882
|
let n = Q;
|
|
1881
|
-
return process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data",
|
|
1882
|
-
|
|
1883
|
+
return process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data", $t)), t.clearConsole && process.stdout.write("\x1B[2J\x1B[3J\x1B[H"), process.stdout.write("\x1B[?25l"), Wt(e, n), qt(), { unmount: () => {
|
|
1884
|
+
Wt(null, n), process.stdout.write("\x1B[?25h"), process.stdin.isTTY && (process.stdin.setRawMode(!1), process.stdin.pause(), process.stdin.off("data", $t));
|
|
1883
1885
|
} };
|
|
1884
1886
|
}
|
|
1885
|
-
var
|
|
1886
|
-
function
|
|
1887
|
+
var tn = null;
|
|
1888
|
+
function nn(e = { clearConsole: !0 }) {
|
|
1887
1889
|
return {
|
|
1888
|
-
mount:
|
|
1890
|
+
mount: an,
|
|
1889
1891
|
options: e,
|
|
1890
1892
|
onMount: (e) => {
|
|
1891
|
-
|
|
1893
|
+
tn = e;
|
|
1892
1894
|
}
|
|
1893
1895
|
};
|
|
1894
1896
|
}
|
|
1895
|
-
function
|
|
1896
|
-
|
|
1897
|
+
function rn() {
|
|
1898
|
+
tn &&= (tn(), null), process.stdout.write("\x1B[?25h"), process.stdout.write("\x1B[2J\x1B[H");
|
|
1897
1899
|
}
|
|
1898
|
-
var
|
|
1900
|
+
var an = (e, t, n) => {
|
|
1899
1901
|
Q = {
|
|
1900
1902
|
type: "root",
|
|
1901
1903
|
props: {},
|
|
1902
1904
|
children: []
|
|
1903
1905
|
};
|
|
1904
1906
|
let r = Q;
|
|
1905
|
-
return process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data",
|
|
1906
|
-
|
|
1907
|
+
return process.stdin.isTTY && (process.stdin.setRawMode(!0), process.stdin.resume(), process.stdin.setEncoding("utf8"), process.stdin.on("data", $t)), t?.clearConsole && process.stdout.write("\x1B[2J\x1B[3J\x1B[H"), process.stdout.write("\x1B[?25l"), Wt(e, r, n), qt(), () => {
|
|
1908
|
+
Wt(null, r), process.stdout.write("\x1B[?25h"), process.stdin.isTTY && (process.stdin.setRawMode(!1), process.stdin.pause(), process.stdin.off("data", $t));
|
|
1907
1909
|
};
|
|
1908
1910
|
};
|
|
1909
|
-
He(
|
|
1911
|
+
He(an);
|
|
1910
1912
|
//#endregion
|
|
1911
|
-
export {
|
|
1913
|
+
export { Vt as Button, Dt as CLIENT_DIRECTIVES, Et as CLIENT_DIRECTIVE_PREFIX, Ht as Checkbox, U as Comment, t as ComputedSymbol, mt as ErrorBoundary, V as Fragment, zt as Input, vt as InstanceLifetimes, Bt as ProgressBar, Ut as Select, I as SigxError, L as SigxErrorCode, xt as SubscriptionHandler, dt as Suspense, H as Text, ht as Utils, Ee as asyncSetupClientError, s as batch, F as component, Xe as compound, ie as computed, Qe as createModel, $e as createModelFromBinding, yt as createTopic, Ue as defineApp, ze as defineDirective, St as defineFactory, Ne as defineInjectable, Pe as defineProvide, D as detectAccess, f as effect, m as effectScope, rn as exitTerminal, Nt as focus, Pt as focusNext, Ft as focusPrev, Y as focusState, Se as getComponentMeta, _e as getCurrentInstance, _t as guid, B as isComponent, j as isComputed, Be as isDirective, ft as isLazyComponent, z as isModel, ee as isReactive, G as jsx, st as jsxDEV, K as jsxs, ut as lazy, Te as mountTargetNotFoundError, nn as mountTerminal, Ce as noMountFunctionError, ye as onCreated, $ as onKey, N as onMounted, P as onUnmounted, be as onUpdated, Oe as provideInvalidInjectableError, De as provideOutsideSetupError, X as registerFocusable, Wt as render, Yt as renderNodeToLines, we as renderTargetNotFoundError, en as renderTerminal, k as signal, an as terminalMount, v as toRaw, bt as toSubscriber, Z as unregisterFocusable, p as untrack, Fe as useAppContext, pt as useAsync, re as watch };
|
|
1912
1914
|
|
|
1913
1915
|
//# sourceMappingURL=index.js.map
|