@lvce-editor/extension-detail-view 7.2.0 → 7.4.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 +208 -157
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -437,12 +438,12 @@ const getChildrenWithCount = (nodes, startIndex, childCount) => {
|
|
|
437
438
|
};
|
|
438
439
|
|
|
439
440
|
const compareNodes = (oldNode, newNode) => {
|
|
440
|
-
const patches = [];
|
|
441
441
|
// Check if node type changed - return null to signal incompatible nodes
|
|
442
442
|
// (caller should handle this with a Replace operation)
|
|
443
443
|
if (oldNode.type !== newNode.type) {
|
|
444
444
|
return null;
|
|
445
445
|
}
|
|
446
|
+
const patches = [];
|
|
446
447
|
// Handle reference nodes - special handling for uid changes
|
|
447
448
|
if (oldNode.type === Reference) {
|
|
448
449
|
if (oldNode.uid !== newNode.uid) {
|
|
@@ -478,7 +479,7 @@ const compareNodes = (oldNode, newNode) => {
|
|
|
478
479
|
}
|
|
479
480
|
// Check for removed attributes
|
|
480
481
|
for (const key of oldKeys) {
|
|
481
|
-
if (!(key
|
|
482
|
+
if (!Object.hasOwn(newNode, key)) {
|
|
482
483
|
patches.push({
|
|
483
484
|
type: RemoveAttribute,
|
|
484
485
|
key
|
|
@@ -496,11 +497,78 @@ const treeToArray = node => {
|
|
|
496
497
|
return result;
|
|
497
498
|
};
|
|
498
499
|
|
|
500
|
+
const navigateToChild = (patches, currentChildIndex, index) => {
|
|
501
|
+
if (currentChildIndex === -1) {
|
|
502
|
+
patches.push({
|
|
503
|
+
type: NavigateChild,
|
|
504
|
+
index
|
|
505
|
+
});
|
|
506
|
+
return index;
|
|
507
|
+
}
|
|
508
|
+
if (currentChildIndex !== index) {
|
|
509
|
+
patches.push({
|
|
510
|
+
type: NavigateSibling,
|
|
511
|
+
index
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
return index;
|
|
515
|
+
};
|
|
516
|
+
const navigateToParent = (patches, currentChildIndex) => {
|
|
517
|
+
if (currentChildIndex >= 0) {
|
|
518
|
+
patches.push({
|
|
519
|
+
type: NavigateParent
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return -1;
|
|
523
|
+
};
|
|
524
|
+
const addTree = (newNode, patches) => {
|
|
525
|
+
patches.push({
|
|
526
|
+
type: Add,
|
|
527
|
+
nodes: treeToArray(newNode)
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
const replaceTree = (newNode, patches) => {
|
|
531
|
+
patches.push({
|
|
532
|
+
type: Replace,
|
|
533
|
+
nodes: treeToArray(newNode)
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
const diffExistingChild = (oldNode, newNode, patches, currentChildIndex, index) => {
|
|
537
|
+
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
538
|
+
if (nodePatches === null) {
|
|
539
|
+
const nextChildIndex = navigateToChild(patches, currentChildIndex, index);
|
|
540
|
+
replaceTree(newNode, patches);
|
|
541
|
+
return nextChildIndex;
|
|
542
|
+
}
|
|
543
|
+
const hasChildrenToCompare = oldNode.children.length > 0 || newNode.children.length > 0;
|
|
544
|
+
if (nodePatches.length === 0 && !hasChildrenToCompare) {
|
|
545
|
+
return currentChildIndex;
|
|
546
|
+
}
|
|
547
|
+
const nextChildIndex = navigateToChild(patches, currentChildIndex, index);
|
|
548
|
+
if (nodePatches.length > 0) {
|
|
549
|
+
patches.push(...nodePatches);
|
|
550
|
+
}
|
|
551
|
+
if (hasChildrenToCompare) {
|
|
552
|
+
diffChildren(oldNode.children, newNode.children, patches);
|
|
553
|
+
}
|
|
554
|
+
return nextChildIndex;
|
|
555
|
+
};
|
|
556
|
+
const diffRootNode = (oldNode, newNode, patches) => {
|
|
557
|
+
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
558
|
+
if (nodePatches === null) {
|
|
559
|
+
replaceTree(newNode, patches);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
if (nodePatches.length > 0) {
|
|
563
|
+
patches.push(...nodePatches);
|
|
564
|
+
}
|
|
565
|
+
if (oldNode.children.length > 0 || newNode.children.length > 0) {
|
|
566
|
+
diffChildren(oldNode.children, newNode.children, patches);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
499
569
|
const diffChildren = (oldChildren, newChildren, patches) => {
|
|
500
570
|
const maxLength = Math.max(oldChildren.length, newChildren.length);
|
|
501
|
-
// Track where we are: -1 means at parent, >= 0 means at child index
|
|
502
571
|
let currentChildIndex = -1;
|
|
503
|
-
// Collect indices of children to remove (we'll add these patches at the end in reverse order)
|
|
504
572
|
const indicesToRemove = [];
|
|
505
573
|
for (let i = 0; i < maxLength; i++) {
|
|
506
574
|
const oldNode = oldChildren[i];
|
|
@@ -509,88 +577,17 @@ const diffChildren = (oldChildren, newChildren, patches) => {
|
|
|
509
577
|
continue;
|
|
510
578
|
}
|
|
511
579
|
if (!oldNode) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
});
|
|
518
|
-
currentChildIndex = -1;
|
|
519
|
-
}
|
|
520
|
-
// Flatten the entire subtree so renderInternal can handle it
|
|
521
|
-
const flatNodes = treeToArray(newNode);
|
|
522
|
-
patches.push({
|
|
523
|
-
type: Add,
|
|
524
|
-
nodes: flatNodes
|
|
525
|
-
});
|
|
526
|
-
} else if (newNode) {
|
|
527
|
-
// Compare nodes to see if we need any patches
|
|
528
|
-
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
529
|
-
// If nodePatches is null, the node types are incompatible - need to replace
|
|
530
|
-
if (nodePatches === null) {
|
|
531
|
-
// Navigate to this child
|
|
532
|
-
if (currentChildIndex === -1) {
|
|
533
|
-
patches.push({
|
|
534
|
-
type: NavigateChild,
|
|
535
|
-
index: i
|
|
536
|
-
});
|
|
537
|
-
currentChildIndex = i;
|
|
538
|
-
} else if (currentChildIndex !== i) {
|
|
539
|
-
patches.push({
|
|
540
|
-
type: NavigateSibling,
|
|
541
|
-
index: i
|
|
542
|
-
});
|
|
543
|
-
currentChildIndex = i;
|
|
544
|
-
}
|
|
545
|
-
// Replace the entire subtree
|
|
546
|
-
const flatNodes = treeToArray(newNode);
|
|
547
|
-
patches.push({
|
|
548
|
-
type: Replace,
|
|
549
|
-
nodes: flatNodes
|
|
550
|
-
});
|
|
551
|
-
// After replace, we're at the new element (same position)
|
|
552
|
-
continue;
|
|
553
|
-
}
|
|
554
|
-
// Check if we need to recurse into children
|
|
555
|
-
const hasChildrenToCompare = oldNode.children.length > 0 || newNode.children.length > 0;
|
|
556
|
-
// Only navigate to this element if we need to do something
|
|
557
|
-
if (nodePatches.length > 0 || hasChildrenToCompare) {
|
|
558
|
-
// Navigate to this child if not already there
|
|
559
|
-
if (currentChildIndex === -1) {
|
|
560
|
-
patches.push({
|
|
561
|
-
type: NavigateChild,
|
|
562
|
-
index: i
|
|
563
|
-
});
|
|
564
|
-
currentChildIndex = i;
|
|
565
|
-
} else if (currentChildIndex !== i) {
|
|
566
|
-
patches.push({
|
|
567
|
-
type: NavigateSibling,
|
|
568
|
-
index: i
|
|
569
|
-
});
|
|
570
|
-
currentChildIndex = i;
|
|
571
|
-
}
|
|
572
|
-
// Apply node patches (these apply to the current element, not children)
|
|
573
|
-
if (nodePatches.length > 0) {
|
|
574
|
-
patches.push(...nodePatches);
|
|
575
|
-
}
|
|
576
|
-
// Compare children recursively
|
|
577
|
-
if (hasChildrenToCompare) {
|
|
578
|
-
diffChildren(oldNode.children, newNode.children, patches);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
} else {
|
|
582
|
-
// Remove old node - collect the index for later removal
|
|
580
|
+
currentChildIndex = navigateToParent(patches, currentChildIndex);
|
|
581
|
+
addTree(newNode, patches);
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
if (!newNode) {
|
|
583
585
|
indicesToRemove.push(i);
|
|
586
|
+
continue;
|
|
584
587
|
}
|
|
588
|
+
currentChildIndex = diffExistingChild(oldNode, newNode, patches, currentChildIndex, i);
|
|
585
589
|
}
|
|
586
|
-
|
|
587
|
-
if (currentChildIndex >= 0) {
|
|
588
|
-
patches.push({
|
|
589
|
-
type: NavigateParent
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
// Add remove patches in reverse order (highest index first)
|
|
593
|
-
// This ensures indices remain valid as we remove
|
|
590
|
+
navigateToParent(patches, currentChildIndex);
|
|
594
591
|
for (let j = indicesToRemove.length - 1; j >= 0; j--) {
|
|
595
592
|
patches.push({
|
|
596
593
|
type: RemoveChild,
|
|
@@ -599,33 +596,11 @@ const diffChildren = (oldChildren, newChildren, patches) => {
|
|
|
599
596
|
}
|
|
600
597
|
};
|
|
601
598
|
const diffTrees = (oldTree, newTree, patches, path) => {
|
|
602
|
-
// At the root level (path.length === 0), we're already AT the element
|
|
603
|
-
// So we compare the root node directly, then compare its children
|
|
604
599
|
if (path.length === 0 && oldTree.length === 1 && newTree.length === 1) {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
// Compare root nodes
|
|
608
|
-
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
609
|
-
// If nodePatches is null, the root node types are incompatible - need to replace
|
|
610
|
-
if (nodePatches === null) {
|
|
611
|
-
const flatNodes = treeToArray(newNode);
|
|
612
|
-
patches.push({
|
|
613
|
-
type: Replace,
|
|
614
|
-
nodes: flatNodes
|
|
615
|
-
});
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
if (nodePatches.length > 0) {
|
|
619
|
-
patches.push(...nodePatches);
|
|
620
|
-
}
|
|
621
|
-
// Compare children
|
|
622
|
-
if (oldNode.children.length > 0 || newNode.children.length > 0) {
|
|
623
|
-
diffChildren(oldNode.children, newNode.children, patches);
|
|
624
|
-
}
|
|
625
|
-
} else {
|
|
626
|
-
// Non-root level or multiple root elements - use the regular comparison
|
|
627
|
-
diffChildren(oldTree, newTree, patches);
|
|
600
|
+
diffRootNode(oldTree[0], newTree[0], patches);
|
|
601
|
+
return;
|
|
628
602
|
}
|
|
603
|
+
diffChildren(oldTree, newTree, patches);
|
|
629
604
|
};
|
|
630
605
|
|
|
631
606
|
const removeTrailingNavigationPatches = patches => {
|
|
@@ -865,9 +840,9 @@ const getCellCodeVirtualDom = (value, props) => {
|
|
|
865
840
|
childCount: 1,
|
|
866
841
|
className: tdClassName,
|
|
867
842
|
type: Td,
|
|
868
|
-
...(props?.title
|
|
843
|
+
...(props?.title && {
|
|
869
844
|
title: props.title
|
|
870
|
-
}
|
|
845
|
+
})
|
|
871
846
|
}, {
|
|
872
847
|
childCount: 1,
|
|
873
848
|
type: Code$2
|
|
@@ -903,9 +878,9 @@ const getCellTextVirtualDom = (value, props) => {
|
|
|
903
878
|
childCount: 1,
|
|
904
879
|
className: tdClassName,
|
|
905
880
|
type: Td,
|
|
906
|
-
...(props?.title
|
|
881
|
+
...(props?.title && {
|
|
907
882
|
title: props.title
|
|
908
|
-
}
|
|
883
|
+
})
|
|
909
884
|
}, text(value)];
|
|
910
885
|
};
|
|
911
886
|
|
|
@@ -1028,10 +1003,7 @@ const isValidRelativePath = value => {
|
|
|
1028
1003
|
return false;
|
|
1029
1004
|
}
|
|
1030
1005
|
// Must contain at least one alphanumeric character
|
|
1031
|
-
|
|
1032
|
-
return false;
|
|
1033
|
-
}
|
|
1034
|
-
return true;
|
|
1006
|
+
return !!/[A-Za-z0-9]/.test(value);
|
|
1035
1007
|
};
|
|
1036
1008
|
const getSchemaLinkUrl = (schema, extensionUri) => {
|
|
1037
1009
|
if (!schema || typeof schema !== 'string') {
|
|
@@ -1048,7 +1020,7 @@ const getSchemaLinkUrl = (schema, extensionUri) => {
|
|
|
1048
1020
|
return '';
|
|
1049
1021
|
}
|
|
1050
1022
|
try {
|
|
1051
|
-
return new URL(schema, extensionUri).
|
|
1023
|
+
return new URL(schema, extensionUri).href;
|
|
1052
1024
|
} catch {
|
|
1053
1025
|
return '';
|
|
1054
1026
|
}
|
|
@@ -2236,7 +2208,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
2236
2208
|
const responseMessage = await promise;
|
|
2237
2209
|
return unwrapJsonRpcResult(responseMessage);
|
|
2238
2210
|
};
|
|
2239
|
-
const createRpc = ipc => {
|
|
2211
|
+
const createRpc$1 = ipc => {
|
|
2240
2212
|
const callbacks = Object.create(null);
|
|
2241
2213
|
ipc._resolve = (id, response) => {
|
|
2242
2214
|
const fn = callbacks[id];
|
|
@@ -2316,7 +2288,7 @@ const create$6 = async ({
|
|
|
2316
2288
|
});
|
|
2317
2289
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2318
2290
|
handleIpc(ipc);
|
|
2319
|
-
const rpc = createRpc(ipc);
|
|
2291
|
+
const rpc = createRpc$1(ipc);
|
|
2320
2292
|
messagePort.start();
|
|
2321
2293
|
return rpc;
|
|
2322
2294
|
};
|
|
@@ -2387,7 +2359,7 @@ const create$3 = async ({
|
|
|
2387
2359
|
register(commandMap);
|
|
2388
2360
|
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
2389
2361
|
handleIpc(ipc);
|
|
2390
|
-
const rpc = createRpc(ipc);
|
|
2362
|
+
const rpc = createRpc$1(ipc);
|
|
2391
2363
|
return rpc;
|
|
2392
2364
|
};
|
|
2393
2365
|
|
|
@@ -2412,7 +2384,7 @@ const createMockRpc = ({
|
|
|
2412
2384
|
};
|
|
2413
2385
|
|
|
2414
2386
|
const rpcs = Object.create(null);
|
|
2415
|
-
const set$
|
|
2387
|
+
const set$b = (id, rpc) => {
|
|
2416
2388
|
rpcs[id] = rpc;
|
|
2417
2389
|
};
|
|
2418
2390
|
const get$2 = id => {
|
|
@@ -2445,7 +2417,7 @@ const create$2 = rpcId => {
|
|
|
2445
2417
|
const mockRpc = createMockRpc({
|
|
2446
2418
|
commandMap
|
|
2447
2419
|
});
|
|
2448
|
-
set$
|
|
2420
|
+
set$b(rpcId, mockRpc);
|
|
2449
2421
|
// @ts-ignore
|
|
2450
2422
|
mockRpc[Symbol.dispose] = () => {
|
|
2451
2423
|
remove(rpcId);
|
|
@@ -2454,11 +2426,22 @@ const create$2 = rpcId => {
|
|
|
2454
2426
|
return mockRpc;
|
|
2455
2427
|
},
|
|
2456
2428
|
set(rpc) {
|
|
2457
|
-
set$
|
|
2429
|
+
set$b(rpcId, rpc);
|
|
2458
2430
|
}
|
|
2459
2431
|
};
|
|
2460
2432
|
};
|
|
2461
2433
|
|
|
2434
|
+
const {
|
|
2435
|
+
invoke: invoke$6,
|
|
2436
|
+
set: set$a
|
|
2437
|
+
} = create$2(ClipBoardWorker);
|
|
2438
|
+
const writeText$1 = async text => {
|
|
2439
|
+
return invoke$6('ClipBoard.writeText', text);
|
|
2440
|
+
};
|
|
2441
|
+
const writeImage = async image => {
|
|
2442
|
+
return invoke$6('ClipBoard.writeImage', image);
|
|
2443
|
+
};
|
|
2444
|
+
|
|
2462
2445
|
const {
|
|
2463
2446
|
invoke: invoke$5,
|
|
2464
2447
|
set: set$9
|
|
@@ -2541,6 +2524,10 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
2541
2524
|
const setColorTheme$1 = async id => {
|
|
2542
2525
|
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
2543
2526
|
};
|
|
2527
|
+
const sendMessagePortToClipBoardWorker = async (port, rpcId) => {
|
|
2528
|
+
const command = 'ClipBoard.handleMessagePort';
|
|
2529
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
2530
|
+
};
|
|
2544
2531
|
const sendMessagePortToMarkdownWorker$1 = async (port, rpcId) => {
|
|
2545
2532
|
const command = 'Markdown.handleMessagePort';
|
|
2546
2533
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
@@ -2557,12 +2544,6 @@ const confirm = async (message, options) => {
|
|
|
2557
2544
|
const result = await invoke$1('ConfirmPrompt.prompt', message, options);
|
|
2558
2545
|
return result;
|
|
2559
2546
|
};
|
|
2560
|
-
const writeClipBoardText = async text => {
|
|
2561
|
-
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
2562
|
-
};
|
|
2563
|
-
const writeClipBoardImage = async blob => {
|
|
2564
|
-
await invoke$1('ClipBoard.writeImage', /* text */blob);
|
|
2565
|
-
};
|
|
2566
2547
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
2567
2548
|
const command = 'Extensions.handleMessagePort';
|
|
2568
2549
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
@@ -2594,6 +2575,9 @@ const openExternal$1 = async uri => {
|
|
|
2594
2575
|
const openUrl = async uri => {
|
|
2595
2576
|
await invoke$1('Open.openUrl', uri);
|
|
2596
2577
|
};
|
|
2578
|
+
const getAllPreferences = async () => {
|
|
2579
|
+
return invoke$1('Preferences.getAll');
|
|
2580
|
+
};
|
|
2597
2581
|
|
|
2598
2582
|
/* eslint-disable unicorn/prefer-export-from */
|
|
2599
2583
|
|
|
@@ -2628,10 +2612,7 @@ const featureRuntimeStatusEnabled = extension => {
|
|
|
2628
2612
|
if (!extension || typeof extension !== 'object') {
|
|
2629
2613
|
return false;
|
|
2630
2614
|
}
|
|
2631
|
-
|
|
2632
|
-
return true;
|
|
2633
|
-
}
|
|
2634
|
-
return false;
|
|
2615
|
+
return 'main' in extension || 'browser' in extension;
|
|
2635
2616
|
};
|
|
2636
2617
|
|
|
2637
2618
|
const formatTime = time => {
|
|
@@ -3327,10 +3308,10 @@ const terminate = () => {
|
|
|
3327
3308
|
};
|
|
3328
3309
|
|
|
3329
3310
|
const writeClipboardImage = async blob => {
|
|
3330
|
-
await
|
|
3311
|
+
await writeImage(blob);
|
|
3331
3312
|
};
|
|
3332
3313
|
const writeText = async text => {
|
|
3333
|
-
await
|
|
3314
|
+
await writeText$1(text);
|
|
3334
3315
|
};
|
|
3335
3316
|
|
|
3336
3317
|
/* eslint-disable unicorn/prefer-export-from */
|
|
@@ -3412,6 +3393,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3412
3393
|
changelogVirtualDom: [],
|
|
3413
3394
|
commands: [],
|
|
3414
3395
|
commit: '',
|
|
3396
|
+
currentColorThemeId: '',
|
|
3415
3397
|
description: '',
|
|
3416
3398
|
detailsVirtualDom: [],
|
|
3417
3399
|
disabled: false,
|
|
@@ -3765,12 +3747,28 @@ const getExtension = async (id, platform) => {
|
|
|
3765
3747
|
}
|
|
3766
3748
|
};
|
|
3767
3749
|
|
|
3750
|
+
const getColorThemeId = extension => {
|
|
3751
|
+
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3752
|
+
const colorTheme = extension.colorThemes[0];
|
|
3753
|
+
return colorTheme.id || colorTheme.label;
|
|
3754
|
+
}
|
|
3755
|
+
return undefined;
|
|
3756
|
+
};
|
|
3757
|
+
const getColorThemeLabel = extension => {
|
|
3758
|
+
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3759
|
+
const colorTheme = extension.colorThemes[0];
|
|
3760
|
+
return colorTheme.label;
|
|
3761
|
+
}
|
|
3762
|
+
return undefined;
|
|
3763
|
+
};
|
|
3764
|
+
|
|
3768
3765
|
const isEnabled$1 = button => {
|
|
3769
3766
|
return button.enabled;
|
|
3770
3767
|
};
|
|
3771
|
-
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
3768
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId) => {
|
|
3769
|
+
const isCurrentColorTheme = extensionColorThemeId !== '' && extensionColorThemeId === currentColorThemeId || extensionColorThemeLabel !== '' && extensionColorThemeLabel === currentColorThemeId;
|
|
3772
3770
|
const allActions = [{
|
|
3773
|
-
enabled: hasColorTheme && !isDisabled,
|
|
3771
|
+
enabled: hasColorTheme && !isDisabled && !isCurrentColorTheme,
|
|
3774
3772
|
label: setColorTheme$2(),
|
|
3775
3773
|
name: SetColorTheme,
|
|
3776
3774
|
onClick: HandleClickSetColorTheme
|
|
@@ -3796,6 +3794,7 @@ const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
|
3796
3794
|
|
|
3797
3795
|
const updateExtensionStatus = async (state, updateFunction) => {
|
|
3798
3796
|
const {
|
|
3797
|
+
currentColorThemeId,
|
|
3799
3798
|
extensionId,
|
|
3800
3799
|
hasColorTheme,
|
|
3801
3800
|
platform
|
|
@@ -3806,7 +3805,10 @@ const updateExtensionStatus = async (state, updateFunction) => {
|
|
|
3806
3805
|
}
|
|
3807
3806
|
const extension = await getExtension(extensionId, platform);
|
|
3808
3807
|
const disabled = extension?.disabled;
|
|
3809
|
-
const
|
|
3808
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
3809
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
3810
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
3811
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId);
|
|
3810
3812
|
return {
|
|
3811
3813
|
...state,
|
|
3812
3814
|
buttons,
|
|
@@ -3875,14 +3877,6 @@ const handleClickScrollToTop = state => {
|
|
|
3875
3877
|
};
|
|
3876
3878
|
};
|
|
3877
3879
|
|
|
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
3880
|
const setColorTheme = id => {
|
|
3887
3881
|
return setColorTheme$1(id);
|
|
3888
3882
|
};
|
|
@@ -3897,6 +3891,14 @@ const handleClickSetColorTheme = async state => {
|
|
|
3897
3891
|
if (error) {
|
|
3898
3892
|
await confirm(`${error}`);
|
|
3899
3893
|
}
|
|
3894
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
3895
|
+
const colorThemeLabel = getColorThemeLabel(extension) || '';
|
|
3896
|
+
const buttons = getExtensionDetailButtons(state.hasColorTheme, isBuiltin, state.disabled, colorThemeId, colorThemeLabel, colorThemeId);
|
|
3897
|
+
return {
|
|
3898
|
+
...state,
|
|
3899
|
+
buttons,
|
|
3900
|
+
currentColorThemeId: colorThemeId
|
|
3901
|
+
};
|
|
3900
3902
|
}
|
|
3901
3903
|
return state;
|
|
3902
3904
|
};
|
|
@@ -3961,6 +3963,41 @@ const getCommit = async () => {
|
|
|
3961
3963
|
}
|
|
3962
3964
|
};
|
|
3963
3965
|
|
|
3966
|
+
const getThemeFromPreferences = preferences => {
|
|
3967
|
+
if (!preferences || typeof preferences !== 'object') {
|
|
3968
|
+
return '';
|
|
3969
|
+
}
|
|
3970
|
+
const workbenchTheme = preferences['workbench.colorTheme'];
|
|
3971
|
+
if (typeof workbenchTheme === 'string') {
|
|
3972
|
+
return workbenchTheme;
|
|
3973
|
+
}
|
|
3974
|
+
const legacyTheme = preferences['workbnech.colorTheme'];
|
|
3975
|
+
if (typeof legacyTheme === 'string') {
|
|
3976
|
+
return legacyTheme;
|
|
3977
|
+
}
|
|
3978
|
+
return '';
|
|
3979
|
+
};
|
|
3980
|
+
const getCurrentColorTheme = async () => {
|
|
3981
|
+
const setting = await getPreference('workbench.colorTheme');
|
|
3982
|
+
if (typeof setting === 'string' && setting) {
|
|
3983
|
+
return setting;
|
|
3984
|
+
}
|
|
3985
|
+
try {
|
|
3986
|
+
const preferences = await getAllPreferences();
|
|
3987
|
+
const theme = getThemeFromPreferences(preferences);
|
|
3988
|
+
if (theme) {
|
|
3989
|
+
return theme;
|
|
3990
|
+
}
|
|
3991
|
+
} catch {
|
|
3992
|
+
// ignore and fall back to legacy key lookup
|
|
3993
|
+
}
|
|
3994
|
+
const legacySetting = await getPreference('workbnech.colorTheme');
|
|
3995
|
+
if (typeof legacySetting === 'string') {
|
|
3996
|
+
return legacySetting;
|
|
3997
|
+
}
|
|
3998
|
+
return '';
|
|
3999
|
+
};
|
|
4000
|
+
|
|
3964
4001
|
const getExtensionIdFromUri = uri => {
|
|
3965
4002
|
const id = uri.slice('extension-detail://'.length);
|
|
3966
4003
|
return id;
|
|
@@ -4606,6 +4643,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4606
4643
|
if (!extension) {
|
|
4607
4644
|
throw new ExtensionNotFoundError(id);
|
|
4608
4645
|
}
|
|
4646
|
+
const currentColorThemeId = await getCurrentColorTheme();
|
|
4609
4647
|
const commit = await getCommit();
|
|
4610
4648
|
const headerData = loadHeaderContent(state, platform, extension);
|
|
4611
4649
|
const {
|
|
@@ -4639,7 +4677,9 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4639
4677
|
});
|
|
4640
4678
|
const isBuiltin = extension?.isBuiltin;
|
|
4641
4679
|
const disabled = extension?.disabled;
|
|
4642
|
-
const
|
|
4680
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
4681
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
4682
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId);
|
|
4643
4683
|
const size = getViewletSize(width);
|
|
4644
4684
|
const {
|
|
4645
4685
|
changelogScrollTop,
|
|
@@ -4674,6 +4714,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4674
4714
|
categories,
|
|
4675
4715
|
changelogScrollTop,
|
|
4676
4716
|
commit,
|
|
4717
|
+
currentColorThemeId,
|
|
4677
4718
|
description,
|
|
4678
4719
|
detailsVirtualDom,
|
|
4679
4720
|
disabled,
|
|
@@ -5021,6 +5062,20 @@ const hideSizeLink = state => {
|
|
|
5021
5062
|
};
|
|
5022
5063
|
};
|
|
5023
5064
|
|
|
5065
|
+
const createRpc = async () => {
|
|
5066
|
+
const rpc = await create$4({
|
|
5067
|
+
commandMap: {},
|
|
5068
|
+
send: async port => {
|
|
5069
|
+
await sendMessagePortToClipBoardWorker(port, 0);
|
|
5070
|
+
}
|
|
5071
|
+
});
|
|
5072
|
+
return rpc;
|
|
5073
|
+
};
|
|
5074
|
+
const initializeClipBoardWorker = async () => {
|
|
5075
|
+
const rpc = await createRpc();
|
|
5076
|
+
set$a(rpc);
|
|
5077
|
+
};
|
|
5078
|
+
|
|
5024
5079
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
5025
5080
|
await sendMessagePortToExtensionHostWorker$1(port, 0);
|
|
5026
5081
|
};
|
|
@@ -5089,15 +5144,11 @@ const sendMessagePortToMarkdownWorker = async port => {
|
|
|
5089
5144
|
};
|
|
5090
5145
|
|
|
5091
5146
|
const createMarkdownWorkerRpc = async () => {
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
return rpc;
|
|
5098
|
-
} catch (error) {
|
|
5099
|
-
throw new VError(error, `Failed to create markdown worker rpc`);
|
|
5100
|
-
}
|
|
5147
|
+
const rpc = await create$4({
|
|
5148
|
+
commandMap: {},
|
|
5149
|
+
send: sendMessagePortToMarkdownWorker
|
|
5150
|
+
});
|
|
5151
|
+
return rpc;
|
|
5101
5152
|
};
|
|
5102
5153
|
|
|
5103
5154
|
const initializeMarkdownWorker = async () => {
|
|
@@ -5107,7 +5158,7 @@ const initializeMarkdownWorker = async () => {
|
|
|
5107
5158
|
|
|
5108
5159
|
const initialize = async () => {
|
|
5109
5160
|
// TODO load markdown worker only when needed
|
|
5110
|
-
await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker()]);
|
|
5161
|
+
await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker(), initializeClipBoardWorker()]);
|
|
5111
5162
|
};
|
|
5112
5163
|
|
|
5113
5164
|
const loadContent2 = async (state, savedState, isTest = false) => {
|