@opentui/core 0.6.8 → 0.8.0

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.
Files changed (60) hide show
  1. package/NativeScene.d.ts +14 -29
  2. package/Renderable.d.ts +47 -34
  3. package/animation/Timeline.d.ts +9 -0
  4. package/audio.d.ts +1 -0
  5. package/buffer.d.ts +6 -2
  6. package/{chunk-bun-4e5bpeqh.js → chunk-bun-6kxdhkdc.js} +1243 -1034
  7. package/chunk-bun-6kxdhkdc.js.map +70 -0
  8. package/{chunk-bun-ehr9v0n8.js → chunk-bun-x6cz4jyg.js} +514 -84
  9. package/chunk-bun-x6cz4jyg.js.map +35 -0
  10. package/{chunk-node-yyjd8p1g.js → chunk-node-q5ccgbk5.js} +1243 -1034
  11. package/chunk-node-q5ccgbk5.js.map +70 -0
  12. package/{chunk-node-jhq62x0c.js → chunk-node-y0w0hq5m.js} +514 -84
  13. package/chunk-node-y0w0hq5m.js.map +34 -0
  14. package/edit-buffer.d.ts +4 -0
  15. package/index.bun.js +1086 -549
  16. package/index.bun.js.map +15 -13
  17. package/index.d.ts +1 -1
  18. package/index.node.js +1086 -549
  19. package/index.node.js.map +16 -12
  20. package/lib/detect-links.d.ts +2 -0
  21. package/lib/extmarks.d.ts +3 -1
  22. package/lib/parse.keypress-kitty.d.ts +2 -0
  23. package/lib/scroll-chain.d.ts +16 -0
  24. package/lib/stdin-parser-native.d.ts +90 -0
  25. package/lib/stdin-parser.d.ts +2 -0
  26. package/lib/terminal-capability-detection.d.ts +6 -1
  27. package/native-abi.generated.d.ts +700 -7
  28. package/package.json +9 -9
  29. package/renderables/Box.d.ts +2 -2
  30. package/renderables/Code.d.ts +2 -1
  31. package/renderables/Diff.d.ts +2 -2
  32. package/renderables/EditBufferRenderable.d.ts +2 -2
  33. package/renderables/EmbeddedTerminal.d.ts +2 -2
  34. package/renderables/FrameBuffer.d.ts +4 -3
  35. package/renderables/Image.d.ts +2 -2
  36. package/renderables/Markdown.d.ts +2 -2
  37. package/renderables/ScrollBar.d.ts +9 -3
  38. package/renderables/ScrollBox.d.ts +87 -44
  39. package/renderables/ScrollBoxParts.d.ts +165 -0
  40. package/renderables/Slider.d.ts +2 -2
  41. package/renderables/Text.d.ts +2 -2
  42. package/renderables/TextBufferRenderable.d.ts +2 -4
  43. package/renderables/index.d.ts +1 -1
  44. package/renderer-theme-mode.d.ts +1 -6
  45. package/renderer.d.ts +30 -7
  46. package/testing/test-renderer.d.ts +4 -0
  47. package/testing.bun.js +12 -4
  48. package/testing.bun.js.map +3 -3
  49. package/testing.js +12 -4
  50. package/testing.js.map +3 -3
  51. package/types.d.ts +11 -0
  52. package/yoga.bun.js +1 -1
  53. package/yoga.internal.d.ts +3 -3
  54. package/yoga.js +1 -1
  55. package/zig-structs.d.ts +26 -0
  56. package/zig.d.ts +96 -13
  57. package/chunk-bun-4e5bpeqh.js.map +0 -69
  58. package/chunk-bun-ehr9v0n8.js.map +0 -35
  59. package/chunk-node-jhq62x0c.js.map +0 -34
  60. package/chunk-node-yyjd8p1g.js.map +0 -69
package/index.bun.js CHANGED
@@ -67,6 +67,12 @@ import {
67
67
  bg2,
68
68
  link2,
69
69
  t2,
70
+ YogaEnumKind,
71
+ YogaFloatKind,
72
+ YogaValueKind,
73
+ sceneSetEnum,
74
+ sceneSetFloat,
75
+ sceneSetValue,
70
76
  SpanInfoStruct,
71
77
  NativeAudioStreamFormat2,
72
78
  NativeAudioStreamState2,
@@ -85,11 +91,13 @@ import {
85
91
  NativeEditorSelectionOperation2,
86
92
  NativeEditorPositionQuery2,
87
93
  NativeEditEvent2,
94
+ NativeStyleFlags,
88
95
  NATIVE_EDGE_NONE2,
89
96
  NativeBorder2,
90
97
  NativeSceneHook2,
91
98
  NativeSceneFrame2,
92
99
  NativeScenePaintPhase2,
100
+ emptySceneScrollState,
93
101
  NATIVE_BUFFER_TEXT_BYTES_MAX2,
94
102
  NativeSessionState2,
95
103
  NativeSessionRenderStatus2,
@@ -108,9 +116,12 @@ import {
108
116
  FFIRenderLib2,
109
117
  setRenderLibPath2,
110
118
  resolveRenderLib2,
119
+ Edge2,
120
+ FlexDirection2,
121
+ Gutter2,
111
122
  MeasureMode2,
112
123
  exports_yoga
113
- } from "./chunk-bun-ehr9v0n8.js";
124
+ } from "./chunk-bun-x6cz4jyg.js";
114
125
  import {
115
126
  isValidBorderStyle2,
116
127
  parseBorderStyle2,
@@ -128,8 +139,6 @@ import {
128
139
  getCharacterPositions2,
129
140
  coordinateToCharacterIndex2,
130
141
  renderFontToFrameBuffer2,
131
- convertThemeToStyles2,
132
- SyntaxStyle2,
133
142
  hastToStyledText2,
134
143
  SystemClock2,
135
144
  nonAlphanumericKeys2,
@@ -210,6 +219,8 @@ import {
210
219
  getTimelineEngine2,
211
220
  createTimeline2,
212
221
  BoxRenderable2,
222
+ wheelDirection,
223
+ scrollOnce,
213
224
  TextBufferRenderable2,
214
225
  CodeRenderable2,
215
226
  ImageLoadError2,
@@ -242,7 +253,237 @@ import {
242
253
  CliRenderEvents2,
243
254
  RendererControlState2,
244
255
  CliRenderer2
245
- } from "./chunk-bun-4e5bpeqh.js";
256
+ } from "./chunk-bun-6kxdhkdc.js";
257
+ // src/syntax-style.ts
258
+ function cloneStyle(style) {
259
+ return {
260
+ ...style,
261
+ fg: style.fg ? RGBA2.clone(style.fg) : undefined,
262
+ bg: style.bg ? RGBA2.clone(style.bg) : undefined
263
+ };
264
+ }
265
+ function convertThemeToStyles(theme) {
266
+ const flatStyles = {};
267
+ for (const tokenStyle of theme) {
268
+ const styleDefinition = {};
269
+ if (tokenStyle.style.foreground) {
270
+ styleDefinition.fg = parseColor2(tokenStyle.style.foreground);
271
+ }
272
+ if (tokenStyle.style.background) {
273
+ styleDefinition.bg = parseColor2(tokenStyle.style.background);
274
+ }
275
+ if (tokenStyle.style.bold !== undefined) {
276
+ styleDefinition.bold = tokenStyle.style.bold;
277
+ }
278
+ if (tokenStyle.style.italic !== undefined) {
279
+ styleDefinition.italic = tokenStyle.style.italic;
280
+ }
281
+ if (tokenStyle.style.underline !== undefined) {
282
+ styleDefinition.underline = tokenStyle.style.underline;
283
+ }
284
+ if (tokenStyle.style.dim !== undefined) {
285
+ styleDefinition.dim = tokenStyle.style.dim;
286
+ }
287
+ for (const scope of tokenStyle.scope) {
288
+ flatStyles[scope] = cloneStyle(styleDefinition);
289
+ }
290
+ }
291
+ return flatStyles;
292
+ }
293
+
294
+ class SyntaxStyle {
295
+ lib;
296
+ native;
297
+ _destroyed = false;
298
+ nameCache = new Map;
299
+ styleDefs = new Map;
300
+ mergedCache = new Map;
301
+ constructor(lib, handle, source) {
302
+ const owner = source?.resourceContext;
303
+ if (!owner)
304
+ throw new Error("SyntaxStyle requires an explicit resource owner");
305
+ owner.assertAlive();
306
+ if (owner.renderLib !== lib || !handle || typeof handle !== "object" || handle.context !== owner.context) {
307
+ throw new Error("SyntaxStyle Context owner mismatch");
308
+ }
309
+ this.lib = lib;
310
+ this.native = { owner, handle };
311
+ }
312
+ static create(source) {
313
+ const owner = source?.resourceContext;
314
+ if (!owner)
315
+ throw new Error("SyntaxStyle requires an explicit resource owner: pass renderer.nativeScene, or a ResourceContext when there is no renderer");
316
+ owner.assertAlive();
317
+ const lib = owner.renderLib;
318
+ const handle = lib.createContextSyntaxStyle(owner.context);
319
+ try {
320
+ return new SyntaxStyle(lib, handle, owner);
321
+ } catch (error) {
322
+ lib.destroyContextSyntaxStyle(owner.context, handle);
323
+ throw error;
324
+ }
325
+ }
326
+ static fromTheme(theme, owner) {
327
+ return SyntaxStyle.fromStyles(convertThemeToStyles(theme), owner);
328
+ }
329
+ static fromStyles(styles, owner) {
330
+ const style = SyntaxStyle.create(owner);
331
+ try {
332
+ for (const [name, styleDef] of styles instanceof Map ? styles : Object.entries(styles)) {
333
+ style.registerStyle(name, styleDef);
334
+ }
335
+ return style;
336
+ } catch (error) {
337
+ style.destroy();
338
+ throw error;
339
+ }
340
+ }
341
+ guard() {
342
+ if (this._destroyed)
343
+ throw new Error("NativeSyntaxStyle is destroyed");
344
+ this.native.owner.assertAlive();
345
+ }
346
+ _getSceneHandle(scene) {
347
+ this.guard();
348
+ if (this.native.owner !== scene.resourceContext)
349
+ throw new Error("SyntaxStyle owner mismatch: bind definitions in the destination Context");
350
+ return this.native.handle;
351
+ }
352
+ registerStyle(name, style) {
353
+ this.guard();
354
+ const { bold, italic, underline, dim, fg: foreground, bg: background } = style;
355
+ const definition = {
356
+ bold,
357
+ italic,
358
+ underline,
359
+ dim,
360
+ fg: foreground ? RGBA2.clone(parseColor2(foreground)) : undefined,
361
+ bg: background ? RGBA2.clone(parseColor2(background)) : undefined
362
+ };
363
+ const attributes = createTextAttributes2(definition);
364
+ const fg = definition.fg ?? null;
365
+ const bg = definition.bg ?? null;
366
+ return this.lib.getYogaHost().runMutation(() => {
367
+ const id = this.lib.contextSyntaxStyleRegister(this.native.handle.context, this.native.handle, name, {
368
+ fg,
369
+ bg,
370
+ attributes
371
+ });
372
+ this.nameCache.set(name, id);
373
+ this.styleDefs.set(name, definition);
374
+ this.mergedCache.clear();
375
+ return id;
376
+ });
377
+ }
378
+ resolveStyleId(name) {
379
+ this.guard();
380
+ const cached = this.nameCache.get(name);
381
+ if (cached !== undefined)
382
+ return cached;
383
+ const id = this.lib.contextSyntaxStyleResolveByName(this.native.handle.context, this.native.handle, name);
384
+ if (id !== null) {
385
+ this.nameCache.set(name, id);
386
+ }
387
+ return id;
388
+ }
389
+ getStyleId(name) {
390
+ this.guard();
391
+ const id = this.resolveStyleId(name);
392
+ if (id !== null)
393
+ return id;
394
+ if (name.includes(".")) {
395
+ const baseName = name.split(".")[0];
396
+ return this.resolveStyleId(baseName);
397
+ }
398
+ return null;
399
+ }
400
+ getStyleCount() {
401
+ this.guard();
402
+ return this.lib.contextSyntaxStyleGetStyleCount(this.native.handle.context, this.native.handle);
403
+ }
404
+ clearNameCache() {
405
+ this.guard();
406
+ this.nameCache.clear();
407
+ }
408
+ getStyle(name) {
409
+ this.guard();
410
+ const style = this.styleDefs.get(name);
411
+ if (style)
412
+ return cloneStyle(style);
413
+ if (name.includes(".")) {
414
+ const baseName = name.split(".")[0];
415
+ const base = this.styleDefs.get(baseName);
416
+ return base ? cloneStyle(base) : undefined;
417
+ }
418
+ return;
419
+ }
420
+ mergeStyles(...styleNames) {
421
+ this.guard();
422
+ const cacheKey = styleNames.join(":");
423
+ const cached = this.mergedCache.get(cacheKey);
424
+ if (cached)
425
+ return cloneStyle(cached);
426
+ const styleDefinition = {};
427
+ for (const name of styleNames) {
428
+ const style = this.getStyle(name);
429
+ if (!style)
430
+ continue;
431
+ if (style.fg)
432
+ styleDefinition.fg = style.fg;
433
+ if (style.bg)
434
+ styleDefinition.bg = style.bg;
435
+ if (style.bold !== undefined)
436
+ styleDefinition.bold = style.bold;
437
+ if (style.italic !== undefined)
438
+ styleDefinition.italic = style.italic;
439
+ if (style.underline !== undefined)
440
+ styleDefinition.underline = style.underline;
441
+ if (style.dim !== undefined)
442
+ styleDefinition.dim = style.dim;
443
+ }
444
+ const attributes = createTextAttributes2({
445
+ bold: styleDefinition.bold,
446
+ italic: styleDefinition.italic,
447
+ underline: styleDefinition.underline,
448
+ dim: styleDefinition.dim
449
+ });
450
+ const merged = {
451
+ fg: styleDefinition.fg,
452
+ bg: styleDefinition.bg,
453
+ attributes
454
+ };
455
+ this.mergedCache.set(cacheKey, merged);
456
+ return cloneStyle(merged);
457
+ }
458
+ clearCache() {
459
+ this.guard();
460
+ this.mergedCache.clear();
461
+ }
462
+ getCacheSize() {
463
+ this.guard();
464
+ return this.mergedCache.size;
465
+ }
466
+ getAllStyles() {
467
+ this.guard();
468
+ return new Map(Array.from(this.styleDefs, ([name, style]) => [name, cloneStyle(style)]));
469
+ }
470
+ getRegisteredNames() {
471
+ this.guard();
472
+ return Array.from(this.styleDefs.keys());
473
+ }
474
+ destroy() {
475
+ if (this._destroyed)
476
+ return;
477
+ this.lib.getYogaHost().runMutation(() => {
478
+ if (!this.native.owner.disposed)
479
+ this.lib.destroyContextSyntaxStyle(this.native.handle.context, this.native.handle);
480
+ this._destroyed = true;
481
+ this.nameCache.clear();
482
+ this.styleDefs.clear();
483
+ this.mergedCache.clear();
484
+ });
485
+ }
486
+ }
246
487
  // src/post/effects.ts
247
488
  function toU8(value) {
248
489
  return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
@@ -3252,13 +3493,8 @@ class AudioStream extends EventEmitter {
3252
3493
  if (this.lifecycleController.signal.aborted)
3253
3494
  return false;
3254
3495
  const status = this.lib.audioEndStream(this.engine, this.nativeStreamId);
3255
- if (status !== 0) {
3256
- const nativeError = this.snapshotError(this.readNativeStats());
3257
- if (nativeError?.context.action === "decoder")
3258
- throw nativeError;
3259
- const context = { action: "end", status };
3260
- throw new AudioStreamError(`Audio stream end failed: ${status}`, context);
3261
- }
3496
+ if (status !== 0)
3497
+ throw this.nativeCallError("end", status);
3262
3498
  if (!await decoderReady || this.lifecycleController.signal.aborted)
3263
3499
  return false;
3264
3500
  if (!await this.awaitEnded(attempt))
@@ -3380,10 +3616,8 @@ class AudioStream extends EventEmitter {
3380
3616
  const context = { action: "write" };
3381
3617
  throw new AudioStreamError("Audio stream write failed", context, cause);
3382
3618
  }
3383
- if (accepted < 0) {
3384
- const context = { action: "write", status: accepted };
3385
- throw new AudioStreamError(`Audio stream write failed: ${accepted}`, context);
3386
- }
3619
+ if (accepted < 0)
3620
+ throw this.nativeCallError("write", accepted);
3387
3621
  offset += accepted;
3388
3622
  if (accepted === 0 || ++attempt.writeBatches >= 32) {
3389
3623
  attempt.writeBatches = 0;
@@ -3393,6 +3627,12 @@ class AudioStream extends EventEmitter {
3393
3627
  }
3394
3628
  }
3395
3629
  }
3630
+ nativeCallError(action, status) {
3631
+ const nativeError = this.snapshotError(this.readNativeStats());
3632
+ if (nativeError?.context.action === "decoder")
3633
+ return nativeError;
3634
+ return new AudioStreamError(`Audio stream ${action} failed: ${status}`, { action, status });
3635
+ }
3396
3636
  resolveConnection(connection, attempt) {
3397
3637
  const finishAcquisition = this.beginResourceAcquisition(attempt);
3398
3638
  try {
@@ -5547,11 +5787,10 @@ function setupAudio(options = {}) {
5547
5787
  }
5548
5788
  // src/renderables/FrameBuffer.ts
5549
5789
  class FrameBufferRenderable extends Renderable2 {
5550
- static nativeIntegration = this.defineNativeIntegration({
5790
+ static nativeIntegration = {
5551
5791
  kind: "custom",
5552
- body: { native: this.prototype.renderSelf },
5553
- construction: "prototype"
5554
- });
5792
+ body: { native: this.prototype.renderSelf }
5793
+ };
5555
5794
  respectAlpha;
5556
5795
  constructor(ctx, options) {
5557
5796
  super(ctx, options);
@@ -5569,7 +5808,7 @@ class FrameBufferRenderable extends Renderable2 {
5569
5808
  }
5570
5809
  }
5571
5810
  _refreshNativeSceneSurface() {
5572
- if (this.respectAlpha === undefined || Object.getOwnPropertyDescriptor(this, "frameBuffer")?.get)
5811
+ if (Object.getOwnPropertyDescriptor(this, "frameBuffer")?.get)
5573
5812
  return;
5574
5813
  let surface = this.frameBuffer;
5575
5814
  this._ctx.nativeScene.setSurface(this, surface);
@@ -6278,10 +6517,10 @@ class LineNumberRenderable extends Renderable2 {
6278
6517
  renderSelf(buffer) {
6279
6518
  if (!this.target || !this.gutter || this._lineColorsContent.size === 0)
6280
6519
  return;
6281
- const y = Math.trunc(this.y);
6520
+ const [x, y] = this._paintOrigin(buffer);
6282
6521
  const start = Math.max(0, -y);
6283
6522
  const end = Math.min(this.height, buffer.height - y);
6284
- if (end <= start || this.x >= buffer.width || this.x + this.width <= 0)
6523
+ if (end <= start || x >= buffer.width || x + this.width <= 0)
6285
6524
  return;
6286
6525
  const sources = getLineSources(this.target, Math.trunc(this.target.scrollY) + start, end - start);
6287
6526
  const gutterWidth = this.gutter.visible ? this.gutter.width : 0;
@@ -6290,7 +6529,7 @@ class LineNumberRenderable extends Renderable2 {
6290
6529
  const logicalLine = sources[i];
6291
6530
  const lineBg = this._lineColorsContent.get(logicalLine);
6292
6531
  if (lineBg) {
6293
- buffer.fillRect(this.x + gutterWidth, y + start + i, contentWidth, 1, lineBg);
6532
+ buffer.fillRect(x + gutterWidth, y + start + i, contentWidth, 1, lineBg);
6294
6533
  }
6295
6534
  }
6296
6535
  }
@@ -6785,10 +7024,9 @@ var defaultColors = {
6785
7024
  };
6786
7025
 
6787
7026
  class DiffRenderable extends Renderable2 {
6788
- static nativeIntegration = this.defineNativeIntegration({
6789
- ...Renderable2.nativeIntegration,
6790
- construction: "prototype"
6791
- });
7027
+ static nativeIntegration = {
7028
+ ...Renderable2.nativeIntegration
7029
+ };
6792
7030
  _diff;
6793
7031
  _syncScroll = false;
6794
7032
  _view;
@@ -7028,7 +7266,7 @@ class DiffRenderable extends Renderable2 {
7028
7266
  });
7029
7267
  }
7030
7268
  get codeSyntaxStyle() {
7031
- return this._syntaxStyle ?? (this.fallbackSyntaxStyle ??= SyntaxStyle2.create(this.ctx.nativeScene));
7269
+ return this._syntaxStyle ?? (this.fallbackSyntaxStyle ??= SyntaxStyle.create(this.ctx.nativeScene));
7032
7270
  }
7033
7271
  buildErrorView() {
7034
7272
  this.flexDirection = "column";
@@ -7848,11 +8086,10 @@ var MOD_CAPS_LOCK = 1 << 4;
7848
8086
  var MOD_NUM_LOCK = 1 << 5;
7849
8087
 
7850
8088
  class EmbeddedTerminalRenderable extends Renderable2 {
7851
- static nativeIntegration = this.defineNativeIntegration({
8089
+ static nativeIntegration = {
7852
8090
  kind: "custom",
7853
- body: "host",
7854
- construction: "prototype"
7855
- });
8091
+ body: "host"
8092
+ };
7856
8093
  lib;
7857
8094
  handle = null;
7858
8095
  _onData;
@@ -11275,10 +11512,9 @@ function cloneTableOptions(options) {
11275
11512
  }
11276
11513
 
11277
11514
  class MarkdownRenderable extends Renderable2 {
11278
- static nativeIntegration = this.defineNativeIntegration({
11279
- ...Renderable2.nativeIntegration,
11280
- construction: "prototype"
11281
- });
11515
+ static nativeIntegration = {
11516
+ ...Renderable2.nativeIntegration
11517
+ };
11282
11518
  static _capabilitySubscriptions = new WeakMap;
11283
11519
  _content = "";
11284
11520
  _syntaxStyle;
@@ -11883,7 +12119,7 @@ class MarkdownRenderable extends Renderable2 {
11883
12119
  }
11884
12120
  }
11885
12121
  applyListItemRenderable(row, input, previousItem) {
11886
- this.applyListItemMarker(row, input);
12122
+ this.applyListItemMarker(row, input, previousItem);
11887
12123
  const content = row.getChildren()[1];
11888
12124
  if (!(content instanceof BoxRenderable2))
11889
12125
  return false;
@@ -11950,6 +12186,10 @@ class MarkdownRenderable extends Renderable2 {
11950
12186
  this.applyCodeBlockRenderable(renderable, token, 0);
11951
12187
  return true;
11952
12188
  }
12189
+ if (token.type === "blockquote" && renderable instanceof BoxRenderable2) {
12190
+ this.applyBlockquoteRenderable(renderable, token, 0);
12191
+ return true;
12192
+ }
11953
12193
  return previousToken?.raw === token.raw;
11954
12194
  }
11955
12195
  destroyListItemChildrenAfter(content, index) {
@@ -11958,7 +12198,7 @@ class MarkdownRenderable extends Renderable2 {
11958
12198
  children[i]?.destroyRecursively();
11959
12199
  }
11960
12200
  }
11961
- applyListItemMarker(row, input) {
12201
+ applyListItemMarker(row, input, previousItem) {
11962
12202
  const marker = row.getChildren()[0];
11963
12203
  if (!(marker instanceof TextRenderable2))
11964
12204
  return;
@@ -11969,7 +12209,7 @@ class MarkdownRenderable extends Renderable2 {
11969
12209
  row.marginBottom = marginBottom;
11970
12210
  if (marker.width !== markerWidth)
11971
12211
  marker.width = markerWidth;
11972
- if (marker.chunks[0]?.text !== markerText) {
12212
+ if (!previousItem || marker.chunks[0]?.text !== markerText) {
11973
12213
  marker.content = new StyledText2([this.createChunk(markerText, "markup.list")]);
11974
12214
  }
11975
12215
  }
@@ -12550,7 +12790,7 @@ class MarkdownRenderable extends Renderable2 {
12550
12790
  return;
12551
12791
  renderable.destroyRecursively();
12552
12792
  }
12553
- updateBlockRenderable(state, token, index, nextToken, forceListRefresh = false) {
12793
+ updateBlockRenderable(state, token, index, nextToken, forceRefresh = false) {
12554
12794
  const marginBottom = this.getInterBlockMargin(token, nextToken);
12555
12795
  if (token.type === "code") {
12556
12796
  this.applyCodeBlockRenderable(state.renderable, token, marginBottom);
@@ -12561,7 +12801,7 @@ class MarkdownRenderable extends Renderable2 {
12561
12801
  return;
12562
12802
  }
12563
12803
  if (token.type === "list") {
12564
- if (!this.applyListRenderable(state.renderable, token, forceListRefresh ? undefined : state.token, `${this.id}-block-${index}`, marginBottom)) {
12804
+ if (!this.applyListRenderable(state.renderable, token, forceRefresh ? undefined : state.token, `${this.id}-block-${index}`, marginBottom)) {
12565
12805
  state.renderable.destroyRecursively();
12566
12806
  state.renderable = this.createListRenderable(token, `${this.id}-block-${index}`, marginBottom);
12567
12807
  this.add(state.renderable, index);
@@ -12574,7 +12814,7 @@ class MarkdownRenderable extends Renderable2 {
12574
12814
  }
12575
12815
  if (token.type === "table") {
12576
12816
  const tableToken = token;
12577
- const { cache, changed } = this.buildTableContentCache(tableToken, state.tableContentCache);
12817
+ const { cache, changed } = this.buildTableContentCache(tableToken, state.tableContentCache, forceRefresh);
12578
12818
  if (!cache) {
12579
12819
  if (state.renderable instanceof CodeRenderable2) {
12580
12820
  this.applyMarkdownCodeRenderable(state.renderable, tableToken.raw, marginBottom);
@@ -12659,7 +12899,7 @@ class MarkdownRenderable extends Renderable2 {
12659
12899
  }
12660
12900
  this.destroyUnusedDefaultRenderable(custom.renderable);
12661
12901
  }
12662
- this.updateBlockRenderable(existing, block.token, blockIndex, blocks[i + 1]?.token);
12902
+ this.updateBlockRenderable(existing, block.token, blockIndex, blocks[i + 1]?.token, forceTableRefresh);
12663
12903
  existing.renderable.marginBottom = 0;
12664
12904
  if (existing.marginTop !== block.marginTop) {
12665
12905
  this.applyMargins(existing.renderable, block.marginTop, 0);
@@ -12951,11 +13191,10 @@ var defaultMin = 0;
12951
13191
  var defaultMax = 100;
12952
13192
 
12953
13193
  class SliderRenderable extends Renderable2 {
12954
- static nativeIntegration = this.defineNativeIntegration({
13194
+ static nativeIntegration = {
12955
13195
  kind: "slider",
12956
- body: { native: this.prototype.renderSelf },
12957
- construction: "prototype"
12958
- });
13196
+ body: { native: this.prototype.renderSelf }
13197
+ };
12959
13198
  _orientation;
12960
13199
  _value;
12961
13200
  _min;
@@ -13180,66 +13419,16 @@ class SliderRenderable extends Renderable2 {
13180
13419
  }
13181
13420
  }
13182
13421
  renderSelf(buffer) {
13183
- const x = this.x;
13184
- const y = this.y;
13185
- const width = this.width;
13186
- const height = this.height;
13187
- const bufferWidth = buffer.width;
13188
- const bufferHeight = buffer.height;
13189
- const left = Math.max(0, Math.trunc(x));
13190
- const top = Math.max(0, Math.trunc(y));
13191
- const right = Math.min(bufferWidth, Math.trunc(x) + Math.trunc(width));
13192
- const bottom = Math.min(bufferHeight, Math.trunc(y) + Math.trunc(height));
13193
- if (right > left && bottom > top) {
13194
- buffer.fillRect(left, top, right - left, bottom - top, this._backgroundColor);
13195
- }
13196
- const horizontal = this.orientation === "horizontal";
13197
- const origin = horizontal ? x : y;
13198
- const crossOrigin = horizontal ? y : x;
13199
- const length = horizontal ? width : height;
13200
- const crossLength = horizontal ? height : width;
13201
- const limit = horizontal ? bufferWidth : bufferHeight;
13202
- const crossLimit = horizontal ? bufferHeight : bufferWidth;
13203
- const thumb = this._ctx.nativeScene.getSliderThumb(this);
13204
- const virtualThumbSize = thumb.size;
13205
- const virtualThumbStart = thumb.start;
13206
- const virtualThumbEnd = virtualThumbStart + virtualThumbSize;
13207
- const start = Math.max(0, Math.floor(virtualThumbStart / 2), Math.floor(-1 - origin));
13208
- const end = Math.min(Math.floor(length), Math.ceil(virtualThumbEnd / 2), Math.ceil(limit - origin) + 1);
13209
- const crossStart = Math.max(0, Math.floor(-1 - crossOrigin));
13210
- const crossEnd = Math.min(Math.ceil(crossLength), Math.ceil(crossLimit - crossOrigin) + 1);
13211
- for (let along = start;along < end; along++) {
13212
- const cell = Math.trunc(origin + along);
13213
- if (cell < 0 || cell >= limit)
13214
- continue;
13215
- const virtualCellStart = along * 2;
13216
- const thumbStartInCell = Math.max(virtualThumbStart, virtualCellStart);
13217
- const coverage = Math.min(virtualThumbEnd, virtualCellStart + 2) - thumbStartInCell;
13218
- let char = " ";
13219
- if (coverage >= 2) {
13220
- char = "\u2588";
13221
- } else if (horizontal) {
13222
- char = thumbStartInCell === virtualCellStart ? "\u258C" : "\u2590";
13223
- } else if (coverage > 0) {
13224
- char = thumbStartInCell === virtualCellStart ? "\u2580" : "\u2584";
13225
- }
13226
- for (let across = crossStart;across < crossEnd; across++) {
13227
- const crossCell = Math.trunc(crossOrigin + across);
13228
- if (crossCell < 0 || crossCell >= crossLimit)
13229
- continue;
13230
- buffer.setCellWithAlphaBlending(horizontal ? cell : crossCell, horizontal ? crossCell : cell, char, this._foregroundColor, this._backgroundColor);
13231
- }
13232
- }
13422
+ this._drawNativeBody(buffer);
13233
13423
  }
13234
13424
  }
13235
13425
 
13236
13426
  // src/renderables/ScrollBar.ts
13237
13427
  class ScrollBarRenderable extends Renderable2 {
13238
- static nativeIntegration = this.defineNativeIntegration({
13428
+ static nativeIntegration = {
13239
13429
  ...Renderable2.nativeIntegration,
13240
- kind: "box",
13241
- construction: "prototype"
13242
- });
13430
+ kind: "box"
13431
+ };
13243
13432
  slider;
13244
13433
  startArrow;
13245
13434
  endArrow;
@@ -13300,7 +13489,7 @@ class ScrollBarRenderable extends Renderable2 {
13300
13489
  if (this.isDestroyed)
13301
13490
  return;
13302
13491
  this.assertMutable();
13303
- const newPosition = Math.round(Math.min(Math.max(0, value ?? 0), this.scrollSize - this.viewportSize));
13492
+ const newPosition = Math.round(Math.max(0, Math.min(value ?? 0, this.scrollSize - this.viewportSize)));
13304
13493
  if (!Number.isFinite(newPosition)) {
13305
13494
  throw new RangeError("Scene scroll positions must be finite numbers");
13306
13495
  }
@@ -13496,9 +13685,7 @@ class ScrollBarRenderable extends Renderable2 {
13496
13685
  this.slider.value = Math.min(this._scrollPosition, scrollRange);
13497
13686
  }
13498
13687
  scrollBy(delta, unit = "absolute") {
13499
- const multiplier = unit === "viewport" ? this.viewportSize : unit === "content" ? this.scrollSize : unit === "step" ? this.scrollStep ?? 1 : 1;
13500
- const resolvedDelta = multiplier * delta;
13501
- this.scrollPosition += resolvedDelta;
13688
+ this.scrollPosition += scrollUnitSize(this, unit) * delta;
13502
13689
  }
13503
13690
  recalculateVisibility() {
13504
13691
  if (!this._manualVisibility) {
@@ -13552,11 +13739,10 @@ var defaultArrowForeground = RGBA2.fromValues(1, 1, 1, 1);
13552
13739
  var defaultArrowBackground = RGBA2.fromValues(0, 0, 0, 0);
13553
13740
 
13554
13741
  class ArrowRenderable extends Renderable2 {
13555
- static nativeIntegration = this.defineNativeIntegration({
13742
+ static nativeIntegration = {
13556
13743
  kind: "arrow",
13557
- body: { native: this.prototype.renderSelf },
13558
- construction: "prototype"
13559
- });
13744
+ body: { native: this.prototype.renderSelf }
13745
+ };
13560
13746
  _direction;
13561
13747
  _foregroundColor;
13562
13748
  _backgroundColor;
@@ -13645,8 +13831,7 @@ class ArrowRenderable extends Renderable2 {
13645
13831
  });
13646
13832
  }
13647
13833
  renderSelf(buffer) {
13648
- const char = this.getArrowChar();
13649
- buffer.drawText(char, this.x, this.y, this._foregroundColor, this._backgroundColor, this._attributes);
13834
+ this._drawNativeBody(buffer);
13650
13835
  }
13651
13836
  defaultDimension(kind) {
13652
13837
  return kind === "width" ? this.glyphWidth() : super.defaultDimension(kind);
@@ -13664,31 +13849,428 @@ class ArrowRenderable extends Renderable2 {
13664
13849
  return this._arrowChars[this._direction];
13665
13850
  }
13666
13851
  }
13667
- // src/renderables/ScrollBox.ts
13668
- class ContentRenderable extends BoxRenderable2 {
13669
- static nativeIntegration = this.defineNativeIntegration(BoxRenderable2.nativeIntegration);
13670
- viewport;
13671
- _viewportCulling;
13672
- constructor(ctx, viewport, viewportCulling, options) {
13673
- super(ctx, options);
13674
- try {
13675
- this.viewport = viewport;
13676
- ctx.nativeScene.setViewport(this, viewportCulling ? viewport : null);
13677
- this._viewportCulling = viewportCulling;
13678
- } catch (error) {
13679
- this.abortConstruction(error);
13852
+ function scrollUnitSize(bar, unit) {
13853
+ if (unit === "viewport")
13854
+ return bar.viewportSize;
13855
+ if (unit === "content")
13856
+ return bar.scrollSize;
13857
+ return unit === "step" ? bar.scrollStep ?? 1 : 1;
13858
+ }
13859
+ // src/renderables/ScrollBoxParts.ts
13860
+ import { EventEmitter as EventEmitter2 } from "events";
13861
+ class ScrollBoxPart extends EventEmitter2 {
13862
+ box;
13863
+ constructor(box, event) {
13864
+ super();
13865
+ this.box = box;
13866
+ this.on("newListener", (name) => name === event && box._refreshScrollHook(true));
13867
+ this.on("removeListener", (name) => name === event && box._refreshScrollHook());
13868
+ }
13869
+ get isDestroyed() {
13870
+ return this.box.isDestroyed;
13871
+ }
13872
+ get x() {
13873
+ return this.rect().x;
13874
+ }
13875
+ get y() {
13876
+ return this.rect().y;
13877
+ }
13878
+ get screenX() {
13879
+ return this.rect().x;
13880
+ }
13881
+ get screenY() {
13882
+ return this.rect().y;
13883
+ }
13884
+ get width() {
13885
+ return this.rect().width;
13886
+ }
13887
+ get height() {
13888
+ return this.rect().height;
13889
+ }
13890
+ removeAllListeners(event) {
13891
+ for (const name of event === undefined ? this.eventNames() : [event]) {
13892
+ if (name !== "newListener" && name !== "removeListener")
13893
+ super.removeAllListeners(name);
13894
+ }
13895
+ return this;
13896
+ }
13897
+ _assign(options, keys) {
13898
+ if (options == null)
13899
+ return;
13900
+ for (const key of Reflect.ownKeys(options)) {
13901
+ if (typeof key !== "string" || !keys.includes(key))
13902
+ continue;
13903
+ if (!Object.getOwnPropertyDescriptor(options, key)?.enumerable)
13904
+ continue;
13905
+ this[key] = Reflect.get(options, key);
13906
+ if (this.box.isDestroyed)
13907
+ return;
13908
+ }
13909
+ }
13910
+ }
13911
+
13912
+ class ScrollBoxFilledPart extends ScrollBoxPart {
13913
+ _backgroundColor;
13914
+ get backgroundColor() {
13915
+ return RGBA2.clone(this._backgroundColor ?? RGBA2.fromValues(0, 0, 0, 0));
13916
+ }
13917
+ set backgroundColor(value) {
13918
+ this._backgroundColor = value == null ? undefined : RGBA2.clone(parseColor2(value));
13919
+ this.box._applyScrollOptions();
13920
+ }
13921
+ _fill() {
13922
+ return this._backgroundColor;
13923
+ }
13924
+ }
13925
+
13926
+ class ScrollBoxSizedPart extends ScrollBoxFilledPart {
13927
+ _onSizeChange;
13928
+ constructor(box) {
13929
+ super(box, "resize");
13930
+ }
13931
+ get onSizeChange() {
13932
+ return this._onSizeChange;
13933
+ }
13934
+ set onSizeChange(handler) {
13935
+ this._onSizeChange = handler ?? undefined;
13936
+ this.box._refreshScrollHook();
13937
+ }
13938
+ _listening() {
13939
+ return this._onSizeChange !== undefined || this.listenerCount("resize") > 0;
13940
+ }
13941
+ _emitResize() {
13942
+ this._onSizeChange?.();
13943
+ if (!this.box.isDestroyed)
13944
+ this.emit("resize");
13945
+ }
13946
+ }
13947
+
13948
+ class ScrollBoxWrapper extends ScrollBoxFilledPart {
13949
+ static keys = ["backgroundColor"];
13950
+ _listening() {
13951
+ return false;
13952
+ }
13953
+ rect() {
13954
+ return this.box._wrapperRect();
13955
+ }
13956
+ }
13957
+ var paddingKeys = ["padding", "paddingX", "paddingY", "paddingLeft", "paddingTop", "paddingRight", "paddingBottom"];
13958
+
13959
+ class ScrollBoxViewport extends ScrollBoxSizedPart {
13960
+ static keys = ["backgroundColor", "onSizeChange", ...paddingKeys];
13961
+ paddings = {};
13962
+ constructor(box) {
13963
+ super(box);
13964
+ paddingKeys.forEach((key, index) => Object.defineProperty(this, key, {
13965
+ configurable: true,
13966
+ get: index < 3 ? undefined : () => this._edges()[index - 3],
13967
+ set: (value) => this.setPadding(key, value)
13968
+ }));
13969
+ }
13970
+ rect() {
13971
+ return this.box._scrollState().viewport;
13972
+ }
13973
+ setPadding(key, value) {
13974
+ if (value != null && (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > 65535)) {
13975
+ throw new RangeError("ScrollBox viewport padding must be a whole number of cells");
13976
+ }
13977
+ if (value == null)
13978
+ delete this.paddings[key];
13979
+ else
13980
+ this.paddings[key] = value;
13981
+ this.box._applyScrollOptions();
13982
+ }
13983
+ _edges() {
13984
+ const p = this.paddings;
13985
+ const all = p.padding ?? 0;
13986
+ const x = p.paddingX ?? all;
13987
+ const y = p.paddingY ?? all;
13988
+ return [p.paddingLeft ?? x, p.paddingTop ?? y, p.paddingRight ?? x, p.paddingBottom ?? y];
13989
+ }
13990
+ }
13991
+ var content = NativeStyleFlags.Content;
13992
+ var contentStyles = {};
13993
+ {
13994
+ const value = (kind, edge = NATIVE_EDGE_NONE2) => (scene, node, input) => sceneSetValue(scene, node, kind, edge, input ?? undefined, content);
13995
+ const enums = [
13996
+ ["flexDirection", YogaEnumKind.FlexDirection, parseFlexDirection2],
13997
+ ["flexWrap", YogaEnumKind.FlexWrap, parseWrap2],
13998
+ ["alignItems", YogaEnumKind.AlignItems, parseAlignItems2],
13999
+ ["justifyContent", YogaEnumKind.JustifyContent, parseJustify2],
14000
+ ["alignSelf", YogaEnumKind.AlignSelf, parseAlign2]
14001
+ ];
14002
+ for (const [key, kind, parse] of enums) {
14003
+ contentStyles[key] = (scene, node, input) => sceneSetEnum(scene, node, kind, parse(input ?? undefined), content);
14004
+ }
14005
+ contentStyles.flexGrow = (scene, node, input) => sceneSetFloat(scene, node, YogaFloatKind.FlexGrow, input ?? 0, content);
14006
+ contentStyles.flexShrink = (scene, node, input) => sceneSetFloat(scene, node, YogaFloatKind.FlexShrink, input ?? 0, content);
14007
+ for (const [key, kind] of [
14008
+ ["width", YogaValueKind.Width],
14009
+ ["height", YogaValueKind.Height],
14010
+ ["flexBasis", YogaValueKind.FlexBasis],
14011
+ ["minWidth", YogaValueKind.MinWidth],
14012
+ ["minHeight", YogaValueKind.MinHeight],
14013
+ ["maxWidth", YogaValueKind.MaxWidth],
14014
+ ["maxHeight", YogaValueKind.MaxHeight]
14015
+ ]) {
14016
+ contentStyles[key] = value(kind);
14017
+ }
14018
+ for (const [suffix, edge] of [
14019
+ ["", Edge2.All],
14020
+ ["X", Edge2.Horizontal],
14021
+ ["Y", Edge2.Vertical],
14022
+ ["Top", Edge2.Top],
14023
+ ["Right", Edge2.Right],
14024
+ ["Bottom", Edge2.Bottom],
14025
+ ["Left", Edge2.Left]
14026
+ ]) {
14027
+ contentStyles[`padding${suffix}`] = value(YogaValueKind.Padding, edge);
14028
+ contentStyles[`margin${suffix}`] = value(YogaValueKind.Margin, edge);
14029
+ }
14030
+ contentStyles.gap = value(YogaValueKind.Gap, Gutter2.All);
14031
+ contentStyles.rowGap = value(YogaValueKind.Gap, Gutter2.Row);
14032
+ contentStyles.columnGap = value(YogaValueKind.Gap, Gutter2.Column);
14033
+ }
14034
+
14035
+ class ScrollBoxContent extends ScrollBoxSizedPart {
14036
+ static keys = ["backgroundColor", "onSizeChange", "viewportCulling", ...Object.keys(contentStyles)];
14037
+ styles = new Map;
14038
+ constructor(box) {
14039
+ super(box);
14040
+ for (const key of Object.keys(contentStyles)) {
14041
+ const size = key === "width" || key === "height";
14042
+ Object.defineProperty(this, key, {
14043
+ configurable: true,
14044
+ enumerable: false,
14045
+ get: () => size ? this.rect()[key] : this.styles.get(key),
14046
+ set: (input) => this.setStyle(key, input)
14047
+ });
13680
14048
  }
13681
14049
  }
14050
+ rect() {
14051
+ const { content, offset } = this.box._scrollState();
14052
+ return {
14053
+ x: this.box.screenX + content.x - offset[0],
14054
+ y: this.box.screenY + content.y - offset[1],
14055
+ width: content.width,
14056
+ height: content.height
14057
+ };
14058
+ }
14059
+ setStyle(key, input) {
14060
+ this.box._setContentStyle((scene, node) => contentStyles[key](scene, node, input));
14061
+ if (input == null)
14062
+ this.styles.delete(key);
14063
+ else
14064
+ this.styles.set(key, input);
14065
+ }
14066
+ get _row() {
14067
+ const direction = parseFlexDirection2(this.styles.get("flexDirection"));
14068
+ return direction === FlexDirection2.Row || direction === FlexDirection2.RowReverse;
14069
+ }
13682
14070
  get viewportCulling() {
13683
- return this._viewportCulling;
14071
+ return this.box.viewportCulling;
13684
14072
  }
13685
14073
  set viewportCulling(value) {
13686
- if (this.isFreed())
14074
+ this.box.viewportCulling = value;
14075
+ }
14076
+ add(obj, index) {
14077
+ return this.box.add(obj, index);
14078
+ }
14079
+ insertBefore(obj, anchor) {
14080
+ return this.box.insertBefore(obj, anchor);
14081
+ }
14082
+ remove(child) {
14083
+ this.box.remove(child);
14084
+ }
14085
+ getChildren() {
14086
+ return this.box.getChildren();
14087
+ }
14088
+ getChildrenCount() {
14089
+ return this.box.getChildrenCount();
14090
+ }
14091
+ getRenderable(id) {
14092
+ return this.box.getRenderable(id);
14093
+ }
14094
+ findDescendantById(id) {
14095
+ return this.box.findDescendantById(id);
14096
+ }
14097
+ }
14098
+ var defaultTrack = RGBA2.fromHex("#252527");
14099
+ var defaultThumb = RGBA2.fromHex("#9a9ea3");
14100
+ var defaultArrowForeground2 = RGBA2.fromValues(1, 1, 1, 1);
14101
+ var defaultArrowBackground2 = RGBA2.fromValues(0, 0, 0, 0);
14102
+
14103
+ class ScrollBoxBar extends ScrollBoxPart {
14104
+ static keys = [
14105
+ "visible",
14106
+ "showArrows",
14107
+ "arrowOptions",
14108
+ "trackOptions",
14109
+ "onChange",
14110
+ "width",
14111
+ "height",
14112
+ "paddingLeft",
14113
+ "paddingTop",
14114
+ "position",
14115
+ "scrollStep"
14116
+ ];
14117
+ orientation;
14118
+ scrollStep = null;
14119
+ axis;
14120
+ policy = "auto";
14121
+ _showArrows = false;
14122
+ _arrowOptions = {};
14123
+ trackForeground = defaultThumb;
14124
+ trackBackground = defaultTrack;
14125
+ thickness = 1;
14126
+ gap = 0;
14127
+ overlay = false;
14128
+ _onChange;
14129
+ constructor(box, orientation) {
14130
+ super(box, "change");
14131
+ this.orientation = orientation;
14132
+ this.axis = orientation === "vertical" ? 1 : 0;
14133
+ }
14134
+ rect() {
14135
+ const bar = this.box._scrollState().bars[this.axis];
14136
+ const arrows = this._showArrows ? 1 : 0;
14137
+ return this.axis === 1 ? {
14138
+ x: bar.track.x - this.gap,
14139
+ y: bar.track.y - arrows,
14140
+ width: bar.track.width + this.gap,
14141
+ height: bar.track.height + 2 * arrows
14142
+ } : {
14143
+ x: bar.track.x - arrows,
14144
+ y: bar.track.y - this.gap,
14145
+ width: bar.track.width + 2 * arrows,
14146
+ height: bar.track.height + this.gap
14147
+ };
14148
+ }
14149
+ _listening() {
14150
+ return this._onChange !== undefined || this.listenerCount("change") > 0;
14151
+ }
14152
+ _native() {
14153
+ return {
14154
+ policy: this.policy,
14155
+ overlay: this.overlay,
14156
+ thickness: this.thickness,
14157
+ gap: this.gap,
14158
+ arrows: this._showArrows,
14159
+ foregroundColor: this.trackForeground,
14160
+ backgroundColor: this.trackBackground
14161
+ };
14162
+ }
14163
+ _arrows() {
14164
+ const options = this._arrowOptions;
14165
+ const background = options.backgroundColor ?? undefined;
14166
+ const foreground = options.foregroundColor ?? background;
14167
+ const chars = options.arrowChars ?? {};
14168
+ return (this.axis === 1 ? ["up", "down"] : ["left", "right"]).map((direction) => ({
14169
+ attributes: options.attributes ?? 0,
14170
+ foregroundColor: RGBA2.clone(parseColor2(foreground || defaultArrowForeground2)),
14171
+ backgroundColor: RGBA2.clone(parseColor2(background || defaultArrowBackground2)),
14172
+ text: chars[direction]
14173
+ }));
14174
+ }
14175
+ _emitChange(position) {
14176
+ this._onChange?.(position);
14177
+ if (!this.box.isDestroyed)
14178
+ this.emit("change", { position });
14179
+ }
14180
+ get visible() {
14181
+ return this.box._scrollState().bars[this.axis].visible;
14182
+ }
14183
+ set visible(value) {
14184
+ this.setOption(() => this.policy = value == null ? "auto" : value ? "always" : "never");
14185
+ }
14186
+ resetVisibilityControl() {
14187
+ this.visible = null;
14188
+ }
14189
+ get onChange() {
14190
+ return this._onChange;
14191
+ }
14192
+ set onChange(handler) {
14193
+ this._onChange = handler ?? undefined;
14194
+ this.box._refreshScrollHook();
14195
+ }
14196
+ get showArrows() {
14197
+ return this._showArrows;
14198
+ }
14199
+ set showArrows(value) {
14200
+ this.setOption(() => this._showArrows = value ?? false);
14201
+ }
14202
+ set arrowOptions(options) {
14203
+ this._arrowOptions = { ...this._arrowOptions, ...options };
14204
+ if (!this.box.isDestroyed)
14205
+ this.box._applyScrollArrows(this.axis);
14206
+ }
14207
+ set trackOptions(options) {
14208
+ this.setOption(() => {
14209
+ if (options && "foregroundColor" in options) {
14210
+ this.trackForeground = RGBA2.clone(parseColor2(options.foregroundColor ?? defaultThumb));
14211
+ }
14212
+ if (options && "backgroundColor" in options) {
14213
+ this.trackBackground = RGBA2.clone(parseColor2(options.backgroundColor ?? defaultTrack));
14214
+ }
14215
+ });
14216
+ }
14217
+ get width() {
14218
+ return super.width;
14219
+ }
14220
+ set width(value) {
14221
+ if (this.axis === 1)
14222
+ this.setOption(() => this.thickness = Math.max(1, cells(value, 1)));
14223
+ }
14224
+ get height() {
14225
+ return super.height;
14226
+ }
14227
+ set height(value) {
14228
+ if (this.axis === 0)
14229
+ this.setOption(() => this.thickness = Math.max(1, cells(value, 1)));
14230
+ }
14231
+ set paddingLeft(value) {
14232
+ if (this.axis === 1)
14233
+ this.setOption(() => this.gap = cells(value, 0));
14234
+ }
14235
+ set paddingTop(value) {
14236
+ if (this.axis === 0)
14237
+ this.setOption(() => this.gap = cells(value, 0));
14238
+ }
14239
+ set position(value) {
14240
+ this.setOption(() => this.overlay = value === "absolute");
14241
+ }
14242
+ setOption(change) {
14243
+ if (this.box.isDestroyed)
13687
14244
  return;
13688
- this._ctx.nativeScene.setViewport(this, value ? this.viewport : null);
13689
- this._viewportCulling = value;
14245
+ change();
14246
+ this.box._applyScrollOptions();
14247
+ }
14248
+ get scrollSize() {
14249
+ const { content } = this.box._scrollState();
14250
+ return this.axis === 1 ? content.height : content.width;
14251
+ }
14252
+ get viewportSize() {
14253
+ const { viewport } = this.box._scrollState();
14254
+ return this.axis === 1 ? viewport.height : viewport.width;
14255
+ }
14256
+ get scrollPosition() {
14257
+ return this.box._scrollState().offset[this.axis];
14258
+ }
14259
+ set scrollPosition(value) {
14260
+ this.box._scrollAxis(this.axis, value, false);
14261
+ }
14262
+ scrollBy(delta, unit = "absolute") {
14263
+ this.box._scrollAxis(this.axis, scrollUnitSize(this, unit) * delta, true, true);
14264
+ }
14265
+ handleKeyPress(key) {
14266
+ return ScrollBarRenderable.prototype.handleKeyPress.call(this, key);
13690
14267
  }
13691
14268
  }
14269
+ function cells(value, fallback) {
14270
+ return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.min(255, Math.trunc(value))) : fallback;
14271
+ }
14272
+
14273
+ // src/renderables/ScrollBox.ts
13692
14274
  var SCROLLBOX_PADDING_KEYS = [
13693
14275
  "padding",
13694
14276
  "paddingX",
@@ -13719,9 +14301,19 @@ function stripScrollBoxPadding(options) {
13719
14301
  }
13720
14302
 
13721
14303
  class ScrollBoxRenderable extends BoxRenderable2 {
13722
- static nativeIntegration = this.defineNativeIntegration(BoxRenderable2.nativeIntegration);
13723
- static idCounter = 0;
13724
- internalId = 0;
14304
+ static nativeIntegration = {
14305
+ ...BoxRenderable2.nativeIntegration,
14306
+ lifecycle: {
14307
+ update: {
14308
+ idle: this.prototype.onUpdate,
14309
+ active: (renderable) => renderable["isAutoScrolling"]
14310
+ },
14311
+ scroll: {
14312
+ active: (renderable) => renderable.scrollHook,
14313
+ notify: (renderable) => renderable.notifyScroll()
14314
+ }
14315
+ }
14316
+ };
13725
14317
  wrapper;
13726
14318
  viewport;
13727
14319
  content;
@@ -13743,126 +14335,70 @@ class ScrollBoxRenderable extends BoxRenderable2 {
13743
14335
  scrollAccumulatorX = 0;
13744
14336
  scrollAccumulatorY = 0;
13745
14337
  _stickyScroll;
13746
- _stickyScrollTop = false;
13747
- _stickyScrollBottom = false;
13748
- _stickyScrollLeft = false;
13749
- _stickyScrollRight = false;
13750
14338
  _stickyStart;
13751
- _hasManualScroll = false;
13752
- _isApplyingStickyScroll = false;
13753
14339
  scrollAccel;
14340
+ axes;
14341
+ _viewportCulling;
14342
+ state = emptySceneScrollState();
14343
+ stateRevision;
14344
+ scrollHook = false;
14345
+ configured = false;
14346
+ barPress;
14347
+ layoutCallbacks = [];
14348
+ anchorToken;
13754
14349
  get stickyScroll() {
13755
14350
  return this._stickyScroll;
13756
14351
  }
13757
14352
  set stickyScroll(value) {
13758
- this._stickyScroll = value;
13759
- this.updateStickyState();
14353
+ this.setScrollOption(() => this._stickyScroll = value);
13760
14354
  }
13761
14355
  get stickyStart() {
13762
14356
  return this._stickyStart;
13763
14357
  }
13764
14358
  set stickyStart(value) {
13765
- this._stickyStart = value;
13766
- this.updateStickyState();
14359
+ this.setScrollOption(() => this._stickyStart = value);
14360
+ }
14361
+ setScrollOption(change) {
14362
+ const previous = [this._stickyScroll, this._stickyStart, this._viewportCulling];
14363
+ change();
14364
+ try {
14365
+ this._applyScrollOptions();
14366
+ } catch (error) {
14367
+ [this._stickyScroll, this._stickyStart, this._viewportCulling] = previous;
14368
+ throw error;
14369
+ }
14370
+ }
14371
+ get scrollX() {
14372
+ return this.axes.x;
14373
+ }
14374
+ set scrollX(value) {
14375
+ this.axes.x = value ?? false;
14376
+ this._applyScrollOptions();
14377
+ }
14378
+ get scrollY() {
14379
+ return this.axes.y;
14380
+ }
14381
+ set scrollY(value) {
14382
+ this.axes.y = value ?? true;
14383
+ this._applyScrollOptions();
13767
14384
  }
13768
14385
  get scrollTop() {
13769
- return this.verticalScrollBar.scrollPosition;
14386
+ return this._scrollState().offset[1];
13770
14387
  }
13771
14388
  set scrollTop(value) {
13772
- this.verticalScrollBar.scrollPosition = value;
13773
- this.updateStickyState();
14389
+ this._scrollAxis(1, value, false);
13774
14390
  }
13775
14391
  get scrollLeft() {
13776
- return this.horizontalScrollBar.scrollPosition;
14392
+ return this._scrollState().offset[0];
13777
14393
  }
13778
14394
  set scrollLeft(value) {
13779
- this.horizontalScrollBar.scrollPosition = value;
13780
- this.updateStickyState();
14395
+ this._scrollAxis(0, value, false);
13781
14396
  }
13782
14397
  get scrollWidth() {
13783
- return this.horizontalScrollBar.scrollSize;
14398
+ return this._scrollState().content.width;
13784
14399
  }
13785
14400
  get scrollHeight() {
13786
- return this.verticalScrollBar.scrollSize;
13787
- }
13788
- updateStickyState() {
13789
- if (this.isDestroyed)
13790
- return;
13791
- if (!this._stickyScroll) {
13792
- this.syncManualScrollState();
13793
- return;
13794
- }
13795
- const maxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
13796
- const maxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
13797
- if (this.scrollTop <= 0) {
13798
- this._stickyScrollTop = true;
13799
- this._stickyScrollBottom = false;
13800
- } else if (this.scrollTop >= maxScrollTop) {
13801
- this._stickyScrollTop = false;
13802
- this._stickyScrollBottom = true;
13803
- } else {
13804
- this._stickyScrollTop = false;
13805
- this._stickyScrollBottom = false;
13806
- }
13807
- if (this.scrollLeft <= 0) {
13808
- this._stickyScrollLeft = true;
13809
- this._stickyScrollRight = false;
13810
- } else if (this.scrollLeft >= maxScrollLeft) {
13811
- this._stickyScrollLeft = false;
13812
- this._stickyScrollRight = true;
13813
- } else {
13814
- this._stickyScrollLeft = false;
13815
- this._stickyScrollRight = false;
13816
- }
13817
- this.syncManualScrollState();
13818
- }
13819
- syncManualScrollState() {
13820
- if (this.isDestroyed)
13821
- return;
13822
- if (!this._stickyScroll) {
13823
- this._hasManualScroll = false;
13824
- return;
13825
- }
13826
- const maxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
13827
- const maxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
13828
- const hasScrollableContent = maxScrollTop > 1 || maxScrollLeft > 1;
13829
- if (this._isApplyingStickyScroll) {
13830
- if (this._hasManualScroll && hasScrollableContent && this.isAtStickyPosition()) {
13831
- this._hasManualScroll = false;
13832
- }
13833
- return;
13834
- }
13835
- this._hasManualScroll = hasScrollableContent && !this.isAtStickyPosition();
13836
- }
13837
- applyStickyStart(stickyStart) {
13838
- const wasApplyingStickyScroll = this._isApplyingStickyScroll;
13839
- this._isApplyingStickyScroll = true;
13840
- try {
13841
- switch (stickyStart) {
13842
- case "top":
13843
- this._stickyScrollTop = true;
13844
- this._stickyScrollBottom = false;
13845
- this.verticalScrollBar.scrollPosition = 0;
13846
- break;
13847
- case "bottom":
13848
- this._stickyScrollTop = false;
13849
- this._stickyScrollBottom = true;
13850
- this.verticalScrollBar.scrollPosition = Math.max(0, this.scrollHeight - this.viewport.height);
13851
- break;
13852
- case "left":
13853
- this._stickyScrollLeft = true;
13854
- this._stickyScrollRight = false;
13855
- this.horizontalScrollBar.scrollPosition = 0;
13856
- break;
13857
- case "right":
13858
- this._stickyScrollLeft = false;
13859
- this._stickyScrollRight = true;
13860
- this.horizontalScrollBar.scrollPosition = Math.max(0, this.scrollWidth - this.viewport.width);
13861
- break;
13862
- }
13863
- } finally {
13864
- this._isApplyingStickyScroll = wasApplyingStickyScroll;
13865
- }
14401
+ return this._scrollState().content.height;
13866
14402
  }
13867
14403
  constructor(ctx, options) {
13868
14404
  const {
@@ -13887,95 +14423,38 @@ class ScrollBoxRenderable extends BoxRenderable2 {
13887
14423
  };
13888
14424
  const sanitizedRootBoxOptions = stripScrollBoxPadding(rootBoxOptions);
13889
14425
  const sanitizedRootOptions = rootOptions ? stripScrollBoxPadding(rootOptions) : undefined;
13890
- const mergedContentOptions = {
13891
- ...forwardedContentPadding,
13892
- ...contentOptions
13893
- };
13894
14426
  super(ctx, {
13895
14427
  flexDirection: "row",
13896
14428
  alignItems: "stretch",
13897
14429
  ...sanitizedRootBoxOptions,
13898
- ...sanitizedRootOptions
14430
+ ...sanitizedRootOptions,
14431
+ overflow: "hidden"
13899
14432
  });
13900
- const children = [];
13901
14433
  try {
13902
- this.internalId = ScrollBoxRenderable.idCounter++;
13903
14434
  this._stickyScroll = stickyScroll;
13904
14435
  this._stickyStart = stickyStart;
13905
14436
  this.scrollAccel = scrollAcceleration ?? new LinearScrollAccel2;
13906
- this.wrapper = new BoxRenderable2(ctx, {
13907
- flexDirection: "column",
13908
- flexGrow: 1,
13909
- ...wrapperOptions,
13910
- id: `scroll-box-wrapper-${this.internalId}`
13911
- });
13912
- children.push(this.wrapper);
13913
- super.add(this.wrapper);
13914
- this.viewport = new BoxRenderable2(ctx, {
13915
- flexDirection: "column",
13916
- flexGrow: 1,
13917
- overflow: "hidden",
13918
- onSizeChange: () => {
13919
- this.recalculateBarProps();
13920
- },
13921
- ...viewportOptions,
13922
- id: `scroll-box-viewport-${this.internalId}`
13923
- });
13924
- children.push(this.viewport);
13925
- this.wrapper.add(this.viewport);
13926
- this.content = new ContentRenderable(ctx, this.viewport, viewportCulling, {
13927
- alignSelf: "flex-start",
13928
- flexShrink: 0,
13929
- ...scrollX ? { minWidth: "100%" } : { minWidth: "100%", maxWidth: "100%" },
13930
- ...scrollY ? { minHeight: "100%" } : { minHeight: "100%", maxHeight: "100%" },
13931
- onSizeChange: () => {
13932
- this.recalculateBarProps();
13933
- },
13934
- ...mergedContentOptions,
13935
- id: `scroll-box-content-${this.internalId}`
13936
- });
13937
- children.push(this.content);
13938
- this.viewport.add(this.content);
13939
- this.verticalScrollBar = new ScrollBarRenderable(ctx, {
13940
- ...scrollbarOptions,
13941
- ...verticalScrollbarOptions,
13942
- arrowOptions: {
13943
- ...scrollbarOptions?.arrowOptions,
13944
- ...verticalScrollbarOptions?.arrowOptions
13945
- },
13946
- id: `scroll-box-vertical-scrollbar-${this.internalId}`,
13947
- orientation: "vertical",
13948
- onChange: (position) => {
13949
- if (this.isDestroyed)
13950
- return;
13951
- this.content.translateY = -position;
13952
- this.updateStickyState();
13953
- }
13954
- });
13955
- children.push(this.verticalScrollBar);
13956
- super.add(this.verticalScrollBar);
13957
- this.horizontalScrollBar = new ScrollBarRenderable(ctx, {
13958
- ...scrollbarOptions,
13959
- ...horizontalScrollbarOptions,
13960
- arrowOptions: {
13961
- ...scrollbarOptions?.arrowOptions,
13962
- ...horizontalScrollbarOptions?.arrowOptions
13963
- },
13964
- id: `scroll-box-horizontal-scrollbar-${this.internalId}`,
13965
- orientation: "horizontal",
13966
- onChange: (position) => {
13967
- if (this.isDestroyed)
13968
- return;
13969
- this.content.translateX = -position;
13970
- this.updateStickyState();
13971
- }
13972
- });
13973
- children.push(this.horizontalScrollBar);
13974
- this.wrapper.add(this.horizontalScrollBar);
13975
- this.recalculateBarProps();
13976
- if (stickyStart && stickyScroll) {
13977
- this.applyStickyStart(stickyStart);
13978
- }
14437
+ this.axes = { x: scrollX, y: scrollY };
14438
+ this._viewportCulling = viewportCulling;
14439
+ this.wrapper = new ScrollBoxWrapper(this);
14440
+ this.viewport = new ScrollBoxViewport(this);
14441
+ this.content = new ScrollBoxContent(this);
14442
+ this.verticalScrollBar = new ScrollBoxBar(this, "vertical");
14443
+ this.horizontalScrollBar = new ScrollBoxBar(this, "horizontal");
14444
+ this.wrapper._assign(wrapperOptions, ScrollBoxWrapper.keys);
14445
+ this.viewport._assign(viewportOptions, ScrollBoxViewport.keys);
14446
+ for (const [bar, own] of [
14447
+ [this.verticalScrollBar, verticalScrollbarOptions],
14448
+ [this.horizontalScrollBar, horizontalScrollbarOptions]
14449
+ ]) {
14450
+ bar._assign({ ...scrollbarOptions, ...own, arrowOptions: { ...scrollbarOptions?.arrowOptions, ...own?.arrowOptions } }, ScrollBoxBar.keys);
14451
+ }
14452
+ this.configured = true;
14453
+ this._applyScrollOptions();
14454
+ this._applyScrollArrows(0);
14455
+ this._applyScrollArrows(1);
14456
+ this.content._assign({ ...forwardedContentPadding, ...contentOptions }, ScrollBoxContent.keys);
14457
+ this._refreshScrollHook();
13979
14458
  this.selectionListener = () => {
13980
14459
  if (this.isDestroyed)
13981
14460
  return;
@@ -13987,14 +14466,149 @@ class ScrollBoxRenderable extends BoxRenderable2 {
13987
14466
  this._ctx.on("selection", this.selectionListener);
13988
14467
  this.setNativeScenePaint();
13989
14468
  } catch (error) {
13990
- this.abortConstruction(error, (run) => {
13991
- run(() => this.destroySelf());
13992
- for (let index = children.length - 1;index >= 0; index--) {
13993
- run(() => children[index].destroyRecursively());
13994
- }
13995
- });
14469
+ this.abortConstruction(error, (run) => run(() => this.destroySelf()));
13996
14470
  }
13997
14471
  }
14472
+ _applyScrollOptions() {
14473
+ if (!this.configured || this.isFreed())
14474
+ return;
14475
+ const sticky = this._stickyScroll && this._stickyStart;
14476
+ this._ctx.nativeScene.setScroll(this, {
14477
+ scrollX: this.axes.x,
14478
+ scrollY: this.axes.y,
14479
+ follow: sticky ? this._stickyStart : "none",
14480
+ culling: this._viewportCulling,
14481
+ padding: this.viewport._edges(),
14482
+ fills: [this.wrapper._fill(), this.viewport._fill(), this.content._fill()],
14483
+ bars: [this.horizontalScrollBar._native(), this.verticalScrollBar._native()]
14484
+ });
14485
+ this.requestRender();
14486
+ }
14487
+ _applyScrollArrows(axis) {
14488
+ if (!this.configured || this.isFreed())
14489
+ return;
14490
+ const bar = axis === 1 ? this.verticalScrollBar : this.horizontalScrollBar;
14491
+ bar._arrows().forEach((arrow, end) => this._ctx.nativeScene.setScrollArrow(this, axis, end, arrow));
14492
+ this.requestRender();
14493
+ }
14494
+ _setContentStyle(apply) {
14495
+ if (this.isFreed())
14496
+ return;
14497
+ apply(this._ctx.nativeScene, this);
14498
+ this.requestRender();
14499
+ }
14500
+ _scrollState() {
14501
+ if (this.isFreed())
14502
+ return this.state;
14503
+ const revision = this._ctx.nativeScene.observedLayoutRevision;
14504
+ if (revision !== undefined && revision === this.stateRevision)
14505
+ return this.state;
14506
+ this.state = this._ctx.nativeScene.getScroll(this);
14507
+ this.stateRevision = revision;
14508
+ return this.state;
14509
+ }
14510
+ _wrapperRect() {
14511
+ const { viewport, bars } = this._scrollState();
14512
+ const horizontal = bars[0];
14513
+ const gutter = horizontal.visible ? horizontal.track.y + horizontal.track.height - viewport.y - viewport.height : 0;
14514
+ return { ...viewport, height: viewport.height + Math.max(0, gutter) };
14515
+ }
14516
+ _scrollAxis(axis, value, relative, reapply = false) {
14517
+ if (this.isFreed())
14518
+ return;
14519
+ this.assertMutable();
14520
+ value ??= 0;
14521
+ if (Number.isNaN(value))
14522
+ throw new RangeError("Scene scroll positions must be finite numbers");
14523
+ const x = axis === 0 ? value : 0;
14524
+ const y = axis === 1 ? value : 0;
14525
+ this.commitScroll(() => this._ctx.nativeScene.scrollTo(this, x, y, axis !== 0 || relative, axis !== 1 || relative, reapply));
14526
+ }
14527
+ commitScroll(scroll) {
14528
+ const before = this._scrollState().offset;
14529
+ const state = scroll();
14530
+ this.state = state;
14531
+ this.stateRevision = this._ctx.nativeScene.observedLayoutRevision;
14532
+ const moved = (state.offset[0] !== before[0] ? 1 : 0) | (state.offset[1] !== before[1] ? 2 : 0);
14533
+ if (moved)
14534
+ this.requestRender();
14535
+ this.notifyOffsets(state, moved);
14536
+ }
14537
+ notifyOffsets(state, moved) {
14538
+ for (const axis of [1, 0]) {
14539
+ if ((moved & axis + 1) === 0)
14540
+ continue;
14541
+ (axis === 1 ? this.verticalScrollBar : this.horizontalScrollBar)._emitChange(state.offset[axis]);
14542
+ if (this.isDestroyed)
14543
+ return;
14544
+ }
14545
+ }
14546
+ listening() {
14547
+ return this.verticalScrollBar?._listening() || this.horizontalScrollBar?._listening() || this.content?._listening() || this.viewport?._listening() || this.layoutCallbacks.length > 0;
14548
+ }
14549
+ _refreshScrollHook(adding = false) {
14550
+ if (!this.configured || this.isFreed())
14551
+ return;
14552
+ const listening = adding || this.listening();
14553
+ if (listening === this.scrollHook)
14554
+ return;
14555
+ this.scrollHook = listening;
14556
+ this.refreshNativeSceneHooks();
14557
+ }
14558
+ notifyScroll() {
14559
+ const state = this._scrollState();
14560
+ this.notifyOffsets(state, state.changes);
14561
+ if (!this.isDestroyed && state.changes & 8)
14562
+ this.viewport._emitResize();
14563
+ if (!this.isDestroyed && state.changes & 4)
14564
+ this.content._emitResize();
14565
+ if (this.isDestroyed || !(state.changes & 16))
14566
+ return;
14567
+ const frame = this._ctx.frameId;
14568
+ const due = this.layoutCallbacks.filter((entry) => entry.frame < frame);
14569
+ this.layoutCallbacks = this.layoutCallbacks.filter((entry) => entry.frame >= frame);
14570
+ if (this.layoutCallbacks.length > 0)
14571
+ this._ctx.nativeScene.scrollRequest(this, "layout", null);
14572
+ let failure;
14573
+ for (const { callback } of due) {
14574
+ if (this.isDestroyed)
14575
+ break;
14576
+ try {
14577
+ callback();
14578
+ } catch (error) {
14579
+ failure ??= { error };
14580
+ }
14581
+ }
14582
+ this._refreshScrollHook();
14583
+ if (failure)
14584
+ throw failure.error;
14585
+ }
14586
+ afterLayout(callback) {
14587
+ if (this.isFreed())
14588
+ return;
14589
+ this.assertMutable();
14590
+ this.layoutCallbacks.push({ frame: this._ctx.frameId, callback });
14591
+ this._refreshScrollHook();
14592
+ this._ctx.nativeScene.scrollRequest(this, "layout", null);
14593
+ this.requestRender();
14594
+ }
14595
+ anchor(node) {
14596
+ if (this.isFreed())
14597
+ return () => {};
14598
+ this.assertMutable();
14599
+ this._ctx.nativeScene.scrollRequest(this, "anchor", node);
14600
+ const token = {};
14601
+ this.anchorToken = token;
14602
+ return () => {
14603
+ if (this.anchorToken !== token || this.isFreed())
14604
+ return;
14605
+ this._ctx.nativeScene.scrollRequest(this, "anchor", null);
14606
+ this.anchorToken = undefined;
14607
+ };
14608
+ }
14609
+ get primaryAxis() {
14610
+ return this.content._row ? "row" : "column";
14611
+ }
13998
14612
  onUpdate(deltaTime) {
13999
14613
  this.handleAutoScroll(deltaTime);
14000
14614
  }
@@ -14008,157 +14622,142 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14008
14622
  this.horizontalScrollBar.scrollBy(delta.x, unit);
14009
14623
  }
14010
14624
  }
14011
- scrollChildIntoView(childId) {
14012
- const child = this.content.findDescendantById(childId);
14013
- if (!child)
14625
+ scrollChildIntoView(child, options = {}) {
14626
+ const node = typeof child === "string" ? this.findDescendantById(child) : child;
14627
+ if (!node || this.isFreed())
14014
14628
  return;
14015
- const getNearestDelta = (elementStart, elementEnd, viewportStart, viewportEnd) => {
14016
- const elementSize = elementEnd - elementStart;
14017
- const viewportSize = viewportEnd - viewportStart;
14018
- const elementStartOutside = elementStart < viewportStart;
14019
- const elementEndOutside = elementEnd > viewportEnd;
14020
- if (elementStartOutside && elementEndOutside) {
14021
- return 0;
14022
- }
14023
- if (elementStartOutside && elementSize < viewportSize || elementEndOutside && elementSize > viewportSize) {
14024
- return elementStart - viewportStart;
14025
- }
14026
- if (elementStartOutside && elementSize > viewportSize || elementEndOutside && elementSize < viewportSize) {
14027
- return elementEnd - viewportEnd;
14028
- }
14029
- return 0;
14030
- };
14031
- const childTop = child.y;
14032
- const childBottom = child.y + child.height;
14033
- const viewportTop = this.viewport.y;
14034
- const viewportBottom = this.viewport.y + this.viewport.height;
14035
- const dy = getNearestDelta(childTop, childBottom, viewportTop, viewportBottom);
14036
- const childLeft = child.x;
14037
- const childRight = child.x + child.width;
14038
- const viewportLeft = this.viewport.x;
14039
- const viewportRight = this.viewport.x + this.viewport.width;
14040
- const dx = getNearestDelta(childLeft, childRight, viewportLeft, viewportRight);
14041
- if (dx !== 0 || dy !== 0) {
14042
- this.scrollBy({ x: dx, y: dy });
14043
- }
14629
+ this.assertMutable();
14630
+ this.commitScroll(() => this._ctx.nativeScene.scrollRequest(this, "into-view", node, options.align, options.inset));
14044
14631
  }
14045
14632
  scrollTo(position) {
14046
14633
  if (typeof position === "number") {
14047
- this.scrollTop = position;
14634
+ this._scrollAxis(1, position, false, true);
14048
14635
  } else {
14049
- this.scrollTop = position.y;
14636
+ this._scrollAxis(1, position.y, false, true);
14050
14637
  if (this.isDestroyed)
14051
14638
  return;
14052
- this.scrollLeft = position.x;
14639
+ this._scrollAxis(0, position.x, false, true);
14053
14640
  }
14054
14641
  }
14055
- isAtStickyPosition() {
14056
- if (!this._stickyScroll || !this._stickyStart) {
14642
+ scrollByWheel(event) {
14643
+ const dir = wheelDirection(event);
14644
+ const vertical = dir === "up" || dir === "down";
14645
+ if (!vertical && dir !== "left" && dir !== "right")
14057
14646
  return false;
14058
- }
14059
- const maxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
14060
- const maxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
14061
- switch (this._stickyStart) {
14062
- case "top":
14063
- return this.scrollTop === 0;
14064
- case "bottom":
14065
- return this.scrollTop >= maxScrollTop;
14066
- case "left":
14067
- return this.scrollLeft === 0;
14068
- case "right":
14069
- return this.scrollLeft >= maxScrollLeft;
14070
- default:
14071
- return false;
14647
+ const axis = vertical ? 1 : 0;
14648
+ const sign = dir === "up" || dir === "left" ? -1 : 1;
14649
+ const { offset, max } = this._scrollState();
14650
+ const position = offset[axis];
14651
+ if (sign < 0 ? position <= 0 : position >= max[axis])
14652
+ return false;
14653
+ let remainder = vertical ? this.scrollAccumulatorY : this.scrollAccumulatorX;
14654
+ if (remainder * sign < 0)
14655
+ remainder = 0;
14656
+ remainder += sign * (event.scroll?.delta ?? 0) * this.scrollAccel.tick(Date.now());
14657
+ const step = Math.trunc(remainder);
14658
+ if (step !== 0)
14659
+ this._scrollAxis(axis, position + step, false);
14660
+ remainder = this._scrollState().offset[axis] - position === step ? remainder - step : 0;
14661
+ if (vertical)
14662
+ this.scrollAccumulatorY = remainder;
14663
+ else
14664
+ this.scrollAccumulatorX = remainder;
14665
+ return true;
14666
+ }
14667
+ onMouseEvent(event) {
14668
+ if (event.type === "scroll")
14669
+ scrollOnce(event, this, () => this.scrollByWheel(event));
14670
+ if (this.handleBarMouse(event))
14671
+ return;
14672
+ if (event.type === "drag" && event.isDragging) {
14673
+ this.updateAutoScroll(event.x, event.y);
14674
+ } else if (event.type === "up") {
14675
+ this.stopAutoScroll();
14072
14676
  }
14073
14677
  }
14074
- isAtStickyReengagePoint(stickyStart, maxScrollTop, maxScrollLeft) {
14075
- switch (stickyStart) {
14076
- case "top":
14077
- return maxScrollTop > 0 && this.scrollTop <= 0;
14078
- case "bottom":
14079
- return maxScrollTop > 0 && this.scrollTop >= maxScrollTop - 1;
14080
- case "left":
14081
- return maxScrollLeft > 0 && this.scrollLeft <= 0;
14082
- case "right":
14083
- return maxScrollLeft > 0 && this.scrollLeft >= maxScrollLeft - 1;
14678
+ handleBarMouse(event) {
14679
+ const press = this.barPress;
14680
+ if (press && (event.type === "drag" || event.type === "up" || event.type === "drag-end")) {
14681
+ if ("offset" in press && event.type !== "drag-end")
14682
+ this.dragThumb(press, event);
14683
+ if (event.type === "up")
14684
+ this.endBarPress();
14685
+ event.stopPropagation();
14686
+ return true;
14084
14687
  }
14688
+ if (event.type !== "down" || event.button !== 0 || event.target !== this)
14689
+ return false;
14690
+ const { bars } = this._scrollState();
14691
+ for (const axis of [1, 0]) {
14692
+ const bar = bars[axis];
14693
+ if (!bar.visible)
14694
+ continue;
14695
+ const part = axis === 1 ? this.verticalScrollBar : this.horizontalScrollBar;
14696
+ const inside = (rect) => event.x >= rect.x && event.x < rect.x + rect.width && event.y >= rect.y && event.y < rect.y + rect.height;
14697
+ const arrow = part.showArrows ? inside(bar.startArrow) ? -1 : inside(bar.endArrow) ? 1 : 0 : 0;
14698
+ if (arrow === 0 && !inside(bar.track))
14699
+ continue;
14700
+ event.stopPropagation();
14701
+ event.preventDefault();
14702
+ this.endBarPress();
14703
+ if (arrow !== 0)
14704
+ this.pressArrow(axis, arrow, part);
14705
+ else
14706
+ this.pressTrack(axis, event);
14707
+ return true;
14708
+ }
14709
+ return false;
14085
14710
  }
14086
- add(obj, index) {
14087
- return this.content.add(obj, index);
14711
+ pressArrow(axis, arrow, part) {
14712
+ const press = { axis, arrow, timer: undefined };
14713
+ this.barPress = press;
14714
+ const step = (amount, delay) => {
14715
+ part.scrollBy(arrow * amount, "viewport");
14716
+ if (this.barPress !== press)
14717
+ return;
14718
+ press.timer = this._ctx.clock.setTimeout(() => step(delay === 500 ? 0.5 : 0.2, 200), delay);
14719
+ };
14720
+ step(0.5, 500);
14088
14721
  }
14089
- insertBefore(obj, anchor) {
14090
- return this.content.insertBefore(obj, anchor);
14722
+ thumbPointer(axis, event) {
14723
+ const bar = this._scrollState().bars[axis];
14724
+ const along = axis === 1 ? event.y - bar.track.y : event.x - bar.track.x;
14725
+ const length = axis === 1 ? bar.track.height : bar.track.width;
14726
+ return {
14727
+ at: Math.max(0, Math.min(length, along)) * 2,
14728
+ length: length * 2,
14729
+ start: bar.thumbStart,
14730
+ size: bar.thumbSize
14731
+ };
14091
14732
  }
14092
- remove(child) {
14093
- if (child.parent === this) {
14094
- super.remove(child);
14095
- return;
14733
+ pressTrack(axis, event) {
14734
+ let thumb = this.thumbPointer(axis, event);
14735
+ const inThumb = thumb.at >= Math.floor(thumb.start / 2) * 2 && thumb.at < Math.ceil((thumb.start + thumb.size) / 2) * 2;
14736
+ if (!inThumb) {
14737
+ const max = this._scrollState().max[axis];
14738
+ this._scrollAxis(axis, thumb.length === 0 ? 0 : thumb.at / thumb.length * max, false);
14739
+ if (this.isDestroyed)
14740
+ return;
14741
+ thumb = this.thumbPointer(axis, event);
14096
14742
  }
14097
- this.content.remove(child);
14743
+ this.barPress = { axis, offset: Math.max(0, Math.min(thumb.size, thumb.at - thumb.start)) };
14098
14744
  }
14099
- getChildren() {
14100
- return this.content.getChildren();
14745
+ dragThumb(press, event) {
14746
+ const thumb = this.thumbPointer(press.axis, event);
14747
+ const span = Math.max(0, thumb.length - thumb.size);
14748
+ const start = Math.max(0, Math.min(span, thumb.at - press.offset));
14749
+ this._scrollAxis(press.axis, span === 0 ? 0 : start / span * this._scrollState().max[press.axis], false);
14101
14750
  }
14102
- getRenderable(id) {
14103
- return this.content.getRenderable(id);
14104
- }
14105
- onMouseEvent(event) {
14106
- if (event.type === "scroll") {
14107
- let dir = event.scroll?.direction;
14108
- if (event.modifiers.shift)
14109
- dir = dir === "up" ? "left" : dir === "down" ? "right" : dir === "right" ? "down" : "up";
14110
- const baseDelta = event.scroll?.delta ?? 0;
14111
- const now = Date.now();
14112
- const multiplier = this.scrollAccel.tick(now);
14113
- const scrollAmount = baseDelta * multiplier;
14114
- if (dir === "up") {
14115
- this.scrollAccumulatorY -= scrollAmount;
14116
- const integerScroll = Math.trunc(this.scrollAccumulatorY);
14117
- if (integerScroll !== 0) {
14118
- this.scrollTop += integerScroll;
14119
- this.scrollAccumulatorY -= integerScroll;
14120
- }
14121
- } else if (dir === "down") {
14122
- this.scrollAccumulatorY += scrollAmount;
14123
- const integerScroll = Math.trunc(this.scrollAccumulatorY);
14124
- if (integerScroll !== 0) {
14125
- this.scrollTop += integerScroll;
14126
- this.scrollAccumulatorY -= integerScroll;
14127
- }
14128
- } else if (dir === "left") {
14129
- this.scrollAccumulatorX -= scrollAmount;
14130
- const integerScroll = Math.trunc(this.scrollAccumulatorX);
14131
- if (integerScroll !== 0) {
14132
- this.scrollLeft += integerScroll;
14133
- this.scrollAccumulatorX -= integerScroll;
14134
- }
14135
- } else if (dir === "right") {
14136
- this.scrollAccumulatorX += scrollAmount;
14137
- const integerScroll = Math.trunc(this.scrollAccumulatorX);
14138
- if (integerScroll !== 0) {
14139
- this.scrollLeft += integerScroll;
14140
- this.scrollAccumulatorX -= integerScroll;
14141
- }
14142
- }
14143
- this.syncManualScrollState();
14144
- }
14145
- if (event.type === "drag" && event.isDragging) {
14146
- this.updateAutoScroll(event.x, event.y);
14147
- } else if (event.type === "up") {
14148
- this.stopAutoScroll();
14149
- }
14751
+ endBarPress() {
14752
+ const press = this.barPress;
14753
+ this.barPress = undefined;
14754
+ if (press && "timer" in press && press.timer !== undefined)
14755
+ this._ctx.clock.clearTimeout(press.timer);
14150
14756
  }
14151
14757
  handleKeyPress(key) {
14152
- if (this.verticalScrollBar.handleKeyPress(key)) {
14153
- this.scrollAccel.reset();
14154
- this.resetScrollAccumulators();
14155
- this.syncManualScrollState();
14156
- return true;
14157
- }
14158
- if (this.horizontalScrollBar.handleKeyPress(key)) {
14758
+ if (this.verticalScrollBar.handleKeyPress(key) || this.horizontalScrollBar.handleKeyPress(key)) {
14159
14759
  this.scrollAccel.reset();
14160
14760
  this.resetScrollAccumulators();
14161
- this.syncManualScrollState();
14162
14761
  return true;
14163
14762
  }
14164
14763
  return false;
@@ -14174,6 +14773,7 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14174
14773
  this.cachedAutoScrollSpeed = this.getAutoScrollSpeed(mouseX, mouseY);
14175
14774
  this.isAutoScrolling = true;
14176
14775
  this.live = true;
14776
+ this.refreshNativeSceneHooks();
14177
14777
  }
14178
14778
  updateAutoScroll(mouseX, mouseY) {
14179
14779
  this.autoScrollMouseX = mouseX;
@@ -14192,8 +14792,10 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14192
14792
  this.isAutoScrolling = false;
14193
14793
  this.autoScrollAccumulatorX = 0;
14194
14794
  this.autoScrollAccumulatorY = 0;
14195
- if (wasAutoScrolling)
14795
+ if (wasAutoScrolling) {
14196
14796
  this.live = false;
14797
+ this.refreshNativeSceneHooks();
14798
+ }
14197
14799
  }
14198
14800
  handleAutoScroll(deltaTime) {
14199
14801
  if (!this.isAutoScrolling)
@@ -14238,8 +14840,7 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14238
14840
  if (distToLeft <= this.autoScrollThresholdHorizontal) {
14239
14841
  return this.scrollLeft > 0 ? -1 : 0;
14240
14842
  } else if (distToRight <= this.autoScrollThresholdHorizontal) {
14241
- const maxScrollLeft = this.scrollWidth - this.viewport.width;
14242
- return this.scrollLeft < maxScrollLeft ? 1 : 0;
14843
+ return this.scrollLeft < this._scrollState().max[0] ? 1 : 0;
14243
14844
  }
14244
14845
  return 0;
14245
14846
  }
@@ -14250,8 +14851,7 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14250
14851
  if (distToTop <= this.autoScrollThresholdVertical) {
14251
14852
  return this.scrollTop > 0 ? -1 : 0;
14252
14853
  } else if (distToBottom <= this.autoScrollThresholdVertical) {
14253
- const maxScrollTop = this.scrollHeight - this.viewport.height;
14254
- return this.scrollTop < maxScrollTop ? 1 : 0;
14854
+ return this.scrollTop < this._scrollState().max[1] ? 1 : 0;
14255
14855
  }
14256
14856
  return 0;
14257
14857
  }
@@ -14271,115 +14871,31 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14271
14871
  return this.autoScrollSpeedSlow;
14272
14872
  }
14273
14873
  }
14274
- recalculateBarProps() {
14275
- if (this.isDestroyed)
14276
- return;
14277
- const wasApplyingStickyScroll = this._isApplyingStickyScroll;
14278
- this._isApplyingStickyScroll = true;
14279
- try {
14280
- this.verticalScrollBar.scrollSize = this.content.height;
14281
- if (this.isDestroyed)
14282
- return;
14283
- this.verticalScrollBar.viewportSize = this.viewport.height;
14284
- if (this.isDestroyed)
14285
- return;
14286
- this.horizontalScrollBar.scrollSize = this.content.width;
14287
- if (this.isDestroyed)
14288
- return;
14289
- this.horizontalScrollBar.viewportSize = this.viewport.width;
14290
- if (this.isDestroyed)
14291
- return;
14292
- if (this._stickyScroll) {
14293
- const newMaxScrollTop = Math.max(0, this.scrollHeight - this.viewport.height);
14294
- const newMaxScrollLeft = Math.max(0, this.scrollWidth - this.viewport.width);
14295
- const stickyStart = this._stickyStart;
14296
- if (stickyStart && !this._hasManualScroll) {
14297
- this.applyStickyStart(stickyStart);
14298
- } else if (stickyStart && this._hasManualScroll && this.isAtStickyReengagePoint(stickyStart, newMaxScrollTop, newMaxScrollLeft)) {
14299
- this._hasManualScroll = false;
14300
- this.applyStickyStart(stickyStart);
14301
- } else if (!this._hasManualScroll) {
14302
- if (this._stickyScrollTop) {
14303
- this.scrollTop = 0;
14304
- } else if (this._stickyScrollBottom && newMaxScrollTop > 0) {
14305
- this.scrollTop = newMaxScrollTop;
14306
- }
14307
- if (this.isDestroyed)
14308
- return;
14309
- if (this._stickyScrollLeft) {
14310
- this.scrollLeft = 0;
14311
- } else if (this._stickyScrollRight && newMaxScrollLeft > 0) {
14312
- this.scrollLeft = newMaxScrollLeft;
14313
- }
14314
- }
14315
- }
14316
- } finally {
14317
- this._isApplyingStickyScroll = wasApplyingStickyScroll;
14318
- }
14319
- }
14320
- set padding(value) {
14321
- this.content.padding = value;
14322
- this.requestRender();
14323
- }
14324
- set paddingX(value) {
14325
- this.content.paddingX = value;
14326
- this.requestRender();
14327
- }
14328
- set paddingY(value) {
14329
- this.content.paddingY = value;
14330
- this.requestRender();
14331
- }
14332
- set paddingTop(value) {
14333
- this.content.paddingTop = value;
14334
- this.requestRender();
14335
- }
14336
- set paddingRight(value) {
14337
- this.content.paddingRight = value;
14338
- this.requestRender();
14339
- }
14340
- set paddingBottom(value) {
14341
- this.content.paddingBottom = value;
14342
- this.requestRender();
14343
- }
14344
- set paddingLeft(value) {
14345
- this.content.paddingLeft = value;
14346
- this.requestRender();
14347
- }
14348
14874
  set rootOptions(options) {
14349
- this.assignOptions(this, options);
14875
+ this.assignOptions(this, options && stripScrollBoxPadding(options));
14876
+ if (options)
14877
+ this.content._assign(pickScrollBoxPadding(options), ScrollBoxContent.keys);
14350
14878
  if (!this.isDestroyed)
14351
14879
  this.requestRender();
14352
14880
  }
14353
14881
  set wrapperOptions(options) {
14354
- this.assignOptions(this.wrapper, options);
14355
- if (!this.isDestroyed)
14356
- this.requestRender();
14882
+ this.wrapper._assign(options, ScrollBoxWrapper.keys);
14357
14883
  }
14358
14884
  set viewportOptions(options) {
14359
- this.assignOptions(this.viewport, options);
14360
- if (!this.isDestroyed)
14361
- this.requestRender();
14885
+ this.viewport._assign(options, ScrollBoxViewport.keys);
14362
14886
  }
14363
14887
  set contentOptions(options) {
14364
- this.assignOptions(this.content, options);
14365
- if (!this.isDestroyed)
14366
- this.requestRender();
14888
+ this.content._assign(options, ScrollBoxContent.keys);
14367
14889
  }
14368
14890
  set scrollbarOptions(options) {
14369
- this.assignOptions(this.verticalScrollBar, options);
14370
- this.assignOptions(this.horizontalScrollBar, options);
14371
- if (!this.isDestroyed)
14372
- this.requestRender();
14891
+ this.verticalScrollBar._assign(options ?? { onChange: undefined }, ScrollBoxBar.keys);
14892
+ this.horizontalScrollBar._assign(options ?? { onChange: undefined }, ScrollBoxBar.keys);
14373
14893
  }
14374
14894
  set verticalScrollbarOptions(options) {
14375
- this.assignOptions(this.verticalScrollBar, options);
14376
- if (!this.isDestroyed)
14377
- this.requestRender();
14895
+ this.verticalScrollBar._assign(options ?? { onChange: undefined }, ScrollBoxBar.keys);
14378
14896
  }
14379
14897
  set horizontalScrollbarOptions(options) {
14380
- this.assignOptions(this.horizontalScrollBar, options);
14381
- if (!this.isDestroyed)
14382
- this.requestRender();
14898
+ this.horizontalScrollBar._assign(options ?? { onChange: undefined }, ScrollBoxBar.keys);
14383
14899
  }
14384
14900
  get scrollAcceleration() {
14385
14901
  return this.scrollAccel;
@@ -14388,15 +14904,22 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14388
14904
  this.scrollAccel = value;
14389
14905
  }
14390
14906
  get viewportCulling() {
14391
- return this.content.viewportCulling;
14907
+ return this._viewportCulling;
14392
14908
  }
14393
14909
  set viewportCulling(value) {
14394
- this.content.viewportCulling = value;
14395
- this.requestRender();
14910
+ this.setScrollOption(() => this._viewportCulling = value ?? true);
14911
+ }
14912
+ get overflow() {
14913
+ return "hidden";
14396
14914
  }
14915
+ set overflow(_value) {}
14397
14916
  destroySelf() {
14917
+ if (!this.isFreed())
14918
+ this._scrollState();
14398
14919
  const selectionListener = this.selectionListener;
14399
14920
  this.selectionListener = undefined;
14921
+ this.layoutCallbacks = [];
14922
+ this.endBarPress();
14400
14923
  this.runCleanup((run) => {
14401
14924
  if (selectionListener)
14402
14925
  run(() => this._ctx.off("selection", selectionListener));
@@ -14404,6 +14927,14 @@ class ScrollBoxRenderable extends BoxRenderable2 {
14404
14927
  });
14405
14928
  }
14406
14929
  }
14930
+ for (const key of SCROLLBOX_PADDING_KEYS) {
14931
+ Object.defineProperty(ScrollBoxRenderable.prototype, key, {
14932
+ configurable: true,
14933
+ set(value) {
14934
+ this.content[key] = value;
14935
+ }
14936
+ });
14937
+ }
14407
14938
  // src/renderables/Select.ts
14408
14939
  var defaultSelectKeybindings = [
14409
14940
  { name: "up", action: "move-up" },
@@ -15183,8 +15714,9 @@ class TimeToFirstDrawRenderable extends Renderable2 {
15183
15714
  const content = `${this.label}: ${this._runtimeMs.toFixed(this.precision)}ms`;
15184
15715
  const maxWidth = Math.max(this.width, 1);
15185
15716
  const visibleContent = truncateToCellWidth(buffer, content, maxWidth);
15186
- const centeredX = this.x + Math.max(0, Math.floor((maxWidth - visibleContent.width) / 2));
15187
- buffer.drawText(visibleContent.text, centeredX, this.y, this.textColor);
15717
+ const [x, y] = this._paintOrigin(buffer);
15718
+ const centeredX = x + Math.max(0, Math.floor((maxWidth - visibleContent.width) / 2));
15719
+ buffer.drawText(visibleContent.text, centeredX, y, this.textColor);
15188
15720
  }
15189
15721
  normalizePrecision(value) {
15190
15722
  if (!Number.isFinite(value)) {
@@ -15316,7 +15848,11 @@ export {
15316
15848
  SYNTHWAVE_MATRIX,
15317
15849
  ScrollBarRenderable,
15318
15850
  ScrollBox,
15851
+ ScrollBoxBar,
15852
+ ScrollBoxContent,
15319
15853
  ScrollBoxRenderable,
15854
+ ScrollBoxViewport,
15855
+ ScrollBoxWrapper,
15320
15856
  Select,
15321
15857
  SelectRenderable,
15322
15858
  SelectRenderableEvents,
@@ -15326,7 +15862,7 @@ export {
15326
15862
  SlotRenderable,
15327
15863
  StdinParser2 as StdinParser,
15328
15864
  StyledText2 as StyledText,
15329
- SyntaxStyle2 as SyntaxStyle,
15865
+ SyntaxStyle,
15330
15866
  SystemClock2 as SystemClock,
15331
15867
  TECHNICOLOR_MATRIX,
15332
15868
  TRITANOPIA_COMP_MATRIX,
@@ -15392,7 +15928,7 @@ export {
15392
15928
  capture2 as capture,
15393
15929
  clearEnvCache2 as clearEnvCache,
15394
15930
  convertGlobalToLocalSelection2 as convertGlobalToLocalSelection,
15395
- convertThemeToStyles2 as convertThemeToStyles,
15931
+ convertThemeToStyles,
15396
15932
  coordinateToCharacterIndex2 as coordinateToCharacterIndex,
15397
15933
  createCliRenderer2 as createCliRenderer,
15398
15934
  createClipboard2 as createClipboard,
@@ -15484,6 +16020,7 @@ export {
15484
16020
  resolveRenderLib2 as resolveRenderLib,
15485
16021
  reverse2 as reverse,
15486
16022
  rgbToHex2 as rgbToHex,
16023
+ scrollUnitSize,
15487
16024
  setRenderLibPath2 as setRenderLibPath,
15488
16025
  setupAudio,
15489
16026
  strikethrough2 as strikethrough,
@@ -15501,5 +16038,5 @@ export {
15501
16038
  yellow2 as yellow
15502
16039
  };
15503
16040
 
15504
- //# debugId=7177BFBAA0B78F6664756E2164756E21
16041
+ //# debugId=B48247C5EAE62C3D64756E2164756E21
15505
16042
  //# sourceMappingURL=index.bun.js.map