@lvce-editor/extension-detail-view 3.26.0 → 3.28.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.
@@ -873,8 +873,6 @@ const WebWorkerRpcClient = {
873
873
  create: create$3
874
874
  };
875
875
 
876
- const assetDir = '';
877
-
878
876
  const create$2 = () => {
879
877
  const states = Object.create(null);
880
878
  return {
@@ -933,6 +931,9 @@ const create$2 = () => {
933
931
  }
934
932
  };
935
933
  };
934
+ const terminate = () => {
935
+ globalThis.close();
936
+ };
936
937
 
937
938
  const {
938
939
  get: get$1,
@@ -941,7 +942,7 @@ const {
941
942
  wrapCommand
942
943
  } = create$2();
943
944
 
944
- const create$1 = (uid, uri, x, y, width, height, platform, assetDir$1) => {
945
+ const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
945
946
  const state = {
946
947
  description: '',
947
948
  iconSrc: '',
@@ -961,7 +962,7 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir$1) => {
961
962
  baseUrl: '',
962
963
  features: [],
963
964
  folderSize: 0,
964
- assetDir: assetDir$1 || assetDir,
965
+ assetDir: assetDir || '',
965
966
  platform,
966
967
  settingsButtonEnabled: false
967
968
  };
@@ -1021,11 +1022,18 @@ const i18nString = (key, placeholders = emptyObject) => {
1021
1022
  return key.replaceAll(RE_PLACEHOLDER, replacer);
1022
1023
  };
1023
1024
 
1025
+ const Installation = 'Installation';
1026
+ const Marketplace = 'Marketplace';
1027
+ const Categories$1 = 'Categories';
1028
+ const Resources$1 = 'Resources';
1029
+ const Changelog$2 = 'Changelog';
1024
1030
  const Commands$1 = 'Commands';
1025
1031
  const ContentSecurityPolicy = 'ContentSecurityPolicy';
1026
1032
  const Copy = 'Copy';
1033
+ const Details$1 = 'Details';
1027
1034
  const Disable = 'Disable';
1028
1035
  const Elements = 'Elements';
1036
+ const Features$2 = 'Features';
1029
1037
  const FileMatch = 'File Match';
1030
1038
  const None$1 = 'None';
1031
1039
  const Id = 'ID';
@@ -1044,12 +1052,33 @@ const Uninstall = 'Uninstall';
1044
1052
  const WebViews$1 = 'WebViews';
1045
1053
  const NotImplemented = 'Not Implemented';
1046
1054
 
1055
+ const installation = () => {
1056
+ return i18nString(Installation);
1057
+ };
1058
+ const marketplace = () => {
1059
+ return i18nString(Marketplace);
1060
+ };
1061
+ const categories = () => {
1062
+ return i18nString(Categories$1);
1063
+ };
1064
+ const resources = () => {
1065
+ return i18nString(Resources$1);
1066
+ };
1047
1067
  const copy = () => {
1048
1068
  return i18nString(Copy);
1049
1069
  };
1070
+ const changelog = () => {
1071
+ return i18nString(Changelog$2);
1072
+ };
1073
+ const details = () => {
1074
+ return i18nString(Details$1);
1075
+ };
1050
1076
  const disable = () => {
1051
1077
  return i18nString(Disable);
1052
1078
  };
1079
+ const features = () => {
1080
+ return i18nString(Features$2);
1081
+ };
1053
1082
  const none = () => {
1054
1083
  return i18nString(None$1);
1055
1084
  };
@@ -1452,6 +1481,11 @@ const handleTabsClick = (state, name) => {
1452
1481
  return selectTab(state, name);
1453
1482
  };
1454
1483
 
1484
+ const initialize = async () => {
1485
+ // TODO create connection to file system worker
1486
+ // TODO create direct connection to markdown worker
1487
+ };
1488
+
1455
1489
  const isLanguageBasicsExtension = extension => {
1456
1490
  return extension.name && extension.name.startsWith('Language Basics');
1457
1491
  };
@@ -1547,6 +1581,26 @@ const getBaseUrl = (extensionPath, platform) => {
1547
1581
  }
1548
1582
  };
1549
1583
 
1584
+ const getCategories = () => {
1585
+ return [{
1586
+ id: 'themes',
1587
+ label: 'Themes'
1588
+ }];
1589
+ };
1590
+
1591
+ const getEntries = () => {
1592
+ return [{
1593
+ key: 'Identifier',
1594
+ value: 'abc'
1595
+ }, {
1596
+ key: 'Version',
1597
+ value: '1.9.5'
1598
+ }, {
1599
+ key: 'Last Updated',
1600
+ value: 'n/a'
1601
+ }];
1602
+ };
1603
+
1550
1604
  const getExtensionIdFromUri = uri => {
1551
1605
  const id = uri.slice('extension-detail://'.length);
1552
1606
  return id;
@@ -1605,6 +1659,32 @@ const getFolderSize = async uri => {
1605
1659
  }
1606
1660
  };
1607
1661
 
1662
+ const getResources = () => {
1663
+ return [{
1664
+ label: 'Marketplace',
1665
+ url: '#'
1666
+ }, {
1667
+ label: 'Issues',
1668
+ url: '#'
1669
+ }, {
1670
+ label: 'Repository',
1671
+ url: '#'
1672
+ }, {
1673
+ label: 'License',
1674
+ url: '#'
1675
+ }];
1676
+ };
1677
+
1678
+ const getSecondEntries = () => {
1679
+ return [{
1680
+ key: 'Published',
1681
+ value: 'n/a'
1682
+ }, {
1683
+ key: 'Last Released',
1684
+ value: 'n/a'
1685
+ }];
1686
+ };
1687
+
1608
1688
  const Small$1 = 1;
1609
1689
  const Normal$1 = 2;
1610
1690
  const Large$1 = 3;
@@ -1620,14 +1700,6 @@ const getViewletSize = width => {
1620
1700
  };
1621
1701
 
1622
1702
  const readFile = async uri => {
1623
- if (uri.startsWith('http://') || uri.startsWith('https://')) {
1624
- const response = await fetch(uri);
1625
- if (!response.ok) {
1626
- throw new Error(response.statusText);
1627
- }
1628
- const result = await response.text();
1629
- return result;
1630
- }
1631
1703
  return readFile$1(uri);
1632
1704
  };
1633
1705
 
@@ -1650,6 +1722,8 @@ const loadReadmeContent = async path => {
1650
1722
  if (isEnoentError(error)) {
1651
1723
  return '';
1652
1724
  }
1725
+ // TODO send message to error worker
1726
+ // @ts-ignore
1653
1727
  console.error(new VError(error, 'Failed to load Readme content'));
1654
1728
  return `${error}`;
1655
1729
  }
@@ -1704,40 +1778,10 @@ const loadContent = async (state, platform, savedState) => {
1704
1778
  const features = getFeatures(selectedFeature, extension);
1705
1779
  const extensionUri = extension.uri || extension.path;
1706
1780
  const folderSize = await getFolderSize(extensionUri);
1707
- const entries = [{
1708
- key: 'Identifier',
1709
- value: 'abc'
1710
- }, {
1711
- key: 'Version',
1712
- value: '1.9.5'
1713
- }, {
1714
- key: 'Last Updated',
1715
- value: 'n/a'
1716
- }];
1717
- const secondEntries = [{
1718
- key: 'Published',
1719
- value: 'n/a'
1720
- }, {
1721
- key: 'Last Released',
1722
- value: 'n/a'
1723
- }];
1724
- const categories = [{
1725
- id: 'themes',
1726
- label: 'Themes'
1727
- }];
1728
- const resources = [{
1729
- label: 'Marketplace',
1730
- url: '#'
1731
- }, {
1732
- label: 'Issues',
1733
- url: '#'
1734
- }, {
1735
- label: 'Repository',
1736
- url: '#'
1737
- }, {
1738
- label: 'License',
1739
- url: '#'
1740
- }];
1781
+ const entries = getEntries();
1782
+ const secondEntries = getSecondEntries();
1783
+ const categories = getCategories();
1784
+ const resources = getResources();
1741
1785
  return {
1742
1786
  ...state,
1743
1787
  selectedTab,
@@ -1779,10 +1823,12 @@ const Img = 17;
1779
1823
  const H2 = 22;
1780
1824
  const Pre = 51;
1781
1825
  const A = 53;
1826
+ const Code$1 = 65;
1782
1827
  const VirtualDomElements = {
1783
1828
  __proto__: null,
1784
1829
  A,
1785
1830
  Button: Button$1,
1831
+ Code: Code$1,
1786
1832
  Div,
1787
1833
  H1,
1788
1834
  H2,
@@ -2170,29 +2216,14 @@ const getMarketplaceEntries = () => {
2170
2216
  };
2171
2217
 
2172
2218
  const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width) => {
2173
- const firstHeading = 'Installation';
2219
+ const firstHeading = installation();
2174
2220
  const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
2175
- const secondHeading = 'Marketplace';
2221
+ const secondHeading = marketplace();
2176
2222
  const secondEntries = getMarketplaceEntries();
2177
- const thirdHeading = 'Categories';
2178
- const categories = [{
2179
- id: 'themes',
2180
- label: 'Themes'
2181
- }];
2182
- const fourthHeading = 'Resources';
2183
- const resources = [{
2184
- label: 'Marketplace',
2185
- url: '#'
2186
- }, {
2187
- label: 'Issues',
2188
- url: '#'
2189
- }, {
2190
- label: 'Repository',
2191
- url: '#'
2192
- }, {
2193
- label: 'License',
2194
- url: '#'
2195
- }];
2223
+ const thirdHeading = categories();
2224
+ const categories$1 = getCategories();
2225
+ const fourthHeading = resources();
2226
+ const resources$1 = getResources();
2196
2227
  const showAdditionalDetailsBreakpoint = 600;
2197
2228
  const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
2198
2229
  const childCount = showAdditionalDetails ? 2 : 1;
@@ -2201,7 +2232,7 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
2201
2232
  className: ExtensionDetailPanel,
2202
2233
  childCount: childCount,
2203
2234
  role: Panel
2204
- }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources)];
2235
+ }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
2205
2236
  return dom;
2206
2237
  };
2207
2238
 
@@ -2255,8 +2286,7 @@ const getCellCodeVirtualDom = value => {
2255
2286
  className: TableCell,
2256
2287
  childCount: 1
2257
2288
  }, {
2258
- type: VirtualDomElements.Div,
2259
- // TODO use code tag
2289
+ type: VirtualDomElements.Code,
2260
2290
  childCount: 1
2261
2291
  }, text(value)];
2262
2292
  };
@@ -2420,11 +2450,11 @@ const getFeatureSettingsVirtualDom = extension => {
2420
2450
  }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
2421
2451
  };
2422
2452
 
2423
- const getVirtualDomChildCount = markdownDom => {
2424
- const max = markdownDom.length - 1;
2453
+ const getVirtualDomChildCount = dom => {
2454
+ const max = dom.length - 1;
2425
2455
  let stack = [];
2426
2456
  for (let i = max; i >= 0; i--) {
2427
- const element = markdownDom[i];
2457
+ const element = dom[i];
2428
2458
  if (element.childCount > 0) {
2429
2459
  stack = stack.slice(element.childCount);
2430
2460
  }
@@ -2675,15 +2705,15 @@ const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, b
2675
2705
 
2676
2706
  const getTabs = selectedTab => {
2677
2707
  const tabs = [{
2678
- label: 'Details',
2708
+ label: details(),
2679
2709
  name: Details,
2680
2710
  selected: selectedTab === Details
2681
2711
  }, {
2682
- label: 'Features',
2712
+ label: features(),
2683
2713
  name: Features$1,
2684
2714
  selected: selectedTab === Features$1
2685
2715
  }, {
2686
- label: 'Changelog',
2716
+ label: changelog(),
2687
2717
  name: Changelog$1,
2688
2718
  selected: selectedTab === Changelog$1
2689
2719
  }];
@@ -2735,7 +2765,7 @@ const getClassNames = size => {
2735
2765
  }
2736
2766
  };
2737
2767
 
2738
- const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml, selectedTab, newState) => {
2768
+ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selectedTab) => {
2739
2769
  // TODO move this to view model so that rendering occurs like
2740
2770
  // 1. state
2741
2771
  // 2. view model
@@ -2758,7 +2788,7 @@ const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml
2758
2788
  name,
2759
2789
  iconSrc,
2760
2790
  description
2761
- } = extensionDetail;
2791
+ } = newState;
2762
2792
  const badge = '';
2763
2793
  const {
2764
2794
  settingsButtonEnabled
@@ -2772,7 +2802,7 @@ const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml
2772
2802
  };
2773
2803
 
2774
2804
  const renderDom = async (oldState, newState) => {
2775
- const dom = await getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab, newState);
2805
+ const dom = await getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab);
2776
2806
  return ['Viewlet.setDom2', dom];
2777
2807
  };
2778
2808
 
@@ -2862,10 +2892,6 @@ const saveState = uid => {
2862
2892
  };
2863
2893
  };
2864
2894
 
2865
- const terminate = () => {
2866
- globalThis.close();
2867
- };
2868
-
2869
2895
  const commandMap = {
2870
2896
  'ExtensionDetail.create': create$1,
2871
2897
  'ExtensionDetail.diff2': diff2,
@@ -2886,7 +2912,8 @@ const commandMap = {
2886
2912
  'ExtensionDetail.resize': resize,
2887
2913
  'ExtensionDetail.saveState': saveState,
2888
2914
  'ExtensionDetail.selectTab': wrapCommand(selectTab),
2889
- 'ExtensionDetail.terminate': terminate
2915
+ 'ExtensionDetail.terminate': terminate,
2916
+ 'ExtensionDetail.initialize': initialize
2890
2917
  };
2891
2918
 
2892
2919
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.26.0",
3
+ "version": "3.28.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",