@snowcone-app/ui 0.10.13 → 0.10.15
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 +17 -0
- package/dist/index.cjs +15 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/composed/carousels/MobileProductCarousel.tsx +3 -4
- package/src/composed/carousels/__tests__/fit.test.ts +16 -0
- package/src/composed/carousels/fit.ts +18 -0
- package/src/personalization/PersonalizationProvider.tsx +7 -3
- package/src/personalization/__tests__/PersonalizationProvider.canvas-import.test.tsx +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#5365](https://github.com/snowcone-app/snowcone-monorepo/pull/5365) [`fd949e6`](https://github.com/snowcone-app/snowcone-monorepo/commit/fd949e6cef3687fd676c866c407da5c37534c674) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Smaller first load for pages that show a canvas or a product.
|
|
8
|
+
- canvas: the print-export Web Worker's code (about 1 MB, 227K gzip) now loads with `import()` on the first export
|
|
9
|
+
instead of with the package, so a page that merely shows an editor or a product no longer downloads it up front.
|
|
10
|
+
Exports work as before; only the first one waits for the code.
|
|
11
|
+
- ui: `PersonalizationProvider` calls `canvasImport` only when the product has personalization fields, so a product
|
|
12
|
+
without them never loads the canvas.
|
|
13
|
+
|
|
14
|
+
## 0.10.14
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#5085](https://github.com/snowcone-app/snowcone-monorepo/pull/5085) [`d804242`](https://github.com/snowcone-app/snowcone-monorepo/commit/d804242f071609a10876118ffcd6465395c6bd32) Thanks [@kevinsproles](https://github.com/kevinsproles)! - `MobileProductCarousel`: the size picture's slide is drawn cropped (cover) like every slide again; the zoom viewer still opens it whole. On a ~342x448 phone hero a whole 16:9 diagram shrank to a letterbox (garment 92-120 px, caption 5 px).
|
|
19
|
+
|
|
3
20
|
## 0.10.13
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -13045,6 +13045,16 @@ function ResponsiveZoom({
|
|
|
13045
13045
|
|
|
13046
13046
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13047
13047
|
var import_react56 = require("react");
|
|
13048
|
+
|
|
13049
|
+
// src/composed/carousels/fit.ts
|
|
13050
|
+
function slideFit(_galleryRole) {
|
|
13051
|
+
return "cover";
|
|
13052
|
+
}
|
|
13053
|
+
function zoomFit(galleryRole) {
|
|
13054
|
+
return galleryRole === "size-picture" ? "whole" : "cover";
|
|
13055
|
+
}
|
|
13056
|
+
|
|
13057
|
+
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13048
13058
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13049
13059
|
function StaticCarouselImage({
|
|
13050
13060
|
src,
|
|
@@ -13644,7 +13654,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13644
13654
|
unavailableText,
|
|
13645
13655
|
className: "w-full h-full object-cover cursor-pointer pointer-events-none",
|
|
13646
13656
|
viewportPolicy: true,
|
|
13647
|
-
fit: image.galleryRole
|
|
13657
|
+
fit: slideFit(image.galleryRole)
|
|
13648
13658
|
}
|
|
13649
13659
|
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13650
13660
|
StaticCarouselImage,
|
|
@@ -13729,7 +13739,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13729
13739
|
alt: img.label,
|
|
13730
13740
|
naturalWidth: img.naturalWidth,
|
|
13731
13741
|
naturalHeight: img.naturalHeight,
|
|
13732
|
-
...img.galleryRole === "
|
|
13742
|
+
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {}
|
|
13733
13743
|
} : null;
|
|
13734
13744
|
}).filter((img) => img !== null);
|
|
13735
13745
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
@@ -16708,9 +16718,10 @@ function PersonalizationProvider({
|
|
|
16708
16718
|
const [BridgeComponent, setBridgeComponent] = (0, import_react69.useState)(
|
|
16709
16719
|
cachedBridgeComponent
|
|
16710
16720
|
);
|
|
16721
|
+
const hasFields = fields.length > 0;
|
|
16711
16722
|
(0, import_react69.useEffect)(() => {
|
|
16712
16723
|
if (CanvasComponent && BridgeComponent) return;
|
|
16713
|
-
if (!canvasImport) return;
|
|
16724
|
+
if (!canvasImport || !hasFields) return;
|
|
16714
16725
|
if (!canvasLoadPromise) {
|
|
16715
16726
|
canvasLoadPromise = canvasImport().then((mod) => {
|
|
16716
16727
|
cachedCanvasComponent = mod.SnowconeCanvas || mod.default;
|
|
@@ -16725,7 +16736,7 @@ function PersonalizationProvider({
|
|
|
16725
16736
|
setBridgeComponent(() => cachedBridgeComponent);
|
|
16726
16737
|
}
|
|
16727
16738
|
});
|
|
16728
|
-
}, [CanvasComponent, BridgeComponent, canvasImport]);
|
|
16739
|
+
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
16729
16740
|
const realtimeEnabledRef = (0, import_react69.useRef)(false);
|
|
16730
16741
|
(0, import_react69.useEffect)(() => {
|
|
16731
16742
|
return () => {
|