@lvce-editor/extension-detail-view 3.4.0 → 3.6.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.
|
@@ -883,7 +883,9 @@ const create = (uid, uri, width, height, platform) => {
|
|
|
883
883
|
resources: [],
|
|
884
884
|
selectedFeatureMarkdownDom: '',
|
|
885
885
|
extension: {},
|
|
886
|
-
baseUrl: ''
|
|
886
|
+
baseUrl: '',
|
|
887
|
+
features: [],
|
|
888
|
+
folderSize: 0
|
|
887
889
|
};
|
|
888
890
|
set$1(uid, state, state);
|
|
889
891
|
};
|
|
@@ -917,6 +919,78 @@ const Resource = 'Resource';
|
|
|
917
919
|
const Resources = 'Resources';
|
|
918
920
|
const Viewlet = 'Viewlet';
|
|
919
921
|
|
|
922
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
923
|
+
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
924
|
+
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
925
|
+
const BIBIT_UNITS = ['b', 'kibit', 'Mibit', 'Gibit', 'Tibit', 'Pibit', 'Eibit', 'Zibit', 'Yibit'];
|
|
926
|
+
|
|
927
|
+
/*
|
|
928
|
+
Formats the given number using `Number#toLocaleString`.
|
|
929
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
930
|
+
- If locale is true, the system default locale is used for translation.
|
|
931
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
932
|
+
*/
|
|
933
|
+
const toLocaleString = (number, locale, options) => {
|
|
934
|
+
let result = number;
|
|
935
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
936
|
+
result = number.toLocaleString(locale, options);
|
|
937
|
+
} else if (locale === true || options !== undefined) {
|
|
938
|
+
result = number.toLocaleString(undefined, options);
|
|
939
|
+
}
|
|
940
|
+
return result;
|
|
941
|
+
};
|
|
942
|
+
function prettyBytes(number, options) {
|
|
943
|
+
if (!Number.isFinite(number)) {
|
|
944
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
945
|
+
}
|
|
946
|
+
options = {
|
|
947
|
+
bits: false,
|
|
948
|
+
binary: false,
|
|
949
|
+
space: true,
|
|
950
|
+
...options
|
|
951
|
+
};
|
|
952
|
+
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
953
|
+
const separator = options.space ? ' ' : '';
|
|
954
|
+
if (options.signed && number === 0) {
|
|
955
|
+
return ` 0${separator}${UNITS[0]}`;
|
|
956
|
+
}
|
|
957
|
+
const isNegative = number < 0;
|
|
958
|
+
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
959
|
+
if (isNegative) {
|
|
960
|
+
number = -number;
|
|
961
|
+
}
|
|
962
|
+
let localeOptions;
|
|
963
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
964
|
+
localeOptions = {
|
|
965
|
+
minimumFractionDigits: options.minimumFractionDigits
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
969
|
+
localeOptions = {
|
|
970
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
971
|
+
...localeOptions
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
if (number < 1) {
|
|
975
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
976
|
+
return prefix + numberString + separator + UNITS[0];
|
|
977
|
+
}
|
|
978
|
+
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
979
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
980
|
+
if (!localeOptions) {
|
|
981
|
+
number = number.toPrecision(3);
|
|
982
|
+
}
|
|
983
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
984
|
+
const unit = UNITS[exponent];
|
|
985
|
+
return prefix + numberString + separator + unit;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
const getDisplaySize = size => {
|
|
989
|
+
return prettyBytes(size, {
|
|
990
|
+
maximumFractionDigits: 1
|
|
991
|
+
});
|
|
992
|
+
};
|
|
993
|
+
|
|
920
994
|
const Button = 1;
|
|
921
995
|
const Div$1 = 4;
|
|
922
996
|
const H1$1 = 5;
|
|
@@ -973,9 +1047,23 @@ const TabList = 'tablist';
|
|
|
973
1047
|
const Tab = 'tab';
|
|
974
1048
|
const Panel = 'panel';
|
|
975
1049
|
|
|
1050
|
+
const HandleClickSize = 'handleClickSize';
|
|
1051
|
+
const HandleFeaturesClick = 'handleFeaturesClick';
|
|
976
1052
|
const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
977
1053
|
const HandleTabsClick = 'handleTabsClick';
|
|
978
1054
|
|
|
1055
|
+
const getAdditionalDetailsEntryVirtualDom = (heading, items, renderer) => {
|
|
1056
|
+
return [{
|
|
1057
|
+
type: Div$1,
|
|
1058
|
+
className: AdditionalDetailsEntry,
|
|
1059
|
+
childCount: 2
|
|
1060
|
+
}, {
|
|
1061
|
+
type: Div$1,
|
|
1062
|
+
className: AdditionalDetailsTitle,
|
|
1063
|
+
childCount: 1
|
|
1064
|
+
}, text(heading), ...renderer(items)];
|
|
1065
|
+
};
|
|
1066
|
+
|
|
979
1067
|
const getCategoryVirtualDom = category => {
|
|
980
1068
|
const {
|
|
981
1069
|
label
|
|
@@ -995,26 +1083,43 @@ const getCategoriesDom = categories => {
|
|
|
995
1083
|
}, ...categories.flatMap(getCategoryVirtualDom)];
|
|
996
1084
|
};
|
|
997
1085
|
|
|
998
|
-
const
|
|
1086
|
+
const getMoreInfoEntryKeyVirtualDom = item => {
|
|
999
1087
|
const {
|
|
1000
|
-
key
|
|
1001
|
-
value
|
|
1088
|
+
key
|
|
1002
1089
|
} = item;
|
|
1003
1090
|
return [{
|
|
1004
|
-
type: Div$1,
|
|
1005
|
-
className: MoreInfoEntry,
|
|
1006
|
-
childCount: 2
|
|
1007
|
-
}, {
|
|
1008
1091
|
type: Div$1,
|
|
1009
1092
|
className: MoreInfoEntryKey,
|
|
1010
1093
|
childCount: 1
|
|
1011
|
-
}, text(key)
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1094
|
+
}, text(key)];
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
const getMoreInfoEntryValueVirtualDom = item => {
|
|
1098
|
+
const {
|
|
1099
|
+
value,
|
|
1100
|
+
onClick
|
|
1101
|
+
} = item;
|
|
1102
|
+
const valueTag = onClick ? A$1 : Div$1;
|
|
1103
|
+
let valueClassName = MoreInfoEntryValue;
|
|
1104
|
+
if (onClick) {
|
|
1105
|
+
valueClassName += ' Link';
|
|
1106
|
+
}
|
|
1107
|
+
return [{
|
|
1108
|
+
type: valueTag,
|
|
1109
|
+
className: valueClassName,
|
|
1110
|
+
childCount: 1,
|
|
1111
|
+
onClick
|
|
1015
1112
|
}, text(value)];
|
|
1016
1113
|
};
|
|
1017
1114
|
|
|
1115
|
+
const getMoreInfoEntryVirtualDom = item => {
|
|
1116
|
+
return [{
|
|
1117
|
+
type: Div$1,
|
|
1118
|
+
className: MoreInfoEntry,
|
|
1119
|
+
childCount: 2
|
|
1120
|
+
}, ...getMoreInfoEntryKeyVirtualDom(item), ...getMoreInfoEntryValueVirtualDom(item)];
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1018
1123
|
const getMoreInfoVirtualDom = items => {
|
|
1019
1124
|
return [{
|
|
1020
1125
|
type: Div$1,
|
|
@@ -1048,39 +1153,25 @@ const getAdditionalDetailsVirtualDom = (firstHeading, entries, secondHeading, se
|
|
|
1048
1153
|
type: Div$1,
|
|
1049
1154
|
className: AdditionalDetails,
|
|
1050
1155
|
childCount: 4
|
|
1156
|
+
}, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
const getInstallationEntries = displaySize => {
|
|
1160
|
+
const entries = [{
|
|
1161
|
+
key: 'Identifier',
|
|
1162
|
+
value: 'abc'
|
|
1051
1163
|
}, {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
childCount: 2
|
|
1055
|
-
}, {
|
|
1056
|
-
type: Div$1,
|
|
1057
|
-
className: AdditionalDetailsTitle,
|
|
1058
|
-
childCount: 1
|
|
1059
|
-
}, text(firstHeading), ...getMoreInfoVirtualDom(entries), {
|
|
1060
|
-
type: Div$1,
|
|
1061
|
-
className: AdditionalDetailsEntry,
|
|
1062
|
-
childCount: 2
|
|
1063
|
-
}, {
|
|
1064
|
-
type: Div$1,
|
|
1065
|
-
className: AdditionalDetailsTitle,
|
|
1066
|
-
childCount: 1
|
|
1067
|
-
}, text(secondHeading), ...getMoreInfoVirtualDom(secondEntries), {
|
|
1068
|
-
type: Div$1,
|
|
1069
|
-
className: AdditionalDetailsEntry,
|
|
1070
|
-
childCount: 2
|
|
1164
|
+
key: 'Version',
|
|
1165
|
+
value: '1.9.5'
|
|
1071
1166
|
}, {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
childCount: 1
|
|
1075
|
-
}, text(thirdHeading), ...getCategoriesDom(categories), {
|
|
1076
|
-
type: Div$1,
|
|
1077
|
-
className: AdditionalDetailsEntry,
|
|
1078
|
-
childCount: 2
|
|
1167
|
+
key: 'Last Updated',
|
|
1168
|
+
value: 'n/a'
|
|
1079
1169
|
}, {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1170
|
+
key: 'Size',
|
|
1171
|
+
value: `${displaySize}`,
|
|
1172
|
+
onClick: HandleClickSize
|
|
1173
|
+
}];
|
|
1174
|
+
return entries;
|
|
1084
1175
|
};
|
|
1085
1176
|
|
|
1086
1177
|
const allowedMarkdownAttributes = ['src', 'id', 'className', 'title', 'alt', 'href', 'target', 'rel'];
|
|
@@ -1545,20 +1636,11 @@ const getVirtualDomChildCount = markdownDom => {
|
|
|
1545
1636
|
return stack.length;
|
|
1546
1637
|
};
|
|
1547
1638
|
|
|
1548
|
-
const getDetailsVirtualDom = sanitizedReadmeHtml => {
|
|
1639
|
+
const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize) => {
|
|
1549
1640
|
const markdownDom = getMarkdownVirtualDom(sanitizedReadmeHtml);
|
|
1550
1641
|
const childCount = getVirtualDomChildCount(markdownDom);
|
|
1551
1642
|
const firstHeading = 'Installation';
|
|
1552
|
-
const entries =
|
|
1553
|
-
key: 'Identifier',
|
|
1554
|
-
value: 'abc'
|
|
1555
|
-
}, {
|
|
1556
|
-
key: 'Version',
|
|
1557
|
-
value: '1.9.5'
|
|
1558
|
-
}, {
|
|
1559
|
-
key: 'Last Updated',
|
|
1560
|
-
value: 'n/a'
|
|
1561
|
-
}];
|
|
1643
|
+
const entries = getInstallationEntries(displaySize);
|
|
1562
1644
|
const secondHeading = 'Marketplace';
|
|
1563
1645
|
const secondEntries = [{
|
|
1564
1646
|
key: 'Published',
|
|
@@ -1607,12 +1689,16 @@ const getDetailsVirtualDom = sanitizedReadmeHtml => {
|
|
|
1607
1689
|
|
|
1608
1690
|
const getFeatureListItemVirtualDom = feature => {
|
|
1609
1691
|
const {
|
|
1610
|
-
label
|
|
1692
|
+
label,
|
|
1693
|
+
selected,
|
|
1694
|
+
id
|
|
1611
1695
|
} = feature;
|
|
1696
|
+
const className = selected ? 'Feature FeatureSelected' : Feature;
|
|
1612
1697
|
return [{
|
|
1613
1698
|
// TODO use role list item or tab
|
|
1614
|
-
type:
|
|
1615
|
-
|
|
1699
|
+
type: Button,
|
|
1700
|
+
name: id,
|
|
1701
|
+
className,
|
|
1616
1702
|
childCount: 1
|
|
1617
1703
|
}, text(label)];
|
|
1618
1704
|
};
|
|
@@ -1622,7 +1708,8 @@ const getFeatureListVirtualDom = features => {
|
|
|
1622
1708
|
// TODO use either list or tabs role
|
|
1623
1709
|
type: Div$1,
|
|
1624
1710
|
className: FeaturesList,
|
|
1625
|
-
childCount: features.length
|
|
1711
|
+
childCount: features.length,
|
|
1712
|
+
onClick: HandleFeaturesClick
|
|
1626
1713
|
}, ...features.flatMap(getFeatureListItemVirtualDom)];
|
|
1627
1714
|
};
|
|
1628
1715
|
|
|
@@ -1644,11 +1731,7 @@ const getFeatureThemesVirtualDom = themesHtml => {
|
|
|
1644
1731
|
}, ...markdownDom];
|
|
1645
1732
|
};
|
|
1646
1733
|
|
|
1647
|
-
const getFeaturesVirtualDom = themesHtml => {
|
|
1648
|
-
const features = [{
|
|
1649
|
-
id: 'theme',
|
|
1650
|
-
label: 'Theme'
|
|
1651
|
-
}];
|
|
1734
|
+
const getFeaturesVirtualDom = (features, themesHtml) => {
|
|
1652
1735
|
return [{
|
|
1653
1736
|
type: Div$1,
|
|
1654
1737
|
className: Features$1,
|
|
@@ -1660,16 +1743,21 @@ const getFeaturesVirtualDom = themesHtml => {
|
|
|
1660
1743
|
}, ...getFeatureThemesVirtualDom(themesHtml)];
|
|
1661
1744
|
};
|
|
1662
1745
|
|
|
1746
|
+
const Changelog = 'Changelog';
|
|
1747
|
+
const Commands = 'Commands';
|
|
1663
1748
|
const Details = 'Details';
|
|
1664
1749
|
const Features = 'Features';
|
|
1665
|
-
const
|
|
1750
|
+
const JsonValidation = 'JsonValidation';
|
|
1751
|
+
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1752
|
+
const Settings = 'Settings';
|
|
1753
|
+
const Theme = 'Theme';
|
|
1666
1754
|
|
|
1667
|
-
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, selectedTab) => {
|
|
1755
|
+
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize) => {
|
|
1668
1756
|
switch (selectedTab) {
|
|
1669
1757
|
case Details:
|
|
1670
|
-
return getDetailsVirtualDom(sanitizedReadmeHtml);
|
|
1758
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize);
|
|
1671
1759
|
case Features:
|
|
1672
|
-
return getFeaturesVirtualDom(themesHtml);
|
|
1760
|
+
return getFeaturesVirtualDom(features, themesHtml);
|
|
1673
1761
|
case Changelog:
|
|
1674
1762
|
return getChangelogVirtualDom();
|
|
1675
1763
|
default:
|
|
@@ -1710,6 +1798,31 @@ const getExtensionDetailHeaderVirtualDom = extensionDetail => {
|
|
|
1710
1798
|
return dom;
|
|
1711
1799
|
};
|
|
1712
1800
|
|
|
1801
|
+
const getFeatures = () => {
|
|
1802
|
+
const features = [{
|
|
1803
|
+
id: Theme,
|
|
1804
|
+
label: 'Theme',
|
|
1805
|
+
selected: true
|
|
1806
|
+
}, {
|
|
1807
|
+
id: Commands,
|
|
1808
|
+
label: 'Commands',
|
|
1809
|
+
selected: false
|
|
1810
|
+
}, {
|
|
1811
|
+
id: JsonValidation,
|
|
1812
|
+
label: 'Json Validation',
|
|
1813
|
+
selected: false
|
|
1814
|
+
}, {
|
|
1815
|
+
id: ProgrammingLanguages,
|
|
1816
|
+
label: 'Programming Languages',
|
|
1817
|
+
selected: false
|
|
1818
|
+
}, {
|
|
1819
|
+
id: Settings,
|
|
1820
|
+
label: 'Settings',
|
|
1821
|
+
selected: false
|
|
1822
|
+
}];
|
|
1823
|
+
return features;
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1713
1826
|
const getTabs = selectedTab => {
|
|
1714
1827
|
const tabs = [{
|
|
1715
1828
|
label: 'Details',
|
|
@@ -1769,12 +1882,15 @@ const getTabsVirtualDom = tabs => {
|
|
|
1769
1882
|
|
|
1770
1883
|
const getExtensionDetailVirtualDom = (extensionDetail, sanitizedReadmeHtml, selectedTab, newState) => {
|
|
1771
1884
|
const themesHtml = newState?.selectedFeatureMarkdownDom || '';
|
|
1885
|
+
const features = newState?.features || getFeatures();
|
|
1886
|
+
const size = newState.folderSize || 0;
|
|
1887
|
+
const displaySize = getDisplaySize(size);
|
|
1772
1888
|
const tabs = getTabs(selectedTab);
|
|
1773
1889
|
const dom = [{
|
|
1774
1890
|
type: Div$1,
|
|
1775
1891
|
className: mergeClassNames(Viewlet, ExtensionDetail),
|
|
1776
1892
|
childCount: 3
|
|
1777
|
-
}, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab)];
|
|
1893
|
+
}, ...getExtensionDetailHeaderVirtualDom(extensionDetail), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(sanitizedReadmeHtml, themesHtml, selectedTab, features, displaySize)];
|
|
1778
1894
|
return dom;
|
|
1779
1895
|
};
|
|
1780
1896
|
|
|
@@ -1851,6 +1967,56 @@ const getLinkMenuEntries = props => {
|
|
|
1851
1967
|
|
|
1852
1968
|
const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
|
|
1853
1969
|
|
|
1970
|
+
const selectFeature = async (state, name) => {
|
|
1971
|
+
const {
|
|
1972
|
+
features
|
|
1973
|
+
} = state;
|
|
1974
|
+
const newFeatures = features.map(feature => {
|
|
1975
|
+
if (feature.id === name) {
|
|
1976
|
+
return {
|
|
1977
|
+
...feature,
|
|
1978
|
+
selected: true
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
return {
|
|
1982
|
+
...feature,
|
|
1983
|
+
selected: false
|
|
1984
|
+
};
|
|
1985
|
+
});
|
|
1986
|
+
return {
|
|
1987
|
+
...state,
|
|
1988
|
+
selectedFeature: name,
|
|
1989
|
+
features: newFeatures
|
|
1990
|
+
};
|
|
1991
|
+
};
|
|
1992
|
+
|
|
1993
|
+
const handleClickFeatures = async (state, name) => {
|
|
1994
|
+
return selectFeature(state, name);
|
|
1995
|
+
};
|
|
1996
|
+
|
|
1997
|
+
const RendererWorker = 1;
|
|
1998
|
+
|
|
1999
|
+
const rpcs = Object.create(null);
|
|
2000
|
+
const set = (id, rpc) => {
|
|
2001
|
+
rpcs[id] = rpc;
|
|
2002
|
+
};
|
|
2003
|
+
const get = id => {
|
|
2004
|
+
return rpcs[id];
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
const invoke = (method, ...params) => {
|
|
2008
|
+
const rpc = get(RendererWorker);
|
|
2009
|
+
return rpc.invoke(method, ...params);
|
|
2010
|
+
};
|
|
2011
|
+
|
|
2012
|
+
const handleClickSize = async state => {
|
|
2013
|
+
const {
|
|
2014
|
+
uri
|
|
2015
|
+
} = state.extension;
|
|
2016
|
+
await invoke('OpenNativeFolder.openNativeFolder', uri);
|
|
2017
|
+
return state;
|
|
2018
|
+
};
|
|
2019
|
+
|
|
1854
2020
|
const assetDir = '';
|
|
1855
2021
|
|
|
1856
2022
|
const ExtensionDefaultIcon = `${assetDir}/icons/extensionDefaultIcon.png`;
|
|
@@ -1877,6 +2043,10 @@ const selectTabChangelog = async state => {
|
|
|
1877
2043
|
};
|
|
1878
2044
|
};
|
|
1879
2045
|
|
|
2046
|
+
const selectTabDefault = async state => {
|
|
2047
|
+
return state;
|
|
2048
|
+
};
|
|
2049
|
+
|
|
1880
2050
|
const selectTabDetails = async state => {
|
|
1881
2051
|
// TODO load readmo markdown here
|
|
1882
2052
|
return {
|
|
@@ -4437,7 +4607,7 @@ const getSelectTabHandler = selectedTab => {
|
|
|
4437
4607
|
case Changelog:
|
|
4438
4608
|
return selectTabChangelog;
|
|
4439
4609
|
default:
|
|
4440
|
-
|
|
4610
|
+
return selectTabDefault;
|
|
4441
4611
|
}
|
|
4442
4612
|
};
|
|
4443
4613
|
|
|
@@ -4501,21 +4671,6 @@ const getName = extension => {
|
|
|
4501
4671
|
return 'n/a';
|
|
4502
4672
|
};
|
|
4503
4673
|
|
|
4504
|
-
const RendererWorker = 1;
|
|
4505
|
-
|
|
4506
|
-
const rpcs = Object.create(null);
|
|
4507
|
-
const set = (id, rpc) => {
|
|
4508
|
-
rpcs[id] = rpc;
|
|
4509
|
-
};
|
|
4510
|
-
const get = id => {
|
|
4511
|
-
return rpcs[id];
|
|
4512
|
-
};
|
|
4513
|
-
|
|
4514
|
-
const invoke = (method, ...params) => {
|
|
4515
|
-
const rpc = get(RendererWorker);
|
|
4516
|
-
return rpc.invoke(method, ...params);
|
|
4517
|
-
};
|
|
4518
|
-
|
|
4519
4674
|
const getAllExtensions = async platform => {
|
|
4520
4675
|
if (platform === Web) {
|
|
4521
4676
|
return [];
|
|
@@ -4547,6 +4702,14 @@ const getBaseUrl = (extensionPath, platform) => {
|
|
|
4547
4702
|
}
|
|
4548
4703
|
};
|
|
4549
4704
|
|
|
4705
|
+
const getFolderSize = async uri => {
|
|
4706
|
+
try {
|
|
4707
|
+
return await invoke('FileSystem.getFolderSize', uri);
|
|
4708
|
+
} catch {
|
|
4709
|
+
return 0;
|
|
4710
|
+
}
|
|
4711
|
+
};
|
|
4712
|
+
|
|
4550
4713
|
const getSavedSelectedTab = savedState => {
|
|
4551
4714
|
if (savedState && typeof savedState === 'object' && 'selectedTab' in savedState && typeof savedState.selectedTab === 'string') {
|
|
4552
4715
|
return savedState.selectedTab;
|
|
@@ -4615,6 +4778,8 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
4615
4778
|
const name = getName(extension);
|
|
4616
4779
|
const size = getViewletSize(width);
|
|
4617
4780
|
const selectedTab = getSavedSelectedTab(savedState);
|
|
4781
|
+
const features = getFeatures();
|
|
4782
|
+
const folderSize = await getFolderSize(extension.uri);
|
|
4618
4783
|
const entries = [{
|
|
4619
4784
|
key: 'Identifier',
|
|
4620
4785
|
value: 'abc'
|
|
@@ -4662,7 +4827,9 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
4662
4827
|
categories,
|
|
4663
4828
|
resources,
|
|
4664
4829
|
extension,
|
|
4665
|
-
baseUrl
|
|
4830
|
+
baseUrl,
|
|
4831
|
+
features,
|
|
4832
|
+
folderSize
|
|
4666
4833
|
};
|
|
4667
4834
|
};
|
|
4668
4835
|
|
|
@@ -4681,14 +4848,16 @@ const terminate = () => {
|
|
|
4681
4848
|
|
|
4682
4849
|
const commandMap = {
|
|
4683
4850
|
'ExtensionDetail.create': create,
|
|
4684
|
-
'ExtensionDetail.saveState': saveState,
|
|
4685
4851
|
'ExtensionDetail.getMenuEntries': getMenuEntries,
|
|
4686
4852
|
'ExtensionDetail.getVirtualDom': getExtensionDetailVirtualDom,
|
|
4687
|
-
'ExtensionDetail.
|
|
4688
|
-
'ExtensionDetail.
|
|
4689
|
-
'ExtensionDetail.handleTabsClick': handleTabsClick,
|
|
4853
|
+
'ExtensionDetail.handleClickSize': handleClickSize,
|
|
4854
|
+
'ExtensionDetail.handleFeaturesClick': handleClickFeatures,
|
|
4690
4855
|
'ExtensionDetail.handleIconError': handleIconError,
|
|
4856
|
+
'ExtensionDetail.handleTabsClick': handleTabsClick,
|
|
4857
|
+
'ExtensionDetail.loadContent': loadContent,
|
|
4858
|
+
'ExtensionDetail.saveState': saveState,
|
|
4691
4859
|
'ExtensionDetail.selectTab': selectTab,
|
|
4860
|
+
'ExtensionDetail.terminate': terminate,
|
|
4692
4861
|
// deprecated
|
|
4693
4862
|
'HandleIconError.handleIconError': handleIconError,
|
|
4694
4863
|
'RenderMarkdown.renderMarkdown': renderMarkdown
|