@lvce-editor/extension-detail-view 3.30.0 → 3.31.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.
|
@@ -1007,7 +1007,7 @@ const dispose = uid => {
|
|
|
1007
1007
|
dispose$1(uid);
|
|
1008
1008
|
};
|
|
1009
1009
|
|
|
1010
|
-
const commandIds = ['getMenuEntries', 'handleClickDisable', 'handleClickScrollToTop', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'handleWheel', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
|
|
1010
|
+
const commandIds = ['getMenuEntries', 'handleClickCategory', 'handleClickDisable', 'handleClickScrollToTop', 'handleClickSettings', 'handleClickSetColorTheme', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleTabsClick', 'handleWheel', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
|
|
1011
1011
|
|
|
1012
1012
|
const getCommandIds = () => {
|
|
1013
1013
|
return commandIds;
|
|
@@ -1034,7 +1034,7 @@ const Commands$1 = 'Commands';
|
|
|
1034
1034
|
const ContentSecurityPolicy = 'ContentSecurityPolicy';
|
|
1035
1035
|
const Copy = 'Copy';
|
|
1036
1036
|
const Details$1 = 'Details';
|
|
1037
|
-
const Disable = 'Disable';
|
|
1037
|
+
const Disable$1 = 'Disable';
|
|
1038
1038
|
const Elements = 'Elements';
|
|
1039
1039
|
const Features$2 = 'Features';
|
|
1040
1040
|
const FileMatch = 'File Match';
|
|
@@ -1047,11 +1047,12 @@ const OpenInNewTab = 'Open in New Tab';
|
|
|
1047
1047
|
const ProgrammingLanguages$1 = 'Programming Languages';
|
|
1048
1048
|
const SaveImageAs = 'Save Image as';
|
|
1049
1049
|
const Schema = 'Schema';
|
|
1050
|
+
const ScrollToTop = 'Scroll to top';
|
|
1050
1051
|
const Selector = 'Selector';
|
|
1051
1052
|
const Settings$1 = 'Settings';
|
|
1052
|
-
const SetColorTheme = 'Set Color Theme';
|
|
1053
|
+
const SetColorTheme$1 = 'Set Color Theme';
|
|
1053
1054
|
const Theme$1 = 'Theme';
|
|
1054
|
-
const Uninstall = 'Uninstall';
|
|
1055
|
+
const Uninstall$1 = 'Uninstall';
|
|
1055
1056
|
const WebViews$1 = 'WebViews';
|
|
1056
1057
|
const NotImplemented = 'Not Implemented';
|
|
1057
1058
|
|
|
@@ -1077,7 +1078,7 @@ const details = () => {
|
|
|
1077
1078
|
return i18nString(Details$1);
|
|
1078
1079
|
};
|
|
1079
1080
|
const disable = () => {
|
|
1080
|
-
return i18nString(Disable);
|
|
1081
|
+
return i18nString(Disable$1);
|
|
1081
1082
|
};
|
|
1082
1083
|
const features = () => {
|
|
1083
1084
|
return i18nString(Features$2);
|
|
@@ -1104,7 +1105,7 @@ const schema = () => {
|
|
|
1104
1105
|
return i18nString(Schema);
|
|
1105
1106
|
};
|
|
1106
1107
|
const setColorTheme$3 = () => {
|
|
1107
|
-
return i18nString(SetColorTheme);
|
|
1108
|
+
return i18nString(SetColorTheme$1);
|
|
1108
1109
|
};
|
|
1109
1110
|
const theme = () => {
|
|
1110
1111
|
return i18nString(Theme$1);
|
|
@@ -1140,7 +1141,10 @@ const notImplemented = () => {
|
|
|
1140
1141
|
return i18nString(NotImplemented);
|
|
1141
1142
|
};
|
|
1142
1143
|
const uninstall = () => {
|
|
1143
|
-
return i18nString(Uninstall);
|
|
1144
|
+
return i18nString(Uninstall$1);
|
|
1145
|
+
};
|
|
1146
|
+
const scrollToTop = () => {
|
|
1147
|
+
return i18nString(ScrollToTop);
|
|
1144
1148
|
};
|
|
1145
1149
|
|
|
1146
1150
|
const None = 0;
|
|
@@ -1186,6 +1190,11 @@ const getLinkMenuEntries = props => {
|
|
|
1186
1190
|
|
|
1187
1191
|
const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
|
|
1188
1192
|
|
|
1193
|
+
const handleClickCategory = async (state, categoryId) => {
|
|
1194
|
+
// TODO: Implement category click functionality
|
|
1195
|
+
return state;
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1189
1198
|
const handleClickDisable = async state => {
|
|
1190
1199
|
return state;
|
|
1191
1200
|
};
|
|
@@ -1389,6 +1398,9 @@ const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
|
1389
1398
|
const Settings = 'Settings';
|
|
1390
1399
|
const WebViews = 'WebViews';
|
|
1391
1400
|
const Theme = 'Theme';
|
|
1401
|
+
const SetColorTheme = 'SetColorTheme';
|
|
1402
|
+
const Disable = 'Disable';
|
|
1403
|
+
const Uninstall = 'Uninstall';
|
|
1392
1404
|
|
|
1393
1405
|
const selectTabChangelog = async state => {
|
|
1394
1406
|
return {
|
|
@@ -1778,6 +1790,9 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1778
1790
|
} = state;
|
|
1779
1791
|
const id = getExtensionIdFromUri(uri);
|
|
1780
1792
|
const extension = await getExtension(id, platform);
|
|
1793
|
+
if (!extension) {
|
|
1794
|
+
throw new Error(`extension not found: ${id}`);
|
|
1795
|
+
}
|
|
1781
1796
|
const readmeContent = await loadReadmeContent(extension.path);
|
|
1782
1797
|
const baseUrl = getBaseUrl(extension.path, platform);
|
|
1783
1798
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
@@ -1841,12 +1856,12 @@ const Img = 17;
|
|
|
1841
1856
|
const H2 = 22;
|
|
1842
1857
|
const Pre = 51;
|
|
1843
1858
|
const A = 53;
|
|
1844
|
-
const Code$
|
|
1859
|
+
const Code$2 = 65;
|
|
1845
1860
|
const VirtualDomElements = {
|
|
1846
1861
|
__proto__: null,
|
|
1847
1862
|
A,
|
|
1848
1863
|
Button: Button$1,
|
|
1849
|
-
Code: Code$
|
|
1864
|
+
Code: Code$2,
|
|
1850
1865
|
Div,
|
|
1851
1866
|
H1,
|
|
1852
1867
|
H2,
|
|
@@ -1876,6 +1891,7 @@ const ButtonPrimary = 'ButtonPrimary';
|
|
|
1876
1891
|
const Categories = 'Categories';
|
|
1877
1892
|
const Category = 'Category';
|
|
1878
1893
|
const Changelog = 'Changelog';
|
|
1894
|
+
const Code$1 = 'Code';
|
|
1879
1895
|
const DefaultMarkdown = 'DefaultMarkdown';
|
|
1880
1896
|
const DefinitionListItem = 'DefinitionListItem';
|
|
1881
1897
|
const DefinitionListItemHeading = 'DefinitionListItemHeading';
|
|
@@ -1898,6 +1914,7 @@ const Features = 'Features';
|
|
|
1898
1914
|
const FeaturesList = 'FeaturesList';
|
|
1899
1915
|
const FeatureWebView = 'FeatureWebView';
|
|
1900
1916
|
const Large = 'Large';
|
|
1917
|
+
const Link = 'Link';
|
|
1901
1918
|
const MoreInfo = 'MoreInfo';
|
|
1902
1919
|
const MoreInfoEntry = 'MoreInfoEntry';
|
|
1903
1920
|
const MoreInfoEntryKey = 'MoreInfoEntryKey';
|
|
@@ -2017,6 +2034,7 @@ const getDisplaySize = size => {
|
|
|
2017
2034
|
});
|
|
2018
2035
|
};
|
|
2019
2036
|
|
|
2037
|
+
const HandleClickCategory = 'handleClickCategory';
|
|
2020
2038
|
const HandleClickDisable = 'handleClickDisable';
|
|
2021
2039
|
const HandleClickScrollToTop = 'handleClickScrollToTop';
|
|
2022
2040
|
const HandleClickSetColorTheme = 'handleClickSetColorTheme';
|
|
@@ -2037,15 +2055,18 @@ const getExtensionDetailButtons = extension => {
|
|
|
2037
2055
|
const allActions = [{
|
|
2038
2056
|
label: setColorTheme$3(),
|
|
2039
2057
|
onClick: HandleClickSetColorTheme,
|
|
2040
|
-
enabled: hasColorThemes(extension)
|
|
2058
|
+
enabled: hasColorThemes(extension),
|
|
2059
|
+
name: SetColorTheme
|
|
2041
2060
|
}, {
|
|
2042
2061
|
label: disable(),
|
|
2043
2062
|
onClick: HandleClickDisable,
|
|
2044
|
-
enabled: true
|
|
2063
|
+
enabled: true,
|
|
2064
|
+
name: Disable
|
|
2045
2065
|
}, {
|
|
2046
2066
|
label: uninstall(),
|
|
2047
2067
|
onClick: HandleClickUninstall,
|
|
2048
|
-
enabled: !extension?.builtin
|
|
2068
|
+
enabled: !extension?.builtin,
|
|
2069
|
+
name: Uninstall
|
|
2049
2070
|
}];
|
|
2050
2071
|
return allActions;
|
|
2051
2072
|
};
|
|
@@ -2078,12 +2099,15 @@ const getAdditionalDetailsEntryVirtualDom = (heading, items, renderer) => {
|
|
|
2078
2099
|
|
|
2079
2100
|
const getCategoryVirtualDom = category => {
|
|
2080
2101
|
const {
|
|
2102
|
+
id,
|
|
2081
2103
|
label
|
|
2082
2104
|
} = category;
|
|
2083
2105
|
return [{
|
|
2084
|
-
type: VirtualDomElements.
|
|
2106
|
+
type: VirtualDomElements.Button,
|
|
2085
2107
|
className: Category,
|
|
2086
|
-
childCount: 1
|
|
2108
|
+
childCount: 1,
|
|
2109
|
+
onClick: HandleClickCategory,
|
|
2110
|
+
name: id
|
|
2087
2111
|
}, text(label)];
|
|
2088
2112
|
};
|
|
2089
2113
|
|
|
@@ -2112,17 +2136,16 @@ const getTag = (onClick, code) => {
|
|
|
2112
2136
|
return VirtualDomElements.A;
|
|
2113
2137
|
}
|
|
2114
2138
|
if (code) {
|
|
2115
|
-
|
|
2116
|
-
return VirtualDomElements.Div;
|
|
2139
|
+
return VirtualDomElements.Code;
|
|
2117
2140
|
}
|
|
2118
2141
|
return VirtualDomElements.Div;
|
|
2119
2142
|
};
|
|
2120
2143
|
const getClassName = (onClick, code) => {
|
|
2121
2144
|
if (onClick) {
|
|
2122
|
-
return MoreInfoEntryValue
|
|
2145
|
+
return mergeClassNames(MoreInfoEntryValue, Link);
|
|
2123
2146
|
}
|
|
2124
2147
|
if (code) {
|
|
2125
|
-
return MoreInfoEntryValue
|
|
2148
|
+
return mergeClassNames(MoreInfoEntryValue, Code$1);
|
|
2126
2149
|
}
|
|
2127
2150
|
return MoreInfoEntryValue;
|
|
2128
2151
|
};
|
|
@@ -2255,22 +2278,32 @@ const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
|
|
|
2255
2278
|
type: VirtualDomElements.Button,
|
|
2256
2279
|
className: ScrollToTopButton,
|
|
2257
2280
|
childCount: 0,
|
|
2258
|
-
onClick: HandleClickScrollToTop
|
|
2281
|
+
onClick: HandleClickScrollToTop,
|
|
2282
|
+
ariaLabel: scrollToTop(),
|
|
2283
|
+
name: 'scrolltotop'
|
|
2259
2284
|
}];
|
|
2260
2285
|
};
|
|
2261
2286
|
|
|
2262
|
-
const
|
|
2287
|
+
const getChildCount = (additionalDetails, scrollToTopEnabled) => {
|
|
2288
|
+
let count = 1;
|
|
2289
|
+
if (additionalDetails) {
|
|
2290
|
+
count++;
|
|
2291
|
+
}
|
|
2292
|
+
if (scrollToTopEnabled) {
|
|
2293
|
+
count++;
|
|
2294
|
+
}
|
|
2295
|
+
return count;
|
|
2296
|
+
};
|
|
2297
|
+
const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled, categories$1, resources$1) => {
|
|
2263
2298
|
const firstHeading = installation();
|
|
2264
2299
|
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
|
|
2265
2300
|
const secondHeading = marketplace();
|
|
2266
2301
|
const secondEntries = getMarketplaceEntries();
|
|
2267
2302
|
const thirdHeading = categories();
|
|
2268
|
-
const categories$1 = getCategories();
|
|
2269
2303
|
const fourthHeading = resources();
|
|
2270
|
-
const resources$1 = getResources();
|
|
2271
2304
|
const showAdditionalDetailsBreakpoint = 600;
|
|
2272
2305
|
const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
|
|
2273
|
-
const childCount = showAdditionalDetails
|
|
2306
|
+
const childCount = getChildCount(showAdditionalDetails, scrollToTopButtonEnabled);
|
|
2274
2307
|
const dom = [{
|
|
2275
2308
|
type: VirtualDomElements.Div,
|
|
2276
2309
|
className: ExtensionDetailPanel,
|
|
@@ -2653,10 +2686,10 @@ const getFeaturesVirtualDom = async (features, themesHtml, selectedFeature, exte
|
|
|
2653
2686
|
}, ...(await getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension))];
|
|
2654
2687
|
};
|
|
2655
2688
|
|
|
2656
|
-
const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled) => {
|
|
2689
|
+
const getExtensionDetailContentVirtualDom = async (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled, categories, resources) => {
|
|
2657
2690
|
switch (selectedTab) {
|
|
2658
2691
|
case Details:
|
|
2659
|
-
return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled);
|
|
2692
|
+
return await getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled, categories, resources);
|
|
2660
2693
|
case Features$1:
|
|
2661
2694
|
return await getFeaturesVirtualDom(features, themesHtml, selectedFeature, extension);
|
|
2662
2695
|
case Changelog$1:
|
|
@@ -2674,11 +2707,12 @@ const getExtensionDetailDescriptionVirtualDom = description => {
|
|
|
2674
2707
|
}, text(description)];
|
|
2675
2708
|
};
|
|
2676
2709
|
|
|
2677
|
-
const getButtonVirtualDom = (message, onClick) => {
|
|
2710
|
+
const getButtonVirtualDom = (message, onClick, name) => {
|
|
2678
2711
|
return [{
|
|
2679
2712
|
type: VirtualDomElements.Button,
|
|
2680
2713
|
className: mergeClassNames(Button, ButtonPrimary),
|
|
2681
2714
|
onClick,
|
|
2715
|
+
name,
|
|
2682
2716
|
childCount: 1
|
|
2683
2717
|
}, text(message)];
|
|
2684
2718
|
};
|
|
@@ -2692,7 +2726,8 @@ const getSettingsButtonVirtualDom = enabled => {
|
|
|
2692
2726
|
className: SettingsButton,
|
|
2693
2727
|
onClick: HandleClickSettings,
|
|
2694
2728
|
childCount: 1,
|
|
2695
|
-
title: 'Settings'
|
|
2729
|
+
title: 'Settings',
|
|
2730
|
+
name: Settings
|
|
2696
2731
|
}, {
|
|
2697
2732
|
type: VirtualDomElements.Span,
|
|
2698
2733
|
className: SettingsIcon,
|
|
@@ -2703,7 +2738,7 @@ const getSettingsButtonVirtualDom = enabled => {
|
|
|
2703
2738
|
|
|
2704
2739
|
const getExtensionDetailHeaderActionsVirtualDom = (buttonDefs, settingsButtonEnabled) => {
|
|
2705
2740
|
const enabledButtons = buttonDefs.filter(btn => btn.enabled);
|
|
2706
|
-
const buttons = enabledButtons.flatMap(btn => getButtonVirtualDom(btn.label, btn.onClick));
|
|
2741
|
+
const buttons = enabledButtons.flatMap(btn => getButtonVirtualDom(btn.label, btn.onClick, btn.name));
|
|
2707
2742
|
const settingsButton = getSettingsButtonVirtualDom(settingsButtonEnabled);
|
|
2708
2743
|
const dom = [{
|
|
2709
2744
|
type: VirtualDomElements.Div,
|
|
@@ -2846,7 +2881,7 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
|
|
|
2846
2881
|
type: VirtualDomElements.Div,
|
|
2847
2882
|
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
2848
2883
|
childCount: 3
|
|
2849
|
-
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, newState.scrollToTopButtonEnabled))];
|
|
2884
|
+
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...(await getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, newState.scrollToTopButtonEnabled, newState.categories, newState.resources))];
|
|
2850
2885
|
return dom;
|
|
2851
2886
|
};
|
|
2852
2887
|
|
|
@@ -2891,6 +2926,9 @@ const render2 = async (uid, diffResult) => {
|
|
|
2891
2926
|
|
|
2892
2927
|
const renderEventListeners = () => {
|
|
2893
2928
|
return [{
|
|
2929
|
+
name: HandleClickCategory,
|
|
2930
|
+
params: ['handleClickCategory', 'event.target.name']
|
|
2931
|
+
}, {
|
|
2894
2932
|
name: HandleIconError,
|
|
2895
2933
|
params: ['handleIconError']
|
|
2896
2934
|
}, {
|
|
@@ -2953,6 +2991,7 @@ const commandMap = {
|
|
|
2953
2991
|
'ExtensionDetail.dispose': dispose,
|
|
2954
2992
|
'ExtensionDetail.getCommandIds': getCommandIds,
|
|
2955
2993
|
'ExtensionDetail.getMenuEntries': getMenuEntries,
|
|
2994
|
+
'ExtensionDetail.handleClickCategory': wrapCommand(handleClickCategory),
|
|
2956
2995
|
'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
|
|
2957
2996
|
'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
|
|
2958
2997
|
'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
|