@lvce-editor/text-search-worker 3.39.0 → 3.41.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.
- package/dist/textSearchWorkerMain.js +99 -17
- package/package.json +1 -1
|
@@ -2009,7 +2009,10 @@ const HandleInput = 'handleInput';
|
|
|
2009
2009
|
const HandleListBlur = 'handleListBlur';
|
|
2010
2010
|
const HandleReplaceInput = 'handleReplaceInput';
|
|
2011
2011
|
const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
|
|
2012
|
+
const HandleToggleButtonClick = 'handleToggleButtonClick';
|
|
2012
2013
|
const HandleWheel = 'handleWheel';
|
|
2014
|
+
const HandleListFocus = 'handleListFocus';
|
|
2015
|
+
const HandleContextMenu = 'handleContextMenu';
|
|
2013
2016
|
|
|
2014
2017
|
const FilesToExclude = 'FilesToExclude';
|
|
2015
2018
|
const FilesToInclude = 'FilesToInclude';
|
|
@@ -2068,12 +2071,17 @@ const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
|
2068
2071
|
}, ...getSearchMessageVirtualDom(message), ...getSearchDetailsToggleVirtualDom()];
|
|
2069
2072
|
};
|
|
2070
2073
|
|
|
2074
|
+
const CheckBoxEnabled = 1;
|
|
2075
|
+
const CheckBoxDisabled = 2;
|
|
2076
|
+
const ButtonEnabled = 2;
|
|
2077
|
+
const ButtonDisabled = 3;
|
|
2078
|
+
|
|
2071
2079
|
const getInputActionsExclude = flags => {
|
|
2072
2080
|
const inside = [{
|
|
2073
2081
|
icon: MaskIconExclude,
|
|
2074
2082
|
title: useExcludeSettings(),
|
|
2075
2083
|
command: 'toggleUseExcludeSettings',
|
|
2076
|
-
|
|
2084
|
+
flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2077
2085
|
name: UseExcludeSettings
|
|
2078
2086
|
}];
|
|
2079
2087
|
const outside = [];
|
|
@@ -2088,7 +2096,7 @@ const getInputActionsInclude = flags => {
|
|
|
2088
2096
|
icon: MaskIconBook,
|
|
2089
2097
|
title: searchOnlyOpenEditors(),
|
|
2090
2098
|
command: 'searchOnlyOpenEditors',
|
|
2091
|
-
|
|
2099
|
+
flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2092
2100
|
name: SearchOnlyOpenEditors
|
|
2093
2101
|
}];
|
|
2094
2102
|
const outside = [];
|
|
@@ -2098,24 +2106,58 @@ const getInputActionsInclude = flags => {
|
|
|
2098
2106
|
};
|
|
2099
2107
|
};
|
|
2100
2108
|
|
|
2101
|
-
const
|
|
2102
|
-
return mergeClassNames(SearchFieldButton,
|
|
2109
|
+
const getSearchFieldButtonClassName = flag => {
|
|
2110
|
+
return mergeClassNames(SearchFieldButton, flag === CheckBoxEnabled ? SearchFieldButtonChecked : '', flag === ButtonDisabled ? SearchFieldButtonDisabled : '');
|
|
2111
|
+
};
|
|
2112
|
+
|
|
2113
|
+
// TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
|
|
2114
|
+
const getAriaChecked = flag => {
|
|
2115
|
+
switch (flag) {
|
|
2116
|
+
case CheckBoxEnabled:
|
|
2117
|
+
return true;
|
|
2118
|
+
case CheckBoxDisabled:
|
|
2119
|
+
return false;
|
|
2120
|
+
default:
|
|
2121
|
+
return undefined;
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
|
|
2125
|
+
// TODO have have separate renderers for checkbox and button elements
|
|
2126
|
+
const getRole = flag => {
|
|
2127
|
+
switch (flag) {
|
|
2128
|
+
case CheckBoxEnabled:
|
|
2129
|
+
case CheckBoxDisabled:
|
|
2130
|
+
return CheckBox;
|
|
2131
|
+
default:
|
|
2132
|
+
return undefined;
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
const getDisabled = flag => {
|
|
2136
|
+
switch (flag) {
|
|
2137
|
+
case ButtonDisabled:
|
|
2138
|
+
return true;
|
|
2139
|
+
default:
|
|
2140
|
+
return undefined;
|
|
2141
|
+
}
|
|
2103
2142
|
};
|
|
2104
2143
|
const getSearchFieldButtonVirtualDom = button => {
|
|
2105
2144
|
const {
|
|
2106
2145
|
icon,
|
|
2107
|
-
checked,
|
|
2108
2146
|
title,
|
|
2109
2147
|
name,
|
|
2110
|
-
|
|
2148
|
+
flag
|
|
2111
2149
|
} = button;
|
|
2150
|
+
const ariaChecked = getAriaChecked(flag);
|
|
2151
|
+
const role = getRole(flag);
|
|
2152
|
+
const disabled = getDisabled(flag);
|
|
2112
2153
|
return [{
|
|
2113
2154
|
type: Button$1,
|
|
2114
|
-
className:
|
|
2155
|
+
className: getSearchFieldButtonClassName(flag),
|
|
2115
2156
|
name,
|
|
2116
2157
|
title,
|
|
2117
|
-
role
|
|
2118
|
-
ariaChecked
|
|
2158
|
+
role,
|
|
2159
|
+
ariaChecked,
|
|
2160
|
+
disabled,
|
|
2119
2161
|
tabIndex: 0,
|
|
2120
2162
|
childCount: 1
|
|
2121
2163
|
}, {
|
|
@@ -2205,17 +2247,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
|
2205
2247
|
const getInputActionsInput = flags => {
|
|
2206
2248
|
const inside = [{
|
|
2207
2249
|
icon: MaskIconCaseSensitive,
|
|
2208
|
-
|
|
2250
|
+
flag: flags & MatchCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2209
2251
|
title: matchCase(),
|
|
2210
2252
|
name: MatchCase
|
|
2211
2253
|
}, {
|
|
2212
2254
|
icon: MaskIconWholeWord,
|
|
2213
|
-
|
|
2255
|
+
flag: flags & MatchWholeWord$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2214
2256
|
title: matchWholeWord(),
|
|
2215
2257
|
name: MatchWholeWord
|
|
2216
2258
|
}, {
|
|
2217
2259
|
icon: MaskIconRegex,
|
|
2218
|
-
|
|
2260
|
+
flag: flags & UseRegularExpression$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2219
2261
|
title: useRegularExpression(),
|
|
2220
2262
|
name: UseRegularExpression
|
|
2221
2263
|
}];
|
|
@@ -2229,16 +2271,15 @@ const getInputActionsInput = flags => {
|
|
|
2229
2271
|
const getInputActionsReplace = (flags, matchCount) => {
|
|
2230
2272
|
const inside = [{
|
|
2231
2273
|
icon: MaskIconPreserveCase,
|
|
2232
|
-
|
|
2274
|
+
flag: flags & PreserveCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2233
2275
|
title: preserveCase(),
|
|
2234
2276
|
name: PreserveCase
|
|
2235
2277
|
}];
|
|
2236
2278
|
const outside = [{
|
|
2237
2279
|
icon: MaskIconReplaceAll,
|
|
2238
|
-
|
|
2280
|
+
flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
|
|
2239
2281
|
title: replaceAll$1(),
|
|
2240
|
-
name: ReplaceAll
|
|
2241
|
-
disabled: matchCount === 0
|
|
2282
|
+
name: ReplaceAll
|
|
2242
2283
|
}];
|
|
2243
2284
|
return {
|
|
2244
2285
|
inside,
|
|
@@ -2883,7 +2924,8 @@ const handleUpdate = async (state, update) => {
|
|
|
2883
2924
|
root,
|
|
2884
2925
|
query: value,
|
|
2885
2926
|
scheme,
|
|
2886
|
-
flags
|
|
2927
|
+
flags,
|
|
2928
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$1)
|
|
2887
2929
|
}, state.assetDir, state.platform);
|
|
2888
2930
|
if (!Array.isArray(results)) {
|
|
2889
2931
|
throw new TypeError('results must be of type array');
|
|
@@ -3746,6 +3788,45 @@ const doRender = uid => {
|
|
|
3746
3788
|
return commands;
|
|
3747
3789
|
};
|
|
3748
3790
|
|
|
3791
|
+
const renderEventListeners = () => {
|
|
3792
|
+
return [{
|
|
3793
|
+
name: HandleExcludeInput,
|
|
3794
|
+
params: ['handleExcludeInput', 'event.target.value']
|
|
3795
|
+
}, {
|
|
3796
|
+
name: HandleIncludeInput,
|
|
3797
|
+
params: ['handleIncludeInput', 'event.target.value']
|
|
3798
|
+
}, {
|
|
3799
|
+
name: HandleReplaceInput,
|
|
3800
|
+
params: ['handleReplaceInput', 'event.target.value']
|
|
3801
|
+
}, {
|
|
3802
|
+
name: HandleInput,
|
|
3803
|
+
params: ['handleInput', 'event.target.value', User]
|
|
3804
|
+
}, {
|
|
3805
|
+
name: HandleClick,
|
|
3806
|
+
params: ['handleClickAt', 'event.clientX', 'event.clientY']
|
|
3807
|
+
}, {
|
|
3808
|
+
name: HandleToggleButtonClick,
|
|
3809
|
+
params: ['handleClickAt', 'event.clientX', 'event.clientY']
|
|
3810
|
+
}, {
|
|
3811
|
+
name: HandleListFocus,
|
|
3812
|
+
params: ['handleClickAt', 'event.clientX', 'event.clientY']
|
|
3813
|
+
}, {
|
|
3814
|
+
name: HandleListBlur,
|
|
3815
|
+
params: ['handleListBlur']
|
|
3816
|
+
}, {
|
|
3817
|
+
name: HandleContextMenu,
|
|
3818
|
+
params: ['handleContextMenu', 'event.button', 'event.clientX', 'event.clientY'],
|
|
3819
|
+
preventDefault: true
|
|
3820
|
+
}, {
|
|
3821
|
+
name: HandleWheel,
|
|
3822
|
+
params: ['handleContextMenu', 'event.deltaMode', 'event.deltaY'],
|
|
3823
|
+
passive: true
|
|
3824
|
+
}, {
|
|
3825
|
+
name: HandleHeaderClick2,
|
|
3826
|
+
params: ['handleHeaderClick', 'event.target.name']
|
|
3827
|
+
}];
|
|
3828
|
+
};
|
|
3829
|
+
|
|
3749
3830
|
var __defProp = Object.defineProperty;
|
|
3750
3831
|
var __export = (target, all) => {
|
|
3751
3832
|
for (var name in all) __defProp(target, name, {
|
|
@@ -4392,6 +4473,7 @@ const commandMap = {
|
|
|
4392
4473
|
'TextSearch.getFocus': getFocus,
|
|
4393
4474
|
'TextSearch.getKeyBindings': getKeyBindings,
|
|
4394
4475
|
'TextSearch.render': doRender,
|
|
4476
|
+
'TextSearch.renderEventListeners': renderEventListeners,
|
|
4395
4477
|
'TextSearch.renderIncremental': renderIncremental,
|
|
4396
4478
|
'TextSearch.saveState': saveState,
|
|
4397
4479
|
'TextSearch.terminate': terminate,
|