@swisspost/design-system-components 9.0.0-next.24 → 9.0.0-next.25
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/index.cjs.js +21 -21
- package/dist/cjs/{package-be30a2ae.js → package-c7d204b7.js} +1 -1
- package/dist/cjs/{post-accordion-980e3707.js → post-accordion-17294430.js} +1 -1
- package/dist/cjs/{post-accordion-item-34526ddd.js → post-accordion-item-da4339cd.js} +1 -1
- package/dist/cjs/post-accordion-item.cjs.entry.js +2 -2
- package/dist/cjs/post-accordion.cjs.entry.js +2 -2
- package/dist/cjs/{post-avatar-ed964ac4.js → post-avatar-4406be64.js} +1 -1
- package/dist/cjs/post-avatar.cjs.entry.js +2 -2
- package/dist/cjs/{post-back-to-top-12ee9182.js → post-back-to-top-7ce45d24.js} +4 -4
- package/dist/cjs/post-back-to-top.cjs.entry.js +3 -3
- package/dist/cjs/{post-banner-13755850.js → post-banner-d7e1b7d5.js} +1 -1
- package/dist/cjs/post-banner.cjs.entry.js +2 -2
- package/dist/cjs/{post-breadcrumb-d6d9f5a4.js → post-breadcrumb-6a5984b4.js} +1 -1
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +2 -2
- package/dist/cjs/post-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/{post-card-control-4a6fbf19.js → post-card-control-8071448c.js} +1 -1
- package/dist/cjs/post-card-control.cjs.entry.js +2 -2
- package/dist/cjs/post-closebutton_15.cjs.entry.js +3 -3
- package/dist/cjs/{post-collapsible-trigger-5bdd97f1.js → post-collapsible-trigger-b0d3df22.js} +1 -1
- package/dist/cjs/post-collapsible_2.cjs.entry.js +2 -2
- package/dist/cjs/{post-footer-f2217a34.js → post-footer-f38ef472.js} +1 -1
- package/dist/cjs/post-footer.cjs.entry.js +2 -2
- package/dist/cjs/{post-linkarea-ced4f6ad.js → post-linkarea-3a0f8a49.js} +1 -1
- package/dist/cjs/post-linkarea.cjs.entry.js +2 -2
- package/dist/cjs/{post-menu-item-4ef32029.js → post-menu-item-107b6d80.js} +1 -1
- package/dist/cjs/{post-popover-1a5b1f4c.js → post-popover-7f47ee07.js} +1 -1
- package/dist/cjs/post-popover.cjs.entry.js +2 -2
- package/dist/cjs/{post-rating-9a9ce431.js → post-rating-8981e238.js} +1 -1
- package/dist/cjs/post-rating.cjs.entry.js +2 -2
- package/dist/cjs/{post-tab-header-43c52a57.js → post-tab-header-f89119cb.js} +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +2 -2
- package/dist/cjs/{post-tab-panel-16064007.js → post-tab-panel-665c1400.js} +1 -1
- package/dist/cjs/post-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/{post-tabs-e4739459.js → post-tabs-579f5e97.js} +1 -1
- package/dist/cjs/post-tabs.cjs.entry.js +2 -2
- package/dist/cjs/{post-tag-e1ed422b.js → post-tag-b13a44ae.js} +1 -1
- package/dist/cjs/post-tag.cjs.entry.js +2 -2
- package/dist/cjs/{post-togglebutton-38ec151e.js → post-togglebutton-241c1868.js} +79 -58
- package/dist/cjs/{post-tooltip-463eaaf6.js → post-tooltip-bedfc58a.js} +1 -1
- package/dist/cjs/post-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/{slide-8ae17ee4.js → slide-cd1f09b3.js} +6 -6
- package/dist/collection/animations/slide.js +6 -6
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +2 -2
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +75 -54
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-back-to-top2.js +3 -3
- package/dist/components/post-header2.js +77 -56
- package/dist/components/post-mainnavigation2.js +1 -1
- package/dist/components/slide.js +7 -7
- package/dist/docs.json +1 -1
- package/dist/esm/index.js +21 -21
- package/dist/esm/package-6dd1a273.js +3 -0
- package/dist/esm/{post-accordion-7f239aa6.js → post-accordion-0a3d5cb5.js} +1 -1
- package/dist/esm/{post-accordion-item-bac98792.js → post-accordion-item-7cd61396.js} +1 -1
- package/dist/esm/post-accordion-item.entry.js +2 -2
- package/dist/esm/post-accordion.entry.js +2 -2
- package/dist/esm/{post-avatar-f74f6de0.js → post-avatar-887e552c.js} +1 -1
- package/dist/esm/post-avatar.entry.js +2 -2
- package/dist/esm/{post-back-to-top-6fdad155.js → post-back-to-top-04066434.js} +4 -4
- package/dist/esm/post-back-to-top.entry.js +3 -3
- package/dist/esm/{post-banner-8448d770.js → post-banner-244b9664.js} +1 -1
- package/dist/esm/post-banner.entry.js +2 -2
- package/dist/esm/{post-breadcrumb-d35e27a0.js → post-breadcrumb-9b85c503.js} +1 -1
- package/dist/esm/post-breadcrumb-item_2.entry.js +2 -2
- package/dist/esm/post-breadcrumb.entry.js +2 -2
- package/dist/esm/{post-card-control-9233ca52.js → post-card-control-1329dcfe.js} +1 -1
- package/dist/esm/post-card-control.entry.js +2 -2
- package/dist/esm/post-closebutton_15.entry.js +3 -3
- package/dist/esm/{post-collapsible-trigger-f98e1f9a.js → post-collapsible-trigger-d2b5247c.js} +1 -1
- package/dist/esm/post-collapsible_2.entry.js +2 -2
- package/dist/esm/{post-footer-f4be2a31.js → post-footer-dd62137f.js} +1 -1
- package/dist/esm/post-footer.entry.js +2 -2
- package/dist/esm/{post-linkarea-c9d8d2be.js → post-linkarea-a32d5a77.js} +1 -1
- package/dist/esm/post-linkarea.entry.js +2 -2
- package/dist/esm/{post-menu-item-1ea9397a.js → post-menu-item-2951453a.js} +1 -1
- package/dist/esm/{post-popover-aa961cc7.js → post-popover-7aa09133.js} +1 -1
- package/dist/esm/post-popover.entry.js +2 -2
- package/dist/esm/{post-rating-17ecd4f4.js → post-rating-b8974582.js} +1 -1
- package/dist/esm/post-rating.entry.js +2 -2
- package/dist/esm/{post-tab-header-6f9449f1.js → post-tab-header-8eae9acf.js} +1 -1
- package/dist/esm/post-tab-header.entry.js +2 -2
- package/dist/esm/{post-tab-panel-fcecd935.js → post-tab-panel-e3368b04.js} +1 -1
- package/dist/esm/post-tab-panel.entry.js +2 -2
- package/dist/esm/{post-tabs-008c118d.js → post-tabs-7adeaf6b.js} +1 -1
- package/dist/esm/post-tabs.entry.js +2 -2
- package/dist/esm/{post-tag-1e709fe5.js → post-tag-441d043f.js} +1 -1
- package/dist/esm/post-tag.entry.js +2 -2
- package/dist/esm/{post-togglebutton-a932d770.js → post-togglebutton-a0510987.js} +79 -58
- package/dist/esm/{post-tooltip-ad5b722d.js → post-tooltip-8295268a.js} +1 -1
- package/dist/esm/post-tooltip.entry.js +2 -2
- package/dist/esm/{slide-62768431.js → slide-cd2850ee.js} +7 -7
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/{p-7daa1a9c.js → p-09468501.js} +1 -1
- package/dist/post-components/{p-f0719685.js → p-195f8cd8.js} +1 -1
- package/dist/post-components/{p-c1307879.js → p-1a1b3072.js} +1 -1
- package/dist/post-components/{p-5e4d5df5.js → p-1cbde7fe.js} +1 -1
- package/dist/post-components/{p-1382d4c9.js → p-1e3dd5bd.js} +1 -1
- package/dist/post-components/{p-edcc075c.js → p-1e73add7.js} +1 -1
- package/dist/post-components/{p-53dd7a51.js → p-21e1cb32.js} +1 -1
- package/dist/post-components/p-2443adcb.js +1 -0
- package/dist/post-components/p-2e9f4062.js +1 -0
- package/dist/post-components/{p-f4c60bbb.js → p-3b748f3e.js} +1 -1
- package/dist/post-components/p-3b7cfd1b.entry.js +1 -0
- package/dist/post-components/{p-78d9d13e.entry.js → p-3d1f93a6.entry.js} +1 -1
- package/dist/post-components/p-41f255ec.entry.js +1 -0
- package/dist/post-components/{p-e47d9a2b.js → p-4eb71e30.js} +1 -1
- package/dist/post-components/p-5c813ccf.entry.js +1 -0
- package/dist/post-components/p-62e18265.entry.js +1 -0
- package/dist/post-components/{p-a0345520.js → p-69841b90.js} +1 -1
- package/dist/post-components/{p-923793ff.js → p-6beffad5.js} +1 -1
- package/dist/post-components/p-792c167c.entry.js +1 -0
- package/dist/post-components/p-8bdf6637.entry.js +1 -0
- package/dist/post-components/p-94bceea9.entry.js +1 -0
- package/dist/post-components/p-9a4dd70a.entry.js +1 -0
- package/dist/post-components/p-9b052461.js +1 -0
- package/dist/post-components/p-9fc68ef1.entry.js +1 -0
- package/dist/post-components/p-a9fc29db.entry.js +1 -0
- package/dist/post-components/{p-23c2b420.js → p-ae1aa734.js} +1 -1
- package/dist/post-components/p-af6ace51.entry.js +1 -0
- package/dist/post-components/p-b46777b6.entry.js +1 -0
- package/dist/post-components/p-bb5ae350.js +1 -0
- package/dist/post-components/p-c75bad27.entry.js +1 -0
- package/dist/post-components/{p-43b10fa7.js → p-d81ae8cb.js} +1 -1
- package/dist/post-components/{p-cfe29403.js → p-e0241c1d.js} +1 -1
- package/dist/post-components/p-ee0c1389.entry.js +1 -0
- package/dist/post-components/p-ef47cf27.entry.js +1 -0
- package/dist/post-components/{p-637b619c.js → p-f0a232d7.js} +1 -1
- package/dist/post-components/{p-6545ed83.js → p-f2451c8b.js} +1 -1
- package/dist/post-components/p-f9a01f1e.entry.js +1 -0
- package/dist/post-components/p-fbe39ef0.entry.js +1 -0
- package/dist/post-components/{p-bd957c85.js → p-fc4c553c.js} +1 -1
- package/dist/post-components/{p-12d7344a.entry.js → p-fd03e4f7.entry.js} +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-header/post-header.d.ts +10 -7
- package/loaders/package.js +1 -1
- package/loaders/post-back-to-top.js +3 -3
- package/loaders/post-header.js +77 -56
- package/loaders/post-mainnavigation.js +1 -1
- package/loaders/slide.js +7 -7
- package/package.json +3 -3
- package/dist/esm/package-7deeece6.js +0 -3
- package/dist/post-components/p-0e6ce700.entry.js +0 -1
- package/dist/post-components/p-20e07b4f.entry.js +0 -1
- package/dist/post-components/p-3b7f8717.entry.js +0 -1
- package/dist/post-components/p-453aa3c8.js +0 -1
- package/dist/post-components/p-4af6dbed.js +0 -1
- package/dist/post-components/p-6239b8f8.entry.js +0 -1
- package/dist/post-components/p-64ba9026.entry.js +0 -1
- package/dist/post-components/p-6a79800f.entry.js +0 -1
- package/dist/post-components/p-6eaba4b6.entry.js +0 -1
- package/dist/post-components/p-73acda40.entry.js +0 -1
- package/dist/post-components/p-7796d5c5.entry.js +0 -1
- package/dist/post-components/p-87c82919.entry.js +0 -1
- package/dist/post-components/p-8f80c6f8.entry.js +0 -1
- package/dist/post-components/p-9184781c.entry.js +0 -1
- package/dist/post-components/p-96e3823e.entry.js +0 -1
- package/dist/post-components/p-9b4b416c.entry.js +0 -1
- package/dist/post-components/p-a5682a18.entry.js +0 -1
- package/dist/post-components/p-ac46ccd1.entry.js +0 -1
- package/dist/post-components/p-c8bfefed.js +0 -1
- package/dist/post-components/p-d6757696.entry.js +0 -1
- package/dist/post-components/p-fbe84d70.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index-d6bf2c66.js');
|
|
4
|
-
const _package = require('./package-
|
|
5
|
-
const slide = require('./slide-
|
|
4
|
+
const _package = require('./package-c7d204b7.js');
|
|
5
|
+
const slide = require('./slide-cd1f09b3.js');
|
|
6
6
|
const index$1 = require('./index-23e36ff7.js');
|
|
7
7
|
const checkNonEmpty = require('./check-non-empty-bd99d236.js');
|
|
8
8
|
const checkType = require('./check-type-cdbf6d29.js');
|
|
@@ -188,7 +188,7 @@ function getFocusableChildren(element) {
|
|
|
188
188
|
return visibleFocusableChildren;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-reduced-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out}.local-header::after{content:\"\";position:absolute;width:100%;height:1px;background-color:#e1e0dc;bottom:-1px;z-index:1}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended::after{bottom:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important;line-height:34px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:\"\";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;
|
|
191
|
+
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-reduced-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out}.local-header::after{content:\"\";position:absolute;width:100%;height:1px;background-color:#e1e0dc;bottom:-1px;z-index:1}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended::after{bottom:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important;line-height:34px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:\"\";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;inset-block-start:var(--header-height);overflow:hidden}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:16px 24px;padding-inline:32px}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}.navigation.extended>div{display:flex;flex-direction:column;height:calc(100dvh - var(--header-height))}.navigation.extended.scroll-y>div{overflow-y:auto;overflow-x:hidden}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){background-color:#fafafa;gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}";
|
|
192
192
|
const PostHeaderStyle0 = postHeaderCss;
|
|
193
193
|
|
|
194
194
|
const PostHeader = class {
|
|
@@ -201,59 +201,75 @@ const PostHeader = class {
|
|
|
201
201
|
}
|
|
202
202
|
firstFocusableEl;
|
|
203
203
|
lastFocusableEl;
|
|
204
|
-
scrollListenerElement = null;
|
|
205
|
-
overflowElement = null;
|
|
206
204
|
mobileMenu;
|
|
207
205
|
mobileMenuAnimation;
|
|
208
|
-
throttledScroll = () => this.handleScrollEvent();
|
|
209
206
|
throttledResize = throttle(50, () => this.handleResize());
|
|
207
|
+
scrollParentResizeObserver;
|
|
208
|
+
localHeaderResizeObserver;
|
|
209
|
+
get scrollParent() {
|
|
210
|
+
let element = this.host.parentElement;
|
|
211
|
+
while (element) {
|
|
212
|
+
const hasScrollParentAttr = element.hasAttribute('data-is-post-header-scroll-parent');
|
|
213
|
+
const overflow = getComputedStyle(element).overflowY;
|
|
214
|
+
if (hasScrollParentAttr || ['auto', 'scroll'].includes(overflow)) {
|
|
215
|
+
return element;
|
|
216
|
+
}
|
|
217
|
+
element = element.parentElement;
|
|
218
|
+
}
|
|
219
|
+
return document.documentElement;
|
|
220
|
+
}
|
|
221
|
+
get host() { return index.getElement(this); }
|
|
222
|
+
frozeBody(isMobileMenuExtended) {
|
|
223
|
+
if (isMobileMenuExtended) {
|
|
224
|
+
this.scrollParent.setAttribute('data-is-post-header-scroll-parent', '');
|
|
225
|
+
this.scrollParent.style.overflow = 'hidden';
|
|
226
|
+
this.host.addEventListener('keydown', this.keyboardHandler.bind(this));
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
this.scrollParent.style.overflow = '';
|
|
230
|
+
this.scrollParent.removeAttribute('data-is-post-header-scroll-parent');
|
|
231
|
+
this.host.removeEventListener('keydown', this.keyboardHandler.bind(this));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* An event emitted when the device has changed
|
|
236
|
+
*/
|
|
237
|
+
postUpdateDevice;
|
|
210
238
|
componentWillRender() {
|
|
211
|
-
this.scrollListenerElement = this.getScrollParent();
|
|
212
|
-
this.overflowElement =
|
|
213
|
-
this.scrollListenerElement === document
|
|
214
|
-
? document.documentElement
|
|
215
|
-
: this.scrollListenerElement;
|
|
216
|
-
this.scrollListenerElement.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
217
239
|
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
240
|
+
window.addEventListener('scroll', this.handleScrollEvent.bind(this), {
|
|
241
|
+
passive: true,
|
|
242
|
+
});
|
|
243
|
+
this.scrollParent.addEventListener('scroll', this.handleScrollEvent.bind(this), {
|
|
244
|
+
passive: true,
|
|
245
|
+
});
|
|
218
246
|
this.handleResize();
|
|
219
247
|
this.handleScrollEvent();
|
|
220
248
|
this.getFocusableElements();
|
|
221
249
|
}
|
|
222
250
|
componentDidLoad() {
|
|
223
|
-
this.updateLocalHeaderHeight();
|
|
224
251
|
// Check if the mega dropdown is expanded
|
|
225
|
-
document.addEventListener('postToggleMegadropdown', (
|
|
226
|
-
this.megadropdownOpen = event.detail.isVisible;
|
|
227
|
-
});
|
|
252
|
+
document.addEventListener('postToggleMegadropdown', this.megedropdownStateHandler.bind(this));
|
|
228
253
|
this.host.addEventListener('click', this.handleLinkClick.bind(this));
|
|
254
|
+
this.handleScrollParentResize();
|
|
255
|
+
this.handleLocalHeaderResize();
|
|
229
256
|
}
|
|
230
257
|
// Clean up possible side effects when post-header is disconnected
|
|
231
258
|
disconnectedCallback() {
|
|
232
259
|
this.mobileMenuExtended = false;
|
|
233
|
-
this.
|
|
234
|
-
this.
|
|
235
|
-
|
|
236
|
-
|
|
260
|
+
this.scrollParent.style.overflow = '';
|
|
261
|
+
this.scrollParent.removeAttribute('data-is-post-header-scroll-parent');
|
|
262
|
+
window.removeEventListener('resize', this.throttledResize);
|
|
263
|
+
window.removeEventListener('scroll', this.handleScrollEvent.bind(this));
|
|
264
|
+
this.scrollParent.removeEventListener('scroll', this.handleScrollEvent.bind(this));
|
|
265
|
+
document.removeEventListener('postToggleMegadropdown', this.megedropdownStateHandler.bind(this));
|
|
266
|
+
this.host.removeEventListener('keydown', this.keyboardHandler.bind(this));
|
|
237
267
|
this.host.removeEventListener('click', this.handleLinkClick.bind(this));
|
|
268
|
+
if (this.scrollParentResizeObserver)
|
|
269
|
+
this.scrollParentResizeObserver.disconnect();
|
|
270
|
+
if (this.localHeaderResizeObserver)
|
|
271
|
+
this.localHeaderResizeObserver.disconnect();
|
|
238
272
|
}
|
|
239
|
-
get host() { return index.getElement(this); }
|
|
240
|
-
frozeBody(isMobileMenuExtended) {
|
|
241
|
-
this.overflowElement.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
242
|
-
if (isMobileMenuExtended) {
|
|
243
|
-
this.host.addEventListener('keydown', e => {
|
|
244
|
-
this.keyboardHandler(e);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
this.host.removeEventListener('keydown', e => {
|
|
249
|
-
this.keyboardHandler(e);
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* An event emitted when the device has changed
|
|
255
|
-
*/
|
|
256
|
-
postUpdateDevice;
|
|
257
273
|
/**
|
|
258
274
|
* Toggles the mobile navigation.
|
|
259
275
|
*/
|
|
@@ -273,6 +289,9 @@ const PostHeader = class {
|
|
|
273
289
|
if (!this.mobileMenuExtended)
|
|
274
290
|
await this.mobileMenuAnimation.finished;
|
|
275
291
|
}
|
|
292
|
+
megedropdownStateHandler(event) {
|
|
293
|
+
this.megadropdownOpen = event.detail.isVisible;
|
|
294
|
+
}
|
|
276
295
|
// Get all the focusable elements in the post-header mobile menu
|
|
277
296
|
getFocusableElements() {
|
|
278
297
|
// Get elements in the correct order (different as the DOM order)
|
|
@@ -303,25 +322,15 @@ const PostHeader = class {
|
|
|
303
322
|
}
|
|
304
323
|
}
|
|
305
324
|
}
|
|
306
|
-
getScrollParent() {
|
|
307
|
-
let parent = this.host.parentElement;
|
|
308
|
-
if (parent.tagName === 'BODY') {
|
|
309
|
-
parent = document;
|
|
310
|
-
}
|
|
311
|
-
return parent;
|
|
312
|
-
}
|
|
313
325
|
handleScrollEvent() {
|
|
314
|
-
|
|
315
|
-
const st = Math.max(0, this.scrollListenerElement instanceof Document
|
|
316
|
-
? this.scrollListenerElement.documentElement.scrollTop
|
|
317
|
-
: this.scrollListenerElement.scrollTop);
|
|
318
|
-
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
326
|
+
this.host.style.setProperty('--header-scroll-top', `${this.scrollParent.scrollTop}px`);
|
|
319
327
|
}
|
|
320
328
|
updateLocalHeaderHeight() {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
329
|
+
const localHeaderHeight = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
|
|
330
|
+
this.host.style.setProperty('--local-header-height', `${localHeaderHeight}px`);
|
|
331
|
+
}
|
|
332
|
+
updateScrollParentHeight() {
|
|
333
|
+
this.host.style.setProperty('--header-scroll-parent-height', `${this.scrollParent.clientHeight}px`);
|
|
325
334
|
}
|
|
326
335
|
handleLinkClick(event) {
|
|
327
336
|
const target = event.target;
|
|
@@ -358,7 +367,6 @@ const PostHeader = class {
|
|
|
358
367
|
this.toggleMobileMenu();
|
|
359
368
|
this.mobileMenuAnimation.finish(); // no animation
|
|
360
369
|
}
|
|
361
|
-
this.updateLocalHeaderHeight();
|
|
362
370
|
// Apply only on change for doing work only when necessary
|
|
363
371
|
if (newDevice !== previousDevice) {
|
|
364
372
|
this.device = newDevice;
|
|
@@ -368,6 +376,19 @@ const PostHeader = class {
|
|
|
368
376
|
});
|
|
369
377
|
}
|
|
370
378
|
}
|
|
379
|
+
handleScrollParentResize() {
|
|
380
|
+
if (this.scrollParent) {
|
|
381
|
+
this.scrollParentResizeObserver = new ResizeObserver(this.updateScrollParentHeight.bind(this));
|
|
382
|
+
this.scrollParentResizeObserver.observe(this.scrollParent);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
handleLocalHeaderResize() {
|
|
386
|
+
const localHeader = this.host.shadowRoot.querySelector('.local-header');
|
|
387
|
+
if (localHeader) {
|
|
388
|
+
this.localHeaderResizeObserver = new ResizeObserver(this.updateLocalHeaderHeight.bind(this));
|
|
389
|
+
this.localHeaderResizeObserver.observe(localHeader);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
371
392
|
switchLanguageSwitchMode() {
|
|
372
393
|
const variant = this.device === 'desktop' ? 'menu' : 'list';
|
|
373
394
|
Array.from(this.host.querySelectorAll('post-language-switch')).forEach(languageSwitch => {
|
|
@@ -382,10 +403,10 @@ const PostHeader = class {
|
|
|
382
403
|
if (!this.megadropdownOpen) {
|
|
383
404
|
navigationClasses.push('scroll-y');
|
|
384
405
|
}
|
|
385
|
-
return (index.h("div", { ref: el => (this.mobileMenu = el)
|
|
406
|
+
return (index.h("div", { class: navigationClasses.join(' ') }, index.h("div", { ref: el => (this.mobileMenu = el) }, index.h("slot", { name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (index.h("div", { class: "navigation-footer" }, index.h("slot", { name: "meta-navigation" }), index.h("slot", { name: "post-language-switch" }))))));
|
|
386
407
|
}
|
|
387
408
|
render() {
|
|
388
|
-
return (index.h(index.Host, { key: '
|
|
409
|
+
return (index.h(index.Host, { key: '859829bf3a75e13fc6f2501806167936be900f1b', version: _package.version }, index.h("div", { key: '06dba64e897db49bd4a8db56786af8daf24b17ed', class: "global-header" }, index.h("div", { key: 'ad8187bf4cef41ea869109515192349eac5bb896', class: "global-sub" }, index.h("div", { key: '629afbf9b084e66665b407d597df17cef57d3c8a', class: "logo" }, index.h("slot", { key: '33f0d3d3ed83057b0a6e235aaf3313a8bf5347ed', name: "post-logo" }))), index.h("div", { key: '9acf53aa0bb748678436baaf9023cba4a65fddec', class: "global-sub" }, this.device === 'desktop' && index.h("slot", { key: '44d42df5a0c25b9892800eeb7bba8cd445a39bef', name: "meta-navigation" }), index.h("slot", { key: '2d0732014f827e989ce90ea1262e7957933bfb15', name: "global-controls" }), this.device === 'desktop' && index.h("slot", { key: 'f56457752c256e0b620f473e63b9ca6b9fe16efa', name: "post-language-switch" }), index.h("div", { key: 'b570047b4492e461ace9676e8ae3e63461f9c7ce', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, index.h("slot", { key: '681840ffdee4e11d68eb16ecddcf1869a0cfd691', name: "post-togglebutton" })))), index.h("div", { key: 'e90406e7508603222e8ab37bf790bb8a3ecc9614', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, index.h("slot", { key: '0115ccd0047409e5a10219ea61c6c09996711e1b', name: "title" }), index.h("div", { key: '2bd5d0e83650c30de7cd7628f324d726337a28b2', class: "local-sub" }, index.h("slot", { key: '0578b7fc28a6caa821d131b43b031036250750a8', name: "local-controls" }), index.h("slot", { key: 'c5ddceb8c56c76a31657633890e8562981e34249' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
|
|
389
410
|
}
|
|
390
411
|
static get watchers() { return {
|
|
391
412
|
"mobileMenuExtended": ["frozeBody"]
|
|
@@ -779,7 +800,7 @@ const PostLogo = class {
|
|
|
779
800
|
};
|
|
780
801
|
PostLogo.style = PostLogoStyle0;
|
|
781
802
|
|
|
782
|
-
const postMainnavigationCss = "post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:4px}post-mainnavigation .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.98px){post-mainnavigation .back-button{font-size:16px}}@media screen and (max-width: 599.98px){post-mainnavigation .back-button{font-size:14px}}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:\"\";mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:24px;width:24px}@media screen and (min-width: 1024px){post-mainnavigation{display:block}post-mainnavigation nav{max-width:100%;background:#fff;max-height:var(--main-navigation-height);user-select:none;transition:margin 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{z-index:4;position:absolute;inset-block-end:0;overflow:hidden}post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;background:#fff;padding:16px;box-shadow:var(--post-device-elevation-500);line-height:100%;height:var(--main-navigation-height)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{background-color:ButtonFace !important}post-mainnavigation .left-scroll-button button:hover,post-mainnavigation .right-scroll-button button:hover{background-color:Highlight !important}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button button post-icon,post-mainnavigation .right-scroll-button button post-icon{font-size:1rem}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button.d-none,post-mainnavigation .right-scroll-button.d-none{display:none}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button{inset-inline-start:0;padding-inline-end:2rem}}@media screen and (min-width: 1024px){post-mainnavigation .right-scroll-button{inset-inline-end:0;padding-inline-start:2rem}}@media screen and (min-width: 1024px){post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--main-navigation-height);gap:4px;font-size:16px;z-index:4}post-mainnavigation post-list-item>a .nav-el-active,post-mainnavigation post-list-item>button .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff;font-weight:700}post-mainnavigation post-list-item>a.selected .nav-el-active,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item>button.selected .nav-el-active,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-mainnavigation post-list-item>a.selected .nav-el-inactive,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item>button.selected .nav-el-inactive,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}}@media screen and (min-width: 1024px)and (max-width: 599.98px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}}@media screen and (min-width: 1024px){post-mainnavigation post-megadropdown button:not(.btn-icon-close),post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-megadropdown button:not(.btn-icon-close)::before,post-mainnavigation post-megadropdown a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-megadropdown button:not(.btn-icon-close).selected,post-mainnavigation post-megadropdown button:not(.btn-icon-close)[aria-expanded=true],post-mainnavigation post-megadropdown a.selected,post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover,post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover::before,post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}}@media screen and (min-width: 1024px){post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.98px){post-mainnavigation nav{transform:none !important}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{display:none}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-list-item>a::before,post-mainnavigation post-list-item>button::before,post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-list-item>a:hover::before,post-mainnavigation post-list-item>button:hover::before,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}}post-mainnavigation .back-button .btn{padding-inline:0}";
|
|
803
|
+
const postMainnavigationCss = "post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:4px}post-mainnavigation .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.98px){post-mainnavigation .back-button{font-size:16px}}@media screen and (max-width: 599.98px){post-mainnavigation .back-button{font-size:14px}}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:\"\";mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:24px;width:24px}@media screen and (min-width: 1024px){post-mainnavigation{display:block;overflow-x:hidden}post-mainnavigation nav{max-width:100%;background:#fff;max-height:var(--main-navigation-height);user-select:none;transition:margin 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{z-index:4;position:absolute;inset-block-end:0;overflow:hidden}post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;background:#fff;padding:16px;box-shadow:var(--post-device-elevation-500);line-height:100%;height:var(--main-navigation-height)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{background-color:ButtonFace !important}post-mainnavigation .left-scroll-button button:hover,post-mainnavigation .right-scroll-button button:hover{background-color:Highlight !important}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button button post-icon,post-mainnavigation .right-scroll-button button post-icon{font-size:1rem}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button.d-none,post-mainnavigation .right-scroll-button.d-none{display:none}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button{inset-inline-start:0;padding-inline-end:2rem}}@media screen and (min-width: 1024px){post-mainnavigation .right-scroll-button{inset-inline-end:0;padding-inline-start:2rem}}@media screen and (min-width: 1024px){post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--main-navigation-height);gap:4px;font-size:16px;z-index:4}post-mainnavigation post-list-item>a .nav-el-active,post-mainnavigation post-list-item>button .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff;font-weight:700}post-mainnavigation post-list-item>a.selected .nav-el-active,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item>button.selected .nav-el-active,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-mainnavigation post-list-item>a.selected .nav-el-inactive,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item>button.selected .nav-el-inactive,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}}@media screen and (min-width: 1024px)and (max-width: 599.98px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}}@media screen and (min-width: 1024px){post-mainnavigation post-megadropdown button:not(.btn-icon-close),post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-megadropdown button:not(.btn-icon-close)::before,post-mainnavigation post-megadropdown a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-megadropdown button:not(.btn-icon-close).selected,post-mainnavigation post-megadropdown button:not(.btn-icon-close)[aria-expanded=true],post-mainnavigation post-megadropdown a.selected,post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover,post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover::before,post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}}@media screen and (min-width: 1024px){post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.98px){post-mainnavigation nav{transform:none !important}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{display:none}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-list-item>a::before,post-mainnavigation post-list-item>button::before,post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-list-item>a:hover::before,post-mainnavigation post-list-item>button:hover::before,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}}post-mainnavigation .back-button .btn{padding-inline:0}";
|
|
783
804
|
const PostMainnavigationStyle0 = postMainnavigationCss;
|
|
784
805
|
|
|
785
806
|
const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index-d6bf2c66.js');
|
|
4
|
-
const _package = require('./package-
|
|
4
|
+
const _package = require('./package-c7d204b7.js');
|
|
5
5
|
const attributeObserver = require('./attribute-observer-6d8b886b.js');
|
|
6
6
|
const index$1 = require('./index-23e36ff7.js');
|
|
7
7
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTooltip = require('./post-tooltip-
|
|
5
|
+
const postTooltip = require('./post-tooltip-bedfc58a.js');
|
|
6
6
|
require('./index-d6bf2c66.js');
|
|
7
|
-
require('./package-
|
|
7
|
+
require('./package-c7d204b7.js');
|
|
8
8
|
require('./attribute-observer-6d8b886b.js');
|
|
9
9
|
require('./index-23e36ff7.js');
|
|
10
10
|
require('./constants-238701d3.js');
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
const easing = 'ease';
|
|
4
4
|
const duration = 500;
|
|
5
5
|
const fill = 'forwards';
|
|
6
|
-
function slideUp(el, translateSize = '100%') {
|
|
6
|
+
function slideUp(el, translateSize = '-100%') {
|
|
7
7
|
return el.animate([
|
|
8
|
-
{ transform:
|
|
9
|
-
{ transform:
|
|
8
|
+
{ transform: 'translateY(0)' }, // Starting position (no translation)
|
|
9
|
+
{ transform: `translateY(${translateSize})` }, // End position
|
|
10
10
|
], {
|
|
11
11
|
duration: duration,
|
|
12
12
|
easing,
|
|
13
13
|
fill,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function slideDown(el, translateSize = '100%') {
|
|
16
|
+
function slideDown(el, translateSize = '-100%') {
|
|
17
17
|
return el.animate([
|
|
18
|
-
{ transform:
|
|
19
|
-
{ transform:
|
|
18
|
+
{ transform: `translateY(${translateSize})` }, // Starting position (no translation)
|
|
19
|
+
{ transform: 'translateY(0)' }, // End position
|
|
20
20
|
], {
|
|
21
21
|
duration: duration,
|
|
22
22
|
easing,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
const easing = 'ease';
|
|
2
2
|
const duration = 500;
|
|
3
3
|
const fill = 'forwards';
|
|
4
|
-
export function slideUp(el, translateSize = '100%') {
|
|
4
|
+
export function slideUp(el, translateSize = '-100%') {
|
|
5
5
|
return el.animate([
|
|
6
|
-
{ transform:
|
|
7
|
-
{ transform:
|
|
6
|
+
{ transform: 'translateY(0)' }, // Starting position (no translation)
|
|
7
|
+
{ transform: `translateY(${translateSize})` }, // End position
|
|
8
8
|
], {
|
|
9
9
|
duration: duration,
|
|
10
10
|
easing,
|
|
11
11
|
fill,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
export function slideDown(el, translateSize = '100%') {
|
|
14
|
+
export function slideDown(el, translateSize = '-100%') {
|
|
15
15
|
return el.animate([
|
|
16
|
-
{ transform:
|
|
17
|
-
{ transform:
|
|
16
|
+
{ transform: `translateY(${translateSize})` }, // Starting position (no translation)
|
|
17
|
+
{ transform: 'translateY(0)' }, // End position
|
|
18
18
|
], {
|
|
19
19
|
duration: duration,
|
|
20
20
|
easing,
|
|
@@ -18,10 +18,10 @@ export class PostBackToTop {
|
|
|
18
18
|
// Watch for changes in belowFold
|
|
19
19
|
watchBelowFold(newValue) {
|
|
20
20
|
if (newValue) {
|
|
21
|
-
|
|
21
|
+
slideDown(this.host, this.translateY);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
|
|
24
|
+
slideUp(this.host, this.translateY);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
scrollToTop() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-reduced-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out}.local-header::after{content:"";position:absolute;width:100%;height:1px;background-color:#e1e0dc;bottom:-1px;z-index:1}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended::after{bottom:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important;line-height:34px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:"";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;
|
|
1
|
+
*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-reduced-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out}.local-header::after{content:"";position:absolute;width:100%;height:1px;background-color:#e1e0dc;bottom:-1px;z-index:1}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended::after{bottom:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important;line-height:34px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:"";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;inset-block-start:var(--header-height);overflow:hidden}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:16px 24px;padding-inline:32px}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}.navigation.extended>div{display:flex;flex-direction:column;height:calc(100dvh - var(--header-height))}.navigation.extended.scroll-y>div{overflow-y:auto;overflow-x:hidden}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){background-color:#fafafa;gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}
|
|
@@ -20,59 +20,75 @@ export class PostHeader {
|
|
|
20
20
|
}
|
|
21
21
|
firstFocusableEl;
|
|
22
22
|
lastFocusableEl;
|
|
23
|
-
scrollListenerElement = null;
|
|
24
|
-
overflowElement = null;
|
|
25
23
|
mobileMenu;
|
|
26
24
|
mobileMenuAnimation;
|
|
27
|
-
throttledScroll = () => this.handleScrollEvent();
|
|
28
25
|
throttledResize = throttle(50, () => this.handleResize());
|
|
26
|
+
scrollParentResizeObserver;
|
|
27
|
+
localHeaderResizeObserver;
|
|
28
|
+
get scrollParent() {
|
|
29
|
+
let element = this.host.parentElement;
|
|
30
|
+
while (element) {
|
|
31
|
+
const hasScrollParentAttr = element.hasAttribute('data-is-post-header-scroll-parent');
|
|
32
|
+
const overflow = getComputedStyle(element).overflowY;
|
|
33
|
+
if (hasScrollParentAttr || ['auto', 'scroll'].includes(overflow)) {
|
|
34
|
+
return element;
|
|
35
|
+
}
|
|
36
|
+
element = element.parentElement;
|
|
37
|
+
}
|
|
38
|
+
return document.documentElement;
|
|
39
|
+
}
|
|
40
|
+
host;
|
|
41
|
+
frozeBody(isMobileMenuExtended) {
|
|
42
|
+
if (isMobileMenuExtended) {
|
|
43
|
+
this.scrollParent.setAttribute('data-is-post-header-scroll-parent', '');
|
|
44
|
+
this.scrollParent.style.overflow = 'hidden';
|
|
45
|
+
this.host.addEventListener('keydown', this.keyboardHandler.bind(this));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.scrollParent.style.overflow = '';
|
|
49
|
+
this.scrollParent.removeAttribute('data-is-post-header-scroll-parent');
|
|
50
|
+
this.host.removeEventListener('keydown', this.keyboardHandler.bind(this));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* An event emitted when the device has changed
|
|
55
|
+
*/
|
|
56
|
+
postUpdateDevice;
|
|
29
57
|
componentWillRender() {
|
|
30
|
-
this.scrollListenerElement = this.getScrollParent();
|
|
31
|
-
this.overflowElement =
|
|
32
|
-
this.scrollListenerElement === document
|
|
33
|
-
? document.documentElement
|
|
34
|
-
: this.scrollListenerElement;
|
|
35
|
-
this.scrollListenerElement.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
36
58
|
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
59
|
+
window.addEventListener('scroll', this.handleScrollEvent.bind(this), {
|
|
60
|
+
passive: true,
|
|
61
|
+
});
|
|
62
|
+
this.scrollParent.addEventListener('scroll', this.handleScrollEvent.bind(this), {
|
|
63
|
+
passive: true,
|
|
64
|
+
});
|
|
37
65
|
this.handleResize();
|
|
38
66
|
this.handleScrollEvent();
|
|
39
67
|
this.getFocusableElements();
|
|
40
68
|
}
|
|
41
69
|
componentDidLoad() {
|
|
42
|
-
this.updateLocalHeaderHeight();
|
|
43
70
|
// Check if the mega dropdown is expanded
|
|
44
|
-
document.addEventListener('postToggleMegadropdown', (
|
|
45
|
-
this.megadropdownOpen = event.detail.isVisible;
|
|
46
|
-
});
|
|
71
|
+
document.addEventListener('postToggleMegadropdown', this.megedropdownStateHandler.bind(this));
|
|
47
72
|
this.host.addEventListener('click', this.handleLinkClick.bind(this));
|
|
73
|
+
this.handleScrollParentResize();
|
|
74
|
+
this.handleLocalHeaderResize();
|
|
48
75
|
}
|
|
49
76
|
// Clean up possible side effects when post-header is disconnected
|
|
50
77
|
disconnectedCallback() {
|
|
51
78
|
this.mobileMenuExtended = false;
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
79
|
+
this.scrollParent.style.overflow = '';
|
|
80
|
+
this.scrollParent.removeAttribute('data-is-post-header-scroll-parent');
|
|
81
|
+
window.removeEventListener('resize', this.throttledResize);
|
|
82
|
+
window.removeEventListener('scroll', this.handleScrollEvent.bind(this));
|
|
83
|
+
this.scrollParent.removeEventListener('scroll', this.handleScrollEvent.bind(this));
|
|
84
|
+
document.removeEventListener('postToggleMegadropdown', this.megedropdownStateHandler.bind(this));
|
|
85
|
+
this.host.removeEventListener('keydown', this.keyboardHandler.bind(this));
|
|
56
86
|
this.host.removeEventListener('click', this.handleLinkClick.bind(this));
|
|
87
|
+
if (this.scrollParentResizeObserver)
|
|
88
|
+
this.scrollParentResizeObserver.disconnect();
|
|
89
|
+
if (this.localHeaderResizeObserver)
|
|
90
|
+
this.localHeaderResizeObserver.disconnect();
|
|
57
91
|
}
|
|
58
|
-
host;
|
|
59
|
-
frozeBody(isMobileMenuExtended) {
|
|
60
|
-
this.overflowElement.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
61
|
-
if (isMobileMenuExtended) {
|
|
62
|
-
this.host.addEventListener('keydown', e => {
|
|
63
|
-
this.keyboardHandler(e);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.host.removeEventListener('keydown', e => {
|
|
68
|
-
this.keyboardHandler(e);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* An event emitted when the device has changed
|
|
74
|
-
*/
|
|
75
|
-
postUpdateDevice;
|
|
76
92
|
/**
|
|
77
93
|
* Toggles the mobile navigation.
|
|
78
94
|
*/
|
|
@@ -92,6 +108,9 @@ export class PostHeader {
|
|
|
92
108
|
if (!this.mobileMenuExtended)
|
|
93
109
|
await this.mobileMenuAnimation.finished;
|
|
94
110
|
}
|
|
111
|
+
megedropdownStateHandler(event) {
|
|
112
|
+
this.megadropdownOpen = event.detail.isVisible;
|
|
113
|
+
}
|
|
95
114
|
// Get all the focusable elements in the post-header mobile menu
|
|
96
115
|
getFocusableElements() {
|
|
97
116
|
// Get elements in the correct order (different as the DOM order)
|
|
@@ -122,25 +141,15 @@ export class PostHeader {
|
|
|
122
141
|
}
|
|
123
142
|
}
|
|
124
143
|
}
|
|
125
|
-
getScrollParent() {
|
|
126
|
-
let parent = this.host.parentElement;
|
|
127
|
-
if (parent.tagName === 'BODY') {
|
|
128
|
-
parent = document;
|
|
129
|
-
}
|
|
130
|
-
return parent;
|
|
131
|
-
}
|
|
132
144
|
handleScrollEvent() {
|
|
133
|
-
|
|
134
|
-
const st = Math.max(0, this.scrollListenerElement instanceof Document
|
|
135
|
-
? this.scrollListenerElement.documentElement.scrollTop
|
|
136
|
-
: this.scrollListenerElement.scrollTop);
|
|
137
|
-
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
145
|
+
this.host.style.setProperty('--header-scroll-top', `${this.scrollParent.scrollTop}px`);
|
|
138
146
|
}
|
|
139
147
|
updateLocalHeaderHeight() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
const localHeaderHeight = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
|
|
149
|
+
this.host.style.setProperty('--local-header-height', `${localHeaderHeight}px`);
|
|
150
|
+
}
|
|
151
|
+
updateScrollParentHeight() {
|
|
152
|
+
this.host.style.setProperty('--header-scroll-parent-height', `${this.scrollParent.clientHeight}px`);
|
|
144
153
|
}
|
|
145
154
|
handleLinkClick(event) {
|
|
146
155
|
const target = event.target;
|
|
@@ -177,7 +186,6 @@ export class PostHeader {
|
|
|
177
186
|
this.toggleMobileMenu();
|
|
178
187
|
this.mobileMenuAnimation.finish(); // no animation
|
|
179
188
|
}
|
|
180
|
-
this.updateLocalHeaderHeight();
|
|
181
189
|
// Apply only on change for doing work only when necessary
|
|
182
190
|
if (newDevice !== previousDevice) {
|
|
183
191
|
this.device = newDevice;
|
|
@@ -187,6 +195,19 @@ export class PostHeader {
|
|
|
187
195
|
});
|
|
188
196
|
}
|
|
189
197
|
}
|
|
198
|
+
handleScrollParentResize() {
|
|
199
|
+
if (this.scrollParent) {
|
|
200
|
+
this.scrollParentResizeObserver = new ResizeObserver(this.updateScrollParentHeight.bind(this));
|
|
201
|
+
this.scrollParentResizeObserver.observe(this.scrollParent);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
handleLocalHeaderResize() {
|
|
205
|
+
const localHeader = this.host.shadowRoot.querySelector('.local-header');
|
|
206
|
+
if (localHeader) {
|
|
207
|
+
this.localHeaderResizeObserver = new ResizeObserver(this.updateLocalHeaderHeight.bind(this));
|
|
208
|
+
this.localHeaderResizeObserver.observe(localHeader);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
190
211
|
switchLanguageSwitchMode() {
|
|
191
212
|
const variant = this.device === 'desktop' ? 'menu' : 'list';
|
|
192
213
|
Array.from(this.host.querySelectorAll('post-language-switch')).forEach(languageSwitch => {
|
|
@@ -201,10 +222,10 @@ export class PostHeader {
|
|
|
201
222
|
if (!this.megadropdownOpen) {
|
|
202
223
|
navigationClasses.push('scroll-y');
|
|
203
224
|
}
|
|
204
|
-
return (h("div", { ref: el => (this.mobileMenu = el)
|
|
225
|
+
return (h("div", { class: navigationClasses.join(' ') }, h("div", { ref: el => (this.mobileMenu = el) }, h("slot", { name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { class: "navigation-footer" }, h("slot", { name: "meta-navigation" }), h("slot", { name: "post-language-switch" }))))));
|
|
205
226
|
}
|
|
206
227
|
render() {
|
|
207
|
-
return (h(Host, { key: '
|
|
228
|
+
return (h(Host, { key: '859829bf3a75e13fc6f2501806167936be900f1b', version: version }, h("div", { key: '06dba64e897db49bd4a8db56786af8daf24b17ed', class: "global-header" }, h("div", { key: 'ad8187bf4cef41ea869109515192349eac5bb896', class: "global-sub" }, h("div", { key: '629afbf9b084e66665b407d597df17cef57d3c8a', class: "logo" }, h("slot", { key: '33f0d3d3ed83057b0a6e235aaf3313a8bf5347ed', name: "post-logo" }))), h("div", { key: '9acf53aa0bb748678436baaf9023cba4a65fddec', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '44d42df5a0c25b9892800eeb7bba8cd445a39bef', name: "meta-navigation" }), h("slot", { key: '2d0732014f827e989ce90ea1262e7957933bfb15', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'f56457752c256e0b620f473e63b9ca6b9fe16efa', name: "post-language-switch" }), h("div", { key: 'b570047b4492e461ace9676e8ae3e63461f9c7ce', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '681840ffdee4e11d68eb16ecddcf1869a0cfd691', name: "post-togglebutton" })))), h("div", { key: 'e90406e7508603222e8ab37bf790bb8a3ecc9614', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: '0115ccd0047409e5a10219ea61c6c09996711e1b', name: "title" }), h("div", { key: '2bd5d0e83650c30de7cd7628f324d726337a28b2', class: "local-sub" }, h("slot", { key: '0578b7fc28a6caa821d131b43b031036250750a8', name: "local-controls" }), h("slot", { key: 'c5ddceb8c56c76a31657633890e8562981e34249' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
|
|
208
229
|
}
|
|
209
230
|
static get is() { return "post-header"; }
|
|
210
231
|
static get encapsulation() { return "shadow"; }
|