cas-ds-web-components 1.3.21 → 1.3.22
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.
|
@@ -16,7 +16,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16
16
|
document.head.appendChild(font2);
|
|
17
17
|
})();
|
|
18
18
|
const name = "@eloisa-ds/all-components";
|
|
19
|
-
const version$1 = "1.3.
|
|
19
|
+
const version$1 = "1.3.22";
|
|
20
20
|
const dependencies = {};
|
|
21
21
|
const main = "./index.js";
|
|
22
22
|
const module$1 = "./index.mjs";
|
|
@@ -1024,8 +1024,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1024
1024
|
position: fixed;
|
|
1025
1025
|
top: 0;
|
|
1026
1026
|
width: 100%;
|
|
1027
|
-
transition: opacity
|
|
1028
|
-
will-change: height;
|
|
1027
|
+
transition: opacity 50ms ease-in-out;
|
|
1029
1028
|
opacity: 0;
|
|
1030
1029
|
animation: fadeIn 50ms ease-in-out;
|
|
1031
1030
|
animation-fill-mode: forwards;
|
|
@@ -24842,7 +24841,8 @@ var __publicField = (obj, key, value) => {
|
|
|
24842
24841
|
this.isMacbookAir = getIsMacbookAir();
|
|
24843
24842
|
this.isDesktop = getIsDesktop();
|
|
24844
24843
|
this.lastScrollPosition = 0;
|
|
24845
|
-
|
|
24844
|
+
const cachedAlertHeight = parseInt(sessionStorage.getItem("cas-alert-height") || "0");
|
|
24845
|
+
this.spaceHeight = 180 + cachedAlertHeight;
|
|
24846
24846
|
}
|
|
24847
24847
|
connectedCallback() {
|
|
24848
24848
|
super.connectedCallback();
|
|
@@ -24964,6 +24964,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24964
24964
|
const { showAlert, alert: alert2 } = data3;
|
|
24965
24965
|
if (showAlert) {
|
|
24966
24966
|
if (!alert2 || !alert2.enabled) {
|
|
24967
|
+
sessionStorage.removeItem("cas-alert-height");
|
|
24967
24968
|
return false;
|
|
24968
24969
|
}
|
|
24969
24970
|
let currentDate = /* @__PURE__ */ new Date();
|
|
@@ -24999,6 +25000,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24999
25000
|
const tagAlert = this.shadowRoot.querySelector("cas-alert");
|
|
25000
25001
|
tagAlert?.addEventListener("close", () => {
|
|
25001
25002
|
sessionStorage.setItem("hideAlert", "true");
|
|
25003
|
+
sessionStorage.removeItem("cas-alert-height");
|
|
25002
25004
|
this.showAlert = false;
|
|
25003
25005
|
this.spaceHeight = head + preHead + taxonomy2;
|
|
25004
25006
|
bottom.style.top = `${head + preHead}px`;
|
|
@@ -25011,6 +25013,7 @@ var __publicField = (obj, key, value) => {
|
|
|
25011
25013
|
this.spaceHeight = head + preHead + taxonomy2 + alert2;
|
|
25012
25014
|
bottom.style.top = `${head + preHead + alert2}px`;
|
|
25013
25015
|
}
|
|
25016
|
+
sessionStorage.setItem("cas-alert-height", String(Math.round(alert2)));
|
|
25014
25017
|
} else {
|
|
25015
25018
|
if (this.type !== VARIANTS$1.HOME) {
|
|
25016
25019
|
this.spaceHeight = head;
|
|
@@ -13,7 +13,7 @@ import { x as x$1, i as i$b, r as r$7, s as s$8, a as x$2, T as T$6, o as o$d, D
|
|
|
13
13
|
document.head.appendChild(font2);
|
|
14
14
|
})();
|
|
15
15
|
const name = "@eloisa-ds/all-components";
|
|
16
|
-
const version$1 = "1.3.
|
|
16
|
+
const version$1 = "1.3.22";
|
|
17
17
|
const dependencies = {};
|
|
18
18
|
const main = "./index.js";
|
|
19
19
|
const module$1 = "./index.mjs";
|
|
@@ -208,8 +208,7 @@ const styles$u = i$b`
|
|
|
208
208
|
position: fixed;
|
|
209
209
|
top: 0;
|
|
210
210
|
width: 100%;
|
|
211
|
-
transition: opacity
|
|
212
|
-
will-change: height;
|
|
211
|
+
transition: opacity 50ms ease-in-out;
|
|
213
212
|
opacity: 0;
|
|
214
213
|
animation: fadeIn 50ms ease-in-out;
|
|
215
214
|
animation-fill-mode: forwards;
|
|
@@ -24026,7 +24025,8 @@ class CasHeader extends s$8 {
|
|
|
24026
24025
|
this.isMacbookAir = getIsMacbookAir();
|
|
24027
24026
|
this.isDesktop = getIsDesktop();
|
|
24028
24027
|
this.lastScrollPosition = 0;
|
|
24029
|
-
|
|
24028
|
+
const cachedAlertHeight = parseInt(sessionStorage.getItem("cas-alert-height") || "0");
|
|
24029
|
+
this.spaceHeight = 180 + cachedAlertHeight;
|
|
24030
24030
|
}
|
|
24031
24031
|
connectedCallback() {
|
|
24032
24032
|
super.connectedCallback();
|
|
@@ -24148,6 +24148,7 @@ class CasHeader extends s$8 {
|
|
|
24148
24148
|
const { showAlert, alert } = data3;
|
|
24149
24149
|
if (showAlert) {
|
|
24150
24150
|
if (!alert || !alert.enabled) {
|
|
24151
|
+
sessionStorage.removeItem("cas-alert-height");
|
|
24151
24152
|
return false;
|
|
24152
24153
|
}
|
|
24153
24154
|
let currentDate = /* @__PURE__ */ new Date();
|
|
@@ -24183,6 +24184,7 @@ class CasHeader extends s$8 {
|
|
|
24183
24184
|
const tagAlert = this.shadowRoot.querySelector("cas-alert");
|
|
24184
24185
|
tagAlert?.addEventListener("close", () => {
|
|
24185
24186
|
sessionStorage.setItem("hideAlert", "true");
|
|
24187
|
+
sessionStorage.removeItem("cas-alert-height");
|
|
24186
24188
|
this.showAlert = false;
|
|
24187
24189
|
this.spaceHeight = head + preHead + taxonomy2;
|
|
24188
24190
|
bottom.style.top = `${head + preHead}px`;
|
|
@@ -24195,6 +24197,7 @@ class CasHeader extends s$8 {
|
|
|
24195
24197
|
this.spaceHeight = head + preHead + taxonomy2 + alert;
|
|
24196
24198
|
bottom.style.top = `${head + preHead + alert}px`;
|
|
24197
24199
|
}
|
|
24200
|
+
sessionStorage.setItem("cas-alert-height", String(Math.round(alert)));
|
|
24198
24201
|
} else {
|
|
24199
24202
|
if (this.type !== VARIANTS$1.HOME) {
|
|
24200
24203
|
this.spaceHeight = head;
|
package/build/cas-header.js
CHANGED
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
position: fixed;
|
|
39
39
|
top: 0;
|
|
40
40
|
width: 100%;
|
|
41
|
-
transition: opacity
|
|
42
|
-
will-change: height;
|
|
41
|
+
transition: opacity 50ms ease-in-out;
|
|
43
42
|
opacity: 0;
|
|
44
43
|
animation: fadeIn 50ms ease-in-out;
|
|
45
44
|
animation-fill-mode: forwards;
|
|
@@ -6390,7 +6389,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
6390
6389
|
</div>
|
|
6391
6390
|
</div>
|
|
6392
6391
|
</div>
|
|
6393
|
-
`}}M(i1,"styles",b3),M(i1,"shadowRootOptions",{...b.shadowRootOptions,mode:"open"}),M(i1,"properties",{theme:{type:String},size:{type:Number},disableMode:{type:Boolean}});const Do=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",y3=s=>{const t=document.querySelector("body");s==="dark"?t==null||t.classList.add("eloisa-ds-dark-mode"):t==null||t.classList.remove("eloisa-ds-dark-mode")};function x3(s=null,t){let e=localStorage.getItem("theme")??Do(),i=e==="dark";const a=()=>{e=Do(),i=e==="dark"};return s!==null?(i=s==="true",e=i?"dark":"light"):window.matchMedia("(prefers-color-scheme: dark)").addListener(a),{theme:e,isDark:i}}const{mobile:A3,tablet:C3,macbookAir:w3,desktop:$3}=n3,Vo=()=>window.matchMedia(`(max-width: ${A3}px)`).matches,Bo=()=>window.matchMedia(`(max-width: ${C3}px)`).matches,Uo=()=>window.matchMedia(`(max-width: ${w3}px)`).matches,jo=()=>window.matchMedia(`(max-width: ${$3}px)`).matches;class G0 extends b{constructor(){super(),this.showAlert=!1,this.alert={},this.type=B.HOME,this.theme="light",this.disableMode="true",this.disableDarkModeDefault="false",this.isMobile=Vo(),this.isTablet=Bo(),this.isMacbookAir=Uo(),this.isDesktop=jo(),this.lastScrollPosition=0
|
|
6392
|
+
`}}M(i1,"styles",b3),M(i1,"shadowRootOptions",{...b.shadowRootOptions,mode:"open"}),M(i1,"properties",{theme:{type:String},size:{type:Number},disableMode:{type:Boolean}});const Do=()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",y3=s=>{const t=document.querySelector("body");s==="dark"?t==null||t.classList.add("eloisa-ds-dark-mode"):t==null||t.classList.remove("eloisa-ds-dark-mode")};function x3(s=null,t){let e=localStorage.getItem("theme")??Do(),i=e==="dark";const a=()=>{e=Do(),i=e==="dark"};return s!==null?(i=s==="true",e=i?"dark":"light"):window.matchMedia("(prefers-color-scheme: dark)").addListener(a),{theme:e,isDark:i}}const{mobile:A3,tablet:C3,macbookAir:w3,desktop:$3}=n3,Vo=()=>window.matchMedia(`(max-width: ${A3}px)`).matches,Bo=()=>window.matchMedia(`(max-width: ${C3}px)`).matches,Uo=()=>window.matchMedia(`(max-width: ${w3}px)`).matches,jo=()=>window.matchMedia(`(max-width: ${$3}px)`).matches;class G0 extends b{constructor(){super(),this.showAlert=!1,this.alert={},this.type=B.HOME,this.theme="light",this.disableMode="true",this.disableDarkModeDefault="false",this.isMobile=Vo(),this.isTablet=Bo(),this.isMacbookAir=Uo(),this.isDesktop=jo(),this.lastScrollPosition=0;const t=parseInt(sessionStorage.getItem("cas-alert-height")||"0");this.spaceHeight=180+t}connectedCallback(){super.connectedCallback(),this.type===B.HOME&&window.addEventListener("scroll",this.handleScroll.bind(this)),window.addEventListener("resize",this.handleResize.bind(this)),window.addEventListener("resize",this.handleSpaces.bind(this))}disconnectedCallback(){this.type===B.HOME&&window.removeEventListener("scroll",this.handleScroll.bind(this)),window.removeEventListener("resize",this.handleResize.bind(this)),window.removeEventListener("resize",this.handleSpaces.bind(this)),super.disconnectedCallback()}handleScroll(){const t=window.pageYOffset||document.documentElement.scrollTop,e=this.shadowRoot.querySelector("header"),i=this.shadowRoot.querySelector("cas-header-taxonomy"),a=this.spaceHeight+"px";t<=this.spaceHeight||t<this.lastScrollPosition?(i.setAttribute("collapsed","false"),i.style.transform="translateY(0)",e.style.height=a):(i.setAttribute("collapsed","true"),i.style.transform="translateY(-100%)",e.style.height=`${this.spaceHeight-72}px`),this.lastScrollPosition=t}handleResize(){const t=this.isMobile,e=this.isTablet,i=this.isMacbookAir,a=this.isDesktop;this.isMobile=Vo(),this.isTablet=Bo(),this.isMacbookAir=Uo(),this.isDesktop=jo(),(t!==this.isMobile||e!==this.isTablet||i!==this.isMacbookAir||a!==this.isDesktop)&&this.requestUpdate()}handleTheme({theme:t}){const e={theme:t,isDark:t==="dark"},i=new CustomEvent("themeChange",{detail:e});this.theme=t,this.defaultDarkMode(),document.dispatchEvent(i)}defaultDarkMode(){y3(this.theme);const t=document.querySelector("head");if(this.disableDarkModeDefault!=="true"&&this.theme==="dark"){const e=document.createElement("style");e.setAttribute("data-name","eloisa-ds-dark-mode"),e.innerHTML=`
|
|
6394
6393
|
// * {
|
|
6395
6394
|
// filter: invert(1) hue-rotate(180deg);
|
|
6396
6395
|
// }
|
|
@@ -6407,7 +6406,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
|
6407
6406
|
// img {
|
|
6408
6407
|
// filter: none;
|
|
6409
6408
|
// }
|
|
6410
|
-
`,t==null||t.appendChild(e)}else{const e=document.querySelector('[data-name="eloisa-ds-dark-mode"]');e==null||e.remove()}}handleEvents(){const t=a=>{this.setAttribute("darkMode",a.detail.isDark)},e=()=>{this.handleTheme({theme:"dark"})},i=()=>{this.handleTheme({theme:"light"})};document.addEventListener("themeChange",t),document.addEventListener("onDarkMode",e),document.addEventListener("onLightMode",i),setTimeout(()=>{const a=this.disableMode==="true";this.darkMode==="true"&&!a&&e(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(o){!localStorage.getItem("theme")&&!a&&(o.matches?e():i())})},1e3)}async handleAlert(){const t=new WebSocket("wss://sjm3jibuni.execute-api.us-east-1.amazonaws.com/prod");t.onopen=function(){t.send(JSON.stringify({action:"getAlert"}))},t.onmessage=e=>{const i=JSON.parse(e.data);if((i==null?void 0:i.type)==="getAlert"){const{showAlert:a,alert:h}=i;if(a){if(!h||!h.enabled)return
|
|
6409
|
+
`,t==null||t.appendChild(e)}else{const e=document.querySelector('[data-name="eloisa-ds-dark-mode"]');e==null||e.remove()}}handleEvents(){const t=a=>{this.setAttribute("darkMode",a.detail.isDark)},e=()=>{this.handleTheme({theme:"dark"})},i=()=>{this.handleTheme({theme:"light"})};document.addEventListener("themeChange",t),document.addEventListener("onDarkMode",e),document.addEventListener("onLightMode",i),setTimeout(()=>{const a=this.disableMode==="true";this.darkMode==="true"&&!a&&e(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(o){!localStorage.getItem("theme")&&!a&&(o.matches?e():i())})},1e3)}async handleAlert(){const t=new WebSocket("wss://sjm3jibuni.execute-api.us-east-1.amazonaws.com/prod");t.onopen=function(){t.send(JSON.stringify({action:"getAlert"}))},t.onmessage=e=>{const i=JSON.parse(e.data);if((i==null?void 0:i.type)==="getAlert"){const{showAlert:a,alert:h}=i;if(a){if(!h||!h.enabled)return sessionStorage.removeItem("cas-alert-height"),!1;let o=new Date,r=new Date(h==null?void 0:h.startDate),n=new Date(h==null?void 0:h.endDate);if(o>r&&o<n){let l=sessionStorage.getItem("hideAlert");this.showAlert=!l&&a,this.alert={title:h==null?void 0:h.Titulo,text:h==null?void 0:h.Contenido,active:h==null?void 0:h.enabled},console.log("Alerta activa"),this.delay(200).then(()=>this.handleSpaces())}else return!1;this.requestUpdate()}}}}async delay(t){return new Promise(e=>setTimeout(e,t))}async handleSpaces(){var h,o,r;const t=this.shadowRoot.querySelector("cas-header-taxonomy"),e=(h=this.shadowRoot.querySelector("cas-header-head"))==null?void 0:h.getClientRects()[0].height,i=(o=this.shadowRoot.querySelector("cas-header-pre-head"))==null?void 0:o.getClientRects()[0].height,a=(r=this.shadowRoot.querySelector("cas-header-taxonomy"))==null?void 0:r.getClientRects()[0].height;if(this.showAlert){const n=this.shadowRoot.querySelector("cas-alert");n==null||n.addEventListener("close",()=>{sessionStorage.setItem("hideAlert","true"),sessionStorage.removeItem("cas-alert-height"),this.showAlert=!1,this.spaceHeight=e+i+a,t.style.top=`${e+i}px`,this.requestUpdate()});const l=n==null?void 0:n.getClientRects()[0].height;this.type!==B.HOME?this.spaceHeight=e+l:(this.spaceHeight=e+i+a+l,t.style.top=`${e+i+l}px`),sessionStorage.setItem("cas-alert-height",String(Math.round(l)))}else this.type!==B.HOME?this.spaceHeight=e:(this.spaceHeight=e+i+a,t.style.top=`${e+i}px`);this.requestUpdate()}async firstUpdated(){const t=this.disableMode==="true",{theme:e}=x3(this.darkMode);this.theme=t?"light":e,this.defaultDarkMode(),this.handleEvents(),await this.handleAlert(),await this.delay(200),this.handleSpaces()}render(){const{alert:t,type:e,bookingBox:i,theme:a}=this,h=i==="true";return f`
|
|
6411
6410
|
<header class="container ${this.type}" data-theme=${a} style="height: ${this.spaceHeight}px">
|
|
6412
6411
|
${this.showAlert?f`<cas-alert
|
|
6413
6412
|
showCloseButton
|