@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.
Files changed (47) hide show
  1. package/dist/blog-articles-grid/blog-articles-grid.esm.js +1 -0
  2. package/dist/blog-articles-grid/index.esm.js +0 -0
  3. package/dist/blog-articles-grid/p-73f0e79a.entry.js +1 -0
  4. package/dist/blog-articles-grid/p-f6930cad.js +1 -0
  5. package/dist/cjs/blog-articles-grid.cjs.entry.js +168 -0
  6. package/dist/cjs/blog-articles-grid.cjs.js +19 -0
  7. package/dist/cjs/index-2ef46f05.js +1177 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/blog-articles-grid/blog-articles-grid.css +126 -0
  12. package/dist/collection/components/blog-articles-grid/blog-articles-grid.js +425 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +24 -0
  15. package/dist/collection/utils/utils.js +0 -0
  16. package/dist/components/blog-articles-grid.d.ts +11 -0
  17. package/dist/components/blog-articles-grid.js +200 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/blog-articles-grid.entry.js +164 -0
  21. package/dist/esm/blog-articles-grid.js +17 -0
  22. package/dist/esm/index-3cf2add0.js +1151 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. 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
  35. package/dist/types/components/blog-articles-grid/blog-articles-grid.d.ts +74 -0
  36. package/dist/types/components.d.ts +150 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +1 -0
  40. package/dist/types/utils/utils.d.ts +0 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +23 -0
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-2ef46f05.js');
6
+
7
+ /*
8
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchEsm = () => {
11
+ return index.promiseResolve();
12
+ };
13
+
14
+ const defineCustomElements = (win, options) => {
15
+ if (typeof window === 'undefined') return Promise.resolve();
16
+ return patchEsm().then(() => {
17
+ 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);
18
+ });
19
+ };
20
+
21
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "./components/blog-articles-grid/blog-articles-grid.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "2.15.2",
8
+ "typescriptVersion": "4.5.4"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,126 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .GridContainer {
6
+ margin: auto;
7
+ width: 100%;
8
+ height: 280px;
9
+ border-radius: 15px;
10
+ background-color: #07072A;
11
+ margin-bottom: 20px;
12
+ display: grid;
13
+ gap: 30px;
14
+ grid-template-rows: 1fr 4fr 1fr 1fr;
15
+ grid-template-columns: 30px 1fr 1fr 30px;
16
+ }
17
+ .GridContainer .BlogBanner {
18
+ grid-column: 1/3;
19
+ grid-row: 1/5;
20
+ }
21
+ .GridContainer .BlogBanner img {
22
+ border-radius: 5px 0 0 5px;
23
+ width: 100%;
24
+ height: 280px;
25
+ }
26
+ .GridContainer .BlogDate {
27
+ font-size: 12px;
28
+ border-radius: 5px 5px 0 0;
29
+ padding: 10px;
30
+ width: fit-content;
31
+ text-align: center;
32
+ color: #FFFFFF;
33
+ background-color: #0D0D4D;
34
+ grid-column: 2/2;
35
+ grid-row: 4/4;
36
+ z-index: 1;
37
+ }
38
+ .GridContainer .BlogTitle {
39
+ font-size: 24px;
40
+ color: #FFF;
41
+ margin-top: 20px;
42
+ grid-column: 3/5;
43
+ }
44
+ .GridContainer .BlogContent {
45
+ font-size: 14px;
46
+ color: #FFF;
47
+ width: 90%;
48
+ max-height: 80px;
49
+ overflow: hidden;
50
+ text-overflow: ellipsis;
51
+ grid-column: 3/5;
52
+ }
53
+ .GridContainer .BlogLink {
54
+ grid-column: 3/5;
55
+ color: #FFF;
56
+ }
57
+ .GridContainer .BlogLink button {
58
+ font-size: 14px;
59
+ border: none;
60
+ padding: 0;
61
+ background: none;
62
+ color: #D0046C;
63
+ cursor: pointer;
64
+ }
65
+
66
+ @container (max-width: 475px) {
67
+ .GridContainer {
68
+ margin: auto;
69
+ width: 100%;
70
+ min-height: 400px;
71
+ gap: 10%;
72
+ padding-bottom: 30px;
73
+ border-radius: 5px;
74
+ background-color: #07072A;
75
+ margin-bottom: 20px;
76
+ display: grid;
77
+ grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));
78
+ grid-template-rows: auto auto auto 50px;
79
+ grid-template-columns: 15px auto auto 15px;
80
+ gap: 10px;
81
+ }
82
+ .GridContainer .BlogBanner {
83
+ grid-column: 1/5;
84
+ grid-row: 1/3;
85
+ margin: 0;
86
+ }
87
+ .GridContainer .BlogBanner img {
88
+ width: 100%;
89
+ height: 232px;
90
+ border-radius: 5px 5px 0 0;
91
+ }
92
+ .GridContainer .BlogDate {
93
+ grid-column: 2/3;
94
+ grid-row: 2/3;
95
+ font-size: 12px;
96
+ border-radius: 5px 5px 0 0;
97
+ padding: 10px;
98
+ width: fit-content;
99
+ text-align: center;
100
+ color: #FFFFFF;
101
+ background-color: #0D0D4D;
102
+ z-index: 1;
103
+ }
104
+ .GridContainer .BlogTitle {
105
+ grid-column: 2/4;
106
+ font-size: 24px;
107
+ color: #FFF;
108
+ }
109
+ .GridContainer .BlogContent {
110
+ grid-column: 2/4;
111
+ font-size: 14px;
112
+ color: #FFF;
113
+ }
114
+ .GridContainer .BlogLink {
115
+ grid-column: 2/4;
116
+ color: #FFF;
117
+ cursor: pointer;
118
+ }
119
+ .GridContainer .BlogLink button {
120
+ font-size: 14px;
121
+ border: none;
122
+ background: none;
123
+ color: #D0046C;
124
+ cursor: pointer;
125
+ }
126
+ }
@@ -0,0 +1,425 @@
1
+ import { Component, Prop, State, Event, h } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ export class BlogArticlesGrid {
4
+ constructor() {
5
+ /**
6
+ * Language of the widget
7
+ */
8
+ this.language = 'en';
9
+ /**
10
+ * Client custom styling via string
11
+ */
12
+ this.clientStyling = '';
13
+ /**
14
+ * Client custom styling via url
15
+ */
16
+ this.clientStylingurl = '';
17
+ /**
18
+ * Client custom styling via url content
19
+ */
20
+ this.clientStylingUrlContent = '';
21
+ /**
22
+ * Property used to display the publishing date
23
+ */
24
+ this.showPublishingDate = true;
25
+ /**
26
+ * Property used to display the image
27
+ */
28
+ this.showImage = true;
29
+ /**
30
+ * Property used to display the image
31
+ */
32
+ this.showTitle = true;
33
+ /**
34
+ * Property used to display the description
35
+ */
36
+ this.showContent = true;
37
+ /**
38
+ * Property used to display the button
39
+ */
40
+ this.showButton = true;
41
+ /**
42
+ * Property used to display the button
43
+ */
44
+ this.showVerticalGrid = false;
45
+ /**
46
+ * Event name to be sent when the button is clicked
47
+ */
48
+ this.postMessageEvent = 'articleActionButton';
49
+ this.hasErrors = false;
50
+ this.limitStylingAppends = false;
51
+ this.isLoading = true;
52
+ this.setClientStyling = () => {
53
+ let sheet = document.createElement('style');
54
+ sheet.innerHTML = this.clientStyling;
55
+ this.stylingContainer.prepend(sheet);
56
+ };
57
+ this.setClientStylingURL = () => {
58
+ let url = new URL(this.clientStylingurl);
59
+ let cssFile = document.createElement('style');
60
+ fetch(url.href)
61
+ .then((res) => res.text())
62
+ .then((data) => {
63
+ this.clientStylingUrlContent = data;
64
+ cssFile.innerHTML = data;
65
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
66
+ })
67
+ .catch((err) => {
68
+ console.log('error ', err);
69
+ });
70
+ };
71
+ }
72
+ getArticleId(postId) {
73
+ this.articleActionButton.emit({ postId });
74
+ if (this.usePostmessage) {
75
+ window.postMessage({ type: this.postMessageEvent, postId });
76
+ }
77
+ }
78
+ connectedCallback() {
79
+ this.getBlogArticleDetails();
80
+ }
81
+ toggleClass() {
82
+ this.showVerticalGrid = !this.showVerticalGrid;
83
+ }
84
+ handleAction(postId) {
85
+ this.getArticleId(postId);
86
+ }
87
+ getBlogArticleDetails() {
88
+ this.isLoading = true;
89
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
90
+ fetch(url.href)
91
+ .then((res) => {
92
+ if (res.status >= 300) {
93
+ this.hasErrors = true;
94
+ throw new Error('There was an error while fetching the data');
95
+ }
96
+ return res.json();
97
+ })
98
+ .then((blogContent) => {
99
+ this.blogData = blogContent;
100
+ this.isLoading = false;
101
+ })
102
+ .catch((err) => {
103
+ this.hasErrors = true;
104
+ console.log('Error', err);
105
+ })
106
+ .finally(() => this.isLoading = false);
107
+ }
108
+ componentDidRender() {
109
+ // start custom styling area
110
+ if (!this.limitStylingAppends && this.stylingContainer) {
111
+ if (this.clientStyling)
112
+ this.setClientStyling();
113
+ if (this.clientStylingUrlContent)
114
+ this.setClientStylingURL();
115
+ this.limitStylingAppends = true;
116
+ }
117
+ // end custom styling area
118
+ }
119
+ render() {
120
+ if (this.hasErrors) {
121
+ return (h("div", { class: "BlogArticleDetails" },
122
+ h("div", { class: "Title" }, translate('error', this.language))));
123
+ }
124
+ if (!this.isLoading) {
125
+ return (h("div", null,
126
+ h("div", { ref: el => this.stylingContainer = el }, this.blogData.map((data) => h("div", { class: "GridContainer" },
127
+ this.showPublishingDate &&
128
+ h("div", { class: "BlogDate" }, data.publishingDate),
129
+ this.showImage &&
130
+ h("div", { class: "BlogBanner" },
131
+ h("img", { src: data.image, alt: data.title })),
132
+ this.showTitle &&
133
+ h("div", { class: "BlogTitle" }, data.title),
134
+ this.showContent &&
135
+ h("div", { class: "BlogContent", innerHTML: data.content }),
136
+ this.showButton &&
137
+ h("div", { class: "BlogLink" },
138
+ h("button", { onClick: () => this.handleAction(data.postID) }, translate('readmore', this.language))))))));
139
+ }
140
+ }
141
+ static get is() { return "blog-articles-grid"; }
142
+ static get encapsulation() { return "shadow"; }
143
+ static get originalStyleUrls() { return {
144
+ "$": ["blog-articles-grid.scss"]
145
+ }; }
146
+ static get styleUrls() { return {
147
+ "$": ["blog-articles-grid.css"]
148
+ }; }
149
+ static get properties() { return {
150
+ "cmsEndpoint": {
151
+ "type": "string",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "string",
155
+ "resolved": "string",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [],
162
+ "text": "Endpoint URL for the source of data"
163
+ },
164
+ "attribute": "cms-endpoint",
165
+ "reflect": false
166
+ },
167
+ "language": {
168
+ "type": "string",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "string",
172
+ "resolved": "string",
173
+ "references": {}
174
+ },
175
+ "required": false,
176
+ "optional": false,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": "Language of the widget"
180
+ },
181
+ "attribute": "language",
182
+ "reflect": false,
183
+ "defaultValue": "'en'"
184
+ },
185
+ "handleClick": {
186
+ "type": "string",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "string",
190
+ "resolved": "string",
191
+ "references": {}
192
+ },
193
+ "required": false,
194
+ "optional": false,
195
+ "docs": {
196
+ "tags": [],
197
+ "text": "Handle when you click on shome more button"
198
+ },
199
+ "attribute": "handle-click",
200
+ "reflect": false
201
+ },
202
+ "clientStyling": {
203
+ "type": "string",
204
+ "mutable": false,
205
+ "complexType": {
206
+ "original": "string",
207
+ "resolved": "string",
208
+ "references": {}
209
+ },
210
+ "required": false,
211
+ "optional": false,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": "Client custom styling via string"
215
+ },
216
+ "attribute": "client-styling",
217
+ "reflect": false,
218
+ "defaultValue": "''"
219
+ },
220
+ "clientStylingurl": {
221
+ "type": "string",
222
+ "mutable": false,
223
+ "complexType": {
224
+ "original": "string",
225
+ "resolved": "string",
226
+ "references": {}
227
+ },
228
+ "required": false,
229
+ "optional": false,
230
+ "docs": {
231
+ "tags": [],
232
+ "text": "Client custom styling via url"
233
+ },
234
+ "attribute": "client-stylingurl",
235
+ "reflect": false,
236
+ "defaultValue": "''"
237
+ },
238
+ "clientStylingUrlContent": {
239
+ "type": "string",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "string",
243
+ "resolved": "string",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "Client custom styling via url content"
251
+ },
252
+ "attribute": "client-styling-url-content",
253
+ "reflect": false,
254
+ "defaultValue": "''"
255
+ },
256
+ "showPublishingDate": {
257
+ "type": "boolean",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "boolean",
261
+ "resolved": "boolean",
262
+ "references": {}
263
+ },
264
+ "required": false,
265
+ "optional": false,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": "Property used to display the publishing date"
269
+ },
270
+ "attribute": "show-publishing-date",
271
+ "reflect": false,
272
+ "defaultValue": "true"
273
+ },
274
+ "showImage": {
275
+ "type": "boolean",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "boolean",
279
+ "resolved": "boolean",
280
+ "references": {}
281
+ },
282
+ "required": false,
283
+ "optional": false,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": "Property used to display the image"
287
+ },
288
+ "attribute": "show-image",
289
+ "reflect": false,
290
+ "defaultValue": "true"
291
+ },
292
+ "showTitle": {
293
+ "type": "boolean",
294
+ "mutable": false,
295
+ "complexType": {
296
+ "original": "boolean",
297
+ "resolved": "boolean",
298
+ "references": {}
299
+ },
300
+ "required": false,
301
+ "optional": false,
302
+ "docs": {
303
+ "tags": [],
304
+ "text": "Property used to display the image"
305
+ },
306
+ "attribute": "show-title",
307
+ "reflect": false,
308
+ "defaultValue": "true"
309
+ },
310
+ "showContent": {
311
+ "type": "boolean",
312
+ "mutable": false,
313
+ "complexType": {
314
+ "original": "boolean",
315
+ "resolved": "boolean",
316
+ "references": {}
317
+ },
318
+ "required": false,
319
+ "optional": false,
320
+ "docs": {
321
+ "tags": [],
322
+ "text": "Property used to display the description"
323
+ },
324
+ "attribute": "show-content",
325
+ "reflect": false,
326
+ "defaultValue": "true"
327
+ },
328
+ "showButton": {
329
+ "type": "boolean",
330
+ "mutable": false,
331
+ "complexType": {
332
+ "original": "boolean",
333
+ "resolved": "boolean",
334
+ "references": {}
335
+ },
336
+ "required": false,
337
+ "optional": false,
338
+ "docs": {
339
+ "tags": [],
340
+ "text": "Property used to display the button"
341
+ },
342
+ "attribute": "show-button",
343
+ "reflect": false,
344
+ "defaultValue": "true"
345
+ },
346
+ "showVerticalGrid": {
347
+ "type": "boolean",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "boolean",
351
+ "resolved": "boolean",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": false,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": "Property used to display the button"
359
+ },
360
+ "attribute": "show-vertical-grid",
361
+ "reflect": false,
362
+ "defaultValue": "false"
363
+ },
364
+ "usePostmessage": {
365
+ "type": "boolean",
366
+ "mutable": false,
367
+ "complexType": {
368
+ "original": "boolean",
369
+ "resolved": "boolean",
370
+ "references": {}
371
+ },
372
+ "required": true,
373
+ "optional": false,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": "Use postMessage event to communicate"
377
+ },
378
+ "attribute": "use-postmessage",
379
+ "reflect": false
380
+ },
381
+ "postMessageEvent": {
382
+ "type": "string",
383
+ "mutable": false,
384
+ "complexType": {
385
+ "original": "string",
386
+ "resolved": "string",
387
+ "references": {}
388
+ },
389
+ "required": false,
390
+ "optional": false,
391
+ "docs": {
392
+ "tags": [],
393
+ "text": "Event name to be sent when the button is clicked"
394
+ },
395
+ "attribute": "post-message-event",
396
+ "reflect": false,
397
+ "defaultValue": "'articleActionButton'"
398
+ }
399
+ }; }
400
+ static get states() { return {
401
+ "hasErrors": {},
402
+ "limitStylingAppends": {},
403
+ "isLoading": {}
404
+ }; }
405
+ static get events() { return [{
406
+ "method": "articleActionButton",
407
+ "name": "articleActionButton",
408
+ "bubbles": true,
409
+ "cancelable": true,
410
+ "composed": true,
411
+ "docs": {
412
+ "tags": [],
413
+ "text": ""
414
+ },
415
+ "complexType": {
416
+ "original": "Object",
417
+ "resolved": "Object",
418
+ "references": {
419
+ "Object": {
420
+ "location": "global"
421
+ }
422
+ }
423
+ }
424
+ }]; }
425
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,24 @@
1
+ const DEFAULT_LANGUAGE = 'en';
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
3
+ const TRANSLATIONS = {
4
+ en: {
5
+ error: 'Error',
6
+ readmore: 'Read more',
7
+ },
8
+ ro: {
9
+ error: 'Eroare',
10
+ readmore: 'Read more',
11
+ },
12
+ fr: {
13
+ error: 'Error',
14
+ readmore: 'Read more',
15
+ },
16
+ ar: {
17
+ error: 'خطأ',
18
+ readmore: 'Read more',
19
+ }
20
+ };
21
+ export const translate = (key, customLang) => {
22
+ const lang = customLang;
23
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
24
+ };
File without changes
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface BlogArticlesGrid extends Components.BlogArticlesGrid, HTMLElement {}
4
+ export const BlogArticlesGrid: {
5
+ prototype: BlogArticlesGrid;
6
+ new (): BlogArticlesGrid;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;