@opentui/core 0.1.100 → 0.1.101
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/{index-nr5q8nyn.js → index-9qfn9g6r.js} +3 -3
- package/{index-86ppjrgv.js → index-ekbq0zm9.js} +2 -2
- package/{index-zkcykvp8.js → index-xsfpee0k.js} +98 -11
- package/{index-zkcykvp8.js.map → index-xsfpee0k.js.map} +4 -4
- package/index.js +2 -2
- package/package.json +7 -7
- package/renderer.d.ts +6 -0
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing.js +1 -1
- /package/{index-nr5q8nyn.js.map → index-9qfn9g6r.js.map} +0 -0
- /package/{index-86ppjrgv.js.map → index-ekbq0zm9.js.map} +0 -0
package/3d.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
exports_src
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-ekbq0zm9.js";
|
|
5
5
|
import {
|
|
6
6
|
__require
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-xsfpee0k.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-9qfn9g6r.js.map
|
|
@@ -167,7 +167,7 @@ import {
|
|
|
167
167
|
white,
|
|
168
168
|
wrapWithDelegates,
|
|
169
169
|
yellow
|
|
170
|
-
} from "./index-
|
|
170
|
+
} from "./index-xsfpee0k.js";
|
|
171
171
|
|
|
172
172
|
// src/index.ts
|
|
173
173
|
var exports_src2 = {};
|
|
@@ -12064,4 +12064,4 @@ class TimeToFirstDrawRenderable extends Renderable {
|
|
|
12064
12064
|
export { TextBufferView, convertThemeToStyles, SyntaxStyle, DistortionEffect, VignetteEffect, CloudsEffect, FlamesEffect, CRTRollingBarEffect, RainbowTextEffect, applyScanlines, applyInvert, applyNoise, applyChromaticAberration, applyAsciiArt, applyBrightness, applyGain, applySaturation, BloomEffect, SEPIA_MATRIX, PROTANOPIA_SIM_MATRIX, DEUTERANOPIA_SIM_MATRIX, TRITANOPIA_SIM_MATRIX, ACHROMATOPSIA_MATRIX, PROTANOPIA_COMP_MATRIX, DEUTERANOPIA_COMP_MATRIX, TRITANOPIA_COMP_MATRIX, TECHNICOLOR_MATRIX, SOLARIZATION_MATRIX, SYNTHWAVE_MATRIX, GREENSCALE_MATRIX, GRAYSCALE_MATRIX, INVERT_MATRIX, Timeline, engine, createTimeline, SlotRegistry, createSlotRegistry, createCoreSlotRegistry, registerCorePlugin, resolveCoreSlot, SlotRenderable, NativeSpanFeed, FrameBufferRenderable, ASCIIFontRenderable, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, Generic, Box, Text, ASCIIFont, Input, Select, TabSelect, FrameBuffer, Code, ScrollBox, vstyles, VRenderable, LineNumberRenderable, TextRenderable, DiffRenderable, TextareaRenderable, InputRenderableEvents, InputRenderable, TextTableRenderable, MarkdownRenderable, SliderRenderable, ScrollBarRenderable, ArrowRenderable, ScrollBoxRenderable, SelectRenderableEvents, SelectRenderable, TabSelectRenderableEvents, TabSelectRenderable, TimeToFirstDrawRenderable, exports_src2 as exports_src };
|
|
12065
12065
|
|
|
12066
12066
|
//# debugId=B00F19B858C15EFD64756E2164756E21
|
|
12067
|
-
//# sourceMappingURL=index-
|
|
12067
|
+
//# sourceMappingURL=index-ekbq0zm9.js.map
|
|
@@ -7088,6 +7088,8 @@ function canCompleteDeferredPrivateReplyCsi(state, byte, context) {
|
|
|
7088
7088
|
return state.hasDigit && byte === 121;
|
|
7089
7089
|
if (byte === 99)
|
|
7090
7090
|
return state.hasDigit || state.semicolons > 0;
|
|
7091
|
+
if (byte === 110)
|
|
7092
|
+
return state.hasDigit;
|
|
7091
7093
|
return state.hasDigit && byte === 117;
|
|
7092
7094
|
}
|
|
7093
7095
|
function concatBytes(left, right) {
|
|
@@ -7789,7 +7791,7 @@ class StdinParser {
|
|
|
7789
7791
|
}
|
|
7790
7792
|
if (byte >= 64 && byte <= 126) {
|
|
7791
7793
|
const end = this.cursor + 1;
|
|
7792
|
-
this.
|
|
7794
|
+
this.emitOpaqueResponse("csi", bytes.subarray(this.unitStart, end));
|
|
7793
7795
|
this.state = { tag: "ground" };
|
|
7794
7796
|
this.consumePrefix(end);
|
|
7795
7797
|
continue;
|
|
@@ -18769,6 +18771,26 @@ function parsePixelResolution(sequence) {
|
|
|
18769
18771
|
}
|
|
18770
18772
|
|
|
18771
18773
|
// src/renderer.ts
|
|
18774
|
+
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;
|
|
18775
|
+
function scaleOscThemeComponent(component) {
|
|
18776
|
+
const value = parseInt(component, 16);
|
|
18777
|
+
const maxValue = (1 << 4 * component.length) - 1;
|
|
18778
|
+
return Math.round(value / maxValue * 255).toString(16).padStart(2, "0");
|
|
18779
|
+
}
|
|
18780
|
+
function oscThemeColorToHex(r, g, b, hex6) {
|
|
18781
|
+
if (hex6) {
|
|
18782
|
+
return `#${hex6.toLowerCase()}`;
|
|
18783
|
+
}
|
|
18784
|
+
if (r && g && b) {
|
|
18785
|
+
return `#${scaleOscThemeComponent(r)}${scaleOscThemeComponent(g)}${scaleOscThemeComponent(b)}`;
|
|
18786
|
+
}
|
|
18787
|
+
return "#000000";
|
|
18788
|
+
}
|
|
18789
|
+
function inferThemeModeFromBackgroundColor(color) {
|
|
18790
|
+
const [r, g, b] = parseColor(color).toInts();
|
|
18791
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
18792
|
+
return brightness > 128 ? "light" : "dark";
|
|
18793
|
+
}
|
|
18772
18794
|
registerEnvVar({
|
|
18773
18795
|
name: "OTUI_DUMP_CAPTURES",
|
|
18774
18796
|
description: "Dump captured stdout and console caches when the renderer exit handler runs.",
|
|
@@ -19126,6 +19148,10 @@ class CliRenderer extends EventEmitter9 {
|
|
|
19126
19148
|
_paletteDetectionPromise = null;
|
|
19127
19149
|
_onDestroy;
|
|
19128
19150
|
_themeMode = null;
|
|
19151
|
+
_themeModeSource = "none";
|
|
19152
|
+
_themeFallbackPending = true;
|
|
19153
|
+
_themeOscForeground = null;
|
|
19154
|
+
_themeOscBackground = null;
|
|
19129
19155
|
_terminalFocusState = null;
|
|
19130
19156
|
sequenceHandlers = [];
|
|
19131
19157
|
prependedInputHandlers = [];
|
|
@@ -19558,6 +19584,38 @@ Captured output:
|
|
|
19558
19584
|
get themeMode() {
|
|
19559
19585
|
return this._themeMode;
|
|
19560
19586
|
}
|
|
19587
|
+
waitForThemeMode(timeoutMs = 1000) {
|
|
19588
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
|
|
19589
|
+
throw new Error("timeoutMs must be a non-negative finite number");
|
|
19590
|
+
}
|
|
19591
|
+
if (this._themeMode !== null || this._isDestroyed || timeoutMs === 0) {
|
|
19592
|
+
return Promise.resolve(this._themeMode);
|
|
19593
|
+
}
|
|
19594
|
+
return new Promise((resolve4) => {
|
|
19595
|
+
let timeoutHandle = null;
|
|
19596
|
+
const cleanup = () => {
|
|
19597
|
+
if (timeoutHandle !== null) {
|
|
19598
|
+
this.clock.clearTimeout(timeoutHandle);
|
|
19599
|
+
timeoutHandle = null;
|
|
19600
|
+
}
|
|
19601
|
+
this.off("theme_mode" /* THEME_MODE */, handleThemeMode);
|
|
19602
|
+
this.off("destroy" /* DESTROY */, handleDestroy);
|
|
19603
|
+
};
|
|
19604
|
+
const finish = () => {
|
|
19605
|
+
cleanup();
|
|
19606
|
+
resolve4(this._themeMode);
|
|
19607
|
+
};
|
|
19608
|
+
const handleThemeMode = () => {
|
|
19609
|
+
finish();
|
|
19610
|
+
};
|
|
19611
|
+
const handleDestroy = () => {
|
|
19612
|
+
finish();
|
|
19613
|
+
};
|
|
19614
|
+
this.on("theme_mode" /* THEME_MODE */, handleThemeMode);
|
|
19615
|
+
this.on("destroy" /* DESTROY */, handleDestroy);
|
|
19616
|
+
timeoutHandle = this.clock.setTimeout(finish, timeoutMs);
|
|
19617
|
+
});
|
|
19618
|
+
}
|
|
19561
19619
|
getDebugInputs() {
|
|
19562
19620
|
return [...this._debugInputs];
|
|
19563
19621
|
}
|
|
@@ -19779,21 +19837,50 @@ Captured output:
|
|
|
19779
19837
|
}).bind(this);
|
|
19780
19838
|
themeModeHandler = ((sequence) => {
|
|
19781
19839
|
if (sequence === "\x1B[?997;1n") {
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
this.emit("theme_mode" /* THEME_MODE */, "dark");
|
|
19785
|
-
}
|
|
19840
|
+
this.applyThemeMode("dark", "csi");
|
|
19841
|
+
this._themeFallbackPending = false;
|
|
19786
19842
|
return true;
|
|
19787
19843
|
}
|
|
19788
19844
|
if (sequence === "\x1B[?997;2n") {
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19845
|
+
this.applyThemeMode("light", "csi");
|
|
19846
|
+
this._themeFallbackPending = false;
|
|
19847
|
+
return true;
|
|
19848
|
+
}
|
|
19849
|
+
let handledOscThemeResponse = false;
|
|
19850
|
+
let match;
|
|
19851
|
+
OSC_THEME_RESPONSE.lastIndex = 0;
|
|
19852
|
+
while (match = OSC_THEME_RESPONSE.exec(sequence)) {
|
|
19853
|
+
handledOscThemeResponse = true;
|
|
19854
|
+
const color = oscThemeColorToHex(match[2], match[3], match[4], match[5]);
|
|
19855
|
+
if (match[1] === "10") {
|
|
19856
|
+
this._themeOscForeground = color;
|
|
19857
|
+
} else {
|
|
19858
|
+
this._themeOscBackground = color;
|
|
19792
19859
|
}
|
|
19860
|
+
}
|
|
19861
|
+
if (!handledOscThemeResponse) {
|
|
19862
|
+
return false;
|
|
19863
|
+
}
|
|
19864
|
+
if (!this._themeFallbackPending) {
|
|
19793
19865
|
return true;
|
|
19794
19866
|
}
|
|
19795
|
-
|
|
19867
|
+
if (this._themeOscForeground && this._themeOscBackground) {
|
|
19868
|
+
this.applyThemeMode(inferThemeModeFromBackgroundColor(this._themeOscBackground), "osc");
|
|
19869
|
+
this._themeFallbackPending = false;
|
|
19870
|
+
}
|
|
19871
|
+
return true;
|
|
19796
19872
|
}).bind(this);
|
|
19873
|
+
applyThemeMode(mode, source) {
|
|
19874
|
+
if (source === "osc" && this._themeModeSource === "csi") {
|
|
19875
|
+
return;
|
|
19876
|
+
}
|
|
19877
|
+
const changed = this._themeMode !== mode;
|
|
19878
|
+
this._themeMode = mode;
|
|
19879
|
+
this._themeModeSource = source;
|
|
19880
|
+
if (changed) {
|
|
19881
|
+
this.emit("theme_mode" /* THEME_MODE */, mode);
|
|
19882
|
+
}
|
|
19883
|
+
}
|
|
19797
19884
|
dispatchSequenceHandlers(sequence) {
|
|
19798
19885
|
if (this._debugModeEnabled) {
|
|
19799
19886
|
this._debugInputs.push({
|
|
@@ -20739,5 +20826,5 @@ Captured output:
|
|
|
20739
20826
|
|
|
20740
20827
|
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 };
|
|
20741
20828
|
|
|
20742
|
-
//# debugId=
|
|
20743
|
-
//# sourceMappingURL=index-
|
|
20829
|
+
//# debugId=9682C54D228A139264756E2164756E21
|
|
20830
|
+
//# sourceMappingURL=index-xsfpee0k.js.map
|