@opentui/core 0.5.0 → 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-ctxxvhwz.js → chunk-bun-26r5c5w5.js} +864 -8
- package/{chunk-bun-ctxxvhwz.js.map → chunk-bun-26r5c5w5.js.map} +8 -6
- package/{chunk-bun-v3e63tzw.js → chunk-bun-t68f2fmr.js} +98 -26
- package/{chunk-bun-v3e63tzw.js.map → chunk-bun-t68f2fmr.js.map} +4 -4
- package/{chunk-node-savhj5rp.js → chunk-node-aj3n20gq.js} +864 -8
- package/{chunk-node-savhj5rp.js.map → chunk-node-aj3n20gq.js.map} +8 -6
- package/{chunk-node-1j69hr31.js → chunk-node-kq7as74d.js} +98 -26
- package/{chunk-node-1j69hr31.js.map → chunk-node-kq7as74d.js.map} +4 -4
- package/image.d.ts +2 -0
- package/index.bun.js +55 -6
- package/index.bun.js.map +4 -4
- package/index.node.js +55 -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/tests/image-icc-allocation-child.d.ts +1 -0
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +97 -0
package/index.node.js
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
mergeKeyAliases,
|
|
44
44
|
mergeKeyBindings,
|
|
45
45
|
wrapWithDelegates
|
|
46
|
-
} from "./chunk-node-
|
|
46
|
+
} from "./chunk-node-kq7as74d.js";
|
|
47
47
|
import {
|
|
48
48
|
ASCIIFontSelectionHelper,
|
|
49
49
|
ATTRIBUTE_BASE_BITS,
|
|
@@ -71,6 +71,12 @@ import {
|
|
|
71
71
|
NativeAudioStreamState,
|
|
72
72
|
NativeAudioStreamState1 as NativeAudioStreamState2,
|
|
73
73
|
NativeAudioStreamStateNames,
|
|
74
|
+
NativeClipboardCancelStatus,
|
|
75
|
+
NativeClipboardCopyStatus,
|
|
76
|
+
NativeClipboardDestroyStatus,
|
|
77
|
+
NativeClipboardOperationStatus,
|
|
78
|
+
NativeClipboardShutdownStatus,
|
|
79
|
+
NativeClipboardStartStatus,
|
|
74
80
|
NativeMeasureTargetKind,
|
|
75
81
|
OptimizedBuffer,
|
|
76
82
|
PasteEvent,
|
|
@@ -114,7 +120,10 @@ import {
|
|
|
114
120
|
clearEnvCache,
|
|
115
121
|
convertGlobalToLocalSelection,
|
|
116
122
|
coordinateToCharacterIndex,
|
|
123
|
+
createClipboard,
|
|
117
124
|
createExtmarksController,
|
|
125
|
+
createHostClipboard,
|
|
126
|
+
createRendererClipboardAdapter,
|
|
118
127
|
createTerminalPalette,
|
|
119
128
|
createTextAttributes,
|
|
120
129
|
cyan,
|
|
@@ -194,7 +203,7 @@ import {
|
|
|
194
203
|
visualizeRenderableTree,
|
|
195
204
|
white,
|
|
196
205
|
yellow
|
|
197
|
-
} from "./chunk-node-
|
|
206
|
+
} from "./chunk-node-aj3n20gq.js";
|
|
198
207
|
// src/post/effects.ts
|
|
199
208
|
function toU8(value) {
|
|
200
209
|
return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
|
|
@@ -5679,6 +5688,7 @@ var STATUS_CODES = [
|
|
|
5679
5688
|
"internal-error",
|
|
5680
5689
|
"unsupported-feature"
|
|
5681
5690
|
];
|
|
5691
|
+
var INVALID_ARGUMENT_STATUS = 7;
|
|
5682
5692
|
|
|
5683
5693
|
class ImageError extends Error {
|
|
5684
5694
|
code;
|
|
@@ -5983,6 +5993,9 @@ class NativeImage {
|
|
|
5983
5993
|
clone() {
|
|
5984
5994
|
return this.wrap(this.lib.imageClone(this.guard()));
|
|
5985
5995
|
}
|
|
5996
|
+
retain() {
|
|
5997
|
+
return this.wrap(this.lib.imageRetain(this.guard()));
|
|
5998
|
+
}
|
|
5986
5999
|
resize(options) {
|
|
5987
6000
|
if (!options || options.width === undefined && options.height === undefined) {
|
|
5988
6001
|
throw new TypeError("resize requires width, height, or both");
|
|
@@ -6032,6 +6045,9 @@ class NativeImage {
|
|
|
6032
6045
|
throw new RangeError("opacity must be between 0 and 1");
|
|
6033
6046
|
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)));
|
|
6034
6047
|
}
|
|
6048
|
+
ensureEncodedPng() {
|
|
6049
|
+
checkStatus(this.lib.imageEnsureEncodedPng(this.guard()));
|
|
6050
|
+
}
|
|
6035
6051
|
raw(format = "rgba8") {
|
|
6036
6052
|
const stride = this.width * 4;
|
|
6037
6053
|
const data = new Uint8Array(stride * this.height);
|
|
@@ -6040,6 +6056,11 @@ class NativeImage {
|
|
|
6040
6056
|
}
|
|
6041
6057
|
takeRaw() {
|
|
6042
6058
|
const handle = this.guard();
|
|
6059
|
+
const materializeStatus = this.lib.imageMaterialize(handle);
|
|
6060
|
+
if (materializeStatus === INVALID_ARGUMENT_STATUS) {
|
|
6061
|
+
throw new Error("Cannot transfer image pixels while native buffers retain the image");
|
|
6062
|
+
}
|
|
6063
|
+
checkStatus(materializeStatus);
|
|
6043
6064
|
const pointer = this.lib.imageGetPixelsPtr(handle);
|
|
6044
6065
|
if (!pointer)
|
|
6045
6066
|
throw new Error("Cannot transfer image pixels while native buffers retain the image");
|
|
@@ -8719,6 +8740,7 @@ function pixelResolution(ctx) {
|
|
|
8719
8740
|
class ImageRenderable extends Renderable {
|
|
8720
8741
|
_source;
|
|
8721
8742
|
_image = null;
|
|
8743
|
+
_pendingImage = null;
|
|
8722
8744
|
_loadError = null;
|
|
8723
8745
|
_loadController = null;
|
|
8724
8746
|
onLoad;
|
|
@@ -8745,6 +8767,8 @@ class ImageRenderable extends Renderable {
|
|
|
8745
8767
|
this._source = source;
|
|
8746
8768
|
this._loadController?.abort();
|
|
8747
8769
|
this._loadController = null;
|
|
8770
|
+
this._pendingImage?.dispose();
|
|
8771
|
+
this._pendingImage = null;
|
|
8748
8772
|
if (source === undefined) {
|
|
8749
8773
|
this._loadError = null;
|
|
8750
8774
|
this._image?.dispose();
|
|
@@ -8756,7 +8780,19 @@ class ImageRenderable extends Renderable {
|
|
|
8756
8780
|
const controller = new AbortController;
|
|
8757
8781
|
this._loadController = controller;
|
|
8758
8782
|
this._loadError = null;
|
|
8759
|
-
|
|
8783
|
+
let imagePromise;
|
|
8784
|
+
if (source instanceof NativeImage) {
|
|
8785
|
+
try {
|
|
8786
|
+
const image = source.retain();
|
|
8787
|
+
this._pendingImage = image;
|
|
8788
|
+
imagePromise = Promise.resolve(image);
|
|
8789
|
+
} catch (error) {
|
|
8790
|
+
imagePromise = Promise.reject(error);
|
|
8791
|
+
}
|
|
8792
|
+
} else {
|
|
8793
|
+
imagePromise = NativeImage.load(source, { signal: controller.signal });
|
|
8794
|
+
}
|
|
8795
|
+
this.loadPromise = this.load(imagePromise, controller);
|
|
8760
8796
|
}
|
|
8761
8797
|
get image() {
|
|
8762
8798
|
return this._image;
|
|
@@ -8845,10 +8881,10 @@ class ImageRenderable extends Renderable {
|
|
|
8845
8881
|
}
|
|
8846
8882
|
buffer.drawImage(this._image, x, y, fitted.width, fitted.height, pixelWidth, pixelHeight, sourceX, sourceY, sourceWidth, sourceHeight, this._protocol);
|
|
8847
8883
|
}
|
|
8848
|
-
async load(
|
|
8884
|
+
async load(imagePromise, controller) {
|
|
8849
8885
|
let image;
|
|
8850
8886
|
try {
|
|
8851
|
-
image = await
|
|
8887
|
+
image = await imagePromise;
|
|
8852
8888
|
} catch (error) {
|
|
8853
8889
|
if (controller.signal.aborted || this.isDestroyed || this._loadController !== controller)
|
|
8854
8890
|
return;
|
|
@@ -8861,6 +8897,8 @@ class ImageRenderable extends Renderable {
|
|
|
8861
8897
|
image.dispose();
|
|
8862
8898
|
return;
|
|
8863
8899
|
}
|
|
8900
|
+
if (this._pendingImage === image)
|
|
8901
|
+
this._pendingImage = null;
|
|
8864
8902
|
const previous = this._image;
|
|
8865
8903
|
this._image = image;
|
|
8866
8904
|
this._loadController = null;
|
|
@@ -8871,6 +8909,8 @@ class ImageRenderable extends Renderable {
|
|
|
8871
8909
|
destroySelf() {
|
|
8872
8910
|
this._loadController?.abort();
|
|
8873
8911
|
this._loadController = null;
|
|
8912
|
+
this._pendingImage?.dispose();
|
|
8913
|
+
this._pendingImage = null;
|
|
8874
8914
|
this._image?.dispose();
|
|
8875
8915
|
this._image = null;
|
|
8876
8916
|
super.destroySelf();
|
|
@@ -14949,10 +14989,13 @@ export {
|
|
|
14949
14989
|
createTextAttributes,
|
|
14950
14990
|
createTerminalPalette,
|
|
14951
14991
|
createSlotRegistry,
|
|
14992
|
+
createRendererClipboardAdapter,
|
|
14952
14993
|
createMarkdownCodeBlockRenderer,
|
|
14953
14994
|
createIcyStreamDemuxer,
|
|
14995
|
+
createHostClipboard,
|
|
14954
14996
|
createExtmarksController,
|
|
14955
14997
|
createCoreSlotRegistry,
|
|
14998
|
+
createClipboard,
|
|
14956
14999
|
createCliRenderer,
|
|
14957
15000
|
coordinateToCharacterIndex,
|
|
14958
15001
|
convertThemeToStyles,
|
|
@@ -15050,6 +15093,12 @@ export {
|
|
|
15050
15093
|
NativeSpanFeed,
|
|
15051
15094
|
NativeMeasureTargetKind,
|
|
15052
15095
|
NativeImage,
|
|
15096
|
+
NativeClipboardStartStatus,
|
|
15097
|
+
NativeClipboardShutdownStatus,
|
|
15098
|
+
NativeClipboardOperationStatus,
|
|
15099
|
+
NativeClipboardDestroyStatus,
|
|
15100
|
+
NativeClipboardCopyStatus,
|
|
15101
|
+
NativeClipboardCancelStatus,
|
|
15053
15102
|
NativeAudioStreamState2 as NativeAudioStreamState,
|
|
15054
15103
|
NativeAudioStreamFormat2 as NativeAudioStreamFormat,
|
|
15055
15104
|
NativeAudioStreamCloseReason2 as NativeAudioStreamCloseReason,
|
|
@@ -15123,5 +15172,5 @@ export {
|
|
|
15123
15172
|
ACHROMATOPSIA_MATRIX
|
|
15124
15173
|
};
|
|
15125
15174
|
|
|
15126
|
-
//# debugId=
|
|
15175
|
+
//# debugId=461568FAFCC40A8864756E2164756E21
|
|
15127
15176
|
//# sourceMappingURL=index.node.js.map
|