@lvce-editor/extension-detail-view 7.14.0 → 7.14.1
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.
|
@@ -4398,6 +4398,26 @@ const handleClickUninstall = async state => {
|
|
|
4398
4398
|
return state;
|
|
4399
4399
|
};
|
|
4400
4400
|
|
|
4401
|
+
const handleColorThemeChanged = (state, colorThemeId) => {
|
|
4402
|
+
if (state.currentColorThemeId === colorThemeId) {
|
|
4403
|
+
return state;
|
|
4404
|
+
}
|
|
4405
|
+
const {
|
|
4406
|
+
disabled,
|
|
4407
|
+
extension,
|
|
4408
|
+
hasColorTheme
|
|
4409
|
+
} = state;
|
|
4410
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
4411
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
4412
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
4413
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, colorThemeId);
|
|
4414
|
+
return {
|
|
4415
|
+
...state,
|
|
4416
|
+
buttons,
|
|
4417
|
+
currentColorThemeId: colorThemeId
|
|
4418
|
+
};
|
|
4419
|
+
};
|
|
4420
|
+
|
|
4401
4421
|
const existsFile = async uri => {
|
|
4402
4422
|
try {
|
|
4403
4423
|
return await exists(uri);
|
|
@@ -4759,10 +4779,10 @@ const loadHeaderContent = (state, platform, extension) => {
|
|
|
4759
4779
|
const extensionId = extension?.id || 'n/a';
|
|
4760
4780
|
const extensionVersion = extension?.version || 'n/a';
|
|
4761
4781
|
const hasColorTheme = hasColorThemes(extension);
|
|
4762
|
-
const isBuiltin = extension?.builtin;
|
|
4782
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
4763
4783
|
const badge = getBadge(isBuiltin, builtinExtensionsBadgeEnabled);
|
|
4764
|
-
const downloadCount = getDownloadCount(extension);
|
|
4765
|
-
const rating = getRating(extension);
|
|
4784
|
+
const downloadCount = isBuiltin ? 'n/a' : getDownloadCount(extension);
|
|
4785
|
+
const rating = isBuiltin ? 'n/a' : getRating(extension);
|
|
4766
4786
|
return {
|
|
4767
4787
|
badge,
|
|
4768
4788
|
description,
|
|
@@ -4921,21 +4941,17 @@ function prettyBytes(number, options) {
|
|
|
4921
4941
|
number = -number;
|
|
4922
4942
|
}
|
|
4923
4943
|
const localeOptions = buildLocaleOptions(options);
|
|
4924
|
-
let
|
|
4925
|
-
if (number
|
|
4926
|
-
|
|
4927
|
-
result = prefix + numberString + separator + UNITS[0];
|
|
4928
|
-
} else {
|
|
4929
|
-
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
4930
|
-
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
4931
|
-
if (!localeOptions) {
|
|
4932
|
-
const minPrecision = Math.max(3, Math.floor(number).toString().length);
|
|
4933
|
-
number = number.toPrecision(minPrecision);
|
|
4934
|
-
}
|
|
4935
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
4936
|
-
const unit = UNITS[exponent];
|
|
4937
|
-
result = prefix + numberString + separator + unit;
|
|
4944
|
+
let exponent = 0;
|
|
4945
|
+
if (number >= 1) {
|
|
4946
|
+
exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
4938
4947
|
}
|
|
4948
|
+
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
4949
|
+
if (!localeOptions) {
|
|
4950
|
+
const minPrecision = Math.max(3, Math.floor(number).toString().length);
|
|
4951
|
+
number = Number(number.toPrecision(minPrecision));
|
|
4952
|
+
}
|
|
4953
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
4954
|
+
const result = prefix + numberString + separator + UNITS[exponent];
|
|
4939
4955
|
return applyFixedWidth(result, options.fixedWidth);
|
|
4940
4956
|
}
|
|
4941
4957
|
|
|
@@ -6576,11 +6592,18 @@ const getStatisticVirtualDom = (label, value, className) => {
|
|
|
6576
6592
|
}, text(value)];
|
|
6577
6593
|
};
|
|
6578
6594
|
const getExtensionDetailMetadataVirtualDom = (downloadCount$1, rating$1) => {
|
|
6595
|
+
const hasDownloadCount = downloadCount$1 !== 'n/a';
|
|
6596
|
+
const hasRating = rating$1 !== 'n/a';
|
|
6597
|
+
if (!hasDownloadCount && !hasRating) {
|
|
6598
|
+
return [];
|
|
6599
|
+
}
|
|
6600
|
+
const downloadCountDom = hasDownloadCount ? getStatisticVirtualDom(downloadCount(), downloadCount$1, ExtensionDetailDownloadCount) : [];
|
|
6601
|
+
const ratingDom = hasRating ? getStatisticVirtualDom(rating(), rating$1, ExtensionDetailRating) : [];
|
|
6579
6602
|
return [{
|
|
6580
|
-
childCount:
|
|
6603
|
+
childCount: Number(hasDownloadCount) + Number(hasRating),
|
|
6581
6604
|
className: ExtensionDetailMetadata,
|
|
6582
6605
|
type: Div
|
|
6583
|
-
}, ...
|
|
6606
|
+
}, ...downloadCountDom, ...ratingDom];
|
|
6584
6607
|
};
|
|
6585
6608
|
|
|
6586
6609
|
const getNameBadgeVirtualDom = badge => {
|
|
@@ -6619,16 +6642,17 @@ const getExtensionDetailNameVirtualDom = (name, badge) => {
|
|
|
6619
6642
|
};
|
|
6620
6643
|
|
|
6621
6644
|
const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, buttonDefs, settingsButtonEnabled, downloadCount = 'n/a', rating = 'n/a') => {
|
|
6645
|
+
const metadataDom = getExtensionDetailMetadataVirtualDom(downloadCount, rating);
|
|
6622
6646
|
const dom = [{
|
|
6623
6647
|
childCount: 2,
|
|
6624
6648
|
className: ExtensionDetailHeader,
|
|
6625
6649
|
type: Div
|
|
6626
6650
|
}, getExtensionDetailIconVirtualDom(iconSrc), {
|
|
6627
|
-
childCount: 4,
|
|
6651
|
+
childCount: metadataDom.length > 0 ? 4 : 3,
|
|
6628
6652
|
className: ExtensionDetailHeaderDetails,
|
|
6629
6653
|
onContextMenu: HandleHeaderContextMenu,
|
|
6630
6654
|
type: Div
|
|
6631
|
-
}, ...getExtensionDetailNameVirtualDom(name, badge), ...getExtensionDetailDescriptionVirtualDom(description), ...
|
|
6655
|
+
}, ...getExtensionDetailNameVirtualDom(name, badge), ...getExtensionDetailDescriptionVirtualDom(description), ...metadataDom, ...getExtensionDetailHeaderActionsVirtualDom(buttonDefs, settingsButtonEnabled)];
|
|
6632
6656
|
return dom;
|
|
6633
6657
|
};
|
|
6634
6658
|
|
|
@@ -6974,6 +6998,7 @@ const commandMap = {
|
|
|
6974
6998
|
'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
|
|
6975
6999
|
'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
|
|
6976
7000
|
'ExtensionDetail.handleClickUninstall': wrapCommand(handleClickUninstall),
|
|
7001
|
+
'ExtensionDetail.handleColorThemeChanged': wrapCommand(handleColorThemeChanged),
|
|
6977
7002
|
'ExtensionDetail.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
|
|
6978
7003
|
'ExtensionDetail.handleExtensionsStatusUpdate': wrapCommand(handleExtensionsStatusUpdate),
|
|
6979
7004
|
'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
|