@lvce-editor/text-search-worker 1.4.0 → 2.1.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.
@@ -18,6 +18,577 @@ const execute = (command, ...args) => {
18
18
  return fn(...args);
19
19
  };
20
20
 
21
+ const FocusSearchInput = 21;
22
+ const FocusSearchReplaceInput = 31;
23
+ const FocusSearchMatchCase = 32;
24
+ const FocusSearchRegex = 33;
25
+ const FocusSearchWholeWord = 34;
26
+ const FocusSearchReplaceAll = 35;
27
+ const FocusSearchPreserveCase = 36;
28
+
29
+ const focusMatchCase$1 = state => {
30
+ return {
31
+ ...state,
32
+ focus: FocusSearchMatchCase
33
+ };
34
+ };
35
+
36
+ const focusReplaceValue$1 = state => {
37
+ return {
38
+ ...state,
39
+ focus: FocusSearchReplaceInput
40
+ };
41
+ };
42
+
43
+ const focusSearchValue$1 = state => {
44
+ return {
45
+ ...state,
46
+ focus: FocusSearchInput
47
+ };
48
+ };
49
+
50
+ const focusSearchValueNext$1 = state => {
51
+ const {
52
+ replaceExpanded
53
+ } = state;
54
+ if (replaceExpanded) {
55
+ return focusReplaceValue$1(state);
56
+ }
57
+ return focusMatchCase$1(state);
58
+ };
59
+
60
+ const CheckBox = 'checkbox';
61
+ const None = 'none';
62
+ const Status = 'status';
63
+ const Tree = 'tree';
64
+ const TreeItem$1 = 'treeitem';
65
+ const ToolBar = 'toolbar';
66
+
67
+ const Chevron = 'Chevron';
68
+ const CloseMaskIcon = 'MaskIcon MaskIconClose';
69
+ const Empty = '';
70
+ const FileIcon = 'FileIcon';
71
+ const IconButton = 'IconButton';
72
+ const Actions = 'Actions';
73
+ const FocusOutline = 'FocusOutline';
74
+ const Highlight = 'Highlight';
75
+ const HighlightDeleted = 'HighlightDeleted';
76
+ const HighlightInserted = 'HighlightInserted';
77
+ const Label = 'Label';
78
+ const List = 'List';
79
+ const MaskIcon = 'MaskIcon';
80
+ const MaskIconChevronDown = 'MaskIconChevronDown';
81
+ const MaskIconChevronRight = 'MaskIconChevronRight';
82
+ const MultilineInputBox = 'MultilineInputBox';
83
+ const Search = 'Search';
84
+ const SearchField = 'SearchField';
85
+ const SearchFieldButtons = 'SearchFieldButtons';
86
+ const SearchFieldContainer = 'SearchFieldContainer';
87
+ const SearchHeader = 'SearchHeader';
88
+ const SearchHeaderTop = 'SearchHeaderTop';
89
+ const SearchRemove = 'SearchRemove';
90
+ const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
91
+ const SourceControlBadge = 'SourceControlBadge';
92
+ const TreeItem = 'TreeItem';
93
+ const TreeItemActive = 'TreeItemActive';
94
+ const Viewlet = 'Viewlet';
95
+ const ViewletSearchMessage = 'ViewletSearchMessage';
96
+
97
+ const Button$1 = 1;
98
+
99
+ const Button = 1;
100
+ const Div = 4;
101
+ const Input = 6;
102
+ const Span = 8;
103
+ const Text = 12;
104
+ const Img = 17;
105
+ const Ins = 20;
106
+ const Del = 21;
107
+ const TextArea = 62;
108
+
109
+ const getIconVirtualDom = (icon, type = Div) => {
110
+ return {
111
+ type,
112
+ className: `MaskIcon MaskIcon${icon}`,
113
+ role: None,
114
+ childCount: 0
115
+ };
116
+ };
117
+
118
+ const getActionButtonVirtualDom = action => {
119
+ const {
120
+ id,
121
+ icon,
122
+ command
123
+ } = action;
124
+ return [{
125
+ type: Button,
126
+ className: IconButton,
127
+ title: id,
128
+ 'data-command': command,
129
+ childCount: 1
130
+ }, getIconVirtualDom(icon)];
131
+ };
132
+
133
+ const getActionVirtualDom = action => {
134
+ switch (action.type) {
135
+ case Button$1:
136
+ return getActionButtonVirtualDom(action);
137
+ default:
138
+ return [];
139
+ }
140
+ };
141
+
142
+ const getActionsVirtualDom = actions => {
143
+ return [{
144
+ type: Div,
145
+ className: Actions,
146
+ role: ToolBar,
147
+ childCount: actions.length
148
+ }, ...actions.flatMap(getActionVirtualDom)];
149
+ };
150
+
151
+ const ClearAll = 'ClearAll';
152
+ const CollapseAll = 'CollapseAll';
153
+ const ListFlat = 'ListFlat';
154
+ const NewFile = 'NewFile';
155
+ const Refresh = 'Refresh';
156
+
157
+ let AssertionError$1 = class AssertionError extends Error {
158
+ constructor(message) {
159
+ super(message);
160
+ this.name = 'AssertionError';
161
+ }
162
+ };
163
+ const getType$1 = value => {
164
+ switch (typeof value) {
165
+ case 'number':
166
+ return 'number';
167
+ case 'function':
168
+ return 'function';
169
+ case 'string':
170
+ return 'string';
171
+ case 'object':
172
+ if (value === null) {
173
+ return 'null';
174
+ }
175
+ if (Array.isArray(value)) {
176
+ return 'array';
177
+ }
178
+ return 'object';
179
+ case 'boolean':
180
+ return 'boolean';
181
+ default:
182
+ return 'unknown';
183
+ }
184
+ };
185
+ const string = value => {
186
+ const type = getType$1(value);
187
+ if (type !== 'string') {
188
+ throw new AssertionError$1('expected value to be of type string');
189
+ }
190
+ };
191
+
192
+ const emptyObject = {};
193
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
194
+ const i18nString = (key, placeholders = emptyObject) => {
195
+ if (placeholders === emptyObject) {
196
+ return key;
197
+ }
198
+ const replacer = (match, rest) => {
199
+ // @ts-ignore
200
+ return placeholders[rest];
201
+ };
202
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
203
+ };
204
+
205
+ /**
206
+ * @enum {string}
207
+ */
208
+ const UiStrings = {
209
+ NoResults: 'No results found',
210
+ Oneresult: '1 result in 1 file',
211
+ ManyResultsInOneFile: '{PH1} results in 1 file',
212
+ ManyResultsInManyFiles: '{PH1} results in {PH2} files',
213
+ ReplaceAll: 'Replace All',
214
+ Replace: 'Replace',
215
+ ConfirmReplaceAll: 'Replace All?',
216
+ ConfirmReplaceOneOccurrenceInOneFile: "Replace 1 occurrence across 1 file with '{PH1}'",
217
+ ConfirmReplaceOneOccurrenceInOneFileNoValue: 'Replace 1 occurrence across 1 file',
218
+ ConfirmReplaceManyOccurrencesInOneFile: "Replace {PH1} occurrences across 1 file with '{PH2}'",
219
+ ConfirmReplaceManyOccurrencesInOneFileNoValue: 'Replace {PH1} occurrences across 1 file',
220
+ ConfirmReplaceManyOccurrencesInManyFiles: "Replace {PH1} occurrences across {PH2} files with '{PH3}'",
221
+ ConfirmReplaceManyOccurrencesInManyFilesNoValue: 'Replace {PH1} occurrences across {PH2} files',
222
+ ReplacedOneOccurrenceInOneFile: "Replaced 1 occurrence across 1 file with '{PH1}'",
223
+ ReplacedManyOccurrencesInOneFile: "Replaced {PH1} occurrences across 1 file with '{PH2}'",
224
+ ReplacedManyOccurrencesInManyFiles: "Replaced {PH1} occurrences across {PH2} files with '{PH3}'",
225
+ CopyPath: 'Copy Path',
226
+ Dismiss: 'Dismiss',
227
+ Refresh: 'Refresh',
228
+ ClearSearchResults: 'Clear Search Results',
229
+ OpenNewSearchEditor: 'Open New Search Editor',
230
+ ViewAsTree: 'View as Tree',
231
+ CollapseAll: 'Collapse All'
232
+ };
233
+ const refresh = () => {
234
+ return i18nString(UiStrings.Refresh);
235
+ };
236
+ const clearSearchResults = () => {
237
+ return i18nString(UiStrings.ClearSearchResults);
238
+ };
239
+ const openNewSearchEditor = () => {
240
+ return i18nString(UiStrings.OpenNewSearchEditor);
241
+ };
242
+ const viewAsTree = () => {
243
+ return i18nString(UiStrings.ViewAsTree);
244
+ };
245
+ const collapseAll = () => {
246
+ return i18nString(UiStrings.CollapseAll);
247
+ };
248
+
249
+ const getActions = () => {
250
+ return [{
251
+ type: Button$1,
252
+ id: refresh(),
253
+ icon: Refresh,
254
+ command: 'refresh'
255
+ }, {
256
+ type: Button$1,
257
+ id: clearSearchResults(),
258
+ icon: ClearAll,
259
+ command: 'clearSearchResults'
260
+ }, {
261
+ type: Button$1,
262
+ id: openNewSearchEditor(),
263
+ icon: NewFile,
264
+ command: ''
265
+ }, {
266
+ type: Button$1,
267
+ id: viewAsTree(),
268
+ icon: ListFlat,
269
+ command: ''
270
+ }, {
271
+ type: Button$1,
272
+ id: collapseAll(),
273
+ icon: CollapseAll,
274
+ command: ''
275
+ }];
276
+ };
277
+
278
+ const HandleClick = 'handleClick';
279
+ const HandleHeaderClick = 'handleHeaderClick';
280
+ const HandleHeaderFocusIn = 'handleHeaderFocusIn';
281
+ const HandleListBlur = 'handleListBlur';
282
+
283
+ const getSearchFieldButtonVirtualDom = button => {
284
+ const {
285
+ icon,
286
+ checked,
287
+ title
288
+ } = button;
289
+ return [{
290
+ type: Div,
291
+ className: `SearchFieldButton ${checked ? 'SearchFieldButtonChecked' : ''}`,
292
+ title,
293
+ role: CheckBox,
294
+ ariaChecked: checked,
295
+ tabIndex: 0,
296
+ childCount: 1
297
+ }, {
298
+ type: Div,
299
+ className: `MaskIcon ${icon}`,
300
+ childCount: 0
301
+ }];
302
+ };
303
+
304
+ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '') => {
305
+ const dom = [{
306
+ type: Div,
307
+ className: SearchField,
308
+ role: None,
309
+ childCount: 2
310
+ }, {
311
+ type: TextArea,
312
+ className: MultilineInputBox,
313
+ spellcheck: false,
314
+ autocapitalize: 'off',
315
+ autocorrect: 'off',
316
+ placeholder,
317
+ name,
318
+ onInput,
319
+ onFocus,
320
+ childCount: 0
321
+ }, {
322
+ type: Div,
323
+ className: SearchFieldButtons,
324
+ childCount: insideButtons.length
325
+ }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
326
+ if (outsideButtons.length > 0) {
327
+ dom.unshift({
328
+ type: Div,
329
+ className: SearchFieldContainer,
330
+ role: None,
331
+ childCount: 1 + outsideButtons.length
332
+ });
333
+ dom.push(...outsideButtons.flatMap(getSearchFieldButtonVirtualDom));
334
+ }
335
+ return dom;
336
+ };
337
+
338
+ const text = data => {
339
+ return {
340
+ type: Text,
341
+ text: data,
342
+ childCount: 0
343
+ };
344
+ };
345
+
346
+ const getSearchHeaderVirtualDom = (replaceExpanded, matchCase, matchWholeWord, useRegularExpression, detailsExpanded) => {
347
+ const dom = [{
348
+ type: Div,
349
+ className: SearchHeader,
350
+ role: None,
351
+ childCount: 2,
352
+ onClick: HandleHeaderClick,
353
+ onFocusIn: HandleHeaderFocusIn
354
+ }, {
355
+ type: Div,
356
+ className: SearchHeaderTop,
357
+ role: None,
358
+ childCount: 2
359
+ }, {
360
+ type: Button,
361
+ className: `IconButton SearchToggleButton ${replaceExpanded ? SearchToggleButtonExpanded : ''}`,
362
+ title: 'Toggle Replace',
363
+ ariaLabel: 'Toggle Replace',
364
+ ariaExpanded: replaceExpanded,
365
+ childCount: 1,
366
+ 'data-command': 'toggleReplace'
367
+ }, {
368
+ type: Div,
369
+ className: `${MaskIcon} ${replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight}`,
370
+ childCount: 0
371
+ }, {
372
+ type: Div,
373
+ className: 'SearchHeaderTopRight',
374
+ role: None,
375
+ childCount: replaceExpanded ? 2 : 1
376
+ }, ...getSearchFieldVirtualDom('search-value', 'Search', 'handleInput', [{
377
+ icon: 'MaskIconCaseSensitive',
378
+ checked: matchCase,
379
+ title: 'Match Case'
380
+ }, {
381
+ icon: 'MaskIconWholeWord',
382
+ checked: matchWholeWord,
383
+ title: 'Match Whole Word'
384
+ }, {
385
+ icon: 'MaskIconRegex',
386
+ checked: useRegularExpression,
387
+ title: 'Use Regular Expression'
388
+ }], [])];
389
+ if (replaceExpanded) {
390
+ dom.push(...getSearchFieldVirtualDom('search-replace-value', 'Replace', 'handleReplaceInput', [{
391
+ icon: 'MaskIconPreserveCase',
392
+ checked: false,
393
+ title: 'Preserve Case'
394
+ }], [{
395
+ icon: 'MaskIconReplaceAll',
396
+ checked: false,
397
+ title: 'Replace All'
398
+ }]));
399
+ }
400
+ if (detailsExpanded) {
401
+ console.log({
402
+ detailsExpanded
403
+ });
404
+ dom[0].childCount++;
405
+ dom.push({
406
+ type: Div,
407
+ className: 'SearchHeaderDetails',
408
+ childCount: 4
409
+ }, text('files to include'), {
410
+ type: Input,
411
+ childCount: 0
412
+ }, text('files to exclude'), {
413
+ type: Input,
414
+ childCount: 0
415
+ });
416
+ }
417
+ return dom;
418
+ };
419
+
420
+ const getBadgeVirtualDom = (className, count) => {
421
+ return [{
422
+ type: Div,
423
+ className: `Badge ${className}`,
424
+ childCount: 1
425
+ }, text(`${count}`)];
426
+ };
427
+
428
+ const getChevronDownVirtualDom = (extraClassName = '') => {
429
+ return {
430
+ type: Div,
431
+ className: `${Chevron} MaskIconChevronDown ${extraClassName}`,
432
+ childCount: 0
433
+ };
434
+ };
435
+
436
+ const getFileIconVirtualDom = icon => {
437
+ return {
438
+ type: Img,
439
+ className: FileIcon,
440
+ src: icon,
441
+ role: None,
442
+ childCount: 0
443
+ };
444
+ };
445
+
446
+ const File$1 = 1;
447
+ const Match = 2;
448
+
449
+ const PaddingRight = '12px';
450
+
451
+ const deleted = {
452
+ type: Del,
453
+ className: HighlightDeleted,
454
+ childCount: 1
455
+ };
456
+ const inserted = {
457
+ type: Ins,
458
+ className: HighlightInserted,
459
+ childCount: 1
460
+ };
461
+ const highlighted = {
462
+ type: Span,
463
+ className: Highlight,
464
+ childCount: 1
465
+ };
466
+ const getLabelVirtualDom = (displayText, matchLength, matchStart, replacement) => {
467
+ const dom = [];
468
+ const label = {
469
+ type: Div,
470
+ className: Label + ' Grow',
471
+ childCount: 1
472
+ };
473
+ dom.push(label);
474
+ if (matchLength) {
475
+ const before = displayText.slice(0, matchStart);
476
+ const highlight = displayText.slice(matchStart, matchStart + matchLength);
477
+ const after = displayText.slice(matchStart + matchLength);
478
+ if (replacement) {
479
+ dom.push(text(before), deleted, text(highlight), inserted, text(replacement), text(after));
480
+ label.childCount = 4;
481
+ } else {
482
+ label.childCount = 3;
483
+ dom.push(text(before), highlighted, text(highlight), text(after));
484
+ }
485
+ } else {
486
+ dom.push(text(displayText));
487
+ }
488
+ return dom;
489
+ };
490
+ const renderRow = rowInfo => {
491
+ // @ts-ignore
492
+ const {
493
+ top,
494
+ type,
495
+ matchStart,
496
+ matchLength,
497
+ text: displayText,
498
+ title,
499
+ icon,
500
+ setSize,
501
+ posInSet,
502
+ depth,
503
+ replacement,
504
+ matchCount,
505
+ focused
506
+ } = rowInfo;
507
+ const treeItem = {
508
+ type: Div,
509
+ role: TreeItem$1,
510
+ className: TreeItem,
511
+ title,
512
+ ariaSetSize: setSize,
513
+ ariaLevel: depth,
514
+ ariaPosInSet: posInSet,
515
+ ariaLabel: title,
516
+ ariaDescription: '',
517
+ childCount: 1,
518
+ paddingLeft: `${Number(depth) + 1}rem`,
519
+ // TODO use classname and dynamic css
520
+ paddingRight: PaddingRight
521
+ };
522
+ if (focused) {
523
+ treeItem.className += ' ' + TreeItemActive;
524
+ }
525
+ switch (type) {
526
+ case File$1:
527
+ treeItem.ariaExpanded = 'true';
528
+ break;
529
+ }
530
+ const dom = [];
531
+ dom.push(treeItem);
532
+ if (type === File$1) {
533
+ treeItem.childCount += 2;
534
+ dom.push(getChevronDownVirtualDom(), getFileIconVirtualDom(icon));
535
+ }
536
+ dom.push(...getLabelVirtualDom(displayText, matchLength, matchStart, replacement));
537
+ if (matchCount) {
538
+ treeItem.childCount++;
539
+ dom.push(...getBadgeVirtualDom(SourceControlBadge, matchCount));
540
+ }
541
+ treeItem.childCount++;
542
+ dom.push({
543
+ type: Div,
544
+ className: SearchRemove,
545
+ childCount: 1
546
+ }, {
547
+ type: Div,
548
+ className: CloseMaskIcon,
549
+ childCount: 0
550
+ });
551
+ return dom;
552
+ };
553
+ const getSearchResultsVirtualDom = visibleItems => {
554
+ return visibleItems.flatMap(renderRow);
555
+ };
556
+
557
+ const mergeClassNames = (...classNames) => {
558
+ return classNames.filter(Boolean).join(' ');
559
+ };
560
+
561
+ const getSearchVirtualDom = (visibleItems, replaceExpanded, matchCase, matchWholeWord, useRegularExpression, message, detailsExpanded, focusOutline) => {
562
+ /**
563
+ * @type {any[]}
564
+ */
565
+ const dom = [];
566
+ dom.push({
567
+ type: Div,
568
+ className: mergeClassNames(Viewlet, Search),
569
+ childCount: 2
570
+ });
571
+ dom.push(...getSearchHeaderVirtualDom(replaceExpanded, matchCase, matchWholeWord, useRegularExpression, detailsExpanded));
572
+ dom.push({
573
+ type: Div,
574
+ className: ViewletSearchMessage,
575
+ role: Status,
576
+ tabIndex: 0,
577
+ childCount: 1
578
+ }, text(message));
579
+ dom.push({
580
+ type: Div,
581
+ className: mergeClassNames(Viewlet, List, focusOutline ? FocusOutline : Empty),
582
+ role: Tree,
583
+ tabIndex: 0,
584
+ childCount: visibleItems.length,
585
+ onClick: HandleClick,
586
+ onBlur: HandleListBlur
587
+ });
588
+ dom.push(...getSearchResultsVirtualDom(visibleItems));
589
+ return dom;
590
+ };
591
+
21
592
  const state$3 = {
22
593
  /**
23
594
  * @type {any}
@@ -32,13 +603,13 @@ const set$1 = ipc => {
32
603
  };
33
604
 
34
605
  const Two = '2.0';
35
- let AssertionError$1 = class AssertionError extends Error {
606
+ class AssertionError extends Error {
36
607
  constructor(message) {
37
608
  super(message);
38
609
  this.name = 'AssertionError';
39
610
  }
40
- };
41
- const getType$1 = value => {
611
+ }
612
+ const getType = value => {
42
613
  switch (typeof value) {
43
614
  case 'number':
44
615
  return 'number';
@@ -61,9 +632,9 @@ const getType$1 = value => {
61
632
  }
62
633
  };
63
634
  const number = value => {
64
- const type = getType$1(value);
635
+ const type = getType(value);
65
636
  if (type !== 'number') {
66
- throw new AssertionError$1('expected value to be of type number');
637
+ throw new AssertionError('expected value to be of type number');
67
638
  }
68
639
  };
69
640
  const state$1 = {
@@ -394,51 +965,43 @@ const listen$2 = ipc => {
394
965
  set$1(ipc);
395
966
  };
396
967
 
397
- const FocusSearchInput = 21;
398
- const FocusSearchReplaceInput = 31;
399
- const FocusSearchMatchCase = 32;
400
- const FocusSearchRegex = 33;
401
- const FocusSearchWholeWord = 34;
402
- const FocusSearchReplaceAll = 35;
403
- const FocusSearchPreserveCase = 36;
404
-
405
- const focusSearchValue$1 = state => {
968
+ const focusSearchValue = state => {
406
969
  return {
407
970
  ...state,
408
971
  focus: FocusSearchInput
409
972
  };
410
973
  };
411
- const focusSearchValueNext$1 = state => {
974
+ const focusSearchValueNext = state => {
412
975
  const {
413
976
  replaceExpanded
414
977
  } = state;
415
978
  if (replaceExpanded) {
416
- return focusReplaceValue$1(state);
979
+ return focusReplaceValue(state);
417
980
  }
418
- return focusMatchCase$1(state);
981
+ return focusMatchCase(state);
419
982
  };
420
983
  const focusMatchCasePrevious = state => {
421
984
  const {
422
985
  replaceExpanded
423
986
  } = state;
424
987
  if (replaceExpanded) {
425
- return focusReplaceValue$1(state);
988
+ return focusReplaceValue(state);
426
989
  }
427
- return focusSearchValue$1(state);
990
+ return focusSearchValue(state);
428
991
  };
429
992
  const focusReplaceValueNext = state => {
430
- return focusMatchCase$1(state);
993
+ return focusMatchCase(state);
431
994
  };
432
995
  const focusRegexNext = state => {
433
996
  return focusPreserveCase(state);
434
997
  };
435
- const focusReplaceValue$1 = state => {
998
+ const focusReplaceValue = state => {
436
999
  return {
437
1000
  ...state,
438
1001
  focus: FocusSearchReplaceInput
439
1002
  };
440
1003
  };
441
- const focusMatchCase$1 = state => {
1004
+ const focusMatchCase = state => {
442
1005
  return {
443
1006
  ...state,
444
1007
  focus: FocusSearchMatchCase
@@ -469,72 +1032,6 @@ const focusReplaceAll = state => {
469
1032
  };
470
1033
  };
471
1034
 
472
- const focusMatchCase = state => {
473
- return {
474
- ...state,
475
- focus: FocusSearchMatchCase
476
- };
477
- };
478
-
479
- const focusReplaceValue = state => {
480
- return {
481
- ...state,
482
- focus: FocusSearchReplaceInput
483
- };
484
- };
485
-
486
- const focusSearchValue = state => {
487
- return {
488
- ...state,
489
- focus: FocusSearchInput
490
- };
491
- };
492
-
493
- const focusSearchValueNext = state => {
494
- const {
495
- replaceExpanded
496
- } = state;
497
- if (replaceExpanded) {
498
- return focusReplaceValue(state);
499
- }
500
- return focusMatchCase(state);
501
- };
502
-
503
- class AssertionError extends Error {
504
- constructor(message) {
505
- super(message);
506
- this.name = 'AssertionError';
507
- }
508
- }
509
- const getType = value => {
510
- switch (typeof value) {
511
- case 'number':
512
- return 'number';
513
- case 'function':
514
- return 'function';
515
- case 'string':
516
- return 'string';
517
- case 'object':
518
- if (value === null) {
519
- return 'null';
520
- }
521
- if (Array.isArray(value)) {
522
- return 'array';
523
- }
524
- return 'object';
525
- case 'boolean':
526
- return 'boolean';
527
- default:
528
- return 'unknown';
529
- }
530
- };
531
- const string = value => {
532
- const type = getType(value);
533
- if (type !== 'string') {
534
- throw new AssertionError('expected value to be of type string');
535
- }
536
- };
537
-
538
1035
  const RE_PROTOCOL = /^([a-z\-]+):\/\//;
539
1036
  const getProtocol = uri => {
540
1037
  const protocolMatch = uri.match(RE_PROTOCOL);
@@ -637,9 +1134,6 @@ const splitLines$1 = lines => {
637
1134
  return lines.split('\n');
638
1135
  };
639
1136
 
640
- const File$1 = 1;
641
- const Match = 2;
642
-
643
1137
  const textSearchInFile$1 = (file, content, query) => {
644
1138
  const results = [];
645
1139
  const lines = splitLines$1(content);
@@ -1192,22 +1686,25 @@ const textSearch = async (root, query, options, assetDir) => {
1192
1686
  };
1193
1687
 
1194
1688
  const commandMap = {
1195
- 'TextSearch.focusMatchCase': focusMatchCase$1,
1689
+ 'SearchView.focusMatchCase': focusMatchCase$1,
1690
+ 'SearchView.focusReplaceValue': focusReplaceValue$1,
1691
+ 'SearchView.focusSearchValue': focusSearchValue$1,
1692
+ 'SearchView.focusSearchValueNext': focusSearchValueNext$1,
1693
+ 'TextSearch.focusMatchCase': focusMatchCase,
1196
1694
  'TextSearch.focusMatchCasePrevious': focusMatchCasePrevious,
1197
1695
  'TextSearch.focusMatchWholeWord': focusMatchWholeWord,
1198
1696
  'TextSearch.focusPreserveCase': focusPreserveCase,
1199
1697
  'TextSearch.focusRegex': focusRegex,
1200
1698
  'TextSearch.focusRegexNext': focusRegexNext,
1201
1699
  'TextSearch.focusReplaceAll': focusReplaceAll,
1202
- 'TextSearch.focusReplaceValue': focusReplaceValue$1,
1700
+ 'TextSearch.focusReplaceValue': focusReplaceValue,
1203
1701
  'TextSearch.focusReplaceValueNext': focusReplaceValueNext,
1204
- 'TextSearch.focusSearchValue': focusSearchValue$1,
1205
- 'TextSearch.focusSearchValueNext': focusSearchValueNext$1,
1206
- 'TextSearch.textSearch': textSearch,
1207
- 'SearchView.focusReplaceValue': focusReplaceValue,
1208
- 'SearchView.focusMatchCase': focusMatchCase,
1209
- 'SearchView.focusSearchValue': focusSearchValue,
1210
- 'SearchView.focusSearchValueNext': focusSearchValueNext
1702
+ 'TextSearch.focusSearchValue': focusSearchValue,
1703
+ 'TextSearch.focusSearchValueNext': focusSearchValueNext,
1704
+ 'TextSearch.getActions': getActions,
1705
+ 'TextSearch.getActionsVirtualDom': getActionsVirtualDom,
1706
+ 'TextSearch.getVirtualDom': getSearchVirtualDom,
1707
+ 'TextSearch.textSearch': textSearch
1211
1708
  };
1212
1709
 
1213
1710
  const requiresSocket = () => {
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "1.4.0",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "main": "dist/textSearchWorkerMain.js",
6
6
  "type": "module",
7
- "keywords": [],
8
- "author": "",
7
+ "keywords": [
8
+ "text-search"
9
+ ],
10
+ "author": "Lvce Editor",
9
11
  "license": "MIT"
10
12
  }