@opentui/core 0.5.11 → 0.5.13

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.
@@ -8301,11 +8301,9 @@ function createNodeWorkerConstructor(node) {
8301
8301
  return this.terminationPromise;
8302
8302
  }
8303
8303
  this.worker.off("message", this.handleMessage);
8304
- this.worker.off("error", this.handleError);
8305
8304
  const termination = this.worker.terminate().catch((error) => {
8306
8305
  this.terminationPromise = undefined;
8307
8306
  this.worker.on("message", this.handleMessage);
8308
- this.worker.on("error", this.handleError);
8309
8307
  throw error;
8310
8308
  });
8311
8309
  this.terminationPromise = termination;
@@ -13624,7 +13622,44 @@ registerEnvVar2({
13624
13622
  });
13625
13623
  var CURSOR_STYLE_TO_ID = { block: 0, line: 1, underline: 2, default: 3 };
13626
13624
  var CURSOR_ID_TO_STYLE = ["block", "line", "underline", "default"];
13627
- var MOUSE_STYLE_TO_ID = { default: 0, pointer: 1, text: 2, crosshair: 3, move: 4, "not-allowed": 5 };
13625
+ var MOUSE_STYLE_TO_ID = {
13626
+ auto: 0,
13627
+ default: 1,
13628
+ none: 2,
13629
+ "context-menu": 3,
13630
+ help: 4,
13631
+ pointer: 5,
13632
+ progress: 6,
13633
+ wait: 7,
13634
+ cell: 8,
13635
+ crosshair: 9,
13636
+ text: 10,
13637
+ "vertical-text": 11,
13638
+ alias: 12,
13639
+ copy: 13,
13640
+ move: 14,
13641
+ "no-drop": 15,
13642
+ "not-allowed": 16,
13643
+ grab: 17,
13644
+ grabbing: 18,
13645
+ "all-scroll": 19,
13646
+ "col-resize": 20,
13647
+ "row-resize": 21,
13648
+ "n-resize": 22,
13649
+ "e-resize": 23,
13650
+ "s-resize": 24,
13651
+ "w-resize": 25,
13652
+ "ne-resize": 26,
13653
+ "nw-resize": 27,
13654
+ "se-resize": 28,
13655
+ "sw-resize": 29,
13656
+ "ew-resize": 30,
13657
+ "ns-resize": 31,
13658
+ "nesw-resize": 32,
13659
+ "nwse-resize": 33,
13660
+ "zoom-in": 34,
13661
+ "zoom-out": 35
13662
+ };
13628
13663
  var MAX_FFI_U32 = 4294967295;
13629
13664
  var globalTraceSymbols = null;
13630
13665
  var globalFFILogPath = null;
@@ -13650,6 +13685,10 @@ function toSafeFFIU32Length(value, label) {
13650
13685
  function isFFIU32(value) {
13651
13686
  return Number.isInteger(value) && value >= 0 && value <= MAX_FFI_U32;
13652
13687
  }
13688
+ var DRAW_TEXT_SCRATCH_BYTES = 4096;
13689
+ function drawTextString(text) {
13690
+ return typeof text === "string" ? text : text === undefined ? "" : `${text}`;
13691
+ }
13653
13692
  function viewOrNull(value) {
13654
13693
  return value.byteLength === 0 ? null : value;
13655
13694
  }
@@ -13763,6 +13802,10 @@ function getOpenTUILib(libPath) {
13763
13802
  args: ["u32"],
13764
13803
  returns: "i32"
13765
13804
  },
13805
+ embeddedTerminalSetTransparentBackground: {
13806
+ args: ["u32", "u8"],
13807
+ returns: "i32"
13808
+ },
13766
13809
  embeddedTerminalScroll: {
13767
13810
  args: ["u32", "i32"],
13768
13811
  returns: "i32"
@@ -14466,6 +14509,10 @@ function getOpenTUILib(libPath) {
14466
14509
  args: ["u32", "u8"],
14467
14510
  returns: "void"
14468
14511
  },
14512
+ textBufferViewSetTextAlign: {
14513
+ args: ["u32", "u8"],
14514
+ returns: "void"
14515
+ },
14469
14516
  textBufferViewSetFirstLineOffset: {
14470
14517
  args: ["u32", "u32"],
14471
14518
  returns: "void"
@@ -15548,6 +15595,8 @@ class FFIRenderLib {
15548
15595
  clipboardServices = new Set;
15549
15596
  encoder = new TextEncoder;
15550
15597
  decoder = new TextDecoder;
15598
+ drawTextScratch = new Uint8Array(DRAW_TEXT_SCRATCH_BYTES);
15599
+ drawBottomTitleScratch = new Uint8Array(DRAW_TEXT_SCRATCH_BYTES);
15551
15600
  logCallbackWrapper = null;
15552
15601
  eventCallbackWrapper = null;
15553
15602
  eventSinkPtr = null;
@@ -15594,6 +15643,9 @@ class FFIRenderLib {
15594
15643
  embeddedTerminalInvalidate(handle) {
15595
15644
  embeddedTerminalResult(this.opentui.symbols.embeddedTerminalInvalidate(handle), "invalidation");
15596
15645
  }
15646
+ embeddedTerminalSetTransparentBackground(handle, transparent) {
15647
+ embeddedTerminalResult(this.opentui.symbols.embeddedTerminalSetTransparentBackground(handle, transparent ? 1 : 0), "transparent background update");
15648
+ }
15597
15649
  embeddedTerminalScroll(handle, delta) {
15598
15650
  embeddedTerminalResult(this.opentui.symbols.embeddedTerminalScroll(handle, embeddedTerminalI32(delta, "scroll delta")), "scroll");
15599
15651
  }
@@ -15986,10 +16038,15 @@ class FFIRenderLib {
15986
16038
  this.opentui.symbols.bufferClear(buffer, rgbaBuffer(color));
15987
16039
  }
15988
16040
  bufferDrawText(buffer, text, x, y, color, bgColor, attributes) {
15989
- const textBytes = this.encoder.encode(text);
15990
16041
  const bg = optionalRgbaBuffer(bgColor);
15991
16042
  const fg = rgbaBuffer(color);
15992
- this.opentui.symbols.bufferDrawText(buffer, viewOrNull(textBytes), textBytes.byteLength, x, y, fg, bg, attributes ?? 0);
16043
+ const string = drawTextString(text);
16044
+ const bytes = this.drawTextStorage(string, this.drawTextScratch);
16045
+ const length = this.encoder.encodeInto(string, bytes).written;
16046
+ this.opentui.symbols.bufferDrawText(buffer, length === 0 ? null : bytes, length, x, y, fg, bg, attributes ?? 0);
16047
+ }
16048
+ drawTextStorage(text, scratch) {
16049
+ return text.length * 3 <= scratch.byteLength ? scratch : new Uint8Array(text.length * 3);
15993
16050
  }
15994
16051
  bufferSetCellWithAlphaBlending(buffer, x, y, char, color, bgColor, attributes) {
15995
16052
  const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
@@ -16049,13 +16106,16 @@ class FFIRenderLib {
16049
16106
  this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaBuffer(borderFg), rgbaBuffer(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, this.ffiStructStorage.gridDrawOptions.ffiView);
16050
16107
  }
16051
16108
  bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, titleColor, title, bottomTitle) {
16052
- const titleBytes = title ? this.encoder.encode(title) : null;
16053
- const titleLen = titleBytes?.byteLength ?? 0;
16054
- const titleBuffer = titleBytes ? titleBytes : null;
16055
- const bottomTitleBytes = bottomTitle ? this.encoder.encode(bottomTitle) : null;
16056
- const bottomTitleLen = bottomTitleBytes?.byteLength ?? 0;
16057
- const bottomTitleBuffer = bottomTitleBytes ? bottomTitleBytes : null;
16058
- this.opentui.symbols.bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, rgbaBuffer(borderColor), rgbaBuffer(backgroundColor), rgbaBuffer(titleColor), titleBuffer, titleLen, bottomTitleBuffer, bottomTitleLen);
16109
+ const border = rgbaBuffer(borderColor);
16110
+ const background = rgbaBuffer(backgroundColor);
16111
+ const titleFg = rgbaBuffer(titleColor);
16112
+ const top = title ? drawTextString(title) : null;
16113
+ const bottom = bottomTitle ? drawTextString(bottomTitle) : null;
16114
+ const topBytes = top === null ? null : this.drawTextStorage(top, this.drawTextScratch);
16115
+ const bottomBytes = bottom === null ? null : this.drawTextStorage(bottom, this.drawBottomTitleScratch);
16116
+ const topLength = top === null ? 0 : this.encoder.encodeInto(top, topBytes).written;
16117
+ const bottomLength = bottom === null ? 0 : this.encoder.encodeInto(bottom, bottomBytes).written;
16118
+ this.opentui.symbols.bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, border, background, titleFg, topBytes, topLength, bottomBytes, bottomLength);
16059
16119
  }
16060
16120
  bufferResize(buffer, width, height) {
16061
16121
  this.opentui.symbols.bufferResize(buffer, width, height);
@@ -16686,6 +16746,10 @@ class FFIRenderLib {
16686
16746
  const modeValue = mode === "none" ? 0 : mode === "char" ? 1 : 2;
16687
16747
  this.opentui.symbols.textBufferViewSetWrapMode(view, modeValue);
16688
16748
  }
16749
+ textBufferViewSetTextAlign(view, alignment) {
16750
+ const alignValue = alignment === "left" ? 0 : alignment === "center" ? 1 : 2;
16751
+ this.opentui.symbols.textBufferViewSetTextAlign(view, alignValue);
16752
+ }
16689
16753
  textBufferViewSetFirstLineOffset(view, offset) {
16690
16754
  this.opentui.symbols.textBufferViewSetFirstLineOffset(view, offset);
16691
16755
  }
@@ -18770,5 +18834,5 @@ var yoga_default = Yoga;
18770
18834
 
18771
18835
  export { toArrayBuffer, singleton, envRegistry2, registerEnvVar2, clearEnvCache2, generateEnvMarkdown2, generateEnvColored2, env2, sleep, stringWidth, resolveBundledFilePath2, DEFAULT_FOREGROUND_RGB2, DEFAULT_BACKGROUND_RGB2, normalizeIndexedColorIndex2, ansi256IndexToRgb2, RGBA2, normalizeColorValue2, hexToRgb2, rgbToHex2, hsvToRgb2, parseColor2, isValidBorderStyle2, parseBorderStyle2, BorderChars2, getBorderFromSides2, getBorderSides2, borderCharsToArray2, BorderCharArrays2, KeyEvent2, PasteEvent2, KeyHandler2, InternalKeyHandler2, fonts2, measureText2, getCharacterPositions2, coordinateToCharacterIndex2, renderFontToFrameBuffer2, TextAttributes2, ATTRIBUTE_BASE_BITS2, ATTRIBUTE_BASE_MASK2, getBaseAttributes2, DebugOverlayCorner2, TargetChannel2, createTextAttributes2, attributesWithLink2, getLinkId2, visualizeRenderableTree2, isStyledText2, StyledText2, stringToStyledText2, black2, red2, green2, yellow2, blue2, magenta2, cyan2, white2, brightBlack2, brightRed2, brightGreen2, brightYellow2, brightBlue2, brightMagenta2, brightCyan2, brightWhite2, bgBlack2, bgRed2, bgGreen2, bgYellow2, bgBlue2, bgMagenta2, bgCyan2, bgWhite2, bold2, italic2, underline2, strikethrough2, dim2, reverse2, blink2, fg2, bg2, link2, t2, hastToStyledText2, SystemClock2, nonAlphanumericKeys2, terminalNamedSingleStrokeKeys2, parseKeypress2, LinearScrollAccel2, MacOSScrollAccel2, parseAlign2, parseAlignItems2, parseBoxSizing2, parseDimension2, parseDirection2, parseDisplay2, parseEdge2, parseFlexDirection2, parseGutter2, parseJustify2, parseLogLevel2, parseMeasureMode2, parseOverflow2, parsePositionType2, parseUnit2, parseWrap2, MouseParser2, Selection2, convertGlobalToLocalSelection2, ASCIIFontSelectionHelper2, StdinParser2, addDefaultParsers2, TreeSitterClient2, treeSitterToTextChunks2, treeSitterToStyledText2, DataPathsManager2, getDataPaths2, extensionToFiletype2, basenameToFiletype2, extToFiletype2, pathToFiletype2, infoStringToFiletype2, getTreeSitterClient2, destroyTreeSitterClient2, ExtmarksController2, createExtmarksController2, TerminalPalette2, createTerminalPalette2, normalizeTerminalPalette2, buildTerminalPaletteSignature2, decodePasteBytes2, stripAnsiSequences2, createHostClipboard2, createClipboard2, ClipboardTarget2, createRendererClipboardAdapter2, Clipboard2, normalizeMarkdownLinkTarget, detectLinks2, OptimizedBuffer2, TextBuffer2, SpanInfoStruct, NativeAudioStreamFormat2, NativeAudioStreamState2, NativeAudioStreamStateNames, NativeAudioStreamCloseReason2, NativeAudioStreamState3, NativeAudioStreamCloseReason3, NativeAudioStreamFormat3, MAX_LINK_URL_BYTES2, NativeClipboardOperationStatus2, NativeClipboardStartStatus2, NativeClipboardCancelStatus2, NativeClipboardCopyStatus2, NativeClipboardDestroyStatus2, NativeClipboardShutdownStatus2, LogLevel2, NativeMeasureTargetKind2, setRenderLibPath2, resolveRenderLib2, Align2, BoxSizing2, Dimension2, Direction2, Display2, Edge2, Errata2, ExperimentalFeature2, FlexDirection2, Gutter2, Justify2, LogLevel3, MeasureMode2, NodeType2, Overflow2, PositionType2, Unit2, Wrap2, ALIGN_AUTO2, ALIGN_FLEX_START2, ALIGN_CENTER2, ALIGN_FLEX_END2, ALIGN_STRETCH2, ALIGN_BASELINE2, ALIGN_SPACE_BETWEEN2, ALIGN_SPACE_AROUND2, ALIGN_SPACE_EVENLY2, BOX_SIZING_BORDER_BOX2, BOX_SIZING_CONTENT_BOX2, DIMENSION_WIDTH2, DIMENSION_HEIGHT2, DIRECTION_INHERIT2, DIRECTION_LTR2, DIRECTION_RTL2, DISPLAY_FLEX2, DISPLAY_NONE2, DISPLAY_CONTENTS2, EDGE_LEFT2, EDGE_TOP2, EDGE_RIGHT2, EDGE_BOTTOM2, EDGE_START2, EDGE_END2, EDGE_HORIZONTAL2, EDGE_VERTICAL2, EDGE_ALL2, ERRATA_NONE2, ERRATA_STRETCH_FLEX_BASIS2, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING2, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE2, ERRATA_ALL2, ERRATA_CLASSIC2, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS2, FLEX_DIRECTION_COLUMN2, FLEX_DIRECTION_COLUMN_REVERSE2, FLEX_DIRECTION_ROW2, FLEX_DIRECTION_ROW_REVERSE2, GUTTER_COLUMN2, GUTTER_ROW2, GUTTER_ALL2, JUSTIFY_FLEX_START2, JUSTIFY_CENTER2, JUSTIFY_FLEX_END2, JUSTIFY_SPACE_BETWEEN2, JUSTIFY_SPACE_AROUND2, JUSTIFY_SPACE_EVENLY2, LOG_LEVEL_ERROR2, LOG_LEVEL_WARN2, LOG_LEVEL_INFO2, LOG_LEVEL_DEBUG2, LOG_LEVEL_VERBOSE2, LOG_LEVEL_FATAL2, MEASURE_MODE_UNDEFINED2, MEASURE_MODE_EXACTLY2, MEASURE_MODE_AT_MOST2, NODE_TYPE_DEFAULT2, NODE_TYPE_TEXT2, OVERFLOW_VISIBLE2, OVERFLOW_HIDDEN2, OVERFLOW_SCROLL2, POSITION_TYPE_STATIC2, POSITION_TYPE_RELATIVE2, POSITION_TYPE_ABSOLUTE2, UNIT_UNDEFINED2, UNIT_POINT2, UNIT_PERCENT2, UNIT_AUTO2, WRAP_NO_WRAP2, WRAP_WRAP2, WRAP_WRAP_REVERSE2, Config2, Node2, exports_yoga, yoga_default };
18772
18836
 
18773
- //# debugId=C8F70BCDECDD4B1164756E2164756E21
18774
- //# sourceMappingURL=chunk-node-70eg2nhg.js.map
18837
+ //# debugId=0EEB9DEBA63FBE2964756E2164756E21
18838
+ //# sourceMappingURL=chunk-node-80p7e6t6.js.map