@opentui/core 0.1.107 → 0.2.1

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.
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_src
4
- } from "./index-mch6dv67.js";
4
+ } from "./index-hxymw48q.js";
5
5
  import {
6
6
  __require
7
- } from "./index-mw2x3082.js";
7
+ } from "./index-b9g14b8c.js";
8
8
 
9
9
  // src/runtime-plugin.ts
10
10
  import { existsSync, readFileSync, realpathSync } from "fs";
@@ -408,4 +408,4 @@ function createRuntimePlugin(input = {}) {
408
408
  export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin };
409
409
 
410
410
  //# debugId=5D58E30F1E057B9664756E2164756E21
411
- //# sourceMappingURL=index-epp5y71w.js.map
411
+ //# sourceMappingURL=index-htg1x5tj.js.map
@@ -175,6 +175,7 @@ import {
175
175
  stripAnsiSequences,
176
176
  t,
177
177
  terminalNamedSingleStrokeKeys,
178
+ toPointer,
178
179
  treeSitterToStyledText,
179
180
  treeSitterToTextChunks,
180
181
  underline,
@@ -182,7 +183,7 @@ import {
182
183
  white,
183
184
  wrapWithDelegates,
184
185
  yellow
185
- } from "./index-mw2x3082.js";
186
+ } from "./index-b9g14b8c.js";
186
187
 
187
188
  // src/index.ts
188
189
  var exports_src2 = {};
@@ -2771,15 +2772,7 @@ class SlotRenderable extends Renderable {
2771
2772
  }
2772
2773
  // src/NativeSpanFeed.ts
2773
2774
  import { toArrayBuffer } from "bun:ffi";
2774
- function toPointer(value) {
2775
- if (typeof value === "bigint") {
2776
- if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
2777
- throw new Error("Pointer exceeds safe integer range");
2778
- }
2779
- return Number(value);
2780
- }
2781
- return value;
2782
- }
2775
+ var toPointer2 = toPointer;
2783
2776
  function toNumber(value) {
2784
2777
  return typeof value === "bigint" ? Number(value) : value;
2785
2778
  }
@@ -2800,7 +2793,7 @@ class NativeSpanFeed {
2800
2793
  }
2801
2794
  static attach(streamPtr, _options) {
2802
2795
  const lib = resolveRenderLib();
2803
- const ptr = toPointer(streamPtr);
2796
+ const ptr = toPointer2(streamPtr);
2804
2797
  const stream = new NativeSpanFeed(ptr);
2805
2798
  lib.registerNativeSpanFeedStream(ptr, stream.eventHandler);
2806
2799
  const status = lib.attachNativeSpanFeed(ptr);
@@ -3815,49 +3808,271 @@ class LineNumberRenderable extends Renderable {
3815
3808
  }
3816
3809
  }
3817
3810
  }
3818
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js
3811
+ // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/patch/parse.js
3819
3812
  function parsePatch(uniDiff) {
3820
3813
  const diffstr = uniDiff.split(/\n/), list = [];
3821
3814
  let i = 0;
3815
+ function isGitDiffHeader(line) {
3816
+ return /^diff --git /.test(line);
3817
+ }
3818
+ function isDiffHeader(line) {
3819
+ return isGitDiffHeader(line) || /^Index:\s/.test(line) || /^diff(?: -r \w+)+\s/.test(line);
3820
+ }
3821
+ function isFileHeader(line) {
3822
+ return /^(---|\+\+\+)\s/.test(line);
3823
+ }
3824
+ function isHunkHeader(line) {
3825
+ return /^@@\s/.test(line);
3826
+ }
3822
3827
  function parseIndex() {
3828
+ var _a;
3823
3829
  const index = {};
3830
+ index.hunks = [];
3824
3831
  list.push(index);
3832
+ let seenDiffHeader = false;
3825
3833
  while (i < diffstr.length) {
3826
3834
  const line = diffstr[i];
3827
- if (/^(---|\+\+\+|@@)\s/.test(line)) {
3835
+ if (isFileHeader(line) || isHunkHeader(line)) {
3828
3836
  break;
3829
3837
  }
3830
- const header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
3831
- if (header) {
3832
- index.index = header[1];
3838
+ if (isGitDiffHeader(line)) {
3839
+ if (seenDiffHeader) {
3840
+ return;
3841
+ }
3842
+ seenDiffHeader = true;
3843
+ index.isGit = true;
3844
+ const paths = parseGitDiffHeader(line);
3845
+ if (paths) {
3846
+ index.oldFileName = paths.oldFileName;
3847
+ index.newFileName = paths.newFileName;
3848
+ }
3849
+ i++;
3850
+ while (i < diffstr.length) {
3851
+ const extLine = diffstr[i];
3852
+ if (isFileHeader(extLine) || isHunkHeader(extLine) || isDiffHeader(extLine)) {
3853
+ break;
3854
+ }
3855
+ const renameFromMatch = /^rename from (.*)/.exec(extLine);
3856
+ if (renameFromMatch) {
3857
+ index.oldFileName = "a/" + unquoteIfQuoted(renameFromMatch[1]);
3858
+ index.isRename = true;
3859
+ }
3860
+ const renameToMatch = /^rename to (.*)/.exec(extLine);
3861
+ if (renameToMatch) {
3862
+ index.newFileName = "b/" + unquoteIfQuoted(renameToMatch[1]);
3863
+ index.isRename = true;
3864
+ }
3865
+ const copyFromMatch = /^copy from (.*)/.exec(extLine);
3866
+ if (copyFromMatch) {
3867
+ index.oldFileName = "a/" + unquoteIfQuoted(copyFromMatch[1]);
3868
+ index.isCopy = true;
3869
+ }
3870
+ const copyToMatch = /^copy to (.*)/.exec(extLine);
3871
+ if (copyToMatch) {
3872
+ index.newFileName = "b/" + unquoteIfQuoted(copyToMatch[1]);
3873
+ index.isCopy = true;
3874
+ }
3875
+ const newFileModeMatch = /^new file mode (\d+)/.exec(extLine);
3876
+ if (newFileModeMatch) {
3877
+ index.isCreate = true;
3878
+ index.newMode = newFileModeMatch[1];
3879
+ }
3880
+ const deletedFileModeMatch = /^deleted file mode (\d+)/.exec(extLine);
3881
+ if (deletedFileModeMatch) {
3882
+ index.isDelete = true;
3883
+ index.oldMode = deletedFileModeMatch[1];
3884
+ }
3885
+ const oldModeMatch = /^old mode (\d+)/.exec(extLine);
3886
+ if (oldModeMatch) {
3887
+ index.oldMode = oldModeMatch[1];
3888
+ }
3889
+ const newModeMatch = /^new mode (\d+)/.exec(extLine);
3890
+ if (newModeMatch) {
3891
+ index.newMode = newModeMatch[1];
3892
+ }
3893
+ if (/^Binary files /.test(extLine)) {
3894
+ index.isBinary = true;
3895
+ }
3896
+ i++;
3897
+ }
3898
+ continue;
3899
+ } else if (isDiffHeader(line)) {
3900
+ if (seenDiffHeader) {
3901
+ return;
3902
+ }
3903
+ seenDiffHeader = true;
3904
+ const headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line);
3905
+ if (headerMatch) {
3906
+ index.index = line.substring(headerMatch[0].length).trim();
3907
+ }
3833
3908
  }
3834
3909
  i++;
3835
3910
  }
3836
3911
  parseFileHeader(index);
3837
3912
  parseFileHeader(index);
3838
- index.hunks = [];
3913
+ if (index.oldFileName === undefined !== (index.newFileName === undefined)) {
3914
+ throw new Error("Missing " + (index.oldFileName !== undefined ? '"+++ ..."' : '"--- ..."') + " file header for " + ((_a = index.oldFileName) !== null && _a !== undefined ? _a : index.newFileName));
3915
+ }
3839
3916
  while (i < diffstr.length) {
3840
3917
  const line = diffstr[i];
3841
- if (/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(line)) {
3918
+ if (isDiffHeader(line) || isFileHeader(line) || /^===================================================================/.test(line)) {
3842
3919
  break;
3843
- } else if (/^@@/.test(line)) {
3920
+ } else if (isHunkHeader(line)) {
3844
3921
  index.hunks.push(parseHunk());
3845
- } else if (line) {
3846
- throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(line));
3847
3922
  } else {
3848
3923
  i++;
3849
3924
  }
3850
3925
  }
3851
3926
  }
3927
+ function parseGitDiffHeader(line) {
3928
+ const rest = line.substring("diff --git ".length);
3929
+ if (rest.startsWith('"')) {
3930
+ const oldPath = parseQuotedFileName(rest);
3931
+ if (oldPath === null) {
3932
+ return null;
3933
+ }
3934
+ const afterOld = rest.substring(oldPath.rawLength + 1);
3935
+ let newFileName;
3936
+ if (afterOld.startsWith('"')) {
3937
+ const newPath = parseQuotedFileName(afterOld);
3938
+ if (newPath === null) {
3939
+ return null;
3940
+ }
3941
+ newFileName = newPath.fileName;
3942
+ } else {
3943
+ newFileName = afterOld;
3944
+ }
3945
+ return {
3946
+ oldFileName: oldPath.fileName,
3947
+ newFileName
3948
+ };
3949
+ }
3950
+ const quoteIdx = rest.indexOf('"');
3951
+ if (quoteIdx > 0) {
3952
+ const oldFileName = rest.substring(0, quoteIdx - 1);
3953
+ const newPath = parseQuotedFileName(rest.substring(quoteIdx));
3954
+ if (newPath === null) {
3955
+ return null;
3956
+ }
3957
+ return {
3958
+ oldFileName,
3959
+ newFileName: newPath.fileName
3960
+ };
3961
+ }
3962
+ if (rest.startsWith("a/")) {
3963
+ const splits = [];
3964
+ let idx = 0;
3965
+ while (true) {
3966
+ idx = rest.indexOf(" b/", idx + 1);
3967
+ if (idx === -1) {
3968
+ break;
3969
+ }
3970
+ splits.push(idx);
3971
+ }
3972
+ if (splits.length > 0) {
3973
+ const mid = splits[Math.floor(splits.length / 2)];
3974
+ return {
3975
+ oldFileName: rest.substring(0, mid),
3976
+ newFileName: rest.substring(mid + 1)
3977
+ };
3978
+ }
3979
+ }
3980
+ return null;
3981
+ }
3982
+ function unquoteIfQuoted(s) {
3983
+ if (s.startsWith('"')) {
3984
+ const parsed = parseQuotedFileName(s);
3985
+ if (parsed) {
3986
+ return parsed.fileName;
3987
+ }
3988
+ }
3989
+ return s;
3990
+ }
3991
+ function parseQuotedFileName(s) {
3992
+ if (!s.startsWith('"')) {
3993
+ return null;
3994
+ }
3995
+ let result = "";
3996
+ let j = 1;
3997
+ while (j < s.length) {
3998
+ if (s[j] === '"') {
3999
+ return { fileName: result, rawLength: j + 1 };
4000
+ }
4001
+ if (s[j] === "\\" && j + 1 < s.length) {
4002
+ j++;
4003
+ switch (s[j]) {
4004
+ case "a":
4005
+ result += "\x07";
4006
+ break;
4007
+ case "b":
4008
+ result += "\b";
4009
+ break;
4010
+ case "f":
4011
+ result += "\f";
4012
+ break;
4013
+ case "n":
4014
+ result += `
4015
+ `;
4016
+ break;
4017
+ case "r":
4018
+ result += "\r";
4019
+ break;
4020
+ case "t":
4021
+ result += "\t";
4022
+ break;
4023
+ case "v":
4024
+ result += "\v";
4025
+ break;
4026
+ case "\\":
4027
+ result += "\\";
4028
+ break;
4029
+ case '"':
4030
+ result += '"';
4031
+ break;
4032
+ case "0":
4033
+ case "1":
4034
+ case "2":
4035
+ case "3":
4036
+ case "4":
4037
+ case "5":
4038
+ case "6":
4039
+ case "7": {
4040
+ if (j + 2 >= s.length || s[j + 1] < "0" || s[j + 1] > "7" || s[j + 2] < "0" || s[j + 2] > "7") {
4041
+ return null;
4042
+ }
4043
+ const bytes = [parseInt(s.substring(j, j + 3), 8)];
4044
+ j += 3;
4045
+ while (s[j] === "\\" && s[j + 1] >= "0" && s[j + 1] <= "7") {
4046
+ if (j + 3 >= s.length || s[j + 2] < "0" || s[j + 2] > "7" || s[j + 3] < "0" || s[j + 3] > "7") {
4047
+ return null;
4048
+ }
4049
+ bytes.push(parseInt(s.substring(j + 1, j + 4), 8));
4050
+ j += 4;
4051
+ }
4052
+ result += new TextDecoder("utf-8").decode(new Uint8Array(bytes));
4053
+ continue;
4054
+ }
4055
+ default:
4056
+ return null;
4057
+ }
4058
+ } else {
4059
+ result += s[j];
4060
+ }
4061
+ j++;
4062
+ }
4063
+ return null;
4064
+ }
3852
4065
  function parseFileHeader(index) {
3853
- const fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]);
3854
- if (fileHeader) {
3855
- const data = fileHeader[2].split("\t", 2), header = (data[1] || "").trim();
3856
- let fileName = data[0].replace(/\\\\/g, "\\");
3857
- if (/^".*"$/.test(fileName)) {
3858
- fileName = fileName.substr(1, fileName.length - 2);
3859
- }
3860
- if (fileHeader[1] === "---") {
4066
+ const fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]);
4067
+ if (fileHeaderMatch) {
4068
+ const prefix = fileHeaderMatch[1], data = diffstr[i].substring(3).trim().split("\t", 2), header = (data[1] || "").trim();
4069
+ let fileName = data[0];
4070
+ if (fileName.startsWith('"')) {
4071
+ fileName = unquoteIfQuoted(fileName);
4072
+ } else {
4073
+ fileName = fileName.replace(/\\\\/g, "\\");
4074
+ }
4075
+ if (prefix === "---") {
3861
4076
  index.oldFileName = fileName;
3862
4077
  index.oldHeader = header;
3863
4078
  } else {
@@ -3912,6 +4127,9 @@ function parsePatch(uniDiff) {
3912
4127
  if (removeCount !== hunk.oldLines) {
3913
4128
  throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
3914
4129
  }
4130
+ if (i < diffstr.length && diffstr[i] && /^[+ -]/.test(diffstr[i]) && !isFileHeader(diffstr[i])) {
4131
+ throw new Error("Hunk at line " + (chunkHeaderIndex + 1) + " has more lines than expected (expected " + hunk.oldLines + " old lines and " + hunk.newLines + " new lines)");
4132
+ }
3915
4133
  return hunk;
3916
4134
  }
3917
4135
  while (i < diffstr.length) {
@@ -10774,5 +10992,5 @@ class TimeToFirstDrawRenderable extends Renderable {
10774
10992
  }
10775
10993
  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, NativeSpanFeed, 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 };
10776
10994
 
10777
- //# debugId=1EC456BC9A30AA3564756E2164756E21
10778
- //# sourceMappingURL=index-mch6dv67.js.map
10995
+ //# debugId=729D006E1BE07AFB64756E2164756E21
10996
+ //# sourceMappingURL=index-hxymw48q.js.map