@lvce-editor/text-search-worker 4.12.0 → 5.0.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.
@@ -951,7 +951,7 @@ const send = (transport, method, ...params) => {
951
951
  const message = create$4$1(method, params);
952
952
  transport.send(message);
953
953
  };
954
- const invoke$4 = (ipc, method, ...params) => {
954
+ const invoke$2 = (ipc, method, ...params) => {
955
955
  return invokeHelper(ipc, method, params, false);
956
956
  };
957
957
  const invokeAndTransfer$1 = (ipc, method, ...params) => {
@@ -984,7 +984,7 @@ const createRpc = ipc => {
984
984
  send(ipc, method, ...params);
985
985
  },
986
986
  invoke(method, ...params) {
987
- return invoke$4(ipc, method, ...params);
987
+ return invoke$2(ipc, method, ...params);
988
988
  },
989
989
  invokeAndTransfer(method, ...params) {
990
990
  return invokeAndTransfer$1(ipc, method, ...params);
@@ -1175,13 +1175,16 @@ const create$3 = rpcId => {
1175
1175
  };
1176
1176
  const RendererWorker$1 = 1;
1177
1177
  const SearchProcess$1 = 77;
1178
+ const RpcId = {
1179
+ __proto__: null,
1180
+ SearchProcess: SearchProcess$1};
1178
1181
  const {
1179
- invoke: invoke$3,
1182
+ invoke: invoke$4,
1180
1183
  invokeAndTransfer: invokeAndTransfer$3,
1181
1184
  set: set$3} = create$3(RendererWorker$1);
1182
1185
  const RendererWorker = {
1183
1186
  __proto__: null,
1184
- invoke: invoke$3,
1187
+ invoke: invoke$4,
1185
1188
  invokeAndTransfer: invokeAndTransfer$3,
1186
1189
  set: set$3
1187
1190
  };
@@ -1193,7 +1196,7 @@ const SearchProcess = {
1193
1196
  };
1194
1197
 
1195
1198
  const {
1196
- invoke: invoke$2,
1199
+ invoke: invoke$1,
1197
1200
  invokeAndTransfer,
1198
1201
  set: set$2} = RendererWorker;
1199
1202
 
@@ -1206,7 +1209,7 @@ const copy = async state => {
1206
1209
  return state;
1207
1210
  }
1208
1211
  const item = items[listFocusedIndex];
1209
- await invoke$2('ClipBoard.writeText', item.text);
1212
+ await invoke$1('ClipBoard.writeText', item.text);
1210
1213
  return state;
1211
1214
  };
1212
1215
 
@@ -2007,7 +2010,7 @@ const handleUpdateError = async (state, update, error) => {
2007
2010
 
2008
2011
  const getFileIcon = async result => {
2009
2012
  if (result.type === File) {
2010
- return invoke$2('IconTheme.getFileIcon', {
2013
+ return invoke$1('IconTheme.getFileIcon', {
2011
2014
  name: result.text
2012
2015
  });
2013
2016
  }
@@ -2070,20 +2073,20 @@ const getScrollBarY$1 = getScrollBarOffset$1;
2070
2073
  const textSearch$6 = async (scheme, root, query) => {
2071
2074
  string(scheme);
2072
2075
  string(query);
2073
- const result = await invoke$2('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
2076
+ const result = await invoke$1('ExtensionHostTextSearch.executeTextSearchProvider', scheme, query);
2074
2077
  return result;
2075
2078
  };
2076
2079
 
2077
2080
  const textSearch$5 = async (scheme, root, query, options, assetDir) => {
2078
- return invoke$2('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
2081
+ return invoke$1('ExtensionHostTextSearch.textSearchFetch', scheme, root, query, options, assetDir);
2079
2082
  };
2080
2083
 
2081
2084
  const textSearch$4 = async (scheme, root, query) => {
2082
- return invoke$2('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
2085
+ return invoke$1('ExtensionHostTextSearch.textSearchHtml', scheme, root, query);
2083
2086
  };
2084
2087
 
2085
2088
  const textSearch$3 = async (scheme, root, query, options, assetDir) => {
2086
- return invoke$2('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
2089
+ return invoke$1('ExtensionHostTextSearch.textSearchMemory', scheme, root, query, options, assetDir);
2087
2090
  };
2088
2091
 
2089
2092
  const getRipGrepArgs = ({
@@ -2113,98 +2116,37 @@ const getRipGrepArgs = ({
2113
2116
  const Electron = 2;
2114
2117
  const Remote = 3;
2115
2118
 
2116
- const Https = 'https:';
2117
- const Ws = 'ws:';
2118
- const Wss = 'wss:';
2119
-
2120
- const getWebSocketProtocol = locationProtocol => {
2121
- return locationProtocol === Https ? Wss : Ws;
2122
- };
2123
-
2124
- const getWebSocketUrl = (type, host, locationProtocol) => {
2125
- const wsProtocol = getWebSocketProtocol(locationProtocol);
2126
- return `${wsProtocol}//${host}/websocket/${type}`;
2127
- };
2128
-
2129
- const getHost = () => {
2130
- return location.host;
2131
- };
2132
- const getProtocol = () => {
2133
- return location.protocol;
2134
- };
2135
-
2136
- const launchSearchProcess = async () => {
2137
- const host = getHost();
2138
- const protocol = getProtocol();
2139
- const wsUrl = getWebSocketUrl('search-process', host, protocol);
2140
- const webSocket = new WebSocket(wsUrl);
2141
- const rpc = await WebSocketRpcParent.create({
2142
- webSocket,
2143
- commandMap: {}
2144
- });
2145
- return rpc;
2146
- };
2147
-
2148
- const state$1 = {
2149
- rpc: undefined
2150
- };
2151
- const getOrCreate$1 = () => {
2152
- if (!state$1.rpc) {
2153
- state$1.rpc = launchSearchProcess();
2154
- }
2155
- return state$1.rpc;
2156
- };
2157
-
2158
- const invoke$1 = async (method, ...params) => {
2159
- const rpc = await getOrCreate$1();
2160
- return rpc.invoke(method, ...params);
2161
- };
2162
- const {
2163
- set} = SearchProcess;
2164
-
2165
- const getPortTuple = () => {
2166
- const {
2167
- port1,
2168
- port2
2169
- } = new MessageChannel();
2119
+ const createLazyRpc = rpcId => {
2120
+ let rpcPromise;
2121
+ let factory;
2122
+ const createRpc = async () => {
2123
+ const rpc = await factory();
2124
+ set$g(rpcId, rpc);
2125
+ };
2126
+ const ensureRpc = async () => {
2127
+ if (!rpcPromise) {
2128
+ rpcPromise = createRpc();
2129
+ }
2130
+ await rpcPromise;
2131
+ };
2170
2132
  return {
2171
- port1,
2172
- port2
2133
+ setFactory(value) {
2134
+ factory = value;
2135
+ },
2136
+ async invoke(method, ...params) {
2137
+ await ensureRpc();
2138
+ const rpc = get$1(rpcId);
2139
+ return rpc.invoke(method, ...params);
2140
+ }
2173
2141
  };
2174
2142
  };
2175
2143
 
2176
- const launchSearchProcessElectron = async () => {
2177
- const {
2178
- port1,
2179
- port2
2180
- } = getPortTuple();
2181
- const rpcPromise = MessagePortRpcParent.create({
2182
- messagePort: port2,
2183
- commandMap: {},
2184
- isMessagePortOpen: true
2185
- });
2186
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port1, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
2187
- port2.start();
2188
- const rpc = await rpcPromise;
2189
- set(rpc);
2190
- return rpc;
2191
- };
2192
-
2193
- const state = {
2194
- rpc: undefined
2195
- };
2196
- const getOrCreate = () => {
2197
- if (!state.rpc) {
2198
- // @ts-ignore
2199
- state.rpc = launchSearchProcessElectron();
2200
- }
2201
- return state.rpc;
2202
- };
2203
-
2204
- const invoke = async (method, ...params) => {
2205
- const rpc = await getOrCreate();
2206
- return rpc.invoke(method, ...params);
2207
- };
2144
+ const {
2145
+ set} = SearchProcess;
2146
+ const {
2147
+ invoke,
2148
+ setFactory
2149
+ } = createLazyRpc(RpcId.SearchProcess);
2208
2150
 
2209
2151
  const textSearch$2 = async (scheme, root, query, options, assetDir, platform) => {
2210
2152
  const ripGrepArgs = getRipGrepArgs({
@@ -2215,16 +2157,13 @@ const textSearch$2 = async (scheme, root, query, options, assetDir, platform) =>
2215
2157
  ripGrepArgs,
2216
2158
  searchDir: root
2217
2159
  };
2218
- if (platform === Remote) {
2219
- const result = await invoke$1('TextSearch.search', actualOptions);
2220
- // TODO api is weird
2221
- return result.results;
2222
- }
2223
- if (platform === Electron) {
2160
+ if (platform === Remote || platform === Electron) {
2224
2161
  const result = await invoke('TextSearch.search', actualOptions);
2162
+ // TODO api is weird
2163
+ // @ts-ignore
2225
2164
  return result.results;
2226
2165
  }
2227
- const results = await invoke$2('SearchProcess.invoke', 'TextSearch.search', actualOptions);
2166
+ const results = await invoke$1('SearchProcess.invoke', 'TextSearch.search', actualOptions);
2228
2167
  // TODO api is weird
2229
2168
  return results.results;
2230
2169
  };
@@ -2356,7 +2295,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2356
2295
  searchDir: root,
2357
2296
  id: searchId
2358
2297
  };
2359
- const resultPromise = invoke$1('TextSearch.searchIncremental', actualOptions);
2298
+ const resultPromise = invoke('TextSearch.searchIncremental', actualOptions);
2360
2299
  for (let i = 0; i < 100; i++) {
2361
2300
  const latest = get(uid);
2362
2301
  const {
@@ -2370,7 +2309,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2370
2309
  } = newState;
2371
2310
  const listHeight = height - headerHeight;
2372
2311
  const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
2373
- const visible = await invoke$1('TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
2312
+ const visible = await invoke('TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
2374
2313
  const latest2 = get(uid);
2375
2314
  if (!latest2 || latest2.newState.searchId !== searchId) {
2376
2315
  return;
@@ -2384,7 +2323,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2384
2323
  };
2385
2324
  set$1(uid, latest2.oldState, updatedState2);
2386
2325
  // @ts-ignore
2387
- await invoke$2('Search.rerender');
2326
+ await invoke$1('Search.rerender');
2388
2327
  await waitForNextFrame();
2389
2328
  }
2390
2329
  await resultPromise;
@@ -2526,7 +2465,7 @@ const noop = state => {
2526
2465
  };
2527
2466
 
2528
2467
  const applyBulkReplacement = async bulkEdits => {
2529
- await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
2468
+ await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
2530
2469
  };
2531
2470
 
2532
2471
  const getReplacedMessage = (fileCount, replaceCount, replacement) => {
@@ -2764,6 +2703,75 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
2764
2703
  return fn(state, value, inputSource);
2765
2704
  };
2766
2705
 
2706
+ const getPortTuple = () => {
2707
+ const {
2708
+ port1,
2709
+ port2
2710
+ } = new MessageChannel();
2711
+ return {
2712
+ port1,
2713
+ port2
2714
+ };
2715
+ };
2716
+
2717
+ const launchSearchProcessElectron = async () => {
2718
+ const {
2719
+ port1,
2720
+ port2
2721
+ } = getPortTuple();
2722
+ const rpcPromise = MessagePortRpcParent.create({
2723
+ messagePort: port2,
2724
+ commandMap: {},
2725
+ isMessagePortOpen: true
2726
+ });
2727
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port1, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
2728
+ port2.start();
2729
+ const rpc = await rpcPromise;
2730
+ set(rpc);
2731
+ return rpc;
2732
+ };
2733
+
2734
+ const Https = 'https:';
2735
+ const Ws = 'ws:';
2736
+ const Wss = 'wss:';
2737
+
2738
+ const getWebSocketProtocol = locationProtocol => {
2739
+ return locationProtocol === Https ? Wss : Ws;
2740
+ };
2741
+
2742
+ const getWebSocketUrl = (type, host, locationProtocol) => {
2743
+ const wsProtocol = getWebSocketProtocol(locationProtocol);
2744
+ return `${wsProtocol}//${host}/websocket/${type}`;
2745
+ };
2746
+
2747
+ const getHost = () => {
2748
+ return location.host;
2749
+ };
2750
+ const getProtocol = () => {
2751
+ return location.protocol;
2752
+ };
2753
+
2754
+ const launchSearchProcessNode = async () => {
2755
+ const host = getHost();
2756
+ const protocol = getProtocol();
2757
+ const wsUrl = getWebSocketUrl('search-process', host, protocol);
2758
+ const webSocket = new WebSocket(wsUrl);
2759
+ const rpc = await WebSocketRpcParent.create({
2760
+ webSocket,
2761
+ commandMap: {}
2762
+ });
2763
+ return rpc;
2764
+ };
2765
+
2766
+ const initialize = async platform => {
2767
+ if (platform === Electron) {
2768
+ setFactory(launchSearchProcessElectron);
2769
+ } else if (platform === Remote) {
2770
+ setFactory(launchSearchProcessNode);
2771
+ }
2772
+ // TODO
2773
+ };
2774
+
2767
2775
  // TODO optimize this function to return the minimum number
2768
2776
  // of visible items needed, e.g. when not scrolled 5 items with
2769
2777
  // 20px fill 100px but when scrolled 6 items are needed
@@ -3120,7 +3128,7 @@ const getFileIndex = (items, index) => {
3120
3128
  };
3121
3129
 
3122
3130
  const openUri = async (path, focus = true, props = {}) => {
3123
- await invoke$2(/* Main.openUri */'Main.openUri', /* uri */path, /* focus */focus, props);
3131
+ await invoke$1(/* Main.openUri */'Main.openUri', /* uri */path, /* focus */focus, props);
3124
3132
  };
3125
3133
 
3126
3134
  // TODO this should be in FileSystem module
@@ -3530,7 +3538,7 @@ const Highlight = 'Highlight';
3530
3538
  const HighlightDeleted = 'HighlightDeleted';
3531
3539
  const HighlightInserted = 'HighlightInserted';
3532
3540
  const IconButton = 'IconButton';
3533
- const Label = 'Label';
3541
+ const Label$1 = 'Label';
3534
3542
  const List = 'List';
3535
3543
  const MaskIcon = 'MaskIcon';
3536
3544
  const MaskIconBook = 'MaskIconBook';
@@ -3575,34 +3583,66 @@ const TreeItems$1 = 'TreeItems';
3575
3583
  const Viewlet = 'Viewlet';
3576
3584
  const ViewletSearchMessage = 'ViewletSearchMessage';
3577
3585
  const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
3578
-
3579
- const Alert = 'alert';
3580
- const Button$2 = 'button';
3581
- const CheckBox = 'checkbox';
3582
- const None = 'none';
3583
- const ScrollBar = 'scrollbar';
3584
- const Status = 'status';
3585
- const ToolBar = 'toolbar';
3586
- const Tree = 'tree';
3587
- const TreeItem = 'treeitem';
3588
-
3589
- const HandleClick = 'handleClick';
3590
- const HandleContextMenu = 'handleContextMenu';
3591
- const HandleHeaderContextMenu = 'handleHeaderContextMenu';
3592
- const HandleExcludeInput = 'handleExcludeInput';
3593
- const HandleHeaderClick2 = 'handleHeaderClick2';
3594
- const HandleHeaderFocusIn = 'handleHeaderFocusIn';
3595
- const HandleHeaderFocusOut = 'handleHeaderFocusOut';
3596
- const HandleIncludeInput = 'handleIncludeInput';
3597
- const HandleInput = 'handleInput';
3598
- const HandleInput2 = 'handleInput2';
3599
- const HandleListBlur = 'handleListBlur';
3600
- const HandleListFocus = 'handleListFocus';
3601
- const HandleReplaceInput = 'handleReplaceInput';
3602
- const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
3603
- const HandleToggleButtonClick = 'handleToggleButtonClick';
3604
- const HandleWheel = 'handleWheel';
3605
-
3586
+ const ClassNames = {
3587
+ __proto__: null,
3588
+ Actions,
3589
+ Badge,
3590
+ Chevron,
3591
+ CloseMaskIcon,
3592
+ Empty,
3593
+ FileIcon,
3594
+ FocusOutline,
3595
+ Grow,
3596
+ Highlight,
3597
+ HighlightDeleted,
3598
+ HighlightInserted,
3599
+ IconButton,
3600
+ Label: Label$1,
3601
+ List,
3602
+ MaskIcon,
3603
+ MaskIconBook,
3604
+ MaskIconCaseSensitive,
3605
+ MaskIconChevronDown,
3606
+ MaskIconChevronRight,
3607
+ MaskIconEllipsis,
3608
+ MaskIconExclude,
3609
+ MaskIconPreserveCase,
3610
+ MaskIconRegex,
3611
+ MaskIconReplaceAll,
3612
+ MaskIconWholeWord,
3613
+ MultilineInputBox,
3614
+ ScrollBar: ScrollBar$1,
3615
+ ScrollBarThumb,
3616
+ ScrollBarVertical,
3617
+ Search: Search$1,
3618
+ SearchField,
3619
+ SearchFieldButton,
3620
+ SearchFieldButtonChecked,
3621
+ SearchFieldButtonDisabled,
3622
+ SearchFieldButtons,
3623
+ SearchFieldContainer,
3624
+ SearchFieldError,
3625
+ SearchHeader,
3626
+ SearchHeaderDetails,
3627
+ SearchHeaderDetailsExpanded,
3628
+ SearchHeaderDetailsExpandedTop,
3629
+ SearchHeaderDetailsHeading,
3630
+ SearchHeaderTop,
3631
+ SearchHeaderTopRight,
3632
+ SearchInputError,
3633
+ SearchRemove,
3634
+ SearchToggleButton,
3635
+ SearchToggleButtonExpanded,
3636
+ SourceControlBadge,
3637
+ ToggleDetails,
3638
+ Tree: Tree$1,
3639
+ TreeItem: TreeItem$1,
3640
+ TreeItemActive,
3641
+ TreeItems: TreeItems$1,
3642
+ Viewlet,
3643
+ ViewletSearchMessage,
3644
+ ViewletSearchMessageIndented
3645
+ };
3606
3646
  const mergeClassNames = (...classNames) => {
3607
3647
  return classNames.filter(Boolean).join(' ');
3608
3648
  };
@@ -3818,6 +3858,33 @@ const diff = (oldNodes, newNodes) => {
3818
3858
  return patches;
3819
3859
  };
3820
3860
 
3861
+ const Alert = 'alert';
3862
+ const Button$2 = 'button';
3863
+ const CheckBox = 'checkbox';
3864
+ const None = 'none';
3865
+ const ScrollBar = 'scrollbar';
3866
+ const Status = 'status';
3867
+ const ToolBar = 'toolbar';
3868
+ const Tree = 'tree';
3869
+ const TreeItem = 'treeitem';
3870
+
3871
+ const HandleClick = 'handleClick';
3872
+ const HandleContextMenu = 'handleContextMenu';
3873
+ const HandleHeaderContextMenu = 'handleHeaderContextMenu';
3874
+ const HandleExcludeInput = 'handleExcludeInput';
3875
+ const HandleHeaderClick2 = 'handleHeaderClick2';
3876
+ const HandleHeaderFocusIn = 'handleHeaderFocusIn';
3877
+ const HandleHeaderFocusOut = 'handleHeaderFocusOut';
3878
+ const HandleIncludeInput = 'handleIncludeInput';
3879
+ const HandleInput = 'handleInput';
3880
+ const HandleInput2 = 'handleInput2';
3881
+ const HandleListBlur = 'handleListBlur';
3882
+ const HandleListFocus = 'handleListFocus';
3883
+ const HandleReplaceInput = 'handleReplaceInput';
3884
+ const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
3885
+ const HandleToggleButtonClick = 'handleToggleButtonClick';
3886
+ const HandleWheel = 'handleWheel';
3887
+
3821
3888
  const Button$1 = 1;
3822
3889
  const Del = 21;
3823
3890
  const Div = 4;
@@ -3831,7 +3898,7 @@ const TextArea = 62;
3831
3898
  const getSearchDetailsToggleVirtualDom = () => {
3832
3899
  return [{
3833
3900
  type: Div,
3834
- className: ToggleDetails,
3901
+ className: ClassNames.ToggleDetails,
3835
3902
  role: Button$2,
3836
3903
  tabIndex: 0,
3837
3904
  ariaLabel: toggleSearchDetails(),
@@ -3840,7 +3907,7 @@ const getSearchDetailsToggleVirtualDom = () => {
3840
3907
  childCount: 1
3841
3908
  }, {
3842
3909
  type: Div,
3843
- className: mergeClassNames(MaskIcon, MaskIconEllipsis),
3910
+ className: mergeClassNames(ClassNames.MaskIcon, ClassNames.MaskIconEllipsis),
3844
3911
  childCount: 0
3845
3912
  }];
3846
3913
  };
@@ -3855,9 +3922,9 @@ const text = data => {
3855
3922
 
3856
3923
  const getClassName = indented => {
3857
3924
  if (indented) {
3858
- return mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented);
3925
+ return mergeClassNames(ClassNames.ViewletSearchMessage, ClassNames.ViewletSearchMessageIndented);
3859
3926
  }
3860
- return ViewletSearchMessage;
3927
+ return ClassNames.ViewletSearchMessage;
3861
3928
  };
3862
3929
  const getSearchMessageVirtualDom = (message, indented) => {
3863
3930
  return [{
@@ -3872,7 +3939,7 @@ const getSearchMessageVirtualDom = (message, indented) => {
3872
3939
  const getSearchHeaderDetailsCollapsedVirtualDom = message => {
3873
3940
  return [{
3874
3941
  type: Div,
3875
- className: SearchHeaderDetails,
3942
+ className: ClassNames.SearchHeaderDetails,
3876
3943
  childCount: 2
3877
3944
  }, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
3878
3945
  };
@@ -3884,7 +3951,7 @@ const ButtonDisabled = 3;
3884
3951
 
3885
3952
  const getInputActionsExclude = flags => {
3886
3953
  const inside = [{
3887
- icon: MaskIconExclude,
3954
+ icon: ClassNames.MaskIconExclude,
3888
3955
  title: useExcludeSettings(),
3889
3956
  command: 'toggleUseExcludeSettings',
3890
3957
  flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
@@ -3899,7 +3966,7 @@ const getInputActionsExclude = flags => {
3899
3966
 
3900
3967
  const getInputActionsInclude = flags => {
3901
3968
  const inside = [{
3902
- icon: MaskIconBook,
3969
+ icon: ClassNames.MaskIconBook,
3903
3970
  title: searchOnlyOpenEditors(),
3904
3971
  command: 'searchOnlyOpenEditors',
3905
3972
  flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
@@ -3913,7 +3980,7 @@ const getInputActionsInclude = flags => {
3913
3980
  };
3914
3981
 
3915
3982
  const getSearchFieldButtonClassName = flag => {
3916
- return mergeClassNames(SearchFieldButton, flag === CheckBoxEnabled ? SearchFieldButtonChecked : '', flag === ButtonDisabled ? SearchFieldButtonDisabled : '');
3983
+ return mergeClassNames(ClassNames.SearchFieldButton, flag === CheckBoxEnabled ? ClassNames.SearchFieldButtonChecked : '', flag === ButtonDisabled ? ClassNames.SearchFieldButtonDisabled : '');
3917
3984
  };
3918
3985
 
3919
3986
  // TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
@@ -3968,7 +4035,7 @@ const getSearchFieldButtonVirtualDom = button => {
3968
4035
  childCount: 1
3969
4036
  }, {
3970
4037
  type: Span,
3971
- className: mergeClassNames(MaskIcon, icon),
4038
+ className: mergeClassNames(ClassNames.MaskIcon, icon),
3972
4039
  childCount: 0
3973
4040
  }];
3974
4041
  };
@@ -3983,7 +4050,7 @@ const getOutSideButtonsDom = outsideButtons => {
3983
4050
  return {
3984
4051
  preNodes: [{
3985
4052
  type: Div,
3986
- className: SearchFieldContainer,
4053
+ className: ClassNames.SearchFieldContainer,
3987
4054
  role: None,
3988
4055
  childCount: 1 + outsideButtons.length
3989
4056
  }],
@@ -3996,7 +4063,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
3996
4063
  preNodes,
3997
4064
  postNodes
3998
4065
  } = getOutSideButtonsDom(outsideButtons);
3999
- const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
4066
+ const searchFieldClassName = hasError ? mergeClassNames(ClassNames.SearchField, ClassNames.SearchFieldError) : ClassNames.SearchField;
4000
4067
  const dom = [...preNodes, {
4001
4068
  type: Div,
4002
4069
  className: searchFieldClassName,
@@ -4004,7 +4071,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4004
4071
  childCount: 2
4005
4072
  }, {
4006
4073
  type: TextArea,
4007
- className: MultilineInputBox,
4074
+ className: ClassNames.MultilineInputBox,
4008
4075
  spellcheck: false,
4009
4076
  autocapitalize: 'off',
4010
4077
  autocorrect: 'off',
@@ -4015,7 +4082,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4015
4082
  childCount: 0
4016
4083
  }, {
4017
4084
  type: Div,
4018
- className: SearchFieldButtons,
4085
+ className: ClassNames.SearchFieldButtons,
4019
4086
  childCount: insideButtons.length
4020
4087
  }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
4021
4088
  return dom;
@@ -4028,19 +4095,19 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
4028
4095
  const excludePlaceholder = exclude();
4029
4096
  return [{
4030
4097
  type: Div,
4031
- className: SearchHeaderDetailsExpanded,
4098
+ className: ClassNames.SearchHeaderDetailsExpanded,
4032
4099
  childCount: 5
4033
4100
  }, {
4034
4101
  type: Div,
4035
- className: SearchHeaderDetailsExpandedTop,
4102
+ className: ClassNames.SearchHeaderDetailsExpandedTop,
4036
4103
  childCount: 2
4037
4104
  }, ...getSearchDetailsToggleVirtualDom(), {
4038
4105
  type: H4,
4039
- className: SearchHeaderDetailsHeading,
4106
+ className: ClassNames.SearchHeaderDetailsHeading,
4040
4107
  childCount: 1
4041
4108
  }, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
4042
4109
  type: H4,
4043
- className: SearchHeaderDetailsHeading,
4110
+ className: ClassNames.SearchHeaderDetailsHeading,
4044
4111
  childCount: 1
4045
4112
  }, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
4046
4113
  };
@@ -4054,17 +4121,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
4054
4121
 
4055
4122
  const getInputActionsInput = flags => {
4056
4123
  const inside = [{
4057
- icon: MaskIconCaseSensitive,
4124
+ icon: ClassNames.MaskIconCaseSensitive,
4058
4125
  flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
4059
4126
  title: matchCase(),
4060
4127
  name: MatchCase
4061
4128
  }, {
4062
- icon: MaskIconWholeWord,
4129
+ icon: ClassNames.MaskIconWholeWord,
4063
4130
  flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
4064
4131
  title: matchWholeWord(),
4065
4132
  name: MatchWholeWord
4066
4133
  }, {
4067
- icon: MaskIconRegex,
4134
+ icon: ClassNames.MaskIconRegex,
4068
4135
  flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
4069
4136
  title: useRegularExpression(),
4070
4137
  name: UseRegularExpression
@@ -4078,13 +4145,13 @@ const getInputActionsInput = flags => {
4078
4145
 
4079
4146
  const getInputActionsReplace = (flags, matchCount) => {
4080
4147
  const inside = [{
4081
- icon: MaskIconPreserveCase,
4148
+ icon: ClassNames.MaskIconPreserveCase,
4082
4149
  flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
4083
4150
  title: preserveCase(),
4084
4151
  name: PreserveCase
4085
4152
  }];
4086
4153
  const outside = [{
4087
- icon: MaskIconReplaceAll,
4154
+ icon: ClassNames.MaskIconReplaceAll,
4088
4155
  flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
4089
4156
  title: replaceAll$1(),
4090
4157
  name: ReplaceAll
@@ -4112,7 +4179,7 @@ const getSearchPlaceholder = focus => {
4112
4179
  const getSearchToggleVirtualDom = replaceExpanded => {
4113
4180
  return [{
4114
4181
  type: Button$1,
4115
- className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
4182
+ className: mergeClassNames(ClassNames.IconButton, ClassNames.SearchToggleButton, replaceExpanded ? ClassNames.SearchToggleButtonExpanded : ''),
4116
4183
  title: toggleReplace$1(),
4117
4184
  ariaLabel: toggleReplace$1(),
4118
4185
  ariaExpanded: Boolean(replaceExpanded),
@@ -4121,7 +4188,7 @@ const getSearchToggleVirtualDom = replaceExpanded => {
4121
4188
  name: ToggleReplace
4122
4189
  }, {
4123
4190
  type: Div,
4124
- className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
4191
+ className: mergeClassNames(ClassNames.MaskIcon, replaceExpanded ? ClassNames.MaskIconChevronDown : ClassNames.MaskIconChevronRight),
4125
4192
  childCount: 0
4126
4193
  }];
4127
4194
  };
@@ -4134,12 +4201,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4134
4201
  const replaceExpanded = flags & ReplaceExpanded;
4135
4202
  const dom = [{
4136
4203
  type: Div,
4137
- className: SearchHeaderTop,
4204
+ className: ClassNames.SearchHeaderTop,
4138
4205
  role: None,
4139
4206
  childCount: 2
4140
4207
  }, ...getSearchToggleVirtualDom(replaceExpanded), {
4141
4208
  type: Div,
4142
- className: SearchHeaderTopRight,
4209
+ className: ClassNames.SearchHeaderTopRight,
4143
4210
  role: None,
4144
4211
  childCount: replaceExpanded ? 2 : 1
4145
4212
  }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
@@ -4151,7 +4218,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4151
4218
 
4152
4219
  const parentNode = {
4153
4220
  type: Div,
4154
- className: SearchHeader,
4221
+ className: ClassNames.SearchHeader,
4155
4222
  role: None,
4156
4223
  childCount: 2,
4157
4224
  onClick: HandleHeaderClick2,
@@ -4170,7 +4237,7 @@ const getSearchInputErrorVirtualDom = errorMessage => {
4170
4237
  }
4171
4238
  return [{
4172
4239
  type: Div,
4173
- className: SearchInputError,
4240
+ className: ClassNames.SearchInputError,
4174
4241
  role: Alert,
4175
4242
  childCount: 1
4176
4243
  }, text(errorMessage)];
@@ -4184,7 +4251,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4184
4251
  }
4185
4252
  return [{
4186
4253
  type: Div,
4187
- className: mergeClassNames(ScrollBar$1, ScrollBarVertical),
4254
+ className: mergeClassNames(ClassNames.ScrollBar, ClassNames.ScrollBarVertical),
4188
4255
  childCount: 1,
4189
4256
  onPointerDown: HandleScrollBarPointerDown,
4190
4257
  role: ScrollBar,
@@ -4192,7 +4259,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4192
4259
  ariaValueNow: scrollBarValue
4193
4260
  }, {
4194
4261
  type: Div,
4195
- className: ScrollBarThumb,
4262
+ className: ClassNames.ScrollBarThumb,
4196
4263
  height: scrollBarHeight,
4197
4264
  translate: `0 ${scrollBarY}px`,
4198
4265
  childCount: 0
@@ -4218,26 +4285,26 @@ const getBadgeVirtualDom = (className, badgeText) => {
4218
4285
  }
4219
4286
  return [{
4220
4287
  type: Div,
4221
- className: mergeClassNames(Badge, className),
4288
+ className: mergeClassNames(ClassNames.Badge, className),
4222
4289
  childCount: 1
4223
4290
  }, text(badgeText)];
4224
4291
  };
4225
4292
 
4226
4293
  const chevronDownVirtualDom = {
4227
4294
  type: Div,
4228
- className: mergeClassNames(Chevron, MaskIconChevronDown),
4295
+ className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronDown),
4229
4296
  childCount: 0
4230
4297
  };
4231
4298
  const chevronRightVirtualDom = {
4232
4299
  type: Div,
4233
- className: mergeClassNames(Chevron, MaskIconChevronRight),
4300
+ className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronRight),
4234
4301
  childCount: 0
4235
4302
  };
4236
4303
 
4237
4304
  const getFileIconVirtualDom = icon => {
4238
4305
  return {
4239
4306
  type: Img,
4240
- className: FileIcon,
4307
+ className: ClassNames.FileIcon,
4241
4308
  src: icon,
4242
4309
  role: None,
4243
4310
  childCount: 0
@@ -4257,22 +4324,22 @@ const getIconsVirtualDom = (expanded, icon) => {
4257
4324
 
4258
4325
  const deleted = {
4259
4326
  type: Del,
4260
- className: HighlightDeleted,
4327
+ className: ClassNames.HighlightDeleted,
4261
4328
  childCount: 1
4262
4329
  };
4263
4330
  const inserted = {
4264
4331
  type: Ins,
4265
- className: HighlightInserted,
4332
+ className: ClassNames.HighlightInserted,
4266
4333
  childCount: 1
4267
4334
  };
4268
4335
  const highlighted = {
4269
4336
  type: Span,
4270
- className: Highlight,
4337
+ className: ClassNames.Highlight,
4271
4338
  childCount: 1
4272
4339
  };
4273
4340
  const label1 = {
4274
4341
  type: Div,
4275
- className: mergeClassNames(Label, Grow),
4342
+ className: mergeClassNames(ClassNames.Label, ClassNames.Grow),
4276
4343
  childCount: 1
4277
4344
  };
4278
4345
  const label3 = {
@@ -4302,9 +4369,9 @@ const getPaddingLeft = depth => {
4302
4369
 
4303
4370
  const getSearchResultClassName = focused => {
4304
4371
  if (focused) {
4305
- return TreeItem$1 + ' ' + TreeItemActive;
4372
+ return ClassNames.TreeItem + ' ' + ClassNames.TreeItemActive;
4306
4373
  }
4307
- return TreeItem$1;
4374
+ return ClassNames.TreeItem;
4308
4375
  };
4309
4376
 
4310
4377
  const PaddingRight = '12px';
@@ -4339,13 +4406,13 @@ const getSearchResultVirtualDom = rowInfo => {
4339
4406
  paddingLeft: getPaddingLeft(depth),
4340
4407
  paddingRight: PaddingRight,
4341
4408
  ariaExpanded: getAriaExpanded(expanded)
4342
- }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(SourceControlBadge, badgeText), {
4409
+ }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(ClassNames.SourceControlBadge, badgeText), {
4343
4410
  type: Div,
4344
- className: SearchRemove,
4411
+ className: ClassNames.SearchRemove,
4345
4412
  childCount: 1
4346
4413
  }, {
4347
4414
  type: Div,
4348
- className: CloseMaskIcon,
4415
+ className: ClassNames.CloseMaskIcon,
4349
4416
  childCount: 0
4350
4417
  }];
4351
4418
  return dom;
@@ -4355,7 +4422,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
4355
4422
  const pixelOffset = deltaY % itemHeight;
4356
4423
  return [{
4357
4424
  type: Div,
4358
- className: TreeItems$1,
4425
+ className: ClassNames.TreeItems,
4359
4426
  childCount: visibleItems.length,
4360
4427
  onClick: HandleClick,
4361
4428
  onBlur: HandleListBlur,
@@ -4370,7 +4437,7 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
4370
4437
  const scrollBarDomNodes = scrollbarHeight === 0 ? 0 : 1;
4371
4438
  return [{
4372
4439
  type: Div,
4373
- className: mergeClassNames(Viewlet, List, Tree$1, focusOutline ? FocusOutline : Empty),
4440
+ className: mergeClassNames(ClassNames.Viewlet, ClassNames.List, ClassNames.Tree, focusOutline ? ClassNames.FocusOutline : ClassNames.Empty),
4374
4441
  role: Tree,
4375
4442
  tabIndex: 0,
4376
4443
  childCount: 1 + scrollBarDomNodes
@@ -4382,7 +4449,7 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
4382
4449
  const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
4383
4450
  return [{
4384
4451
  type: Div,
4385
- className: mergeClassNames(Viewlet, Search$1),
4452
+ className: mergeClassNames(ClassNames.Viewlet, ClassNames.Search),
4386
4453
  childCount
4387
4454
  }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
4388
4455
  };
@@ -4451,7 +4518,7 @@ const Button = 1;
4451
4518
  const getIconVirtualDom = (icon, type = Div) => {
4452
4519
  return {
4453
4520
  type,
4454
- className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
4521
+ className: mergeClassNames(ClassNames.MaskIcon, `MaskIcon${icon}`),
4455
4522
  role: None,
4456
4523
  childCount: 0
4457
4524
  };
@@ -4465,7 +4532,7 @@ const getActionButtonVirtualDom = action => {
4465
4532
  } = action;
4466
4533
  return [{
4467
4534
  type: Button$1,
4468
- className: IconButton,
4535
+ className: ClassNames.IconButton,
4469
4536
  title: id,
4470
4537
  'data-command': command,
4471
4538
  childCount: 1
@@ -4484,7 +4551,7 @@ const getActionVirtualDom = action => {
4484
4551
  const getActionsVirtualDom = actions => {
4485
4552
  return [{
4486
4553
  type: Div,
4487
- className: Actions,
4554
+ className: ClassNames.Actions,
4488
4555
  role: ToolBar,
4489
4556
  childCount: actions.length
4490
4557
  }, ...actions.flatMap(getActionVirtualDom)];
@@ -4608,7 +4675,7 @@ const renderIncremental = uid => {
4608
4675
  };
4609
4676
 
4610
4677
  const prompt = (text, options) => {
4611
- return invoke$2('ConfirmPrompt.prompt', text, options);
4678
+ return invoke$1('ConfirmPrompt.prompt', text, options);
4612
4679
  };
4613
4680
 
4614
4681
  const getReplaceAllConfirmText = (matchCount, fileCount, replacement) => {
@@ -4803,7 +4870,7 @@ const show = async (x, y, id, ...args) => {
4803
4870
  number(y);
4804
4871
  number(id);
4805
4872
  // TODO
4806
- await invoke$2('ContextMenu.show', x, y, id, ...args);
4873
+ await invoke$1('ContextMenu.show', x, y, id, ...args);
4807
4874
  };
4808
4875
 
4809
4876
  const Search = 18;
@@ -4906,6 +4973,7 @@ const commandMap = {
4906
4973
  'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
4907
4974
  'TextSearch.viewAsTree': wrapCommand(viewAsTree),
4908
4975
  // not wrapped
4976
+ 'TextSearch.initialize': initialize,
4909
4977
  'TextSearch.create': create,
4910
4978
  'TextSearch.getCommandIds': getCommandIds,
4911
4979
  'TextSearch.getKeyBindings': getKeyBindings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "4.12.0",
3
+ "version": "5.0.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"