@lvce-editor/text-search-worker 6.3.0 → 6.5.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.
@@ -632,12 +632,12 @@ const getErrorConstructor = (message, type) => {
632
632
  switch (type) {
633
633
  case DomException:
634
634
  return DOMException;
635
- case TypeError$1:
636
- return TypeError;
637
- case SyntaxError$1:
638
- return SyntaxError;
639
635
  case ReferenceError$1:
640
636
  return ReferenceError;
637
+ case SyntaxError$1:
638
+ return SyntaxError;
639
+ case TypeError$1:
640
+ return TypeError;
641
641
  default:
642
642
  return Error;
643
643
  }
@@ -793,27 +793,27 @@ const getErrorProperty = (error, prettyError) => {
793
793
  if (error && error.code === E_COMMAND_NOT_FOUND) {
794
794
  return {
795
795
  code: MethodNotFound,
796
- message: error.message,
797
- data: error.stack
796
+ data: error.stack,
797
+ message: error.message
798
798
  };
799
799
  }
800
800
  return {
801
801
  code: Custom,
802
- message: prettyError.message,
803
802
  data: {
804
- stack: getStack(prettyError),
805
- codeFrame: prettyError.codeFrame,
806
- type: getErrorType(prettyError),
807
803
  code: prettyError.code,
808
- name: prettyError.name
809
- }
804
+ codeFrame: prettyError.codeFrame,
805
+ name: prettyError.name,
806
+ stack: getStack(prettyError),
807
+ type: getErrorType(prettyError)
808
+ },
809
+ message: prettyError.message
810
810
  };
811
811
  };
812
812
  const create$1$1 = (id, error) => {
813
813
  return {
814
- jsonrpc: Two$1,
814
+ error,
815
815
  id,
816
- error
816
+ jsonrpc: Two$1
817
817
  };
818
818
  };
819
819
  const getErrorResponse = (id, error, preparePrettyError, logError) => {
@@ -824,8 +824,8 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
824
824
  };
825
825
  const create$e = (message, result) => {
826
826
  return {
827
- jsonrpc: Two$1,
828
827
  id: message.id,
828
+ jsonrpc: Two$1,
829
829
  result: result ?? null
830
830
  };
831
831
  };
@@ -835,14 +835,14 @@ const getSuccessResponse = (message, result) => {
835
835
  };
836
836
  const getErrorResponseSimple = (id, error) => {
837
837
  return {
838
- jsonrpc: Two$1,
839
- id,
840
838
  error: {
841
839
  code: Custom,
840
+ data: error,
842
841
  // @ts-ignore
843
- message: error.message,
844
- data: error
845
- }
842
+ message: error.message
843
+ },
844
+ id,
845
+ jsonrpc: Two$1
846
846
  };
847
847
  };
848
848
  const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
@@ -872,35 +872,35 @@ const normalizeParams = args => {
872
872
  if (args.length === 1) {
873
873
  const options = args[0];
874
874
  return {
875
+ execute: options.execute,
875
876
  ipc: options.ipc,
877
+ logError: options.logError || defaultLogError,
876
878
  message: options.message,
877
- execute: options.execute,
878
- resolve: options.resolve || defaultResolve,
879
879
  preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
880
- logError: options.logError || defaultLogError,
881
- requiresSocket: options.requiresSocket || defaultRequiresSocket
880
+ requiresSocket: options.requiresSocket || defaultRequiresSocket,
881
+ resolve: options.resolve || defaultResolve
882
882
  };
883
883
  }
884
884
  return {
885
+ execute: args[2],
885
886
  ipc: args[0],
887
+ logError: args[5],
886
888
  message: args[1],
887
- execute: args[2],
888
- resolve: args[3],
889
889
  preparePrettyError: args[4],
890
- logError: args[5],
891
- requiresSocket: args[6]
890
+ requiresSocket: args[6],
891
+ resolve: args[3]
892
892
  };
893
893
  };
894
894
  const handleJsonRpcMessage = async (...args) => {
895
895
  const options = normalizeParams(args);
896
896
  const {
897
- message,
898
- ipc,
899
897
  execute,
900
- resolve,
901
- preparePrettyError,
898
+ ipc,
902
899
  logError,
903
- requiresSocket
900
+ message,
901
+ preparePrettyError,
902
+ requiresSocket,
903
+ resolve
904
904
  } = options;
905
905
  if ('id' in message) {
906
906
  if ('method' in message) {
@@ -961,7 +961,6 @@ const registerPromise = map => {
961
961
  };
962
962
  };
963
963
 
964
- // @ts-ignore
965
964
  const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
966
965
  const {
967
966
  id,
@@ -1043,6 +1042,41 @@ const listen$1 = async (module, options) => {
1043
1042
  return ipc;
1044
1043
  };
1045
1044
 
1045
+ const create$a = async ({
1046
+ commandMap,
1047
+ isMessagePortOpen = true,
1048
+ messagePort
1049
+ }) => {
1050
+ // TODO create a commandMap per rpc instance
1051
+ register(commandMap);
1052
+ const rawIpc = await IpcParentWithMessagePort$1.create({
1053
+ isMessagePortOpen,
1054
+ messagePort
1055
+ });
1056
+ const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
1057
+ handleIpc(ipc);
1058
+ const rpc = createRpc(ipc);
1059
+ messagePort.start();
1060
+ return rpc;
1061
+ };
1062
+
1063
+ const create$9 = async ({
1064
+ commandMap,
1065
+ isMessagePortOpen,
1066
+ send
1067
+ }) => {
1068
+ const {
1069
+ port1,
1070
+ port2
1071
+ } = new MessageChannel();
1072
+ await send(port1);
1073
+ return create$a({
1074
+ commandMap,
1075
+ isMessagePortOpen,
1076
+ messagePort: port2
1077
+ });
1078
+ };
1079
+
1046
1080
  const createSharedLazyRpc = factory => {
1047
1081
  let rpcPromise;
1048
1082
  const getOrCreate = () => {
@@ -1071,13 +1105,13 @@ const createSharedLazyRpc = factory => {
1071
1105
  };
1072
1106
  };
1073
1107
 
1074
- const create$a = async ({
1108
+ const create$8 = async ({
1075
1109
  commandMap,
1076
1110
  isMessagePortOpen,
1077
1111
  send
1078
1112
  }) => {
1079
1113
  return createSharedLazyRpc(() => {
1080
- return create$5({
1114
+ return create$9({
1081
1115
  commandMap,
1082
1116
  isMessagePortOpen,
1083
1117
  send
@@ -1105,7 +1139,7 @@ const getProtocol$1 = () => {
1105
1139
  return location.protocol;
1106
1140
  };
1107
1141
 
1108
- const create$9 = async ({
1142
+ const create$7 = async ({
1109
1143
  commandMap,
1110
1144
  webSocket
1111
1145
  }) => {
@@ -1120,7 +1154,7 @@ const create$9 = async ({
1120
1154
  return rpc;
1121
1155
  };
1122
1156
 
1123
- const create$8 = async ({
1157
+ const create$6 = async ({
1124
1158
  commandMap,
1125
1159
  type
1126
1160
  }) => {
@@ -1128,60 +1162,25 @@ const create$8 = async ({
1128
1162
  const protocol = getProtocol$1();
1129
1163
  const wsUrl = getWebSocketUrl(type, host, protocol);
1130
1164
  const webSocket = new WebSocket(wsUrl);
1131
- const rpc = await create$9({
1165
+ const rpc = await create$7({
1132
1166
  commandMap,
1133
1167
  webSocket
1134
1168
  });
1135
1169
  return rpc;
1136
1170
  };
1137
1171
 
1138
- const create$7 = async ({
1172
+ const create$5 = async ({
1139
1173
  commandMap,
1140
1174
  type
1141
1175
  }) => {
1142
1176
  return createSharedLazyRpc(() => {
1143
- return create$8({
1177
+ return create$6({
1144
1178
  commandMap,
1145
1179
  type
1146
1180
  });
1147
1181
  });
1148
1182
  };
1149
1183
 
1150
- const create$6 = async ({
1151
- commandMap,
1152
- isMessagePortOpen = true,
1153
- messagePort
1154
- }) => {
1155
- // TODO create a commandMap per rpc instance
1156
- register(commandMap);
1157
- const rawIpc = await IpcParentWithMessagePort$1.create({
1158
- isMessagePortOpen,
1159
- messagePort
1160
- });
1161
- const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
1162
- handleIpc(ipc);
1163
- const rpc = createRpc(ipc);
1164
- messagePort.start();
1165
- return rpc;
1166
- };
1167
-
1168
- const create$5 = async ({
1169
- commandMap,
1170
- isMessagePortOpen,
1171
- send
1172
- }) => {
1173
- const {
1174
- port1,
1175
- port2
1176
- } = new MessageChannel();
1177
- await send(port1);
1178
- return create$6({
1179
- commandMap,
1180
- isMessagePortOpen,
1181
- messagePort: port2
1182
- });
1183
- };
1184
-
1185
1184
  const create$4 = async ({
1186
1185
  commandMap
1187
1186
  }) => {
@@ -1193,141 +1192,6 @@ const create$4 = async ({
1193
1192
  return rpc;
1194
1193
  };
1195
1194
 
1196
- const Alert = 'alert';
1197
- const Button$3 = 'button';
1198
- const CheckBox = 'checkbox';
1199
- const None$2 = 'none';
1200
- const ScrollBar$1 = 'scrollbar';
1201
- const Status = 'status';
1202
- const ToolBar = 'toolbar';
1203
- const Tree$1 = 'tree';
1204
- const TreeItem$1 = 'treeitem';
1205
-
1206
- const Actions = 'Actions';
1207
- const Badge = 'Badge';
1208
- const Chevron = 'Chevron';
1209
- const CloseMaskIcon = 'MaskIcon MaskIconClose';
1210
- const Empty$1 = '';
1211
- const FileIcon = 'FileIcon';
1212
- const FocusOutline = 'FocusOutline';
1213
- const Grow = 'Grow';
1214
- const Highlight = 'Highlight';
1215
- const HighlightDeleted = 'HighlightDeleted';
1216
- const HighlightInserted = 'HighlightInserted';
1217
- const IconButton = 'IconButton';
1218
- const IconButtonDisabled = 'IconButtonDisabled';
1219
- const Label = 'Label';
1220
- const List$1 = 'List';
1221
- const MaskIcon = 'MaskIcon';
1222
- const MaskIconBook = 'MaskIconBook';
1223
- const MaskIconCaseSensitive = 'MaskIconCaseSensitive';
1224
- const MaskIconChevronDown = 'MaskIconChevronDown';
1225
- const MaskIconChevronRight = 'MaskIconChevronRight';
1226
- const MaskIconEllipsis = 'MaskIconEllipsis';
1227
- const MaskIconExclude = 'MaskIconExclude';
1228
- const MaskIconPreserveCase = 'MaskIconPreserveCase';
1229
- const MaskIconRegex = 'MaskIconRegex';
1230
- const MaskIconReplaceAll = 'MaskIconReplaceAll';
1231
- const MaskIconWholeWord = 'MaskIconWholeWord';
1232
- const MultilineInputBox = 'MultilineInputBox';
1233
- const ScrollBar = 'ScrollBar';
1234
- const ScrollBarThumb = 'ScrollBarThumb';
1235
- const ScrollBarVertical = 'ScrollBarVertical';
1236
- const Search$2 = 'Search';
1237
- const SearchField = 'SearchField';
1238
- const SearchFieldButton = 'SearchFieldButton';
1239
- const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
1240
- const SearchFieldButtonDisabled = 'SearchFieldButtonDisabled';
1241
- const SearchFieldButtons = 'SearchFieldButtons';
1242
- const SearchFieldContainer = 'SearchFieldContainer';
1243
- const SearchFieldError = 'SearchFieldError';
1244
- const SearchHeader = 'SearchHeader';
1245
- const SearchHeaderDetails = 'SearchHeaderDetails';
1246
- const SearchHeaderDetailsExpanded = 'SearchHeaderDetailsExpanded';
1247
- const SearchHeaderDetailsExpandedTop = 'SearchHeaderDetailsExpandedTop';
1248
- const SearchHeaderDetailsHeading = 'SearchHeaderDetailsHeading';
1249
- const SearchHeaderTop = 'SearchHeaderTop';
1250
- const SearchHeaderTopRight = 'SearchHeaderTopRight';
1251
- const SearchInputError = 'SearchInputError';
1252
- const SearchRemove = 'SearchRemove';
1253
- const SearchToggleButton = 'SearchToggleButton';
1254
- const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
1255
- const SourceControlBadge = 'SourceControlBadge';
1256
- const ToggleDetails = 'ToggleDetails';
1257
- const Tree = 'Tree';
1258
- const TreeItem = 'TreeItem';
1259
- const TreeItemActive = 'TreeItemActive';
1260
- const TreeItems$1 = 'TreeItems';
1261
- const Viewlet = 'Viewlet';
1262
- const ViewletSearchMessage = 'ViewletSearchMessage';
1263
- const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
1264
-
1265
- const File$2 = 7;
1266
-
1267
- const Button$2 = 1;
1268
- const Div = 4;
1269
- const Span = 8;
1270
- const Text = 12;
1271
- const Img = 17;
1272
- const Ins = 20;
1273
- const Del = 21;
1274
- const H4 = 24;
1275
- const TextArea = 62;
1276
- const Reference = 100;
1277
-
1278
- const Button$1 = 'event.button';
1279
- const ClientX = 'event.clientX';
1280
- const ClientY = 'event.clientY';
1281
- const DeltaMode = 'event.deltaMode';
1282
- const DeltaY = 'event.deltaY';
1283
- const TargetName = 'event.target.name';
1284
- const TargetSelectionEnd = 'event.target.selectionEnd';
1285
- const TargetSelectionStart = 'event.target.selectionStart';
1286
- const TargetValue = 'event.target.value';
1287
-
1288
- const Script$1 = 2;
1289
-
1290
- const Search$1 = 18;
1291
- const InputContextMenu = 91;
1292
-
1293
- const Separator = 1;
1294
- const None$1 = 0;
1295
-
1296
- const LeftClick = 0;
1297
-
1298
- const Electron = 2;
1299
- const Remote = 3;
1300
-
1301
- const IconThemeWorker = 7009;
1302
- const RendererWorker = 1;
1303
- const SearchProcess = 77;
1304
-
1305
- const File$1 = 1;
1306
- const Match$1 = 2;
1307
-
1308
- const FocusElementByName = 'Viewlet.focusElementByName';
1309
- const SetCss = 'Viewlet.setCss';
1310
- const SetDom2 = 'Viewlet.setDom2';
1311
- const SetFocusContext = 'Viewlet.setFocusContext';
1312
- const SetValueByName = 'Viewlet.setValueByName';
1313
-
1314
- const Empty = 0;
1315
- const FocusIgnoreFiles = 1012;
1316
- const FocusSearch = 1013;
1317
- const FocusSearchExcludeInput = 1008;
1318
- const FocusSearchIncludeInput = 1007;
1319
- const FocusSearchInput = 21;
1320
- const FocusSearchMatchCase = 32;
1321
- const FocusSearchOpenEditors = 1011;
1322
- const FocusSearchPreserveCase = 36;
1323
- const FocusSearchRegex = 33;
1324
- const FocusSearchReplaceAll = 35;
1325
- const FocusSearchReplaceInput = 31;
1326
- const FocusSearchResults = 22;
1327
- const FocusSearchWholeWord = 34;
1328
- const FocusToggleDetails = 1010;
1329
- const FocusToggleReplace = 1020;
1330
-
1331
1195
  const createMockRpc = ({
1332
1196
  commandMap
1333
1197
  }) => {
@@ -1396,6 +1260,56 @@ const create$3 = rpcId => {
1396
1260
  };
1397
1261
  };
1398
1262
 
1263
+ const Alert = 'alert';
1264
+ const Button$3 = 'button';
1265
+ const CheckBox = 'checkbox';
1266
+ const None$2 = 'none';
1267
+ const ScrollBar$1 = 'scrollbar';
1268
+ const Status = 'status';
1269
+ const ToolBar = 'toolbar';
1270
+ const Tree$1 = 'tree';
1271
+ const TreeItem$1 = 'treeitem';
1272
+
1273
+ const File$2 = 7;
1274
+
1275
+ const Button$2 = 'event.button';
1276
+ const ClientX = 'event.clientX';
1277
+ const ClientY = 'event.clientY';
1278
+ const DeltaMode = 'event.deltaMode';
1279
+ const DeltaY = 'event.deltaY';
1280
+ const TargetName = 'event.target.name';
1281
+ const TargetSelectionEnd = 'event.target.selectionEnd';
1282
+ const TargetSelectionStart = 'event.target.selectionStart';
1283
+ const TargetValue = 'event.target.value';
1284
+
1285
+ const Script$1 = 2;
1286
+
1287
+ const Search$2 = 18;
1288
+ const InputContextMenu = 91;
1289
+
1290
+ const Separator = 1;
1291
+ const None$1 = 0;
1292
+
1293
+ const LeftClick = 0;
1294
+
1295
+ const Electron = 2;
1296
+ const Remote = 3;
1297
+
1298
+ const IconThemeWorker = 7009;
1299
+ const RendererWorker = 1;
1300
+ const SearchProcess = 77;
1301
+
1302
+ const File$1 = 1;
1303
+ const Match$1 = 2;
1304
+
1305
+ const FocusElementByName = 'Viewlet.focusElementByName';
1306
+ const SetCss = 'Viewlet.setCss';
1307
+ const SetFocusContext = 'Viewlet.setFocusContext';
1308
+ const SetValueByName = 'Viewlet.setValueByName';
1309
+ const SetPatches = 'Viewlet.setPatches';
1310
+
1311
+ const FocusSearch$1 = 1013;
1312
+
1399
1313
  const {
1400
1314
  invoke: invoke$2,
1401
1315
  set: set$3
@@ -1482,7 +1396,7 @@ const create$2 = () => {
1482
1396
  },
1483
1397
  getKeys() {
1484
1398
  return Object.keys(states).map(key => {
1485
- return Number.parseInt(key);
1399
+ return Number.parseFloat(key);
1486
1400
  });
1487
1401
  },
1488
1402
  registerCommands(commandMap) {
@@ -1524,6 +1438,37 @@ const create$2 = () => {
1524
1438
  return fn(newState, ...args);
1525
1439
  };
1526
1440
  return wrapped;
1441
+ },
1442
+ wrapLoadContent(fn) {
1443
+ const wrapped = async (uid, ...args) => {
1444
+ const {
1445
+ newState,
1446
+ oldState
1447
+ } = states[uid];
1448
+ const result = await fn(newState, ...args);
1449
+ const {
1450
+ error,
1451
+ state
1452
+ } = result;
1453
+ if (oldState === state || newState === state) {
1454
+ return {
1455
+ error
1456
+ };
1457
+ }
1458
+ const latestOld = states[uid];
1459
+ const latestNew = {
1460
+ ...latestOld.newState,
1461
+ ...state
1462
+ };
1463
+ states[uid] = {
1464
+ newState: latestNew,
1465
+ oldState: latestOld.oldState
1466
+ };
1467
+ return {
1468
+ error
1469
+ };
1470
+ };
1471
+ return wrapped;
1527
1472
  }
1528
1473
  };
1529
1474
  };
@@ -1531,6 +1476,93 @@ const terminate = () => {
1531
1476
  globalThis.close();
1532
1477
  };
1533
1478
 
1479
+ const Actions = 'Actions';
1480
+ const Badge = 'Badge';
1481
+ const Chevron = 'Chevron';
1482
+ const CloseMaskIcon = 'MaskIcon MaskIconClose';
1483
+ const Empty$1 = '';
1484
+ const FileIcon = 'FileIcon';
1485
+ const FocusOutline = 'FocusOutline';
1486
+ const Grow = 'Grow';
1487
+ const Highlight = 'Highlight';
1488
+ const HighlightDeleted = 'HighlightDeleted';
1489
+ const HighlightInserted = 'HighlightInserted';
1490
+ const IconButton = 'IconButton';
1491
+ const IconButtonDisabled = 'IconButtonDisabled';
1492
+ const Label = 'Label';
1493
+ const List$1 = 'List';
1494
+ const MaskIcon = 'MaskIcon';
1495
+ const MaskIconBook = 'MaskIconBook';
1496
+ const MaskIconCaseSensitive = 'MaskIconCaseSensitive';
1497
+ const MaskIconChevronDown = 'MaskIconChevronDown';
1498
+ const MaskIconChevronRight = 'MaskIconChevronRight';
1499
+ const MaskIconEllipsis = 'MaskIconEllipsis';
1500
+ const MaskIconExclude = 'MaskIconExclude';
1501
+ const MaskIconPreserveCase = 'MaskIconPreserveCase';
1502
+ const MaskIconRegex = 'MaskIconRegex';
1503
+ const MaskIconReplaceAll = 'MaskIconReplaceAll';
1504
+ const MaskIconWholeWord = 'MaskIconWholeWord';
1505
+ const MultilineInputBox = 'MultilineInputBox';
1506
+ const ScrollBar = 'ScrollBar';
1507
+ const ScrollBarThumb = 'ScrollBarThumb';
1508
+ const ScrollBarVertical = 'ScrollBarVertical';
1509
+ const Search$1 = 'Search';
1510
+ const SearchField = 'SearchField';
1511
+ const SearchFieldButton = 'SearchFieldButton';
1512
+ const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
1513
+ const SearchFieldButtonDisabled = 'SearchFieldButtonDisabled';
1514
+ const SearchFieldButtons = 'SearchFieldButtons';
1515
+ const SearchFieldContainer = 'SearchFieldContainer';
1516
+ const SearchFieldError = 'SearchFieldError';
1517
+ const SearchHeader = 'SearchHeader';
1518
+ const SearchHeaderDetails = 'SearchHeaderDetails';
1519
+ const SearchHeaderDetailsExpanded = 'SearchHeaderDetailsExpanded';
1520
+ const SearchHeaderDetailsExpandedTop = 'SearchHeaderDetailsExpandedTop';
1521
+ const SearchHeaderDetailsHeading = 'SearchHeaderDetailsHeading';
1522
+ const SearchHeaderTop = 'SearchHeaderTop';
1523
+ const SearchHeaderTopRight = 'SearchHeaderTopRight';
1524
+ const SearchInputError = 'SearchInputError';
1525
+ const SearchRemove = 'SearchRemove';
1526
+ const SearchToggleButton = 'SearchToggleButton';
1527
+ const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
1528
+ const SourceControlBadge = 'SourceControlBadge';
1529
+ const ToggleDetails = 'ToggleDetails';
1530
+ const Tree = 'Tree';
1531
+ const TreeItem = 'TreeItem';
1532
+ const TreeItemActive = 'TreeItemActive';
1533
+ const TreeItems$1 = 'TreeItems';
1534
+ const Viewlet = 'Viewlet';
1535
+ const ViewletSearchMessage = 'ViewletSearchMessage';
1536
+ const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
1537
+
1538
+ const Button$1 = 1;
1539
+ const Div = 4;
1540
+ const Span = 8;
1541
+ const Text = 12;
1542
+ const Img = 17;
1543
+ const Ins = 20;
1544
+ const Del = 21;
1545
+ const H4 = 24;
1546
+ const TextArea = 62;
1547
+ const Reference = 100;
1548
+
1549
+ const Empty = 0;
1550
+ const FocusIgnoreFiles = 1012;
1551
+ const FocusSearch = 1013;
1552
+ const FocusSearchExcludeInput = 1008;
1553
+ const FocusSearchIncludeInput = 1007;
1554
+ const FocusSearchInput = 21;
1555
+ const FocusSearchMatchCase = 32;
1556
+ const FocusSearchOpenEditors = 1011;
1557
+ const FocusSearchPreserveCase = 36;
1558
+ const FocusSearchRegex = 33;
1559
+ const FocusSearchReplaceAll = 35;
1560
+ const FocusSearchReplaceInput = 31;
1561
+ const FocusSearchResults = 22;
1562
+ const FocusSearchWholeWord = 34;
1563
+ const FocusToggleDetails = 1010;
1564
+ const FocusToggleReplace = 1020;
1565
+
1534
1566
  const mergeClassNames = (...classNames) => {
1535
1567
  return classNames.filter(Boolean).join(' ');
1536
1568
  };
@@ -2026,15 +2058,38 @@ const hasUseIgnoreFiles = flags => {
2026
2058
  return (flags & UseIgnoreFiles) === UseIgnoreFiles;
2027
2059
  };
2028
2060
 
2061
+ const getTopHeight = flags => {
2062
+ if (flags & ReplaceExpanded && flags & DetailsExpanded) {
2063
+ return 190;
2064
+ }
2065
+ if (flags & DetailsExpanded) {
2066
+ return 158;
2067
+ }
2068
+ if (flags & ReplaceExpanded) {
2069
+ return 93;
2070
+ }
2071
+ return 61;
2072
+ };
2073
+
2074
+ const getHeaderHeightForFlags = (headerHeight, oldFlags, newFlags) => {
2075
+ const oldTopHeight = getTopHeight(oldFlags);
2076
+ const newTopHeight = getTopHeight(newFlags);
2077
+ const warningHeight = Math.max(headerHeight - oldTopHeight, 0);
2078
+ return newTopHeight + warningHeight;
2079
+ };
2080
+
2029
2081
  const collapseDetails = state => {
2030
2082
  const {
2031
- flags
2083
+ flags,
2084
+ headerHeight
2032
2085
  } = state;
2086
+ const newFlags = flags & -33;
2033
2087
  return {
2034
2088
  ...state,
2035
- flags: flags & -33,
2089
+ flags: newFlags,
2036
2090
  focus: FocusSearchInput,
2037
- focusSource: Script
2091
+ focusSource: Script,
2092
+ headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
2038
2093
  };
2039
2094
  };
2040
2095
 
@@ -2107,6 +2162,7 @@ const create$1 = ({
2107
2162
  };
2108
2163
 
2109
2164
  const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '', platform) => {
2165
+ const headerHeight = getTopHeight(0);
2110
2166
  const state = {
2111
2167
  disposed: false,
2112
2168
  fileCount: 0,
@@ -2120,8 +2176,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
2120
2176
  x,
2121
2177
  y,
2122
2178
  ...create$1({
2123
- headerHeight: 61,
2124
- // TODO
2179
+ headerHeight,
2125
2180
  itemHeight: itemHeight || 22,
2126
2181
  minimumSliderSize: minimumSliderSize
2127
2182
  }),
@@ -2192,7 +2247,6 @@ const isEqual$7 = (oldState, newState) => {
2192
2247
  return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.headerHeight === newState.headerHeight && oldState.itemHeight === newState.itemHeight && oldState.items === newState.items;
2193
2248
  };
2194
2249
 
2195
- const RenderItems = 1;
2196
2250
  const RenderFocus = 2;
2197
2251
  const RenderValue = 3;
2198
2252
  const RenderReplaceValue = 4;
@@ -2220,7 +2274,7 @@ const isEqual$3 = (oldState, newState) => {
2220
2274
  };
2221
2275
 
2222
2276
  const isEqual$2 = (oldState, newState) => {
2223
- return oldState.collapsedPaths === newState.collapsedPaths && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage;
2277
+ return oldState.collapsedPaths === newState.collapsedPaths && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.renderFolderPaths === newState.renderFolderPaths && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage;
2224
2278
  };
2225
2279
 
2226
2280
  const isEqual$1 = (oldState, newState) => {
@@ -2254,6 +2308,13 @@ const diff2 = uid => {
2254
2308
  return diffResult;
2255
2309
  };
2256
2310
 
2311
+ const disableRenderFolderPaths = state => {
2312
+ return {
2313
+ ...state,
2314
+ renderFolderPaths: false
2315
+ };
2316
+ };
2317
+
2257
2318
  const getNewMinMax = (newItemsLength, minLineY, maxLineY, deltaY, itemHeight) => {
2258
2319
  if (maxLineY > newItemsLength) {
2259
2320
  const diff = maxLineY - minLineY;
@@ -2658,15 +2719,25 @@ const dismissItem = state => {
2658
2719
  return removeIndex(state, actualIndex);
2659
2720
  };
2660
2721
 
2722
+ const enableRenderFolderPaths = state => {
2723
+ return {
2724
+ ...state,
2725
+ renderFolderPaths: true
2726
+ };
2727
+ };
2728
+
2661
2729
  const expandDetails = state => {
2662
2730
  const {
2663
- flags
2731
+ flags,
2732
+ headerHeight
2664
2733
  } = state;
2734
+ const newFlags = flags | DetailsExpanded;
2665
2735
  return {
2666
2736
  ...state,
2667
- flags: flags | DetailsExpanded,
2737
+ flags: newFlags,
2668
2738
  focus: FocusSearchIncludeInput,
2669
- focusSource: Script
2739
+ focusSource: Script,
2740
+ headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
2670
2741
  };
2671
2742
  };
2672
2743
 
@@ -2993,7 +3064,7 @@ const getMenuEntriesList = (state, props) => {
2993
3064
  };
2994
3065
 
2995
3066
  const getMenuEntries = (state, props) => {
2996
- if (props.menuId === Search$1) {
3067
+ if (props.menuId === Search$2) {
2997
3068
  return getMenuEntriesList(state, props);
2998
3069
  }
2999
3070
  if (props.menuId === InputContextMenu) {
@@ -3003,7 +3074,7 @@ const getMenuEntries = (state, props) => {
3003
3074
  };
3004
3075
 
3005
3076
  const getMenuEntryIds = () => {
3006
- return [Search$1, InputContextMenu];
3077
+ return [Search$2, InputContextMenu];
3007
3078
  };
3008
3079
 
3009
3080
  const ClearAll$1 = 'ClearAll';
@@ -3082,6 +3153,24 @@ const getProtocol = uri => {
3082
3153
  return '';
3083
3154
  };
3084
3155
 
3156
+ const measureTextHeight = (text, fontFamily, fontSize, lineHeight, width) => {
3157
+ return invoke$1('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, `${lineHeight}px`, width);
3158
+ };
3159
+
3160
+ const SearchWarningFontFamily = 'system-ui';
3161
+ const SearchWarningFontSize = 12;
3162
+ const SearchWarningLineHeight = 18;
3163
+ const SearchWarningHorizontalPadding = 10;
3164
+ const SearchWarningVerticalPadding = 8;
3165
+ const getSearchWarningMessageHeight = async (limitHitWarning, width) => {
3166
+ if (!limitHitWarning) {
3167
+ return 0;
3168
+ }
3169
+ const availableWidth = Math.max(width - SearchWarningHorizontalPadding, 1);
3170
+ const textHeight = await measureTextHeight(limitHitWarning, SearchWarningFontFamily, SearchWarningFontSize, SearchWarningLineHeight, availableWidth);
3171
+ return textHeight + SearchWarningVerticalPadding;
3172
+ };
3173
+
3085
3174
  const getTextSearchResultCounts = results => {
3086
3175
  let resultCount = 0;
3087
3176
  let fileCount = 0;
@@ -3132,7 +3221,6 @@ const handleUpdateFull = async (state, update) => {
3132
3221
  excludeValue,
3133
3222
  fileIconCache,
3134
3223
  flags,
3135
- headerHeight,
3136
3224
  height,
3137
3225
  includeValue,
3138
3226
  itemHeight,
@@ -3142,7 +3230,8 @@ const handleUpdateFull = async (state, update) => {
3142
3230
  threads,
3143
3231
  uid,
3144
3232
  usePullBasedSearch,
3145
- value
3233
+ value,
3234
+ width
3146
3235
  } = partialNewState;
3147
3236
  const root = state.workspacePath;
3148
3237
  const scheme = getProtocol(root);
@@ -3176,6 +3265,9 @@ const handleUpdateFull = async (state, update) => {
3176
3265
  resultCount
3177
3266
  } = getTextSearchResultCounts(results);
3178
3267
  const message = getStatusMessage(resultCount, fileCount);
3268
+ const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
3269
+ const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
3270
+ const headerHeight = getTopHeight(flags) + warningHeight;
3179
3271
  const total = results.length;
3180
3272
  const contentHeight = total * itemHeight;
3181
3273
  const listHeight = height - headerHeight;
@@ -3188,7 +3280,6 @@ const handleUpdateFull = async (state, update) => {
3188
3280
  icons,
3189
3281
  newFileIconCache
3190
3282
  } = await getFileIcons(visible, fileIconCache);
3191
- const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
3192
3283
  return {
3193
3284
  ...partialNewState,
3194
3285
  collapsedPaths: [],
@@ -3196,6 +3287,7 @@ const handleUpdateFull = async (state, update) => {
3196
3287
  fileCount,
3197
3288
  fileIconCache: newFileIconCache,
3198
3289
  finalDeltaY,
3290
+ headerHeight,
3199
3291
  icons,
3200
3292
  items: results,
3201
3293
  limitHit,
@@ -3348,8 +3440,11 @@ const handleUpdateIncremental = async (state, update) => {
3348
3440
  return state;
3349
3441
  };
3350
3442
 
3443
+ const getsearchid = () => {
3444
+ return crypto.randomUUID();
3445
+ };
3351
3446
  const handleUpdatePullBased = async (state, update) => {
3352
- const searchId = crypto.randomUUID();
3447
+ const searchId = getsearchid();
3353
3448
  const partialNewState = {
3354
3449
  ...state,
3355
3450
  ...update,
@@ -3370,7 +3465,8 @@ const handleUpdatePullBased = async (state, update) => {
3370
3465
  threads,
3371
3466
  uid,
3372
3467
  usePullBasedSearch,
3373
- value
3468
+ value,
3469
+ width
3374
3470
  } = partialNewState;
3375
3471
  const root = state.workspacePath;
3376
3472
  const scheme = getProtocol(root);
@@ -3399,6 +3495,8 @@ const handleUpdatePullBased = async (state, update) => {
3399
3495
  return state;
3400
3496
  }
3401
3497
  const limitHitWarning = limitHit ? theResultSetOnlyContainsASubSetOfMatches() : '';
3498
+ const warningHeight = await getSearchWarningMessageHeight(limitHitWarning, width);
3499
+ const headerHeight = getTopHeight(flags) + warningHeight;
3402
3500
  const {
3403
3501
  fileCount,
3404
3502
  resultCount
@@ -3406,6 +3504,7 @@ const handleUpdatePullBased = async (state, update) => {
3406
3504
  const message = getStatusMessage(resultCount, fileCount);
3407
3505
  return {
3408
3506
  ...latest.newState,
3507
+ headerHeight,
3409
3508
  limitHit,
3410
3509
  limitHitWarning,
3411
3510
  message
@@ -3625,21 +3724,27 @@ const togglePreserveCase = state => {
3625
3724
 
3626
3725
  const collapseReplace = state => {
3627
3726
  const {
3628
- flags
3727
+ flags,
3728
+ headerHeight
3629
3729
  } = state;
3730
+ const newFlags = flags & -5;
3630
3731
  return {
3631
3732
  ...state,
3632
- flags: flags & -5
3733
+ flags: newFlags,
3734
+ headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
3633
3735
  };
3634
3736
  };
3635
3737
 
3636
3738
  const expandReplace = state => {
3637
3739
  const {
3638
- flags
3740
+ flags,
3741
+ headerHeight
3639
3742
  } = state;
3743
+ const newFlags = flags | ReplaceExpanded;
3640
3744
  return {
3641
3745
  ...state,
3642
- flags: flags | ReplaceExpanded
3746
+ flags: newFlags,
3747
+ headerHeight: getHeaderHeightForFlags(headerHeight, flags, newFlags)
3643
3748
  };
3644
3749
  };
3645
3750
 
@@ -4101,17 +4206,77 @@ const handlePullResultsFound = async (state, resultSearchId) => {
4101
4206
  return state;
4102
4207
  };
4103
4208
 
4209
+ const clamp$1 = (num, min, max) => {
4210
+ return Math.min(Math.max(num, min), max);
4211
+ };
4212
+
4213
+ const handleResize = async (state, x, y, width, height) => {
4214
+ const {
4215
+ deltaY,
4216
+ fileIconCache,
4217
+ headerHeight,
4218
+ itemHeight,
4219
+ listItems,
4220
+ minimumSliderSize
4221
+ } = state;
4222
+ const total = listItems.length;
4223
+ const contentHeight = total * itemHeight;
4224
+ const listHeight = height - headerHeight;
4225
+ const scrollBarHeight = getScrollBarSize$1(height, contentHeight, minimumSliderSize);
4226
+ const finalDeltaY = Math.max(contentHeight - listHeight, 0);
4227
+ const newDeltaY = clamp$1(deltaY, 0, finalDeltaY);
4228
+ const minLineY = Math.floor(newDeltaY / itemHeight);
4229
+ const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
4230
+ const maxLineY = Math.min(minLineY + numberOfVisible, total);
4231
+ const visibleItems = listItems.slice(minLineY, maxLineY);
4232
+ const {
4233
+ icons,
4234
+ newFileIconCache
4235
+ } = await getFileIcons(visibleItems, fileIconCache);
4236
+ const scrollBarY = finalDeltaY === 0 ? 0 : getScrollBarY$1(newDeltaY, finalDeltaY, listHeight, scrollBarHeight);
4237
+ return {
4238
+ ...state,
4239
+ deltaY: newDeltaY,
4240
+ fileIconCache: newFileIconCache,
4241
+ finalDeltaY,
4242
+ height,
4243
+ icons,
4244
+ maxLineY,
4245
+ minLineY,
4246
+ scrollBarHeight,
4247
+ scrollBarY,
4248
+ width,
4249
+ x,
4250
+ y
4251
+ };
4252
+ };
4253
+
4104
4254
  const handleSharedInput = (state, name, value, inputSource = Script) => {
4105
4255
  const fn = getInputHandler(name);
4106
4256
  return fn(state, value, inputSource);
4107
4257
  };
4108
4258
 
4259
+ const handleWorkspaceChange = state => {
4260
+ return {
4261
+ ...state,
4262
+ deltaY: 0,
4263
+ items: [],
4264
+ listItems: [],
4265
+ matchCount: 0,
4266
+ maxLineY: 0,
4267
+ message: '',
4268
+ minLineY: 0,
4269
+ replacement: '',
4270
+ value: ''
4271
+ };
4272
+ };
4273
+
4109
4274
  const send = async port => {
4110
4275
  await sendMessagePortToIconThemeWorker(port, 0);
4111
4276
  };
4112
4277
  const launchIconThemeWorker = async () => {
4113
4278
  // TODO connect to icon theme worker
4114
- const rpc = await create$5({
4279
+ const rpc = await create$9({
4115
4280
  commandMap: {},
4116
4281
  send
4117
4282
  });
@@ -4124,7 +4289,7 @@ const initializeIconThemeWorker = async () => {
4124
4289
  };
4125
4290
 
4126
4291
  const launchSearchProcessElectron = async () => {
4127
- const rpc = await create$a({
4292
+ const rpc = await create$8({
4128
4293
  commandMap: {},
4129
4294
  send: sendMessagePortToSearchProcess
4130
4295
  });
@@ -4132,7 +4297,7 @@ const launchSearchProcessElectron = async () => {
4132
4297
  };
4133
4298
 
4134
4299
  const launchSearchProcessNode = async () => {
4135
- const rpc = await create$7({
4300
+ const rpc = await create$5({
4136
4301
  commandMap: {},
4137
4302
  // @ts-ignore
4138
4303
  type: 'search-process'
@@ -4463,19 +4628,6 @@ const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight, topHeight, itemC
4463
4628
  return index;
4464
4629
  };
4465
4630
 
4466
- const getTopHeight = flags => {
4467
- if (flags & ReplaceExpanded && flags & DetailsExpanded) {
4468
- return 190;
4469
- }
4470
- if (flags & DetailsExpanded) {
4471
- return 158;
4472
- }
4473
- if (flags & ReplaceExpanded) {
4474
- return 93;
4475
- }
4476
- return 61;
4477
- };
4478
-
4479
4631
  const getFilteredResults = (results, collapsedPaths) => {
4480
4632
  if (collapsedPaths.length === 0) {
4481
4633
  return results;
@@ -4560,6 +4712,14 @@ const getRelativePath = relativePath => {
4560
4712
  }
4561
4713
  return `/${relativePath}`; // TODO support windows paths
4562
4714
  };
4715
+ const getRelativeFolderPath = relativePath => {
4716
+ const normalized = relativePath.startsWith('./') ? relativePath.slice(2) : relativePath;
4717
+ const slashIndex = normalized.lastIndexOf('/');
4718
+ if (slashIndex === -1) {
4719
+ return '';
4720
+ }
4721
+ return normalized.slice(0, slashIndex);
4722
+ };
4563
4723
 
4564
4724
  const selectIndexPreview = async (state, searchResult, index) => {
4565
4725
  const {
@@ -4618,14 +4778,13 @@ const selectIndex = async (state, index) => {
4618
4778
  const handleClickAt = async (state, eventX, eventY, name) => {
4619
4779
  const {
4620
4780
  deltaY,
4621
- flags,
4781
+ headerHeight,
4622
4782
  itemHeight,
4623
4783
  listItems,
4624
4784
  x,
4625
4785
  y
4626
4786
  } = state;
4627
- const topHeight = getTopHeight(flags);
4628
- const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
4787
+ const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, headerHeight, listItems.length);
4629
4788
  const isRemoveButton = name === Remove;
4630
4789
  if (isRemoveButton) {
4631
4790
  return removeIndex(state, index);
@@ -4747,12 +4906,15 @@ const loadContent = async (state, savedState) => {
4747
4906
  threads
4748
4907
  } = restoreState(savedState);
4749
4908
  const usePullBasedSearch = await getUsePullBasedSearch();
4909
+ const warningHeight = await getSearchWarningMessageHeight(state.limitHitWarning, state.width);
4910
+ const headerHeight = getTopHeight(flags) + warningHeight;
4750
4911
  const update = {
4751
4912
  collapsedPaths: savedCollapsedPaths,
4752
4913
  excludeValue,
4753
4914
  flags,
4754
4915
  focus: 0,
4755
4916
  // TODO
4917
+ headerHeight,
4756
4918
  includeValue,
4757
4919
  inputSource: Script,
4758
4920
  replacement,
@@ -4854,10 +5016,12 @@ const getTreeItemIndent = depth => {
4854
5016
  return baseIndent + depth * defaultIndent;
4855
5017
  };
4856
5018
 
4857
- const getSearchDisplayResultFile = (results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults) => {
5019
+ const getSearchDisplayResultFile = (results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, renderFolderPaths, originalResults) => {
4858
5020
  const path = text;
4859
5021
  const absolutePath = getRelativePath(path);
4860
5022
  const baseName = pathBaseName(path);
5023
+ const relativeFolderPath = getRelativeFolderPath(path);
5024
+ const displayText = renderFolderPaths && relativeFolderPath ? `${baseName} — ${relativeFolderPath}` : baseName;
4861
5025
  const index = originalResults.indexOf(results[i]);
4862
5026
  const matchCount = getMatchCount(originalResults, index);
4863
5027
  const expanded = collapsedPaths.includes(path) ? Collapsed : Expanded;
@@ -4876,7 +5040,7 @@ const getSearchDisplayResultFile = (results, fileIcons, i, setSize, collapsedPat
4876
5040
  posInSet,
4877
5041
  replacement: '',
4878
5042
  setSize,
4879
- text: baseName,
5043
+ text: displayText,
4880
5044
  title: absolutePath
4881
5045
  };
4882
5046
  };
@@ -4901,7 +5065,7 @@ const getDisplayResultMatch = (setSize, searchTermLength, replacement, text, pos
4901
5065
  };
4902
5066
  };
4903
5067
 
4904
- const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults) => {
5068
+ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, renderFolderPaths, minLineY, originalResults) => {
4905
5069
  const result = results[i];
4906
5070
  const {
4907
5071
  start,
@@ -4913,7 +5077,7 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
4913
5077
  const relativeIndex = i - minLineY;
4914
5078
  switch (type) {
4915
5079
  case File:
4916
- return getSearchDisplayResultFile(results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults);
5080
+ return getSearchDisplayResultFile(results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, renderFolderPaths, originalResults);
4917
5081
  case Match:
4918
5082
  return getDisplayResultMatch(setSize, searchTermLength, replacement, text, posInSet, start, focused);
4919
5083
  default:
@@ -4921,14 +5085,14 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
4921
5085
  }
4922
5086
  };
4923
5087
 
4924
- const getDisplayResults = (results, itemHeight, resultCount, searchTerm, minLineY, maxLineY, replacement, fileIcons, focusedIndex, collapsedPaths, originalResults) => {
5088
+ const getDisplayResults = (results, itemHeight, resultCount, searchTerm, minLineY, maxLineY, replacement, fileIcons, focusedIndex, collapsedPaths, renderFolderPaths, originalResults) => {
4925
5089
  const filteredResults = getFilteredResults(results, collapsedPaths);
4926
5090
  const displayResults = [];
4927
5091
  const setSize = resultCount;
4928
5092
  const searchTermLength = searchTerm.length;
4929
5093
  const max = Math.min(filteredResults.length, maxLineY);
4930
5094
  for (let i = minLineY; i < max; i++) {
4931
- const displayResult = getDisplayResult(filteredResults, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults);
5095
+ const displayResult = getDisplayResult(filteredResults, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, renderFolderPaths, minLineY, originalResults);
4932
5096
  displayResults.push(displayResult);
4933
5097
  }
4934
5098
  return displayResults;
@@ -4956,12 +5120,13 @@ const createViewModel = state => {
4956
5120
  maxLineY,
4957
5121
  message,
4958
5122
  minLineY,
5123
+ renderFolderPaths,
4959
5124
  replacement,
4960
5125
  scrollBarHeight,
4961
5126
  searchInputErrorMessage,
4962
5127
  value
4963
5128
  } = state;
4964
- const displayResults = getDisplayResults(listItems, itemHeight, fileCount, value, minLineY, maxLineY, replacement, icons, listFocusedIndex, collapsedPaths, items);
5129
+ const displayResults = getDisplayResults(listItems, itemHeight, fileCount, value, minLineY, maxLineY, replacement, icons, listFocusedIndex, collapsedPaths, renderFolderPaths || false, items);
4965
5130
  const focusOutline = listFocused && listFocusedIndex === -1;
4966
5131
  const scrollBarValue = deltaY / finalDeltaY * 100;
4967
5132
  const scrollBarY = getScrollBarY$1(deltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
@@ -4997,13 +5162,24 @@ const getTreeItemsTopRule = treeItemsTop => {
4997
5162
  top: ${roundedTreeItemsTop}px;
4998
5163
  }`;
4999
5164
  };
5000
- const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollBarY, treeItemsTop) => {
5165
+ const getScrollBarThumbTopRule = scrollBarY => {
5166
+ const roundedScrollBarY = Math.round(scrollBarY);
5167
+ return `.ScrollBarThumbTop-${roundedScrollBarY} {
5168
+ transform: translateY(${roundedScrollBarY}px);
5169
+ }`;
5170
+ };
5171
+ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollBarY, treeItemsTop, headerHeight = 0) => {
5001
5172
  const rules = [`.Search {
5002
5173
  --ScrollBarHeight: ${scrollBarHeight}px;
5003
5174
  --ScrollBarTop: ${scrollBarY}px;
5004
5175
  --TreeItemsTop: ${top}px;
5005
5176
  }
5006
- `, ...uniqueIndents.map(getIndentRule), ...uniqueIndentRights.map(getIndentRightRule), getTreeItemsTopRule(treeItemsTop)];
5177
+
5178
+ .SearchHeader {
5179
+ contain: strict;
5180
+ height: ${headerHeight}px;
5181
+ }
5182
+ `, ...uniqueIndents.map(getIndentRule), ...uniqueIndentRights.map(getIndentRightRule), getTreeItemsTopRule(treeItemsTop), getScrollBarThumbTopRule(scrollBarY)];
5007
5183
  return rules.join('\n');
5008
5184
  };
5009
5185
 
@@ -5026,6 +5202,7 @@ const PaddingRight = 12;
5026
5202
 
5027
5203
  const renderCss = (oldState, newState) => {
5028
5204
  const {
5205
+ headerHeight,
5029
5206
  uid
5030
5207
  } = newState;
5031
5208
  const viewModel = createViewModel(newState);
@@ -5033,7 +5210,7 @@ const renderCss = (oldState, newState) => {
5033
5210
  const uniqueIndents = getUniqueIndents(indents);
5034
5211
  const uniqueIndentRights = [PaddingRight];
5035
5212
  const treeItemsTop = viewModel.itemHeight === 0 ? 0 : Math.round(-(viewModel.deltaY % viewModel.itemHeight));
5036
- const css = getCss(0, uniqueIndents, uniqueIndentRights, viewModel.scrollBarHeight, viewModel.scrollBarY, treeItemsTop);
5213
+ const css = getCss(0, uniqueIndents, uniqueIndentRights, viewModel.scrollBarHeight, viewModel.scrollBarY, treeItemsTop, headerHeight);
5037
5214
  return [SetCss, uid, css];
5038
5215
  };
5039
5216
 
@@ -5078,7 +5255,7 @@ const renderFocus = (oldState, newState) => {
5078
5255
  };
5079
5256
 
5080
5257
  const renderFocusContext = (oldState, newState) => {
5081
- return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
5258
+ return [SetFocusContext, newState.uid, FocusSearch$1, newState.focus];
5082
5259
  };
5083
5260
 
5084
5261
  const HandleClick = 1;
@@ -5113,7 +5290,7 @@ const getSearchDetailsToggleVirtualDom = () => {
5113
5290
  role: Button$3,
5114
5291
  tabIndex: 0,
5115
5292
  title: toggleSearchDetails(),
5116
- type: Button$2
5293
+ type: Button$1
5117
5294
  }, {
5118
5295
  childCount: 0,
5119
5296
  className: mergeClassNames(MaskIcon, MaskIconEllipsis),
@@ -5233,7 +5410,7 @@ const getSearchFieldButtonVirtualDom = button => {
5233
5410
  role,
5234
5411
  tabIndex: 0,
5235
5412
  title,
5236
- type: Button$2
5413
+ type: Button$1
5237
5414
  }, {
5238
5415
  childCount: 0,
5239
5416
  className: mergeClassNames(MaskIcon, icon),
@@ -5410,7 +5587,7 @@ const getSearchToggleVirtualDom = replaceExpanded => {
5410
5587
  name: ToggleReplace,
5411
5588
  onClick: HandleButtonClick,
5412
5589
  title: toggleReplace$1(),
5413
- type: Button$2
5590
+ type: Button$1
5414
5591
  }, {
5415
5592
  childCount: 0,
5416
5593
  className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
@@ -5471,6 +5648,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
5471
5648
  if (scrollBarHeight === 0) {
5472
5649
  return [];
5473
5650
  }
5651
+ const roundedScrollBarY = Math.round(scrollBarY);
5474
5652
  return [{
5475
5653
  ariaControls: TreeItems,
5476
5654
  ariaValueNow: scrollBarValue,
@@ -5481,9 +5659,8 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarY, scrollBarValue) =>
5481
5659
  type: Div
5482
5660
  }, {
5483
5661
  childCount: 0,
5484
- className: ScrollBarThumb,
5662
+ className: `${ScrollBarThumb} ScrollBarThumbTop-${roundedScrollBarY}`,
5485
5663
  height: scrollBarHeight,
5486
- translate: `0 ${scrollBarY}px`,
5487
5664
  type: Div
5488
5665
  }];
5489
5666
  };
@@ -5622,7 +5799,7 @@ const getSearchRemoveVirtualDom = () => {
5622
5799
  className: SearchRemove,
5623
5800
  name: Remove,
5624
5801
  title,
5625
- type: Button$2
5802
+ type: Button$1
5626
5803
  }, closeIcon];
5627
5804
  return dom;
5628
5805
  };
@@ -5698,7 +5875,7 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
5698
5875
  }, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
5699
5876
  };
5700
5877
 
5701
- const className = mergeClassNames(Viewlet, Search$2);
5878
+ const className = mergeClassNames(Viewlet, Search$1);
5702
5879
  const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0, initial = false) => {
5703
5880
  if (initial) {
5704
5881
  return [];
@@ -5712,18 +5889,18 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
5712
5889
  }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
5713
5890
  };
5714
5891
 
5715
- const renderItems = (oldState, newState) => {
5892
+ const getDom = newState => {
5716
5893
  const viewModel = createViewModel(newState);
5717
5894
  const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, newState.limitHitWarning, viewModel.focus, newState.initial);
5718
- return [SetDom2, newState.uid, dom];
5895
+ return dom;
5719
5896
  };
5720
5897
 
5721
5898
  // TODO cache rendered dom so that it can be used for dom diffing
5722
5899
  const renderIncremental = (oldState, newState) => {
5723
- const oldDom = renderItems(oldState, oldState)[2];
5724
- const newDom = renderItems(newState, newState)[2];
5900
+ const oldDom = getDom(oldState);
5901
+ const newDom = getDom(newState);
5725
5902
  const patches = diffTree(oldDom, newDom);
5726
- return ['Viewlet.setPatches', newState.uid, patches];
5903
+ return [SetPatches, newState.uid, patches];
5727
5904
  };
5728
5905
 
5729
5906
  const renderSelections = (oldState, newState) => {
@@ -5760,8 +5937,6 @@ const getRenderer = diffType => {
5760
5937
  return renderIncludeValue;
5761
5938
  case RenderIncremental:
5762
5939
  return renderIncremental;
5763
- case RenderItems:
5764
- return renderItems;
5765
5940
  case RenderReplaceValue:
5766
5941
  return renderReplacement;
5767
5942
  case RenderSelections:
@@ -5822,7 +5997,7 @@ const getActionButtonVirtualDom = action => {
5822
5997
  className,
5823
5998
  name: id,
5824
5999
  title: label,
5825
- type: Button$2
6000
+ type: Button$1
5826
6001
  }, getIconVirtualDom(icon)];
5827
6002
  };
5828
6003
 
@@ -5919,7 +6094,7 @@ const renderEventListeners = () => {
5919
6094
  params: ['handleClickAt', ClientX, ClientY, TargetName]
5920
6095
  }, {
5921
6096
  name: HandleListPointerDown,
5922
- params: ['handleListPointerDown', Button$1, TargetName]
6097
+ params: ['handleListPointerDown', Button$2, TargetName]
5923
6098
  }, {
5924
6099
  name: HandleToggleButtonClick,
5925
6100
  params: ['handleToggleButtonClick']
@@ -5931,11 +6106,11 @@ const renderEventListeners = () => {
5931
6106
  params: ['handleListBlur']
5932
6107
  }, {
5933
6108
  name: HandleListContextMenu,
5934
- params: ['handleContextMenu', Button$1, ClientX, ClientY],
6109
+ params: ['handleContextMenu', Button$2, ClientX, ClientY],
5935
6110
  preventDefault: true
5936
6111
  }, {
5937
6112
  name: HandleInputContextMenu,
5938
- params: ['handleInputContextMenu', TargetName, Button$1, ClientX, ClientY],
6113
+ params: ['handleInputContextMenu', TargetName, Button$2, ClientX, ClientY],
5939
6114
  preventDefault: true
5940
6115
  }, {
5941
6116
  name: HandleActionClick,
@@ -6146,10 +6321,10 @@ const handleContextMenuKeyboard = async state => {
6146
6321
  x,
6147
6322
  y
6148
6323
  } = state; // TODO
6149
- await show2(uid, Search$1, x, y, {
6324
+ await show2(uid, Search$2, x, y, {
6150
6325
  index: 0,
6151
6326
  // TODO pass proper index
6152
- menuId: Search$1
6327
+ menuId: Search$2
6153
6328
  });
6154
6329
  return state;
6155
6330
  };
@@ -6157,15 +6332,14 @@ const handleContextMenuKeyboard = async state => {
6157
6332
  const handleContextMenuMouseAt = async (state, eventX, eventY) => {
6158
6333
  const {
6159
6334
  deltaY,
6160
- flags,
6335
+ headerHeight,
6161
6336
  itemHeight,
6162
6337
  listItems,
6163
6338
  uid,
6164
6339
  x,
6165
6340
  y
6166
6341
  } = state;
6167
- const topHeight = getTopHeight(flags);
6168
- const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, topHeight, listItems.length);
6342
+ const index = getListIndex(eventX, eventY, x, y, deltaY, itemHeight, headerHeight, listItems.length);
6169
6343
  const {
6170
6344
  newState,
6171
6345
  oldState
@@ -6175,9 +6349,9 @@ const handleContextMenuMouseAt = async (state, eventX, eventY) => {
6175
6349
  focusedIndex: index,
6176
6350
  listFocusedIndex: index
6177
6351
  });
6178
- await show2(uid, Search$1, x, y, {
6352
+ await show2(uid, Search$2, x, y, {
6179
6353
  index,
6180
- menuId: Search$1
6354
+ menuId: Search$2
6181
6355
  });
6182
6356
  return state;
6183
6357
  };
@@ -6205,7 +6379,9 @@ const commandMap = {
6205
6379
  'TextSearch.copyPath': wrapCommand(copyPath$1),
6206
6380
  'TextSearch.create': create,
6207
6381
  'TextSearch.diff2': diff2,
6382
+ 'TextSearch.disableRenderFolderPaths': wrapCommand(disableRenderFolderPaths),
6208
6383
  'TextSearch.dismissItem': wrapCommand(dismissItem),
6384
+ 'TextSearch.enableRenderFolderPaths': wrapCommand(enableRenderFolderPaths),
6209
6385
  'TextSearch.expandDetails': wrapCommand(expandDetails),
6210
6386
  'TextSearch.focusFirst': wrapCommand(focusFirst),
6211
6387
  'TextSearch.focusIndex': wrapCommand(focusIndex),
@@ -6259,11 +6435,13 @@ const commandMap = {
6259
6435
  'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
6260
6436
  'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound),
6261
6437
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
6438
+ 'TextSearch.handleResize': wrapCommand(handleResize),
6262
6439
  'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
6263
6440
  'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
6264
6441
  'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
6265
6442
  'TextSearch.handleSharedInput': wrapCommand(handleSharedInput),
6266
6443
  'TextSearch.handleWheel': wrapCommand(handleWheel),
6444
+ 'TextSearch.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
6267
6445
  // not wrapped
6268
6446
  'TextSearch.initialize': initialize,
6269
6447
  'TextSearch.loadContent': wrapCommand(loadContent),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "6.3.0",
3
+ "version": "6.5.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"