@opentui/core 0.1.82 → 0.1.84

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
@@ -153,7 +153,7 @@ import {
153
153
  white,
154
154
  wrapWithDelegates,
155
155
  yellow
156
- } from "./index-fv58mb45.js";
156
+ } from "./index-qr7b6cvh.js";
157
157
  // src/text-buffer-view.ts
158
158
  class TextBufferView {
159
159
  lib;
@@ -4140,617 +4140,6 @@ class LineNumberRenderable extends Renderable {
4140
4140
  }
4141
4141
  }
4142
4142
  }
4143
-
4144
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/base.js
4145
- class Diff {
4146
- diff(oldStr, newStr, options = {}) {
4147
- let callback;
4148
- if (typeof options === "function") {
4149
- callback = options;
4150
- options = {};
4151
- } else if ("callback" in options) {
4152
- callback = options.callback;
4153
- }
4154
- const oldString = this.castInput(oldStr, options);
4155
- const newString = this.castInput(newStr, options);
4156
- const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
4157
- const newTokens = this.removeEmpty(this.tokenize(newString, options));
4158
- return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
4159
- }
4160
- diffWithOptionsObj(oldTokens, newTokens, options, callback) {
4161
- var _a;
4162
- const done = (value) => {
4163
- value = this.postProcess(value, options);
4164
- if (callback) {
4165
- setTimeout(function() {
4166
- callback(value);
4167
- }, 0);
4168
- return;
4169
- } else {
4170
- return value;
4171
- }
4172
- };
4173
- const newLen = newTokens.length, oldLen = oldTokens.length;
4174
- let editLength = 1;
4175
- let maxEditLength = newLen + oldLen;
4176
- if (options.maxEditLength != null) {
4177
- maxEditLength = Math.min(maxEditLength, options.maxEditLength);
4178
- }
4179
- const maxExecutionTime = (_a = options.timeout) !== null && _a !== undefined ? _a : Infinity;
4180
- const abortAfterTimestamp = Date.now() + maxExecutionTime;
4181
- const bestPath = [{ oldPos: -1, lastComponent: undefined }];
4182
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
4183
- if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
4184
- return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
4185
- }
4186
- let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
4187
- const execEditLength = () => {
4188
- for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength);diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
4189
- let basePath;
4190
- const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
4191
- if (removePath) {
4192
- bestPath[diagonalPath - 1] = undefined;
4193
- }
4194
- let canAdd = false;
4195
- if (addPath) {
4196
- const addPathNewPos = addPath.oldPos - diagonalPath;
4197
- canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
4198
- }
4199
- const canRemove = removePath && removePath.oldPos + 1 < oldLen;
4200
- if (!canAdd && !canRemove) {
4201
- bestPath[diagonalPath] = undefined;
4202
- continue;
4203
- }
4204
- if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
4205
- basePath = this.addToPath(addPath, true, false, 0, options);
4206
- } else {
4207
- basePath = this.addToPath(removePath, false, true, 1, options);
4208
- }
4209
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
4210
- if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
4211
- return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
4212
- } else {
4213
- bestPath[diagonalPath] = basePath;
4214
- if (basePath.oldPos + 1 >= oldLen) {
4215
- maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
4216
- }
4217
- if (newPos + 1 >= newLen) {
4218
- minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
4219
- }
4220
- }
4221
- }
4222
- editLength++;
4223
- };
4224
- if (callback) {
4225
- (function exec() {
4226
- setTimeout(function() {
4227
- if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
4228
- return callback(undefined);
4229
- }
4230
- if (!execEditLength()) {
4231
- exec();
4232
- }
4233
- }, 0);
4234
- })();
4235
- } else {
4236
- while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
4237
- const ret = execEditLength();
4238
- if (ret) {
4239
- return ret;
4240
- }
4241
- }
4242
- }
4243
- }
4244
- addToPath(path, added, removed, oldPosInc, options) {
4245
- const last = path.lastComponent;
4246
- if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
4247
- return {
4248
- oldPos: path.oldPos + oldPosInc,
4249
- lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
4250
- };
4251
- } else {
4252
- return {
4253
- oldPos: path.oldPos + oldPosInc,
4254
- lastComponent: { count: 1, added, removed, previousComponent: last }
4255
- };
4256
- }
4257
- }
4258
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
4259
- const newLen = newTokens.length, oldLen = oldTokens.length;
4260
- let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
4261
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
4262
- newPos++;
4263
- oldPos++;
4264
- commonCount++;
4265
- if (options.oneChangePerToken) {
4266
- basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
4267
- }
4268
- }
4269
- if (commonCount && !options.oneChangePerToken) {
4270
- basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
4271
- }
4272
- basePath.oldPos = oldPos;
4273
- return newPos;
4274
- }
4275
- equals(left, right, options) {
4276
- if (options.comparator) {
4277
- return options.comparator(left, right);
4278
- } else {
4279
- return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
4280
- }
4281
- }
4282
- removeEmpty(array) {
4283
- const ret = [];
4284
- for (let i = 0;i < array.length; i++) {
4285
- if (array[i]) {
4286
- ret.push(array[i]);
4287
- }
4288
- }
4289
- return ret;
4290
- }
4291
- castInput(value, options) {
4292
- return value;
4293
- }
4294
- tokenize(value, options) {
4295
- return Array.from(value);
4296
- }
4297
- join(chars) {
4298
- return chars.join("");
4299
- }
4300
- postProcess(changeObjects, options) {
4301
- return changeObjects;
4302
- }
4303
- get useLongestToken() {
4304
- return false;
4305
- }
4306
- buildValues(lastComponent, newTokens, oldTokens) {
4307
- const components = [];
4308
- let nextComponent;
4309
- while (lastComponent) {
4310
- components.push(lastComponent);
4311
- nextComponent = lastComponent.previousComponent;
4312
- delete lastComponent.previousComponent;
4313
- lastComponent = nextComponent;
4314
- }
4315
- components.reverse();
4316
- const componentLen = components.length;
4317
- let componentPos = 0, newPos = 0, oldPos = 0;
4318
- for (;componentPos < componentLen; componentPos++) {
4319
- const component = components[componentPos];
4320
- if (!component.removed) {
4321
- if (!component.added && this.useLongestToken) {
4322
- let value = newTokens.slice(newPos, newPos + component.count);
4323
- value = value.map(function(value2, i) {
4324
- const oldValue = oldTokens[oldPos + i];
4325
- return oldValue.length > value2.length ? oldValue : value2;
4326
- });
4327
- component.value = this.join(value);
4328
- } else {
4329
- component.value = this.join(newTokens.slice(newPos, newPos + component.count));
4330
- }
4331
- newPos += component.count;
4332
- if (!component.added) {
4333
- oldPos += component.count;
4334
- }
4335
- } else {
4336
- component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
4337
- oldPos += component.count;
4338
- }
4339
- }
4340
- return components;
4341
- }
4342
- }
4343
-
4344
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/character.js
4345
- class CharacterDiff extends Diff {
4346
- }
4347
- var characterDiff = new CharacterDiff;
4348
-
4349
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/util/string.js
4350
- function longestCommonPrefix(str1, str2) {
4351
- let i;
4352
- for (i = 0;i < str1.length && i < str2.length; i++) {
4353
- if (str1[i] != str2[i]) {
4354
- return str1.slice(0, i);
4355
- }
4356
- }
4357
- return str1.slice(0, i);
4358
- }
4359
- function longestCommonSuffix(str1, str2) {
4360
- let i;
4361
- if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
4362
- return "";
4363
- }
4364
- for (i = 0;i < str1.length && i < str2.length; i++) {
4365
- if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
4366
- return str1.slice(-i);
4367
- }
4368
- }
4369
- return str1.slice(-i);
4370
- }
4371
- function replacePrefix(string, oldPrefix, newPrefix) {
4372
- if (string.slice(0, oldPrefix.length) != oldPrefix) {
4373
- throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
4374
- }
4375
- return newPrefix + string.slice(oldPrefix.length);
4376
- }
4377
- function replaceSuffix(string, oldSuffix, newSuffix) {
4378
- if (!oldSuffix) {
4379
- return string + newSuffix;
4380
- }
4381
- if (string.slice(-oldSuffix.length) != oldSuffix) {
4382
- throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
4383
- }
4384
- return string.slice(0, -oldSuffix.length) + newSuffix;
4385
- }
4386
- function removePrefix(string, oldPrefix) {
4387
- return replacePrefix(string, oldPrefix, "");
4388
- }
4389
- function removeSuffix(string, oldSuffix) {
4390
- return replaceSuffix(string, oldSuffix, "");
4391
- }
4392
- function maximumOverlap(string1, string2) {
4393
- return string2.slice(0, overlapCount(string1, string2));
4394
- }
4395
- function overlapCount(a, b) {
4396
- let startA = 0;
4397
- if (a.length > b.length) {
4398
- startA = a.length - b.length;
4399
- }
4400
- let endB = b.length;
4401
- if (a.length < b.length) {
4402
- endB = a.length;
4403
- }
4404
- const map = Array(endB);
4405
- let k = 0;
4406
- map[0] = 0;
4407
- for (let j = 1;j < endB; j++) {
4408
- if (b[j] == b[k]) {
4409
- map[j] = map[k];
4410
- } else {
4411
- map[j] = k;
4412
- }
4413
- while (k > 0 && b[j] != b[k]) {
4414
- k = map[k];
4415
- }
4416
- if (b[j] == b[k]) {
4417
- k++;
4418
- }
4419
- }
4420
- k = 0;
4421
- for (let i = startA;i < a.length; i++) {
4422
- while (k > 0 && a[i] != b[k]) {
4423
- k = map[k];
4424
- }
4425
- if (a[i] == b[k]) {
4426
- k++;
4427
- }
4428
- }
4429
- return k;
4430
- }
4431
- function trailingWs(string) {
4432
- let i;
4433
- for (i = string.length - 1;i >= 0; i--) {
4434
- if (!string[i].match(/\s/)) {
4435
- break;
4436
- }
4437
- }
4438
- return string.substring(i + 1);
4439
- }
4440
- function leadingWs(string) {
4441
- const match = string.match(/^\s*/);
4442
- return match ? match[0] : "";
4443
- }
4444
-
4445
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/word.js
4446
- 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}";
4447
- var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
4448
-
4449
- class WordDiff extends Diff {
4450
- equals(left, right, options) {
4451
- if (options.ignoreCase) {
4452
- left = left.toLowerCase();
4453
- right = right.toLowerCase();
4454
- }
4455
- return left.trim() === right.trim();
4456
- }
4457
- tokenize(value, options = {}) {
4458
- let parts;
4459
- if (options.intlSegmenter) {
4460
- const segmenter = options.intlSegmenter;
4461
- if (segmenter.resolvedOptions().granularity != "word") {
4462
- throw new Error('The segmenter passed must have a granularity of "word"');
4463
- }
4464
- parts = Array.from(segmenter.segment(value), (segment) => segment.segment);
4465
- } else {
4466
- parts = value.match(tokenizeIncludingWhitespace) || [];
4467
- }
4468
- const tokens = [];
4469
- let prevPart = null;
4470
- parts.forEach((part) => {
4471
- if (/\s/.test(part)) {
4472
- if (prevPart == null) {
4473
- tokens.push(part);
4474
- } else {
4475
- tokens.push(tokens.pop() + part);
4476
- }
4477
- } else if (prevPart != null && /\s/.test(prevPart)) {
4478
- if (tokens[tokens.length - 1] == prevPart) {
4479
- tokens.push(tokens.pop() + part);
4480
- } else {
4481
- tokens.push(prevPart + part);
4482
- }
4483
- } else {
4484
- tokens.push(part);
4485
- }
4486
- prevPart = part;
4487
- });
4488
- return tokens;
4489
- }
4490
- join(tokens) {
4491
- return tokens.map((token, i) => {
4492
- if (i == 0) {
4493
- return token;
4494
- } else {
4495
- return token.replace(/^\s+/, "");
4496
- }
4497
- }).join("");
4498
- }
4499
- postProcess(changes, options) {
4500
- if (!changes || options.oneChangePerToken) {
4501
- return changes;
4502
- }
4503
- let lastKeep = null;
4504
- let insertion = null;
4505
- let deletion = null;
4506
- changes.forEach((change) => {
4507
- if (change.added) {
4508
- insertion = change;
4509
- } else if (change.removed) {
4510
- deletion = change;
4511
- } else {
4512
- if (insertion || deletion) {
4513
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
4514
- }
4515
- lastKeep = change;
4516
- insertion = null;
4517
- deletion = null;
4518
- }
4519
- });
4520
- if (insertion || deletion) {
4521
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
4522
- }
4523
- return changes;
4524
- }
4525
- }
4526
- var wordDiff = new WordDiff;
4527
- function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
4528
- if (deletion && insertion) {
4529
- const oldWsPrefix = leadingWs(deletion.value);
4530
- const oldWsSuffix = trailingWs(deletion.value);
4531
- const newWsPrefix = leadingWs(insertion.value);
4532
- const newWsSuffix = trailingWs(insertion.value);
4533
- if (startKeep) {
4534
- const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
4535
- startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
4536
- deletion.value = removePrefix(deletion.value, commonWsPrefix);
4537
- insertion.value = removePrefix(insertion.value, commonWsPrefix);
4538
- }
4539
- if (endKeep) {
4540
- const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
4541
- endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
4542
- deletion.value = removeSuffix(deletion.value, commonWsSuffix);
4543
- insertion.value = removeSuffix(insertion.value, commonWsSuffix);
4544
- }
4545
- } else if (insertion) {
4546
- if (startKeep) {
4547
- const ws = leadingWs(insertion.value);
4548
- insertion.value = insertion.value.substring(ws.length);
4549
- }
4550
- if (endKeep) {
4551
- const ws = leadingWs(endKeep.value);
4552
- endKeep.value = endKeep.value.substring(ws.length);
4553
- }
4554
- } else if (startKeep && endKeep) {
4555
- const newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
4556
- const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
4557
- deletion.value = removePrefix(deletion.value, newWsStart);
4558
- const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
4559
- deletion.value = removeSuffix(deletion.value, newWsEnd);
4560
- endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
4561
- startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
4562
- } else if (endKeep) {
4563
- const endKeepWsPrefix = leadingWs(endKeep.value);
4564
- const deletionWsSuffix = trailingWs(deletion.value);
4565
- const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
4566
- deletion.value = removeSuffix(deletion.value, overlap);
4567
- } else if (startKeep) {
4568
- const startKeepWsSuffix = trailingWs(startKeep.value);
4569
- const deletionWsPrefix = leadingWs(deletion.value);
4570
- const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
4571
- deletion.value = removePrefix(deletion.value, overlap);
4572
- }
4573
- }
4574
-
4575
- class WordsWithSpaceDiff extends Diff {
4576
- tokenize(value) {
4577
- const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
4578
- return value.match(regex) || [];
4579
- }
4580
- }
4581
- var wordsWithSpaceDiff = new WordsWithSpaceDiff;
4582
-
4583
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/line.js
4584
- class LineDiff extends Diff {
4585
- constructor() {
4586
- super(...arguments);
4587
- this.tokenize = tokenize;
4588
- }
4589
- equals(left, right, options) {
4590
- if (options.ignoreWhitespace) {
4591
- if (!options.newlineIsToken || !left.includes(`
4592
- `)) {
4593
- left = left.trim();
4594
- }
4595
- if (!options.newlineIsToken || !right.includes(`
4596
- `)) {
4597
- right = right.trim();
4598
- }
4599
- } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
4600
- if (left.endsWith(`
4601
- `)) {
4602
- left = left.slice(0, -1);
4603
- }
4604
- if (right.endsWith(`
4605
- `)) {
4606
- right = right.slice(0, -1);
4607
- }
4608
- }
4609
- return super.equals(left, right, options);
4610
- }
4611
- }
4612
- var lineDiff = new LineDiff;
4613
- function tokenize(value, options) {
4614
- if (options.stripTrailingCr) {
4615
- value = value.replace(/\r\n/g, `
4616
- `);
4617
- }
4618
- const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
4619
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
4620
- linesAndNewlines.pop();
4621
- }
4622
- for (let i = 0;i < linesAndNewlines.length; i++) {
4623
- const line = linesAndNewlines[i];
4624
- if (i % 2 && !options.newlineIsToken) {
4625
- retLines[retLines.length - 1] += line;
4626
- } else {
4627
- retLines.push(line);
4628
- }
4629
- }
4630
- return retLines;
4631
- }
4632
-
4633
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/sentence.js
4634
- function isSentenceEndPunct(char) {
4635
- return char == "." || char == "!" || char == "?";
4636
- }
4637
-
4638
- class SentenceDiff extends Diff {
4639
- tokenize(value) {
4640
- var _a;
4641
- const result = [];
4642
- let tokenStartI = 0;
4643
- for (let i = 0;i < value.length; i++) {
4644
- if (i == value.length - 1) {
4645
- result.push(value.slice(tokenStartI));
4646
- break;
4647
- }
4648
- if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
4649
- result.push(value.slice(tokenStartI, i + 1));
4650
- i = tokenStartI = i + 1;
4651
- while ((_a = value[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
4652
- i++;
4653
- }
4654
- result.push(value.slice(tokenStartI, i + 1));
4655
- tokenStartI = i + 1;
4656
- }
4657
- }
4658
- return result;
4659
- }
4660
- }
4661
- var sentenceDiff = new SentenceDiff;
4662
-
4663
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/css.js
4664
- class CssDiff extends Diff {
4665
- tokenize(value) {
4666
- return value.split(/([{}:;,]|\s+)/);
4667
- }
4668
- }
4669
- var cssDiff = new CssDiff;
4670
-
4671
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/json.js
4672
- class JsonDiff extends Diff {
4673
- constructor() {
4674
- super(...arguments);
4675
- this.tokenize = tokenize;
4676
- }
4677
- get useLongestToken() {
4678
- return true;
4679
- }
4680
- castInput(value, options) {
4681
- const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options;
4682
- return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
4683
- }
4684
- equals(left, right, options) {
4685
- return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
4686
- }
4687
- }
4688
- var jsonDiff = new JsonDiff;
4689
- function canonicalize(obj, stack, replacementStack, replacer, key) {
4690
- stack = stack || [];
4691
- replacementStack = replacementStack || [];
4692
- if (replacer) {
4693
- obj = replacer(key === undefined ? "" : key, obj);
4694
- }
4695
- let i;
4696
- for (i = 0;i < stack.length; i += 1) {
4697
- if (stack[i] === obj) {
4698
- return replacementStack[i];
4699
- }
4700
- }
4701
- let canonicalizedObj;
4702
- if (Object.prototype.toString.call(obj) === "[object Array]") {
4703
- stack.push(obj);
4704
- canonicalizedObj = new Array(obj.length);
4705
- replacementStack.push(canonicalizedObj);
4706
- for (i = 0;i < obj.length; i += 1) {
4707
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
4708
- }
4709
- stack.pop();
4710
- replacementStack.pop();
4711
- return canonicalizedObj;
4712
- }
4713
- if (obj && obj.toJSON) {
4714
- obj = obj.toJSON();
4715
- }
4716
- if (typeof obj === "object" && obj !== null) {
4717
- stack.push(obj);
4718
- canonicalizedObj = {};
4719
- replacementStack.push(canonicalizedObj);
4720
- const sortedKeys = [];
4721
- let key2;
4722
- for (key2 in obj) {
4723
- if (Object.prototype.hasOwnProperty.call(obj, key2)) {
4724
- sortedKeys.push(key2);
4725
- }
4726
- }
4727
- sortedKeys.sort();
4728
- for (i = 0;i < sortedKeys.length; i += 1) {
4729
- key2 = sortedKeys[i];
4730
- canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
4731
- }
4732
- stack.pop();
4733
- replacementStack.pop();
4734
- } else {
4735
- canonicalizedObj = obj;
4736
- }
4737
- return canonicalizedObj;
4738
- }
4739
-
4740
- // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/diff/array.js
4741
- class ArrayDiff extends Diff {
4742
- tokenize(value) {
4743
- return value.slice();
4744
- }
4745
- join(value) {
4746
- return value;
4747
- }
4748
- removeEmpty(value) {
4749
- return value;
4750
- }
4751
- }
4752
- var arrayDiff = new ArrayDiff;
4753
-
4754
4143
  // ../../node_modules/.bun/diff@8.0.2/node_modules/diff/libesm/patch/parse.js
4755
4144
  function parsePatch(uniDiff) {
4756
4145
  const diffstr = uniDiff.split(/\n/), list = [];
@@ -4855,7 +4244,6 @@ function parsePatch(uniDiff) {
4855
4244
  }
4856
4245
  return list;
4857
4246
  }
4858
-
4859
4247
  // src/renderables/Text.ts
4860
4248
  class TextRenderable extends TextBufferRenderable {
4861
4249
  _text;
@@ -7171,6 +6559,7 @@ class TextTableRenderable extends Renderable {
7171
6559
  _content;
7172
6560
  _wrapMode;
7173
6561
  _columnWidthMode;
6562
+ _columnFitter;
7174
6563
  _cellPadding;
7175
6564
  _showBorders;
7176
6565
  _border;
@@ -7186,6 +6575,7 @@ class TextTableRenderable extends Renderable {
7186
6575
  _selectionBg;
7187
6576
  _selectionFg;
7188
6577
  _lastLocalSelection = null;
6578
+ _lastSelectionMode = null;
7189
6579
  _cells = [];
7190
6580
  _prevCellContent = [];
7191
6581
  _rowCount = 0;
@@ -7197,8 +6587,9 @@ class TextTableRenderable extends Renderable {
7197
6587
  _cachedMeasureWidth = undefined;
7198
6588
  _defaultOptions = {
7199
6589
  content: [],
7200
- wrapMode: "none",
7201
- columnWidthMode: "content",
6590
+ wrapMode: "word",
6591
+ columnWidthMode: "full",
6592
+ columnFitter: "proportional",
7202
6593
  cellPadding: 0,
7203
6594
  showBorders: true,
7204
6595
  border: true,
@@ -7215,10 +6606,11 @@ class TextTableRenderable extends Renderable {
7215
6606
  attributes: 0
7216
6607
  };
7217
6608
  constructor(ctx, options = {}) {
7218
- super(ctx, { ...options, buffered: true });
6609
+ super(ctx, { ...options, flexShrink: options.flexShrink ?? 0, buffered: true });
7219
6610
  this._content = options.content ?? this._defaultOptions.content;
7220
6611
  this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
7221
6612
  this._columnWidthMode = options.columnWidthMode ?? this._defaultOptions.columnWidthMode;
6613
+ this._columnFitter = this.resolveColumnFitter(options.columnFitter);
7222
6614
  this._cellPadding = this.resolveCellPadding(options.cellPadding);
7223
6615
  this._showBorders = options.showBorders ?? this._defaultOptions.showBorders;
7224
6616
  this._border = options.border ?? this._defaultOptions.border;
@@ -7267,6 +6659,16 @@ class TextTableRenderable extends Renderable {
7267
6659
  this._columnWidthMode = value;
7268
6660
  this.invalidateLayoutAndRaster();
7269
6661
  }
6662
+ get columnFitter() {
6663
+ return this._columnFitter;
6664
+ }
6665
+ set columnFitter(value) {
6666
+ const next = this.resolveColumnFitter(value);
6667
+ if (this._columnFitter === next)
6668
+ return;
6669
+ this._columnFitter = next;
6670
+ this.invalidateLayoutAndRaster();
6671
+ }
7270
6672
  get cellPadding() {
7271
6673
  return this._cellPadding;
7272
6674
  }
@@ -7344,6 +6746,7 @@ class TextTableRenderable extends Renderable {
7344
6746
  const dirtyRows = this.getDirtySelectionRowRange(previousLocalSelection, localSelection);
7345
6747
  if (!localSelection?.isActive) {
7346
6748
  this.resetCellSelections();
6749
+ this._lastSelectionMode = null;
7347
6750
  } else {
7348
6751
  this.applySelectionToCells(localSelection, selection?.isStart ?? false);
7349
6752
  }
@@ -7419,7 +6822,7 @@ class TextTableRenderable extends Renderable {
7419
6822
  super.destroySelf();
7420
6823
  }
7421
6824
  setupMeasureFunc() {
7422
- const measureFunc = (width, widthMode, height, heightMode) => {
6825
+ const measureFunc = (width, widthMode, _height, _heightMode) => {
7423
6826
  const hasWidthConstraint = widthMode !== MeasureMode.Undefined && Number.isFinite(width);
7424
6827
  const rawWidthConstraint = hasWidthConstraint ? Math.max(1, Math.floor(width)) : undefined;
7425
6828
  const widthConstraint = this.resolveLayoutWidthConstraint(rawWidthConstraint);
@@ -7431,9 +6834,6 @@ class TextTableRenderable extends Renderable {
7431
6834
  if (widthMode === MeasureMode.AtMost && rawWidthConstraint !== undefined && this._positionType !== "absolute") {
7432
6835
  measuredWidth = Math.min(rawWidthConstraint, measuredWidth);
7433
6836
  }
7434
- if (heightMode === MeasureMode.AtMost && Number.isFinite(height) && this._positionType !== "absolute") {
7435
- measuredHeight = Math.min(Math.max(1, Math.floor(height)), measuredHeight);
7436
- }
7437
6837
  return {
7438
6838
  width: measuredWidth,
7439
6839
  height: measuredHeight
@@ -7605,6 +7005,9 @@ class TextTableRenderable extends Renderable {
7605
7005
  tableHeight: (rowOffsets[rowOffsets.length - 1] ?? 0) + 1
7606
7006
  };
7607
7007
  }
7008
+ isFullWidthMode() {
7009
+ return this._columnWidthMode === "full";
7010
+ }
7608
7011
  computeColumnWidths(maxTableWidth, borderLayout) {
7609
7012
  const horizontalPadding = this.getHorizontalCellPadding();
7610
7013
  const intrinsicWidths = new Array(this._columnCount).fill(1 + horizontalPadding);
@@ -7627,7 +7030,7 @@ class TextTableRenderable extends Renderable {
7627
7030
  return intrinsicWidths;
7628
7031
  }
7629
7032
  if (currentWidth < maxContentWidth) {
7630
- if (this._columnWidthMode === "fill") {
7033
+ if (this.isFullWidthMode()) {
7631
7034
  return this.expandColumnWidths(intrinsicWidths, maxContentWidth);
7632
7035
  }
7633
7036
  return intrinsicWidths;
@@ -7657,6 +7060,12 @@ class TextTableRenderable extends Renderable {
7657
7060
  return expanded;
7658
7061
  }
7659
7062
  fitColumnWidths(widths, targetContentWidth) {
7063
+ if (this._columnFitter === "balanced") {
7064
+ return this.fitColumnWidthsBalanced(widths, targetContentWidth);
7065
+ }
7066
+ return this.fitColumnWidthsProportional(widths, targetContentWidth);
7067
+ }
7068
+ fitColumnWidthsProportional(widths, targetContentWidth) {
7660
7069
  const minWidth = 1 + this.getHorizontalCellPadding();
7661
7070
  const hardMinWidths = new Array(widths.length).fill(minWidth);
7662
7071
  const baseWidths = widths.map((width) => Math.max(1, Math.floor(width)));
@@ -7707,6 +7116,80 @@ class TextTableRenderable extends Renderable {
7707
7116
  }
7708
7117
  return baseWidths.map((width, idx) => Math.max(floorWidths[idx], width - integerShrink[idx]));
7709
7118
  }
7119
+ fitColumnWidthsBalanced(widths, targetContentWidth) {
7120
+ const minWidth = 1 + this.getHorizontalCellPadding();
7121
+ const hardMinWidths = new Array(widths.length).fill(minWidth);
7122
+ const baseWidths = widths.map((width) => Math.max(1, Math.floor(width)));
7123
+ const totalBaseWidth = baseWidths.reduce((sum, width) => sum + width, 0);
7124
+ const columns = baseWidths.length;
7125
+ if (columns === 0 || totalBaseWidth <= targetContentWidth) {
7126
+ return baseWidths;
7127
+ }
7128
+ const evenShare = Math.max(minWidth, Math.floor(targetContentWidth / columns));
7129
+ const preferredMinWidths = baseWidths.map((width) => Math.min(width, evenShare));
7130
+ const preferredMinTotal = preferredMinWidths.reduce((sum, width) => sum + width, 0);
7131
+ const floorWidths = preferredMinTotal <= targetContentWidth ? preferredMinWidths : hardMinWidths;
7132
+ const floorTotal = floorWidths.reduce((sum, width) => sum + width, 0);
7133
+ const clampedTarget = Math.max(floorTotal, targetContentWidth);
7134
+ if (totalBaseWidth <= clampedTarget) {
7135
+ return baseWidths;
7136
+ }
7137
+ const shrinkable = baseWidths.map((width, idx) => width - floorWidths[idx]);
7138
+ const totalShrinkable = shrinkable.reduce((sum, value) => sum + value, 0);
7139
+ if (totalShrinkable <= 0) {
7140
+ return [...floorWidths];
7141
+ }
7142
+ const targetShrink = totalBaseWidth - clampedTarget;
7143
+ const shrink = this.allocateShrinkByWeight(shrinkable, targetShrink, "sqrt");
7144
+ return baseWidths.map((width, idx) => Math.max(floorWidths[idx], width - shrink[idx]));
7145
+ }
7146
+ allocateShrinkByWeight(shrinkable, targetShrink, mode) {
7147
+ const shrink = new Array(shrinkable.length).fill(0);
7148
+ if (targetShrink <= 0) {
7149
+ return shrink;
7150
+ }
7151
+ const weights = shrinkable.map((value) => {
7152
+ if (value <= 0) {
7153
+ return 0;
7154
+ }
7155
+ return mode === "sqrt" ? Math.sqrt(value) : value;
7156
+ });
7157
+ const totalWeight = weights.reduce((sum, value) => sum + value, 0);
7158
+ if (totalWeight <= 0) {
7159
+ return shrink;
7160
+ }
7161
+ const fractions = new Array(shrinkable.length).fill(0);
7162
+ let usedShrink = 0;
7163
+ for (let idx = 0;idx < shrinkable.length; idx++) {
7164
+ if (shrinkable[idx] <= 0 || weights[idx] <= 0)
7165
+ continue;
7166
+ const exact = weights[idx] / totalWeight * targetShrink;
7167
+ const whole = Math.min(shrinkable[idx], Math.floor(exact));
7168
+ shrink[idx] = whole;
7169
+ fractions[idx] = exact - whole;
7170
+ usedShrink += whole;
7171
+ }
7172
+ let remainingShrink = targetShrink - usedShrink;
7173
+ while (remainingShrink > 0) {
7174
+ let bestIdx = -1;
7175
+ let bestFraction = -1;
7176
+ for (let idx = 0;idx < shrinkable.length; idx++) {
7177
+ if (shrinkable[idx] - shrink[idx] <= 0)
7178
+ continue;
7179
+ if (bestIdx === -1 || fractions[idx] > bestFraction || fractions[idx] === bestFraction && shrinkable[idx] > shrinkable[bestIdx]) {
7180
+ bestIdx = idx;
7181
+ bestFraction = fractions[idx];
7182
+ }
7183
+ }
7184
+ if (bestIdx === -1) {
7185
+ break;
7186
+ }
7187
+ shrink[bestIdx] += 1;
7188
+ fractions[bestIdx] = 0;
7189
+ remainingShrink -= 1;
7190
+ }
7191
+ return shrink;
7192
+ }
7710
7193
  computeRowHeights(columnWidths) {
7711
7194
  const horizontalPadding = this.getHorizontalCellPadding();
7712
7195
  const verticalPadding = this.getVerticalCellPadding();
@@ -7876,6 +7359,10 @@ class TextTableRenderable extends Renderable {
7876
7359
  const maxSelY = Math.max(localSelection.anchorY, localSelection.focusY);
7877
7360
  const firstRow = this.findRowForLocalY(minSelY);
7878
7361
  const lastRow = this.findRowForLocalY(maxSelY);
7362
+ const selection = this.resolveSelectionResolution(localSelection);
7363
+ const modeChanged = this._lastSelectionMode !== selection.mode;
7364
+ this._lastSelectionMode = selection.mode;
7365
+ const lockToAnchorColumn = selection.mode === "column-locked" && selection.anchorColumn !== null;
7879
7366
  for (let rowIdx = 0;rowIdx < this._rowCount; rowIdx++) {
7880
7367
  if (rowIdx < firstRow || rowIdx > lastRow) {
7881
7368
  this.resetRowSelection(rowIdx);
@@ -7886,19 +7373,82 @@ class TextTableRenderable extends Renderable {
7886
7373
  const cell = this._cells[rowIdx]?.[colIdx];
7887
7374
  if (!cell)
7888
7375
  continue;
7376
+ if (lockToAnchorColumn && colIdx !== selection.anchorColumn) {
7377
+ cell.textBufferView.resetLocalSelection();
7378
+ continue;
7379
+ }
7889
7380
  const cellLeft = (this._layout.columnOffsets[colIdx] ?? 0) + 1 + this._cellPadding;
7890
- const anchorX = localSelection.anchorX - cellLeft;
7891
- const anchorY = localSelection.anchorY - cellTop;
7892
- const focusX = localSelection.focusX - cellLeft;
7893
- const focusY = localSelection.focusY - cellTop;
7894
- if (isStart) {
7895
- cell.textBufferView.setLocalSelection(anchorX, anchorY, focusX, focusY, this._selectionBg, this._selectionFg);
7381
+ let coords = {
7382
+ anchorX: localSelection.anchorX - cellLeft,
7383
+ anchorY: localSelection.anchorY - cellTop,
7384
+ focusX: localSelection.focusX - cellLeft,
7385
+ focusY: localSelection.focusY - cellTop
7386
+ };
7387
+ const isAnchorCell = selection.anchorCell !== null && selection.anchorCell.rowIdx === rowIdx && selection.anchorCell.colIdx === colIdx;
7388
+ const forceSet = isAnchorCell && selection.mode !== "single-cell";
7389
+ if (forceSet) {
7390
+ coords = this.getFullCellSelectionCoords(rowIdx, colIdx);
7391
+ }
7392
+ const shouldUseSet = isStart || modeChanged || forceSet;
7393
+ if (shouldUseSet) {
7394
+ cell.textBufferView.setLocalSelection(coords.anchorX, coords.anchorY, coords.focusX, coords.focusY, this._selectionBg, this._selectionFg);
7896
7395
  } else {
7897
- cell.textBufferView.updateLocalSelection(anchorX, anchorY, focusX, focusY, this._selectionBg, this._selectionFg);
7396
+ cell.textBufferView.updateLocalSelection(coords.anchorX, coords.anchorY, coords.focusX, coords.focusY, this._selectionBg, this._selectionFg);
7898
7397
  }
7899
7398
  }
7900
7399
  }
7901
7400
  }
7401
+ resolveSelectionResolution(localSelection) {
7402
+ const anchorCell = this.getCellAtLocalPosition(localSelection.anchorX, localSelection.anchorY);
7403
+ const focusCell = this.getCellAtLocalPosition(localSelection.focusX, localSelection.focusY);
7404
+ const anchorColumn = anchorCell?.colIdx ?? this.getColumnAtLocalX(localSelection.anchorX);
7405
+ if (anchorCell !== null && focusCell !== null && anchorCell.rowIdx === focusCell.rowIdx && anchorCell.colIdx === focusCell.colIdx) {
7406
+ return {
7407
+ mode: "single-cell",
7408
+ anchorCell,
7409
+ anchorColumn
7410
+ };
7411
+ }
7412
+ const focusColumn = this.getColumnAtLocalX(localSelection.focusX);
7413
+ if (anchorColumn !== null && focusColumn === anchorColumn) {
7414
+ return {
7415
+ mode: "column-locked",
7416
+ anchorCell,
7417
+ anchorColumn
7418
+ };
7419
+ }
7420
+ return {
7421
+ mode: "grid",
7422
+ anchorCell,
7423
+ anchorColumn
7424
+ };
7425
+ }
7426
+ getColumnAtLocalX(localX) {
7427
+ if (this._columnCount === 0)
7428
+ return null;
7429
+ if (localX < 0 || localX >= this._layout.tableWidth)
7430
+ return null;
7431
+ for (let colIdx = 0;colIdx < this._columnCount; colIdx++) {
7432
+ const colStart = (this._layout.columnOffsets[colIdx] ?? 0) + 1;
7433
+ const colEnd = colStart + (this._layout.columnWidths[colIdx] ?? 1) - 1;
7434
+ if (localX >= colStart && localX <= colEnd) {
7435
+ return colIdx;
7436
+ }
7437
+ }
7438
+ return null;
7439
+ }
7440
+ getFullCellSelectionCoords(rowIdx, colIdx) {
7441
+ const colWidth = this._layout.columnWidths[colIdx] ?? 1;
7442
+ const rowHeight = this._layout.rowHeights[rowIdx] ?? 1;
7443
+ const contentWidth = Math.max(1, colWidth - this.getHorizontalCellPadding());
7444
+ const contentHeight = Math.max(1, rowHeight - this.getVerticalCellPadding());
7445
+ return {
7446
+ anchorX: -1,
7447
+ anchorY: 0,
7448
+ focusX: contentWidth,
7449
+ focusY: contentHeight
7450
+ };
7451
+ }
7902
7452
  findRowForLocalY(localY) {
7903
7453
  if (this._rowCount === 0)
7904
7454
  return 0;
@@ -7939,8 +7489,6 @@ class TextTableRenderable extends Renderable {
7939
7489
  if (!row)
7940
7490
  return;
7941
7491
  for (const cell of row) {
7942
- if (!cell.textBufferView.hasSelection())
7943
- continue;
7944
7492
  cell.textBufferView.resetLocalSelection();
7945
7493
  }
7946
7494
  }
@@ -7965,7 +7513,7 @@ class TextTableRenderable extends Renderable {
7965
7513
  if (width === undefined || !Number.isFinite(width) || width <= 0) {
7966
7514
  return;
7967
7515
  }
7968
- if (this._wrapMode !== "none" || this._columnWidthMode === "fill") {
7516
+ if (this._wrapMode !== "none" || this.isFullWidthMode()) {
7969
7517
  return Math.max(1, Math.floor(width));
7970
7518
  }
7971
7519
  return;
@@ -7976,6 +7524,12 @@ class TextTableRenderable extends Renderable {
7976
7524
  getVerticalCellPadding() {
7977
7525
  return this._cellPadding * 2;
7978
7526
  }
7527
+ resolveColumnFitter(value) {
7528
+ if (value === undefined) {
7529
+ return this._defaultOptions.columnFitter;
7530
+ }
7531
+ return value === "balanced" ? "balanced" : "proportional";
7532
+ }
7979
7533
  resolveCellPadding(value) {
7980
7534
  if (value === undefined || !Number.isFinite(value)) {
7981
7535
  return this._defaultOptions.cellPadding;
@@ -9308,6 +8862,7 @@ class MarkdownRenderable extends Renderable {
9308
8862
  _syntaxStyle;
9309
8863
  _conceal;
9310
8864
  _treeSitterClient;
8865
+ _tableOptions;
9311
8866
  _renderNode;
9312
8867
  _parseState = null;
9313
8868
  _streaming = false;
@@ -9328,6 +8883,7 @@ class MarkdownRenderable extends Renderable {
9328
8883
  this._conceal = options.conceal ?? this._contentDefaultOptions.conceal;
9329
8884
  this._content = options.content ?? this._contentDefaultOptions.content;
9330
8885
  this._treeSitterClient = options.treeSitterClient;
8886
+ this._tableOptions = options.tableOptions;
9331
8887
  this._renderNode = options.renderNode;
9332
8888
  this._streaming = options.streaming ?? this._contentDefaultOptions.streaming;
9333
8889
  this.updateBlocks();
@@ -9369,6 +8925,13 @@ class MarkdownRenderable extends Renderable {
9369
8925
  this.clearCache();
9370
8926
  }
9371
8927
  }
8928
+ get tableOptions() {
8929
+ return this._tableOptions;
8930
+ }
8931
+ set tableOptions(value) {
8932
+ this._tableOptions = value;
8933
+ this.applyTableOptionsToBlocks();
8934
+ }
9372
8935
  getStyle(group) {
9373
8936
  if (!this._syntaxStyle)
9374
8937
  return;
@@ -9744,18 +9307,63 @@ class MarkdownRenderable extends Renderable {
9744
9307
  changed
9745
9308
  };
9746
9309
  }
9310
+ resolveTableRenderableOptions() {
9311
+ const borders = this._tableOptions?.borders ?? true;
9312
+ return {
9313
+ columnWidthMode: this._tableOptions?.widthMode ?? "full",
9314
+ columnFitter: this._tableOptions?.columnFitter ?? "proportional",
9315
+ wrapMode: this._tableOptions?.wrapMode ?? "word",
9316
+ cellPadding: this._tableOptions?.cellPadding ?? 0,
9317
+ border: borders,
9318
+ outerBorder: this._tableOptions?.outerBorder ?? borders,
9319
+ showBorders: borders,
9320
+ borderStyle: this._tableOptions?.borderStyle ?? "single",
9321
+ borderColor: this._tableOptions?.borderColor ?? this.getStyle("conceal")?.fg ?? "#888888",
9322
+ selectable: this._tableOptions?.selectable ?? true
9323
+ };
9324
+ }
9325
+ applyTableRenderableOptions(tableRenderable, options) {
9326
+ tableRenderable.columnWidthMode = options.columnWidthMode;
9327
+ tableRenderable.columnFitter = options.columnFitter;
9328
+ tableRenderable.wrapMode = options.wrapMode;
9329
+ tableRenderable.cellPadding = options.cellPadding;
9330
+ tableRenderable.border = options.border;
9331
+ tableRenderable.outerBorder = options.outerBorder;
9332
+ tableRenderable.showBorders = options.showBorders;
9333
+ tableRenderable.borderStyle = options.borderStyle;
9334
+ tableRenderable.borderColor = options.borderColor;
9335
+ tableRenderable.selectable = options.selectable;
9336
+ }
9337
+ applyTableOptionsToBlocks() {
9338
+ const options = this.resolveTableRenderableOptions();
9339
+ let updated = false;
9340
+ for (const state of this._blockStates) {
9341
+ if (state.renderable instanceof TextTableRenderable) {
9342
+ this.applyTableRenderableOptions(state.renderable, options);
9343
+ updated = true;
9344
+ }
9345
+ }
9346
+ if (updated) {
9347
+ this.requestRender();
9348
+ }
9349
+ }
9747
9350
  createTextTableRenderable(content, id, marginBottom = 0) {
9351
+ const options = this.resolveTableRenderableOptions();
9748
9352
  return new TextTableRenderable(this.ctx, {
9749
9353
  id,
9750
9354
  content,
9751
9355
  width: "100%",
9752
9356
  marginBottom,
9753
- border: true,
9754
- outerBorder: true,
9755
- showBorders: true,
9756
- borderStyle: "single",
9757
- borderColor: this.getStyle("conceal")?.fg ?? "#888888",
9758
- selectable: false
9357
+ columnWidthMode: options.columnWidthMode,
9358
+ columnFitter: options.columnFitter,
9359
+ wrapMode: options.wrapMode,
9360
+ cellPadding: options.cellPadding,
9361
+ border: options.border,
9362
+ outerBorder: options.outerBorder,
9363
+ showBorders: options.showBorders,
9364
+ borderStyle: options.borderStyle,
9365
+ borderColor: options.borderColor,
9366
+ selectable: options.selectable
9759
9367
  });
9760
9368
  }
9761
9369
  createTableBlock(table, id, marginBottom = 0, previousCache, forceRegenerate = false) {
@@ -9824,7 +9432,7 @@ class MarkdownRenderable extends Renderable {
9824
9432
  if (changed) {
9825
9433
  state.renderable.content = cache.content;
9826
9434
  }
9827
- state.renderable.borderColor = this.getStyle("conceal")?.fg ?? "#888888";
9435
+ this.applyTableRenderableOptions(state.renderable, this.resolveTableRenderableOptions());
9828
9436
  state.renderable.marginBottom = marginBottom;
9829
9437
  state.tableContentCache = cache;
9830
9438
  return;
@@ -9968,7 +9576,7 @@ class MarkdownRenderable extends Renderable {
9968
9576
  state.tableContentCache = undefined;
9969
9577
  } else if (state.renderable instanceof TextTableRenderable) {
9970
9578
  state.renderable.content = cache.content;
9971
- state.renderable.borderColor = this.getStyle("conceal")?.fg ?? "#888888";
9579
+ this.applyTableRenderableOptions(state.renderable, this.resolveTableRenderableOptions());
9972
9580
  state.renderable.marginBottom = marginBottom;
9973
9581
  state.tableContentCache = cache;
9974
9582
  } else {
@@ -10609,6 +10217,34 @@ class ContentRenderable extends BoxRenderable {
10609
10217
  return this.getChildrenSortedByPrimaryAxis().map((child) => child.num);
10610
10218
  }
10611
10219
  }
10220
+ var SCROLLBOX_PADDING_KEYS = [
10221
+ "padding",
10222
+ "paddingX",
10223
+ "paddingY",
10224
+ "paddingTop",
10225
+ "paddingRight",
10226
+ "paddingBottom",
10227
+ "paddingLeft"
10228
+ ];
10229
+ function pickScrollBoxPadding(options) {
10230
+ if (!options)
10231
+ return {};
10232
+ const picked = {};
10233
+ for (const key of SCROLLBOX_PADDING_KEYS) {
10234
+ const value = options[key];
10235
+ if (value !== undefined) {
10236
+ picked[key] = value;
10237
+ }
10238
+ }
10239
+ return picked;
10240
+ }
10241
+ function stripScrollBoxPadding(options) {
10242
+ const sanitized = { ...options };
10243
+ for (const key of SCROLLBOX_PADDING_KEYS) {
10244
+ delete sanitized[key];
10245
+ }
10246
+ return sanitized;
10247
+ }
10612
10248
 
10613
10249
  class ScrollBoxRenderable extends BoxRenderable {
10614
10250
  static idCounter = 0;
@@ -10756,27 +10392,38 @@ class ScrollBoxRenderable extends BoxRenderable {
10756
10392
  this._isApplyingStickyScroll = wasApplyingStickyScroll;
10757
10393
  }
10758
10394
  }
10759
- constructor(ctx, {
10760
- wrapperOptions,
10761
- viewportOptions,
10762
- contentOptions,
10763
- rootOptions,
10764
- scrollbarOptions,
10765
- verticalScrollbarOptions,
10766
- horizontalScrollbarOptions,
10767
- stickyScroll = false,
10768
- stickyStart,
10769
- scrollX = false,
10770
- scrollY = true,
10771
- scrollAcceleration,
10772
- viewportCulling = true,
10773
- ...options
10774
- }) {
10395
+ constructor(ctx, options) {
10396
+ const {
10397
+ wrapperOptions,
10398
+ viewportOptions,
10399
+ contentOptions,
10400
+ rootOptions,
10401
+ scrollbarOptions,
10402
+ verticalScrollbarOptions,
10403
+ horizontalScrollbarOptions,
10404
+ stickyScroll = false,
10405
+ stickyStart,
10406
+ scrollX = false,
10407
+ scrollY = true,
10408
+ scrollAcceleration,
10409
+ viewportCulling = true,
10410
+ ...rootBoxOptions
10411
+ } = options;
10412
+ const forwardedContentPadding = {
10413
+ ...pickScrollBoxPadding(rootBoxOptions),
10414
+ ...pickScrollBoxPadding(rootOptions)
10415
+ };
10416
+ const sanitizedRootBoxOptions = stripScrollBoxPadding(rootBoxOptions);
10417
+ const sanitizedRootOptions = rootOptions ? stripScrollBoxPadding(rootOptions) : undefined;
10418
+ const mergedContentOptions = {
10419
+ ...forwardedContentPadding,
10420
+ ...contentOptions
10421
+ };
10775
10422
  super(ctx, {
10776
10423
  flexDirection: "row",
10777
10424
  alignItems: "stretch",
10778
- ...options,
10779
- ...rootOptions
10425
+ ...sanitizedRootBoxOptions,
10426
+ ...sanitizedRootOptions
10780
10427
  });
10781
10428
  this.internalId = ScrollBoxRenderable.idCounter++;
10782
10429
  this._stickyScroll = stickyScroll;
@@ -10808,7 +10455,7 @@ class ScrollBoxRenderable extends BoxRenderable {
10808
10455
  onSizeChange: () => {
10809
10456
  this.recalculateBarProps();
10810
10457
  },
10811
- ...contentOptions,
10458
+ ...mergedContentOptions,
10812
10459
  id: `scroll-box-content-${this.internalId}`
10813
10460
  });
10814
10461
  this.viewport.add(this.content);
@@ -11124,6 +10771,34 @@ class ScrollBoxRenderable extends BoxRenderable {
11124
10771
  this.requestRender();
11125
10772
  });
11126
10773
  }
10774
+ set padding(value) {
10775
+ this.content.padding = value;
10776
+ this.requestRender();
10777
+ }
10778
+ set paddingX(value) {
10779
+ this.content.paddingX = value;
10780
+ this.requestRender();
10781
+ }
10782
+ set paddingY(value) {
10783
+ this.content.paddingY = value;
10784
+ this.requestRender();
10785
+ }
10786
+ set paddingTop(value) {
10787
+ this.content.paddingTop = value;
10788
+ this.requestRender();
10789
+ }
10790
+ set paddingRight(value) {
10791
+ this.content.paddingRight = value;
10792
+ this.requestRender();
10793
+ }
10794
+ set paddingBottom(value) {
10795
+ this.content.paddingBottom = value;
10796
+ this.requestRender();
10797
+ }
10798
+ set paddingLeft(value) {
10799
+ this.content.paddingLeft = value;
10800
+ this.requestRender();
10801
+ }
11127
10802
  set rootOptions(options) {
11128
10803
  Object.assign(this, options);
11129
10804
  this.requestRender();
@@ -12088,5 +11763,5 @@ export {
12088
11763
  ASCIIFont
12089
11764
  };
12090
11765
 
12091
- //# debugId=115C19DFB6D5E10364756E2164756E21
11766
+ //# debugId=3C6B494E292F6AEE64756E2164756E21
12092
11767
  //# sourceMappingURL=index.js.map