@lvce-editor/extension-detail-view 3.26.0 → 3.27.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,11 @@ const create$2 = () => {
933
931
  }
934
932
  };
935
933
  };
934
+ const terminate = () => {
935
+ globalThis.close();
936
+ };
937
+
938
+ const assetDir = '';
936
939
 
937
940
  const {
938
941
  get: get$1,
@@ -1021,11 +1024,18 @@ const i18nString = (key, placeholders = emptyObject) => {
1021
1024
  return key.replaceAll(RE_PLACEHOLDER, replacer);
1022
1025
  };
1023
1026
 
1027
+ const Installation = 'Installation';
1028
+ const Marketplace = 'Marketplace';
1029
+ const Categories$1 = 'Categories';
1030
+ const Resources$1 = 'Resources';
1031
+ const Changelog$2 = 'Changelog';
1024
1032
  const Commands$1 = 'Commands';
1025
1033
  const ContentSecurityPolicy = 'ContentSecurityPolicy';
1026
1034
  const Copy = 'Copy';
1035
+ const Details$1 = 'Details';
1027
1036
  const Disable = 'Disable';
1028
1037
  const Elements = 'Elements';
1038
+ const Features$2 = 'Features';
1029
1039
  const FileMatch = 'File Match';
1030
1040
  const None$1 = 'None';
1031
1041
  const Id = 'ID';
@@ -1044,12 +1054,33 @@ const Uninstall = 'Uninstall';
1044
1054
  const WebViews$1 = 'WebViews';
1045
1055
  const NotImplemented = 'Not Implemented';
1046
1056
 
1057
+ const installation = () => {
1058
+ return i18nString(Installation);
1059
+ };
1060
+ const marketplace = () => {
1061
+ return i18nString(Marketplace);
1062
+ };
1063
+ const categories = () => {
1064
+ return i18nString(Categories$1);
1065
+ };
1066
+ const resources = () => {
1067
+ return i18nString(Resources$1);
1068
+ };
1047
1069
  const copy = () => {
1048
1070
  return i18nString(Copy);
1049
1071
  };
1072
+ const changelog = () => {
1073
+ return i18nString(Changelog$2);
1074
+ };
1075
+ const details = () => {
1076
+ return i18nString(Details$1);
1077
+ };
1050
1078
  const disable = () => {
1051
1079
  return i18nString(Disable);
1052
1080
  };
1081
+ const features = () => {
1082
+ return i18nString(Features$2);
1083
+ };
1053
1084
  const none = () => {
1054
1085
  return i18nString(None$1);
1055
1086
  };
@@ -1452,6 +1483,10 @@ const handleTabsClick = (state, name) => {
1452
1483
  return selectTab(state, name);
1453
1484
  };
1454
1485
 
1486
+ const initialize = async () => {
1487
+ // TODO create connection to file system worker
1488
+ };
1489
+
1455
1490
  const isLanguageBasicsExtension = extension => {
1456
1491
  return extension.name && extension.name.startsWith('Language Basics');
1457
1492
  };
@@ -1620,14 +1655,6 @@ const getViewletSize = width => {
1620
1655
  };
1621
1656
 
1622
1657
  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
1658
  return readFile$1(uri);
1632
1659
  };
1633
1660
 
@@ -1650,6 +1677,8 @@ const loadReadmeContent = async path => {
1650
1677
  if (isEnoentError(error)) {
1651
1678
  return '';
1652
1679
  }
1680
+ // TODO send message to error worker
1681
+ // @ts-ignore
1653
1682
  console.error(new VError(error, 'Failed to load Readme content'));
1654
1683
  return `${error}`;
1655
1684
  }
@@ -1779,10 +1808,12 @@ const Img = 17;
1779
1808
  const H2 = 22;
1780
1809
  const Pre = 51;
1781
1810
  const A = 53;
1811
+ const Code$1 = 65;
1782
1812
  const VirtualDomElements = {
1783
1813
  __proto__: null,
1784
1814
  A,
1785
1815
  Button: Button$1,
1816
+ Code: Code$1,
1786
1817
  Div,
1787
1818
  H1,
1788
1819
  H2,
@@ -2130,6 +2161,13 @@ const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, ent
2130
2161
  }, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
2131
2162
  };
2132
2163
 
2164
+ const getCategories = () => {
2165
+ return [{
2166
+ id: 'themes',
2167
+ label: 'Themes'
2168
+ }];
2169
+ };
2170
+
2133
2171
  const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
2134
2172
  const entries = [{
2135
2173
  key: 'Identifier',
@@ -2169,18 +2207,8 @@ const getMarketplaceEntries = () => {
2169
2207
  }];
2170
2208
  };
2171
2209
 
2172
- const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width) => {
2173
- const firstHeading = 'Installation';
2174
- const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
2175
- const secondHeading = 'Marketplace';
2176
- const secondEntries = getMarketplaceEntries();
2177
- const thirdHeading = 'Categories';
2178
- const categories = [{
2179
- id: 'themes',
2180
- label: 'Themes'
2181
- }];
2182
- const fourthHeading = 'Resources';
2183
- const resources = [{
2210
+ const getResources = () => {
2211
+ return [{
2184
2212
  label: 'Marketplace',
2185
2213
  url: '#'
2186
2214
  }, {
@@ -2193,6 +2221,17 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
2193
2221
  label: 'License',
2194
2222
  url: '#'
2195
2223
  }];
2224
+ };
2225
+
2226
+ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width) => {
2227
+ const firstHeading = installation();
2228
+ const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
2229
+ const secondHeading = marketplace();
2230
+ const secondEntries = getMarketplaceEntries();
2231
+ const thirdHeading = categories();
2232
+ const categories$1 = getCategories();
2233
+ const fourthHeading = resources();
2234
+ const resources$1 = getResources();
2196
2235
  const showAdditionalDetailsBreakpoint = 600;
2197
2236
  const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
2198
2237
  const childCount = showAdditionalDetails ? 2 : 1;
@@ -2201,7 +2240,7 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
2201
2240
  className: ExtensionDetailPanel,
2202
2241
  childCount: childCount,
2203
2242
  role: Panel
2204
- }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources)];
2243
+ }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
2205
2244
  return dom;
2206
2245
  };
2207
2246
 
@@ -2255,8 +2294,7 @@ const getCellCodeVirtualDom = value => {
2255
2294
  className: TableCell,
2256
2295
  childCount: 1
2257
2296
  }, {
2258
- type: VirtualDomElements.Div,
2259
- // TODO use code tag
2297
+ type: VirtualDomElements.Code,
2260
2298
  childCount: 1
2261
2299
  }, text(value)];
2262
2300
  };
@@ -2420,11 +2458,11 @@ const getFeatureSettingsVirtualDom = extension => {
2420
2458
  }, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
2421
2459
  };
2422
2460
 
2423
- const getVirtualDomChildCount = markdownDom => {
2424
- const max = markdownDom.length - 1;
2461
+ const getVirtualDomChildCount = dom => {
2462
+ const max = dom.length - 1;
2425
2463
  let stack = [];
2426
2464
  for (let i = max; i >= 0; i--) {
2427
- const element = markdownDom[i];
2465
+ const element = dom[i];
2428
2466
  if (element.childCount > 0) {
2429
2467
  stack = stack.slice(element.childCount);
2430
2468
  }
@@ -2675,15 +2713,15 @@ const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, b
2675
2713
 
2676
2714
  const getTabs = selectedTab => {
2677
2715
  const tabs = [{
2678
- label: 'Details',
2716
+ label: details(),
2679
2717
  name: Details,
2680
2718
  selected: selectedTab === Details
2681
2719
  }, {
2682
- label: 'Features',
2720
+ label: features(),
2683
2721
  name: Features$1,
2684
2722
  selected: selectedTab === Features$1
2685
2723
  }, {
2686
- label: 'Changelog',
2724
+ label: changelog(),
2687
2725
  name: Changelog$1,
2688
2726
  selected: selectedTab === Changelog$1
2689
2727
  }];
@@ -2735,7 +2773,7 @@ const getClassNames = size => {
2735
2773
  }
2736
2774
  };
2737
2775
 
2738
- const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml, selectedTab, newState) => {
2776
+ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selectedTab) => {
2739
2777
  // TODO move this to view model so that rendering occurs like
2740
2778
  // 1. state
2741
2779
  // 2. view model
@@ -2758,7 +2796,7 @@ const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml
2758
2796
  name,
2759
2797
  iconSrc,
2760
2798
  description
2761
- } = extensionDetail;
2799
+ } = newState;
2762
2800
  const badge = '';
2763
2801
  const {
2764
2802
  settingsButtonEnabled
@@ -2772,7 +2810,7 @@ const getExtensionDetailVirtualDom = async (extensionDetail, sanitizedReadmeHtml
2772
2810
  };
2773
2811
 
2774
2812
  const renderDom = async (oldState, newState) => {
2775
- const dom = await getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab, newState);
2813
+ const dom = await getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab);
2776
2814
  return ['Viewlet.setDom2', dom];
2777
2815
  };
2778
2816
 
@@ -2862,10 +2900,6 @@ const saveState = uid => {
2862
2900
  };
2863
2901
  };
2864
2902
 
2865
- const terminate = () => {
2866
- globalThis.close();
2867
- };
2868
-
2869
2903
  const commandMap = {
2870
2904
  'ExtensionDetail.create': create$1,
2871
2905
  'ExtensionDetail.diff2': diff2,
@@ -2886,7 +2920,8 @@ const commandMap = {
2886
2920
  'ExtensionDetail.resize': resize,
2887
2921
  'ExtensionDetail.saveState': saveState,
2888
2922
  'ExtensionDetail.selectTab': wrapCommand(selectTab),
2889
- 'ExtensionDetail.terminate': terminate
2923
+ 'ExtensionDetail.terminate': terminate,
2924
+ 'ExtensionDetail.initialize': initialize
2890
2925
  };
2891
2926
 
2892
2927
  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.27.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",