@snowcone-app/ui 0.11.15 → 0.11.16
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 +13 -0
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/carousels/MobileProductCarousel.tsx +4 -0
- package/src/composed/carousels/__tests__/firstView.test.ts +38 -0
- package/src/composed/carousels/firstView.ts +50 -0
- package/src/composed/carousels/index.ts +1 -0
- package/src/composed/carousels/types.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6499](https://github.com/snowcone-app/snowcone-monorepo/pull/6499) [`b00533a`](https://github.com/snowcone-app/snowcone-monorepo/commit/b00533a10a50e8a1fc9c4d07c8bfd8090f688805) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Catalog mockups may carry `productBox: { shape: "16:9", x, y, w, h }` (the product's box in the mockup's default 16:9
|
|
8
|
+
picture) and `phoneWindow: { shape: "2:3", x, w }` (where the mockup's own 2:3 window lies along that picture's width).
|
|
9
|
+
`CarouselImage.productBox` / `CarouselImage.phoneWindow` carry them to the phone carousel, which stamps each slide with
|
|
10
|
+
`data-first-view`, `data-product-box`, `data-phone-window` and the CSS variables `--first-view-x`, `--product-x0`,
|
|
11
|
+
`--product-x1` (`slideFirstViewProps`, `SLIDE_*`), so a hero that shows only part of the picture looks at the picture's
|
|
12
|
+
phone window and keeps the product in view, instead of showing the picture's middle.
|
|
13
|
+
- Updated dependencies [[`b00533a`](https://github.com/snowcone-app/snowcone-monorepo/commit/b00533a10a50e8a1fc9c4d07c8bfd8090f688805)]:
|
|
14
|
+
- @snowcone-app/sdk@0.33.1
|
|
15
|
+
|
|
3
16
|
## 0.11.15
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -288,6 +288,12 @@ __export(src_exports, {
|
|
|
288
288
|
RealtimeProvider: () => RealtimeProvider,
|
|
289
289
|
ResponsiveZoom: () => ResponsiveZoom,
|
|
290
290
|
RightToLeftProgressiveBlur: () => RightToLeftProgressiveBlur,
|
|
291
|
+
SLIDE_FIRST_VIEW_ATTR: () => SLIDE_FIRST_VIEW_ATTR,
|
|
292
|
+
SLIDE_FIRST_VIEW_X_VAR: () => SLIDE_FIRST_VIEW_X_VAR,
|
|
293
|
+
SLIDE_PHONE_WINDOW_ATTR: () => SLIDE_PHONE_WINDOW_ATTR,
|
|
294
|
+
SLIDE_PRODUCT_BOX_ATTR: () => SLIDE_PRODUCT_BOX_ATTR,
|
|
295
|
+
SLIDE_PRODUCT_X0_VAR: () => SLIDE_PRODUCT_X0_VAR,
|
|
296
|
+
SLIDE_PRODUCT_X1_VAR: () => SLIDE_PRODUCT_X1_VAR,
|
|
291
297
|
SafeImg: () => SafeImg,
|
|
292
298
|
ScrollFade: () => ScrollFade,
|
|
293
299
|
SearchBox: () => SearchBox,
|
|
@@ -368,6 +374,7 @@ __export(src_exports, {
|
|
|
368
374
|
runConfigChecks: () => runConfigChecks,
|
|
369
375
|
scrollInputAboveKeyboard: () => scrollInputAboveKeyboard,
|
|
370
376
|
searchClient: () => searchClient,
|
|
377
|
+
slideFirstViewProps: () => slideFirstViewProps,
|
|
371
378
|
spinnerVariants: () => spinnerVariants,
|
|
372
379
|
surfaceVariants: () => surfaceVariants,
|
|
373
380
|
useArtworkAlignment: () => useArtworkAlignment,
|
|
@@ -13171,6 +13178,27 @@ function ResponsiveZoom({
|
|
|
13171
13178
|
] });
|
|
13172
13179
|
}
|
|
13173
13180
|
|
|
13181
|
+
// src/composed/carousels/firstView.ts
|
|
13182
|
+
var SLIDE_FIRST_VIEW_ATTR = "data-first-view";
|
|
13183
|
+
var SLIDE_PRODUCT_BOX_ATTR = "data-product-box";
|
|
13184
|
+
var SLIDE_PHONE_WINDOW_ATTR = "data-phone-window";
|
|
13185
|
+
var SLIDE_FIRST_VIEW_X_VAR = "--first-view-x";
|
|
13186
|
+
var SLIDE_PRODUCT_X0_VAR = "--product-x0";
|
|
13187
|
+
var SLIDE_PRODUCT_X1_VAR = "--product-x1";
|
|
13188
|
+
var r4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
13189
|
+
function slideFirstViewProps(image) {
|
|
13190
|
+
const { productBox: box, phoneWindow: phone } = image;
|
|
13191
|
+
if (!box && !phone) return {};
|
|
13192
|
+
const centre = phone ? r4(phone.x + phone.w / 2) : r4(box.x + box.w / 2);
|
|
13193
|
+
const x0 = box ? r4(box.x) : centre, x1 = box ? r4(box.x + box.w) : centre;
|
|
13194
|
+
return {
|
|
13195
|
+
[SLIDE_FIRST_VIEW_ATTR]: phone ? "phone-window" : "product",
|
|
13196
|
+
...box ? { [SLIDE_PRODUCT_BOX_ATTR]: [box.x, box.y, box.w, box.h].map(r4).join(",") } : {},
|
|
13197
|
+
...phone ? { [SLIDE_PHONE_WINDOW_ATTR]: [phone.x, phone.w].map(r4).join(",") } : {},
|
|
13198
|
+
style: { [SLIDE_FIRST_VIEW_X_VAR]: String(centre), [SLIDE_PRODUCT_X0_VAR]: String(x0), [SLIDE_PRODUCT_X1_VAR]: String(x1) }
|
|
13199
|
+
};
|
|
13200
|
+
}
|
|
13201
|
+
|
|
13174
13202
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13175
13203
|
var import_react57 = require("react");
|
|
13176
13204
|
|
|
@@ -13764,6 +13792,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13764
13792
|
className: "w-full h-full flex-shrink-0 relative select-none",
|
|
13765
13793
|
"data-gallery-role": image.galleryRole,
|
|
13766
13794
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13795
|
+
...slideFirstViewProps(image.isRealMockup ? image : {}),
|
|
13767
13796
|
children: [
|
|
13768
13797
|
!isWithinDecodeWindow ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13769
13798
|
// Rainbow prism loader (same as the /create route) instead of
|
|
@@ -17291,6 +17320,12 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17291
17320
|
RealtimeProvider,
|
|
17292
17321
|
ResponsiveZoom,
|
|
17293
17322
|
RightToLeftProgressiveBlur,
|
|
17323
|
+
SLIDE_FIRST_VIEW_ATTR,
|
|
17324
|
+
SLIDE_FIRST_VIEW_X_VAR,
|
|
17325
|
+
SLIDE_PHONE_WINDOW_ATTR,
|
|
17326
|
+
SLIDE_PRODUCT_BOX_ATTR,
|
|
17327
|
+
SLIDE_PRODUCT_X0_VAR,
|
|
17328
|
+
SLIDE_PRODUCT_X1_VAR,
|
|
17294
17329
|
SafeImg,
|
|
17295
17330
|
ScrollFade,
|
|
17296
17331
|
SearchBox,
|
|
@@ -17371,6 +17406,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17371
17406
|
runConfigChecks,
|
|
17372
17407
|
scrollInputAboveKeyboard,
|
|
17373
17408
|
searchClient,
|
|
17409
|
+
slideFirstViewProps,
|
|
17374
17410
|
spinnerVariants,
|
|
17375
17411
|
surfaceVariants,
|
|
17376
17412
|
useArtworkAlignment,
|