@opentui/core 0.0.0-20251202-52296102 → 0.0.0-20251205-41c885f6

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.js CHANGED
@@ -9,9 +9,7 @@ import {
9
9
  ConsolePosition,
10
10
  DataPathsManager,
11
11
  DebugOverlayCorner,
12
- Edge,
13
12
  ExtmarksController,
14
- Gutter,
15
13
  InternalKeyHandler,
16
14
  KeyEvent,
17
15
  KeyHandler,
@@ -19,7 +17,6 @@ import {
19
17
  LinearScrollAccel,
20
18
  LogLevel,
21
19
  MacOSScrollAccel,
22
- MeasureMode,
23
20
  MouseButton,
24
21
  MouseEvent,
25
22
  MouseParser,
@@ -74,7 +71,6 @@ import {
74
71
  dim,
75
72
  env,
76
73
  envRegistry,
77
- exports_dist,
78
74
  extToFiletype,
79
75
  fg,
80
76
  fonts,
@@ -137,8 +133,7 @@ import {
137
133
  white,
138
134
  wrapWithDelegates,
139
135
  yellow
140
- } from "./index-re80811e.js";
141
- import"./index-g8dczzvv.js";
136
+ } from "./index-x5bb5xvn.js";
142
137
  // src/text-buffer-view.ts
143
138
  class TextBufferView {
144
139
  lib;
@@ -2202,6 +2197,7 @@ class ASCIIFontRenderable extends FrameBufferRenderable {
2202
2197
  }
2203
2198
  }
2204
2199
  // src/renderables/Box.ts
2200
+ import { Edge, Gutter } from "bun-yoga";
2205
2201
  function isGapType(value) {
2206
2202
  if (value === undefined) {
2207
2203
  return true;
@@ -2418,6 +2414,7 @@ class BoxRenderable extends Renderable {
2418
2414
  }
2419
2415
  }
2420
2416
  // src/renderables/TextBufferRenderable.ts
2417
+ import { MeasureMode } from "bun-yoga";
2421
2418
  class TextBufferRenderable extends Renderable {
2422
2419
  selectable = true;
2423
2420
  _defaultFg;
@@ -3757,720 +3754,8 @@ class LineNumberRenderable extends Renderable {
3757
3754
  }
3758
3755
  }
3759
3756
 
3760
- // ../../node_modules/diff/libesm/diff/base.js
3761
- class Diff {
3762
- diff(oldStr, newStr, options = {}) {
3763
- let callback;
3764
- if (typeof options === "function") {
3765
- callback = options;
3766
- options = {};
3767
- } else if ("callback" in options) {
3768
- callback = options.callback;
3769
- }
3770
- const oldString = this.castInput(oldStr, options);
3771
- const newString = this.castInput(newStr, options);
3772
- const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
3773
- const newTokens = this.removeEmpty(this.tokenize(newString, options));
3774
- return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
3775
- }
3776
- diffWithOptionsObj(oldTokens, newTokens, options, callback) {
3777
- var _a;
3778
- const done = (value) => {
3779
- value = this.postProcess(value, options);
3780
- if (callback) {
3781
- setTimeout(function() {
3782
- callback(value);
3783
- }, 0);
3784
- return;
3785
- } else {
3786
- return value;
3787
- }
3788
- };
3789
- const newLen = newTokens.length, oldLen = oldTokens.length;
3790
- let editLength = 1;
3791
- let maxEditLength = newLen + oldLen;
3792
- if (options.maxEditLength != null) {
3793
- maxEditLength = Math.min(maxEditLength, options.maxEditLength);
3794
- }
3795
- const maxExecutionTime = (_a = options.timeout) !== null && _a !== undefined ? _a : Infinity;
3796
- const abortAfterTimestamp = Date.now() + maxExecutionTime;
3797
- const bestPath = [{ oldPos: -1, lastComponent: undefined }];
3798
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
3799
- if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
3800
- return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
3801
- }
3802
- let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
3803
- const execEditLength = () => {
3804
- for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength);diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
3805
- let basePath;
3806
- const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
3807
- if (removePath) {
3808
- bestPath[diagonalPath - 1] = undefined;
3809
- }
3810
- let canAdd = false;
3811
- if (addPath) {
3812
- const addPathNewPos = addPath.oldPos - diagonalPath;
3813
- canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
3814
- }
3815
- const canRemove = removePath && removePath.oldPos + 1 < oldLen;
3816
- if (!canAdd && !canRemove) {
3817
- bestPath[diagonalPath] = undefined;
3818
- continue;
3819
- }
3820
- if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
3821
- basePath = this.addToPath(addPath, true, false, 0, options);
3822
- } else {
3823
- basePath = this.addToPath(removePath, false, true, 1, options);
3824
- }
3825
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
3826
- if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
3827
- return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
3828
- } else {
3829
- bestPath[diagonalPath] = basePath;
3830
- if (basePath.oldPos + 1 >= oldLen) {
3831
- maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
3832
- }
3833
- if (newPos + 1 >= newLen) {
3834
- minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
3835
- }
3836
- }
3837
- }
3838
- editLength++;
3839
- };
3840
- if (callback) {
3841
- (function exec() {
3842
- setTimeout(function() {
3843
- if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
3844
- return callback(undefined);
3845
- }
3846
- if (!execEditLength()) {
3847
- exec();
3848
- }
3849
- }, 0);
3850
- })();
3851
- } else {
3852
- while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
3853
- const ret = execEditLength();
3854
- if (ret) {
3855
- return ret;
3856
- }
3857
- }
3858
- }
3859
- }
3860
- addToPath(path, added, removed, oldPosInc, options) {
3861
- const last = path.lastComponent;
3862
- if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
3863
- return {
3864
- oldPos: path.oldPos + oldPosInc,
3865
- lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
3866
- };
3867
- } else {
3868
- return {
3869
- oldPos: path.oldPos + oldPosInc,
3870
- lastComponent: { count: 1, added, removed, previousComponent: last }
3871
- };
3872
- }
3873
- }
3874
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
3875
- const newLen = newTokens.length, oldLen = oldTokens.length;
3876
- let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
3877
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
3878
- newPos++;
3879
- oldPos++;
3880
- commonCount++;
3881
- if (options.oneChangePerToken) {
3882
- basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
3883
- }
3884
- }
3885
- if (commonCount && !options.oneChangePerToken) {
3886
- basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
3887
- }
3888
- basePath.oldPos = oldPos;
3889
- return newPos;
3890
- }
3891
- equals(left, right, options) {
3892
- if (options.comparator) {
3893
- return options.comparator(left, right);
3894
- } else {
3895
- return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
3896
- }
3897
- }
3898
- removeEmpty(array) {
3899
- const ret = [];
3900
- for (let i = 0;i < array.length; i++) {
3901
- if (array[i]) {
3902
- ret.push(array[i]);
3903
- }
3904
- }
3905
- return ret;
3906
- }
3907
- castInput(value, options) {
3908
- return value;
3909
- }
3910
- tokenize(value, options) {
3911
- return Array.from(value);
3912
- }
3913
- join(chars) {
3914
- return chars.join("");
3915
- }
3916
- postProcess(changeObjects, options) {
3917
- return changeObjects;
3918
- }
3919
- get useLongestToken() {
3920
- return false;
3921
- }
3922
- buildValues(lastComponent, newTokens, oldTokens) {
3923
- const components = [];
3924
- let nextComponent;
3925
- while (lastComponent) {
3926
- components.push(lastComponent);
3927
- nextComponent = lastComponent.previousComponent;
3928
- delete lastComponent.previousComponent;
3929
- lastComponent = nextComponent;
3930
- }
3931
- components.reverse();
3932
- const componentLen = components.length;
3933
- let componentPos = 0, newPos = 0, oldPos = 0;
3934
- for (;componentPos < componentLen; componentPos++) {
3935
- const component = components[componentPos];
3936
- if (!component.removed) {
3937
- if (!component.added && this.useLongestToken) {
3938
- let value = newTokens.slice(newPos, newPos + component.count);
3939
- value = value.map(function(value2, i) {
3940
- const oldValue = oldTokens[oldPos + i];
3941
- return oldValue.length > value2.length ? oldValue : value2;
3942
- });
3943
- component.value = this.join(value);
3944
- } else {
3945
- component.value = this.join(newTokens.slice(newPos, newPos + component.count));
3946
- }
3947
- newPos += component.count;
3948
- if (!component.added) {
3949
- oldPos += component.count;
3950
- }
3951
- } else {
3952
- component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
3953
- oldPos += component.count;
3954
- }
3955
- }
3956
- return components;
3957
- }
3958
- }
3959
-
3960
- // ../../node_modules/diff/libesm/diff/character.js
3961
- class CharacterDiff extends Diff {
3962
- }
3963
- var characterDiff = new CharacterDiff;
3964
-
3965
- // ../../node_modules/diff/libesm/util/string.js
3966
- function longestCommonPrefix(str1, str2) {
3967
- let i;
3968
- for (i = 0;i < str1.length && i < str2.length; i++) {
3969
- if (str1[i] != str2[i]) {
3970
- return str1.slice(0, i);
3971
- }
3972
- }
3973
- return str1.slice(0, i);
3974
- }
3975
- function longestCommonSuffix(str1, str2) {
3976
- let i;
3977
- if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
3978
- return "";
3979
- }
3980
- for (i = 0;i < str1.length && i < str2.length; i++) {
3981
- if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
3982
- return str1.slice(-i);
3983
- }
3984
- }
3985
- return str1.slice(-i);
3986
- }
3987
- function replacePrefix(string, oldPrefix, newPrefix) {
3988
- if (string.slice(0, oldPrefix.length) != oldPrefix) {
3989
- throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
3990
- }
3991
- return newPrefix + string.slice(oldPrefix.length);
3992
- }
3993
- function replaceSuffix(string, oldSuffix, newSuffix) {
3994
- if (!oldSuffix) {
3995
- return string + newSuffix;
3996
- }
3997
- if (string.slice(-oldSuffix.length) != oldSuffix) {
3998
- throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
3999
- }
4000
- return string.slice(0, -oldSuffix.length) + newSuffix;
4001
- }
4002
- function removePrefix(string, oldPrefix) {
4003
- return replacePrefix(string, oldPrefix, "");
4004
- }
4005
- function removeSuffix(string, oldSuffix) {
4006
- return replaceSuffix(string, oldSuffix, "");
4007
- }
4008
- function maximumOverlap(string1, string2) {
4009
- return string2.slice(0, overlapCount(string1, string2));
4010
- }
4011
- function overlapCount(a, b) {
4012
- let startA = 0;
4013
- if (a.length > b.length) {
4014
- startA = a.length - b.length;
4015
- }
4016
- let endB = b.length;
4017
- if (a.length < b.length) {
4018
- endB = a.length;
4019
- }
4020
- const map = Array(endB);
4021
- let k = 0;
4022
- map[0] = 0;
4023
- for (let j = 1;j < endB; j++) {
4024
- if (b[j] == b[k]) {
4025
- map[j] = map[k];
4026
- } else {
4027
- map[j] = k;
4028
- }
4029
- while (k > 0 && b[j] != b[k]) {
4030
- k = map[k];
4031
- }
4032
- if (b[j] == b[k]) {
4033
- k++;
4034
- }
4035
- }
4036
- k = 0;
4037
- for (let i = startA;i < a.length; i++) {
4038
- while (k > 0 && a[i] != b[k]) {
4039
- k = map[k];
4040
- }
4041
- if (a[i] == b[k]) {
4042
- k++;
4043
- }
4044
- }
4045
- return k;
4046
- }
4047
- function trailingWs(string) {
4048
- let i;
4049
- for (i = string.length - 1;i >= 0; i--) {
4050
- if (!string[i].match(/\s/)) {
4051
- break;
4052
- }
4053
- }
4054
- return string.substring(i + 1);
4055
- }
4056
- function leadingWs(string) {
4057
- const match = string.match(/^\s*/);
4058
- return match ? match[0] : "";
4059
- }
4060
-
4061
- // ../../node_modules/diff/libesm/diff/word.js
4062
- var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
4063
- var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
4064
-
4065
- class WordDiff extends Diff {
4066
- equals(left, right, options) {
4067
- if (options.ignoreCase) {
4068
- left = left.toLowerCase();
4069
- right = right.toLowerCase();
4070
- }
4071
- return left.trim() === right.trim();
4072
- }
4073
- tokenize(value, options = {}) {
4074
- let parts;
4075
- if (options.intlSegmenter) {
4076
- const segmenter = options.intlSegmenter;
4077
- if (segmenter.resolvedOptions().granularity != "word") {
4078
- throw new Error('The segmenter passed must have a granularity of "word"');
4079
- }
4080
- parts = Array.from(segmenter.segment(value), (segment) => segment.segment);
4081
- } else {
4082
- parts = value.match(tokenizeIncludingWhitespace) || [];
4083
- }
4084
- const tokens = [];
4085
- let prevPart = null;
4086
- parts.forEach((part) => {
4087
- if (/\s/.test(part)) {
4088
- if (prevPart == null) {
4089
- tokens.push(part);
4090
- } else {
4091
- tokens.push(tokens.pop() + part);
4092
- }
4093
- } else if (prevPart != null && /\s/.test(prevPart)) {
4094
- if (tokens[tokens.length - 1] == prevPart) {
4095
- tokens.push(tokens.pop() + part);
4096
- } else {
4097
- tokens.push(prevPart + part);
4098
- }
4099
- } else {
4100
- tokens.push(part);
4101
- }
4102
- prevPart = part;
4103
- });
4104
- return tokens;
4105
- }
4106
- join(tokens) {
4107
- return tokens.map((token, i) => {
4108
- if (i == 0) {
4109
- return token;
4110
- } else {
4111
- return token.replace(/^\s+/, "");
4112
- }
4113
- }).join("");
4114
- }
4115
- postProcess(changes, options) {
4116
- if (!changes || options.oneChangePerToken) {
4117
- return changes;
4118
- }
4119
- let lastKeep = null;
4120
- let insertion = null;
4121
- let deletion = null;
4122
- changes.forEach((change) => {
4123
- if (change.added) {
4124
- insertion = change;
4125
- } else if (change.removed) {
4126
- deletion = change;
4127
- } else {
4128
- if (insertion || deletion) {
4129
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
4130
- }
4131
- lastKeep = change;
4132
- insertion = null;
4133
- deletion = null;
4134
- }
4135
- });
4136
- if (insertion || deletion) {
4137
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
4138
- }
4139
- return changes;
4140
- }
4141
- }
4142
- var wordDiff = new WordDiff;
4143
- function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
4144
- if (deletion && insertion) {
4145
- const oldWsPrefix = leadingWs(deletion.value);
4146
- const oldWsSuffix = trailingWs(deletion.value);
4147
- const newWsPrefix = leadingWs(insertion.value);
4148
- const newWsSuffix = trailingWs(insertion.value);
4149
- if (startKeep) {
4150
- const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
4151
- startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
4152
- deletion.value = removePrefix(deletion.value, commonWsPrefix);
4153
- insertion.value = removePrefix(insertion.value, commonWsPrefix);
4154
- }
4155
- if (endKeep) {
4156
- const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
4157
- endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
4158
- deletion.value = removeSuffix(deletion.value, commonWsSuffix);
4159
- insertion.value = removeSuffix(insertion.value, commonWsSuffix);
4160
- }
4161
- } else if (insertion) {
4162
- if (startKeep) {
4163
- const ws = leadingWs(insertion.value);
4164
- insertion.value = insertion.value.substring(ws.length);
4165
- }
4166
- if (endKeep) {
4167
- const ws = leadingWs(endKeep.value);
4168
- endKeep.value = endKeep.value.substring(ws.length);
4169
- }
4170
- } else if (startKeep && endKeep) {
4171
- const newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
4172
- const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
4173
- deletion.value = removePrefix(deletion.value, newWsStart);
4174
- const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
4175
- deletion.value = removeSuffix(deletion.value, newWsEnd);
4176
- endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
4177
- startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
4178
- } else if (endKeep) {
4179
- const endKeepWsPrefix = leadingWs(endKeep.value);
4180
- const deletionWsSuffix = trailingWs(deletion.value);
4181
- const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
4182
- deletion.value = removeSuffix(deletion.value, overlap);
4183
- } else if (startKeep) {
4184
- const startKeepWsSuffix = trailingWs(startKeep.value);
4185
- const deletionWsPrefix = leadingWs(deletion.value);
4186
- const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
4187
- deletion.value = removePrefix(deletion.value, overlap);
4188
- }
4189
- }
4190
-
4191
- class WordsWithSpaceDiff extends Diff {
4192
- tokenize(value) {
4193
- const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
4194
- return value.match(regex) || [];
4195
- }
4196
- }
4197
- var wordsWithSpaceDiff = new WordsWithSpaceDiff;
4198
-
4199
- // ../../node_modules/diff/libesm/diff/line.js
4200
- class LineDiff extends Diff {
4201
- constructor() {
4202
- super(...arguments);
4203
- this.tokenize = tokenize;
4204
- }
4205
- equals(left, right, options) {
4206
- if (options.ignoreWhitespace) {
4207
- if (!options.newlineIsToken || !left.includes(`
4208
- `)) {
4209
- left = left.trim();
4210
- }
4211
- if (!options.newlineIsToken || !right.includes(`
4212
- `)) {
4213
- right = right.trim();
4214
- }
4215
- } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
4216
- if (left.endsWith(`
4217
- `)) {
4218
- left = left.slice(0, -1);
4219
- }
4220
- if (right.endsWith(`
4221
- `)) {
4222
- right = right.slice(0, -1);
4223
- }
4224
- }
4225
- return super.equals(left, right, options);
4226
- }
4227
- }
4228
- var lineDiff = new LineDiff;
4229
- function tokenize(value, options) {
4230
- if (options.stripTrailingCr) {
4231
- value = value.replace(/\r\n/g, `
4232
- `);
4233
- }
4234
- const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
4235
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
4236
- linesAndNewlines.pop();
4237
- }
4238
- for (let i = 0;i < linesAndNewlines.length; i++) {
4239
- const line = linesAndNewlines[i];
4240
- if (i % 2 && !options.newlineIsToken) {
4241
- retLines[retLines.length - 1] += line;
4242
- } else {
4243
- retLines.push(line);
4244
- }
4245
- }
4246
- return retLines;
4247
- }
4248
-
4249
- // ../../node_modules/diff/libesm/diff/sentence.js
4250
- function isSentenceEndPunct(char) {
4251
- return char == "." || char == "!" || char == "?";
4252
- }
4253
-
4254
- class SentenceDiff extends Diff {
4255
- tokenize(value) {
4256
- var _a;
4257
- const result = [];
4258
- let tokenStartI = 0;
4259
- for (let i = 0;i < value.length; i++) {
4260
- if (i == value.length - 1) {
4261
- result.push(value.slice(tokenStartI));
4262
- break;
4263
- }
4264
- if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
4265
- result.push(value.slice(tokenStartI, i + 1));
4266
- i = tokenStartI = i + 1;
4267
- while ((_a = value[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
4268
- i++;
4269
- }
4270
- result.push(value.slice(tokenStartI, i + 1));
4271
- tokenStartI = i + 1;
4272
- }
4273
- }
4274
- return result;
4275
- }
4276
- }
4277
- var sentenceDiff = new SentenceDiff;
4278
-
4279
- // ../../node_modules/diff/libesm/diff/css.js
4280
- class CssDiff extends Diff {
4281
- tokenize(value) {
4282
- return value.split(/([{}:;,]|\s+)/);
4283
- }
4284
- }
4285
- var cssDiff = new CssDiff;
4286
-
4287
- // ../../node_modules/diff/libesm/diff/json.js
4288
- class JsonDiff extends Diff {
4289
- constructor() {
4290
- super(...arguments);
4291
- this.tokenize = tokenize;
4292
- }
4293
- get useLongestToken() {
4294
- return true;
4295
- }
4296
- castInput(value, options) {
4297
- const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options;
4298
- return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
4299
- }
4300
- equals(left, right, options) {
4301
- return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
4302
- }
4303
- }
4304
- var jsonDiff = new JsonDiff;
4305
- function canonicalize(obj, stack, replacementStack, replacer, key) {
4306
- stack = stack || [];
4307
- replacementStack = replacementStack || [];
4308
- if (replacer) {
4309
- obj = replacer(key === undefined ? "" : key, obj);
4310
- }
4311
- let i;
4312
- for (i = 0;i < stack.length; i += 1) {
4313
- if (stack[i] === obj) {
4314
- return replacementStack[i];
4315
- }
4316
- }
4317
- let canonicalizedObj;
4318
- if (Object.prototype.toString.call(obj) === "[object Array]") {
4319
- stack.push(obj);
4320
- canonicalizedObj = new Array(obj.length);
4321
- replacementStack.push(canonicalizedObj);
4322
- for (i = 0;i < obj.length; i += 1) {
4323
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
4324
- }
4325
- stack.pop();
4326
- replacementStack.pop();
4327
- return canonicalizedObj;
4328
- }
4329
- if (obj && obj.toJSON) {
4330
- obj = obj.toJSON();
4331
- }
4332
- if (typeof obj === "object" && obj !== null) {
4333
- stack.push(obj);
4334
- canonicalizedObj = {};
4335
- replacementStack.push(canonicalizedObj);
4336
- const sortedKeys = [];
4337
- let key2;
4338
- for (key2 in obj) {
4339
- if (Object.prototype.hasOwnProperty.call(obj, key2)) {
4340
- sortedKeys.push(key2);
4341
- }
4342
- }
4343
- sortedKeys.sort();
4344
- for (i = 0;i < sortedKeys.length; i += 1) {
4345
- key2 = sortedKeys[i];
4346
- canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
4347
- }
4348
- stack.pop();
4349
- replacementStack.pop();
4350
- } else {
4351
- canonicalizedObj = obj;
4352
- }
4353
- return canonicalizedObj;
4354
- }
4355
-
4356
- // ../../node_modules/diff/libesm/diff/array.js
4357
- class ArrayDiff extends Diff {
4358
- tokenize(value) {
4359
- return value.slice();
4360
- }
4361
- join(value) {
4362
- return value;
4363
- }
4364
- removeEmpty(value) {
4365
- return value;
4366
- }
4367
- }
4368
- var arrayDiff = new ArrayDiff;
4369
-
4370
- // ../../node_modules/diff/libesm/patch/parse.js
4371
- function parsePatch(uniDiff) {
4372
- const diffstr = uniDiff.split(/\n/), list = [];
4373
- let i = 0;
4374
- function parseIndex() {
4375
- const index = {};
4376
- list.push(index);
4377
- while (i < diffstr.length) {
4378
- const line = diffstr[i];
4379
- if (/^(---|\+\+\+|@@)\s/.test(line)) {
4380
- break;
4381
- }
4382
- const header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
4383
- if (header) {
4384
- index.index = header[1];
4385
- }
4386
- i++;
4387
- }
4388
- parseFileHeader(index);
4389
- parseFileHeader(index);
4390
- index.hunks = [];
4391
- while (i < diffstr.length) {
4392
- const line = diffstr[i];
4393
- if (/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(line)) {
4394
- break;
4395
- } else if (/^@@/.test(line)) {
4396
- index.hunks.push(parseHunk());
4397
- } else if (line) {
4398
- throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(line));
4399
- } else {
4400
- i++;
4401
- }
4402
- }
4403
- }
4404
- function parseFileHeader(index) {
4405
- const fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]);
4406
- if (fileHeader) {
4407
- const data = fileHeader[2].split("\t", 2), header = (data[1] || "").trim();
4408
- let fileName = data[0].replace(/\\\\/g, "\\");
4409
- if (/^".*"$/.test(fileName)) {
4410
- fileName = fileName.substr(1, fileName.length - 2);
4411
- }
4412
- if (fileHeader[1] === "---") {
4413
- index.oldFileName = fileName;
4414
- index.oldHeader = header;
4415
- } else {
4416
- index.newFileName = fileName;
4417
- index.newHeader = header;
4418
- }
4419
- i++;
4420
- }
4421
- }
4422
- function parseHunk() {
4423
- var _a;
4424
- const chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
4425
- const hunk = {
4426
- oldStart: +chunkHeader[1],
4427
- oldLines: typeof chunkHeader[2] === "undefined" ? 1 : +chunkHeader[2],
4428
- newStart: +chunkHeader[3],
4429
- newLines: typeof chunkHeader[4] === "undefined" ? 1 : +chunkHeader[4],
4430
- lines: []
4431
- };
4432
- if (hunk.oldLines === 0) {
4433
- hunk.oldStart += 1;
4434
- }
4435
- if (hunk.newLines === 0) {
4436
- hunk.newStart += 1;
4437
- }
4438
- let addCount = 0, removeCount = 0;
4439
- for (;i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a = diffstr[i]) === null || _a === undefined ? undefined : _a.startsWith("\\"))); i++) {
4440
- const operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
4441
- if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
4442
- hunk.lines.push(diffstr[i]);
4443
- if (operation === "+") {
4444
- addCount++;
4445
- } else if (operation === "-") {
4446
- removeCount++;
4447
- } else if (operation === " ") {
4448
- addCount++;
4449
- removeCount++;
4450
- }
4451
- } else {
4452
- throw new Error(`Hunk at line ${chunkHeaderIndex + 1} contained invalid line ${diffstr[i]}`);
4453
- }
4454
- }
4455
- if (!addCount && hunk.newLines === 1) {
4456
- hunk.newLines = 0;
4457
- }
4458
- if (!removeCount && hunk.oldLines === 1) {
4459
- hunk.oldLines = 0;
4460
- }
4461
- if (addCount !== hunk.newLines) {
4462
- throw new Error("Added line count did not match for hunk at line " + (chunkHeaderIndex + 1));
4463
- }
4464
- if (removeCount !== hunk.oldLines) {
4465
- throw new Error("Removed line count did not match for hunk at line " + (chunkHeaderIndex + 1));
4466
- }
4467
- return hunk;
4468
- }
4469
- while (i < diffstr.length) {
4470
- parseIndex();
4471
- }
4472
- return list;
4473
- }
3757
+ // src/renderables/Diff.ts
3758
+ import { parsePatch } from "diff";
4474
3759
 
4475
3760
  // src/renderables/Text.ts
4476
3761
  class TextRenderable extends TextBufferRenderable {
@@ -7500,6 +6785,8 @@ class TabSelectRenderable extends Renderable {
7500
6785
  }
7501
6786
  }
7502
6787
  // src/renderables/EditBufferRenderable.ts
6788
+ import { MeasureMode as MeasureMode2 } from "bun-yoga";
6789
+
7503
6790
  class EditBufferRenderable extends Renderable {
7504
6791
  _focusable = true;
7505
6792
  selectable = true;
@@ -7799,7 +7086,7 @@ class EditBufferRenderable extends Renderable {
7799
7086
  setupMeasureFunc() {
7800
7087
  const measureFunc = (width, widthMode, height, heightMode) => {
7801
7088
  let effectiveWidth;
7802
- if (widthMode === MeasureMode.Undefined || isNaN(width)) {
7089
+ if (widthMode === MeasureMode2.Undefined || isNaN(width)) {
7803
7090
  effectiveWidth = 0;
7804
7091
  } else {
7805
7092
  effectiveWidth = width;
@@ -7808,7 +7095,7 @@ class EditBufferRenderable extends Renderable {
7808
7095
  const measureResult = this.editorView.measureForDimensions(Math.floor(effectiveWidth), Math.floor(effectiveHeight));
7809
7096
  const measuredWidth = measureResult ? Math.max(1, measureResult.maxWidth) : 1;
7810
7097
  const measuredHeight = measureResult ? Math.max(1, measureResult.lineCount) : 1;
7811
- if (widthMode === MeasureMode.AtMost && this._positionType !== "absolute") {
7098
+ if (widthMode === MeasureMode2.AtMost && this._positionType !== "absolute") {
7812
7099
  return {
7813
7100
  width: Math.min(effectiveWidth, measuredWidth),
7814
7101
  height: Math.min(effectiveHeight, measuredHeight)
@@ -8470,6 +7757,8 @@ class TextareaRenderable extends EditBufferRenderable {
8470
7757
  return this.editorView.extmarks;
8471
7758
  }
8472
7759
  }
7760
+ // src/index.ts
7761
+ import * as Yoga from "bun-yoga";
8473
7762
  export {
8474
7763
  yellow,
8475
7764
  wrapWithDelegates,
@@ -8579,7 +7868,7 @@ export {
8579
7868
  applyChromaticAberration,
8580
7869
  applyAsciiArt,
8581
7870
  addDefaultParsers,
8582
- exports_dist as Yoga,
7871
+ Yoga,
8583
7872
  VignetteEffect,
8584
7873
  VRenderable,
8585
7874
  TreeSitterClient,
@@ -8657,5 +7946,5 @@ export {
8657
7946
  ASCIIFont
8658
7947
  };
8659
7948
 
8660
- //# debugId=626300641E77A75764756E2164756E21
7949
+ //# debugId=8B540B053341534264756E2164756E21
8661
7950
  //# sourceMappingURL=index.js.map