stream-monaco 0.0.44 → 0.0.45
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-vZJruB3t.js → preloadMonacoWorkers.shared-B5jjaMkr.js} +24 -2
- package/dist/{preloadMonacoWorkers.shared-DpwiD-Ro.cjs → preloadMonacoWorkers.shared-BNjiPbqr.cjs} +24 -2
- package/package.json +1 -1
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-BNjiPbqr.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-B5jjaMkr.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-BNjiPbqr.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-B5jjaMkr.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-vZJruB3t.js → preloadMonacoWorkers.shared-B5jjaMkr.js}
RENAMED
|
@@ -1756,6 +1756,23 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1756
1756
|
if (typeof direct === "function") return direct.call(model, lineNumber);
|
|
1757
1757
|
return model.getValue().split(/\r?\n/)[lineNumber - 1] ?? "";
|
|
1758
1758
|
}
|
|
1759
|
+
colorizeFallbackInlineDeletedLine(lineNode, model, lineText, tabSize) {
|
|
1760
|
+
var _model$getLanguageId;
|
|
1761
|
+
const language = (_model$getLanguageId = model.getLanguageId) === null || _model$getLanguageId === void 0 ? void 0 : _model$getLanguageId.call(model);
|
|
1762
|
+
const colorize = monaco_shim_exports.editor.colorize;
|
|
1763
|
+
if (!language || typeof colorize !== "function") return;
|
|
1764
|
+
const signature = `${language}:${lineText}`;
|
|
1765
|
+
lineNode.dataset.streamMonacoColorizeSignature = signature;
|
|
1766
|
+
colorize(lineText, language, { tabSize }).then((html) => {
|
|
1767
|
+
if (lineNode.dataset.streamMonacoColorizeSignature !== signature) return;
|
|
1768
|
+
lineNode.innerHTML = html;
|
|
1769
|
+
}).catch(() => {});
|
|
1770
|
+
}
|
|
1771
|
+
getModelTabSize(model) {
|
|
1772
|
+
var _model$getOptions;
|
|
1773
|
+
const tabSize = (_model$getOptions = model.getOptions) === null || _model$getOptions === void 0 ? void 0 : _model$getOptions.call(model).tabSize;
|
|
1774
|
+
return typeof tabSize === "number" && Number.isFinite(tabSize) ? tabSize : void 0;
|
|
1775
|
+
}
|
|
1759
1776
|
hasVisibleNativeInlineDeleteNodes() {
|
|
1760
1777
|
if (!this.lastContainer) return false;
|
|
1761
1778
|
const querySelectorAll = typeof this.lastContainer.querySelectorAll === "function" ? this.lastContainer.querySelectorAll.bind(this.lastContainer) : null;
|
|
@@ -1794,6 +1811,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1794
1811
|
}
|
|
1795
1812
|
const lineHeightOption = (_EditorOption = monaco_shim_exports.editor.EditorOption) === null || _EditorOption === void 0 ? void 0 : _EditorOption.lineHeight;
|
|
1796
1813
|
const lineHeight = ((_modifiedEditor$getOp = modifiedEditor.getOption) === null || _modifiedEditor$getOp === void 0 ? void 0 : _modifiedEditor$getOp.call(modifiedEditor, lineHeightOption)) ?? 20;
|
|
1814
|
+
const originalTabSize = this.getModelTabSize(originalModel);
|
|
1797
1815
|
const relevantChanges = lineChanges.filter((change) => hasOriginalLines(change));
|
|
1798
1816
|
const nativeViewWrappers = Array.from(((_this$lastContainer3 = this.lastContainer) === null || _this$lastContainer3 === void 0 || (_this$lastContainer3$ = _this$lastContainer3.querySelectorAll) === null || _this$lastContainer3$ === void 0 ? void 0 : _this$lastContainer3$.call(_this$lastContainer3, ".editor.modified .view-zones [monaco-view-zone]")) ?? []).filter((node) => {
|
|
1799
1817
|
return node instanceof HTMLElement && !!node.querySelector(".view-lines.line-delete");
|
|
@@ -1838,12 +1856,14 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1838
1856
|
domNode.setAttribute("data-stream-monaco-native-wrapper", "true");
|
|
1839
1857
|
(_modifiedEditor$apply = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply === void 0 || _modifiedEditor$apply.call(modifiedEditor, domNode);
|
|
1840
1858
|
for (let line = change.originalStartLineNumber; line <= change.originalEndLineNumber; line++) {
|
|
1859
|
+
const lineText = this.readModelLineContent(originalModel, line);
|
|
1841
1860
|
const lineNode = document.createElement("div");
|
|
1842
1861
|
lineNode.className = "stream-monaco-fallback-inline-delete-line";
|
|
1843
|
-
lineNode.textContent =
|
|
1862
|
+
lineNode.textContent = lineText;
|
|
1844
1863
|
lineNode.style.height = `${lineHeight}px`;
|
|
1845
1864
|
lineNode.style.lineHeight = `${lineHeight}px`;
|
|
1846
1865
|
domNode.append(lineNode);
|
|
1866
|
+
this.colorizeFallbackInlineDeletedLine(lineNode, originalModel, lineText, originalTabSize);
|
|
1847
1867
|
}
|
|
1848
1868
|
pair.viewWrapper.append(domNode);
|
|
1849
1869
|
if (pair.marginWrapper) {
|
|
@@ -1870,12 +1890,14 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1870
1890
|
domNode.setAttribute("aria-hidden", "true");
|
|
1871
1891
|
(_modifiedEditor$apply3 = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply3 === void 0 || _modifiedEditor$apply3.call(modifiedEditor, domNode);
|
|
1872
1892
|
for (let line = change.originalStartLineNumber; line <= change.originalEndLineNumber; line++) {
|
|
1893
|
+
const lineText = this.readModelLineContent(originalModel, line);
|
|
1873
1894
|
const lineNode = document.createElement("div");
|
|
1874
1895
|
lineNode.className = "stream-monaco-fallback-inline-delete-line";
|
|
1875
|
-
lineNode.textContent =
|
|
1896
|
+
lineNode.textContent = lineText;
|
|
1876
1897
|
lineNode.style.height = `${lineHeight}px`;
|
|
1877
1898
|
lineNode.style.lineHeight = `${lineHeight}px`;
|
|
1878
1899
|
domNode.append(lineNode);
|
|
1900
|
+
this.colorizeFallbackInlineDeletedLine(lineNode, originalModel, lineText, originalTabSize);
|
|
1879
1901
|
}
|
|
1880
1902
|
const marginDomNode = document.createElement("div");
|
|
1881
1903
|
marginDomNode.className = "stream-monaco-fallback-inline-delete-margin";
|
package/dist/{preloadMonacoWorkers.shared-DpwiD-Ro.cjs → preloadMonacoWorkers.shared-BNjiPbqr.cjs}
RENAMED
|
@@ -1761,6 +1761,23 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1761
1761
|
if (typeof direct === "function") return direct.call(model, lineNumber);
|
|
1762
1762
|
return model.getValue().split(/\r?\n/)[lineNumber - 1] ?? "";
|
|
1763
1763
|
}
|
|
1764
|
+
colorizeFallbackInlineDeletedLine(lineNode, model, lineText, tabSize) {
|
|
1765
|
+
var _model$getLanguageId;
|
|
1766
|
+
const language = (_model$getLanguageId = model.getLanguageId) === null || _model$getLanguageId === void 0 ? void 0 : _model$getLanguageId.call(model);
|
|
1767
|
+
const colorize = monaco_shim_exports.editor.colorize;
|
|
1768
|
+
if (!language || typeof colorize !== "function") return;
|
|
1769
|
+
const signature = `${language}:${lineText}`;
|
|
1770
|
+
lineNode.dataset.streamMonacoColorizeSignature = signature;
|
|
1771
|
+
colorize(lineText, language, { tabSize }).then((html) => {
|
|
1772
|
+
if (lineNode.dataset.streamMonacoColorizeSignature !== signature) return;
|
|
1773
|
+
lineNode.innerHTML = html;
|
|
1774
|
+
}).catch(() => {});
|
|
1775
|
+
}
|
|
1776
|
+
getModelTabSize(model) {
|
|
1777
|
+
var _model$getOptions;
|
|
1778
|
+
const tabSize = (_model$getOptions = model.getOptions) === null || _model$getOptions === void 0 ? void 0 : _model$getOptions.call(model).tabSize;
|
|
1779
|
+
return typeof tabSize === "number" && Number.isFinite(tabSize) ? tabSize : void 0;
|
|
1780
|
+
}
|
|
1764
1781
|
hasVisibleNativeInlineDeleteNodes() {
|
|
1765
1782
|
if (!this.lastContainer) return false;
|
|
1766
1783
|
const querySelectorAll = typeof this.lastContainer.querySelectorAll === "function" ? this.lastContainer.querySelectorAll.bind(this.lastContainer) : null;
|
|
@@ -1799,6 +1816,7 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1799
1816
|
}
|
|
1800
1817
|
const lineHeightOption = (_EditorOption = monaco_shim_exports.editor.EditorOption) === null || _EditorOption === void 0 ? void 0 : _EditorOption.lineHeight;
|
|
1801
1818
|
const lineHeight = ((_modifiedEditor$getOp = modifiedEditor.getOption) === null || _modifiedEditor$getOp === void 0 ? void 0 : _modifiedEditor$getOp.call(modifiedEditor, lineHeightOption)) ?? 20;
|
|
1819
|
+
const originalTabSize = this.getModelTabSize(originalModel);
|
|
1802
1820
|
const relevantChanges = lineChanges.filter((change) => hasOriginalLines(change));
|
|
1803
1821
|
const nativeViewWrappers = Array.from(((_this$lastContainer3 = this.lastContainer) === null || _this$lastContainer3 === void 0 || (_this$lastContainer3$ = _this$lastContainer3.querySelectorAll) === null || _this$lastContainer3$ === void 0 ? void 0 : _this$lastContainer3$.call(_this$lastContainer3, ".editor.modified .view-zones [monaco-view-zone]")) ?? []).filter((node) => {
|
|
1804
1822
|
return node instanceof HTMLElement && !!node.querySelector(".view-lines.line-delete");
|
|
@@ -1843,12 +1861,14 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1843
1861
|
domNode.setAttribute("data-stream-monaco-native-wrapper", "true");
|
|
1844
1862
|
(_modifiedEditor$apply = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply === void 0 || _modifiedEditor$apply.call(modifiedEditor, domNode);
|
|
1845
1863
|
for (let line = change.originalStartLineNumber; line <= change.originalEndLineNumber; line++) {
|
|
1864
|
+
const lineText = this.readModelLineContent(originalModel, line);
|
|
1846
1865
|
const lineNode = document.createElement("div");
|
|
1847
1866
|
lineNode.className = "stream-monaco-fallback-inline-delete-line";
|
|
1848
|
-
lineNode.textContent =
|
|
1867
|
+
lineNode.textContent = lineText;
|
|
1849
1868
|
lineNode.style.height = `${lineHeight}px`;
|
|
1850
1869
|
lineNode.style.lineHeight = `${lineHeight}px`;
|
|
1851
1870
|
domNode.append(lineNode);
|
|
1871
|
+
this.colorizeFallbackInlineDeletedLine(lineNode, originalModel, lineText, originalTabSize);
|
|
1852
1872
|
}
|
|
1853
1873
|
pair.viewWrapper.append(domNode);
|
|
1854
1874
|
if (pair.marginWrapper) {
|
|
@@ -1875,12 +1895,14 @@ var DiffEditorManager = class DiffEditorManager {
|
|
|
1875
1895
|
domNode.setAttribute("aria-hidden", "true");
|
|
1876
1896
|
(_modifiedEditor$apply3 = modifiedEditor.applyFontInfo) === null || _modifiedEditor$apply3 === void 0 || _modifiedEditor$apply3.call(modifiedEditor, domNode);
|
|
1877
1897
|
for (let line = change.originalStartLineNumber; line <= change.originalEndLineNumber; line++) {
|
|
1898
|
+
const lineText = this.readModelLineContent(originalModel, line);
|
|
1878
1899
|
const lineNode = document.createElement("div");
|
|
1879
1900
|
lineNode.className = "stream-monaco-fallback-inline-delete-line";
|
|
1880
|
-
lineNode.textContent =
|
|
1901
|
+
lineNode.textContent = lineText;
|
|
1881
1902
|
lineNode.style.height = `${lineHeight}px`;
|
|
1882
1903
|
lineNode.style.lineHeight = `${lineHeight}px`;
|
|
1883
1904
|
domNode.append(lineNode);
|
|
1905
|
+
this.colorizeFallbackInlineDeletedLine(lineNode, originalModel, lineText, originalTabSize);
|
|
1884
1906
|
}
|
|
1885
1907
|
const marginDomNode = document.createElement("div");
|
|
1886
1908
|
marginDomNode.className = "stream-monaco-fallback-inline-delete-margin";
|
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.45",
|
|
5
5
|
"packageManager": "pnpm@10.33.4",
|
|
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",
|