@lvce-editor/extension-detail-view 4.13.0 → 4.16.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.
@@ -321,7 +321,8 @@ const ClientX = 'event.clientX';
321
321
  const ClientY = 'event.clientY';
322
322
  const TargetHref = 'event.target.href';
323
323
  const TargetName = 'event.target.name';
324
- const TargetSrc = 'event.target.src';
324
+
325
+ const ExtensionDetailReadme = 20;
325
326
 
326
327
  const DebugWorker = 55;
327
328
  const ExtensionHostWorker = 44;
@@ -661,6 +662,18 @@ const getCommandsVirtualDom = state => {
661
662
  return getFeatureCommandsVirtualDom(state.commands);
662
663
  };
663
664
 
665
+ const existsJson = async schemaUrl => {
666
+ try {
667
+ // TODO verify that response header is json
668
+ const response = await fetch(schemaUrl, {
669
+ method: 'HEAD'
670
+ });
671
+ return response.ok;
672
+ } catch {
673
+ return false;
674
+ }
675
+ };
676
+
664
677
  const isExternalLink$1 = schema => {
665
678
  return schema.startsWith('http://') || schema.startsWith('https://');
666
679
  };
@@ -721,17 +734,6 @@ const getSchemaLinkUrl = (schema, extensionUri) => {
721
734
  }
722
735
  };
723
736
 
724
- const existsJson = async schemaUrl => {
725
- try {
726
- // TODO verify that response header is json
727
- const response = await fetch(schemaUrl, {
728
- method: 'HEAD'
729
- });
730
- return response.ok;
731
- } catch {
732
- return false;
733
- }
734
- };
735
737
  const getJsonValidationInfos = async (extensionUri, validations) => {
736
738
  const validationInfos = [];
737
739
  for (const validation of validations) {
@@ -757,6 +759,7 @@ const getJsonValidationInfos = async (extensionUri, validations) => {
757
759
  fileMatch
758
760
  });
759
761
  } else if (schemaLinkUrl) {
762
+ // TODO maybe better use filesystem.exists
760
763
  if (await existsJson(schemaLinkUrl)) {
761
764
  validationInfos.push({
762
765
  isValid: true,
@@ -2083,7 +2086,7 @@ const getRuntimeStatus$2 = async extensionId => {
2083
2086
  // @ts-ignore
2084
2087
  return invoke$4('ExtensionHost.getRuntimeStatus', extensionId);
2085
2088
  };
2086
- const registerMockRpc$1 = commandMap => {
2089
+ const registerMockRpc$3 = commandMap => {
2087
2090
  const mockRpc = createMockRpc({
2088
2091
  commandMap
2089
2092
  });
@@ -2099,7 +2102,7 @@ const ExtensionHost = {
2099
2102
  getRuntimeStatus: getRuntimeStatus$2,
2100
2103
  invoke: invoke$4,
2101
2104
  invokeAndTransfer: invokeAndTransfer$3,
2102
- registerMockRpc: registerMockRpc$1,
2105
+ registerMockRpc: registerMockRpc$3,
2103
2106
  set: set$9
2104
2107
  };
2105
2108
 
@@ -2159,6 +2162,13 @@ const appendFile = async (uri, text) => {
2159
2162
  // @ts-ignore
2160
2163
  return invoke$3('FileSystem.appendFile', uri, text);
2161
2164
  };
2165
+ const registerMockRpc$2 = commandMap => {
2166
+ const mockRpc = createMockRpc({
2167
+ commandMap
2168
+ });
2169
+ set$8(mockRpc);
2170
+ return mockRpc;
2171
+ };
2162
2172
 
2163
2173
  const FileSystemWorker = {
2164
2174
  __proto__: null,
@@ -2176,6 +2186,7 @@ const FileSystemWorker = {
2176
2186
  readDirWithFileTypes,
2177
2187
  readFile: readFile$3,
2178
2188
  readFileAsBlob: readFileAsBlob$1,
2189
+ registerMockRpc: registerMockRpc$2,
2179
2190
  remove,
2180
2191
  rename,
2181
2192
  set: set$8,
@@ -2197,6 +2208,13 @@ const render$1 = async (markdown, options) => {
2197
2208
  // @ts-ignore
2198
2209
  return invoke$2('Markdown.render', markdown, options);
2199
2210
  };
2211
+ const registerMockRpc$1 = commandMap => {
2212
+ const mockRpc = createMockRpc({
2213
+ commandMap
2214
+ });
2215
+ set$7(mockRpc);
2216
+ return mockRpc;
2217
+ };
2200
2218
 
2201
2219
  const MarkdownWorker = {
2202
2220
  __proto__: null,
@@ -2204,6 +2222,7 @@ const MarkdownWorker = {
2204
2222
  getVirtualDom: getVirtualDom$1,
2205
2223
  invoke: invoke$2,
2206
2224
  invokeAndTransfer: invokeAndTransfer$1,
2225
+ registerMockRpc: registerMockRpc$1,
2207
2226
  render: render$1,
2208
2227
  set: set$7
2209
2228
  };
@@ -2795,11 +2814,12 @@ const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
2795
2814
  }];
2796
2815
  };
2797
2816
 
2817
+ /* eslint-disable unicorn/prefer-export-from */
2818
+
2798
2819
  const {
2799
2820
  set: set$4,
2800
2821
  getVirtualDom,
2801
- render
2802
- } = MarkdownWorker;
2822
+ render} = MarkdownWorker;
2803
2823
 
2804
2824
  const getMarkdownVirtualDom = async (html, options) => {
2805
2825
  string(html);
@@ -3251,6 +3271,8 @@ const terminate = () => {
3251
3271
  globalThis.close();
3252
3272
  };
3253
3273
 
3274
+ /* eslint-disable unicorn/prefer-export-from */
3275
+
3254
3276
  const {
3255
3277
  disableExtension: disableExtension$1,
3256
3278
  enableExtension: enableExtension$1,
@@ -3268,8 +3290,7 @@ const {
3268
3290
  showContextMenu,
3269
3291
  uninstallExtension,
3270
3292
  writeClipBoardImage,
3271
- writeClipBoardText
3272
- } = RendererWorker;
3293
+ writeClipBoardText} = RendererWorker;
3273
3294
 
3274
3295
  const writeClipboardImage = async blob => {
3275
3296
  await writeClipBoardImage(blob);
@@ -3278,12 +3299,13 @@ const writeText = async text => {
3278
3299
  await writeClipBoardText(text);
3279
3300
  };
3280
3301
 
3302
+ /* eslint-disable unicorn/prefer-export-from */
3303
+
3281
3304
  const {
3282
3305
  set: set$1,
3283
3306
  exists,
3284
3307
  readFile: readFile$1,
3285
- invoke
3286
- } = FileSystemWorker;
3308
+ invoke} = FileSystemWorker;
3287
3309
  const readFileAsBlob = async uri => {
3288
3310
  // TODO maybe readAsObjectUrl?
3289
3311
  // @ts-ignore
@@ -3774,6 +3796,12 @@ const handleReadmeClick = async (state, nodeName, href) => {
3774
3796
  return state;
3775
3797
  };
3776
3798
 
3799
+ const handleReadmeContextMenu = async (state, x, y, nodeName, href) => {
3800
+ await show(ExtensionDetailReadme, x, y);
3801
+ // TODO
3802
+ return state;
3803
+ };
3804
+
3777
3805
  const handleScroll = (state, scrollTop, scrollSource = Script) => {
3778
3806
  const newScrollTop = Math.max(0, scrollTop);
3779
3807
  return {
@@ -5168,7 +5196,7 @@ const renderEventListeners = () => {
5168
5196
  params: ['handleIconError']
5169
5197
  }, {
5170
5198
  name: HandleReadmeContextMenu,
5171
- params: ['handleReadmeContextMenu', ClientX, ClientY, TargetHref, TargetSrc]
5199
+ params: ['handleReadmeContextMenu', ClientX, ClientY, 'event.target.nodeName', TargetHref]
5172
5200
  }, {
5173
5201
  name: HandleImageContextMenu,
5174
5202
  params: ['handleImageContextMenu', ClientX, ClientY],
@@ -5248,6 +5276,7 @@ const commandMap = {
5248
5276
  'ExtensionDetail.getMenuEntries': getMenuEntries,
5249
5277
  'ExtensionDetail.getMenus': getMenus,
5250
5278
  'ExtensionDetail.handleClickCategory': wrapCommand(handleClickCategory),
5279
+ 'ExtensionDetail.handleReadmeContextMenu': wrapCommand(handleReadmeContextMenu),
5251
5280
  'ExtensionDetail.handleAdditionalDetailsContextMenu': wrapCommand(handleAdditionalDetailContextMenu),
5252
5281
  'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
5253
5282
  'ExtensionDetail.handleClickEnable': wrapCommand(handleClickEnable),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "4.13.0",
3
+ "version": "4.16.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.28.0"
14
+ "@lvce-editor/constants": "^1.29.0"
15
15
  }
16
16
  }