@opentui/core 0.0.0-20260706-2d4fc4e6 → 0.0.0-20260707-291f8ac3
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/{index-fcyzwry0.js → index-fmbyacqs.js} +83 -40
- package/{index-fcyzwry0.js.map → index-fmbyacqs.js.map} +6 -5
- package/{index-negzejr5.js → index-rrfea0mw.js} +4 -3
- package/{index-negzejr5.js.map → index-rrfea0mw.js.map} +3 -3
- package/index.js +2 -2
- package/lib/host-clipboard.internal.d.ts +2 -0
- package/lib/host-clipboard.native.d.ts +1 -1
- package/lib/host-clipboard.native.scheduler.d.ts +14 -0
- package/package.json +9 -9
- package/renderer.d.ts +2 -2
- package/testing.js +2 -2
- package/yoga.js +1 -1
|
@@ -10248,6 +10248,8 @@ var DEFAULT_CLIPBOARD_MAX_PROVIDER_TRANSFERS = 16;
|
|
|
10248
10248
|
var DEFAULT_CLIPBOARD_MAX_WORK_UNITS_PER_DRAIN = 64;
|
|
10249
10249
|
var MAX_U32 = 4294967295;
|
|
10250
10250
|
var MIME_ESSENCE_PATTERN = /^[a-z0-9!#$%&'*+.^_`|~-]+\/[a-z0-9!#$%&'*+.^_`|~-]+$/i;
|
|
10251
|
+
var HOST_CLIPBOARD_MIME_PREFERENCE_COUNT_MAX = 64;
|
|
10252
|
+
var HOST_CLIPBOARD_MIME_ESSENCE_BYTES_MAX = 255;
|
|
10251
10253
|
var normalizeRemainingTimeout = (timeoutMs, elapsedMs) => {
|
|
10252
10254
|
const exactRemainingMs = timeoutMs - elapsedMs;
|
|
10253
10255
|
return exactRemainingMs <= 0 ? 0 : Math.max(1, Math.floor(exactRemainingMs));
|
|
@@ -10285,8 +10287,17 @@ var normalizePreferredTypes = (preferredTypes) => {
|
|
|
10285
10287
|
if (!Array.isArray(preferredTypes) || preferredTypes.length === 0) {
|
|
10286
10288
|
throw new TypeError("preferredTypes must contain at least one MIME essence type");
|
|
10287
10289
|
}
|
|
10290
|
+
if (preferredTypes.length > HOST_CLIPBOARD_MIME_PREFERENCE_COUNT_MAX) {
|
|
10291
|
+
throw new RangeError(`preferredTypes must contain at most ${HOST_CLIPBOARD_MIME_PREFERENCE_COUNT_MAX} MIME essence types`);
|
|
10292
|
+
}
|
|
10288
10293
|
const normalized = preferredTypes.map((mimeType) => {
|
|
10289
|
-
if (typeof mimeType !== "string"
|
|
10294
|
+
if (typeof mimeType !== "string") {
|
|
10295
|
+
throw new TypeError("preferredTypes must contain valid MIME essence types without parameters");
|
|
10296
|
+
}
|
|
10297
|
+
if (mimeType.length > HOST_CLIPBOARD_MIME_ESSENCE_BYTES_MAX) {
|
|
10298
|
+
throw new RangeError(`preferredTypes MIME essences must be at most ${HOST_CLIPBOARD_MIME_ESSENCE_BYTES_MAX} ASCII bytes`);
|
|
10299
|
+
}
|
|
10300
|
+
if (!MIME_ESSENCE_PATTERN.test(mimeType)) {
|
|
10290
10301
|
throw new TypeError("preferredTypes must contain valid MIME essence types without parameters");
|
|
10291
10302
|
}
|
|
10292
10303
|
return mimeType.toLowerCase();
|
|
@@ -10459,24 +10470,77 @@ var createHostClipboardWithBackend = (options, createBackend) => {
|
|
|
10459
10470
|
};
|
|
10460
10471
|
};
|
|
10461
10472
|
|
|
10462
|
-
// src/lib/host-clipboard.native.ts
|
|
10463
|
-
var MAX_U322 = 4294967295;
|
|
10473
|
+
// src/lib/host-clipboard.native.scheduler.ts
|
|
10464
10474
|
var OPERATION_POLL_INTERVAL_MS = 1;
|
|
10465
10475
|
var PROVIDER_POLL_INTERVAL_MS = 8;
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10476
|
+
|
|
10477
|
+
class NativeClipboardPollScheduler {
|
|
10478
|
+
timers;
|
|
10479
|
+
timer;
|
|
10480
|
+
timerForOperation = false;
|
|
10481
|
+
constructor(timers) {
|
|
10482
|
+
this.timers = timers;
|
|
10483
|
+
}
|
|
10484
|
+
schedule(hasPendingOperation, providerActive, callback) {
|
|
10485
|
+
if (!hasPendingOperation && !providerActive) {
|
|
10486
|
+
this.clearTimer();
|
|
10487
|
+
return;
|
|
10488
|
+
}
|
|
10489
|
+
if (this.timer !== undefined) {
|
|
10490
|
+
if (hasPendingOperation && !this.timerForOperation) {
|
|
10491
|
+
this.clearTimer();
|
|
10492
|
+
} else {
|
|
10493
|
+
if (hasPendingOperation)
|
|
10494
|
+
refTimer(this.timer);
|
|
10495
|
+
else
|
|
10496
|
+
unrefTimer(this.timer);
|
|
10497
|
+
return;
|
|
10498
|
+
}
|
|
10499
|
+
}
|
|
10500
|
+
this.timerForOperation = hasPendingOperation;
|
|
10501
|
+
const timer = this.timers.set(() => {
|
|
10502
|
+
if (this.timer !== timer)
|
|
10503
|
+
return;
|
|
10504
|
+
this.timer = undefined;
|
|
10505
|
+
this.timerForOperation = false;
|
|
10506
|
+
callback();
|
|
10507
|
+
}, hasPendingOperation ? OPERATION_POLL_INTERVAL_MS : PROVIDER_POLL_INTERVAL_MS);
|
|
10508
|
+
this.timer = timer;
|
|
10509
|
+
if (!hasPendingOperation)
|
|
10510
|
+
unrefTimer(timer);
|
|
10511
|
+
}
|
|
10512
|
+
dispose() {
|
|
10513
|
+
this.clearTimer();
|
|
10514
|
+
}
|
|
10515
|
+
clearTimer() {
|
|
10516
|
+
if (this.timer === undefined)
|
|
10517
|
+
return;
|
|
10518
|
+
this.timers.clear(this.timer);
|
|
10519
|
+
this.timer = undefined;
|
|
10520
|
+
this.timerForOperation = false;
|
|
10521
|
+
}
|
|
10522
|
+
}
|
|
10523
|
+
var refTimer = (timer) => {
|
|
10524
|
+
if (typeof timer === "object" && timer !== null && "ref" in timer && typeof timer.ref === "function")
|
|
10525
|
+
timer.ref();
|
|
10526
|
+
};
|
|
10527
|
+
var unrefTimer = (timer) => {
|
|
10528
|
+
if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
|
|
10470
10529
|
timer.unref();
|
|
10471
|
-
|
|
10530
|
+
}
|
|
10472
10531
|
};
|
|
10532
|
+
|
|
10533
|
+
// src/lib/host-clipboard.native.ts
|
|
10534
|
+
var SHUTDOWN_POLL_INTERVAL_MS = 1;
|
|
10535
|
+
var selectionValue = (selection) => selection === "clipboard" ? 0 : 1;
|
|
10473
10536
|
var encodeReadRequest = (preferredTypes) => {
|
|
10474
|
-
if (preferredTypes.length >
|
|
10475
|
-
throw new RangeError("Clipboard MIME preference count exceeds native
|
|
10537
|
+
if (preferredTypes.length > HOST_CLIPBOARD_MIME_PREFERENCE_COUNT_MAX) {
|
|
10538
|
+
throw new RangeError("Clipboard MIME preference count exceeds native protocol capacity");
|
|
10539
|
+
}
|
|
10476
10540
|
let size = 4;
|
|
10477
10541
|
for (const mimeType of preferredTypes) {
|
|
10478
|
-
if (mimeType.length >
|
|
10479
|
-
throw new RangeError("Clipboard MIME
|
|
10542
|
+
if (mimeType.length > HOST_CLIPBOARD_MIME_ESSENCE_BYTES_MAX) {
|
|
10543
|
+
throw new RangeError("Clipboard MIME essence exceeds native protocol capacity");
|
|
10480
10544
|
}
|
|
10481
10545
|
size += 4 + mimeType.length;
|
|
10482
10546
|
}
|
|
@@ -10506,7 +10570,7 @@ class NativeClipboardBackend {
|
|
|
10506
10570
|
library;
|
|
10507
10571
|
service;
|
|
10508
10572
|
pending = new Map;
|
|
10509
|
-
|
|
10573
|
+
scheduler = new NativeClipboardPollScheduler({ set: setTimeout, clear: clearTimeout });
|
|
10510
10574
|
providerActive = false;
|
|
10511
10575
|
disposed = false;
|
|
10512
10576
|
disposePromise;
|
|
@@ -10561,18 +10625,7 @@ class NativeClipboardBackend {
|
|
|
10561
10625
|
this.ensureScheduled();
|
|
10562
10626
|
}
|
|
10563
10627
|
ensureScheduled() {
|
|
10564
|
-
|
|
10565
|
-
if (this.pending.size > 0 && typeof this.timer === "object" && "ref" in this.timer)
|
|
10566
|
-
this.timer.ref();
|
|
10567
|
-
return;
|
|
10568
|
-
}
|
|
10569
|
-
if (this.pending.size === 0 && !this.providerActive)
|
|
10570
|
-
return;
|
|
10571
|
-
const hasPendingOperation = this.pending.size > 0;
|
|
10572
|
-
this.timer = schedule(() => {
|
|
10573
|
-
this.timer = undefined;
|
|
10574
|
-
this.drain();
|
|
10575
|
-
}, hasPendingOperation ? OPERATION_POLL_INTERVAL_MS : PROVIDER_POLL_INTERVAL_MS, hasPendingOperation);
|
|
10628
|
+
this.scheduler.schedule(this.pending.size > 0, this.providerActive, () => this.drain());
|
|
10576
10629
|
}
|
|
10577
10630
|
drain() {
|
|
10578
10631
|
this.providerActive = this.library.clipboardServiceDrain(this.service) === 1;
|
|
@@ -10603,14 +10656,7 @@ class NativeClipboardBackend {
|
|
|
10603
10656
|
this.pending.delete(operation.handle);
|
|
10604
10657
|
operation.resolve(destroyed === 0 /* Destroyed */ ? operation.terminalResult : { status: "failed", error: new Error("Native clipboard operation became invalid before destruction") });
|
|
10605
10658
|
}
|
|
10606
|
-
|
|
10607
|
-
clearTimeout(this.timer);
|
|
10608
|
-
this.timer = undefined;
|
|
10609
|
-
} else if (this.pending.size === 0 && this.timer && typeof this.timer === "object" && "unref" in this.timer) {
|
|
10610
|
-
this.timer.unref();
|
|
10611
|
-
} else {
|
|
10612
|
-
this.ensureScheduled();
|
|
10613
|
-
}
|
|
10659
|
+
this.ensureScheduled();
|
|
10614
10660
|
}
|
|
10615
10661
|
rotate(operation) {
|
|
10616
10662
|
this.pending.delete(operation.handle);
|
|
@@ -10672,13 +10718,10 @@ class NativeClipboardBackend {
|
|
|
10672
10718
|
return Object.assign(new Error(new TextDecoder().decode(diagnostic)), { code: code.errorCode });
|
|
10673
10719
|
}
|
|
10674
10720
|
async shutdown() {
|
|
10675
|
-
|
|
10676
|
-
clearTimeout(this.timer);
|
|
10677
|
-
this.timer = undefined;
|
|
10678
|
-
}
|
|
10721
|
+
this.scheduler.dispose();
|
|
10679
10722
|
let status = this.library.clipboardServiceBeginShutdown(this.service);
|
|
10680
10723
|
while (status === 0 /* Pending */) {
|
|
10681
|
-
await new Promise((resolve3) =>
|
|
10724
|
+
await new Promise((resolve3) => setTimeout(resolve3, SHUTDOWN_POLL_INTERVAL_MS));
|
|
10682
10725
|
status = this.library.clipboardServicePollShutdown(this.service);
|
|
10683
10726
|
}
|
|
10684
10727
|
if (status !== 1 /* Ready */)
|
|
@@ -16952,5 +16995,5 @@ var yoga_default = Yoga;
|
|
|
16952
16995
|
|
|
16953
16996
|
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, createHostClipboard, createClipboard, ClipboardTarget, createRendererClipboardAdapter, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, NativeClipboardOperationStatus, NativeClipboardStartStatus, NativeClipboardCancelStatus, NativeClipboardCopyStatus, NativeClipboardDestroyStatus, NativeClipboardShutdownStatus, 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 };
|
|
16954
16997
|
|
|
16955
|
-
//# debugId=
|
|
16956
|
-
//# sourceMappingURL=index-
|
|
16998
|
+
//# debugId=053F08B0C872F3DE64756E2164756E21
|
|
16999
|
+
//# sourceMappingURL=index-fmbyacqs.js.map
|