@lvce-editor/text-search-worker 5.11.0 → 5.12.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 +404 -365
- package/package.json +1 -1
|
@@ -1240,91 +1240,6 @@ const terminate = () => {
|
|
|
1240
1240
|
globalThis.close();
|
|
1241
1241
|
};
|
|
1242
1242
|
|
|
1243
|
-
const User = 1;
|
|
1244
|
-
const Script = 2;
|
|
1245
|
-
|
|
1246
|
-
const Empty$1 = 0;
|
|
1247
|
-
const FocusIgnoreFiles = 1012;
|
|
1248
|
-
const FocusSearch = 1013;
|
|
1249
|
-
const FocusSearchExcludeInput = 1008;
|
|
1250
|
-
const FocusSearchIncludeInput = 1007;
|
|
1251
|
-
const FocusSearchInput = 21;
|
|
1252
|
-
const FocusSearchMatchCase = 32;
|
|
1253
|
-
const FocusSearchOpenEditors = 1011;
|
|
1254
|
-
const FocusSearchPreserveCase = 36;
|
|
1255
|
-
const FocusSearchRegex = 33;
|
|
1256
|
-
const FocusSearchReplaceAll = 35;
|
|
1257
|
-
const FocusSearchReplaceInput = 31;
|
|
1258
|
-
const FocusSearchResults = 22;
|
|
1259
|
-
const FocusUseExcludeSettings = 90_123;
|
|
1260
|
-
const FocusSearchWholeWord = 34;
|
|
1261
|
-
const FocusToggleDetails = 1010;
|
|
1262
|
-
const FocusToggleReplace = 1020;
|
|
1263
|
-
|
|
1264
|
-
const clearSearchResults$1 = state => {
|
|
1265
|
-
return {
|
|
1266
|
-
...state,
|
|
1267
|
-
value: '',
|
|
1268
|
-
items: [],
|
|
1269
|
-
minLineY: 0,
|
|
1270
|
-
maxLineY: 0,
|
|
1271
|
-
message: '',
|
|
1272
|
-
focus: FocusSearchInput,
|
|
1273
|
-
focusSource: Script,
|
|
1274
|
-
inputSource: Script
|
|
1275
|
-
};
|
|
1276
|
-
};
|
|
1277
|
-
|
|
1278
|
-
const File$1 = 1;
|
|
1279
|
-
const Match = 2;
|
|
1280
|
-
|
|
1281
|
-
const getPaths = items => {
|
|
1282
|
-
const paths = [];
|
|
1283
|
-
for (const item of items) {
|
|
1284
|
-
if (item.type === File$1) {
|
|
1285
|
-
paths.push(item.text);
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
return paths;
|
|
1289
|
-
};
|
|
1290
|
-
const collapseAll$1 = async state => {
|
|
1291
|
-
const {
|
|
1292
|
-
items
|
|
1293
|
-
} = state;
|
|
1294
|
-
if (items.length === 0) {
|
|
1295
|
-
return state;
|
|
1296
|
-
}
|
|
1297
|
-
const paths = getPaths(items);
|
|
1298
|
-
return {
|
|
1299
|
-
...state,
|
|
1300
|
-
collapsedPaths: paths
|
|
1301
|
-
};
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
|
-
const PreserveCase$2 = 1 << 0; // 1
|
|
1305
|
-
const UseRegularExpression$2 = 1 << 1; // 2
|
|
1306
|
-
const ReplaceExpanded = 1 << 2; // 4
|
|
1307
|
-
const MatchWholeWord$2 = 1 << 3; // 8
|
|
1308
|
-
const MatchCase$2 = 1 << 4; // 16
|
|
1309
|
-
const DetailsExpanded = 1 << 5; // 32
|
|
1310
|
-
const OpenEditors = 1 << 6; // 64
|
|
1311
|
-
const UseIgnoreFiles = 1 << 7; // 128
|
|
1312
|
-
const hasDetailsExpanded = flags => {
|
|
1313
|
-
return (flags & DetailsExpanded) === DetailsExpanded;
|
|
1314
|
-
};
|
|
1315
|
-
|
|
1316
|
-
const collapseDetails = state => {
|
|
1317
|
-
const {
|
|
1318
|
-
flags
|
|
1319
|
-
} = state;
|
|
1320
|
-
return {
|
|
1321
|
-
...state,
|
|
1322
|
-
flags: flags & -33,
|
|
1323
|
-
focus: FocusSearchInput,
|
|
1324
|
-
focusSource: Script
|
|
1325
|
-
};
|
|
1326
|
-
};
|
|
1327
|
-
|
|
1328
1243
|
const Alert = 'alert';
|
|
1329
1244
|
const Button$3 = 'button';
|
|
1330
1245
|
const CheckBox = 'checkbox';
|
|
@@ -1339,7 +1254,7 @@ const Actions = 'Actions';
|
|
|
1339
1254
|
const Badge = 'Badge';
|
|
1340
1255
|
const Chevron = 'Chevron';
|
|
1341
1256
|
const CloseMaskIcon = 'MaskIcon MaskIconClose';
|
|
1342
|
-
const Empty = '';
|
|
1257
|
+
const Empty$1 = '';
|
|
1343
1258
|
const FileIcon = 'FileIcon';
|
|
1344
1259
|
const FocusOutline = 'FocusOutline';
|
|
1345
1260
|
const Grow = 'Grow';
|
|
@@ -1393,7 +1308,7 @@ const Viewlet = 'Viewlet';
|
|
|
1393
1308
|
const ViewletSearchMessage = 'ViewletSearchMessage';
|
|
1394
1309
|
const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
|
|
1395
1310
|
|
|
1396
|
-
const File = 7;
|
|
1311
|
+
const File$1 = 7;
|
|
1397
1312
|
|
|
1398
1313
|
const Button$2 = 1;
|
|
1399
1314
|
const Div = 4;
|
|
@@ -1422,6 +1337,322 @@ const DebugWorker = 55;
|
|
|
1422
1337
|
const RendererWorker$1 = 1;
|
|
1423
1338
|
const SearchProcess = 77;
|
|
1424
1339
|
|
|
1340
|
+
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
1341
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
1342
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1343
|
+
const SetValueByName = 'Viewlet.setValueByName';
|
|
1344
|
+
|
|
1345
|
+
const Empty = 0;
|
|
1346
|
+
const FocusIgnoreFiles = 1012;
|
|
1347
|
+
const FocusSearch = 1013;
|
|
1348
|
+
const FocusSearchExcludeInput = 1008;
|
|
1349
|
+
const FocusSearchIncludeInput = 1007;
|
|
1350
|
+
const FocusSearchInput = 21;
|
|
1351
|
+
const FocusSearchMatchCase = 32;
|
|
1352
|
+
const FocusSearchOpenEditors = 1011;
|
|
1353
|
+
const FocusSearchPreserveCase = 36;
|
|
1354
|
+
const FocusSearchRegex = 33;
|
|
1355
|
+
const FocusSearchReplaceAll = 35;
|
|
1356
|
+
const FocusSearchReplaceInput = 31;
|
|
1357
|
+
const FocusSearchResults = 22;
|
|
1358
|
+
const FocusSearchWholeWord = 34;
|
|
1359
|
+
const FocusToggleDetails = 1010;
|
|
1360
|
+
const FocusToggleReplace = 1020;
|
|
1361
|
+
|
|
1362
|
+
const mergeClassNames = (...classNames) => {
|
|
1363
|
+
return classNames.filter(Boolean).join(' ');
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
const text = data => {
|
|
1367
|
+
return {
|
|
1368
|
+
type: Text,
|
|
1369
|
+
text: data,
|
|
1370
|
+
childCount: 0
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
const SetText = 1;
|
|
1375
|
+
const SetAttribute = 3;
|
|
1376
|
+
const RemoveAttribute = 4;
|
|
1377
|
+
const Add = 6;
|
|
1378
|
+
const NavigateChild = 7;
|
|
1379
|
+
const NavigateParent = 8;
|
|
1380
|
+
const RemoveChild = 9;
|
|
1381
|
+
const NavigateSibling = 10;
|
|
1382
|
+
|
|
1383
|
+
const applyPendingPatches = (patches, pendingPatches, skip) => {
|
|
1384
|
+
for (let k = 0; k < pendingPatches.length - skip; k += 2) {
|
|
1385
|
+
const type = pendingPatches[k];
|
|
1386
|
+
const index = pendingPatches[k + 1];
|
|
1387
|
+
if (type === NavigateParent) {
|
|
1388
|
+
patches.push({
|
|
1389
|
+
type
|
|
1390
|
+
});
|
|
1391
|
+
} else {
|
|
1392
|
+
patches.push({
|
|
1393
|
+
type,
|
|
1394
|
+
index
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
pendingPatches.length = 0;
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
const isKey = key => {
|
|
1402
|
+
return key !== 'type' && key !== 'childCount';
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
const getKeys = node => {
|
|
1406
|
+
const keys = Object.keys(node).filter(isKey);
|
|
1407
|
+
return keys;
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
const getTotalChildCount = (nodes, index) => {
|
|
1411
|
+
let i = index;
|
|
1412
|
+
let pending = 1;
|
|
1413
|
+
while (pending) {
|
|
1414
|
+
const node = nodes[i];
|
|
1415
|
+
pending += node.childCount;
|
|
1416
|
+
pending--;
|
|
1417
|
+
i++;
|
|
1418
|
+
}
|
|
1419
|
+
return i - index;
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
const diff$1 = (oldNodes, newNodes) => {
|
|
1423
|
+
const patches = [];
|
|
1424
|
+
const pendingPatches = [];
|
|
1425
|
+
let i = 0;
|
|
1426
|
+
let j = 0;
|
|
1427
|
+
let siblingOffset = 0;
|
|
1428
|
+
let maxSiblingOffset = 1;
|
|
1429
|
+
const indexStack = [0, 1];
|
|
1430
|
+
while (i < oldNodes.length && j < newNodes.length) {
|
|
1431
|
+
const oldNode = oldNodes[i];
|
|
1432
|
+
const newNode = newNodes[j];
|
|
1433
|
+
// TODO maybe don't have the current element in indexstack
|
|
1434
|
+
if (siblingOffset === maxSiblingOffset) {
|
|
1435
|
+
indexStack.pop();
|
|
1436
|
+
indexStack.pop();
|
|
1437
|
+
pendingPatches.push(NavigateParent, 0);
|
|
1438
|
+
maxSiblingOffset = indexStack.pop();
|
|
1439
|
+
siblingOffset = indexStack.pop() + 1;
|
|
1440
|
+
}
|
|
1441
|
+
while (siblingOffset === maxSiblingOffset) {
|
|
1442
|
+
pendingPatches.push(NavigateParent, 0);
|
|
1443
|
+
maxSiblingOffset = indexStack.pop();
|
|
1444
|
+
siblingOffset = indexStack.pop() + 1;
|
|
1445
|
+
}
|
|
1446
|
+
if (oldNode.type !== newNode.type) {
|
|
1447
|
+
let skip = 0;
|
|
1448
|
+
if (pendingPatches.length > 0 && pendingPatches.at(-2) === NavigateChild) {
|
|
1449
|
+
skip = 2;
|
|
1450
|
+
}
|
|
1451
|
+
applyPendingPatches(patches, pendingPatches, skip);
|
|
1452
|
+
const oldTotal = getTotalChildCount(oldNodes, i);
|
|
1453
|
+
const newTotal = getTotalChildCount(newNodes, j);
|
|
1454
|
+
patches.push({
|
|
1455
|
+
type: RemoveChild,
|
|
1456
|
+
index: siblingOffset
|
|
1457
|
+
});
|
|
1458
|
+
patches.push({
|
|
1459
|
+
type: Add,
|
|
1460
|
+
nodes: newNodes.slice(j, j + newTotal)
|
|
1461
|
+
});
|
|
1462
|
+
siblingOffset++;
|
|
1463
|
+
i += oldTotal;
|
|
1464
|
+
j += newTotal;
|
|
1465
|
+
continue;
|
|
1466
|
+
}
|
|
1467
|
+
if (oldNode.type === Text && newNode.type === Text) {
|
|
1468
|
+
if (oldNode.text !== newNode.text) {
|
|
1469
|
+
if (siblingOffset !== 0) {
|
|
1470
|
+
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
1471
|
+
}
|
|
1472
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1473
|
+
patches.push({
|
|
1474
|
+
type: SetText,
|
|
1475
|
+
value: newNode.text
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
i++;
|
|
1479
|
+
j++;
|
|
1480
|
+
siblingOffset++;
|
|
1481
|
+
continue;
|
|
1482
|
+
}
|
|
1483
|
+
const oldKeys = getKeys(oldNode);
|
|
1484
|
+
const newKeys = getKeys(newNode);
|
|
1485
|
+
let hasAttributeChanges = false;
|
|
1486
|
+
for (const key of newKeys) {
|
|
1487
|
+
if (oldNode[key] !== newNode[key]) {
|
|
1488
|
+
hasAttributeChanges = true;
|
|
1489
|
+
break;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
for (const key of oldKeys) {
|
|
1493
|
+
if (!(key in newNode)) {
|
|
1494
|
+
hasAttributeChanges = true;
|
|
1495
|
+
break;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
if (hasAttributeChanges) {
|
|
1499
|
+
if (siblingOffset > 0) {
|
|
1500
|
+
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
1501
|
+
}
|
|
1502
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1503
|
+
for (const key of newKeys) {
|
|
1504
|
+
if (oldNode[key] !== newNode[key]) {
|
|
1505
|
+
patches.push({
|
|
1506
|
+
type: SetAttribute,
|
|
1507
|
+
key,
|
|
1508
|
+
value: newNode[key]
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
for (const key of oldKeys) {
|
|
1513
|
+
if (!(key in newNode)) {
|
|
1514
|
+
patches.push({
|
|
1515
|
+
type: RemoveAttribute,
|
|
1516
|
+
key
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
if (oldNode.childCount && newNode.childCount) {
|
|
1522
|
+
maxSiblingOffset = oldNode.childCount;
|
|
1523
|
+
indexStack.push(0, maxSiblingOffset);
|
|
1524
|
+
pendingPatches.push(NavigateChild, 0);
|
|
1525
|
+
i++;
|
|
1526
|
+
j++;
|
|
1527
|
+
continue;
|
|
1528
|
+
}
|
|
1529
|
+
if (oldNode.childCount) {
|
|
1530
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1531
|
+
for (let k = 0; k < oldNode.childCount; k++) {
|
|
1532
|
+
patches.push({
|
|
1533
|
+
type: RemoveChild,
|
|
1534
|
+
index: 0
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
i += getTotalChildCount(oldNodes, i);
|
|
1538
|
+
j++;
|
|
1539
|
+
siblingOffset++;
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
if (newNode.childCount) {
|
|
1543
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1544
|
+
const total = getTotalChildCount(newNodes, j);
|
|
1545
|
+
patches.push({
|
|
1546
|
+
type: Add,
|
|
1547
|
+
nodes: newNodes.slice(j + 1, j + total)
|
|
1548
|
+
});
|
|
1549
|
+
i++;
|
|
1550
|
+
j += total;
|
|
1551
|
+
continue;
|
|
1552
|
+
}
|
|
1553
|
+
i++;
|
|
1554
|
+
j++;
|
|
1555
|
+
siblingOffset++;
|
|
1556
|
+
}
|
|
1557
|
+
while (i < oldNodes.length) {
|
|
1558
|
+
if (indexStack.length !== 2) {
|
|
1559
|
+
patches.push({
|
|
1560
|
+
type: NavigateParent
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
patches.push({
|
|
1564
|
+
type: RemoveChild,
|
|
1565
|
+
index: siblingOffset
|
|
1566
|
+
});
|
|
1567
|
+
i += getTotalChildCount(oldNodes, i);
|
|
1568
|
+
indexStack.pop();
|
|
1569
|
+
indexStack.pop();
|
|
1570
|
+
}
|
|
1571
|
+
while (j < newNodes.length) {
|
|
1572
|
+
if (siblingOffset > 0) {
|
|
1573
|
+
patches.push({
|
|
1574
|
+
type: NavigateSibling,
|
|
1575
|
+
index: siblingOffset
|
|
1576
|
+
});
|
|
1577
|
+
siblingOffset = 0;
|
|
1578
|
+
}
|
|
1579
|
+
const count = getTotalChildCount(newNodes, j);
|
|
1580
|
+
patches.push({
|
|
1581
|
+
type: Add,
|
|
1582
|
+
nodes: newNodes.slice(j, j + count)
|
|
1583
|
+
});
|
|
1584
|
+
j += count;
|
|
1585
|
+
}
|
|
1586
|
+
return patches;
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
const User = 1;
|
|
1590
|
+
const Script = 2;
|
|
1591
|
+
|
|
1592
|
+
const clearSearchResults$1 = state => {
|
|
1593
|
+
return {
|
|
1594
|
+
...state,
|
|
1595
|
+
value: '',
|
|
1596
|
+
items: [],
|
|
1597
|
+
minLineY: 0,
|
|
1598
|
+
maxLineY: 0,
|
|
1599
|
+
message: '',
|
|
1600
|
+
focus: FocusSearchInput,
|
|
1601
|
+
focusSource: Script,
|
|
1602
|
+
inputSource: Script
|
|
1603
|
+
};
|
|
1604
|
+
};
|
|
1605
|
+
|
|
1606
|
+
const File = 1;
|
|
1607
|
+
const Match = 2;
|
|
1608
|
+
|
|
1609
|
+
const getPaths = items => {
|
|
1610
|
+
const paths = [];
|
|
1611
|
+
for (const item of items) {
|
|
1612
|
+
if (item.type === File) {
|
|
1613
|
+
paths.push(item.text);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
return paths;
|
|
1617
|
+
};
|
|
1618
|
+
const collapseAll$1 = async state => {
|
|
1619
|
+
const {
|
|
1620
|
+
items
|
|
1621
|
+
} = state;
|
|
1622
|
+
if (items.length === 0) {
|
|
1623
|
+
return state;
|
|
1624
|
+
}
|
|
1625
|
+
const paths = getPaths(items);
|
|
1626
|
+
return {
|
|
1627
|
+
...state,
|
|
1628
|
+
collapsedPaths: paths
|
|
1629
|
+
};
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
const PreserveCase$2 = 1 << 0; // 1
|
|
1633
|
+
const UseRegularExpression$2 = 1 << 1; // 2
|
|
1634
|
+
const ReplaceExpanded = 1 << 2; // 4
|
|
1635
|
+
const MatchWholeWord$2 = 1 << 3; // 8
|
|
1636
|
+
const MatchCase$2 = 1 << 4; // 16
|
|
1637
|
+
const DetailsExpanded = 1 << 5; // 32
|
|
1638
|
+
const OpenEditors = 1 << 6; // 64
|
|
1639
|
+
const UseIgnoreFiles = 1 << 7; // 128
|
|
1640
|
+
const hasDetailsExpanded = flags => {
|
|
1641
|
+
return (flags & DetailsExpanded) === DetailsExpanded;
|
|
1642
|
+
};
|
|
1643
|
+
|
|
1644
|
+
const collapseDetails = state => {
|
|
1645
|
+
const {
|
|
1646
|
+
flags
|
|
1647
|
+
} = state;
|
|
1648
|
+
return {
|
|
1649
|
+
...state,
|
|
1650
|
+
flags: flags & -33,
|
|
1651
|
+
focus: FocusSearchInput,
|
|
1652
|
+
focusSource: Script
|
|
1653
|
+
};
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1425
1656
|
const rpcs = Object.create(null);
|
|
1426
1657
|
const set$3 = (id, rpc) => {
|
|
1427
1658
|
rpcs[id] = rpc;
|
|
@@ -1877,7 +2108,8 @@ const {
|
|
|
1877
2108
|
set,
|
|
1878
2109
|
wrapCommand,
|
|
1879
2110
|
registerCommands,
|
|
1880
|
-
getCommandIds
|
|
2111
|
+
getCommandIds,
|
|
2112
|
+
wrapGetter
|
|
1881
2113
|
} = create$3();
|
|
1882
2114
|
|
|
1883
2115
|
const List = 1;
|
|
@@ -1932,7 +2164,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
1932
2164
|
workspacePath: workspacePath,
|
|
1933
2165
|
includeValue: '',
|
|
1934
2166
|
excludeValue: '',
|
|
1935
|
-
focus: Empty
|
|
2167
|
+
focus: Empty,
|
|
1936
2168
|
loaded: false,
|
|
1937
2169
|
message: '',
|
|
1938
2170
|
collapsedPaths: [],
|
|
@@ -1991,7 +2223,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
1991
2223
|
|
|
1992
2224
|
const diffType$2 = RenderItems;
|
|
1993
2225
|
const isEqual$2 = (oldState, newState) => {
|
|
1994
|
-
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;
|
|
2226
|
+
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.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;
|
|
1995
2227
|
};
|
|
1996
2228
|
|
|
1997
2229
|
const diffType$1 = RenderReplaceValue;
|
|
@@ -2007,7 +2239,7 @@ const isEqual = (oldState, newState) => {
|
|
|
2007
2239
|
const modules = [isEqual$2, isEqual$5, isEqual$3, isEqual$6, isEqual$1, isEqual, isEqual$4];
|
|
2008
2240
|
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType, RenderFocusContext];
|
|
2009
2241
|
|
|
2010
|
-
const diff
|
|
2242
|
+
const diff = (oldState, newState) => {
|
|
2011
2243
|
const diffResult = [];
|
|
2012
2244
|
for (let i = 0; i < modules.length; i++) {
|
|
2013
2245
|
const fn = modules[i];
|
|
@@ -2023,7 +2255,7 @@ const diff2 = uid => {
|
|
|
2023
2255
|
oldState,
|
|
2024
2256
|
newState
|
|
2025
2257
|
} = get$1(uid);
|
|
2026
|
-
const diffResult = diff
|
|
2258
|
+
const diffResult = diff(oldState, newState);
|
|
2027
2259
|
return diffResult;
|
|
2028
2260
|
};
|
|
2029
2261
|
|
|
@@ -2234,7 +2466,7 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2234
2466
|
const getSetSize = (items, index) => {
|
|
2235
2467
|
let setSize = 0;
|
|
2236
2468
|
for (let i = index + 1; i < items.length; i++) {
|
|
2237
|
-
if (items[i].type === File
|
|
2469
|
+
if (items[i].type === File) {
|
|
2238
2470
|
break;
|
|
2239
2471
|
}
|
|
2240
2472
|
setSize++;
|
|
@@ -2253,7 +2485,7 @@ const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
|
2253
2485
|
};
|
|
2254
2486
|
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
2255
2487
|
for (let i = index; i >= 0; i--) {
|
|
2256
|
-
if (items[i].type === File
|
|
2488
|
+
if (items[i].type === File) {
|
|
2257
2489
|
const setSize = getSetSize(items, i);
|
|
2258
2490
|
if (setSize === 1) {
|
|
2259
2491
|
return {
|
|
@@ -2278,7 +2510,7 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
|
2278
2510
|
const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
2279
2511
|
const item = items[index];
|
|
2280
2512
|
switch (item.type) {
|
|
2281
|
-
case File
|
|
2513
|
+
case File:
|
|
2282
2514
|
return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
|
|
2283
2515
|
case Match:
|
|
2284
2516
|
return getRemoveIndicesMatch(items, index, matchCount, fileCount);
|
|
@@ -2414,8 +2646,6 @@ const getNextFocus = (focus, flags) => {
|
|
|
2414
2646
|
return FocusSearchResults;
|
|
2415
2647
|
case FocusIgnoreFiles:
|
|
2416
2648
|
return FocusSearchResults;
|
|
2417
|
-
case FocusUseExcludeSettings:
|
|
2418
|
-
return FocusSearchResults;
|
|
2419
2649
|
default:
|
|
2420
2650
|
return focus;
|
|
2421
2651
|
}
|
|
@@ -2626,10 +2856,10 @@ const getFileName$1 = text => {
|
|
|
2626
2856
|
const getFileIcons = async matches => {
|
|
2627
2857
|
const requests = [];
|
|
2628
2858
|
for (const item of matches) {
|
|
2629
|
-
if (item.type === File
|
|
2859
|
+
if (item.type === File) {
|
|
2630
2860
|
const fileName = getFileName$1(item.text);
|
|
2631
2861
|
requests.push({
|
|
2632
|
-
type: File,
|
|
2862
|
+
type: File$1,
|
|
2633
2863
|
name: fileName,
|
|
2634
2864
|
path: `/${fileName}`
|
|
2635
2865
|
});
|
|
@@ -2661,7 +2891,7 @@ const getTextSearchResultCounts = results => {
|
|
|
2661
2891
|
let fileCount = 0;
|
|
2662
2892
|
for (const result of results) {
|
|
2663
2893
|
switch (result.type) {
|
|
2664
|
-
case File
|
|
2894
|
+
case File:
|
|
2665
2895
|
fileCount++;
|
|
2666
2896
|
break;
|
|
2667
2897
|
case Match:
|
|
@@ -3048,7 +3278,7 @@ const getReplaceElements = (items, workspacePath, replacement) => {
|
|
|
3048
3278
|
end,
|
|
3049
3279
|
start
|
|
3050
3280
|
} = match;
|
|
3051
|
-
if (type === File
|
|
3281
|
+
if (type === File) {
|
|
3052
3282
|
changes = [];
|
|
3053
3283
|
const fileName = getFileName(text);
|
|
3054
3284
|
const absolutePath = `${workspacePath}/${fileName}`;
|
|
@@ -3248,7 +3478,9 @@ const handleInputBlur = async (state, name) => {
|
|
|
3248
3478
|
const handleInputFocus = state => {
|
|
3249
3479
|
return {
|
|
3250
3480
|
...state,
|
|
3251
|
-
listFocused: false
|
|
3481
|
+
listFocused: false,
|
|
3482
|
+
focus: FocusSearchInput,
|
|
3483
|
+
focused: true
|
|
3252
3484
|
};
|
|
3253
3485
|
};
|
|
3254
3486
|
|
|
@@ -3615,7 +3847,7 @@ const getFilteredResults = (results, collapsedPaths) => {
|
|
|
3615
3847
|
const filteredResults = [];
|
|
3616
3848
|
let isExcluded = false;
|
|
3617
3849
|
for (const result of results) {
|
|
3618
|
-
if (result.type === File
|
|
3850
|
+
if (result.type === File) {
|
|
3619
3851
|
filteredResults.push(result);
|
|
3620
3852
|
isExcluded = collapsedPaths.includes(result.text) ? true : false;
|
|
3621
3853
|
}
|
|
@@ -3666,7 +3898,7 @@ const selectIndexFile = async (state, searchResult, index) => {
|
|
|
3666
3898
|
const getFileIndex = (items, index) => {
|
|
3667
3899
|
for (let i = index; i >= 0; i--) {
|
|
3668
3900
|
const item = items[i];
|
|
3669
|
-
if (item.type === File
|
|
3901
|
+
if (item.type === File) {
|
|
3670
3902
|
return i;
|
|
3671
3903
|
}
|
|
3672
3904
|
}
|
|
@@ -3717,7 +3949,7 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
3717
3949
|
|
|
3718
3950
|
const getSelectHandler = type => {
|
|
3719
3951
|
switch (type) {
|
|
3720
|
-
case File
|
|
3952
|
+
case File:
|
|
3721
3953
|
return selectIndexFile;
|
|
3722
3954
|
case Match:
|
|
3723
3955
|
return selectIndexPreview;
|
|
@@ -3756,6 +3988,27 @@ const handleClickAt = async (state, eventX, eventY) => {
|
|
|
3756
3988
|
return selectIndex(state, index);
|
|
3757
3989
|
};
|
|
3758
3990
|
|
|
3991
|
+
const handleListPointerDown = async state => {
|
|
3992
|
+
// TODO set list to focused and render focus outline
|
|
3993
|
+
return {
|
|
3994
|
+
...state,
|
|
3995
|
+
listFocused: true
|
|
3996
|
+
};
|
|
3997
|
+
};
|
|
3998
|
+
|
|
3999
|
+
const getSavedFocus = savedState => {
|
|
4000
|
+
if (savedState && typeof savedState === 'object' && 'focus' in savedState && typeof savedState.focus === 'number') {
|
|
4001
|
+
return savedState.focus;
|
|
4002
|
+
}
|
|
4003
|
+
return 0;
|
|
4004
|
+
};
|
|
4005
|
+
const getSavedListFocus = savedState => {
|
|
4006
|
+
if (savedState && typeof savedState === 'object' && 'listFocused' in savedState && typeof savedState.listFocused === 'boolean') {
|
|
4007
|
+
return savedState.listFocused;
|
|
4008
|
+
}
|
|
4009
|
+
return false;
|
|
4010
|
+
};
|
|
4011
|
+
|
|
3759
4012
|
const isString = value => {
|
|
3760
4013
|
return typeof value === 'string';
|
|
3761
4014
|
};
|
|
@@ -3812,7 +4065,9 @@ const restoreState = savedState => {
|
|
|
3812
4065
|
flags: getSavedFlags(savedState),
|
|
3813
4066
|
includeValue: getSavedIncludeValue(savedState),
|
|
3814
4067
|
excludeValue: getSavedExcludeValue(savedState),
|
|
3815
|
-
history: getSavedHistory(savedState)
|
|
4068
|
+
history: getSavedHistory(savedState),
|
|
4069
|
+
focus: getSavedFocus(savedState),
|
|
4070
|
+
listFocused: getSavedListFocus(savedState)
|
|
3816
4071
|
};
|
|
3817
4072
|
};
|
|
3818
4073
|
|
|
@@ -3826,17 +4081,19 @@ const loadContent = async (state, savedState) => {
|
|
|
3826
4081
|
includeValue,
|
|
3827
4082
|
excludeValue
|
|
3828
4083
|
} = restoreState(savedState);
|
|
4084
|
+
const update = {
|
|
4085
|
+
value: savedValue,
|
|
4086
|
+
threads,
|
|
4087
|
+
inputSource: Script,
|
|
4088
|
+
collapsedPaths: savedCollapsedPaths,
|
|
4089
|
+
replacement,
|
|
4090
|
+
flags,
|
|
4091
|
+
includeValue,
|
|
4092
|
+
excludeValue,
|
|
4093
|
+
focus: 0 // TODO
|
|
4094
|
+
};
|
|
3829
4095
|
if (savedValue) {
|
|
3830
|
-
const result = await handleUpdate(state,
|
|
3831
|
-
value: savedValue,
|
|
3832
|
-
threads,
|
|
3833
|
-
inputSource: Script,
|
|
3834
|
-
collapsedPaths: savedCollapsedPaths,
|
|
3835
|
-
replacement,
|
|
3836
|
-
flags,
|
|
3837
|
-
includeValue,
|
|
3838
|
-
excludeValue
|
|
3839
|
-
});
|
|
4096
|
+
const result = await handleUpdate(state, update);
|
|
3840
4097
|
return {
|
|
3841
4098
|
...result,
|
|
3842
4099
|
loaded: true
|
|
@@ -3844,6 +4101,7 @@ const loadContent = async (state, savedState) => {
|
|
|
3844
4101
|
}
|
|
3845
4102
|
return {
|
|
3846
4103
|
...state,
|
|
4104
|
+
...update,
|
|
3847
4105
|
threads,
|
|
3848
4106
|
flags,
|
|
3849
4107
|
loaded: true
|
|
@@ -3931,11 +4189,11 @@ const getFocusSelector = focusKey => {
|
|
|
3931
4189
|
|
|
3932
4190
|
const renderFocus = (oldState, newState) => {
|
|
3933
4191
|
const selector = getFocusSelector(newState.focus);
|
|
3934
|
-
return [
|
|
4192
|
+
return [FocusElementByName, newState.uid, selector];
|
|
3935
4193
|
};
|
|
3936
4194
|
|
|
3937
4195
|
const renderFocusContext = (oldState, newState) => {
|
|
3938
|
-
return [
|
|
4196
|
+
return [SetFocusContext, newState.uid, newState.focus];
|
|
3939
4197
|
};
|
|
3940
4198
|
|
|
3941
4199
|
const None = 0;
|
|
@@ -3945,7 +4203,7 @@ const Expanded = 2;
|
|
|
3945
4203
|
const getMatchCount = (results, startIndex) => {
|
|
3946
4204
|
for (let i = startIndex + 1; i < results.length; i++) {
|
|
3947
4205
|
const result = results[i];
|
|
3948
|
-
if (result.type === File
|
|
4206
|
+
if (result.type === File) {
|
|
3949
4207
|
return i - startIndex - 1;
|
|
3950
4208
|
}
|
|
3951
4209
|
}
|
|
@@ -4004,7 +4262,7 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
|
|
|
4004
4262
|
const focused = i === focusedIndex;
|
|
4005
4263
|
const relativeIndex = i - minLineY;
|
|
4006
4264
|
switch (type) {
|
|
4007
|
-
case File
|
|
4265
|
+
case File:
|
|
4008
4266
|
return getSearchDisplayResultFile(results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults);
|
|
4009
4267
|
case Match:
|
|
4010
4268
|
return getDisplayResultMatch(setSize, searchTermLength, replacement, text, posInSet, start, focused);
|
|
@@ -4074,233 +4332,6 @@ const createViewModel = state => {
|
|
|
4074
4332
|
};
|
|
4075
4333
|
};
|
|
4076
4334
|
|
|
4077
|
-
const mergeClassNames = (...classNames) => {
|
|
4078
|
-
return classNames.filter(Boolean).join(' ');
|
|
4079
|
-
};
|
|
4080
|
-
|
|
4081
|
-
const text = data => {
|
|
4082
|
-
return {
|
|
4083
|
-
type: Text,
|
|
4084
|
-
text: data,
|
|
4085
|
-
childCount: 0
|
|
4086
|
-
};
|
|
4087
|
-
};
|
|
4088
|
-
|
|
4089
|
-
const SetText = 1;
|
|
4090
|
-
const SetAttribute = 3;
|
|
4091
|
-
const RemoveAttribute = 4;
|
|
4092
|
-
const Add = 6;
|
|
4093
|
-
const NavigateChild = 7;
|
|
4094
|
-
const NavigateParent = 8;
|
|
4095
|
-
const RemoveChild = 9;
|
|
4096
|
-
const NavigateSibling = 10;
|
|
4097
|
-
|
|
4098
|
-
const applyPendingPatches = (patches, pendingPatches, skip) => {
|
|
4099
|
-
for (let k = 0; k < pendingPatches.length - skip; k += 2) {
|
|
4100
|
-
const type = pendingPatches[k];
|
|
4101
|
-
const index = pendingPatches[k + 1];
|
|
4102
|
-
if (type === NavigateParent) {
|
|
4103
|
-
patches.push({
|
|
4104
|
-
type
|
|
4105
|
-
});
|
|
4106
|
-
} else {
|
|
4107
|
-
patches.push({
|
|
4108
|
-
type,
|
|
4109
|
-
index
|
|
4110
|
-
});
|
|
4111
|
-
}
|
|
4112
|
-
}
|
|
4113
|
-
pendingPatches.length = 0;
|
|
4114
|
-
};
|
|
4115
|
-
|
|
4116
|
-
const isKey = key => {
|
|
4117
|
-
return key !== 'type' && key !== 'childCount';
|
|
4118
|
-
};
|
|
4119
|
-
|
|
4120
|
-
const getKeys = node => {
|
|
4121
|
-
const keys = Object.keys(node).filter(isKey);
|
|
4122
|
-
return keys;
|
|
4123
|
-
};
|
|
4124
|
-
|
|
4125
|
-
const getTotalChildCount = (nodes, index) => {
|
|
4126
|
-
let i = index;
|
|
4127
|
-
let pending = 1;
|
|
4128
|
-
while (pending) {
|
|
4129
|
-
const node = nodes[i];
|
|
4130
|
-
pending += node.childCount;
|
|
4131
|
-
pending--;
|
|
4132
|
-
i++;
|
|
4133
|
-
}
|
|
4134
|
-
return i - index;
|
|
4135
|
-
};
|
|
4136
|
-
|
|
4137
|
-
const diff = (oldNodes, newNodes) => {
|
|
4138
|
-
const patches = [];
|
|
4139
|
-
const pendingPatches = [];
|
|
4140
|
-
let i = 0;
|
|
4141
|
-
let j = 0;
|
|
4142
|
-
let siblingOffset = 0;
|
|
4143
|
-
let maxSiblingOffset = 1;
|
|
4144
|
-
const indexStack = [0, 1];
|
|
4145
|
-
while (i < oldNodes.length && j < newNodes.length) {
|
|
4146
|
-
const oldNode = oldNodes[i];
|
|
4147
|
-
const newNode = newNodes[j];
|
|
4148
|
-
// TODO maybe don't have the current element in indexstack
|
|
4149
|
-
if (siblingOffset === maxSiblingOffset) {
|
|
4150
|
-
indexStack.pop();
|
|
4151
|
-
indexStack.pop();
|
|
4152
|
-
pendingPatches.push(NavigateParent, 0);
|
|
4153
|
-
maxSiblingOffset = indexStack.pop();
|
|
4154
|
-
siblingOffset = indexStack.pop() + 1;
|
|
4155
|
-
}
|
|
4156
|
-
while (siblingOffset === maxSiblingOffset) {
|
|
4157
|
-
pendingPatches.push(NavigateParent, 0);
|
|
4158
|
-
maxSiblingOffset = indexStack.pop();
|
|
4159
|
-
siblingOffset = indexStack.pop() + 1;
|
|
4160
|
-
}
|
|
4161
|
-
if (oldNode.type !== newNode.type) {
|
|
4162
|
-
let skip = 0;
|
|
4163
|
-
if (pendingPatches.length > 0 && pendingPatches.at(-2) === NavigateChild) {
|
|
4164
|
-
skip = 2;
|
|
4165
|
-
}
|
|
4166
|
-
applyPendingPatches(patches, pendingPatches, skip);
|
|
4167
|
-
const oldTotal = getTotalChildCount(oldNodes, i);
|
|
4168
|
-
const newTotal = getTotalChildCount(newNodes, j);
|
|
4169
|
-
patches.push({
|
|
4170
|
-
type: RemoveChild,
|
|
4171
|
-
index: siblingOffset
|
|
4172
|
-
});
|
|
4173
|
-
patches.push({
|
|
4174
|
-
type: Add,
|
|
4175
|
-
nodes: newNodes.slice(j, j + newTotal)
|
|
4176
|
-
});
|
|
4177
|
-
siblingOffset++;
|
|
4178
|
-
i += oldTotal;
|
|
4179
|
-
j += newTotal;
|
|
4180
|
-
continue;
|
|
4181
|
-
}
|
|
4182
|
-
if (oldNode.type === Text && newNode.type === Text) {
|
|
4183
|
-
if (oldNode.text !== newNode.text) {
|
|
4184
|
-
if (siblingOffset !== 0) {
|
|
4185
|
-
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
4186
|
-
}
|
|
4187
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4188
|
-
patches.push({
|
|
4189
|
-
type: SetText,
|
|
4190
|
-
value: newNode.text
|
|
4191
|
-
});
|
|
4192
|
-
}
|
|
4193
|
-
i++;
|
|
4194
|
-
j++;
|
|
4195
|
-
siblingOffset++;
|
|
4196
|
-
continue;
|
|
4197
|
-
}
|
|
4198
|
-
const oldKeys = getKeys(oldNode);
|
|
4199
|
-
const newKeys = getKeys(newNode);
|
|
4200
|
-
let hasAttributeChanges = false;
|
|
4201
|
-
for (const key of newKeys) {
|
|
4202
|
-
if (oldNode[key] !== newNode[key]) {
|
|
4203
|
-
hasAttributeChanges = true;
|
|
4204
|
-
break;
|
|
4205
|
-
}
|
|
4206
|
-
}
|
|
4207
|
-
for (const key of oldKeys) {
|
|
4208
|
-
if (!(key in newNode)) {
|
|
4209
|
-
hasAttributeChanges = true;
|
|
4210
|
-
break;
|
|
4211
|
-
}
|
|
4212
|
-
}
|
|
4213
|
-
if (hasAttributeChanges) {
|
|
4214
|
-
if (siblingOffset > 0) {
|
|
4215
|
-
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
4216
|
-
}
|
|
4217
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4218
|
-
for (const key of newKeys) {
|
|
4219
|
-
if (oldNode[key] !== newNode[key]) {
|
|
4220
|
-
patches.push({
|
|
4221
|
-
type: SetAttribute,
|
|
4222
|
-
key,
|
|
4223
|
-
value: newNode[key]
|
|
4224
|
-
});
|
|
4225
|
-
}
|
|
4226
|
-
}
|
|
4227
|
-
for (const key of oldKeys) {
|
|
4228
|
-
if (!(key in newNode)) {
|
|
4229
|
-
patches.push({
|
|
4230
|
-
type: RemoveAttribute,
|
|
4231
|
-
key
|
|
4232
|
-
});
|
|
4233
|
-
}
|
|
4234
|
-
}
|
|
4235
|
-
}
|
|
4236
|
-
if (oldNode.childCount && newNode.childCount) {
|
|
4237
|
-
maxSiblingOffset = oldNode.childCount;
|
|
4238
|
-
indexStack.push(0, maxSiblingOffset);
|
|
4239
|
-
pendingPatches.push(NavigateChild, 0);
|
|
4240
|
-
i++;
|
|
4241
|
-
j++;
|
|
4242
|
-
continue;
|
|
4243
|
-
}
|
|
4244
|
-
if (oldNode.childCount) {
|
|
4245
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4246
|
-
for (let k = 0; k < oldNode.childCount; k++) {
|
|
4247
|
-
patches.push({
|
|
4248
|
-
type: RemoveChild,
|
|
4249
|
-
index: 0
|
|
4250
|
-
});
|
|
4251
|
-
}
|
|
4252
|
-
i += getTotalChildCount(oldNodes, i);
|
|
4253
|
-
j++;
|
|
4254
|
-
siblingOffset++;
|
|
4255
|
-
continue;
|
|
4256
|
-
}
|
|
4257
|
-
if (newNode.childCount) {
|
|
4258
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4259
|
-
const total = getTotalChildCount(newNodes, j);
|
|
4260
|
-
patches.push({
|
|
4261
|
-
type: Add,
|
|
4262
|
-
nodes: newNodes.slice(j + 1, j + total)
|
|
4263
|
-
});
|
|
4264
|
-
i++;
|
|
4265
|
-
j += total;
|
|
4266
|
-
continue;
|
|
4267
|
-
}
|
|
4268
|
-
i++;
|
|
4269
|
-
j++;
|
|
4270
|
-
siblingOffset++;
|
|
4271
|
-
}
|
|
4272
|
-
while (i < oldNodes.length) {
|
|
4273
|
-
if (indexStack.length !== 2) {
|
|
4274
|
-
patches.push({
|
|
4275
|
-
type: NavigateParent
|
|
4276
|
-
});
|
|
4277
|
-
}
|
|
4278
|
-
patches.push({
|
|
4279
|
-
type: RemoveChild,
|
|
4280
|
-
index: siblingOffset
|
|
4281
|
-
});
|
|
4282
|
-
i += getTotalChildCount(oldNodes, i);
|
|
4283
|
-
indexStack.pop();
|
|
4284
|
-
indexStack.pop();
|
|
4285
|
-
}
|
|
4286
|
-
while (j < newNodes.length) {
|
|
4287
|
-
if (siblingOffset > 0) {
|
|
4288
|
-
patches.push({
|
|
4289
|
-
type: NavigateSibling,
|
|
4290
|
-
index: siblingOffset
|
|
4291
|
-
});
|
|
4292
|
-
siblingOffset = 0;
|
|
4293
|
-
}
|
|
4294
|
-
const count = getTotalChildCount(newNodes, j);
|
|
4295
|
-
patches.push({
|
|
4296
|
-
type: Add,
|
|
4297
|
-
nodes: newNodes.slice(j, j + count)
|
|
4298
|
-
});
|
|
4299
|
-
j += count;
|
|
4300
|
-
}
|
|
4301
|
-
return patches;
|
|
4302
|
-
};
|
|
4303
|
-
|
|
4304
4335
|
const HandleClick = 1;
|
|
4305
4336
|
const HandleContextMenu = 2;
|
|
4306
4337
|
const HandleHeaderContextMenu = 3;
|
|
@@ -4318,6 +4349,7 @@ const HandleToggleButtonClick = 15;
|
|
|
4318
4349
|
const HandleWheel = 16;
|
|
4319
4350
|
const HandleInputFocus = 17;
|
|
4320
4351
|
const HandleInputBlur = 18;
|
|
4352
|
+
const HandleListPointerDown = 19;
|
|
4321
4353
|
|
|
4322
4354
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4323
4355
|
return [{
|
|
@@ -4897,7 +4929,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
|
4897
4929
|
onWheel: HandleWheel,
|
|
4898
4930
|
onContextMenu: HandleContextMenu,
|
|
4899
4931
|
id: TreeItems,
|
|
4900
|
-
top: `${-pixelOffset}px`
|
|
4932
|
+
top: `${-pixelOffset}px` // TODO use dynamic css instead
|
|
4901
4933
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
4902
4934
|
};
|
|
4903
4935
|
|
|
@@ -4905,10 +4937,12 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
|
|
|
4905
4937
|
const childCount = scrollbarHeight === 0 ? 1 : 2;
|
|
4906
4938
|
return [{
|
|
4907
4939
|
type: Div,
|
|
4908
|
-
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty),
|
|
4940
|
+
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty$1),
|
|
4909
4941
|
role: Tree$1,
|
|
4910
4942
|
tabIndex: 0,
|
|
4911
|
-
childCount
|
|
4943
|
+
childCount,
|
|
4944
|
+
onBlur: HandleListBlur,
|
|
4945
|
+
onPointerDown: HandleListPointerDown
|
|
4912
4946
|
}, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
|
|
4913
4947
|
};
|
|
4914
4948
|
|
|
@@ -4925,20 +4959,20 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
4925
4959
|
const renderItems = (oldState, newState) => {
|
|
4926
4960
|
const viewModel = createViewModel(newState);
|
|
4927
4961
|
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);
|
|
4928
|
-
return [
|
|
4962
|
+
return [SetDom2, newState.uid, dom];
|
|
4929
4963
|
};
|
|
4930
4964
|
|
|
4931
4965
|
const renderValue = (oldState, newState) => {
|
|
4932
|
-
return [
|
|
4966
|
+
return [SetValueByName, SearchValue, newState.value];
|
|
4933
4967
|
};
|
|
4934
4968
|
const renderReplacement = (oldState, newState) => {
|
|
4935
|
-
return [
|
|
4969
|
+
return [SetValueByName, ReplaceValue, newState.replacement];
|
|
4936
4970
|
};
|
|
4937
4971
|
const renderIncludeValue = (oldState, newState) => {
|
|
4938
|
-
return [
|
|
4972
|
+
return [SetValueByName, FilesToInclude, newState.includeValue];
|
|
4939
4973
|
};
|
|
4940
4974
|
const renderExcludeValue = (oldState, newState) => {
|
|
4941
|
-
return [
|
|
4975
|
+
return [SetValueByName, FilesToExclude, newState.excludeValue];
|
|
4942
4976
|
};
|
|
4943
4977
|
|
|
4944
4978
|
const getRenderer = diffType => {
|
|
@@ -5082,6 +5116,9 @@ const renderEventListeners = () => {
|
|
|
5082
5116
|
}, {
|
|
5083
5117
|
name: HandleClick,
|
|
5084
5118
|
params: ['handleClickAt', ClientX, ClientY]
|
|
5119
|
+
}, {
|
|
5120
|
+
name: HandleListPointerDown,
|
|
5121
|
+
params: ['handleListPointerDown']
|
|
5085
5122
|
}, {
|
|
5086
5123
|
name: HandleToggleButtonClick,
|
|
5087
5124
|
params: ['handleToggleButtonClick']
|
|
@@ -5141,7 +5178,7 @@ const renderIncremental = uid => {
|
|
|
5141
5178
|
} = get$1(uid);
|
|
5142
5179
|
const oldDom = getDom(oldState);
|
|
5143
5180
|
const newDom = getDom(newState);
|
|
5144
|
-
const patches = diff(oldDom, newDom);
|
|
5181
|
+
const patches = diff$1(oldDom, newDom);
|
|
5145
5182
|
return patches;
|
|
5146
5183
|
};
|
|
5147
5184
|
|
|
@@ -5195,10 +5232,7 @@ const rerender = state => {
|
|
|
5195
5232
|
};
|
|
5196
5233
|
};
|
|
5197
5234
|
|
|
5198
|
-
const saveState =
|
|
5199
|
-
const {
|
|
5200
|
-
newState
|
|
5201
|
-
} = get$1(uid);
|
|
5235
|
+
const saveState = state => {
|
|
5202
5236
|
const {
|
|
5203
5237
|
value,
|
|
5204
5238
|
replacement,
|
|
@@ -5206,8 +5240,10 @@ const saveState = uid => {
|
|
|
5206
5240
|
includeValue,
|
|
5207
5241
|
excludeValue,
|
|
5208
5242
|
history,
|
|
5209
|
-
collapsedPaths
|
|
5210
|
-
|
|
5243
|
+
collapsedPaths,
|
|
5244
|
+
focus,
|
|
5245
|
+
listFocused
|
|
5246
|
+
} = state;
|
|
5211
5247
|
return {
|
|
5212
5248
|
value,
|
|
5213
5249
|
replacement,
|
|
@@ -5215,7 +5251,9 @@ const saveState = uid => {
|
|
|
5215
5251
|
includeValue,
|
|
5216
5252
|
excludeValue,
|
|
5217
5253
|
history,
|
|
5218
|
-
collapsedPaths
|
|
5254
|
+
collapsedPaths,
|
|
5255
|
+
focus,
|
|
5256
|
+
listFocused
|
|
5219
5257
|
};
|
|
5220
5258
|
};
|
|
5221
5259
|
|
|
@@ -5256,7 +5294,7 @@ const getSearchFocusKey = key => {
|
|
|
5256
5294
|
case ToggleReplace:
|
|
5257
5295
|
return FocusToggleReplace;
|
|
5258
5296
|
default:
|
|
5259
|
-
return Empty
|
|
5297
|
+
return Empty;
|
|
5260
5298
|
}
|
|
5261
5299
|
};
|
|
5262
5300
|
|
|
@@ -5447,6 +5485,7 @@ const commandMap = {
|
|
|
5447
5485
|
'TextSearch.toggleReplace': wrapCommand(toggleReplace),
|
|
5448
5486
|
'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
|
|
5449
5487
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
5488
|
+
'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
|
|
5450
5489
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
5451
5490
|
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
5452
5491
|
// not wrapped
|
|
@@ -5458,7 +5497,7 @@ const commandMap = {
|
|
|
5458
5497
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5459
5498
|
'TextSearch.renderIncremental': renderIncremental,
|
|
5460
5499
|
'TextSearch.restoreState': restoreState,
|
|
5461
|
-
'TextSearch.saveState': saveState,
|
|
5500
|
+
'TextSearch.saveState': wrapGetter(saveState),
|
|
5462
5501
|
'TextSearch.terminate': terminate,
|
|
5463
5502
|
'TextSearch.renderActions': renderActions,
|
|
5464
5503
|
// TODO needed?
|