stream-monaco 0.0.37 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-C0_StL1Z.cjs');
1
+ const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-BGhvoZsn.cjs');
2
2
 
3
3
  //#region src/ensureMonacoWorkers.ts
4
4
  function ensureMonacoWorkers() {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, editorWorkerPath, getOrCreateHighlighter, registerMonacoThemes, uniqueWorkerPaths, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-BRnjKKQj.js";
1
+ import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, editorWorkerPath, getOrCreateHighlighter, registerMonacoThemes, uniqueWorkerPaths, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-DKFGQtO0.js";
2
2
 
3
3
  //#region src/ensureMonacoWorkers.ts
4
4
  function ensureMonacoWorkers() {
@@ -1,4 +1,4 @@
1
- const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-C0_StL1Z.cjs');
1
+ const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-BGhvoZsn.cjs');
2
2
  const monaco_editor_esm_vs_basic_languages_cpp_cpp = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/cpp/cpp"));
3
3
  const monaco_editor_esm_vs_basic_languages_javascript_javascript = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/javascript/javascript"));
4
4
  const monaco_editor_esm_vs_basic_languages_powershell_powershell = require_preloadMonacoWorkers_shared.__toESM(require("monaco-editor/esm/vs/basic-languages/powershell/powershell"));
@@ -1,4 +1,4 @@
1
- import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, monaco_shim_exports, processedLanguage, registerMonacoThemes, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-BRnjKKQj.js";
1
+ import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, monaco_shim_exports, processedLanguage, registerMonacoThemes, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-DKFGQtO0.js";
2
2
  import { conf, language } from "monaco-editor/esm/vs/basic-languages/cpp/cpp";
3
3
  import { conf as conf$1, language as language$1 } from "monaco-editor/esm/vs/basic-languages/javascript/javascript";
4
4
  import { conf as conf$2, language as language$2 } from "monaco-editor/esm/vs/basic-languages/powershell/powershell";
@@ -267,6 +267,7 @@ function createHeightManager(container, computeNext) {
267
267
  const HYSTERESIS_PX = 12;
268
268
  const DEBOUNCE_MS = 0;
269
269
  function apply() {
270
+ var _container$getBoundin;
270
271
  const next = computeNext();
271
272
  if (next == null) return;
272
273
  log("heightManager", "computeNext ->", {
@@ -277,6 +278,11 @@ function createHeightManager(container, computeNext) {
277
278
  log("heightManager", "invalid next height, ignoring", next);
278
279
  return;
279
280
  }
281
+ const currentHeight = Number.parseFloat(container.style.height || "") || ((_container$getBoundin = container.getBoundingClientRect) === null || _container$getBoundin === void 0 ? void 0 : _container$getBoundin.call(container).height) || 0;
282
+ if (currentHeight > 0 && Math.abs(next - currentHeight) <= HYSTERESIS_PX) {
283
+ lastApplied = next;
284
+ return;
285
+ }
280
286
  if (lastApplied !== -1 && Math.abs(next - lastApplied) <= HYSTERESIS_PX) return;
281
287
  if (next === lastApplied) return;
282
288
  suppressed = true;
@@ -5406,7 +5412,17 @@ var EditorManager = class {
5406
5412
  return distance <= threshold;
5407
5413
  }
5408
5414
  computedHeight(editorView) {
5409
- var _editorView$getModel;
5415
+ var _editorView$getConten, _editorView$getModel;
5416
+ const contentHeight = (_editorView$getConten = editorView.getContentHeight) === null || _editorView$getConten === void 0 ? void 0 : _editorView$getConten.call(editorView);
5417
+ if (typeof contentHeight === "number" && Number.isFinite(contentHeight) && contentHeight > 0) {
5418
+ const height$1 = Math.min(contentHeight, this.maxHeightValue);
5419
+ log("EditorManager.computedHeight", {
5420
+ contentHeight,
5421
+ computed: height$1,
5422
+ maxHeightValue: this.maxHeightValue
5423
+ });
5424
+ return height$1;
5425
+ }
5410
5426
  const lineCount = this.cachedLineCount ?? ((_editorView$getModel = editorView.getModel()) === null || _editorView$getModel === void 0 ? void 0 : _editorView$getModel.getLineCount()) ?? 1;
5411
5427
  const lineHeight = editorView.getOption(monaco_shim_exports.editor.EditorOption.lineHeight);
5412
5428
  const height = Math.min(lineCount * lineHeight + padding, this.maxHeightValue);
@@ -5530,8 +5546,31 @@ var EditorManager = class {
5530
5546
  shouldPerformImmediateReveal() {
5531
5547
  return this.autoScrollOnUpdate && this.shouldAutoScroll && this.hasVerticalScrollbar() && this.isOverflowAuto();
5532
5548
  }
5549
+ syncNonOverflowingLayout() {
5550
+ var _this$lastContainer$g, _this$lastContainer;
5551
+ if (!this.editorView || !this.lastContainer) return null;
5552
+ const computed$1 = this.computedHeight(this.editorView);
5553
+ if (computed$1 >= this.maxHeightValue - 1) {
5554
+ this.lastContainer.style.height = `${this.maxHeightValue}px`;
5555
+ return computed$1;
5556
+ }
5557
+ const currentHeight = Number.parseFloat(this.lastContainer.style.height || "") || ((_this$lastContainer$g = (_this$lastContainer = this.lastContainer).getBoundingClientRect) === null || _this$lastContainer$g === void 0 ? void 0 : _this$lastContainer$g.call(_this$lastContainer).height) || 0;
5558
+ if (currentHeight <= 0 || Math.abs(computed$1 - currentHeight) > 12) this.lastContainer.style.height = `${computed$1}px`;
5559
+ this.lastContainer.style.overflow = "hidden";
5560
+ this._hasScrollBar = false;
5561
+ try {
5562
+ var _this$editorView$layo, _this$editorView5;
5563
+ (_this$editorView$layo = (_this$editorView5 = this.editorView).layout) === null || _this$editorView$layo === void 0 || _this$editorView$layo.call(_this$editorView5);
5564
+ } catch {}
5565
+ try {
5566
+ var _this$editorView$getS3, _this$editorView6, _this$editorView$setS, _this$editorView7;
5567
+ if ((((_this$editorView$getS3 = (_this$editorView6 = this.editorView).getScrollTop) === null || _this$editorView$getS3 === void 0 ? void 0 : _this$editorView$getS3.call(_this$editorView6)) ?? 0) !== 0) (_this$editorView$setS = (_this$editorView7 = this.editorView).setScrollTop) === null || _this$editorView$setS === void 0 || _this$editorView$setS.call(_this$editorView7, 0);
5568
+ this.lastScrollTop = 0;
5569
+ } catch {}
5570
+ return computed$1;
5571
+ }
5533
5572
  async createEditor(container, code, language, currentTheme) {
5534
- var _this$editorView$getS3, _this$editorView5, _this$editorView$getO, _this$editorView6, _this$editorView$getM, _this$editorView$onDi, _this$editorView7;
5573
+ var _this$editorView$getS4, _this$editorView8, _this$editorView$getO, _this$editorView9, _this$editorView$getM, _this$editorView$onDi, _this$editorView10;
5535
5574
  this.cleanup();
5536
5575
  this.lastContainer = container;
5537
5576
  this.initDebugFlag();
@@ -5567,12 +5606,9 @@ var EditorManager = class {
5567
5606
  }
5568
5607
  if (this.revealIdleTimerId != null) clearTimeout(this.revealIdleTimerId);
5569
5608
  this.revealIdleTimerId = null;
5570
- const MIN_VISIBLE_HEIGHT = Math.min(120, this.maxHeightValue);
5571
- container.style.minHeight = `${MIN_VISIBLE_HEIGHT}px`;
5572
5609
  this.editorHeightManager = createHeightManager(container, () => {
5573
5610
  const computed$1 = this.computedHeight(this.editorView);
5574
- const clamped = Math.min(computed$1, this.maxHeightValue);
5575
- return Math.max(clamped, MIN_VISIBLE_HEIGHT);
5611
+ return Math.min(computed$1, this.maxHeightValue);
5576
5612
  });
5577
5613
  this.editorHeightManager.update();
5578
5614
  const initialComputed = this.computedHeight(this.editorView);
@@ -5581,17 +5617,17 @@ var EditorManager = class {
5581
5617
  container.style.overflow = "auto";
5582
5618
  this.dlog("applied immediate maxHeight on createEditor", this.maxHeightValue);
5583
5619
  }
5584
- this.cachedScrollHeight = ((_this$editorView$getS3 = (_this$editorView5 = this.editorView).getScrollHeight) === null || _this$editorView$getS3 === void 0 ? void 0 : _this$editorView$getS3.call(_this$editorView5)) ?? null;
5585
- this.cachedLineHeight = ((_this$editorView$getO = (_this$editorView6 = this.editorView).getOption) === null || _this$editorView$getO === void 0 ? void 0 : _this$editorView$getO.call(_this$editorView6, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
5620
+ this.cachedScrollHeight = ((_this$editorView$getS4 = (_this$editorView8 = this.editorView).getScrollHeight) === null || _this$editorView$getS4 === void 0 ? void 0 : _this$editorView$getS4.call(_this$editorView8)) ?? null;
5621
+ this.cachedLineHeight = ((_this$editorView$getO = (_this$editorView9 = this.editorView).getOption) === null || _this$editorView$getO === void 0 ? void 0 : _this$editorView$getO.call(_this$editorView9, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
5586
5622
  this.cachedComputedHeight = this.computedHeight(this.editorView);
5587
5623
  this.cachedLineCount = ((_this$editorView$getM = this.editorView.getModel()) === null || _this$editorView$getM === void 0 ? void 0 : _this$editorView$getM.getLineCount()) ?? null;
5588
- (_this$editorView$onDi = (_this$editorView7 = this.editorView).onDidContentSizeChange) === null || _this$editorView$onDi === void 0 || _this$editorView$onDi.call(_this$editorView7, () => {
5624
+ (_this$editorView$onDi = (_this$editorView10 = this.editorView).onDidContentSizeChange) === null || _this$editorView$onDi === void 0 || _this$editorView$onDi.call(_this$editorView10, () => {
5589
5625
  this._hasScrollBar = false;
5590
5626
  this.rafScheduler.schedule("content-size-change", () => {
5591
5627
  try {
5592
- var _this$editorView8, _this$editorHeightMan, _this$editorHeightMan2;
5628
+ var _this$editorView11, _this$editorHeightMan, _this$editorHeightMan2;
5593
5629
  this.dlog("content-size-change frame");
5594
- this.cachedLineCount = ((_this$editorView8 = this.editorView) === null || _this$editorView8 === void 0 || (_this$editorView8 = _this$editorView8.getModel()) === null || _this$editorView8 === void 0 ? void 0 : _this$editorView8.getLineCount()) ?? this.cachedLineCount;
5630
+ this.cachedLineCount = ((_this$editorView11 = this.editorView) === null || _this$editorView11 === void 0 || (_this$editorView11 = _this$editorView11.getModel()) === null || _this$editorView11 === void 0 ? void 0 : _this$editorView11.getLineCount()) ?? this.cachedLineCount;
5595
5631
  this.cachedComputedHeight = null;
5596
5632
  const m = this.measureViewport();
5597
5633
  this.dlog("content-size-change measure", m);
@@ -5753,9 +5789,8 @@ var EditorManager = class {
5753
5789
  if (newLineCount$1 !== prevLineCount$1) {
5754
5790
  const shouldImmediate = this.shouldPerformImmediateReveal();
5755
5791
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5756
- const computed$1 = this.computedHeight(this.editorView);
5757
- if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5758
- this.forceReveal(newLineCount$1);
5792
+ const computed$1 = this.syncNonOverflowingLayout();
5793
+ if (computed$1 != null && computed$1 >= this.maxHeightValue - 1) this.forceReveal(newLineCount$1);
5759
5794
  }
5760
5795
  return;
5761
5796
  }
@@ -5789,6 +5824,7 @@ var EditorManager = class {
5789
5824
  if (newLineCount !== prevLineCount) {
5790
5825
  const shouldImmediate = this.shouldPerformImmediateReveal();
5791
5826
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5827
+ this.syncNonOverflowingLayout();
5792
5828
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayout(newLineCount);
5793
5829
  else this.maybeScrollToBottom(newLineCount);
5794
5830
  }
@@ -5823,7 +5859,10 @@ var EditorManager = class {
5823
5859
  this.lastKnownCode = next;
5824
5860
  const newLineCount = model.getLineCount();
5825
5861
  this.cachedLineCount = newLineCount;
5826
- if (newLineCount !== prevLineCount) this.maybeScrollToBottom(newLineCount);
5862
+ if (newLineCount !== prevLineCount) {
5863
+ this.syncNonOverflowingLayout();
5864
+ this.maybeScrollToBottom(newLineCount);
5865
+ }
5827
5866
  return;
5828
5867
  }
5829
5868
  const res = computeMinimalEdit(prev, next);
@@ -5878,8 +5917,7 @@ var EditorManager = class {
5878
5917
  this.cachedComputedHeight = null;
5879
5918
  const shouldImmediate = this.shouldPerformImmediateReveal();
5880
5919
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5881
- const computed$1 = this.computedHeight(this.editorView);
5882
- if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5920
+ this.syncNonOverflowingLayout();
5883
5921
  if (shouldImmediate) try {
5884
5922
  this.forceReveal(newLineCount);
5885
5923
  } catch {}
@@ -5898,8 +5936,8 @@ var EditorManager = class {
5898
5936
  return this.editorView;
5899
5937
  }
5900
5938
  getCode() {
5901
- var _this$editorView9;
5902
- return ((_this$editorView9 = this.editorView) === null || _this$editorView9 === void 0 || (_this$editorView9 = _this$editorView9.getModel()) === null || _this$editorView9 === void 0 ? void 0 : _this$editorView9.getValue()) ?? null;
5939
+ var _this$editorView12;
5940
+ return ((_this$editorView12 = this.editorView) === null || _this$editorView12 === void 0 || (_this$editorView12 = _this$editorView12.getModel()) === null || _this$editorView12 === void 0 ? void 0 : _this$editorView12.getValue()) ?? null;
5903
5941
  }
5904
5942
  setUpdateThrottleMs(ms) {
5905
5943
  this.updateThrottleMs = ms;
@@ -262,6 +262,7 @@ function createHeightManager(container, computeNext) {
262
262
  const HYSTERESIS_PX = 12;
263
263
  const DEBOUNCE_MS = 0;
264
264
  function apply() {
265
+ var _container$getBoundin;
265
266
  const next = computeNext();
266
267
  if (next == null) return;
267
268
  log("heightManager", "computeNext ->", {
@@ -272,6 +273,11 @@ function createHeightManager(container, computeNext) {
272
273
  log("heightManager", "invalid next height, ignoring", next);
273
274
  return;
274
275
  }
276
+ const currentHeight = Number.parseFloat(container.style.height || "") || ((_container$getBoundin = container.getBoundingClientRect) === null || _container$getBoundin === void 0 ? void 0 : _container$getBoundin.call(container).height) || 0;
277
+ if (currentHeight > 0 && Math.abs(next - currentHeight) <= HYSTERESIS_PX) {
278
+ lastApplied = next;
279
+ return;
280
+ }
275
281
  if (lastApplied !== -1 && Math.abs(next - lastApplied) <= HYSTERESIS_PX) return;
276
282
  if (next === lastApplied) return;
277
283
  suppressed = true;
@@ -5401,7 +5407,17 @@ var EditorManager = class {
5401
5407
  return distance <= threshold;
5402
5408
  }
5403
5409
  computedHeight(editorView) {
5404
- var _editorView$getModel;
5410
+ var _editorView$getConten, _editorView$getModel;
5411
+ const contentHeight = (_editorView$getConten = editorView.getContentHeight) === null || _editorView$getConten === void 0 ? void 0 : _editorView$getConten.call(editorView);
5412
+ if (typeof contentHeight === "number" && Number.isFinite(contentHeight) && contentHeight > 0) {
5413
+ const height$1 = Math.min(contentHeight, this.maxHeightValue);
5414
+ log("EditorManager.computedHeight", {
5415
+ contentHeight,
5416
+ computed: height$1,
5417
+ maxHeightValue: this.maxHeightValue
5418
+ });
5419
+ return height$1;
5420
+ }
5405
5421
  const lineCount = this.cachedLineCount ?? ((_editorView$getModel = editorView.getModel()) === null || _editorView$getModel === void 0 ? void 0 : _editorView$getModel.getLineCount()) ?? 1;
5406
5422
  const lineHeight = editorView.getOption(monaco_shim_exports.editor.EditorOption.lineHeight);
5407
5423
  const height = Math.min(lineCount * lineHeight + padding, this.maxHeightValue);
@@ -5525,8 +5541,31 @@ var EditorManager = class {
5525
5541
  shouldPerformImmediateReveal() {
5526
5542
  return this.autoScrollOnUpdate && this.shouldAutoScroll && this.hasVerticalScrollbar() && this.isOverflowAuto();
5527
5543
  }
5544
+ syncNonOverflowingLayout() {
5545
+ var _this$lastContainer$g, _this$lastContainer;
5546
+ if (!this.editorView || !this.lastContainer) return null;
5547
+ const computed$2 = this.computedHeight(this.editorView);
5548
+ if (computed$2 >= this.maxHeightValue - 1) {
5549
+ this.lastContainer.style.height = `${this.maxHeightValue}px`;
5550
+ return computed$2;
5551
+ }
5552
+ const currentHeight = Number.parseFloat(this.lastContainer.style.height || "") || ((_this$lastContainer$g = (_this$lastContainer = this.lastContainer).getBoundingClientRect) === null || _this$lastContainer$g === void 0 ? void 0 : _this$lastContainer$g.call(_this$lastContainer).height) || 0;
5553
+ if (currentHeight <= 0 || Math.abs(computed$2 - currentHeight) > 12) this.lastContainer.style.height = `${computed$2}px`;
5554
+ this.lastContainer.style.overflow = "hidden";
5555
+ this._hasScrollBar = false;
5556
+ try {
5557
+ var _this$editorView$layo, _this$editorView5;
5558
+ (_this$editorView$layo = (_this$editorView5 = this.editorView).layout) === null || _this$editorView$layo === void 0 || _this$editorView$layo.call(_this$editorView5);
5559
+ } catch {}
5560
+ try {
5561
+ var _this$editorView$getS3, _this$editorView6, _this$editorView$setS, _this$editorView7;
5562
+ if ((((_this$editorView$getS3 = (_this$editorView6 = this.editorView).getScrollTop) === null || _this$editorView$getS3 === void 0 ? void 0 : _this$editorView$getS3.call(_this$editorView6)) ?? 0) !== 0) (_this$editorView$setS = (_this$editorView7 = this.editorView).setScrollTop) === null || _this$editorView$setS === void 0 || _this$editorView$setS.call(_this$editorView7, 0);
5563
+ this.lastScrollTop = 0;
5564
+ } catch {}
5565
+ return computed$2;
5566
+ }
5528
5567
  async createEditor(container, code, language, currentTheme) {
5529
- var _this$editorView$getS3, _this$editorView5, _this$editorView$getO, _this$editorView6, _this$editorView$getM, _this$editorView$onDi, _this$editorView7;
5568
+ var _this$editorView$getS4, _this$editorView8, _this$editorView$getO, _this$editorView9, _this$editorView$getM, _this$editorView$onDi, _this$editorView10;
5530
5569
  this.cleanup();
5531
5570
  this.lastContainer = container;
5532
5571
  this.initDebugFlag();
@@ -5562,12 +5601,9 @@ var EditorManager = class {
5562
5601
  }
5563
5602
  if (this.revealIdleTimerId != null) clearTimeout(this.revealIdleTimerId);
5564
5603
  this.revealIdleTimerId = null;
5565
- const MIN_VISIBLE_HEIGHT = Math.min(120, this.maxHeightValue);
5566
- container.style.minHeight = `${MIN_VISIBLE_HEIGHT}px`;
5567
5604
  this.editorHeightManager = createHeightManager(container, () => {
5568
5605
  const computed$2 = this.computedHeight(this.editorView);
5569
- const clamped = Math.min(computed$2, this.maxHeightValue);
5570
- return Math.max(clamped, MIN_VISIBLE_HEIGHT);
5606
+ return Math.min(computed$2, this.maxHeightValue);
5571
5607
  });
5572
5608
  this.editorHeightManager.update();
5573
5609
  const initialComputed = this.computedHeight(this.editorView);
@@ -5576,17 +5612,17 @@ var EditorManager = class {
5576
5612
  container.style.overflow = "auto";
5577
5613
  this.dlog("applied immediate maxHeight on createEditor", this.maxHeightValue);
5578
5614
  }
5579
- this.cachedScrollHeight = ((_this$editorView$getS3 = (_this$editorView5 = this.editorView).getScrollHeight) === null || _this$editorView$getS3 === void 0 ? void 0 : _this$editorView$getS3.call(_this$editorView5)) ?? null;
5580
- this.cachedLineHeight = ((_this$editorView$getO = (_this$editorView6 = this.editorView).getOption) === null || _this$editorView$getO === void 0 ? void 0 : _this$editorView$getO.call(_this$editorView6, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
5615
+ this.cachedScrollHeight = ((_this$editorView$getS4 = (_this$editorView8 = this.editorView).getScrollHeight) === null || _this$editorView$getS4 === void 0 ? void 0 : _this$editorView$getS4.call(_this$editorView8)) ?? null;
5616
+ this.cachedLineHeight = ((_this$editorView$getO = (_this$editorView9 = this.editorView).getOption) === null || _this$editorView$getO === void 0 ? void 0 : _this$editorView$getO.call(_this$editorView9, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
5581
5617
  this.cachedComputedHeight = this.computedHeight(this.editorView);
5582
5618
  this.cachedLineCount = ((_this$editorView$getM = this.editorView.getModel()) === null || _this$editorView$getM === void 0 ? void 0 : _this$editorView$getM.getLineCount()) ?? null;
5583
- (_this$editorView$onDi = (_this$editorView7 = this.editorView).onDidContentSizeChange) === null || _this$editorView$onDi === void 0 || _this$editorView$onDi.call(_this$editorView7, () => {
5619
+ (_this$editorView$onDi = (_this$editorView10 = this.editorView).onDidContentSizeChange) === null || _this$editorView$onDi === void 0 || _this$editorView$onDi.call(_this$editorView10, () => {
5584
5620
  this._hasScrollBar = false;
5585
5621
  this.rafScheduler.schedule("content-size-change", () => {
5586
5622
  try {
5587
- var _this$editorView8, _this$editorHeightMan, _this$editorHeightMan2;
5623
+ var _this$editorView11, _this$editorHeightMan, _this$editorHeightMan2;
5588
5624
  this.dlog("content-size-change frame");
5589
- this.cachedLineCount = ((_this$editorView8 = this.editorView) === null || _this$editorView8 === void 0 || (_this$editorView8 = _this$editorView8.getModel()) === null || _this$editorView8 === void 0 ? void 0 : _this$editorView8.getLineCount()) ?? this.cachedLineCount;
5625
+ this.cachedLineCount = ((_this$editorView11 = this.editorView) === null || _this$editorView11 === void 0 || (_this$editorView11 = _this$editorView11.getModel()) === null || _this$editorView11 === void 0 ? void 0 : _this$editorView11.getLineCount()) ?? this.cachedLineCount;
5590
5626
  this.cachedComputedHeight = null;
5591
5627
  const m = this.measureViewport();
5592
5628
  this.dlog("content-size-change measure", m);
@@ -5748,9 +5784,8 @@ var EditorManager = class {
5748
5784
  if (newLineCount$1 !== prevLineCount$1) {
5749
5785
  const shouldImmediate = this.shouldPerformImmediateReveal();
5750
5786
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5751
- const computed$2 = this.computedHeight(this.editorView);
5752
- if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5753
- this.forceReveal(newLineCount$1);
5787
+ const computed$2 = this.syncNonOverflowingLayout();
5788
+ if (computed$2 != null && computed$2 >= this.maxHeightValue - 1) this.forceReveal(newLineCount$1);
5754
5789
  }
5755
5790
  return;
5756
5791
  }
@@ -5784,6 +5819,7 @@ var EditorManager = class {
5784
5819
  if (newLineCount !== prevLineCount) {
5785
5820
  const shouldImmediate = this.shouldPerformImmediateReveal();
5786
5821
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5822
+ this.syncNonOverflowingLayout();
5787
5823
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayout(newLineCount);
5788
5824
  else this.maybeScrollToBottom(newLineCount);
5789
5825
  }
@@ -5818,7 +5854,10 @@ var EditorManager = class {
5818
5854
  this.lastKnownCode = next;
5819
5855
  const newLineCount = model.getLineCount();
5820
5856
  this.cachedLineCount = newLineCount;
5821
- if (newLineCount !== prevLineCount) this.maybeScrollToBottom(newLineCount);
5857
+ if (newLineCount !== prevLineCount) {
5858
+ this.syncNonOverflowingLayout();
5859
+ this.maybeScrollToBottom(newLineCount);
5860
+ }
5822
5861
  return;
5823
5862
  }
5824
5863
  const res = computeMinimalEdit(prev, next);
@@ -5873,8 +5912,7 @@ var EditorManager = class {
5873
5912
  this.cachedComputedHeight = null;
5874
5913
  const shouldImmediate = this.shouldPerformImmediateReveal();
5875
5914
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5876
- const computed$2 = this.computedHeight(this.editorView);
5877
- if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5915
+ this.syncNonOverflowingLayout();
5878
5916
  if (shouldImmediate) try {
5879
5917
  this.forceReveal(newLineCount);
5880
5918
  } catch {}
@@ -5893,8 +5931,8 @@ var EditorManager = class {
5893
5931
  return this.editorView;
5894
5932
  }
5895
5933
  getCode() {
5896
- var _this$editorView9;
5897
- return ((_this$editorView9 = this.editorView) === null || _this$editorView9 === void 0 || (_this$editorView9 = _this$editorView9.getModel()) === null || _this$editorView9 === void 0 ? void 0 : _this$editorView9.getValue()) ?? null;
5934
+ var _this$editorView12;
5935
+ return ((_this$editorView12 = this.editorView) === null || _this$editorView12 === void 0 || (_this$editorView12 = _this$editorView12.getModel()) === null || _this$editorView12 === void 0 ? void 0 : _this$editorView12.getValue()) ?? null;
5898
5936
  }
5899
5937
  setUpdateThrottleMs(ms) {
5900
5938
  this.updateThrottleMs = ms;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-monaco",
3
3
  "type": "module",
4
- "version": "0.0.37",
4
+ "version": "0.0.38",
5
5
  "packageManager": "pnpm@10.33.2",
6
6
  "description": "A framework-agnostic Monaco Editor integration with Shiki syntax highlighting, built for real-time streaming updates and efficient diff editing.",
7
7
  "author": "Simon He",