@lvce-editor/extension-detail-view 7.19.2 → 7.20.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.
@@ -18,16 +18,19 @@ const Changelog$2 = 'Changelog';
18
18
  const Commands$1 = 'Commands';
19
19
  const ContentSecurityPolicy = 'Content Security Policy';
20
20
  const Copy = 'Copy';
21
+ const CopyExtensionId = 'Copy Extension ID';
21
22
  const CopyImage = 'Copy Image';
22
23
  const CopyImageUrl = 'Copy Image Url';
23
24
  const CopyLink = 'Copy Link';
24
25
  const Created = 'Created';
26
+ const Description = 'Description';
25
27
  const Details$1 = 'Details';
26
28
  const Disable$1 = 'Disable';
27
29
  const DownloadCount = 'Downloads';
28
30
  const Elements = 'Elements';
29
31
  const EmptyCommandsArray = 'The extension contributes an empty commands array.';
30
32
  const Enable$1 = 'Enable';
33
+ const ExtensionInfoId = 'Id';
31
34
  const ExtensionNotAvailable = 'The extension "{PH1}" is not available in this version of LVCE Editor.';
32
35
  const Features$2 = 'Features';
33
36
  const FileExtensions = 'File Extensions';
@@ -54,6 +57,7 @@ const OpenInNewTab = 'Open in New Tab';
54
57
  const ProgrammingLanguages$1 = 'Programming Languages';
55
58
  const PropertyMustBeOfTypeString = 'Property must be a string';
56
59
  const Published = 'Published';
60
+ const Publisher = 'Publisher';
57
61
  const Rating = 'Rating';
58
62
  const Repository = 'Repository';
59
63
  const Resources$1 = 'Resources';
@@ -76,6 +80,7 @@ const UnableToLoadExtension = 'Unable to load extension';
76
80
  const UnableToLoadExtensionWithError = 'The extension details could not be loaded: {PH1}';
77
81
  const UnsupportedFeature = 'Unsupported Feature';
78
82
  const Version = 'Version';
83
+ const VsMarketplaceLink = 'VS Marketplace Link';
79
84
  const WebViews$1 = 'WebViews';
80
85
 
81
86
  const installation = () => {
@@ -96,6 +101,9 @@ const resources = () => {
96
101
  const copy = () => {
97
102
  return i18nString(Copy);
98
103
  };
104
+ const copyExtensionId$1 = () => {
105
+ return i18nString(CopyExtensionId);
106
+ };
99
107
  const copyImage$1 = () => {
100
108
  return i18nString(CopyImage);
101
109
  };
@@ -108,6 +116,9 @@ const changelog = () => {
108
116
  const details = () => {
109
117
  return i18nString(Details$1);
110
118
  };
119
+ const description = () => {
120
+ return i18nString(Description);
121
+ };
111
122
  const disable = () => {
112
123
  return i18nString(Disable$1);
113
124
  };
@@ -144,6 +155,9 @@ const setColorTheme$2 = () => {
144
155
  const enable = () => {
145
156
  return i18nString(Enable$1);
146
157
  };
158
+ const extensionInfoId = () => {
159
+ return i18nString(ExtensionInfoId);
160
+ };
147
161
  const extensionNotAvailable = extensionId => {
148
162
  return i18nString(ExtensionNotAvailable, {
149
163
  PH1: extensionId
@@ -253,9 +267,15 @@ const size = () => {
253
267
  const published = () => {
254
268
  return i18nString(Published);
255
269
  };
270
+ const publisher = () => {
271
+ return i18nString(Publisher);
272
+ };
256
273
  const lastReleased = () => {
257
274
  return i18nString(LastReleased);
258
275
  };
276
+ const vsMarketplaceLink = () => {
277
+ return i18nString(VsMarketplaceLink);
278
+ };
259
279
  const issues = () => {
260
280
  return i18nString(Issues);
261
281
  };
@@ -514,6 +534,7 @@ const RightArrow = 15;
514
534
 
515
535
  const Script$1 = 2;
516
536
 
537
+ const ManageExtension = 8;
517
538
  const ExtensionDetailReadme = 20;
518
539
  const ExtensionDetailIconContextMenu$2 = 4091;
519
540
 
@@ -852,6 +873,7 @@ const FeatureContent = 'FeatureContent';
852
873
  const Features$1 = 'Features';
853
874
  const FeaturesList = 'FeaturesList';
854
875
  const FeatureWebView = 'FeatureWebView';
876
+ const IconButton = 'IconButton';
855
877
  const Large$1 = 'Large';
856
878
  const Link$1 = 'Link';
857
879
  const Markdown = 'Markdown';
@@ -868,7 +890,7 @@ const Sash = 'Sash';
868
890
  const SashVertical = 'SashVertical';
869
891
  const ScrollToTopButton = 'ScrollToTopButton';
870
892
  const SettingsButton = 'SettingsButton';
871
- const SettingsIcon = 'SettingsIcon';
893
+ const MaskIconSettingsGear = 'MaskIconSettingsGear';
872
894
  const Small$1 = 'Small';
873
895
  const Table = 'Table';
874
896
  const TableCell = 'TableCell';
@@ -1070,6 +1092,8 @@ const getCellLinkVirtualDom = (value, props) => {
1070
1092
  childCount: 1,
1071
1093
  className: Link$1,
1072
1094
  href: props?.href,
1095
+ rel: 'noopener noreferrer',
1096
+ target: '_blank',
1073
1097
  type: A
1074
1098
  }, text(value)];
1075
1099
  };
@@ -3196,8 +3220,6 @@ const getMarkdownCacheKey = async (markdown, options) => {
3196
3220
  return `https://-/markdown/${hash}`;
3197
3221
  };
3198
3222
 
3199
- // TODO pass application name from renderer worker to not hardcode it
3200
-
3201
3223
  const cachedCaches = Object.create(null);
3202
3224
  const noopCache = {
3203
3225
  async match() {
@@ -3229,21 +3251,23 @@ const getCache = (cacheName, bucketName) => {
3229
3251
  return cachedCaches[cacheName];
3230
3252
  };
3231
3253
 
3232
- // TODO pass application name from renderer worker to not hardcode it
3233
- const cacheName$1 = 'lvce-editor/markdown-cache';
3234
- const has = async (key, bucketName) => {
3235
- const cache = await getCache(cacheName$1, bucketName);
3254
+ let cacheName$1 = '';
3255
+ const setApplicationName = applicationName => {
3256
+ cacheName$1 = `${applicationName}/markdown-cache`;
3257
+ };
3258
+ const has = async (key, bucketName, getCacheFunction = getCache) => {
3259
+ const cache = await getCacheFunction(cacheName$1, bucketName);
3236
3260
  const response = await cache.match(key);
3237
3261
  return Boolean(response);
3238
3262
  };
3239
- const get$2 = async (key, bucketName) => {
3240
- const cache = await getCache(cacheName$1, bucketName);
3263
+ const get$2 = async (key, bucketName, getCacheFunction = getCache) => {
3264
+ const cache = await getCacheFunction(cacheName$1, bucketName);
3241
3265
  const response = await cache.match(key);
3242
3266
  const text = await response?.text();
3243
3267
  return text || '';
3244
3268
  };
3245
- const set$4 = async (key, bucketName, value) => {
3246
- const cache = await getCache(cacheName$1, bucketName);
3269
+ const set$4 = async (key, bucketName, value, getCacheFunction = getCache) => {
3270
+ const cache = await getCacheFunction(cacheName$1, bucketName);
3247
3271
  await cache.put(key, new Response(value, {
3248
3272
  headers: {
3249
3273
  'Content-Length': `${value.length}`,
@@ -3747,6 +3771,54 @@ const writeText = async text => {
3747
3771
  await writeText$1(text);
3748
3772
  };
3749
3773
 
3774
+ const copyExtensionId = async state => {
3775
+ await writeText(state.extensionId);
3776
+ return state;
3777
+ };
3778
+
3779
+ const stringifyRow = ({
3780
+ key,
3781
+ value
3782
+ }) => {
3783
+ return `${key}: ${value}`;
3784
+ };
3785
+ const getExtensionInfoText = state => {
3786
+ const {
3787
+ description: description$1,
3788
+ extension,
3789
+ extensionId,
3790
+ extensionVersion,
3791
+ name: name$1
3792
+ } = state;
3793
+ const publisher$1 = extension?.publisherDisplayName || extension?.publisher || 'n/a';
3794
+ const marketplaceLink = typeof extension?.url === 'string' ? extension.url : '';
3795
+ const rows = [{
3796
+ key: name(),
3797
+ value: name$1
3798
+ }, {
3799
+ key: extensionInfoId(),
3800
+ value: extensionId
3801
+ }, {
3802
+ key: description(),
3803
+ value: description$1
3804
+ }, {
3805
+ key: version(),
3806
+ value: extensionVersion
3807
+ }, {
3808
+ key: publisher(),
3809
+ value: publisher$1
3810
+ }, ...(marketplaceLink ? [{
3811
+ key: vsMarketplaceLink(),
3812
+ value: marketplaceLink
3813
+ }] : [])];
3814
+ return rows.map(stringifyRow).join('\n');
3815
+ };
3816
+
3817
+ const copyExtensionInfo = async state => {
3818
+ await writeText(getExtensionInfoText(state));
3819
+ return state;
3820
+ };
3821
+
3750
3822
  const {
3751
3823
  exists,
3752
3824
  invoke,
@@ -3997,6 +4069,21 @@ const getMenuEntries2 = (state, props) => {
3997
4069
  if (props.menuId === ExtensionDetailIconContextMenu$2) {
3998
4070
  return getMenuEntriesImage();
3999
4071
  }
4072
+ if (props.menuId === ManageExtension) {
4073
+ return [{
4074
+ args: [],
4075
+ command: 'ExtensionDetail.copyExtensionInfo',
4076
+ flags: None$2,
4077
+ id: 'copy',
4078
+ label: copy()
4079
+ }, {
4080
+ args: [],
4081
+ command: 'ExtensionDetail.copyExtensionId',
4082
+ flags: None$2,
4083
+ id: 'copyExtensionId',
4084
+ label: copyExtensionId$1()
4085
+ }];
4086
+ }
4000
4087
  if (props.menuId === ExtensionDetailReadme && props.href) {
4001
4088
  return [{
4002
4089
  args: [props.href],
@@ -4065,7 +4152,7 @@ const getLinkMenuEntries = props => {
4065
4152
  const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
4066
4153
 
4067
4154
  const getMenuIds = () => {
4068
- return [ExtensionDetailReadme, ExtensionDetailIconContextMenu$2];
4155
+ return [ExtensionDetailReadme, ExtensionDetailIconContextMenu$2, ManageExtension];
4069
4156
  };
4070
4157
 
4071
4158
  const getMenuEntriesReadme = () => [{
@@ -4442,8 +4529,13 @@ const handleClickSetColorTheme = async state => {
4442
4529
  return state;
4443
4530
  };
4444
4531
 
4445
- const handleClickSettings = state => {
4446
- // TODO: Implement settings functionality
4532
+ const handleClickSettings = async (state, eventX, eventY) => {
4533
+ const {
4534
+ uid
4535
+ } = state;
4536
+ await show2(uid, ManageExtension, eventX, eventY, {
4537
+ menuId: ManageExtension
4538
+ });
4447
4539
  return state;
4448
4540
  };
4449
4541
 
@@ -5087,7 +5179,9 @@ const getSizeEntries = (showSizeLink, displaySize, extensionUri) => {
5087
5179
  return [];
5088
5180
  }
5089
5181
  return [{
5182
+ code: undefined,
5090
5183
  key: size(),
5184
+ odd: undefined,
5091
5185
  onClick: HandleClickSize,
5092
5186
  title: extensionUri,
5093
5187
  value: displaySize
@@ -5109,20 +5203,34 @@ const getInstallationEntries = (displaySize, extensionId, extensionVersion, exte
5109
5203
  const entries = [{
5110
5204
  code: true,
5111
5205
  key: identifier(),
5206
+ odd: undefined,
5207
+ onClick: undefined,
5208
+ title: undefined,
5112
5209
  value: extensionId
5113
5210
  }, {
5114
5211
  code: true,
5115
5212
  key: version(),
5213
+ odd: undefined,
5214
+ onClick: undefined,
5215
+ title: undefined,
5116
5216
  value: extensionVersion
5117
5217
  }];
5118
5218
  if (created$1 !== null) {
5119
5219
  entries.push({
5220
+ code: undefined,
5120
5221
  key: created(),
5222
+ odd: undefined,
5223
+ onClick: undefined,
5224
+ title: undefined,
5121
5225
  value: formatCreated(created$1)
5122
5226
  });
5123
5227
  }
5124
5228
  entries.push({
5229
+ code: undefined,
5125
5230
  key: lastUpdated(),
5231
+ odd: undefined,
5232
+ onClick: undefined,
5233
+ title: undefined,
5126
5234
  value: formatLastUpdated(lastUpdated$1)
5127
5235
  }, ...getSizeEntries(showSizeLink, displaySize, extensionUri));
5128
5236
  return addOddEntries(entries);
@@ -5133,11 +5241,18 @@ const getMarketplaceEntries = isBuiltin => {
5133
5241
  return [];
5134
5242
  }
5135
5243
  return [{
5244
+ code: undefined,
5136
5245
  key: published(),
5137
5246
  odd: true,
5247
+ onClick: undefined,
5248
+ title: undefined,
5138
5249
  value: 'n/a'
5139
5250
  }, {
5251
+ code: undefined,
5140
5252
  key: lastReleased(),
5253
+ odd: undefined,
5254
+ onClick: undefined,
5255
+ title: undefined,
5141
5256
  value: 'n/a'
5142
5257
  }];
5143
5258
  };
@@ -5467,6 +5582,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5467
5582
  scrollSource: Script,
5468
5583
  scrollToTopButtonEnabled: true,
5469
5584
  selectedTab,
5585
+ settingsButtonEnabled: true,
5470
5586
  showSideBar,
5471
5587
  showSizeLink,
5472
5588
  sideBarWidth,
@@ -6254,7 +6370,8 @@ const initializeMarkdownWorker = async () => {
6254
6370
  set$5(rpc);
6255
6371
  };
6256
6372
 
6257
- const initialize = async () => {
6373
+ const initialize = async applicationName => {
6374
+ setApplicationName(applicationName);
6258
6375
  // TODO load markdown worker only when needed
6259
6376
  await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker(), initializeClipBoardWorker()]);
6260
6377
  };
@@ -6275,8 +6392,11 @@ const openImageInNewTab = async state => {
6275
6392
  return state;
6276
6393
  };
6277
6394
 
6395
+ const mapEntry = ([key, value]) => {
6396
+ return ` --${key}: ${value}px;`;
6397
+ };
6278
6398
  const createCss = object => {
6279
- const inner = Object.entries(object).map(([key, value]) => ` --${key}: ${value}px;`).join('\n');
6399
+ const inner = Object.entries(object).map(mapEntry).join('\n');
6280
6400
  const full = `:root {\n${inner}\n}`;
6281
6401
  return full;
6282
6402
  };
@@ -6384,7 +6504,6 @@ const getExtraProps = (title, onClick) => {
6384
6504
  props.title = title;
6385
6505
  }
6386
6506
  if (onClick) {
6387
- props.style = 'color: var(--vscode-textLink-foreground, #3794ff); cursor: pointer; text-decoration: none';
6388
6507
  props.tabIndex = 0;
6389
6508
  }
6390
6509
  return props;
@@ -6681,17 +6800,18 @@ const getButtonVirtualDom = (message, onClick, name, onMouseEnter, onMouseLeave)
6681
6800
  };
6682
6801
 
6683
6802
  const settingsButtonNode = {
6803
+ ariaHasPopup: 'menu',
6804
+ ariaLabel: settings(),
6684
6805
  childCount: 1,
6685
- className: SettingsButton,
6806
+ className: mergeClassNames(IconButton, SettingsButton),
6686
6807
  name: Settings,
6687
6808
  onClick: HandleClickSettings,
6688
- title: 'Settings',
6809
+ title: settings(),
6689
6810
  type: Button$1
6690
6811
  };
6691
6812
  const settingsIconNode = {
6692
6813
  childCount: 0,
6693
- className: SettingsIcon,
6694
- text: '⚙️',
6814
+ className: mergeClassNames(MaskIcon, MaskIconSettingsGear),
6695
6815
  type: Span
6696
6816
  };
6697
6817
  const getSettingsButtonVirtualDom = enabled => {
@@ -7065,7 +7185,7 @@ const renderEventListeners = () => {
7065
7185
  preventDefault: true
7066
7186
  }, {
7067
7187
  name: HandleClickSettings,
7068
- params: ['handleClickSettings']
7188
+ params: ['handleClickSettings', ClientX, ClientY]
7069
7189
  }, {
7070
7190
  name: HandleReadmeClick,
7071
7191
  params: ['handleReadmeClick', 'event.target.nodeName', TargetHref],
@@ -7123,6 +7243,8 @@ const saveState = state => {
7123
7243
  };
7124
7244
 
7125
7245
  const commandMap = {
7246
+ 'ExtensionDetail.copyExtensionId': wrapCommand(copyExtensionId),
7247
+ 'ExtensionDetail.copyExtensionInfo': wrapCommand(copyExtensionInfo),
7126
7248
  'ExtensionDetail.copyImage': wrapCommand(copyImage),
7127
7249
  'ExtensionDetail.copyImageUrl': wrapCommand(copyImageUrl),
7128
7250
  'ExtensionDetail.copyReadmeLink': wrapCommand(copyReadmeLink),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "7.19.2",
3
+ "version": "7.20.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",