@lvce-editor/extension-detail-view 3.32.0 → 3.34.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/extensionDetailViewWorkerMain.js +485 -386
- package/package.json +1 -1
|
@@ -945,32 +945,43 @@ const {
|
|
|
945
945
|
const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
946
946
|
const state = {
|
|
947
947
|
assetDir: assetDir || '',
|
|
948
|
+
activationEvents: [],
|
|
948
949
|
baseUrl: '',
|
|
949
950
|
builtinExtensionsBadgeEnabled: true,
|
|
950
951
|
categories: [],
|
|
951
952
|
changelogVirtualDom: [],
|
|
953
|
+
commands: [],
|
|
952
954
|
description: '',
|
|
953
955
|
detailsVirtualDom: [],
|
|
956
|
+
displaySize: '',
|
|
954
957
|
entries: [],
|
|
955
958
|
extension: {},
|
|
959
|
+
extensionId: '',
|
|
960
|
+
extensionVersion: '',
|
|
956
961
|
features: [],
|
|
957
962
|
featuresVirtualDom: [],
|
|
958
963
|
folderSize: 0,
|
|
964
|
+
hasColorTheme: false,
|
|
959
965
|
iconSrc: '',
|
|
966
|
+
isBuiltin: false,
|
|
967
|
+
jsonValidation: [],
|
|
960
968
|
name: '',
|
|
961
969
|
platform,
|
|
970
|
+
programmingLanguages: [],
|
|
962
971
|
readmeScrollTop: 0,
|
|
963
972
|
resources: [],
|
|
964
|
-
sanitizedReadmeHtml: '',
|
|
965
973
|
scrollToTopButtonEnabled: false,
|
|
966
974
|
secondEntries: [],
|
|
967
975
|
selectedFeature: '',
|
|
968
|
-
themesMarkdownDom: [],
|
|
969
976
|
selectedTab: '',
|
|
977
|
+
settings: [],
|
|
970
978
|
settingsButtonEnabled: false,
|
|
971
979
|
showAdditionalDetailsBreakpoint: 600,
|
|
972
980
|
sizeOnDisk: 0,
|
|
981
|
+
sizeValue: 0,
|
|
982
|
+
themesMarkdownDom: [],
|
|
973
983
|
uri,
|
|
984
|
+
webViews: [],
|
|
974
985
|
width
|
|
975
986
|
};
|
|
976
987
|
set$1(uid, state, state);
|
|
@@ -1203,40 +1214,80 @@ const handleClickDisable = async state => {
|
|
|
1203
1214
|
return state;
|
|
1204
1215
|
};
|
|
1205
1216
|
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1217
|
+
const Text$1 = 1;
|
|
1218
|
+
const Code$2 = 2;
|
|
1219
|
+
|
|
1220
|
+
const getCommandTableEntry = command => {
|
|
1221
|
+
// TODO watch out for command being null/undefined/number/string/array
|
|
1210
1222
|
const {
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1223
|
+
id,
|
|
1224
|
+
label
|
|
1225
|
+
} = command;
|
|
1226
|
+
return [{
|
|
1227
|
+
type: Code$2,
|
|
1228
|
+
value: id
|
|
1229
|
+
}, {
|
|
1230
|
+
type: Text$1,
|
|
1231
|
+
value: label
|
|
1232
|
+
}];
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
const getFeatureDetailsCommand = extension => {
|
|
1236
|
+
const commands = extension.commands || [];
|
|
1237
|
+
const rows = commands.map(getCommandTableEntry);
|
|
1225
1238
|
return {
|
|
1226
|
-
|
|
1227
|
-
selectedFeature: name,
|
|
1228
|
-
features: newFeatures
|
|
1239
|
+
commands: rows
|
|
1229
1240
|
};
|
|
1230
1241
|
};
|
|
1231
1242
|
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1243
|
+
const getJsonValidationTableEntry = validation => {
|
|
1244
|
+
const {
|
|
1245
|
+
fileMatch,
|
|
1246
|
+
schema
|
|
1247
|
+
} = validation;
|
|
1248
|
+
return [{
|
|
1249
|
+
type: Code$2,
|
|
1250
|
+
value: fileMatch
|
|
1251
|
+
}, {
|
|
1252
|
+
type: Code$2,
|
|
1253
|
+
value: schema
|
|
1254
|
+
}];
|
|
1234
1255
|
};
|
|
1235
1256
|
|
|
1236
|
-
const
|
|
1257
|
+
const getFeatureDetailsJsonValidation = extension => {
|
|
1258
|
+
const validations = extension.jsonValidation || [];
|
|
1259
|
+
const rows = validations.map(getJsonValidationTableEntry);
|
|
1237
1260
|
return {
|
|
1238
|
-
|
|
1239
|
-
|
|
1261
|
+
jsonValidation: rows
|
|
1262
|
+
};
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
const getFeatureDetailsProgrammingLanguages = extension => {
|
|
1266
|
+
return {
|
|
1267
|
+
programmingLanguages: []
|
|
1268
|
+
};
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
const getSettingsTableEntry = setting => {
|
|
1272
|
+
const {
|
|
1273
|
+
id,
|
|
1274
|
+
label
|
|
1275
|
+
} = setting;
|
|
1276
|
+
// TODO watch out for null/undefined/number/string/array
|
|
1277
|
+
return [{
|
|
1278
|
+
type: Text$1,
|
|
1279
|
+
value: id
|
|
1280
|
+
}, {
|
|
1281
|
+
type: Text$1,
|
|
1282
|
+
value: label
|
|
1283
|
+
}];
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
const getFeatureDetailsSettings = extension => {
|
|
1287
|
+
const settings = extension.settings || [];
|
|
1288
|
+
const rows = settings.map(getSettingsTableEntry);
|
|
1289
|
+
return {
|
|
1290
|
+
settings: rows
|
|
1240
1291
|
};
|
|
1241
1292
|
};
|
|
1242
1293
|
|
|
@@ -1330,6 +1381,168 @@ const {
|
|
|
1330
1381
|
set,
|
|
1331
1382
|
setColorTheme: setColorTheme$1} = RendererWorker;
|
|
1332
1383
|
|
|
1384
|
+
const getMarkdownVirtualDom = async html => {
|
|
1385
|
+
string(html);
|
|
1386
|
+
const dom = await getMarkdownDom(html);
|
|
1387
|
+
return dom;
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
const getThemeItemMarkdown = (heading, items) => {
|
|
1391
|
+
let markdown = '';
|
|
1392
|
+
if (items.length > 0) {
|
|
1393
|
+
markdown += `### ${heading}`;
|
|
1394
|
+
markdown += '\n\n';
|
|
1395
|
+
for (const item of items) {
|
|
1396
|
+
markdown += `- ${item.label}`;
|
|
1397
|
+
markdown += '\n';
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return markdown;
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
const getColorThemeMarkdown = themes => {
|
|
1404
|
+
const heading = 'Color Themes';
|
|
1405
|
+
return getThemeItemMarkdown(heading, themes);
|
|
1406
|
+
};
|
|
1407
|
+
const getIconThemeMarkdown = iconThemes => {
|
|
1408
|
+
const heading = 'File Icon Themes';
|
|
1409
|
+
return getThemeItemMarkdown(heading, iconThemes);
|
|
1410
|
+
};
|
|
1411
|
+
const getProductIconThemeMarkdown = iconThemes => {
|
|
1412
|
+
const heading = 'Product Icon Themes';
|
|
1413
|
+
return getThemeItemMarkdown(heading, iconThemes);
|
|
1414
|
+
};
|
|
1415
|
+
const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
|
|
1416
|
+
let markdown = '';
|
|
1417
|
+
markdown += getColorThemeMarkdown(themes);
|
|
1418
|
+
markdown += getIconThemeMarkdown(iconThemes);
|
|
1419
|
+
markdown += getProductIconThemeMarkdown(productIconThemes);
|
|
1420
|
+
return markdown;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
const renderMarkdown = async (markdown, options = {}) => {
|
|
1424
|
+
const html = await renderMarkdown$1(markdown, options);
|
|
1425
|
+
return html;
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
const getFeatureDetailsTheme = async (extension, baseUrl) => {
|
|
1429
|
+
// Only generate theme markdown when the selected feature is actually "Theme"
|
|
1430
|
+
const {
|
|
1431
|
+
colorThemes,
|
|
1432
|
+
iconThemes,
|
|
1433
|
+
productIconThemes
|
|
1434
|
+
} = extension;
|
|
1435
|
+
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
1436
|
+
const rendered = await renderMarkdown(markdown, {
|
|
1437
|
+
baseUrl
|
|
1438
|
+
});
|
|
1439
|
+
const themesMarkdownDom = await getMarkdownVirtualDom(rendered);
|
|
1440
|
+
return {
|
|
1441
|
+
themesMarkdownDom
|
|
1442
|
+
};
|
|
1443
|
+
};
|
|
1444
|
+
|
|
1445
|
+
const toWebView = rawWebView => {
|
|
1446
|
+
const {
|
|
1447
|
+
id,
|
|
1448
|
+
selector,
|
|
1449
|
+
contentSecurityPolicy,
|
|
1450
|
+
elements
|
|
1451
|
+
} = rawWebView;
|
|
1452
|
+
return {
|
|
1453
|
+
id,
|
|
1454
|
+
selectorString: JSON.stringify(selector),
|
|
1455
|
+
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
1456
|
+
elementsString: JSON.stringify(elements, null, 2)
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1460
|
+
const getWebViews = extension => {
|
|
1461
|
+
const rawWebViews = extension.webViews || [];
|
|
1462
|
+
return rawWebViews.map(toWebView);
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
const getFeatureDetailsWebView = extension => {
|
|
1466
|
+
const webViews = getWebViews(extension);
|
|
1467
|
+
return {
|
|
1468
|
+
webViews
|
|
1469
|
+
};
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1472
|
+
const Changelog$1 = 'Changelog';
|
|
1473
|
+
const Commands = 'Commands';
|
|
1474
|
+
const Details = 'Details';
|
|
1475
|
+
const Features$1 = 'Features';
|
|
1476
|
+
const JsonValidation = 'JsonValidation';
|
|
1477
|
+
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1478
|
+
const Settings = 'Settings';
|
|
1479
|
+
const WebViews = 'WebViews';
|
|
1480
|
+
const Theme = 'Theme';
|
|
1481
|
+
const SetColorTheme = 'SetColorTheme';
|
|
1482
|
+
const Disable = 'Disable';
|
|
1483
|
+
const Uninstall = 'Uninstall';
|
|
1484
|
+
|
|
1485
|
+
const getFeatureDetailsHandler = featureName => {
|
|
1486
|
+
switch (featureName) {
|
|
1487
|
+
case Commands:
|
|
1488
|
+
return getFeatureDetailsCommand;
|
|
1489
|
+
case JsonValidation:
|
|
1490
|
+
return getFeatureDetailsJsonValidation;
|
|
1491
|
+
case ProgrammingLanguages:
|
|
1492
|
+
return getFeatureDetailsProgrammingLanguages;
|
|
1493
|
+
case Settings:
|
|
1494
|
+
return getFeatureDetailsSettings;
|
|
1495
|
+
case WebViews:
|
|
1496
|
+
return getFeatureDetailsWebView;
|
|
1497
|
+
case Theme:
|
|
1498
|
+
return getFeatureDetailsTheme;
|
|
1499
|
+
default:
|
|
1500
|
+
throw new Error(`unknown feature details handler: ${featureName}`);
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
const selectFeature = async (state, name) => {
|
|
1505
|
+
if (!name) {
|
|
1506
|
+
return state;
|
|
1507
|
+
}
|
|
1508
|
+
const {
|
|
1509
|
+
features,
|
|
1510
|
+
extension,
|
|
1511
|
+
baseUrl
|
|
1512
|
+
} = state;
|
|
1513
|
+
const newFeatures = features.map(feature => {
|
|
1514
|
+
if (feature.id === name) {
|
|
1515
|
+
return {
|
|
1516
|
+
...feature,
|
|
1517
|
+
selected: true
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
return {
|
|
1521
|
+
...feature,
|
|
1522
|
+
selected: false
|
|
1523
|
+
};
|
|
1524
|
+
});
|
|
1525
|
+
const fn = getFeatureDetailsHandler(name);
|
|
1526
|
+
const partialNewState = await fn(extension, baseUrl);
|
|
1527
|
+
return {
|
|
1528
|
+
...state,
|
|
1529
|
+
...partialNewState,
|
|
1530
|
+
selectedFeature: name,
|
|
1531
|
+
features: newFeatures
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
const handleClickFeatures = async (state, name) => {
|
|
1536
|
+
return selectFeature(state, name);
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
const handleClickScrollToTop = state => {
|
|
1540
|
+
return {
|
|
1541
|
+
...state,
|
|
1542
|
+
readmeScrollTop: 0
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1333
1546
|
const setColorTheme = id => {
|
|
1334
1547
|
return setColorTheme$1(id);
|
|
1335
1548
|
};
|
|
@@ -1393,25 +1606,6 @@ const handleIconError = state => {
|
|
|
1393
1606
|
};
|
|
1394
1607
|
};
|
|
1395
1608
|
|
|
1396
|
-
const Changelog$1 = 'Changelog';
|
|
1397
|
-
const Commands = 'Commands';
|
|
1398
|
-
const Details = 'Details';
|
|
1399
|
-
const Features$1 = 'Features';
|
|
1400
|
-
const JsonValidation = 'JsonValidation';
|
|
1401
|
-
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1402
|
-
const Settings = 'Settings';
|
|
1403
|
-
const WebViews = 'WebViews';
|
|
1404
|
-
const Theme = 'Theme';
|
|
1405
|
-
const SetColorTheme = 'SetColorTheme';
|
|
1406
|
-
const Disable = 'Disable';
|
|
1407
|
-
const Uninstall = 'Uninstall';
|
|
1408
|
-
|
|
1409
|
-
const getMarkdownVirtualDom = async html => {
|
|
1410
|
-
string(html);
|
|
1411
|
-
const dom = await getMarkdownDom(html);
|
|
1412
|
-
return dom;
|
|
1413
|
-
};
|
|
1414
|
-
|
|
1415
1609
|
const readFile = async uri => {
|
|
1416
1610
|
return readFile$1(uri);
|
|
1417
1611
|
};
|
|
@@ -1442,11 +1636,6 @@ const loadChangelogContent = async path => {
|
|
|
1442
1636
|
}
|
|
1443
1637
|
};
|
|
1444
1638
|
|
|
1445
|
-
const renderMarkdown = async (markdown, options = {}) => {
|
|
1446
|
-
const html = await renderMarkdown$1(markdown, options);
|
|
1447
|
-
return html;
|
|
1448
|
-
};
|
|
1449
|
-
|
|
1450
1639
|
const selectTabChangelog = async state => {
|
|
1451
1640
|
const {
|
|
1452
1641
|
extension,
|
|
@@ -1468,25 +1657,6 @@ const selectTabDefault = async state => {
|
|
|
1468
1657
|
return state;
|
|
1469
1658
|
};
|
|
1470
1659
|
|
|
1471
|
-
const getRemoteSrc = uri => {
|
|
1472
|
-
const src = `/remote${uri}`;
|
|
1473
|
-
return src;
|
|
1474
|
-
};
|
|
1475
|
-
|
|
1476
|
-
const Web = 1;
|
|
1477
|
-
const Electron = 2;
|
|
1478
|
-
const Remote = 3;
|
|
1479
|
-
|
|
1480
|
-
const getBaseUrl = (extensionPath, platform) => {
|
|
1481
|
-
switch (platform) {
|
|
1482
|
-
case Remote:
|
|
1483
|
-
case Electron:
|
|
1484
|
-
return getRemoteSrc(extensionPath + '/');
|
|
1485
|
-
default:
|
|
1486
|
-
return extensionPath;
|
|
1487
|
-
}
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
1660
|
const loadReadmeContent = async path => {
|
|
1491
1661
|
try {
|
|
1492
1662
|
const readmeUrl = join('/', path, 'README.md');
|
|
@@ -1506,10 +1676,9 @@ const loadReadmeContent = async path => {
|
|
|
1506
1676
|
const selectTabDetails = async state => {
|
|
1507
1677
|
const {
|
|
1508
1678
|
extension,
|
|
1509
|
-
|
|
1679
|
+
baseUrl
|
|
1510
1680
|
} = state;
|
|
1511
1681
|
const readmeContent = await loadReadmeContent(extension.path);
|
|
1512
|
-
const baseUrl = getBaseUrl(extension.path, platform);
|
|
1513
1682
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
1514
1683
|
baseUrl
|
|
1515
1684
|
});
|
|
@@ -1521,64 +1690,19 @@ const selectTabDetails = async state => {
|
|
|
1521
1690
|
};
|
|
1522
1691
|
};
|
|
1523
1692
|
|
|
1524
|
-
const getThemeItemMarkdown = (heading, items) => {
|
|
1525
|
-
let markdown = '';
|
|
1526
|
-
if (items.length > 0) {
|
|
1527
|
-
markdown += `### ${heading}`;
|
|
1528
|
-
markdown += '\n\n';
|
|
1529
|
-
for (const item of items) {
|
|
1530
|
-
markdown += `- ${item.label}`;
|
|
1531
|
-
markdown += '\n';
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
return markdown;
|
|
1535
|
-
};
|
|
1536
|
-
|
|
1537
|
-
const getColorThemeMarkdown = themes => {
|
|
1538
|
-
const heading = 'Color Themes';
|
|
1539
|
-
return getThemeItemMarkdown(heading, themes);
|
|
1540
|
-
};
|
|
1541
|
-
const getIconThemeMarkdown = iconThemes => {
|
|
1542
|
-
const heading = 'File Icon Themes';
|
|
1543
|
-
return getThemeItemMarkdown(heading, iconThemes);
|
|
1544
|
-
};
|
|
1545
|
-
const getProductIconThemeMarkdown = iconThemes => {
|
|
1546
|
-
const heading = 'Product Icon Themes';
|
|
1547
|
-
return getThemeItemMarkdown(heading, iconThemes);
|
|
1548
|
-
};
|
|
1549
|
-
const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
|
|
1550
|
-
let markdown = '';
|
|
1551
|
-
markdown += getColorThemeMarkdown(themes);
|
|
1552
|
-
markdown += getIconThemeMarkdown(iconThemes);
|
|
1553
|
-
markdown += getProductIconThemeMarkdown(productIconThemes);
|
|
1554
|
-
return markdown;
|
|
1555
|
-
};
|
|
1556
|
-
|
|
1557
1693
|
const selectTabFeatures = async state => {
|
|
1558
1694
|
const {
|
|
1559
1695
|
extension,
|
|
1560
1696
|
baseUrl,
|
|
1561
1697
|
selectedFeature
|
|
1562
1698
|
} = state;
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
if (!selectedFeature || selectedFeature === Theme) {
|
|
1567
|
-
const {
|
|
1568
|
-
colorThemes,
|
|
1569
|
-
iconThemes,
|
|
1570
|
-
productIconThemes
|
|
1571
|
-
} = extension;
|
|
1572
|
-
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
1573
|
-
const rendered = await renderMarkdown(markdown, {
|
|
1574
|
-
baseUrl
|
|
1575
|
-
});
|
|
1576
|
-
themesMarkdownDom = await getMarkdownVirtualDom(rendered);
|
|
1577
|
-
}
|
|
1699
|
+
const actualSelectedFeature = selectedFeature || Theme;
|
|
1700
|
+
const fn = getFeatureDetailsHandler(actualSelectedFeature);
|
|
1701
|
+
const partialNewState = await fn(extension, baseUrl);
|
|
1578
1702
|
return {
|
|
1579
1703
|
...state,
|
|
1580
1704
|
selectedTab: Features$1,
|
|
1581
|
-
|
|
1705
|
+
...partialNewState
|
|
1582
1706
|
};
|
|
1583
1707
|
};
|
|
1584
1708
|
|
|
@@ -1625,6 +1749,10 @@ const isThemeExtension = extension => {
|
|
|
1625
1749
|
return extension.name && extension.name.endsWith(' Theme');
|
|
1626
1750
|
};
|
|
1627
1751
|
|
|
1752
|
+
const Web = 1;
|
|
1753
|
+
const Electron = 2;
|
|
1754
|
+
const Remote = 3;
|
|
1755
|
+
|
|
1628
1756
|
const getIcon = (extension, platform, assetDir) => {
|
|
1629
1757
|
if (!extension) {
|
|
1630
1758
|
return extensionDefaultIcon(assetDir);
|
|
@@ -1661,43 +1789,151 @@ const getName = extension => {
|
|
|
1661
1789
|
if (extension && extension.id) {
|
|
1662
1790
|
return extension.id;
|
|
1663
1791
|
}
|
|
1664
|
-
return 'n/a';
|
|
1665
|
-
};
|
|
1666
|
-
|
|
1667
|
-
const getAllExtensions = async platform => {
|
|
1668
|
-
if (platform === Web) {
|
|
1669
|
-
return [];
|
|
1792
|
+
return 'n/a';
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1795
|
+
const getAllExtensions = async platform => {
|
|
1796
|
+
if (platform === Web) {
|
|
1797
|
+
return [];
|
|
1798
|
+
}
|
|
1799
|
+
// @ts-ignore
|
|
1800
|
+
return getAllExtensions$1();
|
|
1801
|
+
};
|
|
1802
|
+
const getExtension$1 = async (id, platform) => {
|
|
1803
|
+
// TODO only ask one extension from renderer worker instead of all
|
|
1804
|
+
const allExtensions = await getAllExtensions(platform);
|
|
1805
|
+
for (const extension of allExtensions) {
|
|
1806
|
+
if (extension.id === id) {
|
|
1807
|
+
return extension;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
return undefined;
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
const getExtensionNew = async id => {
|
|
1814
|
+
return getExtension$2(id);
|
|
1815
|
+
};
|
|
1816
|
+
const getExtension = async (id, platform) => {
|
|
1817
|
+
try {
|
|
1818
|
+
return await getExtensionNew(id);
|
|
1819
|
+
} catch {
|
|
1820
|
+
return getExtension$1(id, platform);
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
const getRemoteSrc = uri => {
|
|
1825
|
+
const src = `/remote${uri}`;
|
|
1826
|
+
return src;
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
const getBaseUrl = (extensionPath, platform) => {
|
|
1830
|
+
switch (platform) {
|
|
1831
|
+
case Remote:
|
|
1832
|
+
case Electron:
|
|
1833
|
+
return getRemoteSrc(extensionPath + '/');
|
|
1834
|
+
default:
|
|
1835
|
+
return extensionPath;
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1839
|
+
const getCategories = () => {
|
|
1840
|
+
return [{
|
|
1841
|
+
id: 'themes',
|
|
1842
|
+
label: 'Themes'
|
|
1843
|
+
}];
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1847
|
+
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
1848
|
+
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
1849
|
+
const BIBIT_UNITS = ['b', 'kibit', 'Mibit', 'Gibit', 'Tibit', 'Pibit', 'Eibit', 'Zibit', 'Yibit'];
|
|
1850
|
+
|
|
1851
|
+
/*
|
|
1852
|
+
Formats the given number using `Number#toLocaleString`.
|
|
1853
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
1854
|
+
- If locale is true, the system default locale is used for translation.
|
|
1855
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
1856
|
+
*/
|
|
1857
|
+
const toLocaleString = (number, locale, options) => {
|
|
1858
|
+
let result = number;
|
|
1859
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
1860
|
+
result = number.toLocaleString(locale, options);
|
|
1861
|
+
} else if (locale === true || options !== undefined) {
|
|
1862
|
+
result = number.toLocaleString(undefined, options);
|
|
1863
|
+
}
|
|
1864
|
+
return result;
|
|
1865
|
+
};
|
|
1866
|
+
const log10 = numberOrBigInt => {
|
|
1867
|
+
if (typeof numberOrBigInt === 'number') {
|
|
1868
|
+
return Math.log10(numberOrBigInt);
|
|
1869
|
+
}
|
|
1870
|
+
const string = numberOrBigInt.toString(10);
|
|
1871
|
+
return string.length + Math.log10('0.' + string.slice(0, 15));
|
|
1872
|
+
};
|
|
1873
|
+
const log = numberOrBigInt => {
|
|
1874
|
+
if (typeof numberOrBigInt === 'number') {
|
|
1875
|
+
return Math.log(numberOrBigInt);
|
|
1876
|
+
}
|
|
1877
|
+
return log10(numberOrBigInt) * Math.log(10);
|
|
1878
|
+
};
|
|
1879
|
+
const divide = (numberOrBigInt, divisor) => {
|
|
1880
|
+
if (typeof numberOrBigInt === 'number') {
|
|
1881
|
+
return numberOrBigInt / divisor;
|
|
1882
|
+
}
|
|
1883
|
+
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
1884
|
+
const remainder = numberOrBigInt % BigInt(divisor);
|
|
1885
|
+
return Number(integerPart) + Number(remainder) / divisor;
|
|
1886
|
+
};
|
|
1887
|
+
function prettyBytes(number, options) {
|
|
1888
|
+
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
1889
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
1890
|
+
}
|
|
1891
|
+
options = {
|
|
1892
|
+
bits: false,
|
|
1893
|
+
binary: false,
|
|
1894
|
+
space: true,
|
|
1895
|
+
...options
|
|
1896
|
+
};
|
|
1897
|
+
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
1898
|
+
const separator = options.space ? ' ' : '';
|
|
1899
|
+
if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
|
|
1900
|
+
return ` 0${separator}${UNITS[0]}`;
|
|
1901
|
+
}
|
|
1902
|
+
const isNegative = number < 0;
|
|
1903
|
+
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
1904
|
+
if (isNegative) {
|
|
1905
|
+
number = -number;
|
|
1906
|
+
}
|
|
1907
|
+
let localeOptions;
|
|
1908
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
1909
|
+
localeOptions = {
|
|
1910
|
+
minimumFractionDigits: options.minimumFractionDigits
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
1914
|
+
localeOptions = {
|
|
1915
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
1916
|
+
...localeOptions
|
|
1917
|
+
};
|
|
1670
1918
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
const getExtension$1 = async (id, platform) => {
|
|
1675
|
-
// TODO only ask one extension from renderer worker instead of all
|
|
1676
|
-
const allExtensions = await getAllExtensions(platform);
|
|
1677
|
-
for (const extension of allExtensions) {
|
|
1678
|
-
if (extension.id === id) {
|
|
1679
|
-
return extension;
|
|
1680
|
-
}
|
|
1919
|
+
if (number < 1) {
|
|
1920
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
1921
|
+
return prefix + numberString + separator + UNITS[0];
|
|
1681
1922
|
}
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
return getExtension$2(id);
|
|
1687
|
-
};
|
|
1688
|
-
const getExtension = async (id, platform) => {
|
|
1689
|
-
try {
|
|
1690
|
-
return await getExtensionNew(id);
|
|
1691
|
-
} catch {
|
|
1692
|
-
return getExtension$1(id, platform);
|
|
1923
|
+
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
1924
|
+
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
1925
|
+
if (!localeOptions) {
|
|
1926
|
+
number = number.toPrecision(3);
|
|
1693
1927
|
}
|
|
1694
|
-
|
|
1928
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
1929
|
+
const unit = UNITS[exponent];
|
|
1930
|
+
return prefix + numberString + separator + unit;
|
|
1931
|
+
}
|
|
1695
1932
|
|
|
1696
|
-
const
|
|
1697
|
-
return
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
}];
|
|
1933
|
+
const getDisplaySize = size => {
|
|
1934
|
+
return prettyBytes(size, {
|
|
1935
|
+
maximumFractionDigits: 1
|
|
1936
|
+
});
|
|
1701
1937
|
};
|
|
1702
1938
|
|
|
1703
1939
|
const getEntries = () => {
|
|
@@ -1811,6 +2047,10 @@ const getViewletSize = width => {
|
|
|
1811
2047
|
return Large$1;
|
|
1812
2048
|
};
|
|
1813
2049
|
|
|
2050
|
+
const hasColorThemes = extension => {
|
|
2051
|
+
return Boolean(extension && extension.colorThemes && extension.colorThemes.length > 0);
|
|
2052
|
+
};
|
|
2053
|
+
|
|
1814
2054
|
const getSavedSelectedFeature = savedState => {
|
|
1815
2055
|
if (savedState && typeof savedState === 'object' && 'selectedFeature' in savedState && typeof savedState.selectedFeature === 'string') {
|
|
1816
2056
|
return savedState.selectedFeature;
|
|
@@ -1850,8 +2090,7 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1850
2090
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
1851
2091
|
baseUrl
|
|
1852
2092
|
});
|
|
1853
|
-
const
|
|
1854
|
-
const normalizedReadmeHtml = sanitizedReadmeHtml;
|
|
2093
|
+
const detailsVirtualDom = await getMarkdownVirtualDom(readmeHtml);
|
|
1855
2094
|
const iconSrc = getIcon(extension, platform, assetDir);
|
|
1856
2095
|
const description = getDescription(extension);
|
|
1857
2096
|
const name = getName(extension);
|
|
@@ -1863,26 +2102,38 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1863
2102
|
const features = getFeatures(selectedFeature, extension);
|
|
1864
2103
|
const extensionUri = extension.uri || extension.path;
|
|
1865
2104
|
const folderSize = await getFolderSize(extensionUri);
|
|
2105
|
+
const displaySize = getDisplaySize(size);
|
|
1866
2106
|
const entries = getEntries();
|
|
1867
2107
|
const secondEntries = getSecondEntries();
|
|
1868
2108
|
const categories = getCategories();
|
|
1869
2109
|
const resources = getResources();
|
|
2110
|
+
const sizeValue = getViewletSize(width || 0);
|
|
2111
|
+
const isBuiltin = extension?.builtin;
|
|
2112
|
+
const hasColorTheme = hasColorThemes(extension);
|
|
2113
|
+
const extensionId = extension?.id || 'n/a';
|
|
2114
|
+
const extensionVersion = extension?.version || 'n/a';
|
|
1870
2115
|
return {
|
|
1871
2116
|
...state,
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
iconSrc,
|
|
1875
|
-
name,
|
|
2117
|
+
baseUrl,
|
|
2118
|
+
categories,
|
|
1876
2119
|
description,
|
|
1877
|
-
|
|
2120
|
+
detailsVirtualDom,
|
|
2121
|
+
displaySize,
|
|
1878
2122
|
entries,
|
|
1879
|
-
secondEntries,
|
|
1880
|
-
categories,
|
|
1881
|
-
resources,
|
|
1882
2123
|
extension,
|
|
1883
|
-
baseUrl,
|
|
1884
2124
|
features,
|
|
1885
|
-
folderSize
|
|
2125
|
+
folderSize,
|
|
2126
|
+
hasColorTheme,
|
|
2127
|
+
iconSrc,
|
|
2128
|
+
isBuiltin,
|
|
2129
|
+
name,
|
|
2130
|
+
resources,
|
|
2131
|
+
secondEntries,
|
|
2132
|
+
selectedTab,
|
|
2133
|
+
sizeOnDisk: size,
|
|
2134
|
+
sizeValue,
|
|
2135
|
+
extensionId,
|
|
2136
|
+
extensionVersion
|
|
1886
2137
|
};
|
|
1887
2138
|
};
|
|
1888
2139
|
|
|
@@ -1900,21 +2151,27 @@ const Span = 8;
|
|
|
1900
2151
|
const Table$1 = 9;
|
|
1901
2152
|
const TBody = 10;
|
|
1902
2153
|
const Td = 11;
|
|
1903
|
-
const Text
|
|
2154
|
+
const Text = 12;
|
|
1904
2155
|
const Th = 13;
|
|
1905
2156
|
const THead = 14;
|
|
1906
2157
|
const Tr = 15;
|
|
1907
2158
|
const Img = 17;
|
|
1908
2159
|
const H2 = 22;
|
|
2160
|
+
const Dd = 43;
|
|
2161
|
+
const Dl = 44;
|
|
1909
2162
|
const Pre = 51;
|
|
1910
2163
|
const A = 53;
|
|
1911
|
-
const Code$
|
|
2164
|
+
const Code$1 = 65;
|
|
2165
|
+
const Dt = 67;
|
|
1912
2166
|
const VirtualDomElements = {
|
|
1913
2167
|
__proto__: null,
|
|
1914
2168
|
A,
|
|
1915
2169
|
Button: Button$1,
|
|
1916
|
-
Code: Code$
|
|
2170
|
+
Code: Code$1,
|
|
2171
|
+
Dd,
|
|
1917
2172
|
Div,
|
|
2173
|
+
Dl,
|
|
2174
|
+
Dt,
|
|
1918
2175
|
H1,
|
|
1919
2176
|
H2,
|
|
1920
2177
|
Img,
|
|
@@ -1928,7 +2185,7 @@ const VirtualDomElements = {
|
|
|
1928
2185
|
Tr};
|
|
1929
2186
|
const text = data => {
|
|
1930
2187
|
return {
|
|
1931
|
-
type: Text
|
|
2188
|
+
type: Text,
|
|
1932
2189
|
text: data,
|
|
1933
2190
|
childCount: 0
|
|
1934
2191
|
};
|
|
@@ -1943,7 +2200,7 @@ const ButtonPrimary = 'ButtonPrimary';
|
|
|
1943
2200
|
const Categories = 'Categories';
|
|
1944
2201
|
const Category = 'Category';
|
|
1945
2202
|
const Changelog = 'Changelog';
|
|
1946
|
-
const Code
|
|
2203
|
+
const Code = 'Code';
|
|
1947
2204
|
const DefaultMarkdown = 'DefaultMarkdown';
|
|
1948
2205
|
const DefinitionListItem = 'DefinitionListItem';
|
|
1949
2206
|
const DefinitionListItemHeading = 'DefinitionListItemHeading';
|
|
@@ -1986,106 +2243,13 @@ const TableCell = 'TableCell';
|
|
|
1986
2243
|
const TableHeading = 'TableHeading';
|
|
1987
2244
|
const Viewlet = 'Viewlet';
|
|
1988
2245
|
|
|
1989
|
-
const getBadge = (
|
|
1990
|
-
if (
|
|
2246
|
+
const getBadge = (builtin, badgeEnabled) => {
|
|
2247
|
+
if (builtin && badgeEnabled) {
|
|
1991
2248
|
return 'builtin';
|
|
1992
2249
|
}
|
|
1993
2250
|
return '';
|
|
1994
2251
|
};
|
|
1995
2252
|
|
|
1996
|
-
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1997
|
-
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
1998
|
-
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
1999
|
-
const BIBIT_UNITS = ['b', 'kibit', 'Mibit', 'Gibit', 'Tibit', 'Pibit', 'Eibit', 'Zibit', 'Yibit'];
|
|
2000
|
-
|
|
2001
|
-
/*
|
|
2002
|
-
Formats the given number using `Number#toLocaleString`.
|
|
2003
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
2004
|
-
- If locale is true, the system default locale is used for translation.
|
|
2005
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
2006
|
-
*/
|
|
2007
|
-
const toLocaleString = (number, locale, options) => {
|
|
2008
|
-
let result = number;
|
|
2009
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
2010
|
-
result = number.toLocaleString(locale, options);
|
|
2011
|
-
} else if (locale === true || options !== undefined) {
|
|
2012
|
-
result = number.toLocaleString(undefined, options);
|
|
2013
|
-
}
|
|
2014
|
-
return result;
|
|
2015
|
-
};
|
|
2016
|
-
const log10 = numberOrBigInt => {
|
|
2017
|
-
if (typeof numberOrBigInt === 'number') {
|
|
2018
|
-
return Math.log10(numberOrBigInt);
|
|
2019
|
-
}
|
|
2020
|
-
const string = numberOrBigInt.toString(10);
|
|
2021
|
-
return string.length + Math.log10('0.' + string.slice(0, 15));
|
|
2022
|
-
};
|
|
2023
|
-
const log = numberOrBigInt => {
|
|
2024
|
-
if (typeof numberOrBigInt === 'number') {
|
|
2025
|
-
return Math.log(numberOrBigInt);
|
|
2026
|
-
}
|
|
2027
|
-
return log10(numberOrBigInt) * Math.log(10);
|
|
2028
|
-
};
|
|
2029
|
-
const divide = (numberOrBigInt, divisor) => {
|
|
2030
|
-
if (typeof numberOrBigInt === 'number') {
|
|
2031
|
-
return numberOrBigInt / divisor;
|
|
2032
|
-
}
|
|
2033
|
-
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
2034
|
-
const remainder = numberOrBigInt % BigInt(divisor);
|
|
2035
|
-
return Number(integerPart) + Number(remainder) / divisor;
|
|
2036
|
-
};
|
|
2037
|
-
function prettyBytes(number, options) {
|
|
2038
|
-
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
2039
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
2040
|
-
}
|
|
2041
|
-
options = {
|
|
2042
|
-
bits: false,
|
|
2043
|
-
binary: false,
|
|
2044
|
-
space: true,
|
|
2045
|
-
...options
|
|
2046
|
-
};
|
|
2047
|
-
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
2048
|
-
const separator = options.space ? ' ' : '';
|
|
2049
|
-
if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
|
|
2050
|
-
return ` 0${separator}${UNITS[0]}`;
|
|
2051
|
-
}
|
|
2052
|
-
const isNegative = number < 0;
|
|
2053
|
-
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
2054
|
-
if (isNegative) {
|
|
2055
|
-
number = -number;
|
|
2056
|
-
}
|
|
2057
|
-
let localeOptions;
|
|
2058
|
-
if (options.minimumFractionDigits !== undefined) {
|
|
2059
|
-
localeOptions = {
|
|
2060
|
-
minimumFractionDigits: options.minimumFractionDigits
|
|
2061
|
-
};
|
|
2062
|
-
}
|
|
2063
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
2064
|
-
localeOptions = {
|
|
2065
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
|
2066
|
-
...localeOptions
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
if (number < 1) {
|
|
2070
|
-
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
2071
|
-
return prefix + numberString + separator + UNITS[0];
|
|
2072
|
-
}
|
|
2073
|
-
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
2074
|
-
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
2075
|
-
if (!localeOptions) {
|
|
2076
|
-
number = number.toPrecision(3);
|
|
2077
|
-
}
|
|
2078
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
2079
|
-
const unit = UNITS[exponent];
|
|
2080
|
-
return prefix + numberString + separator + unit;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
const getDisplaySize = size => {
|
|
2084
|
-
return prettyBytes(size, {
|
|
2085
|
-
maximumFractionDigits: 1
|
|
2086
|
-
});
|
|
2087
|
-
};
|
|
2088
|
-
|
|
2089
2253
|
const HandleClickCategory = 'handleClickCategory';
|
|
2090
2254
|
const HandleClickDisable = 'handleClickDisable';
|
|
2091
2255
|
const HandleClickScrollToTop = 'handleClickScrollToTop';
|
|
@@ -2099,15 +2263,11 @@ const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
|
2099
2263
|
const HandleReadmeWheel = 'handleReadmeWheel';
|
|
2100
2264
|
const HandleTabsClick = 'handleTabsClick';
|
|
2101
2265
|
|
|
2102
|
-
const
|
|
2103
|
-
return Boolean(extension && extension.colorThemes && extension.colorThemes.length > 0);
|
|
2104
|
-
};
|
|
2105
|
-
|
|
2106
|
-
const getExtensionDetailButtons = extension => {
|
|
2266
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin) => {
|
|
2107
2267
|
const allActions = [{
|
|
2108
2268
|
label: setColorTheme$3(),
|
|
2109
2269
|
onClick: HandleClickSetColorTheme,
|
|
2110
|
-
enabled:
|
|
2270
|
+
enabled: hasColorTheme,
|
|
2111
2271
|
name: SetColorTheme
|
|
2112
2272
|
}, {
|
|
2113
2273
|
label: disable(),
|
|
@@ -2117,7 +2277,7 @@ const getExtensionDetailButtons = extension => {
|
|
|
2117
2277
|
}, {
|
|
2118
2278
|
label: uninstall(),
|
|
2119
2279
|
onClick: HandleClickUninstall,
|
|
2120
|
-
enabled: !
|
|
2280
|
+
enabled: !isBuiltin,
|
|
2121
2281
|
name: Uninstall
|
|
2122
2282
|
}];
|
|
2123
2283
|
return allActions;
|
|
@@ -2172,7 +2332,7 @@ const getCategoriesDom = categories => {
|
|
|
2172
2332
|
};
|
|
2173
2333
|
|
|
2174
2334
|
const parentNode$1 = {
|
|
2175
|
-
type: VirtualDomElements.
|
|
2335
|
+
type: VirtualDomElements.Dt,
|
|
2176
2336
|
className: MoreInfoEntryKey,
|
|
2177
2337
|
childCount: 1
|
|
2178
2338
|
};
|
|
@@ -2190,14 +2350,14 @@ const getTag = (onClick, code) => {
|
|
|
2190
2350
|
if (code) {
|
|
2191
2351
|
return VirtualDomElements.Code;
|
|
2192
2352
|
}
|
|
2193
|
-
return VirtualDomElements.
|
|
2353
|
+
return VirtualDomElements.Dd;
|
|
2194
2354
|
};
|
|
2195
2355
|
const getClassName = (onClick, code) => {
|
|
2196
2356
|
if (onClick) {
|
|
2197
2357
|
return mergeClassNames(MoreInfoEntryValue, Link);
|
|
2198
2358
|
}
|
|
2199
2359
|
if (code) {
|
|
2200
|
-
return mergeClassNames(MoreInfoEntryValue, Code
|
|
2360
|
+
return mergeClassNames(MoreInfoEntryValue, Code);
|
|
2201
2361
|
}
|
|
2202
2362
|
return MoreInfoEntryValue;
|
|
2203
2363
|
};
|
|
@@ -2220,12 +2380,12 @@ const getMoreInfoEntryValueVirtualDom = item => {
|
|
|
2220
2380
|
};
|
|
2221
2381
|
|
|
2222
2382
|
const parentNodeEven = {
|
|
2223
|
-
type: VirtualDomElements.
|
|
2383
|
+
type: VirtualDomElements.Dt,
|
|
2224
2384
|
className: MoreInfoEntry,
|
|
2225
2385
|
childCount: 2
|
|
2226
2386
|
};
|
|
2227
2387
|
const parentNodeOdd = {
|
|
2228
|
-
type: VirtualDomElements.
|
|
2388
|
+
type: VirtualDomElements.Dt,
|
|
2229
2389
|
className: mergeClassNames(MoreInfoEntry, MoreInfoEntryOdd),
|
|
2230
2390
|
childCount: 2
|
|
2231
2391
|
};
|
|
@@ -2239,7 +2399,7 @@ const getMoreInfoEntryVirtualDom = item => {
|
|
|
2239
2399
|
|
|
2240
2400
|
const getMoreInfoVirtualDom = items => {
|
|
2241
2401
|
return [{
|
|
2242
|
-
type: VirtualDomElements.
|
|
2402
|
+
type: VirtualDomElements.Dl,
|
|
2243
2403
|
className: MoreInfo,
|
|
2244
2404
|
childCount: items.length
|
|
2245
2405
|
}, ...items.flatMap(getMoreInfoEntryVirtualDom)];
|
|
@@ -2340,7 +2500,8 @@ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
|
|
|
2340
2500
|
}
|
|
2341
2501
|
return count;
|
|
2342
2502
|
};
|
|
2343
|
-
const getDetailsVirtualDom =
|
|
2503
|
+
const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint // new parameter, no default
|
|
2504
|
+
) => {
|
|
2344
2505
|
const firstHeading = installation();
|
|
2345
2506
|
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
|
|
2346
2507
|
const secondHeading = marketplace();
|
|
@@ -2354,28 +2515,10 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
|
|
|
2354
2515
|
className: ExtensionDetailPanel,
|
|
2355
2516
|
childCount: childCount,
|
|
2356
2517
|
role: Panel
|
|
2357
|
-
}, ...getScrollToTopVirtualDom(scrollToTopButtonEnabled), ...
|
|
2518
|
+
}, ...getScrollToTopVirtualDom(scrollToTopButtonEnabled), ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
|
|
2358
2519
|
return dom;
|
|
2359
2520
|
};
|
|
2360
2521
|
|
|
2361
|
-
const Text = 1;
|
|
2362
|
-
const Code = 2;
|
|
2363
|
-
|
|
2364
|
-
const getCommandTableEntry = command => {
|
|
2365
|
-
// TODO watch out for command being null/undefined/number/string/array
|
|
2366
|
-
const {
|
|
2367
|
-
id,
|
|
2368
|
-
label
|
|
2369
|
-
} = command;
|
|
2370
|
-
return [{
|
|
2371
|
-
type: Code,
|
|
2372
|
-
value: id
|
|
2373
|
-
}, {
|
|
2374
|
-
type: Text,
|
|
2375
|
-
value: label
|
|
2376
|
-
}];
|
|
2377
|
-
};
|
|
2378
|
-
|
|
2379
2522
|
const getCommandTableEntries = extension => {
|
|
2380
2523
|
const commands = extension.commands || [];
|
|
2381
2524
|
const rows = commands.map(getCommandTableEntry);
|
|
@@ -2423,9 +2566,9 @@ const getCellTextVirtualDom = value => {
|
|
|
2423
2566
|
|
|
2424
2567
|
const getCellRenderer = type => {
|
|
2425
2568
|
switch (type) {
|
|
2426
|
-
case Code:
|
|
2569
|
+
case Code$2:
|
|
2427
2570
|
return getCellCodeVirtualDom;
|
|
2428
|
-
case Text:
|
|
2571
|
+
case Text$1:
|
|
2429
2572
|
return getCellTextVirtualDom;
|
|
2430
2573
|
default:
|
|
2431
2574
|
throw new Error(`unexpected cell type ${type}`);
|
|
@@ -2480,20 +2623,6 @@ const getFeatureCommandsVirtualDom = extension => {
|
|
|
2480
2623
|
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
2481
2624
|
};
|
|
2482
2625
|
|
|
2483
|
-
const getJsonValidationTableEntry = validation => {
|
|
2484
|
-
const {
|
|
2485
|
-
fileMatch,
|
|
2486
|
-
schema
|
|
2487
|
-
} = validation;
|
|
2488
|
-
return [{
|
|
2489
|
-
type: Code,
|
|
2490
|
-
value: fileMatch
|
|
2491
|
-
}, {
|
|
2492
|
-
type: Code,
|
|
2493
|
-
value: schema
|
|
2494
|
-
}];
|
|
2495
|
-
};
|
|
2496
|
-
|
|
2497
2626
|
const getJsonValidationTableEntries = extension => {
|
|
2498
2627
|
const validations = extension.jsonValidation || [];
|
|
2499
2628
|
const rows = validations.map(getJsonValidationTableEntry);
|
|
@@ -2536,21 +2665,6 @@ const getFeatureProgrammingLanguagesVirtualDom = () => {
|
|
|
2536
2665
|
}, ...getFeatureContentHeadingVirtualDom(heading)];
|
|
2537
2666
|
};
|
|
2538
2667
|
|
|
2539
|
-
const getSettingsTableEntry = setting => {
|
|
2540
|
-
const {
|
|
2541
|
-
id,
|
|
2542
|
-
label
|
|
2543
|
-
} = setting;
|
|
2544
|
-
// TODO watch out for null/undefined/number/string/array
|
|
2545
|
-
return [{
|
|
2546
|
-
type: Text,
|
|
2547
|
-
value: id
|
|
2548
|
-
}, {
|
|
2549
|
-
type: Text,
|
|
2550
|
-
value: label
|
|
2551
|
-
}];
|
|
2552
|
-
};
|
|
2553
|
-
|
|
2554
2668
|
const getSettingsTableEntries = extension => {
|
|
2555
2669
|
const settings = extension.settings || [];
|
|
2556
2670
|
const rows = settings.map(getSettingsTableEntry);
|
|
@@ -2585,7 +2699,7 @@ const getVirtualDomChildCount = dom => {
|
|
|
2585
2699
|
return stack.length;
|
|
2586
2700
|
};
|
|
2587
2701
|
|
|
2588
|
-
const getFeatureThemesVirtualDom =
|
|
2702
|
+
const getFeatureThemesVirtualDom = themesDom => {
|
|
2589
2703
|
const childCount = getVirtualDomChildCount(themesDom);
|
|
2590
2704
|
const heading = theme();
|
|
2591
2705
|
return [{
|
|
@@ -2599,26 +2713,6 @@ const getFeatureThemesVirtualDom = async themesDom => {
|
|
|
2599
2713
|
}, ...themesDom];
|
|
2600
2714
|
};
|
|
2601
2715
|
|
|
2602
|
-
const toWebView = rawWebView => {
|
|
2603
|
-
const {
|
|
2604
|
-
id,
|
|
2605
|
-
selector,
|
|
2606
|
-
contentSecurityPolicy,
|
|
2607
|
-
elements
|
|
2608
|
-
} = rawWebView;
|
|
2609
|
-
return {
|
|
2610
|
-
id,
|
|
2611
|
-
selectorString: JSON.stringify(selector),
|
|
2612
|
-
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
2613
|
-
elementsString: JSON.stringify(elements, null, 2)
|
|
2614
|
-
};
|
|
2615
|
-
};
|
|
2616
|
-
|
|
2617
|
-
const getWebViews = extension => {
|
|
2618
|
-
const rawWebViews = extension.webViews || [];
|
|
2619
|
-
return rawWebViews.map(toWebView);
|
|
2620
|
-
};
|
|
2621
|
-
|
|
2622
2716
|
const heading = {
|
|
2623
2717
|
type: VirtualDomElements.H2,
|
|
2624
2718
|
className: DefinitionListItemHeading,
|
|
@@ -2665,10 +2759,10 @@ const getFeatureWebViewsVirtualDom = extension => {
|
|
|
2665
2759
|
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
2666
2760
|
};
|
|
2667
2761
|
|
|
2668
|
-
const getFeatureContentVirtualDom =
|
|
2762
|
+
const getFeatureContentVirtualDom = (features, themesDom, selectedFeature, extension) => {
|
|
2669
2763
|
switch (selectedFeature) {
|
|
2670
2764
|
case Theme:
|
|
2671
|
-
return
|
|
2765
|
+
return getFeatureThemesVirtualDom(themesDom);
|
|
2672
2766
|
case Commands:
|
|
2673
2767
|
return getFeatureCommandsVirtualDom(extension);
|
|
2674
2768
|
case JsonValidation:
|
|
@@ -2710,7 +2804,7 @@ const getFeatureListVirtualDom = features => {
|
|
|
2710
2804
|
}, ...features.flatMap(getFeatureListItemVirtualDom)];
|
|
2711
2805
|
};
|
|
2712
2806
|
|
|
2713
|
-
const getFeaturesVirtualDom =
|
|
2807
|
+
const getFeaturesVirtualDom = (features, themesDom, selectedFeature, extension) => {
|
|
2714
2808
|
if (features.length === 0) {
|
|
2715
2809
|
const none$1 = none();
|
|
2716
2810
|
return [{
|
|
@@ -2727,15 +2821,15 @@ const getFeaturesVirtualDom = async (features, themesDom, selectedFeature, exten
|
|
|
2727
2821
|
type: VirtualDomElements.Div,
|
|
2728
2822
|
className: mergeClassNames(Sash, SashVertical),
|
|
2729
2823
|
childCount: 0
|
|
2730
|
-
}, ...
|
|
2824
|
+
}, ...getFeatureContentVirtualDom(features, themesDom, selectedFeature, extension)];
|
|
2731
2825
|
};
|
|
2732
2826
|
|
|
2733
|
-
const getExtensionDetailContentVirtualDom =
|
|
2827
|
+
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled, categories, resources, breakpoint) => {
|
|
2734
2828
|
switch (selectedTab) {
|
|
2735
2829
|
case Details:
|
|
2736
|
-
return
|
|
2830
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled, categories, resources, breakpoint);
|
|
2737
2831
|
case Features$1:
|
|
2738
|
-
return
|
|
2832
|
+
return getFeaturesVirtualDom(features, themesDom, selectedFeature, extension);
|
|
2739
2833
|
case Changelog$1:
|
|
2740
2834
|
return getChangelogVirtualDom();
|
|
2741
2835
|
default:
|
|
@@ -2897,48 +2991,53 @@ const getClassNames = size => {
|
|
|
2897
2991
|
}
|
|
2898
2992
|
};
|
|
2899
2993
|
|
|
2900
|
-
const getExtensionDetailVirtualDom =
|
|
2994
|
+
const getExtensionDetailVirtualDom = (newState, selectedTab) => {
|
|
2901
2995
|
// TODO move this to view model so that rendering occurs like
|
|
2902
2996
|
// 1. state
|
|
2903
2997
|
// 2. view model
|
|
2904
2998
|
// 3. virtual dom
|
|
2905
2999
|
// 4. dom
|
|
2906
|
-
const themesHtml = newState.themesMarkdownDom;
|
|
2907
|
-
const selectedFeature = newState?.selectedFeature || '';
|
|
2908
|
-
const extension = newState?.extension || {};
|
|
2909
|
-
const features = getFeatures(selectedFeature, extension);
|
|
2910
|
-
const size = newState.folderSize || 0;
|
|
2911
|
-
const extensionId = newState?.extension?.id || 'n/a';
|
|
2912
|
-
const extensionVersion = newState?.extension?.version || 'n/a';
|
|
2913
|
-
const displaySize = getDisplaySize(size);
|
|
2914
|
-
const width = newState?.width || 500;
|
|
2915
|
-
const tabs = getTabs(selectedTab);
|
|
2916
|
-
const sizeValue = getViewletSize(newState?.width || 0);
|
|
2917
|
-
const sizeClass = getClassNames(sizeValue);
|
|
2918
|
-
const buttonDefs = getExtensionDetailButtons(extension);
|
|
2919
3000
|
const {
|
|
3001
|
+
displaySize,
|
|
3002
|
+
themesMarkdownDom,
|
|
3003
|
+
selectedFeature,
|
|
3004
|
+
extension,
|
|
3005
|
+
sizeValue,
|
|
3006
|
+
isBuiltin,
|
|
3007
|
+
categories,
|
|
3008
|
+
resources,
|
|
3009
|
+
showAdditionalDetailsBreakpoint,
|
|
3010
|
+
scrollToTopButtonEnabled,
|
|
3011
|
+
hasColorTheme,
|
|
3012
|
+
builtinExtensionsBadgeEnabled,
|
|
3013
|
+
settingsButtonEnabled,
|
|
2920
3014
|
name,
|
|
2921
3015
|
iconSrc,
|
|
2922
|
-
description
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
3016
|
+
description,
|
|
3017
|
+
detailsVirtualDom,
|
|
3018
|
+
features,
|
|
3019
|
+
extensionId,
|
|
3020
|
+
extensionVersion
|
|
2927
3021
|
} = newState;
|
|
3022
|
+
const width = newState?.width || 500;
|
|
3023
|
+
const tabs = getTabs(selectedTab);
|
|
3024
|
+
const sizeClass = getClassNames(sizeValue);
|
|
3025
|
+
const buttonDefs = getExtensionDetailButtons(hasColorTheme, isBuiltin);
|
|
3026
|
+
const badge = getBadge(isBuiltin, builtinExtensionsBadgeEnabled); // TODO compute in loadContent
|
|
2928
3027
|
const dom = [{
|
|
2929
3028
|
type: VirtualDomElements.Div,
|
|
2930
3029
|
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
2931
3030
|
childCount: 3
|
|
2932
|
-
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...
|
|
3031
|
+
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(detailsVirtualDom, themesMarkdownDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled, categories, resources, showAdditionalDetailsBreakpoint)];
|
|
2933
3032
|
return dom;
|
|
2934
3033
|
};
|
|
2935
3034
|
|
|
2936
|
-
const renderDom =
|
|
2937
|
-
const dom =
|
|
3035
|
+
const renderDom = (oldState, newState) => {
|
|
3036
|
+
const dom = getExtensionDetailVirtualDom(newState, newState.selectedTab);
|
|
2938
3037
|
return ['Viewlet.setDom2', dom];
|
|
2939
3038
|
};
|
|
2940
3039
|
|
|
2941
|
-
const renderFocus =
|
|
3040
|
+
const renderFocus = (oldState, newState) => {
|
|
2942
3041
|
return ['Viewlet.focusElementByName', ''];
|
|
2943
3042
|
};
|
|
2944
3043
|
|
|
@@ -2953,22 +3052,22 @@ const getRenderer = diffType => {
|
|
|
2953
3052
|
}
|
|
2954
3053
|
};
|
|
2955
3054
|
|
|
2956
|
-
const applyRender =
|
|
3055
|
+
const applyRender = (oldState, newState, diffResult) => {
|
|
2957
3056
|
const commands = [];
|
|
2958
3057
|
for (const item of diffResult) {
|
|
2959
3058
|
const fn = getRenderer(item);
|
|
2960
|
-
commands.push(
|
|
3059
|
+
commands.push(fn(oldState, newState));
|
|
2961
3060
|
}
|
|
2962
3061
|
return commands;
|
|
2963
3062
|
};
|
|
2964
3063
|
|
|
2965
|
-
const render2 =
|
|
3064
|
+
const render2 = (uid, diffResult) => {
|
|
2966
3065
|
const {
|
|
2967
3066
|
oldState,
|
|
2968
3067
|
newState
|
|
2969
3068
|
} = get$1(uid);
|
|
2970
3069
|
set$1(uid, oldState, newState);
|
|
2971
|
-
const commands =
|
|
3070
|
+
const commands = applyRender(oldState, newState, diffResult);
|
|
2972
3071
|
return commands;
|
|
2973
3072
|
};
|
|
2974
3073
|
|