@opentui/core 0.1.13 → 0.1.14

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/index.js CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  Gutter,
12
12
  KeyHandler,
13
13
  LayoutEvents,
14
+ LogLevel,
14
15
  MeasureMode,
15
16
  MouseButton,
16
17
  MouseEvent,
@@ -74,9 +75,10 @@ import {
74
75
  isDimensionType,
75
76
  isFlexBasisType,
76
77
  isMarginType,
78
+ isOverflowType,
77
79
  isPaddingType,
78
80
  isPositionType,
79
- isPostionTypeType,
81
+ isPositionTypeType,
80
82
  isSizeType,
81
83
  isVNode,
82
84
  isValidPercentage,
@@ -115,7 +117,7 @@ import {
115
117
  white,
116
118
  wrapWithDelegates,
117
119
  yellow
118
- } from "./index-4gez9k7q.js";
120
+ } from "./index-rv93tneq.js";
119
121
  // src/post/filters.ts
120
122
  function applyScanlines(buffer, strength = 0.8, step = 2) {
121
123
  const width = buffer.width;
@@ -958,6 +960,7 @@ class Timeline {
958
960
  autoplay;
959
961
  onComplete;
960
962
  onPause;
963
+ stateChangeListeners = [];
961
964
  constructor(options = {}) {
962
965
  this.duration = options.duration || 1000;
963
966
  this.loop = options.loop === true;
@@ -965,6 +968,17 @@ class Timeline {
965
968
  this.onComplete = options.onComplete;
966
969
  this.onPause = options.onPause;
967
970
  }
971
+ addStateChangeListener(listener) {
972
+ this.stateChangeListeners.push(listener);
973
+ }
974
+ removeStateChangeListener(listener) {
975
+ this.stateChangeListeners = this.stateChangeListeners.filter((l) => l !== listener);
976
+ }
977
+ notifyStateChange() {
978
+ for (const listener of this.stateChangeListeners) {
979
+ listener(this);
980
+ }
981
+ }
968
982
  add(target, properties, startTime = 0) {
969
983
  const resolvedStartTime = typeof startTime === "string" ? 0 : startTime;
970
984
  const animationProperties = {};
@@ -1036,6 +1050,7 @@ class Timeline {
1036
1050
  }
1037
1051
  });
1038
1052
  this.isPlaying = true;
1053
+ this.notifyStateChange();
1039
1054
  return this;
1040
1055
  }
1041
1056
  pause() {
@@ -1046,6 +1061,7 @@ class Timeline {
1046
1061
  if (this.onPause) {
1047
1062
  this.onPause();
1048
1063
  }
1064
+ this.notifyStateChange();
1049
1065
  return this;
1050
1066
  }
1051
1067
  resetItems() {
@@ -1071,6 +1087,7 @@ class Timeline {
1071
1087
  this.currentTime = 0;
1072
1088
  this.isPlaying = true;
1073
1089
  this.resetItems();
1090
+ this.notifyStateChange();
1074
1091
  return this;
1075
1092
  }
1076
1093
  update(deltaTime) {
@@ -1103,23 +1120,75 @@ class Timeline {
1103
1120
  if (this.onComplete) {
1104
1121
  this.onComplete();
1105
1122
  }
1123
+ this.notifyStateChange();
1106
1124
  }
1107
1125
  }
1108
1126
  }
1109
1127
 
1110
1128
  class TimelineEngine {
1111
1129
  timelines = new Set;
1130
+ renderer = null;
1131
+ frameCallback = null;
1132
+ isLive = false;
1112
1133
  defaults = {
1113
1134
  frameRate: 60
1114
1135
  };
1136
+ attach(renderer) {
1137
+ if (this.renderer) {
1138
+ this.detach();
1139
+ }
1140
+ this.renderer = renderer;
1141
+ this.frameCallback = async (deltaTime) => {
1142
+ this.update(deltaTime);
1143
+ };
1144
+ renderer.setFrameCallback(this.frameCallback);
1145
+ }
1146
+ detach() {
1147
+ if (this.renderer && this.frameCallback) {
1148
+ this.renderer.removeFrameCallback(this.frameCallback);
1149
+ if (this.isLive) {
1150
+ this.renderer.dropLive();
1151
+ this.isLive = false;
1152
+ }
1153
+ }
1154
+ this.renderer = null;
1155
+ this.frameCallback = null;
1156
+ }
1157
+ updateLiveState() {
1158
+ if (!this.renderer)
1159
+ return;
1160
+ const hasRunningTimelines = Array.from(this.timelines).some((timeline) => !timeline.synced && timeline.isPlaying && !timeline.isComplete);
1161
+ if (hasRunningTimelines && !this.isLive) {
1162
+ this.renderer.requestLive();
1163
+ this.isLive = true;
1164
+ } else if (!hasRunningTimelines && this.isLive) {
1165
+ this.renderer.dropLive();
1166
+ this.isLive = false;
1167
+ }
1168
+ }
1169
+ onTimelineStateChange = (timeline) => {
1170
+ this.updateLiveState();
1171
+ };
1115
1172
  register(timeline) {
1116
- this.timelines.add(timeline);
1173
+ if (!this.timelines.has(timeline)) {
1174
+ this.timelines.add(timeline);
1175
+ timeline.addStateChangeListener(this.onTimelineStateChange);
1176
+ this.updateLiveState();
1177
+ }
1117
1178
  }
1118
1179
  unregister(timeline) {
1119
- this.timelines.delete(timeline);
1180
+ if (this.timelines.has(timeline)) {
1181
+ this.timelines.delete(timeline);
1182
+ timeline.removeStateChangeListener(this.onTimelineStateChange);
1183
+ this.updateLiveState();
1184
+ }
1120
1185
  }
1121
1186
  clear() {
1187
+ for (const timeline of this.timelines) {
1188
+ timeline.removeStateChangeListener(this.onTimelineStateChange);
1189
+ }
1122
1190
  this.timelines.clear();
1191
+ this.updateLiveState();
1123
1192
  }
1124
1193
  update(deltaTime) {
1125
1194
  for (const timeline of this.timelines) {
@@ -1198,7 +1267,7 @@ class BoxRenderable extends Renderable {
1198
1267
  set customBorderChars(value) {
1199
1268
  this._customBorderCharsObj = value;
1200
1269
  this._customBorderChars = value ? borderCharsToArray(value) : undefined;
1201
- this.needsUpdate();
1270
+ this.requestRender();
1202
1271
  }
1203
1272
  get backgroundColor() {
1204
1273
  return this._backgroundColor;
@@ -1207,7 +1276,7 @@ class BoxRenderable extends Renderable {
1207
1276
  const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
1208
1277
  if (this._backgroundColor !== newColor) {
1209
1278
  this._backgroundColor = newColor;
1210
- this.needsUpdate();
1279
+ this.requestRender();
1211
1280
  }
1212
1281
  }
1213
1282
  get border() {
@@ -1218,7 +1287,7 @@ class BoxRenderable extends Renderable {
1218
1287
  this._border = value;
1219
1288
  this.borderSides = getBorderSides(value);
1220
1289
  this.applyYogaBorders();
1221
- this.needsUpdate();
1290
+ this.requestRender();
1222
1291
  }
1223
1292
  }
1224
1293
  get borderStyle() {
@@ -1229,7 +1298,7 @@ class BoxRenderable extends Renderable {
1229
1298
  if (this._borderStyle !== _value) {
1230
1299
  this._borderStyle = _value;
1231
1300
  this._customBorderChars = undefined;
1232
- this.needsUpdate();
1301
+ this.requestRender();
1233
1302
  }
1234
1303
  }
1235
1304
  get borderColor() {
@@ -1239,7 +1308,7 @@ class BoxRenderable extends Renderable {
1239
1308
  const newColor = parseColor(value ?? this._defaultOptions.borderColor);
1240
1309
  if (this._borderColor !== newColor) {
1241
1310
  this._borderColor = newColor;
1242
- this.needsUpdate();
1311
+ this.requestRender();
1243
1312
  }
1244
1313
  }
1245
1314
  get focusedBorderColor() {
@@ -1250,7 +1319,7 @@ class BoxRenderable extends Renderable {
1250
1319
  if (this._focusedBorderColor !== newColor) {
1251
1320
  this._focusedBorderColor = newColor;
1252
1321
  if (this._focused) {
1253
- this.needsUpdate();
1322
+ this.requestRender();
1254
1323
  }
1255
1324
  }
1256
1325
  }
@@ -1260,7 +1329,7 @@ class BoxRenderable extends Renderable {
1260
1329
  set title(value) {
1261
1330
  if (this._title !== value) {
1262
1331
  this._title = value;
1263
- this.needsUpdate();
1332
+ this.requestRender();
1264
1333
  }
1265
1334
  }
1266
1335
  get titleAlignment() {
@@ -1269,7 +1338,7 @@ class BoxRenderable extends Renderable {
1269
1338
  set titleAlignment(value) {
1270
1339
  if (this._titleAlignment !== value) {
1271
1340
  this._titleAlignment = value;
1272
- this.needsUpdate();
1341
+ this.requestRender();
1273
1342
  }
1274
1343
  }
1275
1344
  renderSelf(buffer) {
@@ -1289,13 +1358,29 @@ class BoxRenderable extends Renderable {
1289
1358
  titleAlignment: this._titleAlignment
1290
1359
  });
1291
1360
  }
1361
+ getScissorRect() {
1362
+ const baseRect = super.getScissorRect();
1363
+ if (!this.borderSides.top && !this.borderSides.right && !this.borderSides.bottom && !this.borderSides.left) {
1364
+ return baseRect;
1365
+ }
1366
+ const leftInset = this.borderSides.left ? 1 : 0;
1367
+ const rightInset = this.borderSides.right ? 1 : 0;
1368
+ const topInset = this.borderSides.top ? 1 : 0;
1369
+ const bottomInset = this.borderSides.bottom ? 1 : 0;
1370
+ return {
1371
+ x: baseRect.x + leftInset,
1372
+ y: baseRect.y + topInset,
1373
+ width: Math.max(0, baseRect.width - leftInset - rightInset),
1374
+ height: Math.max(0, baseRect.height - topInset - bottomInset)
1375
+ };
1376
+ }
1292
1377
  applyYogaBorders() {
1293
1378
  const node = this.layoutNode.yogaNode;
1294
1379
  node.setBorder(Edge.Left, this.borderSides.left ? 1 : 0);
1295
1380
  node.setBorder(Edge.Right, this.borderSides.right ? 1 : 0);
1296
1381
  node.setBorder(Edge.Top, this.borderSides.top ? 1 : 0);
1297
1382
  node.setBorder(Edge.Bottom, this.borderSides.bottom ? 1 : 0);
1298
- this.needsUpdate();
1383
+ this.requestRender();
1299
1384
  }
1300
1385
  applyYogaGap(options) {
1301
1386
  const node = this.layoutNode.yogaNode;
@@ -1312,19 +1397,19 @@ class BoxRenderable extends Renderable {
1312
1397
  set gap(gap) {
1313
1398
  if (isGapType(gap)) {
1314
1399
  this.layoutNode.yogaNode.setGap(Gutter.All, gap);
1315
- this.needsUpdate();
1400
+ this.requestRender();
1316
1401
  }
1317
1402
  }
1318
1403
  set rowGap(rowGap) {
1319
1404
  if (isGapType(rowGap)) {
1320
1405
  this.layoutNode.yogaNode.setGap(Gutter.Row, rowGap);
1321
- this.needsUpdate();
1406
+ this.requestRender();
1322
1407
  }
1323
1408
  }
1324
1409
  set columnGap(columnGap) {
1325
1410
  if (isGapType(columnGap)) {
1326
1411
  this.layoutNode.yogaNode.setGap(Gutter.Column, columnGap);
1327
- this.needsUpdate();
1412
+ this.requestRender();
1328
1413
  }
1329
1414
  }
1330
1415
  }
@@ -1336,7 +1421,8 @@ class FrameBufferRenderable extends Renderable {
1336
1421
  super(ctx, options);
1337
1422
  this.respectAlpha = options.respectAlpha || false;
1338
1423
  this.frameBuffer = OptimizedBuffer.create(options.width, options.height, this._ctx.widthMethod, {
1339
- respectAlpha: this.respectAlpha
1424
+ respectAlpha: this.respectAlpha,
1425
+ id: options.id || `framebufferrenderable-${this.id}`
1340
1426
  });
1341
1427
  }
1342
1428
  onResize(width, height) {
@@ -1345,7 +1431,7 @@ class FrameBufferRenderable extends Renderable {
1345
1431
  }
1346
1432
  this.frameBuffer.resize(width, height);
1347
1433
  super.onResize(width, height);
1348
- this.needsUpdate();
1434
+ this.requestRender();
1349
1435
  }
1350
1436
  renderSelf(buffer) {
1351
1437
  if (!this.visible)
@@ -1370,17 +1456,26 @@ class TextRenderable extends Renderable {
1370
1456
  textBuffer;
1371
1457
  _plainText = "";
1372
1458
  _lineInfo = { lineStarts: [], lineWidths: [] };
1459
+ _defaultOptions = {
1460
+ content: "",
1461
+ fg: RGBA.fromValues(1, 1, 1, 1),
1462
+ bg: RGBA.fromValues(0, 0, 0, 0),
1463
+ selectionBg: undefined,
1464
+ selectionFg: undefined,
1465
+ selectable: true,
1466
+ attributes: 0
1467
+ };
1373
1468
  constructor(ctx, options) {
1374
1469
  super(ctx, options);
1375
1470
  this.selectionHelper = new TextSelectionHelper(() => this.x, () => this.y, () => this._plainText.length, () => this._lineInfo);
1376
- const content = options.content ?? "";
1471
+ const content = options.content ?? this._defaultOptions.content;
1377
1472
  this._text = typeof content === "string" ? stringToStyledText(content) : content;
1378
- this._defaultFg = options.fg ? parseColor(options.fg) : RGBA.fromValues(1, 1, 1, 1);
1379
- this._defaultBg = options.bg ? parseColor(options.bg) : RGBA.fromValues(0, 0, 0, 0);
1380
- this._defaultAttributes = options.attributes ?? 0;
1381
- this._selectionBg = options.selectionBg ? parseColor(options.selectionBg) : undefined;
1382
- this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) : undefined;
1383
- this.selectable = options.selectable ?? true;
1473
+ this._defaultFg = parseColor(options.fg ?? this._defaultOptions.fg);
1474
+ this._defaultBg = parseColor(options.bg ?? this._defaultOptions.bg);
1475
+ this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
1476
+ this._selectionBg = options.selectionBg ? parseColor(options.selectionBg) : this._defaultOptions.selectionBg;
1477
+ this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) : this._defaultOptions.selectionFg;
1478
+ this.selectable = options.selectable ?? this._defaultOptions.selectable;
1384
1479
  this.textBuffer = TextBuffer.create(64, this._ctx.widthMethod);
1385
1480
  this.textBuffer.setDefaultFg(this._defaultFg);
1386
1481
  this.textBuffer.setDefaultBg(this._defaultBg);
@@ -1399,35 +1494,61 @@ class TextRenderable extends Renderable {
1399
1494
  return this._defaultFg;
1400
1495
  }
1401
1496
  set fg(value) {
1402
- if (value) {
1403
- this._defaultFg = parseColor(value);
1497
+ const newColor = parseColor(value ?? this._defaultOptions.fg);
1498
+ if (this._defaultFg !== newColor) {
1499
+ this._defaultFg = newColor;
1404
1500
  this.textBuffer.setDefaultFg(this._defaultFg);
1405
- this.needsUpdate();
1501
+ this.requestRender();
1502
+ }
1503
+ }
1504
+ get selectionBg() {
1505
+ return this._selectionBg;
1506
+ }
1507
+ set selectionBg(value) {
1508
+ const newColor = value ? parseColor(value) : this._defaultOptions.selectionBg;
1509
+ if (this._selectionBg !== newColor) {
1510
+ this._selectionBg = newColor;
1511
+ this.syncSelectionToTextBuffer();
1512
+ this.requestRender();
1513
+ }
1514
+ }
1515
+ get selectionFg() {
1516
+ return this._selectionFg;
1517
+ }
1518
+ set selectionFg(value) {
1519
+ const newColor = value ? parseColor(value) : this._defaultOptions.selectionFg;
1520
+ if (this._selectionFg !== newColor) {
1521
+ this._selectionFg = newColor;
1522
+ this.syncSelectionToTextBuffer();
1523
+ this.requestRender();
1406
1524
  }
1407
1525
  }
1408
1526
  get bg() {
1409
1527
  return this._defaultBg;
1410
1528
  }
1411
1529
  set bg(value) {
1412
- if (value) {
1413
- this._defaultBg = parseColor(value);
1530
+ const newColor = parseColor(value ?? this._defaultOptions.bg);
1531
+ if (this._defaultBg !== newColor) {
1532
+ this._defaultBg = newColor;
1414
1533
  this.textBuffer.setDefaultBg(this._defaultBg);
1415
- this.needsUpdate();
1534
+ this.requestRender();
1416
1535
  }
1417
1536
  }
1418
1537
  get attributes() {
1419
1538
  return this._defaultAttributes;
1420
1539
  }
1421
1540
  set attributes(value) {
1422
- this._defaultAttributes = value;
1423
- this.textBuffer.setDefaultAttributes(this._defaultAttributes);
1424
- this.needsUpdate();
1541
+ if (this._defaultAttributes !== value) {
1542
+ this._defaultAttributes = value;
1543
+ this.textBuffer.setDefaultAttributes(this._defaultAttributes);
1544
+ this.requestRender();
1545
+ }
1425
1546
  }
1426
1547
  onResize(width, height) {
1427
1548
  const changed = this.selectionHelper.reevaluateSelection(width, height);
1428
1549
  if (changed) {
1429
1550
  this.syncSelectionToTextBuffer();
1430
- this.needsUpdate();
1551
+ this.requestRender();
1431
1552
  }
1432
1553
  }
1433
1554
  syncSelectionToTextBuffer() {
@@ -1449,7 +1570,7 @@ class TextRenderable extends Renderable {
1449
1570
  this.syncSelectionToTextBuffer();
1450
1571
  }
1451
1572
  this.layoutNode.yogaNode.markDirty();
1452
- this.needsUpdate();
1573
+ this.requestRender();
1453
1574
  }
1454
1575
  setupMeasureFunc() {
1455
1576
  const measureFunc = (width, widthMode, height, heightMode) => {
@@ -1481,7 +1602,7 @@ class TextRenderable extends Renderable {
1481
1602
  const changed = this.selectionHelper.onSelectionChanged(selection, this.width, this.height);
1482
1603
  if (changed) {
1483
1604
  this.syncSelectionToTextBuffer();
1484
- this.needsUpdate();
1605
+ this.requestRender();
1485
1606
  }
1486
1607
  return this.selectionHelper.hasSelection();
1487
1608
  }
@@ -1551,7 +1672,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
1551
1672
  this.updateDimensions();
1552
1673
  this.selectionHelper.reevaluateSelection(this.width, this.height);
1553
1674
  this.renderFontToBuffer();
1554
- this.needsUpdate();
1675
+ this.requestRender();
1555
1676
  }
1556
1677
  get font() {
1557
1678
  return this._font;
@@ -1561,7 +1682,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
1561
1682
  this.updateDimensions();
1562
1683
  this.selectionHelper.reevaluateSelection(this.width, this.height);
1563
1684
  this.renderFontToBuffer();
1564
- this.needsUpdate();
1685
+ this.requestRender();
1565
1686
  }
1566
1687
  get fg() {
1567
1688
  return this._fg;
@@ -1573,7 +1694,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
1573
1694
  this._fg = [typeof value === "string" ? parseColor(value) : value];
1574
1695
  }
1575
1696
  this.renderFontToBuffer();
1576
- this.needsUpdate();
1697
+ this.requestRender();
1577
1698
  }
1578
1699
  get bg() {
1579
1700
  return this._bg;
@@ -1581,7 +1702,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
1581
1702
  set bg(value) {
1582
1703
  this._bg = typeof value === "string" ? parseColor(value) : value;
1583
1704
  this.renderFontToBuffer();
1584
- this.needsUpdate();
1705
+ this.requestRender();
1585
1706
  }
1586
1707
  updateDimensions() {
1587
1708
  const measurements = measureText({ text: this._text, font: this._font });
@@ -1595,7 +1716,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
1595
1716
  const changed = this.selectionHelper.onSelectionChanged(selection, this.width, this.height);
1596
1717
  if (changed) {
1597
1718
  this.renderFontToBuffer();
1598
- this.needsUpdate();
1719
+ this.requestRender();
1599
1720
  }
1600
1721
  return this.selectionHelper.hasSelection();
1601
1722
  }
@@ -1771,7 +1892,7 @@ class InputRenderable extends Renderable {
1771
1892
  if (this._value !== newValue) {
1772
1893
  this._value = newValue;
1773
1894
  this._cursorPosition = Math.min(this._cursorPosition, this._value.length);
1774
- this.needsUpdate();
1895
+ this.requestRender();
1775
1896
  this.updateCursorPosition();
1776
1897
  this.emit("input" /* INPUT */, this._value);
1777
1898
  }
@@ -1779,14 +1900,14 @@ class InputRenderable extends Renderable {
1779
1900
  set placeholder(placeholder) {
1780
1901
  if (this._placeholder !== placeholder) {
1781
1902
  this._placeholder = placeholder;
1782
- this.needsUpdate();
1903
+ this.requestRender();
1783
1904
  }
1784
1905
  }
1785
1906
  set cursorPosition(position) {
1786
1907
  const newPosition = Math.max(0, Math.min(position, this._value.length));
1787
1908
  if (this._cursorPosition !== newPosition) {
1788
1909
  this._cursorPosition = newPosition;
1789
- this.needsUpdate();
1910
+ this.requestRender();
1790
1911
  this.updateCursorPosition();
1791
1912
  }
1792
1913
  }
@@ -1798,7 +1919,7 @@ class InputRenderable extends Renderable {
1798
1919
  const afterCursor = this._value.substring(this._cursorPosition);
1799
1920
  this._value = beforeCursor + text + afterCursor;
1800
1921
  this._cursorPosition += text.length;
1801
- this.needsUpdate();
1922
+ this.requestRender();
1802
1923
  this.updateCursorPosition();
1803
1924
  this.emit("input" /* INPUT */, this._value);
1804
1925
  }
@@ -1808,14 +1929,14 @@ class InputRenderable extends Renderable {
1808
1929
  const afterCursor = this._value.substring(this._cursorPosition);
1809
1930
  this._value = beforeCursor + afterCursor;
1810
1931
  this._cursorPosition--;
1811
- this.needsUpdate();
1932
+ this.requestRender();
1812
1933
  this.updateCursorPosition();
1813
1934
  this.emit("input" /* INPUT */, this._value);
1814
1935
  } else if (direction === "forward" && this._cursorPosition < this._value.length) {
1815
1936
  const beforeCursor = this._value.substring(0, this._cursorPosition);
1816
1937
  const afterCursor = this._value.substring(this._cursorPosition + 1);
1817
1938
  this._value = beforeCursor + afterCursor;
1818
- this.needsUpdate();
1939
+ this.requestRender();
1819
1940
  this.updateCursorPosition();
1820
1941
  this.emit("input" /* INPUT */, this._value);
1821
1942
  }
@@ -1863,49 +1984,49 @@ class InputRenderable extends Renderable {
1863
1984
  this._maxLength = maxLength;
1864
1985
  if (this._value.length > maxLength) {
1865
1986
  this._value = this._value.substring(0, maxLength);
1866
- this.needsUpdate();
1987
+ this.requestRender();
1867
1988
  }
1868
1989
  }
1869
1990
  set backgroundColor(value) {
1870
1991
  const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
1871
1992
  if (this._backgroundColor !== newColor) {
1872
1993
  this._backgroundColor = newColor;
1873
- this.needsUpdate();
1994
+ this.requestRender();
1874
1995
  }
1875
1996
  }
1876
1997
  set textColor(value) {
1877
1998
  const newColor = parseColor(value ?? this._defaultOptions.textColor);
1878
1999
  if (this._textColor !== newColor) {
1879
2000
  this._textColor = newColor;
1880
- this.needsUpdate();
2001
+ this.requestRender();
1881
2002
  }
1882
2003
  }
1883
2004
  set focusedBackgroundColor(value) {
1884
2005
  const newColor = parseColor(value ?? this._defaultOptions.focusedBackgroundColor);
1885
2006
  if (this._focusedBackgroundColor !== newColor) {
1886
2007
  this._focusedBackgroundColor = newColor;
1887
- this.needsUpdate();
2008
+ this.requestRender();
1888
2009
  }
1889
2010
  }
1890
2011
  set focusedTextColor(value) {
1891
2012
  const newColor = parseColor(value ?? this._defaultOptions.focusedTextColor);
1892
2013
  if (this._focusedTextColor !== newColor) {
1893
2014
  this._focusedTextColor = newColor;
1894
- this.needsUpdate();
2015
+ this.requestRender();
1895
2016
  }
1896
2017
  }
1897
2018
  set placeholderColor(value) {
1898
2019
  const newColor = parseColor(value ?? this._defaultOptions.placeholderColor);
1899
2020
  if (this._placeholderColor !== newColor) {
1900
2021
  this._placeholderColor = newColor;
1901
- this.needsUpdate();
2022
+ this.requestRender();
1902
2023
  }
1903
2024
  }
1904
2025
  set cursorColor(value) {
1905
2026
  const newColor = parseColor(value ?? this._defaultOptions.cursorColor);
1906
2027
  if (this._cursorColor !== newColor) {
1907
2028
  this._cursorColor = newColor;
1908
- this.needsUpdate();
2029
+ this.requestRender();
1909
2030
  }
1910
2031
  }
1911
2032
  updateFromLayout() {
@@ -1990,7 +2111,7 @@ class SelectRenderable extends Renderable {
1990
2111
  this._descriptionColor = parseColor(options.descriptionColor || this._defaultOptions.descriptionColor);
1991
2112
  this._selectedDescriptionColor = parseColor(options.selectedDescriptionColor || this._defaultOptions.selectedDescriptionColor);
1992
2113
  this._fastScrollStep = options.fastScrollStep || this._defaultOptions.fastScrollStep;
1993
- this.needsUpdate();
2114
+ this.requestRender();
1994
2115
  }
1995
2116
  renderSelf(buffer, deltaTime) {
1996
2117
  if (!this.visible || !this.frameBuffer)
@@ -2066,7 +2187,7 @@ class SelectRenderable extends Renderable {
2066
2187
  this._options = options;
2067
2188
  this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
2068
2189
  this.updateScrollOffset();
2069
- this.needsUpdate();
2190
+ this.requestRender();
2070
2191
  }
2071
2192
  getSelectedOption() {
2072
2193
  return this._options[this.selectedIndex] || null;
@@ -2084,7 +2205,7 @@ class SelectRenderable extends Renderable {
2084
2205
  this.selectedIndex = 0;
2085
2206
  }
2086
2207
  this.updateScrollOffset();
2087
- this.needsUpdate();
2208
+ this.requestRender();
2088
2209
  this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
2089
2210
  }
2090
2211
  moveDown(steps = 1) {
@@ -2097,7 +2218,7 @@ class SelectRenderable extends Renderable {
2097
2218
  this.selectedIndex = this._options.length - 1;
2098
2219
  }
2099
2220
  this.updateScrollOffset();
2100
- this.needsUpdate();
2221
+ this.requestRender();
2101
2222
  this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
2102
2223
  }
2103
2224
  selectCurrent() {
@@ -2110,7 +2231,7 @@ class SelectRenderable extends Renderable {
2110
2231
  if (index >= 0 && index < this._options.length) {
2111
2232
  this.selectedIndex = index;
2112
2233
  this.updateScrollOffset();
2113
- this.needsUpdate();
2234
+ this.requestRender();
2114
2235
  this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
2115
2236
  }
2116
2237
  }
@@ -2121,13 +2242,13 @@ class SelectRenderable extends Renderable {
2121
2242
  const newScrollOffset = Math.max(0, Math.min(this.selectedIndex - halfVisible, this._options.length - this.maxVisibleItems));
2122
2243
  if (newScrollOffset !== this.scrollOffset) {
2123
2244
  this.scrollOffset = newScrollOffset;
2124
- this.needsUpdate();
2245
+ this.requestRender();
2125
2246
  }
2126
2247
  }
2127
2248
  onResize(width, height) {
2128
2249
  this.maxVisibleItems = Math.max(1, Math.floor(height / this.linesPerItem));
2129
2250
  this.updateScrollOffset();
2130
- this.needsUpdate();
2251
+ this.requestRender();
2131
2252
  }
2132
2253
  handleKeyPress(key) {
2133
2254
  const keyName = typeof key === "string" ? key : key.name;
@@ -2153,7 +2274,7 @@ class SelectRenderable extends Renderable {
2153
2274
  }
2154
2275
  set showScrollIndicator(show) {
2155
2276
  this._showScrollIndicator = show;
2156
- this.needsUpdate();
2277
+ this.requestRender();
2157
2278
  }
2158
2279
  get showDescription() {
2159
2280
  return this._showDescription;
@@ -2165,7 +2286,7 @@ class SelectRenderable extends Renderable {
2165
2286
  this.linesPerItem += this._itemSpacing;
2166
2287
  this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
2167
2288
  this.updateScrollOffset();
2168
- this.needsUpdate();
2289
+ this.requestRender();
2169
2290
  }
2170
2291
  }
2171
2292
  get wrapSelection() {
@@ -2178,56 +2299,56 @@ class SelectRenderable extends Renderable {
2178
2299
  const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
2179
2300
  if (this._backgroundColor !== newColor) {
2180
2301
  this._backgroundColor = newColor;
2181
- this.needsUpdate();
2302
+ this.requestRender();
2182
2303
  }
2183
2304
  }
2184
2305
  set textColor(value) {
2185
2306
  const newColor = parseColor(value ?? this._defaultOptions.textColor);
2186
2307
  if (this._textColor !== newColor) {
2187
2308
  this._textColor = newColor;
2188
- this.needsUpdate();
2309
+ this.requestRender();
2189
2310
  }
2190
2311
  }
2191
2312
  set focusedBackgroundColor(value) {
2192
2313
  const newColor = parseColor(value ?? this._defaultOptions.focusedBackgroundColor);
2193
2314
  if (this._focusedBackgroundColor !== newColor) {
2194
2315
  this._focusedBackgroundColor = newColor;
2195
- this.needsUpdate();
2316
+ this.requestRender();
2196
2317
  }
2197
2318
  }
2198
2319
  set focusedTextColor(value) {
2199
2320
  const newColor = parseColor(value ?? this._defaultOptions.focusedTextColor);
2200
2321
  if (this._focusedTextColor !== newColor) {
2201
2322
  this._focusedTextColor = newColor;
2202
- this.needsUpdate();
2323
+ this.requestRender();
2203
2324
  }
2204
2325
  }
2205
2326
  set selectedBackgroundColor(value) {
2206
2327
  const newColor = parseColor(value ?? this._defaultOptions.selectedBackgroundColor);
2207
2328
  if (this._selectedBackgroundColor !== newColor) {
2208
2329
  this._selectedBackgroundColor = newColor;
2209
- this.needsUpdate();
2330
+ this.requestRender();
2210
2331
  }
2211
2332
  }
2212
2333
  set selectedTextColor(value) {
2213
2334
  const newColor = parseColor(value ?? this._defaultOptions.selectedTextColor);
2214
2335
  if (this._selectedTextColor !== newColor) {
2215
2336
  this._selectedTextColor = newColor;
2216
- this.needsUpdate();
2337
+ this.requestRender();
2217
2338
  }
2218
2339
  }
2219
2340
  set descriptionColor(value) {
2220
2341
  const newColor = parseColor(value ?? this._defaultOptions.descriptionColor);
2221
2342
  if (this._descriptionColor !== newColor) {
2222
2343
  this._descriptionColor = newColor;
2223
- this.needsUpdate();
2344
+ this.requestRender();
2224
2345
  }
2225
2346
  }
2226
2347
  set selectedDescriptionColor(value) {
2227
2348
  const newColor = parseColor(value ?? this._defaultOptions.selectedDescriptionColor);
2228
2349
  if (this._selectedDescriptionColor !== newColor) {
2229
2350
  this._selectedDescriptionColor = newColor;
2230
- this.needsUpdate();
2351
+ this.requestRender();
2231
2352
  }
2232
2353
  }
2233
2354
  set font(font) {
@@ -2237,7 +2358,7 @@ class SelectRenderable extends Renderable {
2237
2358
  this.linesPerItem += this._itemSpacing;
2238
2359
  this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
2239
2360
  this.updateScrollOffset();
2240
- this.needsUpdate();
2361
+ this.requestRender();
2241
2362
  }
2242
2363
  set itemSpacing(spacing) {
2243
2364
  this._itemSpacing = spacing;
@@ -2245,7 +2366,7 @@ class SelectRenderable extends Renderable {
2245
2366
  this.linesPerItem += this._itemSpacing;
2246
2367
  this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
2247
2368
  this.updateScrollOffset();
2248
- this.needsUpdate();
2369
+ this.requestRender();
2249
2370
  }
2250
2371
  set fastScrollStep(step) {
2251
2372
  this._fastScrollStep = step;
@@ -2379,7 +2500,7 @@ class TabSelectRenderable extends Renderable {
2379
2500
  this._options = options;
2380
2501
  this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
2381
2502
  this.updateScrollOffset();
2382
- this.needsUpdate();
2503
+ this.requestRender();
2383
2504
  }
2384
2505
  getSelectedOption() {
2385
2506
  return this._options[this.selectedIndex] || null;
@@ -2396,7 +2517,7 @@ class TabSelectRenderable extends Renderable {
2396
2517
  return;
2397
2518
  }
2398
2519
  this.updateScrollOffset();
2399
- this.needsUpdate();
2520
+ this.requestRender();
2400
2521
  this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
2401
2522
  }
2402
2523
  moveRight() {
@@ -2408,7 +2529,7 @@ class TabSelectRenderable extends Renderable {
2408
2529
  return;
2409
2530
  }
2410
2531
  this.updateScrollOffset();
2411
- this.needsUpdate();
2532
+ this.requestRender();
2412
2533
  this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
2413
2534
  }
2414
2535
  selectCurrent() {
@@ -2421,7 +2542,7 @@ class TabSelectRenderable extends Renderable {
2421
2542
  if (index >= 0 && index < this._options.length) {
2422
2543
  this.selectedIndex = index;
2423
2544
  this.updateScrollOffset();
2424
- this.needsUpdate();
2545
+ this.requestRender();
2425
2546
  this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
2426
2547
  }
2427
2548
  }
@@ -2430,13 +2551,13 @@ class TabSelectRenderable extends Renderable {
2430
2551
  const newScrollOffset = Math.max(0, Math.min(this.selectedIndex - halfVisible, this._options.length - this.maxVisibleTabs));
2431
2552
  if (newScrollOffset !== this.scrollOffset) {
2432
2553
  this.scrollOffset = newScrollOffset;
2433
- this.needsUpdate();
2554
+ this.requestRender();
2434
2555
  }
2435
2556
  }
2436
2557
  onResize(width, height) {
2437
2558
  this.maxVisibleTabs = Math.max(1, Math.floor(width / this._tabWidth));
2438
2559
  this.updateScrollOffset();
2439
- this.needsUpdate();
2560
+ this.requestRender();
2440
2561
  }
2441
2562
  setTabWidth(tabWidth) {
2442
2563
  if (this._tabWidth === tabWidth)
@@ -2444,7 +2565,7 @@ class TabSelectRenderable extends Renderable {
2444
2565
  this._tabWidth = tabWidth;
2445
2566
  this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
2446
2567
  this.updateScrollOffset();
2447
- this.needsUpdate();
2568
+ this.requestRender();
2448
2569
  }
2449
2570
  getTabWidth() {
2450
2571
  return this._tabWidth;
@@ -2474,35 +2595,35 @@ class TabSelectRenderable extends Renderable {
2474
2595
  this._options = options;
2475
2596
  this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
2476
2597
  this.updateScrollOffset();
2477
- this.needsUpdate();
2598
+ this.requestRender();
2478
2599
  }
2479
2600
  set backgroundColor(color) {
2480
2601
  this._backgroundColor = parseColor(color);
2481
- this.needsUpdate();
2602
+ this.requestRender();
2482
2603
  }
2483
2604
  set textColor(color) {
2484
2605
  this._textColor = parseColor(color);
2485
- this.needsUpdate();
2606
+ this.requestRender();
2486
2607
  }
2487
2608
  set focusedBackgroundColor(color) {
2488
2609
  this._focusedBackgroundColor = parseColor(color);
2489
- this.needsUpdate();
2610
+ this.requestRender();
2490
2611
  }
2491
2612
  set focusedTextColor(color) {
2492
2613
  this._focusedTextColor = parseColor(color);
2493
- this.needsUpdate();
2614
+ this.requestRender();
2494
2615
  }
2495
2616
  set selectedBackgroundColor(color) {
2496
2617
  this._selectedBackgroundColor = parseColor(color);
2497
- this.needsUpdate();
2618
+ this.requestRender();
2498
2619
  }
2499
2620
  set selectedTextColor(color) {
2500
2621
  this._selectedTextColor = parseColor(color);
2501
- this.needsUpdate();
2622
+ this.requestRender();
2502
2623
  }
2503
2624
  set selectedDescriptionColor(color) {
2504
2625
  this._selectedDescriptionColor = parseColor(color);
2505
- this.needsUpdate();
2626
+ this.requestRender();
2506
2627
  }
2507
2628
  get showDescription() {
2508
2629
  return this._showDescription;
@@ -2512,7 +2633,7 @@ class TabSelectRenderable extends Renderable {
2512
2633
  this._showDescription = show;
2513
2634
  const newHeight = this.calculateDynamicHeight();
2514
2635
  this.height = newHeight;
2515
- this.needsUpdate();
2636
+ this.requestRender();
2516
2637
  }
2517
2638
  }
2518
2639
  get showUnderline() {
@@ -2523,7 +2644,7 @@ class TabSelectRenderable extends Renderable {
2523
2644
  this._showUnderline = show;
2524
2645
  const newHeight = this.calculateDynamicHeight();
2525
2646
  this.height = newHeight;
2526
- this.needsUpdate();
2647
+ this.requestRender();
2527
2648
  }
2528
2649
  }
2529
2650
  get showScrollArrows() {
@@ -2532,7 +2653,7 @@ class TabSelectRenderable extends Renderable {
2532
2653
  set showScrollArrows(show) {
2533
2654
  if (this._showScrollArrows !== show) {
2534
2655
  this._showScrollArrows = show;
2535
- this.needsUpdate();
2656
+ this.requestRender();
2536
2657
  }
2537
2658
  }
2538
2659
  get wrapSelection() {
@@ -2550,7 +2671,7 @@ class TabSelectRenderable extends Renderable {
2550
2671
  this._tabWidth = tabWidth;
2551
2672
  this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
2552
2673
  this.updateScrollOffset();
2553
- this.needsUpdate();
2674
+ this.requestRender();
2554
2675
  }
2555
2676
  }
2556
2677
  // src/renderables/composition/constructs.ts
@@ -2630,9 +2751,10 @@ export {
2630
2751
  isValidPercentage,
2631
2752
  isVNode,
2632
2753
  isSizeType,
2633
- isPostionTypeType,
2754
+ isPositionTypeType,
2634
2755
  isPositionType,
2635
2756
  isPaddingType,
2757
+ isOverflowType,
2636
2758
  isMarginType,
2637
2759
  isFlexBasisType,
2638
2760
  isDimensionType,
@@ -2715,6 +2837,7 @@ export {
2715
2837
  MouseParser,
2716
2838
  MouseEvent,
2717
2839
  MouseButton,
2840
+ LogLevel,
2718
2841
  LayoutEvents,
2719
2842
  KeyHandler,
2720
2843
  InputRenderableEvents,
@@ -2740,5 +2863,5 @@ export {
2740
2863
  ASCIIFont
2741
2864
  };
2742
2865
 
2743
- //# debugId=90AD54F99873C73864756E2164756E21
2866
+ //# debugId=673E2078AE4B8BC264756E2164756E21
2744
2867
  //# sourceMappingURL=index.js.map