@lvce-editor/extension-detail-view 3.46.0 → 3.47.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.
@@ -2042,8 +2042,13 @@ const WebWorkerRpcClient = {
2042
2042
  create: create$2
2043
2043
  };
2044
2044
 
2045
+ const toCommandId = key => {
2046
+ const dotIndex = key.indexOf('.');
2047
+ return key.slice(dotIndex + 1);
2048
+ };
2045
2049
  const create$1 = () => {
2046
2050
  const states = Object.create(null);
2051
+ const commandMapRef = {};
2047
2052
  return {
2048
2053
  get(uid) {
2049
2054
  return states[uid];
@@ -2084,6 +2089,15 @@ const create$1 = () => {
2084
2089
  };
2085
2090
  return wrapped;
2086
2091
  },
2092
+ wrapGetter(fn) {
2093
+ const wrapped = (uid, ...args) => {
2094
+ const {
2095
+ newState
2096
+ } = states[uid];
2097
+ return fn(newState, ...args);
2098
+ };
2099
+ return wrapped;
2100
+ },
2087
2101
  diff(uid, modules, numbers) {
2088
2102
  const {
2089
2103
  oldState,
@@ -2097,6 +2111,14 @@ const create$1 = () => {
2097
2111
  }
2098
2112
  }
2099
2113
  return diffResult;
2114
+ },
2115
+ getCommandIds() {
2116
+ const keys = Object.keys(commandMapRef);
2117
+ const ids = keys.map(toCommandId);
2118
+ return ids;
2119
+ },
2120
+ registerCommands(commandMap) {
2121
+ Object.assign(commandMapRef, commandMap);
2100
2122
  }
2101
2123
  };
2102
2124
  };
@@ -2112,7 +2134,8 @@ const {
2112
2134
  get,
2113
2135
  set: set$2,
2114
2136
  dispose: dispose$1,
2115
- wrapCommand
2137
+ wrapCommand,
2138
+ wrapGetter
2116
2139
  } = create$1();
2117
2140
 
2118
2141
  const create = (uid, uri, x, y, width, height, platform, assetDir) => {
@@ -2128,6 +2151,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2128
2151
  changelogScrollTop: 0,
2129
2152
  changelogVirtualDom: [],
2130
2153
  commands: [],
2154
+ hasReadme: false,
2131
2155
  description: '',
2132
2156
  detailsVirtualDom: [],
2133
2157
  displaySize: '',
@@ -2172,7 +2196,7 @@ const isEqual$2 = (oldState, newState) => {
2172
2196
  };
2173
2197
 
2174
2198
  const isEqual$1 = (oldState, newState) => {
2175
- return oldState.activationEvents === newState.activationEvents && oldState.badge === newState.badge && oldState.categories === newState.categories && oldState.changelogVirtualDom === newState.changelogVirtualDom && oldState.commands === newState.commands && oldState.description === newState.description && oldState.detailsVirtualDom === newState.detailsVirtualDom && oldState.displaySize === newState.displaySize && oldState.extensionId === newState.extensionId && oldState.extensionVersion === newState.extensionVersion && oldState.jsonValidation === newState.jsonValidation && oldState.selectedFeature === newState.selectedFeature && oldState.selectedTab === newState.selectedTab && oldState.settings === newState.settings && oldState.themesMarkdownDom === newState.themesMarkdownDom && oldState.webViews === newState.webViews;
2199
+ return oldState.activationEvents === newState.activationEvents && oldState.badge === newState.badge && oldState.categories === newState.categories && oldState.changelogVirtualDom === newState.changelogVirtualDom && oldState.commands === newState.commands && oldState.description === newState.description && oldState.detailsVirtualDom === newState.detailsVirtualDom && oldState.displaySize === newState.displaySize && oldState.extensionId === newState.extensionId && oldState.extensionVersion === newState.extensionVersion && oldState.jsonValidation === newState.jsonValidation && oldState.selectedFeature === newState.selectedFeature && oldState.selectedTab === newState.selectedTab && oldState.settings === newState.settings && oldState.themesMarkdownDom === newState.themesMarkdownDom && oldState.webViews === newState.webViews && oldState.sizeValue === newState.sizeValue;
2176
2200
  };
2177
2201
 
2178
2202
  const User = 1;
@@ -3109,21 +3133,22 @@ const loadContent = async (state, platform, savedState) => {
3109
3133
  description,
3110
3134
  detailsVirtualDom,
3111
3135
  displaySize,
3112
- installationEntries,
3113
3136
  extension,
3114
3137
  extensionId,
3115
3138
  extensionVersion,
3116
3139
  features,
3117
3140
  folderSize,
3118
3141
  hasColorTheme,
3142
+ hasReadme,
3119
3143
  iconSrc,
3144
+ installationEntries,
3145
+ marketplaceEntries,
3120
3146
  name,
3121
3147
  readmeScrollTop,
3122
3148
  readmeUrl,
3123
3149
  resources,
3124
3150
  scrollSource: Script,
3125
3151
  scrollToTopButtonEnabled: true,
3126
- marketplaceEntries,
3127
3152
  selectedTab,
3128
3153
  sizeOnDisk: size,
3129
3154
  sizeValue,
@@ -3299,19 +3324,24 @@ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
3299
3324
  }
3300
3325
  return count;
3301
3326
  };
3302
- const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, installationEntries, marketplaceEntries) => {
3327
+ const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, installationEntries, marketplaceEntries, hasReadme) => {
3303
3328
  const firstHeading = installation();
3304
3329
  const secondHeading = marketplace();
3305
3330
  const thirdHeading = categories();
3306
3331
  const fourthHeading = resources();
3307
3332
  const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
3308
3333
  const childCount = getChildCount(showAdditionalDetails);
3334
+ const contentDom = hasReadme ? sanitizedReadmeHtml : [{
3335
+ type: VirtualDomElements.Div,
3336
+ childCount: 1,
3337
+ className: 'Markdown'
3338
+ }, text(noReadmeFound())];
3309
3339
  const dom = [{
3310
3340
  type: VirtualDomElements.Div,
3311
3341
  className: ExtensionDetailPanel,
3312
3342
  childCount: childCount,
3313
3343
  role: AriaRoles.Panel
3314
- }, ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, installationEntries, secondHeading, marketplaceEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
3344
+ }, ...contentDom, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, installationEntries, secondHeading, marketplaceEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
3315
3345
  return dom;
3316
3346
  };
3317
3347
 
@@ -3366,7 +3396,7 @@ const getFeaturesVirtualDom = (features, selectedFeature, state) => {
3366
3396
  const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, selectedTab, width, scrollToTopButtonEnabled, categories, resources, breakpoint, changelogDom, state) => {
3367
3397
  switch (selectedTab) {
3368
3398
  case Details:
3369
- return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.installationEntries, state.marketplaceEntries);
3399
+ return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.installationEntries, state.marketplaceEntries, state.hasReadme);
3370
3400
  case Features:
3371
3401
  return getFeaturesVirtualDom(state.features, state.selectedFeature, state);
3372
3402
  case Changelog:
@@ -3668,16 +3698,13 @@ const resize = (state, dimensions) => {
3668
3698
  };
3669
3699
  };
3670
3700
 
3671
- const saveState = uid => {
3672
- const {
3673
- newState
3674
- } = get(uid);
3701
+ const saveState = state => {
3675
3702
  const {
3676
3703
  selectedTab,
3677
3704
  selectedFeature,
3678
3705
  readmeScrollTop,
3679
3706
  changelogScrollTop
3680
- } = newState;
3707
+ } = state;
3681
3708
  return {
3682
3709
  selectedTab,
3683
3710
  selectedFeature,
@@ -3709,8 +3736,9 @@ const commandMap = {
3709
3736
  'ExtensionDetail.loadContent2': wrapCommand(loadContent2),
3710
3737
  'ExtensionDetail.render2': render2,
3711
3738
  'ExtensionDetail.renderEventListeners': renderEventListeners,
3712
- 'ExtensionDetail.resize': resize,
3713
- 'ExtensionDetail.saveState': saveState,
3739
+ 'ExtensionDetail.resize': wrapCommand(resize),
3740
+ // @ts-ignore
3741
+ 'ExtensionDetail.saveState': wrapGetter(saveState),
3714
3742
  'ExtensionDetail.selectTab': wrapCommand(selectTab),
3715
3743
  'ExtensionDetail.terminate': terminate,
3716
3744
  'ExtensionDetail.initialize': initialize
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.46.0",
3
+ "version": "3.47.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",