efficient-storefront-blocks 0.128.2 → 0.130.0
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 +60 -0
- package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +1 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +27 -27
- package/dist/render/app/globals.css +53 -6
- package/dist/render/components/GridCardTemplate.js +1 -1
- package/dist/render/components/ProductGallery.d.ts +3 -2
- package/dist/render/components/ProductGallery.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicProductGallery.d.ts +2 -1
- package/dist/render/components/product-hero/SpinLayer.js +1 -1
- package/dist/render/components/product-hero/hero-view.d.ts +4 -0
- package/dist/render/components/product-hero/hero-view.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGallery/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGallery/render.js +1 -1
- package/dist/render/lib/sections/hero-gallery.d.ts +11 -0
- package/dist/render/lib/sections/hero-gallery.js +1 -1
- package/dist/render/lib/sections/picture-grounds.d.ts +11 -0
- package/dist/render/lib/sections/picture-grounds.js +1 -0
- package/dist/render/lib/sections/spin-sets.d.ts +20 -4
- package/dist/render/lib/sections/spin-sets.js +1 -1
- package/dist/render/lib/wheels/detail-shots.d.ts +4 -1
- package/dist/render/lib/wheels/detail-shots.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +1 -0
- package/dist/words.js +1 -1
- package/package.json +1 -1
|
@@ -4368,19 +4368,22 @@ em.text-accent {
|
|
|
4368
4368
|
.sf-card-ground-studio:hover {
|
|
4369
4369
|
background-color: transparent;
|
|
4370
4370
|
}
|
|
4371
|
-
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"])
|
|
4371
|
+
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]),
|
|
4372
|
+
.sf-photo-ground-studio {
|
|
4372
4373
|
--sf-card-studio-ground: radial-gradient(
|
|
4373
4374
|
ellipse at 50% 42%,
|
|
4374
4375
|
color-mix(in oklab, var(--bg) 96.4%, var(--fg)) 0%,
|
|
4375
4376
|
color-mix(in oklab, var(--bg) 91.5%, var(--fg)) 75%,
|
|
4376
4377
|
color-mix(in oklab, var(--bg) 88.5%, var(--fg)) 100%
|
|
4377
4378
|
);
|
|
4378
|
-
position: relative;
|
|
4379
|
-
aspect-ratio: 10 / 13;
|
|
4380
4379
|
container-type: inline-size;
|
|
4381
4380
|
isolation: isolate;
|
|
4382
4381
|
background-image: var(--sf-card-studio-ground);
|
|
4383
4382
|
}
|
|
4383
|
+
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) {
|
|
4384
|
+
position: relative;
|
|
4385
|
+
aspect-ratio: 10 / 13;
|
|
4386
|
+
}
|
|
4384
4387
|
/* Show next image of a RENDERING (`data-hover-fit="contain"`): the layer
|
|
4385
4388
|
covers the whole picture box, so it paints the same ellipse (opaque, over
|
|
4386
4389
|
the card's flat ground colour the layer is handed), holds the next
|
|
@@ -4413,7 +4416,9 @@ em.text-accent {
|
|
|
4413
4416
|
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"])::before,
|
|
4414
4417
|
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"])::after,
|
|
4415
4418
|
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::before,
|
|
4416
|
-
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::after
|
|
4419
|
+
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::after,
|
|
4420
|
+
.sf-photo-ground-studio::before,
|
|
4421
|
+
.sf-photo-ground-studio::after {
|
|
4417
4422
|
content: "";
|
|
4418
4423
|
position: absolute;
|
|
4419
4424
|
z-index: -1;
|
|
@@ -4421,7 +4426,8 @@ em.text-accent {
|
|
|
4421
4426
|
}
|
|
4422
4427
|
/* The wide, faint shadow (`.s2`): 142% of the wheel wide, 1:5. */
|
|
4423
4428
|
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"])::before,
|
|
4424
|
-
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::before
|
|
4429
|
+
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::before,
|
|
4430
|
+
.sf-photo-ground-studio::before {
|
|
4425
4431
|
left: -2.36cqw;
|
|
4426
4432
|
top: 96.41cqw;
|
|
4427
4433
|
width: 109.34cqw;
|
|
@@ -4431,7 +4437,8 @@ em.text-accent {
|
|
|
4431
4437
|
}
|
|
4432
4438
|
/* The near, darker shadow (`.s1`): the wheel's width, 1:6. */
|
|
4433
4439
|
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"])::after,
|
|
4434
|
-
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::after
|
|
4440
|
+
.sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-hover-media][data-hover-fit="contain"]::after,
|
|
4441
|
+
.sf-photo-ground-studio::after {
|
|
4435
4442
|
left: 14.58cqw;
|
|
4436
4443
|
top: 95.85cqw;
|
|
4437
4444
|
width: 77cqw;
|
|
@@ -4440,6 +4447,46 @@ em.text-accent {
|
|
|
4440
4447
|
filter: blur(9px);
|
|
4441
4448
|
}
|
|
4442
4449
|
|
|
4450
|
+
/* ─── "Image ground: Studio" (Product Gallery; INOVIT product page 2026-11-23) ───
|
|
4451
|
+
The product page's pictures and its 360° view on a studio ground, drawn by
|
|
4452
|
+
the card's Studio rules above (one set of rules, two users): the same two
|
|
4453
|
+
floor shadows, under the picture's children.
|
|
4454
|
+
Two values are the product page's own, measured on the approved design
|
|
4455
|
+
(pdp 1440, picture 1): the ground is a wall-to-floor fall, darker at the
|
|
4456
|
+
top (#d4: the text mixed in at 18.3%), #dc at 59% down (14.9%), lighter at
|
|
4457
|
+
the foot (#ee: 7.2%), where the card's is a soft ellipse (on a white page
|
|
4458
|
+
with near-black text these mixes give the design's greys; its faint blue is
|
|
4459
|
+
not copied, as no colour is typed); and the well is square with the
|
|
4460
|
+
wheel centred (77% of the well wide, so its foot is 88.5% down), so the
|
|
4461
|
+
shadows sit 17.1% of the width higher than on a card. */
|
|
4462
|
+
.sf-photo-ground-studio {
|
|
4463
|
+
--sf-card-studio-ground: linear-gradient(
|
|
4464
|
+
to bottom,
|
|
4465
|
+
color-mix(in srgb, var(--bg) 81.7%, var(--fg)) 0%,
|
|
4466
|
+
color-mix(in srgb, var(--bg) 85.1%, var(--fg)) 59%,
|
|
4467
|
+
color-mix(in srgb, var(--bg) 92.8%, var(--fg)) 100%
|
|
4468
|
+
);
|
|
4469
|
+
}
|
|
4470
|
+
.sf-photo-ground-studio::before {
|
|
4471
|
+
top: 79.31cqw;
|
|
4472
|
+
}
|
|
4473
|
+
/* The 360° frames are white-ground renders: multiplied, their white is the
|
|
4474
|
+
ground and the floor shadows show under the wheel (SpinLayer). */
|
|
4475
|
+
.sf-photo-ground-studio [data-spin-frame] {
|
|
4476
|
+
mix-blend-mode: multiply;
|
|
4477
|
+
}
|
|
4478
|
+
/* The Flat ground on a light page (the well's `bg-bg`, ProductGallery
|
|
4479
|
+
groundClass): multiplied too, so the frame's white is the page colour and no
|
|
4480
|
+
white square shows on an off-white page. On a dark page the well has no
|
|
4481
|
+
paint and the frame is drawn as it is: a white-ground render cannot sit on
|
|
4482
|
+
a dark ground without its white. */
|
|
4483
|
+
.bg-bg > [data-spin-well] [data-spin-frame] {
|
|
4484
|
+
mix-blend-mode: multiply;
|
|
4485
|
+
}
|
|
4486
|
+
.sf-photo-ground-studio::after {
|
|
4487
|
+
top: 78.75cqw;
|
|
4488
|
+
}
|
|
4489
|
+
|
|
4443
4490
|
/* ─── "Words: Over the picture" (Product Grid; INOVIT /wheels design 2026-11-18) ───
|
|
4444
4491
|
The card's words sit at the foot of the card, on the picture's ground,
|
|
4445
4492
|
and the wheel sits in the space above them. A choice of the grid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as y,jsxs as
|
|
1
|
+
"use client";import{jsx as t,Fragment as y,jsxs as A}from"react/jsx-runtime";import{createContext as D,useContext as G,useMemo as h}from"react";import{parseOption as x}from"efficient-shell/format";import{CardRowContext as E,CardTemplateRows as p,useCardRow as L}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as k}from"efficient-web-builder/render/components/SiteGutterFrame";import{SECTION_FILL_PASS_CLASS as N}from"efficient-web-builder/format/lib/content/section-min-height";import{cardHoverOf as F}from"efficient-web-builder/format/lib/animation/hover";import{pickHoverMedia as U}from"efficient-web-builder/format/lib/content/hover-media";import W from"efficient-web-builder/render/components/HoverMediaLayer";import{NO_FIELD_ANSWERS as R}from"../lib/content/field-usage.js";import{CARD_IMAGE_SIZES as j}from"../lib/sections/card-image-sizes.js";import{PICTURE_GROUNDS as $}from"../lib/sections/picture-grounds.js";import{productTone as H,productToneVaried as B,randomCardColour as v}from"../lib/sections/card-tone.js";import{CardLookContext as C}from"./card-pieces/card-row.js";import{CardBuyDialog as M}from"./card-pieces/CardBuyButton.js";import V from"./card-pieces/CardSurfaceFrame.js";import{BundleCardStateProvider as z,TyreCardStateProvider as Y,useProductCardState as b,useWheelCardState as _,WheelCardStateProvider as K,tyreCardProduct as X}from"./card-pieces/ProductCardState.js";import{tyrePagePath as q}from"../lib/tyres/tyre-page-path.js";import{say as J}from"efficient-web-builder/format/lib/editor-words";import{CARD_INDEX_OPTIONS as Q,cardIndexCss as Z}from"efficient-web-builder/format/lib/sections/product-card-style";import{SHARED_ROWS_LIST_CLASS as rr}from"efficient-web-builder/render/lib/content/box-shared-columns";import{GAP_ZONE_CLASS as er}from"efficient-web-builder/format/lib/content/container-gap";import{CARD_ROWS_GRID_CLASS as or,cardRowsGap as tr,cardRowsGridStyle as nr}from"./WheelCardFrame.js";import{blockParts as ar}from"../lib/block-parts.js";const sr=ar("ProductCard");function Zr(r){return Q.map(({value:e})=>e==="off"?"":Z(r,e).replace(".sf-card-index::before",`.sf-card-index[data-format="${e}"]::before`)).join("")}function re(r){return r.className.includes(er)?{className:`${r.className} ${or} ${rr}`,style:{...r.style,...nr(tr(r))}}:r}const dr={sale:!1,axleSets:!0,setTotal:!1,wasFollowsSize:!1,showSingle:!1,armOnContact:!1},ee={sale:!0,axleSets:!1,setTotal:!0,wasFollowsSize:!0,showSingle:!0,armOnContact:!0},ir={kindLabel:null,brand:!1,process:!0,tyreBrand:!0},cr=[],lr=$,ur={flat:"",soft:"sf-card-ground-soft",studio:"sf-card-ground-studio"},oe=r=>x(lr.map(e=>e.value),"flat",r),mr=[{label:"Under the picture",value:"under"},{label:"Over the picture",value:"over"}],te=r=>x(mr.map(e=>e.value),"under",r),fr="sf-card-words-over",T={ownerId:"",ownerType:"ProductGrid",Template:void 0,hover:F({},"ProductGrid"),imageSizes:j,fieldUsage:R,tyreFieldUsage:R,reserveEyebrow:!1,editing:!1,eyebrow:ir,fit:null,colours:cr,rules:dr,ground:"flat",words:"under"},O=D(T);function m(){return G(O)}function ne({value:r,children:e}){const o=h(()=>({...T,...pr(r)}),[r]);return t(O.Provider,{value:o,children:e})}const pr=r=>Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0));function w(r,e){const o=r.designCode??r.slug??"";return{name:r.name??"",eyebrow:r.process??"",note:"",href:r.slug?`/wheels/${r.slug}`:"",colour:H(e),colourVaried:B(e,o),colourRandom:v(o)}}function Cr(r){const e=r.designCode||r.slug||"";return{name:r.name??"",eyebrow:r.brand??"",note:"",href:q(r.slug)??"",colour:"",colourVaried:"",colourRandom:v(e)}}const I=r=>`/bundles/${r.slug}`;function wr(r){return{name:r.name,eyebrow:"",note:r.subtitle??"",href:I(r),colour:"",colourVaried:"",colourRandom:""}}const gr="sf-card sf-card-fill group relative flex flex-col bg-[var(--card-bg)] transition-colors duration-200 hover:bg-[var(--card-bg-hover)] [.sf-card-rows>&]:mb-[var(--sf-card-row-gap)]",Sr="sf-card group relative flex flex-col border border-line bg-bg transition-colors hover:border-accent",yr=`relative flex-1 ${N}`;function g({copy:r,href:e,label:o,kit:n=!1,probes:a,arm:d,layer:f}){const{editing:c,ground:i,words:s}=m(),l=[ur[i],s==="over"?fr:""].filter(Boolean);return t(V,{surface:n?Sr:[gr,...l].join(" "),href:e,label:o,linked:!c,probes:a,arm:d,layer:f,children:t("div",{className:yr,...sr("card-content"),children:t(k,{children:r})})})}const hr="var(--card-bg)";function xr(r,e=hr){const o=Rr();return!o||o.cover!==r||!o.media?null:t(W,{media:o.media,cover:r,ground:e})}function Rr(){const{hover:r}=m(),e=b();if(r.kind!=="nextImage"||!r.media||e.kind!=="wheel")return null;const o=e.sel.finish?.name,n=vr(e.wheel,o);return{cover:r.media.cover,media:U(n,r.media,o)}}function vr(r,e){const o=r.finishes?.find(a=>a.name===e),n=o?.angles?.length?o.angles:e&&e===r.defaultFinish?r.defaultFinishRenderings??[]:[];return{...r,finishes:e?[{name:e,angles:n.slice(1)}]:[]}}function br({children:r}){const e=L(),{wheel:o,sel:n}=_(),a=n.finish?.color,d=h(()=>e?{...e,row:w(o,a)}:null,[e,o,a]);return d?t(E.Provider,{value:d,children:r}):t(y,{children:r})}function _r({copy:r}){const{wheel:e,sel:o}=_(),{rules:n}=m(),a=xr("card");return A(y,{children:[t(g,{copy:t(br,{children:r}),href:e.slug?`/wheels/${e.slug}`:"",label:e.name,probes:o.probes,arm:n.armOnContact?o.arm:void 0,layer:a}),t(M,{})]})}function P(r,e,o,n){const a=e.item;return t(K,{wheel:a,colours:o.colours,defaultFinish:n?.[e.index],editing:o.editing,children:t(C.Provider,{value:"catalog",children:t(_r,{copy:r})})})}function ae({wheels:r,finishes:e,children:o}){const n=m(),{ownerId:a,ownerType:d,Template:f,editing:c}=n;return t(p,{ownerId:a,ownerType:d,Template:f,rows:r.map(i=>w(i)),items:r,fallback:c?t(S,{}):null,wrapCopy:(i,s)=>P(i,s,n,e),children:o})}function se({items:r,tyreOf:e,tyreFit:o}){const n=m(),{ownerId:a,ownerType:d,Template:f,editing:c}=n,i=r.map(s=>e(s));return t(p,{ownerId:a,ownerType:d,Template:f,rows:r.map((s,l)=>{const u=i[l];return u?Cr(u):w(s)}),items:r,fallback:c?t(S,{}):null,wrapCopy:(s,l)=>{const u=i[l.index];return u?Or(s,X(u,o?.(u)??null),c):P(s,l,n)},children:s=>s})}function Tr({copy:r}){const e=b();if(e.kind!=="tyre")throw new Error("A tyre card surface was drawn outside its tyre state.");return t(g,{copy:r,href:e.pagePath??"",label:e.tyre.name,arm:e.arm})}function Or(r,e,o){return t(Y,{tyre:e,editing:o,children:t(C.Provider,{value:"catalog",children:t(Tr,{copy:r})})})}function Ir(r,e){const o=e.item;return t(z,{bundle:o,children:t(C.Provider,{value:"catalog",children:t(g,{copy:r,href:I(o),label:o.name,kit:!0})})})}function de({bundles:r,children:e}){const{ownerId:o,ownerType:n,Template:a,editing:d}=m();return t(p,{ownerId:o,ownerType:n,Template:a,rows:r.map(wr),items:r,fallback:d?t(S,{}):null,wrapCopy:Ir,children:e})}function S(){return t("div",{"data-grid-card-empty":"",className:"p-4 text-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.2em] text-fg-dim",children:J("The card is empty. Add parts to its card template in Layers.")})}export{lr as CARD_GROUNDS,mr as CARD_WORDS,fr as CARD_WORDS_OVER_CLASS,dr as GRID_CARD_RULES,de as GridBundleCards,ne as GridCardProvider,ae as GridCards,se as GridMixedCards,ee as LISTING_CARD_RULES,wr as bundleCardRow,I as bundlePagePath,oe as cardGroundOf,vr as cardHoverRow,re as cardRowsGrid,te as cardWordsOf,Zr as gridIndexCss,w as productCardRow,Cr as tyreCardRow,xr as useCardHoverLayer,m as useGridCard};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
2
|
import { type HeroView } from "./product-hero/hero-view.js";
|
|
3
3
|
import type { StoreProduct } from "../lib/catalog/store-product.js";
|
|
4
|
-
import { type HeroGalleryMode, type HeroImageFit } from "../lib/sections/hero-gallery.js";
|
|
4
|
+
import { type HeroGalleryMode, type HeroImageFit, type HeroPhotoGround } from "../lib/sections/hero-gallery.js";
|
|
5
5
|
import { type SpinSets } from "../lib/sections/spin-sets.js";
|
|
6
|
-
export default function ProductGallery({ product, view, angleIdx, onSelect, isLight, onLightbox, galleryMode, imageFit, style, takesViewHide, spin, }: {
|
|
6
|
+
export default function ProductGallery({ product, view, angleIdx, onSelect, isLight, onLightbox, galleryMode, imageFit, style, takesViewHide, spin, ground, }: {
|
|
7
7
|
product: StoreProduct;
|
|
8
8
|
view: HeroView;
|
|
9
9
|
angleIdx: number;
|
|
@@ -15,4 +15,5 @@ export default function ProductGallery({ product, view, angleIdx, onSelect, isLi
|
|
|
15
15
|
style?: CSSProperties;
|
|
16
16
|
takesViewHide?: boolean;
|
|
17
17
|
spin?: SpinSets;
|
|
18
|
+
ground?: HeroPhotoGround;
|
|
18
19
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as
|
|
1
|
+
"use client";import{jsx as n,Fragment as S,jsxs as p}from"react/jsx-runtime";import{useRef as T}from"react";import{photoLabel as _}from"./product-hero/hero-view.js";import j from"./product-hero/SpinLayer.js";import{stageControls as F,useHeldStagePhoto as G}from"./product-hero/stage-photo.js";import{DEFAULT_HERO_GALLERY_MODE as M,DEFAULT_HERO_IMAGE_FIT as P,DEFAULT_HERO_PHOTO_GROUND as U,parseHeroGalleryMode as $,parseHeroImageFit as v,parseHeroPhotoGround as z,resolveHeroImageFit as B}from"../lib/sections/hero-gallery.js";import{spinSetFor as D}from"../lib/sections/spin-sets.js";import{productHasComposedRender as I}from"../lib/wheels/set-mode.js";import{HideTaker as H}from"efficient-web-builder/render/components/ViewHideRoot";import{swipeEnabled as V,swipeStep as q}from"efficient-web-builder/format/lib/hero-swipe";function w({product:e,view:t,angleIdx:o,onSelect:m,isLight:l,onLightbox:r,galleryMode:s=M,imageFit:c=P,style:a,takesViewHide:i=!1,spin:h=W,ground:y=U}){const b=D(h,e.slug,t.metaValue),x=X(z(y),l),g=b?Y(t):t,u=$(s),f=B(v(c),I(e)),N=n(Q,{name:e.name,view:g,wellGround:x,angleIdx:o,onSelect:m,onLightbox:r,fit:f,spinSet:b});return u==="stacked"?n(H,{as:"div",takes:i,"data-hero-gallery":u,"data-hero-fit":f,style:a,children:g.photos.length<2&&!b?N:p(S,{children:[n(Z,{name:e.name,view:g,wellGround:x,onLightbox:r,fit:f,spinSet:b}),n(J,{angleIdx:o,total:C(g),onSelect:m,children:N})]})}):p(H,{as:"div",takes:i,"data-hero-gallery":u,"data-hero-fit":f,className:u==="tiled"?"flex items-start gap-3 max-view-tablet:gap-2":void 0,style:a,children:[n("div",{className:u==="tiled"?"min-w-0 flex-1":void 0,children:N}),u!=="main"&&n(tt,{name:e.name,view:g,angleIdx:o,onSelect:m,isLight:l,tiled:u==="tiled"})]})}function C(e){return e.photos.length>0?e.photos.length:e.thumbFallbackCells}const L="relative flex aspect-square items-center justify-center overflow-hidden",W={},O="sf-photo-ground-studio";function X(e,t){return e==="studio"?O:t?"bg-bg":""}function Y(e){return e.photos.length===0||e.closeUps.length===0?e:{...e,photos:[e.photos[0],...e.closeUps.map(t=>t.url)],captions:[e.captions[0],...e.closeUps.map(t=>t.title)]}}const k=(e,t,o)=>[e,t.metaValue,o].filter(Boolean).join(" — "),E=(e,t)=>[e,t.metaValue].filter(Boolean).join(" "),R=(e,t)=>`Open ${[e,t.metaValue].filter(Boolean).join(" ")} at full resolution`;function Z({name:e,view:t,wellGround:o,onLightbox:m,fit:l,spinSet:r}){const s=r?n(j,{set:r,name:E(e,t)}):null;return n("div",{"data-hero-stack":!0,className:"flex flex-col gap-2 max-view-tablet:hidden",children:t.photos.map((c,a)=>{const i=k(e,t,_(t,a));return n("div",{"data-hero-stack-photo":!0,className:[L,o].join(" "),style:{color:t.tint},children:a===0&&s?s:t.stageImage({photo:c,alt:i,label:R(e,t),onZoom:()=>m(c,i),fit:l,eager:a===0})},c)})})}function J({angleIdx:e,total:t,onSelect:o,children:m}){const l=T(null),r=T(null),s=V({count:t}),c=a=>({x:a.touches[0].clientX,y:a.touches[0].clientY});return n("div",{"data-hero-phone-stage":!0,className:"view-tablet:hidden",onTouchStart:a=>{l.current=s&&a.touches.length===1?c(a):null,r.current=l.current},onTouchMove:a=>{l.current&&(a.touches.length!==1?l.current=null:r.current=c(a))},onTouchEnd:()=>{const a=l.current,i=r.current;if(l.current=null,r.current=null,!a||!i)return;const h=q(i.x-a.x,i.y-a.y,e,t);h!==e&&o(h)},children:m})}const K=6;function Q({name:e,view:t,angleIdx:o,onSelect:m,onLightbox:l,fit:r,spinSet:s,wellGround:c}){const a=t.photos[Math.min(o,t.photos.length-1)],i=G(t.photos,a),h=C(t),y=h>=2,b=String(h).padStart(2,"0"),x=Math.min(o,Math.max(t.photos.length-1,0)),g=y||t.captions[x]?_(t,x):"",u=k(e,t,g),f="max-view-tablet:static",N=[`${L} max-view-tablet:col-span-2`,c].join(" ");return p("div",{className:"relative max-view-tablet:grid max-view-tablet:grid-cols-[minmax(0,1fr)_auto] max-view-tablet:items-start max-view-tablet:gap-x-3 max-view-tablet:gap-y-2",style:{color:t.tint},children:[p("div",{className:`absolute left-0 top-0 z-10 flex items-center gap-3 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-fg ${f} max-view-tablet:min-w-0 max-view-tablet:flex-wrap max-view-tablet:gap-x-2 max-view-tablet:gap-y-1`,children:[y&&p(S,{children:[p("span",{className:"text-accent",children:[String(o+1).padStart(2,"0")," / ",b]}),n("span",{className:"text-fg-dim",children:"·"})]}),n("span",{children:e}),t.metaValue&&p(S,{children:[n("span",{className:"text-fg-dim",children:"·"}),n("span",{className:"text-accent",children:t.metaValue})]})]}),y&&n("div",{className:`absolute right-5 top-5 z-10 flex gap-1 ${f}`,children:F(o,h,m).map(d=>n("button",{type:"button","aria-label":d.label,title:d.label,onClick:d.onClick,className:"flex h-7 w-7 items-center justify-center border border-fg-dim/60 text-fg transition-colors hover:border-accent hover:text-accent",children:d.glyph},d.label))}),p("div",{className:N,children:[c!==O&&["top-3 left-3","top-3 right-3","bottom-3 left-3","bottom-3 right-3"].map((d,A)=>n("span",{className:`absolute ${d} h-3 w-3 border border-fg-dim/40`,style:{borderTop:d.includes("top")?"1px solid var(--site-line)":"none",borderBottom:d.includes("bottom")?"1px solid var(--site-line)":"none",borderLeft:d.includes("left")?"1px solid var(--site-line)":"none",borderRight:d.includes("right")?"1px solid var(--site-line)":"none"}},A)),s&&x===0?n(j,{set:s,name:E(e,t)}):t.stageImage({photo:i,alt:u,label:R(e,t),onZoom:()=>l(i,u),fit:r})]}),p("div",{className:`absolute bottom-0 left-0 right-0 z-10 flex items-end justify-between gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim ${f} max-view-tablet:col-span-2 max-view-tablet:flex-wrap`,children:[p("span",{className:"flex min-w-0 flex-col gap-1",children:[t.specCaption&&n("span",{children:t.specCaption}),t.referenceNote&&n("span",{"data-hero-reference-note":!0,children:t.referenceNote}),t.galleryHint&&n("span",{"data-hero-gallery-hint":!0,children:t.galleryHint})]}),n("span",{children:t.originCaption})]})]})}function tt({name:e,view:t,angleIdx:o,onSelect:m,isLight:l,tiled:r=!1}){const s=C(t);return s<2?null:n("div",{className:r?"order-[-1] flex w-16 flex-col gap-2 max-view-tablet:w-12 max-view-tablet:gap-1":"mt-2 grid grid-cols-4 gap-2 max-view-tablet:gap-1",style:!r&&s>4?{gridTemplateColumns:`repeat(${Math.min(s,K)}, minmax(0, 1fr))`}:void 0,children:Array.from({length:s}).map((c,a)=>{const i=t.photos[a];return p("button",{type:"button",onClick:()=>m(a),"aria-label":`View ${_(t,a)}`,"aria-pressed":a===o,className:["relative flex aspect-square items-center justify-center overflow-hidden transition-colors",l?"bg-bg":"",a===o?"border border-accent":"border border-transparent hover:border-fg-dim"].join(" "),style:{color:t.tint},children:[n("span",{className:"absolute top-1.5 left-2 z-10 font-mono text-[length:var(--size-label,8px)] uppercase tracking-[0.18em] text-fg-dim",children:String(a+1).padStart(2,"0")}),t.thumbImage({photo:i,alt:`${e} — ${_(t,a)}`})]},a)})})}export{w as default};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { HeroGalleryMode, HeroImageFit } from "../../lib/sections/hero-gallery.js";
|
|
1
|
+
import type { HeroGalleryMode, HeroImageFit, HeroPhotoGround } from "../../lib/sections/hero-gallery.js";
|
|
2
2
|
import type { SpinSets } from "../../lib/sections/spin-sets.js";
|
|
3
3
|
interface GalleryLook {
|
|
4
4
|
galleryMode?: HeroGalleryMode;
|
|
5
5
|
imageFit?: HeroImageFit;
|
|
6
6
|
spin?: SpinSets;
|
|
7
|
+
ground?: HeroPhotoGround;
|
|
7
8
|
}
|
|
8
9
|
export default function DynamicProductGallery({ editing, ...look }: {
|
|
9
10
|
editing?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as x}from"react/jsx-runtime";import{useCallback as z,useEffect as b,useRef as p,useState as $}from"react";import{VIEW_TABLET_MIN as oe}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as se}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as L,sizedImage as ae}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as ce}from"efficient-web-builder/render/components/useReducedMotion";import{isFullTurn as H,spinClampPosition as ie,spinFrameIndex as K,spinPositionAfterDrag as U,spinCell as j,spinStartPosition as T}from"../../lib/sections/spin-sets.js";const le=.3,ue=.85,B=24,G=4,q=1e3,Z=77/72,Q=`${(1-Z)/2*100}%`,V=`${Z*100}%`,Y={left:Q,top:Q,width:V,height:V},de=`(max-width: ${oe-.02}px)`,R=new Map;function J(n,E){let f=R.get(n);return f||(f=new Promise(k=>{const o=new Image;o.onload=()=>k({w:o.naturalWidth,h:o.naturalHeight}),o.onerror=()=>{R.delete(n),k(null)},E&&(o.sizes=L,o.srcset=E),o.src=n}),R.set(n,f)),f}const ee=new Set,W=n=>ae(n,{fallbackWidth:q,maxWidth:q});function fe({set:n,name:E}){const[f,k]=$(()=>T(n)),o=p(null),F=p(0),P=p(f),v=p(null),w=p(null),r=n.count,[M,C]=$(null),I=p(null),[D,X]=$(null),_=H(n),g=K(f,r,_),y=z(e=>{const t=ie(e,r,_);return P.current=t,k(t),t},[r,_]),A=z(()=>cancelAnimationFrame(F.current),[]);b(()=>{const e=window.matchMedia?.(de);if(!e)return X(!1);const t=()=>X(e.matches);return t(),e.addEventListener?.("change",t),()=>e.removeEventListener?.("change",t)},[]),b(()=>{if(!n.sheets||!n.startFrame||D===null)return;const e=D?n.sheets.phone:n.sheets.desktop,t=`${n.startFrame} ${e.urls[0]}`;if(w.current===t)return;w.current=t,C({key:t,sheet:e,ready:new Set});const c=Math.floor(T(n)/(e.cols*e.rows)),l=e.urls.map((h,d)=>e.urls[(c+d)%e.urls.length]),u=W(n.startFrame);J(u.src,u.srcSet).then(()=>{for(const h of l)J(h).then(d=>{!d||d.w!==e.cols*e.frame||d.h!==e.rows*e.frame||w.current===t&&C(i=>i?.key===t?{...i,ready:new Set(i.ready).add(h)}:i)})})},[n,D]),b(()=>{if(!n.frames)return;const e=n.frames,t=e[0];if(w.current===t||(w.current=t,ee.has(t)))return;ee.add(t);const c=K(T(n),r,H(n)),l=[];for(let i=0;i<G;i+=1)for(let m=i;m<r;m+=G)l.push((c+m)%r);const u=i=>{const m=W(e[i]),S=new Image;return S.sizes=L,m.srcSet&&(S.srcset=m.srcSet),S.src=m.src,S},h=u(l[0]),d=()=>l.slice(1).forEach(u);h.onload=d,h.onerror=d},[r,n]),b(()=>A,[A]);const te=e=>{A(),e.currentTarget.setPointerCapture?.(e.pointerId),v.current={x0:e.clientX,f0:P.current,last:e.clientX,speed:0}},ne=e=>{const t=v.current,c=o.current;!t||!c||(t.speed=e.clientX-t.last,t.last=e.clientX,y(U(t.f0,e.clientX-t.x0,c.clientWidth,r)))},N=()=>{const e=v.current;v.current=null;const t=o.current;if(!e||!t||ce())return;let c=Math.max(-B,Math.min(B,e.speed));const l=()=>{if(Math.abs(c)<le)return;const u=U(P.current,c,t.clientWidth,r);y(u)===u&&(c*=ue,F.current=requestAnimationFrame(l))};F.current=requestAnimationFrame(l)},re=e=>{const t=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")y(0);else if(e.key==="End")y(r-1);else if(t)y(Math.round(P.current)+t);else return;A(),e.preventDefault()},s=n.sheets&&M&&M.key.startsWith(`${n.startFrame} `)?M:null;s&&s.ready.has(j(s.sheet,g).url)&&(I.current={key:s.key,frame:g});const O=s&&I.current?.key===s.key?I.current.frame:null,a=s&&O!==null?{...j(s.sheet,O),cols:s.sheet.cols,rows:s.sheet.rows}:null;return x("div",{ref:o,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${E}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":r,"aria-valuenow":g+1,"aria-valuetext":`Angle ${g+1} of ${r}`,onKeyDown:re,className:"absolute inset-0 select-none overflow-hidden cursor-grab active:cursor-grabbing focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg",style:{touchAction:"pan-y"},onPointerDown:te,onPointerMove:ne,onPointerUp:N,onPointerCancel:N,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:a?x("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...Y,backgroundImage:`url("${se(a.url)}")`,backgroundSize:`${a.cols*100}% ${a.rows*100}%`,backgroundPosition:`${a.cols>1?a.col*100/(a.cols-1):0}% ${a.rows>1?a.row*100/(a.rows-1):0}%`}}):x("img",{...W(n.frames?n.frames[g]:n.startFrame??""),sizes:L,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:Y})})}export{fe as default};
|
|
@@ -19,6 +19,10 @@ export interface HeroView {
|
|
|
19
19
|
alt: string;
|
|
20
20
|
}) => ReactNode;
|
|
21
21
|
captions: readonly (string | undefined)[];
|
|
22
|
+
closeUps: readonly {
|
|
23
|
+
url: string;
|
|
24
|
+
title: string;
|
|
25
|
+
}[];
|
|
22
26
|
galleryHint: string;
|
|
23
27
|
referenceNote: string;
|
|
24
28
|
thumbFallbackCells: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,Fragment as b,jsxs as x}from"react/jsx-runtime";import N from"./TyreHeroFitment.js";import{STAGE_IMAGE_SIZES as y}from"./stage-photo.js";import{HeroVehicleMemory as w}from"./VehicleQuestion.js";import E from"./WheelHeroFitment.js";import C from"../PreOrderPanel.js";import j from"efficient-web-builder/render/components/RMark";import z from"../TyreImage.js";import F from"../WheelImage.js";import k from"../WheelSvg.js";import{partVariant as P,wheelFinish as
|
|
1
|
+
"use client";import{jsx as a,Fragment as b,jsxs as x}from"react/jsx-runtime";import N from"./TyreHeroFitment.js";import{STAGE_IMAGE_SIZES as y}from"./stage-photo.js";import{HeroVehicleMemory as w}from"./VehicleQuestion.js";import E from"./WheelHeroFitment.js";import C from"../PreOrderPanel.js";import j from"efficient-web-builder/render/components/RMark";import z from"../TyreImage.js";import F from"../WheelImage.js";import k from"../WheelSvg.js";import{partVariant as P,wheelFinish as S}from"../../lib/catalog/from-wheel.js";import{tyreModelLine as H}from"../../lib/tyres/tyre-brand-name.js";import{axisRenderingsFor as L,lugRenderingsFor as R}from"../../lib/wheels/cover-rendering.js";import{namedDetailShots as _}from"../../lib/wheels/detail-shots.js";import{finishAngles as A}from"../../lib/wheels/finish-photos.js";import{selectedStuds as T}from"../../lib/wheels/selected-studs.js";import{REFERENCE_NOTE as B,stageIsFallback as O}from"../../lib/wheels/render-fit.js";import{PER_WHEEL_UNIT as V}from"../../lib/wheels/set-mode.js";import{variantSpecLabel as I}from"../../lib/wheels/variant-spec.js";function le(t,e){return t.captions[e]?.trim()||`Photo ${e+1}`}function me({text:t}){return t==="FusionForge®"?x(b,{children:["FusionForge",a(j,{})]}):a(b,{children:t})}function ce(t,e,h){if(t.kind==="tyre"){const r=t.source,l=e.shown.size??r.sizes[0]??"",n=r.variants.find(m=>m.size===l),f=n?.specs.tireType??r.variants[0]?.specs.tireType??null,d=[n?.image,r.coverImage].filter(m=>!!m);return{heading:H(r.brand,r.name),photos:d.slice(0,1),tint:void 0,stageImage:()=>a(z,{image:n?.image??r.coverImage,size:l,type:f,sizes:y,priority:!0,className:"h-full w-full"}),thumbImage:()=>null,captions:[],closeUps:[],thumbFallbackCells:0,galleryHint:"",referenceNote:"",metaValue:l,specCaption:n?[n.specs.loadIndex,n.specs.speedRating].filter(Boolean).join(""):"",originCaption:r.brand,unitLabel:"per tyre",vehicle:a(N,{slug:r.slug,variants:r.variants,vehicle:e.vehicle,manualMode:e.manualMode,setManualMode:e.setManualMode}),vehicleMemory:e.manualMode?null:a(w,{vehicle:e.vehicle}),vehicleAnswersSpecs:!1,preOrder:null}}const o=t.source,i=S(o,e.shown.finish),s=P(o,e.part),c=T(e),M=s?.components.find(r=>r.hand!=="right")??s?.components[0],p=L(i,M?.renderKey),u=p?null:R(i,c),v=p?[...p]:u?[...u]:A(i),g=v.length>0?v:o.coverImage?[o.coverImage]:[];return{heading:t.name,photos:g,tint:i.color,stageImage:({photo:r,alt:l,label:n,onZoom:f,fit:d,eager:m=!0})=>a(F,{src:r,alt:l,fill:!0,sizes:y,className:d==="cover"?"object-cover":"object-contain",priority:m,onImageClick:f,imageButtonClassName:"relative block h-[88%] w-[88%] cursor-zoom-in",imageButtonLabel:n,fallback:a(k,{spokes:o.spokes,mesh:o.mesh,className:"block h-[70%] w-[70%]"})}),thumbImage:({photo:r,alt:l})=>a(F,{src:r,alt:l,fill:!0,sizes:"(max-width: 720px) 20vw, (max-width: 1100px) 10vw, 120px",className:"object-contain",imageWrapperClassName:"relative h-[80%] w-[80%]",fallback:a(k,{spokes:o.spokes,mesh:o.mesh,className:"block h-[55%] w-[55%]"})}),captions:g.map(r=>i.captions?.[r]),closeUps:_(i,c),thumbFallbackCells:4,galleryHint:W(g,i,c,e.manualMode),referenceNote:!p&&O(i,s,c,u!=null)?B:"",metaValue:i.name,specCaption:s?I(s):"",originCaption:o.process==="FusionForge®"?"FusionForge® · Hybrid":`${o.process} · 1-piece`,unitLabel:V,vehicle:a(E,{selection:e,spec:s?I(s):"",vehicle:e.vehicle,wheel:o}),vehicleMemory:e.manualMode?null:a(w,{vehicle:e.vehicle}),vehicleAnswersSpecs:!0,preOrder:a(C,{wheel:o,editing:h})}}function W(t,e,h,o){return t.length>=2||h!=null||!Object.values(e.lugRenderings??{}).some(s=>Array.isArray(s)&&s.filter(Boolean).length>=2)?"":o?"Pick a bolt pattern to see every angle":"Pick your vehicle to see every angle"}export{me as MarkedLabel,ce as heroView,le as photoLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_HERO_GALLERY_MODE as
|
|
1
|
+
import{DEFAULT_HERO_GALLERY_MODE as r,DEFAULT_HERO_IMAGE_FIT as e,DEFAULT_HERO_PHOTO_GROUND as l}from"../../../../sections/hero-gallery.js";const E={label:"Product Gallery",defaultProps:{galleryMode:r,imageFit:e,ground:l,spin:{}}};export{E as ProductGalleryMeta};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import o from"../../../../../components/pdp-dynamic/DynamicProductGallery.js";import{parseHeroGalleryMode as i,parseHeroImageFit as t,parseHeroPhotoGround as a}from"../../../../sections/hero-gallery.js";import{parseSpinSets as d}from"../../../../sections/spin-sets.js";import{ProductGalleryMeta as m}from"./meta.js";const u={...m,render:r=>e(o,{editing:r.editor?.isEditing,galleryMode:i(r.galleryMode),imageFit:t(r.imageFit),spin:d(r.spin),ground:a(r.ground)})};export{u as ProductGalleryRender};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PictureGround } from "./picture-grounds.js";
|
|
1
2
|
import { type ImageFit } from "efficient-web-builder/format/lib/content/image-fit";
|
|
2
3
|
export type HeroGalleryMode = "main" | "thumbs" | "tiled" | "stacked";
|
|
3
4
|
export declare const HERO_GALLERY_MODES: readonly ["main", "thumbs", "tiled", "stacked"];
|
|
@@ -12,3 +13,13 @@ export declare function heroImageFitOptions(): {
|
|
|
12
13
|
value: HeroImageFit;
|
|
13
14
|
}[];
|
|
14
15
|
export declare function resolveHeroImageFit(fit: HeroImageFit, composed: boolean): HeroImageFit;
|
|
16
|
+
export type HeroPhotoGround = Extract<PictureGround, "flat" | "studio">;
|
|
17
|
+
export declare const HERO_PHOTO_GROUNDS: ({
|
|
18
|
+
readonly label: "Flat";
|
|
19
|
+
readonly value: "flat";
|
|
20
|
+
} | {
|
|
21
|
+
readonly label: "Studio";
|
|
22
|
+
readonly value: "studio";
|
|
23
|
+
})[];
|
|
24
|
+
export declare const DEFAULT_HERO_PHOTO_GROUND: HeroPhotoGround;
|
|
25
|
+
export declare function parseHeroPhotoGround(v: unknown): HeroPhotoGround;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as
|
|
1
|
+
import{parseOption as r}from"efficient-shell/format";import{PICTURE_GROUNDS as e}from"./picture-grounds.js";import{IMAGE_FIT_LABEL as n,parseImageFit as p}from"efficient-web-builder/format/lib/content/image-fit";const a=["main","thumbs","tiled","stacked"],i="thumbs";function H(t){return r(a,i,t)}const E=["contain","cover"],_="contain";function R(t){return p(t,_)}function f(){return E.map(t=>({label:n[t],value:t}))}function x(t,o){return o?"contain":t}const s=e.filter(t=>t.value!=="soft"),O="flat";function I(t){return r(s.map(o=>o.value),O,t)}export{i as DEFAULT_HERO_GALLERY_MODE,_ as DEFAULT_HERO_IMAGE_FIT,O as DEFAULT_HERO_PHOTO_GROUND,a as HERO_GALLERY_MODES,E as HERO_IMAGE_FITS,s as HERO_PHOTO_GROUNDS,f as heroImageFitOptions,H as parseHeroGalleryMode,R as parseHeroImageFit,I as parseHeroPhotoGround,x as resolveHeroImageFit};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const PICTURE_GROUNDS: readonly [{
|
|
2
|
+
readonly label: "Flat";
|
|
3
|
+
readonly value: "flat";
|
|
4
|
+
}, {
|
|
5
|
+
readonly label: "Soft grey";
|
|
6
|
+
readonly value: "soft";
|
|
7
|
+
}, {
|
|
8
|
+
readonly label: "Studio";
|
|
9
|
+
readonly value: "studio";
|
|
10
|
+
}];
|
|
11
|
+
export type PictureGround = (typeof PICTURE_GROUNDS)[number]["value"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const l=[{label:"Flat",value:"flat"},{label:"Soft grey",value:"soft"},{label:"Studio",value:"studio"}];export{l as PICTURE_GROUNDS};
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
export interface SpinSheet {
|
|
2
|
+
frame: number;
|
|
3
|
+
cols: number;
|
|
4
|
+
rows: number;
|
|
5
|
+
urls: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const SPIN_SHEET_MAX_SIDE = 4096;
|
|
1
8
|
export interface SpinSet {
|
|
2
|
-
|
|
3
|
-
|
|
9
|
+
count: number;
|
|
10
|
+
frames?: string[];
|
|
11
|
+
startFrame?: string;
|
|
12
|
+
sheets?: {
|
|
13
|
+
desktop: SpinSheet;
|
|
14
|
+
phone: SpinSheet;
|
|
15
|
+
};
|
|
4
16
|
arc?: number;
|
|
17
|
+
start?: number;
|
|
5
18
|
}
|
|
6
19
|
export type SpinSets = Record<string, Record<string, SpinSet>>;
|
|
7
|
-
export declare const SPIN_MAX_ZOOM = 2;
|
|
8
20
|
export declare function parseSpinSets(v: unknown): SpinSets;
|
|
9
21
|
export declare function spinSetFor(sets: SpinSets, productSlug: string, finishName: string | undefined): SpinSet | null;
|
|
10
22
|
export declare function isFullTurn(set: SpinSet): boolean;
|
|
@@ -12,4 +24,8 @@ export declare function spinStartPosition(set: SpinSet): number;
|
|
|
12
24
|
export declare function spinFrameIndex(position: number, count: number, loop?: boolean): number;
|
|
13
25
|
export declare function spinClampPosition(position: number, count: number, loop: boolean): number;
|
|
14
26
|
export declare function spinPositionAfterDrag(start: number, dx: number, width: number, count: number): number;
|
|
15
|
-
export declare function
|
|
27
|
+
export declare function spinCell(sheet: SpinSheet, i: number): {
|
|
28
|
+
url: string;
|
|
29
|
+
col: number;
|
|
30
|
+
row: number;
|
|
31
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{resolveMedia as h}from"efficient-web-builder/render/lib/media";const l=4096,a=360,y=.9,p=t=>Array.isArray(t)&&t.length>0&&t.every(r=>typeof r=="string"&&r.length>0),c=t=>h(t)??t,f=t=>Number.isInteger(t)&&t>0;function m(t,r){if(!t||typeof t!="object")return null;const{frame:n,cols:e,rows:o,urls:s}=t;return!f(n)||!f(e)||!f(o)||!p(s)||n*e>l||n*o>l||s.length!==Math.ceil(r/(e*o))?null:{frame:n,cols:e,rows:o,urls:s.map(c)}}function x(t){const{frames:r,count:n,startFrame:e,sheets:o}=t,s=p(r)?{count:r.length,frames:r.map(c)}:null;if(o&&typeof o=="object"&&f(n)&&typeof e=="string"&&e){const u=m(o.desktop,n),i=m(o.phone,n);if(u&&i)return{count:n,startFrame:c(e),sheets:{desktop:u,phone:i}}}return s}function M(t){if(!t||typeof t!="object")return null;const{arc:r,start:n}=t,e=x(t);if(!e)return null;if(r!==void 0){if(typeof r!="number"||!(r>0&&r<=a))return null;e.arc=r}return Number.isInteger(n)&&n>=0&&n<e.count&&(e.start=n),e}function S(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const r={};for(const[n,e]of Object.entries(t)){if(!e||typeof e!="object"||Array.isArray(e))continue;const o={};for(const[s,u]of Object.entries(e)){const i=M(u);i&&(o[s]=i)}Object.keys(o).length>0&&(r[n]=o)}return r}function j(t,r,n){return n?t[r]?.[n]??null:null}function b(t){return t.arc===void 0||t.arc>=a}function g(t){return b(t)?0:Math.floor(t.count/2)}function A(t){return t.start??g(t)}function F(t,r,n=!0){return n?(Math.floor(t)%r+r)%r:Math.max(0,Math.min(r-1,Math.floor(t)))}function P(t,r,n){return n?t:Math.max(0,Math.min(r-1,t))}function T(t,r,n,e){return n<=0?t:t-r/n*e*y}function _(t,r){const n=t.cols*t.rows,e=r%n;return{url:t.urls[Math.floor(r/n)],col:e%t.cols,row:Math.floor(e/t.cols)}}export{l as SPIN_SHEET_MAX_SIDE,b as isFullTurn,S as parseSpinSets,_ as spinCell,P as spinClampPosition,F as spinFrameIndex,T as spinPositionAfterDrag,j as spinSetFor,A as spinStartPosition};
|
|
@@ -5,6 +5,9 @@ export interface DetailShotPick {
|
|
|
5
5
|
shownFor: number | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function pickDetailShots(finish: Pick<Finish, "detailShots"> | undefined, carStuds: number | null): DetailShotPick;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function namedDetailShots(finish: Pick<Finish, "detailShots"> | undefined, carStuds: number | null): {
|
|
9
|
+
url: string;
|
|
10
|
+
title: string;
|
|
11
|
+
}[];
|
|
9
12
|
export declare function detailShotTag(shot: DetailShot, pick: DetailShotPick, carStuds: number | null): string | undefined;
|
|
10
13
|
export declare function variesByCar(shot: DetailShot, all: readonly DetailShot[]): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function w(t,r){const n=t?.detailShots;if(!Array.isArray(n)||n.length===0)return{rows:[],shownFor:null};const l=n.filter(e=>!!e&&typeof e.url=="string"&&!!e.url&&typeof e.title=="string"&&!!e.title);if(l.length===0)return{rows:[],shownFor:null};const o=l.filter(e=>f(e).length>0).flatMap(f);let u=r,a=null;if(u==null)u=o.length?Math.min(...o):null;else if(o.length&&!o.includes(u)){const e=u;u=o.reduce((i,s)=>{const c=Math.abs(s-e),h=Math.abs(i-e);return c<h||c===h&&s>i?s:i}),a=u}const g=new Set;return{rows:l.filter(e=>{const i=f(e);if(i.length>0&&(u==null||!i.includes(u)))return!1;const s=JSON.stringify([e.eyebrow??"",e.title,e.line??"",[...i].sort()]);return g.has(s)?!1:(g.add(s),!0)}),shownFor:a}}function p(t,r){const n=w(t,r);return n.rows.map(l=>{const o=d(l,n,r);return{url:l.url,title:o?`${l.title}. ${o}`:l.title}})}function f(t){return Array.isArray(t.lugs)?t.lugs.filter(r=>typeof r=="number"):[]}function d(t,r,n){if(n!=null)return r.shownFor!=null?f(t).length>0?`Shown on the ${r.shownFor} lug wheel. Your ${n} lug wheel may look different.`:void 0:y(t,r.rows)?`Shown for your ${n} lug`:void 0}function y(t,r){const n=Array.isArray(t.lugs)?t.lugs:[];if(n.length===0)return!1;const l=new Set;for(const o of r)for(const u of o.lugs??[])l.add(u);return n.length<l.size}export{d as detailShotTag,p as namedDetailShots,w as pickDetailShots,y as variesByCar};
|