@opentui/core 0.9.0 → 0.9.1

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.
@@ -386,6 +386,7 @@ var nativeSymbols = {
386
386
  ot_text_buffer_get_range: { args: ["ptr", "buffer", "u32", "u32", "ptr", "u32", "buffer"], returns: "i32" },
387
387
  ot_text_buffer_set_defaults: { args: ["ptr", "buffer", "u32", "buffer"], returns: "i32" },
388
388
  ot_text_buffer_set_tab_width: { args: ["ptr", "buffer", "u32"], returns: "i32" },
389
+ ot_text_buffer_set_width_method: { args: ["ptr", "buffer", "u32"], returns: "i32" },
389
390
  ot_text_buffer_highlight: { args: ["ptr", "buffer", "u32", "u32", "ptr"], returns: "i32" },
390
391
  ot_text_buffer_get_highlights: { args: ["ptr", "buffer", "u32", "ptr", "u32", "buffer"], returns: "i32" },
391
392
  ot_text_buffer_set_layer: { args: ["ptr", "buffer", "u32", "u32", "u32", "ptr", "u32"], returns: "i32" },
@@ -1095,7 +1096,7 @@ var nativeLayouts = {
1095
1096
  struct_size: { offset: 0, size: 4, alignment: 4, type: "u32" },
1096
1097
  abi_version: { offset: 4, size: 4, alignment: 4, type: "u32" },
1097
1098
  width_method: { offset: 8, size: 4, alignment: 4, type: "u32" },
1098
- reserved: { offset: 12, size: 4, alignment: 4, type: "u32" }
1099
+ flags: { offset: 12, size: 4, alignment: 4, type: "u32" }
1099
1100
  }
1100
1101
  },
1101
1102
  ot_edit_buffer_info: {
@@ -2089,6 +2090,7 @@ var nativeConstants = {
2089
2090
  OT_SCENE_TEXT_SELECTION_RESET: 0,
2090
2091
  OT_SCENE_TEXT_SELECTION_SET: 1,
2091
2092
  OT_SCENE_TEXT_SELECTION_UPDATE: 2,
2093
+ OT_SCENE_TEXT_SELECTION_COLORS: 3,
2092
2094
  OT_SCENE_TEXT_SELECTION_CELL: 0,
2093
2095
  OT_SCENE_TEXT_SELECTION_WORD: 1,
2094
2096
  OT_SCENE_TEXT_SELECTION_LINE: 2,
@@ -2225,6 +2227,7 @@ var nativeConstants = {
2225
2227
  OT_EMBEDDED_TERMINAL_CLEAR_SELECTION: 2,
2226
2228
  OT_EMBEDDED_TERMINAL_SET_TRANSPARENT_BACKGROUND: 3,
2227
2229
  OT_EMBEDDED_TERMINAL_RESPONSE_BYTES_MAX: 1048576,
2230
+ OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH: 1,
2228
2231
  OT_EDIT_CURSOR_CHANGED: 1,
2229
2232
  OT_EDIT_CONTENT_CHANGED: 2,
2230
2233
  OT_EDIT_HISTORY_CURSOR_CHANGED: 4,
@@ -6072,6 +6075,14 @@ function allocFFIStruct(structDefinition) {
6072
6075
  const storage = allocStruct(structDefinition);
6073
6076
  return { ...storage, ffiView: new Uint8Array(storage.buffer) };
6074
6077
  }
6078
+ function editBufferOptions(options, kind) {
6079
+ const layout = nativeLayouts.ot_edit_buffer_options;
6080
+ const record = createContextRecord(layout);
6081
+ record[layout.fields.width_method.offset / 4] = widthMethodId(options.widthMethod ?? "unicode", kind);
6082
+ if (options.followSessionWidth)
6083
+ record[layout.fields.flags.offset / 4] = nativeConstants.OT_EDIT_BUFFER_FOLLOW_SESSION_WIDTH;
6084
+ return record;
6085
+ }
6075
6086
  var NativeTextViewCommand2;
6076
6087
  ((NativeTextViewCommand) => {
6077
6088
  NativeTextViewCommand[NativeTextViewCommand["WrapWidth"] = 0] = "WrapWidth";
@@ -8599,11 +8610,8 @@ class FFIRenderLib2 {
8599
8610
  return count[0] === 0 ? "" : this.decoder.decode(bytes.subarray(0, count[0]));
8600
8611
  }
8601
8612
  createContextTextBuffer(context, options = {}) {
8602
- const layout = nativeLayouts.ot_edit_buffer_options;
8603
8613
  this.getYogaHost().assertMutable();
8604
- const widthMethod = widthMethodId(options.widthMethod ?? "unicode", "text");
8605
- const record = createContextRecord(layout);
8606
- record[layout.fields.width_method.offset / 4] = widthMethod;
8614
+ const record = editBufferOptions(options, "text");
8607
8615
  const output = new Uint32Array(handleWords);
8608
8616
  const pointer = this.nativeContextPointer(context, "ot_text_buffer_create");
8609
8617
  nativeResult("ot_text_buffer_create", this.opentui.symbols.ot_text_buffer_create(pointer, record, output));
@@ -9140,6 +9148,14 @@ class FFIRenderLib2 {
9140
9148
  nativeResult("ot_text_buffer_set_tab_width", this.opentui.symbols.ot_text_buffer_set_tab_width(pointer, handle, value));
9141
9149
  });
9142
9150
  }
9151
+ contextTextBufferSetWidthMethod(context, text, widthMethod) {
9152
+ const handle = encodeContextHandle(context, text);
9153
+ const method = widthMethodId(widthMethod, "text");
9154
+ this.getYogaHost().runMutation(() => {
9155
+ const pointer = this.nativeContextPointer(context, "ot_text_buffer_set_width_method");
9156
+ nativeResult("ot_text_buffer_set_width_method", this.opentui.symbols.ot_text_buffer_set_width_method(pointer, handle, method));
9157
+ });
9158
+ }
9143
9159
  contextTextBufferHighlight(context, text, operation, argument = 0, highlight) {
9144
9160
  const handle = encodeContextHandle(context, text);
9145
9161
  const selector = toSafeFFIU32Length(operation, "Text highlight operation");
@@ -9342,11 +9358,8 @@ class FFIRenderLib2 {
9342
9358
  nativeResult("ot_buffer_draw_scene_body", this.opentui.symbols.ot_buffer_draw_scene_body(pointer, destination, request, source, column, row));
9343
9359
  }
9344
9360
  createContextEditBuffer(context, options = {}) {
9345
- const layout = nativeLayouts.ot_edit_buffer_options;
9346
9361
  this.getYogaHost().assertMutable();
9347
- const widthMethod = widthMethodId(options.widthMethod ?? "unicode", "editor");
9348
- const record = createContextRecord(layout);
9349
- record[layout.fields.width_method.offset / 4] = widthMethod;
9362
+ const record = editBufferOptions(options, "editor");
9350
9363
  const output = new Uint32Array(handleWords);
9351
9364
  const pointer = this.nativeContextPointer(context, "ot_edit_buffer_create");
9352
9365
  nativeResult("ot_edit_buffer_create", this.opentui.symbols.ot_edit_buffer_create(pointer, record, output));
@@ -11496,7 +11509,7 @@ class FFIRenderLib2 {
11496
11509
  this.getYogaHost().assertMutable();
11497
11510
  const handle = encodeContextHandle(context, node);
11498
11511
  const record = createContextRecord(layout);
11499
- const operation = ["reset", "set", "update"].indexOf(options.operation);
11512
+ const operation = ["reset", "set", "update", "colors"].indexOf(options.operation);
11500
11513
  const behavior = ["cell", "word", "line"].indexOf(options.behavior);
11501
11514
  if (operation < 0 || behavior < 0)
11502
11515
  throw new TypeError("Unknown scene text selection operation or behavior");
@@ -13871,5 +13884,5 @@ var yoga_default = Yoga;
13871
13884
 
13872
13885
  export { nativeLayouts, 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, NativeEditAtomic, NativeEditPositionQuery2, NativeEditorStyleMask2, NativeEditHighlightOperation2, NativeEditorCommand2, NativeEditorSelectionOperation2, NativeEditorPositionQuery2, NativeEditEvent2, NativeStyleGroup, NativeStyleFlags, NATIVE_EDGE_NONE2, NativeBorder2, NativeSceneHook2, NativeSceneFrame2, NativeScenePaintPhase2, emptySceneScrollState, 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 };
13873
13886
 
13874
- //# debugId=990E799710D3272C64756E2164756E21
13875
- //# sourceMappingURL=chunk-node-k5s8s41v.js.map
13887
+ //# debugId=A73B90C38AB354F364756E2164756E21
13888
+ //# sourceMappingURL=chunk-node-mcdre3zn.js.map