@lvce-editor/text-search-worker 3.0.0 → 3.2.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,19 +1,11 @@
1
- const commands = Object.create(null);
2
- const register = commandMap => {
3
- Object.assign(commands, commandMap);
4
- };
5
- const getCommand = key => {
6
- return commands[key];
7
- };
8
- const execute = (command, ...args) => {
9
- const fn = getCommand(command);
10
- if (!fn) {
11
- throw new Error(`command not found ${command}`);
12
- }
13
- return fn(...args);
14
- };
15
-
16
1
  const Two = '2.0';
2
+ const create$4 = (method, params) => {
3
+ return {
4
+ jsonrpc: Two,
5
+ method,
6
+ params
7
+ };
8
+ };
17
9
  const state$2 = {
18
10
  callbacks: Object.create(null)
19
11
  };
@@ -55,7 +47,7 @@ const resolve = (id, response) => {
55
47
  fn(response);
56
48
  remove$1(id);
57
49
  };
58
- const create$2$1 = (method, params) => {
50
+ const create$2 = (method, params) => {
59
51
  const {
60
52
  id,
61
53
  promise
@@ -232,7 +224,7 @@ const getErrorProperty = (error, prettyError) => {
232
224
  }
233
225
  };
234
226
  };
235
- const create$1$1 = (message, error) => {
227
+ const create$1$2 = (message, error) => {
236
228
  return {
237
229
  jsonrpc: Two,
238
230
  id: message.id,
@@ -243,9 +235,9 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
243
235
  const prettyError = preparePrettyError(error);
244
236
  logError(error, prettyError);
245
237
  const errorProperty = getErrorProperty(error, prettyError);
246
- return create$1$1(message, errorProperty);
238
+ return create$1$2(message, errorProperty);
247
239
  };
248
- const create$4 = (message, result) => {
240
+ const create$5 = (message, result) => {
249
241
  return {
250
242
  jsonrpc: Two,
251
243
  id: message.id,
@@ -254,7 +246,7 @@ const create$4 = (message, result) => {
254
246
  };
255
247
  const getSuccessResponse = (message, result) => {
256
248
  const resultProperty = result ?? null;
257
- return create$4(message, resultProperty);
249
+ return create$5(message, resultProperty);
258
250
  };
259
251
  const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
260
252
  try {
@@ -334,20 +326,65 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
334
326
  const {
335
327
  message,
336
328
  promise
337
- } = create$2$1(method, params);
338
- {
329
+ } = create$2(method, params);
330
+ if (useSendAndTransfer && ipc.sendAndTransfer) {
331
+ ipc.sendAndTransfer(message);
332
+ } else {
339
333
  ipc.send(message);
340
334
  }
341
335
  const responseMessage = await promise;
342
336
  return unwrapJsonRpcResult(responseMessage);
343
337
  };
338
+ const send = (transport, method, ...params) => {
339
+ const message = create$4(method, params);
340
+ transport.send(message);
341
+ };
344
342
  const invoke$2 = (ipc, method, ...params) => {
345
- return invokeHelper(ipc, method, params);
343
+ return invokeHelper(ipc, method, params, false);
344
+ };
345
+ const invokeAndTransfer = (ipc, method, ...params) => {
346
+ return invokeHelper(ipc, method, params, true);
347
+ };
348
+
349
+ const commands = Object.create(null);
350
+ const register = commandMap => {
351
+ Object.assign(commands, commandMap);
352
+ };
353
+ const getCommand = key => {
354
+ return commands[key];
355
+ };
356
+ const execute = (command, ...args) => {
357
+ const fn = getCommand(command);
358
+ if (!fn) {
359
+ throw new Error(`command not found ${command}`);
360
+ }
361
+ return fn(...args);
346
362
  };
347
363
 
348
364
  const getData$1 = event => {
349
365
  return event.data;
350
366
  };
367
+ const attachEvents = that => {
368
+ const handleMessage = (...args) => {
369
+ const data = that.getData(...args);
370
+ that.dispatchEvent(new MessageEvent('message', {
371
+ data
372
+ }));
373
+ };
374
+ that.onMessage(handleMessage);
375
+ const handleClose = event => {
376
+ that.dispatchEvent(new Event('close'));
377
+ };
378
+ that.onClose(handleClose);
379
+ };
380
+ class Ipc extends EventTarget {
381
+ constructor(rawIpc) {
382
+ super();
383
+ this._rawIpc = rawIpc;
384
+ attachEvents(this);
385
+ }
386
+ }
387
+ const readyMessage = 'ready';
351
388
  const walkValue = (value, transferrables, isTransferrable) => {
352
389
  if (!value) {
353
390
  return;
@@ -398,35 +435,14 @@ const getTransferrables = value => {
398
435
  walkValue(value, transferrables, isTransferrable);
399
436
  return transferrables;
400
437
  };
401
- const attachEvents = that => {
402
- const handleMessage = (...args) => {
403
- const data = that.getData(...args);
404
- that.dispatchEvent(new MessageEvent('message', {
405
- data
406
- }));
407
- };
408
- that.onMessage(handleMessage);
409
- const handleClose = event => {
410
- that.dispatchEvent(new Event('close'));
411
- };
412
- that.onClose(handleClose);
413
- };
414
- class Ipc extends EventTarget {
415
- constructor(rawIpc) {
416
- super();
417
- this._rawIpc = rawIpc;
418
- attachEvents(this);
419
- }
420
- }
421
- const readyMessage = 'ready';
422
- const listen$4 = () => {
438
+ const listen$2 = () => {
423
439
  // @ts-ignore
424
440
  if (typeof WorkerGlobalScope === 'undefined') {
425
441
  throw new TypeError('module is not in web worker scope');
426
442
  }
427
443
  return globalThis;
428
444
  };
429
- const signal$3 = global => {
445
+ const signal$2 = global => {
430
446
  global.postMessage(readyMessage);
431
447
  };
432
448
  class IpcChildWithModuleWorker extends Ipc {
@@ -452,7 +468,7 @@ class IpcChildWithModuleWorker extends Ipc {
452
468
  this._rawIpc.addEventListener('message', callback);
453
469
  }
454
470
  }
455
- const wrap$6 = global => {
471
+ const wrap$5 = global => {
456
472
  return new IpcChildWithModuleWorker(global);
457
473
  };
458
474
  const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
@@ -570,10 +586,10 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
570
586
  };
571
587
  const normalizeLine$1 = line => {
572
588
  if (line.startsWith('Error: ')) {
573
- return line.slice(`Error: `.length);
589
+ return line.slice('Error: '.length);
574
590
  }
575
591
  if (line.startsWith('VError: ')) {
576
- return line.slice(`VError: `.length);
592
+ return line.slice('VError: '.length);
577
593
  }
578
594
  return line;
579
595
  };
@@ -671,10 +687,10 @@ const waitForFirstMessage = async port => {
671
687
  // @ts-ignore
672
688
  return event.data;
673
689
  };
674
- const listen$3 = async () => {
675
- const parentIpcRaw = listen$4();
676
- signal$3(parentIpcRaw);
677
- const parentIpc = wrap$6(parentIpcRaw);
690
+ const listen$1$1 = async () => {
691
+ const parentIpcRaw = listen$2();
692
+ signal$2(parentIpcRaw);
693
+ const parentIpc = wrap$5(parentIpcRaw);
678
694
  const firstMessage = await waitForFirstMessage(parentIpc);
679
695
  if (firstMessage.method !== 'initialize') {
680
696
  throw new IpcError('unexpected first message');
@@ -719,19 +735,28 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
719
735
  this._rawIpc.start();
720
736
  }
721
737
  }
722
- const wrap$5 = port => {
738
+ const wrap$4 = port => {
723
739
  return new IpcChildWithModuleWorkerAndMessagePort(port);
724
740
  };
725
741
  const IpcChildWithModuleWorkerAndMessagePort$1 = {
726
742
  __proto__: null,
727
- listen: listen$3,
728
- wrap: wrap$5
743
+ listen: listen$1$1,
744
+ wrap: wrap$4
729
745
  };
730
746
 
731
747
  const createRpc = ipc => {
732
748
  const rpc = {
749
+ /**
750
+ * @deprecated
751
+ */
752
+ send(method, ...params) {
753
+ send(ipc, method, ...params);
754
+ },
733
755
  invoke(method, ...params) {
734
756
  return invoke$2(ipc, method, ...params);
757
+ },
758
+ invokeAndTransfer(method, ...params) {
759
+ return invokeAndTransfer(ipc, method, ...params);
735
760
  }
736
761
  };
737
762
  return rpc;
@@ -759,7 +784,7 @@ const listen$1 = async () => {
759
784
  const ipc = module.wrap(rawIpc);
760
785
  return ipc;
761
786
  };
762
- const create$2 = async ({
787
+ const create$1$1 = async ({
763
788
  commandMap
764
789
  }) => {
765
790
  // TODO create a commandMap per rpc instance
@@ -771,7 +796,7 @@ const create$2 = async ({
771
796
  };
772
797
  const WebWorkerRpcClient = {
773
798
  __proto__: null,
774
- create: create$2
799
+ create: create$1$1
775
800
  };
776
801
 
777
802
  const clearSearchResults$1 = state => {
@@ -903,7 +928,8 @@ const create = (uid, x, y, width, height, workspacePath, assetDir) => {
903
928
  focused: false,
904
929
  focusedIndex: -1,
905
930
  handleOffset: 0,
906
- focusSource: User
931
+ focusSource: User,
932
+ preserveCase: false
907
933
  };
908
934
  set(uid, state, state);
909
935
  return state;
@@ -1015,17 +1041,27 @@ const UiStrings = {
1015
1041
  ManyResultsInManyFiles: '{PH1} results in {PH2} files',
1016
1042
  ReplaceAll: 'Replace All',
1017
1043
  Replace: 'Replace',
1044
+ ConfirmReplaceAll: 'Replace All?',
1018
1045
  ConfirmReplaceOneOccurrenceInOneFile: "Replace 1 occurrence across 1 file with '{PH1}'",
1019
1046
  ConfirmReplaceOneOccurrenceInOneFileNoValue: 'Replace 1 occurrence across 1 file',
1020
1047
  ConfirmReplaceManyOccurrencesInOneFile: "Replace {PH1} occurrences across 1 file with '{PH2}'",
1021
1048
  ConfirmReplaceManyOccurrencesInOneFileNoValue: 'Replace {PH1} occurrences across 1 file',
1022
1049
  ConfirmReplaceManyOccurrencesInManyFiles: "Replace {PH1} occurrences across {PH2} files with '{PH3}'",
1023
1050
  ConfirmReplaceManyOccurrencesInManyFilesNoValue: 'Replace {PH1} occurrences across {PH2} files',
1051
+ ReplacedOneOccurrenceInOneFile: "Replaced 1 occurrence across 1 file with '{PH1}'",
1052
+ ReplacedManyOccurrencesInOneFile: "Replaced {PH1} occurrences across 1 file with '{PH2}'",
1053
+ ReplacedManyOccurrencesInManyFiles: "Replaced {PH1} occurrences across {PH2} files with '{PH3}'",
1054
+ CopyPath: 'Copy Path',
1055
+ Dismiss: 'Dismiss',
1024
1056
  Refresh: 'Refresh',
1025
1057
  ClearSearchResults: 'Clear Search Results',
1026
1058
  OpenNewSearchEditor: 'Open New Search Editor',
1027
1059
  ViewAsTree: 'View as Tree',
1028
- CollapseAll: 'Collapse All'
1060
+ CollapseAll: 'Collapse All',
1061
+ ToggleReplace: 'Toggle Replace',
1062
+ MatchCase: 'Match Case',
1063
+ MatchWholeWord: 'Match Whole Word',
1064
+ UseRegularExpression: 'Use Regular Expression'
1029
1065
  };
1030
1066
  const noResults = () => {
1031
1067
  return i18nString(UiStrings.NoResults);
@@ -1033,6 +1069,18 @@ const noResults = () => {
1033
1069
  const oneResult = () => {
1034
1070
  return i18nString(UiStrings.Oneresult);
1035
1071
  };
1072
+ const toggleReplace$1 = () => {
1073
+ return i18nString(UiStrings.ToggleReplace);
1074
+ };
1075
+ const matchCase = () => {
1076
+ return i18nString(UiStrings.MatchCase);
1077
+ };
1078
+ const matchWholeWord = () => {
1079
+ return i18nString(UiStrings.MatchWholeWord);
1080
+ };
1081
+ const useRegularExpression = () => {
1082
+ return i18nString(UiStrings.UseRegularExpression);
1083
+ };
1036
1084
  const manyResultsInOneFile = resultCount => {
1037
1085
  return i18nString(UiStrings.ManyResultsInOneFile, {
1038
1086
  PH1: resultCount
@@ -1588,7 +1636,7 @@ const text = data => {
1588
1636
  };
1589
1637
  };
1590
1638
 
1591
- const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, useRegularExpression, detailsExpanded) => {
1639
+ const getSearchHeaderVirtualDom = (replaceExpanded, matchCase$1, matchWholeWord$1, useRegularExpression$1, detailsExpanded) => {
1592
1640
  const dom = [{
1593
1641
  type: Div,
1594
1642
  className: SearchHeader,
@@ -1604,8 +1652,8 @@ const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, u
1604
1652
  }, {
1605
1653
  type: Button,
1606
1654
  className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
1607
- title: 'Toggle Replace',
1608
- ariaLabel: 'Toggle Replace',
1655
+ title: toggleReplace$1(),
1656
+ ariaLabel: toggleReplace$1(),
1609
1657
  ariaExpanded: replaceExpanded,
1610
1658
  childCount: 1,
1611
1659
  'data-command': 'toggleReplace'
@@ -1620,16 +1668,16 @@ const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, u
1620
1668
  childCount: replaceExpanded ? 2 : 1
1621
1669
  }, ...getSearchFieldVirtualDom('search-value', 'Search', 'handleInput', [{
1622
1670
  icon: 'MaskIconCaseSensitive',
1623
- checked: matchCase,
1624
- title: 'Match Case'
1671
+ checked: matchCase$1,
1672
+ title: matchCase()
1625
1673
  }, {
1626
1674
  icon: 'MaskIconWholeWord',
1627
- checked: matchWholeWord,
1628
- title: 'Match Whole Word'
1675
+ checked: matchWholeWord$1,
1676
+ title: matchWholeWord()
1629
1677
  }, {
1630
1678
  icon: 'MaskIconRegex',
1631
- checked: useRegularExpression,
1632
- title: 'Use Regular Expression'
1679
+ checked: useRegularExpression$1,
1680
+ title: useRegularExpression()
1633
1681
  }], [])];
1634
1682
  if (replaceExpanded) {
1635
1683
  dom.push(...getSearchFieldVirtualDom('search-replace-value', 'Replace', 'handleReplaceInput', [{
@@ -2335,7 +2383,11 @@ replaceTraps(oldTraps => ({
2335
2383
  }));
2336
2384
 
2337
2385
  const state = {
2338
- dbVersion: 1};
2386
+ databases: Object.create(null),
2387
+ eventId: 0,
2388
+ dbVersion: 1,
2389
+ cachedDb: undefined
2390
+ };
2339
2391
 
2340
2392
  // TODO high memory usage in idb because of transactionDoneMap
2341
2393
 
@@ -2635,6 +2687,13 @@ const handleInput = (state, value, inputSource = Script) => {
2635
2687
  });
2636
2688
  };
2637
2689
 
2690
+ const handleReplaceInput = (state, value, inputSource = Script) => {
2691
+ return handleUpdate(state, {
2692
+ replacement: value,
2693
+ inputSource
2694
+ });
2695
+ };
2696
+
2638
2697
  const first = () => {
2639
2698
  return 0;
2640
2699
  };
@@ -3061,46 +3120,6 @@ const doRender = uid => {
3061
3120
  return commands;
3062
3121
  };
3063
3122
 
3064
- const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
3065
- if (matchCount === 1) {
3066
- if (replacement) {
3067
- return confirmReplaceOneOccurrenceInOneFile(replacement);
3068
- }
3069
- return confirmReplaceOneOccurrenceInOneFileNoValue();
3070
- }
3071
- if (fileCount === 1) {
3072
- if (replacement) {
3073
- return confirmReplaceManyOccurrencesInOneFile(matchCount, replacement);
3074
- }
3075
- return confirmReplaceManyOccurrencesInOneFileNoValue(matchCount);
3076
- }
3077
- if (replacement) {
3078
- return confirmReplaceManyOccurrencesInManyFiles(matchCount, fileCount, replacement);
3079
- }
3080
- return confirmReplaceManyOccurrencesInManyFilesNoValue(matchCount, fileCount);
3081
- };
3082
-
3083
- const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount, fileCount) => {
3084
- string(workspacePath);
3085
- array(items);
3086
- string(replacement);
3087
- number(matchCount);
3088
- number(fileCount);
3089
- const confirmTitle = replaceAll$1();
3090
- const confirmAccept = replace();
3091
- const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
3092
- const shouldReplace = await invoke$1('ConfirmPrompt.prompt', confirmText, {
3093
- title: confirmTitle,
3094
- confirmMessage: confirmAccept
3095
- });
3096
- if (!shouldReplace) {
3097
- return false;
3098
- }
3099
- // TODO
3100
- // await TextSearchReplaceAll.replaceAll(workspacePath, items, replacement)
3101
- return true;
3102
- };
3103
-
3104
3123
  const getBulkReplacementEdits = (workspacePath, matches) => {
3105
3124
  string(workspacePath);
3106
3125
  array(matches);
@@ -3141,6 +3160,46 @@ const replaceAll = async (workspacePath, items, replacement) => {
3141
3160
  await invoke$1('BulkReplacement.applyBulkReplacement', files, ranges, replacement);
3142
3161
  };
3143
3162
 
3163
+ const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
3164
+ if (matchCount === 1) {
3165
+ if (replacement) {
3166
+ return confirmReplaceOneOccurrenceInOneFile(replacement);
3167
+ }
3168
+ return confirmReplaceOneOccurrenceInOneFileNoValue();
3169
+ }
3170
+ if (fileCount === 1) {
3171
+ if (replacement) {
3172
+ return confirmReplaceManyOccurrencesInOneFile(matchCount, replacement);
3173
+ }
3174
+ return confirmReplaceManyOccurrencesInOneFileNoValue(matchCount);
3175
+ }
3176
+ if (replacement) {
3177
+ return confirmReplaceManyOccurrencesInManyFiles(matchCount, fileCount, replacement);
3178
+ }
3179
+ return confirmReplaceManyOccurrencesInManyFilesNoValue(matchCount, fileCount);
3180
+ };
3181
+
3182
+ const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount, fileCount) => {
3183
+ string(workspacePath);
3184
+ array(items);
3185
+ string(replacement);
3186
+ number(matchCount);
3187
+ number(fileCount);
3188
+ const confirmTitle = replaceAll$1();
3189
+ const confirmAccept = replace();
3190
+ const confirmText = getReplaceAllConfirmText(matchCount, fileCount, replacement);
3191
+ const shouldReplace = await invoke$1('ConfirmPrompt.prompt', confirmText, {
3192
+ title: confirmTitle,
3193
+ confirmMessage: confirmAccept
3194
+ });
3195
+ if (!shouldReplace) {
3196
+ return false;
3197
+ }
3198
+ // TODO
3199
+ // await TextSearchReplaceAll.replaceAll(workspacePath, items, replacement)
3200
+ return true;
3201
+ };
3202
+
3144
3203
  const saveState = uid => {
3145
3204
  const {
3146
3205
  newState
@@ -3155,6 +3214,14 @@ const saveState = uid => {
3155
3214
  };
3156
3215
  };
3157
3216
 
3217
+ const focusElement = (state, focusKey) => {
3218
+ return {
3219
+ ...state,
3220
+ focus: focusKey,
3221
+ focusSource: Script
3222
+ };
3223
+ };
3224
+
3158
3225
  const setFocus = async focusKey => {
3159
3226
  await invoke$1('Focus.setFocus', focusKey);
3160
3227
  };
@@ -3181,11 +3248,7 @@ const getSearchFocusKey = key => {
3181
3248
  };
3182
3249
 
3183
3250
  const focusSearchValue = state => {
3184
- return {
3185
- ...state,
3186
- focus: FocusSearchInput,
3187
- focusSource: Script
3188
- };
3251
+ return focusElement(state, FocusSearchInput);
3189
3252
  };
3190
3253
  const focusMatchCasePrevious = state => {
3191
3254
  const {
@@ -3203,50 +3266,26 @@ const focusRegexNext = state => {
3203
3266
  return focusPreserveCase(state);
3204
3267
  };
3205
3268
  const focusReplaceValue = state => {
3206
- return {
3207
- ...state,
3208
- focus: FocusSearchReplaceInput,
3209
- focusSource: Script
3210
- };
3269
+ return focusElement(state, FocusSearchReplaceInput);
3211
3270
  };
3212
3271
  const focusMatchCase = state => {
3213
- return {
3214
- ...state,
3215
- focus: FocusSearchMatchCase,
3216
- focusSource: Script
3217
- };
3272
+ return focusElement(state, FocusSearchMatchCase);
3218
3273
  };
3219
3274
  const focusPreserveCase = state => {
3220
- return {
3221
- ...state,
3222
- focus: FocusSearchPreserveCase,
3223
- focusSource: Script
3224
- };
3275
+ return focusElement(state, FocusSearchPreserveCase);
3225
3276
  };
3226
3277
  const focusMatchWholeWord = state => {
3227
- return {
3228
- ...state,
3229
- focus: FocusSearchWholeWord,
3230
- focusSource: Script
3231
- };
3278
+ return focusElement(state, FocusSearchWholeWord);
3232
3279
  };
3233
3280
  const focusRegex = state => {
3234
- return {
3235
- ...state,
3236
- focus: FocusSearchRegex,
3237
- focusSource: Script
3238
- };
3281
+ return focusElement(state, FocusSearchRegex);
3239
3282
  };
3240
3283
  const focusReplaceAll = state => {
3241
- return {
3242
- ...state,
3243
- focus: FocusSearchReplaceAll,
3244
- focusSource: Script
3245
- };
3284
+ return focusElement(state, FocusSearchReplaceAll);
3246
3285
  };
3247
3286
  const handleFocusIn = (state, key) => {
3248
- const focusKey = getSearchFocusKey(key);
3249
- if (state.focus === focusKey) {
3287
+ const focusKey = getSearchFocusKey(key.dataset.focusKey);
3288
+ if (focusKey === state.focus) {
3250
3289
  return state;
3251
3290
  }
3252
3291
  void setFocus(focusKey);
@@ -3264,6 +3303,36 @@ const submit = state => {
3264
3303
  });
3265
3304
  };
3266
3305
 
3306
+ const toggleMatchCase = state => {
3307
+ const {
3308
+ matchCase
3309
+ } = state;
3310
+ return {
3311
+ ...state,
3312
+ matchCase: !matchCase
3313
+ };
3314
+ };
3315
+
3316
+ const toggleMatchWholeWord = state => {
3317
+ const {
3318
+ matchWholeWord
3319
+ } = state;
3320
+ return {
3321
+ ...state,
3322
+ matchWholeWord: !matchWholeWord
3323
+ };
3324
+ };
3325
+
3326
+ const togglePreserveCase = state => {
3327
+ const {
3328
+ preserveCase
3329
+ } = state;
3330
+ return {
3331
+ ...state,
3332
+ preserveCase: !preserveCase
3333
+ };
3334
+ };
3335
+
3267
3336
  const toggleReplace = state => {
3268
3337
  const {
3269
3338
  replaceExpanded
@@ -3274,6 +3343,16 @@ const toggleReplace = state => {
3274
3343
  };
3275
3344
  };
3276
3345
 
3346
+ const toggleUseRegularExpression = state => {
3347
+ const {
3348
+ useRegularExpression
3349
+ } = state;
3350
+ return {
3351
+ ...state,
3352
+ useRegularExpression: !useRegularExpression
3353
+ };
3354
+ };
3355
+
3277
3356
  const Keyboard = -1;
3278
3357
 
3279
3358
  const show = async (x, y, id, ...args) => {
@@ -3350,16 +3429,21 @@ const commandMap = {
3350
3429
  'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
3351
3430
  'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
3352
3431
  'TextSearch.handleInput': wrapCommand(handleInput),
3432
+ 'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
3353
3433
  'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3354
3434
  'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3355
3435
  'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
3356
3436
  'TextSearch.handleWheel': wrapCommand(handleWheel),
3357
3437
  'TextSearch.loadContent': wrapCommand(loadContent),
3358
3438
  'TextSearch.refresh': wrapCommand(refresh),
3359
- 'TextSearch.replaceAllAndPrompt': wrapCommand(replaceAllAndPrompt),
3360
3439
  'TextSearch.replaceAll': wrapCommand(replaceAll),
3440
+ 'TextSearch.replaceAllAndPrompt': wrapCommand(replaceAllAndPrompt),
3361
3441
  'TextSearch.submit': wrapCommand(submit),
3442
+ 'TextSearch.toggleMatchCase': wrapCommand(toggleMatchCase),
3443
+ 'TextSearch.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
3444
+ 'TextSearch.togglePreserveCase': wrapCommand(togglePreserveCase),
3362
3445
  'TextSearch.toggleReplace': wrapCommand(toggleReplace),
3446
+ 'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
3363
3447
  // not wrapped
3364
3448
  'TextSearch.create': create,
3365
3449
  'TextSearch.render': doRender,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Text Search Worker",
5
5
  "main": "dist/textSearchWorkerMain.js",
6
6
  "type": "module",