@lvce-editor/extension-detail-view 7.19.2 → 7.21.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
  };
@@ -1181,12 +1205,26 @@ const existsJson = async schemaUrl => {
1181
1205
  const isExternalLink$2 = schema => {
1182
1206
  return schema.startsWith('http://') || schema.startsWith('https://');
1183
1207
  };
1208
+ const isAlphanumeric = char => {
1209
+ const code = char.codePointAt(0) || 0;
1210
+ return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
1211
+ };
1184
1212
  const hasWhitespace = value => {
1185
- return /\s/.test(value);
1213
+ for (const char of value) {
1214
+ if (char.trim() === '') {
1215
+ return true;
1216
+ }
1217
+ }
1218
+ return false;
1186
1219
  };
1187
1220
  const isOnlyDotsOrEmpty = value => {
1188
1221
  const trimmed = value.trim();
1189
- return trimmed === '' || /^\.*$/.test(trimmed);
1222
+ for (const char of trimmed) {
1223
+ if (char !== '.') {
1224
+ return false;
1225
+ }
1226
+ }
1227
+ return true;
1190
1228
  };
1191
1229
  const isValidHttpUrl = value => {
1192
1230
  try {
@@ -1208,11 +1246,17 @@ const isValidRelativePath = value => {
1208
1246
  return false;
1209
1247
  }
1210
1248
  // Allow paths like ./a.json, ../a.json, /a.json, schemas/a.json, a/b.json
1211
- if (!/^[./]?[A-Za-z0-9._\-/]+$/.test(value)) {
1212
- return false;
1249
+ let hasAlphanumeric = false;
1250
+ for (const char of value) {
1251
+ if (!isAlphanumeric(char) && char !== '.' && char !== '_' && char !== '-' && char !== '/') {
1252
+ return false;
1253
+ }
1254
+ if (isAlphanumeric(char)) {
1255
+ hasAlphanumeric = true;
1256
+ }
1213
1257
  }
1214
1258
  // Must contain at least one alphanumeric character
1215
- return !!/[A-Za-z0-9]/.test(value);
1259
+ return hasAlphanumeric;
1216
1260
  };
1217
1261
  const getSchemaLinkUrl = (schema, extensionUri) => {
1218
1262
  if (!schema || typeof schema !== 'string') {
@@ -3196,8 +3240,6 @@ const getMarkdownCacheKey = async (markdown, options) => {
3196
3240
  return `https://-/markdown/${hash}`;
3197
3241
  };
3198
3242
 
3199
- // TODO pass application name from renderer worker to not hardcode it
3200
-
3201
3243
  const cachedCaches = Object.create(null);
3202
3244
  const noopCache = {
3203
3245
  async match() {
@@ -3229,21 +3271,23 @@ const getCache = (cacheName, bucketName) => {
3229
3271
  return cachedCaches[cacheName];
3230
3272
  };
3231
3273
 
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);
3274
+ let cacheName$1 = '';
3275
+ const setApplicationName = applicationName => {
3276
+ cacheName$1 = `${applicationName}/markdown-cache`;
3277
+ };
3278
+ const has = async (key, bucketName, getCacheFunction = getCache) => {
3279
+ const cache = await getCacheFunction(cacheName$1, bucketName);
3236
3280
  const response = await cache.match(key);
3237
3281
  return Boolean(response);
3238
3282
  };
3239
- const get$2 = async (key, bucketName) => {
3240
- const cache = await getCache(cacheName$1, bucketName);
3283
+ const get$2 = async (key, bucketName, getCacheFunction = getCache) => {
3284
+ const cache = await getCacheFunction(cacheName$1, bucketName);
3241
3285
  const response = await cache.match(key);
3242
3286
  const text = await response?.text();
3243
3287
  return text || '';
3244
3288
  };
3245
- const set$4 = async (key, bucketName, value) => {
3246
- const cache = await getCache(cacheName$1, bucketName);
3289
+ const set$4 = async (key, bucketName, value, getCacheFunction = getCache) => {
3290
+ const cache = await getCacheFunction(cacheName$1, bucketName);
3247
3291
  await cache.put(key, new Response(value, {
3248
3292
  headers: {
3249
3293
  'Content-Length': `${value.length}`,
@@ -3747,6 +3791,57 @@ const writeText = async text => {
3747
3791
  await writeText$1(text);
3748
3792
  };
3749
3793
 
3794
+ const copyExtensionId = async state => {
3795
+ const {
3796
+ extensionId
3797
+ } = state;
3798
+ await writeText(extensionId);
3799
+ return state;
3800
+ };
3801
+
3802
+ const stringifyRow = ({
3803
+ key,
3804
+ value
3805
+ }) => {
3806
+ return `${key}: ${value}`;
3807
+ };
3808
+ const getExtensionInfoText = state => {
3809
+ const {
3810
+ description: description$1,
3811
+ extension,
3812
+ extensionId,
3813
+ extensionVersion,
3814
+ name: name$1
3815
+ } = state;
3816
+ const publisher$1 = extension?.publisherDisplayName || extension?.publisher || 'n/a';
3817
+ const marketplaceLink = typeof extension?.url === 'string' ? extension.url : '';
3818
+ const rows = [{
3819
+ key: name(),
3820
+ value: name$1
3821
+ }, {
3822
+ key: extensionInfoId(),
3823
+ value: extensionId
3824
+ }, {
3825
+ key: description(),
3826
+ value: description$1
3827
+ }, {
3828
+ key: version(),
3829
+ value: extensionVersion
3830
+ }, {
3831
+ key: publisher(),
3832
+ value: publisher$1
3833
+ }, ...(marketplaceLink ? [{
3834
+ key: vsMarketplaceLink(),
3835
+ value: marketplaceLink
3836
+ }] : [])];
3837
+ return rows.map(stringifyRow).join('\n');
3838
+ };
3839
+
3840
+ const copyExtensionInfo = async state => {
3841
+ await writeText(getExtensionInfoText(state));
3842
+ return state;
3843
+ };
3844
+
3750
3845
  const {
3751
3846
  exists,
3752
3847
  invoke,
@@ -3997,6 +4092,21 @@ const getMenuEntries2 = (state, props) => {
3997
4092
  if (props.menuId === ExtensionDetailIconContextMenu$2) {
3998
4093
  return getMenuEntriesImage();
3999
4094
  }
4095
+ if (props.menuId === ManageExtension) {
4096
+ return [{
4097
+ args: [],
4098
+ command: 'ExtensionDetail.copyExtensionInfo',
4099
+ flags: None$2,
4100
+ id: 'copy',
4101
+ label: copy()
4102
+ }, {
4103
+ args: [],
4104
+ command: 'ExtensionDetail.copyExtensionId',
4105
+ flags: None$2,
4106
+ id: 'copyExtensionId',
4107
+ label: copyExtensionId$1()
4108
+ }];
4109
+ }
4000
4110
  if (props.menuId === ExtensionDetailReadme && props.href) {
4001
4111
  return [{
4002
4112
  args: [props.href],
@@ -4065,7 +4175,7 @@ const getLinkMenuEntries = props => {
4065
4175
  const getMenuEntries = props => [...getLinkMenuEntries(props), ...getImageMenuEntries(props), getCopyMenuEntry()];
4066
4176
 
4067
4177
  const getMenuIds = () => {
4068
- return [ExtensionDetailReadme, ExtensionDetailIconContextMenu$2];
4178
+ return [ExtensionDetailReadme, ExtensionDetailIconContextMenu$2, ManageExtension];
4069
4179
  };
4070
4180
 
4071
4181
  const getMenuEntriesReadme = () => [{
@@ -4395,8 +4505,13 @@ const handleClickFeatures = async (state, name) => {
4395
4505
  };
4396
4506
 
4397
4507
  const handleClickScrollToTop = state => {
4398
- if (state.selectedTab === Changelog) {
4399
- if (state.changelogScrollTop === 0) {
4508
+ const {
4509
+ changelogScrollTop,
4510
+ readmeScrollTop,
4511
+ selectedTab
4512
+ } = state;
4513
+ if (selectedTab === Changelog) {
4514
+ if (changelogScrollTop === 0) {
4400
4515
  return state;
4401
4516
  }
4402
4517
  return {
@@ -4404,9 +4519,6 @@ const handleClickScrollToTop = state => {
4404
4519
  changelogScrollTop: 0
4405
4520
  };
4406
4521
  }
4407
- const {
4408
- readmeScrollTop
4409
- } = state;
4410
4522
  if (readmeScrollTop === 0) {
4411
4523
  return state;
4412
4524
  }
@@ -4422,7 +4534,9 @@ const setColorTheme = id => {
4422
4534
 
4423
4535
  const handleClickSetColorTheme = async state => {
4424
4536
  const {
4425
- extension
4537
+ disabled,
4538
+ extension,
4539
+ hasColorTheme
4426
4540
  } = state;
4427
4541
  const colorThemeId = getColorThemeId(extension);
4428
4542
  if (colorThemeId) {
@@ -4432,7 +4546,7 @@ const handleClickSetColorTheme = async state => {
4432
4546
  }
4433
4547
  const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
4434
4548
  const colorThemeLabel = getColorThemeLabel(extension) || '';
4435
- const buttons = getExtensionDetailButtons(state.hasColorTheme, isBuiltin, state.disabled, colorThemeId, colorThemeLabel, colorThemeId);
4549
+ const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, colorThemeId, colorThemeLabel, colorThemeId);
4436
4550
  return {
4437
4551
  ...state,
4438
4552
  buttons,
@@ -4442,36 +4556,48 @@ const handleClickSetColorTheme = async state => {
4442
4556
  return state;
4443
4557
  };
4444
4558
 
4445
- const handleClickSettings = state => {
4446
- // TODO: Implement settings functionality
4559
+ const handleClickSettings = async (state, eventX, eventY) => {
4560
+ const {
4561
+ uid
4562
+ } = state;
4563
+ await show2(uid, ManageExtension, eventX, eventY, {
4564
+ menuId: ManageExtension
4565
+ });
4447
4566
  return state;
4448
4567
  };
4449
4568
 
4450
4569
  const handleClickSize = async state => {
4570
+ const {
4571
+ extension
4572
+ } = state;
4451
4573
  const {
4452
4574
  uri
4453
- } = state.extension;
4575
+ } = extension;
4454
4576
  await openNativeFolder(uri);
4455
4577
  return state;
4456
4578
  };
4457
4579
 
4458
4580
  const handleClickUninstall = async state => {
4581
+ const {
4582
+ extension
4583
+ } = state;
4459
4584
  const {
4460
4585
  id
4461
- } = state.extension;
4586
+ } = extension;
4462
4587
  await uninstallExtension(id);
4463
4588
  return state;
4464
4589
  };
4465
4590
 
4466
4591
  const handleColorThemeChanged = (state, colorThemeId) => {
4467
- if (state.currentColorThemeId === colorThemeId) {
4468
- return state;
4469
- }
4470
4592
  const {
4593
+ currentColorThemeId,
4471
4594
  disabled,
4472
4595
  extension,
4473
4596
  hasColorTheme
4474
4597
  } = state;
4598
+ if (currentColorThemeId === colorThemeId) {
4599
+ return state;
4600
+ }
4475
4601
  const extensionColorThemeId = getColorThemeId(extension) || '';
4476
4602
  const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
4477
4603
  const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
@@ -4580,6 +4706,12 @@ const getExtensionUri = (uri, platform, origin) => {
4580
4706
  };
4581
4707
 
4582
4708
  const segmentRegex = /^[\w.-]+$/;
4709
+ const removeGitPrefix = value => {
4710
+ return value.startsWith('git+') ? value.slice(4) : value;
4711
+ };
4712
+ const removeGitSuffix = value => {
4713
+ return value.toLowerCase().endsWith('.git') ? value.slice(0, -4) : value;
4714
+ };
4583
4715
  const getRepositoryUrl = extension => {
4584
4716
  if (!extension || !hasProperty(extension, 'repository')) {
4585
4717
  return '';
@@ -4596,7 +4728,7 @@ const getRepositoryUrl = extension => {
4596
4728
  return '';
4597
4729
  };
4598
4730
  const getGithubRepository = extension => {
4599
- const rawUrl = getRepositoryUrl(extension).replace(/^git\+/, '');
4731
+ const rawUrl = removeGitPrefix(getRepositoryUrl(extension));
4600
4732
  try {
4601
4733
  const url = new URL(rawUrl);
4602
4734
  if (url.protocol !== 'https:' || url.hostname.toLowerCase() !== 'github.com' || url.username || url.password || url.port) {
@@ -4607,7 +4739,7 @@ const getGithubRepository = extension => {
4607
4739
  return undefined;
4608
4740
  }
4609
4741
  const owner = segments[0];
4610
- const repository = segments[1].replace(/\.git$/i, '');
4742
+ const repository = removeGitSuffix(segments[1]);
4611
4743
  if (!owner || !repository || !segmentRegex.test(owner) || !segmentRegex.test(repository)) {
4612
4744
  return undefined;
4613
4745
  }
@@ -4675,9 +4807,15 @@ const toSyntaxLanguage = value => {
4675
4807
  if (typeof language.id !== 'string' || typeof language.tokenize !== 'string') {
4676
4808
  return undefined;
4677
4809
  }
4810
+ const aliases = getStringArray(language.aliases);
4811
+ const extensions = getStringArray(language.extensions);
4678
4812
  return {
4679
- aliases: getStringArray(language.aliases),
4680
- extensions: getStringArray(language.extensions),
4813
+ ...(aliases && {
4814
+ aliases
4815
+ }),
4816
+ ...(extensions && {
4817
+ extensions
4818
+ }),
4681
4819
  id: language.id,
4682
4820
  tokenize: language.tokenize
4683
4821
  };
@@ -5087,7 +5225,9 @@ const getSizeEntries = (showSizeLink, displaySize, extensionUri) => {
5087
5225
  return [];
5088
5226
  }
5089
5227
  return [{
5228
+ code: undefined,
5090
5229
  key: size(),
5230
+ odd: undefined,
5091
5231
  onClick: HandleClickSize,
5092
5232
  title: extensionUri,
5093
5233
  value: displaySize
@@ -5109,20 +5249,34 @@ const getInstallationEntries = (displaySize, extensionId, extensionVersion, exte
5109
5249
  const entries = [{
5110
5250
  code: true,
5111
5251
  key: identifier(),
5252
+ odd: undefined,
5253
+ onClick: undefined,
5254
+ title: undefined,
5112
5255
  value: extensionId
5113
5256
  }, {
5114
5257
  code: true,
5115
5258
  key: version(),
5259
+ odd: undefined,
5260
+ onClick: undefined,
5261
+ title: undefined,
5116
5262
  value: extensionVersion
5117
5263
  }];
5118
5264
  if (created$1 !== null) {
5119
5265
  entries.push({
5266
+ code: undefined,
5120
5267
  key: created(),
5268
+ odd: undefined,
5269
+ onClick: undefined,
5270
+ title: undefined,
5121
5271
  value: formatCreated(created$1)
5122
5272
  });
5123
5273
  }
5124
5274
  entries.push({
5275
+ code: undefined,
5125
5276
  key: lastUpdated(),
5277
+ odd: undefined,
5278
+ onClick: undefined,
5279
+ title: undefined,
5126
5280
  value: formatLastUpdated(lastUpdated$1)
5127
5281
  }, ...getSizeEntries(showSizeLink, displaySize, extensionUri));
5128
5282
  return addOddEntries(entries);
@@ -5133,11 +5287,18 @@ const getMarketplaceEntries = isBuiltin => {
5133
5287
  return [];
5134
5288
  }
5135
5289
  return [{
5290
+ code: undefined,
5136
5291
  key: published(),
5137
5292
  odd: true,
5293
+ onClick: undefined,
5294
+ title: undefined,
5138
5295
  value: 'n/a'
5139
5296
  }, {
5297
+ code: undefined,
5140
5298
  key: lastReleased(),
5299
+ odd: undefined,
5300
+ onClick: undefined,
5301
+ title: undefined,
5141
5302
  value: 'n/a'
5142
5303
  }];
5143
5304
  };
@@ -5186,13 +5347,20 @@ const getIssuesLink = extension => {
5186
5347
  const isGitHubRepository = url => {
5187
5348
  return url.startsWith('https://github.com/');
5188
5349
  };
5350
+ const removeTrailingSlashes = value => {
5351
+ let end = value.length;
5352
+ while (end > 0 && value[end - 1] === '/') {
5353
+ end--;
5354
+ }
5355
+ return value.slice(0, end);
5356
+ };
5189
5357
  const getLicenseLink = extension => {
5190
5358
  const repositoryLink = getRepositoryLink(extension);
5191
5359
  if (!repositoryLink) {
5192
5360
  return '#';
5193
5361
  }
5194
5362
  if (isGitHubRepository(repositoryLink)) {
5195
- const normalizedLink = repositoryLink.replace(/\/+$/, '');
5363
+ const normalizedLink = removeTrailingSlashes(repositoryLink);
5196
5364
  return `${normalizedLink}/blob/main/LICENSE`;
5197
5365
  }
5198
5366
  return '#';
@@ -5346,6 +5514,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5346
5514
  savedState = undefined;
5347
5515
  }
5348
5516
  const {
5517
+ assetDir,
5349
5518
  uri,
5350
5519
  width
5351
5520
  } = state;
@@ -5356,7 +5525,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5356
5525
  }
5357
5526
  const currentColorThemeId = await getCurrentColorTheme();
5358
5527
  const commit = await getCommit();
5359
- const languages = await getSyntaxLanguages(platform, state.assetDir);
5528
+ const languages = await getSyntaxLanguages(platform, assetDir);
5360
5529
  const headerData = loadHeaderContent(state, platform, extension);
5361
5530
  const {
5362
5531
  badge,
@@ -5467,6 +5636,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5467
5636
  scrollSource: Script,
5468
5637
  scrollToTopButtonEnabled: true,
5469
5638
  selectedTab,
5639
+ settingsButtonEnabled: true,
5470
5640
  showSideBar,
5471
5641
  showSizeLink,
5472
5642
  sideBarWidth,
@@ -5476,10 +5646,13 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5476
5646
  };
5477
5647
  };
5478
5648
  const loadContent = async (state, platform, savedState, isTest = false) => {
5649
+ const {
5650
+ uri
5651
+ } = state;
5479
5652
  try {
5480
5653
  return await loadContentInternal(state, platform, savedState, isTest);
5481
5654
  } catch (error) {
5482
- const extensionId = getExtensionIdFromUri(state.uri);
5655
+ const extensionId = getExtensionIdFromUri(uri);
5483
5656
  const errorMessage = error instanceof ExtensionNotFoundError ? extensionNotAvailable(extensionId) : unableToLoadExtensionWithError(getErrorMessage$1(error));
5484
5657
  return {
5485
5658
  ...state,
@@ -5573,9 +5746,13 @@ const replaceMarkdownImageWithError = (dom, failedSrc) => {
5573
5746
  };
5574
5747
 
5575
5748
  const handleMarkdownImageError = (state, failedSrc) => {
5576
- const detailsVirtualDom = replaceMarkdownImageWithError(state.detailsVirtualDom, failedSrc);
5577
- const changelogVirtualDom = replaceMarkdownImageWithError(state.changelogVirtualDom, failedSrc);
5578
- if (detailsVirtualDom === state.detailsVirtualDom && changelogVirtualDom === state.changelogVirtualDom) {
5749
+ const {
5750
+ changelogVirtualDom: oldChangelogVirtualDom,
5751
+ detailsVirtualDom: oldDetailsVirtualDom
5752
+ } = state;
5753
+ const detailsVirtualDom = replaceMarkdownImageWithError(oldDetailsVirtualDom, failedSrc);
5754
+ const changelogVirtualDom = replaceMarkdownImageWithError(oldChangelogVirtualDom, failedSrc);
5755
+ if (detailsVirtualDom === oldDetailsVirtualDom && changelogVirtualDom === oldChangelogVirtualDom) {
5579
5756
  return state;
5580
5757
  }
5581
5758
  return {
@@ -5593,7 +5770,10 @@ const disablePreviewColorTheme = async () => {
5593
5770
  };
5594
5771
 
5595
5772
  const handleMouseEnterEnable = async state => {
5596
- const colorThemeId = getColorThemeId(state.extension);
5773
+ const {
5774
+ extension
5775
+ } = state;
5776
+ const colorThemeId = getColorThemeId(extension);
5597
5777
  if (!colorThemeId) {
5598
5778
  return state;
5599
5779
  }
@@ -5688,8 +5868,11 @@ const handleResourceLinkClick = async (state, href) => {
5688
5868
  };
5689
5869
 
5690
5870
  const handleScroll = (state, scrollTop, scrollSource = Script) => {
5871
+ const {
5872
+ selectedTab
5873
+ } = state;
5691
5874
  const newScrollTop = Math.max(0, scrollTop);
5692
- if (state.selectedTab === Changelog) {
5875
+ if (selectedTab === Changelog) {
5693
5876
  return {
5694
5877
  ...state,
5695
5878
  changelogScrollTop: newScrollTop,
@@ -5841,7 +6024,7 @@ const getErrorMessage = async response => {
5841
6024
  const getHttpError = async response => {
5842
6025
  const apiMessage = await getErrorMessage(response);
5843
6026
  const rateLimitRemaining = response.headers.get('x-ratelimit-remaining');
5844
- if (response.status === 429 || response.status === 403 && (rateLimitRemaining === '0' || /rate limit/i.test(apiMessage))) {
6027
+ if (response.status === 429 || response.status === 403 && (rateLimitRemaining === '0' || apiMessage.toLowerCase().includes('rate limit'))) {
5845
6028
  const resetValue = Number(response.headers.get('x-ratelimit-reset'));
5846
6029
  const retry = Number.isFinite(resetValue) && resetValue > 0 ? ` Try again after ${new Date(resetValue * 1000).toLocaleString()}.` : ' Please try again later.';
5847
6030
  return new GithubReleasesError(`GitHub API rate limit exceeded.${retry}`);
@@ -6254,13 +6437,17 @@ const initializeMarkdownWorker = async () => {
6254
6437
  set$5(rpc);
6255
6438
  };
6256
6439
 
6257
- const initialize = async () => {
6440
+ const initialize = async applicationName => {
6441
+ setApplicationName(applicationName);
6258
6442
  // TODO load markdown worker only when needed
6259
6443
  await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker(), initializeClipBoardWorker()]);
6260
6444
  };
6261
6445
 
6262
6446
  const loadContent2 = async (state, savedState, isTest = false) => {
6263
- return loadContent(state, state.platform, savedState, isTest);
6447
+ const {
6448
+ platform
6449
+ } = state;
6450
+ return loadContent(state, platform, savedState, isTest);
6264
6451
  };
6265
6452
 
6266
6453
  const openImageInNewTab = async state => {
@@ -6275,8 +6462,11 @@ const openImageInNewTab = async state => {
6275
6462
  return state;
6276
6463
  };
6277
6464
 
6465
+ const mapEntry = ([key, value]) => {
6466
+ return ` --${key}: ${value}px;`;
6467
+ };
6278
6468
  const createCss = object => {
6279
- const inner = Object.entries(object).map(([key, value]) => ` --${key}: ${value}px;`).join('\n');
6469
+ const inner = Object.entries(object).map(mapEntry).join('\n');
6280
6470
  const full = `:root {\n${inner}\n}`;
6281
6471
  return full;
6282
6472
  };
@@ -6384,7 +6574,6 @@ const getExtraProps = (title, onClick) => {
6384
6574
  props.title = title;
6385
6575
  }
6386
6576
  if (onClick) {
6387
- props.style = 'color: var(--vscode-textLink-foreground, #3794ff); cursor: pointer; text-decoration: none';
6388
6577
  props.tabIndex = 0;
6389
6578
  }
6390
6579
  return props;
@@ -6681,17 +6870,18 @@ const getButtonVirtualDom = (message, onClick, name, onMouseEnter, onMouseLeave)
6681
6870
  };
6682
6871
 
6683
6872
  const settingsButtonNode = {
6873
+ ariaHasPopup: 'menu',
6874
+ ariaLabel: settings(),
6684
6875
  childCount: 1,
6685
- className: SettingsButton,
6876
+ className: mergeClassNames(IconButton, SettingsButton),
6686
6877
  name: Settings,
6687
6878
  onClick: HandleClickSettings,
6688
- title: 'Settings',
6879
+ title: settings(),
6689
6880
  type: Button$1
6690
6881
  };
6691
6882
  const settingsIconNode = {
6692
6883
  childCount: 0,
6693
- className: SettingsIcon,
6694
- text: '⚙️',
6884
+ className: mergeClassNames(MaskIcon, MaskIconSettingsGear),
6695
6885
  type: Span
6696
6886
  };
6697
6887
  const getSettingsButtonVirtualDom = enabled => {
@@ -7065,7 +7255,7 @@ const renderEventListeners = () => {
7065
7255
  preventDefault: true
7066
7256
  }, {
7067
7257
  name: HandleClickSettings,
7068
- params: ['handleClickSettings']
7258
+ params: ['handleClickSettings', ClientX, ClientY]
7069
7259
  }, {
7070
7260
  name: HandleReadmeClick,
7071
7261
  params: ['handleReadmeClick', 'event.target.nodeName', TargetHref],
@@ -7090,7 +7280,10 @@ const renderEventListeners = () => {
7090
7280
  };
7091
7281
 
7092
7282
  const renderTitle = state => {
7093
- return state.name;
7283
+ const {
7284
+ name
7285
+ } = state;
7286
+ return name;
7094
7287
  };
7095
7288
 
7096
7289
  const resize = (state, dimensions) => {
@@ -7123,6 +7316,8 @@ const saveState = state => {
7123
7316
  };
7124
7317
 
7125
7318
  const commandMap = {
7319
+ 'ExtensionDetail.copyExtensionId': wrapCommand(copyExtensionId),
7320
+ 'ExtensionDetail.copyExtensionInfo': wrapCommand(copyExtensionInfo),
7126
7321
  'ExtensionDetail.copyImage': wrapCommand(copyImage),
7127
7322
  'ExtensionDetail.copyImageUrl': wrapCommand(copyImageUrl),
7128
7323
  '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.21.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",