@lvce-editor/extension-detail-view 3.39.0 → 3.40.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 +155 -144
- package/package.json +1 -1
|
@@ -173,6 +173,7 @@ const H2 = 22;
|
|
|
173
173
|
const Dd = 43;
|
|
174
174
|
const Dl = 44;
|
|
175
175
|
const Li = 48;
|
|
176
|
+
const P = 50;
|
|
176
177
|
const Pre = 51;
|
|
177
178
|
const A = 53;
|
|
178
179
|
const Ul = 60;
|
|
@@ -191,6 +192,7 @@ const VirtualDomElements = {
|
|
|
191
192
|
H2,
|
|
192
193
|
Img,
|
|
193
194
|
Li,
|
|
195
|
+
P,
|
|
194
196
|
Pre,
|
|
195
197
|
Span,
|
|
196
198
|
TBody,
|
|
@@ -260,11 +262,16 @@ const TableCell = 'TableCell';
|
|
|
260
262
|
const TableHeading = 'TableHeading';
|
|
261
263
|
const Viewlet = 'Viewlet';
|
|
262
264
|
|
|
265
|
+
const li = {
|
|
266
|
+
type: VirtualDomElements.Li,
|
|
267
|
+
childCount: 1
|
|
268
|
+
};
|
|
269
|
+
const code = {
|
|
270
|
+
type: VirtualDomElements.Code,
|
|
271
|
+
childCount: 1
|
|
272
|
+
};
|
|
263
273
|
const getActivationEventVirtualDom = event => {
|
|
264
|
-
return [
|
|
265
|
-
type: VirtualDomElements.Li,
|
|
266
|
-
childCount: 1
|
|
267
|
-
}, text(event)];
|
|
274
|
+
return [li, code, text(event)];
|
|
268
275
|
};
|
|
269
276
|
|
|
270
277
|
const getFeatureContentHeadingVirtualDom = heading => {
|
|
@@ -509,6 +516,19 @@ class FeatureNotFoundError extends Error {
|
|
|
509
516
|
}
|
|
510
517
|
}
|
|
511
518
|
|
|
519
|
+
const getFeatureUnsupportedVirtualDom = state => {
|
|
520
|
+
return [{
|
|
521
|
+
type: VirtualDomElements.Div,
|
|
522
|
+
childCount: 2
|
|
523
|
+
}, {
|
|
524
|
+
type: VirtualDomElements.H1,
|
|
525
|
+
childCount: 1
|
|
526
|
+
}, text('Unsupported Feature'), {
|
|
527
|
+
type: VirtualDomElements.P,
|
|
528
|
+
childCount: 1
|
|
529
|
+
}, text('Selected feature is unknown or unsupported')];
|
|
530
|
+
};
|
|
531
|
+
|
|
512
532
|
const features = Object.create(null);
|
|
513
533
|
const register$1 = feature => {
|
|
514
534
|
features[feature.id] = feature;
|
|
@@ -535,7 +555,7 @@ const getFeatureDetailsHandler = featureName => {
|
|
|
535
555
|
const getFeatureVirtualDomHandler = featureName => {
|
|
536
556
|
const feature = features[featureName];
|
|
537
557
|
if (!feature) {
|
|
538
|
-
|
|
558
|
+
return getFeatureUnsupportedVirtualDom;
|
|
539
559
|
}
|
|
540
560
|
return feature.getVirtualDom;
|
|
541
561
|
};
|
|
@@ -2078,9 +2098,10 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
2078
2098
|
badge: '',
|
|
2079
2099
|
baseUrl: '',
|
|
2080
2100
|
builtinExtensionsBadgeEnabled: true,
|
|
2101
|
+
buttons: [],
|
|
2081
2102
|
categories: [],
|
|
2082
|
-
changelogVirtualDom: [],
|
|
2083
2103
|
changelogScrollTop: 0,
|
|
2104
|
+
changelogVirtualDom: [],
|
|
2084
2105
|
commands: [],
|
|
2085
2106
|
description: '',
|
|
2086
2107
|
detailsVirtualDom: [],
|
|
@@ -2091,10 +2112,10 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
2091
2112
|
extensionVersion: '',
|
|
2092
2113
|
features: [],
|
|
2093
2114
|
featuresVirtualDom: [],
|
|
2115
|
+
focus: 0,
|
|
2094
2116
|
folderSize: 0,
|
|
2095
2117
|
hasColorTheme: false,
|
|
2096
2118
|
iconSrc: '',
|
|
2097
|
-
isBuiltin: false,
|
|
2098
2119
|
jsonValidation: [],
|
|
2099
2120
|
name: '',
|
|
2100
2121
|
platform,
|
|
@@ -2111,11 +2132,11 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
2111
2132
|
showAdditionalDetailsBreakpoint: 600,
|
|
2112
2133
|
sizeOnDisk: 0,
|
|
2113
2134
|
sizeValue: 0,
|
|
2135
|
+
tabs: [],
|
|
2114
2136
|
themesMarkdownDom: [],
|
|
2115
2137
|
uri,
|
|
2116
2138
|
webViews: [],
|
|
2117
|
-
width
|
|
2118
|
-
focus: 0
|
|
2139
|
+
width
|
|
2119
2140
|
};
|
|
2120
2141
|
set$1(uid, state, state);
|
|
2121
2142
|
};
|
|
@@ -2346,6 +2367,15 @@ const handleIconError = state => {
|
|
|
2346
2367
|
};
|
|
2347
2368
|
};
|
|
2348
2369
|
|
|
2370
|
+
const handleScroll = (state, scrollTop) => {
|
|
2371
|
+
const newScrollTop = Math.max(0, scrollTop);
|
|
2372
|
+
return {
|
|
2373
|
+
...state,
|
|
2374
|
+
readmeScrollTop: newScrollTop,
|
|
2375
|
+
scrollSource: User
|
|
2376
|
+
};
|
|
2377
|
+
};
|
|
2378
|
+
|
|
2349
2379
|
const readFile = async uri => {
|
|
2350
2380
|
return readFile$1(uri);
|
|
2351
2381
|
};
|
|
@@ -2437,6 +2467,9 @@ const selectTabFeatures = async state => {
|
|
|
2437
2467
|
selectedFeature,
|
|
2438
2468
|
features
|
|
2439
2469
|
} = state;
|
|
2470
|
+
if (features.length === 0) {
|
|
2471
|
+
return state;
|
|
2472
|
+
}
|
|
2440
2473
|
const actualSelectedFeature = selectedFeature || Theme;
|
|
2441
2474
|
const fn = getFeatureDetailsHandler(actualSelectedFeature);
|
|
2442
2475
|
const partialNewState = await fn(extension, baseUrl);
|
|
@@ -2470,15 +2503,6 @@ const handleTabsClick = (state, name) => {
|
|
|
2470
2503
|
return selectTab(state, name);
|
|
2471
2504
|
};
|
|
2472
2505
|
|
|
2473
|
-
const handleWheel = (state, deltaX, deltaY) => {
|
|
2474
|
-
const newScrollTop = Math.max(0, state.readmeScrollTop + deltaY);
|
|
2475
|
-
return {
|
|
2476
|
-
...state,
|
|
2477
|
-
readmeScrollTop: newScrollTop,
|
|
2478
|
-
scrollSource: User
|
|
2479
|
-
};
|
|
2480
|
-
};
|
|
2481
|
-
|
|
2482
2506
|
const sendMessagePortToMarkdownWorker = async port => {
|
|
2483
2507
|
await sendMessagePortToMarkdownWorker$1(port, 0);
|
|
2484
2508
|
};
|
|
@@ -2561,6 +2585,7 @@ const getBaseUrl = (extensionPath, platform) => {
|
|
|
2561
2585
|
};
|
|
2562
2586
|
|
|
2563
2587
|
const getCategories = () => {
|
|
2588
|
+
// TODO
|
|
2564
2589
|
return [{
|
|
2565
2590
|
id: 'themes',
|
|
2566
2591
|
label: 'Themes'
|
|
@@ -2660,17 +2685,24 @@ const getDisplaySize = size => {
|
|
|
2660
2685
|
});
|
|
2661
2686
|
};
|
|
2662
2687
|
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2688
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin) => {
|
|
2689
|
+
const allActions = [{
|
|
2690
|
+
label: setColorTheme$3(),
|
|
2691
|
+
onClick: HandleClickSetColorTheme,
|
|
2692
|
+
enabled: hasColorTheme,
|
|
2693
|
+
name: SetColorTheme
|
|
2667
2694
|
}, {
|
|
2668
|
-
|
|
2669
|
-
|
|
2695
|
+
label: disable(),
|
|
2696
|
+
onClick: HandleClickDisable,
|
|
2697
|
+
enabled: true,
|
|
2698
|
+
name: Disable
|
|
2670
2699
|
}, {
|
|
2671
|
-
|
|
2672
|
-
|
|
2700
|
+
label: uninstall(),
|
|
2701
|
+
onClick: HandleClickUninstall,
|
|
2702
|
+
enabled: !isBuiltin,
|
|
2703
|
+
name: Uninstall
|
|
2673
2704
|
}];
|
|
2705
|
+
return allActions;
|
|
2674
2706
|
};
|
|
2675
2707
|
|
|
2676
2708
|
const getExtensionIdFromUri = uri => {
|
|
@@ -2689,7 +2721,48 @@ const getFolderSize = async uri => {
|
|
|
2689
2721
|
}
|
|
2690
2722
|
};
|
|
2691
2723
|
|
|
2692
|
-
const
|
|
2724
|
+
const getInstallationEntries = (displaySize, extensionId, extensionVersion, extensionUri) => {
|
|
2725
|
+
const entries = [{
|
|
2726
|
+
key: 'Identifier',
|
|
2727
|
+
value: extensionId,
|
|
2728
|
+
odd: true,
|
|
2729
|
+
code: true
|
|
2730
|
+
}, {
|
|
2731
|
+
key: 'Version',
|
|
2732
|
+
value: extensionVersion,
|
|
2733
|
+
code: true
|
|
2734
|
+
}, {
|
|
2735
|
+
key: 'Last Updated',
|
|
2736
|
+
value: 'n/a',
|
|
2737
|
+
odd: true
|
|
2738
|
+
}, {
|
|
2739
|
+
key: 'Size',
|
|
2740
|
+
value: displaySize,
|
|
2741
|
+
onClick: HandleClickSize,
|
|
2742
|
+
title: extensionUri
|
|
2743
|
+
}];
|
|
2744
|
+
return entries;
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
const getMarketplaceEntries = isBuiltin => {
|
|
2748
|
+
if (isBuiltin) {
|
|
2749
|
+
return [];
|
|
2750
|
+
}
|
|
2751
|
+
return [{
|
|
2752
|
+
key: 'Published',
|
|
2753
|
+
value: 'n/a',
|
|
2754
|
+
odd: true
|
|
2755
|
+
}, {
|
|
2756
|
+
key: 'Last Released',
|
|
2757
|
+
value: 'n/a'
|
|
2758
|
+
}];
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
const getResources = isBuiltin => {
|
|
2762
|
+
if (isBuiltin) {
|
|
2763
|
+
return [];
|
|
2764
|
+
}
|
|
2765
|
+
// TODO
|
|
2693
2766
|
return [{
|
|
2694
2767
|
label: 'Marketplace',
|
|
2695
2768
|
url: '#'
|
|
@@ -2705,14 +2778,24 @@ const getResources = () => {
|
|
|
2705
2778
|
}];
|
|
2706
2779
|
};
|
|
2707
2780
|
|
|
2708
|
-
const
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2781
|
+
const getTabs = (selectedTab, hasReadme, hasFeatures, hasChangelog) => {
|
|
2782
|
+
const tabs = [{
|
|
2783
|
+
label: details(),
|
|
2784
|
+
name: Details,
|
|
2785
|
+
selected: selectedTab === Details,
|
|
2786
|
+
enabled: hasReadme
|
|
2712
2787
|
}, {
|
|
2713
|
-
|
|
2714
|
-
|
|
2788
|
+
label: features$1(),
|
|
2789
|
+
name: Features,
|
|
2790
|
+
selected: selectedTab === Features,
|
|
2791
|
+
enabled: hasFeatures
|
|
2792
|
+
}, {
|
|
2793
|
+
label: changelog(),
|
|
2794
|
+
name: Changelog,
|
|
2795
|
+
selected: selectedTab === Changelog,
|
|
2796
|
+
enabled: hasChangelog
|
|
2715
2797
|
}];
|
|
2798
|
+
return tabs;
|
|
2716
2799
|
};
|
|
2717
2800
|
|
|
2718
2801
|
const Small = 1;
|
|
@@ -2884,30 +2967,40 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
2884
2967
|
const detailsVirtualDom = await getMarkdownVirtualDom(readmeHtml, {
|
|
2885
2968
|
scrollToTopEnabled: true
|
|
2886
2969
|
});
|
|
2970
|
+
const isBuiltin = extension?.isBuiltin;
|
|
2971
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin);
|
|
2972
|
+
const enabledButtons = buttons.filter(button => button.enabled);
|
|
2887
2973
|
const size = getViewletSize(width);
|
|
2888
2974
|
const {
|
|
2889
2975
|
selectedFeature,
|
|
2890
2976
|
selectedTab,
|
|
2891
|
-
readmeScrollTop
|
|
2977
|
+
readmeScrollTop,
|
|
2978
|
+
changelogScrollTop
|
|
2892
2979
|
} = restoreState(savedState);
|
|
2893
2980
|
const features = getFeatures(selectedFeature || Theme, extension);
|
|
2981
|
+
const hasFeatures = features.length > 0;
|
|
2982
|
+
const hasReadme = true; // TODO
|
|
2983
|
+
const hasChangelog = true; // TODO
|
|
2984
|
+
const tabs = getTabs(selectedTab, hasReadme, hasFeatures, hasChangelog);
|
|
2985
|
+
const enabledTabs = tabs.filter(tab => tab.enabled);
|
|
2894
2986
|
const folderSize = await getFolderSize(extensionUri);
|
|
2895
|
-
const displaySize = getDisplaySize(
|
|
2896
|
-
const
|
|
2897
|
-
const
|
|
2987
|
+
const displaySize = getDisplaySize(folderSize);
|
|
2988
|
+
const installationEntries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
|
|
2989
|
+
const marketplaceEntries = getMarketplaceEntries(isBuiltin);
|
|
2898
2990
|
const categories = getCategories();
|
|
2899
|
-
const resources = getResources();
|
|
2991
|
+
const resources = getResources(isBuiltin);
|
|
2900
2992
|
const sizeValue = getViewletSize(width || 0);
|
|
2901
|
-
const isBuiltin = extension?.builtin;
|
|
2902
2993
|
return {
|
|
2903
2994
|
...state,
|
|
2904
2995
|
badge,
|
|
2905
2996
|
baseUrl,
|
|
2997
|
+
buttons: enabledButtons,
|
|
2906
2998
|
categories,
|
|
2999
|
+
changelogScrollTop,
|
|
2907
3000
|
description,
|
|
2908
3001
|
detailsVirtualDom,
|
|
2909
3002
|
displaySize,
|
|
2910
|
-
entries,
|
|
3003
|
+
entries: installationEntries,
|
|
2911
3004
|
extension,
|
|
2912
3005
|
extensionId,
|
|
2913
3006
|
extensionVersion,
|
|
@@ -2915,15 +3008,16 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
2915
3008
|
folderSize,
|
|
2916
3009
|
hasColorTheme,
|
|
2917
3010
|
iconSrc,
|
|
2918
|
-
isBuiltin,
|
|
2919
3011
|
name,
|
|
2920
3012
|
readmeScrollTop,
|
|
2921
3013
|
resources,
|
|
2922
3014
|
scrollToTopButtonEnabled: true,
|
|
2923
|
-
secondEntries,
|
|
3015
|
+
secondEntries: marketplaceEntries,
|
|
3016
|
+
scrollSource: Script,
|
|
2924
3017
|
selectedTab,
|
|
2925
3018
|
sizeOnDisk: size,
|
|
2926
|
-
sizeValue
|
|
3019
|
+
sizeValue,
|
|
3020
|
+
tabs: enabledTabs
|
|
2927
3021
|
};
|
|
2928
3022
|
};
|
|
2929
3023
|
|
|
@@ -2931,26 +3025,6 @@ const loadContent2 = async (state, savedState) => {
|
|
|
2931
3025
|
return loadContent(state, state.platform, savedState);
|
|
2932
3026
|
};
|
|
2933
3027
|
|
|
2934
|
-
const getExtensionDetailButtons = (hasColorTheme, isBuiltin) => {
|
|
2935
|
-
const allActions = [{
|
|
2936
|
-
label: setColorTheme$3(),
|
|
2937
|
-
onClick: HandleClickSetColorTheme,
|
|
2938
|
-
enabled: hasColorTheme,
|
|
2939
|
-
name: SetColorTheme
|
|
2940
|
-
}, {
|
|
2941
|
-
label: disable(),
|
|
2942
|
-
onClick: HandleClickDisable,
|
|
2943
|
-
enabled: true,
|
|
2944
|
-
name: Disable
|
|
2945
|
-
}, {
|
|
2946
|
-
label: uninstall(),
|
|
2947
|
-
onClick: HandleClickUninstall,
|
|
2948
|
-
enabled: !isBuiltin,
|
|
2949
|
-
name: Uninstall
|
|
2950
|
-
}];
|
|
2951
|
-
return allActions;
|
|
2952
|
-
};
|
|
2953
|
-
|
|
2954
3028
|
const getChangelogVirtualDom = changelogDom => {
|
|
2955
3029
|
// const notImplemented = ExtensionDetailStrings.notImplemented()
|
|
2956
3030
|
// TODO set tabpanel role
|
|
@@ -3108,40 +3182,6 @@ const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, ent
|
|
|
3108
3182
|
}, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
|
|
3109
3183
|
};
|
|
3110
3184
|
|
|
3111
|
-
const getInstallationEntries = (displaySize, extensionId, extensionVersion, extensionUri) => {
|
|
3112
|
-
const entries = [{
|
|
3113
|
-
key: 'Identifier',
|
|
3114
|
-
value: extensionId,
|
|
3115
|
-
odd: true,
|
|
3116
|
-
code: true
|
|
3117
|
-
}, {
|
|
3118
|
-
key: 'Version',
|
|
3119
|
-
value: extensionVersion,
|
|
3120
|
-
code: true
|
|
3121
|
-
}, {
|
|
3122
|
-
key: 'Last Updated',
|
|
3123
|
-
value: 'n/a',
|
|
3124
|
-
odd: true
|
|
3125
|
-
}, {
|
|
3126
|
-
key: 'Size',
|
|
3127
|
-
value: displaySize,
|
|
3128
|
-
onClick: HandleClickSize,
|
|
3129
|
-
title: extensionUri
|
|
3130
|
-
}];
|
|
3131
|
-
return entries;
|
|
3132
|
-
};
|
|
3133
|
-
|
|
3134
|
-
const getMarketplaceEntries = () => {
|
|
3135
|
-
return [{
|
|
3136
|
-
key: 'Published',
|
|
3137
|
-
value: 'n/a',
|
|
3138
|
-
odd: true
|
|
3139
|
-
}, {
|
|
3140
|
-
key: 'Last Released',
|
|
3141
|
-
value: 'n/a'
|
|
3142
|
-
}];
|
|
3143
|
-
};
|
|
3144
|
-
|
|
3145
3185
|
const getChildCount = (additionalDetails, scrollToTopEnabled) => {
|
|
3146
3186
|
let count = 1;
|
|
3147
3187
|
if (additionalDetails) {
|
|
@@ -3149,12 +3189,9 @@ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
|
|
|
3149
3189
|
}
|
|
3150
3190
|
return count;
|
|
3151
3191
|
};
|
|
3152
|
-
const getDetailsVirtualDom = (sanitizedReadmeHtml,
|
|
3153
|
-
) => {
|
|
3192
|
+
const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, marketplaceEntries, installationEntries) => {
|
|
3154
3193
|
const firstHeading = installation();
|
|
3155
|
-
const entries = getInstallationEntries(displaySize, extensionId, extensionVersion, extensionUri);
|
|
3156
3194
|
const secondHeading = marketplace();
|
|
3157
|
-
const secondEntries = getMarketplaceEntries();
|
|
3158
3195
|
const thirdHeading = categories();
|
|
3159
3196
|
const fourthHeading = resources();
|
|
3160
3197
|
const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
|
|
@@ -3164,7 +3201,7 @@ const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, ext
|
|
|
3164
3201
|
className: ExtensionDetailPanel,
|
|
3165
3202
|
childCount: childCount,
|
|
3166
3203
|
role: AriaRoles.Panel
|
|
3167
|
-
}, ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading,
|
|
3204
|
+
}, ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, installationEntries, secondHeading, marketplaceEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
|
|
3168
3205
|
return dom;
|
|
3169
3206
|
};
|
|
3170
3207
|
|
|
@@ -3216,10 +3253,10 @@ const getFeaturesVirtualDom = (features, selectedFeature, state) => {
|
|
|
3216
3253
|
}, ...featureVirtualDom];
|
|
3217
3254
|
};
|
|
3218
3255
|
|
|
3219
|
-
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml,
|
|
3256
|
+
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, selectedTab, width, scrollToTopButtonEnabled, categories, resources, breakpoint, changelogDom, state) => {
|
|
3220
3257
|
switch (selectedTab) {
|
|
3221
3258
|
case Details:
|
|
3222
|
-
return getDetailsVirtualDom(sanitizedReadmeHtml,
|
|
3259
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.entries, state.secondEntries);
|
|
3223
3260
|
case Features:
|
|
3224
3261
|
return getFeaturesVirtualDom(state.features, state.selectedFeature, state);
|
|
3225
3262
|
case Changelog:
|
|
@@ -3321,32 +3358,19 @@ const getExtensionDetailHeaderVirtualDom = (name, iconSrc, description, badge, b
|
|
|
3321
3358
|
return dom;
|
|
3322
3359
|
};
|
|
3323
3360
|
|
|
3324
|
-
const getTabs = selectedTab => {
|
|
3325
|
-
const tabs = [{
|
|
3326
|
-
label: details(),
|
|
3327
|
-
name: Details,
|
|
3328
|
-
selected: selectedTab === Details
|
|
3329
|
-
}, {
|
|
3330
|
-
label: features$1(),
|
|
3331
|
-
name: Features,
|
|
3332
|
-
selected: selectedTab === Features
|
|
3333
|
-
}, {
|
|
3334
|
-
label: changelog(),
|
|
3335
|
-
name: Changelog,
|
|
3336
|
-
selected: selectedTab === Changelog
|
|
3337
|
-
}];
|
|
3338
|
-
return tabs;
|
|
3339
|
-
};
|
|
3340
|
-
|
|
3341
3361
|
const selectedClassName = mergeClassNames(ExtensionDetailTab, ExtensionDetailTabSelected);
|
|
3342
3362
|
const defaultClassName = ExtensionDetailTab;
|
|
3363
|
+
const getTabClassName = isSelected => {
|
|
3364
|
+
return isSelected ? selectedClassName : defaultClassName;
|
|
3365
|
+
};
|
|
3366
|
+
|
|
3343
3367
|
const getTabVirtualDom = tab => {
|
|
3344
3368
|
const {
|
|
3345
3369
|
label,
|
|
3346
3370
|
selected,
|
|
3347
3371
|
name
|
|
3348
3372
|
} = tab;
|
|
3349
|
-
const className = selected
|
|
3373
|
+
const className = getTabClassName(selected);
|
|
3350
3374
|
const ariaSelected = selected;
|
|
3351
3375
|
return [{
|
|
3352
3376
|
type: VirtualDomElements.Button,
|
|
@@ -3390,43 +3414,28 @@ const getExtensionDetailVirtualDom = (newState, selectedTab) => {
|
|
|
3390
3414
|
// 3. virtual dom
|
|
3391
3415
|
// 4. dom
|
|
3392
3416
|
const {
|
|
3393
|
-
|
|
3417
|
+
badge,
|
|
3418
|
+
buttons,
|
|
3394
3419
|
categories,
|
|
3395
3420
|
changelogVirtualDom,
|
|
3396
|
-
commands,
|
|
3397
3421
|
description,
|
|
3398
3422
|
detailsVirtualDom,
|
|
3399
|
-
displaySize,
|
|
3400
|
-
extension,
|
|
3401
|
-
extensionId,
|
|
3402
|
-
extensionVersion,
|
|
3403
|
-
features,
|
|
3404
|
-
hasColorTheme,
|
|
3405
3423
|
iconSrc,
|
|
3406
|
-
isBuiltin,
|
|
3407
|
-
jsonValidation,
|
|
3408
3424
|
name,
|
|
3409
3425
|
resources,
|
|
3410
3426
|
scrollToTopButtonEnabled,
|
|
3411
|
-
selectedFeature,
|
|
3412
|
-
settings,
|
|
3413
3427
|
settingsButtonEnabled,
|
|
3414
3428
|
showAdditionalDetailsBreakpoint,
|
|
3415
3429
|
sizeValue,
|
|
3416
|
-
|
|
3417
|
-
webViews,
|
|
3418
|
-
badge
|
|
3430
|
+
tabs
|
|
3419
3431
|
} = newState;
|
|
3420
|
-
const extensionUri = extension.uri || extension.path || '';
|
|
3421
3432
|
const width = newState?.width || 500;
|
|
3422
|
-
const tabs = getTabs(selectedTab);
|
|
3423
3433
|
const sizeClass = getClassNames(sizeValue);
|
|
3424
|
-
const buttonDefs = getExtensionDetailButtons(hasColorTheme, isBuiltin); // TODO compute in loadContent
|
|
3425
3434
|
const dom = [{
|
|
3426
3435
|
type: VirtualDomElements.Div,
|
|
3427
3436
|
className: mergeClassNames(Viewlet, ExtensionDetail, sizeClass),
|
|
3428
3437
|
childCount: 3
|
|
3429
|
-
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge,
|
|
3438
|
+
}, ...getExtensionDetailHeaderVirtualDom(name, iconSrc, description, badge, buttons, settingsButtonEnabled), ...getTabsVirtualDom(tabs), ...getExtensionDetailContentVirtualDom(detailsVirtualDom, selectedTab, width, scrollToTopButtonEnabled, categories, resources, showAdditionalDetailsBreakpoint, changelogVirtualDom, newState)];
|
|
3430
3439
|
return dom;
|
|
3431
3440
|
};
|
|
3432
3441
|
|
|
@@ -3489,7 +3498,7 @@ const renderEventListeners = () => {
|
|
|
3489
3498
|
params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
|
|
3490
3499
|
}, {
|
|
3491
3500
|
name: HandleReadmeScroll,
|
|
3492
|
-
params: ['
|
|
3501
|
+
params: ['handleScroll', 'event.target.scrollTop'],
|
|
3493
3502
|
passive: true
|
|
3494
3503
|
}, {
|
|
3495
3504
|
name: HandleTabsClick,
|
|
@@ -3554,14 +3563,16 @@ const commandMap = {
|
|
|
3554
3563
|
'ExtensionDetail.handleClickCategory': wrapCommand(handleClickCategory),
|
|
3555
3564
|
'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
|
|
3556
3565
|
'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
|
|
3557
|
-
'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
|
|
3558
3566
|
'ExtensionDetail.handleClickSetColorTheme': wrapCommand(handleClickSetColorTheme),
|
|
3567
|
+
'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
|
|
3559
3568
|
'ExtensionDetail.handleClickSize': wrapCommand(handleClickSize),
|
|
3560
3569
|
'ExtensionDetail.handleClickUninstall': wrapCommand(handleClickUninstall),
|
|
3561
3570
|
'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
|
|
3562
3571
|
'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
|
|
3572
|
+
'ExtensionDetail.handleScroll': wrapCommand(handleScroll),
|
|
3563
3573
|
'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
|
|
3564
|
-
'ExtensionDetail.handleWheel': wrapCommand(
|
|
3574
|
+
'ExtensionDetail.handleWheel': wrapCommand(handleScroll),
|
|
3575
|
+
// deprecated
|
|
3565
3576
|
'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
|
|
3566
3577
|
'ExtensionDetail.render2': render2,
|
|
3567
3578
|
'ExtensionDetail.renderEventListeners': renderEventListeners,
|