@lvce-editor/extension-detail-view 3.30.0 → 3.32.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.
@@ -944,30 +944,34 @@ const {
944
944
 
945
945
  const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
946
946
  const state = {
947
+ assetDir: assetDir || '',
948
+ baseUrl: '',
949
+ builtinExtensionsBadgeEnabled: true,
950
+ categories: [],
951
+ changelogVirtualDom: [],
947
952
  description: '',
948
- iconSrc: '',
949
- selectedFeature: '',
950
- name: '',
951
- sanitizedReadmeHtml: '',
952
- selectedTab: '',
953
- sizeOnDisk: 0,
954
- width,
955
- uri,
953
+ detailsVirtualDom: [],
956
954
  entries: [],
957
- secondEntries: [],
958
- categories: [],
959
- resources: [],
960
- selectedFeatureMarkdownDom: '',
961
955
  extension: {},
962
- baseUrl: '',
963
956
  features: [],
957
+ featuresVirtualDom: [],
964
958
  folderSize: 0,
965
- assetDir: assetDir || '',
959
+ iconSrc: '',
960
+ name: '',
966
961
  platform,
967
962
  readmeScrollTop: 0,
963
+ resources: [],
964
+ sanitizedReadmeHtml: '',
965
+ scrollToTopButtonEnabled: false,
966
+ secondEntries: [],
967
+ selectedFeature: '',
968
+ themesMarkdownDom: [],
969
+ selectedTab: '',
968
970
  settingsButtonEnabled: false,
969
- builtinExtensionsBadgeEnabled: true,
970
- scrollToTopButtonEnabled: false
971
+ showAdditionalDetailsBreakpoint: 600,
972
+ sizeOnDisk: 0,
973
+ uri,
974
+ width
971
975
  };
972
976
  set$1(uid, state, state);
973
977
  };
@@ -1007,7 +1011,7 @@ const dispose = uid => {
1007
1011
  dispose$1(uid);
1008
1012
  };
1009
1013
 
1010
- const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickScrollToTop', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'handleWheel', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
1014
+ const commandIds = ['getMenuEntries', 'handleClickCategory', 'handleClickDisable', 'handleClickScrollToTop', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'handleWheel', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
1011
1015
 
1012
1016
  const getCommandIds = () => {
1013
1017
  return commandIds;
@@ -1034,7 +1038,7 @@ const Commands$1 = 'Commands';
1034
1038
  const ContentSecurityPolicy = 'ContentSecurityPolicy';
1035
1039
  const Copy = 'Copy';
1036
1040
  const Details$1 = 'Details';
1037
- const Disable = 'Disable';
1041
+ const Disable$1 = 'Disable';
1038
1042
  const Elements = 'Elements';
1039
1043
  const Features$2 = 'Features';
1040
1044
  const FileMatch = 'File Match';
@@ -1047,11 +1051,12 @@ const OpenInNewTab = 'Open in New Tab';
1047
1051
  const ProgrammingLanguages$1 = 'Programming Languages';
1048
1052
  const SaveImageAs = 'Save Image as';
1049
1053
  const Schema = 'Schema';
1054
+ const ScrollToTop = 'Scroll to top';
1050
1055
  const Selector = 'Selector';
1051
1056
  const Settings$1 = 'Settings';
1052
- const SetColorTheme = 'Set Color Theme';
1057
+ const SetColorTheme$1 = 'Set Color Theme';
1053
1058
  const Theme$1 = 'Theme';
1054
- const Uninstall = 'Uninstall';
1059
+ const Uninstall$1 = 'Uninstall';
1055
1060
  const WebViews$1 = 'WebViews';
1056
1061
  const NotImplemented = 'Not Implemented';
1057
1062
 
@@ -1077,7 +1082,7 @@ const details = () => {
1077
1082
  return i18nString(Details$1);
1078
1083
  };
1079
1084
  const disable = () => {
1080
- return i18nString(Disable);
1085
+ return i18nString(Disable$1);
1081
1086
  };
1082
1087
  const features = () => {
1083
1088
  return i18nString(Features$2);
@@ -1104,7 +1109,7 @@ const schema = () => {
1104
1109
  return i18nString(Schema);
1105
1110
  };
1106
1111
  const setColorTheme$3 = () => {
1107
- return i18nString(SetColorTheme);
1112
+ return i18nString(SetColorTheme$1);
1108
1113
  };
1109
1114
  const theme = () => {
1110
1115
  return i18nString(Theme$1);
@@ -1140,7 +1145,10 @@ const notImplemented = () => {
1140
1145
  return i18nString(NotImplemented);
1141
1146
  };
1142
1147
  const uninstall = () => {
1143
- return i18nString(Uninstall);
1148
+ return i18nString(Uninstall$1);
1149
+ };
1150
+ const scrollToTop = () => {
1151
+ return i18nString(ScrollToTop);
1144
1152
  };
1145
1153
 
1146
1154
  const None = 0;
@@ -1186,6 +1194,11 @@ const getLinkMenuEntries = props => {
1186
1194
 
1187
1195
  const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
1188
1196
 
1197
+ const handleClickCategory = async (state, categoryId) => {
1198
+ // TODO: Implement category click functionality
1199
+ return state;
1200
+ };
1201
+
1189
1202
  const handleClickDisable = async state => {
1190
1203
  return state;
1191
1204
  };
@@ -1389,11 +1402,65 @@ const ProgrammingLanguages = 'ProgrammingLanguages';
1389
1402
  const Settings = 'Settings';
1390
1403
  const WebViews = 'WebViews';
1391
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
+ const readFile = async uri => {
1416
+ return readFile$1(uri);
1417
+ };
1418
+
1419
+ const ENOENT = 'ENOENT';
1420
+
1421
+ const isEnoentError = error => {
1422
+ return error && error.code === ENOENT;
1423
+ };
1424
+
1425
+ const join = (pathSeparator, ...parts) => {
1426
+ return parts.join(pathSeparator);
1427
+ };
1428
+
1429
+ const loadChangelogContent = async path => {
1430
+ try {
1431
+ const changelogUrl = join('/', path, 'CHANGELOG.md');
1432
+ const changelogContent = await readFile(changelogUrl);
1433
+ return changelogContent;
1434
+ } catch (error) {
1435
+ if (isEnoentError(error)) {
1436
+ return '';
1437
+ }
1438
+ // TODO send message to error worker
1439
+ // @ts-ignore
1440
+ console.error(new VError(error, 'Failed to load Changelog content'));
1441
+ return `${error}`;
1442
+ }
1443
+ };
1444
+
1445
+ const renderMarkdown = async (markdown, options = {}) => {
1446
+ const html = await renderMarkdown$1(markdown, options);
1447
+ return html;
1448
+ };
1392
1449
 
1393
1450
  const selectTabChangelog = async state => {
1451
+ const {
1452
+ extension,
1453
+ baseUrl
1454
+ } = state;
1455
+ const changelogContent = await loadChangelogContent(extension.path); // TODO use uri
1456
+ const changelogMarkdownHtml = await renderMarkdown(changelogContent, {
1457
+ baseUrl
1458
+ });
1459
+ const changelogDom = await getMarkdownVirtualDom(changelogMarkdownHtml);
1394
1460
  return {
1395
1461
  ...state,
1396
- selectedTab: Changelog$1
1462
+ selectedTab: Changelog$1,
1463
+ changelogVirtualDom: changelogDom
1397
1464
  };
1398
1465
  };
1399
1466
 
@@ -1401,11 +1468,56 @@ const selectTabDefault = async state => {
1401
1468
  return state;
1402
1469
  };
1403
1470
 
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
+ const loadReadmeContent = async path => {
1491
+ try {
1492
+ const readmeUrl = join('/', path, 'README.md');
1493
+ const readmeContent = await readFile(readmeUrl);
1494
+ return readmeContent;
1495
+ } catch (error) {
1496
+ if (isEnoentError(error)) {
1497
+ return '';
1498
+ }
1499
+ // TODO send message to error worker
1500
+ // @ts-ignore
1501
+ console.error(new VError(error, 'Failed to load Readme content'));
1502
+ return `${error}`;
1503
+ }
1504
+ };
1505
+
1404
1506
  const selectTabDetails = async state => {
1405
- // TODO load readmo markdown here
1507
+ const {
1508
+ extension,
1509
+ platform
1510
+ } = state;
1511
+ const readmeContent = await loadReadmeContent(extension.path);
1512
+ const baseUrl = getBaseUrl(extension.path, platform);
1513
+ const readmeHtml = await renderMarkdown(readmeContent, {
1514
+ baseUrl
1515
+ });
1516
+ const detailsDom = await getMarkdownVirtualDom(readmeHtml);
1406
1517
  return {
1407
1518
  ...state,
1408
- selectedTab: Details
1519
+ selectedTab: Details,
1520
+ detailsVirtualDom: detailsDom
1409
1521
  };
1410
1522
  };
1411
1523
 
@@ -1442,30 +1554,31 @@ const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
1442
1554
  return markdown;
1443
1555
  };
1444
1556
 
1445
- const renderMarkdown = async (markdown, options = {}) => {
1446
- const html = await renderMarkdown$1(markdown, options);
1447
- return html;
1448
- };
1449
-
1450
- const selectTab$1 = async state => {
1557
+ const selectTabFeatures = async state => {
1451
1558
  const {
1452
1559
  extension,
1453
- baseUrl
1560
+ baseUrl,
1561
+ selectedFeature
1454
1562
  } = state;
1455
- const {
1456
- colorThemes,
1457
- iconThemes,
1458
- productIconThemes
1459
- } = extension;
1460
- // TODO do this depending on featured tab content
1461
- const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
1462
- const rendered = await renderMarkdown(markdown, {
1463
- baseUrl
1464
- });
1563
+
1564
+ // Only generate theme markdown when the selected feature is actually "Theme"
1565
+ let themesMarkdownDom = [];
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
+ }
1465
1578
  return {
1466
1579
  ...state,
1467
1580
  selectedTab: Features$1,
1468
- selectedFeatureMarkdownDom: rendered
1581
+ themesMarkdownDom: themesMarkdownDom
1469
1582
  };
1470
1583
  };
1471
1584
 
@@ -1474,7 +1587,7 @@ const getSelectTabHandler = selectedTab => {
1474
1587
  case Details:
1475
1588
  return selectTabDetails;
1476
1589
  case Features$1:
1477
- return selectTab$1;
1590
+ return selectTabFeatures;
1478
1591
  case Changelog$1:
1479
1592
  return selectTabChangelog;
1480
1593
  default:
@@ -1512,10 +1625,6 @@ const isThemeExtension = extension => {
1512
1625
  return extension.name && extension.name.endsWith(' Theme');
1513
1626
  };
1514
1627
 
1515
- const Web = 1;
1516
- const Electron = 2;
1517
- const Remote = 3;
1518
-
1519
1628
  const getIcon = (extension, platform, assetDir) => {
1520
1629
  if (!extension) {
1521
1630
  return extensionDefaultIcon(assetDir);
@@ -1584,21 +1693,6 @@ const getExtension = async (id, platform) => {
1584
1693
  }
1585
1694
  };
1586
1695
 
1587
- const getRemoteSrc = uri => {
1588
- const src = `/remote${uri}`;
1589
- return src;
1590
- };
1591
-
1592
- const getBaseUrl = (extensionPath, platform) => {
1593
- switch (platform) {
1594
- case Remote:
1595
- case Electron:
1596
- return getRemoteSrc(extensionPath + '/');
1597
- default:
1598
- return extensionPath;
1599
- }
1600
- };
1601
-
1602
1696
  const getCategories = () => {
1603
1697
  return [{
1604
1698
  id: 'themes',
@@ -1717,36 +1811,6 @@ const getViewletSize = width => {
1717
1811
  return Large$1;
1718
1812
  };
1719
1813
 
1720
- const readFile = async uri => {
1721
- return readFile$1(uri);
1722
- };
1723
-
1724
- const ENOENT = 'ENOENT';
1725
-
1726
- const isEnoentError = error => {
1727
- return error && error.code === ENOENT;
1728
- };
1729
-
1730
- const join = (pathSeparator, ...parts) => {
1731
- return parts.join(pathSeparator);
1732
- };
1733
-
1734
- const loadReadmeContent = async path => {
1735
- try {
1736
- const readmeUrl = join('/', path, 'README.md');
1737
- const readmeContent = await readFile(readmeUrl);
1738
- return readmeContent;
1739
- } catch (error) {
1740
- if (isEnoentError(error)) {
1741
- return '';
1742
- }
1743
- // TODO send message to error worker
1744
- // @ts-ignore
1745
- console.error(new VError(error, 'Failed to load Readme content'));
1746
- return `${error}`;
1747
- }
1748
- };
1749
-
1750
1814
  const getSavedSelectedFeature = savedState => {
1751
1815
  if (savedState && typeof savedState === 'object' && 'selectedFeature' in savedState && typeof savedState.selectedFeature === 'string') {
1752
1816
  return savedState.selectedFeature;
@@ -1778,6 +1842,9 @@ const loadContent = async (state, platform, savedState) => {
1778
1842
  } = state;
1779
1843
  const id = getExtensionIdFromUri(uri);
1780
1844
  const extension = await getExtension(id, platform);
1845
+ if (!extension) {
1846
+ throw new Error(`extension not found: ${id}`);
1847
+ }
1781
1848
  const readmeContent = await loadReadmeContent(extension.path);
1782
1849
  const baseUrl = getBaseUrl(extension.path, platform);
1783
1850
  const readmeHtml = await renderMarkdown(readmeContent, {
@@ -1841,12 +1908,12 @@ const Img = 17;
1841
1908
  const H2 = 22;
1842
1909
  const Pre = 51;
1843
1910
  const A = 53;
1844
- const Code$1 = 65;
1911
+ const Code$2 = 65;
1845
1912
  const VirtualDomElements = {
1846
1913
  __proto__: null,
1847
1914
  A,
1848
1915
  Button: Button$1,
1849
- Code: Code$1,
1916
+ Code: Code$2,
1850
1917
  Div,
1851
1918
  H1,
1852
1919
  H2,
@@ -1876,6 +1943,7 @@ const ButtonPrimary = 'ButtonPrimary';
1876
1943
  const Categories = 'Categories';
1877
1944
  const Category = 'Category';
1878
1945
  const Changelog = 'Changelog';
1946
+ const Code$1 = 'Code';
1879
1947
  const DefaultMarkdown = 'DefaultMarkdown';
1880
1948
  const DefinitionListItem = 'DefinitionListItem';
1881
1949
  const DefinitionListItemHeading = 'DefinitionListItemHeading';
@@ -1898,6 +1966,7 @@ const Features = 'Features';
1898
1966
  const FeaturesList = 'FeaturesList';
1899
1967
  const FeatureWebView = 'FeatureWebView';
1900
1968
  const Large = 'Large';
1969
+ const Link = 'Link';
1901
1970
  const MoreInfo = 'MoreInfo';
1902
1971
  const MoreInfoEntry = 'MoreInfoEntry';
1903
1972
  const MoreInfoEntryKey = 'MoreInfoEntryKey';
@@ -2017,6 +2086,7 @@ const getDisplaySize = size => {
2017
2086
  });
2018
2087
  };
2019
2088
 
2089
+ const HandleClickCategory = 'handleClickCategory';
2020
2090
  const HandleClickDisable = 'handleClickDisable';
2021
2091
  const HandleClickScrollToTop = 'handleClickScrollToTop';
2022
2092
  const HandleClickSetColorTheme = 'handleClickSetColorTheme';
@@ -2037,15 +2107,18 @@ const getExtensionDetailButtons = extension => {
2037
2107
  const allActions = [{
2038
2108
  label: setColorTheme$3(),
2039
2109
  onClick: HandleClickSetColorTheme,
2040
- enabled: hasColorThemes(extension)
2110
+ enabled: hasColorThemes(extension),
2111
+ name: SetColorTheme
2041
2112
  }, {
2042
2113
  label: disable(),
2043
2114
  onClick: HandleClickDisable,
2044
- enabled: true
2115
+ enabled: true,
2116
+ name: Disable
2045
2117
  }, {
2046
2118
  label: uninstall(),
2047
2119
  onClick: HandleClickUninstall,
2048
- enabled: !extension?.builtin
2120
+ enabled: !extension?.builtin,
2121
+ name: Uninstall
2049
2122
  }];
2050
2123
  return allActions;
2051
2124
  };
@@ -2078,12 +2151,15 @@ const getAdditionalDetailsEntryVirtualDom = (heading, items, renderer) => {
2078
2151
 
2079
2152
  const getCategoryVirtualDom = category => {
2080
2153
  const {
2154
+ id,
2081
2155
  label
2082
2156
  } = category;
2083
2157
  return [{
2084
- type: VirtualDomElements.Div,
2158
+ type: VirtualDomElements.Button,
2085
2159
  className: Category,
2086
- childCount: 1
2160
+ childCount: 1,
2161
+ onClick: HandleClickCategory,
2162
+ name: id
2087
2163
  }, text(label)];
2088
2164
  };
2089
2165
 
@@ -2112,17 +2188,16 @@ const getTag = (onClick, code) => {
2112
2188
  return VirtualDomElements.A;
2113
2189
  }
2114
2190
  if (code) {
2115
- // TODO use code tag
2116
- return VirtualDomElements.Div;
2191
+ return VirtualDomElements.Code;
2117
2192
  }
2118
2193
  return VirtualDomElements.Div;
2119
2194
  };
2120
2195
  const getClassName = (onClick, code) => {
2121
2196
  if (onClick) {
2122
- return MoreInfoEntryValue + ' Link';
2197
+ return mergeClassNames(MoreInfoEntryValue, Link);
2123
2198
  }
2124
2199
  if (code) {
2125
- return MoreInfoEntryValue + ' Code';
2200
+ return mergeClassNames(MoreInfoEntryValue, Code$1);
2126
2201
  }
2127
2202
  return MoreInfoEntryValue;
2128
2203
  };
@@ -2230,12 +2305,6 @@ const getInstallationEntries = (displaySize, extensionId, extensionVersion, exte
2230
2305
  return entries;
2231
2306
  };
2232
2307
 
2233
- const getMarkdownVirtualDom = async html => {
2234
- string(html);
2235
- const dom = await getMarkdownDom(html);
2236
- return dom;
2237
- };
2238
-
2239
2308
  const getMarketplaceEntries = () => {
2240
2309
  return [{
2241
2310
  key: 'Published',
@@ -2255,22 +2324,31 @@ const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
2255
2324
  type: VirtualDomElements.Button,
2256
2325
  className: ScrollToTopButton,
2257
2326
  childCount: 0,
2258
- onClick: HandleClickScrollToTop
2327
+ onClick: HandleClickScrollToTop,
2328
+ ariaLabel: scrollToTop(),
2329
+ name: 'scrolltotop'
2259
2330
  }];
2260
2331
  };
2261
2332
 
2262
- const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled) => {
2333
+ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
2334
+ let count = 1;
2335
+ if (additionalDetails) {
2336
+ count++;
2337
+ }
2338
+ if (scrollToTopEnabled) {
2339
+ count++;
2340
+ }
2341
+ return count;
2342
+ };
2343
+ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint) => {
2263
2344
  const firstHeading = installation();
2264
2345
  const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
2265
2346
  const secondHeading = marketplace();
2266
2347
  const secondEntries = getMarketplaceEntries();
2267
2348
  const thirdHeading = categories();
2268
- const categories$1 = getCategories();
2269
2349
  const fourthHeading = resources();
2270
- const resources$1 = getResources();
2271
- const showAdditionalDetailsBreakpoint = 600;
2272
2350
  const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
2273
- const childCount = showAdditionalDetails ? 2 : 1;
2351
+ const childCount = getChildCount(showAdditionalDetails, scrollToTopButtonEnabled);
2274
2352
  const dom = [{
2275
2353
  type: VirtualDomElements.Div,
2276
2354
  className: ExtensionDetailPanel,
@@ -2507,9 +2585,8 @@ const getVirtualDomChildCount = dom => {
2507
2585
  return stack.length;
2508
2586
  };
2509
2587
 
2510
- const getFeatureThemesVirtualDom = async themesHtml => {
2511
- const markdownDom = await getMarkdownVirtualDom(themesHtml);
2512
- const childCount = getVirtualDomChildCount(markdownDom);
2588
+ const getFeatureThemesVirtualDom = async themesDom => {
2589
+ const childCount = getVirtualDomChildCount(themesDom);
2513
2590
  const heading = theme();
2514
2591
  return [{
2515
2592
  type: VirtualDomElements.Div,
@@ -2519,7 +2596,7 @@ const getFeatureThemesVirtualDom = async themesHtml => {
2519
2596
  type: VirtualDomElements.Div,
2520
2597
  className: DefaultMarkdown,
2521
2598
  childCount
2522
- }, ...markdownDom];
2599
+ }, ...themesDom];
2523
2600
  };
2524
2601
 
2525
2602
  const toWebView = rawWebView => {
@@ -2588,10 +2665,10 @@ const getFeatureWebViewsVirtualDom = extension => {
2588
2665
  }, ...webViews$1.flatMap(getWebViewVirtualDom)];
2589
2666
  };
2590
2667
 
2591
- const getFeatureContentVirtualDom = async (features, themesHtml, selectedFeature, extension) => {
2668
+ const getFeatureContentVirtualDom = async (features, themesDom, selectedFeature, extension) => {
2592
2669
  switch (selectedFeature) {
2593
2670
  case Theme:
2594
- return await getFeatureThemesVirtualDom(themesHtml);
2671
+ return await getFeatureThemesVirtualDom(themesDom);
2595
2672
  case Commands:
2596
2673
  return getFeatureCommandsVirtualDom(extension);
2597
2674
  case JsonValidation:
@@ -2633,7 +2710,7 @@ const getFeatureListVirtualDom = features => {
2633
2710
  }, ...features.flatMap(getFeatureListItemVirtualDom)];
2634
2711
  };
2635
2712
 
2636
- const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, extension) => {
2713
+ const getFeaturesVirtualDom = async (features, themesDom, selectedFeature, extension) => {
2637
2714
  if (features.length === 0) {
2638
2715
  const none$1 = none();
2639
2716
  return [{
@@ -2650,15 +2727,15 @@ const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, exte
2650
2727
  type: VirtualDomElements.Div,
2651
2728
  className: mergeClassNames(Sash, SashVertical),
2652
2729
  childCount: 0
2653
- }, ...(await getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension))];
2730
+ }, ...(await getFeatureContentVirtualDom(features, themesDom, selectedFeature, extension))];
2654
2731
  };
2655
2732
 
2656
- const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled) => {
2733
+ const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled, categories, resources, breakpoint) => {
2657
2734
  switch (selectedTab) {
2658
2735
  case Details:
2659
- return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled);
2736
+ return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled, categories, resources, breakpoint);
2660
2737
  case Features$1:
2661
- return await getFeaturesVirtualDom(features, themesHtml, selectedFeature, extension);
2738
+ return await getFeaturesVirtualDom(features, themesDom, selectedFeature, extension);
2662
2739
  case Changelog$1:
2663
2740
  return getChangelogVirtualDom();
2664
2741
  default:
@@ -2674,11 +2751,12 @@ const getExtensionDetailDescriptionVirtualDom = description => {
2674
2751
  }, text(description)];
2675
2752
  };
2676
2753
 
2677
- const getButtonVirtualDom = (message, onClick) => {
2754
+ const getButtonVirtualDom = (message, onClick, name) => {
2678
2755
  return [{
2679
2756
  type: VirtualDomElements.Button,
2680
2757
  className: mergeClassNames(Button, ButtonPrimary),
2681
2758
  onClick,
2759
+ name,
2682
2760
  childCount: 1
2683
2761
  }, text(message)];
2684
2762
  };
@@ -2692,7 +2770,8 @@ const getSettingsButtonVirtualDom = enabled => {
2692
2770
  className: SettingsButton,
2693
2771
  onClick: HandleClickSettings,
2694
2772
  childCount: 1,
2695
- title: 'Settings'
2773
+ title: 'Settings',
2774
+ name: Settings
2696
2775
  }, {
2697
2776
  type: VirtualDomElements.Span,
2698
2777
  className: SettingsIcon,
@@ -2703,7 +2782,7 @@ const getSettingsButtonVirtualDom = enabled => {
2703
2782
 
2704
2783
  const getExtensionDetailHeaderActionsVirtualDom = (buttonDefs, settingsButtonEnabled) => {
2705
2784
  const enabledButtons = buttonDefs.filter(btn => btn.enabled);
2706
- const buttons = enabledButtons.flatMap(btn => getButtonVirtualDom(btn.label, btn.onClick));
2785
+ const buttons = enabledButtons.flatMap(btn => getButtonVirtualDom(btn.label, btn.onClick, btn.name));
2707
2786
  const settingsButton = getSettingsButtonVirtualDom(settingsButtonEnabled);
2708
2787
  const dom = [{
2709
2788
  type: VirtualDomElements.Div,
@@ -2713,6 +2792,17 @@ const getExtensionDetailHeaderActionsVirtualDom = (buttonDefs, settingsButtonEna
2713
2792
  return dom;
2714
2793
  };
2715
2794
 
2795
+ const getExtensionDetailIconVirtualDom = iconSrc => {
2796
+ return {
2797
+ type: VirtualDomElements.Img,
2798
+ className: ExtensionDetailIcon,
2799
+ alt: '',
2800
+ draggable: false,
2801
+ childCount: 0,
2802
+ src: iconSrc
2803
+ };
2804
+ };
2805
+
2716
2806
  const getNameBadgeVirtualDom = badge => {
2717
2807
  if (!badge) {
2718
2808
  return [];
@@ -2737,14 +2827,7 @@ const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, b
2737
2827
  type: VirtualDomElements.Div,
2738
2828
  className: ExtensionDetailHeader,
2739
2829
  childCount: 2
2740
- }, {
2741
- type: VirtualDomElements.Img,
2742
- className: ExtensionDetailIcon,
2743
- alt: '',
2744
- draggable: false,
2745
- childCount: 0,
2746
- src: iconSrc
2747
- }, {
2830
+ }, getExtensionDetailIconVirtualDom(iconSrc), {
2748
2831
  type: VirtualDomElements.Div,
2749
2832
  className: ExtensionDetailHeaderDetails,
2750
2833
  childCount: 3
@@ -2820,7 +2903,7 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
2820
2903
  // 2. view model
2821
2904
  // 3. virtual dom
2822
2905
  // 4. dom
2823
- const themesHtml = newState?.selectedFeatureMarkdownDom || '';
2906
+ const themesHtml = newState.themesMarkdownDom;
2824
2907
  const selectedFeature = newState?.selectedFeature || '';
2825
2908
  const extension = newState?.extension || {};
2826
2909
  const features = getFeatures(selectedFeature, extension);
@@ -2846,7 +2929,7 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
2846
2929
  type: VirtualDomElements.Div,
2847
2930
  className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
2848
2931
  childCount: 3
2849
- }, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, newState.scrollToTopButtonEnabled))];
2932
+ }, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, newState.scrollToTopButtonEnabled, newState.categories, newState.resources, newState.showAdditionalDetailsBreakpoint))];
2850
2933
  return dom;
2851
2934
  };
2852
2935
 
@@ -2891,6 +2974,9 @@ const render2 = async (uid, diffResult) => {
2891
2974
 
2892
2975
  const renderEventListeners = () => {
2893
2976
  return [{
2977
+ name: HandleClickCategory,
2978
+ params: ['handleClickCategory', 'event.target.name']
2979
+ }, {
2894
2980
  name: HandleIconError,
2895
2981
  params: ['handleIconError']
2896
2982
  }, {
@@ -2953,6 +3039,7 @@ const commandMap = {
2953
3039
  'ExtensionDetail.dispose': dispose,
2954
3040
  'ExtensionDetail.getCommandIds': getCommandIds,
2955
3041
  'ExtensionDetail.getMenuEntries': getMenuEntries,
3042
+ 'ExtensionDetail.handleClickCategory': wrapCommand(handleClickCategory),
2956
3043
  'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
2957
3044
  'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
2958
3045
  'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.30.0",
3
+ "version": "3.32.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",