@opentui/core 0.0.0-20260412-2fcfd0af → 0.0.0-20260417-7aaea62b
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 +1 -0
- package/{index-z2gnvv84.js → index-7pbnsh6w.js} +117 -16
- package/{index-z2gnvv84.js.map → index-7pbnsh6w.js.map} +5 -5
- package/{index-rgnbg53q.js → index-8hvyszn8.js} +3 -3
- package/{index-1j5hqa8e.js → index-er0xwkd8.js} +2 -2
- package/{index-1j5hqa8e.js.map → index-er0xwkd8.js.map} +2 -2
- package/index.js +2 -2
- package/package.json +7 -7
- package/renderer.d.ts +14 -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-rgnbg53q.js.map → index-8hvyszn8.js.map} +0 -0
package/3d.js
CHANGED
package/Renderable.d.ts
CHANGED
|
@@ -158,6 +158,7 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
158
158
|
private childrenPrimarySortDirty;
|
|
159
159
|
private childrenSortedByPrimaryAxis;
|
|
160
160
|
private _shouldUpdateBefore;
|
|
161
|
+
private _lastLayoutFrame;
|
|
161
162
|
onLifecyclePass: (() => void) | null;
|
|
162
163
|
renderBefore?: (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
|
|
163
164
|
renderAfter?: (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
|
|
@@ -14685,6 +14685,7 @@ class Renderable extends BaseRenderable {
|
|
|
14685
14685
|
childrenPrimarySortDirty = true;
|
|
14686
14686
|
childrenSortedByPrimaryAxis = [];
|
|
14687
14687
|
_shouldUpdateBefore = new Set;
|
|
14688
|
+
_lastLayoutFrame = -1;
|
|
14688
14689
|
onLifecyclePass = null;
|
|
14689
14690
|
renderBefore;
|
|
14690
14691
|
renderAfter;
|
|
@@ -15347,6 +15348,10 @@ class Renderable extends BaseRenderable {
|
|
|
15347
15348
|
return this.yogaNode;
|
|
15348
15349
|
}
|
|
15349
15350
|
updateFromLayout() {
|
|
15351
|
+
const frameId = this._ctx.frameId;
|
|
15352
|
+
if (this._lastLayoutFrame === frameId)
|
|
15353
|
+
return;
|
|
15354
|
+
this._lastLayoutFrame = frameId;
|
|
15350
15355
|
const layout = this.yogaNode.getComputedLayout();
|
|
15351
15356
|
const oldX = this._x;
|
|
15352
15357
|
const oldY = this._y;
|
|
@@ -15602,13 +15607,16 @@ class Renderable extends BaseRenderable {
|
|
|
15602
15607
|
child.updateLayout(deltaTime, renderList);
|
|
15603
15608
|
}
|
|
15604
15609
|
} else {
|
|
15610
|
+
for (const child of this._childrenInZIndexOrder) {
|
|
15611
|
+
if (child.isDestroyed)
|
|
15612
|
+
continue;
|
|
15613
|
+
child.updateFromLayout();
|
|
15614
|
+
}
|
|
15605
15615
|
const visibleChildren = this._getVisibleChildren();
|
|
15606
15616
|
const visibleChildSet = new Set(visibleChildren);
|
|
15607
15617
|
for (const child of this._childrenInZIndexOrder) {
|
|
15608
|
-
if (!visibleChildSet.has(child.num))
|
|
15609
|
-
child.updateFromLayout();
|
|
15618
|
+
if (!visibleChildSet.has(child.num))
|
|
15610
15619
|
continue;
|
|
15611
|
-
}
|
|
15612
15620
|
child.updateLayout(deltaTime, renderList);
|
|
15613
15621
|
}
|
|
15614
15622
|
}
|
|
@@ -15620,8 +15628,6 @@ class Renderable extends BaseRenderable {
|
|
|
15620
15628
|
}
|
|
15621
15629
|
}
|
|
15622
15630
|
render(buffer, deltaTime) {
|
|
15623
|
-
const screenX = this._screenX;
|
|
15624
|
-
const screenY = this._screenY;
|
|
15625
15631
|
let renderBuffer = buffer;
|
|
15626
15632
|
if (this.buffered && this.frameBuffer) {
|
|
15627
15633
|
renderBuffer = this.frameBuffer;
|
|
@@ -15633,6 +15639,8 @@ class Renderable extends BaseRenderable {
|
|
|
15633
15639
|
if (this.renderAfter) {
|
|
15634
15640
|
this.renderAfter.call(this, renderBuffer, deltaTime);
|
|
15635
15641
|
}
|
|
15642
|
+
const screenX = this._screenX;
|
|
15643
|
+
const screenY = this._screenY;
|
|
15636
15644
|
this.markClean();
|
|
15637
15645
|
this._ctx.addToHitGrid(screenX, screenY, this.width, this.height, this.num);
|
|
15638
15646
|
if (this.buffered && this.frameBuffer) {
|
|
@@ -15640,7 +15648,7 @@ class Renderable extends BaseRenderable {
|
|
|
15640
15648
|
}
|
|
15641
15649
|
}
|
|
15642
15650
|
_hasVisibleChildFilter() {
|
|
15643
|
-
return
|
|
15651
|
+
return this._getVisibleChildren !== Renderable.prototype._getVisibleChildren;
|
|
15644
15652
|
}
|
|
15645
15653
|
_getVisibleChildren() {
|
|
15646
15654
|
return this._childrenInZIndexOrder.map((child) => child.num);
|
|
@@ -18761,6 +18769,26 @@ function parsePixelResolution(sequence) {
|
|
|
18761
18769
|
}
|
|
18762
18770
|
|
|
18763
18771
|
// src/renderer.ts
|
|
18772
|
+
var OSC_THEME_RESPONSE = /\x1b](10|11);(?:(?:rgb:)([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)|#([0-9a-fA-F]{6}))(?:\x07|\x1b\\)/g;
|
|
18773
|
+
function scaleOscThemeComponent(component) {
|
|
18774
|
+
const value = parseInt(component, 16);
|
|
18775
|
+
const maxValue = (1 << 4 * component.length) - 1;
|
|
18776
|
+
return Math.round(value / maxValue * 255).toString(16).padStart(2, "0");
|
|
18777
|
+
}
|
|
18778
|
+
function oscThemeColorToHex(r, g, b, hex6) {
|
|
18779
|
+
if (hex6) {
|
|
18780
|
+
return `#${hex6.toLowerCase()}`;
|
|
18781
|
+
}
|
|
18782
|
+
if (r && g && b) {
|
|
18783
|
+
return `#${scaleOscThemeComponent(r)}${scaleOscThemeComponent(g)}${scaleOscThemeComponent(b)}`;
|
|
18784
|
+
}
|
|
18785
|
+
return "#000000";
|
|
18786
|
+
}
|
|
18787
|
+
function inferThemeModeFromBackgroundColor(color) {
|
|
18788
|
+
const [r, g, b] = parseColor(color).toInts();
|
|
18789
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
18790
|
+
return brightness > 128 ? "light" : "dark";
|
|
18791
|
+
}
|
|
18764
18792
|
registerEnvVar({
|
|
18765
18793
|
name: "OTUI_DUMP_CAPTURES",
|
|
18766
18794
|
description: "Dump captured stdout and console caches when the renderer exit handler runs.",
|
|
@@ -19040,6 +19068,7 @@ class CliRenderer extends EventEmitter9 {
|
|
|
19040
19068
|
renderTimeout = null;
|
|
19041
19069
|
lastTime = 0;
|
|
19042
19070
|
frameCount = 0;
|
|
19071
|
+
_frameId = 0;
|
|
19043
19072
|
lastFpsTime = 0;
|
|
19044
19073
|
currentFps = 0;
|
|
19045
19074
|
targetFrameTime = 1000 / this._targetFps;
|
|
@@ -19117,6 +19146,10 @@ class CliRenderer extends EventEmitter9 {
|
|
|
19117
19146
|
_paletteDetectionPromise = null;
|
|
19118
19147
|
_onDestroy;
|
|
19119
19148
|
_themeMode = null;
|
|
19149
|
+
_themeModeSource = "none";
|
|
19150
|
+
_themeFallbackPending = true;
|
|
19151
|
+
_themeOscForeground = null;
|
|
19152
|
+
_themeOscBackground = null;
|
|
19120
19153
|
_terminalFocusState = null;
|
|
19121
19154
|
sequenceHandlers = [];
|
|
19122
19155
|
prependedInputHandlers = [];
|
|
@@ -19374,6 +19407,9 @@ Captured output:
|
|
|
19374
19407
|
const caps = this.capabilities;
|
|
19375
19408
|
return caps?.unicode === "wcwidth" ? "wcwidth" : "unicode";
|
|
19376
19409
|
}
|
|
19410
|
+
get frameId() {
|
|
19411
|
+
return this._frameId;
|
|
19412
|
+
}
|
|
19377
19413
|
writeOut(chunk, encoding, callback) {
|
|
19378
19414
|
if (this.rendererPtr && this._useThread) {
|
|
19379
19415
|
const data = typeof chunk === "string" ? chunk : chunk?.toString() ?? "";
|
|
@@ -19546,6 +19582,38 @@ Captured output:
|
|
|
19546
19582
|
get themeMode() {
|
|
19547
19583
|
return this._themeMode;
|
|
19548
19584
|
}
|
|
19585
|
+
waitForThemeMode(timeoutMs = 1000) {
|
|
19586
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
|
|
19587
|
+
throw new Error("timeoutMs must be a non-negative finite number");
|
|
19588
|
+
}
|
|
19589
|
+
if (this._themeMode !== null || this._isDestroyed || timeoutMs === 0) {
|
|
19590
|
+
return Promise.resolve(this._themeMode);
|
|
19591
|
+
}
|
|
19592
|
+
return new Promise((resolve4) => {
|
|
19593
|
+
let timeoutHandle = null;
|
|
19594
|
+
const cleanup = () => {
|
|
19595
|
+
if (timeoutHandle !== null) {
|
|
19596
|
+
this.clock.clearTimeout(timeoutHandle);
|
|
19597
|
+
timeoutHandle = null;
|
|
19598
|
+
}
|
|
19599
|
+
this.off("theme_mode" /* THEME_MODE */, handleThemeMode);
|
|
19600
|
+
this.off("destroy" /* DESTROY */, handleDestroy);
|
|
19601
|
+
};
|
|
19602
|
+
const finish = () => {
|
|
19603
|
+
cleanup();
|
|
19604
|
+
resolve4(this._themeMode);
|
|
19605
|
+
};
|
|
19606
|
+
const handleThemeMode = () => {
|
|
19607
|
+
finish();
|
|
19608
|
+
};
|
|
19609
|
+
const handleDestroy = () => {
|
|
19610
|
+
finish();
|
|
19611
|
+
};
|
|
19612
|
+
this.on("theme_mode" /* THEME_MODE */, handleThemeMode);
|
|
19613
|
+
this.on("destroy" /* DESTROY */, handleDestroy);
|
|
19614
|
+
timeoutHandle = this.clock.setTimeout(finish, timeoutMs);
|
|
19615
|
+
});
|
|
19616
|
+
}
|
|
19549
19617
|
getDebugInputs() {
|
|
19550
19618
|
return [...this._debugInputs];
|
|
19551
19619
|
}
|
|
@@ -19767,21 +19835,50 @@ Captured output:
|
|
|
19767
19835
|
}).bind(this);
|
|
19768
19836
|
themeModeHandler = ((sequence) => {
|
|
19769
19837
|
if (sequence === "\x1B[?997;1n") {
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
this.emit("theme_mode" /* THEME_MODE */, "dark");
|
|
19773
|
-
}
|
|
19838
|
+
this.applyThemeMode("dark", "csi");
|
|
19839
|
+
this._themeFallbackPending = false;
|
|
19774
19840
|
return true;
|
|
19775
19841
|
}
|
|
19776
19842
|
if (sequence === "\x1B[?997;2n") {
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
|
|
19843
|
+
this.applyThemeMode("light", "csi");
|
|
19844
|
+
this._themeFallbackPending = false;
|
|
19845
|
+
return true;
|
|
19846
|
+
}
|
|
19847
|
+
let handledOscThemeResponse = false;
|
|
19848
|
+
let match;
|
|
19849
|
+
OSC_THEME_RESPONSE.lastIndex = 0;
|
|
19850
|
+
while (match = OSC_THEME_RESPONSE.exec(sequence)) {
|
|
19851
|
+
handledOscThemeResponse = true;
|
|
19852
|
+
const color = oscThemeColorToHex(match[2], match[3], match[4], match[5]);
|
|
19853
|
+
if (match[1] === "10") {
|
|
19854
|
+
this._themeOscForeground = color;
|
|
19855
|
+
} else {
|
|
19856
|
+
this._themeOscBackground = color;
|
|
19780
19857
|
}
|
|
19858
|
+
}
|
|
19859
|
+
if (!handledOscThemeResponse) {
|
|
19860
|
+
return false;
|
|
19861
|
+
}
|
|
19862
|
+
if (!this._themeFallbackPending) {
|
|
19781
19863
|
return true;
|
|
19782
19864
|
}
|
|
19783
|
-
|
|
19865
|
+
if (this._themeOscForeground && this._themeOscBackground) {
|
|
19866
|
+
this.applyThemeMode(inferThemeModeFromBackgroundColor(this._themeOscBackground), "osc");
|
|
19867
|
+
this._themeFallbackPending = false;
|
|
19868
|
+
}
|
|
19869
|
+
return true;
|
|
19784
19870
|
}).bind(this);
|
|
19871
|
+
applyThemeMode(mode, source) {
|
|
19872
|
+
if (source === "osc" && this._themeModeSource === "csi") {
|
|
19873
|
+
return;
|
|
19874
|
+
}
|
|
19875
|
+
const changed = this._themeMode !== mode;
|
|
19876
|
+
this._themeMode = mode;
|
|
19877
|
+
this._themeModeSource = source;
|
|
19878
|
+
if (changed) {
|
|
19879
|
+
this.emit("theme_mode" /* THEME_MODE */, mode);
|
|
19880
|
+
}
|
|
19881
|
+
}
|
|
19785
19882
|
dispatchSequenceHandlers(sequence) {
|
|
19786
19883
|
if (this._debugModeEnabled) {
|
|
19787
19884
|
this._debugInputs.push({
|
|
@@ -20173,6 +20270,9 @@ Captured output:
|
|
|
20173
20270
|
setTerminalTitle(title) {
|
|
20174
20271
|
this.lib.setTerminalTitle(this.rendererPtr, title);
|
|
20175
20272
|
}
|
|
20273
|
+
resetTerminalBgColor() {
|
|
20274
|
+
process.stdout.write("\x1B]111\x07");
|
|
20275
|
+
}
|
|
20176
20276
|
copyToClipboardOSC52(text, target) {
|
|
20177
20277
|
return this.clipboard.copyToClipboardOSC52(text, target);
|
|
20178
20278
|
}
|
|
@@ -20457,6 +20557,7 @@ Captured output:
|
|
|
20457
20557
|
this.renderTimeout = null;
|
|
20458
20558
|
}
|
|
20459
20559
|
try {
|
|
20560
|
+
this._frameId++;
|
|
20460
20561
|
const now = this.normalizeClockTime(this.clock.now(), this.lastTime);
|
|
20461
20562
|
const elapsed = this.getElapsedMs(now, this.lastTime);
|
|
20462
20563
|
const deltaTime = elapsed;
|
|
@@ -20723,5 +20824,5 @@ Captured output:
|
|
|
20723
20824
|
|
|
20724
20825
|
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 };
|
|
20725
20826
|
|
|
20726
|
-
//# debugId=
|
|
20727
|
-
//# sourceMappingURL=index-
|
|
20827
|
+
//# debugId=0674A8A7C58EC52864756E2164756E21
|
|
20828
|
+
//# sourceMappingURL=index-7pbnsh6w.js.map
|