@lvce-editor/extension-detail-view 3.29.0 → 3.30.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.
@@ -964,8 +964,10 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
964
964
  folderSize: 0,
965
965
  assetDir: assetDir || '',
966
966
  platform,
967
+ readmeScrollTop: 0,
967
968
  settingsButtonEnabled: false,
968
- builtinExtensionsBadgeEnabled: true
969
+ builtinExtensionsBadgeEnabled: true,
970
+ scrollToTopButtonEnabled: false
969
971
  };
970
972
  set$1(uid, state, state);
971
973
  };
@@ -1005,7 +1007,7 @@ const dispose = uid => {
1005
1007
  dispose$1(uid);
1006
1008
  };
1007
1009
 
1008
- const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
1010
+ const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickScrollToTop', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'handleWheel', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
1009
1011
 
1010
1012
  const getCommandIds = () => {
1011
1013
  return commandIds;
@@ -1218,6 +1220,13 @@ const handleClickFeatures = async (state, name) => {
1218
1220
  return selectFeature(state, name);
1219
1221
  };
1220
1222
 
1223
+ const handleClickScrollToTop = state => {
1224
+ return {
1225
+ ...state,
1226
+ readmeScrollTop: 0
1227
+ };
1228
+ };
1229
+
1221
1230
  const rpcs = Object.create(null);
1222
1231
  const set$g = (id, rpc) => {
1223
1232
  rpcs[id] = rpc;
@@ -1482,6 +1491,14 @@ const handleTabsClick = (state, name) => {
1482
1491
  return selectTab(state, name);
1483
1492
  };
1484
1493
 
1494
+ const handleWheel = (state, deltaX, deltaY) => {
1495
+ const newScrollTop = Math.max(0, state.readmeScrollTop + deltaY);
1496
+ return {
1497
+ ...state,
1498
+ readmeScrollTop: newScrollTop
1499
+ };
1500
+ };
1501
+
1485
1502
  const initialize = async () => {
1486
1503
  // TODO create connection to file system worker
1487
1504
  // TODO create direct connection to markdown worker
@@ -1856,10 +1873,10 @@ const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
1856
1873
  const Aside = 'Aside';
1857
1874
  const Button = 'Button';
1858
1875
  const ButtonPrimary = 'ButtonPrimary';
1859
- const DefaultMarkdown = 'DefaultMarkdown';
1860
1876
  const Categories = 'Categories';
1861
1877
  const Category = 'Category';
1862
1878
  const Changelog = 'Changelog';
1879
+ const DefaultMarkdown = 'DefaultMarkdown';
1863
1880
  const DefinitionListItem = 'DefinitionListItem';
1864
1881
  const DefinitionListItemHeading = 'DefinitionListItemHeading';
1865
1882
  const DefinitionListItemValue = 'DefinitionListItemValue';
@@ -1872,8 +1889,6 @@ const ExtensionDetailIcon = 'ExtensionDetailIcon';
1872
1889
  const ExtensionDetailName = 'ExtensionDetailName';
1873
1890
  const ExtensionDetailNameBadge = 'ExtensionDetailNameBadge';
1874
1891
  const ExtensionDetailPanel = 'ExtensionDetailPanel';
1875
- const SettingsButton = 'SettingsButton';
1876
- const SettingsIcon = 'SettingsIcon';
1877
1892
  const ExtensionDetailTab = 'ExtensionDetailTab';
1878
1893
  const ExtensionDetailTabs = 'ExtensionDetailTabs';
1879
1894
  const ExtensionDetailTabSelected = 'ExtensionDetailTabSelected';
@@ -1883,8 +1898,6 @@ const Features = 'Features';
1883
1898
  const FeaturesList = 'FeaturesList';
1884
1899
  const FeatureWebView = 'FeatureWebView';
1885
1900
  const Large = 'Large';
1886
- const Sash = 'Sash';
1887
- const SashVertical = 'SashVertical';
1888
1901
  const MoreInfo = 'MoreInfo';
1889
1902
  const MoreInfoEntry = 'MoreInfoEntry';
1890
1903
  const MoreInfoEntryKey = 'MoreInfoEntryKey';
@@ -1893,6 +1906,11 @@ const MoreInfoEntryValue = 'MoreInfoEntryValue';
1893
1906
  const Normal = 'Normal';
1894
1907
  const Resource = 'Resource';
1895
1908
  const Resources = 'Resources';
1909
+ const Sash = 'Sash';
1910
+ const SashVertical = 'SashVertical';
1911
+ const ScrollToTopButton = 'ScrollToTopButton';
1912
+ const SettingsButton = 'SettingsButton';
1913
+ const SettingsIcon = 'SettingsIcon';
1896
1914
  const Small = 'Small';
1897
1915
  const Table = 'Table';
1898
1916
  const TableCell = 'TableCell';
@@ -2000,6 +2018,7 @@ const getDisplaySize = size => {
2000
2018
  };
2001
2019
 
2002
2020
  const HandleClickDisable = 'handleClickDisable';
2021
+ const HandleClickScrollToTop = 'handleClickScrollToTop';
2003
2022
  const HandleClickSetColorTheme = 'handleClickSetColorTheme';
2004
2023
  const HandleClickSettings = 'handleClickSettings';
2005
2024
  const HandleClickSize = 'handleClickSize';
@@ -2007,6 +2026,7 @@ const HandleClickUninstall = 'handleClickUninstall';
2007
2026
  const HandleFeaturesClick = 'handleFeaturesClick';
2008
2027
  const HandleIconError = 'handleIconError';
2009
2028
  const HandleReadmeContextMenu = 'handleReadmeContextMenu';
2029
+ const HandleReadmeWheel = 'handleReadmeWheel';
2010
2030
  const HandleTabsClick = 'handleTabsClick';
2011
2031
 
2012
2032
  const hasColorThemes = extension => {
@@ -2227,7 +2247,19 @@ const getMarketplaceEntries = () => {
2227
2247
  }];
2228
2248
  };
2229
2249
 
2230
- const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri) => {
2250
+ const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
2251
+ if (!scrollToTopButtonEnabled) {
2252
+ return [];
2253
+ }
2254
+ return [{
2255
+ type: VirtualDomElements.Button,
2256
+ className: ScrollToTopButton,
2257
+ childCount: 0,
2258
+ onClick: HandleClickScrollToTop
2259
+ }];
2260
+ };
2261
+
2262
+ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled) => {
2231
2263
  const firstHeading = installation();
2232
2264
  const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
2233
2265
  const secondHeading = marketplace();
@@ -2244,7 +2276,7 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
2244
2276
  className: ExtensionDetailPanel,
2245
2277
  childCount: childCount,
2246
2278
  role: Panel
2247
- }, ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
2279
+ }, ...getScrollToTopVirtualDom(scrollToTopButtonEnabled), ...(await getMarkdownVirtualDom(sanitizedReadmeHtml)), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
2248
2280
  return dom;
2249
2281
  };
2250
2282
 
@@ -2621,10 +2653,10 @@ const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, exte
2621
2653
  }, ...(await getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension))];
2622
2654
  };
2623
2655
 
2624
- const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width) => {
2656
+ const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled) => {
2625
2657
  switch (selectedTab) {
2626
2658
  case Details:
2627
- return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '');
2659
+ return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled);
2628
2660
  case Features$1:
2629
2661
  return await getFeaturesVirtualDom(features, themesHtml, selectedFeature, extension);
2630
2662
  case Changelog$1:
@@ -2814,7 +2846,7 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
2814
2846
  type: VirtualDomElements.Div,
2815
2847
  className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
2816
2848
  childCount: 3
2817
- }, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width))];
2849
+ }, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, newState.scrollToTopButtonEnabled))];
2818
2850
  return dom;
2819
2851
  };
2820
2852
 
@@ -2864,6 +2896,9 @@ const renderEventListeners = () => {
2864
2896
  }, {
2865
2897
  name: HandleReadmeContextMenu,
2866
2898
  params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
2899
+ }, {
2900
+ name: HandleReadmeWheel,
2901
+ params: ['handleWheel', 'event.deltaX', 'event.deltaY']
2867
2902
  }, {
2868
2903
  name: HandleTabsClick,
2869
2904
  params: ['handleTabsClick', 'event.target.name']
@@ -2876,6 +2911,9 @@ const renderEventListeners = () => {
2876
2911
  }, {
2877
2912
  name: HandleClickDisable,
2878
2913
  params: ['handleClickDisable']
2914
+ }, {
2915
+ name: HandleClickScrollToTop,
2916
+ params: ['handleClickScrollToTop']
2879
2917
  }, {
2880
2918
  name: HandleClickSettings,
2881
2919
  params: ['handleClickSettings']
@@ -2916,6 +2954,7 @@ const commandMap = {
2916
2954
  'ExtensionDetail.getCommandIds': getCommandIds,
2917
2955
  'ExtensionDetail.getMenuEntries': getMenuEntries,
2918
2956
  'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
2957
+ 'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
2919
2958
  'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
2920
2959
  'ExtensionDetail.handleClickSetColorTheme': wrapCommand(handleClickSetColorTheme),
2921
2960
  'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
@@ -2923,6 +2962,7 @@ const commandMap = {
2923
2962
  'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
2924
2963
  'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
2925
2964
  'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
2965
+ 'ExtensionDetail.handleWheel': wrapCommand(handleWheel),
2926
2966
  'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
2927
2967
  'ExtensionDetail.render2': render2,
2928
2968
  'ExtensionDetail.renderEventListeners': renderEventListeners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.29.0",
3
+ "version": "3.30.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",