@lvce-editor/extension-detail-view 3.62.0 → 3.63.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.
|
@@ -2887,7 +2887,7 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
2887
2887
|
};
|
|
2888
2888
|
|
|
2889
2889
|
const isEqual$1 = (oldState, newState) => {
|
|
2890
|
-
return oldState.activationEvents === newState.activationEvents && oldState.badge === newState.badge && oldState.categories === newState.categories && oldState.changelogVirtualDom === newState.changelogVirtualDom && oldState.commands === newState.commands && oldState.description === newState.description && oldState.detailsVirtualDom === newState.detailsVirtualDom && oldState.displaySize === newState.displaySize && oldState.extensionId === newState.extensionId && oldState.extensionVersion === newState.extensionVersion && oldState.jsonValidation === newState.jsonValidation && oldState.selectedFeature === newState.selectedFeature && oldState.selectedTab === newState.selectedTab && oldState.settings === newState.settings && oldState.
|
|
2890
|
+
return oldState.activationEvents === newState.activationEvents && oldState.badge === newState.badge && oldState.buttons === newState.buttons && oldState.categories === newState.categories && oldState.changelogVirtualDom === newState.changelogVirtualDom && oldState.commands === newState.commands && oldState.description === newState.description && oldState.detailsVirtualDom === newState.detailsVirtualDom && oldState.disabled === newState.disabled && oldState.displaySize === newState.displaySize && oldState.extensionId === newState.extensionId && oldState.extensionVersion === newState.extensionVersion && oldState.jsonValidation === newState.jsonValidation && oldState.selectedFeature === newState.selectedFeature && oldState.selectedTab === newState.selectedTab && oldState.settings === newState.settings && oldState.showSideBar === newState.showSideBar && oldState.sizeValue === newState.sizeValue && oldState.themesMarkdownDom === newState.themesMarkdownDom && oldState.webViews === newState.webViews;
|
|
2891
2891
|
};
|
|
2892
2892
|
|
|
2893
2893
|
const User = 1;
|
|
@@ -3012,13 +3012,87 @@ const disableExtension = id => {
|
|
|
3012
3012
|
return disableExtension$1(id);
|
|
3013
3013
|
};
|
|
3014
3014
|
|
|
3015
|
-
const
|
|
3015
|
+
const Web = 1;
|
|
3016
|
+
const Electron = 2;
|
|
3017
|
+
const Remote = 3;
|
|
3018
|
+
|
|
3019
|
+
const getAllExtensions = async platform => {
|
|
3020
|
+
if (platform === Web) {
|
|
3021
|
+
return [];
|
|
3022
|
+
}
|
|
3023
|
+
// @ts-ignore
|
|
3024
|
+
return getAllExtensions$1();
|
|
3025
|
+
};
|
|
3026
|
+
const getExtension$1 = async (id, platform) => {
|
|
3027
|
+
// TODO only ask one extension from renderer worker instead of all
|
|
3028
|
+
const allExtensions = await getAllExtensions(platform);
|
|
3029
|
+
for (const extension of allExtensions) {
|
|
3030
|
+
if (extension.id === id) {
|
|
3031
|
+
return extension;
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
return undefined;
|
|
3035
|
+
};
|
|
3036
|
+
|
|
3037
|
+
const getExtensionNew = async id => {
|
|
3038
|
+
return getExtension$2(id);
|
|
3039
|
+
};
|
|
3040
|
+
const getExtension = async (id, platform) => {
|
|
3041
|
+
try {
|
|
3042
|
+
return await getExtensionNew(id);
|
|
3043
|
+
} catch {
|
|
3044
|
+
return getExtension$1(id, platform);
|
|
3045
|
+
}
|
|
3046
|
+
};
|
|
3047
|
+
|
|
3048
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
3049
|
+
const allActions = [{
|
|
3050
|
+
label: setColorTheme$3(),
|
|
3051
|
+
onClick: HandleClickSetColorTheme,
|
|
3052
|
+
enabled: hasColorTheme,
|
|
3053
|
+
name: SetColorTheme
|
|
3054
|
+
}, {
|
|
3055
|
+
label: enable(),
|
|
3056
|
+
onClick: HandleClickEnable,
|
|
3057
|
+
enabled: isDisabled,
|
|
3058
|
+
name: Enable
|
|
3059
|
+
}, {
|
|
3060
|
+
label: disable(),
|
|
3061
|
+
onClick: HandleClickDisable,
|
|
3062
|
+
enabled: !isDisabled,
|
|
3063
|
+
name: Disable
|
|
3064
|
+
}, {
|
|
3065
|
+
label: uninstall(),
|
|
3066
|
+
onClick: HandleClickUninstall,
|
|
3067
|
+
enabled: !isBuiltin,
|
|
3068
|
+
name: Uninstall
|
|
3069
|
+
}];
|
|
3070
|
+
const filteredButtons = allActions.filter(button => button.enabled);
|
|
3071
|
+
return filteredButtons;
|
|
3072
|
+
};
|
|
3073
|
+
|
|
3074
|
+
const updateExtensionStatus = async (state, updateFunction) => {
|
|
3016
3075
|
const {
|
|
3017
|
-
extensionId
|
|
3076
|
+
extensionId,
|
|
3077
|
+
platform,
|
|
3078
|
+
hasColorTheme
|
|
3018
3079
|
} = state;
|
|
3019
|
-
await
|
|
3020
|
-
|
|
3021
|
-
|
|
3080
|
+
const error = await updateFunction(extensionId);
|
|
3081
|
+
if (error) {
|
|
3082
|
+
await confirm(`${error}`);
|
|
3083
|
+
}
|
|
3084
|
+
const extension = await getExtension(extensionId, platform);
|
|
3085
|
+
const disabled = extension?.disabled;
|
|
3086
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, false, disabled);
|
|
3087
|
+
return {
|
|
3088
|
+
...state,
|
|
3089
|
+
disabled: extension?.disabled,
|
|
3090
|
+
buttons
|
|
3091
|
+
};
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
const handleClickDisable = async state => {
|
|
3095
|
+
return updateExtensionStatus(state, disableExtension);
|
|
3022
3096
|
};
|
|
3023
3097
|
|
|
3024
3098
|
const selectFeature = async (state, name) => {
|
|
@@ -3392,39 +3466,6 @@ const existsFile = async uri => {
|
|
|
3392
3466
|
return exists(uri);
|
|
3393
3467
|
};
|
|
3394
3468
|
|
|
3395
|
-
const Web = 1;
|
|
3396
|
-
const Electron = 2;
|
|
3397
|
-
const Remote = 3;
|
|
3398
|
-
|
|
3399
|
-
const getAllExtensions = async platform => {
|
|
3400
|
-
if (platform === Web) {
|
|
3401
|
-
return [];
|
|
3402
|
-
}
|
|
3403
|
-
// @ts-ignore
|
|
3404
|
-
return getAllExtensions$1();
|
|
3405
|
-
};
|
|
3406
|
-
const getExtension$1 = async (id, platform) => {
|
|
3407
|
-
// TODO only ask one extension from renderer worker instead of all
|
|
3408
|
-
const allExtensions = await getAllExtensions(platform);
|
|
3409
|
-
for (const extension of allExtensions) {
|
|
3410
|
-
if (extension.id === id) {
|
|
3411
|
-
return extension;
|
|
3412
|
-
}
|
|
3413
|
-
}
|
|
3414
|
-
return undefined;
|
|
3415
|
-
};
|
|
3416
|
-
|
|
3417
|
-
const getExtensionNew = async id => {
|
|
3418
|
-
return getExtension$2(id);
|
|
3419
|
-
};
|
|
3420
|
-
const getExtension = async (id, platform) => {
|
|
3421
|
-
try {
|
|
3422
|
-
return await getExtensionNew(id);
|
|
3423
|
-
} catch {
|
|
3424
|
-
return getExtension$1(id, platform);
|
|
3425
|
-
}
|
|
3426
|
-
};
|
|
3427
|
-
|
|
3428
3469
|
class ExtensionNotFoundError extends Error {
|
|
3429
3470
|
constructor(extensionId) {
|
|
3430
3471
|
super(`extension not found: ${extensionId}`);
|
|
@@ -3447,31 +3488,6 @@ const getBaseUrl = (extensionPath, platform) => {
|
|
|
3447
3488
|
}
|
|
3448
3489
|
};
|
|
3449
3490
|
|
|
3450
|
-
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
3451
|
-
const allActions = [{
|
|
3452
|
-
label: setColorTheme$3(),
|
|
3453
|
-
onClick: HandleClickSetColorTheme,
|
|
3454
|
-
enabled: hasColorTheme,
|
|
3455
|
-
name: SetColorTheme
|
|
3456
|
-
}, {
|
|
3457
|
-
label: enable(),
|
|
3458
|
-
onClick: HandleClickEnable,
|
|
3459
|
-
enabled: isDisabled,
|
|
3460
|
-
name: Enable
|
|
3461
|
-
}, {
|
|
3462
|
-
label: disable(),
|
|
3463
|
-
onClick: HandleClickDisable,
|
|
3464
|
-
enabled: !isDisabled,
|
|
3465
|
-
name: Disable
|
|
3466
|
-
}, {
|
|
3467
|
-
label: uninstall(),
|
|
3468
|
-
onClick: HandleClickUninstall,
|
|
3469
|
-
enabled: !isBuiltin,
|
|
3470
|
-
name: Uninstall
|
|
3471
|
-
}];
|
|
3472
|
-
return allActions;
|
|
3473
|
-
};
|
|
3474
|
-
|
|
3475
3491
|
const getExtensionIdFromUri = uri => {
|
|
3476
3492
|
const id = uri.slice('extension-detail://'.length);
|
|
3477
3493
|
return id;
|
|
@@ -3940,7 +3956,6 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
3940
3956
|
const isBuiltin = extension?.isBuiltin;
|
|
3941
3957
|
const disabled = extension?.disabled;
|
|
3942
3958
|
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled);
|
|
3943
|
-
const enabledButtons = buttons.filter(button => button.enabled);
|
|
3944
3959
|
const size = getViewletSize(width);
|
|
3945
3960
|
const {
|
|
3946
3961
|
selectedFeature,
|
|
@@ -3968,7 +3983,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
3968
3983
|
...state,
|
|
3969
3984
|
badge,
|
|
3970
3985
|
baseUrl,
|
|
3971
|
-
buttons
|
|
3986
|
+
buttons,
|
|
3972
3987
|
categories,
|
|
3973
3988
|
changelogScrollTop,
|
|
3974
3989
|
description,
|