@lvce-editor/extension-detail-view 3.9.0 → 3.11.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.
- package/dist/extensionDetailViewWorkerMain.js +277 -106
- package/package.json +1 -1
|
@@ -439,9 +439,9 @@ const get$2 = id => {
|
|
|
439
439
|
const remove = id => {
|
|
440
440
|
delete callbacks[id];
|
|
441
441
|
};
|
|
442
|
-
let id = 0;
|
|
442
|
+
let id$1 = 0;
|
|
443
443
|
const create$3 = () => {
|
|
444
|
-
return ++id;
|
|
444
|
+
return ++id$1;
|
|
445
445
|
};
|
|
446
446
|
const registerPromise = () => {
|
|
447
447
|
const id = create$3();
|
|
@@ -874,7 +874,7 @@ const create = (uid, uri, width, height, platform) => {
|
|
|
874
874
|
name: '',
|
|
875
875
|
sanitizedReadmeHtml: '',
|
|
876
876
|
selectedTab: '',
|
|
877
|
-
|
|
877
|
+
sizeOnDisk: 0,
|
|
878
878
|
width,
|
|
879
879
|
uri,
|
|
880
880
|
entries: [],
|
|
@@ -894,15 +894,18 @@ const AdditionalDetails = 'AdditionalDetails';
|
|
|
894
894
|
const AdditionalDetailsEntry = 'AdditionalDetailsEntry';
|
|
895
895
|
const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
|
|
896
896
|
const Aside$2 = 'Aside';
|
|
897
|
+
const Button$1 = 'Button';
|
|
898
|
+
const ButtonPrimary = 'ButtonPrimary';
|
|
897
899
|
const Categories = 'Categories';
|
|
898
900
|
const Category = 'Category';
|
|
899
901
|
const Changelog$1 = 'Changelog';
|
|
900
|
-
const
|
|
901
|
-
const
|
|
902
|
+
const DefinitionListItem = 'DefinitionListItem';
|
|
903
|
+
const DefinitionListItemHeading = 'DefinitionListItemHeading';
|
|
904
|
+
const DefinitionListItemValue = 'DefinitionListItemValue';
|
|
902
905
|
const ExtensionDetail = 'ExtensionDetail';
|
|
903
|
-
const FeatureCommands = 'FeatureCommands';
|
|
904
906
|
const ExtensionDetailDescription = 'ExtensionDetailDescription';
|
|
905
907
|
const ExtensionDetailHeader = 'ExtensionDetailHeader';
|
|
908
|
+
const ExtensionDetailHeaderActions = 'ExtensionDetailHeaderActions';
|
|
906
909
|
const ExtensionDetailHeaderDetails = 'ExtensionDetailHeaderDetails';
|
|
907
910
|
const ExtensionDetailIcon = 'ExtensionDetailIcon';
|
|
908
911
|
const ExtensionDetailName = 'ExtensionDetailName';
|
|
@@ -911,15 +914,20 @@ const ExtensionDetailTab = 'ExtensionDetailTab';
|
|
|
911
914
|
const ExtensionDetailTabs = 'ExtensionDetailTabs';
|
|
912
915
|
const ExtensionDetailTabSelected = 'ExtensionDetailTabSelected';
|
|
913
916
|
const Feature = 'Feature';
|
|
917
|
+
const FeatureContent = 'FeatureContent';
|
|
914
918
|
const Features$1 = 'Features';
|
|
915
919
|
const FeaturesList = 'FeaturesList';
|
|
920
|
+
const FeatureWebView = 'FeatureWebView';
|
|
921
|
+
const Large$1 = 'Large';
|
|
916
922
|
const Markdown = 'Markdown';
|
|
917
923
|
const MoreInfo = 'MoreInfo';
|
|
918
924
|
const MoreInfoEntry = 'MoreInfoEntry';
|
|
919
925
|
const MoreInfoEntryKey = 'MoreInfoEntryKey';
|
|
920
926
|
const MoreInfoEntryValue = 'MoreInfoEntryValue';
|
|
927
|
+
const Normal$1 = 'Normal';
|
|
921
928
|
const Resource = 'Resource';
|
|
922
929
|
const Resources = 'Resources';
|
|
930
|
+
const Small$1 = 'Small';
|
|
923
931
|
const Table$1 = 'Table';
|
|
924
932
|
const Viewlet = 'Viewlet';
|
|
925
933
|
|
|
@@ -1057,11 +1065,6 @@ const TabList = 'tablist';
|
|
|
1057
1065
|
const Tab = 'tab';
|
|
1058
1066
|
const Panel = 'panel';
|
|
1059
1067
|
|
|
1060
|
-
const HandleClickSize = 'handleClickSize';
|
|
1061
|
-
const HandleFeaturesClick = 'handleFeaturesClick';
|
|
1062
|
-
const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
1063
|
-
const HandleTabsClick = 'handleTabsClick';
|
|
1064
|
-
|
|
1065
1068
|
const getAdditionalDetailsEntryVirtualDom = (heading, items, renderer) => {
|
|
1066
1069
|
return [{
|
|
1067
1070
|
type: Div$1,
|
|
@@ -1185,8 +1188,15 @@ const getResourcesVirtualDom = resources => {
|
|
|
1185
1188
|
}, ...resources.flatMap(getResourceVirtualDom)];
|
|
1186
1189
|
};
|
|
1187
1190
|
|
|
1188
|
-
const getAdditionalDetailsVirtualDom = (firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources) => {
|
|
1191
|
+
const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources) => {
|
|
1192
|
+
if (!showAdditionalDetails) {
|
|
1193
|
+
return [];
|
|
1194
|
+
}
|
|
1189
1195
|
return [{
|
|
1196
|
+
type: Div$1,
|
|
1197
|
+
className: Aside$2,
|
|
1198
|
+
childCount: 1
|
|
1199
|
+
}, {
|
|
1190
1200
|
type: Div$1,
|
|
1191
1201
|
className: AdditionalDetails,
|
|
1192
1202
|
tabIndex: 0,
|
|
@@ -1194,6 +1204,13 @@ const getAdditionalDetailsVirtualDom = (firstHeading, entries, secondHeading, se
|
|
|
1194
1204
|
}, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
|
|
1195
1205
|
};
|
|
1196
1206
|
|
|
1207
|
+
const HandleClickDisable = 'handleClickDisable';
|
|
1208
|
+
const HandleClickSize = 'handleClickSize';
|
|
1209
|
+
const HandleClickUninstall = 'handleClickUninstall';
|
|
1210
|
+
const HandleFeaturesClick = 'handleFeaturesClick';
|
|
1211
|
+
const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
1212
|
+
const HandleTabsClick = 'handleTabsClick';
|
|
1213
|
+
|
|
1197
1214
|
const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
|
|
1198
1215
|
const entries = [{
|
|
1199
1216
|
key: 'Identifier',
|
|
@@ -1218,6 +1235,19 @@ const getInstallationEntries = (displaySize, extensionId, extensionVersion) => {
|
|
|
1218
1235
|
|
|
1219
1236
|
const allowedMarkdownAttributes = ['src', 'id', 'className', 'title', 'alt', 'href', 'target', 'rel'];
|
|
1220
1237
|
|
|
1238
|
+
const getVirtualDomChildCount = markdownDom => {
|
|
1239
|
+
const max = markdownDom.length - 1;
|
|
1240
|
+
let stack = [];
|
|
1241
|
+
for (let i = max; i >= 0; i--) {
|
|
1242
|
+
const element = markdownDom[i];
|
|
1243
|
+
if (element.childCount > 0) {
|
|
1244
|
+
stack = stack.slice(element.childCount);
|
|
1245
|
+
}
|
|
1246
|
+
stack.unshift(element);
|
|
1247
|
+
}
|
|
1248
|
+
return stack.length;
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1221
1251
|
const Div = 'div';
|
|
1222
1252
|
const H1 = 'h1';
|
|
1223
1253
|
const H2 = 'h2';
|
|
@@ -1661,8 +1691,15 @@ const parseHtml = (html, allowedAttributes) => {
|
|
|
1661
1691
|
|
|
1662
1692
|
const getMarkdownVirtualDom = html => {
|
|
1663
1693
|
string(html);
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1694
|
+
const childDom = parseHtml(html, allowedMarkdownAttributes);
|
|
1695
|
+
const markdownChildCount = getVirtualDomChildCount(childDom);
|
|
1696
|
+
return [{
|
|
1697
|
+
type: Div$1,
|
|
1698
|
+
className: Markdown,
|
|
1699
|
+
role: Document,
|
|
1700
|
+
onContextMenu: HandleReadmeContextMenu,
|
|
1701
|
+
childCount: markdownChildCount
|
|
1702
|
+
}, ...childDom];
|
|
1666
1703
|
};
|
|
1667
1704
|
|
|
1668
1705
|
const getMarketplaceEntries = () => {
|
|
@@ -1676,22 +1713,7 @@ const getMarketplaceEntries = () => {
|
|
|
1676
1713
|
}];
|
|
1677
1714
|
};
|
|
1678
1715
|
|
|
1679
|
-
const
|
|
1680
|
-
const max = markdownDom.length - 1;
|
|
1681
|
-
let stack = [];
|
|
1682
|
-
for (let i = max; i >= 0; i--) {
|
|
1683
|
-
const element = markdownDom[i];
|
|
1684
|
-
if (element.childCount > 0) {
|
|
1685
|
-
stack = stack.slice(element.childCount);
|
|
1686
|
-
}
|
|
1687
|
-
stack.unshift(element);
|
|
1688
|
-
}
|
|
1689
|
-
return stack.length;
|
|
1690
|
-
};
|
|
1691
|
-
|
|
1692
|
-
const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion) => {
|
|
1693
|
-
const markdownDom = getMarkdownVirtualDom(sanitizedReadmeHtml);
|
|
1694
|
-
const childCount = getVirtualDomChildCount(markdownDom);
|
|
1716
|
+
const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width) => {
|
|
1695
1717
|
const firstHeading = 'Installation';
|
|
1696
1718
|
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion);
|
|
1697
1719
|
const secondHeading = 'Marketplace';
|
|
@@ -1715,22 +1737,15 @@ const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, ext
|
|
|
1715
1737
|
label: 'License',
|
|
1716
1738
|
url: '#'
|
|
1717
1739
|
}];
|
|
1740
|
+
const showAdditionalDetailsBreakpoint = 600;
|
|
1741
|
+
const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
|
|
1742
|
+
const childCount = showAdditionalDetails ? 2 : 1;
|
|
1718
1743
|
const dom = [{
|
|
1719
1744
|
type: Div$1,
|
|
1720
1745
|
className: ExtensionDetailPanel,
|
|
1721
|
-
childCount:
|
|
1746
|
+
childCount: childCount,
|
|
1722
1747
|
role: Panel
|
|
1723
|
-
},
|
|
1724
|
-
type: Div$1,
|
|
1725
|
-
className: Markdown,
|
|
1726
|
-
role: Document,
|
|
1727
|
-
onContextMenu: HandleReadmeContextMenu,
|
|
1728
|
-
childCount
|
|
1729
|
-
}, ...markdownDom, {
|
|
1730
|
-
type: Div$1,
|
|
1731
|
-
className: Aside$2,
|
|
1732
|
-
childCount: 1
|
|
1733
|
-
}, ...getAdditionalDetailsVirtualDom(firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources)];
|
|
1748
|
+
}, ...getMarkdownVirtualDom(sanitizedReadmeHtml), ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories, fourthHeading, resources)];
|
|
1734
1749
|
return dom;
|
|
1735
1750
|
};
|
|
1736
1751
|
|
|
@@ -1746,17 +1761,22 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
1746
1761
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1747
1762
|
};
|
|
1748
1763
|
|
|
1764
|
+
const Commands$1 = 'Commands';
|
|
1765
|
+
const ContentSecurityPolicy = 'ContentSecurityPolicy';
|
|
1749
1766
|
const Copy = 'Copy';
|
|
1750
|
-
const
|
|
1751
|
-
const OpenImageInNewTab = 'Open Image in New Tab';
|
|
1752
|
-
const SaveImageAs = 'Save Image as';
|
|
1767
|
+
const Elements = 'Elements';
|
|
1753
1768
|
const FileMatch = 'File Match';
|
|
1754
|
-
const
|
|
1755
|
-
const Theme$1 = 'Theme';
|
|
1756
|
-
const Commands$1 = 'Commands';
|
|
1769
|
+
const Id = 'ID';
|
|
1757
1770
|
const JsonValidation$1 = 'Json Validation';
|
|
1771
|
+
const OpenImageInNewTab = 'Open Image in New Tab';
|
|
1772
|
+
const OpenInNewTab = 'Open in New Tab';
|
|
1758
1773
|
const ProgrammingLanguages$1 = 'Programming Languages';
|
|
1774
|
+
const SaveImageAs = 'Save Image as';
|
|
1775
|
+
const Schema = 'Schema';
|
|
1776
|
+
const Selector = 'Selector';
|
|
1759
1777
|
const Settings$1 = 'Settings';
|
|
1778
|
+
const Theme$1 = 'Theme';
|
|
1779
|
+
const WebViews$1 = 'WebViews';
|
|
1760
1780
|
|
|
1761
1781
|
const copy = () => {
|
|
1762
1782
|
return i18nString(Copy);
|
|
@@ -1782,6 +1802,9 @@ const theme = () => {
|
|
|
1782
1802
|
const commands = () => {
|
|
1783
1803
|
return i18nString(Commands$1);
|
|
1784
1804
|
};
|
|
1805
|
+
const webViews = () => {
|
|
1806
|
+
return i18nString(WebViews$1);
|
|
1807
|
+
};
|
|
1785
1808
|
const jsonValidation = () => {
|
|
1786
1809
|
return i18nString(JsonValidation$1);
|
|
1787
1810
|
};
|
|
@@ -1791,6 +1814,18 @@ const programmingLanguages = () => {
|
|
|
1791
1814
|
const settings = () => {
|
|
1792
1815
|
return i18nString(Settings$1);
|
|
1793
1816
|
};
|
|
1817
|
+
const id = () => {
|
|
1818
|
+
return i18nString(Id);
|
|
1819
|
+
};
|
|
1820
|
+
const selector = () => {
|
|
1821
|
+
return i18nString(Selector);
|
|
1822
|
+
};
|
|
1823
|
+
const contentSecurityPolicy = () => {
|
|
1824
|
+
return i18nString(ContentSecurityPolicy);
|
|
1825
|
+
};
|
|
1826
|
+
const elements = () => {
|
|
1827
|
+
return i18nString(Elements);
|
|
1828
|
+
};
|
|
1794
1829
|
|
|
1795
1830
|
const Text = 1;
|
|
1796
1831
|
const Code = 2;
|
|
@@ -1818,6 +1853,13 @@ const getCommandTableEntries = extension => {
|
|
|
1818
1853
|
};
|
|
1819
1854
|
};
|
|
1820
1855
|
|
|
1856
|
+
const getFeatureContentHeadingVirtualDom = heading => {
|
|
1857
|
+
return [{
|
|
1858
|
+
type: H1$1,
|
|
1859
|
+
childCount: 1
|
|
1860
|
+
}, text(heading)];
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1821
1863
|
const getCellCodeVirtualDom = value => {
|
|
1822
1864
|
return [{
|
|
1823
1865
|
type: Td,
|
|
@@ -1898,12 +1940,9 @@ const getFeatureCommandsVirtualDom = extension => {
|
|
|
1898
1940
|
const tableInfo = getCommandTableEntries(extension);
|
|
1899
1941
|
return [{
|
|
1900
1942
|
type: Div$1,
|
|
1901
|
-
className:
|
|
1943
|
+
className: FeatureContent,
|
|
1902
1944
|
childCount: 2
|
|
1903
|
-
},
|
|
1904
|
-
type: H1$1,
|
|
1905
|
-
childCount: 1
|
|
1906
|
-
}, text(heading), ...getTableVirtualDom(tableInfo)];
|
|
1945
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
1907
1946
|
};
|
|
1908
1947
|
|
|
1909
1948
|
const getJsonValidationTableEntry = validation => {
|
|
@@ -1934,12 +1973,21 @@ const getFeatureJsonValidationVirtualDom = extension => {
|
|
|
1934
1973
|
const tableInfo = getJsonValidationTableEntries(extension);
|
|
1935
1974
|
return [{
|
|
1936
1975
|
type: Div$1,
|
|
1937
|
-
className:
|
|
1976
|
+
className: FeatureContent,
|
|
1938
1977
|
childCount: 2
|
|
1978
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
const getFeatureNotImplementedVirtualDom = () => {
|
|
1982
|
+
const heading = 'Not implemented';
|
|
1983
|
+
return [{
|
|
1984
|
+
type: Div$1,
|
|
1985
|
+
className: FeatureContent,
|
|
1986
|
+
childCount: 1
|
|
1939
1987
|
}, {
|
|
1940
1988
|
type: H1$1,
|
|
1941
1989
|
childCount: 1
|
|
1942
|
-
}, text(heading)
|
|
1990
|
+
}, text(heading)];
|
|
1943
1991
|
};
|
|
1944
1992
|
|
|
1945
1993
|
const getFeatureProgrammingLanguagesVirtualDom = () => {
|
|
@@ -1947,12 +1995,9 @@ const getFeatureProgrammingLanguagesVirtualDom = () => {
|
|
|
1947
1995
|
// TODO
|
|
1948
1996
|
return [{
|
|
1949
1997
|
type: Div$1,
|
|
1950
|
-
className:
|
|
1998
|
+
className: FeatureContent,
|
|
1951
1999
|
childCount: 1
|
|
1952
|
-
},
|
|
1953
|
-
type: H1$1,
|
|
1954
|
-
childCount: 1
|
|
1955
|
-
}, text(heading)];
|
|
2000
|
+
}, ...getFeatureContentHeadingVirtualDom(heading)];
|
|
1956
2001
|
};
|
|
1957
2002
|
|
|
1958
2003
|
const getSettingsTableEntry = setting => {
|
|
@@ -1983,12 +2028,9 @@ const getFeatureSettingsVirtualDom = extension => {
|
|
|
1983
2028
|
const tableInfo = getSettingsTableEntries(extension);
|
|
1984
2029
|
return [{
|
|
1985
2030
|
type: Div$1,
|
|
1986
|
-
className:
|
|
2031
|
+
className: FeatureContent,
|
|
1987
2032
|
childCount: 2
|
|
1988
|
-
},
|
|
1989
|
-
type: H1$1,
|
|
1990
|
-
childCount: 1
|
|
1991
|
-
}, text(heading), ...getTableVirtualDom(tableInfo)];
|
|
2033
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
1992
2034
|
};
|
|
1993
2035
|
|
|
1994
2036
|
const getFeatureThemesVirtualDom = themesHtml => {
|
|
@@ -1997,18 +2039,61 @@ const getFeatureThemesVirtualDom = themesHtml => {
|
|
|
1997
2039
|
const heading = theme();
|
|
1998
2040
|
return [{
|
|
1999
2041
|
type: Div$1,
|
|
2000
|
-
className:
|
|
2042
|
+
className: FeatureContent,
|
|
2001
2043
|
childCount: 2
|
|
2002
|
-
}, {
|
|
2003
|
-
type: H1$1,
|
|
2004
|
-
childCount: 1
|
|
2005
|
-
}, text(heading), {
|
|
2044
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2006
2045
|
type: Div$1,
|
|
2007
2046
|
className: 'DefaultMarkdown',
|
|
2008
2047
|
childCount
|
|
2009
2048
|
}, ...markdownDom];
|
|
2010
2049
|
};
|
|
2011
2050
|
|
|
2051
|
+
const heading$1 = {
|
|
2052
|
+
type: H2$1,
|
|
2053
|
+
className: DefinitionListItemHeading,
|
|
2054
|
+
childCount: 1
|
|
2055
|
+
};
|
|
2056
|
+
const pre = {
|
|
2057
|
+
type: Pre$1,
|
|
2058
|
+
className: DefinitionListItemValue,
|
|
2059
|
+
childCount: 1
|
|
2060
|
+
};
|
|
2061
|
+
const item = {
|
|
2062
|
+
type: Div$1,
|
|
2063
|
+
className: DefinitionListItem,
|
|
2064
|
+
childCount: 2
|
|
2065
|
+
};
|
|
2066
|
+
const getWebViewVirtualDom = webView => {
|
|
2067
|
+
const {
|
|
2068
|
+
id: id$1,
|
|
2069
|
+
selector: selector$1,
|
|
2070
|
+
contentSecurityPolicy: contentSecurityPolicy$1,
|
|
2071
|
+
elements: elements$1
|
|
2072
|
+
} = webView;
|
|
2073
|
+
const textId = id();
|
|
2074
|
+
const textSelector = selector();
|
|
2075
|
+
const textContentSecurityPolicy = contentSecurityPolicy();
|
|
2076
|
+
const textElements = elements();
|
|
2077
|
+
return [{
|
|
2078
|
+
type: Div$1,
|
|
2079
|
+
className: FeatureWebView,
|
|
2080
|
+
childCount: 5
|
|
2081
|
+
}, item, heading$1, text(textId), pre, text(id$1), item, heading$1, text(textSelector), pre, text(JSON.stringify(selector$1)), item, heading$1, text(textContentSecurityPolicy), pre, text(JSON.stringify(contentSecurityPolicy$1)), item, heading$1, text(textElements), pre, text(JSON.stringify(elements$1, null, 2))];
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
const getFeatureWebViewsVirtualDom = extension => {
|
|
2085
|
+
const webViews$1 = extension.webViews || [];
|
|
2086
|
+
const heading = webViews();
|
|
2087
|
+
return [{
|
|
2088
|
+
type: Div$1,
|
|
2089
|
+
className: FeatureContent,
|
|
2090
|
+
childCount: 2
|
|
2091
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2092
|
+
type: Div$1,
|
|
2093
|
+
childCount: webViews$1.length
|
|
2094
|
+
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
2095
|
+
};
|
|
2096
|
+
|
|
2012
2097
|
const Changelog = 'Changelog';
|
|
2013
2098
|
const Commands = 'Commands';
|
|
2014
2099
|
const Details = 'Details';
|
|
@@ -2016,6 +2101,7 @@ const Features = 'Features';
|
|
|
2016
2101
|
const JsonValidation = 'JsonValidation';
|
|
2017
2102
|
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
2018
2103
|
const Settings = 'Settings';
|
|
2104
|
+
const WebViews = 'WebViews';
|
|
2019
2105
|
const Theme = 'Theme';
|
|
2020
2106
|
|
|
2021
2107
|
const getFeatureContentVirtualDom = (features, themesHtml, selectedFeature, extension) => {
|
|
@@ -2030,12 +2116,10 @@ const getFeatureContentVirtualDom = (features, themesHtml, selectedFeature, exte
|
|
|
2030
2116
|
return getFeatureProgrammingLanguagesVirtualDom();
|
|
2031
2117
|
case Settings:
|
|
2032
2118
|
return getFeatureSettingsVirtualDom(extension);
|
|
2119
|
+
case WebViews:
|
|
2120
|
+
return getFeatureWebViewsVirtualDom(extension);
|
|
2033
2121
|
default:
|
|
2034
|
-
return
|
|
2035
|
-
type: Div$1,
|
|
2036
|
-
className: 'FeatureContent',
|
|
2037
|
-
childCount: 1
|
|
2038
|
-
}, text('Not Implemented')];
|
|
2122
|
+
return getFeatureNotImplementedVirtualDom();
|
|
2039
2123
|
}
|
|
2040
2124
|
};
|
|
2041
2125
|
|
|
@@ -2084,10 +2168,10 @@ const getFeaturesVirtualDom = (features, themesHtml, selectedFeature, extension)
|
|
|
2084
2168
|
}, ...getFeatureContentVirtualDom(features, themesHtml, selectedFeature, extension)];
|
|
2085
2169
|
};
|
|
2086
2170
|
|
|
2087
|
-
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension) => {
|
|
2171
|
+
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width) => {
|
|
2088
2172
|
switch (selectedTab) {
|
|
2089
2173
|
case Details:
|
|
2090
|
-
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion);
|
|
2174
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width);
|
|
2091
2175
|
case Features:
|
|
2092
2176
|
return getFeaturesVirtualDom(features, themesHtml, selectedFeature, extension);
|
|
2093
2177
|
case Changelog:
|
|
@@ -2097,6 +2181,24 @@ const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, se
|
|
|
2097
2181
|
}
|
|
2098
2182
|
};
|
|
2099
2183
|
|
|
2184
|
+
const getButtonVirtualDom = (message, onClick) => {
|
|
2185
|
+
return [{
|
|
2186
|
+
type: Button,
|
|
2187
|
+
className: Button$1 + ' ' + ButtonPrimary,
|
|
2188
|
+
onClick,
|
|
2189
|
+
childCount: 1
|
|
2190
|
+
}, text(message)];
|
|
2191
|
+
};
|
|
2192
|
+
|
|
2193
|
+
const getExtensionDetailHeaderActionsVirtualDom = () => {
|
|
2194
|
+
const dom = [{
|
|
2195
|
+
type: Div$1,
|
|
2196
|
+
className: ExtensionDetailHeaderActions,
|
|
2197
|
+
childCount: 2
|
|
2198
|
+
}, ...getButtonVirtualDom('Disable', HandleClickDisable), ...getButtonVirtualDom('Uninstall', HandleClickUninstall)];
|
|
2199
|
+
return dom;
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2100
2202
|
const getExtensionDetailHeaderVirtualDom = extensionDetail => {
|
|
2101
2203
|
const {
|
|
2102
2204
|
name,
|
|
@@ -2117,7 +2219,7 @@ const getExtensionDetailHeaderVirtualDom = extensionDetail => {
|
|
|
2117
2219
|
}, {
|
|
2118
2220
|
type: Div$1,
|
|
2119
2221
|
className: ExtensionDetailHeaderDetails,
|
|
2120
|
-
childCount:
|
|
2222
|
+
childCount: 3
|
|
2121
2223
|
}, {
|
|
2122
2224
|
type: Div$1,
|
|
2123
2225
|
className: ExtensionDetailName,
|
|
@@ -2126,7 +2228,7 @@ const getExtensionDetailHeaderVirtualDom = extensionDetail => {
|
|
|
2126
2228
|
type: Div$1,
|
|
2127
2229
|
className: ExtensionDetailDescription,
|
|
2128
2230
|
childCount: 1
|
|
2129
|
-
}, text(description)];
|
|
2231
|
+
}, text(description), ...getExtensionDetailHeaderActionsVirtualDom()];
|
|
2130
2232
|
return dom;
|
|
2131
2233
|
};
|
|
2132
2234
|
|
|
@@ -2145,6 +2247,9 @@ const hasProgrammingLanguages = extension => {
|
|
|
2145
2247
|
const hasSettings = extension => {
|
|
2146
2248
|
return extension && extension.settings;
|
|
2147
2249
|
};
|
|
2250
|
+
const hasWebViews = extension => {
|
|
2251
|
+
return extension && extension.webViews;
|
|
2252
|
+
};
|
|
2148
2253
|
const ifElseFeature = (id, label, isEnabled, selectedFeature, extension) => {
|
|
2149
2254
|
if (!isEnabled(extension)) {
|
|
2150
2255
|
return [];
|
|
@@ -2159,7 +2264,7 @@ const getFeatures = (selectedFeature, extension) => {
|
|
|
2159
2264
|
if (!selectedFeature) {
|
|
2160
2265
|
selectedFeature = Theme;
|
|
2161
2266
|
}
|
|
2162
|
-
const features = [...ifElseFeature(Theme, 'Theme', hasThemes, selectedFeature, extension), ...ifElseFeature(Commands, 'Commands', hasCommands, selectedFeature, extension), ...ifElseFeature(JsonValidation, 'Json Validation', hasJsonValidation, selectedFeature, extension), ...ifElseFeature(ProgrammingLanguages, 'Programming Languages', hasProgrammingLanguages, selectedFeature, extension), ...ifElseFeature(Settings, 'Settings', hasSettings, selectedFeature, extension)];
|
|
2267
|
+
const features = [...ifElseFeature(Theme, 'Theme', hasThemes, selectedFeature, extension), ...ifElseFeature(Commands, 'Commands', hasCommands, selectedFeature, extension), ...ifElseFeature(JsonValidation, 'Json Validation', hasJsonValidation, selectedFeature, extension), ...ifElseFeature(ProgrammingLanguages, 'Programming Languages', hasProgrammingLanguages, selectedFeature, extension), ...ifElseFeature(Settings, 'Settings', hasSettings, selectedFeature, extension), ...ifElseFeature(WebViews, 'WebViews', hasWebViews, selectedFeature, extension)];
|
|
2163
2268
|
return features;
|
|
2164
2269
|
};
|
|
2165
2270
|
|
|
@@ -2220,6 +2325,33 @@ const getTabsVirtualDom = tabs => {
|
|
|
2220
2325
|
}, ...tabs.flatMap(getTabVirtualDom)];
|
|
2221
2326
|
};
|
|
2222
2327
|
|
|
2328
|
+
const Small = 1;
|
|
2329
|
+
const Normal = 2;
|
|
2330
|
+
const Large = 3;
|
|
2331
|
+
|
|
2332
|
+
const getViewletSize = width => {
|
|
2333
|
+
if (width < 180) {
|
|
2334
|
+
return Small;
|
|
2335
|
+
}
|
|
2336
|
+
if (width < 768) {
|
|
2337
|
+
return Normal;
|
|
2338
|
+
}
|
|
2339
|
+
return Large;
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
const getClassNames = size => {
|
|
2343
|
+
switch (size) {
|
|
2344
|
+
case Small:
|
|
2345
|
+
return Small$1;
|
|
2346
|
+
case Normal:
|
|
2347
|
+
return Normal$1;
|
|
2348
|
+
case Large:
|
|
2349
|
+
return Large$1;
|
|
2350
|
+
default:
|
|
2351
|
+
return '';
|
|
2352
|
+
}
|
|
2353
|
+
};
|
|
2354
|
+
|
|
2223
2355
|
const getExtensionDetailVirtualDom = (extensionDetail, sanitizedReadmeHtml, selectedTab, newState) => {
|
|
2224
2356
|
// TODO move this to view model so that rendering occurs like
|
|
2225
2357
|
// 1. state
|
|
@@ -2234,15 +2366,25 @@ const getExtensionDetailVirtualDom = (extensionDetail, sanitizedReadmeHtml, sele
|
|
|
2234
2366
|
const extensionId = newState?.extension?.id || 'n/a';
|
|
2235
2367
|
const extensionVersion = newState?.extension?.version || 'n/a';
|
|
2236
2368
|
const displaySize = getDisplaySize(size);
|
|
2369
|
+
const width = newState?.width || 500;
|
|
2237
2370
|
const tabs = getTabs(selectedTab);
|
|
2371
|
+
const sizeValue = getViewletSize(newState?.width || 0);
|
|
2372
|
+
const sizeClass = getClassNames(sizeValue);
|
|
2238
2373
|
const dom = [{
|
|
2239
2374
|
type: Div$1,
|
|
2240
|
-
className: mergeClassNames(Viewlet, ExtensionDetail),
|
|
2375
|
+
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
2241
2376
|
childCount: 3
|
|
2242
|
-
}, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension)];
|
|
2377
|
+
}, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width)];
|
|
2243
2378
|
return dom;
|
|
2244
2379
|
};
|
|
2245
2380
|
|
|
2381
|
+
const getExtensionDetailVirtualDom2 = uid => {
|
|
2382
|
+
const {
|
|
2383
|
+
newState
|
|
2384
|
+
} = get$1(uid);
|
|
2385
|
+
return getExtensionDetailVirtualDom(newState, newState.sanitizedReadmeHtml, newState.selectedTab, newState);
|
|
2386
|
+
};
|
|
2387
|
+
|
|
2246
2388
|
const None = 0;
|
|
2247
2389
|
|
|
2248
2390
|
const getCopyMenuEntry = () => ({
|
|
@@ -2286,7 +2428,14 @@ const getLinkMenuEntries = props => {
|
|
|
2286
2428
|
|
|
2287
2429
|
const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
|
|
2288
2430
|
|
|
2431
|
+
const handleClickDisable = async state => {
|
|
2432
|
+
return state;
|
|
2433
|
+
};
|
|
2434
|
+
|
|
2289
2435
|
const selectFeature = async (state, name) => {
|
|
2436
|
+
if (!name) {
|
|
2437
|
+
return state;
|
|
2438
|
+
}
|
|
2290
2439
|
const {
|
|
2291
2440
|
features
|
|
2292
2441
|
} = state;
|
|
@@ -2336,6 +2485,10 @@ const handleClickSize = async state => {
|
|
|
2336
2485
|
return state;
|
|
2337
2486
|
};
|
|
2338
2487
|
|
|
2488
|
+
const handleClickUninstall = async state => {
|
|
2489
|
+
return state;
|
|
2490
|
+
};
|
|
2491
|
+
|
|
2339
2492
|
const assetDir = '';
|
|
2340
2493
|
|
|
2341
2494
|
const ExtensionDefaultIcon = `${assetDir}/icons/extensionDefaultIcon.png`;
|
|
@@ -4906,6 +5059,7 @@ const selectTab$1 = async state => {
|
|
|
4906
5059
|
iconThemes,
|
|
4907
5060
|
productIconThemes
|
|
4908
5061
|
} = extension;
|
|
5062
|
+
// TODO do this depending on featured tab content
|
|
4909
5063
|
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
4910
5064
|
const rendered = await renderMarkdown(markdown, {
|
|
4911
5065
|
baseUrl
|
|
@@ -5055,20 +5209,6 @@ const getSavedSelectedTab = savedState => {
|
|
|
5055
5209
|
return Details;
|
|
5056
5210
|
};
|
|
5057
5211
|
|
|
5058
|
-
const Small = 1;
|
|
5059
|
-
const Normal = 2;
|
|
5060
|
-
const Large = 3;
|
|
5061
|
-
|
|
5062
|
-
const getViewletSize = width => {
|
|
5063
|
-
if (width < 180) {
|
|
5064
|
-
return Small;
|
|
5065
|
-
}
|
|
5066
|
-
if (width < 768) {
|
|
5067
|
-
return Normal;
|
|
5068
|
-
}
|
|
5069
|
-
return Large;
|
|
5070
|
-
};
|
|
5071
|
-
|
|
5072
5212
|
const readFile = async uri => {
|
|
5073
5213
|
return invoke('FileSystem.readFile', uri);
|
|
5074
5214
|
};
|
|
@@ -5160,7 +5300,7 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
5160
5300
|
iconSrc,
|
|
5161
5301
|
name,
|
|
5162
5302
|
description,
|
|
5163
|
-
size,
|
|
5303
|
+
sizeOnDisk: size,
|
|
5164
5304
|
entries,
|
|
5165
5305
|
secondEntries,
|
|
5166
5306
|
categories,
|
|
@@ -5172,11 +5312,21 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
5172
5312
|
};
|
|
5173
5313
|
};
|
|
5174
5314
|
|
|
5175
|
-
const
|
|
5315
|
+
const resize = (state, dimensions) => {
|
|
5316
|
+
return {
|
|
5317
|
+
...state,
|
|
5318
|
+
...dimensions
|
|
5319
|
+
};
|
|
5320
|
+
};
|
|
5321
|
+
|
|
5322
|
+
const saveState = uid => {
|
|
5323
|
+
const {
|
|
5324
|
+
newState
|
|
5325
|
+
} = get$1(uid);
|
|
5176
5326
|
const {
|
|
5177
5327
|
selectedTab,
|
|
5178
5328
|
selectedFeature
|
|
5179
|
-
} =
|
|
5329
|
+
} = newState;
|
|
5180
5330
|
return {
|
|
5181
5331
|
selectedTab,
|
|
5182
5332
|
selectedFeature
|
|
@@ -5187,19 +5337,40 @@ const terminate = () => {
|
|
|
5187
5337
|
globalThis.close();
|
|
5188
5338
|
};
|
|
5189
5339
|
|
|
5340
|
+
const wrapCommand = fn => {
|
|
5341
|
+
const wrapped = async (uid, ...args) => {
|
|
5342
|
+
if (typeof uid === 'number') {
|
|
5343
|
+
const {
|
|
5344
|
+
newState
|
|
5345
|
+
} = get$1(uid);
|
|
5346
|
+
const newerState = await fn(newState, ...args);
|
|
5347
|
+
set$1(uid, newState, newerState);
|
|
5348
|
+
} else {
|
|
5349
|
+
// deprecated
|
|
5350
|
+
const newerState = await fn(uid, ...args);
|
|
5351
|
+
return newerState;
|
|
5352
|
+
}
|
|
5353
|
+
};
|
|
5354
|
+
return wrapped;
|
|
5355
|
+
};
|
|
5356
|
+
|
|
5190
5357
|
const commandMap = {
|
|
5191
5358
|
'ExtensionDetail.create': create,
|
|
5192
5359
|
'ExtensionDetail.getMenuEntries': getMenuEntries,
|
|
5193
|
-
'ExtensionDetail.
|
|
5194
|
-
'ExtensionDetail.
|
|
5195
|
-
'ExtensionDetail.
|
|
5196
|
-
'ExtensionDetail.
|
|
5197
|
-
'ExtensionDetail.
|
|
5198
|
-
'ExtensionDetail.
|
|
5360
|
+
'ExtensionDetail.getVirtualDom2': getExtensionDetailVirtualDom2,
|
|
5361
|
+
'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
|
|
5362
|
+
'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
|
|
5363
|
+
'ExtensionDetail.handleClickUninstall': wrapCommand(handleClickUninstall),
|
|
5364
|
+
'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
|
|
5365
|
+
'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
|
|
5366
|
+
'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
|
|
5367
|
+
'ExtensionDetail.loadContent': wrapCommand(loadContent),
|
|
5368
|
+
'ExtensionDetail.resize': resize,
|
|
5199
5369
|
'ExtensionDetail.saveState': saveState,
|
|
5200
|
-
'ExtensionDetail.selectTab': selectTab,
|
|
5370
|
+
'ExtensionDetail.selectTab': wrapCommand(selectTab),
|
|
5201
5371
|
'ExtensionDetail.terminate': terminate,
|
|
5202
5372
|
// deprecated
|
|
5373
|
+
'ExtensionDetail.getVirtualDom': wrapCommand(getExtensionDetailVirtualDom),
|
|
5203
5374
|
'HandleIconError.handleIconError': handleIconError,
|
|
5204
5375
|
'RenderMarkdown.renderMarkdown': renderMarkdown
|
|
5205
5376
|
};
|