@opentui/core 0.1.12 → 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/3d.js +1 -1
- package/Renderable.d.ts +30 -9
- package/animation/Timeline.d.ts +11 -0
- package/buffer.d.ts +6 -0
- package/console.d.ts +1 -1
- package/{index-bpwzbxgn.js → index-rv93tneq.js} +290 -99
- package/{index-bpwzbxgn.js.map → index-rv93tneq.js.map} +10 -10
- package/index.js +221 -106
- package/index.js.map +12 -13
- package/lib/KeyHandler.d.ts +6 -1
- package/package.json +7 -7
- package/renderables/Box.d.ts +7 -1
- package/renderables/Text.d.ts +13 -0
- package/renderables/composition/constructs.d.ts +1 -3
- package/renderables/composition/vnode.d.ts +13 -6
- package/renderables/index.d.ts +0 -1
- package/renderer.d.ts +3 -1
- package/types.d.ts +1 -1
- package/zig.d.ts +12 -1
- package/renderables/Group.d.ts +0 -5
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
|
-
|
|
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-
|
|
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.
|
|
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.
|
|
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) {
|
|
@@ -1174,6 +1243,9 @@ class BoxRenderable extends Renderable {
|
|
|
1174
1243
|
super(ctx, options);
|
|
1175
1244
|
this._backgroundColor = parseColor(options.backgroundColor || this._defaultOptions.backgroundColor);
|
|
1176
1245
|
this._border = options.border ?? this._defaultOptions.border;
|
|
1246
|
+
if (!options.border && (options.borderStyle || options.borderColor || options.focusedBorderColor || options.customBorderChars)) {
|
|
1247
|
+
this._border = true;
|
|
1248
|
+
}
|
|
1177
1249
|
this._borderStyle = options.borderStyle || this._defaultOptions.borderStyle;
|
|
1178
1250
|
this._borderColor = parseColor(options.borderColor || this._defaultOptions.borderColor);
|
|
1179
1251
|
this._focusedBorderColor = parseColor(options.focusedBorderColor || this._defaultOptions.focusedBorderColor);
|
|
@@ -1195,7 +1267,7 @@ class BoxRenderable extends Renderable {
|
|
|
1195
1267
|
set customBorderChars(value) {
|
|
1196
1268
|
this._customBorderCharsObj = value;
|
|
1197
1269
|
this._customBorderChars = value ? borderCharsToArray(value) : undefined;
|
|
1198
|
-
this.
|
|
1270
|
+
this.requestRender();
|
|
1199
1271
|
}
|
|
1200
1272
|
get backgroundColor() {
|
|
1201
1273
|
return this._backgroundColor;
|
|
@@ -1204,7 +1276,7 @@ class BoxRenderable extends Renderable {
|
|
|
1204
1276
|
const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
|
|
1205
1277
|
if (this._backgroundColor !== newColor) {
|
|
1206
1278
|
this._backgroundColor = newColor;
|
|
1207
|
-
this.
|
|
1279
|
+
this.requestRender();
|
|
1208
1280
|
}
|
|
1209
1281
|
}
|
|
1210
1282
|
get border() {
|
|
@@ -1215,7 +1287,7 @@ class BoxRenderable extends Renderable {
|
|
|
1215
1287
|
this._border = value;
|
|
1216
1288
|
this.borderSides = getBorderSides(value);
|
|
1217
1289
|
this.applyYogaBorders();
|
|
1218
|
-
this.
|
|
1290
|
+
this.requestRender();
|
|
1219
1291
|
}
|
|
1220
1292
|
}
|
|
1221
1293
|
get borderStyle() {
|
|
@@ -1226,7 +1298,7 @@ class BoxRenderable extends Renderable {
|
|
|
1226
1298
|
if (this._borderStyle !== _value) {
|
|
1227
1299
|
this._borderStyle = _value;
|
|
1228
1300
|
this._customBorderChars = undefined;
|
|
1229
|
-
this.
|
|
1301
|
+
this.requestRender();
|
|
1230
1302
|
}
|
|
1231
1303
|
}
|
|
1232
1304
|
get borderColor() {
|
|
@@ -1236,7 +1308,7 @@ class BoxRenderable extends Renderable {
|
|
|
1236
1308
|
const newColor = parseColor(value ?? this._defaultOptions.borderColor);
|
|
1237
1309
|
if (this._borderColor !== newColor) {
|
|
1238
1310
|
this._borderColor = newColor;
|
|
1239
|
-
this.
|
|
1311
|
+
this.requestRender();
|
|
1240
1312
|
}
|
|
1241
1313
|
}
|
|
1242
1314
|
get focusedBorderColor() {
|
|
@@ -1247,7 +1319,7 @@ class BoxRenderable extends Renderable {
|
|
|
1247
1319
|
if (this._focusedBorderColor !== newColor) {
|
|
1248
1320
|
this._focusedBorderColor = newColor;
|
|
1249
1321
|
if (this._focused) {
|
|
1250
|
-
this.
|
|
1322
|
+
this.requestRender();
|
|
1251
1323
|
}
|
|
1252
1324
|
}
|
|
1253
1325
|
}
|
|
@@ -1257,7 +1329,7 @@ class BoxRenderable extends Renderable {
|
|
|
1257
1329
|
set title(value) {
|
|
1258
1330
|
if (this._title !== value) {
|
|
1259
1331
|
this._title = value;
|
|
1260
|
-
this.
|
|
1332
|
+
this.requestRender();
|
|
1261
1333
|
}
|
|
1262
1334
|
}
|
|
1263
1335
|
get titleAlignment() {
|
|
@@ -1266,7 +1338,7 @@ class BoxRenderable extends Renderable {
|
|
|
1266
1338
|
set titleAlignment(value) {
|
|
1267
1339
|
if (this._titleAlignment !== value) {
|
|
1268
1340
|
this._titleAlignment = value;
|
|
1269
|
-
this.
|
|
1341
|
+
this.requestRender();
|
|
1270
1342
|
}
|
|
1271
1343
|
}
|
|
1272
1344
|
renderSelf(buffer) {
|
|
@@ -1286,13 +1358,29 @@ class BoxRenderable extends Renderable {
|
|
|
1286
1358
|
titleAlignment: this._titleAlignment
|
|
1287
1359
|
});
|
|
1288
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
|
+
}
|
|
1289
1377
|
applyYogaBorders() {
|
|
1290
1378
|
const node = this.layoutNode.yogaNode;
|
|
1291
1379
|
node.setBorder(Edge.Left, this.borderSides.left ? 1 : 0);
|
|
1292
1380
|
node.setBorder(Edge.Right, this.borderSides.right ? 1 : 0);
|
|
1293
1381
|
node.setBorder(Edge.Top, this.borderSides.top ? 1 : 0);
|
|
1294
1382
|
node.setBorder(Edge.Bottom, this.borderSides.bottom ? 1 : 0);
|
|
1295
|
-
this.
|
|
1383
|
+
this.requestRender();
|
|
1296
1384
|
}
|
|
1297
1385
|
applyYogaGap(options) {
|
|
1298
1386
|
const node = this.layoutNode.yogaNode;
|
|
@@ -1309,19 +1397,19 @@ class BoxRenderable extends Renderable {
|
|
|
1309
1397
|
set gap(gap) {
|
|
1310
1398
|
if (isGapType(gap)) {
|
|
1311
1399
|
this.layoutNode.yogaNode.setGap(Gutter.All, gap);
|
|
1312
|
-
this.
|
|
1400
|
+
this.requestRender();
|
|
1313
1401
|
}
|
|
1314
1402
|
}
|
|
1315
1403
|
set rowGap(rowGap) {
|
|
1316
1404
|
if (isGapType(rowGap)) {
|
|
1317
1405
|
this.layoutNode.yogaNode.setGap(Gutter.Row, rowGap);
|
|
1318
|
-
this.
|
|
1406
|
+
this.requestRender();
|
|
1319
1407
|
}
|
|
1320
1408
|
}
|
|
1321
1409
|
set columnGap(columnGap) {
|
|
1322
1410
|
if (isGapType(columnGap)) {
|
|
1323
1411
|
this.layoutNode.yogaNode.setGap(Gutter.Column, columnGap);
|
|
1324
|
-
this.
|
|
1412
|
+
this.requestRender();
|
|
1325
1413
|
}
|
|
1326
1414
|
}
|
|
1327
1415
|
}
|
|
@@ -1333,7 +1421,8 @@ class FrameBufferRenderable extends Renderable {
|
|
|
1333
1421
|
super(ctx, options);
|
|
1334
1422
|
this.respectAlpha = options.respectAlpha || false;
|
|
1335
1423
|
this.frameBuffer = OptimizedBuffer.create(options.width, options.height, this._ctx.widthMethod, {
|
|
1336
|
-
respectAlpha: this.respectAlpha
|
|
1424
|
+
respectAlpha: this.respectAlpha,
|
|
1425
|
+
id: options.id || `framebufferrenderable-${this.id}`
|
|
1337
1426
|
});
|
|
1338
1427
|
}
|
|
1339
1428
|
onResize(width, height) {
|
|
@@ -1342,7 +1431,7 @@ class FrameBufferRenderable extends Renderable {
|
|
|
1342
1431
|
}
|
|
1343
1432
|
this.frameBuffer.resize(width, height);
|
|
1344
1433
|
super.onResize(width, height);
|
|
1345
|
-
this.
|
|
1434
|
+
this.requestRender();
|
|
1346
1435
|
}
|
|
1347
1436
|
renderSelf(buffer) {
|
|
1348
1437
|
if (!this.visible)
|
|
@@ -1354,12 +1443,6 @@ class FrameBufferRenderable extends Renderable {
|
|
|
1354
1443
|
super.destroySelf();
|
|
1355
1444
|
}
|
|
1356
1445
|
}
|
|
1357
|
-
// src/renderables/Group.ts
|
|
1358
|
-
class GroupRenderable extends Renderable {
|
|
1359
|
-
constructor(ctx, options) {
|
|
1360
|
-
super(ctx, options);
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
1446
|
// src/renderables/Text.ts
|
|
1364
1447
|
class TextRenderable extends Renderable {
|
|
1365
1448
|
selectable = true;
|
|
@@ -1373,17 +1456,26 @@ class TextRenderable extends Renderable {
|
|
|
1373
1456
|
textBuffer;
|
|
1374
1457
|
_plainText = "";
|
|
1375
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
|
+
};
|
|
1376
1468
|
constructor(ctx, options) {
|
|
1377
1469
|
super(ctx, options);
|
|
1378
1470
|
this.selectionHelper = new TextSelectionHelper(() => this.x, () => this.y, () => this._plainText.length, () => this._lineInfo);
|
|
1379
|
-
const content = options.content ??
|
|
1471
|
+
const content = options.content ?? this._defaultOptions.content;
|
|
1380
1472
|
this._text = typeof content === "string" ? stringToStyledText(content) : content;
|
|
1381
|
-
this._defaultFg =
|
|
1382
|
-
this._defaultBg =
|
|
1383
|
-
this._defaultAttributes = options.attributes ??
|
|
1384
|
-
this._selectionBg = options.selectionBg ? parseColor(options.selectionBg) :
|
|
1385
|
-
this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) :
|
|
1386
|
-
this.selectable = options.selectable ??
|
|
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;
|
|
1387
1479
|
this.textBuffer = TextBuffer.create(64, this._ctx.widthMethod);
|
|
1388
1480
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
1389
1481
|
this.textBuffer.setDefaultBg(this._defaultBg);
|
|
@@ -1402,35 +1494,61 @@ class TextRenderable extends Renderable {
|
|
|
1402
1494
|
return this._defaultFg;
|
|
1403
1495
|
}
|
|
1404
1496
|
set fg(value) {
|
|
1405
|
-
|
|
1406
|
-
|
|
1497
|
+
const newColor = parseColor(value ?? this._defaultOptions.fg);
|
|
1498
|
+
if (this._defaultFg !== newColor) {
|
|
1499
|
+
this._defaultFg = newColor;
|
|
1407
1500
|
this.textBuffer.setDefaultFg(this._defaultFg);
|
|
1408
|
-
this.
|
|
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();
|
|
1409
1524
|
}
|
|
1410
1525
|
}
|
|
1411
1526
|
get bg() {
|
|
1412
1527
|
return this._defaultBg;
|
|
1413
1528
|
}
|
|
1414
1529
|
set bg(value) {
|
|
1415
|
-
|
|
1416
|
-
|
|
1530
|
+
const newColor = parseColor(value ?? this._defaultOptions.bg);
|
|
1531
|
+
if (this._defaultBg !== newColor) {
|
|
1532
|
+
this._defaultBg = newColor;
|
|
1417
1533
|
this.textBuffer.setDefaultBg(this._defaultBg);
|
|
1418
|
-
this.
|
|
1534
|
+
this.requestRender();
|
|
1419
1535
|
}
|
|
1420
1536
|
}
|
|
1421
1537
|
get attributes() {
|
|
1422
1538
|
return this._defaultAttributes;
|
|
1423
1539
|
}
|
|
1424
1540
|
set attributes(value) {
|
|
1425
|
-
this._defaultAttributes
|
|
1426
|
-
|
|
1427
|
-
|
|
1541
|
+
if (this._defaultAttributes !== value) {
|
|
1542
|
+
this._defaultAttributes = value;
|
|
1543
|
+
this.textBuffer.setDefaultAttributes(this._defaultAttributes);
|
|
1544
|
+
this.requestRender();
|
|
1545
|
+
}
|
|
1428
1546
|
}
|
|
1429
1547
|
onResize(width, height) {
|
|
1430
1548
|
const changed = this.selectionHelper.reevaluateSelection(width, height);
|
|
1431
1549
|
if (changed) {
|
|
1432
1550
|
this.syncSelectionToTextBuffer();
|
|
1433
|
-
this.
|
|
1551
|
+
this.requestRender();
|
|
1434
1552
|
}
|
|
1435
1553
|
}
|
|
1436
1554
|
syncSelectionToTextBuffer() {
|
|
@@ -1452,7 +1570,7 @@ class TextRenderable extends Renderable {
|
|
|
1452
1570
|
this.syncSelectionToTextBuffer();
|
|
1453
1571
|
}
|
|
1454
1572
|
this.layoutNode.yogaNode.markDirty();
|
|
1455
|
-
this.
|
|
1573
|
+
this.requestRender();
|
|
1456
1574
|
}
|
|
1457
1575
|
setupMeasureFunc() {
|
|
1458
1576
|
const measureFunc = (width, widthMode, height, heightMode) => {
|
|
@@ -1484,7 +1602,7 @@ class TextRenderable extends Renderable {
|
|
|
1484
1602
|
const changed = this.selectionHelper.onSelectionChanged(selection, this.width, this.height);
|
|
1485
1603
|
if (changed) {
|
|
1486
1604
|
this.syncSelectionToTextBuffer();
|
|
1487
|
-
this.
|
|
1605
|
+
this.requestRender();
|
|
1488
1606
|
}
|
|
1489
1607
|
return this.selectionHelper.hasSelection();
|
|
1490
1608
|
}
|
|
@@ -1554,7 +1672,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
1554
1672
|
this.updateDimensions();
|
|
1555
1673
|
this.selectionHelper.reevaluateSelection(this.width, this.height);
|
|
1556
1674
|
this.renderFontToBuffer();
|
|
1557
|
-
this.
|
|
1675
|
+
this.requestRender();
|
|
1558
1676
|
}
|
|
1559
1677
|
get font() {
|
|
1560
1678
|
return this._font;
|
|
@@ -1564,7 +1682,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
1564
1682
|
this.updateDimensions();
|
|
1565
1683
|
this.selectionHelper.reevaluateSelection(this.width, this.height);
|
|
1566
1684
|
this.renderFontToBuffer();
|
|
1567
|
-
this.
|
|
1685
|
+
this.requestRender();
|
|
1568
1686
|
}
|
|
1569
1687
|
get fg() {
|
|
1570
1688
|
return this._fg;
|
|
@@ -1576,7 +1694,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
1576
1694
|
this._fg = [typeof value === "string" ? parseColor(value) : value];
|
|
1577
1695
|
}
|
|
1578
1696
|
this.renderFontToBuffer();
|
|
1579
|
-
this.
|
|
1697
|
+
this.requestRender();
|
|
1580
1698
|
}
|
|
1581
1699
|
get bg() {
|
|
1582
1700
|
return this._bg;
|
|
@@ -1584,7 +1702,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
1584
1702
|
set bg(value) {
|
|
1585
1703
|
this._bg = typeof value === "string" ? parseColor(value) : value;
|
|
1586
1704
|
this.renderFontToBuffer();
|
|
1587
|
-
this.
|
|
1705
|
+
this.requestRender();
|
|
1588
1706
|
}
|
|
1589
1707
|
updateDimensions() {
|
|
1590
1708
|
const measurements = measureText({ text: this._text, font: this._font });
|
|
@@ -1598,7 +1716,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
|
1598
1716
|
const changed = this.selectionHelper.onSelectionChanged(selection, this.width, this.height);
|
|
1599
1717
|
if (changed) {
|
|
1600
1718
|
this.renderFontToBuffer();
|
|
1601
|
-
this.
|
|
1719
|
+
this.requestRender();
|
|
1602
1720
|
}
|
|
1603
1721
|
return this.selectionHelper.hasSelection();
|
|
1604
1722
|
}
|
|
@@ -1774,7 +1892,7 @@ class InputRenderable extends Renderable {
|
|
|
1774
1892
|
if (this._value !== newValue) {
|
|
1775
1893
|
this._value = newValue;
|
|
1776
1894
|
this._cursorPosition = Math.min(this._cursorPosition, this._value.length);
|
|
1777
|
-
this.
|
|
1895
|
+
this.requestRender();
|
|
1778
1896
|
this.updateCursorPosition();
|
|
1779
1897
|
this.emit("input" /* INPUT */, this._value);
|
|
1780
1898
|
}
|
|
@@ -1782,14 +1900,14 @@ class InputRenderable extends Renderable {
|
|
|
1782
1900
|
set placeholder(placeholder) {
|
|
1783
1901
|
if (this._placeholder !== placeholder) {
|
|
1784
1902
|
this._placeholder = placeholder;
|
|
1785
|
-
this.
|
|
1903
|
+
this.requestRender();
|
|
1786
1904
|
}
|
|
1787
1905
|
}
|
|
1788
1906
|
set cursorPosition(position) {
|
|
1789
1907
|
const newPosition = Math.max(0, Math.min(position, this._value.length));
|
|
1790
1908
|
if (this._cursorPosition !== newPosition) {
|
|
1791
1909
|
this._cursorPosition = newPosition;
|
|
1792
|
-
this.
|
|
1910
|
+
this.requestRender();
|
|
1793
1911
|
this.updateCursorPosition();
|
|
1794
1912
|
}
|
|
1795
1913
|
}
|
|
@@ -1801,7 +1919,7 @@ class InputRenderable extends Renderable {
|
|
|
1801
1919
|
const afterCursor = this._value.substring(this._cursorPosition);
|
|
1802
1920
|
this._value = beforeCursor + text + afterCursor;
|
|
1803
1921
|
this._cursorPosition += text.length;
|
|
1804
|
-
this.
|
|
1922
|
+
this.requestRender();
|
|
1805
1923
|
this.updateCursorPosition();
|
|
1806
1924
|
this.emit("input" /* INPUT */, this._value);
|
|
1807
1925
|
}
|
|
@@ -1811,14 +1929,14 @@ class InputRenderable extends Renderable {
|
|
|
1811
1929
|
const afterCursor = this._value.substring(this._cursorPosition);
|
|
1812
1930
|
this._value = beforeCursor + afterCursor;
|
|
1813
1931
|
this._cursorPosition--;
|
|
1814
|
-
this.
|
|
1932
|
+
this.requestRender();
|
|
1815
1933
|
this.updateCursorPosition();
|
|
1816
1934
|
this.emit("input" /* INPUT */, this._value);
|
|
1817
1935
|
} else if (direction === "forward" && this._cursorPosition < this._value.length) {
|
|
1818
1936
|
const beforeCursor = this._value.substring(0, this._cursorPosition);
|
|
1819
1937
|
const afterCursor = this._value.substring(this._cursorPosition + 1);
|
|
1820
1938
|
this._value = beforeCursor + afterCursor;
|
|
1821
|
-
this.
|
|
1939
|
+
this.requestRender();
|
|
1822
1940
|
this.updateCursorPosition();
|
|
1823
1941
|
this.emit("input" /* INPUT */, this._value);
|
|
1824
1942
|
}
|
|
@@ -1866,49 +1984,49 @@ class InputRenderable extends Renderable {
|
|
|
1866
1984
|
this._maxLength = maxLength;
|
|
1867
1985
|
if (this._value.length > maxLength) {
|
|
1868
1986
|
this._value = this._value.substring(0, maxLength);
|
|
1869
|
-
this.
|
|
1987
|
+
this.requestRender();
|
|
1870
1988
|
}
|
|
1871
1989
|
}
|
|
1872
1990
|
set backgroundColor(value) {
|
|
1873
1991
|
const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
|
|
1874
1992
|
if (this._backgroundColor !== newColor) {
|
|
1875
1993
|
this._backgroundColor = newColor;
|
|
1876
|
-
this.
|
|
1994
|
+
this.requestRender();
|
|
1877
1995
|
}
|
|
1878
1996
|
}
|
|
1879
1997
|
set textColor(value) {
|
|
1880
1998
|
const newColor = parseColor(value ?? this._defaultOptions.textColor);
|
|
1881
1999
|
if (this._textColor !== newColor) {
|
|
1882
2000
|
this._textColor = newColor;
|
|
1883
|
-
this.
|
|
2001
|
+
this.requestRender();
|
|
1884
2002
|
}
|
|
1885
2003
|
}
|
|
1886
2004
|
set focusedBackgroundColor(value) {
|
|
1887
2005
|
const newColor = parseColor(value ?? this._defaultOptions.focusedBackgroundColor);
|
|
1888
2006
|
if (this._focusedBackgroundColor !== newColor) {
|
|
1889
2007
|
this._focusedBackgroundColor = newColor;
|
|
1890
|
-
this.
|
|
2008
|
+
this.requestRender();
|
|
1891
2009
|
}
|
|
1892
2010
|
}
|
|
1893
2011
|
set focusedTextColor(value) {
|
|
1894
2012
|
const newColor = parseColor(value ?? this._defaultOptions.focusedTextColor);
|
|
1895
2013
|
if (this._focusedTextColor !== newColor) {
|
|
1896
2014
|
this._focusedTextColor = newColor;
|
|
1897
|
-
this.
|
|
2015
|
+
this.requestRender();
|
|
1898
2016
|
}
|
|
1899
2017
|
}
|
|
1900
2018
|
set placeholderColor(value) {
|
|
1901
2019
|
const newColor = parseColor(value ?? this._defaultOptions.placeholderColor);
|
|
1902
2020
|
if (this._placeholderColor !== newColor) {
|
|
1903
2021
|
this._placeholderColor = newColor;
|
|
1904
|
-
this.
|
|
2022
|
+
this.requestRender();
|
|
1905
2023
|
}
|
|
1906
2024
|
}
|
|
1907
2025
|
set cursorColor(value) {
|
|
1908
2026
|
const newColor = parseColor(value ?? this._defaultOptions.cursorColor);
|
|
1909
2027
|
if (this._cursorColor !== newColor) {
|
|
1910
2028
|
this._cursorColor = newColor;
|
|
1911
|
-
this.
|
|
2029
|
+
this.requestRender();
|
|
1912
2030
|
}
|
|
1913
2031
|
}
|
|
1914
2032
|
updateFromLayout() {
|
|
@@ -1993,7 +2111,7 @@ class SelectRenderable extends Renderable {
|
|
|
1993
2111
|
this._descriptionColor = parseColor(options.descriptionColor || this._defaultOptions.descriptionColor);
|
|
1994
2112
|
this._selectedDescriptionColor = parseColor(options.selectedDescriptionColor || this._defaultOptions.selectedDescriptionColor);
|
|
1995
2113
|
this._fastScrollStep = options.fastScrollStep || this._defaultOptions.fastScrollStep;
|
|
1996
|
-
this.
|
|
2114
|
+
this.requestRender();
|
|
1997
2115
|
}
|
|
1998
2116
|
renderSelf(buffer, deltaTime) {
|
|
1999
2117
|
if (!this.visible || !this.frameBuffer)
|
|
@@ -2069,7 +2187,7 @@ class SelectRenderable extends Renderable {
|
|
|
2069
2187
|
this._options = options;
|
|
2070
2188
|
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
|
|
2071
2189
|
this.updateScrollOffset();
|
|
2072
|
-
this.
|
|
2190
|
+
this.requestRender();
|
|
2073
2191
|
}
|
|
2074
2192
|
getSelectedOption() {
|
|
2075
2193
|
return this._options[this.selectedIndex] || null;
|
|
@@ -2087,7 +2205,7 @@ class SelectRenderable extends Renderable {
|
|
|
2087
2205
|
this.selectedIndex = 0;
|
|
2088
2206
|
}
|
|
2089
2207
|
this.updateScrollOffset();
|
|
2090
|
-
this.
|
|
2208
|
+
this.requestRender();
|
|
2091
2209
|
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
|
|
2092
2210
|
}
|
|
2093
2211
|
moveDown(steps = 1) {
|
|
@@ -2100,7 +2218,7 @@ class SelectRenderable extends Renderable {
|
|
|
2100
2218
|
this.selectedIndex = this._options.length - 1;
|
|
2101
2219
|
}
|
|
2102
2220
|
this.updateScrollOffset();
|
|
2103
|
-
this.
|
|
2221
|
+
this.requestRender();
|
|
2104
2222
|
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
|
|
2105
2223
|
}
|
|
2106
2224
|
selectCurrent() {
|
|
@@ -2113,7 +2231,7 @@ class SelectRenderable extends Renderable {
|
|
|
2113
2231
|
if (index >= 0 && index < this._options.length) {
|
|
2114
2232
|
this.selectedIndex = index;
|
|
2115
2233
|
this.updateScrollOffset();
|
|
2116
|
-
this.
|
|
2234
|
+
this.requestRender();
|
|
2117
2235
|
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
|
|
2118
2236
|
}
|
|
2119
2237
|
}
|
|
@@ -2124,13 +2242,13 @@ class SelectRenderable extends Renderable {
|
|
|
2124
2242
|
const newScrollOffset = Math.max(0, Math.min(this.selectedIndex - halfVisible, this._options.length - this.maxVisibleItems));
|
|
2125
2243
|
if (newScrollOffset !== this.scrollOffset) {
|
|
2126
2244
|
this.scrollOffset = newScrollOffset;
|
|
2127
|
-
this.
|
|
2245
|
+
this.requestRender();
|
|
2128
2246
|
}
|
|
2129
2247
|
}
|
|
2130
2248
|
onResize(width, height) {
|
|
2131
2249
|
this.maxVisibleItems = Math.max(1, Math.floor(height / this.linesPerItem));
|
|
2132
2250
|
this.updateScrollOffset();
|
|
2133
|
-
this.
|
|
2251
|
+
this.requestRender();
|
|
2134
2252
|
}
|
|
2135
2253
|
handleKeyPress(key) {
|
|
2136
2254
|
const keyName = typeof key === "string" ? key : key.name;
|
|
@@ -2156,7 +2274,7 @@ class SelectRenderable extends Renderable {
|
|
|
2156
2274
|
}
|
|
2157
2275
|
set showScrollIndicator(show) {
|
|
2158
2276
|
this._showScrollIndicator = show;
|
|
2159
|
-
this.
|
|
2277
|
+
this.requestRender();
|
|
2160
2278
|
}
|
|
2161
2279
|
get showDescription() {
|
|
2162
2280
|
return this._showDescription;
|
|
@@ -2168,7 +2286,7 @@ class SelectRenderable extends Renderable {
|
|
|
2168
2286
|
this.linesPerItem += this._itemSpacing;
|
|
2169
2287
|
this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
|
|
2170
2288
|
this.updateScrollOffset();
|
|
2171
|
-
this.
|
|
2289
|
+
this.requestRender();
|
|
2172
2290
|
}
|
|
2173
2291
|
}
|
|
2174
2292
|
get wrapSelection() {
|
|
@@ -2181,56 +2299,56 @@ class SelectRenderable extends Renderable {
|
|
|
2181
2299
|
const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
|
|
2182
2300
|
if (this._backgroundColor !== newColor) {
|
|
2183
2301
|
this._backgroundColor = newColor;
|
|
2184
|
-
this.
|
|
2302
|
+
this.requestRender();
|
|
2185
2303
|
}
|
|
2186
2304
|
}
|
|
2187
2305
|
set textColor(value) {
|
|
2188
2306
|
const newColor = parseColor(value ?? this._defaultOptions.textColor);
|
|
2189
2307
|
if (this._textColor !== newColor) {
|
|
2190
2308
|
this._textColor = newColor;
|
|
2191
|
-
this.
|
|
2309
|
+
this.requestRender();
|
|
2192
2310
|
}
|
|
2193
2311
|
}
|
|
2194
2312
|
set focusedBackgroundColor(value) {
|
|
2195
2313
|
const newColor = parseColor(value ?? this._defaultOptions.focusedBackgroundColor);
|
|
2196
2314
|
if (this._focusedBackgroundColor !== newColor) {
|
|
2197
2315
|
this._focusedBackgroundColor = newColor;
|
|
2198
|
-
this.
|
|
2316
|
+
this.requestRender();
|
|
2199
2317
|
}
|
|
2200
2318
|
}
|
|
2201
2319
|
set focusedTextColor(value) {
|
|
2202
2320
|
const newColor = parseColor(value ?? this._defaultOptions.focusedTextColor);
|
|
2203
2321
|
if (this._focusedTextColor !== newColor) {
|
|
2204
2322
|
this._focusedTextColor = newColor;
|
|
2205
|
-
this.
|
|
2323
|
+
this.requestRender();
|
|
2206
2324
|
}
|
|
2207
2325
|
}
|
|
2208
2326
|
set selectedBackgroundColor(value) {
|
|
2209
2327
|
const newColor = parseColor(value ?? this._defaultOptions.selectedBackgroundColor);
|
|
2210
2328
|
if (this._selectedBackgroundColor !== newColor) {
|
|
2211
2329
|
this._selectedBackgroundColor = newColor;
|
|
2212
|
-
this.
|
|
2330
|
+
this.requestRender();
|
|
2213
2331
|
}
|
|
2214
2332
|
}
|
|
2215
2333
|
set selectedTextColor(value) {
|
|
2216
2334
|
const newColor = parseColor(value ?? this._defaultOptions.selectedTextColor);
|
|
2217
2335
|
if (this._selectedTextColor !== newColor) {
|
|
2218
2336
|
this._selectedTextColor = newColor;
|
|
2219
|
-
this.
|
|
2337
|
+
this.requestRender();
|
|
2220
2338
|
}
|
|
2221
2339
|
}
|
|
2222
2340
|
set descriptionColor(value) {
|
|
2223
2341
|
const newColor = parseColor(value ?? this._defaultOptions.descriptionColor);
|
|
2224
2342
|
if (this._descriptionColor !== newColor) {
|
|
2225
2343
|
this._descriptionColor = newColor;
|
|
2226
|
-
this.
|
|
2344
|
+
this.requestRender();
|
|
2227
2345
|
}
|
|
2228
2346
|
}
|
|
2229
2347
|
set selectedDescriptionColor(value) {
|
|
2230
2348
|
const newColor = parseColor(value ?? this._defaultOptions.selectedDescriptionColor);
|
|
2231
2349
|
if (this._selectedDescriptionColor !== newColor) {
|
|
2232
2350
|
this._selectedDescriptionColor = newColor;
|
|
2233
|
-
this.
|
|
2351
|
+
this.requestRender();
|
|
2234
2352
|
}
|
|
2235
2353
|
}
|
|
2236
2354
|
set font(font) {
|
|
@@ -2240,7 +2358,7 @@ class SelectRenderable extends Renderable {
|
|
|
2240
2358
|
this.linesPerItem += this._itemSpacing;
|
|
2241
2359
|
this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
|
|
2242
2360
|
this.updateScrollOffset();
|
|
2243
|
-
this.
|
|
2361
|
+
this.requestRender();
|
|
2244
2362
|
}
|
|
2245
2363
|
set itemSpacing(spacing) {
|
|
2246
2364
|
this._itemSpacing = spacing;
|
|
@@ -2248,7 +2366,7 @@ class SelectRenderable extends Renderable {
|
|
|
2248
2366
|
this.linesPerItem += this._itemSpacing;
|
|
2249
2367
|
this.maxVisibleItems = Math.max(1, Math.floor(this.height / this.linesPerItem));
|
|
2250
2368
|
this.updateScrollOffset();
|
|
2251
|
-
this.
|
|
2369
|
+
this.requestRender();
|
|
2252
2370
|
}
|
|
2253
2371
|
set fastScrollStep(step) {
|
|
2254
2372
|
this._fastScrollStep = step;
|
|
@@ -2382,7 +2500,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2382
2500
|
this._options = options;
|
|
2383
2501
|
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
|
|
2384
2502
|
this.updateScrollOffset();
|
|
2385
|
-
this.
|
|
2503
|
+
this.requestRender();
|
|
2386
2504
|
}
|
|
2387
2505
|
getSelectedOption() {
|
|
2388
2506
|
return this._options[this.selectedIndex] || null;
|
|
@@ -2399,7 +2517,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2399
2517
|
return;
|
|
2400
2518
|
}
|
|
2401
2519
|
this.updateScrollOffset();
|
|
2402
|
-
this.
|
|
2520
|
+
this.requestRender();
|
|
2403
2521
|
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
|
|
2404
2522
|
}
|
|
2405
2523
|
moveRight() {
|
|
@@ -2411,7 +2529,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2411
2529
|
return;
|
|
2412
2530
|
}
|
|
2413
2531
|
this.updateScrollOffset();
|
|
2414
|
-
this.
|
|
2532
|
+
this.requestRender();
|
|
2415
2533
|
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
|
|
2416
2534
|
}
|
|
2417
2535
|
selectCurrent() {
|
|
@@ -2424,7 +2542,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2424
2542
|
if (index >= 0 && index < this._options.length) {
|
|
2425
2543
|
this.selectedIndex = index;
|
|
2426
2544
|
this.updateScrollOffset();
|
|
2427
|
-
this.
|
|
2545
|
+
this.requestRender();
|
|
2428
2546
|
this.emit("selectionChanged" /* SELECTION_CHANGED */, this.selectedIndex, this.getSelectedOption());
|
|
2429
2547
|
}
|
|
2430
2548
|
}
|
|
@@ -2433,13 +2551,13 @@ class TabSelectRenderable extends Renderable {
|
|
|
2433
2551
|
const newScrollOffset = Math.max(0, Math.min(this.selectedIndex - halfVisible, this._options.length - this.maxVisibleTabs));
|
|
2434
2552
|
if (newScrollOffset !== this.scrollOffset) {
|
|
2435
2553
|
this.scrollOffset = newScrollOffset;
|
|
2436
|
-
this.
|
|
2554
|
+
this.requestRender();
|
|
2437
2555
|
}
|
|
2438
2556
|
}
|
|
2439
2557
|
onResize(width, height) {
|
|
2440
2558
|
this.maxVisibleTabs = Math.max(1, Math.floor(width / this._tabWidth));
|
|
2441
2559
|
this.updateScrollOffset();
|
|
2442
|
-
this.
|
|
2560
|
+
this.requestRender();
|
|
2443
2561
|
}
|
|
2444
2562
|
setTabWidth(tabWidth) {
|
|
2445
2563
|
if (this._tabWidth === tabWidth)
|
|
@@ -2447,7 +2565,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2447
2565
|
this._tabWidth = tabWidth;
|
|
2448
2566
|
this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
|
|
2449
2567
|
this.updateScrollOffset();
|
|
2450
|
-
this.
|
|
2568
|
+
this.requestRender();
|
|
2451
2569
|
}
|
|
2452
2570
|
getTabWidth() {
|
|
2453
2571
|
return this._tabWidth;
|
|
@@ -2477,35 +2595,35 @@ class TabSelectRenderable extends Renderable {
|
|
|
2477
2595
|
this._options = options;
|
|
2478
2596
|
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
|
|
2479
2597
|
this.updateScrollOffset();
|
|
2480
|
-
this.
|
|
2598
|
+
this.requestRender();
|
|
2481
2599
|
}
|
|
2482
2600
|
set backgroundColor(color) {
|
|
2483
2601
|
this._backgroundColor = parseColor(color);
|
|
2484
|
-
this.
|
|
2602
|
+
this.requestRender();
|
|
2485
2603
|
}
|
|
2486
2604
|
set textColor(color) {
|
|
2487
2605
|
this._textColor = parseColor(color);
|
|
2488
|
-
this.
|
|
2606
|
+
this.requestRender();
|
|
2489
2607
|
}
|
|
2490
2608
|
set focusedBackgroundColor(color) {
|
|
2491
2609
|
this._focusedBackgroundColor = parseColor(color);
|
|
2492
|
-
this.
|
|
2610
|
+
this.requestRender();
|
|
2493
2611
|
}
|
|
2494
2612
|
set focusedTextColor(color) {
|
|
2495
2613
|
this._focusedTextColor = parseColor(color);
|
|
2496
|
-
this.
|
|
2614
|
+
this.requestRender();
|
|
2497
2615
|
}
|
|
2498
2616
|
set selectedBackgroundColor(color) {
|
|
2499
2617
|
this._selectedBackgroundColor = parseColor(color);
|
|
2500
|
-
this.
|
|
2618
|
+
this.requestRender();
|
|
2501
2619
|
}
|
|
2502
2620
|
set selectedTextColor(color) {
|
|
2503
2621
|
this._selectedTextColor = parseColor(color);
|
|
2504
|
-
this.
|
|
2622
|
+
this.requestRender();
|
|
2505
2623
|
}
|
|
2506
2624
|
set selectedDescriptionColor(color) {
|
|
2507
2625
|
this._selectedDescriptionColor = parseColor(color);
|
|
2508
|
-
this.
|
|
2626
|
+
this.requestRender();
|
|
2509
2627
|
}
|
|
2510
2628
|
get showDescription() {
|
|
2511
2629
|
return this._showDescription;
|
|
@@ -2515,7 +2633,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2515
2633
|
this._showDescription = show;
|
|
2516
2634
|
const newHeight = this.calculateDynamicHeight();
|
|
2517
2635
|
this.height = newHeight;
|
|
2518
|
-
this.
|
|
2636
|
+
this.requestRender();
|
|
2519
2637
|
}
|
|
2520
2638
|
}
|
|
2521
2639
|
get showUnderline() {
|
|
@@ -2526,7 +2644,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2526
2644
|
this._showUnderline = show;
|
|
2527
2645
|
const newHeight = this.calculateDynamicHeight();
|
|
2528
2646
|
this.height = newHeight;
|
|
2529
|
-
this.
|
|
2647
|
+
this.requestRender();
|
|
2530
2648
|
}
|
|
2531
2649
|
}
|
|
2532
2650
|
get showScrollArrows() {
|
|
@@ -2535,7 +2653,7 @@ class TabSelectRenderable extends Renderable {
|
|
|
2535
2653
|
set showScrollArrows(show) {
|
|
2536
2654
|
if (this._showScrollArrows !== show) {
|
|
2537
2655
|
this._showScrollArrows = show;
|
|
2538
|
-
this.
|
|
2656
|
+
this.requestRender();
|
|
2539
2657
|
}
|
|
2540
2658
|
}
|
|
2541
2659
|
get wrapSelection() {
|
|
@@ -2553,16 +2671,13 @@ class TabSelectRenderable extends Renderable {
|
|
|
2553
2671
|
this._tabWidth = tabWidth;
|
|
2554
2672
|
this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
|
|
2555
2673
|
this.updateScrollOffset();
|
|
2556
|
-
this.
|
|
2674
|
+
this.requestRender();
|
|
2557
2675
|
}
|
|
2558
2676
|
}
|
|
2559
2677
|
// src/renderables/composition/constructs.ts
|
|
2560
2678
|
function Generic(props, ...children) {
|
|
2561
2679
|
return h(VRenderable, props || {}, ...children);
|
|
2562
2680
|
}
|
|
2563
|
-
function Group(props, ...children) {
|
|
2564
|
-
return h(GroupRenderable, props || {}, ...children);
|
|
2565
|
-
}
|
|
2566
2681
|
function Box(props, ...children) {
|
|
2567
2682
|
return h(BoxRenderable, props || {}, ...children);
|
|
2568
2683
|
}
|
|
@@ -2636,9 +2751,10 @@ export {
|
|
|
2636
2751
|
isValidPercentage,
|
|
2637
2752
|
isVNode,
|
|
2638
2753
|
isSizeType,
|
|
2639
|
-
|
|
2754
|
+
isPositionTypeType,
|
|
2640
2755
|
isPositionType,
|
|
2641
2756
|
isPaddingType,
|
|
2757
|
+
isOverflowType,
|
|
2642
2758
|
isMarginType,
|
|
2643
2759
|
isFlexBasisType,
|
|
2644
2760
|
isDimensionType,
|
|
@@ -2721,13 +2837,12 @@ export {
|
|
|
2721
2837
|
MouseParser,
|
|
2722
2838
|
MouseEvent,
|
|
2723
2839
|
MouseButton,
|
|
2840
|
+
LogLevel,
|
|
2724
2841
|
LayoutEvents,
|
|
2725
2842
|
KeyHandler,
|
|
2726
2843
|
InputRenderableEvents,
|
|
2727
2844
|
InputRenderable,
|
|
2728
2845
|
Input,
|
|
2729
|
-
GroupRenderable,
|
|
2730
|
-
Group,
|
|
2731
2846
|
Generic,
|
|
2732
2847
|
FrameBufferRenderable,
|
|
2733
2848
|
FrameBuffer,
|
|
@@ -2748,5 +2863,5 @@ export {
|
|
|
2748
2863
|
ASCIIFont
|
|
2749
2864
|
};
|
|
2750
2865
|
|
|
2751
|
-
//# debugId=
|
|
2866
|
+
//# debugId=673E2078AE4B8BC264756E2164756E21
|
|
2752
2867
|
//# sourceMappingURL=index.js.map
|