@opentui/core 0.4.2 → 0.4.3
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/Renderable.d.ts +2 -7
- package/{index-x7n320jr.js → index-d5xqskty.js} +152 -68
- package/index-d5xqskty.js.map +58 -0
- package/{index-6xr3rbbe.js → index-xt9f071j.js} +147 -136
- package/{index-6xr3rbbe.js.map → index-xt9f071j.js.map} +8 -8
- package/index.js +55 -32
- package/index.js.map +7 -7
- package/package.json +10 -10
- package/renderables/EditBufferRenderable.d.ts +2 -1
- package/renderables/LineNumberRenderable.d.ts +2 -2
- package/renderables/ScrollBox.d.ts +3 -2
- package/renderables/Select.d.ts +5 -0
- package/renderables/Text.d.ts +1 -1
- package/renderables/TextBufferRenderable.d.ts +3 -2
- package/renderables/TextNode.d.ts +2 -1
- package/testing.js +2 -2
- package/yoga.d.ts +1 -4
- package/yoga.js +1 -1
- package/zig-structs.d.ts +3 -3
- package/zig.d.ts +17 -3
- package/index-x7n320jr.js.map +0 -58
package/Renderable.d.ts
CHANGED
|
@@ -10,8 +10,6 @@ import type { RenderContext } from "./types.js";
|
|
|
10
10
|
declare const BrandedRenderable: unique symbol;
|
|
11
11
|
export declare enum LayoutEvents {
|
|
12
12
|
LAYOUT_CHANGED = "layout-changed",
|
|
13
|
-
ADDED = "added",
|
|
14
|
-
REMOVED = "removed",
|
|
15
13
|
RESIZED = "resized"
|
|
16
14
|
}
|
|
17
15
|
export declare enum RenderableEvents {
|
|
@@ -98,7 +96,7 @@ export declare abstract class BaseRenderable extends EventEmitter {
|
|
|
98
96
|
protected _visible: boolean;
|
|
99
97
|
constructor(options: BaseRenderableOptions);
|
|
100
98
|
abstract add(obj: BaseRenderable | unknown, index?: number): number;
|
|
101
|
-
abstract remove(
|
|
99
|
+
abstract remove(child: BaseRenderable): void;
|
|
102
100
|
abstract insertBefore(obj: BaseRenderable | unknown, anchor: BaseRenderable | unknown): void;
|
|
103
101
|
abstract getChildren(): BaseRenderable[];
|
|
104
102
|
abstract getChildrenCount(): number;
|
|
@@ -151,7 +149,6 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
151
149
|
protected _position: Position;
|
|
152
150
|
protected _opacity: number;
|
|
153
151
|
private _flexShrink;
|
|
154
|
-
private renderableMapById;
|
|
155
152
|
protected _childrenInLayoutOrder: Renderable[];
|
|
156
153
|
protected _childrenInZIndexOrder: Renderable[];
|
|
157
154
|
private needsZIndexSort;
|
|
@@ -164,8 +161,6 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
164
161
|
renderBefore?: (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
|
|
165
162
|
renderAfter?: (this: Renderable, buffer: OptimizedBuffer, deltaTime: number) => void;
|
|
166
163
|
constructor(ctx: RenderContext, options: RenderableOptions<any>);
|
|
167
|
-
get id(): string;
|
|
168
|
-
set id(value: string);
|
|
169
164
|
get focusable(): boolean;
|
|
170
165
|
set focusable(value: boolean);
|
|
171
166
|
get ctx(): RenderContext;
|
|
@@ -267,7 +262,7 @@ export declare abstract class Renderable extends BaseRenderable {
|
|
|
267
262
|
add(obj: Renderable | VNode<any, any[]> | unknown, index?: number): number;
|
|
268
263
|
insertBefore(obj: Renderable | VNode<any, any[]> | unknown, anchor?: Renderable | unknown): number;
|
|
269
264
|
getRenderable(id: string): Renderable | undefined;
|
|
270
|
-
remove(
|
|
265
|
+
remove(child: BaseRenderable): void;
|
|
271
266
|
protected onRemove(): void;
|
|
272
267
|
getChildren(): Renderable[];
|
|
273
268
|
getChildrenCount(): number;
|
|
@@ -351,7 +351,7 @@ function createNodeBackend(nodeFfi) {
|
|
|
351
351
|
let closed = false;
|
|
352
352
|
let libraryClosed = false;
|
|
353
353
|
return {
|
|
354
|
-
symbols: wrapNodeSymbols(functions, symbols
|
|
354
|
+
symbols: wrapNodeSymbols(functions, symbols),
|
|
355
355
|
createCallback(callback, definition) {
|
|
356
356
|
if (closed) {
|
|
357
357
|
throw new Error(LIBRARY_CLOSED);
|
|
@@ -402,10 +402,10 @@ function toNodeLibraryPath(path) {
|
|
|
402
402
|
function normalizeNodeDefinitions(definitions) {
|
|
403
403
|
return Object.fromEntries(Object.entries(definitions).map(([name, definition]) => [name, normalizeNodeDefinition(definition)]));
|
|
404
404
|
}
|
|
405
|
-
function wrapNodeSymbols(functions, definitions
|
|
406
|
-
return Object.fromEntries(Object.entries(functions).map(([name, fn]) => [name, wrapNodeSymbol(fn, definitions[name]
|
|
405
|
+
function wrapNodeSymbols(functions, definitions) {
|
|
406
|
+
return Object.fromEntries(Object.entries(functions).map(([name, fn]) => [name, wrapNodeSymbol(fn, definitions[name])]));
|
|
407
407
|
}
|
|
408
|
-
function wrapNodeSymbol(fn, definition
|
|
408
|
+
function wrapNodeSymbol(fn, definition) {
|
|
409
409
|
const pointerArgIndexes = (definition.args ?? []).flatMap((type, index) => isNodePointerArgumentType(type) ? [index] : []);
|
|
410
410
|
if (pointerArgIndexes.length === 0) {
|
|
411
411
|
return fn;
|
|
@@ -413,7 +413,7 @@ function wrapNodeSymbol(fn, definition, nodeFfi) {
|
|
|
413
413
|
return (...args) => {
|
|
414
414
|
const normalizedArgs = args.slice();
|
|
415
415
|
for (const index of pointerArgIndexes) {
|
|
416
|
-
normalizedArgs[index] = toNodePointerArgument(
|
|
416
|
+
normalizedArgs[index] = toNodePointerArgument(normalizedArgs[index]);
|
|
417
417
|
}
|
|
418
418
|
return fn(...normalizedArgs);
|
|
419
419
|
};
|
|
@@ -421,7 +421,7 @@ function wrapNodeSymbol(fn, definition, nodeFfi) {
|
|
|
421
421
|
function isNodePointerArgumentType(type) {
|
|
422
422
|
return type === FFIType.ptr || type === FFIType.pointer || type === FFIType.function || type === FFIType.callback;
|
|
423
423
|
}
|
|
424
|
-
function toNodePointerArgument(
|
|
424
|
+
function toNodePointerArgument(value) {
|
|
425
425
|
if (value == null) {
|
|
426
426
|
return 0n;
|
|
427
427
|
}
|
|
@@ -429,16 +429,19 @@ function toNodePointerArgument(nodeFfi, value) {
|
|
|
429
429
|
return toBigIntPointer(value);
|
|
430
430
|
}
|
|
431
431
|
if (ArrayBuffer.isView(value)) {
|
|
432
|
+
if (!(value.buffer instanceof ArrayBuffer)) {
|
|
433
|
+
throw new TypeError(NODE_PTR_VALUE);
|
|
434
|
+
}
|
|
432
435
|
if (value.byteLength === 0) {
|
|
433
436
|
return 0n;
|
|
434
437
|
}
|
|
435
|
-
return
|
|
438
|
+
return value;
|
|
436
439
|
}
|
|
437
440
|
if (value instanceof ArrayBuffer) {
|
|
438
441
|
if (value.byteLength === 0) {
|
|
439
442
|
return 0n;
|
|
440
443
|
}
|
|
441
|
-
return
|
|
444
|
+
return value;
|
|
442
445
|
}
|
|
443
446
|
throw new TypeError(NODE_POINTER_ARGUMENT);
|
|
444
447
|
}
|
|
@@ -10818,7 +10821,7 @@ class TextBuffer {
|
|
|
10818
10821
|
}
|
|
10819
10822
|
}
|
|
10820
10823
|
|
|
10821
|
-
// ../../node_modules/.bun/bun-ffi-structs@0.2.
|
|
10824
|
+
// ../../node_modules/.bun/bun-ffi-structs@0.2.4+1fb4c65d43e298b9/node_modules/bun-ffi-structs/dist/index.js
|
|
10822
10825
|
var FFI_LOAD_ERROR = "bun-ffi-structs requires Bun or Node.js with node:ffi enabled (--experimental-ffi --allow-ffi).";
|
|
10823
10826
|
var backend2 = await loadBackend2();
|
|
10824
10827
|
function unavailable2(cause) {
|
|
@@ -11068,6 +11071,20 @@ function defineStruct(fields, structDefOptions) {
|
|
|
11068
11071
|
size = typeSizes[typeOrStruct];
|
|
11069
11072
|
align = typeAlignments[typeOrStruct];
|
|
11070
11073
|
({ pack, unpack } = primitivePackers(typeOrStruct));
|
|
11074
|
+
if (typeOrStruct === "pointer") {
|
|
11075
|
+
pack = (view, off, val) => {
|
|
11076
|
+
if (val instanceof ArrayBuffer || ArrayBuffer.isView(val)) {
|
|
11077
|
+
if (val.byteLength === 0) {
|
|
11078
|
+
pointerPacker(view, off, null);
|
|
11079
|
+
return;
|
|
11080
|
+
}
|
|
11081
|
+
pointerPacker(view, off, ptr2(val));
|
|
11082
|
+
retainPointerTarget(view.buffer, val);
|
|
11083
|
+
return;
|
|
11084
|
+
}
|
|
11085
|
+
pointerPacker(view, off, val);
|
|
11086
|
+
};
|
|
11087
|
+
}
|
|
11071
11088
|
} else if (typeof typeOrStruct === "string" && typeOrStruct === "cstring") {
|
|
11072
11089
|
size = pointerSize;
|
|
11073
11090
|
align = pointerSize;
|
|
@@ -11541,7 +11558,7 @@ function defineStruct(fields, structDefOptions) {
|
|
|
11541
11558
|
}
|
|
11542
11559
|
|
|
11543
11560
|
// src/zig-structs.ts
|
|
11544
|
-
var rgbaPackTransform = (rgba) => rgba
|
|
11561
|
+
var rgbaPackTransform = (rgba) => rgba?.buffer ?? null;
|
|
11545
11562
|
var rgbaUnpackTransform = (ptr3) => ptr3 ? RGBA.fromArray(new Uint16Array(toArrayBuffer(ptr3, 0, 8))) : undefined;
|
|
11546
11563
|
var StyledChunkStruct = defineStruct([
|
|
11547
11564
|
["text", "char*"],
|
|
@@ -11918,6 +11935,22 @@ function getOpenTUILib(libPath) {
|
|
|
11918
11935
|
args: ["u32"],
|
|
11919
11936
|
returns: "void"
|
|
11920
11937
|
},
|
|
11938
|
+
createNativeRenderable: {
|
|
11939
|
+
args: [],
|
|
11940
|
+
returns: "u32"
|
|
11941
|
+
},
|
|
11942
|
+
destroyNativeRenderable: {
|
|
11943
|
+
args: ["u32"],
|
|
11944
|
+
returns: "void"
|
|
11945
|
+
},
|
|
11946
|
+
nativeRenderableAttachYogaNode: {
|
|
11947
|
+
args: ["u32", "ptr"],
|
|
11948
|
+
returns: "bool"
|
|
11949
|
+
},
|
|
11950
|
+
nativeRenderableSetMeasureTarget: {
|
|
11951
|
+
args: ["u32", "u32", "u32"],
|
|
11952
|
+
returns: "bool"
|
|
11953
|
+
},
|
|
11921
11954
|
createRenderer: {
|
|
11922
11955
|
args: ["u32", "u32", "u8", "u8", "ptr"],
|
|
11923
11956
|
returns: "u32"
|
|
@@ -13051,7 +13084,7 @@ function getOpenTUILib(libPath) {
|
|
|
13051
13084
|
returns: "u64"
|
|
13052
13085
|
},
|
|
13053
13086
|
yogaNodeSetMeasureFunc: {
|
|
13054
|
-
args: ["ptr", "
|
|
13087
|
+
args: ["ptr", "bool"],
|
|
13055
13088
|
returns: "void"
|
|
13056
13089
|
},
|
|
13057
13090
|
yogaNodeUnsetMeasureFunc: {
|
|
@@ -13063,7 +13096,7 @@ function getOpenTUILib(libPath) {
|
|
|
13063
13096
|
returns: "bool"
|
|
13064
13097
|
},
|
|
13065
13098
|
yogaNodeSetDirtiedFunc: {
|
|
13066
|
-
args: ["ptr", "
|
|
13099
|
+
args: ["ptr", "bool"],
|
|
13067
13100
|
returns: "void"
|
|
13068
13101
|
},
|
|
13069
13102
|
yogaNodeUnsetDirtiedFunc: {
|
|
@@ -13074,6 +13107,14 @@ function getOpenTUILib(libPath) {
|
|
|
13074
13107
|
args: ["f32", "f32"],
|
|
13075
13108
|
returns: "void"
|
|
13076
13109
|
},
|
|
13110
|
+
yogaSetMeasureCallback: {
|
|
13111
|
+
args: ["ptr"],
|
|
13112
|
+
returns: "void"
|
|
13113
|
+
},
|
|
13114
|
+
yogaSetDirtiedCallback: {
|
|
13115
|
+
args: ["ptr"],
|
|
13116
|
+
returns: "void"
|
|
13117
|
+
},
|
|
13077
13118
|
createAudioEngine: {
|
|
13078
13119
|
args: ["ptr"],
|
|
13079
13120
|
returns: "u32"
|
|
@@ -13364,6 +13405,11 @@ var LogLevel2;
|
|
|
13364
13405
|
LogLevel3[LogLevel3["Info"] = 2] = "Info";
|
|
13365
13406
|
LogLevel3[LogLevel3["Debug"] = 3] = "Debug";
|
|
13366
13407
|
})(LogLevel2 ||= {});
|
|
13408
|
+
var NativeMeasureTargetKind = {
|
|
13409
|
+
None: 0,
|
|
13410
|
+
TextBufferView: 1,
|
|
13411
|
+
EditorView: 2
|
|
13412
|
+
};
|
|
13367
13413
|
|
|
13368
13414
|
class FFIRenderLib {
|
|
13369
13415
|
opentui;
|
|
@@ -13376,6 +13422,21 @@ class FFIRenderLib {
|
|
|
13376
13422
|
_anyEventHandlers = [];
|
|
13377
13423
|
nativeSpanFeedCallbackWrapper = null;
|
|
13378
13424
|
nativeSpanFeedHandlers = new Map;
|
|
13425
|
+
createNativeRenderable() {
|
|
13426
|
+
const handle = this.opentui.symbols.createNativeRenderable();
|
|
13427
|
+
if (!handle)
|
|
13428
|
+
throw new Error("Failed to create native renderable");
|
|
13429
|
+
return handle;
|
|
13430
|
+
}
|
|
13431
|
+
destroyNativeRenderable(handle) {
|
|
13432
|
+
this.opentui.symbols.destroyNativeRenderable(handle);
|
|
13433
|
+
}
|
|
13434
|
+
nativeRenderableAttachYogaNode(handle, node) {
|
|
13435
|
+
return Boolean(this.opentui.symbols.nativeRenderableAttachYogaNode(handle, node));
|
|
13436
|
+
}
|
|
13437
|
+
nativeRenderableSetMeasureTarget(handle, kind, target) {
|
|
13438
|
+
return Boolean(this.opentui.symbols.nativeRenderableSetMeasureTarget(handle, kind, target));
|
|
13439
|
+
}
|
|
13379
13440
|
constructor(libPath) {
|
|
13380
13441
|
this.opentui = getOpenTUILib(libPath);
|
|
13381
13442
|
try {
|
|
@@ -13436,6 +13497,8 @@ class FFIRenderLib {
|
|
|
13436
13497
|
this.opentui.symbols.destroyEventSink(this.eventSinkPtr);
|
|
13437
13498
|
this.eventSinkPtr = null;
|
|
13438
13499
|
}
|
|
13500
|
+
this.yogaSetMeasureCallback(null);
|
|
13501
|
+
this.yogaSetDirtiedCallback(null);
|
|
13439
13502
|
this.setLogCallback(null);
|
|
13440
13503
|
} finally {
|
|
13441
13504
|
try {
|
|
@@ -13746,7 +13809,7 @@ class FFIRenderLib {
|
|
|
13746
13809
|
const blinking = options.blinking != null ? options.blinking ? 1 : 0 : 255;
|
|
13747
13810
|
const cursor = options.cursor != null ? MOUSE_STYLE_TO_ID[options.cursor] : 255;
|
|
13748
13811
|
const buffer = CursorStyleOptionsStruct.pack({ style, blinking, color: options.color, cursor });
|
|
13749
|
-
this.opentui.symbols.setCursorStyleOptions(renderer,
|
|
13812
|
+
this.opentui.symbols.setCursorStyleOptions(renderer, buffer);
|
|
13750
13813
|
}
|
|
13751
13814
|
render(renderer, force) {
|
|
13752
13815
|
return this.opentui.symbols.render(renderer, ffiBool(force));
|
|
@@ -14034,17 +14097,17 @@ class FFIRenderLib {
|
|
|
14034
14097
|
yogaNodeStyleGetValue(node, kind, edgeOrGutter) {
|
|
14035
14098
|
return this.opentui.symbols.yogaNodeStyleGetValue(node, kind, edgeOrGutter);
|
|
14036
14099
|
}
|
|
14037
|
-
yogaNodeSetMeasureFunc(node,
|
|
14038
|
-
this.opentui.symbols.yogaNodeSetMeasureFunc(node,
|
|
14100
|
+
yogaNodeSetMeasureFunc(node, enabled) {
|
|
14101
|
+
this.opentui.symbols.yogaNodeSetMeasureFunc(node, ffiBool(enabled));
|
|
14039
14102
|
}
|
|
14040
14103
|
yogaNodeUnsetMeasureFunc(node) {
|
|
14041
14104
|
this.opentui.symbols.yogaNodeUnsetMeasureFunc(node);
|
|
14042
14105
|
}
|
|
14043
14106
|
yogaNodeHasMeasureFunc(node) {
|
|
14044
|
-
return this.opentui.symbols.yogaNodeHasMeasureFunc(node);
|
|
14107
|
+
return Boolean(this.opentui.symbols.yogaNodeHasMeasureFunc(node));
|
|
14045
14108
|
}
|
|
14046
|
-
yogaNodeSetDirtiedFunc(node,
|
|
14047
|
-
this.opentui.symbols.yogaNodeSetDirtiedFunc(node,
|
|
14109
|
+
yogaNodeSetDirtiedFunc(node, enabled) {
|
|
14110
|
+
this.opentui.symbols.yogaNodeSetDirtiedFunc(node, ffiBool(enabled));
|
|
14048
14111
|
}
|
|
14049
14112
|
yogaNodeUnsetDirtiedFunc(node) {
|
|
14050
14113
|
this.opentui.symbols.yogaNodeUnsetDirtiedFunc(node);
|
|
@@ -14052,6 +14115,12 @@ class FFIRenderLib {
|
|
|
14052
14115
|
yogaStoreMeasureResult(width, height) {
|
|
14053
14116
|
this.opentui.symbols.yogaStoreMeasureResult(width, height);
|
|
14054
14117
|
}
|
|
14118
|
+
yogaSetMeasureCallback(callback) {
|
|
14119
|
+
this.opentui.symbols.yogaSetMeasureCallback(callback);
|
|
14120
|
+
}
|
|
14121
|
+
yogaSetDirtiedCallback(callback) {
|
|
14122
|
+
this.opentui.symbols.yogaSetDirtiedCallback(callback);
|
|
14123
|
+
}
|
|
14055
14124
|
createYogaMeasureCallback(callback) {
|
|
14056
14125
|
return this.opentui.createCallback(callback, {
|
|
14057
14126
|
args: ["ptr", "f32", "u32", "f32", "u32"],
|
|
@@ -14060,7 +14129,7 @@ class FFIRenderLib {
|
|
|
14060
14129
|
}
|
|
14061
14130
|
createYogaDirtiedCallback(callback) {
|
|
14062
14131
|
return this.opentui.createCallback(callback, {
|
|
14063
|
-
args: [],
|
|
14132
|
+
args: ["ptr"],
|
|
14064
14133
|
returns: "void"
|
|
14065
14134
|
});
|
|
14066
14135
|
}
|
|
@@ -14140,7 +14209,7 @@ class FFIRenderLib {
|
|
|
14140
14209
|
return;
|
|
14141
14210
|
}
|
|
14142
14211
|
const chunksBuffer = StyledChunkStruct.packList(chunks);
|
|
14143
|
-
this.opentui.symbols.textBufferSetStyledText(buffer,
|
|
14212
|
+
this.opentui.symbols.textBufferSetStyledText(buffer, chunksBuffer, chunks.length);
|
|
14144
14213
|
}
|
|
14145
14214
|
textBufferGetLineCount(buffer) {
|
|
14146
14215
|
return this.opentui.symbols.textBufferGetLineCount(buffer);
|
|
@@ -15028,7 +15097,7 @@ class FFIRenderLib {
|
|
|
15028
15097
|
return;
|
|
15029
15098
|
}
|
|
15030
15099
|
const chunksBuffer = StyledChunkStruct.packList(nonEmptyChunks);
|
|
15031
|
-
this.opentui.symbols.editorViewSetPlaceholderStyledText(view,
|
|
15100
|
+
this.opentui.symbols.editorViewSetPlaceholderStyledText(view, chunksBuffer, nonEmptyChunks.length);
|
|
15032
15101
|
}
|
|
15033
15102
|
editorViewSetTabIndicator(view, indicator) {
|
|
15034
15103
|
this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
|
|
@@ -15317,11 +15386,52 @@ var YogaEdgeLayoutKind = {
|
|
|
15317
15386
|
};
|
|
15318
15387
|
var UNDEFINED_VALUE = { unit: 0 /* Undefined */, value: NaN };
|
|
15319
15388
|
var nodeRegistry = new Map;
|
|
15389
|
+
var measureRegistry = new Map;
|
|
15390
|
+
var dirtiedRegistry = new Map;
|
|
15391
|
+
var measureCallback = null;
|
|
15392
|
+
var measureCallbackLib = null;
|
|
15393
|
+
var dirtiedCallback = null;
|
|
15394
|
+
var dirtiedCallbackLib = null;
|
|
15320
15395
|
function lib() {
|
|
15321
15396
|
return resolveRenderLib();
|
|
15322
15397
|
}
|
|
15323
|
-
function
|
|
15324
|
-
|
|
15398
|
+
function ensureMeasureCallback() {
|
|
15399
|
+
const renderLib = lib();
|
|
15400
|
+
if (measureCallback?.ptr && measureCallbackLib === renderLib)
|
|
15401
|
+
return;
|
|
15402
|
+
const callback = (node, width, widthMode, height, heightMode) => {
|
|
15403
|
+
const measureFunc = node ? measureRegistry.get(node) : undefined;
|
|
15404
|
+
const result = measureFunc?.(width, widthMode, height, heightMode);
|
|
15405
|
+
renderLib.yogaStoreMeasureResult(result?.width ?? NaN, result?.height ?? NaN);
|
|
15406
|
+
};
|
|
15407
|
+
measureCallback = renderLib.createYogaMeasureCallback(callback);
|
|
15408
|
+
if (!measureCallback.ptr) {
|
|
15409
|
+
measureCallback.close();
|
|
15410
|
+
measureCallback = null;
|
|
15411
|
+
throw new Error("Failed to create Yoga measure callback");
|
|
15412
|
+
}
|
|
15413
|
+
renderLib.yogaSetMeasureCallback(measureCallback.ptr);
|
|
15414
|
+
measureCallbackLib = renderLib;
|
|
15415
|
+
}
|
|
15416
|
+
function ensureDirtiedCallback() {
|
|
15417
|
+
const renderLib = lib();
|
|
15418
|
+
if (dirtiedCallback?.ptr && dirtiedCallbackLib === renderLib)
|
|
15419
|
+
return;
|
|
15420
|
+
const callback = (node) => {
|
|
15421
|
+
if (!node)
|
|
15422
|
+
return;
|
|
15423
|
+
const registration = dirtiedRegistry.get(node);
|
|
15424
|
+
if (registration)
|
|
15425
|
+
registration.callback(registration.node);
|
|
15426
|
+
};
|
|
15427
|
+
dirtiedCallback = renderLib.createYogaDirtiedCallback(callback);
|
|
15428
|
+
if (!dirtiedCallback.ptr) {
|
|
15429
|
+
dirtiedCallback.close();
|
|
15430
|
+
dirtiedCallback = null;
|
|
15431
|
+
throw new Error("Failed to create Yoga dirtied callback");
|
|
15432
|
+
}
|
|
15433
|
+
renderLib.yogaSetDirtiedCallback(dirtiedCallback.ptr);
|
|
15434
|
+
dirtiedCallbackLib = renderLib;
|
|
15325
15435
|
}
|
|
15326
15436
|
function isValueObject(value) {
|
|
15327
15437
|
return typeof value === "object" && value !== null && "unit" in value && "value" in value;
|
|
@@ -15424,11 +15534,9 @@ class Config {
|
|
|
15424
15534
|
class Node {
|
|
15425
15535
|
ptr;
|
|
15426
15536
|
freed = false;
|
|
15427
|
-
measureCallback = null;
|
|
15428
|
-
dirtiedCallback = null;
|
|
15429
15537
|
constructor(ptr3) {
|
|
15430
15538
|
this.ptr = ptr3;
|
|
15431
|
-
nodeRegistry.set(
|
|
15539
|
+
nodeRegistry.set(ptr3, this);
|
|
15432
15540
|
}
|
|
15433
15541
|
static create(config) {
|
|
15434
15542
|
return Node.fromPointer(config ? lib().yogaNodeCreateWithConfig(config.ptr) : lib().yogaNodeCreate());
|
|
@@ -15446,8 +15554,7 @@ class Node {
|
|
|
15446
15554
|
node.free();
|
|
15447
15555
|
}
|
|
15448
15556
|
static fromPointer(ptr3) {
|
|
15449
|
-
const
|
|
15450
|
-
const existing = nodeRegistry.get(key);
|
|
15557
|
+
const existing = nodeRegistry.get(ptr3);
|
|
15451
15558
|
if (existing)
|
|
15452
15559
|
return existing;
|
|
15453
15560
|
return new Node(ptr3);
|
|
@@ -15468,8 +15575,7 @@ class Node {
|
|
|
15468
15575
|
return;
|
|
15469
15576
|
const nodes = this.collectSubtree([]);
|
|
15470
15577
|
for (const node of nodes) {
|
|
15471
|
-
node.
|
|
15472
|
-
node.closeDirtiedCallback();
|
|
15578
|
+
node.unregisterCallbacks();
|
|
15473
15579
|
}
|
|
15474
15580
|
lib().yogaNodeFreeRecursive(this.ptr);
|
|
15475
15581
|
for (const node of nodes) {
|
|
@@ -15823,23 +15929,15 @@ class Node {
|
|
|
15823
15929
|
this.unsetMeasureFunc();
|
|
15824
15930
|
if (!measureFunc)
|
|
15825
15931
|
return;
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
};
|
|
15830
|
-
this.measureCallback = lib().createYogaMeasureCallback(callback);
|
|
15831
|
-
if (!this.measureCallback.ptr) {
|
|
15832
|
-
this.measureCallback.close();
|
|
15833
|
-
this.measureCallback = null;
|
|
15834
|
-
throw new Error("Failed to create Yoga measure callback");
|
|
15835
|
-
}
|
|
15836
|
-
lib().yogaNodeSetMeasureFunc(this.ptr, this.measureCallback.ptr);
|
|
15932
|
+
ensureMeasureCallback();
|
|
15933
|
+
measureRegistry.set(this.ptr, measureFunc);
|
|
15934
|
+
lib().yogaNodeSetMeasureFunc(this.ptr, true);
|
|
15837
15935
|
}
|
|
15838
15936
|
unsetMeasureFunc() {
|
|
15839
15937
|
if (this.freed)
|
|
15840
15938
|
return;
|
|
15841
15939
|
lib().yogaNodeUnsetMeasureFunc(this.ptr);
|
|
15842
|
-
this.
|
|
15940
|
+
measureRegistry.delete(this.ptr);
|
|
15843
15941
|
}
|
|
15844
15942
|
hasMeasureFunc() {
|
|
15845
15943
|
if (this.freed)
|
|
@@ -15852,22 +15950,15 @@ class Node {
|
|
|
15852
15950
|
this.unsetDirtiedFunc();
|
|
15853
15951
|
if (!dirtiedFunc)
|
|
15854
15952
|
return;
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
this.dirtiedCallback = lib().createYogaDirtiedCallback(callback);
|
|
15859
|
-
if (!this.dirtiedCallback.ptr) {
|
|
15860
|
-
this.dirtiedCallback.close();
|
|
15861
|
-
this.dirtiedCallback = null;
|
|
15862
|
-
throw new Error("Failed to create Yoga dirtied callback");
|
|
15863
|
-
}
|
|
15864
|
-
lib().yogaNodeSetDirtiedFunc(this.ptr, this.dirtiedCallback.ptr);
|
|
15953
|
+
ensureDirtiedCallback();
|
|
15954
|
+
dirtiedRegistry.set(this.ptr, { node: this, callback: dirtiedFunc });
|
|
15955
|
+
lib().yogaNodeSetDirtiedFunc(this.ptr, true);
|
|
15865
15956
|
}
|
|
15866
15957
|
unsetDirtiedFunc() {
|
|
15867
15958
|
if (this.freed)
|
|
15868
15959
|
return;
|
|
15869
15960
|
lib().yogaNodeUnsetDirtiedFunc(this.ptr);
|
|
15870
|
-
this.
|
|
15961
|
+
dirtiedRegistry.delete(this.ptr);
|
|
15871
15962
|
}
|
|
15872
15963
|
setEnum(kind, value) {
|
|
15873
15964
|
if (this.freed)
|
|
@@ -15907,21 +15998,14 @@ class Node {
|
|
|
15907
15998
|
nodes.push(this);
|
|
15908
15999
|
return nodes;
|
|
15909
16000
|
}
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
this.measureCallback.close();
|
|
15914
|
-
this.measureCallback = null;
|
|
15915
|
-
}
|
|
15916
|
-
closeDirtiedCallback() {
|
|
15917
|
-
if (!this.dirtiedCallback)
|
|
15918
|
-
return;
|
|
15919
|
-
this.dirtiedCallback.close();
|
|
15920
|
-
this.dirtiedCallback = null;
|
|
16001
|
+
unregisterCallbacks() {
|
|
16002
|
+
measureRegistry.delete(this.ptr);
|
|
16003
|
+
dirtiedRegistry.delete(this.ptr);
|
|
15921
16004
|
}
|
|
15922
16005
|
markFreed() {
|
|
16006
|
+
this.unregisterCallbacks();
|
|
15923
16007
|
this.freed = true;
|
|
15924
|
-
nodeRegistry.delete(
|
|
16008
|
+
nodeRegistry.delete(this.ptr);
|
|
15925
16009
|
}
|
|
15926
16010
|
}
|
|
15927
16011
|
var Yoga = {
|
|
@@ -16020,7 +16104,7 @@ var Yoga = {
|
|
|
16020
16104
|
};
|
|
16021
16105
|
var yoga_default = Yoga;
|
|
16022
16106
|
|
|
16023
|
-
export { toArrayBuffer, sleep, stringWidth2 as stringWidth, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, 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, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, singleton, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, destroyTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, ClipboardTarget, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel as LogLevel1, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, ALIGN_AUTO, ALIGN_FLEX_START, ALIGN_CENTER, ALIGN_FLEX_END, ALIGN_STRETCH, ALIGN_BASELINE, ALIGN_SPACE_BETWEEN, ALIGN_SPACE_AROUND, ALIGN_SPACE_EVENLY, BOX_SIZING_BORDER_BOX, BOX_SIZING_CONTENT_BOX, DIMENSION_WIDTH, DIMENSION_HEIGHT, DIRECTION_INHERIT, DIRECTION_LTR, DIRECTION_RTL, DISPLAY_FLEX, DISPLAY_NONE, DISPLAY_CONTENTS, EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM, EDGE_START, EDGE_END, EDGE_HORIZONTAL, EDGE_VERTICAL, EDGE_ALL, ERRATA_NONE, ERRATA_STRETCH_FLEX_BASIS, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE, ERRATA_ALL, ERRATA_CLASSIC, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS, FLEX_DIRECTION_COLUMN, FLEX_DIRECTION_COLUMN_REVERSE, FLEX_DIRECTION_ROW, FLEX_DIRECTION_ROW_REVERSE, GUTTER_COLUMN, GUTTER_ROW, GUTTER_ALL, JUSTIFY_FLEX_START, JUSTIFY_CENTER, JUSTIFY_FLEX_END, JUSTIFY_SPACE_BETWEEN, JUSTIFY_SPACE_AROUND, JUSTIFY_SPACE_EVENLY, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_FATAL, MEASURE_MODE_UNDEFINED, MEASURE_MODE_EXACTLY, MEASURE_MODE_AT_MOST, NODE_TYPE_DEFAULT, NODE_TYPE_TEXT, OVERFLOW_VISIBLE, OVERFLOW_HIDDEN, OVERFLOW_SCROLL, POSITION_TYPE_STATIC, POSITION_TYPE_RELATIVE, POSITION_TYPE_ABSOLUTE, UNIT_UNDEFINED, UNIT_POINT, UNIT_PERCENT, UNIT_AUTO, WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE, Config, Node, exports_yoga, yoga_default };
|
|
16107
|
+
export { toArrayBuffer, sleep, stringWidth2 as stringWidth, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, 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, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, singleton, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, destroyTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, ClipboardTarget, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, NativeMeasureTargetKind, setRenderLibPath, resolveRenderLib, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel as LogLevel1, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, ALIGN_AUTO, ALIGN_FLEX_START, ALIGN_CENTER, ALIGN_FLEX_END, ALIGN_STRETCH, ALIGN_BASELINE, ALIGN_SPACE_BETWEEN, ALIGN_SPACE_AROUND, ALIGN_SPACE_EVENLY, BOX_SIZING_BORDER_BOX, BOX_SIZING_CONTENT_BOX, DIMENSION_WIDTH, DIMENSION_HEIGHT, DIRECTION_INHERIT, DIRECTION_LTR, DIRECTION_RTL, DISPLAY_FLEX, DISPLAY_NONE, DISPLAY_CONTENTS, EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM, EDGE_START, EDGE_END, EDGE_HORIZONTAL, EDGE_VERTICAL, EDGE_ALL, ERRATA_NONE, ERRATA_STRETCH_FLEX_BASIS, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE, ERRATA_ALL, ERRATA_CLASSIC, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS, FLEX_DIRECTION_COLUMN, FLEX_DIRECTION_COLUMN_REVERSE, FLEX_DIRECTION_ROW, FLEX_DIRECTION_ROW_REVERSE, GUTTER_COLUMN, GUTTER_ROW, GUTTER_ALL, JUSTIFY_FLEX_START, JUSTIFY_CENTER, JUSTIFY_FLEX_END, JUSTIFY_SPACE_BETWEEN, JUSTIFY_SPACE_AROUND, JUSTIFY_SPACE_EVENLY, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_FATAL, MEASURE_MODE_UNDEFINED, MEASURE_MODE_EXACTLY, MEASURE_MODE_AT_MOST, NODE_TYPE_DEFAULT, NODE_TYPE_TEXT, OVERFLOW_VISIBLE, OVERFLOW_HIDDEN, OVERFLOW_SCROLL, POSITION_TYPE_STATIC, POSITION_TYPE_RELATIVE, POSITION_TYPE_ABSOLUTE, UNIT_UNDEFINED, UNIT_POINT, UNIT_PERCENT, UNIT_AUTO, WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE, Config, Node, exports_yoga, yoga_default };
|
|
16024
16108
|
|
|
16025
|
-
//# debugId=
|
|
16026
|
-
//# sourceMappingURL=index-
|
|
16109
|
+
//# debugId=FC7AC9CF38562F8A64756E2164756E21
|
|
16110
|
+
//# sourceMappingURL=index-d5xqskty.js.map
|