@ptcwebops/ptcw-design 0.0.11 → 0.0.13
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/ptc-img.cjs.entry.js +26 -7
- package/dist/collection/components/ptc-img/ptc-img.js +27 -8
- package/dist/custom-elements/index.js +26 -7
- package/dist/esm/ptc-img.entry.js +26 -7
- package/dist/ptcw-design/{p-dcbdb129.entry.js → p-f1fd26f7.entry.js} +1 -1
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-img/ptc-img.d.ts +1 -0
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
|
@@ -88,16 +88,16 @@ const PtcImg = class {
|
|
|
88
88
|
//lazy loading
|
|
89
89
|
addIntersectionObserver() {
|
|
90
90
|
if (!this.imgUrl) {
|
|
91
|
-
console.log(
|
|
91
|
+
console.log('no image!');
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
if ('IntersectionObserver' in window) {
|
|
95
|
-
let lazyLoadBgs = document.querySelectorAll(
|
|
96
|
-
let bgObserver = new IntersectionObserver(
|
|
95
|
+
let lazyLoadBgs = document.querySelectorAll('.lazy-bg');
|
|
96
|
+
let bgObserver = new IntersectionObserver(entries => {
|
|
97
97
|
entries.forEach(entry => {
|
|
98
98
|
if (entry.isIntersecting) {
|
|
99
99
|
const image = entry.target;
|
|
100
|
-
image.classList.remove(
|
|
100
|
+
image.classList.remove('lazy-bg');
|
|
101
101
|
console.log('loaded');
|
|
102
102
|
bgObserver.unobserve(image);
|
|
103
103
|
}
|
|
@@ -127,15 +127,34 @@ const PtcImg = class {
|
|
|
127
127
|
// Add classes
|
|
128
128
|
temp.className = 'hidden-' + env;
|
|
129
129
|
// Found breakpoint
|
|
130
|
-
if (temp.offsetParent
|
|
130
|
+
if (temp.offsetParent === null) {
|
|
131
131
|
// Remove our test node
|
|
132
132
|
doc.body.removeChild(temp);
|
|
133
|
+
console.log('remove test node');
|
|
133
134
|
// Return current breakpoint
|
|
134
135
|
return env;
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
// Breakpoint not found
|
|
138
|
-
|
|
138
|
+
// Breakpoint not found, try fallback
|
|
139
|
+
doc.body.removeChild(temp);
|
|
140
|
+
return this.getFallbackBreakpoint();
|
|
141
|
+
}
|
|
142
|
+
getFallbackBreakpoint() {
|
|
143
|
+
if (window.matchMedia('(min-width: 992px)')) {
|
|
144
|
+
return 'lg';
|
|
145
|
+
}
|
|
146
|
+
else if (window.matchMedia('(min-width: 768px)')) {
|
|
147
|
+
return 'md';
|
|
148
|
+
}
|
|
149
|
+
else if (window.matchMedia('(min-width: 576px)')) {
|
|
150
|
+
return 'sm';
|
|
151
|
+
}
|
|
152
|
+
else if (window.matchMedia('(min-width: 575.5px)')) {
|
|
153
|
+
return 'xs';
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return 'Unknown breakpoint';
|
|
157
|
+
}
|
|
139
158
|
}
|
|
140
159
|
get el() { return index.getElement(this); }
|
|
141
160
|
};
|
|
@@ -76,16 +76,16 @@ export class PtcImg {
|
|
|
76
76
|
//lazy loading
|
|
77
77
|
addIntersectionObserver() {
|
|
78
78
|
if (!this.imgUrl) {
|
|
79
|
-
console.log(
|
|
79
|
+
console.log('no image!');
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if ('IntersectionObserver' in window) {
|
|
83
|
-
let lazyLoadBgs = document.querySelectorAll(
|
|
84
|
-
let bgObserver = new IntersectionObserver(
|
|
83
|
+
let lazyLoadBgs = document.querySelectorAll('.lazy-bg');
|
|
84
|
+
let bgObserver = new IntersectionObserver(entries => {
|
|
85
85
|
entries.forEach(entry => {
|
|
86
86
|
if (entry.isIntersecting) {
|
|
87
87
|
const image = entry.target;
|
|
88
|
-
image.classList.remove(
|
|
88
|
+
image.classList.remove('lazy-bg');
|
|
89
89
|
console.log('loaded');
|
|
90
90
|
bgObserver.unobserve(image);
|
|
91
91
|
}
|
|
@@ -126,15 +126,34 @@ export class PtcImg {
|
|
|
126
126
|
// Add classes
|
|
127
127
|
temp.className = 'hidden-' + env;
|
|
128
128
|
// Found breakpoint
|
|
129
|
-
if (temp.offsetParent
|
|
129
|
+
if (temp.offsetParent === null) {
|
|
130
130
|
// Remove our test node
|
|
131
131
|
doc.body.removeChild(temp);
|
|
132
|
+
console.log('remove test node');
|
|
132
133
|
// Return current breakpoint
|
|
133
134
|
return env;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
|
-
// Breakpoint not found
|
|
137
|
-
|
|
137
|
+
// Breakpoint not found, try fallback
|
|
138
|
+
doc.body.removeChild(temp);
|
|
139
|
+
return this.getFallbackBreakpoint();
|
|
140
|
+
}
|
|
141
|
+
getFallbackBreakpoint() {
|
|
142
|
+
if (window.matchMedia('(min-width: 992px)')) {
|
|
143
|
+
return 'lg';
|
|
144
|
+
}
|
|
145
|
+
else if (window.matchMedia('(min-width: 768px)')) {
|
|
146
|
+
return 'md';
|
|
147
|
+
}
|
|
148
|
+
else if (window.matchMedia('(min-width: 576px)')) {
|
|
149
|
+
return 'sm';
|
|
150
|
+
}
|
|
151
|
+
else if (window.matchMedia('(min-width: 575.5px)')) {
|
|
152
|
+
return 'xs';
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return 'Unknown breakpoint';
|
|
156
|
+
}
|
|
138
157
|
}
|
|
139
158
|
static get is() { return "ptc-img"; }
|
|
140
159
|
static get originalStyleUrls() { return {
|
|
@@ -255,7 +274,7 @@ export class PtcImg {
|
|
|
255
274
|
"type": "string",
|
|
256
275
|
"mutable": false,
|
|
257
276
|
"complexType": {
|
|
258
|
-
"original": "'radius-sm' | 'radius-md' | 'radius-lg'| ''",
|
|
277
|
+
"original": "'radius-sm' | 'radius-md' | 'radius-lg' | ''",
|
|
259
278
|
"resolved": "\"\" | \"radius-lg\" | \"radius-md\" | \"radius-sm\"",
|
|
260
279
|
"references": {}
|
|
261
280
|
},
|
|
@@ -13879,16 +13879,16 @@ const PtcImg$1 = class extends HTMLElement {
|
|
|
13879
13879
|
//lazy loading
|
|
13880
13880
|
addIntersectionObserver() {
|
|
13881
13881
|
if (!this.imgUrl) {
|
|
13882
|
-
console.log(
|
|
13882
|
+
console.log('no image!');
|
|
13883
13883
|
return;
|
|
13884
13884
|
}
|
|
13885
13885
|
if ('IntersectionObserver' in window) {
|
|
13886
|
-
let lazyLoadBgs = document.querySelectorAll(
|
|
13887
|
-
let bgObserver = new IntersectionObserver(
|
|
13886
|
+
let lazyLoadBgs = document.querySelectorAll('.lazy-bg');
|
|
13887
|
+
let bgObserver = new IntersectionObserver(entries => {
|
|
13888
13888
|
entries.forEach(entry => {
|
|
13889
13889
|
if (entry.isIntersecting) {
|
|
13890
13890
|
const image = entry.target;
|
|
13891
|
-
image.classList.remove(
|
|
13891
|
+
image.classList.remove('lazy-bg');
|
|
13892
13892
|
console.log('loaded');
|
|
13893
13893
|
bgObserver.unobserve(image);
|
|
13894
13894
|
}
|
|
@@ -13918,15 +13918,34 @@ const PtcImg$1 = class extends HTMLElement {
|
|
|
13918
13918
|
// Add classes
|
|
13919
13919
|
temp.className = 'hidden-' + env;
|
|
13920
13920
|
// Found breakpoint
|
|
13921
|
-
if (temp.offsetParent
|
|
13921
|
+
if (temp.offsetParent === null) {
|
|
13922
13922
|
// Remove our test node
|
|
13923
13923
|
doc.body.removeChild(temp);
|
|
13924
|
+
console.log('remove test node');
|
|
13924
13925
|
// Return current breakpoint
|
|
13925
13926
|
return env;
|
|
13926
13927
|
}
|
|
13927
13928
|
}
|
|
13928
|
-
// Breakpoint not found
|
|
13929
|
-
|
|
13929
|
+
// Breakpoint not found, try fallback
|
|
13930
|
+
doc.body.removeChild(temp);
|
|
13931
|
+
return this.getFallbackBreakpoint();
|
|
13932
|
+
}
|
|
13933
|
+
getFallbackBreakpoint() {
|
|
13934
|
+
if (window.matchMedia('(min-width: 992px)')) {
|
|
13935
|
+
return 'lg';
|
|
13936
|
+
}
|
|
13937
|
+
else if (window.matchMedia('(min-width: 768px)')) {
|
|
13938
|
+
return 'md';
|
|
13939
|
+
}
|
|
13940
|
+
else if (window.matchMedia('(min-width: 576px)')) {
|
|
13941
|
+
return 'sm';
|
|
13942
|
+
}
|
|
13943
|
+
else if (window.matchMedia('(min-width: 575.5px)')) {
|
|
13944
|
+
return 'xs';
|
|
13945
|
+
}
|
|
13946
|
+
else {
|
|
13947
|
+
return 'Unknown breakpoint';
|
|
13948
|
+
}
|
|
13930
13949
|
}
|
|
13931
13950
|
get el() { return this; }
|
|
13932
13951
|
static get style() { return ptcImgCss; }
|
|
@@ -84,16 +84,16 @@ const PtcImg = class {
|
|
|
84
84
|
//lazy loading
|
|
85
85
|
addIntersectionObserver() {
|
|
86
86
|
if (!this.imgUrl) {
|
|
87
|
-
console.log(
|
|
87
|
+
console.log('no image!');
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
if ('IntersectionObserver' in window) {
|
|
91
|
-
let lazyLoadBgs = document.querySelectorAll(
|
|
92
|
-
let bgObserver = new IntersectionObserver(
|
|
91
|
+
let lazyLoadBgs = document.querySelectorAll('.lazy-bg');
|
|
92
|
+
let bgObserver = new IntersectionObserver(entries => {
|
|
93
93
|
entries.forEach(entry => {
|
|
94
94
|
if (entry.isIntersecting) {
|
|
95
95
|
const image = entry.target;
|
|
96
|
-
image.classList.remove(
|
|
96
|
+
image.classList.remove('lazy-bg');
|
|
97
97
|
console.log('loaded');
|
|
98
98
|
bgObserver.unobserve(image);
|
|
99
99
|
}
|
|
@@ -123,15 +123,34 @@ const PtcImg = class {
|
|
|
123
123
|
// Add classes
|
|
124
124
|
temp.className = 'hidden-' + env;
|
|
125
125
|
// Found breakpoint
|
|
126
|
-
if (temp.offsetParent
|
|
126
|
+
if (temp.offsetParent === null) {
|
|
127
127
|
// Remove our test node
|
|
128
128
|
doc.body.removeChild(temp);
|
|
129
|
+
console.log('remove test node');
|
|
129
130
|
// Return current breakpoint
|
|
130
131
|
return env;
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
// Breakpoint not found
|
|
134
|
-
|
|
134
|
+
// Breakpoint not found, try fallback
|
|
135
|
+
doc.body.removeChild(temp);
|
|
136
|
+
return this.getFallbackBreakpoint();
|
|
137
|
+
}
|
|
138
|
+
getFallbackBreakpoint() {
|
|
139
|
+
if (window.matchMedia('(min-width: 992px)')) {
|
|
140
|
+
return 'lg';
|
|
141
|
+
}
|
|
142
|
+
else if (window.matchMedia('(min-width: 768px)')) {
|
|
143
|
+
return 'md';
|
|
144
|
+
}
|
|
145
|
+
else if (window.matchMedia('(min-width: 576px)')) {
|
|
146
|
+
return 'sm';
|
|
147
|
+
}
|
|
148
|
+
else if (window.matchMedia('(min-width: 575.5px)')) {
|
|
149
|
+
return 'xs';
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return 'Unknown breakpoint';
|
|
153
|
+
}
|
|
135
154
|
}
|
|
136
155
|
get el() { return getElement(this); }
|
|
137
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,H as e,g as n}from"./p-4f366fc3.js";let s={envs:["xs","sm","md","lg"],selector:".ptc-img",interval:250};const
|
|
1
|
+
import{r as t,h as i,H as e,g as n}from"./p-4f366fc3.js";let s={envs:["xs","sm","md","lg"],selector:".ptc-img",interval:250};const o=class{constructor(i){t(this,i),this.sizeXs="510x340",this.sizeSm="1240x496",this.sizeMd="1366x500",this.sizeLg="1920x1080",this.imageType="smart-bg",this.borderRadius="",this.loadMode="lazy-bg"}WindowResize(){this.setResponsiveBg()}render(){const t=this.getCssClassMap();return i(e,null,i("div",{class:t,"data-xs":`${this.imgUrl}:${this.sizeXs}`,"data-sm":`${this.imgUrl}:${this.sizeSm}`,"data-md":`${this.imgUrl}:${this.sizeMd}`,"data-lg":`${this.imgUrl}:${this.sizeLg}`}))}componentDidLoad(){this.addIntersectionObserver(),this.setResponsiveBg()}componentWillUpdate(){console.log("componentWillUpdate!"),this.addIntersectionObserver(),this.setResponsiveBg()}setResponsiveBg(){let t,i,e=document.querySelectorAll(s.selector),n=this.getCurrentBreakPoints();console.log("current breakpoint: "+n);for(var o=0,r=e.length;o<r;o++)t=e[o],i=t.getAttribute("data-"+n),null!==i?t.style.backgroundImage="url('"+i+"')":"object"==typeof console&&console.warn("Data attribute: data-"+n+" not found on element:\n\n"+t.outerHTML+"\n\n\n")}addIntersectionObserver(){if(this.imgUrl){if("IntersectionObserver"in window){let t=document.querySelectorAll(".lazy-bg"),i=new IntersectionObserver((t=>{t.forEach((t=>{if(t.isIntersecting){const e=t.target;e.classList.remove("lazy-bg"),console.log("loaded"),i.unobserve(e)}}))}));t.forEach((t=>{i.observe(t)}))}}else console.log("no image!")}getCssClassMap(){return{[this.imageType]:!0,"ptc-img":!0,[this.borderRadius]:!0,[this.loadMode]:!0}}getCurrentBreakPoints(){let t,i=window.document,e=i.createElement("div");i.body.appendChild(e);for(let n=s.envs.length-1;n>=0;n--)if(t=s.envs[n],e.className="hidden-"+t,null===e.offsetParent)return i.body.removeChild(e),console.log("remove test node"),t;return i.body.removeChild(e),this.getFallbackBreakpoint()}getFallbackBreakpoint(){return window.matchMedia("(min-width: 992px)")?"lg":window.matchMedia("(min-width: 768px)")?"md":window.matchMedia("(min-width: 576px)")?"sm":window.matchMedia("(min-width: 575.5px)")?"xs":"Unknown breakpoint"}get el(){return n(this)}};o.style=".smart-bg{width:100%;height:100%;background-size:cover;background-repeat:no-repeat;background-position:50% 50%}.smart-img{position:absolute;display:block;width:100%;height:100%;top:0;left:0;background-size:cover;background-repeat:no-repeat;background-position:50% 50%}.radius-sm{border-radius:var(--ptc-border-radius-small)}.radius-md{border-radius:var(--ptc-border-radius-medium)}.radius-lg{border-radius:var(--ptc-border-radius-large)}.lazy-bg{background-image:none !important;background-color:var(--color-primary-lightgrey)}@media (max-width: 767px){.hidden-xs{display:none !important}}@media (min-width: 768px) and (max-width: 991px){.hidden-sm{display:none !important}}@media (min-width: 992px) and (max-width: 1199px){.hidden-md{display:none !important}}@media (min-width: 1200px){.hidden-lg{display:none !important}}";export{o as ptc_img}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-4f366fc3.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-d4f117d2",[[1,"ptc-card",{cardType:[1,"card-type"],cardHref:[1,"card-href"],target:[1],rel:[1],hasImage:[4,"has-image"],hasVideo:[4,"has-video"],hasLottie:[4,"has-lottie"],heading:[1],cardDate:[1,"card-date"],styles:[1]}]]],["p-76dfa56f",[[1,"ptc-link",{disabled:[516],external:[516],href:[1],target:[1],linkTitle:[1,"link-title"],theme:[1],uppercase:[4],fontSize:[1,"font-size"]}]]],["p-07624831",[[1,"ptc-lottie",{jsonSrc:[1025,"json-src"],speed:[1026]}]]],["p-31f4bd0c",[[4,"list-item",{listType:[1,"list-type"],linkHref:[1,"link-href"]}]]],["p-ac0ad25e",[[1,"my-component",{first:[1],middle:[1],last:[1]}]]],["p-85131a2a",[[4,"ptc-button",{disabled:[516],type:[1],color:[1],iconAnimation:[1,"icon-animation"],iconPosition:[1,"icon-position"]}]]],["p-0a44a2f7",[[1,"ptc-footer"]]],["p-c169281f",[[1,"ptc-image",{src:[1],alt:[1],oldSrc:[32]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-4f366fc3.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-d4f117d2",[[1,"ptc-card",{cardType:[1,"card-type"],cardHref:[1,"card-href"],target:[1],rel:[1],hasImage:[4,"has-image"],hasVideo:[4,"has-video"],hasLottie:[4,"has-lottie"],heading:[1],cardDate:[1,"card-date"],styles:[1]}]]],["p-76dfa56f",[[1,"ptc-link",{disabled:[516],external:[516],href:[1],target:[1],linkTitle:[1,"link-title"],theme:[1],uppercase:[4],fontSize:[1,"font-size"]}]]],["p-07624831",[[1,"ptc-lottie",{jsonSrc:[1025,"json-src"],speed:[1026]}]]],["p-31f4bd0c",[[4,"list-item",{listType:[1,"list-type"],linkHref:[1,"link-href"]}]]],["p-ac0ad25e",[[1,"my-component",{first:[1],middle:[1],last:[1]}]]],["p-85131a2a",[[4,"ptc-button",{disabled:[516],type:[1],color:[1],iconAnimation:[1,"icon-animation"],iconPosition:[1,"icon-position"]}]]],["p-0a44a2f7",[[1,"ptc-footer"]]],["p-c169281f",[[1,"ptc-image",{src:[1],alt:[1],oldSrc:[32]}]]],["p-f1fd26f7",[[0,"ptc-img",{sizeXs:[1025,"size-xs"],sizeSm:[1025,"size-sm"],sizeMd:[1025,"size-md"],sizeLg:[1025,"size-lg"],imgUrl:[1,"img-url"],imageType:[1,"image-type"],borderRadius:[1,"border-radius"],loadMode:[1,"load-mode"]},[[9,"resize","WindowResize"]]]]],["p-7a63ca63",[[0,"ptc-list",{listType:[1,"list-type"],listItems:[16]}]]],["p-3af43980",[[1,"ptc-nav"]]],["p-fe6a3ba5",[[1,"ptc-nav-item",{url:[1025],label:[1025],ariaExpanded:[1028,"aria-expanded"],depth:[1538],hasChildren:[1028,"has-children"],parentExpanded:[1540,"parent-expanded"],navType:[1,"nav-type"]},[[0,"handleClick","handleClick"],[9,"resize","handleResize"]]]]],["p-662ae9b6",[[4,"ptc-overlay"]]],["p-83d98048",[[1,"ptc-para",{fontSize:[1,"font-size"],fontWeight:[1,"font-weight"],paraStyle:[1,"para-style"],paraMargin:[1,"para-margin"]}]]],["p-01dc360c",[[4,"ptc-picture",{lazy:[1]}]]],["p-2d357f92",[[1,"ptc-spacer",{breakpoint:[1],size:[1],direction:[1]}]]],["p-70adca2e",[[1,"ptc-span",{spanStyle:[1,"span-style"],display:[1],styles:[1]}]]],["p-77f87fa3",[[1,"ptc-title",{type:[1],textAlign:[1,"text-align"],upperline:[1]}]]],["p-1a26bade",[[0,"icon-asset",{name:[1],size:[1],type:[1],spin:[1],pulse:[1],color:[1]}]]],["p-ce8b8a72",[[1,"lottie-player",{mode:[1],autoplay:[4],background:[513],controls:[4],count:[2],direction:[2],hover:[4],loop:[516],renderer:[1],speed:[2],src:[1],currentState:[1,"current-state"],seeker:[8],intermission:[2],play:[64],pause:[64],stop:[64],seek:[64],getLottie:[64],setSpeed:[64],setDirection:[64],setLooping:[64],togglePlay:[64],toggleLooping:[64]}]]],["p-00b6c442",[[1,"ptc-date",{year:[2],month:[2],day:[2],country:[1],dateString:[1,"date-string"],dateStyles:[1,"date-styles"]}]]]],e)));
|
|
@@ -156,7 +156,7 @@ export namespace Components {
|
|
|
156
156
|
/**
|
|
157
157
|
* Image border shape
|
|
158
158
|
*/
|
|
159
|
-
"borderRadius": 'radius-sm' | 'radius-md' | 'radius-lg'| '';
|
|
159
|
+
"borderRadius": 'radius-sm' | 'radius-md' | 'radius-lg' | '';
|
|
160
160
|
/**
|
|
161
161
|
* Image type
|
|
162
162
|
*/
|
|
@@ -628,7 +628,7 @@ declare namespace LocalJSX {
|
|
|
628
628
|
/**
|
|
629
629
|
* Image border shape
|
|
630
630
|
*/
|
|
631
|
-
"borderRadius"?: 'radius-sm' | 'radius-md' | 'radius-lg'| '';
|
|
631
|
+
"borderRadius"?: 'radius-sm' | 'radius-md' | 'radius-lg' | '';
|
|
632
632
|
/**
|
|
633
633
|
* Image type
|
|
634
634
|
*/
|