@lvce-editor/extension-detail-view 3.32.0 → 3.33.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 +174 -161
- package/package.json +1 -1
|
@@ -951,6 +951,7 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
951
951
|
changelogVirtualDom: [],
|
|
952
952
|
description: '',
|
|
953
953
|
detailsVirtualDom: [],
|
|
954
|
+
displaySize: '',
|
|
954
955
|
entries: [],
|
|
955
956
|
extension: {},
|
|
956
957
|
features: [],
|
|
@@ -961,7 +962,6 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
961
962
|
platform,
|
|
962
963
|
readmeScrollTop: 0,
|
|
963
964
|
resources: [],
|
|
964
|
-
sanitizedReadmeHtml: '',
|
|
965
965
|
scrollToTopButtonEnabled: false,
|
|
966
966
|
secondEntries: [],
|
|
967
967
|
selectedFeature: '',
|
|
@@ -971,7 +971,10 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
971
971
|
showAdditionalDetailsBreakpoint: 600,
|
|
972
972
|
sizeOnDisk: 0,
|
|
973
973
|
uri,
|
|
974
|
-
width
|
|
974
|
+
width,
|
|
975
|
+
hasColorTheme: false,
|
|
976
|
+
isBuiltin: false,
|
|
977
|
+
sizeValue: 0
|
|
975
978
|
};
|
|
976
979
|
set$1(uid, state, state);
|
|
977
980
|
};
|
|
@@ -1468,25 +1471,6 @@ const selectTabDefault = async state => {
|
|
|
1468
1471
|
return state;
|
|
1469
1472
|
};
|
|
1470
1473
|
|
|
1471
|
-
const getRemoteSrc = uri => {
|
|
1472
|
-
const src = `/remote${uri}`;
|
|
1473
|
-
return src;
|
|
1474
|
-
};
|
|
1475
|
-
|
|
1476
|
-
const Web = 1;
|
|
1477
|
-
const Electron = 2;
|
|
1478
|
-
const Remote = 3;
|
|
1479
|
-
|
|
1480
|
-
const getBaseUrl = (extensionPath, platform) => {
|
|
1481
|
-
switch (platform) {
|
|
1482
|
-
case Remote:
|
|
1483
|
-
case Electron:
|
|
1484
|
-
return getRemoteSrc(extensionPath + '/');
|
|
1485
|
-
default:
|
|
1486
|
-
return extensionPath;
|
|
1487
|
-
}
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
1474
|
const loadReadmeContent = async path => {
|
|
1491
1475
|
try {
|
|
1492
1476
|
const readmeUrl = join('/', path, 'README.md');
|
|
@@ -1506,10 +1490,9 @@ const loadReadmeContent = async path => {
|
|
|
1506
1490
|
const selectTabDetails = async state => {
|
|
1507
1491
|
const {
|
|
1508
1492
|
extension,
|
|
1509
|
-
|
|
1493
|
+
baseUrl
|
|
1510
1494
|
} = state;
|
|
1511
1495
|
const readmeContent = await loadReadmeContent(extension.path);
|
|
1512
|
-
const baseUrl = getBaseUrl(extension.path, platform);
|
|
1513
1496
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
1514
1497
|
baseUrl
|
|
1515
1498
|
});
|
|
@@ -1625,6 +1608,10 @@ const isThemeExtension = extension => {
|
|
|
1625
1608
|
return extension.name && extension.name.endsWith(' Theme');
|
|
1626
1609
|
};
|
|
1627
1610
|
|
|
1611
|
+
const Web = 1;
|
|
1612
|
+
const Electron = 2;
|
|
1613
|
+
const Remote = 3;
|
|
1614
|
+
|
|
1628
1615
|
const getIcon = (extension, platform, assetDir) => {
|
|
1629
1616
|
if (!extension) {
|
|
1630
1617
|
return extensionDefaultIcon(assetDir);
|
|
@@ -1693,6 +1680,21 @@ const getExtension = async (id, platform) => {
|
|
|
1693
1680
|
}
|
|
1694
1681
|
};
|
|
1695
1682
|
|
|
1683
|
+
const getRemoteSrc = uri => {
|
|
1684
|
+
const src = `/remote${uri}`;
|
|
1685
|
+
return src;
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1688
|
+
const getBaseUrl = (extensionPath, platform) => {
|
|
1689
|
+
switch (platform) {
|
|
1690
|
+
case Remote:
|
|
1691
|
+
case Electron:
|
|
1692
|
+
return getRemoteSrc(extensionPath + '/');
|
|
1693
|
+
default:
|
|
1694
|
+
return extensionPath;
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
|
|
1696
1698
|
const getCategories = () => {
|
|
1697
1699
|
return [{
|
|
1698
1700
|
id: 'themes',
|
|
@@ -1700,6 +1702,99 @@ const getCategories = () => {
|
|
|
1700
1702
|
}];
|
|
1701
1703
|
};
|
|
1702
1704
|
|
|
1705
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1706
|
+
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
1707
|
+
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
1708
|
+
const BIBIT_UNITS = ['b', 'kibit', 'Mibit', 'Gibit', 'Tibit', 'Pibit', 'Eibit', 'Zibit', 'Yibit'];
|
|
1709
|
+
|
|
1710
|
+
/*
|
|
1711
|
+
Formats the given number using `Number#toLocaleString`.
|
|
1712
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
1713
|
+
- If locale is true, the system default locale is used for translation.
|
|
1714
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
1715
|
+
*/
|
|
1716
|
+
const toLocaleString = (number, locale, options) => {
|
|
1717
|
+
let result = number;
|
|
1718
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
1719
|
+
result = number.toLocaleString(locale, options);
|
|
1720
|
+
} else if (locale === true || options !== undefined) {
|
|
1721
|
+
result = number.toLocaleString(undefined, options);
|
|
1722
|
+
}
|
|
1723
|
+
return result;
|
|
1724
|
+
};
|
|
1725
|
+
const log10 = numberOrBigInt => {
|
|
1726
|
+
if (typeof numberOrBigInt === 'number') {
|
|
1727
|
+
return Math.log10(numberOrBigInt);
|
|
1728
|
+
}
|
|
1729
|
+
const string = numberOrBigInt.toString(10);
|
|
1730
|
+
return string.length + Math.log10('0.' + string.slice(0, 15));
|
|
1731
|
+
};
|
|
1732
|
+
const log = numberOrBigInt => {
|
|
1733
|
+
if (typeof numberOrBigInt === 'number') {
|
|
1734
|
+
return Math.log(numberOrBigInt);
|
|
1735
|
+
}
|
|
1736
|
+
return log10(numberOrBigInt) * Math.log(10);
|
|
1737
|
+
};
|
|
1738
|
+
const divide = (numberOrBigInt, divisor) => {
|
|
1739
|
+
if (typeof numberOrBigInt === 'number') {
|
|
1740
|
+
return numberOrBigInt / divisor;
|
|
1741
|
+
}
|
|
1742
|
+
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
1743
|
+
const remainder = numberOrBigInt % BigInt(divisor);
|
|
1744
|
+
return Number(integerPart) + Number(remainder) / divisor;
|
|
1745
|
+
};
|
|
1746
|
+
function prettyBytes(number, options) {
|
|
1747
|
+
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
1748
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
1749
|
+
}
|
|
1750
|
+
options = {
|
|
1751
|
+
bits: false,
|
|
1752
|
+
binary: false,
|
|
1753
|
+
space: true,
|
|
1754
|
+
...options
|
|
1755
|
+
};
|
|
1756
|
+
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
1757
|
+
const separator = options.space ? ' ' : '';
|
|
1758
|
+
if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
|
|
1759
|
+
return ` 0${separator}${UNITS[0]}`;
|
|
1760
|
+
}
|
|
1761
|
+
const isNegative = number < 0;
|
|
1762
|
+
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
1763
|
+
if (isNegative) {
|
|
1764
|
+
number = -number;
|
|
1765
|
+
}
|
|
1766
|
+
let localeOptions;
|
|
1767
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
1768
|
+
localeOptions = {
|
|
1769
|
+
minimumFractionDigits: options.minimumFractionDigits
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
1773
|
+
localeOptions = {
|
|
1774
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
1775
|
+
...localeOptions
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
if (number < 1) {
|
|
1779
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
1780
|
+
return prefix + numberString + separator + UNITS[0];
|
|
1781
|
+
}
|
|
1782
|
+
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
1783
|
+
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
1784
|
+
if (!localeOptions) {
|
|
1785
|
+
number = number.toPrecision(3);
|
|
1786
|
+
}
|
|
1787
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
1788
|
+
const unit = UNITS[exponent];
|
|
1789
|
+
return prefix + numberString + separator + unit;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
const getDisplaySize = size => {
|
|
1793
|
+
return prettyBytes(size, {
|
|
1794
|
+
maximumFractionDigits: 1
|
|
1795
|
+
});
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1703
1798
|
const getEntries = () => {
|
|
1704
1799
|
return [{
|
|
1705
1800
|
key: 'Identifier',
|
|
@@ -1811,6 +1906,10 @@ const getViewletSize = width => {
|
|
|
1811
1906
|
return Large$1;
|
|
1812
1907
|
};
|
|
1813
1908
|
|
|
1909
|
+
const hasColorThemes = extension => {
|
|
1910
|
+
return Boolean(extension && extension.colorThemes && extension.colorThemes.length > 0);
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1814
1913
|
const getSavedSelectedFeature = savedState => {
|
|
1815
1914
|
if (savedState && typeof savedState === 'object' && 'selectedFeature' in savedState && typeof savedState.selectedFeature === 'string') {
|
|
1816
1915
|
return savedState.selectedFeature;
|
|
@@ -1850,8 +1949,7 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1850
1949
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
1851
1950
|
baseUrl
|
|
1852
1951
|
});
|
|
1853
|
-
const
|
|
1854
|
-
const normalizedReadmeHtml = sanitizedReadmeHtml;
|
|
1952
|
+
const detailsVirtualDom = await getMarkdownVirtualDom(readmeHtml);
|
|
1855
1953
|
const iconSrc = getIcon(extension, platform, assetDir);
|
|
1856
1954
|
const description = getDescription(extension);
|
|
1857
1955
|
const name = getName(extension);
|
|
@@ -1863,26 +1961,34 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
1863
1961
|
const features = getFeatures(selectedFeature, extension);
|
|
1864
1962
|
const extensionUri = extension.uri || extension.path;
|
|
1865
1963
|
const folderSize = await getFolderSize(extensionUri);
|
|
1964
|
+
const displaySize = getDisplaySize(size);
|
|
1866
1965
|
const entries = getEntries();
|
|
1867
1966
|
const secondEntries = getSecondEntries();
|
|
1868
1967
|
const categories = getCategories();
|
|
1869
1968
|
const resources = getResources();
|
|
1969
|
+
const sizeValue = getViewletSize(width || 0);
|
|
1970
|
+
const isBuiltin = extension?.builtin;
|
|
1971
|
+
const hasColorTheme = hasColorThemes(extension);
|
|
1870
1972
|
return {
|
|
1871
1973
|
...state,
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
iconSrc,
|
|
1875
|
-
name,
|
|
1974
|
+
baseUrl,
|
|
1975
|
+
categories,
|
|
1876
1976
|
description,
|
|
1877
|
-
|
|
1977
|
+
detailsVirtualDom,
|
|
1978
|
+
displaySize,
|
|
1878
1979
|
entries,
|
|
1879
|
-
secondEntries,
|
|
1880
|
-
categories,
|
|
1881
|
-
resources,
|
|
1882
1980
|
extension,
|
|
1883
|
-
baseUrl,
|
|
1884
1981
|
features,
|
|
1885
|
-
folderSize
|
|
1982
|
+
folderSize,
|
|
1983
|
+
hasColorTheme,
|
|
1984
|
+
iconSrc,
|
|
1985
|
+
isBuiltin,
|
|
1986
|
+
name,
|
|
1987
|
+
resources,
|
|
1988
|
+
secondEntries,
|
|
1989
|
+
selectedTab,
|
|
1990
|
+
sizeOnDisk: size,
|
|
1991
|
+
sizeValue
|
|
1886
1992
|
};
|
|
1887
1993
|
};
|
|
1888
1994
|
|
|
@@ -1986,106 +2092,13 @@ const TableCell = 'TableCell';
|
|
|
1986
2092
|
const TableHeading = 'TableHeading';
|
|
1987
2093
|
const Viewlet = 'Viewlet';
|
|
1988
2094
|
|
|
1989
|
-
const getBadge = (
|
|
1990
|
-
if (
|
|
2095
|
+
const getBadge = (builtin, badgeEnabled) => {
|
|
2096
|
+
if (builtin && badgeEnabled) {
|
|
1991
2097
|
return 'builtin';
|
|
1992
2098
|
}
|
|
1993
2099
|
return '';
|
|
1994
2100
|
};
|
|
1995
2101
|
|
|
1996
|
-
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
1997
|
-
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
1998
|
-
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
1999
|
-
const BIBIT_UNITS = ['b', 'kibit', 'Mibit', 'Gibit', 'Tibit', 'Pibit', 'Eibit', 'Zibit', 'Yibit'];
|
|
2000
|
-
|
|
2001
|
-
/*
|
|
2002
|
-
Formats the given number using `Number#toLocaleString`.
|
|
2003
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
2004
|
-
- If locale is true, the system default locale is used for translation.
|
|
2005
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
2006
|
-
*/
|
|
2007
|
-
const toLocaleString = (number, locale, options) => {
|
|
2008
|
-
let result = number;
|
|
2009
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
2010
|
-
result = number.toLocaleString(locale, options);
|
|
2011
|
-
} else if (locale === true || options !== undefined) {
|
|
2012
|
-
result = number.toLocaleString(undefined, options);
|
|
2013
|
-
}
|
|
2014
|
-
return result;
|
|
2015
|
-
};
|
|
2016
|
-
const log10 = numberOrBigInt => {
|
|
2017
|
-
if (typeof numberOrBigInt === 'number') {
|
|
2018
|
-
return Math.log10(numberOrBigInt);
|
|
2019
|
-
}
|
|
2020
|
-
const string = numberOrBigInt.toString(10);
|
|
2021
|
-
return string.length + Math.log10('0.' + string.slice(0, 15));
|
|
2022
|
-
};
|
|
2023
|
-
const log = numberOrBigInt => {
|
|
2024
|
-
if (typeof numberOrBigInt === 'number') {
|
|
2025
|
-
return Math.log(numberOrBigInt);
|
|
2026
|
-
}
|
|
2027
|
-
return log10(numberOrBigInt) * Math.log(10);
|
|
2028
|
-
};
|
|
2029
|
-
const divide = (numberOrBigInt, divisor) => {
|
|
2030
|
-
if (typeof numberOrBigInt === 'number') {
|
|
2031
|
-
return numberOrBigInt / divisor;
|
|
2032
|
-
}
|
|
2033
|
-
const integerPart = numberOrBigInt / BigInt(divisor);
|
|
2034
|
-
const remainder = numberOrBigInt % BigInt(divisor);
|
|
2035
|
-
return Number(integerPart) + Number(remainder) / divisor;
|
|
2036
|
-
};
|
|
2037
|
-
function prettyBytes(number, options) {
|
|
2038
|
-
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
2039
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
2040
|
-
}
|
|
2041
|
-
options = {
|
|
2042
|
-
bits: false,
|
|
2043
|
-
binary: false,
|
|
2044
|
-
space: true,
|
|
2045
|
-
...options
|
|
2046
|
-
};
|
|
2047
|
-
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
2048
|
-
const separator = options.space ? ' ' : '';
|
|
2049
|
-
if (options.signed && (typeof number === 'number' ? number === 0 : number === 0n)) {
|
|
2050
|
-
return ` 0${separator}${UNITS[0]}`;
|
|
2051
|
-
}
|
|
2052
|
-
const isNegative = number < 0;
|
|
2053
|
-
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
2054
|
-
if (isNegative) {
|
|
2055
|
-
number = -number;
|
|
2056
|
-
}
|
|
2057
|
-
let localeOptions;
|
|
2058
|
-
if (options.minimumFractionDigits !== undefined) {
|
|
2059
|
-
localeOptions = {
|
|
2060
|
-
minimumFractionDigits: options.minimumFractionDigits
|
|
2061
|
-
};
|
|
2062
|
-
}
|
|
2063
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
2064
|
-
localeOptions = {
|
|
2065
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
|
2066
|
-
...localeOptions
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
if (number < 1) {
|
|
2070
|
-
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
2071
|
-
return prefix + numberString + separator + UNITS[0];
|
|
2072
|
-
}
|
|
2073
|
-
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
2074
|
-
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
2075
|
-
if (!localeOptions) {
|
|
2076
|
-
number = number.toPrecision(3);
|
|
2077
|
-
}
|
|
2078
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
2079
|
-
const unit = UNITS[exponent];
|
|
2080
|
-
return prefix + numberString + separator + unit;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
const getDisplaySize = size => {
|
|
2084
|
-
return prettyBytes(size, {
|
|
2085
|
-
maximumFractionDigits: 1
|
|
2086
|
-
});
|
|
2087
|
-
};
|
|
2088
|
-
|
|
2089
2102
|
const HandleClickCategory = 'handleClickCategory';
|
|
2090
2103
|
const HandleClickDisable = 'handleClickDisable';
|
|
2091
2104
|
const HandleClickScrollToTop = 'handleClickScrollToTop';
|
|
@@ -2099,15 +2112,11 @@ const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
|
2099
2112
|
const HandleReadmeWheel = 'handleReadmeWheel';
|
|
2100
2113
|
const HandleTabsClick = 'handleTabsClick';
|
|
2101
2114
|
|
|
2102
|
-
const
|
|
2103
|
-
return Boolean(extension && extension.colorThemes && extension.colorThemes.length > 0);
|
|
2104
|
-
};
|
|
2105
|
-
|
|
2106
|
-
const getExtensionDetailButtons = extension => {
|
|
2115
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin) => {
|
|
2107
2116
|
const allActions = [{
|
|
2108
2117
|
label: setColorTheme$3(),
|
|
2109
2118
|
onClick: HandleClickSetColorTheme,
|
|
2110
|
-
enabled:
|
|
2119
|
+
enabled: hasColorTheme,
|
|
2111
2120
|
name: SetColorTheme
|
|
2112
2121
|
}, {
|
|
2113
2122
|
label: disable(),
|
|
@@ -2117,7 +2126,7 @@ const getExtensionDetailButtons = extension => {
|
|
|
2117
2126
|
}, {
|
|
2118
2127
|
label: uninstall(),
|
|
2119
2128
|
onClick: HandleClickUninstall,
|
|
2120
|
-
enabled: !
|
|
2129
|
+
enabled: !isBuiltin,
|
|
2121
2130
|
name: Uninstall
|
|
2122
2131
|
}];
|
|
2123
2132
|
return allActions;
|
|
@@ -2340,7 +2349,8 @@ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
|
|
|
2340
2349
|
}
|
|
2341
2350
|
return count;
|
|
2342
2351
|
};
|
|
2343
|
-
const getDetailsVirtualDom =
|
|
2352
|
+
const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint // new parameter, no default
|
|
2353
|
+
) => {
|
|
2344
2354
|
const firstHeading = installation();
|
|
2345
2355
|
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
|
|
2346
2356
|
const secondHeading = marketplace();
|
|
@@ -2354,7 +2364,7 @@ const getDetailsVirtualDom = async (sanitizedReadmeHtml, displaySize, extensionI
|
|
|
2354
2364
|
className: ExtensionDetailPanel,
|
|
2355
2365
|
childCount: childCount,
|
|
2356
2366
|
role: Panel
|
|
2357
|
-
}, ...getScrollToTopVirtualDom(scrollToTopButtonEnabled), ...
|
|
2367
|
+
}, ...getScrollToTopVirtualDom(scrollToTopButtonEnabled), ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
|
|
2358
2368
|
return dom;
|
|
2359
2369
|
};
|
|
2360
2370
|
|
|
@@ -2585,7 +2595,7 @@ const getVirtualDomChildCount = dom => {
|
|
|
2585
2595
|
return stack.length;
|
|
2586
2596
|
};
|
|
2587
2597
|
|
|
2588
|
-
const getFeatureThemesVirtualDom =
|
|
2598
|
+
const getFeatureThemesVirtualDom = themesDom => {
|
|
2589
2599
|
const childCount = getVirtualDomChildCount(themesDom);
|
|
2590
2600
|
const heading = theme();
|
|
2591
2601
|
return [{
|
|
@@ -2665,10 +2675,10 @@ const getFeatureWebViewsVirtualDom = extension => {
|
|
|
2665
2675
|
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
2666
2676
|
};
|
|
2667
2677
|
|
|
2668
|
-
const getFeatureContentVirtualDom =
|
|
2678
|
+
const getFeatureContentVirtualDom = (features, themesDom, selectedFeature, extension) => {
|
|
2669
2679
|
switch (selectedFeature) {
|
|
2670
2680
|
case Theme:
|
|
2671
|
-
return
|
|
2681
|
+
return getFeatureThemesVirtualDom(themesDom);
|
|
2672
2682
|
case Commands:
|
|
2673
2683
|
return getFeatureCommandsVirtualDom(extension);
|
|
2674
2684
|
case JsonValidation:
|
|
@@ -2710,7 +2720,7 @@ const getFeatureListVirtualDom = features => {
|
|
|
2710
2720
|
}, ...features.flatMap(getFeatureListItemVirtualDom)];
|
|
2711
2721
|
};
|
|
2712
2722
|
|
|
2713
|
-
const getFeaturesVirtualDom =
|
|
2723
|
+
const getFeaturesVirtualDom = (features, themesDom, selectedFeature, extension) => {
|
|
2714
2724
|
if (features.length === 0) {
|
|
2715
2725
|
const none$1 = none();
|
|
2716
2726
|
return [{
|
|
@@ -2727,15 +2737,15 @@ const getFeaturesVirtualDom = async (features, themesDom, selectedFeature, exten
|
|
|
2727
2737
|
type: VirtualDomElements.Div,
|
|
2728
2738
|
className: mergeClassNames(Sash, SashVertical),
|
|
2729
2739
|
childCount: 0
|
|
2730
|
-
}, ...
|
|
2740
|
+
}, ...getFeatureContentVirtualDom(features, themesDom, selectedFeature, extension)];
|
|
2731
2741
|
};
|
|
2732
2742
|
|
|
2733
|
-
const getExtensionDetailContentVirtualDom =
|
|
2743
|
+
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, themesDom, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, scrollToTopButtonEnabled, categories, resources, breakpoint) => {
|
|
2734
2744
|
switch (selectedTab) {
|
|
2735
2745
|
case Details:
|
|
2736
|
-
return
|
|
2746
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extension.uri || extension.path || '', scrollToTopButtonEnabled, categories, resources, breakpoint);
|
|
2737
2747
|
case Features$1:
|
|
2738
|
-
return
|
|
2748
|
+
return getFeaturesVirtualDom(features, themesDom, selectedFeature, extension);
|
|
2739
2749
|
case Changelog$1:
|
|
2740
2750
|
return getChangelogVirtualDom();
|
|
2741
2751
|
default:
|
|
@@ -2897,7 +2907,7 @@ const getClassNames = size => {
|
|
|
2897
2907
|
}
|
|
2898
2908
|
};
|
|
2899
2909
|
|
|
2900
|
-
const getExtensionDetailVirtualDom =
|
|
2910
|
+
const getExtensionDetailVirtualDom = (newState, selectedTab) => {
|
|
2901
2911
|
// TODO move this to view model so that rendering occurs like
|
|
2902
2912
|
// 1. state
|
|
2903
2913
|
// 2. view model
|
|
@@ -2907,21 +2917,24 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
|
|
|
2907
2917
|
const selectedFeature = newState?.selectedFeature || '';
|
|
2908
2918
|
const extension = newState?.extension || {};
|
|
2909
2919
|
const features = getFeatures(selectedFeature, extension);
|
|
2910
|
-
const size = newState.folderSize || 0;
|
|
2911
2920
|
const extensionId = newState?.extension?.id || 'n/a';
|
|
2912
2921
|
const extensionVersion = newState?.extension?.version || 'n/a';
|
|
2913
|
-
const
|
|
2922
|
+
const {
|
|
2923
|
+
displaySize
|
|
2924
|
+
} = newState;
|
|
2914
2925
|
const width = newState?.width || 500;
|
|
2915
2926
|
const tabs = getTabs(selectedTab);
|
|
2916
|
-
const
|
|
2927
|
+
const {
|
|
2928
|
+
sizeValue
|
|
2929
|
+
} = newState;
|
|
2917
2930
|
const sizeClass = getClassNames(sizeValue);
|
|
2918
|
-
const buttonDefs = getExtensionDetailButtons(
|
|
2931
|
+
const buttonDefs = getExtensionDetailButtons(newState.hasColorTheme, newState.isBuiltin);
|
|
2919
2932
|
const {
|
|
2920
2933
|
name,
|
|
2921
2934
|
iconSrc,
|
|
2922
2935
|
description
|
|
2923
2936
|
} = newState;
|
|
2924
|
-
const badge = getBadge(
|
|
2937
|
+
const badge = getBadge(newState.isBuiltin, newState.builtinExtensionsBadgeEnabled); // TODO compute in loadContent
|
|
2925
2938
|
const {
|
|
2926
2939
|
settingsButtonEnabled
|
|
2927
2940
|
} = newState;
|
|
@@ -2929,16 +2942,16 @@ const getExtensionDetailVirtualDom = async (newState, sanitizedReadmeHtml, selec
|
|
|
2929
2942
|
type: VirtualDomElements.Div,
|
|
2930
2943
|
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
2931
2944
|
childCount: 3
|
|
2932
|
-
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...
|
|
2945
|
+
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(newState.detailsVirtualDom, themesHtml, selectedTab, features, displaySize, extensionId, extensionVersion, selectedFeature, extension, width, newState.scrollToTopButtonEnabled, newState.categories, newState.resources, newState.showAdditionalDetailsBreakpoint)];
|
|
2933
2946
|
return dom;
|
|
2934
2947
|
};
|
|
2935
2948
|
|
|
2936
|
-
const renderDom =
|
|
2937
|
-
const dom =
|
|
2949
|
+
const renderDom = (oldState, newState) => {
|
|
2950
|
+
const dom = getExtensionDetailVirtualDom(newState, newState.selectedTab);
|
|
2938
2951
|
return ['Viewlet.setDom2', dom];
|
|
2939
2952
|
};
|
|
2940
2953
|
|
|
2941
|
-
const renderFocus =
|
|
2954
|
+
const renderFocus = (oldState, newState) => {
|
|
2942
2955
|
return ['Viewlet.focusElementByName', ''];
|
|
2943
2956
|
};
|
|
2944
2957
|
|
|
@@ -2953,22 +2966,22 @@ const getRenderer = diffType => {
|
|
|
2953
2966
|
}
|
|
2954
2967
|
};
|
|
2955
2968
|
|
|
2956
|
-
const applyRender =
|
|
2969
|
+
const applyRender = (oldState, newState, diffResult) => {
|
|
2957
2970
|
const commands = [];
|
|
2958
2971
|
for (const item of diffResult) {
|
|
2959
2972
|
const fn = getRenderer(item);
|
|
2960
|
-
commands.push(
|
|
2973
|
+
commands.push(fn(oldState, newState));
|
|
2961
2974
|
}
|
|
2962
2975
|
return commands;
|
|
2963
2976
|
};
|
|
2964
2977
|
|
|
2965
|
-
const render2 =
|
|
2978
|
+
const render2 = (uid, diffResult) => {
|
|
2966
2979
|
const {
|
|
2967
2980
|
oldState,
|
|
2968
2981
|
newState
|
|
2969
2982
|
} = get$1(uid);
|
|
2970
2983
|
set$1(uid, oldState, newState);
|
|
2971
|
-
const commands =
|
|
2984
|
+
const commands = applyRender(oldState, newState, diffResult);
|
|
2972
2985
|
return commands;
|
|
2973
2986
|
};
|
|
2974
2987
|
|