@opentui/core 0.1.98 → 0.1.100
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 +6 -0
- package/{index-ks829haj.js → index-86ppjrgv.js} +27 -10
- package/{index-ks829haj.js.map → index-86ppjrgv.js.map} +5 -5
- package/{index-qs64hr08.js → index-nr5q8nyn.js} +3 -3
- package/{index-e4g80551.js → index-zkcykvp8.js} +153 -75
- package/{index-e4g80551.js.map → index-zkcykvp8.js.map} +9 -9
- package/index.js +2 -2
- package/lib/objects-in-viewport.d.ts +4 -4
- package/lib/tree-sitter/default-parsers.d.ts +1 -1
- package/package.json +7 -7
- package/renderables/ScrollBox.d.ts +1 -0
- package/renderer.d.ts +8 -0
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing.js +1 -1
- package/types.d.ts +2 -0
- /package/{index-qs64hr08.js.map → index-nr5q8nyn.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
exports_src
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-86ppjrgv.js";
|
|
5
5
|
import {
|
|
6
6
|
__require
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-zkcykvp8.js";
|
|
8
8
|
|
|
9
9
|
// src/runtime-plugin.ts
|
|
10
10
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
@@ -408,4 +408,4 @@ function createRuntimePlugin(input = {}) {
|
|
|
408
408
|
export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin };
|
|
409
409
|
|
|
410
410
|
//# debugId=5D58E30F1E057B9664756E2164756E21
|
|
411
|
-
//# sourceMappingURL=index-
|
|
411
|
+
//# sourceMappingURL=index-nr5q8nyn.js.map
|
|
@@ -8468,7 +8468,19 @@ class ProcessQueue {
|
|
|
8468
8468
|
}
|
|
8469
8469
|
|
|
8470
8470
|
// src/lib/tree-sitter/default-parsers.ts
|
|
8471
|
+
import { resolve, dirname } from "path";
|
|
8471
8472
|
import { fileURLToPath } from "url";
|
|
8473
|
+
import javascript_highlights from "./assets/javascript/highlights.scm" with { type: "file" };
|
|
8474
|
+
import javascript_language from "./assets/javascript/tree-sitter-javascript.wasm" with { type: "file" };
|
|
8475
|
+
import typescript_highlights from "./assets/typescript/highlights.scm" with { type: "file" };
|
|
8476
|
+
import typescript_language from "./assets/typescript/tree-sitter-typescript.wasm" with { type: "file" };
|
|
8477
|
+
import markdown_highlights from "./assets/markdown/highlights.scm" with { type: "file" };
|
|
8478
|
+
import markdown_language from "./assets/markdown/tree-sitter-markdown.wasm" with { type: "file" };
|
|
8479
|
+
import markdown_injections from "./assets/markdown/injections.scm" with { type: "file" };
|
|
8480
|
+
import markdown_inline_highlights from "./assets/markdown_inline/highlights.scm" with { type: "file" };
|
|
8481
|
+
import markdown_inline_language from "./assets/markdown_inline/tree-sitter-markdown_inline.wasm" with { type: "file" };
|
|
8482
|
+
import zig_highlights from "./assets/zig/highlights.scm" with { type: "file" };
|
|
8483
|
+
import zig_language from "./assets/zig/tree-sitter-zig.wasm" with { type: "file" };
|
|
8472
8484
|
var _cachedParsers;
|
|
8473
8485
|
function getParsers() {
|
|
8474
8486
|
if (!_cachedParsers) {
|
|
@@ -8477,25 +8489,25 @@ function getParsers() {
|
|
|
8477
8489
|
filetype: "javascript",
|
|
8478
8490
|
aliases: ["javascriptreact"],
|
|
8479
8491
|
queries: {
|
|
8480
|
-
highlights: [fileURLToPath(
|
|
8492
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), javascript_highlights)]
|
|
8481
8493
|
},
|
|
8482
|
-
wasm: fileURLToPath(
|
|
8494
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), javascript_language)
|
|
8483
8495
|
},
|
|
8484
8496
|
{
|
|
8485
8497
|
filetype: "typescript",
|
|
8486
8498
|
aliases: ["typescriptreact"],
|
|
8487
8499
|
queries: {
|
|
8488
|
-
highlights: [fileURLToPath(
|
|
8500
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), typescript_highlights)]
|
|
8489
8501
|
},
|
|
8490
|
-
wasm: fileURLToPath(
|
|
8502
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), typescript_language)
|
|
8491
8503
|
},
|
|
8492
8504
|
{
|
|
8493
8505
|
filetype: "markdown",
|
|
8494
8506
|
queries: {
|
|
8495
|
-
highlights: [fileURLToPath(
|
|
8496
|
-
injections: [fileURLToPath(
|
|
8507
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), markdown_highlights)],
|
|
8508
|
+
injections: [resolve(dirname(fileURLToPath(import.meta.url)), markdown_injections)]
|
|
8497
8509
|
},
|
|
8498
|
-
wasm: fileURLToPath(
|
|
8510
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), markdown_language),
|
|
8499
8511
|
injectionMapping: {
|
|
8500
8512
|
nodeTypes: {
|
|
8501
8513
|
inline: "markdown_inline",
|
|
@@ -8518,16 +8530,16 @@ function getParsers() {
|
|
|
8518
8530
|
{
|
|
8519
8531
|
filetype: "markdown_inline",
|
|
8520
8532
|
queries: {
|
|
8521
|
-
highlights: [fileURLToPath(
|
|
8533
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), markdown_inline_highlights)]
|
|
8522
8534
|
},
|
|
8523
|
-
wasm: fileURLToPath(
|
|
8535
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), markdown_inline_language)
|
|
8524
8536
|
},
|
|
8525
8537
|
{
|
|
8526
8538
|
filetype: "zig",
|
|
8527
8539
|
queries: {
|
|
8528
|
-
highlights: [fileURLToPath(
|
|
8540
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), zig_highlights)]
|
|
8529
8541
|
},
|
|
8530
|
-
wasm: fileURLToPath(
|
|
8542
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), zig_language)
|
|
8531
8543
|
}
|
|
8532
8544
|
];
|
|
8533
8545
|
}
|
|
@@ -8535,7 +8547,7 @@ function getParsers() {
|
|
|
8535
8547
|
}
|
|
8536
8548
|
|
|
8537
8549
|
// src/lib/tree-sitter/client.ts
|
|
8538
|
-
import { resolve, isAbsolute, parse } from "path";
|
|
8550
|
+
import { resolve as resolve2, isAbsolute, parse } from "path";
|
|
8539
8551
|
import { existsSync } from "fs";
|
|
8540
8552
|
|
|
8541
8553
|
// src/lib/bunfs.ts
|
|
@@ -8608,7 +8620,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8608
8620
|
worker_path = this.options.workerPath;
|
|
8609
8621
|
} else {
|
|
8610
8622
|
worker_path = new URL("./parser.worker.js", import.meta.url).href;
|
|
8611
|
-
if (!existsSync(
|
|
8623
|
+
if (!existsSync(resolve2(import.meta.dirname, "parser.worker.js"))) {
|
|
8612
8624
|
worker_path = new URL("./parser.worker.ts", import.meta.url).href;
|
|
8613
8625
|
}
|
|
8614
8626
|
}
|
|
@@ -8643,7 +8655,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8643
8655
|
if (this.initializePromise) {
|
|
8644
8656
|
return this.initializePromise;
|
|
8645
8657
|
}
|
|
8646
|
-
this.initializePromise = new Promise((
|
|
8658
|
+
this.initializePromise = new Promise((resolve3, reject) => {
|
|
8647
8659
|
const timeoutMs = this.options.initTimeout ?? 1e4;
|
|
8648
8660
|
const timeoutId = setTimeout(() => {
|
|
8649
8661
|
const error = new Error("Worker initialization timed out");
|
|
@@ -8651,7 +8663,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8651
8663
|
this.initializeResolvers = undefined;
|
|
8652
8664
|
reject(error);
|
|
8653
8665
|
}, timeoutMs);
|
|
8654
|
-
this.initializeResolvers = { resolve:
|
|
8666
|
+
this.initializeResolvers = { resolve: resolve3, reject, timeoutId };
|
|
8655
8667
|
this.worker?.postMessage({
|
|
8656
8668
|
type: "INIT",
|
|
8657
8669
|
dataPath: this.options.dataPath
|
|
@@ -8674,7 +8686,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8674
8686
|
return normalizeBunfsPath(parse(path).base);
|
|
8675
8687
|
}
|
|
8676
8688
|
if (!isAbsolute(path)) {
|
|
8677
|
-
return
|
|
8689
|
+
return resolve2(path);
|
|
8678
8690
|
}
|
|
8679
8691
|
return path;
|
|
8680
8692
|
}
|
|
@@ -8692,8 +8704,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8692
8704
|
}
|
|
8693
8705
|
async getPerformance() {
|
|
8694
8706
|
const messageId = `performance_${this.messageIdCounter++}`;
|
|
8695
|
-
return new Promise((
|
|
8696
|
-
this.messageCallbacks.set(messageId,
|
|
8707
|
+
return new Promise((resolve3) => {
|
|
8708
|
+
this.messageCallbacks.set(messageId, resolve3);
|
|
8697
8709
|
this.worker?.postMessage({ type: "GET_PERFORMANCE", messageId });
|
|
8698
8710
|
});
|
|
8699
8711
|
}
|
|
@@ -8706,8 +8718,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8706
8718
|
}
|
|
8707
8719
|
}
|
|
8708
8720
|
const messageId = `oneshot_${this.messageIdCounter++}`;
|
|
8709
|
-
return new Promise((
|
|
8710
|
-
this.messageCallbacks.set(messageId,
|
|
8721
|
+
return new Promise((resolve3) => {
|
|
8722
|
+
this.messageCallbacks.set(messageId, resolve3);
|
|
8711
8723
|
this.worker?.postMessage({
|
|
8712
8724
|
type: "ONESHOT_HIGHLIGHT",
|
|
8713
8725
|
content,
|
|
@@ -8816,8 +8828,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8816
8828
|
}
|
|
8817
8829
|
async preloadParser(filetype) {
|
|
8818
8830
|
const messageId = `has_parser_${this.messageIdCounter++}`;
|
|
8819
|
-
const response = await new Promise((
|
|
8820
|
-
this.messageCallbacks.set(messageId,
|
|
8831
|
+
const response = await new Promise((resolve3) => {
|
|
8832
|
+
this.messageCallbacks.set(messageId, resolve3);
|
|
8821
8833
|
this.worker?.postMessage({
|
|
8822
8834
|
type: "PRELOAD_PARSER",
|
|
8823
8835
|
filetype,
|
|
@@ -8844,8 +8856,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8844
8856
|
}
|
|
8845
8857
|
this.buffers.set(id, { id, content, filetype, version, hasParser: false });
|
|
8846
8858
|
const messageId = `init_${this.messageIdCounter++}`;
|
|
8847
|
-
const response = await new Promise((
|
|
8848
|
-
this.messageCallbacks.set(messageId,
|
|
8859
|
+
const response = await new Promise((resolve3) => {
|
|
8860
|
+
this.messageCallbacks.set(messageId, resolve3);
|
|
8849
8861
|
this.worker?.postMessage({
|
|
8850
8862
|
type: "INITIALIZE_PARSER",
|
|
8851
8863
|
bufferId: id,
|
|
@@ -8901,9 +8913,9 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8901
8913
|
this.editQueues.delete(bufferId);
|
|
8902
8914
|
}
|
|
8903
8915
|
if (this.worker) {
|
|
8904
|
-
await new Promise((
|
|
8916
|
+
await new Promise((resolve3) => {
|
|
8905
8917
|
const messageId = `dispose_${bufferId}`;
|
|
8906
|
-
this.messageCallbacks.set(messageId,
|
|
8918
|
+
this.messageCallbacks.set(messageId, resolve3);
|
|
8907
8919
|
try {
|
|
8908
8920
|
this.worker.postMessage({
|
|
8909
8921
|
type: "DISPOSE_BUFFER",
|
|
@@ -8911,13 +8923,13 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8911
8923
|
});
|
|
8912
8924
|
} catch (error) {
|
|
8913
8925
|
console.error("Error disposing buffer", error);
|
|
8914
|
-
|
|
8926
|
+
resolve3(false);
|
|
8915
8927
|
}
|
|
8916
8928
|
setTimeout(() => {
|
|
8917
8929
|
if (this.messageCallbacks.has(messageId)) {
|
|
8918
8930
|
this.messageCallbacks.delete(messageId);
|
|
8919
8931
|
console.warn({ bufferId }, "Timed out waiting for buffer to be disposed");
|
|
8920
|
-
|
|
8932
|
+
resolve3(false);
|
|
8921
8933
|
}
|
|
8922
8934
|
}, 3000);
|
|
8923
8935
|
});
|
|
@@ -8974,12 +8986,12 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8974
8986
|
this.options.dataPath = dataPath;
|
|
8975
8987
|
if (this.initialized && this.worker) {
|
|
8976
8988
|
const messageId = `update_datapath_${this.messageIdCounter++}`;
|
|
8977
|
-
return new Promise((
|
|
8989
|
+
return new Promise((resolve3, reject) => {
|
|
8978
8990
|
this.messageCallbacks.set(messageId, (response) => {
|
|
8979
8991
|
if (response.error) {
|
|
8980
8992
|
reject(new Error(response.error));
|
|
8981
8993
|
} else {
|
|
8982
|
-
|
|
8994
|
+
resolve3();
|
|
8983
8995
|
}
|
|
8984
8996
|
});
|
|
8985
8997
|
this.worker.postMessage({
|
|
@@ -8995,12 +9007,12 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8995
9007
|
throw new Error("Cannot clear cache: client is not initialized");
|
|
8996
9008
|
}
|
|
8997
9009
|
const messageId = `clear_cache_${this.messageIdCounter++}`;
|
|
8998
|
-
return new Promise((
|
|
9010
|
+
return new Promise((resolve3, reject) => {
|
|
8999
9011
|
this.messageCallbacks.set(messageId, (response) => {
|
|
9000
9012
|
if (response.error) {
|
|
9001
9013
|
reject(new Error(response.error));
|
|
9002
9014
|
} else {
|
|
9003
|
-
|
|
9015
|
+
resolve3();
|
|
9004
9016
|
}
|
|
9005
9017
|
});
|
|
9006
9018
|
this.worker.postMessage({
|
|
@@ -9526,13 +9538,26 @@ ${content}`);
|
|
|
9526
9538
|
return "./" + path4.relative(path4.dirname(outputPath), queryPath);
|
|
9527
9539
|
}
|
|
9528
9540
|
async function generateDefaultParsersFile(parsers, outputPath) {
|
|
9541
|
+
const imports = parsers.map((parser) => {
|
|
9542
|
+
const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_");
|
|
9543
|
+
const lines = [
|
|
9544
|
+
`import ${safeFiletype}_highlights from "${parser.highlightsPath}" with { type: "file" }`,
|
|
9545
|
+
`import ${safeFiletype}_language from "${parser.languagePath}" with { type: "file" }`
|
|
9546
|
+
];
|
|
9547
|
+
if (parser.injectionsPath) {
|
|
9548
|
+
lines.push(`import ${safeFiletype}_injections from "${parser.injectionsPath}" with { type: "file" }`);
|
|
9549
|
+
}
|
|
9550
|
+
return lines.join(`
|
|
9551
|
+
`);
|
|
9552
|
+
}).join(`
|
|
9553
|
+
`);
|
|
9529
9554
|
const parserDefinitions = parsers.map((parser) => {
|
|
9530
9555
|
const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_");
|
|
9531
9556
|
const queriesLines = [
|
|
9532
|
-
` highlights: [fileURLToPath(
|
|
9557
|
+
` highlights: [resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_highlights)],`
|
|
9533
9558
|
];
|
|
9534
9559
|
if (parser.injectionsPath) {
|
|
9535
|
-
queriesLines.push(` injections: [fileURLToPath(
|
|
9560
|
+
queriesLines.push(` injections: [resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_injections)],`);
|
|
9536
9561
|
}
|
|
9537
9562
|
const injectionMappingLine = parser.injectionMapping ? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},` : "";
|
|
9538
9563
|
const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : "";
|
|
@@ -9543,7 +9568,7 @@ ${aliasesLine ? aliasesLine + `
|
|
|
9543
9568
|
${queriesLines.join(`
|
|
9544
9569
|
`)}
|
|
9545
9570
|
},
|
|
9546
|
-
wasm: fileURLToPath(
|
|
9571
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_language),${injectionMappingLine ? `
|
|
9547
9572
|
` + injectionMappingLine : ""}
|
|
9548
9573
|
}`;
|
|
9549
9574
|
}).join(`,
|
|
@@ -9553,8 +9578,11 @@ ${queriesLines.join(`
|
|
|
9553
9578
|
// Last generated: ${new Date().toISOString()}
|
|
9554
9579
|
|
|
9555
9580
|
import type { FiletypeParserOptions } from "./types"
|
|
9581
|
+
import { resolve, dirname } from "path"
|
|
9556
9582
|
import { fileURLToPath } from "url"
|
|
9557
9583
|
|
|
9584
|
+
${imports}
|
|
9585
|
+
|
|
9558
9586
|
// Cached parsers to avoid re-resolving paths on every call
|
|
9559
9587
|
let _cachedParsers: FiletypeParserOptions[] | undefined
|
|
9560
9588
|
|
|
@@ -10446,7 +10474,7 @@ class TerminalPalette {
|
|
|
10446
10474
|
const out = this.stdout;
|
|
10447
10475
|
if (!out.isTTY || !this.stdin.isTTY)
|
|
10448
10476
|
return false;
|
|
10449
|
-
return new Promise((
|
|
10477
|
+
return new Promise((resolve4) => {
|
|
10450
10478
|
const session = this.createQuerySession();
|
|
10451
10479
|
let buffer = "";
|
|
10452
10480
|
let settled = false;
|
|
@@ -10455,7 +10483,7 @@ class TerminalPalette {
|
|
|
10455
10483
|
return;
|
|
10456
10484
|
settled = true;
|
|
10457
10485
|
session.cleanup();
|
|
10458
|
-
|
|
10486
|
+
resolve4(supported);
|
|
10459
10487
|
};
|
|
10460
10488
|
const onData = (chunk) => {
|
|
10461
10489
|
buffer += chunk.toString();
|
|
@@ -10478,7 +10506,7 @@ class TerminalPalette {
|
|
|
10478
10506
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10479
10507
|
return results;
|
|
10480
10508
|
}
|
|
10481
|
-
return new Promise((
|
|
10509
|
+
return new Promise((resolve4) => {
|
|
10482
10510
|
const session = this.createQuerySession();
|
|
10483
10511
|
let buffer = "";
|
|
10484
10512
|
let idleTimer = null;
|
|
@@ -10488,7 +10516,7 @@ class TerminalPalette {
|
|
|
10488
10516
|
return;
|
|
10489
10517
|
settled = true;
|
|
10490
10518
|
session.cleanup();
|
|
10491
|
-
|
|
10519
|
+
resolve4(results);
|
|
10492
10520
|
};
|
|
10493
10521
|
const onData = (chunk) => {
|
|
10494
10522
|
buffer += chunk.toString();
|
|
@@ -10529,7 +10557,7 @@ class TerminalPalette {
|
|
|
10529
10557
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10530
10558
|
return results;
|
|
10531
10559
|
}
|
|
10532
|
-
return new Promise((
|
|
10560
|
+
return new Promise((resolve4) => {
|
|
10533
10561
|
const session = this.createQuerySession();
|
|
10534
10562
|
let buffer = "";
|
|
10535
10563
|
let idleTimer = null;
|
|
@@ -10539,7 +10567,7 @@ class TerminalPalette {
|
|
|
10539
10567
|
return;
|
|
10540
10568
|
settled = true;
|
|
10541
10569
|
session.cleanup();
|
|
10542
|
-
|
|
10570
|
+
resolve4(results);
|
|
10543
10571
|
};
|
|
10544
10572
|
const onData = (chunk) => {
|
|
10545
10573
|
buffer += chunk.toString();
|
|
@@ -14621,6 +14649,8 @@ class Renderable extends BaseRenderable {
|
|
|
14621
14649
|
_translateY = 0;
|
|
14622
14650
|
_x = 0;
|
|
14623
14651
|
_y = 0;
|
|
14652
|
+
_screenX = 0;
|
|
14653
|
+
_screenY = 0;
|
|
14624
14654
|
_width;
|
|
14625
14655
|
_height;
|
|
14626
14656
|
_widthValue = 0;
|
|
@@ -14655,6 +14685,7 @@ class Renderable extends BaseRenderable {
|
|
|
14655
14685
|
childrenPrimarySortDirty = true;
|
|
14656
14686
|
childrenSortedByPrimaryAxis = [];
|
|
14657
14687
|
_shouldUpdateBefore = new Set;
|
|
14688
|
+
_lastLayoutFrame = -1;
|
|
14658
14689
|
onLifecyclePass = null;
|
|
14659
14690
|
renderBefore;
|
|
14660
14691
|
renderAfter;
|
|
@@ -14860,6 +14891,8 @@ class Renderable extends BaseRenderable {
|
|
|
14860
14891
|
if (this._translateX === value)
|
|
14861
14892
|
return;
|
|
14862
14893
|
this._translateX = value;
|
|
14894
|
+
const parentScreenX = this.parent ? this.parent._screenX : 0;
|
|
14895
|
+
this._screenX = parentScreenX + this._x + this._translateX;
|
|
14863
14896
|
if (this.parent)
|
|
14864
14897
|
this.parent.childrenPrimarySortDirty = true;
|
|
14865
14898
|
this.requestRender();
|
|
@@ -14871,10 +14904,20 @@ class Renderable extends BaseRenderable {
|
|
|
14871
14904
|
if (this._translateY === value)
|
|
14872
14905
|
return;
|
|
14873
14906
|
this._translateY = value;
|
|
14907
|
+
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
14908
|
+
this._screenY = parentScreenY + this._y + this._translateY;
|
|
14874
14909
|
if (this.parent)
|
|
14875
14910
|
this.parent.childrenPrimarySortDirty = true;
|
|
14876
14911
|
this.requestRender();
|
|
14877
14912
|
}
|
|
14913
|
+
get screenX() {
|
|
14914
|
+
const parentScreenX = this.parent ? this.parent._screenX : 0;
|
|
14915
|
+
return parentScreenX + this._x + this._translateX;
|
|
14916
|
+
}
|
|
14917
|
+
get screenY() {
|
|
14918
|
+
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
14919
|
+
return parentScreenY + this._y + this._translateY;
|
|
14920
|
+
}
|
|
14878
14921
|
get x() {
|
|
14879
14922
|
if (this.parent) {
|
|
14880
14923
|
return this.parent.x + this._x + this._translateX;
|
|
@@ -14982,8 +15025,8 @@ class Renderable extends BaseRenderable {
|
|
|
14982
15025
|
const axis = dir === 2 || dir === 3 ? "x" : "y";
|
|
14983
15026
|
const sorted = [...this._childrenInLayoutOrder];
|
|
14984
15027
|
sorted.sort((a, b) => {
|
|
14985
|
-
const va = axis === "y" ? a.
|
|
14986
|
-
const vb = axis === "y" ? b.
|
|
15028
|
+
const va = axis === "y" ? a.screenY : a.screenX;
|
|
15029
|
+
const vb = axis === "y" ? b.screenY : b.screenX;
|
|
14987
15030
|
return va - vb;
|
|
14988
15031
|
});
|
|
14989
15032
|
this.childrenSortedByPrimaryAxis = sorted;
|
|
@@ -15305,6 +15348,10 @@ class Renderable extends BaseRenderable {
|
|
|
15305
15348
|
return this.yogaNode;
|
|
15306
15349
|
}
|
|
15307
15350
|
updateFromLayout() {
|
|
15351
|
+
const frameId = this._ctx.frameId;
|
|
15352
|
+
if (this._lastLayoutFrame === frameId)
|
|
15353
|
+
return;
|
|
15354
|
+
this._lastLayoutFrame = frameId;
|
|
15308
15355
|
const layout = this.yogaNode.getComputedLayout();
|
|
15309
15356
|
const oldX = this._x;
|
|
15310
15357
|
const oldY = this._y;
|
|
@@ -15312,6 +15359,10 @@ class Renderable extends BaseRenderable {
|
|
|
15312
15359
|
const oldHeight = this._heightValue;
|
|
15313
15360
|
this._x = layout.left;
|
|
15314
15361
|
this._y = layout.top;
|
|
15362
|
+
const parentScreenX = this.parent ? this.parent._screenX : 0;
|
|
15363
|
+
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
15364
|
+
this._screenX = parentScreenX + this._x + this._translateX;
|
|
15365
|
+
this._screenY = parentScreenY + this._y + this._translateY;
|
|
15315
15366
|
const newWidth = Math.max(layout.width, 1);
|
|
15316
15367
|
const newHeight = Math.max(layout.height, 1);
|
|
15317
15368
|
const sizeChanged = oldWidth !== newWidth || oldHeight !== newHeight;
|
|
@@ -15547,17 +15598,27 @@ class Renderable extends BaseRenderable {
|
|
|
15547
15598
|
y: scissorRect.y,
|
|
15548
15599
|
width: scissorRect.width,
|
|
15549
15600
|
height: scissorRect.height,
|
|
15550
|
-
screenX: this.
|
|
15551
|
-
screenY: this.
|
|
15601
|
+
screenX: this._screenX,
|
|
15602
|
+
screenY: this._screenY
|
|
15552
15603
|
});
|
|
15553
15604
|
}
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15605
|
+
if (!this._hasVisibleChildFilter()) {
|
|
15606
|
+
for (const child of this._childrenInZIndexOrder) {
|
|
15607
|
+
child.updateLayout(deltaTime, renderList);
|
|
15608
|
+
}
|
|
15609
|
+
} else {
|
|
15610
|
+
for (const child of this._childrenInZIndexOrder) {
|
|
15611
|
+
if (child.isDestroyed)
|
|
15612
|
+
continue;
|
|
15557
15613
|
child.updateFromLayout();
|
|
15558
|
-
continue;
|
|
15559
15614
|
}
|
|
15560
|
-
|
|
15615
|
+
const visibleChildren = this._getVisibleChildren();
|
|
15616
|
+
const visibleChildSet = new Set(visibleChildren);
|
|
15617
|
+
for (const child of this._childrenInZIndexOrder) {
|
|
15618
|
+
if (!visibleChildSet.has(child.num))
|
|
15619
|
+
continue;
|
|
15620
|
+
child.updateLayout(deltaTime, renderList);
|
|
15621
|
+
}
|
|
15561
15622
|
}
|
|
15562
15623
|
if (shouldPushScissor) {
|
|
15563
15624
|
renderList.push({ action: "popScissorRect" });
|
|
@@ -15578,20 +15639,25 @@ class Renderable extends BaseRenderable {
|
|
|
15578
15639
|
if (this.renderAfter) {
|
|
15579
15640
|
this.renderAfter.call(this, renderBuffer, deltaTime);
|
|
15580
15641
|
}
|
|
15642
|
+
const screenX = this._screenX;
|
|
15643
|
+
const screenY = this._screenY;
|
|
15581
15644
|
this.markClean();
|
|
15582
|
-
this._ctx.addToHitGrid(
|
|
15645
|
+
this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
|
|
15583
15646
|
if (this.buffered && this.frameBuffer) {
|
|
15584
|
-
buffer.drawFrameBuffer(
|
|
15647
|
+
buffer.drawFrameBuffer(screenX, screenY, this.frameBuffer);
|
|
15585
15648
|
}
|
|
15586
15649
|
}
|
|
15650
|
+
_hasVisibleChildFilter() {
|
|
15651
|
+
return this._getVisibleChildren !== Renderable.prototype._getVisibleChildren;
|
|
15652
|
+
}
|
|
15587
15653
|
_getVisibleChildren() {
|
|
15588
15654
|
return this._childrenInZIndexOrder.map((child) => child.num);
|
|
15589
15655
|
}
|
|
15590
15656
|
onUpdate(deltaTime) {}
|
|
15591
15657
|
getScissorRect() {
|
|
15592
15658
|
return {
|
|
15593
|
-
x: this.buffered ? 0 : this.
|
|
15594
|
-
y: this.buffered ? 0 : this.
|
|
15659
|
+
x: this.buffered ? 0 : this._screenX,
|
|
15660
|
+
y: this.buffered ? 0 : this._screenY,
|
|
15595
15661
|
width: this.width,
|
|
15596
15662
|
height: this.height
|
|
15597
15663
|
};
|
|
@@ -18380,20 +18446,24 @@ class EditBufferRenderable extends Renderable {
|
|
|
18380
18446
|
return;
|
|
18381
18447
|
if (this.isDestroyed)
|
|
18382
18448
|
return;
|
|
18449
|
+
const screenX = this._screenX;
|
|
18450
|
+
const screenY = this._screenY;
|
|
18383
18451
|
this.markClean();
|
|
18384
|
-
this._ctx.addToHitGrid(
|
|
18452
|
+
this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
|
|
18385
18453
|
this.renderSelf(buffer);
|
|
18386
18454
|
this.renderCursor(buffer);
|
|
18387
18455
|
}
|
|
18388
18456
|
renderSelf(buffer) {
|
|
18389
|
-
buffer.drawEditorView(this.editorView, this.
|
|
18457
|
+
buffer.drawEditorView(this.editorView, this._screenX, this._screenY);
|
|
18390
18458
|
}
|
|
18391
18459
|
renderCursor(buffer) {
|
|
18392
18460
|
if (!this._showCursor || !this._focused)
|
|
18393
18461
|
return;
|
|
18394
18462
|
const visualCursor = this.editorView.getVisualCursor();
|
|
18395
|
-
const
|
|
18396
|
-
const
|
|
18463
|
+
const screenX = this._screenX;
|
|
18464
|
+
const screenY = this._screenY;
|
|
18465
|
+
const cursorX = screenX + visualCursor.visualCol + 1;
|
|
18466
|
+
const cursorY = screenY + visualCursor.visualRow + 1;
|
|
18397
18467
|
this._ctx.setCursorPosition(cursorX, cursorY, true);
|
|
18398
18468
|
this._ctx.setCursorStyle({ ...this._cursorStyle, color: this._cursorColor });
|
|
18399
18469
|
}
|
|
@@ -18593,8 +18663,8 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
|
|
|
18593
18663
|
while (lo <= hi) {
|
|
18594
18664
|
const mid = lo + hi >> 1;
|
|
18595
18665
|
const c = children[mid];
|
|
18596
|
-
const start = isRow ? c.
|
|
18597
|
-
const end = isRow ? c.
|
|
18666
|
+
const start = isRow ? c.screenX : c.screenY;
|
|
18667
|
+
const end = isRow ? c.screenX + c.width : c.screenY + c.height;
|
|
18598
18668
|
if (end < vpStart) {
|
|
18599
18669
|
lo = mid + 1;
|
|
18600
18670
|
} else if (start > vpEnd) {
|
|
@@ -18613,7 +18683,7 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
|
|
|
18613
18683
|
let gapCount = 0;
|
|
18614
18684
|
while (left - 1 >= 0) {
|
|
18615
18685
|
const prev = children[left - 1];
|
|
18616
|
-
const prevEnd = isRow ? prev.
|
|
18686
|
+
const prevEnd = isRow ? prev.screenX + prev.width : prev.screenY + prev.height;
|
|
18617
18687
|
if (prevEnd <= vpStart) {
|
|
18618
18688
|
gapCount++;
|
|
18619
18689
|
if (gapCount >= maxLookBehind) {
|
|
@@ -18627,30 +18697,30 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
|
|
|
18627
18697
|
let right = candidate + 1;
|
|
18628
18698
|
while (right < totalChildren) {
|
|
18629
18699
|
const next = children[right];
|
|
18630
|
-
if ((isRow ? next.
|
|
18700
|
+
if ((isRow ? next.screenX : next.screenY) >= vpEnd)
|
|
18631
18701
|
break;
|
|
18632
18702
|
right++;
|
|
18633
18703
|
}
|
|
18634
18704
|
for (let i = left;i < right; i++) {
|
|
18635
18705
|
const child = children[i];
|
|
18636
|
-
const start = isRow ? child.
|
|
18637
|
-
const end = isRow ? child.
|
|
18706
|
+
const start = isRow ? child.screenX : child.screenY;
|
|
18707
|
+
const end = isRow ? child.screenX + child.width : child.screenY + child.height;
|
|
18638
18708
|
if (end <= vpStart)
|
|
18639
18709
|
continue;
|
|
18640
18710
|
if (start >= vpEnd)
|
|
18641
18711
|
break;
|
|
18642
18712
|
if (isRow) {
|
|
18643
|
-
const childBottom = child.
|
|
18713
|
+
const childBottom = child.screenY + child.height;
|
|
18644
18714
|
if (childBottom < viewportTop)
|
|
18645
18715
|
continue;
|
|
18646
|
-
const childTop = child.
|
|
18716
|
+
const childTop = child.screenY;
|
|
18647
18717
|
if (childTop > viewportBottom)
|
|
18648
18718
|
continue;
|
|
18649
18719
|
} else {
|
|
18650
|
-
const childRight = child.
|
|
18720
|
+
const childRight = child.screenX + child.width;
|
|
18651
18721
|
if (childRight < viewportLeft)
|
|
18652
18722
|
continue;
|
|
18653
|
-
const childLeft = child.
|
|
18723
|
+
const childLeft = child.screenX;
|
|
18654
18724
|
if (childLeft > viewportRight)
|
|
18655
18725
|
continue;
|
|
18656
18726
|
}
|
|
@@ -18881,7 +18951,7 @@ var rendererTracker = singleton("RendererTracker", () => {
|
|
|
18881
18951
|
});
|
|
18882
18952
|
async function createCliRenderer(config = {}) {
|
|
18883
18953
|
if (process.argv.includes("--delay-start")) {
|
|
18884
|
-
await new Promise((
|
|
18954
|
+
await new Promise((resolve4) => setTimeout(resolve4, 5000));
|
|
18885
18955
|
}
|
|
18886
18956
|
const stdin = config.stdin || process.stdin;
|
|
18887
18957
|
const stdout = config.stdout || process.stdout;
|
|
@@ -18978,6 +19048,7 @@ class CliRenderer extends EventEmitter9 {
|
|
|
18978
19048
|
renderTimeout = null;
|
|
18979
19049
|
lastTime = 0;
|
|
18980
19050
|
frameCount = 0;
|
|
19051
|
+
_frameId = 0;
|
|
18981
19052
|
lastFpsTime = 0;
|
|
18982
19053
|
currentFps = 0;
|
|
18983
19054
|
targetFrameTime = 1000 / this._targetFps;
|
|
@@ -19312,6 +19383,9 @@ Captured output:
|
|
|
19312
19383
|
const caps = this.capabilities;
|
|
19313
19384
|
return caps?.unicode === "wcwidth" ? "wcwidth" : "unicode";
|
|
19314
19385
|
}
|
|
19386
|
+
get frameId() {
|
|
19387
|
+
return this._frameId;
|
|
19388
|
+
}
|
|
19315
19389
|
writeOut(chunk, encoding, callback) {
|
|
19316
19390
|
if (this.rendererPtr && this._useThread) {
|
|
19317
19391
|
const data = typeof chunk === "string" ? chunk : chunk?.toString() ?? "";
|
|
@@ -19379,8 +19453,8 @@ Captured output:
|
|
|
19379
19453
|
if (!this.isIdleNow())
|
|
19380
19454
|
return;
|
|
19381
19455
|
const resolvers = this.idleResolvers.splice(0);
|
|
19382
|
-
for (const
|
|
19383
|
-
|
|
19456
|
+
for (const resolve4 of resolvers) {
|
|
19457
|
+
resolve4();
|
|
19384
19458
|
}
|
|
19385
19459
|
}
|
|
19386
19460
|
idle() {
|
|
@@ -19388,8 +19462,8 @@ Captured output:
|
|
|
19388
19462
|
return Promise.resolve();
|
|
19389
19463
|
if (this.isIdleNow())
|
|
19390
19464
|
return Promise.resolve();
|
|
19391
|
-
return new Promise((
|
|
19392
|
-
this.idleResolvers.push(
|
|
19465
|
+
return new Promise((resolve4) => {
|
|
19466
|
+
this.idleResolvers.push(resolve4);
|
|
19393
19467
|
});
|
|
19394
19468
|
}
|
|
19395
19469
|
get resolution() {
|
|
@@ -20111,6 +20185,9 @@ Captured output:
|
|
|
20111
20185
|
setTerminalTitle(title) {
|
|
20112
20186
|
this.lib.setTerminalTitle(this.rendererPtr, title);
|
|
20113
20187
|
}
|
|
20188
|
+
resetTerminalBgColor() {
|
|
20189
|
+
process.stdout.write("\x1B]111\x07");
|
|
20190
|
+
}
|
|
20114
20191
|
copyToClipboardOSC52(text, target) {
|
|
20115
20192
|
return this.clipboard.copyToClipboardOSC52(text, target);
|
|
20116
20193
|
}
|
|
@@ -20395,6 +20472,7 @@ Captured output:
|
|
|
20395
20472
|
this.renderTimeout = null;
|
|
20396
20473
|
}
|
|
20397
20474
|
try {
|
|
20475
|
+
this._frameId++;
|
|
20398
20476
|
const now = this.normalizeClockTime(this.clock.now(), this.lastTime);
|
|
20399
20477
|
const elapsed = this.getElapsedMs(now, this.lastTime);
|
|
20400
20478
|
const deltaTime = elapsed;
|
|
@@ -20661,5 +20739,5 @@ Captured output:
|
|
|
20661
20739
|
|
|
20662
20740
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, EditBuffer, EditorView, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
20663
20741
|
|
|
20664
|
-
//# debugId=
|
|
20665
|
-
//# sourceMappingURL=index-
|
|
20742
|
+
//# debugId=1B3B44D6B234F20A64756E2164756E21
|
|
20743
|
+
//# sourceMappingURL=index-zkcykvp8.js.map
|