@swisspost/design-system-components 9.0.0-next.33 → 9.0.0-next.35
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/get-root-8102fecd.js +17 -0
- package/dist/cjs/{index-d6bf2c66.js → index-b60129c4.js} +4 -4
- package/dist/cjs/index.cjs.js +25 -26
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/long-press-event-6e62d113.js +266 -0
- package/dist/cjs/{package-3562c265.js → package-19b74b08.js} +1 -1
- package/dist/cjs/{post-accordion-6c5681ba.js → post-accordion-785f602b.js} +5 -5
- package/dist/cjs/{post-accordion-item-05a78451.js → post-accordion-item-8e1c9bdb.js} +5 -5
- package/dist/cjs/post-accordion-item.cjs.entry.js +5 -4
- package/dist/cjs/post-accordion.cjs.entry.js +4 -3
- package/dist/cjs/{post-avatar-6710a77a.js → post-avatar-eecfd222.js} +6 -5
- package/dist/cjs/post-avatar.cjs.entry.js +4 -3
- package/dist/cjs/{post-back-to-top-d0662842.js → post-back-to-top-49a3abcb.js} +9 -9
- package/dist/cjs/post-back-to-top.cjs.entry.js +4 -3
- package/dist/cjs/{post-banner-bd97db9c.js → post-banner-249ec2ff.js} +5 -9
- package/dist/cjs/post-banner.cjs.entry.js +4 -3
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +4 -3
- package/dist/cjs/{post-breadcrumb-36ab841c.js → post-breadcrumbs-f51590d1.js} +39 -31
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +13 -0
- package/dist/cjs/post-card-control-d0a47015.js +269 -0
- package/dist/cjs/post-card-control.cjs.entry.js +4 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +5 -5
- package/dist/cjs/{post-collapsible-trigger-6601c554.js → post-collapsible-trigger-4784edb2.js} +24 -41
- package/dist/cjs/post-collapsible_2.cjs.entry.js +5 -5
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/{post-footer-23699aef.js → post-footer-9d078cb1.js} +11 -11
- package/dist/cjs/post-footer.cjs.entry.js +4 -4
- package/dist/cjs/{post-linkarea-8e5e1a9f.js → post-linkarea-e4ce3960.js} +5 -5
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/{post-menu-item-8dd94792.js → post-menu-item-e9ebd27a.js} +4 -4
- package/dist/cjs/post-popover-5db53ead.js +112 -0
- package/dist/cjs/post-popover.cjs.entry.js +5 -4
- package/dist/cjs/{post-rating-ef592484.js → post-rating-98a06828.js} +5 -15
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-d785e7fc.js → post-tab-header-c8e92f77.js} +6 -5
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-41ea371e.js → post-tab-panel-d966ee38.js} +4 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-c6f00130.js → post-tabs-83d99b69.js} +5 -12
- package/dist/cjs/post-tabs.cjs.entry.js +4 -3
- package/dist/cjs/post-tag-a1d78e75.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-togglebutton-02c56b7b.js → post-togglebutton-e4651aad.js} +939 -464
- package/dist/cjs/{post-tooltip-3176e280.js → post-tooltip-bb862241.js} +39 -296
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
- package/dist/collection/animations/collapse.js +3 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/post-accordion/post-accordion.js +1 -3
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +0 -2
- package/dist/collection/components/post-avatar/post-avatar.css +1 -3
- package/dist/collection/components/post-avatar/post-avatar.js +3 -4
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +6 -8
- package/dist/collection/components/post-banner/post-banner.css +1 -3
- package/dist/collection/components/post-banner/post-banner.js +0 -6
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +0 -2
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -0
- package/dist/collection/components/{post-breadcrumb/post-breadcrumb.js → post-breadcrumbs/post-breadcrumbs.js} +24 -27
- package/dist/collection/components/post-card-control/post-card-control.css +1 -3
- 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 +15 -28
- 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 +13 -22
- package/dist/collection/components/post-icon/post-icon.js +4 -6
- package/dist/collection/components/post-language-option/post-language-option.css +1 -3
- package/dist/collection/components/post-language-option/post-language-option.js +1 -10
- package/dist/collection/components/post-language-switch/post-language-switch.js +7 -19
- 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.css +1 -3
- 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.js +20 -30
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +36 -37
- package/dist/collection/components/post-menu/post-menu.css +1 -3
- package/dist/collection/components/post-menu/post-menu.js +47 -55
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +13 -15
- package/dist/collection/components/post-popover/post-popover.css +1 -3
- package/dist/collection/components/post-popover/post-popover.js +13 -13
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +30 -33
- package/dist/collection/components/post-rating/post-rating.css +1 -3
- package/dist/collection/components/post-rating/post-rating.js +1 -12
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -3
- 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.css +1 -3
- package/dist/collection/components/post-tag/post-tag.js +1 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +10 -11
- package/dist/collection/components/post-tooltip/post-tooltip.js +37 -33
- package/dist/collection/index.js +1 -1
- 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/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/get-root.js +7 -1
- package/dist/components/index.js +1 -1
- package/dist/components/long-press-event.js +264 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +3 -3
- package/dist/components/post-accordion2.js +3 -3
- package/dist/components/post-avatar2.js +5 -4
- package/dist/components/post-back-to-top2.js +8 -8
- package/dist/components/post-banner2.js +3 -7
- package/dist/components/post-breadcrumb-item2.js +2 -2
- package/dist/components/{post-breadcrumb.d.ts → post-breadcrumbs.d.ts} +4 -4
- package/dist/components/post-breadcrumbs.js +6 -0
- package/dist/components/{post-breadcrumb2.js → post-breadcrumbs2.js} +41 -33
- package/dist/components/post-card-control2.js +26 -40
- package/dist/components/post-closebutton2.js +8 -3
- package/dist/components/post-collapsible-trigger2.js +19 -31
- package/dist/components/post-collapsible2.js +9 -12
- package/dist/components/post-footer2.js +8 -8
- package/dist/components/post-header2.js +15 -23
- package/dist/components/post-icon2.js +5 -5
- package/dist/components/post-language-option2.js +4 -11
- package/dist/components/post-language-switch2.js +9 -18
- package/dist/components/post-linkarea2.js +5 -4
- package/dist/components/post-list-item2.js +2 -2
- package/dist/components/post-list2.js +3 -4
- package/dist/components/post-logo2.js +3 -2
- package/dist/components/post-mainnavigation2.js +94 -182
- package/dist/components/post-megadropdown-trigger2.js +38 -37
- package/dist/components/post-megadropdown2.js +21 -30
- package/dist/components/post-menu-trigger2.js +15 -15
- package/dist/components/post-menu2.js +50 -56
- package/dist/components/post-popover2.js +15 -13
- package/dist/components/post-popovercontainer2.js +638 -36
- package/dist/components/post-rating2.js +3 -13
- package/dist/components/post-tab-header2.js +5 -4
- package/dist/components/post-tab-panel2.js +3 -3
- package/dist/components/post-tabs2.js +3 -10
- package/dist/components/post-tag2.js +2 -2
- package/dist/components/post-togglebutton2.js +12 -11
- package/dist/components/post-tooltip2.js +37 -294
- package/dist/docs.json +107 -101
- 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/get-root-1b1af46f.js +15 -0
- package/dist/esm/{index-3419e46d.js → index-f4d19816.js} +4 -4
- package/dist/esm/index.js +24 -25
- package/dist/esm/loader.js +3 -3
- package/dist/esm/long-press-event-04d24397.js +264 -0
- package/dist/esm/package-791f9257.js +3 -0
- package/dist/esm/{post-accordion-024451fa.js → post-accordion-4de9963b.js} +5 -5
- package/dist/esm/{post-accordion-item-19b996d1.js → post-accordion-item-2cbb32f9.js} +5 -5
- package/dist/esm/post-accordion-item.entry.js +5 -4
- package/dist/esm/post-accordion.entry.js +4 -3
- package/dist/esm/{post-avatar-33aed045.js → post-avatar-0aaefe87.js} +6 -5
- package/dist/esm/post-avatar.entry.js +4 -3
- package/dist/esm/{post-back-to-top-7dd43c3b.js → post-back-to-top-24eef0a0.js} +9 -9
- package/dist/esm/post-back-to-top.entry.js +4 -3
- package/dist/esm/{post-banner-28d18721.js → post-banner-1f37f9f0.js} +5 -9
- package/dist/esm/post-banner.entry.js +4 -3
- package/dist/esm/post-breadcrumb-item_2.entry.js +4 -3
- package/dist/esm/{post-breadcrumb-d86fae7b.js → post-breadcrumbs-2fcccf9f.js} +39 -31
- package/dist/esm/post-breadcrumbs.entry.js +5 -0
- package/dist/esm/post-card-control-75e8d336.js +267 -0
- package/dist/esm/post-card-control.entry.js +4 -3
- package/dist/esm/post-closebutton_15.entry.js +5 -5
- package/dist/esm/{post-collapsible-trigger-b1612866.js → post-collapsible-trigger-08b79162.js} +24 -41
- package/dist/esm/post-collapsible_2.entry.js +5 -5
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/{post-footer-2ed5e520.js → post-footer-01677010.js} +11 -11
- package/dist/esm/post-footer.entry.js +4 -4
- package/dist/esm/{post-linkarea-802bf774.js → post-linkarea-4a178d51.js} +5 -5
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/{post-menu-item-d97611d8.js → post-menu-item-199477fd.js} +4 -4
- package/dist/esm/post-popover-2a6a13d8.js +110 -0
- package/dist/esm/post-popover.entry.js +5 -4
- package/dist/esm/{post-rating-e1ac47ce.js → post-rating-fcf24658.js} +5 -15
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-06dcbf7f.js → post-tab-header-aaa2f0b8.js} +6 -5
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-75932601.js → post-tab-panel-91f35995.js} +4 -4
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-3ef2ea23.js → post-tabs-8657f2d6.js} +5 -12
- package/dist/esm/post-tabs.entry.js +4 -3
- package/dist/esm/post-tag-19141551.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-togglebutton-db251030.js → post-togglebutton-40cac8c2.js} +939 -464
- package/dist/esm/{post-tooltip-c256d714.js → post-tooltip-165eb353.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-01544069.js +1 -0
- package/dist/post-components/p-02d0c370.js +1 -0
- package/dist/post-components/p-03169497.js +1 -0
- package/dist/post-components/p-06bf6b81.entry.js +1 -0
- package/dist/post-components/p-0ca39161.entry.js +1 -0
- package/dist/post-components/p-0f398677.js +1 -0
- package/dist/post-components/p-10f9d25e.js +1 -0
- package/dist/post-components/p-15da2cf9.js +1 -0
- package/dist/post-components/p-1622ed8c.js +1 -0
- package/dist/post-components/p-1d5e275b.js +1 -0
- package/dist/post-components/p-2a90f66c.js +1 -0
- package/dist/post-components/p-32aa68ac.entry.js +1 -0
- package/dist/post-components/p-3d30acad.entry.js +1 -0
- package/dist/post-components/p-48cd3157.js +1 -0
- package/dist/post-components/p-56da2097.entry.js +1 -0
- package/dist/post-components/p-65824049.entry.js +1 -0
- package/dist/post-components/p-6b31a76a.js +1 -0
- package/dist/post-components/p-722ffaae.js +1 -0
- package/dist/post-components/p-7c6f4c29.js +1 -0
- package/dist/post-components/p-817effd4.js +1 -0
- package/dist/post-components/p-8579ac14.js +8 -0
- package/dist/post-components/p-86859a7b.entry.js +1 -0
- package/dist/post-components/p-8db32dab.js +8 -0
- package/dist/post-components/p-936682bc.entry.js +1 -0
- package/dist/post-components/p-9597127a.js +1 -0
- package/dist/post-components/p-9818ad52.entry.js +1 -0
- package/dist/post-components/{p-5c758f41.js → p-9e461613.js} +1 -1
- package/dist/post-components/p-9ec20111.js +1 -0
- package/dist/post-components/p-a1a39a27.js +1 -0
- package/dist/post-components/p-a1bae666.entry.js +1 -0
- package/dist/post-components/p-a27907cc.js +1 -0
- package/dist/post-components/p-a77a6729.entry.js +1 -0
- package/dist/post-components/p-ab3ab29b.js +1 -0
- package/dist/post-components/p-ad9ffd61.entry.js +1 -0
- package/dist/post-components/p-b8241188.js +1 -0
- package/dist/post-components/p-bece917c.js +1 -0
- package/dist/post-components/p-bf3c80a3.entry.js +1 -0
- package/dist/post-components/p-cd8aef45.entry.js +1 -0
- package/dist/post-components/p-cdd3a06a.entry.js +1 -0
- package/dist/post-components/p-dc702c39.entry.js +1 -0
- package/dist/post-components/p-e077239a.entry.js +1 -0
- package/dist/post-components/p-e653daec.entry.js +1 -0
- package/dist/post-components/p-e8861c07.entry.js +1 -0
- package/dist/post-components/p-f2478a7d.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-breadcrumb/post-breadcrumb.d.ts → post-breadcrumbs/post-breadcrumbs.d.ts} +4 -4
- 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 +4 -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 +2 -5
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +14 -39
- package/dist/types/components/post-menu/post-menu.d.ts +3 -3
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +1 -1
- package/dist/types/components/post-popover/post-popover.d.ts +6 -4
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +1 -1
- package/dist/types/components/post-tag/post-tag.d.ts +1 -1
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +9 -4
- package/dist/types/components.d.ts +35 -35
- package/dist/types/index.d.ts +1 -1
- package/dist/types/popover-fn.d.ts +11 -0
- package/dist/types/utils/environment.d.ts +2 -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/get-root.js +7 -1
- package/loaders/index.d.ts +2 -2
- package/loaders/index.js +4 -4
- package/loaders/long-press-event.js +264 -0
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item2.js +3 -3
- package/loaders/post-accordion.js +3 -3
- package/loaders/post-avatar.js +5 -4
- package/loaders/post-back-to-top.js +8 -8
- package/loaders/post-banner.js +3 -7
- package/loaders/post-breadcrumb-item2.js +2 -2
- package/loaders/{post-breadcrumb.d.ts → post-breadcrumbs.d.ts} +4 -4
- package/loaders/{post-breadcrumb.js → post-breadcrumbs.js} +42 -34
- package/loaders/post-card-control.js +26 -40
- package/loaders/post-closebutton.js +8 -3
- package/loaders/post-collapsible-trigger2.js +19 -31
- package/loaders/post-collapsible2.js +9 -12
- package/loaders/post-footer.js +8 -8
- package/loaders/post-header.js +15 -23
- package/loaders/post-icon2.js +5 -5
- package/loaders/post-language-option.js +4 -11
- package/loaders/post-language-switch.js +9 -18
- package/loaders/post-linkarea.js +5 -4
- package/loaders/post-list-item.js +2 -2
- package/loaders/post-list.js +3 -4
- package/loaders/post-logo.js +3 -2
- package/loaders/post-mainnavigation.js +94 -182
- package/loaders/post-megadropdown-trigger.js +38 -37
- package/loaders/post-megadropdown.js +21 -30
- package/loaders/post-menu-trigger2.js +15 -15
- package/loaders/post-menu2.js +50 -56
- package/loaders/post-popover.js +15 -13
- package/loaders/post-popovercontainer2.js +638 -36
- package/loaders/post-rating.js +3 -13
- package/loaders/post-tab-header.js +5 -4
- package/loaders/post-tab-panel.js +3 -3
- package/loaders/post-tabs.js +3 -10
- package/loaders/post-tag.js +2 -2
- package/loaders/post-togglebutton.js +12 -11
- package/loaders/post-tooltip.js +37 -294
- package/package.json +20 -15
- package/dist/cjs/debounce-158fd76f.js +0 -13
- package/dist/cjs/get-root-7a3498ef.js +0 -11
- package/dist/cjs/post-breadcrumb.cjs.entry.js +0 -13
- package/dist/cjs/post-card-control-155fb433.js +0 -283
- package/dist/cjs/post-popover-858cbd12.js +0 -110
- package/dist/cjs/post-tag-d1a1176c.js +0 -47
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +0 -3
- package/dist/components/debounce.js +0 -11
- package/dist/components/post-breadcrumb.js +0 -6
- package/dist/esm/debounce-e54c7131.js +0 -11
- package/dist/esm/get-root-7af2e0d1.js +0 -9
- package/dist/esm/package-da68ab5a.js +0 -3
- package/dist/esm/post-breadcrumb.entry.js +0 -5
- package/dist/esm/post-card-control-aa043898.js +0 -281
- package/dist/esm/post-popover-e51a7a18.js +0 -108
- package/dist/esm/post-tag-a3b989e0.js +0 -45
- package/dist/post-components/p-1376c653.js +0 -1
- package/dist/post-components/p-13835969.js +0 -1
- package/dist/post-components/p-13fdbaf6.entry.js +0 -1
- package/dist/post-components/p-1e2169ae.entry.js +0 -1
- package/dist/post-components/p-23e4c270.entry.js +0 -1
- package/dist/post-components/p-2641e06b.js +0 -1
- package/dist/post-components/p-2d3b16c7.js +0 -1
- package/dist/post-components/p-33c35e15.js +0 -1
- package/dist/post-components/p-3b247d71.entry.js +0 -1
- package/dist/post-components/p-42a5fdf8.js +0 -1
- package/dist/post-components/p-4ed7bab6.js +0 -1
- package/dist/post-components/p-5aeb3656.js +0 -1
- package/dist/post-components/p-5c518421.js +0 -1
- package/dist/post-components/p-6db1a2e0.entry.js +0 -1
- package/dist/post-components/p-6fe98184.entry.js +0 -1
- package/dist/post-components/p-7d731077.entry.js +0 -1
- package/dist/post-components/p-7ee47334.entry.js +0 -1
- package/dist/post-components/p-8223e97b.js +0 -1
- package/dist/post-components/p-8a8376d0.js +0 -1
- package/dist/post-components/p-8bb828cf.entry.js +0 -1
- package/dist/post-components/p-8e55ddd2.js +0 -1
- package/dist/post-components/p-9681efce.js +0 -1
- package/dist/post-components/p-96a59372.entry.js +0 -1
- package/dist/post-components/p-9748a355.js +0 -1
- package/dist/post-components/p-99c8fd43.entry.js +0 -1
- package/dist/post-components/p-ac042f7a.entry.js +0 -1
- package/dist/post-components/p-c34cacb7.js +0 -1
- package/dist/post-components/p-c3a970c5.js +0 -1
- package/dist/post-components/p-c4651d32.entry.js +0 -1
- package/dist/post-components/p-c9b61d31.entry.js +0 -1
- package/dist/post-components/p-d16dd7f9.js +0 -1
- package/dist/post-components/p-d81c5908.entry.js +0 -1
- package/dist/post-components/p-dbe31632.js +0 -1
- package/dist/post-components/p-e1baac59.js +0 -1
- package/dist/post-components/p-e2294014.js +0 -15
- package/dist/post-components/p-e8ff8122.js +0 -1
- package/dist/post-components/p-ed78d04a.entry.js +0 -1
- package/dist/post-components/p-f1c0924a.js +0 -1
- package/dist/post-components/p-f1db96d0.entry.js +0 -1
- package/dist/post-components/p-f7aa917f.entry.js +0 -1
- package/dist/post-components/p-f96b80cc.entry.js +0 -1
- package/dist/post-components/p-fc91cbc2.js +0 -1
- package/dist/post-components/p-fd78716d.js +0 -1
- package/loaders/debounce.js +0 -11
|
@@ -1,23 +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-791f9257.js';
|
|
3
3
|
import { a as slideUp, s as slideDown } from './slide-cd2850ee.js';
|
|
4
4
|
import { e as eventGuard } from './event-guard-538ee077.js';
|
|
5
|
+
import { I as IS_BROWSER, b as breakpoint } from './breakpoints-7812702e.js';
|
|
5
6
|
import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-8f8fe5b0.js';
|
|
6
7
|
import { c as checkNonEmpty } from './check-non-empty-258a56b3.js';
|
|
7
8
|
import { c as checkType } from './check-type-37d5d307.js';
|
|
8
9
|
import { n as nanoid } from './index.browser-51485f85.js';
|
|
9
|
-
import {
|
|
10
|
-
|
|
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;
|
|
11
48
|
|
|
12
49
|
const PostClosebutton = class {
|
|
13
50
|
constructor(hostRef) {
|
|
14
51
|
registerInstance(this, hostRef);
|
|
15
52
|
}
|
|
16
|
-
get host() { return getElement(this); }
|
|
17
53
|
render() {
|
|
18
|
-
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' })))));
|
|
19
55
|
}
|
|
56
|
+
get host() { return getElement(this); }
|
|
20
57
|
};
|
|
58
|
+
PostClosebutton.style = PostClosebuttonStyle0;
|
|
21
59
|
|
|
22
60
|
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
23
61
|
|
|
@@ -153,51 +191,10 @@ function throttle (delay, callback, options) {
|
|
|
153
191
|
return wrapper;
|
|
154
192
|
}
|
|
155
193
|
|
|
156
|
-
const
|
|
157
|
-
'button',
|
|
158
|
-
'input:not([type="hidden"])',
|
|
159
|
-
'[tabindex]',
|
|
160
|
-
'select',
|
|
161
|
-
'textarea',
|
|
162
|
-
'[contenteditable]',
|
|
163
|
-
'a[href]',
|
|
164
|
-
'iframe',
|
|
165
|
-
'audio[controls]',
|
|
166
|
-
'video[controls]',
|
|
167
|
-
'area[href]',
|
|
168
|
-
'details > summary:first-of-type',
|
|
169
|
-
].join(',')})`;
|
|
170
|
-
const focusDisablingSelector = `:where(${[
|
|
171
|
-
'[inert]',
|
|
172
|
-
'[inert] *',
|
|
173
|
-
':disabled',
|
|
174
|
-
'dialog:not([open]) *',
|
|
175
|
-
'[popover]:not(:popover-open) *',
|
|
176
|
-
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
177
|
-
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
178
|
-
'[tabindex^="-"]',
|
|
179
|
-
'[hidden]:not([hidden="false"])',
|
|
180
|
-
].join(',')})`;
|
|
181
|
-
function getFocusableChildren(element) {
|
|
182
|
-
const focusableChildren = element.querySelectorAll(`${focusableSelector}:not(${focusDisablingSelector})`);
|
|
183
|
-
const visibleFocusableChildren = Array.from(focusableChildren).filter(child => {
|
|
184
|
-
const style = window.getComputedStyle(child.parentElement);
|
|
185
|
-
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
186
|
-
});
|
|
187
|
-
return visibleFocusableChildren;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
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));--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}}";
|
|
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}}";
|
|
191
195
|
const PostHeaderStyle0 = postHeaderCss;
|
|
192
196
|
|
|
193
197
|
const PostHeader = class {
|
|
194
|
-
firstFocusableEl;
|
|
195
|
-
lastFocusableEl;
|
|
196
|
-
mobileMenu;
|
|
197
|
-
mobileMenuAnimation;
|
|
198
|
-
throttledResize = throttle(50, () => this.handleResize());
|
|
199
|
-
scrollParentResizeObserver;
|
|
200
|
-
localHeaderResizeObserver;
|
|
201
198
|
get scrollParent() {
|
|
202
199
|
const frozenScrollParent = document.querySelector('[data-post-scroll-locked]');
|
|
203
200
|
if (frozenScrollParent)
|
|
@@ -212,7 +209,6 @@ const PostHeader = class {
|
|
|
212
209
|
}
|
|
213
210
|
return document.body;
|
|
214
211
|
}
|
|
215
|
-
get host() { return getElement(this); }
|
|
216
212
|
lockBody(newValue, _oldValue, propName) {
|
|
217
213
|
const scrollParent = this.scrollParent;
|
|
218
214
|
const mobileMenuExtended = propName === 'mobileMenuExtended' ? newValue : this.mobileMenuExtended;
|
|
@@ -225,13 +221,18 @@ const PostHeader = class {
|
|
|
225
221
|
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
226
222
|
}
|
|
227
223
|
}
|
|
228
|
-
/**
|
|
229
|
-
* An event emitted when the device has changed
|
|
230
|
-
*/
|
|
231
|
-
postUpdateDevice;
|
|
232
224
|
constructor(hostRef) {
|
|
233
225
|
registerInstance(this, hostRef);
|
|
234
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
|
+
};
|
|
235
236
|
this.device = null;
|
|
236
237
|
this.mobileMenuExtended = false;
|
|
237
238
|
this.megadropdownOpen = false;
|
|
@@ -253,10 +254,12 @@ const PostHeader = class {
|
|
|
253
254
|
document.addEventListener('postToggleMegadropdown', this.megedropdownStateHandler);
|
|
254
255
|
this.host.addEventListener('click', this.handleLinkClick);
|
|
255
256
|
this.handleResize();
|
|
256
|
-
this.handleScrollEvent();
|
|
257
257
|
this.handleScrollParentResize();
|
|
258
258
|
this.lockBody(false, this.mobileMenuExtended, 'mobileMenuExtended');
|
|
259
259
|
}
|
|
260
|
+
componentWillRender() {
|
|
261
|
+
this.handleScrollEvent();
|
|
262
|
+
}
|
|
260
263
|
componentDidRender() {
|
|
261
264
|
this.getFocusableElements();
|
|
262
265
|
this.handleLocalHeaderResize();
|
|
@@ -302,14 +305,6 @@ const PostHeader = class {
|
|
|
302
305
|
});
|
|
303
306
|
}
|
|
304
307
|
}
|
|
305
|
-
megedropdownStateHandler = (event) => {
|
|
306
|
-
eventGuard(this.host, event, {
|
|
307
|
-
targetLocalName: 'post-megadropdown',
|
|
308
|
-
delegatorSelector: 'post-header',
|
|
309
|
-
}, () => {
|
|
310
|
-
this.megadropdownOpen = event.detail.isVisible;
|
|
311
|
-
});
|
|
312
|
-
};
|
|
313
308
|
// Get all the focusable elements in the post-header mobile menu
|
|
314
309
|
getFocusableElements() {
|
|
315
310
|
// Get elements in the correct order (different as the DOM order)
|
|
@@ -421,8 +416,9 @@ const PostHeader = class {
|
|
|
421
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" }))))));
|
|
422
417
|
}
|
|
423
418
|
render() {
|
|
424
|
-
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()));
|
|
425
420
|
}
|
|
421
|
+
get host() { return getElement(this); }
|
|
426
422
|
static get watchers() { return {
|
|
427
423
|
"device": ["lockBody"],
|
|
428
424
|
"mobileMenuExtended": ["lockBody"]
|
|
@@ -454,8 +450,6 @@ const PostIcon = class {
|
|
|
454
450
|
this.rotate = null;
|
|
455
451
|
this.scale = null;
|
|
456
452
|
}
|
|
457
|
-
isSSR = typeof window === 'undefined';
|
|
458
|
-
get host() { return getElement(this); }
|
|
459
453
|
validateAnimation(newValue = this.animation) {
|
|
460
454
|
if (newValue !== undefined)
|
|
461
455
|
checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
|
|
@@ -486,7 +480,7 @@ const PostIcon = class {
|
|
|
486
480
|
// the first definition object which defines a domain, will be used to set the domain of the file url
|
|
487
481
|
// the first definition object which defines a slug, will be used to set the slug of the file url
|
|
488
482
|
const urlDefinitions = [this.getUrlDefinition(this.base, 'both')];
|
|
489
|
-
if (
|
|
483
|
+
if (IS_BROWSER) {
|
|
490
484
|
urlDefinitions.push(this.getUrlDefinition(document.head
|
|
491
485
|
.querySelector('meta[name="design-system-settings"][data-post-icon-base]')
|
|
492
486
|
?.getAttribute('data-post-icon-base'), 'relative'));
|
|
@@ -550,8 +544,9 @@ const PostIcon = class {
|
|
|
550
544
|
this.validateAnimation();
|
|
551
545
|
}
|
|
552
546
|
render() {
|
|
553
|
-
return (h(Host, { key: '
|
|
547
|
+
return (h(Host, { key: 'b3c3efcc03f423a248e231b4b4c5d79c93ae25a6', "data-version": version }, h("span", { key: 'd73d4df11fcccb96d5346f3f8c3e18602bb8d484', style: this.getStyles() })));
|
|
554
548
|
}
|
|
549
|
+
get host() { return getElement(this); }
|
|
555
550
|
static get watchers() { return {
|
|
556
551
|
"animation": ["validateAnimation"],
|
|
557
552
|
"base": ["validateBase"],
|
|
@@ -564,7 +559,7 @@ const PostIcon = class {
|
|
|
564
559
|
};
|
|
565
560
|
PostIcon.style = PostIconStyle0;
|
|
566
561
|
|
|
567
|
-
const postLanguageOptionCss = "
|
|
562
|
+
const postLanguageOptionCss = "post-language-option{display:inline-block}post-language-option 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}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option button{background-color:ButtonFace !important}post-language-option button:hover{background-color:Highlight !important}}post-language-option a{color:var(--post-scheme-color-surface-default-fg);text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:2px;text-transform:uppercase}post-language-option :is(a,button){outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){padding-inline:0;width:40px;height:40px;border-radius:2px}post-language-option:where([variant=list]) :is(a,button):hover{color:#504f4b}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option:where([variant=list]) :is(a,button){border:1px solid ButtonBorder;color:ButtonText}}post-language-option:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:Highlight !important;color:HighlightText}}post-language-option:where([variant=menu]){min-width:72px}post-language-option:where([variant=menu])[active]:not([active=false]){display:none}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:16px;box-sizing:border-box;justify-content:flex-start;position:relative}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}";
|
|
568
563
|
const PostLanguageOptionStyle0 = postLanguageOptionCss;
|
|
569
564
|
|
|
570
565
|
const PostLanguageOption = class {
|
|
@@ -578,7 +573,6 @@ const PostLanguageOption = class {
|
|
|
578
573
|
this.name = undefined;
|
|
579
574
|
this.url = undefined;
|
|
580
575
|
}
|
|
581
|
-
get host() { return getElement(this); }
|
|
582
576
|
validateCode() {
|
|
583
577
|
checkType(this, 'code', 'string');
|
|
584
578
|
}
|
|
@@ -603,14 +597,6 @@ const PostLanguageOption = class {
|
|
|
603
597
|
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
604
598
|
}
|
|
605
599
|
}
|
|
606
|
-
/**
|
|
607
|
-
* An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
|
|
608
|
-
*/
|
|
609
|
-
postChange;
|
|
610
|
-
/**
|
|
611
|
-
* An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
|
|
612
|
-
*/
|
|
613
|
-
postLanguageOptionInitiallyActive;
|
|
614
600
|
/**
|
|
615
601
|
* Selects the language option programmatically.
|
|
616
602
|
*/
|
|
@@ -631,8 +617,9 @@ const PostLanguageOption = class {
|
|
|
631
617
|
this.emitChange();
|
|
632
618
|
}
|
|
633
619
|
};
|
|
634
|
-
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)))));
|
|
635
621
|
}
|
|
622
|
+
get host() { return getElement(this); }
|
|
636
623
|
static get watchers() { return {
|
|
637
624
|
"code": ["validateCode"],
|
|
638
625
|
"active": ["validateActiveProp"],
|
|
@@ -650,12 +637,15 @@ const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
|
|
|
650
637
|
const PostLanguageSwitch = class {
|
|
651
638
|
constructor(hostRef) {
|
|
652
639
|
registerInstance(this, hostRef);
|
|
640
|
+
this.menuId = `p${nanoid(11)}`;
|
|
653
641
|
this.caption = undefined;
|
|
654
642
|
this.description = undefined;
|
|
655
643
|
this.variant = 'list';
|
|
656
644
|
this.activeLang = undefined;
|
|
657
645
|
}
|
|
658
|
-
get
|
|
646
|
+
get languageOptions() {
|
|
647
|
+
return Array.from(this.host.querySelectorAll('post-language-option'));
|
|
648
|
+
}
|
|
659
649
|
validateCaption() {
|
|
660
650
|
checkType(this, 'caption', 'string');
|
|
661
651
|
}
|
|
@@ -673,7 +663,6 @@ const PostLanguageSwitch = class {
|
|
|
673
663
|
// Initially set variants and active language
|
|
674
664
|
// Handles cases where the language-switch is rendered after the language-options have been rendered
|
|
675
665
|
this.updateChildrenVariant();
|
|
676
|
-
this.updateActiveLanguage();
|
|
677
666
|
}
|
|
678
667
|
/**
|
|
679
668
|
* Listen for the postChange event and guard it to run only for events originating from a <post-language-option> element.
|
|
@@ -704,34 +693,22 @@ const PostLanguageSwitch = class {
|
|
|
704
693
|
handleInitiallyActive(event) {
|
|
705
694
|
this.activeLang = event.detail;
|
|
706
695
|
}
|
|
707
|
-
get languageOptions() {
|
|
708
|
-
return this.host.querySelectorAll('post-language-option');
|
|
709
|
-
}
|
|
710
|
-
get activeLanguageOption() {
|
|
711
|
-
return this.host.querySelector('post-language-option[active]:not([active="false"])');
|
|
712
|
-
}
|
|
713
|
-
handleSlotChange() {
|
|
714
|
-
this.updateActiveLanguage();
|
|
715
|
-
}
|
|
716
|
-
updateActiveLanguage() {
|
|
717
|
-
this.activeLang = this.activeLanguageOption.getAttribute('code');
|
|
718
|
-
}
|
|
719
696
|
// Update post-language-option variant to have the correct style
|
|
720
697
|
updateChildrenVariant() {
|
|
721
698
|
this.languageOptions.forEach(el => {
|
|
722
699
|
el.setAttribute('variant', this.variant);
|
|
723
700
|
});
|
|
724
701
|
}
|
|
725
|
-
menuId = `p${nanoid(11)}`;
|
|
726
702
|
renderList() {
|
|
727
|
-
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))));
|
|
728
704
|
}
|
|
729
705
|
renderDropdown() {
|
|
730
|
-
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))));
|
|
731
707
|
}
|
|
732
708
|
render() {
|
|
733
709
|
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
734
710
|
}
|
|
711
|
+
get host() { return getElement(this); }
|
|
735
712
|
static get watchers() { return {
|
|
736
713
|
"caption": ["validateCaption"],
|
|
737
714
|
"description": ["validateDescription"],
|
|
@@ -740,7 +717,7 @@ const PostLanguageSwitch = class {
|
|
|
740
717
|
};
|
|
741
718
|
PostLanguageSwitch.style = PostLanguageSwitchStyle0;
|
|
742
719
|
|
|
743
|
-
const postListCss = "
|
|
720
|
+
const postListCss = "post-list{display:flex;flex-direction:column;gap:var(--post-list-title-gap, 0)}post-list>[role=list]{display:flex;flex-direction:column;gap:var(--post-list-item-gap, 0)}post-list:where([horizontal]:not([horizontal=false])){flex-direction:row;align-items:center}post-list:where([horizontal]:not([horizontal=false]))>[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}";
|
|
744
721
|
const PostListStyle0 = postListCss;
|
|
745
722
|
|
|
746
723
|
const PostList = class {
|
|
@@ -750,8 +727,6 @@ const PostList = class {
|
|
|
750
727
|
this.titleHidden = false;
|
|
751
728
|
this.horizontal = false;
|
|
752
729
|
}
|
|
753
|
-
get host() { return getElement(this); }
|
|
754
|
-
titleEl;
|
|
755
730
|
componentWillLoad() {
|
|
756
731
|
/**
|
|
757
732
|
* Get the id set on the host element or use a random id by default
|
|
@@ -767,8 +742,9 @@ const PostList = class {
|
|
|
767
742
|
}
|
|
768
743
|
}
|
|
769
744
|
render() {
|
|
770
|
-
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" }))));
|
|
771
746
|
}
|
|
747
|
+
get host() { return getElement(this); }
|
|
772
748
|
};
|
|
773
749
|
PostList.style = PostListStyle0;
|
|
774
750
|
|
|
@@ -779,13 +755,13 @@ const PostListItem = class {
|
|
|
779
755
|
constructor(hostRef) {
|
|
780
756
|
registerInstance(this, hostRef);
|
|
781
757
|
}
|
|
782
|
-
get host() { return getElement(this); }
|
|
783
758
|
connectedCallback() {
|
|
784
759
|
this.host.setAttribute('slot', 'post-list-item');
|
|
785
760
|
}
|
|
786
761
|
render() {
|
|
787
|
-
return (h(Host, { key: '
|
|
762
|
+
return (h(Host, { key: 'c826293ea2a7446bea2f5b223934b444655198a0', role: "listitem", slot: "post-list-item", version: version }, h("slot", { key: 'b997f79da2fbc87fbc6a388c118a03c008ad2c23' })));
|
|
788
763
|
}
|
|
764
|
+
get host() { return getElement(this); }
|
|
789
765
|
};
|
|
790
766
|
PostListItem.style = PostListItemStyle0;
|
|
791
767
|
|
|
@@ -797,7 +773,6 @@ const PostLogo = class {
|
|
|
797
773
|
registerInstance(this, hostRef);
|
|
798
774
|
this.url = undefined;
|
|
799
775
|
}
|
|
800
|
-
get host() { return getElement(this); }
|
|
801
776
|
validateUrl() {
|
|
802
777
|
checkEmptyOrUrl(this, 'url');
|
|
803
778
|
}
|
|
@@ -813,252 +788,168 @@ const PostLogo = class {
|
|
|
813
788
|
render() {
|
|
814
789
|
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
815
790
|
const LogoTag = logoLink ? 'a' : 'span';
|
|
816
|
-
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" }))))));
|
|
817
792
|
}
|
|
793
|
+
get host() { return getElement(this); }
|
|
818
794
|
static get watchers() { return {
|
|
819
795
|
"url": ["validateUrl"]
|
|
820
796
|
}; }
|
|
821
797
|
};
|
|
822
798
|
PostLogo.style = PostLogoStyle0;
|
|
823
799
|
|
|
824
|
-
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(--post-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(--post-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(--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 .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}";
|
|
825
801
|
const PostMainnavigationStyle0 = postMainnavigationCss;
|
|
826
802
|
|
|
827
803
|
const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
|
|
828
804
|
const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
|
|
829
|
-
const NAVIGATION_LIST_SELECTOR = 'post-list > [role="list"]:not(post-megadropdown *)';
|
|
830
|
-
const NAVIGATION_ITEM_SELECTOR = 'post-list-item :is(a, button):not(post-megadropdown *)';
|
|
831
805
|
const PostMainnavigation = class {
|
|
832
806
|
constructor(hostRef) {
|
|
833
807
|
registerInstance(this, hostRef);
|
|
834
808
|
this.canScrollLeft = false;
|
|
835
809
|
this.canScrollRight = false;
|
|
836
|
-
this.
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
scrollRepeatInterval;
|
|
843
|
-
navbarDisableTimer;
|
|
844
|
-
resizeObserver;
|
|
845
|
-
mutationObserver = new MutationObserver(async (mutations) => {
|
|
846
|
-
// Wait for all elements to be hydrated
|
|
847
|
-
await Promise.all(mutations
|
|
848
|
-
.flatMap((mutation) => Array.from(mutation.addedNodes))
|
|
849
|
-
.map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
|
|
850
|
-
// Recalculate scrollability after DOM changes
|
|
851
|
-
this.checkScrollability();
|
|
852
|
-
});
|
|
853
|
-
get host() { return getElement(this); }
|
|
854
|
-
/**
|
|
855
|
-
* Update navbar translation when 'translateAmount' changes and recalculate scrollability
|
|
856
|
-
*/
|
|
857
|
-
onTranslateAmountChanges(value) {
|
|
858
|
-
this.navbar.style.marginInlineStart = `-${value}px`;
|
|
859
|
-
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);
|
|
860
816
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
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);
|
|
867
828
|
}
|
|
868
829
|
/**
|
|
869
|
-
*
|
|
830
|
+
* Disconnects observers and remove event listeners when the main navigation is removed from the DOM.
|
|
870
831
|
*/
|
|
871
832
|
disconnectedCallback() {
|
|
872
|
-
this.header = null;
|
|
873
833
|
this.mutationObserver.disconnect();
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
}
|
|
834
|
+
this.resizeObserver.disconnect();
|
|
835
|
+
this.navbar.removeEventListener('scrollend', this.checkScrollability);
|
|
877
836
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
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);
|
|
882
847
|
});
|
|
883
|
-
//
|
|
884
|
-
|
|
885
|
-
this.resizeObserver.observe(this.navbar);
|
|
886
|
-
const navList = this.navigationList;
|
|
887
|
-
if (navList) {
|
|
888
|
-
this.resizeObserver.observe(navList);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
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)));
|
|
892
850
|
this.fixLayoutShift();
|
|
893
|
-
|
|
894
|
-
this.navbar.addEventListener('focusin', e => this.adjustTranslation(e));
|
|
851
|
+
this.checkScrollability();
|
|
895
852
|
}
|
|
896
|
-
|
|
853
|
+
get navigationItems() {
|
|
854
|
+
return Array.from(this.navbar.querySelectorAll(':is(a, button):not(post-megadropdown *)'));
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Hack to fix the layout shift due to bold text on active elements
|
|
858
|
+
*/
|
|
897
859
|
fixLayoutShift() {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
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
|
+
});
|
|
902
868
|
}
|
|
903
869
|
handleBackButtonClick() {
|
|
904
|
-
|
|
905
|
-
|
|
870
|
+
const header = this.navbar.closest('post-header');
|
|
871
|
+
if (header)
|
|
872
|
+
header.toggleMobileMenu();
|
|
906
873
|
}
|
|
907
874
|
/**
|
|
908
|
-
*
|
|
875
|
+
* Returns whether scrolling is enabled in either the left or right direction.
|
|
909
876
|
*/
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
if (!this.canScroll || !focusedElement.matches(NAVIGATION_ITEM_SELECTOR))
|
|
913
|
-
return;
|
|
914
|
-
// We need to move the element into the view before it is focused to avoid browser default behavior
|
|
915
|
-
e.preventDefault();
|
|
916
|
-
this.withoutTransition(() => {
|
|
917
|
-
// Try scrolling in both directions, only the necessary translation will actually occur
|
|
918
|
-
this.translateRightTo(focusedElement);
|
|
919
|
-
this.translateLeftTo(focusedElement);
|
|
920
|
-
focusedElement.focus();
|
|
921
|
-
});
|
|
877
|
+
get canScroll() {
|
|
878
|
+
return this.canScrollLeft || this.canScrollRight;
|
|
922
879
|
}
|
|
923
880
|
/**
|
|
924
881
|
* Checks if scrolling is possible in either direction (left or right) and updates the state accordingly.
|
|
925
882
|
*/
|
|
926
883
|
checkScrollability() {
|
|
927
|
-
const { scrollWidth, clientWidth } = this.navbar;
|
|
928
|
-
const couldScroll = this.canScroll;
|
|
884
|
+
const { scrollLeft, scrollWidth, clientWidth } = this.navbar;
|
|
929
885
|
if (scrollWidth === clientWidth) {
|
|
930
886
|
// If scroll width equals client width, scrolling is disabled in both directions
|
|
931
887
|
this.canScrollLeft = this.canScrollRight = false;
|
|
932
888
|
}
|
|
933
889
|
else {
|
|
934
|
-
this.canScrollLeft =
|
|
935
|
-
this.canScrollRight = clientWidth +
|
|
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
|
|
936
892
|
}
|
|
937
|
-
if (couldScroll && !this.canScroll) {
|
|
938
|
-
this.withoutTransition(() => (this.translationAmount = 0));
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
/**
|
|
942
|
-
* Returns whether scrolling is enabled in either the left or right direction.
|
|
943
|
-
*/
|
|
944
|
-
get canScroll() {
|
|
945
|
-
return this.canScrollLeft || this.canScrollRight;
|
|
946
893
|
}
|
|
947
894
|
/**
|
|
948
895
|
* Handles the scrolling behavior when a user clicks on the left or right scroll buttons.
|
|
949
896
|
*/
|
|
950
|
-
handleScrollButtonClick(direction) {
|
|
951
|
-
if (!this.canScroll)
|
|
897
|
+
handleScrollButtonClick(e, direction) {
|
|
898
|
+
if (!this.canScroll || e.button !== 0)
|
|
952
899
|
return;
|
|
953
900
|
// Disable interaction with the navbar during scrolling
|
|
954
|
-
this.
|
|
955
|
-
//
|
|
956
|
-
this.
|
|
901
|
+
this.temporarilyDisableNavbar();
|
|
902
|
+
// Set up the correct scroll function
|
|
903
|
+
const scroll = direction === 'right' ? this.scrollRight : this.scrollLeft;
|
|
904
|
+
scroll();
|
|
957
905
|
// Repeat the scrolling action while the button is held down
|
|
958
906
|
this.scrollRepeatInterval = setInterval(() => {
|
|
959
|
-
|
|
907
|
+
scroll();
|
|
960
908
|
}, SCROLL_REPEAT_INTERVAL);
|
|
961
909
|
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
const couldScroll = direction === 'left' ? this.translateLeftTo(item, true) : this.translateRightTo(item, true);
|
|
975
|
-
if (couldScroll)
|
|
976
|
-
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
|
+
}
|
|
977
922
|
}
|
|
978
923
|
}
|
|
979
|
-
|
|
980
|
-
const
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
// Calculate the maximum translation amount to prevent scrolling past the end of the content
|
|
993
|
-
const maximumTranslation = this.navbar.scrollWidth - this.host.clientWidth;
|
|
994
|
-
// Adjust the translation amount, ensuring it doesn't exceed the maximum scrollable area
|
|
995
|
-
const { marginRight } = getComputedStyle(this.navigationList);
|
|
996
|
-
this.translationAmount =
|
|
997
|
-
Math.min(this.translationAmount + translationIncrease, maximumTranslation) +
|
|
998
|
-
parseInt(marginRight);
|
|
999
|
-
return true;
|
|
1000
|
-
}
|
|
1001
|
-
translateLeftTo(navigationItem, skipSmallTranslation = false) {
|
|
1002
|
-
const listItem = navigationItem.closest('post-list-item');
|
|
1003
|
-
// Get the left edge position of the list item relative to the left of the screen
|
|
1004
|
-
const leftEdgePosition = listItem.offsetLeft;
|
|
1005
|
-
// Calculate the first visible position on the screen to the left, right after the left scroll button
|
|
1006
|
-
const firstVisiblePosition = this.leftScrollButton.clientWidth;
|
|
1007
|
-
// If the item is already fully visible, no translation is needed
|
|
1008
|
-
if (leftEdgePosition > firstVisiblePosition)
|
|
1009
|
-
return false;
|
|
1010
|
-
const translationDecrease = firstVisiblePosition - leftEdgePosition + 1; // + 1 because offset values are rounded
|
|
1011
|
-
// If the required scroll distance is too small (less than half the width of the item), don't perform the scroll
|
|
1012
|
-
if (skipSmallTranslation && translationDecrease < listItem.clientWidth / 2)
|
|
1013
|
-
return false;
|
|
1014
|
-
// Calculate the minimum allowed translation amount (no negative scrolling allowed)
|
|
1015
|
-
const minimumTranslation = 0;
|
|
1016
|
-
// Adjust the translation amount, ensuring it doesn't go below the minimum scrollable area
|
|
1017
|
-
const { marginLeft } = getComputedStyle(this.navigationList);
|
|
1018
|
-
this.translationAmount = Math.max(this.translationAmount - translationDecrease - parseInt(marginLeft), minimumTranslation);
|
|
1019
|
-
return true;
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Returns the navigation list container element
|
|
1023
|
-
*/
|
|
1024
|
-
get navigationList() {
|
|
1025
|
-
return this.navbar.querySelector(NAVIGATION_LIST_SELECTOR);
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Returns the navigation items
|
|
1029
|
-
*/
|
|
1030
|
-
get navigationItems() {
|
|
1031
|
-
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
|
+
}
|
|
1032
937
|
}
|
|
1033
938
|
/**
|
|
1034
939
|
* Temporarily disables interactions with the navbar during scrolling to prevent accidental clicks.
|
|
1035
940
|
* Re-enables interactions after a brief delay to avoid blocking the user entirely.
|
|
1036
941
|
*/
|
|
1037
|
-
|
|
942
|
+
temporarilyDisableNavbar() {
|
|
1038
943
|
if (this.navbarDisableTimer)
|
|
1039
944
|
clearTimeout(this.navbarDisableTimer);
|
|
1040
|
-
this.navbar.
|
|
945
|
+
this.navbar.setAttribute('inert', '');
|
|
1041
946
|
this.navbarDisableTimer = setTimeout(() => {
|
|
1042
|
-
this.navbar.
|
|
947
|
+
this.navbar.removeAttribute('inert');
|
|
1043
948
|
}, NAVBAR_DISABLE_DURATION);
|
|
1044
949
|
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Allows to translate the navbar without a transition
|
|
1047
|
-
*/
|
|
1048
|
-
withoutTransition(callback) {
|
|
1049
|
-
const transition = this.navbar.style.transition;
|
|
1050
|
-
this.navbar.style.transition = 'none';
|
|
1051
|
-
callback();
|
|
1052
|
-
setTimeout(() => {
|
|
1053
|
-
this.navbar.style.transition = transition;
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
950
|
render() {
|
|
1057
|
-
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" }))));
|
|
1058
952
|
}
|
|
1059
|
-
static get watchers() { return {
|
|
1060
|
-
"translationAmount": ["onTranslateAmountChanges"]
|
|
1061
|
-
}; }
|
|
1062
953
|
};
|
|
1063
954
|
PostMainnavigation.style = PostMainnavigationStyle0;
|
|
1064
955
|
|
|
@@ -1069,28 +960,34 @@ const PostMegadropdown = class {
|
|
|
1069
960
|
constructor(hostRef) {
|
|
1070
961
|
registerInstance(this, hostRef);
|
|
1071
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
|
+
};
|
|
1072
981
|
this.device = breakpoint.get('name');
|
|
1073
982
|
this.isVisible = false;
|
|
1074
983
|
this.animationClass = null;
|
|
1075
984
|
}
|
|
1076
|
-
firstFocusableEl;
|
|
1077
|
-
lastFocusableEl;
|
|
1078
|
-
get host() { return getElement(this); }
|
|
1079
|
-
/** Tracks the currently active dropdown instance. */
|
|
1080
|
-
static activeDropdown = null;
|
|
1081
985
|
breakpointChange(e) {
|
|
1082
986
|
this.device = e.detail;
|
|
1083
987
|
if (this.device === 'desktop' && this.isVisible) {
|
|
1084
988
|
this.animationClass = null;
|
|
1085
989
|
}
|
|
1086
990
|
}
|
|
1087
|
-
/**
|
|
1088
|
-
* Emits when the dropdown is shown or hidden.
|
|
1089
|
-
* The event payload is an object.
|
|
1090
|
-
* `isVisible` is true when the dropdown gets opened and false when it gets closed
|
|
1091
|
-
* `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
|
|
1092
|
-
**/
|
|
1093
|
-
postToggleMegadropdown;
|
|
1094
991
|
disconnectedCallback() {
|
|
1095
992
|
this.removeListeners();
|
|
1096
993
|
window.removeEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
|
|
@@ -1170,24 +1067,6 @@ const PostMegadropdown = class {
|
|
|
1170
1067
|
this.removeListeners();
|
|
1171
1068
|
}
|
|
1172
1069
|
}
|
|
1173
|
-
handleClickOutside = (event) => {
|
|
1174
|
-
if (this.device !== 'desktop')
|
|
1175
|
-
return;
|
|
1176
|
-
const target = event.target;
|
|
1177
|
-
if (this.host.contains(target)) {
|
|
1178
|
-
return;
|
|
1179
|
-
}
|
|
1180
|
-
if (target instanceof HTMLElement) {
|
|
1181
|
-
const trigger = target.closest('post-megadropdown-trigger');
|
|
1182
|
-
if (trigger) {
|
|
1183
|
-
const targetDropdownId = trigger.getAttribute('for');
|
|
1184
|
-
if (targetDropdownId !== this.host.id) {
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
this.hide(false);
|
|
1190
|
-
};
|
|
1191
1070
|
addListeners() {
|
|
1192
1071
|
this.host.addEventListener('keydown', e => this.keyboardHandler(e));
|
|
1193
1072
|
document.addEventListener('keyup', e => this.handleTabOutside(e));
|
|
@@ -1230,7 +1109,10 @@ const PostMegadropdown = class {
|
|
|
1230
1109
|
const containerStyle = this.isVisible ? {} : { display: 'none' };
|
|
1231
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" }))))));
|
|
1232
1111
|
}
|
|
1112
|
+
get host() { return getElement(this); }
|
|
1233
1113
|
};
|
|
1114
|
+
/** Tracks the currently active dropdown instance. */
|
|
1115
|
+
PostMegadropdown.activeDropdown = null;
|
|
1234
1116
|
PostMegadropdown.style = PostMegadropdownStyle0;
|
|
1235
1117
|
|
|
1236
1118
|
const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%;position:relative;z-index:3}";
|
|
@@ -1239,20 +1121,45 @@ const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
|
|
|
1239
1121
|
const PostMegadropdownTrigger = class {
|
|
1240
1122
|
constructor(hostRef) {
|
|
1241
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
|
+
};
|
|
1242
1160
|
this.for = undefined;
|
|
1243
1161
|
this.ariaExpanded = false;
|
|
1244
1162
|
}
|
|
1245
|
-
get host() { return getElement(this); }
|
|
1246
|
-
/**
|
|
1247
|
-
* Reference to the slotted button within the trigger, if present.
|
|
1248
|
-
* Used to manage click and key events for mega dropdown control.
|
|
1249
|
-
*/
|
|
1250
|
-
slottedButton = null;
|
|
1251
|
-
/**
|
|
1252
|
-
* Tracks whether this trigger's dropdown was expanded before a state change.
|
|
1253
|
-
* Used to determine if this trigger should handle focus when its dropdown closes.
|
|
1254
|
-
*/
|
|
1255
|
-
wasExpanded = false;
|
|
1256
1163
|
/**
|
|
1257
1164
|
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
1258
1165
|
* @param forValue - The new value of the `for` property.
|
|
@@ -1274,32 +1181,6 @@ const PostMegadropdownTrigger = class {
|
|
|
1274
1181
|
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
1275
1182
|
}
|
|
1276
1183
|
}
|
|
1277
|
-
handleKeyDown = (event) => {
|
|
1278
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
1279
|
-
event.preventDefault();
|
|
1280
|
-
this.handleToggle();
|
|
1281
|
-
if (this.megadropdown && !this.ariaExpanded) {
|
|
1282
|
-
setTimeout(() => this.megadropdown.focusFirst(), 100);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
handleToggleMegadropdown = (event) => {
|
|
1287
|
-
eventGuard(this.host, event, { targetLocalName: 'post-megadropdown' }, () => {
|
|
1288
|
-
if (event.target.id === this.for) {
|
|
1289
|
-
this.ariaExpanded = event.detail.isVisible;
|
|
1290
|
-
// Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
|
|
1291
|
-
if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
|
|
1292
|
-
setTimeout(() => {
|
|
1293
|
-
this.slottedButton?.focus();
|
|
1294
|
-
}, 100);
|
|
1295
|
-
}
|
|
1296
|
-
this.wasExpanded = this.ariaExpanded;
|
|
1297
|
-
if (this.slottedButton) {
|
|
1298
|
-
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1302
|
-
};
|
|
1303
1184
|
componentDidLoad() {
|
|
1304
1185
|
this.validateControlFor();
|
|
1305
1186
|
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
@@ -1322,41 +1203,68 @@ const PostMegadropdownTrigger = class {
|
|
|
1322
1203
|
render() {
|
|
1323
1204
|
return (h(Host, { key: '86b85efede8d9b19f3f0560f500f33f5e172177f', "data-version": version, "tab-index": "-1" }, h("button", { key: '0f810e4c38bc4abf23ac60ab27b36d408e7ced0d' }, h("slot", { key: '2a522ac7e15ef8ac077b73cdebf629b89ea173c6' }))));
|
|
1324
1205
|
}
|
|
1206
|
+
get host() { return getElement(this); }
|
|
1325
1207
|
static get watchers() { return {
|
|
1326
1208
|
"for": ["validateControlFor"]
|
|
1327
1209
|
}; }
|
|
1328
1210
|
};
|
|
1329
1211
|
PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
|
|
1330
1212
|
|
|
1331
|
-
const postMenuCss = "
|
|
1213
|
+
const postMenuCss = ":host{display:block}post-popovercontainer{padding:var(--post-menu-padding);background-color:var(--post-menu-bg, #ffffff);border-color:var(--post-menu-bg, #ffffff)}.popover-container{display:flex;flex-direction:column}";
|
|
1332
1214
|
const PostMenuStyle0 = postMenuCss;
|
|
1333
1215
|
|
|
1334
1216
|
const PostMenu = class {
|
|
1335
1217
|
constructor(hostRef) {
|
|
1336
1218
|
registerInstance(this, hostRef);
|
|
1337
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
|
+
};
|
|
1338
1265
|
this.placement = 'bottom';
|
|
1339
1266
|
this.isVisible = false;
|
|
1340
1267
|
}
|
|
1341
|
-
popoverRef;
|
|
1342
|
-
lastFocusedElement = null;
|
|
1343
|
-
KEYCODES = {
|
|
1344
|
-
SPACE: ' ',
|
|
1345
|
-
ENTER: 'Enter',
|
|
1346
|
-
UP: 'ArrowUp',
|
|
1347
|
-
DOWN: 'ArrowDown',
|
|
1348
|
-
TAB: 'Tab',
|
|
1349
|
-
HOME: 'Home',
|
|
1350
|
-
END: 'End',
|
|
1351
|
-
ESCAPE: 'Escape',
|
|
1352
|
-
};
|
|
1353
|
-
get host() { return getElement(this); }
|
|
1354
|
-
/**
|
|
1355
|
-
* Emits when the menu is shown or hidden.
|
|
1356
|
-
* The event payload is a boolean: `true` when the menu was opened, `false` when it was closed.
|
|
1357
|
-
**/
|
|
1358
|
-
toggleMenu;
|
|
1359
|
-
root;
|
|
1360
1268
|
connectedCallback() {
|
|
1361
1269
|
this.root = getRoot(this.host);
|
|
1362
1270
|
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
@@ -1407,40 +1315,6 @@ const PostMenu = class {
|
|
|
1407
1315
|
console.error('hide: popoverRef is null or undefined');
|
|
1408
1316
|
}
|
|
1409
1317
|
}
|
|
1410
|
-
handleKeyDown = (e) => {
|
|
1411
|
-
e.stopPropagation();
|
|
1412
|
-
if (e.key === this.KEYCODES.ESCAPE) {
|
|
1413
|
-
this.toggle(this.host);
|
|
1414
|
-
return;
|
|
1415
|
-
}
|
|
1416
|
-
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
1417
|
-
this.controlKeyDownHandler(e);
|
|
1418
|
-
}
|
|
1419
|
-
};
|
|
1420
|
-
handlePostToggle = (event) => {
|
|
1421
|
-
eventGuard(this.host, event, { targetLocalName: 'post-popovercontainer', delegatorSelector: 'post-menu' }, () => {
|
|
1422
|
-
this.isVisible = event.detail;
|
|
1423
|
-
this.toggleMenu.emit(this.isVisible);
|
|
1424
|
-
requestAnimationFrame(() => {
|
|
1425
|
-
if (this.isVisible) {
|
|
1426
|
-
this.lastFocusedElement = this.root?.activeElement;
|
|
1427
|
-
const menuItems = this.getSlottedItems();
|
|
1428
|
-
if (menuItems.length > 0) {
|
|
1429
|
-
menuItems[0].focus();
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
else if (this.lastFocusedElement) {
|
|
1433
|
-
this.lastFocusedElement.focus();
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
});
|
|
1437
|
-
};
|
|
1438
|
-
handleClick = (e) => {
|
|
1439
|
-
const target = e.target;
|
|
1440
|
-
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
1441
|
-
this.toggle(this.host);
|
|
1442
|
-
}
|
|
1443
|
-
};
|
|
1444
1318
|
controlKeyDownHandler(e) {
|
|
1445
1319
|
const menuItems = this.getSlottedItems();
|
|
1446
1320
|
if (!menuItems.length) {
|
|
@@ -1487,8 +1361,9 @@ const PostMenu = class {
|
|
|
1487
1361
|
.flatMap(el => Array.from(getFocusableChildren(el))));
|
|
1488
1362
|
}
|
|
1489
1363
|
render() {
|
|
1490
|
-
return (h(Host, { key: '
|
|
1364
|
+
return (h(Host, { key: 'dd3bbcbf568e529588bcf5c90b8c2d4d07d454fb', "data-version": version, role: "menu" }, h("post-popovercontainer", { key: '17a24933ef087cc8699b00f7165fff33756da9a8', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '9ff3d687146c88cf153ea745abcaf7a3267be620', class: "popover-container", part: "popover-container" }, h("slot", { key: 'aff50800748410f6e2583690620c12e47b4c7a22' })))));
|
|
1491
1365
|
}
|
|
1366
|
+
get host() { return getElement(this); }
|
|
1492
1367
|
};
|
|
1493
1368
|
PostMenu.style = PostMenuStyle0;
|
|
1494
1369
|
|
|
@@ -1498,16 +1373,20 @@ const PostMenuTriggerStyle0 = postMenuTriggerCss;
|
|
|
1498
1373
|
const PostMenuTrigger = class {
|
|
1499
1374
|
constructor(hostRef) {
|
|
1500
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
|
+
};
|
|
1501
1387
|
this.for = undefined;
|
|
1502
1388
|
this.ariaExpanded = false;
|
|
1503
1389
|
}
|
|
1504
|
-
get host() { return getElement(this); }
|
|
1505
|
-
/**
|
|
1506
|
-
* Reference to the slotted button within the trigger, if present.
|
|
1507
|
-
* Used to manage click and key events for menu control.
|
|
1508
|
-
*/
|
|
1509
|
-
slottedButton = null;
|
|
1510
|
-
root;
|
|
1511
1390
|
/**
|
|
1512
1391
|
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
1513
1392
|
* @param forValue - The new value of the `for` property.
|
|
@@ -1527,12 +1406,6 @@ const PostMenuTrigger = class {
|
|
|
1527
1406
|
console.warn(`No post-menu found with ID: ${this.for}`);
|
|
1528
1407
|
}
|
|
1529
1408
|
}
|
|
1530
|
-
handleKeyDown = (e) => {
|
|
1531
|
-
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
1532
|
-
e.preventDefault();
|
|
1533
|
-
this.handleToggle();
|
|
1534
|
-
}
|
|
1535
|
-
};
|
|
1536
1409
|
connectedCallback() {
|
|
1537
1410
|
this.root = getRoot(this.host);
|
|
1538
1411
|
}
|
|
@@ -1568,8 +1441,9 @@ const PostMenuTrigger = class {
|
|
|
1568
1441
|
}
|
|
1569
1442
|
}
|
|
1570
1443
|
render() {
|
|
1571
|
-
return (h(Host, { key: '
|
|
1444
|
+
return (h(Host, { key: '1b9589febc2976d17eed3363d91b4321473b7b5e', "data-version": version, "tab-index": "-1" }, h("slot", { key: 'bec55f97274084ab4721dc085dc9e1c3a216c0a3' })));
|
|
1572
1445
|
}
|
|
1446
|
+
get host() { return getElement(this); }
|
|
1573
1447
|
static get watchers() { return {
|
|
1574
1448
|
"for": ["validateControlFor"]
|
|
1575
1449
|
}; }
|
|
@@ -3620,7 +3494,385 @@ const computePosition = (reference, floating, options) => {
|
|
|
3620
3494
|
});
|
|
3621
3495
|
};
|
|
3622
3496
|
|
|
3623
|
-
|
|
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 {" : ""}
|
|
3624
3876
|
:where([popover]) {
|
|
3625
3877
|
position: fixed;
|
|
3626
3878
|
z-index: 2147483647;
|
|
@@ -3638,6 +3890,14 @@ const computePosition = (reference, floating, options) => {
|
|
|
3638
3890
|
margin: auto;
|
|
3639
3891
|
}
|
|
3640
3892
|
|
|
3893
|
+
:where([popover]:not(.\\:popover-open)) {
|
|
3894
|
+
display: none;
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
:where(dialog[popover].\\:popover-open) {
|
|
3898
|
+
display: block;
|
|
3899
|
+
}
|
|
3900
|
+
|
|
3641
3901
|
:where(dialog[popover][open]) {
|
|
3642
3902
|
display: revert;
|
|
3643
3903
|
}
|
|
@@ -3672,11 +3932,229 @@ const computePosition = (reference, floating, options) => {
|
|
|
3672
3932
|
bottom: 0;
|
|
3673
3933
|
}
|
|
3674
3934
|
}
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
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
|
+
}
|
|
3948
|
+
}
|
|
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
|
+
});
|
|
3678
4059
|
}
|
|
3679
|
-
|
|
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
|
+
}
|
|
3680
4158
|
|
|
3681
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)}";
|
|
3682
4160
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
@@ -3691,35 +4169,6 @@ const PostPopovercontainer = class {
|
|
|
3691
4169
|
this.arrow = false;
|
|
3692
4170
|
this.safeSpace = undefined;
|
|
3693
4171
|
}
|
|
3694
|
-
static STATIC_SIDES = {
|
|
3695
|
-
top: 'bottom',
|
|
3696
|
-
right: 'left',
|
|
3697
|
-
bottom: 'top',
|
|
3698
|
-
left: 'right',
|
|
3699
|
-
};
|
|
3700
|
-
static PROPERTIES_TO_CLEAR = [
|
|
3701
|
-
'--safe-space-popover-x',
|
|
3702
|
-
'--safe-space-popover-y',
|
|
3703
|
-
'--safe-space-popover-x-start',
|
|
3704
|
-
'--safe-space-popover-x-end',
|
|
3705
|
-
'--safe-space-popover-y-start',
|
|
3706
|
-
'--safe-space-popover-y-end',
|
|
3707
|
-
'--safe-space-trigger-x',
|
|
3708
|
-
'--safe-space-trigger-y',
|
|
3709
|
-
'--safe-space-trigger-x-start',
|
|
3710
|
-
'--safe-space-trigger-x-end',
|
|
3711
|
-
'--safe-space-trigger-y-start',
|
|
3712
|
-
'--safe-space-trigger-y-end',
|
|
3713
|
-
];
|
|
3714
|
-
get host() { return getElement(this); }
|
|
3715
|
-
arrowRef;
|
|
3716
|
-
eventTarget;
|
|
3717
|
-
clearAutoUpdate;
|
|
3718
|
-
toggleTimeoutId;
|
|
3719
|
-
/**
|
|
3720
|
-
* Fires whenever the popover gets shown or hidden, passing the new state in event.details as a boolean
|
|
3721
|
-
*/
|
|
3722
|
-
postToggle;
|
|
3723
4172
|
/**
|
|
3724
4173
|
* Updates cursor position for safe space feature when popover is open.
|
|
3725
4174
|
* Sets CSS custom properties for dynamic styling of safe area.
|
|
@@ -3729,6 +4178,11 @@ const PostPopovercontainer = class {
|
|
|
3729
4178
|
this.host.style.setProperty('--safe-space-cursor-x', `${event.clientX}px`);
|
|
3730
4179
|
this.host.style.setProperty('--safe-space-cursor-y', `${event.clientY}px`);
|
|
3731
4180
|
}
|
|
4181
|
+
connectedCallback() {
|
|
4182
|
+
if (IS_BROWSER && !isSupported()) {
|
|
4183
|
+
apply();
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
3732
4186
|
componentDidLoad() {
|
|
3733
4187
|
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
3734
4188
|
}
|
|
@@ -3923,11 +4377,32 @@ const PostPopovercontainer = class {
|
|
|
3923
4377
|
}
|
|
3924
4378
|
}
|
|
3925
4379
|
render() {
|
|
3926
|
-
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 => {
|
|
3927
4381
|
this.arrowRef = el;
|
|
3928
|
-
} })), h("slot", { key: '
|
|
4382
|
+
} })), h("slot", { key: 'bb9b4b3d8e7c36f024883d02bd34766bf2e9de88' }))));
|
|
3929
4383
|
}
|
|
4384
|
+
get host() { return getElement(this); }
|
|
3930
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
|
+
];
|
|
3931
4406
|
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
3932
4407
|
|
|
3933
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}";
|
|
@@ -3936,9 +4411,18 @@ const PostTogglebuttonStyle0 = postTogglebuttonCss;
|
|
|
3936
4411
|
const PostTogglebutton = class {
|
|
3937
4412
|
constructor(hostRef) {
|
|
3938
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
|
+
};
|
|
3939
4424
|
this.toggled = false;
|
|
3940
4425
|
}
|
|
3941
|
-
get host() { return getElement(this); }
|
|
3942
4426
|
validateToggled() {
|
|
3943
4427
|
checkType(this, 'toggled', 'boolean');
|
|
3944
4428
|
}
|
|
@@ -3948,19 +4432,10 @@ const PostTogglebutton = class {
|
|
|
3948
4432
|
this.host.addEventListener('click', () => this.handleClick());
|
|
3949
4433
|
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
3950
4434
|
}
|
|
3951
|
-
handleClick = () => {
|
|
3952
|
-
this.toggled = !this.toggled;
|
|
3953
|
-
};
|
|
3954
|
-
handleKeydown = (event) => {
|
|
3955
|
-
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
3956
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
3957
|
-
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
3958
|
-
this.host.click();
|
|
3959
|
-
}
|
|
3960
|
-
};
|
|
3961
4435
|
render() {
|
|
3962
4436
|
return (h(Host, { key: '3a1429a9b67b8cfafae184fe0d060ee3a04974e0', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '9ab1537574423740fc335fde732c699698acac25' })));
|
|
3963
4437
|
}
|
|
4438
|
+
get host() { return getElement(this); }
|
|
3964
4439
|
static get watchers() { return {
|
|
3965
4440
|
"toggled": ["validateToggled"]
|
|
3966
4441
|
}; }
|