@lvce-editor/extension-detail-view 3.49.0 → 3.50.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.
@@ -16,6 +16,8 @@ const Changelog$2 = 'Changelog';
16
16
  const Commands$1 = 'Commands';
17
17
  const ContentSecurityPolicy = 'ContentSecurityPolicy';
18
18
  const Copy = 'Copy';
19
+ const CopyImage = 'Copy Image';
20
+ const CopyImageUrl = 'Copy Image Url';
19
21
  const Details$1 = 'Details';
20
22
  const Disable$1 = 'Disable';
21
23
  const Elements = 'Elements';
@@ -27,6 +29,7 @@ const JsonValidation$1 = 'Json Validation';
27
29
  const Label = 'Label';
28
30
  const Marketplace = 'Marketplace';
29
31
  const None$2 = 'None';
32
+ const NoReadmeFound = 'No Readme Found.';
30
33
  const OpenImageInNewTab = 'Open Image in New Tab';
31
34
  const OpenInNewTab = 'Open in New Tab';
32
35
  const ProgrammingLanguages$1 = 'Programming Languages';
@@ -34,7 +37,6 @@ const Resources$1 = 'Resources';
34
37
  const SaveImageAs = 'Save Image as';
35
38
  const Schema = 'Schema';
36
39
  const ScrollToTop$1 = 'Scroll to top';
37
- const NoReadmeFound = 'No Readme Found.';
38
40
  const Selector = 'Selector';
39
41
  const SetColorTheme$1 = 'Set Color Theme';
40
42
  const Settings$1 = 'Settings';
@@ -57,6 +59,12 @@ const resources = () => {
57
59
  const copy = () => {
58
60
  return i18nString(Copy);
59
61
  };
62
+ const copyImage$1 = () => {
63
+ return i18nString(CopyImage);
64
+ };
65
+ const copyImageUrl$1 = () => {
66
+ return i18nString(CopyImageUrl);
67
+ };
60
68
  const changelog = () => {
61
69
  return i18nString(Changelog$2);
62
70
  };
@@ -78,7 +86,7 @@ const openInNewTab = () => {
78
86
  const label = () => {
79
87
  return i18nString(Label);
80
88
  };
81
- const openImageInNewTab = () => {
89
+ const openImageInNewTab$1 = () => {
82
90
  return i18nString(OpenImageInNewTab);
83
91
  };
84
92
  const saveImageAs = () => {
@@ -797,6 +805,13 @@ const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
797
805
  // @ts-ignore
798
806
  await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
799
807
  };
808
+ const writeClipBoardText$1 = async text => {
809
+ await invoke$3('ClipBoard.writeText', /* text */text);
810
+ };
811
+ const writeClipBoardImage$1 = async blob => {
812
+ // @ts-ignore
813
+ await invoke$3('ClipBoard.writeImage', /* text */blob);
814
+ };
800
815
  const getAllExtensions$2 = async () => {
801
816
  return invoke$3('ExtensionManagement.getAllExtensions');
802
817
  };
@@ -823,6 +838,7 @@ const RendererWorker = {
823
838
  __proto__: null,
824
839
  getAllExtensions: getAllExtensions$2,
825
840
  getExtension: getExtension$3,
841
+ invoke: invoke$3,
826
842
  openExtensionSearch: openExtensionSearch$2,
827
843
  openNativeFolder: openNativeFolder$1,
828
844
  sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
@@ -831,7 +847,10 @@ const RendererWorker = {
831
847
  setColorTheme: setColorTheme$2,
832
848
  setExtensionsSearchValue: setExtensionsSearchValue$1,
833
849
  showContextMenu: showContextMenu$1,
834
- uninstallExtension: uninstallExtension$1};
850
+ uninstallExtension: uninstallExtension$1,
851
+ writeClipBoardImage: writeClipBoardImage$1,
852
+ writeClipBoardText: writeClipBoardText$1
853
+ };
835
854
 
836
855
  const {
837
856
  set: set$4,
@@ -1934,7 +1953,7 @@ const send = (transport, method, ...params) => {
1934
1953
  const message = create$4(method, params);
1935
1954
  transport.send(message);
1936
1955
  };
1937
- const invoke$1 = (ipc, method, ...params) => {
1956
+ const invoke$2 = (ipc, method, ...params) => {
1938
1957
  return invokeHelper(ipc, method, params, false);
1939
1958
  };
1940
1959
  const invokeAndTransfer = (ipc, method, ...params) => {
@@ -1967,7 +1986,7 @@ const createRpc = ipc => {
1967
1986
  send(ipc, method, ...params);
1968
1987
  },
1969
1988
  invoke(method, ...params) {
1970
- return invoke$1(ipc, method, ...params);
1989
+ return invoke$2(ipc, method, ...params);
1971
1990
  },
1972
1991
  invokeAndTransfer(method, ...params) {
1973
1992
  return invokeAndTransfer(ipc, method, ...params);
@@ -2141,13 +2160,76 @@ const terminate = () => {
2141
2160
  globalThis.close();
2142
2161
  };
2143
2162
 
2144
- const copyImage = state => {
2163
+ const {
2164
+ getAllExtensions: getAllExtensions$1,
2165
+ getExtension: getExtension$2,
2166
+ invoke: invoke$1,
2167
+ openExtensionSearch: openExtensionSearch$1,
2168
+ openNativeFolder,
2169
+ writeClipBoardText,
2170
+ sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
2171
+ sendMessagePortToMarkdownWorker: sendMessagePortToMarkdownWorker$1,
2172
+ set: set$2,
2173
+ setColorTheme: setColorTheme$1,
2174
+ setExtensionsSearchValue,
2175
+ showContextMenu,
2176
+ uninstallExtension,
2177
+ writeClipBoardImage
2178
+ } = RendererWorker;
2179
+ const openUrl$1 = async uri => {
2180
+ // @ts-ignore
2181
+ await invoke$1('Open.openUrl', uri);
2182
+ };
2183
+
2184
+ const writeClipboardImage = async blob => {
2185
+ await writeClipBoardImage(blob);
2186
+ };
2187
+ const writeText = async text => {
2188
+ await writeClipBoardText(text);
2189
+ };
2190
+
2191
+ const {
2192
+ set: set$1,
2193
+ exists,
2194
+ readFile: readFile$1,
2195
+ invoke
2196
+ } = FileSystemWorker;
2197
+ const readFileAsBlob = async uri => {
2198
+ // TODO maybe readAsObjectUrl?
2199
+ // @ts-ignore
2200
+ return invoke('FileSystem.readFileAsBlob', uri);
2201
+ };
2202
+
2203
+ const getImageCopyUrl = iconSrc => {
2204
+ // TODO support gitpod url prefixes
2205
+ // @ts-ignore
2206
+ const prefix = `${location.protocol}//${location.host}`;
2207
+ const absoluteIconSrc = `${prefix}${iconSrc}`;
2208
+ return absoluteIconSrc;
2209
+ };
2210
+
2211
+ const copyImage = async state => {
2212
+ const {
2213
+ iconSrc
2214
+ } = state;
2215
+ const absoluteIconSrc = getImageCopyUrl(iconSrc);
2216
+ const blob = await readFileAsBlob(absoluteIconSrc);
2217
+ await writeClipboardImage(blob);
2218
+ return state;
2219
+ };
2220
+
2221
+ const copyImageUrl = async state => {
2222
+ const {
2223
+ iconSrc
2224
+ } = state;
2225
+ const absoluteIconSrc = getImageCopyUrl(iconSrc);
2226
+ await writeText(absoluteIconSrc);
2145
2227
  return state;
2146
2228
  };
2147
2229
 
2148
2230
  const {
2149
2231
  get,
2150
- set: set$2,
2232
+ set,
2151
2233
  dispose: dispose$1,
2152
2234
  wrapCommand,
2153
2235
  wrapGetter,
@@ -2167,6 +2249,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2167
2249
  categories: [],
2168
2250
  changelogScrollTop: 0,
2169
2251
  changelogVirtualDom: [],
2252
+ extensionUri: '',
2170
2253
  commands: [],
2171
2254
  hasReadme: false,
2172
2255
  description: '',
@@ -2205,7 +2288,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2205
2288
  width,
2206
2289
  readmeUrl: ''
2207
2290
  };
2208
- set$2(uid, state, state);
2291
+ set(uid, state, state);
2209
2292
  };
2210
2293
 
2211
2294
  const isEqual$2 = (oldState, newState) => {
@@ -2264,7 +2347,7 @@ const getImageMenuEntries = props => {
2264
2347
  }
2265
2348
  return [{
2266
2349
  id: 'openImageInNewTab',
2267
- label: openImageInNewTab(),
2350
+ label: openImageInNewTab$1(),
2268
2351
  flags: None,
2269
2352
  command: 'Open.openUrl',
2270
2353
  args: [props.url || '']
@@ -2297,24 +2380,28 @@ const ExtensionDetailIconContextMenu = 4091;
2297
2380
  const getMenus = () => {
2298
2381
  return [{
2299
2382
  id: ExtensionDetailIconContextMenu,
2300
- entries: []
2383
+ entries: [{
2384
+ id: 'openImageInNewTab',
2385
+ label: openImageInNewTab$1(),
2386
+ flags: None,
2387
+ command: 'ExtensionDetail.openImageInNewTab',
2388
+ args: []
2389
+ }, {
2390
+ id: 'copyImage',
2391
+ label: copyImage$1(),
2392
+ flags: None,
2393
+ command: 'ExtensionDetail.copyImage',
2394
+ args: []
2395
+ }, {
2396
+ id: 'copyImageUrl',
2397
+ label: copyImageUrl$1(),
2398
+ flags: None,
2399
+ command: 'ExtensionDetail.copyImageUrl',
2400
+ args: []
2401
+ }]
2301
2402
  }];
2302
2403
  };
2303
2404
 
2304
- const {
2305
- getAllExtensions: getAllExtensions$1,
2306
- getExtension: getExtension$2,
2307
- openExtensionSearch: openExtensionSearch$1,
2308
- openNativeFolder,
2309
- sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
2310
- sendMessagePortToMarkdownWorker: sendMessagePortToMarkdownWorker$1,
2311
- set: set$1,
2312
- setColorTheme: setColorTheme$1,
2313
- setExtensionsSearchValue,
2314
- uninstallExtension,
2315
- showContextMenu
2316
- } = RendererWorker;
2317
-
2318
2405
  const openExtensionSearch = async searchValue => {
2319
2406
  await openExtensionSearch$1();
2320
2407
  await setExtensionsSearchValue(searchValue);
@@ -2449,7 +2536,7 @@ const handleIconError = state => {
2449
2536
  };
2450
2537
 
2451
2538
  const show = async (menuId, x, y) => {
2452
- await showContextMenu(menuId, x, y);
2539
+ await showContextMenu(x, y, menuId);
2453
2540
  };
2454
2541
 
2455
2542
  const handleImageContextMenu = async (state, eventX, eventY) => {
@@ -2466,13 +2553,6 @@ const handleScroll = (state, scrollTop, scrollSource = Script) => {
2466
2553
  };
2467
2554
  };
2468
2555
 
2469
- const {
2470
- set,
2471
- exists,
2472
- readFile: readFile$1,
2473
- invoke
2474
- } = FileSystemWorker;
2475
-
2476
2556
  const readFile = async uri => {
2477
2557
  return readFile$1(uri);
2478
2558
  };
@@ -2641,7 +2721,7 @@ const createFileSystemWorkerRpc = async () => {
2641
2721
 
2642
2722
  const initializeFileSystemWorker = async () => {
2643
2723
  const rpc = await createFileSystemWorkerRpc();
2644
- set(rpc);
2724
+ set$1(rpc);
2645
2725
  };
2646
2726
 
2647
2727
  const sendMessagePortToMarkdownWorker = async port => {
@@ -3176,6 +3256,7 @@ const loadContent = async (state, platform, savedState) => {
3176
3256
  displaySize,
3177
3257
  extension,
3178
3258
  extensionId,
3259
+ extensionUri,
3179
3260
  extensionVersion,
3180
3261
  features,
3181
3262
  folderSize,
@@ -3201,6 +3282,19 @@ const loadContent2 = async (state, savedState) => {
3201
3282
  return loadContent(state, state.platform, savedState);
3202
3283
  };
3203
3284
 
3285
+ const openUrl = async uri => {
3286
+ await openUrl$1(uri);
3287
+ };
3288
+
3289
+ const openImageInNewTab = async state => {
3290
+ const {
3291
+ iconSrc
3292
+ } = state;
3293
+ const absoluteIconSrc = getImageCopyUrl(iconSrc);
3294
+ await openUrl(absoluteIconSrc);
3295
+ return state;
3296
+ };
3297
+
3204
3298
  const getChangelogVirtualDom = changelogDom => {
3205
3299
  // const notImplemented = ExtensionDetailStrings.notImplemented()
3206
3300
  // TODO set tabpanel role
@@ -3685,7 +3779,7 @@ const render2 = (uid, diffResult) => {
3685
3779
  oldState,
3686
3780
  newState
3687
3781
  } = get(uid);
3688
- set$2(uid, newState, newState);
3782
+ set(uid, newState, newState);
3689
3783
  const commands = applyRender(oldState, newState, diffResult);
3690
3784
  return commands;
3691
3785
  };
@@ -3760,12 +3854,13 @@ const saveState = state => {
3760
3854
 
3761
3855
  const commandMap = {
3762
3856
  'ExtensionDetail.copyImage': wrapCommand(copyImage),
3763
- 'ExtensionDetail.getMenus': getMenus,
3857
+ 'ExtensionDetail.copyImageUrl': wrapCommand(copyImageUrl),
3764
3858
  'ExtensionDetail.create': create,
3765
3859
  'ExtensionDetail.diff2': diff2,
3766
3860
  'ExtensionDetail.dispose': dispose,
3767
3861
  'ExtensionDetail.getCommandIds': getCommandIds,
3768
3862
  'ExtensionDetail.getMenuEntries': getMenuEntries,
3863
+ 'ExtensionDetail.getMenus': getMenus,
3769
3864
  'ExtensionDetail.handleClickCategory': wrapCommand(handleClickCategory),
3770
3865
  'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
3771
3866
  'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
@@ -3775,14 +3870,15 @@ const commandMap = {
3775
3870
  'ExtensionDetail.handleClickUninstall': wrapCommand(handleClickUninstall),
3776
3871
  'ExtensionDetail.handleFeaturesClick': wrapCommand(handleClickFeatures),
3777
3872
  'ExtensionDetail.handleIconError': wrapCommand(handleIconError),
3873
+ 'ExtensionDetail.handleImageContextMenu': wrapCommand(handleImageContextMenu),
3778
3874
  'ExtensionDetail.handleScroll': wrapCommand(handleScroll),
3779
3875
  'ExtensionDetail.handleTabsClick': wrapCommand(handleTabsClick),
3780
3876
  'ExtensionDetail.handleWheel': wrapCommand(handleScroll),
3781
3877
  // deprecated
3782
3878
  'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
3879
+ 'ExtensionDetail.openImageInNewTab': wrapCommand(openImageInNewTab),
3783
3880
  'ExtensionDetail.render2': render2,
3784
3881
  'ExtensionDetail.renderEventListeners': renderEventListeners,
3785
- 'ExtensionDetail.handleImageContextMenu': wrapCommand(handleImageContextMenu),
3786
3882
  'ExtensionDetail.resize': wrapCommand(resize),
3787
3883
  // @ts-ignore
3788
3884
  'ExtensionDetail.saveState': wrapGetter(saveState),
@@ -3796,7 +3892,7 @@ const listen = async () => {
3796
3892
  const rpc = await WebWorkerRpcClient.create({
3797
3893
  commandMap: commandMap
3798
3894
  });
3799
- set$1(rpc);
3895
+ set$2(rpc);
3800
3896
  };
3801
3897
 
3802
3898
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.49.0",
3
+ "version": "3.50.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",