stream-monaco 0.0.37 → 0.0.39
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/index.legacy.cjs +1 -1
- package/dist/index.legacy.js +1 -1
- package/dist/{preloadMonacoWorkers.shared-C0_StL1Z.cjs → preloadMonacoWorkers.shared-DePkenFk.cjs} +67 -19
- package/dist/{preloadMonacoWorkers.shared-BRnjKKQj.js → preloadMonacoWorkers.shared-lMUizP7R.js} +67 -19
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-
|
|
1
|
+
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-DePkenFk.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-
|
|
1
|
+
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, editorWorkerPath, getOrCreateHighlighter, registerMonacoThemes, uniqueWorkerPaths, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-lMUizP7R.js";
|
|
2
2
|
|
|
3
3
|
//#region src/ensureMonacoWorkers.ts
|
|
4
4
|
function ensureMonacoWorkers() {
|
package/dist/index.legacy.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-
|
|
1
|
+
const require_preloadMonacoWorkers_shared = require('./preloadMonacoWorkers.shared-DePkenFk.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"));
|
package/dist/index.legacy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, monaco_shim_exports, processedLanguage, registerMonacoThemes, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-
|
|
1
|
+
import { RevealStrategy, clearHighlighterCache, defaultRevealDebounceMs, detectLanguage, getOrCreateHighlighter, monaco_shim_exports, processedLanguage, registerMonacoThemes, useMonaco, workerPathByLabel } from "./preloadMonacoWorkers.shared-lMUizP7R.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";
|
package/dist/{preloadMonacoWorkers.shared-C0_StL1Z.cjs → preloadMonacoWorkers.shared-DePkenFk.cjs}
RENAMED
|
@@ -154,6 +154,16 @@ __export(monaco_shim_exports, {
|
|
|
154
154
|
__reExport(monaco_shim_exports, require("monaco-editor/esm/vs/editor/editor.api"));
|
|
155
155
|
var _editor;
|
|
156
156
|
const monaco = monaco_editor_esm_vs_editor_editor_api;
|
|
157
|
+
const monacoAny = monaco;
|
|
158
|
+
for (const name of [
|
|
159
|
+
"css",
|
|
160
|
+
"html",
|
|
161
|
+
"json",
|
|
162
|
+
"typescript"
|
|
163
|
+
]) {
|
|
164
|
+
var _monacoAny$languages;
|
|
165
|
+
(_monacoAny$languages = monacoAny.languages)[name] ?? (_monacoAny$languages[name] = monacoAny[name]);
|
|
166
|
+
}
|
|
157
167
|
const ScrollType = Reflect.get(monaco_editor_esm_vs_editor_editor_api, "ScrollType") ?? ((_editor = monaco_editor_esm_vs_editor_editor_api.editor) === null || _editor === void 0 ? void 0 : _editor.ScrollType);
|
|
158
168
|
|
|
159
169
|
//#endregion
|
|
@@ -267,6 +277,7 @@ function createHeightManager(container, computeNext) {
|
|
|
267
277
|
const HYSTERESIS_PX = 12;
|
|
268
278
|
const DEBOUNCE_MS = 0;
|
|
269
279
|
function apply() {
|
|
280
|
+
var _container$getBoundin;
|
|
270
281
|
const next = computeNext();
|
|
271
282
|
if (next == null) return;
|
|
272
283
|
log("heightManager", "computeNext ->", {
|
|
@@ -277,6 +288,11 @@ function createHeightManager(container, computeNext) {
|
|
|
277
288
|
log("heightManager", "invalid next height, ignoring", next);
|
|
278
289
|
return;
|
|
279
290
|
}
|
|
291
|
+
const currentHeight = Number.parseFloat(container.style.height || "") || ((_container$getBoundin = container.getBoundingClientRect) === null || _container$getBoundin === void 0 ? void 0 : _container$getBoundin.call(container).height) || 0;
|
|
292
|
+
if (currentHeight > 0 && Math.abs(next - currentHeight) <= HYSTERESIS_PX) {
|
|
293
|
+
lastApplied = next;
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
280
296
|
if (lastApplied !== -1 && Math.abs(next - lastApplied) <= HYSTERESIS_PX) return;
|
|
281
297
|
if (next === lastApplied) return;
|
|
282
298
|
suppressed = true;
|
|
@@ -5406,7 +5422,17 @@ var EditorManager = class {
|
|
|
5406
5422
|
return distance <= threshold;
|
|
5407
5423
|
}
|
|
5408
5424
|
computedHeight(editorView) {
|
|
5409
|
-
var _editorView$getModel;
|
|
5425
|
+
var _editorView$getConten, _editorView$getModel;
|
|
5426
|
+
const contentHeight = (_editorView$getConten = editorView.getContentHeight) === null || _editorView$getConten === void 0 ? void 0 : _editorView$getConten.call(editorView);
|
|
5427
|
+
if (typeof contentHeight === "number" && Number.isFinite(contentHeight) && contentHeight > 0) {
|
|
5428
|
+
const height$1 = Math.min(contentHeight, this.maxHeightValue);
|
|
5429
|
+
log("EditorManager.computedHeight", {
|
|
5430
|
+
contentHeight,
|
|
5431
|
+
computed: height$1,
|
|
5432
|
+
maxHeightValue: this.maxHeightValue
|
|
5433
|
+
});
|
|
5434
|
+
return height$1;
|
|
5435
|
+
}
|
|
5410
5436
|
const lineCount = this.cachedLineCount ?? ((_editorView$getModel = editorView.getModel()) === null || _editorView$getModel === void 0 ? void 0 : _editorView$getModel.getLineCount()) ?? 1;
|
|
5411
5437
|
const lineHeight = editorView.getOption(monaco_shim_exports.editor.EditorOption.lineHeight);
|
|
5412
5438
|
const height = Math.min(lineCount * lineHeight + padding, this.maxHeightValue);
|
|
@@ -5530,8 +5556,31 @@ var EditorManager = class {
|
|
|
5530
5556
|
shouldPerformImmediateReveal() {
|
|
5531
5557
|
return this.autoScrollOnUpdate && this.shouldAutoScroll && this.hasVerticalScrollbar() && this.isOverflowAuto();
|
|
5532
5558
|
}
|
|
5559
|
+
syncNonOverflowingLayout() {
|
|
5560
|
+
var _this$lastContainer$g, _this$lastContainer;
|
|
5561
|
+
if (!this.editorView || !this.lastContainer) return null;
|
|
5562
|
+
const computed$1 = this.computedHeight(this.editorView);
|
|
5563
|
+
if (computed$1 >= this.maxHeightValue - 1) {
|
|
5564
|
+
this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
5565
|
+
return computed$1;
|
|
5566
|
+
}
|
|
5567
|
+
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;
|
|
5568
|
+
if (currentHeight <= 0 || Math.abs(computed$1 - currentHeight) > 12) this.lastContainer.style.height = `${computed$1}px`;
|
|
5569
|
+
this.lastContainer.style.overflow = "hidden";
|
|
5570
|
+
this._hasScrollBar = false;
|
|
5571
|
+
try {
|
|
5572
|
+
var _this$editorView$layo, _this$editorView5;
|
|
5573
|
+
(_this$editorView$layo = (_this$editorView5 = this.editorView).layout) === null || _this$editorView$layo === void 0 || _this$editorView$layo.call(_this$editorView5);
|
|
5574
|
+
} catch {}
|
|
5575
|
+
try {
|
|
5576
|
+
var _this$editorView$getS3, _this$editorView6, _this$editorView$setS, _this$editorView7;
|
|
5577
|
+
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);
|
|
5578
|
+
this.lastScrollTop = 0;
|
|
5579
|
+
} catch {}
|
|
5580
|
+
return computed$1;
|
|
5581
|
+
}
|
|
5533
5582
|
async createEditor(container, code, language, currentTheme) {
|
|
5534
|
-
var _this$editorView$
|
|
5583
|
+
var _this$editorView$getS4, _this$editorView8, _this$editorView$getO, _this$editorView9, _this$editorView$getM, _this$editorView$onDi, _this$editorView10;
|
|
5535
5584
|
this.cleanup();
|
|
5536
5585
|
this.lastContainer = container;
|
|
5537
5586
|
this.initDebugFlag();
|
|
@@ -5567,12 +5616,9 @@ var EditorManager = class {
|
|
|
5567
5616
|
}
|
|
5568
5617
|
if (this.revealIdleTimerId != null) clearTimeout(this.revealIdleTimerId);
|
|
5569
5618
|
this.revealIdleTimerId = null;
|
|
5570
|
-
const MIN_VISIBLE_HEIGHT = Math.min(120, this.maxHeightValue);
|
|
5571
|
-
container.style.minHeight = `${MIN_VISIBLE_HEIGHT}px`;
|
|
5572
5619
|
this.editorHeightManager = createHeightManager(container, () => {
|
|
5573
5620
|
const computed$1 = this.computedHeight(this.editorView);
|
|
5574
|
-
|
|
5575
|
-
return Math.max(clamped, MIN_VISIBLE_HEIGHT);
|
|
5621
|
+
return Math.min(computed$1, this.maxHeightValue);
|
|
5576
5622
|
});
|
|
5577
5623
|
this.editorHeightManager.update();
|
|
5578
5624
|
const initialComputed = this.computedHeight(this.editorView);
|
|
@@ -5581,17 +5627,17 @@ var EditorManager = class {
|
|
|
5581
5627
|
container.style.overflow = "auto";
|
|
5582
5628
|
this.dlog("applied immediate maxHeight on createEditor", this.maxHeightValue);
|
|
5583
5629
|
}
|
|
5584
|
-
this.cachedScrollHeight = ((_this$editorView$
|
|
5585
|
-
this.cachedLineHeight = ((_this$editorView$getO = (_this$
|
|
5630
|
+
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;
|
|
5631
|
+
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
5632
|
this.cachedComputedHeight = this.computedHeight(this.editorView);
|
|
5587
5633
|
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$
|
|
5634
|
+
(_this$editorView$onDi = (_this$editorView10 = this.editorView).onDidContentSizeChange) === null || _this$editorView$onDi === void 0 || _this$editorView$onDi.call(_this$editorView10, () => {
|
|
5589
5635
|
this._hasScrollBar = false;
|
|
5590
5636
|
this.rafScheduler.schedule("content-size-change", () => {
|
|
5591
5637
|
try {
|
|
5592
|
-
var _this$
|
|
5638
|
+
var _this$editorView11, _this$editorHeightMan, _this$editorHeightMan2;
|
|
5593
5639
|
this.dlog("content-size-change frame");
|
|
5594
|
-
this.cachedLineCount = ((_this$
|
|
5640
|
+
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
5641
|
this.cachedComputedHeight = null;
|
|
5596
5642
|
const m = this.measureViewport();
|
|
5597
5643
|
this.dlog("content-size-change measure", m);
|
|
@@ -5753,9 +5799,8 @@ var EditorManager = class {
|
|
|
5753
5799
|
if (newLineCount$1 !== prevLineCount$1) {
|
|
5754
5800
|
const shouldImmediate = this.shouldPerformImmediateReveal();
|
|
5755
5801
|
if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
|
|
5756
|
-
const computed$1 = this.
|
|
5757
|
-
if (computed$1 >= this.maxHeightValue - 1
|
|
5758
|
-
this.forceReveal(newLineCount$1);
|
|
5802
|
+
const computed$1 = this.syncNonOverflowingLayout();
|
|
5803
|
+
if (computed$1 != null && computed$1 >= this.maxHeightValue - 1) this.forceReveal(newLineCount$1);
|
|
5759
5804
|
}
|
|
5760
5805
|
return;
|
|
5761
5806
|
}
|
|
@@ -5789,6 +5834,7 @@ var EditorManager = class {
|
|
|
5789
5834
|
if (newLineCount !== prevLineCount) {
|
|
5790
5835
|
const shouldImmediate = this.shouldPerformImmediateReveal();
|
|
5791
5836
|
if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
|
|
5837
|
+
this.syncNonOverflowingLayout();
|
|
5792
5838
|
if (shouldImmediate) this.scheduleImmediateRevealAfterLayout(newLineCount);
|
|
5793
5839
|
else this.maybeScrollToBottom(newLineCount);
|
|
5794
5840
|
}
|
|
@@ -5823,7 +5869,10 @@ var EditorManager = class {
|
|
|
5823
5869
|
this.lastKnownCode = next;
|
|
5824
5870
|
const newLineCount = model.getLineCount();
|
|
5825
5871
|
this.cachedLineCount = newLineCount;
|
|
5826
|
-
if (newLineCount !== prevLineCount)
|
|
5872
|
+
if (newLineCount !== prevLineCount) {
|
|
5873
|
+
this.syncNonOverflowingLayout();
|
|
5874
|
+
this.maybeScrollToBottom(newLineCount);
|
|
5875
|
+
}
|
|
5827
5876
|
return;
|
|
5828
5877
|
}
|
|
5829
5878
|
const res = computeMinimalEdit(prev, next);
|
|
@@ -5878,8 +5927,7 @@ var EditorManager = class {
|
|
|
5878
5927
|
this.cachedComputedHeight = null;
|
|
5879
5928
|
const shouldImmediate = this.shouldPerformImmediateReveal();
|
|
5880
5929
|
if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
|
|
5881
|
-
|
|
5882
|
-
if (computed$1 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
5930
|
+
this.syncNonOverflowingLayout();
|
|
5883
5931
|
if (shouldImmediate) try {
|
|
5884
5932
|
this.forceReveal(newLineCount);
|
|
5885
5933
|
} catch {}
|
|
@@ -5898,8 +5946,8 @@ var EditorManager = class {
|
|
|
5898
5946
|
return this.editorView;
|
|
5899
5947
|
}
|
|
5900
5948
|
getCode() {
|
|
5901
|
-
var _this$
|
|
5902
|
-
return ((_this$
|
|
5949
|
+
var _this$editorView12;
|
|
5950
|
+
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
5951
|
}
|
|
5904
5952
|
setUpdateThrottleMs(ms) {
|
|
5905
5953
|
this.updateThrottleMs = ms;
|
package/dist/{preloadMonacoWorkers.shared-BRnjKKQj.js → preloadMonacoWorkers.shared-lMUizP7R.js}
RENAMED
|
@@ -149,6 +149,16 @@ import * as import_monaco_editor_esm_vs_editor_editor_api from "monaco-editor/es
|
|
|
149
149
|
__reExport(monaco_shim_exports, import_monaco_editor_esm_vs_editor_editor_api);
|
|
150
150
|
var _editor;
|
|
151
151
|
const monaco = _monaco;
|
|
152
|
+
const monacoAny = monaco;
|
|
153
|
+
for (const name of [
|
|
154
|
+
"css",
|
|
155
|
+
"html",
|
|
156
|
+
"json",
|
|
157
|
+
"typescript"
|
|
158
|
+
]) {
|
|
159
|
+
var _monacoAny$languages;
|
|
160
|
+
(_monacoAny$languages = monacoAny.languages)[name] ?? (_monacoAny$languages[name] = monacoAny[name]);
|
|
161
|
+
}
|
|
152
162
|
const ScrollType = Reflect.get(_monaco, "ScrollType") ?? ((_editor = _monaco.editor) === null || _editor === void 0 ? void 0 : _editor.ScrollType);
|
|
153
163
|
|
|
154
164
|
//#endregion
|
|
@@ -262,6 +272,7 @@ function createHeightManager(container, computeNext) {
|
|
|
262
272
|
const HYSTERESIS_PX = 12;
|
|
263
273
|
const DEBOUNCE_MS = 0;
|
|
264
274
|
function apply() {
|
|
275
|
+
var _container$getBoundin;
|
|
265
276
|
const next = computeNext();
|
|
266
277
|
if (next == null) return;
|
|
267
278
|
log("heightManager", "computeNext ->", {
|
|
@@ -272,6 +283,11 @@ function createHeightManager(container, computeNext) {
|
|
|
272
283
|
log("heightManager", "invalid next height, ignoring", next);
|
|
273
284
|
return;
|
|
274
285
|
}
|
|
286
|
+
const currentHeight = Number.parseFloat(container.style.height || "") || ((_container$getBoundin = container.getBoundingClientRect) === null || _container$getBoundin === void 0 ? void 0 : _container$getBoundin.call(container).height) || 0;
|
|
287
|
+
if (currentHeight > 0 && Math.abs(next - currentHeight) <= HYSTERESIS_PX) {
|
|
288
|
+
lastApplied = next;
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
275
291
|
if (lastApplied !== -1 && Math.abs(next - lastApplied) <= HYSTERESIS_PX) return;
|
|
276
292
|
if (next === lastApplied) return;
|
|
277
293
|
suppressed = true;
|
|
@@ -5401,7 +5417,17 @@ var EditorManager = class {
|
|
|
5401
5417
|
return distance <= threshold;
|
|
5402
5418
|
}
|
|
5403
5419
|
computedHeight(editorView) {
|
|
5404
|
-
var _editorView$getModel;
|
|
5420
|
+
var _editorView$getConten, _editorView$getModel;
|
|
5421
|
+
const contentHeight = (_editorView$getConten = editorView.getContentHeight) === null || _editorView$getConten === void 0 ? void 0 : _editorView$getConten.call(editorView);
|
|
5422
|
+
if (typeof contentHeight === "number" && Number.isFinite(contentHeight) && contentHeight > 0) {
|
|
5423
|
+
const height$1 = Math.min(contentHeight, this.maxHeightValue);
|
|
5424
|
+
log("EditorManager.computedHeight", {
|
|
5425
|
+
contentHeight,
|
|
5426
|
+
computed: height$1,
|
|
5427
|
+
maxHeightValue: this.maxHeightValue
|
|
5428
|
+
});
|
|
5429
|
+
return height$1;
|
|
5430
|
+
}
|
|
5405
5431
|
const lineCount = this.cachedLineCount ?? ((_editorView$getModel = editorView.getModel()) === null || _editorView$getModel === void 0 ? void 0 : _editorView$getModel.getLineCount()) ?? 1;
|
|
5406
5432
|
const lineHeight = editorView.getOption(monaco_shim_exports.editor.EditorOption.lineHeight);
|
|
5407
5433
|
const height = Math.min(lineCount * lineHeight + padding, this.maxHeightValue);
|
|
@@ -5525,8 +5551,31 @@ var EditorManager = class {
|
|
|
5525
5551
|
shouldPerformImmediateReveal() {
|
|
5526
5552
|
return this.autoScrollOnUpdate && this.shouldAutoScroll && this.hasVerticalScrollbar() && this.isOverflowAuto();
|
|
5527
5553
|
}
|
|
5554
|
+
syncNonOverflowingLayout() {
|
|
5555
|
+
var _this$lastContainer$g, _this$lastContainer;
|
|
5556
|
+
if (!this.editorView || !this.lastContainer) return null;
|
|
5557
|
+
const computed$2 = this.computedHeight(this.editorView);
|
|
5558
|
+
if (computed$2 >= this.maxHeightValue - 1) {
|
|
5559
|
+
this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
5560
|
+
return computed$2;
|
|
5561
|
+
}
|
|
5562
|
+
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;
|
|
5563
|
+
if (currentHeight <= 0 || Math.abs(computed$2 - currentHeight) > 12) this.lastContainer.style.height = `${computed$2}px`;
|
|
5564
|
+
this.lastContainer.style.overflow = "hidden";
|
|
5565
|
+
this._hasScrollBar = false;
|
|
5566
|
+
try {
|
|
5567
|
+
var _this$editorView$layo, _this$editorView5;
|
|
5568
|
+
(_this$editorView$layo = (_this$editorView5 = this.editorView).layout) === null || _this$editorView$layo === void 0 || _this$editorView$layo.call(_this$editorView5);
|
|
5569
|
+
} catch {}
|
|
5570
|
+
try {
|
|
5571
|
+
var _this$editorView$getS3, _this$editorView6, _this$editorView$setS, _this$editorView7;
|
|
5572
|
+
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);
|
|
5573
|
+
this.lastScrollTop = 0;
|
|
5574
|
+
} catch {}
|
|
5575
|
+
return computed$2;
|
|
5576
|
+
}
|
|
5528
5577
|
async createEditor(container, code, language, currentTheme) {
|
|
5529
|
-
var _this$editorView$
|
|
5578
|
+
var _this$editorView$getS4, _this$editorView8, _this$editorView$getO, _this$editorView9, _this$editorView$getM, _this$editorView$onDi, _this$editorView10;
|
|
5530
5579
|
this.cleanup();
|
|
5531
5580
|
this.lastContainer = container;
|
|
5532
5581
|
this.initDebugFlag();
|
|
@@ -5562,12 +5611,9 @@ var EditorManager = class {
|
|
|
5562
5611
|
}
|
|
5563
5612
|
if (this.revealIdleTimerId != null) clearTimeout(this.revealIdleTimerId);
|
|
5564
5613
|
this.revealIdleTimerId = null;
|
|
5565
|
-
const MIN_VISIBLE_HEIGHT = Math.min(120, this.maxHeightValue);
|
|
5566
|
-
container.style.minHeight = `${MIN_VISIBLE_HEIGHT}px`;
|
|
5567
5614
|
this.editorHeightManager = createHeightManager(container, () => {
|
|
5568
5615
|
const computed$2 = this.computedHeight(this.editorView);
|
|
5569
|
-
|
|
5570
|
-
return Math.max(clamped, MIN_VISIBLE_HEIGHT);
|
|
5616
|
+
return Math.min(computed$2, this.maxHeightValue);
|
|
5571
5617
|
});
|
|
5572
5618
|
this.editorHeightManager.update();
|
|
5573
5619
|
const initialComputed = this.computedHeight(this.editorView);
|
|
@@ -5576,17 +5622,17 @@ var EditorManager = class {
|
|
|
5576
5622
|
container.style.overflow = "auto";
|
|
5577
5623
|
this.dlog("applied immediate maxHeight on createEditor", this.maxHeightValue);
|
|
5578
5624
|
}
|
|
5579
|
-
this.cachedScrollHeight = ((_this$editorView$
|
|
5580
|
-
this.cachedLineHeight = ((_this$editorView$getO = (_this$
|
|
5625
|
+
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;
|
|
5626
|
+
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
5627
|
this.cachedComputedHeight = this.computedHeight(this.editorView);
|
|
5582
5628
|
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$
|
|
5629
|
+
(_this$editorView$onDi = (_this$editorView10 = this.editorView).onDidContentSizeChange) === null || _this$editorView$onDi === void 0 || _this$editorView$onDi.call(_this$editorView10, () => {
|
|
5584
5630
|
this._hasScrollBar = false;
|
|
5585
5631
|
this.rafScheduler.schedule("content-size-change", () => {
|
|
5586
5632
|
try {
|
|
5587
|
-
var _this$
|
|
5633
|
+
var _this$editorView11, _this$editorHeightMan, _this$editorHeightMan2;
|
|
5588
5634
|
this.dlog("content-size-change frame");
|
|
5589
|
-
this.cachedLineCount = ((_this$
|
|
5635
|
+
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
5636
|
this.cachedComputedHeight = null;
|
|
5591
5637
|
const m = this.measureViewport();
|
|
5592
5638
|
this.dlog("content-size-change measure", m);
|
|
@@ -5748,9 +5794,8 @@ var EditorManager = class {
|
|
|
5748
5794
|
if (newLineCount$1 !== prevLineCount$1) {
|
|
5749
5795
|
const shouldImmediate = this.shouldPerformImmediateReveal();
|
|
5750
5796
|
if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
|
|
5751
|
-
const computed$2 = this.
|
|
5752
|
-
if (computed$2 >= this.maxHeightValue - 1
|
|
5753
|
-
this.forceReveal(newLineCount$1);
|
|
5797
|
+
const computed$2 = this.syncNonOverflowingLayout();
|
|
5798
|
+
if (computed$2 != null && computed$2 >= this.maxHeightValue - 1) this.forceReveal(newLineCount$1);
|
|
5754
5799
|
}
|
|
5755
5800
|
return;
|
|
5756
5801
|
}
|
|
@@ -5784,6 +5829,7 @@ var EditorManager = class {
|
|
|
5784
5829
|
if (newLineCount !== prevLineCount) {
|
|
5785
5830
|
const shouldImmediate = this.shouldPerformImmediateReveal();
|
|
5786
5831
|
if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
|
|
5832
|
+
this.syncNonOverflowingLayout();
|
|
5787
5833
|
if (shouldImmediate) this.scheduleImmediateRevealAfterLayout(newLineCount);
|
|
5788
5834
|
else this.maybeScrollToBottom(newLineCount);
|
|
5789
5835
|
}
|
|
@@ -5818,7 +5864,10 @@ var EditorManager = class {
|
|
|
5818
5864
|
this.lastKnownCode = next;
|
|
5819
5865
|
const newLineCount = model.getLineCount();
|
|
5820
5866
|
this.cachedLineCount = newLineCount;
|
|
5821
|
-
if (newLineCount !== prevLineCount)
|
|
5867
|
+
if (newLineCount !== prevLineCount) {
|
|
5868
|
+
this.syncNonOverflowingLayout();
|
|
5869
|
+
this.maybeScrollToBottom(newLineCount);
|
|
5870
|
+
}
|
|
5822
5871
|
return;
|
|
5823
5872
|
}
|
|
5824
5873
|
const res = computeMinimalEdit(prev, next);
|
|
@@ -5873,8 +5922,7 @@ var EditorManager = class {
|
|
|
5873
5922
|
this.cachedComputedHeight = null;
|
|
5874
5923
|
const shouldImmediate = this.shouldPerformImmediateReveal();
|
|
5875
5924
|
if (shouldImmediate) this.suppressScrollWatcher(this.scrollWatcherSuppressionMs);
|
|
5876
|
-
|
|
5877
|
-
if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
|
|
5925
|
+
this.syncNonOverflowingLayout();
|
|
5878
5926
|
if (shouldImmediate) try {
|
|
5879
5927
|
this.forceReveal(newLineCount);
|
|
5880
5928
|
} catch {}
|
|
@@ -5893,8 +5941,8 @@ var EditorManager = class {
|
|
|
5893
5941
|
return this.editorView;
|
|
5894
5942
|
}
|
|
5895
5943
|
getCode() {
|
|
5896
|
-
var _this$
|
|
5897
|
-
return ((_this$
|
|
5944
|
+
var _this$editorView12;
|
|
5945
|
+
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
5946
|
}
|
|
5899
5947
|
setUpdateThrottleMs(ms) {
|
|
5900
5948
|
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.
|
|
4
|
+
"version": "0.0.39",
|
|
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",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"typecheck": "tsc --noEmit"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
|
-
"monaco-editor": "
|
|
105
|
+
"monaco-editor": ">=0.52.2 <0.56.0"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
108
|
"@shikijs/monaco": "^3.23.0",
|