@opentui/core 0.1.98 → 0.1.99
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 +5 -0
- package/{index-e4g80551.js → index-8978gvk3.js} +138 -76
- package/{index-e4g80551.js.map → index-8978gvk3.js.map} +7 -7
- package/{index-ks829haj.js → index-fedv7szb.js} +27 -10
- package/{index-ks829haj.js.map → index-fedv7szb.js.map} +5 -5
- package/{index-qs64hr08.js → index-gb4b75s8.js} +3 -3
- 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/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing.js +1 -1
- /package/{index-qs64hr08.js.map → index-gb4b75s8.js.map} +0 -0
package/3d.js
CHANGED
package/Renderable.d.ts
CHANGED
|
@@ -122,6 +122,8 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
122
122
|
protected _translateY: number;
|
|
123
123
|
protected _x: number;
|
|
124
124
|
protected _y: number;
|
|
125
|
+
protected _screenX: number;
|
|
126
|
+
protected _screenY: number;
|
|
125
127
|
protected _width: number | "auto" | `${number}%`;
|
|
126
128
|
protected _height: number | "auto" | `${number}%`;
|
|
127
129
|
protected _widthValue: number;
|
|
@@ -191,6 +193,8 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
191
193
|
set translateX(value: number);
|
|
192
194
|
get translateY(): number;
|
|
193
195
|
set translateY(value: number);
|
|
196
|
+
get screenX(): number;
|
|
197
|
+
get screenY(): number;
|
|
194
198
|
get x(): number;
|
|
195
199
|
set x(value: number);
|
|
196
200
|
get top(): number | "auto" | `${number}%` | undefined;
|
|
@@ -266,6 +270,7 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
266
270
|
getChildrenCount(): number;
|
|
267
271
|
updateLayout(deltaTime: number, renderList?: RenderCommand[]): void;
|
|
268
272
|
render(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
273
|
+
protected _hasVisibleChildFilter(): boolean;
|
|
269
274
|
protected _getVisibleChildren(): number[];
|
|
270
275
|
protected onUpdate(deltaTime: number): void;
|
|
271
276
|
protected getScissorRect(): {
|
|
@@ -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;
|
|
@@ -14860,6 +14890,8 @@ class Renderable extends BaseRenderable {
|
|
|
14860
14890
|
if (this._translateX === value)
|
|
14861
14891
|
return;
|
|
14862
14892
|
this._translateX = value;
|
|
14893
|
+
const parentScreenX = this.parent ? this.parent._screenX : 0;
|
|
14894
|
+
this._screenX = parentScreenX + this._x + this._translateX;
|
|
14863
14895
|
if (this.parent)
|
|
14864
14896
|
this.parent.childrenPrimarySortDirty = true;
|
|
14865
14897
|
this.requestRender();
|
|
@@ -14871,10 +14903,20 @@ class Renderable extends BaseRenderable {
|
|
|
14871
14903
|
if (this._translateY === value)
|
|
14872
14904
|
return;
|
|
14873
14905
|
this._translateY = value;
|
|
14906
|
+
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
14907
|
+
this._screenY = parentScreenY + this._y + this._translateY;
|
|
14874
14908
|
if (this.parent)
|
|
14875
14909
|
this.parent.childrenPrimarySortDirty = true;
|
|
14876
14910
|
this.requestRender();
|
|
14877
14911
|
}
|
|
14912
|
+
get screenX() {
|
|
14913
|
+
const parentScreenX = this.parent ? this.parent._screenX : 0;
|
|
14914
|
+
return parentScreenX + this._x + this._translateX;
|
|
14915
|
+
}
|
|
14916
|
+
get screenY() {
|
|
14917
|
+
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
14918
|
+
return parentScreenY + this._y + this._translateY;
|
|
14919
|
+
}
|
|
14878
14920
|
get x() {
|
|
14879
14921
|
if (this.parent) {
|
|
14880
14922
|
return this.parent.x + this._x + this._translateX;
|
|
@@ -14982,8 +15024,8 @@ class Renderable extends BaseRenderable {
|
|
|
14982
15024
|
const axis = dir === 2 || dir === 3 ? "x" : "y";
|
|
14983
15025
|
const sorted = [...this._childrenInLayoutOrder];
|
|
14984
15026
|
sorted.sort((a, b) => {
|
|
14985
|
-
const va = axis === "y" ? a.
|
|
14986
|
-
const vb = axis === "y" ? b.
|
|
15027
|
+
const va = axis === "y" ? a.screenY : a.screenX;
|
|
15028
|
+
const vb = axis === "y" ? b.screenY : b.screenX;
|
|
14987
15029
|
return va - vb;
|
|
14988
15030
|
});
|
|
14989
15031
|
this.childrenSortedByPrimaryAxis = sorted;
|
|
@@ -15312,6 +15354,10 @@ class Renderable extends BaseRenderable {
|
|
|
15312
15354
|
const oldHeight = this._heightValue;
|
|
15313
15355
|
this._x = layout.left;
|
|
15314
15356
|
this._y = layout.top;
|
|
15357
|
+
const parentScreenX = this.parent ? this.parent._screenX : 0;
|
|
15358
|
+
const parentScreenY = this.parent ? this.parent._screenY : 0;
|
|
15359
|
+
this._screenX = parentScreenX + this._x + this._translateX;
|
|
15360
|
+
this._screenY = parentScreenY + this._y + this._translateY;
|
|
15315
15361
|
const newWidth = Math.max(layout.width, 1);
|
|
15316
15362
|
const newHeight = Math.max(layout.height, 1);
|
|
15317
15363
|
const sizeChanged = oldWidth !== newWidth || oldHeight !== newHeight;
|
|
@@ -15547,17 +15593,24 @@ class Renderable extends BaseRenderable {
|
|
|
15547
15593
|
y: scissorRect.y,
|
|
15548
15594
|
width: scissorRect.width,
|
|
15549
15595
|
height: scissorRect.height,
|
|
15550
|
-
screenX: this.
|
|
15551
|
-
screenY: this.
|
|
15596
|
+
screenX: this._screenX,
|
|
15597
|
+
screenY: this._screenY
|
|
15552
15598
|
});
|
|
15553
15599
|
}
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15600
|
+
if (!this._hasVisibleChildFilter()) {
|
|
15601
|
+
for (const child of this._childrenInZIndexOrder) {
|
|
15602
|
+
child.updateLayout(deltaTime, renderList);
|
|
15603
|
+
}
|
|
15604
|
+
} else {
|
|
15605
|
+
const visibleChildren = this._getVisibleChildren();
|
|
15606
|
+
const visibleChildSet = new Set(visibleChildren);
|
|
15607
|
+
for (const child of this._childrenInZIndexOrder) {
|
|
15608
|
+
if (!visibleChildSet.has(child.num)) {
|
|
15609
|
+
child.updateFromLayout();
|
|
15610
|
+
continue;
|
|
15611
|
+
}
|
|
15612
|
+
child.updateLayout(deltaTime, renderList);
|
|
15559
15613
|
}
|
|
15560
|
-
child.updateLayout(deltaTime, renderList);
|
|
15561
15614
|
}
|
|
15562
15615
|
if (shouldPushScissor) {
|
|
15563
15616
|
renderList.push({ action: "popScissorRect" });
|
|
@@ -15578,20 +15631,25 @@ class Renderable extends BaseRenderable {
|
|
|
15578
15631
|
if (this.renderAfter) {
|
|
15579
15632
|
this.renderAfter.call(this, renderBuffer, deltaTime);
|
|
15580
15633
|
}
|
|
15634
|
+
const screenX = this._screenX;
|
|
15635
|
+
const screenY = this._screenY;
|
|
15581
15636
|
this.markClean();
|
|
15582
|
-
this._ctx.addToHitGrid(
|
|
15637
|
+
this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
|
|
15583
15638
|
if (this.buffered && this.frameBuffer) {
|
|
15584
|
-
buffer.drawFrameBuffer(
|
|
15639
|
+
buffer.drawFrameBuffer(screenX, screenY, this.frameBuffer);
|
|
15585
15640
|
}
|
|
15586
15641
|
}
|
|
15642
|
+
_hasVisibleChildFilter() {
|
|
15643
|
+
return this._getVisibleChildren !== Renderable.prototype._getVisibleChildren;
|
|
15644
|
+
}
|
|
15587
15645
|
_getVisibleChildren() {
|
|
15588
15646
|
return this._childrenInZIndexOrder.map((child) => child.num);
|
|
15589
15647
|
}
|
|
15590
15648
|
onUpdate(deltaTime) {}
|
|
15591
15649
|
getScissorRect() {
|
|
15592
15650
|
return {
|
|
15593
|
-
x: this.buffered ? 0 : this.
|
|
15594
|
-
y: this.buffered ? 0 : this.
|
|
15651
|
+
x: this.buffered ? 0 : this._screenX,
|
|
15652
|
+
y: this.buffered ? 0 : this._screenY,
|
|
15595
15653
|
width: this.width,
|
|
15596
15654
|
height: this.height
|
|
15597
15655
|
};
|
|
@@ -18380,20 +18438,24 @@ class EditBufferRenderable extends Renderable {
|
|
|
18380
18438
|
return;
|
|
18381
18439
|
if (this.isDestroyed)
|
|
18382
18440
|
return;
|
|
18441
|
+
const screenX = this._screenX;
|
|
18442
|
+
const screenY = this._screenY;
|
|
18383
18443
|
this.markClean();
|
|
18384
|
-
this._ctx.addToHitGrid(
|
|
18444
|
+
this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
|
|
18385
18445
|
this.renderSelf(buffer);
|
|
18386
18446
|
this.renderCursor(buffer);
|
|
18387
18447
|
}
|
|
18388
18448
|
renderSelf(buffer) {
|
|
18389
|
-
buffer.drawEditorView(this.editorView, this.
|
|
18449
|
+
buffer.drawEditorView(this.editorView, this._screenX, this._screenY);
|
|
18390
18450
|
}
|
|
18391
18451
|
renderCursor(buffer) {
|
|
18392
18452
|
if (!this._showCursor || !this._focused)
|
|
18393
18453
|
return;
|
|
18394
18454
|
const visualCursor = this.editorView.getVisualCursor();
|
|
18395
|
-
const
|
|
18396
|
-
const
|
|
18455
|
+
const screenX = this._screenX;
|
|
18456
|
+
const screenY = this._screenY;
|
|
18457
|
+
const cursorX = screenX + visualCursor.visualCol + 1;
|
|
18458
|
+
const cursorY = screenY + visualCursor.visualRow + 1;
|
|
18397
18459
|
this._ctx.setCursorPosition(cursorX, cursorY, true);
|
|
18398
18460
|
this._ctx.setCursorStyle({ ...this._cursorStyle, color: this._cursorColor });
|
|
18399
18461
|
}
|
|
@@ -18593,8 +18655,8 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
|
|
|
18593
18655
|
while (lo <= hi) {
|
|
18594
18656
|
const mid = lo + hi >> 1;
|
|
18595
18657
|
const c = children[mid];
|
|
18596
|
-
const start = isRow ? c.
|
|
18597
|
-
const end = isRow ? c.
|
|
18658
|
+
const start = isRow ? c.screenX : c.screenY;
|
|
18659
|
+
const end = isRow ? c.screenX + c.width : c.screenY + c.height;
|
|
18598
18660
|
if (end < vpStart) {
|
|
18599
18661
|
lo = mid + 1;
|
|
18600
18662
|
} else if (start > vpEnd) {
|
|
@@ -18613,7 +18675,7 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
|
|
|
18613
18675
|
let gapCount = 0;
|
|
18614
18676
|
while (left - 1 >= 0) {
|
|
18615
18677
|
const prev = children[left - 1];
|
|
18616
|
-
const prevEnd = isRow ? prev.
|
|
18678
|
+
const prevEnd = isRow ? prev.screenX + prev.width : prev.screenY + prev.height;
|
|
18617
18679
|
if (prevEnd <= vpStart) {
|
|
18618
18680
|
gapCount++;
|
|
18619
18681
|
if (gapCount >= maxLookBehind) {
|
|
@@ -18627,30 +18689,30 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
|
|
|
18627
18689
|
let right = candidate + 1;
|
|
18628
18690
|
while (right < totalChildren) {
|
|
18629
18691
|
const next = children[right];
|
|
18630
|
-
if ((isRow ? next.
|
|
18692
|
+
if ((isRow ? next.screenX : next.screenY) >= vpEnd)
|
|
18631
18693
|
break;
|
|
18632
18694
|
right++;
|
|
18633
18695
|
}
|
|
18634
18696
|
for (let i = left;i < right; i++) {
|
|
18635
18697
|
const child = children[i];
|
|
18636
|
-
const start = isRow ? child.
|
|
18637
|
-
const end = isRow ? child.
|
|
18698
|
+
const start = isRow ? child.screenX : child.screenY;
|
|
18699
|
+
const end = isRow ? child.screenX + child.width : child.screenY + child.height;
|
|
18638
18700
|
if (end <= vpStart)
|
|
18639
18701
|
continue;
|
|
18640
18702
|
if (start >= vpEnd)
|
|
18641
18703
|
break;
|
|
18642
18704
|
if (isRow) {
|
|
18643
|
-
const childBottom = child.
|
|
18705
|
+
const childBottom = child.screenY + child.height;
|
|
18644
18706
|
if (childBottom < viewportTop)
|
|
18645
18707
|
continue;
|
|
18646
|
-
const childTop = child.
|
|
18708
|
+
const childTop = child.screenY;
|
|
18647
18709
|
if (childTop > viewportBottom)
|
|
18648
18710
|
continue;
|
|
18649
18711
|
} else {
|
|
18650
|
-
const childRight = child.
|
|
18712
|
+
const childRight = child.screenX + child.width;
|
|
18651
18713
|
if (childRight < viewportLeft)
|
|
18652
18714
|
continue;
|
|
18653
|
-
const childLeft = child.
|
|
18715
|
+
const childLeft = child.screenX;
|
|
18654
18716
|
if (childLeft > viewportRight)
|
|
18655
18717
|
continue;
|
|
18656
18718
|
}
|
|
@@ -18881,7 +18943,7 @@ var rendererTracker = singleton("RendererTracker", () => {
|
|
|
18881
18943
|
});
|
|
18882
18944
|
async function createCliRenderer(config = {}) {
|
|
18883
18945
|
if (process.argv.includes("--delay-start")) {
|
|
18884
|
-
await new Promise((
|
|
18946
|
+
await new Promise((resolve4) => setTimeout(resolve4, 5000));
|
|
18885
18947
|
}
|
|
18886
18948
|
const stdin = config.stdin || process.stdin;
|
|
18887
18949
|
const stdout = config.stdout || process.stdout;
|
|
@@ -19379,8 +19441,8 @@ Captured output:
|
|
|
19379
19441
|
if (!this.isIdleNow())
|
|
19380
19442
|
return;
|
|
19381
19443
|
const resolvers = this.idleResolvers.splice(0);
|
|
19382
|
-
for (const
|
|
19383
|
-
|
|
19444
|
+
for (const resolve4 of resolvers) {
|
|
19445
|
+
resolve4();
|
|
19384
19446
|
}
|
|
19385
19447
|
}
|
|
19386
19448
|
idle() {
|
|
@@ -19388,8 +19450,8 @@ Captured output:
|
|
|
19388
19450
|
return Promise.resolve();
|
|
19389
19451
|
if (this.isIdleNow())
|
|
19390
19452
|
return Promise.resolve();
|
|
19391
|
-
return new Promise((
|
|
19392
|
-
this.idleResolvers.push(
|
|
19453
|
+
return new Promise((resolve4) => {
|
|
19454
|
+
this.idleResolvers.push(resolve4);
|
|
19393
19455
|
});
|
|
19394
19456
|
}
|
|
19395
19457
|
get resolution() {
|
|
@@ -20661,5 +20723,5 @@ Captured output:
|
|
|
20661
20723
|
|
|
20662
20724
|
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
20725
|
|
|
20664
|
-
//# debugId=
|
|
20665
|
-
//# sourceMappingURL=index-
|
|
20726
|
+
//# debugId=2193DA33CB3F5D3964756E2164756E21
|
|
20727
|
+
//# sourceMappingURL=index-8978gvk3.js.map
|