@anker-in/headless-ui 1.3.80 → 1.3.81
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/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.d.ts +2 -0
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/styles.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/DiscountBadge.d.ts +25 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/DiscountBadge.js +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +4 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +4 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -2
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +0 -3
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductTags.d.ts +14 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductTags.js +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/context.d.ts +2 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/context.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.d.ts +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +70 -3
- package/dist/cjs/biz-components/BuyOneGetOneShelf/types.js +1 -1
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/MediaShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/MediaShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/MediaShelf/index.js +1 -1
- package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/material/breakpoints.d.ts +97 -0
- package/dist/cjs/material/breakpoints.js +1 -0
- package/dist/cjs/material/contract.d.ts +72 -0
- package/dist/cjs/material/contract.js +1 -0
- package/dist/cjs/material/index.d.ts +17 -0
- package/dist/cjs/material/index.js +1 -0
- package/dist/cjs/material/material-meta.d.ts +76 -0
- package/dist/cjs/material/material-meta.js +1 -0
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.d.ts +2 -0
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/styles.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/DiscountBadge.d.ts +25 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/DiscountBadge.js +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +4 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +4 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -2
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +0 -3
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductTags.d.ts +14 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductTags.js +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/context.d.ts +2 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.d.ts +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +70 -3
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/MediaShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/MediaShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/MediaShelf/index.js +1 -1
- package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/material/breakpoints.d.ts +97 -0
- package/dist/esm/material/breakpoints.js +1 -0
- package/dist/esm/material/contract.d.ts +72 -0
- package/dist/esm/material/contract.js +1 -0
- package/dist/esm/material/index.d.ts +17 -0
- package/dist/esm/material/index.js +1 -0
- package/dist/esm/material/material-meta.d.ts +76 -0
- package/dist/esm/material/material-meta.js +1 -0
- package/package.json +13 -2
- package/style.css +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var W=Object.create;var x=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var n in t)x(e,n,{get:t[n],enumerable:!0})},B=(e,t,n,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Z(t))!J.call(e,l)&&l!==n&&x(e,l,{get:()=>t[l],enumerable:!(d=q(t,l))||d.enumerable});return e};var O=(e,t,n)=>(n=e!=null?W(G(e)):{},B(t||!e||!e.__esModule?x(n,"default",{value:e,enumerable:!0}):n,e)),Q=e=>B(x({},"__esModule",{value:!0}),e);var ne={};K(ne,{default:()=>re});module.exports=Q(ne);var r=require("react/jsx-runtime"),i=O(require("react")),o=require("../../helpers/index.js"),H=require("../../shared/Styles.js"),g=require("../../components/index.js"),f=require("swiper/react"),v=require("class-variance-authority"),L=require("../SwiperBox/buildSsrSlideCss.js");const D=(e,t)=>{const n=Date.now(),d=new Date(e).getTime(),l=new Date(t).getTime();return n>l?"completed":n<d?"not-started":"in-progress"},U=(0,v.cva)("h-1 w-full overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),X=(0,v.cva)("size-4 rounded-full transition-colors",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),$=(0,v.cva)("font-bold leading-[1.2]",{variants:{state:{"in-progress-light":"text-[#080A0F]","in-progress-dark":"text-white","not-started-light":"text-[#080A0F]","not-started-dark":"text-[#F5F6F7]","completed-light":"text-[#4A4C56]/60","completed-dark":"text-[#F5F6F7]/60"}},defaultVariants:{state:"not-started-light"}}),Y=(0,v.cva)("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F4E8BC]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F4E8BC]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),ee=({timeStatus:e,theme:t="light",className:n,index:d,nodeLength:l})=>{const p=`${e}-${t}`,a=d===0,c=d===l-1;return(0,r.jsxs)("div",{className:(0,o.cn)(`event-schedule-timeline-node event-schedule-timeline-node--${e} relative my-2 flex h-1 w-full items-center justify-center`,n),children:[(0,r.jsx)("div",{className:(0,o.cn)(`event-schedule-timeline-progress event-schedule-timeline-progress--${e}`,U({state:p}),a&&"rounded-l-full",c&&"rounded-r-full")}),(0,r.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:(0,r.jsx)("div",{className:(0,o.cn)(`event-schedule-timeline-dot event-schedule-timeline-dot--${e}`,X({state:p}))})})]})},te=(e,t)=>{if(e)return t==="in-progress"?e.active:t==="completed"&&e.completed||e.inactive},se=({timeStatus:e,item:t,theme:n="light",className:d,scheduleCount:l})=>{const p=i.useMemo(()=>te(t.icon,e),[t.icon,e]),a=`${e}-${n}`;return(0,r.jsxs)("div",{className:(0,o.cn)(`event-schedule-card event-schedule-card--${e}`,Y({state:a}),d),children:[p&&(0,r.jsx)("div",{className:`event-schedule-card__background-icon event-schedule-card__background-icon--${e} laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]`,children:(0,r.jsx)(g.Picture,{source:p.url,alt:p.alt,className:"aspect-square"})}),(0,r.jsxs)("div",{className:`event-schedule-card__content event-schedule-card__content--${e} tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8`,children:[(0,r.jsx)(g.Heading,{html:t.title,className:(0,o.cn)(`event-schedule-card__title event-schedule-card__title--${e}`,l>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",$({state:a}))}),(0,r.jsx)("div",{className:`event-schedule-card__details event-schedule-card__details--${e} flex flex-col gap-0.5`,children:t.items.map((c,u)=>(0,r.jsxs)("div",{className:`event-schedule-card__detail-item event-schedule-card__detail-item--${e} flex items-center gap-2`,children:[c.icon&&(0,r.jsx)(g.Text,{className:(0,o.cn)(`event-schedule-card__detail-icon event-schedule-card__detail-icon--${e} desktop:size-6 size-5 shrink-0`,$({state:a})),html:c.icon}),(0,r.jsx)(g.Text,{html:c.label,className:(0,o.cn)(`event-schedule-card__detail-text event-schedule-card__detail-text--${e} lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]`,$({state:a}))})]},u))})]})]})},P=i.forwardRef(({classNames:e={},data:t,className:n,...d},l)=>{const p=t.theme||"light",a=i.useRef(null),c=i.useRef(null),u=i.useRef(!1),S=i.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),w=i.useMemo(()=>t.scheduleList.findIndex(s=>D(s.startDate,s.endDate)==="in-progress"),[t.scheduleList]),b=i.useCallback((s,h=!1)=>{const m=j=>{switch(j){case"mobile":return{slidesPerView:1.17};case"tablet":return s===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return s===2?{}:s===4?{slidesPerView:3.2}:{slidesPerView:s};case"desktop":return s===2?{slidesPerView:2}:{slidesPerView:s}}},M=m("mobile"),F=m("tablet"),V=m("laptop"),A=m("desktop");return h?{0:{...M,spaceBetween:12},768:{...F,spaceBetween:12},1024:{...V,spaceBetween:16},1440:{...A,spaceBetween:16}}:{0:M,768:F,1024:V,1440:A}},[]),k=i.useMemo(()=>b(S,!0),[S,b]),T=i.useMemo(()=>b(S,!1),[S,b]),I=i.useId().replace(/[^a-zA-Z0-9_-]/g,""),C=`swiper-ssr-timeline-${I}`,E=`swiper-ssr-cards-${I}`,_=i.useMemo(()=>(0,L.buildSsrSlideCss)(`.${C}`,T),[C,T]),N=i.useMemo(()=>(0,L.buildSsrSlideCss)(`.${E}`,k),[E,k]),y=t.showTimeline!==!1,z=i.useCallback(s=>{u.current||!c.current||(u.current=!0,c.current.slideTo(s.activeIndex,s.params.speed),setTimeout(()=>{u.current=!1},50))},[]),R=i.useCallback(s=>{u.current||!a.current||(u.current=!0,a.current.slideTo(s.activeIndex,s.params.speed),setTimeout(()=>{u.current=!1},50))},[]);return i.useEffect(()=>{a.current&&c.current&&w>=0&&setTimeout(()=>{u.current=!0,a.current?.slideTo(w,500),c.current?.slideTo(w,500),setTimeout(()=>{u.current=!1},600)},100)},[w]),(0,r.jsxs)("div",{...d,ref:l,className:(0,o.cn)("event-schedule-root overflow-hidden",e?.root,n),children:[y&&_&&(0,r.jsx)("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:_}}),N&&(0,r.jsx)("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:N}}),y&&(0,r.jsx)(f.Swiper,{breakpoints:T,className:(0,o.cn)("event-schedule-timeline h-4 w-full !overflow-visible",_&&C),onSwiper:s=>{c.current=s},onSlideChange:R,children:t.scheduleList.map((s,h)=>{const m=D(s.startDate,s.endDate);return(0,r.jsx)(f.SwiperSlide,{className:"",children:(0,r.jsx)(ee,{className:e?.timeline,timeStatus:m,theme:p,index:h,nodeLength:t.scheduleList.length})},"timelineNode"+h)})}),(0,r.jsx)(f.Swiper,{breakpoints:k,className:(0,o.cn)("event-schedule-cards w-full !overflow-visible",N&&E),onSwiper:s=>{a.current=s},onSlideChange:z,children:t.scheduleList.map((s,h)=>{const m=D(s.startDate,s.endDate);return(0,r.jsx)(f.SwiperSlide,{children:(0,r.jsx)(se,{timeStatus:m,className:(0,o.cn)(y?"laptop:mt-4 mt-2":"",e?.eventScheduleCard),item:s,theme:p,scheduleCount:t.scheduleList.length})},"SwiperSlideItem"+h)})})]})});P.displayName="EventSchedule";var re=(0,H.withLayout)(P);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var A=Object.create;var b=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var R=(e,i)=>{for(var r in i)b(e,r,{get:i[r],enumerable:!0})},k=(e,i,r,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of $(i))!H.call(e,s)&&s!==r&&b(e,s,{get:()=>i[s],enumerable:!(d=q(i,s))||d.enumerable});return e};var I=(e,i,r)=>(r=e!=null?A(E(e)):{},k(i||!e||!e.__esModule?b(r,"default",{value:e,enumerable:!0}):r,e)),O=e=>k(b({},"__esModule",{value:!0}),e);var W={};R(W,{ProductCard:()=>u,default:()=>K});module.exports=O(W);var a=require("react/jsx-runtime"),c=I(require("react")),n=require("../../helpers/index.js"),t=require("../../components/index.js");const G=5;function j(e,i,r,d){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return i===void 0?!0:r<=i;case"below-percentage":return i===void 0?!0:r/d*100<=i;default:return!0}}const u=c.forwardRef(({product:e,className:i,stockDisplayMode:r,stockThresholdValue:d,onLearnMore:s,onShopNow:C,onAddToCart:S,classNames:l,secondaryButtonText:p,secondaryButtonFun:v,primaryButtonText:y,primaryButtonFun:h,showOriginalPrice:P,copy:g,onProductImageClick:m,showTags:N=!0,showMemberPrice:M=!0},F)=>{const[L,B]=c.useState(!1),[D,T]=c.useState(!1),z=c.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?G:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),x=async(o,f)=>{if(!o)return;const w=f==="primary"?B:T;w(!0);try{switch(o){case"buyNow":await C?.(e);break;case"addCart":await S?.(e);break;case"learnMore":await s?.(e);break;default:break}}finally{w(!1)}},_=e.availableForSale&&e.quantityAvailable<=0;return(0,a.jsxs)(t.Card,{ref:F,className:(0,n.cn)("tablet:min-w-[auto] hover:bg-container-secondary-0 flex h-full min-w-[296px] flex-col overflow-hidden border-none",e.custom_link?"cursor-pointer":"",i,l?.productCard),children:[(0,a.jsxs)("div",{className:(0,n.cn)("media-shelf-product-card-image-wrapper desktop:h-[240px] relative h-[200px] shrink-0 overflow-hidden",l?.productCardImageWrapper),children:[(0,a.jsx)("div",{className:(0,n.cn)("media-shelf-product-card-image-bg absolute inset-0 ",l?.productCardImageBg),children:(0,a.jsx)("a",{onClick:()=>m?.(e),...!m&&{href:e.custom_link||e.listingLink},className:"cursor-pointer",children:(0,a.jsx)(t.Picture,{source:e.custom_image||e.image,alt:e.name,className:(0,n.cn)("h-full",l?.productCardImage),imgClassName:"h-full object-contain"})})}),N&&e.tags&&e.tags.length>0&&(0,a.jsx)("div",{className:"lg-desktop:h-[28px] absolute left-4 top-4 flex h-[24px]",children:e.tags.map((o,f)=>o.label?(0,a.jsx)(t.Badge,{size:"sm",variant:o.variant||"outline",className:(0,n.cn)("mr-1"),promotionalType:o.promotionalType,children:o.label},f):(0,a.jsx)(c.Fragment,{children:o},f))})]}),(0,a.jsxs)(t.CardContent,{className:"desktop:p-6 bg-container-primary laptop:gap-6 flex h-[calc(100%-240px)] grow flex-col justify-between gap-4 p-4",children:[(0,a.jsxs)("div",{className:"flex-0",children:[(0,a.jsx)(t.Heading,{as:"h3",size:2,className:(0,n.cn)("text-info-primary mb-1 line-clamp-2 tracking-tight",m?"cursor-pointer":"",l?.productTitle),onClick:m?()=>m(e):void 0,children:e.custom_name||e.name}),(e.custom_description||e?.description)&&(0,a.jsx)(t.Text,{size:2,className:(0,n.cn)("text-info-primary line-clamp-1",l?.productDescription),html:e.custom_description||e.description})]}),j(r,d,e?.quantityAvailable??0,e?.totalInventory??0)&&(0,a.jsxs)("div",{"data-total":e?.totalInventory??0,"data-available":e?.quantityAvailable??0,className:"space-y-2",children:[(0,a.jsx)(t.Progress,{value:z,max:100,min:0,size:"base",variant:"default","aria-label":"stock progress",classNames:{progressBar:"transition-all duration-300 ease-in-out"}}),(0,a.jsx)(t.Text,{size:3,className:"text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] text-[12px]",children:_?g?.limitedStock:g?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:(0,n.cn)("mb-2",l?.productPrice),children:(0,a.jsx)("div",{className:"flex items-baseline gap-2",children:e.availableForSale?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.Heading,{size:2,className:"text-info-primary",as:"h6",children:e.price}),P&&e.originalPrice&&(0,a.jsx)(t.Heading,{size:2,className:(0,n.cn)("text-info-tertiary line-through",l?.originalPrice),as:"h6",children:e.originalPrice})]}):(0,a.jsx)(t.Heading,{size:2,className:"text-info-tertiary",children:g?.outOfStockLabel??"Sold Out"})})}),M&&e?.priceLabel&&e?.availableForSale&&(0,a.jsx)(t.Text,{size:4,className:(0,n.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[12px]",l?.productPriceLabel),children:e.priceLabel}),(0,a.jsxs)("div",{className:(0,n.cn)("lg-desktop:gap-3 tablet:flex-nowrap flex flex-wrap gap-2",l?.buttonGroup),children:[p&&(0,a.jsx)(t.Button,{variant:"secondary",size:"base",className:(0,n.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",l?.secondaryButton),onClick:()=>x(v,"secondary"),disabled:!e.availableForSale&&v!=="learnMore",loading:D,"data-headless-type-name":"MediaShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${p}`,"data-headless-sku":e.sku,children:p}),y&&(0,a.jsx)(t.Button,{variant:"primary",size:"base",className:(0,n.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",l?.primaryButton),onClick:()=>x(h,"primary"),disabled:!e.availableForSale&&h!=="learnMore",loading:L,"data-headless-type-name":"MediaShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${y}`,"data-headless-sku":e.sku,children:y})]})]})]})]})});u.displayName="MediaShelf.ProductCard";var K=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var _=Object.create;var
|
|
1
|
+
"use strict";"use client";var _=Object.create;var x=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var a in t)x(e,a,{get:t[a],enumerable:!0})},z=(e,t,a,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of J(t))!Q.call(e,l)&&l!==a&&x(e,l,{get:()=>t[l],enumerable:!(d=G(t,l))||d.enumerable});return e};var A=(e,t,a)=>(a=e!=null?_(K(e)):{},z(t||!e||!e.__esModule?x(a,"default",{value:e,enumerable:!0}):a,e)),X=e=>z(x({},"__esModule",{value:!0}),e);var ae={};U(ae,{default:()=>ie,useMediaShelfContext:()=>Z});module.exports=X(ae);var o=require("react/jsx-runtime"),s=A(require("react")),p=require("../../helpers/index.js"),W=require("../../shared/Styles.js"),r=require("../../components/index.js"),M=require("swiper/react"),j=require("swiper/modules"),se=require("swiper/css"),le=require("swiper/css/navigation"),V=A(require("./ProductCard.js")),q=require("../../hooks/useExposure.js");const Y="shelf",ee="media_shelf",te=({disabled:e})=>(0,o.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[(0,o.jsx)("path",{d:"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z",fill:"currentColor",fillOpacity:e?"0.2":"0.6"}),(0,o.jsx)("path",{d:"M31 22L25 28L31 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),oe=({disabled:e})=>(0,o.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[(0,o.jsx)("path",{d:"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z",fill:"currentColor",fillOpacity:e?"0.2":"0.6"}),(0,o.jsx)("path",{d:"M25 22L31 28L25 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),I=s.createContext(null),Z=()=>{const e=s.useContext(I);if(!e)throw new Error("useMediaShelfContext must be used within an MediaShelfProvider");return e},R=s.forwardRef(({products:e,className:t},a)=>{const{copy:d,stockDisplayMode:l,stockThresholdValue:S,onLearnMore:c,onShopNow:v,onAddToCart:P,onProductImageClick:h,classNames:k,secondaryButtonText:B,primaryButtonText:D,secondaryButtonFun:L,primaryButtonFun:N,showOriginalPrice:E,showTags:F,showMemberPrice:H}=Z(),g=s.useId().replace(/:/g,""),C=`swiper-button-next-custom-${g}`,b=`swiper-button-prev-custom-${g}`,[u,w]=s.useState({isBeginning:!0,isEnd:!1}),y=s.useRef(null),T=s.useCallback(()=>{const n=y.current;if(!n?.slides||n.slides.length===0)return;n.slides.forEach(i=>{i.style.height="auto"});const m=Array.from(n.slides).map(i=>i.scrollHeight),f=Math.max(...m);f>0&&n.slides.forEach(i=>{i.style.height=`${f}px`})},[]);return s.useEffect(()=>{const n=()=>{requestAnimationFrame(T)};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[T]),e?.length===0?null:(0,o.jsx)("div",{ref:a,className:t,children:(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)(M.Swiper,{modules:[j.Navigation],spaceBetween:16,slidesPerView:"auto",navigation:{nextEl:`.${C}`,prevEl:`.${b}`},onSwiper:n=>{y.current=n,w({isBeginning:n.isBeginning,isEnd:n.isEnd}),setTimeout(T,100)},onSlideChange:n=>{w({isBeginning:n.isBeginning,isEnd:n.isEnd})},className:"!overflow-visible",breakpoints:{0:{spaceBetween:12,slidesPerView:1.2},768:{spaceBetween:12,slidesPerView:e.length<=2?2:2.3},1024:{spaceBetween:16,slidesPerView:Math.min(3,e.length)}},children:e.map((n,m)=>(0,o.jsx)(M.SwiperSlide,{className:"tablet:!max-w-[50%] overflow-hidden",children:(0,o.jsx)(V.default,{product:n,className:"box-border w-full max-w-full",stockDisplayMode:l,stockThresholdValue:S,onLearnMore:c,onShopNow:v,onAddToCart:P,onProductImageClick:h,classNames:k,secondaryButtonText:B,primaryButtonText:D,secondaryButtonFun:L,primaryButtonFun:N,showOriginalPrice:E,copy:d,showTags:F,showMemberPrice:H})},n.shopify_id+"-"+n.sku||m))}),(0,o.jsx)("button",{className:(0,p.cn)(`${b} tablet:block absolute left-4 top-1/2 z-10 hidden -translate-y-1/2`,{"tablet:hidden":e.length<=2,"laptop:hidden":e.length<=3}),"aria-label":d?.previousSlideLabel,disabled:u.isBeginning,children:(0,o.jsx)(te,{disabled:u.isBeginning})}),(0,o.jsx)("button",{className:(0,p.cn)(`${C} tablet:block absolute right-4 top-1/2 z-10 hidden -translate-y-1/2`,{"tablet:hidden":e.length<=2,"laptop:hidden":e.length<=3}),"aria-label":d?.nextSlideLabel,disabled:u.isEnd,children:(0,o.jsx)(oe,{disabled:u.isEnd})})]})})});R.displayName="ProductsList";const O=s.forwardRef(({className:e,data:t,onLearnMore:a,onShopNow:d,onAddToCart:l,onProductImageClick:S,classNames:c,...v},P)=>{const h=s.useRef(null);(0,q.useExposure)(h,{componentType:Y,componentName:ee,componentTitle:t.title,componentDescription:t.description}),s.useImperativeHandle(P,()=>h.current);const{theme:k="light",codeChannel:B,showMemberPrice:D=!0,showDiscount:L=!0,showTags:N=!0,stockDisplayMode:E,stockThresholdValue:F,showOriginalPrice:H=!0,secondaryButtonText:g,primaryButtonText:C,secondaryButtonFun:b,primaryButtonFun:u,isShowTab:w=!0,copy:y}=t,n={codeChannel:B,showMemberPrice:D,showDiscount:L,showTags:N,stockDisplayMode:E,stockThresholdValue:F,showOriginalPrice:H,onLearnMore:a,onShopNow:d,onAddToCart:l,onProductImageClick:S,classNames:c,secondaryButtonText:g,secondaryButtonFun:b,primaryButtonText:C,primaryButtonFun:u,copy:y||{}},m=t.productsTab&&t.productsTab.length>0,f=w&&m;return(0,o.jsx)(I.Provider,{value:n,children:(0,o.jsxs)("div",{ref:h,className:(0,p.cn)("w-full",{"aiui-dark":k==="dark"},e,c?.root),...v,children:[t.title&&(0,o.jsx)(r.Heading,{as:"h2",html:t.title,size:4,className:(0,p.cn)("text-info-primary mb-4",c?.title)}),t.description&&(0,o.jsx)(r.Text,{size:3,as:"p",html:t.description,className:(0,p.cn)("text-info-primary mb-6",c?.description)}),(0,o.jsxs)(r.Tabs,{defaultValue:t.productsTab?.[0]?.id,className:"w-full",children:[f&&(0,o.jsx)(r.TabsList,{className:"mb-6",children:t.productsTab?.map(i=>(0,o.jsx)(r.TabsTrigger,{value:i.id,children:i.tab},"tab-"+i.id))}),f?t.productsTab?.map(i=>(0,o.jsx)(r.TabsContent,{value:i.id,children:(0,o.jsx)(R,{products:i.data})},"tab-content-"+i.id)):(0,o.jsx)(R,{products:t.productsCard})]})]})})});O.displayName="MediaShelf";const $=O;$.ProductCard=V.default;const ne=(0,W.withLayout)($);var ie=ne;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var N=Object.create;var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},h=(t,e,n,
|
|
1
|
+
"use strict";"use client";var N=Object.create;var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},h=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!F.call(t,r)&&r!==n&&g(t,r,{get:()=>e[r],enumerable:!(s=D(e,r))||s.enumerable});return t};var U=(t,e,n)=>(n=t!=null?N(R(t)):{},h(e||!t||!t.__esModule?g(n,"default",{value:t,enumerable:!0}):n,t)),$=t=>h(g({},"__esModule",{value:!0}),t);var S={};L(S,{default:()=>z});module.exports=$(S);var i=require("react/jsx-runtime"),b=U(require("react")),m=require("../../helpers/index.js"),u=require("../../components/index.js"),v=require("../../shared/Styles.js"),B=require("../../helpers/index.js"),P=require("../AiuiProvider/index.js"),T=require("../../shared/trackUrlRef.js");const w="image",H="PromotionalBar",I=t=>{if(!t)return;const{mobile:e,tablet:n,laptop:s,desktop:r,lgDesktop:x}=t,o=[],p=M=>M?.url,a=p(x),l=p(r),c=p(s),d=p(n),f=p(e);return a?o.push(a):l?o.push(l):c?o.push(c):d?o.push(d):f&&o.push(f),l&&a&&o.push(`${l} 1920`),c&&(l||a)&&o.push(`${c} 1440`),d&&(c||l||a)&&o.push(`${d} 1024`),f&&(d||c||l||a)&&o.push(`${f} 768`),o.length>0?o.join(", "):void 0},k=b.forwardRef(({classNames:t,data:e,className:n,...s},r)=>{const{locale:x="us",pageHandle:o}=(0,P.useAiuiContext)(),{backgroundImage:p,theme:a="dark"}=e,l=b.useMemo(()=>I(p),[p]);return(0,i.jsx)("div",{ref:r,...s,className:(0,m.cn)("laptop:h-[192px] lg-desktop:h-[240px] h-[240px] text-[#080A0F]",{"text-[#F5F6F7]":a==="dark"},t?.root,n),children:(0,i.jsxs)("div",{className:"promotional-bar-content rounded-card relative h-full overflow-hidden",children:[(0,i.jsxs)("div",{className:(0,m.cn)("laptop:px-8 laptop:justify-center laptop:box-content lg-desktop:max-w-[686px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",t?.content),children:[e.contentTitle&&(0,i.jsx)(u.Heading,{className:(0,m.cn)("line-clamp-2 ",t?.title),html:e.contentTitle,size:3}),e.contentDesc&&(0,i.jsx)("p",{className:(0,m.cn)("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] ",t?.description),dangerouslySetInnerHTML:{__html:e.contentDesc}}),(0,i.jsx)("div",{className:"laptop:mt-4 mt-2",children:e.buttonText&&(0,i.jsx)(u.Button,{as:"a",variant:"link",className:(0,m.cn)("!p-0 text-[#F5F6F7]",{"text-[#080A0F]":a==="light"},t?.button),href:(0,T.trackUrlRef)((0,B.getLocalizedPath)(e.buttonLink||"",x),`${o}_${w}_${H}`),iconClassName:"size-4",children:e.buttonText})})]}),(0,i.jsx)(u.Picture,{source:l,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});k.displayName="PromotionalBar";var z=(0,v.withLayout)(k);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var j=Object.create;var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(t,
|
|
1
|
+
"use strict";"use client";var j=Object.create;var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(t,r)=>{for(var e in r)g(t,e,{get:r[e],enumerable:!0})},b=(t,r,e,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of O(r))!A.call(t,l)&&l!==e&&g(t,l,{get:()=>r[l],enumerable:!(m=D(r,l))||m.enumerable});return t};var I=(t,r,e)=>(e=t!=null?j(q(t)):{},b(r||!t||!t.__esModule?g(e,"default",{value:t,enumerable:!0}):e,t)),R=t=>b(g({},"__esModule",{value:!0}),t);var U={};H(U,{SceneProductCard:()=>x});module.exports=R(U);var a=require("react/jsx-runtime"),M=I(require("react")),i=require("../../helpers/index.js"),s=require("../../components/index.js"),k=require("./context.js"),C=require("../../shared/LocalizedLink.js");const x=M.forwardRef(({className:t,classNames:r,product:e,selected:m,onSelectChange:l,showTags:P,showOriginalPrice:u,onProductImageClick:N,...S},v)=>{const c=(0,k.useSceneShelfContext)(),w=P??c?.showTags??!0,y=u??c?.showOriginalPrice??!0,o=r??c?.classNames??{},p=m??(c?c.selectedIds.has(e.id):!1),h=l??c?.onSelectChange,f=N??c?.onProductImageClick,d=e.soldOut??!1,z=n=>{d||typeof n=="boolean"&&h?.(n,e)},T=()=>{d||h?.(!p,e)};return(0,a.jsxs)("div",{ref:v,className:(0,i.cn)("scene-shelf-product-card","lg-desktop:gap-2 lg-desktop:h-[362px] lg-desktop:px-6 lg-desktop:pb-6 lg-desktop:pt-4 rounded-box box-border flex h-[284px] flex-col justify-between gap-2 border-2 border-solid p-4 pb-6 transition-colors",d?"cursor-not-allowed opacity-50":"cursor-pointer",p?(0,i.cn)("border-brand-0 bg-container-secondary-0",o?.cardSelected):(0,i.cn)("border-lines bg-container-primary",!d&&"hover:bg-container-secondary",o?.card),t),onClick:T,"data-headless-type-name":"SceneShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name??e.title}##Select`,"data-headless-sku":e.id,...S,children:[(0,a.jsx)("div",{className:(0,i.cn)("scene-shelf-product-card-tags","lg-desktop:left-6 lg-desktop:top-6 flex max-h-[24px] min-h-[24px] flex-wrap gap-1 overflow-visible pr-9",o?.tags),children:w&&e.tags?.map((n,L)=>(0,a.jsx)(s.Badge,{variant:n.variant||"outline",size:"sm",className:"scene-shelf-product-card-badge",children:n.label},L))}),(0,a.jsx)(s.Checkbox,{checked:p,disabled:d,onCheckedChange:z,onClick:n=>n.stopPropagation(),className:(0,i.cn)("scene-shelf-product-card-checkbox","text-brand-0 border-brand-0 lg-desktop:right-6 lg-desktop:top-6 absolute right-4 top-4 size-5 shrink-0",o?.checkbox)}),(0,a.jsx)("div",{className:(0,i.cn)("flex flex-1 grow-0 items-center justify-center",o?.image),children:f?(0,a.jsx)("a",{onClick:()=>f(e),role:"button",children:(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?(0,a.jsx)(C.LocalizedLink,{href:e.href,children:(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),(0,a.jsxs)("div",{className:"flex grow flex-col justify-start gap-4",children:[(0,a.jsx)(s.Heading,{as:"h3",size:2,className:(0,i.cn)("text-info-primary line-clamp-2 h-[2.2em]",o?.title),html:e.custom_name??e.title}),(0,a.jsxs)("div",{className:(0,i.cn)("flex flex-wrap items-center gap-1",o?.priceWrapper),children:[(0,a.jsx)(s.Text,{as:"span",size:2,className:(0,i.cn)("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",o?.currentPrice),children:e.currentPrice.formatted}),y&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&(0,a.jsx)(s.Text,{as:"span",size:2,className:(0,i.cn)("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",o?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&(0,a.jsx)(s.Text,{size:4,className:(0,i.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",o?.productPriceLabel),children:e.priceLabel})]})]})});x.displayName="SceneShelf.ProductCard";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var pt=Object.create;var w=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty;var wt=(t,n)=>{for(var e in n)w(t,e,{get:n[e],enumerable:!0})},S=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ht(n))!xt.call(t,r)&&r!==e&&w(t,r,{get:()=>n[r],enumerable:!(o=ft(n,r))||o.enumerable});return t};var bt=(t,n,e)=>(e=t!=null?pt(gt(t)):{},S(n||!t||!t.__esModule?w(e,"default",{value:t,enumerable:!0}):e,t)),yt=t=>S(w({},"__esModule",{value:!0}),t);var Ft={};wt(Ft,{default:()=>Lt});module.exports=yt(Ft);var i=require("react/jsx-runtime"),a=bt(require("react")),b=require("gsap"),F=require("gsap/dist/SplitText"),H=require("gsap/dist/ScrollTrigger"),l=require("../../helpers/utils.js"),C=require("class-variance-authority"),d=require("../../components/index.js"),O=require("../../shared/Styles.js"),U=require("../AiuiProvider/index.js"),W=require("@payloadcms/richtext-lexical/plaintext"),Z=require("../../shared/trackUrlRef.js"),q=require("react-intersection-observer");const $="link",_="title";function vt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const n=t?.root?.children;return!Array.isArray(n)||n.length===0?!1:n.some(e=>{const o=e?.children;return!Array.isArray(o)||o.length===0?!1:o.some(r=>typeof r?.text=="string"&&r.text.length>0)})}function B(t){if(!t)return"";if(typeof t=="string")return t;try{return(0,W.convertLexicalToPlaintext)({data:t})||""}catch{return""}}const kt=(0,C.cva)("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),Tt=(0,C.cva)("desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),I=({data:t,onClick:n,className:e})=>{const{theme:o="light",extensions:r,title:h,caption:y,align:g}=t,{locale:v="us"}=(0,U.useAiuiContext)();if(!r?.textLink)return null;const u=r?.link?(0,Z.trackUrlRef)((0,l.getLocalizedPath)(r.link,v),`${$}_${_}`):void 0;return(0,i.jsxs)("a",{className:(0,l.cn)({"aiui-dark":o==="dark"},"hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":o==="light"},{"text-[#F5F6F7]":o==="dark"},{"justify-center mt-4":g==="center"},{"mt-1 laptop:mt-0":g==="left"},e),...u?{href:u}:{},"data-headless-type-name":`${$}#${_}`,"data-headless-title-desc-button":`${B(h)}#${B(y)}`,...n?{onClick:n}:{},children:[(0,i.jsx)("div",{className:"truncate whitespace-nowrap",children:r?.textLink}),(0,i.jsx)("div",{className:"lg-desktop:size-5 size-4",children:(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:(0,i.jsx)("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:o==="dark"?"#F5F6F7":"#080A0F",className:"transition-all duration-[0.4s]"})})})]})},j=a.default.forwardRef(({data:t,className:n,classNames:e,as:o="h2",weight:r="bold",onButtonClick:h,id:y,...g},v)=>{const{title:u,titleSize:G=4,caption:D,subtitle:M,content:z,countdown:s,showCountdown:J=!1,theme:x="light",extensions:E,align:m="left"}=t,P=(0,a.useRef)(null),p=(0,a.useRef)(null),c=(0,a.useRef)(null),f=(0,a.useRef)(null),[K,Q]=(0,a.useState)(!0),{ref:X,inView:R}=(0,q.useInView)();(0,a.useImperativeHandle)(v,()=>P.current);const Y=()=>{Q(!1)},tt=s?.targetDateTime||s?.targetDate||"",et=s?.targetDateTime_tz,nt=s?.labels?{day:s.labels.days||"Day",hour:s.labels.hours||"Hours",minute:s.labels.minutes||"Mins",second:s.labels.seconds||"Secs"}:void 0;return(0,a.useEffect)(()=>{b.gsap.registerPlugin(F.SplitText,H.ScrollTrigger);function rt(){if(!p.current)return;const it=p.current?.clientHeight||80;c.current&&c.current.revert(),f.current&&f.current.kill(),c.current=new F.SplitText(p.current,{type:"words",wordsClass:"word"});const k=c.current.words;b.gsap.set(k,{opacity:0}),f.current=H.ScrollTrigger.create({trigger:p.current,start:"bottom bottom-=4%",end:`bottom+=${it*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:ot=>{const st=ot.progress,A=k.length||1,at=.5,T=1/A,V=T*(1-at),N=(A-1)*V+T,lt=Math.min(1,N>0?st/N:0);k.forEach((dt,ct)=>{const ut=ct*V,mt=T;let L=(lt-ut)/mt;L=Math.max(0,Math.min(1,L)),b.gsap.set(dt,{opacity:L})})}})}return R&&rt(),()=>{c.current&&c.current.revert(),f.current&&f.current.kill()}},[R]),(0,i.jsxs)("div",{id:E?.id?E?.id:y,className:(0,l.cn)("titleBottom title-box flex items-end justify-between gap-2 pb-6",n,e?.wrapper),...g,ref:P,children:[(0,i.jsxs)("div",{ref:X,className:(0,l.cn)("flex-1",e?.container,{"aiui-dark":x==="dark","text-center":m==="center","text-left":m==="left"}),children:[(D||u)&&(0,i.jsx)(d.Heading,{ref:p,as:o,size:G,html:D||u,weight:r,className:(0,l.cn)(kt({theme:x}),e?.title)}),M&&(0,i.jsx)(d.Text,{html:M,as:"div",className:(0,l.cn)(Tt({theme:x}),e?.subtitle)}),vt(z)&&(0,i.jsx)(d.Text,{html:z,as:"div",size:4,className:(0,l.cn)("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",e?.content)}),(0,i.jsx)(I,{data:t,className:(0,l.cn)({"laptop:hidden":m==="left"},e?.button),onClick:h}),J&&s&&K&&(0,i.jsx)(d.Countdown,{endDate:tt,endDate_tz:et,timeLabels:nt,showDays:s?.showDays,showHours:s?.showHours,showMinutes:s?.showMinutes,showSeconds:s?.showSeconds,theme:x,onExpire:Y,hideWhenExpired:!0,align:m==="center"?"center":"left",className:(0,l.cn)("mt-4",e?.countdown)})]}),(0,i.jsx)(I,{data:t,className:(0,l.cn)("hidden",{"laptop:flex":m==="left"},e?.button),onClick:h})]})});j.displayName="Title";var Lt=(0,O.withLayout)(j);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 物料推导模块 — 断点判定单点(ADR 0008 / 0010)
|
|
3
|
+
*
|
|
4
|
+
* 全仓唯一实现「哪个字段是哪端媒体」的判定知识:
|
|
5
|
+
* - 5 端断点词表(与 Tailwind screens 对齐)
|
|
6
|
+
* - 媒体字段宽判定(isMediaField,预览回填视角,含语义媒体)
|
|
7
|
+
* - 生成范围窄判定(classifyMediaField,discriminated result)
|
|
8
|
+
* - 字段 → 断点判定(canonical 5 端 + legacy alias 表 + 裸 image 语义翻转)
|
|
9
|
+
* - Tailwind aspect 类级联解析(移动优先:无前缀 = 基线并向上继承)
|
|
10
|
+
*
|
|
11
|
+
* 纯 TypeScript,无 React / DOM 依赖——供 playground 与外部 Bun agent
|
|
12
|
+
* repo(type-only)共同消费。禁止在本模块引入任何运行时环境假设。
|
|
13
|
+
*/
|
|
14
|
+
export type Breakpoint = 'mobile' | 'tablet' | 'laptop' | 'desktop' | 'lg-desktop';
|
|
15
|
+
/** canonical 5 端断点阶梯(与 tailwind.config.js screens 对齐)。 */
|
|
16
|
+
export declare const BREAKPOINTS: readonly Breakpoint[];
|
|
17
|
+
export type MediaFamily = 'image' | 'video' | 'poster';
|
|
18
|
+
export interface MaterialSize {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}
|
|
22
|
+
export type AspectCascade = Partial<Record<Breakpoint, MaterialSize>>;
|
|
23
|
+
/**
|
|
24
|
+
* 宽判定:字段名是否承载媒体引用(预览回填视角)。
|
|
25
|
+
*
|
|
26
|
+
* 语义媒体、嵌套对象族主名(backgroundImage)、嵌套裸断点键(mobile)
|
|
27
|
+
* 均返回 true——预览解析宁可多识别也不丢图(2026-09-09 缺图事故教训)。
|
|
28
|
+
* 断点归属判定请用 classifyMediaField / breakpointOfField。
|
|
29
|
+
*/
|
|
30
|
+
export declare function isMediaField(name: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* canonical 媒体字段名形态:{断点前缀}{族名},如 image / tabletImage /
|
|
33
|
+
* laptopVideo / lgDesktopPoster。裸族名 = mobile 基线(ADR 0010 决策 1)。
|
|
34
|
+
*/
|
|
35
|
+
export declare function isCanonicalMediaFieldName(name: string): boolean;
|
|
36
|
+
/** 裸 image 的两种语义(ADR 0010 决策 2 语义翻转警告)。 */
|
|
37
|
+
export type BareImageSemantics = 'mobile' | 'desktop';
|
|
38
|
+
export interface BreakpointOfFieldOptions {
|
|
39
|
+
/**
|
|
40
|
+
* 裸 image/video/poster 的断点归属:
|
|
41
|
+
* - 'mobile'(默认,canonical 语义):无前缀 = 移动优先基线
|
|
42
|
+
* - 'desktop'(legacy 语义):旧约定裸 image = 桌面母图
|
|
43
|
+
* 显式断点前缀字段(tabletImage 等)不受此选项影响。
|
|
44
|
+
*/
|
|
45
|
+
legacyBareImage?: BareImageSemantics;
|
|
46
|
+
}
|
|
47
|
+
/** 断点判定的结构化未命中结果(显式降级数据,禁止裸 null)。 */
|
|
48
|
+
export interface UnrecognizedField {
|
|
49
|
+
breakpoint: null;
|
|
50
|
+
field: string;
|
|
51
|
+
reason: string;
|
|
52
|
+
}
|
|
53
|
+
export type BreakpointResult = Breakpoint | UnrecognizedField;
|
|
54
|
+
/**
|
|
55
|
+
* 字段 → 断点判定(全仓单点)。
|
|
56
|
+
*
|
|
57
|
+
* 判定次序:canonical 5 端 → legacy alias → 结构化未命中。
|
|
58
|
+
* 字段路径(items[].image)取末段 bare name 判定。
|
|
59
|
+
* 语义媒体(icon 等)无断点概念,返回结构化未命中。
|
|
60
|
+
*/
|
|
61
|
+
export declare function breakpointOfField(field: string, options?: BreakpointOfFieldOptions): BreakpointResult;
|
|
62
|
+
export type MediaFieldClassification = {
|
|
63
|
+
kind: 'responsive-hero-media';
|
|
64
|
+
breakpoint: Breakpoint;
|
|
65
|
+
family: MediaFamily;
|
|
66
|
+
} | {
|
|
67
|
+
kind: 'semantic-media';
|
|
68
|
+
reason: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'not-a-media-field';
|
|
71
|
+
} | {
|
|
72
|
+
kind: 'unrecognized-media-field';
|
|
73
|
+
reason: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 窄判定:字段是否属于物料生成范围(生成视角)。
|
|
77
|
+
*
|
|
78
|
+
* 与宽判定(isMediaField)的二分(CONTEXT.md「主视觉媒体 vs 语义媒体」):
|
|
79
|
+
* - responsive-hero-media:参与断点族的主视觉大图,可生成
|
|
80
|
+
* - semantic-media:icon/avatar/video 等,默认排除并给出 opt-in 提示
|
|
81
|
+
* - not-a-media-field:非媒体
|
|
82
|
+
* - unrecognized-media-field:媒体但判不出断点(fieldMap 领地)
|
|
83
|
+
*/
|
|
84
|
+
export declare function classifyMediaField(field: string): MediaFieldClassification;
|
|
85
|
+
/**
|
|
86
|
+
* 解析 Tailwind aspect 类 → 各断点显示尺寸(移动优先级联)。
|
|
87
|
+
*
|
|
88
|
+
* 语义(修正现存「无前缀误判为 mobile-only」缺陷):
|
|
89
|
+
* - 无前缀 = 基线,被所有断点继承
|
|
90
|
+
* - 前缀类从其断点起向上覆盖,直到更具体的前缀出现
|
|
91
|
+
* - 某断点存在多个值时取面积最大者(大屏档保真)
|
|
92
|
+
*
|
|
93
|
+
* 支持两种语法:arbitrary `aspect-[W/H]` 与插件
|
|
94
|
+
* `aspect-w-[W] aspect-h-[H]`(@tailwindcss/aspect-ratio)。
|
|
95
|
+
* aspect-auto / aspect-square / aspect-1 等普通比例类不解析。
|
|
96
|
+
*/
|
|
97
|
+
export declare function parseAspectCascade(classNames: string[]): AspectCascade;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var i in t)l(e,i,{get:t[i],enumerable:!0})},C=(e,t,i,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of M(t))!R.call(e,o)&&o!==i&&l(e,o,{get:()=>t[o],enumerable:!(a=E(t,o))||a.enumerable});return e};var _=e=>C(l({},"__esModule",{value:!0}),e);var D={};S(D,{BREAKPOINTS:()=>A,breakpointOfField:()=>v,classifyMediaField:()=>w,isCanonicalMediaFieldName:()=>O,isMediaField:()=>x,parseAspectCascade:()=>L});module.exports=_(D);const A=["mobile","tablet","laptop","desktop","lg-desktop"],p=new Set(["icon","activeIcon","inactiveIcon","titleIcon","iconImage","pictureImage","avatar","logo","thumbnail","cover"]),B=new Set(Array.from(p).concat(["image","mobileImage","padImage","mobImage","pcImage","imageUrl","mobImageUrl","img","imgUrl","video","padVideo","mobVideo","pcVideo","mobileVideo","videoUrl","mobVideoUrl","poster","mobPoster","padPoster","media","mobMedia","subtitleImage","backgroundImage","mobile","tablet","laptop","desktop","lgDesktop"])),F=/(image|img|video|poster|media|icon|avatar|logo|cover|thumbnail|picture)/i;function x(e){return B.has(e)?!0:F.test(e)}const N={"":"mobile",tablet:"tablet",laptop:"laptop",desktop:"desktop",lgDesktop:"lg-desktop"},m=["lgDesktop","tablet","laptop","desktop"],s=["image","video","poster"];function O(e){for(const t of m)if(e.startsWith(t)){const i=e.slice(t.length);if(i.length>0&&i[0]===i[0].toUpperCase()){const a=i[0].toLowerCase()+i.slice(1);return s.includes(a)}}return s.includes(e)}function g(e){for(const t of m)if(e.startsWith(t)){const i=e.slice(t.length);if(i.length>0&&i[0]===i[0].toUpperCase()){const a=i[0].toLowerCase()+i.slice(1);if(s.includes(a))return{breakpoint:N[t],family:a}}}return s.includes(e)?{breakpoint:"mobile",family:e}:null}const b={padImage:"tablet",padImageUrl:"tablet",padVideo:"tablet",padPoster:"tablet",mobImage:"mobile",mobImageUrl:"mobile",mobVideo:"mobile",mobVideoUrl:"mobile",mobPoster:"mobile",pcImage:"desktop",pcImageUrl:"desktop",pcVideo:"desktop",mobileImage:"mobile",mobileVideo:"mobile",imageUrl:"desktop",videoUrl:"desktop"},k="\u672A\u547D\u4E2D\u7EA6\u5B9A\uFF1A\u5B57\u6BB5\u540D\u4E0D\u542B\u53EF\u8BC6\u522B\u7684\u65AD\u70B9\u8BCD\u6839\uFF08canonical 5 \u7AEF\u6216 legacy alias\uFF09\uFF0C\u9700 MaterialMeta fieldMap \u663E\u5F0F\u58F0\u660E\u6620\u5C04";function U(e){return{breakpoint:null,field:e,reason:k}}function v(e,t={}){const i=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e,a=t.legacyBareImage??"mobile",o=g(i);if(o)return o.breakpoint==="mobile"&&a==="desktop"?"desktop":o.breakpoint;const n=b[i];return n||U(e)}const f="video \u5B57\u6BB5\u4E0D\u53C2\u4E0E\u7269\u6599\u751F\u6210\uFF08ADR 0008 \u8303\u56F4\u95F8\u95E8\uFF09\uFF0C\u5982\u9700\u751F\u6210\u8BF7\u7ECF meta mediaRole \u663E\u5F0F opt-in",P="\u8BED\u4E49\u5A92\u4F53\uFF08icon/avatar \u7C7B\u5355\u5C3A\u5BF8\u5C0F\u56FE\uFF09\u9ED8\u8BA4\u6392\u9664\u751F\u6210\uFF0C\u9700 meta mediaRole opt-in";function w(e){const t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;if(!x(t))return{kind:"not-a-media-field"};if(p.has(t))return{kind:"semantic-media",reason:P};const i=g(t);if(i)return i.family==="video"?{kind:"semantic-media",reason:f}:{kind:"responsive-hero-media",breakpoint:i.breakpoint,family:i.family};const a=b[t];if(a){if(/(video)/i.test(t))return{kind:"semantic-media",reason:f};const o=/poster/i.test(t)?"poster":"image";return{kind:"responsive-hero-media",breakpoint:a,family:o}}return{kind:"unrecognized-media-field",reason:k}}const T={"":"mobile","md:":"tablet","tablet:":"tablet","laptop:":"laptop","desktop:":"desktop","lg-desktop:":"lg-desktop","min-xxl:":"lg-desktop","xxl:":"lg-desktop"},u=/(?:^|\s)((?:[a-z-]+:)?aspect-\[(\d+)\/(\d+)\])(?=\s|$)/g,I=/(?:^|\s)((?:[a-z-]+:)?aspect-w-\[(\d+)\])(?=\s|$)/g,h=/(?:^|\s)((?:[a-z-]+:)?aspect-h-\[(\d+)\])(?=\s|$)/g;function c(e){const t=e.indexOf(":");return t===-1?"":e.slice(0,t+1)}function y(e){const t=c(e);return T[t]??"mobile"}function z(e,t){const i=new Map;let a;for(h.lastIndex=0;(a=h.exec(e))!==null;)i.set(c(a[1]),Number(a[2]));I.lastIndex=0;let o;for(;(o=I.exec(e))!==null;){const r=c(o[1]),d=i.get(r);d!==void 0&&t.push({breakpoint:y(o[1]),width:Number(o[2]),height:d})}u.lastIndex=0;let n;for(;(n=u.exec(e))!==null;)t.push({breakpoint:y(n[1]),width:Number(n[2]),height:Number(n[3])})}function L(e){const t=[];for(const n of e)z(n,t);const i={};for(const n of t){const r=i[n.breakpoint];(!r||n.width*n.height>r.width*r.height)&&(i[n.breakpoint]={width:n.width,height:n.height})}const a={};let o;for(const n of A){const r=i[n];r&&(o=r),o&&(a[n]={...o})}return a}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* material-generate 请求 contract — BFF ↔ agent 双端 SSOT(ADR 0008 / ticket 06)
|
|
3
|
+
*
|
|
4
|
+
* playground BFF(apps/playground/app/api/ai-gen/material-generate/route.ts)
|
|
5
|
+
* 出站 agentBody 与 ai-gen agent(/internal/ai-gen/material-generate,
|
|
6
|
+
* src/ai-gen/plugin.ts handleMaterialGenerate → material.ts GenerateMaterialArgs)
|
|
7
|
+
* 入站之间的传输契约。此前这 13 个键只活在 BFF route 代码里(漂移风险),
|
|
8
|
+
* 现以 zod schema 单点定义于组件库,双端各挂 contract test 守门:任一端
|
|
9
|
+
* 漂移 → 各自 CI 红,而非运行时事故。
|
|
10
|
+
*
|
|
11
|
+
* 校验范围刻意只到「传输形状」:类型 / 必填 / count 限额(双端硬编码 1-4)。
|
|
12
|
+
* 16 整除、短边 ≥672 等生图业务硬约束仍由 agent 侧 validateGenerateSize
|
|
13
|
+
* 负责(那是生成 API 的领域规则,不属于传输契约)。
|
|
14
|
+
*
|
|
15
|
+
* 版本兼容策略(MATERIAL_CONTRACT_VERSION):
|
|
16
|
+
* - 新增可选字段 = 兼容——schema 默认忽略未知键(非 strict),旧消费方
|
|
17
|
+
* safeParse 新载荷仍通过(未知键被剥离),新消费方解析旧载荷亦通过;
|
|
18
|
+
* - 改名 / 删除 / 收紧既有字段约束 / 必填化 = 破坏性——须升版本号并
|
|
19
|
+
* 协调发版:组件库先发版(schema 变红守门),playground BFF 与
|
|
20
|
+
* ai-gen 各自升级 devDep 后再部署,禁止单端先行;
|
|
21
|
+
* - 详见 docs/adr/0008 Consequences。
|
|
22
|
+
*
|
|
23
|
+
* promptHints 刻意收窄为 string:agent 侧 typeof 守卫会静默丢弃非 string
|
|
24
|
+
* 值(MaterialMeta 允许 string[]),若未来 meta 演进为数组形态,BFF 必须
|
|
25
|
+
* 先 join() 再出站——本 schema 会强制这个决策显式发生而不是静默丢数据。
|
|
26
|
+
*
|
|
27
|
+
* 纯 TypeScript,无 React / DOM 依赖(与 breakpoints.ts / material-meta.ts
|
|
28
|
+
* 同一模块纪律),供 playground(jest/CJS)与外部 Bun agent repo 共同消费。
|
|
29
|
+
*/
|
|
30
|
+
import { z } from 'zod';
|
|
31
|
+
/** contract 语义版本:破坏性变更时 +1,用于双端漂移协商(见文件头)。 */
|
|
32
|
+
export declare const MATERIAL_CONTRACT_VERSION = 1;
|
|
33
|
+
/**
|
|
34
|
+
* agentBody 的 13 个键(与 BFF route 的 agentBody 组装、agent 侧
|
|
35
|
+
* handleMaterialGenerate 的入参读取一一对应)。satisfies 保证该字面量
|
|
36
|
+
* 与 schema 推断类型不可漂移。
|
|
37
|
+
*/
|
|
38
|
+
export declare const MATERIAL_GENERATE_REQUEST_KEYS: readonly ["intent", "component", "field", "generateWidth", "generateHeight", "count", "safeZone", "imageryStyle", "promptHints", "aspect", "brand", "theme", "promptOverride"];
|
|
39
|
+
/**
|
|
40
|
+
* material-generate 出站请求 schema(非 strict:未知键忽略,保证
|
|
41
|
+
* 「新增可选字段 = 兼容」的演进策略,见文件头)。
|
|
42
|
+
*/
|
|
43
|
+
export declare const materialGenerateRequestSchema: z.ZodObject<{
|
|
44
|
+
intent: z.ZodString;
|
|
45
|
+
component: z.ZodString;
|
|
46
|
+
field: z.ZodString;
|
|
47
|
+
generateWidth: z.ZodNumber;
|
|
48
|
+
generateHeight: z.ZodNumber;
|
|
49
|
+
count: z.ZodNumber;
|
|
50
|
+
safeZone: z.ZodOptional<z.ZodString>;
|
|
51
|
+
imageryStyle: z.ZodOptional<z.ZodString>;
|
|
52
|
+
promptHints: z.ZodOptional<z.ZodString>;
|
|
53
|
+
aspect: z.ZodString;
|
|
54
|
+
brand: z.ZodOptional<z.ZodString>;
|
|
55
|
+
theme: z.ZodOptional<z.ZodString>;
|
|
56
|
+
promptOverride: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type MaterialGenerateRequest = z.infer<typeof materialGenerateRequestSchema>;
|
|
59
|
+
export type MaterialGenerateRequestResult = {
|
|
60
|
+
ok: true;
|
|
61
|
+
data: MaterialGenerateRequest;
|
|
62
|
+
} | {
|
|
63
|
+
ok: false;
|
|
64
|
+
errors: string[];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* agentBody 运行时校验(BFF 出站前调用;agent 侧 contract test 同源消费)。
|
|
68
|
+
*
|
|
69
|
+
* 失败返回结构化 errors(可读的 `path: message` 列表),供 4xx 响应体
|
|
70
|
+
* 与显式降级链路透传;成功返回归一后的数据(未知键被剥离)。
|
|
71
|
+
*/
|
|
72
|
+
export declare function validateMaterialGenerateRequest(raw: unknown): MaterialGenerateRequestResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(r,t)=>{for(var a in t)i(r,a,{get:t[a],enumerable:!0})},u=(r,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!g.call(r,n)&&n!==a&&i(r,n,{get:()=>t[n],enumerable:!(o=p(t,n))||o.enumerable});return r};var c=r=>u(i({},"__esModule",{value:!0}),r);var y={};l(y,{MATERIAL_CONTRACT_VERSION:()=>f,MATERIAL_GENERATE_REQUEST_KEYS:()=>R,materialGenerateRequestSchema:()=>s,validateMaterialGenerateRequest:()=>d});module.exports=c(y);var e=require("zod");const f=1,R=["intent","component","field","generateWidth","generateHeight","count","safeZone","imageryStyle","promptHints","aspect","brand","theme","promptOverride"],s=e.z.object({intent:e.z.string().min(1),component:e.z.string().min(1),field:e.z.string().min(1),generateWidth:e.z.number().int().positive().finite(),generateHeight:e.z.number().int().positive().finite(),count:e.z.number().int().min(1).max(4),safeZone:e.z.string().optional(),imageryStyle:e.z.string().optional(),promptHints:e.z.string().optional(),aspect:e.z.string().min(1),brand:e.z.string().optional(),theme:e.z.string().optional(),promptOverride:e.z.string().optional()});function d(r){const t=s.safeParse(r);return t.success?{ok:!0,data:t.data}:{ok:!1,errors:t.error.issues.map(h)}}function h(r){return`${r.path.length>0?r.path.map(String).join("."):"(root)"}: ${r.message}`}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 物料推导模块公共入口(@anker-in/headless-ui/material)
|
|
3
|
+
*
|
|
4
|
+
* 消费方:
|
|
5
|
+
* - playground derive 管线:classifyMediaField / breakpointOfField /
|
|
6
|
+
* parseAspectCascade / materialMetaSchema
|
|
7
|
+
* - 预览回填:isMediaField(宽判定)
|
|
8
|
+
* - lint 规则:isCanonicalMediaFieldName
|
|
9
|
+
* - contract 导出:zod schemas(双端守门)——material-meta schema(声明层)
|
|
10
|
+
* 与 material-generate 请求 schema(BFF ↔ agent 传输层,ticket 06)
|
|
11
|
+
*/
|
|
12
|
+
export { BREAKPOINTS, isMediaField, isCanonicalMediaFieldName, classifyMediaField, breakpointOfField, parseAspectCascade, } from './breakpoints.js';
|
|
13
|
+
export type { Breakpoint, MediaFamily, MaterialSize, AspectCascade, MediaFieldClassification, BareImageSemantics, BreakpointOfFieldOptions, BreakpointResult, UnrecognizedField, } from './breakpoints.js';
|
|
14
|
+
export { materialMetaSchema, validateMaterialMeta } from './material-meta.js';
|
|
15
|
+
export type { MaterialMeta, MaterialMetaFieldMap, MaterialMetaFallbackSizes, MaterialMetaPromptHints, MaterialMetaMediaRole, MaterialMetaResult, } from './material-meta.js';
|
|
16
|
+
export { MATERIAL_CONTRACT_VERSION, MATERIAL_GENERATE_REQUEST_KEYS, materialGenerateRequestSchema, validateMaterialGenerateRequest, } from './contract.js';
|
|
17
|
+
export type { MaterialGenerateRequest, MaterialGenerateRequestResult } from './contract.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var m=(i,a)=>{for(var l in a)s(i,l,{get:a[l],enumerable:!0})},R=(i,a,l,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of d(a))!n.call(i,r)&&r!==l&&s(i,r,{get:()=>a[r],enumerable:!(o=p(a,r))||o.enumerable});return i};var c=i=>R(s({},"__esModule",{value:!0}),i);var f={};m(f,{BREAKPOINTS:()=>e.BREAKPOINTS,MATERIAL_CONTRACT_VERSION:()=>t.MATERIAL_CONTRACT_VERSION,MATERIAL_GENERATE_REQUEST_KEYS:()=>t.MATERIAL_GENERATE_REQUEST_KEYS,breakpointOfField:()=>e.breakpointOfField,classifyMediaField:()=>e.classifyMediaField,isCanonicalMediaFieldName:()=>e.isCanonicalMediaFieldName,isMediaField:()=>e.isMediaField,materialGenerateRequestSchema:()=>t.materialGenerateRequestSchema,materialMetaSchema:()=>M.materialMetaSchema,parseAspectCascade:()=>e.parseAspectCascade,validateMaterialGenerateRequest:()=>t.validateMaterialGenerateRequest,validateMaterialMeta:()=>M.validateMaterialMeta});module.exports=c(f);var e=require("./breakpoints.js"),M=require("./material-meta.js"),t=require("./contract.js");
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MaterialMeta zod schema — 声明层 contract SSOT(ADR 0008 / 0009)
|
|
3
|
+
*
|
|
4
|
+
* 3 个存量 material-meta.json(Ksp / ImageWithText / ThreeDCarousel)的
|
|
5
|
+
* 超集:兼容存量 generatable/promptHints(string)/sizeSource 字段,新增
|
|
6
|
+
* generativeFields / fieldMap / 5 端 fallbackSizes / promptHints(string[])
|
|
7
|
+
* / mediaRole opt-in。playground BFF 与 ai-gen agent 双端消费同一 schema
|
|
8
|
+
* 守门(contract test),schema 漂移在 CI 变红而非运行时事故。
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { BREAKPOINTS } from './breakpoints.js';
|
|
12
|
+
import type { Breakpoint, MaterialSize } from './breakpoints.js';
|
|
13
|
+
export declare const materialMetaSchema: z.ZodObject<{
|
|
14
|
+
component: z.ZodString;
|
|
15
|
+
generativeFields: z.ZodArray<z.ZodString>;
|
|
16
|
+
fieldMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
17
|
+
mobile: "mobile";
|
|
18
|
+
tablet: "tablet";
|
|
19
|
+
laptop: "laptop";
|
|
20
|
+
desktop: "desktop";
|
|
21
|
+
"lg-desktop": "lg-desktop";
|
|
22
|
+
}>>>;
|
|
23
|
+
fallbackSizes: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
mobile: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
width: z.ZodNumber;
|
|
26
|
+
height: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
tablet: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
width: z.ZodNumber;
|
|
30
|
+
height: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
laptop: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
width: z.ZodNumber;
|
|
34
|
+
height: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
desktop: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
width: z.ZodNumber;
|
|
38
|
+
height: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
'lg-desktop': z.ZodOptional<z.ZodObject<{
|
|
41
|
+
width: z.ZodNumber;
|
|
42
|
+
height: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
safeZone: z.ZodString;
|
|
46
|
+
imageryStyle: z.ZodEnum<{
|
|
47
|
+
"use-case-scene": "use-case-scene";
|
|
48
|
+
"pure-product": "pure-product";
|
|
49
|
+
}>;
|
|
50
|
+
promptHints: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
51
|
+
mediaRole: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
52
|
+
generatable: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
sizeSource: z.ZodOptional<z.ZodLiteral<"code-aspect">>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type MaterialMeta = z.infer<typeof materialMetaSchema>;
|
|
56
|
+
export type MaterialMetaFieldMap = Record<string, Breakpoint>;
|
|
57
|
+
export type MaterialMetaFallbackSizes = Partial<Record<Breakpoint, MaterialSize>>;
|
|
58
|
+
export type MaterialMetaPromptHints = string | string[];
|
|
59
|
+
export type MaterialMetaMediaRole = Record<string, string>;
|
|
60
|
+
export type MaterialMetaResult = {
|
|
61
|
+
ok: true;
|
|
62
|
+
data: MaterialMeta;
|
|
63
|
+
} | {
|
|
64
|
+
ok: false;
|
|
65
|
+
errors: string[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* material-meta.json 运行时校验。
|
|
69
|
+
*
|
|
70
|
+
* 与存量 validateMaterialMeta(返回裸 null)不同,失败返回结构化
|
|
71
|
+
* errors 数组(可读错误信息),供显式降级链路透传到 UI。
|
|
72
|
+
* 存量字段(generatable/sizeSource)校验通过后归一到新形态
|
|
73
|
+
* (generativeFields)。
|
|
74
|
+
*/
|
|
75
|
+
export declare function validateMaterialMeta(raw: unknown): MaterialMetaResult;
|
|
76
|
+
export { BREAKPOINTS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(t,a)=>{for(var r in a)s(t,r,{get:a[r],enumerable:!0})},f=(t,a,r,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of d(a))!g.call(t,o)&&o!==r&&s(t,o,{get:()=>a[o],enumerable:!(p=m(a,o))||p.enumerable});return t};var M=t=>f(s({},"__esModule",{value:!0}),t);var v={};u(v,{BREAKPOINTS:()=>l.BREAKPOINTS,materialMetaSchema:()=>c,validateMaterialMeta:()=>R});module.exports=M(v);var e=require("zod"),l=require("./breakpoints.js");const k=e.z.enum(["mobile","tablet","laptop","desktop","lg-desktop"]),i=e.z.object({width:e.z.number().positive().finite(),height:e.z.number().positive().finite()}),n=e.z.string().min(1),S=e.z.union([e.z.string().min(1),e.z.array(e.z.string().min(1)).min(1)]),y=e.z.object({mobile:i.optional(),tablet:i.optional(),laptop:i.optional(),desktop:i.optional(),"lg-desktop":i.optional()}).refine(t=>Object.values(t).some(a=>a!==void 0),{message:"fallbackSizes \u81F3\u5C11\u5305\u542B\u4E00\u4E2A\u65AD\u70B9\u7684\u5C3A\u5BF8"}),b=e.z.record(n,k),h=e.z.record(n,e.z.string().min(1)),z=e.z.enum(["use-case-scene","pure-product"]),c=e.z.object({component:e.z.string().min(1),generativeFields:e.z.array(n).min(1),fieldMap:b.optional(),fallbackSizes:y.optional(),safeZone:e.z.string().min(1),imageryStyle:z,promptHints:S.optional(),mediaRole:h.optional(),generatable:e.z.array(n).min(1).optional(),sizeSource:e.z.literal("code-aspect").optional()});function R(t){const a=x(t),r=c.safeParse(a);return r.success?{ok:!0,data:r.data}:{ok:!1,errors:r.error.issues.map(j)}}function x(t){if(typeof t!="object"||t===null)return{};const a=t,r={...a};return!r.generativeFields&&Array.isArray(a.generatable)&&(r.generativeFields=a.generatable),r}function j(t){return`${t.path.length>0?t.path.map(String).join("."):"(root)"}: ${t.message}`}
|
|
@@ -168,6 +168,8 @@ export interface ProductCardProps {
|
|
|
168
168
|
customTagsIcon?: Img;
|
|
169
169
|
/** 自定义折扣标签图标样式(style1/style2/style3 为内置预设,custom 为自定义上传) */
|
|
170
170
|
customTagStyle?: DiscountTagStyle;
|
|
171
|
+
/** 左上角折扣标签文字颜色,覆盖默认文字色;未设置时保持原样式 */
|
|
172
|
+
discountTagTextColor?: string;
|
|
171
173
|
/** 点击会员标签模块游客副标题(注册/登录)回调 */
|
|
172
174
|
onMemberSignUp?: () => void;
|
|
173
175
|
/** 点击会员标签模块付费会员折扣文案(加购付费会员sku)回调 */
|