@lvce-editor/text-search-worker 5.11.0 → 5.13.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 +425 -368
- 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;
|
|
@@ -1415,6 +1330,8 @@ const TargetValue = 'event.target.value';
|
|
|
1415
1330
|
|
|
1416
1331
|
const Search$1 = 18;
|
|
1417
1332
|
|
|
1333
|
+
const LeftClick = 0;
|
|
1334
|
+
|
|
1418
1335
|
const Electron = 2;
|
|
1419
1336
|
const Remote = 3;
|
|
1420
1337
|
|
|
@@ -1422,6 +1339,322 @@ const DebugWorker = 55;
|
|
|
1422
1339
|
const RendererWorker$1 = 1;
|
|
1423
1340
|
const SearchProcess = 77;
|
|
1424
1341
|
|
|
1342
|
+
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
1343
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
1344
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1345
|
+
const SetValueByName = 'Viewlet.setValueByName';
|
|
1346
|
+
|
|
1347
|
+
const Empty = 0;
|
|
1348
|
+
const FocusIgnoreFiles = 1012;
|
|
1349
|
+
const FocusSearch = 1013;
|
|
1350
|
+
const FocusSearchExcludeInput = 1008;
|
|
1351
|
+
const FocusSearchIncludeInput = 1007;
|
|
1352
|
+
const FocusSearchInput = 21;
|
|
1353
|
+
const FocusSearchMatchCase = 32;
|
|
1354
|
+
const FocusSearchOpenEditors = 1011;
|
|
1355
|
+
const FocusSearchPreserveCase = 36;
|
|
1356
|
+
const FocusSearchRegex = 33;
|
|
1357
|
+
const FocusSearchReplaceAll = 35;
|
|
1358
|
+
const FocusSearchReplaceInput = 31;
|
|
1359
|
+
const FocusSearchResults = 22;
|
|
1360
|
+
const FocusSearchWholeWord = 34;
|
|
1361
|
+
const FocusToggleDetails = 1010;
|
|
1362
|
+
const FocusToggleReplace = 1020;
|
|
1363
|
+
|
|
1364
|
+
const mergeClassNames = (...classNames) => {
|
|
1365
|
+
return classNames.filter(Boolean).join(' ');
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
const text = data => {
|
|
1369
|
+
return {
|
|
1370
|
+
type: Text,
|
|
1371
|
+
text: data,
|
|
1372
|
+
childCount: 0
|
|
1373
|
+
};
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
const SetText = 1;
|
|
1377
|
+
const SetAttribute = 3;
|
|
1378
|
+
const RemoveAttribute = 4;
|
|
1379
|
+
const Add = 6;
|
|
1380
|
+
const NavigateChild = 7;
|
|
1381
|
+
const NavigateParent = 8;
|
|
1382
|
+
const RemoveChild = 9;
|
|
1383
|
+
const NavigateSibling = 10;
|
|
1384
|
+
|
|
1385
|
+
const applyPendingPatches = (patches, pendingPatches, skip) => {
|
|
1386
|
+
for (let k = 0; k < pendingPatches.length - skip; k += 2) {
|
|
1387
|
+
const type = pendingPatches[k];
|
|
1388
|
+
const index = pendingPatches[k + 1];
|
|
1389
|
+
if (type === NavigateParent) {
|
|
1390
|
+
patches.push({
|
|
1391
|
+
type
|
|
1392
|
+
});
|
|
1393
|
+
} else {
|
|
1394
|
+
patches.push({
|
|
1395
|
+
type,
|
|
1396
|
+
index
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
pendingPatches.length = 0;
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
const isKey = key => {
|
|
1404
|
+
return key !== 'type' && key !== 'childCount';
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
const getKeys = node => {
|
|
1408
|
+
const keys = Object.keys(node).filter(isKey);
|
|
1409
|
+
return keys;
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
const getTotalChildCount = (nodes, index) => {
|
|
1413
|
+
let i = index;
|
|
1414
|
+
let pending = 1;
|
|
1415
|
+
while (pending) {
|
|
1416
|
+
const node = nodes[i];
|
|
1417
|
+
pending += node.childCount;
|
|
1418
|
+
pending--;
|
|
1419
|
+
i++;
|
|
1420
|
+
}
|
|
1421
|
+
return i - index;
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
const diff$1 = (oldNodes, newNodes) => {
|
|
1425
|
+
const patches = [];
|
|
1426
|
+
const pendingPatches = [];
|
|
1427
|
+
let i = 0;
|
|
1428
|
+
let j = 0;
|
|
1429
|
+
let siblingOffset = 0;
|
|
1430
|
+
let maxSiblingOffset = 1;
|
|
1431
|
+
const indexStack = [0, 1];
|
|
1432
|
+
while (i < oldNodes.length && j < newNodes.length) {
|
|
1433
|
+
const oldNode = oldNodes[i];
|
|
1434
|
+
const newNode = newNodes[j];
|
|
1435
|
+
// TODO maybe don't have the current element in indexstack
|
|
1436
|
+
if (siblingOffset === maxSiblingOffset) {
|
|
1437
|
+
indexStack.pop();
|
|
1438
|
+
indexStack.pop();
|
|
1439
|
+
pendingPatches.push(NavigateParent, 0);
|
|
1440
|
+
maxSiblingOffset = indexStack.pop();
|
|
1441
|
+
siblingOffset = indexStack.pop() + 1;
|
|
1442
|
+
}
|
|
1443
|
+
while (siblingOffset === maxSiblingOffset) {
|
|
1444
|
+
pendingPatches.push(NavigateParent, 0);
|
|
1445
|
+
maxSiblingOffset = indexStack.pop();
|
|
1446
|
+
siblingOffset = indexStack.pop() + 1;
|
|
1447
|
+
}
|
|
1448
|
+
if (oldNode.type !== newNode.type) {
|
|
1449
|
+
let skip = 0;
|
|
1450
|
+
if (pendingPatches.length > 0 && pendingPatches.at(-2) === NavigateChild) {
|
|
1451
|
+
skip = 2;
|
|
1452
|
+
}
|
|
1453
|
+
applyPendingPatches(patches, pendingPatches, skip);
|
|
1454
|
+
const oldTotal = getTotalChildCount(oldNodes, i);
|
|
1455
|
+
const newTotal = getTotalChildCount(newNodes, j);
|
|
1456
|
+
patches.push({
|
|
1457
|
+
type: RemoveChild,
|
|
1458
|
+
index: siblingOffset
|
|
1459
|
+
});
|
|
1460
|
+
patches.push({
|
|
1461
|
+
type: Add,
|
|
1462
|
+
nodes: newNodes.slice(j, j + newTotal)
|
|
1463
|
+
});
|
|
1464
|
+
siblingOffset++;
|
|
1465
|
+
i += oldTotal;
|
|
1466
|
+
j += newTotal;
|
|
1467
|
+
continue;
|
|
1468
|
+
}
|
|
1469
|
+
if (oldNode.type === Text && newNode.type === Text) {
|
|
1470
|
+
if (oldNode.text !== newNode.text) {
|
|
1471
|
+
if (siblingOffset !== 0) {
|
|
1472
|
+
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
1473
|
+
}
|
|
1474
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1475
|
+
patches.push({
|
|
1476
|
+
type: SetText,
|
|
1477
|
+
value: newNode.text
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
i++;
|
|
1481
|
+
j++;
|
|
1482
|
+
siblingOffset++;
|
|
1483
|
+
continue;
|
|
1484
|
+
}
|
|
1485
|
+
const oldKeys = getKeys(oldNode);
|
|
1486
|
+
const newKeys = getKeys(newNode);
|
|
1487
|
+
let hasAttributeChanges = false;
|
|
1488
|
+
for (const key of newKeys) {
|
|
1489
|
+
if (oldNode[key] !== newNode[key]) {
|
|
1490
|
+
hasAttributeChanges = true;
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
for (const key of oldKeys) {
|
|
1495
|
+
if (!(key in newNode)) {
|
|
1496
|
+
hasAttributeChanges = true;
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
if (hasAttributeChanges) {
|
|
1501
|
+
if (siblingOffset > 0) {
|
|
1502
|
+
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
1503
|
+
}
|
|
1504
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1505
|
+
for (const key of newKeys) {
|
|
1506
|
+
if (oldNode[key] !== newNode[key]) {
|
|
1507
|
+
patches.push({
|
|
1508
|
+
type: SetAttribute,
|
|
1509
|
+
key,
|
|
1510
|
+
value: newNode[key]
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
for (const key of oldKeys) {
|
|
1515
|
+
if (!(key in newNode)) {
|
|
1516
|
+
patches.push({
|
|
1517
|
+
type: RemoveAttribute,
|
|
1518
|
+
key
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
if (oldNode.childCount && newNode.childCount) {
|
|
1524
|
+
maxSiblingOffset = oldNode.childCount;
|
|
1525
|
+
indexStack.push(0, maxSiblingOffset);
|
|
1526
|
+
pendingPatches.push(NavigateChild, 0);
|
|
1527
|
+
i++;
|
|
1528
|
+
j++;
|
|
1529
|
+
continue;
|
|
1530
|
+
}
|
|
1531
|
+
if (oldNode.childCount) {
|
|
1532
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1533
|
+
for (let k = 0; k < oldNode.childCount; k++) {
|
|
1534
|
+
patches.push({
|
|
1535
|
+
type: RemoveChild,
|
|
1536
|
+
index: 0
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
i += getTotalChildCount(oldNodes, i);
|
|
1540
|
+
j++;
|
|
1541
|
+
siblingOffset++;
|
|
1542
|
+
continue;
|
|
1543
|
+
}
|
|
1544
|
+
if (newNode.childCount) {
|
|
1545
|
+
applyPendingPatches(patches, pendingPatches, 0);
|
|
1546
|
+
const total = getTotalChildCount(newNodes, j);
|
|
1547
|
+
patches.push({
|
|
1548
|
+
type: Add,
|
|
1549
|
+
nodes: newNodes.slice(j + 1, j + total)
|
|
1550
|
+
});
|
|
1551
|
+
i++;
|
|
1552
|
+
j += total;
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
i++;
|
|
1556
|
+
j++;
|
|
1557
|
+
siblingOffset++;
|
|
1558
|
+
}
|
|
1559
|
+
while (i < oldNodes.length) {
|
|
1560
|
+
if (indexStack.length !== 2) {
|
|
1561
|
+
patches.push({
|
|
1562
|
+
type: NavigateParent
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
patches.push({
|
|
1566
|
+
type: RemoveChild,
|
|
1567
|
+
index: siblingOffset
|
|
1568
|
+
});
|
|
1569
|
+
i += getTotalChildCount(oldNodes, i);
|
|
1570
|
+
indexStack.pop();
|
|
1571
|
+
indexStack.pop();
|
|
1572
|
+
}
|
|
1573
|
+
while (j < newNodes.length) {
|
|
1574
|
+
if (siblingOffset > 0) {
|
|
1575
|
+
patches.push({
|
|
1576
|
+
type: NavigateSibling,
|
|
1577
|
+
index: siblingOffset
|
|
1578
|
+
});
|
|
1579
|
+
siblingOffset = 0;
|
|
1580
|
+
}
|
|
1581
|
+
const count = getTotalChildCount(newNodes, j);
|
|
1582
|
+
patches.push({
|
|
1583
|
+
type: Add,
|
|
1584
|
+
nodes: newNodes.slice(j, j + count)
|
|
1585
|
+
});
|
|
1586
|
+
j += count;
|
|
1587
|
+
}
|
|
1588
|
+
return patches;
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
const User = 1;
|
|
1592
|
+
const Script = 2;
|
|
1593
|
+
|
|
1594
|
+
const clearSearchResults$1 = state => {
|
|
1595
|
+
return {
|
|
1596
|
+
...state,
|
|
1597
|
+
value: '',
|
|
1598
|
+
items: [],
|
|
1599
|
+
minLineY: 0,
|
|
1600
|
+
maxLineY: 0,
|
|
1601
|
+
message: '',
|
|
1602
|
+
focus: FocusSearchInput,
|
|
1603
|
+
focusSource: Script,
|
|
1604
|
+
inputSource: Script
|
|
1605
|
+
};
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
const File = 1;
|
|
1609
|
+
const Match = 2;
|
|
1610
|
+
|
|
1611
|
+
const getPaths = items => {
|
|
1612
|
+
const paths = [];
|
|
1613
|
+
for (const item of items) {
|
|
1614
|
+
if (item.type === File) {
|
|
1615
|
+
paths.push(item.text);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
return paths;
|
|
1619
|
+
};
|
|
1620
|
+
const collapseAll$1 = async state => {
|
|
1621
|
+
const {
|
|
1622
|
+
items
|
|
1623
|
+
} = state;
|
|
1624
|
+
if (items.length === 0) {
|
|
1625
|
+
return state;
|
|
1626
|
+
}
|
|
1627
|
+
const paths = getPaths(items);
|
|
1628
|
+
return {
|
|
1629
|
+
...state,
|
|
1630
|
+
collapsedPaths: paths
|
|
1631
|
+
};
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
const PreserveCase$2 = 1 << 0; // 1
|
|
1635
|
+
const UseRegularExpression$2 = 1 << 1; // 2
|
|
1636
|
+
const ReplaceExpanded = 1 << 2; // 4
|
|
1637
|
+
const MatchWholeWord$2 = 1 << 3; // 8
|
|
1638
|
+
const MatchCase$2 = 1 << 4; // 16
|
|
1639
|
+
const DetailsExpanded = 1 << 5; // 32
|
|
1640
|
+
const OpenEditors = 1 << 6; // 64
|
|
1641
|
+
const UseIgnoreFiles = 1 << 7; // 128
|
|
1642
|
+
const hasDetailsExpanded = flags => {
|
|
1643
|
+
return (flags & DetailsExpanded) === DetailsExpanded;
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
const collapseDetails = state => {
|
|
1647
|
+
const {
|
|
1648
|
+
flags
|
|
1649
|
+
} = state;
|
|
1650
|
+
return {
|
|
1651
|
+
...state,
|
|
1652
|
+
flags: flags & -33,
|
|
1653
|
+
focus: FocusSearchInput,
|
|
1654
|
+
focusSource: Script
|
|
1655
|
+
};
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1425
1658
|
const rpcs = Object.create(null);
|
|
1426
1659
|
const set$3 = (id, rpc) => {
|
|
1427
1660
|
rpcs[id] = rpc;
|
|
@@ -1877,7 +2110,8 @@ const {
|
|
|
1877
2110
|
set,
|
|
1878
2111
|
wrapCommand,
|
|
1879
2112
|
registerCommands,
|
|
1880
|
-
getCommandIds
|
|
2113
|
+
getCommandIds,
|
|
2114
|
+
wrapGetter
|
|
1881
2115
|
} = create$3();
|
|
1882
2116
|
|
|
1883
2117
|
const List = 1;
|
|
@@ -1932,7 +2166,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
1932
2166
|
workspacePath: workspacePath,
|
|
1933
2167
|
includeValue: '',
|
|
1934
2168
|
excludeValue: '',
|
|
1935
|
-
focus: Empty
|
|
2169
|
+
focus: Empty,
|
|
1936
2170
|
loaded: false,
|
|
1937
2171
|
message: '',
|
|
1938
2172
|
collapsedPaths: [],
|
|
@@ -1991,7 +2225,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
1991
2225
|
|
|
1992
2226
|
const diffType$2 = RenderItems;
|
|
1993
2227
|
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;
|
|
2228
|
+
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
2229
|
};
|
|
1996
2230
|
|
|
1997
2231
|
const diffType$1 = RenderReplaceValue;
|
|
@@ -2007,7 +2241,7 @@ const isEqual = (oldState, newState) => {
|
|
|
2007
2241
|
const modules = [isEqual$2, isEqual$5, isEqual$3, isEqual$6, isEqual$1, isEqual, isEqual$4];
|
|
2008
2242
|
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType, RenderFocusContext];
|
|
2009
2243
|
|
|
2010
|
-
const diff
|
|
2244
|
+
const diff = (oldState, newState) => {
|
|
2011
2245
|
const diffResult = [];
|
|
2012
2246
|
for (let i = 0; i < modules.length; i++) {
|
|
2013
2247
|
const fn = modules[i];
|
|
@@ -2023,7 +2257,7 @@ const diff2 = uid => {
|
|
|
2023
2257
|
oldState,
|
|
2024
2258
|
newState
|
|
2025
2259
|
} = get$1(uid);
|
|
2026
|
-
const diffResult = diff
|
|
2260
|
+
const diffResult = diff(oldState, newState);
|
|
2027
2261
|
return diffResult;
|
|
2028
2262
|
};
|
|
2029
2263
|
|
|
@@ -2234,7 +2468,7 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2234
2468
|
const getSetSize = (items, index) => {
|
|
2235
2469
|
let setSize = 0;
|
|
2236
2470
|
for (let i = index + 1; i < items.length; i++) {
|
|
2237
|
-
if (items[i].type === File
|
|
2471
|
+
if (items[i].type === File) {
|
|
2238
2472
|
break;
|
|
2239
2473
|
}
|
|
2240
2474
|
setSize++;
|
|
@@ -2253,7 +2487,7 @@ const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
|
2253
2487
|
};
|
|
2254
2488
|
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
2255
2489
|
for (let i = index; i >= 0; i--) {
|
|
2256
|
-
if (items[i].type === File
|
|
2490
|
+
if (items[i].type === File) {
|
|
2257
2491
|
const setSize = getSetSize(items, i);
|
|
2258
2492
|
if (setSize === 1) {
|
|
2259
2493
|
return {
|
|
@@ -2278,7 +2512,7 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
|
2278
2512
|
const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
2279
2513
|
const item = items[index];
|
|
2280
2514
|
switch (item.type) {
|
|
2281
|
-
case File
|
|
2515
|
+
case File:
|
|
2282
2516
|
return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
|
|
2283
2517
|
case Match:
|
|
2284
2518
|
return getRemoveIndicesMatch(items, index, matchCount, fileCount);
|
|
@@ -2414,8 +2648,6 @@ const getNextFocus = (focus, flags) => {
|
|
|
2414
2648
|
return FocusSearchResults;
|
|
2415
2649
|
case FocusIgnoreFiles:
|
|
2416
2650
|
return FocusSearchResults;
|
|
2417
|
-
case FocusUseExcludeSettings:
|
|
2418
|
-
return FocusSearchResults;
|
|
2419
2651
|
default:
|
|
2420
2652
|
return focus;
|
|
2421
2653
|
}
|
|
@@ -2626,10 +2858,10 @@ const getFileName$1 = text => {
|
|
|
2626
2858
|
const getFileIcons = async matches => {
|
|
2627
2859
|
const requests = [];
|
|
2628
2860
|
for (const item of matches) {
|
|
2629
|
-
if (item.type === File
|
|
2861
|
+
if (item.type === File) {
|
|
2630
2862
|
const fileName = getFileName$1(item.text);
|
|
2631
2863
|
requests.push({
|
|
2632
|
-
type: File,
|
|
2864
|
+
type: File$1,
|
|
2633
2865
|
name: fileName,
|
|
2634
2866
|
path: `/${fileName}`
|
|
2635
2867
|
});
|
|
@@ -2661,7 +2893,7 @@ const getTextSearchResultCounts = results => {
|
|
|
2661
2893
|
let fileCount = 0;
|
|
2662
2894
|
for (const result of results) {
|
|
2663
2895
|
switch (result.type) {
|
|
2664
|
-
case File
|
|
2896
|
+
case File:
|
|
2665
2897
|
fileCount++;
|
|
2666
2898
|
break;
|
|
2667
2899
|
case Match:
|
|
@@ -3048,7 +3280,7 @@ const getReplaceElements = (items, workspacePath, replacement) => {
|
|
|
3048
3280
|
end,
|
|
3049
3281
|
start
|
|
3050
3282
|
} = match;
|
|
3051
|
-
if (type === File
|
|
3283
|
+
if (type === File) {
|
|
3052
3284
|
changes = [];
|
|
3053
3285
|
const fileName = getFileName(text);
|
|
3054
3286
|
const absolutePath = `${workspacePath}/${fileName}`;
|
|
@@ -3248,7 +3480,9 @@ const handleInputBlur = async (state, name) => {
|
|
|
3248
3480
|
const handleInputFocus = state => {
|
|
3249
3481
|
return {
|
|
3250
3482
|
...state,
|
|
3251
|
-
listFocused: false
|
|
3483
|
+
listFocused: false,
|
|
3484
|
+
focus: FocusSearchInput,
|
|
3485
|
+
focused: true
|
|
3252
3486
|
};
|
|
3253
3487
|
};
|
|
3254
3488
|
|
|
@@ -3259,6 +3493,19 @@ const handleListBlur = state => {
|
|
|
3259
3493
|
};
|
|
3260
3494
|
};
|
|
3261
3495
|
|
|
3496
|
+
const handleListFocus = async state => {
|
|
3497
|
+
const {
|
|
3498
|
+
listFocused
|
|
3499
|
+
} = state;
|
|
3500
|
+
if (listFocused) {
|
|
3501
|
+
return state;
|
|
3502
|
+
}
|
|
3503
|
+
return {
|
|
3504
|
+
...state,
|
|
3505
|
+
listFocused: true
|
|
3506
|
+
};
|
|
3507
|
+
};
|
|
3508
|
+
|
|
3262
3509
|
const handleSharedInput = (state, name, value, inputSource = Script) => {
|
|
3263
3510
|
const fn = getInputHandler(name);
|
|
3264
3511
|
return fn(state, value, inputSource);
|
|
@@ -3615,7 +3862,7 @@ const getFilteredResults = (results, collapsedPaths) => {
|
|
|
3615
3862
|
const filteredResults = [];
|
|
3616
3863
|
let isExcluded = false;
|
|
3617
3864
|
for (const result of results) {
|
|
3618
|
-
if (result.type === File
|
|
3865
|
+
if (result.type === File) {
|
|
3619
3866
|
filteredResults.push(result);
|
|
3620
3867
|
isExcluded = collapsedPaths.includes(result.text) ? true : false;
|
|
3621
3868
|
}
|
|
@@ -3666,7 +3913,7 @@ const selectIndexFile = async (state, searchResult, index) => {
|
|
|
3666
3913
|
const getFileIndex = (items, index) => {
|
|
3667
3914
|
for (let i = index; i >= 0; i--) {
|
|
3668
3915
|
const item = items[i];
|
|
3669
|
-
if (item.type === File
|
|
3916
|
+
if (item.type === File) {
|
|
3670
3917
|
return i;
|
|
3671
3918
|
}
|
|
3672
3919
|
}
|
|
@@ -3717,7 +3964,7 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
3717
3964
|
|
|
3718
3965
|
const getSelectHandler = type => {
|
|
3719
3966
|
switch (type) {
|
|
3720
|
-
case File
|
|
3967
|
+
case File:
|
|
3721
3968
|
return selectIndexFile;
|
|
3722
3969
|
case Match:
|
|
3723
3970
|
return selectIndexPreview;
|
|
@@ -3756,6 +4003,29 @@ const handleClickAt = async (state, eventX, eventY) => {
|
|
|
3756
4003
|
return selectIndex(state, index);
|
|
3757
4004
|
};
|
|
3758
4005
|
|
|
4006
|
+
const handleListPointerDown = async (state, button) => {
|
|
4007
|
+
if (button !== LeftClick) {
|
|
4008
|
+
return state;
|
|
4009
|
+
}
|
|
4010
|
+
return {
|
|
4011
|
+
...state,
|
|
4012
|
+
listFocused: true
|
|
4013
|
+
};
|
|
4014
|
+
};
|
|
4015
|
+
|
|
4016
|
+
const getSavedFocus = savedState => {
|
|
4017
|
+
if (savedState && typeof savedState === 'object' && 'focus' in savedState && typeof savedState.focus === 'number') {
|
|
4018
|
+
return savedState.focus;
|
|
4019
|
+
}
|
|
4020
|
+
return 0;
|
|
4021
|
+
};
|
|
4022
|
+
const getSavedListFocus = savedState => {
|
|
4023
|
+
if (savedState && typeof savedState === 'object' && 'listFocused' in savedState && typeof savedState.listFocused === 'boolean') {
|
|
4024
|
+
return savedState.listFocused;
|
|
4025
|
+
}
|
|
4026
|
+
return false;
|
|
4027
|
+
};
|
|
4028
|
+
|
|
3759
4029
|
const isString = value => {
|
|
3760
4030
|
return typeof value === 'string';
|
|
3761
4031
|
};
|
|
@@ -3812,7 +4082,9 @@ const restoreState = savedState => {
|
|
|
3812
4082
|
flags: getSavedFlags(savedState),
|
|
3813
4083
|
includeValue: getSavedIncludeValue(savedState),
|
|
3814
4084
|
excludeValue: getSavedExcludeValue(savedState),
|
|
3815
|
-
history: getSavedHistory(savedState)
|
|
4085
|
+
history: getSavedHistory(savedState),
|
|
4086
|
+
focus: getSavedFocus(savedState),
|
|
4087
|
+
listFocused: getSavedListFocus(savedState)
|
|
3816
4088
|
};
|
|
3817
4089
|
};
|
|
3818
4090
|
|
|
@@ -3826,17 +4098,19 @@ const loadContent = async (state, savedState) => {
|
|
|
3826
4098
|
includeValue,
|
|
3827
4099
|
excludeValue
|
|
3828
4100
|
} = restoreState(savedState);
|
|
4101
|
+
const update = {
|
|
4102
|
+
value: savedValue,
|
|
4103
|
+
threads,
|
|
4104
|
+
inputSource: Script,
|
|
4105
|
+
collapsedPaths: savedCollapsedPaths,
|
|
4106
|
+
replacement,
|
|
4107
|
+
flags,
|
|
4108
|
+
includeValue,
|
|
4109
|
+
excludeValue,
|
|
4110
|
+
focus: 0 // TODO
|
|
4111
|
+
};
|
|
3829
4112
|
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
|
-
});
|
|
4113
|
+
const result = await handleUpdate(state, update);
|
|
3840
4114
|
return {
|
|
3841
4115
|
...result,
|
|
3842
4116
|
loaded: true
|
|
@@ -3844,6 +4118,7 @@ const loadContent = async (state, savedState) => {
|
|
|
3844
4118
|
}
|
|
3845
4119
|
return {
|
|
3846
4120
|
...state,
|
|
4121
|
+
...update,
|
|
3847
4122
|
threads,
|
|
3848
4123
|
flags,
|
|
3849
4124
|
loaded: true
|
|
@@ -3931,11 +4206,11 @@ const getFocusSelector = focusKey => {
|
|
|
3931
4206
|
|
|
3932
4207
|
const renderFocus = (oldState, newState) => {
|
|
3933
4208
|
const selector = getFocusSelector(newState.focus);
|
|
3934
|
-
return [
|
|
4209
|
+
return [FocusElementByName, newState.uid, selector];
|
|
3935
4210
|
};
|
|
3936
4211
|
|
|
3937
4212
|
const renderFocusContext = (oldState, newState) => {
|
|
3938
|
-
return [
|
|
4213
|
+
return [SetFocusContext, newState.uid, newState.focus];
|
|
3939
4214
|
};
|
|
3940
4215
|
|
|
3941
4216
|
const None = 0;
|
|
@@ -3945,7 +4220,7 @@ const Expanded = 2;
|
|
|
3945
4220
|
const getMatchCount = (results, startIndex) => {
|
|
3946
4221
|
for (let i = startIndex + 1; i < results.length; i++) {
|
|
3947
4222
|
const result = results[i];
|
|
3948
|
-
if (result.type === File
|
|
4223
|
+
if (result.type === File) {
|
|
3949
4224
|
return i - startIndex - 1;
|
|
3950
4225
|
}
|
|
3951
4226
|
}
|
|
@@ -4004,7 +4279,7 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
|
|
|
4004
4279
|
const focused = i === focusedIndex;
|
|
4005
4280
|
const relativeIndex = i - minLineY;
|
|
4006
4281
|
switch (type) {
|
|
4007
|
-
case File
|
|
4282
|
+
case File:
|
|
4008
4283
|
return getSearchDisplayResultFile(results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults);
|
|
4009
4284
|
case Match:
|
|
4010
4285
|
return getDisplayResultMatch(setSize, searchTermLength, replacement, text, posInSet, start, focused);
|
|
@@ -4074,233 +4349,6 @@ const createViewModel = state => {
|
|
|
4074
4349
|
};
|
|
4075
4350
|
};
|
|
4076
4351
|
|
|
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
4352
|
const HandleClick = 1;
|
|
4305
4353
|
const HandleContextMenu = 2;
|
|
4306
4354
|
const HandleHeaderContextMenu = 3;
|
|
@@ -4318,6 +4366,7 @@ const HandleToggleButtonClick = 15;
|
|
|
4318
4366
|
const HandleWheel = 16;
|
|
4319
4367
|
const HandleInputFocus = 17;
|
|
4320
4368
|
const HandleInputBlur = 18;
|
|
4369
|
+
const HandleListPointerDown = 19;
|
|
4321
4370
|
|
|
4322
4371
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4323
4372
|
return [{
|
|
@@ -4348,7 +4397,6 @@ const getSearchMessageVirtualDom = (message, indented) => {
|
|
|
4348
4397
|
type: Div,
|
|
4349
4398
|
className: getClassName(indented),
|
|
4350
4399
|
role: Status,
|
|
4351
|
-
tabIndex: 0,
|
|
4352
4400
|
childCount: 1
|
|
4353
4401
|
}, text(message)];
|
|
4354
4402
|
};
|
|
@@ -4897,7 +4945,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
|
4897
4945
|
onWheel: HandleWheel,
|
|
4898
4946
|
onContextMenu: HandleContextMenu,
|
|
4899
4947
|
id: TreeItems,
|
|
4900
|
-
top: `${-pixelOffset}px`
|
|
4948
|
+
top: `${-pixelOffset}px` // TODO use dynamic css instead
|
|
4901
4949
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
4902
4950
|
};
|
|
4903
4951
|
|
|
@@ -4905,10 +4953,13 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
|
|
|
4905
4953
|
const childCount = scrollbarHeight === 0 ? 1 : 2;
|
|
4906
4954
|
return [{
|
|
4907
4955
|
type: Div,
|
|
4908
|
-
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty),
|
|
4956
|
+
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty$1),
|
|
4909
4957
|
role: Tree$1,
|
|
4910
4958
|
tabIndex: 0,
|
|
4911
|
-
childCount
|
|
4959
|
+
childCount,
|
|
4960
|
+
onBlur: HandleListBlur,
|
|
4961
|
+
onPointerDown: HandleListPointerDown,
|
|
4962
|
+
onFocus: HandleListFocus
|
|
4912
4963
|
}, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
|
|
4913
4964
|
};
|
|
4914
4965
|
|
|
@@ -4925,20 +4976,20 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
4925
4976
|
const renderItems = (oldState, newState) => {
|
|
4926
4977
|
const viewModel = createViewModel(newState);
|
|
4927
4978
|
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 [
|
|
4979
|
+
return [SetDom2, newState.uid, dom];
|
|
4929
4980
|
};
|
|
4930
4981
|
|
|
4931
4982
|
const renderValue = (oldState, newState) => {
|
|
4932
|
-
return [
|
|
4983
|
+
return [SetValueByName, SearchValue, newState.value];
|
|
4933
4984
|
};
|
|
4934
4985
|
const renderReplacement = (oldState, newState) => {
|
|
4935
|
-
return [
|
|
4986
|
+
return [SetValueByName, ReplaceValue, newState.replacement];
|
|
4936
4987
|
};
|
|
4937
4988
|
const renderIncludeValue = (oldState, newState) => {
|
|
4938
|
-
return [
|
|
4989
|
+
return [SetValueByName, FilesToInclude, newState.includeValue];
|
|
4939
4990
|
};
|
|
4940
4991
|
const renderExcludeValue = (oldState, newState) => {
|
|
4941
|
-
return [
|
|
4992
|
+
return [SetValueByName, FilesToExclude, newState.excludeValue];
|
|
4942
4993
|
};
|
|
4943
4994
|
|
|
4944
4995
|
const getRenderer = diffType => {
|
|
@@ -5082,6 +5133,9 @@ const renderEventListeners = () => {
|
|
|
5082
5133
|
}, {
|
|
5083
5134
|
name: HandleClick,
|
|
5084
5135
|
params: ['handleClickAt', ClientX, ClientY]
|
|
5136
|
+
}, {
|
|
5137
|
+
name: HandleListPointerDown,
|
|
5138
|
+
params: ['handleListPointerDown', Button$1]
|
|
5085
5139
|
}, {
|
|
5086
5140
|
name: HandleToggleButtonClick,
|
|
5087
5141
|
params: ['handleToggleButtonClick']
|
|
@@ -5141,7 +5195,7 @@ const renderIncremental = uid => {
|
|
|
5141
5195
|
} = get$1(uid);
|
|
5142
5196
|
const oldDom = getDom(oldState);
|
|
5143
5197
|
const newDom = getDom(newState);
|
|
5144
|
-
const patches = diff(oldDom, newDom);
|
|
5198
|
+
const patches = diff$1(oldDom, newDom);
|
|
5145
5199
|
return patches;
|
|
5146
5200
|
};
|
|
5147
5201
|
|
|
@@ -5195,10 +5249,7 @@ const rerender = state => {
|
|
|
5195
5249
|
};
|
|
5196
5250
|
};
|
|
5197
5251
|
|
|
5198
|
-
const saveState =
|
|
5199
|
-
const {
|
|
5200
|
-
newState
|
|
5201
|
-
} = get$1(uid);
|
|
5252
|
+
const saveState = state => {
|
|
5202
5253
|
const {
|
|
5203
5254
|
value,
|
|
5204
5255
|
replacement,
|
|
@@ -5206,8 +5257,10 @@ const saveState = uid => {
|
|
|
5206
5257
|
includeValue,
|
|
5207
5258
|
excludeValue,
|
|
5208
5259
|
history,
|
|
5209
|
-
collapsedPaths
|
|
5210
|
-
|
|
5260
|
+
collapsedPaths,
|
|
5261
|
+
focus,
|
|
5262
|
+
listFocused
|
|
5263
|
+
} = state;
|
|
5211
5264
|
return {
|
|
5212
5265
|
value,
|
|
5213
5266
|
replacement,
|
|
@@ -5215,7 +5268,9 @@ const saveState = uid => {
|
|
|
5215
5268
|
includeValue,
|
|
5216
5269
|
excludeValue,
|
|
5217
5270
|
history,
|
|
5218
|
-
collapsedPaths
|
|
5271
|
+
collapsedPaths,
|
|
5272
|
+
focus,
|
|
5273
|
+
listFocused
|
|
5219
5274
|
};
|
|
5220
5275
|
};
|
|
5221
5276
|
|
|
@@ -5256,7 +5311,7 @@ const getSearchFocusKey = key => {
|
|
|
5256
5311
|
case ToggleReplace:
|
|
5257
5312
|
return FocusToggleReplace;
|
|
5258
5313
|
default:
|
|
5259
|
-
return Empty
|
|
5314
|
+
return Empty;
|
|
5260
5315
|
}
|
|
5261
5316
|
};
|
|
5262
5317
|
|
|
@@ -5385,7 +5440,6 @@ const commandMap = {
|
|
|
5385
5440
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5386
5441
|
'TextSearch.copy': wrapCommand(copy),
|
|
5387
5442
|
'TextSearch.copyPath': wrapCommand(copyPath),
|
|
5388
|
-
'TextSearch.handleInputBlur': wrapCommand(handleInputBlur),
|
|
5389
5443
|
'TextSearch.diff2': diff2,
|
|
5390
5444
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
5391
5445
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
@@ -5412,7 +5466,6 @@ const commandMap = {
|
|
|
5412
5466
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
5413
5467
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
5414
5468
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
5415
|
-
'TextSearch.handleInputFocus': wrapCommand(handleInputFocus),
|
|
5416
5469
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
5417
5470
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
5418
5471
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
@@ -5424,7 +5477,11 @@ const commandMap = {
|
|
|
5424
5477
|
'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
|
|
5425
5478
|
'TextSearch.handleInput': wrapCommand(handleInput),
|
|
5426
5479
|
'TextSearch.handleInput2': wrapCommand(handleInput2),
|
|
5480
|
+
'TextSearch.handleInputBlur': wrapCommand(handleInputBlur),
|
|
5481
|
+
'TextSearch.handleInputFocus': wrapCommand(handleInputFocus),
|
|
5427
5482
|
'TextSearch.handleListBlur': wrapCommand(handleListBlur),
|
|
5483
|
+
'TextSearch.handleListFocus': wrapCommand(handleListFocus),
|
|
5484
|
+
'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
|
|
5428
5485
|
'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
|
|
5429
5486
|
'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
5430
5487
|
'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
@@ -5458,7 +5515,7 @@ const commandMap = {
|
|
|
5458
5515
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5459
5516
|
'TextSearch.renderIncremental': renderIncremental,
|
|
5460
5517
|
'TextSearch.restoreState': restoreState,
|
|
5461
|
-
'TextSearch.saveState': saveState,
|
|
5518
|
+
'TextSearch.saveState': wrapGetter(saveState),
|
|
5462
5519
|
'TextSearch.terminate': terminate,
|
|
5463
5520
|
'TextSearch.renderActions': renderActions,
|
|
5464
5521
|
// TODO needed?
|