@ai-ecoverse/slicc-spectrum 1.111.4 → 1.112.1
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/README.md +11 -8
- package/dist/{chunk-KYIEFCEE.js → chunk-G7UZNWLW.js} +775 -136
- package/dist/chunk-G7UZNWLW.js.map +7 -0
- package/dist/{chunk-2UI4FYPN.js → chunk-GIS2QBSN.js} +3421 -3186
- package/dist/chunk-GIS2QBSN.js.map +7 -0
- package/dist/ghostty-vt.wasm +0 -0
- package/dist/slicc-dummy.js +78 -1
- package/dist/slicc-dummy.js.map +2 -2
- package/dist/slicc-terminal.js +1 -1
- package/dist/slicc-ui.js +249 -131
- package/dist/slicc-ui.js.map +3 -3
- package/dist/types/app/approvals.d.ts +3 -0
- package/dist/types/cell-canvas.d.ts +6 -0
- package/dist/types/dummy/approvals.d.ts +1 -1
- package/dist/types/ghostty.d.ts +5 -1
- package/dist/types/model/types.d.ts +10 -1
- package/dist/types/slicc-terminal.d.ts +1 -0
- package/package.json +10 -10
- package/dist/chunk-2UI4FYPN.js.map +0 -7
- package/dist/chunk-KYIEFCEE.js.map +0 -7
|
@@ -53,6 +53,7 @@ function loadWasmModule(url) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// node_modules/@wterm/core/dist/wasm-bridge.js
|
|
56
|
+
var CLUSTER_BIT = 2147483648;
|
|
56
57
|
var DEFAULT_COLOR = 256;
|
|
57
58
|
var WasmBridge = class _WasmBridge {
|
|
58
59
|
get dv() {
|
|
@@ -71,7 +72,9 @@ var WasmBridge = class _WasmBridge {
|
|
|
71
72
|
this.encoder = new TextEncoder();
|
|
72
73
|
this.decoder = new TextDecoder();
|
|
73
74
|
this._dvBuffer = null;
|
|
75
|
+
this.clusterCache = /* @__PURE__ */ new Map();
|
|
74
76
|
this.linkCache = /* @__PURE__ */ new Map();
|
|
77
|
+
this.clearedRowIds = new Uint32Array(0);
|
|
75
78
|
this.exports = instance.exports;
|
|
76
79
|
this.memory = this.exports.memory;
|
|
77
80
|
}
|
|
@@ -83,6 +86,7 @@ var WasmBridge = class _WasmBridge {
|
|
|
83
86
|
init(cols, rows) {
|
|
84
87
|
this.exports.init(cols, rows);
|
|
85
88
|
this.linkCache.clear();
|
|
89
|
+
this.clusterCache.clear();
|
|
86
90
|
this._updatePointers();
|
|
87
91
|
}
|
|
88
92
|
_updatePointers() {
|
|
@@ -118,14 +122,55 @@ var WasmBridge = class _WasmBridge {
|
|
|
118
122
|
flags: dv.getUint8(offset + 8),
|
|
119
123
|
width: dv.getUint8(offset + 9)
|
|
120
124
|
};
|
|
125
|
+
this._resolveCluster(result);
|
|
121
126
|
this._resolveRgb(result);
|
|
122
127
|
Object.assign(result, this._readLink(dv.getUint16(offset + 10, true)));
|
|
123
128
|
return result;
|
|
124
129
|
}
|
|
130
|
+
/** Theme defaults reported to OSC 10 and OSC 11 queries. */
|
|
131
|
+
setThemeColors(colors) {
|
|
132
|
+
this.exports.setThemeColors?.(colors.foreground, colors.background);
|
|
133
|
+
}
|
|
134
|
+
/** Times the history was cleared, as by CSI 3 J or reinitialization. */
|
|
135
|
+
getScrollbackClearCount() {
|
|
136
|
+
return this.exports.getScrollbackClearCount?.() ?? 0;
|
|
137
|
+
}
|
|
138
|
+
/** Raw hyperlink table index of a grid cell; 0 when it has no link. */
|
|
139
|
+
getCellLinkIndex(row, col) {
|
|
140
|
+
const offset = this.gridPtr + (row * this.gridStride + col) * this.cellSize;
|
|
141
|
+
return this.dv.getUint16(offset + 10, true);
|
|
142
|
+
}
|
|
143
|
+
/** Raw hyperlink table index of a scrollback cell; 0 when it has no link. */
|
|
144
|
+
getScrollbackLinkIndex(offset, col) {
|
|
145
|
+
const ptr = this.exports.getScrollbackLine(offset);
|
|
146
|
+
return this.dv.getUint16(ptr + col * this.cellSize + 10, true);
|
|
147
|
+
}
|
|
125
148
|
isDirtyRow(row) {
|
|
149
|
+
if (this.isRowContentDirty(row))
|
|
150
|
+
return true;
|
|
151
|
+
const id = this.getRowId(row);
|
|
152
|
+
return id === null ? this.exports.getRowId !== void 0 : id !== this.clearedRowIds[row];
|
|
153
|
+
}
|
|
154
|
+
isRowContentDirty(row) {
|
|
126
155
|
return new Uint8Array(this.memory.buffer, this.dirtyPtr, this.getRows())[row] !== 0;
|
|
127
156
|
}
|
|
157
|
+
getRowId(row) {
|
|
158
|
+
if (!Number.isInteger(row) || row < 0 || row >= this.getRows())
|
|
159
|
+
return null;
|
|
160
|
+
const id = this.exports.getRowId?.(row) ?? 0;
|
|
161
|
+
return id === 0 ? null : id >>> 0;
|
|
162
|
+
}
|
|
128
163
|
clearDirty() {
|
|
164
|
+
const getRowId = this.exports.getRowId;
|
|
165
|
+
if (getRowId) {
|
|
166
|
+
const rows = this.getRows();
|
|
167
|
+
if (this.clearedRowIds.length !== rows) {
|
|
168
|
+
this.clearedRowIds = new Uint32Array(rows);
|
|
169
|
+
}
|
|
170
|
+
for (let row = 0; row < rows; row++) {
|
|
171
|
+
this.clearedRowIds[row] = getRowId(row);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
129
174
|
this.exports.clearDirty();
|
|
130
175
|
}
|
|
131
176
|
getCursor() {
|
|
@@ -245,6 +290,7 @@ var WasmBridge = class _WasmBridge {
|
|
|
245
290
|
flags: dv.getUint8(off + 8),
|
|
246
291
|
width: dv.getUint8(off + 9)
|
|
247
292
|
};
|
|
293
|
+
this._resolveCluster(result);
|
|
248
294
|
this._resolveRgb(result);
|
|
249
295
|
Object.assign(result, this._readLink(dv.getUint16(off + 10, true)));
|
|
250
296
|
return result;
|
|
@@ -288,6 +334,20 @@ var WasmBridge = class _WasmBridge {
|
|
|
288
334
|
this.exports.resizeTerminal(cols, rows);
|
|
289
335
|
this._updatePointers();
|
|
290
336
|
}
|
|
337
|
+
_resolveCluster(cell) {
|
|
338
|
+
if (cell.char < CLUSTER_BIT)
|
|
339
|
+
return;
|
|
340
|
+
const index = cell.char - CLUSTER_BIT;
|
|
341
|
+
let chars = this.clusterCache.get(index);
|
|
342
|
+
if (chars === void 0) {
|
|
343
|
+
const len = this.exports.getClusterLen?.(index) ?? 0;
|
|
344
|
+
chars = len === 0 ? "" : this.decoder.decode(new Uint8Array(this.memory.buffer, this.exports.getClusterPtr(index), len));
|
|
345
|
+
this.clusterCache.set(index, chars);
|
|
346
|
+
}
|
|
347
|
+
cell.char = chars.codePointAt(0) ?? 32;
|
|
348
|
+
if (chars.length > String.fromCodePoint(cell.char).length)
|
|
349
|
+
cell.chars = chars;
|
|
350
|
+
}
|
|
291
351
|
_resolveRgb(cell) {
|
|
292
352
|
if (cell.fg > DEFAULT_COLOR) {
|
|
293
353
|
const rgb = this._readRgb(cell.fg);
|
|
@@ -743,6 +803,30 @@ var GraphicsLayer = class {
|
|
|
743
803
|
}
|
|
744
804
|
};
|
|
745
805
|
|
|
806
|
+
// node_modules/@wterm/dom/dist/selection-state.js
|
|
807
|
+
var states = /* @__PURE__ */ new WeakMap();
|
|
808
|
+
function selectionMayExist(document2) {
|
|
809
|
+
let state = states.get(document2);
|
|
810
|
+
if (!state) {
|
|
811
|
+
state = { knownEmpty: false };
|
|
812
|
+
states.set(document2, state);
|
|
813
|
+
const invalidate = () => markSelectionChanged(document2);
|
|
814
|
+
document2.addEventListener("selectionchange", invalidate);
|
|
815
|
+
for (const type of ["pointerdown", "mousedown", "touchstart", "keydown"])
|
|
816
|
+
document2.addEventListener(type, invalidate, true);
|
|
817
|
+
}
|
|
818
|
+
if (state.knownEmpty)
|
|
819
|
+
return false;
|
|
820
|
+
const selection = document2.getSelection();
|
|
821
|
+
state.knownEmpty = !selection || selection.rangeCount === 0 || selection.isCollapsed;
|
|
822
|
+
return !state.knownEmpty;
|
|
823
|
+
}
|
|
824
|
+
function markSelectionChanged(document2) {
|
|
825
|
+
const state = states.get(document2);
|
|
826
|
+
if (state)
|
|
827
|
+
state.knownEmpty = false;
|
|
828
|
+
}
|
|
829
|
+
|
|
746
830
|
// node_modules/@wterm/dom/dist/selection.js
|
|
747
831
|
function selectedText(content, start, end) {
|
|
748
832
|
const parts = [];
|
|
@@ -763,9 +847,12 @@ function selectedText(content, start, end) {
|
|
|
763
847
|
return parts.join("");
|
|
764
848
|
}
|
|
765
849
|
function getSelectionText(terminal, rows) {
|
|
850
|
+
markSelectionChanged(terminal.ownerDocument);
|
|
766
851
|
return readSelection(terminal, rows)?.text ?? null;
|
|
767
852
|
}
|
|
768
853
|
function readSelection(terminal, rows) {
|
|
854
|
+
if (!selectionMayExist(terminal.ownerDocument))
|
|
855
|
+
return null;
|
|
769
856
|
const selection = terminal.ownerDocument.getSelection();
|
|
770
857
|
if (!selection || selection.isCollapsed || selection.rangeCount !== 1)
|
|
771
858
|
return null;
|
|
@@ -987,11 +1074,17 @@ var TrackedSelection = class {
|
|
|
987
1074
|
this.painted = true;
|
|
988
1075
|
}
|
|
989
1076
|
matches() {
|
|
1077
|
+
if (!selectionMayExist(this.terminal.ownerDocument))
|
|
1078
|
+
return false;
|
|
990
1079
|
const selection = this.terminal.ownerDocument.getSelection();
|
|
991
1080
|
const native = this.current?.native;
|
|
992
1081
|
return !!selection && !!native && selection.anchorNode === native.anchorNode && selection.anchorOffset === native.anchorOffset && selection.focusNode === native.focusNode && selection.focusOffset === native.focusOffset;
|
|
993
1082
|
}
|
|
994
1083
|
capture(core, rows) {
|
|
1084
|
+
if (!selectionMayExist(this.terminal.ownerDocument)) {
|
|
1085
|
+
this.dispose();
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
995
1088
|
const active = this.terminal.ownerDocument.activeElement;
|
|
996
1089
|
if (active && (active.tagName === "INPUT" || active.tagName === "TEXTAREA")) {
|
|
997
1090
|
const input = active;
|
|
@@ -1061,6 +1154,7 @@ var TrackedSelection = class {
|
|
|
1061
1154
|
const anchor = current.backward ? end : start;
|
|
1062
1155
|
const focus = current.backward ? start : end;
|
|
1063
1156
|
if (selection.anchorNode !== anchor[0] || selection.anchorOffset !== anchor[1] || selection.focusNode !== focus[0] || selection.focusOffset !== focus[1]) {
|
|
1157
|
+
markSelectionChanged(this.terminal.ownerDocument);
|
|
1064
1158
|
selection.setBaseAndExtent(...anchor, ...focus);
|
|
1065
1159
|
}
|
|
1066
1160
|
current.native = this.snapshot(selection);
|
|
@@ -1076,8 +1170,10 @@ var TrackedSelection = class {
|
|
|
1076
1170
|
};
|
|
1077
1171
|
}
|
|
1078
1172
|
clear() {
|
|
1079
|
-
if (this.current && this.matches())
|
|
1173
|
+
if (this.current && this.matches()) {
|
|
1174
|
+
markSelectionChanged(this.terminal.ownerDocument);
|
|
1080
1175
|
this.terminal.ownerDocument.getSelection()?.removeAllRanges();
|
|
1176
|
+
}
|
|
1081
1177
|
this.dispose();
|
|
1082
1178
|
}
|
|
1083
1179
|
dispose() {
|
|
@@ -1110,15 +1206,24 @@ function colorToCSS(index) {
|
|
|
1110
1206
|
return null;
|
|
1111
1207
|
if (index < 16)
|
|
1112
1208
|
return `var(--term-color-${index})`;
|
|
1209
|
+
return rgbToCSS(paletteRgb(index));
|
|
1210
|
+
}
|
|
1211
|
+
function paletteRgb(index) {
|
|
1113
1212
|
if (index < 232) {
|
|
1114
1213
|
const n = index - 16;
|
|
1115
|
-
|
|
1116
|
-
const g = Math.floor(n / 6) % 6 * 51;
|
|
1117
|
-
const b = n % 6 * 51;
|
|
1118
|
-
return `rgb(${r},${g},${b})`;
|
|
1214
|
+
return Math.floor(n / 36) * 51 << 16 | Math.floor(n / 6) % 6 * 51 << 8 | n % 6 * 51;
|
|
1119
1215
|
}
|
|
1120
1216
|
const level = (index - 232) * 10 + 8;
|
|
1121
|
-
return
|
|
1217
|
+
return level << 16 | level << 8 | level;
|
|
1218
|
+
}
|
|
1219
|
+
var LITTLE_ENDIAN = new Uint8Array(new Uint32Array([1]).buffer)[0] === 1;
|
|
1220
|
+
function cellColorPixel(index, rgb) {
|
|
1221
|
+
if (rgb === void 0) {
|
|
1222
|
+
if (index < 16 || index > 255)
|
|
1223
|
+
return void 0;
|
|
1224
|
+
rgb = paletteRgb(index);
|
|
1225
|
+
}
|
|
1226
|
+
return LITTLE_ENDIAN ? (4278190080 | (rgb & 255) << 16 | rgb & 65280 | rgb >>> 16 & 255) >>> 0 : (rgb << 8 | 255) >>> 0;
|
|
1122
1227
|
}
|
|
1123
1228
|
function cellFgCSS(fg, fgRgb) {
|
|
1124
1229
|
if (fgRgb !== void 0)
|
|
@@ -1130,12 +1235,13 @@ function cellBgCSS(bg, bgRgb) {
|
|
|
1130
1235
|
return rgbToCSS(bgRgb);
|
|
1131
1236
|
return colorToCSS(bg);
|
|
1132
1237
|
}
|
|
1133
|
-
function
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1238
|
+
function cellBackgroundPixel(cell) {
|
|
1239
|
+
return cell.flags & FLAG_REVERSE ? cellColorPixel(cell.fg, cell.fgRgb) : cellColorPixel(cell.bg, cell.bgRgb);
|
|
1240
|
+
}
|
|
1241
|
+
function buildCellStyle({ fg, bg, flags, fgRgb, bgRgb, underlineStyle, underlineRgb }, includeBackground = true) {
|
|
1242
|
+
const reverse = flags & FLAG_REVERSE;
|
|
1243
|
+
const fgCSS = reverse ? cellBgCSS(bg, bgRgb) ?? DEFAULT_BG_CSS : cellFgCSS(fg, fgRgb);
|
|
1244
|
+
const bgCSS = includeBackground ? reverse ? cellFgCSS(fg, fgRgb) ?? DEFAULT_FG_CSS : cellBgCSS(bg, bgRgb) : null;
|
|
1139
1245
|
let style = "";
|
|
1140
1246
|
if (fgCSS)
|
|
1141
1247
|
style += `color:${fgCSS};`;
|
|
@@ -1415,7 +1521,7 @@ var Renderer = class {
|
|
|
1415
1521
|
this.prevCursorRow = -1;
|
|
1416
1522
|
this.prevCursorCol = -1;
|
|
1417
1523
|
this.prevCursorVisible = false;
|
|
1418
|
-
this.
|
|
1524
|
+
this.rowIds = [];
|
|
1419
1525
|
this._scrollbackRowEls = [];
|
|
1420
1526
|
this._scrollbackKeys = [];
|
|
1421
1527
|
this._scrollbackRowHeight = 0;
|
|
@@ -1431,12 +1537,30 @@ var Renderer = class {
|
|
|
1431
1537
|
this.needsSetup = false;
|
|
1432
1538
|
this.colorsChanged = false;
|
|
1433
1539
|
this.painted = false;
|
|
1540
|
+
this.cellContext = null;
|
|
1541
|
+
this.cellImage = null;
|
|
1542
|
+
this.cellPixels = null;
|
|
1543
|
+
this.cellEdges = null;
|
|
1544
|
+
this.cellTop = null;
|
|
1545
|
+
this.cellBottom = null;
|
|
1546
|
+
this.cellBandUsed = [];
|
|
1547
|
+
this.cellEnabled = false;
|
|
1548
|
+
this.cellSuspended = false;
|
|
1549
|
+
this.cellRowHeight = 0;
|
|
1550
|
+
this.cellCharWidth = 0;
|
|
1434
1551
|
this.container = container;
|
|
1435
1552
|
this.colorHost = options.colorHost ?? container;
|
|
1436
1553
|
this.graphics = new GraphicsLayer(container, options);
|
|
1437
1554
|
this.searchLayer = document.createElement("div");
|
|
1438
1555
|
this.searchLayer.className = "term-search-layer";
|
|
1439
1556
|
this.searchLayer.setAttribute("aria-hidden", "true");
|
|
1557
|
+
this.cellCanvas = document.createElement("canvas");
|
|
1558
|
+
this.cellCanvas.className = "term-cell-canvas";
|
|
1559
|
+
this.cellCanvas.setAttribute("aria-hidden", "true");
|
|
1560
|
+
this.cellCanvas.addEventListener("contextrestored", () => {
|
|
1561
|
+
if (this.cellImage)
|
|
1562
|
+
this.cellContext?.putImageData(this.cellImage, 0, 0);
|
|
1563
|
+
});
|
|
1440
1564
|
}
|
|
1441
1565
|
setup(cols, rows) {
|
|
1442
1566
|
this.cols = cols;
|
|
@@ -1446,12 +1570,16 @@ var Renderer = class {
|
|
|
1446
1570
|
this.rowParts = /* @__PURE__ */ new WeakMap();
|
|
1447
1571
|
this.rowBackground = /* @__PURE__ */ new WeakMap();
|
|
1448
1572
|
this.rowEls = [];
|
|
1449
|
-
this.
|
|
1573
|
+
this.rowIds = [];
|
|
1450
1574
|
this._scrollbackRowEls = [];
|
|
1451
1575
|
this._scrollbackKeys = [];
|
|
1452
1576
|
this._scrollbackGapSpacers = [];
|
|
1453
1577
|
this._renderedScrollbackCount = -1;
|
|
1454
1578
|
this._renderedDiscardedCount = -1;
|
|
1579
|
+
this.cellEnabled = false;
|
|
1580
|
+
this.cellRowHeight = 0;
|
|
1581
|
+
this.cellCharWidth = 0;
|
|
1582
|
+
this.releaseCellImage();
|
|
1455
1583
|
const fragment = document.createDocumentFragment();
|
|
1456
1584
|
this._scrollbackTopSpacer = document.createElement("div");
|
|
1457
1585
|
this._scrollbackTopSpacer.className = "term-scrollback-spacer";
|
|
@@ -1462,16 +1590,106 @@ var Renderer = class {
|
|
|
1462
1590
|
for (let r = 0; r < rows; r++) {
|
|
1463
1591
|
const rowEl = document.createElement("div");
|
|
1464
1592
|
rowEl.className = "term-row";
|
|
1593
|
+
this.rowBackground.set(rowEl, "");
|
|
1465
1594
|
fragment.appendChild(rowEl);
|
|
1466
1595
|
this.rowEls.push(rowEl);
|
|
1467
1596
|
}
|
|
1468
1597
|
this.container.appendChild(fragment);
|
|
1598
|
+
this.container.appendChild(this.cellCanvas);
|
|
1469
1599
|
this.searchLayer.replaceChildren();
|
|
1470
1600
|
this.container.appendChild(this.searchLayer);
|
|
1471
1601
|
this.graphics.setup();
|
|
1472
1602
|
this.prevCursorRow = -1;
|
|
1473
1603
|
this.prevCursorCol = -1;
|
|
1474
1604
|
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Sizes the live-row color canvas to the grid. Cell edges sit on whole CSS
|
|
1607
|
+
* pixels, matching where the browser paints DOM cell backgrounds.
|
|
1608
|
+
*/
|
|
1609
|
+
syncCellCanvas(viewport) {
|
|
1610
|
+
const rowHeight = viewport?.rowHeight ?? 0;
|
|
1611
|
+
const charWidth = viewport?.charWidth ?? 0;
|
|
1612
|
+
const enabled = Number.isInteger(rowHeight) && rowHeight > 0 && Number.isFinite(charWidth) && charWidth > 0 && !this.hasImageFlow && !this.cellSuspended && (this.cellContext ?? (this.cellContext = this.cellCanvas.getContext("2d"))) !== null;
|
|
1613
|
+
if (!enabled) {
|
|
1614
|
+
const changed = this.cellEnabled;
|
|
1615
|
+
this.cellEnabled = false;
|
|
1616
|
+
if (changed)
|
|
1617
|
+
this.releaseCellImage();
|
|
1618
|
+
return changed;
|
|
1619
|
+
}
|
|
1620
|
+
if (this.cellEnabled && this.cellRowHeight === rowHeight && this.cellCharWidth === charWidth)
|
|
1621
|
+
return false;
|
|
1622
|
+
const edges = new Int32Array(this.cols + 1);
|
|
1623
|
+
for (let col = 0; col <= this.cols; col++)
|
|
1624
|
+
edges[col] = Math.round(col * charWidth);
|
|
1625
|
+
this.releaseCellImage();
|
|
1626
|
+
this.cellEnabled = true;
|
|
1627
|
+
this.cellRowHeight = rowHeight;
|
|
1628
|
+
this.cellCharWidth = charWidth;
|
|
1629
|
+
this.cellEdges = edges;
|
|
1630
|
+
this.cellTop = new Uint32Array(this.cols);
|
|
1631
|
+
this.cellBottom = new Uint32Array(this.cols);
|
|
1632
|
+
return true;
|
|
1633
|
+
}
|
|
1634
|
+
/** Frees the canvas bitmap and pixel buffer until a row needs them again. */
|
|
1635
|
+
releaseCellImage() {
|
|
1636
|
+
this.cellImage = null;
|
|
1637
|
+
this.cellPixels = null;
|
|
1638
|
+
this.cellBandUsed = [];
|
|
1639
|
+
this.cellCanvas.width = 0;
|
|
1640
|
+
this.cellCanvas.height = 0;
|
|
1641
|
+
this.cellCanvas.hidden = true;
|
|
1642
|
+
}
|
|
1643
|
+
/** Allocates the canvas bitmap on the first row that has canvas cells. */
|
|
1644
|
+
ensureCellImage() {
|
|
1645
|
+
if (this.cellImage)
|
|
1646
|
+
return true;
|
|
1647
|
+
if (!this.cellContext)
|
|
1648
|
+
return false;
|
|
1649
|
+
const width = Math.max(1, this.cellEdges[this.cols]);
|
|
1650
|
+
const height = this.rows * this.cellRowHeight;
|
|
1651
|
+
this.cellCanvas.width = width;
|
|
1652
|
+
this.cellCanvas.height = height;
|
|
1653
|
+
this.cellCanvas.style.width = `${width}px`;
|
|
1654
|
+
this.cellCanvas.style.height = `${height}px`;
|
|
1655
|
+
this.cellCanvas.hidden = false;
|
|
1656
|
+
this.cellImage = this.cellContext.createImageData(width, height);
|
|
1657
|
+
this.cellPixels = new Uint32Array(this.cellImage.data.buffer);
|
|
1658
|
+
return true;
|
|
1659
|
+
}
|
|
1660
|
+
/** Expands one row's cell colors into its canvas band and uploads it. */
|
|
1661
|
+
paintCellBand(rowIndex, used) {
|
|
1662
|
+
if (!used && !this.cellBandUsed[rowIndex])
|
|
1663
|
+
return;
|
|
1664
|
+
if (!this.ensureCellImage())
|
|
1665
|
+
return;
|
|
1666
|
+
const pixels = this.cellPixels;
|
|
1667
|
+
const image = this.cellImage;
|
|
1668
|
+
const width = image.width;
|
|
1669
|
+
const height = this.cellRowHeight;
|
|
1670
|
+
const band = rowIndex * height * width;
|
|
1671
|
+
if (!used) {
|
|
1672
|
+
pixels.fill(0, band, band + height * width);
|
|
1673
|
+
} else {
|
|
1674
|
+
const edges = this.cellEdges;
|
|
1675
|
+
const top = this.cellTop;
|
|
1676
|
+
const bottom = this.cellBottom;
|
|
1677
|
+
const split = Math.round(height / 2);
|
|
1678
|
+
const bottomLine = band + split * width;
|
|
1679
|
+
for (let col = 0; col < this.cols; col++) {
|
|
1680
|
+
pixels.fill(top[col], band + edges[col], band + edges[col + 1]);
|
|
1681
|
+
pixels.fill(bottom[col], bottomLine + edges[col], bottomLine + edges[col + 1]);
|
|
1682
|
+
}
|
|
1683
|
+
for (let line = 1; line < height; line++) {
|
|
1684
|
+
if (line === split)
|
|
1685
|
+
continue;
|
|
1686
|
+
const source = line < split ? band : bottomLine;
|
|
1687
|
+
pixels.copyWithin(band + line * width, source, source + width);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
this.cellBandUsed[rowIndex] = used;
|
|
1691
|
+
this.cellContext.putImageData(image, 0, 0, 0, rowIndex * height, width, height);
|
|
1692
|
+
}
|
|
1475
1693
|
_buildRowContent(rowEl, getCell, lineLen, cursorCol, rowIndex) {
|
|
1476
1694
|
const parts = [];
|
|
1477
1695
|
let linkHtml = "";
|
|
@@ -1502,6 +1720,15 @@ var Renderer = class {
|
|
|
1502
1720
|
let outputLinkKey = "";
|
|
1503
1721
|
let rowBackground;
|
|
1504
1722
|
let uniformBackground = lineLen >= this.cols;
|
|
1723
|
+
const canvasTop = rowIndex >= 0 && this.cellEnabled ? this.cellTop : null;
|
|
1724
|
+
const canvasBottom = this.cellBottom;
|
|
1725
|
+
if (canvasTop) {
|
|
1726
|
+
canvasTop.fill(0);
|
|
1727
|
+
canvasBottom.fill(0);
|
|
1728
|
+
}
|
|
1729
|
+
let canvasUsed = false;
|
|
1730
|
+
let canvasText = "";
|
|
1731
|
+
let canvasCols = 0;
|
|
1505
1732
|
const appendContent = (content2, linkKey, uri) => {
|
|
1506
1733
|
const href = safeLinkHref(uri);
|
|
1507
1734
|
const nextLinkKey = href ? linkKey : "";
|
|
@@ -1547,6 +1774,13 @@ var Renderer = class {
|
|
|
1547
1774
|
const appendStyledSpan = (className, style, text, linkKey, linkUri) => {
|
|
1548
1775
|
appendContent(cellSpanPart(className, style, text), linkKey, linkUri);
|
|
1549
1776
|
};
|
|
1777
|
+
const flushCanvasRun = () => {
|
|
1778
|
+
if (!canvasCols)
|
|
1779
|
+
return;
|
|
1780
|
+
appendStyledSpan("term-canvas-run", columnStyle(canvasCols), canvasText, "");
|
|
1781
|
+
canvasText = "";
|
|
1782
|
+
canvasCols = 0;
|
|
1783
|
+
};
|
|
1550
1784
|
for (let col = 0; col < this.cols; col++) {
|
|
1551
1785
|
const cell = getCell(col);
|
|
1552
1786
|
const inBounds = col < lineLen;
|
|
@@ -1554,6 +1788,32 @@ var Renderer = class {
|
|
|
1554
1788
|
const width = inBounds ? cell.width ?? 1 : 1;
|
|
1555
1789
|
const cellLinkKey = inBounds ? linkIdentity(cell) : "";
|
|
1556
1790
|
const cellLinkUri = inBounds ? cell.linkUri : void 0;
|
|
1791
|
+
if (canvasTop && inBounds && width === 1 && col !== cursorCol && !cellLinkUri && !(cell.flags & (FLAG_DIM | FLAG_INVISIBLE | FLAG_UNDERLINE | FLAG_STRIKETHROUGH)) && (!cell.underlineStyle || cell.underlineStyle === "none") && (cp === 9600 || cp === 9604 || cp === 9608)) {
|
|
1792
|
+
let foreground = cellColorPixel(cell.fg, cell.fgRgb);
|
|
1793
|
+
let background = cellColorPixel(cell.bg, cell.bgRgb);
|
|
1794
|
+
if (cell.flags & FLAG_REVERSE)
|
|
1795
|
+
[foreground, background] = [background, foreground];
|
|
1796
|
+
if (foreground !== void 0 && (cp === 9608 || background !== void 0)) {
|
|
1797
|
+
flushRun(col);
|
|
1798
|
+
canvasTop[col] = cp === 9604 ? background : foreground;
|
|
1799
|
+
canvasBottom[col] = cp === 9600 ? background : foreground;
|
|
1800
|
+
canvasUsed = true;
|
|
1801
|
+
const text = cell.chars ?? String.fromCodePoint(cp);
|
|
1802
|
+
recordText(text, col);
|
|
1803
|
+
canvasText += text;
|
|
1804
|
+
canvasCols++;
|
|
1805
|
+
uniformBackground = false;
|
|
1806
|
+
runStart = col + 1;
|
|
1807
|
+
continue;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
const canvasBackground = canvasTop && inBounds && width === 1 && col !== cursorCol && !cellLinkKey && !(cell.flags & (FLAG_DIM | FLAG_INVISIBLE)) && !(cp >= 9600 && cp <= 9631) ? cellBackgroundPixel(cell) : void 0;
|
|
1811
|
+
if (canvasTop && canvasBackground !== void 0) {
|
|
1812
|
+
canvasTop[col] = canvasBackground;
|
|
1813
|
+
canvasBottom[col] = canvasBackground;
|
|
1814
|
+
canvasUsed = true;
|
|
1815
|
+
}
|
|
1816
|
+
flushCanvasRun();
|
|
1557
1817
|
const continuesWide = inBounds && width === 0 && col > 0 && (getCell(col - 1).width ?? 1) === 2;
|
|
1558
1818
|
if (uniformBackground && !continuesWide) {
|
|
1559
1819
|
const bg = resolveColors(cell.fg, cell.bg, cell.flags, cell.fgRgb, cell.bgRgb).bg;
|
|
@@ -1626,7 +1886,7 @@ var Renderer = class {
|
|
|
1626
1886
|
} else {
|
|
1627
1887
|
const ch = cell.chars ?? (inBounds && cp >= 32 ? String.fromCodePoint(cp) : " ");
|
|
1628
1888
|
recordText(ch, col, 1, cell.spacerHead === true);
|
|
1629
|
-
const style = inBounds ? buildCellStyle(cell) : "";
|
|
1889
|
+
const style = inBounds ? buildCellStyle(cell, canvasBackground === void 0) : "";
|
|
1630
1890
|
if (ch.length !== 1 || ch.charCodeAt(0) > 126) {
|
|
1631
1891
|
flushRun(col);
|
|
1632
1892
|
const cursor = col === cursorCol;
|
|
@@ -1659,17 +1919,15 @@ var Renderer = class {
|
|
|
1659
1919
|
}
|
|
1660
1920
|
}
|
|
1661
1921
|
flushRun(this.cols);
|
|
1922
|
+
flushCanvasRun();
|
|
1662
1923
|
if (outputLinkKey)
|
|
1663
1924
|
parts.push({ html: linkHtml + "</a>" });
|
|
1664
1925
|
this.updateRowParts(rowEl, parts);
|
|
1665
1926
|
this.rowText.set(rowEl, content);
|
|
1927
|
+
if (canvasTop)
|
|
1928
|
+
this.paintCellBand(rowIndex, canvasUsed);
|
|
1666
1929
|
const bgCss = uniformBackground && rowBackground !== DEFAULT_BG_CSS ? rowBackground ?? "" : "";
|
|
1667
|
-
if (
|
|
1668
|
-
if (bgCss !== (this.prevRowBg[rowIndex] ?? "")) {
|
|
1669
|
-
rowEl.style.background = bgCss;
|
|
1670
|
-
this.prevRowBg[rowIndex] = bgCss;
|
|
1671
|
-
}
|
|
1672
|
-
} else if (this.rowBackground.get(rowEl) !== bgCss) {
|
|
1930
|
+
if (this.rowBackground.get(rowEl) !== bgCss) {
|
|
1673
1931
|
rowEl.style.background = bgCss;
|
|
1674
1932
|
this.rowBackground.set(rowEl, bgCss);
|
|
1675
1933
|
}
|
|
@@ -1736,7 +1994,7 @@ var Renderer = class {
|
|
|
1736
1994
|
const visibleRows = virtual ? Math.ceil(viewportHeight / rowHeight) : scrollbackCount;
|
|
1737
1995
|
const start = virtual ? Math.max(0, Math.min(scrollbackCount, firstVisible - overscan)) : 0;
|
|
1738
1996
|
const end = virtual ? Math.max(start, Math.min(scrollbackCount, firstVisible + visibleRows + overscan)) : scrollbackCount;
|
|
1739
|
-
const selection = this.container.ownerDocument.getSelection();
|
|
1997
|
+
const selection = selectionMayExist(this.container.ownerDocument) ? this.container.ownerDocument.getSelection() : null;
|
|
1740
1998
|
const selectionInContainer = selection !== null && !selection.isCollapsed && (this.container.contains(selection.anchorNode) || this.container.contains(selection.focusNode));
|
|
1741
1999
|
const contentUnchanged = this.painted && !this.colorsChanged && hasDiscardedCount && scrollbackCount === this._renderedScrollbackCount && discardedCount === this._renderedDiscardedCount;
|
|
1742
2000
|
const first = (this._scrollbackKeys[0] ?? Infinity) - discardedCount;
|
|
@@ -1833,6 +2091,61 @@ var Renderer = class {
|
|
|
1833
2091
|
this.colorHost.style.removeProperty(property);
|
|
1834
2092
|
}
|
|
1835
2093
|
}
|
|
2094
|
+
/** Reuses live row nodes and canvas bands by the core's content identity. */
|
|
2095
|
+
syncLiveRows(core) {
|
|
2096
|
+
const ids = core.getRowId ? Array.from({ length: this.rows }, (_, row) => core.getRowId(row)) : [];
|
|
2097
|
+
const previous = this.rowIds;
|
|
2098
|
+
this.rowIds = ids.includes(null) ? [] : ids;
|
|
2099
|
+
if (!this.rowIds.length)
|
|
2100
|
+
return null;
|
|
2101
|
+
if (previous.length !== ids.length)
|
|
2102
|
+
return new Set(ids.map((_, row) => row));
|
|
2103
|
+
if (ids.every((id, row) => id === previous[row]))
|
|
2104
|
+
return null;
|
|
2105
|
+
const oldRows = /* @__PURE__ */ new Map();
|
|
2106
|
+
for (let row = 0; row < previous.length; row++)
|
|
2107
|
+
oldRows.set(previous[row], row);
|
|
2108
|
+
const sources = ids.map((id) => oldRows.get(id) ?? -1);
|
|
2109
|
+
const retained = new Set(sources);
|
|
2110
|
+
const available = this.rowEls.map((_, row) => row).filter((row) => !retained.has(row)).reverse();
|
|
2111
|
+
const fresh = /* @__PURE__ */ new Set();
|
|
2112
|
+
for (let row = 0; row < this.rows; row++) {
|
|
2113
|
+
if (sources[row] < 0) {
|
|
2114
|
+
sources[row] = available.pop();
|
|
2115
|
+
fresh.add(row);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
this.rowEls = sources.map((source) => this.rowEls[source]);
|
|
2119
|
+
this.prevCursorRow = sources.indexOf(this.prevCursorRow);
|
|
2120
|
+
const firstMoved = sources.findIndex((source, row) => !fresh.has(row) && source !== row);
|
|
2121
|
+
if (firstMoved >= 0 && sources[firstMoved] > firstMoved) {
|
|
2122
|
+
let next = this.cellCanvas;
|
|
2123
|
+
for (let row = this.rows - 1; row >= 0; row--) {
|
|
2124
|
+
const element = this.rowEls[row];
|
|
2125
|
+
if (element.nextSibling !== next)
|
|
2126
|
+
this.container.insertBefore(element, next);
|
|
2127
|
+
next = element;
|
|
2128
|
+
}
|
|
2129
|
+
} else {
|
|
2130
|
+
let next = this._scrollbackBottomSpacer.nextSibling;
|
|
2131
|
+
for (const element of this.rowEls) {
|
|
2132
|
+
if (element !== next)
|
|
2133
|
+
this.container.insertBefore(element, next);
|
|
2134
|
+
next = element.nextSibling;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
if (this.cellPixels && this.cellBandUsed.some(Boolean)) {
|
|
2138
|
+
const pixels = this.cellPixels.slice();
|
|
2139
|
+
const bandSize = this.cellImage.width * this.cellRowHeight;
|
|
2140
|
+
for (let row = 0; row < this.rows; row++) {
|
|
2141
|
+
const start = sources[row] * bandSize;
|
|
2142
|
+
this.cellPixels.set(pixels.subarray(start, start + bandSize), row * bandSize);
|
|
2143
|
+
}
|
|
2144
|
+
this.cellContext.putImageData(this.cellImage, 0, 0);
|
|
2145
|
+
}
|
|
2146
|
+
this.cellBandUsed = sources.map((source) => this.cellBandUsed[source]);
|
|
2147
|
+
return fresh;
|
|
2148
|
+
}
|
|
1836
2149
|
render(core, viewport) {
|
|
1837
2150
|
this.syncColorOverrides(core.getColorOverrides?.());
|
|
1838
2151
|
this.viewport = viewport;
|
|
@@ -1850,6 +2163,17 @@ var Renderer = class {
|
|
|
1850
2163
|
...viewport,
|
|
1851
2164
|
selectedRows: positions ? { start: positions.start.row, end: positions.end.row } : void 0
|
|
1852
2165
|
});
|
|
2166
|
+
this.graphics.reconcile(core, {
|
|
2167
|
+
scrollTop: viewport?.scrollTop ?? 0,
|
|
2168
|
+
clientHeight: viewport?.clientHeight ?? 0,
|
|
2169
|
+
rowHeight: viewport?.rowHeight ?? 0,
|
|
2170
|
+
charWidth: viewport?.charWidth ?? 0,
|
|
2171
|
+
overscanRows: viewport?.overscanRows ?? DEFAULT_SCROLLBACK_OVERSCAN_ROWS,
|
|
2172
|
+
scrollbackCount: core.getScrollbackCount()
|
|
2173
|
+
});
|
|
2174
|
+
const canvasChanged = this.syncCellCanvas(viewport);
|
|
2175
|
+
const freshRows = this.syncLiveRows(core);
|
|
2176
|
+
this.cellCanvas.style.top = `${core.getScrollbackCount() * (viewport?.rowHeight ?? 0)}px`;
|
|
1853
2177
|
const cursor = core.getCursor();
|
|
1854
2178
|
const cursorVisible = cursor.visible;
|
|
1855
2179
|
const shape = cursor.shape ?? "block";
|
|
@@ -1860,7 +2184,7 @@ var Renderer = class {
|
|
|
1860
2184
|
this.container.dataset.cursorBlink = blink;
|
|
1861
2185
|
const needsCursorUpdate = cursor.row !== this.prevCursorRow || cursor.col !== this.prevCursorCol || cursorVisible !== this.prevCursorVisible;
|
|
1862
2186
|
for (let r = 0; r < this.rows; r++) {
|
|
1863
|
-
const isDirty = this.colorsChanged || resized || core.isDirtyRow(r);
|
|
2187
|
+
const isDirty = this.colorsChanged || resized || canvasChanged || freshRows?.has(r) || (this.rowIds.length ? core.isRowContentDirty?.(r) ?? core.isDirtyRow(r) : core.isDirtyRow(r));
|
|
1864
2188
|
const hadCursor = r === this.prevCursorRow && needsCursorUpdate;
|
|
1865
2189
|
const hasCursor = r === cursor.row;
|
|
1866
2190
|
if (isDirty || hadCursor || hasCursor && needsCursorUpdate) {
|
|
@@ -1880,14 +2204,6 @@ var Renderer = class {
|
|
|
1880
2204
|
this.colorsChanged = false;
|
|
1881
2205
|
this.selection.afterRender(this.selectionRows(), positions);
|
|
1882
2206
|
this.painted = true;
|
|
1883
|
-
this.graphics.reconcile(core, {
|
|
1884
|
-
scrollTop: viewport?.scrollTop ?? 0,
|
|
1885
|
-
clientHeight: viewport?.clientHeight ?? 0,
|
|
1886
|
-
rowHeight: viewport?.rowHeight ?? 0,
|
|
1887
|
-
charWidth: viewport?.charWidth ?? 0,
|
|
1888
|
-
overscanRows: viewport?.overscanRows ?? DEFAULT_SCROLLBACK_OVERSCAN_ROWS,
|
|
1889
|
-
scrollbackCount: core.getScrollbackCount()
|
|
1890
|
-
});
|
|
1891
2207
|
}
|
|
1892
2208
|
/** Mounted rows in chronological, retained-buffer coordinates. */
|
|
1893
2209
|
*searchRows() {
|
|
@@ -1955,6 +2271,7 @@ var Renderer = class {
|
|
|
1955
2271
|
const native = this.container.ownerDocument.getSelection();
|
|
1956
2272
|
if (!start || !end || !native)
|
|
1957
2273
|
return false;
|
|
2274
|
+
markSelectionChanged(this.container.ownerDocument);
|
|
1958
2275
|
native.setBaseAndExtent(...start, ...end);
|
|
1959
2276
|
this.selection?.capture(core, this.selectionRows());
|
|
1960
2277
|
return true;
|
|
@@ -1985,6 +2302,10 @@ var Renderer = class {
|
|
|
1985
2302
|
}
|
|
1986
2303
|
return nearest && { row: nearest.row, col: nearest.col };
|
|
1987
2304
|
}
|
|
2305
|
+
/** Turns the color canvas off so block cells keep their own colored spans. */
|
|
2306
|
+
setCanvasSuspended(suspended) {
|
|
2307
|
+
this.cellSuspended = suspended;
|
|
2308
|
+
}
|
|
1988
2309
|
requestSetup() {
|
|
1989
2310
|
this.needsSetup = true;
|
|
1990
2311
|
}
|
|
@@ -2006,6 +2327,9 @@ var Renderer = class {
|
|
|
2006
2327
|
this.container.innerHTML = "";
|
|
2007
2328
|
this.rowEls = [];
|
|
2008
2329
|
this._scrollbackRowEls = [];
|
|
2330
|
+
this.cellImage = null;
|
|
2331
|
+
this.cellPixels = null;
|
|
2332
|
+
this.cellContext = null;
|
|
2009
2333
|
}
|
|
2010
2334
|
};
|
|
2011
2335
|
|
|
@@ -2734,10 +3058,12 @@ var InputHandler = class {
|
|
|
2734
3058
|
this.onData("");
|
|
2735
3059
|
} else if (e.key === "a") {
|
|
2736
3060
|
e.preventDefault();
|
|
2737
|
-
const
|
|
3061
|
+
const doc = this.element.ownerDocument;
|
|
3062
|
+
const sel = doc.getSelection();
|
|
2738
3063
|
if (sel) {
|
|
2739
|
-
const range =
|
|
3064
|
+
const range = doc.createRange();
|
|
2740
3065
|
range.selectNodeContents(this.element);
|
|
3066
|
+
markSelectionChanged(doc);
|
|
2741
3067
|
sel.removeAllRanges();
|
|
2742
3068
|
sel.addRange(range);
|
|
2743
3069
|
}
|
|
@@ -3262,6 +3588,7 @@ var HistorySelection = class {
|
|
|
3262
3588
|
if (!this.active)
|
|
3263
3589
|
return;
|
|
3264
3590
|
const doc2 = this.element.ownerDocument;
|
|
3591
|
+
markSelectionChanged(doc2);
|
|
3265
3592
|
const active = doc2.activeElement;
|
|
3266
3593
|
if (active && (active.tagName === "INPUT" || active.tagName === "TEXTAREA")) {
|
|
3267
3594
|
const input = active;
|
|
@@ -3270,8 +3597,7 @@ var HistorySelection = class {
|
|
|
3270
3597
|
return;
|
|
3271
3598
|
}
|
|
3272
3599
|
}
|
|
3273
|
-
|
|
3274
|
-
if (selection && !selection.isCollapsed)
|
|
3600
|
+
if (selectionMayExist(doc2))
|
|
3275
3601
|
this.clear();
|
|
3276
3602
|
};
|
|
3277
3603
|
this.status = element.ownerDocument.createElement("div");
|
|
@@ -3289,6 +3615,10 @@ var HistorySelection = class {
|
|
|
3289
3615
|
get active() {
|
|
3290
3616
|
return this.pending || this.text !== null;
|
|
3291
3617
|
}
|
|
3618
|
+
/** Height the sticky status line adds to the terminal's scroll height. */
|
|
3619
|
+
get statusHeight() {
|
|
3620
|
+
return this.status.offsetHeight;
|
|
3621
|
+
}
|
|
3292
3622
|
getText() {
|
|
3293
3623
|
this.onSelectionChange();
|
|
3294
3624
|
return this.text;
|
|
@@ -3330,12 +3660,17 @@ var HistorySelection = class {
|
|
|
3330
3660
|
}
|
|
3331
3661
|
claim() {
|
|
3332
3662
|
const doc = this.element.ownerDocument;
|
|
3663
|
+
markSelectionChanged(doc);
|
|
3333
3664
|
owners.get(doc)?.clear();
|
|
3334
3665
|
this.clear();
|
|
3335
3666
|
owners.set(doc, this);
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
native.
|
|
3667
|
+
if (selectionMayExist(doc)) {
|
|
3668
|
+
const native = doc.getSelection();
|
|
3669
|
+
if (native && !native.isCollapsed) {
|
|
3670
|
+
markSelectionChanged(doc);
|
|
3671
|
+
native.removeAllRanges();
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3339
3674
|
}
|
|
3340
3675
|
/** WTerm calls this only once its current frame has painted. */
|
|
3341
3676
|
resume(core) {
|
|
@@ -4141,14 +4476,74 @@ var SearchController = class {
|
|
|
4141
4476
|
// node_modules/@wterm/dom/dist/wterm.js
|
|
4142
4477
|
var SYNCHRONIZED_OUTPUT_TIMEOUT_MS = 1e3;
|
|
4143
4478
|
var PROGRAMMATIC_SCROLL_TOLERANCE = 1;
|
|
4144
|
-
var
|
|
4479
|
+
var pendingRenders = /* @__PURE__ */ new Set();
|
|
4480
|
+
var renderFrameId = null;
|
|
4481
|
+
var THEME_PROPERTIES = [
|
|
4482
|
+
"--term-fg",
|
|
4483
|
+
"--term-bg",
|
|
4484
|
+
"--term-cursor",
|
|
4485
|
+
...Array.from({ length: 16 }, (_, index) => `--term-color-${index}`)
|
|
4486
|
+
];
|
|
4487
|
+
function mayQueryThemeColors(data) {
|
|
4488
|
+
if (typeof data === "string")
|
|
4489
|
+
return data.includes("\x1B]10;") || data.includes("\x1B]11;");
|
|
4490
|
+
for (let i = data.indexOf(27); i >= 0; i = data.indexOf(27, i + 1)) {
|
|
4491
|
+
if (data[i + 1] === 93 && data[i + 2] === 49 && (data[i + 3] === 48 || data[i + 3] === 49) && data[i + 4] === 59)
|
|
4492
|
+
return true;
|
|
4493
|
+
}
|
|
4494
|
+
return false;
|
|
4495
|
+
}
|
|
4496
|
+
function readCssThemeColors(element) {
|
|
4497
|
+
const probe = element.ownerDocument.createElement("span");
|
|
4498
|
+
probe.style.display = "none";
|
|
4499
|
+
element.appendChild(probe);
|
|
4500
|
+
try {
|
|
4501
|
+
const values = [];
|
|
4502
|
+
for (const property of THEME_PROPERTIES) {
|
|
4503
|
+
probe.style.color = `var(${property})`;
|
|
4504
|
+
const rgb = parseCssColor(getComputedStyle(probe).color);
|
|
4505
|
+
if (rgb === null)
|
|
4506
|
+
return null;
|
|
4507
|
+
values.push(rgb);
|
|
4508
|
+
}
|
|
4509
|
+
return {
|
|
4510
|
+
foreground: values[0],
|
|
4511
|
+
background: values[1],
|
|
4512
|
+
cursor: values[2],
|
|
4513
|
+
palette: values.slice(3)
|
|
4514
|
+
};
|
|
4515
|
+
} finally {
|
|
4516
|
+
probe.remove();
|
|
4517
|
+
}
|
|
4518
|
+
}
|
|
4519
|
+
function parseCssColor(color) {
|
|
4520
|
+
if (typeof color !== "string")
|
|
4521
|
+
return null;
|
|
4522
|
+
const rgb = color.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/);
|
|
4523
|
+
if (rgb)
|
|
4524
|
+
return Math.round(Number(rgb[1])) << 16 | Math.round(Number(rgb[2])) << 8 | Math.round(Number(rgb[3]));
|
|
4525
|
+
try {
|
|
4526
|
+
const context = document.createElement("canvas").getContext("2d", {
|
|
4527
|
+
willReadFrequently: true
|
|
4528
|
+
});
|
|
4529
|
+
if (!context)
|
|
4530
|
+
return null;
|
|
4531
|
+
context.fillStyle = color;
|
|
4532
|
+
context.fillRect(0, 0, 1, 1);
|
|
4533
|
+
const [r, g, b] = context.getImageData(0, 0, 1, 1).data;
|
|
4534
|
+
return r << 16 | g << 8 | b;
|
|
4535
|
+
} catch {
|
|
4536
|
+
return null;
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
var WTerm = class _WTerm {
|
|
4145
4540
|
constructor(element, options = {}) {
|
|
4146
4541
|
this.bridge = null;
|
|
4147
4542
|
this.debug = null;
|
|
4148
4543
|
this._themeColors = null;
|
|
4544
|
+
this._cssThemeKey = null;
|
|
4149
4545
|
this.renderer = null;
|
|
4150
4546
|
this.input = null;
|
|
4151
|
-
this.rafId = null;
|
|
4152
4547
|
this._synchronizedOutputTimer = null;
|
|
4153
4548
|
this._synchronizedOutputState = "idle";
|
|
4154
4549
|
this._synchronizedOutputGeneration = 0;
|
|
@@ -4156,6 +4551,7 @@ var WTerm = class {
|
|
|
4156
4551
|
this.resizeObserver = null;
|
|
4157
4552
|
this._destroyed = false;
|
|
4158
4553
|
this._shouldScrollToBottom = false;
|
|
4554
|
+
this._pinnedToBottom = true;
|
|
4159
4555
|
this._scrollbackDiscardedCount = 0;
|
|
4160
4556
|
this._programmaticScrollTop = null;
|
|
4161
4557
|
this._pendingResizeScrollTop = null;
|
|
@@ -4164,8 +4560,32 @@ var WTerm = class {
|
|
|
4164
4560
|
this._windowSizeQueryState = 0;
|
|
4165
4561
|
this._textCapture = new TextCapture();
|
|
4166
4562
|
this._searchReveal = false;
|
|
4563
|
+
this._onCoreUpdate = () => {
|
|
4564
|
+
if (!this.bridge || this._destroyed)
|
|
4565
|
+
return;
|
|
4566
|
+
this._textCapture.cancel();
|
|
4567
|
+
this._rectangleDrag.cancel();
|
|
4568
|
+
this.renderer?.beforeMutation(this.bridge);
|
|
4569
|
+
this._historySelection.invalidate();
|
|
4570
|
+
const result = this._deliverCoreEffects();
|
|
4571
|
+
const synchronized = this.bridge.synchronizedOutput?.() ?? false;
|
|
4572
|
+
const generation = this.bridge.synchronizedOutputGeneration?.() ?? 0;
|
|
4573
|
+
this._updateSynchronizedOutput(synchronized, generation);
|
|
4574
|
+
this._invalidateSearch();
|
|
4575
|
+
if (this._synchronizedOutputState !== "held") {
|
|
4576
|
+
this._setupRendererIfNeeded();
|
|
4577
|
+
this._scheduleRender();
|
|
4578
|
+
}
|
|
4579
|
+
if (result.hasError) {
|
|
4580
|
+
const error = result.error;
|
|
4581
|
+
queueMicrotask(() => {
|
|
4582
|
+
throw error;
|
|
4583
|
+
});
|
|
4584
|
+
}
|
|
4585
|
+
};
|
|
4167
4586
|
this._lastContainerRect = null;
|
|
4168
4587
|
this._keyboardSpacer = null;
|
|
4588
|
+
this._keyboardInset = 0;
|
|
4169
4589
|
this._visualViewport = null;
|
|
4170
4590
|
this._visualViewportFrame = 0;
|
|
4171
4591
|
this._onVisualViewportChange = () => {
|
|
@@ -4232,7 +4652,7 @@ var WTerm = class {
|
|
|
4232
4652
|
select: (start, end) => this.selectRectangle(start, end),
|
|
4233
4653
|
clear: () => this._historySelection.clear()
|
|
4234
4654
|
});
|
|
4235
|
-
this._outputAnnouncements = new OutputAnnouncements(this.element, () => this.bridge, () => this._canRender() && this
|
|
4655
|
+
this._outputAnnouncements = new OutputAnnouncements(this.element, () => this.bridge, () => this._canRender() && !pendingRenders.has(this) && this._synchronizedOutputState !== "held");
|
|
4236
4656
|
this._outputAnnouncements.setEnabled(options.announceOutput ?? false);
|
|
4237
4657
|
this._onVisibilityChange = () => {
|
|
4238
4658
|
if (this._canRender())
|
|
@@ -4283,10 +4703,15 @@ var WTerm = class {
|
|
|
4283
4703
|
this.element.ownerDocument.addEventListener("keydown", this._onModifierChange);
|
|
4284
4704
|
this.element.ownerDocument.addEventListener("keyup", this._onModifierChange);
|
|
4285
4705
|
this.element.ownerDocument.defaultView?.addEventListener("blur", this._onWindowBlur);
|
|
4706
|
+
this._onBeforePrint = () => this._setPrintMode(true);
|
|
4707
|
+
this._onAfterPrint = () => this._setPrintMode(false);
|
|
4708
|
+
this.element.ownerDocument.defaultView?.addEventListener("beforeprint", this._onBeforePrint);
|
|
4709
|
+
this.element.ownerDocument.defaultView?.addEventListener("afterprint", this._onAfterPrint);
|
|
4286
4710
|
this._onScroll = () => {
|
|
4287
4711
|
if (this._pendingResizeScrollTop !== null)
|
|
4288
4712
|
return;
|
|
4289
|
-
|
|
4713
|
+
const atBottom = this._isScrolledToBottom();
|
|
4714
|
+
if (this._shouldScrollToBottom && atBottom) {
|
|
4290
4715
|
this._programmaticScrollTop = null;
|
|
4291
4716
|
return;
|
|
4292
4717
|
}
|
|
@@ -4326,6 +4751,7 @@ var WTerm = class {
|
|
|
4326
4751
|
}
|
|
4327
4752
|
if (this._destroyed)
|
|
4328
4753
|
return this;
|
|
4754
|
+
this.bridge.setUpdateListener?.(this._onCoreUpdate);
|
|
4329
4755
|
const initialCols = this.cols;
|
|
4330
4756
|
const initialRows = this.rows;
|
|
4331
4757
|
this._setRowHeight();
|
|
@@ -4341,6 +4767,8 @@ var WTerm = class {
|
|
|
4341
4767
|
this.bridge.init(this.cols, this.rows);
|
|
4342
4768
|
if (this._themeColors)
|
|
4343
4769
|
this.bridge.setThemeColors?.(this._themeColors);
|
|
4770
|
+
else
|
|
4771
|
+
this._syncCssThemeColors();
|
|
4344
4772
|
this.cols = this.bridge.getCols();
|
|
4345
4773
|
this.rows = this.bridge.getRows();
|
|
4346
4774
|
if (this._debugEnabled) {
|
|
@@ -4407,21 +4835,47 @@ var WTerm = class {
|
|
|
4407
4835
|
}
|
|
4408
4836
|
_isScrolledToBottom() {
|
|
4409
4837
|
const el = this.element;
|
|
4410
|
-
|
|
4838
|
+
this._pinnedToBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 5;
|
|
4839
|
+
return this._pinnedToBottom;
|
|
4411
4840
|
}
|
|
4412
4841
|
_scrollToBottom() {
|
|
4413
4842
|
this._setScrollTop(this.element.scrollHeight);
|
|
4414
4843
|
}
|
|
4415
|
-
_setScrollTop(value) {
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4844
|
+
_setScrollTop(value, frame) {
|
|
4845
|
+
if (!frame) {
|
|
4846
|
+
const before = this.element.scrollTop;
|
|
4847
|
+
this.element.scrollTop = value;
|
|
4848
|
+
const after = this.element.scrollTop;
|
|
4849
|
+
this._isScrolledToBottom();
|
|
4850
|
+
if (after !== before)
|
|
4851
|
+
this._programmaticScrollTop = after;
|
|
4420
4852
|
return;
|
|
4421
|
-
|
|
4853
|
+
}
|
|
4854
|
+
const maxScrollTop = frame.maxScrollTop;
|
|
4855
|
+
const target = Math.max(0, Math.min(value, maxScrollTop));
|
|
4856
|
+
this._pinnedToBottom = maxScrollTop - target < 5;
|
|
4857
|
+
if (target !== frame.viewportScrollTop || frame.restoreScroll) {
|
|
4858
|
+
this._programmaticScrollTop = target;
|
|
4859
|
+
}
|
|
4860
|
+
this.element.scrollTop = target;
|
|
4422
4861
|
}
|
|
4423
|
-
/**
|
|
4862
|
+
/**
|
|
4863
|
+
* Apply host colors without writing terminal input or restarting the session.
|
|
4864
|
+
* Pass `null` to drop them and answer color queries from the page's CSS again.
|
|
4865
|
+
*/
|
|
4424
4866
|
setThemeColors(colors) {
|
|
4867
|
+
if (colors === null) {
|
|
4868
|
+
if (this._destroyed)
|
|
4869
|
+
return;
|
|
4870
|
+
this._themeColors = null;
|
|
4871
|
+
for (const property of THEME_PROPERTIES)
|
|
4872
|
+
this.element.style.removeProperty(property);
|
|
4873
|
+
this._cssThemeKey = null;
|
|
4874
|
+
this._syncCssThemeColors();
|
|
4875
|
+
this.renderer?.invalidateColors();
|
|
4876
|
+
this._scheduleRender();
|
|
4877
|
+
return;
|
|
4878
|
+
}
|
|
4425
4879
|
const values = [
|
|
4426
4880
|
colors.foreground,
|
|
4427
4881
|
colors.background,
|
|
@@ -4435,26 +4889,23 @@ var WTerm = class {
|
|
|
4435
4889
|
const copy = { ...colors, palette: [...colors.palette] };
|
|
4436
4890
|
this.bridge?.setThemeColors?.(copy);
|
|
4437
4891
|
this._themeColors = copy;
|
|
4438
|
-
|
|
4439
|
-
"--term-fg",
|
|
4440
|
-
"--term-bg",
|
|
4441
|
-
"--term-cursor",
|
|
4442
|
-
...colors.palette.map((_, index) => `--term-color-${index}`)
|
|
4443
|
-
];
|
|
4444
|
-
values.forEach((value, index) => this.element.style.setProperty(properties[index], `#${value.toString(16).padStart(6, "0")}`));
|
|
4892
|
+
values.forEach((value, index) => this.element.style.setProperty(THEME_PROPERTIES[index], `#${value.toString(16).padStart(6, "0")}`));
|
|
4445
4893
|
this.renderer?.invalidateColors();
|
|
4446
4894
|
this._scheduleRender();
|
|
4447
4895
|
}
|
|
4448
4896
|
write(data) {
|
|
4449
4897
|
if (!this.bridge || this._destroyed)
|
|
4450
4898
|
return;
|
|
4899
|
+
markSelectionChanged(this.element.ownerDocument);
|
|
4451
4900
|
this._textCapture.cancel();
|
|
4452
4901
|
this._rectangleDrag.cancel();
|
|
4453
4902
|
this._historySelection.invalidate();
|
|
4454
4903
|
this.renderer?.beforeMutation(this.bridge);
|
|
4455
4904
|
if (this.debug)
|
|
4456
4905
|
this.debug.traceWrite(data);
|
|
4457
|
-
this._shouldScrollToBottom = this.
|
|
4906
|
+
this._shouldScrollToBottom = this._pinnedToBottom;
|
|
4907
|
+
if (mayQueryThemeColors(data))
|
|
4908
|
+
this._syncCssThemeColors();
|
|
4458
4909
|
const windowSizeQueries = this._collectWindowSizeQueries(data);
|
|
4459
4910
|
let deliveryError;
|
|
4460
4911
|
let hasDeliveryError = false;
|
|
@@ -4465,43 +4916,9 @@ var WTerm = class {
|
|
|
4465
4916
|
deliveryError = error;
|
|
4466
4917
|
};
|
|
4467
4918
|
const drain = () => {
|
|
4468
|
-
const result = this.
|
|
4919
|
+
const result = this._deliverCoreEffects();
|
|
4469
4920
|
if (result.hasError)
|
|
4470
4921
|
recordDeliveryError(result.error);
|
|
4471
|
-
const bells = this.bridge?.getBellCount?.() ?? 0;
|
|
4472
|
-
if (bells > 0) {
|
|
4473
|
-
try {
|
|
4474
|
-
this.onBell?.(bells);
|
|
4475
|
-
} catch (error) {
|
|
4476
|
-
recordDeliveryError(error);
|
|
4477
|
-
}
|
|
4478
|
-
}
|
|
4479
|
-
try {
|
|
4480
|
-
this._deliverTitle();
|
|
4481
|
-
} catch (error) {
|
|
4482
|
-
recordDeliveryError(error);
|
|
4483
|
-
}
|
|
4484
|
-
try {
|
|
4485
|
-
const text = this.bridge?.getClipboardWrite?.() ?? null;
|
|
4486
|
-
if (text !== null && !this._destroyed)
|
|
4487
|
-
this.onClipboardWrite?.(text);
|
|
4488
|
-
} catch (error) {
|
|
4489
|
-
recordDeliveryError(error);
|
|
4490
|
-
}
|
|
4491
|
-
try {
|
|
4492
|
-
const state = this.bridge?.getShellIntegrationState?.() ?? null;
|
|
4493
|
-
if (state !== null && !this._destroyed)
|
|
4494
|
-
this.onShellIntegration?.(state);
|
|
4495
|
-
} catch (error) {
|
|
4496
|
-
recordDeliveryError(error);
|
|
4497
|
-
}
|
|
4498
|
-
try {
|
|
4499
|
-
const uri = this.bridge?.getWorkingDirectory?.() ?? null;
|
|
4500
|
-
if (uri !== null && !this._destroyed)
|
|
4501
|
-
this.onWorkingDirectory?.(uri);
|
|
4502
|
-
} catch (error) {
|
|
4503
|
-
recordDeliveryError(error);
|
|
4504
|
-
}
|
|
4505
4922
|
};
|
|
4506
4923
|
if (typeof data === "string") {
|
|
4507
4924
|
this.bridge.writeString(data, drain);
|
|
@@ -4527,6 +4944,84 @@ var WTerm = class {
|
|
|
4527
4944
|
if (hasDeliveryError)
|
|
4528
4945
|
throw deliveryError;
|
|
4529
4946
|
}
|
|
4947
|
+
/**
|
|
4948
|
+
* Hands the core the theme colors the page's CSS resolves to, unless the
|
|
4949
|
+
* host set explicit colors with setThemeColors().
|
|
4950
|
+
*/
|
|
4951
|
+
_syncCssThemeColors() {
|
|
4952
|
+
if (this._themeColors || !this.bridge?.setThemeColors || this._destroyed)
|
|
4953
|
+
return;
|
|
4954
|
+
let colors;
|
|
4955
|
+
try {
|
|
4956
|
+
colors = readCssThemeColors(this.element);
|
|
4957
|
+
} catch {
|
|
4958
|
+
return;
|
|
4959
|
+
}
|
|
4960
|
+
if (!colors)
|
|
4961
|
+
return;
|
|
4962
|
+
const key = [
|
|
4963
|
+
colors.foreground,
|
|
4964
|
+
colors.background,
|
|
4965
|
+
colors.cursor,
|
|
4966
|
+
...colors.palette
|
|
4967
|
+
].join();
|
|
4968
|
+
if (key === this._cssThemeKey)
|
|
4969
|
+
return;
|
|
4970
|
+
this._cssThemeKey = key;
|
|
4971
|
+
this.bridge.setThemeColors(colors);
|
|
4972
|
+
}
|
|
4973
|
+
/**
|
|
4974
|
+
* Hands replies, bells, titles, clipboard writes, shell state and the
|
|
4975
|
+
* working directory to the host. Returns the first host callback error.
|
|
4976
|
+
*/
|
|
4977
|
+
_deliverCoreEffects() {
|
|
4978
|
+
let hasError = false;
|
|
4979
|
+
let firstError;
|
|
4980
|
+
const record = (error) => {
|
|
4981
|
+
if (hasError)
|
|
4982
|
+
return;
|
|
4983
|
+
hasError = true;
|
|
4984
|
+
firstError = error;
|
|
4985
|
+
};
|
|
4986
|
+
const result = this._drainResponses();
|
|
4987
|
+
if (result.hasError)
|
|
4988
|
+
record(result.error);
|
|
4989
|
+
const bells = this.bridge?.getBellCount?.() ?? 0;
|
|
4990
|
+
if (bells > 0) {
|
|
4991
|
+
try {
|
|
4992
|
+
this.onBell?.(bells);
|
|
4993
|
+
} catch (error) {
|
|
4994
|
+
record(error);
|
|
4995
|
+
}
|
|
4996
|
+
}
|
|
4997
|
+
try {
|
|
4998
|
+
this._deliverTitle();
|
|
4999
|
+
} catch (error) {
|
|
5000
|
+
record(error);
|
|
5001
|
+
}
|
|
5002
|
+
try {
|
|
5003
|
+
const text = this.bridge?.getClipboardWrite?.() ?? null;
|
|
5004
|
+
if (text !== null && !this._destroyed)
|
|
5005
|
+
this.onClipboardWrite?.(text);
|
|
5006
|
+
} catch (error) {
|
|
5007
|
+
record(error);
|
|
5008
|
+
}
|
|
5009
|
+
try {
|
|
5010
|
+
const state = this.bridge?.getShellIntegrationState?.() ?? null;
|
|
5011
|
+
if (state !== null && !this._destroyed)
|
|
5012
|
+
this.onShellIntegration?.(state);
|
|
5013
|
+
} catch (error) {
|
|
5014
|
+
record(error);
|
|
5015
|
+
}
|
|
5016
|
+
try {
|
|
5017
|
+
const uri = this.bridge?.getWorkingDirectory?.() ?? null;
|
|
5018
|
+
if (uri !== null && !this._destroyed)
|
|
5019
|
+
this.onWorkingDirectory?.(uri);
|
|
5020
|
+
} catch (error) {
|
|
5021
|
+
record(error);
|
|
5022
|
+
}
|
|
5023
|
+
return { hasError, error: firstError };
|
|
5024
|
+
}
|
|
4530
5025
|
/** Fit the grid to the current element and font metrics. */
|
|
4531
5026
|
fit() {
|
|
4532
5027
|
if (!this.bridge || this._destroyed)
|
|
@@ -4557,6 +5052,7 @@ var WTerm = class {
|
|
|
4557
5052
|
resize(cols, rows) {
|
|
4558
5053
|
if (!this.bridge || this._destroyed)
|
|
4559
5054
|
return;
|
|
5055
|
+
markSelectionChanged(this.element.ownerDocument);
|
|
4560
5056
|
this._textCapture.cancel();
|
|
4561
5057
|
this._rectangleDrag.cancel();
|
|
4562
5058
|
this._historySelection.invalidate();
|
|
@@ -4706,6 +5202,7 @@ var WTerm = class {
|
|
|
4706
5202
|
if (!this.element.contains(range.startContainer) || !this.element.contains(range.endContainer))
|
|
4707
5203
|
return;
|
|
4708
5204
|
}
|
|
5205
|
+
markSelectionChanged(this.element.ownerDocument);
|
|
4709
5206
|
selection.removeAllRanges();
|
|
4710
5207
|
}
|
|
4711
5208
|
_invalidateSearch() {
|
|
@@ -4784,17 +5281,57 @@ var WTerm = class {
|
|
|
4784
5281
|
}
|
|
4785
5282
|
}
|
|
4786
5283
|
_scheduleRender() {
|
|
4787
|
-
if (!this._canRender() || this._synchronizedOutputState === "held" || this
|
|
5284
|
+
if (!this._canRender() || this._synchronizedOutputState === "held" || pendingRenders.has(this))
|
|
4788
5285
|
return;
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
5286
|
+
pendingRenders.add(this);
|
|
5287
|
+
if (renderFrameId === null) {
|
|
5288
|
+
const frameId = requestAnimationFrame(_WTerm._flushRenders);
|
|
5289
|
+
if (pendingRenders.size > 0)
|
|
5290
|
+
renderFrameId = frameId;
|
|
5291
|
+
}
|
|
4793
5292
|
}
|
|
4794
5293
|
_cancelScheduledRender() {
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
5294
|
+
pendingRenders.delete(this);
|
|
5295
|
+
if (pendingRenders.size === 0 && renderFrameId !== null) {
|
|
5296
|
+
cancelAnimationFrame(renderFrameId);
|
|
5297
|
+
renderFrameId = null;
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
static _flushRenders() {
|
|
5301
|
+
renderFrameId = null;
|
|
5302
|
+
const frames = /* @__PURE__ */ new Map();
|
|
5303
|
+
const terminals = Array.from(pendingRenders);
|
|
5304
|
+
for (const document2 of new Set(terminals.map((terminal) => terminal.element.ownerDocument)))
|
|
5305
|
+
markSelectionChanged(document2);
|
|
5306
|
+
for (const phase of ["read", "render", "measure", "scroll", "finish"]) {
|
|
5307
|
+
for (const terminal of terminals) {
|
|
5308
|
+
try {
|
|
5309
|
+
if (phase === "read") {
|
|
5310
|
+
if (!pendingRenders.delete(terminal))
|
|
5311
|
+
continue;
|
|
5312
|
+
const frame2 = terminal._readRender();
|
|
5313
|
+
if (frame2)
|
|
5314
|
+
frames.set(terminal, frame2);
|
|
5315
|
+
continue;
|
|
5316
|
+
}
|
|
5317
|
+
const frame = frames.get(terminal);
|
|
5318
|
+
if (!frame)
|
|
5319
|
+
continue;
|
|
5320
|
+
if (phase === "render")
|
|
5321
|
+
terminal._renderFrame(frame);
|
|
5322
|
+
else if (phase === "measure")
|
|
5323
|
+
terminal._measureRenderScroll(frame);
|
|
5324
|
+
else if (phase === "scroll")
|
|
5325
|
+
terminal._scrollRender(frame);
|
|
5326
|
+
else
|
|
5327
|
+
terminal._finishRender();
|
|
5328
|
+
} catch (error) {
|
|
5329
|
+
frames.delete(terminal);
|
|
5330
|
+
queueMicrotask(() => {
|
|
5331
|
+
throw error;
|
|
5332
|
+
});
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
4798
5335
|
}
|
|
4799
5336
|
}
|
|
4800
5337
|
_updateSynchronizedOutput(synchronized, generation) {
|
|
@@ -4839,6 +5376,20 @@ var WTerm = class {
|
|
|
4839
5376
|
clearTimeout(this._synchronizedOutputTimer);
|
|
4840
5377
|
this._synchronizedOutputTimer = null;
|
|
4841
5378
|
}
|
|
5379
|
+
/** Prepares colored print output without advancing a paused or synchronized screen. */
|
|
5380
|
+
_setPrintMode(printing) {
|
|
5381
|
+
if (!this.renderer || this._destroyed)
|
|
5382
|
+
return;
|
|
5383
|
+
const keepCanvas = printing && (!this._canRender() || this._synchronizedOutputState === "held");
|
|
5384
|
+
this.element.classList.toggle("term-print-canvas", keepCanvas);
|
|
5385
|
+
this.renderer.setCanvasSuspended(printing && !keepCanvas);
|
|
5386
|
+
if (keepCanvas)
|
|
5387
|
+
return;
|
|
5388
|
+
if (printing)
|
|
5389
|
+
this._doRender();
|
|
5390
|
+
else
|
|
5391
|
+
this._scheduleRender();
|
|
5392
|
+
}
|
|
4842
5393
|
_setupRendererIfNeeded() {
|
|
4843
5394
|
if (!this._rendererNeedsSetup)
|
|
4844
5395
|
return;
|
|
@@ -4855,10 +5406,20 @@ var WTerm = class {
|
|
|
4855
5406
|
this._doRender();
|
|
4856
5407
|
}
|
|
4857
5408
|
_doRender() {
|
|
4858
|
-
|
|
5409
|
+
this._cancelScheduledRender();
|
|
5410
|
+
markSelectionChanged(this.element.ownerDocument);
|
|
5411
|
+
const frame = this._readRender();
|
|
5412
|
+
if (!frame)
|
|
4859
5413
|
return;
|
|
5414
|
+
this._renderFrame(frame);
|
|
5415
|
+
this._measureRenderScroll(frame);
|
|
5416
|
+
this._scrollRender(frame);
|
|
5417
|
+
this._finishRender();
|
|
5418
|
+
}
|
|
5419
|
+
_readRender() {
|
|
5420
|
+
if (!this._canRender() || !this.bridge || !this.renderer || this._synchronizedOutputState === "held")
|
|
5421
|
+
return null;
|
|
4860
5422
|
let dirtyCount = 0;
|
|
4861
|
-
const t0 = this.debug ? performance.now() : 0;
|
|
4862
5423
|
if (this.debug) {
|
|
4863
5424
|
for (let r = 0; r < this.rows; r++) {
|
|
4864
5425
|
if (this.bridge.isDirtyRow(r))
|
|
@@ -4866,42 +5427,69 @@ var WTerm = class {
|
|
|
4866
5427
|
}
|
|
4867
5428
|
}
|
|
4868
5429
|
const rowHeight = this._rowHeight || 17;
|
|
5430
|
+
const viewportScrollTop = this.element.scrollTop;
|
|
5431
|
+
const clientHeight = this.element.clientHeight;
|
|
5432
|
+
this._pinnedToBottom = this.element.scrollHeight - viewportScrollTop - clientHeight < 5;
|
|
5433
|
+
const style = getComputedStyle(this.element);
|
|
5434
|
+
const padding = (parseFloat(style.paddingTop) || 0) + (parseFloat(style.paddingBottom) || 0);
|
|
4869
5435
|
const scrollbackCount = this.bridge.getScrollbackCount();
|
|
4870
5436
|
const discardedCount = this.bridge.getScrollbackDiscardedCount?.();
|
|
4871
5437
|
const discardedDelta = discardedCount !== void 0 && discardedCount >= this._scrollbackDiscardedCount ? discardedCount - this._scrollbackDiscardedCount : 0;
|
|
4872
5438
|
if (discardedCount !== void 0) {
|
|
4873
5439
|
this._scrollbackDiscardedCount = discardedCount;
|
|
4874
5440
|
}
|
|
4875
|
-
let scrollTop = this._pendingResizeScrollTop !== null ? this._pendingResizeScrollTop :
|
|
5441
|
+
let scrollTop = this._pendingResizeScrollTop !== null ? this._pendingResizeScrollTop : viewportScrollTop;
|
|
4876
5442
|
if (!this._shouldScrollToBottom && discardedDelta > 0) {
|
|
4877
5443
|
scrollTop = Math.max(0, scrollTop - discardedDelta * rowHeight);
|
|
4878
|
-
if (this._pendingResizeScrollTop !== null) {
|
|
4879
|
-
this._pendingResizeScrollTop = scrollTop;
|
|
4880
|
-
} else {
|
|
4881
|
-
this._setScrollTop(scrollTop);
|
|
4882
|
-
}
|
|
4883
5444
|
}
|
|
4884
|
-
|
|
4885
|
-
scrollTop
|
|
4886
|
-
|
|
5445
|
+
return {
|
|
5446
|
+
scrollTop,
|
|
5447
|
+
viewportScrollTop,
|
|
5448
|
+
clientHeight,
|
|
5449
|
+
maxScrollTop: Math.max(0, Math.round((scrollbackCount + this.rows) * rowHeight + padding + this._keyboardInset + this._historySelection.statusHeight) - clientHeight),
|
|
4887
5450
|
rowHeight,
|
|
4888
|
-
|
|
5451
|
+
scrollbackCount,
|
|
5452
|
+
discardedCount,
|
|
5453
|
+
dirtyCount,
|
|
5454
|
+
followOutput: this._shouldScrollToBottom,
|
|
5455
|
+
restoreScroll: this._pendingResizeScrollTop !== null || discardedDelta > 0
|
|
5456
|
+
};
|
|
5457
|
+
}
|
|
5458
|
+
_renderFrame(frame) {
|
|
5459
|
+
if (!this.bridge || !this.renderer)
|
|
5460
|
+
return;
|
|
5461
|
+
const t0 = this.debug ? performance.now() : 0;
|
|
5462
|
+
this.renderer.render(this.bridge, {
|
|
5463
|
+
scrollTop: frame.followOutput ? Math.max(0, (frame.scrollbackCount + this.rows) * frame.rowHeight - frame.clientHeight) : frame.scrollTop,
|
|
5464
|
+
clientHeight: frame.clientHeight,
|
|
5465
|
+
rowHeight: frame.rowHeight,
|
|
5466
|
+
scrollbackDiscardedCount: frame.discardedCount,
|
|
4889
5467
|
charWidth: this._charWidth
|
|
4890
5468
|
});
|
|
4891
5469
|
if (this.debug) {
|
|
4892
|
-
this.debug.recordRender(performance.now() - t0, dirtyCount);
|
|
5470
|
+
this.debug.recordRender(performance.now() - t0, frame.dirtyCount);
|
|
4893
5471
|
}
|
|
4894
|
-
const hasScrollback = scrollbackCount > 0 || this.renderer.hasImageFlow;
|
|
5472
|
+
const hasScrollback = frame.scrollbackCount > 0 || this.renderer.hasImageFlow;
|
|
4895
5473
|
this.element.classList.toggle("has-scrollback", hasScrollback);
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
this._pendingResizeScrollTop = null;
|
|
4901
|
-
this._setScrollTop(pendingScrollTop);
|
|
4902
|
-
} else if (!hasScrollback && this.element.scrollTop !== 0) {
|
|
4903
|
-
this._setScrollTop(0);
|
|
5474
|
+
}
|
|
5475
|
+
_measureRenderScroll(frame) {
|
|
5476
|
+
if (this.renderer?.hasImageFlow) {
|
|
5477
|
+
frame.maxScrollTop = Math.max(0, this.element.scrollHeight - frame.clientHeight);
|
|
4904
5478
|
}
|
|
5479
|
+
}
|
|
5480
|
+
_scrollRender(frame) {
|
|
5481
|
+
this._pendingResizeScrollTop = null;
|
|
5482
|
+
if (frame.followOutput) {
|
|
5483
|
+
this._setScrollTop(frame.maxScrollTop, frame);
|
|
5484
|
+
} else if (frame.restoreScroll) {
|
|
5485
|
+
this._setScrollTop(frame.scrollTop, frame);
|
|
5486
|
+
} else if (!frame.scrollbackCount && !this.renderer?.hasImageFlow) {
|
|
5487
|
+
this._setScrollTop(0, frame);
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
_finishRender() {
|
|
5491
|
+
if (!this.bridge || !this.renderer || !this._canRender() || this._synchronizedOutputState === "held")
|
|
5492
|
+
return;
|
|
4905
5493
|
this.input?.syncInputPosition();
|
|
4906
5494
|
if (this._searchReveal) {
|
|
4907
5495
|
this._searchReveal = false;
|
|
@@ -5050,15 +5638,26 @@ var WTerm = class {
|
|
|
5050
5638
|
probe.style.width = "auto";
|
|
5051
5639
|
probe.textContent = "W";
|
|
5052
5640
|
row.appendChild(probe);
|
|
5641
|
+
const block = document.createElement("span");
|
|
5642
|
+
block.style.width = "auto";
|
|
5643
|
+
block.style.letterSpacing = "0";
|
|
5644
|
+
block.textContent = "\u2580";
|
|
5645
|
+
row.appendChild(block);
|
|
5053
5646
|
this._container.appendChild(row);
|
|
5054
5647
|
const charWidth = probe.getBoundingClientRect().width;
|
|
5648
|
+
const blockWidth = block.getBoundingClientRect().width;
|
|
5055
5649
|
const rowHeight = row.getBoundingClientRect().height;
|
|
5056
5650
|
row.remove();
|
|
5057
5651
|
if (charWidth === 0 || rowHeight === 0)
|
|
5058
5652
|
return null;
|
|
5653
|
+
const changed = this._charWidth > 0 && (charWidth !== this._charWidth || rowHeight !== this._rowHeight);
|
|
5059
5654
|
this._charWidth = charWidth;
|
|
5060
5655
|
this._rowHeight = rowHeight;
|
|
5061
5656
|
this.element.style.setProperty("--term-cell-width", `${charWidth}px`);
|
|
5657
|
+
const drift = blockWidth > 0 ? charWidth - blockWidth : 0;
|
|
5658
|
+
this.element.style.setProperty("--term-block-spacing", Math.abs(drift) > 0.01 ? `${drift}px` : "0px");
|
|
5659
|
+
if (changed && this.renderer)
|
|
5660
|
+
this._scheduleRender();
|
|
5062
5661
|
return { charWidth, rowHeight };
|
|
5063
5662
|
}
|
|
5064
5663
|
_setupResizeObserver() {
|
|
@@ -5109,6 +5708,7 @@ var WTerm = class {
|
|
|
5109
5708
|
}
|
|
5110
5709
|
/** Keeps the grid's last row above the keyboard while the element scrolls to the bottom. */
|
|
5111
5710
|
_setKeyboardInset(px) {
|
|
5711
|
+
this._keyboardInset = Math.max(0, px);
|
|
5112
5712
|
if (px <= 0) {
|
|
5113
5713
|
this._keyboardSpacer?.remove();
|
|
5114
5714
|
this._keyboardSpacer = null;
|
|
@@ -5142,6 +5742,7 @@ var WTerm = class {
|
|
|
5142
5742
|
}
|
|
5143
5743
|
destroy() {
|
|
5144
5744
|
this._destroyed = true;
|
|
5745
|
+
this.bridge?.setUpdateListener?.(null);
|
|
5145
5746
|
this._textCapture.cancel();
|
|
5146
5747
|
this._historySelection.destroy();
|
|
5147
5748
|
this._rectangleDrag.destroy();
|
|
@@ -5170,7 +5771,9 @@ var WTerm = class {
|
|
|
5170
5771
|
this.element.ownerDocument.removeEventListener("keydown", this._onModifierChange);
|
|
5171
5772
|
this.element.ownerDocument.removeEventListener("keyup", this._onModifierChange);
|
|
5172
5773
|
this.element.ownerDocument.defaultView?.removeEventListener("blur", this._onWindowBlur);
|
|
5173
|
-
this.element.
|
|
5774
|
+
this.element.ownerDocument.defaultView?.removeEventListener("beforeprint", this._onBeforePrint);
|
|
5775
|
+
this.element.ownerDocument.defaultView?.removeEventListener("afterprint", this._onAfterPrint);
|
|
5776
|
+
this.element.classList.remove("link-modifier-active", "term-print-canvas");
|
|
5174
5777
|
this.element.innerHTML = "";
|
|
5175
5778
|
if (this.debug && globalThis.__wterm === this) {
|
|
5176
5779
|
delete globalThis.__wterm;
|
|
@@ -5187,6 +5790,20 @@ var controlBytes = {
|
|
|
5187
5790
|
SIGHUP: null
|
|
5188
5791
|
};
|
|
5189
5792
|
|
|
5793
|
+
// src/cell-canvas.ts
|
|
5794
|
+
function installCellCanvasHold(target = Renderer) {
|
|
5795
|
+
const set = target.prototype.setCanvasSuspended;
|
|
5796
|
+
target.prototype.setCanvasSuspended = function() {
|
|
5797
|
+
set.call(this, true);
|
|
5798
|
+
};
|
|
5799
|
+
const setup = target.prototype.setup;
|
|
5800
|
+
target.prototype.setup = function(cols, rows) {
|
|
5801
|
+
setup.call(this, cols, rows);
|
|
5802
|
+
set.call(this, true);
|
|
5803
|
+
};
|
|
5804
|
+
}
|
|
5805
|
+
installCellCanvasHold();
|
|
5806
|
+
|
|
5190
5807
|
// src/color-query.ts
|
|
5191
5808
|
var query = /\x1b\](1[01])((?:;\?){1,10})(\x07|\x1b\\)/g;
|
|
5192
5809
|
var partial = /\x1b(?:\](?:1(?:[01](?:;\?){0,10};?\x1b?)?)?)?$/;
|
|
@@ -6251,10 +6868,17 @@ var GhosttyCore = class _GhosttyCore {
|
|
|
6251
6868
|
const read2 = this._cellBytes === CELL_BYTES_V2 ? this.wasm.exports.get_viewport_v2 : this.wasm.exports.get_viewport;
|
|
6252
6869
|
read2(this.termPtr, this._viewportBufPtr);
|
|
6253
6870
|
this._viewportStale = false;
|
|
6871
|
+
this._viewportView = null;
|
|
6254
6872
|
}
|
|
6255
|
-
if (this._viewportView
|
|
6256
|
-
|
|
6873
|
+
if (this._viewportView) {
|
|
6874
|
+
try {
|
|
6875
|
+
this._viewportView.byteLength;
|
|
6876
|
+
return;
|
|
6877
|
+
} catch {
|
|
6878
|
+
this._viewportView = null;
|
|
6879
|
+
}
|
|
6257
6880
|
}
|
|
6881
|
+
this._viewportView = new DataView(this.wasm.exports.memory.buffer, this._viewportBufPtr, this._viewportBufSize);
|
|
6258
6882
|
}
|
|
6259
6883
|
};
|
|
6260
6884
|
|
|
@@ -6262,6 +6886,22 @@ var GhosttyCore = class _GhosttyCore {
|
|
|
6262
6886
|
var base = 5360640;
|
|
6263
6887
|
var replies = /\x1b\]1[01];rgb:[0-9a-f/]+(?:\x07|\x1b\\)/gi;
|
|
6264
6888
|
var slot = (rgb) => rgb !== void 0 && rgb >>> 4 === base >>> 4 ? rgb & 15 : void 0;
|
|
6889
|
+
var markers = {
|
|
6890
|
+
foreground: 13948116,
|
|
6891
|
+
background: 1907997,
|
|
6892
|
+
cursor: 11448237,
|
|
6893
|
+
palette: Array.from({ length: 16 }, (_, index) => base + index)
|
|
6894
|
+
};
|
|
6895
|
+
function keepMarkerPalette(apply, palette = markers.palette) {
|
|
6896
|
+
return (colors) => {
|
|
6897
|
+
apply({
|
|
6898
|
+
foreground: colors.foreground,
|
|
6899
|
+
background: colors.background,
|
|
6900
|
+
cursor: colors.cursor,
|
|
6901
|
+
palette
|
|
6902
|
+
});
|
|
6903
|
+
};
|
|
6904
|
+
}
|
|
6265
6905
|
function indexed(cell) {
|
|
6266
6906
|
const fg = slot(cell.fgRgb);
|
|
6267
6907
|
const bg = slot(cell.bgRgb);
|
|
@@ -6275,14 +6915,10 @@ function indexed(cell) {
|
|
|
6275
6915
|
}
|
|
6276
6916
|
return cell;
|
|
6277
6917
|
}
|
|
6278
|
-
|
|
6279
|
-
const
|
|
6280
|
-
core.setThemeColors(
|
|
6281
|
-
|
|
6282
|
-
background: 1907997,
|
|
6283
|
-
cursor: 11448237,
|
|
6284
|
-
palette: Array.from({ length: 16 }, (_, index) => base + index)
|
|
6285
|
-
});
|
|
6918
|
+
function wireCore(core) {
|
|
6919
|
+
const apply = core.setThemeColors.bind(core);
|
|
6920
|
+
core.setThemeColors = keepMarkerPalette(apply);
|
|
6921
|
+
apply(markers);
|
|
6286
6922
|
const cell = core.getCell.bind(core);
|
|
6287
6923
|
const history = core.getScrollbackCell.bind(core);
|
|
6288
6924
|
const response = core.getResponse.bind(core);
|
|
@@ -6297,9 +6933,12 @@ async function loadCore(wasmPath) {
|
|
|
6297
6933
|
};
|
|
6298
6934
|
return core;
|
|
6299
6935
|
}
|
|
6936
|
+
async function loadCore(wasmPath, load = GhosttyCore.load.bind(GhosttyCore)) {
|
|
6937
|
+
return wireCore(await load({ wasmPath, scrollbackLimit: 4e6 }));
|
|
6938
|
+
}
|
|
6300
6939
|
|
|
6301
6940
|
// node_modules/@wterm/dom/src/terminal.css
|
|
6302
|
-
var terminal_default = '.wterm {\n /* Application overrides are owned by the renderer; each terminal is isolated. */\n --term-app-fg: initial;\n --term-app-bg: initial;\n --term-app-cursor: initial;\n\n --term-fg: #d4d4d4;\n --term-bg: #1e1e1e;\n --term-cursor: #aeafad;\n\n --term-color-0: #1e1e1e;\n --term-color-1: #f44747;\n --term-color-2: #6a9955;\n --term-color-3: #d7ba7d;\n --term-color-4: #569cd6;\n --term-color-5: #c586c0;\n --term-color-6: #4ec9b0;\n --term-color-7: #d4d4d4;\n --term-color-8: #808080;\n --term-color-9: #f44747;\n --term-color-10: #6a9955;\n --term-color-11: #d7ba7d;\n --term-color-12: #569cd6;\n --term-color-13: #c586c0;\n --term-color-14: #4ec9b0;\n --term-color-15: #ffffff;\n\n --term-font-family:\n "Menlo", "Consolas", "DejaVu Sans Mono", "Courier New", monospace;\n --term-font-size: 14px;\n --term-line-height: 1.2;\n --term-row-height: 17px;\n\n position: relative;\n background: var(--term-app-bg, var(--term-bg));\n color: var(--term-app-fg, var(--term-fg));\n font-family: var(--term-font-family);\n font-size: var(--term-font-size);\n font-kerning: none;\n font-variant-ligatures: none;\n line-height: var(--term-line-height);\n padding: 12px;\n border-radius: 8px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);\n outline: none;\n overflow: hidden;\n overflow-anchor: none;\n}\n\n.wterm:focus,\n.wterm:focus-visible {\n outline: none;\n}\n\n.term-grid {\n display: block;\n position: relative;\n white-space: pre;\n contain: layout paint style;\n will-change: contents;\n}\n\n.term-announcements {\n position: absolute;\n left: 0;\n top: 0;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: pre;\n pointer-events: none;\n user-select: none;\n}\n\n.term-images {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 1;\n}\n\n.term-search-layer {\n position: absolute;\n inset: 0;\n pointer-events: none;\n user-select: none;\n z-index: 2;\n}\n\n.term-search-match {\n position: absolute;\n background: var(--term-search-match, rgb(255 200 0 / 25%));\n}\n\n.term-search-active {\n background: var(--term-search-active, rgb(255 150 0 / 40%));\n box-shadow: inset 0 0 0 1px var(--term-search-border, #ffb000);\n}\n\n.term-image-flow-spacer {\n display: block;\n height: 0;\n pointer-events: none;\n}\n\n.term-image {\n position: absolute;\n display: block;\n pointer-events: none;\n user-select: none;\n}\n\n.term-row {\n display: block;\n height: var(--term-row-height);\n line-height: var(--term-row-height);\n contain: layout style;\n}\n\n.term-select-all .term-row,\n.term-rectangle-row {\n position: relative;\n}\n\n.term-select-all .term-row::after,\n.term-rectangle-row::after {\n content: "";\n position: absolute;\n inset: 0;\n background: var(--term-selection-bg, rgb(80 140 255 / 30%));\n pointer-events: none;\n user-select: none;\n z-index: 3;\n}\n\n.term-rectangle-row::after {\n left: var(--term-selection-left);\n width: var(--term-selection-width);\n right: auto;\n}\n\n.term-selection-status {\n position: sticky;\n bottom: 0;\n width: fit-content;\n max-width: 100%;\n white-space: normal;\n background: var(--term-app-bg, var(--term-bg));\n color: var(--term-app-fg, var(--term-fg));\n user-select: none;\n pointer-events: none;\n z-index: 4;\n}\n\n.term-selection-status:empty {\n display: none;\n}\n\n.term-scrollback-spacer {\n display: block;\n pointer-events: none;\n}\n\n.term-keyboard-spacer {\n flex: none;\n pointer-events: none;\n}\n\n.term-size-probe {\n position: absolute;\n top: 0;\n left: 0;\n visibility: hidden;\n pointer-events: none;\n white-space: pre;\n width: auto;\n height: var(--term-row-height);\n}\n\n.term-row > span,\n.term-row > .term-link,\n.term-link > span {\n display: inline-block;\n height: var(--term-row-height);\n vertical-align: top;\n}\n\n.term-row > span,\n.term-link > span {\n width: calc(var(--term-span-cols, 1) * var(--term-cell-width, 1ch));\n /* Glyph ink may overhang its advance without moving the following cell. */\n overflow: visible;\n}\n\n.term-link {\n color: inherit;\n cursor: text;\n}\n\n.wterm.link-modifier-active .term-link:hover,\n.term-link:focus-visible {\n cursor: pointer;\n}\n\n.wterm.link-modifier-active .term-link:hover > span,\n.term-link:focus-visible > span {\n text-decoration: underline;\n text-underline-offset: 0.15em;\n}\n\n.term-block {\n width: var(--term-cell-width, 1ch);\n overflow: hidden;\n -webkit-text-fill-color: transparent;\n}\n\n.term-box {\n --term-box-stroke: max(\n 1px,\n round(calc(var(--term-cell-width, 1ch) * 0.18), 1px)\n );\n -webkit-text-fill-color: transparent;\n}\n\n.term-box-heavy,\n.term-box-bold {\n --term-box-stroke: max(\n 2px,\n round(calc(var(--term-cell-width, 1ch) * 0.3), 1px)\n );\n}\n\n.term-box-round {\n position: relative;\n}\n\n.term-box-round::after {\n content: "";\n position: absolute;\n box-sizing: border-box;\n border: 0 solid currentColor;\n pointer-events: none;\n}\n\n.term-box-round-tl::after {\n inset: calc(50% - var(--term-box-stroke) * 0.5) 0 0\n calc(50% - var(--term-box-stroke) * 0.5);\n border-top-width: var(--term-box-stroke);\n border-left-width: var(--term-box-stroke);\n border-top-left-radius: 100%;\n}\n\n.term-box-round-tr::after {\n inset: calc(50% - var(--term-box-stroke) * 0.5)\n calc(50% - var(--term-box-stroke) * 0.5) 0 0;\n border-top-width: var(--term-box-stroke);\n border-right-width: var(--term-box-stroke);\n border-top-right-radius: 100%;\n}\n\n.term-box-round-br::after {\n inset: 0 calc(50% - var(--term-box-stroke) * 0.5)\n calc(50% - var(--term-box-stroke) * 0.5) 0;\n border-bottom-width: var(--term-box-stroke);\n border-right-width: var(--term-box-stroke);\n border-bottom-right-radius: 100%;\n}\n\n.term-box-round-bl::after {\n inset: 0 0 calc(50% - var(--term-box-stroke) * 0.5)\n calc(50% - var(--term-box-stroke) * 0.5);\n border-bottom-width: var(--term-box-stroke);\n border-left-width: var(--term-box-stroke);\n border-bottom-left-radius: 100%;\n}\n\n@media (forced-colors: active), print {\n .term-block {\n background: none !important;\n -webkit-text-fill-color: currentColor;\n }\n\n .term-box {\n background-image: none !important;\n -webkit-text-fill-color: currentColor;\n }\n\n .term-box-round::after {\n display: none;\n }\n}\n\n.term-wide {\n --term-span-cols: 2;\n overflow: visible;\n}\n\n.term-cursor {\n color: var(--term-cell-fg, inherit);\n background: var(--term-cell-bg, transparent);\n outline: 1px solid var(--term-app-cursor, var(--term-cursor));\n outline-offset: -1px;\n}\n\n/* Native text selection can blur the input until click-to-focus runs. Keep\n the cursor active during that press without cancelling the selection. */\n.wterm:is(.focused, :active) .term-cursor {\n background: var(--term-app-cursor, var(--term-cursor));\n color: var(--term-app-bg, var(--term-bg));\n outline: none;\n}\n\n.wterm:is(.focused, :active) .term-grid[data-cursor-shape="bar"] .term-cursor,\n.wterm:is(.focused, :active) .term-grid[data-cursor-shape="underline"] .term-cursor {\n background: var(--term-cell-bg, transparent);\n color: var(--term-cell-fg, inherit);\n box-shadow: var(--term-cursor-shadow);\n --term-cursor-animation: cursor-line-blink;\n}\n\n.term-grid[data-cursor-shape="bar"] .term-cursor {\n --term-cursor-shadow: inset 2px 0 0 var(--term-app-cursor, var(--term-cursor));\n}\n\n.term-grid[data-cursor-shape="underline"] .term-cursor {\n --term-cursor-shadow: inset 0 -2px 0\n var(--term-app-cursor, var(--term-cursor));\n}\n\n.wterm:is(.focused, :active).cursor-blink .term-cursor,\n.wterm:is(.focused, :active):not(.cursor-steady)\n .term-grid[data-cursor-blink="true"]\n .term-cursor {\n animation: var(--term-cursor-animation, cursor-blink) 1s step-end infinite;\n}\n\n@keyframes cursor-blink {\n 0%,\n 100% {\n background: var(--term-app-cursor, var(--term-cursor));\n color: var(--term-app-bg, var(--term-bg));\n }\n 50% {\n background: var(--term-cell-bg, transparent);\n color: var(--term-cell-fg, inherit);\n }\n}\n\n@keyframes cursor-line-blink {\n 0%,\n 100% {\n box-shadow: var(--term-cursor-shadow);\n }\n 50% {\n box-shadow: none;\n }\n}\n\n.wterm.has-scrollback,\n.wterm.has-image-flow {\n overflow-y: auto;\n}\n\n.wterm ::selection {\n background: rgba(86, 156, 214, 0.3);\n}\n\n/* Solarized Dark */\n.wterm.theme-solarized-dark {\n --term-fg: #839496;\n --term-bg: #002b36;\n --term-cursor: #93a1a1;\n --term-color-0: #073642;\n --term-color-1: #dc322f;\n --term-color-2: #859900;\n --term-color-3: #b58900;\n --term-color-4: #268bd2;\n --term-color-5: #d33682;\n --term-color-6: #2aa198;\n --term-color-7: #eee8d5;\n --term-color-8: #586e75;\n --term-color-9: #cb4b16;\n --term-color-10: #586e75;\n --term-color-11: #657b83;\n --term-color-12: #839496;\n --term-color-13: #6c71c4;\n --term-color-14: #93a1a1;\n --term-color-15: #fdf6e3;\n}\n\n/* Monokai */\n.wterm.theme-monokai {\n --term-fg: #f8f8f2;\n --term-bg: #272822;\n --term-cursor: #f8f8f0;\n --term-color-0: #272822;\n --term-color-1: #f92672;\n --term-color-2: #a6e22e;\n --term-color-3: #f4bf75;\n --term-color-4: #66d9ef;\n --term-color-5: #ae81ff;\n --term-color-6: #a1efe4;\n --term-color-7: #f8f8f2;\n --term-color-8: #75715e;\n --term-color-9: #f92672;\n --term-color-10: #a6e22e;\n --term-color-11: #f4bf75;\n --term-color-12: #66d9ef;\n --term-color-13: #ae81ff;\n --term-color-14: #a1efe4;\n --term-color-15: #f9f8f5;\n}\n\n/* Light */\n.wterm.theme-light {\n --term-fg: #383a42;\n --term-bg: #fafafa;\n --term-cursor: #526eff;\n --term-color-0: #383a42;\n --term-color-1: #e45649;\n --term-color-2: #50a14f;\n --term-color-3: #c18401;\n --term-color-4: #4078f2;\n --term-color-5: #a626a4;\n --term-color-6: #0184bc;\n --term-color-7: #fafafa;\n --term-color-8: #a0a1a7;\n --term-color-9: #e45649;\n --term-color-10: #50a14f;\n --term-color-11: #c18401;\n --term-color-12: #4078f2;\n --term-color-13: #a626a4;\n --term-color-14: #0184bc;\n --term-color-15: #ffffff;\n}\n';
|
|
6941
|
+
var terminal_default = '.wterm {\n /* Application overrides are owned by the renderer; each terminal is isolated. */\n --term-app-fg: initial;\n --term-app-bg: initial;\n --term-app-cursor: initial;\n\n --term-fg: #d4d4d4;\n --term-bg: #1e1e1e;\n --term-cursor: #aeafad;\n\n --term-color-0: #1e1e1e;\n --term-color-1: #f44747;\n --term-color-2: #6a9955;\n --term-color-3: #d7ba7d;\n --term-color-4: #569cd6;\n --term-color-5: #c586c0;\n --term-color-6: #4ec9b0;\n --term-color-7: #d4d4d4;\n --term-color-8: #808080;\n --term-color-9: #f44747;\n --term-color-10: #6a9955;\n --term-color-11: #d7ba7d;\n --term-color-12: #569cd6;\n --term-color-13: #c586c0;\n --term-color-14: #4ec9b0;\n --term-color-15: #ffffff;\n\n --term-font-family:\n "Menlo", "Consolas", "DejaVu Sans Mono", "Courier New", monospace;\n --term-font-size: 14px;\n --term-line-height: 1.2;\n --term-row-height: 17px;\n\n position: relative;\n background: var(--term-app-bg, var(--term-bg));\n color: var(--term-app-fg, var(--term-fg));\n font-family: var(--term-font-family);\n font-size: var(--term-font-size);\n font-kerning: none;\n font-variant-ligatures: none;\n line-height: var(--term-line-height);\n padding: 12px;\n border-radius: 8px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);\n outline: none;\n overflow: hidden;\n overflow-anchor: none;\n}\n\n.wterm:focus,\n.wterm:focus-visible {\n outline: none;\n}\n\n.term-grid {\n display: block;\n position: relative;\n white-space: pre;\n contain: layout paint style;\n will-change: contents;\n}\n\n.term-cell-canvas {\n position: absolute;\n left: 0;\n pointer-events: none;\n image-rendering: pixelated;\n z-index: -1;\n}\n\n.term-announcements {\n position: absolute;\n left: 0;\n top: 0;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: pre;\n pointer-events: none;\n user-select: none;\n}\n\n.term-images {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 1;\n}\n\n.term-search-layer {\n position: absolute;\n inset: 0;\n pointer-events: none;\n user-select: none;\n z-index: 2;\n}\n\n.term-search-match {\n position: absolute;\n background: var(--term-search-match, rgb(255 200 0 / 25%));\n}\n\n.term-search-active {\n background: var(--term-search-active, rgb(255 150 0 / 40%));\n box-shadow: inset 0 0 0 1px var(--term-search-border, #ffb000);\n}\n\n.term-image-flow-spacer {\n display: block;\n height: 0;\n pointer-events: none;\n}\n\n.term-image {\n position: absolute;\n display: block;\n pointer-events: none;\n user-select: none;\n}\n\n.term-row {\n display: block;\n height: var(--term-row-height);\n line-height: var(--term-row-height);\n contain: layout style;\n}\n\n.term-select-all .term-row,\n.term-rectangle-row {\n position: relative;\n}\n\n.term-select-all .term-row::after,\n.term-rectangle-row::after {\n content: "";\n position: absolute;\n inset: 0;\n background: var(--term-selection-bg, rgb(80 140 255 / 30%));\n pointer-events: none;\n user-select: none;\n z-index: 3;\n}\n\n.term-rectangle-row::after {\n left: var(--term-selection-left);\n width: var(--term-selection-width);\n right: auto;\n}\n\n.term-selection-status {\n position: sticky;\n bottom: 0;\n width: fit-content;\n max-width: 100%;\n white-space: normal;\n background: var(--term-app-bg, var(--term-bg));\n color: var(--term-app-fg, var(--term-fg));\n user-select: none;\n pointer-events: none;\n z-index: 4;\n}\n\n.term-selection-status:empty {\n display: none;\n}\n\n.term-scrollback-spacer {\n display: block;\n pointer-events: none;\n}\n\n.term-keyboard-spacer {\n flex: none;\n pointer-events: none;\n}\n\n.term-size-probe {\n position: absolute;\n top: 0;\n left: 0;\n visibility: hidden;\n pointer-events: none;\n white-space: pre;\n width: auto;\n height: var(--term-row-height);\n}\n\n.term-row > span,\n.term-row > .term-link,\n.term-link > span {\n display: inline-block;\n height: var(--term-row-height);\n vertical-align: top;\n}\n\n.term-row > span,\n.term-link > span {\n width: calc(var(--term-span-cols, 1) * var(--term-cell-width, 1ch));\n /* Glyph ink may overhang its advance without moving the following cell. */\n overflow: visible;\n}\n\n.term-link {\n color: inherit;\n cursor: text;\n}\n\n.wterm.link-modifier-active .term-link:hover,\n.term-link:focus-visible {\n cursor: pointer;\n}\n\n.wterm.link-modifier-active .term-link:hover > span,\n.term-link:focus-visible > span {\n text-decoration: underline;\n text-underline-offset: 0.15em;\n}\n\n.term-block {\n width: var(--term-cell-width, 1ch);\n overflow: hidden;\n -webkit-text-fill-color: transparent;\n}\n\n.term-canvas-run {\n width: calc(var(--term-span-cols, 1) * var(--term-cell-width, 1ch));\n letter-spacing: var(--term-block-spacing, 0px);\n -webkit-text-fill-color: transparent;\n}\n\n.term-box {\n --term-box-stroke: max(\n 1px,\n round(calc(var(--term-cell-width, 1ch) * 0.18), 1px)\n );\n -webkit-text-fill-color: transparent;\n}\n\n.term-box-heavy,\n.term-box-bold {\n --term-box-stroke: max(\n 2px,\n round(calc(var(--term-cell-width, 1ch) * 0.3), 1px)\n );\n}\n\n.term-box-round {\n position: relative;\n}\n\n.term-box-round::after {\n content: "";\n position: absolute;\n box-sizing: border-box;\n border: 0 solid currentColor;\n pointer-events: none;\n}\n\n.term-box-round-tl::after {\n inset: calc(50% - var(--term-box-stroke) * 0.5) 0 0\n calc(50% - var(--term-box-stroke) * 0.5);\n border-top-width: var(--term-box-stroke);\n border-left-width: var(--term-box-stroke);\n border-top-left-radius: 100%;\n}\n\n.term-box-round-tr::after {\n inset: calc(50% - var(--term-box-stroke) * 0.5)\n calc(50% - var(--term-box-stroke) * 0.5) 0 0;\n border-top-width: var(--term-box-stroke);\n border-right-width: var(--term-box-stroke);\n border-top-right-radius: 100%;\n}\n\n.term-box-round-br::after {\n inset: 0 calc(50% - var(--term-box-stroke) * 0.5)\n calc(50% - var(--term-box-stroke) * 0.5) 0;\n border-bottom-width: var(--term-box-stroke);\n border-right-width: var(--term-box-stroke);\n border-bottom-right-radius: 100%;\n}\n\n.term-box-round-bl::after {\n inset: 0 0 calc(50% - var(--term-box-stroke) * 0.5)\n calc(50% - var(--term-box-stroke) * 0.5);\n border-bottom-width: var(--term-box-stroke);\n border-left-width: var(--term-box-stroke);\n border-bottom-left-radius: 100%;\n}\n\n@media (forced-colors: active), print {\n .term-cell-canvas {\n display: none;\n }\n\n .term-block,\n .term-canvas-run {\n background: none !important;\n -webkit-text-fill-color: currentColor;\n }\n\n .term-box {\n background-image: none !important;\n -webkit-text-fill-color: currentColor;\n }\n\n .term-box-round::after {\n display: none;\n }\n}\n\n@media print and (forced-colors: none) {\n .term-print-canvas .term-cell-canvas {\n display: block;\n }\n\n .term-print-canvas .term-canvas-run {\n -webkit-text-fill-color: transparent;\n }\n}\n\n.term-wide {\n --term-span-cols: 2;\n overflow: visible;\n}\n\n.term-cursor {\n color: var(--term-cell-fg, inherit);\n background: var(--term-cell-bg, transparent);\n outline: 1px solid var(--term-app-cursor, var(--term-cursor));\n outline-offset: -1px;\n}\n\n/* Native text selection can blur the input until click-to-focus runs. Keep\n the cursor active during that press without cancelling the selection. */\n.wterm:is(.focused, :active) .term-cursor {\n background: var(--term-app-cursor, var(--term-cursor));\n color: var(--term-app-bg, var(--term-bg));\n outline: none;\n}\n\n.wterm:is(.focused, :active) .term-grid[data-cursor-shape="bar"] .term-cursor,\n.wterm:is(.focused, :active) .term-grid[data-cursor-shape="underline"] .term-cursor {\n background: var(--term-cell-bg, transparent);\n color: var(--term-cell-fg, inherit);\n box-shadow: var(--term-cursor-shadow);\n --term-cursor-animation: cursor-line-blink;\n}\n\n.term-grid[data-cursor-shape="bar"] .term-cursor {\n --term-cursor-shadow: inset 2px 0 0 var(--term-app-cursor, var(--term-cursor));\n}\n\n.term-grid[data-cursor-shape="underline"] .term-cursor {\n --term-cursor-shadow: inset 0 -2px 0\n var(--term-app-cursor, var(--term-cursor));\n}\n\n.wterm:is(.focused, :active).cursor-blink .term-cursor,\n.wterm:is(.focused, :active):not(.cursor-steady)\n .term-grid[data-cursor-blink="true"]\n .term-cursor {\n animation: var(--term-cursor-animation, cursor-blink) 1s step-end infinite;\n}\n\n@keyframes cursor-blink {\n 0%,\n 100% {\n background: var(--term-app-cursor, var(--term-cursor));\n color: var(--term-app-bg, var(--term-bg));\n }\n 50% {\n background: var(--term-cell-bg, transparent);\n color: var(--term-cell-fg, inherit);\n }\n}\n\n@keyframes cursor-line-blink {\n 0%,\n 100% {\n box-shadow: var(--term-cursor-shadow);\n }\n 50% {\n box-shadow: none;\n }\n}\n\n.wterm.has-scrollback,\n.wterm.has-image-flow {\n overflow-y: auto;\n}\n\n.wterm ::selection {\n background: rgba(86, 156, 214, 0.3);\n}\n\n/* Solarized Dark */\n.wterm.theme-solarized-dark {\n --term-fg: #839496;\n --term-bg: #002b36;\n --term-cursor: #93a1a1;\n --term-color-0: #073642;\n --term-color-1: #dc322f;\n --term-color-2: #859900;\n --term-color-3: #b58900;\n --term-color-4: #268bd2;\n --term-color-5: #d33682;\n --term-color-6: #2aa198;\n --term-color-7: #eee8d5;\n --term-color-8: #586e75;\n --term-color-9: #cb4b16;\n --term-color-10: #586e75;\n --term-color-11: #657b83;\n --term-color-12: #839496;\n --term-color-13: #6c71c4;\n --term-color-14: #93a1a1;\n --term-color-15: #fdf6e3;\n}\n\n/* Monokai */\n.wterm.theme-monokai {\n --term-fg: #f8f8f2;\n --term-bg: #272822;\n --term-cursor: #f8f8f0;\n --term-color-0: #272822;\n --term-color-1: #f92672;\n --term-color-2: #a6e22e;\n --term-color-3: #f4bf75;\n --term-color-4: #66d9ef;\n --term-color-5: #ae81ff;\n --term-color-6: #a1efe4;\n --term-color-7: #f8f8f2;\n --term-color-8: #75715e;\n --term-color-9: #f92672;\n --term-color-10: #a6e22e;\n --term-color-11: #f4bf75;\n --term-color-12: #66d9ef;\n --term-color-13: #ae81ff;\n --term-color-14: #a1efe4;\n --term-color-15: #f9f8f5;\n}\n\n/* Light */\n.wterm.theme-light {\n --term-fg: #383a42;\n --term-bg: #fafafa;\n --term-cursor: #526eff;\n --term-color-0: #383a42;\n --term-color-1: #e45649;\n --term-color-2: #50a14f;\n --term-color-3: #c18401;\n --term-color-4: #4078f2;\n --term-color-5: #a626a4;\n --term-color-6: #0184bc;\n --term-color-7: #fafafa;\n --term-color-8: #a0a1a7;\n --term-color-9: #e45649;\n --term-color-10: #50a14f;\n --term-color-11: #c18401;\n --term-color-12: #4078f2;\n --term-color-13: #a626a4;\n --term-color-14: #0184bc;\n --term-color-15: #ffffff;\n}\n';
|
|
6303
6942
|
|
|
6304
6943
|
// src/slicc-terminal.css
|
|
6305
6944
|
var slicc_terminal_default = 'slicc-terminal {\n display: block;\n position: relative;\n box-sizing: border-box;\n height: var(--slicc-terminal-height, 360px);\n overflow: hidden;\n border-radius: var(--slicc-terminal-border-radius, 4px);\n background: var(--slicc-terminal-background, #1d1d1d);\n}\n\nslicc-terminal[rows] {\n height: auto;\n}\n\nslicc-terminal > .wterm {\n --term-fg: var(--slicc-terminal-foreground, #d4d4d4);\n --term-bg: var(--slicc-terminal-background, #1d1d1d);\n --term-cursor: var(--slicc-terminal-cursor, #aeafad);\n --term-color-0: var(--slicc-terminal-color-0, #1d1d1d);\n --term-color-1: var(--slicc-terminal-color-1, #f44747);\n --term-color-2: var(--slicc-terminal-color-2, #6a9955);\n --term-color-3: var(--slicc-terminal-color-3, #d7ba7d);\n --term-color-4: var(--slicc-terminal-color-4, #569cd6);\n --term-color-5: var(--slicc-terminal-color-5, #c586c0);\n --term-color-6: var(--slicc-terminal-color-6, #4ec9b0);\n --term-color-7: var(--slicc-terminal-color-7, #d4d4d4);\n --term-color-8: var(--slicc-terminal-color-8, #808080);\n --term-color-9: var(--slicc-terminal-color-9, #f44747);\n --term-color-10: var(--slicc-terminal-color-10, #6a9955);\n --term-color-11: var(--slicc-terminal-color-11, #d7ba7d);\n --term-color-12: var(--slicc-terminal-color-12, #569cd6);\n --term-color-13: var(--slicc-terminal-color-13, #c586c0);\n --term-color-14: var(--slicc-terminal-color-14, #4ec9b0);\n --term-color-15: var(--slicc-terminal-color-15, #ffffff);\n --term-font-family: var(\n --slicc-terminal-font-family,\n "Source Code Pro",\n "Menlo",\n "Consolas",\n "DejaVu Sans Mono",\n monospace\n );\n --term-font-size: var(--slicc-terminal-font-size, 14px);\n --term-line-height: var(--slicc-terminal-line-height, 1.2);\n\n box-sizing: border-box;\n height: 100%;\n padding: var(--slicc-terminal-padding, 8px);\n border-radius: 0;\n box-shadow: none;\n}\n\nslicc-terminal[rows] > .wterm {\n height: auto;\n}\n';
|
|
@@ -6574,4 +7213,4 @@ export {
|
|
|
6574
7213
|
SliccTerminal,
|
|
6575
7214
|
define
|
|
6576
7215
|
};
|
|
6577
|
-
//# sourceMappingURL=chunk-
|
|
7216
|
+
//# sourceMappingURL=chunk-G7UZNWLW.js.map
|