@lvce-editor/extension-detail-view 3.33.0 → 3.35.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 +317 -233
- package/package.json +1 -1
|
@@ -945,36 +945,44 @@ 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: [],
|
|
954
956
|
displaySize: '',
|
|
955
957
|
entries: [],
|
|
956
958
|
extension: {},
|
|
959
|
+
extensionId: '',
|
|
960
|
+
extensionVersion: '',
|
|
957
961
|
features: [],
|
|
958
962
|
featuresVirtualDom: [],
|
|
959
963
|
folderSize: 0,
|
|
964
|
+
hasColorTheme: false,
|
|
960
965
|
iconSrc: '',
|
|
966
|
+
isBuiltin: false,
|
|
967
|
+
jsonValidation: [],
|
|
961
968
|
name: '',
|
|
962
969
|
platform,
|
|
970
|
+
programmingLanguages: [],
|
|
963
971
|
readmeScrollTop: 0,
|
|
964
972
|
resources: [],
|
|
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,
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
isBuiltin: false,
|
|
977
|
-
sizeValue: 0
|
|
984
|
+
webViews: [],
|
|
985
|
+
width
|
|
978
986
|
};
|
|
979
987
|
set$1(uid, state, state);
|
|
980
988
|
};
|
|
@@ -1206,40 +1214,80 @@ const handleClickDisable = async state => {
|
|
|
1206
1214
|
return state;
|
|
1207
1215
|
};
|
|
1208
1216
|
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
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
|
|
1213
1222
|
const {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
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);
|
|
1228
1238
|
return {
|
|
1229
|
-
|
|
1230
|
-
selectedFeature: name,
|
|
1231
|
-
features: newFeatures
|
|
1239
|
+
commands: rows
|
|
1232
1240
|
};
|
|
1233
1241
|
};
|
|
1234
1242
|
|
|
1235
|
-
const
|
|
1236
|
-
|
|
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
|
+
}];
|
|
1237
1255
|
};
|
|
1238
1256
|
|
|
1239
|
-
const
|
|
1257
|
+
const getFeatureDetailsJsonValidation = extension => {
|
|
1258
|
+
const validations = extension.jsonValidation || [];
|
|
1259
|
+
const rows = validations.map(getJsonValidationTableEntry);
|
|
1240
1260
|
return {
|
|
1241
|
-
|
|
1242
|
-
|
|
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
|
|
1243
1291
|
};
|
|
1244
1292
|
};
|
|
1245
1293
|
|
|
@@ -1333,6 +1381,168 @@ const {
|
|
|
1333
1381
|
set,
|
|
1334
1382
|
setColorTheme: setColorTheme$1} = RendererWorker;
|
|
1335
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 Disable = 'Disable';
|
|
1476
|
+
const Features$1 = 'Features';
|
|
1477
|
+
const JsonValidation = 'JsonValidation';
|
|
1478
|
+
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1479
|
+
const SetColorTheme = 'SetColorTheme';
|
|
1480
|
+
const Settings = 'Settings';
|
|
1481
|
+
const Theme = 'Theme';
|
|
1482
|
+
const Uninstall = 'Uninstall';
|
|
1483
|
+
const WebViews = 'WebViews';
|
|
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
|
+
|
|
1336
1546
|
const setColorTheme = id => {
|
|
1337
1547
|
return setColorTheme$1(id);
|
|
1338
1548
|
};
|
|
@@ -1396,25 +1606,6 @@ const handleIconError = state => {
|
|
|
1396
1606
|
};
|
|
1397
1607
|
};
|
|
1398
1608
|
|
|
1399
|
-
const Changelog$1 = 'Changelog';
|
|
1400
|
-
const Commands = 'Commands';
|
|
1401
|
-
const Details = 'Details';
|
|
1402
|
-
const Features$1 = 'Features';
|
|
1403
|
-
const JsonValidation = 'JsonValidation';
|
|
1404
|
-
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1405
|
-
const Settings = 'Settings';
|
|
1406
|
-
const WebViews = 'WebViews';
|
|
1407
|
-
const Theme = 'Theme';
|
|
1408
|
-
const SetColorTheme = 'SetColorTheme';
|
|
1409
|
-
const Disable = 'Disable';
|
|
1410
|
-
const Uninstall = 'Uninstall';
|
|
1411
|
-
|
|
1412
|
-
const getMarkdownVirtualDom = async html => {
|
|
1413
|
-
string(html);
|
|
1414
|
-
const dom = await getMarkdownDom(html);
|
|
1415
|
-
return dom;
|
|
1416
|
-
};
|
|
1417
|
-
|
|
1418
1609
|
const readFile = async uri => {
|
|
1419
1610
|
return readFile$1(uri);
|
|
1420
1611
|
};
|
|
@@ -1445,11 +1636,6 @@ const loadChangelogContent = async path => {
|
|
|
1445
1636
|
}
|
|
1446
1637
|
};
|
|
1447
1638
|
|
|
1448
|
-
const renderMarkdown = async (markdown, options = {}) => {
|
|
1449
|
-
const html = await renderMarkdown$1(markdown, options);
|
|
1450
|
-
return html;
|
|
1451
|
-
};
|
|
1452
|
-
|
|
1453
1639
|
const selectTabChangelog = async state => {
|
|
1454
1640
|
const {
|
|
1455
1641
|
extension,
|
|
@@ -1504,64 +1690,19 @@ const selectTabDetails = async state => {
|
|
|
1504
1690
|
};
|
|
1505
1691
|
};
|
|
1506
1692
|
|
|
1507
|
-
const getThemeItemMarkdown = (heading, items) => {
|
|
1508
|
-
let markdown = '';
|
|
1509
|
-
if (items.length > 0) {
|
|
1510
|
-
markdown += `### ${heading}`;
|
|
1511
|
-
markdown += '\n\n';
|
|
1512
|
-
for (const item of items) {
|
|
1513
|
-
markdown += `- ${item.label}`;
|
|
1514
|
-
markdown += '\n';
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
return markdown;
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
const getColorThemeMarkdown = themes => {
|
|
1521
|
-
const heading = 'Color Themes';
|
|
1522
|
-
return getThemeItemMarkdown(heading, themes);
|
|
1523
|
-
};
|
|
1524
|
-
const getIconThemeMarkdown = iconThemes => {
|
|
1525
|
-
const heading = 'File Icon Themes';
|
|
1526
|
-
return getThemeItemMarkdown(heading, iconThemes);
|
|
1527
|
-
};
|
|
1528
|
-
const getProductIconThemeMarkdown = iconThemes => {
|
|
1529
|
-
const heading = 'Product Icon Themes';
|
|
1530
|
-
return getThemeItemMarkdown(heading, iconThemes);
|
|
1531
|
-
};
|
|
1532
|
-
const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
|
|
1533
|
-
let markdown = '';
|
|
1534
|
-
markdown += getColorThemeMarkdown(themes);
|
|
1535
|
-
markdown += getIconThemeMarkdown(iconThemes);
|
|
1536
|
-
markdown += getProductIconThemeMarkdown(productIconThemes);
|
|
1537
|
-
return markdown;
|
|
1538
|
-
};
|
|
1539
|
-
|
|
1540
1693
|
const selectTabFeatures = async state => {
|
|
1541
1694
|
const {
|
|
1542
1695
|
extension,
|
|
1543
1696
|
baseUrl,
|
|
1544
1697
|
selectedFeature
|
|
1545
1698
|
} = state;
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
if (!selectedFeature || selectedFeature === Theme) {
|
|
1550
|
-
const {
|
|
1551
|
-
colorThemes,
|
|
1552
|
-
iconThemes,
|
|
1553
|
-
productIconThemes
|
|
1554
|
-
} = extension;
|
|
1555
|
-
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
1556
|
-
const rendered = await renderMarkdown(markdown, {
|
|
1557
|
-
baseUrl
|
|
1558
|
-
});
|
|
1559
|
-
themesMarkdownDom = await getMarkdownVirtualDom(rendered);
|
|
1560
|
-
}
|
|
1699
|
+
const actualSelectedFeature = selectedFeature || Theme;
|
|
1700
|
+
const fn = getFeatureDetailsHandler(actualSelectedFeature);
|
|
1701
|
+
const partialNewState = await fn(extension, baseUrl);
|
|
1561
1702
|
return {
|
|
1562
1703
|
...state,
|
|
1563
1704
|
selectedTab: Features$1,
|
|
1564
|
-
|
|
1705
|
+
...partialNewState
|
|
1565
1706
|
};
|
|
1566
1707
|
};
|
|
1567
1708
|
|
|
@@ -1969,6 +2110,8 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1969
2110
|
const sizeValue = getViewletSize(width || 0);
|
|
1970
2111
|
const isBuiltin = extension?.builtin;
|
|
1971
2112
|
const hasColorTheme = hasColorThemes(extension);
|
|
2113
|
+
const extensionId = extension?.id || 'n/a';
|
|
2114
|
+
const extensionVersion = extension?.version || 'n/a';
|
|
1972
2115
|
return {
|
|
1973
2116
|
...state,
|
|
1974
2117
|
baseUrl,
|
|
@@ -1988,7 +2131,9 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1988
2131
|
secondEntries,
|
|
1989
2132
|
selectedTab,
|
|
1990
2133
|
sizeOnDisk: size,
|
|
1991
|
-
sizeValue
|
|
2134
|
+
sizeValue,
|
|
2135
|
+
extensionId,
|
|
2136
|
+
extensionVersion
|
|
1992
2137
|
};
|
|
1993
2138
|
};
|
|
1994
2139
|
|
|
@@ -2006,21 +2151,27 @@ const Span = 8;
|
|
|
2006
2151
|
const Table$1 = 9;
|
|
2007
2152
|
const TBody = 10;
|
|
2008
2153
|
const Td = 11;
|
|
2009
|
-
const Text
|
|
2154
|
+
const Text = 12;
|
|
2010
2155
|
const Th = 13;
|
|
2011
2156
|
const THead = 14;
|
|
2012
2157
|
const Tr = 15;
|
|
2013
2158
|
const Img = 17;
|
|
2014
2159
|
const H2 = 22;
|
|
2160
|
+
const Dd = 43;
|
|
2161
|
+
const Dl = 44;
|
|
2015
2162
|
const Pre = 51;
|
|
2016
2163
|
const A = 53;
|
|
2017
|
-
const Code$
|
|
2164
|
+
const Code$1 = 65;
|
|
2165
|
+
const Dt = 67;
|
|
2018
2166
|
const VirtualDomElements = {
|
|
2019
2167
|
__proto__: null,
|
|
2020
2168
|
A,
|
|
2021
2169
|
Button: Button$1,
|
|
2022
|
-
Code: Code$
|
|
2170
|
+
Code: Code$1,
|
|
2171
|
+
Dd,
|
|
2023
2172
|
Div,
|
|
2173
|
+
Dl,
|
|
2174
|
+
Dt,
|
|
2024
2175
|
H1,
|
|
2025
2176
|
H2,
|
|
2026
2177
|
Img,
|
|
@@ -2034,7 +2185,7 @@ const VirtualDomElements = {
|
|
|
2034
2185
|
Tr};
|
|
2035
2186
|
const text = data => {
|
|
2036
2187
|
return {
|
|
2037
|
-
type: Text
|
|
2188
|
+
type: Text,
|
|
2038
2189
|
text: data,
|
|
2039
2190
|
childCount: 0
|
|
2040
2191
|
};
|
|
@@ -2049,7 +2200,7 @@ const ButtonPrimary = 'ButtonPrimary';
|
|
|
2049
2200
|
const Categories = 'Categories';
|
|
2050
2201
|
const Category = 'Category';
|
|
2051
2202
|
const Changelog = 'Changelog';
|
|
2052
|
-
const Code
|
|
2203
|
+
const Code = 'Code';
|
|
2053
2204
|
const DefaultMarkdown = 'DefaultMarkdown';
|
|
2054
2205
|
const DefinitionListItem = 'DefinitionListItem';
|
|
2055
2206
|
const DefinitionListItemHeading = 'DefinitionListItemHeading';
|
|
@@ -2181,7 +2332,7 @@ const getCategoriesDom = categories => {
|
|
|
2181
2332
|
};
|
|
2182
2333
|
|
|
2183
2334
|
const parentNode$1 = {
|
|
2184
|
-
type: VirtualDomElements.
|
|
2335
|
+
type: VirtualDomElements.Dt,
|
|
2185
2336
|
className: MoreInfoEntryKey,
|
|
2186
2337
|
childCount: 1
|
|
2187
2338
|
};
|
|
@@ -2199,14 +2350,14 @@ const getTag = (onClick, code) => {
|
|
|
2199
2350
|
if (code) {
|
|
2200
2351
|
return VirtualDomElements.Code;
|
|
2201
2352
|
}
|
|
2202
|
-
return VirtualDomElements.
|
|
2353
|
+
return VirtualDomElements.Dd;
|
|
2203
2354
|
};
|
|
2204
2355
|
const getClassName = (onClick, code) => {
|
|
2205
2356
|
if (onClick) {
|
|
2206
2357
|
return mergeClassNames(MoreInfoEntryValue, Link);
|
|
2207
2358
|
}
|
|
2208
2359
|
if (code) {
|
|
2209
|
-
return mergeClassNames(MoreInfoEntryValue, Code
|
|
2360
|
+
return mergeClassNames(MoreInfoEntryValue, Code);
|
|
2210
2361
|
}
|
|
2211
2362
|
return MoreInfoEntryValue;
|
|
2212
2363
|
};
|
|
@@ -2229,12 +2380,12 @@ const getMoreInfoEntryValueVirtualDom = item => {
|
|
|
2229
2380
|
};
|
|
2230
2381
|
|
|
2231
2382
|
const parentNodeEven = {
|
|
2232
|
-
type: VirtualDomElements.
|
|
2383
|
+
type: VirtualDomElements.Dt,
|
|
2233
2384
|
className: MoreInfoEntry,
|
|
2234
2385
|
childCount: 2
|
|
2235
2386
|
};
|
|
2236
2387
|
const parentNodeOdd = {
|
|
2237
|
-
type: VirtualDomElements.
|
|
2388
|
+
type: VirtualDomElements.Dt,
|
|
2238
2389
|
className: mergeClassNames(MoreInfoEntry, MoreInfoEntryOdd),
|
|
2239
2390
|
childCount: 2
|
|
2240
2391
|
};
|
|
@@ -2248,7 +2399,7 @@ const getMoreInfoEntryVirtualDom = item => {
|
|
|
2248
2399
|
|
|
2249
2400
|
const getMoreInfoVirtualDom = items => {
|
|
2250
2401
|
return [{
|
|
2251
|
-
type: VirtualDomElements.
|
|
2402
|
+
type: VirtualDomElements.Dl,
|
|
2252
2403
|
className: MoreInfo,
|
|
2253
2404
|
childCount: items.length
|
|
2254
2405
|
}, ...items.flatMap(getMoreInfoEntryVirtualDom)];
|
|
@@ -2368,27 +2519,7 @@ const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, ext
|
|
|
2368
2519
|
return dom;
|
|
2369
2520
|
};
|
|
2370
2521
|
|
|
2371
|
-
const
|
|
2372
|
-
const Code = 2;
|
|
2373
|
-
|
|
2374
|
-
const getCommandTableEntry = command => {
|
|
2375
|
-
// TODO watch out for command being null/undefined/number/string/array
|
|
2376
|
-
const {
|
|
2377
|
-
id,
|
|
2378
|
-
label
|
|
2379
|
-
} = command;
|
|
2380
|
-
return [{
|
|
2381
|
-
type: Code,
|
|
2382
|
-
value: id
|
|
2383
|
-
}, {
|
|
2384
|
-
type: Text,
|
|
2385
|
-
value: label
|
|
2386
|
-
}];
|
|
2387
|
-
};
|
|
2388
|
-
|
|
2389
|
-
const getCommandTableEntries = extension => {
|
|
2390
|
-
const commands = extension.commands || [];
|
|
2391
|
-
const rows = commands.map(getCommandTableEntry);
|
|
2522
|
+
const getCommandTableEntries = rows => {
|
|
2392
2523
|
const id$1 = id();
|
|
2393
2524
|
const label$1 = label();
|
|
2394
2525
|
return {
|
|
@@ -2433,9 +2564,9 @@ const getCellTextVirtualDom = value => {
|
|
|
2433
2564
|
|
|
2434
2565
|
const getCellRenderer = type => {
|
|
2435
2566
|
switch (type) {
|
|
2436
|
-
case Code:
|
|
2567
|
+
case Code$2:
|
|
2437
2568
|
return getCellCodeVirtualDom;
|
|
2438
|
-
case Text:
|
|
2569
|
+
case Text$1:
|
|
2439
2570
|
return getCellTextVirtualDom;
|
|
2440
2571
|
default:
|
|
2441
2572
|
throw new Error(`unexpected cell type ${type}`);
|
|
@@ -2480,9 +2611,9 @@ const getTableVirtualDom = tableInfo => {
|
|
|
2480
2611
|
};
|
|
2481
2612
|
|
|
2482
2613
|
// TODO have typed view-model
|
|
2483
|
-
const getFeatureCommandsVirtualDom =
|
|
2614
|
+
const getFeatureCommandsVirtualDom = commands$1 => {
|
|
2484
2615
|
const heading = commands();
|
|
2485
|
-
const tableInfo = getCommandTableEntries(
|
|
2616
|
+
const tableInfo = getCommandTableEntries(commands$1);
|
|
2486
2617
|
return [{
|
|
2487
2618
|
type: VirtualDomElements.Div,
|
|
2488
2619
|
className: FeatureContent,
|
|
@@ -2490,23 +2621,7 @@ const getFeatureCommandsVirtualDom = extension => {
|
|
|
2490
2621
|
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
2491
2622
|
};
|
|
2492
2623
|
|
|
2493
|
-
const
|
|
2494
|
-
const {
|
|
2495
|
-
fileMatch,
|
|
2496
|
-
schema
|
|
2497
|
-
} = validation;
|
|
2498
|
-
return [{
|
|
2499
|
-
type: Code,
|
|
2500
|
-
value: fileMatch
|
|
2501
|
-
}, {
|
|
2502
|
-
type: Code,
|
|
2503
|
-
value: schema
|
|
2504
|
-
}];
|
|
2505
|
-
};
|
|
2506
|
-
|
|
2507
|
-
const getJsonValidationTableEntries = extension => {
|
|
2508
|
-
const validations = extension.jsonValidation || [];
|
|
2509
|
-
const rows = validations.map(getJsonValidationTableEntry);
|
|
2624
|
+
const getJsonValidationTableEntries = rows => {
|
|
2510
2625
|
return {
|
|
2511
2626
|
headings: [fileMatch(), schema()],
|
|
2512
2627
|
rows
|
|
@@ -2518,9 +2633,9 @@ const parentNode = {
|
|
|
2518
2633
|
className: FeatureContent,
|
|
2519
2634
|
childCount: 2
|
|
2520
2635
|
};
|
|
2521
|
-
const getFeatureJsonValidationVirtualDom =
|
|
2636
|
+
const getFeatureJsonValidationVirtualDom = jsonValidation$1 => {
|
|
2522
2637
|
const heading = jsonValidation();
|
|
2523
|
-
const tableInfo = getJsonValidationTableEntries(
|
|
2638
|
+
const tableInfo = getJsonValidationTableEntries(jsonValidation$1);
|
|
2524
2639
|
return [parentNode, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
2525
2640
|
};
|
|
2526
2641
|
|
|
@@ -2546,24 +2661,7 @@ const getFeatureProgrammingLanguagesVirtualDom = () => {
|
|
|
2546
2661
|
}, ...getFeatureContentHeadingVirtualDom(heading)];
|
|
2547
2662
|
};
|
|
2548
2663
|
|
|
2549
|
-
const
|
|
2550
|
-
const {
|
|
2551
|
-
id,
|
|
2552
|
-
label
|
|
2553
|
-
} = setting;
|
|
2554
|
-
// TODO watch out for null/undefined/number/string/array
|
|
2555
|
-
return [{
|
|
2556
|
-
type: Text,
|
|
2557
|
-
value: id
|
|
2558
|
-
}, {
|
|
2559
|
-
type: Text,
|
|
2560
|
-
value: label
|
|
2561
|
-
}];
|
|
2562
|
-
};
|
|
2563
|
-
|
|
2564
|
-
const getSettingsTableEntries = extension => {
|
|
2565
|
-
const settings = extension.settings || [];
|
|
2566
|
-
const rows = settings.map(getSettingsTableEntry);
|
|
2664
|
+
const getSettingsTableEntries = rows => {
|
|
2567
2665
|
const textId = id();
|
|
2568
2666
|
const textLabel = label();
|
|
2569
2667
|
return {
|
|
@@ -2572,9 +2670,9 @@ const getSettingsTableEntries = extension => {
|
|
|
2572
2670
|
};
|
|
2573
2671
|
};
|
|
2574
2672
|
|
|
2575
|
-
const getFeatureSettingsVirtualDom =
|
|
2673
|
+
const getFeatureSettingsVirtualDom = rows => {
|
|
2576
2674
|
const heading = settings();
|
|
2577
|
-
const tableInfo = getSettingsTableEntries(
|
|
2675
|
+
const tableInfo = getSettingsTableEntries(rows);
|
|
2578
2676
|
return [{
|
|
2579
2677
|
type: VirtualDomElements.Div,
|
|
2580
2678
|
className: FeatureContent,
|
|
@@ -2609,26 +2707,6 @@ const getFeatureThemesVirtualDom = themesDom => {
|
|
|
2609
2707
|
}, ...themesDom];
|
|
2610
2708
|
};
|
|
2611
2709
|
|
|
2612
|
-
const toWebView = rawWebView => {
|
|
2613
|
-
const {
|
|
2614
|
-
id,
|
|
2615
|
-
selector,
|
|
2616
|
-
contentSecurityPolicy,
|
|
2617
|
-
elements
|
|
2618
|
-
} = rawWebView;
|
|
2619
|
-
return {
|
|
2620
|
-
id,
|
|
2621
|
-
selectorString: JSON.stringify(selector),
|
|
2622
|
-
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
2623
|
-
elementsString: JSON.stringify(elements, null, 2)
|
|
2624
|
-
};
|
|
2625
|
-
};
|
|
2626
|
-
|
|
2627
|
-
const getWebViews = extension => {
|
|
2628
|
-
const rawWebViews = extension.webViews || [];
|
|
2629
|
-
return rawWebViews.map(toWebView);
|
|
2630
|
-
};
|
|
2631
|
-
|
|
2632
2710
|
const heading = {
|
|
2633
2711
|
type: VirtualDomElements.H2,
|
|
2634
2712
|
className: DefinitionListItemHeading,
|
|
@@ -2662,8 +2740,7 @@ const getWebViewVirtualDom = webView => {
|
|
|
2662
2740
|
}, item, heading, text(textId), pre, text(id$1), item, heading, text(textSelector), pre, text(selectorString), item, heading, text(textContentSecurityPolicy), pre, text(contentSecurityPolicyString), item, heading, text(textElements), pre, text(elementsString)];
|
|
2663
2741
|
};
|
|
2664
2742
|
|
|
2665
|
-
const getFeatureWebViewsVirtualDom =
|
|
2666
|
-
const webViews$1 = getWebViews(extension);
|
|
2743
|
+
const getFeatureWebViewsVirtualDom = webViews$1 => {
|
|
2667
2744
|
const heading = webViews();
|
|
2668
2745
|
return [{
|
|
2669
2746
|
type: VirtualDomElements.Div,
|
|
@@ -2675,20 +2752,20 @@ const getFeatureWebViewsVirtualDom = extension => {
|
|
|
2675
2752
|
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
2676
2753
|
};
|
|
2677
2754
|
|
|
2678
|
-
const getFeatureContentVirtualDom = (
|
|
2755
|
+
const getFeatureContentVirtualDom = (themesDom, selectedFeature, commands, jsonValidation, settings, webViews) => {
|
|
2679
2756
|
switch (selectedFeature) {
|
|
2680
2757
|
case Theme:
|
|
2681
2758
|
return getFeatureThemesVirtualDom(themesDom);
|
|
2682
2759
|
case Commands:
|
|
2683
|
-
return getFeatureCommandsVirtualDom(
|
|
2760
|
+
return getFeatureCommandsVirtualDom(commands);
|
|
2684
2761
|
case JsonValidation:
|
|
2685
|
-
return getFeatureJsonValidationVirtualDom(
|
|
2762
|
+
return getFeatureJsonValidationVirtualDom(jsonValidation);
|
|
2686
2763
|
case ProgrammingLanguages:
|
|
2687
2764
|
return getFeatureProgrammingLanguagesVirtualDom();
|
|
2688
2765
|
case Settings:
|
|
2689
|
-
return getFeatureSettingsVirtualDom(
|
|
2766
|
+
return getFeatureSettingsVirtualDom(settings);
|
|
2690
2767
|
case WebViews:
|
|
2691
|
-
return getFeatureWebViewsVirtualDom(
|
|
2768
|
+
return getFeatureWebViewsVirtualDom(webViews);
|
|
2692
2769
|
default:
|
|
2693
2770
|
return getFeatureNotImplementedVirtualDom();
|
|
2694
2771
|
}
|
|
@@ -2720,7 +2797,7 @@ const getFeatureListVirtualDom = features => {
|
|
|
2720
2797
|
}, ...features.flatMap(getFeatureListItemVirtualDom)];
|
|
2721
2798
|
};
|
|
2722
2799
|
|
|
2723
|
-
const getFeaturesVirtualDom = (features, themesDom, selectedFeature,
|
|
2800
|
+
const getFeaturesVirtualDom = (features, themesDom, selectedFeature, commands, jsonValidation, settings, webViews) => {
|
|
2724
2801
|
if (features.length === 0) {
|
|
2725
2802
|
const none$1 = none();
|
|
2726
2803
|
return [{
|
|
@@ -2737,15 +2814,15 @@ const getFeaturesVirtualDom = (features, themesDom, selectedFeature, extension)
|
|
|
2737
2814
|
type: VirtualDomElements.Div,
|
|
2738
2815
|
className: mergeClassNames(Sash, SashVertical),
|
|
2739
2816
|
childCount: 0
|
|
2740
|
-
}, ...getFeatureContentVirtualDom(
|
|
2817
|
+
}, ...getFeatureContentVirtualDom(themesDom, selectedFeature, commands, jsonValidation, settings, webViews)];
|
|
2741
2818
|
};
|
|
2742
2819
|
|
|
2743
|
-
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature,
|
|
2820
|
+
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, width, scrollToTopButtonEnabled, categories, resources, breakpoint, commands, jsonValidation, settings, webViews, extensionUri) => {
|
|
2744
2821
|
switch (selectedTab) {
|
|
2745
2822
|
case Details:
|
|
2746
|
-
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width,
|
|
2823
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled, categories, resources, breakpoint);
|
|
2747
2824
|
case Features$1:
|
|
2748
|
-
return getFeaturesVirtualDom(features, themesDom, selectedFeature,
|
|
2825
|
+
return getFeaturesVirtualDom(features, themesDom, selectedFeature, commands, jsonValidation, settings, webViews);
|
|
2749
2826
|
case Changelog$1:
|
|
2750
2827
|
return getChangelogVirtualDom();
|
|
2751
2828
|
default:
|
|
@@ -2913,36 +2990,43 @@ const getExtensionDetailVirtualDom = (newState, selectedTab) => {
|
|
|
2913
2990
|
// 2. view model
|
|
2914
2991
|
// 3. virtual dom
|
|
2915
2992
|
// 4. dom
|
|
2916
|
-
const themesHtml = newState.themesMarkdownDom;
|
|
2917
|
-
const selectedFeature = newState?.selectedFeature || '';
|
|
2918
|
-
const extension = newState?.extension || {};
|
|
2919
|
-
const features = getFeatures(selectedFeature, extension);
|
|
2920
|
-
const extensionId = newState?.extension?.id || 'n/a';
|
|
2921
|
-
const extensionVersion = newState?.extension?.version || 'n/a';
|
|
2922
2993
|
const {
|
|
2923
|
-
displaySize
|
|
2994
|
+
displaySize,
|
|
2995
|
+
themesMarkdownDom,
|
|
2996
|
+
selectedFeature,
|
|
2997
|
+
sizeValue,
|
|
2998
|
+
isBuiltin,
|
|
2999
|
+
categories,
|
|
3000
|
+
resources,
|
|
3001
|
+
showAdditionalDetailsBreakpoint,
|
|
3002
|
+
scrollToTopButtonEnabled,
|
|
3003
|
+
hasColorTheme,
|
|
3004
|
+
builtinExtensionsBadgeEnabled,
|
|
3005
|
+
settingsButtonEnabled,
|
|
3006
|
+
name,
|
|
3007
|
+
iconSrc,
|
|
3008
|
+
description,
|
|
3009
|
+
detailsVirtualDom,
|
|
3010
|
+
features,
|
|
3011
|
+
extensionId,
|
|
3012
|
+
extensionVersion,
|
|
3013
|
+
commands,
|
|
3014
|
+
jsonValidation,
|
|
3015
|
+
settings,
|
|
3016
|
+
webViews,
|
|
3017
|
+
extension
|
|
2924
3018
|
} = newState;
|
|
3019
|
+
const extensionUri = extension.uri || extension.path || '';
|
|
2925
3020
|
const width = newState?.width || 500;
|
|
2926
3021
|
const tabs = getTabs(selectedTab);
|
|
2927
|
-
const {
|
|
2928
|
-
sizeValue
|
|
2929
|
-
} = newState;
|
|
2930
3022
|
const sizeClass = getClassNames(sizeValue);
|
|
2931
|
-
const buttonDefs = getExtensionDetailButtons(
|
|
2932
|
-
const
|
|
2933
|
-
name,
|
|
2934
|
-
iconSrc,
|
|
2935
|
-
description
|
|
2936
|
-
} = newState;
|
|
2937
|
-
const badge = getBadge(newState.isBuiltin, newState.builtinExtensionsBadgeEnabled); // TODO compute in loadContent
|
|
2938
|
-
const {
|
|
2939
|
-
settingsButtonEnabled
|
|
2940
|
-
} = newState;
|
|
3023
|
+
const buttonDefs = getExtensionDetailButtons(hasColorTheme, isBuiltin);
|
|
3024
|
+
const badge = getBadge(isBuiltin, builtinExtensionsBadgeEnabled); // TODO compute in loadContent
|
|
2941
3025
|
const dom = [{
|
|
2942
3026
|
type: VirtualDomElements.Div,
|
|
2943
3027
|
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
2944
3028
|
childCount: 3
|
|
2945
|
-
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(
|
|
3029
|
+
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(detailsVirtualDom, themesMarkdownDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, width, scrollToTopButtonEnabled, categories, resources, showAdditionalDetailsBreakpoint, commands, jsonValidation, settings, webViews, extensionUri)];
|
|
2946
3030
|
return dom;
|
|
2947
3031
|
};
|
|
2948
3032
|
|