@lvce-editor/extension-detail-view 7.2.0 → 7.3.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.
|
@@ -341,6 +341,7 @@ const None$2 = 0;
|
|
|
341
341
|
const Web$1 = 1;
|
|
342
342
|
const Electron$1 = 2;
|
|
343
343
|
|
|
344
|
+
const ClipBoardWorker = 3400;
|
|
344
345
|
const ExtensionHostWorker = 44;
|
|
345
346
|
const ExtensionManagementWorker = 9006;
|
|
346
347
|
const FileSystemWorker$1 = 209;
|
|
@@ -2236,7 +2237,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
2236
2237
|
const responseMessage = await promise;
|
|
2237
2238
|
return unwrapJsonRpcResult(responseMessage);
|
|
2238
2239
|
};
|
|
2239
|
-
const createRpc = ipc => {
|
|
2240
|
+
const createRpc$1 = ipc => {
|
|
2240
2241
|
const callbacks = Object.create(null);
|
|
2241
2242
|
ipc._resolve = (id, response) => {
|
|
2242
2243
|
const fn = callbacks[id];
|
|
@@ -2316,7 +2317,7 @@ const create$6 = async ({
|
|
|
2316
2317
|
});
|
|
2317
2318
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2318
2319
|
handleIpc(ipc);
|
|
2319
|
-
const rpc = createRpc(ipc);
|
|
2320
|
+
const rpc = createRpc$1(ipc);
|
|
2320
2321
|
messagePort.start();
|
|
2321
2322
|
return rpc;
|
|
2322
2323
|
};
|
|
@@ -2387,7 +2388,7 @@ const create$3 = async ({
|
|
|
2387
2388
|
register(commandMap);
|
|
2388
2389
|
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
2389
2390
|
handleIpc(ipc);
|
|
2390
|
-
const rpc = createRpc(ipc);
|
|
2391
|
+
const rpc = createRpc$1(ipc);
|
|
2391
2392
|
return rpc;
|
|
2392
2393
|
};
|
|
2393
2394
|
|
|
@@ -2412,7 +2413,7 @@ const createMockRpc = ({
|
|
|
2412
2413
|
};
|
|
2413
2414
|
|
|
2414
2415
|
const rpcs = Object.create(null);
|
|
2415
|
-
const set$
|
|
2416
|
+
const set$b = (id, rpc) => {
|
|
2416
2417
|
rpcs[id] = rpc;
|
|
2417
2418
|
};
|
|
2418
2419
|
const get$2 = id => {
|
|
@@ -2445,7 +2446,7 @@ const create$2 = rpcId => {
|
|
|
2445
2446
|
const mockRpc = createMockRpc({
|
|
2446
2447
|
commandMap
|
|
2447
2448
|
});
|
|
2448
|
-
set$
|
|
2449
|
+
set$b(rpcId, mockRpc);
|
|
2449
2450
|
// @ts-ignore
|
|
2450
2451
|
mockRpc[Symbol.dispose] = () => {
|
|
2451
2452
|
remove(rpcId);
|
|
@@ -2454,11 +2455,15 @@ const create$2 = rpcId => {
|
|
|
2454
2455
|
return mockRpc;
|
|
2455
2456
|
},
|
|
2456
2457
|
set(rpc) {
|
|
2457
|
-
set$
|
|
2458
|
+
set$b(rpcId, rpc);
|
|
2458
2459
|
}
|
|
2459
2460
|
};
|
|
2460
2461
|
};
|
|
2461
2462
|
|
|
2463
|
+
const {
|
|
2464
|
+
set: set$a
|
|
2465
|
+
} = create$2(ClipBoardWorker);
|
|
2466
|
+
|
|
2462
2467
|
const {
|
|
2463
2468
|
invoke: invoke$5,
|
|
2464
2469
|
set: set$9
|
|
@@ -2541,6 +2546,10 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
2541
2546
|
const setColorTheme$1 = async id => {
|
|
2542
2547
|
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
2543
2548
|
};
|
|
2549
|
+
const sendMessagePortToClipBoardWorker = async (port, rpcId) => {
|
|
2550
|
+
const command = 'ClipBoard.handleMessagePort';
|
|
2551
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
2552
|
+
};
|
|
2544
2553
|
const sendMessagePortToMarkdownWorker$1 = async (port, rpcId) => {
|
|
2545
2554
|
const command = 'Markdown.handleMessagePort';
|
|
2546
2555
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
@@ -2594,6 +2603,9 @@ const openExternal$1 = async uri => {
|
|
|
2594
2603
|
const openUrl = async uri => {
|
|
2595
2604
|
await invoke$1('Open.openUrl', uri);
|
|
2596
2605
|
};
|
|
2606
|
+
const getAllPreferences = async () => {
|
|
2607
|
+
return invoke$1('Preferences.getAll');
|
|
2608
|
+
};
|
|
2597
2609
|
|
|
2598
2610
|
/* eslint-disable unicorn/prefer-export-from */
|
|
2599
2611
|
|
|
@@ -3412,6 +3424,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3412
3424
|
changelogVirtualDom: [],
|
|
3413
3425
|
commands: [],
|
|
3414
3426
|
commit: '',
|
|
3427
|
+
currentColorThemeId: '',
|
|
3415
3428
|
description: '',
|
|
3416
3429
|
detailsVirtualDom: [],
|
|
3417
3430
|
disabled: false,
|
|
@@ -3765,12 +3778,28 @@ const getExtension = async (id, platform) => {
|
|
|
3765
3778
|
}
|
|
3766
3779
|
};
|
|
3767
3780
|
|
|
3781
|
+
const getColorThemeId = extension => {
|
|
3782
|
+
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3783
|
+
const colorTheme = extension.colorThemes[0];
|
|
3784
|
+
return colorTheme.id || colorTheme.label;
|
|
3785
|
+
}
|
|
3786
|
+
return undefined;
|
|
3787
|
+
};
|
|
3788
|
+
const getColorThemeLabel = extension => {
|
|
3789
|
+
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3790
|
+
const colorTheme = extension.colorThemes[0];
|
|
3791
|
+
return colorTheme.label;
|
|
3792
|
+
}
|
|
3793
|
+
return undefined;
|
|
3794
|
+
};
|
|
3795
|
+
|
|
3768
3796
|
const isEnabled$1 = button => {
|
|
3769
3797
|
return button.enabled;
|
|
3770
3798
|
};
|
|
3771
|
-
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
3799
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId) => {
|
|
3800
|
+
const isCurrentColorTheme = extensionColorThemeId !== '' && extensionColorThemeId === currentColorThemeId || extensionColorThemeLabel !== '' && extensionColorThemeLabel === currentColorThemeId;
|
|
3772
3801
|
const allActions = [{
|
|
3773
|
-
enabled: hasColorTheme && !isDisabled,
|
|
3802
|
+
enabled: hasColorTheme && !isDisabled && !isCurrentColorTheme,
|
|
3774
3803
|
label: setColorTheme$2(),
|
|
3775
3804
|
name: SetColorTheme,
|
|
3776
3805
|
onClick: HandleClickSetColorTheme
|
|
@@ -3796,6 +3825,7 @@ const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
|
3796
3825
|
|
|
3797
3826
|
const updateExtensionStatus = async (state, updateFunction) => {
|
|
3798
3827
|
const {
|
|
3828
|
+
currentColorThemeId,
|
|
3799
3829
|
extensionId,
|
|
3800
3830
|
hasColorTheme,
|
|
3801
3831
|
platform
|
|
@@ -3806,7 +3836,10 @@ const updateExtensionStatus = async (state, updateFunction) => {
|
|
|
3806
3836
|
}
|
|
3807
3837
|
const extension = await getExtension(extensionId, platform);
|
|
3808
3838
|
const disabled = extension?.disabled;
|
|
3809
|
-
const
|
|
3839
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
3840
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
3841
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
3842
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId);
|
|
3810
3843
|
return {
|
|
3811
3844
|
...state,
|
|
3812
3845
|
buttons,
|
|
@@ -3875,14 +3908,6 @@ const handleClickScrollToTop = state => {
|
|
|
3875
3908
|
};
|
|
3876
3909
|
};
|
|
3877
3910
|
|
|
3878
|
-
const getColorThemeId = extension => {
|
|
3879
|
-
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3880
|
-
const colorTheme = extension.colorThemes[0];
|
|
3881
|
-
return colorTheme.id || colorTheme.label;
|
|
3882
|
-
}
|
|
3883
|
-
return undefined;
|
|
3884
|
-
};
|
|
3885
|
-
|
|
3886
3911
|
const setColorTheme = id => {
|
|
3887
3912
|
return setColorTheme$1(id);
|
|
3888
3913
|
};
|
|
@@ -3897,6 +3922,14 @@ const handleClickSetColorTheme = async state => {
|
|
|
3897
3922
|
if (error) {
|
|
3898
3923
|
await confirm(`${error}`);
|
|
3899
3924
|
}
|
|
3925
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
3926
|
+
const colorThemeLabel = getColorThemeLabel(extension) || '';
|
|
3927
|
+
const buttons = getExtensionDetailButtons(state.hasColorTheme, isBuiltin, state.disabled, colorThemeId, colorThemeLabel, colorThemeId);
|
|
3928
|
+
return {
|
|
3929
|
+
...state,
|
|
3930
|
+
buttons,
|
|
3931
|
+
currentColorThemeId: colorThemeId
|
|
3932
|
+
};
|
|
3900
3933
|
}
|
|
3901
3934
|
return state;
|
|
3902
3935
|
};
|
|
@@ -3961,6 +3994,41 @@ const getCommit = async () => {
|
|
|
3961
3994
|
}
|
|
3962
3995
|
};
|
|
3963
3996
|
|
|
3997
|
+
const getThemeFromPreferences = preferences => {
|
|
3998
|
+
if (!preferences || typeof preferences !== 'object') {
|
|
3999
|
+
return '';
|
|
4000
|
+
}
|
|
4001
|
+
const workbenchTheme = preferences['workbench.colorTheme'];
|
|
4002
|
+
if (typeof workbenchTheme === 'string') {
|
|
4003
|
+
return workbenchTheme;
|
|
4004
|
+
}
|
|
4005
|
+
const legacyTheme = preferences['workbnech.colorTheme'];
|
|
4006
|
+
if (typeof legacyTheme === 'string') {
|
|
4007
|
+
return legacyTheme;
|
|
4008
|
+
}
|
|
4009
|
+
return '';
|
|
4010
|
+
};
|
|
4011
|
+
const getCurrentColorTheme = async () => {
|
|
4012
|
+
const setting = await getPreference('workbench.colorTheme');
|
|
4013
|
+
if (typeof setting === 'string' && setting) {
|
|
4014
|
+
return setting;
|
|
4015
|
+
}
|
|
4016
|
+
try {
|
|
4017
|
+
const preferences = await getAllPreferences();
|
|
4018
|
+
const theme = getThemeFromPreferences(preferences);
|
|
4019
|
+
if (theme) {
|
|
4020
|
+
return theme;
|
|
4021
|
+
}
|
|
4022
|
+
} catch {
|
|
4023
|
+
// ignore and fall back to legacy key lookup
|
|
4024
|
+
}
|
|
4025
|
+
const legacySetting = await getPreference('workbnech.colorTheme');
|
|
4026
|
+
if (typeof legacySetting === 'string') {
|
|
4027
|
+
return legacySetting;
|
|
4028
|
+
}
|
|
4029
|
+
return '';
|
|
4030
|
+
};
|
|
4031
|
+
|
|
3964
4032
|
const getExtensionIdFromUri = uri => {
|
|
3965
4033
|
const id = uri.slice('extension-detail://'.length);
|
|
3966
4034
|
return id;
|
|
@@ -4606,6 +4674,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4606
4674
|
if (!extension) {
|
|
4607
4675
|
throw new ExtensionNotFoundError(id);
|
|
4608
4676
|
}
|
|
4677
|
+
const currentColorThemeId = await getCurrentColorTheme();
|
|
4609
4678
|
const commit = await getCommit();
|
|
4610
4679
|
const headerData = loadHeaderContent(state, platform, extension);
|
|
4611
4680
|
const {
|
|
@@ -4639,7 +4708,9 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4639
4708
|
});
|
|
4640
4709
|
const isBuiltin = extension?.isBuiltin;
|
|
4641
4710
|
const disabled = extension?.disabled;
|
|
4642
|
-
const
|
|
4711
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
4712
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
4713
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId);
|
|
4643
4714
|
const size = getViewletSize(width);
|
|
4644
4715
|
const {
|
|
4645
4716
|
changelogScrollTop,
|
|
@@ -4674,6 +4745,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4674
4745
|
categories,
|
|
4675
4746
|
changelogScrollTop,
|
|
4676
4747
|
commit,
|
|
4748
|
+
currentColorThemeId,
|
|
4677
4749
|
description,
|
|
4678
4750
|
detailsVirtualDom,
|
|
4679
4751
|
disabled,
|
|
@@ -5021,6 +5093,20 @@ const hideSizeLink = state => {
|
|
|
5021
5093
|
};
|
|
5022
5094
|
};
|
|
5023
5095
|
|
|
5096
|
+
const createRpc = async () => {
|
|
5097
|
+
const rpc = await create$4({
|
|
5098
|
+
commandMap: {},
|
|
5099
|
+
send: async port => {
|
|
5100
|
+
await sendMessagePortToClipBoardWorker(port, 0);
|
|
5101
|
+
}
|
|
5102
|
+
});
|
|
5103
|
+
return rpc;
|
|
5104
|
+
};
|
|
5105
|
+
const initializeClipBoardWorker = async () => {
|
|
5106
|
+
const rpc = await createRpc();
|
|
5107
|
+
set$a(rpc);
|
|
5108
|
+
};
|
|
5109
|
+
|
|
5024
5110
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
5025
5111
|
await sendMessagePortToExtensionHostWorker$1(port, 0);
|
|
5026
5112
|
};
|
|
@@ -5107,7 +5193,7 @@ const initializeMarkdownWorker = async () => {
|
|
|
5107
5193
|
|
|
5108
5194
|
const initialize = async () => {
|
|
5109
5195
|
// TODO load markdown worker only when needed
|
|
5110
|
-
await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker()]);
|
|
5196
|
+
await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker(), initializeClipBoardWorker()]);
|
|
5111
5197
|
};
|
|
5112
5198
|
|
|
5113
5199
|
const loadContent2 = async (state, savedState, isTest = false) => {
|