@lvce-editor/text-search-worker 3.39.0 → 3.40.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 +70 -17
- package/package.json +1 -1
|
@@ -2068,12 +2068,17 @@ const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
|
2068
2068
|
}, ...getSearchMessageVirtualDom(message), ...getSearchDetailsToggleVirtualDom()];
|
|
2069
2069
|
};
|
|
2070
2070
|
|
|
2071
|
+
const CheckBoxEnabled = 1;
|
|
2072
|
+
const CheckBoxDisabled = 2;
|
|
2073
|
+
const ButtonEnabled = 2;
|
|
2074
|
+
const ButtonDisabled = 3;
|
|
2075
|
+
|
|
2071
2076
|
const getInputActionsExclude = flags => {
|
|
2072
2077
|
const inside = [{
|
|
2073
2078
|
icon: MaskIconExclude,
|
|
2074
2079
|
title: useExcludeSettings(),
|
|
2075
2080
|
command: 'toggleUseExcludeSettings',
|
|
2076
|
-
|
|
2081
|
+
flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2077
2082
|
name: UseExcludeSettings
|
|
2078
2083
|
}];
|
|
2079
2084
|
const outside = [];
|
|
@@ -2088,7 +2093,7 @@ const getInputActionsInclude = flags => {
|
|
|
2088
2093
|
icon: MaskIconBook,
|
|
2089
2094
|
title: searchOnlyOpenEditors(),
|
|
2090
2095
|
command: 'searchOnlyOpenEditors',
|
|
2091
|
-
|
|
2096
|
+
flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2092
2097
|
name: SearchOnlyOpenEditors
|
|
2093
2098
|
}];
|
|
2094
2099
|
const outside = [];
|
|
@@ -2098,24 +2103,58 @@ const getInputActionsInclude = flags => {
|
|
|
2098
2103
|
};
|
|
2099
2104
|
};
|
|
2100
2105
|
|
|
2101
|
-
const
|
|
2102
|
-
return mergeClassNames(SearchFieldButton,
|
|
2106
|
+
const getSearchFieldButtonClassName = flag => {
|
|
2107
|
+
return mergeClassNames(SearchFieldButton, flag === CheckBoxEnabled ? SearchFieldButtonChecked : '', flag === ButtonDisabled ? SearchFieldButtonDisabled : '');
|
|
2108
|
+
};
|
|
2109
|
+
|
|
2110
|
+
// TODO maybe move logic to viewmodel, which returns ariaChecked 1 | 2 | 3
|
|
2111
|
+
const getAriaChecked = flag => {
|
|
2112
|
+
switch (flag) {
|
|
2113
|
+
case CheckBoxEnabled:
|
|
2114
|
+
return true;
|
|
2115
|
+
case CheckBoxDisabled:
|
|
2116
|
+
return false;
|
|
2117
|
+
default:
|
|
2118
|
+
return undefined;
|
|
2119
|
+
}
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
// TODO have have separate renderers for checkbox and button elements
|
|
2123
|
+
const getRole = flag => {
|
|
2124
|
+
switch (flag) {
|
|
2125
|
+
case CheckBoxEnabled:
|
|
2126
|
+
case CheckBoxDisabled:
|
|
2127
|
+
return CheckBox;
|
|
2128
|
+
default:
|
|
2129
|
+
return undefined;
|
|
2130
|
+
}
|
|
2131
|
+
};
|
|
2132
|
+
const getDisabled = flag => {
|
|
2133
|
+
switch (flag) {
|
|
2134
|
+
case ButtonDisabled:
|
|
2135
|
+
return true;
|
|
2136
|
+
default:
|
|
2137
|
+
return undefined;
|
|
2138
|
+
}
|
|
2103
2139
|
};
|
|
2104
2140
|
const getSearchFieldButtonVirtualDom = button => {
|
|
2105
2141
|
const {
|
|
2106
2142
|
icon,
|
|
2107
|
-
checked,
|
|
2108
2143
|
title,
|
|
2109
2144
|
name,
|
|
2110
|
-
|
|
2145
|
+
flag
|
|
2111
2146
|
} = button;
|
|
2147
|
+
const ariaChecked = getAriaChecked(flag);
|
|
2148
|
+
const role = getRole(flag);
|
|
2149
|
+
const disabled = getDisabled(flag);
|
|
2112
2150
|
return [{
|
|
2113
2151
|
type: Button$1,
|
|
2114
|
-
className:
|
|
2152
|
+
className: getSearchFieldButtonClassName(flag),
|
|
2115
2153
|
name,
|
|
2116
2154
|
title,
|
|
2117
|
-
role
|
|
2118
|
-
ariaChecked
|
|
2155
|
+
role,
|
|
2156
|
+
ariaChecked,
|
|
2157
|
+
disabled,
|
|
2119
2158
|
tabIndex: 0,
|
|
2120
2159
|
childCount: 1
|
|
2121
2160
|
}, {
|
|
@@ -2205,17 +2244,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
|
2205
2244
|
const getInputActionsInput = flags => {
|
|
2206
2245
|
const inside = [{
|
|
2207
2246
|
icon: MaskIconCaseSensitive,
|
|
2208
|
-
|
|
2247
|
+
flag: flags & MatchCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2209
2248
|
title: matchCase(),
|
|
2210
2249
|
name: MatchCase
|
|
2211
2250
|
}, {
|
|
2212
2251
|
icon: MaskIconWholeWord,
|
|
2213
|
-
|
|
2252
|
+
flag: flags & MatchWholeWord$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2214
2253
|
title: matchWholeWord(),
|
|
2215
2254
|
name: MatchWholeWord
|
|
2216
2255
|
}, {
|
|
2217
2256
|
icon: MaskIconRegex,
|
|
2218
|
-
|
|
2257
|
+
flag: flags & UseRegularExpression$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2219
2258
|
title: useRegularExpression(),
|
|
2220
2259
|
name: UseRegularExpression
|
|
2221
2260
|
}];
|
|
@@ -2229,16 +2268,15 @@ const getInputActionsInput = flags => {
|
|
|
2229
2268
|
const getInputActionsReplace = (flags, matchCount) => {
|
|
2230
2269
|
const inside = [{
|
|
2231
2270
|
icon: MaskIconPreserveCase,
|
|
2232
|
-
|
|
2271
|
+
flag: flags & PreserveCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2233
2272
|
title: preserveCase(),
|
|
2234
2273
|
name: PreserveCase
|
|
2235
2274
|
}];
|
|
2236
2275
|
const outside = [{
|
|
2237
2276
|
icon: MaskIconReplaceAll,
|
|
2238
|
-
|
|
2277
|
+
flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
|
|
2239
2278
|
title: replaceAll$1(),
|
|
2240
|
-
name: ReplaceAll
|
|
2241
|
-
disabled: matchCount === 0
|
|
2279
|
+
name: ReplaceAll
|
|
2242
2280
|
}];
|
|
2243
2281
|
return {
|
|
2244
2282
|
inside,
|
|
@@ -2883,7 +2921,8 @@ const handleUpdate = async (state, update) => {
|
|
|
2883
2921
|
root,
|
|
2884
2922
|
query: value,
|
|
2885
2923
|
scheme,
|
|
2886
|
-
flags
|
|
2924
|
+
flags,
|
|
2925
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$1)
|
|
2887
2926
|
}, state.assetDir, state.platform);
|
|
2888
2927
|
if (!Array.isArray(results)) {
|
|
2889
2928
|
throw new TypeError('results must be of type array');
|
|
@@ -3746,6 +3785,19 @@ const doRender = uid => {
|
|
|
3746
3785
|
return commands;
|
|
3747
3786
|
};
|
|
3748
3787
|
|
|
3788
|
+
const renderEventListeners = () => {
|
|
3789
|
+
return [{
|
|
3790
|
+
name: HandleExcludeInput,
|
|
3791
|
+
params: ['handleExcludeInput', 'event.target.value']
|
|
3792
|
+
}, {
|
|
3793
|
+
name: HandleIncludeInput,
|
|
3794
|
+
params: ['handleIncludeInput', 'event.target.value']
|
|
3795
|
+
}, {
|
|
3796
|
+
name: HandleReplaceInput,
|
|
3797
|
+
params: ['handleReplaceInput', 'event.target.value']
|
|
3798
|
+
}];
|
|
3799
|
+
};
|
|
3800
|
+
|
|
3749
3801
|
var __defProp = Object.defineProperty;
|
|
3750
3802
|
var __export = (target, all) => {
|
|
3751
3803
|
for (var name in all) __defProp(target, name, {
|
|
@@ -4392,6 +4444,7 @@ const commandMap = {
|
|
|
4392
4444
|
'TextSearch.getFocus': getFocus,
|
|
4393
4445
|
'TextSearch.getKeyBindings': getKeyBindings,
|
|
4394
4446
|
'TextSearch.render': doRender,
|
|
4447
|
+
'TextSearch.renderEventListeners': renderEventListeners,
|
|
4395
4448
|
'TextSearch.renderIncremental': renderIncremental,
|
|
4396
4449
|
'TextSearch.saveState': saveState,
|
|
4397
4450
|
'TextSearch.terminate': terminate,
|