@swisspost/design-system-components 9.0.0-next.32 → 9.0.0-next.34
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/{attribute-observer-6d8b886b.js → attribute-observer-c3a805b2.js} +3 -1
- package/dist/cjs/{breakpoints-c6247c71.js → breakpoints-cdf1b747.js} +12 -7
- package/dist/cjs/event-guard-efabc84f.js +47 -0
- package/dist/cjs/get-root-8102fecd.js +17 -0
- package/dist/cjs/{index-d6bf2c66.js → index-b60129c4.js} +2 -2
- package/dist/cjs/index.cjs.js +25 -25
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/long-press-event-6e62d113.js +266 -0
- package/dist/cjs/{package-6f8f430c.js → package-3426e8f7.js} +1 -1
- package/dist/cjs/{post-accordion-e3a6d78e.js → post-accordion-3ac8dca8.js} +10 -12
- package/dist/cjs/{post-accordion-item-7ed1f630.js → post-accordion-item-aace6bc2.js} +10 -10
- package/dist/cjs/post-accordion-item.cjs.entry.js +5 -3
- package/dist/cjs/post-accordion.cjs.entry.js +5 -3
- package/dist/cjs/{post-avatar-de8ec197.js → post-avatar-53abd22f.js} +5 -4
- package/dist/cjs/post-avatar.cjs.entry.js +4 -3
- package/dist/cjs/post-back-to-top-b231fc1c.js +96 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +4 -3
- package/dist/cjs/{post-banner-bf523706.js → post-banner-e6d14bf1.js} +4 -8
- package/dist/cjs/post-banner.cjs.entry.js +4 -3
- package/dist/cjs/{post-breadcrumb-da55143a.js → post-breadcrumb-a929f2a6.js} +30 -22
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +4 -3
- package/dist/cjs/post-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/{post-card-control-0bcd7d16.js → post-card-control-cbee7b86.js} +26 -40
- package/dist/cjs/post-card-control.cjs.entry.js +4 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +6 -5
- package/dist/cjs/{post-collapsible-trigger-a5e4451d.js → post-collapsible-trigger-d1cb592a.js} +39 -46
- package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -5
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/{post-footer-b15fee73.js → post-footer-4290dafc.js} +11 -11
- package/dist/cjs/post-footer.cjs.entry.js +4 -4
- package/dist/cjs/{post-linkarea-8c85bf5e.js → post-linkarea-f22f4f92.js} +5 -5
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/{post-menu-item-509877cd.js → post-menu-item-afabaa61.js} +4 -4
- package/dist/cjs/{post-popover-1213aa19.js → post-popover-a4c72d38.js} +16 -14
- package/dist/cjs/post-popover.cjs.entry.js +5 -4
- package/dist/cjs/{post-rating-e1f8a668.js → post-rating-b87616fc.js} +4 -14
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-889a6c64.js → post-tab-header-45cb6bb4.js} +5 -4
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-300f39a9.js → post-tab-panel-00d16ba7.js} +4 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-dc281228.js → post-tabs-2c3a89d0.js} +5 -12
- package/dist/cjs/post-tabs.cjs.entry.js +4 -3
- package/dist/cjs/{post-tag-fd9e586f.js → post-tag-370a2f4d.js} +3 -3
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-togglebutton-ad6ae1e4.js → post-togglebutton-2c9552e3.js} +969 -471
- package/dist/cjs/{post-tooltip-52d690e4.js → post-tooltip-4d4d2ea9.js} +39 -296
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
- package/dist/collection/animations/collapse.js +3 -1
- package/dist/collection/components/post-accordion/post-accordion.js +6 -10
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +6 -8
- package/dist/collection/components/post-avatar/post-avatar.js +3 -4
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +37 -19
- package/dist/collection/components/post-banner/post-banner.js +0 -6
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +16 -19
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +0 -2
- package/dist/collection/components/post-card-control/post-card-control.js +24 -40
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -0
- package/dist/collection/components/post-closebutton/post-closebutton.js +12 -2
- package/dist/collection/components/post-collapsible/post-collapsible.js +4 -10
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +29 -32
- package/dist/collection/components/post-footer/post-footer.js +8 -9
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +16 -19
- package/dist/collection/components/post-icon/post-icon.js +5 -7
- package/dist/collection/components/post-language-option/post-language-option.js +1 -10
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -1
- package/dist/collection/components/post-language-switch/post-language-switch.js +25 -31
- package/dist/collection/components/post-linkarea/post-linkarea.css +1 -1
- package/dist/collection/components/post-linkarea/post-linkarea.js +2 -2
- package/dist/collection/components/post-list/post-list.js +1 -3
- package/dist/collection/components/post-list-item/post-list-item.js +1 -2
- package/dist/collection/components/post-logo/post-logo.js +1 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +98 -182
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +20 -30
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +42 -36
- package/dist/collection/components/post-menu/post-menu.js +51 -52
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +13 -15
- package/dist/collection/components/post-popover/post-popover.js +12 -12
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +30 -33
- package/dist/collection/components/post-rating/post-rating.js +1 -12
- package/dist/collection/components/post-tab-header/post-tab-header.js +2 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -3
- package/dist/collection/components/post-tabs/post-tabs.js +1 -10
- package/dist/collection/components/post-tag/post-tag.js +0 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +10 -11
- package/dist/collection/components/post-tooltip/post-tooltip.js +36 -32
- package/dist/collection/utils/attribute-observer.js +2 -1
- package/dist/collection/utils/breakpoints.js +9 -7
- package/dist/collection/utils/environment.js +2 -0
- package/dist/collection/utils/event-guard.js +43 -0
- package/dist/collection/utils/get-root.js +6 -1
- package/dist/collection/utils/index.js +5 -0
- package/dist/collection/utils/is-motion-reduced.js +2 -1
- package/dist/components/attribute-observer.js +3 -1
- package/dist/components/breakpoints.js +12 -8
- package/dist/components/event-guard.js +45 -0
- package/dist/components/get-root.js +7 -1
- package/dist/components/long-press-event.js +264 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +8 -8
- package/dist/components/post-accordion2.js +8 -10
- package/dist/components/post-avatar2.js +4 -3
- package/dist/components/post-back-to-top2.js +40 -20
- package/dist/components/post-banner2.js +2 -6
- package/dist/components/post-breadcrumb-item2.js +2 -2
- package/dist/components/post-breadcrumb2.js +28 -20
- package/dist/components/post-card-control2.js +25 -39
- package/dist/components/post-closebutton2.js +8 -3
- package/dist/components/post-collapsible-trigger2.js +33 -35
- package/dist/components/post-collapsible2.js +9 -12
- package/dist/components/post-footer2.js +8 -8
- package/dist/components/post-header2.js +18 -20
- package/dist/components/post-icon2.js +6 -6
- package/dist/components/post-language-option2.js +3 -10
- package/dist/components/post-language-switch2.js +28 -31
- package/dist/components/post-linkarea2.js +5 -4
- package/dist/components/post-list-item2.js +2 -2
- package/dist/components/post-list2.js +2 -3
- package/dist/components/post-logo2.js +3 -2
- package/dist/components/post-mainnavigation2.js +94 -182
- package/dist/components/post-megadropdown-trigger2.js +44 -36
- package/dist/components/post-megadropdown2.js +22 -31
- package/dist/components/post-menu-trigger2.js +15 -15
- package/dist/components/post-menu2.js +53 -52
- package/dist/components/post-popover2.js +14 -12
- package/dist/components/post-popovercontainer2.js +638 -36
- package/dist/components/post-rating2.js +2 -12
- package/dist/components/post-tab-header2.js +4 -3
- package/dist/components/post-tab-panel2.js +3 -3
- package/dist/components/post-tabs2.js +3 -10
- package/dist/components/post-tag2.js +1 -1
- package/dist/components/post-togglebutton2.js +12 -11
- package/dist/components/post-tooltip2.js +37 -294
- package/dist/docs.json +21 -15
- package/dist/esm/{attribute-observer-2f203993.js → attribute-observer-009deee5.js} +3 -1
- package/dist/esm/{breakpoints-bbe0c54e.js → breakpoints-7812702e.js} +12 -8
- package/dist/esm/event-guard-538ee077.js +45 -0
- package/dist/esm/get-root-1b1af46f.js +15 -0
- package/dist/esm/{index-3419e46d.js → index-f4d19816.js} +2 -2
- package/dist/esm/index.js +25 -25
- package/dist/esm/loader.js +3 -3
- package/dist/esm/long-press-event-04d24397.js +264 -0
- package/dist/esm/package-8986a24c.js +3 -0
- package/dist/esm/{post-accordion-7b6fb9c3.js → post-accordion-577b52a0.js} +10 -12
- package/dist/esm/{post-accordion-item-d40c0b26.js → post-accordion-item-99053b41.js} +10 -10
- package/dist/esm/post-accordion-item.entry.js +5 -3
- package/dist/esm/post-accordion.entry.js +5 -3
- package/dist/esm/{post-avatar-04ca6e3e.js → post-avatar-2914706c.js} +5 -4
- package/dist/esm/post-avatar.entry.js +4 -3
- package/dist/esm/post-back-to-top-4c7b1b47.js +94 -0
- package/dist/esm/post-back-to-top.entry.js +4 -3
- package/dist/esm/{post-banner-7c37e3ef.js → post-banner-295fd0f5.js} +4 -8
- package/dist/esm/post-banner.entry.js +4 -3
- package/dist/esm/{post-breadcrumb-59e4d655.js → post-breadcrumb-1abfb312.js} +30 -22
- package/dist/esm/post-breadcrumb-item_2.entry.js +4 -3
- package/dist/esm/post-breadcrumb.entry.js +4 -4
- package/dist/esm/{post-card-control-5471488b.js → post-card-control-ad72d4f8.js} +26 -40
- package/dist/esm/post-card-control.entry.js +4 -3
- package/dist/esm/post-closebutton_15.entry.js +6 -5
- package/dist/esm/{post-collapsible-trigger-1f6d816e.js → post-collapsible-trigger-6b4ece20.js} +39 -46
- package/dist/esm/post-collapsible_2.entry.js +6 -5
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/{post-footer-d30f4dc8.js → post-footer-a5105e66.js} +11 -11
- package/dist/esm/post-footer.entry.js +4 -4
- package/dist/esm/{post-linkarea-8e1a561e.js → post-linkarea-22f97a88.js} +5 -5
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/{post-menu-item-0c8477eb.js → post-menu-item-9465a1f3.js} +4 -4
- package/dist/esm/{post-popover-c43969ca.js → post-popover-e9b4569c.js} +16 -14
- package/dist/esm/post-popover.entry.js +5 -4
- package/dist/esm/{post-rating-94148df7.js → post-rating-ae16e3c9.js} +4 -14
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-82df0ba9.js → post-tab-header-11f23150.js} +5 -4
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-a6512f53.js → post-tab-panel-0f3a952e.js} +4 -4
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-d26ce341.js → post-tabs-1192509c.js} +5 -12
- package/dist/esm/post-tabs.entry.js +4 -3
- package/dist/esm/{post-tag-41d1667e.js → post-tag-8be0a71c.js} +3 -3
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-togglebutton-4f94bddb.js → post-togglebutton-b634fc7c.js} +969 -471
- package/dist/esm/{post-tooltip-20f916db.js → post-tooltip-f64bd0cc.js} +39 -296
- package/dist/esm/post-tooltip.entry.js +5 -4
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0889c759.js +1 -0
- package/dist/post-components/p-0f398677.js +1 -0
- package/dist/post-components/p-1038fc25.js +1 -0
- package/dist/post-components/p-30f94eca.entry.js +1 -0
- package/dist/post-components/p-31bb6dc5.entry.js +1 -0
- package/dist/post-components/p-32173742.js +1 -0
- package/dist/post-components/p-338a2507.js +1 -0
- package/dist/post-components/p-36540dd6.entry.js +1 -0
- package/dist/post-components/p-3aa766a6.js +1 -0
- package/dist/post-components/p-3b0158b3.js +1 -0
- package/dist/post-components/p-40db8cd5.js +1 -0
- package/dist/post-components/p-44f13ce4.entry.js +1 -0
- package/dist/post-components/p-46a9324f.entry.js +1 -0
- package/dist/post-components/p-49c5aa99.js +1 -0
- package/dist/post-components/p-4cd4a936.entry.js +1 -0
- package/dist/post-components/p-548ef2f5.entry.js +1 -0
- package/dist/post-components/p-58f453dd.js +1 -0
- package/dist/post-components/p-5f54b77f.js +1 -0
- package/dist/post-components/p-60bb7f26.js +1 -0
- package/dist/post-components/p-60bfa4be.entry.js +1 -0
- package/dist/post-components/p-6b31a76a.js +1 -0
- package/dist/post-components/p-6ee81c5d.js +1 -0
- package/dist/post-components/p-6faad212.entry.js +1 -0
- package/dist/post-components/p-722ffaae.js +1 -0
- package/dist/post-components/p-74a0b44c.entry.js +1 -0
- package/dist/post-components/{p-28e77ad3.js → p-78b4c699.js} +1 -1
- package/dist/post-components/p-7aa0468b.entry.js +1 -0
- package/dist/post-components/p-7afc495e.entry.js +1 -0
- package/dist/post-components/p-8db32dab.js +8 -0
- package/dist/post-components/p-96034ba4.entry.js +1 -0
- package/dist/post-components/p-9aaf9f54.js +1 -0
- package/dist/post-components/{p-5c758f41.js → p-9e461613.js} +1 -1
- package/dist/post-components/p-ab4073be.js +1 -0
- package/dist/post-components/p-abd7eb91.js +8 -0
- package/dist/post-components/p-afb8a487.entry.js +1 -0
- package/dist/post-components/p-b003b381.js +1 -0
- package/dist/post-components/p-b97dea1e.entry.js +1 -0
- package/dist/post-components/p-be37cf2a.js +1 -0
- package/dist/post-components/p-c31b56ed.js +1 -0
- package/dist/post-components/p-ccbb51fe.js +1 -0
- package/dist/post-components/p-d3900385.entry.js +1 -0
- package/dist/post-components/p-ef49153c.entry.js +1 -0
- package/dist/post-components/p-f27e5691.js +1 -0
- package/dist/post-components/p-f553019f.entry.js +1 -0
- package/dist/post-components/p-ffc1db17.entry.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-avatar/post-avatar.d.ts +1 -1
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +3 -1
- package/dist/types/components/post-card-control/post-card-control.d.ts +1 -1
- package/dist/types/components/post-collapsible-trigger/post-collapsible-trigger.d.ts +9 -14
- package/dist/types/components/post-footer/post-footer.d.ts +2 -2
- package/dist/types/components/post-header/post-header.d.ts +1 -0
- package/dist/types/components/post-icon/post-icon.d.ts +0 -1
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +5 -5
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +14 -39
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +2 -0
- package/dist/types/components/post-menu/post-menu.d.ts +1 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +1 -1
- package/dist/types/components/post-popover/post-popover.d.ts +3 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +1 -1
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +6 -1
- package/dist/types/components.d.ts +4 -4
- package/dist/types/popover-fn.d.ts +11 -0
- package/dist/types/utils/environment.d.ts +2 -0
- package/dist/types/utils/event-guard.d.ts +4 -0
- package/dist/types/utils/get-root.d.ts +4 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/loaders/attribute-observer.js +3 -1
- package/loaders/breakpoints.js +12 -8
- package/loaders/event-guard.js +45 -0
- package/loaders/get-root.js +7 -1
- package/loaders/index.js +3 -3
- package/loaders/long-press-event.js +264 -0
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item2.js +8 -8
- package/loaders/post-accordion.js +8 -10
- package/loaders/post-avatar.js +4 -3
- package/loaders/post-back-to-top.js +40 -20
- package/loaders/post-banner.js +2 -6
- package/loaders/post-breadcrumb-item2.js +2 -2
- package/loaders/post-breadcrumb.js +28 -20
- package/loaders/post-card-control.js +25 -39
- package/loaders/post-closebutton.js +8 -3
- package/loaders/post-collapsible-trigger2.js +33 -35
- package/loaders/post-collapsible2.js +9 -12
- package/loaders/post-footer.js +8 -8
- package/loaders/post-header.js +18 -20
- package/loaders/post-icon2.js +6 -6
- package/loaders/post-language-option.js +3 -10
- package/loaders/post-language-switch.js +28 -31
- package/loaders/post-linkarea.js +5 -4
- package/loaders/post-list-item.js +2 -2
- package/loaders/post-list.js +2 -3
- package/loaders/post-logo.js +3 -2
- package/loaders/post-mainnavigation.js +94 -182
- package/loaders/post-megadropdown-trigger.js +44 -36
- package/loaders/post-megadropdown.js +22 -31
- package/loaders/post-menu-trigger2.js +15 -15
- package/loaders/post-menu2.js +53 -52
- package/loaders/post-popover.js +14 -12
- package/loaders/post-popovercontainer2.js +638 -36
- package/loaders/post-rating.js +2 -12
- package/loaders/post-tab-header.js +4 -3
- package/loaders/post-tab-panel.js +3 -3
- package/loaders/post-tabs.js +3 -10
- package/loaders/post-tag.js +1 -1
- package/loaders/post-togglebutton.js +12 -11
- package/loaders/post-tooltip.js +37 -294
- package/package.json +5 -5
- package/dist/cjs/debounce-158fd76f.js +0 -13
- package/dist/cjs/get-root-7a3498ef.js +0 -11
- package/dist/cjs/post-back-to-top-6a1c1ba4.js +0 -76
- package/dist/components/debounce.js +0 -11
- package/dist/esm/debounce-e54c7131.js +0 -11
- package/dist/esm/get-root-7af2e0d1.js +0 -9
- package/dist/esm/package-70367d05.js +0 -3
- package/dist/esm/post-back-to-top-abe253c1.js +0 -74
- package/dist/post-components/p-015361b5.entry.js +0 -1
- package/dist/post-components/p-077edb8c.js +0 -1
- package/dist/post-components/p-08a13d05.js +0 -1
- package/dist/post-components/p-08c3b919.entry.js +0 -1
- package/dist/post-components/p-0d7b0c2e.entry.js +0 -1
- package/dist/post-components/p-12f9a91e.entry.js +0 -1
- package/dist/post-components/p-20137c6a.entry.js +0 -1
- package/dist/post-components/p-21254d9c.entry.js +0 -1
- package/dist/post-components/p-22513a27.entry.js +0 -1
- package/dist/post-components/p-3638e50d.js +0 -1
- package/dist/post-components/p-4397f28e.js +0 -1
- package/dist/post-components/p-494a2a31.js +0 -1
- package/dist/post-components/p-509987da.entry.js +0 -1
- package/dist/post-components/p-5aeb3656.js +0 -1
- package/dist/post-components/p-5d0bb74d.js +0 -1
- package/dist/post-components/p-5e0f6c12.js +0 -1
- package/dist/post-components/p-5f89f4e8.entry.js +0 -1
- package/dist/post-components/p-6213f0dc.entry.js +0 -1
- package/dist/post-components/p-6ad7bf0f.js +0 -1
- package/dist/post-components/p-6f058a98.js +0 -1
- package/dist/post-components/p-737d76cb.js +0 -15
- package/dist/post-components/p-753a1935.js +0 -1
- package/dist/post-components/p-88a2cdaa.js +0 -1
- package/dist/post-components/p-90935fdd.js +0 -1
- package/dist/post-components/p-931c4523.js +0 -1
- package/dist/post-components/p-9748a355.js +0 -1
- package/dist/post-components/p-97865e22.entry.js +0 -1
- package/dist/post-components/p-a200c9c7.js +0 -1
- package/dist/post-components/p-a35c235a.entry.js +0 -1
- package/dist/post-components/p-a4264a61.entry.js +0 -1
- package/dist/post-components/p-a54c63d0.entry.js +0 -1
- package/dist/post-components/p-aebe402d.entry.js +0 -1
- package/dist/post-components/p-b43e79e3.entry.js +0 -1
- package/dist/post-components/p-c0c71e37.js +0 -1
- package/dist/post-components/p-c0ca344d.js +0 -1
- package/dist/post-components/p-c554fcf3.js +0 -1
- package/dist/post-components/p-cff7c06f.entry.js +0 -1
- package/dist/post-components/p-d1f70a05.entry.js +0 -1
- package/dist/post-components/p-dc67e6de.entry.js +0 -1
- package/dist/post-components/p-e1baac59.js +0 -1
- package/dist/post-components/p-f1ceccf3.js +0 -1
- package/dist/post-components/p-fc91cbc2.js +0 -1
- package/loaders/debounce.js +0 -11
|
@@ -1,22 +1,61 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
2
|
-
import { v as version } from './package-
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-f4d19816.js';
|
|
2
|
+
import { v as version } from './package-8986a24c.js';
|
|
3
3
|
import { a as slideUp, s as slideDown } from './slide-cd2850ee.js';
|
|
4
|
+
import { e as eventGuard } from './event-guard-538ee077.js';
|
|
5
|
+
import { I as IS_BROWSER, b as breakpoint } from './breakpoints-7812702e.js';
|
|
4
6
|
import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-8f8fe5b0.js';
|
|
5
7
|
import { c as checkNonEmpty } from './check-non-empty-258a56b3.js';
|
|
6
8
|
import { c as checkType } from './check-type-37d5d307.js';
|
|
7
9
|
import { n as nanoid } from './index.browser-51485f85.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
+
import { g as getRoot } from './get-root-1b1af46f.js';
|
|
11
|
+
|
|
12
|
+
const focusableSelector = `:where(${[
|
|
13
|
+
'button',
|
|
14
|
+
'input:not([type="hidden"])',
|
|
15
|
+
'[tabindex]',
|
|
16
|
+
'select',
|
|
17
|
+
'textarea',
|
|
18
|
+
'[contenteditable]',
|
|
19
|
+
'a[href]',
|
|
20
|
+
'iframe',
|
|
21
|
+
'audio[controls]',
|
|
22
|
+
'video[controls]',
|
|
23
|
+
'area[href]',
|
|
24
|
+
'details > summary:first-of-type',
|
|
25
|
+
].join(',')})`;
|
|
26
|
+
const focusDisablingSelector = `:where(${[
|
|
27
|
+
'[inert]',
|
|
28
|
+
'[inert] *',
|
|
29
|
+
':disabled',
|
|
30
|
+
'dialog:not([open]) *',
|
|
31
|
+
'[popover]:not(:popover-open) *',
|
|
32
|
+
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
33
|
+
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
34
|
+
'[tabindex^="-"]',
|
|
35
|
+
'[hidden]:not([hidden="false"])',
|
|
36
|
+
].join(',')})`;
|
|
37
|
+
function getFocusableChildren(element) {
|
|
38
|
+
const focusableChildren = element.querySelectorAll(`${focusableSelector}:not(${focusDisablingSelector})`);
|
|
39
|
+
const visibleFocusableChildren = Array.from(focusableChildren).filter(child => {
|
|
40
|
+
const style = window.getComputedStyle(child.parentElement);
|
|
41
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
42
|
+
});
|
|
43
|
+
return visibleFocusableChildren;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const postClosebuttonCss = ".btn-icon-close{padding:0;border:unset;min-height:unset;min-width:unset;width:var(--post-device-sizing-notification-1);height:var(--post-device-sizing-notification-1);border-radius:var(--post-device-border-radius-round);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}.btn-icon-close>post-icon{min-width:var(--post-device-sizing-interactive-icon-size4);width:var(--post-device-sizing-interactive-icon-size4);height:var(--post-device-sizing-interactive-icon-size4)}.btn-icon-close:not(:disabled):hover,.btn-icon-close.pretend-hover{cursor:pointer;background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-icon-close:not(:disabled):hover,.btn-icon-close.pretend-hover{color:HighlightText !important}}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
|
|
47
|
+
const PostClosebuttonStyle0 = postClosebuttonCss;
|
|
10
48
|
|
|
11
49
|
const PostClosebutton = class {
|
|
12
50
|
constructor(hostRef) {
|
|
13
51
|
registerInstance(this, hostRef);
|
|
14
52
|
}
|
|
15
|
-
get host() { return getElement(this); }
|
|
16
53
|
render() {
|
|
17
|
-
return (h(Host, { key: '
|
|
54
|
+
return (h(Host, { key: 'cfa55f799fdf9ad0f3ac1eb296e063b5001de997', "data-version": version }, h("button", { key: '7c8a084f6d7278329ddfb5fc4b2b8f992a185666', class: "btn btn-icon-close", type: "button" }, h("post-icon", { key: 'fc74ccb4f0c4c091a02a41cdef918d6c3b065c8c', "aria-hidden": "true", name: "closex" }), h("span", { key: '98478b013714df6d82c6c2f533ac8ecd2abae778', class: "visually-hidden" }, h("slot", { key: '109e2bca4436986dd037d8c29088cc79395bc200' })))));
|
|
18
55
|
}
|
|
56
|
+
get host() { return getElement(this); }
|
|
19
57
|
};
|
|
58
|
+
PostClosebutton.style = PostClosebuttonStyle0;
|
|
20
59
|
|
|
21
60
|
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
22
61
|
|
|
@@ -152,51 +191,10 @@ function throttle (delay, callback, options) {
|
|
|
152
191
|
return wrapper;
|
|
153
192
|
}
|
|
154
193
|
|
|
155
|
-
const
|
|
156
|
-
'button',
|
|
157
|
-
'input:not([type="hidden"])',
|
|
158
|
-
'[tabindex]',
|
|
159
|
-
'select',
|
|
160
|
-
'textarea',
|
|
161
|
-
'[contenteditable]',
|
|
162
|
-
'a[href]',
|
|
163
|
-
'iframe',
|
|
164
|
-
'audio[controls]',
|
|
165
|
-
'video[controls]',
|
|
166
|
-
'area[href]',
|
|
167
|
-
'details > summary:first-of-type',
|
|
168
|
-
].join(',')})`;
|
|
169
|
-
const focusDisablingSelector = `:where(${[
|
|
170
|
-
'[inert]',
|
|
171
|
-
'[inert] *',
|
|
172
|
-
':disabled',
|
|
173
|
-
'dialog:not([open]) *',
|
|
174
|
-
'[popover]:not(:popover-open) *',
|
|
175
|
-
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
176
|
-
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
177
|
-
'[tabindex^="-"]',
|
|
178
|
-
'[hidden]:not([hidden="false"])',
|
|
179
|
-
].join(',')})`;
|
|
180
|
-
function getFocusableChildren(element) {
|
|
181
|
-
const focusableChildren = element.querySelectorAll(`${focusableSelector}:not(${focusDisablingSelector})`);
|
|
182
|
-
const visibleFocusableChildren = Array.from(focusableChildren).filter(child => {
|
|
183
|
-
const style = window.getComputedStyle(child.parentElement);
|
|
184
|
-
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
185
|
-
});
|
|
186
|
-
return visibleFocusableChildren;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative;--global-header-top:calc( (var(--global-header-height) - var(--global-header-reduced-height)) * -1 );--local-header-top:calc( -1 * (var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height) );--logo-height:calc(var(--global-header-height) - var(--header-scroll-top));--global-controls-top:calc(min((var(--header-scroll-top) / 4), 20px) * -1)}:host:has(.global-sub>*:not(.logo):focus-within),:host:has(.local-sub:focus-within){--global-header-top:0;--local-header-top:var(--global-header-height);--logo-height:var(--global-header-height);--global-controls-top:0}: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:var(--global-header-top);transition:inset-block-start .2s ease-in-out}}.global-sub{display:flex;align-items:center;gap:24px}@media screen and (min-width: 1024px){.global-sub:not(:has(.logo)){position:relative;transition:inset-block-start .2s ease-in-out;inset-block-start:var(--global-controls-top)}}.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{transition:height .2 ease-in-out;height:var(--logo-height)}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-inline-start: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;inset-block-end:-1px;z-index:1}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.local-header::after{background-color:Highlight}}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:var(--local-header-top);padding-block-start:18px;box-shadow:var(--post-device-elevation-300);transition:box-shadow .2s ease-in-out,inset-block-start .2s ease-in-out}}@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{inset-block-end:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:8px}@media screen and (max-width: 1023.98px){.local-sub{margin-inline-end:4px}}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}@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:sticky;z-index:1;inset-inline:0;inset-block-start:var(--header-height)}.mobile-menu{background-color:#fafafa}::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;overflow-y:auto;overflow-x:hidden;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--header-height))}.navigation.extended.megadropdown-open>div{overflow-y:hidden}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}";
|
|
194
|
+
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative;--global-header-top:calc( (var(--post-global-header-height) - var(--post-global-header-reduced-height)) * -1 );--local-header-top:calc( -1 * (var(--post-local-header-height) - var(--post-main-navigation-height)) + var(--post-global-header-reduced-height) );--logo-height:calc(var(--post-global-header-height) - var(--post-header-scroll-top, 0px));--global-controls-top:calc(min((var(--post-header-scroll-top) / 4), 20px) * -1)}:host:has(.global-sub>*:not(.logo):focus-within),:host:has(.local-sub:focus-within){--global-header-top:0;--local-header-top:var(--post-global-header-height);--logo-height:var(--post-global-header-height);--global-controls-top:0}: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(--post-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:var(--global-header-top);transition:inset-block-start .2s ease-in-out}}.global-sub{display:flex;align-items:center;gap:24px}@media screen and (min-width: 1024px){.global-sub:not(:has(.logo)){position:relative;transition:inset-block-start .2s ease-in-out;inset-block-start:var(--global-controls-top)}}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--post-global-header-height);width:var(--post-global-header-height);min-height:var(--post-global-header-reduced-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{transition:height .2 ease-in-out;height:var(--logo-height)}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-inline-start: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(--post-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;inset-block-end:-1px;z-index:1}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.local-header::after{background-color:Highlight}}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:var(--local-header-top);padding-block-start:18px;box-shadow:var(--post-device-elevation-300);transition:box-shadow .2s ease-in-out,inset-block-start .2s ease-in-out}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--post-global-header-height);padding-block:8px;flex-wrap:wrap;gap:12px}.local-header.local-header-mobile-extended::after{inset-block-end:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:8px}@media screen and (max-width: 1023.98px){.local-sub{margin-inline-end:4px}}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--post-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:sticky;z-index:1;inset-inline:0;inset-block-start:var(--post-header-height)}.mobile-menu{background-color:#fafafa}::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;overflow-y:auto;overflow-x:hidden;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height))}.navigation.extended.megadropdown-open>div{overflow-y:hidden}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}";
|
|
190
195
|
const PostHeaderStyle0 = postHeaderCss;
|
|
191
196
|
|
|
192
197
|
const PostHeader = class {
|
|
193
|
-
firstFocusableEl;
|
|
194
|
-
lastFocusableEl;
|
|
195
|
-
mobileMenu;
|
|
196
|
-
mobileMenuAnimation;
|
|
197
|
-
throttledResize = throttle(50, () => this.handleResize());
|
|
198
|
-
scrollParentResizeObserver;
|
|
199
|
-
localHeaderResizeObserver;
|
|
200
198
|
get scrollParent() {
|
|
201
199
|
const frozenScrollParent = document.querySelector('[data-post-scroll-locked]');
|
|
202
200
|
if (frozenScrollParent)
|
|
@@ -211,7 +209,6 @@ const PostHeader = class {
|
|
|
211
209
|
}
|
|
212
210
|
return document.body;
|
|
213
211
|
}
|
|
214
|
-
get host() { return getElement(this); }
|
|
215
212
|
lockBody(newValue, _oldValue, propName) {
|
|
216
213
|
const scrollParent = this.scrollParent;
|
|
217
214
|
const mobileMenuExtended = propName === 'mobileMenuExtended' ? newValue : this.mobileMenuExtended;
|
|
@@ -224,13 +221,18 @@ const PostHeader = class {
|
|
|
224
221
|
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
225
222
|
}
|
|
226
223
|
}
|
|
227
|
-
/**
|
|
228
|
-
* An event emitted when the device has changed
|
|
229
|
-
*/
|
|
230
|
-
postUpdateDevice;
|
|
231
224
|
constructor(hostRef) {
|
|
232
225
|
registerInstance(this, hostRef);
|
|
233
226
|
this.postUpdateDevice = createEvent(this, "postUpdateDevice", 7);
|
|
227
|
+
this.throttledResize = throttle(50, () => this.handleResize());
|
|
228
|
+
this.megedropdownStateHandler = (event) => {
|
|
229
|
+
eventGuard(this.host, event, {
|
|
230
|
+
targetLocalName: 'post-megadropdown',
|
|
231
|
+
delegatorSelector: 'post-header',
|
|
232
|
+
}, () => {
|
|
233
|
+
this.megadropdownOpen = event.detail.isVisible;
|
|
234
|
+
});
|
|
235
|
+
};
|
|
234
236
|
this.device = null;
|
|
235
237
|
this.mobileMenuExtended = false;
|
|
236
238
|
this.megadropdownOpen = false;
|
|
@@ -252,10 +254,12 @@ const PostHeader = class {
|
|
|
252
254
|
document.addEventListener('postToggleMegadropdown', this.megedropdownStateHandler);
|
|
253
255
|
this.host.addEventListener('click', this.handleLinkClick);
|
|
254
256
|
this.handleResize();
|
|
255
|
-
this.handleScrollEvent();
|
|
256
257
|
this.handleScrollParentResize();
|
|
257
258
|
this.lockBody(false, this.mobileMenuExtended, 'mobileMenuExtended');
|
|
258
259
|
}
|
|
260
|
+
componentWillRender() {
|
|
261
|
+
this.handleScrollEvent();
|
|
262
|
+
}
|
|
259
263
|
componentDidRender() {
|
|
260
264
|
this.getFocusableElements();
|
|
261
265
|
this.handleLocalHeaderResize();
|
|
@@ -301,9 +305,6 @@ const PostHeader = class {
|
|
|
301
305
|
});
|
|
302
306
|
}
|
|
303
307
|
}
|
|
304
|
-
megedropdownStateHandler(event) {
|
|
305
|
-
this.megadropdownOpen = event.detail.isVisible;
|
|
306
|
-
}
|
|
307
308
|
// Get all the focusable elements in the post-header mobile menu
|
|
308
309
|
getFocusableElements() {
|
|
309
310
|
// Get elements in the correct order (different as the DOM order)
|
|
@@ -336,11 +337,11 @@ const PostHeader = class {
|
|
|
336
337
|
}
|
|
337
338
|
handleScrollEvent() {
|
|
338
339
|
const scrollTop = this.scrollParent === document.body ? window.scrollY : this.scrollParent.scrollTop;
|
|
339
|
-
|
|
340
|
+
document.documentElement.style.setProperty('--post-header-scroll-top', `${scrollTop}px`);
|
|
340
341
|
}
|
|
341
342
|
updateLocalHeaderHeight() {
|
|
342
343
|
const localHeaderHeight = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
|
|
343
|
-
|
|
344
|
+
document.documentElement.style.setProperty('--post-local-header-height', `${localHeaderHeight}px`);
|
|
344
345
|
}
|
|
345
346
|
updateScrollParentHeight() {
|
|
346
347
|
this.host.style.setProperty('--header-scroll-parent-height', `${this.scrollParent.clientHeight}px`);
|
|
@@ -415,8 +416,9 @@ const PostHeader = class {
|
|
|
415
416
|
return (h("div", { class: navigationClasses.join(' '), style: { '--header-navigation-current-inset': `${mobileMenuScrollTop}px` } }, h("div", { class: "mobile-menu", 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" }))))));
|
|
416
417
|
}
|
|
417
418
|
render() {
|
|
418
|
-
return (h(Host, { key: '
|
|
419
|
+
return (h(Host, { key: 'd8b43333c00a612a3a37479750874a1efaf6a855', "data-version": version }, h("div", { key: 'b270fb139cc8730a774785c5535fb3bcdd60c59c', class: "global-header" }, h("div", { key: 'b3161c4b26a1be4707fa6c7360e6779547b7ab30', class: "global-sub" }, h("div", { key: '44ecddd8f91c86d1af0075718b63e6bf034a25b7', class: "logo" }, h("slot", { key: 'de5208255d0cf59707092c984b0fec33d317d38d', name: "post-logo" }))), h("div", { key: '199dc1da25d817b488d5c3402779130c360e0f9a', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '1337f13908a826022a1bf2a8a1a2e2bfe323900b', name: "meta-navigation" }), h("slot", { key: '2b6fbbcedc8f1803e388fdbcbcd637d6a2605c87', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: '2861c1a0f7639678edd0f584d8f98665fcf84fb0', name: "post-language-switch" }), h("div", { key: '06e2d9a4abe3a804f25ffa303f6f9ed5b7c01b60', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '772407e65d3d8f642c1e80fd8cb42b425eed4848', name: "post-togglebutton" })))), h("div", { key: '7b7a3da2a8cc848632c2e45badc52e23958a6faa', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: '96e4d68bfe0504cc09d57a8b11dabb9139d780f6', name: "title" }), h("div", { key: '240fae6f0f9d2a192a7b94110a9c4571856de90a', class: "local-sub" }, h("slot", { key: '14fd77af7dca02157248bf95d7d253d5f14e9f1e', name: "local-controls" }), h("slot", { key: '6dfac25cb64401123638ddfc6b94bbe89ae78249' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
|
|
419
420
|
}
|
|
421
|
+
get host() { return getElement(this); }
|
|
420
422
|
static get watchers() { return {
|
|
421
423
|
"device": ["lockBody"],
|
|
422
424
|
"mobileMenuExtended": ["lockBody"]
|
|
@@ -427,7 +429,7 @@ PostHeader.style = PostHeaderStyle0;
|
|
|
427
429
|
const postIconCss = ":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
|
|
428
430
|
const PostIconStyle0 = postIconCss;
|
|
429
431
|
|
|
430
|
-
const CDN_URL =
|
|
432
|
+
const CDN_URL = `https://unpkg.com/@swisspost/design-system-icons@${version}/public/post-icons/`;
|
|
431
433
|
const ANIMATION_NAMES = [
|
|
432
434
|
'cylon',
|
|
433
435
|
'cylon-vertical',
|
|
@@ -448,8 +450,6 @@ const PostIcon = class {
|
|
|
448
450
|
this.rotate = null;
|
|
449
451
|
this.scale = null;
|
|
450
452
|
}
|
|
451
|
-
isSSR = typeof window === 'undefined';
|
|
452
|
-
get host() { return getElement(this); }
|
|
453
453
|
validateAnimation(newValue = this.animation) {
|
|
454
454
|
if (newValue !== undefined)
|
|
455
455
|
checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
|
|
@@ -480,7 +480,7 @@ const PostIcon = class {
|
|
|
480
480
|
// the first definition object which defines a domain, will be used to set the domain of the file url
|
|
481
481
|
// the first definition object which defines a slug, will be used to set the slug of the file url
|
|
482
482
|
const urlDefinitions = [this.getUrlDefinition(this.base, 'both')];
|
|
483
|
-
if (
|
|
483
|
+
if (IS_BROWSER) {
|
|
484
484
|
urlDefinitions.push(this.getUrlDefinition(document.head
|
|
485
485
|
.querySelector('meta[name="design-system-settings"][data-post-icon-base]')
|
|
486
486
|
?.getAttribute('data-post-icon-base'), 'relative'));
|
|
@@ -544,8 +544,9 @@ const PostIcon = class {
|
|
|
544
544
|
this.validateAnimation();
|
|
545
545
|
}
|
|
546
546
|
render() {
|
|
547
|
-
return (h(Host, { key: '
|
|
547
|
+
return (h(Host, { key: 'b3c3efcc03f423a248e231b4b4c5d79c93ae25a6', "data-version": version }, h("span", { key: 'd73d4df11fcccb96d5346f3f8c3e18602bb8d484', style: this.getStyles() })));
|
|
548
548
|
}
|
|
549
|
+
get host() { return getElement(this); }
|
|
549
550
|
static get watchers() { return {
|
|
550
551
|
"animation": ["validateAnimation"],
|
|
551
552
|
"base": ["validateBase"],
|
|
@@ -572,7 +573,6 @@ const PostLanguageOption = class {
|
|
|
572
573
|
this.name = undefined;
|
|
573
574
|
this.url = undefined;
|
|
574
575
|
}
|
|
575
|
-
get host() { return getElement(this); }
|
|
576
576
|
validateCode() {
|
|
577
577
|
checkType(this, 'code', 'string');
|
|
578
578
|
}
|
|
@@ -597,14 +597,6 @@ const PostLanguageOption = class {
|
|
|
597
597
|
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
/**
|
|
601
|
-
* An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
|
|
602
|
-
*/
|
|
603
|
-
postChange;
|
|
604
|
-
/**
|
|
605
|
-
* An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
|
|
606
|
-
*/
|
|
607
|
-
postLanguageOptionInitiallyActive;
|
|
608
600
|
/**
|
|
609
601
|
* Selects the language option programmatically.
|
|
610
602
|
*/
|
|
@@ -625,8 +617,9 @@ const PostLanguageOption = class {
|
|
|
625
617
|
this.emitChange();
|
|
626
618
|
}
|
|
627
619
|
};
|
|
628
|
-
return (h(Host, { key: '
|
|
620
|
+
return (h(Host, { key: '3a6b9a8f63c90f431a13c1df529a2e4716ede5d8', "data-version": version }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
|
|
629
621
|
}
|
|
622
|
+
get host() { return getElement(this); }
|
|
630
623
|
static get watchers() { return {
|
|
631
624
|
"code": ["validateCode"],
|
|
632
625
|
"active": ["validateActiveProp"],
|
|
@@ -638,18 +631,21 @@ PostLanguageOption.style = PostLanguageOptionStyle0;
|
|
|
638
631
|
|
|
639
632
|
const SWITCH_VARIANTS = ['list', 'menu'];
|
|
640
633
|
|
|
641
|
-
const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;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-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px
|
|
634
|
+
const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;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-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.post-language-switch-trigger{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-language-switch-trigger: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-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger: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-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:24px;width:24px}.post-language-switch-trigger[aria-expanded=true]{background-color:#050400;color:#fff}.post-language-switch-trigger[aria-expanded=true] post-icon{transform:rotate(180deg)}.post-language-switch-trigger[aria-expanded=true]:hover{background-color:#504f4b;color:#fff}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{border:1px solid ButtonBorder}.post-language-switch-trigger[aria-expanded=true] post-icon,.post-language-switch-trigger:hover post-icon{color:HighlightText}}";
|
|
642
635
|
const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
|
|
643
636
|
|
|
644
637
|
const PostLanguageSwitch = class {
|
|
645
638
|
constructor(hostRef) {
|
|
646
639
|
registerInstance(this, hostRef);
|
|
640
|
+
this.menuId = `p${nanoid(11)}`;
|
|
647
641
|
this.caption = undefined;
|
|
648
642
|
this.description = undefined;
|
|
649
643
|
this.variant = 'list';
|
|
650
644
|
this.activeLang = undefined;
|
|
651
645
|
}
|
|
652
|
-
get
|
|
646
|
+
get languageOptions() {
|
|
647
|
+
return Array.from(this.host.querySelectorAll('post-language-option'));
|
|
648
|
+
}
|
|
653
649
|
validateCaption() {
|
|
654
650
|
checkType(this, 'caption', 'string');
|
|
655
651
|
}
|
|
@@ -667,24 +663,28 @@ const PostLanguageSwitch = class {
|
|
|
667
663
|
// Initially set variants and active language
|
|
668
664
|
// Handles cases where the language-switch is rendered after the language-options have been rendered
|
|
669
665
|
this.updateChildrenVariant();
|
|
670
|
-
this.updateActiveLanguage();
|
|
671
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* Listen for the postChange event and guard it to run only for events originating from a <post-language-option> element.
|
|
669
|
+
*/
|
|
672
670
|
handlePostChange(event) {
|
|
673
|
-
this.
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
lang.
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
671
|
+
eventGuard(this.host, event, { targetLocalName: 'post-language-option', delegatorSelector: 'post-language-switch' }, () => {
|
|
672
|
+
this.activeLang = event.detail;
|
|
673
|
+
// Update the active state in the children post-language-option components
|
|
674
|
+
this.languageOptions.forEach(lang => {
|
|
675
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
676
|
+
lang.setAttribute('active', '');
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
lang.removeAttribute('active');
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
// Hides the dropdown when an option has been clicked
|
|
683
|
+
if (this.variant === 'menu') {
|
|
684
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
685
|
+
menu.hide();
|
|
681
686
|
}
|
|
682
687
|
});
|
|
683
|
-
// Hides the dropdown when an option has been clicked
|
|
684
|
-
if (this.variant === 'menu') {
|
|
685
|
-
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
686
|
-
menu.hide();
|
|
687
|
-
}
|
|
688
688
|
}
|
|
689
689
|
/**
|
|
690
690
|
* Handles cases where the language switch is being rendered before options are available
|
|
@@ -693,34 +693,22 @@ const PostLanguageSwitch = class {
|
|
|
693
693
|
handleInitiallyActive(event) {
|
|
694
694
|
this.activeLang = event.detail;
|
|
695
695
|
}
|
|
696
|
-
get languageOptions() {
|
|
697
|
-
return this.host.querySelectorAll('post-language-option');
|
|
698
|
-
}
|
|
699
|
-
get activeLanguageOption() {
|
|
700
|
-
return this.host.querySelector('post-language-option[active]:not([active="false"])');
|
|
701
|
-
}
|
|
702
|
-
handleSlotChange() {
|
|
703
|
-
this.updateActiveLanguage();
|
|
704
|
-
}
|
|
705
|
-
updateActiveLanguage() {
|
|
706
|
-
this.activeLang = this.activeLanguageOption.getAttribute('code');
|
|
707
|
-
}
|
|
708
696
|
// Update post-language-option variant to have the correct style
|
|
709
697
|
updateChildrenVariant() {
|
|
710
698
|
this.languageOptions.forEach(el => {
|
|
711
699
|
el.setAttribute('variant', this.variant);
|
|
712
700
|
});
|
|
713
701
|
}
|
|
714
|
-
menuId = `p${nanoid(11)}`;
|
|
715
702
|
renderList() {
|
|
716
|
-
return (h(Host, { "data-version": version, role: "list", "aria-label": this.caption }, h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, h("slot",
|
|
703
|
+
return (h(Host, { "data-version": version, role: "list", "aria-label": this.caption }, h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, h("slot", null))));
|
|
717
704
|
}
|
|
718
705
|
renderDropdown() {
|
|
719
|
-
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, h("slot",
|
|
706
|
+
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, h("slot", null))));
|
|
720
707
|
}
|
|
721
708
|
render() {
|
|
722
709
|
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
723
710
|
}
|
|
711
|
+
get host() { return getElement(this); }
|
|
724
712
|
static get watchers() { return {
|
|
725
713
|
"caption": ["validateCaption"],
|
|
726
714
|
"description": ["validateDescription"],
|
|
@@ -739,8 +727,6 @@ const PostList = class {
|
|
|
739
727
|
this.titleHidden = false;
|
|
740
728
|
this.horizontal = false;
|
|
741
729
|
}
|
|
742
|
-
get host() { return getElement(this); }
|
|
743
|
-
titleEl;
|
|
744
730
|
componentWillLoad() {
|
|
745
731
|
/**
|
|
746
732
|
* Get the id set on the host element or use a random id by default
|
|
@@ -756,8 +742,9 @@ const PostList = class {
|
|
|
756
742
|
}
|
|
757
743
|
}
|
|
758
744
|
render() {
|
|
759
|
-
return (h(Host, { key: '
|
|
745
|
+
return (h(Host, { key: 'b003aa61735359b6a1d95aad8d29c609d5bb3c8b', "data-version": version }, h("div", { key: '2f69a2c72dd357767735e10d16f1b7586da6d5a3', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: '3982783d438519673a676323339a013d3edb84db' })), h("div", { key: 'b8a91c4430774f019cc46aa19393e2a1566204a5', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: '378a51785c4d52df8ae422657a16e8295b405149', name: "post-list-item" }))));
|
|
760
746
|
}
|
|
747
|
+
get host() { return getElement(this); }
|
|
761
748
|
};
|
|
762
749
|
PostList.style = PostListStyle0;
|
|
763
750
|
|
|
@@ -768,13 +755,13 @@ const PostListItem = class {
|
|
|
768
755
|
constructor(hostRef) {
|
|
769
756
|
registerInstance(this, hostRef);
|
|
770
757
|
}
|
|
771
|
-
get host() { return getElement(this); }
|
|
772
758
|
connectedCallback() {
|
|
773
759
|
this.host.setAttribute('slot', 'post-list-item');
|
|
774
760
|
}
|
|
775
761
|
render() {
|
|
776
|
-
return (h(Host, { key: '
|
|
762
|
+
return (h(Host, { key: 'c826293ea2a7446bea2f5b223934b444655198a0', role: "listitem", slot: "post-list-item", version: version }, h("slot", { key: 'b997f79da2fbc87fbc6a388c118a03c008ad2c23' })));
|
|
777
763
|
}
|
|
764
|
+
get host() { return getElement(this); }
|
|
778
765
|
};
|
|
779
766
|
PostListItem.style = PostListItemStyle0;
|
|
780
767
|
|
|
@@ -786,7 +773,6 @@ const PostLogo = class {
|
|
|
786
773
|
registerInstance(this, hostRef);
|
|
787
774
|
this.url = undefined;
|
|
788
775
|
}
|
|
789
|
-
get host() { return getElement(this); }
|
|
790
776
|
validateUrl() {
|
|
791
777
|
checkEmptyOrUrl(this, 'url');
|
|
792
778
|
}
|
|
@@ -802,284 +788,206 @@ const PostLogo = class {
|
|
|
802
788
|
render() {
|
|
803
789
|
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
804
790
|
const LogoTag = logoLink ? 'a' : 'span';
|
|
805
|
-
return (h(Host, { key: '
|
|
791
|
+
return (h(Host, { key: '7dee19302c0c560b29f09b1675135f10d41fc44a', "data-version": version }, h(LogoTag, { key: '1d851ca305d1bfc24666b416ad5f210b96d39811', class: `logo ${logoLink ? 'logo-link' : ''}`, ...(logoLink ? { href: logoLink } : {}) }, h("span", { key: 'cd75bd4040bc2f0d62e5cec2afc9529fa7c43c49', class: "description" }, h("slot", { key: 'caf63c4f823873181fa52cfb0cf38217b6a45823', onSlotchange: () => this.checkDescription() })), h("svg", { key: 'd41c14973b829eb35764c9e562fe449e65f410b4', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: '90c52e528bf4fc8e075e6517c18a59686ffd39f6', id: "Logo" }, h("rect", { key: '50633d1110596123232f07272406ebd0a32ffce8', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '7a617412c094669a66914edf769fba9ee9448b83', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), h("path", { key: '74213b21fad18ba6a1dbb07e0b0b7dcf4a89b855', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
|
|
806
792
|
}
|
|
793
|
+
get host() { return getElement(this); }
|
|
807
794
|
static get watchers() { return {
|
|
808
795
|
"url": ["validateUrl"]
|
|
809
796
|
}; }
|
|
810
797
|
};
|
|
811
798
|
PostLogo.style = PostLogoStyle0;
|
|
812
799
|
|
|
813
|
-
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>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;outline-offset:-2px !important}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 (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation>button,post-mainnavigation post-megadropdown-trigger button{border:1px solid ButtonBorder !important}post-mainnavigation>button:hover::after,post-mainnavigation>button[aria-expanded=true]::after,post-mainnavigation post-megadropdown-trigger button:hover::after,post-mainnavigation post-megadropdown-trigger button[aria-expanded=true]::after{color:HighlightText}}@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%;inset-inline-start: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}";
|
|
800
|
+
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>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;outline-offset:-2px !important}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 (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation>button,post-mainnavigation post-megadropdown-trigger button{border:1px solid ButtonBorder !important}post-mainnavigation>button:hover::after,post-mainnavigation>button[aria-expanded=true]::after,post-mainnavigation post-megadropdown-trigger button:hover::after,post-mainnavigation post-megadropdown-trigger button[aria-expanded=true]::after{color:HighlightText}}@media screen and (min-width: 1024px){post-mainnavigation{display:block;position:relative;height:var(--post-main-navigation-height);background:#fff;user-select:none}post-mainnavigation nav{flex:1 1 auto;overflow:hidden;scroll-behavior:smooth}post-mainnavigation .scroll-control{cursor:pointer;position:absolute;inset-block:0;z-index:5;padding:16px;background:#fff;box-shadow:var(--post-device-elevation-500);line-height:1}post-mainnavigation .scroll-control.scroll-left{inset-inline-start:0}post-mainnavigation .scroll-control.scroll-right{inset-inline-end:0}post-mainnavigation .scroll-control.d-none{display:none}post-mainnavigation .scroll-control post-icon{font-size:1rem}post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}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(--post-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%;inset-inline-start: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 .scroll-control{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}";
|
|
814
801
|
const PostMainnavigationStyle0 = postMainnavigationCss;
|
|
815
802
|
|
|
816
803
|
const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
|
|
817
804
|
const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
|
|
818
|
-
const NAVIGATION_LIST_SELECTOR = 'post-list > [role="list"]:not(post-megadropdown *)';
|
|
819
|
-
const NAVIGATION_ITEM_SELECTOR = 'post-list-item :is(a, button):not(post-megadropdown *)';
|
|
820
805
|
const PostMainnavigation = class {
|
|
821
806
|
constructor(hostRef) {
|
|
822
807
|
registerInstance(this, hostRef);
|
|
823
808
|
this.canScrollLeft = false;
|
|
824
809
|
this.canScrollRight = false;
|
|
825
|
-
this.
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
scrollRepeatInterval;
|
|
832
|
-
navbarDisableTimer;
|
|
833
|
-
resizeObserver;
|
|
834
|
-
mutationObserver = new MutationObserver(async (mutations) => {
|
|
835
|
-
// Wait for all elements to be hydrated
|
|
836
|
-
await Promise.all(mutations
|
|
837
|
-
.flatMap((mutation) => Array.from(mutation.addedNodes))
|
|
838
|
-
.map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
|
|
839
|
-
// Recalculate scrollability after DOM changes
|
|
840
|
-
this.checkScrollability();
|
|
841
|
-
});
|
|
842
|
-
get host() { return getElement(this); }
|
|
843
|
-
/**
|
|
844
|
-
* Update navbar translation when 'translateAmount' changes and recalculate scrollability
|
|
845
|
-
*/
|
|
846
|
-
onTranslateAmountChanges(value) {
|
|
847
|
-
this.navbar.style.marginInlineStart = `-${value}px`;
|
|
848
|
-
this.checkScrollability();
|
|
810
|
+
this.scrollRight = this.scrollRight.bind(this);
|
|
811
|
+
this.scrollLeft = this.scrollLeft.bind(this);
|
|
812
|
+
this.handleMutations = this.handleMutations.bind(this);
|
|
813
|
+
this.checkScrollability = this.checkScrollability.bind(this);
|
|
814
|
+
this.resizeObserver = new ResizeObserver(this.checkScrollability);
|
|
815
|
+
this.mutationObserver = new MutationObserver(this.handleMutations);
|
|
849
816
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
817
|
+
componentDidLoad() {
|
|
818
|
+
setTimeout(() => {
|
|
819
|
+
this.fixLayoutShift();
|
|
820
|
+
this.checkScrollability();
|
|
821
|
+
});
|
|
822
|
+
// Observe the navbar for size changes
|
|
823
|
+
this.resizeObserver.observe(this.navbar);
|
|
824
|
+
// Observe the navabar for mutation changes
|
|
825
|
+
this.mutationObserver.observe(this.navbar, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
|
|
826
|
+
// Ensure the scroll buttons are correctly displayed or hidden whenever the navbar is scrolled
|
|
827
|
+
this.navbar.addEventListener('scrollend', this.checkScrollability);
|
|
856
828
|
}
|
|
857
829
|
/**
|
|
858
|
-
*
|
|
830
|
+
* Disconnects observers and remove event listeners when the main navigation is removed from the DOM.
|
|
859
831
|
*/
|
|
860
832
|
disconnectedCallback() {
|
|
861
|
-
this.header = null;
|
|
862
833
|
this.mutationObserver.disconnect();
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
}
|
|
834
|
+
this.resizeObserver.disconnect();
|
|
835
|
+
this.navbar.removeEventListener('scrollend', this.checkScrollability);
|
|
866
836
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
837
|
+
/**
|
|
838
|
+
* Stops the repeated scrolling when the mouse button is released.
|
|
839
|
+
*/
|
|
840
|
+
stopScrolling() {
|
|
841
|
+
if (this.scrollRepeatInterval)
|
|
842
|
+
clearInterval(this.scrollRepeatInterval);
|
|
843
|
+
}
|
|
844
|
+
async handleMutations(mutations) {
|
|
845
|
+
const addedNodes = mutations.flatMap((mutation) => {
|
|
846
|
+
return Array.from(mutation.addedNodes);
|
|
871
847
|
});
|
|
872
|
-
//
|
|
873
|
-
|
|
874
|
-
this.resizeObserver.observe(this.navbar);
|
|
875
|
-
const navList = this.navigationList;
|
|
876
|
-
if (navList) {
|
|
877
|
-
this.resizeObserver.observe(navList);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
this.mutationObserver.observe(this.navigationList, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
|
|
848
|
+
// Wait for all elements to be hydrated
|
|
849
|
+
await Promise.all(addedNodes.map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
|
|
881
850
|
this.fixLayoutShift();
|
|
882
|
-
|
|
883
|
-
|
|
851
|
+
this.checkScrollability();
|
|
852
|
+
}
|
|
853
|
+
get navigationItems() {
|
|
854
|
+
return Array.from(this.navbar.querySelectorAll(':is(a, button):not(post-megadropdown *)'));
|
|
884
855
|
}
|
|
885
|
-
|
|
856
|
+
/**
|
|
857
|
+
* Hack to fix the layout shift due to bold text on active elements
|
|
858
|
+
*/
|
|
886
859
|
fixLayoutShift() {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
860
|
+
this.navigationItems
|
|
861
|
+
.filter(item => !item.matches(':has(.nav-el-active)'))
|
|
862
|
+
.forEach(item => {
|
|
863
|
+
item.innerHTML = `
|
|
864
|
+
<span class="nav-el-active">${item.innerHTML}</span>
|
|
865
|
+
<span class="nav-el-inactive" aria-hidden="true">${item.innerHTML}</span>
|
|
866
|
+
`;
|
|
867
|
+
});
|
|
891
868
|
}
|
|
892
869
|
handleBackButtonClick() {
|
|
893
|
-
|
|
894
|
-
|
|
870
|
+
const header = this.navbar.closest('post-header');
|
|
871
|
+
if (header)
|
|
872
|
+
header.toggleMobileMenu();
|
|
895
873
|
}
|
|
896
874
|
/**
|
|
897
|
-
*
|
|
875
|
+
* Returns whether scrolling is enabled in either the left or right direction.
|
|
898
876
|
*/
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (!this.canScroll || !focusedElement.matches(NAVIGATION_ITEM_SELECTOR))
|
|
902
|
-
return;
|
|
903
|
-
// We need to move the element into the view before it is focused to avoid browser default behavior
|
|
904
|
-
e.preventDefault();
|
|
905
|
-
this.withoutTransition(() => {
|
|
906
|
-
// Try scrolling in both directions, only the necessary translation will actually occur
|
|
907
|
-
this.translateRightTo(focusedElement);
|
|
908
|
-
this.translateLeftTo(focusedElement);
|
|
909
|
-
focusedElement.focus();
|
|
910
|
-
});
|
|
877
|
+
get canScroll() {
|
|
878
|
+
return this.canScrollLeft || this.canScrollRight;
|
|
911
879
|
}
|
|
912
880
|
/**
|
|
913
881
|
* Checks if scrolling is possible in either direction (left or right) and updates the state accordingly.
|
|
914
882
|
*/
|
|
915
883
|
checkScrollability() {
|
|
916
|
-
const { scrollWidth, clientWidth } = this.navbar;
|
|
917
|
-
const couldScroll = this.canScroll;
|
|
884
|
+
const { scrollLeft, scrollWidth, clientWidth } = this.navbar;
|
|
918
885
|
if (scrollWidth === clientWidth) {
|
|
919
886
|
// If scroll width equals client width, scrolling is disabled in both directions
|
|
920
887
|
this.canScrollLeft = this.canScrollRight = false;
|
|
921
888
|
}
|
|
922
889
|
else {
|
|
923
|
-
this.canScrollLeft =
|
|
924
|
-
this.canScrollRight = clientWidth +
|
|
925
|
-
}
|
|
926
|
-
if (couldScroll && !this.canScroll) {
|
|
927
|
-
this.withoutTransition(() => (this.translationAmount = 0));
|
|
890
|
+
this.canScrollLeft = Math.floor(scrollLeft) > 0; // Scrolling left is possible if not at the start
|
|
891
|
+
this.canScrollRight = Math.ceil(clientWidth + scrollLeft) < scrollWidth; // Scrolling right is possible if not at the end
|
|
928
892
|
}
|
|
929
893
|
}
|
|
930
|
-
/**
|
|
931
|
-
* Returns whether scrolling is enabled in either the left or right direction.
|
|
932
|
-
*/
|
|
933
|
-
get canScroll() {
|
|
934
|
-
return this.canScrollLeft || this.canScrollRight;
|
|
935
|
-
}
|
|
936
894
|
/**
|
|
937
895
|
* Handles the scrolling behavior when a user clicks on the left or right scroll buttons.
|
|
938
896
|
*/
|
|
939
|
-
handleScrollButtonClick(direction) {
|
|
940
|
-
if (!this.canScroll)
|
|
897
|
+
handleScrollButtonClick(e, direction) {
|
|
898
|
+
if (!this.canScroll || e.button !== 0)
|
|
941
899
|
return;
|
|
942
900
|
// Disable interaction with the navbar during scrolling
|
|
943
|
-
this.
|
|
944
|
-
//
|
|
945
|
-
this.
|
|
901
|
+
this.temporarilyDisableNavbar();
|
|
902
|
+
// Set up the correct scroll function
|
|
903
|
+
const scroll = direction === 'right' ? this.scrollRight : this.scrollLeft;
|
|
904
|
+
scroll();
|
|
946
905
|
// Repeat the scrolling action while the button is held down
|
|
947
906
|
this.scrollRepeatInterval = setInterval(() => {
|
|
948
|
-
|
|
907
|
+
scroll();
|
|
949
908
|
}, SCROLL_REPEAT_INTERVAL);
|
|
950
909
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
const couldScroll = direction === 'left' ? this.translateLeftTo(item, true) : this.translateRightTo(item, true);
|
|
964
|
-
if (couldScroll)
|
|
965
|
-
break;
|
|
910
|
+
scrollRight() {
|
|
911
|
+
const scrollRightLeftEdge = document
|
|
912
|
+
.querySelector('.scroll-right')
|
|
913
|
+
.getBoundingClientRect().left;
|
|
914
|
+
for (const navigationItem of this.navigationItems) {
|
|
915
|
+
const { right, width } = navigationItem.getBoundingClientRect();
|
|
916
|
+
// Scroll to the first navigation item that is less than 75% visible
|
|
917
|
+
const isThreeQuartersVisible = right - 0.25 * width < scrollRightLeftEdge;
|
|
918
|
+
if (!isThreeQuartersVisible) {
|
|
919
|
+
this.navbar.scrollBy({ left: right - scrollRightLeftEdge });
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
966
922
|
}
|
|
967
923
|
}
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
// Calculate the maximum translation amount to prevent scrolling past the end of the content
|
|
982
|
-
const maximumTranslation = this.navbar.scrollWidth - this.host.clientWidth;
|
|
983
|
-
// Adjust the translation amount, ensuring it doesn't exceed the maximum scrollable area
|
|
984
|
-
const { marginRight } = getComputedStyle(this.navigationList);
|
|
985
|
-
this.translationAmount =
|
|
986
|
-
Math.min(this.translationAmount + translationIncrease, maximumTranslation) +
|
|
987
|
-
parseInt(marginRight);
|
|
988
|
-
return true;
|
|
989
|
-
}
|
|
990
|
-
translateLeftTo(navigationItem, skipSmallTranslation = false) {
|
|
991
|
-
const listItem = navigationItem.closest('post-list-item');
|
|
992
|
-
// Get the left edge position of the list item relative to the left of the screen
|
|
993
|
-
const leftEdgePosition = listItem.offsetLeft;
|
|
994
|
-
// Calculate the first visible position on the screen to the left, right after the left scroll button
|
|
995
|
-
const firstVisiblePosition = this.leftScrollButton.clientWidth;
|
|
996
|
-
// If the item is already fully visible, no translation is needed
|
|
997
|
-
if (leftEdgePosition > firstVisiblePosition)
|
|
998
|
-
return false;
|
|
999
|
-
const translationDecrease = firstVisiblePosition - leftEdgePosition + 1; // + 1 because offset values are rounded
|
|
1000
|
-
// If the required scroll distance is too small (less than half the width of the item), don't perform the scroll
|
|
1001
|
-
if (skipSmallTranslation && translationDecrease < listItem.clientWidth / 2)
|
|
1002
|
-
return false;
|
|
1003
|
-
// Calculate the minimum allowed translation amount (no negative scrolling allowed)
|
|
1004
|
-
const minimumTranslation = 0;
|
|
1005
|
-
// Adjust the translation amount, ensuring it doesn't go below the minimum scrollable area
|
|
1006
|
-
const { marginLeft } = getComputedStyle(this.navigationList);
|
|
1007
|
-
this.translationAmount = Math.max(this.translationAmount - translationDecrease - parseInt(marginLeft), minimumTranslation);
|
|
1008
|
-
return true;
|
|
1009
|
-
}
|
|
1010
|
-
/**
|
|
1011
|
-
* Returns the navigation list container element
|
|
1012
|
-
*/
|
|
1013
|
-
get navigationList() {
|
|
1014
|
-
return this.navbar.querySelector(NAVIGATION_LIST_SELECTOR);
|
|
1015
|
-
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Returns the navigation items
|
|
1018
|
-
*/
|
|
1019
|
-
get navigationItems() {
|
|
1020
|
-
return this.navbar.querySelectorAll(NAVIGATION_ITEM_SELECTOR);
|
|
924
|
+
scrollLeft() {
|
|
925
|
+
const scrollLeftRightEdge = document
|
|
926
|
+
.querySelector('.scroll-left')
|
|
927
|
+
.getBoundingClientRect().right;
|
|
928
|
+
for (const navigationItem of this.navigationItems.reverse()) {
|
|
929
|
+
const { left, width } = navigationItem.getBoundingClientRect();
|
|
930
|
+
// Scroll to the first navigation item that is less than 75% visible
|
|
931
|
+
const isThreeQuartersVisible = left + 0.25 * width > scrollLeftRightEdge;
|
|
932
|
+
if (!isThreeQuartersVisible) {
|
|
933
|
+
this.navbar.scrollBy({ left: left - scrollLeftRightEdge });
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
1021
937
|
}
|
|
1022
938
|
/**
|
|
1023
939
|
* Temporarily disables interactions with the navbar during scrolling to prevent accidental clicks.
|
|
1024
940
|
* Re-enables interactions after a brief delay to avoid blocking the user entirely.
|
|
1025
941
|
*/
|
|
1026
|
-
|
|
942
|
+
temporarilyDisableNavbar() {
|
|
1027
943
|
if (this.navbarDisableTimer)
|
|
1028
944
|
clearTimeout(this.navbarDisableTimer);
|
|
1029
|
-
this.navbar.
|
|
945
|
+
this.navbar.setAttribute('inert', '');
|
|
1030
946
|
this.navbarDisableTimer = setTimeout(() => {
|
|
1031
|
-
this.navbar.
|
|
947
|
+
this.navbar.removeAttribute('inert');
|
|
1032
948
|
}, NAVBAR_DISABLE_DURATION);
|
|
1033
949
|
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Allows to translate the navbar without a transition
|
|
1036
|
-
*/
|
|
1037
|
-
withoutTransition(callback) {
|
|
1038
|
-
const transition = this.navbar.style.transition;
|
|
1039
|
-
this.navbar.style.transition = 'none';
|
|
1040
|
-
callback();
|
|
1041
|
-
setTimeout(() => {
|
|
1042
|
-
this.navbar.style.transition = transition;
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
950
|
render() {
|
|
1046
|
-
return (h(Host, { key: '
|
|
951
|
+
return (h(Host, { key: '6cd850555585d87eb25e3f6892b8010f5e4d23d6', slot: "post-mainnavigation", version: version }, h("div", { key: '3411008120d072920f4de0b71c9dc014748f1390', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '2e3747380cb546bd6da77e5ffba2403586205a55', name: "back-button" })), h("div", { key: 'e9eedd836b3f679ba2861109db2d0811c1142677', "aria-hidden": "true", class: { 'scroll-control scroll-left': true, 'd-none': !this.canScrollLeft }, onMouseDown: e => this.handleScrollButtonClick(e, 'left') }, h("post-icon", { key: '628511a2c1812a08828e1aa2b51f26ad01a5a2cf', "aria-hidden": "true", name: "chevronleft" })), h("nav", { key: '1b660d65e1984e8701a98a369046f391fd177338', ref: el => (this.navbar = el) }, h("slot", { key: '0eb35366ac0bd58509afd6a12f68c2b09396a497' })), h("div", { key: '11145ad6602e2df78d3c3f4643cc6e4e960775aa', "aria-hidden": "true", class: { 'scroll-control scroll-right': true, 'd-none': !this.canScrollRight }, onMouseDown: e => this.handleScrollButtonClick(e, 'right') }, h("post-icon", { key: '26e795cd00221dbfb1a7632453d0d48993584b0b', "aria-hidden": "true", name: "chevronright" }))));
|
|
1047
952
|
}
|
|
1048
|
-
static get watchers() { return {
|
|
1049
|
-
"translationAmount": ["onTranslateAmountChanges"]
|
|
1050
|
-
}; }
|
|
1051
953
|
};
|
|
1052
954
|
PostMainnavigation.style = PostMainnavigationStyle0;
|
|
1053
955
|
|
|
1054
|
-
const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;width:100%;inset-block-start:100%;inset-inline-start:0;border-radius:0}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;position:fixed;inset-block-start:var(--header-navigation-current-inset);inset-inline:0;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--header-height));border-block-start:unset;overflow-y:auto;overscroll-behavior:contain}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}@media screen and (min-width: 1024px){.megadropdown-container{max-height:calc(100vh - var(--header-height) - 48px);overflow-y:auto}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-block:0 8px;font-weight:900}.megadropdown h2 a{text-decoration:none;display:none;font-weight:inherit;border-block:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:\"\";background-color:#050400;inset-block-end:0;inset-inline-start:0;width:100%;height:2px;position:absolute}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px;white-space:normal;word-break:break-word}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-block-end:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;inset-block-start:1rem;inset-inline-end:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}";
|
|
956
|
+
const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;width:100%;inset-block-start:100%;inset-inline-start:0;border-radius:0}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;position:fixed;inset-block-start:var(--header-navigation-current-inset);inset-inline:0;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));border-block-start:unset;overflow-y:auto;overscroll-behavior:contain}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}@media screen and (min-width: 1024px){.megadropdown-container{max-height:calc(100vh - var(--post-header-height) - 48px);overflow-y:auto}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-block:0 8px;font-weight:900}.megadropdown h2 a{text-decoration:none;display:none;font-weight:inherit;border-block:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:\"\";background-color:#050400;inset-block-end:0;inset-inline-start:0;width:100%;height:2px;position:absolute}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px;white-space:normal;word-break:break-word}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-block-end:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;inset-block-start:1rem;inset-inline-end:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}";
|
|
1055
957
|
const PostMegadropdownStyle0 = postMegadropdownCss;
|
|
1056
958
|
|
|
1057
959
|
const PostMegadropdown = class {
|
|
1058
960
|
constructor(hostRef) {
|
|
1059
961
|
registerInstance(this, hostRef);
|
|
1060
962
|
this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown", 7);
|
|
963
|
+
this.handleClickOutside = (event) => {
|
|
964
|
+
if (this.device !== 'desktop')
|
|
965
|
+
return;
|
|
966
|
+
const target = event.target;
|
|
967
|
+
if (this.host.contains(target)) {
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (target instanceof HTMLElement) {
|
|
971
|
+
const trigger = target.closest('post-megadropdown-trigger');
|
|
972
|
+
if (trigger) {
|
|
973
|
+
const targetDropdownId = trigger.getAttribute('for');
|
|
974
|
+
if (targetDropdownId !== this.host.id) {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
this.hide(false);
|
|
980
|
+
};
|
|
1061
981
|
this.device = breakpoint.get('name');
|
|
1062
982
|
this.isVisible = false;
|
|
1063
983
|
this.animationClass = null;
|
|
1064
984
|
}
|
|
1065
|
-
firstFocusableEl;
|
|
1066
|
-
lastFocusableEl;
|
|
1067
|
-
get host() { return getElement(this); }
|
|
1068
|
-
/** Tracks the currently active dropdown instance. */
|
|
1069
|
-
static activeDropdown = null;
|
|
1070
985
|
breakpointChange(e) {
|
|
1071
986
|
this.device = e.detail;
|
|
1072
987
|
if (this.device === 'desktop' && this.isVisible) {
|
|
1073
988
|
this.animationClass = null;
|
|
1074
989
|
}
|
|
1075
990
|
}
|
|
1076
|
-
/**
|
|
1077
|
-
* Emits when the dropdown is shown or hidden.
|
|
1078
|
-
* The event payload is an object.
|
|
1079
|
-
* `isVisible` is true when the dropdown gets opened and false when it gets closed
|
|
1080
|
-
* `focusParent` determines whether after the closing of the mega dropdown, the focus should go back to the trigger parent or naturally go to the next focusable element in the page
|
|
1081
|
-
**/
|
|
1082
|
-
postToggleMegadropdown;
|
|
1083
991
|
disconnectedCallback() {
|
|
1084
992
|
this.removeListeners();
|
|
1085
993
|
window.removeEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
|
|
@@ -1159,24 +1067,6 @@ const PostMegadropdown = class {
|
|
|
1159
1067
|
this.removeListeners();
|
|
1160
1068
|
}
|
|
1161
1069
|
}
|
|
1162
|
-
handleClickOutside = (event) => {
|
|
1163
|
-
if (this.device !== 'desktop')
|
|
1164
|
-
return;
|
|
1165
|
-
const target = event.target;
|
|
1166
|
-
if (this.host.contains(target)) {
|
|
1167
|
-
return;
|
|
1168
|
-
}
|
|
1169
|
-
if (target instanceof HTMLElement) {
|
|
1170
|
-
const trigger = target.closest('post-megadropdown-trigger');
|
|
1171
|
-
if (trigger) {
|
|
1172
|
-
const targetDropdownId = trigger.getAttribute('for');
|
|
1173
|
-
if (targetDropdownId !== this.host.id) {
|
|
1174
|
-
return;
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
this.hide(false);
|
|
1179
|
-
};
|
|
1180
1070
|
addListeners() {
|
|
1181
1071
|
this.host.addEventListener('keydown', e => this.keyboardHandler(e));
|
|
1182
1072
|
document.addEventListener('keyup', e => this.handleTabOutside(e));
|
|
@@ -1219,7 +1109,10 @@ const PostMegadropdown = class {
|
|
|
1219
1109
|
const containerStyle = this.isVisible ? {} : { display: 'none' };
|
|
1220
1110
|
return (h(Host, { key: '7426a12ebaeac0ce3b8402c3da4d5393daca059b', version: version }, h("div", { key: 'd47b60c334577f5662f19912f12ce941b4b52d94', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: '2798f217b2b3e43c3c63072884bbbbe7d99ed62f', class: "megadropdown" }, h("slot", { key: 'b61f82bbc7f87f65d9b6957e7a4e5d6790b6dd00', name: "megadropdown-title" }), h("div", { key: 'f4996a819511cb59185faeedbdcec4be6e6f8a24', class: "megadropdown-content" }, h("slot", { key: '54f695c3b3d30a6a1aae7f7dc6f65f4d4d27de68' })), h("div", { key: 'b1334295c7d758e20c85b6c6c8cefc31dcf09e20', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: 'c4db69fa3207ce4cb47b725e37b1993820a2a64c', name: "back-button" })), h("div", { key: '68b22a3222382586fc749dec63e36edae84360c1', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: '8023b75c931a95dbd9552c1a713790e77e40f526', name: "close-button" }))))));
|
|
1221
1111
|
}
|
|
1112
|
+
get host() { return getElement(this); }
|
|
1222
1113
|
};
|
|
1114
|
+
/** Tracks the currently active dropdown instance. */
|
|
1115
|
+
PostMegadropdown.activeDropdown = null;
|
|
1223
1116
|
PostMegadropdown.style = PostMegadropdownStyle0;
|
|
1224
1117
|
|
|
1225
1118
|
const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%;position:relative;z-index:3}";
|
|
@@ -1228,20 +1121,45 @@ const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
|
|
|
1228
1121
|
const PostMegadropdownTrigger = class {
|
|
1229
1122
|
constructor(hostRef) {
|
|
1230
1123
|
registerInstance(this, hostRef);
|
|
1124
|
+
/**
|
|
1125
|
+
* Reference to the slotted button within the trigger, if present.
|
|
1126
|
+
* Used to manage click and key events for mega dropdown control.
|
|
1127
|
+
*/
|
|
1128
|
+
this.slottedButton = null;
|
|
1129
|
+
/**
|
|
1130
|
+
* Tracks whether this trigger's dropdown was expanded before a state change.
|
|
1131
|
+
* Used to determine if this trigger should handle focus when its dropdown closes.
|
|
1132
|
+
*/
|
|
1133
|
+
this.wasExpanded = false;
|
|
1134
|
+
this.handleKeyDown = (event) => {
|
|
1135
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1136
|
+
event.preventDefault();
|
|
1137
|
+
this.handleToggle();
|
|
1138
|
+
if (this.megadropdown && !this.ariaExpanded) {
|
|
1139
|
+
setTimeout(() => this.megadropdown.focusFirst(), 100);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
this.handleToggleMegadropdown = (event) => {
|
|
1144
|
+
eventGuard(this.host, event, { targetLocalName: 'post-megadropdown' }, () => {
|
|
1145
|
+
if (event.target.id === this.for) {
|
|
1146
|
+
this.ariaExpanded = event.detail.isVisible;
|
|
1147
|
+
// Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
|
|
1148
|
+
if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
|
|
1149
|
+
setTimeout(() => {
|
|
1150
|
+
this.slottedButton?.focus();
|
|
1151
|
+
}, 100);
|
|
1152
|
+
}
|
|
1153
|
+
this.wasExpanded = this.ariaExpanded;
|
|
1154
|
+
if (this.slottedButton) {
|
|
1155
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
};
|
|
1231
1160
|
this.for = undefined;
|
|
1232
1161
|
this.ariaExpanded = false;
|
|
1233
1162
|
}
|
|
1234
|
-
get host() { return getElement(this); }
|
|
1235
|
-
/**
|
|
1236
|
-
* Reference to the slotted button within the trigger, if present.
|
|
1237
|
-
* Used to manage click and key events for mega dropdown control.
|
|
1238
|
-
*/
|
|
1239
|
-
slottedButton = null;
|
|
1240
|
-
/**
|
|
1241
|
-
* Tracks whether this trigger's dropdown was expanded before a state change.
|
|
1242
|
-
* Used to determine if this trigger should handle focus when its dropdown closes.
|
|
1243
|
-
*/
|
|
1244
|
-
wasExpanded = false;
|
|
1245
1163
|
/**
|
|
1246
1164
|
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
1247
1165
|
* @param forValue - The new value of the `for` property.
|
|
@@ -1263,33 +1181,10 @@ const PostMegadropdownTrigger = class {
|
|
|
1263
1181
|
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
1264
1182
|
}
|
|
1265
1183
|
}
|
|
1266
|
-
handleKeyDown = (event) => {
|
|
1267
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
1268
|
-
event.preventDefault();
|
|
1269
|
-
this.handleToggle();
|
|
1270
|
-
if (this.megadropdown && !this.ariaExpanded) {
|
|
1271
|
-
setTimeout(() => this.megadropdown.focusFirst(), 100);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
};
|
|
1275
1184
|
componentDidLoad() {
|
|
1276
1185
|
this.validateControlFor();
|
|
1277
1186
|
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
1278
|
-
document.addEventListener('postToggleMegadropdown',
|
|
1279
|
-
if (event.target.id === this.for) {
|
|
1280
|
-
this.ariaExpanded = event.detail.isVisible;
|
|
1281
|
-
// Focus on the trigger parent of the dropdown after it's closed if close button had been clicked
|
|
1282
|
-
if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
|
|
1283
|
-
setTimeout(() => {
|
|
1284
|
-
this.slottedButton?.focus();
|
|
1285
|
-
}, 100);
|
|
1286
|
-
}
|
|
1287
|
-
this.wasExpanded = this.ariaExpanded;
|
|
1288
|
-
if (this.slottedButton) {
|
|
1289
|
-
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
});
|
|
1187
|
+
document.addEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
|
|
1293
1188
|
this.slottedButton = this.host.querySelector('button');
|
|
1294
1189
|
if (this.slottedButton) {
|
|
1295
1190
|
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
@@ -1302,9 +1197,13 @@ const PostMegadropdownTrigger = class {
|
|
|
1302
1197
|
console.warn('No button found within post-megadropdown-trigger');
|
|
1303
1198
|
}
|
|
1304
1199
|
}
|
|
1200
|
+
disconnectedCallback() {
|
|
1201
|
+
document.removeEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
|
|
1202
|
+
}
|
|
1305
1203
|
render() {
|
|
1306
|
-
return (h(Host, { key: '
|
|
1204
|
+
return (h(Host, { key: '86b85efede8d9b19f3f0560f500f33f5e172177f', "data-version": version, "tab-index": "-1" }, h("button", { key: '0f810e4c38bc4abf23ac60ab27b36d408e7ced0d' }, h("slot", { key: '2a522ac7e15ef8ac077b73cdebf629b89ea173c6' }))));
|
|
1307
1205
|
}
|
|
1206
|
+
get host() { return getElement(this); }
|
|
1308
1207
|
static get watchers() { return {
|
|
1309
1208
|
"for": ["validateControlFor"]
|
|
1310
1209
|
}; }
|
|
@@ -1318,28 +1217,54 @@ const PostMenu = class {
|
|
|
1318
1217
|
constructor(hostRef) {
|
|
1319
1218
|
registerInstance(this, hostRef);
|
|
1320
1219
|
this.toggleMenu = createEvent(this, "toggleMenu", 7);
|
|
1220
|
+
this.lastFocusedElement = null;
|
|
1221
|
+
this.KEYCODES = {
|
|
1222
|
+
SPACE: ' ',
|
|
1223
|
+
ENTER: 'Enter',
|
|
1224
|
+
UP: 'ArrowUp',
|
|
1225
|
+
DOWN: 'ArrowDown',
|
|
1226
|
+
TAB: 'Tab',
|
|
1227
|
+
HOME: 'Home',
|
|
1228
|
+
END: 'End',
|
|
1229
|
+
ESCAPE: 'Escape',
|
|
1230
|
+
};
|
|
1231
|
+
this.handleKeyDown = (e) => {
|
|
1232
|
+
e.stopPropagation();
|
|
1233
|
+
if (e.key === this.KEYCODES.ESCAPE) {
|
|
1234
|
+
this.toggle(this.host);
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
1238
|
+
this.controlKeyDownHandler(e);
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
this.handlePostToggle = (event) => {
|
|
1242
|
+
eventGuard(this.host, event, { targetLocalName: 'post-popovercontainer', delegatorSelector: 'post-menu' }, () => {
|
|
1243
|
+
this.isVisible = event.detail;
|
|
1244
|
+
this.toggleMenu.emit(this.isVisible);
|
|
1245
|
+
requestAnimationFrame(() => {
|
|
1246
|
+
if (this.isVisible) {
|
|
1247
|
+
this.lastFocusedElement = this.root?.activeElement;
|
|
1248
|
+
const menuItems = this.getSlottedItems();
|
|
1249
|
+
if (menuItems.length > 0) {
|
|
1250
|
+
menuItems[0].focus();
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
else if (this.lastFocusedElement) {
|
|
1254
|
+
this.lastFocusedElement.focus();
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
});
|
|
1258
|
+
};
|
|
1259
|
+
this.handleClick = (e) => {
|
|
1260
|
+
const target = e.target;
|
|
1261
|
+
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
1262
|
+
this.toggle(this.host);
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1321
1265
|
this.placement = 'bottom';
|
|
1322
1266
|
this.isVisible = false;
|
|
1323
1267
|
}
|
|
1324
|
-
popoverRef;
|
|
1325
|
-
lastFocusedElement = null;
|
|
1326
|
-
KEYCODES = {
|
|
1327
|
-
SPACE: ' ',
|
|
1328
|
-
ENTER: 'Enter',
|
|
1329
|
-
UP: 'ArrowUp',
|
|
1330
|
-
DOWN: 'ArrowDown',
|
|
1331
|
-
TAB: 'Tab',
|
|
1332
|
-
HOME: 'Home',
|
|
1333
|
-
END: 'End',
|
|
1334
|
-
ESCAPE: 'Escape',
|
|
1335
|
-
};
|
|
1336
|
-
get host() { return getElement(this); }
|
|
1337
|
-
/**
|
|
1338
|
-
* Emits when the menu is shown or hidden.
|
|
1339
|
-
* The event payload is a boolean: `true` when the menu was opened, `false` when it was closed.
|
|
1340
|
-
**/
|
|
1341
|
-
toggleMenu;
|
|
1342
|
-
root;
|
|
1343
1268
|
connectedCallback() {
|
|
1344
1269
|
this.root = getRoot(this.host);
|
|
1345
1270
|
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
@@ -1348,24 +1273,12 @@ const PostMenu = class {
|
|
|
1348
1273
|
disconnectedCallback() {
|
|
1349
1274
|
this.host.removeEventListener('keydown', this.handleKeyDown);
|
|
1350
1275
|
this.host.removeEventListener('click', this.handleClick);
|
|
1276
|
+
this.popoverRef?.removeEventListener('postToggle', this.handlePostToggle);
|
|
1351
1277
|
}
|
|
1352
1278
|
componentDidLoad() {
|
|
1353
|
-
this.popoverRef
|
|
1354
|
-
this.
|
|
1355
|
-
|
|
1356
|
-
requestAnimationFrame(() => {
|
|
1357
|
-
if (this.isVisible) {
|
|
1358
|
-
this.lastFocusedElement = this.root.activeElement;
|
|
1359
|
-
const menuItems = this.getSlottedItems();
|
|
1360
|
-
if (menuItems.length > 0) {
|
|
1361
|
-
menuItems[0].focus();
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
else if (this.lastFocusedElement) {
|
|
1365
|
-
this.lastFocusedElement.focus();
|
|
1366
|
-
}
|
|
1367
|
-
});
|
|
1368
|
-
});
|
|
1279
|
+
if (this.popoverRef) {
|
|
1280
|
+
this.popoverRef.addEventListener('postToggle', this.handlePostToggle);
|
|
1281
|
+
}
|
|
1369
1282
|
}
|
|
1370
1283
|
/**
|
|
1371
1284
|
* Toggles the menu visibility based on its current state.
|
|
@@ -1402,22 +1315,6 @@ const PostMenu = class {
|
|
|
1402
1315
|
console.error('hide: popoverRef is null or undefined');
|
|
1403
1316
|
}
|
|
1404
1317
|
}
|
|
1405
|
-
handleKeyDown = (e) => {
|
|
1406
|
-
e.stopPropagation();
|
|
1407
|
-
if (e.key === this.KEYCODES.ESCAPE) {
|
|
1408
|
-
this.toggle(this.host);
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
1412
|
-
this.controlKeyDownHandler(e);
|
|
1413
|
-
}
|
|
1414
|
-
};
|
|
1415
|
-
handleClick = (e) => {
|
|
1416
|
-
const target = e.target;
|
|
1417
|
-
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
1418
|
-
this.toggle(this.host);
|
|
1419
|
-
}
|
|
1420
|
-
};
|
|
1421
1318
|
controlKeyDownHandler(e) {
|
|
1422
1319
|
const menuItems = this.getSlottedItems();
|
|
1423
1320
|
if (!menuItems.length) {
|
|
@@ -1464,8 +1361,9 @@ const PostMenu = class {
|
|
|
1464
1361
|
.flatMap(el => Array.from(getFocusableChildren(el))));
|
|
1465
1362
|
}
|
|
1466
1363
|
render() {
|
|
1467
|
-
return (h(Host, { key: '
|
|
1364
|
+
return (h(Host, { key: 'a86276a1fefccbb1f2b50f1ad74dd98ddcbdae5d', "data-version": version, role: "menu" }, h("post-popovercontainer", { key: 'a0b2a35714ba370b7a73d92d1d6c036aa7039aea', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '98da2e21f8e4b4e02b4c347bc4f9238edc635b77', class: "popover-container", part: "popover-container" }, h("slot", { key: 'd3060c46482c5f3179827b8996a9a4b24abf49fa' })))));
|
|
1468
1365
|
}
|
|
1366
|
+
get host() { return getElement(this); }
|
|
1469
1367
|
};
|
|
1470
1368
|
PostMenu.style = PostMenuStyle0;
|
|
1471
1369
|
|
|
@@ -1475,16 +1373,20 @@ const PostMenuTriggerStyle0 = postMenuTriggerCss;
|
|
|
1475
1373
|
const PostMenuTrigger = class {
|
|
1476
1374
|
constructor(hostRef) {
|
|
1477
1375
|
registerInstance(this, hostRef);
|
|
1376
|
+
/**
|
|
1377
|
+
* Reference to the slotted button within the trigger, if present.
|
|
1378
|
+
* Used to manage click and key events for menu control.
|
|
1379
|
+
*/
|
|
1380
|
+
this.slottedButton = null;
|
|
1381
|
+
this.handleKeyDown = (e) => {
|
|
1382
|
+
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
1383
|
+
e.preventDefault();
|
|
1384
|
+
this.handleToggle();
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1478
1387
|
this.for = undefined;
|
|
1479
1388
|
this.ariaExpanded = false;
|
|
1480
1389
|
}
|
|
1481
|
-
get host() { return getElement(this); }
|
|
1482
|
-
/**
|
|
1483
|
-
* Reference to the slotted button within the trigger, if present.
|
|
1484
|
-
* Used to manage click and key events for menu control.
|
|
1485
|
-
*/
|
|
1486
|
-
slottedButton = null;
|
|
1487
|
-
root;
|
|
1488
1390
|
/**
|
|
1489
1391
|
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
1490
1392
|
* @param forValue - The new value of the `for` property.
|
|
@@ -1504,12 +1406,6 @@ const PostMenuTrigger = class {
|
|
|
1504
1406
|
console.warn(`No post-menu found with ID: ${this.for}`);
|
|
1505
1407
|
}
|
|
1506
1408
|
}
|
|
1507
|
-
handleKeyDown = (e) => {
|
|
1508
|
-
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
1509
|
-
e.preventDefault();
|
|
1510
|
-
this.handleToggle();
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
1409
|
connectedCallback() {
|
|
1514
1410
|
this.root = getRoot(this.host);
|
|
1515
1411
|
}
|
|
@@ -1545,8 +1441,9 @@ const PostMenuTrigger = class {
|
|
|
1545
1441
|
}
|
|
1546
1442
|
}
|
|
1547
1443
|
render() {
|
|
1548
|
-
return (h(Host, { key: '
|
|
1444
|
+
return (h(Host, { key: '1b9589febc2976d17eed3363d91b4321473b7b5e', "data-version": version, "tab-index": "-1" }, h("slot", { key: 'bec55f97274084ab4721dc085dc9e1c3a216c0a3' })));
|
|
1549
1445
|
}
|
|
1446
|
+
get host() { return getElement(this); }
|
|
1550
1447
|
static get watchers() { return {
|
|
1551
1448
|
"for": ["validateControlFor"]
|
|
1552
1449
|
}; }
|
|
@@ -3597,7 +3494,385 @@ const computePosition = (reference, floating, options) => {
|
|
|
3597
3494
|
});
|
|
3598
3495
|
};
|
|
3599
3496
|
|
|
3600
|
-
|
|
3497
|
+
// src/events.ts
|
|
3498
|
+
var ToggleEvent = class extends Event {
|
|
3499
|
+
oldState;
|
|
3500
|
+
newState;
|
|
3501
|
+
constructor(type, { oldState = "", newState = "", ...init } = {}) {
|
|
3502
|
+
super(type, init);
|
|
3503
|
+
this.oldState = String(oldState || "");
|
|
3504
|
+
this.newState = String(newState || "");
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
var popoverToggleTaskQueue = /* @__PURE__ */ new WeakMap();
|
|
3508
|
+
function queuePopoverToggleEventTask(element, oldState, newState) {
|
|
3509
|
+
popoverToggleTaskQueue.set(
|
|
3510
|
+
element,
|
|
3511
|
+
setTimeout(() => {
|
|
3512
|
+
if (!popoverToggleTaskQueue.has(element)) return;
|
|
3513
|
+
element.dispatchEvent(
|
|
3514
|
+
new ToggleEvent("toggle", {
|
|
3515
|
+
cancelable: false,
|
|
3516
|
+
oldState,
|
|
3517
|
+
newState
|
|
3518
|
+
})
|
|
3519
|
+
);
|
|
3520
|
+
}, 0)
|
|
3521
|
+
);
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
// src/popover-helpers.ts
|
|
3525
|
+
var ShadowRoot$1 = globalThis.ShadowRoot || function() {
|
|
3526
|
+
};
|
|
3527
|
+
var HTMLDialogElement = globalThis.HTMLDialogElement || function() {
|
|
3528
|
+
};
|
|
3529
|
+
var topLayerElements = /* @__PURE__ */ new WeakMap();
|
|
3530
|
+
var autoPopoverList = /* @__PURE__ */ new WeakMap();
|
|
3531
|
+
var visibilityState = /* @__PURE__ */ new WeakMap();
|
|
3532
|
+
function getPopoverVisibilityState(popover) {
|
|
3533
|
+
return visibilityState.get(popover) || "hidden";
|
|
3534
|
+
}
|
|
3535
|
+
var popoverInvoker = /* @__PURE__ */ new WeakMap();
|
|
3536
|
+
function popoverTargetAttributeActivationBehavior(element) {
|
|
3537
|
+
const popover = element.popoverTargetElement;
|
|
3538
|
+
if (!(popover instanceof HTMLElement)) {
|
|
3539
|
+
return;
|
|
3540
|
+
}
|
|
3541
|
+
const visibility = getPopoverVisibilityState(popover);
|
|
3542
|
+
if (element.popoverTargetAction === "show" && visibility === "showing") {
|
|
3543
|
+
return;
|
|
3544
|
+
}
|
|
3545
|
+
if (element.popoverTargetAction === "hide" && visibility === "hidden") return;
|
|
3546
|
+
if (visibility === "showing") {
|
|
3547
|
+
hidePopover(popover, true, true);
|
|
3548
|
+
} else if (checkPopoverValidity(popover, false)) {
|
|
3549
|
+
popoverInvoker.set(popover, element);
|
|
3550
|
+
showPopover(popover);
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
function checkPopoverValidity(element, expectedToBeShowing) {
|
|
3554
|
+
if (element.popover !== "auto" && element.popover !== "manual") {
|
|
3555
|
+
return false;
|
|
3556
|
+
}
|
|
3557
|
+
if (!element.isConnected) return false;
|
|
3558
|
+
if (expectedToBeShowing && getPopoverVisibilityState(element) !== "showing") {
|
|
3559
|
+
return false;
|
|
3560
|
+
}
|
|
3561
|
+
if (!expectedToBeShowing && getPopoverVisibilityState(element) !== "hidden") {
|
|
3562
|
+
return false;
|
|
3563
|
+
}
|
|
3564
|
+
if (element instanceof HTMLDialogElement && element.hasAttribute("open")) {
|
|
3565
|
+
return false;
|
|
3566
|
+
}
|
|
3567
|
+
if (document.fullscreenElement === element) return false;
|
|
3568
|
+
return true;
|
|
3569
|
+
}
|
|
3570
|
+
function getStackPosition(popover) {
|
|
3571
|
+
if (!popover) return 0;
|
|
3572
|
+
return Array.from(autoPopoverList.get(popover.ownerDocument) || []).indexOf(
|
|
3573
|
+
popover
|
|
3574
|
+
) + 1;
|
|
3575
|
+
}
|
|
3576
|
+
function topMostClickedPopover(target) {
|
|
3577
|
+
const clickedPopover = nearestInclusiveOpenPopover(target);
|
|
3578
|
+
const invokerPopover = nearestInclusiveTargetPopoverForInvoker(target);
|
|
3579
|
+
if (getStackPosition(clickedPopover) > getStackPosition(invokerPopover)) {
|
|
3580
|
+
return clickedPopover;
|
|
3581
|
+
}
|
|
3582
|
+
return invokerPopover;
|
|
3583
|
+
}
|
|
3584
|
+
function topMostAutoPopover(document2) {
|
|
3585
|
+
const documentPopovers = autoPopoverList.get(document2);
|
|
3586
|
+
for (const popover of documentPopovers || []) {
|
|
3587
|
+
if (!popover.isConnected) {
|
|
3588
|
+
documentPopovers.delete(popover);
|
|
3589
|
+
} else {
|
|
3590
|
+
return popover;
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
return null;
|
|
3594
|
+
}
|
|
3595
|
+
function getRootNode(node) {
|
|
3596
|
+
if (typeof node.getRootNode === "function") {
|
|
3597
|
+
return node.getRootNode();
|
|
3598
|
+
}
|
|
3599
|
+
if (node.parentNode) return getRootNode(node.parentNode);
|
|
3600
|
+
return node;
|
|
3601
|
+
}
|
|
3602
|
+
function nearestInclusiveOpenPopover(node) {
|
|
3603
|
+
while (node) {
|
|
3604
|
+
if (node instanceof HTMLElement && node.popover === "auto" && visibilityState.get(node) === "showing") {
|
|
3605
|
+
return node;
|
|
3606
|
+
}
|
|
3607
|
+
node = node instanceof Element && node.assignedSlot || node.parentElement || getRootNode(node);
|
|
3608
|
+
if (node instanceof ShadowRoot$1) node = node.host;
|
|
3609
|
+
if (node instanceof Document) return;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
function nearestInclusiveTargetPopoverForInvoker(node) {
|
|
3613
|
+
while (node) {
|
|
3614
|
+
const nodePopover = node.popoverTargetElement;
|
|
3615
|
+
if (nodePopover instanceof HTMLElement) return nodePopover;
|
|
3616
|
+
node = node.parentElement || getRootNode(node);
|
|
3617
|
+
if (node instanceof ShadowRoot$1) node = node.host;
|
|
3618
|
+
if (node instanceof Document) return;
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
function topMostPopoverAncestor(newPopover) {
|
|
3622
|
+
const popoverPositions = /* @__PURE__ */ new Map();
|
|
3623
|
+
let i = 0;
|
|
3624
|
+
for (const popover of autoPopoverList.get(newPopover.ownerDocument) || []) {
|
|
3625
|
+
popoverPositions.set(popover, i);
|
|
3626
|
+
i += 1;
|
|
3627
|
+
}
|
|
3628
|
+
popoverPositions.set(newPopover, i);
|
|
3629
|
+
i += 1;
|
|
3630
|
+
let topMostPopoverAncestor2 = null;
|
|
3631
|
+
function checkAncestor(candidate) {
|
|
3632
|
+
const candidateAncestor = nearestInclusiveOpenPopover(candidate);
|
|
3633
|
+
if (candidateAncestor === null) return null;
|
|
3634
|
+
const candidatePosition = popoverPositions.get(candidateAncestor);
|
|
3635
|
+
if (topMostPopoverAncestor2 === null || popoverPositions.get(topMostPopoverAncestor2) < candidatePosition) {
|
|
3636
|
+
topMostPopoverAncestor2 = candidateAncestor;
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
checkAncestor(newPopover.parentElement || getRootNode(newPopover));
|
|
3640
|
+
return topMostPopoverAncestor2;
|
|
3641
|
+
}
|
|
3642
|
+
function isFocusable(focusTarget) {
|
|
3643
|
+
if (focusTarget.hidden || focusTarget instanceof ShadowRoot$1) return false;
|
|
3644
|
+
if (focusTarget instanceof HTMLButtonElement || focusTarget instanceof HTMLInputElement || focusTarget instanceof HTMLSelectElement || focusTarget instanceof HTMLTextAreaElement || focusTarget instanceof HTMLOptGroupElement || focusTarget instanceof HTMLOptionElement || focusTarget instanceof HTMLFieldSetElement) {
|
|
3645
|
+
if (focusTarget.disabled) return false;
|
|
3646
|
+
}
|
|
3647
|
+
if (focusTarget instanceof HTMLInputElement && focusTarget.type === "hidden") {
|
|
3648
|
+
return false;
|
|
3649
|
+
}
|
|
3650
|
+
if (focusTarget instanceof HTMLAnchorElement && focusTarget.href === "") {
|
|
3651
|
+
return false;
|
|
3652
|
+
}
|
|
3653
|
+
return typeof focusTarget.tabIndex === "number" && focusTarget.tabIndex !== -1;
|
|
3654
|
+
}
|
|
3655
|
+
function focusDelegate(focusTarget) {
|
|
3656
|
+
if (focusTarget.shadowRoot && focusTarget.shadowRoot.delegatesFocus !== true) {
|
|
3657
|
+
return null;
|
|
3658
|
+
}
|
|
3659
|
+
let whereToLook = focusTarget;
|
|
3660
|
+
if (whereToLook.shadowRoot) {
|
|
3661
|
+
whereToLook = whereToLook.shadowRoot;
|
|
3662
|
+
}
|
|
3663
|
+
let autoFocusDelegate = whereToLook.querySelector("[autofocus]");
|
|
3664
|
+
if (autoFocusDelegate) {
|
|
3665
|
+
return autoFocusDelegate;
|
|
3666
|
+
} else {
|
|
3667
|
+
const slots = whereToLook.querySelectorAll("slot");
|
|
3668
|
+
for (const slot of slots) {
|
|
3669
|
+
const assignedElements = slot.assignedElements({ flatten: true });
|
|
3670
|
+
for (const el of assignedElements) {
|
|
3671
|
+
if (el.hasAttribute("autofocus")) {
|
|
3672
|
+
return el;
|
|
3673
|
+
} else {
|
|
3674
|
+
autoFocusDelegate = el.querySelector("[autofocus]");
|
|
3675
|
+
if (autoFocusDelegate) {
|
|
3676
|
+
return autoFocusDelegate;
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
const walker = focusTarget.ownerDocument.createTreeWalker(
|
|
3683
|
+
whereToLook,
|
|
3684
|
+
NodeFilter.SHOW_ELEMENT
|
|
3685
|
+
);
|
|
3686
|
+
let descendant = walker.currentNode;
|
|
3687
|
+
while (descendant) {
|
|
3688
|
+
if (isFocusable(descendant)) {
|
|
3689
|
+
return descendant;
|
|
3690
|
+
}
|
|
3691
|
+
descendant = walker.nextNode();
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
function popoverFocusingSteps(subject) {
|
|
3695
|
+
focusDelegate(subject)?.focus();
|
|
3696
|
+
}
|
|
3697
|
+
var previouslyFocusedElements = /* @__PURE__ */ new WeakMap();
|
|
3698
|
+
function showPopover(element) {
|
|
3699
|
+
if (!checkPopoverValidity(element, false)) {
|
|
3700
|
+
return;
|
|
3701
|
+
}
|
|
3702
|
+
const document2 = element.ownerDocument;
|
|
3703
|
+
if (!element.dispatchEvent(
|
|
3704
|
+
new ToggleEvent("beforetoggle", {
|
|
3705
|
+
cancelable: true,
|
|
3706
|
+
oldState: "closed",
|
|
3707
|
+
newState: "open"
|
|
3708
|
+
})
|
|
3709
|
+
)) {
|
|
3710
|
+
return;
|
|
3711
|
+
}
|
|
3712
|
+
if (!checkPopoverValidity(element, false)) {
|
|
3713
|
+
return;
|
|
3714
|
+
}
|
|
3715
|
+
let shouldRestoreFocus = false;
|
|
3716
|
+
if (element.popover === "auto") {
|
|
3717
|
+
const originalType = element.getAttribute("popover");
|
|
3718
|
+
const ancestor = topMostPopoverAncestor(element) || document2;
|
|
3719
|
+
hideAllPopoversUntil(ancestor, false, true);
|
|
3720
|
+
if (originalType !== element.getAttribute("popover") || !checkPopoverValidity(element, false)) {
|
|
3721
|
+
return;
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3724
|
+
if (!topMostAutoPopover(document2)) {
|
|
3725
|
+
shouldRestoreFocus = true;
|
|
3726
|
+
}
|
|
3727
|
+
previouslyFocusedElements.delete(element);
|
|
3728
|
+
const originallyFocusedElement = document2.activeElement;
|
|
3729
|
+
element.classList.add(":popover-open");
|
|
3730
|
+
visibilityState.set(element, "showing");
|
|
3731
|
+
if (!topLayerElements.has(document2)) {
|
|
3732
|
+
topLayerElements.set(document2, /* @__PURE__ */ new Set());
|
|
3733
|
+
}
|
|
3734
|
+
topLayerElements.get(document2).add(element);
|
|
3735
|
+
popoverFocusingSteps(element);
|
|
3736
|
+
if (element.popover === "auto") {
|
|
3737
|
+
if (!autoPopoverList.has(document2)) {
|
|
3738
|
+
autoPopoverList.set(document2, /* @__PURE__ */ new Set());
|
|
3739
|
+
}
|
|
3740
|
+
autoPopoverList.get(document2).add(element);
|
|
3741
|
+
setInvokerAriaExpanded(popoverInvoker.get(element), true);
|
|
3742
|
+
}
|
|
3743
|
+
if (shouldRestoreFocus && originallyFocusedElement && element.popover === "auto") {
|
|
3744
|
+
previouslyFocusedElements.set(element, originallyFocusedElement);
|
|
3745
|
+
}
|
|
3746
|
+
queuePopoverToggleEventTask(element, "closed", "open");
|
|
3747
|
+
}
|
|
3748
|
+
function hidePopover(element, focusPreviousElement = false, fireEvents = false) {
|
|
3749
|
+
if (!checkPopoverValidity(element, true)) {
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
const document2 = element.ownerDocument;
|
|
3753
|
+
if (element.popover === "auto") {
|
|
3754
|
+
hideAllPopoversUntil(element, focusPreviousElement, fireEvents);
|
|
3755
|
+
if (!checkPopoverValidity(element, true)) {
|
|
3756
|
+
return;
|
|
3757
|
+
}
|
|
3758
|
+
}
|
|
3759
|
+
setInvokerAriaExpanded(popoverInvoker.get(element), false);
|
|
3760
|
+
popoverInvoker.delete(element);
|
|
3761
|
+
if (fireEvents) {
|
|
3762
|
+
element.dispatchEvent(
|
|
3763
|
+
new ToggleEvent("beforetoggle", {
|
|
3764
|
+
oldState: "open",
|
|
3765
|
+
newState: "closed"
|
|
3766
|
+
})
|
|
3767
|
+
);
|
|
3768
|
+
if (!checkPopoverValidity(element, true)) {
|
|
3769
|
+
return;
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
topLayerElements.get(document2)?.delete(element);
|
|
3773
|
+
autoPopoverList.get(document2)?.delete(element);
|
|
3774
|
+
element.classList.remove(":popover-open");
|
|
3775
|
+
visibilityState.set(element, "hidden");
|
|
3776
|
+
if (fireEvents) {
|
|
3777
|
+
queuePopoverToggleEventTask(element, "open", "closed");
|
|
3778
|
+
}
|
|
3779
|
+
const previouslyFocusedElement = previouslyFocusedElements.get(element);
|
|
3780
|
+
if (previouslyFocusedElement) {
|
|
3781
|
+
previouslyFocusedElements.delete(element);
|
|
3782
|
+
if (focusPreviousElement) {
|
|
3783
|
+
previouslyFocusedElement.focus();
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
function closeAllOpenPopovers(document2, focusPreviousElement = false, fireEvents = false) {
|
|
3788
|
+
let popover = topMostAutoPopover(document2);
|
|
3789
|
+
while (popover) {
|
|
3790
|
+
hidePopover(popover, focusPreviousElement, fireEvents);
|
|
3791
|
+
popover = topMostAutoPopover(document2);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
function hideAllPopoversUntil(endpoint, focusPreviousElement, fireEvents) {
|
|
3795
|
+
const document2 = endpoint.ownerDocument || endpoint;
|
|
3796
|
+
if (endpoint instanceof Document) {
|
|
3797
|
+
return closeAllOpenPopovers(document2, focusPreviousElement, fireEvents);
|
|
3798
|
+
}
|
|
3799
|
+
let lastToHide = null;
|
|
3800
|
+
let foundEndpoint = false;
|
|
3801
|
+
for (const popover of autoPopoverList.get(document2) || []) {
|
|
3802
|
+
if (popover === endpoint) {
|
|
3803
|
+
foundEndpoint = true;
|
|
3804
|
+
} else if (foundEndpoint) {
|
|
3805
|
+
lastToHide = popover;
|
|
3806
|
+
break;
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
if (!foundEndpoint) {
|
|
3810
|
+
return closeAllOpenPopovers(document2, focusPreviousElement, fireEvents);
|
|
3811
|
+
}
|
|
3812
|
+
while (lastToHide && getPopoverVisibilityState(lastToHide) === "showing" && autoPopoverList.get(document2)?.size) {
|
|
3813
|
+
hidePopover(lastToHide, focusPreviousElement, fireEvents);
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
var popoverPointerDownTargets = /* @__PURE__ */ new WeakMap();
|
|
3817
|
+
function lightDismissOpenPopovers(event) {
|
|
3818
|
+
if (!event.isTrusted) return;
|
|
3819
|
+
const target = event.composedPath()[0];
|
|
3820
|
+
if (!target) return;
|
|
3821
|
+
const document2 = target.ownerDocument;
|
|
3822
|
+
const topMostPopover = topMostAutoPopover(document2);
|
|
3823
|
+
if (!topMostPopover) return;
|
|
3824
|
+
const ancestor = topMostClickedPopover(target);
|
|
3825
|
+
if (ancestor && event.type === "pointerdown") {
|
|
3826
|
+
popoverPointerDownTargets.set(document2, ancestor);
|
|
3827
|
+
} else if (event.type === "pointerup") {
|
|
3828
|
+
const sameTarget = popoverPointerDownTargets.get(document2) === ancestor;
|
|
3829
|
+
popoverPointerDownTargets.delete(document2);
|
|
3830
|
+
if (sameTarget) {
|
|
3831
|
+
hideAllPopoversUntil(ancestor || document2, false, true);
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
var initialAriaExpandedValue = /* @__PURE__ */ new WeakMap();
|
|
3836
|
+
function setInvokerAriaExpanded(el, force = false) {
|
|
3837
|
+
if (!el) return;
|
|
3838
|
+
if (!initialAriaExpandedValue.has(el)) {
|
|
3839
|
+
initialAriaExpandedValue.set(el, el.getAttribute("aria-expanded"));
|
|
3840
|
+
}
|
|
3841
|
+
const popover = el.popoverTargetElement;
|
|
3842
|
+
if (popover instanceof HTMLElement && popover.popover === "auto") {
|
|
3843
|
+
el.setAttribute("aria-expanded", String(force));
|
|
3844
|
+
} else {
|
|
3845
|
+
const initialValue = initialAriaExpandedValue.get(el);
|
|
3846
|
+
if (!initialValue) {
|
|
3847
|
+
el.removeAttribute("aria-expanded");
|
|
3848
|
+
} else {
|
|
3849
|
+
el.setAttribute("aria-expanded", initialValue);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3854
|
+
// src/popover.ts
|
|
3855
|
+
var ShadowRoot2 = globalThis.ShadowRoot || function() {
|
|
3856
|
+
};
|
|
3857
|
+
function isSupported() {
|
|
3858
|
+
return typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype === "object" && "popover" in HTMLElement.prototype;
|
|
3859
|
+
}
|
|
3860
|
+
function patchSelectorFn(object, name, mapper) {
|
|
3861
|
+
const original = object[name];
|
|
3862
|
+
Object.defineProperty(object, name, {
|
|
3863
|
+
value(selector) {
|
|
3864
|
+
return original.call(this, mapper(selector));
|
|
3865
|
+
}
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
var nonEscapedPopoverSelector = /(^|[^\\]):popover-open\b/g;
|
|
3869
|
+
function hasLayerSupport() {
|
|
3870
|
+
return typeof globalThis.CSSLayerBlockRule === "function";
|
|
3871
|
+
}
|
|
3872
|
+
function getStyles() {
|
|
3873
|
+
const useLayer = hasLayerSupport();
|
|
3874
|
+
return `
|
|
3875
|
+
${useLayer ? "@layer popover-polyfill {" : ""}
|
|
3601
3876
|
:where([popover]) {
|
|
3602
3877
|
position: fixed;
|
|
3603
3878
|
z-index: 2147483647;
|
|
@@ -3615,6 +3890,14 @@ const computePosition = (reference, floating, options) => {
|
|
|
3615
3890
|
margin: auto;
|
|
3616
3891
|
}
|
|
3617
3892
|
|
|
3893
|
+
:where([popover]:not(.\\:popover-open)) {
|
|
3894
|
+
display: none;
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
:where(dialog[popover].\\:popover-open) {
|
|
3898
|
+
display: block;
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3618
3901
|
:where(dialog[popover][open]) {
|
|
3619
3902
|
display: revert;
|
|
3620
3903
|
}
|
|
@@ -3649,11 +3932,229 @@ const computePosition = (reference, floating, options) => {
|
|
|
3649
3932
|
bottom: 0;
|
|
3650
3933
|
}
|
|
3651
3934
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3935
|
+
${useLayer ? "}" : ""}
|
|
3936
|
+
`;
|
|
3937
|
+
}
|
|
3938
|
+
var popoverStyleSheet = null;
|
|
3939
|
+
function injectStyles(root) {
|
|
3940
|
+
const styles = getStyles();
|
|
3941
|
+
if (popoverStyleSheet === null) {
|
|
3942
|
+
try {
|
|
3943
|
+
popoverStyleSheet = new CSSStyleSheet();
|
|
3944
|
+
popoverStyleSheet.replaceSync(styles);
|
|
3945
|
+
} catch {
|
|
3946
|
+
popoverStyleSheet = false;
|
|
3947
|
+
}
|
|
3655
3948
|
}
|
|
3656
|
-
|
|
3949
|
+
if (popoverStyleSheet === false) {
|
|
3950
|
+
const sheet = document.createElement("style");
|
|
3951
|
+
sheet.textContent = styles;
|
|
3952
|
+
if (root instanceof Document) {
|
|
3953
|
+
root.head.prepend(sheet);
|
|
3954
|
+
} else {
|
|
3955
|
+
root.prepend(sheet);
|
|
3956
|
+
}
|
|
3957
|
+
} else {
|
|
3958
|
+
root.adoptedStyleSheets = [popoverStyleSheet, ...root.adoptedStyleSheets];
|
|
3959
|
+
}
|
|
3960
|
+
}
|
|
3961
|
+
function apply() {
|
|
3962
|
+
if (typeof window === "undefined") return;
|
|
3963
|
+
window.ToggleEvent = window.ToggleEvent || ToggleEvent;
|
|
3964
|
+
function rewriteSelector(selector) {
|
|
3965
|
+
if (selector?.includes(":popover-open")) {
|
|
3966
|
+
selector = selector.replace(
|
|
3967
|
+
nonEscapedPopoverSelector,
|
|
3968
|
+
"$1.\\:popover-open"
|
|
3969
|
+
);
|
|
3970
|
+
}
|
|
3971
|
+
return selector;
|
|
3972
|
+
}
|
|
3973
|
+
patchSelectorFn(Document.prototype, "querySelector", rewriteSelector);
|
|
3974
|
+
patchSelectorFn(Document.prototype, "querySelectorAll", rewriteSelector);
|
|
3975
|
+
patchSelectorFn(Element.prototype, "querySelector", rewriteSelector);
|
|
3976
|
+
patchSelectorFn(Element.prototype, "querySelectorAll", rewriteSelector);
|
|
3977
|
+
patchSelectorFn(Element.prototype, "matches", rewriteSelector);
|
|
3978
|
+
patchSelectorFn(Element.prototype, "closest", rewriteSelector);
|
|
3979
|
+
patchSelectorFn(
|
|
3980
|
+
DocumentFragment.prototype,
|
|
3981
|
+
"querySelectorAll",
|
|
3982
|
+
rewriteSelector
|
|
3983
|
+
);
|
|
3984
|
+
Object.defineProperties(HTMLElement.prototype, {
|
|
3985
|
+
popover: {
|
|
3986
|
+
enumerable: true,
|
|
3987
|
+
configurable: true,
|
|
3988
|
+
get() {
|
|
3989
|
+
if (!this.hasAttribute("popover")) return null;
|
|
3990
|
+
const value = (this.getAttribute("popover") || "").toLowerCase();
|
|
3991
|
+
if (value === "" || value == "auto") return "auto";
|
|
3992
|
+
return "manual";
|
|
3993
|
+
},
|
|
3994
|
+
set(value) {
|
|
3995
|
+
if (value === null) {
|
|
3996
|
+
this.removeAttribute("popover");
|
|
3997
|
+
} else {
|
|
3998
|
+
this.setAttribute("popover", value);
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
},
|
|
4002
|
+
showPopover: {
|
|
4003
|
+
enumerable: true,
|
|
4004
|
+
configurable: true,
|
|
4005
|
+
value() {
|
|
4006
|
+
showPopover(this);
|
|
4007
|
+
}
|
|
4008
|
+
},
|
|
4009
|
+
hidePopover: {
|
|
4010
|
+
enumerable: true,
|
|
4011
|
+
configurable: true,
|
|
4012
|
+
value() {
|
|
4013
|
+
hidePopover(this, true, true);
|
|
4014
|
+
}
|
|
4015
|
+
},
|
|
4016
|
+
togglePopover: {
|
|
4017
|
+
enumerable: true,
|
|
4018
|
+
configurable: true,
|
|
4019
|
+
value(force) {
|
|
4020
|
+
if (visibilityState.get(this) === "showing" && force === void 0 || force === false) {
|
|
4021
|
+
hidePopover(this, true, true);
|
|
4022
|
+
} else if (force === void 0 || force === true) {
|
|
4023
|
+
showPopover(this);
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
});
|
|
4028
|
+
const originalAttachShadow = Element.prototype.attachShadow;
|
|
4029
|
+
if (originalAttachShadow) {
|
|
4030
|
+
Object.defineProperties(Element.prototype, {
|
|
4031
|
+
attachShadow: {
|
|
4032
|
+
enumerable: true,
|
|
4033
|
+
configurable: true,
|
|
4034
|
+
writable: true,
|
|
4035
|
+
value(options) {
|
|
4036
|
+
const shadowRoot = originalAttachShadow.call(this, options);
|
|
4037
|
+
injectStyles(shadowRoot);
|
|
4038
|
+
return shadowRoot;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4043
|
+
const originalAttachInternals = HTMLElement.prototype.attachInternals;
|
|
4044
|
+
if (originalAttachInternals) {
|
|
4045
|
+
Object.defineProperties(HTMLElement.prototype, {
|
|
4046
|
+
attachInternals: {
|
|
4047
|
+
enumerable: true,
|
|
4048
|
+
configurable: true,
|
|
4049
|
+
writable: true,
|
|
4050
|
+
value() {
|
|
4051
|
+
const internals = originalAttachInternals.call(this);
|
|
4052
|
+
if (internals.shadowRoot) {
|
|
4053
|
+
injectStyles(internals.shadowRoot);
|
|
4054
|
+
}
|
|
4055
|
+
return internals;
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
});
|
|
4059
|
+
}
|
|
4060
|
+
const popoverTargetAssociatedElements = /* @__PURE__ */ new WeakMap();
|
|
4061
|
+
function applyPopoverInvokerElementMixin(ElementClass) {
|
|
4062
|
+
Object.defineProperties(ElementClass.prototype, {
|
|
4063
|
+
popoverTargetElement: {
|
|
4064
|
+
enumerable: true,
|
|
4065
|
+
configurable: true,
|
|
4066
|
+
set(targetElement) {
|
|
4067
|
+
if (targetElement === null) {
|
|
4068
|
+
this.removeAttribute("popovertarget");
|
|
4069
|
+
popoverTargetAssociatedElements.delete(this);
|
|
4070
|
+
} else if (!(targetElement instanceof Element)) {
|
|
4071
|
+
throw new TypeError(
|
|
4072
|
+
`popoverTargetElement must be an element or null`
|
|
4073
|
+
);
|
|
4074
|
+
} else {
|
|
4075
|
+
this.setAttribute("popovertarget", "");
|
|
4076
|
+
popoverTargetAssociatedElements.set(this, targetElement);
|
|
4077
|
+
}
|
|
4078
|
+
},
|
|
4079
|
+
get() {
|
|
4080
|
+
if (this.localName !== "button" && this.localName !== "input") {
|
|
4081
|
+
return null;
|
|
4082
|
+
}
|
|
4083
|
+
if (this.localName === "input" && this.type !== "reset" && this.type !== "image" && this.type !== "button") {
|
|
4084
|
+
return null;
|
|
4085
|
+
}
|
|
4086
|
+
if (this.disabled) {
|
|
4087
|
+
return null;
|
|
4088
|
+
}
|
|
4089
|
+
if (this.form && this.type === "submit") {
|
|
4090
|
+
return null;
|
|
4091
|
+
}
|
|
4092
|
+
const targetElement = popoverTargetAssociatedElements.get(this);
|
|
4093
|
+
if (targetElement && targetElement.isConnected) {
|
|
4094
|
+
return targetElement;
|
|
4095
|
+
} else if (targetElement && !targetElement.isConnected) {
|
|
4096
|
+
popoverTargetAssociatedElements.delete(this);
|
|
4097
|
+
return null;
|
|
4098
|
+
}
|
|
4099
|
+
const root = getRootNode(this);
|
|
4100
|
+
const idref = this.getAttribute("popovertarget");
|
|
4101
|
+
if ((root instanceof Document || root instanceof ShadowRoot2) && idref) {
|
|
4102
|
+
return root.getElementById(idref) || null;
|
|
4103
|
+
}
|
|
4104
|
+
return null;
|
|
4105
|
+
}
|
|
4106
|
+
},
|
|
4107
|
+
popoverTargetAction: {
|
|
4108
|
+
enumerable: true,
|
|
4109
|
+
configurable: true,
|
|
4110
|
+
get() {
|
|
4111
|
+
const value = (this.getAttribute("popovertargetaction") || "").toLowerCase();
|
|
4112
|
+
if (value === "show" || value === "hide") return value;
|
|
4113
|
+
return "toggle";
|
|
4114
|
+
},
|
|
4115
|
+
set(value) {
|
|
4116
|
+
this.setAttribute("popovertargetaction", value);
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
4121
|
+
applyPopoverInvokerElementMixin(HTMLButtonElement);
|
|
4122
|
+
applyPopoverInvokerElementMixin(HTMLInputElement);
|
|
4123
|
+
const handleInvokerActivation = (event) => {
|
|
4124
|
+
const composedPath = event.composedPath();
|
|
4125
|
+
const target = composedPath[0];
|
|
4126
|
+
if (!(target instanceof Element) || target?.shadowRoot) {
|
|
4127
|
+
return;
|
|
4128
|
+
}
|
|
4129
|
+
const root = getRootNode(target);
|
|
4130
|
+
if (!(root instanceof ShadowRoot2 || root instanceof Document)) {
|
|
4131
|
+
return;
|
|
4132
|
+
}
|
|
4133
|
+
const invoker = composedPath.find(
|
|
4134
|
+
(el) => el.matches?.("[popovertargetaction],[popovertarget]")
|
|
4135
|
+
);
|
|
4136
|
+
if (invoker) {
|
|
4137
|
+
popoverTargetAttributeActivationBehavior(invoker);
|
|
4138
|
+
event.preventDefault();
|
|
4139
|
+
return;
|
|
4140
|
+
}
|
|
4141
|
+
};
|
|
4142
|
+
const onKeydown = (event) => {
|
|
4143
|
+
const key = event.key;
|
|
4144
|
+
const target = event.target;
|
|
4145
|
+
if (!event.defaultPrevented && target && (key === "Escape" || key === "Esc")) {
|
|
4146
|
+
hideAllPopoversUntil(target.ownerDocument, true, true);
|
|
4147
|
+
}
|
|
4148
|
+
};
|
|
4149
|
+
const addEventListeners = (root) => {
|
|
4150
|
+
root.addEventListener("click", handleInvokerActivation);
|
|
4151
|
+
root.addEventListener("keydown", onKeydown);
|
|
4152
|
+
root.addEventListener("pointerdown", lightDismissOpenPopovers);
|
|
4153
|
+
root.addEventListener("pointerup", lightDismissOpenPopovers);
|
|
4154
|
+
};
|
|
4155
|
+
addEventListeners(document);
|
|
4156
|
+
injectStyles(document);
|
|
4157
|
+
}
|
|
3657
4158
|
|
|
3658
4159
|
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:var(--post-device-elevation-300);width:max-content;max-width:100%;color:var(--post-current-palette-fg);background-color:var(--post-current-palette-bg);border:2px solid rgba(0,0,0,0);border-radius:4px}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--safe-space-cursor-x, 0) var(--safe-space-cursor-y, 0), var(--safe-space-popover-x-start, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-start, 0)), var(--safe-space-popover-x-end, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--safe-space-trigger-x-start, var(--safe-space-trigger-x, 0)) var(--safe-space-trigger-y, var(--safe-space-trigger-y-start, 0)), var(--safe-space-trigger-x-end, var(--safe-space-trigger-x, 0)) var(--safe-space-trigger-y, var(--safe-space-trigger-y-end, 0)), var(--safe-space-popover-x-end, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-end, 0)), var(--safe-space-popover-x-start, var(--safe-space-popover-x, 0)) var(--safe-space-popover-y, var(--safe-space-popover-y-start, 0)))}:where(post-popovercontainer):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}";
|
|
3659
4160
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
@@ -3668,35 +4169,6 @@ const PostPopovercontainer = class {
|
|
|
3668
4169
|
this.arrow = false;
|
|
3669
4170
|
this.safeSpace = undefined;
|
|
3670
4171
|
}
|
|
3671
|
-
static STATIC_SIDES = {
|
|
3672
|
-
top: 'bottom',
|
|
3673
|
-
right: 'left',
|
|
3674
|
-
bottom: 'top',
|
|
3675
|
-
left: 'right',
|
|
3676
|
-
};
|
|
3677
|
-
static PROPERTIES_TO_CLEAR = [
|
|
3678
|
-
'--safe-space-popover-x',
|
|
3679
|
-
'--safe-space-popover-y',
|
|
3680
|
-
'--safe-space-popover-x-start',
|
|
3681
|
-
'--safe-space-popover-x-end',
|
|
3682
|
-
'--safe-space-popover-y-start',
|
|
3683
|
-
'--safe-space-popover-y-end',
|
|
3684
|
-
'--safe-space-trigger-x',
|
|
3685
|
-
'--safe-space-trigger-y',
|
|
3686
|
-
'--safe-space-trigger-x-start',
|
|
3687
|
-
'--safe-space-trigger-x-end',
|
|
3688
|
-
'--safe-space-trigger-y-start',
|
|
3689
|
-
'--safe-space-trigger-y-end',
|
|
3690
|
-
];
|
|
3691
|
-
get host() { return getElement(this); }
|
|
3692
|
-
arrowRef;
|
|
3693
|
-
eventTarget;
|
|
3694
|
-
clearAutoUpdate;
|
|
3695
|
-
toggleTimeoutId;
|
|
3696
|
-
/**
|
|
3697
|
-
* Fires whenever the popover gets shown or hidden, passing the new state in event.details as a boolean
|
|
3698
|
-
*/
|
|
3699
|
-
postToggle;
|
|
3700
4172
|
/**
|
|
3701
4173
|
* Updates cursor position for safe space feature when popover is open.
|
|
3702
4174
|
* Sets CSS custom properties for dynamic styling of safe area.
|
|
@@ -3706,6 +4178,11 @@ const PostPopovercontainer = class {
|
|
|
3706
4178
|
this.host.style.setProperty('--safe-space-cursor-x', `${event.clientX}px`);
|
|
3707
4179
|
this.host.style.setProperty('--safe-space-cursor-y', `${event.clientY}px`);
|
|
3708
4180
|
}
|
|
4181
|
+
connectedCallback() {
|
|
4182
|
+
if (IS_BROWSER && !isSupported()) {
|
|
4183
|
+
apply();
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
3709
4186
|
componentDidLoad() {
|
|
3710
4187
|
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
3711
4188
|
}
|
|
@@ -3900,11 +4377,32 @@ const PostPopovercontainer = class {
|
|
|
3900
4377
|
}
|
|
3901
4378
|
}
|
|
3902
4379
|
render() {
|
|
3903
|
-
return (h(Host, { key: '
|
|
4380
|
+
return (h(Host, { key: 'bbd430fbda9344c351d59f3d59cf84049992709b', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: 'e359cac588d1dd1359c88f8e472828be845fdad7' }, this.arrow && (h("span", { key: '45329ae23722e93410132746e4e39e88e86cd310', class: "arrow", ref: el => {
|
|
3904
4381
|
this.arrowRef = el;
|
|
3905
|
-
} })), h("slot", { key: '
|
|
4382
|
+
} })), h("slot", { key: 'bb9b4b3d8e7c36f024883d02bd34766bf2e9de88' }))));
|
|
3906
4383
|
}
|
|
4384
|
+
get host() { return getElement(this); }
|
|
3907
4385
|
};
|
|
4386
|
+
PostPopovercontainer.STATIC_SIDES = {
|
|
4387
|
+
top: 'bottom',
|
|
4388
|
+
right: 'left',
|
|
4389
|
+
bottom: 'top',
|
|
4390
|
+
left: 'right',
|
|
4391
|
+
};
|
|
4392
|
+
PostPopovercontainer.PROPERTIES_TO_CLEAR = [
|
|
4393
|
+
'--safe-space-popover-x',
|
|
4394
|
+
'--safe-space-popover-y',
|
|
4395
|
+
'--safe-space-popover-x-start',
|
|
4396
|
+
'--safe-space-popover-x-end',
|
|
4397
|
+
'--safe-space-popover-y-start',
|
|
4398
|
+
'--safe-space-popover-y-end',
|
|
4399
|
+
'--safe-space-trigger-x',
|
|
4400
|
+
'--safe-space-trigger-y',
|
|
4401
|
+
'--safe-space-trigger-x-start',
|
|
4402
|
+
'--safe-space-trigger-x-end',
|
|
4403
|
+
'--safe-space-trigger-y-start',
|
|
4404
|
+
'--safe-space-trigger-y-end',
|
|
4405
|
+
];
|
|
3908
4406
|
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
3909
4407
|
|
|
3910
4408
|
const postTogglebuttonCss = ":host{cursor:pointer;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}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}";
|
|
@@ -3913,9 +4411,18 @@ const PostTogglebuttonStyle0 = postTogglebuttonCss;
|
|
|
3913
4411
|
const PostTogglebutton = class {
|
|
3914
4412
|
constructor(hostRef) {
|
|
3915
4413
|
registerInstance(this, hostRef);
|
|
4414
|
+
this.handleClick = () => {
|
|
4415
|
+
this.toggled = !this.toggled;
|
|
4416
|
+
};
|
|
4417
|
+
this.handleKeydown = (event) => {
|
|
4418
|
+
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
4419
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
4420
|
+
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
4421
|
+
this.host.click();
|
|
4422
|
+
}
|
|
4423
|
+
};
|
|
3916
4424
|
this.toggled = false;
|
|
3917
4425
|
}
|
|
3918
|
-
get host() { return getElement(this); }
|
|
3919
4426
|
validateToggled() {
|
|
3920
4427
|
checkType(this, 'toggled', 'boolean');
|
|
3921
4428
|
}
|
|
@@ -3925,19 +4432,10 @@ const PostTogglebutton = class {
|
|
|
3925
4432
|
this.host.addEventListener('click', () => this.handleClick());
|
|
3926
4433
|
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
3927
4434
|
}
|
|
3928
|
-
handleClick = () => {
|
|
3929
|
-
this.toggled = !this.toggled;
|
|
3930
|
-
};
|
|
3931
|
-
handleKeydown = (event) => {
|
|
3932
|
-
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
3933
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
3934
|
-
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
3935
|
-
this.host.click();
|
|
3936
|
-
}
|
|
3937
|
-
};
|
|
3938
4435
|
render() {
|
|
3939
4436
|
return (h(Host, { key: '3a1429a9b67b8cfafae184fe0d060ee3a04974e0', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '9ab1537574423740fc335fde732c699698acac25' })));
|
|
3940
4437
|
}
|
|
4438
|
+
get host() { return getElement(this); }
|
|
3941
4439
|
static get watchers() { return {
|
|
3942
4440
|
"toggled": ["validateToggled"]
|
|
3943
4441
|
}; }
|