@lvce-editor/editor-worker 19.68.4 → 19.68.6

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.
@@ -9825,6 +9825,7 @@ const getDiagnosticHoverInfo = async (editor, diagnostic) => {
9825
9825
  return {
9826
9826
  diagnostics: [diagnostic],
9827
9827
  documentation: '',
9828
+ documentationVirtualDom: [],
9828
9829
  height,
9829
9830
  lineInfos: [],
9830
9831
  width,
@@ -9842,6 +9843,7 @@ const create$5 = () => {
9842
9843
  content: '',
9843
9844
  diagnostics: [],
9844
9845
  documentation: '',
9846
+ documentationVirtualDom: [],
9845
9847
  editorUid: 0,
9846
9848
  height: 0,
9847
9849
  lineInfos: [],
@@ -9855,6 +9857,7 @@ const create$5 = () => {
9855
9857
  content: '',
9856
9858
  diagnostics: [],
9857
9859
  documentation: '',
9860
+ documentationVirtualDom: [],
9858
9861
  editorUid: 0,
9859
9862
  height: 0,
9860
9863
  lineInfos: [],
@@ -9893,6 +9896,15 @@ const getHover = async (editor, offset) => {
9893
9896
  return hover;
9894
9897
  };
9895
9898
 
9899
+ const invoke$5 = (...args) => invoke$d(...args);
9900
+
9901
+ const getVirtualDomFromMarkdown = async markdown => {
9902
+ const html = await invoke$5('Markdown.renderMarkdown', markdown, {
9903
+ linksExternal: true
9904
+ });
9905
+ return invoke$5('Markdown.getVirtualDom', html);
9906
+ };
9907
+
9896
9908
  const getLineInfo = (line, tokens, TokenMap) => {
9897
9909
  const tokensLength = tokens.length;
9898
9910
  let end = 0;
@@ -9990,6 +10002,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
9990
10002
  }
9991
10003
  const tokenizerPath = '';
9992
10004
  const lineInfos = displayString ? await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath) : [];
10005
+ const documentationVirtualDom = documentation ? await getVirtualDomFromMarkdown(documentation) : [];
9993
10006
  const wordPart = getWordBefore(editor, rowIndex, columnIndex);
9994
10007
  const wordStart = columnIndex - wordPart.length;
9995
10008
  const documentationHeight = documentation ? await measureTextBlockHeight(documentation, hoverDocumentationFontFamily, hoverDocumentationFontSize, hoverDocumentationLineHeight, hoverDocumentationWidth) : 0;
@@ -10004,6 +10017,7 @@ const getEditorHoverInfo = async (editorUid, position) => {
10004
10017
  const y$1 = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
10005
10018
  return {
10006
10019
  documentation,
10020
+ documentationVirtualDom,
10007
10021
  height,
10008
10022
  lineInfos,
10009
10023
  matchingDiagnostics,
@@ -10019,6 +10033,7 @@ const loadHoverContent = async (state, position) => {
10019
10033
  }
10020
10034
  const {
10021
10035
  documentation,
10036
+ documentationVirtualDom,
10022
10037
  height,
10023
10038
  lineInfos,
10024
10039
  matchingDiagnostics,
@@ -10029,6 +10044,7 @@ const loadHoverContent = async (state, position) => {
10029
10044
  ...state,
10030
10045
  diagnostics: matchingDiagnostics,
10031
10046
  documentation,
10047
+ documentationVirtualDom,
10032
10048
  height,
10033
10049
  lineInfos,
10034
10050
  width: 600,
@@ -11073,7 +11089,7 @@ const create$3 = () => {
11073
11089
  };
11074
11090
 
11075
11091
  const {
11076
- invoke: invoke$5,
11092
+ invoke: invoke$4,
11077
11093
  setFactory
11078
11094
  } = createLazyRpc(CompletionWorker);
11079
11095
 
@@ -11092,10 +11108,10 @@ const newStateGenerator$3 = async (state, parentUid) => {
11092
11108
  applicationId,
11093
11109
  languageId
11094
11110
  } = newState;
11095
- await invoke$5('Completions.create', uid, x, y, width, height, parentUid, languageId, applicationId);
11096
- await invoke$5('Completions.loadContent', uid);
11097
- const diff = await invoke$5('Completions.diff2', uid);
11098
- const commands = await invoke$5('Completions.render2', uid, diff);
11111
+ await invoke$4('Completions.create', uid, x, y, width, height, parentUid, languageId, applicationId);
11112
+ await invoke$4('Completions.loadContent', uid);
11113
+ const diff = await invoke$4('Completions.diff2', uid);
11114
+ const commands = await invoke$4('Completions.render2', uid, diff);
11099
11115
  return {
11100
11116
  ...state,
11101
11117
  commands
@@ -11225,7 +11241,7 @@ const launch = async () => {
11225
11241
  const rpc = await launchFindWidgetWorker();
11226
11242
  set$h(rpcId, rpc);
11227
11243
  };
11228
- const invoke$4 = async (method, ...params) => {
11244
+ const invoke$3 = async (method, ...params) => {
11229
11245
  const rpc = get$9(rpcId);
11230
11246
  return await rpc.invoke(method, ...params);
11231
11247
  };
@@ -11256,7 +11272,7 @@ const getOrCreate$1 = () => {
11256
11272
  }
11257
11273
  return state$2.workerPromise;
11258
11274
  };
11259
- const invoke$3 = async (method, ...params) => {
11275
+ const invoke$2 = async (method, ...params) => {
11260
11276
  const worker = await getOrCreate$1();
11261
11277
  return await worker.invoke(method, ...params);
11262
11278
  };
@@ -11276,7 +11292,7 @@ const getOrCreate = () => {
11276
11292
  }
11277
11293
  return state$1.workerPromise;
11278
11294
  };
11279
- const invoke$2 = async (method, ...params) => {
11295
+ const invoke$1 = async (method, ...params) => {
11280
11296
  const worker = await getOrCreate();
11281
11297
  return await worker.invoke(method, ...params);
11282
11298
  };
@@ -11286,15 +11302,15 @@ const getWidgetInvoke = widgetId => {
11286
11302
  case ColorPicker$2:
11287
11303
  return invoke$7;
11288
11304
  case Completion:
11289
- return invoke$5;
11290
- case Find:
11291
11305
  return invoke$4;
11292
- case Hover:
11306
+ case Find:
11293
11307
  return invoke$3;
11308
+ case Hover:
11309
+ return invoke$2;
11294
11310
  case Rename$1:
11295
11311
  return invoke$6;
11296
11312
  case SourceAction$1:
11297
- return invoke$2;
11313
+ return invoke$1;
11298
11314
  default:
11299
11315
  return undefined;
11300
11316
  }
@@ -11554,10 +11570,10 @@ const loadContent$2 = async (state, parentUid) => {
11554
11570
  y
11555
11571
  } = editor;
11556
11572
  await launch();
11557
- await invoke$4('FindWidget.create', uid, x, y, width, height, parentUid);
11558
- await invoke$4('FindWidget.loadContent', uid);
11559
- const diff = await invoke$4('FindWidget.diff2', uid);
11560
- const commands = await invoke$4('FindWidget.render2', uid, diff);
11573
+ await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
11574
+ await invoke$3('FindWidget.loadContent', uid);
11575
+ const diff = await invoke$3('FindWidget.diff2', uid);
11576
+ const commands = await invoke$3('FindWidget.render2', uid, diff);
11561
11577
  return {
11562
11578
  ...state,
11563
11579
  commands
@@ -12654,10 +12670,10 @@ const newStateGenerator = async (state, parentUid) => {
12654
12670
  const {
12655
12671
  languageId
12656
12672
  } = newState;
12657
- await invoke$2('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
12658
- await invoke$2('SourceActions.loadContent', uid);
12659
- const diff = await invoke$2('SourceActions.diff2', uid);
12660
- const commands = await invoke$2('SourceActions.render2', uid, diff);
12673
+ await invoke$1('SourceActions.create', uid, x, y, width, height, parentUid, languageId);
12674
+ await invoke$1('SourceActions.loadContent', uid);
12675
+ const diff = await invoke$1('SourceActions.diff2', uid);
12676
+ const commands = await invoke$1('SourceActions.render2', uid, diff);
12661
12677
  return {
12662
12678
  ...state,
12663
12679
  commands
@@ -13647,6 +13663,7 @@ const loadContent$1 = async (editorUid, state, position) => {
13647
13663
  }
13648
13664
  const {
13649
13665
  documentation,
13666
+ documentationVirtualDom,
13650
13667
  height,
13651
13668
  lineInfos,
13652
13669
  matchingDiagnostics,
@@ -13657,6 +13674,7 @@ const loadContent$1 = async (editorUid, state, position) => {
13657
13674
  ...state,
13658
13675
  diagnostics: matchingDiagnostics,
13659
13676
  documentation,
13677
+ documentationVirtualDom,
13660
13678
  height,
13661
13679
  lineInfos,
13662
13680
  x,
@@ -14062,20 +14080,20 @@ const hoverSashNode = {
14062
14080
  onPointerDown: HandleSashPointerDown,
14063
14081
  type: Div
14064
14082
  };
14065
- const getChildCount = (lineInfos, documentation, diagnostics) => {
14066
- const documentationCount = documentation ? 1 : 0;
14083
+ const getChildCount = (lineInfos, documentationVirtualDom, diagnostics) => {
14084
+ const documentationCount = documentationVirtualDom.length > 0 ? 1 : 0;
14067
14085
  const diagnosticsCount = diagnostics && diagnostics.length > 0 ? 1 : 0;
14068
- return lineInfos.length + documentationCount + diagnosticsCount;
14086
+ return (lineInfos.length > 0 ? 1 : 0) + documentationCount + diagnosticsCount;
14069
14087
  };
14070
- const getEditorHoverClassName = (lineInfos, documentation, diagnostics) => {
14071
- const isDiagnosticOnly = diagnostics?.length === 1 && lineInfos.length === 0 && !documentation;
14088
+ const getEditorHoverClassName = (lineInfos, documentationVirtualDom, diagnostics) => {
14089
+ const isDiagnosticOnly = diagnostics?.length === 1 && lineInfos.length === 0 && documentationVirtualDom.length === 0;
14072
14090
  return mergeClassNames('Viewlet', 'EditorHover', isDiagnosticOnly ? EditorHoverDiagnosticOnly : '');
14073
14091
  };
14074
- const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
14092
+ const getHoverVirtualDom = (lineInfos, documentationVirtualDom, diagnostics) => {
14075
14093
  const dom = [];
14076
14094
  dom.push({
14077
- childCount: getChildCount(lineInfos, documentation, diagnostics) + 1,
14078
- className: getEditorHoverClassName(lineInfos, documentation, diagnostics),
14095
+ childCount: getChildCount(lineInfos, documentationVirtualDom, diagnostics) + 1,
14096
+ className: getEditorHoverClassName(lineInfos, documentationVirtualDom, diagnostics),
14079
14097
  type: Div
14080
14098
  });
14081
14099
  if (diagnostics && diagnostics.length > 0) {
@@ -14096,8 +14114,8 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
14096
14114
  type: Div
14097
14115
  }, ...lineInfosDom);
14098
14116
  }
14099
- if (documentation) {
14100
- dom.push(hoverDocumentationNode, text(documentation));
14117
+ if (documentationVirtualDom.length > 0) {
14118
+ dom.push(hoverDocumentationNode, ...documentationVirtualDom);
14101
14119
  }
14102
14120
  dom.push(hoverSashNode);
14103
14121
  return dom;
@@ -14105,10 +14123,10 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
14105
14123
 
14106
14124
  const renderHoverDom = {
14107
14125
  apply(oldState, newState) {
14108
- const dom = getHoverVirtualDom(newState.lineInfos, newState.documentation, newState.diagnostics);
14126
+ const dom = getHoverVirtualDom(newState.lineInfos, newState.documentationVirtualDom, newState.diagnostics);
14109
14127
  return [/* method */SetDom2, dom];
14110
14128
  },
14111
- isEqual: (oldState, newState) => oldState.lineInfos === newState.lineInfos && oldState.documentation === newState.documentation && oldState.diagnostics === newState.diagnostics
14129
+ isEqual: (oldState, newState) => oldState.lineInfos === newState.lineInfos && oldState.documentationVirtualDom === newState.documentationVirtualDom && oldState.diagnostics === newState.diagnostics
14112
14130
  };
14113
14131
  const renderBounds$2 = {
14114
14132
  apply(oldState, newState) {
@@ -15132,7 +15150,11 @@ const isAutoClosingTagsEnabled = async () => {
15132
15150
  return true;
15133
15151
  };
15134
15152
  const getRowHeight = async () => {
15135
- return (await get$3(kLineHeight)) || 20;
15153
+ const [lineHeight, fontSize] = await Promise.all([get$3(kLineHeight), getFontSize()]);
15154
+ if (typeof lineHeight !== 'number' || !Number.isFinite(lineHeight) || lineHeight < fontSize) {
15155
+ return fontSize;
15156
+ }
15157
+ return lineHeight;
15136
15158
  };
15137
15159
  const getFontSize = async () => {
15138
15160
  return (await get$3(kFontSize)) || 15; // TODO find out if it is possible to use all numeric values for settings for efficiency, maybe settings could be an array
@@ -15236,9 +15258,9 @@ const updateFindWidget = async state => {
15236
15258
  const {
15237
15259
  uid
15238
15260
  } = widget.newState;
15239
- await invoke$4('FindWidget.handleSettingsChanged', uid);
15240
- const diff = await invoke$4('FindWidget.diff2', uid);
15241
- const commands = await invoke$4('FindWidget.render2', uid, diff);
15261
+ await invoke$3('FindWidget.handleSettingsChanged', uid);
15262
+ const diff = await invoke$3('FindWidget.diff2', uid);
15263
+ const commands = await invoke$3('FindWidget.render2', uid, diff);
15242
15264
  return updateWidget(state, Find, {
15243
15265
  ...widget.newState,
15244
15266
  commands
@@ -15333,7 +15355,7 @@ const getWidgetHotReloadDescriptor = widgetId => {
15333
15355
  switch (widgetId) {
15334
15356
  case Find:
15335
15357
  return {
15336
- invoke: invoke$4,
15358
+ invoke: invoke$3,
15337
15359
  name: 'FindWidget'
15338
15360
  };
15339
15361
  default:
@@ -17224,13 +17246,13 @@ const unregisterListener = (listenerType, rpcId) => {
17224
17246
  unregisterListener$1(listenerType, rpcId);
17225
17247
  };
17226
17248
 
17227
- const invoke$1 = async (method, ...params) => {
17249
+ const invoke = async (method, ...params) => {
17228
17250
  const worker = get$9(DebugWorker);
17229
17251
  return worker.invoke(method, ...params);
17230
17252
  };
17231
17253
 
17232
17254
  const getDebugHighlight = async debugId => {
17233
- const newInfo = await invoke$1('RunAndDebug.getHighlight', debugId);
17255
+ const newInfo = await invoke('RunAndDebug.getHighlight', debugId);
17234
17256
  return newInfo;
17235
17257
  };
17236
17258
 
@@ -17304,8 +17326,6 @@ const executeDiagnosticProvider = async editor => {
17304
17326
  return executeIsolatedDiagnosticProvider(editor);
17305
17327
  };
17306
17328
 
17307
- const invoke = (...args) => invoke$d(...args);
17308
-
17309
17329
  /**
17310
17330
  * Merges link decorations with diagnostic decorations
17311
17331
  * Links should always be present, but we also need to include any diagnostic decorations
@@ -17417,7 +17437,7 @@ const updateDiagnostics = async editor => {
17417
17437
  }
17418
17438
  const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
17419
17439
  set$8(editor.id, latest.oldState, newEditor);
17420
- await invoke('Editor.renderPending', newEditor.id);
17440
+ await invoke$5('Editor.renderPending', newEditor.id);
17421
17441
  await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
17422
17442
  return newEditor;
17423
17443
  })) ?? editor;
@@ -17899,6 +17919,7 @@ const commandMap = {
17899
17919
  'Listener.register': registerListener,
17900
17920
  'Listener.registerListener': registerListener,
17901
17921
  'Listener.unregister': unregisterListener,
17922
+ 'Markdown.getVirtualDomFromMarkdown': getVirtualDomFromMarkdown,
17902
17923
  'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker': sendDeprecatedExtensionHostPortToExtensionManagementWorker,
17903
17924
  'SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker': sendMessagePortToExtensionManagementWorker
17904
17925
  };
@@ -18244,7 +18265,7 @@ const render$1 = widget => {
18244
18265
  newState,
18245
18266
  oldState
18246
18267
  } = widget;
18247
- const commands = newState.commands.length > 0 ? renderFull$3(oldState, newState) : [[SetDom2, newState.uid, getHoverVirtualDom(newState.lineInfos, newState.documentation, newState.diagnostics)], [SetBounds2, newState.uid, newState.x, newState.y, newState.width, newState.height]];
18268
+ const commands = newState.commands.length > 0 ? renderFull$3(oldState, newState) : [[SetDom2, newState.uid, getHoverVirtualDom(newState.lineInfos, newState.documentationVirtualDom, newState.diagnostics)], [SetBounds2, newState.uid, newState.x, newState.y, newState.width, newState.height]];
18248
18269
  const wrappedCommands = [];
18249
18270
  const {
18250
18271
  uid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.68.4",
3
+ "version": "19.68.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"