@lvce-editor/extension-detail-view 5.10.0 → 5.12.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.
@@ -19,6 +19,7 @@ const ContentSecurityPolicy = 'ContentSecurityPolicy';
19
19
  const Copy = 'Copy';
20
20
  const CopyImage = 'Copy Image';
21
21
  const CopyImageUrl = 'Copy Image Url';
22
+ const CopyLink = 'Copy Link';
22
23
  const Details$1 = 'Details';
23
24
  const Disable$1 = 'Disable';
24
25
  const Elements = 'Elements';
@@ -78,6 +79,9 @@ const marketplace = () => {
78
79
  const categories = () => {
79
80
  return i18nString(Categories$1);
80
81
  };
82
+ const copyLink = () => {
83
+ return i18nString(CopyLink);
84
+ };
81
85
  const resources = () => {
82
86
  return i18nString(Resources$1);
83
87
  };
@@ -1150,6 +1154,12 @@ const getType = value => {
1150
1154
  return Unknown;
1151
1155
  }
1152
1156
  };
1157
+ const number = value => {
1158
+ const type = getType(value);
1159
+ if (type !== Number$1) {
1160
+ throw new AssertionError('expected value to be of type number');
1161
+ }
1162
+ };
1153
1163
  const string = value => {
1154
1164
  const type = getType(value);
1155
1165
  if (type !== String) {
@@ -2250,6 +2260,14 @@ const {
2250
2260
  invoke: invoke$1,
2251
2261
  invokeAndTransfer,
2252
2262
  set: set$5} = create$7(RendererWorker);
2263
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
2264
+ number(uid);
2265
+ number(menuId);
2266
+ number(x);
2267
+ number(y);
2268
+ // @ts-ignore
2269
+ await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
2270
+ };
2253
2271
  const setColorTheme$1 = async id => {
2254
2272
  // @ts-ignore
2255
2273
  return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
@@ -2656,7 +2674,7 @@ const getCacheInternal = async (cacheName, bucketName) => {
2656
2674
  // @ts-ignore
2657
2675
  const bucket = await navigator.storageBuckets.open(bucketName, {
2658
2676
  expires: Date.now() + twoWeeks,
2659
- quota: 20 * 1024 * 1024 // 20MB
2677
+ quota: 100 * 1024 * 1024 // 100MB
2660
2678
  });
2661
2679
  const cache = await bucket.caches.open(cacheName);
2662
2680
  return cache;
@@ -3214,6 +3232,21 @@ const getMenuEntries2 = (state, props) => {
3214
3232
  if (props.menuId === ExtensionDetailIconContextMenu$3) {
3215
3233
  return getMenuEntriesImage();
3216
3234
  }
3235
+ if (props.menuId === ExtensionDetailReadme && props.href) {
3236
+ return [{
3237
+ args: [],
3238
+ command: 'ExtensionDetail.copyLink',
3239
+ flags: None$2,
3240
+ id: 'copyLink',
3241
+ label: copyLink()
3242
+ }, {
3243
+ args: [],
3244
+ command: 'ExtensionDetail.executeCopy',
3245
+ flags: None$2,
3246
+ id: 'copy',
3247
+ label: copy$1()
3248
+ }];
3249
+ }
3217
3250
  return [{
3218
3251
  args: [],
3219
3252
  command: 'ExtensionDetail.executeCopy',
@@ -3308,7 +3341,19 @@ const getMenus = () => {
3308
3341
  }];
3309
3342
  };
3310
3343
 
3311
- const handleAdditionalDetailContextMenu = state => {
3344
+ const show2 = async (uid, menuId, x, y, args) => {
3345
+ await showContextMenu2(uid, menuId, x, y, args);
3346
+ };
3347
+
3348
+ const handleAdditionalDetailContextMenu = async (state, x, y, nodeName, href) => {
3349
+ const {
3350
+ uid
3351
+ } = state;
3352
+ await show2(uid, ExtensionDetailReadme, x, y, {
3353
+ href,
3354
+ menuId: ExtensionDetailReadme,
3355
+ nodeName
3356
+ });
3312
3357
  return state;
3313
3358
  };
3314
3359
 
@@ -3553,11 +3598,6 @@ const handleIconError = state => {
3553
3598
  };
3554
3599
  };
3555
3600
 
3556
- const show2 = async (uid, menuId, x, y, args) => {
3557
- // @ts-ignore
3558
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
3559
- };
3560
-
3561
3601
  const ExtensionDetailIconContextMenu = 4091;
3562
3602
 
3563
3603
  const handleImageContextMenu = async (state, eventX, eventY) => {
@@ -4336,12 +4376,23 @@ const getRepositoryLink = extension => {
4336
4376
  const validLink = ensureValidLink(raw);
4337
4377
  return validLink;
4338
4378
  };
4379
+ const getIssuesLink = extension => {
4380
+ const repositoryLink = getRepositoryLink(extension);
4381
+ if (!repositoryLink) {
4382
+ return '';
4383
+ }
4384
+ if (repositoryLink && repositoryLink.startsWith('https://github.com')) {
4385
+ return `${repositoryLink}/issues`;
4386
+ }
4387
+ return '';
4388
+ };
4339
4389
 
4340
4390
  const getResources = (isBuiltin, extension) => {
4341
4391
  if (isBuiltin) {
4342
4392
  return [];
4343
4393
  }
4344
4394
  const repositoryLink = getRepositoryLink(extension);
4395
+ const issueLink = getIssuesLink(extension);
4345
4396
  const licenseLink = getLicenseLink();
4346
4397
  // TODO
4347
4398
  return [{
@@ -4351,7 +4402,7 @@ const getResources = (isBuiltin, extension) => {
4351
4402
  }, {
4352
4403
  icon: 'LinkExternal',
4353
4404
  label: issues(),
4354
- url: '#'
4405
+ url: issueLink
4355
4406
  }, {
4356
4407
  icon: 'Repo',
4357
4408
  label: repository(),
@@ -4774,7 +4825,7 @@ const getAdditionalDetailsVirtualDom = (showAdditionalDetails, firstHeading, ent
4774
4825
  }, {
4775
4826
  childCount: 4,
4776
4827
  className: AdditionalDetails,
4777
- onClick: HandleAdditionalDetailContextMenu,
4828
+ onContextMenu: HandleAdditionalDetailContextMenu,
4778
4829
  tabIndex: 0,
4779
4830
  type: Div
4780
4831
  }, ...getAdditionalDetailsEntryVirtualDom(firstHeading, entries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(secondHeading, secondEntries, getMoreInfoVirtualDom), ...getAdditionalDetailsEntryVirtualDom(thirdHeading, categories, getCategoriesDom), ...getAdditionalDetailsEntryVirtualDom(fourthHeading, resources, getResourcesVirtualDom)];
@@ -5126,7 +5177,7 @@ const render2 = (uid, diffResult) => {
5126
5177
  const renderEventListeners = () => {
5127
5178
  return [{
5128
5179
  name: HandleAdditionalDetailContextMenu,
5129
- params: ['handleAdditionalDetailsContextMenu'],
5180
+ params: ['handleAdditionalDetailsContextMenu', ClientX, ClientY, 'event.target.nodeName', 'event.target.href'],
5130
5181
  preventDefault: true
5131
5182
  }, {
5132
5183
  name: HandleClickCategory,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "5.10.0",
3
+ "version": "5.12.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,6 +11,6 @@
11
11
  "type": "module",
12
12
  "main": "dist/extensionDetailViewWorkerMain.js",
13
13
  "dependencies": {
14
- "@lvce-editor/constants": "^1.40.0"
14
+ "@lvce-editor/constants": "^1.41.0"
15
15
  }
16
16
  }