@lvce-editor/extension-detail-view 3.13.0 → 3.15.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.
|
@@ -846,6 +846,8 @@ const WebWorkerRpcClient = {
|
|
|
846
846
|
create: create$2
|
|
847
847
|
};
|
|
848
848
|
|
|
849
|
+
const assetDir = '';
|
|
850
|
+
|
|
849
851
|
const create$1 = () => {
|
|
850
852
|
const states = Object.create(null);
|
|
851
853
|
return {
|
|
@@ -866,7 +868,7 @@ const {
|
|
|
866
868
|
set: set$1
|
|
867
869
|
} = create$1();
|
|
868
870
|
|
|
869
|
-
const create = (uid, uri, width, height, platform) => {
|
|
871
|
+
const create = (uid, uri, width, height, platform, assetDir$1) => {
|
|
870
872
|
const state = {
|
|
871
873
|
description: '',
|
|
872
874
|
iconSrc: '',
|
|
@@ -885,7 +887,8 @@ const create = (uid, uri, width, height, platform) => {
|
|
|
885
887
|
extension: {},
|
|
886
888
|
baseUrl: '',
|
|
887
889
|
features: [],
|
|
888
|
-
folderSize: 0
|
|
890
|
+
folderSize: 0,
|
|
891
|
+
assetDir: assetDir$1 || assetDir
|
|
889
892
|
};
|
|
890
893
|
set$1(uid, state, state);
|
|
891
894
|
};
|
|
@@ -2063,6 +2066,26 @@ const getFeatureThemesVirtualDom = themesHtml => {
|
|
|
2063
2066
|
}, ...markdownDom];
|
|
2064
2067
|
};
|
|
2065
2068
|
|
|
2069
|
+
const toWebView = rawWebView => {
|
|
2070
|
+
const {
|
|
2071
|
+
id,
|
|
2072
|
+
selector,
|
|
2073
|
+
contentSecurityPolicy,
|
|
2074
|
+
elements
|
|
2075
|
+
} = rawWebView;
|
|
2076
|
+
return {
|
|
2077
|
+
id,
|
|
2078
|
+
selectorString: JSON.stringify(selector),
|
|
2079
|
+
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
2080
|
+
elementsString: JSON.stringify(elements, null, 2)
|
|
2081
|
+
};
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
const getWebViews = extension => {
|
|
2085
|
+
const rawWebViews = extension.webViews || [];
|
|
2086
|
+
return rawWebViews.map(toWebView);
|
|
2087
|
+
};
|
|
2088
|
+
|
|
2066
2089
|
const heading$1 = {
|
|
2067
2090
|
type: H2$1,
|
|
2068
2091
|
className: DefinitionListItemHeading,
|
|
@@ -2078,14 +2101,12 @@ const item = {
|
|
|
2078
2101
|
className: DefinitionListItem,
|
|
2079
2102
|
childCount: 2
|
|
2080
2103
|
};
|
|
2081
|
-
|
|
2082
|
-
// TODO move json stringify to view model
|
|
2083
2104
|
const getWebViewVirtualDom = webView => {
|
|
2084
2105
|
const {
|
|
2085
2106
|
id: id$1,
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2107
|
+
selectorString,
|
|
2108
|
+
contentSecurityPolicyString,
|
|
2109
|
+
elementsString
|
|
2089
2110
|
} = webView;
|
|
2090
2111
|
const textId = id();
|
|
2091
2112
|
const textSelector = selector();
|
|
@@ -2095,11 +2116,11 @@ const getWebViewVirtualDom = webView => {
|
|
|
2095
2116
|
type: Div$1,
|
|
2096
2117
|
className: FeatureWebView,
|
|
2097
2118
|
childCount: 5
|
|
2098
|
-
}, item, heading$1, text(textId), pre, text(id$1), item, heading$1, text(textSelector), pre, text(
|
|
2119
|
+
}, item, heading$1, text(textId), pre, text(id$1), item, heading$1, text(textSelector), pre, text(selectorString), item, heading$1, text(textContentSecurityPolicy), pre, text(contentSecurityPolicyString), item, heading$1, text(textElements), pre, text(elementsString)];
|
|
2099
2120
|
};
|
|
2100
2121
|
|
|
2101
2122
|
const getFeatureWebViewsVirtualDom = extension => {
|
|
2102
|
-
const webViews$1 = extension
|
|
2123
|
+
const webViews$1 = getWebViews(extension);
|
|
2103
2124
|
const heading = webViews();
|
|
2104
2125
|
return [{
|
|
2105
2126
|
type: Div$1,
|
|
@@ -2512,22 +2533,27 @@ const handleClickUninstall = async state => {
|
|
|
2512
2533
|
return state;
|
|
2513
2534
|
};
|
|
2514
2535
|
|
|
2515
|
-
const
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
const
|
|
2519
|
-
|
|
2536
|
+
const extensionDefaultIcon = assetDir => {
|
|
2537
|
+
return `${assetDir}/icons/extensionDefaultIcon.png`;
|
|
2538
|
+
};
|
|
2539
|
+
const extensionLanguageBasics = assetDir => {
|
|
2540
|
+
return `${assetDir}/icons/language-icon.svg`;
|
|
2541
|
+
};
|
|
2542
|
+
const extensionTheme = assetDir => {
|
|
2543
|
+
return `${assetDir}/icons/theme-icon.png`;
|
|
2544
|
+
};
|
|
2520
2545
|
|
|
2521
2546
|
const handleIconError = state => {
|
|
2522
2547
|
const {
|
|
2523
|
-
iconSrc
|
|
2548
|
+
iconSrc,
|
|
2549
|
+
assetDir
|
|
2524
2550
|
} = state;
|
|
2525
|
-
if (iconSrc ===
|
|
2551
|
+
if (iconSrc === extensionDefaultIcon(assetDir)) {
|
|
2526
2552
|
return state;
|
|
2527
2553
|
}
|
|
2528
2554
|
return {
|
|
2529
2555
|
...state,
|
|
2530
|
-
iconSrc:
|
|
2556
|
+
iconSrc: extensionDefaultIcon(assetDir)
|
|
2531
2557
|
};
|
|
2532
2558
|
};
|
|
2533
2559
|
|
|
@@ -5128,18 +5154,18 @@ const Web = 1;
|
|
|
5128
5154
|
const Electron = 2;
|
|
5129
5155
|
const Remote = 3;
|
|
5130
5156
|
|
|
5131
|
-
const getIcon = (extension, platform) => {
|
|
5157
|
+
const getIcon = (extension, platform, assetDir) => {
|
|
5132
5158
|
if (!extension) {
|
|
5133
|
-
return
|
|
5159
|
+
return extensionDefaultIcon(assetDir);
|
|
5134
5160
|
}
|
|
5135
5161
|
if (!extension.path || !extension.icon) {
|
|
5136
5162
|
if (isLanguageBasicsExtension(extension)) {
|
|
5137
|
-
return
|
|
5163
|
+
return extensionLanguageBasics(assetDir);
|
|
5138
5164
|
}
|
|
5139
5165
|
if (isThemeExtension(extension)) {
|
|
5140
|
-
return
|
|
5166
|
+
return extensionTheme(assetDir);
|
|
5141
5167
|
}
|
|
5142
|
-
return
|
|
5168
|
+
return extensionDefaultIcon(assetDir);
|
|
5143
5169
|
}
|
|
5144
5170
|
if (platform === Remote || platform === Electron) {
|
|
5145
5171
|
if (extension.builtin) {
|
|
@@ -5263,7 +5289,8 @@ const loadReadmeContent = async path => {
|
|
|
5263
5289
|
const loadContent = async (state, platform, savedState) => {
|
|
5264
5290
|
const {
|
|
5265
5291
|
uri,
|
|
5266
|
-
width
|
|
5292
|
+
width,
|
|
5293
|
+
assetDir
|
|
5267
5294
|
} = state;
|
|
5268
5295
|
const id = uri.slice('extension-detail://'.length);
|
|
5269
5296
|
const extension = await getExtension(id, platform);
|
|
@@ -5274,7 +5301,7 @@ const loadContent = async (state, platform, savedState) => {
|
|
|
5274
5301
|
});
|
|
5275
5302
|
const sanitizedReadmeHtml = readmeHtml;
|
|
5276
5303
|
const normalizedReadmeHtml = sanitizedReadmeHtml;
|
|
5277
|
-
const iconSrc = getIcon(extension, platform);
|
|
5304
|
+
const iconSrc = getIcon(extension, platform, assetDir);
|
|
5278
5305
|
const description = getDescription(extension);
|
|
5279
5306
|
const name = getName(extension);
|
|
5280
5307
|
const size = getViewletSize(width);
|