@lvce-editor/extension-detail-view 3.28.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,7 +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
|
-
|
|
967
|
+
readmeScrollTop: 0,
|
|
968
|
+
settingsButtonEnabled: false,
|
|
969
|
+
builtinExtensionsBadgeEnabled: true,
|
|
970
|
+
scrollToTopButtonEnabled: false
|
|
968
971
|
};
|
|
969
972
|
set$1(uid, state, state);
|
|
970
973
|
};
|
|
@@ -1004,7 +1007,7 @@ const dispose = uid => {
|
|
|
1004
1007
|
dispose$1(uid);
|
|
1005
1008
|
};
|
|
1006
1009
|
|
|
1007
|
-
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'];
|
|
1008
1011
|
|
|
1009
1012
|
const getCommandIds = () => {
|
|
1010
1013
|
return commandIds;
|
|
@@ -1217,6 +1220,13 @@ const handleClickFeatures = async (state, name) => {
|
|
|
1217
1220
|
return selectFeature(state, name);
|
|
1218
1221
|
};
|
|
1219
1222
|
|
|
1223
|
+
const handleClickScrollToTop = state => {
|
|
1224
|
+
return {
|
|
1225
|
+
...state,
|
|
1226
|
+
readmeScrollTop: 0
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1220
1230
|
const rpcs = Object.create(null);
|
|
1221
1231
|
const set$g = (id, rpc) => {
|
|
1222
1232
|
rpcs[id] = rpc;
|
|
@@ -1481,6 +1491,14 @@ const handleTabsClick = (state, name) => {
|
|
|
1481
1491
|
return selectTab(state, name);
|
|
1482
1492
|
};
|
|
1483
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
|
+
|
|
1484
1502
|
const initialize = async () => {
|
|
1485
1503
|
// TODO create connection to file system worker
|
|
1486
1504
|
// TODO create direct connection to markdown worker
|
|
@@ -1855,10 +1873,10 @@ const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
|
|
|
1855
1873
|
const Aside = 'Aside';
|
|
1856
1874
|
const Button = 'Button';
|
|
1857
1875
|
const ButtonPrimary = 'ButtonPrimary';
|
|
1858
|
-
const DefaultMarkdown = 'DefaultMarkdown';
|
|
1859
1876
|
const Categories = 'Categories';
|
|
1860
1877
|
const Category = 'Category';
|
|
1861
1878
|
const Changelog = 'Changelog';
|
|
1879
|
+
const DefaultMarkdown = 'DefaultMarkdown';
|
|
1862
1880
|
const DefinitionListItem = 'DefinitionListItem';
|
|
1863
1881
|
const DefinitionListItemHeading = 'DefinitionListItemHeading';
|
|
1864
1882
|
const DefinitionListItemValue = 'DefinitionListItemValue';
|
|
@@ -1869,9 +1887,8 @@ const ExtensionDetailHeaderActions = 'ExtensionDetailHeaderActions';
|
|
|
1869
1887
|
const ExtensionDetailHeaderDetails = 'ExtensionDetailHeaderDetails';
|
|
1870
1888
|
const ExtensionDetailIcon = 'ExtensionDetailIcon';
|
|
1871
1889
|
const ExtensionDetailName = 'ExtensionDetailName';
|
|
1890
|
+
const ExtensionDetailNameBadge = 'ExtensionDetailNameBadge';
|
|
1872
1891
|
const ExtensionDetailPanel = 'ExtensionDetailPanel';
|
|
1873
|
-
const SettingsButton = 'SettingsButton';
|
|
1874
|
-
const SettingsIcon = 'SettingsIcon';
|
|
1875
1892
|
const ExtensionDetailTab = 'ExtensionDetailTab';
|
|
1876
1893
|
const ExtensionDetailTabs = 'ExtensionDetailTabs';
|
|
1877
1894
|
const ExtensionDetailTabSelected = 'ExtensionDetailTabSelected';
|
|
@@ -1881,8 +1898,6 @@ const Features = 'Features';
|
|
|
1881
1898
|
const FeaturesList = 'FeaturesList';
|
|
1882
1899
|
const FeatureWebView = 'FeatureWebView';
|
|
1883
1900
|
const Large = 'Large';
|
|
1884
|
-
const Sash = 'Sash';
|
|
1885
|
-
const SashVertical = 'SashVertical';
|
|
1886
1901
|
const MoreInfo = 'MoreInfo';
|
|
1887
1902
|
const MoreInfoEntry = 'MoreInfoEntry';
|
|
1888
1903
|
const MoreInfoEntryKey = 'MoreInfoEntryKey';
|
|
@@ -1891,12 +1906,24 @@ const MoreInfoEntryValue = 'MoreInfoEntryValue';
|
|
|
1891
1906
|
const Normal = 'Normal';
|
|
1892
1907
|
const Resource = 'Resource';
|
|
1893
1908
|
const Resources = 'Resources';
|
|
1909
|
+
const Sash = 'Sash';
|
|
1910
|
+
const SashVertical = 'SashVertical';
|
|
1911
|
+
const ScrollToTopButton = 'ScrollToTopButton';
|
|
1912
|
+
const SettingsButton = 'SettingsButton';
|
|
1913
|
+
const SettingsIcon = 'SettingsIcon';
|
|
1894
1914
|
const Small = 'Small';
|
|
1895
1915
|
const Table = 'Table';
|
|
1896
1916
|
const TableCell = 'TableCell';
|
|
1897
1917
|
const TableHeading = 'TableHeading';
|
|
1898
1918
|
const Viewlet = 'Viewlet';
|
|
1899
1919
|
|
|
1920
|
+
const getBadge = (extension, state) => {
|
|
1921
|
+
if (extension?.builtin && state.builtinExtensionsBadgeEnabled) {
|
|
1922
|
+
return 'builtin';
|
|
1923
|
+
}
|
|
1924
|
+
return '';
|
|
1925
|
+
};
|
|
1926
|
+
|
|
1900
1927
|
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1901
1928
|
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
1902
1929
|
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
@@ -1991,6 +2018,7 @@ const getDisplaySize = size => {
|
|
|
1991
2018
|
};
|
|
1992
2019
|
|
|
1993
2020
|
const HandleClickDisable = 'handleClickDisable';
|
|
2021
|
+
const HandleClickScrollToTop = 'handleClickScrollToTop';
|
|
1994
2022
|
const HandleClickSetColorTheme = 'handleClickSetColorTheme';
|
|
1995
2023
|
const HandleClickSettings = 'handleClickSettings';
|
|
1996
2024
|
const HandleClickSize = 'handleClickSize';
|
|
@@ -1998,6 +2026,7 @@ const HandleClickUninstall = 'handleClickUninstall';
|
|
|
1998
2026
|
const HandleFeaturesClick = 'handleFeaturesClick';
|
|
1999
2027
|
const HandleIconError = 'handleIconError';
|
|
2000
2028
|
const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
2029
|
+
const HandleReadmeWheel = 'handleReadmeWheel';
|
|
2001
2030
|
const HandleTabsClick = 'handleTabsClick';
|
|
2002
2031
|
|
|
2003
2032
|
const hasColorThemes = extension => {
|
|
@@ -2101,7 +2130,8 @@ const getMoreInfoEntryValueVirtualDom = item => {
|
|
|
2101
2130
|
const {
|
|
2102
2131
|
value,
|
|
2103
2132
|
onClick,
|
|
2104
|
-
code
|
|
2133
|
+
code,
|
|
2134
|
+
title
|
|
2105
2135
|
} = item;
|
|
2106
2136
|
const type = getTag(onClick, code);
|
|
2107
2137
|
const className = getClassName(onClick, code);
|
|
@@ -2109,7 +2139,8 @@ const getMoreInfoEntryValueVirtualDom = item => {
|
|
|
2109
2139
|
type: type,
|
|
2110
2140
|
className,
|
|
2111
2141
|
childCount: 1,
|
|
2112
|
-
onClick
|
|
2142
|
+
onClick,
|
|
2143
|
+
title
|
|
2113
2144
|
}, text(value)];
|
|
2114
2145
|
};
|
|
2115
2146
|
|
|
@@ -2176,7 +2207,7 @@ const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, ent
|
|
|
2176
2207
|
}, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
|
|
2177
2208
|
};
|
|
2178
2209
|
|
|
2179
|
-
const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
|
|
2210
|
+
const getInstallationEntries = (displaySize, extensionId, extensionVersion, extensionUri) => {
|
|
2180
2211
|
const entries = [{
|
|
2181
2212
|
key: 'Identifier',
|
|
2182
2213
|
value: extensionId,
|
|
@@ -2193,7 +2224,8 @@ const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
|
|
|
2193
2224
|
}, {
|
|
2194
2225
|
key: 'Size',
|
|
2195
2226
|
value: displaySize,
|
|
2196
|
-
onClick: HandleClickSize
|
|
2227
|
+
onClick: HandleClickSize,
|
|
2228
|
+
title: extensionUri
|
|
2197
2229
|
}];
|
|
2198
2230
|
return entries;
|
|
2199
2231
|
};
|
|
@@ -2215,9 +2247,21 @@ const getMarketplaceEntries = () => {
|
|
|
2215
2247
|
}];
|
|
2216
2248
|
};
|
|
2217
2249
|
|
|
2218
|
-
const
|
|
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) => {
|
|
2219
2263
|
const firstHeading = installation();
|
|
2220
|
-
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
|
|
2264
|
+
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
|
|
2221
2265
|
const secondHeading = marketplace();
|
|
2222
2266
|
const secondEntries = getMarketplaceEntries();
|
|
2223
2267
|
const thirdHeading = categories();
|
|
@@ -2232,7 +2276,7 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
|
|
|
2232
2276
|
className: ExtensionDetailPanel,
|
|
2233
2277
|
childCount: childCount,
|
|
2234
2278
|
role: Panel
|
|
2235
|
-
}, ...(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)];
|
|
2236
2280
|
return dom;
|
|
2237
2281
|
};
|
|
2238
2282
|
|
|
@@ -2609,10 +2653,10 @@ const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, exte
|
|
|
2609
2653
|
}, ...(await getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension))];
|
|
2610
2654
|
};
|
|
2611
2655
|
|
|
2612
|
-
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) => {
|
|
2613
2657
|
switch (selectedTab) {
|
|
2614
2658
|
case Details:
|
|
2615
|
-
return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width);
|
|
2659
|
+
return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled);
|
|
2616
2660
|
case Features$1:
|
|
2617
2661
|
return await getFeaturesVirtualDom(features, themesHtml, selectedFeature, extension);
|
|
2618
2662
|
case Changelog$1:
|
|
@@ -2670,9 +2714,14 @@ const getExtensionDetailHeaderActionsVirtualDom = (buttonDefs, settingsButtonEna
|
|
|
2670
2714
|
};
|
|
2671
2715
|
|
|
2672
2716
|
const getNameBadgeVirtualDom = badge => {
|
|
2673
|
-
{
|
|
2717
|
+
if (!badge) {
|
|
2674
2718
|
return [];
|
|
2675
2719
|
}
|
|
2720
|
+
return [{
|
|
2721
|
+
type: VirtualDomElements.Span,
|
|
2722
|
+
className: ExtensionDetailNameBadge,
|
|
2723
|
+
childCount: 1
|
|
2724
|
+
}, text(badge)];
|
|
2676
2725
|
};
|
|
2677
2726
|
|
|
2678
2727
|
const getExtensionDetailNameVirtualDom = (name, badge) => {
|
|
@@ -2680,7 +2729,7 @@ const getExtensionDetailNameVirtualDom = (name, badge) => {
|
|
|
2680
2729
|
type: VirtualDomElements.Div,
|
|
2681
2730
|
className: ExtensionDetailName,
|
|
2682
2731
|
childCount: badge ? 2 : 1
|
|
2683
|
-
}, text(name), ...getNameBadgeVirtualDom()];
|
|
2732
|
+
}, text(name), ...getNameBadgeVirtualDom(badge)];
|
|
2684
2733
|
};
|
|
2685
2734
|
|
|
2686
2735
|
const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled) => {
|
|
@@ -2789,7 +2838,7 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
|
|
|
2789
2838
|
iconSrc,
|
|
2790
2839
|
description
|
|
2791
2840
|
} = newState;
|
|
2792
|
-
const badge =
|
|
2841
|
+
const badge = getBadge(extension, newState);
|
|
2793
2842
|
const {
|
|
2794
2843
|
settingsButtonEnabled
|
|
2795
2844
|
} = newState;
|
|
@@ -2797,7 +2846,7 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
|
|
|
2797
2846
|
type: VirtualDomElements.Div,
|
|
2798
2847
|
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
2799
2848
|
childCount: 3
|
|
2800
|
-
}, ...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))];
|
|
2801
2850
|
return dom;
|
|
2802
2851
|
};
|
|
2803
2852
|
|
|
@@ -2847,6 +2896,9 @@ const renderEventListeners = () => {
|
|
|
2847
2896
|
}, {
|
|
2848
2897
|
name: HandleReadmeContextMenu,
|
|
2849
2898
|
params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
|
|
2899
|
+
}, {
|
|
2900
|
+
name: HandleReadmeWheel,
|
|
2901
|
+
params: ['handleWheel', 'event.deltaX', 'event.deltaY']
|
|
2850
2902
|
}, {
|
|
2851
2903
|
name: HandleTabsClick,
|
|
2852
2904
|
params: ['handleTabsClick', 'event.target.name']
|
|
@@ -2859,6 +2911,9 @@ const renderEventListeners = () => {
|
|
|
2859
2911
|
}, {
|
|
2860
2912
|
name: HandleClickDisable,
|
|
2861
2913
|
params: ['handleClickDisable']
|
|
2914
|
+
}, {
|
|
2915
|
+
name: HandleClickScrollToTop,
|
|
2916
|
+
params: ['handleClickScrollToTop']
|
|
2862
2917
|
}, {
|
|
2863
2918
|
name: HandleClickSettings,
|
|
2864
2919
|
params: ['handleClickSettings']
|
|
@@ -2899,6 +2954,7 @@ const commandMap = {
|
|
|
2899
2954
|
'ExtensionDetail.getCommandIds': getCommandIds,
|
|
2900
2955
|
'ExtensionDetail.getMenuEntries': getMenuEntries,
|
|
2901
2956
|
'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
|
|
2957
|
+
'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
|
|
2902
2958
|
'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
|
|
2903
2959
|
'ExtensionDetail.handleClickSetColorTheme': wrapCommand(handleClickSetColorTheme),
|
|
2904
2960
|
'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
|
|
@@ -2906,6 +2962,7 @@ const commandMap = {
|
|
|
2906
2962
|
'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
|
|
2907
2963
|
'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
|
|
2908
2964
|
'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
|
|
2965
|
+
'ExtensionDetail.handleWheel': wrapCommand(handleWheel),
|
|
2909
2966
|
'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
|
|
2910
2967
|
'ExtensionDetail.render2': render2,
|
|
2911
2968
|
'ExtensionDetail.renderEventListeners': renderEventListeners,
|