@lvce-editor/extension-detail-view 3.38.0 → 3.39.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.
@@ -646,7 +646,7 @@ const HandleClickUninstall = 'handleClickUninstall';
646
646
  const HandleFeaturesClick = 'handleFeaturesClick';
647
647
  const HandleIconError = 'handleIconError';
648
648
  const HandleReadmeContextMenu = 'handleReadmeContextMenu';
649
- const HandleReadmeWheel = 'handleReadmeWheel';
649
+ const HandleReadmeScroll = 'handleReadmeScroll';
650
650
  const HandleTabsClick = 'handleTabsClick';
651
651
 
652
652
  const ActivationEvents = 'ActivationEvents';
@@ -784,6 +784,7 @@ const getMarkdownVirtualDom = async (html, options) => {
784
784
  const dom = await getVirtualDom(html);
785
785
  const newDom = [...dom];
786
786
  if (options?.scrollToTopEnabled) {
787
+ newDom[0].onScroll = HandleReadmeScroll;
787
788
  newDom[0].childCount++;
788
789
  const extraDom = getScrollToTopVirtualDom();
789
790
  newDom.splice(1, 0, ...extraDom);
@@ -2071,6 +2072,7 @@ const {
2071
2072
 
2072
2073
  const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2073
2074
  const state = {
2075
+ uid,
2074
2076
  activationEvents: [],
2075
2077
  assetDir: assetDir || '',
2076
2078
  badge: '',
@@ -2078,6 +2080,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2078
2080
  builtinExtensionsBadgeEnabled: true,
2079
2081
  categories: [],
2080
2082
  changelogVirtualDom: [],
2083
+ changelogScrollTop: 0,
2081
2084
  commands: [],
2082
2085
  description: '',
2083
2086
  detailsVirtualDom: [],
@@ -2111,34 +2114,33 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2111
2114
  themesMarkdownDom: [],
2112
2115
  uri,
2113
2116
  webViews: [],
2114
- width
2117
+ width,
2118
+ focus: 0
2115
2119
  };
2116
2120
  set$1(uid, state, state);
2117
2121
  };
2118
2122
 
2119
- const RenderFocus = 2;
2120
- const RenderItems = 3;
2121
- const RenderScrollTop = 4;
2122
-
2123
- const diffType$2 = RenderFocus;
2124
2123
  const isEqual$2 = (oldState, newState) => {
2125
- return oldState === newState;
2124
+ return oldState.focus === newState.focus;
2126
2125
  };
2127
2126
 
2128
- const diffType$1 = RenderItems;
2129
2127
  const isEqual$1 = (oldState, newState) => {
2130
- return oldState === newState;
2128
+ 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;
2131
2129
  };
2132
2130
 
2133
2131
  const User = 1;
2132
+ const Script = 2;
2134
2133
 
2135
- const diffType = RenderScrollTop;
2136
2134
  const isEqual = (oldState, newState) => {
2137
- return newState.scrollSource === User || oldState.readmeScrollTop === newState.readmeScrollTop;
2135
+ return newState.scrollSource === Script || oldState.readmeScrollTop === newState.readmeScrollTop;
2138
2136
  };
2139
2137
 
2138
+ const RenderFocus = 2;
2139
+ const RenderItems = 3;
2140
+ const RenderScrollTop = 4;
2141
+
2140
2142
  const modules = [isEqual$1, isEqual$2, isEqual];
2141
- const numbers = [diffType$1, diffType$2, diffType];
2143
+ const numbers = [RenderItems, RenderFocus, RenderScrollTop];
2142
2144
 
2143
2145
  const diff2 = uid => {
2144
2146
  const {
@@ -2812,6 +2814,13 @@ const loadHeaderContent = (state, platform, extension) => {
2812
2814
  };
2813
2815
  };
2814
2816
 
2817
+ const getSavedChangelogScrollTop = savedState => {
2818
+ if (savedState && typeof savedState === 'object' && 'changelogScrollTop' in savedState && typeof savedState.changelogScrollTop === 'number') {
2819
+ return savedState.changelogScrollTop;
2820
+ }
2821
+ return 0;
2822
+ };
2823
+
2815
2824
  const getSavedReadmeScrollTop = savedState => {
2816
2825
  if (savedState && typeof savedState === 'object' && 'readmeScrollTop' in savedState && typeof savedState.readmeScrollTop === 'number') {
2817
2826
  return savedState.readmeScrollTop;
@@ -2837,10 +2846,12 @@ const restoreState = savedState => {
2837
2846
  const selectedTab = getSavedSelectedTab(savedState);
2838
2847
  const selectedFeature = getSavedSelectedFeature(savedState);
2839
2848
  const readmeScrollTop = getSavedReadmeScrollTop(savedState);
2849
+ const changelogScrollTop = getSavedChangelogScrollTop(savedState);
2840
2850
  return {
2841
2851
  selectedFeature,
2842
2852
  selectedTab,
2843
- readmeScrollTop
2853
+ readmeScrollTop,
2854
+ changelogScrollTop
2844
2855
  };
2845
2856
  };
2846
2857
 
@@ -3131,16 +3142,11 @@ const getMarketplaceEntries = () => {
3131
3142
  }];
3132
3143
  };
3133
3144
 
3134
- // import * as GetScrollToTopVirtualDom from '../GetScrollToTopVirtualDom/GetScrollToTopVirtualDom.ts'
3135
-
3136
3145
  const getChildCount = (additionalDetails, scrollToTopEnabled) => {
3137
3146
  let count = 1;
3138
3147
  if (additionalDetails) {
3139
3148
  count++;
3140
3149
  }
3141
- // if (scrollToTopEnabled) {
3142
- // count++
3143
- // }
3144
3150
  return count;
3145
3151
  };
3146
3152
  const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, extensionVersion, width, extensionUri, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint // new parameter, no default
@@ -3158,9 +3164,7 @@ const getDetailsVirtualDom = (sanitizedReadmeHtml, displaySize, extensionId, ext
3158
3164
  className: ExtensionDetailPanel,
3159
3165
  childCount: childCount,
3160
3166
  role: AriaRoles.Panel
3161
- },
3162
- // ...GetScrollToTopVirtualDom.getScrollToTopVirtualDom(scrollToTopButtonEnabled),
3163
- ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
3167
+ }, ...sanitizedReadmeHtml, ...getAdditionalDetailsVirtualDom(showAdditionalDetails, firstHeading, entries, secondHeading, secondEntries, thirdHeading, categories$1, fourthHeading, resources$1)];
3164
3168
  return dom;
3165
3169
  };
3166
3170
 
@@ -3436,7 +3440,9 @@ const renderFocus = (oldState, newState) => {
3436
3440
  };
3437
3441
 
3438
3442
  const renderScrollTop = (oldState, newState) => {
3439
- return ['Viewlet.setScrollTop', '', newState.readmeScrollTop];
3443
+ const selector = '.ExtensionDetailPanel .Markdown';
3444
+ const property = 'scrollTop';
3445
+ return ['Viewlet.setProperty', newState.uid, selector, property, newState.readmeScrollTop];
3440
3446
  };
3441
3447
 
3442
3448
  const getRenderer = diffType => {
@@ -3466,7 +3472,7 @@ const render2 = (uid, diffResult) => {
3466
3472
  oldState,
3467
3473
  newState
3468
3474
  } = get(uid);
3469
- set$1(uid, oldState, newState);
3475
+ set$1(uid, newState, newState);
3470
3476
  const commands = applyRender(oldState, newState, diffResult);
3471
3477
  return commands;
3472
3478
  };
@@ -3482,8 +3488,9 @@ const renderEventListeners = () => {
3482
3488
  name: HandleReadmeContextMenu,
3483
3489
  params: ['handleReadmeContextMenu', 'event.clientX', 'event.clientY', 'event.target.href', 'event.target.src']
3484
3490
  }, {
3485
- name: HandleReadmeWheel,
3486
- params: ['handleWheel', 'event.deltaX', 'event.deltaY']
3491
+ name: HandleReadmeScroll,
3492
+ params: ['handleWheel', 'event.deltaX', 'event.deltaY'],
3493
+ passive: true
3487
3494
  }, {
3488
3495
  name: HandleTabsClick,
3489
3496
  params: ['handleTabsClick', 'event.target.name']
@@ -3498,7 +3505,8 @@ const renderEventListeners = () => {
3498
3505
  params: ['handleClickDisable']
3499
3506
  }, {
3500
3507
  name: HandleClickScrollToTop,
3501
- params: ['handleClickScrollToTop']
3508
+ params: ['handleClickScrollToTop'],
3509
+ preventDefault: true
3502
3510
  }, {
3503
3511
  name: HandleClickSettings,
3504
3512
  params: ['handleClickSettings']
@@ -3525,12 +3533,14 @@ const saveState = uid => {
3525
3533
  const {
3526
3534
  selectedTab,
3527
3535
  selectedFeature,
3528
- readmeScrollTop
3536
+ readmeScrollTop,
3537
+ changelogScrollTop
3529
3538
  } = newState;
3530
3539
  return {
3531
3540
  selectedTab,
3532
3541
  selectedFeature,
3533
- readmeScrollTop
3542
+ readmeScrollTop,
3543
+ changelogScrollTop
3534
3544
  };
3535
3545
  };
3536
3546
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.38.0",
3
+ "version": "3.39.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",