@willbooster/monaco-react 0.0.0-semantically-released
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/LICENSE +22 -0
- package/README.md +86 -0
- package/dist/index.cjs +618 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +231 -0
- package/dist/index.d.ts +231 -0
- package/dist/index.js +581 -0
- package/dist/index.js.map +1 -0
- package/package.json +102 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
DiffEditor: () => DiffEditor_default2,
|
|
35
|
+
Editor: () => Editor_default2,
|
|
36
|
+
default: () => index_default,
|
|
37
|
+
loader: () => import_monaco_loader4.default,
|
|
38
|
+
useMonaco: () => useMonaco_default
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(index_exports);
|
|
41
|
+
var import_monaco_loader4 = __toESM(require("@willbooster/monaco-loader"), 1);
|
|
42
|
+
|
|
43
|
+
// src/DiffEditor/index.ts
|
|
44
|
+
var import_react5 = require("react");
|
|
45
|
+
|
|
46
|
+
// src/DiffEditor/DiffEditor.tsx
|
|
47
|
+
var import_react4 = require("react");
|
|
48
|
+
var import_monaco_loader = __toESM(require("@willbooster/monaco-loader"), 1);
|
|
49
|
+
|
|
50
|
+
// src/MonacoContainer/index.ts
|
|
51
|
+
var import_react = require("react");
|
|
52
|
+
|
|
53
|
+
// src/MonacoContainer/styles.ts
|
|
54
|
+
var styles = {
|
|
55
|
+
wrapper: {
|
|
56
|
+
display: "flex",
|
|
57
|
+
position: "relative",
|
|
58
|
+
textAlign: "initial"
|
|
59
|
+
},
|
|
60
|
+
fullWidth: {
|
|
61
|
+
width: "100%"
|
|
62
|
+
},
|
|
63
|
+
hide: {
|
|
64
|
+
display: "none"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var styles_default = styles;
|
|
68
|
+
|
|
69
|
+
// src/Loading/styles.ts
|
|
70
|
+
var styles2 = {
|
|
71
|
+
container: {
|
|
72
|
+
display: "flex",
|
|
73
|
+
height: "100%",
|
|
74
|
+
width: "100%",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
alignItems: "center"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var styles_default2 = styles2;
|
|
80
|
+
|
|
81
|
+
// src/Loading/Loading.tsx
|
|
82
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
83
|
+
function Loading({ children }) {
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: styles_default2.container, children });
|
|
85
|
+
}
|
|
86
|
+
var Loading_default = Loading;
|
|
87
|
+
|
|
88
|
+
// src/Loading/index.ts
|
|
89
|
+
var Loading_default2 = Loading_default;
|
|
90
|
+
|
|
91
|
+
// src/MonacoContainer/MonacoContainer.tsx
|
|
92
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
93
|
+
function MonacoContainer({
|
|
94
|
+
width,
|
|
95
|
+
height,
|
|
96
|
+
isEditorReady,
|
|
97
|
+
loading,
|
|
98
|
+
_ref,
|
|
99
|
+
className,
|
|
100
|
+
wrapperProps
|
|
101
|
+
}) {
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { style: { ...styles_default.wrapper, width, height }, ...wrapperProps, children: [
|
|
103
|
+
!isEditorReady && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loading_default2, { children: loading }),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: _ref, style: { ...styles_default.fullWidth, ...!isEditorReady && styles_default.hide }, className })
|
|
105
|
+
] });
|
|
106
|
+
}
|
|
107
|
+
var MonacoContainer_default = MonacoContainer;
|
|
108
|
+
|
|
109
|
+
// src/MonacoContainer/index.ts
|
|
110
|
+
var MonacoContainer_default2 = (0, import_react.memo)(MonacoContainer_default);
|
|
111
|
+
|
|
112
|
+
// src/hooks/useMount/index.ts
|
|
113
|
+
var import_react2 = require("react");
|
|
114
|
+
function useMount(effect) {
|
|
115
|
+
(0, import_react2.useEffect)(effect, []);
|
|
116
|
+
}
|
|
117
|
+
var useMount_default = useMount;
|
|
118
|
+
|
|
119
|
+
// src/hooks/useUpdate/index.ts
|
|
120
|
+
var import_react3 = require("react");
|
|
121
|
+
function useUpdate(effect, deps, applyChanges = true) {
|
|
122
|
+
const isInitialMount = (0, import_react3.useRef)(true);
|
|
123
|
+
(0, import_react3.useEffect)(
|
|
124
|
+
isInitialMount.current || !applyChanges ? () => {
|
|
125
|
+
isInitialMount.current = false;
|
|
126
|
+
} : effect,
|
|
127
|
+
deps
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
var useUpdate_default = useUpdate;
|
|
131
|
+
|
|
132
|
+
// src/utils/index.ts
|
|
133
|
+
function noop() {
|
|
134
|
+
}
|
|
135
|
+
function getOrCreateModel(monaco, value, language, path) {
|
|
136
|
+
return getModel(monaco, path) ?? createModel(monaco, value, language, path);
|
|
137
|
+
}
|
|
138
|
+
function getModel(monaco, path) {
|
|
139
|
+
return monaco.editor.getModel(createModelUri(monaco, path));
|
|
140
|
+
}
|
|
141
|
+
function createModel(monaco, value, language, path) {
|
|
142
|
+
return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : void 0);
|
|
143
|
+
}
|
|
144
|
+
function createModelUri(monaco, path) {
|
|
145
|
+
return monaco.Uri.parse(path);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/DiffEditor/DiffEditor.tsx
|
|
149
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
150
|
+
function DiffEditor({
|
|
151
|
+
original,
|
|
152
|
+
modified,
|
|
153
|
+
language,
|
|
154
|
+
originalLanguage,
|
|
155
|
+
modifiedLanguage,
|
|
156
|
+
originalModelPath,
|
|
157
|
+
modifiedModelPath,
|
|
158
|
+
keepCurrentOriginalModel = false,
|
|
159
|
+
keepCurrentModifiedModel = false,
|
|
160
|
+
theme = "light",
|
|
161
|
+
loading = "Loading...",
|
|
162
|
+
options = {},
|
|
163
|
+
height = "100%",
|
|
164
|
+
width = "100%",
|
|
165
|
+
className,
|
|
166
|
+
wrapperProps = {},
|
|
167
|
+
beforeMount = noop,
|
|
168
|
+
onMount = noop
|
|
169
|
+
}) {
|
|
170
|
+
const [isEditorReady, setIsEditorReady] = (0, import_react4.useState)(false);
|
|
171
|
+
const [isMonacoMounting, setIsMonacoMounting] = (0, import_react4.useState)(true);
|
|
172
|
+
const editorRef = (0, import_react4.useRef)(null);
|
|
173
|
+
const monacoRef = (0, import_react4.useRef)(null);
|
|
174
|
+
const containerRef = (0, import_react4.useRef)(null);
|
|
175
|
+
const onMountRef = (0, import_react4.useRef)(onMount);
|
|
176
|
+
const beforeMountRef = (0, import_react4.useRef)(beforeMount);
|
|
177
|
+
const preventCreation = (0, import_react4.useRef)(false);
|
|
178
|
+
useMount_default(() => {
|
|
179
|
+
const cancelable = import_monaco_loader.default.init();
|
|
180
|
+
cancelable.then((monaco) => (monacoRef.current = monaco) && setIsMonacoMounting(false)).catch((error) => error?.type !== "cancelation" && console.error("Monaco initialization: error:", error));
|
|
181
|
+
return () => editorRef.current ? disposeEditor() : cancelable.cancel();
|
|
182
|
+
});
|
|
183
|
+
useUpdate_default(
|
|
184
|
+
() => {
|
|
185
|
+
if (editorRef.current && monacoRef.current) {
|
|
186
|
+
const originalEditor = editorRef.current.getOriginalEditor();
|
|
187
|
+
const model = getOrCreateModel(
|
|
188
|
+
monacoRef.current,
|
|
189
|
+
original || "",
|
|
190
|
+
originalLanguage || language || "text",
|
|
191
|
+
originalModelPath || ""
|
|
192
|
+
);
|
|
193
|
+
if (model !== originalEditor.getModel()) {
|
|
194
|
+
originalEditor.setModel(model);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
[originalModelPath],
|
|
199
|
+
isEditorReady
|
|
200
|
+
);
|
|
201
|
+
useUpdate_default(
|
|
202
|
+
() => {
|
|
203
|
+
if (editorRef.current && monacoRef.current) {
|
|
204
|
+
const modifiedEditor = editorRef.current.getModifiedEditor();
|
|
205
|
+
const model = getOrCreateModel(
|
|
206
|
+
monacoRef.current,
|
|
207
|
+
modified || "",
|
|
208
|
+
modifiedLanguage || language || "text",
|
|
209
|
+
modifiedModelPath || ""
|
|
210
|
+
);
|
|
211
|
+
if (model !== modifiedEditor.getModel()) {
|
|
212
|
+
modifiedEditor.setModel(model);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
[modifiedModelPath],
|
|
217
|
+
isEditorReady
|
|
218
|
+
);
|
|
219
|
+
useUpdate_default(
|
|
220
|
+
() => {
|
|
221
|
+
const modifiedEditor = editorRef.current.getModifiedEditor();
|
|
222
|
+
if (modifiedEditor.getOption(monacoRef.current.editor.EditorOption.readOnly)) {
|
|
223
|
+
modifiedEditor.setValue(modified || "");
|
|
224
|
+
} else {
|
|
225
|
+
if (modified !== modifiedEditor.getValue()) {
|
|
226
|
+
modifiedEditor.executeEdits("", [
|
|
227
|
+
{
|
|
228
|
+
range: modifiedEditor.getModel().getFullModelRange(),
|
|
229
|
+
text: modified || "",
|
|
230
|
+
forceMoveMarkers: true
|
|
231
|
+
}
|
|
232
|
+
]);
|
|
233
|
+
modifiedEditor.pushUndoStop();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
[modified],
|
|
238
|
+
isEditorReady
|
|
239
|
+
);
|
|
240
|
+
useUpdate_default(
|
|
241
|
+
() => {
|
|
242
|
+
editorRef.current?.getModel()?.original.setValue(original || "");
|
|
243
|
+
},
|
|
244
|
+
[original],
|
|
245
|
+
isEditorReady
|
|
246
|
+
);
|
|
247
|
+
useUpdate_default(
|
|
248
|
+
() => {
|
|
249
|
+
const { original: original2, modified: modified2 } = editorRef.current.getModel();
|
|
250
|
+
monacoRef.current.editor.setModelLanguage(original2, originalLanguage || language || "text");
|
|
251
|
+
monacoRef.current.editor.setModelLanguage(modified2, modifiedLanguage || language || "text");
|
|
252
|
+
},
|
|
253
|
+
[language, originalLanguage, modifiedLanguage],
|
|
254
|
+
isEditorReady
|
|
255
|
+
);
|
|
256
|
+
useUpdate_default(
|
|
257
|
+
() => {
|
|
258
|
+
monacoRef.current?.editor.setTheme(theme);
|
|
259
|
+
},
|
|
260
|
+
[theme],
|
|
261
|
+
isEditorReady
|
|
262
|
+
);
|
|
263
|
+
useUpdate_default(
|
|
264
|
+
() => {
|
|
265
|
+
editorRef.current?.updateOptions(options);
|
|
266
|
+
},
|
|
267
|
+
[options],
|
|
268
|
+
isEditorReady
|
|
269
|
+
);
|
|
270
|
+
const setModels = (0, import_react4.useCallback)(() => {
|
|
271
|
+
if (!monacoRef.current) return;
|
|
272
|
+
beforeMountRef.current(monacoRef.current);
|
|
273
|
+
const originalModel = getOrCreateModel(
|
|
274
|
+
monacoRef.current,
|
|
275
|
+
original || "",
|
|
276
|
+
originalLanguage || language || "text",
|
|
277
|
+
originalModelPath || ""
|
|
278
|
+
);
|
|
279
|
+
const modifiedModel = getOrCreateModel(
|
|
280
|
+
monacoRef.current,
|
|
281
|
+
modified || "",
|
|
282
|
+
modifiedLanguage || language || "text",
|
|
283
|
+
modifiedModelPath || ""
|
|
284
|
+
);
|
|
285
|
+
editorRef.current?.setModel({
|
|
286
|
+
original: originalModel,
|
|
287
|
+
modified: modifiedModel
|
|
288
|
+
});
|
|
289
|
+
}, [language, modified, modifiedLanguage, original, originalLanguage, originalModelPath, modifiedModelPath]);
|
|
290
|
+
const createEditor = (0, import_react4.useCallback)(() => {
|
|
291
|
+
if (!preventCreation.current && containerRef.current) {
|
|
292
|
+
editorRef.current = monacoRef.current.editor.createDiffEditor(containerRef.current, {
|
|
293
|
+
automaticLayout: true,
|
|
294
|
+
...options
|
|
295
|
+
});
|
|
296
|
+
setModels();
|
|
297
|
+
monacoRef.current?.editor.setTheme(theme);
|
|
298
|
+
setIsEditorReady(true);
|
|
299
|
+
preventCreation.current = true;
|
|
300
|
+
}
|
|
301
|
+
}, [options, theme, setModels]);
|
|
302
|
+
(0, import_react4.useEffect)(() => {
|
|
303
|
+
if (isEditorReady) {
|
|
304
|
+
onMountRef.current(editorRef.current, monacoRef.current);
|
|
305
|
+
}
|
|
306
|
+
}, [isEditorReady]);
|
|
307
|
+
(0, import_react4.useEffect)(() => {
|
|
308
|
+
!isMonacoMounting && !isEditorReady && createEditor();
|
|
309
|
+
}, [isMonacoMounting, isEditorReady, createEditor]);
|
|
310
|
+
function disposeEditor() {
|
|
311
|
+
const models = editorRef.current?.getModel();
|
|
312
|
+
if (!keepCurrentOriginalModel) {
|
|
313
|
+
models?.original?.dispose();
|
|
314
|
+
}
|
|
315
|
+
if (!keepCurrentModifiedModel) {
|
|
316
|
+
models?.modified?.dispose();
|
|
317
|
+
}
|
|
318
|
+
editorRef.current?.dispose();
|
|
319
|
+
}
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
321
|
+
MonacoContainer_default2,
|
|
322
|
+
{
|
|
323
|
+
width,
|
|
324
|
+
height,
|
|
325
|
+
isEditorReady,
|
|
326
|
+
loading,
|
|
327
|
+
_ref: containerRef,
|
|
328
|
+
className,
|
|
329
|
+
wrapperProps
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
var DiffEditor_default = DiffEditor;
|
|
334
|
+
|
|
335
|
+
// src/DiffEditor/index.ts
|
|
336
|
+
var DiffEditor_default2 = (0, import_react5.memo)(DiffEditor_default);
|
|
337
|
+
|
|
338
|
+
// src/hooks/useMonaco/index.ts
|
|
339
|
+
var import_react6 = require("react");
|
|
340
|
+
var import_monaco_loader2 = __toESM(require("@willbooster/monaco-loader"), 1);
|
|
341
|
+
function useMonaco() {
|
|
342
|
+
const [monaco, setMonaco] = (0, import_react6.useState)(import_monaco_loader2.default.__getMonacoInstance());
|
|
343
|
+
useMount_default(() => {
|
|
344
|
+
let cancelable;
|
|
345
|
+
if (!monaco) {
|
|
346
|
+
cancelable = import_monaco_loader2.default.init();
|
|
347
|
+
void cancelable.then((monaco2) => {
|
|
348
|
+
setMonaco(monaco2);
|
|
349
|
+
return;
|
|
350
|
+
}).catch((error) => {
|
|
351
|
+
if (error?.type !== "cancelation") {
|
|
352
|
+
console.error("Monaco initialization: error:", error);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return () => cancelable?.cancel();
|
|
357
|
+
});
|
|
358
|
+
return monaco;
|
|
359
|
+
}
|
|
360
|
+
var useMonaco_default = useMonaco;
|
|
361
|
+
|
|
362
|
+
// src/Editor/index.ts
|
|
363
|
+
var import_react9 = require("react");
|
|
364
|
+
|
|
365
|
+
// src/Editor/Editor.tsx
|
|
366
|
+
var import_react8 = require("react");
|
|
367
|
+
var import_monaco_loader3 = __toESM(require("@willbooster/monaco-loader"), 1);
|
|
368
|
+
|
|
369
|
+
// src/hooks/usePrevious/index.ts
|
|
370
|
+
var import_react7 = require("react");
|
|
371
|
+
function usePrevious(value) {
|
|
372
|
+
const ref = (0, import_react7.useRef)(void 0);
|
|
373
|
+
(0, import_react7.useEffect)(() => {
|
|
374
|
+
ref.current = value;
|
|
375
|
+
}, [value]);
|
|
376
|
+
return ref.current;
|
|
377
|
+
}
|
|
378
|
+
var usePrevious_default = usePrevious;
|
|
379
|
+
|
|
380
|
+
// src/Editor/Editor.tsx
|
|
381
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
382
|
+
var viewStates = /* @__PURE__ */ new Map();
|
|
383
|
+
function Editor({
|
|
384
|
+
defaultValue,
|
|
385
|
+
defaultLanguage,
|
|
386
|
+
defaultPath,
|
|
387
|
+
value,
|
|
388
|
+
language,
|
|
389
|
+
path,
|
|
390
|
+
/* === */
|
|
391
|
+
theme = "light",
|
|
392
|
+
line,
|
|
393
|
+
loading = "Loading...",
|
|
394
|
+
options = {},
|
|
395
|
+
overrideServices = {},
|
|
396
|
+
saveViewState = true,
|
|
397
|
+
keepCurrentModel = false,
|
|
398
|
+
/* === */
|
|
399
|
+
width = "100%",
|
|
400
|
+
height = "100%",
|
|
401
|
+
className,
|
|
402
|
+
wrapperProps = {},
|
|
403
|
+
/* === */
|
|
404
|
+
beforeMount = noop,
|
|
405
|
+
onMount = noop,
|
|
406
|
+
onChange,
|
|
407
|
+
onValidate = noop
|
|
408
|
+
}) {
|
|
409
|
+
const [isEditorReady, setIsEditorReady] = (0, import_react8.useState)(false);
|
|
410
|
+
const [isMonacoMounting, setIsMonacoMounting] = (0, import_react8.useState)(true);
|
|
411
|
+
const monacoRef = (0, import_react8.useRef)(null);
|
|
412
|
+
const editorRef = (0, import_react8.useRef)(null);
|
|
413
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
414
|
+
const onMountRef = (0, import_react8.useRef)(onMount);
|
|
415
|
+
const beforeMountRef = (0, import_react8.useRef)(beforeMount);
|
|
416
|
+
const subscriptionRef = (0, import_react8.useRef)(void 0);
|
|
417
|
+
const valueRef = (0, import_react8.useRef)(value);
|
|
418
|
+
const previousPath = usePrevious_default(path);
|
|
419
|
+
const preventCreation = (0, import_react8.useRef)(false);
|
|
420
|
+
const preventTriggerChangeEvent = (0, import_react8.useRef)(false);
|
|
421
|
+
useMount_default(() => {
|
|
422
|
+
const cancelable = import_monaco_loader3.default.init();
|
|
423
|
+
cancelable.then((monaco) => (monacoRef.current = monaco) && setIsMonacoMounting(false)).catch((error) => error?.type !== "cancelation" && console.error("Monaco initialization: error:", error));
|
|
424
|
+
return () => editorRef.current ? disposeEditor() : cancelable.cancel();
|
|
425
|
+
});
|
|
426
|
+
useUpdate_default(
|
|
427
|
+
() => {
|
|
428
|
+
const model = getOrCreateModel(
|
|
429
|
+
monacoRef.current,
|
|
430
|
+
defaultValue || value || "",
|
|
431
|
+
defaultLanguage || language || "",
|
|
432
|
+
path || defaultPath || ""
|
|
433
|
+
);
|
|
434
|
+
if (model !== editorRef.current?.getModel()) {
|
|
435
|
+
if (saveViewState) viewStates.set(previousPath, editorRef.current?.saveViewState());
|
|
436
|
+
editorRef.current?.setModel(model);
|
|
437
|
+
if (saveViewState) editorRef.current?.restoreViewState(viewStates.get(path));
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
[path],
|
|
441
|
+
isEditorReady
|
|
442
|
+
);
|
|
443
|
+
useUpdate_default(
|
|
444
|
+
() => {
|
|
445
|
+
editorRef.current?.updateOptions(options);
|
|
446
|
+
},
|
|
447
|
+
[options],
|
|
448
|
+
isEditorReady
|
|
449
|
+
);
|
|
450
|
+
useUpdate_default(
|
|
451
|
+
() => {
|
|
452
|
+
if (!editorRef.current || value === void 0) return;
|
|
453
|
+
if (editorRef.current.getOption(monacoRef.current.editor.EditorOption.readOnly)) {
|
|
454
|
+
editorRef.current.setValue(value);
|
|
455
|
+
} else if (value !== editorRef.current.getValue()) {
|
|
456
|
+
preventTriggerChangeEvent.current = true;
|
|
457
|
+
editorRef.current.executeEdits("", [
|
|
458
|
+
{
|
|
459
|
+
range: editorRef.current.getModel().getFullModelRange(),
|
|
460
|
+
text: value,
|
|
461
|
+
forceMoveMarkers: true
|
|
462
|
+
}
|
|
463
|
+
]);
|
|
464
|
+
editorRef.current.pushUndoStop();
|
|
465
|
+
preventTriggerChangeEvent.current = false;
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
[value],
|
|
469
|
+
isEditorReady
|
|
470
|
+
);
|
|
471
|
+
useUpdate_default(
|
|
472
|
+
() => {
|
|
473
|
+
const model = editorRef.current?.getModel();
|
|
474
|
+
if (isEditorReady && model && language) {
|
|
475
|
+
monacoRef.current?.editor.setModelLanguage(model, language);
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
[language, isEditorReady],
|
|
479
|
+
isEditorReady
|
|
480
|
+
);
|
|
481
|
+
useUpdate_default(
|
|
482
|
+
() => {
|
|
483
|
+
if (line !== void 0) {
|
|
484
|
+
editorRef.current?.revealLine(line);
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
[line],
|
|
488
|
+
isEditorReady
|
|
489
|
+
);
|
|
490
|
+
useUpdate_default(
|
|
491
|
+
() => {
|
|
492
|
+
monacoRef.current?.editor.setTheme(theme);
|
|
493
|
+
},
|
|
494
|
+
[theme],
|
|
495
|
+
isEditorReady
|
|
496
|
+
);
|
|
497
|
+
const createEditor = (0, import_react8.useCallback)(() => {
|
|
498
|
+
if (!containerRef.current || !monacoRef.current) return;
|
|
499
|
+
if (!preventCreation.current) {
|
|
500
|
+
beforeMountRef.current(monacoRef.current);
|
|
501
|
+
const autoCreatedModelPath = path || defaultPath;
|
|
502
|
+
const defaultModel = getOrCreateModel(
|
|
503
|
+
monacoRef.current,
|
|
504
|
+
value || defaultValue || "",
|
|
505
|
+
defaultLanguage || language || "",
|
|
506
|
+
autoCreatedModelPath || ""
|
|
507
|
+
);
|
|
508
|
+
const editor = monacoRef.current.editor.create(
|
|
509
|
+
containerRef.current,
|
|
510
|
+
{
|
|
511
|
+
model: defaultModel,
|
|
512
|
+
automaticLayout: true,
|
|
513
|
+
...options
|
|
514
|
+
},
|
|
515
|
+
overrideServices
|
|
516
|
+
);
|
|
517
|
+
editorRef.current = editor;
|
|
518
|
+
saveViewState && editor.restoreViewState(viewStates.get(autoCreatedModelPath));
|
|
519
|
+
monacoRef.current.editor.setTheme(theme);
|
|
520
|
+
if (line !== void 0) {
|
|
521
|
+
editor.revealLine(line);
|
|
522
|
+
}
|
|
523
|
+
setIsEditorReady(true);
|
|
524
|
+
preventCreation.current = true;
|
|
525
|
+
}
|
|
526
|
+
}, [
|
|
527
|
+
defaultValue,
|
|
528
|
+
defaultLanguage,
|
|
529
|
+
defaultPath,
|
|
530
|
+
value,
|
|
531
|
+
language,
|
|
532
|
+
path,
|
|
533
|
+
options,
|
|
534
|
+
overrideServices,
|
|
535
|
+
saveViewState,
|
|
536
|
+
theme,
|
|
537
|
+
line
|
|
538
|
+
]);
|
|
539
|
+
(0, import_react8.useEffect)(() => {
|
|
540
|
+
if (isEditorReady) {
|
|
541
|
+
onMountRef.current(editorRef.current, monacoRef.current);
|
|
542
|
+
}
|
|
543
|
+
}, [isEditorReady]);
|
|
544
|
+
(0, import_react8.useEffect)(() => {
|
|
545
|
+
!isMonacoMounting && !isEditorReady && createEditor();
|
|
546
|
+
}, [isMonacoMounting, isEditorReady, createEditor]);
|
|
547
|
+
valueRef.current = value;
|
|
548
|
+
(0, import_react8.useEffect)(() => {
|
|
549
|
+
if (isEditorReady && onChange) {
|
|
550
|
+
subscriptionRef.current?.dispose();
|
|
551
|
+
subscriptionRef.current = editorRef.current?.onDidChangeModelContent((event) => {
|
|
552
|
+
if (!preventTriggerChangeEvent.current) {
|
|
553
|
+
onChange(editorRef.current.getValue(), event);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}, [isEditorReady, onChange]);
|
|
558
|
+
(0, import_react8.useEffect)(() => {
|
|
559
|
+
if (isEditorReady) {
|
|
560
|
+
const changeMarkersListener = monacoRef.current.editor.onDidChangeMarkers((uris) => {
|
|
561
|
+
const editorUri = editorRef.current.getModel()?.uri;
|
|
562
|
+
if (editorUri) {
|
|
563
|
+
const currentEditorHasMarkerChanges = uris.find((uri) => uri.path === editorUri.path);
|
|
564
|
+
if (currentEditorHasMarkerChanges) {
|
|
565
|
+
const markers = monacoRef.current.editor.getModelMarkers({
|
|
566
|
+
resource: editorUri
|
|
567
|
+
});
|
|
568
|
+
onValidate?.(markers);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
return () => {
|
|
573
|
+
changeMarkersListener?.dispose();
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
return () => {
|
|
577
|
+
};
|
|
578
|
+
}, [isEditorReady, onValidate]);
|
|
579
|
+
function disposeEditor() {
|
|
580
|
+
subscriptionRef.current?.dispose();
|
|
581
|
+
if (keepCurrentModel) {
|
|
582
|
+
saveViewState && viewStates.set(path, editorRef.current.saveViewState());
|
|
583
|
+
} else {
|
|
584
|
+
editorRef.current.getModel()?.dispose();
|
|
585
|
+
}
|
|
586
|
+
editorRef.current.dispose();
|
|
587
|
+
editorRef.current = null;
|
|
588
|
+
preventCreation.current = false;
|
|
589
|
+
setIsEditorReady(false);
|
|
590
|
+
}
|
|
591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
592
|
+
MonacoContainer_default2,
|
|
593
|
+
{
|
|
594
|
+
width,
|
|
595
|
+
height,
|
|
596
|
+
isEditorReady,
|
|
597
|
+
loading,
|
|
598
|
+
_ref: containerRef,
|
|
599
|
+
className,
|
|
600
|
+
wrapperProps
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
var Editor_default = Editor;
|
|
605
|
+
|
|
606
|
+
// src/Editor/index.ts
|
|
607
|
+
var Editor_default2 = (0, import_react9.memo)(Editor_default);
|
|
608
|
+
|
|
609
|
+
// src/index.ts
|
|
610
|
+
var index_default = Editor_default2;
|
|
611
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
612
|
+
0 && (module.exports = {
|
|
613
|
+
DiffEditor,
|
|
614
|
+
Editor,
|
|
615
|
+
loader,
|
|
616
|
+
useMonaco
|
|
617
|
+
});
|
|
618
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/DiffEditor/index.ts","../src/DiffEditor/DiffEditor.tsx","../src/MonacoContainer/index.ts","../src/MonacoContainer/styles.ts","../src/Loading/styles.ts","../src/Loading/Loading.tsx","../src/Loading/index.ts","../src/MonacoContainer/MonacoContainer.tsx","../src/hooks/useMount/index.ts","../src/hooks/useUpdate/index.ts","../src/utils/index.ts","../src/hooks/useMonaco/index.ts","../src/Editor/index.ts","../src/Editor/Editor.tsx","../src/hooks/usePrevious/index.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\nexport { loader };\n\nimport DiffEditor from './DiffEditor';\nexport * from './DiffEditor/types';\nexport { DiffEditor };\n\nimport useMonaco from './hooks/useMonaco';\nexport { useMonaco };\n\nimport Editor from './Editor';\nexport * from './Editor/types';\nexport { Editor };\nexport default Editor;\n\n// Monaco\nimport type * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';\nexport type Monaco = typeof monaco;\n\n// Default themes\nexport type Theme = 'vs-dark' | 'light';\n","import { memo } from 'react';\n\nimport DiffEditor from './DiffEditor';\n\nexport * from './types';\n\nexport default memo(DiffEditor);\n","'use client';\n\nimport { useState, useRef, useCallback, useEffect } from 'react';\nimport type { ReactElement } from 'react';\nimport loader from '@willbooster/monaco-loader';\n\nimport MonacoContainer from '../MonacoContainer';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport { noop, getOrCreateModel } from '../utils';\nimport type { DiffEditorProps, MonacoDiffEditor } from './types';\nimport type { Monaco } from '..';\n\nfunction DiffEditor({\n original,\n modified,\n language,\n originalLanguage,\n modifiedLanguage,\n originalModelPath,\n modifiedModelPath,\n keepCurrentOriginalModel = false,\n keepCurrentModifiedModel = false,\n theme = 'light',\n loading = 'Loading...',\n options = {},\n height = '100%',\n width = '100%',\n className,\n wrapperProps = {},\n beforeMount = noop,\n onMount = noop,\n}: DiffEditorProps): ReactElement {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const [isMonacoMounting, setIsMonacoMounting] = useState(true);\n const editorRef = useRef<MonacoDiffEditor | null>(null);\n const monacoRef = useRef<Monaco | null>(null);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const preventCreation = useRef(false);\n\n useMount(() => {\n const cancelable = loader.init();\n\n cancelable\n .then((monaco) => (monacoRef.current = monaco as Monaco) && setIsMonacoMounting(false))\n .catch((error) => error?.type !== 'cancelation' && console.error('Monaco initialization: error:', error));\n\n return () => (editorRef.current ? disposeEditor() : cancelable.cancel());\n });\n\n useUpdate(\n () => {\n if (editorRef.current && monacoRef.current) {\n const originalEditor = editorRef.current.getOriginalEditor();\n const model = getOrCreateModel(\n monacoRef.current,\n original || '',\n originalLanguage || language || 'text',\n originalModelPath || ''\n );\n\n if (model !== originalEditor.getModel()) {\n originalEditor.setModel(model);\n }\n }\n },\n [originalModelPath],\n isEditorReady\n );\n\n useUpdate(\n () => {\n if (editorRef.current && monacoRef.current) {\n const modifiedEditor = editorRef.current.getModifiedEditor();\n const model = getOrCreateModel(\n monacoRef.current,\n modified || '',\n modifiedLanguage || language || 'text',\n modifiedModelPath || ''\n );\n\n if (model !== modifiedEditor.getModel()) {\n modifiedEditor.setModel(model);\n }\n }\n },\n [modifiedModelPath],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const modifiedEditor = editorRef.current!.getModifiedEditor();\n if (modifiedEditor.getOption(monacoRef.current!.editor.EditorOption.readOnly)) {\n modifiedEditor.setValue(modified || '');\n } else {\n if (modified !== modifiedEditor.getValue()) {\n modifiedEditor.executeEdits('', [\n {\n range: modifiedEditor.getModel()!.getFullModelRange(),\n text: modified || '',\n forceMoveMarkers: true,\n },\n ]);\n\n modifiedEditor.pushUndoStop();\n }\n }\n },\n [modified],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.getModel()?.original.setValue(original || '');\n },\n [original],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const { original, modified } = editorRef.current!.getModel()!;\n\n monacoRef.current!.editor.setModelLanguage(original, originalLanguage || language || 'text');\n monacoRef.current!.editor.setModelLanguage(modified, modifiedLanguage || language || 'text');\n },\n [language, originalLanguage, modifiedLanguage],\n isEditorReady\n );\n\n useUpdate(\n () => {\n monacoRef.current?.editor.setTheme(theme);\n },\n [theme],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.updateOptions(options);\n },\n [options],\n isEditorReady\n );\n\n const setModels = useCallback(() => {\n if (!monacoRef.current) return;\n beforeMountRef.current(monacoRef.current);\n const originalModel = getOrCreateModel(\n monacoRef.current,\n original || '',\n originalLanguage || language || 'text',\n originalModelPath || ''\n );\n\n const modifiedModel = getOrCreateModel(\n monacoRef.current,\n modified || '',\n modifiedLanguage || language || 'text',\n modifiedModelPath || ''\n );\n\n editorRef.current?.setModel({\n original: originalModel,\n modified: modifiedModel,\n });\n }, [language, modified, modifiedLanguage, original, originalLanguage, originalModelPath, modifiedModelPath]);\n\n const createEditor = useCallback(() => {\n if (!preventCreation.current && containerRef.current) {\n editorRef.current = monacoRef.current!.editor.createDiffEditor(containerRef.current, {\n automaticLayout: true,\n ...options,\n });\n\n setModels();\n\n monacoRef.current?.editor.setTheme(theme);\n\n setIsEditorReady(true);\n preventCreation.current = true;\n }\n }, [options, theme, setModels]);\n\n useEffect(() => {\n if (isEditorReady) {\n onMountRef.current(editorRef.current!, monacoRef.current!);\n }\n }, [isEditorReady]);\n\n useEffect(() => {\n !isMonacoMounting && !isEditorReady && createEditor();\n }, [isMonacoMounting, isEditorReady, createEditor]);\n\n function disposeEditor(): void {\n const models = editorRef.current?.getModel();\n\n if (!keepCurrentOriginalModel) {\n models?.original?.dispose();\n }\n\n if (!keepCurrentModifiedModel) {\n models?.modified?.dispose();\n }\n\n editorRef.current?.dispose();\n }\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={isEditorReady}\n loading={loading}\n _ref={containerRef}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n}\n\nexport default DiffEditor;\n","import { memo } from 'react';\n\nimport MonacoContainer from './MonacoContainer';\n\nexport default memo(MonacoContainer);\n","import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n display: 'flex',\n position: 'relative',\n textAlign: 'initial',\n },\n fullWidth: {\n width: '100%',\n },\n hide: {\n display: 'none',\n },\n};\n\nexport default styles;\n","import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n container: {\n display: 'flex',\n height: '100%',\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport default styles;\n","import type { PropsWithChildren, ReactElement } from 'react';\n\nimport styles from './styles';\n\nfunction Loading({ children }: PropsWithChildren): ReactElement {\n return <div style={styles.container}>{children}</div>;\n}\n\nexport default Loading;\n","import Loading from './Loading';\n\nexport default Loading;\n","import type { ReactElement } from 'react';\n\nimport styles from './styles';\nimport Loading from '../Loading';\nimport type { ContainerProps } from './types';\n\n// ** forwardref render functions do not support proptypes or defaultprops **\n// one of the reasons why we use a separate prop for passing ref instead of using forwardref\n\nfunction MonacoContainer({\n width,\n height,\n isEditorReady,\n loading,\n _ref,\n className,\n wrapperProps,\n}: ContainerProps): ReactElement {\n return (\n <section style={{ ...styles.wrapper, width, height }} {...wrapperProps}>\n {!isEditorReady && <Loading>{loading}</Loading>}\n <div ref={_ref} style={{ ...styles.fullWidth, ...(!isEditorReady && styles.hide) }} className={className} />\n </section>\n );\n}\n\nexport default MonacoContainer;\n","import { useEffect } from 'react';\nimport type { EffectCallback } from 'react';\n\nfunction useMount(effect: EffectCallback): void {\n useEffect(effect, []);\n}\n\nexport default useMount;\n","import { useEffect, useRef } from 'react';\nimport type { DependencyList, EffectCallback } from 'react';\n\nfunction useUpdate(effect: EffectCallback, deps: DependencyList, applyChanges = true): void {\n const isInitialMount = useRef(true);\n\n useEffect(\n isInitialMount.current || !applyChanges\n ? () => {\n isInitialMount.current = false;\n }\n : effect,\n deps\n );\n}\n\nexport default useUpdate;\n","import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor/esm/vs/editor/editor.api.js';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n return monaco.Uri.parse(path);\n}\n\nexport { noop, getOrCreateModel };\n","import { useState } from 'react';\nimport loader from '@willbooster/monaco-loader';\n\nimport useMount from '../useMount';\nimport type { Monaco } from '../..';\n\nfunction useMonaco(): Monaco | undefined {\n const [monaco, setMonaco] = useState<Monaco | undefined>(loader.__getMonacoInstance() as Monaco | undefined);\n\n useMount(() => {\n let cancelable: ReturnType<typeof loader.init>;\n\n if (!monaco) {\n cancelable = loader.init();\n\n void cancelable\n .then((monaco) => {\n setMonaco(monaco as Monaco);\n return;\n })\n .catch((error: unknown) => {\n if ((error as { type?: unknown })?.type !== 'cancelation') {\n console.error('Monaco initialization: error:', error);\n }\n });\n }\n\n return () => cancelable?.cancel();\n });\n\n return monaco;\n}\n\nexport default useMonaco;\n","import { memo } from 'react';\n\nimport Editor from './Editor';\n\nexport * from './types';\n\nexport default memo(Editor);\n","'use client';\n\nimport { useState, useEffect, useRef, useCallback } from 'react';\nimport type { ReactElement } from 'react';\nimport loader from '@willbooster/monaco-loader';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport usePrevious from '../hooks/usePrevious';\nimport type { IDisposable, Uri, editor } from 'monaco-editor/esm/vs/editor/editor.api.js';\nimport { noop, getOrCreateModel } from '../utils';\nimport type { EditorProps } from './types';\nimport type { Monaco } from '..';\nimport MonacoContainer from '../MonacoContainer';\n\nconst viewStates = new Map();\n\nfunction Editor({\n defaultValue,\n defaultLanguage,\n defaultPath,\n value,\n language,\n path,\n /* === */\n theme = 'light',\n line,\n loading = 'Loading...',\n options = {},\n overrideServices = {},\n saveViewState = true,\n keepCurrentModel = false,\n /* === */\n width = '100%',\n height = '100%',\n className,\n wrapperProps = {},\n /* === */\n beforeMount = noop,\n onMount = noop,\n onChange,\n onValidate = noop,\n}: EditorProps): ReactElement {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const [isMonacoMounting, setIsMonacoMounting] = useState(true);\n const monacoRef = useRef<Monaco | null>(null);\n const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const subscriptionRef = useRef<IDisposable | undefined>(undefined);\n const valueRef = useRef(value);\n const previousPath = usePrevious(path);\n const preventCreation = useRef(false);\n const preventTriggerChangeEvent = useRef<boolean>(false);\n\n useMount(() => {\n const cancelable = loader.init();\n\n cancelable\n .then((monaco) => (monacoRef.current = monaco as Monaco) && setIsMonacoMounting(false))\n .catch((error) => error?.type !== 'cancelation' && console.error('Monaco initialization: error:', error));\n\n return () => (editorRef.current ? disposeEditor() : cancelable.cancel());\n });\n\n useUpdate(\n () => {\n const model = getOrCreateModel(\n monacoRef.current!,\n defaultValue || value || '',\n defaultLanguage || language || '',\n path || defaultPath || ''\n );\n\n if (model !== editorRef.current?.getModel()) {\n if (saveViewState) viewStates.set(previousPath, editorRef.current?.saveViewState());\n editorRef.current?.setModel(model);\n if (saveViewState) editorRef.current?.restoreViewState(viewStates.get(path));\n }\n },\n [path],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.updateOptions(options);\n },\n [options],\n isEditorReady\n );\n\n useUpdate(\n () => {\n if (!editorRef.current || value === undefined) return;\n if (editorRef.current.getOption(monacoRef.current!.editor.EditorOption.readOnly)) {\n editorRef.current.setValue(value);\n } else if (value !== editorRef.current.getValue()) {\n preventTriggerChangeEvent.current = true;\n editorRef.current.executeEdits('', [\n {\n range: editorRef.current.getModel()!.getFullModelRange(),\n text: value,\n forceMoveMarkers: true,\n },\n ]);\n\n editorRef.current.pushUndoStop();\n preventTriggerChangeEvent.current = false;\n }\n },\n [value],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const model = editorRef.current?.getModel();\n if (isEditorReady && model && language) {\n monacoRef.current?.editor.setModelLanguage(model, language);\n }\n },\n [language, isEditorReady],\n isEditorReady\n );\n\n useUpdate(\n () => {\n // reason for undefined check: https://github.com/suren-atoyan/monaco-react/pull/188\n if (line !== undefined) {\n editorRef.current?.revealLine(line);\n }\n },\n [line],\n isEditorReady\n );\n\n useUpdate(\n () => {\n monacoRef.current?.editor.setTheme(theme);\n },\n [theme],\n isEditorReady\n );\n\n const createEditor = useCallback(() => {\n if (!containerRef.current || !monacoRef.current) return;\n if (!preventCreation.current) {\n beforeMountRef.current(monacoRef.current);\n const autoCreatedModelPath = path || defaultPath;\n\n const defaultModel = getOrCreateModel(\n monacoRef.current,\n value || defaultValue || '',\n defaultLanguage || language || '',\n autoCreatedModelPath || ''\n );\n\n const editor = monacoRef.current.editor.create(\n containerRef.current,\n {\n model: defaultModel,\n automaticLayout: true,\n ...options,\n },\n overrideServices\n );\n editorRef.current = editor;\n\n saveViewState && editor.restoreViewState(viewStates.get(autoCreatedModelPath));\n\n monacoRef.current.editor.setTheme(theme);\n\n if (line !== undefined) {\n editor.revealLine(line);\n }\n\n setIsEditorReady(true);\n preventCreation.current = true;\n }\n }, [\n defaultValue,\n defaultLanguage,\n defaultPath,\n value,\n language,\n path,\n options,\n overrideServices,\n saveViewState,\n theme,\n line,\n ]);\n\n useEffect(() => {\n if (isEditorReady) {\n onMountRef.current(editorRef.current!, monacoRef.current!);\n }\n }, [isEditorReady]);\n\n useEffect(() => {\n !isMonacoMounting && !isEditorReady && createEditor();\n }, [isMonacoMounting, isEditorReady, createEditor]);\n\n // subscription\n // to avoid unnecessary updates (attach - dispose listener) in subscription\n valueRef.current = value;\n\n // onChange\n useEffect(() => {\n if (isEditorReady && onChange) {\n subscriptionRef.current?.dispose();\n subscriptionRef.current = editorRef.current?.onDidChangeModelContent((event) => {\n if (!preventTriggerChangeEvent.current) {\n onChange(editorRef.current!.getValue(), event);\n }\n });\n }\n }, [isEditorReady, onChange]);\n\n // onValidate\n useEffect(() => {\n if (isEditorReady) {\n const changeMarkersListener = monacoRef.current!.editor.onDidChangeMarkers((uris: readonly Uri[]) => {\n const editorUri = editorRef.current!.getModel()?.uri;\n\n if (editorUri) {\n const currentEditorHasMarkerChanges = uris.find((uri: Uri) => uri.path === editorUri.path);\n if (currentEditorHasMarkerChanges) {\n const markers = monacoRef.current!.editor.getModelMarkers({\n resource: editorUri,\n });\n onValidate?.(markers);\n }\n }\n });\n\n return () => {\n changeMarkersListener?.dispose();\n };\n }\n return () => {\n // eslint happy\n };\n }, [isEditorReady, onValidate]);\n\n function disposeEditor(): void {\n subscriptionRef.current?.dispose();\n\n if (keepCurrentModel) {\n saveViewState && viewStates.set(path, editorRef.current!.saveViewState());\n } else {\n editorRef.current!.getModel()?.dispose();\n }\n\n editorRef.current!.dispose();\n\n editorRef.current = null;\n preventCreation.current = false;\n setIsEditorReady(false);\n }\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={isEditorReady}\n loading={loading}\n _ref={containerRef}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n}\n\nexport default Editor;\n","import { useEffect, useRef } from 'react';\n\nfunction usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\nexport default usePrevious;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oBAAAA;AAAA,EAAA,cAAAC;AAAA,EAAA;AAAA,sCAAAC;AAAA,EAAA;AAAA;AAAA;AAAA,IAAAC,wBAAmB;;;ACAnB,IAAAC,gBAAqB;;;ACErB,IAAAC,gBAAyD;AAEzD,2BAAmB;;;ACJnB,m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;AAEjD,YAAI,WAAW;AACb,gBAAM,gCAAgC,KAAK,KAAK,CAAC,QAAa,IAAI,SAAS,UAAU,IAAI;AACzF,cAAI,+BAA+B;AACjC,kBAAM,UAAU,UAAU,QAAS,OAAO,gBAAgB;AAAA,cACxD,UAAU;AAAA,YACZ,CAAC;AACD,yBAAa,OAAO;AAAA,UACtB;AAAA,QACF;AAAA,MACF,CAAC;AAED,aAAO,MAAM;AACX,+BAAuB,QAAQ;AAAA,MACjC;AAAA,IACF;AACA,WAAO,MAAM;AAAA,IAEb;AAAA,EACF,GAAG,CAAC,eAAe,UAAU,CAAC;AAE9B,WAAS,gBAAsB;AAC7B,oBAAgB,SAAS,QAAQ;AAEjC,QAAI,kBAAkB;AACpB,uBAAiB,WAAW,IAAI,MAAM,UAAU,QAAS,cAAc,CAAC;AAAA,IAC1E,OAAO;AACL,gBAAU,QAAS,SAAS,GAAG,QAAQ;AAAA,IACzC;AAEA,cAAU,QAAS,QAAQ;AAE3B,cAAU,UAAU;AACpB,oBAAgB,UAAU;AAC1B,qBAAiB,KAAK;AAAA,EACxB;AAEA,SACE;AAAA,IAACC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ;;;AD7Qf,IAAOC,sBAAQ,oBAAK,cAAM;;;AbO1B,IAAO,gBAAQC;","names":["DiffEditor_default","Editor_default","loader","import_monaco_loader","import_react","import_react","styles","styles_default","styles_default","Loading_default","import_jsx_runtime","Loading_default","MonacoContainer_default","import_react","import_react","import_jsx_runtime","loader","original","modified","MonacoContainer_default","DiffEditor_default","import_react","import_monaco_loader","loader","monaco","import_react","import_react","import_monaco_loader","import_react","import_jsx_runtime","loader","MonacoContainer_default","Editor_default","Editor_default"]}
|