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
4.7 KiB
JavaScript
1 line
4.7 KiB
JavaScript
import{A as e,C as t,D as n,Q as r,V as i,Z as a,a as o,c as s,k as c,n as l,tt as u}from"./index-7LYai_r-.js";import{t as d}from"./jszip.min-B_jfdBDa.js";var f=r(),p=u(d(),1),m=a(),h=`linear-gradient(135deg, rgba(var(--vitec-brand), 1) 0%, rgba(var(--vitec-navy-deep), 1) 100%)`;async function g(e,t){let n=new p.default;await Promise.all(e.map(async e=>{let t=e.file?.url;if(!t)return;let r=i(t,o.base_url,o.router_mode),a=await fetch(r);if(!a.ok)return;let s=await a.blob();n.file(e.file?.name??`download_${e.uid}.pdf`,s)}));let r=await n.generateAsync({type:`blob`}),a=URL.createObjectURL(r),s=document.createElement(`a`);s.href=a,s.download=t,s.click(),URL.revokeObjectURL(a)}function _({download:e}){let t=e.file,r=t?.url?i(t.url,o.base_url,o.router_mode):void 0,a=e.title??t?.name??`Download`;return(0,m.jsxs)(n,{component:`a`,href:r??`#`,target:`_blank`,rel:`noreferrer noopener`,sx:{display:`flex`,alignItems:`baseline`,gap:`0.4rem`,color:`rgba(255,255,255,0.85)`,textDecoration:`none`,fontSize:`0.8125rem`,lineHeight:1.4,"&:hover":{color:`#fff`,textDecoration:`underline`}},children:[(0,m.jsx)(n,{component:`span`,sx:{flexShrink:0,mt:`0.2em`,color:`rgba(var(--vitec-orange), 1)`,fontSize:`0.5rem`},children:`■`}),(0,m.jsx)(`span`,{children:a})]})}function v({downloads:t,zipName:r}){let[i,a]=(0,f.useState)(`idle`);return(0,m.jsxs)(n,{component:`button`,onClick:async e=>{if(e.preventDefault(),i!==`loading`){a(`loading`);try{await g(t,r),a(`idle`)}catch{a(`error`),setTimeout(()=>a(`idle`),3e3)}}},disabled:i===`loading`,sx:{display:`inline-flex`,alignItems:`center`,gap:`0.4rem`,alignSelf:`flex-start`,mt:`auto`,fontSize:`0.8125rem`,fontWeight:600,color:i===`error`?`rgba(255,180,180,1)`:`#fff`,background:`none`,border:`1.5px solid`,borderColor:i===`error`?`rgba(255,120,120,0.6)`:`rgba(255,255,255,0.5)`,borderRadius:`0.375rem`,px:`0.875rem`,py:`0.4375rem`,cursor:i===`loading`?`default`:`pointer`,transition:`border-color 0.15s, background 0.15s`,"&:hover:not(:disabled)":{borderColor:`#fff`,bgcolor:`rgba(255,255,255,0.1)`}},children:[i===`loading`?(0,m.jsx)(e,{size:12,sx:{color:`inherit`}}):(0,m.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,m.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,m.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]}),i===`error`?`Download failed`:`Download All Documents (ZIP)`]})}function y({element:e,className:r,nested:a,devInfoTags:u,uid:d,spaceBefore:f,spaceAfter:p}){let g=e.content?.downloadcardcollection??e.data?.downloadcardcollection,y=g?.downloads??[],b=s(e),x=g?.image,S=x&&`publicUrl`in x?x.publicUrl:void 0,C=y[0]?.file?.thumbnail,w=S??(C?i(C,o.base_url,o.router_mode):void 0),T=y.filter(e=>e.file?.url),E=`${(b??`documents`).toLowerCase().replace(/\s+/g,`-`)}.zip`;return y.length===0?null:(0,m.jsx)(l,{className:r,devInfoTags:u,nested:a,uid:d,spaceBefore:f,spaceAfter:p,children:(0,m.jsxs)(n,{className:`vitec_downloadcardcollection`,sx:{display:`flex`,borderRadius:`0.75rem`,overflow:`hidden`,boxShadow:`0 0.125rem 0.75rem rgba(0,0,0,0.08)`,minHeight:`10rem`},children:[(0,m.jsx)(n,{sx:{width:`38%`,flexShrink:0,bgcolor:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,p:w?0:`1.5rem`},children:w?(0,m.jsx)(n,{component:`img`,src:w,alt:b??`Downloads`,loading:`lazy`,sx:{width:`100%`,height:`100%`,objectFit:`contain`,objectPosition:`top center`,display:`block`,p:`0.75rem`}}):(0,m.jsx)(n,{sx:{color:`text.disabled`,opacity:.3},children:(0,m.jsxs)(`svg`,{width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,m.jsx)(`polyline`,{points:`14 2 14 8 20 8`}),(0,m.jsx)(`line`,{x1:`8`,y1:`13`,x2:`16`,y2:`13`}),(0,m.jsx)(`line`,{x1:`8`,y1:`17`,x2:`16`,y2:`17`}),(0,m.jsx)(`polyline`,{points:`10 9 9 9 8 9`})]})})}),(0,m.jsxs)(n,{sx:{flex:1,background:h,color:`#fff`,display:`flex`,flexDirection:`column`,p:`1.25rem 1.25rem 1rem`,gap:`0.75rem`},children:[(0,m.jsxs)(t,{direction:`row`,alignItems:`center`,spacing:1,children:[(0,m.jsx)(c,{component:`span`,sx:{fontSize:`0.6875rem`,fontWeight:700,letterSpacing:`0.06em`,textTransform:`uppercase`,opacity:.85,whiteSpace:`nowrap`,color:`inherit`},children:b??`Download Collection`}),(0,m.jsx)(n,{sx:{flex:1,height:`1px`,bgcolor:`rgba(255,255,255,0.3)`}})]}),(0,m.jsx)(t,{spacing:.375,sx:{flex:1},children:y.map(e=>(0,m.jsx)(_,{download:e},e.uid??e.slug??e.title))}),T.length>1&&(0,m.jsx)(v,{downloads:T,zipName:E})]})]})})}export{y as VitecDownloadCardCollection}; |