diff --git a/dist/banner/banner.js b/dist/banner/banner.js index 885c5273..1f508403 100644 --- a/dist/banner/banner.js +++ b/dist/banner/banner.js @@ -1,2 +1,2 @@ -import{j as d,x as i}from"../__chunks__/lit-element.XkUWx5ik.js";import{o as h}from"../__chunks__/unsafe-html.tmuruS4o.js";const u=({headline:n,subline:e,texts:r,buttons:a,picture:c})=>i``;function $(n){var p,s;const e=n.querySelector("div"),r=n.children[1],a=(p=e==null?void 0:e.querySelector("h1"))==null?void 0:p.innerText,c=(s=e==null?void 0:e.querySelector("h3"))==null?void 0:s.innerText,l=e?[...e.querySelectorAll("p")]:[],o=[...r==null?void 0:r.querySelectorAll("a")],t=(e==null?void 0:e.querySelector("picture"))||void 0;console.log({headline:a,subline:c,texts:l,buttons:o,picture:t}),n.innerHTML="",n.style.removeProperty("display"),d(u({headline:a,subline:c,texts:l,buttons:o,picture:t}),n)}export{$ as default}; +import{j as d,x as i}from"../__chunks__/lit-element.XkUWx5ik.js";import{o as h}from"../__chunks__/unsafe-html.tmuruS4o.js";const u=({headline:n,subline:e,texts:r,buttons:c,picture:l})=>i``;function $(n){var t,p;const e=n.querySelector("div"),r=n.children[1],c=(t=e==null?void 0:e.querySelector("h1"))==null?void 0:t.innerText,l=(p=e==null?void 0:e.querySelector("h3"))==null?void 0:p.innerText,a=e?[...e.querySelectorAll("p")]:[],o=[...r==null?void 0:r.querySelectorAll("a")],s=(e==null?void 0:e.querySelector("picture"))||void 0;n.innerHTML="",n.style.removeProperty("display"),d(u({headline:c,subline:l,texts:a,buttons:o,picture:s}),n)}export{$ as default}; //# sourceMappingURL=banner.js.map diff --git a/dist/banner/banner.js.map b/dist/banner/banner.js.map index 66dbb8f3..00296ac8 100644 --- a/dist/banner/banner.js.map +++ b/dist/banner/banner.js.map @@ -1 +1 @@ -{"version":3,"file":"banner.js","sources":["../../src/blocks/banner/banner.ts"],"sourcesContent":["import { html, render } from 'lit';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\n\ninterface TemplateArgs {\n headline?: string;\n subline?: string;\n picture?: HTMLPictureElement;\n texts?: HTMLParagraphElement[];\n buttons?: HTMLAnchorElement[];\n}\n\nconst template = ({ headline, subline, texts, buttons, picture }: TemplateArgs) => {\n return html`\n
\n
\n
\n

${headline}

\n

${subline}

\n
\n ${texts?.map((text) => html`

${text.innerText}

`)}\n \n
\n ${picture ?? unsafeHTML(picture)} \n
\n `;\n};\n\nexport default function (block: HTMLElement) {\n const firstRow = block.querySelector('div');\n const secondRow = block.children[1];\n const headline = firstRow?.querySelector('h1')?.innerText;\n const subline = firstRow?.querySelector('h3')?.innerText;\n const texts = firstRow ? [...firstRow.querySelectorAll('p')] : [];\n const buttons = [...secondRow?.querySelectorAll('a')];\n const picture = firstRow?.querySelector('picture') || undefined;\n\n console.log({ headline, subline, texts, buttons, picture });\n\n block.innerHTML = '';\n\n block.style.removeProperty('display');\n render(template({ headline, subline, texts, buttons, picture }), block);\n}\n"],"names":["template","headline","subline","texts","buttons","picture","html","text","button","unsafeHTML","banner","block","firstRow","secondRow","_a","_b","render"],"mappings":"2HAWA,MAAMA,EAAW,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAS,MAAAC,EAAO,QAAAC,EAAS,QAAAC,KAC9CC,0DAIOL,CAAQ,WACTC,CAAO,gBAEZC,GAAA,YAAAA,EAAO,IAAKI,GAASD,OAAUC,EAAK,SAAS,OAAO,uBAElDH,GAAA,YAAAA,EAAS,IACRI,GACCF,iBACaE,EAAO,IAAI,wBAAwBA,EAAO,SAAS,YAEnE,yCAGyBH,GAAWI,EAAWJ,CAAO,CAAC,oBAKlE,SAAAK,EAAyBC,EAAoB,SACrC,MAAAC,EAAWD,EAAM,cAAc,KAAK,EACpCE,EAAYF,EAAM,SAAS,CAAC,EAC5BV,GAAWa,EAAAF,GAAA,YAAAA,EAAU,cAAc,QAAxB,YAAAE,EAA+B,UAC1CZ,GAAUa,EAAAH,GAAA,YAAAA,EAAU,cAAc,QAAxB,YAAAG,EAA+B,UACzCZ,EAAQS,EAAW,CAAC,GAAGA,EAAS,iBAAiB,GAAG,CAAC,EAAI,GACzDR,EAAU,CAAC,GAAGS,GAAA,YAAAA,EAAW,iBAAiB,IAAI,EAC9CR,GAAUO,GAAA,YAAAA,EAAU,cAAc,aAAc,OAEtD,QAAQ,IAAI,CAAE,SAAAX,EAAU,QAAAC,EAAS,MAAAC,EAAO,QAAAC,EAAS,QAAAC,EAAS,EAE1DM,EAAM,UAAY,GAEZA,EAAA,MAAM,eAAe,SAAS,EAC7BK,EAAAhB,EAAS,CAAE,SAAAC,EAAU,QAAAC,EAAS,MAAAC,EAAO,QAAAC,EAAS,QAAAC,CAAA,CAAS,EAAGM,CAAK,CACxE"} \ No newline at end of file +{"version":3,"file":"banner.js","sources":["../../src/blocks/banner/banner.ts"],"sourcesContent":["import { html, render } from 'lit';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html.js';\n\ninterface TemplateArgs {\n headline?: string;\n subline?: string;\n picture?: HTMLPictureElement;\n texts?: HTMLParagraphElement[];\n buttons?: HTMLAnchorElement[];\n}\n\nconst template = ({ headline, subline, texts, buttons, picture }: TemplateArgs) => {\n // if (picture) {\n // picture.querySelector('img')?.removeAttribute('loading');\n // }\n return html`\n
\n
\n
\n

${headline}

\n

${subline}

\n
\n ${texts?.map((text) => html`

${text.innerText}

`)}\n \n
\n ${picture ?? unsafeHTML(picture)} \n
\n `;\n};\n\nexport default function (block: HTMLElement) {\n const firstRow = block.querySelector('div');\n const secondRow = block.children[1];\n const headline = firstRow?.querySelector('h1')?.innerText;\n const subline = firstRow?.querySelector('h3')?.innerText;\n const texts = firstRow ? [...firstRow.querySelectorAll('p')] : [];\n const buttons = [...secondRow?.querySelectorAll('a')];\n const picture = firstRow?.querySelector('picture') || undefined;\n\n block.innerHTML = '';\n\n block.style.removeProperty('display');\n render(template({ headline, subline, texts, buttons, picture }), block);\n}\n"],"names":["template","headline","subline","texts","buttons","picture","html","text","button","unsafeHTML","banner","block","firstRow","secondRow","_a","_b","render"],"mappings":"2HAWA,MAAMA,EAAW,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAS,MAAAC,EAAO,QAAAC,EAAS,QAAAC,KAI9CC,0DAIOL,CAAQ,WACTC,CAAO,gBAEZC,GAAA,YAAAA,EAAO,IAAKI,GAASD,OAAUC,EAAK,SAAS,OAAO,uBAElDH,GAAA,YAAAA,EAAS,IACRI,GACCF,iBACaE,EAAO,IAAI,wBAAwBA,EAAO,SAAS,YAEnE,yCAGyBH,GAAWI,EAAWJ,CAAO,CAAC,oBAKlE,SAAAK,EAAyBC,EAAoB,SACrC,MAAAC,EAAWD,EAAM,cAAc,KAAK,EACpCE,EAAYF,EAAM,SAAS,CAAC,EAC5BV,GAAWa,EAAAF,GAAA,YAAAA,EAAU,cAAc,QAAxB,YAAAE,EAA+B,UAC1CZ,GAAUa,EAAAH,GAAA,YAAAA,EAAU,cAAc,QAAxB,YAAAG,EAA+B,UACzCZ,EAAQS,EAAW,CAAC,GAAGA,EAAS,iBAAiB,GAAG,CAAC,EAAI,GACzDR,EAAU,CAAC,GAAGS,GAAA,YAAAA,EAAW,iBAAiB,IAAI,EAC9CR,GAAUO,GAAA,YAAAA,EAAU,cAAc,aAAc,OAEtDD,EAAM,UAAY,GAEZA,EAAA,MAAM,eAAe,SAAS,EAC7BK,EAAAhB,EAAS,CAAE,SAAAC,EAAU,QAAAC,EAAS,MAAAC,EAAO,QAAAC,EAAS,QAAAC,CAAA,CAAS,EAAGM,CAAK,CACxE"} \ No newline at end of file diff --git a/dist/main/main.js b/dist/main/main.js index 86c77327..27eff806 100644 --- a/dist/main/main.js +++ b/dist/main/main.js @@ -1,4 +1,4 @@ -const S="modulepreload",g=function(i){return"/"+i},f={},v=function(e,t,s){let n=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link");n=Promise.all(t.map(a=>{if(a=g(a),a in f)return;f[a]=!0;const r=a.endsWith(".css"),c=r?'[rel="stylesheet"]':"";if(!!s)for(let h=o.length-1;h>=0;h--){const m=o[h];if(m.href===a&&(!r||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${c}`))return;const l=document.createElement("link");if(l.rel=r?"stylesheet":S,r||(l.as="script",l.crossOrigin=""),l.href=a,document.head.appendChild(l),r)return new Promise((h,m)=>{l.addEventListener("load",h),l.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${a}`)))})}))}return n.then(()=>e()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function u(i){return typeof i=="string"?i.toLowerCase().replace(/[^0-9a-z]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const p=(i,e)=>{e.split(",").forEach(t=>{i.classList.add(u(t.trim()))})};function y(i,e=document){const t=i&&i.includes(":")?"property":"name",n=[...e.head.querySelectorAll(`meta[${t}="${i}"]`)].map(o=>o.content).join(", ");return n.length?n:""}function w(i){return u(i).replace(/-([a-z])/g,e=>e[1].toUpperCase())}class E{readBlockConfig(e){const t={};return e.querySelectorAll(":scope > div").forEach(s=>{if(s.children){const n=[...s.children];if(n[1]){const o=n[1],a=u(n[0].textContent??"");let r="";if(o.querySelector("a")){const c=[...o.querySelectorAll("a")];c.length===1?r=c[0].href:r=c.map(d=>d.href)}else if(o.querySelector("img")){const c=[...o.querySelectorAll("img")];c.length===1?r=c[0].src:r=c.map(d=>d.src)}else if(o.querySelector("p")){const c=[...o.querySelectorAll("p")];c.length===1?r=c[0].textContent:r=c.map(d=>d.textContent)}else r=s.children[1].textContent;t[a]=r}}}),t}decorateBlocks(e){e.querySelectorAll("div.section > div > div").forEach(this.decorateBlock)}decorateBlock(e){const t=e.classList[0];if(t){e.classList.add("block"),e.dataset.blockName=t;const s=e.parentElement;s==null||s.classList.add(`${t}-wrapper`);const n=e.closest(".section");n&&n.classList.add(`${t}-container`)}}}class C{constructor(e){this.blockService=e}init(e){this.transformSection(e)}transformSection(e){e.querySelectorAll(":scope > div").forEach(t=>{this.adjustMarkup(t),this.processSectionMetaData(t)})}processSectionMetaData(e){const t=e.querySelector("div.section-metadata");if(t){const s=this.blockService.readBlockConfig(t);Object.keys(s).forEach(n=>{n==="style"?s.style.split(",").filter(a=>a).map(a=>u(a.trim())).forEach(a=>e.classList.add(a)):e.dataset[w(n)]=s[n]}),t.parentElement&&t.parentElement.remove()}}adjustMarkup(e){const t=[];let s=!1;[...e.children].forEach(n=>{if(n.tagName==="DIV"||!s){const o=document.createElement("div");t.push(o),s=n.tagName!=="DIV",s&&o.classList.add("default-content-wrapper")}t[t.length-1].append(n)}),t.forEach(n=>e.append(n)),e.classList.add("section"),e.dataset.sectionStatus="initialized",e.style.display="none"}}class L{constructor(e,t){this.sectionService=e,this.blockService=t,this.init=async()=>{this.setup(),await this.loadEager()},this.loadEager=async()=>{document.documentElement.lang="en",this.decorateTemplateAndTheme();const s=document.querySelector("main");s&&(s.setAttribute("id","main"),this.addSidebarContainer(s),this.sectionService.init(s),this.addInnerContainer(s),this.blockService.decorateBlocks(s),await this.loadComponents(),document.body.classList.add("appear"))},this.loadComponents=async()=>{document.querySelectorAll(".section").forEach(n=>{const o=[],a=n.querySelectorAll("[data-block-name]");if(!a.length){n.style.removeProperty("display");return}a.forEach(r=>{r.style.display="none",o.push({name:r.dataset.blockName,element:r})}),o.length&&o.forEach(async r=>{const c=await v(()=>import(`${window.hlx.codeBasePath}/dist/${r.name}/${r.name}.js`),__vite__mapDeps([]));c.default&&await c.default(r.element)}),n.style.removeProperty("display")})}}setup(){window.hlx=window.hlx||{},window.hlx.RUM_MASK_URL="full",window.hlx.codeBasePath="",window.hlx.lighthouse=new URLSearchParams(window.location.search).get("lighthouse")==="on";const e=document.querySelector('script[src$="/scripts/scripts.js"]');if(e)try{[window.hlx.codeBasePath]=new URL(e.src).pathname.split("/scripts/scripts.js")}catch(t){console.log(t)}}addSidebarContainer(e){const t=document.createElement("div");t.classList.add("sidebar"),t.setAttribute("id","sidebar"),e.after(t)}addInnerContainer(e){const t=e.innerHTML;e.innerHTML=`
${t}
`}decorateTemplateAndTheme(){const e=y("template");e&&p(document.body,e);const t=y("theme");t&&p(document.body,t)}}(async function(){const i=new E,e=new C(i);await new L(e,i).init()})(); +const S="modulepreload",v=function(i){return"/"+i},f={},g=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){const a=document.getElementsByTagName("link");s=Promise.all(t.map(o=>{if(o=v(o),o in f)return;f[o]=!0;const r=o.endsWith(".css"),c=r?'[rel="stylesheet"]':"";if(!!n)for(let h=a.length-1;h>=0;h--){const m=a[h];if(m.href===o&&(!r||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const l=document.createElement("link");if(l.rel=r?"stylesheet":S,r||(l.as="script",l.crossOrigin=""),l.href=o,document.head.appendChild(l),r)return new Promise((h,m)=>{l.addEventListener("load",h),l.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${o}`)))})}))}return s.then(()=>e()).catch(a=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a})};function u(i){return typeof i=="string"?i.toLowerCase().replace(/[^0-9a-z]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const p=(i,e)=>{e.split(",").forEach(t=>{i.classList.add(u(t.trim()))})};function y(i,e=document){const t=i&&i.includes(":")?"property":"name",s=[...e.head.querySelectorAll(`meta[${t}="${i}"]`)].map(a=>a.content).join(", ");return s.length?s:""}function w(i){return u(i).replace(/-([a-z])/g,e=>e[1].toUpperCase())}class E{readBlockConfig(e){const t={};return e.querySelectorAll(":scope > div").forEach(n=>{if(n.children){const s=[...n.children];if(s[1]){const a=s[1],o=u(s[0].textContent??"");let r="";if(a.querySelector("a")){const c=[...a.querySelectorAll("a")];c.length===1?r=c[0].href:r=c.map(d=>d.href)}else if(a.querySelector("img")){const c=[...a.querySelectorAll("img")];c.length===1?r=c[0].src:r=c.map(d=>d.src)}else if(a.querySelector("p")){const c=[...a.querySelectorAll("p")];c.length===1?r=c[0].textContent:r=c.map(d=>d.textContent)}else r=n.children[1].textContent;t[o]=r}}}),t}decorateBlocks(e){e.querySelectorAll("div.section > div > div").forEach(this.decorateBlock)}decorateBlock(e){const t=e.classList[0];if(t){e.classList.add("block"),e.dataset.blockName=t;const n=e.parentElement;n==null||n.classList.add(`${t}-wrapper`);const s=e.closest(".section");s&&s.classList.add(`${t}-container`)}}}class C{constructor(e){this.blockService=e}init(e){this.transformSection(e)}transformSection(e){e.querySelectorAll(":scope > div").forEach(t=>{this.adjustMarkup(t),this.processSectionMetaData(t)})}processSectionMetaData(e){const t=e.querySelector("div.section-metadata");if(t){const n=this.blockService.readBlockConfig(t);Object.keys(n).forEach(s=>{s==="style"?n.style.split(",").filter(o=>o).map(o=>u(o.trim())).forEach(o=>e.classList.add(o)):e.dataset[w(s)]=n[s]}),t.parentElement&&t.parentElement.remove()}}adjustMarkup(e){const t=[];let n=!1;[...e.children].forEach(s=>{if(s.tagName==="DIV"||!n){const a=document.createElement("div");t.push(a),n=s.tagName!=="DIV",n&&a.classList.add("default-content-wrapper")}t[t.length-1].append(s)}),t.forEach(s=>e.append(s)),e.classList.add("section"),e.dataset.sectionStatus="initialized",e.style.display="none"}}class b{constructor(e,t){this.sectionService=e,this.blockService=t,this.init=async()=>{this.setup(),await this.loadEager()},this.loadEager=async()=>{if(document.documentElement.lang="en",this.decorateTemplateAndTheme(),document){const s=document.querySelector("body");s&&(s.style.display="none")}const n=document.querySelector("main");n&&(n.setAttribute("id","main"),this.addSidebarContainer(n),this.sectionService.init(n),this.addInnerContainer(n),this.blockService.decorateBlocks(n),await this.loadComponents(),setTimeout(()=>{document.body.removeAttribute("style")},200))},this.loadComponents=async()=>{document.querySelectorAll(".section").forEach(s=>{const a=[],o=s.querySelectorAll("[data-block-name]");if(!o.length){s.style.removeProperty("display");return}o.forEach(r=>{r.style.display="none",a.push({name:r.dataset.blockName,element:r})}),a.length&&a.forEach(async r=>{const c=await g(()=>import(`${window.hlx.codeBasePath}/dist/${r.name}/${r.name}.js`),__vite__mapDeps([]));c.default&&await c.default(r.element)}),s.style.removeProperty("display")})}}setup(){window.hlx=window.hlx||{},window.hlx.RUM_MASK_URL="full",window.hlx.codeBasePath="",window.hlx.lighthouse=new URLSearchParams(window.location.search).get("lighthouse")==="on";const e=document.querySelector('script[src$="/scripts/scripts.js"]');if(e)try{[window.hlx.codeBasePath]=new URL(e.src).pathname.split("/scripts/scripts.js")}catch(t){console.log(t)}}addSidebarContainer(e){const t=document.createElement("div");t.classList.add("sidebar"),t.setAttribute("id","sidebar"),e.after(t)}addInnerContainer(e){const t=e.innerHTML;e.innerHTML=`
${t}
`}decorateTemplateAndTheme(){const e=y("template");e&&p(document.body,e);const t=y("theme");t&&p(document.body,t)}}(async function(){const i=new E,e=new C(i);await new b(e,i).init()})(); function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/main/main.js.map b/dist/main/main.js.map index f0bb7667..0e8418d4 100644 --- a/dist/main/main.js.map +++ b/dist/main/main.js.map @@ -1 +1 @@ -{"version":3,"mappings":"22BAAO,SAASA,EAAYC,EAAc,CACxC,OAAO,OAAOA,GAAS,SACnBA,EACG,cACA,QAAQ,cAAe,GAAG,EAC1B,QAAQ,MAAO,GAAG,EAClB,QAAQ,SAAU,EAAE,EACvB,EACN,CCNa,MAAAC,EAAa,CAACC,EAAsBC,IAAoB,CACnEA,EAAQ,MAAM,GAAG,EAAE,QAASC,GAAM,CAChCF,EAAQ,UAAU,IAAIH,EAAYK,EAAE,KAAM,EAAC,EAC5C,CACH,ECNgB,SAAAC,EAAYL,EAAcM,EAAM,SAAU,CACxD,MAAMC,EAAOP,GAAQA,EAAK,SAAS,GAAG,EAAI,WAAa,OAGjDQ,EADH,CAAC,GAAGF,EAAI,KAAK,iBAAiB,QAAQC,CAAI,KAAKP,CAAI,IAAI,CAAC,EAExD,IAAKS,GACGA,EAAE,OACV,EACA,KAAK,IAAI,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SAASD,EAAU,IAAI,IAAIA,EAAU,IAAI,4BAEjEC,EAAgB,SACZ,MAAAA,EAAgB,QAAQD,EAAU,OAAO,CACjD,CACD,EAEKf,EAAA,MAAM,eAAe,SAAS,EACvC,EA5FA,CAUK,OAAQ,CACP,WAAM,OAAO,KAAO,GAC3B,OAAO,IAAI,aAAe,OAC1B,OAAO,IAAI,aAAe,GACnB,WAAI,WAAa,IAAI,gBAAgB,OAAO,SAAS,MAAM,EAAE,IAAI,YAAY,IAAM,KAEpF,MAAAiB,EAAW,SAAS,cAAc,oCAAoC,EAC5E,GAAIA,EACE,IACD,QAAO,IAAI,YAAY,EAAI,IAAI,IAAIA,EAAS,GAAG,EAAE,SAAS,MAAM,qBAAqB,QAC/EC,EAAO,CAEd,QAAQ,IAAIA,CAAK,CACnB,CAEJ,CAmBQ,oBAAoBrB,EAAmB,CACvC,MAAAsB,EAAmB,SAAS,cAAc,KAAK,EACpCA,EAAA,UAAU,IAAI,SAAS,EACvBA,EAAA,aAAa,KAAM,SAAS,EAC7CtB,EAAK,MAAMsB,CAAgB,CAC7B,CAEQ,kBAAkBtB,EAAmB,CAC3C,MAAMuB,EAAWvB,EAAK,UACjBA,EAAA,UAAY,sBAAsBuB,CAAQ,QACjD,CAIQ,0BAA2B,CAC3B,MAAAC,EAAW5C,EAAY,UAAU,EACnC4C,GAAqBhD,EAAA,SAAS,KAAMgD,CAAQ,EAC1C,MAAAC,EAAQ7C,EAAY,OAAO,EAC7B6C,GAAkBjD,EAAA,SAAS,KAAMiD,CAAK,CAC5C,CA+BF,EAEC,gBAAkB,CACX,MAAApB,EAAe,IAAIlB,EACnB4B,EAAiB,IAAIX,EAAeC,CAAY,EAEtD,MADa,IAAIS,EAAKC,EAAgBV,CAAY,EACvC,MACb,GAAG","names":["toClassName","name","addClasses","element","classes","c","getMetadata","doc","attr","meta","m","toCamelCase","g","BlockService","block","config","row","cols","col","value","as","a","imgs","img","ps","p","main","shortBlockName","blockWrapper","section","SectionService","blockService","container","sectionMeta","key","style","wrappers","defaultContent","e","wrapper","Main","sectionService","components","blocks","component","componentModule","scriptEl","error","sidebarContainer","children","template","theme"],"sources":["../../src/utils/toClassName.ts","../../src/utils/addClasses.ts","../../src/utils/getMetadata.ts","../../src/utils/toCamelCase.ts","../../src/main.ts"],"sourcesContent":["export function toClassName(name: string) {\n return typeof name === 'string'\n ? name\n .toLowerCase()\n .replace(/[^0-9a-z]/gi, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n : '';\n}\n","import { toClassName } from './toClassName';\n\nexport const addClasses = (element: HTMLElement, classes: string) => {\n classes.split(',').forEach((c) => {\n element.classList.add(toClassName(c.trim()));\n });\n};\n","export function getMetadata(name: string, doc = document) {\n const attr = name && name.includes(':') ? 'property' : 'name';\n const metaTags: HTMLMetaElement[] =\n ([...doc.head.querySelectorAll(`meta[${attr}=\"${name}\"]`)] as HTMLMetaElement[]) || [];\n const meta = metaTags\n .map((m) => {\n return m.content;\n })\n .join(', ');\n return meta.length ? meta : '';\n}\n","import { toClassName } from './toClassName';\n\n/**\n * Sanitizes a string for use as a js property name.\n * @param {string} name The unsanitized string\n * @returns {string} The camelCased name\n */\nexport function toCamelCase(name: string) {\n return toClassName(name).replace(/-([a-z])/g, (g) => g[1].toUpperCase());\n}\n","// const LCP_BLOCKS: string[] = []; // add your LCP blocks to the list\n\nimport { addClasses } from '../src/utils/addClasses';\nimport { getMetadata } from '../src/utils/getMetadata';\nimport { toCamelCase } from '../src/utils/toCamelCase';\nimport { toClassName } from '../src/utils/toClassName';\n\ntype ComponentMapping = {\n name: string;\n element: HTMLDivElement;\n};\n\nclass BlockService {\n /**\n * Extracts the config from a block.\n * @param {Element} block The block element\n * @returns {object} The block config\n */\n readBlockConfig(block: Element): Record {\n const config: Record = {};\n block.querySelectorAll(':scope > div').forEach((row) => {\n if (row.children) {\n const cols = [...row.children];\n if (cols[1]) {\n const col = cols[1];\n const name = toClassName(cols[0].textContent ?? '');\n let value: any = '';\n if (col.querySelector('a')) {\n const as = [...col.querySelectorAll('a')];\n if (as.length === 1) {\n value = as[0].href;\n } else {\n value = as.map((a) => a.href);\n }\n } else if (col.querySelector('img')) {\n const imgs = [...col.querySelectorAll('img')];\n if (imgs.length === 1) {\n value = imgs[0].src;\n } else {\n value = imgs.map((img) => img.src);\n }\n } else if (col.querySelector('p')) {\n const ps = [...col.querySelectorAll('p')];\n if (ps.length === 1) {\n value = ps[0].textContent;\n } else {\n value = ps.map((p) => p.textContent);\n }\n } else value = row.children[1].textContent;\n config[name] = value;\n }\n }\n });\n return config;\n }\n\n /**\n * Decorates all blocks in a container element.\n * @param {Element} main The container element\n */\n decorateBlocks(main: HTMLElement) {\n main.querySelectorAll('div.section > div > div').forEach(this.decorateBlock);\n }\n\n /**\n * Decorates a block.\n * @param {Element} block The block element\n */\n private decorateBlock(block: HTMLElement) {\n const shortBlockName = block.classList[0];\n if (shortBlockName) {\n block.classList.add('block');\n block.dataset.blockName = shortBlockName;\n const blockWrapper = block.parentElement;\n blockWrapper?.classList.add(`${shortBlockName}-wrapper`);\n const section = block.closest('.section');\n if (section) section.classList.add(`${shortBlockName}-container`);\n }\n }\n}\n\nclass SectionService {\n constructor(private blockService: BlockService) {}\n\n init(container: HTMLElement) {\n this.transformSection(container);\n }\n\n /**\n * Decorates all sections in a container element.\n * @param {Element} main The container element\n */\n private transformSection(main: HTMLElement) {\n main.querySelectorAll(':scope > div').forEach((section) => {\n this.adjustMarkup(section);\n this.processSectionMetaData(section);\n });\n }\n\n private processSectionMetaData(section: HTMLElement) {\n // Process section metadata\n const sectionMeta = section.querySelector('div.section-metadata');\n if (sectionMeta) {\n const meta = this.blockService.readBlockConfig(sectionMeta);\n Object.keys(meta).forEach((key) => {\n if (key === 'style') {\n const styles = meta.style\n .split(',')\n .filter((style: string) => style)\n .map((style: string) => toClassName(style.trim()));\n styles.forEach((style: string) => section.classList.add(style));\n } else {\n section.dataset[toCamelCase(key)] = meta[key];\n }\n });\n if (sectionMeta.parentElement) sectionMeta.parentElement.remove();\n }\n }\n\n private adjustMarkup(section: HTMLDivElement) {\n const wrappers: HTMLDivElement[] = [];\n let defaultContent = false;\n [...section.children].forEach((e) => {\n if (e.tagName === 'DIV' || !defaultContent) {\n const wrapper = document.createElement('div');\n wrappers.push(wrapper);\n defaultContent = e.tagName !== 'DIV';\n if (defaultContent) wrapper.classList.add('default-content-wrapper');\n }\n wrappers[wrappers.length - 1].append(e);\n });\n wrappers.forEach((wrapper) => section.append(wrapper));\n section.classList.add('section');\n section.dataset.sectionStatus = 'initialized';\n section.style.display = 'none';\n }\n}\n\nclass Main {\n constructor(\n private sectionService: SectionService,\n private blockService: BlockService\n ) {}\n\n init = async () => {\n this.setup();\n await this.loadEager();\n };\n\n /**\n * Setup block utils.\n */\n private setup() {\n window.hlx = window.hlx || {};\n window.hlx.RUM_MASK_URL = 'full';\n window.hlx.codeBasePath = '';\n window.hlx.lighthouse = new URLSearchParams(window.location.search).get('lighthouse') === 'on';\n\n const scriptEl = document.querySelector('script[src$=\"/scripts/scripts.js\"]') as HTMLScriptElement;\n if (scriptEl) {\n try {\n [window.hlx.codeBasePath] = new URL(scriptEl.src).pathname.split('/scripts/scripts.js');\n } catch (error) {\n // eslint-disable-next-line no-console\n console.log(error);\n }\n }\n }\n\n private loadEager = async () => {\n // TODO: how to support different languages here\n document.documentElement.lang = 'en';\n this.decorateTemplateAndTheme();\n const main = document.querySelector('main');\n if (main) {\n main.setAttribute('id', 'main');\n this.addSidebarContainer(main);\n this.sectionService.init(main);\n this.addInnerContainer(main); // TODO refactor initializing\n this.blockService.decorateBlocks(main);\n await this.loadComponents();\n document.body.classList.add('appear');\n // await this.waitForLCP(LCP_BLOCKS);\n }\n };\n\n private addSidebarContainer(main: HTMLElement) {\n const sidebarContainer = document.createElement('div');\n sidebarContainer.classList.add('sidebar');\n sidebarContainer.setAttribute('id', 'sidebar');\n main.after(sidebarContainer);\n }\n\n private addInnerContainer(main: HTMLElement) {\n const children = main.innerHTML;\n main.innerHTML = `
${children}
`;\n }\n\n // private loadLazy = async () => {};\n\n private decorateTemplateAndTheme() {\n const template = getMetadata('template');\n if (template) addClasses(document.body, template);\n const theme = getMetadata('theme');\n if (theme) addClasses(document.body, theme);\n }\n\n private loadComponents = async () => {\n const sections = document.querySelectorAll('.section');\n sections.forEach((section) => {\n const components: ComponentMapping[] = [];\n const blocks = section.querySelectorAll('[data-block-name]');\n if (!blocks.length) {\n section.style.removeProperty('display');\n return;\n }\n blocks.forEach((block: HTMLDivElement) => {\n block.style.display = 'none';\n components.push({\n name: block.dataset['blockName'] as string,\n element: block,\n });\n });\n if (components.length) {\n components.forEach(async (component) => {\n const componentModule = await import(\n `${window.hlx.codeBasePath}/dist/${component.name}/${component.name}.js`\n );\n if (componentModule.default) {\n await componentModule.default(component.element);\n }\n });\n }\n section.style.removeProperty('display');\n });\n };\n}\n\n(async function () {\n const blockService = new BlockService();\n const sectionService = new SectionService(blockService);\n const main = new Main(sectionService, blockService);\n await main.init();\n})();\n\n// /**\n// * Loads JS and CSS for a block.\n// * @param {Element} block The block element\n// */\n// async function loadBlock(block) {\n// const status = block.dataset.blockStatus;\n// if (status !== 'loading' && status !== 'loaded') {\n// block.dataset.blockStatus = 'loading';\n// const { blockName } = block.dataset;\n// try {\n// const cssLoaded = loadCSS(`${window.hlx.codeBasePath}/blocks/${blockName}/${blockName}.css`);\n// const decorationComplete = new Promise((resolve) => {\n// (async () => {\n// try {\n// const mod = await import(`${window.hlx.codeBasePath}/blocks/${blockName}/${blockName}.js`);\n// if (mod.default) {\n// await mod.default(block);\n// }\n// } catch (error) {\n// // eslint-disable-next-line no-console\n// console.log(`failed to load module for ${blockName}`, error);\n// }\n// resolve();\n// })();\n// });\n// await Promise.all([cssLoaded, decorationComplete]);\n// } catch (error) {\n// // eslint-disable-next-line no-console\n// console.log(`failed to load block ${blockName}`, error);\n// }\n// block.dataset.blockStatus = 'loaded';\n// }\n// return block;\n// }\n\ndeclare global {\n interface Window {\n hlx: {\n RUM_MASK_URL: string;\n codeBasePath: string;\n lighthouse: boolean;\n };\n }\n}\n"],"file":"main/main.js"} \ No newline at end of file +{"version":3,"mappings":"22BAAO,SAASA,EAAYC,EAAc,CACxC,OAAO,OAAOA,GAAS,SACnBA,EACG,cACA,QAAQ,cAAe,GAAG,EAC1B,QAAQ,MAAO,GAAG,EAClB,QAAQ,SAAU,EAAE,EACvB,EACN,CCNa,MAAAC,EAAa,CAACC,EAAsBC,IAAoB,CACnEA,EAAQ,MAAM,GAAG,EAAE,QAASC,GAAM,CAChCF,EAAQ,UAAU,IAAIH,EAAYK,EAAE,KAAM,EAAC,EAC5C,CACH,ECNgB,SAAAC,EAAYL,EAAcM,EAAM,SAAU,CACxD,MAAMC,EAAOP,GAAQA,EAAK,SAAS,GAAG,EAAI,WAAa,OAGjDQ,EADH,CAAC,GAAGF,EAAI,KAAK,iBAAiB,QAAQC,CAAI,KAAKP,CAAI,IAAI,CAAC,EAExD,IAAKS,GACGA,EAAE,OACV,EACA,KAAK,IAAI,EACL,OAAAD,EAAK,OAASA,EAAO,EAC9B,CCHO,SAASE,EAAYV,EAAc,CACjC,OAAAD,EAAYC,CAAI,EAAE,QAAQ,YAAcW,GAAMA,EAAE,CAAC,EAAE,YAAa,EACzE,CCGA,MAAMC,CAAa,CAMjB,gBAAgBC,EAAqC,CACnD,MAAMC,EAA2B,GACjC,OAAAD,EAAM,iBAAiB,cAAc,EAAE,QAASE,GAAQ,CACtD,GAAIA,EAAI,SAAU,CAChB,MAAMC,EAAO,CAAC,GAAGD,EAAI,QAAQ,EACzB,GAAAC,EAAK,CAAC,EAAG,CACL,MAAAC,EAAMD,EAAK,CAAC,EACZhB,EAAOD,EAAYiB,EAAK,CAAC,EAAE,aAAe,EAAE,EAClD,IAAIE,EAAa,GACb,GAAAD,EAAI,cAAc,GAAG,EAAG,CAC1B,MAAME,EAAK,CAAC,GAAGF,EAAI,iBAAiB,GAAG,CAAC,EACpCE,EAAG,SAAW,EACRD,EAAAC,EAAG,CAAC,E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K,CACnB,CAEJ,CA6BQ,oBAAoBtB,EAAmB,CACvC,MAAAuB,EAAmB,SAAS,cAAc,KAAK,EACpCA,EAAA,UAAU,IAAI,SAAS,EACvBA,EAAA,aAAa,KAAM,SAAS,EAC7CvB,EAAK,MAAMuB,CAAgB,CAC7B,CAEQ,kBAAkBvB,EAAmB,CAC3C,MAAMwB,EAAWxB,EAAK,UACjBA,EAAA,UAAY,sBAAsBwB,CAAQ,QACjD,CAIQ,0BAA2B,CAC3B,MAAAC,EAAW7C,EAAY,UAAU,EACnC6C,GAAqBjD,EAAA,SAAS,KAAMiD,CAAQ,EAC1C,MAAAC,EAAQ9C,EAAY,OAAO,EAC7B8C,GAAkBlD,EAAA,SAAS,KAAMkD,CAAK,CAC5C,CA+BF,EAEC,gBAAkB,CACX,MAAArB,EAAe,IAAIlB,EACnB4B,EAAiB,IAAIX,EAAeC,CAAY,EAEtD,MADa,IAAIS,EAAKC,EAAgBV,CAAY,EACvC,MACb,GAAG","names":["toClassName","name","addClasses","element","classes","c","getMetadata","doc","attr","meta","m","toCamelCase","g","BlockService","block","config","row","cols","col","value","as","a","imgs","img","ps","p","main","shortBlockName","blockWrapper","section","SectionService","blockService","container","sectionMeta","key","style","wrappers","defaultContent","e","wrapper","Main","sectionService","body","components","blocks","component","componentModule","scriptEl","error","sidebarContainer","children","template","theme"],"sources":["../../src/utils/toClassName.ts","../../src/utils/addClasses.ts","../../src/utils/getMetadata.ts","../../src/utils/toCamelCase.ts","../../src/main.ts"],"sourcesContent":["export function toClassName(name: string) {\n return typeof name === 'string'\n ? name\n .toLowerCase()\n .replace(/[^0-9a-z]/gi, '-')\n .replace(/-+/g, '-')\n .replace(/^-|-$/g, '')\n : '';\n}\n","import { toClassName } from './toClassName';\n\nexport const addClasses = (element: HTMLElement, classes: string) => {\n classes.split(',').forEach((c) => {\n element.classList.add(toClassName(c.trim()));\n });\n};\n","export function getMetadata(name: string, doc = document) {\n const attr = name && name.includes(':') ? 'property' : 'name';\n const metaTags: HTMLMetaElement[] =\n ([...doc.head.querySelectorAll(`meta[${attr}=\"${name}\"]`)] as HTMLMetaElement[]) || [];\n const meta = metaTags\n .map((m) => {\n return m.content;\n })\n .join(', ');\n return meta.length ? meta : '';\n}\n","import { toClassName } from './toClassName';\n\n/**\n * Sanitizes a string for use as a js property name.\n * @param {string} name The unsanitized string\n * @returns {string} The camelCased name\n */\nexport function toCamelCase(name: string) {\n return toClassName(name).replace(/-([a-z])/g, (g) => g[1].toUpperCase());\n}\n","// const LCP_BLOCKS: string[] = []; // add your LCP blocks to the list\n\nimport { addClasses } from '../src/utils/addClasses';\nimport { getMetadata } from '../src/utils/getMetadata';\nimport { toCamelCase } from '../src/utils/toCamelCase';\nimport { toClassName } from '../src/utils/toClassName';\n\ntype ComponentMapping = {\n name: string;\n element: HTMLDivElement;\n};\n\nclass BlockService {\n /**\n * Extracts the config from a block.\n * @param {Element} block The block element\n * @returns {object} The block config\n */\n readBlockConfig(block: Element): Record {\n const config: Record = {};\n block.querySelectorAll(':scope > div').forEach((row) => {\n if (row.children) {\n const cols = [...row.children];\n if (cols[1]) {\n const col = cols[1];\n const name = toClassName(cols[0].textContent ?? '');\n let value: any = '';\n if (col.querySelector('a')) {\n const as = [...col.querySelectorAll('a')];\n if (as.length === 1) {\n value = as[0].href;\n } else {\n value = as.map((a) => a.href);\n }\n } else if (col.querySelector('img')) {\n const imgs = [...col.querySelectorAll('img')];\n if (imgs.length === 1) {\n value = imgs[0].src;\n } else {\n value = imgs.map((img) => img.src);\n }\n } else if (col.querySelector('p')) {\n const ps = [...col.querySelectorAll('p')];\n if (ps.length === 1) {\n value = ps[0].textContent;\n } else {\n value = ps.map((p) => p.textContent);\n }\n } else value = row.children[1].textContent;\n config[name] = value;\n }\n }\n });\n return config;\n }\n\n /**\n * Decorates all blocks in a container element.\n * @param {Element} main The container element\n */\n decorateBlocks(main: HTMLElement) {\n main.querySelectorAll('div.section > div > div').forEach(this.decorateBlock);\n }\n\n /**\n * Decorates a block.\n * @param {Element} block The block element\n */\n private decorateBlock(block: HTMLElement) {\n const shortBlockName = block.classList[0];\n if (shortBlockName) {\n block.classList.add('block');\n block.dataset.blockName = shortBlockName;\n const blockWrapper = block.parentElement;\n blockWrapper?.classList.add(`${shortBlockName}-wrapper`);\n const section = block.closest('.section');\n if (section) section.classList.add(`${shortBlockName}-container`);\n }\n }\n}\n\nclass SectionService {\n constructor(private blockService: BlockService) {}\n\n init(container: HTMLElement) {\n this.transformSection(container);\n }\n\n /**\n * Decorates all sections in a container element.\n * @param {Element} main The container element\n */\n private transformSection(main: HTMLElement) {\n main.querySelectorAll(':scope > div').forEach((section) => {\n this.adjustMarkup(section);\n this.processSectionMetaData(section);\n });\n }\n\n private processSectionMetaData(section: HTMLElement) {\n // Process section metadata\n const sectionMeta = section.querySelector('div.section-metadata');\n if (sectionMeta) {\n const meta = this.blockService.readBlockConfig(sectionMeta);\n Object.keys(meta).forEach((key) => {\n if (key === 'style') {\n const styles = meta.style\n .split(',')\n .filter((style: string) => style)\n .map((style: string) => toClassName(style.trim()));\n styles.forEach((style: string) => section.classList.add(style));\n } else {\n section.dataset[toCamelCase(key)] = meta[key];\n }\n });\n if (sectionMeta.parentElement) sectionMeta.parentElement.remove();\n }\n }\n\n private adjustMarkup(section: HTMLDivElement) {\n const wrappers: HTMLDivElement[] = [];\n let defaultContent = false;\n [...section.children].forEach((e) => {\n if (e.tagName === 'DIV' || !defaultContent) {\n const wrapper = document.createElement('div');\n wrappers.push(wrapper);\n defaultContent = e.tagName !== 'DIV';\n if (defaultContent) wrapper.classList.add('default-content-wrapper');\n }\n wrappers[wrappers.length - 1].append(e);\n });\n wrappers.forEach((wrapper) => section.append(wrapper));\n section.classList.add('section');\n section.dataset.sectionStatus = 'initialized';\n section.style.display = 'none';\n }\n}\n\nclass Main {\n constructor(\n private sectionService: SectionService,\n private blockService: BlockService\n ) {}\n\n init = async () => {\n this.setup();\n await this.loadEager();\n };\n\n /**\n * Setup block utils.\n */\n private setup() {\n window.hlx = window.hlx || {};\n window.hlx.RUM_MASK_URL = 'full';\n window.hlx.codeBasePath = '';\n window.hlx.lighthouse = new URLSearchParams(window.location.search).get('lighthouse') === 'on';\n\n const scriptEl = document.querySelector('script[src$=\"/scripts/scripts.js\"]') as HTMLScriptElement;\n if (scriptEl) {\n try {\n [window.hlx.codeBasePath] = new URL(scriptEl.src).pathname.split('/scripts/scripts.js');\n } catch (error) {\n // eslint-disable-next-line no-console\n console.log(error);\n }\n }\n }\n\n private loadEager = async () => {\n // TODO: how to support different languages here\n document.documentElement.lang = 'en';\n this.decorateTemplateAndTheme();\n if (document) {\n const body = document.querySelector('body');\n if (body) {\n body.style.display = 'none';\n }\n }\n const main = document.querySelector('main');\n if (main) {\n main.setAttribute('id', 'main');\n this.addSidebarContainer(main);\n this.sectionService.init(main);\n this.addInnerContainer(main); // TODO refactor initializing\n this.blockService.decorateBlocks(main);\n await this.loadComponents();\n // TODO: Performace adjustment\n setTimeout(() => {\n document.body.removeAttribute('style');\n }, 200);\n\n // await this.waitForLCP(LCP_BLOCKS);\n }\n };\n\n private addSidebarContainer(main: HTMLElement) {\n const sidebarContainer = document.createElement('div');\n sidebarContainer.classList.add('sidebar');\n sidebarContainer.setAttribute('id', 'sidebar');\n main.after(sidebarContainer);\n }\n\n private addInnerContainer(main: HTMLElement) {\n const children = main.innerHTML;\n main.innerHTML = `
${children}
`;\n }\n\n // private loadLazy = async () => {};\n\n private decorateTemplateAndTheme() {\n const template = getMetadata('template');\n if (template) addClasses(document.body, template);\n const theme = getMetadata('theme');\n if (theme) addClasses(document.body, theme);\n }\n\n private loadComponents = async () => {\n const sections = document.querySelectorAll('.section');\n sections.forEach((section) => {\n const components: ComponentMapping[] = [];\n const blocks = section.querySelectorAll('[data-block-name]');\n if (!blocks.length) {\n section.style.removeProperty('display');\n return;\n }\n blocks.forEach((block: HTMLDivElement) => {\n block.style.display = 'none';\n components.push({\n name: block.dataset['blockName'] as string,\n element: block,\n });\n });\n if (components.length) {\n components.forEach(async (component) => {\n const componentModule = await import(\n `${window.hlx.codeBasePath}/dist/${component.name}/${component.name}.js`\n );\n if (componentModule.default) {\n await componentModule.default(component.element);\n }\n });\n }\n section.style.removeProperty('display');\n });\n };\n}\n\n(async function () {\n const blockService = new BlockService();\n const sectionService = new SectionService(blockService);\n const main = new Main(sectionService, blockService);\n await main.init();\n})();\n\n// /**\n// * Loads JS and CSS for a block.\n// * @param {Element} block The block element\n// */\n// async function loadBlock(block) {\n// const status = block.dataset.blockStatus;\n// if (status !== 'loading' && status !== 'loaded') {\n// block.dataset.blockStatus = 'loading';\n// const { blockName } = block.dataset;\n// try {\n// const cssLoaded = loadCSS(`${window.hlx.codeBasePath}/blocks/${blockName}/${blockName}.css`);\n// const decorationComplete = new Promise((resolve) => {\n// (async () => {\n// try {\n// const mod = await import(`${window.hlx.codeBasePath}/blocks/${blockName}/${blockName}.js`);\n// if (mod.default) {\n// await mod.default(block);\n// }\n// } catch (error) {\n// // eslint-disable-next-line no-console\n// console.log(`failed to load module for ${blockName}`, error);\n// }\n// resolve();\n// })();\n// });\n// await Promise.all([cssLoaded, decorationComplete]);\n// } catch (error) {\n// // eslint-disable-next-line no-console\n// console.log(`failed to load block ${blockName}`, error);\n// }\n// block.dataset.blockStatus = 'loaded';\n// }\n// return block;\n// }\n\ndeclare global {\n interface Window {\n hlx: {\n RUM_MASK_URL: string;\n codeBasePath: string;\n lighthouse: boolean;\n };\n }\n}\n"],"file":"main/main.js"} \ No newline at end of file diff --git a/dist/posts/posts.js b/dist/posts/posts.js index b28dc4b6..e4eedfb8 100644 --- a/dist/posts/posts.js +++ b/dist/posts/posts.js @@ -1,2 +1,11 @@ -import{j as h,x as m}from"../__chunks__/lit-element.XkUWx5ik.js";const u=t=>{const{postUrl:s,headline:o,text:r}=t;return m``},w=t=>t.map(s=>u(s));async function P(t){t.innerHTML="";const r=(await(await fetch(`${window.hlx.codeBasePath}/query-index.json`)).json()).data.filter(e=>e.path.includes("/posts")).map(e=>e.path),n=(await Promise.all(r.map(e=>fetch(`${window.hlx.codeBasePath}${e}.plain.html`)))).map(e=>{var a=new DOMParser;return a.parseFromString(e.text(),"text/html")});console.log("postsPreviewHtml",n);const l=n.map((e,a)=>{var i,p,c;return console.log("doc",e),{postUrl:`${window.hlx.codeBasePath}${r[a]}.html`,headline:((i=e.querySelector("h1"))==null?void 0:i.innerText)||((p=e.querySelector("h2"))==null?void 0:p.innerText),text:(c=e.querySelector("p"))==null?void 0:c.innerText}});console.log("posts",l),t.style.removeProperty("display"),h(w(l),t)}export{P as default}; +import{j as h,x as m}from"../__chunks__/lit-element.XkUWx5ik.js";const u=t=>{const{postUrl:s,headline:n,text:r}=t;return m` +
+ +

${n}

+

${r==null?void 0:r.slice(0,200)}

+ +
+ `},w=t=>t.map(s=>u(s));async function y(t){t.innerHTML="";const r=(await(await fetch(`${window.hlx.codeBasePath}/query-index.json`)).json()).data.filter(e=>e.path.includes("/posts")).map(e=>e.path),c=(await Promise.all(r.map(async e=>(await fetch(`${window.hlx.codeBasePath}${e}.plain.html`)).text()))).map(e=>{var a=new DOMParser;return a.parseFromString(e,"text/html")}).map((e,a)=>{var o,i,l,p;return{postUrl:`${window.hlx.codeBasePath}${r[a]}`,headline:((o=e.querySelector("h1"))==null?void 0:o.innerText)||((i=e.querySelector("h2"))==null?void 0:i.innerText),text:(p=(l=e.querySelector("p"))==null?void 0:l.innerText)==null?void 0:p.trim()}});t.style.removeProperty("display"),h(w(c),t)}export{y as default}; //# sourceMappingURL=posts.js.map diff --git a/dist/posts/posts.js.map b/dist/posts/posts.js.map index 723e80a1..232813cb 100644 --- a/dist/posts/posts.js.map +++ b/dist/posts/posts.js.map @@ -1 +1 @@ -{"version":3,"file":"posts.js","sources":["../../src/blocks/posts/posts.ts"],"sourcesContent":["import { html, render } from 'lit';\n\ninterface PostArgs {\n postUrl: string;\n headline?: string;\n text?: string;\n}\n\nconst postTemplate = (args: PostArgs) => {\n const { postUrl, headline, text } = args;\n return html`\n
\n \"\"\n

${headline}

\n

${text}

\n \n
\n `;\n};\n\nconst template = (posts: PostArgs[]) => {\n return posts.map((post) => postTemplate(post));\n};\n\nexport default async function (block: HTMLElement) {\n block.innerHTML = '';\n\n const req = await fetch(`${window.hlx.codeBasePath}/query-index.json`);\n const response = await req.json();\n const data = response.data\n .filter((item) => {\n return item.path.includes('/posts');\n })\n .map((item) => item.path);\n\n const postsPreview = await Promise.all(data.map((path) => fetch(`${window.hlx.codeBasePath}${path}.plain.html`)));\n\n const postsPreviewHtml = postsPreview.map((res) => {\n var parser = new DOMParser();\n return parser.parseFromString(res.text(), 'text/html');\n });\n\n console.log('postsPreviewHtml', postsPreviewHtml);\n\n const posts = postsPreviewHtml.map((doc, index) => {\n console.log('doc', doc);\n return {\n postUrl: `${window.hlx.codeBasePath}${data[index]}.html`,\n headline: doc.querySelector('h1')?.innerText || doc.querySelector('h2')?.innerText,\n text: doc.querySelector('p')?.innerText,\n };\n });\n\n console.log('posts', posts);\n\n block.style.removeProperty('display');\n render(template(posts), block);\n}\n"],"names":["postTemplate","args","postUrl","headline","text","html","template","posts","post","block","data","item","postsPreviewHtml","path","res","parser","doc","index","_a","_b","_c","render"],"mappings":"iEAQA,MAAMA,EAAgBC,GAAmB,CACvC,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,KAAAC,CAAA,EAASH,EAC7B,OAAAI,sBAEQH,CAAO,8DACZC,CAAQ,WACTC,CAAI,wCAEQF,CAAO,+CAI9B,EAEMI,EAAYC,GACTA,EAAM,IAAKC,GAASR,EAAaQ,CAAI,CAAC,EAG/C,eAAAD,EAA+BE,EAAoB,CACjDA,EAAM,UAAY,GAIlB,MAAMC,GADW,MADL,MAAM,MAAM,GAAG,OAAO,IAAI,YAAY,mBAAmB,GAC1C,QACL,KACnB,OAAQC,GACAA,EAAK,KAAK,SAAS,QAAQ,CACnC,EACA,IAAKA,GAASA,EAAK,IAAI,EAIpBC,GAFe,MAAM,QAAQ,IAAIF,EAAK,IAAKG,GAAS,MAAM,GAAG,OAAO,IAAI,YAAY,GAAGA,CAAI,aAAa,CAAC,CAAC,GAE1E,IAAKC,GAAQ,CAC7C,IAAAC,EAAS,IAAI,UACjB,OAAOA,EAAO,gBAAgBD,EAAI,OAAQ,WAAW,CAAA,CACtD,EAEO,QAAA,IAAI,mBAAoBF,CAAgB,EAEhD,MAAML,EAAQK,EAAiB,IAAI,CAACI,EAAKC,IAAU,WACzC,eAAA,IAAI,MAAOD,CAAG,EACf,CACL,QAAS,GAAG,OAAO,IAAI,YAAY,GAAGN,EAAKO,CAAK,CAAC,QACjD,WAAUC,EAAAF,EAAI,cAAc,IAAI,IAAtB,YAAAE,EAAyB,cAAaC,EAAAH,EAAI,cAAc,IAAI,IAAtB,YAAAG,EAAyB,WACzE,MAAMC,EAAAJ,EAAI,cAAc,GAAG,IAArB,YAAAI,EAAwB,SAAA,CAChC,CACD,EAEO,QAAA,IAAI,QAASb,CAAK,EAEpBE,EAAA,MAAM,eAAe,SAAS,EAC7BY,EAAAf,EAASC,CAAK,EAAGE,CAAK,CAC/B"} \ No newline at end of file +{"version":3,"file":"posts.js","sources":["../../src/blocks/posts/posts.ts"],"sourcesContent":["import { html, render } from 'lit';\n\ninterface PostArgs {\n postUrl: string;\n headline?: string;\n text?: string;\n}\n\nconst postTemplate = (args: PostArgs) => {\n const { postUrl, headline, text } = args;\n return html`\n
\n \n

${headline}

\n

${text?.slice(0, 200)}

\n \n
\n `;\n};\n\nconst template = (posts: PostArgs[]) => {\n return posts.map((post) => postTemplate(post));\n};\n\nexport default async function (block: HTMLElement) {\n block.innerHTML = '';\n\n const req = await fetch(`${window.hlx.codeBasePath}/query-index.json`);\n const response = await req.json();\n const data = response.data\n .filter((item) => {\n return item.path.includes('/posts');\n })\n .map((item) => item.path);\n\n const postsPreview = await Promise.all(\n data.map(async (path) => {\n const result = await fetch(`${window.hlx.codeBasePath}${path}.plain.html`);\n return result.text();\n })\n );\n\n const postsPreviewHtml = postsPreview.map((res) => {\n var parser = new DOMParser();\n return parser.parseFromString(res, 'text/html');\n });\n\n const posts = postsPreviewHtml.map((doc, index) => {\n return {\n postUrl: `${window.hlx.codeBasePath}${data[index]}`,\n headline: doc.querySelector('h1')?.innerText || doc.querySelector('h2')?.innerText,\n text: doc.querySelector('p')?.innerText?.trim(),\n };\n });\n\n block.style.removeProperty('display');\n render(template(posts), block);\n}\n"],"names":["postTemplate","args","postUrl","headline","text","html","template","posts","post","block","data","item","path","res","parser","doc","index","_a","_b","_d","_c","render"],"mappings":"iEAQA,MAAMA,EAAgBC,GAAmB,CACvC,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,KAAAC,CAAA,EAASH,EAC7B,OAAAI;AAAAA;AAAAA,sBAEaH,CAAO;AAAA,YACjBC,CAAQ;AAAA,WACTC,GAAA,YAAAA,EAAM,MAAM,EAAG,IAAI;AAAA;AAAA,uBAEPF,CAAO;AAAA;AAAA;AAAA,GAI9B,EAEMI,EAAYC,GACTA,EAAM,IAAKC,GAASR,EAAaQ,CAAI,CAAC,EAG/C,eAAAD,EAA+BE,EAAoB,CACjDA,EAAM,UAAY,GAIlB,MAAMC,GADW,MADL,MAAM,MAAM,GAAG,OAAO,IAAI,YAAY,mBAAmB,GAC1C,QACL,KACnB,OAAQC,GACAA,EAAK,KAAK,SAAS,QAAQ,CACnC,EACA,IAAKA,GAASA,EAAK,IAAI,EAcpBJ,GAZe,MAAM,QAAQ,IACjCG,EAAK,IAAI,MAAOE,IACC,MAAM,MAAM,GAAG,OAAO,IAAI,YAAY,GAAGA,CAAI,aAAa,GAC3D,MACf,CAAA,GAGmC,IAAKC,GAAQ,CAC7C,IAAAC,EAAS,IAAI,UACV,OAAAA,EAAO,gBAAgBD,EAAK,WAAW,CAAA,CAC/C,EAE8B,IAAI,CAACE,EAAKC,IAAU,aAC1C,MAAA,CACL,QAAS,GAAG,OAAO,IAAI,YAAY,GAAGN,EAAKM,CAAK,CAAC,GACjD,WAAUC,EAAAF,EAAI,cAAc,IAAI,IAAtB,YAAAE,EAAyB,cAAaC,EAAAH,EAAI,cAAc,IAAI,IAAtB,YAAAG,EAAyB,WACzE,MAAMC,GAAAC,EAAAL,EAAI,cAAc,GAAG,IAArB,YAAAK,EAAwB,YAAxB,YAAAD,EAAmC,MAAK,CAChD,CACD,EAEKV,EAAA,MAAM,eAAe,SAAS,EAC7BY,EAAAf,EAASC,CAAK,EAAGE,CAAK,CAC/B"} \ No newline at end of file diff --git a/head.html b/head.html index 19de3c27..4ce22cb6 100644 --- a/head.html +++ b/head.html @@ -1,3 +1,4 @@ + diff --git a/src/blocks/banner/banner.ts b/src/blocks/banner/banner.ts index 0c33f262..e820bebe 100644 --- a/src/blocks/banner/banner.ts +++ b/src/blocks/banner/banner.ts @@ -10,6 +10,9 @@ interface TemplateArgs { } const template = ({ headline, subline, texts, buttons, picture }: TemplateArgs) => { + // if (picture) { + // picture.querySelector('img')?.removeAttribute('loading'); + // } return html`