@lvce-editor/text-search-worker 4.13.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.
@@ -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
  };
@@ -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 getPortTuple = () => {
2159
- const {
2160
- port1,
2161
- port2
2162
- } = 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
+ };
2163
2132
  return {
2164
- port1,
2165
- 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
+ }
2166
2141
  };
2167
2142
  };
2168
2143
 
2169
- const launchSearchProcessElectron = async () => {
2170
- const {
2171
- port1,
2172
- port2
2173
- } = getPortTuple();
2174
- const rpcPromise = MessagePortRpcParent.create({
2175
- messagePort: port2,
2176
- commandMap: {},
2177
- isMessagePortOpen: true
2178
- });
2179
- await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port1, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
2180
- port2.start();
2181
- const rpc = await rpcPromise;
2182
- set(rpc);
2183
- return rpc;
2184
- };
2185
-
2186
- const state = {
2187
- rpc: undefined
2188
- };
2189
- const getOrCreate = () => {
2190
- if (!state.rpc) {
2191
- // @ts-ignore
2192
- state.rpc = launchSearchProcessElectron();
2193
- }
2194
- return state.rpc;
2195
- };
2196
-
2197
2144
  const {
2198
2145
  set} = SearchProcess;
2199
- const lazyInvoke = async (platform, method, ...params) => {
2200
- if (platform === Electron) {
2201
- await getOrCreate();
2202
- } else if (platform === Remote) {
2203
- await getOrCreate$1();
2204
- }
2205
- // @ts-ignore
2206
- return invoke(method, ...params);
2207
- };
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({
@@ -2216,8 +2158,7 @@ const textSearch$2 = async (scheme, root, query, options, assetDir, platform) =>
2216
2158
  searchDir: root
2217
2159
  };
2218
2160
  if (platform === Remote || platform === Electron) {
2219
- // @ts-ignore
2220
- const result = await lazyInvoke(platform, 'TextSearch.search', actualOptions);
2161
+ const result = await invoke('TextSearch.search', actualOptions);
2221
2162
  // TODO api is weird
2222
2163
  // @ts-ignore
2223
2164
  return result.results;
@@ -2354,7 +2295,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2354
2295
  searchDir: root,
2355
2296
  id: searchId
2356
2297
  };
2357
- const resultPromise = lazyInvoke(platform, 'TextSearch.searchIncremental', actualOptions);
2298
+ const resultPromise = invoke('TextSearch.searchIncremental', actualOptions);
2358
2299
  for (let i = 0; i < 100; i++) {
2359
2300
  const latest = get(uid);
2360
2301
  const {
@@ -2368,7 +2309,7 @@ const textSearchIncremental = async (root, query, options, assetDir, platform, s
2368
2309
  } = newState;
2369
2310
  const listHeight = height - headerHeight;
2370
2311
  const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
2371
- const visible = await lazyInvoke(platform, 'TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
2312
+ const visible = await invoke('TextSearch.getIncrementalResults', searchId, minLineY, minLineY + numberOfVisible);
2372
2313
  const latest2 = get(uid);
2373
2314
  if (!latest2 || latest2.newState.searchId !== searchId) {
2374
2315
  return;
@@ -2762,7 +2703,72 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
2762
2703
  return fn(state, value, inputSource);
2763
2704
  };
2764
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
+
2765
2766
  const initialize = async platform => {
2767
+ if (platform === Electron) {
2768
+ setFactory(launchSearchProcessElectron);
2769
+ } else if (platform === Remote) {
2770
+ setFactory(launchSearchProcessNode);
2771
+ }
2766
2772
  // TODO
2767
2773
  };
2768
2774
 
@@ -3532,7 +3538,7 @@ const Highlight = 'Highlight';
3532
3538
  const HighlightDeleted = 'HighlightDeleted';
3533
3539
  const HighlightInserted = 'HighlightInserted';
3534
3540
  const IconButton = 'IconButton';
3535
- const Label = 'Label';
3541
+ const Label$1 = 'Label';
3536
3542
  const List = 'List';
3537
3543
  const MaskIcon = 'MaskIcon';
3538
3544
  const MaskIconBook = 'MaskIconBook';
@@ -3577,34 +3583,66 @@ const TreeItems$1 = 'TreeItems';
3577
3583
  const Viewlet = 'Viewlet';
3578
3584
  const ViewletSearchMessage = 'ViewletSearchMessage';
3579
3585
  const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
3580
-
3581
- const Alert = 'alert';
3582
- const Button$2 = 'button';
3583
- const CheckBox = 'checkbox';
3584
- const None = 'none';
3585
- const ScrollBar = 'scrollbar';
3586
- const Status = 'status';
3587
- const ToolBar = 'toolbar';
3588
- const Tree = 'tree';
3589
- const TreeItem = 'treeitem';
3590
-
3591
- const HandleClick = 'handleClick';
3592
- const HandleContextMenu = 'handleContextMenu';
3593
- const HandleHeaderContextMenu = 'handleHeaderContextMenu';
3594
- const HandleExcludeInput = 'handleExcludeInput';
3595
- const HandleHeaderClick2 = 'handleHeaderClick2';
3596
- const HandleHeaderFocusIn = 'handleHeaderFocusIn';
3597
- const HandleHeaderFocusOut = 'handleHeaderFocusOut';
3598
- const HandleIncludeInput = 'handleIncludeInput';
3599
- const HandleInput = 'handleInput';
3600
- const HandleInput2 = 'handleInput2';
3601
- const HandleListBlur = 'handleListBlur';
3602
- const HandleListFocus = 'handleListFocus';
3603
- const HandleReplaceInput = 'handleReplaceInput';
3604
- const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
3605
- const HandleToggleButtonClick = 'handleToggleButtonClick';
3606
- const HandleWheel = 'handleWheel';
3607
-
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
+ };
3608
3646
  const mergeClassNames = (...classNames) => {
3609
3647
  return classNames.filter(Boolean).join(' ');
3610
3648
  };
@@ -3820,6 +3858,33 @@ const diff = (oldNodes, newNodes) => {
3820
3858
  return patches;
3821
3859
  };
3822
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
+
3823
3888
  const Button$1 = 1;
3824
3889
  const Del = 21;
3825
3890
  const Div = 4;
@@ -3833,7 +3898,7 @@ const TextArea = 62;
3833
3898
  const getSearchDetailsToggleVirtualDom = () => {
3834
3899
  return [{
3835
3900
  type: Div,
3836
- className: ToggleDetails,
3901
+ className: ClassNames.ToggleDetails,
3837
3902
  role: Button$2,
3838
3903
  tabIndex: 0,
3839
3904
  ariaLabel: toggleSearchDetails(),
@@ -3842,7 +3907,7 @@ const getSearchDetailsToggleVirtualDom = () => {
3842
3907
  childCount: 1
3843
3908
  }, {
3844
3909
  type: Div,
3845
- className: mergeClassNames(MaskIcon, MaskIconEllipsis),
3910
+ className: mergeClassNames(ClassNames.MaskIcon, ClassNames.MaskIconEllipsis),
3846
3911
  childCount: 0
3847
3912
  }];
3848
3913
  };
@@ -3857,9 +3922,9 @@ const text = data => {
3857
3922
 
3858
3923
  const getClassName = indented => {
3859
3924
  if (indented) {
3860
- return mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented);
3925
+ return mergeClassNames(ClassNames.ViewletSearchMessage, ClassNames.ViewletSearchMessageIndented);
3861
3926
  }
3862
- return ViewletSearchMessage;
3927
+ return ClassNames.ViewletSearchMessage;
3863
3928
  };
3864
3929
  const getSearchMessageVirtualDom = (message, indented) => {
3865
3930
  return [{
@@ -3874,7 +3939,7 @@ const getSearchMessageVirtualDom = (message, indented) => {
3874
3939
  const getSearchHeaderDetailsCollapsedVirtualDom = message => {
3875
3940
  return [{
3876
3941
  type: Div,
3877
- className: SearchHeaderDetails,
3942
+ className: ClassNames.SearchHeaderDetails,
3878
3943
  childCount: 2
3879
3944
  }, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
3880
3945
  };
@@ -3886,7 +3951,7 @@ const ButtonDisabled = 3;
3886
3951
 
3887
3952
  const getInputActionsExclude = flags => {
3888
3953
  const inside = [{
3889
- icon: MaskIconExclude,
3954
+ icon: ClassNames.MaskIconExclude,
3890
3955
  title: useExcludeSettings(),
3891
3956
  command: 'toggleUseExcludeSettings',
3892
3957
  flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
@@ -3901,7 +3966,7 @@ const getInputActionsExclude = flags => {
3901
3966
 
3902
3967
  const getInputActionsInclude = flags => {
3903
3968
  const inside = [{
3904
- icon: MaskIconBook,
3969
+ icon: ClassNames.MaskIconBook,
3905
3970
  title: searchOnlyOpenEditors(),
3906
3971
  command: 'searchOnlyOpenEditors',
3907
3972
  flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
@@ -3915,7 +3980,7 @@ const getInputActionsInclude = flags => {
3915
3980
  };
3916
3981
 
3917
3982
  const getSearchFieldButtonClassName = flag => {
3918
- return mergeClassNames(SearchFieldButton, flag === CheckBoxEnabled ? SearchFieldButtonChecked : '', flag === ButtonDisabled ? SearchFieldButtonDisabled : '');
3983
+ return mergeClassNames(ClassNames.SearchFieldButton, flag === CheckBoxEnabled ? ClassNames.SearchFieldButtonChecked : '', flag === ButtonDisabled ? ClassNames.SearchFieldButtonDisabled : '');
3919
3984
  };
3920
3985
 
3921
3986
  // TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
@@ -3970,7 +4035,7 @@ const getSearchFieldButtonVirtualDom = button => {
3970
4035
  childCount: 1
3971
4036
  }, {
3972
4037
  type: Span,
3973
- className: mergeClassNames(MaskIcon, icon),
4038
+ className: mergeClassNames(ClassNames.MaskIcon, icon),
3974
4039
  childCount: 0
3975
4040
  }];
3976
4041
  };
@@ -3985,7 +4050,7 @@ const getOutSideButtonsDom = outsideButtons => {
3985
4050
  return {
3986
4051
  preNodes: [{
3987
4052
  type: Div,
3988
- className: SearchFieldContainer,
4053
+ className: ClassNames.SearchFieldContainer,
3989
4054
  role: None,
3990
4055
  childCount: 1 + outsideButtons.length
3991
4056
  }],
@@ -3998,7 +4063,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
3998
4063
  preNodes,
3999
4064
  postNodes
4000
4065
  } = getOutSideButtonsDom(outsideButtons);
4001
- const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
4066
+ const searchFieldClassName = hasError ? mergeClassNames(ClassNames.SearchField, ClassNames.SearchFieldError) : ClassNames.SearchField;
4002
4067
  const dom = [...preNodes, {
4003
4068
  type: Div,
4004
4069
  className: searchFieldClassName,
@@ -4006,7 +4071,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4006
4071
  childCount: 2
4007
4072
  }, {
4008
4073
  type: TextArea,
4009
- className: MultilineInputBox,
4074
+ className: ClassNames.MultilineInputBox,
4010
4075
  spellcheck: false,
4011
4076
  autocapitalize: 'off',
4012
4077
  autocorrect: 'off',
@@ -4017,7 +4082,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4017
4082
  childCount: 0
4018
4083
  }, {
4019
4084
  type: Div,
4020
- className: SearchFieldButtons,
4085
+ className: ClassNames.SearchFieldButtons,
4021
4086
  childCount: insideButtons.length
4022
4087
  }, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom), ...postNodes];
4023
4088
  return dom;
@@ -4030,19 +4095,19 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
4030
4095
  const excludePlaceholder = exclude();
4031
4096
  return [{
4032
4097
  type: Div,
4033
- className: SearchHeaderDetailsExpanded,
4098
+ className: ClassNames.SearchHeaderDetailsExpanded,
4034
4099
  childCount: 5
4035
4100
  }, {
4036
4101
  type: Div,
4037
- className: SearchHeaderDetailsExpandedTop,
4102
+ className: ClassNames.SearchHeaderDetailsExpandedTop,
4038
4103
  childCount: 2
4039
4104
  }, ...getSearchDetailsToggleVirtualDom(), {
4040
4105
  type: H4,
4041
- className: SearchHeaderDetailsHeading,
4106
+ className: ClassNames.SearchHeaderDetailsHeading,
4042
4107
  childCount: 1
4043
4108
  }, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
4044
4109
  type: H4,
4045
- className: SearchHeaderDetailsHeading,
4110
+ className: ClassNames.SearchHeaderDetailsHeading,
4046
4111
  childCount: 1
4047
4112
  }, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
4048
4113
  };
@@ -4056,17 +4121,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
4056
4121
 
4057
4122
  const getInputActionsInput = flags => {
4058
4123
  const inside = [{
4059
- icon: MaskIconCaseSensitive,
4124
+ icon: ClassNames.MaskIconCaseSensitive,
4060
4125
  flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
4061
4126
  title: matchCase(),
4062
4127
  name: MatchCase
4063
4128
  }, {
4064
- icon: MaskIconWholeWord,
4129
+ icon: ClassNames.MaskIconWholeWord,
4065
4130
  flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
4066
4131
  title: matchWholeWord(),
4067
4132
  name: MatchWholeWord
4068
4133
  }, {
4069
- icon: MaskIconRegex,
4134
+ icon: ClassNames.MaskIconRegex,
4070
4135
  flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
4071
4136
  title: useRegularExpression(),
4072
4137
  name: UseRegularExpression
@@ -4080,13 +4145,13 @@ const getInputActionsInput = flags => {
4080
4145
 
4081
4146
  const getInputActionsReplace = (flags, matchCount) => {
4082
4147
  const inside = [{
4083
- icon: MaskIconPreserveCase,
4148
+ icon: ClassNames.MaskIconPreserveCase,
4084
4149
  flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
4085
4150
  title: preserveCase(),
4086
4151
  name: PreserveCase
4087
4152
  }];
4088
4153
  const outside = [{
4089
- icon: MaskIconReplaceAll,
4154
+ icon: ClassNames.MaskIconReplaceAll,
4090
4155
  flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
4091
4156
  title: replaceAll$1(),
4092
4157
  name: ReplaceAll
@@ -4114,7 +4179,7 @@ const getSearchPlaceholder = focus => {
4114
4179
  const getSearchToggleVirtualDom = replaceExpanded => {
4115
4180
  return [{
4116
4181
  type: Button$1,
4117
- className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
4182
+ className: mergeClassNames(ClassNames.IconButton, ClassNames.SearchToggleButton, replaceExpanded ? ClassNames.SearchToggleButtonExpanded : ''),
4118
4183
  title: toggleReplace$1(),
4119
4184
  ariaLabel: toggleReplace$1(),
4120
4185
  ariaExpanded: Boolean(replaceExpanded),
@@ -4123,7 +4188,7 @@ const getSearchToggleVirtualDom = replaceExpanded => {
4123
4188
  name: ToggleReplace
4124
4189
  }, {
4125
4190
  type: Div,
4126
- className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
4191
+ className: mergeClassNames(ClassNames.MaskIcon, replaceExpanded ? ClassNames.MaskIconChevronDown : ClassNames.MaskIconChevronRight),
4127
4192
  childCount: 0
4128
4193
  }];
4129
4194
  };
@@ -4136,12 +4201,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4136
4201
  const replaceExpanded = flags & ReplaceExpanded;
4137
4202
  const dom = [{
4138
4203
  type: Div,
4139
- className: SearchHeaderTop,
4204
+ className: ClassNames.SearchHeaderTop,
4140
4205
  role: None,
4141
4206
  childCount: 2
4142
4207
  }, ...getSearchToggleVirtualDom(replaceExpanded), {
4143
4208
  type: Div,
4144
- className: SearchHeaderTopRight,
4209
+ className: ClassNames.SearchHeaderTopRight,
4145
4210
  role: None,
4146
4211
  childCount: replaceExpanded ? 2 : 1
4147
4212
  }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
@@ -4153,7 +4218,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4153
4218
 
4154
4219
  const parentNode = {
4155
4220
  type: Div,
4156
- className: SearchHeader,
4221
+ className: ClassNames.SearchHeader,
4157
4222
  role: None,
4158
4223
  childCount: 2,
4159
4224
  onClick: HandleHeaderClick2,
@@ -4172,7 +4237,7 @@ const getSearchInputErrorVirtualDom = errorMessage => {
4172
4237
  }
4173
4238
  return [{
4174
4239
  type: Div,
4175
- className: SearchInputError,
4240
+ className: ClassNames.SearchInputError,
4176
4241
  role: Alert,
4177
4242
  childCount: 1
4178
4243
  }, text(errorMessage)];
@@ -4186,7 +4251,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4186
4251
  }
4187
4252
  return [{
4188
4253
  type: Div,
4189
- className: mergeClassNames(ScrollBar$1, ScrollBarVertical),
4254
+ className: mergeClassNames(ClassNames.ScrollBar, ClassNames.ScrollBarVertical),
4190
4255
  childCount: 1,
4191
4256
  onPointerDown: HandleScrollBarPointerDown,
4192
4257
  role: ScrollBar,
@@ -4194,7 +4259,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
4194
4259
  ariaValueNow: scrollBarValue
4195
4260
  }, {
4196
4261
  type: Div,
4197
- className: ScrollBarThumb,
4262
+ className: ClassNames.ScrollBarThumb,
4198
4263
  height: scrollBarHeight,
4199
4264
  translate: `0 ${scrollBarY}px`,
4200
4265
  childCount: 0
@@ -4220,26 +4285,26 @@ const getBadgeVirtualDom = (className, badgeText) => {
4220
4285
  }
4221
4286
  return [{
4222
4287
  type: Div,
4223
- className: mergeClassNames(Badge, className),
4288
+ className: mergeClassNames(ClassNames.Badge, className),
4224
4289
  childCount: 1
4225
4290
  }, text(badgeText)];
4226
4291
  };
4227
4292
 
4228
4293
  const chevronDownVirtualDom = {
4229
4294
  type: Div,
4230
- className: mergeClassNames(Chevron, MaskIconChevronDown),
4295
+ className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronDown),
4231
4296
  childCount: 0
4232
4297
  };
4233
4298
  const chevronRightVirtualDom = {
4234
4299
  type: Div,
4235
- className: mergeClassNames(Chevron, MaskIconChevronRight),
4300
+ className: mergeClassNames(ClassNames.Chevron, ClassNames.MaskIconChevronRight),
4236
4301
  childCount: 0
4237
4302
  };
4238
4303
 
4239
4304
  const getFileIconVirtualDom = icon => {
4240
4305
  return {
4241
4306
  type: Img,
4242
- className: FileIcon,
4307
+ className: ClassNames.FileIcon,
4243
4308
  src: icon,
4244
4309
  role: None,
4245
4310
  childCount: 0
@@ -4259,22 +4324,22 @@ const getIconsVirtualDom = (expanded, icon) => {
4259
4324
 
4260
4325
  const deleted = {
4261
4326
  type: Del,
4262
- className: HighlightDeleted,
4327
+ className: ClassNames.HighlightDeleted,
4263
4328
  childCount: 1
4264
4329
  };
4265
4330
  const inserted = {
4266
4331
  type: Ins,
4267
- className: HighlightInserted,
4332
+ className: ClassNames.HighlightInserted,
4268
4333
  childCount: 1
4269
4334
  };
4270
4335
  const highlighted = {
4271
4336
  type: Span,
4272
- className: Highlight,
4337
+ className: ClassNames.Highlight,
4273
4338
  childCount: 1
4274
4339
  };
4275
4340
  const label1 = {
4276
4341
  type: Div,
4277
- className: mergeClassNames(Label, Grow),
4342
+ className: mergeClassNames(ClassNames.Label, ClassNames.Grow),
4278
4343
  childCount: 1
4279
4344
  };
4280
4345
  const label3 = {
@@ -4304,9 +4369,9 @@ const getPaddingLeft = depth => {
4304
4369
 
4305
4370
  const getSearchResultClassName = focused => {
4306
4371
  if (focused) {
4307
- return TreeItem$1 + ' ' + TreeItemActive;
4372
+ return ClassNames.TreeItem + ' ' + ClassNames.TreeItemActive;
4308
4373
  }
4309
- return TreeItem$1;
4374
+ return ClassNames.TreeItem;
4310
4375
  };
4311
4376
 
4312
4377
  const PaddingRight = '12px';
@@ -4341,13 +4406,13 @@ const getSearchResultVirtualDom = rowInfo => {
4341
4406
  paddingLeft: getPaddingLeft(depth),
4342
4407
  paddingRight: PaddingRight,
4343
4408
  ariaExpanded: getAriaExpanded(expanded)
4344
- }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(SourceControlBadge, badgeText), {
4409
+ }, ...getIconsVirtualDom(expanded, icon), ...getLabelVirtualDom(displayText, matchLength, matchStart, replacement), ...getBadgeVirtualDom(ClassNames.SourceControlBadge, badgeText), {
4345
4410
  type: Div,
4346
- className: SearchRemove,
4411
+ className: ClassNames.SearchRemove,
4347
4412
  childCount: 1
4348
4413
  }, {
4349
4414
  type: Div,
4350
- className: CloseMaskIcon,
4415
+ className: ClassNames.CloseMaskIcon,
4351
4416
  childCount: 0
4352
4417
  }];
4353
4418
  return dom;
@@ -4357,7 +4422,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
4357
4422
  const pixelOffset = deltaY % itemHeight;
4358
4423
  return [{
4359
4424
  type: Div,
4360
- className: TreeItems$1,
4425
+ className: ClassNames.TreeItems,
4361
4426
  childCount: visibleItems.length,
4362
4427
  onClick: HandleClick,
4363
4428
  onBlur: HandleListBlur,
@@ -4372,7 +4437,7 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
4372
4437
  const scrollBarDomNodes = scrollbarHeight === 0 ? 0 : 1;
4373
4438
  return [{
4374
4439
  type: Div,
4375
- className: mergeClassNames(Viewlet, List, Tree$1, focusOutline ? FocusOutline : Empty),
4440
+ className: mergeClassNames(ClassNames.Viewlet, ClassNames.List, ClassNames.Tree, focusOutline ? ClassNames.FocusOutline : ClassNames.Empty),
4376
4441
  role: Tree,
4377
4442
  tabIndex: 0,
4378
4443
  childCount: 1 + scrollBarDomNodes
@@ -4384,7 +4449,7 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
4384
4449
  const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
4385
4450
  return [{
4386
4451
  type: Div,
4387
- className: mergeClassNames(Viewlet, Search$1),
4452
+ className: mergeClassNames(ClassNames.Viewlet, ClassNames.Search),
4388
4453
  childCount
4389
4454
  }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
4390
4455
  };
@@ -4453,7 +4518,7 @@ const Button = 1;
4453
4518
  const getIconVirtualDom = (icon, type = Div) => {
4454
4519
  return {
4455
4520
  type,
4456
- className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
4521
+ className: mergeClassNames(ClassNames.MaskIcon, `MaskIcon${icon}`),
4457
4522
  role: None,
4458
4523
  childCount: 0
4459
4524
  };
@@ -4467,7 +4532,7 @@ const getActionButtonVirtualDom = action => {
4467
4532
  } = action;
4468
4533
  return [{
4469
4534
  type: Button$1,
4470
- className: IconButton,
4535
+ className: ClassNames.IconButton,
4471
4536
  title: id,
4472
4537
  'data-command': command,
4473
4538
  childCount: 1
@@ -4486,7 +4551,7 @@ const getActionVirtualDom = action => {
4486
4551
  const getActionsVirtualDom = actions => {
4487
4552
  return [{
4488
4553
  type: Div,
4489
- className: Actions,
4554
+ className: ClassNames.Actions,
4490
4555
  role: ToolBar,
4491
4556
  childCount: actions.length
4492
4557
  }, ...actions.flatMap(getActionVirtualDom)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "4.13.0",
3
+ "version": "5.0.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"