@lvce-editor/extension-detail-view 3.48.0 → 3.49.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.
@@ -671,6 +671,7 @@ const HandleClickSize = 'handleClickSize';
671
671
  const HandleClickUninstall = 'handleClickUninstall';
672
672
  const HandleFeaturesClick = 'handleFeaturesClick';
673
673
  const HandleIconError = 'handleIconError';
674
+ const HandleImageContextMenu = 'handleImageContextMenu';
674
675
  const HandleReadmeContextMenu = 'handleReadmeContextMenu';
675
676
  const HandleReadmeScroll = 'handleReadmeScroll';
676
677
  const HandleTabsClick = 'handleTabsClick';
@@ -779,6 +780,9 @@ const {
779
780
  invoke: invoke$3,
780
781
  invokeAndTransfer: invokeAndTransfer$3,
781
782
  set: set$3$1} = create$7(RendererWorker$1);
783
+ const showContextMenu$1 = async (x, y, id, ...args) => {
784
+ return invoke$3('ContextMenu.show', x, y, id, ...args);
785
+ };
782
786
  const setColorTheme$2 = async id => {
783
787
  // @ts-ignore
784
788
  return invoke$3(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
@@ -826,6 +830,7 @@ const RendererWorker = {
826
830
  set: set$3$1,
827
831
  setColorTheme: setColorTheme$2,
828
832
  setExtensionsSearchValue: setExtensionsSearchValue$1,
833
+ showContextMenu: showContextMenu$1,
829
834
  uninstallExtension: uninstallExtension$1};
830
835
 
831
836
  const {
@@ -2145,7 +2150,9 @@ const {
2145
2150
  set: set$2,
2146
2151
  dispose: dispose$1,
2147
2152
  wrapCommand,
2148
- wrapGetter
2153
+ wrapGetter,
2154
+ getCommandIds,
2155
+ registerCommands
2149
2156
  } = create$1();
2150
2157
 
2151
2158
  const create = (uid, uri, x, y, width, height, platform, assetDir) => {
@@ -2242,12 +2249,6 @@ const dispose = uid => {
2242
2249
  dispose$1(uid);
2243
2250
  };
2244
2251
 
2245
- const commandIds = ['copyImage', 'getMenuEntries', 'handleClickCategory', 'handleClickDisable', 'handleClickScrollToTop', 'handleClickSetColorTheme', 'handleClickSettings', 'handleClickSize', 'handleClickUninstall', 'handleFeaturesClick', 'handleIconError', 'handleScroll', 'handleTabsClick', 'handleWheel', 'renderEventListeners', 'resize', 'saveState', 'selectTab', 'terminate'];
2246
-
2247
- const getCommandIds = () => {
2248
- return commandIds;
2249
- };
2250
-
2251
2252
  const None = 0;
2252
2253
 
2253
2254
  const getCopyMenuEntry = () => ({
@@ -2291,6 +2292,15 @@ const getLinkMenuEntries = props => {
2291
2292
 
2292
2293
  const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
2293
2294
 
2295
+ const ExtensionDetailIconContextMenu = 4091;
2296
+
2297
+ const getMenus = () => {
2298
+ return [{
2299
+ id: ExtensionDetailIconContextMenu,
2300
+ entries: []
2301
+ }];
2302
+ };
2303
+
2294
2304
  const {
2295
2305
  getAllExtensions: getAllExtensions$1,
2296
2306
  getExtension: getExtension$2,
@@ -2301,7 +2311,8 @@ const {
2301
2311
  set: set$1,
2302
2312
  setColorTheme: setColorTheme$1,
2303
2313
  setExtensionsSearchValue,
2304
- uninstallExtension
2314
+ uninstallExtension,
2315
+ showContextMenu
2305
2316
  } = RendererWorker;
2306
2317
 
2307
2318
  const openExtensionSearch = async searchValue => {
@@ -2437,6 +2448,15 @@ const handleIconError = state => {
2437
2448
  };
2438
2449
  };
2439
2450
 
2451
+ const show = async (menuId, x, y) => {
2452
+ await showContextMenu(menuId, x, y);
2453
+ };
2454
+
2455
+ const handleImageContextMenu = async (state, eventX, eventY) => {
2456
+ await show(ExtensionDetailIconContextMenu, eventX, eventY);
2457
+ return state;
2458
+ };
2459
+
2440
2460
  const handleScroll = (state, scrollTop, scrollSource = Script) => {
2441
2461
  const newScrollTop = Math.max(0, scrollTop);
2442
2462
  return {
@@ -3481,8 +3501,9 @@ const getExtensionDetailIconVirtualDom = iconSrc => {
3481
3501
  type: VirtualDomElements.Img,
3482
3502
  className: ExtensionDetailIcon,
3483
3503
  alt: '',
3484
- draggable: false,
3485
3504
  childCount: 0,
3505
+ draggable: false,
3506
+ onContextMenu: HandleImageContextMenu,
3486
3507
  src: iconSrc
3487
3508
  };
3488
3509
  };
@@ -3679,6 +3700,10 @@ const renderEventListeners = () => {
3679
3700
  }, {
3680
3701
  name: HandleReadmeContextMenu,
3681
3702
  params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
3703
+ }, {
3704
+ name: HandleImageContextMenu,
3705
+ params: ['handleImageContextMenu', 'event.clientX', 'event.clientY'],
3706
+ preventDefault: true
3682
3707
  }, {
3683
3708
  name: HandleReadmeScroll,
3684
3709
  params: ['handleScroll', 'event.target.scrollTop', User],
@@ -3735,6 +3760,7 @@ const saveState = state => {
3735
3760
 
3736
3761
  const commandMap = {
3737
3762
  'ExtensionDetail.copyImage': wrapCommand(copyImage),
3763
+ 'ExtensionDetail.getMenus': getMenus,
3738
3764
  'ExtensionDetail.create': create,
3739
3765
  'ExtensionDetail.diff2': diff2,
3740
3766
  'ExtensionDetail.dispose': dispose,
@@ -3756,6 +3782,7 @@ const commandMap = {
3756
3782
  'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
3757
3783
  'ExtensionDetail.render2': render2,
3758
3784
  'ExtensionDetail.renderEventListeners': renderEventListeners,
3785
+ 'ExtensionDetail.handleImageContextMenu': wrapCommand(handleImageContextMenu),
3759
3786
  'ExtensionDetail.resize': wrapCommand(resize),
3760
3787
  // @ts-ignore
3761
3788
  'ExtensionDetail.saveState': wrapGetter(saveState),
@@ -3765,6 +3792,7 @@ const commandMap = {
3765
3792
  };
3766
3793
 
3767
3794
  const listen = async () => {
3795
+ registerCommands(commandMap);
3768
3796
  const rpc = await WebWorkerRpcClient.create({
3769
3797
  commandMap: commandMap
3770
3798
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.48.0",
3
+ "version": "3.49.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",