@lvce-editor/extension-detail-view 7.24.0 → 7.24.1

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.
@@ -3909,6 +3909,49 @@ const {
3909
3909
  wrapGetter
3910
3910
  } = create$1();
3911
3911
 
3912
+ const interpolate = (value, inMin, inMax, outMin, outMax) => {
3913
+ const clamped = Math.min(Math.max(value, inMin), inMax);
3914
+ const ratio = (clamped - inMin) / (inMax - inMin);
3915
+ const mapped = outMin + ratio * (outMax - outMin);
3916
+ return Math.round(mapped);
3917
+ };
3918
+
3919
+ const getPadding = width => {
3920
+ if (width < 600) {
3921
+ return 10;
3922
+ }
3923
+ if (width < 800) {
3924
+ return 10;
3925
+ }
3926
+ if (width < 1200) {
3927
+ return interpolate(width, 800, 1200, 10, 30);
3928
+ }
3929
+ return 30;
3930
+ };
3931
+ const getSideBarWidth = width => {
3932
+ if (width < 490) {
3933
+ return 0;
3934
+ }
3935
+ if (width < 650) {
3936
+ return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
3937
+ }
3938
+ if (width < 800) {
3939
+ return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
3940
+ }
3941
+ return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
3942
+ };
3943
+
3944
+ const getResponsiveLayout = width => {
3945
+ const padding = getPadding(width);
3946
+ const sideBarWidth = getSideBarWidth(width);
3947
+ return {
3948
+ paddingLeft: padding,
3949
+ paddingRight: padding,
3950
+ showSideBar: sideBarWidth > 0,
3951
+ sideBarWidth
3952
+ };
3953
+ };
3954
+
3912
3955
  const create = (uid, uri, x, y, width, height, platform, assetDir) => {
3913
3956
  const state = {
3914
3957
  activationEntries: [],
@@ -3957,8 +4000,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
3957
4000
  locationProtocol: '',
3958
4001
  marketplaceEntries: [],
3959
4002
  name: '',
3960
- paddingLeft: 0,
3961
- paddingRight: 0,
4003
+ ...getResponsiveLayout(width),
3962
4004
  platform,
3963
4005
  programmingLanguages: [],
3964
4006
  rating: 'n/a',
@@ -3972,9 +4014,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
3972
4014
  settings: [],
3973
4015
  settingsButtonEnabled: false,
3974
4016
  showAdditionalDetailsBreakpoint: 700,
3975
- showSideBar: true,
3976
4017
  showSizeLink: false,
3977
- sideBarWidth: 0,
3978
4018
  sizeOnDisk: 0,
3979
4019
  sizeValue: 0,
3980
4020
  status: 0,
@@ -4772,38 +4812,6 @@ const getLinkProtectionEnabled = async () => {
4772
4812
  }
4773
4813
  };
4774
4814
 
4775
- const interpolate = (value, inMin, inMax, outMin, outMax) => {
4776
- const clamped = Math.min(Math.max(value, inMin), inMax);
4777
- const ratio = (clamped - inMin) / (inMax - inMin);
4778
- const mapped = outMin + ratio * (outMax - outMin);
4779
- return Math.round(mapped);
4780
- };
4781
-
4782
- const getPadding = width => {
4783
- if (width < 600) {
4784
- return 10;
4785
- }
4786
- if (width < 800) {
4787
- return 10;
4788
- }
4789
- if (width < 1200) {
4790
- return interpolate(width, 800, 1200, 10, 30);
4791
- }
4792
- return 30;
4793
- };
4794
- const getSideBarWidth = width => {
4795
- if (width < 490) {
4796
- return 0;
4797
- }
4798
- if (width < 650) {
4799
- return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
4800
- }
4801
- if (width < 800) {
4802
- return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
4803
- }
4804
- return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
4805
- };
4806
-
4807
4815
  const getStringArray = value => {
4808
4816
  if (!Array.isArray(value)) {
4809
4817
  return undefined;
@@ -5601,9 +5609,6 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5601
5609
  marketplaceEntries,
5602
5610
  resources
5603
5611
  } = await loadSideBarContent(extensionId, extensionVersion, extensionUri, isBuiltin, extension, showSizeLink, created, lastUpdated);
5604
- const padding = getPadding(width);
5605
- const sideBarWidth = getSideBarWidth(width);
5606
- const showSideBar = sideBarWidth > 0;
5607
5612
  const linkProtectionEnabled = await getLinkProtectionEnabled();
5608
5613
  return {
5609
5614
  ...state,
@@ -5641,8 +5646,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5641
5646
  locationProtocol,
5642
5647
  marketplaceEntries,
5643
5648
  name,
5644
- paddingLeft: padding,
5645
- paddingRight: padding,
5649
+ ...getResponsiveLayout(width),
5646
5650
  platform,
5647
5651
  rating,
5648
5652
  readmeScrollTop,
@@ -5653,9 +5657,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
5653
5657
  selectedFeature: actualSelectedFeature,
5654
5658
  selectedTab,
5655
5659
  settingsButtonEnabled: true,
5656
- showSideBar,
5657
5660
  showSizeLink,
5658
- sideBarWidth,
5659
5661
  sizeOnDisk: size,
5660
5662
  sizeValue,
5661
5663
  tabs: enabledTabs
@@ -6364,11 +6366,25 @@ const hideSizeLink = state => {
6364
6366
  };
6365
6367
  };
6366
6368
 
6369
+ const applyLatestResponsiveLayout = state => {
6370
+ const {
6371
+ uid
6372
+ } = state;
6373
+ const {
6374
+ width
6375
+ } = get$1(uid).newState;
6376
+ return {
6377
+ ...state,
6378
+ ...getResponsiveLayout(width),
6379
+ width
6380
+ };
6381
+ };
6367
6382
  const loadContent2 = async (state, savedState, isTest = false) => {
6368
6383
  const {
6369
6384
  platform
6370
6385
  } = state;
6371
- return loadContent(state, platform, savedState, isTest);
6386
+ const loadedState = await loadContent(state, platform, savedState, isTest);
6387
+ return applyLatestResponsiveLayout(loadedState);
6372
6388
  };
6373
6389
 
6374
6390
  const openImageInNewTab = async state => {
@@ -7209,16 +7225,10 @@ const renderTitle = state => {
7209
7225
  };
7210
7226
 
7211
7227
  const resize = (state, dimensions) => {
7212
- const padding = getPadding(dimensions.width);
7213
- const sideBarWidth = getSideBarWidth(dimensions.width);
7214
- const showSideBar = sideBarWidth > 0;
7215
7228
  return {
7216
7229
  ...state,
7217
7230
  ...dimensions,
7218
- paddingLeft: padding,
7219
- paddingRight: padding,
7220
- showSideBar,
7221
- sideBarWidth
7231
+ ...getResponsiveLayout(dimensions.width)
7222
7232
  };
7223
7233
  };
7224
7234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-detail-view",
3
- "version": "7.24.0",
3
+ "version": "7.24.1",
4
4
  "description": "Extension Detail View Worker",
5
5
  "repository": {
6
6
  "type": "git",