@opentui/core 0.2.16 → 0.3.0
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/NativeSpanFeed.d.ts +6 -0
- package/{index-qfwqv8y3.js → index-081xws23.js} +620 -135
- package/{index-qfwqv8y3.js.map → index-081xws23.js.map} +8 -7
- package/{index-t1vzaxv4.js → index-dhbwkghw.js} +2 -2
- package/{index-qe67qr6s.js → index-qwem5zxy.js} +3 -3
- package/{index-hzcw4q21.js → index-sq86yyfz.js} +5 -255
- package/{index-hzcw4q21.js.map → index-sq86yyfz.js.map} +3 -4
- package/index.js +4 -4
- package/index.js.map +1 -1
- package/package.json +7 -7
- package/renderer.d.ts +51 -4
- package/runtime-plugin-support-configure.js +4 -4
- package/runtime-plugin-support.js +4 -4
- package/runtime-plugin.js +3 -3
- package/testing/test-renderer.d.ts +2 -3
- package/testing/test-streams.d.ts +12 -0
- package/testing.js +40 -48
- package/testing.js.map +6 -5
- package/types.d.ts +3 -1
- package/zig-structs.d.ts +7 -1
- package/zig.d.ts +15 -8
- /package/{index-t1vzaxv4.js.map → index-dhbwkghw.js.map} +0 -0
- /package/{index-qe67qr6s.js.map → index-qwem5zxy.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createRuntimePlugin
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-qwem5zxy.js";
|
|
5
5
|
|
|
6
6
|
// src/runtime-plugin-support-configure.ts
|
|
7
7
|
var {plugin: registerBunPlugin } = globalThis.Bun;
|
|
@@ -41,4 +41,4 @@ function ensureRuntimePluginSupport(options = {}) {
|
|
|
41
41
|
export { ensureRuntimePluginSupport };
|
|
42
42
|
|
|
43
43
|
//# debugId=09C0597CB92E654F64756E2164756E21
|
|
44
|
-
//# sourceMappingURL=index-
|
|
44
|
+
//# sourceMappingURL=index-dhbwkghw.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
exports_src
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-sq86yyfz.js";
|
|
5
5
|
import {
|
|
6
6
|
__require
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-081xws23.js";
|
|
8
8
|
|
|
9
9
|
// src/runtime-plugin.ts
|
|
10
10
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
@@ -418,4 +418,4 @@ function createRuntimePlugin(input = {}) {
|
|
|
418
418
|
export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin };
|
|
419
419
|
|
|
420
420
|
//# debugId=4F4ECA92927B118964756E2164756E21
|
|
421
|
-
//# sourceMappingURL=index-
|
|
421
|
+
//# sourceMappingURL=index-qwem5zxy.js.map
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
MouseButton,
|
|
32
32
|
MouseEvent,
|
|
33
33
|
MouseParser,
|
|
34
|
+
NativeSpanFeed,
|
|
34
35
|
OptimizedBuffer,
|
|
35
36
|
PasteEvent,
|
|
36
37
|
RGBA,
|
|
@@ -40,7 +41,6 @@ import {
|
|
|
40
41
|
RootRenderable,
|
|
41
42
|
RootTextNodeRenderable,
|
|
42
43
|
Selection,
|
|
43
|
-
SpanInfoStruct,
|
|
44
44
|
StdinParser,
|
|
45
45
|
StyledText,
|
|
46
46
|
SyntaxStyle,
|
|
@@ -175,7 +175,6 @@ import {
|
|
|
175
175
|
stripAnsiSequences,
|
|
176
176
|
t,
|
|
177
177
|
terminalNamedSingleStrokeKeys,
|
|
178
|
-
toArrayBuffer,
|
|
179
178
|
treeSitterToStyledText,
|
|
180
179
|
treeSitterToTextChunks,
|
|
181
180
|
underline,
|
|
@@ -183,7 +182,7 @@ import {
|
|
|
183
182
|
white,
|
|
184
183
|
wrapWithDelegates,
|
|
185
184
|
yellow
|
|
186
|
-
} from "./index-
|
|
185
|
+
} from "./index-081xws23.js";
|
|
187
186
|
|
|
188
187
|
// src/index.ts
|
|
189
188
|
var exports_src2 = {};
|
|
@@ -2771,255 +2770,6 @@ class SlotRenderable extends Renderable {
|
|
|
2771
2770
|
this._mountedNodes = [...desiredNodes];
|
|
2772
2771
|
}
|
|
2773
2772
|
}
|
|
2774
|
-
// src/NativeSpanFeed.ts
|
|
2775
|
-
function toNumber(value) {
|
|
2776
|
-
return typeof value === "bigint" ? Number(value) : value;
|
|
2777
|
-
}
|
|
2778
|
-
|
|
2779
|
-
class NativeSpanFeed {
|
|
2780
|
-
static create(options) {
|
|
2781
|
-
const lib = resolveRenderLib();
|
|
2782
|
-
const streamPtr = lib.createNativeSpanFeed(options);
|
|
2783
|
-
const stream = new NativeSpanFeed(streamPtr);
|
|
2784
|
-
lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
|
|
2785
|
-
const status = lib.attachNativeSpanFeed(streamPtr);
|
|
2786
|
-
if (status !== 0) {
|
|
2787
|
-
lib.unregisterNativeSpanFeedStream(streamPtr);
|
|
2788
|
-
lib.destroyNativeSpanFeed(streamPtr);
|
|
2789
|
-
throw new Error(`Failed to attach stream: ${status}`);
|
|
2790
|
-
}
|
|
2791
|
-
return stream;
|
|
2792
|
-
}
|
|
2793
|
-
static attach(streamPtr, _options) {
|
|
2794
|
-
const lib = resolveRenderLib();
|
|
2795
|
-
const stream = new NativeSpanFeed(streamPtr);
|
|
2796
|
-
lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
|
|
2797
|
-
const status = lib.attachNativeSpanFeed(streamPtr);
|
|
2798
|
-
if (status !== 0) {
|
|
2799
|
-
lib.unregisterNativeSpanFeedStream(streamPtr);
|
|
2800
|
-
throw new Error(`Failed to attach stream: ${status}`);
|
|
2801
|
-
}
|
|
2802
|
-
return stream;
|
|
2803
|
-
}
|
|
2804
|
-
streamPtr;
|
|
2805
|
-
lib = resolveRenderLib();
|
|
2806
|
-
eventHandler;
|
|
2807
|
-
chunkMap = new Map;
|
|
2808
|
-
chunkSizes = new Map;
|
|
2809
|
-
dataHandlers = new Set;
|
|
2810
|
-
errorHandlers = new Set;
|
|
2811
|
-
drainBuffer = null;
|
|
2812
|
-
stateBuffer = null;
|
|
2813
|
-
closed = false;
|
|
2814
|
-
destroyed = false;
|
|
2815
|
-
draining = false;
|
|
2816
|
-
pendingDataAvailable = false;
|
|
2817
|
-
pendingClose = false;
|
|
2818
|
-
closing = false;
|
|
2819
|
-
pendingAsyncHandlers = 0;
|
|
2820
|
-
inCallback = false;
|
|
2821
|
-
closeQueued = false;
|
|
2822
|
-
constructor(streamPtr) {
|
|
2823
|
-
this.streamPtr = streamPtr;
|
|
2824
|
-
this.eventHandler = (eventId, arg0, arg1) => {
|
|
2825
|
-
this.handleEvent(eventId, arg0, arg1);
|
|
2826
|
-
};
|
|
2827
|
-
this.ensureDrainBuffer();
|
|
2828
|
-
}
|
|
2829
|
-
ensureDrainBuffer() {
|
|
2830
|
-
if (this.drainBuffer)
|
|
2831
|
-
return;
|
|
2832
|
-
const capacity = 256;
|
|
2833
|
-
this.drainBuffer = new Uint8Array(capacity * SpanInfoStruct.size);
|
|
2834
|
-
}
|
|
2835
|
-
onData(handler) {
|
|
2836
|
-
this.dataHandlers.add(handler);
|
|
2837
|
-
if (this.pendingDataAvailable) {
|
|
2838
|
-
this.pendingDataAvailable = false;
|
|
2839
|
-
this.drainAll();
|
|
2840
|
-
}
|
|
2841
|
-
return () => this.dataHandlers.delete(handler);
|
|
2842
|
-
}
|
|
2843
|
-
onError(handler) {
|
|
2844
|
-
this.errorHandlers.add(handler);
|
|
2845
|
-
return () => this.errorHandlers.delete(handler);
|
|
2846
|
-
}
|
|
2847
|
-
close() {
|
|
2848
|
-
if (this.destroyed)
|
|
2849
|
-
return;
|
|
2850
|
-
if (this.inCallback || this.draining || this.pendingAsyncHandlers > 0) {
|
|
2851
|
-
this.pendingClose = true;
|
|
2852
|
-
if (!this.closeQueued) {
|
|
2853
|
-
this.closeQueued = true;
|
|
2854
|
-
queueMicrotask(() => {
|
|
2855
|
-
this.closeQueued = false;
|
|
2856
|
-
this.processPendingClose();
|
|
2857
|
-
});
|
|
2858
|
-
}
|
|
2859
|
-
return;
|
|
2860
|
-
}
|
|
2861
|
-
this.performClose();
|
|
2862
|
-
}
|
|
2863
|
-
processPendingClose() {
|
|
2864
|
-
if (!this.pendingClose || this.destroyed)
|
|
2865
|
-
return;
|
|
2866
|
-
if (this.inCallback || this.draining || this.pendingAsyncHandlers > 0)
|
|
2867
|
-
return;
|
|
2868
|
-
this.pendingClose = false;
|
|
2869
|
-
this.performClose();
|
|
2870
|
-
}
|
|
2871
|
-
performClose() {
|
|
2872
|
-
if (this.closing)
|
|
2873
|
-
return;
|
|
2874
|
-
this.closing = true;
|
|
2875
|
-
if (!this.closed) {
|
|
2876
|
-
const status = this.lib.streamClose(this.streamPtr);
|
|
2877
|
-
if (status !== 0) {
|
|
2878
|
-
this.closing = false;
|
|
2879
|
-
return;
|
|
2880
|
-
}
|
|
2881
|
-
this.closed = true;
|
|
2882
|
-
}
|
|
2883
|
-
this.finalizeDestroy();
|
|
2884
|
-
}
|
|
2885
|
-
finalizeDestroy() {
|
|
2886
|
-
if (this.destroyed)
|
|
2887
|
-
return;
|
|
2888
|
-
this.lib.unregisterNativeSpanFeedStream(this.streamPtr);
|
|
2889
|
-
this.lib.destroyNativeSpanFeed(this.streamPtr);
|
|
2890
|
-
this.destroyed = true;
|
|
2891
|
-
this.chunkMap.clear();
|
|
2892
|
-
this.chunkSizes.clear();
|
|
2893
|
-
this.stateBuffer = null;
|
|
2894
|
-
this.drainBuffer = null;
|
|
2895
|
-
this.dataHandlers.clear();
|
|
2896
|
-
this.errorHandlers.clear();
|
|
2897
|
-
this.pendingDataAvailable = false;
|
|
2898
|
-
}
|
|
2899
|
-
handleEvent(eventId, arg0, arg1) {
|
|
2900
|
-
this.inCallback = true;
|
|
2901
|
-
try {
|
|
2902
|
-
switch (eventId) {
|
|
2903
|
-
case 8 /* StateBuffer */: {
|
|
2904
|
-
const len = toNumber(arg1);
|
|
2905
|
-
if (len > 0 && arg0) {
|
|
2906
|
-
const buffer = toArrayBuffer(arg0, 0, len);
|
|
2907
|
-
this.stateBuffer = new Uint8Array(buffer);
|
|
2908
|
-
}
|
|
2909
|
-
break;
|
|
2910
|
-
}
|
|
2911
|
-
case 7 /* DataAvailable */: {
|
|
2912
|
-
if (this.closing)
|
|
2913
|
-
break;
|
|
2914
|
-
if (this.dataHandlers.size === 0) {
|
|
2915
|
-
this.pendingDataAvailable = true;
|
|
2916
|
-
break;
|
|
2917
|
-
}
|
|
2918
|
-
this.drainAll();
|
|
2919
|
-
break;
|
|
2920
|
-
}
|
|
2921
|
-
case 2 /* ChunkAdded */: {
|
|
2922
|
-
const chunkLen = toNumber(arg1);
|
|
2923
|
-
if (chunkLen > 0 && arg0) {
|
|
2924
|
-
if (!this.chunkMap.has(arg0)) {
|
|
2925
|
-
const buffer = toArrayBuffer(arg0, 0, chunkLen);
|
|
2926
|
-
this.chunkMap.set(arg0, buffer);
|
|
2927
|
-
}
|
|
2928
|
-
this.chunkSizes.set(arg0, chunkLen);
|
|
2929
|
-
}
|
|
2930
|
-
break;
|
|
2931
|
-
}
|
|
2932
|
-
case 6 /* Error */: {
|
|
2933
|
-
const code = toNumber(arg0);
|
|
2934
|
-
for (const handler of this.errorHandlers)
|
|
2935
|
-
handler(code);
|
|
2936
|
-
break;
|
|
2937
|
-
}
|
|
2938
|
-
case 5 /* Closed */: {
|
|
2939
|
-
this.closed = true;
|
|
2940
|
-
break;
|
|
2941
|
-
}
|
|
2942
|
-
default:
|
|
2943
|
-
break;
|
|
2944
|
-
}
|
|
2945
|
-
} finally {
|
|
2946
|
-
this.inCallback = false;
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
decrementRefcount(chunkIndex) {
|
|
2950
|
-
if (this.stateBuffer && chunkIndex < this.stateBuffer.length) {
|
|
2951
|
-
const prev = this.stateBuffer[chunkIndex];
|
|
2952
|
-
this.stateBuffer[chunkIndex] = prev > 0 ? prev - 1 : 0;
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
drainOnce() {
|
|
2956
|
-
if (!this.drainBuffer || this.draining || this.pendingClose)
|
|
2957
|
-
return 0;
|
|
2958
|
-
const capacity = Math.floor(this.drainBuffer.byteLength / SpanInfoStruct.size);
|
|
2959
|
-
if (capacity === 0)
|
|
2960
|
-
return 0;
|
|
2961
|
-
const count = this.lib.streamDrainSpans(this.streamPtr, this.drainBuffer, capacity);
|
|
2962
|
-
if (count === 0)
|
|
2963
|
-
return 0;
|
|
2964
|
-
this.draining = true;
|
|
2965
|
-
const spans = SpanInfoStruct.unpackList(this.drainBuffer.buffer, count);
|
|
2966
|
-
let firstError = null;
|
|
2967
|
-
try {
|
|
2968
|
-
for (const span of spans) {
|
|
2969
|
-
if (span.len === 0)
|
|
2970
|
-
continue;
|
|
2971
|
-
let buffer = this.chunkMap.get(span.chunkPtr);
|
|
2972
|
-
if (!buffer) {
|
|
2973
|
-
const size = this.chunkSizes.get(span.chunkPtr);
|
|
2974
|
-
if (!size)
|
|
2975
|
-
continue;
|
|
2976
|
-
buffer = toArrayBuffer(span.chunkPtr, 0, size);
|
|
2977
|
-
this.chunkMap.set(span.chunkPtr, buffer);
|
|
2978
|
-
}
|
|
2979
|
-
if (span.offset + span.len > buffer.byteLength)
|
|
2980
|
-
continue;
|
|
2981
|
-
const slice = new Uint8Array(buffer, span.offset, span.len);
|
|
2982
|
-
let asyncResults = null;
|
|
2983
|
-
for (const handler of this.dataHandlers) {
|
|
2984
|
-
try {
|
|
2985
|
-
const result = handler(slice);
|
|
2986
|
-
if (result && typeof result.then === "function") {
|
|
2987
|
-
asyncResults ??= [];
|
|
2988
|
-
asyncResults.push(result);
|
|
2989
|
-
}
|
|
2990
|
-
} catch (e) {
|
|
2991
|
-
firstError ??= e;
|
|
2992
|
-
}
|
|
2993
|
-
}
|
|
2994
|
-
const shouldStopAfterThisSpan = this.pendingClose;
|
|
2995
|
-
if (asyncResults) {
|
|
2996
|
-
const chunkIndex = span.chunkIndex;
|
|
2997
|
-
this.pendingAsyncHandlers += 1;
|
|
2998
|
-
Promise.allSettled(asyncResults).then(() => {
|
|
2999
|
-
this.decrementRefcount(chunkIndex);
|
|
3000
|
-
this.pendingAsyncHandlers -= 1;
|
|
3001
|
-
this.processPendingClose();
|
|
3002
|
-
});
|
|
3003
|
-
} else {
|
|
3004
|
-
this.decrementRefcount(span.chunkIndex);
|
|
3005
|
-
}
|
|
3006
|
-
if (shouldStopAfterThisSpan)
|
|
3007
|
-
break;
|
|
3008
|
-
}
|
|
3009
|
-
} finally {
|
|
3010
|
-
this.draining = false;
|
|
3011
|
-
}
|
|
3012
|
-
if (firstError)
|
|
3013
|
-
throw firstError;
|
|
3014
|
-
return count;
|
|
3015
|
-
}
|
|
3016
|
-
drainAll() {
|
|
3017
|
-
let count = this.drainOnce();
|
|
3018
|
-
while (count > 0) {
|
|
3019
|
-
count = this.drainOnce();
|
|
3020
|
-
}
|
|
3021
|
-
}
|
|
3022
|
-
}
|
|
3023
2773
|
// src/audio.ts
|
|
3024
2774
|
import { EventEmitter } from "events";
|
|
3025
2775
|
import { readFile } from "fs/promises";
|
|
@@ -11783,7 +11533,7 @@ class TimeToFirstDrawRenderable extends Renderable {
|
|
|
11783
11533
|
return Math.max(0, Math.floor(value));
|
|
11784
11534
|
}
|
|
11785
11535
|
}
|
|
11786
|
-
export { DistortionEffect, VignetteEffect, CloudsEffect, FlamesEffect, CRTRollingBarEffect, RainbowTextEffect, applyScanlines, applyInvert, applyNoise, applyChromaticAberration, applyAsciiArt, applyBrightness, applyGain, applySaturation, BloomEffect, SEPIA_MATRIX, PROTANOPIA_SIM_MATRIX, DEUTERANOPIA_SIM_MATRIX, TRITANOPIA_SIM_MATRIX, ACHROMATOPSIA_MATRIX, PROTANOPIA_COMP_MATRIX, DEUTERANOPIA_COMP_MATRIX, TRITANOPIA_COMP_MATRIX, TECHNICOLOR_MATRIX, SOLARIZATION_MATRIX, SYNTHWAVE_MATRIX, GREENSCALE_MATRIX, GRAYSCALE_MATRIX, INVERT_MATRIX, Timeline, engine, createTimeline, SlotRegistry, createSlotRegistry, createCoreSlotRegistry, registerCorePlugin, resolveCoreSlot, SlotRenderable,
|
|
11536
|
+
export { DistortionEffect, VignetteEffect, CloudsEffect, FlamesEffect, CRTRollingBarEffect, RainbowTextEffect, applyScanlines, applyInvert, applyNoise, applyChromaticAberration, applyAsciiArt, applyBrightness, applyGain, applySaturation, BloomEffect, SEPIA_MATRIX, PROTANOPIA_SIM_MATRIX, DEUTERANOPIA_SIM_MATRIX, TRITANOPIA_SIM_MATRIX, ACHROMATOPSIA_MATRIX, PROTANOPIA_COMP_MATRIX, DEUTERANOPIA_COMP_MATRIX, TRITANOPIA_COMP_MATRIX, TECHNICOLOR_MATRIX, SOLARIZATION_MATRIX, SYNTHWAVE_MATRIX, GREENSCALE_MATRIX, GRAYSCALE_MATRIX, INVERT_MATRIX, Timeline, engine, createTimeline, SlotRegistry, createSlotRegistry, createCoreSlotRegistry, registerCorePlugin, resolveCoreSlot, SlotRenderable, Audio, setupAudio, FrameBufferRenderable, ASCIIFontRenderable, Generic, Box, Text, ASCIIFont, Input, Select, TabSelect, FrameBuffer, Code, ScrollBox, vstyles, VRenderable, LineNumberRenderable, DiffRenderable, defaultTextareaKeyBindings, TextareaRenderable, InputRenderableEvents, InputRenderable, TextTableRenderable, MarkdownRenderable, SliderRenderable, ScrollBarRenderable, ArrowRenderable, ScrollBoxRenderable, SelectRenderableEvents, SelectRenderable, TabSelectRenderableEvents, TabSelectRenderable, TimeToFirstDrawRenderable, exports_src2 as exports_src };
|
|
11787
11537
|
|
|
11788
|
-
//# debugId=
|
|
11789
|
-
//# sourceMappingURL=index-
|
|
11538
|
+
//# debugId=FF9419E6A578C71164756E2164756E21
|
|
11539
|
+
//# sourceMappingURL=index-sq86yyfz.js.map
|