@snowcone-app/ui 0.11.11 → 0.11.14
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 +20 -0
- package/dist/index.cjs +704 -672
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +352 -324
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +22 -11
- package/src/composed/__tests__/HeroProductImage.placement-art.test.tsx +102 -0
- package/src/index.ts +8 -0
- package/src/patterns/PlacementArt.tsx +49 -0
package/dist/index.cjs
CHANGED
|
@@ -259,6 +259,7 @@ __export(src_exports, {
|
|
|
259
259
|
PDPLayout: () => PDPLayout,
|
|
260
260
|
PersonalizationInputs: () => PersonalizationInputs,
|
|
261
261
|
PersonalizationProvider: () => PersonalizationProvider,
|
|
262
|
+
PlacementArt: () => PlacementArt,
|
|
262
263
|
PlacementClipShapeSelector: () => PlacementClipShapeSelector,
|
|
263
264
|
PlacementTabs: () => PlacementTabs,
|
|
264
265
|
Popover: () => Popover,
|
|
@@ -363,6 +364,7 @@ __export(src_exports, {
|
|
|
363
364
|
normalizeHex: () => normalizeHex,
|
|
364
365
|
observe: () => observe,
|
|
365
366
|
pictureRenderState: () => pictureRenderState,
|
|
367
|
+
placementArtFor: () => placementArtFor,
|
|
366
368
|
runConfigChecks: () => runConfigChecks,
|
|
367
369
|
scrollInputAboveKeyboard: () => scrollInputAboveKeyboard,
|
|
368
370
|
searchClient: () => searchClient,
|
|
@@ -389,6 +391,7 @@ __export(src_exports, {
|
|
|
389
391
|
usePersonalization: () => usePersonalization,
|
|
390
392
|
usePersonalizationOptional: () => usePersonalizationOptional,
|
|
391
393
|
usePersonalizationShimmer: () => usePersonalizationShimmer,
|
|
394
|
+
usePlacementArtOptional: () => usePlacementArtOptional,
|
|
392
395
|
usePlacementClipShape: () => usePlacementClipShape,
|
|
393
396
|
usePlacementsProcessor: () => usePlacementsProcessor,
|
|
394
397
|
useProduct: () => useProduct,
|
|
@@ -399,7 +402,7 @@ __export(src_exports, {
|
|
|
399
402
|
useProductSelection: () => useProductSelection,
|
|
400
403
|
useProviderStatus: () => useProviderStatus,
|
|
401
404
|
useRealtime: () => useRealtime,
|
|
402
|
-
useRealtimeMockup: () =>
|
|
405
|
+
useRealtimeMockup: () => import_react72.useRealtimeMockup,
|
|
403
406
|
useRealtimeOptional: () => useRealtimeOptional,
|
|
404
407
|
useRenderCount: () => useRenderCount,
|
|
405
408
|
useRenderGuard: () => useRenderGuard,
|
|
@@ -10267,11 +10270,69 @@ var LoadingOverlayPrismCandyInline = (0, import_react41.memo)(
|
|
|
10267
10270
|
);
|
|
10268
10271
|
|
|
10269
10272
|
// src/index.ts
|
|
10270
|
-
var
|
|
10273
|
+
var import_react72 = require("@snowcone-app/sdk/react");
|
|
10271
10274
|
var import_sdk13 = require("@snowcone-app/sdk");
|
|
10272
10275
|
|
|
10273
|
-
// src/patterns/
|
|
10276
|
+
// src/patterns/PlacementArt.tsx
|
|
10277
|
+
var import_react42 = require("react");
|
|
10278
|
+
|
|
10279
|
+
// src/composed/heroMockupUrl.ts
|
|
10280
|
+
var import_sdk10 = require("@snowcone-app/sdk");
|
|
10281
|
+
function slugifyPlacementKey(label) {
|
|
10282
|
+
return label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
10283
|
+
}
|
|
10284
|
+
function toPublicDesign(elements, placements) {
|
|
10285
|
+
const design = {};
|
|
10286
|
+
for (const el of elements) {
|
|
10287
|
+
if (!el.placement) continue;
|
|
10288
|
+
const match = placements.find((p) => p.label === el.placement);
|
|
10289
|
+
const key = match?.key || slugifyPlacementKey(el.placement);
|
|
10290
|
+
if (el.type === "color") {
|
|
10291
|
+
if (el.hex) design[key] = { color: el.hex };
|
|
10292
|
+
} else if (el.imageUrl) {
|
|
10293
|
+
const aligned = el.alignment && el.alignment !== "center";
|
|
10294
|
+
design[key] = aligned || el.tiles ? {
|
|
10295
|
+
src: el.imageUrl,
|
|
10296
|
+
...aligned ? { align: el.alignment } : {},
|
|
10297
|
+
...el.tiles ? { tile: el.tiles } : {}
|
|
10298
|
+
} : el.imageUrl;
|
|
10299
|
+
}
|
|
10300
|
+
}
|
|
10301
|
+
return design;
|
|
10302
|
+
}
|
|
10303
|
+
function heroMockupUrl(args) {
|
|
10304
|
+
if (!args.shop) return null;
|
|
10305
|
+
const publicDesign = toPublicDesign(args.design, args.placements);
|
|
10306
|
+
if (Object.keys(publicDesign).length === 0) return null;
|
|
10307
|
+
return (0, import_sdk10.getMockupUrl)(args.productCode, {
|
|
10308
|
+
shop: args.shop,
|
|
10309
|
+
design: publicDesign,
|
|
10310
|
+
..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView, ...args.size.width !== void 0 ? { width: args.size.width } : {} } : { width: args.size.width },
|
|
10311
|
+
view: args.mockupId,
|
|
10312
|
+
variant: args.variantId,
|
|
10313
|
+
...args.bg ? { bg: args.bg } : {},
|
|
10314
|
+
...args.resolver ? { base: args.resolver } : {}
|
|
10315
|
+
});
|
|
10316
|
+
}
|
|
10317
|
+
|
|
10318
|
+
// src/patterns/PlacementArt.tsx
|
|
10274
10319
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10320
|
+
var PlacementArtContext = (0, import_react42.createContext)(null);
|
|
10321
|
+
function PlacementArt({ art, children }) {
|
|
10322
|
+
const key = art ? JSON.stringify(art) : "";
|
|
10323
|
+
const value = (0, import_react42.useMemo)(() => key ? JSON.parse(key) : null, [key]);
|
|
10324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PlacementArtContext.Provider, { value, children });
|
|
10325
|
+
}
|
|
10326
|
+
function usePlacementArtOptional() {
|
|
10327
|
+
return (0, import_react42.useContext)(PlacementArtContext);
|
|
10328
|
+
}
|
|
10329
|
+
function placementArtFor(art, placement, fallback) {
|
|
10330
|
+
if (!art) return fallback;
|
|
10331
|
+
return art[placement.key || slugifyPlacementKey(placement.label)] ?? fallback;
|
|
10332
|
+
}
|
|
10333
|
+
|
|
10334
|
+
// src/patterns/ProductPageProvider.tsx
|
|
10335
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10275
10336
|
function ProductPageProvider({
|
|
10276
10337
|
children,
|
|
10277
10338
|
productId,
|
|
@@ -10285,12 +10346,12 @@ function ProductPageProvider({
|
|
|
10285
10346
|
realtimeGrantUrl,
|
|
10286
10347
|
enablePriority = true
|
|
10287
10348
|
}) {
|
|
10288
|
-
let content = /* @__PURE__ */ (0,
|
|
10349
|
+
let content = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Product, { productId, productData, children });
|
|
10289
10350
|
if (enablePriority) {
|
|
10290
|
-
content = /* @__PURE__ */ (0,
|
|
10351
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(MockupPriorityProvider, { children: content });
|
|
10291
10352
|
}
|
|
10292
10353
|
if (enableRealtime) {
|
|
10293
|
-
content = /* @__PURE__ */ (0,
|
|
10354
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10294
10355
|
RealtimeProvider,
|
|
10295
10356
|
{
|
|
10296
10357
|
wsUrl: realtimeWsUrl,
|
|
@@ -10300,7 +10361,7 @@ function ProductPageProvider({
|
|
|
10300
10361
|
}
|
|
10301
10362
|
);
|
|
10302
10363
|
}
|
|
10303
|
-
return /* @__PURE__ */ (0,
|
|
10364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10304
10365
|
Shop,
|
|
10305
10366
|
{
|
|
10306
10367
|
endpoint,
|
|
@@ -10320,23 +10381,23 @@ function ProductPageProviderMinimal({
|
|
|
10320
10381
|
shop,
|
|
10321
10382
|
initialArtwork
|
|
10322
10383
|
}) {
|
|
10323
|
-
return /* @__PURE__ */ (0,
|
|
10384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10324
10385
|
Shop,
|
|
10325
10386
|
{
|
|
10326
10387
|
endpoint,
|
|
10327
10388
|
mockupUrl,
|
|
10328
10389
|
shop,
|
|
10329
10390
|
initialArtwork,
|
|
10330
|
-
children: /* @__PURE__ */ (0,
|
|
10391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Product, { productId, productData, children })
|
|
10331
10392
|
}
|
|
10332
10393
|
);
|
|
10333
10394
|
}
|
|
10334
10395
|
|
|
10335
10396
|
// src/composed/ArtAlignment.tsx
|
|
10336
|
-
var
|
|
10337
|
-
var
|
|
10338
|
-
var
|
|
10339
|
-
var
|
|
10397
|
+
var import_react43 = require("react");
|
|
10398
|
+
var import_react44 = require("@use-gesture/react");
|
|
10399
|
+
var import_sdk11 = require("@snowcone-app/sdk");
|
|
10400
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10340
10401
|
function ArtAlignment({
|
|
10341
10402
|
src: propSrc,
|
|
10342
10403
|
artworkAspectRatio: propAspectRatio,
|
|
@@ -10370,17 +10431,17 @@ function ArtAlignment({
|
|
|
10370
10431
|
selection: {}
|
|
10371
10432
|
};
|
|
10372
10433
|
}
|
|
10373
|
-
const containerRef = (0,
|
|
10374
|
-
const imageRef = (0,
|
|
10375
|
-
const lastUserDragTimeRef = (0,
|
|
10376
|
-
const [containerSize, setContainerSize] = (0,
|
|
10377
|
-
const [position, setPosition] = (0,
|
|
10378
|
-
const [isReady, setIsReady] = (0,
|
|
10379
|
-
const [detectedAspectRatio, setDetectedAspectRatio] = (0,
|
|
10434
|
+
const containerRef = (0, import_react43.useRef)(null);
|
|
10435
|
+
const imageRef = (0, import_react43.useRef)(null);
|
|
10436
|
+
const lastUserDragTimeRef = (0, import_react43.useRef)(0);
|
|
10437
|
+
const [containerSize, setContainerSize] = (0, import_react43.useState)({ width: 0, height: 0 });
|
|
10438
|
+
const [position, setPosition] = (0, import_react43.useState)({ x: 0, y: 0 });
|
|
10439
|
+
const [isReady, setIsReady] = (0, import_react43.useState)(false);
|
|
10440
|
+
const [detectedAspectRatio, setDetectedAspectRatio] = (0, import_react43.useState)();
|
|
10380
10441
|
const effectiveAspectRatio = artworkAspectRatio || detectedAspectRatio;
|
|
10381
10442
|
const alignment = placementDesign?.alignment || propAlignment || "center";
|
|
10382
|
-
const descriptor = (0,
|
|
10383
|
-
() => (0,
|
|
10443
|
+
const descriptor = (0, import_react43.useMemo)(
|
|
10444
|
+
() => (0, import_sdk11.describeProductArtAlignment)(
|
|
10384
10445
|
{
|
|
10385
10446
|
src,
|
|
10386
10447
|
artworkAspectRatio: effectiveAspectRatio,
|
|
@@ -10401,7 +10462,7 @@ function ArtAlignment({
|
|
|
10401
10462
|
productContext
|
|
10402
10463
|
]
|
|
10403
10464
|
);
|
|
10404
|
-
const containerStyle = (0,
|
|
10465
|
+
const containerStyle = (0, import_react43.useMemo)(() => {
|
|
10405
10466
|
const style = {};
|
|
10406
10467
|
if (height !== void 0) {
|
|
10407
10468
|
const heightValue = typeof height === "number" ? height : parseFloat(height);
|
|
@@ -10432,7 +10493,7 @@ function ArtAlignment({
|
|
|
10432
10493
|
}
|
|
10433
10494
|
return style;
|
|
10434
10495
|
}, [effectiveAspectRatio, height, maxHeight, minHeight]);
|
|
10435
|
-
(0,
|
|
10496
|
+
(0, import_react43.useEffect)(() => {
|
|
10436
10497
|
if (!containerRef.current) return;
|
|
10437
10498
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
10438
10499
|
const entry = entries[0];
|
|
@@ -10458,7 +10519,7 @@ function ArtAlignment({
|
|
|
10458
10519
|
}
|
|
10459
10520
|
}
|
|
10460
10521
|
};
|
|
10461
|
-
(0,
|
|
10522
|
+
(0, import_react43.useEffect)(() => {
|
|
10462
10523
|
if (!imageRef.current || !descriptor) return;
|
|
10463
10524
|
if (imageRef.current.complete) {
|
|
10464
10525
|
setIsReady(true);
|
|
@@ -10483,7 +10544,7 @@ function ArtAlignment({
|
|
|
10483
10544
|
img.removeEventListener("load", handleLoad);
|
|
10484
10545
|
};
|
|
10485
10546
|
}, [descriptor?.src, artworkAspectRatio]);
|
|
10486
|
-
const maskDimensions = (0,
|
|
10547
|
+
const maskDimensions = (0, import_react43.useMemo)(() => {
|
|
10487
10548
|
if (!isReady || containerSize.width === 0 || !descriptor) {
|
|
10488
10549
|
return { width: 0, height: 0 };
|
|
10489
10550
|
}
|
|
@@ -10498,17 +10559,17 @@ function ArtAlignment({
|
|
|
10498
10559
|
descriptor?.effectiveAlignment,
|
|
10499
10560
|
isReady
|
|
10500
10561
|
]);
|
|
10501
|
-
const clipPathCoords = (0,
|
|
10562
|
+
const clipPathCoords = (0, import_react43.useMemo)(() => {
|
|
10502
10563
|
const halfMaskW = maskDimensions.width / 2;
|
|
10503
10564
|
const halfMaskH = maskDimensions.height / 2;
|
|
10504
10565
|
const halfContainerW = containerSize.width / 2;
|
|
10505
10566
|
const halfContainerH = containerSize.height / 2;
|
|
10506
10567
|
return { halfMaskW, halfMaskH, halfContainerW, halfContainerH };
|
|
10507
10568
|
}, [maskDimensions.width, maskDimensions.height, containerSize.width, containerSize.height]);
|
|
10508
|
-
(0,
|
|
10569
|
+
(0, import_react43.useEffect)(() => {
|
|
10509
10570
|
if (Date.now() - lastUserDragTimeRef.current < 500) return;
|
|
10510
10571
|
if (!isReady || maskDimensions.width === 0 || !descriptor) return;
|
|
10511
|
-
const points = (0,
|
|
10572
|
+
const points = (0, import_sdk11.getSnapPoints)(
|
|
10512
10573
|
containerSize,
|
|
10513
10574
|
maskDimensions,
|
|
10514
10575
|
descriptor.effectiveAlignment
|
|
@@ -10527,7 +10588,7 @@ function ArtAlignment({
|
|
|
10527
10588
|
maskDimensions.height,
|
|
10528
10589
|
isReady
|
|
10529
10590
|
]);
|
|
10530
|
-
const overlayStyle = (0,
|
|
10591
|
+
const overlayStyle = (0, import_react43.useMemo)(() => {
|
|
10531
10592
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10532
10593
|
const cx = position.x + halfContainerW;
|
|
10533
10594
|
const cy = position.y + halfContainerH;
|
|
@@ -10548,7 +10609,7 @@ function ArtAlignment({
|
|
|
10548
10609
|
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"
|
|
10549
10610
|
};
|
|
10550
10611
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10551
|
-
const maskStyle = (0,
|
|
10612
|
+
const maskStyle = (0, import_react43.useMemo)(() => ({
|
|
10552
10613
|
width: `${maskDimensions.width}px`,
|
|
10553
10614
|
height: `${maskDimensions.height}px`,
|
|
10554
10615
|
boxShadow: `0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary)`,
|
|
@@ -10563,7 +10624,7 @@ function ArtAlignment({
|
|
|
10563
10624
|
// GPU acceleration for smoother drag
|
|
10564
10625
|
borderRadius: "var(--radius-image, 4px)"
|
|
10565
10626
|
}), [maskDimensions.width, maskDimensions.height]);
|
|
10566
|
-
const clearImageClipPath = (0,
|
|
10627
|
+
const clearImageClipPath = (0, import_react43.useMemo)(() => {
|
|
10567
10628
|
if (!isReady) return "none";
|
|
10568
10629
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10569
10630
|
const cx = position.x + halfContainerW;
|
|
@@ -10574,14 +10635,14 @@ function ArtAlignment({
|
|
|
10574
10635
|
const top = cy - halfMaskH;
|
|
10575
10636
|
return `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
|
|
10576
10637
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10577
|
-
const maskTransform = (0,
|
|
10638
|
+
const maskTransform = (0, import_react43.useMemo)(() => {
|
|
10578
10639
|
return descriptor?.effectiveAlignment === "horizontal" ? `translate(calc(-50% + ${position.x}px), -50%)` : `translate(-50%, calc(-50% + ${position.y}px))`;
|
|
10579
10640
|
}, [descriptor?.effectiveAlignment, position.x, position.y]);
|
|
10580
|
-
const lastContextUpdateTimeRef = (0,
|
|
10581
|
-
const pendingAlignmentRef = (0,
|
|
10582
|
-
const throttleTimeoutRef = (0,
|
|
10641
|
+
const lastContextUpdateTimeRef = (0, import_react43.useRef)(0);
|
|
10642
|
+
const pendingAlignmentRef = (0, import_react43.useRef)(null);
|
|
10643
|
+
const throttleTimeoutRef = (0, import_react43.useRef)(null);
|
|
10583
10644
|
const THROTTLE_MS = 150;
|
|
10584
|
-
const bind = (0,
|
|
10645
|
+
const bind = (0, import_react44.useDrag)(
|
|
10585
10646
|
({ offset: [ox, oy], last }) => {
|
|
10586
10647
|
if (maskDimensions.width === 0 || maskDimensions.height === 0 || !descriptor) {
|
|
10587
10648
|
return;
|
|
@@ -10593,7 +10654,7 @@ function ArtAlignment({
|
|
|
10593
10654
|
-maxDistance
|
|
10594
10655
|
);
|
|
10595
10656
|
const positions = Object.entries(
|
|
10596
|
-
(0,
|
|
10657
|
+
(0, import_sdk11.getSnapPoints)(
|
|
10597
10658
|
containerSize,
|
|
10598
10659
|
maskDimensions,
|
|
10599
10660
|
descriptor.effectiveAlignment
|
|
@@ -10606,7 +10667,7 @@ function ArtAlignment({
|
|
|
10606
10667
|
},
|
|
10607
10668
|
["center", Infinity]
|
|
10608
10669
|
);
|
|
10609
|
-
const snapPoints = (0,
|
|
10670
|
+
const snapPoints = (0, import_sdk11.getSnapPoints)(
|
|
10610
10671
|
containerSize,
|
|
10611
10672
|
maskDimensions,
|
|
10612
10673
|
descriptor.effectiveAlignment
|
|
@@ -10674,7 +10735,7 @@ function ArtAlignment({
|
|
|
10674
10735
|
if (!descriptor) {
|
|
10675
10736
|
return null;
|
|
10676
10737
|
}
|
|
10677
|
-
return /* @__PURE__ */ (0,
|
|
10738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10678
10739
|
"div",
|
|
10679
10740
|
{
|
|
10680
10741
|
className: `relative ${className || ""}`,
|
|
@@ -10683,8 +10744,8 @@ function ArtAlignment({
|
|
|
10683
10744
|
width: "fit-content",
|
|
10684
10745
|
maxWidth: "100%"
|
|
10685
10746
|
},
|
|
10686
|
-
children: /* @__PURE__ */ (0,
|
|
10687
|
-
/* @__PURE__ */ (0,
|
|
10747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "overflow-hidden p-1", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { ref: containerRef, className: "relative", style: containerStyle, children: [
|
|
10748
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10688
10749
|
"img",
|
|
10689
10750
|
{
|
|
10690
10751
|
ref: imageRef,
|
|
@@ -10709,9 +10770,9 @@ function ArtAlignment({
|
|
|
10709
10770
|
loading: "eager"
|
|
10710
10771
|
}
|
|
10711
10772
|
),
|
|
10712
|
-
isReady && maskDimensions.width > 0 && /* @__PURE__ */ (0,
|
|
10713
|
-
/* @__PURE__ */ (0,
|
|
10714
|
-
/* @__PURE__ */ (0,
|
|
10773
|
+
isReady && maskDimensions.width > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
10774
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { style: overlayStyle }),
|
|
10775
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10715
10776
|
"img",
|
|
10716
10777
|
{
|
|
10717
10778
|
src: descriptor.src,
|
|
@@ -10739,7 +10800,7 @@ function ArtAlignment({
|
|
|
10739
10800
|
loading: "eager"
|
|
10740
10801
|
}
|
|
10741
10802
|
),
|
|
10742
|
-
/* @__PURE__ */ (0,
|
|
10803
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10743
10804
|
"div",
|
|
10744
10805
|
{
|
|
10745
10806
|
...bind(),
|
|
@@ -10756,8 +10817,8 @@ function ArtAlignment({
|
|
|
10756
10817
|
}
|
|
10757
10818
|
|
|
10758
10819
|
// src/composed/ArtworkCustomizer.tsx
|
|
10759
|
-
var
|
|
10760
|
-
var
|
|
10820
|
+
var import_react45 = require("react");
|
|
10821
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10761
10822
|
function ArtworkCustomizer(props) {
|
|
10762
10823
|
const designContext = useDesign();
|
|
10763
10824
|
const artwork = props.artwork || designContext.selectedArtwork;
|
|
@@ -10769,7 +10830,7 @@ function ArtworkCustomizer(props) {
|
|
|
10769
10830
|
const placements = productCtx?.product?.placements || [];
|
|
10770
10831
|
const selectedPlacement = productCtx?.selectedPlacement;
|
|
10771
10832
|
const setSelectedPlacement = productCtx?.setSelectedPlacement;
|
|
10772
|
-
(0,
|
|
10833
|
+
(0, import_react45.useEffect)(() => {
|
|
10773
10834
|
if (placements.length > 0 && !selectedPlacement && setSelectedPlacement) {
|
|
10774
10835
|
setSelectedPlacement(placements[0].label);
|
|
10775
10836
|
}
|
|
@@ -10779,13 +10840,13 @@ function ArtworkCustomizer(props) {
|
|
|
10779
10840
|
);
|
|
10780
10841
|
const isColorPlacement = currentPlacement?.type === "color";
|
|
10781
10842
|
const isFitMode = currentPlacement?.defaultScaleMode === "fit";
|
|
10782
|
-
(0,
|
|
10843
|
+
(0, import_react45.useEffect)(() => {
|
|
10783
10844
|
}, [selectedPlacement]);
|
|
10784
10845
|
if (!artwork) {
|
|
10785
|
-
return /* @__PURE__ */ (0,
|
|
10846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: `text-sm text-muted-foreground ${props.className || ""}`, children: "Select artwork to customize" });
|
|
10786
10847
|
}
|
|
10787
10848
|
if (artwork.type === "pattern") {
|
|
10788
|
-
return /* @__PURE__ */ (0,
|
|
10849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10789
10850
|
TileCount,
|
|
10790
10851
|
{
|
|
10791
10852
|
artwork,
|
|
@@ -10796,8 +10857,8 @@ function ArtworkCustomizer(props) {
|
|
|
10796
10857
|
);
|
|
10797
10858
|
}
|
|
10798
10859
|
const isCanvasEditorMode = props.mode === "canvas" || !!props.children && props.mode !== "alignment";
|
|
10799
|
-
return /* @__PURE__ */ (0,
|
|
10800
|
-
placements.length > 1 && /* @__PURE__ */ (0,
|
|
10860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
10861
|
+
placements.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "text-sm leading-relaxed", children: placements.map((p) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10801
10862
|
"button",
|
|
10802
10863
|
{
|
|
10803
10864
|
onClick: () => setSelectedPlacement?.(p.label),
|
|
@@ -10806,7 +10867,7 @@ function ArtworkCustomizer(props) {
|
|
|
10806
10867
|
},
|
|
10807
10868
|
p.label
|
|
10808
10869
|
)) }),
|
|
10809
|
-
isColorPlacement ? /* @__PURE__ */ (0,
|
|
10870
|
+
isColorPlacement ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ColorPicker2, { placement: selectedPlacement }) : isFitMode ? null : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "relative", children: props.children || /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10810
10871
|
ArtAlignment,
|
|
10811
10872
|
{
|
|
10812
10873
|
artwork: { src: artwork.src },
|
|
@@ -10822,7 +10883,7 @@ function ArtworkCustomizer(props) {
|
|
|
10822
10883
|
|
|
10823
10884
|
// src/composed/CanvasEditor.tsx
|
|
10824
10885
|
var import_lucide_react2 = require("lucide-react");
|
|
10825
|
-
var
|
|
10886
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10826
10887
|
var ImageIcon = import_lucide_react2.Image;
|
|
10827
10888
|
var TypeIcon = import_lucide_react2.Type;
|
|
10828
10889
|
var ShapesIcon = import_lucide_react2.Shapes;
|
|
@@ -10833,82 +10894,43 @@ function CanvasEditor({
|
|
|
10833
10894
|
onOpenTypography,
|
|
10834
10895
|
children
|
|
10835
10896
|
}) {
|
|
10836
|
-
return /* @__PURE__ */ (0,
|
|
10837
|
-
/* @__PURE__ */ (0,
|
|
10838
|
-
/* @__PURE__ */ (0,
|
|
10839
|
-
/* @__PURE__ */ (0,
|
|
10897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
10898
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "bg-background border-2 border-border rounded-lg aspect-square overflow-hidden relative", children: children || /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "text-muted-foreground text-sm", children: "No editor provided" }) }) }),
|
|
10899
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center justify-center gap-8 py-2", children: [
|
|
10900
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10840
10901
|
"button",
|
|
10841
10902
|
{
|
|
10842
10903
|
onClick: onOpenImageGallery,
|
|
10843
10904
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10844
10905
|
"aria-label": "Open image gallery",
|
|
10845
|
-
children: /* @__PURE__ */ (0,
|
|
10906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ImageIcon, { className: "w-6 h-6" }) })
|
|
10846
10907
|
}
|
|
10847
10908
|
),
|
|
10848
|
-
/* @__PURE__ */ (0,
|
|
10909
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10849
10910
|
"button",
|
|
10850
10911
|
{
|
|
10851
10912
|
onClick: onOpenTypography,
|
|
10852
10913
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10853
10914
|
"aria-label": "Add text",
|
|
10854
|
-
children: /* @__PURE__ */ (0,
|
|
10915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TypeIcon, { className: "w-6 h-6" }) })
|
|
10855
10916
|
}
|
|
10856
10917
|
),
|
|
10857
|
-
/* @__PURE__ */ (0,
|
|
10858
|
-
/* @__PURE__ */ (0,
|
|
10918
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ShapesIcon, { className: "w-6 h-6" }) }) }),
|
|
10919
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(UploadIcon, { className: "w-6 h-6" }) }) })
|
|
10859
10920
|
] })
|
|
10860
10921
|
] });
|
|
10861
10922
|
}
|
|
10862
10923
|
|
|
10863
10924
|
// src/composed/HeroProductImage.tsx
|
|
10864
|
-
var
|
|
10925
|
+
var import_react47 = require("react");
|
|
10865
10926
|
var import_sdk12 = require("@snowcone-app/sdk");
|
|
10866
10927
|
|
|
10867
|
-
// src/composed/heroMockupUrl.ts
|
|
10868
|
-
var import_sdk11 = require("@snowcone-app/sdk");
|
|
10869
|
-
function slugifyPlacementKey(label) {
|
|
10870
|
-
return label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
10871
|
-
}
|
|
10872
|
-
function toPublicDesign(elements, placements) {
|
|
10873
|
-
const design = {};
|
|
10874
|
-
for (const el of elements) {
|
|
10875
|
-
if (!el.placement) continue;
|
|
10876
|
-
const match = placements.find((p) => p.label === el.placement);
|
|
10877
|
-
const key = match?.key || slugifyPlacementKey(el.placement);
|
|
10878
|
-
if (el.type === "color") {
|
|
10879
|
-
if (el.hex) design[key] = { color: el.hex };
|
|
10880
|
-
} else if (el.imageUrl) {
|
|
10881
|
-
const aligned = el.alignment && el.alignment !== "center";
|
|
10882
|
-
design[key] = aligned || el.tiles ? {
|
|
10883
|
-
src: el.imageUrl,
|
|
10884
|
-
...aligned ? { align: el.alignment } : {},
|
|
10885
|
-
...el.tiles ? { tile: el.tiles } : {}
|
|
10886
|
-
} : el.imageUrl;
|
|
10887
|
-
}
|
|
10888
|
-
}
|
|
10889
|
-
return design;
|
|
10890
|
-
}
|
|
10891
|
-
function heroMockupUrl(args) {
|
|
10892
|
-
if (!args.shop) return null;
|
|
10893
|
-
const publicDesign = toPublicDesign(args.design, args.placements);
|
|
10894
|
-
if (Object.keys(publicDesign).length === 0) return null;
|
|
10895
|
-
return (0, import_sdk11.getMockupUrl)(args.productCode, {
|
|
10896
|
-
shop: args.shop,
|
|
10897
|
-
design: publicDesign,
|
|
10898
|
-
..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView, ...args.size.width !== void 0 ? { width: args.size.width } : {} } : { width: args.size.width },
|
|
10899
|
-
view: args.mockupId,
|
|
10900
|
-
variant: args.variantId,
|
|
10901
|
-
...args.bg ? { bg: args.bg } : {},
|
|
10902
|
-
...args.resolver ? { base: args.resolver } : {}
|
|
10903
|
-
});
|
|
10904
|
-
}
|
|
10905
|
-
|
|
10906
10928
|
// src/hooks/viewport/useContainerWidth.ts
|
|
10907
|
-
var
|
|
10929
|
+
var import_react46 = require("react");
|
|
10908
10930
|
function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
10909
|
-
const [width, setWidth] = (0,
|
|
10910
|
-
const resizeTimeoutRef = (0,
|
|
10911
|
-
(0,
|
|
10931
|
+
const [width, setWidth] = (0, import_react46.useState)(0);
|
|
10932
|
+
const resizeTimeoutRef = (0, import_react46.useRef)(null);
|
|
10933
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
10912
10934
|
const el = containerRef.current;
|
|
10913
10935
|
if (!el) return;
|
|
10914
10936
|
const cssWidth = el.offsetWidth;
|
|
@@ -10916,7 +10938,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10916
10938
|
const dpr = window.devicePixelRatio ?? 1;
|
|
10917
10939
|
setWidth(Math.min(Math.round(cssWidth * dpr), maxWidth));
|
|
10918
10940
|
}, [containerRef, maxWidth]);
|
|
10919
|
-
(0,
|
|
10941
|
+
(0, import_react46.useEffect)(() => {
|
|
10920
10942
|
const measure = () => {
|
|
10921
10943
|
const el = containerRef.current;
|
|
10922
10944
|
if (!el) return;
|
|
@@ -10939,11 +10961,14 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10939
10961
|
}
|
|
10940
10962
|
|
|
10941
10963
|
// src/composed/HeroProductImage.tsx
|
|
10942
|
-
var
|
|
10964
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10943
10965
|
function buildHeroMockupUrl(args) {
|
|
10944
10966
|
const snow = typeof window !== "undefined" && window.snowcone || {};
|
|
10945
10967
|
return heroMockupUrl({ ...args, shop: snow.shop, resolver: snow.resolver });
|
|
10946
10968
|
}
|
|
10969
|
+
function artIdentity(src, placementArtKey) {
|
|
10970
|
+
return placementArtKey ? `${src ?? ""}|${placementArtKey}` : src;
|
|
10971
|
+
}
|
|
10947
10972
|
function isCrop(stripView) {
|
|
10948
10973
|
return stripView !== void 0;
|
|
10949
10974
|
}
|
|
@@ -10959,7 +10984,7 @@ function pictureRenderState(s) {
|
|
|
10959
10984
|
if (s.refusal || s.behind && s.sessionError) return "refused";
|
|
10960
10985
|
return s.behind ? "stale" : "current";
|
|
10961
10986
|
}
|
|
10962
|
-
var HeroProductImage = (0,
|
|
10987
|
+
var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
10963
10988
|
productId,
|
|
10964
10989
|
mockupId,
|
|
10965
10990
|
variantId,
|
|
@@ -11003,28 +11028,30 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11003
11028
|
const realtimeContext = useRealtimeOptional();
|
|
11004
11029
|
const priorityContext = useMockupPriorityOptional();
|
|
11005
11030
|
const mockupBg = useMockupBackgroundOptional();
|
|
11006
|
-
const
|
|
11031
|
+
const placementArt = usePlacementArtOptional();
|
|
11032
|
+
const placementArtKey = placementArt ? JSON.stringify(placementArt) : "";
|
|
11033
|
+
const priorityContextRef = (0, import_react47.useRef)(priorityContext);
|
|
11007
11034
|
priorityContextRef.current = priorityContext;
|
|
11008
|
-
const contextRef = (0,
|
|
11035
|
+
const contextRef = (0, import_react47.useRef)(context);
|
|
11009
11036
|
contextRef.current = context;
|
|
11010
11037
|
const actualProductId = product?.id || productId || context?.product?.id;
|
|
11011
|
-
const selectedGvid = (0,
|
|
11038
|
+
const selectedGvid = (0, import_react47.useMemo)(() => {
|
|
11012
11039
|
return (0, import_sdk12.resolveVariantId)(context, gvid, variantId);
|
|
11013
11040
|
}, [gvid, variantId, context?.selection, context?.combinations]);
|
|
11014
|
-
const actualMockupId = (0,
|
|
11041
|
+
const actualMockupId = (0, import_react47.useMemo)(() => {
|
|
11015
11042
|
return (0, import_sdk12.resolveMockupId)(context, selectedGvid, mockupId);
|
|
11016
11043
|
}, [mockupId, selectedGvid, context]);
|
|
11017
|
-
const actualGvid = (0,
|
|
11044
|
+
const actualGvid = (0, import_react47.useMemo)(() => {
|
|
11018
11045
|
return gvid || variantId ? selectedGvid : (0, import_sdk12.resolvePreviewVariantId)(context, selectedGvid, actualMockupId);
|
|
11019
11046
|
}, [gvid, variantId, selectedGvid, actualMockupId, context]);
|
|
11020
11047
|
const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
|
|
11021
11048
|
const artworkSrc = artwork?.src;
|
|
11022
11049
|
const selectedArtworkSrc = designContext?.selectedArtwork?.src;
|
|
11023
11050
|
const effectiveArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
11024
|
-
const containerRef = (0,
|
|
11051
|
+
const containerRef = (0, import_react47.useRef)(null);
|
|
11025
11052
|
const measuredWidth = useContainerWidth(containerRef);
|
|
11026
11053
|
const width = widthProp ?? measuredWidth;
|
|
11027
|
-
const initialStaticUrl = (0,
|
|
11054
|
+
const initialStaticUrl = (0, import_react47.useMemo)(() => {
|
|
11028
11055
|
if (realtimeUrl) return null;
|
|
11029
11056
|
if (mode === "realtime") return null;
|
|
11030
11057
|
if (typeof window !== "undefined" && window.snowcone?.signMockupUrl) {
|
|
@@ -11036,12 +11063,12 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11036
11063
|
const allPlacements = product?.placements || context?.product?.placements || [];
|
|
11037
11064
|
if (allPlacements.length === 0) return null;
|
|
11038
11065
|
const placementDesigns = {};
|
|
11039
|
-
if (designContext?.getPlacementDesign && allPlacements) {
|
|
11066
|
+
if ((designContext?.getPlacementDesign || placementArt) && allPlacements) {
|
|
11040
11067
|
for (const p of allPlacements) {
|
|
11041
11068
|
if (p.type === "color") continue;
|
|
11042
|
-
const design2 = designContext
|
|
11069
|
+
const design2 = designContext?.getPlacementDesign(p.label);
|
|
11043
11070
|
placementDesigns[p.label] = {
|
|
11044
|
-
imageUrl: effectiveArtworkSrc,
|
|
11071
|
+
imageUrl: placementArtFor(placementArt, p, effectiveArtworkSrc),
|
|
11045
11072
|
alignment: design2?.alignment || "center"
|
|
11046
11073
|
};
|
|
11047
11074
|
}
|
|
@@ -11076,6 +11103,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11076
11103
|
images,
|
|
11077
11104
|
width,
|
|
11078
11105
|
effects,
|
|
11106
|
+
placementArt,
|
|
11079
11107
|
// Include placements to trigger recomputation when alignment changes
|
|
11080
11108
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11081
11109
|
JSON.stringify(designContext?.placements)
|
|
@@ -11094,31 +11122,31 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11094
11122
|
shimmerDelay,
|
|
11095
11123
|
initialUrl: realtimeUrl || initialStaticUrl
|
|
11096
11124
|
});
|
|
11097
|
-
const [error, setError] = (0,
|
|
11098
|
-
const [isInPreloadZone, setIsInPreloadZone] = (0,
|
|
11099
|
-
const componentIdRef = (0,
|
|
11125
|
+
const [error, setError] = (0, import_react47.useState)(null);
|
|
11126
|
+
const [isInPreloadZone, setIsInPreloadZone] = (0, import_react47.useState)(true);
|
|
11127
|
+
const componentIdRef = (0, import_react47.useRef)(
|
|
11100
11128
|
`hero-product-image-${Math.random().toString(36).substr(2, 9)}`
|
|
11101
11129
|
);
|
|
11102
|
-
const [containerMounted, setContainerMounted] = (0,
|
|
11103
|
-
const setContainerRef = (0,
|
|
11130
|
+
const [containerMounted, setContainerMounted] = (0, import_react47.useState)(false);
|
|
11131
|
+
const setContainerRef = (0, import_react47.useCallback)((node) => {
|
|
11104
11132
|
containerRef.current = node;
|
|
11105
11133
|
setContainerMounted(!!node);
|
|
11106
11134
|
}, []);
|
|
11107
|
-
const lastUrlRef = (0,
|
|
11108
|
-
const priorityRegisteredRef = (0,
|
|
11109
|
-
const onLoadCalledRef = (0,
|
|
11110
|
-
const prevArtworkSrcRef = (0,
|
|
11111
|
-
const realtimeArtworkSrcRef = (0,
|
|
11112
|
-
const hasReceivedRealtimeRef = (0,
|
|
11113
|
-
const isPendingExportRef = (0,
|
|
11114
|
-
const onUrlGeneratedRef = (0,
|
|
11135
|
+
const lastUrlRef = (0, import_react47.useRef)(realtimeUrl ?? initialStaticUrl ?? null);
|
|
11136
|
+
const priorityRegisteredRef = (0, import_react47.useRef)(false);
|
|
11137
|
+
const onLoadCalledRef = (0, import_react47.useRef)(false);
|
|
11138
|
+
const prevArtworkSrcRef = (0, import_react47.useRef)(void 0);
|
|
11139
|
+
const realtimeArtworkSrcRef = (0, import_react47.useRef)(void 0);
|
|
11140
|
+
const hasReceivedRealtimeRef = (0, import_react47.useRef)(false);
|
|
11141
|
+
const isPendingExportRef = (0, import_react47.useRef)(false);
|
|
11142
|
+
const onUrlGeneratedRef = (0, import_react47.useRef)(onUrlGenerated);
|
|
11115
11143
|
onUrlGeneratedRef.current = onUrlGenerated;
|
|
11116
|
-
const onShownRef = (0,
|
|
11144
|
+
const onShownRef = (0, import_react47.useRef)(onShown);
|
|
11117
11145
|
onShownRef.current = onShown;
|
|
11118
|
-
const presignedUsedRef = (0,
|
|
11119
|
-
const layersLengthRef = (0,
|
|
11146
|
+
const presignedUsedRef = (0, import_react47.useRef)(false);
|
|
11147
|
+
const layersLengthRef = (0, import_react47.useRef)(layers.length);
|
|
11120
11148
|
layersLengthRef.current = layers.length;
|
|
11121
|
-
(0,
|
|
11149
|
+
(0, import_react47.useEffect)(() => {
|
|
11122
11150
|
if (initialPriority === 1) return;
|
|
11123
11151
|
if (!containerMounted || !containerRef.current) return;
|
|
11124
11152
|
if (isInPreloadZone) return;
|
|
@@ -11137,15 +11165,15 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11137
11165
|
);
|
|
11138
11166
|
return unobserve;
|
|
11139
11167
|
}, [containerMounted, initialPriority, isInPreloadZone]);
|
|
11140
|
-
(0,
|
|
11168
|
+
(0, import_react47.useEffect)(() => {
|
|
11141
11169
|
if (!realtimeUrl) return;
|
|
11142
11170
|
if (realtimeUrl === lastUrlRef.current) return;
|
|
11143
11171
|
lastUrlRef.current = realtimeUrl;
|
|
11144
|
-
realtimeArtworkSrcRef.current = artworkSrc || selectedArtworkSrc;
|
|
11172
|
+
realtimeArtworkSrcRef.current = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11145
11173
|
const isInitialLoad = layersLengthRef.current === 0;
|
|
11146
11174
|
addLayerDirectly(realtimeUrl, { skipTransition: isInitialLoad });
|
|
11147
11175
|
}, [realtimeUrl, addLayerDirectly, actualMockupId, placement]);
|
|
11148
|
-
(0,
|
|
11176
|
+
(0, import_react47.useEffect)(() => {
|
|
11149
11177
|
if (mode === "static") {
|
|
11150
11178
|
return;
|
|
11151
11179
|
}
|
|
@@ -11189,7 +11217,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11189
11217
|
addLayerDirectly
|
|
11190
11218
|
// NOTE: layers.length removed - use layersLengthRef instead to prevent duplicate requests
|
|
11191
11219
|
]);
|
|
11192
|
-
(0,
|
|
11220
|
+
(0, import_react47.useEffect)(() => {
|
|
11193
11221
|
if (mode === "static") return;
|
|
11194
11222
|
if (!realtimeContext?.subscribePendingBlob || !placement) return;
|
|
11195
11223
|
const handlePendingExport = (pendingPlacement) => {
|
|
@@ -11202,38 +11230,38 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11202
11230
|
unsubscribe?.();
|
|
11203
11231
|
};
|
|
11204
11232
|
}, [mode, realtimeContext?.subscribePendingBlob, placement]);
|
|
11205
|
-
const renderVersionRef = (0,
|
|
11206
|
-
const arrivedVersionRef = (0,
|
|
11207
|
-
const versionByUrlRef = (0,
|
|
11208
|
-
const loadedUrlRef = (0,
|
|
11209
|
-
const blobConsumerRef = (0,
|
|
11233
|
+
const renderVersionRef = (0, import_react47.useRef)(0);
|
|
11234
|
+
const arrivedVersionRef = (0, import_react47.useRef)(0);
|
|
11235
|
+
const versionByUrlRef = (0, import_react47.useRef)(/* @__PURE__ */ new Map());
|
|
11236
|
+
const loadedUrlRef = (0, import_react47.useRef)(null);
|
|
11237
|
+
const blobConsumerRef = (0, import_react47.useRef)(`el-${Math.random().toString(36).slice(2, 10)}`);
|
|
11210
11238
|
const releaseBlobConsumer = realtimeContext?.releaseBlobConsumer;
|
|
11211
|
-
(0,
|
|
11239
|
+
(0, import_react47.useEffect)(() => {
|
|
11212
11240
|
const id = actualMockupId;
|
|
11213
11241
|
const consumer = blobConsumerRef.current;
|
|
11214
11242
|
return () => {
|
|
11215
11243
|
if (id) releaseBlobConsumer?.(id, consumer);
|
|
11216
11244
|
};
|
|
11217
11245
|
}, [actualMockupId, releaseBlobConsumer]);
|
|
11218
|
-
const frameErrorRef = (0,
|
|
11219
|
-
const showVersionOf = (0,
|
|
11246
|
+
const frameErrorRef = (0, import_react47.useRef)(null);
|
|
11247
|
+
const showVersionOf = (0, import_react47.useCallback)((url) => {
|
|
11220
11248
|
const e = versionByUrlRef.current.get(url);
|
|
11221
11249
|
if (!e || e.v < renderVersionRef.current) return;
|
|
11222
11250
|
renderVersionRef.current = e.v;
|
|
11223
11251
|
renderVersionsRef.current = e.versions;
|
|
11224
11252
|
frameErrorRef.current = null;
|
|
11225
11253
|
}, []);
|
|
11226
|
-
const renderVersionsRef = (0,
|
|
11254
|
+
const renderVersionsRef = (0, import_react47.useRef)(null);
|
|
11227
11255
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
11228
|
-
const refusalCodeRef = (0,
|
|
11256
|
+
const refusalCodeRef = (0, import_react47.useRef)(null);
|
|
11229
11257
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
11230
|
-
const frameFailedRef = (0,
|
|
11258
|
+
const frameFailedRef = (0, import_react47.useRef)(realtimeContext?.frameFailed);
|
|
11231
11259
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
11232
|
-
const sessionErrorCodeRef = (0,
|
|
11260
|
+
const sessionErrorCodeRef = (0, import_react47.useRef)(null);
|
|
11233
11261
|
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
11234
11262
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
11235
11263
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
11236
|
-
const applyRenderStamp = (0,
|
|
11264
|
+
const applyRenderStamp = (0, import_react47.useCallback)(() => {
|
|
11237
11265
|
const node = containerRef.current;
|
|
11238
11266
|
if (!node) return;
|
|
11239
11267
|
if (mode === "static") {
|
|
@@ -11267,12 +11295,12 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11267
11295
|
node.dataset.sessionPhase = shape.phase;
|
|
11268
11296
|
}
|
|
11269
11297
|
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
11270
|
-
const applyRenderStampRef = (0,
|
|
11298
|
+
const applyRenderStampRef = (0, import_react47.useRef)(applyRenderStamp);
|
|
11271
11299
|
applyRenderStampRef.current = applyRenderStamp;
|
|
11272
|
-
(0,
|
|
11300
|
+
(0, import_react47.useEffect)(() => {
|
|
11273
11301
|
applyRenderStamp();
|
|
11274
11302
|
});
|
|
11275
|
-
(0,
|
|
11303
|
+
(0, import_react47.useEffect)(() => {
|
|
11276
11304
|
const subscribeSent = realtimeContext?.subscribeBlobSent;
|
|
11277
11305
|
const subscribeResult = realtimeContext?.subscribeMockupResultById;
|
|
11278
11306
|
if (!actualMockupId || !subscribeSent || !subscribeResult) return;
|
|
@@ -11299,7 +11327,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11299
11327
|
applyRenderStamp
|
|
11300
11328
|
]);
|
|
11301
11329
|
const reportPictureView = realtimeContext?.reportPictureView;
|
|
11302
|
-
(0,
|
|
11330
|
+
(0, import_react47.useEffect)(() => {
|
|
11303
11331
|
if (!viewportPolicy || !reportPictureView || !actualMockupId) return;
|
|
11304
11332
|
const node = containerRef.current;
|
|
11305
11333
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
@@ -11331,7 +11359,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11331
11359
|
reportPictureView(key, null);
|
|
11332
11360
|
};
|
|
11333
11361
|
}, [viewportPolicy, reportPictureView, actualMockupId]);
|
|
11334
|
-
(0,
|
|
11362
|
+
(0, import_react47.useEffect)(() => {
|
|
11335
11363
|
if (!priorityContext || !actualMockupId || !placement) return;
|
|
11336
11364
|
priorityContext.registerMockup(actualMockupId, placement, initialPriority);
|
|
11337
11365
|
priorityRegisteredRef.current = true;
|
|
@@ -11342,7 +11370,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11342
11370
|
}
|
|
11343
11371
|
};
|
|
11344
11372
|
}, [priorityContext, actualMockupId, placement, initialPriority]);
|
|
11345
|
-
(0,
|
|
11373
|
+
(0, import_react47.useEffect)(() => {
|
|
11346
11374
|
if (!priorityContext?.updateElementRef || !actualMockupId) return;
|
|
11347
11375
|
if (containerMounted && containerRef.current) {
|
|
11348
11376
|
priorityContext.updateElementRef(actualMockupId, containerRef.current);
|
|
@@ -11356,8 +11384,8 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11356
11384
|
const artworkTileCount = artwork?.type === "pattern" ? artwork?.tileCount : void 0;
|
|
11357
11385
|
const selectedArtworkType = designContext?.selectedArtwork?.type;
|
|
11358
11386
|
const selectedArtworkTileCount = designContext?.selectedArtwork?.type === "pattern" ? designContext?.selectedArtwork?.tileCount : void 0;
|
|
11359
|
-
(0,
|
|
11360
|
-
const currentSrc = artworkSrc || selectedArtworkSrc;
|
|
11387
|
+
(0, import_react47.useEffect)(() => {
|
|
11388
|
+
const currentSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11361
11389
|
if (currentSrc !== prevArtworkSrcRef.current) {
|
|
11362
11390
|
lastUrlRef.current = null;
|
|
11363
11391
|
prevArtworkSrcRef.current = currentSrc;
|
|
@@ -11365,24 +11393,24 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11365
11393
|
hasReceivedRealtimeRef.current = false;
|
|
11366
11394
|
realtimeArtworkSrcRef.current = void 0;
|
|
11367
11395
|
}
|
|
11368
|
-
}, [artworkSrc, selectedArtworkSrc]);
|
|
11369
|
-
const contextSelectionRef = (0,
|
|
11370
|
-
const contextOptionAttributesRef = (0,
|
|
11396
|
+
}, [artworkSrc, selectedArtworkSrc, placementArtKey]);
|
|
11397
|
+
const contextSelectionRef = (0, import_react47.useRef)(context?.selection);
|
|
11398
|
+
const contextOptionAttributesRef = (0, import_react47.useRef)(context?.optionAttributes);
|
|
11371
11399
|
contextSelectionRef.current = context?.selection;
|
|
11372
11400
|
contextOptionAttributesRef.current = context?.optionAttributes;
|
|
11373
|
-
const createDesignForPlacementsWrapper = (0,
|
|
11401
|
+
const createDesignForPlacementsWrapper = (0, import_react47.useCallback)(
|
|
11374
11402
|
(placements, providedImages) => {
|
|
11375
11403
|
const effectiveArtworkSrc2 = artworkSrc || selectedArtworkSrc;
|
|
11376
11404
|
if (!effectiveArtworkSrc2 || effectiveArtworkSrc2.trim() === "" || effectiveArtworkSrc2 === "undefined" || effectiveArtworkSrc2 === "null") {
|
|
11377
11405
|
return [];
|
|
11378
11406
|
}
|
|
11379
11407
|
const placementDesigns = {};
|
|
11380
|
-
if (getPlacementDesign && placements) {
|
|
11408
|
+
if ((getPlacementDesign || placementArt) && placements) {
|
|
11381
11409
|
for (const p of placements) {
|
|
11382
11410
|
if (p.type === "color") continue;
|
|
11383
|
-
const design = getPlacementDesign(p.label);
|
|
11411
|
+
const design = getPlacementDesign?.(p.label);
|
|
11384
11412
|
placementDesigns[p.label] = {
|
|
11385
|
-
imageUrl: effectiveArtworkSrc2,
|
|
11413
|
+
imageUrl: placementArtFor(placementArt, p, effectiveArtworkSrc2),
|
|
11386
11414
|
alignment: design?.alignment || "center"
|
|
11387
11415
|
};
|
|
11388
11416
|
}
|
|
@@ -11401,6 +11429,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11401
11429
|
},
|
|
11402
11430
|
[
|
|
11403
11431
|
getPlacementDesign,
|
|
11432
|
+
placementArt,
|
|
11404
11433
|
artworkSrc,
|
|
11405
11434
|
artworkType,
|
|
11406
11435
|
artworkTileCount,
|
|
@@ -11409,7 +11438,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11409
11438
|
selectedArtworkTileCount
|
|
11410
11439
|
]
|
|
11411
11440
|
);
|
|
11412
|
-
(0,
|
|
11441
|
+
(0, import_react47.useEffect)(() => {
|
|
11413
11442
|
if (mode === "realtime") return;
|
|
11414
11443
|
if (initialStaticUrl && lastUrlRef.current === initialStaticUrl) {
|
|
11415
11444
|
return;
|
|
@@ -11446,7 +11475,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11446
11475
|
lastUrlRef.current = url;
|
|
11447
11476
|
const hasExistingImage = !!realtimeUrl || layersLengthRef.current > 0;
|
|
11448
11477
|
setError(null);
|
|
11449
|
-
const currentArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
11478
|
+
const currentArtworkSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11450
11479
|
const isRealtimeUrlFresh = realtimeUrl && realtimeArtworkSrcRef.current === currentArtworkSrc;
|
|
11451
11480
|
if (isRealtimeUrlFresh) {
|
|
11452
11481
|
onUrlGeneratedRef.current?.(realtimeUrl);
|
|
@@ -11517,12 +11546,12 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11517
11546
|
const topLayer = layers[layers.length - 1];
|
|
11518
11547
|
const displayUrl = topLayer?.url || realtimeUrl || initialStaticUrl;
|
|
11519
11548
|
const CROSSFADE_MS = 400;
|
|
11520
|
-
const [prevUrl, setPrevUrl] = (0,
|
|
11521
|
-
const [showNew, setShowNew] = (0,
|
|
11522
|
-
const [renderedUrl, setRenderedUrl] = (0,
|
|
11523
|
-
const [firstImageLoaded, setFirstImageLoaded] = (0,
|
|
11524
|
-
const [loaderMounted, setLoaderMounted] = (0,
|
|
11525
|
-
const [imgFailed, setImgFailed] = (0,
|
|
11549
|
+
const [prevUrl, setPrevUrl] = (0, import_react47.useState)(null);
|
|
11550
|
+
const [showNew, setShowNew] = (0, import_react47.useState)(false);
|
|
11551
|
+
const [renderedUrl, setRenderedUrl] = (0, import_react47.useState)(displayUrl);
|
|
11552
|
+
const [firstImageLoaded, setFirstImageLoaded] = (0, import_react47.useState)(false);
|
|
11553
|
+
const [loaderMounted, setLoaderMounted] = (0, import_react47.useState)(true);
|
|
11554
|
+
const [imgFailed, setImgFailed] = (0, import_react47.useState)(false);
|
|
11526
11555
|
const failedSrc = (() => {
|
|
11527
11556
|
if (!imgFailed || !renderedUrl) return void 0;
|
|
11528
11557
|
try {
|
|
@@ -11532,11 +11561,11 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11532
11561
|
return "?";
|
|
11533
11562
|
}
|
|
11534
11563
|
})();
|
|
11535
|
-
const [retryNonce, setRetryNonce] = (0,
|
|
11536
|
-
const retriedUrlRef = (0,
|
|
11537
|
-
const prevDisplayUrlRef = (0,
|
|
11538
|
-
const signHintShownRef = (0,
|
|
11539
|
-
(0,
|
|
11564
|
+
const [retryNonce, setRetryNonce] = (0, import_react47.useState)(0);
|
|
11565
|
+
const retriedUrlRef = (0, import_react47.useRef)(null);
|
|
11566
|
+
const prevDisplayUrlRef = (0, import_react47.useRef)(displayUrl);
|
|
11567
|
+
const signHintShownRef = (0, import_react47.useRef)(false);
|
|
11568
|
+
(0, import_react47.useEffect)(() => {
|
|
11540
11569
|
if (!displayUrl || displayUrl === prevDisplayUrlRef.current) return;
|
|
11541
11570
|
const oldUrl = prevDisplayUrlRef.current;
|
|
11542
11571
|
prevDisplayUrlRef.current = displayUrl;
|
|
@@ -11569,26 +11598,26 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11569
11598
|
preload.onerror = null;
|
|
11570
11599
|
};
|
|
11571
11600
|
}, [displayUrl]);
|
|
11572
|
-
const handleCrossfadeEnd = (0,
|
|
11601
|
+
const handleCrossfadeEnd = (0, import_react47.useCallback)(() => {
|
|
11573
11602
|
setPrevUrl(null);
|
|
11574
11603
|
setShowNew(false);
|
|
11575
11604
|
}, []);
|
|
11576
|
-
const handleLoaderExited = (0,
|
|
11605
|
+
const handleLoaderExited = (0, import_react47.useCallback)(() => setLoaderMounted(false), []);
|
|
11577
11606
|
if (!hasArtwork) {
|
|
11578
|
-
return /* @__PURE__ */ (0,
|
|
11607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11579
11608
|
"div",
|
|
11580
11609
|
{
|
|
11581
11610
|
className: `bg-gray-100 flex items-center justify-center ${className || ""}`,
|
|
11582
11611
|
style,
|
|
11583
|
-
children: /* @__PURE__ */ (0,
|
|
11584
|
-
/* @__PURE__ */ (0,
|
|
11612
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "text-gray-400 text-center p-4", children: [
|
|
11613
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11585
11614
|
"svg",
|
|
11586
11615
|
{
|
|
11587
11616
|
className: "w-8 h-8 mx-auto mb-2",
|
|
11588
11617
|
fill: "none",
|
|
11589
11618
|
stroke: "currentColor",
|
|
11590
11619
|
viewBox: "0 0 24 24",
|
|
11591
|
-
children: /* @__PURE__ */ (0,
|
|
11620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11592
11621
|
"path",
|
|
11593
11622
|
{
|
|
11594
11623
|
strokeLinecap: "round",
|
|
@@ -11599,22 +11628,22 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11599
11628
|
)
|
|
11600
11629
|
}
|
|
11601
11630
|
),
|
|
11602
|
-
/* @__PURE__ */ (0,
|
|
11631
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-xs", children: emptyText })
|
|
11603
11632
|
] })
|
|
11604
11633
|
}
|
|
11605
11634
|
);
|
|
11606
11635
|
}
|
|
11607
11636
|
if (error) {
|
|
11608
|
-
return /* @__PURE__ */ (0,
|
|
11637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11609
11638
|
"div",
|
|
11610
11639
|
{
|
|
11611
11640
|
className: `bg-red-50 flex items-center justify-center ${className || ""}`,
|
|
11612
11641
|
style,
|
|
11613
|
-
children: /* @__PURE__ */ (0,
|
|
11642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "text-red-600 text-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-xs", children: errorText }) })
|
|
11614
11643
|
}
|
|
11615
11644
|
);
|
|
11616
11645
|
}
|
|
11617
|
-
return /* @__PURE__ */ (0,
|
|
11646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
11618
11647
|
"div",
|
|
11619
11648
|
{
|
|
11620
11649
|
ref: setContainerRef,
|
|
@@ -11630,7 +11659,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11630
11659
|
"data-picture-failed-src": failedSrc,
|
|
11631
11660
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|
|
11632
11661
|
children: [
|
|
11633
|
-
unavailable && /* @__PURE__ */ (0,
|
|
11662
|
+
unavailable && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11634
11663
|
"div",
|
|
11635
11664
|
{
|
|
11636
11665
|
role: "status",
|
|
@@ -11639,7 +11668,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11639
11668
|
children: "Mockup unavailable"
|
|
11640
11669
|
}
|
|
11641
11670
|
),
|
|
11642
|
-
renderedUrl && !imgFailed && /* @__PURE__ */ (0,
|
|
11671
|
+
renderedUrl && !imgFailed && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11643
11672
|
"img",
|
|
11644
11673
|
{
|
|
11645
11674
|
alt: `Product mockup${placement ? ` - ${placement}` : ""}`,
|
|
@@ -11688,8 +11717,8 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11688
11717
|
},
|
|
11689
11718
|
retryNonce
|
|
11690
11719
|
),
|
|
11691
|
-
imgFailed && !prevUrl && /* @__PURE__ */ (0,
|
|
11692
|
-
realtimeContext?.renderError && /* @__PURE__ */ (0,
|
|
11720
|
+
imgFailed && !prevUrl && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-muted-foreground text-xs", children: unavailableText }) }),
|
|
11721
|
+
realtimeContext?.renderError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11693
11722
|
"div",
|
|
11694
11723
|
{
|
|
11695
11724
|
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
@@ -11699,7 +11728,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11699
11728
|
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11700
11729
|
}
|
|
11701
11730
|
),
|
|
11702
|
-
prevUrl && /* @__PURE__ */ (0,
|
|
11731
|
+
prevUrl && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11703
11732
|
"img",
|
|
11704
11733
|
{
|
|
11705
11734
|
alt: "",
|
|
@@ -11714,7 +11743,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11714
11743
|
onTransitionEnd: handleCrossfadeEnd
|
|
11715
11744
|
}
|
|
11716
11745
|
),
|
|
11717
|
-
loaderMounted && /* @__PURE__ */ (0,
|
|
11746
|
+
loaderMounted && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11718
11747
|
LoadingOverlayPrismCandyInline,
|
|
11719
11748
|
{
|
|
11720
11749
|
visible: !firstImageLoaded,
|
|
@@ -11728,16 +11757,16 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11728
11757
|
});
|
|
11729
11758
|
|
|
11730
11759
|
// src/composed/SafeImg.tsx
|
|
11731
|
-
var
|
|
11732
|
-
var
|
|
11733
|
-
var SafeImg =
|
|
11760
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
11761
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
11762
|
+
var SafeImg = import_react48.default.forwardRef(
|
|
11734
11763
|
function SafeImg2({ fallback = null, onError, src, ...rest }, ref) {
|
|
11735
|
-
const [failed, setFailed] = (0,
|
|
11736
|
-
(0,
|
|
11764
|
+
const [failed, setFailed] = (0, import_react48.useState)(false);
|
|
11765
|
+
(0, import_react48.useEffect)(() => {
|
|
11737
11766
|
setFailed(false);
|
|
11738
11767
|
}, [src]);
|
|
11739
|
-
if (failed) return /* @__PURE__ */ (0,
|
|
11740
|
-
return /* @__PURE__ */ (0,
|
|
11768
|
+
if (failed) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: fallback });
|
|
11769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11741
11770
|
"img",
|
|
11742
11771
|
{
|
|
11743
11772
|
...rest,
|
|
@@ -11772,11 +11801,11 @@ var { searchClient } = (0, import_instant_meilisearch.instantMeiliSearch)(
|
|
|
11772
11801
|
);
|
|
11773
11802
|
|
|
11774
11803
|
// src/composed/search/SearchProvider.tsx
|
|
11775
|
-
var
|
|
11776
|
-
var
|
|
11804
|
+
var import_react49 = require("react");
|
|
11805
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11777
11806
|
function InitialSearchTrigger() {
|
|
11778
11807
|
const { refine } = (0, import_react_instantsearch.useSearchBox)();
|
|
11779
|
-
(0,
|
|
11808
|
+
(0, import_react49.useEffect)(() => {
|
|
11780
11809
|
refine("");
|
|
11781
11810
|
}, [refine]);
|
|
11782
11811
|
return null;
|
|
@@ -11800,7 +11829,7 @@ function SearchProvider({
|
|
|
11800
11829
|
],
|
|
11801
11830
|
children
|
|
11802
11831
|
}) {
|
|
11803
|
-
return /* @__PURE__ */ (0,
|
|
11832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11804
11833
|
import_react_instantsearch.InstantSearch,
|
|
11805
11834
|
{
|
|
11806
11835
|
searchClient,
|
|
@@ -11828,7 +11857,7 @@ function SearchProvider({
|
|
|
11828
11857
|
}
|
|
11829
11858
|
},
|
|
11830
11859
|
children: [
|
|
11831
|
-
/* @__PURE__ */ (0,
|
|
11860
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11832
11861
|
import_react_instantsearch.Configure,
|
|
11833
11862
|
{
|
|
11834
11863
|
hitsPerPage,
|
|
@@ -11837,7 +11866,7 @@ function SearchProvider({
|
|
|
11837
11866
|
attributesToRetrieve
|
|
11838
11867
|
}
|
|
11839
11868
|
),
|
|
11840
|
-
/* @__PURE__ */ (0,
|
|
11869
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InitialSearchTrigger, {}),
|
|
11841
11870
|
children
|
|
11842
11871
|
]
|
|
11843
11872
|
}
|
|
@@ -11847,17 +11876,17 @@ function SearchProvider({
|
|
|
11847
11876
|
// src/composed/search/SearchBox.tsx
|
|
11848
11877
|
var import_react_instantsearch2 = require("react-instantsearch");
|
|
11849
11878
|
var import_lucide_react3 = require("lucide-react");
|
|
11850
|
-
var
|
|
11851
|
-
var
|
|
11879
|
+
var import_react50 = require("react");
|
|
11880
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11852
11881
|
function SearchBox() {
|
|
11853
11882
|
const { query, refine, clear } = (0, import_react_instantsearch2.useSearchBox)();
|
|
11854
11883
|
const searchParams = useUiSearchParams();
|
|
11855
11884
|
const router = useUiRouter();
|
|
11856
|
-
const inputRef = (0,
|
|
11857
|
-
const [showShimmer, setShowShimmer] = (0,
|
|
11885
|
+
const inputRef = (0, import_react50.useRef)(null);
|
|
11886
|
+
const [showShimmer, setShowShimmer] = (0, import_react50.useState)(false);
|
|
11858
11887
|
const inputId = "search-products-input";
|
|
11859
11888
|
const descriptionId = "search-description";
|
|
11860
|
-
(0,
|
|
11889
|
+
(0, import_react50.useEffect)(() => {
|
|
11861
11890
|
const handleSpotlight = () => {
|
|
11862
11891
|
inputRef.current?.focus();
|
|
11863
11892
|
inputRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -11867,7 +11896,7 @@ function SearchBox() {
|
|
|
11867
11896
|
window.addEventListener("search-spotlight", handleSpotlight);
|
|
11868
11897
|
return () => window.removeEventListener("search-spotlight", handleSpotlight);
|
|
11869
11898
|
}, []);
|
|
11870
|
-
(0,
|
|
11899
|
+
(0, import_react50.useEffect)(() => {
|
|
11871
11900
|
const shouldFocus = searchParams.get("focus") === "search";
|
|
11872
11901
|
if (shouldFocus && inputRef.current) {
|
|
11873
11902
|
const timer = setTimeout(() => {
|
|
@@ -11882,8 +11911,8 @@ function SearchBox() {
|
|
|
11882
11911
|
return () => clearTimeout(timer);
|
|
11883
11912
|
}
|
|
11884
11913
|
}, [searchParams, router]);
|
|
11885
|
-
return /* @__PURE__ */ (0,
|
|
11886
|
-
/* @__PURE__ */ (0,
|
|
11914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("form", { role: "search", onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative", children: [
|
|
11915
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11887
11916
|
Input,
|
|
11888
11917
|
{
|
|
11889
11918
|
ref: inputRef,
|
|
@@ -11892,15 +11921,15 @@ function SearchBox() {
|
|
|
11892
11921
|
value: query,
|
|
11893
11922
|
onChange: (e) => refine(e.target.value),
|
|
11894
11923
|
placeholder: "Search products...",
|
|
11895
|
-
startContent: /* @__PURE__ */ (0,
|
|
11896
|
-
endContent: query ? /* @__PURE__ */ (0,
|
|
11924
|
+
startContent: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_lucide_react3.Search, { className: "w-5 h-5", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11925
|
+
endContent: query ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11897
11926
|
"button",
|
|
11898
11927
|
{
|
|
11899
11928
|
type: "button",
|
|
11900
11929
|
onClick: clear,
|
|
11901
11930
|
className: "hover:text-foreground transition-colors",
|
|
11902
11931
|
"aria-label": "Clear search",
|
|
11903
|
-
children: /* @__PURE__ */ (0,
|
|
11932
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_lucide_react3.X, { className: "w-4 h-4", strokeWidth: 2, "aria-hidden": "true" })
|
|
11904
11933
|
}
|
|
11905
11934
|
) : void 0,
|
|
11906
11935
|
"aria-label": "Search products",
|
|
@@ -11910,11 +11939,11 @@ function SearchBox() {
|
|
|
11910
11939
|
className: "[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"
|
|
11911
11940
|
}
|
|
11912
11941
|
),
|
|
11913
|
-
showShimmer && /* @__PURE__ */ (0,
|
|
11942
|
+
showShimmer && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11914
11943
|
"div",
|
|
11915
11944
|
{
|
|
11916
11945
|
className: "absolute inset-0 pointer-events-none rounded-input z-20 overflow-hidden",
|
|
11917
|
-
children: /* @__PURE__ */ (0,
|
|
11946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11918
11947
|
"div",
|
|
11919
11948
|
{
|
|
11920
11949
|
className: "absolute inset-0",
|
|
@@ -11927,13 +11956,13 @@ function SearchBox() {
|
|
|
11927
11956
|
)
|
|
11928
11957
|
}
|
|
11929
11958
|
),
|
|
11930
|
-
/* @__PURE__ */ (0,
|
|
11959
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("style", { dangerouslySetInnerHTML: { __html: `
|
|
11931
11960
|
@keyframes searchShimmer {
|
|
11932
11961
|
0% { transform: translateX(-100%); }
|
|
11933
11962
|
100% { transform: translateX(100%); }
|
|
11934
11963
|
}
|
|
11935
11964
|
` } }),
|
|
11936
|
-
/* @__PURE__ */ (0,
|
|
11965
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { id: descriptionId, className: "sr-only", children: "Search results will update as you type" })
|
|
11937
11966
|
] }) });
|
|
11938
11967
|
}
|
|
11939
11968
|
|
|
@@ -11941,7 +11970,7 @@ function SearchBox() {
|
|
|
11941
11970
|
var import_react_instantsearch3 = require("react-instantsearch");
|
|
11942
11971
|
|
|
11943
11972
|
// src/composed/search/ProductHit.tsx
|
|
11944
|
-
var
|
|
11973
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11945
11974
|
function ProductHitComponent({
|
|
11946
11975
|
hit: product,
|
|
11947
11976
|
variant = "overlay"
|
|
@@ -11958,12 +11987,12 @@ function ProductHitComponent({
|
|
|
11958
11987
|
}
|
|
11959
11988
|
return "";
|
|
11960
11989
|
};
|
|
11961
|
-
return /* @__PURE__ */ (0,
|
|
11990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11962
11991
|
Product,
|
|
11963
11992
|
{
|
|
11964
11993
|
productId,
|
|
11965
11994
|
productData: product,
|
|
11966
|
-
children: /* @__PURE__ */ (0,
|
|
11995
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11967
11996
|
ProductCard,
|
|
11968
11997
|
{
|
|
11969
11998
|
variant,
|
|
@@ -11984,10 +12013,10 @@ function ProductHitComponent({
|
|
|
11984
12013
|
}
|
|
11985
12014
|
|
|
11986
12015
|
// src/composed/search/ProductGrid.tsx
|
|
11987
|
-
var
|
|
11988
|
-
var
|
|
12016
|
+
var import_react51 = require("react");
|
|
12017
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11989
12018
|
function ProductGridSkeletonItem() {
|
|
11990
|
-
return /* @__PURE__ */ (0,
|
|
12019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "aspect-square bg-muted animate-pulse" });
|
|
11991
12020
|
}
|
|
11992
12021
|
function ProductGrid({
|
|
11993
12022
|
className = "",
|
|
@@ -11997,26 +12026,26 @@ function ProductGrid({
|
|
|
11997
12026
|
}) {
|
|
11998
12027
|
const { nbHits } = (0, import_react_instantsearch3.useStats)();
|
|
11999
12028
|
const { status, results } = (0, import_react_instantsearch3.useInstantSearch)();
|
|
12000
|
-
const [announcement, setAnnouncement] = (0,
|
|
12029
|
+
const [announcement, setAnnouncement] = (0, import_react51.useState)("");
|
|
12001
12030
|
const hitsCount = results?.hits?.length ?? 0;
|
|
12002
12031
|
const showSkeleton = hitsCount === 0 && status !== "error";
|
|
12003
|
-
(0,
|
|
12032
|
+
(0, import_react51.useEffect)(() => {
|
|
12004
12033
|
const timer = setTimeout(() => {
|
|
12005
12034
|
setAnnouncement(`${nbHits} ${nbHits === 1 ? "product" : "products"} found`);
|
|
12006
12035
|
}, 1e3);
|
|
12007
12036
|
return () => clearTimeout(timer);
|
|
12008
12037
|
}, [nbHits]);
|
|
12009
|
-
const HitComponent = (0,
|
|
12038
|
+
const HitComponent = (0, import_react51.useCallback)(({ hit }) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12010
12039
|
ProductHitComponent,
|
|
12011
12040
|
{
|
|
12012
12041
|
hit,
|
|
12013
12042
|
variant
|
|
12014
12043
|
}
|
|
12015
12044
|
), [variant]);
|
|
12016
|
-
return /* @__PURE__ */ (0,
|
|
12017
|
-
/* @__PURE__ */ (0,
|
|
12018
|
-
showSkeleton && /* @__PURE__ */ (0,
|
|
12019
|
-
/* @__PURE__ */ (0,
|
|
12045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className, children: [
|
|
12046
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12047
|
+
showSkeleton && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: `grid ${gridClassName}`, children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ProductGridSkeletonItem, {}, i)) }),
|
|
12048
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: showSkeleton ? "hidden" : "", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12020
12049
|
import_react_instantsearch3.Hits,
|
|
12021
12050
|
{
|
|
12022
12051
|
hitComponent: HitComponent,
|
|
@@ -12031,18 +12060,18 @@ function ProductGrid({
|
|
|
12031
12060
|
}
|
|
12032
12061
|
|
|
12033
12062
|
// src/composed/search/Filters.tsx
|
|
12034
|
-
var
|
|
12063
|
+
var import_react53 = require("react");
|
|
12035
12064
|
|
|
12036
12065
|
// src/composed/search/FiltersButton.tsx
|
|
12037
12066
|
var import_lucide_react4 = require("lucide-react");
|
|
12038
|
-
var
|
|
12067
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12039
12068
|
var SlidersHorizontalIcon = import_lucide_react4.SlidersHorizontal;
|
|
12040
12069
|
function FiltersButton({
|
|
12041
12070
|
onClick,
|
|
12042
12071
|
className = "",
|
|
12043
12072
|
children = "Filters"
|
|
12044
12073
|
}) {
|
|
12045
|
-
return /* @__PURE__ */ (0,
|
|
12074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
12046
12075
|
Button,
|
|
12047
12076
|
{
|
|
12048
12077
|
variant: "field",
|
|
@@ -12050,8 +12079,8 @@ function FiltersButton({
|
|
|
12050
12079
|
className,
|
|
12051
12080
|
"aria-label": "Open filters",
|
|
12052
12081
|
children: [
|
|
12053
|
-
/* @__PURE__ */ (0,
|
|
12054
|
-
/* @__PURE__ */ (0,
|
|
12082
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(SlidersHorizontalIcon, { className: "w-4 h-4" }),
|
|
12083
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { children })
|
|
12055
12084
|
]
|
|
12056
12085
|
}
|
|
12057
12086
|
);
|
|
@@ -12060,15 +12089,15 @@ function FiltersButton({
|
|
|
12060
12089
|
// src/composed/search/FiltersDrawer.tsx
|
|
12061
12090
|
var import_react_instantsearch4 = require("react-instantsearch");
|
|
12062
12091
|
var import_lucide_react5 = require("lucide-react");
|
|
12063
|
-
var
|
|
12092
|
+
var import_react52 = require("react");
|
|
12064
12093
|
var Slider2 = __toESM(require("@radix-ui/react-slider"), 1);
|
|
12065
|
-
var
|
|
12094
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12066
12095
|
var XIcon2 = import_lucide_react5.X;
|
|
12067
12096
|
function FiltersDrawer({ isOpen, onClose }) {
|
|
12068
|
-
const [showCounts, setShowCounts] = (0,
|
|
12097
|
+
const [showCounts, setShowCounts] = (0, import_react52.useState)(false);
|
|
12069
12098
|
const { nbHits } = (0, import_react_instantsearch4.useStats)();
|
|
12070
12099
|
const containerRef = useFocusTrap(isOpen, onClose);
|
|
12071
|
-
(0,
|
|
12100
|
+
(0, import_react52.useEffect)(() => {
|
|
12072
12101
|
if (isOpen) {
|
|
12073
12102
|
document.body.style.overflow = "hidden";
|
|
12074
12103
|
} else {
|
|
@@ -12078,7 +12107,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12078
12107
|
document.body.style.overflow = "";
|
|
12079
12108
|
};
|
|
12080
12109
|
}, [isOpen]);
|
|
12081
|
-
(0,
|
|
12110
|
+
(0, import_react52.useEffect)(() => {
|
|
12082
12111
|
const handleEscape = (e) => {
|
|
12083
12112
|
if (e.key === "Escape" && isOpen) {
|
|
12084
12113
|
onClose();
|
|
@@ -12087,8 +12116,8 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12087
12116
|
document.addEventListener("keydown", handleEscape);
|
|
12088
12117
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
12089
12118
|
}, [isOpen, onClose]);
|
|
12090
|
-
return /* @__PURE__ */ (0,
|
|
12091
|
-
/* @__PURE__ */ (0,
|
|
12119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
12120
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12092
12121
|
"div",
|
|
12093
12122
|
{
|
|
12094
12123
|
className: `fixed inset-0 bg-black/50 z-40 transition-opacity ${isOpen ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
@@ -12096,7 +12125,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12096
12125
|
"aria-hidden": "true"
|
|
12097
12126
|
}
|
|
12098
12127
|
),
|
|
12099
|
-
/* @__PURE__ */ (0,
|
|
12128
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12100
12129
|
"div",
|
|
12101
12130
|
{
|
|
12102
12131
|
ref: containerRef,
|
|
@@ -12105,26 +12134,26 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12105
12134
|
"aria-modal": "true",
|
|
12106
12135
|
"aria-labelledby": "filters-drawer-title",
|
|
12107
12136
|
children: [
|
|
12108
|
-
/* @__PURE__ */ (0,
|
|
12109
|
-
/* @__PURE__ */ (0,
|
|
12110
|
-
/* @__PURE__ */ (0,
|
|
12137
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
12138
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h2", { id: "filters-drawer-title", className: "text-xl font-bold", children: "Filters" }),
|
|
12139
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12111
12140
|
"button",
|
|
12112
12141
|
{
|
|
12113
12142
|
onClick: onClose,
|
|
12114
12143
|
className: "p-2 hover:bg-foreground/5 rounded-full transition-colors",
|
|
12115
12144
|
"aria-label": "Close filters",
|
|
12116
|
-
children: /* @__PURE__ */ (0,
|
|
12145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(XIcon2, { className: "w-5 h-5" })
|
|
12117
12146
|
}
|
|
12118
12147
|
)
|
|
12119
12148
|
] }),
|
|
12120
|
-
/* @__PURE__ */ (0,
|
|
12149
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("p", { className: "text-sm font-caption text-foreground/60", role: "status", "aria-live": "polite", children: [
|
|
12121
12150
|
nbHits.toLocaleString(),
|
|
12122
12151
|
" ",
|
|
12123
12152
|
nbHits === 1 ? "result" : "results"
|
|
12124
12153
|
] }) }),
|
|
12125
|
-
/* @__PURE__ */ (0,
|
|
12126
|
-
/* @__PURE__ */ (0,
|
|
12127
|
-
/* @__PURE__ */ (0,
|
|
12154
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex flex-col gap-8", children: [
|
|
12155
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TagsSection, { showCounts, setShowCounts }),
|
|
12156
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(PriceSection, {})
|
|
12128
12157
|
] }) })
|
|
12129
12158
|
]
|
|
12130
12159
|
}
|
|
@@ -12140,9 +12169,9 @@ function TagsSection({
|
|
|
12140
12169
|
sortBy: ["count:desc", "name:asc"],
|
|
12141
12170
|
limit: 100
|
|
12142
12171
|
});
|
|
12143
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12144
|
-
return /* @__PURE__ */ (0,
|
|
12145
|
-
/* @__PURE__ */ (0,
|
|
12172
|
+
const [isExpanded, setIsExpanded] = (0, import_react52.useState)(true);
|
|
12173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
12174
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12146
12175
|
"button",
|
|
12147
12176
|
{
|
|
12148
12177
|
onClick: () => setIsExpanded(!isExpanded),
|
|
@@ -12150,8 +12179,8 @@ function TagsSection({
|
|
|
12150
12179
|
"aria-expanded": isExpanded,
|
|
12151
12180
|
"aria-controls": "tags-content",
|
|
12152
12181
|
children: [
|
|
12153
|
-
/* @__PURE__ */ (0,
|
|
12154
|
-
/* @__PURE__ */ (0,
|
|
12182
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h3", { className: "text-base font-semibold text-primary", children: "Tags" }),
|
|
12183
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12155
12184
|
"svg",
|
|
12156
12185
|
{
|
|
12157
12186
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -12160,14 +12189,14 @@ function TagsSection({
|
|
|
12160
12189
|
stroke: "currentColor",
|
|
12161
12190
|
strokeWidth: 2.5,
|
|
12162
12191
|
"aria-hidden": "true",
|
|
12163
|
-
children: /* @__PURE__ */ (0,
|
|
12192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
12164
12193
|
}
|
|
12165
12194
|
)
|
|
12166
12195
|
]
|
|
12167
12196
|
}
|
|
12168
12197
|
),
|
|
12169
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12170
|
-
/* @__PURE__ */ (0,
|
|
12198
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "space-y-4", id: "tags-content", children: [
|
|
12199
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Product tags filter", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12171
12200
|
"button",
|
|
12172
12201
|
{
|
|
12173
12202
|
onClick: () => refine(item.value),
|
|
@@ -12178,15 +12207,15 @@ function TagsSection({
|
|
|
12178
12207
|
"aria-label": `${item.isRefined ? "Remove" : "Apply"} ${item.label} filter${showCounts ? ` (${item.count} products)` : ""}`,
|
|
12179
12208
|
"aria-pressed": item.isRefined,
|
|
12180
12209
|
children: [
|
|
12181
|
-
/* @__PURE__ */ (0,
|
|
12182
|
-
showCounts && /* @__PURE__ */ (0,
|
|
12210
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "aria-hidden": "true", children: item.label }),
|
|
12211
|
+
showCounts && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: `text-xs font-caption ${item.isRefined ? "opacity-80" : "opacity-60"}`, "aria-hidden": "true", children: item.count })
|
|
12183
12212
|
]
|
|
12184
12213
|
},
|
|
12185
12214
|
item.value
|
|
12186
12215
|
)) }),
|
|
12187
|
-
/* @__PURE__ */ (0,
|
|
12188
|
-
/* @__PURE__ */ (0,
|
|
12189
|
-
/* @__PURE__ */ (0,
|
|
12216
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center justify-between pt-2", children: [
|
|
12217
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-sm font-label text-foreground/60", id: "show-counts-label", children: "Show counts" }),
|
|
12218
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12190
12219
|
"button",
|
|
12191
12220
|
{
|
|
12192
12221
|
onClick: () => setShowCounts(!showCounts),
|
|
@@ -12194,7 +12223,7 @@ function TagsSection({
|
|
|
12194
12223
|
role: "switch",
|
|
12195
12224
|
"aria-checked": showCounts,
|
|
12196
12225
|
"aria-labelledby": "show-counts-label",
|
|
12197
|
-
children: /* @__PURE__ */ (0,
|
|
12226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12198
12227
|
"span",
|
|
12199
12228
|
{
|
|
12200
12229
|
className: `inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform ${showCounts ? "translate-x-6" : "translate-x-1"}`,
|
|
@@ -12211,11 +12240,11 @@ function PriceSection() {
|
|
|
12211
12240
|
const { range, refine, start, canRefine } = (0, import_react_instantsearch4.useRange)({ attribute: "price" });
|
|
12212
12241
|
const rangeMin = typeof range.min === "number" && isFinite(range.min) ? range.min : 0;
|
|
12213
12242
|
const rangeMax = typeof range.max === "number" && isFinite(range.max) ? range.max : 15e3;
|
|
12214
|
-
const [localRange, setLocalRange] = (0,
|
|
12243
|
+
const [localRange, setLocalRange] = (0, import_react52.useState)([
|
|
12215
12244
|
typeof start?.[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
12216
12245
|
typeof start?.[1] === "number" && isFinite(start[1]) ? start[1] : rangeMax
|
|
12217
12246
|
]);
|
|
12218
|
-
(0,
|
|
12247
|
+
(0, import_react52.useEffect)(() => {
|
|
12219
12248
|
if (start && Array.isArray(start)) {
|
|
12220
12249
|
setLocalRange([
|
|
12221
12250
|
typeof start[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
@@ -12225,7 +12254,7 @@ function PriceSection() {
|
|
|
12225
12254
|
setLocalRange([rangeMin, rangeMax]);
|
|
12226
12255
|
}
|
|
12227
12256
|
}, [start, rangeMin, rangeMax]);
|
|
12228
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12257
|
+
const [isExpanded, setIsExpanded] = (0, import_react52.useState)(true);
|
|
12229
12258
|
if (!canRefine) {
|
|
12230
12259
|
return null;
|
|
12231
12260
|
}
|
|
@@ -12240,8 +12269,8 @@ function PriceSection() {
|
|
|
12240
12269
|
return `$${priceInDollars.toFixed(2)}`;
|
|
12241
12270
|
}
|
|
12242
12271
|
};
|
|
12243
|
-
return /* @__PURE__ */ (0,
|
|
12244
|
-
/* @__PURE__ */ (0,
|
|
12272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
12273
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12245
12274
|
"button",
|
|
12246
12275
|
{
|
|
12247
12276
|
onClick: () => setIsExpanded(!isExpanded),
|
|
@@ -12249,8 +12278,8 @@ function PriceSection() {
|
|
|
12249
12278
|
"aria-expanded": isExpanded,
|
|
12250
12279
|
"aria-controls": "price-content",
|
|
12251
12280
|
children: [
|
|
12252
|
-
/* @__PURE__ */ (0,
|
|
12253
|
-
/* @__PURE__ */ (0,
|
|
12281
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h3", { className: "text-base font-semibold text-primary", children: "Price" }),
|
|
12282
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12254
12283
|
"svg",
|
|
12255
12284
|
{
|
|
12256
12285
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -12259,22 +12288,22 @@ function PriceSection() {
|
|
|
12259
12288
|
stroke: "currentColor",
|
|
12260
12289
|
strokeWidth: 2.5,
|
|
12261
12290
|
"aria-hidden": "true",
|
|
12262
|
-
children: /* @__PURE__ */ (0,
|
|
12291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
12263
12292
|
}
|
|
12264
12293
|
)
|
|
12265
12294
|
]
|
|
12266
12295
|
}
|
|
12267
12296
|
),
|
|
12268
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12269
|
-
/* @__PURE__ */ (0,
|
|
12270
|
-
/* @__PURE__ */ (0,
|
|
12271
|
-
/* @__PURE__ */ (0,
|
|
12297
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "space-y-6", id: "price-content", children: [
|
|
12298
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center justify-between text-sm font-display", children: [
|
|
12299
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: formatPrice2(localRange[0]) }),
|
|
12300
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-foreground/70", children: formatPrice2(localRange[1]) })
|
|
12272
12301
|
] }),
|
|
12273
|
-
/* @__PURE__ */ (0,
|
|
12302
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.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) => {
|
|
12274
12303
|
const totalBars = 19;
|
|
12275
12304
|
const barPrice = rangeMin + (rangeMax - rangeMin) / totalBars * i;
|
|
12276
12305
|
const isInRange = barPrice >= localRange[0] && barPrice <= localRange[1];
|
|
12277
|
-
return /* @__PURE__ */ (0,
|
|
12306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12278
12307
|
"div",
|
|
12279
12308
|
{
|
|
12280
12309
|
className: `flex-1 rounded-t-sm transition-opacity ${isInRange ? "bg-foreground" : "bg-foreground/20"}`,
|
|
@@ -12283,7 +12312,7 @@ function PriceSection() {
|
|
|
12283
12312
|
i
|
|
12284
12313
|
);
|
|
12285
12314
|
}) }),
|
|
12286
|
-
/* @__PURE__ */ (0,
|
|
12315
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { style: { touchAction: "none" }, className: "my-6", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12287
12316
|
Slider2.Root,
|
|
12288
12317
|
{
|
|
12289
12318
|
className: "relative flex w-full touch-none select-none items-center",
|
|
@@ -12301,8 +12330,8 @@ function PriceSection() {
|
|
|
12301
12330
|
step: 1,
|
|
12302
12331
|
minStepsBetweenThumbs: 1,
|
|
12303
12332
|
children: [
|
|
12304
|
-
/* @__PURE__ */ (0,
|
|
12305
|
-
/* @__PURE__ */ (0,
|
|
12333
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Slider2.Track, { className: "relative h-3 w-full grow overflow-hidden rounded-full bg-foreground/20", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Slider2.Range, { className: "absolute h-full bg-foreground" }) }),
|
|
12334
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12306
12335
|
Slider2.Thumb,
|
|
12307
12336
|
{
|
|
12308
12337
|
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",
|
|
@@ -12316,7 +12345,7 @@ function PriceSection() {
|
|
|
12316
12345
|
"aria-valuetext": formatPrice2(localRange[0])
|
|
12317
12346
|
}
|
|
12318
12347
|
),
|
|
12319
|
-
/* @__PURE__ */ (0,
|
|
12348
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12320
12349
|
Slider2.Thumb,
|
|
12321
12350
|
{
|
|
12322
12351
|
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",
|
|
@@ -12333,10 +12362,10 @@ function PriceSection() {
|
|
|
12333
12362
|
]
|
|
12334
12363
|
}
|
|
12335
12364
|
) }),
|
|
12336
|
-
/* @__PURE__ */ (0,
|
|
12337
|
-
/* @__PURE__ */ (0,
|
|
12338
|
-
/* @__PURE__ */ (0,
|
|
12339
|
-
/* @__PURE__ */ (0,
|
|
12365
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
12366
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { children: [
|
|
12367
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: "price-min", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Min" }),
|
|
12368
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12340
12369
|
"input",
|
|
12341
12370
|
{
|
|
12342
12371
|
id: "price-min",
|
|
@@ -12354,9 +12383,9 @@ function PriceSection() {
|
|
|
12354
12383
|
}
|
|
12355
12384
|
)
|
|
12356
12385
|
] }),
|
|
12357
|
-
/* @__PURE__ */ (0,
|
|
12358
|
-
/* @__PURE__ */ (0,
|
|
12359
|
-
/* @__PURE__ */ (0,
|
|
12386
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { children: [
|
|
12387
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("label", { htmlFor: "price-max", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Max" }),
|
|
12388
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12360
12389
|
"input",
|
|
12361
12390
|
{
|
|
12362
12391
|
id: "price-max",
|
|
@@ -12380,11 +12409,11 @@ function PriceSection() {
|
|
|
12380
12409
|
}
|
|
12381
12410
|
|
|
12382
12411
|
// src/composed/search/Filters.tsx
|
|
12383
|
-
var
|
|
12412
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
12384
12413
|
function Filters({ buttonClassName, buttonText }) {
|
|
12385
|
-
const [isOpen, setIsOpen] = (0,
|
|
12386
|
-
return /* @__PURE__ */ (0,
|
|
12387
|
-
/* @__PURE__ */ (0,
|
|
12414
|
+
const [isOpen, setIsOpen] = (0, import_react53.useState)(false);
|
|
12415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
12416
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12388
12417
|
FiltersButton,
|
|
12389
12418
|
{
|
|
12390
12419
|
onClick: () => setIsOpen(true),
|
|
@@ -12392,14 +12421,14 @@ function Filters({ buttonClassName, buttonText }) {
|
|
|
12392
12421
|
children: buttonText
|
|
12393
12422
|
}
|
|
12394
12423
|
),
|
|
12395
|
-
/* @__PURE__ */ (0,
|
|
12424
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FiltersDrawer, { isOpen, onClose: () => setIsOpen(false) })
|
|
12396
12425
|
] });
|
|
12397
12426
|
}
|
|
12398
12427
|
|
|
12399
12428
|
// src/composed/search/CurrentRefinements.tsx
|
|
12400
12429
|
var import_react_instantsearch5 = require("react-instantsearch");
|
|
12401
12430
|
var import_lucide_react6 = require("lucide-react");
|
|
12402
|
-
var
|
|
12431
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
12403
12432
|
var XIcon3 = import_lucide_react6.X;
|
|
12404
12433
|
var MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
12405
12434
|
var MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
@@ -12447,15 +12476,15 @@ function CurrentRefinements() {
|
|
|
12447
12476
|
if (allRefinements.length === 0) {
|
|
12448
12477
|
return null;
|
|
12449
12478
|
}
|
|
12450
|
-
return /* @__PURE__ */ (0,
|
|
12479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.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_runtime71.jsxs)(
|
|
12451
12480
|
"button",
|
|
12452
12481
|
{
|
|
12453
12482
|
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",
|
|
12454
12483
|
onClick: () => refinement.refine(),
|
|
12455
12484
|
"aria-label": `Remove filter: ${refinement.displayLabel}`,
|
|
12456
12485
|
children: [
|
|
12457
|
-
/* @__PURE__ */ (0,
|
|
12458
|
-
/* @__PURE__ */ (0,
|
|
12486
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "truncate", children: refinement.displayLabel }),
|
|
12487
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(XIcon3, { className: "w-3 h-3" })
|
|
12459
12488
|
]
|
|
12460
12489
|
},
|
|
12461
12490
|
`${refinement.attribute}-${refinement.value}-${index}`
|
|
@@ -12479,12 +12508,12 @@ var FACET_SECTIONS = [
|
|
|
12479
12508
|
];
|
|
12480
12509
|
|
|
12481
12510
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12482
|
-
var
|
|
12511
|
+
var import_react56 = require("react");
|
|
12483
12512
|
|
|
12484
12513
|
// src/composed/zoom/ZoomOverlay.tsx
|
|
12485
|
-
var
|
|
12514
|
+
var import_react54 = require("react");
|
|
12486
12515
|
var import_lucide_react7 = require("lucide-react");
|
|
12487
|
-
var
|
|
12516
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
12488
12517
|
var PlusIcon2 = import_lucide_react7.Plus;
|
|
12489
12518
|
var MinusIcon2 = import_lucide_react7.Minus;
|
|
12490
12519
|
function ZoomOverlay({
|
|
@@ -12496,13 +12525,13 @@ function ZoomOverlay({
|
|
|
12496
12525
|
className,
|
|
12497
12526
|
style
|
|
12498
12527
|
}) {
|
|
12499
|
-
const [zoomedImageIndex, setZoomedImageIndex] = (0,
|
|
12500
|
-
const [zoomOrigin, setZoomOrigin] = (0,
|
|
12501
|
-
const [hoveredImageIndex, setHoveredImageIndex] = (0,
|
|
12502
|
-
const [cursorPos, setCursorPos] = (0,
|
|
12503
|
-
const [announcement, setAnnouncement] = (0,
|
|
12504
|
-
const [isZooming, setIsZooming] = (0,
|
|
12505
|
-
const handleZoomClick = (0,
|
|
12528
|
+
const [zoomedImageIndex, setZoomedImageIndex] = (0, import_react54.useState)(null);
|
|
12529
|
+
const [zoomOrigin, setZoomOrigin] = (0, import_react54.useState)({ x: 50, y: 50 });
|
|
12530
|
+
const [hoveredImageIndex, setHoveredImageIndex] = (0, import_react54.useState)(null);
|
|
12531
|
+
const [cursorPos, setCursorPos] = (0, import_react54.useState)({ x: 0, y: 0 });
|
|
12532
|
+
const [announcement, setAnnouncement] = (0, import_react54.useState)("");
|
|
12533
|
+
const [isZooming, setIsZooming] = (0, import_react54.useState)(false);
|
|
12534
|
+
const handleZoomClick = (0, import_react54.useCallback)(
|
|
12506
12535
|
(e) => {
|
|
12507
12536
|
e.stopPropagation();
|
|
12508
12537
|
if (isLargeTouchDevice && onEnhancedViewer) {
|
|
@@ -12527,7 +12556,7 @@ function ZoomOverlay({
|
|
|
12527
12556
|
},
|
|
12528
12557
|
[zoomedImageIndex, isLargeTouchDevice, onEnhancedViewer, imageIndex]
|
|
12529
12558
|
);
|
|
12530
|
-
const handleZoomMouseMove = (0,
|
|
12559
|
+
const handleZoomMouseMove = (0, import_react54.useCallback)(
|
|
12531
12560
|
(e) => {
|
|
12532
12561
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
12533
12562
|
if (zoomedImageIndex === imageIndex) {
|
|
@@ -12543,9 +12572,9 @@ function ZoomOverlay({
|
|
|
12543
12572
|
const isZoomed = zoomedImageIndex === imageIndex;
|
|
12544
12573
|
const isHovered = hoveredImageIndex === imageIndex;
|
|
12545
12574
|
const cursorStyle = isLargeTouchDevice ? "pointer" : isTouchDevice ? "default" : "none";
|
|
12546
|
-
return /* @__PURE__ */ (0,
|
|
12547
|
-
/* @__PURE__ */ (0,
|
|
12548
|
-
/* @__PURE__ */ (0,
|
|
12575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
12576
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12577
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12549
12578
|
"div",
|
|
12550
12579
|
{
|
|
12551
12580
|
className,
|
|
@@ -12553,7 +12582,7 @@ function ZoomOverlay({
|
|
|
12553
12582
|
...style,
|
|
12554
12583
|
position: "relative"
|
|
12555
12584
|
},
|
|
12556
|
-
children: /* @__PURE__ */ (0,
|
|
12585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12557
12586
|
"div",
|
|
12558
12587
|
{
|
|
12559
12588
|
style: {
|
|
@@ -12576,7 +12605,7 @@ function ZoomOverlay({
|
|
|
12576
12605
|
handleZoomClick(e);
|
|
12577
12606
|
}
|
|
12578
12607
|
},
|
|
12579
|
-
children: /* @__PURE__ */ (0,
|
|
12608
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12580
12609
|
"div",
|
|
12581
12610
|
{
|
|
12582
12611
|
style: {
|
|
@@ -12592,7 +12621,7 @@ function ZoomOverlay({
|
|
|
12592
12621
|
)
|
|
12593
12622
|
}
|
|
12594
12623
|
),
|
|
12595
|
-
isHovered && !isTouchDevice && /* @__PURE__ */ (0,
|
|
12624
|
+
isHovered && !isTouchDevice && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12596
12625
|
"div",
|
|
12597
12626
|
{
|
|
12598
12627
|
className: "fixed pointer-events-none z-50 hidden md:block",
|
|
@@ -12602,7 +12631,7 @@ function ZoomOverlay({
|
|
|
12602
12631
|
transform: "translate(-50%, -50%)"
|
|
12603
12632
|
},
|
|
12604
12633
|
"aria-hidden": "true",
|
|
12605
|
-
children: /* @__PURE__ */ (0,
|
|
12634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.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_runtime72.jsx)(
|
|
12606
12635
|
MinusIcon2,
|
|
12607
12636
|
{
|
|
12608
12637
|
size: 20,
|
|
@@ -12610,7 +12639,7 @@ function ZoomOverlay({
|
|
|
12610
12639
|
strokeWidth: 1.5,
|
|
12611
12640
|
"aria-hidden": "true"
|
|
12612
12641
|
}
|
|
12613
|
-
) : /* @__PURE__ */ (0,
|
|
12642
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
12614
12643
|
PlusIcon2,
|
|
12615
12644
|
{
|
|
12616
12645
|
size: 20,
|
|
@@ -12625,11 +12654,11 @@ function ZoomOverlay({
|
|
|
12625
12654
|
}
|
|
12626
12655
|
|
|
12627
12656
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12628
|
-
var
|
|
12657
|
+
var import_react55 = require("react");
|
|
12629
12658
|
var import_react_dom3 = require("react-dom");
|
|
12630
12659
|
var import_react_zoom_pan_pinch = require("react-zoom-pan-pinch");
|
|
12631
12660
|
var import_lucide_react8 = require("lucide-react");
|
|
12632
|
-
var
|
|
12661
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
12633
12662
|
var TransformWrapper = import_react_zoom_pan_pinch.TransformWrapper;
|
|
12634
12663
|
var TransformComponent = import_react_zoom_pan_pinch.TransformComponent;
|
|
12635
12664
|
var EnhancedImageViewer = ({
|
|
@@ -12640,17 +12669,17 @@ var EnhancedImageViewer = ({
|
|
|
12640
12669
|
onIndexChange,
|
|
12641
12670
|
currentIndex: propCurrentIndex
|
|
12642
12671
|
}) => {
|
|
12643
|
-
const [isMounted, setIsMounted] = (0,
|
|
12644
|
-
const [isClient, setIsClient] = (0,
|
|
12645
|
-
const [scale, setScale] = (0,
|
|
12646
|
-
const [cropDimensions, setCropDimensions] = (0,
|
|
12647
|
-
const [currentZoomScale, setCurrentZoomScale] = (0,
|
|
12648
|
-
const imgRef = (0,
|
|
12649
|
-
const touchStartRef = (0,
|
|
12672
|
+
const [isMounted, setIsMounted] = (0, import_react55.useState)(false);
|
|
12673
|
+
const [isClient, setIsClient] = (0, import_react55.useState)(false);
|
|
12674
|
+
const [scale, setScale] = (0, import_react55.useState)({ initial: 1, min: 1, max: 8 });
|
|
12675
|
+
const [cropDimensions, setCropDimensions] = (0, import_react55.useState)({ width: 0, height: 0 });
|
|
12676
|
+
const [currentZoomScale, setCurrentZoomScale] = (0, import_react55.useState)(1);
|
|
12677
|
+
const imgRef = (0, import_react55.useRef)(null);
|
|
12678
|
+
const touchStartRef = (0, import_react55.useRef)(
|
|
12650
12679
|
null
|
|
12651
12680
|
);
|
|
12652
|
-
const isSwipingRef = (0,
|
|
12653
|
-
const calculateScale = (0,
|
|
12681
|
+
const isSwipingRef = (0, import_react55.useRef)(false);
|
|
12682
|
+
const calculateScale = (0, import_react55.useCallback)(() => {
|
|
12654
12683
|
const viewport = {
|
|
12655
12684
|
width: window.innerWidth,
|
|
12656
12685
|
height: window.innerHeight
|
|
@@ -12662,10 +12691,10 @@ var EnhancedImageViewer = ({
|
|
|
12662
12691
|
max: 8
|
|
12663
12692
|
});
|
|
12664
12693
|
}, []);
|
|
12665
|
-
const handleImageLoad = (0,
|
|
12694
|
+
const handleImageLoad = (0, import_react55.useCallback)(() => {
|
|
12666
12695
|
calculateScale();
|
|
12667
12696
|
}, [calculateScale]);
|
|
12668
|
-
(0,
|
|
12697
|
+
(0, import_react55.useLayoutEffect)(() => {
|
|
12669
12698
|
setIsClient(true);
|
|
12670
12699
|
setIsMounted(true);
|
|
12671
12700
|
document.body.style.overflow = "hidden";
|
|
@@ -12674,17 +12703,17 @@ var EnhancedImageViewer = ({
|
|
|
12674
12703
|
document.body.style.overflow = "";
|
|
12675
12704
|
};
|
|
12676
12705
|
}, [calculateScale]);
|
|
12677
|
-
(0,
|
|
12706
|
+
(0, import_react55.useEffect)(() => {
|
|
12678
12707
|
calculateScale();
|
|
12679
12708
|
}, [calculateScale]);
|
|
12680
|
-
(0,
|
|
12709
|
+
(0, import_react55.useEffect)(() => {
|
|
12681
12710
|
const handleResize = () => {
|
|
12682
12711
|
calculateScale();
|
|
12683
12712
|
};
|
|
12684
12713
|
window.addEventListener("resize", handleResize);
|
|
12685
12714
|
return () => window.removeEventListener("resize", handleResize);
|
|
12686
12715
|
}, [calculateScale]);
|
|
12687
|
-
(0,
|
|
12716
|
+
(0, import_react55.useEffect)(() => {
|
|
12688
12717
|
const handleKeyDown = (e) => {
|
|
12689
12718
|
if (e.key === "Escape") {
|
|
12690
12719
|
onClose();
|
|
@@ -12710,7 +12739,7 @@ var EnhancedImageViewer = ({
|
|
|
12710
12739
|
document.addEventListener("keydown", handleKeyDown);
|
|
12711
12740
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12712
12741
|
}, [onClose, imageUrl, images, onIndexChange, propCurrentIndex]);
|
|
12713
|
-
const handleSwipeNavigation = (0,
|
|
12742
|
+
const handleSwipeNavigation = (0, import_react55.useCallback)(
|
|
12714
12743
|
(direction) => {
|
|
12715
12744
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12716
12745
|
if (currentIndex === -1) {
|
|
@@ -12731,7 +12760,7 @@ var EnhancedImageViewer = ({
|
|
|
12731
12760
|
},
|
|
12732
12761
|
[propCurrentIndex, images, imageUrl, onIndexChange]
|
|
12733
12762
|
);
|
|
12734
|
-
const handleTouchStart = (0,
|
|
12763
|
+
const handleTouchStart = (0, import_react55.useCallback)(
|
|
12735
12764
|
(e) => {
|
|
12736
12765
|
const isAtInitialZoom = Math.abs(currentZoomScale - scale.initial) < 0.1;
|
|
12737
12766
|
if (!isAtInitialZoom) return;
|
|
@@ -12745,7 +12774,7 @@ var EnhancedImageViewer = ({
|
|
|
12745
12774
|
},
|
|
12746
12775
|
[currentZoomScale, scale.initial]
|
|
12747
12776
|
);
|
|
12748
|
-
const handleTouchEnd = (0,
|
|
12777
|
+
const handleTouchEnd = (0, import_react55.useCallback)(
|
|
12749
12778
|
(e) => {
|
|
12750
12779
|
if (!touchStartRef.current) return;
|
|
12751
12780
|
const touch = e.changedTouches[0];
|
|
@@ -12769,12 +12798,12 @@ var EnhancedImageViewer = ({
|
|
|
12769
12798
|
);
|
|
12770
12799
|
if (!isMounted || !isClient) {
|
|
12771
12800
|
return (0, import_react_dom3.createPortal)(
|
|
12772
|
-
/* @__PURE__ */ (0,
|
|
12801
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12773
12802
|
"div",
|
|
12774
12803
|
{
|
|
12775
12804
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
12776
12805
|
style: { zIndex: 999999 },
|
|
12777
|
-
children: /* @__PURE__ */ (0,
|
|
12806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12778
12807
|
"div",
|
|
12779
12808
|
{
|
|
12780
12809
|
style: {
|
|
@@ -12790,7 +12819,7 @@ var EnhancedImageViewer = ({
|
|
|
12790
12819
|
);
|
|
12791
12820
|
}
|
|
12792
12821
|
return (0, import_react_dom3.createPortal)(
|
|
12793
|
-
/* @__PURE__ */ (0,
|
|
12822
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
12794
12823
|
"div",
|
|
12795
12824
|
{
|
|
12796
12825
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
@@ -12799,7 +12828,7 @@ var EnhancedImageViewer = ({
|
|
|
12799
12828
|
"aria-modal": "true",
|
|
12800
12829
|
"aria-label": "Image viewer",
|
|
12801
12830
|
children: [
|
|
12802
|
-
/* @__PURE__ */ (0,
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12803
12832
|
"button",
|
|
12804
12833
|
{
|
|
12805
12834
|
onClick: (e) => {
|
|
@@ -12825,10 +12854,10 @@ var EnhancedImageViewer = ({
|
|
|
12825
12854
|
touchAction: "manipulation",
|
|
12826
12855
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
12827
12856
|
},
|
|
12828
|
-
children: /* @__PURE__ */ (0,
|
|
12857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_lucide_react8.X, { className: "w-7 h-7", strokeWidth: 2.5 })
|
|
12829
12858
|
}
|
|
12830
12859
|
),
|
|
12831
|
-
/* @__PURE__ */ (0,
|
|
12860
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12832
12861
|
TransformWrapper,
|
|
12833
12862
|
{
|
|
12834
12863
|
initialScale: scale.initial,
|
|
@@ -12862,7 +12891,7 @@ var EnhancedImageViewer = ({
|
|
|
12862
12891
|
onTransformed: (ref) => {
|
|
12863
12892
|
setCurrentZoomScale(ref.state.scale);
|
|
12864
12893
|
},
|
|
12865
|
-
children: ({ zoomIn, zoomOut, resetTransform }) => /* @__PURE__ */ (0,
|
|
12894
|
+
children: ({ zoomIn, zoomOut, resetTransform }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
12866
12895
|
"div",
|
|
12867
12896
|
{
|
|
12868
12897
|
style: {
|
|
@@ -12875,14 +12904,14 @@ var EnhancedImageViewer = ({
|
|
|
12875
12904
|
onTouchStart: handleTouchStart,
|
|
12876
12905
|
onTouchEnd: handleTouchEnd,
|
|
12877
12906
|
children: [
|
|
12878
|
-
/* @__PURE__ */ (0,
|
|
12907
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12879
12908
|
TransformComponent,
|
|
12880
12909
|
{
|
|
12881
12910
|
wrapperStyle: {
|
|
12882
12911
|
width: "100%",
|
|
12883
12912
|
height: "100%"
|
|
12884
12913
|
},
|
|
12885
|
-
children: /* @__PURE__ */ (0,
|
|
12914
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12886
12915
|
"div",
|
|
12887
12916
|
{
|
|
12888
12917
|
style: {
|
|
@@ -12893,7 +12922,7 @@ var EnhancedImageViewer = ({
|
|
|
12893
12922
|
alignItems: "center",
|
|
12894
12923
|
justifyContent: "center"
|
|
12895
12924
|
},
|
|
12896
|
-
children: /* @__PURE__ */ (0,
|
|
12925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12897
12926
|
SafeImg,
|
|
12898
12927
|
{
|
|
12899
12928
|
ref: imgRef,
|
|
@@ -12914,8 +12943,8 @@ var EnhancedImageViewer = ({
|
|
|
12914
12943
|
)
|
|
12915
12944
|
}
|
|
12916
12945
|
),
|
|
12917
|
-
/* @__PURE__ */ (0,
|
|
12918
|
-
/* @__PURE__ */ (0,
|
|
12946
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "fixed bottom-5 left-0 right-0 z-50", children: [
|
|
12947
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "flex justify-center gap-2", children: (() => {
|
|
12919
12948
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12920
12949
|
if (currentIndex === -1) {
|
|
12921
12950
|
currentIndex = images.findIndex(
|
|
@@ -12948,8 +12977,8 @@ var EnhancedImageViewer = ({
|
|
|
12948
12977
|
};
|
|
12949
12978
|
const nextIndex = findNextAvailableIndex(currentIndex, 1);
|
|
12950
12979
|
const prevIndex = findNextAvailableIndex(currentIndex, -1);
|
|
12951
|
-
return /* @__PURE__ */ (0,
|
|
12952
|
-
/* @__PURE__ */ (0,
|
|
12980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
12981
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12953
12982
|
"button",
|
|
12954
12983
|
{
|
|
12955
12984
|
onClick: () => {
|
|
@@ -12962,7 +12991,7 @@ var EnhancedImageViewer = ({
|
|
|
12962
12991
|
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"}`,
|
|
12963
12992
|
style: { touchAction: "manipulation" },
|
|
12964
12993
|
"aria-label": "Previous image",
|
|
12965
|
-
children: /* @__PURE__ */ (0,
|
|
12994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12966
12995
|
"svg",
|
|
12967
12996
|
{
|
|
12968
12997
|
className: "w-4 h-4",
|
|
@@ -12970,7 +12999,7 @@ var EnhancedImageViewer = ({
|
|
|
12970
12999
|
stroke: "currentColor",
|
|
12971
13000
|
viewBox: "0 0 24 24",
|
|
12972
13001
|
"aria-hidden": "true",
|
|
12973
|
-
children: /* @__PURE__ */ (0,
|
|
13002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12974
13003
|
"path",
|
|
12975
13004
|
{
|
|
12976
13005
|
strokeLinecap: "round",
|
|
@@ -12983,7 +13012,7 @@ var EnhancedImageViewer = ({
|
|
|
12983
13012
|
)
|
|
12984
13013
|
}
|
|
12985
13014
|
),
|
|
12986
|
-
/* @__PURE__ */ (0,
|
|
13015
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12987
13016
|
"button",
|
|
12988
13017
|
{
|
|
12989
13018
|
onClick: () => {
|
|
@@ -12996,7 +13025,7 @@ var EnhancedImageViewer = ({
|
|
|
12996
13025
|
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"}`,
|
|
12997
13026
|
style: { touchAction: "manipulation" },
|
|
12998
13027
|
"aria-label": "Next image",
|
|
12999
|
-
children: /* @__PURE__ */ (0,
|
|
13028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13000
13029
|
"svg",
|
|
13001
13030
|
{
|
|
13002
13031
|
className: "w-4 h-4",
|
|
@@ -13004,7 +13033,7 @@ var EnhancedImageViewer = ({
|
|
|
13004
13033
|
stroke: "currentColor",
|
|
13005
13034
|
viewBox: "0 0 24 24",
|
|
13006
13035
|
"aria-hidden": "true",
|
|
13007
|
-
children: /* @__PURE__ */ (0,
|
|
13036
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13008
13037
|
"path",
|
|
13009
13038
|
{
|
|
13010
13039
|
strokeLinecap: "round",
|
|
@@ -13019,7 +13048,7 @@ var EnhancedImageViewer = ({
|
|
|
13019
13048
|
)
|
|
13020
13049
|
] });
|
|
13021
13050
|
})() }),
|
|
13022
|
-
/* @__PURE__ */ (0,
|
|
13051
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.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: (() => {
|
|
13023
13052
|
const total = Math.max(images.length, 1);
|
|
13024
13053
|
const current = propCurrentIndex !== void 0 ? Math.min(propCurrentIndex + 1, total) : 1;
|
|
13025
13054
|
return `${current} / ${total}`;
|
|
@@ -13031,7 +13060,7 @@ var EnhancedImageViewer = ({
|
|
|
13031
13060
|
},
|
|
13032
13061
|
`${scale.initial}-${scale.min}-${scale.max}`
|
|
13033
13062
|
),
|
|
13034
|
-
/* @__PURE__ */ (0,
|
|
13063
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
13035
13064
|
"div",
|
|
13036
13065
|
{
|
|
13037
13066
|
className: "absolute inset-0 bg-black",
|
|
@@ -13050,7 +13079,7 @@ var EnhancedImageViewer = ({
|
|
|
13050
13079
|
};
|
|
13051
13080
|
|
|
13052
13081
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
13053
|
-
var
|
|
13082
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13054
13083
|
function ResponsiveZoom({
|
|
13055
13084
|
imageIndex,
|
|
13056
13085
|
children,
|
|
@@ -13060,11 +13089,11 @@ function ResponsiveZoom({
|
|
|
13060
13089
|
imageUrl,
|
|
13061
13090
|
alt = "Product image"
|
|
13062
13091
|
}) {
|
|
13063
|
-
const [isTouchDevice, setIsTouchDevice] = (0,
|
|
13064
|
-
const [showEnhancedViewer, setShowEnhancedViewer] = (0,
|
|
13065
|
-
const [viewerIndex, setViewerIndex] = (0,
|
|
13066
|
-
const [currentImageUrl, setCurrentImageUrl] = (0,
|
|
13067
|
-
(0,
|
|
13092
|
+
const [isTouchDevice, setIsTouchDevice] = (0, import_react56.useState)(false);
|
|
13093
|
+
const [showEnhancedViewer, setShowEnhancedViewer] = (0, import_react56.useState)(false);
|
|
13094
|
+
const [viewerIndex, setViewerIndex] = (0, import_react56.useState)(0);
|
|
13095
|
+
const [currentImageUrl, setCurrentImageUrl] = (0, import_react56.useState)(imageUrl || "");
|
|
13096
|
+
(0, import_react56.useEffect)(() => {
|
|
13068
13097
|
const checkDeviceType = () => {
|
|
13069
13098
|
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
13070
13099
|
setIsTouchDevice(hasTouch);
|
|
@@ -13091,8 +13120,8 @@ function ResponsiveZoom({
|
|
|
13091
13120
|
}
|
|
13092
13121
|
}
|
|
13093
13122
|
};
|
|
13094
|
-
return /* @__PURE__ */ (0,
|
|
13095
|
-
isTouchDevice ? /* @__PURE__ */ (0,
|
|
13123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
13124
|
+
isTouchDevice ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13096
13125
|
"div",
|
|
13097
13126
|
{
|
|
13098
13127
|
className,
|
|
@@ -13109,7 +13138,7 @@ function ResponsiveZoom({
|
|
|
13109
13138
|
},
|
|
13110
13139
|
children
|
|
13111
13140
|
}
|
|
13112
|
-
) : /* @__PURE__ */ (0,
|
|
13141
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13113
13142
|
ZoomOverlay,
|
|
13114
13143
|
{
|
|
13115
13144
|
imageIndex,
|
|
@@ -13120,7 +13149,7 @@ function ResponsiveZoom({
|
|
|
13120
13149
|
children
|
|
13121
13150
|
}
|
|
13122
13151
|
),
|
|
13123
|
-
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ (0,
|
|
13152
|
+
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13124
13153
|
EnhancedImageViewer,
|
|
13125
13154
|
{
|
|
13126
13155
|
imageUrl: currentImageUrl,
|
|
@@ -13143,7 +13172,7 @@ function ResponsiveZoom({
|
|
|
13143
13172
|
}
|
|
13144
13173
|
|
|
13145
13174
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13146
|
-
var
|
|
13175
|
+
var import_react57 = require("react");
|
|
13147
13176
|
|
|
13148
13177
|
// src/composed/carousels/fit.ts
|
|
13149
13178
|
function slideFit(_galleryRole) {
|
|
@@ -13154,17 +13183,17 @@ function zoomFit(galleryRole) {
|
|
|
13154
13183
|
}
|
|
13155
13184
|
|
|
13156
13185
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13157
|
-
var
|
|
13186
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13158
13187
|
function StaticCarouselImage({
|
|
13159
13188
|
src,
|
|
13160
13189
|
alt,
|
|
13161
13190
|
className
|
|
13162
13191
|
}) {
|
|
13163
|
-
const [failed, setFailed] = (0,
|
|
13192
|
+
const [failed, setFailed] = (0, import_react57.useState)(false);
|
|
13164
13193
|
if (failed || !src) {
|
|
13165
|
-
return /* @__PURE__ */ (0,
|
|
13194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: `bg-muted ${className ?? ""}`, role: "img", "aria-label": alt });
|
|
13166
13195
|
}
|
|
13167
|
-
return /* @__PURE__ */ (0,
|
|
13196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13168
13197
|
"img",
|
|
13169
13198
|
{
|
|
13170
13199
|
src,
|
|
@@ -13178,7 +13207,7 @@ function StaticCarouselImage({
|
|
|
13178
13207
|
}
|
|
13179
13208
|
);
|
|
13180
13209
|
}
|
|
13181
|
-
var MobileProductCarousel = (0,
|
|
13210
|
+
var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarousel2({
|
|
13182
13211
|
images,
|
|
13183
13212
|
currentIndex = 0,
|
|
13184
13213
|
onIndexChange,
|
|
@@ -13197,42 +13226,42 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13197
13226
|
errorText,
|
|
13198
13227
|
unavailableText
|
|
13199
13228
|
}) {
|
|
13200
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
13201
|
-
const [touchStart, setTouchStart] = (0,
|
|
13229
|
+
const [activeIndex, setActiveIndex] = (0, import_react57.useState)(currentIndex);
|
|
13230
|
+
const [touchStart, setTouchStart] = (0, import_react57.useState)(
|
|
13202
13231
|
null
|
|
13203
13232
|
);
|
|
13204
|
-
const [touchEnd, setTouchEnd] = (0,
|
|
13233
|
+
const [touchEnd, setTouchEnd] = (0, import_react57.useState)(
|
|
13205
13234
|
null
|
|
13206
13235
|
);
|
|
13207
|
-
const [showImageViewer, setShowImageViewer] = (0,
|
|
13208
|
-
const [viewerKey, setViewerKey] = (0,
|
|
13209
|
-
const [isDragging, setIsDragging] = (0,
|
|
13210
|
-
const [dragOffset, setDragOffset] = (0,
|
|
13211
|
-
const [isTransitioning, setIsTransitioning] = (0,
|
|
13212
|
-
const [isHorizontalSwipe, setIsHorizontalSwipe] = (0,
|
|
13236
|
+
const [showImageViewer, setShowImageViewer] = (0, import_react57.useState)(false);
|
|
13237
|
+
const [viewerKey, setViewerKey] = (0, import_react57.useState)(0);
|
|
13238
|
+
const [isDragging, setIsDragging] = (0, import_react57.useState)(false);
|
|
13239
|
+
const [dragOffset, setDragOffset] = (0, import_react57.useState)(0);
|
|
13240
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react57.useState)(false);
|
|
13241
|
+
const [isHorizontalSwipe, setIsHorizontalSwipe] = (0, import_react57.useState)(
|
|
13213
13242
|
null
|
|
13214
13243
|
);
|
|
13215
|
-
const [isPeeking, setIsPeeking] = (0,
|
|
13216
|
-
const [isPeekReturning, setIsPeekReturning] = (0,
|
|
13217
|
-
const carouselRef = (0,
|
|
13218
|
-
const indicatorRef = (0,
|
|
13219
|
-
const touchStartRef = (0,
|
|
13244
|
+
const [isPeeking, setIsPeeking] = (0, import_react57.useState)(false);
|
|
13245
|
+
const [isPeekReturning, setIsPeekReturning] = (0, import_react57.useState)(false);
|
|
13246
|
+
const carouselRef = (0, import_react57.useRef)(null);
|
|
13247
|
+
const indicatorRef = (0, import_react57.useRef)(null);
|
|
13248
|
+
const touchStartRef = (0, import_react57.useRef)(
|
|
13220
13249
|
null
|
|
13221
13250
|
);
|
|
13222
|
-
const horizontalGestureRef = (0,
|
|
13223
|
-
const hasShownPeekRef = (0,
|
|
13224
|
-
const hasSwipedThisSessionRef = (0,
|
|
13225
|
-
const generatedUrlsRef = (0,
|
|
13226
|
-
const prevArtworkSrcRef = (0,
|
|
13227
|
-
(0,
|
|
13251
|
+
const horizontalGestureRef = (0, import_react57.useRef)(false);
|
|
13252
|
+
const hasShownPeekRef = (0, import_react57.useRef)(false);
|
|
13253
|
+
const hasSwipedThisSessionRef = (0, import_react57.useRef)(false);
|
|
13254
|
+
const generatedUrlsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
13255
|
+
const prevArtworkSrcRef = (0, import_react57.useRef)(currentArtwork?.src);
|
|
13256
|
+
(0, import_react57.useEffect)(() => {
|
|
13228
13257
|
if (currentArtwork?.src !== prevArtworkSrcRef.current) {
|
|
13229
13258
|
generatedUrlsRef.current.clear();
|
|
13230
13259
|
prevArtworkSrcRef.current = currentArtwork?.src;
|
|
13231
13260
|
}
|
|
13232
13261
|
}, [currentArtwork?.src]);
|
|
13233
|
-
const onMockupUrlGeneratedRef = (0,
|
|
13262
|
+
const onMockupUrlGeneratedRef = (0, import_react57.useRef)(onMockupUrlGenerated);
|
|
13234
13263
|
onMockupUrlGeneratedRef.current = onMockupUrlGenerated;
|
|
13235
|
-
const handleUrlGenerated = (0,
|
|
13264
|
+
const handleUrlGenerated = (0, import_react57.useCallback)((mockupId, url) => {
|
|
13236
13265
|
generatedUrlsRef.current.set(mockupId, url);
|
|
13237
13266
|
onMockupUrlGeneratedRef.current?.(mockupId, url);
|
|
13238
13267
|
}, []);
|
|
@@ -13240,24 +13269,24 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13240
13269
|
const shouldHideDots = stickyHeroContext?.shouldHideDots ?? false;
|
|
13241
13270
|
const priorityContext = useMockupPriorityOptional();
|
|
13242
13271
|
const realtimeContext = useRealtimeOptional();
|
|
13243
|
-
const [urlUpdateCounter, setUrlUpdateCounter] = (0,
|
|
13244
|
-
(0,
|
|
13272
|
+
const [urlUpdateCounter, setUrlUpdateCounter] = (0, import_react57.useState)(0);
|
|
13273
|
+
(0, import_react57.useEffect)(() => {
|
|
13245
13274
|
if (!realtimeContext?.subscribeMockupResults) return;
|
|
13246
13275
|
const unsubscribe = realtimeContext.subscribeMockupResults(() => {
|
|
13247
13276
|
setUrlUpdateCounter((c) => c + 1);
|
|
13248
13277
|
});
|
|
13249
13278
|
return unsubscribe;
|
|
13250
13279
|
}, [realtimeContext?.subscribeMockupResults]);
|
|
13251
|
-
const mockupIds = (0,
|
|
13280
|
+
const mockupIds = (0, import_react57.useMemo)(() => {
|
|
13252
13281
|
return images.filter((img) => img.isRealMockup && img.mockupId).map((img) => img.mockupId);
|
|
13253
13282
|
}, [images]);
|
|
13254
|
-
const realtimeMockupUrls = (0,
|
|
13283
|
+
const realtimeMockupUrls = (0, import_react57.useMemo)(() => {
|
|
13255
13284
|
if (!realtimeContext?.getMockupUrls || mockupIds.length === 0) {
|
|
13256
13285
|
return {};
|
|
13257
13286
|
}
|
|
13258
13287
|
return realtimeContext.getMockupUrls(mockupIds);
|
|
13259
13288
|
}, [realtimeContext?.getMockupUrls, mockupIds, urlUpdateCounter]);
|
|
13260
|
-
const imagesWithRealtimeUrls = (0,
|
|
13289
|
+
const imagesWithRealtimeUrls = (0, import_react57.useMemo)(() => {
|
|
13261
13290
|
return images.map((img) => {
|
|
13262
13291
|
if (img.isRealMockup && img.mockupId && realtimeMockupUrls[img.mockupId]) {
|
|
13263
13292
|
return {
|
|
@@ -13269,10 +13298,10 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13269
13298
|
});
|
|
13270
13299
|
}, [images, realtimeMockupUrls]);
|
|
13271
13300
|
const minSwipeDistance = 50;
|
|
13272
|
-
(0,
|
|
13301
|
+
(0, import_react57.useEffect)(() => {
|
|
13273
13302
|
setActiveIndex(currentIndex);
|
|
13274
13303
|
}, [currentIndex]);
|
|
13275
|
-
(0,
|
|
13304
|
+
(0, import_react57.useEffect)(() => {
|
|
13276
13305
|
if (!priorityContext) return;
|
|
13277
13306
|
const realMockups = images.map((img, idx) => ({ img, originalIdx: idx })).filter(({ img }) => img.isRealMockup && img.mockupId);
|
|
13278
13307
|
const mockupIdsList = realMockups.map(({ img }) => img.mockupId);
|
|
@@ -13300,7 +13329,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13300
13329
|
priorityContext.clearMobileCarouselMode?.();
|
|
13301
13330
|
};
|
|
13302
13331
|
}, [priorityContext, activeIndex, images]);
|
|
13303
|
-
(0,
|
|
13332
|
+
(0, import_react57.useEffect)(() => {
|
|
13304
13333
|
const indicator = indicatorRef.current;
|
|
13305
13334
|
if (!indicator) return;
|
|
13306
13335
|
let ticking = false;
|
|
@@ -13341,7 +13370,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13341
13370
|
}, []);
|
|
13342
13371
|
const SWIPE_TRACKING_KEY = "carousel-swipe-tracking";
|
|
13343
13372
|
const PDP_VIEWS_BEFORE_PEEK = 10;
|
|
13344
|
-
const getSwipeTracking = (0,
|
|
13373
|
+
const getSwipeTracking = (0, import_react57.useCallback)(() => {
|
|
13345
13374
|
try {
|
|
13346
13375
|
const stored = localStorage.getItem(SWIPE_TRACKING_KEY);
|
|
13347
13376
|
if (stored) {
|
|
@@ -13351,7 +13380,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13351
13380
|
}
|
|
13352
13381
|
return { viewsWithoutSwipe: 0, hasEverSwiped: false };
|
|
13353
13382
|
}, []);
|
|
13354
|
-
const recordSwipe = (0,
|
|
13383
|
+
const recordSwipe = (0, import_react57.useCallback)(() => {
|
|
13355
13384
|
if (hasSwipedThisSessionRef.current) return;
|
|
13356
13385
|
hasSwipedThisSessionRef.current = true;
|
|
13357
13386
|
try {
|
|
@@ -13365,7 +13394,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13365
13394
|
} catch {
|
|
13366
13395
|
}
|
|
13367
13396
|
}, []);
|
|
13368
|
-
(0,
|
|
13397
|
+
(0, import_react57.useEffect)(() => {
|
|
13369
13398
|
if (!enablePeekAnimation || images.length <= 1) return;
|
|
13370
13399
|
const tracking = getSwipeTracking();
|
|
13371
13400
|
const newViewCount = tracking.viewsWithoutSwipe + 1;
|
|
@@ -13406,14 +13435,14 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13406
13435
|
clearTimeout(clearTimeout_);
|
|
13407
13436
|
};
|
|
13408
13437
|
}, [images.length, getSwipeTracking, enablePeekAnimation]);
|
|
13409
|
-
const wasTapRef = (0,
|
|
13410
|
-
const handleImageTap = (0,
|
|
13438
|
+
const wasTapRef = (0, import_react57.useRef)(false);
|
|
13439
|
+
const handleImageTap = (0, import_react57.useCallback)(() => {
|
|
13411
13440
|
if (!enableZoom) return;
|
|
13412
13441
|
setViewerKey((prev) => prev + 1);
|
|
13413
13442
|
setShowImageViewer(true);
|
|
13414
13443
|
onZoomChange?.(true);
|
|
13415
13444
|
}, [enableZoom, onZoomChange]);
|
|
13416
|
-
const calculateDragOffset = (0,
|
|
13445
|
+
const calculateDragOffset = (0, import_react57.useCallback)(
|
|
13417
13446
|
(startX, currentX, containerWidth) => {
|
|
13418
13447
|
const distance = startX - currentX;
|
|
13419
13448
|
const offsetPercent = distance / containerWidth * 100;
|
|
@@ -13438,7 +13467,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13438
13467
|
},
|
|
13439
13468
|
[activeIndex, images.length]
|
|
13440
13469
|
);
|
|
13441
|
-
const handleSwipeEnd = (0,
|
|
13470
|
+
const handleSwipeEnd = (0, import_react57.useCallback)(
|
|
13442
13471
|
(startX, endX, containerWidth) => {
|
|
13443
13472
|
const distance = startX - endX;
|
|
13444
13473
|
const distancePercent = Math.abs(distance) / containerWidth * 100;
|
|
@@ -13469,7 +13498,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13469
13498
|
},
|
|
13470
13499
|
[activeIndex, images.length, onIndexChange, recordSwipe]
|
|
13471
13500
|
);
|
|
13472
|
-
(0,
|
|
13501
|
+
(0, import_react57.useEffect)(() => {
|
|
13473
13502
|
const container = carouselRef.current;
|
|
13474
13503
|
if (!container) return;
|
|
13475
13504
|
const handleTouchStart = (e) => {
|
|
@@ -13558,11 +13587,11 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13558
13587
|
handleSwipeEnd,
|
|
13559
13588
|
handleImageTap
|
|
13560
13589
|
]);
|
|
13561
|
-
const mouseStartRef = (0,
|
|
13590
|
+
const mouseStartRef = (0, import_react57.useRef)(
|
|
13562
13591
|
null
|
|
13563
13592
|
);
|
|
13564
|
-
const isMouseDraggingRef = (0,
|
|
13565
|
-
(0,
|
|
13593
|
+
const isMouseDraggingRef = (0, import_react57.useRef)(false);
|
|
13594
|
+
(0, import_react57.useEffect)(() => {
|
|
13566
13595
|
const container = carouselRef.current;
|
|
13567
13596
|
if (!container) return;
|
|
13568
13597
|
const handleMouseDown = (e) => {
|
|
@@ -13638,7 +13667,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13638
13667
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
13639
13668
|
};
|
|
13640
13669
|
}, [calculateDragOffset, handleSwipeEnd, handleImageTap]);
|
|
13641
|
-
const goToSlide = (0,
|
|
13670
|
+
const goToSlide = (0, import_react57.useCallback)(
|
|
13642
13671
|
(index, withTransition = true) => {
|
|
13643
13672
|
if (withTransition) {
|
|
13644
13673
|
setIsTransitioning(true);
|
|
@@ -13656,16 +13685,16 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13656
13685
|
},
|
|
13657
13686
|
[onIndexChange]
|
|
13658
13687
|
);
|
|
13659
|
-
(0,
|
|
13688
|
+
(0, import_react57.useEffect)(() => {
|
|
13660
13689
|
if (stickyHeroContext?.setCarouselIndicator && images.length > 1) {
|
|
13661
|
-
const indicator = /* @__PURE__ */ (0,
|
|
13690
|
+
const indicator = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13662
13691
|
"div",
|
|
13663
13692
|
{
|
|
13664
13693
|
className: "w-full",
|
|
13665
13694
|
role: "group",
|
|
13666
13695
|
"aria-label": "Product image navigation",
|
|
13667
|
-
children: /* @__PURE__ */ (0,
|
|
13668
|
-
/* @__PURE__ */ (0,
|
|
13696
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "relative h-1", children: [
|
|
13697
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "flex h-full", children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13669
13698
|
"button",
|
|
13670
13699
|
{
|
|
13671
13700
|
onClick: () => goToSlide(index),
|
|
@@ -13675,7 +13704,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13675
13704
|
},
|
|
13676
13705
|
index
|
|
13677
13706
|
)) }),
|
|
13678
|
-
/* @__PURE__ */ (0,
|
|
13707
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13679
13708
|
"div",
|
|
13680
13709
|
{
|
|
13681
13710
|
className: "absolute top-0 h-full bg-primary transition-all duration-300 ease-out",
|
|
@@ -13698,10 +13727,10 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13698
13727
|
};
|
|
13699
13728
|
}, [activeIndex, images.length, goToSlide, stickyHeroContext]);
|
|
13700
13729
|
if (!images || images.length === 0) {
|
|
13701
|
-
return /* @__PURE__ */ (0,
|
|
13730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "w-full aspect-video bg-muted rounded-lg" });
|
|
13702
13731
|
}
|
|
13703
|
-
return /* @__PURE__ */ (0,
|
|
13704
|
-
/* @__PURE__ */ (0,
|
|
13732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: `relative w-full h-full ${className}`, children: [
|
|
13733
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13705
13734
|
"div",
|
|
13706
13735
|
{
|
|
13707
13736
|
ref: carouselRef,
|
|
@@ -13719,7 +13748,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13719
13748
|
role: "region",
|
|
13720
13749
|
"aria-roledescription": "carousel",
|
|
13721
13750
|
"aria-label": "Product images",
|
|
13722
|
-
children: /* @__PURE__ */ (0,
|
|
13751
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13723
13752
|
"div",
|
|
13724
13753
|
{
|
|
13725
13754
|
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)]" : ""}`,
|
|
@@ -13729,18 +13758,18 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13729
13758
|
children: images.map((image, index) => {
|
|
13730
13759
|
const DECODE_WINDOW = 1;
|
|
13731
13760
|
const isWithinDecodeWindow = Math.abs(index - activeIndex) <= DECODE_WINDOW;
|
|
13732
|
-
return /* @__PURE__ */ (0,
|
|
13761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
13733
13762
|
"div",
|
|
13734
13763
|
{
|
|
13735
13764
|
className: "w-full h-full flex-shrink-0 relative select-none",
|
|
13736
13765
|
"data-gallery-role": image.galleryRole,
|
|
13737
13766
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13738
13767
|
children: [
|
|
13739
|
-
!isWithinDecodeWindow ? /* @__PURE__ */ (0,
|
|
13768
|
+
!isWithinDecodeWindow ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13740
13769
|
// Rainbow prism loader (same as the /create route) instead of
|
|
13741
13770
|
// a flat pulse; fills this relative slide via inset:0.
|
|
13742
|
-
/* @__PURE__ */ (0,
|
|
13743
|
-
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0,
|
|
13771
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" })
|
|
13772
|
+
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13744
13773
|
HeroProductImage,
|
|
13745
13774
|
{
|
|
13746
13775
|
productId,
|
|
@@ -13757,7 +13786,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13757
13786
|
viewportPolicy: true,
|
|
13758
13787
|
fit: slideFit(image.galleryRole)
|
|
13759
13788
|
}
|
|
13760
|
-
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0,
|
|
13789
|
+
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13761
13790
|
StaticCarouselImage,
|
|
13762
13791
|
{
|
|
13763
13792
|
src: image.src,
|
|
@@ -13767,7 +13796,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13767
13796
|
),
|
|
13768
13797
|
isWithinDecodeWindow && (() => {
|
|
13769
13798
|
const action = renderImageAction?.(image, index);
|
|
13770
|
-
return action ? /* @__PURE__ */ (0,
|
|
13799
|
+
return action ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13771
13800
|
"div",
|
|
13772
13801
|
{
|
|
13773
13802
|
className: "absolute top-3 right-3 z-10",
|
|
@@ -13788,7 +13817,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13788
13817
|
)
|
|
13789
13818
|
}
|
|
13790
13819
|
),
|
|
13791
|
-
showIndicators && images.length > 1 && /* @__PURE__ */ (0,
|
|
13820
|
+
showIndicators && images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13792
13821
|
"div",
|
|
13793
13822
|
{
|
|
13794
13823
|
ref: indicatorRef,
|
|
@@ -13796,8 +13825,8 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13796
13825
|
className: "relative z-20 w-full",
|
|
13797
13826
|
role: "group",
|
|
13798
13827
|
"aria-label": "Product image navigation",
|
|
13799
|
-
children: /* @__PURE__ */ (0,
|
|
13800
|
-
/* @__PURE__ */ (0,
|
|
13828
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "relative h-1", children: [
|
|
13829
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "flex h-full absolute inset-0", children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13801
13830
|
"button",
|
|
13802
13831
|
{
|
|
13803
13832
|
onClick: () => goToSlide(index),
|
|
@@ -13807,7 +13836,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13807
13836
|
},
|
|
13808
13837
|
index
|
|
13809
13838
|
)) }),
|
|
13810
|
-
/* @__PURE__ */ (0,
|
|
13839
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13811
13840
|
"div",
|
|
13812
13841
|
{
|
|
13813
13842
|
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"}`,
|
|
@@ -13843,7 +13872,7 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13843
13872
|
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {}
|
|
13844
13873
|
} : null;
|
|
13845
13874
|
}).filter((img) => img !== null);
|
|
13846
|
-
return /* @__PURE__ */ (0,
|
|
13875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13847
13876
|
EnhancedImageViewer,
|
|
13848
13877
|
{
|
|
13849
13878
|
imageUrl,
|
|
@@ -13882,8 +13911,8 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13882
13911
|
});
|
|
13883
13912
|
|
|
13884
13913
|
// src/composed/carousels/HeroCarousel.tsx
|
|
13885
|
-
var
|
|
13886
|
-
var
|
|
13914
|
+
var import_react58 = require("react");
|
|
13915
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13887
13916
|
function HeroCarousel({
|
|
13888
13917
|
images,
|
|
13889
13918
|
currentIndex = 0,
|
|
@@ -13893,16 +13922,16 @@ function HeroCarousel({
|
|
|
13893
13922
|
productId,
|
|
13894
13923
|
onImageTap
|
|
13895
13924
|
}) {
|
|
13896
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
13897
|
-
const containerRef = (0,
|
|
13898
|
-
const touchStartRef = (0,
|
|
13925
|
+
const [activeIndex, setActiveIndex] = (0, import_react58.useState)(currentIndex);
|
|
13926
|
+
const containerRef = (0, import_react58.useRef)(null);
|
|
13927
|
+
const touchStartRef = (0, import_react58.useRef)(
|
|
13899
13928
|
null
|
|
13900
13929
|
);
|
|
13901
|
-
const isSwipingRef = (0,
|
|
13902
|
-
(0,
|
|
13930
|
+
const isSwipingRef = (0, import_react58.useRef)(false);
|
|
13931
|
+
(0, import_react58.useEffect)(() => {
|
|
13903
13932
|
setActiveIndex(currentIndex);
|
|
13904
13933
|
}, [currentIndex]);
|
|
13905
|
-
const goToSlide = (0,
|
|
13934
|
+
const goToSlide = (0, import_react58.useCallback)(
|
|
13906
13935
|
(index) => {
|
|
13907
13936
|
const clampedIndex = Math.max(0, Math.min(images.length - 1, index));
|
|
13908
13937
|
setActiveIndex(clampedIndex);
|
|
@@ -13910,7 +13939,7 @@ function HeroCarousel({
|
|
|
13910
13939
|
},
|
|
13911
13940
|
[images.length, onIndexChange]
|
|
13912
13941
|
);
|
|
13913
|
-
(0,
|
|
13942
|
+
(0, import_react58.useEffect)(() => {
|
|
13914
13943
|
const container = containerRef.current;
|
|
13915
13944
|
if (!container) return;
|
|
13916
13945
|
const handleTouchStart = (e) => {
|
|
@@ -13962,9 +13991,9 @@ function HeroCarousel({
|
|
|
13962
13991
|
};
|
|
13963
13992
|
}, [activeIndex, images.length, goToSlide, onImageTap]);
|
|
13964
13993
|
if (!images || images.length === 0) {
|
|
13965
|
-
return /* @__PURE__ */ (0,
|
|
13994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full h-full bg-muted" });
|
|
13966
13995
|
}
|
|
13967
|
-
return /* @__PURE__ */ (0,
|
|
13996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
13968
13997
|
"div",
|
|
13969
13998
|
{
|
|
13970
13999
|
ref: containerRef,
|
|
@@ -13975,7 +14004,7 @@ function HeroCarousel({
|
|
|
13975
14004
|
overflow: "hidden"
|
|
13976
14005
|
},
|
|
13977
14006
|
children: [
|
|
13978
|
-
/* @__PURE__ */ (0,
|
|
14007
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13979
14008
|
"div",
|
|
13980
14009
|
{
|
|
13981
14010
|
className: "flex h-full transition-transform duration-300 ease-out",
|
|
@@ -13986,14 +14015,14 @@ function HeroCarousel({
|
|
|
13986
14015
|
backfaceVisibility: "hidden",
|
|
13987
14016
|
WebkitBackfaceVisibility: "hidden"
|
|
13988
14017
|
},
|
|
13989
|
-
children: images.map((image, index) => /* @__PURE__ */ (0,
|
|
14018
|
+
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13990
14019
|
"div",
|
|
13991
14020
|
{
|
|
13992
14021
|
className: "w-full h-full flex-shrink-0",
|
|
13993
14022
|
style: {
|
|
13994
14023
|
contain: "layout paint"
|
|
13995
14024
|
},
|
|
13996
|
-
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0,
|
|
14025
|
+
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13997
14026
|
HeroProductImage,
|
|
13998
14027
|
{
|
|
13999
14028
|
productId,
|
|
@@ -14002,7 +14031,7 @@ function HeroCarousel({
|
|
|
14002
14031
|
mockupId: image.mockupId,
|
|
14003
14032
|
className: "w-full h-full object-cover"
|
|
14004
14033
|
}
|
|
14005
|
-
) : /* @__PURE__ */ (0,
|
|
14034
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14006
14035
|
"img",
|
|
14007
14036
|
{
|
|
14008
14037
|
src: image.src,
|
|
@@ -14019,12 +14048,12 @@ function HeroCarousel({
|
|
|
14019
14048
|
))
|
|
14020
14049
|
}
|
|
14021
14050
|
),
|
|
14022
|
-
images.length > 1 && /* @__PURE__ */ (0,
|
|
14051
|
+
images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14023
14052
|
"div",
|
|
14024
14053
|
{
|
|
14025
14054
|
className: "absolute bottom-4 left-0 right-0 flex justify-center gap-2 z-10",
|
|
14026
14055
|
style: { contain: "layout style" },
|
|
14027
|
-
children: images.map((_, index) => /* @__PURE__ */ (0,
|
|
14056
|
+
children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14028
14057
|
"button",
|
|
14029
14058
|
{
|
|
14030
14059
|
onClick: () => goToSlide(index),
|
|
@@ -14041,8 +14070,8 @@ function HeroCarousel({
|
|
|
14041
14070
|
}
|
|
14042
14071
|
|
|
14043
14072
|
// src/composed/grids/MasonryGrid.tsx
|
|
14044
|
-
var
|
|
14045
|
-
var
|
|
14073
|
+
var import_react59 = require("react");
|
|
14074
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14046
14075
|
var BREAKPOINTS = {
|
|
14047
14076
|
sm: 640,
|
|
14048
14077
|
md: 768,
|
|
@@ -14094,13 +14123,13 @@ function MasonryGrid({
|
|
|
14094
14123
|
className = "",
|
|
14095
14124
|
emptyContent
|
|
14096
14125
|
}) {
|
|
14097
|
-
const [columnCount, setColumnCount] = (0,
|
|
14126
|
+
const [columnCount, setColumnCount] = (0, import_react59.useState)(
|
|
14098
14127
|
() => typeof columns === "number" ? columns : getColumnCount(
|
|
14099
14128
|
typeof window !== "undefined" ? window.innerWidth : 1024,
|
|
14100
14129
|
columns
|
|
14101
14130
|
)
|
|
14102
14131
|
);
|
|
14103
|
-
(0,
|
|
14132
|
+
(0, import_react59.useEffect)(() => {
|
|
14104
14133
|
const updateColumnCount = () => {
|
|
14105
14134
|
setColumnCount(getColumnCount(window.innerWidth, columns));
|
|
14106
14135
|
};
|
|
@@ -14108,30 +14137,30 @@ function MasonryGrid({
|
|
|
14108
14137
|
window.addEventListener("resize", updateColumnCount);
|
|
14109
14138
|
return () => window.removeEventListener("resize", updateColumnCount);
|
|
14110
14139
|
}, [columns]);
|
|
14111
|
-
const distributedColumns = (0,
|
|
14140
|
+
const distributedColumns = (0, import_react59.useMemo)(
|
|
14112
14141
|
() => distributeItems(items, columnCount),
|
|
14113
14142
|
[items, columnCount]
|
|
14114
14143
|
);
|
|
14115
14144
|
if (items.length === 0) {
|
|
14116
14145
|
if (emptyContent) {
|
|
14117
|
-
return /* @__PURE__ */ (0,
|
|
14146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: emptyContent });
|
|
14118
14147
|
}
|
|
14119
14148
|
return null;
|
|
14120
14149
|
}
|
|
14121
|
-
return /* @__PURE__ */ (0,
|
|
14150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14122
14151
|
"div",
|
|
14123
14152
|
{
|
|
14124
14153
|
className: `flex ${className}`,
|
|
14125
14154
|
style: { gap: `${gap}px` },
|
|
14126
14155
|
role: "list",
|
|
14127
|
-
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ (0,
|
|
14156
|
+
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14128
14157
|
"div",
|
|
14129
14158
|
{
|
|
14130
14159
|
className: "flex-1 flex flex-col",
|
|
14131
14160
|
style: { gap: `${gap}px` },
|
|
14132
14161
|
children: columnItems.map((item, itemIndex) => {
|
|
14133
14162
|
const originalIndex = itemIndex * columnCount + columnIndex;
|
|
14134
|
-
return /* @__PURE__ */ (0,
|
|
14163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { role: "listitem", children: renderItem(item, originalIndex) }, originalIndex);
|
|
14135
14164
|
})
|
|
14136
14165
|
},
|
|
14137
14166
|
columnIndex
|
|
@@ -14144,7 +14173,7 @@ function MasonryGrid({
|
|
|
14144
14173
|
init_dev_warnings();
|
|
14145
14174
|
|
|
14146
14175
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
14147
|
-
var
|
|
14176
|
+
var import_react61 = require("react");
|
|
14148
14177
|
|
|
14149
14178
|
// src/layouts/hero-zoom/types.ts
|
|
14150
14179
|
var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
@@ -14156,19 +14185,19 @@ var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
|
14156
14185
|
};
|
|
14157
14186
|
|
|
14158
14187
|
// src/layouts/hero-zoom/useHeroZoomScales.ts
|
|
14159
|
-
var
|
|
14188
|
+
var import_react60 = require("react");
|
|
14160
14189
|
function useHeroZoomScales(config = {}) {
|
|
14161
14190
|
const { initialScale, accountForRetina, maxRetinaMultiplier } = {
|
|
14162
14191
|
...DEFAULT_HERO_ZOOM_CONFIG,
|
|
14163
14192
|
...config
|
|
14164
14193
|
};
|
|
14165
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
14194
|
+
const [isHydrated, setIsHydrated] = (0, import_react60.useState)(false);
|
|
14166
14195
|
const ssrMultiplier = accountForRetina ? maxRetinaMultiplier : 2;
|
|
14167
|
-
const [scales, setScales] = (0,
|
|
14196
|
+
const [scales, setScales] = (0, import_react60.useState)(() => ({
|
|
14168
14197
|
visual: initialScale,
|
|
14169
14198
|
render: initialScale * ssrMultiplier
|
|
14170
14199
|
}));
|
|
14171
|
-
const calculateScales = (0,
|
|
14200
|
+
const calculateScales = (0, import_react60.useCallback)(() => {
|
|
14172
14201
|
const visualScale = Math.max(1, Math.min(4, initialScale));
|
|
14173
14202
|
let renderScale;
|
|
14174
14203
|
if (accountForRetina) {
|
|
@@ -14183,7 +14212,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
14183
14212
|
renderScale = Math.max(1, Math.min(8, renderScale));
|
|
14184
14213
|
return { visual: visualScale, render: renderScale };
|
|
14185
14214
|
}, [initialScale, accountForRetina, maxRetinaMultiplier]);
|
|
14186
|
-
(0,
|
|
14215
|
+
(0, import_react60.useEffect)(() => {
|
|
14187
14216
|
const supportsScrollTimeline = CSS.supports(
|
|
14188
14217
|
"animation-timeline",
|
|
14189
14218
|
"scroll()"
|
|
@@ -14233,7 +14262,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
14233
14262
|
}
|
|
14234
14263
|
|
|
14235
14264
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
14236
|
-
var
|
|
14265
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14237
14266
|
function HeroZoomLayout({
|
|
14238
14267
|
config = {},
|
|
14239
14268
|
header,
|
|
@@ -14248,9 +14277,9 @@ function HeroZoomLayout({
|
|
|
14248
14277
|
};
|
|
14249
14278
|
const { aspectRatio, initialScale, headerHeight } = mergedConfig;
|
|
14250
14279
|
const { visual, render, isHydrated } = useHeroZoomScales(mergedConfig);
|
|
14251
|
-
const imageContainerRef = (0,
|
|
14252
|
-
const headerRef = (0,
|
|
14253
|
-
(0,
|
|
14280
|
+
const imageContainerRef = (0, import_react61.useRef)(null);
|
|
14281
|
+
const headerRef = (0, import_react61.useRef)(null);
|
|
14282
|
+
(0, import_react61.useEffect)(() => {
|
|
14254
14283
|
if (typeof window === "undefined") return;
|
|
14255
14284
|
const originalRestoration = "scrollRestoration" in history ? history.scrollRestoration : "auto";
|
|
14256
14285
|
if ("scrollRestoration" in history) {
|
|
@@ -14263,7 +14292,7 @@ function HeroZoomLayout({
|
|
|
14263
14292
|
}
|
|
14264
14293
|
};
|
|
14265
14294
|
}, []);
|
|
14266
|
-
(0,
|
|
14295
|
+
(0, import_react61.useEffect)(() => {
|
|
14267
14296
|
const supportsScrollTimeline = CSS.supports(
|
|
14268
14297
|
"animation-timeline",
|
|
14269
14298
|
"scroll()"
|
|
@@ -14392,7 +14421,7 @@ function HeroZoomLayout({
|
|
|
14392
14421
|
The drawer covers the hero completely, so let animation run continuously. */
|
|
14393
14422
|
}
|
|
14394
14423
|
`;
|
|
14395
|
-
return /* @__PURE__ */ (0,
|
|
14424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
14396
14425
|
"div",
|
|
14397
14426
|
{
|
|
14398
14427
|
className: `relative min-h-screen ${className}`,
|
|
@@ -14406,8 +14435,8 @@ function HeroZoomLayout({
|
|
|
14406
14435
|
"--hero-zoom-final-transform": 1 / activeRender
|
|
14407
14436
|
},
|
|
14408
14437
|
children: [
|
|
14409
|
-
/* @__PURE__ */ (0,
|
|
14410
|
-
/* @__PURE__ */ (0,
|
|
14438
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14439
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14411
14440
|
"div",
|
|
14412
14441
|
{
|
|
14413
14442
|
style: {
|
|
@@ -14415,7 +14444,7 @@ function HeroZoomLayout({
|
|
|
14415
14444
|
}
|
|
14416
14445
|
}
|
|
14417
14446
|
),
|
|
14418
|
-
header && /* @__PURE__ */ (0,
|
|
14447
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14419
14448
|
"div",
|
|
14420
14449
|
{
|
|
14421
14450
|
ref: headerRef,
|
|
@@ -14428,7 +14457,7 @@ function HeroZoomLayout({
|
|
|
14428
14457
|
children: header
|
|
14429
14458
|
}
|
|
14430
14459
|
),
|
|
14431
|
-
/* @__PURE__ */ (0,
|
|
14460
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14432
14461
|
"div",
|
|
14433
14462
|
{
|
|
14434
14463
|
ref: imageContainerRef,
|
|
@@ -14448,15 +14477,15 @@ function HeroZoomLayout({
|
|
|
14448
14477
|
children: hero
|
|
14449
14478
|
}
|
|
14450
14479
|
),
|
|
14451
|
-
/* @__PURE__ */ (0,
|
|
14480
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "relative z-10", children })
|
|
14452
14481
|
]
|
|
14453
14482
|
}
|
|
14454
14483
|
);
|
|
14455
14484
|
}
|
|
14456
14485
|
|
|
14457
14486
|
// src/layouts/hero-zoom/HeroShrinkLayout.tsx
|
|
14458
|
-
var
|
|
14459
|
-
var
|
|
14487
|
+
var import_react62 = require("react");
|
|
14488
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14460
14489
|
var DEFAULT_CONFIG = {
|
|
14461
14490
|
aspectRatio: 16 / 9,
|
|
14462
14491
|
initialHeightPercent: 70,
|
|
@@ -14476,13 +14505,13 @@ function HeroShrinkLayout({
|
|
|
14476
14505
|
...config
|
|
14477
14506
|
};
|
|
14478
14507
|
const { aspectRatio, initialHeightPercent, minHeightPercent, headerHeight } = mergedConfig;
|
|
14479
|
-
const heroRef = (0,
|
|
14480
|
-
const headerRef = (0,
|
|
14481
|
-
const [isClient, setIsClient] = (0,
|
|
14482
|
-
(0,
|
|
14508
|
+
const heroRef = (0, import_react62.useRef)(null);
|
|
14509
|
+
const headerRef = (0, import_react62.useRef)(null);
|
|
14510
|
+
const [isClient, setIsClient] = (0, import_react62.useState)(false);
|
|
14511
|
+
(0, import_react62.useEffect)(() => {
|
|
14483
14512
|
setIsClient(true);
|
|
14484
14513
|
}, []);
|
|
14485
|
-
(0,
|
|
14514
|
+
(0, import_react62.useEffect)(() => {
|
|
14486
14515
|
if (!isClient) return;
|
|
14487
14516
|
const supportsScrollTimeline = CSS.supports("animation-timeline", "scroll()");
|
|
14488
14517
|
if (supportsScrollTimeline) return;
|
|
@@ -14569,15 +14598,15 @@ function HeroShrinkLayout({
|
|
|
14569
14598
|
}
|
|
14570
14599
|
`;
|
|
14571
14600
|
const spacerHeight = `calc(${initialHeightPercent}svh + ${headerHeight}px)`;
|
|
14572
|
-
return /* @__PURE__ */ (0,
|
|
14601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14573
14602
|
"div",
|
|
14574
14603
|
{
|
|
14575
14604
|
className: `relative min-h-screen ${className}`,
|
|
14576
14605
|
style: { ...style, ...cssVars },
|
|
14577
14606
|
children: [
|
|
14578
|
-
/* @__PURE__ */ (0,
|
|
14579
|
-
/* @__PURE__ */ (0,
|
|
14580
|
-
header && /* @__PURE__ */ (0,
|
|
14607
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14608
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { style: { height: spacerHeight } }),
|
|
14609
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14581
14610
|
"div",
|
|
14582
14611
|
{
|
|
14583
14612
|
ref: headerRef,
|
|
@@ -14586,7 +14615,7 @@ function HeroShrinkLayout({
|
|
|
14586
14615
|
children: header
|
|
14587
14616
|
}
|
|
14588
14617
|
),
|
|
14589
|
-
/* @__PURE__ */ (0,
|
|
14618
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14590
14619
|
"div",
|
|
14591
14620
|
{
|
|
14592
14621
|
ref: heroRef,
|
|
@@ -14594,15 +14623,15 @@ function HeroShrinkLayout({
|
|
|
14594
14623
|
children: hero
|
|
14595
14624
|
}
|
|
14596
14625
|
),
|
|
14597
|
-
/* @__PURE__ */ (0,
|
|
14626
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "relative z-10 bg-background", children })
|
|
14598
14627
|
]
|
|
14599
14628
|
}
|
|
14600
14629
|
);
|
|
14601
14630
|
}
|
|
14602
14631
|
|
|
14603
14632
|
// src/layouts/pdp/ImageEdgeBlur.tsx
|
|
14604
|
-
var
|
|
14605
|
-
var
|
|
14633
|
+
var import_react63 = __toESM(require("react"), 1);
|
|
14634
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14606
14635
|
var BLUR_CONFIG = {
|
|
14607
14636
|
blur: 24,
|
|
14608
14637
|
crossfade: 68
|
|
@@ -14626,7 +14655,7 @@ var BLUR_LAYERS = [
|
|
|
14626
14655
|
{ blur: Math.round(BLUR_CONFIG.blur * 0.5), zone: 0.6 },
|
|
14627
14656
|
{ blur: BLUR_CONFIG.blur, zone: 1 }
|
|
14628
14657
|
];
|
|
14629
|
-
var ImageEdgeBlur =
|
|
14658
|
+
var ImageEdgeBlur = import_react63.default.memo(
|
|
14630
14659
|
function ImageEdgeBlur2({
|
|
14631
14660
|
imageSrc,
|
|
14632
14661
|
imageCapInfo,
|
|
@@ -14657,7 +14686,7 @@ var ImageEdgeBlur = import_react62.default.memo(
|
|
|
14657
14686
|
viewportWidth / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO,
|
|
14658
14687
|
maxWidthPx / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO
|
|
14659
14688
|
);
|
|
14660
|
-
return /* @__PURE__ */ (0,
|
|
14689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14661
14690
|
"div",
|
|
14662
14691
|
{
|
|
14663
14692
|
className: `absolute inset-0 pointer-events-none overflow-hidden ${className}`,
|
|
@@ -14665,7 +14694,7 @@ var ImageEdgeBlur = import_react62.default.memo(
|
|
|
14665
14694
|
children: BLUR_LAYERS.map((layer, index) => {
|
|
14666
14695
|
const layerMask = index === BLUR_LAYERS.length - 1 ? void 0 : `linear-gradient(to right, black 0%, black ${layer.zone * 100}%, transparent ${layer.zone * 100 + 10}%)`;
|
|
14667
14696
|
const blurScale = 1 + layer.blur * 3 / containerHeightPx;
|
|
14668
|
-
return /* @__PURE__ */ (0,
|
|
14697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14669
14698
|
"img",
|
|
14670
14699
|
{
|
|
14671
14700
|
src: imageSrc,
|
|
@@ -14712,7 +14741,7 @@ var ImageEdgeBlur = import_react62.default.memo(
|
|
|
14712
14741
|
);
|
|
14713
14742
|
|
|
14714
14743
|
// src/layouts/pdp/PDPLayout.tsx
|
|
14715
|
-
var
|
|
14744
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14716
14745
|
function PDPLayout({
|
|
14717
14746
|
renderHeroImage,
|
|
14718
14747
|
renderContent,
|
|
@@ -14740,15 +14769,15 @@ function PDPLayout({
|
|
|
14740
14769
|
isDesktop,
|
|
14741
14770
|
isWideMonitor: isWideMonitor2
|
|
14742
14771
|
};
|
|
14743
|
-
return /* @__PURE__ */ (0,
|
|
14744
|
-
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ (0,
|
|
14745
|
-
renderMobileCarousel && /* @__PURE__ */ (0,
|
|
14746
|
-
/* @__PURE__ */ (0,
|
|
14772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: `pdp-layout ${className}`, children: [
|
|
14773
|
+
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "md:hidden", children: [
|
|
14774
|
+
renderMobileCarousel && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "mobile-carousel-container", children: renderMobileCarousel({ images: carouselImages }) }),
|
|
14775
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "mobile-content p-4", children: renderContent(contentProps) })
|
|
14747
14776
|
] }),
|
|
14748
|
-
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ (0,
|
|
14749
|
-
/* @__PURE__ */ (0,
|
|
14777
|
+
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "hidden md:block relative", children: [
|
|
14778
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "desktop-hero relative", children: [
|
|
14750
14779
|
renderHeroImage(heroProps),
|
|
14751
|
-
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ (0,
|
|
14780
|
+
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14752
14781
|
ImageEdgeBlur,
|
|
14753
14782
|
{
|
|
14754
14783
|
imageSrc: blurImageSrc,
|
|
@@ -14759,7 +14788,7 @@ function PDPLayout({
|
|
|
14759
14788
|
}
|
|
14760
14789
|
)
|
|
14761
14790
|
] }),
|
|
14762
|
-
/* @__PURE__ */ (0,
|
|
14791
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14763
14792
|
"div",
|
|
14764
14793
|
{
|
|
14765
14794
|
className: "desktop-sidebar",
|
|
@@ -14776,8 +14805,8 @@ function PDPLayout({
|
|
|
14776
14805
|
}
|
|
14777
14806
|
|
|
14778
14807
|
// src/layouts/pdp/SimpleImageBlur.tsx
|
|
14779
|
-
var
|
|
14780
|
-
var
|
|
14808
|
+
var import_react64 = __toESM(require("react"), 1);
|
|
14809
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14781
14810
|
var BLUR_CONFIG2 = {
|
|
14782
14811
|
blur: 24,
|
|
14783
14812
|
crossfade: 60
|
|
@@ -14800,7 +14829,7 @@ function getFadeInMask(crossfadeWidth) {
|
|
|
14800
14829
|
black ${crossfadeWidth + 10}px
|
|
14801
14830
|
)`;
|
|
14802
14831
|
}
|
|
14803
|
-
var SimpleImageBlur =
|
|
14832
|
+
var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
14804
14833
|
imageSrc,
|
|
14805
14834
|
width,
|
|
14806
14835
|
height = "100%",
|
|
@@ -14810,7 +14839,7 @@ var SimpleImageBlur = import_react63.default.memo(function SimpleImageBlur2({
|
|
|
14810
14839
|
if (!imageSrc || width <= 0) return null;
|
|
14811
14840
|
const fadeInMask = getFadeInMask(BLUR_CONFIG2.crossfade);
|
|
14812
14841
|
const extendedWidth = width + BLUR_CONFIG2.blur * 2;
|
|
14813
|
-
return /* @__PURE__ */ (0,
|
|
14842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14814
14843
|
"div",
|
|
14815
14844
|
{
|
|
14816
14845
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -14823,7 +14852,7 @@ var SimpleImageBlur = import_react63.default.memo(function SimpleImageBlur2({
|
|
|
14823
14852
|
black 0%,
|
|
14824
14853
|
black ${layer.zone * 100}%,
|
|
14825
14854
|
transparent ${layer.zone * 100 + 10}%)`;
|
|
14826
|
-
return /* @__PURE__ */ (0,
|
|
14855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14827
14856
|
"img",
|
|
14828
14857
|
{
|
|
14829
14858
|
src: imageSrc,
|
|
@@ -14853,8 +14882,8 @@ var SimpleImageBlur = import_react63.default.memo(function SimpleImageBlur2({
|
|
|
14853
14882
|
});
|
|
14854
14883
|
|
|
14855
14884
|
// src/layouts/pdp/EdgeBlurBox.tsx
|
|
14856
|
-
var
|
|
14857
|
-
var
|
|
14885
|
+
var import_react65 = __toESM(require("react"), 1);
|
|
14886
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14858
14887
|
var BLUR_CONFIG3 = {
|
|
14859
14888
|
blur: 24,
|
|
14860
14889
|
crossfade: 60
|
|
@@ -14878,7 +14907,7 @@ function getFadeOutMask(crossfadeWidth) {
|
|
|
14878
14907
|
transparent 100%
|
|
14879
14908
|
)`;
|
|
14880
14909
|
}
|
|
14881
|
-
var EdgeBlurBox =
|
|
14910
|
+
var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
14882
14911
|
imageSrc,
|
|
14883
14912
|
width,
|
|
14884
14913
|
height = "100%",
|
|
@@ -14893,7 +14922,7 @@ var EdgeBlurBox = import_react64.default.memo(function EdgeBlurBox2({
|
|
|
14893
14922
|
const blurExtend = BLUR_CONFIG3.blur * 2;
|
|
14894
14923
|
const actualSharpWidth = sharpImageWidth ?? width + overlapLeft;
|
|
14895
14924
|
const hasOverlap = overlapLeft > 0;
|
|
14896
|
-
return /* @__PURE__ */ (0,
|
|
14925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
14897
14926
|
"div",
|
|
14898
14927
|
{
|
|
14899
14928
|
className: `relative ${className}`,
|
|
@@ -14904,7 +14933,7 @@ var EdgeBlurBox = import_react64.default.memo(function EdgeBlurBox2({
|
|
|
14904
14933
|
overflow: hasOverlap ? "visible" : "hidden"
|
|
14905
14934
|
},
|
|
14906
14935
|
children: [
|
|
14907
|
-
/* @__PURE__ */ (0,
|
|
14936
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14908
14937
|
"div",
|
|
14909
14938
|
{
|
|
14910
14939
|
style: {
|
|
@@ -14918,7 +14947,7 @@ var EdgeBlurBox = import_react64.default.memo(function EdgeBlurBox2({
|
|
|
14918
14947
|
transparent ${100 - (layer.zone * 100 + 10)}%,
|
|
14919
14948
|
black ${100 - layer.zone * 100}%,
|
|
14920
14949
|
black 100%)`;
|
|
14921
|
-
return /* @__PURE__ */ (0,
|
|
14950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14922
14951
|
"img",
|
|
14923
14952
|
{
|
|
14924
14953
|
src: imageSrc,
|
|
@@ -14946,7 +14975,7 @@ var EdgeBlurBox = import_react64.default.memo(function EdgeBlurBox2({
|
|
|
14946
14975
|
})
|
|
14947
14976
|
}
|
|
14948
14977
|
),
|
|
14949
|
-
/* @__PURE__ */ (0,
|
|
14978
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14950
14979
|
"img",
|
|
14951
14980
|
{
|
|
14952
14981
|
src: imageSrc,
|
|
@@ -14974,8 +15003,8 @@ var EdgeBlurBox = import_react64.default.memo(function EdgeBlurBox2({
|
|
|
14974
15003
|
});
|
|
14975
15004
|
|
|
14976
15005
|
// src/layouts/pdp/ImageBlurExtension.tsx
|
|
14977
|
-
var
|
|
14978
|
-
var
|
|
15006
|
+
var import_react66 = __toESM(require("react"), 1);
|
|
15007
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14979
15008
|
var BLUR_CONFIG4 = {
|
|
14980
15009
|
blur: 24,
|
|
14981
15010
|
crossfadeWidth: 80
|
|
@@ -14998,7 +15027,7 @@ function getFadeOutMask2(crossfadeWidth) {
|
|
|
14998
15027
|
transparent 100%
|
|
14999
15028
|
)`;
|
|
15000
15029
|
}
|
|
15001
|
-
var ImageBlurExtension =
|
|
15030
|
+
var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension2({
|
|
15002
15031
|
imageSrc,
|
|
15003
15032
|
width,
|
|
15004
15033
|
height,
|
|
@@ -15012,7 +15041,7 @@ var ImageBlurExtension = import_react65.default.memo(function ImageBlurExtension
|
|
|
15012
15041
|
const internalImageLeft = `calc(${heroImageLeft} - 100vw + ${width}px)`;
|
|
15013
15042
|
const fadeOutMask = getFadeOutMask2(crossfadeWidth);
|
|
15014
15043
|
const heightValue = typeof height === "number" ? `${height}px` : height;
|
|
15015
|
-
return /* @__PURE__ */ (0,
|
|
15044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
15016
15045
|
"div",
|
|
15017
15046
|
{
|
|
15018
15047
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -15021,7 +15050,7 @@ var ImageBlurExtension = import_react65.default.memo(function ImageBlurExtension
|
|
|
15021
15050
|
height: heightValue
|
|
15022
15051
|
},
|
|
15023
15052
|
children: [
|
|
15024
|
-
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ (0,
|
|
15053
|
+
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
15025
15054
|
"img",
|
|
15026
15055
|
{
|
|
15027
15056
|
src: imageSrc,
|
|
@@ -15045,7 +15074,7 @@ var ImageBlurExtension = import_react65.default.memo(function ImageBlurExtension
|
|
|
15045
15074
|
},
|
|
15046
15075
|
`blur-${index}`
|
|
15047
15076
|
)),
|
|
15048
|
-
/* @__PURE__ */ (0,
|
|
15077
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
15049
15078
|
"img",
|
|
15050
15079
|
{
|
|
15051
15080
|
src: imageSrc,
|
|
@@ -15073,39 +15102,39 @@ var ImageBlurExtension = import_react65.default.memo(function ImageBlurExtension
|
|
|
15073
15102
|
});
|
|
15074
15103
|
|
|
15075
15104
|
// src/design-system/ColorSwatch.tsx
|
|
15076
|
-
var
|
|
15105
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
15077
15106
|
function ColorTokenSwatch({ name, cssVar, className = "" }) {
|
|
15078
|
-
return /* @__PURE__ */ (0,
|
|
15079
|
-
/* @__PURE__ */ (0,
|
|
15107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, children: [
|
|
15108
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15080
15109
|
"div",
|
|
15081
15110
|
{
|
|
15082
15111
|
className: "h-16 w-full rounded-lg border border-border shadow-sm",
|
|
15083
15112
|
style: { backgroundColor: `var(${cssVar})` }
|
|
15084
15113
|
}
|
|
15085
15114
|
),
|
|
15086
|
-
/* @__PURE__ */ (0,
|
|
15087
|
-
/* @__PURE__ */ (0,
|
|
15115
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15116
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("code", { className: "text-xs text-muted-foreground font-mono", children: cssVar })
|
|
15088
15117
|
] });
|
|
15089
15118
|
}
|
|
15090
15119
|
function ColorRow({ name, cssVar, description }) {
|
|
15091
|
-
return /* @__PURE__ */ (0,
|
|
15092
|
-
/* @__PURE__ */ (0,
|
|
15120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex items-center gap-4 py-2", children: [
|
|
15121
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15093
15122
|
"div",
|
|
15094
15123
|
{
|
|
15095
15124
|
className: "h-10 w-10 rounded-lg border border-border shadow-sm flex-shrink-0",
|
|
15096
15125
|
style: { backgroundColor: `var(${cssVar})` }
|
|
15097
15126
|
}
|
|
15098
15127
|
),
|
|
15099
|
-
/* @__PURE__ */ (0,
|
|
15100
|
-
/* @__PURE__ */ (0,
|
|
15101
|
-
description && /* @__PURE__ */ (0,
|
|
15128
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
15129
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15130
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "text-xs text-muted-foreground", children: description })
|
|
15102
15131
|
] }),
|
|
15103
|
-
/* @__PURE__ */ (0,
|
|
15132
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: cssVar })
|
|
15104
15133
|
] });
|
|
15105
15134
|
}
|
|
15106
15135
|
|
|
15107
15136
|
// src/design-system/ColorPalette.tsx
|
|
15108
|
-
var
|
|
15137
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
15109
15138
|
var COLOR_GROUPS = [
|
|
15110
15139
|
{
|
|
15111
15140
|
name: "Base",
|
|
@@ -15186,17 +15215,17 @@ var COLOR_GROUPS = [
|
|
|
15186
15215
|
}
|
|
15187
15216
|
];
|
|
15188
15217
|
function ColorPalette({ layout = "list", className = "" }) {
|
|
15189
|
-
return /* @__PURE__ */ (0,
|
|
15190
|
-
/* @__PURE__ */ (0,
|
|
15191
|
-
/* @__PURE__ */ (0,
|
|
15192
|
-
layout === "grid" ? /* @__PURE__ */ (0,
|
|
15218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: `space-y-8 ${className}`, children: COLOR_GROUPS.map((group) => /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("section", { children: [
|
|
15219
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("h3", { className: "text-lg font-semibold text-foreground mb-1", children: group.name }),
|
|
15220
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: group.description }),
|
|
15221
|
+
layout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: group.colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
15193
15222
|
ColorTokenSwatch,
|
|
15194
15223
|
{
|
|
15195
15224
|
name: color.name,
|
|
15196
15225
|
cssVar: color.cssVar
|
|
15197
15226
|
},
|
|
15198
15227
|
color.cssVar
|
|
15199
|
-
)) }) : /* @__PURE__ */ (0,
|
|
15228
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime86.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_runtime86.jsx)(
|
|
15200
15229
|
ColorRow,
|
|
15201
15230
|
{
|
|
15202
15231
|
name: color.name,
|
|
@@ -15209,7 +15238,7 @@ function ColorPalette({ layout = "list", className = "" }) {
|
|
|
15209
15238
|
}
|
|
15210
15239
|
|
|
15211
15240
|
// src/design-system/TypographyScale.tsx
|
|
15212
|
-
var
|
|
15241
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
15213
15242
|
var FONT_SAMPLES = [
|
|
15214
15243
|
{
|
|
15215
15244
|
name: "Heading",
|
|
@@ -15243,14 +15272,14 @@ var FONT_SAMPLES = [
|
|
|
15243
15272
|
}
|
|
15244
15273
|
];
|
|
15245
15274
|
function TypographyScale({ className = "" }) {
|
|
15246
|
-
return /* @__PURE__ */ (0,
|
|
15247
|
-
/* @__PURE__ */ (0,
|
|
15248
|
-
/* @__PURE__ */ (0,
|
|
15249
|
-
/* @__PURE__ */ (0,
|
|
15275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `space-y-8 ${className}`, children: FONT_SAMPLES.map((font) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("section", { className: "bg-card rounded-lg border border-border p-6", children: [
|
|
15276
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
|
15277
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: font.name }),
|
|
15278
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: font.cssVar })
|
|
15250
15279
|
] }),
|
|
15251
|
-
/* @__PURE__ */ (0,
|
|
15252
|
-
/* @__PURE__ */ (0,
|
|
15253
|
-
/* @__PURE__ */ (0,
|
|
15280
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "space-y-4", children: font.sizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-baseline gap-4", children: [
|
|
15281
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-xs text-muted-foreground w-20 flex-shrink-0", children: size }),
|
|
15282
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15254
15283
|
"p",
|
|
15255
15284
|
{
|
|
15256
15285
|
className: `${size} text-foreground`,
|
|
@@ -15269,8 +15298,8 @@ var RADIUS_SAMPLES = [
|
|
|
15269
15298
|
{ name: "Full", value: "9999px" }
|
|
15270
15299
|
];
|
|
15271
15300
|
function RadiusScale({ className = "" }) {
|
|
15272
|
-
return /* @__PURE__ */ (0,
|
|
15273
|
-
/* @__PURE__ */ (0,
|
|
15301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `space-y-4 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "grid grid-cols-5 gap-4", children: RADIUS_SAMPLES.map((radius) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
15302
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15274
15303
|
"div",
|
|
15275
15304
|
{
|
|
15276
15305
|
className: "h-16 w-16 bg-primary",
|
|
@@ -15279,13 +15308,13 @@ function RadiusScale({ className = "" }) {
|
|
|
15279
15308
|
}
|
|
15280
15309
|
}
|
|
15281
15310
|
),
|
|
15282
|
-
/* @__PURE__ */ (0,
|
|
15283
|
-
/* @__PURE__ */ (0,
|
|
15311
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "text-sm font-medium text-foreground", children: radius.name }),
|
|
15312
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("code", { className: "text-xs text-muted-foreground font-mono", children: radius.cssVar || radius.value })
|
|
15284
15313
|
] }, radius.name)) }) });
|
|
15285
15314
|
}
|
|
15286
15315
|
|
|
15287
15316
|
// src/design-system/ThemeSwitcher.tsx
|
|
15288
|
-
var
|
|
15317
|
+
var import_react67 = require("react");
|
|
15289
15318
|
|
|
15290
15319
|
// src/themes/types.ts
|
|
15291
15320
|
var RADIUS_PRESETS = {
|
|
@@ -16453,7 +16482,7 @@ function applyTheme(config) {
|
|
|
16453
16482
|
}
|
|
16454
16483
|
|
|
16455
16484
|
// src/design-system/ThemeSwitcher.tsx
|
|
16456
|
-
var
|
|
16485
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
16457
16486
|
function readThemeFromDOM() {
|
|
16458
16487
|
if (typeof document === "undefined") {
|
|
16459
16488
|
return { themeName: "Linear", isDark: false };
|
|
@@ -16471,10 +16500,10 @@ function readThemeFromDOM() {
|
|
|
16471
16500
|
return { themeName: "Linear", isDark: dark };
|
|
16472
16501
|
}
|
|
16473
16502
|
function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
16474
|
-
const [currentTheme, setCurrentTheme] = (0,
|
|
16475
|
-
const [isDark, setIsDark] = (0,
|
|
16476
|
-
const [isOpen, setIsOpen] = (0,
|
|
16477
|
-
(0,
|
|
16503
|
+
const [currentTheme, setCurrentTheme] = (0, import_react67.useState)("Linear");
|
|
16504
|
+
const [isDark, setIsDark] = (0, import_react67.useState)(false);
|
|
16505
|
+
const [isOpen, setIsOpen] = (0, import_react67.useState)(false);
|
|
16506
|
+
(0, import_react67.useEffect)(() => {
|
|
16478
16507
|
const { themeName, isDark: dark } = readThemeFromDOM();
|
|
16479
16508
|
setCurrentTheme(themeName);
|
|
16480
16509
|
setIsDark(dark);
|
|
@@ -16513,61 +16542,61 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
16513
16542
|
applyTheme(config);
|
|
16514
16543
|
};
|
|
16515
16544
|
const themes = showBaseThemesOnly ? baseThemes : baseThemes;
|
|
16516
|
-
return /* @__PURE__ */ (0,
|
|
16517
|
-
/* @__PURE__ */ (0,
|
|
16518
|
-
/* @__PURE__ */ (0,
|
|
16545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: `flex items-center gap-3 ${className}`, children: [
|
|
16546
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "relative", children: [
|
|
16547
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
16519
16548
|
"button",
|
|
16520
16549
|
{
|
|
16521
16550
|
onClick: () => setIsOpen(!isOpen),
|
|
16522
16551
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
16523
16552
|
children: [
|
|
16524
|
-
/* @__PURE__ */ (0,
|
|
16525
|
-
/* @__PURE__ */ (0,
|
|
16526
|
-
/* @__PURE__ */ (0,
|
|
16553
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime88.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" }) }),
|
|
16554
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-medium", children: currentTheme }),
|
|
16555
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.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_runtime88.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
16527
16556
|
]
|
|
16528
16557
|
}
|
|
16529
16558
|
),
|
|
16530
|
-
isOpen && /* @__PURE__ */ (0,
|
|
16531
|
-
/* @__PURE__ */ (0,
|
|
16559
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
16560
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
16532
16561
|
"div",
|
|
16533
16562
|
{
|
|
16534
16563
|
className: "fixed inset-0 z-40",
|
|
16535
16564
|
onClick: () => setIsOpen(false)
|
|
16536
16565
|
}
|
|
16537
16566
|
),
|
|
16538
|
-
/* @__PURE__ */ (0,
|
|
16567
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.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_runtime88.jsxs)(
|
|
16539
16568
|
"button",
|
|
16540
16569
|
{
|
|
16541
16570
|
onClick: () => handleThemeSelect(theme.name),
|
|
16542
16571
|
className: `w-full px-4 py-2 text-left hover:bg-muted transition-colors flex items-center gap-3 ${currentTheme === theme.name ? "bg-muted" : ""}`,
|
|
16543
16572
|
children: [
|
|
16544
|
-
/* @__PURE__ */ (0,
|
|
16573
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
16545
16574
|
"div",
|
|
16546
16575
|
{
|
|
16547
16576
|
className: "w-4 h-4 rounded-full border border-border",
|
|
16548
16577
|
style: { backgroundColor: theme.primaryColor || "#888" }
|
|
16549
16578
|
}
|
|
16550
16579
|
),
|
|
16551
|
-
/* @__PURE__ */ (0,
|
|
16552
|
-
currentTheme === theme.name && /* @__PURE__ */ (0,
|
|
16580
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-foreground", children: theme.name }),
|
|
16581
|
+
currentTheme === theme.name && /* @__PURE__ */ (0, import_jsx_runtime88.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_runtime88.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
16553
16582
|
]
|
|
16554
16583
|
},
|
|
16555
16584
|
theme.name
|
|
16556
16585
|
)) })
|
|
16557
16586
|
] })
|
|
16558
16587
|
] }),
|
|
16559
|
-
/* @__PURE__ */ (0,
|
|
16588
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
16560
16589
|
"button",
|
|
16561
16590
|
{
|
|
16562
16591
|
onClick: handleDarkModeToggle,
|
|
16563
16592
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
16564
16593
|
title: `Switch to ${isDark ? "light" : "dark"} mode`,
|
|
16565
16594
|
children: [
|
|
16566
|
-
isDark ? /* @__PURE__ */ (0,
|
|
16567
|
-
/* @__PURE__ */ (0,
|
|
16568
|
-
/* @__PURE__ */ (0,
|
|
16569
|
-
] }) : /* @__PURE__ */ (0,
|
|
16570
|
-
/* @__PURE__ */ (0,
|
|
16595
|
+
isDark ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
16596
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
16597
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.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" })
|
|
16598
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
16599
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-sm", children: isDark ? "Light" : "Dark" })
|
|
16571
16600
|
]
|
|
16572
16601
|
}
|
|
16573
16602
|
)
|
|
@@ -16575,7 +16604,7 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
16575
16604
|
}
|
|
16576
16605
|
|
|
16577
16606
|
// src/design-system/DesignSystemPage.tsx
|
|
16578
|
-
var
|
|
16607
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
16579
16608
|
function DesignSystemPage({
|
|
16580
16609
|
showThemeSwitcher = true,
|
|
16581
16610
|
showColors = true,
|
|
@@ -16585,29 +16614,29 @@ function DesignSystemPage({
|
|
|
16585
16614
|
colorLayout = "list",
|
|
16586
16615
|
className = ""
|
|
16587
16616
|
}) {
|
|
16588
|
-
return /* @__PURE__ */ (0,
|
|
16589
|
-
/* @__PURE__ */ (0,
|
|
16590
|
-
/* @__PURE__ */ (0,
|
|
16591
|
-
/* @__PURE__ */ (0,
|
|
16592
|
-
/* @__PURE__ */ (0,
|
|
16617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `max-w-4xl mx-auto px-4 py-8 ${className}`, children: [
|
|
16618
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("header", { className: "mb-12", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4", children: [
|
|
16619
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { children: [
|
|
16620
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h1", { className: "text-4xl font-bold text-foreground mb-2", children: "Design System" }),
|
|
16621
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-lg text-muted-foreground", children: "Visual reference for theme tokens and styles" })
|
|
16593
16622
|
] }),
|
|
16594
|
-
showThemeSwitcher && /* @__PURE__ */ (0,
|
|
16623
|
+
showThemeSwitcher && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ThemeSwitcher, {})
|
|
16595
16624
|
] }) }),
|
|
16596
|
-
showColors && /* @__PURE__ */ (0,
|
|
16597
|
-
/* @__PURE__ */ (0,
|
|
16598
|
-
/* @__PURE__ */ (0,
|
|
16625
|
+
showColors && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "mb-16", children: [
|
|
16626
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Color Palette" }),
|
|
16627
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ColorPalette, { layout: colorLayout })
|
|
16599
16628
|
] }),
|
|
16600
|
-
showTypography && /* @__PURE__ */ (0,
|
|
16601
|
-
/* @__PURE__ */ (0,
|
|
16602
|
-
/* @__PURE__ */ (0,
|
|
16629
|
+
showTypography && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "mb-16", children: [
|
|
16630
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Typography" }),
|
|
16631
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TypographyScale, {})
|
|
16603
16632
|
] }),
|
|
16604
|
-
showRadius && /* @__PURE__ */ (0,
|
|
16605
|
-
/* @__PURE__ */ (0,
|
|
16606
|
-
/* @__PURE__ */ (0,
|
|
16633
|
+
showRadius && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "mb-16", children: [
|
|
16634
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Border Radius" }),
|
|
16635
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(RadiusScale, {})
|
|
16607
16636
|
] }),
|
|
16608
|
-
showSpacing && /* @__PURE__ */ (0,
|
|
16609
|
-
/* @__PURE__ */ (0,
|
|
16610
|
-
/* @__PURE__ */ (0,
|
|
16637
|
+
showSpacing && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "mb-16", children: [
|
|
16638
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Spacing Scale" }),
|
|
16639
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SpacingScale, {})
|
|
16611
16640
|
] })
|
|
16612
16641
|
] });
|
|
16613
16642
|
}
|
|
@@ -16622,31 +16651,31 @@ function SpacingScale() {
|
|
|
16622
16651
|
{ name: "12", value: "3rem" },
|
|
16623
16652
|
{ name: "16", value: "4rem" }
|
|
16624
16653
|
];
|
|
16625
|
-
return /* @__PURE__ */ (0,
|
|
16626
|
-
/* @__PURE__ */ (0,
|
|
16627
|
-
/* @__PURE__ */ (0,
|
|
16654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "space-y-2", children: spaces.map((space) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
16655
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("code", { className: "text-xs text-muted-foreground font-mono w-8", children: space.name }),
|
|
16656
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
16628
16657
|
"div",
|
|
16629
16658
|
{
|
|
16630
16659
|
className: "h-4 bg-primary rounded",
|
|
16631
16660
|
style: { width: space.value }
|
|
16632
16661
|
}
|
|
16633
16662
|
),
|
|
16634
|
-
/* @__PURE__ */ (0,
|
|
16663
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-sm text-muted-foreground", children: space.value })
|
|
16635
16664
|
] }, space.name)) });
|
|
16636
16665
|
}
|
|
16637
16666
|
|
|
16638
16667
|
// src/personalization/PersonalizationProvider.tsx
|
|
16639
|
-
var
|
|
16668
|
+
var import_react70 = __toESM(require("react"), 1);
|
|
16640
16669
|
|
|
16641
16670
|
// src/personalization/PersonalizationContext.ts
|
|
16642
|
-
var
|
|
16643
|
-
var PersonalizationContext = (0,
|
|
16671
|
+
var import_react68 = require("react");
|
|
16672
|
+
var PersonalizationContext = (0, import_react68.createContext)(null);
|
|
16644
16673
|
function usePersonalizationContext() {
|
|
16645
|
-
return (0,
|
|
16674
|
+
return (0, import_react68.useContext)(PersonalizationContext);
|
|
16646
16675
|
}
|
|
16647
16676
|
|
|
16648
16677
|
// src/personalization/utils.ts
|
|
16649
|
-
var
|
|
16678
|
+
var import_react69 = require("react");
|
|
16650
16679
|
function normalizeHex(color) {
|
|
16651
16680
|
let hex = color.trim().toUpperCase();
|
|
16652
16681
|
if (hex.length === 4 && hex.startsWith("#")) {
|
|
@@ -16667,8 +16696,8 @@ function isValidImageUrl(url) {
|
|
|
16667
16696
|
}
|
|
16668
16697
|
}
|
|
16669
16698
|
function useDebouncedValue(value, delay) {
|
|
16670
|
-
const [debounced, setDebounced] = (0,
|
|
16671
|
-
(0,
|
|
16699
|
+
const [debounced, setDebounced] = (0, import_react69.useState)(value);
|
|
16700
|
+
(0, import_react69.useEffect)(() => {
|
|
16672
16701
|
const timer = setTimeout(() => setDebounced(value), delay);
|
|
16673
16702
|
return () => clearTimeout(timer);
|
|
16674
16703
|
}, [value, delay]);
|
|
@@ -16689,18 +16718,18 @@ function scrollInputAboveKeyboard(input) {
|
|
|
16689
16718
|
}
|
|
16690
16719
|
|
|
16691
16720
|
// src/personalization/PersonalizationProvider.tsx
|
|
16692
|
-
var
|
|
16721
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
16693
16722
|
function createBridgeFromCanvas(canvasModule) {
|
|
16694
16723
|
const { useEditor, useCommands, useImageBinding } = canvasModule;
|
|
16695
16724
|
function TextBinder({ name, value }) {
|
|
16696
16725
|
const { elements } = useEditor();
|
|
16697
16726
|
const { executeElementUpdate } = useCommands();
|
|
16698
|
-
const elementsRef =
|
|
16727
|
+
const elementsRef = import_react70.default.useRef(elements);
|
|
16699
16728
|
elementsRef.current = elements;
|
|
16700
|
-
const executeRef =
|
|
16729
|
+
const executeRef = import_react70.default.useRef(executeElementUpdate);
|
|
16701
16730
|
executeRef.current = executeElementUpdate;
|
|
16702
|
-
const hasUserInput =
|
|
16703
|
-
|
|
16731
|
+
const hasUserInput = import_react70.default.useRef(false);
|
|
16732
|
+
import_react70.default.useEffect(() => {
|
|
16704
16733
|
if (value == null) return;
|
|
16705
16734
|
if (value === "" && !hasUserInput.current) return;
|
|
16706
16735
|
hasUserInput.current = true;
|
|
@@ -16718,12 +16747,12 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16718
16747
|
function ColorBinder({ originalColor, newColor }) {
|
|
16719
16748
|
const { elements } = useEditor();
|
|
16720
16749
|
const { executeElementUpdate } = useCommands();
|
|
16721
|
-
const elementsRef =
|
|
16750
|
+
const elementsRef = import_react70.default.useRef(elements);
|
|
16722
16751
|
elementsRef.current = elements;
|
|
16723
|
-
const executeRef =
|
|
16752
|
+
const executeRef = import_react70.default.useRef(executeElementUpdate);
|
|
16724
16753
|
executeRef.current = executeElementUpdate;
|
|
16725
|
-
const appliedColorRef =
|
|
16726
|
-
|
|
16754
|
+
const appliedColorRef = import_react70.default.useRef(normalizeHex(originalColor));
|
|
16755
|
+
import_react70.default.useEffect(() => {
|
|
16727
16756
|
const normalizedNew = normalizeHex(newColor);
|
|
16728
16757
|
if (normalizedNew === appliedColorRef.current) return;
|
|
16729
16758
|
const matchColor = appliedColorRef.current;
|
|
@@ -16763,11 +16792,11 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16763
16792
|
}
|
|
16764
16793
|
function ImageBinder({ name, value, fit = "cover" }) {
|
|
16765
16794
|
const { setImageUrl } = useImageBinding(name, { fit });
|
|
16766
|
-
const hasUserInput =
|
|
16795
|
+
const hasUserInput = import_react70.default.useRef(false);
|
|
16767
16796
|
const debouncedValue = useDebouncedValue(value, 500);
|
|
16768
|
-
const setImageUrlRef =
|
|
16797
|
+
const setImageUrlRef = import_react70.default.useRef(setImageUrl);
|
|
16769
16798
|
setImageUrlRef.current = setImageUrl;
|
|
16770
|
-
|
|
16799
|
+
import_react70.default.useEffect(() => {
|
|
16771
16800
|
if (debouncedValue == null) return;
|
|
16772
16801
|
if (debouncedValue === "" && !hasUserInput.current) return;
|
|
16773
16802
|
hasUserInput.current = true;
|
|
@@ -16777,15 +16806,15 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16777
16806
|
return null;
|
|
16778
16807
|
}
|
|
16779
16808
|
return function PersonalizationBridge({ fields = [], values = {} } = {}) {
|
|
16780
|
-
return /* @__PURE__ */ (0,
|
|
16809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_jsx_runtime90.Fragment, { children: fields.map((field) => {
|
|
16781
16810
|
if (field.type === "text") {
|
|
16782
|
-
return /* @__PURE__ */ (0,
|
|
16811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
|
|
16783
16812
|
}
|
|
16784
16813
|
if (field.type === "color") {
|
|
16785
|
-
return /* @__PURE__ */ (0,
|
|
16814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
|
|
16786
16815
|
}
|
|
16787
16816
|
if (field.type === "image") {
|
|
16788
|
-
return /* @__PURE__ */ (0,
|
|
16817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ImageBinder, { name: field.name, value: values[field.name] ?? "", fit: field.fit ?? "cover" }, `image-${field.name}`);
|
|
16789
16818
|
}
|
|
16790
16819
|
return null;
|
|
16791
16820
|
}) });
|
|
@@ -16807,20 +16836,20 @@ function PersonalizationProvider({
|
|
|
16807
16836
|
children
|
|
16808
16837
|
}) {
|
|
16809
16838
|
const realtime = useRealtimeOptional();
|
|
16810
|
-
const [personValues, setPersonValues] = (0,
|
|
16811
|
-
const [isActive, setIsActive] = (0,
|
|
16812
|
-
const [isExporting, setIsExporting] = (0,
|
|
16813
|
-
const [exportedBlobUrls, setExportedBlobUrls] = (0,
|
|
16814
|
-
const [exportCount, setExportCount] = (0,
|
|
16815
|
-
const blobUrlsRef = (0,
|
|
16816
|
-
const [CanvasComponent, setCanvasComponent] = (0,
|
|
16839
|
+
const [personValues, setPersonValues] = (0, import_react70.useState)(initialValues ?? {});
|
|
16840
|
+
const [isActive, setIsActive] = (0, import_react70.useState)(!!(initialValues && Object.keys(initialValues).length > 0));
|
|
16841
|
+
const [isExporting, setIsExporting] = (0, import_react70.useState)(false);
|
|
16842
|
+
const [exportedBlobUrls, setExportedBlobUrls] = (0, import_react70.useState)({});
|
|
16843
|
+
const [exportCount, setExportCount] = (0, import_react70.useState)(0);
|
|
16844
|
+
const blobUrlsRef = (0, import_react70.useRef)({});
|
|
16845
|
+
const [CanvasComponent, setCanvasComponent] = (0, import_react70.useState)(
|
|
16817
16846
|
cachedCanvasComponent
|
|
16818
16847
|
);
|
|
16819
|
-
const [BridgeComponent, setBridgeComponent] = (0,
|
|
16848
|
+
const [BridgeComponent, setBridgeComponent] = (0, import_react70.useState)(
|
|
16820
16849
|
cachedBridgeComponent
|
|
16821
16850
|
);
|
|
16822
16851
|
const hasFields = fields.length > 0;
|
|
16823
|
-
(0,
|
|
16852
|
+
(0, import_react70.useEffect)(() => {
|
|
16824
16853
|
if (CanvasComponent && BridgeComponent) return;
|
|
16825
16854
|
if (!canvasImport || !hasFields) return;
|
|
16826
16855
|
if (!canvasLoadPromise) {
|
|
@@ -16838,8 +16867,8 @@ function PersonalizationProvider({
|
|
|
16838
16867
|
}
|
|
16839
16868
|
});
|
|
16840
16869
|
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
16841
|
-
const realtimeEnabledRef = (0,
|
|
16842
|
-
(0,
|
|
16870
|
+
const realtimeEnabledRef = (0, import_react70.useRef)(false);
|
|
16871
|
+
(0, import_react70.useEffect)(() => {
|
|
16843
16872
|
return () => {
|
|
16844
16873
|
for (const url of Object.values(blobUrlsRef.current)) {
|
|
16845
16874
|
try {
|
|
@@ -16849,16 +16878,16 @@ function PersonalizationProvider({
|
|
|
16849
16878
|
}
|
|
16850
16879
|
};
|
|
16851
16880
|
}, []);
|
|
16852
|
-
const updateField = (0,
|
|
16881
|
+
const updateField = (0, import_react70.useCallback)((key, value) => {
|
|
16853
16882
|
setIsActive(true);
|
|
16854
16883
|
setPersonValues((prev) => ({ ...prev, [key]: value }));
|
|
16855
16884
|
}, []);
|
|
16856
|
-
const reset = (0,
|
|
16885
|
+
const reset = (0, import_react70.useCallback)(() => {
|
|
16857
16886
|
setPersonValues({});
|
|
16858
16887
|
setIsActive(false);
|
|
16859
16888
|
setIsExporting(false);
|
|
16860
16889
|
}, []);
|
|
16861
|
-
const handleExport = (0,
|
|
16890
|
+
const handleExport = (0, import_react70.useCallback)(
|
|
16862
16891
|
(exports2) => {
|
|
16863
16892
|
const newUrls = {};
|
|
16864
16893
|
for (const [name, data] of Object.entries(exports2)) {
|
|
@@ -16892,11 +16921,11 @@ function PersonalizationProvider({
|
|
|
16892
16921
|
},
|
|
16893
16922
|
[realtime, placementOverride]
|
|
16894
16923
|
);
|
|
16895
|
-
const handleExportScheduled = (0,
|
|
16924
|
+
const handleExportScheduled = (0, import_react70.useCallback)(() => {
|
|
16896
16925
|
setIsExporting(true);
|
|
16897
16926
|
}, []);
|
|
16898
16927
|
const shouldMountCanvas = CanvasComponent && BridgeComponent && canvasState?.elements && canvasState.elements.length > 0 && (!lazy || isActive);
|
|
16899
|
-
const contextValue =
|
|
16928
|
+
const contextValue = import_react70.default.useMemo(
|
|
16900
16929
|
() => ({
|
|
16901
16930
|
fields,
|
|
16902
16931
|
personValues,
|
|
@@ -16909,8 +16938,8 @@ function PersonalizationProvider({
|
|
|
16909
16938
|
}),
|
|
16910
16939
|
[fields, personValues, updateField, isActive, isExporting, exportedBlobUrls, exportCount, reset]
|
|
16911
16940
|
);
|
|
16912
|
-
return /* @__PURE__ */ (0,
|
|
16913
|
-
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ (0,
|
|
16941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(PersonalizationContext.Provider, { value: contextValue, children: [
|
|
16942
|
+
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16914
16943
|
"div",
|
|
16915
16944
|
{
|
|
16916
16945
|
style: {
|
|
@@ -16923,7 +16952,7 @@ function PersonalizationProvider({
|
|
|
16923
16952
|
pointerEvents: "none"
|
|
16924
16953
|
},
|
|
16925
16954
|
"aria-hidden": true,
|
|
16926
|
-
children: /* @__PURE__ */ (0,
|
|
16955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16927
16956
|
CanvasComponent,
|
|
16928
16957
|
{
|
|
16929
16958
|
initialElements: canvasState?.elements,
|
|
@@ -16943,7 +16972,7 @@ function PersonalizationProvider({
|
|
|
16943
16972
|
exportImageQuality: exportConfig?.imageQuality ?? 0.85,
|
|
16944
16973
|
onExport: handleExport,
|
|
16945
16974
|
onExportScheduled: handleExportScheduled,
|
|
16946
|
-
overlay: /* @__PURE__ */ (0,
|
|
16975
|
+
overlay: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(BridgeComponent, { fields, values: personValues })
|
|
16947
16976
|
}
|
|
16948
16977
|
)
|
|
16949
16978
|
},
|
|
@@ -16968,7 +16997,7 @@ function usePersonalizationOptional() {
|
|
|
16968
16997
|
}
|
|
16969
16998
|
|
|
16970
16999
|
// src/personalization/PersonalizationInputs.tsx
|
|
16971
|
-
var
|
|
17000
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
16972
17001
|
function PersonalizationInputs({
|
|
16973
17002
|
className,
|
|
16974
17003
|
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",
|
|
@@ -16992,8 +17021,8 @@ function PersonalizationInputs({
|
|
|
16992
17021
|
scrollInputAboveKeyboard(e.target);
|
|
16993
17022
|
}
|
|
16994
17023
|
};
|
|
16995
|
-
return /* @__PURE__ */ (0,
|
|
16996
|
-
textFields.map((field) => /* @__PURE__ */ (0,
|
|
17024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: className || "flex flex-col gap-3", children: [
|
|
17025
|
+
textFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
16997
17026
|
"input",
|
|
16998
17027
|
{
|
|
16999
17028
|
type: "text",
|
|
@@ -17007,8 +17036,8 @@ function PersonalizationInputs({
|
|
|
17007
17036
|
},
|
|
17008
17037
|
`text-${field.name}`
|
|
17009
17038
|
)),
|
|
17010
|
-
colorFields.map((field) => /* @__PURE__ */ (0,
|
|
17011
|
-
/* @__PURE__ */ (0,
|
|
17039
|
+
colorFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
17040
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17012
17041
|
"input",
|
|
17013
17042
|
{
|
|
17014
17043
|
type: "color",
|
|
@@ -17017,9 +17046,9 @@ function PersonalizationInputs({
|
|
|
17017
17046
|
onChange: (e) => updateField(field.color, e.target.value)
|
|
17018
17047
|
}
|
|
17019
17048
|
),
|
|
17020
|
-
/* @__PURE__ */ (0,
|
|
17049
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "text-base text-muted-foreground", children: field.label })
|
|
17021
17050
|
] }, `color-${field.color}`)),
|
|
17022
|
-
imageFields.map((field) => /* @__PURE__ */ (0,
|
|
17051
|
+
imageFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17023
17052
|
"input",
|
|
17024
17053
|
{
|
|
17025
17054
|
type: "text",
|
|
@@ -17037,15 +17066,15 @@ function PersonalizationInputs({
|
|
|
17037
17066
|
}
|
|
17038
17067
|
|
|
17039
17068
|
// src/personalization/usePersonalizationShimmer.ts
|
|
17040
|
-
var
|
|
17069
|
+
var import_react71 = require("react");
|
|
17041
17070
|
function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
17042
17071
|
const personCtx = usePersonalizationContext();
|
|
17043
17072
|
const realtime = useRealtimeOptional();
|
|
17044
|
-
const [shimmerActive, setShimmerActive] = (0,
|
|
17045
|
-
const sdkSettledRef = (0,
|
|
17046
|
-
const manualTriggerRef = (0,
|
|
17047
|
-
const safetyTimeoutRef = (0,
|
|
17048
|
-
const startShimmer = (0,
|
|
17073
|
+
const [shimmerActive, setShimmerActive] = (0, import_react71.useState)(false);
|
|
17074
|
+
const sdkSettledRef = (0, import_react71.useRef)(false);
|
|
17075
|
+
const manualTriggerRef = (0, import_react71.useRef)(false);
|
|
17076
|
+
const safetyTimeoutRef = (0, import_react71.useRef)(void 0);
|
|
17077
|
+
const startShimmer = (0, import_react71.useCallback)(() => {
|
|
17049
17078
|
setShimmerActive(true);
|
|
17050
17079
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
17051
17080
|
safetyTimeoutRef.current = setTimeout(
|
|
@@ -17057,25 +17086,25 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17057
17086
|
safetyTimeoutMs
|
|
17058
17087
|
);
|
|
17059
17088
|
}, [safetyTimeoutMs]);
|
|
17060
|
-
(0,
|
|
17089
|
+
(0, import_react71.useEffect)(() => {
|
|
17061
17090
|
if (!personCtx?.isActive) return;
|
|
17062
17091
|
sdkSettledRef.current = false;
|
|
17063
17092
|
manualTriggerRef.current = false;
|
|
17064
17093
|
realtime?.resetPipelineSettled();
|
|
17065
17094
|
startShimmer();
|
|
17066
17095
|
}, [personCtx?.personValues, personCtx?.isActive, startShimmer]);
|
|
17067
|
-
const triggerShimmer = (0,
|
|
17096
|
+
const triggerShimmer = (0, import_react71.useCallback)(() => {
|
|
17068
17097
|
sdkSettledRef.current = false;
|
|
17069
17098
|
manualTriggerRef.current = true;
|
|
17070
17099
|
startShimmer();
|
|
17071
17100
|
}, [startShimmer]);
|
|
17072
|
-
(0,
|
|
17101
|
+
(0, import_react71.useEffect)(() => {
|
|
17073
17102
|
if (!realtime?.subscribePipelineSettled) return;
|
|
17074
17103
|
return realtime.subscribePipelineSettled(() => {
|
|
17075
17104
|
sdkSettledRef.current = true;
|
|
17076
17105
|
});
|
|
17077
17106
|
}, [realtime]);
|
|
17078
|
-
(0,
|
|
17107
|
+
(0, import_react71.useEffect)(() => {
|
|
17079
17108
|
const container = containerRef.current;
|
|
17080
17109
|
if (!container) return;
|
|
17081
17110
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -17118,7 +17147,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17118
17147
|
});
|
|
17119
17148
|
return () => observer.disconnect();
|
|
17120
17149
|
}, [containerRef]);
|
|
17121
|
-
(0,
|
|
17150
|
+
(0, import_react71.useEffect)(() => {
|
|
17122
17151
|
return () => {
|
|
17123
17152
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
17124
17153
|
};
|
|
@@ -17233,6 +17262,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17233
17262
|
PDPLayout,
|
|
17234
17263
|
PersonalizationInputs,
|
|
17235
17264
|
PersonalizationProvider,
|
|
17265
|
+
PlacementArt,
|
|
17236
17266
|
PlacementClipShapeSelector,
|
|
17237
17267
|
PlacementTabs,
|
|
17238
17268
|
Popover,
|
|
@@ -17337,6 +17367,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17337
17367
|
normalizeHex,
|
|
17338
17368
|
observe,
|
|
17339
17369
|
pictureRenderState,
|
|
17370
|
+
placementArtFor,
|
|
17340
17371
|
runConfigChecks,
|
|
17341
17372
|
scrollInputAboveKeyboard,
|
|
17342
17373
|
searchClient,
|
|
@@ -17363,6 +17394,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17363
17394
|
usePersonalization,
|
|
17364
17395
|
usePersonalizationOptional,
|
|
17365
17396
|
usePersonalizationShimmer,
|
|
17397
|
+
usePlacementArtOptional,
|
|
17366
17398
|
usePlacementClipShape,
|
|
17367
17399
|
usePlacementsProcessor,
|
|
17368
17400
|
useProduct,
|