@opentui/core 0.6.6 → 0.6.7

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.
@@ -2299,76 +2299,76 @@ function normalizeNodeDefinitions(definitions) {
2299
2299
  function wrapNodeSymbols(functions, definitions) {
2300
2300
  return Object.fromEntries(Object.entries(functions).map(([name, fn]) => [name, wrapNodeSymbol(fn, definitions[name])]));
2301
2301
  }
2302
+ var NODE_ARGUMENT_AS_IS = 0;
2303
+ var NODE_ARGUMENT_POINTER = 1;
2304
+ var NODE_ARGUMENT_INT32 = 2;
2305
+ function toNodeArgumentKind(type) {
2306
+ if (isNodePointerArgumentType(type))
2307
+ return NODE_ARGUMENT_POINTER;
2308
+ const nodeType = toNodeFFIType(type, "parameter");
2309
+ return nodeType === "i32" || nodeType === "u32" ? NODE_ARGUMENT_INT32 : NODE_ARGUMENT_AS_IS;
2310
+ }
2311
+ function toNodeArgument(value, kind) {
2312
+ if (kind === NODE_ARGUMENT_POINTER)
2313
+ return toNodePointerArgumentFast(value);
2314
+ return kind === NODE_ARGUMENT_INT32 && value === 0 ? 0 : value;
2315
+ }
2302
2316
  function wrapNodeSymbol(fn, definition) {
2303
- const pointerArgIndexes = (definition.args ?? []).flatMap((type, index) => isNodePointerArgumentType(type) ? [index] : []);
2304
- if (pointerArgIndexes.length === 0) {
2317
+ const kinds = (definition.args ?? []).map(toNodeArgumentKind);
2318
+ const pointerCount = kinds.filter((kind) => kind === NODE_ARGUMENT_POINTER).length;
2319
+ if (kinds.every((kind) => kind === NODE_ARGUMENT_AS_IS)) {
2305
2320
  return fn;
2306
2321
  }
2307
- if (definition.args?.length === 7 && pointerArgIndexes.length >= 2) {
2308
- return wrapNodeSymbol7(fn, pointerArgIndexes);
2322
+ if (kinds.length === 7 && pointerCount >= 2) {
2323
+ return wrapNodeSymbol7(fn, kinds);
2309
2324
  }
2310
- if (definition.args?.length === 8) {
2311
- return wrapNodeSymbol8(fn, pointerArgIndexes);
2325
+ if (kinds.length === 8) {
2326
+ return wrapNodeSymbol8(fn, kinds);
2312
2327
  }
2313
- const pointerArgs = new Set(pointerArgIndexes);
2314
- const normalize = (value, index) => pointerArgs.has(index) ? toNodePointerArgumentFast(value) : value;
2315
- switch (definition.args?.length) {
2328
+ const [kind0, kind1, kind2] = kinds;
2329
+ switch (kinds.length) {
2316
2330
  case 1:
2317
2331
  return function(arg0) {
2318
2332
  if (arguments.length !== 1)
2319
2333
  return Reflect.apply(fn, undefined, arguments);
2320
- return fn(normalize(arg0, 0));
2334
+ return fn(toNodeArgument(arg0, kind0));
2321
2335
  };
2322
2336
  case 2:
2323
2337
  return function(arg0, arg1) {
2324
2338
  if (arguments.length !== 2)
2325
2339
  return Reflect.apply(fn, undefined, arguments);
2326
- return fn(normalize(arg0, 0), normalize(arg1, 1));
2340
+ return fn(toNodeArgument(arg0, kind0), toNodeArgument(arg1, kind1));
2327
2341
  };
2328
2342
  case 3:
2329
2343
  return function(arg0, arg1, arg2) {
2330
2344
  if (arguments.length !== 3)
2331
2345
  return Reflect.apply(fn, undefined, arguments);
2332
- return fn(normalize(arg0, 0), normalize(arg1, 1), normalize(arg2, 2));
2346
+ return fn(toNodeArgument(arg0, kind0), toNodeArgument(arg1, kind1), toNodeArgument(arg2, kind2));
2333
2347
  };
2334
2348
  }
2349
+ const adaptedIndexes = kinds.flatMap((kind, index) => kind === NODE_ARGUMENT_AS_IS ? [] : [index]);
2335
2350
  return (...args) => {
2336
2351
  const normalizedArgs = args.slice();
2337
- for (const index of pointerArgIndexes) {
2338
- normalizedArgs[index] = toNodePointerArgument(normalizedArgs[index]);
2352
+ for (const index of adaptedIndexes) {
2353
+ normalizedArgs[index] = toNodeArgument(normalizedArgs[index], kinds[index]);
2339
2354
  }
2340
2355
  return fn(...normalizedArgs);
2341
2356
  };
2342
2357
  }
2343
- function wrapNodeSymbol7(fn, pointerArgIndexes) {
2344
- const pointer0 = pointerArgIndexes.includes(0);
2345
- const pointer1 = pointerArgIndexes.includes(1);
2346
- const pointer2 = pointerArgIndexes.includes(2);
2347
- const pointer3 = pointerArgIndexes.includes(3);
2348
- const pointer4 = pointerArgIndexes.includes(4);
2349
- const pointer5 = pointerArgIndexes.includes(5);
2350
- const pointer6 = pointerArgIndexes.includes(6);
2351
- const normalize = (value, pointer) => pointer ? toNodePointerArgumentFast(value) : value;
2358
+ function wrapNodeSymbol7(fn, kinds) {
2359
+ const [kind0, kind1, kind2, kind3, kind4, kind5, kind6] = kinds;
2352
2360
  return function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
2353
2361
  if (arguments.length !== 7)
2354
2362
  return Reflect.apply(fn, undefined, arguments);
2355
- return fn(normalize(arg0, pointer0), normalize(arg1, pointer1), normalize(arg2, pointer2), normalize(arg3, pointer3), normalize(arg4, pointer4), normalize(arg5, pointer5), normalize(arg6, pointer6));
2363
+ return fn(toNodeArgument(arg0, kind0), toNodeArgument(arg1, kind1), toNodeArgument(arg2, kind2), toNodeArgument(arg3, kind3), toNodeArgument(arg4, kind4), toNodeArgument(arg5, kind5), toNodeArgument(arg6, kind6));
2356
2364
  };
2357
2365
  }
2358
- function wrapNodeSymbol8(fn, pointerArgIndexes) {
2359
- const pointer0 = pointerArgIndexes.includes(0);
2360
- const pointer1 = pointerArgIndexes.includes(1);
2361
- const pointer2 = pointerArgIndexes.includes(2);
2362
- const pointer3 = pointerArgIndexes.includes(3);
2363
- const pointer4 = pointerArgIndexes.includes(4);
2364
- const pointer5 = pointerArgIndexes.includes(5);
2365
- const pointer6 = pointerArgIndexes.includes(6);
2366
- const pointer7 = pointerArgIndexes.includes(7);
2367
- const normalize = (value, pointer) => pointer ? toNodePointerArgumentFast(value) : value;
2366
+ function wrapNodeSymbol8(fn, kinds) {
2367
+ const [kind0, kind1, kind2, kind3, kind4, kind5, kind6, kind7] = kinds;
2368
2368
  return function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
2369
2369
  if (arguments.length !== 8)
2370
2370
  return Reflect.apply(fn, undefined, arguments);
2371
- return fn(normalize(arg0, pointer0), normalize(arg1, pointer1), normalize(arg2, pointer2), normalize(arg3, pointer3), normalize(arg4, pointer4), normalize(arg5, pointer5), normalize(arg6, pointer6), normalize(arg7, pointer7));
2371
+ return fn(toNodeArgument(arg0, kind0), toNodeArgument(arg1, kind1), toNodeArgument(arg2, kind2), toNodeArgument(arg3, kind3), toNodeArgument(arg4, kind4), toNodeArgument(arg5, kind5), toNodeArgument(arg6, kind6), toNodeArgument(arg7, kind7));
2372
2372
  };
2373
2373
  }
2374
2374
  function toNodePointerArgumentFast(value) {
@@ -8576,8 +8576,8 @@ class FFIRenderLib2 {
8576
8576
  const destination = encodeContextHandle(context, target);
8577
8577
  const request = frame === null ? null : encodeSceneFrameRequest(context, frame);
8578
8578
  const source = encodeContextHandle(context, view);
8579
- const column = toFFII32(x, "Text view x") || 0;
8580
- const row = toFFII32(y, "Text view y") || 0;
8579
+ const column = toFFII32(x, "Text view x");
8580
+ const row = toFFII32(y, "Text view y");
8581
8581
  const pointer = this.nativeContextPointer(context, "ot_buffer_draw_text_view");
8582
8582
  nativeResult("ot_buffer_draw_text_view", this.opentui.symbols.ot_buffer_draw_text_view(pointer, destination, request, source, column, row));
8583
8583
  }
@@ -8586,8 +8586,8 @@ class FFIRenderLib2 {
8586
8586
  const destination = encodeContextHandle(context, target);
8587
8587
  const request = frame === null ? null : encodeSceneFrameRequest(context, frame);
8588
8588
  const source = encodeContextHandle(context, view);
8589
- const column = toFFII32(x, "Editor view x") || 0;
8590
- const row = toFFII32(y, "Editor view y") || 0;
8589
+ const column = toFFII32(x, "Editor view x");
8590
+ const row = toFFII32(y, "Editor view y");
8591
8591
  const pointer = this.nativeContextPointer(context, "ot_buffer_draw_editor_view");
8592
8592
  nativeResult("ot_buffer_draw_editor_view", this.opentui.symbols.ot_buffer_draw_editor_view(pointer, destination, request, source, column, row));
8593
8593
  }
@@ -8596,8 +8596,8 @@ class FFIRenderLib2 {
8596
8596
  const destination = encodeContextHandle(context, target);
8597
8597
  const request = frame === null ? null : encodeSceneFrameRequest(context, frame);
8598
8598
  const source = encodeContextHandle(context, node);
8599
- const column = toFFII32(x, "Scene text x") || 0;
8600
- const row = toFFII32(y, "Scene text y") || 0;
8599
+ const column = toFFII32(x, "Scene text x");
8600
+ const row = toFFII32(y, "Scene text y");
8601
8601
  const pointer = this.nativeContextPointer(context, "ot_buffer_draw_scene_text");
8602
8602
  nativeResult("ot_buffer_draw_scene_text", this.opentui.symbols.ot_buffer_draw_scene_text(pointer, destination, request, source, column, row));
8603
8603
  }
@@ -12629,5 +12629,5 @@ var yoga_default = Yoga;
12629
12629
 
12630
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 };
12631
12631
 
12632
- //# debugId=0BF426E31EECA3F864756E2164756E21
12633
- //# sourceMappingURL=chunk-bun-jztcnb74.js.map
12632
+ //# debugId=0623A84D99914C2564756E2164756E21
12633
+ //# sourceMappingURL=chunk-bun-ehr9v0n8.js.map