@snowcone-app/ui 0.10.21 → 0.10.22
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.
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +13 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -6
- package/dist/index.d.ts +13 -6
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +32 -21
- package/src/composed/__tests__/HeroProductImage.strip.test.tsx +14 -6
- package/src/composed/carousels/types.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4460,12 +4460,18 @@ interface HeroProductImageProps {
|
|
|
4460
4460
|
*/
|
|
4461
4461
|
fit?: "cover" | "whole";
|
|
4462
4462
|
/**
|
|
4463
|
-
* Ask for a crop of the mockup's 8:3 strip
|
|
4464
|
-
* `
|
|
4465
|
-
*
|
|
4466
|
-
*
|
|
4467
|
-
|
|
4468
|
-
|
|
4463
|
+
* Ask for a crop of the mockup's 8:3 strip instead of a width-sized 16:9 picture: the desktop hero of a mockup whose
|
|
4464
|
+
* catalog entry carries `strip` (www heroStrip.ts).
|
|
4465
|
+
* - `"<r>@<f>"`: `aspect=8:3&view=<r>@<f>`, at the crop's own px;
|
|
4466
|
+
* - `{ view, width }`: the same crop downscaled to `width` (the page's CSS width x devicePixelRatio when that is under
|
|
4467
|
+
* the crop's px; the box never enlarges, rendercenter rc#899);
|
|
4468
|
+
* The whole strip is a view too: `MOCKUP_VIEW_WHOLE_STRIP` (`2.7@0.25`, a window wider than 2.6).
|
|
4469
|
+
* Stamped as data-strip-view (and data-strip-width).
|
|
4470
|
+
*/
|
|
4471
|
+
stripView?: MockupView | {
|
|
4472
|
+
view: MockupView;
|
|
4473
|
+
width: number;
|
|
4474
|
+
};
|
|
4469
4475
|
/** Called with the URL of each picture once it is ON SCREEN (its <img> loaded), not when it is asked for. */
|
|
4470
4476
|
onShown?: (url: string) => void;
|
|
4471
4477
|
}
|
|
@@ -4800,6 +4806,7 @@ interface CarouselImage {
|
|
|
4800
4806
|
strip?: {
|
|
4801
4807
|
shape: "8:3";
|
|
4802
4808
|
productX: number;
|
|
4809
|
+
heightPx?: number;
|
|
4803
4810
|
};
|
|
4804
4811
|
}
|
|
4805
4812
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -4460,12 +4460,18 @@ interface HeroProductImageProps {
|
|
|
4460
4460
|
*/
|
|
4461
4461
|
fit?: "cover" | "whole";
|
|
4462
4462
|
/**
|
|
4463
|
-
* Ask for a crop of the mockup's 8:3 strip
|
|
4464
|
-
* `
|
|
4465
|
-
*
|
|
4466
|
-
*
|
|
4467
|
-
|
|
4468
|
-
|
|
4463
|
+
* Ask for a crop of the mockup's 8:3 strip instead of a width-sized 16:9 picture: the desktop hero of a mockup whose
|
|
4464
|
+
* catalog entry carries `strip` (www heroStrip.ts).
|
|
4465
|
+
* - `"<r>@<f>"`: `aspect=8:3&view=<r>@<f>`, at the crop's own px;
|
|
4466
|
+
* - `{ view, width }`: the same crop downscaled to `width` (the page's CSS width x devicePixelRatio when that is under
|
|
4467
|
+
* the crop's px; the box never enlarges, rendercenter rc#899);
|
|
4468
|
+
* The whole strip is a view too: `MOCKUP_VIEW_WHOLE_STRIP` (`2.7@0.25`, a window wider than 2.6).
|
|
4469
|
+
* Stamped as data-strip-view (and data-strip-width).
|
|
4470
|
+
*/
|
|
4471
|
+
stripView?: MockupView | {
|
|
4472
|
+
view: MockupView;
|
|
4473
|
+
width: number;
|
|
4474
|
+
};
|
|
4469
4475
|
/** Called with the URL of each picture once it is ON SCREEN (its <img> loaded), not when it is asked for. */
|
|
4470
4476
|
onShown?: (url: string) => void;
|
|
4471
4477
|
}
|
|
@@ -4800,6 +4806,7 @@ interface CarouselImage {
|
|
|
4800
4806
|
strip?: {
|
|
4801
4807
|
shape: "8:3";
|
|
4802
4808
|
productX: number;
|
|
4809
|
+
heightPx?: number;
|
|
4803
4810
|
};
|
|
4804
4811
|
}
|
|
4805
4812
|
/**
|
package/dist/index.js
CHANGED
|
@@ -10578,7 +10578,7 @@ function buildHeroMockupUrl(args) {
|
|
|
10578
10578
|
return getMockupUrl(args.productCode, {
|
|
10579
10579
|
shop: snow.shop,
|
|
10580
10580
|
design: publicDesign,
|
|
10581
|
-
..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView
|
|
10581
|
+
..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView, ...args.size.width !== void 0 ? { width: args.size.width } : {} } : { width: args.size.width },
|
|
10582
10582
|
view: args.mockupId,
|
|
10583
10583
|
variant: args.variantId,
|
|
10584
10584
|
...args.bg ? { bg: args.bg } : {},
|
|
@@ -10586,11 +10586,11 @@ function buildHeroMockupUrl(args) {
|
|
|
10586
10586
|
});
|
|
10587
10587
|
}
|
|
10588
10588
|
function isCrop(stripView) {
|
|
10589
|
-
return stripView !== void 0
|
|
10589
|
+
return stripView !== void 0;
|
|
10590
10590
|
}
|
|
10591
|
-
function heroSize(stripView, width) {
|
|
10592
|
-
if (isCrop(stripView)) return { stripView };
|
|
10593
|
-
return
|
|
10591
|
+
function heroSize(stripView, cropWidth, width) {
|
|
10592
|
+
if (isCrop(stripView)) return cropWidth !== void 0 ? { stripView, width: cropWidth } : { stripView };
|
|
10593
|
+
return { width };
|
|
10594
10594
|
}
|
|
10595
10595
|
var EMPTY_IMAGES = [];
|
|
10596
10596
|
var HeroProductImage = memo3(function HeroProductImage2({
|
|
@@ -10625,9 +10625,11 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10625
10625
|
unavailableText = "Preview unavailable",
|
|
10626
10626
|
viewportPolicy = false,
|
|
10627
10627
|
fit = "cover",
|
|
10628
|
-
stripView,
|
|
10628
|
+
stripView: stripViewProp,
|
|
10629
10629
|
onShown
|
|
10630
10630
|
}) {
|
|
10631
|
+
const stripView = typeof stripViewProp === "object" ? stripViewProp.view : stripViewProp;
|
|
10632
|
+
const cropWidth = typeof stripViewProp === "object" ? stripViewProp.width : void 0;
|
|
10631
10633
|
const context = useProductOptional();
|
|
10632
10634
|
const designContext = useDesignOptional();
|
|
10633
10635
|
const shopContext = useShopOptional();
|
|
@@ -10688,11 +10690,12 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10688
10690
|
placements: allPlacements,
|
|
10689
10691
|
mockupId: actualMockupId,
|
|
10690
10692
|
variantId: actualGvid,
|
|
10691
|
-
size: heroSize(stripView, width),
|
|
10693
|
+
size: heroSize(stripView, cropWidth, width),
|
|
10692
10694
|
bg: mockupBg
|
|
10693
10695
|
});
|
|
10694
10696
|
}, [
|
|
10695
10697
|
stripView,
|
|
10698
|
+
cropWidth,
|
|
10696
10699
|
realtimeUrl,
|
|
10697
10700
|
mode,
|
|
10698
10701
|
context?.loading,
|
|
@@ -11067,7 +11070,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11067
11070
|
placements: allPlacements,
|
|
11068
11071
|
mockupId: actualMockupId,
|
|
11069
11072
|
variantId: actualGvid,
|
|
11070
|
-
size: heroSize(stripView, width),
|
|
11073
|
+
size: heroSize(stripView, cropWidth, width),
|
|
11071
11074
|
bg: mockupBg
|
|
11072
11075
|
});
|
|
11073
11076
|
if (!url) return;
|
|
@@ -11113,6 +11116,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11113
11116
|
images,
|
|
11114
11117
|
width,
|
|
11115
11118
|
stripView,
|
|
11119
|
+
cropWidth,
|
|
11116
11120
|
effects,
|
|
11117
11121
|
// Use primitive values extracted at the top of the component
|
|
11118
11122
|
artworkSrc,
|
|
@@ -11248,6 +11252,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11248
11252
|
"data-mockup-id": actualMockupId || void 0,
|
|
11249
11253
|
"data-fit": fit,
|
|
11250
11254
|
"data-strip-view": stripView,
|
|
11255
|
+
"data-strip-width": cropWidth,
|
|
11251
11256
|
"data-picture-failed": imgFailed ? "E_PICTURE_UNDISPLAYED" : void 0,
|
|
11252
11257
|
"data-picture-failed-src": failedSrc,
|
|
11253
11258
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|