@snowcone-app/ui 0.12.0 → 0.12.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.
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +838 -654
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +753 -575
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +45 -3
- package/src/composed/__tests__/HeroProductImage.designRefusal.test.tsx +117 -0
- package/src/composed/carousels/MobileProductCarousel.tsx +7 -2
- package/src/composed/renderRefusalProbe.ts +35 -0
- package/src/index.ts +15 -0
- package/src/patterns/GallerySkip.tsx +113 -0
- package/src/patterns/RealtimeProvider.tsx +46 -0
- package/src/patterns/__tests__/RealtimeProvider.designRefusal.test.tsx +125 -0
- package/src/patterns/__tests__/gallerySkipRules.test.ts +71 -0
- package/src/patterns/gallerySkipRules.ts +57 -0
package/dist/index.js
CHANGED
|
@@ -5631,6 +5631,28 @@ import {
|
|
|
5631
5631
|
import { useRealtimeMockup as useRealtimeMockup2 } from "@snowcone-app/sdk/react";
|
|
5632
5632
|
import { gallerySizePicture, mockupRole, resolvePreviewVariantId, resolveVariantId as resolveVariantIdUtil } from "@snowcone-app/sdk";
|
|
5633
5633
|
|
|
5634
|
+
// src/patterns/gallerySkipRules.ts
|
|
5635
|
+
import { designRefusalKind } from "@snowcone-app/sdk";
|
|
5636
|
+
function gallerySkipVerdict(code, attempt) {
|
|
5637
|
+
const kind = designRefusalKind(code);
|
|
5638
|
+
if (kind === "skip") return "skip";
|
|
5639
|
+
if (kind === "retry-once") return attempt < 1 ? "retry" : "skip";
|
|
5640
|
+
return "loud";
|
|
5641
|
+
}
|
|
5642
|
+
var NO_GALLERY_SKIPS = /* @__PURE__ */ new Map();
|
|
5643
|
+
function galleryWithoutSkipped(images, skipped) {
|
|
5644
|
+
if (skipped.size === 0) return images;
|
|
5645
|
+
const kept = images.filter((img) => !(img.isRealMockup && img.mockupId && skipped.has(img.mockupId)));
|
|
5646
|
+
if (kept.length === images.length || kept.length === 0) return images;
|
|
5647
|
+
return kept;
|
|
5648
|
+
}
|
|
5649
|
+
function gallerySkippedStamp(skipped, shown) {
|
|
5650
|
+
if (skipped.size === 0) return void 0;
|
|
5651
|
+
const shownIds = new Set(shown.map((img) => img.mockupId).filter(Boolean));
|
|
5652
|
+
const parts = [...skipped].filter(([id]) => !shownIds.has(id)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([id, code]) => `${id}:${code}`);
|
|
5653
|
+
return parts.length ? parts.join(" ") : void 0;
|
|
5654
|
+
}
|
|
5655
|
+
|
|
5634
5656
|
// src/patterns/MockupBackground.tsx
|
|
5635
5657
|
import { createContext as createContext7, useContext as useContext5 } from "react";
|
|
5636
5658
|
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
@@ -5811,6 +5833,9 @@ function RealtimeProvider({
|
|
|
5811
5833
|
);
|
|
5812
5834
|
const resetSessionRef = useRef12(() => {
|
|
5813
5835
|
});
|
|
5836
|
+
const designRefusalSubscribersRef = useRef12(/* @__PURE__ */ new Set());
|
|
5837
|
+
const designBusySeenRef = useRef12(/* @__PURE__ */ new Map());
|
|
5838
|
+
const designRetryRef = useRef12(null);
|
|
5814
5839
|
const realtimeMockup = useRealtimeMockup2({
|
|
5815
5840
|
wsUrl,
|
|
5816
5841
|
getToken: useSessionGrant ? getToken : void 0,
|
|
@@ -5851,6 +5876,23 @@ function RealtimeProvider({
|
|
|
5851
5876
|
const id = detail.mockupId;
|
|
5852
5877
|
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
5853
5878
|
}
|
|
5879
|
+
},
|
|
5880
|
+
onDesignRefusal: (refusal) => {
|
|
5881
|
+
const seen = designBusySeenRef.current.get(refusal.mockupId) ?? 0;
|
|
5882
|
+
const verdict = gallerySkipVerdict(refusal.code, seen);
|
|
5883
|
+
if (verdict === "retry") {
|
|
5884
|
+
designBusySeenRef.current.set(refusal.mockupId, seen + 1);
|
|
5885
|
+
designRetryRef.current?.([refusal.mockupId]);
|
|
5886
|
+
return;
|
|
5887
|
+
}
|
|
5888
|
+
if (verdict !== "skip") return;
|
|
5889
|
+
if (designRefusalSubscribersRef.current.size === 0) {
|
|
5890
|
+
const id = refusal.mockupId;
|
|
5891
|
+
const detail = { code: refusal.code, message: refusal.message, mockupId: id };
|
|
5892
|
+
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
5893
|
+
return;
|
|
5894
|
+
}
|
|
5895
|
+
designRefusalSubscribersRef.current.forEach((cb) => cb(refusal));
|
|
5854
5896
|
}
|
|
5855
5897
|
});
|
|
5856
5898
|
const subscribeRTCTiming = useCallback10((_callback) => {
|
|
@@ -6098,6 +6140,7 @@ function RealtimeProvider({
|
|
|
6098
6140
|
},
|
|
6099
6141
|
[rerenderRaw]
|
|
6100
6142
|
);
|
|
6143
|
+
designRetryRef.current = sendRerenderPaced;
|
|
6101
6144
|
const rerenderFullFrame = useCallback10(
|
|
6102
6145
|
(mockupId) => {
|
|
6103
6146
|
fullFrameRerenderIdsRef.current.add(mockupId);
|
|
@@ -6242,6 +6285,7 @@ function RealtimeProvider({
|
|
|
6242
6285
|
else merged.push(result);
|
|
6243
6286
|
});
|
|
6244
6287
|
mockupResultsRef.current = merged;
|
|
6288
|
+
results.forEach((result) => designBusySeenRef.current.delete(result.mockupId));
|
|
6245
6289
|
if (pendingRerenderRef.current.length > 0) {
|
|
6246
6290
|
const delivered = new Set(results.map((r) => r.mockupId));
|
|
6247
6291
|
pendingRerenderRef.current = pendingRerenderRef.current.filter((id) => !delivered.has(id));
|
|
@@ -6506,6 +6550,7 @@ function RealtimeProvider({
|
|
|
6506
6550
|
const resetSession = useCallback10(() => {
|
|
6507
6551
|
configSentRef.current = false;
|
|
6508
6552
|
dueByVersionRef.current.clear();
|
|
6553
|
+
designBusySeenRef.current.clear();
|
|
6509
6554
|
setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
|
|
6510
6555
|
lastSentVariantIdRef.current = null;
|
|
6511
6556
|
lastSentBgRef.current = void 0;
|
|
@@ -6891,6 +6936,13 @@ function RealtimeProvider({
|
|
|
6891
6936
|
subscribeBlobSentRef.current = subscribeBlobSent;
|
|
6892
6937
|
subscribePipelineSettledRef.current = subscribePipelineSettled;
|
|
6893
6938
|
subscribePendingExportCancelledRef.current = subscribePendingExportCancelled;
|
|
6939
|
+
const subscribeDesignRefusals = useCallback10((callback) => {
|
|
6940
|
+
const subscribers = designRefusalSubscribersRef.current;
|
|
6941
|
+
subscribers.add(callback);
|
|
6942
|
+
return () => {
|
|
6943
|
+
subscribers.delete(callback);
|
|
6944
|
+
};
|
|
6945
|
+
}, []);
|
|
6894
6946
|
const stableSubscribeMockupResults = useCallback10(
|
|
6895
6947
|
(callback) => {
|
|
6896
6948
|
return subscribeMockupResultsRef.current(callback);
|
|
@@ -6960,6 +7012,7 @@ function RealtimeProvider({
|
|
|
6960
7012
|
isConfigured,
|
|
6961
7013
|
renderError,
|
|
6962
7014
|
unavailableMockups,
|
|
7015
|
+
subscribeDesignRefusals,
|
|
6963
7016
|
// Read from ref - this is a snapshot at render time, NOT reactive
|
|
6964
7017
|
// For reactive updates, use getMockupResultsImmediate() or subscribe functions
|
|
6965
7018
|
get mockupResults() {
|
|
@@ -7016,6 +7069,7 @@ function RealtimeProvider({
|
|
|
7016
7069
|
isConfigured,
|
|
7017
7070
|
renderError,
|
|
7018
7071
|
unavailableMockups,
|
|
7072
|
+
subscribeDesignRefusals,
|
|
7019
7073
|
// mockupResults removed from deps - it's a getter that reads from ref
|
|
7020
7074
|
canvasExportSize,
|
|
7021
7075
|
mockupWidth,
|
|
@@ -9913,17 +9967,80 @@ var LoadingOverlayPrismCandyInline = memo2(
|
|
|
9913
9967
|
import { useRealtimeMockup as useRealtimeMockup3 } from "@snowcone-app/sdk/react";
|
|
9914
9968
|
import { getProduct as getProduct3, listProducts as listProducts4, getMockupUrl } from "@snowcone-app/sdk";
|
|
9915
9969
|
|
|
9916
|
-
// src/patterns/
|
|
9917
|
-
import { createContext as createContext10, useContext as useContext8, useMemo as useMemo13 } from "react";
|
|
9970
|
+
// src/patterns/GallerySkip.tsx
|
|
9971
|
+
import { createContext as createContext10, useCallback as useCallback18, useContext as useContext8, useEffect as useEffect29, useMemo as useMemo13, useRef as useRef21, useState as useState28 } from "react";
|
|
9918
9972
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
9919
|
-
var
|
|
9973
|
+
var GallerySkipContext = createContext10(void 0);
|
|
9974
|
+
function useGallerySkipState(design) {
|
|
9975
|
+
const realtime = useRealtimeOptional();
|
|
9976
|
+
const [entries, setEntries] = useState28(() => /* @__PURE__ */ new Map());
|
|
9977
|
+
const entriesRef = useRef21(entries);
|
|
9978
|
+
entriesRef.current = entries;
|
|
9979
|
+
const designRef = useRef21(design);
|
|
9980
|
+
designRef.current = design;
|
|
9981
|
+
const getResults = realtime?.getMockupResultsImmediate;
|
|
9982
|
+
const frameOfRef = useRef21((mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null);
|
|
9983
|
+
frameOfRef.current = (mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null;
|
|
9984
|
+
const report = useCallback18((mockupId, code) => {
|
|
9985
|
+
const at = designRef.current;
|
|
9986
|
+
const realtimeUrl = frameOfRef.current(mockupId);
|
|
9987
|
+
setEntries((prev) => {
|
|
9988
|
+
const e = prev.get(mockupId);
|
|
9989
|
+
if (e && e.code === code && e.design === at) return prev;
|
|
9990
|
+
return new Map(prev).set(mockupId, { code, design: at, realtimeUrl });
|
|
9991
|
+
});
|
|
9992
|
+
}, []);
|
|
9993
|
+
const subscribeDesignRefusals = realtime?.subscribeDesignRefusals;
|
|
9994
|
+
useEffect29(() => {
|
|
9995
|
+
if (!subscribeDesignRefusals) return;
|
|
9996
|
+
return subscribeDesignRefusals((refusal) => report(refusal.mockupId, refusal.code));
|
|
9997
|
+
}, [subscribeDesignRefusals, report]);
|
|
9998
|
+
const subscribeMockupResults = realtime?.subscribeMockupResults;
|
|
9999
|
+
useEffect29(() => {
|
|
10000
|
+
if (!subscribeMockupResults) return;
|
|
10001
|
+
return subscribeMockupResults((results) => {
|
|
10002
|
+
const current = entriesRef.current;
|
|
10003
|
+
if (current.size === 0) return;
|
|
10004
|
+
const back = results.filter((r) => {
|
|
10005
|
+
const e = current.get(r.mockupId);
|
|
10006
|
+
if (!e) return false;
|
|
10007
|
+
return !!r.imageUrl && r.imageUrl !== e.realtimeUrl;
|
|
10008
|
+
});
|
|
10009
|
+
if (back.length === 0) return;
|
|
10010
|
+
setEntries((prev) => {
|
|
10011
|
+
const next = new Map(prev);
|
|
10012
|
+
back.forEach((r) => next.delete(r.mockupId));
|
|
10013
|
+
return next;
|
|
10014
|
+
});
|
|
10015
|
+
});
|
|
10016
|
+
}, [subscribeMockupResults]);
|
|
10017
|
+
const skipped = useMemo13(() => {
|
|
10018
|
+
const m = /* @__PURE__ */ new Map();
|
|
10019
|
+
entries.forEach((e, id) => {
|
|
10020
|
+
if (e.design === design) m.set(id, e.code);
|
|
10021
|
+
});
|
|
10022
|
+
return m;
|
|
10023
|
+
}, [entries, design]);
|
|
10024
|
+
return useMemo13(() => ({ skipped, report }), [skipped, report]);
|
|
10025
|
+
}
|
|
10026
|
+
function GallerySkipProvider({ value, children }) {
|
|
10027
|
+
return /* @__PURE__ */ jsx57(GallerySkipContext.Provider, { value, children });
|
|
10028
|
+
}
|
|
10029
|
+
function useGallerySkipOptional() {
|
|
10030
|
+
return useContext8(GallerySkipContext);
|
|
10031
|
+
}
|
|
10032
|
+
|
|
10033
|
+
// src/patterns/PlacementArt.tsx
|
|
10034
|
+
import { createContext as createContext11, useContext as useContext9, useMemo as useMemo14 } from "react";
|
|
10035
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
10036
|
+
var PlacementArtContext = createContext11(null);
|
|
9920
10037
|
function PlacementArt({ art, children }) {
|
|
9921
10038
|
const key = art ? JSON.stringify(art) : "";
|
|
9922
|
-
const value =
|
|
9923
|
-
return /* @__PURE__ */
|
|
10039
|
+
const value = useMemo14(() => key ? JSON.parse(key) : null, [key]);
|
|
10040
|
+
return /* @__PURE__ */ jsx58(PlacementArtContext.Provider, { value, children });
|
|
9924
10041
|
}
|
|
9925
10042
|
function usePlacementArtOptional() {
|
|
9926
|
-
return
|
|
10043
|
+
return useContext9(PlacementArtContext);
|
|
9927
10044
|
}
|
|
9928
10045
|
function placementArtFor(art, placement, fallback) {
|
|
9929
10046
|
if (!art) return fallback;
|
|
@@ -9931,7 +10048,7 @@ function placementArtFor(art, placement, fallback) {
|
|
|
9931
10048
|
}
|
|
9932
10049
|
|
|
9933
10050
|
// src/patterns/ProductPageProvider.tsx
|
|
9934
|
-
import { jsx as
|
|
10051
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
9935
10052
|
function ProductPageProvider({
|
|
9936
10053
|
children,
|
|
9937
10054
|
productId,
|
|
@@ -9945,12 +10062,12 @@ function ProductPageProvider({
|
|
|
9945
10062
|
realtimeGrantUrl,
|
|
9946
10063
|
enablePriority = true
|
|
9947
10064
|
}) {
|
|
9948
|
-
let content = /* @__PURE__ */
|
|
10065
|
+
let content = /* @__PURE__ */ jsx59(Product, { productId, productData, children });
|
|
9949
10066
|
if (enablePriority) {
|
|
9950
|
-
content = /* @__PURE__ */
|
|
10067
|
+
content = /* @__PURE__ */ jsx59(MockupPriorityProvider, { children: content });
|
|
9951
10068
|
}
|
|
9952
10069
|
if (enableRealtime) {
|
|
9953
|
-
content = /* @__PURE__ */
|
|
10070
|
+
content = /* @__PURE__ */ jsx59(
|
|
9954
10071
|
RealtimeProvider,
|
|
9955
10072
|
{
|
|
9956
10073
|
wsUrl: realtimeWsUrl,
|
|
@@ -9960,7 +10077,7 @@ function ProductPageProvider({
|
|
|
9960
10077
|
}
|
|
9961
10078
|
);
|
|
9962
10079
|
}
|
|
9963
|
-
return /* @__PURE__ */
|
|
10080
|
+
return /* @__PURE__ */ jsx59(
|
|
9964
10081
|
Shop,
|
|
9965
10082
|
{
|
|
9966
10083
|
endpoint,
|
|
@@ -9980,31 +10097,31 @@ function ProductPageProviderMinimal({
|
|
|
9980
10097
|
shop,
|
|
9981
10098
|
initialArtwork
|
|
9982
10099
|
}) {
|
|
9983
|
-
return /* @__PURE__ */
|
|
10100
|
+
return /* @__PURE__ */ jsx59(
|
|
9984
10101
|
Shop,
|
|
9985
10102
|
{
|
|
9986
10103
|
endpoint,
|
|
9987
10104
|
mockupUrl,
|
|
9988
10105
|
shop,
|
|
9989
10106
|
initialArtwork,
|
|
9990
|
-
children: /* @__PURE__ */
|
|
10107
|
+
children: /* @__PURE__ */ jsx59(Product, { productId, productData, children })
|
|
9991
10108
|
}
|
|
9992
10109
|
);
|
|
9993
10110
|
}
|
|
9994
10111
|
|
|
9995
10112
|
// src/composed/ArtAlignment.tsx
|
|
9996
10113
|
import {
|
|
9997
|
-
useRef as
|
|
9998
|
-
useState as
|
|
9999
|
-
useEffect as
|
|
10000
|
-
useMemo as
|
|
10114
|
+
useRef as useRef22,
|
|
10115
|
+
useState as useState29,
|
|
10116
|
+
useEffect as useEffect30,
|
|
10117
|
+
useMemo as useMemo15
|
|
10001
10118
|
} from "react";
|
|
10002
10119
|
import { useDrag } from "@use-gesture/react";
|
|
10003
10120
|
import {
|
|
10004
10121
|
describeProductArtAlignment,
|
|
10005
10122
|
getSnapPoints
|
|
10006
10123
|
} from "@snowcone-app/sdk";
|
|
10007
|
-
import { Fragment as Fragment12, jsx as
|
|
10124
|
+
import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10008
10125
|
function ArtAlignment({
|
|
10009
10126
|
src: propSrc,
|
|
10010
10127
|
artworkAspectRatio: propAspectRatio,
|
|
@@ -10038,16 +10155,16 @@ function ArtAlignment({
|
|
|
10038
10155
|
selection: {}
|
|
10039
10156
|
};
|
|
10040
10157
|
}
|
|
10041
|
-
const containerRef =
|
|
10042
|
-
const imageRef =
|
|
10043
|
-
const lastUserDragTimeRef =
|
|
10044
|
-
const [containerSize, setContainerSize] =
|
|
10045
|
-
const [position, setPosition] =
|
|
10046
|
-
const [isReady, setIsReady] =
|
|
10047
|
-
const [detectedAspectRatio, setDetectedAspectRatio] =
|
|
10158
|
+
const containerRef = useRef22(null);
|
|
10159
|
+
const imageRef = useRef22(null);
|
|
10160
|
+
const lastUserDragTimeRef = useRef22(0);
|
|
10161
|
+
const [containerSize, setContainerSize] = useState29({ width: 0, height: 0 });
|
|
10162
|
+
const [position, setPosition] = useState29({ x: 0, y: 0 });
|
|
10163
|
+
const [isReady, setIsReady] = useState29(false);
|
|
10164
|
+
const [detectedAspectRatio, setDetectedAspectRatio] = useState29();
|
|
10048
10165
|
const effectiveAspectRatio = artworkAspectRatio || detectedAspectRatio;
|
|
10049
10166
|
const alignment = placementDesign?.alignment || propAlignment || "center";
|
|
10050
|
-
const descriptor =
|
|
10167
|
+
const descriptor = useMemo15(
|
|
10051
10168
|
() => describeProductArtAlignment(
|
|
10052
10169
|
{
|
|
10053
10170
|
src,
|
|
@@ -10069,7 +10186,7 @@ function ArtAlignment({
|
|
|
10069
10186
|
productContext
|
|
10070
10187
|
]
|
|
10071
10188
|
);
|
|
10072
|
-
const containerStyle =
|
|
10189
|
+
const containerStyle = useMemo15(() => {
|
|
10073
10190
|
const style = {};
|
|
10074
10191
|
if (height !== void 0) {
|
|
10075
10192
|
const heightValue = typeof height === "number" ? height : parseFloat(height);
|
|
@@ -10100,7 +10217,7 @@ function ArtAlignment({
|
|
|
10100
10217
|
}
|
|
10101
10218
|
return style;
|
|
10102
10219
|
}, [effectiveAspectRatio, height, maxHeight, minHeight]);
|
|
10103
|
-
|
|
10220
|
+
useEffect30(() => {
|
|
10104
10221
|
if (!containerRef.current) return;
|
|
10105
10222
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
10106
10223
|
const entry = entries[0];
|
|
@@ -10126,7 +10243,7 @@ function ArtAlignment({
|
|
|
10126
10243
|
}
|
|
10127
10244
|
}
|
|
10128
10245
|
};
|
|
10129
|
-
|
|
10246
|
+
useEffect30(() => {
|
|
10130
10247
|
if (!imageRef.current || !descriptor) return;
|
|
10131
10248
|
if (imageRef.current.complete) {
|
|
10132
10249
|
setIsReady(true);
|
|
@@ -10151,7 +10268,7 @@ function ArtAlignment({
|
|
|
10151
10268
|
img.removeEventListener("load", handleLoad);
|
|
10152
10269
|
};
|
|
10153
10270
|
}, [descriptor?.src, artworkAspectRatio]);
|
|
10154
|
-
const maskDimensions =
|
|
10271
|
+
const maskDimensions = useMemo15(() => {
|
|
10155
10272
|
if (!isReady || containerSize.width === 0 || !descriptor) {
|
|
10156
10273
|
return { width: 0, height: 0 };
|
|
10157
10274
|
}
|
|
@@ -10166,14 +10283,14 @@ function ArtAlignment({
|
|
|
10166
10283
|
descriptor?.effectiveAlignment,
|
|
10167
10284
|
isReady
|
|
10168
10285
|
]);
|
|
10169
|
-
const clipPathCoords =
|
|
10286
|
+
const clipPathCoords = useMemo15(() => {
|
|
10170
10287
|
const halfMaskW = maskDimensions.width / 2;
|
|
10171
10288
|
const halfMaskH = maskDimensions.height / 2;
|
|
10172
10289
|
const halfContainerW = containerSize.width / 2;
|
|
10173
10290
|
const halfContainerH = containerSize.height / 2;
|
|
10174
10291
|
return { halfMaskW, halfMaskH, halfContainerW, halfContainerH };
|
|
10175
10292
|
}, [maskDimensions.width, maskDimensions.height, containerSize.width, containerSize.height]);
|
|
10176
|
-
|
|
10293
|
+
useEffect30(() => {
|
|
10177
10294
|
if (Date.now() - lastUserDragTimeRef.current < 500) return;
|
|
10178
10295
|
if (!isReady || maskDimensions.width === 0 || !descriptor) return;
|
|
10179
10296
|
const points = getSnapPoints(
|
|
@@ -10195,7 +10312,7 @@ function ArtAlignment({
|
|
|
10195
10312
|
maskDimensions.height,
|
|
10196
10313
|
isReady
|
|
10197
10314
|
]);
|
|
10198
|
-
const overlayStyle =
|
|
10315
|
+
const overlayStyle = useMemo15(() => {
|
|
10199
10316
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10200
10317
|
const cx = position.x + halfContainerW;
|
|
10201
10318
|
const cy = position.y + halfContainerH;
|
|
@@ -10216,7 +10333,7 @@ function ArtAlignment({
|
|
|
10216
10333
|
clipPath: isReady ? `polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, ${right}px ${bottom}px, ${right}px ${top}px, ${left}px ${top}px, ${left}px ${bottom}px, ${right}px ${bottom}px)` : "none"
|
|
10217
10334
|
};
|
|
10218
10335
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10219
|
-
const maskStyle =
|
|
10336
|
+
const maskStyle = useMemo15(() => ({
|
|
10220
10337
|
width: `${maskDimensions.width}px`,
|
|
10221
10338
|
height: `${maskDimensions.height}px`,
|
|
10222
10339
|
boxShadow: `0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary)`,
|
|
@@ -10231,7 +10348,7 @@ function ArtAlignment({
|
|
|
10231
10348
|
// GPU acceleration for smoother drag
|
|
10232
10349
|
borderRadius: "var(--radius-image, 4px)"
|
|
10233
10350
|
}), [maskDimensions.width, maskDimensions.height]);
|
|
10234
|
-
const clearImageClipPath =
|
|
10351
|
+
const clearImageClipPath = useMemo15(() => {
|
|
10235
10352
|
if (!isReady) return "none";
|
|
10236
10353
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10237
10354
|
const cx = position.x + halfContainerW;
|
|
@@ -10242,12 +10359,12 @@ function ArtAlignment({
|
|
|
10242
10359
|
const top = cy - halfMaskH;
|
|
10243
10360
|
return `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
|
|
10244
10361
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10245
|
-
const maskTransform =
|
|
10362
|
+
const maskTransform = useMemo15(() => {
|
|
10246
10363
|
return descriptor?.effectiveAlignment === "horizontal" ? `translate(calc(-50% + ${position.x}px), -50%)` : `translate(-50%, calc(-50% + ${position.y}px))`;
|
|
10247
10364
|
}, [descriptor?.effectiveAlignment, position.x, position.y]);
|
|
10248
|
-
const lastContextUpdateTimeRef =
|
|
10249
|
-
const pendingAlignmentRef =
|
|
10250
|
-
const throttleTimeoutRef =
|
|
10365
|
+
const lastContextUpdateTimeRef = useRef22(0);
|
|
10366
|
+
const pendingAlignmentRef = useRef22(null);
|
|
10367
|
+
const throttleTimeoutRef = useRef22(null);
|
|
10251
10368
|
const THROTTLE_MS = 150;
|
|
10252
10369
|
const bind = useDrag(
|
|
10253
10370
|
({ offset: [ox, oy], last }) => {
|
|
@@ -10342,7 +10459,7 @@ function ArtAlignment({
|
|
|
10342
10459
|
if (!descriptor) {
|
|
10343
10460
|
return null;
|
|
10344
10461
|
}
|
|
10345
|
-
return /* @__PURE__ */
|
|
10462
|
+
return /* @__PURE__ */ jsx60(
|
|
10346
10463
|
"div",
|
|
10347
10464
|
{
|
|
10348
10465
|
className: `relative ${className || ""}`,
|
|
@@ -10351,8 +10468,8 @@ function ArtAlignment({
|
|
|
10351
10468
|
width: "fit-content",
|
|
10352
10469
|
maxWidth: "100%"
|
|
10353
10470
|
},
|
|
10354
|
-
children: /* @__PURE__ */
|
|
10355
|
-
/* @__PURE__ */
|
|
10471
|
+
children: /* @__PURE__ */ jsx60("div", { className: "overflow-hidden p-1", children: /* @__PURE__ */ jsxs36("div", { ref: containerRef, className: "relative", style: containerStyle, children: [
|
|
10472
|
+
/* @__PURE__ */ jsx60(
|
|
10356
10473
|
"img",
|
|
10357
10474
|
{
|
|
10358
10475
|
ref: imageRef,
|
|
@@ -10378,8 +10495,8 @@ function ArtAlignment({
|
|
|
10378
10495
|
}
|
|
10379
10496
|
),
|
|
10380
10497
|
isReady && maskDimensions.width > 0 && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
10381
|
-
/* @__PURE__ */
|
|
10382
|
-
/* @__PURE__ */
|
|
10498
|
+
/* @__PURE__ */ jsx60("div", { style: overlayStyle }),
|
|
10499
|
+
/* @__PURE__ */ jsx60(
|
|
10383
10500
|
"img",
|
|
10384
10501
|
{
|
|
10385
10502
|
src: descriptor.src,
|
|
@@ -10407,7 +10524,7 @@ function ArtAlignment({
|
|
|
10407
10524
|
loading: "eager"
|
|
10408
10525
|
}
|
|
10409
10526
|
),
|
|
10410
|
-
/* @__PURE__ */
|
|
10527
|
+
/* @__PURE__ */ jsx60(
|
|
10411
10528
|
"div",
|
|
10412
10529
|
{
|
|
10413
10530
|
...bind(),
|
|
@@ -10424,8 +10541,8 @@ function ArtAlignment({
|
|
|
10424
10541
|
}
|
|
10425
10542
|
|
|
10426
10543
|
// src/composed/ArtworkCustomizer.tsx
|
|
10427
|
-
import { useEffect as
|
|
10428
|
-
import { jsx as
|
|
10544
|
+
import { useEffect as useEffect31 } from "react";
|
|
10545
|
+
import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10429
10546
|
function ArtworkCustomizer(props) {
|
|
10430
10547
|
const designContext = useDesign();
|
|
10431
10548
|
const artwork = props.artwork || designContext.selectedArtwork;
|
|
@@ -10437,7 +10554,7 @@ function ArtworkCustomizer(props) {
|
|
|
10437
10554
|
const placements = productCtx?.product?.placements || [];
|
|
10438
10555
|
const selectedPlacement = productCtx?.selectedPlacement;
|
|
10439
10556
|
const setSelectedPlacement = productCtx?.setSelectedPlacement;
|
|
10440
|
-
|
|
10557
|
+
useEffect31(() => {
|
|
10441
10558
|
if (placements.length > 0 && !selectedPlacement && setSelectedPlacement) {
|
|
10442
10559
|
setSelectedPlacement(placements[0].label);
|
|
10443
10560
|
}
|
|
@@ -10447,13 +10564,13 @@ function ArtworkCustomizer(props) {
|
|
|
10447
10564
|
);
|
|
10448
10565
|
const isColorPlacement = currentPlacement?.type === "color";
|
|
10449
10566
|
const isFitMode = currentPlacement?.defaultScaleMode === "fit";
|
|
10450
|
-
|
|
10567
|
+
useEffect31(() => {
|
|
10451
10568
|
}, [selectedPlacement]);
|
|
10452
10569
|
if (!artwork) {
|
|
10453
|
-
return /* @__PURE__ */
|
|
10570
|
+
return /* @__PURE__ */ jsx61("div", { className: `text-sm text-muted-foreground ${props.className || ""}`, children: "Select artwork to customize" });
|
|
10454
10571
|
}
|
|
10455
10572
|
if (artwork.type === "pattern") {
|
|
10456
|
-
return /* @__PURE__ */
|
|
10573
|
+
return /* @__PURE__ */ jsx61(
|
|
10457
10574
|
TileCount,
|
|
10458
10575
|
{
|
|
10459
10576
|
artwork,
|
|
@@ -10465,7 +10582,7 @@ function ArtworkCustomizer(props) {
|
|
|
10465
10582
|
}
|
|
10466
10583
|
const isCanvasEditorMode = props.mode === "canvas" || !!props.children && props.mode !== "alignment";
|
|
10467
10584
|
return /* @__PURE__ */ jsxs37("div", { className: "flex flex-col gap-4", children: [
|
|
10468
|
-
placements.length > 1 && /* @__PURE__ */
|
|
10585
|
+
placements.length > 1 && /* @__PURE__ */ jsx61("div", { className: "text-sm leading-relaxed", children: placements.map((p) => /* @__PURE__ */ jsx61(
|
|
10469
10586
|
"button",
|
|
10470
10587
|
{
|
|
10471
10588
|
onClick: () => setSelectedPlacement?.(p.label),
|
|
@@ -10474,7 +10591,7 @@ function ArtworkCustomizer(props) {
|
|
|
10474
10591
|
},
|
|
10475
10592
|
p.label
|
|
10476
10593
|
)) }),
|
|
10477
|
-
isColorPlacement ? /* @__PURE__ */
|
|
10594
|
+
isColorPlacement ? /* @__PURE__ */ jsx61(ColorPicker2, { placement: selectedPlacement }) : isFitMode ? null : /* @__PURE__ */ jsx61("div", { className: "relative", children: props.children || /* @__PURE__ */ jsx61(
|
|
10478
10595
|
ArtAlignment,
|
|
10479
10596
|
{
|
|
10480
10597
|
artwork: { src: artwork.src },
|
|
@@ -10495,7 +10612,7 @@ import {
|
|
|
10495
10612
|
Shapes as LucideShapes,
|
|
10496
10613
|
Upload as LucideUpload
|
|
10497
10614
|
} from "lucide-react";
|
|
10498
|
-
import { jsx as
|
|
10615
|
+
import { jsx as jsx62, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
10499
10616
|
var ImageIcon = LucideImage;
|
|
10500
10617
|
var TypeIcon = LucideType;
|
|
10501
10618
|
var ShapesIcon = LucideShapes;
|
|
@@ -10507,54 +10624,77 @@ function CanvasEditor({
|
|
|
10507
10624
|
children
|
|
10508
10625
|
}) {
|
|
10509
10626
|
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-6", children: [
|
|
10510
|
-
/* @__PURE__ */
|
|
10627
|
+
/* @__PURE__ */ jsx62("div", { className: "bg-background border-2 border-border rounded-lg aspect-square overflow-hidden relative", children: children || /* @__PURE__ */ jsx62("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ jsx62("div", { className: "text-muted-foreground text-sm", children: "No editor provided" }) }) }),
|
|
10511
10628
|
/* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-center gap-8 py-2", children: [
|
|
10512
|
-
/* @__PURE__ */
|
|
10629
|
+
/* @__PURE__ */ jsx62(
|
|
10513
10630
|
"button",
|
|
10514
10631
|
{
|
|
10515
10632
|
onClick: onOpenImageGallery,
|
|
10516
10633
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10517
10634
|
"aria-label": "Open image gallery",
|
|
10518
|
-
children: /* @__PURE__ */
|
|
10635
|
+
children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(ImageIcon, { className: "w-6 h-6" }) })
|
|
10519
10636
|
}
|
|
10520
10637
|
),
|
|
10521
|
-
/* @__PURE__ */
|
|
10638
|
+
/* @__PURE__ */ jsx62(
|
|
10522
10639
|
"button",
|
|
10523
10640
|
{
|
|
10524
10641
|
onClick: onOpenTypography,
|
|
10525
10642
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10526
10643
|
"aria-label": "Add text",
|
|
10527
|
-
children: /* @__PURE__ */
|
|
10644
|
+
children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(TypeIcon, { className: "w-6 h-6" }) })
|
|
10528
10645
|
}
|
|
10529
10646
|
),
|
|
10530
|
-
/* @__PURE__ */
|
|
10531
|
-
/* @__PURE__ */
|
|
10647
|
+
/* @__PURE__ */ jsx62("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(ShapesIcon, { className: "w-6 h-6" }) }) }),
|
|
10648
|
+
/* @__PURE__ */ jsx62("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(UploadIcon, { className: "w-6 h-6" }) }) })
|
|
10532
10649
|
] })
|
|
10533
10650
|
] });
|
|
10534
10651
|
}
|
|
10535
10652
|
|
|
10536
10653
|
// src/composed/HeroProductImage.tsx
|
|
10537
10654
|
import {
|
|
10538
|
-
useMemo as
|
|
10539
|
-
useState as
|
|
10540
|
-
useEffect as
|
|
10541
|
-
useRef as
|
|
10655
|
+
useMemo as useMemo16,
|
|
10656
|
+
useState as useState32,
|
|
10657
|
+
useEffect as useEffect33,
|
|
10658
|
+
useRef as useRef24,
|
|
10542
10659
|
memo as memo3,
|
|
10543
|
-
useCallback as
|
|
10660
|
+
useCallback as useCallback19
|
|
10544
10661
|
} from "react";
|
|
10662
|
+
|
|
10663
|
+
// src/composed/renderRefusalProbe.ts
|
|
10664
|
+
import { renderRefusalCodeOf } from "@snowcone-app/sdk";
|
|
10665
|
+
async function probeRenderAnswer(url, fetchImpl = fetch) {
|
|
10666
|
+
let res;
|
|
10667
|
+
try {
|
|
10668
|
+
res = await fetchImpl(url, { mode: "cors", cache: "reload", credentials: "omit" });
|
|
10669
|
+
} catch {
|
|
10670
|
+
return { ok: false, status: 0, code: null };
|
|
10671
|
+
}
|
|
10672
|
+
if (res.ok) return { ok: true, status: res.status, code: null };
|
|
10673
|
+
let body = null;
|
|
10674
|
+
try {
|
|
10675
|
+
const text = await res.text();
|
|
10676
|
+
body = text ? JSON.parse(text) : null;
|
|
10677
|
+
} catch {
|
|
10678
|
+
body = null;
|
|
10679
|
+
}
|
|
10680
|
+
return { ok: false, status: res.status, code: renderRefusalCodeOf(body, res.headers.get("x-render-reason")) };
|
|
10681
|
+
}
|
|
10682
|
+
|
|
10683
|
+
// src/composed/HeroProductImage.tsx
|
|
10545
10684
|
import {
|
|
10546
10685
|
createDesignForPlacements,
|
|
10547
10686
|
resolveVariantId,
|
|
10548
10687
|
resolvePreviewVariantId as resolvePreviewVariantId2,
|
|
10549
10688
|
resolveMockupId,
|
|
10550
|
-
SNOWCONE_HOSTS
|
|
10689
|
+
SNOWCONE_HOSTS,
|
|
10690
|
+
isDesignRefusalCode
|
|
10551
10691
|
} from "@snowcone-app/sdk";
|
|
10552
10692
|
|
|
10553
10693
|
// src/hooks/viewport/useContainerWidth.ts
|
|
10554
|
-
import { useState as
|
|
10694
|
+
import { useState as useState31, useLayoutEffect as useLayoutEffect5, useEffect as useEffect32, useRef as useRef23 } from "react";
|
|
10555
10695
|
function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
10556
|
-
const [width, setWidth] =
|
|
10557
|
-
const resizeTimeoutRef =
|
|
10696
|
+
const [width, setWidth] = useState31(0);
|
|
10697
|
+
const resizeTimeoutRef = useRef23(null);
|
|
10558
10698
|
useLayoutEffect5(() => {
|
|
10559
10699
|
const el = containerRef.current;
|
|
10560
10700
|
if (!el) return;
|
|
@@ -10563,7 +10703,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10563
10703
|
const dpr = window.devicePixelRatio ?? 1;
|
|
10564
10704
|
setWidth(Math.min(Math.round(cssWidth * dpr), maxWidth));
|
|
10565
10705
|
}, [containerRef, maxWidth]);
|
|
10566
|
-
|
|
10706
|
+
useEffect32(() => {
|
|
10567
10707
|
const measure = () => {
|
|
10568
10708
|
const el = containerRef.current;
|
|
10569
10709
|
if (!el) return;
|
|
@@ -10586,7 +10726,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10586
10726
|
}
|
|
10587
10727
|
|
|
10588
10728
|
// src/composed/HeroProductImage.tsx
|
|
10589
|
-
import { jsx as
|
|
10729
|
+
import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
10590
10730
|
function buildHeroMockupUrl(args) {
|
|
10591
10731
|
const snow = typeof window !== "undefined" && window.snowcone || {};
|
|
10592
10732
|
return heroMockupUrl({ ...args, shop: snow.shop, resolver: snow.resolver });
|
|
@@ -10602,6 +10742,7 @@ function heroSize(stripView, cropWidth, width) {
|
|
|
10602
10742
|
return { width };
|
|
10603
10743
|
}
|
|
10604
10744
|
var EMPTY_IMAGES = [];
|
|
10745
|
+
var DESIGN_BUSY_RETRY_MS = 1500;
|
|
10605
10746
|
function blockingSessionError(error) {
|
|
10606
10747
|
return error && !error.retryable ? error.code : null;
|
|
10607
10748
|
}
|
|
@@ -10655,28 +10796,31 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10655
10796
|
const mockupBg = useMockupBackgroundOptional();
|
|
10656
10797
|
const placementArt = usePlacementArtOptional();
|
|
10657
10798
|
const placementArtKey = placementArt ? JSON.stringify(placementArt) : "";
|
|
10658
|
-
const
|
|
10799
|
+
const gallerySkip = useGallerySkipOptional();
|
|
10800
|
+
const gallerySkipRef = useRef24(gallerySkip);
|
|
10801
|
+
gallerySkipRef.current = gallerySkip;
|
|
10802
|
+
const priorityContextRef = useRef24(priorityContext);
|
|
10659
10803
|
priorityContextRef.current = priorityContext;
|
|
10660
|
-
const contextRef =
|
|
10804
|
+
const contextRef = useRef24(context);
|
|
10661
10805
|
contextRef.current = context;
|
|
10662
10806
|
const actualProductId = product?.id || productId || context?.product?.id;
|
|
10663
|
-
const selectedGvid =
|
|
10807
|
+
const selectedGvid = useMemo16(() => {
|
|
10664
10808
|
return resolveVariantId(context, gvid, variantId);
|
|
10665
10809
|
}, [gvid, variantId, context?.selection, context?.combinations]);
|
|
10666
|
-
const actualMockupId =
|
|
10810
|
+
const actualMockupId = useMemo16(() => {
|
|
10667
10811
|
return resolveMockupId(context, selectedGvid, mockupId);
|
|
10668
10812
|
}, [mockupId, selectedGvid, context]);
|
|
10669
|
-
const actualGvid =
|
|
10813
|
+
const actualGvid = useMemo16(() => {
|
|
10670
10814
|
return gvid || variantId ? selectedGvid : resolvePreviewVariantId2(context, selectedGvid, actualMockupId);
|
|
10671
10815
|
}, [gvid, variantId, selectedGvid, actualMockupId, context]);
|
|
10672
10816
|
const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
|
|
10673
10817
|
const artworkSrc = artwork?.src;
|
|
10674
10818
|
const selectedArtworkSrc = designContext?.selectedArtwork?.src;
|
|
10675
10819
|
const effectiveArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
10676
|
-
const containerRef =
|
|
10820
|
+
const containerRef = useRef24(null);
|
|
10677
10821
|
const measuredWidth = useContainerWidth(containerRef);
|
|
10678
10822
|
const width = widthProp ?? measuredWidth;
|
|
10679
|
-
const initialStaticUrl =
|
|
10823
|
+
const initialStaticUrl = useMemo16(() => {
|
|
10680
10824
|
if (realtimeUrl) return null;
|
|
10681
10825
|
if (mode === "realtime") return null;
|
|
10682
10826
|
if (typeof window !== "undefined" && window.snowcone?.signMockupUrl) {
|
|
@@ -10747,31 +10891,31 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10747
10891
|
shimmerDelay,
|
|
10748
10892
|
initialUrl: realtimeUrl || initialStaticUrl
|
|
10749
10893
|
});
|
|
10750
|
-
const [error, setError] =
|
|
10751
|
-
const [isInPreloadZone, setIsInPreloadZone] =
|
|
10752
|
-
const componentIdRef =
|
|
10894
|
+
const [error, setError] = useState32(null);
|
|
10895
|
+
const [isInPreloadZone, setIsInPreloadZone] = useState32(true);
|
|
10896
|
+
const componentIdRef = useRef24(
|
|
10753
10897
|
`hero-product-image-${Math.random().toString(36).substr(2, 9)}`
|
|
10754
10898
|
);
|
|
10755
|
-
const [containerMounted, setContainerMounted] =
|
|
10756
|
-
const setContainerRef =
|
|
10899
|
+
const [containerMounted, setContainerMounted] = useState32(false);
|
|
10900
|
+
const setContainerRef = useCallback19((node) => {
|
|
10757
10901
|
containerRef.current = node;
|
|
10758
10902
|
setContainerMounted(!!node);
|
|
10759
10903
|
}, []);
|
|
10760
|
-
const lastUrlRef =
|
|
10761
|
-
const priorityRegisteredRef =
|
|
10762
|
-
const onLoadCalledRef =
|
|
10763
|
-
const prevArtworkSrcRef =
|
|
10764
|
-
const realtimeArtworkSrcRef =
|
|
10765
|
-
const hasReceivedRealtimeRef =
|
|
10766
|
-
const isPendingExportRef =
|
|
10767
|
-
const onUrlGeneratedRef =
|
|
10904
|
+
const lastUrlRef = useRef24(realtimeUrl ?? initialStaticUrl ?? null);
|
|
10905
|
+
const priorityRegisteredRef = useRef24(false);
|
|
10906
|
+
const onLoadCalledRef = useRef24(false);
|
|
10907
|
+
const prevArtworkSrcRef = useRef24(void 0);
|
|
10908
|
+
const realtimeArtworkSrcRef = useRef24(void 0);
|
|
10909
|
+
const hasReceivedRealtimeRef = useRef24(false);
|
|
10910
|
+
const isPendingExportRef = useRef24(false);
|
|
10911
|
+
const onUrlGeneratedRef = useRef24(onUrlGenerated);
|
|
10768
10912
|
onUrlGeneratedRef.current = onUrlGenerated;
|
|
10769
|
-
const onShownRef =
|
|
10913
|
+
const onShownRef = useRef24(onShown);
|
|
10770
10914
|
onShownRef.current = onShown;
|
|
10771
|
-
const presignedUsedRef =
|
|
10772
|
-
const layersLengthRef =
|
|
10915
|
+
const presignedUsedRef = useRef24(false);
|
|
10916
|
+
const layersLengthRef = useRef24(layers.length);
|
|
10773
10917
|
layersLengthRef.current = layers.length;
|
|
10774
|
-
|
|
10918
|
+
useEffect33(() => {
|
|
10775
10919
|
if (initialPriority === 1) return;
|
|
10776
10920
|
if (!containerMounted || !containerRef.current) return;
|
|
10777
10921
|
if (isInPreloadZone) return;
|
|
@@ -10790,7 +10934,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10790
10934
|
);
|
|
10791
10935
|
return unobserve;
|
|
10792
10936
|
}, [containerMounted, initialPriority, isInPreloadZone]);
|
|
10793
|
-
|
|
10937
|
+
useEffect33(() => {
|
|
10794
10938
|
if (!realtimeUrl) return;
|
|
10795
10939
|
if (realtimeUrl === lastUrlRef.current) return;
|
|
10796
10940
|
lastUrlRef.current = realtimeUrl;
|
|
@@ -10798,7 +10942,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10798
10942
|
const isInitialLoad = layersLengthRef.current === 0;
|
|
10799
10943
|
addLayerDirectly(realtimeUrl, { skipTransition: isInitialLoad });
|
|
10800
10944
|
}, [realtimeUrl, addLayerDirectly, actualMockupId, placement]);
|
|
10801
|
-
|
|
10945
|
+
useEffect33(() => {
|
|
10802
10946
|
if (mode === "static") {
|
|
10803
10947
|
return;
|
|
10804
10948
|
}
|
|
@@ -10842,7 +10986,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10842
10986
|
addLayerDirectly
|
|
10843
10987
|
// NOTE: layers.length removed - use layersLengthRef instead to prevent duplicate requests
|
|
10844
10988
|
]);
|
|
10845
|
-
|
|
10989
|
+
useEffect33(() => {
|
|
10846
10990
|
if (mode === "static") return;
|
|
10847
10991
|
if (!realtimeContext?.subscribePendingBlob || !placement) return;
|
|
10848
10992
|
const handlePendingExport = (pendingPlacement) => {
|
|
@@ -10855,38 +10999,38 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10855
10999
|
unsubscribe?.();
|
|
10856
11000
|
};
|
|
10857
11001
|
}, [mode, realtimeContext?.subscribePendingBlob, placement]);
|
|
10858
|
-
const renderVersionRef =
|
|
10859
|
-
const arrivedVersionRef =
|
|
10860
|
-
const versionByUrlRef =
|
|
10861
|
-
const loadedUrlRef =
|
|
10862
|
-
const blobConsumerRef =
|
|
11002
|
+
const renderVersionRef = useRef24(0);
|
|
11003
|
+
const arrivedVersionRef = useRef24(0);
|
|
11004
|
+
const versionByUrlRef = useRef24(/* @__PURE__ */ new Map());
|
|
11005
|
+
const loadedUrlRef = useRef24(null);
|
|
11006
|
+
const blobConsumerRef = useRef24(`el-${Math.random().toString(36).slice(2, 10)}`);
|
|
10863
11007
|
const releaseBlobConsumer = realtimeContext?.releaseBlobConsumer;
|
|
10864
|
-
|
|
11008
|
+
useEffect33(() => {
|
|
10865
11009
|
const id = actualMockupId;
|
|
10866
11010
|
const consumer = blobConsumerRef.current;
|
|
10867
11011
|
return () => {
|
|
10868
11012
|
if (id) releaseBlobConsumer?.(id, consumer);
|
|
10869
11013
|
};
|
|
10870
11014
|
}, [actualMockupId, releaseBlobConsumer]);
|
|
10871
|
-
const frameErrorRef =
|
|
10872
|
-
const showVersionOf =
|
|
11015
|
+
const frameErrorRef = useRef24(null);
|
|
11016
|
+
const showVersionOf = useCallback19((url) => {
|
|
10873
11017
|
const e = versionByUrlRef.current.get(url);
|
|
10874
11018
|
if (!e || e.v < renderVersionRef.current) return;
|
|
10875
11019
|
renderVersionRef.current = e.v;
|
|
10876
11020
|
renderVersionsRef.current = e.versions;
|
|
10877
11021
|
frameErrorRef.current = null;
|
|
10878
11022
|
}, []);
|
|
10879
|
-
const renderVersionsRef =
|
|
11023
|
+
const renderVersionsRef = useRef24(null);
|
|
10880
11024
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
10881
|
-
const refusalCodeRef =
|
|
11025
|
+
const refusalCodeRef = useRef24(null);
|
|
10882
11026
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
10883
|
-
const frameFailedRef =
|
|
11027
|
+
const frameFailedRef = useRef24(realtimeContext?.frameFailed);
|
|
10884
11028
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
10885
|
-
const sessionErrorCodeRef =
|
|
11029
|
+
const sessionErrorCodeRef = useRef24(null);
|
|
10886
11030
|
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
10887
11031
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
10888
11032
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
10889
|
-
const applyRenderStamp =
|
|
11033
|
+
const applyRenderStamp = useCallback19(() => {
|
|
10890
11034
|
const node = containerRef.current;
|
|
10891
11035
|
if (!node) return;
|
|
10892
11036
|
if (mode === "static") {
|
|
@@ -10920,12 +11064,12 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10920
11064
|
node.dataset.sessionPhase = shape.phase;
|
|
10921
11065
|
}
|
|
10922
11066
|
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
10923
|
-
const applyRenderStampRef =
|
|
11067
|
+
const applyRenderStampRef = useRef24(applyRenderStamp);
|
|
10924
11068
|
applyRenderStampRef.current = applyRenderStamp;
|
|
10925
|
-
|
|
11069
|
+
useEffect33(() => {
|
|
10926
11070
|
applyRenderStamp();
|
|
10927
11071
|
});
|
|
10928
|
-
|
|
11072
|
+
useEffect33(() => {
|
|
10929
11073
|
const subscribeSent = realtimeContext?.subscribeBlobSent;
|
|
10930
11074
|
const subscribeResult = realtimeContext?.subscribeMockupResultById;
|
|
10931
11075
|
if (!actualMockupId || !subscribeSent || !subscribeResult) return;
|
|
@@ -10952,7 +11096,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10952
11096
|
applyRenderStamp
|
|
10953
11097
|
]);
|
|
10954
11098
|
const reportPictureView = realtimeContext?.reportPictureView;
|
|
10955
|
-
|
|
11099
|
+
useEffect33(() => {
|
|
10956
11100
|
if (!viewportPolicy || !reportPictureView || !actualMockupId) return;
|
|
10957
11101
|
const node = containerRef.current;
|
|
10958
11102
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
@@ -10984,7 +11128,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10984
11128
|
reportPictureView(key, null);
|
|
10985
11129
|
};
|
|
10986
11130
|
}, [viewportPolicy, reportPictureView, actualMockupId]);
|
|
10987
|
-
|
|
11131
|
+
useEffect33(() => {
|
|
10988
11132
|
if (!priorityContext || !actualMockupId || !placement) return;
|
|
10989
11133
|
priorityContext.registerMockup(actualMockupId, placement, initialPriority);
|
|
10990
11134
|
priorityRegisteredRef.current = true;
|
|
@@ -10995,7 +11139,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10995
11139
|
}
|
|
10996
11140
|
};
|
|
10997
11141
|
}, [priorityContext, actualMockupId, placement, initialPriority]);
|
|
10998
|
-
|
|
11142
|
+
useEffect33(() => {
|
|
10999
11143
|
if (!priorityContext?.updateElementRef || !actualMockupId) return;
|
|
11000
11144
|
if (containerMounted && containerRef.current) {
|
|
11001
11145
|
priorityContext.updateElementRef(actualMockupId, containerRef.current);
|
|
@@ -11009,7 +11153,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11009
11153
|
const artworkTileCount = artwork?.type === "pattern" ? artwork?.tileCount : void 0;
|
|
11010
11154
|
const selectedArtworkType = designContext?.selectedArtwork?.type;
|
|
11011
11155
|
const selectedArtworkTileCount = designContext?.selectedArtwork?.type === "pattern" ? designContext?.selectedArtwork?.tileCount : void 0;
|
|
11012
|
-
|
|
11156
|
+
useEffect33(() => {
|
|
11013
11157
|
const currentSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11014
11158
|
if (currentSrc !== prevArtworkSrcRef.current) {
|
|
11015
11159
|
lastUrlRef.current = null;
|
|
@@ -11019,11 +11163,11 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11019
11163
|
realtimeArtworkSrcRef.current = void 0;
|
|
11020
11164
|
}
|
|
11021
11165
|
}, [artworkSrc, selectedArtworkSrc, placementArtKey]);
|
|
11022
|
-
const contextSelectionRef =
|
|
11023
|
-
const contextOptionAttributesRef =
|
|
11166
|
+
const contextSelectionRef = useRef24(context?.selection);
|
|
11167
|
+
const contextOptionAttributesRef = useRef24(context?.optionAttributes);
|
|
11024
11168
|
contextSelectionRef.current = context?.selection;
|
|
11025
11169
|
contextOptionAttributesRef.current = context?.optionAttributes;
|
|
11026
|
-
const createDesignForPlacementsWrapper =
|
|
11170
|
+
const createDesignForPlacementsWrapper = useCallback19(
|
|
11027
11171
|
(placements, providedImages) => {
|
|
11028
11172
|
const effectiveArtworkSrc2 = artworkSrc || selectedArtworkSrc;
|
|
11029
11173
|
if (!effectiveArtworkSrc2 || effectiveArtworkSrc2.trim() === "" || effectiveArtworkSrc2 === "undefined" || effectiveArtworkSrc2 === "null") {
|
|
@@ -11063,7 +11207,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11063
11207
|
selectedArtworkTileCount
|
|
11064
11208
|
]
|
|
11065
11209
|
);
|
|
11066
|
-
|
|
11210
|
+
useEffect33(() => {
|
|
11067
11211
|
if (mode === "realtime") return;
|
|
11068
11212
|
if (initialStaticUrl && lastUrlRef.current === initialStaticUrl) {
|
|
11069
11213
|
return;
|
|
@@ -11171,12 +11315,15 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11171
11315
|
const topLayer = layers[layers.length - 1];
|
|
11172
11316
|
const displayUrl = topLayer?.url || realtimeUrl || initialStaticUrl;
|
|
11173
11317
|
const CROSSFADE_MS = 400;
|
|
11174
|
-
const [prevUrl, setPrevUrl] =
|
|
11175
|
-
const [showNew, setShowNew] =
|
|
11176
|
-
const [renderedUrl, setRenderedUrl] =
|
|
11177
|
-
const
|
|
11178
|
-
|
|
11179
|
-
const [
|
|
11318
|
+
const [prevUrl, setPrevUrl] = useState32(null);
|
|
11319
|
+
const [showNew, setShowNew] = useState32(false);
|
|
11320
|
+
const [renderedUrl, setRenderedUrl] = useState32(displayUrl);
|
|
11321
|
+
const renderedUrlRef = useRef24(renderedUrl);
|
|
11322
|
+
renderedUrlRef.current = renderedUrl;
|
|
11323
|
+
const [designRefused, setDesignRefused] = useState32(null);
|
|
11324
|
+
const [firstImageLoaded, setFirstImageLoaded] = useState32(false);
|
|
11325
|
+
const [loaderMounted, setLoaderMounted] = useState32(true);
|
|
11326
|
+
const [imgFailed, setImgFailed] = useState32(false);
|
|
11180
11327
|
const failedSrc = (() => {
|
|
11181
11328
|
if (!imgFailed || !renderedUrl) return void 0;
|
|
11182
11329
|
try {
|
|
@@ -11186,15 +11333,16 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11186
11333
|
return "?";
|
|
11187
11334
|
}
|
|
11188
11335
|
})();
|
|
11189
|
-
const [retryNonce, setRetryNonce] =
|
|
11190
|
-
const retriedUrlRef =
|
|
11191
|
-
const prevDisplayUrlRef =
|
|
11192
|
-
const signHintShownRef =
|
|
11193
|
-
|
|
11336
|
+
const [retryNonce, setRetryNonce] = useState32(0);
|
|
11337
|
+
const retriedUrlRef = useRef24(null);
|
|
11338
|
+
const prevDisplayUrlRef = useRef24(displayUrl);
|
|
11339
|
+
const signHintShownRef = useRef24(false);
|
|
11340
|
+
useEffect33(() => {
|
|
11194
11341
|
if (!displayUrl || displayUrl === prevDisplayUrlRef.current) return;
|
|
11195
11342
|
const oldUrl = prevDisplayUrlRef.current;
|
|
11196
11343
|
prevDisplayUrlRef.current = displayUrl;
|
|
11197
11344
|
setImgFailed(false);
|
|
11345
|
+
setDesignRefused(null);
|
|
11198
11346
|
retriedUrlRef.current = null;
|
|
11199
11347
|
if (!oldUrl) {
|
|
11200
11348
|
setRenderedUrl(displayUrl);
|
|
@@ -11223,26 +11371,26 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11223
11371
|
preload.onerror = null;
|
|
11224
11372
|
};
|
|
11225
11373
|
}, [displayUrl]);
|
|
11226
|
-
const handleCrossfadeEnd =
|
|
11374
|
+
const handleCrossfadeEnd = useCallback19(() => {
|
|
11227
11375
|
setPrevUrl(null);
|
|
11228
11376
|
setShowNew(false);
|
|
11229
11377
|
}, []);
|
|
11230
|
-
const handleLoaderExited =
|
|
11378
|
+
const handleLoaderExited = useCallback19(() => setLoaderMounted(false), []);
|
|
11231
11379
|
if (!hasArtwork) {
|
|
11232
|
-
return /* @__PURE__ */
|
|
11380
|
+
return /* @__PURE__ */ jsx63(
|
|
11233
11381
|
"div",
|
|
11234
11382
|
{
|
|
11235
11383
|
className: `bg-gray-100 flex items-center justify-center ${className || ""}`,
|
|
11236
11384
|
style,
|
|
11237
11385
|
children: /* @__PURE__ */ jsxs39("div", { className: "text-gray-400 text-center p-4", children: [
|
|
11238
|
-
/* @__PURE__ */
|
|
11386
|
+
/* @__PURE__ */ jsx63(
|
|
11239
11387
|
"svg",
|
|
11240
11388
|
{
|
|
11241
11389
|
className: "w-8 h-8 mx-auto mb-2",
|
|
11242
11390
|
fill: "none",
|
|
11243
11391
|
stroke: "currentColor",
|
|
11244
11392
|
viewBox: "0 0 24 24",
|
|
11245
|
-
children: /* @__PURE__ */
|
|
11393
|
+
children: /* @__PURE__ */ jsx63(
|
|
11246
11394
|
"path",
|
|
11247
11395
|
{
|
|
11248
11396
|
strokeLinecap: "round",
|
|
@@ -11253,18 +11401,18 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11253
11401
|
)
|
|
11254
11402
|
}
|
|
11255
11403
|
),
|
|
11256
|
-
/* @__PURE__ */
|
|
11404
|
+
/* @__PURE__ */ jsx63("p", { className: "text-xs", children: emptyText })
|
|
11257
11405
|
] })
|
|
11258
11406
|
}
|
|
11259
11407
|
);
|
|
11260
11408
|
}
|
|
11261
11409
|
if (error) {
|
|
11262
|
-
return /* @__PURE__ */
|
|
11410
|
+
return /* @__PURE__ */ jsx63(
|
|
11263
11411
|
"div",
|
|
11264
11412
|
{
|
|
11265
11413
|
className: `bg-red-50 flex items-center justify-center ${className || ""}`,
|
|
11266
11414
|
style,
|
|
11267
|
-
children: /* @__PURE__ */
|
|
11415
|
+
children: /* @__PURE__ */ jsx63("div", { className: "text-red-600 text-center p-4", children: /* @__PURE__ */ jsx63("p", { className: "text-xs", children: errorText }) })
|
|
11268
11416
|
}
|
|
11269
11417
|
);
|
|
11270
11418
|
}
|
|
@@ -11283,8 +11431,9 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11283
11431
|
"data-picture-failed": imgFailed ? "E_PICTURE_UNDISPLAYED" : void 0,
|
|
11284
11432
|
"data-picture-failed-src": failedSrc,
|
|
11285
11433
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|
|
11434
|
+
"data-design-refused": designRefused ?? void 0,
|
|
11286
11435
|
children: [
|
|
11287
|
-
unavailable && /* @__PURE__ */
|
|
11436
|
+
unavailable && /* @__PURE__ */ jsx63(
|
|
11288
11437
|
"div",
|
|
11289
11438
|
{
|
|
11290
11439
|
role: "status",
|
|
@@ -11293,7 +11442,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11293
11442
|
children: "Mockup unavailable"
|
|
11294
11443
|
}
|
|
11295
11444
|
),
|
|
11296
|
-
renderedUrl && !imgFailed && /* @__PURE__ */
|
|
11445
|
+
renderedUrl && !imgFailed && /* @__PURE__ */ jsx63(
|
|
11297
11446
|
"img",
|
|
11298
11447
|
{
|
|
11299
11448
|
alt: `Product mockup${placement ? ` - ${placement}` : ""}`,
|
|
@@ -11323,8 +11472,29 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11323
11472
|
onError: () => {
|
|
11324
11473
|
if (renderedUrl && retriedUrlRef.current !== renderedUrl) {
|
|
11325
11474
|
retriedUrlRef.current = renderedUrl;
|
|
11326
|
-
|
|
11327
|
-
|
|
11475
|
+
const url = renderedUrl;
|
|
11476
|
+
const mockupIdNow = actualMockupId;
|
|
11477
|
+
void (async () => {
|
|
11478
|
+
let answer = await probeRenderAnswer(url);
|
|
11479
|
+
let verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 0);
|
|
11480
|
+
if (verdict === "retry") {
|
|
11481
|
+
await new Promise((r) => setTimeout(r, DESIGN_BUSY_RETRY_MS));
|
|
11482
|
+
if (renderedUrlRef.current !== url) return;
|
|
11483
|
+
answer = await probeRenderAnswer(url);
|
|
11484
|
+
verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 1);
|
|
11485
|
+
}
|
|
11486
|
+
if (renderedUrlRef.current !== url) return;
|
|
11487
|
+
if (verdict === "skip" && isDesignRefusalCode(answer.code)) {
|
|
11488
|
+
setDesignRefused(answer.code);
|
|
11489
|
+
const skip = gallerySkipRef.current;
|
|
11490
|
+
if (skip && mockupIdNow) {
|
|
11491
|
+
skip.report(mockupIdNow, answer.code);
|
|
11492
|
+
realtimeContext?.frameFailed?.(url);
|
|
11493
|
+
return;
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
setRetryNonce((n) => n + 1);
|
|
11497
|
+
})();
|
|
11328
11498
|
return;
|
|
11329
11499
|
}
|
|
11330
11500
|
setImgFailed(true);
|
|
@@ -11342,8 +11512,8 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11342
11512
|
},
|
|
11343
11513
|
retryNonce
|
|
11344
11514
|
),
|
|
11345
|
-
imgFailed && !prevUrl && /* @__PURE__ */
|
|
11346
|
-
realtimeContext?.renderError && /* @__PURE__ */
|
|
11515
|
+
imgFailed && !prevUrl && /* @__PURE__ */ jsx63("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ jsx63("p", { className: "text-muted-foreground text-xs", children: unavailableText }) }),
|
|
11516
|
+
realtimeContext?.renderError && /* @__PURE__ */ jsx63(
|
|
11347
11517
|
"div",
|
|
11348
11518
|
{
|
|
11349
11519
|
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
@@ -11353,7 +11523,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11353
11523
|
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11354
11524
|
}
|
|
11355
11525
|
),
|
|
11356
|
-
prevUrl && /* @__PURE__ */
|
|
11526
|
+
prevUrl && /* @__PURE__ */ jsx63(
|
|
11357
11527
|
"img",
|
|
11358
11528
|
{
|
|
11359
11529
|
alt: "",
|
|
@@ -11368,7 +11538,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11368
11538
|
onTransitionEnd: handleCrossfadeEnd
|
|
11369
11539
|
}
|
|
11370
11540
|
),
|
|
11371
|
-
loaderMounted && /* @__PURE__ */
|
|
11541
|
+
loaderMounted && /* @__PURE__ */ jsx63(
|
|
11372
11542
|
LoadingOverlayPrismCandyInline,
|
|
11373
11543
|
{
|
|
11374
11544
|
visible: !firstImageLoaded,
|
|
@@ -11382,16 +11552,16 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11382
11552
|
});
|
|
11383
11553
|
|
|
11384
11554
|
// src/composed/SafeImg.tsx
|
|
11385
|
-
import
|
|
11386
|
-
import { Fragment as Fragment13, jsx as
|
|
11387
|
-
var SafeImg =
|
|
11555
|
+
import React47, { useEffect as useEffect34, useState as useState33 } from "react";
|
|
11556
|
+
import { Fragment as Fragment13, jsx as jsx64 } from "react/jsx-runtime";
|
|
11557
|
+
var SafeImg = React47.forwardRef(
|
|
11388
11558
|
function SafeImg2({ fallback = null, onError, src, ...rest }, ref) {
|
|
11389
|
-
const [failed, setFailed] =
|
|
11390
|
-
|
|
11559
|
+
const [failed, setFailed] = useState33(false);
|
|
11560
|
+
useEffect34(() => {
|
|
11391
11561
|
setFailed(false);
|
|
11392
11562
|
}, [src]);
|
|
11393
|
-
if (failed) return /* @__PURE__ */
|
|
11394
|
-
return /* @__PURE__ */
|
|
11563
|
+
if (failed) return /* @__PURE__ */ jsx64(Fragment13, { children: fallback });
|
|
11564
|
+
return /* @__PURE__ */ jsx64(
|
|
11395
11565
|
"img",
|
|
11396
11566
|
{
|
|
11397
11567
|
...rest,
|
|
@@ -11429,11 +11599,11 @@ var { searchClient } = instantMeiliSearch(
|
|
|
11429
11599
|
);
|
|
11430
11600
|
|
|
11431
11601
|
// src/composed/search/SearchProvider.tsx
|
|
11432
|
-
import { useEffect as
|
|
11433
|
-
import { jsx as
|
|
11602
|
+
import { useEffect as useEffect35 } from "react";
|
|
11603
|
+
import { jsx as jsx65, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11434
11604
|
function InitialSearchTrigger() {
|
|
11435
11605
|
const { refine } = useSearchBox();
|
|
11436
|
-
|
|
11606
|
+
useEffect35(() => {
|
|
11437
11607
|
refine("");
|
|
11438
11608
|
}, [refine]);
|
|
11439
11609
|
return null;
|
|
@@ -11485,7 +11655,7 @@ function SearchProvider({
|
|
|
11485
11655
|
}
|
|
11486
11656
|
},
|
|
11487
11657
|
children: [
|
|
11488
|
-
/* @__PURE__ */
|
|
11658
|
+
/* @__PURE__ */ jsx65(
|
|
11489
11659
|
Configure,
|
|
11490
11660
|
{
|
|
11491
11661
|
hitsPerPage,
|
|
@@ -11494,7 +11664,7 @@ function SearchProvider({
|
|
|
11494
11664
|
attributesToRetrieve
|
|
11495
11665
|
}
|
|
11496
11666
|
),
|
|
11497
|
-
/* @__PURE__ */
|
|
11667
|
+
/* @__PURE__ */ jsx65(InitialSearchTrigger, {}),
|
|
11498
11668
|
children
|
|
11499
11669
|
]
|
|
11500
11670
|
}
|
|
@@ -11504,17 +11674,17 @@ function SearchProvider({
|
|
|
11504
11674
|
// src/composed/search/SearchBox.tsx
|
|
11505
11675
|
import { useSearchBox as useSearchBox2 } from "react-instantsearch";
|
|
11506
11676
|
import { Search, X } from "lucide-react";
|
|
11507
|
-
import { useEffect as
|
|
11508
|
-
import { jsx as
|
|
11677
|
+
import { useEffect as useEffect36, useRef as useRef25, useState as useState34 } from "react";
|
|
11678
|
+
import { jsx as jsx66, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
11509
11679
|
function SearchBox() {
|
|
11510
11680
|
const { query, refine, clear } = useSearchBox2();
|
|
11511
11681
|
const searchParams = useUiSearchParams();
|
|
11512
11682
|
const router = useUiRouter();
|
|
11513
|
-
const inputRef =
|
|
11514
|
-
const [showShimmer, setShowShimmer] =
|
|
11683
|
+
const inputRef = useRef25(null);
|
|
11684
|
+
const [showShimmer, setShowShimmer] = useState34(false);
|
|
11515
11685
|
const inputId = "search-products-input";
|
|
11516
11686
|
const descriptionId = "search-description";
|
|
11517
|
-
|
|
11687
|
+
useEffect36(() => {
|
|
11518
11688
|
const handleSpotlight = () => {
|
|
11519
11689
|
inputRef.current?.focus();
|
|
11520
11690
|
inputRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -11524,7 +11694,7 @@ function SearchBox() {
|
|
|
11524
11694
|
window.addEventListener("search-spotlight", handleSpotlight);
|
|
11525
11695
|
return () => window.removeEventListener("search-spotlight", handleSpotlight);
|
|
11526
11696
|
}, []);
|
|
11527
|
-
|
|
11697
|
+
useEffect36(() => {
|
|
11528
11698
|
const shouldFocus = searchParams.get("focus") === "search";
|
|
11529
11699
|
if (shouldFocus && inputRef.current) {
|
|
11530
11700
|
const timer = setTimeout(() => {
|
|
@@ -11539,8 +11709,8 @@ function SearchBox() {
|
|
|
11539
11709
|
return () => clearTimeout(timer);
|
|
11540
11710
|
}
|
|
11541
11711
|
}, [searchParams, router]);
|
|
11542
|
-
return /* @__PURE__ */
|
|
11543
|
-
/* @__PURE__ */
|
|
11712
|
+
return /* @__PURE__ */ jsx66("form", { role: "search", onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ jsxs41("div", { className: "relative", children: [
|
|
11713
|
+
/* @__PURE__ */ jsx66(
|
|
11544
11714
|
Input,
|
|
11545
11715
|
{
|
|
11546
11716
|
ref: inputRef,
|
|
@@ -11549,15 +11719,15 @@ function SearchBox() {
|
|
|
11549
11719
|
value: query,
|
|
11550
11720
|
onChange: (e) => refine(e.target.value),
|
|
11551
11721
|
placeholder: "Search products...",
|
|
11552
|
-
startContent: /* @__PURE__ */
|
|
11553
|
-
endContent: query ? /* @__PURE__ */
|
|
11722
|
+
startContent: /* @__PURE__ */ jsx66(Search, { className: "w-5 h-5", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11723
|
+
endContent: query ? /* @__PURE__ */ jsx66(
|
|
11554
11724
|
"button",
|
|
11555
11725
|
{
|
|
11556
11726
|
type: "button",
|
|
11557
11727
|
onClick: clear,
|
|
11558
11728
|
className: "hover:text-foreground transition-colors",
|
|
11559
11729
|
"aria-label": "Clear search",
|
|
11560
|
-
children: /* @__PURE__ */
|
|
11730
|
+
children: /* @__PURE__ */ jsx66(X, { className: "w-4 h-4", strokeWidth: 2, "aria-hidden": "true" })
|
|
11561
11731
|
}
|
|
11562
11732
|
) : void 0,
|
|
11563
11733
|
"aria-label": "Search products",
|
|
@@ -11567,11 +11737,11 @@ function SearchBox() {
|
|
|
11567
11737
|
className: "[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"
|
|
11568
11738
|
}
|
|
11569
11739
|
),
|
|
11570
|
-
showShimmer && /* @__PURE__ */
|
|
11740
|
+
showShimmer && /* @__PURE__ */ jsx66(
|
|
11571
11741
|
"div",
|
|
11572
11742
|
{
|
|
11573
11743
|
className: "absolute inset-0 pointer-events-none rounded-input z-20 overflow-hidden",
|
|
11574
|
-
children: /* @__PURE__ */
|
|
11744
|
+
children: /* @__PURE__ */ jsx66(
|
|
11575
11745
|
"div",
|
|
11576
11746
|
{
|
|
11577
11747
|
className: "absolute inset-0",
|
|
@@ -11584,13 +11754,13 @@ function SearchBox() {
|
|
|
11584
11754
|
)
|
|
11585
11755
|
}
|
|
11586
11756
|
),
|
|
11587
|
-
/* @__PURE__ */
|
|
11757
|
+
/* @__PURE__ */ jsx66("style", { dangerouslySetInnerHTML: { __html: `
|
|
11588
11758
|
@keyframes searchShimmer {
|
|
11589
11759
|
0% { transform: translateX(-100%); }
|
|
11590
11760
|
100% { transform: translateX(100%); }
|
|
11591
11761
|
}
|
|
11592
11762
|
` } }),
|
|
11593
|
-
/* @__PURE__ */
|
|
11763
|
+
/* @__PURE__ */ jsx66("span", { id: descriptionId, className: "sr-only", children: "Search results will update as you type" })
|
|
11594
11764
|
] }) });
|
|
11595
11765
|
}
|
|
11596
11766
|
|
|
@@ -11598,7 +11768,7 @@ function SearchBox() {
|
|
|
11598
11768
|
import { Hits, useStats, useInstantSearch } from "react-instantsearch";
|
|
11599
11769
|
|
|
11600
11770
|
// src/composed/search/ProductHit.tsx
|
|
11601
|
-
import { jsx as
|
|
11771
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
11602
11772
|
function ProductHitComponent({
|
|
11603
11773
|
hit: product,
|
|
11604
11774
|
variant = "overlay"
|
|
@@ -11615,12 +11785,12 @@ function ProductHitComponent({
|
|
|
11615
11785
|
}
|
|
11616
11786
|
return "";
|
|
11617
11787
|
};
|
|
11618
|
-
return /* @__PURE__ */
|
|
11788
|
+
return /* @__PURE__ */ jsx67(
|
|
11619
11789
|
Product,
|
|
11620
11790
|
{
|
|
11621
11791
|
productId,
|
|
11622
11792
|
productData: product,
|
|
11623
|
-
children: /* @__PURE__ */
|
|
11793
|
+
children: /* @__PURE__ */ jsx67(
|
|
11624
11794
|
ProductCard,
|
|
11625
11795
|
{
|
|
11626
11796
|
variant,
|
|
@@ -11641,10 +11811,10 @@ function ProductHitComponent({
|
|
|
11641
11811
|
}
|
|
11642
11812
|
|
|
11643
11813
|
// src/composed/search/ProductGrid.tsx
|
|
11644
|
-
import { useState as
|
|
11645
|
-
import { jsx as
|
|
11814
|
+
import { useState as useState35, useEffect as useEffect37, useCallback as useCallback20 } from "react";
|
|
11815
|
+
import { jsx as jsx68, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
11646
11816
|
function ProductGridSkeletonItem() {
|
|
11647
|
-
return /* @__PURE__ */
|
|
11817
|
+
return /* @__PURE__ */ jsx68("div", { className: "aspect-square bg-muted animate-pulse" });
|
|
11648
11818
|
}
|
|
11649
11819
|
function ProductGrid({
|
|
11650
11820
|
className = "",
|
|
@@ -11654,16 +11824,16 @@ function ProductGrid({
|
|
|
11654
11824
|
}) {
|
|
11655
11825
|
const { nbHits } = useStats();
|
|
11656
11826
|
const { status, results } = useInstantSearch();
|
|
11657
|
-
const [announcement, setAnnouncement] =
|
|
11827
|
+
const [announcement, setAnnouncement] = useState35("");
|
|
11658
11828
|
const hitsCount = results?.hits?.length ?? 0;
|
|
11659
11829
|
const showSkeleton = hitsCount === 0 && status !== "error";
|
|
11660
|
-
|
|
11830
|
+
useEffect37(() => {
|
|
11661
11831
|
const timer = setTimeout(() => {
|
|
11662
11832
|
setAnnouncement(`${nbHits} ${nbHits === 1 ? "product" : "products"} found`);
|
|
11663
11833
|
}, 1e3);
|
|
11664
11834
|
return () => clearTimeout(timer);
|
|
11665
11835
|
}, [nbHits]);
|
|
11666
|
-
const HitComponent =
|
|
11836
|
+
const HitComponent = useCallback20(({ hit }) => /* @__PURE__ */ jsx68(
|
|
11667
11837
|
ProductHitComponent,
|
|
11668
11838
|
{
|
|
11669
11839
|
hit,
|
|
@@ -11671,9 +11841,9 @@ function ProductGrid({
|
|
|
11671
11841
|
}
|
|
11672
11842
|
), [variant]);
|
|
11673
11843
|
return /* @__PURE__ */ jsxs42("div", { className, children: [
|
|
11674
|
-
/* @__PURE__ */
|
|
11675
|
-
showSkeleton && /* @__PURE__ */
|
|
11676
|
-
/* @__PURE__ */
|
|
11844
|
+
/* @__PURE__ */ jsx68("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
11845
|
+
showSkeleton && /* @__PURE__ */ jsx68("div", { className: `grid ${gridClassName}`, children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx68(ProductGridSkeletonItem, {}, i)) }),
|
|
11846
|
+
/* @__PURE__ */ jsx68("div", { className: showSkeleton ? "hidden" : "", children: /* @__PURE__ */ jsx68(
|
|
11677
11847
|
Hits,
|
|
11678
11848
|
{
|
|
11679
11849
|
hitComponent: HitComponent,
|
|
@@ -11688,11 +11858,11 @@ function ProductGrid({
|
|
|
11688
11858
|
}
|
|
11689
11859
|
|
|
11690
11860
|
// src/composed/search/Filters.tsx
|
|
11691
|
-
import { useState as
|
|
11861
|
+
import { useState as useState37 } from "react";
|
|
11692
11862
|
|
|
11693
11863
|
// src/composed/search/FiltersButton.tsx
|
|
11694
11864
|
import { SlidersHorizontal as LucideSlidersHorizontal } from "lucide-react";
|
|
11695
|
-
import { jsx as
|
|
11865
|
+
import { jsx as jsx69, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
11696
11866
|
var SlidersHorizontalIcon = LucideSlidersHorizontal;
|
|
11697
11867
|
function FiltersButton({
|
|
11698
11868
|
onClick,
|
|
@@ -11707,8 +11877,8 @@ function FiltersButton({
|
|
|
11707
11877
|
className,
|
|
11708
11878
|
"aria-label": "Open filters",
|
|
11709
11879
|
children: [
|
|
11710
|
-
/* @__PURE__ */
|
|
11711
|
-
/* @__PURE__ */
|
|
11880
|
+
/* @__PURE__ */ jsx69(SlidersHorizontalIcon, { className: "w-4 h-4" }),
|
|
11881
|
+
/* @__PURE__ */ jsx69("span", { children })
|
|
11712
11882
|
]
|
|
11713
11883
|
}
|
|
11714
11884
|
);
|
|
@@ -11717,15 +11887,15 @@ function FiltersButton({
|
|
|
11717
11887
|
// src/composed/search/FiltersDrawer.tsx
|
|
11718
11888
|
import { useRefinementList, useRange, useStats as useStats2 } from "react-instantsearch";
|
|
11719
11889
|
import { X as LucideX2, SlidersHorizontal as LucideSlidersHorizontal2 } from "lucide-react";
|
|
11720
|
-
import { useState as
|
|
11890
|
+
import { useState as useState36, useEffect as useEffect38 } from "react";
|
|
11721
11891
|
import * as Slider2 from "@radix-ui/react-slider";
|
|
11722
|
-
import { Fragment as Fragment14, jsx as
|
|
11892
|
+
import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
11723
11893
|
var XIcon2 = LucideX2;
|
|
11724
11894
|
function FiltersDrawer({ isOpen, onClose }) {
|
|
11725
|
-
const [showCounts, setShowCounts] =
|
|
11895
|
+
const [showCounts, setShowCounts] = useState36(false);
|
|
11726
11896
|
const { nbHits } = useStats2();
|
|
11727
11897
|
const containerRef = useFocusTrap(isOpen, onClose);
|
|
11728
|
-
|
|
11898
|
+
useEffect38(() => {
|
|
11729
11899
|
if (isOpen) {
|
|
11730
11900
|
document.body.style.overflow = "hidden";
|
|
11731
11901
|
} else {
|
|
@@ -11735,7 +11905,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11735
11905
|
document.body.style.overflow = "";
|
|
11736
11906
|
};
|
|
11737
11907
|
}, [isOpen]);
|
|
11738
|
-
|
|
11908
|
+
useEffect38(() => {
|
|
11739
11909
|
const handleEscape = (e) => {
|
|
11740
11910
|
if (e.key === "Escape" && isOpen) {
|
|
11741
11911
|
onClose();
|
|
@@ -11745,7 +11915,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11745
11915
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
11746
11916
|
}, [isOpen, onClose]);
|
|
11747
11917
|
return /* @__PURE__ */ jsxs44(Fragment14, { children: [
|
|
11748
|
-
/* @__PURE__ */
|
|
11918
|
+
/* @__PURE__ */ jsx70(
|
|
11749
11919
|
"div",
|
|
11750
11920
|
{
|
|
11751
11921
|
className: `fixed inset-0 bg-black/50 z-40 transition-opacity ${isOpen ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
@@ -11763,25 +11933,25 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11763
11933
|
"aria-labelledby": "filters-drawer-title",
|
|
11764
11934
|
children: [
|
|
11765
11935
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
11766
|
-
/* @__PURE__ */
|
|
11767
|
-
/* @__PURE__ */
|
|
11936
|
+
/* @__PURE__ */ jsx70("h2", { id: "filters-drawer-title", className: "text-xl font-bold", children: "Filters" }),
|
|
11937
|
+
/* @__PURE__ */ jsx70(
|
|
11768
11938
|
"button",
|
|
11769
11939
|
{
|
|
11770
11940
|
onClick: onClose,
|
|
11771
11941
|
className: "p-2 hover:bg-foreground/5 rounded-full transition-colors",
|
|
11772
11942
|
"aria-label": "Close filters",
|
|
11773
|
-
children: /* @__PURE__ */
|
|
11943
|
+
children: /* @__PURE__ */ jsx70(XIcon2, { className: "w-5 h-5" })
|
|
11774
11944
|
}
|
|
11775
11945
|
)
|
|
11776
11946
|
] }),
|
|
11777
|
-
/* @__PURE__ */
|
|
11947
|
+
/* @__PURE__ */ jsx70("div", { className: "px-4 pb-4", children: /* @__PURE__ */ jsxs44("p", { className: "text-sm font-caption text-foreground/60", role: "status", "aria-live": "polite", children: [
|
|
11778
11948
|
nbHits.toLocaleString(),
|
|
11779
11949
|
" ",
|
|
11780
11950
|
nbHits === 1 ? "result" : "results"
|
|
11781
11951
|
] }) }),
|
|
11782
|
-
/* @__PURE__ */
|
|
11783
|
-
/* @__PURE__ */
|
|
11784
|
-
/* @__PURE__ */
|
|
11952
|
+
/* @__PURE__ */ jsx70("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-8", children: [
|
|
11953
|
+
/* @__PURE__ */ jsx70(TagsSection, { showCounts, setShowCounts }),
|
|
11954
|
+
/* @__PURE__ */ jsx70(PriceSection, {})
|
|
11785
11955
|
] }) })
|
|
11786
11956
|
]
|
|
11787
11957
|
}
|
|
@@ -11797,7 +11967,7 @@ function TagsSection({
|
|
|
11797
11967
|
sortBy: ["count:desc", "name:asc"],
|
|
11798
11968
|
limit: 100
|
|
11799
11969
|
});
|
|
11800
|
-
const [isExpanded, setIsExpanded] =
|
|
11970
|
+
const [isExpanded, setIsExpanded] = useState36(true);
|
|
11801
11971
|
return /* @__PURE__ */ jsxs44("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
11802
11972
|
/* @__PURE__ */ jsxs44(
|
|
11803
11973
|
"button",
|
|
@@ -11807,8 +11977,8 @@ function TagsSection({
|
|
|
11807
11977
|
"aria-expanded": isExpanded,
|
|
11808
11978
|
"aria-controls": "tags-content",
|
|
11809
11979
|
children: [
|
|
11810
|
-
/* @__PURE__ */
|
|
11811
|
-
/* @__PURE__ */
|
|
11980
|
+
/* @__PURE__ */ jsx70("h3", { className: "text-base font-semibold text-primary", children: "Tags" }),
|
|
11981
|
+
/* @__PURE__ */ jsx70(
|
|
11812
11982
|
"svg",
|
|
11813
11983
|
{
|
|
11814
11984
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -11817,14 +11987,14 @@ function TagsSection({
|
|
|
11817
11987
|
stroke: "currentColor",
|
|
11818
11988
|
strokeWidth: 2.5,
|
|
11819
11989
|
"aria-hidden": "true",
|
|
11820
|
-
children: /* @__PURE__ */
|
|
11990
|
+
children: /* @__PURE__ */ jsx70("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
11821
11991
|
}
|
|
11822
11992
|
)
|
|
11823
11993
|
]
|
|
11824
11994
|
}
|
|
11825
11995
|
),
|
|
11826
11996
|
isExpanded && /* @__PURE__ */ jsxs44("div", { className: "space-y-4", id: "tags-content", children: [
|
|
11827
|
-
/* @__PURE__ */
|
|
11997
|
+
/* @__PURE__ */ jsx70("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Product tags filter", children: items.map((item) => /* @__PURE__ */ jsxs44(
|
|
11828
11998
|
"button",
|
|
11829
11999
|
{
|
|
11830
12000
|
onClick: () => refine(item.value),
|
|
@@ -11835,15 +12005,15 @@ function TagsSection({
|
|
|
11835
12005
|
"aria-label": `${item.isRefined ? "Remove" : "Apply"} ${item.label} filter${showCounts ? ` (${item.count} products)` : ""}`,
|
|
11836
12006
|
"aria-pressed": item.isRefined,
|
|
11837
12007
|
children: [
|
|
11838
|
-
/* @__PURE__ */
|
|
11839
|
-
showCounts && /* @__PURE__ */
|
|
12008
|
+
/* @__PURE__ */ jsx70("span", { "aria-hidden": "true", children: item.label }),
|
|
12009
|
+
showCounts && /* @__PURE__ */ jsx70("span", { className: `text-xs font-caption ${item.isRefined ? "opacity-80" : "opacity-60"}`, "aria-hidden": "true", children: item.count })
|
|
11840
12010
|
]
|
|
11841
12011
|
},
|
|
11842
12012
|
item.value
|
|
11843
12013
|
)) }),
|
|
11844
12014
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between pt-2", children: [
|
|
11845
|
-
/* @__PURE__ */
|
|
11846
|
-
/* @__PURE__ */
|
|
12015
|
+
/* @__PURE__ */ jsx70("span", { className: "text-sm font-label text-foreground/60", id: "show-counts-label", children: "Show counts" }),
|
|
12016
|
+
/* @__PURE__ */ jsx70(
|
|
11847
12017
|
"button",
|
|
11848
12018
|
{
|
|
11849
12019
|
onClick: () => setShowCounts(!showCounts),
|
|
@@ -11851,7 +12021,7 @@ function TagsSection({
|
|
|
11851
12021
|
role: "switch",
|
|
11852
12022
|
"aria-checked": showCounts,
|
|
11853
12023
|
"aria-labelledby": "show-counts-label",
|
|
11854
|
-
children: /* @__PURE__ */
|
|
12024
|
+
children: /* @__PURE__ */ jsx70(
|
|
11855
12025
|
"span",
|
|
11856
12026
|
{
|
|
11857
12027
|
className: `inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform ${showCounts ? "translate-x-6" : "translate-x-1"}`,
|
|
@@ -11868,11 +12038,11 @@ function PriceSection() {
|
|
|
11868
12038
|
const { range, refine, start, canRefine } = useRange({ attribute: "price" });
|
|
11869
12039
|
const rangeMin = typeof range.min === "number" && isFinite(range.min) ? range.min : 0;
|
|
11870
12040
|
const rangeMax = typeof range.max === "number" && isFinite(range.max) ? range.max : 15e3;
|
|
11871
|
-
const [localRange, setLocalRange] =
|
|
12041
|
+
const [localRange, setLocalRange] = useState36([
|
|
11872
12042
|
typeof start?.[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
11873
12043
|
typeof start?.[1] === "number" && isFinite(start[1]) ? start[1] : rangeMax
|
|
11874
12044
|
]);
|
|
11875
|
-
|
|
12045
|
+
useEffect38(() => {
|
|
11876
12046
|
if (start && Array.isArray(start)) {
|
|
11877
12047
|
setLocalRange([
|
|
11878
12048
|
typeof start[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
@@ -11882,7 +12052,7 @@ function PriceSection() {
|
|
|
11882
12052
|
setLocalRange([rangeMin, rangeMax]);
|
|
11883
12053
|
}
|
|
11884
12054
|
}, [start, rangeMin, rangeMax]);
|
|
11885
|
-
const [isExpanded, setIsExpanded] =
|
|
12055
|
+
const [isExpanded, setIsExpanded] = useState36(true);
|
|
11886
12056
|
if (!canRefine) {
|
|
11887
12057
|
return null;
|
|
11888
12058
|
}
|
|
@@ -11906,8 +12076,8 @@ function PriceSection() {
|
|
|
11906
12076
|
"aria-expanded": isExpanded,
|
|
11907
12077
|
"aria-controls": "price-content",
|
|
11908
12078
|
children: [
|
|
11909
|
-
/* @__PURE__ */
|
|
11910
|
-
/* @__PURE__ */
|
|
12079
|
+
/* @__PURE__ */ jsx70("h3", { className: "text-base font-semibold text-primary", children: "Price" }),
|
|
12080
|
+
/* @__PURE__ */ jsx70(
|
|
11911
12081
|
"svg",
|
|
11912
12082
|
{
|
|
11913
12083
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -11916,7 +12086,7 @@ function PriceSection() {
|
|
|
11916
12086
|
stroke: "currentColor",
|
|
11917
12087
|
strokeWidth: 2.5,
|
|
11918
12088
|
"aria-hidden": "true",
|
|
11919
|
-
children: /* @__PURE__ */
|
|
12089
|
+
children: /* @__PURE__ */ jsx70("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
11920
12090
|
}
|
|
11921
12091
|
)
|
|
11922
12092
|
]
|
|
@@ -11924,14 +12094,14 @@ function PriceSection() {
|
|
|
11924
12094
|
),
|
|
11925
12095
|
isExpanded && /* @__PURE__ */ jsxs44("div", { className: "space-y-6", id: "price-content", children: [
|
|
11926
12096
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between text-sm font-display", children: [
|
|
11927
|
-
/* @__PURE__ */
|
|
11928
|
-
/* @__PURE__ */
|
|
12097
|
+
/* @__PURE__ */ jsx70("span", { children: formatPrice2(localRange[0]) }),
|
|
12098
|
+
/* @__PURE__ */ jsx70("span", { className: "text-foreground/70", children: formatPrice2(localRange[1]) })
|
|
11929
12099
|
] }),
|
|
11930
|
-
/* @__PURE__ */
|
|
12100
|
+
/* @__PURE__ */ jsx70("div", { className: "relative h-24 flex items-end justify-between gap-0.5 px-1", "aria-hidden": "true", role: "presentation", children: [60, 40, 80, 50, 60, 30, 20, 15, 10, 5, 30, 20, 15, 10, 5, 3, 3, 60, 40].map((height, i) => {
|
|
11931
12101
|
const totalBars = 19;
|
|
11932
12102
|
const barPrice = rangeMin + (rangeMax - rangeMin) / totalBars * i;
|
|
11933
12103
|
const isInRange = barPrice >= localRange[0] && barPrice <= localRange[1];
|
|
11934
|
-
return /* @__PURE__ */
|
|
12104
|
+
return /* @__PURE__ */ jsx70(
|
|
11935
12105
|
"div",
|
|
11936
12106
|
{
|
|
11937
12107
|
className: `flex-1 rounded-t-sm transition-opacity ${isInRange ? "bg-foreground" : "bg-foreground/20"}`,
|
|
@@ -11940,7 +12110,7 @@ function PriceSection() {
|
|
|
11940
12110
|
i
|
|
11941
12111
|
);
|
|
11942
12112
|
}) }),
|
|
11943
|
-
/* @__PURE__ */
|
|
12113
|
+
/* @__PURE__ */ jsx70("div", { style: { touchAction: "none" }, className: "my-6", children: /* @__PURE__ */ jsxs44(
|
|
11944
12114
|
Slider2.Root,
|
|
11945
12115
|
{
|
|
11946
12116
|
className: "relative flex w-full touch-none select-none items-center",
|
|
@@ -11958,8 +12128,8 @@ function PriceSection() {
|
|
|
11958
12128
|
step: 1,
|
|
11959
12129
|
minStepsBetweenThumbs: 1,
|
|
11960
12130
|
children: [
|
|
11961
|
-
/* @__PURE__ */
|
|
11962
|
-
/* @__PURE__ */
|
|
12131
|
+
/* @__PURE__ */ jsx70(Slider2.Track, { className: "relative h-3 w-full grow overflow-hidden rounded-full bg-foreground/20", children: /* @__PURE__ */ jsx70(Slider2.Range, { className: "absolute h-full bg-foreground" }) }),
|
|
12132
|
+
/* @__PURE__ */ jsx70(
|
|
11963
12133
|
Slider2.Thumb,
|
|
11964
12134
|
{
|
|
11965
12135
|
className: "block h-6 w-6 rounded-full bg-background shadow transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:scale-105 border-2 border-primary",
|
|
@@ -11973,7 +12143,7 @@ function PriceSection() {
|
|
|
11973
12143
|
"aria-valuetext": formatPrice2(localRange[0])
|
|
11974
12144
|
}
|
|
11975
12145
|
),
|
|
11976
|
-
/* @__PURE__ */
|
|
12146
|
+
/* @__PURE__ */ jsx70(
|
|
11977
12147
|
Slider2.Thumb,
|
|
11978
12148
|
{
|
|
11979
12149
|
className: "block h-6 w-6 rounded-full bg-background shadow transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:scale-105 border-2 border-primary",
|
|
@@ -11992,8 +12162,8 @@ function PriceSection() {
|
|
|
11992
12162
|
) }),
|
|
11993
12163
|
/* @__PURE__ */ jsxs44("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
11994
12164
|
/* @__PURE__ */ jsxs44("div", { children: [
|
|
11995
|
-
/* @__PURE__ */
|
|
11996
|
-
/* @__PURE__ */
|
|
12165
|
+
/* @__PURE__ */ jsx70("label", { htmlFor: "price-min", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Min" }),
|
|
12166
|
+
/* @__PURE__ */ jsx70(
|
|
11997
12167
|
"input",
|
|
11998
12168
|
{
|
|
11999
12169
|
id: "price-min",
|
|
@@ -12012,8 +12182,8 @@ function PriceSection() {
|
|
|
12012
12182
|
)
|
|
12013
12183
|
] }),
|
|
12014
12184
|
/* @__PURE__ */ jsxs44("div", { children: [
|
|
12015
|
-
/* @__PURE__ */
|
|
12016
|
-
/* @__PURE__ */
|
|
12185
|
+
/* @__PURE__ */ jsx70("label", { htmlFor: "price-max", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Max" }),
|
|
12186
|
+
/* @__PURE__ */ jsx70(
|
|
12017
12187
|
"input",
|
|
12018
12188
|
{
|
|
12019
12189
|
id: "price-max",
|
|
@@ -12037,11 +12207,11 @@ function PriceSection() {
|
|
|
12037
12207
|
}
|
|
12038
12208
|
|
|
12039
12209
|
// src/composed/search/Filters.tsx
|
|
12040
|
-
import { Fragment as Fragment15, jsx as
|
|
12210
|
+
import { Fragment as Fragment15, jsx as jsx71, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
12041
12211
|
function Filters({ buttonClassName, buttonText }) {
|
|
12042
|
-
const [isOpen, setIsOpen] =
|
|
12212
|
+
const [isOpen, setIsOpen] = useState37(false);
|
|
12043
12213
|
return /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
12044
|
-
/* @__PURE__ */
|
|
12214
|
+
/* @__PURE__ */ jsx71(
|
|
12045
12215
|
FiltersButton,
|
|
12046
12216
|
{
|
|
12047
12217
|
onClick: () => setIsOpen(true),
|
|
@@ -12049,14 +12219,14 @@ function Filters({ buttonClassName, buttonText }) {
|
|
|
12049
12219
|
children: buttonText
|
|
12050
12220
|
}
|
|
12051
12221
|
),
|
|
12052
|
-
/* @__PURE__ */
|
|
12222
|
+
/* @__PURE__ */ jsx71(FiltersDrawer, { isOpen, onClose: () => setIsOpen(false) })
|
|
12053
12223
|
] });
|
|
12054
12224
|
}
|
|
12055
12225
|
|
|
12056
12226
|
// src/composed/search/CurrentRefinements.tsx
|
|
12057
12227
|
import { useCurrentRefinements } from "react-instantsearch";
|
|
12058
12228
|
import { X as LucideX3 } from "lucide-react";
|
|
12059
|
-
import { jsx as
|
|
12229
|
+
import { jsx as jsx72, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
12060
12230
|
var XIcon3 = LucideX3;
|
|
12061
12231
|
var MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
12062
12232
|
var MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
@@ -12104,15 +12274,15 @@ function CurrentRefinements() {
|
|
|
12104
12274
|
if (allRefinements.length === 0) {
|
|
12105
12275
|
return null;
|
|
12106
12276
|
}
|
|
12107
|
-
return /* @__PURE__ */
|
|
12277
|
+
return /* @__PURE__ */ jsx72("div", { className: "flex flex-wrap items-center gap-2 mb-4 -mt-1", role: "group", "aria-label": "Active filters", children: allRefinements.map((refinement, index) => /* @__PURE__ */ jsxs46(
|
|
12108
12278
|
"button",
|
|
12109
12279
|
{
|
|
12110
12280
|
className: "bg-primary text-on-primary hover:bg-primary/90 inline-flex h-7 items-center gap-1.5 rounded-full px-3 text-sm transition-colors",
|
|
12111
12281
|
onClick: () => refinement.refine(),
|
|
12112
12282
|
"aria-label": `Remove filter: ${refinement.displayLabel}`,
|
|
12113
12283
|
children: [
|
|
12114
|
-
/* @__PURE__ */
|
|
12115
|
-
/* @__PURE__ */
|
|
12284
|
+
/* @__PURE__ */ jsx72("span", { className: "truncate", children: refinement.displayLabel }),
|
|
12285
|
+
/* @__PURE__ */ jsx72(XIcon3, { className: "w-3 h-3" })
|
|
12116
12286
|
]
|
|
12117
12287
|
},
|
|
12118
12288
|
`${refinement.attribute}-${refinement.value}-${index}`
|
|
@@ -12136,12 +12306,12 @@ var FACET_SECTIONS = [
|
|
|
12136
12306
|
];
|
|
12137
12307
|
|
|
12138
12308
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12139
|
-
import { useState as
|
|
12309
|
+
import { useState as useState40, useEffect as useEffect40 } from "react";
|
|
12140
12310
|
|
|
12141
12311
|
// src/composed/zoom/ZoomOverlay.tsx
|
|
12142
|
-
import { useState as
|
|
12312
|
+
import { useState as useState38, useCallback as useCallback21 } from "react";
|
|
12143
12313
|
import { Plus as LucidePlus2, Minus as LucideMinus2 } from "lucide-react";
|
|
12144
|
-
import { Fragment as Fragment16, jsx as
|
|
12314
|
+
import { Fragment as Fragment16, jsx as jsx73, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
12145
12315
|
var PlusIcon2 = LucidePlus2;
|
|
12146
12316
|
var MinusIcon2 = LucideMinus2;
|
|
12147
12317
|
function ZoomOverlay({
|
|
@@ -12153,13 +12323,13 @@ function ZoomOverlay({
|
|
|
12153
12323
|
className,
|
|
12154
12324
|
style
|
|
12155
12325
|
}) {
|
|
12156
|
-
const [zoomedImageIndex, setZoomedImageIndex] =
|
|
12157
|
-
const [zoomOrigin, setZoomOrigin] =
|
|
12158
|
-
const [hoveredImageIndex, setHoveredImageIndex] =
|
|
12159
|
-
const [cursorPos, setCursorPos] =
|
|
12160
|
-
const [announcement, setAnnouncement] =
|
|
12161
|
-
const [isZooming, setIsZooming] =
|
|
12162
|
-
const handleZoomClick =
|
|
12326
|
+
const [zoomedImageIndex, setZoomedImageIndex] = useState38(null);
|
|
12327
|
+
const [zoomOrigin, setZoomOrigin] = useState38({ x: 50, y: 50 });
|
|
12328
|
+
const [hoveredImageIndex, setHoveredImageIndex] = useState38(null);
|
|
12329
|
+
const [cursorPos, setCursorPos] = useState38({ x: 0, y: 0 });
|
|
12330
|
+
const [announcement, setAnnouncement] = useState38("");
|
|
12331
|
+
const [isZooming, setIsZooming] = useState38(false);
|
|
12332
|
+
const handleZoomClick = useCallback21(
|
|
12163
12333
|
(e) => {
|
|
12164
12334
|
e.stopPropagation();
|
|
12165
12335
|
if (isLargeTouchDevice && onEnhancedViewer) {
|
|
@@ -12184,7 +12354,7 @@ function ZoomOverlay({
|
|
|
12184
12354
|
},
|
|
12185
12355
|
[zoomedImageIndex, isLargeTouchDevice, onEnhancedViewer, imageIndex]
|
|
12186
12356
|
);
|
|
12187
|
-
const handleZoomMouseMove =
|
|
12357
|
+
const handleZoomMouseMove = useCallback21(
|
|
12188
12358
|
(e) => {
|
|
12189
12359
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
12190
12360
|
if (zoomedImageIndex === imageIndex) {
|
|
@@ -12201,8 +12371,8 @@ function ZoomOverlay({
|
|
|
12201
12371
|
const isHovered = hoveredImageIndex === imageIndex;
|
|
12202
12372
|
const cursorStyle = isLargeTouchDevice ? "pointer" : isTouchDevice ? "default" : "none";
|
|
12203
12373
|
return /* @__PURE__ */ jsxs47(Fragment16, { children: [
|
|
12204
|
-
/* @__PURE__ */
|
|
12205
|
-
/* @__PURE__ */
|
|
12374
|
+
/* @__PURE__ */ jsx73("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12375
|
+
/* @__PURE__ */ jsx73(
|
|
12206
12376
|
"div",
|
|
12207
12377
|
{
|
|
12208
12378
|
className,
|
|
@@ -12210,7 +12380,7 @@ function ZoomOverlay({
|
|
|
12210
12380
|
...style,
|
|
12211
12381
|
position: "relative"
|
|
12212
12382
|
},
|
|
12213
|
-
children: /* @__PURE__ */
|
|
12383
|
+
children: /* @__PURE__ */ jsx73(
|
|
12214
12384
|
"div",
|
|
12215
12385
|
{
|
|
12216
12386
|
style: {
|
|
@@ -12233,7 +12403,7 @@ function ZoomOverlay({
|
|
|
12233
12403
|
handleZoomClick(e);
|
|
12234
12404
|
}
|
|
12235
12405
|
},
|
|
12236
|
-
children: /* @__PURE__ */
|
|
12406
|
+
children: /* @__PURE__ */ jsx73(
|
|
12237
12407
|
"div",
|
|
12238
12408
|
{
|
|
12239
12409
|
style: {
|
|
@@ -12249,7 +12419,7 @@ function ZoomOverlay({
|
|
|
12249
12419
|
)
|
|
12250
12420
|
}
|
|
12251
12421
|
),
|
|
12252
|
-
isHovered && !isTouchDevice && /* @__PURE__ */
|
|
12422
|
+
isHovered && !isTouchDevice && /* @__PURE__ */ jsx73(
|
|
12253
12423
|
"div",
|
|
12254
12424
|
{
|
|
12255
12425
|
className: "fixed pointer-events-none z-50 hidden md:block",
|
|
@@ -12259,7 +12429,7 @@ function ZoomOverlay({
|
|
|
12259
12429
|
transform: "translate(-50%, -50%)"
|
|
12260
12430
|
},
|
|
12261
12431
|
"aria-hidden": "true",
|
|
12262
|
-
children: /* @__PURE__ */
|
|
12432
|
+
children: /* @__PURE__ */ jsx73("div", { className: "bg-white dark:bg-gray-800 rounded-full p-2 shadow-sm dark:shadow-gray-950/50", children: isZoomed ? /* @__PURE__ */ jsx73(
|
|
12263
12433
|
MinusIcon2,
|
|
12264
12434
|
{
|
|
12265
12435
|
size: 20,
|
|
@@ -12267,7 +12437,7 @@ function ZoomOverlay({
|
|
|
12267
12437
|
strokeWidth: 1.5,
|
|
12268
12438
|
"aria-hidden": "true"
|
|
12269
12439
|
}
|
|
12270
|
-
) : /* @__PURE__ */
|
|
12440
|
+
) : /* @__PURE__ */ jsx73(
|
|
12271
12441
|
PlusIcon2,
|
|
12272
12442
|
{
|
|
12273
12443
|
size: 20,
|
|
@@ -12283,11 +12453,11 @@ function ZoomOverlay({
|
|
|
12283
12453
|
|
|
12284
12454
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12285
12455
|
import {
|
|
12286
|
-
useState as
|
|
12287
|
-
useRef as
|
|
12288
|
-
useEffect as
|
|
12456
|
+
useState as useState39,
|
|
12457
|
+
useRef as useRef26,
|
|
12458
|
+
useEffect as useEffect39,
|
|
12289
12459
|
useLayoutEffect as useLayoutEffect6,
|
|
12290
|
-
useCallback as
|
|
12460
|
+
useCallback as useCallback22
|
|
12291
12461
|
} from "react";
|
|
12292
12462
|
import { createPortal as createPortal3 } from "react-dom";
|
|
12293
12463
|
import {
|
|
@@ -12349,7 +12519,7 @@ function slideFirstViewProps(image) {
|
|
|
12349
12519
|
}
|
|
12350
12520
|
|
|
12351
12521
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12352
|
-
import { Fragment as Fragment17, jsx as
|
|
12522
|
+
import { Fragment as Fragment17, jsx as jsx74, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
12353
12523
|
var TransformWrapper = OriginalTransformWrapper;
|
|
12354
12524
|
var TransformComponent = OriginalTransformComponent;
|
|
12355
12525
|
function viewerFirstView(image, screen, pictureAspect) {
|
|
@@ -12370,18 +12540,18 @@ var EnhancedImageViewer = ({
|
|
|
12370
12540
|
onIndexChange,
|
|
12371
12541
|
currentIndex: propCurrentIndex
|
|
12372
12542
|
}) => {
|
|
12373
|
-
const [isMounted, setIsMounted] =
|
|
12374
|
-
const [isClient, setIsClient] =
|
|
12375
|
-
const [scale, setScale] =
|
|
12376
|
-
const [cropDimensions, setCropDimensions] =
|
|
12377
|
-
const [currentZoomScale, setCurrentZoomScale] =
|
|
12378
|
-
const imgRef =
|
|
12379
|
-
const [loadedAspect, setLoadedAspect] =
|
|
12380
|
-
const touchStartRef =
|
|
12543
|
+
const [isMounted, setIsMounted] = useState39(false);
|
|
12544
|
+
const [isClient, setIsClient] = useState39(false);
|
|
12545
|
+
const [scale, setScale] = useState39({ initial: 1, min: 1, max: 8 });
|
|
12546
|
+
const [cropDimensions, setCropDimensions] = useState39({ width: 0, height: 0 });
|
|
12547
|
+
const [currentZoomScale, setCurrentZoomScale] = useState39(1);
|
|
12548
|
+
const imgRef = useRef26(null);
|
|
12549
|
+
const [loadedAspect, setLoadedAspect] = useState39(null);
|
|
12550
|
+
const touchStartRef = useRef26(
|
|
12381
12551
|
null
|
|
12382
12552
|
);
|
|
12383
|
-
const isSwipingRef =
|
|
12384
|
-
const calculateScale =
|
|
12553
|
+
const isSwipingRef = useRef26(false);
|
|
12554
|
+
const calculateScale = useCallback22(() => {
|
|
12385
12555
|
const viewport = {
|
|
12386
12556
|
width: window.innerWidth,
|
|
12387
12557
|
height: window.innerHeight
|
|
@@ -12393,7 +12563,7 @@ var EnhancedImageViewer = ({
|
|
|
12393
12563
|
max: 8
|
|
12394
12564
|
});
|
|
12395
12565
|
}, []);
|
|
12396
|
-
const handleImageLoad =
|
|
12566
|
+
const handleImageLoad = useCallback22(() => {
|
|
12397
12567
|
calculateScale();
|
|
12398
12568
|
const img = imgRef.current;
|
|
12399
12569
|
if (img && img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
@@ -12409,17 +12579,17 @@ var EnhancedImageViewer = ({
|
|
|
12409
12579
|
document.body.style.overflow = "";
|
|
12410
12580
|
};
|
|
12411
12581
|
}, [calculateScale]);
|
|
12412
|
-
|
|
12582
|
+
useEffect39(() => {
|
|
12413
12583
|
calculateScale();
|
|
12414
12584
|
}, [calculateScale]);
|
|
12415
|
-
|
|
12585
|
+
useEffect39(() => {
|
|
12416
12586
|
const handleResize = () => {
|
|
12417
12587
|
calculateScale();
|
|
12418
12588
|
};
|
|
12419
12589
|
window.addEventListener("resize", handleResize);
|
|
12420
12590
|
return () => window.removeEventListener("resize", handleResize);
|
|
12421
12591
|
}, [calculateScale]);
|
|
12422
|
-
|
|
12592
|
+
useEffect39(() => {
|
|
12423
12593
|
const handleKeyDown = (e) => {
|
|
12424
12594
|
if (e.key === "Escape") {
|
|
12425
12595
|
onClose();
|
|
@@ -12445,7 +12615,7 @@ var EnhancedImageViewer = ({
|
|
|
12445
12615
|
document.addEventListener("keydown", handleKeyDown);
|
|
12446
12616
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12447
12617
|
}, [onClose, imageUrl, images, onIndexChange, propCurrentIndex]);
|
|
12448
|
-
const handleSwipeNavigation =
|
|
12618
|
+
const handleSwipeNavigation = useCallback22(
|
|
12449
12619
|
(direction) => {
|
|
12450
12620
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12451
12621
|
if (currentIndex === -1) {
|
|
@@ -12466,7 +12636,7 @@ var EnhancedImageViewer = ({
|
|
|
12466
12636
|
},
|
|
12467
12637
|
[propCurrentIndex, images, imageUrl, onIndexChange]
|
|
12468
12638
|
);
|
|
12469
|
-
const handleTouchStart =
|
|
12639
|
+
const handleTouchStart = useCallback22(
|
|
12470
12640
|
(e) => {
|
|
12471
12641
|
const isAtInitialZoom = Math.abs(currentZoomScale - scale.initial) < 0.1;
|
|
12472
12642
|
if (!isAtInitialZoom) return;
|
|
@@ -12480,7 +12650,7 @@ var EnhancedImageViewer = ({
|
|
|
12480
12650
|
},
|
|
12481
12651
|
[currentZoomScale, scale.initial]
|
|
12482
12652
|
);
|
|
12483
|
-
const handleTouchEnd =
|
|
12653
|
+
const handleTouchEnd = useCallback22(
|
|
12484
12654
|
(e) => {
|
|
12485
12655
|
if (!touchStartRef.current) return;
|
|
12486
12656
|
const touch = e.changedTouches[0];
|
|
@@ -12515,12 +12685,12 @@ var EnhancedImageViewer = ({
|
|
|
12515
12685
|
);
|
|
12516
12686
|
if (!isMounted || !isClient) {
|
|
12517
12687
|
return createPortal3(
|
|
12518
|
-
/* @__PURE__ */
|
|
12688
|
+
/* @__PURE__ */ jsx74(
|
|
12519
12689
|
"div",
|
|
12520
12690
|
{
|
|
12521
12691
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
12522
12692
|
style: { zIndex: 999999 },
|
|
12523
|
-
children: /* @__PURE__ */
|
|
12693
|
+
children: /* @__PURE__ */ jsx74(
|
|
12524
12694
|
"div",
|
|
12525
12695
|
{
|
|
12526
12696
|
style: {
|
|
@@ -12545,7 +12715,7 @@ var EnhancedImageViewer = ({
|
|
|
12545
12715
|
"aria-modal": "true",
|
|
12546
12716
|
"aria-label": "Image viewer",
|
|
12547
12717
|
children: [
|
|
12548
|
-
/* @__PURE__ */
|
|
12718
|
+
/* @__PURE__ */ jsx74(
|
|
12549
12719
|
"button",
|
|
12550
12720
|
{
|
|
12551
12721
|
onClick: (e) => {
|
|
@@ -12571,10 +12741,10 @@ var EnhancedImageViewer = ({
|
|
|
12571
12741
|
touchAction: "manipulation",
|
|
12572
12742
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
12573
12743
|
},
|
|
12574
|
-
children: /* @__PURE__ */
|
|
12744
|
+
children: /* @__PURE__ */ jsx74(X2, { className: "w-7 h-7", strokeWidth: 2.5 })
|
|
12575
12745
|
}
|
|
12576
12746
|
),
|
|
12577
|
-
/* @__PURE__ */
|
|
12747
|
+
/* @__PURE__ */ jsx74(
|
|
12578
12748
|
TransformWrapper,
|
|
12579
12749
|
{
|
|
12580
12750
|
initialScale: scale.initial,
|
|
@@ -12621,14 +12791,14 @@ var EnhancedImageViewer = ({
|
|
|
12621
12791
|
onTouchStart: handleTouchStart,
|
|
12622
12792
|
onTouchEnd: handleTouchEnd,
|
|
12623
12793
|
children: [
|
|
12624
|
-
/* @__PURE__ */
|
|
12794
|
+
/* @__PURE__ */ jsx74(
|
|
12625
12795
|
TransformComponent,
|
|
12626
12796
|
{
|
|
12627
12797
|
wrapperStyle: {
|
|
12628
12798
|
width: "100%",
|
|
12629
12799
|
height: "100%"
|
|
12630
12800
|
},
|
|
12631
|
-
children: /* @__PURE__ */
|
|
12801
|
+
children: /* @__PURE__ */ jsx74(
|
|
12632
12802
|
"div",
|
|
12633
12803
|
{
|
|
12634
12804
|
style: {
|
|
@@ -12639,7 +12809,7 @@ var EnhancedImageViewer = ({
|
|
|
12639
12809
|
alignItems: "center",
|
|
12640
12810
|
justifyContent: "center"
|
|
12641
12811
|
},
|
|
12642
|
-
children: /* @__PURE__ */
|
|
12812
|
+
children: /* @__PURE__ */ jsx74(
|
|
12643
12813
|
SafeImg,
|
|
12644
12814
|
{
|
|
12645
12815
|
ref: imgRef,
|
|
@@ -12667,7 +12837,7 @@ var EnhancedImageViewer = ({
|
|
|
12667
12837
|
}
|
|
12668
12838
|
),
|
|
12669
12839
|
/* @__PURE__ */ jsxs48("div", { className: "fixed bottom-5 left-0 right-0 z-50", children: [
|
|
12670
|
-
/* @__PURE__ */
|
|
12840
|
+
/* @__PURE__ */ jsx74("div", { className: "flex justify-center gap-2", children: (() => {
|
|
12671
12841
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12672
12842
|
if (currentIndex === -1) {
|
|
12673
12843
|
currentIndex = images.findIndex(
|
|
@@ -12701,7 +12871,7 @@ var EnhancedImageViewer = ({
|
|
|
12701
12871
|
const nextIndex = findNextAvailableIndex(currentIndex, 1);
|
|
12702
12872
|
const prevIndex = findNextAvailableIndex(currentIndex, -1);
|
|
12703
12873
|
return /* @__PURE__ */ jsxs48(Fragment17, { children: [
|
|
12704
|
-
/* @__PURE__ */
|
|
12874
|
+
/* @__PURE__ */ jsx74(
|
|
12705
12875
|
"button",
|
|
12706
12876
|
{
|
|
12707
12877
|
onClick: () => {
|
|
@@ -12714,7 +12884,7 @@ var EnhancedImageViewer = ({
|
|
|
12714
12884
|
className: `w-10 h-10 rounded-full shadow-lg flex items-center justify-center transition-all duration-200 ${prevIndex === -1 ? "bg-white/40 text-black opacity-50 cursor-not-allowed" : "bg-white/90 hover:bg-white text-black"}`,
|
|
12715
12885
|
style: { touchAction: "manipulation" },
|
|
12716
12886
|
"aria-label": "Previous image",
|
|
12717
|
-
children: /* @__PURE__ */
|
|
12887
|
+
children: /* @__PURE__ */ jsx74(
|
|
12718
12888
|
"svg",
|
|
12719
12889
|
{
|
|
12720
12890
|
className: "w-4 h-4",
|
|
@@ -12722,7 +12892,7 @@ var EnhancedImageViewer = ({
|
|
|
12722
12892
|
stroke: "currentColor",
|
|
12723
12893
|
viewBox: "0 0 24 24",
|
|
12724
12894
|
"aria-hidden": "true",
|
|
12725
|
-
children: /* @__PURE__ */
|
|
12895
|
+
children: /* @__PURE__ */ jsx74(
|
|
12726
12896
|
"path",
|
|
12727
12897
|
{
|
|
12728
12898
|
strokeLinecap: "round",
|
|
@@ -12735,7 +12905,7 @@ var EnhancedImageViewer = ({
|
|
|
12735
12905
|
)
|
|
12736
12906
|
}
|
|
12737
12907
|
),
|
|
12738
|
-
/* @__PURE__ */
|
|
12908
|
+
/* @__PURE__ */ jsx74(
|
|
12739
12909
|
"button",
|
|
12740
12910
|
{
|
|
12741
12911
|
onClick: () => {
|
|
@@ -12748,7 +12918,7 @@ var EnhancedImageViewer = ({
|
|
|
12748
12918
|
className: `w-10 h-10 rounded-full shadow-lg flex items-center justify-center transition-all duration-200 ${nextIndex === -1 ? "bg-white/40 text-black opacity-50 cursor-not-allowed" : "bg-white/90 hover:bg-white text-black"}`,
|
|
12749
12919
|
style: { touchAction: "manipulation" },
|
|
12750
12920
|
"aria-label": "Next image",
|
|
12751
|
-
children: /* @__PURE__ */
|
|
12921
|
+
children: /* @__PURE__ */ jsx74(
|
|
12752
12922
|
"svg",
|
|
12753
12923
|
{
|
|
12754
12924
|
className: "w-4 h-4",
|
|
@@ -12756,7 +12926,7 @@ var EnhancedImageViewer = ({
|
|
|
12756
12926
|
stroke: "currentColor",
|
|
12757
12927
|
viewBox: "0 0 24 24",
|
|
12758
12928
|
"aria-hidden": "true",
|
|
12759
|
-
children: /* @__PURE__ */
|
|
12929
|
+
children: /* @__PURE__ */ jsx74(
|
|
12760
12930
|
"path",
|
|
12761
12931
|
{
|
|
12762
12932
|
strokeLinecap: "round",
|
|
@@ -12771,7 +12941,7 @@ var EnhancedImageViewer = ({
|
|
|
12771
12941
|
)
|
|
12772
12942
|
] });
|
|
12773
12943
|
})() }),
|
|
12774
|
-
/* @__PURE__ */
|
|
12944
|
+
/* @__PURE__ */ jsx74("div", { style: { position: "fixed", bottom: 20, left: 24, zIndex: 10, marginBottom: "env(safe-area-inset-bottom, 0px)" }, className: "h-10 px-3 rounded-full bg-white/90 text-black text-sm font-medium flex items-center justify-center shadow-lg", children: (() => {
|
|
12775
12945
|
const total = Math.max(images.length, 1);
|
|
12776
12946
|
const current = propCurrentIndex !== void 0 ? Math.min(propCurrentIndex + 1, total) : 1;
|
|
12777
12947
|
return `${current} / ${total}`;
|
|
@@ -12783,7 +12953,7 @@ var EnhancedImageViewer = ({
|
|
|
12783
12953
|
},
|
|
12784
12954
|
`${scale.initial}-${scale.min}-${scale.max}`
|
|
12785
12955
|
),
|
|
12786
|
-
/* @__PURE__ */
|
|
12956
|
+
/* @__PURE__ */ jsx74(
|
|
12787
12957
|
"div",
|
|
12788
12958
|
{
|
|
12789
12959
|
className: "absolute inset-0 bg-black",
|
|
@@ -12802,7 +12972,7 @@ var EnhancedImageViewer = ({
|
|
|
12802
12972
|
};
|
|
12803
12973
|
|
|
12804
12974
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12805
|
-
import { Fragment as Fragment18, jsx as
|
|
12975
|
+
import { Fragment as Fragment18, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12806
12976
|
function ResponsiveZoom({
|
|
12807
12977
|
imageIndex,
|
|
12808
12978
|
children,
|
|
@@ -12812,11 +12982,11 @@ function ResponsiveZoom({
|
|
|
12812
12982
|
imageUrl,
|
|
12813
12983
|
alt = "Product image"
|
|
12814
12984
|
}) {
|
|
12815
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
12816
|
-
const [showEnhancedViewer, setShowEnhancedViewer] =
|
|
12817
|
-
const [viewerIndex, setViewerIndex] =
|
|
12818
|
-
const [currentImageUrl, setCurrentImageUrl] =
|
|
12819
|
-
|
|
12985
|
+
const [isTouchDevice, setIsTouchDevice] = useState40(false);
|
|
12986
|
+
const [showEnhancedViewer, setShowEnhancedViewer] = useState40(false);
|
|
12987
|
+
const [viewerIndex, setViewerIndex] = useState40(0);
|
|
12988
|
+
const [currentImageUrl, setCurrentImageUrl] = useState40(imageUrl || "");
|
|
12989
|
+
useEffect40(() => {
|
|
12820
12990
|
const checkDeviceType = () => {
|
|
12821
12991
|
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
12822
12992
|
setIsTouchDevice(hasTouch);
|
|
@@ -12844,7 +13014,7 @@ function ResponsiveZoom({
|
|
|
12844
13014
|
}
|
|
12845
13015
|
};
|
|
12846
13016
|
return /* @__PURE__ */ jsxs49(Fragment18, { children: [
|
|
12847
|
-
isTouchDevice ? /* @__PURE__ */
|
|
13017
|
+
isTouchDevice ? /* @__PURE__ */ jsx75(
|
|
12848
13018
|
"div",
|
|
12849
13019
|
{
|
|
12850
13020
|
className,
|
|
@@ -12861,7 +13031,7 @@ function ResponsiveZoom({
|
|
|
12861
13031
|
},
|
|
12862
13032
|
children
|
|
12863
13033
|
}
|
|
12864
|
-
) : /* @__PURE__ */
|
|
13034
|
+
) : /* @__PURE__ */ jsx75(
|
|
12865
13035
|
ZoomOverlay,
|
|
12866
13036
|
{
|
|
12867
13037
|
imageIndex,
|
|
@@ -12872,7 +13042,7 @@ function ResponsiveZoom({
|
|
|
12872
13042
|
children
|
|
12873
13043
|
}
|
|
12874
13044
|
),
|
|
12875
|
-
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */
|
|
13045
|
+
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ jsx75(
|
|
12876
13046
|
EnhancedImageViewer,
|
|
12877
13047
|
{
|
|
12878
13048
|
imageUrl: currentImageUrl,
|
|
@@ -12896,11 +13066,11 @@ function ResponsiveZoom({
|
|
|
12896
13066
|
|
|
12897
13067
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
12898
13068
|
import {
|
|
12899
|
-
useState as
|
|
12900
|
-
useRef as
|
|
12901
|
-
useEffect as
|
|
12902
|
-
useCallback as
|
|
12903
|
-
useMemo as
|
|
13069
|
+
useState as useState41,
|
|
13070
|
+
useRef as useRef27,
|
|
13071
|
+
useEffect as useEffect41,
|
|
13072
|
+
useCallback as useCallback23,
|
|
13073
|
+
useMemo as useMemo17,
|
|
12904
13074
|
memo as memo4
|
|
12905
13075
|
} from "react";
|
|
12906
13076
|
|
|
@@ -12913,17 +13083,17 @@ function zoomFit(galleryRole) {
|
|
|
12913
13083
|
}
|
|
12914
13084
|
|
|
12915
13085
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
12916
|
-
import { jsx as
|
|
13086
|
+
import { jsx as jsx76, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12917
13087
|
function StaticCarouselImage({
|
|
12918
13088
|
src,
|
|
12919
13089
|
alt,
|
|
12920
13090
|
className
|
|
12921
13091
|
}) {
|
|
12922
|
-
const [failed, setFailed] =
|
|
13092
|
+
const [failed, setFailed] = useState41(false);
|
|
12923
13093
|
if (failed || !src) {
|
|
12924
|
-
return /* @__PURE__ */
|
|
13094
|
+
return /* @__PURE__ */ jsx76("div", { className: `bg-muted ${className ?? ""}`, role: "img", "aria-label": alt });
|
|
12925
13095
|
}
|
|
12926
|
-
return /* @__PURE__ */
|
|
13096
|
+
return /* @__PURE__ */ jsx76(
|
|
12927
13097
|
"img",
|
|
12928
13098
|
{
|
|
12929
13099
|
src,
|
|
@@ -12956,42 +13126,43 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12956
13126
|
errorText,
|
|
12957
13127
|
unavailableText
|
|
12958
13128
|
}) {
|
|
12959
|
-
const [activeIndex, setActiveIndex] =
|
|
12960
|
-
const
|
|
13129
|
+
const [activeIndex, setActiveIndex] = useState41(currentIndex);
|
|
13130
|
+
const skippedStamp = gallerySkippedStamp(useGallerySkipOptional()?.skipped ?? NO_GALLERY_SKIPS, images ?? []);
|
|
13131
|
+
const [touchStart, setTouchStart] = useState41(
|
|
12961
13132
|
null
|
|
12962
13133
|
);
|
|
12963
|
-
const [touchEnd, setTouchEnd] =
|
|
13134
|
+
const [touchEnd, setTouchEnd] = useState41(
|
|
12964
13135
|
null
|
|
12965
13136
|
);
|
|
12966
|
-
const [showImageViewer, setShowImageViewer] =
|
|
12967
|
-
const [viewerKey, setViewerKey] =
|
|
12968
|
-
const [isDragging, setIsDragging] =
|
|
12969
|
-
const [dragOffset, setDragOffset] =
|
|
12970
|
-
const [isTransitioning, setIsTransitioning] =
|
|
12971
|
-
const [isHorizontalSwipe, setIsHorizontalSwipe] =
|
|
13137
|
+
const [showImageViewer, setShowImageViewer] = useState41(false);
|
|
13138
|
+
const [viewerKey, setViewerKey] = useState41(0);
|
|
13139
|
+
const [isDragging, setIsDragging] = useState41(false);
|
|
13140
|
+
const [dragOffset, setDragOffset] = useState41(0);
|
|
13141
|
+
const [isTransitioning, setIsTransitioning] = useState41(false);
|
|
13142
|
+
const [isHorizontalSwipe, setIsHorizontalSwipe] = useState41(
|
|
12972
13143
|
null
|
|
12973
13144
|
);
|
|
12974
|
-
const [isPeeking, setIsPeeking] =
|
|
12975
|
-
const [isPeekReturning, setIsPeekReturning] =
|
|
12976
|
-
const carouselRef =
|
|
12977
|
-
const indicatorRef =
|
|
12978
|
-
const touchStartRef =
|
|
13145
|
+
const [isPeeking, setIsPeeking] = useState41(false);
|
|
13146
|
+
const [isPeekReturning, setIsPeekReturning] = useState41(false);
|
|
13147
|
+
const carouselRef = useRef27(null);
|
|
13148
|
+
const indicatorRef = useRef27(null);
|
|
13149
|
+
const touchStartRef = useRef27(
|
|
12979
13150
|
null
|
|
12980
13151
|
);
|
|
12981
|
-
const horizontalGestureRef =
|
|
12982
|
-
const hasShownPeekRef =
|
|
12983
|
-
const hasSwipedThisSessionRef =
|
|
12984
|
-
const generatedUrlsRef =
|
|
12985
|
-
const prevArtworkSrcRef =
|
|
12986
|
-
|
|
13152
|
+
const horizontalGestureRef = useRef27(false);
|
|
13153
|
+
const hasShownPeekRef = useRef27(false);
|
|
13154
|
+
const hasSwipedThisSessionRef = useRef27(false);
|
|
13155
|
+
const generatedUrlsRef = useRef27(/* @__PURE__ */ new Map());
|
|
13156
|
+
const prevArtworkSrcRef = useRef27(currentArtwork?.src);
|
|
13157
|
+
useEffect41(() => {
|
|
12987
13158
|
if (currentArtwork?.src !== prevArtworkSrcRef.current) {
|
|
12988
13159
|
generatedUrlsRef.current.clear();
|
|
12989
13160
|
prevArtworkSrcRef.current = currentArtwork?.src;
|
|
12990
13161
|
}
|
|
12991
13162
|
}, [currentArtwork?.src]);
|
|
12992
|
-
const onMockupUrlGeneratedRef =
|
|
13163
|
+
const onMockupUrlGeneratedRef = useRef27(onMockupUrlGenerated);
|
|
12993
13164
|
onMockupUrlGeneratedRef.current = onMockupUrlGenerated;
|
|
12994
|
-
const handleUrlGenerated =
|
|
13165
|
+
const handleUrlGenerated = useCallback23((mockupId, url) => {
|
|
12995
13166
|
generatedUrlsRef.current.set(mockupId, url);
|
|
12996
13167
|
onMockupUrlGeneratedRef.current?.(mockupId, url);
|
|
12997
13168
|
}, []);
|
|
@@ -12999,24 +13170,24 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12999
13170
|
const shouldHideDots = stickyHeroContext?.shouldHideDots ?? false;
|
|
13000
13171
|
const priorityContext = useMockupPriorityOptional();
|
|
13001
13172
|
const realtimeContext = useRealtimeOptional();
|
|
13002
|
-
const [urlUpdateCounter, setUrlUpdateCounter] =
|
|
13003
|
-
|
|
13173
|
+
const [urlUpdateCounter, setUrlUpdateCounter] = useState41(0);
|
|
13174
|
+
useEffect41(() => {
|
|
13004
13175
|
if (!realtimeContext?.subscribeMockupResults) return;
|
|
13005
13176
|
const unsubscribe = realtimeContext.subscribeMockupResults(() => {
|
|
13006
13177
|
setUrlUpdateCounter((c) => c + 1);
|
|
13007
13178
|
});
|
|
13008
13179
|
return unsubscribe;
|
|
13009
13180
|
}, [realtimeContext?.subscribeMockupResults]);
|
|
13010
|
-
const mockupIds =
|
|
13181
|
+
const mockupIds = useMemo17(() => {
|
|
13011
13182
|
return images.filter((img) => img.isRealMockup && img.mockupId).map((img) => img.mockupId);
|
|
13012
13183
|
}, [images]);
|
|
13013
|
-
const realtimeMockupUrls =
|
|
13184
|
+
const realtimeMockupUrls = useMemo17(() => {
|
|
13014
13185
|
if (!realtimeContext?.getMockupUrls || mockupIds.length === 0) {
|
|
13015
13186
|
return {};
|
|
13016
13187
|
}
|
|
13017
13188
|
return realtimeContext.getMockupUrls(mockupIds);
|
|
13018
13189
|
}, [realtimeContext?.getMockupUrls, mockupIds, urlUpdateCounter]);
|
|
13019
|
-
const imagesWithRealtimeUrls =
|
|
13190
|
+
const imagesWithRealtimeUrls = useMemo17(() => {
|
|
13020
13191
|
return images.map((img) => {
|
|
13021
13192
|
if (img.isRealMockup && img.mockupId && realtimeMockupUrls[img.mockupId]) {
|
|
13022
13193
|
return {
|
|
@@ -13028,10 +13199,10 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13028
13199
|
});
|
|
13029
13200
|
}, [images, realtimeMockupUrls]);
|
|
13030
13201
|
const minSwipeDistance = 50;
|
|
13031
|
-
|
|
13202
|
+
useEffect41(() => {
|
|
13032
13203
|
setActiveIndex(currentIndex);
|
|
13033
13204
|
}, [currentIndex]);
|
|
13034
|
-
|
|
13205
|
+
useEffect41(() => {
|
|
13035
13206
|
if (!priorityContext) return;
|
|
13036
13207
|
const realMockups = images.map((img, idx) => ({ img, originalIdx: idx })).filter(({ img }) => img.isRealMockup && img.mockupId);
|
|
13037
13208
|
const mockupIdsList = realMockups.map(({ img }) => img.mockupId);
|
|
@@ -13059,7 +13230,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13059
13230
|
priorityContext.clearMobileCarouselMode?.();
|
|
13060
13231
|
};
|
|
13061
13232
|
}, [priorityContext, activeIndex, images]);
|
|
13062
|
-
|
|
13233
|
+
useEffect41(() => {
|
|
13063
13234
|
const indicator = indicatorRef.current;
|
|
13064
13235
|
if (!indicator) return;
|
|
13065
13236
|
let ticking = false;
|
|
@@ -13100,7 +13271,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13100
13271
|
}, []);
|
|
13101
13272
|
const SWIPE_TRACKING_KEY = "carousel-swipe-tracking";
|
|
13102
13273
|
const PDP_VIEWS_BEFORE_PEEK = 10;
|
|
13103
|
-
const getSwipeTracking =
|
|
13274
|
+
const getSwipeTracking = useCallback23(() => {
|
|
13104
13275
|
try {
|
|
13105
13276
|
const stored = localStorage.getItem(SWIPE_TRACKING_KEY);
|
|
13106
13277
|
if (stored) {
|
|
@@ -13110,7 +13281,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13110
13281
|
}
|
|
13111
13282
|
return { viewsWithoutSwipe: 0, hasEverSwiped: false };
|
|
13112
13283
|
}, []);
|
|
13113
|
-
const recordSwipe =
|
|
13284
|
+
const recordSwipe = useCallback23(() => {
|
|
13114
13285
|
if (hasSwipedThisSessionRef.current) return;
|
|
13115
13286
|
hasSwipedThisSessionRef.current = true;
|
|
13116
13287
|
try {
|
|
@@ -13124,7 +13295,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13124
13295
|
} catch {
|
|
13125
13296
|
}
|
|
13126
13297
|
}, []);
|
|
13127
|
-
|
|
13298
|
+
useEffect41(() => {
|
|
13128
13299
|
if (!enablePeekAnimation || images.length <= 1) return;
|
|
13129
13300
|
const tracking = getSwipeTracking();
|
|
13130
13301
|
const newViewCount = tracking.viewsWithoutSwipe + 1;
|
|
@@ -13165,14 +13336,14 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13165
13336
|
clearTimeout(clearTimeout_);
|
|
13166
13337
|
};
|
|
13167
13338
|
}, [images.length, getSwipeTracking, enablePeekAnimation]);
|
|
13168
|
-
const wasTapRef =
|
|
13169
|
-
const handleImageTap =
|
|
13339
|
+
const wasTapRef = useRef27(false);
|
|
13340
|
+
const handleImageTap = useCallback23(() => {
|
|
13170
13341
|
if (!enableZoom) return;
|
|
13171
13342
|
setViewerKey((prev) => prev + 1);
|
|
13172
13343
|
setShowImageViewer(true);
|
|
13173
13344
|
onZoomChange?.(true);
|
|
13174
13345
|
}, [enableZoom, onZoomChange]);
|
|
13175
|
-
const calculateDragOffset =
|
|
13346
|
+
const calculateDragOffset = useCallback23(
|
|
13176
13347
|
(startX, currentX, containerWidth) => {
|
|
13177
13348
|
const distance = startX - currentX;
|
|
13178
13349
|
const offsetPercent = distance / containerWidth * 100;
|
|
@@ -13197,7 +13368,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13197
13368
|
},
|
|
13198
13369
|
[activeIndex, images.length]
|
|
13199
13370
|
);
|
|
13200
|
-
const handleSwipeEnd =
|
|
13371
|
+
const handleSwipeEnd = useCallback23(
|
|
13201
13372
|
(startX, endX, containerWidth) => {
|
|
13202
13373
|
const distance = startX - endX;
|
|
13203
13374
|
const distancePercent = Math.abs(distance) / containerWidth * 100;
|
|
@@ -13228,7 +13399,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13228
13399
|
},
|
|
13229
13400
|
[activeIndex, images.length, onIndexChange, recordSwipe]
|
|
13230
13401
|
);
|
|
13231
|
-
|
|
13402
|
+
useEffect41(() => {
|
|
13232
13403
|
const container = carouselRef.current;
|
|
13233
13404
|
if (!container) return;
|
|
13234
13405
|
const handleTouchStart = (e) => {
|
|
@@ -13317,11 +13488,11 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13317
13488
|
handleSwipeEnd,
|
|
13318
13489
|
handleImageTap
|
|
13319
13490
|
]);
|
|
13320
|
-
const mouseStartRef =
|
|
13491
|
+
const mouseStartRef = useRef27(
|
|
13321
13492
|
null
|
|
13322
13493
|
);
|
|
13323
|
-
const isMouseDraggingRef =
|
|
13324
|
-
|
|
13494
|
+
const isMouseDraggingRef = useRef27(false);
|
|
13495
|
+
useEffect41(() => {
|
|
13325
13496
|
const container = carouselRef.current;
|
|
13326
13497
|
if (!container) return;
|
|
13327
13498
|
const handleMouseDown = (e) => {
|
|
@@ -13397,7 +13568,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13397
13568
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
13398
13569
|
};
|
|
13399
13570
|
}, [calculateDragOffset, handleSwipeEnd, handleImageTap]);
|
|
13400
|
-
const goToSlide =
|
|
13571
|
+
const goToSlide = useCallback23(
|
|
13401
13572
|
(index, withTransition = true) => {
|
|
13402
13573
|
if (withTransition) {
|
|
13403
13574
|
setIsTransitioning(true);
|
|
@@ -13415,16 +13586,16 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13415
13586
|
},
|
|
13416
13587
|
[onIndexChange]
|
|
13417
13588
|
);
|
|
13418
|
-
|
|
13589
|
+
useEffect41(() => {
|
|
13419
13590
|
if (stickyHeroContext?.setCarouselIndicator && images.length > 1) {
|
|
13420
|
-
const indicator = /* @__PURE__ */
|
|
13591
|
+
const indicator = /* @__PURE__ */ jsx76(
|
|
13421
13592
|
"div",
|
|
13422
13593
|
{
|
|
13423
13594
|
className: "w-full",
|
|
13424
13595
|
role: "group",
|
|
13425
13596
|
"aria-label": "Product image navigation",
|
|
13426
13597
|
children: /* @__PURE__ */ jsxs50("div", { className: "relative h-1", children: [
|
|
13427
|
-
/* @__PURE__ */
|
|
13598
|
+
/* @__PURE__ */ jsx76("div", { className: "flex h-full", children: images.map((_, index) => /* @__PURE__ */ jsx76(
|
|
13428
13599
|
"button",
|
|
13429
13600
|
{
|
|
13430
13601
|
onClick: () => goToSlide(index),
|
|
@@ -13434,7 +13605,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13434
13605
|
},
|
|
13435
13606
|
index
|
|
13436
13607
|
)) }),
|
|
13437
|
-
/* @__PURE__ */
|
|
13608
|
+
/* @__PURE__ */ jsx76(
|
|
13438
13609
|
"div",
|
|
13439
13610
|
{
|
|
13440
13611
|
className: "absolute top-0 h-full bg-primary transition-all duration-300 ease-out",
|
|
@@ -13457,10 +13628,10 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13457
13628
|
};
|
|
13458
13629
|
}, [activeIndex, images.length, goToSlide, stickyHeroContext]);
|
|
13459
13630
|
if (!images || images.length === 0) {
|
|
13460
|
-
return /* @__PURE__ */
|
|
13631
|
+
return /* @__PURE__ */ jsx76("div", { className: "w-full aspect-video bg-muted rounded-lg" });
|
|
13461
13632
|
}
|
|
13462
|
-
return /* @__PURE__ */ jsxs50("div", { className: `relative w-full h-full ${className}`, children: [
|
|
13463
|
-
/* @__PURE__ */
|
|
13633
|
+
return /* @__PURE__ */ jsxs50("div", { className: `relative w-full h-full ${className}`, "data-gallery": "product", "data-gallery-skipped": skippedStamp, children: [
|
|
13634
|
+
/* @__PURE__ */ jsx76(
|
|
13464
13635
|
"div",
|
|
13465
13636
|
{
|
|
13466
13637
|
ref: carouselRef,
|
|
@@ -13478,7 +13649,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13478
13649
|
role: "region",
|
|
13479
13650
|
"aria-roledescription": "carousel",
|
|
13480
13651
|
"aria-label": "Product images",
|
|
13481
|
-
children: /* @__PURE__ */
|
|
13652
|
+
children: /* @__PURE__ */ jsx76(
|
|
13482
13653
|
"div",
|
|
13483
13654
|
{
|
|
13484
13655
|
className: `flex h-full ${isPeekReturning ? "transition-transform duration-300 ease-[cubic-bezier(0,0,0.2,1)]" : isPeeking ? "transition-transform duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]" : isTransitioning || !isDragging ? "transition-transform duration-300 ease-[cubic-bezier(0.25,0.46,0.45,0.94)]" : ""}`,
|
|
@@ -13496,11 +13667,11 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13496
13667
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13497
13668
|
...slideFirstViewProps(image.isRealMockup ? image : {}),
|
|
13498
13669
|
children: [
|
|
13499
|
-
!isWithinDecodeWindow ? /* @__PURE__ */
|
|
13670
|
+
!isWithinDecodeWindow ? /* @__PURE__ */ jsx76("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13500
13671
|
// Rainbow prism loader (same as the /create route) instead of
|
|
13501
13672
|
// a flat pulse; fills this relative slide via inset:0.
|
|
13502
|
-
/* @__PURE__ */
|
|
13503
|
-
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */
|
|
13673
|
+
/* @__PURE__ */ jsx76(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" })
|
|
13674
|
+
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ jsx76(
|
|
13504
13675
|
HeroProductImage,
|
|
13505
13676
|
{
|
|
13506
13677
|
productId,
|
|
@@ -13517,7 +13688,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13517
13688
|
viewportPolicy: true,
|
|
13518
13689
|
fit: slideFit(image.galleryRole)
|
|
13519
13690
|
}
|
|
13520
|
-
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */
|
|
13691
|
+
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ jsx76(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ jsx76(
|
|
13521
13692
|
StaticCarouselImage,
|
|
13522
13693
|
{
|
|
13523
13694
|
src: image.src,
|
|
@@ -13527,7 +13698,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13527
13698
|
),
|
|
13528
13699
|
isWithinDecodeWindow && (() => {
|
|
13529
13700
|
const action = renderImageAction?.(image, index);
|
|
13530
|
-
return action ? /* @__PURE__ */
|
|
13701
|
+
return action ? /* @__PURE__ */ jsx76(
|
|
13531
13702
|
"div",
|
|
13532
13703
|
{
|
|
13533
13704
|
className: "absolute top-3 right-3 z-10",
|
|
@@ -13541,14 +13712,14 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13541
13712
|
})()
|
|
13542
13713
|
]
|
|
13543
13714
|
},
|
|
13544
|
-
index
|
|
13715
|
+
image.mockupId ? `m:${image.mockupId}` : `i:${index}`
|
|
13545
13716
|
);
|
|
13546
13717
|
})
|
|
13547
13718
|
}
|
|
13548
13719
|
)
|
|
13549
13720
|
}
|
|
13550
13721
|
),
|
|
13551
|
-
showIndicators && images.length > 1 && /* @__PURE__ */
|
|
13722
|
+
showIndicators && images.length > 1 && /* @__PURE__ */ jsx76(
|
|
13552
13723
|
"div",
|
|
13553
13724
|
{
|
|
13554
13725
|
ref: indicatorRef,
|
|
@@ -13557,7 +13728,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13557
13728
|
role: "group",
|
|
13558
13729
|
"aria-label": "Product image navigation",
|
|
13559
13730
|
children: /* @__PURE__ */ jsxs50("div", { className: "relative h-1", children: [
|
|
13560
|
-
/* @__PURE__ */
|
|
13731
|
+
/* @__PURE__ */ jsx76("div", { className: "flex h-full absolute inset-0", children: images.map((_, index) => /* @__PURE__ */ jsx76(
|
|
13561
13732
|
"button",
|
|
13562
13733
|
{
|
|
13563
13734
|
onClick: () => goToSlide(index),
|
|
@@ -13567,7 +13738,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13567
13738
|
},
|
|
13568
13739
|
index
|
|
13569
13740
|
)) }),
|
|
13570
|
-
/* @__PURE__ */
|
|
13741
|
+
/* @__PURE__ */ jsx76(
|
|
13571
13742
|
"div",
|
|
13572
13743
|
{
|
|
13573
13744
|
className: `absolute top-0 h-full bg-foreground ${isPeekReturning ? "transition-all duration-300 ease-[cubic-bezier(0,0,0.2,1)]" : isPeeking ? "transition-all duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]" : isDragging ? "" : "transition-all duration-300 ease-out"}`,
|
|
@@ -13605,7 +13776,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13605
13776
|
...slideFirstViewFields(img)
|
|
13606
13777
|
} : null;
|
|
13607
13778
|
}).filter((img) => img !== null);
|
|
13608
|
-
return /* @__PURE__ */
|
|
13779
|
+
return /* @__PURE__ */ jsx76(
|
|
13609
13780
|
EnhancedImageViewer,
|
|
13610
13781
|
{
|
|
13611
13782
|
imageUrl,
|
|
@@ -13644,8 +13815,8 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13644
13815
|
});
|
|
13645
13816
|
|
|
13646
13817
|
// src/composed/carousels/HeroCarousel.tsx
|
|
13647
|
-
import { useState as
|
|
13648
|
-
import { jsx as
|
|
13818
|
+
import { useState as useState42, useRef as useRef28, useCallback as useCallback24, useEffect as useEffect42 } from "react";
|
|
13819
|
+
import { jsx as jsx77, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
13649
13820
|
function HeroCarousel({
|
|
13650
13821
|
images,
|
|
13651
13822
|
currentIndex = 0,
|
|
@@ -13655,16 +13826,16 @@ function HeroCarousel({
|
|
|
13655
13826
|
productId,
|
|
13656
13827
|
onImageTap
|
|
13657
13828
|
}) {
|
|
13658
|
-
const [activeIndex, setActiveIndex] =
|
|
13659
|
-
const containerRef =
|
|
13660
|
-
const touchStartRef =
|
|
13829
|
+
const [activeIndex, setActiveIndex] = useState42(currentIndex);
|
|
13830
|
+
const containerRef = useRef28(null);
|
|
13831
|
+
const touchStartRef = useRef28(
|
|
13661
13832
|
null
|
|
13662
13833
|
);
|
|
13663
|
-
const isSwipingRef =
|
|
13664
|
-
|
|
13834
|
+
const isSwipingRef = useRef28(false);
|
|
13835
|
+
useEffect42(() => {
|
|
13665
13836
|
setActiveIndex(currentIndex);
|
|
13666
13837
|
}, [currentIndex]);
|
|
13667
|
-
const goToSlide =
|
|
13838
|
+
const goToSlide = useCallback24(
|
|
13668
13839
|
(index) => {
|
|
13669
13840
|
const clampedIndex = Math.max(0, Math.min(images.length - 1, index));
|
|
13670
13841
|
setActiveIndex(clampedIndex);
|
|
@@ -13672,7 +13843,7 @@ function HeroCarousel({
|
|
|
13672
13843
|
},
|
|
13673
13844
|
[images.length, onIndexChange]
|
|
13674
13845
|
);
|
|
13675
|
-
|
|
13846
|
+
useEffect42(() => {
|
|
13676
13847
|
const container = containerRef.current;
|
|
13677
13848
|
if (!container) return;
|
|
13678
13849
|
const handleTouchStart = (e) => {
|
|
@@ -13724,7 +13895,7 @@ function HeroCarousel({
|
|
|
13724
13895
|
};
|
|
13725
13896
|
}, [activeIndex, images.length, goToSlide, onImageTap]);
|
|
13726
13897
|
if (!images || images.length === 0) {
|
|
13727
|
-
return /* @__PURE__ */
|
|
13898
|
+
return /* @__PURE__ */ jsx77("div", { className: "w-full h-full bg-muted" });
|
|
13728
13899
|
}
|
|
13729
13900
|
return /* @__PURE__ */ jsxs51(
|
|
13730
13901
|
"div",
|
|
@@ -13737,7 +13908,7 @@ function HeroCarousel({
|
|
|
13737
13908
|
overflow: "hidden"
|
|
13738
13909
|
},
|
|
13739
13910
|
children: [
|
|
13740
|
-
/* @__PURE__ */
|
|
13911
|
+
/* @__PURE__ */ jsx77(
|
|
13741
13912
|
"div",
|
|
13742
13913
|
{
|
|
13743
13914
|
className: "flex h-full transition-transform duration-300 ease-out",
|
|
@@ -13748,14 +13919,14 @@ function HeroCarousel({
|
|
|
13748
13919
|
backfaceVisibility: "hidden",
|
|
13749
13920
|
WebkitBackfaceVisibility: "hidden"
|
|
13750
13921
|
},
|
|
13751
|
-
children: images.map((image, index) => /* @__PURE__ */
|
|
13922
|
+
children: images.map((image, index) => /* @__PURE__ */ jsx77(
|
|
13752
13923
|
"div",
|
|
13753
13924
|
{
|
|
13754
13925
|
className: "w-full h-full flex-shrink-0",
|
|
13755
13926
|
style: {
|
|
13756
13927
|
contain: "layout paint"
|
|
13757
13928
|
},
|
|
13758
|
-
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */
|
|
13929
|
+
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ jsx77(
|
|
13759
13930
|
HeroProductImage,
|
|
13760
13931
|
{
|
|
13761
13932
|
productId,
|
|
@@ -13764,7 +13935,7 @@ function HeroCarousel({
|
|
|
13764
13935
|
mockupId: image.mockupId,
|
|
13765
13936
|
className: "w-full h-full object-cover"
|
|
13766
13937
|
}
|
|
13767
|
-
) : /* @__PURE__ */
|
|
13938
|
+
) : /* @__PURE__ */ jsx77(
|
|
13768
13939
|
"img",
|
|
13769
13940
|
{
|
|
13770
13941
|
src: image.src,
|
|
@@ -13781,12 +13952,12 @@ function HeroCarousel({
|
|
|
13781
13952
|
))
|
|
13782
13953
|
}
|
|
13783
13954
|
),
|
|
13784
|
-
images.length > 1 && /* @__PURE__ */
|
|
13955
|
+
images.length > 1 && /* @__PURE__ */ jsx77(
|
|
13785
13956
|
"div",
|
|
13786
13957
|
{
|
|
13787
13958
|
className: "absolute bottom-4 left-0 right-0 flex justify-center gap-2 z-10",
|
|
13788
13959
|
style: { contain: "layout style" },
|
|
13789
|
-
children: images.map((_, index) => /* @__PURE__ */
|
|
13960
|
+
children: images.map((_, index) => /* @__PURE__ */ jsx77(
|
|
13790
13961
|
"button",
|
|
13791
13962
|
{
|
|
13792
13963
|
onClick: () => goToSlide(index),
|
|
@@ -13803,8 +13974,8 @@ function HeroCarousel({
|
|
|
13803
13974
|
}
|
|
13804
13975
|
|
|
13805
13976
|
// src/composed/grids/MasonryGrid.tsx
|
|
13806
|
-
import { useState as
|
|
13807
|
-
import { Fragment as Fragment19, jsx as
|
|
13977
|
+
import { useState as useState43, useEffect as useEffect43, useMemo as useMemo18 } from "react";
|
|
13978
|
+
import { Fragment as Fragment19, jsx as jsx78 } from "react/jsx-runtime";
|
|
13808
13979
|
var BREAKPOINTS = {
|
|
13809
13980
|
sm: 640,
|
|
13810
13981
|
md: 768,
|
|
@@ -13856,13 +14027,13 @@ function MasonryGrid({
|
|
|
13856
14027
|
className = "",
|
|
13857
14028
|
emptyContent
|
|
13858
14029
|
}) {
|
|
13859
|
-
const [columnCount, setColumnCount] =
|
|
14030
|
+
const [columnCount, setColumnCount] = useState43(
|
|
13860
14031
|
() => typeof columns === "number" ? columns : getColumnCount(
|
|
13861
14032
|
typeof window !== "undefined" ? window.innerWidth : 1024,
|
|
13862
14033
|
columns
|
|
13863
14034
|
)
|
|
13864
14035
|
);
|
|
13865
|
-
|
|
14036
|
+
useEffect43(() => {
|
|
13866
14037
|
const updateColumnCount = () => {
|
|
13867
14038
|
setColumnCount(getColumnCount(window.innerWidth, columns));
|
|
13868
14039
|
};
|
|
@@ -13870,30 +14041,30 @@ function MasonryGrid({
|
|
|
13870
14041
|
window.addEventListener("resize", updateColumnCount);
|
|
13871
14042
|
return () => window.removeEventListener("resize", updateColumnCount);
|
|
13872
14043
|
}, [columns]);
|
|
13873
|
-
const distributedColumns =
|
|
14044
|
+
const distributedColumns = useMemo18(
|
|
13874
14045
|
() => distributeItems(items, columnCount),
|
|
13875
14046
|
[items, columnCount]
|
|
13876
14047
|
);
|
|
13877
14048
|
if (items.length === 0) {
|
|
13878
14049
|
if (emptyContent) {
|
|
13879
|
-
return /* @__PURE__ */
|
|
14050
|
+
return /* @__PURE__ */ jsx78(Fragment19, { children: emptyContent });
|
|
13880
14051
|
}
|
|
13881
14052
|
return null;
|
|
13882
14053
|
}
|
|
13883
|
-
return /* @__PURE__ */
|
|
14054
|
+
return /* @__PURE__ */ jsx78(
|
|
13884
14055
|
"div",
|
|
13885
14056
|
{
|
|
13886
14057
|
className: `flex ${className}`,
|
|
13887
14058
|
style: { gap: `${gap}px` },
|
|
13888
14059
|
role: "list",
|
|
13889
|
-
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */
|
|
14060
|
+
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ jsx78(
|
|
13890
14061
|
"div",
|
|
13891
14062
|
{
|
|
13892
14063
|
className: "flex-1 flex flex-col",
|
|
13893
14064
|
style: { gap: `${gap}px` },
|
|
13894
14065
|
children: columnItems.map((item, itemIndex) => {
|
|
13895
14066
|
const originalIndex = itemIndex * columnCount + columnIndex;
|
|
13896
|
-
return /* @__PURE__ */
|
|
14067
|
+
return /* @__PURE__ */ jsx78("div", { role: "listitem", children: renderItem(item, originalIndex) }, originalIndex);
|
|
13897
14068
|
})
|
|
13898
14069
|
},
|
|
13899
14070
|
columnIndex
|
|
@@ -13903,7 +14074,7 @@ function MasonryGrid({
|
|
|
13903
14074
|
}
|
|
13904
14075
|
|
|
13905
14076
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
13906
|
-
import { useEffect as
|
|
14077
|
+
import { useEffect as useEffect45, useRef as useRef29 } from "react";
|
|
13907
14078
|
|
|
13908
14079
|
// src/layouts/hero-zoom/types.ts
|
|
13909
14080
|
var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
@@ -13915,19 +14086,19 @@ var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
|
13915
14086
|
};
|
|
13916
14087
|
|
|
13917
14088
|
// src/layouts/hero-zoom/useHeroZoomScales.ts
|
|
13918
|
-
import { useEffect as
|
|
14089
|
+
import { useEffect as useEffect44, useState as useState44, useCallback as useCallback25 } from "react";
|
|
13919
14090
|
function useHeroZoomScales(config = {}) {
|
|
13920
14091
|
const { initialScale, accountForRetina, maxRetinaMultiplier } = {
|
|
13921
14092
|
...DEFAULT_HERO_ZOOM_CONFIG,
|
|
13922
14093
|
...config
|
|
13923
14094
|
};
|
|
13924
|
-
const [isHydrated, setIsHydrated] =
|
|
14095
|
+
const [isHydrated, setIsHydrated] = useState44(false);
|
|
13925
14096
|
const ssrMultiplier = accountForRetina ? maxRetinaMultiplier : 2;
|
|
13926
|
-
const [scales, setScales] =
|
|
14097
|
+
const [scales, setScales] = useState44(() => ({
|
|
13927
14098
|
visual: initialScale,
|
|
13928
14099
|
render: initialScale * ssrMultiplier
|
|
13929
14100
|
}));
|
|
13930
|
-
const calculateScales =
|
|
14101
|
+
const calculateScales = useCallback25(() => {
|
|
13931
14102
|
const visualScale = Math.max(1, Math.min(4, initialScale));
|
|
13932
14103
|
let renderScale;
|
|
13933
14104
|
if (accountForRetina) {
|
|
@@ -13942,7 +14113,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
13942
14113
|
renderScale = Math.max(1, Math.min(8, renderScale));
|
|
13943
14114
|
return { visual: visualScale, render: renderScale };
|
|
13944
14115
|
}, [initialScale, accountForRetina, maxRetinaMultiplier]);
|
|
13945
|
-
|
|
14116
|
+
useEffect44(() => {
|
|
13946
14117
|
const supportsScrollTimeline = CSS.supports(
|
|
13947
14118
|
"animation-timeline",
|
|
13948
14119
|
"scroll()"
|
|
@@ -13992,7 +14163,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
13992
14163
|
}
|
|
13993
14164
|
|
|
13994
14165
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
13995
|
-
import { jsx as
|
|
14166
|
+
import { jsx as jsx79, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
13996
14167
|
function HeroZoomLayout({
|
|
13997
14168
|
config = {},
|
|
13998
14169
|
header,
|
|
@@ -14007,9 +14178,9 @@ function HeroZoomLayout({
|
|
|
14007
14178
|
};
|
|
14008
14179
|
const { aspectRatio, initialScale, headerHeight } = mergedConfig;
|
|
14009
14180
|
const { visual, render, isHydrated } = useHeroZoomScales(mergedConfig);
|
|
14010
|
-
const imageContainerRef =
|
|
14011
|
-
const headerRef =
|
|
14012
|
-
|
|
14181
|
+
const imageContainerRef = useRef29(null);
|
|
14182
|
+
const headerRef = useRef29(null);
|
|
14183
|
+
useEffect45(() => {
|
|
14013
14184
|
if (typeof window === "undefined") return;
|
|
14014
14185
|
const originalRestoration = "scrollRestoration" in history ? history.scrollRestoration : "auto";
|
|
14015
14186
|
if ("scrollRestoration" in history) {
|
|
@@ -14022,7 +14193,7 @@ function HeroZoomLayout({
|
|
|
14022
14193
|
}
|
|
14023
14194
|
};
|
|
14024
14195
|
}, []);
|
|
14025
|
-
|
|
14196
|
+
useEffect45(() => {
|
|
14026
14197
|
const supportsScrollTimeline = CSS.supports(
|
|
14027
14198
|
"animation-timeline",
|
|
14028
14199
|
"scroll()"
|
|
@@ -14165,8 +14336,8 @@ function HeroZoomLayout({
|
|
|
14165
14336
|
"--hero-zoom-final-transform": 1 / activeRender
|
|
14166
14337
|
},
|
|
14167
14338
|
children: [
|
|
14168
|
-
/* @__PURE__ */
|
|
14169
|
-
/* @__PURE__ */
|
|
14339
|
+
/* @__PURE__ */ jsx79("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14340
|
+
/* @__PURE__ */ jsx79(
|
|
14170
14341
|
"div",
|
|
14171
14342
|
{
|
|
14172
14343
|
style: {
|
|
@@ -14174,7 +14345,7 @@ function HeroZoomLayout({
|
|
|
14174
14345
|
}
|
|
14175
14346
|
}
|
|
14176
14347
|
),
|
|
14177
|
-
header && /* @__PURE__ */
|
|
14348
|
+
header && /* @__PURE__ */ jsx79(
|
|
14178
14349
|
"div",
|
|
14179
14350
|
{
|
|
14180
14351
|
ref: headerRef,
|
|
@@ -14187,7 +14358,7 @@ function HeroZoomLayout({
|
|
|
14187
14358
|
children: header
|
|
14188
14359
|
}
|
|
14189
14360
|
),
|
|
14190
|
-
/* @__PURE__ */
|
|
14361
|
+
/* @__PURE__ */ jsx79(
|
|
14191
14362
|
"div",
|
|
14192
14363
|
{
|
|
14193
14364
|
ref: imageContainerRef,
|
|
@@ -14207,15 +14378,15 @@ function HeroZoomLayout({
|
|
|
14207
14378
|
children: hero
|
|
14208
14379
|
}
|
|
14209
14380
|
),
|
|
14210
|
-
/* @__PURE__ */
|
|
14381
|
+
/* @__PURE__ */ jsx79("div", { className: "relative z-10", children })
|
|
14211
14382
|
]
|
|
14212
14383
|
}
|
|
14213
14384
|
);
|
|
14214
14385
|
}
|
|
14215
14386
|
|
|
14216
14387
|
// src/layouts/hero-zoom/HeroShrinkLayout.tsx
|
|
14217
|
-
import { useEffect as
|
|
14218
|
-
import { jsx as
|
|
14388
|
+
import { useEffect as useEffect46, useRef as useRef30, useState as useState45 } from "react";
|
|
14389
|
+
import { jsx as jsx80, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14219
14390
|
var DEFAULT_CONFIG = {
|
|
14220
14391
|
aspectRatio: 16 / 9,
|
|
14221
14392
|
initialHeightPercent: 70,
|
|
@@ -14235,13 +14406,13 @@ function HeroShrinkLayout({
|
|
|
14235
14406
|
...config
|
|
14236
14407
|
};
|
|
14237
14408
|
const { aspectRatio, initialHeightPercent, minHeightPercent, headerHeight } = mergedConfig;
|
|
14238
|
-
const heroRef =
|
|
14239
|
-
const headerRef =
|
|
14240
|
-
const [isClient, setIsClient] =
|
|
14241
|
-
|
|
14409
|
+
const heroRef = useRef30(null);
|
|
14410
|
+
const headerRef = useRef30(null);
|
|
14411
|
+
const [isClient, setIsClient] = useState45(false);
|
|
14412
|
+
useEffect46(() => {
|
|
14242
14413
|
setIsClient(true);
|
|
14243
14414
|
}, []);
|
|
14244
|
-
|
|
14415
|
+
useEffect46(() => {
|
|
14245
14416
|
if (!isClient) return;
|
|
14246
14417
|
const supportsScrollTimeline = CSS.supports("animation-timeline", "scroll()");
|
|
14247
14418
|
if (supportsScrollTimeline) return;
|
|
@@ -14334,9 +14505,9 @@ function HeroShrinkLayout({
|
|
|
14334
14505
|
className: `relative min-h-screen ${className}`,
|
|
14335
14506
|
style: { ...style, ...cssVars },
|
|
14336
14507
|
children: [
|
|
14337
|
-
/* @__PURE__ */
|
|
14338
|
-
/* @__PURE__ */
|
|
14339
|
-
header && /* @__PURE__ */
|
|
14508
|
+
/* @__PURE__ */ jsx80("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14509
|
+
/* @__PURE__ */ jsx80("div", { style: { height: spacerHeight } }),
|
|
14510
|
+
header && /* @__PURE__ */ jsx80(
|
|
14340
14511
|
"div",
|
|
14341
14512
|
{
|
|
14342
14513
|
ref: headerRef,
|
|
@@ -14345,7 +14516,7 @@ function HeroShrinkLayout({
|
|
|
14345
14516
|
children: header
|
|
14346
14517
|
}
|
|
14347
14518
|
),
|
|
14348
|
-
/* @__PURE__ */
|
|
14519
|
+
/* @__PURE__ */ jsx80(
|
|
14349
14520
|
"div",
|
|
14350
14521
|
{
|
|
14351
14522
|
ref: heroRef,
|
|
@@ -14353,15 +14524,15 @@ function HeroShrinkLayout({
|
|
|
14353
14524
|
children: hero
|
|
14354
14525
|
}
|
|
14355
14526
|
),
|
|
14356
|
-
/* @__PURE__ */
|
|
14527
|
+
/* @__PURE__ */ jsx80("div", { className: "relative z-10 bg-background", children })
|
|
14357
14528
|
]
|
|
14358
14529
|
}
|
|
14359
14530
|
);
|
|
14360
14531
|
}
|
|
14361
14532
|
|
|
14362
14533
|
// src/layouts/pdp/ImageEdgeBlur.tsx
|
|
14363
|
-
import
|
|
14364
|
-
import { jsx as
|
|
14534
|
+
import React54 from "react";
|
|
14535
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
14365
14536
|
var BLUR_CONFIG = {
|
|
14366
14537
|
blur: 24,
|
|
14367
14538
|
crossfade: 68
|
|
@@ -14385,7 +14556,7 @@ var BLUR_LAYERS = [
|
|
|
14385
14556
|
{ blur: Math.round(BLUR_CONFIG.blur * 0.5), zone: 0.6 },
|
|
14386
14557
|
{ blur: BLUR_CONFIG.blur, zone: 1 }
|
|
14387
14558
|
];
|
|
14388
|
-
var ImageEdgeBlur =
|
|
14559
|
+
var ImageEdgeBlur = React54.memo(
|
|
14389
14560
|
function ImageEdgeBlur2({
|
|
14390
14561
|
imageSrc,
|
|
14391
14562
|
imageCapInfo,
|
|
@@ -14416,7 +14587,7 @@ var ImageEdgeBlur = React53.memo(
|
|
|
14416
14587
|
viewportWidth / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO,
|
|
14417
14588
|
maxWidthPx / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO
|
|
14418
14589
|
);
|
|
14419
|
-
return /* @__PURE__ */
|
|
14590
|
+
return /* @__PURE__ */ jsx81(
|
|
14420
14591
|
"div",
|
|
14421
14592
|
{
|
|
14422
14593
|
className: `absolute inset-0 pointer-events-none overflow-hidden ${className}`,
|
|
@@ -14424,7 +14595,7 @@ var ImageEdgeBlur = React53.memo(
|
|
|
14424
14595
|
children: BLUR_LAYERS.map((layer, index) => {
|
|
14425
14596
|
const layerMask = index === BLUR_LAYERS.length - 1 ? void 0 : `linear-gradient(to right, black 0%, black ${layer.zone * 100}%, transparent ${layer.zone * 100 + 10}%)`;
|
|
14426
14597
|
const blurScale = 1 + layer.blur * 3 / containerHeightPx;
|
|
14427
|
-
return /* @__PURE__ */
|
|
14598
|
+
return /* @__PURE__ */ jsx81(
|
|
14428
14599
|
"img",
|
|
14429
14600
|
{
|
|
14430
14601
|
src: imageSrc,
|
|
@@ -14471,7 +14642,7 @@ var ImageEdgeBlur = React53.memo(
|
|
|
14471
14642
|
);
|
|
14472
14643
|
|
|
14473
14644
|
// src/layouts/pdp/PDPLayout.tsx
|
|
14474
|
-
import { jsx as
|
|
14645
|
+
import { jsx as jsx82, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
14475
14646
|
function PDPLayout({
|
|
14476
14647
|
renderHeroImage,
|
|
14477
14648
|
renderContent,
|
|
@@ -14501,13 +14672,13 @@ function PDPLayout({
|
|
|
14501
14672
|
};
|
|
14502
14673
|
return /* @__PURE__ */ jsxs54("div", { className: `pdp-layout ${className}`, children: [
|
|
14503
14674
|
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ jsxs54("div", { className: "md:hidden", children: [
|
|
14504
|
-
renderMobileCarousel && /* @__PURE__ */
|
|
14505
|
-
/* @__PURE__ */
|
|
14675
|
+
renderMobileCarousel && /* @__PURE__ */ jsx82("div", { className: "mobile-carousel-container", children: renderMobileCarousel({ images: carouselImages }) }),
|
|
14676
|
+
/* @__PURE__ */ jsx82("div", { className: "mobile-content p-4", children: renderContent(contentProps) })
|
|
14506
14677
|
] }),
|
|
14507
14678
|
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ jsxs54("div", { className: "hidden md:block relative", children: [
|
|
14508
14679
|
/* @__PURE__ */ jsxs54("div", { className: "desktop-hero relative", children: [
|
|
14509
14680
|
renderHeroImage(heroProps),
|
|
14510
|
-
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */
|
|
14681
|
+
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ jsx82(
|
|
14511
14682
|
ImageEdgeBlur,
|
|
14512
14683
|
{
|
|
14513
14684
|
imageSrc: blurImageSrc,
|
|
@@ -14518,7 +14689,7 @@ function PDPLayout({
|
|
|
14518
14689
|
}
|
|
14519
14690
|
)
|
|
14520
14691
|
] }),
|
|
14521
|
-
/* @__PURE__ */
|
|
14692
|
+
/* @__PURE__ */ jsx82(
|
|
14522
14693
|
"div",
|
|
14523
14694
|
{
|
|
14524
14695
|
className: "desktop-sidebar",
|
|
@@ -14535,8 +14706,8 @@ function PDPLayout({
|
|
|
14535
14706
|
}
|
|
14536
14707
|
|
|
14537
14708
|
// src/layouts/pdp/SimpleImageBlur.tsx
|
|
14538
|
-
import
|
|
14539
|
-
import { jsx as
|
|
14709
|
+
import React55 from "react";
|
|
14710
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
14540
14711
|
var BLUR_CONFIG2 = {
|
|
14541
14712
|
blur: 24,
|
|
14542
14713
|
crossfade: 60
|
|
@@ -14559,7 +14730,7 @@ function getFadeInMask(crossfadeWidth) {
|
|
|
14559
14730
|
black ${crossfadeWidth + 10}px
|
|
14560
14731
|
)`;
|
|
14561
14732
|
}
|
|
14562
|
-
var SimpleImageBlur =
|
|
14733
|
+
var SimpleImageBlur = React55.memo(function SimpleImageBlur2({
|
|
14563
14734
|
imageSrc,
|
|
14564
14735
|
width,
|
|
14565
14736
|
height = "100%",
|
|
@@ -14569,7 +14740,7 @@ var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
|
14569
14740
|
if (!imageSrc || width <= 0) return null;
|
|
14570
14741
|
const fadeInMask = getFadeInMask(BLUR_CONFIG2.crossfade);
|
|
14571
14742
|
const extendedWidth = width + BLUR_CONFIG2.blur * 2;
|
|
14572
|
-
return /* @__PURE__ */
|
|
14743
|
+
return /* @__PURE__ */ jsx83(
|
|
14573
14744
|
"div",
|
|
14574
14745
|
{
|
|
14575
14746
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -14582,7 +14753,7 @@ var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
|
14582
14753
|
black 0%,
|
|
14583
14754
|
black ${layer.zone * 100}%,
|
|
14584
14755
|
transparent ${layer.zone * 100 + 10}%)`;
|
|
14585
|
-
return /* @__PURE__ */
|
|
14756
|
+
return /* @__PURE__ */ jsx83(
|
|
14586
14757
|
"img",
|
|
14587
14758
|
{
|
|
14588
14759
|
src: imageSrc,
|
|
@@ -14612,8 +14783,8 @@ var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
|
14612
14783
|
});
|
|
14613
14784
|
|
|
14614
14785
|
// src/layouts/pdp/EdgeBlurBox.tsx
|
|
14615
|
-
import
|
|
14616
|
-
import { jsx as
|
|
14786
|
+
import React56 from "react";
|
|
14787
|
+
import { jsx as jsx84, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
14617
14788
|
var BLUR_CONFIG3 = {
|
|
14618
14789
|
blur: 24,
|
|
14619
14790
|
crossfade: 60
|
|
@@ -14637,7 +14808,7 @@ function getFadeOutMask(crossfadeWidth) {
|
|
|
14637
14808
|
transparent 100%
|
|
14638
14809
|
)`;
|
|
14639
14810
|
}
|
|
14640
|
-
var EdgeBlurBox =
|
|
14811
|
+
var EdgeBlurBox = React56.memo(function EdgeBlurBox2({
|
|
14641
14812
|
imageSrc,
|
|
14642
14813
|
width,
|
|
14643
14814
|
height = "100%",
|
|
@@ -14663,7 +14834,7 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14663
14834
|
overflow: hasOverlap ? "visible" : "hidden"
|
|
14664
14835
|
},
|
|
14665
14836
|
children: [
|
|
14666
|
-
/* @__PURE__ */
|
|
14837
|
+
/* @__PURE__ */ jsx84(
|
|
14667
14838
|
"div",
|
|
14668
14839
|
{
|
|
14669
14840
|
style: {
|
|
@@ -14677,7 +14848,7 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14677
14848
|
transparent ${100 - (layer.zone * 100 + 10)}%,
|
|
14678
14849
|
black ${100 - layer.zone * 100}%,
|
|
14679
14850
|
black 100%)`;
|
|
14680
|
-
return /* @__PURE__ */
|
|
14851
|
+
return /* @__PURE__ */ jsx84(
|
|
14681
14852
|
"img",
|
|
14682
14853
|
{
|
|
14683
14854
|
src: imageSrc,
|
|
@@ -14705,7 +14876,7 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14705
14876
|
})
|
|
14706
14877
|
}
|
|
14707
14878
|
),
|
|
14708
|
-
/* @__PURE__ */
|
|
14879
|
+
/* @__PURE__ */ jsx84(
|
|
14709
14880
|
"img",
|
|
14710
14881
|
{
|
|
14711
14882
|
src: imageSrc,
|
|
@@ -14733,8 +14904,8 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14733
14904
|
});
|
|
14734
14905
|
|
|
14735
14906
|
// src/layouts/pdp/ImageBlurExtension.tsx
|
|
14736
|
-
import
|
|
14737
|
-
import { jsx as
|
|
14907
|
+
import React57 from "react";
|
|
14908
|
+
import { jsx as jsx85, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14738
14909
|
var BLUR_CONFIG4 = {
|
|
14739
14910
|
blur: 24,
|
|
14740
14911
|
crossfadeWidth: 80
|
|
@@ -14757,7 +14928,7 @@ function getFadeOutMask2(crossfadeWidth) {
|
|
|
14757
14928
|
transparent 100%
|
|
14758
14929
|
)`;
|
|
14759
14930
|
}
|
|
14760
|
-
var ImageBlurExtension =
|
|
14931
|
+
var ImageBlurExtension = React57.memo(function ImageBlurExtension2({
|
|
14761
14932
|
imageSrc,
|
|
14762
14933
|
width,
|
|
14763
14934
|
height,
|
|
@@ -14780,7 +14951,7 @@ var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
|
14780
14951
|
height: heightValue
|
|
14781
14952
|
},
|
|
14782
14953
|
children: [
|
|
14783
|
-
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */
|
|
14954
|
+
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ jsx85(
|
|
14784
14955
|
"img",
|
|
14785
14956
|
{
|
|
14786
14957
|
src: imageSrc,
|
|
@@ -14804,7 +14975,7 @@ var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
|
14804
14975
|
},
|
|
14805
14976
|
`blur-${index}`
|
|
14806
14977
|
)),
|
|
14807
|
-
/* @__PURE__ */
|
|
14978
|
+
/* @__PURE__ */ jsx85(
|
|
14808
14979
|
"img",
|
|
14809
14980
|
{
|
|
14810
14981
|
src: imageSrc,
|
|
@@ -14832,23 +15003,23 @@ var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
|
14832
15003
|
});
|
|
14833
15004
|
|
|
14834
15005
|
// src/design-system/ColorSwatch.tsx
|
|
14835
|
-
import { jsx as
|
|
15006
|
+
import { jsx as jsx86, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
14836
15007
|
function ColorTokenSwatch({ name, cssVar, className = "" }) {
|
|
14837
15008
|
return /* @__PURE__ */ jsxs57("div", { className: `flex flex-col gap-1 ${className}`, children: [
|
|
14838
|
-
/* @__PURE__ */
|
|
15009
|
+
/* @__PURE__ */ jsx86(
|
|
14839
15010
|
"div",
|
|
14840
15011
|
{
|
|
14841
15012
|
className: "h-16 w-full rounded-lg border border-border shadow-sm",
|
|
14842
15013
|
style: { backgroundColor: `var(${cssVar})` }
|
|
14843
15014
|
}
|
|
14844
15015
|
),
|
|
14845
|
-
/* @__PURE__ */
|
|
14846
|
-
/* @__PURE__ */
|
|
15016
|
+
/* @__PURE__ */ jsx86("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15017
|
+
/* @__PURE__ */ jsx86("code", { className: "text-xs text-muted-foreground font-mono", children: cssVar })
|
|
14847
15018
|
] });
|
|
14848
15019
|
}
|
|
14849
15020
|
function ColorRow({ name, cssVar, description }) {
|
|
14850
15021
|
return /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-4 py-2", children: [
|
|
14851
|
-
/* @__PURE__ */
|
|
15022
|
+
/* @__PURE__ */ jsx86(
|
|
14852
15023
|
"div",
|
|
14853
15024
|
{
|
|
14854
15025
|
className: "h-10 w-10 rounded-lg border border-border shadow-sm flex-shrink-0",
|
|
@@ -14856,15 +15027,15 @@ function ColorRow({ name, cssVar, description }) {
|
|
|
14856
15027
|
}
|
|
14857
15028
|
),
|
|
14858
15029
|
/* @__PURE__ */ jsxs57("div", { className: "flex-1 min-w-0", children: [
|
|
14859
|
-
/* @__PURE__ */
|
|
14860
|
-
description && /* @__PURE__ */
|
|
15030
|
+
/* @__PURE__ */ jsx86("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15031
|
+
description && /* @__PURE__ */ jsx86("div", { className: "text-xs text-muted-foreground", children: description })
|
|
14861
15032
|
] }),
|
|
14862
|
-
/* @__PURE__ */
|
|
15033
|
+
/* @__PURE__ */ jsx86("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: cssVar })
|
|
14863
15034
|
] });
|
|
14864
15035
|
}
|
|
14865
15036
|
|
|
14866
15037
|
// src/design-system/ColorPalette.tsx
|
|
14867
|
-
import { jsx as
|
|
15038
|
+
import { jsx as jsx87, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14868
15039
|
var COLOR_GROUPS = [
|
|
14869
15040
|
{
|
|
14870
15041
|
name: "Base",
|
|
@@ -14945,17 +15116,17 @@ var COLOR_GROUPS = [
|
|
|
14945
15116
|
}
|
|
14946
15117
|
];
|
|
14947
15118
|
function ColorPalette({ layout = "list", className = "" }) {
|
|
14948
|
-
return /* @__PURE__ */
|
|
14949
|
-
/* @__PURE__ */
|
|
14950
|
-
/* @__PURE__ */
|
|
14951
|
-
layout === "grid" ? /* @__PURE__ */
|
|
15119
|
+
return /* @__PURE__ */ jsx87("div", { className: `space-y-8 ${className}`, children: COLOR_GROUPS.map((group) => /* @__PURE__ */ jsxs58("section", { children: [
|
|
15120
|
+
/* @__PURE__ */ jsx87("h3", { className: "text-lg font-semibold text-foreground mb-1", children: group.name }),
|
|
15121
|
+
/* @__PURE__ */ jsx87("p", { className: "text-sm text-muted-foreground mb-4", children: group.description }),
|
|
15122
|
+
layout === "grid" ? /* @__PURE__ */ jsx87("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: group.colors.map((color) => /* @__PURE__ */ jsx87(
|
|
14952
15123
|
ColorTokenSwatch,
|
|
14953
15124
|
{
|
|
14954
15125
|
name: color.name,
|
|
14955
15126
|
cssVar: color.cssVar
|
|
14956
15127
|
},
|
|
14957
15128
|
color.cssVar
|
|
14958
|
-
)) }) : /* @__PURE__ */
|
|
15129
|
+
)) }) : /* @__PURE__ */ jsx87("div", { className: "bg-card rounded-lg border border-border p-4 divide-y divide-border", children: group.colors.map((color) => /* @__PURE__ */ jsx87(
|
|
14959
15130
|
ColorRow,
|
|
14960
15131
|
{
|
|
14961
15132
|
name: color.name,
|
|
@@ -14968,7 +15139,7 @@ function ColorPalette({ layout = "list", className = "" }) {
|
|
|
14968
15139
|
}
|
|
14969
15140
|
|
|
14970
15141
|
// src/design-system/TypographyScale.tsx
|
|
14971
|
-
import { jsx as
|
|
15142
|
+
import { jsx as jsx88, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
14972
15143
|
var FONT_SAMPLES = [
|
|
14973
15144
|
{
|
|
14974
15145
|
name: "Heading",
|
|
@@ -15002,14 +15173,14 @@ var FONT_SAMPLES = [
|
|
|
15002
15173
|
}
|
|
15003
15174
|
];
|
|
15004
15175
|
function TypographyScale({ className = "" }) {
|
|
15005
|
-
return /* @__PURE__ */
|
|
15176
|
+
return /* @__PURE__ */ jsx88("div", { className: `space-y-8 ${className}`, children: FONT_SAMPLES.map((font) => /* @__PURE__ */ jsxs59("section", { className: "bg-card rounded-lg border border-border p-6", children: [
|
|
15006
15177
|
/* @__PURE__ */ jsxs59("div", { className: "flex items-center justify-between mb-4", children: [
|
|
15007
|
-
/* @__PURE__ */
|
|
15008
|
-
/* @__PURE__ */
|
|
15178
|
+
/* @__PURE__ */ jsx88("h3", { className: "text-lg font-semibold text-foreground", children: font.name }),
|
|
15179
|
+
/* @__PURE__ */ jsx88("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: font.cssVar })
|
|
15009
15180
|
] }),
|
|
15010
|
-
/* @__PURE__ */
|
|
15011
|
-
/* @__PURE__ */
|
|
15012
|
-
/* @__PURE__ */
|
|
15181
|
+
/* @__PURE__ */ jsx88("div", { className: "space-y-4", children: font.sizes.map((size) => /* @__PURE__ */ jsxs59("div", { className: "flex items-baseline gap-4", children: [
|
|
15182
|
+
/* @__PURE__ */ jsx88("span", { className: "text-xs text-muted-foreground w-20 flex-shrink-0", children: size }),
|
|
15183
|
+
/* @__PURE__ */ jsx88(
|
|
15013
15184
|
"p",
|
|
15014
15185
|
{
|
|
15015
15186
|
className: `${size} text-foreground`,
|
|
@@ -15028,8 +15199,8 @@ var RADIUS_SAMPLES = [
|
|
|
15028
15199
|
{ name: "Full", value: "9999px" }
|
|
15029
15200
|
];
|
|
15030
15201
|
function RadiusScale({ className = "" }) {
|
|
15031
|
-
return /* @__PURE__ */
|
|
15032
|
-
/* @__PURE__ */
|
|
15202
|
+
return /* @__PURE__ */ jsx88("div", { className: `space-y-4 ${className}`, children: /* @__PURE__ */ jsx88("div", { className: "grid grid-cols-5 gap-4", children: RADIUS_SAMPLES.map((radius) => /* @__PURE__ */ jsxs59("div", { className: "flex flex-col items-center gap-2", children: [
|
|
15203
|
+
/* @__PURE__ */ jsx88(
|
|
15033
15204
|
"div",
|
|
15034
15205
|
{
|
|
15035
15206
|
className: "h-16 w-16 bg-primary",
|
|
@@ -15038,14 +15209,14 @@ function RadiusScale({ className = "" }) {
|
|
|
15038
15209
|
}
|
|
15039
15210
|
}
|
|
15040
15211
|
),
|
|
15041
|
-
/* @__PURE__ */
|
|
15042
|
-
/* @__PURE__ */
|
|
15212
|
+
/* @__PURE__ */ jsx88("span", { className: "text-sm font-medium text-foreground", children: radius.name }),
|
|
15213
|
+
/* @__PURE__ */ jsx88("code", { className: "text-xs text-muted-foreground font-mono", children: radius.cssVar || radius.value })
|
|
15043
15214
|
] }, radius.name)) }) });
|
|
15044
15215
|
}
|
|
15045
15216
|
|
|
15046
15217
|
// src/design-system/ThemeSwitcher.tsx
|
|
15047
|
-
import { useState as
|
|
15048
|
-
import { Fragment as Fragment20, jsx as
|
|
15218
|
+
import { useState as useState46, useEffect as useEffect47 } from "react";
|
|
15219
|
+
import { Fragment as Fragment20, jsx as jsx89, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
15049
15220
|
function readThemeFromDOM() {
|
|
15050
15221
|
if (typeof document === "undefined") {
|
|
15051
15222
|
return { themeName: "Linear", isDark: false };
|
|
@@ -15063,10 +15234,10 @@ function readThemeFromDOM() {
|
|
|
15063
15234
|
return { themeName: "Linear", isDark: dark };
|
|
15064
15235
|
}
|
|
15065
15236
|
function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
15066
|
-
const [currentTheme, setCurrentTheme] =
|
|
15067
|
-
const [isDark, setIsDark] =
|
|
15068
|
-
const [isOpen, setIsOpen] =
|
|
15069
|
-
|
|
15237
|
+
const [currentTheme, setCurrentTheme] = useState46("Linear");
|
|
15238
|
+
const [isDark, setIsDark] = useState46(false);
|
|
15239
|
+
const [isOpen, setIsOpen] = useState46(false);
|
|
15240
|
+
useEffect47(() => {
|
|
15070
15241
|
const { themeName, isDark: dark } = readThemeFromDOM();
|
|
15071
15242
|
setCurrentTheme(themeName);
|
|
15072
15243
|
setIsDark(dark);
|
|
@@ -15113,35 +15284,35 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15113
15284
|
onClick: () => setIsOpen(!isOpen),
|
|
15114
15285
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
15115
15286
|
children: [
|
|
15116
|
-
/* @__PURE__ */
|
|
15117
|
-
/* @__PURE__ */
|
|
15118
|
-
/* @__PURE__ */
|
|
15287
|
+
/* @__PURE__ */ jsx89("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01" }) }),
|
|
15288
|
+
/* @__PURE__ */ jsx89("span", { className: "font-medium", children: currentTheme }),
|
|
15289
|
+
/* @__PURE__ */ jsx89("svg", { className: `w-4 h-4 transition-transform ${isOpen ? "rotate-180" : ""}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
15119
15290
|
]
|
|
15120
15291
|
}
|
|
15121
15292
|
),
|
|
15122
15293
|
isOpen && /* @__PURE__ */ jsxs60(Fragment20, { children: [
|
|
15123
|
-
/* @__PURE__ */
|
|
15294
|
+
/* @__PURE__ */ jsx89(
|
|
15124
15295
|
"div",
|
|
15125
15296
|
{
|
|
15126
15297
|
className: "fixed inset-0 z-40",
|
|
15127
15298
|
onClick: () => setIsOpen(false)
|
|
15128
15299
|
}
|
|
15129
15300
|
),
|
|
15130
|
-
/* @__PURE__ */
|
|
15301
|
+
/* @__PURE__ */ jsx89("div", { className: "absolute top-full left-0 mt-2 w-56 max-h-80 overflow-auto bg-card border border-border rounded-lg shadow-lg z-50", children: themes.map((theme) => /* @__PURE__ */ jsxs60(
|
|
15131
15302
|
"button",
|
|
15132
15303
|
{
|
|
15133
15304
|
onClick: () => handleThemeSelect(theme.name),
|
|
15134
15305
|
className: `w-full px-4 py-2 text-left hover:bg-muted transition-colors flex items-center gap-3 ${currentTheme === theme.name ? "bg-muted" : ""}`,
|
|
15135
15306
|
children: [
|
|
15136
|
-
/* @__PURE__ */
|
|
15307
|
+
/* @__PURE__ */ jsx89(
|
|
15137
15308
|
"div",
|
|
15138
15309
|
{
|
|
15139
15310
|
className: "w-4 h-4 rounded-full border border-border",
|
|
15140
15311
|
style: { backgroundColor: theme.primaryColor || "#888" }
|
|
15141
15312
|
}
|
|
15142
15313
|
),
|
|
15143
|
-
/* @__PURE__ */
|
|
15144
|
-
currentTheme === theme.name && /* @__PURE__ */
|
|
15314
|
+
/* @__PURE__ */ jsx89("span", { className: "text-foreground", children: theme.name }),
|
|
15315
|
+
currentTheme === theme.name && /* @__PURE__ */ jsx89("svg", { className: "w-4 h-4 ml-auto text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
15145
15316
|
]
|
|
15146
15317
|
},
|
|
15147
15318
|
theme.name
|
|
@@ -15156,10 +15327,10 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15156
15327
|
title: `Switch to ${isDark ? "light" : "dark"} mode`,
|
|
15157
15328
|
children: [
|
|
15158
15329
|
isDark ? /* @__PURE__ */ jsxs60("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
15159
|
-
/* @__PURE__ */
|
|
15160
|
-
/* @__PURE__ */
|
|
15161
|
-
] }) : /* @__PURE__ */
|
|
15162
|
-
/* @__PURE__ */
|
|
15330
|
+
/* @__PURE__ */ jsx89("circle", { cx: "12", cy: "12", r: "5" }),
|
|
15331
|
+
/* @__PURE__ */ jsx89("path", { d: "M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" })
|
|
15332
|
+
] }) : /* @__PURE__ */ jsx89("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
15333
|
+
/* @__PURE__ */ jsx89("span", { className: "text-sm", children: isDark ? "Light" : "Dark" })
|
|
15163
15334
|
]
|
|
15164
15335
|
}
|
|
15165
15336
|
)
|
|
@@ -15167,7 +15338,7 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15167
15338
|
}
|
|
15168
15339
|
|
|
15169
15340
|
// src/design-system/DesignSystemPage.tsx
|
|
15170
|
-
import { jsx as
|
|
15341
|
+
import { jsx as jsx90, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15171
15342
|
function DesignSystemPage({
|
|
15172
15343
|
showThemeSwitcher = true,
|
|
15173
15344
|
showColors = true,
|
|
@@ -15178,28 +15349,28 @@ function DesignSystemPage({
|
|
|
15178
15349
|
className = ""
|
|
15179
15350
|
}) {
|
|
15180
15351
|
return /* @__PURE__ */ jsxs61("div", { className: `max-w-4xl mx-auto px-4 py-8 ${className}`, children: [
|
|
15181
|
-
/* @__PURE__ */
|
|
15352
|
+
/* @__PURE__ */ jsx90("header", { className: "mb-12", children: /* @__PURE__ */ jsxs61("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4", children: [
|
|
15182
15353
|
/* @__PURE__ */ jsxs61("div", { children: [
|
|
15183
|
-
/* @__PURE__ */
|
|
15184
|
-
/* @__PURE__ */
|
|
15354
|
+
/* @__PURE__ */ jsx90("h1", { className: "text-4xl font-bold text-foreground mb-2", children: "Design System" }),
|
|
15355
|
+
/* @__PURE__ */ jsx90("p", { className: "text-lg text-muted-foreground", children: "Visual reference for theme tokens and styles" })
|
|
15185
15356
|
] }),
|
|
15186
|
-
showThemeSwitcher && /* @__PURE__ */
|
|
15357
|
+
showThemeSwitcher && /* @__PURE__ */ jsx90(ThemeSwitcher, {})
|
|
15187
15358
|
] }) }),
|
|
15188
15359
|
showColors && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15189
|
-
/* @__PURE__ */
|
|
15190
|
-
/* @__PURE__ */
|
|
15360
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Color Palette" }),
|
|
15361
|
+
/* @__PURE__ */ jsx90(ColorPalette, { layout: colorLayout })
|
|
15191
15362
|
] }),
|
|
15192
15363
|
showTypography && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15193
|
-
/* @__PURE__ */
|
|
15194
|
-
/* @__PURE__ */
|
|
15364
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Typography" }),
|
|
15365
|
+
/* @__PURE__ */ jsx90(TypographyScale, {})
|
|
15195
15366
|
] }),
|
|
15196
15367
|
showRadius && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15197
|
-
/* @__PURE__ */
|
|
15198
|
-
/* @__PURE__ */
|
|
15368
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Border Radius" }),
|
|
15369
|
+
/* @__PURE__ */ jsx90(RadiusScale, {})
|
|
15199
15370
|
] }),
|
|
15200
15371
|
showSpacing && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15201
|
-
/* @__PURE__ */
|
|
15202
|
-
/* @__PURE__ */
|
|
15372
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Spacing Scale" }),
|
|
15373
|
+
/* @__PURE__ */ jsx90(SpacingScale, {})
|
|
15203
15374
|
] })
|
|
15204
15375
|
] });
|
|
15205
15376
|
}
|
|
@@ -15214,47 +15385,47 @@ function SpacingScale() {
|
|
|
15214
15385
|
{ name: "12", value: "3rem" },
|
|
15215
15386
|
{ name: "16", value: "4rem" }
|
|
15216
15387
|
];
|
|
15217
|
-
return /* @__PURE__ */
|
|
15218
|
-
/* @__PURE__ */
|
|
15219
|
-
/* @__PURE__ */
|
|
15388
|
+
return /* @__PURE__ */ jsx90("div", { className: "space-y-2", children: spaces.map((space) => /* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-4", children: [
|
|
15389
|
+
/* @__PURE__ */ jsx90("code", { className: "text-xs text-muted-foreground font-mono w-8", children: space.name }),
|
|
15390
|
+
/* @__PURE__ */ jsx90(
|
|
15220
15391
|
"div",
|
|
15221
15392
|
{
|
|
15222
15393
|
className: "h-4 bg-primary rounded",
|
|
15223
15394
|
style: { width: space.value }
|
|
15224
15395
|
}
|
|
15225
15396
|
),
|
|
15226
|
-
/* @__PURE__ */
|
|
15397
|
+
/* @__PURE__ */ jsx90("span", { className: "text-sm text-muted-foreground", children: space.value })
|
|
15227
15398
|
] }, space.name)) });
|
|
15228
15399
|
}
|
|
15229
15400
|
|
|
15230
15401
|
// src/personalization/PersonalizationProvider.tsx
|
|
15231
|
-
import
|
|
15232
|
-
useState as
|
|
15233
|
-
useCallback as
|
|
15234
|
-
useRef as
|
|
15235
|
-
useEffect as
|
|
15402
|
+
import React58, {
|
|
15403
|
+
useState as useState47,
|
|
15404
|
+
useCallback as useCallback27,
|
|
15405
|
+
useRef as useRef31,
|
|
15406
|
+
useEffect as useEffect48
|
|
15236
15407
|
} from "react";
|
|
15237
15408
|
|
|
15238
15409
|
// src/personalization/PersonalizationContext.ts
|
|
15239
|
-
import { createContext as
|
|
15240
|
-
var PersonalizationContext =
|
|
15410
|
+
import { createContext as createContext12, useContext as useContext10 } from "react";
|
|
15411
|
+
var PersonalizationContext = createContext12(null);
|
|
15241
15412
|
function usePersonalizationContext() {
|
|
15242
|
-
return
|
|
15413
|
+
return useContext10(PersonalizationContext);
|
|
15243
15414
|
}
|
|
15244
15415
|
|
|
15245
15416
|
// src/personalization/PersonalizationProvider.tsx
|
|
15246
|
-
import { Fragment as Fragment21, jsx as
|
|
15417
|
+
import { Fragment as Fragment21, jsx as jsx91, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
15247
15418
|
function createBridgeFromCanvas(canvasModule) {
|
|
15248
15419
|
const { useEditor, useCommands, useImageBinding } = canvasModule;
|
|
15249
15420
|
function TextBinder({ name, value }) {
|
|
15250
15421
|
const { elements } = useEditor();
|
|
15251
15422
|
const { executeElementUpdate } = useCommands();
|
|
15252
|
-
const elementsRef =
|
|
15423
|
+
const elementsRef = React58.useRef(elements);
|
|
15253
15424
|
elementsRef.current = elements;
|
|
15254
|
-
const executeRef =
|
|
15425
|
+
const executeRef = React58.useRef(executeElementUpdate);
|
|
15255
15426
|
executeRef.current = executeElementUpdate;
|
|
15256
|
-
const hasUserInput =
|
|
15257
|
-
|
|
15427
|
+
const hasUserInput = React58.useRef(false);
|
|
15428
|
+
React58.useEffect(() => {
|
|
15258
15429
|
if (value == null) return;
|
|
15259
15430
|
if (value === "" && !hasUserInput.current) return;
|
|
15260
15431
|
hasUserInput.current = true;
|
|
@@ -15272,12 +15443,12 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15272
15443
|
function ColorBinder({ originalColor, newColor }) {
|
|
15273
15444
|
const { elements } = useEditor();
|
|
15274
15445
|
const { executeElementUpdate } = useCommands();
|
|
15275
|
-
const elementsRef =
|
|
15446
|
+
const elementsRef = React58.useRef(elements);
|
|
15276
15447
|
elementsRef.current = elements;
|
|
15277
|
-
const executeRef =
|
|
15448
|
+
const executeRef = React58.useRef(executeElementUpdate);
|
|
15278
15449
|
executeRef.current = executeElementUpdate;
|
|
15279
|
-
const appliedColorRef =
|
|
15280
|
-
|
|
15450
|
+
const appliedColorRef = React58.useRef(normalizeHex(originalColor));
|
|
15451
|
+
React58.useEffect(() => {
|
|
15281
15452
|
const normalizedNew = normalizeHex(newColor);
|
|
15282
15453
|
if (normalizedNew === appliedColorRef.current) return;
|
|
15283
15454
|
const matchColor = appliedColorRef.current;
|
|
@@ -15317,11 +15488,11 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15317
15488
|
}
|
|
15318
15489
|
function ImageBinder({ name, value, fit = "cover" }) {
|
|
15319
15490
|
const { setImageUrl } = useImageBinding(name, { fit });
|
|
15320
|
-
const hasUserInput =
|
|
15491
|
+
const hasUserInput = React58.useRef(false);
|
|
15321
15492
|
const debouncedValue = useDebouncedValue(value, 500);
|
|
15322
|
-
const setImageUrlRef =
|
|
15493
|
+
const setImageUrlRef = React58.useRef(setImageUrl);
|
|
15323
15494
|
setImageUrlRef.current = setImageUrl;
|
|
15324
|
-
|
|
15495
|
+
React58.useEffect(() => {
|
|
15325
15496
|
if (debouncedValue == null) return;
|
|
15326
15497
|
if (debouncedValue === "" && !hasUserInput.current) return;
|
|
15327
15498
|
hasUserInput.current = true;
|
|
@@ -15331,15 +15502,15 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15331
15502
|
return null;
|
|
15332
15503
|
}
|
|
15333
15504
|
return function PersonalizationBridge({ fields = [], values = {} } = {}) {
|
|
15334
|
-
return /* @__PURE__ */
|
|
15505
|
+
return /* @__PURE__ */ jsx91(Fragment21, { children: fields.map((field) => {
|
|
15335
15506
|
if (field.type === "text") {
|
|
15336
|
-
return /* @__PURE__ */
|
|
15507
|
+
return /* @__PURE__ */ jsx91(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
|
|
15337
15508
|
}
|
|
15338
15509
|
if (field.type === "color") {
|
|
15339
|
-
return /* @__PURE__ */
|
|
15510
|
+
return /* @__PURE__ */ jsx91(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
|
|
15340
15511
|
}
|
|
15341
15512
|
if (field.type === "image") {
|
|
15342
|
-
return /* @__PURE__ */
|
|
15513
|
+
return /* @__PURE__ */ jsx91(ImageBinder, { name: field.name, value: values[field.name] ?? "", fit: field.fit ?? "cover" }, `image-${field.name}`);
|
|
15343
15514
|
}
|
|
15344
15515
|
return null;
|
|
15345
15516
|
}) });
|
|
@@ -15361,20 +15532,20 @@ function PersonalizationProvider({
|
|
|
15361
15532
|
children
|
|
15362
15533
|
}) {
|
|
15363
15534
|
const realtime = useRealtimeOptional();
|
|
15364
|
-
const [personValues, setPersonValues] =
|
|
15365
|
-
const [isActive, setIsActive] =
|
|
15366
|
-
const [isExporting, setIsExporting] =
|
|
15367
|
-
const [exportedBlobUrls, setExportedBlobUrls] =
|
|
15368
|
-
const [exportCount, setExportCount] =
|
|
15369
|
-
const blobUrlsRef =
|
|
15370
|
-
const [CanvasComponent, setCanvasComponent] =
|
|
15535
|
+
const [personValues, setPersonValues] = useState47(initialValues ?? {});
|
|
15536
|
+
const [isActive, setIsActive] = useState47(!!(initialValues && Object.keys(initialValues).length > 0));
|
|
15537
|
+
const [isExporting, setIsExporting] = useState47(false);
|
|
15538
|
+
const [exportedBlobUrls, setExportedBlobUrls] = useState47({});
|
|
15539
|
+
const [exportCount, setExportCount] = useState47(0);
|
|
15540
|
+
const blobUrlsRef = useRef31({});
|
|
15541
|
+
const [CanvasComponent, setCanvasComponent] = useState47(
|
|
15371
15542
|
cachedCanvasComponent
|
|
15372
15543
|
);
|
|
15373
|
-
const [BridgeComponent, setBridgeComponent] =
|
|
15544
|
+
const [BridgeComponent, setBridgeComponent] = useState47(
|
|
15374
15545
|
cachedBridgeComponent
|
|
15375
15546
|
);
|
|
15376
15547
|
const hasFields = fields.length > 0;
|
|
15377
|
-
|
|
15548
|
+
useEffect48(() => {
|
|
15378
15549
|
if (CanvasComponent && BridgeComponent) return;
|
|
15379
15550
|
if (!canvasImport || !hasFields) return;
|
|
15380
15551
|
if (!canvasLoadPromise) {
|
|
@@ -15392,8 +15563,8 @@ function PersonalizationProvider({
|
|
|
15392
15563
|
}
|
|
15393
15564
|
});
|
|
15394
15565
|
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
15395
|
-
const realtimeEnabledRef =
|
|
15396
|
-
|
|
15566
|
+
const realtimeEnabledRef = useRef31(false);
|
|
15567
|
+
useEffect48(() => {
|
|
15397
15568
|
return () => {
|
|
15398
15569
|
for (const url of Object.values(blobUrlsRef.current)) {
|
|
15399
15570
|
try {
|
|
@@ -15403,16 +15574,16 @@ function PersonalizationProvider({
|
|
|
15403
15574
|
}
|
|
15404
15575
|
};
|
|
15405
15576
|
}, []);
|
|
15406
|
-
const updateField =
|
|
15577
|
+
const updateField = useCallback27((key, value) => {
|
|
15407
15578
|
setIsActive(true);
|
|
15408
15579
|
setPersonValues((prev) => ({ ...prev, [key]: value }));
|
|
15409
15580
|
}, []);
|
|
15410
|
-
const reset =
|
|
15581
|
+
const reset = useCallback27(() => {
|
|
15411
15582
|
setPersonValues({});
|
|
15412
15583
|
setIsActive(false);
|
|
15413
15584
|
setIsExporting(false);
|
|
15414
15585
|
}, []);
|
|
15415
|
-
const handleExport =
|
|
15586
|
+
const handleExport = useCallback27(
|
|
15416
15587
|
(exports) => {
|
|
15417
15588
|
const newUrls = {};
|
|
15418
15589
|
for (const [name, data] of Object.entries(exports)) {
|
|
@@ -15446,11 +15617,11 @@ function PersonalizationProvider({
|
|
|
15446
15617
|
},
|
|
15447
15618
|
[realtime, placementOverride]
|
|
15448
15619
|
);
|
|
15449
|
-
const handleExportScheduled =
|
|
15620
|
+
const handleExportScheduled = useCallback27(() => {
|
|
15450
15621
|
setIsExporting(true);
|
|
15451
15622
|
}, []);
|
|
15452
15623
|
const shouldMountCanvas = CanvasComponent && BridgeComponent && canvasState?.elements && canvasState.elements.length > 0 && (!lazy || isActive);
|
|
15453
|
-
const contextValue =
|
|
15624
|
+
const contextValue = React58.useMemo(
|
|
15454
15625
|
() => ({
|
|
15455
15626
|
fields,
|
|
15456
15627
|
personValues,
|
|
@@ -15464,7 +15635,7 @@ function PersonalizationProvider({
|
|
|
15464
15635
|
[fields, personValues, updateField, isActive, isExporting, exportedBlobUrls, exportCount, reset]
|
|
15465
15636
|
);
|
|
15466
15637
|
return /* @__PURE__ */ jsxs62(PersonalizationContext.Provider, { value: contextValue, children: [
|
|
15467
|
-
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */
|
|
15638
|
+
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ jsx91(
|
|
15468
15639
|
"div",
|
|
15469
15640
|
{
|
|
15470
15641
|
style: {
|
|
@@ -15477,7 +15648,7 @@ function PersonalizationProvider({
|
|
|
15477
15648
|
pointerEvents: "none"
|
|
15478
15649
|
},
|
|
15479
15650
|
"aria-hidden": true,
|
|
15480
|
-
children: /* @__PURE__ */
|
|
15651
|
+
children: /* @__PURE__ */ jsx91(
|
|
15481
15652
|
CanvasComponent,
|
|
15482
15653
|
{
|
|
15483
15654
|
initialElements: canvasState?.elements,
|
|
@@ -15497,7 +15668,7 @@ function PersonalizationProvider({
|
|
|
15497
15668
|
exportImageQuality: exportConfig?.imageQuality ?? 0.85,
|
|
15498
15669
|
onExport: handleExport,
|
|
15499
15670
|
onExportScheduled: handleExportScheduled,
|
|
15500
|
-
overlay: /* @__PURE__ */
|
|
15671
|
+
overlay: /* @__PURE__ */ jsx91(BridgeComponent, { fields, values: personValues })
|
|
15501
15672
|
}
|
|
15502
15673
|
)
|
|
15503
15674
|
},
|
|
@@ -15522,7 +15693,7 @@ function usePersonalizationOptional() {
|
|
|
15522
15693
|
}
|
|
15523
15694
|
|
|
15524
15695
|
// src/personalization/PersonalizationInputs.tsx
|
|
15525
|
-
import { jsx as
|
|
15696
|
+
import { jsx as jsx92, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
15526
15697
|
function PersonalizationInputs({
|
|
15527
15698
|
className,
|
|
15528
15699
|
inputClassName = "w-full px-4 py-3 rounded-lg border text-base text-foreground placeholder:text-muted-foreground bg-white/50 outline-none focus:ring-2 focus:ring-foreground/20",
|
|
@@ -15547,7 +15718,7 @@ function PersonalizationInputs({
|
|
|
15547
15718
|
}
|
|
15548
15719
|
};
|
|
15549
15720
|
return /* @__PURE__ */ jsxs63("div", { className: className || "flex flex-col gap-3", children: [
|
|
15550
|
-
textFields.map((field) => /* @__PURE__ */
|
|
15721
|
+
textFields.map((field) => /* @__PURE__ */ jsx92(
|
|
15551
15722
|
"input",
|
|
15552
15723
|
{
|
|
15553
15724
|
type: "text",
|
|
@@ -15562,7 +15733,7 @@ function PersonalizationInputs({
|
|
|
15562
15733
|
`text-${field.name}`
|
|
15563
15734
|
)),
|
|
15564
15735
|
colorFields.map((field) => /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-3", children: [
|
|
15565
|
-
/* @__PURE__ */
|
|
15736
|
+
/* @__PURE__ */ jsx92(
|
|
15566
15737
|
"input",
|
|
15567
15738
|
{
|
|
15568
15739
|
type: "color",
|
|
@@ -15571,9 +15742,9 @@ function PersonalizationInputs({
|
|
|
15571
15742
|
onChange: (e) => updateField(field.color, e.target.value)
|
|
15572
15743
|
}
|
|
15573
15744
|
),
|
|
15574
|
-
/* @__PURE__ */
|
|
15745
|
+
/* @__PURE__ */ jsx92("span", { className: "text-base text-muted-foreground", children: field.label })
|
|
15575
15746
|
] }, `color-${field.color}`)),
|
|
15576
|
-
imageFields.map((field) => /* @__PURE__ */
|
|
15747
|
+
imageFields.map((field) => /* @__PURE__ */ jsx92(
|
|
15577
15748
|
"input",
|
|
15578
15749
|
{
|
|
15579
15750
|
type: "text",
|
|
@@ -15591,15 +15762,15 @@ function PersonalizationInputs({
|
|
|
15591
15762
|
}
|
|
15592
15763
|
|
|
15593
15764
|
// src/personalization/usePersonalizationShimmer.ts
|
|
15594
|
-
import { useState as
|
|
15765
|
+
import { useState as useState48, useEffect as useEffect49, useRef as useRef32, useCallback as useCallback28 } from "react";
|
|
15595
15766
|
function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
15596
15767
|
const personCtx = usePersonalizationContext();
|
|
15597
15768
|
const realtime = useRealtimeOptional();
|
|
15598
|
-
const [shimmerActive, setShimmerActive] =
|
|
15599
|
-
const sdkSettledRef =
|
|
15600
|
-
const manualTriggerRef =
|
|
15601
|
-
const safetyTimeoutRef =
|
|
15602
|
-
const startShimmer =
|
|
15769
|
+
const [shimmerActive, setShimmerActive] = useState48(false);
|
|
15770
|
+
const sdkSettledRef = useRef32(false);
|
|
15771
|
+
const manualTriggerRef = useRef32(false);
|
|
15772
|
+
const safetyTimeoutRef = useRef32(void 0);
|
|
15773
|
+
const startShimmer = useCallback28(() => {
|
|
15603
15774
|
setShimmerActive(true);
|
|
15604
15775
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
15605
15776
|
safetyTimeoutRef.current = setTimeout(
|
|
@@ -15611,25 +15782,25 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
15611
15782
|
safetyTimeoutMs
|
|
15612
15783
|
);
|
|
15613
15784
|
}, [safetyTimeoutMs]);
|
|
15614
|
-
|
|
15785
|
+
useEffect49(() => {
|
|
15615
15786
|
if (!personCtx?.isActive) return;
|
|
15616
15787
|
sdkSettledRef.current = false;
|
|
15617
15788
|
manualTriggerRef.current = false;
|
|
15618
15789
|
realtime?.resetPipelineSettled();
|
|
15619
15790
|
startShimmer();
|
|
15620
15791
|
}, [personCtx?.personValues, personCtx?.isActive, startShimmer]);
|
|
15621
|
-
const triggerShimmer =
|
|
15792
|
+
const triggerShimmer = useCallback28(() => {
|
|
15622
15793
|
sdkSettledRef.current = false;
|
|
15623
15794
|
manualTriggerRef.current = true;
|
|
15624
15795
|
startShimmer();
|
|
15625
15796
|
}, [startShimmer]);
|
|
15626
|
-
|
|
15797
|
+
useEffect49(() => {
|
|
15627
15798
|
if (!realtime?.subscribePipelineSettled) return;
|
|
15628
15799
|
return realtime.subscribePipelineSettled(() => {
|
|
15629
15800
|
sdkSettledRef.current = true;
|
|
15630
15801
|
});
|
|
15631
15802
|
}, [realtime]);
|
|
15632
|
-
|
|
15803
|
+
useEffect49(() => {
|
|
15633
15804
|
const container = containerRef.current;
|
|
15634
15805
|
if (!container) return;
|
|
15635
15806
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -15672,7 +15843,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
15672
15843
|
});
|
|
15673
15844
|
return () => observer.disconnect();
|
|
15674
15845
|
}, [containerRef]);
|
|
15675
|
-
|
|
15846
|
+
useEffect49(() => {
|
|
15676
15847
|
return () => {
|
|
15677
15848
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
15678
15849
|
};
|
|
@@ -15756,6 +15927,7 @@ export {
|
|
|
15756
15927
|
FiltersButton,
|
|
15757
15928
|
FiltersDrawer,
|
|
15758
15929
|
FloatingActionGroup,
|
|
15930
|
+
GallerySkipProvider,
|
|
15759
15931
|
HeroCarousel,
|
|
15760
15932
|
HeroProductImage,
|
|
15761
15933
|
HeroShrinkLayout,
|
|
@@ -15785,6 +15957,7 @@ export {
|
|
|
15785
15957
|
MobileProductCarousel,
|
|
15786
15958
|
MockupBackground,
|
|
15787
15959
|
MockupPriorityProvider,
|
|
15960
|
+
NO_GALLERY_SKIPS,
|
|
15788
15961
|
PDPLayout,
|
|
15789
15962
|
PersonalizationInputs,
|
|
15790
15963
|
PersonalizationProvider,
|
|
@@ -15885,6 +16058,9 @@ export {
|
|
|
15885
16058
|
formatCurrency,
|
|
15886
16059
|
formatDate,
|
|
15887
16060
|
formatDateTime,
|
|
16061
|
+
gallerySkipVerdict,
|
|
16062
|
+
gallerySkippedStamp,
|
|
16063
|
+
galleryWithoutSkipped,
|
|
15888
16064
|
getBrand,
|
|
15889
16065
|
getMockupUrl,
|
|
15890
16066
|
getObservedElementCount,
|
|
@@ -15918,6 +16094,8 @@ export {
|
|
|
15918
16094
|
useDesignOptional,
|
|
15919
16095
|
useDeviceDetection,
|
|
15920
16096
|
useFocusTrap,
|
|
16097
|
+
useGallerySkipOptional,
|
|
16098
|
+
useGallerySkipState,
|
|
15921
16099
|
useHeroZoomScales,
|
|
15922
16100
|
useImagePreloader,
|
|
15923
16101
|
useImageTransition,
|