stream-monaco 0.0.36 → 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-kHKw8Ju_.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-B0KjUDJf.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-kHKw8Ju_.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-B0KjUDJf.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,19 +5617,20 @@ 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");
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;
5631
+ this.cachedComputedHeight = null;
5594
5632
  const m = this.measureViewport();
5595
5633
  this.dlog("content-size-change measure", m);
5596
- 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;
5597
5634
  if ((_this$editorHeightMan = this.editorHeightManager) === null || _this$editorHeightMan === void 0 ? void 0 : _this$editorHeightMan.isSuppressed()) {
5598
5635
  this.dlog("content-size-change skipped height update (suppressed)");
5599
5636
  return;
@@ -5647,6 +5684,7 @@ var EditorManager = class {
5647
5684
  if (model) {
5648
5685
  this.lastKnownCode = model.getValue();
5649
5686
  this.cachedLineCount = model.getLineCount() ?? this.cachedLineCount;
5687
+ this.cachedComputedHeight = null;
5650
5688
  }
5651
5689
  this.lastKnownCodeDirty = false;
5652
5690
  }
@@ -5747,12 +5785,12 @@ var EditorManager = class {
5747
5785
  this.lastKnownCode = newCode;
5748
5786
  const newLineCount$1 = model.getLineCount();
5749
5787
  this.cachedLineCount = newLineCount$1;
5788
+ this.cachedComputedHeight = null;
5750
5789
  if (newLineCount$1 !== prevLineCount$1) {
5751
5790
  const shouldImmediate = this.shouldPerformImmediateReveal();
5752
5791
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5753
- const computed$1 = this.computedHeight(this.editorView);
5754
- if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5755
- this.forceReveal(newLineCount$1);
5792
+ const computed$1 = this.syncNonOverflowingLayout();
5793
+ if (computed$1 != null && computed$1 >= this.maxHeightValue - 1) this.forceReveal(newLineCount$1);
5756
5794
  }
5757
5795
  return;
5758
5796
  }
@@ -5782,9 +5820,11 @@ var EditorManager = class {
5782
5820
  this.lastKnownCode = newCode;
5783
5821
  const newLineCount = model.getLineCount();
5784
5822
  this.cachedLineCount = newLineCount;
5823
+ this.cachedComputedHeight = null;
5785
5824
  if (newLineCount !== prevLineCount) {
5786
5825
  const shouldImmediate = this.shouldPerformImmediateReveal();
5787
5826
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5827
+ this.syncNonOverflowingLayout();
5788
5828
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayout(newLineCount);
5789
5829
  else this.maybeScrollToBottom(newLineCount);
5790
5830
  }
@@ -5819,7 +5859,10 @@ var EditorManager = class {
5819
5859
  this.lastKnownCode = next;
5820
5860
  const newLineCount = model.getLineCount();
5821
5861
  this.cachedLineCount = newLineCount;
5822
- if (newLineCount !== prevLineCount) this.maybeScrollToBottom(newLineCount);
5862
+ if (newLineCount !== prevLineCount) {
5863
+ this.syncNonOverflowingLayout();
5864
+ this.maybeScrollToBottom(newLineCount);
5865
+ }
5823
5866
  return;
5824
5867
  }
5825
5868
  const res = computeMinimalEdit(prev, next);
@@ -5871,10 +5914,10 @@ var EditorManager = class {
5871
5914
  const newLineCount = model.getLineCount();
5872
5915
  if (lastLine !== newLineCount) {
5873
5916
  this.cachedLineCount = newLineCount;
5917
+ this.cachedComputedHeight = null;
5874
5918
  const shouldImmediate = this.shouldPerformImmediateReveal();
5875
5919
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5876
- const computed$1 = this.computedHeight(this.editorView);
5877
- if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5920
+ this.syncNonOverflowingLayout();
5878
5921
  if (shouldImmediate) try {
5879
5922
  this.forceReveal(newLineCount);
5880
5923
  } catch {}
@@ -5893,8 +5936,8 @@ var EditorManager = class {
5893
5936
  return this.editorView;
5894
5937
  }
5895
5938
  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;
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;
5898
5941
  }
5899
5942
  setUpdateThrottleMs(ms) {
5900
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,19 +5612,20 @@ 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");
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;
5626
+ this.cachedComputedHeight = null;
5589
5627
  const m = this.measureViewport();
5590
5628
  this.dlog("content-size-change measure", m);
5591
- 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;
5592
5629
  if ((_this$editorHeightMan = this.editorHeightManager) === null || _this$editorHeightMan === void 0 ? void 0 : _this$editorHeightMan.isSuppressed()) {
5593
5630
  this.dlog("content-size-change skipped height update (suppressed)");
5594
5631
  return;
@@ -5642,6 +5679,7 @@ var EditorManager = class {
5642
5679
  if (model) {
5643
5680
  this.lastKnownCode = model.getValue();
5644
5681
  this.cachedLineCount = model.getLineCount() ?? this.cachedLineCount;
5682
+ this.cachedComputedHeight = null;
5645
5683
  }
5646
5684
  this.lastKnownCodeDirty = false;
5647
5685
  }
@@ -5742,12 +5780,12 @@ var EditorManager = class {
5742
5780
  this.lastKnownCode = newCode;
5743
5781
  const newLineCount$1 = model.getLineCount();
5744
5782
  this.cachedLineCount = newLineCount$1;
5783
+ this.cachedComputedHeight = null;
5745
5784
  if (newLineCount$1 !== prevLineCount$1) {
5746
5785
  const shouldImmediate = this.shouldPerformImmediateReveal();
5747
5786
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5748
- const computed$2 = this.computedHeight(this.editorView);
5749
- if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5750
- this.forceReveal(newLineCount$1);
5787
+ const computed$2 = this.syncNonOverflowingLayout();
5788
+ if (computed$2 != null && computed$2 >= this.maxHeightValue - 1) this.forceReveal(newLineCount$1);
5751
5789
  }
5752
5790
  return;
5753
5791
  }
@@ -5777,9 +5815,11 @@ var EditorManager = class {
5777
5815
  this.lastKnownCode = newCode;
5778
5816
  const newLineCount = model.getLineCount();
5779
5817
  this.cachedLineCount = newLineCount;
5818
+ this.cachedComputedHeight = null;
5780
5819
  if (newLineCount !== prevLineCount) {
5781
5820
  const shouldImmediate = this.shouldPerformImmediateReveal();
5782
5821
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5822
+ this.syncNonOverflowingLayout();
5783
5823
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayout(newLineCount);
5784
5824
  else this.maybeScrollToBottom(newLineCount);
5785
5825
  }
@@ -5814,7 +5854,10 @@ var EditorManager = class {
5814
5854
  this.lastKnownCode = next;
5815
5855
  const newLineCount = model.getLineCount();
5816
5856
  this.cachedLineCount = newLineCount;
5817
- if (newLineCount !== prevLineCount) this.maybeScrollToBottom(newLineCount);
5857
+ if (newLineCount !== prevLineCount) {
5858
+ this.syncNonOverflowingLayout();
5859
+ this.maybeScrollToBottom(newLineCount);
5860
+ }
5818
5861
  return;
5819
5862
  }
5820
5863
  const res = computeMinimalEdit(prev, next);
@@ -5866,10 +5909,10 @@ var EditorManager = class {
5866
5909
  const newLineCount = model.getLineCount();
5867
5910
  if (lastLine !== newLineCount) {
5868
5911
  this.cachedLineCount = newLineCount;
5912
+ this.cachedComputedHeight = null;
5869
5913
  const shouldImmediate = this.shouldPerformImmediateReveal();
5870
5914
  if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
5871
- const computed$2 = this.computedHeight(this.editorView);
5872
- if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
5915
+ this.syncNonOverflowingLayout();
5873
5916
  if (shouldImmediate) try {
5874
5917
  this.forceReveal(newLineCount);
5875
5918
  } catch {}
@@ -5888,8 +5931,8 @@ var EditorManager = class {
5888
5931
  return this.editorView;
5889
5932
  }
5890
5933
  getCode() {
5891
- var _this$editorView9;
5892
- 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;
5893
5936
  }
5894
5937
  setUpdateThrottleMs(ms) {
5895
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.36",
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",