@lvce-editor/extension-detail-view 3.45.0 → 3.47.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.
|
@@ -34,6 +34,7 @@ const Resources$1 = 'Resources';
|
|
|
34
34
|
const SaveImageAs = 'Save Image as';
|
|
35
35
|
const Schema = 'Schema';
|
|
36
36
|
const ScrollToTop$1 = 'Scroll to top';
|
|
37
|
+
const NoReadmeFound = 'No Readme Found.';
|
|
37
38
|
const Selector = 'Selector';
|
|
38
39
|
const SetColorTheme$1 = 'Set Color Theme';
|
|
39
40
|
const Settings$1 = 'Settings';
|
|
@@ -131,6 +132,9 @@ const uninstall = () => {
|
|
|
131
132
|
const scrollToTop = () => {
|
|
132
133
|
return i18nString(ScrollToTop$1);
|
|
133
134
|
};
|
|
135
|
+
const noReadmeFound = () => {
|
|
136
|
+
return i18nString(NoReadmeFound);
|
|
137
|
+
};
|
|
134
138
|
|
|
135
139
|
const getActivationEventsDetails = async extension => {
|
|
136
140
|
const activationEvents = extension.activation || [];
|
|
@@ -744,8 +748,13 @@ const {
|
|
|
744
748
|
const readFile$1$1 = async uri => {
|
|
745
749
|
return invoke$7('FileSystem.readFile', uri);
|
|
746
750
|
};
|
|
751
|
+
const exists$1 = async uri => {
|
|
752
|
+
// @ts-ignore
|
|
753
|
+
return invoke$7('FileSystem.exists', uri);
|
|
754
|
+
};
|
|
747
755
|
const FileSystemWorker = {
|
|
748
756
|
__proto__: null,
|
|
757
|
+
exists: exists$1,
|
|
749
758
|
invoke: invoke$7,
|
|
750
759
|
readFile: readFile$1$1,
|
|
751
760
|
set: set$7};
|
|
@@ -2033,8 +2042,13 @@ const WebWorkerRpcClient = {
|
|
|
2033
2042
|
create: create$2
|
|
2034
2043
|
};
|
|
2035
2044
|
|
|
2045
|
+
const toCommandId = key => {
|
|
2046
|
+
const dotIndex = key.indexOf('.');
|
|
2047
|
+
return key.slice(dotIndex + 1);
|
|
2048
|
+
};
|
|
2036
2049
|
const create$1 = () => {
|
|
2037
2050
|
const states = Object.create(null);
|
|
2051
|
+
const commandMapRef = {};
|
|
2038
2052
|
return {
|
|
2039
2053
|
get(uid) {
|
|
2040
2054
|
return states[uid];
|
|
@@ -2075,6 +2089,15 @@ const create$1 = () => {
|
|
|
2075
2089
|
};
|
|
2076
2090
|
return wrapped;
|
|
2077
2091
|
},
|
|
2092
|
+
wrapGetter(fn) {
|
|
2093
|
+
const wrapped = (uid, ...args) => {
|
|
2094
|
+
const {
|
|
2095
|
+
newState
|
|
2096
|
+
} = states[uid];
|
|
2097
|
+
return fn(newState, ...args);
|
|
2098
|
+
};
|
|
2099
|
+
return wrapped;
|
|
2100
|
+
},
|
|
2078
2101
|
diff(uid, modules, numbers) {
|
|
2079
2102
|
const {
|
|
2080
2103
|
oldState,
|
|
@@ -2088,6 +2111,14 @@ const create$1 = () => {
|
|
|
2088
2111
|
}
|
|
2089
2112
|
}
|
|
2090
2113
|
return diffResult;
|
|
2114
|
+
},
|
|
2115
|
+
getCommandIds() {
|
|
2116
|
+
const keys = Object.keys(commandMapRef);
|
|
2117
|
+
const ids = keys.map(toCommandId);
|
|
2118
|
+
return ids;
|
|
2119
|
+
},
|
|
2120
|
+
registerCommands(commandMap) {
|
|
2121
|
+
Object.assign(commandMapRef, commandMap);
|
|
2091
2122
|
}
|
|
2092
2123
|
};
|
|
2093
2124
|
};
|
|
@@ -2103,7 +2134,8 @@ const {
|
|
|
2103
2134
|
get,
|
|
2104
2135
|
set: set$2,
|
|
2105
2136
|
dispose: dispose$1,
|
|
2106
|
-
wrapCommand
|
|
2137
|
+
wrapCommand,
|
|
2138
|
+
wrapGetter
|
|
2107
2139
|
} = create$1();
|
|
2108
2140
|
|
|
2109
2141
|
const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
@@ -2119,6 +2151,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
2119
2151
|
changelogScrollTop: 0,
|
|
2120
2152
|
changelogVirtualDom: [],
|
|
2121
2153
|
commands: [],
|
|
2154
|
+
hasReadme: false,
|
|
2122
2155
|
description: '',
|
|
2123
2156
|
detailsVirtualDom: [],
|
|
2124
2157
|
displaySize: '',
|
|
@@ -2163,7 +2196,7 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
2163
2196
|
};
|
|
2164
2197
|
|
|
2165
2198
|
const isEqual$1 = (oldState, newState) => {
|
|
2166
|
-
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.themesMarkdownDom === newState.themesMarkdownDom && oldState.webViews === newState.webViews;
|
|
2199
|
+
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.themesMarkdownDom === newState.themesMarkdownDom && oldState.webViews === newState.webViews && oldState.sizeValue === newState.sizeValue;
|
|
2167
2200
|
};
|
|
2168
2201
|
|
|
2169
2202
|
const User = 1;
|
|
@@ -2394,6 +2427,7 @@ const handleScroll = (state, scrollTop, scrollSource = Script) => {
|
|
|
2394
2427
|
|
|
2395
2428
|
const {
|
|
2396
2429
|
set,
|
|
2430
|
+
exists,
|
|
2397
2431
|
readFile: readFile$1,
|
|
2398
2432
|
invoke
|
|
2399
2433
|
} = FileSystemWorker;
|
|
@@ -2595,8 +2629,7 @@ const initialize = async () => {
|
|
|
2595
2629
|
};
|
|
2596
2630
|
|
|
2597
2631
|
const existsFile = async uri => {
|
|
2598
|
-
|
|
2599
|
-
return true;
|
|
2632
|
+
return exists(uri);
|
|
2600
2633
|
};
|
|
2601
2634
|
|
|
2602
2635
|
const Web = 1;
|
|
@@ -3057,9 +3090,9 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
3057
3090
|
name
|
|
3058
3091
|
} = headerData;
|
|
3059
3092
|
const readmeUrl = join(extensionUri, 'README.md');
|
|
3060
|
-
join(extensionUri, 'CHANGELOG.md');
|
|
3061
|
-
const [hasReadme, hasChangelog] = await Promise.all([existsFile(), existsFile()]);
|
|
3062
|
-
const readmeContent = await loadReadmeContent(readmeUrl);
|
|
3093
|
+
const changelogUrl = join(extensionUri, 'CHANGELOG.md');
|
|
3094
|
+
const [hasReadme, hasChangelog] = await Promise.all([existsFile(readmeUrl), existsFile(changelogUrl)]);
|
|
3095
|
+
const readmeContent = hasReadme ? await loadReadmeContent(readmeUrl) : noReadmeFound();
|
|
3063
3096
|
const baseUrl = getBaseUrl(extension.path, platform);
|
|
3064
3097
|
const readmeHtml = await renderMarkdown(readmeContent, {
|
|
3065
3098
|
baseUrl
|
|
@@ -3100,21 +3133,22 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
3100
3133
|
description,
|
|
3101
3134
|
detailsVirtualDom,
|
|
3102
3135
|
displaySize,
|
|
3103
|
-
installationEntries,
|
|
3104
3136
|
extension,
|
|
3105
3137
|
extensionId,
|
|
3106
3138
|
extensionVersion,
|
|
3107
3139
|
features,
|
|
3108
3140
|
folderSize,
|
|
3109
3141
|
hasColorTheme,
|
|
3142
|
+
hasReadme,
|
|
3110
3143
|
iconSrc,
|
|
3144
|
+
installationEntries,
|
|
3145
|
+
marketplaceEntries,
|
|
3111
3146
|
name,
|
|
3112
3147
|
readmeScrollTop,
|
|
3113
3148
|
readmeUrl,
|
|
3114
3149
|
resources,
|
|
3115
3150
|
scrollSource: Script,
|
|
3116
3151
|
scrollToTopButtonEnabled: true,
|
|
3117
|
-
marketplaceEntries,
|
|
3118
3152
|
selectedTab,
|
|
3119
3153
|
sizeOnDisk: size,
|
|
3120
3154
|
sizeValue,
|
|
@@ -3290,19 +3324,24 @@ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
|
|
|
3290
3324
|
}
|
|
3291
3325
|
return count;
|
|
3292
3326
|
};
|
|
3293
|
-
const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, installationEntries, marketplaceEntries) => {
|
|
3327
|
+
const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, installationEntries, marketplaceEntries, hasReadme) => {
|
|
3294
3328
|
const firstHeading = installation();
|
|
3295
3329
|
const secondHeading = marketplace();
|
|
3296
3330
|
const thirdHeading = categories();
|
|
3297
3331
|
const fourthHeading = resources();
|
|
3298
3332
|
const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
|
|
3299
3333
|
const childCount = getChildCount(showAdditionalDetails);
|
|
3334
|
+
const contentDom = hasReadme ? sanitizedReadmeHtml : [{
|
|
3335
|
+
type: VirtualDomElements.Div,
|
|
3336
|
+
childCount: 1,
|
|
3337
|
+
className: 'Markdown'
|
|
3338
|
+
}, text(noReadmeFound())];
|
|
3300
3339
|
const dom = [{
|
|
3301
3340
|
type: VirtualDomElements.Div,
|
|
3302
3341
|
className: ExtensionDetailPanel,
|
|
3303
3342
|
childCount: childCount,
|
|
3304
3343
|
role: AriaRoles.Panel
|
|
3305
|
-
}, ...
|
|
3344
|
+
}, ...contentDom, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, installationEntries, secondHeading, marketplaceEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
|
|
3306
3345
|
return dom;
|
|
3307
3346
|
};
|
|
3308
3347
|
|
|
@@ -3357,7 +3396,7 @@ const getFeaturesVirtualDom = (features, selectedFeature, state) => {
|
|
|
3357
3396
|
const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, selectedTab, width, scrollToTopButtonEnabled, categories, resources, breakpoint, changelogDom, state) => {
|
|
3358
3397
|
switch (selectedTab) {
|
|
3359
3398
|
case Details:
|
|
3360
|
-
return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.installationEntries, state.marketplaceEntries);
|
|
3399
|
+
return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.installationEntries, state.marketplaceEntries, state.hasReadme);
|
|
3361
3400
|
case Features:
|
|
3362
3401
|
return getFeaturesVirtualDom(state.features, state.selectedFeature, state);
|
|
3363
3402
|
case Changelog:
|
|
@@ -3659,16 +3698,13 @@ const resize = (state, dimensions) => {
|
|
|
3659
3698
|
};
|
|
3660
3699
|
};
|
|
3661
3700
|
|
|
3662
|
-
const saveState =
|
|
3663
|
-
const {
|
|
3664
|
-
newState
|
|
3665
|
-
} = get(uid);
|
|
3701
|
+
const saveState = state => {
|
|
3666
3702
|
const {
|
|
3667
3703
|
selectedTab,
|
|
3668
3704
|
selectedFeature,
|
|
3669
3705
|
readmeScrollTop,
|
|
3670
3706
|
changelogScrollTop
|
|
3671
|
-
} =
|
|
3707
|
+
} = state;
|
|
3672
3708
|
return {
|
|
3673
3709
|
selectedTab,
|
|
3674
3710
|
selectedFeature,
|
|
@@ -3700,8 +3736,9 @@ const commandMap = {
|
|
|
3700
3736
|
'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
|
|
3701
3737
|
'ExtensionDetail.render2': render2,
|
|
3702
3738
|
'ExtensionDetail.renderEventListeners': renderEventListeners,
|
|
3703
|
-
'ExtensionDetail.resize': resize,
|
|
3704
|
-
|
|
3739
|
+
'ExtensionDetail.resize': wrapCommand(resize),
|
|
3740
|
+
// @ts-ignore
|
|
3741
|
+
'ExtensionDetail.saveState': wrapGetter(saveState),
|
|
3705
3742
|
'ExtensionDetail.selectTab': wrapCommand(selectTab),
|
|
3706
3743
|
'ExtensionDetail.terminate': terminate,
|
|
3707
3744
|
'ExtensionDetail.initialize': initialize
|