efficient-storefront-blocks 0.133.8 → 0.133.9

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.
@@ -1 +1 @@
1
- "use client";import{jsx as l,Fragment as O,jsxs as u}from"react/jsx-runtime";import{useRef as G}from"react";import{photoLabel as N}from"./product-hero/hero-view.js";import R from"./product-hero/SpinLayer.js";import{stageControls as $,useHeldStagePhoto as I}from"./product-hero/stage-photo.js";import{DEFAULT_HERO_CLOSE_UPS_FILL as z,DEFAULT_HERO_GALLERY_GAP as F,DEFAULT_HERO_GALLERY_MARKS as v,DEFAULT_HERO_GALLERY_MODE as B,DEFAULT_HERO_GALLERY_SHOW as V,DEFAULT_HERO_IMAGE_FIT as Y,DEFAULT_HERO_PHOTO_GROUND as w,parseHeroGalleryGap as W,parseHeroCloseUpsFill as q,parseHeroGalleryMarks as X,parseHeroGalleryMode as Z,parseHeroGalleryShow as K,parseHeroImageFit as J,parseHeroPhotoGround as Q,resolveHeroImageFit as ee}from"../lib/sections/hero-gallery.js";import{spinSetFor as te}from"../lib/sections/spin-sets.js";import{productHasComposedRender as ae}from"../lib/wheels/set-mode.js";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";import{swipeEnabled as le,swipeStep as ne}from"efficient-web-builder/format/lib/hero-swipe";function oe({product:t,view:e,angleIdx:o,onSelect:c,isLight:n,onLightbox:s,galleryMode:i=B,imageFit:h=Y,style:a,takesViewHide:m=!1,spin:p=re,ground:d=w,show:g=V,marks:y=v,gap:S=F,closeUpsFill:_=z}){const b=te(p,t.slug,e.metaValue),L=se(Q(d),n),f=K(g)==="closeUps"||b?ie(e):e,E=X(y),T=ce(e,f,q(_)),r=Z(i),x=ee(J(h),ae(t)),H=l(ue,{name:t.name,view:f,wellGround:L,angleIdx:o,onSelect:c,onLightbox:s,fit:x,spinSet:b,marks:E,fillsTile:T});return r==="stacked"?l(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,style:a,children:f.photos.length<2&&!b?H:u(O,{children:[l(me,{name:t.name,view:f,wellGround:L,onLightbox:s,fit:x,spinSet:b,gap:W(S),fillsTile:T}),l(pe,{angleIdx:o,total:U(f),onSelect:c,children:H})]})}):u(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,className:r==="tiled"?"flex items-start gap-3 max-view-tablet:gap-2":void 0,style:a,children:[l("div",{className:r==="tiled"?"min-w-0 flex-1":void 0,children:H}),r!=="main"&&l(he,{name:t.name,view:f,angleIdx:o,onSelect:c,isLight:n,tiled:r==="tiled"})]})}function U(t){return t.photos.length>0?t.photos.length:t.thumbFallbackCells}const j="relative flex aspect-square items-center justify-center overflow-hidden",re={},k="sf-photo-ground-studio";function se(t,e){return t==="studio"?k:e?"bg-bg":""}function ie(t){return t.photos.length===0||t.closeUps.length===0?t:{...t,photos:[t.photos[0],...t.closeUps.map(e=>e.url)],captions:[t.captions[0],...t.closeUps.map(e=>e.title)]}}const A=()=>!1;function ce(t,e,o){if(!o||e===t)return A;const c=new Set(t.closeUps.map(n=>n.url));return(n,s)=>s>0&&n!==void 0&&c.has(n)}const M=(t,e,o)=>[t,e.metaValue,o].filter(Boolean).join(" — "),P=(t,e)=>[t,e.metaValue].filter(Boolean).join(" "),D=(t,e)=>`Open ${[t,e.metaValue].filter(Boolean).join(" ")} at full resolution`;function me({name:t,view:e,wellGround:o,onLightbox:c,fit:n,spinSet:s,gap:i,fillsTile:h=A}){const a=s?l(R,{set:s,name:P(t,e)}):null,m=i===F;return l("div",{"data-hero-stack":!0,className:m?"flex flex-col gap-2 max-view-tablet:hidden":"flex flex-col max-view-tablet:hidden",style:m?void 0:{gap:`${i}px`},children:e.photos.map((p,d)=>{const g=M(t,e,N(e,d));return l("div",{"data-hero-stack-photo":!0,className:[j,o].join(" "),style:{color:e.tint},children:d===0&&a?a:e.stageImage({photo:p,alt:g,label:D(t,e),onZoom:()=>c(p,g),fit:n,eager:d===0,fillsTile:h(p,d)})},p)})})}function pe({angleIdx:t,total:e,onSelect:o,children:c}){const n=G(null),s=G(null),i=le({count:e}),h=a=>({x:a.touches[0].clientX,y:a.touches[0].clientY});return l("div",{"data-hero-phone-stage":!0,className:"view-tablet:hidden",onTouchStart:a=>{n.current=i&&a.touches.length===1?h(a):null,s.current=n.current},onTouchMove:a=>{n.current&&(a.touches.length!==1?n.current=null:s.current=h(a))},onTouchEnd:()=>{const a=n.current,m=s.current;if(n.current=null,s.current=null,!a||!m)return;const p=ne(m.x-a.x,m.y-a.y,t,e);p!==t&&o(p)},children:c})}const de=6;function ue({name:t,view:e,angleIdx:o,onSelect:c,onLightbox:n,fit:s,spinSet:i,wellGround:h,marks:a,fillsTile:m=A}){const p=e.photos[Math.min(o,e.photos.length-1)],d=I(e.photos,p),g=U(e),y=g>=2,S=String(g).padStart(2,"0"),_=Math.min(o,Math.max(e.photos.length-1,0)),b=y||e.captions[_]?N(e,_):"",L=M(t,e,b),f="max-view-tablet:static",E=[`${j} max-view-tablet:col-span-2`,h].join(" ");return u("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:e.tint},children:[a&&u("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&&u(O,{children:[u("span",{className:"text-accent",children:[String(o+1).padStart(2,"0")," / ",S]}),l("span",{className:"text-fg-dim",children:"·"})]}),l("span",{children:t}),e.metaValue&&u(O,{children:[l("span",{className:"text-fg-dim",children:"·"}),l("span",{className:"text-accent",children:e.metaValue})]})]}),a&&y&&l("div",{className:`absolute right-5 top-5 z-10 flex gap-1 ${f}`,children:$(o,g,c).map(r=>l("button",{type:"button","aria-label":r.label,title:r.label,onClick:r.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:r.glyph},r.label))}),u("div",{className:E,children:[h!==k&&["top-3 left-3","top-3 right-3","bottom-3 left-3","bottom-3 right-3"].map((r,x)=>l("span",{className:`absolute ${r} h-3 w-3 border border-fg-dim/40`,style:{borderTop:r.includes("top")?"1px solid var(--site-line)":"none",borderBottom:r.includes("bottom")?"1px solid var(--site-line)":"none",borderLeft:r.includes("left")?"1px solid var(--site-line)":"none",borderRight:r.includes("right")?"1px solid var(--site-line)":"none"}},x)),i&&_===0?l(R,{set:i,name:P(t,e)}):e.stageImage({photo:d,alt:L,label:D(t,e),onZoom:()=>n(d,L),fit:s,fillsTile:m(d,e.photos.indexOf(d??""))})]}),a&&u("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:[u("span",{className:"flex min-w-0 flex-col gap-1",children:[e.specCaption&&l("span",{children:e.specCaption}),e.referenceNote&&l("span",{"data-hero-reference-note":!0,children:e.referenceNote}),e.galleryHint&&l("span",{"data-hero-gallery-hint":!0,children:e.galleryHint})]}),l("span",{children:e.originCaption})]})]})}function he({name:t,view:e,angleIdx:o,onSelect:c,isLight:n,tiled:s=!1}){const i=U(e);return i<2?null:l("div",{className:s?"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:!s&&i>4?{gridTemplateColumns:`repeat(${Math.min(i,de)}, minmax(0, 1fr))`}:void 0,children:Array.from({length:i}).map((h,a)=>{const m=e.photos[a];return u("button",{type:"button",onClick:()=>c(a),"aria-label":`View ${N(e,a)}`,"aria-pressed":a===o,className:["relative flex aspect-square items-center justify-center overflow-hidden transition-colors",n?"bg-bg":"",a===o?"border border-accent":"border border-transparent hover:border-fg-dim"].join(" "),style:{color:e.tint},children:[l("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")}),e.thumbImage({photo:m,alt:`${t} — ${N(e,a)}`})]},a)})})}export{oe as default};
1
+ "use client";import{jsx as o,Fragment as O,jsxs as u}from"react/jsx-runtime";import{useRef as G}from"react";import{photoLabel as N}from"./product-hero/hero-view.js";import R from"./product-hero/SpinLayer.js";import{stageControls as $,useHeldStagePhoto as I}from"./product-hero/stage-photo.js";import{DEFAULT_HERO_CLOSE_UPS_FILL as z,DEFAULT_HERO_GALLERY_GAP as F,DEFAULT_HERO_GALLERY_MARKS as B,DEFAULT_HERO_GALLERY_MODE as V,DEFAULT_HERO_GALLERY_SHOW as v,DEFAULT_HERO_IMAGE_FIT as Y,DEFAULT_HERO_PHOTO_GROUND as W,parseHeroGalleryGap as q,parseHeroCloseUpsFill as X,parseHeroGalleryMarks as Z,parseHeroGalleryMode as w,parseHeroGalleryShow as K,parseHeroImageFit as J,parseHeroPhotoGround as Q,resolveHeroImageFit as ee}from"../lib/sections/hero-gallery.js";import{spinSetFor as te}from"../lib/sections/spin-sets.js";import{productHasComposedRender as ae}from"../lib/wheels/set-mode.js";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";import{swipeEnabled as oe,swipeStep as le}from"efficient-web-builder/format/lib/hero-swipe";function ne({product:t,view:e,angleIdx:n,onSelect:c,isLight:l,onLightbox:s,galleryMode:i=V,imageFit:h=Y,style:a,takesViewHide:m=!1,spin:p=re,ground:d=W,show:g=v,marks:y=B,gap:S=F,closeUpsFill:_=z}){const b=te(p,t.slug,e.metaValue),L=se(Q(d),l),f=K(g)==="closeUps"||b?ie(e):e,E=Z(y),T=ce(e,f,X(_)),r=w(i),x=ee(J(h),ae(t)),H=o(ue,{name:t.name,view:f,wellGround:L,angleIdx:n,onSelect:c,onLightbox:s,fit:x,spinSet:b,marks:E,fillsTile:T});return r==="stacked"?o(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,style:a,children:f.photos.length<2&&!b?H:u(O,{children:[o(me,{name:t.name,view:f,wellGround:L,onLightbox:s,fit:x,spinSet:b,gap:q(S),fillsTile:T}),o(pe,{angleIdx:n,total:U(f),onSelect:c,children:H})]})}):u(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,className:r==="tiled"?"flex items-start gap-3 max-view-tablet:gap-2":void 0,style:a,children:[o("div",{className:r==="tiled"?"min-w-0 flex-1":void 0,children:H}),r!=="main"&&o(he,{name:t.name,view:f,angleIdx:n,onSelect:c,isLight:l,tiled:r==="tiled"})]})}function U(t){return t.photos.length>0?t.photos.length:t.thumbFallbackCells}const j="relative flex aspect-square items-center justify-center overflow-hidden",re={},k="sf-photo-ground-studio";function se(t,e){return t==="studio"?k:e?"bg-bg":""}function ie(t){return t.photos.length===0||t.closeUps.length===0?t:{...t,photos:[t.photos[0],...t.closeUps.map(e=>e.url)],captions:[t.captions[0],...t.closeUps.map(e=>e.title)]}}const A=()=>!1;function ce(t,e,n){if(!n||e===t)return A;const c=new Set(t.closeUps.map(l=>l.url));return(l,s)=>s>0&&l!==void 0&&c.has(l)}const M=(t,e,n)=>[t,e.metaValue,n].filter(Boolean).join(" — "),P=(t,e)=>[t,e.metaValue].filter(Boolean).join(" "),D=(t,e)=>`Open ${[t,e.metaValue].filter(Boolean).join(" ")} at full resolution`;function me({name:t,view:e,wellGround:n,onLightbox:c,fit:l,spinSet:s,gap:i,fillsTile:h=A}){const a=s?o(R,{set:s,name:P(t,e),poster:e.photos[0]}):null,m=i===F;return o("div",{"data-hero-stack":!0,className:m?"flex flex-col gap-2 max-view-tablet:hidden":"flex flex-col max-view-tablet:hidden",style:m?void 0:{gap:`${i}px`},children:e.photos.map((p,d)=>{const g=M(t,e,N(e,d));return o("div",{"data-hero-stack-photo":!0,className:[j,n].join(" "),style:{color:e.tint},children:d===0&&a?a:e.stageImage({photo:p,alt:g,label:D(t,e),onZoom:()=>c(p,g),fit:l,eager:d===0,fillsTile:h(p,d)})},p)})})}function pe({angleIdx:t,total:e,onSelect:n,children:c}){const l=G(null),s=G(null),i=oe({count:e}),h=a=>({x:a.touches[0].clientX,y:a.touches[0].clientY});return o("div",{"data-hero-phone-stage":!0,className:"view-tablet:hidden",onTouchStart:a=>{l.current=i&&a.touches.length===1?h(a):null,s.current=l.current},onTouchMove:a=>{l.current&&(a.touches.length!==1?l.current=null:s.current=h(a))},onTouchEnd:()=>{const a=l.current,m=s.current;if(l.current=null,s.current=null,!a||!m)return;const p=le(m.x-a.x,m.y-a.y,t,e);p!==t&&n(p)},children:c})}const de=6;function ue({name:t,view:e,angleIdx:n,onSelect:c,onLightbox:l,fit:s,spinSet:i,wellGround:h,marks:a,fillsTile:m=A}){const p=e.photos[Math.min(n,e.photos.length-1)],d=I(e.photos,p),g=U(e),y=g>=2,S=String(g).padStart(2,"0"),_=Math.min(n,Math.max(e.photos.length-1,0)),b=y||e.captions[_]?N(e,_):"",L=M(t,e,b),f="max-view-tablet:static",E=[`${j} max-view-tablet:col-span-2`,h].join(" ");return u("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:e.tint},children:[a&&u("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&&u(O,{children:[u("span",{className:"text-accent",children:[String(n+1).padStart(2,"0")," / ",S]}),o("span",{className:"text-fg-dim",children:"·"})]}),o("span",{children:t}),e.metaValue&&u(O,{children:[o("span",{className:"text-fg-dim",children:"·"}),o("span",{className:"text-accent",children:e.metaValue})]})]}),a&&y&&o("div",{className:`absolute right-5 top-5 z-10 flex gap-1 ${f}`,children:$(n,g,c).map(r=>o("button",{type:"button","aria-label":r.label,title:r.label,onClick:r.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:r.glyph},r.label))}),u("div",{className:E,children:[h!==k&&["top-3 left-3","top-3 right-3","bottom-3 left-3","bottom-3 right-3"].map((r,x)=>o("span",{className:`absolute ${r} h-3 w-3 border border-fg-dim/40`,style:{borderTop:r.includes("top")?"1px solid var(--site-line)":"none",borderBottom:r.includes("bottom")?"1px solid var(--site-line)":"none",borderLeft:r.includes("left")?"1px solid var(--site-line)":"none",borderRight:r.includes("right")?"1px solid var(--site-line)":"none"}},x)),i&&_===0?o(R,{set:i,name:P(t,e),poster:e.photos[0]}):e.stageImage({photo:d,alt:L,label:D(t,e),onZoom:()=>l(d,L),fit:s,fillsTile:m(d,e.photos.indexOf(d??""))})]}),a&&u("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:[u("span",{className:"flex min-w-0 flex-col gap-1",children:[e.specCaption&&o("span",{children:e.specCaption}),e.referenceNote&&o("span",{"data-hero-reference-note":!0,children:e.referenceNote}),e.galleryHint&&o("span",{"data-hero-gallery-hint":!0,children:e.galleryHint})]}),o("span",{children:e.originCaption})]})]})}function he({name:t,view:e,angleIdx:n,onSelect:c,isLight:l,tiled:s=!1}){const i=U(e);return i<2?null:o("div",{className:s?"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:!s&&i>4?{gridTemplateColumns:`repeat(${Math.min(i,de)}, minmax(0, 1fr))`}:void 0,children:Array.from({length:i}).map((h,a)=>{const m=e.photos[a];return u("button",{type:"button",onClick:()=>c(a),"aria-label":`View ${N(e,a)}`,"aria-pressed":a===n,className:["relative flex aspect-square items-center justify-center overflow-hidden transition-colors",l?"bg-bg":"",a===n?"border border-accent":"border border-transparent hover:border-fg-dim"].join(" "),style:{color:e.tint},children:[o("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")}),e.thumbImage({photo:m,alt:`${t} — ${N(e,a)}`})]},a)})})}export{ne as default};
@@ -3,7 +3,8 @@ export declare const SpinChoices: import("react").Context<{
3
3
  autoTurn: boolean;
4
4
  turnHint: boolean;
5
5
  }>;
6
- export default function SpinLayer({ set, name }: {
6
+ export default function SpinLayer({ set, name, poster }: {
7
7
  set: SpinSet;
8
8
  name: string;
9
+ poster?: string;
9
10
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as x,Fragment as ie,jsxs as M}from"react/jsx-runtime";import{createContext as Me,useCallback as ae,useContext as Le,useEffect as w,useRef as y,useState as h}from"react";import{VIEW_TABLET_MIN as De}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as Ne}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as j,sizedImage as He}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as X}from"efficient-web-builder/render/components/useReducedMotion";import{DEFAULT_SPIN_AUTO_TURN as Re,DEFAULT_SPIN_HINT as $e,SPIN_HINT_HIDE_MS as Ce,SPIN_HINT_SHOW_MS as ce,SPIN_RESUME_MS as Oe,isFullTurn as le,spinAutoTurnStep as We,spinBlend as Ue,spinClampPosition as je,spinFrameIndex as L,spinPositionAfterDrag as ue,spinCell as z,spinStartPosition as B}from"../../lib/sections/spin-sets.js";const Xe=.3,ze=.85,de=24,fe=4,me=1e3,he=77/72,pe=`${(1-he)/2*100}%`,we=`${he*100}%`,q={left:pe,top:pe,width:we,height:we},Be=`(max-width: ${De-.02}px)`,K=new Map,ge=new Map;function G(t,v){let p=K.get(t);return p||(p=new Promise(P=>{const a=new Image,b=()=>{K.delete(t),ge.delete(t),P(null)},d=()=>P({w:a.naturalWidth,h:a.naturalHeight});a.onload=()=>{if(typeof a.decode!="function")return d();a.decode().then(d,b)},a.onerror=b,v&&(a.sizes=j,a.srcset=v),a.src=t,ge.set(t,a)}),K.set(t,p)),p}const qe=Me({autoTurn:Re,turnHint:$e});let D=!1;const Ke="M3 4.5c3.2 3.6 18.8 3.6 22 0M5.6 2.6 3 4.5l3 1.2M22.4 2.6 25 4.5l-3 1.2",N=t=>He(t,{fallbackWidth:me,maxWidth:me}),ye=(t,v)=>!!t.frames&&v===t.frames[0],ve=t=>({...q,backgroundImage:`url("${Ne(t.url)}")`,backgroundSize:`${t.cols*100}% ${t.rows*100}%`,backgroundPosition:`${t.cols>1?t.col*100/(t.cols-1):0}% ${t.rows>1?t.row*100/(t.rows-1):0}%`});function Ge({set:t,name:v}){const[p,P]=h(()=>B(t)),a=y(null),b=y(0),d=y(p),F=y(null),S=y(null),{autoTurn:f,turnHint:H}=Le(qe),[be,R]=h(!1),[Se,Z]=h(!1),[$,Q]=h(0),V=y(0),[Ee,Y]=h(!1),[_e,ke]=h(!0),[J,xe]=h(null),i=t.count,[C,ee]=h(null),O=y(null),[E,te]=h(null),g=le(t),_=L(p,i,g),A=ae(e=>{const n=je(e,i,g);return d.current=n,P(n),n},[i,g]),T=ae(()=>cancelAnimationFrame(b.current),[]);w(()=>{const e=window.matchMedia?.(Be);if(!e)return te(!1);const n=()=>te(e.matches);return n(),e.addEventListener?.("change",n),()=>e.removeEventListener?.("change",n)},[]),w(()=>{if(!t.sheets||!t.startFrame||E===null)return;const e=E?t.sheets.phone:t.sheets.desktop,n=`${t.startFrame} ${e.urls[0]}`;if(S.current===n)return;S.current=n,ee({key:n,sheet:e,ready:new Set});const r=Math.floor(B(t)/(e.cols*e.rows)),u=e.urls.map((l,o)=>e.urls[(r+o)%e.urls.length]),c=N(t.startFrame);G(c.src,c.srcSet).then(()=>{for(const l of u)G(l).then(o=>{!o||o.w!==e.cols*e.frame||o.h!==e.rows*e.frame||S.current===n&&ee(m=>m?.key===n?{...m,ready:new Set(m.ready).add(l)}:m)})})},[t,E]),w(()=>{if(!t.frames)return;const e=t.frames,n=e[0];if(S.current===n)return;S.current=n;const r=L(B(t),i,le(t)),u=[];for(let l=0;l<fe;l+=1)for(let o=l;o<i;o+=fe)u.push((r+o)%i);const c=l=>{const o=N(e[l]);return G(o.src,o.srcSet)};c(u[0]).then(()=>Promise.all(u.slice(1).map(c))).then(l=>{S.current===n&&l.every(Boolean)&&xe(n)})},[i,t]),w(()=>T,[T]),w(()=>{if(!H||D)return;const e=window.setTimeout(()=>R(!D),ce),n=window.setTimeout(()=>{D=!0,R(!1)},ce+Ce);return()=>{window.clearTimeout(e),window.clearTimeout(n)}},[H]),w(()=>{const e=a.current;if(!f||!e)return;if(typeof IntersectionObserver>"u")return Y(!0);const n=new IntersectionObserver(r=>Y(r.some(u=>u.isIntersecting)));return n.observe(e),()=>n.disconnect()},[f]),w(()=>{if(!f)return;const e=()=>ke(document.visibilityState!=="hidden");return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[f]);const Pe=e=>{T(),f&&Z(!0),H&&(D=!0,R(!1)),e.currentTarget.setPointerCapture?.(e.pointerId),F.current={x0:e.clientX,f0:d.current,last:e.clientX,speed:0}},Ae=e=>{const n=F.current,r=a.current;!n||!r||(n.speed=e.clientX-n.last,n.last=e.clientX,A(ue(n.f0,e.clientX-n.x0,r.clientWidth,i)))},ne=()=>{const e=F.current;F.current=null,f&&e&&(Z(!1),Q(c=>c+1));const n=a.current;if(!e||!n||X())return;let r=Math.max(-de,Math.min(de,e.speed));const u=()=>{if(Math.abs(r)<Xe)return;const c=ue(d.current,r,n.clientWidth,i);A(c)===c&&(r*=ze,b.current=requestAnimationFrame(u))};b.current=requestAnimationFrame(u)},Ie=e=>{const n=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")A(0);else if(e.key==="End")A(i-1);else if(n)A(Math.round(d.current)+n);else return;T(),f&&Q(r=>r+1),e.preventDefault()},s=t.sheets&&C&&C.key.startsWith(`${t.startFrame} `)?C:null;s&&s.ready.has(z(s.sheet,_).url)&&(O.current={key:s.key,frame:_});const W=s&&O.current?.key===s.key?O.current.frame:null,I=s&&W!==null?{...z(s.sheet,W),cols:s.sheet.cols,rows:s.sheet.rows}:null,k=Ue(p,i,g,X()),U=s&&k.b!==null&&W===_?z(s.sheet,k.b):null,re=I&&U&&s.ready.has(U.url)?{...U,cols:I.cols,rows:I.rows}:null,oe=!s&&t.frames&&k.b!==null&&ye(t,J)?t.frames[k.b]:null,Fe=t.frames?ye(t,J):!!s&&s.ready.size===s.sheet.urls.length,se=f&&Fe&&Ee&&_e&&!Se;return w(()=>{if(!se)return;const e=V.current!==$;let n=-1,r=-1,u=1,c=0;const l=o=>{if(c=requestAnimationFrame(l),n<0&&(n=o),e&&o-n<Oe)return;if(V.current=$,r<0){r=o;return}const m=We(t,d.current,u,o-r);r=o,u=m.way;const Te=L(d.current,i,g);d.current=m.position,(!X()||L(m.position,i,g)!==Te)&&P(m.position)};return c=requestAnimationFrame(l),()=>cancelAnimationFrame(c)},[se,$,t,i,g]),M("div",{ref:a,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${v}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":i,"aria-valuenow":_+1,"aria-valuetext":`Angle ${_+1} of ${i}`,"data-spin-auto-turn":f?"":void 0,onKeyDown:Ie,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:Pe,onPointerMove:Ae,onPointerUp:ne,onPointerCancel:ne,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[I?M(ie,{children:[x("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:ve(I)}),re?x("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...ve(re),opacity:k.mix}}):null]}):M(ie,{children:[x("img",{...N(t.frames?t.frames[_]:t.startFrame??""),sizes:j,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:q}),oe?x("img",{...N(oe),sizes:j,alt:"",draggable:!1,"data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:{...q,opacity:k.mix}}):null]}),be?M("span",{"data-spin-hint":!0,className:`pointer-events-none absolute inset-x-0 flex flex-col items-center gap-1 text-xs text-fg ${E?"bottom-3":"bottom-5"}`,children:[E?null:x("svg",{viewBox:"0 0 28 12",width:"28",height:"12","aria-hidden":"true",children:x("path",{d:Ke,fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),E?"Swipe to turn":"Drag to turn"]}):null]})}export{qe as SpinChoices,Ge as default};
1
+ "use client";import{jsx as b,Fragment as de,jsxs as H}from"react/jsx-runtime";import{createContext as $e,useCallback as fe,useContext as Oe,useEffect as h,useRef as p,useState as d}from"react";import{VIEW_TABLET_MIN as Re}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as Ce}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as $,sizedImage as We}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as G}from"efficient-web-builder/render/components/useReducedMotion";import{STAGE_PHOTO_BOX as Ue}from"../../lib/sections/hero-gallery.js";import{DEFAULT_SPIN_AUTO_TURN as je,DEFAULT_SPIN_HINT as Xe,SPIN_HINT_HIDE_MS as ze,SPIN_HINT_SHOW_MS as me,SPIN_RESUME_MS as Be,isFullTurn as he,spinAutoTurnStep as qe,spinBlend as Ge,spinClampPosition as Ke,spinFrameIndex as O,spinPositionAfterDrag as pe,spinCell as K,spinStartPosition as Z}from"../../lib/sections/spin-sets.js";const Ze=.3,Qe=.85,we=24,ge=4,ye=1e3,be=77/72,ve=`${(1-be)/2*100}%`,Se=`${be*100}%`,Q={left:ve,top:ve,width:Se,height:Se},Ve=`(max-width: ${Re-.02}px)`,V=new Map,Ee=new Map;function Y(t,v){let w=V.get(t);return w||(w=new Promise(M=>{const l=new Image,A=()=>{V.delete(t),Ee.delete(t),M(null)},S=()=>M({w:l.naturalWidth,h:l.naturalHeight});l.onload=()=>{if(typeof l.decode!="function")return S();l.decode().then(S,A)},l.onerror=A,v&&(l.sizes=$,l.srcset=v),l.src=t,Ee.set(t,l)}),V.set(t,w)),w}const Ye=$e({autoTurn:je,turnHint:Xe});let R=!1;const Je="M3 4.5c3.2 3.6 18.8 3.6 22 0M5.6 2.6 3 4.5l3 1.2M22.4 2.6 25 4.5l-3 1.2",F=t=>We(t,{fallbackWidth:ye,maxWidth:ye}),_e=(t,v)=>!!t.frames&&v===t.frames[0],Pe=t=>({...Q,backgroundImage:`url("${Ce(t.url)}")`,backgroundSize:`${t.cols*100}% ${t.rows*100}%`,backgroundPosition:`${t.cols>1?t.col*100/(t.cols-1):0}% ${t.rows>1?t.row*100/(t.rows-1):0}%`});function et({set:t,name:v,poster:w}){const[M,l]=d(null),A=p(null),[S,J]=d(()=>Z(t)),L=p(null),C=p(0),g=p(S),N=p(null),E=p(null),{autoTurn:f,turnHint:W}=Oe(Ye),[ke,U]=d(!1),[xe,ee]=d(!1),[j,te]=d(0),ne=p(0),[Ae,re]=d(!1),[Ie,Te]=d(!0),[oe,Fe]=d(null),i=t.count,[X,se]=d(null),z=p(null),[_,ie]=d(null),y=he(t),P=O(S,i,y),I=t.frames?t.frames[P]:t.startFrame??"";h(()=>{const e=A.current;e?.complete&&e.naturalWidth>0&&l(I)},[I]);const T=fe(e=>{const n=Ke(e,i,y);return g.current=n,J(n),n},[i,y]),D=fe(()=>cancelAnimationFrame(C.current),[]);h(()=>{const e=window.matchMedia?.(Ve);if(!e)return ie(!1);const n=()=>ie(e.matches);return n(),e.addEventListener?.("change",n),()=>e.removeEventListener?.("change",n)},[]),h(()=>{if(!t.sheets||!t.startFrame||_===null)return;const e=_?t.sheets.phone:t.sheets.desktop,n=`${t.startFrame} ${e.urls[0]}`;if(E.current===n)return;E.current=n,se({key:n,sheet:e,ready:new Set});const r=Math.floor(Z(t)/(e.cols*e.rows)),u=e.urls.map((c,o)=>e.urls[(r+o)%e.urls.length]),a=F(t.startFrame);Y(a.src,a.srcSet).then(()=>{for(const c of u)Y(c).then(o=>{!o||o.w!==e.cols*e.frame||o.h!==e.rows*e.frame||E.current===n&&se(m=>m?.key===n?{...m,ready:new Set(m.ready).add(c)}:m)})})},[t,_]),h(()=>{if(!t.frames)return;const e=t.frames,n=e[0];if(E.current===n)return;E.current=n;const r=O(Z(t),i,he(t)),u=[];for(let c=0;c<ge;c+=1)for(let o=c;o<i;o+=ge)u.push((r+o)%i);const a=c=>{const o=F(e[c]);return Y(o.src,o.srcSet)};a(u[0]).then(()=>Promise.all(u.slice(1).map(a))).then(c=>{E.current===n&&c.every(Boolean)&&Fe(n)})},[i,t]),h(()=>D,[D]),h(()=>{if(!W||R)return;const e=window.setTimeout(()=>U(!R),me),n=window.setTimeout(()=>{R=!0,U(!1)},me+ze);return()=>{window.clearTimeout(e),window.clearTimeout(n)}},[W]),h(()=>{const e=L.current;if(!f||!e)return;if(typeof IntersectionObserver>"u")return re(!0);const n=new IntersectionObserver(r=>re(r.some(u=>u.isIntersecting)));return n.observe(e),()=>n.disconnect()},[f]),h(()=>{if(!f)return;const e=()=>Te(document.visibilityState!=="hidden");return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[f]);const Me=e=>{D(),f&&ee(!0),W&&(R=!0,U(!1)),e.currentTarget.setPointerCapture?.(e.pointerId),N.current={x0:e.clientX,f0:g.current,last:e.clientX,speed:0}},Le=e=>{const n=N.current,r=L.current;!n||!r||(n.speed=e.clientX-n.last,n.last=e.clientX,T(pe(n.f0,e.clientX-n.x0,r.clientWidth,i)))},ae=()=>{const e=N.current;N.current=null,f&&e&&(ee(!1),te(a=>a+1));const n=L.current;if(!e||!n||G())return;let r=Math.max(-we,Math.min(we,e.speed));const u=()=>{if(Math.abs(r)<Ze)return;const a=pe(g.current,r,n.clientWidth,i);T(a)===a&&(r*=Qe,C.current=requestAnimationFrame(u))};C.current=requestAnimationFrame(u)},Ne=e=>{const n=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")T(0);else if(e.key==="End")T(i-1);else if(n)T(Math.round(g.current)+n);else return;D(),f&&te(r=>r+1),e.preventDefault()},s=t.sheets&&X&&X.key.startsWith(`${t.startFrame} `)?X:null;s&&s.ready.has(K(s.sheet,P).url)&&(z.current={key:s.key,frame:P});const B=s&&z.current?.key===s.key?z.current.frame:null,k=s&&B!==null?{...K(s.sheet,B),cols:s.sheet.cols,rows:s.sheet.rows}:null,x=Ge(S,i,y,G()),q=s&&x.b!==null&&B===P?K(s.sheet,x.b):null,ce=k&&q&&s.ready.has(q.url)?{...q,cols:k.cols,rows:k.rows}:null,le=!s&&t.frames&&x.b!==null&&_e(t,oe)?t.frames[x.b]:null,De=t.frames?_e(t,oe):!!s&&s.ready.size===s.sheet.urls.length,ue=f&&De&&Ae&&Ie&&!xe;return h(()=>{if(!ue)return;const e=ne.current!==j;let n=-1,r=-1,u=1,a=0;const c=o=>{if(a=requestAnimationFrame(c),n<0&&(n=o),e&&o-n<Be)return;if(ne.current=j,r<0){r=o;return}const m=qe(t,g.current,u,o-r);r=o,u=m.way;const He=O(g.current,i,y);g.current=m.position,(!G()||O(m.position,i,y)!==He)&&J(m.position)};return a=requestAnimationFrame(c),()=>cancelAnimationFrame(a)},[ue,j,t,i,y]),H("div",{ref:L,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${v}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":i,"aria-valuenow":P+1,"aria-valuetext":`Angle ${P+1} of ${i}`,"data-spin-auto-turn":f?"":void 0,onKeyDown:Ne,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:Me,onPointerMove:Le,onPointerUp:ae,onPointerCancel:ae,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[k?H(de,{children:[b("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:Pe(k)}),ce?b("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...Pe(ce),opacity:x.mix}}):null]}):H(de,{children:[b("img",{...F(I),ref:A,onLoad:()=>l(I),sizes:$,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:Q}),le?b("img",{...F(le),sizes:$,alt:"",draggable:!1,"data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:{...Q,opacity:x.mix}}):null]}),w&&!k&&M!==I?b("img",{...F(w),sizes:$,alt:"",draggable:!1,"data-spin-poster":!0,className:`pointer-events-none absolute inset-[6%] ${Ue} object-contain`}):null,ke?H("span",{"data-spin-hint":!0,className:`pointer-events-none absolute inset-x-0 flex flex-col items-center gap-1 text-xs text-fg ${_?"bottom-3":"bottom-5"}`,children:[_?null:b("svg",{viewBox:"0 0 28 12",width:"28",height:"12","aria-hidden":"true",children:b("path",{d:Je,fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),_?"Swipe to turn":"Drag to turn"]}):null]})}export{Ye as SpinChoices,et as default};
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ProductSelection } from "../useProductSelection.js";
3
3
  import type { StoreProduct } from "../../lib/catalog/store-product.js";
4
- import type { HeroImageFit } from "../../lib/sections/hero-gallery.js";
4
+ import { type HeroImageFit } from "../../lib/sections/hero-gallery.js";
5
5
  export interface HeroView {
6
6
  heading: string;
7
7
  photos: string[];
@@ -1 +1 @@
1
- "use client";import{jsx as a,Fragment as y,jsxs as N}from"react/jsx-runtime";import E from"./TyreHeroFitment.js";import{STAGE_IMAGE_SIZES as w}from"./stage-photo.js";import{HeroVehicleMemory as k}from"./VehicleQuestion.js";import z from"./WheelHeroFitment.js";import C from"../PreOrderPanel.js";import j from"efficient-web-builder/render/components/RMark";import P from"../TyreImage.js";import F from"../WheelImage.js";import I from"../WheelSvg.js";import{partVariant as S,wheelFinish as H}from"../../lib/catalog/from-wheel.js";import{tyreModelLine as L}from"../../lib/tyres/tyre-brand-name.js";import{axisRenderingsFor as R,lugRenderingsFor as _}from"../../lib/wheels/cover-rendering.js";import{namedDetailShots as A}from"../../lib/wheels/detail-shots.js";import{finishAngles as T}from"../../lib/wheels/finish-photos.js";import{selectedStuds as B}from"../../lib/wheels/selected-studs.js";import{REFERENCE_NOTE as O,stageIsFallback as V}from"../../lib/wheels/render-fit.js";import{PER_WHEEL_UNIT as W}from"../../lib/wheels/set-mode.js";import{variantSpecLabel as M}from"../../lib/wheels/variant-spec.js";function me(t,e){return t.captions[e]?.trim()||`Photo ${e+1}`}function ce({text:t}){return t==="FusionForge®"?N(y,{children:["FusionForge",a(j,{})]}):a(y,{children:t})}function pe(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:L(r.brand,r.name),photos:d.slice(0,1),tint:void 0,stageImage:()=>a(P,{image:n?.image??r.coverImage,size:l,type:f,sizes:w,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(E,{slug:r.slug,variants:r.variants,vehicle:e.vehicle,manualMode:e.manualMode,setManualMode:e.setManualMode}),vehicleMemory:e.manualMode?null:a(k,{vehicle:e.vehicle}),vehicleAnswersSpecs:!1,preOrder:null}}const o=t.source,i=H(o,e.shown.finish),s=S(o,e.part),c=B(e),x=s?.components.find(r=>r.hand!=="right")??s?.components[0],p=R(i,x?.renderKey),u=p?null:_(i,c),v=p?[...p]:u?[...u]:T(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,fillsTile:b=!1})=>a(F,{src:r,alt:l,fill:!0,sizes:w,className:b||d==="cover"?"object-cover":"object-contain",priority:m,onImageClick:f,imageButtonClassName:b?"relative block h-full w-full cursor-zoom-in":"relative block h-[88%] w-[88%] cursor-zoom-in",imageButtonLabel:n,fallback:a(I,{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(I,{spokes:o.spokes,mesh:o.mesh,className:"block h-[55%] w-[55%]"})}),captions:g.map(r=>i.captions?.[r]),closeUps:A(i,c),thumbFallbackCells:4,galleryHint:U(g,i,c,e.manualMode),referenceNote:!p&&V(i,s,c,u!=null)?O:"",metaValue:i.name,specCaption:s?M(s):"",originCaption:o.process==="FusionForge®"?"FusionForge® · Hybrid":`${o.process} · 1-piece`,unitLabel:W,vehicle:a(z,{selection:e,spec:s?M(s):"",vehicle:e.vehicle,wheel:o}),vehicleMemory:e.manualMode?null:a(k,{vehicle:e.vehicle}),vehicleAnswersSpecs:!0,preOrder:a(C,{wheel:o,editing:h})}}function U(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{ce as MarkedLabel,pe as heroView,me as photoLabel};
1
+ "use client";import{jsx as a,Fragment as y,jsxs as E}from"react/jsx-runtime";import N from"./TyreHeroFitment.js";import{STAGE_IMAGE_SIZES as w}from"./stage-photo.js";import{HeroVehicleMemory as k}from"./VehicleQuestion.js";import z from"./WheelHeroFitment.js";import C from"../PreOrderPanel.js";import P from"efficient-web-builder/render/components/RMark";import S from"../TyreImage.js";import F from"../WheelImage.js";import I from"../WheelSvg.js";import{partVariant as _,wheelFinish as j}from"../../lib/catalog/from-wheel.js";import{STAGE_PHOTO_BOX as H}from"../../lib/sections/hero-gallery.js";import{tyreModelLine as A}from"../../lib/tyres/tyre-brand-name.js";import{axisRenderingsFor as L,lugRenderingsFor as O}from"../../lib/wheels/cover-rendering.js";import{namedDetailShots as R}from"../../lib/wheels/detail-shots.js";import{finishAngles as T}from"../../lib/wheels/finish-photos.js";import{selectedStuds as B}from"../../lib/wheels/selected-studs.js";import{REFERENCE_NOTE as V,stageIsFallback as W}from"../../lib/wheels/render-fit.js";import{PER_WHEEL_UNIT as G}from"../../lib/wheels/set-mode.js";import{variantSpecLabel as M}from"../../lib/wheels/variant-spec.js";function pe(t,e){return t.captions[e]?.trim()||`Photo ${e+1}`}function he({text:t}){return t==="FusionForge®"?E(y,{children:["FusionForge",a(P,{})]}):a(y,{children:t})}function ue(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:A(r.brand,r.name),photos:d.slice(0,1),tint:void 0,stageImage:()=>a(S,{image:n?.image??r.coverImage,size:l,type:f,sizes:w,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(k,{vehicle:e.vehicle}),vehicleAnswersSpecs:!1,preOrder:null}}const o=t.source,i=j(o,e.shown.finish),s=_(o,e.part),c=B(e),x=s?.components.find(r=>r.hand!=="right")??s?.components[0],p=L(i,x?.renderKey),u=p?null:O(i,c),v=p?[...p]:u?[...u]:T(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,fillsTile:b=!1})=>a(F,{src:r,alt:l,fill:!0,sizes:w,className:b||d==="cover"?"object-cover":"object-contain",priority:m,onImageClick:f,imageButtonClassName:b?"relative block h-full w-full cursor-zoom-in":`relative block ${H} cursor-zoom-in`,imageButtonLabel:n,fallback:a(I,{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(I,{spokes:o.spokes,mesh:o.mesh,className:"block h-[55%] w-[55%]"})}),captions:g.map(r=>i.captions?.[r]),closeUps:R(i,c),thumbFallbackCells:4,galleryHint:U(g,i,c,e.manualMode),referenceNote:!p&&W(i,s,c,u!=null)?V:"",metaValue:i.name,specCaption:s?M(s):"",originCaption:o.process==="FusionForge®"?"FusionForge® · Hybrid":`${o.process} · 1-piece`,unitLabel:G,vehicle:a(z,{selection:e,spec:s?M(s):"",vehicle:e.vehicle,wheel:o}),vehicleMemory:e.manualMode?null:a(k,{vehicle:e.vehicle}),vehicleAnswersSpecs:!0,preOrder:a(C,{wheel:o,editing:h})}}function U(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{he as MarkedLabel,ue as heroView,pe as photoLabel};
@@ -5,6 +5,7 @@ export declare const HERO_GALLERY_MODES: readonly ["main", "thumbs", "tiled", "s
5
5
  export declare const DEFAULT_HERO_GALLERY_MODE: HeroGalleryMode;
6
6
  export declare function parseHeroGalleryMode(v: unknown): HeroGalleryMode;
7
7
  export type HeroImageFit = ImageFit;
8
+ export declare const STAGE_PHOTO_BOX = "h-[88%] w-[88%]";
8
9
  export declare const HERO_IMAGE_FITS: readonly HeroImageFit[];
9
10
  export declare const DEFAULT_HERO_IMAGE_FIT: HeroImageFit;
10
11
  export declare function parseHeroImageFit(v: unknown): HeroImageFit;
@@ -1 +1 @@
1
- import{parseOption as t}from"efficient-shell/format";import{PICTURE_GROUNDS as r}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"],s="thumbs";function f(e){return t(a,s,e)}const _=["contain","cover"],E="contain";function F(e){return p(e,E)}function U(){return _.map(e=>({label:n[e],value:e}))}function I(e,o){return o?"contain":e}const l=r.filter(e=>e.value!=="soft"),c="flat";function M(e){return t(l.map(o=>o.value),c,e)}const i=[{label:"Every picture",value:"all"},{label:"First picture + close-ups",value:"closeUps"}],u="all";function T(e){return t(i.map(o=>o.value),u,e)}const L=!1,D=e=>typeof e=="boolean"?e:L,O=!0;function S(e){return typeof e=="boolean"?e:O}const R=0,H=24,A=8;function b(e){const o=typeof e=="number"?e:Number.NaN;return Number.isFinite(o)?Math.min(H,Math.max(R,Math.round(o))):A}export{L as DEFAULT_HERO_CLOSE_UPS_FILL,A as DEFAULT_HERO_GALLERY_GAP,O as DEFAULT_HERO_GALLERY_MARKS,s as DEFAULT_HERO_GALLERY_MODE,u as DEFAULT_HERO_GALLERY_SHOW,E as DEFAULT_HERO_IMAGE_FIT,c as DEFAULT_HERO_PHOTO_GROUND,H as HERO_GALLERY_GAP_MAX,R as HERO_GALLERY_GAP_MIN,a as HERO_GALLERY_MODES,i as HERO_GALLERY_SHOWS,_ as HERO_IMAGE_FITS,l as HERO_PHOTO_GROUNDS,U as heroImageFitOptions,D as parseHeroCloseUpsFill,b as parseHeroGalleryGap,S as parseHeroGalleryMarks,f as parseHeroGalleryMode,T as parseHeroGalleryShow,F as parseHeroImageFit,M as parseHeroPhotoGround,I as resolveHeroImageFit};
1
+ import{parseOption as t}from"efficient-shell/format";import{PICTURE_GROUNDS as r}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"],s="thumbs";function f(e){return t(a,s,e)}const F="h-[88%] w-[88%]",_=["contain","cover"],E="contain";function T(e){return p(e,E)}function U(){return _.map(e=>({label:n[e],value:e}))}function I(e,o){return o?"contain":e}const l=r.filter(e=>e.value!=="soft"),c="flat";function M(e){return t(l.map(o=>o.value),c,e)}const i=[{label:"Every picture",value:"all"},{label:"First picture + close-ups",value:"closeUps"}],u="all";function D(e){return t(i.map(o=>o.value),u,e)}const O=!1,S=e=>typeof e=="boolean"?e:O,L=!0;function b(e){return typeof e=="boolean"?e:L}const H=0,R=24,A=8;function h(e){const o=typeof e=="number"?e:Number.NaN;return Number.isFinite(o)?Math.min(R,Math.max(H,Math.round(o))):A}export{O as DEFAULT_HERO_CLOSE_UPS_FILL,A as DEFAULT_HERO_GALLERY_GAP,L as DEFAULT_HERO_GALLERY_MARKS,s as DEFAULT_HERO_GALLERY_MODE,u as DEFAULT_HERO_GALLERY_SHOW,E as DEFAULT_HERO_IMAGE_FIT,c as DEFAULT_HERO_PHOTO_GROUND,R as HERO_GALLERY_GAP_MAX,H as HERO_GALLERY_GAP_MIN,a as HERO_GALLERY_MODES,i as HERO_GALLERY_SHOWS,_ as HERO_IMAGE_FITS,l as HERO_PHOTO_GROUNDS,F as STAGE_PHOTO_BOX,U as heroImageFitOptions,S as parseHeroCloseUpsFill,h as parseHeroGalleryGap,b as parseHeroGalleryMarks,f as parseHeroGalleryMode,D as parseHeroGalleryShow,T as parseHeroImageFit,M as parseHeroPhotoGround,I as resolveHeroImageFit};
@@ -15,6 +15,7 @@ export interface SpinSet {
15
15
  };
16
16
  arc?: number;
17
17
  start?: number;
18
+ autoArc?: number;
18
19
  }
19
20
  export type SpinSets = Record<string, Record<string, SpinSet>>;
20
21
  export declare const DEFAULT_SPIN_AUTO_TURN = false;
@@ -23,7 +24,8 @@ export declare function parseSpinSwitch(v: unknown): boolean;
23
24
  export declare const SPIN_HINT_SHOW_MS = 1000;
24
25
  export declare const SPIN_HINT_HIDE_MS = 6000;
25
26
  export declare const SPIN_TURN_MS = 14000;
26
- export declare const SPIN_RESUME_MS = 2500;
27
+ export declare const SPIN_RESUME_MS = 5000;
28
+ export declare const DEFAULT_SPIN_AUTO_ARC = 160;
27
29
  export declare function spinAutoTurnStep(set: SpinSet, position: number, way: 1 | -1, ms: number): {
28
30
  position: number;
29
31
  way: 1 | -1;
@@ -1 +1 @@
1
- import{resolveMedia as S}from"efficient-web-builder/render/lib/media";const a=4096,c=360,h=.9,A=!1,g=!1;function P(t){return t===!0}const d=1e3,E=6e3,m=14e3,M=1e-6,j=2500;function F(t,n,r,e){const o=p(t)?c:t.arc,s=n+r*e*t.count*c/(m*o);if(p(t))return{position:(s%t.count+t.count)%t.count,way:r};const i=t.count-M;return s>=i?{position:i,way:-1}:s<=0?{position:0,way:1}:{position:s,way:r}}const _=t=>Array.isArray(t)&&t.length>0&&t.every(n=>typeof n=="string"&&n.length>0),l=t=>S(t)??t,f=t=>Number.isInteger(t)&&t>0;function x(t,n){if(!t||typeof t!="object")return null;const{frame:r,cols:e,rows:o,urls:s}=t;return!f(r)||!f(e)||!f(o)||!_(s)||r*e>a||r*o>a||s.length!==Math.ceil(n/(e*o))?null:{frame:r,cols:e,rows:o,urls:s.map(l)}}function y(t){const{frames:n,count:r,startFrame:e,sheets:o}=t,s=_(n)?{count:n.length,frames:n.map(l)}:null;if(o&&typeof o=="object"&&f(r)&&typeof e=="string"&&e){const i=x(o.desktop,r),u=x(o.phone,r);if(i&&u)return{count:r,startFrame:l(e),sheets:{desktop:i,phone:u}}}return s}function N(t){if(!t||typeof t!="object")return null;const{arc:n,start:r}=t,e=y(t);if(!e)return null;if(n!==void 0){if(typeof n!="number"||!(n>0&&n<=c))return null;e.arc=n}return Number.isInteger(r)&&r>=0&&r<e.count&&(e.start=r),e}function U(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,e]of Object.entries(t)){if(!e||typeof e!="object"||Array.isArray(e))continue;const o={};for(const[s,i]of Object.entries(e)){const u=N(i);u&&(o[s]=u)}Object.keys(o).length>0&&(n[r]=o)}return n}function R(t,n,r){return r?t[n]?.[r]??null:null}function L(t,n){const r=Object.keys(t?.[n]??{});return r.length>0?{finish:r}:null}function p(t){return t.arc===void 0||t.arc>=c}function I(t){return p(t)?0:Math.floor(t.count/2)}function k(t){return t.start??I(t)}function T(t,n,r=!0){return r?(Math.floor(t)%n+n)%n:Math.max(0,Math.min(n-1,Math.floor(t)))}function D(t,n,r,e){const o=T(t,n,r),s=t-Math.floor(t),i=r?(o+1)%n:o+1<n?o+1:null;return e||s===0||i===null?{a:o,b:null,mix:0}:{a:o,b:i,mix:s}}function H(t,n,r){return r?t:Math.max(0,Math.min(n-1,t))}function O(t,n,r,e){return r<=0?t:t-n/r*e*h}function C(t,n){const r=t.cols*t.rows,e=n%r;return{url:t.urls[Math.floor(n/r)],col:e%t.cols,row:Math.floor(e/t.cols)}}export{A as DEFAULT_SPIN_AUTO_TURN,g as DEFAULT_SPIN_HINT,E as SPIN_HINT_HIDE_MS,d as SPIN_HINT_SHOW_MS,j as SPIN_RESUME_MS,a as SPIN_SHEET_MAX_SIDE,m as SPIN_TURN_MS,p as isFullTurn,U as parseSpinSets,P as parseSpinSwitch,F as spinAutoTurnStep,D as spinBlend,C as spinCell,H as spinClampPosition,T as spinFrameIndex,O as spinPositionAfterDrag,L as spinPreference,R as spinSetFor,k as spinStartPosition};
1
+ import{resolveMedia as m}from"efficient-web-builder/render/lib/media";const x=4096,c=360,M=.9,E=!1,U=!1;function F(t){return t===!0}const j=1e3,R=6e3,S=14e3,y=1e-6,L=5e3,N=160;function D(t,n,r,e){const o=t.autoArc??N;if(a(t)&&o<c)return g(t.count,o,n,r,e*t.count/S);const i=a(t)?c:t.arc,s=n+r*e*t.count*c/(S*i);if(a(t))return{position:(s%t.count+t.count)%t.count,way:r};const u=t.count-y;return s>=u?{position:u,way:-1}:s<=0?{position:0,way:1}:{position:s,way:r}}const h=t=>Array.isArray(t)&&t.length>0&&t.every(n=>typeof n=="string"&&n.length>0),_=t=>m(t)??t,p=t=>Number.isInteger(t)&&t>0;function A(t,n){if(!t||typeof t!="object")return null;const{frame:r,cols:e,rows:o,urls:i}=t;return!p(r)||!p(e)||!p(o)||!h(i)||r*e>x||r*o>x||i.length!==Math.ceil(n/(e*o))?null:{frame:r,cols:e,rows:o,urls:i.map(_)}}function T(t){const{frames:n,count:r,startFrame:e,sheets:o}=t,i=h(n)?{count:n.length,frames:n.map(_)}:null;if(o&&typeof o=="object"&&p(r)&&typeof e=="string"&&e){const s=A(o.desktop,r),u=A(o.phone,r);if(s&&u)return{count:r,startFrame:_(e),sheets:{desktop:s,phone:u}}}return i}function I(t){if(!t||typeof t!="object")return null;const{arc:n,start:r}=t,e=T(t);if(!e)return null;if(n!==void 0){if(typeof n!="number"||!(n>0&&n<=c))return null;e.arc=n}const{autoArc:o}=t;return typeof o=="number"&&o>0&&o<=c&&(e.autoArc=o),Number.isInteger(r)&&r>=0&&r<e.count&&(e.start=r),e}function O(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,e]of Object.entries(t)){if(!e||typeof e!="object"||Array.isArray(e))continue;const o={};for(const[i,s]of Object.entries(e)){const u=I(s);u&&(o[i]=u)}Object.keys(o).length>0&&(n[r]=o)}return n}function k(t,n,r){return r?t[n]?.[r]??null:null}function w(t,n){const r=Object.keys(t?.[n]??{});return r.length>0?{finish:r}:null}function a(t){return t.arc===void 0||t.arc>=c}function g(t,n,r,e,o){const i=t*n/(2*c),s=(r%t+t)%t,u=s>t/2?s-t:s;let f=u>i?-1:u<-i?1:e,l=u+f*o;return f===1&&u<=i&&l>=i?[l,f]=[i,-1]:f===-1&&u>=-i&&l<=-i&&([l,f]=[-i,1]),{position:(l%t+t)%t,way:f}}function b(t){return a(t)?0:Math.floor(t.count/2)}function H(t){return t.start??b(t)}function d(t,n,r=!0){return r?(Math.floor(t)%n+n)%n:Math.max(0,Math.min(n-1,Math.floor(t)))}function C(t,n,r,e){const o=d(t,n,r),i=t-Math.floor(t),s=r?(o+1)%n:o+1<n?o+1:null;return e||i===0||s===null?{a:o,b:null,mix:0}:{a:o,b:s,mix:i}}function W(t,n,r){return r?t:Math.max(0,Math.min(n-1,t))}function B(t,n,r,e){return r<=0?t:t-n/r*e*M}function G(t,n){const r=t.cols*t.rows,e=n%r;return{url:t.urls[Math.floor(n/r)],col:e%t.cols,row:Math.floor(e/t.cols)}}export{N as DEFAULT_SPIN_AUTO_ARC,E as DEFAULT_SPIN_AUTO_TURN,U as DEFAULT_SPIN_HINT,R as SPIN_HINT_HIDE_MS,j as SPIN_HINT_SHOW_MS,L as SPIN_RESUME_MS,x as SPIN_SHEET_MAX_SIDE,S as SPIN_TURN_MS,a as isFullTurn,O as parseSpinSets,F as parseSpinSwitch,D as spinAutoTurnStep,C as spinBlend,G as spinCell,W as spinClampPosition,d as spinFrameIndex,B as spinPositionAfterDrag,w as spinPreference,k as spinSetFor,H as spinStartPosition};