@lvce-editor/extension-detail-view 7.23.2 → 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.
|
@@ -1545,11 +1545,13 @@ const register$1 = feature => {
|
|
|
1545
1545
|
const getFeatures = (selectedFeature, extension) => {
|
|
1546
1546
|
const allFeatures = Object.values(features);
|
|
1547
1547
|
const enabledFeatures = allFeatures.filter(item => item.isEnabled(extension));
|
|
1548
|
+
const hasSelectedFeature = enabledFeatures.some(item => item.id === selectedFeature);
|
|
1549
|
+
const actualSelectedFeature = hasSelectedFeature ? selectedFeature : enabledFeatures[0]?.id;
|
|
1548
1550
|
const converted = enabledFeatures.map(item => {
|
|
1549
1551
|
return {
|
|
1550
1552
|
id: item.id,
|
|
1551
1553
|
label: item.getLabel(),
|
|
1552
|
-
selected: item.id ===
|
|
1554
|
+
selected: item.id === actualSelectedFeature
|
|
1553
1555
|
};
|
|
1554
1556
|
});
|
|
1555
1557
|
return converted;
|
|
@@ -3907,6 +3909,49 @@ const {
|
|
|
3907
3909
|
wrapGetter
|
|
3908
3910
|
} = create$1();
|
|
3909
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
|
+
|
|
3910
3955
|
const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
3911
3956
|
const state = {
|
|
3912
3957
|
activationEntries: [],
|
|
@@ -3955,8 +4000,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3955
4000
|
locationProtocol: '',
|
|
3956
4001
|
marketplaceEntries: [],
|
|
3957
4002
|
name: '',
|
|
3958
|
-
|
|
3959
|
-
paddingRight: 0,
|
|
4003
|
+
...getResponsiveLayout(width),
|
|
3960
4004
|
platform,
|
|
3961
4005
|
programmingLanguages: [],
|
|
3962
4006
|
rating: 'n/a',
|
|
@@ -3970,9 +4014,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3970
4014
|
settings: [],
|
|
3971
4015
|
settingsButtonEnabled: false,
|
|
3972
4016
|
showAdditionalDetailsBreakpoint: 700,
|
|
3973
|
-
showSideBar: true,
|
|
3974
4017
|
showSizeLink: false,
|
|
3975
|
-
sideBarWidth: 0,
|
|
3976
4018
|
sizeOnDisk: 0,
|
|
3977
4019
|
sizeValue: 0,
|
|
3978
4020
|
status: 0,
|
|
@@ -4770,38 +4812,6 @@ const getLinkProtectionEnabled = async () => {
|
|
|
4770
4812
|
}
|
|
4771
4813
|
};
|
|
4772
4814
|
|
|
4773
|
-
const interpolate = (value, inMin, inMax, outMin, outMax) => {
|
|
4774
|
-
const clamped = Math.min(Math.max(value, inMin), inMax);
|
|
4775
|
-
const ratio = (clamped - inMin) / (inMax - inMin);
|
|
4776
|
-
const mapped = outMin + ratio * (outMax - outMin);
|
|
4777
|
-
return Math.round(mapped);
|
|
4778
|
-
};
|
|
4779
|
-
|
|
4780
|
-
const getPadding = width => {
|
|
4781
|
-
if (width < 600) {
|
|
4782
|
-
return 10;
|
|
4783
|
-
}
|
|
4784
|
-
if (width < 800) {
|
|
4785
|
-
return 10;
|
|
4786
|
-
}
|
|
4787
|
-
if (width < 1200) {
|
|
4788
|
-
return interpolate(width, 800, 1200, 10, 30);
|
|
4789
|
-
}
|
|
4790
|
-
return 30;
|
|
4791
|
-
};
|
|
4792
|
-
const getSideBarWidth = width => {
|
|
4793
|
-
if (width < 490) {
|
|
4794
|
-
return 0;
|
|
4795
|
-
}
|
|
4796
|
-
if (width < 650) {
|
|
4797
|
-
return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
|
|
4798
|
-
}
|
|
4799
|
-
if (width < 800) {
|
|
4800
|
-
return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
|
|
4801
|
-
}
|
|
4802
|
-
return Math.max(175 + Math.round(20 * (width / 100)), Math.round(width / 4));
|
|
4803
|
-
};
|
|
4804
|
-
|
|
4805
4815
|
const getStringArray = value => {
|
|
4806
4816
|
if (!Array.isArray(value)) {
|
|
4807
4817
|
return undefined;
|
|
@@ -5582,6 +5592,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
|
|
|
5582
5592
|
selectedTab
|
|
5583
5593
|
} = restoreState(savedState);
|
|
5584
5594
|
const features = getFeatures(selectedFeature || Theme, extension);
|
|
5595
|
+
const actualSelectedFeature = features.find(feature => feature.selected)?.id || '';
|
|
5585
5596
|
const hasFeatures = features.length > 0;
|
|
5586
5597
|
const hasGithubReleases = Boolean(getGithubRepository(extension));
|
|
5587
5598
|
const tabs = getTabs(selectedTab, hasReadme, hasFeatures, hasChangelog || hasGithubReleases);
|
|
@@ -5598,9 +5609,6 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
|
|
|
5598
5609
|
marketplaceEntries,
|
|
5599
5610
|
resources
|
|
5600
5611
|
} = await loadSideBarContent(extensionId, extensionVersion, extensionUri, isBuiltin, extension, showSizeLink, created, lastUpdated);
|
|
5601
|
-
const padding = getPadding(width);
|
|
5602
|
-
const sideBarWidth = getSideBarWidth(width);
|
|
5603
|
-
const showSideBar = sideBarWidth > 0;
|
|
5604
5612
|
const linkProtectionEnabled = await getLinkProtectionEnabled();
|
|
5605
5613
|
return {
|
|
5606
5614
|
...state,
|
|
@@ -5638,8 +5646,7 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
|
|
|
5638
5646
|
locationProtocol,
|
|
5639
5647
|
marketplaceEntries,
|
|
5640
5648
|
name,
|
|
5641
|
-
|
|
5642
|
-
paddingRight: padding,
|
|
5649
|
+
...getResponsiveLayout(width),
|
|
5643
5650
|
platform,
|
|
5644
5651
|
rating,
|
|
5645
5652
|
readmeScrollTop,
|
|
@@ -5647,11 +5654,10 @@ const loadContentInternal = async (state, platform, savedState, isTest = false)
|
|
|
5647
5654
|
resources,
|
|
5648
5655
|
scrollSource: Script,
|
|
5649
5656
|
scrollToTopButtonEnabled: true,
|
|
5657
|
+
selectedFeature: actualSelectedFeature,
|
|
5650
5658
|
selectedTab,
|
|
5651
5659
|
settingsButtonEnabled: true,
|
|
5652
|
-
showSideBar,
|
|
5653
5660
|
showSizeLink,
|
|
5654
|
-
sideBarWidth,
|
|
5655
5661
|
sizeOnDisk: size,
|
|
5656
5662
|
sizeValue,
|
|
5657
5663
|
tabs: enabledTabs
|
|
@@ -6360,11 +6366,25 @@ const hideSizeLink = state => {
|
|
|
6360
6366
|
};
|
|
6361
6367
|
};
|
|
6362
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
|
+
};
|
|
6363
6382
|
const loadContent2 = async (state, savedState, isTest = false) => {
|
|
6364
6383
|
const {
|
|
6365
6384
|
platform
|
|
6366
6385
|
} = state;
|
|
6367
|
-
|
|
6386
|
+
const loadedState = await loadContent(state, platform, savedState, isTest);
|
|
6387
|
+
return applyLatestResponsiveLayout(loadedState);
|
|
6368
6388
|
};
|
|
6369
6389
|
|
|
6370
6390
|
const openImageInNewTab = async state => {
|
|
@@ -7205,16 +7225,10 @@ const renderTitle = state => {
|
|
|
7205
7225
|
};
|
|
7206
7226
|
|
|
7207
7227
|
const resize = (state, dimensions) => {
|
|
7208
|
-
const padding = getPadding(dimensions.width);
|
|
7209
|
-
const sideBarWidth = getSideBarWidth(dimensions.width);
|
|
7210
|
-
const showSideBar = sideBarWidth > 0;
|
|
7211
7228
|
return {
|
|
7212
7229
|
...state,
|
|
7213
7230
|
...dimensions,
|
|
7214
|
-
|
|
7215
|
-
paddingRight: padding,
|
|
7216
|
-
showSideBar,
|
|
7217
|
-
sideBarWidth
|
|
7231
|
+
...getResponsiveLayout(dimensions.width)
|
|
7218
7232
|
};
|
|
7219
7233
|
};
|
|
7220
7234
|
|