@lvce-editor/extension-detail-view 6.1.0 → 6.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.
|
@@ -100,7 +100,7 @@ const changelog = () => {
|
|
|
100
100
|
const details = () => {
|
|
101
101
|
return i18nString(Details$1);
|
|
102
102
|
};
|
|
103
|
-
const disable
|
|
103
|
+
const disable = () => {
|
|
104
104
|
return i18nString(Disable$1);
|
|
105
105
|
};
|
|
106
106
|
const features$1 = () => {
|
|
@@ -133,7 +133,7 @@ const status = () => {
|
|
|
133
133
|
const setColorTheme$2 = () => {
|
|
134
134
|
return i18nString(SetColorTheme$1);
|
|
135
135
|
};
|
|
136
|
-
const enable
|
|
136
|
+
const enable = () => {
|
|
137
137
|
return i18nString(Enable$1);
|
|
138
138
|
};
|
|
139
139
|
const theme = () => {
|
|
@@ -325,24 +325,9 @@ const Ul = 60;
|
|
|
325
325
|
const Code$2 = 65;
|
|
326
326
|
const Dt = 67;
|
|
327
327
|
|
|
328
|
-
const ClientX = 'event.clientX';
|
|
329
|
-
const ClientY = 'event.clientY';
|
|
330
|
-
const TargetHref = 'event.target.href';
|
|
331
|
-
const TargetName = 'event.target.name';
|
|
332
|
-
|
|
333
328
|
const LeftArrow = 13;
|
|
334
329
|
const RightArrow = 15;
|
|
335
330
|
|
|
336
|
-
const ExtensionDetailReadme = 20;
|
|
337
|
-
const ExtensionDetailIconContextMenu$3 = 4091;
|
|
338
|
-
|
|
339
|
-
const None$2 = 0;
|
|
340
|
-
|
|
341
|
-
const Web$1 = 1;
|
|
342
|
-
|
|
343
|
-
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
344
|
-
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
345
|
-
|
|
346
331
|
const mergeClassNames = (...classNames) => {
|
|
347
332
|
return classNames.filter(Boolean).join(' ');
|
|
348
333
|
};
|
|
@@ -1029,14 +1014,30 @@ const getFeatureVirtualDomHandler = featureName => {
|
|
|
1029
1014
|
return feature.getVirtualDom;
|
|
1030
1015
|
};
|
|
1031
1016
|
|
|
1017
|
+
const ClientX = 'event.clientX';
|
|
1018
|
+
const ClientY = 'event.clientY';
|
|
1019
|
+
const TargetHref = 'event.target.href';
|
|
1020
|
+
const TargetName = 'event.target.name';
|
|
1021
|
+
|
|
1032
1022
|
const Script$1 = 2;
|
|
1033
1023
|
|
|
1024
|
+
const ExtensionDetailReadme = 20;
|
|
1025
|
+
const ExtensionDetailIconContextMenu$3 = 4091;
|
|
1026
|
+
|
|
1027
|
+
const None$2 = 0;
|
|
1028
|
+
|
|
1029
|
+
const Web$1 = 1;
|
|
1030
|
+
const Electron$1 = 2;
|
|
1031
|
+
|
|
1034
1032
|
const ExtensionHostWorker = 44;
|
|
1035
1033
|
const ExtensionManagementWorker = 9006;
|
|
1036
1034
|
const FileSystemWorker$1 = 209;
|
|
1037
1035
|
const MarkdownWorker$1 = 300;
|
|
1038
1036
|
const RendererWorker = 1;
|
|
1039
1037
|
|
|
1038
|
+
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
1039
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1040
|
+
|
|
1040
1041
|
const rpcs = Object.create(null);
|
|
1041
1042
|
const set$b = (id, rpc) => {
|
|
1042
1043
|
rpcs[id] = rpc;
|
|
@@ -1302,8 +1303,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
1302
1303
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
1303
1304
|
const message = lines[messageIndex];
|
|
1304
1305
|
return {
|
|
1305
|
-
|
|
1306
|
-
|
|
1306
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
1307
|
+
message
|
|
1307
1308
|
};
|
|
1308
1309
|
};
|
|
1309
1310
|
const isModuleNotFoundError = stderr => {
|
|
@@ -1326,14 +1327,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
1326
1327
|
const getNativeModuleErrorMessage = stderr => {
|
|
1327
1328
|
const message = getMessageCodeBlock(stderr);
|
|
1328
1329
|
return {
|
|
1329
|
-
|
|
1330
|
-
|
|
1330
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
1331
|
+
message: `Incompatible native node module: ${message}`
|
|
1331
1332
|
};
|
|
1332
1333
|
};
|
|
1333
1334
|
const getModuleSyntaxError = () => {
|
|
1334
1335
|
return {
|
|
1335
|
-
|
|
1336
|
-
|
|
1336
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
1337
|
+
message: `ES Modules are not supported in electron`
|
|
1337
1338
|
};
|
|
1338
1339
|
};
|
|
1339
1340
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -1352,8 +1353,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
1352
1353
|
rest
|
|
1353
1354
|
} = getDetails(lines);
|
|
1354
1355
|
return {
|
|
1355
|
-
message: actualMessage,
|
|
1356
1356
|
code: '',
|
|
1357
|
+
message: actualMessage,
|
|
1357
1358
|
stack: rest
|
|
1358
1359
|
};
|
|
1359
1360
|
};
|
|
@@ -1363,8 +1364,8 @@ class IpcError extends VError {
|
|
|
1363
1364
|
if (stdout || stderr) {
|
|
1364
1365
|
// @ts-ignore
|
|
1365
1366
|
const {
|
|
1366
|
-
message,
|
|
1367
1367
|
code,
|
|
1368
|
+
message,
|
|
1368
1369
|
stack
|
|
1369
1370
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
1370
1371
|
const cause = new Error(message);
|
|
@@ -1425,8 +1426,8 @@ const wrap$f = global => {
|
|
|
1425
1426
|
};
|
|
1426
1427
|
const waitForFirstMessage = async port => {
|
|
1427
1428
|
const {
|
|
1428
|
-
|
|
1429
|
-
|
|
1429
|
+
promise,
|
|
1430
|
+
resolve
|
|
1430
1431
|
} = Promise.withResolvers();
|
|
1431
1432
|
port.addEventListener('message', resolve, {
|
|
1432
1433
|
once: true
|
|
@@ -1446,8 +1447,8 @@ const listen$6 = async () => {
|
|
|
1446
1447
|
const type = firstMessage.params[0];
|
|
1447
1448
|
if (type === 'message-port') {
|
|
1448
1449
|
parentIpc.send({
|
|
1449
|
-
jsonrpc: '2.0',
|
|
1450
1450
|
id: firstMessage.id,
|
|
1451
|
+
jsonrpc: '2.0',
|
|
1451
1452
|
result: null
|
|
1452
1453
|
});
|
|
1453
1454
|
parentIpc.dispose();
|
|
@@ -1504,8 +1505,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
1504
1505
|
};
|
|
1505
1506
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
1506
1507
|
const {
|
|
1507
|
-
|
|
1508
|
-
|
|
1508
|
+
promise,
|
|
1509
|
+
resolve
|
|
1509
1510
|
} = Promise.withResolvers();
|
|
1510
1511
|
const listenerMap = Object.create(null);
|
|
1511
1512
|
const cleanup = value => {
|
|
@@ -1517,8 +1518,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
1517
1518
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
1518
1519
|
const listener = event => {
|
|
1519
1520
|
cleanup({
|
|
1520
|
-
|
|
1521
|
-
|
|
1521
|
+
event,
|
|
1522
|
+
type
|
|
1522
1523
|
});
|
|
1523
1524
|
};
|
|
1524
1525
|
addListener(eventEmitter, event, listener);
|
|
@@ -1528,8 +1529,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
1528
1529
|
};
|
|
1529
1530
|
const Message$1 = 3;
|
|
1530
1531
|
const create$5$1 = async ({
|
|
1531
|
-
|
|
1532
|
-
|
|
1532
|
+
isMessagePortOpen,
|
|
1533
|
+
messagePort
|
|
1533
1534
|
}) => {
|
|
1534
1535
|
if (!isMessagePort(messagePort)) {
|
|
1535
1536
|
throw new IpcError('port must be of type MessagePort');
|
|
@@ -1542,8 +1543,8 @@ const create$5$1 = async ({
|
|
|
1542
1543
|
});
|
|
1543
1544
|
messagePort.start();
|
|
1544
1545
|
const {
|
|
1545
|
-
|
|
1546
|
-
|
|
1546
|
+
event,
|
|
1547
|
+
type
|
|
1547
1548
|
} = await eventPromise;
|
|
1548
1549
|
if (type !== Message$1) {
|
|
1549
1550
|
throw new IpcError('Failed to wait for ipc message');
|
|
@@ -2146,12 +2147,6 @@ const {
|
|
|
2146
2147
|
invoke: invoke$4,
|
|
2147
2148
|
set: set$8
|
|
2148
2149
|
} = create$7(ExtensionManagementWorker);
|
|
2149
|
-
const enable = id => {
|
|
2150
|
-
return invoke$4(`Extensions.enable`, id);
|
|
2151
|
-
};
|
|
2152
|
-
const disable = id => {
|
|
2153
|
-
return invoke$4(`Extensions.disable`, id);
|
|
2154
|
-
};
|
|
2155
2150
|
|
|
2156
2151
|
const {
|
|
2157
2152
|
dispose: dispose$3,
|
|
@@ -2343,7 +2338,7 @@ const setExtensionsSearchValue = async searchValue => {
|
|
|
2343
2338
|
// @ts-ignore
|
|
2344
2339
|
return invoke$1('Extensions.handleInput', searchValue, Script$1);
|
|
2345
2340
|
};
|
|
2346
|
-
const openUrl
|
|
2341
|
+
const openUrl = async uri => {
|
|
2347
2342
|
// @ts-ignore
|
|
2348
2343
|
await invoke$1('Open.openUrl', uri);
|
|
2349
2344
|
};
|
|
@@ -3143,6 +3138,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3143
3138
|
importTime: 0,
|
|
3144
3139
|
installationEntries: [],
|
|
3145
3140
|
jsonValidation: [],
|
|
3141
|
+
linkProtectionEnabled: false,
|
|
3146
3142
|
locationHost: '',
|
|
3147
3143
|
locationProtocol: '',
|
|
3148
3144
|
marketplaceEntries: [],
|
|
@@ -3431,8 +3427,8 @@ const handleClickCategory = async (state, categoryId) => {
|
|
|
3431
3427
|
return state;
|
|
3432
3428
|
};
|
|
3433
3429
|
|
|
3434
|
-
const disableExtension = id => {
|
|
3435
|
-
return
|
|
3430
|
+
const disableExtension = (id, platform) => {
|
|
3431
|
+
return invoke$4('Extensions.disable2', id, platform);
|
|
3436
3432
|
};
|
|
3437
3433
|
|
|
3438
3434
|
const Web = 1;
|
|
@@ -3474,20 +3470,23 @@ const getExtension = async (id, platform) => {
|
|
|
3474
3470
|
}
|
|
3475
3471
|
};
|
|
3476
3472
|
|
|
3473
|
+
const isEnabled$1 = button => {
|
|
3474
|
+
return button.enabled;
|
|
3475
|
+
};
|
|
3477
3476
|
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
3478
3477
|
const allActions = [{
|
|
3479
|
-
enabled: hasColorTheme,
|
|
3478
|
+
enabled: hasColorTheme && !isDisabled,
|
|
3480
3479
|
label: setColorTheme$2(),
|
|
3481
3480
|
name: SetColorTheme,
|
|
3482
3481
|
onClick: HandleClickSetColorTheme
|
|
3483
3482
|
}, {
|
|
3484
3483
|
enabled: isDisabled,
|
|
3485
|
-
label: enable
|
|
3484
|
+
label: enable(),
|
|
3486
3485
|
name: Enable,
|
|
3487
3486
|
onClick: HandleClickEnable
|
|
3488
3487
|
}, {
|
|
3489
3488
|
enabled: !isDisabled,
|
|
3490
|
-
label: disable
|
|
3489
|
+
label: disable(),
|
|
3491
3490
|
name: Disable,
|
|
3492
3491
|
onClick: HandleClickDisable
|
|
3493
3492
|
}, {
|
|
@@ -3496,7 +3495,7 @@ const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
|
3496
3495
|
name: Uninstall,
|
|
3497
3496
|
onClick: HandleClickUninstall
|
|
3498
3497
|
}];
|
|
3499
|
-
const filteredButtons = allActions.filter(
|
|
3498
|
+
const filteredButtons = allActions.filter(isEnabled$1);
|
|
3500
3499
|
return filteredButtons;
|
|
3501
3500
|
};
|
|
3502
3501
|
|
|
@@ -3506,7 +3505,7 @@ const updateExtensionStatus = async (state, updateFunction) => {
|
|
|
3506
3505
|
hasColorTheme,
|
|
3507
3506
|
platform
|
|
3508
3507
|
} = state;
|
|
3509
|
-
const error = await updateFunction(extensionId);
|
|
3508
|
+
const error = await updateFunction(extensionId, platform);
|
|
3510
3509
|
if (error) {
|
|
3511
3510
|
await confirm(`${error}`);
|
|
3512
3511
|
}
|
|
@@ -3524,8 +3523,8 @@ const handleClickDisable = async state => {
|
|
|
3524
3523
|
return updateExtensionStatus(state, disableExtension);
|
|
3525
3524
|
};
|
|
3526
3525
|
|
|
3527
|
-
const enableExtension = id => {
|
|
3528
|
-
return
|
|
3526
|
+
const enableExtension = (id, platform) => {
|
|
3527
|
+
return invoke$4('Extensions.enable2', id, platform);
|
|
3529
3528
|
};
|
|
3530
3529
|
|
|
3531
3530
|
const handleClickEnable = async state => {
|
|
@@ -4329,6 +4328,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4329
4328
|
name,
|
|
4330
4329
|
paddingLeft: padding,
|
|
4331
4330
|
paddingRight: padding,
|
|
4331
|
+
platform,
|
|
4332
4332
|
rating,
|
|
4333
4333
|
readmeScrollTop,
|
|
4334
4334
|
readmeUrl,
|
|
@@ -4389,17 +4389,40 @@ const handleImageContextMenu = async (state, eventX, eventY) => {
|
|
|
4389
4389
|
return state;
|
|
4390
4390
|
};
|
|
4391
4391
|
|
|
4392
|
+
const openExternal = async (uri, platform) => {
|
|
4393
|
+
if (platform === Electron$1) ; else {
|
|
4394
|
+
await openUrl(uri);
|
|
4395
|
+
}
|
|
4396
|
+
};
|
|
4397
|
+
|
|
4398
|
+
const handleReadmeLinkClick = async (linkProtectionEnabled, platform, href) => {
|
|
4399
|
+
// TODO what to do about relative links? open them in editor?
|
|
4400
|
+
// TODO what to do about mail links?
|
|
4401
|
+
if (linkProtectionEnabled) {
|
|
4402
|
+
const message = `Do you want to open this external link?\n\n${href}`;
|
|
4403
|
+
const confirmed = await confirm(message);
|
|
4404
|
+
if (!confirmed) {
|
|
4405
|
+
return;
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
await openExternal(href, platform);
|
|
4409
|
+
return;
|
|
4410
|
+
};
|
|
4411
|
+
|
|
4392
4412
|
const isExternalLink = href => {
|
|
4393
4413
|
return href.startsWith('http://') || href.startsWith('https://');
|
|
4394
4414
|
};
|
|
4395
4415
|
const handleReadmeClick = async (state, nodeName, href) => {
|
|
4416
|
+
const {
|
|
4417
|
+
linkProtectionEnabled,
|
|
4418
|
+
platform
|
|
4419
|
+
} = state;
|
|
4396
4420
|
if (!href || !isExternalLink(href)) {
|
|
4397
4421
|
return state;
|
|
4398
4422
|
}
|
|
4399
4423
|
// TODO what to do about relative links? open them in editor?
|
|
4400
4424
|
// TODO what to do about mail links?
|
|
4401
|
-
await
|
|
4402
|
-
// TODO check node name and href
|
|
4425
|
+
await handleReadmeLinkClick(linkProtectionEnabled, platform, href);
|
|
4403
4426
|
return state;
|
|
4404
4427
|
};
|
|
4405
4428
|
|
|
@@ -4695,18 +4718,15 @@ const loadContent2 = async (state, savedState, isTest = false) => {
|
|
|
4695
4718
|
return loadContent(state, state.platform, savedState, isTest);
|
|
4696
4719
|
};
|
|
4697
4720
|
|
|
4698
|
-
const openUrl = async uri => {
|
|
4699
|
-
await openUrl$1(uri);
|
|
4700
|
-
};
|
|
4701
|
-
|
|
4702
4721
|
const openImageInNewTab = async state => {
|
|
4703
4722
|
const {
|
|
4704
4723
|
iconSrc,
|
|
4705
4724
|
locationHost,
|
|
4706
|
-
locationProtocol
|
|
4725
|
+
locationProtocol,
|
|
4726
|
+
platform
|
|
4707
4727
|
} = state;
|
|
4708
4728
|
const absoluteIconSrc = getImageCopyUrl(iconSrc, locationProtocol, locationHost);
|
|
4709
|
-
await
|
|
4729
|
+
await openExternal(absoluteIconSrc, platform);
|
|
4710
4730
|
return state;
|
|
4711
4731
|
};
|
|
4712
4732
|
|
|
@@ -5316,7 +5336,7 @@ const render2 = (uid, diffResult) => {
|
|
|
5316
5336
|
const renderEventListeners = () => {
|
|
5317
5337
|
return [{
|
|
5318
5338
|
name: HandleAdditionalDetailContextMenu,
|
|
5319
|
-
params: ['handleAdditionalDetailsContextMenu', ClientX, ClientY, 'event.target.nodeName',
|
|
5339
|
+
params: ['handleAdditionalDetailsContextMenu', ClientX, ClientY, 'event.target.nodeName', TargetHref],
|
|
5320
5340
|
preventDefault: true
|
|
5321
5341
|
}, {
|
|
5322
5342
|
name: HandleClickCategory,
|
|
@@ -5359,7 +5379,7 @@ const renderEventListeners = () => {
|
|
|
5359
5379
|
params: ['handleClickSettings']
|
|
5360
5380
|
}, {
|
|
5361
5381
|
name: HandleReadmeClick,
|
|
5362
|
-
params: ['handleReadmeClick', 'event.target.nodeName',
|
|
5382
|
+
params: ['handleReadmeClick', 'event.target.nodeName', TargetHref],
|
|
5363
5383
|
preventDefault: true
|
|
5364
5384
|
}, {
|
|
5365
5385
|
name: HandleClickUninstall,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/extension-detail-view",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Extension Detail View Worker",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/extensionDetailViewWorkerMain.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@lvce-editor/constants": "^
|
|
14
|
+
"@lvce-editor/constants": "^2.4.0"
|
|
15
15
|
}
|
|
16
16
|
}
|