@opentui/core 0.0.0-20251201-fe4cc80e → 0.0.0-20251202-52296102

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.
@@ -1,56 +1,9 @@
1
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, {
22
- get: all[name],
23
- enumerable: true,
24
- configurable: true,
25
- set: (newValue) => all[name] = () => newValue
26
- });
27
- };
28
- var __require = import.meta.require;
29
-
30
- // ../../node_modules/bun-yoga/dist/darwin-arm64/libyoga.dylib
31
- var require_libyoga = __commonJS((exports, module) => {
32
- module.exports = "./libyoga-j5nt7np1.dylib";
33
- });
34
-
35
- // ../../node_modules/bun-yoga/dist/darwin-x64/libyoga.dylib
36
- var require_libyoga2 = __commonJS((exports, module) => {
37
- module.exports = "./libyoga-2ksztx35.dylib";
38
- });
39
-
40
- // ../../node_modules/bun-yoga/dist/linux-x64/libyoga.so
41
- var require_libyoga3 = __commonJS((exports, module) => {
42
- module.exports = "./libyoga-wnbqxxhv.so";
43
- });
44
-
45
- // ../../node_modules/bun-yoga/dist/linux-arm64/libyoga.so
46
- var require_libyoga4 = __commonJS((exports, module) => {
47
- module.exports = "./libyoga-gh2tjwb7.so";
48
- });
49
-
50
- // ../../node_modules/bun-yoga/dist/windows-x64/yoga.dll
51
- var require_yoga = __commonJS((exports, module) => {
52
- module.exports = "./yoga-jkgc6c1f.dll";
53
- });
2
+ import {
3
+ __export,
4
+ __require,
5
+ __toESM
6
+ } from "./index-g8dczzvv.js";
54
7
 
55
8
  // ../../node_modules/bun-yoga/dist/index.js
56
9
  var exports_dist = {};
@@ -122,65 +75,41 @@ __export(exports_dist, {
122
75
  import { dlopen, suffix, JSCallback, FFIType } from "bun:ffi";
123
76
  import { join } from "path";
124
77
  import { existsSync } from "fs";
125
- import { arch, platform } from "os";
126
- function getPlatformTarget() {
127
- const p = platform();
128
- const a = arch();
129
- if (p === "darwin") {
130
- return a === "arm64" ? "darwin-arm64" : "darwin-x64";
131
- } else if (p === "linux") {
132
- return a === "arm64" ? "linux-arm64" : "linux-x64";
133
- } else if (p === "win32") {
134
- return "windows-x64";
135
- }
136
- throw new Error(`Unsupported platform: ${p}-${a}`);
137
- }
138
- function getEmbeddedLib() {
139
- const target = getPlatformTarget();
78
+ var __dirname = "/Users/runner/work/opentui/opentui/node_modules/bun-yoga/dist";
79
+ var embeddedLib = await (async () => {
140
80
  try {
141
- switch (target) {
142
- case "darwin-arm64":
143
- return require_libyoga();
144
- case "darwin-x64":
145
- return require_libyoga2();
146
- case "linux-x64":
147
- return require_libyoga3();
148
- case "linux-arm64":
149
- return require_libyoga4();
150
- case "windows-x64":
151
- return require_yoga();
152
- default:
153
- return;
154
- }
155
- } catch {
156
- return;
157
- }
158
- }
81
+ if (process.platform === "darwin" && process.arch === "arm64") {
82
+ return (await import("./libyoga-m7gmcz0e.js", { with: { type: "file" } })).default;
83
+ } else if (process.platform === "darwin" && process.arch === "x64") {
84
+ return (await import("./libyoga-jkq1dr7g.js", { with: { type: "file" } })).default;
85
+ } else if (process.platform === "linux" && process.arch === "x64") {
86
+ return (await import("./libyoga-zt51h244.js", { with: { type: "file" } })).default;
87
+ } else if (process.platform === "linux" && process.arch === "arm64") {
88
+ return (await import("./libyoga-jjdjx62k.js", { with: { type: "file" } })).default;
89
+ } else if (process.platform === "win32") {
90
+ return (await import("./yoga-merwjcba.js", { with: { type: "file" } })).default;
91
+ }
92
+ } catch {}
93
+ return;
94
+ })();
159
95
  function getLibPath() {
160
- const libName = platform() === "win32" ? `yoga.${suffix}` : `libyoga.${suffix}`;
161
- const target = getPlatformTarget();
162
- const devPath = join(import.meta.dir, "..", "zig-out", "lib", libName);
163
- if (existsSync(devPath)) {
164
- return devPath;
165
- }
166
- if (platform() === "win32") {
167
- const devPathBin = join(import.meta.dir, "..", "zig-out", "bin", libName);
168
- if (existsSync(devPathBin)) {
169
- return devPathBin;
96
+ if (process.platform === "win32") {
97
+ if (existsSync(join(__dirname, "..", "zig-out", "lib", `yoga.${suffix}`))) {
98
+ return join(__dirname, "..", "zig-out", "lib", `yoga.${suffix}`);
99
+ }
100
+ if (existsSync(join(__dirname, "..", "zig-out", "bin", `yoga.${suffix}`))) {
101
+ return join(__dirname, "..", "zig-out", "bin", `yoga.${suffix}`);
102
+ }
103
+ } else {
104
+ if (existsSync(join(__dirname, "..", "zig-out", "lib", `libyoga.${suffix}`))) {
105
+ return join(__dirname, "..", "zig-out", "lib", `libyoga.${suffix}`);
170
106
  }
171
107
  }
172
- const embedded = getEmbeddedLib();
173
- if (embedded && existsSync(embedded)) {
174
- return embedded;
175
- }
176
- const distPath = join(import.meta.dir, "..", "dist", target, libName);
177
- if (existsSync(distPath)) {
178
- return distPath;
108
+ if (embeddedLib && existsSync(embeddedLib)) {
109
+ return embeddedLib;
179
110
  }
180
- throw new Error(`Could not find native library ${libName}. ` + `Looked in:
181
- - ${devPath}
182
- - ${distPath}
183
- ` + `Make sure to run 'zig build' or install the package with binaries.`);
111
+ throw new Error(`Could not find native library. Platform: ${process.platform}-${process.arch}
112
+ Make sure to run 'zig build' or install the package with binaries.`);
184
113
  }
185
114
  var Align = {
186
115
  Auto: 0,
@@ -344,6 +273,7 @@ function parseValue(value) {
344
273
  }
345
274
  return { unit: Unit.Point, asNumber: value };
346
275
  }
276
+ var UNDEFINED_VALUE = { unit: Unit.Undefined, value: NaN };
347
277
  function unpackValue(packed) {
348
278
  const p = BigInt(packed);
349
279
  const unit = Number(p & 0xffffffffn);
@@ -499,12 +429,16 @@ var yg = lib.symbols;
499
429
 
500
430
  class Node {
501
431
  ptr;
432
+ _freed = false;
502
433
  measureCallback = null;
503
434
  baselineCallback = null;
504
435
  dirtiedCallback = null;
505
436
  constructor(ptr) {
506
437
  this.ptr = ptr;
507
438
  }
439
+ isFreed() {
440
+ return this._freed;
441
+ }
508
442
  static create(config) {
509
443
  const ptr = config ? yg.ygNodeNewWithConfig(config["ptr"]) : yg.ygNodeNew();
510
444
  if (!ptr)
@@ -521,16 +455,24 @@ class Node {
521
455
  node.free();
522
456
  }
523
457
  free() {
458
+ if (this._freed)
459
+ return;
524
460
  this.unsetMeasureFunc();
525
461
  this.unsetBaselineFunc();
526
462
  this.unsetDirtiedFunc();
527
463
  yg.ygNodeFree(this.ptr);
464
+ this._freed = true;
528
465
  }
529
466
  freeRecursive() {
467
+ if (this._freed)
468
+ return;
530
469
  this.cleanupCallbacks();
531
470
  yg.ygNodeFreeRecursive(this.ptr);
471
+ this._freed = true;
532
472
  }
533
473
  reset() {
474
+ if (this._freed)
475
+ return;
534
476
  this.cleanupCallbacks();
535
477
  yg.ygNodeReset(this.ptr);
536
478
  }
@@ -549,61 +491,95 @@ class Node {
549
491
  }
550
492
  }
551
493
  clone() {
494
+ if (this._freed)
495
+ throw new Error("Cannot clone freed node");
552
496
  const ptr = yg.ygNodeClone(this.ptr);
553
497
  if (!ptr)
554
498
  throw new Error("Failed to clone node");
555
499
  return new Node(ptr);
556
500
  }
557
501
  copyStyle(node) {
502
+ if (this._freed)
503
+ return;
558
504
  yg.ygNodeCopyStyle(this.ptr, node.ptr);
559
505
  }
560
506
  setIsReferenceBaseline(isReferenceBaseline) {
507
+ if (this._freed)
508
+ return;
561
509
  yg.ygNodeSetIsReferenceBaseline(this.ptr, isReferenceBaseline);
562
510
  }
563
511
  isReferenceBaseline() {
512
+ if (this._freed)
513
+ return false;
564
514
  return yg.ygNodeIsReferenceBaseline(this.ptr);
565
515
  }
566
516
  setAlwaysFormsContainingBlock(alwaysFormsContainingBlock) {
517
+ if (this._freed)
518
+ return;
567
519
  yg.ygNodeSetAlwaysFormsContainingBlock(this.ptr, alwaysFormsContainingBlock);
568
520
  }
569
521
  insertChild(child, index) {
522
+ if (this._freed)
523
+ return;
570
524
  yg.ygNodeInsertChild(this.ptr, child.ptr, index);
571
525
  }
572
526
  removeChild(child) {
527
+ if (this._freed)
528
+ return;
573
529
  yg.ygNodeRemoveChild(this.ptr, child.ptr);
574
530
  }
575
531
  removeAllChildren() {
532
+ if (this._freed)
533
+ return;
576
534
  yg.ygNodeRemoveAllChildren(this.ptr);
577
535
  }
578
536
  getChild(index) {
537
+ if (this._freed)
538
+ return null;
579
539
  const ptr = yg.ygNodeGetChild(this.ptr, index);
580
540
  return ptr ? new Node(ptr) : null;
581
541
  }
582
542
  getChildCount() {
543
+ if (this._freed)
544
+ return 0;
583
545
  return Number(yg.ygNodeGetChildCount(this.ptr));
584
546
  }
585
547
  getParent() {
548
+ if (this._freed)
549
+ return null;
586
550
  const ptr = yg.ygNodeGetParent(this.ptr);
587
551
  return ptr ? new Node(ptr) : null;
588
552
  }
589
553
  calculateLayout(width, height, direction = Direction.LTR) {
554
+ if (this._freed)
555
+ return;
590
556
  const w = width === "auto" || width === undefined ? NaN : width;
591
557
  const h = height === "auto" || height === undefined ? NaN : height;
592
558
  yg.ygNodeCalculateLayout(this.ptr, w, h, direction);
593
559
  }
594
560
  hasNewLayout() {
561
+ if (this._freed)
562
+ return false;
595
563
  return yg.ygNodeGetHasNewLayout(this.ptr);
596
564
  }
597
565
  markLayoutSeen() {
566
+ if (this._freed)
567
+ return;
598
568
  yg.ygNodeSetHasNewLayout(this.ptr, false);
599
569
  }
600
570
  markDirty() {
571
+ if (this._freed)
572
+ return;
601
573
  yg.ygNodeMarkDirty(this.ptr);
602
574
  }
603
575
  isDirty() {
576
+ if (this._freed)
577
+ return true;
604
578
  return yg.ygNodeIsDirty(this.ptr);
605
579
  }
606
580
  getComputedLayout() {
581
+ if (this._freed)
582
+ return { left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0 };
607
583
  return {
608
584
  left: yg.ygNodeLayoutGetLeft(this.ptr),
609
585
  top: yg.ygNodeLayoutGetTop(this.ptr),
@@ -614,117 +590,193 @@ class Node {
614
590
  };
615
591
  }
616
592
  getComputedLeft() {
593
+ if (this._freed)
594
+ return 0;
617
595
  return yg.ygNodeLayoutGetLeft(this.ptr);
618
596
  }
619
597
  getComputedTop() {
598
+ if (this._freed)
599
+ return 0;
620
600
  return yg.ygNodeLayoutGetTop(this.ptr);
621
601
  }
622
602
  getComputedRight() {
603
+ if (this._freed)
604
+ return 0;
623
605
  return yg.ygNodeLayoutGetRight(this.ptr);
624
606
  }
625
607
  getComputedBottom() {
608
+ if (this._freed)
609
+ return 0;
626
610
  return yg.ygNodeLayoutGetBottom(this.ptr);
627
611
  }
628
612
  getComputedWidth() {
613
+ if (this._freed)
614
+ return 0;
629
615
  return yg.ygNodeLayoutGetWidth(this.ptr);
630
616
  }
631
617
  getComputedHeight() {
618
+ if (this._freed)
619
+ return 0;
632
620
  return yg.ygNodeLayoutGetHeight(this.ptr);
633
621
  }
634
622
  getComputedBorder(edge) {
623
+ if (this._freed)
624
+ return 0;
635
625
  return yg.ygNodeLayoutGetBorder(this.ptr, edge);
636
626
  }
637
627
  getComputedMargin(edge) {
628
+ if (this._freed)
629
+ return 0;
638
630
  return yg.ygNodeLayoutGetMargin(this.ptr, edge);
639
631
  }
640
632
  getComputedPadding(edge) {
633
+ if (this._freed)
634
+ return 0;
641
635
  return yg.ygNodeLayoutGetPadding(this.ptr, edge);
642
636
  }
643
637
  setDirection(direction) {
638
+ if (this._freed)
639
+ return;
644
640
  yg.ygNodeStyleSetDirection(this.ptr, direction);
645
641
  }
646
642
  getDirection() {
643
+ if (this._freed)
644
+ return Direction.Inherit;
647
645
  return yg.ygNodeStyleGetDirection(this.ptr);
648
646
  }
649
647
  setFlexDirection(flexDirection) {
648
+ if (this._freed)
649
+ return;
650
650
  yg.ygNodeStyleSetFlexDirection(this.ptr, flexDirection);
651
651
  }
652
652
  getFlexDirection() {
653
+ if (this._freed)
654
+ return FlexDirection.Column;
653
655
  return yg.ygNodeStyleGetFlexDirection(this.ptr);
654
656
  }
655
657
  setJustifyContent(justifyContent) {
658
+ if (this._freed)
659
+ return;
656
660
  yg.ygNodeStyleSetJustifyContent(this.ptr, justifyContent);
657
661
  }
658
662
  getJustifyContent() {
663
+ if (this._freed)
664
+ return Justify.FlexStart;
659
665
  return yg.ygNodeStyleGetJustifyContent(this.ptr);
660
666
  }
661
667
  setAlignContent(alignContent) {
668
+ if (this._freed)
669
+ return;
662
670
  yg.ygNodeStyleSetAlignContent(this.ptr, alignContent);
663
671
  }
664
672
  getAlignContent() {
673
+ if (this._freed)
674
+ return Align.Auto;
665
675
  return yg.ygNodeStyleGetAlignContent(this.ptr);
666
676
  }
667
677
  setAlignItems(alignItems) {
678
+ if (this._freed)
679
+ return;
668
680
  yg.ygNodeStyleSetAlignItems(this.ptr, alignItems);
669
681
  }
670
682
  getAlignItems() {
683
+ if (this._freed)
684
+ return Align.Auto;
671
685
  return yg.ygNodeStyleGetAlignItems(this.ptr);
672
686
  }
673
687
  setAlignSelf(alignSelf) {
688
+ if (this._freed)
689
+ return;
674
690
  yg.ygNodeStyleSetAlignSelf(this.ptr, alignSelf);
675
691
  }
676
692
  getAlignSelf() {
693
+ if (this._freed)
694
+ return Align.Auto;
677
695
  return yg.ygNodeStyleGetAlignSelf(this.ptr);
678
696
  }
679
697
  setPositionType(positionType) {
698
+ if (this._freed)
699
+ return;
680
700
  yg.ygNodeStyleSetPositionType(this.ptr, positionType);
681
701
  }
682
702
  getPositionType() {
703
+ if (this._freed)
704
+ return PositionType.Static;
683
705
  return yg.ygNodeStyleGetPositionType(this.ptr);
684
706
  }
685
707
  setFlexWrap(flexWrap) {
708
+ if (this._freed)
709
+ return;
686
710
  yg.ygNodeStyleSetFlexWrap(this.ptr, flexWrap);
687
711
  }
688
712
  getFlexWrap() {
713
+ if (this._freed)
714
+ return Wrap.NoWrap;
689
715
  return yg.ygNodeStyleGetFlexWrap(this.ptr);
690
716
  }
691
717
  setOverflow(overflow) {
718
+ if (this._freed)
719
+ return;
692
720
  yg.ygNodeStyleSetOverflow(this.ptr, overflow);
693
721
  }
694
722
  getOverflow() {
723
+ if (this._freed)
724
+ return Overflow.Visible;
695
725
  return yg.ygNodeStyleGetOverflow(this.ptr);
696
726
  }
697
727
  setDisplay(display) {
728
+ if (this._freed)
729
+ return;
698
730
  yg.ygNodeStyleSetDisplay(this.ptr, display);
699
731
  }
700
732
  getDisplay() {
733
+ if (this._freed)
734
+ return Display.Flex;
701
735
  return yg.ygNodeStyleGetDisplay(this.ptr);
702
736
  }
703
737
  setBoxSizing(boxSizing) {
738
+ if (this._freed)
739
+ return;
704
740
  yg.ygNodeStyleSetBoxSizing(this.ptr, boxSizing);
705
741
  }
706
742
  getBoxSizing() {
743
+ if (this._freed)
744
+ return BoxSizing.BorderBox;
707
745
  return yg.ygNodeStyleGetBoxSizing(this.ptr);
708
746
  }
709
747
  setFlex(flex) {
748
+ if (this._freed)
749
+ return;
710
750
  yg.ygNodeStyleSetFlex(this.ptr, flex);
711
751
  }
712
752
  getFlex() {
753
+ if (this._freed)
754
+ return NaN;
713
755
  return yg.ygNodeStyleGetFlex(this.ptr);
714
756
  }
715
757
  setFlexGrow(flexGrow) {
758
+ if (this._freed)
759
+ return;
716
760
  yg.ygNodeStyleSetFlexGrow(this.ptr, flexGrow);
717
761
  }
718
762
  getFlexGrow() {
763
+ if (this._freed)
764
+ return NaN;
719
765
  return yg.ygNodeStyleGetFlexGrow(this.ptr);
720
766
  }
721
767
  setFlexShrink(flexShrink) {
768
+ if (this._freed)
769
+ return;
722
770
  yg.ygNodeStyleSetFlexShrink(this.ptr, flexShrink);
723
771
  }
724
772
  getFlexShrink() {
773
+ if (this._freed)
774
+ return NaN;
725
775
  return yg.ygNodeStyleGetFlexShrink(this.ptr);
726
776
  }
727
777
  setFlexBasis(flexBasis) {
778
+ if (this._freed)
779
+ return;
728
780
  const { unit, asNumber } = parseValue(flexBasis);
729
781
  if (unit === Unit.Auto) {
730
782
  yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
@@ -735,14 +787,20 @@ class Node {
735
787
  }
736
788
  }
737
789
  setFlexBasisPercent(flexBasis) {
790
+ if (this._freed)
791
+ return;
738
792
  if (flexBasis !== undefined) {
739
793
  yg.ygNodeStyleSetFlexBasisPercent(this.ptr, flexBasis);
740
794
  }
741
795
  }
742
796
  setFlexBasisAuto() {
797
+ if (this._freed)
798
+ return;
743
799
  yg.ygNodeStyleSetFlexBasisAuto(this.ptr);
744
800
  }
745
801
  setPosition(edge, position) {
802
+ if (this._freed)
803
+ return;
746
804
  const { unit, asNumber } = parseValue(position);
747
805
  if (unit === Unit.Percent) {
748
806
  yg.ygNodeStyleSetPositionPercent(this.ptr, edge, asNumber);
@@ -751,14 +809,20 @@ class Node {
751
809
  }
752
810
  }
753
811
  setPositionPercent(edge, position) {
812
+ if (this._freed)
813
+ return;
754
814
  if (position !== undefined) {
755
815
  yg.ygNodeStyleSetPositionPercent(this.ptr, edge, position);
756
816
  }
757
817
  }
758
818
  setPositionAuto(edge) {
819
+ if (this._freed)
820
+ return;
759
821
  yg.ygNodeStyleSetPositionAuto(this.ptr, edge);
760
822
  }
761
823
  setMargin(edge, margin) {
824
+ if (this._freed)
825
+ return;
762
826
  const { unit, asNumber } = parseValue(margin);
763
827
  if (unit === Unit.Auto) {
764
828
  yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
@@ -769,14 +833,20 @@ class Node {
769
833
  }
770
834
  }
771
835
  setMarginPercent(edge, margin) {
836
+ if (this._freed)
837
+ return;
772
838
  if (margin !== undefined) {
773
839
  yg.ygNodeStyleSetMarginPercent(this.ptr, edge, margin);
774
840
  }
775
841
  }
776
842
  setMarginAuto(edge) {
843
+ if (this._freed)
844
+ return;
777
845
  yg.ygNodeStyleSetMarginAuto(this.ptr, edge);
778
846
  }
779
847
  setPadding(edge, padding) {
848
+ if (this._freed)
849
+ return;
780
850
  const { unit, asNumber } = parseValue(padding);
781
851
  if (unit === Unit.Percent) {
782
852
  yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, asNumber);
@@ -785,19 +855,27 @@ class Node {
785
855
  }
786
856
  }
787
857
  setPaddingPercent(edge, padding) {
858
+ if (this._freed)
859
+ return;
788
860
  if (padding !== undefined) {
789
861
  yg.ygNodeStyleSetPaddingPercent(this.ptr, edge, padding);
790
862
  }
791
863
  }
792
864
  setBorder(edge, border) {
865
+ if (this._freed)
866
+ return;
793
867
  if (border !== undefined) {
794
868
  yg.ygNodeStyleSetBorder(this.ptr, edge, border);
795
869
  }
796
870
  }
797
871
  getBorder(edge) {
872
+ if (this._freed)
873
+ return NaN;
798
874
  return yg.ygNodeStyleGetBorder(this.ptr, edge);
799
875
  }
800
876
  setGap(gutter, gap) {
877
+ if (this._freed)
878
+ return;
801
879
  const { unit, asNumber } = parseValue(gap);
802
880
  if (unit === Unit.Percent) {
803
881
  yg.ygNodeStyleSetGapPercent(this.ptr, gutter, asNumber);
@@ -806,11 +884,15 @@ class Node {
806
884
  }
807
885
  }
808
886
  setGapPercent(gutter, gap) {
887
+ if (this._freed)
888
+ return;
809
889
  if (gap !== undefined) {
810
890
  yg.ygNodeStyleSetGapPercent(this.ptr, gutter, gap);
811
891
  }
812
892
  }
813
893
  setWidth(width) {
894
+ if (this._freed)
895
+ return;
814
896
  const { unit, asNumber } = parseValue(width);
815
897
  if (unit === Unit.Auto) {
816
898
  yg.ygNodeStyleSetWidthAuto(this.ptr);
@@ -821,14 +903,20 @@ class Node {
821
903
  }
822
904
  }
823
905
  setWidthPercent(width) {
906
+ if (this._freed)
907
+ return;
824
908
  if (width !== undefined) {
825
909
  yg.ygNodeStyleSetWidthPercent(this.ptr, width);
826
910
  }
827
911
  }
828
912
  setWidthAuto() {
913
+ if (this._freed)
914
+ return;
829
915
  yg.ygNodeStyleSetWidthAuto(this.ptr);
830
916
  }
831
917
  setHeight(height) {
918
+ if (this._freed)
919
+ return;
832
920
  const { unit, asNumber } = parseValue(height);
833
921
  if (unit === Unit.Auto) {
834
922
  yg.ygNodeStyleSetHeightAuto(this.ptr);
@@ -839,14 +927,20 @@ class Node {
839
927
  }
840
928
  }
841
929
  setHeightPercent(height) {
930
+ if (this._freed)
931
+ return;
842
932
  if (height !== undefined) {
843
933
  yg.ygNodeStyleSetHeightPercent(this.ptr, height);
844
934
  }
845
935
  }
846
936
  setHeightAuto() {
937
+ if (this._freed)
938
+ return;
847
939
  yg.ygNodeStyleSetHeightAuto(this.ptr);
848
940
  }
849
941
  setMinWidth(minWidth) {
942
+ if (this._freed)
943
+ return;
850
944
  const { unit, asNumber } = parseValue(minWidth);
851
945
  if (unit === Unit.Percent) {
852
946
  yg.ygNodeStyleSetMinWidthPercent(this.ptr, asNumber);
@@ -855,11 +949,15 @@ class Node {
855
949
  }
856
950
  }
857
951
  setMinWidthPercent(minWidth) {
952
+ if (this._freed)
953
+ return;
858
954
  if (minWidth !== undefined) {
859
955
  yg.ygNodeStyleSetMinWidthPercent(this.ptr, minWidth);
860
956
  }
861
957
  }
862
958
  setMinHeight(minHeight) {
959
+ if (this._freed)
960
+ return;
863
961
  const { unit, asNumber } = parseValue(minHeight);
864
962
  if (unit === Unit.Percent) {
865
963
  yg.ygNodeStyleSetMinHeightPercent(this.ptr, asNumber);
@@ -868,11 +966,15 @@ class Node {
868
966
  }
869
967
  }
870
968
  setMinHeightPercent(minHeight) {
969
+ if (this._freed)
970
+ return;
871
971
  if (minHeight !== undefined) {
872
972
  yg.ygNodeStyleSetMinHeightPercent(this.ptr, minHeight);
873
973
  }
874
974
  }
875
975
  setMaxWidth(maxWidth) {
976
+ if (this._freed)
977
+ return;
876
978
  const { unit, asNumber } = parseValue(maxWidth);
877
979
  if (unit === Unit.Percent) {
878
980
  yg.ygNodeStyleSetMaxWidthPercent(this.ptr, asNumber);
@@ -881,11 +983,15 @@ class Node {
881
983
  }
882
984
  }
883
985
  setMaxWidthPercent(maxWidth) {
986
+ if (this._freed)
987
+ return;
884
988
  if (maxWidth !== undefined) {
885
989
  yg.ygNodeStyleSetMaxWidthPercent(this.ptr, maxWidth);
886
990
  }
887
991
  }
888
992
  setMaxHeight(maxHeight) {
993
+ if (this._freed)
994
+ return;
889
995
  const { unit, asNumber } = parseValue(maxHeight);
890
996
  if (unit === Unit.Percent) {
891
997
  yg.ygNodeStyleSetMaxHeightPercent(this.ptr, asNumber);
@@ -894,52 +1000,82 @@ class Node {
894
1000
  }
895
1001
  }
896
1002
  setMaxHeightPercent(maxHeight) {
1003
+ if (this._freed)
1004
+ return;
897
1005
  if (maxHeight !== undefined) {
898
1006
  yg.ygNodeStyleSetMaxHeightPercent(this.ptr, maxHeight);
899
1007
  }
900
1008
  }
901
1009
  setAspectRatio(aspectRatio) {
1010
+ if (this._freed)
1011
+ return;
902
1012
  if (aspectRatio !== undefined) {
903
1013
  yg.ygNodeStyleSetAspectRatio(this.ptr, aspectRatio);
904
1014
  }
905
1015
  }
906
1016
  getAspectRatio() {
1017
+ if (this._freed)
1018
+ return NaN;
907
1019
  return yg.ygNodeStyleGetAspectRatio(this.ptr);
908
1020
  }
909
1021
  getWidth() {
1022
+ if (this._freed)
1023
+ return UNDEFINED_VALUE;
910
1024
  return unpackValue(yg.ygNodeStyleGetWidthPacked(this.ptr));
911
1025
  }
912
1026
  getHeight() {
1027
+ if (this._freed)
1028
+ return UNDEFINED_VALUE;
913
1029
  return unpackValue(yg.ygNodeStyleGetHeightPacked(this.ptr));
914
1030
  }
915
1031
  getMinWidth() {
1032
+ if (this._freed)
1033
+ return UNDEFINED_VALUE;
916
1034
  return unpackValue(yg.ygNodeStyleGetMinWidthPacked(this.ptr));
917
1035
  }
918
1036
  getMinHeight() {
1037
+ if (this._freed)
1038
+ return UNDEFINED_VALUE;
919
1039
  return unpackValue(yg.ygNodeStyleGetMinHeightPacked(this.ptr));
920
1040
  }
921
1041
  getMaxWidth() {
1042
+ if (this._freed)
1043
+ return UNDEFINED_VALUE;
922
1044
  return unpackValue(yg.ygNodeStyleGetMaxWidthPacked(this.ptr));
923
1045
  }
924
1046
  getMaxHeight() {
1047
+ if (this._freed)
1048
+ return UNDEFINED_VALUE;
925
1049
  return unpackValue(yg.ygNodeStyleGetMaxHeightPacked(this.ptr));
926
1050
  }
927
1051
  getMargin(edge) {
1052
+ if (this._freed)
1053
+ return UNDEFINED_VALUE;
928
1054
  return unpackValue(yg.ygNodeStyleGetMarginPacked(this.ptr, edge));
929
1055
  }
930
1056
  getPadding(edge) {
1057
+ if (this._freed)
1058
+ return UNDEFINED_VALUE;
931
1059
  return unpackValue(yg.ygNodeStyleGetPaddingPacked(this.ptr, edge));
932
1060
  }
933
1061
  getPosition(edge) {
1062
+ if (this._freed)
1063
+ return UNDEFINED_VALUE;
934
1064
  return unpackValue(yg.ygNodeStyleGetPositionPacked(this.ptr, edge));
935
1065
  }
936
1066
  getGap(gutter) {
1067
+ if (this._freed)
1068
+ return UNDEFINED_VALUE;
937
1069
  return unpackValue(yg.ygNodeStyleGetGapPacked(this.ptr, gutter));
938
1070
  }
939
1071
  getFlexBasis() {
1072
+ if (this._freed)
1073
+ return UNDEFINED_VALUE;
940
1074
  return unpackValue(yg.ygNodeStyleGetFlexBasisPacked(this.ptr));
941
1075
  }
942
1076
  setMeasureFunc(measureFunc) {
1077
+ if (this._freed)
1078
+ return;
943
1079
  this.unsetMeasureFunc();
944
1080
  if (measureFunc) {
945
1081
  this.measureCallback = new JSCallback((nodePtr, width, widthMode, height, heightMode) => {
@@ -961,6 +1097,8 @@ class Node {
961
1097
  }
962
1098
  }
963
1099
  unsetMeasureFunc() {
1100
+ if (this._freed)
1101
+ return;
964
1102
  if (this.measureCallback) {
965
1103
  this.measureCallback.close();
966
1104
  this.measureCallback = null;
@@ -968,9 +1106,13 @@ class Node {
968
1106
  yg.ygNodeUnsetMeasureFuncTrampoline(this.ptr);
969
1107
  }
970
1108
  hasMeasureFunc() {
1109
+ if (this._freed)
1110
+ return false;
971
1111
  return yg.ygNodeHasMeasureFunc(this.ptr);
972
1112
  }
973
1113
  setBaselineFunc(baselineFunc) {
1114
+ if (this._freed)
1115
+ return;
974
1116
  this.unsetBaselineFunc();
975
1117
  if (baselineFunc) {
976
1118
  this.baselineCallback = new JSCallback((nodePtr, width, height) => {
@@ -986,6 +1128,8 @@ class Node {
986
1128
  }
987
1129
  }
988
1130
  unsetBaselineFunc() {
1131
+ if (this._freed)
1132
+ return;
989
1133
  if (this.baselineCallback) {
990
1134
  this.baselineCallback.close();
991
1135
  this.baselineCallback = null;
@@ -993,9 +1137,13 @@ class Node {
993
1137
  yg.ygNodeUnsetBaselineFuncTrampoline(this.ptr);
994
1138
  }
995
1139
  hasBaselineFunc() {
1140
+ if (this._freed)
1141
+ return false;
996
1142
  return yg.ygNodeHasBaselineFunc(this.ptr);
997
1143
  }
998
1144
  setDirtiedFunc(dirtiedFunc) {
1145
+ if (this._freed)
1146
+ return;
999
1147
  this.unsetDirtiedFunc();
1000
1148
  if (dirtiedFunc) {
1001
1149
  const node = this;
@@ -1011,6 +1159,8 @@ class Node {
1011
1159
  }
1012
1160
  }
1013
1161
  unsetDirtiedFunc() {
1162
+ if (this._freed)
1163
+ return;
1014
1164
  if (this.dirtiedCallback) {
1015
1165
  this.dirtiedCallback.close();
1016
1166
  this.dirtiedCallback = null;
@@ -1018,6 +1168,8 @@ class Node {
1018
1168
  yg.ygNodeUnsetDirtiedFunc(this.ptr);
1019
1169
  }
1020
1170
  hasDirtiedFunc() {
1171
+ if (this._freed)
1172
+ return false;
1021
1173
  return yg.ygNodeGetDirtiedFunc(this.ptr) !== null;
1022
1174
  }
1023
1175
  }
@@ -8371,15 +8523,15 @@ class TerminalPalette {
8371
8523
  writeFn;
8372
8524
  activeListeners = [];
8373
8525
  activeTimers = [];
8374
- inTmux;
8375
- constructor(stdin, stdout, writeFn, isTmux) {
8526
+ inLegacyTmux;
8527
+ constructor(stdin, stdout, writeFn, isLegacyTmux) {
8376
8528
  this.stdin = stdin;
8377
8529
  this.stdout = stdout;
8378
8530
  this.writeFn = writeFn || ((data) => stdout.write(data));
8379
- this.inTmux = isTmux ?? false;
8531
+ this.inLegacyTmux = isLegacyTmux ?? false;
8380
8532
  }
8381
8533
  writeOsc(osc) {
8382
- const data = this.inTmux ? wrapForTmux(osc) : osc;
8534
+ const data = this.inLegacyTmux ? wrapForTmux(osc) : osc;
8383
8535
  return this.writeFn(data);
8384
8536
  }
8385
8537
  cleanup() {
@@ -8616,8 +8768,8 @@ class TerminalPalette {
8616
8768
  };
8617
8769
  }
8618
8770
  }
8619
- function createTerminalPalette(stdin, stdout, writeFn, isTmux) {
8620
- return new TerminalPalette(stdin, stdout, writeFn, isTmux);
8771
+ function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux) {
8772
+ return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux);
8621
8773
  }
8622
8774
  // src/zig.ts
8623
8775
  import { dlopen as dlopen2, toArrayBuffer as toArrayBuffer4, JSCallback as JSCallback2, ptr as ptr3 } from "bun:ffi";
@@ -15079,6 +15231,10 @@ Captured output:
15079
15231
  } catch (error) {
15080
15232
  console.error("Error in frame callback:", error);
15081
15233
  }
15234
+ if (this._isDestroyed) {
15235
+ this.rendering = false;
15236
+ return;
15237
+ }
15082
15238
  }
15083
15239
  const end = performance.now();
15084
15240
  this.renderStats.frameCallbackTime = end - start;
@@ -15281,8 +15437,8 @@ Captured output:
15281
15437
  return this._paletteDetectionPromise;
15282
15438
  }
15283
15439
  if (!this._paletteDetector) {
15284
- const isTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux");
15285
- this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isTmux);
15440
+ const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
15441
+ this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isLegacyTmux);
15286
15442
  }
15287
15443
  this._paletteDetectionPromise = this._paletteDetector.detect(options).then((result) => {
15288
15444
  this._cachedPalette = result;
@@ -15293,7 +15449,7 @@ Captured output:
15293
15449
  }
15294
15450
  }
15295
15451
 
15296
- export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_dist, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
15452
+ export { Edge, Gutter, MeasureMode, exports_dist, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, hastToStyledText, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
15297
15453
 
15298
- //# debugId=3153067811E5610D64756E2164756E21
15299
- //# sourceMappingURL=index-533e9nca.js.map
15454
+ //# debugId=1623532973D99D8964756E2164756E21
15455
+ //# sourceMappingURL=index-re80811e.js.map