@snowcone-app/ui 0.11.17 → 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 +15 -0
- package/dist/index.cjs +937 -676
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -60
- package/dist/index.d.ts +185 -60
- package/dist/index.js +847 -597
- 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 +10 -3
- package/src/composed/carousels/firstView.ts +81 -0
- package/src/composed/renderRefusalProbe.ts +35 -0
- package/src/composed/zoom/EnhancedImageViewer.tsx +68 -1
- package/src/composed/zoom/__tests__/EnhancedImageViewer.firstView.test.tsx +126 -0
- package/src/composed/zoom/types.ts +9 -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.cjs
CHANGED
|
@@ -222,11 +222,14 @@ __export(src_exports, {
|
|
|
222
222
|
EdgeSwipeGuards: () => EdgeSwipeGuards,
|
|
223
223
|
EnhancedImageViewer: () => EnhancedImageViewer,
|
|
224
224
|
FACET_SECTIONS: () => FACET_SECTIONS,
|
|
225
|
+
FIRST_VIEW_MARGIN: () => FIRST_VIEW_MARGIN,
|
|
226
|
+
FIRST_VIEW_PICTURE_ASPECT: () => FIRST_VIEW_PICTURE_ASPECT,
|
|
225
227
|
Fieldset: () => Fieldset,
|
|
226
228
|
Filters: () => Filters,
|
|
227
229
|
FiltersButton: () => FiltersButton,
|
|
228
230
|
FiltersDrawer: () => FiltersDrawer,
|
|
229
231
|
FloatingActionGroup: () => FloatingActionGroup,
|
|
232
|
+
GallerySkipProvider: () => GallerySkipProvider,
|
|
230
233
|
HeroCarousel: () => HeroCarousel,
|
|
231
234
|
HeroProductImage: () => HeroProductImage,
|
|
232
235
|
HeroShrinkLayout: () => HeroShrinkLayout,
|
|
@@ -256,6 +259,7 @@ __export(src_exports, {
|
|
|
256
259
|
MobileProductCarousel: () => MobileProductCarousel,
|
|
257
260
|
MockupBackground: () => MockupBackground,
|
|
258
261
|
MockupPriorityProvider: () => MockupPriorityProvider,
|
|
262
|
+
NO_GALLERY_SKIPS: () => NO_GALLERY_SKIPS,
|
|
259
263
|
PDPLayout: () => PDPLayout,
|
|
260
264
|
PersonalizationInputs: () => PersonalizationInputs,
|
|
261
265
|
PersonalizationProvider: () => PersonalizationProvider,
|
|
@@ -350,23 +354,28 @@ __export(src_exports, {
|
|
|
350
354
|
checkTailwindConfig: () => checkTailwindConfig,
|
|
351
355
|
checkThemeTokens: () => checkThemeTokens,
|
|
352
356
|
createScrollDirectionTracker: () => createScrollDirectionTracker,
|
|
353
|
-
describeProductArtAlignment: () =>
|
|
357
|
+
describeProductArtAlignment: () => import_sdk16.describeProductArtAlignment,
|
|
358
|
+
firstView: () => firstView,
|
|
359
|
+
firstViewAnchorOfSlide: () => firstViewAnchorOfSlide,
|
|
354
360
|
formatCurrency: () => formatCurrency,
|
|
355
361
|
formatDate: () => formatDate,
|
|
356
362
|
formatDateTime: () => formatDateTime,
|
|
363
|
+
gallerySkipVerdict: () => gallerySkipVerdict,
|
|
364
|
+
gallerySkippedStamp: () => gallerySkippedStamp,
|
|
365
|
+
galleryWithoutSkipped: () => galleryWithoutSkipped,
|
|
357
366
|
getBrand: () => getBrand,
|
|
358
|
-
getMockupUrl: () =>
|
|
367
|
+
getMockupUrl: () => import_sdk15.getMockupUrl,
|
|
359
368
|
getObservedElementCount: () => getObservedElementCount,
|
|
360
369
|
getObserverCount: () => getObserverCount,
|
|
361
|
-
getProduct: () =>
|
|
362
|
-
getSnapPoints: () =>
|
|
370
|
+
getProduct: () => import_sdk15.getProduct,
|
|
371
|
+
getSnapPoints: () => import_sdk16.getSnapPoints,
|
|
363
372
|
hasEdgeBlur: () => hasEdgeBlur,
|
|
364
373
|
isObserved: () => isObserved,
|
|
365
374
|
isWideMonitor: () => isWideMonitor,
|
|
366
375
|
kbdVariants: () => kbdVariants,
|
|
367
376
|
linkVariants: () => linkVariants,
|
|
368
377
|
linkedPlacementsLabel: () => linkedPlacementsLabel,
|
|
369
|
-
listProducts: () =>
|
|
378
|
+
listProducts: () => import_sdk15.listProducts,
|
|
370
379
|
normalizeHex: () => normalizeHex,
|
|
371
380
|
observe: () => observe,
|
|
372
381
|
pictureRenderState: () => pictureRenderState,
|
|
@@ -374,6 +383,7 @@ __export(src_exports, {
|
|
|
374
383
|
runConfigChecks: () => runConfigChecks,
|
|
375
384
|
scrollInputAboveKeyboard: () => scrollInputAboveKeyboard,
|
|
376
385
|
searchClient: () => searchClient,
|
|
386
|
+
slideFirstViewFields: () => slideFirstViewFields,
|
|
377
387
|
slideFirstViewProps: () => slideFirstViewProps,
|
|
378
388
|
spinnerVariants: () => spinnerVariants,
|
|
379
389
|
surfaceVariants: () => surfaceVariants,
|
|
@@ -386,6 +396,8 @@ __export(src_exports, {
|
|
|
386
396
|
useDesignOptional: () => useDesignOptional,
|
|
387
397
|
useDeviceDetection: () => useDeviceDetection,
|
|
388
398
|
useFocusTrap: () => useFocusTrap,
|
|
399
|
+
useGallerySkipOptional: () => useGallerySkipOptional,
|
|
400
|
+
useGallerySkipState: () => useGallerySkipState,
|
|
389
401
|
useHeroZoomScales: () => useHeroZoomScales,
|
|
390
402
|
useImagePreloader: () => useImagePreloader,
|
|
391
403
|
useImageTransition: () => useImageTransition,
|
|
@@ -409,7 +421,7 @@ __export(src_exports, {
|
|
|
409
421
|
useProductSelection: () => useProductSelection,
|
|
410
422
|
useProviderStatus: () => useProviderStatus,
|
|
411
423
|
useRealtime: () => useRealtime,
|
|
412
|
-
useRealtimeMockup: () =>
|
|
424
|
+
useRealtimeMockup: () => import_react73.useRealtimeMockup,
|
|
413
425
|
useRealtimeOptional: () => useRealtimeOptional,
|
|
414
426
|
useRenderCount: () => useRenderCount,
|
|
415
427
|
useRenderGuard: () => useRenderGuard,
|
|
@@ -6011,7 +6023,29 @@ var import_react27 = require("react");
|
|
|
6011
6023
|
// src/patterns/RealtimeProvider.tsx
|
|
6012
6024
|
var import_react25 = require("react");
|
|
6013
6025
|
var import_react26 = require("@snowcone-app/sdk/react");
|
|
6026
|
+
var import_sdk10 = require("@snowcone-app/sdk");
|
|
6027
|
+
|
|
6028
|
+
// src/patterns/gallerySkipRules.ts
|
|
6014
6029
|
var import_sdk9 = require("@snowcone-app/sdk");
|
|
6030
|
+
function gallerySkipVerdict(code, attempt) {
|
|
6031
|
+
const kind = (0, import_sdk9.designRefusalKind)(code);
|
|
6032
|
+
if (kind === "skip") return "skip";
|
|
6033
|
+
if (kind === "retry-once") return attempt < 1 ? "retry" : "skip";
|
|
6034
|
+
return "loud";
|
|
6035
|
+
}
|
|
6036
|
+
var NO_GALLERY_SKIPS = /* @__PURE__ */ new Map();
|
|
6037
|
+
function galleryWithoutSkipped(images, skipped) {
|
|
6038
|
+
if (skipped.size === 0) return images;
|
|
6039
|
+
const kept = images.filter((img) => !(img.isRealMockup && img.mockupId && skipped.has(img.mockupId)));
|
|
6040
|
+
if (kept.length === images.length || kept.length === 0) return images;
|
|
6041
|
+
return kept;
|
|
6042
|
+
}
|
|
6043
|
+
function gallerySkippedStamp(skipped, shown) {
|
|
6044
|
+
if (skipped.size === 0) return void 0;
|
|
6045
|
+
const shownIds = new Set(shown.map((img) => img.mockupId).filter(Boolean));
|
|
6046
|
+
const parts = [...skipped].filter(([id]) => !shownIds.has(id)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([id, code]) => `${id}:${code}`);
|
|
6047
|
+
return parts.length ? parts.join(" ") : void 0;
|
|
6048
|
+
}
|
|
6015
6049
|
|
|
6016
6050
|
// src/patterns/MockupBackground.tsx
|
|
6017
6051
|
var import_react24 = require("react");
|
|
@@ -6193,6 +6227,9 @@ function RealtimeProvider({
|
|
|
6193
6227
|
);
|
|
6194
6228
|
const resetSessionRef = (0, import_react25.useRef)(() => {
|
|
6195
6229
|
});
|
|
6230
|
+
const designRefusalSubscribersRef = (0, import_react25.useRef)(/* @__PURE__ */ new Set());
|
|
6231
|
+
const designBusySeenRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
6232
|
+
const designRetryRef = (0, import_react25.useRef)(null);
|
|
6196
6233
|
const realtimeMockup = (0, import_react26.useRealtimeMockup)({
|
|
6197
6234
|
wsUrl,
|
|
6198
6235
|
getToken: useSessionGrant ? getToken : void 0,
|
|
@@ -6233,6 +6270,23 @@ function RealtimeProvider({
|
|
|
6233
6270
|
const id = detail.mockupId;
|
|
6234
6271
|
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
6235
6272
|
}
|
|
6273
|
+
},
|
|
6274
|
+
onDesignRefusal: (refusal) => {
|
|
6275
|
+
const seen = designBusySeenRef.current.get(refusal.mockupId) ?? 0;
|
|
6276
|
+
const verdict = gallerySkipVerdict(refusal.code, seen);
|
|
6277
|
+
if (verdict === "retry") {
|
|
6278
|
+
designBusySeenRef.current.set(refusal.mockupId, seen + 1);
|
|
6279
|
+
designRetryRef.current?.([refusal.mockupId]);
|
|
6280
|
+
return;
|
|
6281
|
+
}
|
|
6282
|
+
if (verdict !== "skip") return;
|
|
6283
|
+
if (designRefusalSubscribersRef.current.size === 0) {
|
|
6284
|
+
const id = refusal.mockupId;
|
|
6285
|
+
const detail = { code: refusal.code, message: refusal.message, mockupId: id };
|
|
6286
|
+
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
6287
|
+
return;
|
|
6288
|
+
}
|
|
6289
|
+
designRefusalSubscribersRef.current.forEach((cb) => cb(refusal));
|
|
6236
6290
|
}
|
|
6237
6291
|
});
|
|
6238
6292
|
const subscribeRTCTiming = (0, import_react25.useCallback)((_callback) => {
|
|
@@ -6480,6 +6534,7 @@ function RealtimeProvider({
|
|
|
6480
6534
|
},
|
|
6481
6535
|
[rerenderRaw]
|
|
6482
6536
|
);
|
|
6537
|
+
designRetryRef.current = sendRerenderPaced;
|
|
6483
6538
|
const rerenderFullFrame = (0, import_react25.useCallback)(
|
|
6484
6539
|
(mockupId) => {
|
|
6485
6540
|
fullFrameRerenderIdsRef.current.add(mockupId);
|
|
@@ -6624,6 +6679,7 @@ function RealtimeProvider({
|
|
|
6624
6679
|
else merged.push(result);
|
|
6625
6680
|
});
|
|
6626
6681
|
mockupResultsRef.current = merged;
|
|
6682
|
+
results.forEach((result) => designBusySeenRef.current.delete(result.mockupId));
|
|
6627
6683
|
if (pendingRerenderRef.current.length > 0) {
|
|
6628
6684
|
const delivered = new Set(results.map((r) => r.mockupId));
|
|
6629
6685
|
pendingRerenderRef.current = pendingRerenderRef.current.filter((id) => !delivered.has(id));
|
|
@@ -6888,6 +6944,7 @@ function RealtimeProvider({
|
|
|
6888
6944
|
const resetSession = (0, import_react25.useCallback)(() => {
|
|
6889
6945
|
configSentRef.current = false;
|
|
6890
6946
|
dueByVersionRef.current.clear();
|
|
6947
|
+
designBusySeenRef.current.clear();
|
|
6891
6948
|
setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
|
|
6892
6949
|
lastSentVariantIdRef.current = null;
|
|
6893
6950
|
lastSentBgRef.current = void 0;
|
|
@@ -6916,13 +6973,13 @@ function RealtimeProvider({
|
|
|
6916
6973
|
const product = productContext.product;
|
|
6917
6974
|
const productId = product.id;
|
|
6918
6975
|
const placements = product.placements || [];
|
|
6919
|
-
const variantId = (0,
|
|
6976
|
+
const variantId = (0, import_sdk10.resolvePreviewVariantId)(
|
|
6920
6977
|
productContext,
|
|
6921
|
-
(0,
|
|
6978
|
+
(0, import_sdk10.resolveVariantId)(productContext, void 0, void 0)
|
|
6922
6979
|
);
|
|
6923
6980
|
const isFirstSend = !configSentRef.current;
|
|
6924
6981
|
const variantChanged = lastSentVariantIdRef.current !== null && lastSentVariantIdRef.current !== variantId;
|
|
6925
|
-
const sizePicture = (0,
|
|
6982
|
+
const sizePicture = (0, import_sdk10.gallerySizePicture)(product.mockups, (0, import_sdk10.resolveVariantId)(productContext, void 0, void 0));
|
|
6926
6983
|
const sizePictureId = sizePicture?.id ?? null;
|
|
6927
6984
|
const sizePictureChanged = configSentRef.current && lastSentSizePictureRef.current !== sizePictureId;
|
|
6928
6985
|
const bgChanged = configSentRef.current && lastSentBgRef.current !== mockupBg;
|
|
@@ -6937,7 +6994,7 @@ function RealtimeProvider({
|
|
|
6937
6994
|
const mockupIds = [];
|
|
6938
6995
|
if (product.mockups && Array.isArray(product.mockups)) {
|
|
6939
6996
|
product.mockups.forEach((mockup) => {
|
|
6940
|
-
if (mockup.id && (0,
|
|
6997
|
+
if (mockup.id && (0, import_sdk10.mockupRole)(mockup) === "ordinary") {
|
|
6941
6998
|
mockupIds.push(mockup.id);
|
|
6942
6999
|
}
|
|
6943
7000
|
});
|
|
@@ -7195,7 +7252,7 @@ function RealtimeProvider({
|
|
|
7195
7252
|
const pendingIds = [];
|
|
7196
7253
|
if (productContext?.product?.mockups) {
|
|
7197
7254
|
productContext.product.mockups.forEach((mockup) => {
|
|
7198
|
-
if ((0,
|
|
7255
|
+
if ((0, import_sdk10.mockupRole)(mockup) !== "ordinary" && !configuredMockupIdsRef.current.includes(mockup.id)) return;
|
|
7199
7256
|
if (mockup.placement === placement || !mockup.placement) {
|
|
7200
7257
|
pendingMockupIdsRef.current.add(mockup.id);
|
|
7201
7258
|
pendingIds.push(mockup.id);
|
|
@@ -7273,6 +7330,13 @@ function RealtimeProvider({
|
|
|
7273
7330
|
subscribeBlobSentRef.current = subscribeBlobSent;
|
|
7274
7331
|
subscribePipelineSettledRef.current = subscribePipelineSettled;
|
|
7275
7332
|
subscribePendingExportCancelledRef.current = subscribePendingExportCancelled;
|
|
7333
|
+
const subscribeDesignRefusals = (0, import_react25.useCallback)((callback) => {
|
|
7334
|
+
const subscribers = designRefusalSubscribersRef.current;
|
|
7335
|
+
subscribers.add(callback);
|
|
7336
|
+
return () => {
|
|
7337
|
+
subscribers.delete(callback);
|
|
7338
|
+
};
|
|
7339
|
+
}, []);
|
|
7276
7340
|
const stableSubscribeMockupResults = (0, import_react25.useCallback)(
|
|
7277
7341
|
(callback) => {
|
|
7278
7342
|
return subscribeMockupResultsRef.current(callback);
|
|
@@ -7342,6 +7406,7 @@ function RealtimeProvider({
|
|
|
7342
7406
|
isConfigured,
|
|
7343
7407
|
renderError,
|
|
7344
7408
|
unavailableMockups,
|
|
7409
|
+
subscribeDesignRefusals,
|
|
7345
7410
|
// Read from ref - this is a snapshot at render time, NOT reactive
|
|
7346
7411
|
// For reactive updates, use getMockupResultsImmediate() or subscribe functions
|
|
7347
7412
|
get mockupResults() {
|
|
@@ -7398,6 +7463,7 @@ function RealtimeProvider({
|
|
|
7398
7463
|
isConfigured,
|
|
7399
7464
|
renderError,
|
|
7400
7465
|
unavailableMockups,
|
|
7466
|
+
subscribeDesignRefusals,
|
|
7401
7467
|
// mockupResults removed from deps - it's a getter that reads from ref
|
|
7402
7468
|
canvasExportSize,
|
|
7403
7469
|
mockupWidth,
|
|
@@ -10277,14 +10343,77 @@ var LoadingOverlayPrismCandyInline = (0, import_react41.memo)(
|
|
|
10277
10343
|
);
|
|
10278
10344
|
|
|
10279
10345
|
// src/index.ts
|
|
10280
|
-
var
|
|
10281
|
-
var
|
|
10346
|
+
var import_react73 = require("@snowcone-app/sdk/react");
|
|
10347
|
+
var import_sdk15 = require("@snowcone-app/sdk");
|
|
10282
10348
|
|
|
10283
|
-
// src/patterns/
|
|
10349
|
+
// src/patterns/GallerySkip.tsx
|
|
10284
10350
|
var import_react42 = require("react");
|
|
10351
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10352
|
+
var GallerySkipContext = (0, import_react42.createContext)(void 0);
|
|
10353
|
+
function useGallerySkipState(design) {
|
|
10354
|
+
const realtime = useRealtimeOptional();
|
|
10355
|
+
const [entries, setEntries] = (0, import_react42.useState)(() => /* @__PURE__ */ new Map());
|
|
10356
|
+
const entriesRef = (0, import_react42.useRef)(entries);
|
|
10357
|
+
entriesRef.current = entries;
|
|
10358
|
+
const designRef = (0, import_react42.useRef)(design);
|
|
10359
|
+
designRef.current = design;
|
|
10360
|
+
const getResults = realtime?.getMockupResultsImmediate;
|
|
10361
|
+
const frameOfRef = (0, import_react42.useRef)((mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null);
|
|
10362
|
+
frameOfRef.current = (mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null;
|
|
10363
|
+
const report = (0, import_react42.useCallback)((mockupId, code) => {
|
|
10364
|
+
const at = designRef.current;
|
|
10365
|
+
const realtimeUrl = frameOfRef.current(mockupId);
|
|
10366
|
+
setEntries((prev) => {
|
|
10367
|
+
const e = prev.get(mockupId);
|
|
10368
|
+
if (e && e.code === code && e.design === at) return prev;
|
|
10369
|
+
return new Map(prev).set(mockupId, { code, design: at, realtimeUrl });
|
|
10370
|
+
});
|
|
10371
|
+
}, []);
|
|
10372
|
+
const subscribeDesignRefusals = realtime?.subscribeDesignRefusals;
|
|
10373
|
+
(0, import_react42.useEffect)(() => {
|
|
10374
|
+
if (!subscribeDesignRefusals) return;
|
|
10375
|
+
return subscribeDesignRefusals((refusal) => report(refusal.mockupId, refusal.code));
|
|
10376
|
+
}, [subscribeDesignRefusals, report]);
|
|
10377
|
+
const subscribeMockupResults = realtime?.subscribeMockupResults;
|
|
10378
|
+
(0, import_react42.useEffect)(() => {
|
|
10379
|
+
if (!subscribeMockupResults) return;
|
|
10380
|
+
return subscribeMockupResults((results) => {
|
|
10381
|
+
const current = entriesRef.current;
|
|
10382
|
+
if (current.size === 0) return;
|
|
10383
|
+
const back = results.filter((r) => {
|
|
10384
|
+
const e = current.get(r.mockupId);
|
|
10385
|
+
if (!e) return false;
|
|
10386
|
+
return !!r.imageUrl && r.imageUrl !== e.realtimeUrl;
|
|
10387
|
+
});
|
|
10388
|
+
if (back.length === 0) return;
|
|
10389
|
+
setEntries((prev) => {
|
|
10390
|
+
const next = new Map(prev);
|
|
10391
|
+
back.forEach((r) => next.delete(r.mockupId));
|
|
10392
|
+
return next;
|
|
10393
|
+
});
|
|
10394
|
+
});
|
|
10395
|
+
}, [subscribeMockupResults]);
|
|
10396
|
+
const skipped = (0, import_react42.useMemo)(() => {
|
|
10397
|
+
const m = /* @__PURE__ */ new Map();
|
|
10398
|
+
entries.forEach((e, id) => {
|
|
10399
|
+
if (e.design === design) m.set(id, e.code);
|
|
10400
|
+
});
|
|
10401
|
+
return m;
|
|
10402
|
+
}, [entries, design]);
|
|
10403
|
+
return (0, import_react42.useMemo)(() => ({ skipped, report }), [skipped, report]);
|
|
10404
|
+
}
|
|
10405
|
+
function GallerySkipProvider({ value, children }) {
|
|
10406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(GallerySkipContext.Provider, { value, children });
|
|
10407
|
+
}
|
|
10408
|
+
function useGallerySkipOptional() {
|
|
10409
|
+
return (0, import_react42.useContext)(GallerySkipContext);
|
|
10410
|
+
}
|
|
10411
|
+
|
|
10412
|
+
// src/patterns/PlacementArt.tsx
|
|
10413
|
+
var import_react43 = require("react");
|
|
10285
10414
|
|
|
10286
10415
|
// src/composed/heroMockupUrl.ts
|
|
10287
|
-
var
|
|
10416
|
+
var import_sdk11 = require("@snowcone-app/sdk");
|
|
10288
10417
|
function slugifyPlacementKey(label) {
|
|
10289
10418
|
return label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
10290
10419
|
}
|
|
@@ -10311,7 +10440,7 @@ function heroMockupUrl(args) {
|
|
|
10311
10440
|
if (!args.shop) return null;
|
|
10312
10441
|
const publicDesign = toPublicDesign(args.design, args.placements);
|
|
10313
10442
|
if (Object.keys(publicDesign).length === 0) return null;
|
|
10314
|
-
return (0,
|
|
10443
|
+
return (0, import_sdk11.getMockupUrl)(args.productCode, {
|
|
10315
10444
|
shop: args.shop,
|
|
10316
10445
|
design: publicDesign,
|
|
10317
10446
|
..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView, ...args.size.width !== void 0 ? { width: args.size.width } : {} } : { width: args.size.width },
|
|
@@ -10323,15 +10452,15 @@ function heroMockupUrl(args) {
|
|
|
10323
10452
|
}
|
|
10324
10453
|
|
|
10325
10454
|
// src/patterns/PlacementArt.tsx
|
|
10326
|
-
var
|
|
10327
|
-
var PlacementArtContext = (0,
|
|
10455
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10456
|
+
var PlacementArtContext = (0, import_react43.createContext)(null);
|
|
10328
10457
|
function PlacementArt({ art, children }) {
|
|
10329
10458
|
const key = art ? JSON.stringify(art) : "";
|
|
10330
|
-
const value = (0,
|
|
10331
|
-
return /* @__PURE__ */ (0,
|
|
10459
|
+
const value = (0, import_react43.useMemo)(() => key ? JSON.parse(key) : null, [key]);
|
|
10460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PlacementArtContext.Provider, { value, children });
|
|
10332
10461
|
}
|
|
10333
10462
|
function usePlacementArtOptional() {
|
|
10334
|
-
return (0,
|
|
10463
|
+
return (0, import_react43.useContext)(PlacementArtContext);
|
|
10335
10464
|
}
|
|
10336
10465
|
function placementArtFor(art, placement, fallback) {
|
|
10337
10466
|
if (!art) return fallback;
|
|
@@ -10339,7 +10468,7 @@ function placementArtFor(art, placement, fallback) {
|
|
|
10339
10468
|
}
|
|
10340
10469
|
|
|
10341
10470
|
// src/patterns/ProductPageProvider.tsx
|
|
10342
|
-
var
|
|
10471
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10343
10472
|
function ProductPageProvider({
|
|
10344
10473
|
children,
|
|
10345
10474
|
productId,
|
|
@@ -10353,12 +10482,12 @@ function ProductPageProvider({
|
|
|
10353
10482
|
realtimeGrantUrl,
|
|
10354
10483
|
enablePriority = true
|
|
10355
10484
|
}) {
|
|
10356
|
-
let content = /* @__PURE__ */ (0,
|
|
10485
|
+
let content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Product, { productId, productData, children });
|
|
10357
10486
|
if (enablePriority) {
|
|
10358
|
-
content = /* @__PURE__ */ (0,
|
|
10487
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(MockupPriorityProvider, { children: content });
|
|
10359
10488
|
}
|
|
10360
10489
|
if (enableRealtime) {
|
|
10361
|
-
content = /* @__PURE__ */ (0,
|
|
10490
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10362
10491
|
RealtimeProvider,
|
|
10363
10492
|
{
|
|
10364
10493
|
wsUrl: realtimeWsUrl,
|
|
@@ -10368,7 +10497,7 @@ function ProductPageProvider({
|
|
|
10368
10497
|
}
|
|
10369
10498
|
);
|
|
10370
10499
|
}
|
|
10371
|
-
return /* @__PURE__ */ (0,
|
|
10500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10372
10501
|
Shop,
|
|
10373
10502
|
{
|
|
10374
10503
|
endpoint,
|
|
@@ -10388,23 +10517,23 @@ function ProductPageProviderMinimal({
|
|
|
10388
10517
|
shop,
|
|
10389
10518
|
initialArtwork
|
|
10390
10519
|
}) {
|
|
10391
|
-
return /* @__PURE__ */ (0,
|
|
10520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10392
10521
|
Shop,
|
|
10393
10522
|
{
|
|
10394
10523
|
endpoint,
|
|
10395
10524
|
mockupUrl,
|
|
10396
10525
|
shop,
|
|
10397
10526
|
initialArtwork,
|
|
10398
|
-
children: /* @__PURE__ */ (0,
|
|
10527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Product, { productId, productData, children })
|
|
10399
10528
|
}
|
|
10400
10529
|
);
|
|
10401
10530
|
}
|
|
10402
10531
|
|
|
10403
10532
|
// src/composed/ArtAlignment.tsx
|
|
10404
|
-
var
|
|
10405
|
-
var
|
|
10406
|
-
var
|
|
10407
|
-
var
|
|
10533
|
+
var import_react44 = require("react");
|
|
10534
|
+
var import_react45 = require("@use-gesture/react");
|
|
10535
|
+
var import_sdk12 = require("@snowcone-app/sdk");
|
|
10536
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10408
10537
|
function ArtAlignment({
|
|
10409
10538
|
src: propSrc,
|
|
10410
10539
|
artworkAspectRatio: propAspectRatio,
|
|
@@ -10438,17 +10567,17 @@ function ArtAlignment({
|
|
|
10438
10567
|
selection: {}
|
|
10439
10568
|
};
|
|
10440
10569
|
}
|
|
10441
|
-
const containerRef = (0,
|
|
10442
|
-
const imageRef = (0,
|
|
10443
|
-
const lastUserDragTimeRef = (0,
|
|
10444
|
-
const [containerSize, setContainerSize] = (0,
|
|
10445
|
-
const [position, setPosition] = (0,
|
|
10446
|
-
const [isReady, setIsReady] = (0,
|
|
10447
|
-
const [detectedAspectRatio, setDetectedAspectRatio] = (0,
|
|
10570
|
+
const containerRef = (0, import_react44.useRef)(null);
|
|
10571
|
+
const imageRef = (0, import_react44.useRef)(null);
|
|
10572
|
+
const lastUserDragTimeRef = (0, import_react44.useRef)(0);
|
|
10573
|
+
const [containerSize, setContainerSize] = (0, import_react44.useState)({ width: 0, height: 0 });
|
|
10574
|
+
const [position, setPosition] = (0, import_react44.useState)({ x: 0, y: 0 });
|
|
10575
|
+
const [isReady, setIsReady] = (0, import_react44.useState)(false);
|
|
10576
|
+
const [detectedAspectRatio, setDetectedAspectRatio] = (0, import_react44.useState)();
|
|
10448
10577
|
const effectiveAspectRatio = artworkAspectRatio || detectedAspectRatio;
|
|
10449
10578
|
const alignment = placementDesign?.alignment || propAlignment || "center";
|
|
10450
|
-
const descriptor = (0,
|
|
10451
|
-
() => (0,
|
|
10579
|
+
const descriptor = (0, import_react44.useMemo)(
|
|
10580
|
+
() => (0, import_sdk12.describeProductArtAlignment)(
|
|
10452
10581
|
{
|
|
10453
10582
|
src,
|
|
10454
10583
|
artworkAspectRatio: effectiveAspectRatio,
|
|
@@ -10469,7 +10598,7 @@ function ArtAlignment({
|
|
|
10469
10598
|
productContext
|
|
10470
10599
|
]
|
|
10471
10600
|
);
|
|
10472
|
-
const containerStyle = (0,
|
|
10601
|
+
const containerStyle = (0, import_react44.useMemo)(() => {
|
|
10473
10602
|
const style = {};
|
|
10474
10603
|
if (height !== void 0) {
|
|
10475
10604
|
const heightValue = typeof height === "number" ? height : parseFloat(height);
|
|
@@ -10500,7 +10629,7 @@ function ArtAlignment({
|
|
|
10500
10629
|
}
|
|
10501
10630
|
return style;
|
|
10502
10631
|
}, [effectiveAspectRatio, height, maxHeight, minHeight]);
|
|
10503
|
-
(0,
|
|
10632
|
+
(0, import_react44.useEffect)(() => {
|
|
10504
10633
|
if (!containerRef.current) return;
|
|
10505
10634
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
10506
10635
|
const entry = entries[0];
|
|
@@ -10526,7 +10655,7 @@ function ArtAlignment({
|
|
|
10526
10655
|
}
|
|
10527
10656
|
}
|
|
10528
10657
|
};
|
|
10529
|
-
(0,
|
|
10658
|
+
(0, import_react44.useEffect)(() => {
|
|
10530
10659
|
if (!imageRef.current || !descriptor) return;
|
|
10531
10660
|
if (imageRef.current.complete) {
|
|
10532
10661
|
setIsReady(true);
|
|
@@ -10551,7 +10680,7 @@ function ArtAlignment({
|
|
|
10551
10680
|
img.removeEventListener("load", handleLoad);
|
|
10552
10681
|
};
|
|
10553
10682
|
}, [descriptor?.src, artworkAspectRatio]);
|
|
10554
|
-
const maskDimensions = (0,
|
|
10683
|
+
const maskDimensions = (0, import_react44.useMemo)(() => {
|
|
10555
10684
|
if (!isReady || containerSize.width === 0 || !descriptor) {
|
|
10556
10685
|
return { width: 0, height: 0 };
|
|
10557
10686
|
}
|
|
@@ -10566,17 +10695,17 @@ function ArtAlignment({
|
|
|
10566
10695
|
descriptor?.effectiveAlignment,
|
|
10567
10696
|
isReady
|
|
10568
10697
|
]);
|
|
10569
|
-
const clipPathCoords = (0,
|
|
10698
|
+
const clipPathCoords = (0, import_react44.useMemo)(() => {
|
|
10570
10699
|
const halfMaskW = maskDimensions.width / 2;
|
|
10571
10700
|
const halfMaskH = maskDimensions.height / 2;
|
|
10572
10701
|
const halfContainerW = containerSize.width / 2;
|
|
10573
10702
|
const halfContainerH = containerSize.height / 2;
|
|
10574
10703
|
return { halfMaskW, halfMaskH, halfContainerW, halfContainerH };
|
|
10575
10704
|
}, [maskDimensions.width, maskDimensions.height, containerSize.width, containerSize.height]);
|
|
10576
|
-
(0,
|
|
10705
|
+
(0, import_react44.useEffect)(() => {
|
|
10577
10706
|
if (Date.now() - lastUserDragTimeRef.current < 500) return;
|
|
10578
10707
|
if (!isReady || maskDimensions.width === 0 || !descriptor) return;
|
|
10579
|
-
const points = (0,
|
|
10708
|
+
const points = (0, import_sdk12.getSnapPoints)(
|
|
10580
10709
|
containerSize,
|
|
10581
10710
|
maskDimensions,
|
|
10582
10711
|
descriptor.effectiveAlignment
|
|
@@ -10595,7 +10724,7 @@ function ArtAlignment({
|
|
|
10595
10724
|
maskDimensions.height,
|
|
10596
10725
|
isReady
|
|
10597
10726
|
]);
|
|
10598
|
-
const overlayStyle = (0,
|
|
10727
|
+
const overlayStyle = (0, import_react44.useMemo)(() => {
|
|
10599
10728
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10600
10729
|
const cx = position.x + halfContainerW;
|
|
10601
10730
|
const cy = position.y + halfContainerH;
|
|
@@ -10616,7 +10745,7 @@ function ArtAlignment({
|
|
|
10616
10745
|
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"
|
|
10617
10746
|
};
|
|
10618
10747
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10619
|
-
const maskStyle = (0,
|
|
10748
|
+
const maskStyle = (0, import_react44.useMemo)(() => ({
|
|
10620
10749
|
width: `${maskDimensions.width}px`,
|
|
10621
10750
|
height: `${maskDimensions.height}px`,
|
|
10622
10751
|
boxShadow: `0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary)`,
|
|
@@ -10631,7 +10760,7 @@ function ArtAlignment({
|
|
|
10631
10760
|
// GPU acceleration for smoother drag
|
|
10632
10761
|
borderRadius: "var(--radius-image, 4px)"
|
|
10633
10762
|
}), [maskDimensions.width, maskDimensions.height]);
|
|
10634
|
-
const clearImageClipPath = (0,
|
|
10763
|
+
const clearImageClipPath = (0, import_react44.useMemo)(() => {
|
|
10635
10764
|
if (!isReady) return "none";
|
|
10636
10765
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10637
10766
|
const cx = position.x + halfContainerW;
|
|
@@ -10642,14 +10771,14 @@ function ArtAlignment({
|
|
|
10642
10771
|
const top = cy - halfMaskH;
|
|
10643
10772
|
return `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
|
|
10644
10773
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10645
|
-
const maskTransform = (0,
|
|
10774
|
+
const maskTransform = (0, import_react44.useMemo)(() => {
|
|
10646
10775
|
return descriptor?.effectiveAlignment === "horizontal" ? `translate(calc(-50% + ${position.x}px), -50%)` : `translate(-50%, calc(-50% + ${position.y}px))`;
|
|
10647
10776
|
}, [descriptor?.effectiveAlignment, position.x, position.y]);
|
|
10648
|
-
const lastContextUpdateTimeRef = (0,
|
|
10649
|
-
const pendingAlignmentRef = (0,
|
|
10650
|
-
const throttleTimeoutRef = (0,
|
|
10777
|
+
const lastContextUpdateTimeRef = (0, import_react44.useRef)(0);
|
|
10778
|
+
const pendingAlignmentRef = (0, import_react44.useRef)(null);
|
|
10779
|
+
const throttleTimeoutRef = (0, import_react44.useRef)(null);
|
|
10651
10780
|
const THROTTLE_MS = 150;
|
|
10652
|
-
const bind = (0,
|
|
10781
|
+
const bind = (0, import_react45.useDrag)(
|
|
10653
10782
|
({ offset: [ox, oy], last }) => {
|
|
10654
10783
|
if (maskDimensions.width === 0 || maskDimensions.height === 0 || !descriptor) {
|
|
10655
10784
|
return;
|
|
@@ -10661,7 +10790,7 @@ function ArtAlignment({
|
|
|
10661
10790
|
-maxDistance
|
|
10662
10791
|
);
|
|
10663
10792
|
const positions = Object.entries(
|
|
10664
|
-
(0,
|
|
10793
|
+
(0, import_sdk12.getSnapPoints)(
|
|
10665
10794
|
containerSize,
|
|
10666
10795
|
maskDimensions,
|
|
10667
10796
|
descriptor.effectiveAlignment
|
|
@@ -10674,7 +10803,7 @@ function ArtAlignment({
|
|
|
10674
10803
|
},
|
|
10675
10804
|
["center", Infinity]
|
|
10676
10805
|
);
|
|
10677
|
-
const snapPoints = (0,
|
|
10806
|
+
const snapPoints = (0, import_sdk12.getSnapPoints)(
|
|
10678
10807
|
containerSize,
|
|
10679
10808
|
maskDimensions,
|
|
10680
10809
|
descriptor.effectiveAlignment
|
|
@@ -10742,7 +10871,7 @@ function ArtAlignment({
|
|
|
10742
10871
|
if (!descriptor) {
|
|
10743
10872
|
return null;
|
|
10744
10873
|
}
|
|
10745
|
-
return /* @__PURE__ */ (0,
|
|
10874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10746
10875
|
"div",
|
|
10747
10876
|
{
|
|
10748
10877
|
className: `relative ${className || ""}`,
|
|
@@ -10751,8 +10880,8 @@ function ArtAlignment({
|
|
|
10751
10880
|
width: "fit-content",
|
|
10752
10881
|
maxWidth: "100%"
|
|
10753
10882
|
},
|
|
10754
|
-
children: /* @__PURE__ */ (0,
|
|
10755
|
-
/* @__PURE__ */ (0,
|
|
10883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "overflow-hidden p-1", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { ref: containerRef, className: "relative", style: containerStyle, children: [
|
|
10884
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10756
10885
|
"img",
|
|
10757
10886
|
{
|
|
10758
10887
|
ref: imageRef,
|
|
@@ -10777,9 +10906,9 @@ function ArtAlignment({
|
|
|
10777
10906
|
loading: "eager"
|
|
10778
10907
|
}
|
|
10779
10908
|
),
|
|
10780
|
-
isReady && maskDimensions.width > 0 && /* @__PURE__ */ (0,
|
|
10781
|
-
/* @__PURE__ */ (0,
|
|
10782
|
-
/* @__PURE__ */ (0,
|
|
10909
|
+
isReady && maskDimensions.width > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
10910
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { style: overlayStyle }),
|
|
10911
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10783
10912
|
"img",
|
|
10784
10913
|
{
|
|
10785
10914
|
src: descriptor.src,
|
|
@@ -10807,7 +10936,7 @@ function ArtAlignment({
|
|
|
10807
10936
|
loading: "eager"
|
|
10808
10937
|
}
|
|
10809
10938
|
),
|
|
10810
|
-
/* @__PURE__ */ (0,
|
|
10939
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10811
10940
|
"div",
|
|
10812
10941
|
{
|
|
10813
10942
|
...bind(),
|
|
@@ -10824,8 +10953,8 @@ function ArtAlignment({
|
|
|
10824
10953
|
}
|
|
10825
10954
|
|
|
10826
10955
|
// src/composed/ArtworkCustomizer.tsx
|
|
10827
|
-
var
|
|
10828
|
-
var
|
|
10956
|
+
var import_react46 = require("react");
|
|
10957
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10829
10958
|
function ArtworkCustomizer(props) {
|
|
10830
10959
|
const designContext = useDesign();
|
|
10831
10960
|
const artwork = props.artwork || designContext.selectedArtwork;
|
|
@@ -10837,7 +10966,7 @@ function ArtworkCustomizer(props) {
|
|
|
10837
10966
|
const placements = productCtx?.product?.placements || [];
|
|
10838
10967
|
const selectedPlacement = productCtx?.selectedPlacement;
|
|
10839
10968
|
const setSelectedPlacement = productCtx?.setSelectedPlacement;
|
|
10840
|
-
(0,
|
|
10969
|
+
(0, import_react46.useEffect)(() => {
|
|
10841
10970
|
if (placements.length > 0 && !selectedPlacement && setSelectedPlacement) {
|
|
10842
10971
|
setSelectedPlacement(placements[0].label);
|
|
10843
10972
|
}
|
|
@@ -10847,13 +10976,13 @@ function ArtworkCustomizer(props) {
|
|
|
10847
10976
|
);
|
|
10848
10977
|
const isColorPlacement = currentPlacement?.type === "color";
|
|
10849
10978
|
const isFitMode = currentPlacement?.defaultScaleMode === "fit";
|
|
10850
|
-
(0,
|
|
10979
|
+
(0, import_react46.useEffect)(() => {
|
|
10851
10980
|
}, [selectedPlacement]);
|
|
10852
10981
|
if (!artwork) {
|
|
10853
|
-
return /* @__PURE__ */ (0,
|
|
10982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: `text-sm text-muted-foreground ${props.className || ""}`, children: "Select artwork to customize" });
|
|
10854
10983
|
}
|
|
10855
10984
|
if (artwork.type === "pattern") {
|
|
10856
|
-
return /* @__PURE__ */ (0,
|
|
10985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10857
10986
|
TileCount,
|
|
10858
10987
|
{
|
|
10859
10988
|
artwork,
|
|
@@ -10864,8 +10993,8 @@ function ArtworkCustomizer(props) {
|
|
|
10864
10993
|
);
|
|
10865
10994
|
}
|
|
10866
10995
|
const isCanvasEditorMode = props.mode === "canvas" || !!props.children && props.mode !== "alignment";
|
|
10867
|
-
return /* @__PURE__ */ (0,
|
|
10868
|
-
placements.length > 1 && /* @__PURE__ */ (0,
|
|
10996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
10997
|
+
placements.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "text-sm leading-relaxed", children: placements.map((p) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10869
10998
|
"button",
|
|
10870
10999
|
{
|
|
10871
11000
|
onClick: () => setSelectedPlacement?.(p.label),
|
|
@@ -10874,7 +11003,7 @@ function ArtworkCustomizer(props) {
|
|
|
10874
11003
|
},
|
|
10875
11004
|
p.label
|
|
10876
11005
|
)) }),
|
|
10877
|
-
isColorPlacement ? /* @__PURE__ */ (0,
|
|
11006
|
+
isColorPlacement ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ColorPicker2, { placement: selectedPlacement }) : isFitMode ? null : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "relative", children: props.children || /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10878
11007
|
ArtAlignment,
|
|
10879
11008
|
{
|
|
10880
11009
|
artwork: { src: artwork.src },
|
|
@@ -10890,7 +11019,7 @@ function ArtworkCustomizer(props) {
|
|
|
10890
11019
|
|
|
10891
11020
|
// src/composed/CanvasEditor.tsx
|
|
10892
11021
|
var import_lucide_react2 = require("lucide-react");
|
|
10893
|
-
var
|
|
11022
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10894
11023
|
var ImageIcon = import_lucide_react2.Image;
|
|
10895
11024
|
var TypeIcon = import_lucide_react2.Type;
|
|
10896
11025
|
var ShapesIcon = import_lucide_react2.Shapes;
|
|
@@ -10901,43 +11030,65 @@ function CanvasEditor({
|
|
|
10901
11030
|
onOpenTypography,
|
|
10902
11031
|
children
|
|
10903
11032
|
}) {
|
|
10904
|
-
return /* @__PURE__ */ (0,
|
|
10905
|
-
/* @__PURE__ */ (0,
|
|
10906
|
-
/* @__PURE__ */ (0,
|
|
10907
|
-
/* @__PURE__ */ (0,
|
|
11033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
11034
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "bg-background border-2 border-border rounded-lg aspect-square overflow-hidden relative", children: children || /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "text-muted-foreground text-sm", children: "No editor provided" }) }) }),
|
|
11035
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center justify-center gap-8 py-2", children: [
|
|
11036
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10908
11037
|
"button",
|
|
10909
11038
|
{
|
|
10910
11039
|
onClick: onOpenImageGallery,
|
|
10911
11040
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10912
11041
|
"aria-label": "Open image gallery",
|
|
10913
|
-
children: /* @__PURE__ */ (0,
|
|
11042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ImageIcon, { className: "w-6 h-6" }) })
|
|
10914
11043
|
}
|
|
10915
11044
|
),
|
|
10916
|
-
/* @__PURE__ */ (0,
|
|
11045
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10917
11046
|
"button",
|
|
10918
11047
|
{
|
|
10919
11048
|
onClick: onOpenTypography,
|
|
10920
11049
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10921
11050
|
"aria-label": "Add text",
|
|
10922
|
-
children: /* @__PURE__ */ (0,
|
|
11051
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TypeIcon, { className: "w-6 h-6" }) })
|
|
10923
11052
|
}
|
|
10924
11053
|
),
|
|
10925
|
-
/* @__PURE__ */ (0,
|
|
10926
|
-
/* @__PURE__ */ (0,
|
|
11054
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ShapesIcon, { className: "w-6 h-6" }) }) }),
|
|
11055
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(UploadIcon, { className: "w-6 h-6" }) }) })
|
|
10927
11056
|
] })
|
|
10928
11057
|
] });
|
|
10929
11058
|
}
|
|
10930
11059
|
|
|
10931
11060
|
// src/composed/HeroProductImage.tsx
|
|
10932
|
-
var
|
|
10933
|
-
|
|
11061
|
+
var import_react48 = require("react");
|
|
11062
|
+
|
|
11063
|
+
// src/composed/renderRefusalProbe.ts
|
|
11064
|
+
var import_sdk13 = require("@snowcone-app/sdk");
|
|
11065
|
+
async function probeRenderAnswer(url, fetchImpl = fetch) {
|
|
11066
|
+
let res;
|
|
11067
|
+
try {
|
|
11068
|
+
res = await fetchImpl(url, { mode: "cors", cache: "reload", credentials: "omit" });
|
|
11069
|
+
} catch {
|
|
11070
|
+
return { ok: false, status: 0, code: null };
|
|
11071
|
+
}
|
|
11072
|
+
if (res.ok) return { ok: true, status: res.status, code: null };
|
|
11073
|
+
let body = null;
|
|
11074
|
+
try {
|
|
11075
|
+
const text = await res.text();
|
|
11076
|
+
body = text ? JSON.parse(text) : null;
|
|
11077
|
+
} catch {
|
|
11078
|
+
body = null;
|
|
11079
|
+
}
|
|
11080
|
+
return { ok: false, status: res.status, code: (0, import_sdk13.renderRefusalCodeOf)(body, res.headers.get("x-render-reason")) };
|
|
11081
|
+
}
|
|
11082
|
+
|
|
11083
|
+
// src/composed/HeroProductImage.tsx
|
|
11084
|
+
var import_sdk14 = require("@snowcone-app/sdk");
|
|
10934
11085
|
|
|
10935
11086
|
// src/hooks/viewport/useContainerWidth.ts
|
|
10936
|
-
var
|
|
11087
|
+
var import_react47 = require("react");
|
|
10937
11088
|
function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
10938
|
-
const [width, setWidth] = (0,
|
|
10939
|
-
const resizeTimeoutRef = (0,
|
|
10940
|
-
(0,
|
|
11089
|
+
const [width, setWidth] = (0, import_react47.useState)(0);
|
|
11090
|
+
const resizeTimeoutRef = (0, import_react47.useRef)(null);
|
|
11091
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
10941
11092
|
const el = containerRef.current;
|
|
10942
11093
|
if (!el) return;
|
|
10943
11094
|
const cssWidth = el.offsetWidth;
|
|
@@ -10945,7 +11096,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10945
11096
|
const dpr = window.devicePixelRatio ?? 1;
|
|
10946
11097
|
setWidth(Math.min(Math.round(cssWidth * dpr), maxWidth));
|
|
10947
11098
|
}, [containerRef, maxWidth]);
|
|
10948
|
-
(0,
|
|
11099
|
+
(0, import_react47.useEffect)(() => {
|
|
10949
11100
|
const measure = () => {
|
|
10950
11101
|
const el = containerRef.current;
|
|
10951
11102
|
if (!el) return;
|
|
@@ -10968,7 +11119,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10968
11119
|
}
|
|
10969
11120
|
|
|
10970
11121
|
// src/composed/HeroProductImage.tsx
|
|
10971
|
-
var
|
|
11122
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10972
11123
|
function buildHeroMockupUrl(args) {
|
|
10973
11124
|
const snow = typeof window !== "undefined" && window.snowcone || {};
|
|
10974
11125
|
return heroMockupUrl({ ...args, shop: snow.shop, resolver: snow.resolver });
|
|
@@ -10984,6 +11135,7 @@ function heroSize(stripView, cropWidth, width) {
|
|
|
10984
11135
|
return { width };
|
|
10985
11136
|
}
|
|
10986
11137
|
var EMPTY_IMAGES = [];
|
|
11138
|
+
var DESIGN_BUSY_RETRY_MS = 1500;
|
|
10987
11139
|
function blockingSessionError(error) {
|
|
10988
11140
|
return error && !error.retryable ? error.code : null;
|
|
10989
11141
|
}
|
|
@@ -10991,7 +11143,7 @@ function pictureRenderState(s) {
|
|
|
10991
11143
|
if (s.refusal || s.behind && s.sessionError) return "refused";
|
|
10992
11144
|
return s.behind ? "stale" : "current";
|
|
10993
11145
|
}
|
|
10994
|
-
var HeroProductImage = (0,
|
|
11146
|
+
var HeroProductImage = (0, import_react48.memo)(function HeroProductImage2({
|
|
10995
11147
|
productId,
|
|
10996
11148
|
mockupId,
|
|
10997
11149
|
variantId,
|
|
@@ -11037,28 +11189,31 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11037
11189
|
const mockupBg = useMockupBackgroundOptional();
|
|
11038
11190
|
const placementArt = usePlacementArtOptional();
|
|
11039
11191
|
const placementArtKey = placementArt ? JSON.stringify(placementArt) : "";
|
|
11040
|
-
const
|
|
11192
|
+
const gallerySkip = useGallerySkipOptional();
|
|
11193
|
+
const gallerySkipRef = (0, import_react48.useRef)(gallerySkip);
|
|
11194
|
+
gallerySkipRef.current = gallerySkip;
|
|
11195
|
+
const priorityContextRef = (0, import_react48.useRef)(priorityContext);
|
|
11041
11196
|
priorityContextRef.current = priorityContext;
|
|
11042
|
-
const contextRef = (0,
|
|
11197
|
+
const contextRef = (0, import_react48.useRef)(context);
|
|
11043
11198
|
contextRef.current = context;
|
|
11044
11199
|
const actualProductId = product?.id || productId || context?.product?.id;
|
|
11045
|
-
const selectedGvid = (0,
|
|
11046
|
-
return (0,
|
|
11200
|
+
const selectedGvid = (0, import_react48.useMemo)(() => {
|
|
11201
|
+
return (0, import_sdk14.resolveVariantId)(context, gvid, variantId);
|
|
11047
11202
|
}, [gvid, variantId, context?.selection, context?.combinations]);
|
|
11048
|
-
const actualMockupId = (0,
|
|
11049
|
-
return (0,
|
|
11203
|
+
const actualMockupId = (0, import_react48.useMemo)(() => {
|
|
11204
|
+
return (0, import_sdk14.resolveMockupId)(context, selectedGvid, mockupId);
|
|
11050
11205
|
}, [mockupId, selectedGvid, context]);
|
|
11051
|
-
const actualGvid = (0,
|
|
11052
|
-
return gvid || variantId ? selectedGvid : (0,
|
|
11206
|
+
const actualGvid = (0, import_react48.useMemo)(() => {
|
|
11207
|
+
return gvid || variantId ? selectedGvid : (0, import_sdk14.resolvePreviewVariantId)(context, selectedGvid, actualMockupId);
|
|
11053
11208
|
}, [gvid, variantId, selectedGvid, actualMockupId, context]);
|
|
11054
11209
|
const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
|
|
11055
11210
|
const artworkSrc = artwork?.src;
|
|
11056
11211
|
const selectedArtworkSrc = designContext?.selectedArtwork?.src;
|
|
11057
11212
|
const effectiveArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
11058
|
-
const containerRef = (0,
|
|
11213
|
+
const containerRef = (0, import_react48.useRef)(null);
|
|
11059
11214
|
const measuredWidth = useContainerWidth(containerRef);
|
|
11060
11215
|
const width = widthProp ?? measuredWidth;
|
|
11061
|
-
const initialStaticUrl = (0,
|
|
11216
|
+
const initialStaticUrl = (0, import_react48.useMemo)(() => {
|
|
11062
11217
|
if (realtimeUrl) return null;
|
|
11063
11218
|
if (mode === "realtime") return null;
|
|
11064
11219
|
if (typeof window !== "undefined" && window.snowcone?.signMockupUrl) {
|
|
@@ -11080,7 +11235,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11080
11235
|
};
|
|
11081
11236
|
}
|
|
11082
11237
|
}
|
|
11083
|
-
const design = (0,
|
|
11238
|
+
const design = (0, import_sdk14.createDesignForPlacements)(allPlacements, images, {
|
|
11084
11239
|
artworkSrc: effectiveArtworkSrc,
|
|
11085
11240
|
placementDesigns
|
|
11086
11241
|
});
|
|
@@ -11129,31 +11284,31 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11129
11284
|
shimmerDelay,
|
|
11130
11285
|
initialUrl: realtimeUrl || initialStaticUrl
|
|
11131
11286
|
});
|
|
11132
|
-
const [error, setError] = (0,
|
|
11133
|
-
const [isInPreloadZone, setIsInPreloadZone] = (0,
|
|
11134
|
-
const componentIdRef = (0,
|
|
11287
|
+
const [error, setError] = (0, import_react48.useState)(null);
|
|
11288
|
+
const [isInPreloadZone, setIsInPreloadZone] = (0, import_react48.useState)(true);
|
|
11289
|
+
const componentIdRef = (0, import_react48.useRef)(
|
|
11135
11290
|
`hero-product-image-${Math.random().toString(36).substr(2, 9)}`
|
|
11136
11291
|
);
|
|
11137
|
-
const [containerMounted, setContainerMounted] = (0,
|
|
11138
|
-
const setContainerRef = (0,
|
|
11292
|
+
const [containerMounted, setContainerMounted] = (0, import_react48.useState)(false);
|
|
11293
|
+
const setContainerRef = (0, import_react48.useCallback)((node) => {
|
|
11139
11294
|
containerRef.current = node;
|
|
11140
11295
|
setContainerMounted(!!node);
|
|
11141
11296
|
}, []);
|
|
11142
|
-
const lastUrlRef = (0,
|
|
11143
|
-
const priorityRegisteredRef = (0,
|
|
11144
|
-
const onLoadCalledRef = (0,
|
|
11145
|
-
const prevArtworkSrcRef = (0,
|
|
11146
|
-
const realtimeArtworkSrcRef = (0,
|
|
11147
|
-
const hasReceivedRealtimeRef = (0,
|
|
11148
|
-
const isPendingExportRef = (0,
|
|
11149
|
-
const onUrlGeneratedRef = (0,
|
|
11297
|
+
const lastUrlRef = (0, import_react48.useRef)(realtimeUrl ?? initialStaticUrl ?? null);
|
|
11298
|
+
const priorityRegisteredRef = (0, import_react48.useRef)(false);
|
|
11299
|
+
const onLoadCalledRef = (0, import_react48.useRef)(false);
|
|
11300
|
+
const prevArtworkSrcRef = (0, import_react48.useRef)(void 0);
|
|
11301
|
+
const realtimeArtworkSrcRef = (0, import_react48.useRef)(void 0);
|
|
11302
|
+
const hasReceivedRealtimeRef = (0, import_react48.useRef)(false);
|
|
11303
|
+
const isPendingExportRef = (0, import_react48.useRef)(false);
|
|
11304
|
+
const onUrlGeneratedRef = (0, import_react48.useRef)(onUrlGenerated);
|
|
11150
11305
|
onUrlGeneratedRef.current = onUrlGenerated;
|
|
11151
|
-
const onShownRef = (0,
|
|
11306
|
+
const onShownRef = (0, import_react48.useRef)(onShown);
|
|
11152
11307
|
onShownRef.current = onShown;
|
|
11153
|
-
const presignedUsedRef = (0,
|
|
11154
|
-
const layersLengthRef = (0,
|
|
11308
|
+
const presignedUsedRef = (0, import_react48.useRef)(false);
|
|
11309
|
+
const layersLengthRef = (0, import_react48.useRef)(layers.length);
|
|
11155
11310
|
layersLengthRef.current = layers.length;
|
|
11156
|
-
(0,
|
|
11311
|
+
(0, import_react48.useEffect)(() => {
|
|
11157
11312
|
if (initialPriority === 1) return;
|
|
11158
11313
|
if (!containerMounted || !containerRef.current) return;
|
|
11159
11314
|
if (isInPreloadZone) return;
|
|
@@ -11172,7 +11327,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11172
11327
|
);
|
|
11173
11328
|
return unobserve;
|
|
11174
11329
|
}, [containerMounted, initialPriority, isInPreloadZone]);
|
|
11175
|
-
(0,
|
|
11330
|
+
(0, import_react48.useEffect)(() => {
|
|
11176
11331
|
if (!realtimeUrl) return;
|
|
11177
11332
|
if (realtimeUrl === lastUrlRef.current) return;
|
|
11178
11333
|
lastUrlRef.current = realtimeUrl;
|
|
@@ -11180,7 +11335,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11180
11335
|
const isInitialLoad = layersLengthRef.current === 0;
|
|
11181
11336
|
addLayerDirectly(realtimeUrl, { skipTransition: isInitialLoad });
|
|
11182
11337
|
}, [realtimeUrl, addLayerDirectly, actualMockupId, placement]);
|
|
11183
|
-
(0,
|
|
11338
|
+
(0, import_react48.useEffect)(() => {
|
|
11184
11339
|
if (mode === "static") {
|
|
11185
11340
|
return;
|
|
11186
11341
|
}
|
|
@@ -11224,7 +11379,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11224
11379
|
addLayerDirectly
|
|
11225
11380
|
// NOTE: layers.length removed - use layersLengthRef instead to prevent duplicate requests
|
|
11226
11381
|
]);
|
|
11227
|
-
(0,
|
|
11382
|
+
(0, import_react48.useEffect)(() => {
|
|
11228
11383
|
if (mode === "static") return;
|
|
11229
11384
|
if (!realtimeContext?.subscribePendingBlob || !placement) return;
|
|
11230
11385
|
const handlePendingExport = (pendingPlacement) => {
|
|
@@ -11237,38 +11392,38 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11237
11392
|
unsubscribe?.();
|
|
11238
11393
|
};
|
|
11239
11394
|
}, [mode, realtimeContext?.subscribePendingBlob, placement]);
|
|
11240
|
-
const renderVersionRef = (0,
|
|
11241
|
-
const arrivedVersionRef = (0,
|
|
11242
|
-
const versionByUrlRef = (0,
|
|
11243
|
-
const loadedUrlRef = (0,
|
|
11244
|
-
const blobConsumerRef = (0,
|
|
11395
|
+
const renderVersionRef = (0, import_react48.useRef)(0);
|
|
11396
|
+
const arrivedVersionRef = (0, import_react48.useRef)(0);
|
|
11397
|
+
const versionByUrlRef = (0, import_react48.useRef)(/* @__PURE__ */ new Map());
|
|
11398
|
+
const loadedUrlRef = (0, import_react48.useRef)(null);
|
|
11399
|
+
const blobConsumerRef = (0, import_react48.useRef)(`el-${Math.random().toString(36).slice(2, 10)}`);
|
|
11245
11400
|
const releaseBlobConsumer = realtimeContext?.releaseBlobConsumer;
|
|
11246
|
-
(0,
|
|
11401
|
+
(0, import_react48.useEffect)(() => {
|
|
11247
11402
|
const id = actualMockupId;
|
|
11248
11403
|
const consumer = blobConsumerRef.current;
|
|
11249
11404
|
return () => {
|
|
11250
11405
|
if (id) releaseBlobConsumer?.(id, consumer);
|
|
11251
11406
|
};
|
|
11252
11407
|
}, [actualMockupId, releaseBlobConsumer]);
|
|
11253
|
-
const frameErrorRef = (0,
|
|
11254
|
-
const showVersionOf = (0,
|
|
11408
|
+
const frameErrorRef = (0, import_react48.useRef)(null);
|
|
11409
|
+
const showVersionOf = (0, import_react48.useCallback)((url) => {
|
|
11255
11410
|
const e = versionByUrlRef.current.get(url);
|
|
11256
11411
|
if (!e || e.v < renderVersionRef.current) return;
|
|
11257
11412
|
renderVersionRef.current = e.v;
|
|
11258
11413
|
renderVersionsRef.current = e.versions;
|
|
11259
11414
|
frameErrorRef.current = null;
|
|
11260
11415
|
}, []);
|
|
11261
|
-
const renderVersionsRef = (0,
|
|
11416
|
+
const renderVersionsRef = (0, import_react48.useRef)(null);
|
|
11262
11417
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
11263
|
-
const refusalCodeRef = (0,
|
|
11418
|
+
const refusalCodeRef = (0, import_react48.useRef)(null);
|
|
11264
11419
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
11265
|
-
const frameFailedRef = (0,
|
|
11420
|
+
const frameFailedRef = (0, import_react48.useRef)(realtimeContext?.frameFailed);
|
|
11266
11421
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
11267
|
-
const sessionErrorCodeRef = (0,
|
|
11422
|
+
const sessionErrorCodeRef = (0, import_react48.useRef)(null);
|
|
11268
11423
|
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
11269
11424
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
11270
11425
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
11271
|
-
const applyRenderStamp = (0,
|
|
11426
|
+
const applyRenderStamp = (0, import_react48.useCallback)(() => {
|
|
11272
11427
|
const node = containerRef.current;
|
|
11273
11428
|
if (!node) return;
|
|
11274
11429
|
if (mode === "static") {
|
|
@@ -11302,12 +11457,12 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11302
11457
|
node.dataset.sessionPhase = shape.phase;
|
|
11303
11458
|
}
|
|
11304
11459
|
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
11305
|
-
const applyRenderStampRef = (0,
|
|
11460
|
+
const applyRenderStampRef = (0, import_react48.useRef)(applyRenderStamp);
|
|
11306
11461
|
applyRenderStampRef.current = applyRenderStamp;
|
|
11307
|
-
(0,
|
|
11462
|
+
(0, import_react48.useEffect)(() => {
|
|
11308
11463
|
applyRenderStamp();
|
|
11309
11464
|
});
|
|
11310
|
-
(0,
|
|
11465
|
+
(0, import_react48.useEffect)(() => {
|
|
11311
11466
|
const subscribeSent = realtimeContext?.subscribeBlobSent;
|
|
11312
11467
|
const subscribeResult = realtimeContext?.subscribeMockupResultById;
|
|
11313
11468
|
if (!actualMockupId || !subscribeSent || !subscribeResult) return;
|
|
@@ -11334,7 +11489,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11334
11489
|
applyRenderStamp
|
|
11335
11490
|
]);
|
|
11336
11491
|
const reportPictureView = realtimeContext?.reportPictureView;
|
|
11337
|
-
(0,
|
|
11492
|
+
(0, import_react48.useEffect)(() => {
|
|
11338
11493
|
if (!viewportPolicy || !reportPictureView || !actualMockupId) return;
|
|
11339
11494
|
const node = containerRef.current;
|
|
11340
11495
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
@@ -11366,7 +11521,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11366
11521
|
reportPictureView(key, null);
|
|
11367
11522
|
};
|
|
11368
11523
|
}, [viewportPolicy, reportPictureView, actualMockupId]);
|
|
11369
|
-
(0,
|
|
11524
|
+
(0, import_react48.useEffect)(() => {
|
|
11370
11525
|
if (!priorityContext || !actualMockupId || !placement) return;
|
|
11371
11526
|
priorityContext.registerMockup(actualMockupId, placement, initialPriority);
|
|
11372
11527
|
priorityRegisteredRef.current = true;
|
|
@@ -11377,7 +11532,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11377
11532
|
}
|
|
11378
11533
|
};
|
|
11379
11534
|
}, [priorityContext, actualMockupId, placement, initialPriority]);
|
|
11380
|
-
(0,
|
|
11535
|
+
(0, import_react48.useEffect)(() => {
|
|
11381
11536
|
if (!priorityContext?.updateElementRef || !actualMockupId) return;
|
|
11382
11537
|
if (containerMounted && containerRef.current) {
|
|
11383
11538
|
priorityContext.updateElementRef(actualMockupId, containerRef.current);
|
|
@@ -11391,7 +11546,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11391
11546
|
const artworkTileCount = artwork?.type === "pattern" ? artwork?.tileCount : void 0;
|
|
11392
11547
|
const selectedArtworkType = designContext?.selectedArtwork?.type;
|
|
11393
11548
|
const selectedArtworkTileCount = designContext?.selectedArtwork?.type === "pattern" ? designContext?.selectedArtwork?.tileCount : void 0;
|
|
11394
|
-
(0,
|
|
11549
|
+
(0, import_react48.useEffect)(() => {
|
|
11395
11550
|
const currentSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11396
11551
|
if (currentSrc !== prevArtworkSrcRef.current) {
|
|
11397
11552
|
lastUrlRef.current = null;
|
|
@@ -11401,11 +11556,11 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11401
11556
|
realtimeArtworkSrcRef.current = void 0;
|
|
11402
11557
|
}
|
|
11403
11558
|
}, [artworkSrc, selectedArtworkSrc, placementArtKey]);
|
|
11404
|
-
const contextSelectionRef = (0,
|
|
11405
|
-
const contextOptionAttributesRef = (0,
|
|
11559
|
+
const contextSelectionRef = (0, import_react48.useRef)(context?.selection);
|
|
11560
|
+
const contextOptionAttributesRef = (0, import_react48.useRef)(context?.optionAttributes);
|
|
11406
11561
|
contextSelectionRef.current = context?.selection;
|
|
11407
11562
|
contextOptionAttributesRef.current = context?.optionAttributes;
|
|
11408
|
-
const createDesignForPlacementsWrapper = (0,
|
|
11563
|
+
const createDesignForPlacementsWrapper = (0, import_react48.useCallback)(
|
|
11409
11564
|
(placements, providedImages) => {
|
|
11410
11565
|
const effectiveArtworkSrc2 = artworkSrc || selectedArtworkSrc;
|
|
11411
11566
|
if (!effectiveArtworkSrc2 || effectiveArtworkSrc2.trim() === "" || effectiveArtworkSrc2 === "undefined" || effectiveArtworkSrc2 === "null") {
|
|
@@ -11426,7 +11581,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11426
11581
|
const placementTiles = firstPlacement ? getPlacementDesign?.(firstPlacement.label)?.tiles : void 0;
|
|
11427
11582
|
const isCurrentArtworkPattern = artworkType === "pattern" || selectedArtworkType === "pattern";
|
|
11428
11583
|
const tiles = isCurrentArtworkPattern ? placementTiles ? placementTiles : artworkTileCount ? artworkTileCount : selectedArtworkTileCount ? selectedArtworkTileCount : void 0 : void 0;
|
|
11429
|
-
return (0,
|
|
11584
|
+
return (0, import_sdk14.createDesignForPlacements)(placements, providedImages, {
|
|
11430
11585
|
selection: contextSelectionRef.current,
|
|
11431
11586
|
attributes: contextOptionAttributesRef.current,
|
|
11432
11587
|
artworkSrc: effectiveArtworkSrc2,
|
|
@@ -11445,7 +11600,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11445
11600
|
selectedArtworkTileCount
|
|
11446
11601
|
]
|
|
11447
11602
|
);
|
|
11448
|
-
(0,
|
|
11603
|
+
(0, import_react48.useEffect)(() => {
|
|
11449
11604
|
if (mode === "realtime") return;
|
|
11450
11605
|
if (initialStaticUrl && lastUrlRef.current === initialStaticUrl) {
|
|
11451
11606
|
return;
|
|
@@ -11553,12 +11708,15 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11553
11708
|
const topLayer = layers[layers.length - 1];
|
|
11554
11709
|
const displayUrl = topLayer?.url || realtimeUrl || initialStaticUrl;
|
|
11555
11710
|
const CROSSFADE_MS = 400;
|
|
11556
|
-
const [prevUrl, setPrevUrl] = (0,
|
|
11557
|
-
const [showNew, setShowNew] = (0,
|
|
11558
|
-
const [renderedUrl, setRenderedUrl] = (0,
|
|
11559
|
-
const
|
|
11560
|
-
|
|
11561
|
-
const [
|
|
11711
|
+
const [prevUrl, setPrevUrl] = (0, import_react48.useState)(null);
|
|
11712
|
+
const [showNew, setShowNew] = (0, import_react48.useState)(false);
|
|
11713
|
+
const [renderedUrl, setRenderedUrl] = (0, import_react48.useState)(displayUrl);
|
|
11714
|
+
const renderedUrlRef = (0, import_react48.useRef)(renderedUrl);
|
|
11715
|
+
renderedUrlRef.current = renderedUrl;
|
|
11716
|
+
const [designRefused, setDesignRefused] = (0, import_react48.useState)(null);
|
|
11717
|
+
const [firstImageLoaded, setFirstImageLoaded] = (0, import_react48.useState)(false);
|
|
11718
|
+
const [loaderMounted, setLoaderMounted] = (0, import_react48.useState)(true);
|
|
11719
|
+
const [imgFailed, setImgFailed] = (0, import_react48.useState)(false);
|
|
11562
11720
|
const failedSrc = (() => {
|
|
11563
11721
|
if (!imgFailed || !renderedUrl) return void 0;
|
|
11564
11722
|
try {
|
|
@@ -11568,15 +11726,16 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11568
11726
|
return "?";
|
|
11569
11727
|
}
|
|
11570
11728
|
})();
|
|
11571
|
-
const [retryNonce, setRetryNonce] = (0,
|
|
11572
|
-
const retriedUrlRef = (0,
|
|
11573
|
-
const prevDisplayUrlRef = (0,
|
|
11574
|
-
const signHintShownRef = (0,
|
|
11575
|
-
(0,
|
|
11729
|
+
const [retryNonce, setRetryNonce] = (0, import_react48.useState)(0);
|
|
11730
|
+
const retriedUrlRef = (0, import_react48.useRef)(null);
|
|
11731
|
+
const prevDisplayUrlRef = (0, import_react48.useRef)(displayUrl);
|
|
11732
|
+
const signHintShownRef = (0, import_react48.useRef)(false);
|
|
11733
|
+
(0, import_react48.useEffect)(() => {
|
|
11576
11734
|
if (!displayUrl || displayUrl === prevDisplayUrlRef.current) return;
|
|
11577
11735
|
const oldUrl = prevDisplayUrlRef.current;
|
|
11578
11736
|
prevDisplayUrlRef.current = displayUrl;
|
|
11579
11737
|
setImgFailed(false);
|
|
11738
|
+
setDesignRefused(null);
|
|
11580
11739
|
retriedUrlRef.current = null;
|
|
11581
11740
|
if (!oldUrl) {
|
|
11582
11741
|
setRenderedUrl(displayUrl);
|
|
@@ -11605,26 +11764,26 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11605
11764
|
preload.onerror = null;
|
|
11606
11765
|
};
|
|
11607
11766
|
}, [displayUrl]);
|
|
11608
|
-
const handleCrossfadeEnd = (0,
|
|
11767
|
+
const handleCrossfadeEnd = (0, import_react48.useCallback)(() => {
|
|
11609
11768
|
setPrevUrl(null);
|
|
11610
11769
|
setShowNew(false);
|
|
11611
11770
|
}, []);
|
|
11612
|
-
const handleLoaderExited = (0,
|
|
11771
|
+
const handleLoaderExited = (0, import_react48.useCallback)(() => setLoaderMounted(false), []);
|
|
11613
11772
|
if (!hasArtwork) {
|
|
11614
|
-
return /* @__PURE__ */ (0,
|
|
11773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11615
11774
|
"div",
|
|
11616
11775
|
{
|
|
11617
11776
|
className: `bg-gray-100 flex items-center justify-center ${className || ""}`,
|
|
11618
11777
|
style,
|
|
11619
|
-
children: /* @__PURE__ */ (0,
|
|
11620
|
-
/* @__PURE__ */ (0,
|
|
11778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "text-gray-400 text-center p-4", children: [
|
|
11779
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11621
11780
|
"svg",
|
|
11622
11781
|
{
|
|
11623
11782
|
className: "w-8 h-8 mx-auto mb-2",
|
|
11624
11783
|
fill: "none",
|
|
11625
11784
|
stroke: "currentColor",
|
|
11626
11785
|
viewBox: "0 0 24 24",
|
|
11627
|
-
children: /* @__PURE__ */ (0,
|
|
11786
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11628
11787
|
"path",
|
|
11629
11788
|
{
|
|
11630
11789
|
strokeLinecap: "round",
|
|
@@ -11635,22 +11794,22 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11635
11794
|
)
|
|
11636
11795
|
}
|
|
11637
11796
|
),
|
|
11638
|
-
/* @__PURE__ */ (0,
|
|
11797
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-xs", children: emptyText })
|
|
11639
11798
|
] })
|
|
11640
11799
|
}
|
|
11641
11800
|
);
|
|
11642
11801
|
}
|
|
11643
11802
|
if (error) {
|
|
11644
|
-
return /* @__PURE__ */ (0,
|
|
11803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11645
11804
|
"div",
|
|
11646
11805
|
{
|
|
11647
11806
|
className: `bg-red-50 flex items-center justify-center ${className || ""}`,
|
|
11648
11807
|
style,
|
|
11649
|
-
children: /* @__PURE__ */ (0,
|
|
11808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "text-red-600 text-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-xs", children: errorText }) })
|
|
11650
11809
|
}
|
|
11651
11810
|
);
|
|
11652
11811
|
}
|
|
11653
|
-
return /* @__PURE__ */ (0,
|
|
11812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
11654
11813
|
"div",
|
|
11655
11814
|
{
|
|
11656
11815
|
ref: setContainerRef,
|
|
@@ -11665,8 +11824,9 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11665
11824
|
"data-picture-failed": imgFailed ? "E_PICTURE_UNDISPLAYED" : void 0,
|
|
11666
11825
|
"data-picture-failed-src": failedSrc,
|
|
11667
11826
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|
|
11827
|
+
"data-design-refused": designRefused ?? void 0,
|
|
11668
11828
|
children: [
|
|
11669
|
-
unavailable && /* @__PURE__ */ (0,
|
|
11829
|
+
unavailable && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11670
11830
|
"div",
|
|
11671
11831
|
{
|
|
11672
11832
|
role: "status",
|
|
@@ -11675,7 +11835,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11675
11835
|
children: "Mockup unavailable"
|
|
11676
11836
|
}
|
|
11677
11837
|
),
|
|
11678
|
-
renderedUrl && !imgFailed && /* @__PURE__ */ (0,
|
|
11838
|
+
renderedUrl && !imgFailed && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11679
11839
|
"img",
|
|
11680
11840
|
{
|
|
11681
11841
|
alt: `Product mockup${placement ? ` - ${placement}` : ""}`,
|
|
@@ -11705,8 +11865,29 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11705
11865
|
onError: () => {
|
|
11706
11866
|
if (renderedUrl && retriedUrlRef.current !== renderedUrl) {
|
|
11707
11867
|
retriedUrlRef.current = renderedUrl;
|
|
11708
|
-
|
|
11709
|
-
|
|
11868
|
+
const url = renderedUrl;
|
|
11869
|
+
const mockupIdNow = actualMockupId;
|
|
11870
|
+
void (async () => {
|
|
11871
|
+
let answer = await probeRenderAnswer(url);
|
|
11872
|
+
let verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 0);
|
|
11873
|
+
if (verdict === "retry") {
|
|
11874
|
+
await new Promise((r) => setTimeout(r, DESIGN_BUSY_RETRY_MS));
|
|
11875
|
+
if (renderedUrlRef.current !== url) return;
|
|
11876
|
+
answer = await probeRenderAnswer(url);
|
|
11877
|
+
verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 1);
|
|
11878
|
+
}
|
|
11879
|
+
if (renderedUrlRef.current !== url) return;
|
|
11880
|
+
if (verdict === "skip" && (0, import_sdk14.isDesignRefusalCode)(answer.code)) {
|
|
11881
|
+
setDesignRefused(answer.code);
|
|
11882
|
+
const skip = gallerySkipRef.current;
|
|
11883
|
+
if (skip && mockupIdNow) {
|
|
11884
|
+
skip.report(mockupIdNow, answer.code);
|
|
11885
|
+
realtimeContext?.frameFailed?.(url);
|
|
11886
|
+
return;
|
|
11887
|
+
}
|
|
11888
|
+
}
|
|
11889
|
+
setRetryNonce((n) => n + 1);
|
|
11890
|
+
})();
|
|
11710
11891
|
return;
|
|
11711
11892
|
}
|
|
11712
11893
|
setImgFailed(true);
|
|
@@ -11717,15 +11898,15 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11717
11898
|
signHintShownRef.current = true;
|
|
11718
11899
|
const hasSigner = typeof window !== "undefined" && !!window.snowcone?.signMockupUrl;
|
|
11719
11900
|
console.warn(
|
|
11720
|
-
hasSigner ? "[Snowcone] A mockup image failed to load and its URL is unsigned. Your `signMockupUrl` likely errored \u2014 check your /api/sign route and that its secret matches the shop's signing secret." : `[Snowcone] A mockup image failed to load (likely 'Missing required signature'). If your shop requires signed URLs, pass \`signMockupUrl\` to <Shop> so the UI can sign mockup <img> URLs. Docs: ${
|
|
11901
|
+
hasSigner ? "[Snowcone] A mockup image failed to load and its URL is unsigned. Your `signMockupUrl` likely errored \u2014 check your /api/sign route and that its secret matches the shop's signing secret." : `[Snowcone] A mockup image failed to load (likely 'Missing required signature'). If your shop requires signed URLs, pass \`signMockupUrl\` to <Shop> so the UI can sign mockup <img> URLs. Docs: ${import_sdk14.SNOWCONE_HOSTS.docs}/design-system/signing-at-scale`
|
|
11721
11902
|
);
|
|
11722
11903
|
}
|
|
11723
11904
|
}
|
|
11724
11905
|
},
|
|
11725
11906
|
retryNonce
|
|
11726
11907
|
),
|
|
11727
|
-
imgFailed && !prevUrl && /* @__PURE__ */ (0,
|
|
11728
|
-
realtimeContext?.renderError && /* @__PURE__ */ (0,
|
|
11908
|
+
imgFailed && !prevUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-muted-foreground text-xs", children: unavailableText }) }),
|
|
11909
|
+
realtimeContext?.renderError && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11729
11910
|
"div",
|
|
11730
11911
|
{
|
|
11731
11912
|
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
@@ -11735,7 +11916,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11735
11916
|
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11736
11917
|
}
|
|
11737
11918
|
),
|
|
11738
|
-
prevUrl && /* @__PURE__ */ (0,
|
|
11919
|
+
prevUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11739
11920
|
"img",
|
|
11740
11921
|
{
|
|
11741
11922
|
alt: "",
|
|
@@ -11750,7 +11931,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11750
11931
|
onTransitionEnd: handleCrossfadeEnd
|
|
11751
11932
|
}
|
|
11752
11933
|
),
|
|
11753
|
-
loaderMounted && /* @__PURE__ */ (0,
|
|
11934
|
+
loaderMounted && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11754
11935
|
LoadingOverlayPrismCandyInline,
|
|
11755
11936
|
{
|
|
11756
11937
|
visible: !firstImageLoaded,
|
|
@@ -11764,16 +11945,16 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11764
11945
|
});
|
|
11765
11946
|
|
|
11766
11947
|
// src/composed/SafeImg.tsx
|
|
11767
|
-
var
|
|
11768
|
-
var
|
|
11769
|
-
var SafeImg =
|
|
11948
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
11949
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11950
|
+
var SafeImg = import_react49.default.forwardRef(
|
|
11770
11951
|
function SafeImg2({ fallback = null, onError, src, ...rest }, ref) {
|
|
11771
|
-
const [failed, setFailed] = (0,
|
|
11772
|
-
(0,
|
|
11952
|
+
const [failed, setFailed] = (0, import_react49.useState)(false);
|
|
11953
|
+
(0, import_react49.useEffect)(() => {
|
|
11773
11954
|
setFailed(false);
|
|
11774
11955
|
}, [src]);
|
|
11775
|
-
if (failed) return /* @__PURE__ */ (0,
|
|
11776
|
-
return /* @__PURE__ */ (0,
|
|
11956
|
+
if (failed) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: fallback });
|
|
11957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11777
11958
|
"img",
|
|
11778
11959
|
{
|
|
11779
11960
|
...rest,
|
|
@@ -11789,7 +11970,7 @@ var SafeImg = import_react48.default.forwardRef(
|
|
|
11789
11970
|
);
|
|
11790
11971
|
|
|
11791
11972
|
// src/index.ts
|
|
11792
|
-
var
|
|
11973
|
+
var import_sdk16 = require("@snowcone-app/sdk");
|
|
11793
11974
|
|
|
11794
11975
|
// src/composed/search/SearchProvider.tsx
|
|
11795
11976
|
var import_react_instantsearch = require("react-instantsearch");
|
|
@@ -11808,11 +11989,11 @@ var { searchClient } = (0, import_instant_meilisearch.instantMeiliSearch)(
|
|
|
11808
11989
|
);
|
|
11809
11990
|
|
|
11810
11991
|
// src/composed/search/SearchProvider.tsx
|
|
11811
|
-
var
|
|
11812
|
-
var
|
|
11992
|
+
var import_react50 = require("react");
|
|
11993
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11813
11994
|
function InitialSearchTrigger() {
|
|
11814
11995
|
const { refine } = (0, import_react_instantsearch.useSearchBox)();
|
|
11815
|
-
(0,
|
|
11996
|
+
(0, import_react50.useEffect)(() => {
|
|
11816
11997
|
refine("");
|
|
11817
11998
|
}, [refine]);
|
|
11818
11999
|
return null;
|
|
@@ -11836,7 +12017,7 @@ function SearchProvider({
|
|
|
11836
12017
|
],
|
|
11837
12018
|
children
|
|
11838
12019
|
}) {
|
|
11839
|
-
return /* @__PURE__ */ (0,
|
|
12020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
11840
12021
|
import_react_instantsearch.InstantSearch,
|
|
11841
12022
|
{
|
|
11842
12023
|
searchClient,
|
|
@@ -11864,7 +12045,7 @@ function SearchProvider({
|
|
|
11864
12045
|
}
|
|
11865
12046
|
},
|
|
11866
12047
|
children: [
|
|
11867
|
-
/* @__PURE__ */ (0,
|
|
12048
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11868
12049
|
import_react_instantsearch.Configure,
|
|
11869
12050
|
{
|
|
11870
12051
|
hitsPerPage,
|
|
@@ -11873,7 +12054,7 @@ function SearchProvider({
|
|
|
11873
12054
|
attributesToRetrieve
|
|
11874
12055
|
}
|
|
11875
12056
|
),
|
|
11876
|
-
/* @__PURE__ */ (0,
|
|
12057
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(InitialSearchTrigger, {}),
|
|
11877
12058
|
children
|
|
11878
12059
|
]
|
|
11879
12060
|
}
|
|
@@ -11883,17 +12064,17 @@ function SearchProvider({
|
|
|
11883
12064
|
// src/composed/search/SearchBox.tsx
|
|
11884
12065
|
var import_react_instantsearch2 = require("react-instantsearch");
|
|
11885
12066
|
var import_lucide_react3 = require("lucide-react");
|
|
11886
|
-
var
|
|
11887
|
-
var
|
|
12067
|
+
var import_react51 = require("react");
|
|
12068
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11888
12069
|
function SearchBox() {
|
|
11889
12070
|
const { query, refine, clear } = (0, import_react_instantsearch2.useSearchBox)();
|
|
11890
12071
|
const searchParams = useUiSearchParams();
|
|
11891
12072
|
const router = useUiRouter();
|
|
11892
|
-
const inputRef = (0,
|
|
11893
|
-
const [showShimmer, setShowShimmer] = (0,
|
|
12073
|
+
const inputRef = (0, import_react51.useRef)(null);
|
|
12074
|
+
const [showShimmer, setShowShimmer] = (0, import_react51.useState)(false);
|
|
11894
12075
|
const inputId = "search-products-input";
|
|
11895
12076
|
const descriptionId = "search-description";
|
|
11896
|
-
(0,
|
|
12077
|
+
(0, import_react51.useEffect)(() => {
|
|
11897
12078
|
const handleSpotlight = () => {
|
|
11898
12079
|
inputRef.current?.focus();
|
|
11899
12080
|
inputRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -11903,7 +12084,7 @@ function SearchBox() {
|
|
|
11903
12084
|
window.addEventListener("search-spotlight", handleSpotlight);
|
|
11904
12085
|
return () => window.removeEventListener("search-spotlight", handleSpotlight);
|
|
11905
12086
|
}, []);
|
|
11906
|
-
(0,
|
|
12087
|
+
(0, import_react51.useEffect)(() => {
|
|
11907
12088
|
const shouldFocus = searchParams.get("focus") === "search";
|
|
11908
12089
|
if (shouldFocus && inputRef.current) {
|
|
11909
12090
|
const timer = setTimeout(() => {
|
|
@@ -11918,8 +12099,8 @@ function SearchBox() {
|
|
|
11918
12099
|
return () => clearTimeout(timer);
|
|
11919
12100
|
}
|
|
11920
12101
|
}, [searchParams, router]);
|
|
11921
|
-
return /* @__PURE__ */ (0,
|
|
11922
|
-
/* @__PURE__ */ (0,
|
|
12102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("form", { role: "search", onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative", children: [
|
|
12103
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11923
12104
|
Input,
|
|
11924
12105
|
{
|
|
11925
12106
|
ref: inputRef,
|
|
@@ -11928,15 +12109,15 @@ function SearchBox() {
|
|
|
11928
12109
|
value: query,
|
|
11929
12110
|
onChange: (e) => refine(e.target.value),
|
|
11930
12111
|
placeholder: "Search products...",
|
|
11931
|
-
startContent: /* @__PURE__ */ (0,
|
|
11932
|
-
endContent: query ? /* @__PURE__ */ (0,
|
|
12112
|
+
startContent: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react3.Search, { className: "w-5 h-5", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
12113
|
+
endContent: query ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11933
12114
|
"button",
|
|
11934
12115
|
{
|
|
11935
12116
|
type: "button",
|
|
11936
12117
|
onClick: clear,
|
|
11937
12118
|
className: "hover:text-foreground transition-colors",
|
|
11938
12119
|
"aria-label": "Clear search",
|
|
11939
|
-
children: /* @__PURE__ */ (0,
|
|
12120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react3.X, { className: "w-4 h-4", strokeWidth: 2, "aria-hidden": "true" })
|
|
11940
12121
|
}
|
|
11941
12122
|
) : void 0,
|
|
11942
12123
|
"aria-label": "Search products",
|
|
@@ -11946,11 +12127,11 @@ function SearchBox() {
|
|
|
11946
12127
|
className: "[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"
|
|
11947
12128
|
}
|
|
11948
12129
|
),
|
|
11949
|
-
showShimmer && /* @__PURE__ */ (0,
|
|
12130
|
+
showShimmer && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11950
12131
|
"div",
|
|
11951
12132
|
{
|
|
11952
12133
|
className: "absolute inset-0 pointer-events-none rounded-input z-20 overflow-hidden",
|
|
11953
|
-
children: /* @__PURE__ */ (0,
|
|
12134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11954
12135
|
"div",
|
|
11955
12136
|
{
|
|
11956
12137
|
className: "absolute inset-0",
|
|
@@ -11963,13 +12144,13 @@ function SearchBox() {
|
|
|
11963
12144
|
)
|
|
11964
12145
|
}
|
|
11965
12146
|
),
|
|
11966
|
-
/* @__PURE__ */ (0,
|
|
12147
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("style", { dangerouslySetInnerHTML: { __html: `
|
|
11967
12148
|
@keyframes searchShimmer {
|
|
11968
12149
|
0% { transform: translateX(-100%); }
|
|
11969
12150
|
100% { transform: translateX(100%); }
|
|
11970
12151
|
}
|
|
11971
12152
|
` } }),
|
|
11972
|
-
/* @__PURE__ */ (0,
|
|
12153
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { id: descriptionId, className: "sr-only", children: "Search results will update as you type" })
|
|
11973
12154
|
] }) });
|
|
11974
12155
|
}
|
|
11975
12156
|
|
|
@@ -11977,7 +12158,7 @@ function SearchBox() {
|
|
|
11977
12158
|
var import_react_instantsearch3 = require("react-instantsearch");
|
|
11978
12159
|
|
|
11979
12160
|
// src/composed/search/ProductHit.tsx
|
|
11980
|
-
var
|
|
12161
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11981
12162
|
function ProductHitComponent({
|
|
11982
12163
|
hit: product,
|
|
11983
12164
|
variant = "overlay"
|
|
@@ -11994,12 +12175,12 @@ function ProductHitComponent({
|
|
|
11994
12175
|
}
|
|
11995
12176
|
return "";
|
|
11996
12177
|
};
|
|
11997
|
-
return /* @__PURE__ */ (0,
|
|
12178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11998
12179
|
Product,
|
|
11999
12180
|
{
|
|
12000
12181
|
productId,
|
|
12001
12182
|
productData: product,
|
|
12002
|
-
children: /* @__PURE__ */ (0,
|
|
12183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12003
12184
|
ProductCard,
|
|
12004
12185
|
{
|
|
12005
12186
|
variant,
|
|
@@ -12020,10 +12201,10 @@ function ProductHitComponent({
|
|
|
12020
12201
|
}
|
|
12021
12202
|
|
|
12022
12203
|
// src/composed/search/ProductGrid.tsx
|
|
12023
|
-
var
|
|
12024
|
-
var
|
|
12204
|
+
var import_react52 = require("react");
|
|
12205
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12025
12206
|
function ProductGridSkeletonItem() {
|
|
12026
|
-
return /* @__PURE__ */ (0,
|
|
12207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "aspect-square bg-muted animate-pulse" });
|
|
12027
12208
|
}
|
|
12028
12209
|
function ProductGrid({
|
|
12029
12210
|
className = "",
|
|
@@ -12033,26 +12214,26 @@ function ProductGrid({
|
|
|
12033
12214
|
}) {
|
|
12034
12215
|
const { nbHits } = (0, import_react_instantsearch3.useStats)();
|
|
12035
12216
|
const { status, results } = (0, import_react_instantsearch3.useInstantSearch)();
|
|
12036
|
-
const [announcement, setAnnouncement] = (0,
|
|
12217
|
+
const [announcement, setAnnouncement] = (0, import_react52.useState)("");
|
|
12037
12218
|
const hitsCount = results?.hits?.length ?? 0;
|
|
12038
12219
|
const showSkeleton = hitsCount === 0 && status !== "error";
|
|
12039
|
-
(0,
|
|
12220
|
+
(0, import_react52.useEffect)(() => {
|
|
12040
12221
|
const timer = setTimeout(() => {
|
|
12041
12222
|
setAnnouncement(`${nbHits} ${nbHits === 1 ? "product" : "products"} found`);
|
|
12042
12223
|
}, 1e3);
|
|
12043
12224
|
return () => clearTimeout(timer);
|
|
12044
12225
|
}, [nbHits]);
|
|
12045
|
-
const HitComponent = (0,
|
|
12226
|
+
const HitComponent = (0, import_react52.useCallback)(({ hit }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12046
12227
|
ProductHitComponent,
|
|
12047
12228
|
{
|
|
12048
12229
|
hit,
|
|
12049
12230
|
variant
|
|
12050
12231
|
}
|
|
12051
12232
|
), [variant]);
|
|
12052
|
-
return /* @__PURE__ */ (0,
|
|
12053
|
-
/* @__PURE__ */ (0,
|
|
12054
|
-
showSkeleton && /* @__PURE__ */ (0,
|
|
12055
|
-
/* @__PURE__ */ (0,
|
|
12233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className, children: [
|
|
12234
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12235
|
+
showSkeleton && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: `grid ${gridClassName}`, children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ProductGridSkeletonItem, {}, i)) }),
|
|
12236
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: showSkeleton ? "hidden" : "", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12056
12237
|
import_react_instantsearch3.Hits,
|
|
12057
12238
|
{
|
|
12058
12239
|
hitComponent: HitComponent,
|
|
@@ -12067,18 +12248,18 @@ function ProductGrid({
|
|
|
12067
12248
|
}
|
|
12068
12249
|
|
|
12069
12250
|
// src/composed/search/Filters.tsx
|
|
12070
|
-
var
|
|
12251
|
+
var import_react54 = require("react");
|
|
12071
12252
|
|
|
12072
12253
|
// src/composed/search/FiltersButton.tsx
|
|
12073
12254
|
var import_lucide_react4 = require("lucide-react");
|
|
12074
|
-
var
|
|
12255
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12075
12256
|
var SlidersHorizontalIcon = import_lucide_react4.SlidersHorizontal;
|
|
12076
12257
|
function FiltersButton({
|
|
12077
12258
|
onClick,
|
|
12078
12259
|
className = "",
|
|
12079
12260
|
children = "Filters"
|
|
12080
12261
|
}) {
|
|
12081
|
-
return /* @__PURE__ */ (0,
|
|
12262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12082
12263
|
Button,
|
|
12083
12264
|
{
|
|
12084
12265
|
variant: "field",
|
|
@@ -12086,8 +12267,8 @@ function FiltersButton({
|
|
|
12086
12267
|
className,
|
|
12087
12268
|
"aria-label": "Open filters",
|
|
12088
12269
|
children: [
|
|
12089
|
-
/* @__PURE__ */ (0,
|
|
12090
|
-
/* @__PURE__ */ (0,
|
|
12270
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(SlidersHorizontalIcon, { className: "w-4 h-4" }),
|
|
12271
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children })
|
|
12091
12272
|
]
|
|
12092
12273
|
}
|
|
12093
12274
|
);
|
|
@@ -12096,15 +12277,15 @@ function FiltersButton({
|
|
|
12096
12277
|
// src/composed/search/FiltersDrawer.tsx
|
|
12097
12278
|
var import_react_instantsearch4 = require("react-instantsearch");
|
|
12098
12279
|
var import_lucide_react5 = require("lucide-react");
|
|
12099
|
-
var
|
|
12280
|
+
var import_react53 = require("react");
|
|
12100
12281
|
var Slider2 = __toESM(require("@radix-ui/react-slider"), 1);
|
|
12101
|
-
var
|
|
12282
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
12102
12283
|
var XIcon2 = import_lucide_react5.X;
|
|
12103
12284
|
function FiltersDrawer({ isOpen, onClose }) {
|
|
12104
|
-
const [showCounts, setShowCounts] = (0,
|
|
12285
|
+
const [showCounts, setShowCounts] = (0, import_react53.useState)(false);
|
|
12105
12286
|
const { nbHits } = (0, import_react_instantsearch4.useStats)();
|
|
12106
12287
|
const containerRef = useFocusTrap(isOpen, onClose);
|
|
12107
|
-
(0,
|
|
12288
|
+
(0, import_react53.useEffect)(() => {
|
|
12108
12289
|
if (isOpen) {
|
|
12109
12290
|
document.body.style.overflow = "hidden";
|
|
12110
12291
|
} else {
|
|
@@ -12114,7 +12295,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12114
12295
|
document.body.style.overflow = "";
|
|
12115
12296
|
};
|
|
12116
12297
|
}, [isOpen]);
|
|
12117
|
-
(0,
|
|
12298
|
+
(0, import_react53.useEffect)(() => {
|
|
12118
12299
|
const handleEscape = (e) => {
|
|
12119
12300
|
if (e.key === "Escape" && isOpen) {
|
|
12120
12301
|
onClose();
|
|
@@ -12123,8 +12304,8 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12123
12304
|
document.addEventListener("keydown", handleEscape);
|
|
12124
12305
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
12125
12306
|
}, [isOpen, onClose]);
|
|
12126
|
-
return /* @__PURE__ */ (0,
|
|
12127
|
-
/* @__PURE__ */ (0,
|
|
12307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
12308
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12128
12309
|
"div",
|
|
12129
12310
|
{
|
|
12130
12311
|
className: `fixed inset-0 bg-black/50 z-40 transition-opacity ${isOpen ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
@@ -12132,7 +12313,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12132
12313
|
"aria-hidden": "true"
|
|
12133
12314
|
}
|
|
12134
12315
|
),
|
|
12135
|
-
/* @__PURE__ */ (0,
|
|
12316
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12136
12317
|
"div",
|
|
12137
12318
|
{
|
|
12138
12319
|
ref: containerRef,
|
|
@@ -12141,26 +12322,26 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12141
12322
|
"aria-modal": "true",
|
|
12142
12323
|
"aria-labelledby": "filters-drawer-title",
|
|
12143
12324
|
children: [
|
|
12144
|
-
/* @__PURE__ */ (0,
|
|
12145
|
-
/* @__PURE__ */ (0,
|
|
12146
|
-
/* @__PURE__ */ (0,
|
|
12325
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
12326
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h2", { id: "filters-drawer-title", className: "text-xl font-bold", children: "Filters" }),
|
|
12327
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12147
12328
|
"button",
|
|
12148
12329
|
{
|
|
12149
12330
|
onClick: onClose,
|
|
12150
12331
|
className: "p-2 hover:bg-foreground/5 rounded-full transition-colors",
|
|
12151
12332
|
"aria-label": "Close filters",
|
|
12152
|
-
children: /* @__PURE__ */ (0,
|
|
12333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(XIcon2, { className: "w-5 h-5" })
|
|
12153
12334
|
}
|
|
12154
12335
|
)
|
|
12155
12336
|
] }),
|
|
12156
|
-
/* @__PURE__ */ (0,
|
|
12337
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("p", { className: "text-sm font-caption text-foreground/60", role: "status", "aria-live": "polite", children: [
|
|
12157
12338
|
nbHits.toLocaleString(),
|
|
12158
12339
|
" ",
|
|
12159
12340
|
nbHits === 1 ? "result" : "results"
|
|
12160
12341
|
] }) }),
|
|
12161
|
-
/* @__PURE__ */ (0,
|
|
12162
|
-
/* @__PURE__ */ (0,
|
|
12163
|
-
/* @__PURE__ */ (0,
|
|
12342
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-col gap-8", children: [
|
|
12343
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TagsSection, { showCounts, setShowCounts }),
|
|
12344
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PriceSection, {})
|
|
12164
12345
|
] }) })
|
|
12165
12346
|
]
|
|
12166
12347
|
}
|
|
@@ -12176,9 +12357,9 @@ function TagsSection({
|
|
|
12176
12357
|
sortBy: ["count:desc", "name:asc"],
|
|
12177
12358
|
limit: 100
|
|
12178
12359
|
});
|
|
12179
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12180
|
-
return /* @__PURE__ */ (0,
|
|
12181
|
-
/* @__PURE__ */ (0,
|
|
12360
|
+
const [isExpanded, setIsExpanded] = (0, import_react53.useState)(true);
|
|
12361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
12362
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12182
12363
|
"button",
|
|
12183
12364
|
{
|
|
12184
12365
|
onClick: () => setIsExpanded(!isExpanded),
|
|
@@ -12186,8 +12367,8 @@ function TagsSection({
|
|
|
12186
12367
|
"aria-expanded": isExpanded,
|
|
12187
12368
|
"aria-controls": "tags-content",
|
|
12188
12369
|
children: [
|
|
12189
|
-
/* @__PURE__ */ (0,
|
|
12190
|
-
/* @__PURE__ */ (0,
|
|
12370
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h3", { className: "text-base font-semibold text-primary", children: "Tags" }),
|
|
12371
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12191
12372
|
"svg",
|
|
12192
12373
|
{
|
|
12193
12374
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -12196,14 +12377,14 @@ function TagsSection({
|
|
|
12196
12377
|
stroke: "currentColor",
|
|
12197
12378
|
strokeWidth: 2.5,
|
|
12198
12379
|
"aria-hidden": "true",
|
|
12199
|
-
children: /* @__PURE__ */ (0,
|
|
12380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
12200
12381
|
}
|
|
12201
12382
|
)
|
|
12202
12383
|
]
|
|
12203
12384
|
}
|
|
12204
12385
|
),
|
|
12205
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12206
|
-
/* @__PURE__ */ (0,
|
|
12386
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-4", id: "tags-content", children: [
|
|
12387
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Product tags filter", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12207
12388
|
"button",
|
|
12208
12389
|
{
|
|
12209
12390
|
onClick: () => refine(item.value),
|
|
@@ -12214,15 +12395,15 @@ function TagsSection({
|
|
|
12214
12395
|
"aria-label": `${item.isRefined ? "Remove" : "Apply"} ${item.label} filter${showCounts ? ` (${item.count} products)` : ""}`,
|
|
12215
12396
|
"aria-pressed": item.isRefined,
|
|
12216
12397
|
children: [
|
|
12217
|
-
/* @__PURE__ */ (0,
|
|
12218
|
-
showCounts && /* @__PURE__ */ (0,
|
|
12398
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { "aria-hidden": "true", children: item.label }),
|
|
12399
|
+
showCounts && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: `text-xs font-caption ${item.isRefined ? "opacity-80" : "opacity-60"}`, "aria-hidden": "true", children: item.count })
|
|
12219
12400
|
]
|
|
12220
12401
|
},
|
|
12221
12402
|
item.value
|
|
12222
12403
|
)) }),
|
|
12223
|
-
/* @__PURE__ */ (0,
|
|
12224
|
-
/* @__PURE__ */ (0,
|
|
12225
|
-
/* @__PURE__ */ (0,
|
|
12404
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between pt-2", children: [
|
|
12405
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm font-label text-foreground/60", id: "show-counts-label", children: "Show counts" }),
|
|
12406
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12226
12407
|
"button",
|
|
12227
12408
|
{
|
|
12228
12409
|
onClick: () => setShowCounts(!showCounts),
|
|
@@ -12230,7 +12411,7 @@ function TagsSection({
|
|
|
12230
12411
|
role: "switch",
|
|
12231
12412
|
"aria-checked": showCounts,
|
|
12232
12413
|
"aria-labelledby": "show-counts-label",
|
|
12233
|
-
children: /* @__PURE__ */ (0,
|
|
12414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12234
12415
|
"span",
|
|
12235
12416
|
{
|
|
12236
12417
|
className: `inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform ${showCounts ? "translate-x-6" : "translate-x-1"}`,
|
|
@@ -12247,11 +12428,11 @@ function PriceSection() {
|
|
|
12247
12428
|
const { range, refine, start, canRefine } = (0, import_react_instantsearch4.useRange)({ attribute: "price" });
|
|
12248
12429
|
const rangeMin = typeof range.min === "number" && isFinite(range.min) ? range.min : 0;
|
|
12249
12430
|
const rangeMax = typeof range.max === "number" && isFinite(range.max) ? range.max : 15e3;
|
|
12250
|
-
const [localRange, setLocalRange] = (0,
|
|
12431
|
+
const [localRange, setLocalRange] = (0, import_react53.useState)([
|
|
12251
12432
|
typeof start?.[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
12252
12433
|
typeof start?.[1] === "number" && isFinite(start[1]) ? start[1] : rangeMax
|
|
12253
12434
|
]);
|
|
12254
|
-
(0,
|
|
12435
|
+
(0, import_react53.useEffect)(() => {
|
|
12255
12436
|
if (start && Array.isArray(start)) {
|
|
12256
12437
|
setLocalRange([
|
|
12257
12438
|
typeof start[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
@@ -12261,7 +12442,7 @@ function PriceSection() {
|
|
|
12261
12442
|
setLocalRange([rangeMin, rangeMax]);
|
|
12262
12443
|
}
|
|
12263
12444
|
}, [start, rangeMin, rangeMax]);
|
|
12264
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12445
|
+
const [isExpanded, setIsExpanded] = (0, import_react53.useState)(true);
|
|
12265
12446
|
if (!canRefine) {
|
|
12266
12447
|
return null;
|
|
12267
12448
|
}
|
|
@@ -12276,8 +12457,8 @@ function PriceSection() {
|
|
|
12276
12457
|
return `$${priceInDollars.toFixed(2)}`;
|
|
12277
12458
|
}
|
|
12278
12459
|
};
|
|
12279
|
-
return /* @__PURE__ */ (0,
|
|
12280
|
-
/* @__PURE__ */ (0,
|
|
12460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
12461
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12281
12462
|
"button",
|
|
12282
12463
|
{
|
|
12283
12464
|
onClick: () => setIsExpanded(!isExpanded),
|
|
@@ -12285,8 +12466,8 @@ function PriceSection() {
|
|
|
12285
12466
|
"aria-expanded": isExpanded,
|
|
12286
12467
|
"aria-controls": "price-content",
|
|
12287
12468
|
children: [
|
|
12288
|
-
/* @__PURE__ */ (0,
|
|
12289
|
-
/* @__PURE__ */ (0,
|
|
12469
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h3", { className: "text-base font-semibold text-primary", children: "Price" }),
|
|
12470
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12290
12471
|
"svg",
|
|
12291
12472
|
{
|
|
12292
12473
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -12295,22 +12476,22 @@ function PriceSection() {
|
|
|
12295
12476
|
stroke: "currentColor",
|
|
12296
12477
|
strokeWidth: 2.5,
|
|
12297
12478
|
"aria-hidden": "true",
|
|
12298
|
-
children: /* @__PURE__ */ (0,
|
|
12479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
12299
12480
|
}
|
|
12300
12481
|
)
|
|
12301
12482
|
]
|
|
12302
12483
|
}
|
|
12303
12484
|
),
|
|
12304
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12305
|
-
/* @__PURE__ */ (0,
|
|
12306
|
-
/* @__PURE__ */ (0,
|
|
12307
|
-
/* @__PURE__ */ (0,
|
|
12485
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-6", id: "price-content", children: [
|
|
12486
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between text-sm font-display", children: [
|
|
12487
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: formatPrice2(localRange[0]) }),
|
|
12488
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-foreground/70", children: formatPrice2(localRange[1]) })
|
|
12308
12489
|
] }),
|
|
12309
|
-
/* @__PURE__ */ (0,
|
|
12490
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("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) => {
|
|
12310
12491
|
const totalBars = 19;
|
|
12311
12492
|
const barPrice = rangeMin + (rangeMax - rangeMin) / totalBars * i;
|
|
12312
12493
|
const isInRange = barPrice >= localRange[0] && barPrice <= localRange[1];
|
|
12313
|
-
return /* @__PURE__ */ (0,
|
|
12494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12314
12495
|
"div",
|
|
12315
12496
|
{
|
|
12316
12497
|
className: `flex-1 rounded-t-sm transition-opacity ${isInRange ? "bg-foreground" : "bg-foreground/20"}`,
|
|
@@ -12319,7 +12500,7 @@ function PriceSection() {
|
|
|
12319
12500
|
i
|
|
12320
12501
|
);
|
|
12321
12502
|
}) }),
|
|
12322
|
-
/* @__PURE__ */ (0,
|
|
12503
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { style: { touchAction: "none" }, className: "my-6", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12323
12504
|
Slider2.Root,
|
|
12324
12505
|
{
|
|
12325
12506
|
className: "relative flex w-full touch-none select-none items-center",
|
|
@@ -12337,8 +12518,8 @@ function PriceSection() {
|
|
|
12337
12518
|
step: 1,
|
|
12338
12519
|
minStepsBetweenThumbs: 1,
|
|
12339
12520
|
children: [
|
|
12340
|
-
/* @__PURE__ */ (0,
|
|
12341
|
-
/* @__PURE__ */ (0,
|
|
12521
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Slider2.Track, { className: "relative h-3 w-full grow overflow-hidden rounded-full bg-foreground/20", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Slider2.Range, { className: "absolute h-full bg-foreground" }) }),
|
|
12522
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12342
12523
|
Slider2.Thumb,
|
|
12343
12524
|
{
|
|
12344
12525
|
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",
|
|
@@ -12352,7 +12533,7 @@ function PriceSection() {
|
|
|
12352
12533
|
"aria-valuetext": formatPrice2(localRange[0])
|
|
12353
12534
|
}
|
|
12354
12535
|
),
|
|
12355
|
-
/* @__PURE__ */ (0,
|
|
12536
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12356
12537
|
Slider2.Thumb,
|
|
12357
12538
|
{
|
|
12358
12539
|
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",
|
|
@@ -12369,10 +12550,10 @@ function PriceSection() {
|
|
|
12369
12550
|
]
|
|
12370
12551
|
}
|
|
12371
12552
|
) }),
|
|
12372
|
-
/* @__PURE__ */ (0,
|
|
12373
|
-
/* @__PURE__ */ (0,
|
|
12374
|
-
/* @__PURE__ */ (0,
|
|
12375
|
-
/* @__PURE__ */ (0,
|
|
12553
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
12554
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
12555
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { htmlFor: "price-min", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Min" }),
|
|
12556
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12376
12557
|
"input",
|
|
12377
12558
|
{
|
|
12378
12559
|
id: "price-min",
|
|
@@ -12390,9 +12571,9 @@ function PriceSection() {
|
|
|
12390
12571
|
}
|
|
12391
12572
|
)
|
|
12392
12573
|
] }),
|
|
12393
|
-
/* @__PURE__ */ (0,
|
|
12394
|
-
/* @__PURE__ */ (0,
|
|
12395
|
-
/* @__PURE__ */ (0,
|
|
12574
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
12575
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { htmlFor: "price-max", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Max" }),
|
|
12576
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12396
12577
|
"input",
|
|
12397
12578
|
{
|
|
12398
12579
|
id: "price-max",
|
|
@@ -12416,11 +12597,11 @@ function PriceSection() {
|
|
|
12416
12597
|
}
|
|
12417
12598
|
|
|
12418
12599
|
// src/composed/search/Filters.tsx
|
|
12419
|
-
var
|
|
12600
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
12420
12601
|
function Filters({ buttonClassName, buttonText }) {
|
|
12421
|
-
const [isOpen, setIsOpen] = (0,
|
|
12422
|
-
return /* @__PURE__ */ (0,
|
|
12423
|
-
/* @__PURE__ */ (0,
|
|
12602
|
+
const [isOpen, setIsOpen] = (0, import_react54.useState)(false);
|
|
12603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
12604
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
12424
12605
|
FiltersButton,
|
|
12425
12606
|
{
|
|
12426
12607
|
onClick: () => setIsOpen(true),
|
|
@@ -12428,14 +12609,14 @@ function Filters({ buttonClassName, buttonText }) {
|
|
|
12428
12609
|
children: buttonText
|
|
12429
12610
|
}
|
|
12430
12611
|
),
|
|
12431
|
-
/* @__PURE__ */ (0,
|
|
12612
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FiltersDrawer, { isOpen, onClose: () => setIsOpen(false) })
|
|
12432
12613
|
] });
|
|
12433
12614
|
}
|
|
12434
12615
|
|
|
12435
12616
|
// src/composed/search/CurrentRefinements.tsx
|
|
12436
12617
|
var import_react_instantsearch5 = require("react-instantsearch");
|
|
12437
12618
|
var import_lucide_react6 = require("lucide-react");
|
|
12438
|
-
var
|
|
12619
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
12439
12620
|
var XIcon3 = import_lucide_react6.X;
|
|
12440
12621
|
var MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
12441
12622
|
var MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
@@ -12483,15 +12664,15 @@ function CurrentRefinements() {
|
|
|
12483
12664
|
if (allRefinements.length === 0) {
|
|
12484
12665
|
return null;
|
|
12485
12666
|
}
|
|
12486
|
-
return /* @__PURE__ */ (0,
|
|
12667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("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__ */ (0, import_jsx_runtime72.jsxs)(
|
|
12487
12668
|
"button",
|
|
12488
12669
|
{
|
|
12489
12670
|
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",
|
|
12490
12671
|
onClick: () => refinement.refine(),
|
|
12491
12672
|
"aria-label": `Remove filter: ${refinement.displayLabel}`,
|
|
12492
12673
|
children: [
|
|
12493
|
-
/* @__PURE__ */ (0,
|
|
12494
|
-
/* @__PURE__ */ (0,
|
|
12674
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "truncate", children: refinement.displayLabel }),
|
|
12675
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(XIcon3, { className: "w-3 h-3" })
|
|
12495
12676
|
]
|
|
12496
12677
|
},
|
|
12497
12678
|
`${refinement.attribute}-${refinement.value}-${index}`
|
|
@@ -12515,12 +12696,12 @@ var FACET_SECTIONS = [
|
|
|
12515
12696
|
];
|
|
12516
12697
|
|
|
12517
12698
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12518
|
-
var
|
|
12699
|
+
var import_react57 = require("react");
|
|
12519
12700
|
|
|
12520
12701
|
// src/composed/zoom/ZoomOverlay.tsx
|
|
12521
|
-
var
|
|
12702
|
+
var import_react55 = require("react");
|
|
12522
12703
|
var import_lucide_react7 = require("lucide-react");
|
|
12523
|
-
var
|
|
12704
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
12524
12705
|
var PlusIcon2 = import_lucide_react7.Plus;
|
|
12525
12706
|
var MinusIcon2 = import_lucide_react7.Minus;
|
|
12526
12707
|
function ZoomOverlay({
|
|
@@ -12532,13 +12713,13 @@ function ZoomOverlay({
|
|
|
12532
12713
|
className,
|
|
12533
12714
|
style
|
|
12534
12715
|
}) {
|
|
12535
|
-
const [zoomedImageIndex, setZoomedImageIndex] = (0,
|
|
12536
|
-
const [zoomOrigin, setZoomOrigin] = (0,
|
|
12537
|
-
const [hoveredImageIndex, setHoveredImageIndex] = (0,
|
|
12538
|
-
const [cursorPos, setCursorPos] = (0,
|
|
12539
|
-
const [announcement, setAnnouncement] = (0,
|
|
12540
|
-
const [isZooming, setIsZooming] = (0,
|
|
12541
|
-
const handleZoomClick = (0,
|
|
12716
|
+
const [zoomedImageIndex, setZoomedImageIndex] = (0, import_react55.useState)(null);
|
|
12717
|
+
const [zoomOrigin, setZoomOrigin] = (0, import_react55.useState)({ x: 50, y: 50 });
|
|
12718
|
+
const [hoveredImageIndex, setHoveredImageIndex] = (0, import_react55.useState)(null);
|
|
12719
|
+
const [cursorPos, setCursorPos] = (0, import_react55.useState)({ x: 0, y: 0 });
|
|
12720
|
+
const [announcement, setAnnouncement] = (0, import_react55.useState)("");
|
|
12721
|
+
const [isZooming, setIsZooming] = (0, import_react55.useState)(false);
|
|
12722
|
+
const handleZoomClick = (0, import_react55.useCallback)(
|
|
12542
12723
|
(e) => {
|
|
12543
12724
|
e.stopPropagation();
|
|
12544
12725
|
if (isLargeTouchDevice && onEnhancedViewer) {
|
|
@@ -12563,7 +12744,7 @@ function ZoomOverlay({
|
|
|
12563
12744
|
},
|
|
12564
12745
|
[zoomedImageIndex, isLargeTouchDevice, onEnhancedViewer, imageIndex]
|
|
12565
12746
|
);
|
|
12566
|
-
const handleZoomMouseMove = (0,
|
|
12747
|
+
const handleZoomMouseMove = (0, import_react55.useCallback)(
|
|
12567
12748
|
(e) => {
|
|
12568
12749
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
12569
12750
|
if (zoomedImageIndex === imageIndex) {
|
|
@@ -12579,9 +12760,9 @@ function ZoomOverlay({
|
|
|
12579
12760
|
const isZoomed = zoomedImageIndex === imageIndex;
|
|
12580
12761
|
const isHovered = hoveredImageIndex === imageIndex;
|
|
12581
12762
|
const cursorStyle = isLargeTouchDevice ? "pointer" : isTouchDevice ? "default" : "none";
|
|
12582
|
-
return /* @__PURE__ */ (0,
|
|
12583
|
-
/* @__PURE__ */ (0,
|
|
12584
|
-
/* @__PURE__ */ (0,
|
|
12763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
12764
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12765
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12585
12766
|
"div",
|
|
12586
12767
|
{
|
|
12587
12768
|
className,
|
|
@@ -12589,7 +12770,7 @@ function ZoomOverlay({
|
|
|
12589
12770
|
...style,
|
|
12590
12771
|
position: "relative"
|
|
12591
12772
|
},
|
|
12592
|
-
children: /* @__PURE__ */ (0,
|
|
12773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12593
12774
|
"div",
|
|
12594
12775
|
{
|
|
12595
12776
|
style: {
|
|
@@ -12612,7 +12793,7 @@ function ZoomOverlay({
|
|
|
12612
12793
|
handleZoomClick(e);
|
|
12613
12794
|
}
|
|
12614
12795
|
},
|
|
12615
|
-
children: /* @__PURE__ */ (0,
|
|
12796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12616
12797
|
"div",
|
|
12617
12798
|
{
|
|
12618
12799
|
style: {
|
|
@@ -12628,7 +12809,7 @@ function ZoomOverlay({
|
|
|
12628
12809
|
)
|
|
12629
12810
|
}
|
|
12630
12811
|
),
|
|
12631
|
-
isHovered && !isTouchDevice && /* @__PURE__ */ (0,
|
|
12812
|
+
isHovered && !isTouchDevice && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12632
12813
|
"div",
|
|
12633
12814
|
{
|
|
12634
12815
|
className: "fixed pointer-events-none z-50 hidden md:block",
|
|
@@ -12638,7 +12819,7 @@ function ZoomOverlay({
|
|
|
12638
12819
|
transform: "translate(-50%, -50%)"
|
|
12639
12820
|
},
|
|
12640
12821
|
"aria-hidden": "true",
|
|
12641
|
-
children: /* @__PURE__ */ (0,
|
|
12822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "bg-white dark:bg-gray-800 rounded-full p-2 shadow-sm dark:shadow-gray-950/50", children: isZoomed ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12642
12823
|
MinusIcon2,
|
|
12643
12824
|
{
|
|
12644
12825
|
size: 20,
|
|
@@ -12646,7 +12827,7 @@ function ZoomOverlay({
|
|
|
12646
12827
|
strokeWidth: 1.5,
|
|
12647
12828
|
"aria-hidden": "true"
|
|
12648
12829
|
}
|
|
12649
|
-
) : /* @__PURE__ */ (0,
|
|
12830
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12650
12831
|
PlusIcon2,
|
|
12651
12832
|
{
|
|
12652
12833
|
size: 20,
|
|
@@ -12661,13 +12842,77 @@ function ZoomOverlay({
|
|
|
12661
12842
|
}
|
|
12662
12843
|
|
|
12663
12844
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12664
|
-
var
|
|
12845
|
+
var import_react56 = require("react");
|
|
12665
12846
|
var import_react_dom3 = require("react-dom");
|
|
12666
12847
|
var import_react_zoom_pan_pinch = require("react-zoom-pan-pinch");
|
|
12667
12848
|
var import_lucide_react8 = require("lucide-react");
|
|
12668
|
-
|
|
12849
|
+
|
|
12850
|
+
// src/composed/carousels/firstView.ts
|
|
12851
|
+
var SLIDE_FIRST_VIEW_ATTR = "data-first-view";
|
|
12852
|
+
var SLIDE_PRODUCT_BOX_ATTR = "data-product-box";
|
|
12853
|
+
var SLIDE_PHONE_WINDOW_ATTR = "data-phone-window";
|
|
12854
|
+
var SLIDE_FIRST_VIEW_X_VAR = "--first-view-x";
|
|
12855
|
+
var SLIDE_PRODUCT_X0_VAR = "--product-x0";
|
|
12856
|
+
var SLIDE_PRODUCT_X1_VAR = "--product-x1";
|
|
12857
|
+
var r4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
12858
|
+
var FIRST_VIEW_PICTURE_ASPECT = 16 / 9;
|
|
12859
|
+
var FIRST_VIEW_MARGIN = 0.03;
|
|
12860
|
+
function firstViewAnchorOfSlide(image) {
|
|
12861
|
+
const { productBox: product, phoneWindow: window2 } = image;
|
|
12862
|
+
if (window2) return { by: "phone-window", window: window2, product: product ?? null };
|
|
12863
|
+
if (product) return { by: "product", product };
|
|
12864
|
+
return { by: "picture-middle", why: "no-phone-window-no-product-box" };
|
|
12865
|
+
}
|
|
12866
|
+
function firstView(box, anchor, pictureAspect = FIRST_VIEW_PICTURE_ASPECT) {
|
|
12867
|
+
const { width: W, height: H } = box;
|
|
12868
|
+
const pictureWidth = Math.max(W, H * pictureAspect);
|
|
12869
|
+
const product = anchor.by === "picture-middle" ? null : anchor.product;
|
|
12870
|
+
const wanted = anchor.by === "phone-window" ? anchor.window.x + anchor.window.w / 2 : anchor.by === "product" ? anchor.product.x + anchor.product.w / 2 : 0.5;
|
|
12871
|
+
let centrePx = wanted * pictureWidth;
|
|
12872
|
+
if (product) {
|
|
12873
|
+
const mid = (product.x + product.w / 2) * pictureWidth;
|
|
12874
|
+
const lo = (product.x + product.w) * pictureWidth + FIRST_VIEW_MARGIN * W - W / 2;
|
|
12875
|
+
const hi = product.x * pictureWidth - FIRST_VIEW_MARGIN * W + W / 2;
|
|
12876
|
+
centrePx = Math.max(Math.min(lo, mid), Math.min(centrePx, Math.max(hi, mid)));
|
|
12877
|
+
}
|
|
12878
|
+
const left = Math.max(Math.min(0, W - pictureWidth), Math.min(W / 2 - centrePx, 0));
|
|
12879
|
+
const x0 = -left / pictureWidth, x1 = (W - left) / pictureWidth;
|
|
12880
|
+
if (!product) return { x0, x1, pictureWidth, left, product: "unjudged", inView: null, share: null };
|
|
12881
|
+
const seen = Math.max(0, Math.min(product.x + product.w, x1) - Math.max(product.x, x0));
|
|
12882
|
+
const inView = seen / product.w;
|
|
12883
|
+
return { x0, x1, pictureWidth, left, product: inView > 1 - 1e-6 ? "held" : "cut", inView, share: seen / (x1 - x0) };
|
|
12884
|
+
}
|
|
12885
|
+
function slideFirstViewFields(image) {
|
|
12886
|
+
if (!image.isRealMockup) return {};
|
|
12887
|
+
return { ...image.productBox ? { productBox: image.productBox } : {}, ...image.phoneWindow ? { phoneWindow: image.phoneWindow } : {} };
|
|
12888
|
+
}
|
|
12889
|
+
function slideFirstViewProps(image) {
|
|
12890
|
+
const { productBox: box, phoneWindow: phone } = image;
|
|
12891
|
+
if (!box && !phone) return {};
|
|
12892
|
+
const centre = phone ? r4(phone.x + phone.w / 2) : r4(box.x + box.w / 2);
|
|
12893
|
+
const x0 = box ? r4(box.x) : centre, x1 = box ? r4(box.x + box.w) : centre;
|
|
12894
|
+
return {
|
|
12895
|
+
[SLIDE_FIRST_VIEW_ATTR]: phone ? "phone-window" : "product",
|
|
12896
|
+
...box ? { [SLIDE_PRODUCT_BOX_ATTR]: [box.x, box.y, box.w, box.h].map(r4).join(",") } : {},
|
|
12897
|
+
...phone ? { [SLIDE_PHONE_WINDOW_ATTR]: [phone.x, phone.w].map(r4).join(",") } : {},
|
|
12898
|
+
style: { [SLIDE_FIRST_VIEW_X_VAR]: String(centre), [SLIDE_PRODUCT_X0_VAR]: String(x0), [SLIDE_PRODUCT_X1_VAR]: String(x1) }
|
|
12899
|
+
};
|
|
12900
|
+
}
|
|
12901
|
+
|
|
12902
|
+
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12903
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
12669
12904
|
var TransformWrapper = import_react_zoom_pan_pinch.TransformWrapper;
|
|
12670
12905
|
var TransformComponent = import_react_zoom_pan_pinch.TransformComponent;
|
|
12906
|
+
function viewerFirstView(image, screen, pictureAspect) {
|
|
12907
|
+
if (image?.fit === "whole") return { by: "whole" };
|
|
12908
|
+
const anchor = firstViewAnchorOfSlide(image ?? {});
|
|
12909
|
+
if (anchor.by === "picture-middle") return anchor;
|
|
12910
|
+
if (pictureAspect !== void 0 && Math.abs(pictureAspect / FIRST_VIEW_PICTURE_ASPECT - 1) > 0.01) {
|
|
12911
|
+
return { by: "picture-middle", why: "picture-not-16:9" };
|
|
12912
|
+
}
|
|
12913
|
+
return { by: anchor.by, view: firstView(screen, anchor) };
|
|
12914
|
+
}
|
|
12915
|
+
var r42 = (n) => Math.round(n * 1e4) / 1e4;
|
|
12671
12916
|
var EnhancedImageViewer = ({
|
|
12672
12917
|
imageUrl,
|
|
12673
12918
|
alt,
|
|
@@ -12676,17 +12921,18 @@ var EnhancedImageViewer = ({
|
|
|
12676
12921
|
onIndexChange,
|
|
12677
12922
|
currentIndex: propCurrentIndex
|
|
12678
12923
|
}) => {
|
|
12679
|
-
const [isMounted, setIsMounted] = (0,
|
|
12680
|
-
const [isClient, setIsClient] = (0,
|
|
12681
|
-
const [scale, setScale] = (0,
|
|
12682
|
-
const [cropDimensions, setCropDimensions] = (0,
|
|
12683
|
-
const [currentZoomScale, setCurrentZoomScale] = (0,
|
|
12684
|
-
const imgRef = (0,
|
|
12685
|
-
const
|
|
12924
|
+
const [isMounted, setIsMounted] = (0, import_react56.useState)(false);
|
|
12925
|
+
const [isClient, setIsClient] = (0, import_react56.useState)(false);
|
|
12926
|
+
const [scale, setScale] = (0, import_react56.useState)({ initial: 1, min: 1, max: 8 });
|
|
12927
|
+
const [cropDimensions, setCropDimensions] = (0, import_react56.useState)({ width: 0, height: 0 });
|
|
12928
|
+
const [currentZoomScale, setCurrentZoomScale] = (0, import_react56.useState)(1);
|
|
12929
|
+
const imgRef = (0, import_react56.useRef)(null);
|
|
12930
|
+
const [loadedAspect, setLoadedAspect] = (0, import_react56.useState)(null);
|
|
12931
|
+
const touchStartRef = (0, import_react56.useRef)(
|
|
12686
12932
|
null
|
|
12687
12933
|
);
|
|
12688
|
-
const isSwipingRef = (0,
|
|
12689
|
-
const calculateScale = (0,
|
|
12934
|
+
const isSwipingRef = (0, import_react56.useRef)(false);
|
|
12935
|
+
const calculateScale = (0, import_react56.useCallback)(() => {
|
|
12690
12936
|
const viewport = {
|
|
12691
12937
|
width: window.innerWidth,
|
|
12692
12938
|
height: window.innerHeight
|
|
@@ -12698,10 +12944,14 @@ var EnhancedImageViewer = ({
|
|
|
12698
12944
|
max: 8
|
|
12699
12945
|
});
|
|
12700
12946
|
}, []);
|
|
12701
|
-
const handleImageLoad = (0,
|
|
12947
|
+
const handleImageLoad = (0, import_react56.useCallback)(() => {
|
|
12702
12948
|
calculateScale();
|
|
12949
|
+
const img = imgRef.current;
|
|
12950
|
+
if (img && img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
12951
|
+
setLoadedAspect({ src: img.currentSrc || img.src, aspect: img.naturalWidth / img.naturalHeight });
|
|
12952
|
+
}
|
|
12703
12953
|
}, [calculateScale]);
|
|
12704
|
-
(0,
|
|
12954
|
+
(0, import_react56.useLayoutEffect)(() => {
|
|
12705
12955
|
setIsClient(true);
|
|
12706
12956
|
setIsMounted(true);
|
|
12707
12957
|
document.body.style.overflow = "hidden";
|
|
@@ -12710,17 +12960,17 @@ var EnhancedImageViewer = ({
|
|
|
12710
12960
|
document.body.style.overflow = "";
|
|
12711
12961
|
};
|
|
12712
12962
|
}, [calculateScale]);
|
|
12713
|
-
(0,
|
|
12963
|
+
(0, import_react56.useEffect)(() => {
|
|
12714
12964
|
calculateScale();
|
|
12715
12965
|
}, [calculateScale]);
|
|
12716
|
-
(0,
|
|
12966
|
+
(0, import_react56.useEffect)(() => {
|
|
12717
12967
|
const handleResize = () => {
|
|
12718
12968
|
calculateScale();
|
|
12719
12969
|
};
|
|
12720
12970
|
window.addEventListener("resize", handleResize);
|
|
12721
12971
|
return () => window.removeEventListener("resize", handleResize);
|
|
12722
12972
|
}, [calculateScale]);
|
|
12723
|
-
(0,
|
|
12973
|
+
(0, import_react56.useEffect)(() => {
|
|
12724
12974
|
const handleKeyDown = (e) => {
|
|
12725
12975
|
if (e.key === "Escape") {
|
|
12726
12976
|
onClose();
|
|
@@ -12746,7 +12996,7 @@ var EnhancedImageViewer = ({
|
|
|
12746
12996
|
document.addEventListener("keydown", handleKeyDown);
|
|
12747
12997
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12748
12998
|
}, [onClose, imageUrl, images, onIndexChange, propCurrentIndex]);
|
|
12749
|
-
const handleSwipeNavigation = (0,
|
|
12999
|
+
const handleSwipeNavigation = (0, import_react56.useCallback)(
|
|
12750
13000
|
(direction) => {
|
|
12751
13001
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12752
13002
|
if (currentIndex === -1) {
|
|
@@ -12767,7 +13017,7 @@ var EnhancedImageViewer = ({
|
|
|
12767
13017
|
},
|
|
12768
13018
|
[propCurrentIndex, images, imageUrl, onIndexChange]
|
|
12769
13019
|
);
|
|
12770
|
-
const handleTouchStart = (0,
|
|
13020
|
+
const handleTouchStart = (0, import_react56.useCallback)(
|
|
12771
13021
|
(e) => {
|
|
12772
13022
|
const isAtInitialZoom = Math.abs(currentZoomScale - scale.initial) < 0.1;
|
|
12773
13023
|
if (!isAtInitialZoom) return;
|
|
@@ -12781,7 +13031,7 @@ var EnhancedImageViewer = ({
|
|
|
12781
13031
|
},
|
|
12782
13032
|
[currentZoomScale, scale.initial]
|
|
12783
13033
|
);
|
|
12784
|
-
const handleTouchEnd = (0,
|
|
13034
|
+
const handleTouchEnd = (0, import_react56.useCallback)(
|
|
12785
13035
|
(e) => {
|
|
12786
13036
|
if (!touchStartRef.current) return;
|
|
12787
13037
|
const touch = e.changedTouches[0];
|
|
@@ -12803,14 +13053,25 @@ var EnhancedImageViewer = ({
|
|
|
12803
13053
|
},
|
|
12804
13054
|
[handleSwipeNavigation]
|
|
12805
13055
|
);
|
|
13056
|
+
const shownIndex = propCurrentIndex ?? images.findIndex((img) => img.src === imageUrl);
|
|
13057
|
+
const shown = images[shownIndex];
|
|
13058
|
+
const shownAspect = loadedAspect && (loadedAspect.src === imageUrl || loadedAspect.src.endsWith(imageUrl)) ? loadedAspect.aspect : shown?.naturalWidth && shown?.naturalHeight ? shown.naturalWidth / shown.naturalHeight : void 0;
|
|
13059
|
+
const opening = viewerFirstView(
|
|
13060
|
+
shown,
|
|
13061
|
+
{
|
|
13062
|
+
width: cropDimensions.width || (typeof window === "undefined" ? 0 : window.innerWidth),
|
|
13063
|
+
height: cropDimensions.height || (typeof window === "undefined" ? 0 : window.innerHeight)
|
|
13064
|
+
},
|
|
13065
|
+
shownAspect
|
|
13066
|
+
);
|
|
12806
13067
|
if (!isMounted || !isClient) {
|
|
12807
13068
|
return (0, import_react_dom3.createPortal)(
|
|
12808
|
-
/* @__PURE__ */ (0,
|
|
13069
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12809
13070
|
"div",
|
|
12810
13071
|
{
|
|
12811
13072
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
12812
13073
|
style: { zIndex: 999999 },
|
|
12813
|
-
children: /* @__PURE__ */ (0,
|
|
13074
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12814
13075
|
"div",
|
|
12815
13076
|
{
|
|
12816
13077
|
style: {
|
|
@@ -12826,7 +13087,7 @@ var EnhancedImageViewer = ({
|
|
|
12826
13087
|
);
|
|
12827
13088
|
}
|
|
12828
13089
|
return (0, import_react_dom3.createPortal)(
|
|
12829
|
-
/* @__PURE__ */ (0,
|
|
13090
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
12830
13091
|
"div",
|
|
12831
13092
|
{
|
|
12832
13093
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
@@ -12835,7 +13096,7 @@ var EnhancedImageViewer = ({
|
|
|
12835
13096
|
"aria-modal": "true",
|
|
12836
13097
|
"aria-label": "Image viewer",
|
|
12837
13098
|
children: [
|
|
12838
|
-
/* @__PURE__ */ (0,
|
|
13099
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12839
13100
|
"button",
|
|
12840
13101
|
{
|
|
12841
13102
|
onClick: (e) => {
|
|
@@ -12861,10 +13122,10 @@ var EnhancedImageViewer = ({
|
|
|
12861
13122
|
touchAction: "manipulation",
|
|
12862
13123
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
12863
13124
|
},
|
|
12864
|
-
children: /* @__PURE__ */ (0,
|
|
13125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_lucide_react8.X, { className: "w-7 h-7", strokeWidth: 2.5 })
|
|
12865
13126
|
}
|
|
12866
13127
|
),
|
|
12867
|
-
/* @__PURE__ */ (0,
|
|
13128
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12868
13129
|
TransformWrapper,
|
|
12869
13130
|
{
|
|
12870
13131
|
initialScale: scale.initial,
|
|
@@ -12898,7 +13159,7 @@ var EnhancedImageViewer = ({
|
|
|
12898
13159
|
onTransformed: (ref) => {
|
|
12899
13160
|
setCurrentZoomScale(ref.state.scale);
|
|
12900
13161
|
},
|
|
12901
|
-
children: ({ zoomIn, zoomOut, resetTransform }) => /* @__PURE__ */ (0,
|
|
13162
|
+
children: ({ zoomIn, zoomOut, resetTransform }) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
12902
13163
|
"div",
|
|
12903
13164
|
{
|
|
12904
13165
|
style: {
|
|
@@ -12911,14 +13172,14 @@ var EnhancedImageViewer = ({
|
|
|
12911
13172
|
onTouchStart: handleTouchStart,
|
|
12912
13173
|
onTouchEnd: handleTouchEnd,
|
|
12913
13174
|
children: [
|
|
12914
|
-
/* @__PURE__ */ (0,
|
|
13175
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12915
13176
|
TransformComponent,
|
|
12916
13177
|
{
|
|
12917
13178
|
wrapperStyle: {
|
|
12918
13179
|
width: "100%",
|
|
12919
13180
|
height: "100%"
|
|
12920
13181
|
},
|
|
12921
|
-
children: /* @__PURE__ */ (0,
|
|
13182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12922
13183
|
"div",
|
|
12923
13184
|
{
|
|
12924
13185
|
style: {
|
|
@@ -12929,7 +13190,7 @@ var EnhancedImageViewer = ({
|
|
|
12929
13190
|
alignItems: "center",
|
|
12930
13191
|
justifyContent: "center"
|
|
12931
13192
|
},
|
|
12932
|
-
children: /* @__PURE__ */ (0,
|
|
13193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12933
13194
|
SafeImg,
|
|
12934
13195
|
{
|
|
12935
13196
|
ref: imgRef,
|
|
@@ -12937,11 +13198,17 @@ var EnhancedImageViewer = ({
|
|
|
12937
13198
|
alt,
|
|
12938
13199
|
crossOrigin: "anonymous",
|
|
12939
13200
|
onLoad: handleImageLoad,
|
|
13201
|
+
"data-first-view": opening.by,
|
|
13202
|
+
"data-first-view-why": opening.by === "picture-middle" ? opening.why : void 0,
|
|
13203
|
+
"data-first-view-product": "view" in opening ? opening.view.product : void 0,
|
|
13204
|
+
"data-first-view-slice": "view" in opening ? `${r42(opening.view.x0)},${r42(opening.view.x1)}` : void 0,
|
|
12940
13205
|
style: {
|
|
12941
13206
|
width: "100%",
|
|
12942
13207
|
height: "100%",
|
|
12943
13208
|
// Crop 16:9 to fill the screen (a hero), or the whole picture for a size picture (a diagram).
|
|
12944
|
-
objectFit:
|
|
13209
|
+
objectFit: opening.by === "whole" ? "contain" : "cover",
|
|
13210
|
+
// Opened on the product by the hero's first-view rule; a picture without the fields keeps the middle.
|
|
13211
|
+
..."view" in opening ? { objectPosition: `${Math.round(opening.view.left * 100) / 100}px 50%` } : {}
|
|
12945
13212
|
}
|
|
12946
13213
|
},
|
|
12947
13214
|
`${imageUrl}-${propCurrentIndex}`
|
|
@@ -12950,8 +13217,8 @@ var EnhancedImageViewer = ({
|
|
|
12950
13217
|
)
|
|
12951
13218
|
}
|
|
12952
13219
|
),
|
|
12953
|
-
/* @__PURE__ */ (0,
|
|
12954
|
-
/* @__PURE__ */ (0,
|
|
13220
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "fixed bottom-5 left-0 right-0 z-50", children: [
|
|
13221
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "flex justify-center gap-2", children: (() => {
|
|
12955
13222
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12956
13223
|
if (currentIndex === -1) {
|
|
12957
13224
|
currentIndex = images.findIndex(
|
|
@@ -12984,8 +13251,8 @@ var EnhancedImageViewer = ({
|
|
|
12984
13251
|
};
|
|
12985
13252
|
const nextIndex = findNextAvailableIndex(currentIndex, 1);
|
|
12986
13253
|
const prevIndex = findNextAvailableIndex(currentIndex, -1);
|
|
12987
|
-
return /* @__PURE__ */ (0,
|
|
12988
|
-
/* @__PURE__ */ (0,
|
|
13254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
13255
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12989
13256
|
"button",
|
|
12990
13257
|
{
|
|
12991
13258
|
onClick: () => {
|
|
@@ -12998,7 +13265,7 @@ var EnhancedImageViewer = ({
|
|
|
12998
13265
|
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"}`,
|
|
12999
13266
|
style: { touchAction: "manipulation" },
|
|
13000
13267
|
"aria-label": "Previous image",
|
|
13001
|
-
children: /* @__PURE__ */ (0,
|
|
13268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13002
13269
|
"svg",
|
|
13003
13270
|
{
|
|
13004
13271
|
className: "w-4 h-4",
|
|
@@ -13006,7 +13273,7 @@ var EnhancedImageViewer = ({
|
|
|
13006
13273
|
stroke: "currentColor",
|
|
13007
13274
|
viewBox: "0 0 24 24",
|
|
13008
13275
|
"aria-hidden": "true",
|
|
13009
|
-
children: /* @__PURE__ */ (0,
|
|
13276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13010
13277
|
"path",
|
|
13011
13278
|
{
|
|
13012
13279
|
strokeLinecap: "round",
|
|
@@ -13019,7 +13286,7 @@ var EnhancedImageViewer = ({
|
|
|
13019
13286
|
)
|
|
13020
13287
|
}
|
|
13021
13288
|
),
|
|
13022
|
-
/* @__PURE__ */ (0,
|
|
13289
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13023
13290
|
"button",
|
|
13024
13291
|
{
|
|
13025
13292
|
onClick: () => {
|
|
@@ -13032,7 +13299,7 @@ var EnhancedImageViewer = ({
|
|
|
13032
13299
|
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"}`,
|
|
13033
13300
|
style: { touchAction: "manipulation" },
|
|
13034
13301
|
"aria-label": "Next image",
|
|
13035
|
-
children: /* @__PURE__ */ (0,
|
|
13302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13036
13303
|
"svg",
|
|
13037
13304
|
{
|
|
13038
13305
|
className: "w-4 h-4",
|
|
@@ -13040,7 +13307,7 @@ var EnhancedImageViewer = ({
|
|
|
13040
13307
|
stroke: "currentColor",
|
|
13041
13308
|
viewBox: "0 0 24 24",
|
|
13042
13309
|
"aria-hidden": "true",
|
|
13043
|
-
children: /* @__PURE__ */ (0,
|
|
13310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13044
13311
|
"path",
|
|
13045
13312
|
{
|
|
13046
13313
|
strokeLinecap: "round",
|
|
@@ -13055,7 +13322,7 @@ var EnhancedImageViewer = ({
|
|
|
13055
13322
|
)
|
|
13056
13323
|
] });
|
|
13057
13324
|
})() }),
|
|
13058
|
-
/* @__PURE__ */ (0,
|
|
13325
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("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: (() => {
|
|
13059
13326
|
const total = Math.max(images.length, 1);
|
|
13060
13327
|
const current = propCurrentIndex !== void 0 ? Math.min(propCurrentIndex + 1, total) : 1;
|
|
13061
13328
|
return `${current} / ${total}`;
|
|
@@ -13067,7 +13334,7 @@ var EnhancedImageViewer = ({
|
|
|
13067
13334
|
},
|
|
13068
13335
|
`${scale.initial}-${scale.min}-${scale.max}`
|
|
13069
13336
|
),
|
|
13070
|
-
/* @__PURE__ */ (0,
|
|
13337
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13071
13338
|
"div",
|
|
13072
13339
|
{
|
|
13073
13340
|
className: "absolute inset-0 bg-black",
|
|
@@ -13086,7 +13353,7 @@ var EnhancedImageViewer = ({
|
|
|
13086
13353
|
};
|
|
13087
13354
|
|
|
13088
13355
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
13089
|
-
var
|
|
13356
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13090
13357
|
function ResponsiveZoom({
|
|
13091
13358
|
imageIndex,
|
|
13092
13359
|
children,
|
|
@@ -13096,11 +13363,11 @@ function ResponsiveZoom({
|
|
|
13096
13363
|
imageUrl,
|
|
13097
13364
|
alt = "Product image"
|
|
13098
13365
|
}) {
|
|
13099
|
-
const [isTouchDevice, setIsTouchDevice] = (0,
|
|
13100
|
-
const [showEnhancedViewer, setShowEnhancedViewer] = (0,
|
|
13101
|
-
const [viewerIndex, setViewerIndex] = (0,
|
|
13102
|
-
const [currentImageUrl, setCurrentImageUrl] = (0,
|
|
13103
|
-
(0,
|
|
13366
|
+
const [isTouchDevice, setIsTouchDevice] = (0, import_react57.useState)(false);
|
|
13367
|
+
const [showEnhancedViewer, setShowEnhancedViewer] = (0, import_react57.useState)(false);
|
|
13368
|
+
const [viewerIndex, setViewerIndex] = (0, import_react57.useState)(0);
|
|
13369
|
+
const [currentImageUrl, setCurrentImageUrl] = (0, import_react57.useState)(imageUrl || "");
|
|
13370
|
+
(0, import_react57.useEffect)(() => {
|
|
13104
13371
|
const checkDeviceType = () => {
|
|
13105
13372
|
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
13106
13373
|
setIsTouchDevice(hasTouch);
|
|
@@ -13127,8 +13394,8 @@ function ResponsiveZoom({
|
|
|
13127
13394
|
}
|
|
13128
13395
|
}
|
|
13129
13396
|
};
|
|
13130
|
-
return /* @__PURE__ */ (0,
|
|
13131
|
-
isTouchDevice ? /* @__PURE__ */ (0,
|
|
13397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
13398
|
+
isTouchDevice ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13132
13399
|
"div",
|
|
13133
13400
|
{
|
|
13134
13401
|
className,
|
|
@@ -13145,7 +13412,7 @@ function ResponsiveZoom({
|
|
|
13145
13412
|
},
|
|
13146
13413
|
children
|
|
13147
13414
|
}
|
|
13148
|
-
) : /* @__PURE__ */ (0,
|
|
13415
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13149
13416
|
ZoomOverlay,
|
|
13150
13417
|
{
|
|
13151
13418
|
imageIndex,
|
|
@@ -13156,7 +13423,7 @@ function ResponsiveZoom({
|
|
|
13156
13423
|
children
|
|
13157
13424
|
}
|
|
13158
13425
|
),
|
|
13159
|
-
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ (0,
|
|
13426
|
+
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13160
13427
|
EnhancedImageViewer,
|
|
13161
13428
|
{
|
|
13162
13429
|
imageUrl: currentImageUrl,
|
|
@@ -13178,29 +13445,8 @@ function ResponsiveZoom({
|
|
|
13178
13445
|
] });
|
|
13179
13446
|
}
|
|
13180
13447
|
|
|
13181
|
-
// src/composed/carousels/firstView.ts
|
|
13182
|
-
var SLIDE_FIRST_VIEW_ATTR = "data-first-view";
|
|
13183
|
-
var SLIDE_PRODUCT_BOX_ATTR = "data-product-box";
|
|
13184
|
-
var SLIDE_PHONE_WINDOW_ATTR = "data-phone-window";
|
|
13185
|
-
var SLIDE_FIRST_VIEW_X_VAR = "--first-view-x";
|
|
13186
|
-
var SLIDE_PRODUCT_X0_VAR = "--product-x0";
|
|
13187
|
-
var SLIDE_PRODUCT_X1_VAR = "--product-x1";
|
|
13188
|
-
var r4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
13189
|
-
function slideFirstViewProps(image) {
|
|
13190
|
-
const { productBox: box, phoneWindow: phone } = image;
|
|
13191
|
-
if (!box && !phone) return {};
|
|
13192
|
-
const centre = phone ? r4(phone.x + phone.w / 2) : r4(box.x + box.w / 2);
|
|
13193
|
-
const x0 = box ? r4(box.x) : centre, x1 = box ? r4(box.x + box.w) : centre;
|
|
13194
|
-
return {
|
|
13195
|
-
[SLIDE_FIRST_VIEW_ATTR]: phone ? "phone-window" : "product",
|
|
13196
|
-
...box ? { [SLIDE_PRODUCT_BOX_ATTR]: [box.x, box.y, box.w, box.h].map(r4).join(",") } : {},
|
|
13197
|
-
...phone ? { [SLIDE_PHONE_WINDOW_ATTR]: [phone.x, phone.w].map(r4).join(",") } : {},
|
|
13198
|
-
style: { [SLIDE_FIRST_VIEW_X_VAR]: String(centre), [SLIDE_PRODUCT_X0_VAR]: String(x0), [SLIDE_PRODUCT_X1_VAR]: String(x1) }
|
|
13199
|
-
};
|
|
13200
|
-
}
|
|
13201
|
-
|
|
13202
13448
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13203
|
-
var
|
|
13449
|
+
var import_react58 = require("react");
|
|
13204
13450
|
|
|
13205
13451
|
// src/composed/carousels/fit.ts
|
|
13206
13452
|
function slideFit(_galleryRole) {
|
|
@@ -13211,17 +13457,17 @@ function zoomFit(galleryRole) {
|
|
|
13211
13457
|
}
|
|
13212
13458
|
|
|
13213
13459
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13214
|
-
var
|
|
13460
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13215
13461
|
function StaticCarouselImage({
|
|
13216
13462
|
src,
|
|
13217
13463
|
alt,
|
|
13218
13464
|
className
|
|
13219
13465
|
}) {
|
|
13220
|
-
const [failed, setFailed] = (0,
|
|
13466
|
+
const [failed, setFailed] = (0, import_react58.useState)(false);
|
|
13221
13467
|
if (failed || !src) {
|
|
13222
|
-
return /* @__PURE__ */ (0,
|
|
13468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: `bg-muted ${className ?? ""}`, role: "img", "aria-label": alt });
|
|
13223
13469
|
}
|
|
13224
|
-
return /* @__PURE__ */ (0,
|
|
13470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13225
13471
|
"img",
|
|
13226
13472
|
{
|
|
13227
13473
|
src,
|
|
@@ -13235,7 +13481,7 @@ function StaticCarouselImage({
|
|
|
13235
13481
|
}
|
|
13236
13482
|
);
|
|
13237
13483
|
}
|
|
13238
|
-
var MobileProductCarousel = (0,
|
|
13484
|
+
var MobileProductCarousel = (0, import_react58.memo)(function MobileProductCarousel2({
|
|
13239
13485
|
images,
|
|
13240
13486
|
currentIndex = 0,
|
|
13241
13487
|
onIndexChange,
|
|
@@ -13254,42 +13500,43 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13254
13500
|
errorText,
|
|
13255
13501
|
unavailableText
|
|
13256
13502
|
}) {
|
|
13257
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
13258
|
-
const
|
|
13503
|
+
const [activeIndex, setActiveIndex] = (0, import_react58.useState)(currentIndex);
|
|
13504
|
+
const skippedStamp = gallerySkippedStamp(useGallerySkipOptional()?.skipped ?? NO_GALLERY_SKIPS, images ?? []);
|
|
13505
|
+
const [touchStart, setTouchStart] = (0, import_react58.useState)(
|
|
13259
13506
|
null
|
|
13260
13507
|
);
|
|
13261
|
-
const [touchEnd, setTouchEnd] = (0,
|
|
13508
|
+
const [touchEnd, setTouchEnd] = (0, import_react58.useState)(
|
|
13262
13509
|
null
|
|
13263
13510
|
);
|
|
13264
|
-
const [showImageViewer, setShowImageViewer] = (0,
|
|
13265
|
-
const [viewerKey, setViewerKey] = (0,
|
|
13266
|
-
const [isDragging, setIsDragging] = (0,
|
|
13267
|
-
const [dragOffset, setDragOffset] = (0,
|
|
13268
|
-
const [isTransitioning, setIsTransitioning] = (0,
|
|
13269
|
-
const [isHorizontalSwipe, setIsHorizontalSwipe] = (0,
|
|
13511
|
+
const [showImageViewer, setShowImageViewer] = (0, import_react58.useState)(false);
|
|
13512
|
+
const [viewerKey, setViewerKey] = (0, import_react58.useState)(0);
|
|
13513
|
+
const [isDragging, setIsDragging] = (0, import_react58.useState)(false);
|
|
13514
|
+
const [dragOffset, setDragOffset] = (0, import_react58.useState)(0);
|
|
13515
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react58.useState)(false);
|
|
13516
|
+
const [isHorizontalSwipe, setIsHorizontalSwipe] = (0, import_react58.useState)(
|
|
13270
13517
|
null
|
|
13271
13518
|
);
|
|
13272
|
-
const [isPeeking, setIsPeeking] = (0,
|
|
13273
|
-
const [isPeekReturning, setIsPeekReturning] = (0,
|
|
13274
|
-
const carouselRef = (0,
|
|
13275
|
-
const indicatorRef = (0,
|
|
13276
|
-
const touchStartRef = (0,
|
|
13519
|
+
const [isPeeking, setIsPeeking] = (0, import_react58.useState)(false);
|
|
13520
|
+
const [isPeekReturning, setIsPeekReturning] = (0, import_react58.useState)(false);
|
|
13521
|
+
const carouselRef = (0, import_react58.useRef)(null);
|
|
13522
|
+
const indicatorRef = (0, import_react58.useRef)(null);
|
|
13523
|
+
const touchStartRef = (0, import_react58.useRef)(
|
|
13277
13524
|
null
|
|
13278
13525
|
);
|
|
13279
|
-
const horizontalGestureRef = (0,
|
|
13280
|
-
const hasShownPeekRef = (0,
|
|
13281
|
-
const hasSwipedThisSessionRef = (0,
|
|
13282
|
-
const generatedUrlsRef = (0,
|
|
13283
|
-
const prevArtworkSrcRef = (0,
|
|
13284
|
-
(0,
|
|
13526
|
+
const horizontalGestureRef = (0, import_react58.useRef)(false);
|
|
13527
|
+
const hasShownPeekRef = (0, import_react58.useRef)(false);
|
|
13528
|
+
const hasSwipedThisSessionRef = (0, import_react58.useRef)(false);
|
|
13529
|
+
const generatedUrlsRef = (0, import_react58.useRef)(/* @__PURE__ */ new Map());
|
|
13530
|
+
const prevArtworkSrcRef = (0, import_react58.useRef)(currentArtwork?.src);
|
|
13531
|
+
(0, import_react58.useEffect)(() => {
|
|
13285
13532
|
if (currentArtwork?.src !== prevArtworkSrcRef.current) {
|
|
13286
13533
|
generatedUrlsRef.current.clear();
|
|
13287
13534
|
prevArtworkSrcRef.current = currentArtwork?.src;
|
|
13288
13535
|
}
|
|
13289
13536
|
}, [currentArtwork?.src]);
|
|
13290
|
-
const onMockupUrlGeneratedRef = (0,
|
|
13537
|
+
const onMockupUrlGeneratedRef = (0, import_react58.useRef)(onMockupUrlGenerated);
|
|
13291
13538
|
onMockupUrlGeneratedRef.current = onMockupUrlGenerated;
|
|
13292
|
-
const handleUrlGenerated = (0,
|
|
13539
|
+
const handleUrlGenerated = (0, import_react58.useCallback)((mockupId, url) => {
|
|
13293
13540
|
generatedUrlsRef.current.set(mockupId, url);
|
|
13294
13541
|
onMockupUrlGeneratedRef.current?.(mockupId, url);
|
|
13295
13542
|
}, []);
|
|
@@ -13297,24 +13544,24 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13297
13544
|
const shouldHideDots = stickyHeroContext?.shouldHideDots ?? false;
|
|
13298
13545
|
const priorityContext = useMockupPriorityOptional();
|
|
13299
13546
|
const realtimeContext = useRealtimeOptional();
|
|
13300
|
-
const [urlUpdateCounter, setUrlUpdateCounter] = (0,
|
|
13301
|
-
(0,
|
|
13547
|
+
const [urlUpdateCounter, setUrlUpdateCounter] = (0, import_react58.useState)(0);
|
|
13548
|
+
(0, import_react58.useEffect)(() => {
|
|
13302
13549
|
if (!realtimeContext?.subscribeMockupResults) return;
|
|
13303
13550
|
const unsubscribe = realtimeContext.subscribeMockupResults(() => {
|
|
13304
13551
|
setUrlUpdateCounter((c) => c + 1);
|
|
13305
13552
|
});
|
|
13306
13553
|
return unsubscribe;
|
|
13307
13554
|
}, [realtimeContext?.subscribeMockupResults]);
|
|
13308
|
-
const mockupIds = (0,
|
|
13555
|
+
const mockupIds = (0, import_react58.useMemo)(() => {
|
|
13309
13556
|
return images.filter((img) => img.isRealMockup && img.mockupId).map((img) => img.mockupId);
|
|
13310
13557
|
}, [images]);
|
|
13311
|
-
const realtimeMockupUrls = (0,
|
|
13558
|
+
const realtimeMockupUrls = (0, import_react58.useMemo)(() => {
|
|
13312
13559
|
if (!realtimeContext?.getMockupUrls || mockupIds.length === 0) {
|
|
13313
13560
|
return {};
|
|
13314
13561
|
}
|
|
13315
13562
|
return realtimeContext.getMockupUrls(mockupIds);
|
|
13316
13563
|
}, [realtimeContext?.getMockupUrls, mockupIds, urlUpdateCounter]);
|
|
13317
|
-
const imagesWithRealtimeUrls = (0,
|
|
13564
|
+
const imagesWithRealtimeUrls = (0, import_react58.useMemo)(() => {
|
|
13318
13565
|
return images.map((img) => {
|
|
13319
13566
|
if (img.isRealMockup && img.mockupId && realtimeMockupUrls[img.mockupId]) {
|
|
13320
13567
|
return {
|
|
@@ -13326,10 +13573,10 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13326
13573
|
});
|
|
13327
13574
|
}, [images, realtimeMockupUrls]);
|
|
13328
13575
|
const minSwipeDistance = 50;
|
|
13329
|
-
(0,
|
|
13576
|
+
(0, import_react58.useEffect)(() => {
|
|
13330
13577
|
setActiveIndex(currentIndex);
|
|
13331
13578
|
}, [currentIndex]);
|
|
13332
|
-
(0,
|
|
13579
|
+
(0, import_react58.useEffect)(() => {
|
|
13333
13580
|
if (!priorityContext) return;
|
|
13334
13581
|
const realMockups = images.map((img, idx) => ({ img, originalIdx: idx })).filter(({ img }) => img.isRealMockup && img.mockupId);
|
|
13335
13582
|
const mockupIdsList = realMockups.map(({ img }) => img.mockupId);
|
|
@@ -13357,7 +13604,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13357
13604
|
priorityContext.clearMobileCarouselMode?.();
|
|
13358
13605
|
};
|
|
13359
13606
|
}, [priorityContext, activeIndex, images]);
|
|
13360
|
-
(0,
|
|
13607
|
+
(0, import_react58.useEffect)(() => {
|
|
13361
13608
|
const indicator = indicatorRef.current;
|
|
13362
13609
|
if (!indicator) return;
|
|
13363
13610
|
let ticking = false;
|
|
@@ -13398,7 +13645,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13398
13645
|
}, []);
|
|
13399
13646
|
const SWIPE_TRACKING_KEY = "carousel-swipe-tracking";
|
|
13400
13647
|
const PDP_VIEWS_BEFORE_PEEK = 10;
|
|
13401
|
-
const getSwipeTracking = (0,
|
|
13648
|
+
const getSwipeTracking = (0, import_react58.useCallback)(() => {
|
|
13402
13649
|
try {
|
|
13403
13650
|
const stored = localStorage.getItem(SWIPE_TRACKING_KEY);
|
|
13404
13651
|
if (stored) {
|
|
@@ -13408,7 +13655,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13408
13655
|
}
|
|
13409
13656
|
return { viewsWithoutSwipe: 0, hasEverSwiped: false };
|
|
13410
13657
|
}, []);
|
|
13411
|
-
const recordSwipe = (0,
|
|
13658
|
+
const recordSwipe = (0, import_react58.useCallback)(() => {
|
|
13412
13659
|
if (hasSwipedThisSessionRef.current) return;
|
|
13413
13660
|
hasSwipedThisSessionRef.current = true;
|
|
13414
13661
|
try {
|
|
@@ -13422,7 +13669,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13422
13669
|
} catch {
|
|
13423
13670
|
}
|
|
13424
13671
|
}, []);
|
|
13425
|
-
(0,
|
|
13672
|
+
(0, import_react58.useEffect)(() => {
|
|
13426
13673
|
if (!enablePeekAnimation || images.length <= 1) return;
|
|
13427
13674
|
const tracking = getSwipeTracking();
|
|
13428
13675
|
const newViewCount = tracking.viewsWithoutSwipe + 1;
|
|
@@ -13463,14 +13710,14 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13463
13710
|
clearTimeout(clearTimeout_);
|
|
13464
13711
|
};
|
|
13465
13712
|
}, [images.length, getSwipeTracking, enablePeekAnimation]);
|
|
13466
|
-
const wasTapRef = (0,
|
|
13467
|
-
const handleImageTap = (0,
|
|
13713
|
+
const wasTapRef = (0, import_react58.useRef)(false);
|
|
13714
|
+
const handleImageTap = (0, import_react58.useCallback)(() => {
|
|
13468
13715
|
if (!enableZoom) return;
|
|
13469
13716
|
setViewerKey((prev) => prev + 1);
|
|
13470
13717
|
setShowImageViewer(true);
|
|
13471
13718
|
onZoomChange?.(true);
|
|
13472
13719
|
}, [enableZoom, onZoomChange]);
|
|
13473
|
-
const calculateDragOffset = (0,
|
|
13720
|
+
const calculateDragOffset = (0, import_react58.useCallback)(
|
|
13474
13721
|
(startX, currentX, containerWidth) => {
|
|
13475
13722
|
const distance = startX - currentX;
|
|
13476
13723
|
const offsetPercent = distance / containerWidth * 100;
|
|
@@ -13495,7 +13742,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13495
13742
|
},
|
|
13496
13743
|
[activeIndex, images.length]
|
|
13497
13744
|
);
|
|
13498
|
-
const handleSwipeEnd = (0,
|
|
13745
|
+
const handleSwipeEnd = (0, import_react58.useCallback)(
|
|
13499
13746
|
(startX, endX, containerWidth) => {
|
|
13500
13747
|
const distance = startX - endX;
|
|
13501
13748
|
const distancePercent = Math.abs(distance) / containerWidth * 100;
|
|
@@ -13526,7 +13773,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13526
13773
|
},
|
|
13527
13774
|
[activeIndex, images.length, onIndexChange, recordSwipe]
|
|
13528
13775
|
);
|
|
13529
|
-
(0,
|
|
13776
|
+
(0, import_react58.useEffect)(() => {
|
|
13530
13777
|
const container = carouselRef.current;
|
|
13531
13778
|
if (!container) return;
|
|
13532
13779
|
const handleTouchStart = (e) => {
|
|
@@ -13615,11 +13862,11 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13615
13862
|
handleSwipeEnd,
|
|
13616
13863
|
handleImageTap
|
|
13617
13864
|
]);
|
|
13618
|
-
const mouseStartRef = (0,
|
|
13865
|
+
const mouseStartRef = (0, import_react58.useRef)(
|
|
13619
13866
|
null
|
|
13620
13867
|
);
|
|
13621
|
-
const isMouseDraggingRef = (0,
|
|
13622
|
-
(0,
|
|
13868
|
+
const isMouseDraggingRef = (0, import_react58.useRef)(false);
|
|
13869
|
+
(0, import_react58.useEffect)(() => {
|
|
13623
13870
|
const container = carouselRef.current;
|
|
13624
13871
|
if (!container) return;
|
|
13625
13872
|
const handleMouseDown = (e) => {
|
|
@@ -13695,7 +13942,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13695
13942
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
13696
13943
|
};
|
|
13697
13944
|
}, [calculateDragOffset, handleSwipeEnd, handleImageTap]);
|
|
13698
|
-
const goToSlide = (0,
|
|
13945
|
+
const goToSlide = (0, import_react58.useCallback)(
|
|
13699
13946
|
(index, withTransition = true) => {
|
|
13700
13947
|
if (withTransition) {
|
|
13701
13948
|
setIsTransitioning(true);
|
|
@@ -13713,16 +13960,16 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13713
13960
|
},
|
|
13714
13961
|
[onIndexChange]
|
|
13715
13962
|
);
|
|
13716
|
-
(0,
|
|
13963
|
+
(0, import_react58.useEffect)(() => {
|
|
13717
13964
|
if (stickyHeroContext?.setCarouselIndicator && images.length > 1) {
|
|
13718
|
-
const indicator = /* @__PURE__ */ (0,
|
|
13965
|
+
const indicator = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13719
13966
|
"div",
|
|
13720
13967
|
{
|
|
13721
13968
|
className: "w-full",
|
|
13722
13969
|
role: "group",
|
|
13723
13970
|
"aria-label": "Product image navigation",
|
|
13724
|
-
children: /* @__PURE__ */ (0,
|
|
13725
|
-
/* @__PURE__ */ (0,
|
|
13971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative h-1", children: [
|
|
13972
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex h-full", children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13726
13973
|
"button",
|
|
13727
13974
|
{
|
|
13728
13975
|
onClick: () => goToSlide(index),
|
|
@@ -13732,7 +13979,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13732
13979
|
},
|
|
13733
13980
|
index
|
|
13734
13981
|
)) }),
|
|
13735
|
-
/* @__PURE__ */ (0,
|
|
13982
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13736
13983
|
"div",
|
|
13737
13984
|
{
|
|
13738
13985
|
className: "absolute top-0 h-full bg-primary transition-all duration-300 ease-out",
|
|
@@ -13755,10 +14002,10 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13755
14002
|
};
|
|
13756
14003
|
}, [activeIndex, images.length, goToSlide, stickyHeroContext]);
|
|
13757
14004
|
if (!images || images.length === 0) {
|
|
13758
|
-
return /* @__PURE__ */ (0,
|
|
14005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full aspect-video bg-muted rounded-lg" });
|
|
13759
14006
|
}
|
|
13760
|
-
return /* @__PURE__ */ (0,
|
|
13761
|
-
/* @__PURE__ */ (0,
|
|
14007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: `relative w-full h-full ${className}`, "data-gallery": "product", "data-gallery-skipped": skippedStamp, children: [
|
|
14008
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13762
14009
|
"div",
|
|
13763
14010
|
{
|
|
13764
14011
|
ref: carouselRef,
|
|
@@ -13776,7 +14023,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13776
14023
|
role: "region",
|
|
13777
14024
|
"aria-roledescription": "carousel",
|
|
13778
14025
|
"aria-label": "Product images",
|
|
13779
|
-
children: /* @__PURE__ */ (0,
|
|
14026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13780
14027
|
"div",
|
|
13781
14028
|
{
|
|
13782
14029
|
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)]" : ""}`,
|
|
@@ -13786,7 +14033,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13786
14033
|
children: images.map((image, index) => {
|
|
13787
14034
|
const DECODE_WINDOW = 1;
|
|
13788
14035
|
const isWithinDecodeWindow = Math.abs(index - activeIndex) <= DECODE_WINDOW;
|
|
13789
|
-
return /* @__PURE__ */ (0,
|
|
14036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
13790
14037
|
"div",
|
|
13791
14038
|
{
|
|
13792
14039
|
className: "w-full h-full flex-shrink-0 relative select-none",
|
|
@@ -13794,11 +14041,11 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13794
14041
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13795
14042
|
...slideFirstViewProps(image.isRealMockup ? image : {}),
|
|
13796
14043
|
children: [
|
|
13797
|
-
!isWithinDecodeWindow ? /* @__PURE__ */ (0,
|
|
14044
|
+
!isWithinDecodeWindow ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13798
14045
|
// Rainbow prism loader (same as the /create route) instead of
|
|
13799
14046
|
// a flat pulse; fills this relative slide via inset:0.
|
|
13800
|
-
/* @__PURE__ */ (0,
|
|
13801
|
-
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0,
|
|
14047
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" })
|
|
14048
|
+
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13802
14049
|
HeroProductImage,
|
|
13803
14050
|
{
|
|
13804
14051
|
productId,
|
|
@@ -13815,7 +14062,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13815
14062
|
viewportPolicy: true,
|
|
13816
14063
|
fit: slideFit(image.galleryRole)
|
|
13817
14064
|
}
|
|
13818
|
-
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0,
|
|
14065
|
+
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13819
14066
|
StaticCarouselImage,
|
|
13820
14067
|
{
|
|
13821
14068
|
src: image.src,
|
|
@@ -13825,7 +14072,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13825
14072
|
),
|
|
13826
14073
|
isWithinDecodeWindow && (() => {
|
|
13827
14074
|
const action = renderImageAction?.(image, index);
|
|
13828
|
-
return action ? /* @__PURE__ */ (0,
|
|
14075
|
+
return action ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13829
14076
|
"div",
|
|
13830
14077
|
{
|
|
13831
14078
|
className: "absolute top-3 right-3 z-10",
|
|
@@ -13839,14 +14086,14 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13839
14086
|
})()
|
|
13840
14087
|
]
|
|
13841
14088
|
},
|
|
13842
|
-
index
|
|
14089
|
+
image.mockupId ? `m:${image.mockupId}` : `i:${index}`
|
|
13843
14090
|
);
|
|
13844
14091
|
})
|
|
13845
14092
|
}
|
|
13846
14093
|
)
|
|
13847
14094
|
}
|
|
13848
14095
|
),
|
|
13849
|
-
showIndicators && images.length > 1 && /* @__PURE__ */ (0,
|
|
14096
|
+
showIndicators && images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13850
14097
|
"div",
|
|
13851
14098
|
{
|
|
13852
14099
|
ref: indicatorRef,
|
|
@@ -13854,8 +14101,8 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13854
14101
|
className: "relative z-20 w-full",
|
|
13855
14102
|
role: "group",
|
|
13856
14103
|
"aria-label": "Product image navigation",
|
|
13857
|
-
children: /* @__PURE__ */ (0,
|
|
13858
|
-
/* @__PURE__ */ (0,
|
|
14104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative h-1", children: [
|
|
14105
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex h-full absolute inset-0", children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13859
14106
|
"button",
|
|
13860
14107
|
{
|
|
13861
14108
|
onClick: () => goToSlide(index),
|
|
@@ -13865,7 +14112,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13865
14112
|
},
|
|
13866
14113
|
index
|
|
13867
14114
|
)) }),
|
|
13868
|
-
/* @__PURE__ */ (0,
|
|
14115
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13869
14116
|
"div",
|
|
13870
14117
|
{
|
|
13871
14118
|
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"}`,
|
|
@@ -13898,10 +14145,12 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13898
14145
|
alt: img.label,
|
|
13899
14146
|
naturalWidth: img.naturalWidth,
|
|
13900
14147
|
naturalHeight: img.naturalHeight,
|
|
13901
|
-
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {}
|
|
14148
|
+
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {},
|
|
14149
|
+
// the viewer opens on the product by the hero's first-view rule (EnhancedImageViewer viewerFirstView)
|
|
14150
|
+
...slideFirstViewFields(img)
|
|
13902
14151
|
} : null;
|
|
13903
14152
|
}).filter((img) => img !== null);
|
|
13904
|
-
return /* @__PURE__ */ (0,
|
|
14153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13905
14154
|
EnhancedImageViewer,
|
|
13906
14155
|
{
|
|
13907
14156
|
imageUrl,
|
|
@@ -13940,8 +14189,8 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13940
14189
|
});
|
|
13941
14190
|
|
|
13942
14191
|
// src/composed/carousels/HeroCarousel.tsx
|
|
13943
|
-
var
|
|
13944
|
-
var
|
|
14192
|
+
var import_react59 = require("react");
|
|
14193
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
13945
14194
|
function HeroCarousel({
|
|
13946
14195
|
images,
|
|
13947
14196
|
currentIndex = 0,
|
|
@@ -13951,16 +14200,16 @@ function HeroCarousel({
|
|
|
13951
14200
|
productId,
|
|
13952
14201
|
onImageTap
|
|
13953
14202
|
}) {
|
|
13954
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
13955
|
-
const containerRef = (0,
|
|
13956
|
-
const touchStartRef = (0,
|
|
14203
|
+
const [activeIndex, setActiveIndex] = (0, import_react59.useState)(currentIndex);
|
|
14204
|
+
const containerRef = (0, import_react59.useRef)(null);
|
|
14205
|
+
const touchStartRef = (0, import_react59.useRef)(
|
|
13957
14206
|
null
|
|
13958
14207
|
);
|
|
13959
|
-
const isSwipingRef = (0,
|
|
13960
|
-
(0,
|
|
14208
|
+
const isSwipingRef = (0, import_react59.useRef)(false);
|
|
14209
|
+
(0, import_react59.useEffect)(() => {
|
|
13961
14210
|
setActiveIndex(currentIndex);
|
|
13962
14211
|
}, [currentIndex]);
|
|
13963
|
-
const goToSlide = (0,
|
|
14212
|
+
const goToSlide = (0, import_react59.useCallback)(
|
|
13964
14213
|
(index) => {
|
|
13965
14214
|
const clampedIndex = Math.max(0, Math.min(images.length - 1, index));
|
|
13966
14215
|
setActiveIndex(clampedIndex);
|
|
@@ -13968,7 +14217,7 @@ function HeroCarousel({
|
|
|
13968
14217
|
},
|
|
13969
14218
|
[images.length, onIndexChange]
|
|
13970
14219
|
);
|
|
13971
|
-
(0,
|
|
14220
|
+
(0, import_react59.useEffect)(() => {
|
|
13972
14221
|
const container = containerRef.current;
|
|
13973
14222
|
if (!container) return;
|
|
13974
14223
|
const handleTouchStart = (e) => {
|
|
@@ -14020,9 +14269,9 @@ function HeroCarousel({
|
|
|
14020
14269
|
};
|
|
14021
14270
|
}, [activeIndex, images.length, goToSlide, onImageTap]);
|
|
14022
14271
|
if (!images || images.length === 0) {
|
|
14023
|
-
return /* @__PURE__ */ (0,
|
|
14272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "w-full h-full bg-muted" });
|
|
14024
14273
|
}
|
|
14025
|
-
return /* @__PURE__ */ (0,
|
|
14274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14026
14275
|
"div",
|
|
14027
14276
|
{
|
|
14028
14277
|
ref: containerRef,
|
|
@@ -14033,7 +14282,7 @@ function HeroCarousel({
|
|
|
14033
14282
|
overflow: "hidden"
|
|
14034
14283
|
},
|
|
14035
14284
|
children: [
|
|
14036
|
-
/* @__PURE__ */ (0,
|
|
14285
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14037
14286
|
"div",
|
|
14038
14287
|
{
|
|
14039
14288
|
className: "flex h-full transition-transform duration-300 ease-out",
|
|
@@ -14044,14 +14293,14 @@ function HeroCarousel({
|
|
|
14044
14293
|
backfaceVisibility: "hidden",
|
|
14045
14294
|
WebkitBackfaceVisibility: "hidden"
|
|
14046
14295
|
},
|
|
14047
|
-
children: images.map((image, index) => /* @__PURE__ */ (0,
|
|
14296
|
+
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14048
14297
|
"div",
|
|
14049
14298
|
{
|
|
14050
14299
|
className: "w-full h-full flex-shrink-0",
|
|
14051
14300
|
style: {
|
|
14052
14301
|
contain: "layout paint"
|
|
14053
14302
|
},
|
|
14054
|
-
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0,
|
|
14303
|
+
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14055
14304
|
HeroProductImage,
|
|
14056
14305
|
{
|
|
14057
14306
|
productId,
|
|
@@ -14060,7 +14309,7 @@ function HeroCarousel({
|
|
|
14060
14309
|
mockupId: image.mockupId,
|
|
14061
14310
|
className: "w-full h-full object-cover"
|
|
14062
14311
|
}
|
|
14063
|
-
) : /* @__PURE__ */ (0,
|
|
14312
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14064
14313
|
"img",
|
|
14065
14314
|
{
|
|
14066
14315
|
src: image.src,
|
|
@@ -14077,12 +14326,12 @@ function HeroCarousel({
|
|
|
14077
14326
|
))
|
|
14078
14327
|
}
|
|
14079
14328
|
),
|
|
14080
|
-
images.length > 1 && /* @__PURE__ */ (0,
|
|
14329
|
+
images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14081
14330
|
"div",
|
|
14082
14331
|
{
|
|
14083
14332
|
className: "absolute bottom-4 left-0 right-0 flex justify-center gap-2 z-10",
|
|
14084
14333
|
style: { contain: "layout style" },
|
|
14085
|
-
children: images.map((_, index) => /* @__PURE__ */ (0,
|
|
14334
|
+
children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14086
14335
|
"button",
|
|
14087
14336
|
{
|
|
14088
14337
|
onClick: () => goToSlide(index),
|
|
@@ -14099,8 +14348,8 @@ function HeroCarousel({
|
|
|
14099
14348
|
}
|
|
14100
14349
|
|
|
14101
14350
|
// src/composed/grids/MasonryGrid.tsx
|
|
14102
|
-
var
|
|
14103
|
-
var
|
|
14351
|
+
var import_react60 = require("react");
|
|
14352
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14104
14353
|
var BREAKPOINTS = {
|
|
14105
14354
|
sm: 640,
|
|
14106
14355
|
md: 768,
|
|
@@ -14152,13 +14401,13 @@ function MasonryGrid({
|
|
|
14152
14401
|
className = "",
|
|
14153
14402
|
emptyContent
|
|
14154
14403
|
}) {
|
|
14155
|
-
const [columnCount, setColumnCount] = (0,
|
|
14404
|
+
const [columnCount, setColumnCount] = (0, import_react60.useState)(
|
|
14156
14405
|
() => typeof columns === "number" ? columns : getColumnCount(
|
|
14157
14406
|
typeof window !== "undefined" ? window.innerWidth : 1024,
|
|
14158
14407
|
columns
|
|
14159
14408
|
)
|
|
14160
14409
|
);
|
|
14161
|
-
(0,
|
|
14410
|
+
(0, import_react60.useEffect)(() => {
|
|
14162
14411
|
const updateColumnCount = () => {
|
|
14163
14412
|
setColumnCount(getColumnCount(window.innerWidth, columns));
|
|
14164
14413
|
};
|
|
@@ -14166,30 +14415,30 @@ function MasonryGrid({
|
|
|
14166
14415
|
window.addEventListener("resize", updateColumnCount);
|
|
14167
14416
|
return () => window.removeEventListener("resize", updateColumnCount);
|
|
14168
14417
|
}, [columns]);
|
|
14169
|
-
const distributedColumns = (0,
|
|
14418
|
+
const distributedColumns = (0, import_react60.useMemo)(
|
|
14170
14419
|
() => distributeItems(items, columnCount),
|
|
14171
14420
|
[items, columnCount]
|
|
14172
14421
|
);
|
|
14173
14422
|
if (items.length === 0) {
|
|
14174
14423
|
if (emptyContent) {
|
|
14175
|
-
return /* @__PURE__ */ (0,
|
|
14424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: emptyContent });
|
|
14176
14425
|
}
|
|
14177
14426
|
return null;
|
|
14178
14427
|
}
|
|
14179
|
-
return /* @__PURE__ */ (0,
|
|
14428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14180
14429
|
"div",
|
|
14181
14430
|
{
|
|
14182
14431
|
className: `flex ${className}`,
|
|
14183
14432
|
style: { gap: `${gap}px` },
|
|
14184
14433
|
role: "list",
|
|
14185
|
-
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ (0,
|
|
14434
|
+
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14186
14435
|
"div",
|
|
14187
14436
|
{
|
|
14188
14437
|
className: "flex-1 flex flex-col",
|
|
14189
14438
|
style: { gap: `${gap}px` },
|
|
14190
14439
|
children: columnItems.map((item, itemIndex) => {
|
|
14191
14440
|
const originalIndex = itemIndex * columnCount + columnIndex;
|
|
14192
|
-
return /* @__PURE__ */ (0,
|
|
14441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { role: "listitem", children: renderItem(item, originalIndex) }, originalIndex);
|
|
14193
14442
|
})
|
|
14194
14443
|
},
|
|
14195
14444
|
columnIndex
|
|
@@ -14202,7 +14451,7 @@ function MasonryGrid({
|
|
|
14202
14451
|
init_dev_warnings();
|
|
14203
14452
|
|
|
14204
14453
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
14205
|
-
var
|
|
14454
|
+
var import_react62 = require("react");
|
|
14206
14455
|
|
|
14207
14456
|
// src/layouts/hero-zoom/types.ts
|
|
14208
14457
|
var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
@@ -14214,19 +14463,19 @@ var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
|
14214
14463
|
};
|
|
14215
14464
|
|
|
14216
14465
|
// src/layouts/hero-zoom/useHeroZoomScales.ts
|
|
14217
|
-
var
|
|
14466
|
+
var import_react61 = require("react");
|
|
14218
14467
|
function useHeroZoomScales(config = {}) {
|
|
14219
14468
|
const { initialScale, accountForRetina, maxRetinaMultiplier } = {
|
|
14220
14469
|
...DEFAULT_HERO_ZOOM_CONFIG,
|
|
14221
14470
|
...config
|
|
14222
14471
|
};
|
|
14223
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
14472
|
+
const [isHydrated, setIsHydrated] = (0, import_react61.useState)(false);
|
|
14224
14473
|
const ssrMultiplier = accountForRetina ? maxRetinaMultiplier : 2;
|
|
14225
|
-
const [scales, setScales] = (0,
|
|
14474
|
+
const [scales, setScales] = (0, import_react61.useState)(() => ({
|
|
14226
14475
|
visual: initialScale,
|
|
14227
14476
|
render: initialScale * ssrMultiplier
|
|
14228
14477
|
}));
|
|
14229
|
-
const calculateScales = (0,
|
|
14478
|
+
const calculateScales = (0, import_react61.useCallback)(() => {
|
|
14230
14479
|
const visualScale = Math.max(1, Math.min(4, initialScale));
|
|
14231
14480
|
let renderScale;
|
|
14232
14481
|
if (accountForRetina) {
|
|
@@ -14241,7 +14490,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
14241
14490
|
renderScale = Math.max(1, Math.min(8, renderScale));
|
|
14242
14491
|
return { visual: visualScale, render: renderScale };
|
|
14243
14492
|
}, [initialScale, accountForRetina, maxRetinaMultiplier]);
|
|
14244
|
-
(0,
|
|
14493
|
+
(0, import_react61.useEffect)(() => {
|
|
14245
14494
|
const supportsScrollTimeline = CSS.supports(
|
|
14246
14495
|
"animation-timeline",
|
|
14247
14496
|
"scroll()"
|
|
@@ -14291,7 +14540,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
14291
14540
|
}
|
|
14292
14541
|
|
|
14293
14542
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
14294
|
-
var
|
|
14543
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14295
14544
|
function HeroZoomLayout({
|
|
14296
14545
|
config = {},
|
|
14297
14546
|
header,
|
|
@@ -14306,9 +14555,9 @@ function HeroZoomLayout({
|
|
|
14306
14555
|
};
|
|
14307
14556
|
const { aspectRatio, initialScale, headerHeight } = mergedConfig;
|
|
14308
14557
|
const { visual, render, isHydrated } = useHeroZoomScales(mergedConfig);
|
|
14309
|
-
const imageContainerRef = (0,
|
|
14310
|
-
const headerRef = (0,
|
|
14311
|
-
(0,
|
|
14558
|
+
const imageContainerRef = (0, import_react62.useRef)(null);
|
|
14559
|
+
const headerRef = (0, import_react62.useRef)(null);
|
|
14560
|
+
(0, import_react62.useEffect)(() => {
|
|
14312
14561
|
if (typeof window === "undefined") return;
|
|
14313
14562
|
const originalRestoration = "scrollRestoration" in history ? history.scrollRestoration : "auto";
|
|
14314
14563
|
if ("scrollRestoration" in history) {
|
|
@@ -14321,7 +14570,7 @@ function HeroZoomLayout({
|
|
|
14321
14570
|
}
|
|
14322
14571
|
};
|
|
14323
14572
|
}, []);
|
|
14324
|
-
(0,
|
|
14573
|
+
(0, import_react62.useEffect)(() => {
|
|
14325
14574
|
const supportsScrollTimeline = CSS.supports(
|
|
14326
14575
|
"animation-timeline",
|
|
14327
14576
|
"scroll()"
|
|
@@ -14450,7 +14699,7 @@ function HeroZoomLayout({
|
|
|
14450
14699
|
The drawer covers the hero completely, so let animation run continuously. */
|
|
14451
14700
|
}
|
|
14452
14701
|
`;
|
|
14453
|
-
return /* @__PURE__ */ (0,
|
|
14702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14454
14703
|
"div",
|
|
14455
14704
|
{
|
|
14456
14705
|
className: `relative min-h-screen ${className}`,
|
|
@@ -14464,8 +14713,8 @@ function HeroZoomLayout({
|
|
|
14464
14713
|
"--hero-zoom-final-transform": 1 / activeRender
|
|
14465
14714
|
},
|
|
14466
14715
|
children: [
|
|
14467
|
-
/* @__PURE__ */ (0,
|
|
14468
|
-
/* @__PURE__ */ (0,
|
|
14716
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14717
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14469
14718
|
"div",
|
|
14470
14719
|
{
|
|
14471
14720
|
style: {
|
|
@@ -14473,7 +14722,7 @@ function HeroZoomLayout({
|
|
|
14473
14722
|
}
|
|
14474
14723
|
}
|
|
14475
14724
|
),
|
|
14476
|
-
header && /* @__PURE__ */ (0,
|
|
14725
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14477
14726
|
"div",
|
|
14478
14727
|
{
|
|
14479
14728
|
ref: headerRef,
|
|
@@ -14486,7 +14735,7 @@ function HeroZoomLayout({
|
|
|
14486
14735
|
children: header
|
|
14487
14736
|
}
|
|
14488
14737
|
),
|
|
14489
|
-
/* @__PURE__ */ (0,
|
|
14738
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14490
14739
|
"div",
|
|
14491
14740
|
{
|
|
14492
14741
|
ref: imageContainerRef,
|
|
@@ -14506,15 +14755,15 @@ function HeroZoomLayout({
|
|
|
14506
14755
|
children: hero
|
|
14507
14756
|
}
|
|
14508
14757
|
),
|
|
14509
|
-
/* @__PURE__ */ (0,
|
|
14758
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "relative z-10", children })
|
|
14510
14759
|
]
|
|
14511
14760
|
}
|
|
14512
14761
|
);
|
|
14513
14762
|
}
|
|
14514
14763
|
|
|
14515
14764
|
// src/layouts/hero-zoom/HeroShrinkLayout.tsx
|
|
14516
|
-
var
|
|
14517
|
-
var
|
|
14765
|
+
var import_react63 = require("react");
|
|
14766
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14518
14767
|
var DEFAULT_CONFIG = {
|
|
14519
14768
|
aspectRatio: 16 / 9,
|
|
14520
14769
|
initialHeightPercent: 70,
|
|
@@ -14534,13 +14783,13 @@ function HeroShrinkLayout({
|
|
|
14534
14783
|
...config
|
|
14535
14784
|
};
|
|
14536
14785
|
const { aspectRatio, initialHeightPercent, minHeightPercent, headerHeight } = mergedConfig;
|
|
14537
|
-
const heroRef = (0,
|
|
14538
|
-
const headerRef = (0,
|
|
14539
|
-
const [isClient, setIsClient] = (0,
|
|
14540
|
-
(0,
|
|
14786
|
+
const heroRef = (0, import_react63.useRef)(null);
|
|
14787
|
+
const headerRef = (0, import_react63.useRef)(null);
|
|
14788
|
+
const [isClient, setIsClient] = (0, import_react63.useState)(false);
|
|
14789
|
+
(0, import_react63.useEffect)(() => {
|
|
14541
14790
|
setIsClient(true);
|
|
14542
14791
|
}, []);
|
|
14543
|
-
(0,
|
|
14792
|
+
(0, import_react63.useEffect)(() => {
|
|
14544
14793
|
if (!isClient) return;
|
|
14545
14794
|
const supportsScrollTimeline = CSS.supports("animation-timeline", "scroll()");
|
|
14546
14795
|
if (supportsScrollTimeline) return;
|
|
@@ -14627,15 +14876,15 @@ function HeroShrinkLayout({
|
|
|
14627
14876
|
}
|
|
14628
14877
|
`;
|
|
14629
14878
|
const spacerHeight = `calc(${initialHeightPercent}svh + ${headerHeight}px)`;
|
|
14630
|
-
return /* @__PURE__ */ (0,
|
|
14879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
14631
14880
|
"div",
|
|
14632
14881
|
{
|
|
14633
14882
|
className: `relative min-h-screen ${className}`,
|
|
14634
14883
|
style: { ...style, ...cssVars },
|
|
14635
14884
|
children: [
|
|
14636
|
-
/* @__PURE__ */ (0,
|
|
14637
|
-
/* @__PURE__ */ (0,
|
|
14638
|
-
header && /* @__PURE__ */ (0,
|
|
14885
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14886
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { style: { height: spacerHeight } }),
|
|
14887
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14639
14888
|
"div",
|
|
14640
14889
|
{
|
|
14641
14890
|
ref: headerRef,
|
|
@@ -14644,7 +14893,7 @@ function HeroShrinkLayout({
|
|
|
14644
14893
|
children: header
|
|
14645
14894
|
}
|
|
14646
14895
|
),
|
|
14647
|
-
/* @__PURE__ */ (0,
|
|
14896
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14648
14897
|
"div",
|
|
14649
14898
|
{
|
|
14650
14899
|
ref: heroRef,
|
|
@@ -14652,15 +14901,15 @@ function HeroShrinkLayout({
|
|
|
14652
14901
|
children: hero
|
|
14653
14902
|
}
|
|
14654
14903
|
),
|
|
14655
|
-
/* @__PURE__ */ (0,
|
|
14904
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "relative z-10 bg-background", children })
|
|
14656
14905
|
]
|
|
14657
14906
|
}
|
|
14658
14907
|
);
|
|
14659
14908
|
}
|
|
14660
14909
|
|
|
14661
14910
|
// src/layouts/pdp/ImageEdgeBlur.tsx
|
|
14662
|
-
var
|
|
14663
|
-
var
|
|
14911
|
+
var import_react64 = __toESM(require("react"), 1);
|
|
14912
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14664
14913
|
var BLUR_CONFIG = {
|
|
14665
14914
|
blur: 24,
|
|
14666
14915
|
crossfade: 68
|
|
@@ -14684,7 +14933,7 @@ var BLUR_LAYERS = [
|
|
|
14684
14933
|
{ blur: Math.round(BLUR_CONFIG.blur * 0.5), zone: 0.6 },
|
|
14685
14934
|
{ blur: BLUR_CONFIG.blur, zone: 1 }
|
|
14686
14935
|
];
|
|
14687
|
-
var ImageEdgeBlur =
|
|
14936
|
+
var ImageEdgeBlur = import_react64.default.memo(
|
|
14688
14937
|
function ImageEdgeBlur2({
|
|
14689
14938
|
imageSrc,
|
|
14690
14939
|
imageCapInfo,
|
|
@@ -14715,7 +14964,7 @@ var ImageEdgeBlur = import_react63.default.memo(
|
|
|
14715
14964
|
viewportWidth / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO,
|
|
14716
14965
|
maxWidthPx / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO
|
|
14717
14966
|
);
|
|
14718
|
-
return /* @__PURE__ */ (0,
|
|
14967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14719
14968
|
"div",
|
|
14720
14969
|
{
|
|
14721
14970
|
className: `absolute inset-0 pointer-events-none overflow-hidden ${className}`,
|
|
@@ -14723,7 +14972,7 @@ var ImageEdgeBlur = import_react63.default.memo(
|
|
|
14723
14972
|
children: BLUR_LAYERS.map((layer, index) => {
|
|
14724
14973
|
const layerMask = index === BLUR_LAYERS.length - 1 ? void 0 : `linear-gradient(to right, black 0%, black ${layer.zone * 100}%, transparent ${layer.zone * 100 + 10}%)`;
|
|
14725
14974
|
const blurScale = 1 + layer.blur * 3 / containerHeightPx;
|
|
14726
|
-
return /* @__PURE__ */ (0,
|
|
14975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14727
14976
|
"img",
|
|
14728
14977
|
{
|
|
14729
14978
|
src: imageSrc,
|
|
@@ -14770,7 +15019,7 @@ var ImageEdgeBlur = import_react63.default.memo(
|
|
|
14770
15019
|
);
|
|
14771
15020
|
|
|
14772
15021
|
// src/layouts/pdp/PDPLayout.tsx
|
|
14773
|
-
var
|
|
15022
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14774
15023
|
function PDPLayout({
|
|
14775
15024
|
renderHeroImage,
|
|
14776
15025
|
renderContent,
|
|
@@ -14798,15 +15047,15 @@ function PDPLayout({
|
|
|
14798
15047
|
isDesktop,
|
|
14799
15048
|
isWideMonitor: isWideMonitor2
|
|
14800
15049
|
};
|
|
14801
|
-
return /* @__PURE__ */ (0,
|
|
14802
|
-
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ (0,
|
|
14803
|
-
renderMobileCarousel && /* @__PURE__ */ (0,
|
|
14804
|
-
/* @__PURE__ */ (0,
|
|
15050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `pdp-layout ${className}`, children: [
|
|
15051
|
+
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "md:hidden", children: [
|
|
15052
|
+
renderMobileCarousel && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "mobile-carousel-container", children: renderMobileCarousel({ images: carouselImages }) }),
|
|
15053
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "mobile-content p-4", children: renderContent(contentProps) })
|
|
14805
15054
|
] }),
|
|
14806
|
-
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ (0,
|
|
14807
|
-
/* @__PURE__ */ (0,
|
|
15055
|
+
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "hidden md:block relative", children: [
|
|
15056
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "desktop-hero relative", children: [
|
|
14808
15057
|
renderHeroImage(heroProps),
|
|
14809
|
-
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ (0,
|
|
15058
|
+
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14810
15059
|
ImageEdgeBlur,
|
|
14811
15060
|
{
|
|
14812
15061
|
imageSrc: blurImageSrc,
|
|
@@ -14817,7 +15066,7 @@ function PDPLayout({
|
|
|
14817
15066
|
}
|
|
14818
15067
|
)
|
|
14819
15068
|
] }),
|
|
14820
|
-
/* @__PURE__ */ (0,
|
|
15069
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14821
15070
|
"div",
|
|
14822
15071
|
{
|
|
14823
15072
|
className: "desktop-sidebar",
|
|
@@ -14834,8 +15083,8 @@ function PDPLayout({
|
|
|
14834
15083
|
}
|
|
14835
15084
|
|
|
14836
15085
|
// src/layouts/pdp/SimpleImageBlur.tsx
|
|
14837
|
-
var
|
|
14838
|
-
var
|
|
15086
|
+
var import_react65 = __toESM(require("react"), 1);
|
|
15087
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14839
15088
|
var BLUR_CONFIG2 = {
|
|
14840
15089
|
blur: 24,
|
|
14841
15090
|
crossfade: 60
|
|
@@ -14858,7 +15107,7 @@ function getFadeInMask(crossfadeWidth) {
|
|
|
14858
15107
|
black ${crossfadeWidth + 10}px
|
|
14859
15108
|
)`;
|
|
14860
15109
|
}
|
|
14861
|
-
var SimpleImageBlur =
|
|
15110
|
+
var SimpleImageBlur = import_react65.default.memo(function SimpleImageBlur2({
|
|
14862
15111
|
imageSrc,
|
|
14863
15112
|
width,
|
|
14864
15113
|
height = "100%",
|
|
@@ -14868,7 +15117,7 @@ var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
|
14868
15117
|
if (!imageSrc || width <= 0) return null;
|
|
14869
15118
|
const fadeInMask = getFadeInMask(BLUR_CONFIG2.crossfade);
|
|
14870
15119
|
const extendedWidth = width + BLUR_CONFIG2.blur * 2;
|
|
14871
|
-
return /* @__PURE__ */ (0,
|
|
15120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14872
15121
|
"div",
|
|
14873
15122
|
{
|
|
14874
15123
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -14881,7 +15130,7 @@ var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
|
14881
15130
|
black 0%,
|
|
14882
15131
|
black ${layer.zone * 100}%,
|
|
14883
15132
|
transparent ${layer.zone * 100 + 10}%)`;
|
|
14884
|
-
return /* @__PURE__ */ (0,
|
|
15133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14885
15134
|
"img",
|
|
14886
15135
|
{
|
|
14887
15136
|
src: imageSrc,
|
|
@@ -14911,8 +15160,8 @@ var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
|
14911
15160
|
});
|
|
14912
15161
|
|
|
14913
15162
|
// src/layouts/pdp/EdgeBlurBox.tsx
|
|
14914
|
-
var
|
|
14915
|
-
var
|
|
15163
|
+
var import_react66 = __toESM(require("react"), 1);
|
|
15164
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14916
15165
|
var BLUR_CONFIG3 = {
|
|
14917
15166
|
blur: 24,
|
|
14918
15167
|
crossfade: 60
|
|
@@ -14936,7 +15185,7 @@ function getFadeOutMask(crossfadeWidth) {
|
|
|
14936
15185
|
transparent 100%
|
|
14937
15186
|
)`;
|
|
14938
15187
|
}
|
|
14939
|
-
var EdgeBlurBox =
|
|
15188
|
+
var EdgeBlurBox = import_react66.default.memo(function EdgeBlurBox2({
|
|
14940
15189
|
imageSrc,
|
|
14941
15190
|
width,
|
|
14942
15191
|
height = "100%",
|
|
@@ -14951,7 +15200,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
14951
15200
|
const blurExtend = BLUR_CONFIG3.blur * 2;
|
|
14952
15201
|
const actualSharpWidth = sharpImageWidth ?? width + overlapLeft;
|
|
14953
15202
|
const hasOverlap = overlapLeft > 0;
|
|
14954
|
-
return /* @__PURE__ */ (0,
|
|
15203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
14955
15204
|
"div",
|
|
14956
15205
|
{
|
|
14957
15206
|
className: `relative ${className}`,
|
|
@@ -14962,7 +15211,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
14962
15211
|
overflow: hasOverlap ? "visible" : "hidden"
|
|
14963
15212
|
},
|
|
14964
15213
|
children: [
|
|
14965
|
-
/* @__PURE__ */ (0,
|
|
15214
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
14966
15215
|
"div",
|
|
14967
15216
|
{
|
|
14968
15217
|
style: {
|
|
@@ -14976,7 +15225,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
14976
15225
|
transparent ${100 - (layer.zone * 100 + 10)}%,
|
|
14977
15226
|
black ${100 - layer.zone * 100}%,
|
|
14978
15227
|
black 100%)`;
|
|
14979
|
-
return /* @__PURE__ */ (0,
|
|
15228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
14980
15229
|
"img",
|
|
14981
15230
|
{
|
|
14982
15231
|
src: imageSrc,
|
|
@@ -15004,7 +15253,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15004
15253
|
})
|
|
15005
15254
|
}
|
|
15006
15255
|
),
|
|
15007
|
-
/* @__PURE__ */ (0,
|
|
15256
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
15008
15257
|
"img",
|
|
15009
15258
|
{
|
|
15010
15259
|
src: imageSrc,
|
|
@@ -15032,8 +15281,8 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15032
15281
|
});
|
|
15033
15282
|
|
|
15034
15283
|
// src/layouts/pdp/ImageBlurExtension.tsx
|
|
15035
|
-
var
|
|
15036
|
-
var
|
|
15284
|
+
var import_react67 = __toESM(require("react"), 1);
|
|
15285
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
15037
15286
|
var BLUR_CONFIG4 = {
|
|
15038
15287
|
blur: 24,
|
|
15039
15288
|
crossfadeWidth: 80
|
|
@@ -15056,7 +15305,7 @@ function getFadeOutMask2(crossfadeWidth) {
|
|
|
15056
15305
|
transparent 100%
|
|
15057
15306
|
)`;
|
|
15058
15307
|
}
|
|
15059
|
-
var ImageBlurExtension =
|
|
15308
|
+
var ImageBlurExtension = import_react67.default.memo(function ImageBlurExtension2({
|
|
15060
15309
|
imageSrc,
|
|
15061
15310
|
width,
|
|
15062
15311
|
height,
|
|
@@ -15070,7 +15319,7 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15070
15319
|
const internalImageLeft = `calc(${heroImageLeft} - 100vw + ${width}px)`;
|
|
15071
15320
|
const fadeOutMask = getFadeOutMask2(crossfadeWidth);
|
|
15072
15321
|
const heightValue = typeof height === "number" ? `${height}px` : height;
|
|
15073
|
-
return /* @__PURE__ */ (0,
|
|
15322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15074
15323
|
"div",
|
|
15075
15324
|
{
|
|
15076
15325
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -15079,7 +15328,7 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15079
15328
|
height: heightValue
|
|
15080
15329
|
},
|
|
15081
15330
|
children: [
|
|
15082
|
-
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ (0,
|
|
15331
|
+
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15083
15332
|
"img",
|
|
15084
15333
|
{
|
|
15085
15334
|
src: imageSrc,
|
|
@@ -15103,7 +15352,7 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15103
15352
|
},
|
|
15104
15353
|
`blur-${index}`
|
|
15105
15354
|
)),
|
|
15106
|
-
/* @__PURE__ */ (0,
|
|
15355
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15107
15356
|
"img",
|
|
15108
15357
|
{
|
|
15109
15358
|
src: imageSrc,
|
|
@@ -15131,39 +15380,39 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15131
15380
|
});
|
|
15132
15381
|
|
|
15133
15382
|
// src/design-system/ColorSwatch.tsx
|
|
15134
|
-
var
|
|
15383
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
15135
15384
|
function ColorTokenSwatch({ name, cssVar, className = "" }) {
|
|
15136
|
-
return /* @__PURE__ */ (0,
|
|
15137
|
-
/* @__PURE__ */ (0,
|
|
15385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, children: [
|
|
15386
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
15138
15387
|
"div",
|
|
15139
15388
|
{
|
|
15140
15389
|
className: "h-16 w-full rounded-lg border border-border shadow-sm",
|
|
15141
15390
|
style: { backgroundColor: `var(${cssVar})` }
|
|
15142
15391
|
}
|
|
15143
15392
|
),
|
|
15144
|
-
/* @__PURE__ */ (0,
|
|
15145
|
-
/* @__PURE__ */ (0,
|
|
15393
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15394
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("code", { className: "text-xs text-muted-foreground font-mono", children: cssVar })
|
|
15146
15395
|
] });
|
|
15147
15396
|
}
|
|
15148
15397
|
function ColorRow({ name, cssVar, description }) {
|
|
15149
|
-
return /* @__PURE__ */ (0,
|
|
15150
|
-
/* @__PURE__ */ (0,
|
|
15398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-center gap-4 py-2", children: [
|
|
15399
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
15151
15400
|
"div",
|
|
15152
15401
|
{
|
|
15153
15402
|
className: "h-10 w-10 rounded-lg border border-border shadow-sm flex-shrink-0",
|
|
15154
15403
|
style: { backgroundColor: `var(${cssVar})` }
|
|
15155
15404
|
}
|
|
15156
15405
|
),
|
|
15157
|
-
/* @__PURE__ */ (0,
|
|
15158
|
-
/* @__PURE__ */ (0,
|
|
15159
|
-
description && /* @__PURE__ */ (0,
|
|
15406
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
15407
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15408
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "text-xs text-muted-foreground", children: description })
|
|
15160
15409
|
] }),
|
|
15161
|
-
/* @__PURE__ */ (0,
|
|
15410
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: cssVar })
|
|
15162
15411
|
] });
|
|
15163
15412
|
}
|
|
15164
15413
|
|
|
15165
15414
|
// src/design-system/ColorPalette.tsx
|
|
15166
|
-
var
|
|
15415
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
15167
15416
|
var COLOR_GROUPS = [
|
|
15168
15417
|
{
|
|
15169
15418
|
name: "Base",
|
|
@@ -15244,17 +15493,17 @@ var COLOR_GROUPS = [
|
|
|
15244
15493
|
}
|
|
15245
15494
|
];
|
|
15246
15495
|
function ColorPalette({ layout = "list", className = "" }) {
|
|
15247
|
-
return /* @__PURE__ */ (0,
|
|
15248
|
-
/* @__PURE__ */ (0,
|
|
15249
|
-
/* @__PURE__ */ (0,
|
|
15250
|
-
layout === "grid" ? /* @__PURE__ */ (0,
|
|
15496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `space-y-8 ${className}`, children: COLOR_GROUPS.map((group) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("section", { children: [
|
|
15497
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h3", { className: "text-lg font-semibold text-foreground mb-1", children: group.name }),
|
|
15498
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: group.description }),
|
|
15499
|
+
layout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: group.colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15251
15500
|
ColorTokenSwatch,
|
|
15252
15501
|
{
|
|
15253
15502
|
name: color.name,
|
|
15254
15503
|
cssVar: color.cssVar
|
|
15255
15504
|
},
|
|
15256
15505
|
color.cssVar
|
|
15257
|
-
)) }) : /* @__PURE__ */ (0,
|
|
15506
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "bg-card rounded-lg border border-border p-4 divide-y divide-border", children: group.colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15258
15507
|
ColorRow,
|
|
15259
15508
|
{
|
|
15260
15509
|
name: color.name,
|
|
@@ -15267,7 +15516,7 @@ function ColorPalette({ layout = "list", className = "" }) {
|
|
|
15267
15516
|
}
|
|
15268
15517
|
|
|
15269
15518
|
// src/design-system/TypographyScale.tsx
|
|
15270
|
-
var
|
|
15519
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
15271
15520
|
var FONT_SAMPLES = [
|
|
15272
15521
|
{
|
|
15273
15522
|
name: "Heading",
|
|
@@ -15301,14 +15550,14 @@ var FONT_SAMPLES = [
|
|
|
15301
15550
|
}
|
|
15302
15551
|
];
|
|
15303
15552
|
function TypographyScale({ className = "" }) {
|
|
15304
|
-
return /* @__PURE__ */ (0,
|
|
15305
|
-
/* @__PURE__ */ (0,
|
|
15306
|
-
/* @__PURE__ */ (0,
|
|
15307
|
-
/* @__PURE__ */ (0,
|
|
15553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `space-y-8 ${className}`, children: FONT_SAMPLES.map((font) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("section", { className: "bg-card rounded-lg border border-border p-6", children: [
|
|
15554
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
|
15555
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: font.name }),
|
|
15556
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: font.cssVar })
|
|
15308
15557
|
] }),
|
|
15309
|
-
/* @__PURE__ */ (0,
|
|
15310
|
-
/* @__PURE__ */ (0,
|
|
15311
|
-
/* @__PURE__ */ (0,
|
|
15558
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "space-y-4", children: font.sizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-baseline gap-4", children: [
|
|
15559
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-xs text-muted-foreground w-20 flex-shrink-0", children: size }),
|
|
15560
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15312
15561
|
"p",
|
|
15313
15562
|
{
|
|
15314
15563
|
className: `${size} text-foreground`,
|
|
@@ -15327,8 +15576,8 @@ var RADIUS_SAMPLES = [
|
|
|
15327
15576
|
{ name: "Full", value: "9999px" }
|
|
15328
15577
|
];
|
|
15329
15578
|
function RadiusScale({ className = "" }) {
|
|
15330
|
-
return /* @__PURE__ */ (0,
|
|
15331
|
-
/* @__PURE__ */ (0,
|
|
15579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `space-y-4 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "grid grid-cols-5 gap-4", children: RADIUS_SAMPLES.map((radius) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
15580
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15332
15581
|
"div",
|
|
15333
15582
|
{
|
|
15334
15583
|
className: "h-16 w-16 bg-primary",
|
|
@@ -15337,13 +15586,13 @@ function RadiusScale({ className = "" }) {
|
|
|
15337
15586
|
}
|
|
15338
15587
|
}
|
|
15339
15588
|
),
|
|
15340
|
-
/* @__PURE__ */ (0,
|
|
15341
|
-
/* @__PURE__ */ (0,
|
|
15589
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-sm font-medium text-foreground", children: radius.name }),
|
|
15590
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("code", { className: "text-xs text-muted-foreground font-mono", children: radius.cssVar || radius.value })
|
|
15342
15591
|
] }, radius.name)) }) });
|
|
15343
15592
|
}
|
|
15344
15593
|
|
|
15345
15594
|
// src/design-system/ThemeSwitcher.tsx
|
|
15346
|
-
var
|
|
15595
|
+
var import_react68 = require("react");
|
|
15347
15596
|
|
|
15348
15597
|
// src/themes/types.ts
|
|
15349
15598
|
var RADIUS_PRESETS = {
|
|
@@ -16511,7 +16760,7 @@ function applyTheme(config) {
|
|
|
16511
16760
|
}
|
|
16512
16761
|
|
|
16513
16762
|
// src/design-system/ThemeSwitcher.tsx
|
|
16514
|
-
var
|
|
16763
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
16515
16764
|
function readThemeFromDOM() {
|
|
16516
16765
|
if (typeof document === "undefined") {
|
|
16517
16766
|
return { themeName: "Linear", isDark: false };
|
|
@@ -16529,10 +16778,10 @@ function readThemeFromDOM() {
|
|
|
16529
16778
|
return { themeName: "Linear", isDark: dark };
|
|
16530
16779
|
}
|
|
16531
16780
|
function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
16532
|
-
const [currentTheme, setCurrentTheme] = (0,
|
|
16533
|
-
const [isDark, setIsDark] = (0,
|
|
16534
|
-
const [isOpen, setIsOpen] = (0,
|
|
16535
|
-
(0,
|
|
16781
|
+
const [currentTheme, setCurrentTheme] = (0, import_react68.useState)("Linear");
|
|
16782
|
+
const [isDark, setIsDark] = (0, import_react68.useState)(false);
|
|
16783
|
+
const [isOpen, setIsOpen] = (0, import_react68.useState)(false);
|
|
16784
|
+
(0, import_react68.useEffect)(() => {
|
|
16536
16785
|
const { themeName, isDark: dark } = readThemeFromDOM();
|
|
16537
16786
|
setCurrentTheme(themeName);
|
|
16538
16787
|
setIsDark(dark);
|
|
@@ -16571,61 +16820,61 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
16571
16820
|
applyTheme(config);
|
|
16572
16821
|
};
|
|
16573
16822
|
const themes = showBaseThemesOnly ? baseThemes : baseThemes;
|
|
16574
|
-
return /* @__PURE__ */ (0,
|
|
16575
|
-
/* @__PURE__ */ (0,
|
|
16576
|
-
/* @__PURE__ */ (0,
|
|
16823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `flex items-center gap-3 ${className}`, children: [
|
|
16824
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "relative", children: [
|
|
16825
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
16577
16826
|
"button",
|
|
16578
16827
|
{
|
|
16579
16828
|
onClick: () => setIsOpen(!isOpen),
|
|
16580
16829
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
16581
16830
|
children: [
|
|
16582
|
-
/* @__PURE__ */ (0,
|
|
16583
|
-
/* @__PURE__ */ (0,
|
|
16584
|
-
/* @__PURE__ */ (0,
|
|
16831
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("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" }) }),
|
|
16832
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "font-medium", children: currentTheme }),
|
|
16833
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: `w-4 h-4 transition-transform ${isOpen ? "rotate-180" : ""}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
16585
16834
|
]
|
|
16586
16835
|
}
|
|
16587
16836
|
),
|
|
16588
|
-
isOpen && /* @__PURE__ */ (0,
|
|
16589
|
-
/* @__PURE__ */ (0,
|
|
16837
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
16838
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
16590
16839
|
"div",
|
|
16591
16840
|
{
|
|
16592
16841
|
className: "fixed inset-0 z-40",
|
|
16593
16842
|
onClick: () => setIsOpen(false)
|
|
16594
16843
|
}
|
|
16595
16844
|
),
|
|
16596
|
-
/* @__PURE__ */ (0,
|
|
16845
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("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__ */ (0, import_jsx_runtime89.jsxs)(
|
|
16597
16846
|
"button",
|
|
16598
16847
|
{
|
|
16599
16848
|
onClick: () => handleThemeSelect(theme.name),
|
|
16600
16849
|
className: `w-full px-4 py-2 text-left hover:bg-muted transition-colors flex items-center gap-3 ${currentTheme === theme.name ? "bg-muted" : ""}`,
|
|
16601
16850
|
children: [
|
|
16602
|
-
/* @__PURE__ */ (0,
|
|
16851
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
16603
16852
|
"div",
|
|
16604
16853
|
{
|
|
16605
16854
|
className: "w-4 h-4 rounded-full border border-border",
|
|
16606
16855
|
style: { backgroundColor: theme.primaryColor || "#888" }
|
|
16607
16856
|
}
|
|
16608
16857
|
),
|
|
16609
|
-
/* @__PURE__ */ (0,
|
|
16610
|
-
currentTheme === theme.name && /* @__PURE__ */ (0,
|
|
16858
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-foreground", children: theme.name }),
|
|
16859
|
+
currentTheme === theme.name && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: "w-4 h-4 ml-auto text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
16611
16860
|
]
|
|
16612
16861
|
},
|
|
16613
16862
|
theme.name
|
|
16614
16863
|
)) })
|
|
16615
16864
|
] })
|
|
16616
16865
|
] }),
|
|
16617
|
-
/* @__PURE__ */ (0,
|
|
16866
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
16618
16867
|
"button",
|
|
16619
16868
|
{
|
|
16620
16869
|
onClick: handleDarkModeToggle,
|
|
16621
16870
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
16622
16871
|
title: `Switch to ${isDark ? "light" : "dark"} mode`,
|
|
16623
16872
|
children: [
|
|
16624
|
-
isDark ? /* @__PURE__ */ (0,
|
|
16625
|
-
/* @__PURE__ */ (0,
|
|
16626
|
-
/* @__PURE__ */ (0,
|
|
16627
|
-
] }) : /* @__PURE__ */ (0,
|
|
16628
|
-
/* @__PURE__ */ (0,
|
|
16873
|
+
isDark ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
16874
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
16875
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("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" })
|
|
16876
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
16877
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-sm", children: isDark ? "Light" : "Dark" })
|
|
16629
16878
|
]
|
|
16630
16879
|
}
|
|
16631
16880
|
)
|
|
@@ -16633,7 +16882,7 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
16633
16882
|
}
|
|
16634
16883
|
|
|
16635
16884
|
// src/design-system/DesignSystemPage.tsx
|
|
16636
|
-
var
|
|
16885
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
16637
16886
|
function DesignSystemPage({
|
|
16638
16887
|
showThemeSwitcher = true,
|
|
16639
16888
|
showColors = true,
|
|
@@ -16643,29 +16892,29 @@ function DesignSystemPage({
|
|
|
16643
16892
|
colorLayout = "list",
|
|
16644
16893
|
className = ""
|
|
16645
16894
|
}) {
|
|
16646
|
-
return /* @__PURE__ */ (0,
|
|
16647
|
-
/* @__PURE__ */ (0,
|
|
16648
|
-
/* @__PURE__ */ (0,
|
|
16649
|
-
/* @__PURE__ */ (0,
|
|
16650
|
-
/* @__PURE__ */ (0,
|
|
16895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `max-w-4xl mx-auto px-4 py-8 ${className}`, children: [
|
|
16896
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("header", { className: "mb-12", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4", children: [
|
|
16897
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { children: [
|
|
16898
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h1", { className: "text-4xl font-bold text-foreground mb-2", children: "Design System" }),
|
|
16899
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "text-lg text-muted-foreground", children: "Visual reference for theme tokens and styles" })
|
|
16651
16900
|
] }),
|
|
16652
|
-
showThemeSwitcher && /* @__PURE__ */ (0,
|
|
16901
|
+
showThemeSwitcher && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ThemeSwitcher, {})
|
|
16653
16902
|
] }) }),
|
|
16654
|
-
showColors && /* @__PURE__ */ (0,
|
|
16655
|
-
/* @__PURE__ */ (0,
|
|
16656
|
-
/* @__PURE__ */ (0,
|
|
16903
|
+
showColors && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16904
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Color Palette" }),
|
|
16905
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ColorPalette, { layout: colorLayout })
|
|
16657
16906
|
] }),
|
|
16658
|
-
showTypography && /* @__PURE__ */ (0,
|
|
16659
|
-
/* @__PURE__ */ (0,
|
|
16660
|
-
/* @__PURE__ */ (0,
|
|
16907
|
+
showTypography && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16908
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Typography" }),
|
|
16909
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TypographyScale, {})
|
|
16661
16910
|
] }),
|
|
16662
|
-
showRadius && /* @__PURE__ */ (0,
|
|
16663
|
-
/* @__PURE__ */ (0,
|
|
16664
|
-
/* @__PURE__ */ (0,
|
|
16911
|
+
showRadius && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16912
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Border Radius" }),
|
|
16913
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RadiusScale, {})
|
|
16665
16914
|
] }),
|
|
16666
|
-
showSpacing && /* @__PURE__ */ (0,
|
|
16667
|
-
/* @__PURE__ */ (0,
|
|
16668
|
-
/* @__PURE__ */ (0,
|
|
16915
|
+
showSpacing && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16916
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Spacing Scale" }),
|
|
16917
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SpacingScale, {})
|
|
16669
16918
|
] })
|
|
16670
16919
|
] });
|
|
16671
16920
|
}
|
|
@@ -16680,31 +16929,31 @@ function SpacingScale() {
|
|
|
16680
16929
|
{ name: "12", value: "3rem" },
|
|
16681
16930
|
{ name: "16", value: "4rem" }
|
|
16682
16931
|
];
|
|
16683
|
-
return /* @__PURE__ */ (0,
|
|
16684
|
-
/* @__PURE__ */ (0,
|
|
16685
|
-
/* @__PURE__ */ (0,
|
|
16932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "space-y-2", children: spaces.map((space) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
16933
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("code", { className: "text-xs text-muted-foreground font-mono w-8", children: space.name }),
|
|
16934
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16686
16935
|
"div",
|
|
16687
16936
|
{
|
|
16688
16937
|
className: "h-4 bg-primary rounded",
|
|
16689
16938
|
style: { width: space.value }
|
|
16690
16939
|
}
|
|
16691
16940
|
),
|
|
16692
|
-
/* @__PURE__ */ (0,
|
|
16941
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-sm text-muted-foreground", children: space.value })
|
|
16693
16942
|
] }, space.name)) });
|
|
16694
16943
|
}
|
|
16695
16944
|
|
|
16696
16945
|
// src/personalization/PersonalizationProvider.tsx
|
|
16697
|
-
var
|
|
16946
|
+
var import_react71 = __toESM(require("react"), 1);
|
|
16698
16947
|
|
|
16699
16948
|
// src/personalization/PersonalizationContext.ts
|
|
16700
|
-
var
|
|
16701
|
-
var PersonalizationContext = (0,
|
|
16949
|
+
var import_react69 = require("react");
|
|
16950
|
+
var PersonalizationContext = (0, import_react69.createContext)(null);
|
|
16702
16951
|
function usePersonalizationContext() {
|
|
16703
|
-
return (0,
|
|
16952
|
+
return (0, import_react69.useContext)(PersonalizationContext);
|
|
16704
16953
|
}
|
|
16705
16954
|
|
|
16706
16955
|
// src/personalization/utils.ts
|
|
16707
|
-
var
|
|
16956
|
+
var import_react70 = require("react");
|
|
16708
16957
|
function normalizeHex(color) {
|
|
16709
16958
|
let hex = color.trim().toUpperCase();
|
|
16710
16959
|
if (hex.length === 4 && hex.startsWith("#")) {
|
|
@@ -16725,8 +16974,8 @@ function isValidImageUrl(url) {
|
|
|
16725
16974
|
}
|
|
16726
16975
|
}
|
|
16727
16976
|
function useDebouncedValue(value, delay) {
|
|
16728
|
-
const [debounced, setDebounced] = (0,
|
|
16729
|
-
(0,
|
|
16977
|
+
const [debounced, setDebounced] = (0, import_react70.useState)(value);
|
|
16978
|
+
(0, import_react70.useEffect)(() => {
|
|
16730
16979
|
const timer = setTimeout(() => setDebounced(value), delay);
|
|
16731
16980
|
return () => clearTimeout(timer);
|
|
16732
16981
|
}, [value, delay]);
|
|
@@ -16747,18 +16996,18 @@ function scrollInputAboveKeyboard(input) {
|
|
|
16747
16996
|
}
|
|
16748
16997
|
|
|
16749
16998
|
// src/personalization/PersonalizationProvider.tsx
|
|
16750
|
-
var
|
|
16999
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
16751
17000
|
function createBridgeFromCanvas(canvasModule) {
|
|
16752
17001
|
const { useEditor, useCommands, useImageBinding } = canvasModule;
|
|
16753
17002
|
function TextBinder({ name, value }) {
|
|
16754
17003
|
const { elements } = useEditor();
|
|
16755
17004
|
const { executeElementUpdate } = useCommands();
|
|
16756
|
-
const elementsRef =
|
|
17005
|
+
const elementsRef = import_react71.default.useRef(elements);
|
|
16757
17006
|
elementsRef.current = elements;
|
|
16758
|
-
const executeRef =
|
|
17007
|
+
const executeRef = import_react71.default.useRef(executeElementUpdate);
|
|
16759
17008
|
executeRef.current = executeElementUpdate;
|
|
16760
|
-
const hasUserInput =
|
|
16761
|
-
|
|
17009
|
+
const hasUserInput = import_react71.default.useRef(false);
|
|
17010
|
+
import_react71.default.useEffect(() => {
|
|
16762
17011
|
if (value == null) return;
|
|
16763
17012
|
if (value === "" && !hasUserInput.current) return;
|
|
16764
17013
|
hasUserInput.current = true;
|
|
@@ -16776,12 +17025,12 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16776
17025
|
function ColorBinder({ originalColor, newColor }) {
|
|
16777
17026
|
const { elements } = useEditor();
|
|
16778
17027
|
const { executeElementUpdate } = useCommands();
|
|
16779
|
-
const elementsRef =
|
|
17028
|
+
const elementsRef = import_react71.default.useRef(elements);
|
|
16780
17029
|
elementsRef.current = elements;
|
|
16781
|
-
const executeRef =
|
|
17030
|
+
const executeRef = import_react71.default.useRef(executeElementUpdate);
|
|
16782
17031
|
executeRef.current = executeElementUpdate;
|
|
16783
|
-
const appliedColorRef =
|
|
16784
|
-
|
|
17032
|
+
const appliedColorRef = import_react71.default.useRef(normalizeHex(originalColor));
|
|
17033
|
+
import_react71.default.useEffect(() => {
|
|
16785
17034
|
const normalizedNew = normalizeHex(newColor);
|
|
16786
17035
|
if (normalizedNew === appliedColorRef.current) return;
|
|
16787
17036
|
const matchColor = appliedColorRef.current;
|
|
@@ -16821,11 +17070,11 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16821
17070
|
}
|
|
16822
17071
|
function ImageBinder({ name, value, fit = "cover" }) {
|
|
16823
17072
|
const { setImageUrl } = useImageBinding(name, { fit });
|
|
16824
|
-
const hasUserInput =
|
|
17073
|
+
const hasUserInput = import_react71.default.useRef(false);
|
|
16825
17074
|
const debouncedValue = useDebouncedValue(value, 500);
|
|
16826
|
-
const setImageUrlRef =
|
|
17075
|
+
const setImageUrlRef = import_react71.default.useRef(setImageUrl);
|
|
16827
17076
|
setImageUrlRef.current = setImageUrl;
|
|
16828
|
-
|
|
17077
|
+
import_react71.default.useEffect(() => {
|
|
16829
17078
|
if (debouncedValue == null) return;
|
|
16830
17079
|
if (debouncedValue === "" && !hasUserInput.current) return;
|
|
16831
17080
|
hasUserInput.current = true;
|
|
@@ -16835,15 +17084,15 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16835
17084
|
return null;
|
|
16836
17085
|
}
|
|
16837
17086
|
return function PersonalizationBridge({ fields = [], values = {} } = {}) {
|
|
16838
|
-
return /* @__PURE__ */ (0,
|
|
17087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_jsx_runtime91.Fragment, { children: fields.map((field) => {
|
|
16839
17088
|
if (field.type === "text") {
|
|
16840
|
-
return /* @__PURE__ */ (0,
|
|
17089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
|
|
16841
17090
|
}
|
|
16842
17091
|
if (field.type === "color") {
|
|
16843
|
-
return /* @__PURE__ */ (0,
|
|
17092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
|
|
16844
17093
|
}
|
|
16845
17094
|
if (field.type === "image") {
|
|
16846
|
-
return /* @__PURE__ */ (0,
|
|
17095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ImageBinder, { name: field.name, value: values[field.name] ?? "", fit: field.fit ?? "cover" }, `image-${field.name}`);
|
|
16847
17096
|
}
|
|
16848
17097
|
return null;
|
|
16849
17098
|
}) });
|
|
@@ -16865,20 +17114,20 @@ function PersonalizationProvider({
|
|
|
16865
17114
|
children
|
|
16866
17115
|
}) {
|
|
16867
17116
|
const realtime = useRealtimeOptional();
|
|
16868
|
-
const [personValues, setPersonValues] = (0,
|
|
16869
|
-
const [isActive, setIsActive] = (0,
|
|
16870
|
-
const [isExporting, setIsExporting] = (0,
|
|
16871
|
-
const [exportedBlobUrls, setExportedBlobUrls] = (0,
|
|
16872
|
-
const [exportCount, setExportCount] = (0,
|
|
16873
|
-
const blobUrlsRef = (0,
|
|
16874
|
-
const [CanvasComponent, setCanvasComponent] = (0,
|
|
17117
|
+
const [personValues, setPersonValues] = (0, import_react71.useState)(initialValues ?? {});
|
|
17118
|
+
const [isActive, setIsActive] = (0, import_react71.useState)(!!(initialValues && Object.keys(initialValues).length > 0));
|
|
17119
|
+
const [isExporting, setIsExporting] = (0, import_react71.useState)(false);
|
|
17120
|
+
const [exportedBlobUrls, setExportedBlobUrls] = (0, import_react71.useState)({});
|
|
17121
|
+
const [exportCount, setExportCount] = (0, import_react71.useState)(0);
|
|
17122
|
+
const blobUrlsRef = (0, import_react71.useRef)({});
|
|
17123
|
+
const [CanvasComponent, setCanvasComponent] = (0, import_react71.useState)(
|
|
16875
17124
|
cachedCanvasComponent
|
|
16876
17125
|
);
|
|
16877
|
-
const [BridgeComponent, setBridgeComponent] = (0,
|
|
17126
|
+
const [BridgeComponent, setBridgeComponent] = (0, import_react71.useState)(
|
|
16878
17127
|
cachedBridgeComponent
|
|
16879
17128
|
);
|
|
16880
17129
|
const hasFields = fields.length > 0;
|
|
16881
|
-
(0,
|
|
17130
|
+
(0, import_react71.useEffect)(() => {
|
|
16882
17131
|
if (CanvasComponent && BridgeComponent) return;
|
|
16883
17132
|
if (!canvasImport || !hasFields) return;
|
|
16884
17133
|
if (!canvasLoadPromise) {
|
|
@@ -16896,8 +17145,8 @@ function PersonalizationProvider({
|
|
|
16896
17145
|
}
|
|
16897
17146
|
});
|
|
16898
17147
|
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
16899
|
-
const realtimeEnabledRef = (0,
|
|
16900
|
-
(0,
|
|
17148
|
+
const realtimeEnabledRef = (0, import_react71.useRef)(false);
|
|
17149
|
+
(0, import_react71.useEffect)(() => {
|
|
16901
17150
|
return () => {
|
|
16902
17151
|
for (const url of Object.values(blobUrlsRef.current)) {
|
|
16903
17152
|
try {
|
|
@@ -16907,16 +17156,16 @@ function PersonalizationProvider({
|
|
|
16907
17156
|
}
|
|
16908
17157
|
};
|
|
16909
17158
|
}, []);
|
|
16910
|
-
const updateField = (0,
|
|
17159
|
+
const updateField = (0, import_react71.useCallback)((key, value) => {
|
|
16911
17160
|
setIsActive(true);
|
|
16912
17161
|
setPersonValues((prev) => ({ ...prev, [key]: value }));
|
|
16913
17162
|
}, []);
|
|
16914
|
-
const reset = (0,
|
|
17163
|
+
const reset = (0, import_react71.useCallback)(() => {
|
|
16915
17164
|
setPersonValues({});
|
|
16916
17165
|
setIsActive(false);
|
|
16917
17166
|
setIsExporting(false);
|
|
16918
17167
|
}, []);
|
|
16919
|
-
const handleExport = (0,
|
|
17168
|
+
const handleExport = (0, import_react71.useCallback)(
|
|
16920
17169
|
(exports2) => {
|
|
16921
17170
|
const newUrls = {};
|
|
16922
17171
|
for (const [name, data] of Object.entries(exports2)) {
|
|
@@ -16950,11 +17199,11 @@ function PersonalizationProvider({
|
|
|
16950
17199
|
},
|
|
16951
17200
|
[realtime, placementOverride]
|
|
16952
17201
|
);
|
|
16953
|
-
const handleExportScheduled = (0,
|
|
17202
|
+
const handleExportScheduled = (0, import_react71.useCallback)(() => {
|
|
16954
17203
|
setIsExporting(true);
|
|
16955
17204
|
}, []);
|
|
16956
17205
|
const shouldMountCanvas = CanvasComponent && BridgeComponent && canvasState?.elements && canvasState.elements.length > 0 && (!lazy || isActive);
|
|
16957
|
-
const contextValue =
|
|
17206
|
+
const contextValue = import_react71.default.useMemo(
|
|
16958
17207
|
() => ({
|
|
16959
17208
|
fields,
|
|
16960
17209
|
personValues,
|
|
@@ -16967,8 +17216,8 @@ function PersonalizationProvider({
|
|
|
16967
17216
|
}),
|
|
16968
17217
|
[fields, personValues, updateField, isActive, isExporting, exportedBlobUrls, exportCount, reset]
|
|
16969
17218
|
);
|
|
16970
|
-
return /* @__PURE__ */ (0,
|
|
16971
|
-
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ (0,
|
|
17219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(PersonalizationContext.Provider, { value: contextValue, children: [
|
|
17220
|
+
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16972
17221
|
"div",
|
|
16973
17222
|
{
|
|
16974
17223
|
style: {
|
|
@@ -16981,7 +17230,7 @@ function PersonalizationProvider({
|
|
|
16981
17230
|
pointerEvents: "none"
|
|
16982
17231
|
},
|
|
16983
17232
|
"aria-hidden": true,
|
|
16984
|
-
children: /* @__PURE__ */ (0,
|
|
17233
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16985
17234
|
CanvasComponent,
|
|
16986
17235
|
{
|
|
16987
17236
|
initialElements: canvasState?.elements,
|
|
@@ -17001,7 +17250,7 @@ function PersonalizationProvider({
|
|
|
17001
17250
|
exportImageQuality: exportConfig?.imageQuality ?? 0.85,
|
|
17002
17251
|
onExport: handleExport,
|
|
17003
17252
|
onExportScheduled: handleExportScheduled,
|
|
17004
|
-
overlay: /* @__PURE__ */ (0,
|
|
17253
|
+
overlay: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(BridgeComponent, { fields, values: personValues })
|
|
17005
17254
|
}
|
|
17006
17255
|
)
|
|
17007
17256
|
},
|
|
@@ -17026,7 +17275,7 @@ function usePersonalizationOptional() {
|
|
|
17026
17275
|
}
|
|
17027
17276
|
|
|
17028
17277
|
// src/personalization/PersonalizationInputs.tsx
|
|
17029
|
-
var
|
|
17278
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
17030
17279
|
function PersonalizationInputs({
|
|
17031
17280
|
className,
|
|
17032
17281
|
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",
|
|
@@ -17050,8 +17299,8 @@ function PersonalizationInputs({
|
|
|
17050
17299
|
scrollInputAboveKeyboard(e.target);
|
|
17051
17300
|
}
|
|
17052
17301
|
};
|
|
17053
|
-
return /* @__PURE__ */ (0,
|
|
17054
|
-
textFields.map((field) => /* @__PURE__ */ (0,
|
|
17302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: className || "flex flex-col gap-3", children: [
|
|
17303
|
+
textFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17055
17304
|
"input",
|
|
17056
17305
|
{
|
|
17057
17306
|
type: "text",
|
|
@@ -17065,8 +17314,8 @@ function PersonalizationInputs({
|
|
|
17065
17314
|
},
|
|
17066
17315
|
`text-${field.name}`
|
|
17067
17316
|
)),
|
|
17068
|
-
colorFields.map((field) => /* @__PURE__ */ (0,
|
|
17069
|
-
/* @__PURE__ */ (0,
|
|
17317
|
+
colorFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
17318
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17070
17319
|
"input",
|
|
17071
17320
|
{
|
|
17072
17321
|
type: "color",
|
|
@@ -17075,9 +17324,9 @@ function PersonalizationInputs({
|
|
|
17075
17324
|
onChange: (e) => updateField(field.color, e.target.value)
|
|
17076
17325
|
}
|
|
17077
17326
|
),
|
|
17078
|
-
/* @__PURE__ */ (0,
|
|
17327
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "text-base text-muted-foreground", children: field.label })
|
|
17079
17328
|
] }, `color-${field.color}`)),
|
|
17080
|
-
imageFields.map((field) => /* @__PURE__ */ (0,
|
|
17329
|
+
imageFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17081
17330
|
"input",
|
|
17082
17331
|
{
|
|
17083
17332
|
type: "text",
|
|
@@ -17095,15 +17344,15 @@ function PersonalizationInputs({
|
|
|
17095
17344
|
}
|
|
17096
17345
|
|
|
17097
17346
|
// src/personalization/usePersonalizationShimmer.ts
|
|
17098
|
-
var
|
|
17347
|
+
var import_react72 = require("react");
|
|
17099
17348
|
function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
17100
17349
|
const personCtx = usePersonalizationContext();
|
|
17101
17350
|
const realtime = useRealtimeOptional();
|
|
17102
|
-
const [shimmerActive, setShimmerActive] = (0,
|
|
17103
|
-
const sdkSettledRef = (0,
|
|
17104
|
-
const manualTriggerRef = (0,
|
|
17105
|
-
const safetyTimeoutRef = (0,
|
|
17106
|
-
const startShimmer = (0,
|
|
17351
|
+
const [shimmerActive, setShimmerActive] = (0, import_react72.useState)(false);
|
|
17352
|
+
const sdkSettledRef = (0, import_react72.useRef)(false);
|
|
17353
|
+
const manualTriggerRef = (0, import_react72.useRef)(false);
|
|
17354
|
+
const safetyTimeoutRef = (0, import_react72.useRef)(void 0);
|
|
17355
|
+
const startShimmer = (0, import_react72.useCallback)(() => {
|
|
17107
17356
|
setShimmerActive(true);
|
|
17108
17357
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
17109
17358
|
safetyTimeoutRef.current = setTimeout(
|
|
@@ -17115,25 +17364,25 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17115
17364
|
safetyTimeoutMs
|
|
17116
17365
|
);
|
|
17117
17366
|
}, [safetyTimeoutMs]);
|
|
17118
|
-
(0,
|
|
17367
|
+
(0, import_react72.useEffect)(() => {
|
|
17119
17368
|
if (!personCtx?.isActive) return;
|
|
17120
17369
|
sdkSettledRef.current = false;
|
|
17121
17370
|
manualTriggerRef.current = false;
|
|
17122
17371
|
realtime?.resetPipelineSettled();
|
|
17123
17372
|
startShimmer();
|
|
17124
17373
|
}, [personCtx?.personValues, personCtx?.isActive, startShimmer]);
|
|
17125
|
-
const triggerShimmer = (0,
|
|
17374
|
+
const triggerShimmer = (0, import_react72.useCallback)(() => {
|
|
17126
17375
|
sdkSettledRef.current = false;
|
|
17127
17376
|
manualTriggerRef.current = true;
|
|
17128
17377
|
startShimmer();
|
|
17129
17378
|
}, [startShimmer]);
|
|
17130
|
-
(0,
|
|
17379
|
+
(0, import_react72.useEffect)(() => {
|
|
17131
17380
|
if (!realtime?.subscribePipelineSettled) return;
|
|
17132
17381
|
return realtime.subscribePipelineSettled(() => {
|
|
17133
17382
|
sdkSettledRef.current = true;
|
|
17134
17383
|
});
|
|
17135
17384
|
}, [realtime]);
|
|
17136
|
-
(0,
|
|
17385
|
+
(0, import_react72.useEffect)(() => {
|
|
17137
17386
|
const container = containerRef.current;
|
|
17138
17387
|
if (!container) return;
|
|
17139
17388
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -17176,7 +17425,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17176
17425
|
});
|
|
17177
17426
|
return () => observer.disconnect();
|
|
17178
17427
|
}, [containerRef]);
|
|
17179
|
-
(0,
|
|
17428
|
+
(0, import_react72.useEffect)(() => {
|
|
17180
17429
|
return () => {
|
|
17181
17430
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
17182
17431
|
};
|
|
@@ -17254,11 +17503,14 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17254
17503
|
EdgeSwipeGuards,
|
|
17255
17504
|
EnhancedImageViewer,
|
|
17256
17505
|
FACET_SECTIONS,
|
|
17506
|
+
FIRST_VIEW_MARGIN,
|
|
17507
|
+
FIRST_VIEW_PICTURE_ASPECT,
|
|
17257
17508
|
Fieldset,
|
|
17258
17509
|
Filters,
|
|
17259
17510
|
FiltersButton,
|
|
17260
17511
|
FiltersDrawer,
|
|
17261
17512
|
FloatingActionGroup,
|
|
17513
|
+
GallerySkipProvider,
|
|
17262
17514
|
HeroCarousel,
|
|
17263
17515
|
HeroProductImage,
|
|
17264
17516
|
HeroShrinkLayout,
|
|
@@ -17288,6 +17540,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17288
17540
|
MobileProductCarousel,
|
|
17289
17541
|
MockupBackground,
|
|
17290
17542
|
MockupPriorityProvider,
|
|
17543
|
+
NO_GALLERY_SKIPS,
|
|
17291
17544
|
PDPLayout,
|
|
17292
17545
|
PersonalizationInputs,
|
|
17293
17546
|
PersonalizationProvider,
|
|
@@ -17383,9 +17636,14 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17383
17636
|
checkThemeTokens,
|
|
17384
17637
|
createScrollDirectionTracker,
|
|
17385
17638
|
describeProductArtAlignment,
|
|
17639
|
+
firstView,
|
|
17640
|
+
firstViewAnchorOfSlide,
|
|
17386
17641
|
formatCurrency,
|
|
17387
17642
|
formatDate,
|
|
17388
17643
|
formatDateTime,
|
|
17644
|
+
gallerySkipVerdict,
|
|
17645
|
+
gallerySkippedStamp,
|
|
17646
|
+
galleryWithoutSkipped,
|
|
17389
17647
|
getBrand,
|
|
17390
17648
|
getMockupUrl,
|
|
17391
17649
|
getObservedElementCount,
|
|
@@ -17406,6 +17664,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17406
17664
|
runConfigChecks,
|
|
17407
17665
|
scrollInputAboveKeyboard,
|
|
17408
17666
|
searchClient,
|
|
17667
|
+
slideFirstViewFields,
|
|
17409
17668
|
slideFirstViewProps,
|
|
17410
17669
|
spinnerVariants,
|
|
17411
17670
|
surfaceVariants,
|
|
@@ -17418,6 +17677,8 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17418
17677
|
useDesignOptional,
|
|
17419
17678
|
useDeviceDetection,
|
|
17420
17679
|
useFocusTrap,
|
|
17680
|
+
useGallerySkipOptional,
|
|
17681
|
+
useGallerySkipState,
|
|
17421
17682
|
useHeroZoomScales,
|
|
17422
17683
|
useImagePreloader,
|
|
17423
17684
|
useImageTransition,
|