@lvce-editor/text-search-worker 5.10.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 +449 -379
- package/package.json +1 -1
|
@@ -1240,90 +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 FocusSearchWholeWord = 34;
|
|
1260
|
-
const FocusToggleDetails = 1010;
|
|
1261
|
-
const FocusToggleReplace = 1020;
|
|
1262
|
-
|
|
1263
|
-
const clearSearchResults$1 = state => {
|
|
1264
|
-
return {
|
|
1265
|
-
...state,
|
|
1266
|
-
value: '',
|
|
1267
|
-
items: [],
|
|
1268
|
-
minLineY: 0,
|
|
1269
|
-
maxLineY: 0,
|
|
1270
|
-
message: '',
|
|
1271
|
-
focus: FocusSearchInput,
|
|
1272
|
-
focusSource: Script,
|
|
1273
|
-
inputSource: Script
|
|
1274
|
-
};
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
const File$1 = 1;
|
|
1278
|
-
const Match = 2;
|
|
1279
|
-
|
|
1280
|
-
const getPaths = items => {
|
|
1281
|
-
const paths = [];
|
|
1282
|
-
for (const item of items) {
|
|
1283
|
-
if (item.type === File$1) {
|
|
1284
|
-
paths.push(item.text);
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
return paths;
|
|
1288
|
-
};
|
|
1289
|
-
const collapseAll$1 = async state => {
|
|
1290
|
-
const {
|
|
1291
|
-
items
|
|
1292
|
-
} = state;
|
|
1293
|
-
if (items.length === 0) {
|
|
1294
|
-
return state;
|
|
1295
|
-
}
|
|
1296
|
-
const paths = getPaths(items);
|
|
1297
|
-
return {
|
|
1298
|
-
...state,
|
|
1299
|
-
collapsedPaths: paths
|
|
1300
|
-
};
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
|
-
const PreserveCase$2 = 1 << 0; // 1
|
|
1304
|
-
const UseRegularExpression$2 = 1 << 1; // 2
|
|
1305
|
-
const ReplaceExpanded = 1 << 2; // 4
|
|
1306
|
-
const MatchWholeWord$2 = 1 << 3; // 8
|
|
1307
|
-
const MatchCase$2 = 1 << 4; // 16
|
|
1308
|
-
const DetailsExpanded = 1 << 5; // 32
|
|
1309
|
-
const OpenEditors = 1 << 6; // 64
|
|
1310
|
-
const UseIgnoreFiles = 1 << 7; // 128
|
|
1311
|
-
const hasDetailsExpanded = flags => {
|
|
1312
|
-
return (flags & DetailsExpanded) === DetailsExpanded;
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
|
-
const collapseDetails = state => {
|
|
1316
|
-
const {
|
|
1317
|
-
flags
|
|
1318
|
-
} = state;
|
|
1319
|
-
return {
|
|
1320
|
-
...state,
|
|
1321
|
-
flags: flags & -33,
|
|
1322
|
-
focus: FocusSearchInput,
|
|
1323
|
-
focusSource: Script
|
|
1324
|
-
};
|
|
1325
|
-
};
|
|
1326
|
-
|
|
1327
1243
|
const Alert = 'alert';
|
|
1328
1244
|
const Button$3 = 'button';
|
|
1329
1245
|
const CheckBox = 'checkbox';
|
|
@@ -1338,7 +1254,7 @@ const Actions = 'Actions';
|
|
|
1338
1254
|
const Badge = 'Badge';
|
|
1339
1255
|
const Chevron = 'Chevron';
|
|
1340
1256
|
const CloseMaskIcon = 'MaskIcon MaskIconClose';
|
|
1341
|
-
const Empty = '';
|
|
1257
|
+
const Empty$1 = '';
|
|
1342
1258
|
const FileIcon = 'FileIcon';
|
|
1343
1259
|
const FocusOutline = 'FocusOutline';
|
|
1344
1260
|
const Grow = 'Grow';
|
|
@@ -1392,7 +1308,7 @@ const Viewlet = 'Viewlet';
|
|
|
1392
1308
|
const ViewletSearchMessage = 'ViewletSearchMessage';
|
|
1393
1309
|
const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
|
|
1394
1310
|
|
|
1395
|
-
const File = 7;
|
|
1311
|
+
const File$1 = 7;
|
|
1396
1312
|
|
|
1397
1313
|
const Button$2 = 1;
|
|
1398
1314
|
const Div = 4;
|
|
@@ -1421,6 +1337,322 @@ const DebugWorker = 55;
|
|
|
1421
1337
|
const RendererWorker$1 = 1;
|
|
1422
1338
|
const SearchProcess = 77;
|
|
1423
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
|
+
|
|
1424
1656
|
const rpcs = Object.create(null);
|
|
1425
1657
|
const set$3 = (id, rpc) => {
|
|
1426
1658
|
rpcs[id] = rpc;
|
|
@@ -1876,7 +2108,8 @@ const {
|
|
|
1876
2108
|
set,
|
|
1877
2109
|
wrapCommand,
|
|
1878
2110
|
registerCommands,
|
|
1879
|
-
getCommandIds
|
|
2111
|
+
getCommandIds,
|
|
2112
|
+
wrapGetter
|
|
1880
2113
|
} = create$3();
|
|
1881
2114
|
|
|
1882
2115
|
const List = 1;
|
|
@@ -1931,7 +2164,7 @@ const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, v
|
|
|
1931
2164
|
workspacePath: workspacePath,
|
|
1932
2165
|
includeValue: '',
|
|
1933
2166
|
excludeValue: '',
|
|
1934
|
-
focus: Empty
|
|
2167
|
+
focus: Empty,
|
|
1935
2168
|
loaded: false,
|
|
1936
2169
|
message: '',
|
|
1937
2170
|
collapsedPaths: [],
|
|
@@ -1990,7 +2223,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
1990
2223
|
|
|
1991
2224
|
const diffType$2 = RenderItems;
|
|
1992
2225
|
const isEqual$2 = (oldState, newState) => {
|
|
1993
|
-
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;
|
|
1994
2227
|
};
|
|
1995
2228
|
|
|
1996
2229
|
const diffType$1 = RenderReplaceValue;
|
|
@@ -2006,7 +2239,7 @@ const isEqual = (oldState, newState) => {
|
|
|
2006
2239
|
const modules = [isEqual$2, isEqual$5, isEqual$3, isEqual$6, isEqual$1, isEqual, isEqual$4];
|
|
2007
2240
|
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType, RenderFocusContext];
|
|
2008
2241
|
|
|
2009
|
-
const diff
|
|
2242
|
+
const diff = (oldState, newState) => {
|
|
2010
2243
|
const diffResult = [];
|
|
2011
2244
|
for (let i = 0; i < modules.length; i++) {
|
|
2012
2245
|
const fn = modules[i];
|
|
@@ -2022,7 +2255,7 @@ const diff2 = uid => {
|
|
|
2022
2255
|
oldState,
|
|
2023
2256
|
newState
|
|
2024
2257
|
} = get$1(uid);
|
|
2025
|
-
const diffResult = diff
|
|
2258
|
+
const diffResult = diff(oldState, newState);
|
|
2026
2259
|
return diffResult;
|
|
2027
2260
|
};
|
|
2028
2261
|
|
|
@@ -2233,7 +2466,7 @@ const getStatusMessage = (resultCount, fileResultCount) => {
|
|
|
2233
2466
|
const getSetSize = (items, index) => {
|
|
2234
2467
|
let setSize = 0;
|
|
2235
2468
|
for (let i = index + 1; i < items.length; i++) {
|
|
2236
|
-
if (items[i].type === File
|
|
2469
|
+
if (items[i].type === File) {
|
|
2237
2470
|
break;
|
|
2238
2471
|
}
|
|
2239
2472
|
setSize++;
|
|
@@ -2252,7 +2485,7 @@ const getRemoveIndicesFile = (items, item, index, matchCount, fileCount) => {
|
|
|
2252
2485
|
};
|
|
2253
2486
|
const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
2254
2487
|
for (let i = index; i >= 0; i--) {
|
|
2255
|
-
if (items[i].type === File
|
|
2488
|
+
if (items[i].type === File) {
|
|
2256
2489
|
const setSize = getSetSize(items, i);
|
|
2257
2490
|
if (setSize === 1) {
|
|
2258
2491
|
return {
|
|
@@ -2277,7 +2510,7 @@ const getRemoveIndicesMatch = (items, index, matchCount, fileCount) => {
|
|
|
2277
2510
|
const getRemoveIndices = (items, index, matchCount, fileCount) => {
|
|
2278
2511
|
const item = items[index];
|
|
2279
2512
|
switch (item.type) {
|
|
2280
|
-
case File
|
|
2513
|
+
case File:
|
|
2281
2514
|
return getRemoveIndicesFile(items, item, index, matchCount, fileCount);
|
|
2282
2515
|
case Match:
|
|
2283
2516
|
return getRemoveIndicesMatch(items, index, matchCount, fileCount);
|
|
@@ -2407,7 +2640,12 @@ const getNextFocus = (focus, flags) => {
|
|
|
2407
2640
|
case FocusSearchExcludeInput:
|
|
2408
2641
|
return FocusIgnoreFiles;
|
|
2409
2642
|
case FocusToggleDetails:
|
|
2410
|
-
|
|
2643
|
+
if (flags & DetailsExpanded) {
|
|
2644
|
+
return FocusSearchIncludeInput;
|
|
2645
|
+
}
|
|
2646
|
+
return FocusSearchResults;
|
|
2647
|
+
case FocusIgnoreFiles:
|
|
2648
|
+
return FocusSearchResults;
|
|
2411
2649
|
default:
|
|
2412
2650
|
return focus;
|
|
2413
2651
|
}
|
|
@@ -2415,10 +2653,12 @@ const getNextFocus = (focus, flags) => {
|
|
|
2415
2653
|
|
|
2416
2654
|
const focusNextInput = state => {
|
|
2417
2655
|
const nextFocus = getNextFocus(state.focus, state.flags);
|
|
2656
|
+
const isListFocus = nextFocus === FocusSearchResults;
|
|
2418
2657
|
return {
|
|
2419
2658
|
...state,
|
|
2420
2659
|
focus: nextFocus,
|
|
2421
|
-
focusSource: Script
|
|
2660
|
+
focusSource: Script,
|
|
2661
|
+
listFocused: isListFocus
|
|
2422
2662
|
};
|
|
2423
2663
|
};
|
|
2424
2664
|
|
|
@@ -2616,10 +2856,10 @@ const getFileName$1 = text => {
|
|
|
2616
2856
|
const getFileIcons = async matches => {
|
|
2617
2857
|
const requests = [];
|
|
2618
2858
|
for (const item of matches) {
|
|
2619
|
-
if (item.type === File
|
|
2859
|
+
if (item.type === File) {
|
|
2620
2860
|
const fileName = getFileName$1(item.text);
|
|
2621
2861
|
requests.push({
|
|
2622
|
-
type: File,
|
|
2862
|
+
type: File$1,
|
|
2623
2863
|
name: fileName,
|
|
2624
2864
|
path: `/${fileName}`
|
|
2625
2865
|
});
|
|
@@ -2651,7 +2891,7 @@ const getTextSearchResultCounts = results => {
|
|
|
2651
2891
|
let fileCount = 0;
|
|
2652
2892
|
for (const result of results) {
|
|
2653
2893
|
switch (result.type) {
|
|
2654
|
-
case File
|
|
2894
|
+
case File:
|
|
2655
2895
|
fileCount++;
|
|
2656
2896
|
break;
|
|
2657
2897
|
case Match:
|
|
@@ -3038,7 +3278,7 @@ const getReplaceElements = (items, workspacePath, replacement) => {
|
|
|
3038
3278
|
end,
|
|
3039
3279
|
start
|
|
3040
3280
|
} = match;
|
|
3041
|
-
if (type === File
|
|
3281
|
+
if (type === File) {
|
|
3042
3282
|
changes = [];
|
|
3043
3283
|
const fileName = getFileName(text);
|
|
3044
3284
|
const absolutePath = `${workspacePath}/${fileName}`;
|
|
@@ -3231,6 +3471,19 @@ const handleInput2 = (state, inputName, value, inputSource = Script) => {
|
|
|
3231
3471
|
return fn(state, value, inputSource);
|
|
3232
3472
|
};
|
|
3233
3473
|
|
|
3474
|
+
const handleInputBlur = async (state, name) => {
|
|
3475
|
+
return state;
|
|
3476
|
+
};
|
|
3477
|
+
|
|
3478
|
+
const handleInputFocus = state => {
|
|
3479
|
+
return {
|
|
3480
|
+
...state,
|
|
3481
|
+
listFocused: false,
|
|
3482
|
+
focus: FocusSearchInput,
|
|
3483
|
+
focused: true
|
|
3484
|
+
};
|
|
3485
|
+
};
|
|
3486
|
+
|
|
3234
3487
|
const handleListBlur = state => {
|
|
3235
3488
|
return {
|
|
3236
3489
|
...state,
|
|
@@ -3594,7 +3847,7 @@ const getFilteredResults = (results, collapsedPaths) => {
|
|
|
3594
3847
|
const filteredResults = [];
|
|
3595
3848
|
let isExcluded = false;
|
|
3596
3849
|
for (const result of results) {
|
|
3597
|
-
if (result.type === File
|
|
3850
|
+
if (result.type === File) {
|
|
3598
3851
|
filteredResults.push(result);
|
|
3599
3852
|
isExcluded = collapsedPaths.includes(result.text) ? true : false;
|
|
3600
3853
|
}
|
|
@@ -3645,7 +3898,7 @@ const selectIndexFile = async (state, searchResult, index) => {
|
|
|
3645
3898
|
const getFileIndex = (items, index) => {
|
|
3646
3899
|
for (let i = index; i >= 0; i--) {
|
|
3647
3900
|
const item = items[i];
|
|
3648
|
-
if (item.type === File
|
|
3901
|
+
if (item.type === File) {
|
|
3649
3902
|
return i;
|
|
3650
3903
|
}
|
|
3651
3904
|
}
|
|
@@ -3696,7 +3949,7 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
3696
3949
|
|
|
3697
3950
|
const getSelectHandler = type => {
|
|
3698
3951
|
switch (type) {
|
|
3699
|
-
case File
|
|
3952
|
+
case File:
|
|
3700
3953
|
return selectIndexFile;
|
|
3701
3954
|
case Match:
|
|
3702
3955
|
return selectIndexPreview;
|
|
@@ -3735,6 +3988,27 @@ const handleClickAt = async (state, eventX, eventY) => {
|
|
|
3735
3988
|
return selectIndex(state, index);
|
|
3736
3989
|
};
|
|
3737
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
|
+
|
|
3738
4012
|
const isString = value => {
|
|
3739
4013
|
return typeof value === 'string';
|
|
3740
4014
|
};
|
|
@@ -3791,7 +4065,9 @@ const restoreState = savedState => {
|
|
|
3791
4065
|
flags: getSavedFlags(savedState),
|
|
3792
4066
|
includeValue: getSavedIncludeValue(savedState),
|
|
3793
4067
|
excludeValue: getSavedExcludeValue(savedState),
|
|
3794
|
-
history: getSavedHistory(savedState)
|
|
4068
|
+
history: getSavedHistory(savedState),
|
|
4069
|
+
focus: getSavedFocus(savedState),
|
|
4070
|
+
listFocused: getSavedListFocus(savedState)
|
|
3795
4071
|
};
|
|
3796
4072
|
};
|
|
3797
4073
|
|
|
@@ -3805,17 +4081,19 @@ const loadContent = async (state, savedState) => {
|
|
|
3805
4081
|
includeValue,
|
|
3806
4082
|
excludeValue
|
|
3807
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
|
+
};
|
|
3808
4095
|
if (savedValue) {
|
|
3809
|
-
const result = await handleUpdate(state,
|
|
3810
|
-
value: savedValue,
|
|
3811
|
-
threads,
|
|
3812
|
-
inputSource: Script,
|
|
3813
|
-
collapsedPaths: savedCollapsedPaths,
|
|
3814
|
-
replacement,
|
|
3815
|
-
flags,
|
|
3816
|
-
includeValue,
|
|
3817
|
-
excludeValue
|
|
3818
|
-
});
|
|
4096
|
+
const result = await handleUpdate(state, update);
|
|
3819
4097
|
return {
|
|
3820
4098
|
...result,
|
|
3821
4099
|
loaded: true
|
|
@@ -3823,6 +4101,7 @@ const loadContent = async (state, savedState) => {
|
|
|
3823
4101
|
}
|
|
3824
4102
|
return {
|
|
3825
4103
|
...state,
|
|
4104
|
+
...update,
|
|
3826
4105
|
threads,
|
|
3827
4106
|
flags,
|
|
3828
4107
|
loaded: true
|
|
@@ -3901,6 +4180,8 @@ const getFocusSelector = focusKey => {
|
|
|
3901
4180
|
return UseExcludeSettings;
|
|
3902
4181
|
case FocusToggleReplace:
|
|
3903
4182
|
return ToggleReplace;
|
|
4183
|
+
case FocusSearchResults:
|
|
4184
|
+
return '.Tree';
|
|
3904
4185
|
default:
|
|
3905
4186
|
return '';
|
|
3906
4187
|
}
|
|
@@ -3908,11 +4189,11 @@ const getFocusSelector = focusKey => {
|
|
|
3908
4189
|
|
|
3909
4190
|
const renderFocus = (oldState, newState) => {
|
|
3910
4191
|
const selector = getFocusSelector(newState.focus);
|
|
3911
|
-
return [
|
|
4192
|
+
return [FocusElementByName, newState.uid, selector];
|
|
3912
4193
|
};
|
|
3913
4194
|
|
|
3914
4195
|
const renderFocusContext = (oldState, newState) => {
|
|
3915
|
-
return [
|
|
4196
|
+
return [SetFocusContext, newState.uid, newState.focus];
|
|
3916
4197
|
};
|
|
3917
4198
|
|
|
3918
4199
|
const None = 0;
|
|
@@ -3922,7 +4203,7 @@ const Expanded = 2;
|
|
|
3922
4203
|
const getMatchCount = (results, startIndex) => {
|
|
3923
4204
|
for (let i = startIndex + 1; i < results.length; i++) {
|
|
3924
4205
|
const result = results[i];
|
|
3925
|
-
if (result.type === File
|
|
4206
|
+
if (result.type === File) {
|
|
3926
4207
|
return i - startIndex - 1;
|
|
3927
4208
|
}
|
|
3928
4209
|
}
|
|
@@ -3981,7 +4262,7 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
|
|
|
3981
4262
|
const focused = i === focusedIndex;
|
|
3982
4263
|
const relativeIndex = i - minLineY;
|
|
3983
4264
|
switch (type) {
|
|
3984
|
-
case File
|
|
4265
|
+
case File:
|
|
3985
4266
|
return getSearchDisplayResultFile(results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults);
|
|
3986
4267
|
case Match:
|
|
3987
4268
|
return getDisplayResultMatch(setSize, searchTermLength, replacement, text, posInSet, start, focused);
|
|
@@ -4051,242 +4332,14 @@ const createViewModel = state => {
|
|
|
4051
4332
|
};
|
|
4052
4333
|
};
|
|
4053
4334
|
|
|
4054
|
-
const mergeClassNames = (...classNames) => {
|
|
4055
|
-
return classNames.filter(Boolean).join(' ');
|
|
4056
|
-
};
|
|
4057
|
-
|
|
4058
|
-
const text = data => {
|
|
4059
|
-
return {
|
|
4060
|
-
type: Text,
|
|
4061
|
-
text: data,
|
|
4062
|
-
childCount: 0
|
|
4063
|
-
};
|
|
4064
|
-
};
|
|
4065
|
-
|
|
4066
|
-
const SetText = 1;
|
|
4067
|
-
const SetAttribute = 3;
|
|
4068
|
-
const RemoveAttribute = 4;
|
|
4069
|
-
const Add = 6;
|
|
4070
|
-
const NavigateChild = 7;
|
|
4071
|
-
const NavigateParent = 8;
|
|
4072
|
-
const RemoveChild = 9;
|
|
4073
|
-
const NavigateSibling = 10;
|
|
4074
|
-
|
|
4075
|
-
const applyPendingPatches = (patches, pendingPatches, skip) => {
|
|
4076
|
-
for (let k = 0; k < pendingPatches.length - skip; k += 2) {
|
|
4077
|
-
const type = pendingPatches[k];
|
|
4078
|
-
const index = pendingPatches[k + 1];
|
|
4079
|
-
if (type === NavigateParent) {
|
|
4080
|
-
patches.push({
|
|
4081
|
-
type
|
|
4082
|
-
});
|
|
4083
|
-
} else {
|
|
4084
|
-
patches.push({
|
|
4085
|
-
type,
|
|
4086
|
-
index
|
|
4087
|
-
});
|
|
4088
|
-
}
|
|
4089
|
-
}
|
|
4090
|
-
pendingPatches.length = 0;
|
|
4091
|
-
};
|
|
4092
|
-
|
|
4093
|
-
const isKey = key => {
|
|
4094
|
-
return key !== 'type' && key !== 'childCount';
|
|
4095
|
-
};
|
|
4096
|
-
|
|
4097
|
-
const getKeys = node => {
|
|
4098
|
-
const keys = Object.keys(node).filter(isKey);
|
|
4099
|
-
return keys;
|
|
4100
|
-
};
|
|
4101
|
-
|
|
4102
|
-
const getTotalChildCount = (nodes, index) => {
|
|
4103
|
-
let i = index;
|
|
4104
|
-
let pending = 1;
|
|
4105
|
-
while (pending) {
|
|
4106
|
-
const node = nodes[i];
|
|
4107
|
-
pending += node.childCount;
|
|
4108
|
-
pending--;
|
|
4109
|
-
i++;
|
|
4110
|
-
}
|
|
4111
|
-
return i - index;
|
|
4112
|
-
};
|
|
4113
|
-
|
|
4114
|
-
const diff = (oldNodes, newNodes) => {
|
|
4115
|
-
const patches = [];
|
|
4116
|
-
const pendingPatches = [];
|
|
4117
|
-
let i = 0;
|
|
4118
|
-
let j = 0;
|
|
4119
|
-
let siblingOffset = 0;
|
|
4120
|
-
let maxSiblingOffset = 1;
|
|
4121
|
-
const indexStack = [0, 1];
|
|
4122
|
-
while (i < oldNodes.length && j < newNodes.length) {
|
|
4123
|
-
const oldNode = oldNodes[i];
|
|
4124
|
-
const newNode = newNodes[j];
|
|
4125
|
-
// TODO maybe don't have the current element in indexstack
|
|
4126
|
-
if (siblingOffset === maxSiblingOffset) {
|
|
4127
|
-
indexStack.pop();
|
|
4128
|
-
indexStack.pop();
|
|
4129
|
-
pendingPatches.push(NavigateParent, 0);
|
|
4130
|
-
maxSiblingOffset = indexStack.pop();
|
|
4131
|
-
siblingOffset = indexStack.pop() + 1;
|
|
4132
|
-
}
|
|
4133
|
-
while (siblingOffset === maxSiblingOffset) {
|
|
4134
|
-
pendingPatches.push(NavigateParent, 0);
|
|
4135
|
-
maxSiblingOffset = indexStack.pop();
|
|
4136
|
-
siblingOffset = indexStack.pop() + 1;
|
|
4137
|
-
}
|
|
4138
|
-
if (oldNode.type !== newNode.type) {
|
|
4139
|
-
let skip = 0;
|
|
4140
|
-
if (pendingPatches.length > 0 && pendingPatches.at(-2) === NavigateChild) {
|
|
4141
|
-
skip = 2;
|
|
4142
|
-
}
|
|
4143
|
-
applyPendingPatches(patches, pendingPatches, skip);
|
|
4144
|
-
const oldTotal = getTotalChildCount(oldNodes, i);
|
|
4145
|
-
const newTotal = getTotalChildCount(newNodes, j);
|
|
4146
|
-
patches.push({
|
|
4147
|
-
type: RemoveChild,
|
|
4148
|
-
index: siblingOffset
|
|
4149
|
-
});
|
|
4150
|
-
patches.push({
|
|
4151
|
-
type: Add,
|
|
4152
|
-
nodes: newNodes.slice(j, j + newTotal)
|
|
4153
|
-
});
|
|
4154
|
-
siblingOffset++;
|
|
4155
|
-
i += oldTotal;
|
|
4156
|
-
j += newTotal;
|
|
4157
|
-
continue;
|
|
4158
|
-
}
|
|
4159
|
-
if (oldNode.type === Text && newNode.type === Text) {
|
|
4160
|
-
if (oldNode.text !== newNode.text) {
|
|
4161
|
-
if (siblingOffset !== 0) {
|
|
4162
|
-
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
4163
|
-
}
|
|
4164
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4165
|
-
patches.push({
|
|
4166
|
-
type: SetText,
|
|
4167
|
-
value: newNode.text
|
|
4168
|
-
});
|
|
4169
|
-
}
|
|
4170
|
-
i++;
|
|
4171
|
-
j++;
|
|
4172
|
-
siblingOffset++;
|
|
4173
|
-
continue;
|
|
4174
|
-
}
|
|
4175
|
-
const oldKeys = getKeys(oldNode);
|
|
4176
|
-
const newKeys = getKeys(newNode);
|
|
4177
|
-
let hasAttributeChanges = false;
|
|
4178
|
-
for (const key of newKeys) {
|
|
4179
|
-
if (oldNode[key] !== newNode[key]) {
|
|
4180
|
-
hasAttributeChanges = true;
|
|
4181
|
-
break;
|
|
4182
|
-
}
|
|
4183
|
-
}
|
|
4184
|
-
for (const key of oldKeys) {
|
|
4185
|
-
if (!(key in newNode)) {
|
|
4186
|
-
hasAttributeChanges = true;
|
|
4187
|
-
break;
|
|
4188
|
-
}
|
|
4189
|
-
}
|
|
4190
|
-
if (hasAttributeChanges) {
|
|
4191
|
-
if (siblingOffset > 0) {
|
|
4192
|
-
pendingPatches.push(NavigateSibling, siblingOffset);
|
|
4193
|
-
}
|
|
4194
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4195
|
-
for (const key of newKeys) {
|
|
4196
|
-
if (oldNode[key] !== newNode[key]) {
|
|
4197
|
-
patches.push({
|
|
4198
|
-
type: SetAttribute,
|
|
4199
|
-
key,
|
|
4200
|
-
value: newNode[key]
|
|
4201
|
-
});
|
|
4202
|
-
}
|
|
4203
|
-
}
|
|
4204
|
-
for (const key of oldKeys) {
|
|
4205
|
-
if (!(key in newNode)) {
|
|
4206
|
-
patches.push({
|
|
4207
|
-
type: RemoveAttribute,
|
|
4208
|
-
key
|
|
4209
|
-
});
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
}
|
|
4213
|
-
if (oldNode.childCount && newNode.childCount) {
|
|
4214
|
-
maxSiblingOffset = oldNode.childCount;
|
|
4215
|
-
indexStack.push(0, maxSiblingOffset);
|
|
4216
|
-
pendingPatches.push(NavigateChild, 0);
|
|
4217
|
-
i++;
|
|
4218
|
-
j++;
|
|
4219
|
-
continue;
|
|
4220
|
-
}
|
|
4221
|
-
if (oldNode.childCount) {
|
|
4222
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4223
|
-
for (let k = 0; k < oldNode.childCount; k++) {
|
|
4224
|
-
patches.push({
|
|
4225
|
-
type: RemoveChild,
|
|
4226
|
-
index: 0
|
|
4227
|
-
});
|
|
4228
|
-
}
|
|
4229
|
-
i += getTotalChildCount(oldNodes, i);
|
|
4230
|
-
j++;
|
|
4231
|
-
siblingOffset++;
|
|
4232
|
-
continue;
|
|
4233
|
-
}
|
|
4234
|
-
if (newNode.childCount) {
|
|
4235
|
-
applyPendingPatches(patches, pendingPatches, 0);
|
|
4236
|
-
const total = getTotalChildCount(newNodes, j);
|
|
4237
|
-
patches.push({
|
|
4238
|
-
type: Add,
|
|
4239
|
-
nodes: newNodes.slice(j + 1, j + total)
|
|
4240
|
-
});
|
|
4241
|
-
i++;
|
|
4242
|
-
j += total;
|
|
4243
|
-
continue;
|
|
4244
|
-
}
|
|
4245
|
-
i++;
|
|
4246
|
-
j++;
|
|
4247
|
-
siblingOffset++;
|
|
4248
|
-
}
|
|
4249
|
-
while (i < oldNodes.length) {
|
|
4250
|
-
if (indexStack.length !== 2) {
|
|
4251
|
-
patches.push({
|
|
4252
|
-
type: NavigateParent
|
|
4253
|
-
});
|
|
4254
|
-
}
|
|
4255
|
-
patches.push({
|
|
4256
|
-
type: RemoveChild,
|
|
4257
|
-
index: siblingOffset
|
|
4258
|
-
});
|
|
4259
|
-
i += getTotalChildCount(oldNodes, i);
|
|
4260
|
-
indexStack.pop();
|
|
4261
|
-
indexStack.pop();
|
|
4262
|
-
}
|
|
4263
|
-
while (j < newNodes.length) {
|
|
4264
|
-
if (siblingOffset > 0) {
|
|
4265
|
-
patches.push({
|
|
4266
|
-
type: NavigateSibling,
|
|
4267
|
-
index: siblingOffset
|
|
4268
|
-
});
|
|
4269
|
-
siblingOffset = 0;
|
|
4270
|
-
}
|
|
4271
|
-
const count = getTotalChildCount(newNodes, j);
|
|
4272
|
-
patches.push({
|
|
4273
|
-
type: Add,
|
|
4274
|
-
nodes: newNodes.slice(j, j + count)
|
|
4275
|
-
});
|
|
4276
|
-
j += count;
|
|
4277
|
-
}
|
|
4278
|
-
return patches;
|
|
4279
|
-
};
|
|
4280
|
-
|
|
4281
4335
|
const HandleClick = 1;
|
|
4282
4336
|
const HandleContextMenu = 2;
|
|
4283
4337
|
const HandleHeaderContextMenu = 3;
|
|
4284
4338
|
const HandleExcludeInput = 4;
|
|
4285
|
-
const
|
|
4339
|
+
const HandleButtonClick = 5;
|
|
4286
4340
|
const HandleHeaderFocusIn = 6;
|
|
4287
4341
|
const HandleHeaderFocusOut = 7;
|
|
4288
4342
|
const HandleIncludeInput = 8;
|
|
4289
|
-
const HandleInput = 9;
|
|
4290
4343
|
const HandleInput2 = 10;
|
|
4291
4344
|
const HandleListBlur = 11;
|
|
4292
4345
|
const HandleListFocus = 12;
|
|
@@ -4294,16 +4347,20 @@ const HandleReplaceInput = 13;
|
|
|
4294
4347
|
const HandleScrollBarPointerDown = 14;
|
|
4295
4348
|
const HandleToggleButtonClick = 15;
|
|
4296
4349
|
const HandleWheel = 16;
|
|
4350
|
+
const HandleInputFocus = 17;
|
|
4351
|
+
const HandleInputBlur = 18;
|
|
4352
|
+
const HandleListPointerDown = 19;
|
|
4297
4353
|
|
|
4298
4354
|
const getSearchDetailsToggleVirtualDom = () => {
|
|
4299
4355
|
return [{
|
|
4300
|
-
type:
|
|
4356
|
+
type: Button$2,
|
|
4301
4357
|
className: ToggleDetails,
|
|
4302
4358
|
role: Button$3,
|
|
4303
4359
|
tabIndex: 0,
|
|
4304
4360
|
ariaLabel: toggleSearchDetails(),
|
|
4305
4361
|
title: toggleSearchDetails(),
|
|
4306
4362
|
name: ToggleSearchDetails,
|
|
4363
|
+
onClick: HandleButtonClick,
|
|
4307
4364
|
childCount: 1
|
|
4308
4365
|
}, {
|
|
4309
4366
|
type: Div,
|
|
@@ -4424,7 +4481,8 @@ const getSearchFieldButtonVirtualDom = button => {
|
|
|
4424
4481
|
ariaChecked,
|
|
4425
4482
|
disabled,
|
|
4426
4483
|
tabIndex: 0,
|
|
4427
|
-
childCount: 1
|
|
4484
|
+
childCount: 1,
|
|
4485
|
+
onClick: HandleButtonClick
|
|
4428
4486
|
}, {
|
|
4429
4487
|
type: Span,
|
|
4430
4488
|
className: mergeClassNames(MaskIcon, icon),
|
|
@@ -4450,7 +4508,7 @@ const getOutSideButtonsDom = outsideButtons => {
|
|
|
4450
4508
|
};
|
|
4451
4509
|
};
|
|
4452
4510
|
|
|
4453
|
-
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons,
|
|
4511
|
+
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, hasError = false) => {
|
|
4454
4512
|
const {
|
|
4455
4513
|
preNodes,
|
|
4456
4514
|
postNodes
|
|
@@ -4470,7 +4528,9 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
4470
4528
|
placeholder,
|
|
4471
4529
|
name,
|
|
4472
4530
|
onInput,
|
|
4473
|
-
onFocus,
|
|
4531
|
+
onFocus: HandleInputFocus,
|
|
4532
|
+
onBlur: HandleInputBlur,
|
|
4533
|
+
onContextMenu: HandleContextMenu,
|
|
4474
4534
|
childCount: 0
|
|
4475
4535
|
}, {
|
|
4476
4536
|
type: Div,
|
|
@@ -4594,10 +4654,11 @@ const getSearchToggleVirtualDom = replaceExpanded => {
|
|
|
4594
4654
|
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
4595
4655
|
title: toggleReplace$1(),
|
|
4596
4656
|
ariaLabel: toggleReplace$1(),
|
|
4657
|
+
// TODO compute label only once
|
|
4597
4658
|
ariaExpanded: Boolean(replaceExpanded),
|
|
4598
4659
|
childCount: 1,
|
|
4599
|
-
|
|
4600
|
-
|
|
4660
|
+
name: ToggleReplace,
|
|
4661
|
+
onClick: HandleButtonClick
|
|
4601
4662
|
}, {
|
|
4602
4663
|
type: Div,
|
|
4603
4664
|
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
@@ -4621,7 +4682,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4621
4682
|
className: SearchHeaderTopRight,
|
|
4622
4683
|
role: None$1,
|
|
4623
4684
|
childCount: replaceExpanded ? 2 : 1
|
|
4624
|
-
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside,
|
|
4685
|
+
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
|
|
4625
4686
|
if (flags & ReplaceExpanded) {
|
|
4626
4687
|
dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
|
|
4627
4688
|
}
|
|
@@ -4633,9 +4694,6 @@ const parentNode = {
|
|
|
4633
4694
|
className: SearchHeader,
|
|
4634
4695
|
role: None$1,
|
|
4635
4696
|
childCount: 3,
|
|
4636
|
-
onClick: HandleHeaderClick2,
|
|
4637
|
-
onFocusIn: HandleHeaderFocusIn,
|
|
4638
|
-
onFocusOut: HandleHeaderFocusOut,
|
|
4639
4697
|
onContextMenu: HandleHeaderContextMenu
|
|
4640
4698
|
};
|
|
4641
4699
|
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
|
|
@@ -4871,7 +4929,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
|
4871
4929
|
onWheel: HandleWheel,
|
|
4872
4930
|
onContextMenu: HandleContextMenu,
|
|
4873
4931
|
id: TreeItems,
|
|
4874
|
-
top: `${-pixelOffset}px`
|
|
4932
|
+
top: `${-pixelOffset}px` // TODO use dynamic css instead
|
|
4875
4933
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
4876
4934
|
};
|
|
4877
4935
|
|
|
@@ -4879,10 +4937,12 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
|
|
|
4879
4937
|
const childCount = scrollbarHeight === 0 ? 1 : 2;
|
|
4880
4938
|
return [{
|
|
4881
4939
|
type: Div,
|
|
4882
|
-
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty),
|
|
4940
|
+
className: mergeClassNames(Viewlet, List$1, Tree, focusOutline ? FocusOutline : Empty$1),
|
|
4883
4941
|
role: Tree$1,
|
|
4884
4942
|
tabIndex: 0,
|
|
4885
|
-
childCount
|
|
4943
|
+
childCount,
|
|
4944
|
+
onBlur: HandleListBlur,
|
|
4945
|
+
onPointerDown: HandleListPointerDown
|
|
4886
4946
|
}, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
|
|
4887
4947
|
};
|
|
4888
4948
|
|
|
@@ -4899,20 +4959,20 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
|
|
|
4899
4959
|
const renderItems = (oldState, newState) => {
|
|
4900
4960
|
const viewModel = createViewModel(newState);
|
|
4901
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);
|
|
4902
|
-
return [
|
|
4962
|
+
return [SetDom2, newState.uid, dom];
|
|
4903
4963
|
};
|
|
4904
4964
|
|
|
4905
4965
|
const renderValue = (oldState, newState) => {
|
|
4906
|
-
return [
|
|
4966
|
+
return [SetValueByName, SearchValue, newState.value];
|
|
4907
4967
|
};
|
|
4908
4968
|
const renderReplacement = (oldState, newState) => {
|
|
4909
|
-
return [
|
|
4969
|
+
return [SetValueByName, ReplaceValue, newState.replacement];
|
|
4910
4970
|
};
|
|
4911
4971
|
const renderIncludeValue = (oldState, newState) => {
|
|
4912
|
-
return [
|
|
4972
|
+
return [SetValueByName, FilesToInclude, newState.includeValue];
|
|
4913
4973
|
};
|
|
4914
4974
|
const renderExcludeValue = (oldState, newState) => {
|
|
4915
|
-
return [
|
|
4975
|
+
return [SetValueByName, FilesToExclude, newState.excludeValue];
|
|
4916
4976
|
};
|
|
4917
4977
|
|
|
4918
4978
|
const getRenderer = diffType => {
|
|
@@ -5053,12 +5113,12 @@ const renderEventListeners = () => {
|
|
|
5053
5113
|
}, {
|
|
5054
5114
|
name: HandleReplaceInput,
|
|
5055
5115
|
params: ['handleReplaceInput', TargetValue]
|
|
5056
|
-
}, {
|
|
5057
|
-
name: HandleInput,
|
|
5058
|
-
params: ['handleInput', TargetValue, User]
|
|
5059
5116
|
}, {
|
|
5060
5117
|
name: HandleClick,
|
|
5061
5118
|
params: ['handleClickAt', ClientX, ClientY]
|
|
5119
|
+
}, {
|
|
5120
|
+
name: HandleListPointerDown,
|
|
5121
|
+
params: ['handleListPointerDown']
|
|
5062
5122
|
}, {
|
|
5063
5123
|
name: HandleToggleButtonClick,
|
|
5064
5124
|
params: ['handleToggleButtonClick']
|
|
@@ -5081,7 +5141,7 @@ const renderEventListeners = () => {
|
|
|
5081
5141
|
params: ['handleWheel', DeltaMode, DeltaY],
|
|
5082
5142
|
passive: true
|
|
5083
5143
|
}, {
|
|
5084
|
-
name:
|
|
5144
|
+
name: HandleButtonClick,
|
|
5085
5145
|
params: ['handleHeaderClick', TargetName]
|
|
5086
5146
|
}, {
|
|
5087
5147
|
name: HandleHeaderFocusIn,
|
|
@@ -5092,6 +5152,12 @@ const renderEventListeners = () => {
|
|
|
5092
5152
|
}, {
|
|
5093
5153
|
name: HandleScrollBarPointerDown,
|
|
5094
5154
|
params: ['handleScrollBarClick', DeltaY]
|
|
5155
|
+
}, {
|
|
5156
|
+
name: HandleInputFocus,
|
|
5157
|
+
params: ['handleInputFocus', TargetName]
|
|
5158
|
+
}, {
|
|
5159
|
+
name: HandleInputBlur,
|
|
5160
|
+
params: ['handleInputBlur', TargetName]
|
|
5095
5161
|
}];
|
|
5096
5162
|
};
|
|
5097
5163
|
|
|
@@ -5112,7 +5178,7 @@ const renderIncremental = uid => {
|
|
|
5112
5178
|
} = get$1(uid);
|
|
5113
5179
|
const oldDom = getDom(oldState);
|
|
5114
5180
|
const newDom = getDom(newState);
|
|
5115
|
-
const patches = diff(oldDom, newDom);
|
|
5181
|
+
const patches = diff$1(oldDom, newDom);
|
|
5116
5182
|
return patches;
|
|
5117
5183
|
};
|
|
5118
5184
|
|
|
@@ -5166,10 +5232,7 @@ const rerender = state => {
|
|
|
5166
5232
|
};
|
|
5167
5233
|
};
|
|
5168
5234
|
|
|
5169
|
-
const saveState =
|
|
5170
|
-
const {
|
|
5171
|
-
newState
|
|
5172
|
-
} = get$1(uid);
|
|
5235
|
+
const saveState = state => {
|
|
5173
5236
|
const {
|
|
5174
5237
|
value,
|
|
5175
5238
|
replacement,
|
|
@@ -5177,8 +5240,10 @@ const saveState = uid => {
|
|
|
5177
5240
|
includeValue,
|
|
5178
5241
|
excludeValue,
|
|
5179
5242
|
history,
|
|
5180
|
-
collapsedPaths
|
|
5181
|
-
|
|
5243
|
+
collapsedPaths,
|
|
5244
|
+
focus,
|
|
5245
|
+
listFocused
|
|
5246
|
+
} = state;
|
|
5182
5247
|
return {
|
|
5183
5248
|
value,
|
|
5184
5249
|
replacement,
|
|
@@ -5186,7 +5251,9 @@ const saveState = uid => {
|
|
|
5186
5251
|
includeValue,
|
|
5187
5252
|
excludeValue,
|
|
5188
5253
|
history,
|
|
5189
|
-
collapsedPaths
|
|
5254
|
+
collapsedPaths,
|
|
5255
|
+
focus,
|
|
5256
|
+
listFocused
|
|
5190
5257
|
};
|
|
5191
5258
|
};
|
|
5192
5259
|
|
|
@@ -5227,7 +5294,7 @@ const getSearchFocusKey = key => {
|
|
|
5227
5294
|
case ToggleReplace:
|
|
5228
5295
|
return FocusToggleReplace;
|
|
5229
5296
|
default:
|
|
5230
|
-
return Empty
|
|
5297
|
+
return Empty;
|
|
5231
5298
|
}
|
|
5232
5299
|
};
|
|
5233
5300
|
|
|
@@ -5356,6 +5423,7 @@ const commandMap = {
|
|
|
5356
5423
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5357
5424
|
'TextSearch.copy': wrapCommand(copy),
|
|
5358
5425
|
'TextSearch.copyPath': wrapCommand(copyPath),
|
|
5426
|
+
'TextSearch.handleInputBlur': wrapCommand(handleInputBlur),
|
|
5359
5427
|
'TextSearch.diff2': diff2,
|
|
5360
5428
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
5361
5429
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
@@ -5382,6 +5450,7 @@ const commandMap = {
|
|
|
5382
5450
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
5383
5451
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
5384
5452
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
5453
|
+
'TextSearch.handleInputFocus': wrapCommand(handleInputFocus),
|
|
5385
5454
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
5386
5455
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
5387
5456
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
@@ -5416,6 +5485,7 @@ const commandMap = {
|
|
|
5416
5485
|
'TextSearch.toggleReplace': wrapCommand(toggleReplace),
|
|
5417
5486
|
'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
|
|
5418
5487
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
5488
|
+
'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
|
|
5419
5489
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
5420
5490
|
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
5421
5491
|
// not wrapped
|
|
@@ -5427,7 +5497,7 @@ const commandMap = {
|
|
|
5427
5497
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
5428
5498
|
'TextSearch.renderIncremental': renderIncremental,
|
|
5429
5499
|
'TextSearch.restoreState': restoreState,
|
|
5430
|
-
'TextSearch.saveState': saveState,
|
|
5500
|
+
'TextSearch.saveState': wrapGetter(saveState),
|
|
5431
5501
|
'TextSearch.terminate': terminate,
|
|
5432
5502
|
'TextSearch.renderActions': renderActions,
|
|
5433
5503
|
// TODO needed?
|