@ptcwebops/ptcw-design 0.1.1 → 0.1.3
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/cjs/icon-asset_5.cjs.entry.js +207 -0
- package/dist/{ptcw-design/index-f7043a90.js → cjs/index-ac192914.js} +195 -1311
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/interfaces-0ecd8027.js +15 -0
- package/dist/cjs/list-item.cjs.entry.js +27 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/lottie-player.cjs.entry.js +13476 -0
- package/dist/cjs/my-component.cjs.entry.js +26 -0
- package/dist/cjs/ptc-avatar.cjs.entry.js +19 -0
- package/dist/cjs/ptc-card.cjs.entry.js +75 -0
- package/dist/cjs/ptc-date.cjs.entry.js +48 -0
- package/dist/cjs/ptc-footer.cjs.entry.js +19 -0
- package/dist/cjs/ptc-img.cjs.entry.js +155 -0
- package/dist/cjs/ptc-link.cjs.entry.js +53 -0
- package/dist/cjs/ptc-list.cjs.entry.js +32 -0
- package/dist/cjs/ptc-lottie.cjs.entry.js +23 -0
- package/dist/cjs/ptc-nav-item.cjs.entry.js +94 -0
- package/dist/cjs/ptc-nav.cjs.entry.js +19 -0
- package/dist/cjs/ptc-overlay.cjs.entry.js +19 -0
- package/dist/cjs/ptc-picture.cjs.entry.js +167 -0
- package/dist/cjs/ptc-spacer.cjs.entry.js +46 -0
- package/dist/cjs/ptc-span.cjs.entry.js +31 -0
- package/dist/cjs/ptc-title.cjs.entry.js +49 -0
- package/dist/cjs/ptcw-design.cjs.js +19 -0
- package/dist/collection/assets/svg-imgs/close.svg +11 -0
- package/dist/collection/collection-manifest.json +40 -0
- package/dist/collection/components/icon-asset/assets/brands.svg +1381 -0
- package/dist/collection/components/icon-asset/assets/footer-social.svg +0 -0
- package/dist/collection/components/icon-asset/assets/ptc-sprite.svg +144 -0
- package/dist/collection/components/icon-asset/assets/regular.svg +463 -0
- package/dist/collection/components/icon-asset/assets/solid.svg +3013 -0
- package/dist/collection/components/icon-asset/assets/svg-with-js.min.css +5 -0
- package/dist/collection/components/icon-asset/icon-asset.css +30 -0
- package/dist/collection/components/icon-asset/icon-asset.js +177 -0
- package/dist/collection/components/list-item/list-item.css +3 -0
- package/dist/collection/components/list-item/list-item.js +63 -0
- package/dist/collection/components/my-component/my-component.css +3 -0
- package/dist/collection/components/my-component/my-component.js +74 -0
- package/dist/collection/components/ptc-announcement/ptc-announcement.css +87 -0
- package/dist/collection/components/ptc-announcement/ptc-announcement.js +127 -0
- package/dist/collection/components/ptc-avatar/ptc-avatar.css +3 -0
- package/dist/collection/components/ptc-avatar/ptc-avatar.js +15 -0
- package/dist/collection/components/ptc-button/ptc-button.css +155 -0
- package/dist/collection/components/ptc-button/ptc-button.js +223 -0
- package/dist/collection/components/ptc-card/ptc-card.css +262 -0
- package/dist/collection/components/ptc-card/ptc-card.js +260 -0
- package/dist/collection/components/ptc-date/ptc-date.css +3 -0
- package/dist/collection/components/ptc-date/ptc-date.js +155 -0
- package/dist/collection/components/ptc-footer/ptc-footer.css +40 -0
- package/dist/collection/components/ptc-footer/ptc-footer.js +25 -0
- package/dist/collection/components/ptc-img/ptc-img.css +65 -0
- package/dist/collection/components/ptc-img/ptc-img.js +309 -0
- package/dist/collection/components/ptc-link/ptc-link.css +168 -0
- package/dist/collection/components/ptc-link/ptc-link.js +197 -0
- package/dist/collection/components/ptc-list/ptc-list.css +24 -0
- package/dist/collection/components/ptc-list/ptc-list.js +66 -0
- package/dist/collection/components/ptc-lottie/ptc-lottie.css +5 -0
- package/dist/collection/components/ptc-lottie/ptc-lottie.js +58 -0
- package/dist/collection/components/ptc-nav/ptc-nav.css +29 -0
- package/dist/collection/components/ptc-nav/ptc-nav.js +21 -0
- package/dist/collection/components/ptc-nav-item/ptc-nav-item.css +81 -0
- package/dist/collection/components/ptc-nav-item/ptc-nav-item.js +252 -0
- package/dist/collection/components/ptc-overlay/ptc-overlay.css +3 -0
- package/dist/collection/components/ptc-overlay/ptc-overlay.js +14 -0
- package/dist/collection/components/ptc-para/ptc-para.css +88 -0
- package/dist/collection/components/ptc-para/ptc-para.js +111 -0
- package/dist/collection/components/ptc-picture/ptc-picture.css +32 -0
- package/dist/collection/components/ptc-picture/ptc-picture.js +356 -0
- package/dist/collection/components/ptc-spacer/ptc-spacer.css +307 -0
- package/dist/collection/components/ptc-spacer/ptc-spacer.js +99 -0
- package/dist/collection/components/ptc-span/ptc-span.css +36 -0
- package/dist/collection/components/ptc-span/ptc-span.js +86 -0
- package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.css +77 -0
- package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.js +34 -0
- package/dist/collection/components/ptc-title/ptc-title.css +64 -0
- package/dist/collection/components/ptc-title/ptc-title.js +105 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/interfaces.js +11 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/custom-elements/index.d.ts +6 -6
- package/dist/custom-elements/index.js +14559 -0
- package/dist/esm/icon-asset_5.entry.js +199 -0
- package/dist/esm/index-7a3883ee.js +1687 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/interfaces-3cb94654.js +12 -0
- package/dist/{ptcw-design → esm}/list-item.entry.js +1 -1
- package/dist/esm/loader.js +17 -0
- package/dist/{ptcw-design → esm}/lottie-player.entry.js +31 -782
- package/dist/{ptcw-design → esm}/my-component.entry.js +1 -1
- 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/esm/ptc-avatar.entry.js +15 -0
- package/dist/{ptcw-design → esm}/ptc-card.entry.js +3 -3
- package/dist/{ptcw-design → esm}/ptc-date.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-footer.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-img.entry.js +6 -25
- package/dist/{ptcw-design → esm}/ptc-link.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-list.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-lottie.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-nav-item.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-nav.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-overlay.entry.js +1 -1
- package/dist/esm/ptc-picture.entry.js +163 -0
- package/dist/{ptcw-design → esm}/ptc-spacer.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-span.entry.js +1 -1
- package/dist/{ptcw-design → esm}/ptc-title.entry.js +1 -1
- package/dist/esm/ptcw-design.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/node_modules/@teamhive/lottie-player/dist/collection/components/lottie-player/lottie-player.css +187 -0
- package/dist/ptcw-design/index.esm.js +0 -1
- package/dist/ptcw-design/p-0c8df906.entry.js +1 -0
- package/dist/ptcw-design/p-18092cf1.entry.js +1 -0
- package/dist/ptcw-design/p-186beb2c.entry.js +1 -0
- package/dist/ptcw-design/p-240733ce.js +1 -0
- package/dist/ptcw-design/p-2d5f8cff.entry.js +1 -0
- package/dist/ptcw-design/p-50923c9a.js +1 -0
- package/dist/ptcw-design/p-51a3e9e6.entry.js +1 -0
- package/dist/ptcw-design/p-5f776886.entry.js +1 -0
- package/dist/ptcw-design/p-66ffa30c.entry.js +1 -0
- package/dist/ptcw-design/p-6b1a35e1.entry.js +1 -0
- package/dist/ptcw-design/p-73e2418e.entry.js +1 -0
- package/dist/ptcw-design/p-78a47bf1.entry.js +1 -0
- package/dist/ptcw-design/p-796b8287.entry.js +1 -0
- package/dist/ptcw-design/p-90402319.entry.js +1 -0
- package/dist/ptcw-design/p-919311d2.entry.js +1 -0
- package/dist/ptcw-design/p-ac449734.entry.js +1 -0
- package/dist/ptcw-design/p-bff9c1f2.entry.js +1 -0
- package/dist/ptcw-design/p-d6553853.entry.js +1 -0
- package/dist/ptcw-design/p-ef250898.entry.js +1 -0
- package/dist/ptcw-design/p-f694e46a.entry.js +1 -0
- package/dist/ptcw-design/p-f80152dc.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.css +2 -1030
- package/dist/ptcw-design/ptcw-design.esm.js +1 -122
- package/dist/types/components/ptc-avatar/ptc-avatar.d.ts +3 -0
- package/dist/types/components/ptc-para/ptc-para.d.ts +1 -1
- package/dist/types/components/ptc-picture/ptc-picture.d.ts +60 -1
- package/dist/types/components.d.ts +95 -33
- package/dist/types/utils/interfaces.d.ts +6 -1
- package/package.json +2 -2
- package/dist/ptcw-design/app-globals-0f993ce5.js +0 -3
- package/dist/ptcw-design/css-shim-003e9264.js +0 -4
- package/dist/ptcw-design/dom-1b195079.js +0 -73
- package/dist/ptcw-design/icon-asset.entry.js +0 -60
- package/dist/ptcw-design/ptc-announcement.entry.js +0 -31
- package/dist/ptcw-design/ptc-button.entry.js +0 -57
- package/dist/ptcw-design/ptc-image.entry.js +0 -54
- package/dist/ptcw-design/ptc-para.entry.js +0 -36
- package/dist/ptcw-design/ptc-picture.entry.js +0 -22
- package/dist/ptcw-design/ptc-svg-btn.entry.js +0 -27
- package/dist/ptcw-design/shadow-css-c1ad5fdc.js +0 -383
- package/dist/types/components/ptc-image/ptc-image.d.ts +0 -18
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Component, h, Prop } from '@stencil/core';
|
|
2
|
+
export class PtcPara {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Paragraph font size
|
|
6
|
+
**/
|
|
7
|
+
this.fontSize = "medium";
|
|
8
|
+
/**
|
|
9
|
+
* Paragraph font weight
|
|
10
|
+
**/
|
|
11
|
+
this.fontWeight = 'w-4';
|
|
12
|
+
/**
|
|
13
|
+
* Paragraph Style
|
|
14
|
+
**/
|
|
15
|
+
this.paraStyle = 'default';
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const classMap = this.getCssClassMap();
|
|
19
|
+
return (h("p", { class: classMap, part: "part-para" },
|
|
20
|
+
h("slot", null)));
|
|
21
|
+
}
|
|
22
|
+
getCssClassMap() {
|
|
23
|
+
return {
|
|
24
|
+
[this.fontSize]: true,
|
|
25
|
+
[this.fontWeight]: true,
|
|
26
|
+
[this.paraStyle]: true,
|
|
27
|
+
[this.paraMargin]: true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static get is() { return "ptc-para"; }
|
|
31
|
+
static get encapsulation() { return "shadow"; }
|
|
32
|
+
static get originalStyleUrls() { return {
|
|
33
|
+
"$": ["ptc-para.scss"]
|
|
34
|
+
}; }
|
|
35
|
+
static get styleUrls() { return {
|
|
36
|
+
"$": ["ptc-para.css"]
|
|
37
|
+
}; }
|
|
38
|
+
static get properties() { return {
|
|
39
|
+
"fontSize": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"mutable": false,
|
|
42
|
+
"complexType": {
|
|
43
|
+
"original": "'xx-small' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' | 'xx-large' | 'xxx-large' | 'xxxx-large'",
|
|
44
|
+
"resolved": "\"large\" | \"medium\" | \"small\" | \"x-large\" | \"x-small\" | \"xx-large\" | \"xx-small\" | \"xxx-large\" | \"xxxx-large\"",
|
|
45
|
+
"references": {}
|
|
46
|
+
},
|
|
47
|
+
"required": false,
|
|
48
|
+
"optional": false,
|
|
49
|
+
"docs": {
|
|
50
|
+
"tags": [],
|
|
51
|
+
"text": "Paragraph font size"
|
|
52
|
+
},
|
|
53
|
+
"attribute": "font-size",
|
|
54
|
+
"reflect": false,
|
|
55
|
+
"defaultValue": "\"medium\""
|
|
56
|
+
},
|
|
57
|
+
"fontWeight": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"mutable": false,
|
|
60
|
+
"complexType": {
|
|
61
|
+
"original": "'w-3' | 'w-4' | 'w-5' | 'w-6' | 'w-7' | 'w-8' | 'w-9'",
|
|
62
|
+
"resolved": "\"w-3\" | \"w-4\" | \"w-5\" | \"w-6\" | \"w-7\" | \"w-8\" | \"w-9\"",
|
|
63
|
+
"references": {}
|
|
64
|
+
},
|
|
65
|
+
"required": false,
|
|
66
|
+
"optional": false,
|
|
67
|
+
"docs": {
|
|
68
|
+
"tags": [],
|
|
69
|
+
"text": "Paragraph font weight"
|
|
70
|
+
},
|
|
71
|
+
"attribute": "font-weight",
|
|
72
|
+
"reflect": false,
|
|
73
|
+
"defaultValue": "'w-4'"
|
|
74
|
+
},
|
|
75
|
+
"paraStyle": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "'default' | 'intro' | 'small' | 'announcement'",
|
|
80
|
+
"resolved": "\"announcement\" | \"default\" | \"intro\" | \"small\"",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": false,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": "Paragraph Style"
|
|
88
|
+
},
|
|
89
|
+
"attribute": "para-style",
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"defaultValue": "'default'"
|
|
92
|
+
},
|
|
93
|
+
"paraMargin": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "'margin-flush' | 'margin-top-3' | 'margin-top-4' | 'margin-top-5' | 'margin-top-6' | 'margin-bottom-3' | 'margin-bottom-4' | 'margin-bottom-5' | 'margin-bottom-6'",
|
|
98
|
+
"resolved": "\"margin-bottom-3\" | \"margin-bottom-4\" | \"margin-bottom-5\" | \"margin-bottom-6\" | \"margin-flush\" | \"margin-top-3\" | \"margin-top-4\" | \"margin-top-5\" | \"margin-top-6\"",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": true,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [],
|
|
105
|
+
"text": "Paragraph Margin"
|
|
106
|
+
},
|
|
107
|
+
"attribute": "para-margin",
|
|
108
|
+
"reflect": false
|
|
109
|
+
}
|
|
110
|
+
}; }
|
|
111
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.cover {
|
|
7
|
+
object-fit: cover;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.fill {
|
|
11
|
+
object-fit: fill;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.contain {
|
|
15
|
+
object-fit: contain;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.scale-down {
|
|
19
|
+
object-fit: scale-down;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.none {
|
|
23
|
+
object-fit: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.initial {
|
|
27
|
+
object-fit: initial;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.inherit {
|
|
31
|
+
object-fit: inherit;
|
|
32
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Component, Prop, h, Element, Listen, State, Host } from '@stencil/core';
|
|
2
|
+
import { ResponsivePictureVariables } from '../../utils/interfaces';
|
|
3
|
+
export class PtcPicture {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Image size for smallest screen
|
|
7
|
+
* <=767px
|
|
8
|
+
*/
|
|
9
|
+
this.sizeXs = '510x340';
|
|
10
|
+
/**
|
|
11
|
+
* Image size for small screen
|
|
12
|
+
* >=768px and <=991px
|
|
13
|
+
*/
|
|
14
|
+
this.sizeSm = '1240x496';
|
|
15
|
+
/**
|
|
16
|
+
* Image size for medium screen
|
|
17
|
+
* >=992px and <=1199px
|
|
18
|
+
*/
|
|
19
|
+
this.sizeMd = '1366x500';
|
|
20
|
+
/**
|
|
21
|
+
* Image solution for large screen
|
|
22
|
+
* >=1200px
|
|
23
|
+
*/
|
|
24
|
+
this.sizeLg = '1920x1080';
|
|
25
|
+
/**
|
|
26
|
+
* Image border shape
|
|
27
|
+
*/
|
|
28
|
+
this.borderRadius = '';
|
|
29
|
+
/**
|
|
30
|
+
* Set height
|
|
31
|
+
* Width will be auto by default
|
|
32
|
+
*/
|
|
33
|
+
this.height = 'auto';
|
|
34
|
+
/**
|
|
35
|
+
* Set Width
|
|
36
|
+
* height will be 100% by default
|
|
37
|
+
*/
|
|
38
|
+
this.width = '100%';
|
|
39
|
+
/**
|
|
40
|
+
* Object Fit
|
|
41
|
+
* Default: cover
|
|
42
|
+
*/
|
|
43
|
+
this.objectFit = 'cover';
|
|
44
|
+
}
|
|
45
|
+
WindowResize() {
|
|
46
|
+
this.addIntersectionObserver();
|
|
47
|
+
}
|
|
48
|
+
componentDidLoad() {
|
|
49
|
+
this.addIntersectionObserver();
|
|
50
|
+
}
|
|
51
|
+
componentWillUpdate() {
|
|
52
|
+
if (this.src !== this.oldSrc) {
|
|
53
|
+
this.addIntersectionObserver();
|
|
54
|
+
}
|
|
55
|
+
this.oldSrc = this.src;
|
|
56
|
+
}
|
|
57
|
+
//lazy-loading
|
|
58
|
+
addIntersectionObserver() {
|
|
59
|
+
if (!this.src) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if ('IntersectionObserver' in window) {
|
|
63
|
+
let lazyLoadImages = new IntersectionObserver(entries => {
|
|
64
|
+
entries.forEach(entry => {
|
|
65
|
+
if (entry.isIntersecting) {
|
|
66
|
+
const image = this.el.shadowRoot.querySelector('img');
|
|
67
|
+
image.src = this.setResponsiveBg();
|
|
68
|
+
console.log('loaded');
|
|
69
|
+
lazyLoadImages.unobserve(image);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
lazyLoadImages.observe(this.el.shadowRoot.querySelector('img'));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// fall back to setTimeout for Safari and IE
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
const image = this.el.shadowRoot.querySelector('img');
|
|
79
|
+
image.src = this.setResponsiveBg();
|
|
80
|
+
image.onload = () => {
|
|
81
|
+
image.removeAttribute('data-src');
|
|
82
|
+
console.log('loaded fallback');
|
|
83
|
+
};
|
|
84
|
+
}, 5000);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//responsive image
|
|
88
|
+
setResponsiveBg() {
|
|
89
|
+
// Define local variables
|
|
90
|
+
let backgrounds = (this.el.shadowRoot || document).querySelectorAll('img'), el, elData, currentBreakpoint = this.getCurrentBreakPoints();
|
|
91
|
+
//console.log('current breakpoint: ' + currentBreakpoint);
|
|
92
|
+
// Loop through all target elements
|
|
93
|
+
for (var i = 0, len = backgrounds.length; i < len; i++) {
|
|
94
|
+
// Set current variables
|
|
95
|
+
el = backgrounds[i];
|
|
96
|
+
elData = el.getAttribute('data-' + currentBreakpoint);
|
|
97
|
+
if (elData !== null) {
|
|
98
|
+
// console.log('img src= ' + elData);
|
|
99
|
+
return elData;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (typeof console == 'object') {
|
|
103
|
+
console.warn('Data attribute: data-' + currentBreakpoint + ' not found on element:\n\n' + el.outerHTML + '\n\n\n');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
const classMap = this.getCssClassMap();
|
|
110
|
+
return (h(Host, null,
|
|
111
|
+
h("style", null, `img{width:${this.width};height:${this.height};}`),
|
|
112
|
+
h("img", { class: classMap, "data-xs": `${this.src}:${this.sizeXs}`, "data-sm": `${this.src}:${this.sizeSm}`, "data-md": `${this.src}:${this.sizeMd}`, "data-lg": `${this.src}:${this.sizeLg}`, alt: this.alt })));
|
|
113
|
+
}
|
|
114
|
+
getCurrentBreakPoints() {
|
|
115
|
+
// Define local variables
|
|
116
|
+
let doc = window.document, temp = doc.createElement('div'), env;
|
|
117
|
+
// Append test node
|
|
118
|
+
doc.body.appendChild(temp);
|
|
119
|
+
// Loop through breakpoints
|
|
120
|
+
for (let i = ResponsivePictureVariables.envs.length - 1; i >= 0; i--) {
|
|
121
|
+
env = ResponsivePictureVariables.envs[i];
|
|
122
|
+
// Add classes
|
|
123
|
+
temp.className = 'hidden-' + env;
|
|
124
|
+
// Found breakpoint
|
|
125
|
+
if (temp.offsetParent === null) {
|
|
126
|
+
// Remove our test node
|
|
127
|
+
doc.body.removeChild(temp);
|
|
128
|
+
console.log('remove test node');
|
|
129
|
+
// Return current breakpoint
|
|
130
|
+
return env;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Breakpoint not found, try fallback
|
|
134
|
+
doc.body.removeChild(temp);
|
|
135
|
+
return this.getFallbackBreakpoint();
|
|
136
|
+
}
|
|
137
|
+
getFallbackBreakpoint() {
|
|
138
|
+
if (window.matchMedia('(min-width: 992px)').matches) {
|
|
139
|
+
return 'lg';
|
|
140
|
+
}
|
|
141
|
+
else if (window.matchMedia('(min-width: 768px)').matches) {
|
|
142
|
+
return 'md';
|
|
143
|
+
}
|
|
144
|
+
else if (window.matchMedia('(min-width: 576px)').matches) {
|
|
145
|
+
return 'sm';
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return 'xs';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
getCssClassMap() {
|
|
152
|
+
return {
|
|
153
|
+
[this.borderRadius]: true,
|
|
154
|
+
[this.objectFit]: true,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
static get is() { return "ptc-picture"; }
|
|
158
|
+
static get encapsulation() { return "shadow"; }
|
|
159
|
+
static get originalStyleUrls() { return {
|
|
160
|
+
"$": ["ptc-picture.scss"]
|
|
161
|
+
}; }
|
|
162
|
+
static get styleUrls() { return {
|
|
163
|
+
"$": ["ptc-picture.css"]
|
|
164
|
+
}; }
|
|
165
|
+
static get properties() { return {
|
|
166
|
+
"src": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "string",
|
|
171
|
+
"resolved": "string",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": "Image Render Src"
|
|
179
|
+
},
|
|
180
|
+
"attribute": "src",
|
|
181
|
+
"reflect": false
|
|
182
|
+
},
|
|
183
|
+
"alt": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"mutable": false,
|
|
186
|
+
"complexType": {
|
|
187
|
+
"original": "string",
|
|
188
|
+
"resolved": "string",
|
|
189
|
+
"references": {}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": false,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": "Image alt"
|
|
196
|
+
},
|
|
197
|
+
"attribute": "alt",
|
|
198
|
+
"reflect": false
|
|
199
|
+
},
|
|
200
|
+
"sizeXs": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"mutable": true,
|
|
203
|
+
"complexType": {
|
|
204
|
+
"original": "string",
|
|
205
|
+
"resolved": "string",
|
|
206
|
+
"references": {}
|
|
207
|
+
},
|
|
208
|
+
"required": false,
|
|
209
|
+
"optional": false,
|
|
210
|
+
"docs": {
|
|
211
|
+
"tags": [],
|
|
212
|
+
"text": "Image size for smallest screen\n<=767px"
|
|
213
|
+
},
|
|
214
|
+
"attribute": "size-xs",
|
|
215
|
+
"reflect": false,
|
|
216
|
+
"defaultValue": "'510x340'"
|
|
217
|
+
},
|
|
218
|
+
"sizeSm": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"mutable": true,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "string",
|
|
223
|
+
"resolved": "string",
|
|
224
|
+
"references": {}
|
|
225
|
+
},
|
|
226
|
+
"required": false,
|
|
227
|
+
"optional": false,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [],
|
|
230
|
+
"text": "Image size for small screen\n>=768px and <=991px"
|
|
231
|
+
},
|
|
232
|
+
"attribute": "size-sm",
|
|
233
|
+
"reflect": false,
|
|
234
|
+
"defaultValue": "'1240x496'"
|
|
235
|
+
},
|
|
236
|
+
"sizeMd": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"mutable": true,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "string",
|
|
241
|
+
"resolved": "string",
|
|
242
|
+
"references": {}
|
|
243
|
+
},
|
|
244
|
+
"required": false,
|
|
245
|
+
"optional": false,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": "Image size for medium screen\n>=992px and <=1199px"
|
|
249
|
+
},
|
|
250
|
+
"attribute": "size-md",
|
|
251
|
+
"reflect": false,
|
|
252
|
+
"defaultValue": "'1366x500'"
|
|
253
|
+
},
|
|
254
|
+
"sizeLg": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"mutable": true,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "string",
|
|
259
|
+
"resolved": "string",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Image solution for large screen\n>=1200px"
|
|
267
|
+
},
|
|
268
|
+
"attribute": "size-lg",
|
|
269
|
+
"reflect": false,
|
|
270
|
+
"defaultValue": "'1920x1080'"
|
|
271
|
+
},
|
|
272
|
+
"borderRadius": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"mutable": false,
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "'radius-sm' | 'radius-md' | 'radius-lg' | ''",
|
|
277
|
+
"resolved": "\"\" | \"radius-lg\" | \"radius-md\" | \"radius-sm\"",
|
|
278
|
+
"references": {}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": false,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": "Image border shape"
|
|
285
|
+
},
|
|
286
|
+
"attribute": "border-radius",
|
|
287
|
+
"reflect": false,
|
|
288
|
+
"defaultValue": "''"
|
|
289
|
+
},
|
|
290
|
+
"height": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "string",
|
|
295
|
+
"resolved": "string",
|
|
296
|
+
"references": {}
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"optional": false,
|
|
300
|
+
"docs": {
|
|
301
|
+
"tags": [],
|
|
302
|
+
"text": "Set height\nWidth will be auto by default"
|
|
303
|
+
},
|
|
304
|
+
"attribute": "height",
|
|
305
|
+
"reflect": false,
|
|
306
|
+
"defaultValue": "'auto'"
|
|
307
|
+
},
|
|
308
|
+
"width": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"mutable": false,
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "string",
|
|
313
|
+
"resolved": "string",
|
|
314
|
+
"references": {}
|
|
315
|
+
},
|
|
316
|
+
"required": false,
|
|
317
|
+
"optional": false,
|
|
318
|
+
"docs": {
|
|
319
|
+
"tags": [],
|
|
320
|
+
"text": "Set Width\nheight will be 100% by default"
|
|
321
|
+
},
|
|
322
|
+
"attribute": "width",
|
|
323
|
+
"reflect": false,
|
|
324
|
+
"defaultValue": "'100%'"
|
|
325
|
+
},
|
|
326
|
+
"objectFit": {
|
|
327
|
+
"type": "string",
|
|
328
|
+
"mutable": false,
|
|
329
|
+
"complexType": {
|
|
330
|
+
"original": "'cover' | 'fill' | 'contain' | 'scale-down' | 'none' | 'initial' | 'inherit'",
|
|
331
|
+
"resolved": "\"contain\" | \"cover\" | \"fill\" | \"inherit\" | \"initial\" | \"none\" | \"scale-down\"",
|
|
332
|
+
"references": {}
|
|
333
|
+
},
|
|
334
|
+
"required": false,
|
|
335
|
+
"optional": false,
|
|
336
|
+
"docs": {
|
|
337
|
+
"tags": [],
|
|
338
|
+
"text": "Object Fit\nDefault: cover"
|
|
339
|
+
},
|
|
340
|
+
"attribute": "object-fit",
|
|
341
|
+
"reflect": false,
|
|
342
|
+
"defaultValue": "'cover'"
|
|
343
|
+
}
|
|
344
|
+
}; }
|
|
345
|
+
static get states() { return {
|
|
346
|
+
"oldSrc": {}
|
|
347
|
+
}; }
|
|
348
|
+
static get elementRef() { return "el"; }
|
|
349
|
+
static get listeners() { return [{
|
|
350
|
+
"name": "resize",
|
|
351
|
+
"method": "WindowResize",
|
|
352
|
+
"target": "window",
|
|
353
|
+
"capture": false,
|
|
354
|
+
"passive": true
|
|
355
|
+
}]; }
|
|
356
|
+
}
|