@lvce-editor/editor-worker 13.1.0 → 13.3.0

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.
@@ -899,7 +899,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
899
899
  const responseMessage = await promise;
900
900
  return unwrapJsonRpcResult(responseMessage);
901
901
  };
902
- const send = (transport, method, ...params) => {
902
+ const send$1 = (transport, method, ...params) => {
903
903
  const message = create$4$2(method, params);
904
904
  transport.send(message);
905
905
  };
@@ -939,7 +939,7 @@ const createRpc = ipc => {
939
939
  * @deprecated
940
940
  */
941
941
  send(method, ...params) {
942
- send(ipc, method, ...params);
942
+ send$1(ipc, method, ...params);
943
943
  },
944
944
  invoke(method, ...params) {
945
945
  return invoke$c(ipc, method, ...params);
@@ -1136,6 +1136,7 @@ const EditorWorker = 99;
1136
1136
  const ExtensionHostWorker = 44;
1137
1137
  const MarkdownWorker = 300;
1138
1138
  const RendererWorker = 1;
1139
+ const TextMeasurementWorker = 7011;
1139
1140
 
1140
1141
  const FocusEditorText$1 = 12;
1141
1142
 
@@ -1216,6 +1217,11 @@ const {
1216
1217
  invoke: invoke$a,
1217
1218
  invokeAndTransfer: invokeAndTransfer$1,
1218
1219
  set: set$9} = create$9(RendererWorker);
1220
+ const sendMessagePortToTextMeasurementWorker = async port => {
1221
+ const command = 'TextMeasurement.handleMessagePort';
1222
+ // @ts-ignore
1223
+ await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker', port, command, 0);
1224
+ };
1219
1225
 
1220
1226
  const {
1221
1227
  invoke: invoke$9,
@@ -2435,7 +2441,7 @@ const getTabCount = string => {
2435
2441
  return count;
2436
2442
  };
2437
2443
 
2438
- const measureTextWidthFast = (text, charWidth) => {
2444
+ const measureTextWidthFast = async (text, charWidth) => {
2439
2445
  return text.length * charWidth;
2440
2446
  };
2441
2447
 
@@ -2474,7 +2480,7 @@ const getContext = () => {
2474
2480
 
2475
2481
  // TODO for text editor, could dispose measuring canvas after editor has been initialized to free up offscreencanvas space
2476
2482
 
2477
- const measureTextWidthSlow = (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
2483
+ const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
2478
2484
  string(text);
2479
2485
  number(fontWeight);
2480
2486
  number(fontSize);
@@ -2496,14 +2502,14 @@ const measureTextWidthSlow = (text, fontWeight, fontSize, fontFamily, letterSpac
2496
2502
  return width;
2497
2503
  };
2498
2504
 
2499
- const measureTextWidth = (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
2505
+ const measureTextWidth = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
2500
2506
  if (isMonoSpaceFont) {
2501
- return measureTextWidthFast(text, charWidth);
2507
+ return await measureTextWidthFast(text, charWidth);
2502
2508
  }
2503
- return measureTextWidthSlow(text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
2509
+ return await measureTextWidthSlow(text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
2504
2510
  };
2505
2511
 
2506
- const getX = (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference = 0) => {
2512
+ const getX = async (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference = 0) => {
2507
2513
  if (!line) {
2508
2514
  return 0;
2509
2515
  }
@@ -2525,7 +2531,8 @@ const getX = (line, column, fontWeight, fontSize, fontFamily, isMonospaceFont, l
2525
2531
  const normalizedLine = normalizeText(line, normalize, tabSize);
2526
2532
  const tabCount = getTabCount(line.slice(0, column));
2527
2533
  const partialText = normalizedLine.slice(0, column + tabCount);
2528
- return measureTextWidth(partialText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, averageCharWidth) - halfCursorWidth + difference;
2534
+ const textWidth = await measureTextWidth(partialText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, averageCharWidth);
2535
+ return textWidth - halfCursorWidth + difference;
2529
2536
  };
2530
2537
 
2531
2538
  const getY = (row, minLineY, rowHeight) => {
@@ -2642,7 +2649,7 @@ const getSelectionArray = visibleSelections => {
2642
2649
  }
2643
2650
  return selectionsArray;
2644
2651
  };
2645
- const getVisible = editor => {
2652
+ const getVisible = async editor => {
2646
2653
  const visibleCursors = [];
2647
2654
  const visibleSelections = [];
2648
2655
  // // TODO binary search
@@ -2675,7 +2682,7 @@ const getVisible = editor => {
2675
2682
  const relativeEndLineRow = selectionEndRow - minLineY;
2676
2683
  const endLineDifference = differences[relativeEndLineRow];
2677
2684
  const endLine = lines[selectionEndRow];
2678
- const endLineEndX = getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
2685
+ const endLineEndX = await getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
2679
2686
  const endLineY = getY(selectionEndRow, minLineY, rowHeight);
2680
2687
  if (isEmpty(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) && endLineEndX > 0) {
2681
2688
  visibleCursors.push(endLineEndX, endLineY);
@@ -2685,7 +2692,7 @@ const getVisible = editor => {
2685
2692
  const startLineYRelative = selectionStartRow - minLineY;
2686
2693
  const startLineDifference = differences[startLineYRelative];
2687
2694
  if (selectionStartRow === selectionEndRow) {
2688
- const startX = getX(endLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
2695
+ const startX = await getX(endLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
2689
2696
  if (reversed) {
2690
2697
  visibleCursors.push(startX, endLineY);
2691
2698
  } else if (endLineEndX >= 0) {
@@ -2696,8 +2703,8 @@ const getVisible = editor => {
2696
2703
  } else {
2697
2704
  if (selectionStartRow >= minLineY) {
2698
2705
  const startLine = lines[selectionStartRow];
2699
- const startLineStartX = getX(startLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
2700
- const startLineEndX = getX(startLine, startLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
2706
+ const startLineStartX = await getX(startLine, selectionStartColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
2707
+ const startLineEndX = await getX(startLine, startLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, startLineDifference);
2701
2708
  const startLineStartY = getY(selectionStartRow, minLineY, rowHeight);
2702
2709
  const selectionWidth = startLineEndX - startLineStartX;
2703
2710
  if (reversed) {
@@ -2712,7 +2719,7 @@ const getVisible = editor => {
2712
2719
  const currentLineY = getY(i, minLineY, rowHeight);
2713
2720
  const relativeLine = i - minLineY;
2714
2721
  const difference = differences[relativeLine];
2715
- const selectionWidth = getX(currentLine, currentLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference);
2722
+ const selectionWidth = await getX(currentLine, currentLine.length, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, difference);
2716
2723
  visibleSelections.push(0, currentLineY, selectionWidth, rowHeight);
2717
2724
  }
2718
2725
  if (selectionEndRow <= maxLineY) {
@@ -3131,8 +3138,8 @@ const getLanguages = async () => {
3131
3138
  return languages;
3132
3139
  };
3133
3140
 
3134
- const measureCharacterWidth = (fontWeight, fontSize, fontFamily, letterSpacing) => {
3135
- return measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
3141
+ const measureCharacterWidth = async (fontWeight, fontSize, fontFamily, letterSpacing) => {
3142
+ return await measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
3136
3143
  };
3137
3144
 
3138
3145
  const get$1 = async key => {
@@ -3171,7 +3178,7 @@ const getDiagnosticType = diagnostic => {
3171
3178
  return diagnostic.type;
3172
3179
  };
3173
3180
 
3174
- const getVisibleDiagnostics = (editor, diagnostics) => {
3181
+ const getVisibleDiagnostics = async (editor, diagnostics) => {
3175
3182
  const visibleDiagnostics = [];
3176
3183
  const {
3177
3184
  width,
@@ -3196,7 +3203,7 @@ const getVisibleDiagnostics = (editor, diagnostics) => {
3196
3203
  const diagnosticWidth = columnDelta * charWidth;
3197
3204
  const endLineDifference = 0;
3198
3205
  const halfCursorWidth = 0;
3199
- const x = getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, charWidth, endLineDifference);
3206
+ const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, charWidth, endLineDifference);
3200
3207
  const y = getY(rowIndex, minLineY, rowHeight) - rowHeight;
3201
3208
  visibleDiagnostics.push({
3202
3209
  x,
@@ -3228,7 +3235,7 @@ const updateDiagnostics = async newState => {
3228
3235
  if (!latest) {
3229
3236
  return newState;
3230
3237
  }
3231
- const decorations = getVisibleDiagnostics(latest.newState, diagnostics);
3238
+ const decorations = await getVisibleDiagnostics(latest.newState, diagnostics);
3232
3239
  const newEditor = {
3233
3240
  ...latest.newState,
3234
3241
  diagnostics,
@@ -3282,7 +3289,7 @@ const createEditor = async ({
3282
3289
  number(id);
3283
3290
  string(content);
3284
3291
  // TODO support overwriting language id by setting it explicitly or via settings
3285
- const charWidth = measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
3292
+ const charWidth = await measureCharacterWidth(fontWeight, fontSize, fontFamily, letterSpacing);
3286
3293
  const languages = await getLanguages();
3287
3294
  const computedlanguageId = getLanguageId$1(uri, languages);
3288
3295
  const editor = {
@@ -3582,9 +3589,9 @@ const editorReplaceSelections = (editor, replacement, origin) => {
3582
3589
  return replaceRange(editor, selections, replacement, origin);
3583
3590
  };
3584
3591
 
3585
- const getAccurateColumnIndexAscii = (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth) => {
3592
+ const getAccurateColumnIndexAscii = async (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth) => {
3586
3593
  for (let i = guess; i < line.length; i++) {
3587
- const width = measureTextWidth(line.slice(0, i), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3594
+ const width = await measureTextWidth(line.slice(0, i), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3588
3595
  if (eventX - width < averageCharWidth / 2) {
3589
3596
  return i;
3590
3597
  }
@@ -3631,14 +3638,13 @@ const create$8 = () => {
3631
3638
  };
3632
3639
  };
3633
3640
 
3634
- // @ts-ignore
3635
- const getAccurateColumnIndexUnicode = (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing) => {
3641
+ const getAccurateColumnIndexUnicode = async (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing) => {
3636
3642
  const segmenter = create$8();
3637
3643
  const segments = segmenter.getSegments(line);
3638
3644
  const isMonospaceFont = false;
3639
3645
  const charWidth = 0;
3640
3646
  for (const segment of segments) {
3641
- const width = measureTextWidth(line.slice(0, segment.index), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3647
+ const width = await measureTextWidth(line.slice(0, segment.index), fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3642
3648
  if (eventX - width < averageCharWidth) {
3643
3649
  return segment.index;
3644
3650
  }
@@ -3651,13 +3657,10 @@ const isAscii = line => {
3651
3657
  return RE_ASCII.test(line);
3652
3658
  };
3653
3659
 
3654
- // @ts-ignore
3655
3660
  const guessOffset = (eventX, averageCharWidth) => {
3656
3661
  const guess = Math.round(eventX / averageCharWidth);
3657
3662
  return guess;
3658
3663
  };
3659
-
3660
- // @ts-ignore
3661
3664
  const normalizeGuess = (line, guess, tabSize) => {
3662
3665
  let normalizedGuess = guess;
3663
3666
  for (let i = 0; i < guess; i++) {
@@ -3667,9 +3670,7 @@ const normalizeGuess = (line, guess, tabSize) => {
3667
3670
  }
3668
3671
  return normalizedGuess;
3669
3672
  };
3670
-
3671
- // @ts-ignore
3672
- const getAccurateColumnIndex = (line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX) => {
3673
+ const getAccurateColumnIndex = async (line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX) => {
3673
3674
  string(line);
3674
3675
  number(fontWeight);
3675
3676
  number(fontSize);
@@ -3685,18 +3686,18 @@ const getAccurateColumnIndex = (line, fontWeight, fontSize, fontFamily, letterSp
3685
3686
  const normalizedGuess = normalizeGuess(line, guess, tabSize);
3686
3687
  const text = line.slice(0, normalizedGuess);
3687
3688
  const normalizedText = normalizeText(text, normalize, tabSize);
3688
- const actual = measureTextWidth(normalizedText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3689
+ const actual = await measureTextWidth(normalizedText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3689
3690
  const isAscii$1 = isAscii(line);
3690
3691
  if (isAscii$1) {
3691
3692
  if (Math.abs(eventX - actual) < charWidth / 2) {
3692
3693
  return normalizedGuess;
3693
3694
  }
3694
- return getAccurateColumnIndexAscii(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3695
+ return await getAccurateColumnIndexAscii(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth);
3695
3696
  }
3696
- return getAccurateColumnIndexUnicode(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing);
3697
+ return await getAccurateColumnIndexUnicode(line, normalizedGuess, charWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing);
3697
3698
  };
3698
3699
 
3699
- const at = (editor, eventX, eventY) => {
3700
+ const at = async (editor, eventX, eventY) => {
3700
3701
  object(editor);
3701
3702
  number(eventX);
3702
3703
  number(eventY);
@@ -3722,7 +3723,7 @@ const at = (editor, eventX, eventY) => {
3722
3723
  }
3723
3724
  const clampedRowIndex = clamp(rowIndex, 0, lines.length - 1);
3724
3725
  const line = lines[clampedRowIndex];
3725
- const columnIndex = getAccurateColumnIndex(line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX);
3726
+ const columnIndex = await getAccurateColumnIndex(line, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, charWidth, tabSize, eventX);
3726
3727
  return {
3727
3728
  rowIndex: clampedRowIndex,
3728
3729
  columnIndex
@@ -5269,8 +5270,8 @@ const selectWord = (editor, rowIndex, columnIndex) => {
5269
5270
  return scheduleSelections(editor, newSelections);
5270
5271
  };
5271
5272
 
5272
- const handleDoubleClick = (editor, modifier, x, y) => {
5273
- const position = at(editor, x, y);
5273
+ const handleDoubleClick = async (editor, modifier, x, y) => {
5274
+ const position = await at(editor, x, y);
5274
5275
  return selectWord(editor, position.rowIndex, position.columnIndex);
5275
5276
  };
5276
5277
 
@@ -5295,7 +5296,7 @@ const handleSingleClick = async (editor, modifier, x, y) => {
5295
5296
  number(modifier);
5296
5297
  number(x);
5297
5298
  number(y);
5298
- const position = at(editor, x, y);
5299
+ const position = await at(editor, x, y);
5299
5300
  return handleClickAtPosition(editor, modifier, position.rowIndex, position.columnIndex);
5300
5301
  };
5301
5302
 
@@ -5379,7 +5380,7 @@ const onHoverIdle = async () => {
5379
5380
  y,
5380
5381
  editor
5381
5382
  } = get();
5382
- at(editor, x, y);
5383
+ await at(editor, x, y);
5383
5384
  await showHover$1();
5384
5385
  };
5385
5386
  const hoverDelay = 300;
@@ -5416,7 +5417,7 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
5416
5417
  object(editor);
5417
5418
  number(x);
5418
5419
  number(y);
5419
- const position = at(editor, x, y);
5420
+ const position = await at(editor, x, y);
5420
5421
  const documentOffset = offsetAt(editor, position.rowIndex, position.columnIndex);
5421
5422
  try {
5422
5423
  const definition = await getDefinition(editor, documentOffset);
@@ -5971,8 +5972,8 @@ const moveRectangleSelection = (editor, position) => {
5971
5972
  };
5972
5973
 
5973
5974
  // @ts-ignore
5974
- const moveRectangleSelectionPx = (editor, x, y) => {
5975
- at(editor, x, y);
5975
+ const moveRectangleSelectionPx = async (editor, x, y) => {
5976
+ await at(editor, x, y);
5976
5977
  };
5977
5978
 
5978
5979
  const LessThan = -1;
@@ -6107,11 +6108,11 @@ const continueScrollingAndMovingSelection = async () => {
6107
6108
  };
6108
6109
 
6109
6110
  // @ts-ignore
6110
- const moveSelectionPx = (editor, x, y) => {
6111
+ const moveSelectionPx = async (editor, x, y) => {
6111
6112
  object(editor);
6112
6113
  number(x);
6113
6114
  number(y);
6114
- const position = at(editor, x, y);
6115
+ const position = await at(editor, x, y);
6115
6116
  if (!hasListener() && (position.rowIndex < editor.minLineY || position.rowIndex > editor.maxLineY)) {
6116
6117
  requestAnimationFrame(continueScrollingAndMovingSelection);
6117
6118
  setEditor(editor);
@@ -6191,7 +6192,7 @@ const create$4 = () => {
6191
6192
  };
6192
6193
 
6193
6194
  const {
6194
- setFactory,
6195
+ setFactory: setFactory$1,
6195
6196
  invoke: invoke$4
6196
6197
  } = createLazyRpc(CompletionWorker);
6197
6198
 
@@ -9849,7 +9850,7 @@ const launchCompletionWorker = async () => {
9849
9850
  };
9850
9851
 
9851
9852
  const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
9852
- setFactory(launchCompletionWorker);
9853
+ setFactory$1(launchCompletionWorker);
9853
9854
  await Promise.all([initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental), initializeExtensionHost()]);
9854
9855
  };
9855
9856
 
@@ -10074,11 +10075,11 @@ const renderSelections = {
10074
10075
  isEqual(oldState, newState) {
10075
10076
  return oldState.selections === newState.selections && oldState.focused === newState.focused && oldState.minLineY === newState.minLineY && oldState.deltaX === newState.deltaX;
10076
10077
  },
10077
- apply(oldState, newState) {
10078
+ apply: async (oldState, newState) => {
10078
10079
  const {
10079
10080
  cursorInfos,
10080
10081
  selectionInfos
10081
- } = getVisible(newState);
10082
+ } = await getVisible(newState);
10082
10083
  const cursorsDom = getCursorsVirtualDom(cursorInfos);
10083
10084
  const selectionsDom = getSelectionsVirtualDom(selectionInfos);
10084
10085
  return [/* method */'setSelections', cursorsDom, selectionsDom];
@@ -10219,7 +10220,7 @@ const renderWidgets = {
10219
10220
  multiple: true
10220
10221
  };
10221
10222
  const render$6 = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets, renderFocusContext, renderAdditionalFocusContext];
10222
- const renderEditor = id => {
10223
+ const renderEditor = async id => {
10223
10224
  const instance = get$5(id);
10224
10225
  if (!instance) {
10225
10226
  return [];
@@ -10232,7 +10233,7 @@ const renderEditor = id => {
10232
10233
  set$6(id, newState, newState);
10233
10234
  for (const item of render$6) {
10234
10235
  if (!item.isEqual(oldState, newState)) {
10235
- const result = item.apply(oldState, newState);
10236
+ const result = await item.apply(oldState, newState);
10236
10237
  // @ts-ignore
10237
10238
  if (item.multiple) {
10238
10239
  commands.push(...result);
@@ -10361,7 +10362,7 @@ const wrapCommand = fn => async (editorUid, ...args) => {
10361
10362
  // TODO combine neweditor with latest editor?
10362
10363
 
10363
10364
  set$6(editorUid, state, newEditor);
10364
- const commands = renderEditor(editorUid);
10365
+ const commands = await renderEditor(editorUid);
10365
10366
  return {
10366
10367
  ...newEditor,
10367
10368
  commands
@@ -10617,7 +10618,28 @@ const commandMap = {
10617
10618
  };
10618
10619
  wrapCommands(commandMap);
10619
10620
 
10621
+ const send = port => {
10622
+ // @ts-ignore
10623
+ return sendMessagePortToTextMeasurementWorker(port);
10624
+ };
10625
+ const createTextMeasurementWorkerRpc = async () => {
10626
+ try {
10627
+ const rpc = await TransferMessagePortRpcParent.create({
10628
+ commandMap: {},
10629
+ send
10630
+ });
10631
+ return rpc;
10632
+ } catch (error) {
10633
+ throw new VError(error, `Failed to create text measurement worker rpc`);
10634
+ }
10635
+ };
10636
+
10637
+ const {
10638
+ setFactory
10639
+ } = createLazyRpc(TextMeasurementWorker);
10640
+
10620
10641
  const listen = async () => {
10642
+ setFactory(createTextMeasurementWorkerRpc);
10621
10643
  const rpc = await WebWorkerRpcClient.create({
10622
10644
  commandMap: commandMap
10623
10645
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "13.1.0",
3
+ "version": "13.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"