@lvce-editor/extension-detail-view 3.6.0 → 3.7.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.
@@ -1094,30 +1094,57 @@ const getMoreInfoEntryKeyVirtualDom = item => {
1094
1094
  }, text(key)];
1095
1095
  };
1096
1096
 
1097
+ const getTag = (onClick, code) => {
1098
+ if (onClick) {
1099
+ return A$1;
1100
+ }
1101
+ if (code) {
1102
+ // TODO use code tag
1103
+ return Div$1;
1104
+ }
1105
+ return Div$1;
1106
+ };
1107
+ const getClassName = (onClick, code) => {
1108
+ if (onClick) {
1109
+ return MoreInfoEntryValue + ' Link';
1110
+ }
1111
+ if (code) {
1112
+ return MoreInfoEntryValue + ' Code';
1113
+ }
1114
+ return MoreInfoEntryValue;
1115
+ };
1097
1116
  const getMoreInfoEntryValueVirtualDom = item => {
1098
1117
  const {
1099
1118
  value,
1100
- onClick
1119
+ onClick,
1120
+ code
1101
1121
  } = item;
1102
- const valueTag = onClick ? A$1 : Div$1;
1103
- let valueClassName = MoreInfoEntryValue;
1104
- if (onClick) {
1105
- valueClassName += ' Link';
1106
- }
1122
+ const type = getTag(onClick, code);
1123
+ const className = getClassName(onClick, code);
1107
1124
  return [{
1108
- type: valueTag,
1109
- className: valueClassName,
1125
+ type: type,
1126
+ className,
1110
1127
  childCount: 1,
1111
1128
  onClick
1112
1129
  }, text(value)];
1113
1130
  };
1114
1131
 
1132
+ const parentNodeEven = {
1133
+ type: Div$1,
1134
+ className: MoreInfoEntry,
1135
+ childCount: 2
1136
+ };
1137
+ const parentNodeOdd = {
1138
+ type: Div$1,
1139
+ className: MoreInfoEntry + ' ' + 'MoreInfoEntryOdd',
1140
+ childCount: 2
1141
+ };
1115
1142
  const getMoreInfoEntryVirtualDom = item => {
1116
- return [{
1117
- type: Div$1,
1118
- className: MoreInfoEntry,
1119
- childCount: 2
1120
- }, ...getMoreInfoEntryKeyVirtualDom(item), ...getMoreInfoEntryValueVirtualDom(item)];
1143
+ const {
1144
+ odd
1145
+ } = item;
1146
+ const node = odd ? parentNodeOdd : parentNodeEven;
1147
+ return [node, ...getMoreInfoEntryKeyVirtualDom(item), ...getMoreInfoEntryValueVirtualDom(item)];
1121
1148
  };
1122
1149
 
1123
1150
  const getMoreInfoVirtualDom = items => {
@@ -1152,23 +1179,28 @@ const getAdditionalDetailsVirtualDom = (firstHeading, entries, secondHeading, se
1152
1179
  return [{
1153
1180
  type: Div$1,
1154
1181
  className: AdditionalDetails,
1182
+ tabIndex: 0,
1155
1183
  childCount: 4
1156
1184
  }, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
1157
1185
  };
1158
1186
 
1159
- const getInstallationEntries = displaySize => {
1187
+ const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
1160
1188
  const entries = [{
1161
1189
  key: 'Identifier',
1162
- value: 'abc'
1190
+ value: extensionId,
1191
+ odd: true,
1192
+ code: true
1163
1193
  }, {
1164
1194
  key: 'Version',
1165
- value: '1.9.5'
1195
+ value: extensionVersion,
1196
+ code: true
1166
1197
  }, {
1167
1198
  key: 'Last Updated',
1168
- value: 'n/a'
1199
+ value: 'n/a',
1200
+ odd: true
1169
1201
  }, {
1170
1202
  key: 'Size',
1171
- value: `${displaySize}`,
1203
+ value: displaySize,
1172
1204
  onClick: HandleClickSize
1173
1205
  }];
1174
1206
  return entries;
@@ -1623,6 +1655,17 @@ const getMarkdownVirtualDom = html => {
1623
1655
  return dom;
1624
1656
  };
1625
1657
 
1658
+ const getMarketplaceEntries = () => {
1659
+ return [{
1660
+ key: 'Published',
1661
+ value: 'n/a',
1662
+ odd: true
1663
+ }, {
1664
+ key: 'Last Released',
1665
+ value: 'n/a'
1666
+ }];
1667
+ };
1668
+
1626
1669
  const getVirtualDomChildCount = markdownDom => {
1627
1670
  const max = markdownDom.length - 1;
1628
1671
  let stack = [];
@@ -1636,19 +1679,13 @@ const getVirtualDomChildCount = markdownDom => {
1636
1679
  return stack.length;
1637
1680
  };
1638
1681
 
1639
- const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize) => {
1682
+ const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion) => {
1640
1683
  const markdownDom = getMarkdownVirtualDom(sanitizedReadmeHtml);
1641
1684
  const childCount = getVirtualDomChildCount(markdownDom);
1642
1685
  const firstHeading = 'Installation';
1643
- const entries = getInstallationEntries(displaySize);
1686
+ const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
1644
1687
  const secondHeading = 'Marketplace';
1645
- const secondEntries = [{
1646
- key: 'Published',
1647
- value: 'n/a'
1648
- }, {
1649
- key: 'Last Released',
1650
- value: 'n/a'
1651
- }];
1688
+ const secondEntries = getMarketplaceEntries();
1652
1689
  const thirdHeading = 'Categories';
1653
1690
  const categories = [{
1654
1691
  id: 'themes',
@@ -1752,10 +1789,10 @@ const ProgrammingLanguages = 'ProgrammingLanguages';
1752
1789
  const Settings = 'Settings';
1753
1790
  const Theme = 'Theme';
1754
1791
 
1755
- const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize) => {
1792
+ const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion) => {
1756
1793
  switch (selectedTab) {
1757
1794
  case Details:
1758
- return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize);
1795
+ return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion);
1759
1796
  case Features:
1760
1797
  return getFeaturesVirtualDom(features, themesHtml);
1761
1798
  case Changelog:
@@ -1884,13 +1921,15 @@ const getExtensionDetailVirtualDom = (extensionDetail, sanitizedReadmeHtml, sele
1884
1921
  const themesHtml = newState?.selectedFeatureMarkdownDom || '';
1885
1922
  const features = newState?.features || getFeatures();
1886
1923
  const size = newState.folderSize || 0;
1924
+ const extensionId = newState?.extension?.id || 'n/a';
1925
+ const extensionVersion = newState?.extension?.version || 'n/a';
1887
1926
  const displaySize = getDisplaySize(size);
1888
1927
  const tabs = getTabs(selectedTab);
1889
1928
  const dom = [{
1890
1929
  type: Div$1,
1891
1930
  className: mergeClassNames(Viewlet, ExtensionDetail),
1892
1931
  childCount: 3
1893
- }, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize)];
1932
+ }, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion)];
1894
1933
  return dom;
1895
1934
  };
1896
1935
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "keywords": [],
6
6
  "license": "MIT",