@everymatrix/blog-articles-grid 1.10.6
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/blog-articles-grid/blog-articles-grid.esm.js +1 -0
- package/dist/blog-articles-grid/index.esm.js +0 -0
- package/dist/blog-articles-grid/p-73f0e79a.entry.js +1 -0
- package/dist/blog-articles-grid/p-f6930cad.js +1 -0
- package/dist/cjs/blog-articles-grid.cjs.entry.js +168 -0
- package/dist/cjs/blog-articles-grid.cjs.js +19 -0
- package/dist/cjs/index-2ef46f05.js +1177 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/blog-articles-grid/blog-articles-grid.css +126 -0
- package/dist/collection/components/blog-articles-grid/blog-articles-grid.js +425 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +24 -0
- package/dist/collection/utils/utils.js +0 -0
- package/dist/components/blog-articles-grid.d.ts +11 -0
- package/dist/components/blog-articles-grid.js +200 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/blog-articles-grid.entry.js +164 -0
- package/dist/esm/blog-articles-grid.js +17 -0
- package/dist/esm/index-3cf2add0.js +1151 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/blog-articles-grid/.stencil/packages/blog-articles-grid/stencil.config.d.ts +2 -0
- package/dist/types/components/blog-articles-grid/blog-articles-grid.d.ts +74 -0
- package/dist/types/components.d.ts +150 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +0 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +23 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,b as s}from"./p-f6930cad.js";(()=>{const s=import.meta.url,e={};return""!==s&&(e.resourcesUrl=new URL(".",s).href),t(e)})().then((t=>s([["p-73f0e79a",[[1,"blog-articles-grid",{cmsEndpoint:[1,"cms-endpoint"],language:[1],handleClick:[1,"handle-click"],clientStyling:[1,"client-styling"],clientStylingurl:[1,"client-stylingurl"],clientStylingUrlContent:[1,"client-styling-url-content"],showPublishingDate:[4,"show-publishing-date"],showImage:[4,"show-image"],showTitle:[4,"show-title"],showContent:[4,"show-content"],showButton:[4,"show-button"],showVerticalGrid:[4,"show-vertical-grid"],usePostmessage:[4,"use-postmessage"],postMessageEvent:[1,"post-message-event"],hasErrors:[32],limitStylingAppends:[32],isLoading:[32]}]]]],t)));
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,c as r,h as i}from"./p-f6930cad.js";const t=["ro","en","fr","ar"],o={en:{error:"Error",readmore:"Read more"},ro:{error:"Eroare",readmore:"Read more"},fr:{error:"Error",readmore:"Read more"},ar:{error:"خطأ",readmore:"Read more"}},e=(n,r)=>{const i=r;return o[void 0!==i&&t.includes(i)?i:"en"][n]},s=class{constructor(i){n(this,i),this.articleActionButton=r(this,"articleActionButton",7),this.language="en",this.clientStyling="",this.clientStylingurl="",this.clientStylingUrlContent="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.showVerticalGrid=!1,this.postMessageEvent="articleActionButton",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.setClientStyling=()=>{let n=document.createElement("style");n.innerHTML=this.clientStyling,this.stylingContainer.prepend(n)},this.setClientStylingURL=()=>{let n=new URL(this.clientStylingurl),r=document.createElement("style");fetch(n.href).then((n=>n.text())).then((n=>{this.clientStylingUrlContent=n,r.innerHTML=n,setTimeout((()=>{this.stylingContainer.prepend(r)}),1)})).catch((n=>{console.log("error ",n)}))}}getArticleId(n){this.articleActionButton.emit({postId:n}),this.usePostmessage&&window.postMessage({type:this.postMessageEvent,postId:n})}connectedCallback(){this.getBlogArticleDetails()}toggleClass(){this.showVerticalGrid=!this.showVerticalGrid}handleAction(n){this.getArticleId(n)}getBlogArticleDetails(){this.isLoading=!0;let n=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);fetch(n.href).then((n=>{if(n.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return n.json()})).then((n=>{this.blogData=n,this.isLoading=!1})).catch((n=>{this.hasErrors=!0,console.log("Error",n)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){return this.hasErrors?i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},e("error",this.language))):this.isLoading?void 0:i("div",null,i("div",{ref:n=>this.stylingContainer=n},this.blogData.map((n=>i("div",{class:"GridContainer"},this.showPublishingDate&&i("div",{class:"BlogDate"},n.publishingDate),this.showImage&&i("div",{class:"BlogBanner"},i("img",{src:n.image,alt:n.title})),this.showTitle&&i("div",{class:"BlogTitle"},n.title),this.showContent&&i("div",{class:"BlogContent",innerHTML:n.content}),this.showButton&&i("div",{class:"BlogLink"},i("button",{onClick:()=>this.handleAction(n.postID)},e("readmore",this.language))))))))}};s.style=":host {\n display: block;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";export{s as blog_articles_grid}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,d=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?$(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=$(e,null);return i.u=t,r.length>0&&(i.$=r),i},$=(e,t)=>({t:0,h:e,i:t,m:null,$:null,u:null}),h={},m=(e,t,n,s,r,c)=>{if(n!==s){let i=z(e,t),u=t.toLowerCase();if("class"===t){const t=e.classList,l=p(n),o=p(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("ref"===t)s&&s(e);else if(i||"o"!==t[0]||"n"!==t[1]){const l=f(s);if((i||l&&null!==s)&&!r)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&c||r)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):z(l,u)?u.slice(2):u[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},y=/\s/,p=e=>e?e.split(y):[],b=(e,t,n,l)=>{const s=11===t.m.nodeType&&t.m.host?t.m.host:t.m,o=e&&e.u||a,r=t.u||a;for(l in o)l in r||m(s,l,o[l],void 0,n,t.t);for(l in r)m(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{let o,r,c=n.$[l],i=0;if(null!==c.i)o=c.m=s.createTextNode(c.i);else if(o=c.m=s.createElement(c.h),b(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.$)for(i=0;i<c.$.length;++i)r=w(t,c,i),r&&o.appendChild(r);return o},S=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=w(null,l,o),c&&(s[o].m=c,i.insertBefore(c,n)))},g=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.m,M(l),s.remove())},j=(e,t)=>e.h===t.h,v=(e,t)=>{const n=t.m=e.m,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],d=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==d?d=l[--a]:j(i,f)?(v(i,f),i=t[++o],f=l[++r]):j(u,d)?(v(u,d),u=t[--c],d=l[--a]):j(i,d)?(v(i,d),e.insertBefore(i.m,u.m.nextSibling),i=t[++o],d=l[--a]):j(u,f)?(v(u,f),e.insertBefore(u.m,i.m),u=t[--c],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&i.m.parentNode.insertBefore(s,i.m));o>c?S(e,null==l[a+1]?null:l[a+1].m,n,l,r,a):r>a&&g(t,o,c)})(n,l,t,s):null!==s?(null!==e.i&&(n.textContent=""),S(n,null,t,s,0,s.length-1)):null!==l&&g(l,0,l.length-1)):e.i!==o&&(n.data=o)},M=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(M)},k=(e,t,n)=>{const l=(e=>H(e).p)(e);return{emit:e=>C(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},C=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},O=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},P=(e,t)=>{if(e.t|=16,!(4&e.t))return O(e,e.g),te((()=>x(e,t)));e.t|=512},x=(e,t)=>{const n=e.j;return L(void 0,(()=>E(e,n,t)))},E=async(e,t,n)=>{const l=e.p,o=l["s-rc"];n&&(e=>{const t=e.v,n=e.p,l=t.t,o=((e,t)=>{let n=u(t),l=J.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=i.get(e=e.head||e);o||i.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);N(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>R(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},N=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.p,o=n.M||$(null,null),r=(e=>e&&e.h===h)(l)?l:d(null,null,l);t=s.tagName,r.h=null,r.t|=4,n.M=r,r.m=o.m=s.shadowRoot||s,e=s["s-sc"],v(o,r)})(n,l)}catch(e){B(e,n.p)}return null},R=e=>{const t=e.p,n=e.g;A(e.j,"componentDidRender"),64&e.t||(e.t|=64,U(t),e.k(t),n||T()),e.S&&(e.S(),e.S=void 0),512&e.t&&ee((()=>P(e,!1))),e.t&=-517},T=()=>{U(s.documentElement),ee((()=>C(l,"appload",{detail:{namespace:"blog-articles-grid"}})))},A=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){B(e)}},L=(e,t)=>e&&e.then?e.then(t):t(),U=e=>e.classList.add("hydrated"),W=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>H(this).O.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=H(e),o=s.O.get(t),r=s.t,c=s.j;n=((e,t)=>null==e||f(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.O.set(t,n),c&&2==(18&r)&&P(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},q=e=>{A(e,"connectedCallback")},D=(e,t={})=>{const n=[],r=t.exclude||[],i=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),d=s.createElement("style"),$=[];let h,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],o:t[1],C:t[2],P:t[3]};l.C=t[2];const s=l.o,a=class extends HTMLElement{constructor(e){super(e),_(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),m?$.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=H(e),n=t.v,l=()=>{};if(1&t.t)q(t.j);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){O(t,t.g=n);break}}n.C&&Object.entries(n.C).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=I(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(W(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){B(e)}t.t&=-9,e(),q(t.j)}if(s.style){let e=s.style;const t=u(n);if(!J.has(t)){const l=()=>{};((e,t,n)=>{let l=J.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,J.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.g,r=()=>P(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return H(this).N}};l.R=e[0],r.includes(s)||i.get(s)||(n.push(s),i.define(s,W(a,l,1)))}))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),a.insertBefore(d,f?f.nextSibling:a.firstChild),m=!1,$.length?$.map((e=>e.connectedCallback())):o.jmp((()=>h=setTimeout(T,30)))},F=new WeakMap,H=e=>F.get(e),V=(e,t)=>F.set(t.j=e,t),_=(e,t)=>{const n={t:0,p:e,v:t,O:new Map};return n.N=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],F.set(e,n)},z=(e,t)=>t in e,B=(e,t)=>(0,console.error)(e,t),G=new Map,I=e=>{const t=e.o.replace(/-/g,"_"),n=e.R,l=G.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(G.set(n,e),e[t])),B)},J=new Map,K=[],Q=[],X=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?ee(Z):o.raf(Z))},Y=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){B(e)}e.length=0},Z=()=>{Y(K),Y(Q),(n=K.length>0)&&o.raf(Z)},ee=e=>r().then(e),te=X(Q,!0);export{D as b,k as c,d as h,r as p,V as r}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-2ef46f05.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
|
|
9
|
+
const TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
error: 'Error',
|
|
12
|
+
readmore: 'Read more',
|
|
13
|
+
},
|
|
14
|
+
ro: {
|
|
15
|
+
error: 'Eroare',
|
|
16
|
+
readmore: 'Read more',
|
|
17
|
+
},
|
|
18
|
+
fr: {
|
|
19
|
+
error: 'Error',
|
|
20
|
+
readmore: 'Read more',
|
|
21
|
+
},
|
|
22
|
+
ar: {
|
|
23
|
+
error: 'خطأ',
|
|
24
|
+
readmore: 'Read more',
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const translate = (key, customLang) => {
|
|
28
|
+
const lang = customLang;
|
|
29
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";
|
|
33
|
+
|
|
34
|
+
const BlogArticlesGrid = class {
|
|
35
|
+
constructor(hostRef) {
|
|
36
|
+
index.registerInstance(this, hostRef);
|
|
37
|
+
this.articleActionButton = index.createEvent(this, "articleActionButton", 7);
|
|
38
|
+
/**
|
|
39
|
+
* Language of the widget
|
|
40
|
+
*/
|
|
41
|
+
this.language = 'en';
|
|
42
|
+
/**
|
|
43
|
+
* Client custom styling via string
|
|
44
|
+
*/
|
|
45
|
+
this.clientStyling = '';
|
|
46
|
+
/**
|
|
47
|
+
* Client custom styling via url
|
|
48
|
+
*/
|
|
49
|
+
this.clientStylingurl = '';
|
|
50
|
+
/**
|
|
51
|
+
* Client custom styling via url content
|
|
52
|
+
*/
|
|
53
|
+
this.clientStylingUrlContent = '';
|
|
54
|
+
/**
|
|
55
|
+
* Property used to display the publishing date
|
|
56
|
+
*/
|
|
57
|
+
this.showPublishingDate = true;
|
|
58
|
+
/**
|
|
59
|
+
* Property used to display the image
|
|
60
|
+
*/
|
|
61
|
+
this.showImage = true;
|
|
62
|
+
/**
|
|
63
|
+
* Property used to display the image
|
|
64
|
+
*/
|
|
65
|
+
this.showTitle = true;
|
|
66
|
+
/**
|
|
67
|
+
* Property used to display the description
|
|
68
|
+
*/
|
|
69
|
+
this.showContent = true;
|
|
70
|
+
/**
|
|
71
|
+
* Property used to display the button
|
|
72
|
+
*/
|
|
73
|
+
this.showButton = true;
|
|
74
|
+
/**
|
|
75
|
+
* Property used to display the button
|
|
76
|
+
*/
|
|
77
|
+
this.showVerticalGrid = false;
|
|
78
|
+
/**
|
|
79
|
+
* Event name to be sent when the button is clicked
|
|
80
|
+
*/
|
|
81
|
+
this.postMessageEvent = 'articleActionButton';
|
|
82
|
+
this.hasErrors = false;
|
|
83
|
+
this.limitStylingAppends = false;
|
|
84
|
+
this.isLoading = true;
|
|
85
|
+
this.setClientStyling = () => {
|
|
86
|
+
let sheet = document.createElement('style');
|
|
87
|
+
sheet.innerHTML = this.clientStyling;
|
|
88
|
+
this.stylingContainer.prepend(sheet);
|
|
89
|
+
};
|
|
90
|
+
this.setClientStylingURL = () => {
|
|
91
|
+
let url = new URL(this.clientStylingurl);
|
|
92
|
+
let cssFile = document.createElement('style');
|
|
93
|
+
fetch(url.href)
|
|
94
|
+
.then((res) => res.text())
|
|
95
|
+
.then((data) => {
|
|
96
|
+
this.clientStylingUrlContent = data;
|
|
97
|
+
cssFile.innerHTML = data;
|
|
98
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
99
|
+
})
|
|
100
|
+
.catch((err) => {
|
|
101
|
+
console.log('error ', err);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
getArticleId(postId) {
|
|
106
|
+
this.articleActionButton.emit({ postId });
|
|
107
|
+
if (this.usePostmessage) {
|
|
108
|
+
window.postMessage({ type: this.postMessageEvent, postId });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
connectedCallback() {
|
|
112
|
+
this.getBlogArticleDetails();
|
|
113
|
+
}
|
|
114
|
+
toggleClass() {
|
|
115
|
+
this.showVerticalGrid = !this.showVerticalGrid;
|
|
116
|
+
}
|
|
117
|
+
handleAction(postId) {
|
|
118
|
+
this.getArticleId(postId);
|
|
119
|
+
}
|
|
120
|
+
getBlogArticleDetails() {
|
|
121
|
+
this.isLoading = true;
|
|
122
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
123
|
+
fetch(url.href)
|
|
124
|
+
.then((res) => {
|
|
125
|
+
if (res.status >= 300) {
|
|
126
|
+
this.hasErrors = true;
|
|
127
|
+
throw new Error('There was an error while fetching the data');
|
|
128
|
+
}
|
|
129
|
+
return res.json();
|
|
130
|
+
})
|
|
131
|
+
.then((blogContent) => {
|
|
132
|
+
this.blogData = blogContent;
|
|
133
|
+
this.isLoading = false;
|
|
134
|
+
})
|
|
135
|
+
.catch((err) => {
|
|
136
|
+
this.hasErrors = true;
|
|
137
|
+
console.log('Error', err);
|
|
138
|
+
})
|
|
139
|
+
.finally(() => this.isLoading = false);
|
|
140
|
+
}
|
|
141
|
+
componentDidRender() {
|
|
142
|
+
// start custom styling area
|
|
143
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
144
|
+
if (this.clientStyling)
|
|
145
|
+
this.setClientStyling();
|
|
146
|
+
if (this.clientStylingUrlContent)
|
|
147
|
+
this.setClientStylingURL();
|
|
148
|
+
this.limitStylingAppends = true;
|
|
149
|
+
}
|
|
150
|
+
// end custom styling area
|
|
151
|
+
}
|
|
152
|
+
render() {
|
|
153
|
+
if (this.hasErrors) {
|
|
154
|
+
return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate('error', this.language))));
|
|
155
|
+
}
|
|
156
|
+
if (!this.isLoading) {
|
|
157
|
+
return (index.h("div", null, index.h("div", { ref: el => this.stylingContainer = el }, this.blogData.map((data) => index.h("div", { class: "GridContainer" }, this.showPublishingDate &&
|
|
158
|
+
index.h("div", { class: "BlogDate" }, data.publishingDate), this.showImage &&
|
|
159
|
+
index.h("div", { class: "BlogBanner" }, index.h("img", { src: data.image, alt: data.title })), this.showTitle &&
|
|
160
|
+
index.h("div", { class: "BlogTitle" }, data.title), this.showContent &&
|
|
161
|
+
index.h("div", { class: "BlogContent", innerHTML: data.content }), this.showButton &&
|
|
162
|
+
index.h("div", { class: "BlogLink" }, index.h("button", { onClick: () => this.handleAction(data.postID) }, translate('readmore', this.language))))))));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
BlogArticlesGrid.style = blogArticlesGridCss;
|
|
167
|
+
|
|
168
|
+
exports.blog_articles_grid = BlogArticlesGrid;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-2ef46f05.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('blog-articles-grid.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["blog-articles-grid.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingurl":[1,"client-stylingurl"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"showButton":[4,"show-button"],"showVerticalGrid":[4,"show-vertical-grid"],"usePostmessage":[4,"use-postmessage"],"postMessageEvent":[1,"post-message-event"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32]}]]]], options);
|
|
19
|
+
});
|