@lvce-editor/editor-worker 3.13.0 → 3.15.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.
@@ -1,3 +1,23 @@
1
+ const commands = Object.create(null);
2
+ const registerCommand = (key, fn) => {
3
+ commands[key] = fn;
4
+ };
5
+ const register$1 = commandMap => {
6
+ for (const [key, value] of Object.entries(commandMap)) {
7
+ registerCommand(key, value);
8
+ }
9
+ };
10
+ const getCommand = key => {
11
+ return commands[key];
12
+ };
13
+ const execute$1 = (command, ...args) => {
14
+ const fn = getCommand(command);
15
+ if (!fn) {
16
+ throw new Error(`command not found ${command}`);
17
+ }
18
+ return fn(...args);
19
+ };
20
+
1
21
  let AssertionError$1 = class AssertionError extends Error {
2
22
  constructor(message) {
3
23
  super(message);
@@ -121,7 +141,7 @@ const IconButtonDisabled = 'IconButtonDisabled';
121
141
  const IconButton = 'IconButton';
122
142
  const CompletionDetailContent = 'CompletionDetailContent';
123
143
  const Diagnostic = 'Diagnostic';
124
- const FindWidgetReplace$1 = 'FindWidgetReplace';
144
+ const FindWidgetReplace = 'FindWidgetReplace';
125
145
  const FindWidgetFind = 'FindWidgetFind';
126
146
  const FindWidgetMatchCount = 'FindWidgetMatchCount';
127
147
  const FindWidgetRight = 'FindWidgetRight';
@@ -611,15 +631,15 @@ const createMeasureContext = () => {
611
631
  return ctx;
612
632
  };
613
633
 
614
- const state$b = {
634
+ const state$a = {
615
635
  ctx: undefined
616
636
  };
617
637
  const getOrCreate = createCtx => {
618
- if (state$b.ctx) {
619
- return state$b.ctx;
638
+ if (state$a.ctx) {
639
+ return state$a.ctx;
620
640
  }
621
- state$b.ctx = createCtx();
622
- return state$b.ctx;
641
+ state$a.ctx = createCtx();
642
+ return state$a.ctx;
623
643
  };
624
644
 
625
645
  const getContext = () => {
@@ -1200,11 +1220,11 @@ const get$6 = id => {
1200
1220
  const remove$4 = id => {
1201
1221
  delete state$1$1.callbacks[id];
1202
1222
  };
1203
- const state$a = {
1223
+ const state$9 = {
1204
1224
  id: 0
1205
1225
  };
1206
1226
  const create$3$1 = () => {
1207
- return ++state$a.id;
1227
+ return ++state$9.id;
1208
1228
  };
1209
1229
  const warn$1 = (...args) => {
1210
1230
  console.warn(...args);
@@ -1531,38 +1551,6 @@ const invokeAndTransfer$2 = async (ipc, method, ...params) => {
1531
1551
  return result;
1532
1552
  };
1533
1553
 
1534
- const state$9 = {
1535
- commands: Object.create(null)
1536
- };
1537
-
1538
- // @ts-ignore
1539
- const registerCommand = (key, fn) => {
1540
- state$9.commands[key] = fn;
1541
- };
1542
-
1543
- // @ts-ignore
1544
- const registerCommands = commandMap => {
1545
- for (const [key, value] of Object.entries(commandMap)) {
1546
- registerCommand(key, value);
1547
- }
1548
- };
1549
-
1550
- // @ts-ignore
1551
- const getCommand = key => {
1552
- return state$9.commands[key];
1553
- };
1554
-
1555
- const processName = 'editor-worker';
1556
-
1557
- // @ts-ignore
1558
- const execute$1 = (command, ...args) => {
1559
- const fn = getCommand(command);
1560
- if (!fn) {
1561
- throw new Error(`[${processName}] command not found ${command}`);
1562
- }
1563
- return fn(...args);
1564
- };
1565
-
1566
1554
  const requiresSocket = () => {
1567
1555
  return false;
1568
1556
  };
@@ -2512,13 +2500,13 @@ const FindWidget = 16;
2512
2500
  const EditorCompletion = 9;
2513
2501
  const CompletionDetail = 999;
2514
2502
  const Empty = 0;
2515
- const FindWidgetToggleReplace = 42;
2516
- const FindWidgetReplace = 43;
2517
- const FindWidgetReplaceButton = 46;
2518
- const FindWidgetReplaceAllButton = 47;
2519
- const FindWidgetCloseButton = 48;
2520
- const FindWidgetFocusNext = 49;
2521
- const FindWidgetFocusPrevious = 50;
2503
+ const FocusFindWidgetToggleReplace = 42;
2504
+ const FocusFindWidgetReplace = 43;
2505
+ const FocusFindWidgetReplaceButton = 46;
2506
+ const FocusFindWidgetReplaceAllButton = 47;
2507
+ const FocusFindWidgetCloseButton = 48;
2508
+ const FocusFindWidgetNextMatchButton = 49;
2509
+ const FocusFindWidgetPreviousMatchButton = 50;
2522
2510
 
2523
2511
  const newStateGenerator = state => {
2524
2512
  return loadContent$3(state);
@@ -3639,7 +3627,7 @@ const handleDoubleClick = (editor, modifier, x, y) => {
3639
3627
  };
3640
3628
 
3641
3629
  const WhenExpressionEditorText = 12;
3642
- const handleFocus$1 = editor => {
3630
+ const handleFocus = editor => {
3643
3631
  // TODO make change events functional,
3644
3632
  // when rendering, send focus changes to renderer worker
3645
3633
  invoke$3('Focus.setFocus', WhenExpressionEditorText);
@@ -3656,7 +3644,7 @@ const state$5 = {
3656
3644
  columnIndex: 0
3657
3645
  }
3658
3646
  };
3659
- const getPosition$2 = () => {
3647
+ const getPosition$1 = () => {
3660
3648
  return state$5.position;
3661
3649
  };
3662
3650
 
@@ -3976,7 +3964,7 @@ const setPosition = position => {
3976
3964
  const getEditor$1 = () => {
3977
3965
  return state$3.currentEditor;
3978
3966
  };
3979
- const getPosition$1 = () => {
3967
+ const getPosition = () => {
3980
3968
  return state$3.position;
3981
3969
  };
3982
3970
  const hasListener = () => {
@@ -4221,7 +4209,7 @@ const getNewSelections$5 = (anchor, position) => {
4221
4209
 
4222
4210
  // @ts-ignore
4223
4211
  const editorMoveSelection = (editor, position) => {
4224
- const anchor = getPosition$2();
4212
+ const anchor = getPosition$1();
4225
4213
  const newSelections = getNewSelections$5(anchor, position);
4226
4214
  // TODO if selection equals previous selection -> do nothing
4227
4215
  return scheduleSelections(editor, newSelections);
@@ -4508,7 +4496,7 @@ const getNewEditor$1 = (editor, position) => {
4508
4496
  const newMinLineY = position.rowIndex;
4509
4497
  const newMaxLineY = position.rowIndex + diff;
4510
4498
  const newDeltaY = position.rowIndex * rowHeight;
4511
- const anchor = getPosition$2();
4499
+ const anchor = getPosition$1();
4512
4500
  const newSelections = new Uint32Array([position.rowIndex - 1, position.columnIndex, anchor.rowIndex, anchor.columnIndex]);
4513
4501
  return {
4514
4502
  ...editor,
@@ -4523,7 +4511,7 @@ const getNewEditor$1 = (editor, position) => {
4523
4511
  const newMinLineY = position.rowIndex - diff;
4524
4512
  const newMaxLineY = position.rowIndex;
4525
4513
  const newDeltaY = newMinLineY * rowHeight;
4526
- const anchor = getPosition$2();
4514
+ const anchor = getPosition$1();
4527
4515
  const newSelections = new Uint32Array([anchor.rowIndex, anchor.columnIndex, position.rowIndex + 1, position.columnIndex]);
4528
4516
  return {
4529
4517
  ...editor,
@@ -4540,7 +4528,7 @@ const continueScrollingAndMovingSelection = async () => {
4540
4528
  if (!editor) {
4541
4529
  return;
4542
4530
  }
4543
- const position = getPosition$1();
4531
+ const position = getPosition();
4544
4532
  if (position.rowIndex === 0) {
4545
4533
  return;
4546
4534
  }
@@ -5181,22 +5169,14 @@ const findMatchesCaseInsensitive = (lines, searchString) => {
5181
5169
  return findRegexMatches(lines, regex);
5182
5170
  };
5183
5171
 
5184
- const getFindWidgetHeight = replaceExpanded => {
5185
- const collapsedHeight = 30;
5186
- const expandedHeight = 60;
5187
- const newHeight = replaceExpanded ? expandedHeight : collapsedHeight;
5188
- return newHeight;
5189
- };
5190
-
5191
5172
  const getMatchCount = matches => {
5192
5173
  return matches.length / 2;
5193
5174
  };
5194
5175
 
5195
- const setFindWidgetFocus = async (state, focusKey) => {
5176
+ const setFindWidgetFocus = (state, focusKey) => {
5196
5177
  if (state.focus === focusKey) {
5197
5178
  return state;
5198
5179
  }
5199
- await setFocus(focusKey);
5200
5180
  return {
5201
5181
  ...state,
5202
5182
  focus: focusKey,
@@ -5204,88 +5184,15 @@ const setFindWidgetFocus = async (state, focusKey) => {
5204
5184
  };
5205
5185
  };
5206
5186
 
5207
- const getPosition = editor => {
5208
- const width = 300;
5209
- const height = 30;
5210
- const paddingTop = 10;
5211
- const paddingRight = 20;
5212
- const x = editor.x + editor.width - width - paddingRight;
5213
- const y = editor.y + paddingTop;
5214
- return {
5215
- y,
5216
- x,
5217
- width,
5218
- height
5219
- };
5187
+ const focusCloseButton = state => {
5188
+ return setFindWidgetFocus(state, FocusFindWidgetCloseButton);
5220
5189
  };
5221
- const loadContent$1 = editorId => {
5222
- const editor = getEditor(editorId);
5223
- const {
5224
- selections,
5225
- lines
5226
- } = editor;
5227
- const startRowIndex = selections[0];
5228
- const startColumnIndex = selections[1];
5229
- const endColumnIndex = selections[3];
5230
- const line = lines[startRowIndex];
5231
- const value = line.slice(startColumnIndex, endColumnIndex);
5232
- const matches = findMatchesCaseInsensitive(lines, value);
5233
- const matchCount = getMatchCount(matches);
5234
- return {
5235
- value,
5236
- matches,
5237
- matchIndex: 0,
5238
- matchCount,
5239
- editorUid: editor.uid
5240
- };
5241
- };
5242
- const refresh = (state, value = state.value) => {
5243
- // TODO get focused editor
5244
- const {
5245
- editorUid
5246
- } = state;
5247
- // highlight locations that match value
5248
- const editor = getEditor(editorUid);
5249
- const {
5250
- lines
5251
- } = editor;
5252
- const matches = findMatchesCaseInsensitive(lines, value);
5253
- const matchCount = getMatchCount(matches);
5254
- return {
5255
- ...state,
5256
- matches,
5257
- matchIndex: 0,
5258
- matchCount,
5259
- value
5260
- };
5261
- };
5262
- const handleInput = (state, value) => {
5263
- return refresh(state, value);
5264
- };
5265
- const handleFocus = async state => {
5266
- if (state.focus === FindWidget) {
5267
- return state;
5268
- }
5269
- await setFocus(FindWidget);
5270
- return {
5271
- ...state,
5272
- focus: FindWidget
5273
- };
5274
- };
5275
- const handleBlur = async state => {
5276
- await setFocus(Empty);
5277
- return state;
5278
- };
5279
- const toggleReplace = state => {
5280
- const newExpanded = !state.replaceExpanded;
5281
- const newHeight = getFindWidgetHeight(newExpanded);
5282
- return {
5283
- ...state,
5284
- replaceExpanded: !state.replaceExpanded,
5285
- height: newHeight
5286
- };
5190
+
5191
+ const focusFind = state => {
5192
+ return setFindWidgetFocus(state, FindWidget);
5287
5193
  };
5288
5194
 
5195
+ // TODO don't call renderer worker, set editor state
5289
5196
  // TODO this function should be synchronous
5290
5197
  const focusIndex$1 = async (state, index) => {
5291
5198
  const {
@@ -5338,64 +5245,152 @@ const focusPrevious$1 = state => {
5338
5245
  }
5339
5246
  return focusIndex$1(state, matchIndex - 1);
5340
5247
  };
5341
- const close$1 = async state => {
5342
- // TODO
5343
- // await Viewlet.closeWidget(uid)
5344
- return {
5345
- ...state,
5346
- disposed: true
5347
- };
5248
+
5249
+ const focusNextMatchButton = state => {
5250
+ return setFindWidgetFocus(state, FocusFindWidgetNextMatchButton);
5348
5251
  };
5349
- const handleToggleReplaceFocus = async state => {
5350
- if (state.focus === FindWidgetToggleReplace) {
5252
+
5253
+ const focusPreviousMatchButton = state => {
5254
+ return setFindWidgetFocus(state, FocusFindWidgetPreviousMatchButton);
5255
+ };
5256
+
5257
+ const focusReplace = state => {
5258
+ return setFindWidgetFocus(state, FocusFindWidgetReplace);
5259
+ };
5260
+
5261
+ const focusReplaceAllButton = state => {
5262
+ return setFindWidgetFocus(state, FocusFindWidgetReplaceAllButton);
5263
+ };
5264
+
5265
+ const focusReplaceButton = state => {
5266
+ return setFindWidgetFocus(state, FocusFindWidgetReplaceButton);
5267
+ };
5268
+
5269
+ const focusToggleReplaceButton = state => {
5270
+ return setFindWidgetFocus(state, FocusFindWidgetToggleReplace);
5271
+ };
5272
+
5273
+ const handleBlur = async state => {
5274
+ await setFocus(Empty);
5275
+ return state;
5276
+ };
5277
+
5278
+ const handleFindWidgetFocus = (state, focusKey) => {
5279
+ if (state.focus === focusKey) {
5351
5280
  return state;
5352
5281
  }
5353
- await setFocus(FindWidgetToggleReplace);
5354
5282
  return {
5355
5283
  ...state,
5356
- focus: FindWidgetToggleReplace
5284
+ focus: focusKey,
5285
+ focusSource: User
5357
5286
  };
5358
5287
  };
5359
- const handleReplaceFocus = async state => {
5360
- if (state.focus === FindWidgetReplace) {
5361
- return state;
5362
- }
5363
- await setFocus(FindWidgetReplace);
5288
+
5289
+ const handleReplaceAllFocus = state => {
5290
+ return handleFindWidgetFocus(state, FocusFindWidgetReplaceAllButton);
5291
+ };
5292
+
5293
+ const handleReplaceFocus = state => {
5294
+ return handleFindWidgetFocus(state, FocusFindWidgetReplace);
5295
+ };
5296
+
5297
+ const getFindWidgetHeight = replaceExpanded => {
5298
+ const collapsedHeight = 30;
5299
+ const expandedHeight = 60;
5300
+ const newHeight = replaceExpanded ? expandedHeight : collapsedHeight;
5301
+ return newHeight;
5302
+ };
5303
+
5304
+ const toggleReplace = state => {
5305
+ const newExpanded = !state.replaceExpanded;
5306
+ const newHeight = getFindWidgetHeight(newExpanded);
5364
5307
  return {
5365
5308
  ...state,
5366
- focus: FindWidgetReplace,
5367
- focusSource: User
5309
+ replaceExpanded: !state.replaceExpanded,
5310
+ height: newHeight
5368
5311
  };
5369
5312
  };
5370
- const focusReplace = state => {
5371
- return setFindWidgetFocus(state, FindWidgetReplace);
5313
+
5314
+ const loadContent$1 = editorId => {
5315
+ const editor = getEditor(editorId);
5316
+ const {
5317
+ selections,
5318
+ lines
5319
+ } = editor;
5320
+ const startRowIndex = selections[0];
5321
+ const startColumnIndex = selections[1];
5322
+ const endColumnIndex = selections[3];
5323
+ const line = lines[startRowIndex];
5324
+ const value = line.slice(startColumnIndex, endColumnIndex);
5325
+ const matches = findMatchesCaseInsensitive(lines, value);
5326
+ const matchCount = getMatchCount(matches);
5327
+ return {
5328
+ value,
5329
+ matches,
5330
+ matchIndex: 0,
5331
+ matchCount,
5332
+ editorUid: editor.uid
5333
+ };
5372
5334
  };
5373
- const focusFind = state => {
5374
- return setFindWidgetFocus(state, FindWidget);
5335
+ const refresh = (state, value = state.value) => {
5336
+ // TODO get focused editor
5337
+ const {
5338
+ editorUid
5339
+ } = state;
5340
+ // highlight locations that match value
5341
+ const editor = getEditor(editorUid);
5342
+ const {
5343
+ lines
5344
+ } = editor;
5345
+ const matches = findMatchesCaseInsensitive(lines, value);
5346
+ const matchCount = getMatchCount(matches);
5347
+ return {
5348
+ ...state,
5349
+ matches,
5350
+ matchIndex: 0,
5351
+ matchCount,
5352
+ value
5353
+ };
5375
5354
  };
5376
- const handleReplaceInput = state => {
5377
- // TODO
5378
- return state;
5355
+ const handleInput = (state, value) => {
5356
+ return refresh(state, value);
5379
5357
  };
5380
- const focusToggleReplace = async state => {
5381
- return setFindWidgetFocus(state, FindWidgetToggleReplace);
5358
+ const close$1 = async state => {
5359
+ // TODO
5360
+ // await Viewlet.closeWidget(uid)
5361
+ return {
5362
+ ...state,
5363
+ disposed: true
5364
+ };
5382
5365
  };
5383
- const handleReplaceAllFocus = async state => {
5384
- if (state.focus === FindWidgetReplaceAllButton) {
5366
+ const handleToggleReplaceFocus = async state => {
5367
+ if (state.focus === FocusFindWidgetToggleReplace) {
5385
5368
  return state;
5386
5369
  }
5387
- await setFocus(FindWidgetReplaceAllButton);
5370
+ await setFocus(FocusFindWidgetToggleReplace);
5388
5371
  return {
5389
5372
  ...state,
5390
- focus: FindWidgetReplaceAllButton
5373
+ focus: FocusFindWidgetToggleReplace
5391
5374
  };
5392
5375
  };
5393
- const focusReplaceButton = async state => {
5394
- console.log('f replace button');
5395
- return setFindWidgetFocus(state, FindWidgetReplaceButton);
5376
+ const handleReplaceInput = state => {
5377
+ // TODO
5378
+ return state;
5396
5379
  };
5397
- const focusReplaceAllButton = async state => {
5398
- return setFindWidgetFocus(state, FindWidgetReplaceAllButton);
5380
+
5381
+ const getFindWidgetPosition = editor => {
5382
+ const width = 300;
5383
+ const height = 30;
5384
+ const paddingTop = 10;
5385
+ const paddingRight = 20;
5386
+ const x = editor.x + editor.width - width - paddingRight;
5387
+ const y = editor.y + paddingTop;
5388
+ return {
5389
+ y,
5390
+ x,
5391
+ width,
5392
+ height
5393
+ };
5399
5394
  };
5400
5395
 
5401
5396
  const openFind2 = async editor => {
@@ -5411,7 +5406,7 @@ const openFind2 = async editor => {
5411
5406
  y,
5412
5407
  width,
5413
5408
  height
5414
- } = getPosition(editor);
5409
+ } = getFindWidgetPosition(editor);
5415
5410
  const latestState = {
5416
5411
  ...state,
5417
5412
  value,
@@ -8735,7 +8730,10 @@ const widgetCommands = {
8735
8730
  'FindWidget.focusToggleReplace': Find,
8736
8731
  'FindWidget.focusReplace': Find,
8737
8732
  'FindWidget.focusReplaceButton': Find,
8738
- 'FindWidget.focusReplaceAllButton': Find
8733
+ 'FindWidget.focusReplaceAllButton': Find,
8734
+ 'FindWidget.focusNextMatchButton': Find,
8735
+ 'FindWidget.focusPreviousMatchButton': Find,
8736
+ 'FindWidget.focusCloseButton': Find
8739
8737
  };
8740
8738
 
8741
8739
  // TODO wrap commands globally, not per editor
@@ -8818,7 +8816,7 @@ const commandMap = {
8818
8816
  'Editor.handleBlur': handleBlur$1,
8819
8817
  'Editor.handleContextMenu': handleContextMenu,
8820
8818
  'Editor.handleDoubleClick': handleDoubleClick,
8821
- 'Editor.handleFocus': handleFocus$1,
8819
+ 'Editor.handleFocus': handleFocus,
8822
8820
  'Editor.handleMouseDown': handleMouseDown,
8823
8821
  'Editor.handleMouseMove': handleMouseMove,
8824
8822
  'Editor.handleMouseMoveWithAltKey': handleMouseMoveWithAltKey,
@@ -8910,20 +8908,23 @@ const commandMap = {
8910
8908
  'FindWidget.focusIndex': focusIndex$1,
8911
8909
  'FindWidget.focusLast': focusLast,
8912
8910
  'FindWidget.focusNext': focusNext$1,
8911
+ 'FindWidget.focusNextMatchButton': focusNextMatchButton,
8913
8912
  'FindWidget.focusPrevious': focusPrevious$1,
8913
+ 'FindWidget.focusPreviousMatchButton': focusPreviousMatchButton,
8914
8914
  'FindWidget.focusReplace': focusReplace,
8915
- 'FindWidget.focusToggleReplace': focusToggleReplace,
8915
+ 'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
8916
+ 'FindWidget.focusReplaceButton': focusReplaceButton,
8917
+ 'FindWidget.focusToggleReplace': focusToggleReplaceButton,
8916
8918
  'FindWidget.handleBlur': handleBlur,
8917
- 'FindWidget.handleFocus': handleFocus,
8919
+ 'FindWidget.handleFocus': handleFindWidgetFocus,
8918
8920
  'FindWidget.handleInput': handleInput,
8921
+ 'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
8919
8922
  'FindWidget.handleReplaceFocus': handleReplaceFocus,
8920
8923
  'FindWidget.handleReplaceInput': handleReplaceInput,
8924
+ 'FindWidget.handleToggleReplaceFocus': handleToggleReplaceFocus,
8921
8925
  'FindWidget.loadContent': loadContent$1,
8922
8926
  'FindWidget.toggleReplace': toggleReplace,
8923
- 'FindWidget.handleToggleReplaceFocus': handleToggleReplaceFocus,
8924
- 'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
8925
- 'FindWidget.focusReplaceButton': focusReplaceButton,
8926
- 'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
8927
+ 'FindWidget.focusCloseButton': focusCloseButton,
8927
8928
  'Font.ensure': ensure,
8928
8929
  'Hover.getHoverInfo': getEditorHoverInfo,
8929
8930
  'Hover.handleSashPointerDown': handleSashPointerDown,
@@ -9767,7 +9768,7 @@ const listen$1 = async ({
9767
9768
  };
9768
9769
 
9769
9770
  const listen = async () => {
9770
- registerCommands(commandMap);
9771
+ register$1(commandMap);
9771
9772
  register(Completion, EditorCompletionWidget);
9772
9773
  const ipc = await listen$1({
9773
9774
  method: Auto()
@@ -10056,19 +10057,19 @@ const getFindWidgetFocusSelector = focus => {
10056
10057
  switch (focus) {
10057
10058
  case FindWidget:
10058
10059
  return `[name="${SearchValue}"]`;
10059
- case FindWidgetReplace:
10060
+ case FocusFindWidgetReplace:
10060
10061
  return `[name="${ReplaceValue}"]`;
10061
- case FindWidgetReplaceAllButton:
10062
+ case FocusFindWidgetReplaceAllButton:
10062
10063
  return `[name="${ReplaceAll}"]`;
10063
- case FindWidgetCloseButton:
10064
+ case FocusFindWidgetCloseButton:
10064
10065
  return `[name="${Close}"]`;
10065
- case FindWidgetToggleReplace:
10066
+ case FocusFindWidgetToggleReplace:
10066
10067
  return `[name="${ToggleReplace}"]`;
10067
- case FindWidgetFocusNext:
10068
+ case FocusFindWidgetNextMatchButton:
10068
10069
  return `[name="${FocusNext}"]`;
10069
- case FindWidgetFocusPrevious:
10070
+ case FocusFindWidgetPreviousMatchButton:
10070
10071
  return `[name="${FocusPrevious}"]`;
10071
- case FindWidgetReplaceButton:
10072
+ case FocusFindWidgetReplaceButton:
10072
10073
  return `[name="${Replace}"]`;
10073
10074
  default:
10074
10075
  return '';
@@ -10178,7 +10179,7 @@ const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons) => {
10178
10179
  if (replaceExpanded) {
10179
10180
  dom.push({
10180
10181
  type: Div,
10181
- className: FindWidgetReplace$1,
10182
+ className: FindWidgetReplace,
10182
10183
  childCount: 1 + replaceButtons.length
10183
10184
  }, ...getSearchFieldVirtualDom('replace-value', replace(), 'handleReplaceInput', [], [], 'handleReplaceFocus'), ...replaceButtons.flatMap(getIconButtonVirtualDom));
10184
10185
  }
@@ -10300,6 +10301,10 @@ const renderFocus = {
10300
10301
 
10301
10302
  const render$1 = [renderDetails, renderBounds, renderValue, renderFocus];
10302
10303
  const apply = (oldState, newState) => {
10304
+ // TODO avoid side effect
10305
+ if (oldState.focus !== newState.focus) {
10306
+ setFocus(newState.focus);
10307
+ }
10303
10308
  return renderParts(render$1, oldState, newState);
10304
10309
  };
10305
10310
 
@@ -10327,7 +10332,7 @@ const Commands = {
10327
10332
  'FindWidget.focusIndex': focusIndex$1,
10328
10333
  'FindWidget.focusLast': focusLast,
10329
10334
  'FindWidget.toggleReplace': toggleReplace,
10330
- 'FindWidget.handleFocus': handleFocus,
10335
+ 'FindWidget.handleFocus': focusFind,
10331
10336
  'FindWidget.handleBlur': handleBlur
10332
10337
  };
10333
10338
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "3.13.0",
3
+ "version": "3.15.0",
4
4
  "description": "",
5
5
  "main": "dist/testWorkerMain.js",
6
6
  "type": "module",