@opentui/core 0.6.4 → 0.6.6

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.
@@ -3728,6 +3728,9 @@ function sceneGetEnum(scene, node, kind) {
3728
3728
  function sceneSetFloat(scene, node, kind, value) {
3729
3729
  scene.setStyle(node, NativeStyleGroup.Float, kind, NATIVE_EDGE_NONE2, Unit2.Undefined, value ?? NaN);
3730
3730
  }
3731
+ function sceneGetFloat(scene, node, kind) {
3732
+ return scene.getStyle(node, NativeStyleGroup.Float, kind, NATIVE_EDGE_NONE2).value;
3733
+ }
3731
3734
  function sceneSetValue(scene, node, kind, edge, valueInput) {
3732
3735
  const value = parseYogaValue(valueInput);
3733
3736
  scene.setStyle(node, NativeStyleGroup.Value, kind, edge, value.unit, value.value);
@@ -5660,8 +5663,8 @@ var NativeStatus2;
5660
5663
  class NativeError2 extends Error {
5661
5664
  operation;
5662
5665
  status;
5663
- constructor(operation, status) {
5664
- super(`${operation} failed: ${NativeStatus2[status] ?? `status ${status}`}`);
5666
+ constructor(operation, status, reason = NativeStatus2[status] ?? `status ${status}`) {
5667
+ super(`${operation} failed: ${reason}`);
5665
5668
  this.operation = operation;
5666
5669
  this.status = status;
5667
5670
  this.name = "NativeError";
@@ -5884,9 +5887,10 @@ function toSafeByteCount(value, label) {
5884
5887
  return Number(value);
5885
5888
  }
5886
5889
  function toSafeFFIU32Length(value, label) {
5887
- if (!Number.isSafeInteger(value) || value < 0 || value > MAX_FFI_U32) {
5890
+ if (!Number.isInteger(value) || value < 0)
5891
+ throw new RangeError(`${label} must be a non-negative integer`);
5892
+ if (value > MAX_FFI_U32)
5888
5893
  throw new RangeError(`${label} exceeds native u32 length limit`);
5889
- }
5890
5894
  return value;
5891
5895
  }
5892
5896
  function isFFIU32(value) {
@@ -7785,8 +7789,8 @@ class FFIRenderLib2 {
7785
7789
  hitTestOutput = new Uint32Array(1);
7786
7790
  bufferStackInput = new Float32Array(1);
7787
7791
  bufferStackOutput = new Float32Array(1);
7788
- drawTextBytes;
7789
- drawBottomBytes;
7792
+ drawTextBytes = new Uint8Array(NATIVE_BUFFER_TEXT_BYTES_MAX2);
7793
+ drawBottomBytes = new Uint8Array(NATIVE_BUFFER_TEXT_BYTES_MAX2);
7790
7794
  opentui;
7791
7795
  iccCacheClient = false;
7792
7796
  yogaLayout = new Float32Array(6);
@@ -9234,8 +9238,8 @@ class FFIRenderLib2 {
9234
9238
  const encoded = encodeBufferDrawRecord(context, options, scratch.words, signed, colors, 0, scratch.source);
9235
9239
  const record = scratch.records[encoded.operation];
9236
9240
  const source = encoded.source;
9237
- const textBytes = this.drawTextBytes ??= new Uint8Array(NATIVE_BUFFER_TEXT_BYTES_MAX2);
9238
- const bottomBytes = this.drawBottomBytes ??= new Uint8Array(NATIVE_BUFFER_TEXT_BYTES_MAX2);
9241
+ const textBytes = this.drawTextBytes;
9242
+ const bottomBytes = this.drawBottomBytes;
9239
9243
  const textLength = encodeDrawText(text, textBytes);
9240
9244
  const bottomLength = encodeDrawText(bottom, bottomBytes);
9241
9245
  const pointer = this.nativeContextPointer(context, "ot_buffer_draw");
@@ -9958,7 +9962,10 @@ class FFIRenderLib2 {
9958
9962
  const destination = parent === null ? null : encodeContextHandle(context, parent, scratch.target.record, scratch.target.words);
9959
9963
  const childIndex = toSafeFFIU32Length(index, "Scene child index");
9960
9964
  const pointer = this.nativeContextPointer(context, "ot_scene_move_node");
9961
- nativeResult("ot_scene_move_node", this.opentui.symbols.ot_scene_move_node(pointer, handle, destination, childIndex));
9965
+ const status = this.opentui.symbols.ot_scene_move_node(pointer, handle, destination, childIndex);
9966
+ if (status === -16 /* ObjectLimit */)
9967
+ throw new NativeError2("ot_scene_move_node", status, "Scene nesting depth exceeds the native limit");
9968
+ nativeResult("ot_scene_move_node", status);
9962
9969
  } finally {
9963
9970
  this.sceneMoveRecord ??= scratch;
9964
9971
  }
@@ -10016,11 +10023,11 @@ class FFIRenderLib2 {
10016
10023
  const bottomTitle = details.bottomTitle ?? "";
10017
10024
  if (typeof title !== "string" || typeof bottomTitle !== "string")
10018
10025
  throw new TypeError("Box titles must be strings");
10019
- const topBytes = sessionBytes(this.encoder.encode(title), "Box title length");
10020
- const bottomBytes = sessionBytes(this.encoder.encode(bottomTitle), "Box bottom title length");
10026
+ const topLength = encodeDrawText(title, this.drawTextBytes);
10027
+ const bottomLength = encodeDrawText(bottomTitle, this.drawBottomBytes);
10021
10028
  this.getYogaHost().runMutation(() => {
10022
10029
  const pointer = this.nativeContextPointer(context, "ot_scene_set_box_details");
10023
- nativeResult("ot_scene_set_box_details", this.opentui.symbols.ot_scene_set_box_details(pointer, handle, record, viewOrNull(topBytes), topBytes.length, viewOrNull(bottomBytes), bottomBytes.length));
10030
+ nativeResult("ot_scene_set_box_details", this.opentui.symbols.ot_scene_set_box_details(pointer, handle, record, topLength === 0 ? null : this.drawTextBytes, topLength, bottomLength === 0 ? null : this.drawBottomBytes, bottomLength));
10024
10031
  });
10025
10032
  }
10026
10033
  sceneSetSurface(context, node, buffer) {
@@ -12620,7 +12627,7 @@ var Yoga = {
12620
12627
  };
12621
12628
  var yoga_default = Yoga;
12622
12629
 
12623
- export { nativeConstants, toArrayBuffer, singleton, getSingleton, destroySingleton, envRegistry2, registerEnvVar2, clearEnvCache2, generateEnvMarkdown2, generateEnvColored2, env2, stringWidth, resolveBundledFilePath2, Worker, TextAttributes2, ATTRIBUTE_BASE_BITS2, ATTRIBUTE_BASE_MASK2, getBaseAttributes2, DebugOverlayCorner2, TargetChannel2, DEFAULT_FOREGROUND_RGB2, DEFAULT_BACKGROUND_RGB2, normalizeIndexedColorIndex2, ansi256IndexToRgb2, RGBA2, normalizeColorValue2, hexToRgb2, rgbToHex2, hsvToRgb2, parseColor2, 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, YogaEnumKind, YogaFloatKind, YogaValueKind, sceneSetEnum, sceneGetEnum, sceneSetFloat, sceneSetValue, sceneGetValue, sceneSetDimension, UNDEFINED_VALUE, parseYogaValue, SpanInfoStruct, NativeAudioStreamFormat2, NativeAudioStreamState2, NativeAudioStreamStateNames, NativeAudioStreamCloseReason2, isBunfsPath, normalizeBunfsPath, resolveDefaultParserAsset, resolveDefaultTreeSitterWorkerPath, resolveTreeSitterWasm, NativeAudioStreamState3, NativeAudioStreamCloseReason3, NativeAudioStreamFormat3, MAX_LINK_URL_BYTES2, NativeTextViewCommand2, NativeEditCommand2, NativeEditPositionQuery2, NativeEditorStyleMask2, NativeEditHighlightOperation2, NativeEditorCommand2, NativeEditorSelectionOperation2, NativeEditorPositionQuery2, NativeEditEvent2, NativeStyleGroup, NativeStyleFlags, NATIVE_EDGE_NONE2, NativeBorder2, NativeSceneHook2, NativeSceneFrame2, NativeScenePaintPhase2, NATIVE_BUFFER_TEXT_BYTES_MAX2, NativeSessionState2, NativeSessionRenderStatus2, NATIVE_SESSION_CONTROL_PACKET_BYTES2, NativeSessionTerminalPhase2, NativeSessionPumpStatus2, NativeStatus2, NativeError2, NativeClipboardOperationStatus2, NativeClipboardStartStatus2, NativeClipboardCancelStatus2, NativeClipboardCopyStatus2, NativeClipboardDestroyStatus2, NativeClipboardShutdownStatus2, SceneStaging, NativePaintRecorder, LogLevel2, FFIRenderLib2, 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, YogaStatus2, YogaError2, Config2, Node2, exports_yoga, yoga_default };
12630
+ export { nativeConstants, toArrayBuffer, singleton, getSingleton, destroySingleton, envRegistry2, registerEnvVar2, clearEnvCache2, generateEnvMarkdown2, generateEnvColored2, env2, stringWidth, resolveBundledFilePath2, Worker, TextAttributes2, ATTRIBUTE_BASE_BITS2, ATTRIBUTE_BASE_MASK2, getBaseAttributes2, DebugOverlayCorner2, TargetChannel2, DEFAULT_FOREGROUND_RGB2, DEFAULT_BACKGROUND_RGB2, normalizeIndexedColorIndex2, ansi256IndexToRgb2, RGBA2, normalizeColorValue2, hexToRgb2, rgbToHex2, hsvToRgb2, parseColor2, 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, YogaEnumKind, YogaFloatKind, YogaValueKind, sceneSetEnum, sceneGetEnum, sceneSetFloat, sceneGetFloat, sceneSetValue, sceneGetValue, sceneSetDimension, UNDEFINED_VALUE, parseYogaValue, SpanInfoStruct, NativeAudioStreamFormat2, NativeAudioStreamState2, NativeAudioStreamStateNames, NativeAudioStreamCloseReason2, isBunfsPath, normalizeBunfsPath, resolveDefaultParserAsset, resolveDefaultTreeSitterWorkerPath, resolveTreeSitterWasm, NativeAudioStreamState3, NativeAudioStreamCloseReason3, NativeAudioStreamFormat3, MAX_LINK_URL_BYTES2, NativeTextViewCommand2, NativeEditCommand2, NativeEditPositionQuery2, NativeEditorStyleMask2, NativeEditHighlightOperation2, NativeEditorCommand2, NativeEditorSelectionOperation2, NativeEditorPositionQuery2, NativeEditEvent2, NativeStyleGroup, NativeStyleFlags, NATIVE_EDGE_NONE2, NativeBorder2, NativeSceneHook2, NativeSceneFrame2, NativeScenePaintPhase2, NATIVE_BUFFER_TEXT_BYTES_MAX2, NativeSessionState2, NativeSessionRenderStatus2, NATIVE_SESSION_CONTROL_PACKET_BYTES2, NativeSessionTerminalPhase2, NativeSessionPumpStatus2, NativeStatus2, NativeError2, NativeClipboardOperationStatus2, NativeClipboardStartStatus2, NativeClipboardCancelStatus2, NativeClipboardCopyStatus2, NativeClipboardDestroyStatus2, NativeClipboardShutdownStatus2, SceneStaging, NativePaintRecorder, LogLevel2, FFIRenderLib2, 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, YogaStatus2, YogaError2, Config2, Node2, exports_yoga, yoga_default };
12624
12631
 
12625
- //# debugId=F20A9528ED9106B664756E2164756E21
12626
- //# sourceMappingURL=chunk-bun-e2gttx65.js.map
12632
+ //# debugId=0BF426E31EECA3F864756E2164756E21
12633
+ //# sourceMappingURL=chunk-bun-jztcnb74.js.map