@lvce-editor/extension-detail-view 3.59.0 → 3.60.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.
@@ -2538,7 +2538,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2538
2538
  selectedTab: '',
2539
2539
  settings: [],
2540
2540
  settingsButtonEnabled: false,
2541
- showAdditionalDetailsBreakpoint: 600,
2541
+ showAdditionalDetailsBreakpoint: 700,
2542
2542
  sizeOnDisk: 0,
2543
2543
  sizeValue: 0,
2544
2544
  tabs: [],
@@ -2548,13 +2548,15 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
2548
2548
  width,
2549
2549
  readmeUrl: '',
2550
2550
  paddingLeft: 0,
2551
- paddingRight: 0
2551
+ paddingRight: 0,
2552
+ showSideBar: true,
2553
+ sideBarWidth: 0
2552
2554
  };
2553
2555
  set(uid, state, state);
2554
2556
  };
2555
2557
 
2556
2558
  const isEqual$3 = (oldState, newState) => {
2557
- return oldState.paddingLeft === newState.paddingLeft && oldState.paddingRight === newState.paddingRight;
2559
+ return oldState.paddingLeft === newState.paddingLeft && oldState.paddingRight === newState.paddingRight && oldState.sideBarWidth === newState.sideBarWidth;
2558
2560
  };
2559
2561
 
2560
2562
  const isEqual$2 = (oldState, newState) => {
@@ -2562,7 +2564,7 @@ const isEqual$2 = (oldState, newState) => {
2562
2564
  };
2563
2565
 
2564
2566
  const isEqual$1 = (oldState, newState) => {
2565
- 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;
2567
+ 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 && oldState.showSideBar === newState.showSideBar;
2566
2568
  };
2567
2569
 
2568
2570
  const User = 1;
@@ -3148,17 +3150,36 @@ const getExtensionIdFromUri = uri => {
3148
3150
  return id;
3149
3151
  };
3150
3152
 
3153
+ const interpolate = (value, inMin, inMax, outMin, outMax) => {
3154
+ const clamped = Math.min(Math.max(value, inMin), inMax);
3155
+ const ratio = (clamped - inMin) / (inMax - inMin);
3156
+ const mapped = outMin + ratio * (outMax - outMin);
3157
+ return Math.round(mapped);
3158
+ };
3159
+
3151
3160
  const getPadding = width => {
3152
- if (width < 400) {
3161
+ if (width < 600) {
3153
3162
  return 10;
3154
3163
  }
3155
3164
  if (width < 800) {
3156
- return 20;
3165
+ return 10;
3157
3166
  }
3158
3167
  if (width < 1200) {
3159
- return 30;
3168
+ return interpolate(width, 800, 1200, 10, 30);
3169
+ }
3170
+ return 30;
3171
+ };
3172
+ const getSideBarWidth = width => {
3173
+ if (width < 490) {
3174
+ return 0;
3160
3175
  }
3161
- return 40;
3176
+ if (width < 650) {
3177
+ return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
3178
+ }
3179
+ if (width < 800) {
3180
+ return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
3181
+ }
3182
+ return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
3162
3183
  };
3163
3184
 
3164
3185
  const getTabs = (selectedTab, hasReadme, hasFeatures, hasChangelog) => {
@@ -3614,6 +3635,8 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3614
3635
  folderSize
3615
3636
  } = await loadSideBarContent(extensionId, extensionVersion, extensionUri, isBuiltin);
3616
3637
  const padding = getPadding(width);
3638
+ const sideBarWidth = getSideBarWidth(width);
3639
+ const showSideBar = sideBarWidth > 0;
3617
3640
  return {
3618
3641
  ...state,
3619
3642
  badge,
@@ -3638,6 +3661,8 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3638
3661
  installationEntries,
3639
3662
  marketplaceEntries,
3640
3663
  name,
3664
+ paddingLeft: padding,
3665
+ paddingRight: padding,
3641
3666
  rating,
3642
3667
  readmeScrollTop,
3643
3668
  readmeUrl,
@@ -3645,11 +3670,11 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
3645
3670
  scrollSource: Script,
3646
3671
  scrollToTopButtonEnabled: true,
3647
3672
  selectedTab,
3673
+ showSideBar,
3674
+ sideBarWidth,
3648
3675
  sizeOnDisk: size,
3649
3676
  sizeValue,
3650
- tabs: enabledTabs,
3651
- paddingLeft: padding,
3652
- paddingRight: padding
3677
+ tabs: enabledTabs
3653
3678
  };
3654
3679
  };
3655
3680
 
@@ -3682,11 +3707,13 @@ const renderCss = (oldState, newState) => {
3682
3707
  const {
3683
3708
  uid,
3684
3709
  paddingLeft,
3685
- paddingRight
3710
+ paddingRight,
3711
+ sideBarWidth
3686
3712
  } = newState;
3687
3713
  const css = createCss({
3688
3714
  ExtensionDetailPaddingLeft: paddingLeft,
3689
- ExtensionDetailPaddingRight: paddingRight
3715
+ ExtensionDetailPaddingRight: paddingRight,
3716
+ ExtensionDetailSideBarWidth: sideBarWidth
3690
3717
  });
3691
3718
  return ['Viewlet.setCss', uid, css];
3692
3719
  };
@@ -3857,12 +3884,12 @@ const getChildCount = (additionalDetails, scrollToTopEnabled) => {
3857
3884
  }
3858
3885
  return count;
3859
3886
  };
3860
- const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, installationEntries, marketplaceEntries, hasReadme) => {
3887
+ const getDetailsVirtualDom = (sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories$1, resources$1, showAdditionalDetailsBreakpoint, installationEntries, marketplaceEntries, hasReadme, showSideBar) => {
3861
3888
  const firstHeading = installation();
3862
3889
  const secondHeading = marketplace();
3863
3890
  const thirdHeading = categories();
3864
3891
  const fourthHeading = resources();
3865
- const showAdditionalDetails = width > showAdditionalDetailsBreakpoint;
3892
+ const showAdditionalDetails = showSideBar;
3866
3893
  const childCount = getChildCount(showAdditionalDetails);
3867
3894
  const contentDom = hasReadme ? sanitizedReadmeHtml : [{
3868
3895
  type: VirtualDomElements.Div,
@@ -3934,7 +3961,7 @@ const getFeaturesVirtualDom = (features, selectedFeature, state) => {
3934
3961
  const getExtensionDetailContentVirtualDom = (sanitizedReadmeHtml, selectedTab, width, scrollToTopButtonEnabled, categories, resources, breakpoint, changelogDom, state) => {
3935
3962
  switch (selectedTab) {
3936
3963
  case Details:
3937
- return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.installationEntries, state.marketplaceEntries, state.hasReadme);
3964
+ return getDetailsVirtualDom(sanitizedReadmeHtml, width, scrollToTopButtonEnabled, categories, resources, breakpoint, state.installationEntries, state.marketplaceEntries, state.hasReadme, state.showSideBar);
3938
3965
  case Features:
3939
3966
  return getFeaturesVirtualDom(state.features, state.selectedFeature, state);
3940
3967
  case Changelog:
@@ -4236,9 +4263,16 @@ const renderEventListeners = () => {
4236
4263
  };
4237
4264
 
4238
4265
  const resize = (state, dimensions) => {
4266
+ const padding = getPadding(dimensions.width);
4267
+ const sideBarWidth = getSideBarWidth(dimensions.width);
4268
+ const showSideBar = sideBarWidth > 0;
4239
4269
  return {
4240
4270
  ...state,
4241
- ...dimensions
4271
+ ...dimensions,
4272
+ showSideBar,
4273
+ paddingLeft: padding,
4274
+ paddingRight: padding,
4275
+ sideBarWidth
4242
4276
  };
4243
4277
  };
4244
4278
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "3.59.0",
3
+ "version": "3.60.0",
4
4
  "description": "Extension Detail View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",