@opentui/core 0.5.1 → 0.5.2
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/{chunk-bun-83ry0rzt.js → chunk-bun-26r5c5w5.js} +833 -3
- package/{chunk-bun-83ry0rzt.js.map → chunk-bun-26r5c5w5.js.map} +8 -6
- package/{chunk-bun-8fkgaxc6.js → chunk-bun-t68f2fmr.js} +98 -26
- package/{chunk-bun-8fkgaxc6.js.map → chunk-bun-t68f2fmr.js.map} +4 -4
- package/{chunk-node-m23dbcww.js → chunk-node-aj3n20gq.js} +833 -3
- package/{chunk-node-m23dbcww.js.map → chunk-node-aj3n20gq.js.map} +8 -6
- package/{chunk-node-0yw3x5m7.js → chunk-node-kq7as74d.js} +98 -26
- package/{chunk-node-0yw3x5m7.js.map → chunk-node-kq7as74d.js.map} +4 -4
- package/image.d.ts +2 -0
- package/index.bun.js +49 -6
- package/index.bun.js.map +4 -4
- package/index.node.js +49 -6
- package/index.node.js.map +4 -4
- package/lib/clipboard.d.ts +119 -0
- package/lib/host-clipboard.internal.d.ts +22 -0
- package/lib/host-clipboard.native.d.ts +2 -0
- package/lib/tree-sitter/types.d.ts +1 -0
- package/package.json +9 -9
- package/parser.worker.js +6 -4
- package/parser.worker.js.map +3 -3
- package/renderables/Code.d.ts +7 -0
- package/renderables/Image.d.ts +5 -3
- package/renderer.d.ts +5 -2
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +93 -0
package/image.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export declare class NativeImage {
|
|
|
88
88
|
get width(): number;
|
|
89
89
|
get height(): number;
|
|
90
90
|
clone(): NativeImage;
|
|
91
|
+
retain(): NativeImage;
|
|
91
92
|
resize(options: ResizeOptions): NativeImage;
|
|
92
93
|
extract(options: ExtractOptions): NativeImage;
|
|
93
94
|
extend(options?: ExtendOptions): NativeImage;
|
|
@@ -95,6 +96,7 @@ export declare class NativeImage {
|
|
|
95
96
|
flip(): NativeImage;
|
|
96
97
|
flop(): NativeImage;
|
|
97
98
|
composite(overlay: NativeImage, options?: CompositeOptions): NativeImage;
|
|
99
|
+
ensureEncodedPng(): void;
|
|
98
100
|
raw(format?: PixelFormat): RawImage;
|
|
99
101
|
takeRaw(): OwnedRawImage;
|
|
100
102
|
copyTo(destination: Uint8Array, options?: {
|
package/index.bun.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
mergeKeyAliases,
|
|
45
45
|
mergeKeyBindings,
|
|
46
46
|
wrapWithDelegates
|
|
47
|
-
} from "./chunk-bun-
|
|
47
|
+
} from "./chunk-bun-t68f2fmr.js";
|
|
48
48
|
import {
|
|
49
49
|
ASCIIFontSelectionHelper,
|
|
50
50
|
ATTRIBUTE_BASE_BITS,
|
|
@@ -72,6 +72,12 @@ import {
|
|
|
72
72
|
NativeAudioStreamState,
|
|
73
73
|
NativeAudioStreamState1 as NativeAudioStreamState2,
|
|
74
74
|
NativeAudioStreamStateNames,
|
|
75
|
+
NativeClipboardCancelStatus,
|
|
76
|
+
NativeClipboardCopyStatus,
|
|
77
|
+
NativeClipboardDestroyStatus,
|
|
78
|
+
NativeClipboardOperationStatus,
|
|
79
|
+
NativeClipboardShutdownStatus,
|
|
80
|
+
NativeClipboardStartStatus,
|
|
75
81
|
NativeMeasureTargetKind,
|
|
76
82
|
OptimizedBuffer,
|
|
77
83
|
PasteEvent,
|
|
@@ -115,7 +121,10 @@ import {
|
|
|
115
121
|
clearEnvCache,
|
|
116
122
|
convertGlobalToLocalSelection,
|
|
117
123
|
coordinateToCharacterIndex,
|
|
124
|
+
createClipboard,
|
|
118
125
|
createExtmarksController,
|
|
126
|
+
createHostClipboard,
|
|
127
|
+
createRendererClipboardAdapter,
|
|
119
128
|
createTerminalPalette,
|
|
120
129
|
createTextAttributes,
|
|
121
130
|
cyan,
|
|
@@ -195,7 +204,7 @@ import {
|
|
|
195
204
|
visualizeRenderableTree,
|
|
196
205
|
white,
|
|
197
206
|
yellow
|
|
198
|
-
} from "./chunk-bun-
|
|
207
|
+
} from "./chunk-bun-26r5c5w5.js";
|
|
199
208
|
// src/post/effects.ts
|
|
200
209
|
function toU8(value) {
|
|
201
210
|
return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
|
|
@@ -5985,6 +5994,9 @@ class NativeImage {
|
|
|
5985
5994
|
clone() {
|
|
5986
5995
|
return this.wrap(this.lib.imageClone(this.guard()));
|
|
5987
5996
|
}
|
|
5997
|
+
retain() {
|
|
5998
|
+
return this.wrap(this.lib.imageRetain(this.guard()));
|
|
5999
|
+
}
|
|
5988
6000
|
resize(options) {
|
|
5989
6001
|
if (!options || options.width === undefined && options.height === undefined) {
|
|
5990
6002
|
throw new TypeError("resize requires width, height, or both");
|
|
@@ -6034,6 +6046,9 @@ class NativeImage {
|
|
|
6034
6046
|
throw new RangeError("opacity must be between 0 and 1");
|
|
6035
6047
|
return this.wrap(this.lib.imageComposite(this.guard(), overlay.guard(), requireI32(options.left ?? 0, "left"), requireI32(options.top ?? 0, "top"), requireMappedOption(BLEND_IDS, options.blend ?? "source-over", "blend mode"), Math.round(opacity * 255)));
|
|
6036
6048
|
}
|
|
6049
|
+
ensureEncodedPng() {
|
|
6050
|
+
checkStatus(this.lib.imageEnsureEncodedPng(this.guard()));
|
|
6051
|
+
}
|
|
6037
6052
|
raw(format = "rgba8") {
|
|
6038
6053
|
const stride = this.width * 4;
|
|
6039
6054
|
const data = new Uint8Array(stride * this.height);
|
|
@@ -8726,6 +8741,7 @@ function pixelResolution(ctx) {
|
|
|
8726
8741
|
class ImageRenderable extends Renderable {
|
|
8727
8742
|
_source;
|
|
8728
8743
|
_image = null;
|
|
8744
|
+
_pendingImage = null;
|
|
8729
8745
|
_loadError = null;
|
|
8730
8746
|
_loadController = null;
|
|
8731
8747
|
onLoad;
|
|
@@ -8752,6 +8768,8 @@ class ImageRenderable extends Renderable {
|
|
|
8752
8768
|
this._source = source;
|
|
8753
8769
|
this._loadController?.abort();
|
|
8754
8770
|
this._loadController = null;
|
|
8771
|
+
this._pendingImage?.dispose();
|
|
8772
|
+
this._pendingImage = null;
|
|
8755
8773
|
if (source === undefined) {
|
|
8756
8774
|
this._loadError = null;
|
|
8757
8775
|
this._image?.dispose();
|
|
@@ -8763,7 +8781,19 @@ class ImageRenderable extends Renderable {
|
|
|
8763
8781
|
const controller = new AbortController;
|
|
8764
8782
|
this._loadController = controller;
|
|
8765
8783
|
this._loadError = null;
|
|
8766
|
-
|
|
8784
|
+
let imagePromise;
|
|
8785
|
+
if (source instanceof NativeImage) {
|
|
8786
|
+
try {
|
|
8787
|
+
const image = source.retain();
|
|
8788
|
+
this._pendingImage = image;
|
|
8789
|
+
imagePromise = Promise.resolve(image);
|
|
8790
|
+
} catch (error) {
|
|
8791
|
+
imagePromise = Promise.reject(error);
|
|
8792
|
+
}
|
|
8793
|
+
} else {
|
|
8794
|
+
imagePromise = NativeImage.load(source, { signal: controller.signal });
|
|
8795
|
+
}
|
|
8796
|
+
this.loadPromise = this.load(imagePromise, controller);
|
|
8767
8797
|
}
|
|
8768
8798
|
get image() {
|
|
8769
8799
|
return this._image;
|
|
@@ -8852,10 +8882,10 @@ class ImageRenderable extends Renderable {
|
|
|
8852
8882
|
}
|
|
8853
8883
|
buffer.drawImage(this._image, x, y, fitted.width, fitted.height, pixelWidth, pixelHeight, sourceX, sourceY, sourceWidth, sourceHeight, this._protocol);
|
|
8854
8884
|
}
|
|
8855
|
-
async load(
|
|
8885
|
+
async load(imagePromise, controller) {
|
|
8856
8886
|
let image;
|
|
8857
8887
|
try {
|
|
8858
|
-
image = await
|
|
8888
|
+
image = await imagePromise;
|
|
8859
8889
|
} catch (error) {
|
|
8860
8890
|
if (controller.signal.aborted || this.isDestroyed || this._loadController !== controller)
|
|
8861
8891
|
return;
|
|
@@ -8868,6 +8898,8 @@ class ImageRenderable extends Renderable {
|
|
|
8868
8898
|
image.dispose();
|
|
8869
8899
|
return;
|
|
8870
8900
|
}
|
|
8901
|
+
if (this._pendingImage === image)
|
|
8902
|
+
this._pendingImage = null;
|
|
8871
8903
|
const previous = this._image;
|
|
8872
8904
|
this._image = image;
|
|
8873
8905
|
this._loadController = null;
|
|
@@ -8878,6 +8910,8 @@ class ImageRenderable extends Renderable {
|
|
|
8878
8910
|
destroySelf() {
|
|
8879
8911
|
this._loadController?.abort();
|
|
8880
8912
|
this._loadController = null;
|
|
8913
|
+
this._pendingImage?.dispose();
|
|
8914
|
+
this._pendingImage = null;
|
|
8881
8915
|
this._image?.dispose();
|
|
8882
8916
|
this._image = null;
|
|
8883
8917
|
super.destroySelf();
|
|
@@ -14956,10 +14990,13 @@ export {
|
|
|
14956
14990
|
createTextAttributes,
|
|
14957
14991
|
createTerminalPalette,
|
|
14958
14992
|
createSlotRegistry,
|
|
14993
|
+
createRendererClipboardAdapter,
|
|
14959
14994
|
createMarkdownCodeBlockRenderer,
|
|
14960
14995
|
createIcyStreamDemuxer,
|
|
14996
|
+
createHostClipboard,
|
|
14961
14997
|
createExtmarksController,
|
|
14962
14998
|
createCoreSlotRegistry,
|
|
14999
|
+
createClipboard,
|
|
14963
15000
|
createCliRenderer,
|
|
14964
15001
|
coordinateToCharacterIndex,
|
|
14965
15002
|
convertThemeToStyles,
|
|
@@ -15057,6 +15094,12 @@ export {
|
|
|
15057
15094
|
NativeSpanFeed,
|
|
15058
15095
|
NativeMeasureTargetKind,
|
|
15059
15096
|
NativeImage,
|
|
15097
|
+
NativeClipboardStartStatus,
|
|
15098
|
+
NativeClipboardShutdownStatus,
|
|
15099
|
+
NativeClipboardOperationStatus,
|
|
15100
|
+
NativeClipboardDestroyStatus,
|
|
15101
|
+
NativeClipboardCopyStatus,
|
|
15102
|
+
NativeClipboardCancelStatus,
|
|
15060
15103
|
NativeAudioStreamState2 as NativeAudioStreamState,
|
|
15061
15104
|
NativeAudioStreamFormat2 as NativeAudioStreamFormat,
|
|
15062
15105
|
NativeAudioStreamCloseReason2 as NativeAudioStreamCloseReason,
|
|
@@ -15130,5 +15173,5 @@ export {
|
|
|
15130
15173
|
ACHROMATOPSIA_MATRIX
|
|
15131
15174
|
};
|
|
15132
15175
|
|
|
15133
|
-
//# debugId=
|
|
15176
|
+
//# debugId=7EDEA741834B885264756E2164756E21
|
|
15134
15177
|
//# sourceMappingURL=index.bun.js.map
|