@lvce-editor/find-widget-worker 2.2.0 → 2.4.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.
@@ -940,91 +940,6 @@ const terminate = () => {
940
940
  globalThis.close();
941
941
  };
942
942
 
943
- const {
944
- get: get$1,
945
- set: set$3,
946
- wrapCommand,
947
- dispose: dispose$2,
948
- getCommandIds,
949
- registerCommands,
950
- wrapGetter
951
- } = create$2();
952
-
953
- const User$1 = 1;
954
- const Script$1 = 2;
955
- const Unknown = 0;
956
-
957
- const create$1 = (uid, x, y, width, height, parentUid) => {
958
- const state = {
959
- uid,
960
- value: '',
961
- ariaAnnouncement: '',
962
- matches: new Uint32Array(),
963
- matchIndex: -1,
964
- matchCount: 0,
965
- replaceExpanded: false,
966
- useRegularExpression: false,
967
- matchCase: false,
968
- matchWholeWord: false,
969
- replacement: '',
970
- editorUid: parentUid,
971
- x: 0,
972
- y: 0,
973
- width: 0,
974
- height: 0,
975
- focused: false,
976
- focusSource: Unknown,
977
- focus: 0,
978
- version: 0,
979
- lines: [],
980
- selections: [],
981
- editorX: x,
982
- editorY: y,
983
- editorWidth: width,
984
- editorHeight: height,
985
- inputSource: 0,
986
- preserveCase: false,
987
- resizerPointerDown: false,
988
- minWidth: 400,
989
- history: [],
990
- inputErrorMessage: '',
991
- inputHeight: 15,
992
- inputLineHeight: 15,
993
- inputPaddingTop: 2,
994
- inputPaddingBottom: 2
995
- };
996
- set$3(uid, state, state);
997
- return state;
998
- };
999
-
1000
- const isEqual$8 = (oldState, newState) => {
1001
- return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
1002
- };
1003
-
1004
- const isEqual$7 = (oldState, newState) => {
1005
- return newState.width === newState.width && oldState.height === newState.height && oldState.x === newState.x && oldState.inputHeight === newState.inputHeight;
1006
- };
1007
-
1008
- const isEqual$6 = (oldState, newState) => {
1009
- return oldState.version === newState.version;
1010
- };
1011
-
1012
- const isEqual$5 = (oldState, newState) => {
1013
- return oldState.focused === newState.focused && oldState.focus === newState.focus;
1014
- };
1015
-
1016
- const isEqual$4 = (oldState, newState) => {
1017
- return oldState.focused === newState.focused;
1018
- };
1019
-
1020
- const isEqual$3 = (oldState, newState) => {
1021
- return oldState.version === newState.version && oldState.replaceExpanded === newState.replaceExpanded && oldState.matchCount === newState.matchCount && oldState.matchIndex === newState.matchIndex && oldState.matchCase === newState.matchCase && oldState.matchWholeWord === newState.matchWholeWord && oldState.useRegularExpression === newState.useRegularExpression && oldState.preserveCase === newState.preserveCase;
1022
- };
1023
-
1024
- const isEqual$2 = (oldState, newState) => {
1025
- return oldState.version === newState.version;
1026
- };
1027
-
1028
943
  const CheckBox = 'checkbox';
1029
944
  const Group = 'group';
1030
945
  const None = 'none';
@@ -1043,8 +958,8 @@ const Enter = 3;
1043
958
  const KeyF = 34;
1044
959
  const F4 = 60;
1045
960
 
1046
- const User = 1;
1047
- const Script = 2;
961
+ const User$1 = 1;
962
+ const Script$1 = 2;
1048
963
 
1049
964
  const CtrlCmd = 1 << 11 >>> 0;
1050
965
  const Shift = 1 << 10 >>> 0;
@@ -1078,97 +993,33 @@ const FocusSearchWholeWord = 34;
1078
993
  const FocusToggleDetails = 1010;
1079
994
  const FocusToggleReplace = 1020;
1080
995
 
1081
- const isEqual$1 = (oldState, newState) => {
1082
- return newState.inputSource === User || oldState.replacement === newState.replacement;
1083
- };
1084
-
1085
- const RenderBounds = 8;
1086
- const RenderCss = 10;
1087
- const RenderEventListeners = 11;
1088
- const RenderUid = 12;
1089
- const RenderContent = 13;
1090
- const RenderFocusContext = 14;
1091
- const RenderFocus = 15;
1092
- const RenderValue = 16;
1093
- const RenderReplaceValue = 17;
1094
-
1095
- const isEqual = (oldState, newState) => {
1096
- return newState.inputSource === User || oldState.value === newState.value;
1097
- };
1098
-
1099
- const modules = [isEqual$6, isEqual$3, isEqual$8, isEqual$2, isEqual$4, isEqual$5, isEqual, isEqual$1, isEqual$7];
1100
- const numbers = [RenderEventListeners, RenderContent, RenderBounds, RenderUid, RenderFocusContext, RenderFocus, RenderValue, RenderReplaceValue, RenderCss];
1101
-
1102
- const diff = (oldState, newState) => {
1103
- const diffResult = [];
1104
- for (let i = 0; i < modules.length; i++) {
1105
- const fn = modules[i];
1106
- if (!fn(oldState, newState)) {
1107
- diffResult.push(numbers[i]);
1108
- }
1109
- }
1110
- return diffResult;
1111
- };
1112
-
1113
- const diff2 = uid => {
1114
- const {
1115
- oldState,
1116
- newState
1117
- } = get$1(uid);
1118
- const diffResult = diff(oldState, newState);
1119
- return diffResult;
1120
- };
1121
-
1122
- const dispose$1 = uid => {
1123
- return dispose$2(uid);
1124
- };
1125
-
1126
- const FocusFindWidgetCloseButton = 48;
1127
- const FocusFindWidgetReplace = 43;
1128
- const FocusFindWidgetReplaceAllButton = 47;
1129
-
1130
- const setFindWidgetFocus = (state, focusKey) => {
1131
- if (state.focus === focusKey) {
1132
- return state;
1133
- }
1134
- return {
1135
- ...state,
1136
- focus: focusKey,
1137
- focusSource: Script$1
1138
- };
1139
- };
1140
-
1141
- const focusCloseButton = state => {
1142
- return setFindWidgetFocus(state, FocusFindWidgetCloseButton);
1143
- };
1144
-
1145
996
  const rpcs = Object.create(null);
1146
- const set$2 = (id, rpc) => {
997
+ const set$3 = (id, rpc) => {
1147
998
  rpcs[id] = rpc;
1148
999
  };
1149
- const get = id => {
1000
+ const get$1 = id => {
1150
1001
  return rpcs[id];
1151
1002
  };
1152
1003
 
1153
- const create = rpcId => {
1004
+ const create$1 = rpcId => {
1154
1005
  return {
1155
1006
  // @ts-ignore
1156
1007
  invoke(method, ...params) {
1157
- const rpc = get(rpcId);
1008
+ const rpc = get$1(rpcId);
1158
1009
  // @ts-ignore
1159
1010
  return rpc.invoke(method, ...params);
1160
1011
  },
1161
1012
  // @ts-ignore
1162
1013
  invokeAndTransfer(method, ...params) {
1163
- const rpc = get(rpcId);
1014
+ const rpc = get$1(rpcId);
1164
1015
  // @ts-ignore
1165
1016
  return rpc.invokeAndTransfer(method, ...params);
1166
1017
  },
1167
1018
  set(rpc) {
1168
- set$2(rpcId, rpc);
1019
+ set$3(rpcId, rpc);
1169
1020
  },
1170
1021
  async dispose() {
1171
- const rpc = get(rpcId);
1022
+ const rpc = get$1(rpcId);
1172
1023
  await rpc.dispose();
1173
1024
  }
1174
1025
  };
@@ -1177,9 +1028,9 @@ const create = rpcId => {
1177
1028
  const {
1178
1029
  invoke: invoke$1,
1179
1030
  invokeAndTransfer,
1180
- set: set$1,
1181
- dispose
1182
- } = create(EditorWorker$1);
1031
+ set: set$2,
1032
+ dispose: dispose$2
1033
+ } = create$1(EditorWorker$1);
1183
1034
  const sendMessagePortToExtensionHostWorker = async port => {
1184
1035
  const command = 'HandleMessagePort.handleMessagePort2';
1185
1036
  await invokeAndTransfer(
@@ -1249,7 +1100,7 @@ const registerMockRpc = commandMap => {
1249
1100
  const mockRpc = createMockRpc({
1250
1101
  commandMap
1251
1102
  });
1252
- set$1(mockRpc);
1103
+ set$2(mockRpc);
1253
1104
  return mockRpc;
1254
1105
  };
1255
1106
 
@@ -1259,7 +1110,7 @@ const EditorWorker = {
1259
1110
  applyEdit,
1260
1111
  applyWorkspaceEdit,
1261
1112
  closeWidget,
1262
- dispose,
1113
+ dispose: dispose$2,
1263
1114
  getLanguageId,
1264
1115
  getLines: getLines$1,
1265
1116
  getOffsetAtCursor,
@@ -1274,13 +1125,173 @@ const EditorWorker = {
1274
1125
  invokeAndTransfer,
1275
1126
  registerMockRpc,
1276
1127
  sendMessagePortToExtensionHostWorker,
1277
- set: set$1,
1128
+ set: set$2,
1278
1129
  updateDebugInfo
1279
1130
  };
1280
1131
 
1281
1132
  const {
1282
1133
  invoke,
1283
- set} = EditorWorker;
1134
+ set: set$1} = EditorWorker;
1135
+
1136
+ const close$1 = async state => {
1137
+ const {
1138
+ editorUid
1139
+ } = state;
1140
+ // @ts-ignore
1141
+ await invoke('Editor.closeFind2', editorUid);
1142
+ return state;
1143
+ };
1144
+
1145
+ const {
1146
+ get,
1147
+ set,
1148
+ wrapCommand,
1149
+ dispose: dispose$1,
1150
+ getCommandIds,
1151
+ registerCommands,
1152
+ wrapGetter
1153
+ } = create$2();
1154
+
1155
+ const User = 1;
1156
+ const Script = 2;
1157
+ const Unknown = 0;
1158
+
1159
+ const create = (uid, x, y, width, height, parentUid) => {
1160
+ const state = {
1161
+ uid,
1162
+ value: '',
1163
+ ariaAnnouncement: '',
1164
+ matches: new Uint32Array(),
1165
+ matchIndex: -1,
1166
+ matchCount: 0,
1167
+ replaceExpanded: false,
1168
+ useRegularExpression: false,
1169
+ matchCase: false,
1170
+ matchWholeWord: false,
1171
+ replacement: '',
1172
+ editorUid: parentUid,
1173
+ x: 0,
1174
+ y: 0,
1175
+ width: 0,
1176
+ height: 0,
1177
+ focused: false,
1178
+ focusSource: Unknown,
1179
+ focus: 0,
1180
+ version: 0,
1181
+ lines: [],
1182
+ selections: [],
1183
+ editorX: x,
1184
+ editorY: y,
1185
+ editorWidth: width,
1186
+ editorHeight: height,
1187
+ inputSource: 0,
1188
+ preserveCase: false,
1189
+ resizerPointerDown: false,
1190
+ minWidth: 400,
1191
+ history: [],
1192
+ inputErrorMessage: '',
1193
+ searchInputHeight: 15,
1194
+ inputLineHeight: 15,
1195
+ inputPaddingTop: 4,
1196
+ inputPaddingBottom: 4,
1197
+ inputBorderWidth: 1,
1198
+ inputGap: 3
1199
+ };
1200
+ set(uid, state, state);
1201
+ return state;
1202
+ };
1203
+
1204
+ const isEqual$8 = (oldState, newState) => {
1205
+ return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
1206
+ };
1207
+
1208
+ const isEqual$7 = (oldState, newState) => {
1209
+ return newState.width === newState.width && oldState.height === newState.height && oldState.x === newState.x && oldState.searchInputHeight === newState.searchInputHeight;
1210
+ };
1211
+
1212
+ const isEqual$6 = (oldState, newState) => {
1213
+ return oldState.version === newState.version;
1214
+ };
1215
+
1216
+ const isEqual$5 = (oldState, newState) => {
1217
+ return oldState.focused === newState.focused && oldState.focus === newState.focus;
1218
+ };
1219
+
1220
+ const isEqual$4 = (oldState, newState) => {
1221
+ return oldState.focused === newState.focused;
1222
+ };
1223
+
1224
+ const isEqual$3 = (oldState, newState) => {
1225
+ return oldState.version === newState.version && oldState.replaceExpanded === newState.replaceExpanded && oldState.matchCount === newState.matchCount && oldState.matchIndex === newState.matchIndex && oldState.matchCase === newState.matchCase && oldState.matchWholeWord === newState.matchWholeWord && oldState.useRegularExpression === newState.useRegularExpression && oldState.preserveCase === newState.preserveCase;
1226
+ };
1227
+
1228
+ const isEqual$2 = (oldState, newState) => {
1229
+ return oldState.version === newState.version;
1230
+ };
1231
+
1232
+ const isEqual$1 = (oldState, newState) => {
1233
+ return newState.inputSource === User$1 || oldState.replacement === newState.replacement;
1234
+ };
1235
+
1236
+ const RenderBounds = 8;
1237
+ const RenderCss = 10;
1238
+ const RenderEventListeners = 11;
1239
+ const RenderUid = 12;
1240
+ const RenderContent = 13;
1241
+ const RenderFocusContext = 14;
1242
+ const RenderFocus = 15;
1243
+ const RenderValue = 16;
1244
+ const RenderReplaceValue = 17;
1245
+
1246
+ const isEqual = (oldState, newState) => {
1247
+ return newState.inputSource === User$1 || oldState.value === newState.value;
1248
+ };
1249
+
1250
+ const modules = [isEqual$6, isEqual$3, isEqual$8, isEqual$2, isEqual$4, isEqual$5, isEqual, isEqual$1, isEqual$7];
1251
+ const numbers = [RenderEventListeners, RenderContent, RenderBounds, RenderUid, RenderFocusContext, RenderFocus, RenderValue, RenderReplaceValue, RenderCss];
1252
+
1253
+ const diff = (oldState, newState) => {
1254
+ const diffResult = [];
1255
+ for (let i = 0; i < modules.length; i++) {
1256
+ const fn = modules[i];
1257
+ if (!fn(oldState, newState)) {
1258
+ diffResult.push(numbers[i]);
1259
+ }
1260
+ }
1261
+ return diffResult;
1262
+ };
1263
+
1264
+ const diff2 = uid => {
1265
+ const {
1266
+ oldState,
1267
+ newState
1268
+ } = get(uid);
1269
+ const diffResult = diff(oldState, newState);
1270
+ return diffResult;
1271
+ };
1272
+
1273
+ const dispose = uid => {
1274
+ return dispose$1(uid);
1275
+ };
1276
+
1277
+ const FocusFindWidgetCloseButton = 48;
1278
+ const FocusFindWidgetReplace = 43;
1279
+ const FocusFindWidgetReplaceAllButton = 47;
1280
+
1281
+ const setFindWidgetFocus = (state, focusKey) => {
1282
+ if (state.focus === focusKey) {
1283
+ return state;
1284
+ }
1285
+ return {
1286
+ ...state,
1287
+ focus: focusKey,
1288
+ focusSource: Script
1289
+ };
1290
+ };
1291
+
1292
+ const focusCloseButton = state => {
1293
+ return setFindWidgetFocus(state, FocusFindWidgetCloseButton);
1294
+ };
1284
1295
 
1285
1296
  const setSelections = async (editorUid, selections) => {
1286
1297
  // @ts-ignore
@@ -1434,6 +1445,20 @@ const measureTextHeight = (value, lineHeight) => {
1434
1445
  return lines.length * lineHeight;
1435
1446
  };
1436
1447
 
1448
+ const measureInputHeight = (value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded) => {
1449
+ const textHeight = measureTextHeight(value, inputLineHeight);
1450
+ const inputHeight = textHeight + inputPaddingBottom + inputPaddingTop + inputBorderWidth * 2;
1451
+ const replaceInputHeight = replaceExpanded ? inputHeight : 0; // TODO should be independent of input
1452
+ const actualGap = replaceExpanded ? inputGap : 0;
1453
+ // TODO use variables for margin
1454
+ const height = inputHeight + replaceInputHeight + 5 + actualGap;
1455
+ return {
1456
+ inputHeight,
1457
+ height,
1458
+ replaceInputHeight
1459
+ };
1460
+ };
1461
+
1437
1462
  const refresh$1 = (state, value, inputSource) => {
1438
1463
  const {
1439
1464
  lines,
@@ -1442,7 +1467,10 @@ const refresh$1 = (state, value, inputSource) => {
1442
1467
  matchWholeWord,
1443
1468
  inputLineHeight,
1444
1469
  inputPaddingTop,
1445
- inputPaddingBottom
1470
+ inputPaddingBottom,
1471
+ replaceExpanded,
1472
+ inputBorderWidth,
1473
+ inputGap
1446
1474
  } = state;
1447
1475
  const options = {
1448
1476
  matchCase,
@@ -1453,14 +1481,15 @@ const refresh$1 = (state, value, inputSource) => {
1453
1481
  matches,
1454
1482
  error
1455
1483
  } = findMatches(lines, value, options);
1456
- const textHeight = measureTextHeight(value, inputLineHeight);
1457
- const inputHeight = textHeight + inputPaddingBottom + inputPaddingTop;
1458
- const height = inputHeight + 5;
1484
+ const {
1485
+ inputHeight,
1486
+ height
1487
+ } = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded);
1459
1488
  if (error) {
1460
1489
  return {
1461
1490
  ...state,
1462
1491
  inputErrorMessage: error,
1463
- inputHeight,
1492
+ searchInputHeight: inputHeight,
1464
1493
  height
1465
1494
  };
1466
1495
  }
@@ -1468,7 +1497,7 @@ const refresh$1 = (state, value, inputSource) => {
1468
1497
  return {
1469
1498
  ...state,
1470
1499
  inputErrorMessage: error,
1471
- inputHeight,
1500
+ searchInputHeight: inputHeight,
1472
1501
  inputSource,
1473
1502
  matchCount,
1474
1503
  matches,
@@ -1478,7 +1507,7 @@ const refresh$1 = (state, value, inputSource) => {
1478
1507
  };
1479
1508
  };
1480
1509
 
1481
- const refresh = (state, value = state.value, inputSource = User) => {
1510
+ const refresh = (state, value = state.value, inputSource = User$1) => {
1482
1511
  return refresh$1(state, value, inputSource);
1483
1512
  };
1484
1513
 
@@ -1490,7 +1519,7 @@ const toggleMatchCase = state => {
1490
1519
  ...state,
1491
1520
  matchCase: !matchCase
1492
1521
  };
1493
- return refresh(newState, newState.value, User);
1522
+ return refresh(newState, newState.value, User$1);
1494
1523
  };
1495
1524
 
1496
1525
  const toggleMatchWholeWord = state => {
@@ -1501,7 +1530,7 @@ const toggleMatchWholeWord = state => {
1501
1530
  ...state,
1502
1531
  matchWholeWord: !matchWholeWord
1503
1532
  };
1504
- return refresh(newState, newState.value, User);
1533
+ return refresh(newState, newState.value, User$1);
1505
1534
  };
1506
1535
 
1507
1536
  const togglePreserveCase = state => {
@@ -1523,7 +1552,7 @@ const toggleUseRegularExpression = state => {
1523
1552
  ...state,
1524
1553
  useRegularExpression: !useRegularExpression
1525
1554
  };
1526
- return refresh(newState, newState.value, User);
1555
+ return refresh(newState, newState.value, User$1);
1527
1556
  };
1528
1557
 
1529
1558
  const Close$2 = 'Close';
@@ -1635,15 +1664,6 @@ const handleClickButton = async (state, name) => {
1635
1664
  return fn(state);
1636
1665
  };
1637
1666
 
1638
- const close$1 = async state => {
1639
- const {
1640
- editorUid
1641
- } = state;
1642
- // @ts-ignore
1643
- await invoke('Editor.closeFind2', editorUid);
1644
- return state;
1645
- };
1646
-
1647
1667
  const handleClickClose = state => {
1648
1668
  return close$1(state);
1649
1669
  };
@@ -1655,7 +1675,7 @@ const handleFindWidgetFocus = (state, focusKey) => {
1655
1675
  return {
1656
1676
  ...state,
1657
1677
  focus: focusKey,
1658
- focusSource: User$1
1678
+ focusSource: User
1659
1679
  };
1660
1680
  };
1661
1681
 
@@ -1706,23 +1726,24 @@ const handleResizerPointerUp = async (state, eventX, eventY) => {
1706
1726
  };
1707
1727
  };
1708
1728
 
1709
- const getFindWidgetHeight = replaceExpanded => {
1710
- const collapsedHeight = 30;
1711
- const expandedHeight = 60;
1712
- const newHeight = replaceExpanded ? expandedHeight : collapsedHeight;
1713
- return newHeight;
1714
- };
1715
-
1716
1729
  const toggleReplace$1 = state => {
1717
1730
  const {
1718
- replaceExpanded
1731
+ replaceExpanded,
1732
+ value,
1733
+ inputLineHeight,
1734
+ inputPaddingBottom,
1735
+ inputPaddingTop,
1736
+ inputBorderWidth,
1737
+ inputGap
1719
1738
  } = state;
1720
1739
  const newExpanded = !replaceExpanded;
1721
- const newHeight = getFindWidgetHeight(newExpanded);
1740
+ const {
1741
+ height
1742
+ } = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, newExpanded);
1722
1743
  return {
1723
1744
  ...state,
1724
1745
  replaceExpanded: newExpanded,
1725
- height: newHeight
1746
+ height
1726
1747
  };
1727
1748
  };
1728
1749
 
@@ -1730,7 +1751,7 @@ const focusElement = (state, whenExpression) => {
1730
1751
  return {
1731
1752
  ...state,
1732
1753
  focus: whenExpression,
1733
- focusSource: Script
1754
+ focusSource: Script$1
1734
1755
  };
1735
1756
  };
1736
1757
 
@@ -1904,11 +1925,11 @@ const getKeyBindings = () => {
1904
1925
  }];
1905
1926
  };
1906
1927
 
1907
- const handleInput = (state, value, inputSource = User) => {
1928
+ const handleInput = (state, value, inputSource = User$1) => {
1908
1929
  return refresh(state, value, inputSource);
1909
1930
  };
1910
1931
 
1911
- const handleReplaceInput = (state, value, inputSource = User) => {
1932
+ const handleReplaceInput = (state, value, inputSource = User$1) => {
1912
1933
  return {
1913
1934
  ...state,
1914
1935
  replacement: value,
@@ -1995,7 +2016,12 @@ const loadContent = async (state, savedState) => {
1995
2016
  editorWidth,
1996
2017
  editorX,
1997
2018
  editorY,
1998
- inputLineHeight
2019
+ inputLineHeight,
2020
+ inputPaddingBottom,
2021
+ inputPaddingTop,
2022
+ replaceExpanded,
2023
+ inputBorderWidth,
2024
+ inputGap
1999
2025
  } = state;
2000
2026
  const {
2001
2027
  replacement,
@@ -2006,8 +2032,7 @@ const loadContent = async (state, savedState) => {
2006
2032
  const {
2007
2033
  x,
2008
2034
  y,
2009
- width,
2010
- height
2035
+ width
2011
2036
  } = getFindWidgetPosition(editorX, editorY, editorWidth);
2012
2037
  if (lines.length === 0) {
2013
2038
  return state;
@@ -2015,19 +2040,22 @@ const loadContent = async (state, savedState) => {
2015
2040
  const actualValue = value || getSelectedText(lines, selections);
2016
2041
  const matches = findMatchesCaseInsensitive(lines, actualValue);
2017
2042
  const matchCount = getMatchCount(matches);
2018
- const inputHeight = measureTextHeight(value, inputLineHeight);
2043
+ const {
2044
+ inputHeight,
2045
+ height
2046
+ } = measureInputHeight(value, inputLineHeight, inputPaddingBottom, inputPaddingTop, inputBorderWidth, inputGap, replaceExpanded);
2019
2047
  return {
2020
2048
  ...state,
2021
2049
  focus: FocusSearchInput,
2022
2050
  focused: true,
2023
2051
  height,
2024
- inputHeight,
2025
- inputSource: Script,
2052
+ inputSource: Script$1,
2026
2053
  lines,
2027
2054
  matchCount,
2028
2055
  matches,
2029
2056
  matchIndex: 0,
2030
2057
  replacement,
2058
+ searchInputHeight: inputHeight,
2031
2059
  selections,
2032
2060
  value: actualValue,
2033
2061
  version: 1,
@@ -2483,7 +2511,7 @@ const renderCss = (oldState, newState) => {
2483
2511
  height,
2484
2512
  x,
2485
2513
  y,
2486
- inputHeight
2514
+ searchInputHeight: inputHeight
2487
2515
  } = newState;
2488
2516
  const css = `:root {
2489
2517
  --FindWidgetWidth: ${width}px;
@@ -2607,7 +2635,7 @@ const renderReplaceValue = (oldState, newState) => {
2607
2635
  uid,
2608
2636
  replacement
2609
2637
  } = newState;
2610
- return [SetValueByName, uid, Replace$2, replacement];
2638
+ return [SetValueByName, uid, ReplaceValue, replacement];
2611
2639
  };
2612
2640
 
2613
2641
  const renderUid = (oldState, newState) => {
@@ -2664,8 +2692,8 @@ const render2 = (uid, diffResult) => {
2664
2692
  const {
2665
2693
  oldState,
2666
2694
  newState
2667
- } = get$1(uid);
2668
- set$3(uid, newState, newState);
2695
+ } = get(uid);
2696
+ set(uid, newState, newState);
2669
2697
  const commands = applyRender(oldState, newState, diffResult);
2670
2698
  return commands;
2671
2699
  };
@@ -2696,9 +2724,10 @@ const saveState = state => {
2696
2724
  };
2697
2725
 
2698
2726
  const commandMap = {
2699
- 'FindWidget.create': create$1,
2727
+ 'FindWidget.create': create,
2700
2728
  'FindWidget.diff2': diff2,
2701
- 'FindWidget.dispose': dispose$1,
2729
+ 'FindWidget.close': wrapCommand(close$1),
2730
+ 'FindWidget.dispose': dispose,
2702
2731
  'FindWidget.focusCloseButton': wrapCommand(focusCloseButton),
2703
2732
  'FindWidget.focusElement': wrapCommand(focusElement),
2704
2733
  'FindWidget.focusFirst': wrapCommand(focusFirst),
@@ -2732,7 +2761,8 @@ const commandMap = {
2732
2761
  'FindWidget.toggleMatchCase': wrapCommand(toggleMatchCase),
2733
2762
  'FindWidget.toggleReplace': wrapCommand(toggleReplace$1),
2734
2763
  'FindWidget.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
2735
- 'FindWidget.togglePreserveCase': wrapCommand(togglePreserveCase)
2764
+ 'FindWidget.togglePreserveCase': wrapCommand(togglePreserveCase),
2765
+ 'FindWidget.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord)
2736
2766
  };
2737
2767
 
2738
2768
  const listen = async () => {
@@ -2740,7 +2770,7 @@ const listen = async () => {
2740
2770
  const rpc = await WebWorkerRpcClient.create({
2741
2771
  commandMap: commandMap
2742
2772
  });
2743
- set(rpc);
2773
+ set$1(rpc);
2744
2774
  };
2745
2775
 
2746
2776
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",