@gridland/core 0.2.22 → 0.2.24
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.d.ts +13 -5
- package/dist/index.js +854 -160
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,6 +17,10 @@ var __esm = (fn, res) => function __init() {
|
|
|
17
17
|
var __commonJS = (cb, mod) => function __require2() {
|
|
18
18
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
19
|
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
20
24
|
var __copyProps = (to, from, except, desc) => {
|
|
21
25
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
26
|
for (let key of __getOwnPropNames(from))
|
|
@@ -22594,6 +22598,171 @@ var init_devtools = __esm({
|
|
|
22594
22598
|
}
|
|
22595
22599
|
});
|
|
22596
22600
|
|
|
22601
|
+
// ../web/src/core-shims/rgba.ts
|
|
22602
|
+
var RGBA = class _RGBA {
|
|
22603
|
+
buffer;
|
|
22604
|
+
constructor(buffer) {
|
|
22605
|
+
this.buffer = buffer;
|
|
22606
|
+
}
|
|
22607
|
+
static fromArray(array) {
|
|
22608
|
+
return new _RGBA(array);
|
|
22609
|
+
}
|
|
22610
|
+
static fromValues(r, g, b2, a = 1) {
|
|
22611
|
+
return new _RGBA(new Float32Array([r, g, b2, a]));
|
|
22612
|
+
}
|
|
22613
|
+
static fromInts(r, g, b2, a = 255) {
|
|
22614
|
+
return new _RGBA(new Float32Array([r / 255, g / 255, b2 / 255, a / 255]));
|
|
22615
|
+
}
|
|
22616
|
+
static fromHex(hex) {
|
|
22617
|
+
return hexToRgb(hex);
|
|
22618
|
+
}
|
|
22619
|
+
get r() {
|
|
22620
|
+
return this.buffer[0];
|
|
22621
|
+
}
|
|
22622
|
+
set r(v2) {
|
|
22623
|
+
this.buffer[0] = v2;
|
|
22624
|
+
}
|
|
22625
|
+
get g() {
|
|
22626
|
+
return this.buffer[1];
|
|
22627
|
+
}
|
|
22628
|
+
set g(v2) {
|
|
22629
|
+
this.buffer[1] = v2;
|
|
22630
|
+
}
|
|
22631
|
+
get b() {
|
|
22632
|
+
return this.buffer[2];
|
|
22633
|
+
}
|
|
22634
|
+
set b(v2) {
|
|
22635
|
+
this.buffer[2] = v2;
|
|
22636
|
+
}
|
|
22637
|
+
get a() {
|
|
22638
|
+
return this.buffer[3];
|
|
22639
|
+
}
|
|
22640
|
+
set a(v2) {
|
|
22641
|
+
this.buffer[3] = v2;
|
|
22642
|
+
}
|
|
22643
|
+
toInts() {
|
|
22644
|
+
return [
|
|
22645
|
+
Math.round(this.buffer[0] * 255),
|
|
22646
|
+
Math.round(this.buffer[1] * 255),
|
|
22647
|
+
Math.round(this.buffer[2] * 255),
|
|
22648
|
+
Math.round(this.buffer[3] * 255)
|
|
22649
|
+
];
|
|
22650
|
+
}
|
|
22651
|
+
map(fn) {
|
|
22652
|
+
return [fn(this.buffer[0]), fn(this.buffer[1]), fn(this.buffer[2]), fn(this.buffer[3])];
|
|
22653
|
+
}
|
|
22654
|
+
toString() {
|
|
22655
|
+
const [r, g, b2, a] = this.toInts();
|
|
22656
|
+
return `rgba(${r}, ${g}, ${b2}, ${a / 255})`;
|
|
22657
|
+
}
|
|
22658
|
+
equals(other) {
|
|
22659
|
+
if (!other) return false;
|
|
22660
|
+
return this.buffer[0] === other.buffer[0] && this.buffer[1] === other.buffer[1] && this.buffer[2] === other.buffer[2] && this.buffer[3] === other.buffer[3];
|
|
22661
|
+
}
|
|
22662
|
+
};
|
|
22663
|
+
var CSS_COLOR_NAMES = {
|
|
22664
|
+
black: "#000000",
|
|
22665
|
+
white: "#ffffff",
|
|
22666
|
+
red: "#ff0000",
|
|
22667
|
+
green: "#008000",
|
|
22668
|
+
blue: "#0000ff",
|
|
22669
|
+
yellow: "#ffff00",
|
|
22670
|
+
cyan: "#00ffff",
|
|
22671
|
+
magenta: "#ff00ff",
|
|
22672
|
+
silver: "#c0c0c0",
|
|
22673
|
+
gray: "#808080",
|
|
22674
|
+
grey: "#808080",
|
|
22675
|
+
maroon: "#800000",
|
|
22676
|
+
olive: "#808000",
|
|
22677
|
+
lime: "#00ff00",
|
|
22678
|
+
aqua: "#00ffff",
|
|
22679
|
+
teal: "#008080",
|
|
22680
|
+
navy: "#000080",
|
|
22681
|
+
fuchsia: "#ff00ff",
|
|
22682
|
+
purple: "#800080",
|
|
22683
|
+
orange: "#ffa500",
|
|
22684
|
+
transparent: "#00000000",
|
|
22685
|
+
brightblack: "#808080",
|
|
22686
|
+
brightred: "#ff5555",
|
|
22687
|
+
brightgreen: "#55ff55",
|
|
22688
|
+
brightyellow: "#ffff55",
|
|
22689
|
+
brightblue: "#5555ff",
|
|
22690
|
+
brightmagenta: "#ff55ff",
|
|
22691
|
+
brightcyan: "#55ffff",
|
|
22692
|
+
brightwhite: "#ffffff"
|
|
22693
|
+
};
|
|
22694
|
+
function hexToRgb(hex) {
|
|
22695
|
+
hex = hex.replace(/^#/, "");
|
|
22696
|
+
if (hex.length === 3) {
|
|
22697
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
22698
|
+
}
|
|
22699
|
+
if (hex.length === 6) {
|
|
22700
|
+
hex = hex + "ff";
|
|
22701
|
+
}
|
|
22702
|
+
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
22703
|
+
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
22704
|
+
const b2 = parseInt(hex.substring(4, 6), 16) / 255;
|
|
22705
|
+
const a = parseInt(hex.substring(6, 8), 16) / 255;
|
|
22706
|
+
return RGBA.fromValues(r, g, b2, a);
|
|
22707
|
+
}
|
|
22708
|
+
function rgbToHex(rgb) {
|
|
22709
|
+
const [r, g, b2] = rgb.toInts();
|
|
22710
|
+
return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b2.toString(16).padStart(2, "0")}`;
|
|
22711
|
+
}
|
|
22712
|
+
function hsvToRgb(h2, s, v2) {
|
|
22713
|
+
const c = v2 * s;
|
|
22714
|
+
const x2 = c * (1 - Math.abs(h2 / 60 % 2 - 1));
|
|
22715
|
+
const m2 = v2 - c;
|
|
22716
|
+
let r = 0, g = 0, b2 = 0;
|
|
22717
|
+
if (h2 < 60) {
|
|
22718
|
+
r = c;
|
|
22719
|
+
g = x2;
|
|
22720
|
+
b2 = 0;
|
|
22721
|
+
} else if (h2 < 120) {
|
|
22722
|
+
r = x2;
|
|
22723
|
+
g = c;
|
|
22724
|
+
b2 = 0;
|
|
22725
|
+
} else if (h2 < 180) {
|
|
22726
|
+
r = 0;
|
|
22727
|
+
g = c;
|
|
22728
|
+
b2 = x2;
|
|
22729
|
+
} else if (h2 < 240) {
|
|
22730
|
+
r = 0;
|
|
22731
|
+
g = x2;
|
|
22732
|
+
b2 = c;
|
|
22733
|
+
} else if (h2 < 300) {
|
|
22734
|
+
r = x2;
|
|
22735
|
+
g = 0;
|
|
22736
|
+
b2 = c;
|
|
22737
|
+
} else {
|
|
22738
|
+
r = c;
|
|
22739
|
+
g = 0;
|
|
22740
|
+
b2 = x2;
|
|
22741
|
+
}
|
|
22742
|
+
return RGBA.fromValues(r + m2, g + m2, b2 + m2, 1);
|
|
22743
|
+
}
|
|
22744
|
+
function parseColor(color) {
|
|
22745
|
+
if (color instanceof RGBA) return color;
|
|
22746
|
+
if (typeof color !== "string") return RGBA.fromValues(1, 1, 1, 1);
|
|
22747
|
+
const lower = color.toLowerCase().trim();
|
|
22748
|
+
if (CSS_COLOR_NAMES[lower]) {
|
|
22749
|
+
return hexToRgb(CSS_COLOR_NAMES[lower]);
|
|
22750
|
+
}
|
|
22751
|
+
if (lower.startsWith("#")) {
|
|
22752
|
+
return hexToRgb(lower);
|
|
22753
|
+
}
|
|
22754
|
+
const rgbaMatch = lower.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/);
|
|
22755
|
+
if (rgbaMatch) {
|
|
22756
|
+
return RGBA.fromInts(
|
|
22757
|
+
parseInt(rgbaMatch[1]),
|
|
22758
|
+
parseInt(rgbaMatch[2]),
|
|
22759
|
+
parseInt(rgbaMatch[3]),
|
|
22760
|
+
rgbaMatch[4] ? Math.round(parseFloat(rgbaMatch[4]) * 255) : 255
|
|
22761
|
+
);
|
|
22762
|
+
}
|
|
22763
|
+
return RGBA.fromValues(1, 1, 1, 1);
|
|
22764
|
+
}
|
|
22765
|
+
|
|
22597
22766
|
// ../web/src/core-shims/types.ts
|
|
22598
22767
|
var TextAttributes = {
|
|
22599
22768
|
NONE: 0,
|
|
@@ -22606,6 +22775,18 @@ var TextAttributes = {
|
|
|
22606
22775
|
HIDDEN: 1 << 6,
|
|
22607
22776
|
STRIKETHROUGH: 1 << 7
|
|
22608
22777
|
};
|
|
22778
|
+
var ATTRIBUTE_BASE_BITS = 8;
|
|
22779
|
+
var ATTRIBUTE_BASE_MASK = 255;
|
|
22780
|
+
function getBaseAttributes(attr) {
|
|
22781
|
+
return attr & 255;
|
|
22782
|
+
}
|
|
22783
|
+
var DebugOverlayCorner = /* @__PURE__ */ ((DebugOverlayCorner2) => {
|
|
22784
|
+
DebugOverlayCorner2[DebugOverlayCorner2["topLeft"] = 0] = "topLeft";
|
|
22785
|
+
DebugOverlayCorner2[DebugOverlayCorner2["topRight"] = 1] = "topRight";
|
|
22786
|
+
DebugOverlayCorner2[DebugOverlayCorner2["bottomLeft"] = 2] = "bottomLeft";
|
|
22787
|
+
DebugOverlayCorner2[DebugOverlayCorner2["bottomRight"] = 3] = "bottomRight";
|
|
22788
|
+
return DebugOverlayCorner2;
|
|
22789
|
+
})(DebugOverlayCorner || {});
|
|
22609
22790
|
|
|
22610
22791
|
// ../web/src/shims/events-shim.ts
|
|
22611
22792
|
var EventEmitter = class {
|
|
@@ -25106,6 +25287,18 @@ function isSizeType(value) {
|
|
|
25106
25287
|
|
|
25107
25288
|
// ../../opentui/packages/core/src/Renderable.ts
|
|
25108
25289
|
var BrandedRenderable = /* @__PURE__ */ Symbol.for("@opentui/core/Renderable");
|
|
25290
|
+
var LayoutEvents = /* @__PURE__ */ ((LayoutEvents2) => {
|
|
25291
|
+
LayoutEvents2["LAYOUT_CHANGED"] = "layout-changed";
|
|
25292
|
+
LayoutEvents2["ADDED"] = "added";
|
|
25293
|
+
LayoutEvents2["REMOVED"] = "removed";
|
|
25294
|
+
LayoutEvents2["RESIZED"] = "resized";
|
|
25295
|
+
return LayoutEvents2;
|
|
25296
|
+
})(LayoutEvents || {});
|
|
25297
|
+
var RenderableEvents = /* @__PURE__ */ ((RenderableEvents2) => {
|
|
25298
|
+
RenderableEvents2["FOCUSED"] = "focused";
|
|
25299
|
+
RenderableEvents2["BLURRED"] = "blurred";
|
|
25300
|
+
return RenderableEvents2;
|
|
25301
|
+
})(RenderableEvents || {});
|
|
25109
25302
|
function isRenderable(obj) {
|
|
25110
25303
|
return !!obj?.[BrandedRenderable];
|
|
25111
25304
|
}
|
|
@@ -26223,6 +26416,74 @@ var Renderable = class _Renderable extends BaseRenderable {
|
|
|
26223
26416
|
this.onSizeChange = options.onSizeChange;
|
|
26224
26417
|
}
|
|
26225
26418
|
};
|
|
26419
|
+
var RootRenderable = class extends Renderable {
|
|
26420
|
+
renderList = [];
|
|
26421
|
+
constructor(ctx) {
|
|
26422
|
+
super(ctx, { id: "__root__", zIndex: 0, visible: true, width: ctx.width, height: ctx.height, enableLayout: true });
|
|
26423
|
+
if (this.yogaNode) {
|
|
26424
|
+
this.yogaNode.free();
|
|
26425
|
+
}
|
|
26426
|
+
this.yogaNode = src_default.Node.create(yogaConfig);
|
|
26427
|
+
this.yogaNode.setWidth(ctx.width);
|
|
26428
|
+
this.yogaNode.setHeight(ctx.height);
|
|
26429
|
+
this.yogaNode.setFlexDirection(FlexDirection.Column);
|
|
26430
|
+
this.calculateLayout();
|
|
26431
|
+
}
|
|
26432
|
+
render(buffer, deltaTime) {
|
|
26433
|
+
if (!this.visible) return;
|
|
26434
|
+
for (const renderable of this._ctx.getLifecyclePasses()) {
|
|
26435
|
+
renderable.onLifecyclePass?.call(renderable);
|
|
26436
|
+
}
|
|
26437
|
+
if (this.yogaNode.isDirty()) {
|
|
26438
|
+
this.calculateLayout();
|
|
26439
|
+
}
|
|
26440
|
+
this.renderList.length = 0;
|
|
26441
|
+
this.updateLayout(deltaTime, this.renderList);
|
|
26442
|
+
this._ctx.clearHitGridScissorRects();
|
|
26443
|
+
for (let i = 1; i < this.renderList.length; i++) {
|
|
26444
|
+
const command = this.renderList[i];
|
|
26445
|
+
switch (command.action) {
|
|
26446
|
+
case "render":
|
|
26447
|
+
if (!command.renderable.isDestroyed) {
|
|
26448
|
+
command.renderable.render(buffer, deltaTime);
|
|
26449
|
+
}
|
|
26450
|
+
break;
|
|
26451
|
+
case "pushScissorRect":
|
|
26452
|
+
buffer.pushScissorRect(command.x, command.y, command.width, command.height);
|
|
26453
|
+
this._ctx.pushHitGridScissorRect(command.screenX, command.screenY, command.width, command.height);
|
|
26454
|
+
break;
|
|
26455
|
+
case "popScissorRect":
|
|
26456
|
+
buffer.popScissorRect();
|
|
26457
|
+
this._ctx.popHitGridScissorRect();
|
|
26458
|
+
break;
|
|
26459
|
+
case "pushOpacity":
|
|
26460
|
+
buffer.pushOpacity(command.opacity);
|
|
26461
|
+
break;
|
|
26462
|
+
case "popOpacity":
|
|
26463
|
+
buffer.popOpacity();
|
|
26464
|
+
break;
|
|
26465
|
+
}
|
|
26466
|
+
}
|
|
26467
|
+
}
|
|
26468
|
+
propagateLiveCount(delta) {
|
|
26469
|
+
const oldCount = this._liveCount;
|
|
26470
|
+
this._liveCount += delta;
|
|
26471
|
+
if (oldCount === 0 && this._liveCount > 0) {
|
|
26472
|
+
this._ctx.requestLive();
|
|
26473
|
+
} else if (oldCount > 0 && this._liveCount === 0) {
|
|
26474
|
+
this._ctx.dropLive();
|
|
26475
|
+
}
|
|
26476
|
+
}
|
|
26477
|
+
calculateLayout() {
|
|
26478
|
+
this.yogaNode.calculateLayout(this.width, this.height, Direction.LTR);
|
|
26479
|
+
this.emit("layout-changed" /* LAYOUT_CHANGED */);
|
|
26480
|
+
}
|
|
26481
|
+
resize(width, height) {
|
|
26482
|
+
this.width = width;
|
|
26483
|
+
this.height = height;
|
|
26484
|
+
this.emit("resized" /* RESIZED */, { width, height });
|
|
26485
|
+
}
|
|
26486
|
+
};
|
|
26226
26487
|
|
|
26227
26488
|
// ../../opentui/packages/core/src/lib/border.ts
|
|
26228
26489
|
var VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
|
|
@@ -26294,6 +26555,14 @@ var BorderChars = {
|
|
|
26294
26555
|
cross: "\u254B"
|
|
26295
26556
|
}
|
|
26296
26557
|
};
|
|
26558
|
+
function getBorderFromSides(sides) {
|
|
26559
|
+
const result = [];
|
|
26560
|
+
if (sides.top) result.push("top");
|
|
26561
|
+
if (sides.right) result.push("right");
|
|
26562
|
+
if (sides.bottom) result.push("bottom");
|
|
26563
|
+
if (sides.left) result.push("left");
|
|
26564
|
+
return result.length > 0 ? result : false;
|
|
26565
|
+
}
|
|
26297
26566
|
function getBorderSides(border) {
|
|
26298
26567
|
return border === true ? { top: true, right: true, bottom: true, left: true } : Array.isArray(border) ? {
|
|
26299
26568
|
top: border.includes("top"),
|
|
@@ -26369,7 +26638,7 @@ function createTextAttributes({
|
|
|
26369
26638
|
}
|
|
26370
26639
|
|
|
26371
26640
|
// ../../opentui/packages/core/src/lib/RGBA.ts
|
|
26372
|
-
var
|
|
26641
|
+
var RGBA2 = class _RGBA {
|
|
26373
26642
|
buffer;
|
|
26374
26643
|
constructor(buffer) {
|
|
26375
26644
|
this.buffer = buffer;
|
|
@@ -26384,7 +26653,7 @@ var RGBA = class _RGBA {
|
|
|
26384
26653
|
return new _RGBA(new Float32Array([r / 255, g / 255, b2 / 255, a / 255]));
|
|
26385
26654
|
}
|
|
26386
26655
|
static fromHex(hex) {
|
|
26387
|
-
return
|
|
26656
|
+
return hexToRgb2(hex);
|
|
26388
26657
|
}
|
|
26389
26658
|
toInts() {
|
|
26390
26659
|
return [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255), Math.round(this.a * 255)];
|
|
@@ -26424,7 +26693,7 @@ var RGBA = class _RGBA {
|
|
|
26424
26693
|
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
26425
26694
|
}
|
|
26426
26695
|
};
|
|
26427
|
-
function
|
|
26696
|
+
function hexToRgb2(hex) {
|
|
26428
26697
|
hex = hex.replace(/^#/, "");
|
|
26429
26698
|
if (hex.length === 3) {
|
|
26430
26699
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
@@ -26433,15 +26702,15 @@ function hexToRgb(hex) {
|
|
|
26433
26702
|
}
|
|
26434
26703
|
if (!/^[0-9A-Fa-f]{6}$/.test(hex) && !/^[0-9A-Fa-f]{8}$/.test(hex)) {
|
|
26435
26704
|
console.warn(`Invalid hex color: ${hex}, defaulting to magenta`);
|
|
26436
|
-
return
|
|
26705
|
+
return RGBA2.fromValues(1, 0, 1, 1);
|
|
26437
26706
|
}
|
|
26438
26707
|
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
26439
26708
|
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
26440
26709
|
const b2 = parseInt(hex.substring(4, 6), 16) / 255;
|
|
26441
26710
|
const a = hex.length === 8 ? parseInt(hex.substring(6, 8), 16) / 255 : 1;
|
|
26442
|
-
return
|
|
26711
|
+
return RGBA2.fromValues(r, g, b2, a);
|
|
26443
26712
|
}
|
|
26444
|
-
var
|
|
26713
|
+
var CSS_COLOR_NAMES2 = {
|
|
26445
26714
|
black: "#000000",
|
|
26446
26715
|
white: "#FFFFFF",
|
|
26447
26716
|
red: "#FF0000",
|
|
@@ -26471,16 +26740,16 @@ var CSS_COLOR_NAMES = {
|
|
|
26471
26740
|
brightmagenta: "#FF66FF",
|
|
26472
26741
|
brightwhite: "#FFFFFF"
|
|
26473
26742
|
};
|
|
26474
|
-
function
|
|
26743
|
+
function parseColor2(color) {
|
|
26475
26744
|
if (typeof color === "string") {
|
|
26476
26745
|
const lowerColor = color.toLowerCase();
|
|
26477
26746
|
if (lowerColor === "transparent") {
|
|
26478
|
-
return
|
|
26747
|
+
return RGBA2.fromValues(0, 0, 0, 0);
|
|
26479
26748
|
}
|
|
26480
|
-
if (
|
|
26481
|
-
return
|
|
26749
|
+
if (CSS_COLOR_NAMES2[lowerColor]) {
|
|
26750
|
+
return hexToRgb2(CSS_COLOR_NAMES2[lowerColor]);
|
|
26482
26751
|
}
|
|
26483
|
-
return
|
|
26752
|
+
return hexToRgb2(color);
|
|
26484
26753
|
}
|
|
26485
26754
|
return color;
|
|
26486
26755
|
}
|
|
@@ -26507,8 +26776,8 @@ function stringToStyledText(content) {
|
|
|
26507
26776
|
function applyStyle(input, style) {
|
|
26508
26777
|
if (typeof input === "object" && "__isChunk" in input) {
|
|
26509
26778
|
const existingChunk = input;
|
|
26510
|
-
const fg2 = style.fg ?
|
|
26511
|
-
const bg2 = style.bg ?
|
|
26779
|
+
const fg2 = style.fg ? parseColor2(style.fg) : existingChunk.fg;
|
|
26780
|
+
const bg2 = style.bg ? parseColor2(style.bg) : existingChunk.bg;
|
|
26512
26781
|
const newAttrs = createTextAttributes(style);
|
|
26513
26782
|
const mergedAttrs = existingChunk.attributes ? existingChunk.attributes | newAttrs : newAttrs;
|
|
26514
26783
|
return {
|
|
@@ -26521,8 +26790,8 @@ function applyStyle(input, style) {
|
|
|
26521
26790
|
};
|
|
26522
26791
|
} else {
|
|
26523
26792
|
const plainTextStr = String(input);
|
|
26524
|
-
const fg2 = style.fg ?
|
|
26525
|
-
const bg2 = style.bg ?
|
|
26793
|
+
const fg2 = style.fg ? parseColor2(style.fg) : void 0;
|
|
26794
|
+
const bg2 = style.bg ? parseColor2(style.bg) : void 0;
|
|
26526
26795
|
const attributes = createTextAttributes(style);
|
|
26527
26796
|
return {
|
|
26528
26797
|
__isChunk: true,
|
|
@@ -26533,7 +26802,48 @@ function applyStyle(input, style) {
|
|
|
26533
26802
|
};
|
|
26534
26803
|
}
|
|
26535
26804
|
}
|
|
26805
|
+
var black = (input) => applyStyle(input, { fg: "black" });
|
|
26806
|
+
var red = (input) => applyStyle(input, { fg: "red" });
|
|
26807
|
+
var green = (input) => applyStyle(input, { fg: "green" });
|
|
26808
|
+
var yellow = (input) => applyStyle(input, { fg: "yellow" });
|
|
26809
|
+
var blue = (input) => applyStyle(input, { fg: "blue" });
|
|
26810
|
+
var magenta = (input) => applyStyle(input, { fg: "magenta" });
|
|
26811
|
+
var cyan = (input) => applyStyle(input, { fg: "cyan" });
|
|
26812
|
+
var white = (input) => applyStyle(input, { fg: "white" });
|
|
26813
|
+
var bold = (input) => applyStyle(input, { bold: true });
|
|
26814
|
+
var italic = (input) => applyStyle(input, { italic: true });
|
|
26815
|
+
var underline = (input) => applyStyle(input, { underline: true });
|
|
26816
|
+
var strikethrough = (input) => applyStyle(input, { strikethrough: true });
|
|
26817
|
+
var dim = (input) => applyStyle(input, { dim: true });
|
|
26818
|
+
var reverse = (input) => applyStyle(input, { reverse: true });
|
|
26819
|
+
var blink = (input) => applyStyle(input, { blink: true });
|
|
26536
26820
|
var fg = (color) => (input) => applyStyle(input, { fg: color });
|
|
26821
|
+
var bg = (color) => (input) => applyStyle(input, { bg: color });
|
|
26822
|
+
function t(strings, ...values) {
|
|
26823
|
+
const chunks = [];
|
|
26824
|
+
for (let i = 0; i < strings.length; i++) {
|
|
26825
|
+
const raw = strings[i];
|
|
26826
|
+
if (raw) {
|
|
26827
|
+
chunks.push({
|
|
26828
|
+
__isChunk: true,
|
|
26829
|
+
text: raw,
|
|
26830
|
+
attributes: 0
|
|
26831
|
+
});
|
|
26832
|
+
}
|
|
26833
|
+
const val = values[i];
|
|
26834
|
+
if (typeof val === "object" && "__isChunk" in val) {
|
|
26835
|
+
chunks.push(val);
|
|
26836
|
+
} else if (val !== void 0) {
|
|
26837
|
+
const plainTextStr = String(val);
|
|
26838
|
+
chunks.push({
|
|
26839
|
+
__isChunk: true,
|
|
26840
|
+
text: plainTextStr,
|
|
26841
|
+
attributes: 0
|
|
26842
|
+
});
|
|
26843
|
+
}
|
|
26844
|
+
}
|
|
26845
|
+
return new StyledText(chunks);
|
|
26846
|
+
}
|
|
26537
26847
|
|
|
26538
26848
|
// ../web/src/browser-text-buffer.ts
|
|
26539
26849
|
var BrowserTextBuffer = class _BrowserTextBuffer {
|
|
@@ -27668,6 +27978,40 @@ var BrowserSyntaxStyle = class _BrowserSyntaxStyle {
|
|
|
27668
27978
|
};
|
|
27669
27979
|
|
|
27670
27980
|
// ../web/src/shims/timeline-stub.ts
|
|
27981
|
+
var Timeline = class {
|
|
27982
|
+
isPlaying = false;
|
|
27983
|
+
isComplete = false;
|
|
27984
|
+
duration = 1e3;
|
|
27985
|
+
loop = false;
|
|
27986
|
+
synced = false;
|
|
27987
|
+
currentTime = 0;
|
|
27988
|
+
items = [];
|
|
27989
|
+
subTimelines = [];
|
|
27990
|
+
constructor(_options = {}) {
|
|
27991
|
+
}
|
|
27992
|
+
addStateChangeListener(_listener) {
|
|
27993
|
+
}
|
|
27994
|
+
removeStateChangeListener(_listener) {
|
|
27995
|
+
}
|
|
27996
|
+
add(_target, _options) {
|
|
27997
|
+
return this;
|
|
27998
|
+
}
|
|
27999
|
+
call(_callback) {
|
|
28000
|
+
return this;
|
|
28001
|
+
}
|
|
28002
|
+
play() {
|
|
28003
|
+
this.isPlaying = true;
|
|
28004
|
+
return this;
|
|
28005
|
+
}
|
|
28006
|
+
pause() {
|
|
28007
|
+
this.isPlaying = false;
|
|
28008
|
+
return this;
|
|
28009
|
+
}
|
|
28010
|
+
restart() {
|
|
28011
|
+
}
|
|
28012
|
+
update(_deltaTime) {
|
|
28013
|
+
}
|
|
28014
|
+
};
|
|
27671
28015
|
var TimelineEngine = class {
|
|
27672
28016
|
defaults = { frameRate: 60 };
|
|
27673
28017
|
attach(_renderer) {
|
|
@@ -27684,6 +28028,9 @@ var TimelineEngine = class {
|
|
|
27684
28028
|
}
|
|
27685
28029
|
};
|
|
27686
28030
|
var engine = new TimelineEngine();
|
|
28031
|
+
function createTimeline(options = {}) {
|
|
28032
|
+
return new Timeline(options);
|
|
28033
|
+
}
|
|
27687
28034
|
|
|
27688
28035
|
// ../../opentui/packages/core/src/lib/parse.keypress.ts
|
|
27689
28036
|
var keyName = {
|
|
@@ -30640,8 +30987,8 @@ function renderFontToFrameBuffer(buffer, {
|
|
|
30640
30987
|
text,
|
|
30641
30988
|
x: x2 = 0,
|
|
30642
30989
|
y: y2 = 0,
|
|
30643
|
-
color = [
|
|
30644
|
-
backgroundColor =
|
|
30990
|
+
color = [RGBA2.fromInts(255, 255, 255, 255)],
|
|
30991
|
+
backgroundColor = RGBA2.fromInts(0, 0, 0, 255),
|
|
30645
30992
|
font = "tiny"
|
|
30646
30993
|
}) {
|
|
30647
30994
|
const width = buffer.width;
|
|
@@ -30700,8 +31047,8 @@ function renderFontToFrameBuffer(buffer, {
|
|
|
30700
31047
|
renderX,
|
|
30701
31048
|
renderY,
|
|
30702
31049
|
fontChar,
|
|
30703
|
-
|
|
30704
|
-
|
|
31050
|
+
parseColor2(segmentColor),
|
|
31051
|
+
parseColor2(backgroundColor)
|
|
30705
31052
|
);
|
|
30706
31053
|
}
|
|
30707
31054
|
}
|
|
@@ -30889,6 +31236,23 @@ function detectLinks(chunks, context) {
|
|
|
30889
31236
|
return chunks;
|
|
30890
31237
|
}
|
|
30891
31238
|
|
|
31239
|
+
// ../web/src/shims/renderer-stub.ts
|
|
31240
|
+
var CliRenderEvents = /* @__PURE__ */ ((CliRenderEvents2) => {
|
|
31241
|
+
CliRenderEvents2["DESTROY"] = "destroy";
|
|
31242
|
+
CliRenderEvents2["DEBUG_OVERLAY_TOGGLE"] = "debug_overlay_toggle";
|
|
31243
|
+
return CliRenderEvents2;
|
|
31244
|
+
})(CliRenderEvents || {});
|
|
31245
|
+
var CliRenderer = class extends EventEmitter {
|
|
31246
|
+
root = null;
|
|
31247
|
+
keyInput = new EventEmitter();
|
|
31248
|
+
destroy() {
|
|
31249
|
+
this.emit("destroy" /* DESTROY */);
|
|
31250
|
+
}
|
|
31251
|
+
};
|
|
31252
|
+
function createCliRenderer() {
|
|
31253
|
+
return Promise.resolve(new CliRenderer());
|
|
31254
|
+
}
|
|
31255
|
+
|
|
30892
31256
|
// ../../opentui/packages/core/src/renderables/FrameBuffer.ts
|
|
30893
31257
|
var FrameBufferRenderable = class extends Renderable {
|
|
30894
31258
|
frameBuffer;
|
|
@@ -30955,8 +31319,8 @@ var ASCIIFontRenderable = class _ASCIIFontRenderable extends FrameBufferRenderab
|
|
|
30955
31319
|
this._font = font;
|
|
30956
31320
|
this._color = options.color || defaultOptions.color;
|
|
30957
31321
|
this._backgroundColor = options.backgroundColor || defaultOptions.backgroundColor;
|
|
30958
|
-
this._selectionBg = options.selectionBg ?
|
|
30959
|
-
this._selectionFg = options.selectionFg ?
|
|
31322
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : void 0;
|
|
31323
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : void 0;
|
|
30960
31324
|
this.selectable = options.selectable ?? true;
|
|
30961
31325
|
this.selectionHelper = new ASCIIFontSelectionHelper(
|
|
30962
31326
|
() => this._text,
|
|
@@ -31038,7 +31402,7 @@ var ASCIIFontRenderable = class _ASCIIFontRenderable extends FrameBufferRenderab
|
|
|
31038
31402
|
}
|
|
31039
31403
|
renderFontToBuffer() {
|
|
31040
31404
|
if (this.isDestroyed) return;
|
|
31041
|
-
this.frameBuffer.clear(
|
|
31405
|
+
this.frameBuffer.clear(parseColor2(this._backgroundColor));
|
|
31042
31406
|
renderFontToFrameBuffer(this.frameBuffer, {
|
|
31043
31407
|
text: this._text,
|
|
31044
31408
|
x: 0,
|
|
@@ -31060,7 +31424,7 @@ var ASCIIFontRenderable = class _ASCIIFontRenderable extends FrameBufferRenderab
|
|
|
31060
31424
|
const startX = positions[selection.start] || 0;
|
|
31061
31425
|
const endX = selection.end < positions.length ? positions[selection.end] : measureText({ text: this._text, font: this._font }).width;
|
|
31062
31426
|
if (this._selectionBg) {
|
|
31063
|
-
this.frameBuffer.fillRect(startX, 0, endX - startX, this.height,
|
|
31427
|
+
this.frameBuffer.fillRect(startX, 0, endX - startX, this.height, parseColor2(this._selectionBg));
|
|
31064
31428
|
}
|
|
31065
31429
|
if (this._selectionFg || this._selectionBg) {
|
|
31066
31430
|
renderFontToFrameBuffer(this.frameBuffer, {
|
|
@@ -31111,14 +31475,14 @@ var BoxRenderable = class extends Renderable {
|
|
|
31111
31475
|
if (options.focusable === true) {
|
|
31112
31476
|
this._focusable = true;
|
|
31113
31477
|
}
|
|
31114
|
-
this._backgroundColor =
|
|
31478
|
+
this._backgroundColor = parseColor2(options.backgroundColor || this._defaultOptions.backgroundColor);
|
|
31115
31479
|
this._border = options.border ?? this._defaultOptions.border;
|
|
31116
31480
|
if (!options.border && (options.borderStyle || options.borderColor || options.focusedBorderColor || options.customBorderChars)) {
|
|
31117
31481
|
this._border = true;
|
|
31118
31482
|
}
|
|
31119
31483
|
this._borderStyle = parseBorderStyle(options.borderStyle, this._defaultOptions.borderStyle);
|
|
31120
|
-
this._borderColor =
|
|
31121
|
-
this._focusedBorderColor =
|
|
31484
|
+
this._borderColor = parseColor2(options.borderColor || this._defaultOptions.borderColor);
|
|
31485
|
+
this._focusedBorderColor = parseColor2(options.focusedBorderColor || this._defaultOptions.focusedBorderColor);
|
|
31122
31486
|
this._customBorderCharsObj = options.customBorderChars;
|
|
31123
31487
|
this._customBorderChars = this._customBorderCharsObj ? borderCharsToArray(this._customBorderCharsObj) : void 0;
|
|
31124
31488
|
this.borderSides = getBorderSides(this._border);
|
|
@@ -31150,7 +31514,7 @@ var BoxRenderable = class extends Renderable {
|
|
|
31150
31514
|
return this._backgroundColor;
|
|
31151
31515
|
}
|
|
31152
31516
|
set backgroundColor(value) {
|
|
31153
|
-
const newColor =
|
|
31517
|
+
const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
|
|
31154
31518
|
if (this._backgroundColor !== newColor) {
|
|
31155
31519
|
this._backgroundColor = newColor;
|
|
31156
31520
|
this.requestRender();
|
|
@@ -31183,7 +31547,7 @@ var BoxRenderable = class extends Renderable {
|
|
|
31183
31547
|
return this._borderColor;
|
|
31184
31548
|
}
|
|
31185
31549
|
set borderColor(value) {
|
|
31186
|
-
const newColor =
|
|
31550
|
+
const newColor = parseColor2(value ?? this._defaultOptions.borderColor);
|
|
31187
31551
|
if (this._borderColor !== newColor) {
|
|
31188
31552
|
this._borderColor = newColor;
|
|
31189
31553
|
this.initializeBorder();
|
|
@@ -31194,7 +31558,7 @@ var BoxRenderable = class extends Renderable {
|
|
|
31194
31558
|
return this._focusedBorderColor;
|
|
31195
31559
|
}
|
|
31196
31560
|
set focusedBorderColor(value) {
|
|
31197
|
-
const newColor =
|
|
31561
|
+
const newColor = parseColor2(value ?? this._defaultOptions.focusedBorderColor);
|
|
31198
31562
|
if (this._focusedBorderColor !== newColor) {
|
|
31199
31563
|
this._focusedBorderColor = newColor;
|
|
31200
31564
|
this.initializeBorder();
|
|
@@ -31313,8 +31677,8 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31313
31677
|
textBufferView;
|
|
31314
31678
|
_textBufferSyntaxStyle;
|
|
31315
31679
|
_defaultOptions = {
|
|
31316
|
-
fg:
|
|
31317
|
-
bg:
|
|
31680
|
+
fg: RGBA2.fromValues(1, 1, 1, 1),
|
|
31681
|
+
bg: RGBA2.fromValues(0, 0, 0, 0),
|
|
31318
31682
|
selectionBg: void 0,
|
|
31319
31683
|
selectionFg: void 0,
|
|
31320
31684
|
selectable: true,
|
|
@@ -31326,15 +31690,15 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31326
31690
|
};
|
|
31327
31691
|
constructor(ctx, options) {
|
|
31328
31692
|
super(ctx, options);
|
|
31329
|
-
this._defaultFg =
|
|
31330
|
-
this._defaultBg =
|
|
31693
|
+
this._defaultFg = parseColor2(options.fg ?? this._defaultOptions.fg);
|
|
31694
|
+
this._defaultBg = parseColor2(options.bg ?? this._defaultOptions.bg);
|
|
31331
31695
|
this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
|
|
31332
|
-
this._selectionBg = options.selectionBg ?
|
|
31333
|
-
this._selectionFg = options.selectionFg ?
|
|
31696
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : this._defaultOptions.selectionBg;
|
|
31697
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
31334
31698
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
31335
31699
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
31336
31700
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
31337
|
-
this._tabIndicatorColor = options.tabIndicatorColor ?
|
|
31701
|
+
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
31338
31702
|
this._truncate = options.truncate ?? this._defaultOptions.truncate;
|
|
31339
31703
|
this.textBuffer = BrowserTextBuffer.create(this._ctx.widthMethod);
|
|
31340
31704
|
this.textBufferView = BrowserTextBufferView.create(this.textBuffer);
|
|
@@ -31441,7 +31805,7 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31441
31805
|
return this._defaultFg;
|
|
31442
31806
|
}
|
|
31443
31807
|
set fg(value) {
|
|
31444
|
-
const newColor =
|
|
31808
|
+
const newColor = parseColor2(value ?? this._defaultOptions.fg);
|
|
31445
31809
|
if (this._defaultFg !== newColor) {
|
|
31446
31810
|
this._defaultFg = newColor;
|
|
31447
31811
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
@@ -31453,7 +31817,7 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31453
31817
|
return this._selectionBg;
|
|
31454
31818
|
}
|
|
31455
31819
|
set selectionBg(value) {
|
|
31456
|
-
const newColor = value ?
|
|
31820
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionBg;
|
|
31457
31821
|
if (this._selectionBg !== newColor) {
|
|
31458
31822
|
this._selectionBg = newColor;
|
|
31459
31823
|
if (this.lastLocalSelection) {
|
|
@@ -31466,7 +31830,7 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31466
31830
|
return this._selectionFg;
|
|
31467
31831
|
}
|
|
31468
31832
|
set selectionFg(value) {
|
|
31469
|
-
const newColor = value ?
|
|
31833
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionFg;
|
|
31470
31834
|
if (this._selectionFg !== newColor) {
|
|
31471
31835
|
this._selectionFg = newColor;
|
|
31472
31836
|
if (this.lastLocalSelection) {
|
|
@@ -31479,7 +31843,7 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31479
31843
|
return this._defaultBg;
|
|
31480
31844
|
}
|
|
31481
31845
|
set bg(value) {
|
|
31482
|
-
const newColor =
|
|
31846
|
+
const newColor = parseColor2(value ?? this._defaultOptions.bg);
|
|
31483
31847
|
if (this._defaultBg !== newColor) {
|
|
31484
31848
|
this._defaultBg = newColor;
|
|
31485
31849
|
this.textBuffer.setDefaultBg(this._defaultBg);
|
|
@@ -31528,7 +31892,7 @@ var TextBufferRenderable = class extends Renderable {
|
|
|
31528
31892
|
return this._tabIndicatorColor;
|
|
31529
31893
|
}
|
|
31530
31894
|
set tabIndicatorColor(value) {
|
|
31531
|
-
const newColor = value ?
|
|
31895
|
+
const newColor = value ? parseColor2(value) : void 0;
|
|
31532
31896
|
if (this._tabIndicatorColor !== newColor) {
|
|
31533
31897
|
this._tabIndicatorColor = newColor;
|
|
31534
31898
|
if (newColor !== void 0) {
|
|
@@ -31970,8 +32334,8 @@ var TextNodeRenderable = class _TextNodeRenderable extends BaseRenderable {
|
|
|
31970
32334
|
parent = null;
|
|
31971
32335
|
constructor(options) {
|
|
31972
32336
|
super(options);
|
|
31973
|
-
this._fg = options.fg ?
|
|
31974
|
-
this._bg = options.bg ?
|
|
32337
|
+
this._fg = options.fg ? parseColor2(options.fg) : void 0;
|
|
32338
|
+
this._bg = options.bg ? parseColor2(options.bg) : void 0;
|
|
31975
32339
|
this._attributes = options.attributes ?? 0;
|
|
31976
32340
|
this._link = options.link;
|
|
31977
32341
|
}
|
|
@@ -32145,7 +32509,7 @@ var TextNodeRenderable = class _TextNodeRenderable extends BaseRenderable {
|
|
|
32145
32509
|
this.requestRender();
|
|
32146
32510
|
return;
|
|
32147
32511
|
}
|
|
32148
|
-
this._fg =
|
|
32512
|
+
this._fg = parseColor2(fg2);
|
|
32149
32513
|
this.requestRender();
|
|
32150
32514
|
}
|
|
32151
32515
|
set bg(bg2) {
|
|
@@ -32154,7 +32518,7 @@ var TextNodeRenderable = class _TextNodeRenderable extends BaseRenderable {
|
|
|
32154
32518
|
this.requestRender();
|
|
32155
32519
|
return;
|
|
32156
32520
|
}
|
|
32157
|
-
this._bg =
|
|
32521
|
+
this._bg = parseColor2(bg2);
|
|
32158
32522
|
this.requestRender();
|
|
32159
32523
|
}
|
|
32160
32524
|
get bg() {
|
|
@@ -32362,7 +32726,7 @@ var GutterRenderable = class extends Renderable {
|
|
|
32362
32726
|
const beforeWidth = Bun.stringWidth(sign.before);
|
|
32363
32727
|
const padding = this._maxBeforeWidth - beforeWidth;
|
|
32364
32728
|
currentX += padding;
|
|
32365
|
-
const beforeColor = sign.beforeColor ?
|
|
32729
|
+
const beforeColor = sign.beforeColor ? parseColor2(sign.beforeColor) : this._fg;
|
|
32366
32730
|
buffer.drawText(sign.before, currentX, startY + i, beforeColor, lineBg);
|
|
32367
32731
|
currentX += beforeWidth;
|
|
32368
32732
|
} else if (this._maxBeforeWidth > 0) {
|
|
@@ -32381,7 +32745,7 @@ var GutterRenderable = class extends Renderable {
|
|
|
32381
32745
|
}
|
|
32382
32746
|
if (sign?.after) {
|
|
32383
32747
|
const afterX = startX + this.width - this._paddingRight - this._maxAfterWidth;
|
|
32384
|
-
const afterColor = sign.afterColor ?
|
|
32748
|
+
const afterColor = sign.afterColor ? parseColor2(sign.afterColor) : this._fg;
|
|
32385
32749
|
buffer.drawText(sign.after, afterX, startY + i, afterColor, lineBg);
|
|
32386
32750
|
}
|
|
32387
32751
|
}
|
|
@@ -32390,7 +32754,7 @@ var GutterRenderable = class extends Renderable {
|
|
|
32390
32754
|
}
|
|
32391
32755
|
};
|
|
32392
32756
|
function darkenColor(color) {
|
|
32393
|
-
return
|
|
32757
|
+
return RGBA2.fromValues(color.r * 0.8, color.g * 0.8, color.b * 0.8, color.a);
|
|
32394
32758
|
}
|
|
32395
32759
|
var LineNumberRenderable = class extends Renderable {
|
|
32396
32760
|
gutter = null;
|
|
@@ -32414,15 +32778,15 @@ var LineNumberRenderable = class extends Renderable {
|
|
|
32414
32778
|
if (typeof color === "object" && "gutter" in color) {
|
|
32415
32779
|
const config = color;
|
|
32416
32780
|
if (config.gutter) {
|
|
32417
|
-
this._lineColorsGutter.set(line,
|
|
32781
|
+
this._lineColorsGutter.set(line, parseColor2(config.gutter));
|
|
32418
32782
|
}
|
|
32419
32783
|
if (config.content) {
|
|
32420
|
-
this._lineColorsContent.set(line,
|
|
32784
|
+
this._lineColorsContent.set(line, parseColor2(config.content));
|
|
32421
32785
|
} else if (config.gutter) {
|
|
32422
|
-
this._lineColorsContent.set(line, darkenColor(
|
|
32786
|
+
this._lineColorsContent.set(line, darkenColor(parseColor2(config.gutter)));
|
|
32423
32787
|
}
|
|
32424
32788
|
} else {
|
|
32425
|
-
const parsedColor =
|
|
32789
|
+
const parsedColor = parseColor2(color);
|
|
32426
32790
|
this._lineColorsGutter.set(line, parsedColor);
|
|
32427
32791
|
this._lineColorsContent.set(line, darkenColor(parsedColor));
|
|
32428
32792
|
}
|
|
@@ -32435,8 +32799,8 @@ var LineNumberRenderable = class extends Renderable {
|
|
|
32435
32799
|
// By forcing height=auto, we ensure the parent box properly accounts for our full height.
|
|
32436
32800
|
height: "auto"
|
|
32437
32801
|
});
|
|
32438
|
-
this._fg =
|
|
32439
|
-
this._bg =
|
|
32802
|
+
this._fg = parseColor2(options.fg ?? "#888888");
|
|
32803
|
+
this._bg = parseColor2(options.bg ?? "transparent");
|
|
32440
32804
|
this._minWidth = options.minWidth ?? 3;
|
|
32441
32805
|
this._paddingRight = options.paddingRight ?? 1;
|
|
32442
32806
|
this._lineNumberOffset = options.lineNumberOffset ?? 0;
|
|
@@ -32930,27 +33294,27 @@ var DiffRenderable = class extends Renderable {
|
|
|
32930
33294
|
});
|
|
32931
33295
|
this._diff = options.diff ?? "";
|
|
32932
33296
|
this._view = options.view ?? "unified";
|
|
32933
|
-
this._fg = options.fg ?
|
|
33297
|
+
this._fg = options.fg ? parseColor2(options.fg) : void 0;
|
|
32934
33298
|
this._filetype = options.filetype;
|
|
32935
33299
|
this._syntaxStyle = options.syntaxStyle;
|
|
32936
33300
|
this._wrapMode = options.wrapMode;
|
|
32937
33301
|
this._conceal = options.conceal ?? false;
|
|
32938
|
-
this._selectionBg = options.selectionBg ?
|
|
32939
|
-
this._selectionFg = options.selectionFg ?
|
|
33302
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : void 0;
|
|
33303
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : void 0;
|
|
32940
33304
|
this._treeSitterClient = options.treeSitterClient;
|
|
32941
33305
|
this._showLineNumbers = options.showLineNumbers ?? true;
|
|
32942
|
-
this._lineNumberFg =
|
|
32943
|
-
this._lineNumberBg =
|
|
32944
|
-
this._addedBg =
|
|
32945
|
-
this._removedBg =
|
|
32946
|
-
this._contextBg =
|
|
32947
|
-
this._addedContentBg = options.addedContentBg ?
|
|
32948
|
-
this._removedContentBg = options.removedContentBg ?
|
|
32949
|
-
this._contextContentBg = options.contextContentBg ?
|
|
32950
|
-
this._addedSignColor =
|
|
32951
|
-
this._removedSignColor =
|
|
32952
|
-
this._addedLineNumberBg =
|
|
32953
|
-
this._removedLineNumberBg =
|
|
33306
|
+
this._lineNumberFg = parseColor2(options.lineNumberFg ?? "#888888");
|
|
33307
|
+
this._lineNumberBg = parseColor2(options.lineNumberBg ?? "transparent");
|
|
33308
|
+
this._addedBg = parseColor2(options.addedBg ?? "#1a4d1a");
|
|
33309
|
+
this._removedBg = parseColor2(options.removedBg ?? "#4d1a1a");
|
|
33310
|
+
this._contextBg = parseColor2(options.contextBg ?? "transparent");
|
|
33311
|
+
this._addedContentBg = options.addedContentBg ? parseColor2(options.addedContentBg) : null;
|
|
33312
|
+
this._removedContentBg = options.removedContentBg ? parseColor2(options.removedContentBg) : null;
|
|
33313
|
+
this._contextContentBg = options.contextContentBg ? parseColor2(options.contextContentBg) : null;
|
|
33314
|
+
this._addedSignColor = parseColor2(options.addedSignColor ?? "#22c55e");
|
|
33315
|
+
this._removedSignColor = parseColor2(options.removedSignColor ?? "#ef4444");
|
|
33316
|
+
this._addedLineNumberBg = parseColor2(options.addedLineNumberBg ?? "transparent");
|
|
33317
|
+
this._removedLineNumberBg = parseColor2(options.removedLineNumberBg ?? "transparent");
|
|
32954
33318
|
if (this._diff) {
|
|
32955
33319
|
this.parseDiff();
|
|
32956
33320
|
this.buildView();
|
|
@@ -33638,7 +34002,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33638
34002
|
return this._addedBg;
|
|
33639
34003
|
}
|
|
33640
34004
|
set addedBg(value) {
|
|
33641
|
-
const parsed =
|
|
34005
|
+
const parsed = parseColor2(value);
|
|
33642
34006
|
if (this._addedBg !== parsed) {
|
|
33643
34007
|
this._addedBg = parsed;
|
|
33644
34008
|
this.rebuildView();
|
|
@@ -33648,7 +34012,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33648
34012
|
return this._removedBg;
|
|
33649
34013
|
}
|
|
33650
34014
|
set removedBg(value) {
|
|
33651
|
-
const parsed =
|
|
34015
|
+
const parsed = parseColor2(value);
|
|
33652
34016
|
if (this._removedBg !== parsed) {
|
|
33653
34017
|
this._removedBg = parsed;
|
|
33654
34018
|
this.rebuildView();
|
|
@@ -33658,7 +34022,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33658
34022
|
return this._contextBg;
|
|
33659
34023
|
}
|
|
33660
34024
|
set contextBg(value) {
|
|
33661
|
-
const parsed =
|
|
34025
|
+
const parsed = parseColor2(value);
|
|
33662
34026
|
if (this._contextBg !== parsed) {
|
|
33663
34027
|
this._contextBg = parsed;
|
|
33664
34028
|
this.rebuildView();
|
|
@@ -33668,7 +34032,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33668
34032
|
return this._addedSignColor;
|
|
33669
34033
|
}
|
|
33670
34034
|
set addedSignColor(value) {
|
|
33671
|
-
const parsed =
|
|
34035
|
+
const parsed = parseColor2(value);
|
|
33672
34036
|
if (this._addedSignColor !== parsed) {
|
|
33673
34037
|
this._addedSignColor = parsed;
|
|
33674
34038
|
this.rebuildView();
|
|
@@ -33678,7 +34042,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33678
34042
|
return this._removedSignColor;
|
|
33679
34043
|
}
|
|
33680
34044
|
set removedSignColor(value) {
|
|
33681
|
-
const parsed =
|
|
34045
|
+
const parsed = parseColor2(value);
|
|
33682
34046
|
if (this._removedSignColor !== parsed) {
|
|
33683
34047
|
this._removedSignColor = parsed;
|
|
33684
34048
|
this.rebuildView();
|
|
@@ -33688,7 +34052,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33688
34052
|
return this._addedLineNumberBg;
|
|
33689
34053
|
}
|
|
33690
34054
|
set addedLineNumberBg(value) {
|
|
33691
|
-
const parsed =
|
|
34055
|
+
const parsed = parseColor2(value);
|
|
33692
34056
|
if (this._addedLineNumberBg !== parsed) {
|
|
33693
34057
|
this._addedLineNumberBg = parsed;
|
|
33694
34058
|
this.rebuildView();
|
|
@@ -33698,7 +34062,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33698
34062
|
return this._removedLineNumberBg;
|
|
33699
34063
|
}
|
|
33700
34064
|
set removedLineNumberBg(value) {
|
|
33701
|
-
const parsed =
|
|
34065
|
+
const parsed = parseColor2(value);
|
|
33702
34066
|
if (this._removedLineNumberBg !== parsed) {
|
|
33703
34067
|
this._removedLineNumberBg = parsed;
|
|
33704
34068
|
this.rebuildView();
|
|
@@ -33708,7 +34072,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33708
34072
|
return this._lineNumberFg;
|
|
33709
34073
|
}
|
|
33710
34074
|
set lineNumberFg(value) {
|
|
33711
|
-
const parsed =
|
|
34075
|
+
const parsed = parseColor2(value);
|
|
33712
34076
|
if (this._lineNumberFg !== parsed) {
|
|
33713
34077
|
this._lineNumberFg = parsed;
|
|
33714
34078
|
this.rebuildView();
|
|
@@ -33718,7 +34082,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33718
34082
|
return this._lineNumberBg;
|
|
33719
34083
|
}
|
|
33720
34084
|
set lineNumberBg(value) {
|
|
33721
|
-
const parsed =
|
|
34085
|
+
const parsed = parseColor2(value);
|
|
33722
34086
|
if (this._lineNumberBg !== parsed) {
|
|
33723
34087
|
this._lineNumberBg = parsed;
|
|
33724
34088
|
this.rebuildView();
|
|
@@ -33728,7 +34092,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33728
34092
|
return this._addedContentBg;
|
|
33729
34093
|
}
|
|
33730
34094
|
set addedContentBg(value) {
|
|
33731
|
-
const parsed = value ?
|
|
34095
|
+
const parsed = value ? parseColor2(value) : null;
|
|
33732
34096
|
if (this._addedContentBg !== parsed) {
|
|
33733
34097
|
this._addedContentBg = parsed;
|
|
33734
34098
|
this.rebuildView();
|
|
@@ -33738,7 +34102,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33738
34102
|
return this._removedContentBg;
|
|
33739
34103
|
}
|
|
33740
34104
|
set removedContentBg(value) {
|
|
33741
|
-
const parsed = value ?
|
|
34105
|
+
const parsed = value ? parseColor2(value) : null;
|
|
33742
34106
|
if (this._removedContentBg !== parsed) {
|
|
33743
34107
|
this._removedContentBg = parsed;
|
|
33744
34108
|
this.rebuildView();
|
|
@@ -33748,7 +34112,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33748
34112
|
return this._contextContentBg;
|
|
33749
34113
|
}
|
|
33750
34114
|
set contextContentBg(value) {
|
|
33751
|
-
const parsed = value ?
|
|
34115
|
+
const parsed = value ? parseColor2(value) : null;
|
|
33752
34116
|
if (this._contextContentBg !== parsed) {
|
|
33753
34117
|
this._contextContentBg = parsed;
|
|
33754
34118
|
this.rebuildView();
|
|
@@ -33758,7 +34122,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33758
34122
|
return this._selectionBg;
|
|
33759
34123
|
}
|
|
33760
34124
|
set selectionBg(value) {
|
|
33761
|
-
const parsed = value ?
|
|
34125
|
+
const parsed = value ? parseColor2(value) : void 0;
|
|
33762
34126
|
if (this._selectionBg !== parsed) {
|
|
33763
34127
|
this._selectionBg = parsed;
|
|
33764
34128
|
if (this.leftCodeRenderable) {
|
|
@@ -33773,7 +34137,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33773
34137
|
return this._selectionFg;
|
|
33774
34138
|
}
|
|
33775
34139
|
set selectionFg(value) {
|
|
33776
|
-
const parsed = value ?
|
|
34140
|
+
const parsed = value ? parseColor2(value) : void 0;
|
|
33777
34141
|
if (this._selectionFg !== parsed) {
|
|
33778
34142
|
this._selectionFg = parsed;
|
|
33779
34143
|
if (this.leftCodeRenderable) {
|
|
@@ -33797,7 +34161,7 @@ var DiffRenderable = class extends Renderable {
|
|
|
33797
34161
|
return this._fg;
|
|
33798
34162
|
}
|
|
33799
34163
|
set fg(value) {
|
|
33800
|
-
const parsed = value ?
|
|
34164
|
+
const parsed = value ? parseColor2(value) : void 0;
|
|
33801
34165
|
if (this._fg !== parsed) {
|
|
33802
34166
|
this._fg = parsed;
|
|
33803
34167
|
if (this.leftCodeRenderable) {
|
|
@@ -33860,7 +34224,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
33860
34224
|
editBuffer;
|
|
33861
34225
|
editorView;
|
|
33862
34226
|
_defaultOptions = {
|
|
33863
|
-
textColor:
|
|
34227
|
+
textColor: RGBA2.fromValues(1, 1, 1, 1),
|
|
33864
34228
|
backgroundColor: "transparent",
|
|
33865
34229
|
selectionBg: void 0,
|
|
33866
34230
|
selectionFg: void 0,
|
|
@@ -33870,7 +34234,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
33870
34234
|
scrollMargin: 0.2,
|
|
33871
34235
|
scrollSpeed: 16,
|
|
33872
34236
|
showCursor: true,
|
|
33873
|
-
cursorColor:
|
|
34237
|
+
cursorColor: RGBA2.fromValues(1, 1, 1, 1),
|
|
33874
34238
|
cursorStyle: {
|
|
33875
34239
|
style: "block",
|
|
33876
34240
|
blinking: true
|
|
@@ -33880,20 +34244,20 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
33880
34244
|
};
|
|
33881
34245
|
constructor(ctx, options) {
|
|
33882
34246
|
super(ctx, options);
|
|
33883
|
-
this._textColor =
|
|
33884
|
-
this._backgroundColor =
|
|
34247
|
+
this._textColor = parseColor2(options.textColor ?? this._defaultOptions.textColor);
|
|
34248
|
+
this._backgroundColor = parseColor2(options.backgroundColor ?? this._defaultOptions.backgroundColor);
|
|
33885
34249
|
this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
|
|
33886
|
-
this._selectionBg = options.selectionBg ?
|
|
33887
|
-
this._selectionFg = options.selectionFg ?
|
|
34250
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : this._defaultOptions.selectionBg;
|
|
34251
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
|
|
33888
34252
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
33889
34253
|
this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
|
|
33890
34254
|
this._scrollMargin = options.scrollMargin ?? this._defaultOptions.scrollMargin;
|
|
33891
34255
|
this._scrollSpeed = options.scrollSpeed ?? this._defaultOptions.scrollSpeed;
|
|
33892
34256
|
this._showCursor = options.showCursor ?? this._defaultOptions.showCursor;
|
|
33893
|
-
this._cursorColor =
|
|
34257
|
+
this._cursorColor = parseColor2(options.cursorColor ?? this._defaultOptions.cursorColor);
|
|
33894
34258
|
this._cursorStyle = options.cursorStyle ?? this._defaultOptions.cursorStyle;
|
|
33895
34259
|
this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
|
|
33896
|
-
this._tabIndicatorColor = options.tabIndicatorColor ?
|
|
34260
|
+
this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
|
|
33897
34261
|
this.editBuffer = EditBuffer.create(this._ctx.widthMethod);
|
|
33898
34262
|
this.editorView = EditorView.create(this.editBuffer, this.width || 80, this.height || 24);
|
|
33899
34263
|
this.editorView.setWrapMode(this._wrapMode);
|
|
@@ -33966,7 +34330,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
33966
34330
|
return this._textColor;
|
|
33967
34331
|
}
|
|
33968
34332
|
set textColor(value) {
|
|
33969
|
-
const newColor =
|
|
34333
|
+
const newColor = parseColor2(value ?? this._defaultOptions.textColor);
|
|
33970
34334
|
if (this._textColor !== newColor) {
|
|
33971
34335
|
this._textColor = newColor;
|
|
33972
34336
|
this.editBuffer.setDefaultFg(newColor);
|
|
@@ -33977,7 +34341,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
33977
34341
|
return this._selectionBg;
|
|
33978
34342
|
}
|
|
33979
34343
|
set selectionBg(value) {
|
|
33980
|
-
const newColor = value ?
|
|
34344
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionBg;
|
|
33981
34345
|
if (this._selectionBg !== newColor) {
|
|
33982
34346
|
this._selectionBg = newColor;
|
|
33983
34347
|
if (this.lastLocalSelection) {
|
|
@@ -33990,7 +34354,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
33990
34354
|
return this._selectionFg;
|
|
33991
34355
|
}
|
|
33992
34356
|
set selectionFg(value) {
|
|
33993
|
-
const newColor = value ?
|
|
34357
|
+
const newColor = value ? parseColor2(value) : this._defaultOptions.selectionFg;
|
|
33994
34358
|
if (this._selectionFg !== newColor) {
|
|
33995
34359
|
this._selectionFg = newColor;
|
|
33996
34360
|
if (this.lastLocalSelection) {
|
|
@@ -34003,7 +34367,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
34003
34367
|
return this._backgroundColor;
|
|
34004
34368
|
}
|
|
34005
34369
|
set backgroundColor(value) {
|
|
34006
|
-
const newColor =
|
|
34370
|
+
const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
|
|
34007
34371
|
if (this._backgroundColor !== newColor) {
|
|
34008
34372
|
this._backgroundColor = newColor;
|
|
34009
34373
|
this.editBuffer.setDefaultBg(newColor);
|
|
@@ -34047,7 +34411,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
34047
34411
|
return this._cursorColor;
|
|
34048
34412
|
}
|
|
34049
34413
|
set cursorColor(value) {
|
|
34050
|
-
const newColor =
|
|
34414
|
+
const newColor = parseColor2(value);
|
|
34051
34415
|
if (this._cursorColor !== newColor) {
|
|
34052
34416
|
this._cursorColor = newColor;
|
|
34053
34417
|
if (this._focused) {
|
|
@@ -34083,7 +34447,7 @@ var EditBufferRenderable = class extends Renderable {
|
|
|
34083
34447
|
return this._tabIndicatorColor;
|
|
34084
34448
|
}
|
|
34085
34449
|
set tabIndicatorColor(value) {
|
|
34086
|
-
const newColor = value ?
|
|
34450
|
+
const newColor = value ? parseColor2(value) : void 0;
|
|
34087
34451
|
if (this._tabIndicatorColor !== newColor) {
|
|
34088
34452
|
this._tabIndicatorColor = newColor;
|
|
34089
34453
|
if (newColor !== void 0) {
|
|
@@ -34557,14 +34921,14 @@ var TextareaRenderable = class _TextareaRenderable extends EditBufferRenderable
|
|
|
34557
34921
|
textColor: options.textColor || defaults.textColor
|
|
34558
34922
|
};
|
|
34559
34923
|
super(ctx, baseOptions);
|
|
34560
|
-
this._unfocusedBackgroundColor =
|
|
34561
|
-
this._unfocusedTextColor =
|
|
34562
|
-
this._focusedBackgroundColor =
|
|
34924
|
+
this._unfocusedBackgroundColor = parseColor2(options.backgroundColor || defaults.backgroundColor);
|
|
34925
|
+
this._unfocusedTextColor = parseColor2(options.textColor || defaults.textColor);
|
|
34926
|
+
this._focusedBackgroundColor = parseColor2(
|
|
34563
34927
|
options.focusedBackgroundColor || options.backgroundColor || defaults.focusedBackgroundColor
|
|
34564
34928
|
);
|
|
34565
|
-
this._focusedTextColor =
|
|
34929
|
+
this._focusedTextColor = parseColor2(options.focusedTextColor || options.textColor || defaults.focusedTextColor);
|
|
34566
34930
|
this._placeholder = options.placeholder ?? defaults.placeholder;
|
|
34567
|
-
this._placeholderColor =
|
|
34931
|
+
this._placeholderColor = parseColor2(options.placeholderColor ?? defaults.placeholderColor);
|
|
34568
34932
|
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
34569
34933
|
this._keyBindings = options.keyBindings || [];
|
|
34570
34934
|
const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
|
|
@@ -34946,7 +35310,7 @@ var TextareaRenderable = class _TextareaRenderable extends EditBufferRenderable
|
|
|
34946
35310
|
return this._placeholderColor;
|
|
34947
35311
|
}
|
|
34948
35312
|
set placeholderColor(value) {
|
|
34949
|
-
const newColor =
|
|
35313
|
+
const newColor = parseColor2(value ?? _TextareaRenderable.defaults.placeholderColor);
|
|
34950
35314
|
if (this._placeholderColor !== newColor) {
|
|
34951
35315
|
this._placeholderColor = newColor;
|
|
34952
35316
|
this.applyPlaceholder(this._placeholder);
|
|
@@ -34957,7 +35321,7 @@ var TextareaRenderable = class _TextareaRenderable extends EditBufferRenderable
|
|
|
34957
35321
|
return this._unfocusedBackgroundColor;
|
|
34958
35322
|
}
|
|
34959
35323
|
set backgroundColor(value) {
|
|
34960
|
-
const newColor =
|
|
35324
|
+
const newColor = parseColor2(value ?? _TextareaRenderable.defaults.backgroundColor);
|
|
34961
35325
|
if (this._unfocusedBackgroundColor !== newColor) {
|
|
34962
35326
|
this._unfocusedBackgroundColor = newColor;
|
|
34963
35327
|
this.updateColors();
|
|
@@ -34967,21 +35331,21 @@ var TextareaRenderable = class _TextareaRenderable extends EditBufferRenderable
|
|
|
34967
35331
|
return this._unfocusedTextColor;
|
|
34968
35332
|
}
|
|
34969
35333
|
set textColor(value) {
|
|
34970
|
-
const newColor =
|
|
35334
|
+
const newColor = parseColor2(value ?? _TextareaRenderable.defaults.textColor);
|
|
34971
35335
|
if (this._unfocusedTextColor !== newColor) {
|
|
34972
35336
|
this._unfocusedTextColor = newColor;
|
|
34973
35337
|
this.updateColors();
|
|
34974
35338
|
}
|
|
34975
35339
|
}
|
|
34976
35340
|
set focusedBackgroundColor(value) {
|
|
34977
|
-
const newColor =
|
|
35341
|
+
const newColor = parseColor2(value ?? _TextareaRenderable.defaults.focusedBackgroundColor);
|
|
34978
35342
|
if (this._focusedBackgroundColor !== newColor) {
|
|
34979
35343
|
this._focusedBackgroundColor = newColor;
|
|
34980
35344
|
this.updateColors();
|
|
34981
35345
|
}
|
|
34982
35346
|
}
|
|
34983
35347
|
set focusedTextColor(value) {
|
|
34984
|
-
const newColor =
|
|
35348
|
+
const newColor = parseColor2(value ?? _TextareaRenderable.defaults.focusedTextColor);
|
|
34985
35349
|
if (this._focusedTextColor !== newColor) {
|
|
34986
35350
|
this._focusedTextColor = newColor;
|
|
34987
35351
|
this.updateColors();
|
|
@@ -35021,6 +35385,12 @@ var TextareaRenderable = class _TextareaRenderable extends EditBufferRenderable
|
|
|
35021
35385
|
};
|
|
35022
35386
|
|
|
35023
35387
|
// ../../opentui/packages/core/src/renderables/Input.ts
|
|
35388
|
+
var InputRenderableEvents = /* @__PURE__ */ ((InputRenderableEvents2) => {
|
|
35389
|
+
InputRenderableEvents2["INPUT"] = "input";
|
|
35390
|
+
InputRenderableEvents2["CHANGE"] = "change";
|
|
35391
|
+
InputRenderableEvents2["ENTER"] = "enter";
|
|
35392
|
+
return InputRenderableEvents2;
|
|
35393
|
+
})(InputRenderableEvents || {});
|
|
35024
35394
|
var InputRenderable = class _InputRenderable extends TextareaRenderable {
|
|
35025
35395
|
_maxLength;
|
|
35026
35396
|
_lastCommittedValue = "";
|
|
@@ -36434,16 +36804,16 @@ var TextTableRenderable = class extends Renderable {
|
|
|
36434
36804
|
this._hasExplicitOuterBorder = options.outerBorder !== void 0;
|
|
36435
36805
|
this._outerBorder = options.outerBorder ?? this._border;
|
|
36436
36806
|
this.selectable = options.selectable ?? this._defaultOptions.selectable;
|
|
36437
|
-
this._selectionBg = options.selectionBg ?
|
|
36438
|
-
this._selectionFg = options.selectionFg ?
|
|
36807
|
+
this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : void 0;
|
|
36808
|
+
this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : void 0;
|
|
36439
36809
|
this._borderStyle = parseBorderStyle(options.borderStyle, this._defaultOptions.borderStyle);
|
|
36440
|
-
this._borderColor =
|
|
36441
|
-
this._borderBackgroundColor =
|
|
36810
|
+
this._borderColor = parseColor2(options.borderColor ?? this._defaultOptions.borderColor);
|
|
36811
|
+
this._borderBackgroundColor = parseColor2(
|
|
36442
36812
|
options.borderBackgroundColor ?? this._defaultOptions.borderBackgroundColor
|
|
36443
36813
|
);
|
|
36444
|
-
this._backgroundColor =
|
|
36445
|
-
this._defaultFg =
|
|
36446
|
-
this._defaultBg =
|
|
36814
|
+
this._backgroundColor = parseColor2(options.backgroundColor ?? this._defaultOptions.backgroundColor);
|
|
36815
|
+
this._defaultFg = parseColor2(options.fg ?? this._defaultOptions.fg);
|
|
36816
|
+
this._defaultBg = parseColor2(options.bg ?? this._defaultOptions.bg);
|
|
36447
36817
|
this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
|
|
36448
36818
|
this.setupMeasureFunc();
|
|
36449
36819
|
this.rebuildCells();
|
|
@@ -36535,7 +36905,7 @@ var TextTableRenderable = class extends Renderable {
|
|
|
36535
36905
|
return this._borderColor;
|
|
36536
36906
|
}
|
|
36537
36907
|
set borderColor(value) {
|
|
36538
|
-
const next =
|
|
36908
|
+
const next = parseColor2(value);
|
|
36539
36909
|
if (this._borderColor === next) return;
|
|
36540
36910
|
this._borderColor = next;
|
|
36541
36911
|
this.invalidateRasterOnly();
|
|
@@ -38204,8 +38574,8 @@ var MarkdownRenderable = class extends Renderable {
|
|
|
38204
38574
|
};
|
|
38205
38575
|
|
|
38206
38576
|
// ../../opentui/packages/core/src/renderables/Slider.ts
|
|
38207
|
-
var defaultThumbBackgroundColor =
|
|
38208
|
-
var defaultTrackBackgroundColor =
|
|
38577
|
+
var defaultThumbBackgroundColor = RGBA2.fromHex("#9a9ea3");
|
|
38578
|
+
var defaultTrackBackgroundColor = RGBA2.fromHex("#252527");
|
|
38209
38579
|
var SliderRenderable = class extends Renderable {
|
|
38210
38580
|
orientation;
|
|
38211
38581
|
_value;
|
|
@@ -38223,8 +38593,8 @@ var SliderRenderable = class extends Renderable {
|
|
|
38223
38593
|
this._value = options.value ?? this._min;
|
|
38224
38594
|
this._viewPortSize = options.viewPortSize ?? Math.max(1, (this._max - this._min) * 0.1);
|
|
38225
38595
|
this._onChange = options.onChange;
|
|
38226
|
-
this._backgroundColor = options.backgroundColor ?
|
|
38227
|
-
this._foregroundColor = options.foregroundColor ?
|
|
38596
|
+
this._backgroundColor = options.backgroundColor ? parseColor2(options.backgroundColor) : defaultTrackBackgroundColor;
|
|
38597
|
+
this._foregroundColor = options.foregroundColor ? parseColor2(options.foregroundColor) : defaultThumbBackgroundColor;
|
|
38228
38598
|
this.setupMouseHandling();
|
|
38229
38599
|
}
|
|
38230
38600
|
get value() {
|
|
@@ -38277,14 +38647,14 @@ var SliderRenderable = class extends Renderable {
|
|
|
38277
38647
|
return this._backgroundColor;
|
|
38278
38648
|
}
|
|
38279
38649
|
set backgroundColor(value) {
|
|
38280
|
-
this._backgroundColor =
|
|
38650
|
+
this._backgroundColor = parseColor2(value);
|
|
38281
38651
|
this.requestRender();
|
|
38282
38652
|
}
|
|
38283
38653
|
get foregroundColor() {
|
|
38284
38654
|
return this._foregroundColor;
|
|
38285
38655
|
}
|
|
38286
38656
|
set foregroundColor(value) {
|
|
38287
|
-
this._foregroundColor =
|
|
38657
|
+
this._foregroundColor = parseColor2(value);
|
|
38288
38658
|
this.requestRender();
|
|
38289
38659
|
}
|
|
38290
38660
|
calculateDragOffsetVirtual(event) {
|
|
@@ -38698,8 +39068,8 @@ var ArrowRenderable = class extends Renderable {
|
|
|
38698
39068
|
constructor(ctx, options) {
|
|
38699
39069
|
super(ctx, options);
|
|
38700
39070
|
this._direction = options.direction;
|
|
38701
|
-
this._foregroundColor = options.foregroundColor ?
|
|
38702
|
-
this._backgroundColor = options.backgroundColor ?
|
|
39071
|
+
this._foregroundColor = options.foregroundColor ? parseColor2(options.foregroundColor) : RGBA2.fromValues(1, 1, 1, 1);
|
|
39072
|
+
this._backgroundColor = options.backgroundColor ? parseColor2(options.backgroundColor) : RGBA2.fromValues(0, 0, 0, 0);
|
|
38703
39073
|
this._attributes = options.attributes ?? 0;
|
|
38704
39074
|
this._arrowChars = {
|
|
38705
39075
|
up: "\u25B2",
|
|
@@ -38726,7 +39096,7 @@ var ArrowRenderable = class extends Renderable {
|
|
|
38726
39096
|
}
|
|
38727
39097
|
set foregroundColor(value) {
|
|
38728
39098
|
if (this._foregroundColor !== value) {
|
|
38729
|
-
this._foregroundColor =
|
|
39099
|
+
this._foregroundColor = parseColor2(value);
|
|
38730
39100
|
this.requestRender();
|
|
38731
39101
|
}
|
|
38732
39102
|
}
|
|
@@ -38735,7 +39105,7 @@ var ArrowRenderable = class extends Renderable {
|
|
|
38735
39105
|
}
|
|
38736
39106
|
set backgroundColor(value) {
|
|
38737
39107
|
if (this._backgroundColor !== value) {
|
|
38738
|
-
this._backgroundColor =
|
|
39108
|
+
this._backgroundColor = parseColor2(value);
|
|
38739
39109
|
this.requestRender();
|
|
38740
39110
|
}
|
|
38741
39111
|
}
|
|
@@ -39531,6 +39901,11 @@ var defaultSelectKeybindings = [
|
|
|
39531
39901
|
{ name: "return", action: "select-current" },
|
|
39532
39902
|
{ name: "linefeed", action: "select-current" }
|
|
39533
39903
|
];
|
|
39904
|
+
var SelectRenderableEvents = /* @__PURE__ */ ((SelectRenderableEvents2) => {
|
|
39905
|
+
SelectRenderableEvents2["SELECTION_CHANGED"] = "selectionChanged";
|
|
39906
|
+
SelectRenderableEvents2["ITEM_SELECTED"] = "itemSelected";
|
|
39907
|
+
return SelectRenderableEvents2;
|
|
39908
|
+
})(SelectRenderableEvents || {});
|
|
39534
39909
|
var SelectRenderable = class extends Renderable {
|
|
39535
39910
|
_focusable = true;
|
|
39536
39911
|
_options = [];
|
|
@@ -39577,12 +39952,12 @@ var SelectRenderable = class extends Renderable {
|
|
|
39577
39952
|
this._options = options.options || [];
|
|
39578
39953
|
const requestedIndex = options.selectedIndex ?? this._defaultOptions.selectedIndex;
|
|
39579
39954
|
this._selectedIndex = this._options.length > 0 ? Math.min(requestedIndex, this._options.length - 1) : 0;
|
|
39580
|
-
this._backgroundColor =
|
|
39581
|
-
this._textColor =
|
|
39582
|
-
this._focusedBackgroundColor =
|
|
39955
|
+
this._backgroundColor = parseColor2(options.backgroundColor || this._defaultOptions.backgroundColor);
|
|
39956
|
+
this._textColor = parseColor2(options.textColor || this._defaultOptions.textColor);
|
|
39957
|
+
this._focusedBackgroundColor = parseColor2(
|
|
39583
39958
|
options.focusedBackgroundColor || this._defaultOptions.focusedBackgroundColor
|
|
39584
39959
|
);
|
|
39585
|
-
this._focusedTextColor =
|
|
39960
|
+
this._focusedTextColor = parseColor2(options.focusedTextColor || this._defaultOptions.focusedTextColor);
|
|
39586
39961
|
this._showScrollIndicator = options.showScrollIndicator ?? this._defaultOptions.showScrollIndicator;
|
|
39587
39962
|
this._wrapSelection = options.wrapSelection ?? this._defaultOptions.wrapSelection;
|
|
39588
39963
|
this._showDescription = options.showDescription ?? this._defaultOptions.showDescription;
|
|
@@ -39592,12 +39967,12 @@ var SelectRenderable = class extends Renderable {
|
|
|
39592
39967
|
this.linesPerItem = this._showDescription ? this._font ? this.fontHeight + 1 : 2 : this._font ? this.fontHeight : 1;
|
|
39593
39968
|
this.linesPerItem += this._itemSpacing;
|
|
39594
39969
|
this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
|
|
39595
|
-
this._selectedBackgroundColor =
|
|
39970
|
+
this._selectedBackgroundColor = parseColor2(
|
|
39596
39971
|
options.selectedBackgroundColor || this._defaultOptions.selectedBackgroundColor
|
|
39597
39972
|
);
|
|
39598
|
-
this._selectedTextColor =
|
|
39599
|
-
this._descriptionColor =
|
|
39600
|
-
this._selectedDescriptionColor =
|
|
39973
|
+
this._selectedTextColor = parseColor2(options.selectedTextColor || this._defaultOptions.selectedTextColor);
|
|
39974
|
+
this._descriptionColor = parseColor2(options.descriptionColor || this._defaultOptions.descriptionColor);
|
|
39975
|
+
this._selectedDescriptionColor = parseColor2(
|
|
39601
39976
|
options.selectedDescriptionColor || this._defaultOptions.selectedDescriptionColor
|
|
39602
39977
|
);
|
|
39603
39978
|
this._fastScrollStep = options.fastScrollStep || this._defaultOptions.fastScrollStep;
|
|
@@ -39667,7 +40042,7 @@ var SelectRenderable = class extends Renderable {
|
|
|
39667
40042
|
const indicatorHeight = Math.max(1, contentHeight - 2);
|
|
39668
40043
|
const indicatorY = contentY + 1 + Math.floor(scrollPercent * indicatorHeight);
|
|
39669
40044
|
const indicatorX = contentX + contentWidth - 1;
|
|
39670
|
-
this.frameBuffer.drawText("\u2588", indicatorX, indicatorY,
|
|
40045
|
+
this.frameBuffer.drawText("\u2588", indicatorX, indicatorY, parseColor2("#666666"));
|
|
39671
40046
|
}
|
|
39672
40047
|
get options() {
|
|
39673
40048
|
return this._options;
|
|
@@ -39799,56 +40174,56 @@ var SelectRenderable = class extends Renderable {
|
|
|
39799
40174
|
this._wrapSelection = wrap;
|
|
39800
40175
|
}
|
|
39801
40176
|
set backgroundColor(value) {
|
|
39802
|
-
const newColor =
|
|
40177
|
+
const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
|
|
39803
40178
|
if (this._backgroundColor !== newColor) {
|
|
39804
40179
|
this._backgroundColor = newColor;
|
|
39805
40180
|
this.requestRender();
|
|
39806
40181
|
}
|
|
39807
40182
|
}
|
|
39808
40183
|
set textColor(value) {
|
|
39809
|
-
const newColor =
|
|
40184
|
+
const newColor = parseColor2(value ?? this._defaultOptions.textColor);
|
|
39810
40185
|
if (this._textColor !== newColor) {
|
|
39811
40186
|
this._textColor = newColor;
|
|
39812
40187
|
this.requestRender();
|
|
39813
40188
|
}
|
|
39814
40189
|
}
|
|
39815
40190
|
set focusedBackgroundColor(value) {
|
|
39816
|
-
const newColor =
|
|
40191
|
+
const newColor = parseColor2(value ?? this._defaultOptions.focusedBackgroundColor);
|
|
39817
40192
|
if (this._focusedBackgroundColor !== newColor) {
|
|
39818
40193
|
this._focusedBackgroundColor = newColor;
|
|
39819
40194
|
this.requestRender();
|
|
39820
40195
|
}
|
|
39821
40196
|
}
|
|
39822
40197
|
set focusedTextColor(value) {
|
|
39823
|
-
const newColor =
|
|
40198
|
+
const newColor = parseColor2(value ?? this._defaultOptions.focusedTextColor);
|
|
39824
40199
|
if (this._focusedTextColor !== newColor) {
|
|
39825
40200
|
this._focusedTextColor = newColor;
|
|
39826
40201
|
this.requestRender();
|
|
39827
40202
|
}
|
|
39828
40203
|
}
|
|
39829
40204
|
set selectedBackgroundColor(value) {
|
|
39830
|
-
const newColor =
|
|
40205
|
+
const newColor = parseColor2(value ?? this._defaultOptions.selectedBackgroundColor);
|
|
39831
40206
|
if (this._selectedBackgroundColor !== newColor) {
|
|
39832
40207
|
this._selectedBackgroundColor = newColor;
|
|
39833
40208
|
this.requestRender();
|
|
39834
40209
|
}
|
|
39835
40210
|
}
|
|
39836
40211
|
set selectedTextColor(value) {
|
|
39837
|
-
const newColor =
|
|
40212
|
+
const newColor = parseColor2(value ?? this._defaultOptions.selectedTextColor);
|
|
39838
40213
|
if (this._selectedTextColor !== newColor) {
|
|
39839
40214
|
this._selectedTextColor = newColor;
|
|
39840
40215
|
this.requestRender();
|
|
39841
40216
|
}
|
|
39842
40217
|
}
|
|
39843
40218
|
set descriptionColor(value) {
|
|
39844
|
-
const newColor =
|
|
40219
|
+
const newColor = parseColor2(value ?? this._defaultOptions.descriptionColor);
|
|
39845
40220
|
if (this._descriptionColor !== newColor) {
|
|
39846
40221
|
this._descriptionColor = newColor;
|
|
39847
40222
|
this.requestRender();
|
|
39848
40223
|
}
|
|
39849
40224
|
}
|
|
39850
40225
|
set selectedDescriptionColor(value) {
|
|
39851
|
-
const newColor =
|
|
40226
|
+
const newColor = parseColor2(value ?? this._defaultOptions.selectedDescriptionColor);
|
|
39852
40227
|
if (this._selectedDescriptionColor !== newColor) {
|
|
39853
40228
|
this._selectedDescriptionColor = newColor;
|
|
39854
40229
|
this.requestRender();
|
|
@@ -39904,6 +40279,11 @@ var defaultTabSelectKeybindings = [
|
|
|
39904
40279
|
{ name: "return", action: "select-current" },
|
|
39905
40280
|
{ name: "linefeed", action: "select-current" }
|
|
39906
40281
|
];
|
|
40282
|
+
var TabSelectRenderableEvents = /* @__PURE__ */ ((TabSelectRenderableEvents2) => {
|
|
40283
|
+
TabSelectRenderableEvents2["SELECTION_CHANGED"] = "selectionChanged";
|
|
40284
|
+
TabSelectRenderableEvents2["ITEM_SELECTED"] = "itemSelected";
|
|
40285
|
+
return TabSelectRenderableEvents2;
|
|
40286
|
+
})(TabSelectRenderableEvents || {});
|
|
39907
40287
|
function calculateDynamicHeight(showUnderline, showDescription) {
|
|
39908
40288
|
let height = 1;
|
|
39909
40289
|
if (showUnderline) {
|
|
@@ -39938,10 +40318,10 @@ var TabSelectRenderable = class extends Renderable {
|
|
|
39938
40318
|
constructor(ctx, options) {
|
|
39939
40319
|
const calculatedHeight = calculateDynamicHeight(options.showUnderline ?? true, options.showDescription ?? true);
|
|
39940
40320
|
super(ctx, { ...options, height: calculatedHeight, buffered: true });
|
|
39941
|
-
this._backgroundColor =
|
|
39942
|
-
this._textColor =
|
|
39943
|
-
this._focusedBackgroundColor =
|
|
39944
|
-
this._focusedTextColor =
|
|
40321
|
+
this._backgroundColor = parseColor2(options.backgroundColor || "transparent");
|
|
40322
|
+
this._textColor = parseColor2(options.textColor || "#FFFFFF");
|
|
40323
|
+
this._focusedBackgroundColor = parseColor2(options.focusedBackgroundColor || options.backgroundColor || "#1a1a1a");
|
|
40324
|
+
this._focusedTextColor = parseColor2(options.focusedTextColor || options.textColor || "#FFFFFF");
|
|
39945
40325
|
this._options = options.options || [];
|
|
39946
40326
|
this._tabWidth = options.tabWidth || 20;
|
|
39947
40327
|
this._showDescription = options.showDescription ?? true;
|
|
@@ -39949,9 +40329,9 @@ var TabSelectRenderable = class extends Renderable {
|
|
|
39949
40329
|
this._showScrollArrows = options.showScrollArrows ?? true;
|
|
39950
40330
|
this._wrapSelection = options.wrapSelection ?? false;
|
|
39951
40331
|
this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
|
|
39952
|
-
this._selectedBackgroundColor =
|
|
39953
|
-
this._selectedTextColor =
|
|
39954
|
-
this._selectedDescriptionColor =
|
|
40332
|
+
this._selectedBackgroundColor = parseColor2(options.selectedBackgroundColor || "#334455");
|
|
40333
|
+
this._selectedTextColor = parseColor2(options.selectedTextColor || "#FFFF00");
|
|
40334
|
+
this._selectedDescriptionColor = parseColor2(options.selectedDescriptionColor || "#CCCCCC");
|
|
39955
40335
|
this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
|
|
39956
40336
|
this._keyBindings = options.keyBindings || [];
|
|
39957
40337
|
const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, this._keyBindings);
|
|
@@ -40018,10 +40398,10 @@ var TabSelectRenderable = class extends Renderable {
|
|
|
40018
40398
|
const hasMoreLeft = this.scrollOffset > 0;
|
|
40019
40399
|
const hasMoreRight = this.scrollOffset + this.maxVisibleTabs < this._options.length;
|
|
40020
40400
|
if (hasMoreLeft) {
|
|
40021
|
-
this.frameBuffer.drawText("\u2039", contentX, contentY,
|
|
40401
|
+
this.frameBuffer.drawText("\u2039", contentX, contentY, parseColor2("#AAAAAA"));
|
|
40022
40402
|
}
|
|
40023
40403
|
if (hasMoreRight) {
|
|
40024
|
-
this.frameBuffer.drawText("\u203A", contentX + contentWidth - 1, contentY,
|
|
40404
|
+
this.frameBuffer.drawText("\u203A", contentX + contentWidth - 1, contentY, parseColor2("#AAAAAA"));
|
|
40025
40405
|
}
|
|
40026
40406
|
}
|
|
40027
40407
|
setOptions(options) {
|
|
@@ -40135,31 +40515,31 @@ var TabSelectRenderable = class extends Renderable {
|
|
|
40135
40515
|
this.requestRender();
|
|
40136
40516
|
}
|
|
40137
40517
|
set backgroundColor(color) {
|
|
40138
|
-
this._backgroundColor =
|
|
40518
|
+
this._backgroundColor = parseColor2(color);
|
|
40139
40519
|
this.requestRender();
|
|
40140
40520
|
}
|
|
40141
40521
|
set textColor(color) {
|
|
40142
|
-
this._textColor =
|
|
40522
|
+
this._textColor = parseColor2(color);
|
|
40143
40523
|
this.requestRender();
|
|
40144
40524
|
}
|
|
40145
40525
|
set focusedBackgroundColor(color) {
|
|
40146
|
-
this._focusedBackgroundColor =
|
|
40526
|
+
this._focusedBackgroundColor = parseColor2(color);
|
|
40147
40527
|
this.requestRender();
|
|
40148
40528
|
}
|
|
40149
40529
|
set focusedTextColor(color) {
|
|
40150
|
-
this._focusedTextColor =
|
|
40530
|
+
this._focusedTextColor = parseColor2(color);
|
|
40151
40531
|
this.requestRender();
|
|
40152
40532
|
}
|
|
40153
40533
|
set selectedBackgroundColor(color) {
|
|
40154
|
-
this._selectedBackgroundColor =
|
|
40534
|
+
this._selectedBackgroundColor = parseColor2(color);
|
|
40155
40535
|
this.requestRender();
|
|
40156
40536
|
}
|
|
40157
40537
|
set selectedTextColor(color) {
|
|
40158
|
-
this._selectedTextColor =
|
|
40538
|
+
this._selectedTextColor = parseColor2(color);
|
|
40159
40539
|
this.requestRender();
|
|
40160
40540
|
}
|
|
40161
40541
|
set selectedDescriptionColor(color) {
|
|
40162
|
-
this._selectedDescriptionColor =
|
|
40542
|
+
this._selectedDescriptionColor = parseColor2(color);
|
|
40163
40543
|
this.requestRender();
|
|
40164
40544
|
}
|
|
40165
40545
|
get showDescription() {
|
|
@@ -40222,6 +40602,98 @@ var TabSelectRenderable = class extends Renderable {
|
|
|
40222
40602
|
};
|
|
40223
40603
|
|
|
40224
40604
|
// ../../opentui/packages/core/src/lib/selection.ts
|
|
40605
|
+
var SelectionAnchor = class {
|
|
40606
|
+
constructor(renderable, absoluteX, absoluteY) {
|
|
40607
|
+
this.renderable = renderable;
|
|
40608
|
+
this.relativeX = absoluteX - this.renderable.x;
|
|
40609
|
+
this.relativeY = absoluteY - this.renderable.y;
|
|
40610
|
+
}
|
|
40611
|
+
relativeX;
|
|
40612
|
+
relativeY;
|
|
40613
|
+
get x() {
|
|
40614
|
+
return this.renderable.x + this.relativeX;
|
|
40615
|
+
}
|
|
40616
|
+
get y() {
|
|
40617
|
+
return this.renderable.y + this.relativeY;
|
|
40618
|
+
}
|
|
40619
|
+
};
|
|
40620
|
+
var Selection4 = class {
|
|
40621
|
+
_anchor;
|
|
40622
|
+
_focus;
|
|
40623
|
+
_selectedRenderables = [];
|
|
40624
|
+
_touchedRenderables = [];
|
|
40625
|
+
_isActive = true;
|
|
40626
|
+
_isDragging = true;
|
|
40627
|
+
_isStart = false;
|
|
40628
|
+
constructor(anchorRenderable, anchor, focus) {
|
|
40629
|
+
this._anchor = new SelectionAnchor(anchorRenderable, anchor.x, anchor.y);
|
|
40630
|
+
this._focus = { ...focus };
|
|
40631
|
+
}
|
|
40632
|
+
get isStart() {
|
|
40633
|
+
return this._isStart;
|
|
40634
|
+
}
|
|
40635
|
+
set isStart(value) {
|
|
40636
|
+
this._isStart = value;
|
|
40637
|
+
}
|
|
40638
|
+
get anchor() {
|
|
40639
|
+
return { x: this._anchor.x, y: this._anchor.y };
|
|
40640
|
+
}
|
|
40641
|
+
get focus() {
|
|
40642
|
+
return { ...this._focus };
|
|
40643
|
+
}
|
|
40644
|
+
set focus(value) {
|
|
40645
|
+
this._focus = { ...value };
|
|
40646
|
+
}
|
|
40647
|
+
get isActive() {
|
|
40648
|
+
return this._isActive;
|
|
40649
|
+
}
|
|
40650
|
+
set isActive(value) {
|
|
40651
|
+
this._isActive = value;
|
|
40652
|
+
}
|
|
40653
|
+
get isDragging() {
|
|
40654
|
+
return this._isDragging;
|
|
40655
|
+
}
|
|
40656
|
+
set isDragging(value) {
|
|
40657
|
+
this._isDragging = value;
|
|
40658
|
+
}
|
|
40659
|
+
get bounds() {
|
|
40660
|
+
const minX = Math.min(this._anchor.x, this._focus.x);
|
|
40661
|
+
const maxX = Math.max(this._anchor.x, this._focus.x);
|
|
40662
|
+
const minY = Math.min(this._anchor.y, this._focus.y);
|
|
40663
|
+
const maxY = Math.max(this._anchor.y, this._focus.y);
|
|
40664
|
+
const width = maxX - minX + 1;
|
|
40665
|
+
const height = maxY - minY + 1;
|
|
40666
|
+
return {
|
|
40667
|
+
x: minX,
|
|
40668
|
+
y: minY,
|
|
40669
|
+
width,
|
|
40670
|
+
height
|
|
40671
|
+
};
|
|
40672
|
+
}
|
|
40673
|
+
updateSelectedRenderables(selectedRenderables) {
|
|
40674
|
+
this._selectedRenderables = selectedRenderables;
|
|
40675
|
+
}
|
|
40676
|
+
get selectedRenderables() {
|
|
40677
|
+
return this._selectedRenderables;
|
|
40678
|
+
}
|
|
40679
|
+
updateTouchedRenderables(touchedRenderables) {
|
|
40680
|
+
this._touchedRenderables = touchedRenderables;
|
|
40681
|
+
}
|
|
40682
|
+
get touchedRenderables() {
|
|
40683
|
+
return this._touchedRenderables;
|
|
40684
|
+
}
|
|
40685
|
+
getSelectedText() {
|
|
40686
|
+
const selectedTexts = this._selectedRenderables.sort((a, b2) => {
|
|
40687
|
+
const aY = a.y;
|
|
40688
|
+
const bY = b2.y;
|
|
40689
|
+
if (aY !== bY) {
|
|
40690
|
+
return aY - bY;
|
|
40691
|
+
}
|
|
40692
|
+
return a.x - b2.x;
|
|
40693
|
+
}).filter((renderable) => !renderable.isDestroyed).map((renderable) => renderable.getSelectedText()).filter((text) => text);
|
|
40694
|
+
return selectedTexts.join("\n");
|
|
40695
|
+
}
|
|
40696
|
+
};
|
|
40225
40697
|
function convertGlobalToLocalSelection(globalSelection, localX, localY) {
|
|
40226
40698
|
if (!globalSelection?.isActive) {
|
|
40227
40699
|
return null;
|
|
@@ -40450,6 +40922,30 @@ var BrowserRenderContext = class extends EventEmitter {
|
|
|
40450
40922
|
}
|
|
40451
40923
|
};
|
|
40452
40924
|
|
|
40925
|
+
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
|
|
40926
|
+
var src_exports2 = {};
|
|
40927
|
+
__export(src_exports2, {
|
|
40928
|
+
Align: () => Align2,
|
|
40929
|
+
BoxSizing: () => BoxSizing2,
|
|
40930
|
+
Dimension: () => Dimension2,
|
|
40931
|
+
Direction: () => Direction2,
|
|
40932
|
+
Display: () => Display2,
|
|
40933
|
+
Edge: () => Edge2,
|
|
40934
|
+
Errata: () => Errata2,
|
|
40935
|
+
ExperimentalFeature: () => ExperimentalFeature2,
|
|
40936
|
+
FlexDirection: () => FlexDirection2,
|
|
40937
|
+
Gutter: () => Gutter2,
|
|
40938
|
+
Justify: () => Justify2,
|
|
40939
|
+
LogLevel: () => LogLevel2,
|
|
40940
|
+
MeasureMode: () => MeasureMode3,
|
|
40941
|
+
NodeType: () => NodeType2,
|
|
40942
|
+
Overflow: () => Overflow2,
|
|
40943
|
+
PositionType: () => PositionType2,
|
|
40944
|
+
Unit: () => Unit2,
|
|
40945
|
+
Wrap: () => Wrap2,
|
|
40946
|
+
default: () => src_default2
|
|
40947
|
+
});
|
|
40948
|
+
|
|
40453
40949
|
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js
|
|
40454
40950
|
var loadYoga2 = (() => {
|
|
40455
40951
|
var _scriptDir = import.meta.url;
|
|
@@ -41987,6 +42483,7 @@ function wrapAssembly2(lib) {
|
|
|
41987
42483
|
|
|
41988
42484
|
// ../../node_modules/.bun/yoga-layout@3.2.1/node_modules/yoga-layout/dist/src/index.js
|
|
41989
42485
|
var Yoga2 = wrapAssembly2(await yoga_wasm_base64_esm_default2());
|
|
42486
|
+
var src_default2 = Yoga2;
|
|
41990
42487
|
|
|
41991
42488
|
// ../web/src/core-shims/index.ts
|
|
41992
42489
|
Object.defineProperty(TextBufferRenderable.prototype, "textAlign", {
|
|
@@ -42002,9 +42499,40 @@ Object.defineProperty(TextBufferRenderable.prototype, "textAlign", {
|
|
|
42002
42499
|
enumerable: true,
|
|
42003
42500
|
configurable: true
|
|
42004
42501
|
});
|
|
42502
|
+
function resolveRenderLib() {
|
|
42503
|
+
return null;
|
|
42504
|
+
}
|
|
42505
|
+
function createTextAttributes2(opts = {}) {
|
|
42506
|
+
const TA = {
|
|
42507
|
+
NONE: 0,
|
|
42508
|
+
BOLD: 1,
|
|
42509
|
+
DIM: 2,
|
|
42510
|
+
ITALIC: 4,
|
|
42511
|
+
UNDERLINE: 8,
|
|
42512
|
+
BLINK: 16,
|
|
42513
|
+
INVERSE: 32,
|
|
42514
|
+
HIDDEN: 64,
|
|
42515
|
+
STRIKETHROUGH: 128
|
|
42516
|
+
};
|
|
42517
|
+
let attr = TA.NONE;
|
|
42518
|
+
if (opts.bold) attr |= TA.BOLD;
|
|
42519
|
+
if (opts.italic) attr |= TA.ITALIC;
|
|
42520
|
+
if (opts.underline) attr |= TA.UNDERLINE;
|
|
42521
|
+
if (opts.dim) attr |= TA.DIM;
|
|
42522
|
+
if (opts.blink) attr |= TA.BLINK;
|
|
42523
|
+
if (opts.inverse) attr |= TA.INVERSE;
|
|
42524
|
+
if (opts.hidden) attr |= TA.HIDDEN;
|
|
42525
|
+
if (opts.strikethrough) attr |= TA.STRIKETHROUGH;
|
|
42526
|
+
return attr;
|
|
42527
|
+
}
|
|
42005
42528
|
function attributesWithLink(baseAttributes, linkId) {
|
|
42006
42529
|
return baseAttributes & 255 | (linkId & 16777215) << 8;
|
|
42007
42530
|
}
|
|
42531
|
+
function getLinkId(attributes) {
|
|
42532
|
+
return attributes >>> 8 & 16777215;
|
|
42533
|
+
}
|
|
42534
|
+
function visualizeRenderableTree(..._args) {
|
|
42535
|
+
}
|
|
42008
42536
|
|
|
42009
42537
|
// ../../opentui/packages/react/src/components/text.ts
|
|
42010
42538
|
var textNodeKeys = ["span", "b", "strong", "i", "em", "u", "br", "a"];
|
|
@@ -42085,6 +42613,9 @@ var baseComponents = {
|
|
|
42085
42613
|
a: LinkRenderable
|
|
42086
42614
|
};
|
|
42087
42615
|
var componentCatalogue = { ...baseComponents };
|
|
42616
|
+
function extend(objects) {
|
|
42617
|
+
Object.assign(componentCatalogue, objects);
|
|
42618
|
+
}
|
|
42088
42619
|
function getComponentCatalogue() {
|
|
42089
42620
|
return componentCatalogue;
|
|
42090
42621
|
}
|
|
@@ -42173,6 +42704,20 @@ var useTerminalDimensions = () => {
|
|
|
42173
42704
|
|
|
42174
42705
|
// ../../opentui/packages/react/src/hooks/use-timeline.ts
|
|
42175
42706
|
import { useEffect as useEffect3 } from "react";
|
|
42707
|
+
var useTimeline = (options = {}) => {
|
|
42708
|
+
const timeline = new Timeline(options);
|
|
42709
|
+
useEffect3(() => {
|
|
42710
|
+
if (!options.autoplay) {
|
|
42711
|
+
timeline.play();
|
|
42712
|
+
}
|
|
42713
|
+
engine.register(timeline);
|
|
42714
|
+
return () => {
|
|
42715
|
+
timeline.pause();
|
|
42716
|
+
engine.unregister(timeline);
|
|
42717
|
+
};
|
|
42718
|
+
}, []);
|
|
42719
|
+
return timeline;
|
|
42720
|
+
};
|
|
42176
42721
|
|
|
42177
42722
|
// ../../opentui/packages/react/src/reconciler/renderer.ts
|
|
42178
42723
|
import React3 from "react";
|
|
@@ -42635,6 +43180,32 @@ function _render(element, root) {
|
|
|
42635
43180
|
var _r = reconciler;
|
|
42636
43181
|
var flushSync = _r.flushSyncFromReconciler ?? _r.flushSync;
|
|
42637
43182
|
var { createPortal } = reconciler;
|
|
43183
|
+
function createRoot(renderer) {
|
|
43184
|
+
let container = null;
|
|
43185
|
+
const cleanup = () => {
|
|
43186
|
+
if (container) {
|
|
43187
|
+
reconciler.updateContainer(null, container, null, () => {
|
|
43188
|
+
});
|
|
43189
|
+
reconciler.flushSyncWork();
|
|
43190
|
+
container = null;
|
|
43191
|
+
}
|
|
43192
|
+
};
|
|
43193
|
+
renderer.once("destroy" /* DESTROY */, cleanup);
|
|
43194
|
+
return {
|
|
43195
|
+
render: (node) => {
|
|
43196
|
+
engine.attach(renderer);
|
|
43197
|
+
container = _render(
|
|
43198
|
+
React3.createElement(
|
|
43199
|
+
AppContext.Provider,
|
|
43200
|
+
{ value: { keyHandler: renderer.keyInput, renderer } },
|
|
43201
|
+
React3.createElement(ErrorBoundary, null, node)
|
|
43202
|
+
),
|
|
43203
|
+
renderer.root
|
|
43204
|
+
);
|
|
43205
|
+
},
|
|
43206
|
+
unmount: cleanup
|
|
43207
|
+
};
|
|
43208
|
+
}
|
|
42638
43209
|
|
|
42639
43210
|
// ../../opentui/packages/react/src/index.ts
|
|
42640
43211
|
import { createElement } from "react";
|
|
@@ -42786,17 +43357,140 @@ function calculateGridSize(widthPx, heightPx, cellWidth, cellHeight) {
|
|
|
42786
43357
|
rows: Math.max(1, Math.floor(heightPx / cellHeight))
|
|
42787
43358
|
};
|
|
42788
43359
|
}
|
|
43360
|
+
|
|
43361
|
+
// src/index.ts
|
|
43362
|
+
var ErrorBoundary3 = ErrorBoundary;
|
|
42789
43363
|
export {
|
|
43364
|
+
ASCIIFontRenderable,
|
|
43365
|
+
ATTRIBUTE_BASE_BITS,
|
|
43366
|
+
ATTRIBUTE_BASE_MASK,
|
|
43367
|
+
AppContext,
|
|
43368
|
+
ArrowRenderable,
|
|
43369
|
+
BaseRenderable,
|
|
43370
|
+
BorderCharArrays,
|
|
43371
|
+
BorderChars,
|
|
43372
|
+
BoxRenderable,
|
|
42790
43373
|
BrowserContext,
|
|
43374
|
+
CliRenderEvents,
|
|
43375
|
+
CliRenderer,
|
|
43376
|
+
CodeRenderable,
|
|
43377
|
+
DebugOverlayCorner,
|
|
43378
|
+
DiffRenderable,
|
|
43379
|
+
ErrorBoundary3 as ErrorBoundary,
|
|
43380
|
+
FrameBufferRenderable,
|
|
42791
43381
|
HeadlessRenderer,
|
|
43382
|
+
InputRenderable,
|
|
43383
|
+
InputRenderableEvents,
|
|
43384
|
+
BrowserInternalKeyHandler as InternalKeyHandler,
|
|
43385
|
+
BrowserKeyHandler as KeyHandler,
|
|
43386
|
+
LayoutEvents,
|
|
43387
|
+
LineNumberRenderable,
|
|
43388
|
+
MarkdownRenderable,
|
|
43389
|
+
BrowserBuffer as OptimizedBuffer,
|
|
43390
|
+
RGBA,
|
|
43391
|
+
Renderable,
|
|
43392
|
+
RenderableEvents,
|
|
43393
|
+
RootRenderable,
|
|
43394
|
+
RootTextNodeRenderable,
|
|
43395
|
+
ScrollBarRenderable,
|
|
43396
|
+
ScrollBoxRenderable,
|
|
43397
|
+
SelectRenderable,
|
|
43398
|
+
SelectRenderableEvents,
|
|
43399
|
+
Selection4 as Selection,
|
|
43400
|
+
SliderRenderable,
|
|
43401
|
+
StyledText,
|
|
43402
|
+
BrowserSyntaxStyle as SyntaxStyle,
|
|
43403
|
+
TabSelectRenderable,
|
|
43404
|
+
TabSelectRenderableEvents,
|
|
43405
|
+
TextAttributes,
|
|
43406
|
+
BrowserTextBuffer as TextBuffer,
|
|
43407
|
+
TextBufferRenderable,
|
|
43408
|
+
BrowserTextBufferView as TextBufferView,
|
|
43409
|
+
TextNodeRenderable,
|
|
43410
|
+
TextRenderable,
|
|
43411
|
+
TextareaRenderable,
|
|
43412
|
+
Timeline,
|
|
43413
|
+
src_exports2 as Yoga,
|
|
43414
|
+
_render,
|
|
43415
|
+
attributesWithLink,
|
|
43416
|
+
baseComponents,
|
|
43417
|
+
bg,
|
|
43418
|
+
black,
|
|
43419
|
+
blink,
|
|
43420
|
+
blue,
|
|
43421
|
+
bold,
|
|
43422
|
+
borderCharsToArray,
|
|
42792
43423
|
bufferToText,
|
|
42793
43424
|
calculateGridSize,
|
|
43425
|
+
componentCatalogue,
|
|
43426
|
+
convertGlobalToLocalSelection,
|
|
43427
|
+
createCliRenderer,
|
|
43428
|
+
createElement,
|
|
42794
43429
|
createHeadlessRoot,
|
|
43430
|
+
createPortal,
|
|
43431
|
+
createRoot,
|
|
43432
|
+
createTextAttributes2 as createTextAttributes,
|
|
43433
|
+
createTimeline,
|
|
43434
|
+
cyan,
|
|
43435
|
+
dim,
|
|
43436
|
+
engine,
|
|
43437
|
+
extend,
|
|
43438
|
+
fg,
|
|
43439
|
+
flushSync,
|
|
43440
|
+
getBaseAttributes,
|
|
43441
|
+
getBorderFromSides,
|
|
43442
|
+
getBorderSides,
|
|
43443
|
+
getComponentCatalogue,
|
|
43444
|
+
getLinkId,
|
|
43445
|
+
green,
|
|
43446
|
+
hexToRgb,
|
|
43447
|
+
hsvToRgb,
|
|
42795
43448
|
isBrowser,
|
|
42796
43449
|
isCanvasSupported,
|
|
43450
|
+
isDimensionType,
|
|
43451
|
+
isFlexBasisType,
|
|
43452
|
+
isMarginType,
|
|
43453
|
+
isOverflowType,
|
|
43454
|
+
isPaddingType,
|
|
43455
|
+
isPositionType,
|
|
43456
|
+
isPositionTypeType,
|
|
43457
|
+
isRenderable,
|
|
43458
|
+
isSizeType,
|
|
43459
|
+
isStyledText,
|
|
43460
|
+
isTextNodeRenderable,
|
|
43461
|
+
isValidBorderStyle,
|
|
43462
|
+
italic,
|
|
43463
|
+
magenta,
|
|
43464
|
+
maybeMakeRenderable,
|
|
43465
|
+
parseAlign,
|
|
43466
|
+
parseAlignItems,
|
|
43467
|
+
parseBorderStyle,
|
|
43468
|
+
parseColor,
|
|
43469
|
+
parseFlexDirection,
|
|
43470
|
+
parseJustify,
|
|
43471
|
+
parseOverflow,
|
|
43472
|
+
parsePositionType,
|
|
43473
|
+
parseWrap,
|
|
43474
|
+
reconciler,
|
|
43475
|
+
red,
|
|
43476
|
+
resolveRenderLib,
|
|
43477
|
+
reverse,
|
|
43478
|
+
rgbToHex,
|
|
42797
43479
|
setHeadlessRootRenderableClass,
|
|
43480
|
+
strikethrough,
|
|
43481
|
+
stringToStyledText,
|
|
43482
|
+
t,
|
|
43483
|
+
underline,
|
|
43484
|
+
useAppContext,
|
|
42798
43485
|
useKeyboard,
|
|
42799
|
-
|
|
43486
|
+
useOnResize,
|
|
43487
|
+
useRenderer,
|
|
43488
|
+
useTerminalDimensions,
|
|
43489
|
+
useTimeline,
|
|
43490
|
+
validateOptions,
|
|
43491
|
+
visualizeRenderableTree,
|
|
43492
|
+
white,
|
|
43493
|
+
yellow
|
|
42800
43494
|
};
|
|
42801
43495
|
/*! Bundled license information:
|
|
42802
43496
|
|