@lvce-editor/find-widget-worker 1.6.0 → 1.7.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.
@@ -859,7 +859,8 @@ const create$2 = () => {
859
859
  const {
860
860
  get: get$1,
861
861
  set: set$1,
862
- wrapCommand
862
+ wrapCommand,
863
+ dispose: dispose$1
863
864
  } = create$2();
864
865
 
865
866
  const Script$1 = 2;
@@ -957,6 +958,10 @@ const diff2 = uid => {
957
958
  return diffResult;
958
959
  };
959
960
 
961
+ const dispose = uid => {
962
+ return dispose$1(uid);
963
+ };
964
+
960
965
  const FocusFindWidgetCloseButton = 48;
961
966
  const FocusFindWidgetReplace = 43;
962
967
  const FocusFindWidgetReplaceAllButton = 47;
@@ -1053,11 +1058,63 @@ const handleBlur = async state => {
1053
1058
  };
1054
1059
  };
1055
1060
 
1056
- const handleClickClose = state => {
1057
- // TODO ask editor worker to dispose widget
1061
+ const rpcs = Object.create(null);
1062
+ const set$a = (id, rpc) => {
1063
+ rpcs[id] = rpc;
1064
+ };
1065
+ const get = id => {
1066
+ return rpcs[id];
1067
+ };
1068
+
1069
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
1070
+
1071
+ const create = rpcId => {
1072
+ return {
1073
+ // @ts-ignore
1074
+ invoke(method, ...params) {
1075
+ const rpc = get(rpcId);
1076
+ // @ts-ignore
1077
+ return rpc.invoke(method, ...params);
1078
+ },
1079
+ // @ts-ignore
1080
+ invokeAndTransfer(method, ...params) {
1081
+ const rpc = get(rpcId);
1082
+ // @ts-ignore
1083
+ return rpc.invokeAndTransfer(method, ...params);
1084
+ },
1085
+ set(rpc) {
1086
+ set$a(rpcId, rpc);
1087
+ }
1088
+ };
1089
+ };
1090
+ const EditorWorker$1 = 99;
1091
+ const {
1092
+ invoke: invoke$9,
1093
+ set: set$9
1094
+ } = create(EditorWorker$1);
1095
+ const EditorWorker = {
1096
+ __proto__: null,
1097
+ invoke: invoke$9,
1098
+ set: set$9
1099
+ };
1100
+
1101
+ const {
1102
+ invoke,
1103
+ set} = EditorWorker;
1104
+
1105
+ const close$1 = async state => {
1106
+ const {
1107
+ editorUid
1108
+ } = state;
1109
+ // @ts-ignore
1110
+ await invoke('Editor.closeFind2', editorUid);
1058
1111
  return state;
1059
1112
  };
1060
1113
 
1114
+ const handleClickClose = state => {
1115
+ return close$1(state);
1116
+ };
1117
+
1061
1118
  const findRegexMatches = (lines, regex) => {
1062
1119
  if (!regex.global) {
1063
1120
  throw new Error('regex must be global');
@@ -1170,50 +1227,6 @@ const getFindWidgetPosition = (editorX, editorY, editorWidth) => {
1170
1227
  };
1171
1228
  };
1172
1229
 
1173
- const rpcs = Object.create(null);
1174
- const set$a = (id, rpc) => {
1175
- rpcs[id] = rpc;
1176
- };
1177
- const get = id => {
1178
- return rpcs[id];
1179
- };
1180
-
1181
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1182
-
1183
- const create = rpcId => {
1184
- return {
1185
- // @ts-ignore
1186
- invoke(method, ...params) {
1187
- const rpc = get(rpcId);
1188
- // @ts-ignore
1189
- return rpc.invoke(method, ...params);
1190
- },
1191
- // @ts-ignore
1192
- invokeAndTransfer(method, ...params) {
1193
- const rpc = get(rpcId);
1194
- // @ts-ignore
1195
- return rpc.invokeAndTransfer(method, ...params);
1196
- },
1197
- set(rpc) {
1198
- set$a(rpcId, rpc);
1199
- }
1200
- };
1201
- };
1202
- const EditorWorker$1 = 99;
1203
- const {
1204
- invoke: invoke$9,
1205
- set: set$9
1206
- } = create(EditorWorker$1);
1207
- const EditorWorker = {
1208
- __proto__: null,
1209
- invoke: invoke$9,
1210
- set: set$9
1211
- };
1212
-
1213
- const {
1214
- invoke,
1215
- set} = EditorWorker;
1216
-
1217
1230
  const getLines = async editorUid => {
1218
1231
  // @ts-ignore
1219
1232
  const lines = await invoke('Editor.getLines2', editorUid);
@@ -1768,6 +1781,7 @@ const terminate = () => {
1768
1781
  const commandMap = {
1769
1782
  'FindWidget.create': create$1,
1770
1783
  'FindWidget.diff2': diff2,
1784
+ 'FindWidget.dispose': dispose,
1771
1785
  'FindWidget.focusCloseButton': wrapCommand(focusCloseButton),
1772
1786
  'FindWidget.focusFirst': wrapCommand(focusFirst),
1773
1787
  'FindWidget.focusIndex': wrapCommand(focusIndex),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",