Restore point before Stufe 3 (central resolver-service refactoring). Includes this session's work: - Success Story (usecase) rebuild: new fields/tabs, UsecaseSerializer, thin List/Show renderers, MM relations, inline content elements. - vitec_columns content block (two-column layout with per-item content) incl. unified header section; special-cased JSON resolution. - Container per-column flex (items[].config align/justify) + gap on parent. - Unified header section across CEs/plugins/containers; header fields in JSON. - ISO-style architecture spec: Documentation/Headless-JSON-Architecture.md. - Cleanup: removed local scratch + verified .bak backups. - Fixes: B-6 (undefined thumbnail variable in Downloadcardcollection image resolver), B-7 (unsatisfiable legacy CType OR branch in Downloadcard/Datasheets). Rollback: git reset --hard snapshot-2026-07-09-pre-stufe3 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 line
5.4 KiB
JavaScript
1 line
5.4 KiB
JavaScript
import{C as e,D as t,Q as n,Z as r,_ as i,c as a,d as o,k as s,n as c,o as l,u}from"./index-7LYai_r-.js";var d=n(),f=r();function p(){return(0,f.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 18 18`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M11 4.5L6.5 9l4.5 4.5`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function m(){return(0,f.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 18 18`,fill:`none`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M7 4.5L11.5 9 7 13.5`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`})})}var h=24;function g({element:n,className:r,nested:g,devInfoTags:_,uid:v,spaceBefore:ee,spaceAfter:y,renderElement:b}){let x=a(n),S=o(n),C=i(u(n)),w=n.cssClass,T=n.tx_vitec_bg_variant,E=!!(T&&T!==`none`),D=E?l(T):{},O=n.carousel??{},k=Math.max(1,parseInt(O.slidesPerView??`3`,10)),A=O.showArrows!==`0`,j=O.showIndicators!==`0`,M=n.items?.flatMap(e=>e.contentElements??[])??[],N=(0,d.useRef)(null),P=(0,d.useRef)({dragging:!1,startX:0,startScrollLeft:0,moved:!1}),[F,I]=(0,d.useState)(!1),[L,R]=(0,d.useState)(!1),[z,B]=(0,d.useState)(0),[V,H]=(0,d.useState)(k),U=(0,d.useCallback)(()=>{let e=N.current;if(!e||!e.children[0])return;let t=e.children[0].offsetWidth;t>0&&H(Math.max(1,Math.floor((e.clientWidth+h)/(t+h))))},[]),W=(0,d.useCallback)(()=>{let e=N.current;if(!e)return;let{scrollLeft:t,scrollWidth:n,clientWidth:r}=e;I(t>4),R(t<n-r-4);let i=e.children[0];if(i){let n=i.offsetWidth+h;if(n>0){let r=Math.round(t/n),i=Math.max(1,Math.floor((e.clientWidth+h)/n)),a=Math.max(1,M.length-i+1);B(Math.min(r,a-1))}}},[M.length]);(0,d.useEffect)(()=>{U(),W();let e=new ResizeObserver(()=>{U(),W()});return N.current&&e.observe(N.current),()=>e.disconnect()},[U,W]),(0,d.useEffect)(()=>{let e=N.current;if(!e)return;let t=0,n=0,r=0,i=null,a=a=>{let o=a.touches[0];t=o.pageX,n=o.pageY,r=e.scrollLeft,i=null,P.current={dragging:!0,startX:o.pageX,startScrollLeft:e.scrollLeft,moved:!1},e.style.scrollSnapType=`none`},o=a=>{if(!P.current.dragging)return;let o=a.touches[0],s=o.pageX-t,c=o.pageY-n;i===null&&(i=Math.abs(s)>Math.abs(c)),i?(a.preventDefault(),Math.abs(s)>3&&(P.current.moved=!0),e.scrollLeft=r-s):(e.style.scrollSnapType=``,P.current.dragging=!1)},s=()=>{P.current.dragging&&(P.current.dragging=!1,e.style.scrollSnapType=``)};return e.addEventListener(`touchstart`,a,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!1}),e.addEventListener(`touchend`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,a),e.removeEventListener(`touchmove`,o),e.removeEventListener(`touchend`,s)}},[]);let G=(0,d.useCallback)(e=>{let t=N.current;if(!t||!t.children[0])return;let n=t.children[0].offsetWidth+h;t.scrollTo({left:e*n,behavior:`smooth`})},[]),K=(0,d.useCallback)(e=>{let t=N.current;if(!t||!t.children[0])return;let n=t.children[0].offsetWidth+h;t.scrollBy({left:e*n,behavior:`smooth`})},[]),q=(0,d.useCallback)(e=>{let t=N.current;t&&(P.current={dragging:!0,startX:e.pageX,startScrollLeft:t.scrollLeft,moved:!1},t.style.scrollSnapType=`none`,t.style.cursor=`grabbing`,t.style.userSelect=`none`)},[]),J=(0,d.useCallback)(e=>{let t=P.current;if(!t.dragging)return;let n=N.current;if(!n)return;let r=e.pageX-t.startX;Math.abs(r)>3&&(t.moved=!0),n.scrollLeft=t.startScrollLeft-r},[]),Y=(0,d.useCallback)(()=>{let e=N.current;!e||!P.current.dragging||(P.current.dragging=!1,e.style.cursor=``,e.style.userSelect=``,e.style.scrollSnapType=``)},[]),X=(0,d.useCallback)(e=>{P.current.moved&&(e.stopPropagation(),e.preventDefault(),P.current.moved=!1)},[]),Z=Math.max(1,M.length-V+1),Q=M.length>V,$=!!(x||S);return(0,f.jsx)(c,{className:[r,w].filter(Boolean).join(` `)||void 0,devInfoTags:_,nested:g,uid:v,spaceBefore:ee,spaceAfter:y,children:(0,f.jsx)(t,{sx:{...D,...E?{borderRadius:3,px:{xs:2.5,md:4},py:{xs:3,md:3.5},"& p, & h1, & h2, & h3, & h4, & h5, & h6, & .MuiTypography-root":{color:`inherit`}}:{}},children:(0,f.jsxs)(`div`,{className:`vitec_cards_carousel__inner`,children:[($||A&&Q)&&(0,f.jsxs)(`div`,{className:`vitec_cards_carousel__header`,children:[$&&(0,f.jsxs)(e,{spacing:.25,sx:{textAlign:C,alignItems:C===`center`?`center`:C===`right`?`flex-end`:`flex-start`},children:[x&&(0,f.jsx)(s,{variant:`h4`,children:x}),S&&(0,f.jsx)(s,{variant:`subtitle1`,color:`text.secondary`,children:S})]}),A&&Q&&(0,f.jsxs)(`div`,{className:`vitec_cards_carousel__arrows`,children:[(0,f.jsx)(`button`,{className:`vitec_cards_carousel__arrow`,onClick:()=>K(-1),disabled:!F,"aria-label":`Previous slide`,children:(0,f.jsx)(p,{})}),(0,f.jsx)(`button`,{className:`vitec_cards_carousel__arrow`,onClick:()=>K(1),disabled:!L,"aria-label":`Next slide`,children:(0,f.jsx)(m,{})})]})]}),(0,f.jsx)(`div`,{className:`vitec_cards_carousel__track vitec_cards_carousel__track--slides-${k}`,ref:N,onScroll:W,onMouseDown:q,onMouseMove:J,onMouseUp:Y,onMouseLeave:Y,onClickCapture:X,onDragStart:e=>e.preventDefault(),children:M.map(e=>(0,f.jsx)(d.Fragment,{children:(0,f.jsx)(`div`,{className:`vitec_cards_carousel__slide`,children:b(e,!0)})},`${e.id??e.type}-${e.colPos}`))}),j&&Q&&(0,f.jsx)(`div`,{className:`vitec_cards_carousel__indicators`,role:`tablist`,"aria-label":`Carousel position`,children:Array.from({length:Z}).map((e,t)=>(0,f.jsx)(`button`,{role:`tab`,"aria-selected":t===z,"aria-label":`Position ${t+1}`,className:[`vitec_cards_carousel__dot`,t===z?`vitec_cards_carousel__dot--active`:``].filter(Boolean).join(` `),onClick:()=>G(t)},t))})]})})})}export{g as VitecCardsCarousel}; |