@lvce-editor/text-search-worker 3.38.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 +86 -19
- package/package.json +1 -1
|
@@ -509,7 +509,8 @@ class IpcParentWithMessagePort extends Ipc {
|
|
|
509
509
|
this._rawIpc.postMessage(message);
|
|
510
510
|
}
|
|
511
511
|
sendAndTransfer(message) {
|
|
512
|
-
|
|
512
|
+
const transfer = getTransferrables(message);
|
|
513
|
+
this._rawIpc.postMessage(message, transfer);
|
|
513
514
|
}
|
|
514
515
|
dispose() {
|
|
515
516
|
this._rawIpc.close();
|
|
@@ -2067,12 +2068,17 @@ const getSearchHeaderDetailsCollapsedVirtualDom = message => {
|
|
|
2067
2068
|
}, ...getSearchMessageVirtualDom(message), ...getSearchDetailsToggleVirtualDom()];
|
|
2068
2069
|
};
|
|
2069
2070
|
|
|
2071
|
+
const CheckBoxEnabled = 1;
|
|
2072
|
+
const CheckBoxDisabled = 2;
|
|
2073
|
+
const ButtonEnabled = 2;
|
|
2074
|
+
const ButtonDisabled = 3;
|
|
2075
|
+
|
|
2070
2076
|
const getInputActionsExclude = flags => {
|
|
2071
2077
|
const inside = [{
|
|
2072
2078
|
icon: MaskIconExclude,
|
|
2073
2079
|
title: useExcludeSettings(),
|
|
2074
2080
|
command: 'toggleUseExcludeSettings',
|
|
2075
|
-
|
|
2081
|
+
flag: flags & UseIgnoreFiles ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2076
2082
|
name: UseExcludeSettings
|
|
2077
2083
|
}];
|
|
2078
2084
|
const outside = [];
|
|
@@ -2087,7 +2093,7 @@ const getInputActionsInclude = flags => {
|
|
|
2087
2093
|
icon: MaskIconBook,
|
|
2088
2094
|
title: searchOnlyOpenEditors(),
|
|
2089
2095
|
command: 'searchOnlyOpenEditors',
|
|
2090
|
-
|
|
2096
|
+
flag: flags & OpenEditors ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2091
2097
|
name: SearchOnlyOpenEditors
|
|
2092
2098
|
}];
|
|
2093
2099
|
const outside = [];
|
|
@@ -2097,24 +2103,58 @@ const getInputActionsInclude = flags => {
|
|
|
2097
2103
|
};
|
|
2098
2104
|
};
|
|
2099
2105
|
|
|
2100
|
-
const
|
|
2101
|
-
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
|
+
}
|
|
2102
2139
|
};
|
|
2103
2140
|
const getSearchFieldButtonVirtualDom = button => {
|
|
2104
2141
|
const {
|
|
2105
2142
|
icon,
|
|
2106
|
-
checked,
|
|
2107
2143
|
title,
|
|
2108
2144
|
name,
|
|
2109
|
-
|
|
2145
|
+
flag
|
|
2110
2146
|
} = button;
|
|
2147
|
+
const ariaChecked = getAriaChecked(flag);
|
|
2148
|
+
const role = getRole(flag);
|
|
2149
|
+
const disabled = getDisabled(flag);
|
|
2111
2150
|
return [{
|
|
2112
2151
|
type: Button$1,
|
|
2113
|
-
className:
|
|
2152
|
+
className: getSearchFieldButtonClassName(flag),
|
|
2114
2153
|
name,
|
|
2115
2154
|
title,
|
|
2116
|
-
role
|
|
2117
|
-
ariaChecked
|
|
2155
|
+
role,
|
|
2156
|
+
ariaChecked,
|
|
2157
|
+
disabled,
|
|
2118
2158
|
tabIndex: 0,
|
|
2119
2159
|
childCount: 1
|
|
2120
2160
|
}, {
|
|
@@ -2204,17 +2244,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
|
2204
2244
|
const getInputActionsInput = flags => {
|
|
2205
2245
|
const inside = [{
|
|
2206
2246
|
icon: MaskIconCaseSensitive,
|
|
2207
|
-
|
|
2247
|
+
flag: flags & MatchCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2208
2248
|
title: matchCase(),
|
|
2209
2249
|
name: MatchCase
|
|
2210
2250
|
}, {
|
|
2211
2251
|
icon: MaskIconWholeWord,
|
|
2212
|
-
|
|
2252
|
+
flag: flags & MatchWholeWord$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2213
2253
|
title: matchWholeWord(),
|
|
2214
2254
|
name: MatchWholeWord
|
|
2215
2255
|
}, {
|
|
2216
2256
|
icon: MaskIconRegex,
|
|
2217
|
-
|
|
2257
|
+
flag: flags & UseRegularExpression$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2218
2258
|
title: useRegularExpression(),
|
|
2219
2259
|
name: UseRegularExpression
|
|
2220
2260
|
}];
|
|
@@ -2228,16 +2268,15 @@ const getInputActionsInput = flags => {
|
|
|
2228
2268
|
const getInputActionsReplace = (flags, matchCount) => {
|
|
2229
2269
|
const inside = [{
|
|
2230
2270
|
icon: MaskIconPreserveCase,
|
|
2231
|
-
|
|
2271
|
+
flag: flags & PreserveCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
|
|
2232
2272
|
title: preserveCase(),
|
|
2233
2273
|
name: PreserveCase
|
|
2234
2274
|
}];
|
|
2235
2275
|
const outside = [{
|
|
2236
2276
|
icon: MaskIconReplaceAll,
|
|
2237
|
-
|
|
2277
|
+
flag: matchCount === 0 ? ButtonDisabled : ButtonEnabled,
|
|
2238
2278
|
title: replaceAll$1(),
|
|
2239
|
-
name: ReplaceAll
|
|
2240
|
-
disabled: matchCount === 0
|
|
2279
|
+
name: ReplaceAll
|
|
2241
2280
|
}];
|
|
2242
2281
|
return {
|
|
2243
2282
|
inside,
|
|
@@ -2882,7 +2921,8 @@ const handleUpdate = async (state, update) => {
|
|
|
2882
2921
|
root,
|
|
2883
2922
|
query: value,
|
|
2884
2923
|
scheme,
|
|
2885
|
-
flags
|
|
2924
|
+
flags,
|
|
2925
|
+
matchWholeWord: Boolean(flags & MatchWholeWord$1)
|
|
2886
2926
|
}, state.assetDir, state.platform);
|
|
2887
2927
|
if (!Array.isArray(results)) {
|
|
2888
2928
|
throw new TypeError('results must be of type array');
|
|
@@ -3745,6 +3785,19 @@ const doRender = uid => {
|
|
|
3745
3785
|
return commands;
|
|
3746
3786
|
};
|
|
3747
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
|
+
|
|
3748
3801
|
var __defProp = Object.defineProperty;
|
|
3749
3802
|
var __export = (target, all) => {
|
|
3750
3803
|
for (var name in all) __defProp(target, name, {
|
|
@@ -3895,10 +3948,12 @@ var applyPendingPatches = (patches, pendingPatches, skip) => {
|
|
|
3895
3948
|
pendingPatches.length = 0;
|
|
3896
3949
|
};
|
|
3897
3950
|
|
|
3898
|
-
// src/parts/
|
|
3951
|
+
// src/parts/IsKey/IsKey.ts
|
|
3899
3952
|
var isKey = key => {
|
|
3900
3953
|
return key !== "type" && key !== "childCount";
|
|
3901
3954
|
};
|
|
3955
|
+
|
|
3956
|
+
// src/parts/GetKeys/GetKeys.ts
|
|
3902
3957
|
var getKeys = node => {
|
|
3903
3958
|
const keys = Object.keys(node).filter(isKey);
|
|
3904
3959
|
return keys;
|
|
@@ -3930,6 +3985,13 @@ var diff = (oldNodes, newNodes) => {
|
|
|
3930
3985
|
const oldNode = oldNodes[i];
|
|
3931
3986
|
const newNode = newNodes[j];
|
|
3932
3987
|
if (siblingOffset === maxSiblingOffset) {
|
|
3988
|
+
indexStack.pop();
|
|
3989
|
+
indexStack.pop();
|
|
3990
|
+
pendingPatches.push(NavigateParent, 0);
|
|
3991
|
+
maxSiblingOffset = indexStack.pop();
|
|
3992
|
+
siblingOffset = indexStack.pop() + 1;
|
|
3993
|
+
}
|
|
3994
|
+
while (siblingOffset === maxSiblingOffset) {
|
|
3933
3995
|
pendingPatches.push(NavigateParent, 0);
|
|
3934
3996
|
maxSiblingOffset = indexStack.pop();
|
|
3935
3997
|
siblingOffset = indexStack.pop() + 1;
|
|
@@ -3987,6 +4049,9 @@ var diff = (oldNodes, newNodes) => {
|
|
|
3987
4049
|
}
|
|
3988
4050
|
}
|
|
3989
4051
|
if (hasAttributeChanges) {
|
|
4052
|
+
if (siblingOffset > 0) {
|
|
4053
|
+
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
4054
|
+
}
|
|
3990
4055
|
applyPendingPatches(patches, pendingPatches, 0);
|
|
3991
4056
|
for (const key of newKeys) {
|
|
3992
4057
|
if (oldNode[key] !== newNode[key]) {
|
|
@@ -4024,6 +4089,7 @@ var diff = (oldNodes, newNodes) => {
|
|
|
4024
4089
|
}
|
|
4025
4090
|
i += getTotalChildCount(oldNodes, i);
|
|
4026
4091
|
j++;
|
|
4092
|
+
siblingOffset++;
|
|
4027
4093
|
continue;
|
|
4028
4094
|
}
|
|
4029
4095
|
if (newNode.childCount) {
|
|
@@ -4378,6 +4444,7 @@ const commandMap = {
|
|
|
4378
4444
|
'TextSearch.getFocus': getFocus,
|
|
4379
4445
|
'TextSearch.getKeyBindings': getKeyBindings,
|
|
4380
4446
|
'TextSearch.render': doRender,
|
|
4447
|
+
'TextSearch.renderEventListeners': renderEventListeners,
|
|
4381
4448
|
'TextSearch.renderIncremental': renderIncremental,
|
|
4382
4449
|
'TextSearch.saveState': saveState,
|
|
4383
4450
|
'TextSearch.terminate': terminate,
|