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