@swisspost/design-system-components 9.0.0-next.7 → 9.0.0-next.9
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/check-url-3ffdd2fb.js +14 -0
- package/dist/cjs/debounce-1151afe3.js +12 -0
- package/dist/cjs/{index-e1f32cce.js → index-010dc207.js} +24 -27
- package/dist/cjs/{index-824d2b71.js → index-5d4e0aed.js} +2 -12
- package/dist/cjs/index.cjs.js +47 -42
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-bc44930e.js → package-8e810a59.js} +1 -1
- package/dist/cjs/{post-accordion-c55fef06.js → post-accordion-b9df8522.js} +3 -3
- package/dist/cjs/post-accordion-item-ecc6749f.js +63 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +5 -4
- package/dist/cjs/post-accordion.cjs.entry.js +3 -3
- package/dist/cjs/{post-avatar-10d7b5c0.js → post-avatar-f7236084.js} +2 -2
- package/dist/cjs/post-avatar.cjs.entry.js +3 -3
- package/dist/cjs/post-back-to-top-60762f8e.js +75 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
- package/dist/cjs/{post-banner-b286d37f.js → post-banner-9662f22c.js} +6 -6
- package/dist/cjs/post-banner.cjs.entry.js +5 -4
- package/dist/cjs/post-breadcrumb-b40732fc.js +111 -0
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
- package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
- package/dist/cjs/post-card-control-039c9a4b.js +272 -0
- package/dist/cjs/post-card-control.cjs.entry.js +3 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +33 -0
- package/dist/cjs/{post-collapsible-trigger-c8b3e767.js → post-collapsible-trigger-143cf84a.js} +6 -14
- package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -4
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-footer-5f7fdf96.js +84 -0
- package/dist/cjs/post-footer.cjs.entry.js +11 -0
- package/dist/cjs/post-menu-item-bb0b0b9e.js +74 -0
- package/dist/cjs/{post-popover-91a83e9d.js → post-popover-d0ce9dc6.js} +3 -3
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-rating-57fcf949.js → post-rating-1082197c.js} +3 -3
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-ce56b760.js → post-tab-header-4b6d8d54.js} +3 -3
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-panel-70e49260.js → post-tab-panel-60f211a5.js} +3 -3
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-39262e55.js → post-tabs-1f797ce4.js} +8 -6
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/{post-tag-b6bc5785.js → post-tag-ddaaaedc.js} +3 -3
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-megadropdown-trigger-9b9f1036.js → post-togglebutton-0984a694.js} +1789 -1234
- package/dist/cjs/{post-tooltip-8be3b2aa.js → post-tooltip-38c839a4.js} +4 -4
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
- package/dist/cjs/slide-5d51abe8.js +28 -0
- package/dist/collection/animations/slide.js +23 -0
- package/dist/collection/collection-manifest.json +13 -9
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +22 -7
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +107 -0
- package/dist/collection/components/post-banner/post-banner.js +3 -3
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +161 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +11 -1
- package/dist/collection/components/post-card-control/post-card-control.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.js +2 -2
- package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
- package/dist/collection/components/post-footer/post-footer.css +1 -0
- package/dist/collection/components/post-footer/post-footer.js +75 -0
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +74 -17
- package/dist/collection/components/post-icon/post-icon.js +1 -1
- package/dist/collection/components/post-language-option/post-language-option.css +1 -1
- package/dist/collection/components/post-language-option/post-language-option.js +25 -1
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
- package/dist/collection/components/post-language-switch/post-language-switch.js +163 -0
- package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
- package/dist/collection/components/post-list/post-list.css +1 -1
- package/dist/collection/components/post-list/post-list.js +3 -3
- package/dist/collection/components/post-list-item/post-list-item.js +1 -1
- package/dist/collection/components/post-logo/post-logo.js +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +15 -24
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +82 -68
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -1
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +80 -24
- package/dist/collection/components/post-menu/post-menu.js +6 -4
- package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +11 -1
- package/dist/collection/components/post-popover/post-popover.js +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +2 -2
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +6 -4
- package/dist/collection/components/post-tag/post-tag.js +1 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +24 -6
- package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
- package/dist/collection/index.js +13 -9
- package/dist/collection/utils/breakpoints.js +46 -0
- package/dist/components/debounce.js +10 -0
- package/dist/components/index.js +13 -9
- package/dist/components/index2.js +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +29 -11
- package/dist/components/post-accordion2.js +1 -1
- package/dist/components/post-back-to-top.d.ts +11 -0
- package/dist/components/post-back-to-top.js +6 -0
- package/dist/components/post-back-to-top2.js +100 -0
- package/dist/components/post-banner2.js +3 -3
- package/dist/components/post-breadcrumb-item2.js +13 -3
- package/dist/components/post-breadcrumb.d.ts +11 -0
- package/dist/components/post-breadcrumb.js +6 -0
- package/dist/components/post-breadcrumb2.js +168 -0
- package/dist/components/post-card-control2.js +3 -3
- package/dist/components/post-closebutton2.js +1 -1
- package/dist/components/post-collapsible-trigger2.js +1 -9
- package/dist/components/post-collapsible2.js +2 -2
- package/dist/components/post-footer.d.ts +11 -0
- package/dist/components/post-footer.js +6 -0
- package/dist/components/post-footer2.js +124 -0
- package/dist/components/post-header2.js +55 -14
- package/dist/components/post-icon2.js +2 -2
- package/dist/components/post-language-option2.js +5 -3
- package/dist/components/post-language-switch.d.ts +11 -0
- package/dist/components/post-language-switch.js +6 -0
- package/dist/components/post-language-switch2.js +146 -0
- package/dist/components/post-list-item2.js +1 -1
- package/dist/components/post-list2.js +4 -4
- package/dist/components/post-logo2.js +2 -2
- package/dist/components/post-mainnavigation2.js +17 -17
- package/dist/components/post-megadropdown-trigger2.js +63 -11
- package/dist/components/post-megadropdown2.js +48 -22
- package/dist/components/post-menu-item2.js +1 -1
- package/dist/components/post-menu-trigger2.js +11 -1
- package/dist/components/post-menu2.js +6 -4
- package/dist/components/post-popover2.js +1 -1
- package/dist/components/post-popovercontainer2.js +2 -2
- package/dist/components/post-rating2.js +1 -1
- package/dist/components/post-tab-header2.js +1 -1
- package/dist/components/post-tab-panel2.js +1 -1
- package/dist/components/post-tabs2.js +6 -4
- package/dist/components/post-tag2.js +1 -1
- package/dist/components/post-togglebutton2.js +23 -5
- package/dist/components/post-tooltip2.js +2 -2
- package/dist/components/slide.js +25 -0
- package/dist/docs.json +565 -123
- package/dist/esm/check-url-a974431e.js +12 -0
- package/dist/esm/debounce-abe98cc2.js +10 -0
- package/dist/esm/{index-f8a00dc0.js → index-b49c9904.js} +1 -11
- package/dist/esm/{index-e1b64755.js → index-fb8d6be7.js} +24 -27
- package/dist/esm/index.js +25 -24
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-4d81f3c2.js +3 -0
- package/dist/esm/{post-accordion-7268e29b.js → post-accordion-ee54a3ef.js} +3 -3
- package/dist/esm/post-accordion-item-e10452dc.js +61 -0
- package/dist/esm/post-accordion-item.entry.js +5 -4
- package/dist/esm/post-accordion.entry.js +3 -3
- package/dist/esm/{post-avatar-19162f90.js → post-avatar-5572fa73.js} +2 -2
- package/dist/esm/post-avatar.entry.js +3 -3
- package/dist/esm/post-back-to-top-1d823c43.js +73 -0
- package/dist/esm/post-back-to-top.entry.js +7 -0
- package/dist/esm/{post-banner-132709ad.js → post-banner-78480475.js} +6 -6
- package/dist/esm/post-banner.entry.js +5 -4
- package/dist/esm/post-breadcrumb-aaa77f74.js +109 -0
- package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
- package/dist/esm/post-breadcrumb.entry.js +5 -0
- package/dist/esm/post-card-control-862aa961.js +270 -0
- package/dist/esm/post-card-control.entry.js +3 -3
- package/dist/esm/post-closebutton_15.entry.js +11 -0
- package/dist/esm/{post-collapsible-trigger-43fbbf03.js → post-collapsible-trigger-1c7833f8.js} +5 -13
- package/dist/esm/post-collapsible_2.entry.js +6 -4
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-footer-b18875e7.js +82 -0
- package/dist/esm/post-footer.entry.js +3 -0
- package/dist/esm/post-menu-item-2906384b.js +71 -0
- package/dist/esm/{post-popover-abae1f3a.js → post-popover-2432bb3f.js} +3 -3
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-rating-b963d4f2.js → post-rating-95cbdbb8.js} +3 -3
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-c16feb72.js → post-tab-header-dfea00ea.js} +3 -3
- package/dist/esm/post-tab-header.entry.js +3 -3
- package/dist/esm/{post-tab-panel-cb02df49.js → post-tab-panel-cafd9e04.js} +3 -3
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-81085d7b.js → post-tabs-beef8eae.js} +8 -6
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/{post-tag-103bfff5.js → post-tag-a77e7af6.js} +3 -3
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-megadropdown-trigger-813b5140.js → post-togglebutton-395bf3f0.js} +1785 -1235
- package/dist/esm/{post-tooltip-2c5ff736.js → post-tooltip-b298039a.js} +4 -4
- package/dist/esm/post-tooltip.entry.js +5 -4
- package/dist/esm/slide-3422b8a3.js +25 -0
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0711f76d.entry.js +1 -0
- package/dist/post-components/p-095a06f6.entry.js +1 -0
- package/dist/post-components/p-0b5a5f32.js +1 -0
- package/dist/post-components/p-135fa60f.js +1 -0
- package/dist/post-components/p-18e38d8a.js +1 -0
- package/dist/post-components/p-2e1ec074.entry.js +1 -0
- package/dist/post-components/p-4202b433.entry.js +1 -0
- package/dist/post-components/p-45773f59.js +1 -0
- package/dist/post-components/{p-bb103905.js → p-4953de7e.js} +1 -1
- package/dist/post-components/p-4f67c5f5.entry.js +1 -0
- package/dist/post-components/{p-6f56a13d.js → p-4f9746f6.js} +2 -2
- package/dist/post-components/p-5075c672.entry.js +1 -0
- package/dist/post-components/p-515e0f96.js +1 -0
- package/dist/post-components/p-5467b223.js +1 -0
- package/dist/post-components/p-67036798.entry.js +1 -0
- package/dist/post-components/{p-c819933c.js → p-6d953fb2.js} +1 -1
- package/dist/post-components/p-6edb0ac5.js +1 -0
- package/dist/post-components/{p-fa7af203.js → p-6f8f39ca.js} +1 -1
- package/dist/post-components/p-7503a623.js +1 -0
- package/dist/post-components/p-761b24c7.entry.js +1 -0
- package/dist/post-components/{p-0f699dbc.js → p-77c4c1d2.js} +1 -1
- package/dist/post-components/p-7cf0c2ad.js +1 -0
- package/dist/post-components/p-856c14d6.entry.js +1 -0
- package/dist/post-components/p-866bf50a.entry.js +1 -0
- package/dist/post-components/p-8d621781.js +1 -0
- package/dist/post-components/p-8fe2d72c.entry.js +1 -0
- package/dist/post-components/p-9ad5088f.entry.js +1 -0
- package/dist/post-components/{p-8b6f7f04.js → p-a1d2b90e.js} +1 -1
- package/dist/post-components/p-a521419d.entry.js +1 -0
- package/dist/post-components/p-aa538648.js +1 -0
- package/dist/post-components/p-afdbee2f.js +1 -0
- package/dist/post-components/p-b02817f2.entry.js +1 -0
- package/dist/post-components/p-b157dcba.entry.js +1 -0
- package/dist/post-components/p-b22656b1.js +1 -0
- package/dist/post-components/{p-ed834dde.js → p-bdbd11cb.js} +1 -1
- package/dist/post-components/{p-3eab790d.js → p-c0ae9886.js} +1 -1
- package/dist/post-components/p-c537e196.entry.js +1 -0
- package/dist/post-components/p-d4f93f2b.js +1 -0
- package/dist/post-components/p-dca4246a.entry.js +1 -0
- package/dist/post-components/p-f319b026.js +1 -0
- package/dist/post-components/p-f4b7b379.js +1 -0
- package/dist/post-components/p-fac66087.entry.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/animations/slide.d.ts +2 -0
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +7 -1
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
- package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +1 -0
- package/dist/types/components/post-footer/post-footer.d.ts +23 -0
- package/dist/types/components/post-header/post-header.d.ts +13 -5
- package/dist/types/components/post-language-option/post-language-option.d.ts +5 -0
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
- package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +10 -1
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +24 -12
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +20 -5
- package/dist/types/components/post-menu/post-menu.d.ts +1 -0
- package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +4 -2
- package/dist/types/components.d.ts +150 -29
- package/dist/types/index.d.ts +13 -9
- package/dist/types/utils/breakpoints.d.ts +11 -0
- package/loaders/debounce.js +10 -0
- package/loaders/index.d.ts +8 -0
- package/loaders/index.js +4 -0
- package/loaders/index2.js +1 -1
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item.js +1 -82
- package/loaders/post-accordion-item2.js +102 -0
- package/loaders/post-accordion.js +1 -1
- package/loaders/post-back-to-top.d.ts +11 -0
- package/loaders/post-back-to-top.js +103 -0
- package/loaders/post-banner.js +4 -4
- package/loaders/post-breadcrumb-item.js +1 -70
- package/loaders/post-breadcrumb-item2.js +82 -0
- package/loaders/post-breadcrumb.d.ts +11 -0
- package/loaders/post-breadcrumb.js +171 -0
- package/loaders/post-card-control.js +3 -3
- package/loaders/post-closebutton.js +1 -1
- package/loaders/post-collapsible-trigger2.js +1 -9
- package/loaders/post-collapsible2.js +1 -1
- package/loaders/post-footer.d.ts +11 -0
- package/loaders/post-footer.js +127 -0
- package/loaders/post-header.js +55 -14
- package/loaders/post-icon2.js +2 -2
- package/loaders/post-language-option.js +4 -2
- package/loaders/post-language-switch.d.ts +11 -0
- package/loaders/post-language-switch.js +149 -0
- package/loaders/post-list-item.js +1 -1
- package/loaders/post-list.js +4 -4
- package/loaders/post-logo.js +2 -2
- package/loaders/post-mainnavigation.js +17 -17
- package/loaders/post-megadropdown-trigger.js +63 -11
- package/loaders/post-megadropdown.js +48 -22
- package/loaders/post-menu-item.js +1 -31
- package/loaders/post-menu-item2.js +33 -0
- package/loaders/post-menu-trigger.js +1 -90
- package/{dist/esm/post-menu-trigger-b84f728d.js → loaders/post-menu-trigger2.js} +41 -12
- package/loaders/post-menu.js +1 -199
- package/{dist/esm/post-menu-62c3e49a.js → loaders/post-menu2.js} +42 -13
- package/loaders/post-popover.js +1 -1
- package/loaders/post-popovercontainer2.js +2 -2
- package/loaders/post-rating.js +1 -1
- package/loaders/post-tab-header.js +1 -1
- package/loaders/post-tab-panel.js +1 -1
- package/loaders/post-tabs.js +6 -4
- package/loaders/post-tag.js +1 -1
- package/loaders/post-togglebutton.js +23 -5
- package/loaders/post-tooltip.js +1 -1
- package/loaders/slide.js +25 -0
- package/package.json +6 -4
- package/dist/cjs/post-accordion-item-641f0b42.js +0 -52
- package/dist/cjs/post-breadcrumb-item-8cdc59a8.js +0 -49
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +0 -15
- package/dist/cjs/post-card-control-fc4aca2a.js +0 -272
- package/dist/cjs/post-closebutton_10.cjs.entry.js +0 -25
- package/dist/cjs/post-language-option-8c1ec4fd.js +0 -68
- package/dist/cjs/post-language-option.cjs.entry.js +0 -15
- package/dist/cjs/post-menu-5a71a6fe.js +0 -176
- package/dist/cjs/post-menu-item-5c5c1aaf.js +0 -20
- package/dist/cjs/post-menu-item.cjs.entry.js +0 -11
- package/dist/cjs/post-menu-trigger-02d128c4.js +0 -75
- package/dist/cjs/post-menu-trigger.cjs.entry.js +0 -13
- package/dist/cjs/post-menu.cjs.entry.js +0 -11
- package/dist/cjs/post-togglebutton-2f39442e.js +0 -28
- package/dist/cjs/post-togglebutton.cjs.entry.js +0 -11
- package/dist/esm/package-180da9f3.js +0 -3
- package/dist/esm/post-accordion-item-a5a76abb.js +0 -50
- package/dist/esm/post-breadcrumb-item-5a77f988.js +0 -47
- package/dist/esm/post-breadcrumb-item.entry.js +0 -7
- package/dist/esm/post-card-control-5be9c80a.js +0 -270
- package/dist/esm/post-closebutton_10.entry.js +0 -8
- package/dist/esm/post-language-option-f41240c3.js +0 -66
- package/dist/esm/post-language-option.entry.js +0 -7
- package/dist/esm/post-menu-item-f63a1521.js +0 -18
- package/dist/esm/post-menu-item.entry.js +0 -3
- package/dist/esm/post-menu-trigger.entry.js +0 -5
- package/dist/esm/post-menu.entry.js +0 -3
- package/dist/esm/post-togglebutton-0e714838.js +0 -26
- package/dist/esm/post-togglebutton.entry.js +0 -3
- package/dist/post-components/p-0338f9da.js +0 -1
- package/dist/post-components/p-06980a04.js +0 -1
- package/dist/post-components/p-0af7dfbb.js +0 -1
- package/dist/post-components/p-12262945.entry.js +0 -1
- package/dist/post-components/p-2504dace.entry.js +0 -1
- package/dist/post-components/p-27343d32.entry.js +0 -1
- package/dist/post-components/p-2a456317.js +0 -1
- package/dist/post-components/p-2c3980d2.js +0 -1
- package/dist/post-components/p-31d38040.js +0 -1
- package/dist/post-components/p-339e000e.entry.js +0 -1
- package/dist/post-components/p-3b325360.entry.js +0 -1
- package/dist/post-components/p-3e65ba47.js +0 -1
- package/dist/post-components/p-3f417208.entry.js +0 -1
- package/dist/post-components/p-4922deaf.entry.js +0 -1
- package/dist/post-components/p-6c7546b8.entry.js +0 -1
- package/dist/post-components/p-7eee2b6a.js +0 -1
- package/dist/post-components/p-816623f0.entry.js +0 -1
- package/dist/post-components/p-83cd3885.entry.js +0 -1
- package/dist/post-components/p-9abe554b.js +0 -1
- package/dist/post-components/p-9ea6103e.entry.js +0 -1
- package/dist/post-components/p-a0a7c2c1.entry.js +0 -1
- package/dist/post-components/p-abf9ffdc.entry.js +0 -1
- package/dist/post-components/p-b4a2c7b7.entry.js +0 -1
- package/dist/post-components/p-b7ef401f.js +0 -1
- package/dist/post-components/p-b8a9cf2d.js +0 -1
- package/dist/post-components/p-ccd8a221.entry.js +0 -1
- package/dist/post-components/p-cfc1727f.entry.js +0 -1
- package/dist/post-components/p-d4465c2b.js +0 -1
- package/dist/post-components/p-d4cef624.js +0 -1
- package/dist/post-components/p-da449573.js +0 -1
- package/dist/post-components/p-df5bdda5.entry.js +0 -1
- package/dist/post-components/p-f1416918.entry.js +0 -1
- package/dist/post-components/p-f171b18b.entry.js +0 -1
- package/dist/post-components/p-f4dbd35f.entry.js +0 -1
- package/dist/post-components/p-f6b44820.js +0 -1
|
@@ -1,19 +1,271 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-
|
|
2
|
-
import { v as version } from './package-
|
|
3
|
-
import {
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-fb8d6be7.js';
|
|
2
|
+
import { v as version } from './package-4d81f3c2.js';
|
|
3
|
+
import { s as slideUp, a as slideDown } from './slide-3422b8a3.js';
|
|
4
|
+
import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-b49c9904.js';
|
|
4
5
|
import { c as checkNonEmpty } from './check-non-empty-58bd6b17.js';
|
|
5
6
|
import { c as checkType } from './check-type-8828dbe4.js';
|
|
7
|
+
import { g as getRoot } from './get-root-7af2e0d1.js';
|
|
6
8
|
|
|
7
9
|
const PostClosebutton = class {
|
|
8
10
|
constructor(hostRef) {
|
|
9
11
|
registerInstance(this, hostRef);
|
|
10
12
|
}
|
|
11
13
|
render() {
|
|
12
|
-
return (h(Host, { key: '
|
|
14
|
+
return (h(Host, { key: 'cb5be35247053b1227c32f7949baca51ccc31081', "data-version": version }, h("button", { key: 'b68dc109cc7a9a99b85fc995447bc7c0b0ddc3bf', class: "btn btn-icon-close" }, h("post-icon", { key: '9276c885e5b48092a0a24285ec6cd4301a4fc032', "aria-hidden": "true", name: "closex" }), h("span", { key: '3e04657ab677186830d80b8dabe769d70b6b8e8e', class: "visually-hidden" }, h("slot", { key: 'c2c9e8df9f62516a1b88b1dbc3949287fbaa3991' })))));
|
|
13
15
|
}
|
|
14
16
|
get host() { return getElement(this); }
|
|
15
17
|
};
|
|
16
18
|
|
|
19
|
+
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
23
|
+
* execution of handlers on events like resize and scroll.
|
|
24
|
+
*
|
|
25
|
+
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
26
|
+
* are most useful.
|
|
27
|
+
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
28
|
+
* as-is, to `callback` when the throttled-function is executed.
|
|
29
|
+
* @param {object} [options] - An object to configure options.
|
|
30
|
+
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
31
|
+
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
32
|
+
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
33
|
+
* `delay` milliseconds, the internal counter is reset).
|
|
34
|
+
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
35
|
+
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
36
|
+
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
37
|
+
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
38
|
+
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Function} A new, throttled, function.
|
|
41
|
+
*/
|
|
42
|
+
function throttle (delay, callback, options) {
|
|
43
|
+
var _ref = options || {},
|
|
44
|
+
_ref$noTrailing = _ref.noTrailing,
|
|
45
|
+
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
46
|
+
_ref$noLeading = _ref.noLeading,
|
|
47
|
+
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
48
|
+
_ref$debounceMode = _ref.debounceMode,
|
|
49
|
+
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
50
|
+
/*
|
|
51
|
+
* After wrapper has stopped being called, this timeout ensures that
|
|
52
|
+
* `callback` is executed at the proper times in `throttle` and `end`
|
|
53
|
+
* debounce modes.
|
|
54
|
+
*/
|
|
55
|
+
var timeoutID;
|
|
56
|
+
var cancelled = false;
|
|
57
|
+
|
|
58
|
+
// Keep track of the last time `callback` was executed.
|
|
59
|
+
var lastExec = 0;
|
|
60
|
+
|
|
61
|
+
// Function to clear existing timeout
|
|
62
|
+
function clearExistingTimeout() {
|
|
63
|
+
if (timeoutID) {
|
|
64
|
+
clearTimeout(timeoutID);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Function to cancel next exec
|
|
69
|
+
function cancel(options) {
|
|
70
|
+
var _ref2 = options || {},
|
|
71
|
+
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
72
|
+
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
73
|
+
clearExistingTimeout();
|
|
74
|
+
cancelled = !upcomingOnly;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
79
|
+
* functionality and when executed will limit the rate at which `callback`
|
|
80
|
+
* is executed.
|
|
81
|
+
*/
|
|
82
|
+
function wrapper() {
|
|
83
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
84
|
+
arguments_[_key] = arguments[_key];
|
|
85
|
+
}
|
|
86
|
+
var self = this;
|
|
87
|
+
var elapsed = Date.now() - lastExec;
|
|
88
|
+
if (cancelled) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Execute `callback` and update the `lastExec` timestamp.
|
|
93
|
+
function exec() {
|
|
94
|
+
lastExec = Date.now();
|
|
95
|
+
callback.apply(self, arguments_);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
100
|
+
* to allow future `callback` executions.
|
|
101
|
+
*/
|
|
102
|
+
function clear() {
|
|
103
|
+
timeoutID = undefined;
|
|
104
|
+
}
|
|
105
|
+
if (!noLeading && debounceMode && !timeoutID) {
|
|
106
|
+
/*
|
|
107
|
+
* Since `wrapper` is being called for the first time and
|
|
108
|
+
* `debounceMode` is true (at begin), execute `callback`
|
|
109
|
+
* and noLeading != true.
|
|
110
|
+
*/
|
|
111
|
+
exec();
|
|
112
|
+
}
|
|
113
|
+
clearExistingTimeout();
|
|
114
|
+
if (debounceMode === undefined && elapsed > delay) {
|
|
115
|
+
if (noLeading) {
|
|
116
|
+
/*
|
|
117
|
+
* In throttle mode with noLeading, if `delay` time has
|
|
118
|
+
* been exceeded, update `lastExec` and schedule `callback`
|
|
119
|
+
* to execute after `delay` ms.
|
|
120
|
+
*/
|
|
121
|
+
lastExec = Date.now();
|
|
122
|
+
if (!noTrailing) {
|
|
123
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
/*
|
|
127
|
+
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
128
|
+
* `callback`.
|
|
129
|
+
*/
|
|
130
|
+
exec();
|
|
131
|
+
}
|
|
132
|
+
} else if (noTrailing !== true) {
|
|
133
|
+
/*
|
|
134
|
+
* In trailing throttle mode, since `delay` time has not been
|
|
135
|
+
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
136
|
+
* recent execution.
|
|
137
|
+
*
|
|
138
|
+
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
139
|
+
* after `delay` ms.
|
|
140
|
+
*
|
|
141
|
+
* If `debounceMode` is false (at end), schedule `callback` to
|
|
142
|
+
* execute after `delay` ms.
|
|
143
|
+
*/
|
|
144
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
wrapper.cancel = cancel;
|
|
148
|
+
|
|
149
|
+
// Return the wrapper function.
|
|
150
|
+
return wrapper;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--global-header-minimal-height:24px;--main-header-height:56px;--header-height:calc(var(--global-header-height) + var(--main-header-height))}@media screen and (min-width: 1024px){:host{display:block;position:sticky;inset-inline:0;inset-block-start:calc(-1*(var(--global-header-height) + var(--main-header-height) - var(--global-header-minimal-height)));box-shadow:var(--post-core-elevation-3)}}@media screen and (max-width: 1023.99px){:host{--global-header-height:64px;--main-header-height:48px}}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;align-items:center;position:sticky;padding-inline:var(--post-core-dimension-4);height:var(--global-header-height);z-index:1}@media screen and (max-width: 1023.99px){.global-header{inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{padding-inline-end:var(--post-core-dimension-12);top:calc((var(--global-header-height) - var(--global-header-minimal-height))*-1)}}slot[name=post-logo]{align-self:flex-end}.global-sub{display:flex;align-items:center;gap:var(--post-core-dimension-24);height:var(--global-header-height)}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-minimal-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem}.title-header{display:flex;align-items:center;gap:var(--post-core-dimension-4);height:var(--main-header-height);background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.title-header{padding:var(--post-core-dimension-18) var(--post-core-dimension-16) var(--post-core-dimension-4) var(--post-core-dimension-12)}}@media screen and (max-width: 1023.99px){.title-header{position:sticky;z-index:1;inset-block-start:var(--global-header-height);padding-inline:var(--post-core-dimension-8) var(--post-core-dimension-16)}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important}@media screen and (min-width: 1024px){::slotted(h1){font-size:var(--post-core-font-size-28) !important}}@media screen and (max-width: 1023.99px){::slotted(h1){font-size:var(--post-core-font-size-20) !important}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.navigation{position:sticky;z-index:1;inset-block-start:var(--global-header-minimal-height)}}@media screen and (max-width: 1023.99px){.navigation{position:fixed;inset-inline:0;inset-block-end:calc(100vh - var(--header-height));box-shadow:var(--post-core-elevation-3);min-height:var(--post-core-dimension-10);max-height:calc(100vh - var(--header-height));overflow:auto}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:var(--post-core-dimension-16) var(--post-core-dimension-24);padding-inline:var(--post-core-dimension-32)}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}::slotted(post-mainnavigation){background-color:var(--post-core-color-sandgrey-002);gap:var(--post-core-dimension-32)}.navigation-footer{background-color:var(--post-core-color-sandgrey-006);gap:var(--post-core-dimension-24)}}";
|
|
154
|
+
const PostHeaderStyle0 = postHeaderCss;
|
|
155
|
+
|
|
156
|
+
const PostHeader = class {
|
|
157
|
+
constructor(hostRef) {
|
|
158
|
+
registerInstance(this, hostRef);
|
|
159
|
+
this.scrollParent = null;
|
|
160
|
+
this.throttledScroll = () => this.handleScrollEvent();
|
|
161
|
+
this.throttledResize = throttle(50, () => this.handleResize());
|
|
162
|
+
this.device = null;
|
|
163
|
+
this.mobileMenuExtended = false;
|
|
164
|
+
}
|
|
165
|
+
componentWillRender() {
|
|
166
|
+
this.scrollParent = this.getScrollParent(this.host);
|
|
167
|
+
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
168
|
+
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
169
|
+
this.handleResize();
|
|
170
|
+
this.handleScrollEvent();
|
|
171
|
+
}
|
|
172
|
+
frozeBody(isMobileMenuExtended) {
|
|
173
|
+
document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Toggles the mobile navigation.
|
|
177
|
+
*/
|
|
178
|
+
async toggleMobileMenu() {
|
|
179
|
+
if (this.device === 'desktop')
|
|
180
|
+
return;
|
|
181
|
+
this.mobileMenuAnimation = this.mobileMenuExtended
|
|
182
|
+
? slideUp(this.mobileMenu)
|
|
183
|
+
: slideDown(this.mobileMenu);
|
|
184
|
+
// Update the state of the toggle button
|
|
185
|
+
const menuButton = this.host.querySelector('post-togglebutton');
|
|
186
|
+
menuButton.toggled = !this.mobileMenuExtended;
|
|
187
|
+
// Toggle menu visibility before it slides down and after it slides back up
|
|
188
|
+
if (this.mobileMenuExtended)
|
|
189
|
+
await this.mobileMenuAnimation.finished;
|
|
190
|
+
this.mobileMenuExtended = !this.mobileMenuExtended;
|
|
191
|
+
if (!this.mobileMenuExtended)
|
|
192
|
+
await this.mobileMenuAnimation.finished;
|
|
193
|
+
}
|
|
194
|
+
handleScrollEvent() {
|
|
195
|
+
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
196
|
+
const st = Math.max(0, this.scrollParent instanceof Document
|
|
197
|
+
? this.scrollParent.documentElement.scrollTop
|
|
198
|
+
: this.scrollParent.scrollTop);
|
|
199
|
+
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
200
|
+
}
|
|
201
|
+
getScrollParent(node) {
|
|
202
|
+
let currentParent = node.parentElement;
|
|
203
|
+
while (currentParent) {
|
|
204
|
+
if (currentParent.nodeName === 'BODY') {
|
|
205
|
+
return document;
|
|
206
|
+
}
|
|
207
|
+
if (this.isScrollable(currentParent)) {
|
|
208
|
+
return currentParent;
|
|
209
|
+
}
|
|
210
|
+
currentParent = currentParent.parentElement;
|
|
211
|
+
}
|
|
212
|
+
return document;
|
|
213
|
+
}
|
|
214
|
+
isScrollable(node) {
|
|
215
|
+
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
const style = getComputedStyle(node);
|
|
219
|
+
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
220
|
+
const value = style.getPropertyValue(propertyName);
|
|
221
|
+
return value === 'auto' || value === 'scroll';
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
handleResize() {
|
|
225
|
+
const previousDevice = this.device;
|
|
226
|
+
let newDevice;
|
|
227
|
+
const width = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
228
|
+
if (width >= 1024) {
|
|
229
|
+
newDevice = 'desktop';
|
|
230
|
+
}
|
|
231
|
+
else if (width >= 600) {
|
|
232
|
+
newDevice = 'tablet';
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
newDevice = 'mobile';
|
|
236
|
+
}
|
|
237
|
+
// Close any open mobile menu
|
|
238
|
+
if (newDevice === 'desktop' && this.mobileMenuExtended) {
|
|
239
|
+
this.toggleMobileMenu();
|
|
240
|
+
this.mobileMenuAnimation.finish(); // no animation
|
|
241
|
+
}
|
|
242
|
+
// Apply only on change for doing work only when necessary
|
|
243
|
+
if (newDevice !== previousDevice) {
|
|
244
|
+
this.device = newDevice;
|
|
245
|
+
window.requestAnimationFrame(() => {
|
|
246
|
+
this.switchLanguageSwitchMode();
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
switchLanguageSwitchMode() {
|
|
251
|
+
var _a;
|
|
252
|
+
const variant = this.device === 'desktop' ? 'dropdown' : 'list';
|
|
253
|
+
(_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
|
|
254
|
+
}
|
|
255
|
+
render() {
|
|
256
|
+
const navigationClasses = ['navigation'];
|
|
257
|
+
if (this.mobileMenuExtended) {
|
|
258
|
+
navigationClasses.push('extended');
|
|
259
|
+
}
|
|
260
|
+
return (h(Host, { key: 'd96b46b64946ef425059463d127fa1188c99ea58', version: version }, h("div", { key: '831ebc53d0f598a99e72d46a1530c2c34c196948', class: "global-header" }, h("div", { key: '69f3b3bc47a61810eea3ae60d7b2423af1750416', class: "global-sub" }, h("div", { key: 'ad6d36c7e7f029edfdee223ab1df664a1b7002f8', class: "logo" }, h("slot", { key: '95adfc2ad9e63fde9eef3cc71b63247e140fba3d', name: "post-logo" }))), h("div", { key: '741e62693a4df8558213c85d7a837efb8b0cfa6d', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '992844b617955cb77079a175fcaaf54943a6eef2', name: "meta-navigation" }), h("slot", { key: '4384ae4c04d239bf1b1947ba6d1457ae6879a5cf', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'c5b33b6bfb8c00d44710ec997a80d56720aab760', name: "post-language-switch" }), h("div", { key: '25a629a419c94fc4789eb374b87cf7c159b746c6', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '3f3078832237abc5a6df79b4a57fe20fae926aa3', name: "post-togglebutton" })))), h("div", { key: 'e11ca83bc108d4677e849b7386ad7bd09d8c9331', class: "title-header d-flex space-between align-center" }, h("slot", { key: '87430ad15ab09f800b714be45be00a50e5b7dc0a', name: "title" }), h("div", { key: '494a198d3ee8185a26b16fce97a85bed01d6b3f7', class: "global-sub" }, h("slot", { key: '8a54e3d1366d39c11d64c0de90f35a4330836428', name: "local-controls" }), h("slot", { key: '63f841457e0f7b7722a3f8b1ea83ff0d78d9c08e' }))), h("div", { key: '90cf667c412d90f8e466e7e7925fa4a2f8223ad8', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { key: 'a046286cb6cc770bfb8fb4439cdacac7c351001b', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { key: '6e0ad5841ef53daf0c0885b75efdf12d69f4a72d', class: "navigation-footer" }, h("slot", { key: '1eaebace0d5e37794867ae2a317a104726bb873a', name: "meta-navigation" }), h("slot", { key: '79217cd6fd16d4c6ef3e8aaa656e6dc0a8842b23', name: "post-language-switch" }))))));
|
|
261
|
+
}
|
|
262
|
+
get host() { return getElement(this); }
|
|
263
|
+
static get watchers() { return {
|
|
264
|
+
"mobileMenuExtended": ["frozeBody"]
|
|
265
|
+
}; }
|
|
266
|
+
};
|
|
267
|
+
PostHeader.style = PostHeaderStyle0;
|
|
268
|
+
|
|
17
269
|
const postIconCss = ":host{container-name:post-icon;container-type:inline-size;display:inline-block;width:1em;height:1em;vertical-align:-0.15em}svg{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color}@container post-icon (max-width: 23.98px){svg{--pis-16: block}}@container post-icon (min-width: 24px) and (max-width: 31.98px){svg{--pis-24: block}}@container post-icon (min-width: 32px) and (max-width: 39.98px){svg{--pis-32: block}}@container post-icon (min-width: 40px) and (max-width: 47.98px){svg{--pis-40: block}}@container post-icon (min-width: 48px) and (max-width: 63.98px){svg{--pis-48: block}}@container post-icon (min-width: 64px){svg{--pis-64: block}}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
|
|
18
270
|
const PostIconStyle0 = postIconCss;
|
|
19
271
|
|
|
@@ -90,7 +342,7 @@ const PostIcon = class {
|
|
|
90
342
|
this.validateAnimation();
|
|
91
343
|
}
|
|
92
344
|
render() {
|
|
93
|
-
return (h(Host, { key: '
|
|
345
|
+
return (h(Host, { key: '7864661c5ba45508fa3902c49fd0da1d6c026795', "data-version": version }, h("svg", { key: '588f70bd81afc4cc5a312388aa6225bc9c853b57', style: this.getStyles() }, h("use", { key: 'c4505cf12ddf083ad86b3b9304ffbf37ac3489d1', href: this.getPath() }))));
|
|
94
346
|
}
|
|
95
347
|
get host() { return getElement(this); }
|
|
96
348
|
static get watchers() { return {
|
|
@@ -105,59 +357,671 @@ const PostIcon = class {
|
|
|
105
357
|
};
|
|
106
358
|
PostIcon.style = PostIconStyle0;
|
|
107
359
|
|
|
108
|
-
const
|
|
109
|
-
const
|
|
360
|
+
const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:inline-block;width:fit-content}button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}a{color:inherit;text-decoration:none}:is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;height:100%;width:100%;padding:var(--post-language-option-padding)}.post-language-option-list{border-radius:2px;width:40px;height:40px}.post-language-option-list{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-list: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-list:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-option-list: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-list:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-option-list[aria-current=true],.post-language-option-list[aria-current=page]{background-color:#050400;color:#fff}.post-language-option-dropdown{padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative}.post-language-option-dropdown[aria-current=true]::after,.post-language-option-dropdown[aria-current=page]::after{content:\"\";left:-2px;height:3px;background-color:#504f4b;width:calc(100% + 4px);display:block;position:absolute;bottom:3px}.post-language-option-dropdown[aria-current=true]:focus::after,.post-language-option-dropdown[aria-current=page]:focus::after{width:calc(100% - 5px);left:2px}";
|
|
361
|
+
const PostLanguageOptionStyle0 = postLanguageOptionCss;
|
|
110
362
|
|
|
111
|
-
const
|
|
363
|
+
const PostLanguageOption = class {
|
|
112
364
|
constructor(hostRef) {
|
|
113
365
|
registerInstance(this, hostRef);
|
|
366
|
+
this.postChange = createEvent(this, "postChange", 7);
|
|
367
|
+
this.code = undefined;
|
|
368
|
+
this.active = undefined;
|
|
369
|
+
this.variant = undefined;
|
|
370
|
+
this.name = undefined;
|
|
114
371
|
this.url = undefined;
|
|
115
372
|
}
|
|
116
|
-
|
|
117
|
-
|
|
373
|
+
validateCode(value = this.code) {
|
|
374
|
+
checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
|
|
375
|
+
}
|
|
376
|
+
validateActiveProp(value = this.active) {
|
|
377
|
+
checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
|
|
378
|
+
}
|
|
379
|
+
validateName(value = this.name) {
|
|
380
|
+
checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
|
|
381
|
+
}
|
|
382
|
+
validateUrl(value = this.url) {
|
|
383
|
+
checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
|
|
118
384
|
}
|
|
119
385
|
componentDidLoad() {
|
|
386
|
+
this.validateCode();
|
|
387
|
+
this.validateActiveProp();
|
|
388
|
+
this.validateName();
|
|
120
389
|
this.validateUrl();
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
checkDescription() {
|
|
124
|
-
if (!this.host.textContent) {
|
|
125
|
-
console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
|
|
390
|
+
if (!this.name && this.isNameRequired()) {
|
|
391
|
+
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
126
392
|
}
|
|
127
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Selects the language option programmatically.
|
|
396
|
+
*/
|
|
397
|
+
async select() {
|
|
398
|
+
this.active = true;
|
|
399
|
+
this.emitChange();
|
|
400
|
+
}
|
|
401
|
+
emitChange() {
|
|
402
|
+
this.postChange.emit(this.code);
|
|
403
|
+
}
|
|
404
|
+
isNameRequired() {
|
|
405
|
+
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
406
|
+
}
|
|
128
407
|
render() {
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
return (h(Host, { key: 'd3dd408c30b4e22712b9a293906c7334e7d1852b', "data-version": version, slot: "post-logo" }, h(LogoTag, Object.assign({ key: '4eb08a4d1b4a0ec2557b63678225a16d287c692c', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: 'ab3b1a8da4a7b87aa0a020d47586a7018619e9c3', class: "description" }, h("slot", { key: 'a9c39b1f2f54fd4ceb79a82ab30571c161a29adb', onSlotchange: () => this.checkDescription() })), h("svg", { key: 'af4c3fbdb2a72e0b8518a6c16cefdb795f41244c', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: '05e25c1522dd4edfc676b04cf9092ed519d95381', id: "Logo" }, h("rect", { key: '12e1b7878e990e110c8ae83ef742bb6fa4c48a2f', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '0e1120c70769c4a23b3711c1157e6f1742e3a75b', 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: 'ccc271be1919898fc6eed78bf2e012e71dd96c48', 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" }))))));
|
|
408
|
+
const lang = this.code.toLowerCase();
|
|
409
|
+
return (h(Host, { key: '9a3f49ee993b69393ea8f81b671cd5482049ff1c', "data-version": version, role: "listitem" }, this.url ? (h("a", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange() }, h("slot", null))) : (h("button", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange() }, h("slot", null)))));
|
|
132
410
|
}
|
|
133
411
|
get host() { return getElement(this); }
|
|
134
412
|
static get watchers() { return {
|
|
413
|
+
"code": ["validateCode"],
|
|
414
|
+
"active": ["validateActiveProp"],
|
|
415
|
+
"name": ["validateName"],
|
|
135
416
|
"url": ["validateUrl"]
|
|
136
417
|
}; }
|
|
137
418
|
};
|
|
138
|
-
|
|
419
|
+
PostLanguageOption.style = PostLanguageOptionStyle0;
|
|
139
420
|
|
|
140
|
-
|
|
141
|
-
* Custom positioning reference element.
|
|
142
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
143
|
-
*/
|
|
421
|
+
const SWITCH_VARIANTS = ['list', 'dropdown'];
|
|
144
422
|
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
423
|
+
const urlAlphabet =
|
|
424
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
425
|
+
|
|
426
|
+
let nanoid = (size = 21) => {
|
|
427
|
+
let id = '';
|
|
428
|
+
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
|
|
429
|
+
while (size--) {
|
|
430
|
+
id += urlAlphabet[bytes[size] & 63];
|
|
431
|
+
}
|
|
432
|
+
return id
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
const postLanguageSwitchCss = ":host{display:block}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:var(--post-core-dimension-6);border-radius:var(--post-core-dimension-24);font-size:var(--post-core-font-size-16);padding:var(--post-core-dimension-3) var(--post-core-dimension-10)}.post-language-switch-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:var(--post-core-dimension-16);width:var(--post-core-dimension-16)}";
|
|
436
|
+
const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
|
|
437
|
+
|
|
438
|
+
const PostLanguageSwitch = class {
|
|
439
|
+
constructor(hostRef) {
|
|
440
|
+
registerInstance(this, hostRef);
|
|
441
|
+
this.menuId = `p${nanoid(11)}`;
|
|
442
|
+
this.caption = undefined;
|
|
443
|
+
this.description = undefined;
|
|
444
|
+
this.variant = 'list';
|
|
445
|
+
this.activeLang = undefined;
|
|
446
|
+
}
|
|
447
|
+
validateCaption(value = this.caption) {
|
|
448
|
+
checkType(value, 'string', 'The "caption" property of the post-language-switch component must be a string.');
|
|
449
|
+
}
|
|
450
|
+
validateDescription(value = this.description) {
|
|
451
|
+
checkType(value, 'string', 'The "description" property of the post-language-switch component must be a string.');
|
|
452
|
+
}
|
|
453
|
+
validateVariant(value = this.variant) {
|
|
454
|
+
checkEmptyOrOneOf(value, SWITCH_VARIANTS, `The "variant" property of the post-language-switch component must be: ${SWITCH_VARIANTS.join(', ')}`);
|
|
455
|
+
}
|
|
456
|
+
connectedCallback() {
|
|
457
|
+
this.updateChildrenVariant();
|
|
458
|
+
// Get the active language based on children's active state
|
|
459
|
+
this.activeLang = Array.from(this.host.querySelectorAll('post-language-option'))
|
|
460
|
+
.find(el => el.getAttribute('active') == 'true')
|
|
461
|
+
.getAttribute('code');
|
|
462
|
+
}
|
|
463
|
+
// Update post-language-option variant to have the correct style
|
|
464
|
+
updateChildrenVariant() {
|
|
465
|
+
this.host.querySelectorAll('post-language-option').forEach(el => {
|
|
466
|
+
el.setAttribute('variant', this.variant);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
componentShouldUpdate() {
|
|
470
|
+
this.updateChildrenVariant();
|
|
471
|
+
}
|
|
472
|
+
componentDidLoad() {
|
|
473
|
+
this.validateCaption();
|
|
474
|
+
this.validateDescription();
|
|
475
|
+
this.validateVariant();
|
|
476
|
+
// Detects a change in the active language
|
|
477
|
+
this.host.addEventListener('postChange', (el) => {
|
|
478
|
+
this.activeLang = el.detail;
|
|
479
|
+
// Update the active state in the children post-language-option components
|
|
480
|
+
this.host.querySelectorAll('post-language-option').forEach(lang => {
|
|
481
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
482
|
+
lang.setAttribute('active', 'true');
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
lang.setAttribute('active', 'false');
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
// Hides the dropdown when an option has been clicked
|
|
489
|
+
if (this.variant === 'dropdown') {
|
|
490
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
491
|
+
menu.toggle(menu);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
renderList() {
|
|
496
|
+
return (h(Host, { "data-version": version, "aria-label": `${this.caption}, ${this.description}`, "aria-role": "list" }, h("slot", null)));
|
|
497
|
+
}
|
|
498
|
+
renderDropdown() {
|
|
499
|
+
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": `${this.caption}, ${this.description}` }, this.activeLang.toUpperCase(), h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId }, h("div", { class: "post-language-switch-dropdown-container" }, h("slot", null)))));
|
|
500
|
+
}
|
|
501
|
+
render() {
|
|
502
|
+
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
503
|
+
}
|
|
504
|
+
get host() { return getElement(this); }
|
|
505
|
+
static get watchers() { return {
|
|
506
|
+
"caption": ["validateCaption"],
|
|
507
|
+
"description": ["validateDescription"],
|
|
508
|
+
"variant": ["validateVariant"]
|
|
509
|
+
}; }
|
|
510
|
+
};
|
|
511
|
+
PostLanguageSwitch.style = PostLanguageSwitchStyle0;
|
|
512
|
+
|
|
513
|
+
const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */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}";
|
|
514
|
+
const PostListStyle0 = postListCss;
|
|
515
|
+
|
|
516
|
+
const PostList = class {
|
|
517
|
+
constructor(hostRef) {
|
|
518
|
+
registerInstance(this, hostRef);
|
|
519
|
+
this.titleId = undefined;
|
|
520
|
+
this.titleHidden = false;
|
|
521
|
+
this.horizontal = false;
|
|
522
|
+
}
|
|
523
|
+
componentWillLoad() {
|
|
524
|
+
/**
|
|
525
|
+
* Get the id set on the host element or use a random id by default
|
|
526
|
+
*/
|
|
527
|
+
this.titleId = `title-${this.host.id || crypto.randomUUID()}`;
|
|
528
|
+
}
|
|
529
|
+
componentDidLoad() {
|
|
530
|
+
this.checkTitle();
|
|
531
|
+
}
|
|
532
|
+
checkTitle() {
|
|
533
|
+
if (!this.titleEl.textContent.trim()) {
|
|
534
|
+
throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
render() {
|
|
538
|
+
return (h(Host, { key: '4f982e717530514589c5528553b70463d678b676', "data-version": version }, h("div", { key: 'cc65ed208f48e7a22482af96fd069d05363f2617', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: '0f8bbeade50b59e53767ce2169dd57bb79644705' })), h("div", { key: '7fa5de37a169e6f76928c2088c46ee747427887e', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: '86b4d71b83671babb61dd12e842710d67350a09e', name: "post-list-item" }))));
|
|
539
|
+
}
|
|
540
|
+
get host() { return getElement(this); }
|
|
541
|
+
};
|
|
542
|
+
PostList.style = PostListStyle0;
|
|
543
|
+
|
|
544
|
+
const postListItemCss = ":host{display:flex}";
|
|
545
|
+
const PostListItemStyle0 = postListItemCss;
|
|
546
|
+
|
|
547
|
+
const PostListItem = class {
|
|
548
|
+
constructor(hostRef) {
|
|
549
|
+
registerInstance(this, hostRef);
|
|
550
|
+
}
|
|
551
|
+
connectedCallback() {
|
|
552
|
+
this.host.setAttribute('slot', 'post-list-item');
|
|
553
|
+
}
|
|
554
|
+
render() {
|
|
555
|
+
return (h(Host, { key: 'aa9a31c64e3e8ba5dcac1d03b54ab3c886149c1f', role: "listitem", slot: "post-list-item" }, h("slot", { key: '06353140f8917fc5373de6d56708467af2ef52b2' })));
|
|
556
|
+
}
|
|
557
|
+
get host() { return getElement(this); }
|
|
558
|
+
};
|
|
559
|
+
PostListItem.style = PostListItemStyle0;
|
|
560
|
+
|
|
561
|
+
const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
|
|
562
|
+
const PostLogoStyle0 = postLogoCss;
|
|
563
|
+
|
|
564
|
+
const PostLogo = class {
|
|
565
|
+
constructor(hostRef) {
|
|
566
|
+
registerInstance(this, hostRef);
|
|
567
|
+
this.url = undefined;
|
|
568
|
+
}
|
|
569
|
+
validateUrl() {
|
|
570
|
+
checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
|
|
571
|
+
}
|
|
572
|
+
componentDidLoad() {
|
|
573
|
+
this.validateUrl();
|
|
574
|
+
this.checkDescription();
|
|
575
|
+
}
|
|
576
|
+
checkDescription() {
|
|
577
|
+
if (!this.host.textContent) {
|
|
578
|
+
console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
render() {
|
|
582
|
+
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
583
|
+
const LogoTag = logoLink ? 'a' : 'span';
|
|
584
|
+
return (h(Host, { key: 'b8d47e2530eb39f7b05370b4cea0b728cb00a1fb', "data-version": version, slot: "post-logo" }, h(LogoTag, Object.assign({ key: '47a4d88622aab30e652a08827e221dacda36cb48', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: '4eb6ad1bc6c165197b6bcce8fe1146eb9d48fb21', class: "description" }, h("slot", { key: 'c66a4385f19711daab6f4ba87d5f78f59ad8b263', onSlotchange: () => this.checkDescription() })), h("svg", { key: '824643e64a3fb0914082f8f78a11753d66c98842', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'e4f63d237c1fe1128005f29ea604c865f6b50943', id: "Logo" }, h("rect", { key: '34fec89177fb5461318d3e8fcc725f32dd97057a', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '5600de7c21a8e363fffa35710a3f41e4295b76c7', 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: '719be82825355704c4eac3c60fb461f6303734f7', 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" }))))));
|
|
585
|
+
}
|
|
586
|
+
get host() { return getElement(this); }
|
|
587
|
+
static get watchers() { return {
|
|
588
|
+
"url": ["validateUrl"]
|
|
589
|
+
}; }
|
|
590
|
+
};
|
|
591
|
+
PostLogo.style = PostLogoStyle0;
|
|
592
|
+
|
|
593
|
+
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:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button: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>button:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:var(--post-core-dimension-4);z-index:1}@media screen and (min-width: 1024px){post-mainnavigation nav{position:relative;max-width:100vw;max-height:var(--post-core-dimension-56);user-select:none}post-mainnavigation post-list{margin-inline:var(--post-core-dimension-4)}post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw;transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline:var(--post-core-dimension-12);height:var(--post-core-dimension-56);gap:var(--post-core-dimension-4);font-size:var(--post-core-font-size-16);border-block:0 solid rgba(0,0,0,0);border-block-end-color:currentColor}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{border-block-width:var(--post-core-dimension-2)}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]{border-block-width:var(--post-core-dimension-4);font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:var(--post-core-dimension-12);transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{content:\"\";-webkit-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\");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:var(--post-core-dimension-24);width:var(--post-core-dimension-24);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)}post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.99px){post-mainnavigation post-list>[role=list]{transform:none !important}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;height:var(--post-core-dimension-48);padding-inline-end:var(--post-core-dimension-6);gap:var(--post-core-dimension-16);border-block:var(--post-core-dimension-1) solid rgba(0,0,0,0);border-block-end-color:currentColor;font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button.selected{border-block-width:var(--post-core-dimension-3)}post-mainnavigation post-list-item>a:hover::after,post-mainnavigation post-list-item>button:hover::after,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::after{content:\"\";display:block;-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;width:var(--post-core-dimension-24);height:var(--post-core-dimension-24)}}";
|
|
594
|
+
const PostMainnavigationStyle0 = postMainnavigationCss;
|
|
595
|
+
|
|
596
|
+
const PostMainnavigation = class {
|
|
597
|
+
constructor(hostRef) {
|
|
598
|
+
registerInstance(this, hostRef);
|
|
599
|
+
this.postToggle = createEvent(this, "postToggle", 7);
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
|
|
603
|
+
*/
|
|
604
|
+
connectedCallback() {
|
|
605
|
+
this.header = this.host.closest('post-header');
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
|
|
609
|
+
*/
|
|
610
|
+
disconnectedCallback() {
|
|
611
|
+
this.header = null;
|
|
612
|
+
}
|
|
613
|
+
handleBackButtonClick() {
|
|
614
|
+
if (this.header)
|
|
615
|
+
this.header.toggleMobileMenu();
|
|
616
|
+
}
|
|
617
|
+
render() {
|
|
618
|
+
return (h(Host, { key: 'f21c438ac0bbcb08e08fd419589bf92b7d8b3a61', slot: "post-mainnavigation" }, h("div", { key: '1925f47932d7e842e8b9f059d7ade955c577fa50', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: 'fe18f6859a6d79c7ae701b65a31be1eab9c8b2ac', name: "back-button" })), h("nav", { key: 'ad2b0a52bc0bcf78a3c3340ba163ee6167be2c73' }, h("slot", { key: '8fc7b01cc0f3729cd2c12c4967ec87891fe0dcf5' }))));
|
|
619
|
+
}
|
|
620
|
+
get host() { return getElement(this); }
|
|
621
|
+
};
|
|
622
|
+
PostMainnavigation.style = PostMainnavigationStyle0;
|
|
623
|
+
|
|
624
|
+
const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}*,::before,::after{box-sizing:border-box}post-popovercontainer{--post-global-header-height:72px;--post-main-header-height:56px;--post-header-height:calc(var(--post-global-header-height) + var(--post-main-header-height));background-color:#fafafa;border:none;border-top:1px solid #e1e0dc;width:100%;border-radius:0;box-shadow:0 8px 6px rgba(0,0,0,.16)}@media screen and (max-width: 1023.99px){post-popovercontainer{--post-global-header-height:64px;position:absolute;top:var(--post-header-height) !important;bottom:0;left:0;width:100%;height:auto}post-popovercontainer.slide-in{animation:slide-in;animation-duration:350ms;animation-fill-mode:forwards}post-popovercontainer.slide-out{animation:slide-out;animation-duration:350ms;animation-fill-mode:forwards}}.megadropdown{padding:31px 40px 40px}@media screen and (max-width: 1023.99px){.megadropdown{padding:16px 32px 24px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.99px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.99px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-top:0;margin-bottom:8px;font-weight:900}.megadropdown h2 a{text-decoration:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown h2{display:block;font-size:20px}}.megadropdown a:hover{border-block-width:0}.megadropdown a:hover::after{content:unset}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;border-bottom:1px solid #050400;padding:15px 12px 14px 0;display:block;font-weight:900}.megadropdown post-list .list-title h3 a{text-decoration:none;width:100%;font-size:inherit;display:inline-block;font-weight:inherit;height:unset;padding:0;border:0}@media screen and (max-width: 1023.99px){.megadropdown post-list .list-title h3{font-size:16px;padding:12px 12px 11px 0}}.megadropdown post-list-item{border-bottom:1px solid #050400}.megadropdown post-list-item>a{padding:13px 12px 12px 0;display:block;text-decoration:none;width:100%;border-bottom:0;height:auto;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown post-list-item>a{padding:12px 12px 11px 0}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}.megadropdown .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.99px){.megadropdown .back-button{display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.99px){.megadropdown .close-button{display:none}}";
|
|
625
|
+
const PostMegadropdownStyle0 = postMegadropdownCss;
|
|
626
|
+
|
|
627
|
+
const PostMegadropdown = class {
|
|
628
|
+
constructor(hostRef) {
|
|
629
|
+
registerInstance(this, hostRef);
|
|
630
|
+
this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown", 7);
|
|
631
|
+
this.isVisible = false;
|
|
632
|
+
this.animationClass = null;
|
|
633
|
+
}
|
|
634
|
+
componentDidLoad() {
|
|
635
|
+
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
636
|
+
this.isVisible = event.detail;
|
|
637
|
+
this.postToggleMegadropdown.emit(this.isVisible);
|
|
638
|
+
});
|
|
639
|
+
this.popoverRef.addEventListener('animationend', () => {
|
|
640
|
+
if (this.animationClass === 'slide-out') {
|
|
641
|
+
this.hide();
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Toggles the dropdown visibility based on its current state.
|
|
647
|
+
*/
|
|
648
|
+
async toggle(target) {
|
|
649
|
+
this.isVisible ? this.hide() : await this.show(target);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Displays the popover dropdown
|
|
653
|
+
*
|
|
654
|
+
* @param target - The HTML element relative to which the popover dropdown should be displayed.
|
|
655
|
+
*/
|
|
656
|
+
async show(target) {
|
|
657
|
+
if (this.popoverRef) {
|
|
658
|
+
await this.popoverRef.show(target);
|
|
659
|
+
this.animationClass = 'slide-in';
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
console.error('show: popoverRef is null or undefined');
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Hides the popover dropdown
|
|
667
|
+
*/
|
|
668
|
+
hide() {
|
|
669
|
+
if (this.popoverRef) {
|
|
670
|
+
this.popoverRef.hide();
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
console.error('hide: popoverRef is null or undefined');
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
handleBackButtonClick() {
|
|
677
|
+
this.animationClass = 'slide-out';
|
|
678
|
+
}
|
|
679
|
+
handleCloseButtonClick() {
|
|
680
|
+
this.popoverRef.hide();
|
|
681
|
+
}
|
|
682
|
+
render() {
|
|
683
|
+
return (h(Host, { key: 'cfd4e6c7bb87c50e471d304a4b4f086266e1c2fe' }, h("post-popovercontainer", { key: '31dc3a5e98a5c60a4db8d47375491a6f3957af0b', class: this.animationClass, placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, h("div", { key: '7001d0e108544a0244af088be0bde49f90a3dea3', class: "megadropdown" }, h("div", { key: '513b0710163e8f58677b6b50d2ba2d241cf9ff35', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '5457c0b9bfff045f39f470e600b5aa31036c0807', name: "back-button" })), h("div", { key: 'c3314a4ae4f386224a2db7fe32203f72f6a1b284', onClick: () => this.handleCloseButtonClick(), class: "close-button" }, h("slot", { key: '8feeec24fe5f2522ba1a54ab0b7c682d3a152086', name: "close-button" })), h("slot", { key: '6d9426756a809ed26045c9cd56cacf0f36aa9400', name: "megadropdown-title" }), h("div", { key: 'fd3b0ac7998eec76700ccc6668d8b2e3fcc4c63a', class: "megadropdown-content" }, h("slot", { key: '23638936fdffa224de9631bfd599c0872202a30d' }))))));
|
|
684
|
+
}
|
|
685
|
+
get host() { return getElement(this); }
|
|
686
|
+
};
|
|
687
|
+
PostMegadropdown.style = PostMegadropdownStyle0;
|
|
688
|
+
|
|
689
|
+
const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%}";
|
|
690
|
+
const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
|
|
691
|
+
|
|
692
|
+
const PostMegadropdownTrigger = class {
|
|
693
|
+
constructor(hostRef) {
|
|
694
|
+
registerInstance(this, hostRef);
|
|
695
|
+
/**
|
|
696
|
+
* Reference to the slotted button within the trigger, if present.
|
|
697
|
+
* Used to manage click and key events for mega dropdown control.
|
|
698
|
+
*/
|
|
699
|
+
this.slottedButton = null;
|
|
700
|
+
this.for = undefined;
|
|
701
|
+
this.ariaExpanded = false;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
705
|
+
* @param forValue - The new value of the `for` property.
|
|
706
|
+
*/
|
|
707
|
+
validateControlFor(forValue = this.for) {
|
|
708
|
+
checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
709
|
+
}
|
|
710
|
+
get megadropdown() {
|
|
711
|
+
const ref = document.getElementById(this.for);
|
|
712
|
+
return ref && ref.localName === 'post-megadropdown'
|
|
713
|
+
? ref
|
|
714
|
+
: null;
|
|
715
|
+
}
|
|
716
|
+
handleToggle() {
|
|
717
|
+
if (this.megadropdown) {
|
|
718
|
+
this.megadropdown.toggle(this.host);
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
componentDidLoad() {
|
|
725
|
+
this.validateControlFor();
|
|
726
|
+
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
727
|
+
document.addEventListener('postToggleMegadropdown', (event) => {
|
|
728
|
+
if (event.target.id === this.for) {
|
|
729
|
+
this.ariaExpanded = event.detail;
|
|
730
|
+
if (this.slottedButton) {
|
|
731
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
this.slottedButton = this.host.querySelector('button');
|
|
736
|
+
if (this.slottedButton) {
|
|
737
|
+
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
738
|
+
this.slottedButton.addEventListener('click', () => {
|
|
739
|
+
this.handleToggle();
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
console.warn('No button found within post-megadropdown-trigger');
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
render() {
|
|
747
|
+
return (h(Host, { key: '4ab919adeaa51fc12d45131fa540c76fb3ba73d9', "data-version": version, "tab-index": "-1" }, h("button", { key: 'e7dac321691cdb19a4874fd0b2097227d077af35' }, h("slot", { key: 'beffc38d2d35a67e74364c3b40b6d39896aa4de3' }))));
|
|
748
|
+
}
|
|
749
|
+
get host() { return getElement(this); }
|
|
750
|
+
static get watchers() { return {
|
|
751
|
+
"for": ["validateControlFor"]
|
|
752
|
+
}; }
|
|
753
|
+
};
|
|
754
|
+
PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
|
|
755
|
+
|
|
756
|
+
const focusableSelector = `:where(${[
|
|
757
|
+
'button',
|
|
758
|
+
'input:not([type="hidden"])',
|
|
759
|
+
'[tabindex]',
|
|
760
|
+
'select',
|
|
761
|
+
'textarea',
|
|
762
|
+
'[contenteditable]',
|
|
763
|
+
'a[href]',
|
|
764
|
+
'iframe',
|
|
765
|
+
'audio[controls]',
|
|
766
|
+
'video[controls]',
|
|
767
|
+
'area[href]',
|
|
768
|
+
'details > summary:first-of-type',
|
|
769
|
+
].join(',')})`;
|
|
770
|
+
const focusDisablingSelector = `:where(${[
|
|
771
|
+
'[inert]',
|
|
772
|
+
'[inert] *',
|
|
773
|
+
':disabled',
|
|
774
|
+
'dialog:not([open]) *',
|
|
775
|
+
'[popover]:not(:popover-open) *',
|
|
776
|
+
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
777
|
+
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
778
|
+
].join(',')})`;
|
|
779
|
+
const isFocusable = (element) => {
|
|
780
|
+
return (element === null || element === void 0 ? void 0 : element.matches(focusableSelector)) && !(element === null || element === void 0 ? void 0 : element.matches(focusDisablingSelector));
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const postMenuCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}post-popovercontainer{padding:var(--post-menu-padding);background-color:var(--post-menu-bg, #ffffff);border-color:var(--post-menu-bg, #ffffff)}";
|
|
784
|
+
const PostMenuStyle0 = postMenuCss;
|
|
785
|
+
|
|
786
|
+
const PostMenu = class {
|
|
787
|
+
constructor(hostRef) {
|
|
788
|
+
registerInstance(this, hostRef);
|
|
789
|
+
this.toggleMenu = createEvent(this, "toggleMenu", 7);
|
|
790
|
+
this.lastFocusedElement = null;
|
|
791
|
+
this.KEYCODES = {
|
|
792
|
+
SPACE: ' ',
|
|
793
|
+
ENTER: 'Enter',
|
|
794
|
+
UP: 'ArrowUp',
|
|
795
|
+
DOWN: 'ArrowDown',
|
|
796
|
+
TAB: 'Tab',
|
|
797
|
+
HOME: 'Home',
|
|
798
|
+
END: 'End',
|
|
799
|
+
ESCAPE: 'Escape',
|
|
800
|
+
};
|
|
801
|
+
this.handleKeyDown = (e) => {
|
|
802
|
+
e.stopPropagation();
|
|
803
|
+
if (e.key === this.KEYCODES.ESCAPE) {
|
|
804
|
+
this.toggle(this.host);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
808
|
+
this.controlKeyDownHandler(e);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
this.handleClick = (e) => {
|
|
812
|
+
const target = e.target;
|
|
813
|
+
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
814
|
+
this.toggle(this.host);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
this.placement = 'bottom';
|
|
818
|
+
this.isVisible = false;
|
|
819
|
+
}
|
|
820
|
+
connectedCallback() {
|
|
821
|
+
this.root = getRoot(this.host);
|
|
822
|
+
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
823
|
+
this.host.addEventListener('click', this.handleClick);
|
|
824
|
+
}
|
|
825
|
+
disconnectedCallback() {
|
|
826
|
+
this.host.removeEventListener('keydown', this.handleKeyDown);
|
|
827
|
+
this.host.removeEventListener('click', this.handleClick);
|
|
828
|
+
}
|
|
829
|
+
componentDidLoad() {
|
|
830
|
+
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
831
|
+
this.isVisible = event.detail;
|
|
832
|
+
this.toggleMenu.emit(this.isVisible);
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Toggles the menu visibility based on its current state.
|
|
837
|
+
*/
|
|
838
|
+
async toggle(target) {
|
|
839
|
+
this.isVisible ? await this.hide() : await this.show(target);
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Displays the popover menu, focusing the first menu item.
|
|
843
|
+
*
|
|
844
|
+
* @param target - The HTML element relative to which the popover menu should be displayed.
|
|
845
|
+
*/
|
|
846
|
+
async show(target) {
|
|
847
|
+
if (this.popoverRef) {
|
|
848
|
+
await this.popoverRef.show(target);
|
|
849
|
+
this.lastFocusedElement = this.root.activeElement; // Use root's activeElement
|
|
850
|
+
const menuItems = this.getSlottedItems();
|
|
851
|
+
if (menuItems.length > 0) {
|
|
852
|
+
menuItems[0].focus();
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
else {
|
|
856
|
+
console.error('show: popoverRef is null or undefined');
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Hides the popover menu and restores focus to the previously focused element.
|
|
861
|
+
*/
|
|
862
|
+
async hide() {
|
|
863
|
+
if (this.popoverRef) {
|
|
864
|
+
await this.popoverRef.hide();
|
|
865
|
+
if (this.lastFocusedElement) {
|
|
866
|
+
this.lastFocusedElement.focus();
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
console.error('hide: popoverRef is null or undefined');
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
controlKeyDownHandler(e) {
|
|
874
|
+
const menuItems = this.getSlottedItems();
|
|
875
|
+
if (!menuItems.length) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const currentFocusedElement = this.root.activeElement; // Use root's activeElement
|
|
879
|
+
let currentIndex = menuItems.findIndex(el => el === currentFocusedElement);
|
|
880
|
+
switch (e.key) {
|
|
881
|
+
case this.KEYCODES.UP:
|
|
882
|
+
e.preventDefault();
|
|
883
|
+
currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
|
|
884
|
+
break;
|
|
885
|
+
case this.KEYCODES.DOWN:
|
|
886
|
+
e.preventDefault();
|
|
887
|
+
currentIndex = (currentIndex + 1) % menuItems.length;
|
|
888
|
+
break;
|
|
889
|
+
case this.KEYCODES.HOME:
|
|
890
|
+
currentIndex = 0;
|
|
891
|
+
break;
|
|
892
|
+
case this.KEYCODES.END:
|
|
893
|
+
currentIndex = menuItems.length - 1;
|
|
894
|
+
break;
|
|
895
|
+
case this.KEYCODES.SPACE:
|
|
896
|
+
case this.KEYCODES.ENTER:
|
|
897
|
+
this.toggle(this.host);
|
|
898
|
+
return;
|
|
899
|
+
case this.KEYCODES.TAB:
|
|
900
|
+
this.toggle(this.host);
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
if (menuItems[currentIndex]) {
|
|
904
|
+
menuItems[currentIndex].focus();
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
getSlottedItems() {
|
|
908
|
+
const slot = this.host.shadowRoot.querySelector('slot');
|
|
909
|
+
const slottedElements = slot ? slot.assignedElements() : [];
|
|
910
|
+
const menuItems = slottedElements
|
|
911
|
+
.filter(el => el.tagName === 'POST-MENU-ITEM')
|
|
912
|
+
.map(el => {
|
|
913
|
+
const slot = el.shadowRoot.querySelector('slot');
|
|
914
|
+
const assignedElements = slot ? slot.assignedElements() : [];
|
|
915
|
+
return assignedElements.filter(isFocusable);
|
|
916
|
+
})
|
|
917
|
+
.flat();
|
|
918
|
+
return menuItems;
|
|
919
|
+
}
|
|
920
|
+
render() {
|
|
921
|
+
return (h(Host, { key: '48e04f36dc7a3d8ed81b9570d1a4c931ace3cadd', "data-version": version }, h("post-popovercontainer", { key: '58532143bd7a8be7ea77cbd0a929fa74ee0ee890', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '967bf8aa936611ac6d533d9a8a1e176ee84b2a73', class: "popover-container", part: "popover-container" }, h("slot", { key: '4eb6b7fe34e8ea1df0d7cd8de31b57452442c3bb' })))));
|
|
922
|
+
}
|
|
923
|
+
get host() { return getElement(this); }
|
|
924
|
+
};
|
|
925
|
+
PostMenu.style = PostMenuStyle0;
|
|
926
|
+
|
|
927
|
+
const postMenuTriggerCss = ":host{display:inline-block}";
|
|
928
|
+
const PostMenuTriggerStyle0 = postMenuTriggerCss;
|
|
929
|
+
|
|
930
|
+
const PostMenuTrigger = class {
|
|
931
|
+
constructor(hostRef) {
|
|
932
|
+
registerInstance(this, hostRef);
|
|
933
|
+
/**
|
|
934
|
+
* Reference to the slotted button within the trigger, if present.
|
|
935
|
+
* Used to manage click and key events for menu control.
|
|
936
|
+
*/
|
|
937
|
+
this.slottedButton = null;
|
|
938
|
+
this.handleKeyDown = (e) => {
|
|
939
|
+
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
940
|
+
e.preventDefault();
|
|
941
|
+
this.handleToggle();
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
this.for = undefined;
|
|
945
|
+
this.ariaExpanded = false;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
949
|
+
* @param forValue - The new value of the `for` property.
|
|
950
|
+
*/
|
|
951
|
+
validateControlFor(forValue = this.for) {
|
|
952
|
+
checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
953
|
+
}
|
|
954
|
+
get menu() {
|
|
955
|
+
const ref = this.root.getElementById(this.for);
|
|
956
|
+
return ref && ref.localName === 'post-menu' ? ref : null;
|
|
957
|
+
}
|
|
958
|
+
handleToggle() {
|
|
959
|
+
const menu = this.menu;
|
|
960
|
+
if (menu && this.slottedButton) {
|
|
961
|
+
this.ariaExpanded = !this.ariaExpanded;
|
|
962
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
963
|
+
menu.toggle(this.host);
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
console.warn(`No post-menu found with ID: ${this.for}`);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
componentDidLoad() {
|
|
970
|
+
this.root = getRoot(this.host);
|
|
971
|
+
this.validateControlFor();
|
|
972
|
+
this.slottedButton = this.host.querySelector('button');
|
|
973
|
+
// Check if the slottedButton is within a web component
|
|
974
|
+
if (!this.slottedButton) {
|
|
975
|
+
const webComponent = this.host.querySelector('.menu-trigger-webc');
|
|
976
|
+
if (webComponent.shadowRoot) {
|
|
977
|
+
const slottedButton = webComponent.shadowRoot.querySelector('button');
|
|
978
|
+
if (slottedButton) {
|
|
979
|
+
this.slottedButton = slottedButton;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
if (this.slottedButton) {
|
|
984
|
+
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
985
|
+
this.slottedButton.addEventListener('click', () => {
|
|
986
|
+
this.handleToggle();
|
|
987
|
+
});
|
|
988
|
+
this.slottedButton.addEventListener('keydown', this.handleKeyDown);
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
console.warn('No button found within post-menu-trigger');
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
render() {
|
|
995
|
+
return (h(Host, { key: '64e9e7e6448160c7b52fc732b5107e94e9776678', "data-version": version, "tab-index": "-1" }, h("slot", { key: '711d641147cec0c26c7a3917f9302f1bbbee0d73' })));
|
|
996
|
+
}
|
|
997
|
+
get host() { return getElement(this); }
|
|
998
|
+
static get watchers() { return {
|
|
999
|
+
"for": ["validateControlFor"]
|
|
1000
|
+
}; }
|
|
1001
|
+
};
|
|
1002
|
+
PostMenuTrigger.style = PostMenuTriggerStyle0;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Custom positioning reference element.
|
|
1006
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
1007
|
+
*/
|
|
1008
|
+
|
|
1009
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
1010
|
+
const alignments = ['start', 'end'];
|
|
1011
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
1012
|
+
const min = Math.min;
|
|
1013
|
+
const max = Math.max;
|
|
1014
|
+
const round = Math.round;
|
|
1015
|
+
const floor = Math.floor;
|
|
1016
|
+
const createCoords = v => ({
|
|
1017
|
+
x: v,
|
|
1018
|
+
y: v
|
|
1019
|
+
});
|
|
1020
|
+
const oppositeSideMap = {
|
|
1021
|
+
left: 'right',
|
|
1022
|
+
right: 'left',
|
|
1023
|
+
bottom: 'top',
|
|
1024
|
+
top: 'bottom'
|
|
161
1025
|
};
|
|
162
1026
|
const oppositeAlignmentMap = {
|
|
163
1027
|
start: 'end',
|
|
@@ -1334,1340 +2198,1026 @@ function isOverflowElement(element) {
|
|
|
1334
2198
|
} = getComputedStyle$1(element);
|
|
1335
2199
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1336
2200
|
}
|
|
1337
|
-
function isTableElement(element) {
|
|
1338
|
-
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1339
|
-
}
|
|
1340
|
-
function isTopLayer(element) {
|
|
1341
|
-
return [':popover-open', ':modal'].some(selector => {
|
|
1342
|
-
try {
|
|
1343
|
-
return element.matches(selector);
|
|
1344
|
-
} catch (e) {
|
|
1345
|
-
return false;
|
|
1346
|
-
}
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
function isContainingBlock(elementOrCss) {
|
|
1350
|
-
const webkit = isWebKit();
|
|
1351
|
-
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1352
|
-
|
|
1353
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1354
|
-
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
1355
|
-
}
|
|
1356
|
-
function getContainingBlock(element) {
|
|
1357
|
-
let currentNode = getParentNode(element);
|
|
1358
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1359
|
-
if (isContainingBlock(currentNode)) {
|
|
1360
|
-
return currentNode;
|
|
1361
|
-
} else if (isTopLayer(currentNode)) {
|
|
1362
|
-
return null;
|
|
1363
|
-
}
|
|
1364
|
-
currentNode = getParentNode(currentNode);
|
|
1365
|
-
}
|
|
1366
|
-
return null;
|
|
1367
|
-
}
|
|
1368
|
-
function isWebKit() {
|
|
1369
|
-
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
1370
|
-
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
1371
|
-
}
|
|
1372
|
-
function isLastTraversableNode(node) {
|
|
1373
|
-
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1374
|
-
}
|
|
1375
|
-
function getComputedStyle$1(element) {
|
|
1376
|
-
return getWindow(element).getComputedStyle(element);
|
|
1377
|
-
}
|
|
1378
|
-
function getNodeScroll(element) {
|
|
1379
|
-
if (isElement(element)) {
|
|
1380
|
-
return {
|
|
1381
|
-
scrollLeft: element.scrollLeft,
|
|
1382
|
-
scrollTop: element.scrollTop
|
|
1383
|
-
};
|
|
1384
|
-
}
|
|
1385
|
-
return {
|
|
1386
|
-
scrollLeft: element.scrollX,
|
|
1387
|
-
scrollTop: element.scrollY
|
|
1388
|
-
};
|
|
1389
|
-
}
|
|
1390
|
-
function getParentNode(node) {
|
|
1391
|
-
if (getNodeName(node) === 'html') {
|
|
1392
|
-
return node;
|
|
1393
|
-
}
|
|
1394
|
-
const result =
|
|
1395
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
1396
|
-
node.assignedSlot ||
|
|
1397
|
-
// DOM Element detected.
|
|
1398
|
-
node.parentNode ||
|
|
1399
|
-
// ShadowRoot detected.
|
|
1400
|
-
isShadowRoot(node) && node.host ||
|
|
1401
|
-
// Fallback.
|
|
1402
|
-
getDocumentElement(node);
|
|
1403
|
-
return isShadowRoot(result) ? result.host : result;
|
|
1404
|
-
}
|
|
1405
|
-
function getNearestOverflowAncestor(node) {
|
|
1406
|
-
const parentNode = getParentNode(node);
|
|
1407
|
-
if (isLastTraversableNode(parentNode)) {
|
|
1408
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1409
|
-
}
|
|
1410
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1411
|
-
return parentNode;
|
|
1412
|
-
}
|
|
1413
|
-
return getNearestOverflowAncestor(parentNode);
|
|
1414
|
-
}
|
|
1415
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
1416
|
-
var _node$ownerDocument2;
|
|
1417
|
-
if (list === void 0) {
|
|
1418
|
-
list = [];
|
|
1419
|
-
}
|
|
1420
|
-
if (traverseIframes === void 0) {
|
|
1421
|
-
traverseIframes = true;
|
|
1422
|
-
}
|
|
1423
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1424
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1425
|
-
const win = getWindow(scrollableAncestor);
|
|
1426
|
-
if (isBody) {
|
|
1427
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
1428
|
-
}
|
|
1429
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
function getCssDimensions(element) {
|
|
1433
|
-
const css = getComputedStyle$1(element);
|
|
1434
|
-
// In testing environments, the `width` and `height` properties are empty
|
|
1435
|
-
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
1436
|
-
let width = parseFloat(css.width) || 0;
|
|
1437
|
-
let height = parseFloat(css.height) || 0;
|
|
1438
|
-
const hasOffset = isHTMLElement(element);
|
|
1439
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
1440
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
1441
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
1442
|
-
if (shouldFallback) {
|
|
1443
|
-
width = offsetWidth;
|
|
1444
|
-
height = offsetHeight;
|
|
1445
|
-
}
|
|
1446
|
-
return {
|
|
1447
|
-
width,
|
|
1448
|
-
height,
|
|
1449
|
-
$: shouldFallback
|
|
1450
|
-
};
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
function unwrapElement(element) {
|
|
1454
|
-
return !isElement(element) ? element.contextElement : element;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
function getScale(element) {
|
|
1458
|
-
const domElement = unwrapElement(element);
|
|
1459
|
-
if (!isHTMLElement(domElement)) {
|
|
1460
|
-
return createCoords(1);
|
|
1461
|
-
}
|
|
1462
|
-
const rect = domElement.getBoundingClientRect();
|
|
1463
|
-
const {
|
|
1464
|
-
width,
|
|
1465
|
-
height,
|
|
1466
|
-
$
|
|
1467
|
-
} = getCssDimensions(domElement);
|
|
1468
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1469
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1470
|
-
|
|
1471
|
-
// 0, NaN, or Infinity should always fallback to 1.
|
|
1472
|
-
|
|
1473
|
-
if (!x || !Number.isFinite(x)) {
|
|
1474
|
-
x = 1;
|
|
1475
|
-
}
|
|
1476
|
-
if (!y || !Number.isFinite(y)) {
|
|
1477
|
-
y = 1;
|
|
1478
|
-
}
|
|
1479
|
-
return {
|
|
1480
|
-
x,
|
|
1481
|
-
y
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
1486
|
-
function getVisualOffsets(element) {
|
|
1487
|
-
const win = getWindow(element);
|
|
1488
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
1489
|
-
return noOffsets;
|
|
1490
|
-
}
|
|
1491
|
-
return {
|
|
1492
|
-
x: win.visualViewport.offsetLeft,
|
|
1493
|
-
y: win.visualViewport.offsetTop
|
|
1494
|
-
};
|
|
1495
|
-
}
|
|
1496
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1497
|
-
if (isFixed === void 0) {
|
|
1498
|
-
isFixed = false;
|
|
1499
|
-
}
|
|
1500
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1501
|
-
return false;
|
|
1502
|
-
}
|
|
1503
|
-
return isFixed;
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1507
|
-
if (includeScale === void 0) {
|
|
1508
|
-
includeScale = false;
|
|
1509
|
-
}
|
|
1510
|
-
if (isFixedStrategy === void 0) {
|
|
1511
|
-
isFixedStrategy = false;
|
|
1512
|
-
}
|
|
1513
|
-
const clientRect = element.getBoundingClientRect();
|
|
1514
|
-
const domElement = unwrapElement(element);
|
|
1515
|
-
let scale = createCoords(1);
|
|
1516
|
-
if (includeScale) {
|
|
1517
|
-
if (offsetParent) {
|
|
1518
|
-
if (isElement(offsetParent)) {
|
|
1519
|
-
scale = getScale(offsetParent);
|
|
1520
|
-
}
|
|
1521
|
-
} else {
|
|
1522
|
-
scale = getScale(element);
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1526
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1527
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1528
|
-
let width = clientRect.width / scale.x;
|
|
1529
|
-
let height = clientRect.height / scale.y;
|
|
1530
|
-
if (domElement) {
|
|
1531
|
-
const win = getWindow(domElement);
|
|
1532
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1533
|
-
let currentWin = win;
|
|
1534
|
-
let currentIFrame = currentWin.frameElement;
|
|
1535
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1536
|
-
const iframeScale = getScale(currentIFrame);
|
|
1537
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1538
|
-
const css = getComputedStyle$1(currentIFrame);
|
|
1539
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1540
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1541
|
-
x *= iframeScale.x;
|
|
1542
|
-
y *= iframeScale.y;
|
|
1543
|
-
width *= iframeScale.x;
|
|
1544
|
-
height *= iframeScale.y;
|
|
1545
|
-
x += left;
|
|
1546
|
-
y += top;
|
|
1547
|
-
currentWin = getWindow(currentIFrame);
|
|
1548
|
-
currentIFrame = currentWin.frameElement;
|
|
2201
|
+
function isTableElement(element) {
|
|
2202
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
2203
|
+
}
|
|
2204
|
+
function isTopLayer(element) {
|
|
2205
|
+
return [':popover-open', ':modal'].some(selector => {
|
|
2206
|
+
try {
|
|
2207
|
+
return element.matches(selector);
|
|
2208
|
+
} catch (e) {
|
|
2209
|
+
return false;
|
|
1549
2210
|
}
|
|
1550
|
-
}
|
|
1551
|
-
return rectToClientRect({
|
|
1552
|
-
width,
|
|
1553
|
-
height,
|
|
1554
|
-
x,
|
|
1555
|
-
y
|
|
1556
2211
|
});
|
|
1557
2212
|
}
|
|
2213
|
+
function isContainingBlock(elementOrCss) {
|
|
2214
|
+
const webkit = isWebKit();
|
|
2215
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1558
2216
|
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1570
|
-
return rect;
|
|
1571
|
-
}
|
|
1572
|
-
let scroll = {
|
|
1573
|
-
scrollLeft: 0,
|
|
1574
|
-
scrollTop: 0
|
|
1575
|
-
};
|
|
1576
|
-
let scale = createCoords(1);
|
|
1577
|
-
const offsets = createCoords(0);
|
|
1578
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1579
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1580
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1581
|
-
scroll = getNodeScroll(offsetParent);
|
|
1582
|
-
}
|
|
1583
|
-
if (isHTMLElement(offsetParent)) {
|
|
1584
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1585
|
-
scale = getScale(offsetParent);
|
|
1586
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1587
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2217
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2218
|
+
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
2219
|
+
}
|
|
2220
|
+
function getContainingBlock(element) {
|
|
2221
|
+
let currentNode = getParentNode(element);
|
|
2222
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2223
|
+
if (isContainingBlock(currentNode)) {
|
|
2224
|
+
return currentNode;
|
|
2225
|
+
} else if (isTopLayer(currentNode)) {
|
|
2226
|
+
return null;
|
|
1588
2227
|
}
|
|
2228
|
+
currentNode = getParentNode(currentNode);
|
|
1589
2229
|
}
|
|
1590
|
-
return
|
|
1591
|
-
width: rect.width * scale.x,
|
|
1592
|
-
height: rect.height * scale.y,
|
|
1593
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1594
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
1595
|
-
};
|
|
2230
|
+
return null;
|
|
1596
2231
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
return
|
|
2232
|
+
function isWebKit() {
|
|
2233
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
2234
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
1600
2235
|
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1604
|
-
// incorrect for RTL.
|
|
1605
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
2236
|
+
function isLastTraversableNode(node) {
|
|
2237
|
+
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1606
2238
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1610
|
-
function getDocumentRect(element) {
|
|
1611
|
-
const html = getDocumentElement(element);
|
|
1612
|
-
const scroll = getNodeScroll(element);
|
|
1613
|
-
const body = element.ownerDocument.body;
|
|
1614
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1615
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1616
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1617
|
-
const y = -scroll.scrollTop;
|
|
1618
|
-
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1619
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1620
|
-
}
|
|
1621
|
-
return {
|
|
1622
|
-
width,
|
|
1623
|
-
height,
|
|
1624
|
-
x,
|
|
1625
|
-
y
|
|
1626
|
-
};
|
|
2239
|
+
function getComputedStyle$1(element) {
|
|
2240
|
+
return getWindow(element).getComputedStyle(element);
|
|
1627
2241
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
let height = html.clientHeight;
|
|
1635
|
-
let x = 0;
|
|
1636
|
-
let y = 0;
|
|
1637
|
-
if (visualViewport) {
|
|
1638
|
-
width = visualViewport.width;
|
|
1639
|
-
height = visualViewport.height;
|
|
1640
|
-
const visualViewportBased = isWebKit();
|
|
1641
|
-
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
1642
|
-
x = visualViewport.offsetLeft;
|
|
1643
|
-
y = visualViewport.offsetTop;
|
|
1644
|
-
}
|
|
2242
|
+
function getNodeScroll(element) {
|
|
2243
|
+
if (isElement(element)) {
|
|
2244
|
+
return {
|
|
2245
|
+
scrollLeft: element.scrollLeft,
|
|
2246
|
+
scrollTop: element.scrollTop
|
|
2247
|
+
};
|
|
1645
2248
|
}
|
|
1646
2249
|
return {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
x,
|
|
1650
|
-
y
|
|
1651
|
-
};
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
// Returns the inner client rect, subtracting scrollbars if present.
|
|
1655
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
1656
|
-
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1657
|
-
const top = clientRect.top + element.clientTop;
|
|
1658
|
-
const left = clientRect.left + element.clientLeft;
|
|
1659
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1660
|
-
const width = element.clientWidth * scale.x;
|
|
1661
|
-
const height = element.clientHeight * scale.y;
|
|
1662
|
-
const x = left * scale.x;
|
|
1663
|
-
const y = top * scale.y;
|
|
1664
|
-
return {
|
|
1665
|
-
width,
|
|
1666
|
-
height,
|
|
1667
|
-
x,
|
|
1668
|
-
y
|
|
2250
|
+
scrollLeft: element.scrollX,
|
|
2251
|
+
scrollTop: element.scrollY
|
|
1669
2252
|
};
|
|
1670
2253
|
}
|
|
1671
|
-
function
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
rect = getViewportRect(element, strategy);
|
|
1675
|
-
} else if (clippingAncestor === 'document') {
|
|
1676
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
1677
|
-
} else if (isElement(clippingAncestor)) {
|
|
1678
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1679
|
-
} else {
|
|
1680
|
-
const visualOffsets = getVisualOffsets(element);
|
|
1681
|
-
rect = {
|
|
1682
|
-
...clippingAncestor,
|
|
1683
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
1684
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
1685
|
-
};
|
|
2254
|
+
function getParentNode(node) {
|
|
2255
|
+
if (getNodeName(node) === 'html') {
|
|
2256
|
+
return node;
|
|
1686
2257
|
}
|
|
1687
|
-
|
|
2258
|
+
const result =
|
|
2259
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
2260
|
+
node.assignedSlot ||
|
|
2261
|
+
// DOM Element detected.
|
|
2262
|
+
node.parentNode ||
|
|
2263
|
+
// ShadowRoot detected.
|
|
2264
|
+
isShadowRoot(node) && node.host ||
|
|
2265
|
+
// Fallback.
|
|
2266
|
+
getDocumentElement(node);
|
|
2267
|
+
return isShadowRoot(result) ? result.host : result;
|
|
1688
2268
|
}
|
|
1689
|
-
function
|
|
1690
|
-
const parentNode = getParentNode(
|
|
1691
|
-
if (
|
|
1692
|
-
return
|
|
2269
|
+
function getNearestOverflowAncestor(node) {
|
|
2270
|
+
const parentNode = getParentNode(node);
|
|
2271
|
+
if (isLastTraversableNode(parentNode)) {
|
|
2272
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1693
2273
|
}
|
|
1694
|
-
|
|
2274
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
2275
|
+
return parentNode;
|
|
2276
|
+
}
|
|
2277
|
+
return getNearestOverflowAncestor(parentNode);
|
|
1695
2278
|
}
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
function getClippingElementAncestors(element, cache) {
|
|
1701
|
-
const cachedResult = cache.get(element);
|
|
1702
|
-
if (cachedResult) {
|
|
1703
|
-
return cachedResult;
|
|
2279
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
2280
|
+
var _node$ownerDocument2;
|
|
2281
|
+
if (list === void 0) {
|
|
2282
|
+
list = [];
|
|
1704
2283
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1708
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1709
|
-
|
|
1710
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1711
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1712
|
-
const computedStyle = getComputedStyle$1(currentNode);
|
|
1713
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1714
|
-
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1715
|
-
currentContainingBlockComputedStyle = null;
|
|
1716
|
-
}
|
|
1717
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1718
|
-
if (shouldDropCurrentNode) {
|
|
1719
|
-
// Drop non-containing blocks.
|
|
1720
|
-
result = result.filter(ancestor => ancestor !== currentNode);
|
|
1721
|
-
} else {
|
|
1722
|
-
// Record last containing block for next iteration.
|
|
1723
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
1724
|
-
}
|
|
1725
|
-
currentNode = getParentNode(currentNode);
|
|
2284
|
+
if (traverseIframes === void 0) {
|
|
2285
|
+
traverseIframes = true;
|
|
1726
2286
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
let {
|
|
1735
|
-
element,
|
|
1736
|
-
boundary,
|
|
1737
|
-
rootBoundary,
|
|
1738
|
-
strategy
|
|
1739
|
-
} = _ref;
|
|
1740
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1741
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1742
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
1743
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1744
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1745
|
-
accRect.top = max(rect.top, accRect.top);
|
|
1746
|
-
accRect.right = min(rect.right, accRect.right);
|
|
1747
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1748
|
-
accRect.left = max(rect.left, accRect.left);
|
|
1749
|
-
return accRect;
|
|
1750
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1751
|
-
return {
|
|
1752
|
-
width: clippingRect.right - clippingRect.left,
|
|
1753
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
1754
|
-
x: clippingRect.left,
|
|
1755
|
-
y: clippingRect.top
|
|
1756
|
-
};
|
|
2287
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
2288
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
2289
|
+
const win = getWindow(scrollableAncestor);
|
|
2290
|
+
if (isBody) {
|
|
2291
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
2292
|
+
}
|
|
2293
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1757
2294
|
}
|
|
1758
2295
|
|
|
1759
|
-
function
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
2296
|
+
function getCssDimensions(element) {
|
|
2297
|
+
const css = getComputedStyle$1(element);
|
|
2298
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
2299
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
2300
|
+
let width = parseFloat(css.width) || 0;
|
|
2301
|
+
let height = parseFloat(css.height) || 0;
|
|
2302
|
+
const hasOffset = isHTMLElement(element);
|
|
2303
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2304
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2305
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2306
|
+
if (shouldFallback) {
|
|
2307
|
+
width = offsetWidth;
|
|
2308
|
+
height = offsetHeight;
|
|
2309
|
+
}
|
|
1764
2310
|
return {
|
|
1765
2311
|
width,
|
|
1766
|
-
height
|
|
2312
|
+
height,
|
|
2313
|
+
$: shouldFallback
|
|
1767
2314
|
};
|
|
1768
2315
|
}
|
|
1769
2316
|
|
|
1770
|
-
function
|
|
1771
|
-
|
|
1772
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1773
|
-
const isFixed = strategy === 'fixed';
|
|
1774
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1775
|
-
let scroll = {
|
|
1776
|
-
scrollLeft: 0,
|
|
1777
|
-
scrollTop: 0
|
|
1778
|
-
};
|
|
1779
|
-
const offsets = createCoords(0);
|
|
1780
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1781
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1782
|
-
scroll = getNodeScroll(offsetParent);
|
|
1783
|
-
}
|
|
1784
|
-
if (isOffsetParentAnElement) {
|
|
1785
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1786
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1787
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1788
|
-
} else if (documentElement) {
|
|
1789
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
1793
|
-
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
1794
|
-
return {
|
|
1795
|
-
x,
|
|
1796
|
-
y,
|
|
1797
|
-
width: rect.width,
|
|
1798
|
-
height: rect.height
|
|
1799
|
-
};
|
|
2317
|
+
function unwrapElement(element) {
|
|
2318
|
+
return !isElement(element) ? element.contextElement : element;
|
|
1800
2319
|
}
|
|
1801
2320
|
|
|
1802
|
-
function
|
|
1803
|
-
|
|
1804
|
-
|
|
2321
|
+
function getScale(element) {
|
|
2322
|
+
const domElement = unwrapElement(element);
|
|
2323
|
+
if (!isHTMLElement(domElement)) {
|
|
2324
|
+
return createCoords(1);
|
|
2325
|
+
}
|
|
2326
|
+
const rect = domElement.getBoundingClientRect();
|
|
2327
|
+
const {
|
|
2328
|
+
width,
|
|
2329
|
+
height,
|
|
2330
|
+
$
|
|
2331
|
+
} = getCssDimensions(domElement);
|
|
2332
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
2333
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1805
2334
|
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
2335
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
2336
|
+
|
|
2337
|
+
if (!x || !Number.isFinite(x)) {
|
|
2338
|
+
x = 1;
|
|
1809
2339
|
}
|
|
1810
|
-
if (
|
|
1811
|
-
|
|
2340
|
+
if (!y || !Number.isFinite(y)) {
|
|
2341
|
+
y = 1;
|
|
1812
2342
|
}
|
|
1813
|
-
return
|
|
2343
|
+
return {
|
|
2344
|
+
x,
|
|
2345
|
+
y
|
|
2346
|
+
};
|
|
1814
2347
|
}
|
|
1815
2348
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
function getOffsetParent(element, polyfill) {
|
|
2349
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
2350
|
+
function getVisualOffsets(element) {
|
|
1819
2351
|
const win = getWindow(element);
|
|
1820
|
-
if (
|
|
1821
|
-
return
|
|
1822
|
-
}
|
|
1823
|
-
if (!isHTMLElement(element)) {
|
|
1824
|
-
let svgOffsetParent = getParentNode(element);
|
|
1825
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1826
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1827
|
-
return svgOffsetParent;
|
|
1828
|
-
}
|
|
1829
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1830
|
-
}
|
|
1831
|
-
return win;
|
|
1832
|
-
}
|
|
1833
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1834
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1835
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1836
|
-
}
|
|
1837
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1838
|
-
return win;
|
|
2352
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
2353
|
+
return noOffsets;
|
|
1839
2354
|
}
|
|
1840
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
const getElementRects = async function (data) {
|
|
1844
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1845
|
-
const getDimensionsFn = this.getDimensions;
|
|
1846
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1847
2355
|
return {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
x: 0,
|
|
1851
|
-
y: 0,
|
|
1852
|
-
width: floatingDimensions.width,
|
|
1853
|
-
height: floatingDimensions.height
|
|
1854
|
-
}
|
|
2356
|
+
x: win.visualViewport.offsetLeft,
|
|
2357
|
+
y: win.visualViewport.offsetTop
|
|
1855
2358
|
};
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
2359
|
+
}
|
|
2360
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2361
|
+
if (isFixed === void 0) {
|
|
2362
|
+
isFixed = false;
|
|
2363
|
+
}
|
|
2364
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
2365
|
+
return false;
|
|
2366
|
+
}
|
|
2367
|
+
return isFixed;
|
|
1860
2368
|
}
|
|
1861
2369
|
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
getClippingRect,
|
|
1866
|
-
getOffsetParent,
|
|
1867
|
-
getElementRects,
|
|
1868
|
-
getClientRects,
|
|
1869
|
-
getDimensions,
|
|
1870
|
-
getScale,
|
|
1871
|
-
isElement,
|
|
1872
|
-
isRTL
|
|
1873
|
-
};
|
|
1874
|
-
|
|
1875
|
-
// https://samthor.au/2021/observing-dom/
|
|
1876
|
-
function observeMove(element, onMove) {
|
|
1877
|
-
let io = null;
|
|
1878
|
-
let timeoutId;
|
|
1879
|
-
const root = getDocumentElement(element);
|
|
1880
|
-
function cleanup() {
|
|
1881
|
-
var _io;
|
|
1882
|
-
clearTimeout(timeoutId);
|
|
1883
|
-
(_io = io) == null || _io.disconnect();
|
|
1884
|
-
io = null;
|
|
2370
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2371
|
+
if (includeScale === void 0) {
|
|
2372
|
+
includeScale = false;
|
|
1885
2373
|
}
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
top,
|
|
1897
|
-
width,
|
|
1898
|
-
height
|
|
1899
|
-
} = element.getBoundingClientRect();
|
|
1900
|
-
if (!skip) {
|
|
1901
|
-
onMove();
|
|
1902
|
-
}
|
|
1903
|
-
if (!width || !height) {
|
|
1904
|
-
return;
|
|
1905
|
-
}
|
|
1906
|
-
const insetTop = floor(top);
|
|
1907
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
|
1908
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1909
|
-
const insetLeft = floor(left);
|
|
1910
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1911
|
-
const options = {
|
|
1912
|
-
rootMargin,
|
|
1913
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
1914
|
-
};
|
|
1915
|
-
let isFirstUpdate = true;
|
|
1916
|
-
function handleObserve(entries) {
|
|
1917
|
-
const ratio = entries[0].intersectionRatio;
|
|
1918
|
-
if (ratio !== threshold) {
|
|
1919
|
-
if (!isFirstUpdate) {
|
|
1920
|
-
return refresh();
|
|
1921
|
-
}
|
|
1922
|
-
if (!ratio) {
|
|
1923
|
-
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
1924
|
-
// to prevent an infinite loop of updates.
|
|
1925
|
-
timeoutId = setTimeout(() => {
|
|
1926
|
-
refresh(false, 1e-7);
|
|
1927
|
-
}, 1000);
|
|
1928
|
-
} else {
|
|
1929
|
-
refresh(false, ratio);
|
|
1930
|
-
}
|
|
2374
|
+
if (isFixedStrategy === void 0) {
|
|
2375
|
+
isFixedStrategy = false;
|
|
2376
|
+
}
|
|
2377
|
+
const clientRect = element.getBoundingClientRect();
|
|
2378
|
+
const domElement = unwrapElement(element);
|
|
2379
|
+
let scale = createCoords(1);
|
|
2380
|
+
if (includeScale) {
|
|
2381
|
+
if (offsetParent) {
|
|
2382
|
+
if (isElement(offsetParent)) {
|
|
2383
|
+
scale = getScale(offsetParent);
|
|
1931
2384
|
}
|
|
1932
|
-
|
|
2385
|
+
} else {
|
|
2386
|
+
scale = getScale(element);
|
|
1933
2387
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
2388
|
+
}
|
|
2389
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2390
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2391
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2392
|
+
let width = clientRect.width / scale.x;
|
|
2393
|
+
let height = clientRect.height / scale.y;
|
|
2394
|
+
if (domElement) {
|
|
2395
|
+
const win = getWindow(domElement);
|
|
2396
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2397
|
+
let currentWin = win;
|
|
2398
|
+
let currentIFrame = currentWin.frameElement;
|
|
2399
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2400
|
+
const iframeScale = getScale(currentIFrame);
|
|
2401
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2402
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2403
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2404
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2405
|
+
x *= iframeScale.x;
|
|
2406
|
+
y *= iframeScale.y;
|
|
2407
|
+
width *= iframeScale.x;
|
|
2408
|
+
height *= iframeScale.y;
|
|
2409
|
+
x += left;
|
|
2410
|
+
y += top;
|
|
2411
|
+
currentWin = getWindow(currentIFrame);
|
|
2412
|
+
currentIFrame = currentWin.frameElement;
|
|
1945
2413
|
}
|
|
1946
|
-
io.observe(element);
|
|
1947
2414
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
2415
|
+
return rectToClientRect({
|
|
2416
|
+
width,
|
|
2417
|
+
height,
|
|
2418
|
+
x,
|
|
2419
|
+
y
|
|
2420
|
+
});
|
|
1950
2421
|
}
|
|
1951
2422
|
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2423
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2424
|
+
let {
|
|
2425
|
+
elements,
|
|
2426
|
+
rect,
|
|
2427
|
+
offsetParent,
|
|
2428
|
+
strategy
|
|
2429
|
+
} = _ref;
|
|
2430
|
+
const isFixed = strategy === 'fixed';
|
|
2431
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2432
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2433
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
2434
|
+
return rect;
|
|
1963
2435
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
1975
|
-
passive: true
|
|
1976
|
-
});
|
|
1977
|
-
ancestorResize && ancestor.addEventListener('resize', update);
|
|
1978
|
-
});
|
|
1979
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1980
|
-
let reobserveFrame = -1;
|
|
1981
|
-
let resizeObserver = null;
|
|
1982
|
-
if (elementResize) {
|
|
1983
|
-
resizeObserver = new ResizeObserver(_ref => {
|
|
1984
|
-
let [firstEntry] = _ref;
|
|
1985
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
1986
|
-
// Prevent update loops when using the `size` middleware.
|
|
1987
|
-
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
1988
|
-
resizeObserver.unobserve(floating);
|
|
1989
|
-
cancelAnimationFrame(reobserveFrame);
|
|
1990
|
-
reobserveFrame = requestAnimationFrame(() => {
|
|
1991
|
-
var _resizeObserver;
|
|
1992
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1993
|
-
});
|
|
1994
|
-
}
|
|
1995
|
-
update();
|
|
1996
|
-
});
|
|
1997
|
-
if (referenceEl && !animationFrame) {
|
|
1998
|
-
resizeObserver.observe(referenceEl);
|
|
2436
|
+
let scroll = {
|
|
2437
|
+
scrollLeft: 0,
|
|
2438
|
+
scrollTop: 0
|
|
2439
|
+
};
|
|
2440
|
+
let scale = createCoords(1);
|
|
2441
|
+
const offsets = createCoords(0);
|
|
2442
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2443
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2444
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2445
|
+
scroll = getNodeScroll(offsetParent);
|
|
1999
2446
|
}
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
frameLoop();
|
|
2006
|
-
}
|
|
2007
|
-
function frameLoop() {
|
|
2008
|
-
const nextRefRect = getBoundingClientRect(reference);
|
|
2009
|
-
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
2010
|
-
update();
|
|
2447
|
+
if (isHTMLElement(offsetParent)) {
|
|
2448
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2449
|
+
scale = getScale(offsetParent);
|
|
2450
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2451
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2011
2452
|
}
|
|
2012
|
-
prevRefRect = nextRefRect;
|
|
2013
|
-
frameId = requestAnimationFrame(frameLoop);
|
|
2014
2453
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
2021
|
-
});
|
|
2022
|
-
cleanupIo == null || cleanupIo();
|
|
2023
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
2024
|
-
resizeObserver = null;
|
|
2025
|
-
if (animationFrame) {
|
|
2026
|
-
cancelAnimationFrame(frameId);
|
|
2027
|
-
}
|
|
2454
|
+
return {
|
|
2455
|
+
width: rect.width * scale.x,
|
|
2456
|
+
height: rect.height * scale.y,
|
|
2457
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
2458
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
2028
2459
|
};
|
|
2029
2460
|
}
|
|
2030
2461
|
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
2035
|
-
* object may be passed.
|
|
2036
|
-
* @see https://floating-ui.com/docs/offset
|
|
2037
|
-
*/
|
|
2038
|
-
const offset = offset$1;
|
|
2039
|
-
|
|
2040
|
-
/**
|
|
2041
|
-
* Optimizes the visibility of the floating element by choosing the placement
|
|
2042
|
-
* that has the most space available automatically, without needing to specify a
|
|
2043
|
-
* preferred placement. Alternative to `flip`.
|
|
2044
|
-
* @see https://floating-ui.com/docs/autoPlacement
|
|
2045
|
-
*/
|
|
2046
|
-
autoPlacement;
|
|
2047
|
-
|
|
2048
|
-
/**
|
|
2049
|
-
* Optimizes the visibility of the floating element by shifting it in order to
|
|
2050
|
-
* keep it in view when it will overflow the clipping boundary.
|
|
2051
|
-
* @see https://floating-ui.com/docs/shift
|
|
2052
|
-
*/
|
|
2053
|
-
const shift = shift$1;
|
|
2462
|
+
function getClientRects(element) {
|
|
2463
|
+
return Array.from(element.getClientRects());
|
|
2464
|
+
}
|
|
2054
2465
|
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
*/
|
|
2061
|
-
const flip = flip$1;
|
|
2466
|
+
function getWindowScrollBarX(element) {
|
|
2467
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
2468
|
+
// incorrect for RTL.
|
|
2469
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
2470
|
+
}
|
|
2062
2471
|
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
const
|
|
2472
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
2473
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
2474
|
+
function getDocumentRect(element) {
|
|
2475
|
+
const html = getDocumentElement(element);
|
|
2476
|
+
const scroll = getNodeScroll(element);
|
|
2477
|
+
const body = element.ownerDocument.body;
|
|
2478
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2479
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2480
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2481
|
+
const y = -scroll.scrollTop;
|
|
2482
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
2483
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2484
|
+
}
|
|
2485
|
+
return {
|
|
2486
|
+
width,
|
|
2487
|
+
height,
|
|
2488
|
+
x,
|
|
2489
|
+
y
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2070
2492
|
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2493
|
+
function getViewportRect(element, strategy) {
|
|
2494
|
+
const win = getWindow(element);
|
|
2495
|
+
const html = getDocumentElement(element);
|
|
2496
|
+
const visualViewport = win.visualViewport;
|
|
2497
|
+
let width = html.clientWidth;
|
|
2498
|
+
let height = html.clientHeight;
|
|
2499
|
+
let x = 0;
|
|
2500
|
+
let y = 0;
|
|
2501
|
+
if (visualViewport) {
|
|
2502
|
+
width = visualViewport.width;
|
|
2503
|
+
height = visualViewport.height;
|
|
2504
|
+
const visualViewportBased = isWebKit();
|
|
2505
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
2506
|
+
x = visualViewport.offsetLeft;
|
|
2507
|
+
y = visualViewport.offsetTop;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
return {
|
|
2511
|
+
width,
|
|
2512
|
+
height,
|
|
2513
|
+
x,
|
|
2514
|
+
y
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2077
2517
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
const
|
|
2518
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
2519
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
2520
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
2521
|
+
const top = clientRect.top + element.clientTop;
|
|
2522
|
+
const left = clientRect.left + element.clientLeft;
|
|
2523
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
2524
|
+
const width = element.clientWidth * scale.x;
|
|
2525
|
+
const height = element.clientHeight * scale.y;
|
|
2526
|
+
const x = left * scale.x;
|
|
2527
|
+
const y = top * scale.y;
|
|
2528
|
+
return {
|
|
2529
|
+
width,
|
|
2530
|
+
height,
|
|
2531
|
+
x,
|
|
2532
|
+
y
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2536
|
+
let rect;
|
|
2537
|
+
if (clippingAncestor === 'viewport') {
|
|
2538
|
+
rect = getViewportRect(element, strategy);
|
|
2539
|
+
} else if (clippingAncestor === 'document') {
|
|
2540
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
2541
|
+
} else if (isElement(clippingAncestor)) {
|
|
2542
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2543
|
+
} else {
|
|
2544
|
+
const visualOffsets = getVisualOffsets(element);
|
|
2545
|
+
rect = {
|
|
2546
|
+
...clippingAncestor,
|
|
2547
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
2548
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
2549
|
+
};
|
|
2550
|
+
}
|
|
2551
|
+
return rectToClientRect(rect);
|
|
2552
|
+
}
|
|
2553
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
2554
|
+
const parentNode = getParentNode(element);
|
|
2555
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2556
|
+
return false;
|
|
2557
|
+
}
|
|
2558
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2559
|
+
}
|
|
2084
2560
|
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2561
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
2562
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
2563
|
+
// of the given element up the tree.
|
|
2564
|
+
function getClippingElementAncestors(element, cache) {
|
|
2565
|
+
const cachedResult = cache.get(element);
|
|
2566
|
+
if (cachedResult) {
|
|
2567
|
+
return cachedResult;
|
|
2568
|
+
}
|
|
2569
|
+
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2570
|
+
let currentContainingBlockComputedStyle = null;
|
|
2571
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
2572
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2091
2573
|
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
const
|
|
2574
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2575
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2576
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
2577
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2578
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2579
|
+
currentContainingBlockComputedStyle = null;
|
|
2580
|
+
}
|
|
2581
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2582
|
+
if (shouldDropCurrentNode) {
|
|
2583
|
+
// Drop non-containing blocks.
|
|
2584
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
2585
|
+
} else {
|
|
2586
|
+
// Record last containing block for next iteration.
|
|
2587
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
2588
|
+
}
|
|
2589
|
+
currentNode = getParentNode(currentNode);
|
|
2590
|
+
}
|
|
2591
|
+
cache.set(element, result);
|
|
2592
|
+
return result;
|
|
2593
|
+
}
|
|
2096
2594
|
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2108
|
-
|
|
2595
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
2596
|
+
// clipping ancestors.
|
|
2597
|
+
function getClippingRect(_ref) {
|
|
2598
|
+
let {
|
|
2599
|
+
element,
|
|
2600
|
+
boundary,
|
|
2601
|
+
rootBoundary,
|
|
2602
|
+
strategy
|
|
2603
|
+
} = _ref;
|
|
2604
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2605
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2606
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
2607
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
2608
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
2609
|
+
accRect.top = max(rect.top, accRect.top);
|
|
2610
|
+
accRect.right = min(rect.right, accRect.right);
|
|
2611
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
2612
|
+
accRect.left = max(rect.left, accRect.left);
|
|
2613
|
+
return accRect;
|
|
2614
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
2615
|
+
return {
|
|
2616
|
+
width: clippingRect.right - clippingRect.left,
|
|
2617
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
2618
|
+
x: clippingRect.left,
|
|
2619
|
+
y: clippingRect.top
|
|
2109
2620
|
};
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
function getDimensions(element) {
|
|
2624
|
+
const {
|
|
2625
|
+
width,
|
|
2626
|
+
height
|
|
2627
|
+
} = getCssDimensions(element);
|
|
2628
|
+
return {
|
|
2629
|
+
width,
|
|
2630
|
+
height
|
|
2113
2631
|
};
|
|
2114
|
-
|
|
2115
|
-
...mergedOptions,
|
|
2116
|
-
platform: platformWithCache
|
|
2117
|
-
});
|
|
2118
|
-
};
|
|
2632
|
+
}
|
|
2119
2633
|
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2634
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
2635
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2636
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2637
|
+
const isFixed = strategy === 'fixed';
|
|
2638
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
2639
|
+
let scroll = {
|
|
2640
|
+
scrollLeft: 0,
|
|
2641
|
+
scrollTop: 0
|
|
2642
|
+
};
|
|
2643
|
+
const offsets = createCoords(0);
|
|
2644
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2645
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2646
|
+
scroll = getNodeScroll(offsetParent);
|
|
2647
|
+
}
|
|
2648
|
+
if (isOffsetParentAnElement) {
|
|
2649
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
2650
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2651
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2652
|
+
} else if (documentElement) {
|
|
2653
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2654
|
+
}
|
|
2136
2655
|
}
|
|
2656
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
2657
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
2658
|
+
return {
|
|
2659
|
+
x,
|
|
2660
|
+
y,
|
|
2661
|
+
width: rect.width,
|
|
2662
|
+
height: rect.height
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2137
2665
|
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2666
|
+
function isStaticPositioned(element) {
|
|
2667
|
+
return getComputedStyle$1(element).position === 'static';
|
|
2668
|
+
}
|
|
2141
2669
|
|
|
2142
|
-
|
|
2143
|
-
|
|
2670
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
2671
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
2672
|
+
return null;
|
|
2144
2673
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
inset: auto;
|
|
2674
|
+
if (polyfill) {
|
|
2675
|
+
return polyfill(element);
|
|
2148
2676
|
}
|
|
2677
|
+
return element.offsetParent;
|
|
2678
|
+
}
|
|
2149
2679
|
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2680
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
2681
|
+
// such as table ancestors and cross browser bugs.
|
|
2682
|
+
function getOffsetParent(element, polyfill) {
|
|
2683
|
+
const win = getWindow(element);
|
|
2684
|
+
if (isTopLayer(element)) {
|
|
2685
|
+
return win;
|
|
2155
2686
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2687
|
+
if (!isHTMLElement(element)) {
|
|
2688
|
+
let svgOffsetParent = getParentNode(element);
|
|
2689
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
2690
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
2691
|
+
return svgOffsetParent;
|
|
2692
|
+
}
|
|
2693
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
2161
2694
|
}
|
|
2695
|
+
return win;
|
|
2162
2696
|
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
top: 0;
|
|
2167
|
-
left: 0;
|
|
2168
|
-
right: 0;
|
|
2169
|
-
bottom: 0;
|
|
2170
|
-
}
|
|
2697
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
2698
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
2699
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
2171
2700
|
}
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
display: none;
|
|
2701
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
2702
|
+
return win;
|
|
2175
2703
|
}
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}: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) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
|
|
2179
|
-
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
2704
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
2705
|
+
}
|
|
2180
2706
|
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
this.edgeGap = 8;
|
|
2193
|
-
this.arrow = false;
|
|
2194
|
-
}
|
|
2195
|
-
componentDidLoad() {
|
|
2196
|
-
this.host.setAttribute('popover', '');
|
|
2197
|
-
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
2198
|
-
}
|
|
2199
|
-
disconnectedCallback() {
|
|
2200
|
-
if (typeof this.clearAutoUpdate === 'function')
|
|
2201
|
-
this.clearAutoUpdate();
|
|
2202
|
-
}
|
|
2203
|
-
/**
|
|
2204
|
-
* Programmatically display the tooltip
|
|
2205
|
-
* @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
|
|
2206
|
-
*/
|
|
2207
|
-
async show(target) {
|
|
2208
|
-
if (!this.toggleTimeoutId) {
|
|
2209
|
-
this.eventTarget = target;
|
|
2210
|
-
this.calculatePosition();
|
|
2211
|
-
this.host.showPopover();
|
|
2212
|
-
}
|
|
2707
|
+
const getElementRects = async function (data) {
|
|
2708
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
2709
|
+
const getDimensionsFn = this.getDimensions;
|
|
2710
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
2711
|
+
return {
|
|
2712
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
2713
|
+
floating: {
|
|
2714
|
+
x: 0,
|
|
2715
|
+
y: 0,
|
|
2716
|
+
width: floatingDimensions.width,
|
|
2717
|
+
height: floatingDimensions.height
|
|
2213
2718
|
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2719
|
+
};
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2722
|
+
function isRTL(element) {
|
|
2723
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
const platform = {
|
|
2727
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
2728
|
+
getDocumentElement,
|
|
2729
|
+
getClippingRect,
|
|
2730
|
+
getOffsetParent,
|
|
2731
|
+
getElementRects,
|
|
2732
|
+
getClientRects,
|
|
2733
|
+
getDimensions,
|
|
2734
|
+
getScale,
|
|
2735
|
+
isElement,
|
|
2736
|
+
isRTL
|
|
2737
|
+
};
|
|
2738
|
+
|
|
2739
|
+
// https://samthor.au/2021/observing-dom/
|
|
2740
|
+
function observeMove(element, onMove) {
|
|
2741
|
+
let io = null;
|
|
2742
|
+
let timeoutId;
|
|
2743
|
+
const root = getDocumentElement(element);
|
|
2744
|
+
function cleanup() {
|
|
2745
|
+
var _io;
|
|
2746
|
+
clearTimeout(timeoutId);
|
|
2747
|
+
(_io = io) == null || _io.disconnect();
|
|
2748
|
+
io = null;
|
|
2749
|
+
}
|
|
2750
|
+
function refresh(skip, threshold) {
|
|
2751
|
+
if (skip === void 0) {
|
|
2752
|
+
skip = false;
|
|
2222
2753
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
* @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
|
|
2226
|
-
* @param force Pass true to always show or false to always hide
|
|
2227
|
-
*/
|
|
2228
|
-
async toggle(target, force) {
|
|
2229
|
-
// Prevent instant double toggle
|
|
2230
|
-
if (!this.toggleTimeoutId) {
|
|
2231
|
-
this.eventTarget = target;
|
|
2232
|
-
this.calculatePosition();
|
|
2233
|
-
this.host.togglePopover(force);
|
|
2234
|
-
this.toggleTimeoutId = null;
|
|
2235
|
-
}
|
|
2236
|
-
return this.host.matches(':where(:popover-open, .popover-open');
|
|
2754
|
+
if (threshold === void 0) {
|
|
2755
|
+
threshold = 1;
|
|
2237
2756
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
if (isOpen) {
|
|
2248
|
-
this.startAutoupdates();
|
|
2249
|
-
}
|
|
2250
|
-
else {
|
|
2251
|
-
if (typeof this.clearAutoUpdate === 'function')
|
|
2252
|
-
this.clearAutoUpdate();
|
|
2253
|
-
}
|
|
2254
|
-
this.postToggle.emit(isOpen);
|
|
2757
|
+
cleanup();
|
|
2758
|
+
const {
|
|
2759
|
+
left,
|
|
2760
|
+
top,
|
|
2761
|
+
width,
|
|
2762
|
+
height
|
|
2763
|
+
} = element.getBoundingClientRect();
|
|
2764
|
+
if (!skip) {
|
|
2765
|
+
onMove();
|
|
2255
2766
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
* an influence on tooltip positioning
|
|
2259
|
-
*/
|
|
2260
|
-
startAutoupdates() {
|
|
2261
|
-
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
2767
|
+
if (!width || !height) {
|
|
2768
|
+
return;
|
|
2262
2769
|
}
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
Object.assign(elements.floating.style, {
|
|
2279
|
-
maxWidth: `${availableWidth - gap * 2}px`,
|
|
2280
|
-
});
|
|
2281
|
-
},
|
|
2282
|
-
}),
|
|
2283
|
-
offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
|
|
2284
|
-
];
|
|
2285
|
-
if (this.arrow) {
|
|
2286
|
-
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
2770
|
+
const insetTop = floor(top);
|
|
2771
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
2772
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
2773
|
+
const insetLeft = floor(left);
|
|
2774
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
2775
|
+
const options = {
|
|
2776
|
+
rootMargin,
|
|
2777
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
2778
|
+
};
|
|
2779
|
+
let isFirstUpdate = true;
|
|
2780
|
+
function handleObserve(entries) {
|
|
2781
|
+
const ratio = entries[0].intersectionRatio;
|
|
2782
|
+
if (ratio !== threshold) {
|
|
2783
|
+
if (!isFirstUpdate) {
|
|
2784
|
+
return refresh();
|
|
2287
2785
|
}
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
// Arrow
|
|
2297
|
-
if (this.arrow) {
|
|
2298
|
-
// Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
|
|
2299
|
-
const side = currentPlacement.split('-')[0];
|
|
2300
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
2301
|
-
const staticSide = SIDE_MAP[side];
|
|
2302
|
-
const offsetBorderLineJoin = 2;
|
|
2303
|
-
Object.assign(this.arrowRef.style, {
|
|
2304
|
-
top: arrowY ? `${arrowY}px` : '',
|
|
2305
|
-
left: arrowX ? `${arrowX}px` : '',
|
|
2306
|
-
[staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
|
|
2307
|
-
});
|
|
2308
|
-
// Add position as a class to be able to style arrow for HCM
|
|
2309
|
-
this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
|
|
2310
|
-
this.arrowRef.classList.add(staticSide);
|
|
2786
|
+
if (!ratio) {
|
|
2787
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
2788
|
+
// to prevent an infinite loop of updates.
|
|
2789
|
+
timeoutId = setTimeout(() => {
|
|
2790
|
+
refresh(false, 1e-7);
|
|
2791
|
+
}, 1000);
|
|
2792
|
+
} else {
|
|
2793
|
+
refresh(false, ratio);
|
|
2311
2794
|
}
|
|
2795
|
+
}
|
|
2796
|
+
isFirstUpdate = false;
|
|
2312
2797
|
}
|
|
2313
|
-
render() {
|
|
2314
|
-
return (h(Host, { key: '11e3be5293791aa58da291f2a0f17677ad0e0e63', "data-version": version }, this.arrow && (h("span", { key: '00d76dcd41bf267bb50290ae439c49333ade68b3', class: "arrow", ref: el => {
|
|
2315
|
-
this.arrowRef = el;
|
|
2316
|
-
} })), h("slot", { key: '7c579254fc1b76c91ddecf0952945339cf5bc7fd' })));
|
|
2317
|
-
}
|
|
2318
|
-
get host() { return getElement(this); }
|
|
2319
|
-
};
|
|
2320
|
-
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
2321
|
-
|
|
2322
|
-
const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-list{display:flex;gap:var(--post-list-title-gap);flex-direction:column;align-items:flex-start}post-list>div[role=list]{flex-direction:column;display:flex;gap:var(--post-list-item-gap)}post-list[horizontal]:not([horizontal=false]){flex-direction:row;align-items:baseline}post-list[horizontal]:not([horizontal=false])>div[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}";
|
|
2323
|
-
const PostListStyle0 = postListCss;
|
|
2324
2798
|
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
*/
|
|
2336
|
-
this.titleId = `list-${crypto.randomUUID()}`;
|
|
2337
|
-
}
|
|
2338
|
-
componentDidLoad() {
|
|
2339
|
-
this.checkTitle();
|
|
2799
|
+
// Older browsers don't support a `document` as the root and will throw an
|
|
2800
|
+
// error.
|
|
2801
|
+
try {
|
|
2802
|
+
io = new IntersectionObserver(handleObserve, {
|
|
2803
|
+
...options,
|
|
2804
|
+
// Handle <iframe>s
|
|
2805
|
+
root: root.ownerDocument
|
|
2806
|
+
});
|
|
2807
|
+
} catch (e) {
|
|
2808
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
2340
2809
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2810
|
+
io.observe(element);
|
|
2811
|
+
}
|
|
2812
|
+
refresh(true);
|
|
2813
|
+
return cleanup;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
/**
|
|
2817
|
+
* Automatically updates the position of the floating element when necessary.
|
|
2818
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
2819
|
+
* visible on the screen.
|
|
2820
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
2821
|
+
* removed from the DOM or hidden from the screen.
|
|
2822
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
2823
|
+
*/
|
|
2824
|
+
function autoUpdate(reference, floating, update, options) {
|
|
2825
|
+
if (options === void 0) {
|
|
2826
|
+
options = {};
|
|
2827
|
+
}
|
|
2828
|
+
const {
|
|
2829
|
+
ancestorScroll = true,
|
|
2830
|
+
ancestorResize = true,
|
|
2831
|
+
elementResize = typeof ResizeObserver === 'function',
|
|
2832
|
+
layoutShift = typeof IntersectionObserver === 'function',
|
|
2833
|
+
animationFrame = false
|
|
2834
|
+
} = options;
|
|
2835
|
+
const referenceEl = unwrapElement(reference);
|
|
2836
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
2837
|
+
ancestors.forEach(ancestor => {
|
|
2838
|
+
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
2839
|
+
passive: true
|
|
2840
|
+
});
|
|
2841
|
+
ancestorResize && ancestor.addEventListener('resize', update);
|
|
2842
|
+
});
|
|
2843
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
2844
|
+
let reobserveFrame = -1;
|
|
2845
|
+
let resizeObserver = null;
|
|
2846
|
+
if (elementResize) {
|
|
2847
|
+
resizeObserver = new ResizeObserver(_ref => {
|
|
2848
|
+
let [firstEntry] = _ref;
|
|
2849
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
2850
|
+
// Prevent update loops when using the `size` middleware.
|
|
2851
|
+
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
2852
|
+
resizeObserver.unobserve(floating);
|
|
2853
|
+
cancelAnimationFrame(reobserveFrame);
|
|
2854
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
2855
|
+
var _resizeObserver;
|
|
2856
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
update();
|
|
2860
|
+
});
|
|
2861
|
+
if (referenceEl && !animationFrame) {
|
|
2862
|
+
resizeObserver.observe(referenceEl);
|
|
2345
2863
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2864
|
+
resizeObserver.observe(floating);
|
|
2865
|
+
}
|
|
2866
|
+
let frameId;
|
|
2867
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
2868
|
+
if (animationFrame) {
|
|
2869
|
+
frameLoop();
|
|
2870
|
+
}
|
|
2871
|
+
function frameLoop() {
|
|
2872
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
2873
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
2874
|
+
update();
|
|
2348
2875
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2876
|
+
prevRefRect = nextRefRect;
|
|
2877
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
2878
|
+
}
|
|
2879
|
+
update();
|
|
2880
|
+
return () => {
|
|
2881
|
+
var _resizeObserver2;
|
|
2882
|
+
ancestors.forEach(ancestor => {
|
|
2883
|
+
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
2884
|
+
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
2885
|
+
});
|
|
2886
|
+
cleanupIo == null || cleanupIo();
|
|
2887
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
2888
|
+
resizeObserver = null;
|
|
2889
|
+
if (animationFrame) {
|
|
2890
|
+
cancelAnimationFrame(frameId);
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
}
|
|
2352
2894
|
|
|
2353
|
-
|
|
2354
|
-
|
|
2895
|
+
/**
|
|
2896
|
+
* Modifies the placement by translating the floating element along the
|
|
2897
|
+
* specified axes.
|
|
2898
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
2899
|
+
* object may be passed.
|
|
2900
|
+
* @see https://floating-ui.com/docs/offset
|
|
2901
|
+
*/
|
|
2902
|
+
const offset = offset$1;
|
|
2355
2903
|
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
render() {
|
|
2364
|
-
return (h(Host, { key: '25532c40e8f02f335df6b112041cbaf6056576b6', role: "listitem" }, h("slot", { key: '46ddc9e27c71040b271ab6bd59db2ac37fa4a112' })));
|
|
2365
|
-
}
|
|
2366
|
-
get host() { return getElement(this); }
|
|
2367
|
-
};
|
|
2368
|
-
PostListItem.style = PostListItemStyle0;
|
|
2904
|
+
/**
|
|
2905
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
2906
|
+
* that has the most space available automatically, without needing to specify a
|
|
2907
|
+
* preferred placement. Alternative to `flip`.
|
|
2908
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
2909
|
+
*/
|
|
2910
|
+
autoPlacement;
|
|
2369
2911
|
|
|
2370
|
-
|
|
2912
|
+
/**
|
|
2913
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
2914
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
2915
|
+
* @see https://floating-ui.com/docs/shift
|
|
2916
|
+
*/
|
|
2917
|
+
const shift = shift$1;
|
|
2371
2918
|
|
|
2372
2919
|
/**
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2376
|
-
* @
|
|
2377
|
-
* are most useful.
|
|
2378
|
-
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
2379
|
-
* as-is, to `callback` when the throttled-function is executed.
|
|
2380
|
-
* @param {object} [options] - An object to configure options.
|
|
2381
|
-
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
2382
|
-
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
2383
|
-
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
2384
|
-
* `delay` milliseconds, the internal counter is reset).
|
|
2385
|
-
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
2386
|
-
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
2387
|
-
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
2388
|
-
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
2389
|
-
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
2390
|
-
*
|
|
2391
|
-
* @returns {Function} A new, throttled, function.
|
|
2920
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
2921
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
2922
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
2923
|
+
* @see https://floating-ui.com/docs/flip
|
|
2392
2924
|
*/
|
|
2393
|
-
|
|
2394
|
-
var _ref = options || {},
|
|
2395
|
-
_ref$noTrailing = _ref.noTrailing,
|
|
2396
|
-
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
2397
|
-
_ref$noLeading = _ref.noLeading,
|
|
2398
|
-
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
2399
|
-
_ref$debounceMode = _ref.debounceMode,
|
|
2400
|
-
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
2401
|
-
/*
|
|
2402
|
-
* After wrapper has stopped being called, this timeout ensures that
|
|
2403
|
-
* `callback` is executed at the proper times in `throttle` and `end`
|
|
2404
|
-
* debounce modes.
|
|
2405
|
-
*/
|
|
2406
|
-
var timeoutID;
|
|
2407
|
-
var cancelled = false;
|
|
2925
|
+
const flip = flip$1;
|
|
2408
2926
|
|
|
2409
|
-
|
|
2410
|
-
|
|
2927
|
+
/**
|
|
2928
|
+
* Provides data that allows you to change the size of the floating element —
|
|
2929
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
2930
|
+
* width of the reference element.
|
|
2931
|
+
* @see https://floating-ui.com/docs/size
|
|
2932
|
+
*/
|
|
2933
|
+
const size = size$1;
|
|
2411
2934
|
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2935
|
+
/**
|
|
2936
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
2937
|
+
* when it is not in the same clipping context as the reference element.
|
|
2938
|
+
* @see https://floating-ui.com/docs/hide
|
|
2939
|
+
*/
|
|
2940
|
+
hide;
|
|
2418
2941
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
cancelled = !upcomingOnly;
|
|
2426
|
-
}
|
|
2942
|
+
/**
|
|
2943
|
+
* Provides data to position an inner element of the floating element so that it
|
|
2944
|
+
* appears centered to the reference element.
|
|
2945
|
+
* @see https://floating-ui.com/docs/arrow
|
|
2946
|
+
*/
|
|
2947
|
+
const arrow = arrow$1;
|
|
2427
2948
|
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2435
|
-
arguments_[_key] = arguments[_key];
|
|
2436
|
-
}
|
|
2437
|
-
var self = this;
|
|
2438
|
-
var elapsed = Date.now() - lastExec;
|
|
2439
|
-
if (cancelled) {
|
|
2440
|
-
return;
|
|
2441
|
-
}
|
|
2949
|
+
/**
|
|
2950
|
+
* Provides improved positioning for inline reference elements that can span
|
|
2951
|
+
* over multiple lines, such as hyperlinks or range selections.
|
|
2952
|
+
* @see https://floating-ui.com/docs/inline
|
|
2953
|
+
*/
|
|
2954
|
+
const inline = inline$1;
|
|
2442
2955
|
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
}
|
|
2956
|
+
/**
|
|
2957
|
+
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
2958
|
+
*/
|
|
2959
|
+
const limitShift = limitShift$1;
|
|
2448
2960
|
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
*
|
|
2489
|
-
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
2490
|
-
* after `delay` ms.
|
|
2491
|
-
*
|
|
2492
|
-
* If `debounceMode` is false (at end), schedule `callback` to
|
|
2493
|
-
* execute after `delay` ms.
|
|
2494
|
-
*/
|
|
2495
|
-
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
2496
|
-
}
|
|
2961
|
+
/**
|
|
2962
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
2963
|
+
* next to a given reference element.
|
|
2964
|
+
*/
|
|
2965
|
+
const computePosition = (reference, floating, options) => {
|
|
2966
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
2967
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
2968
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
2969
|
+
const cache = new Map();
|
|
2970
|
+
const mergedOptions = {
|
|
2971
|
+
platform,
|
|
2972
|
+
...options
|
|
2973
|
+
};
|
|
2974
|
+
const platformWithCache = {
|
|
2975
|
+
...mergedOptions.platform,
|
|
2976
|
+
_c: cache
|
|
2977
|
+
};
|
|
2978
|
+
return computePosition$1(reference, floating, {
|
|
2979
|
+
...mergedOptions,
|
|
2980
|
+
platform: platformWithCache
|
|
2981
|
+
});
|
|
2982
|
+
};
|
|
2983
|
+
|
|
2984
|
+
(()=>{var c=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:r="",...i}={}){super(t,i),this.oldState=String(o||""),this.newState=String(r||"");}},R=new WeakMap;function A(e,t,o){R.set(e,setTimeout(()=>{R.has(e)&&e.dispatchEvent(new c("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var D=globalThis.ShadowRoot||function(){},z=globalThis.HTMLDialogElement||function(){},M=new WeakMap,p=new WeakMap,h=new WeakMap;function L(e){return h.get(e)||"hidden"}var b=new WeakMap;function O(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let o=L(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?m(t,!0,!0):d(t,!1)&&(b.set(t,e),S(t)));}function d(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&L(e)!=="showing"||!t&&L(e)!=="hidden"||e instanceof z&&e.hasAttribute("open")||document.fullscreenElement===e)}function N(e){return e?Array.from(p.get(e.ownerDocument)||[]).indexOf(e)+1:0}function V(e){let t=W(e),o=U(e);return N(t)>N(o)?t:o}function y(e){let t=p.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function v(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?v(e.parentNode):e}function W(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&h.get(e)==="showing")return e;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function U(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function G(e){let t=new Map,o=0,r=e.ownerDocument;for(let a of p.get(r)||[])t.set(a,o),o+=1;t.set(e,o),o+=1;let i=null;function l(a){let g=W(a);if(g===null)return null;let n=t.get(g);(i===null||t.get(i)<n)&&(i=g);}return l(e?.parentElement),i}function Q(e){return e.hidden||e instanceof D||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type==="hidden"||e instanceof HTMLAnchorElement&&e.href===""?!1:typeof e.tabIndex=="number"&&e.tabIndex!==-1}function _(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let o=t.querySelector("[autofocus]");if(o)return o;{let l=t.querySelectorAll("slot");for(let a of l){let g=a.assignedElements({flatten:!0});for(let n of g){if(n.hasAttribute("autofocus"))return n;if(o=n.querySelector("[autofocus]"),o)return o}}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(Q(i))return i;i=r.nextNode();}}function $(e){_(e)?.focus();}var H=new WeakMap;function S(e){if(!d(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new c("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!d(e,!1))return;let o=!1;if(e.popover==="auto"){let i=e.getAttribute("popover"),l=G(e)||t;if(T(l,!1,!0),i!==e.getAttribute("popover")||!d(e,!1))return}y(t)||(o=!0),H.delete(e);let r=t.activeElement;e.classList.add(":popover-open"),h.set(e,"showing"),M.has(t)||M.set(t,new Set),M.get(t).add(e),$(e),e.popover==="auto"&&(p.has(t)||p.set(t,new Set),p.get(t).add(e),q(b.get(e),!0)),o&&r&&e.popover==="auto"&&H.set(e,r),A(e,"closed","open");}function m(e,t=!1,o=!1){if(!d(e,!0))return;let r=e.ownerDocument;if(e.popover==="auto"&&(T(e,t,o),!d(e,!0))||(q(b.get(e),!1),b.delete(e),o&&(e.dispatchEvent(new c("beforetoggle",{oldState:"open",newState:"closed"})),!d(e,!0))))return;M.get(r)?.delete(e),p.get(r)?.delete(e),e.classList.remove(":popover-open"),h.set(e,"hidden"),o&&A(e,"open","closed");let i=H.get(e);i&&(H.delete(e),t&&i.focus());}function F(e,t=!1,o=!1){let r=y(e);for(;r;)m(r,t,o),r=y(e);}function T(e,t,o){let r=e.ownerDocument||e;if(e instanceof Document)return F(r,t,o);let i=null,l=!1;for(let a of p.get(r)||[])if(a===e)l=!0;else if(l){i=a;break}if(!l)return F(r,t,o);for(;i&&L(i)==="showing"&&p.get(r)?.size;)m(i,t,o);}var P=new WeakMap;function x(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!y(o))return;let i=V(t);if(i&&e.type==="pointerdown")P.set(o,i);else if(e.type==="pointerup"){let l=P.get(o)===i;P.delete(o),l&&T(i||o,!1,!0);}}var k=new WeakMap;function q(e,t=!1){if(!e)return;k.has(e)||k.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o instanceof HTMLElement&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let r=k.get(e);r?e.setAttribute("aria-expanded",r):e.removeAttribute("aria-expanded");}}var B=globalThis.ShadowRoot||function(){};function j(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function f(e,t,o){let r=e[t];Object.defineProperty(e,t,{value(i){return r.call(this,o(i))}});}var J=/(^|[^\\]):popover-open\b/g,C=`
|
|
2985
|
+
:where([popover]) {
|
|
2986
|
+
position: fixed;
|
|
2987
|
+
z-index: 2147483647;
|
|
2988
|
+
inset: 0;
|
|
2989
|
+
padding: 0.25em;
|
|
2990
|
+
width: fit-content;
|
|
2991
|
+
height: fit-content;
|
|
2992
|
+
border-width: initial;
|
|
2993
|
+
border-color: initial;
|
|
2994
|
+
border-image: initial;
|
|
2995
|
+
border-style: solid;
|
|
2996
|
+
background-color: canvas;
|
|
2997
|
+
color: canvastext;
|
|
2998
|
+
overflow: auto;
|
|
2999
|
+
margin: auto;
|
|
2497
3000
|
}
|
|
2498
|
-
wrapper.cancel = cancel;
|
|
2499
3001
|
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
}
|
|
3002
|
+
:where(dialog[popover][open]) {
|
|
3003
|
+
display: revert;
|
|
3004
|
+
}
|
|
2503
3005
|
|
|
2504
|
-
|
|
2505
|
-
|
|
3006
|
+
:where([anchor].\\:popover-open) {
|
|
3007
|
+
inset: auto;
|
|
3008
|
+
}
|
|
2506
3009
|
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
}
|
|
2516
|
-
componentWillRender() {
|
|
2517
|
-
this.scrollParent = this.getScrollParent(this.host);
|
|
2518
|
-
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
2519
|
-
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
2520
|
-
this.handleResize();
|
|
2521
|
-
this.handleScrollEvent();
|
|
2522
|
-
}
|
|
2523
|
-
handlePostMainNavigationClosed() {
|
|
2524
|
-
this.mobileMenuExtended = false;
|
|
2525
|
-
}
|
|
2526
|
-
handleScrollEvent() {
|
|
2527
|
-
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
2528
|
-
const st = Math.max(0, this.scrollParent instanceof Document
|
|
2529
|
-
? this.scrollParent.documentElement.scrollTop
|
|
2530
|
-
: this.scrollParent.scrollTop);
|
|
2531
|
-
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
2532
|
-
}
|
|
2533
|
-
getScrollParent(node) {
|
|
2534
|
-
let currentParent = node.parentElement;
|
|
2535
|
-
while (currentParent) {
|
|
2536
|
-
if (currentParent.nodeName === 'BODY') {
|
|
2537
|
-
return document;
|
|
2538
|
-
}
|
|
2539
|
-
if (this.isScrollable(currentParent)) {
|
|
2540
|
-
return currentParent;
|
|
2541
|
-
}
|
|
2542
|
-
currentParent = currentParent.parentElement;
|
|
2543
|
-
}
|
|
2544
|
-
return document;
|
|
2545
|
-
}
|
|
2546
|
-
isScrollable(node) {
|
|
2547
|
-
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
2548
|
-
return false;
|
|
2549
|
-
}
|
|
2550
|
-
const style = getComputedStyle(node);
|
|
2551
|
-
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
2552
|
-
const value = style.getPropertyValue(propertyName);
|
|
2553
|
-
return value === 'auto' || value === 'scroll';
|
|
2554
|
-
});
|
|
2555
|
-
}
|
|
2556
|
-
handleResize() {
|
|
2557
|
-
const width = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
2558
|
-
if (width >= 1024) {
|
|
2559
|
-
this.device = 'desktop';
|
|
2560
|
-
this.mobileMenuExtended = false; // Close any open mobile menu
|
|
2561
|
-
}
|
|
2562
|
-
else if (width >= 600) {
|
|
2563
|
-
this.device = 'tablet';
|
|
2564
|
-
}
|
|
2565
|
-
else {
|
|
2566
|
-
this.device = 'mobile';
|
|
2567
|
-
}
|
|
3010
|
+
:where([anchor]:popover-open) {
|
|
3011
|
+
inset: auto;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
@supports not (background-color: canvas) {
|
|
3015
|
+
:where([popover]) {
|
|
3016
|
+
background-color: white;
|
|
3017
|
+
color: black;
|
|
2568
3018
|
}
|
|
2569
|
-
|
|
2570
|
-
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
@supports (width: -moz-fit-content) {
|
|
3022
|
+
:where([popover]) {
|
|
3023
|
+
width: -moz-fit-content;
|
|
3024
|
+
height: -moz-fit-content;
|
|
2571
3025
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
@supports not (inset: 0) {
|
|
3029
|
+
:where([popover]) {
|
|
3030
|
+
top: 0;
|
|
3031
|
+
left: 0;
|
|
3032
|
+
right: 0;
|
|
3033
|
+
bottom: 0;
|
|
2578
3034
|
}
|
|
2579
|
-
|
|
2580
|
-
};
|
|
2581
|
-
PostHeader.style = PostHeaderStyle0;
|
|
3035
|
+
}
|
|
2582
3036
|
|
|
2583
|
-
|
|
2584
|
-
|
|
3037
|
+
:where([popover]:not(.\\:popover-open)) {
|
|
3038
|
+
display: none;
|
|
3039
|
+
}
|
|
3040
|
+
`,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
|
|
2585
3041
|
|
|
2586
|
-
const
|
|
3042
|
+
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}: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) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
|
|
3043
|
+
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
3044
|
+
|
|
3045
|
+
const SIDE_MAP = {
|
|
3046
|
+
top: 'bottom',
|
|
3047
|
+
right: 'left',
|
|
3048
|
+
bottom: 'top',
|
|
3049
|
+
left: 'right',
|
|
3050
|
+
};
|
|
3051
|
+
const PostPopovercontainer = class {
|
|
2587
3052
|
constructor(hostRef) {
|
|
2588
3053
|
registerInstance(this, hostRef);
|
|
2589
3054
|
this.postToggle = createEvent(this, "postToggle", 7);
|
|
3055
|
+
this.placement = 'top';
|
|
3056
|
+
this.edgeGap = 8;
|
|
3057
|
+
this.arrow = false;
|
|
2590
3058
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
let target = event.target;
|
|
2595
|
-
while (target !== null) {
|
|
2596
|
-
if (target.tagName === 'POST-MEGADROPDOWN') {
|
|
2597
|
-
megalodon = target;
|
|
2598
|
-
break;
|
|
2599
|
-
}
|
|
2600
|
-
target = target.nextElementSibling;
|
|
2601
|
-
}
|
|
2602
|
-
if (megalodon)
|
|
2603
|
-
megalodon.toggle(event.target);
|
|
3059
|
+
componentDidLoad() {
|
|
3060
|
+
this.host.setAttribute('popover', '');
|
|
3061
|
+
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
2604
3062
|
}
|
|
2605
|
-
|
|
2606
|
-
this.
|
|
3063
|
+
disconnectedCallback() {
|
|
3064
|
+
if (typeof this.clearAutoUpdate === 'function')
|
|
3065
|
+
this.clearAutoUpdate();
|
|
2607
3066
|
}
|
|
2608
|
-
|
|
2609
|
-
|
|
3067
|
+
/**
|
|
3068
|
+
* Programmatically display the tooltip
|
|
3069
|
+
* @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
|
|
3070
|
+
*/
|
|
3071
|
+
async show(target) {
|
|
3072
|
+
if (!this.toggleTimeoutId) {
|
|
3073
|
+
this.eventTarget = target;
|
|
3074
|
+
this.calculatePosition();
|
|
3075
|
+
this.host.showPopover();
|
|
3076
|
+
}
|
|
2610
3077
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
registerInstance(this, hostRef);
|
|
3078
|
+
/**
|
|
3079
|
+
* Programmatically hide this tooltip
|
|
3080
|
+
*/
|
|
3081
|
+
async hide() {
|
|
3082
|
+
if (!this.toggleTimeoutId) {
|
|
3083
|
+
this.eventTarget = null;
|
|
3084
|
+
this.host.hidePopover();
|
|
3085
|
+
}
|
|
2620
3086
|
}
|
|
2621
3087
|
/**
|
|
2622
|
-
*
|
|
2623
|
-
* @param element
|
|
2624
|
-
* @
|
|
3088
|
+
* Toggle tooltip display
|
|
3089
|
+
* @param target An element with [data-tooltip-target="id"] where the tooltip should be shown
|
|
3090
|
+
* @param force Pass true to always show or false to always hide
|
|
2625
3091
|
*/
|
|
2626
|
-
async
|
|
2627
|
-
|
|
3092
|
+
async toggle(target, force) {
|
|
3093
|
+
// Prevent instant double toggle
|
|
3094
|
+
if (!this.toggleTimeoutId) {
|
|
3095
|
+
this.eventTarget = target;
|
|
3096
|
+
this.calculatePosition();
|
|
3097
|
+
this.host.togglePopover(force);
|
|
3098
|
+
this.toggleTimeoutId = null;
|
|
3099
|
+
}
|
|
3100
|
+
return this.host.matches(':where(:popover-open, .popover-open');
|
|
2628
3101
|
}
|
|
2629
3102
|
/**
|
|
2630
|
-
*
|
|
2631
|
-
*
|
|
3103
|
+
* Start or stop auto updates based on tooltip events.
|
|
3104
|
+
* Tooltips can be closed or opened with other methods than class members,
|
|
3105
|
+
* therefore listening to the toggle event is safer for cleaning up.
|
|
3106
|
+
* @param e ToggleEvent
|
|
2632
3107
|
*/
|
|
2633
|
-
|
|
2634
|
-
|
|
3108
|
+
handleToggle(e) {
|
|
3109
|
+
this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
|
|
3110
|
+
const isOpen = e.newState === 'open';
|
|
3111
|
+
if (isOpen) {
|
|
3112
|
+
this.startAutoupdates();
|
|
3113
|
+
}
|
|
3114
|
+
else {
|
|
3115
|
+
if (typeof this.clearAutoUpdate === 'function')
|
|
3116
|
+
this.clearAutoUpdate();
|
|
3117
|
+
}
|
|
3118
|
+
this.postToggle.emit(isOpen);
|
|
2635
3119
|
}
|
|
2636
3120
|
/**
|
|
2637
|
-
*
|
|
2638
|
-
*
|
|
2639
|
-
* @param force boolean
|
|
2640
|
-
* @returns boolean
|
|
3121
|
+
* Start listening for DOM updates, scroll events etc. that have
|
|
3122
|
+
* an influence on tooltip positioning
|
|
2641
3123
|
*/
|
|
2642
|
-
|
|
2643
|
-
|
|
3124
|
+
startAutoupdates() {
|
|
3125
|
+
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
2644
3126
|
}
|
|
2645
|
-
|
|
2646
|
-
this.
|
|
3127
|
+
async calculatePosition() {
|
|
3128
|
+
const gap = this.edgeGap;
|
|
3129
|
+
const middleware = [
|
|
3130
|
+
flip(),
|
|
3131
|
+
inline(),
|
|
3132
|
+
shift({
|
|
3133
|
+
padding: gap,
|
|
3134
|
+
// Prevents shifting away from the anchor too far, while shifting as far as possible
|
|
3135
|
+
// https://floating-ui.com/docs/shift#limiter
|
|
3136
|
+
limiter: limitShift({
|
|
3137
|
+
offset: 32,
|
|
3138
|
+
}),
|
|
3139
|
+
}),
|
|
3140
|
+
size({
|
|
3141
|
+
apply({ availableWidth, elements }) {
|
|
3142
|
+
Object.assign(elements.floating.style, {
|
|
3143
|
+
maxWidth: `${availableWidth - gap * 2}px`,
|
|
3144
|
+
});
|
|
3145
|
+
},
|
|
3146
|
+
}),
|
|
3147
|
+
offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
|
|
3148
|
+
];
|
|
3149
|
+
if (this.arrow) {
|
|
3150
|
+
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
3151
|
+
}
|
|
3152
|
+
const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
|
|
3153
|
+
placement: this.placement || 'top',
|
|
3154
|
+
strategy: 'fixed',
|
|
3155
|
+
middleware,
|
|
3156
|
+
});
|
|
3157
|
+
// Tooltip
|
|
3158
|
+
this.host.style.left = `${x}px`;
|
|
3159
|
+
this.host.style.top = `${y}px`;
|
|
3160
|
+
// Arrow
|
|
3161
|
+
if (this.arrow) {
|
|
3162
|
+
// Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
|
|
3163
|
+
const side = currentPlacement.split('-')[0];
|
|
3164
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
3165
|
+
const staticSide = SIDE_MAP[side];
|
|
3166
|
+
const offsetBorderLineJoin = 2;
|
|
3167
|
+
Object.assign(this.arrowRef.style, {
|
|
3168
|
+
top: arrowY ? `${arrowY}px` : '',
|
|
3169
|
+
left: arrowX ? `${arrowX}px` : '',
|
|
3170
|
+
[staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
|
|
3171
|
+
});
|
|
3172
|
+
// Add position as a class to be able to style arrow for HCM
|
|
3173
|
+
this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
|
|
3174
|
+
this.arrowRef.classList.add(staticSide);
|
|
3175
|
+
}
|
|
2647
3176
|
}
|
|
2648
3177
|
render() {
|
|
2649
|
-
return (h(Host, { key: '
|
|
3178
|
+
return (h(Host, { key: '23e391236e263f7ae7c66c994b2847bcba269b37', "data-version": version }, this.arrow && (h("span", { key: '6c6053b2fd315a5940a2c3493182249782b2492c', class: "arrow", ref: el => {
|
|
3179
|
+
this.arrowRef = el;
|
|
3180
|
+
} })), h("slot", { key: 'ff998f110f42a22e886eba398285c41d94718bab' })));
|
|
2650
3181
|
}
|
|
3182
|
+
get host() { return getElement(this); }
|
|
2651
3183
|
};
|
|
2652
|
-
|
|
3184
|
+
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
2653
3185
|
|
|
2654
|
-
const
|
|
2655
|
-
const
|
|
3186
|
+
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}";
|
|
3187
|
+
const PostTogglebuttonStyle0 = postTogglebuttonCss;
|
|
2656
3188
|
|
|
2657
|
-
const
|
|
3189
|
+
const PostTogglebutton = class {
|
|
2658
3190
|
constructor(hostRef) {
|
|
2659
3191
|
registerInstance(this, hostRef);
|
|
2660
|
-
this.
|
|
3192
|
+
this.handleClick = () => {
|
|
3193
|
+
this.toggled = !this.toggled;
|
|
3194
|
+
};
|
|
3195
|
+
this.handleKeydown = (event) => {
|
|
3196
|
+
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
3197
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
3198
|
+
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
3199
|
+
this.host.click();
|
|
3200
|
+
}
|
|
3201
|
+
};
|
|
2661
3202
|
this.toggled = false;
|
|
2662
3203
|
}
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
3204
|
+
validateToggled(value = this.toggled) {
|
|
3205
|
+
checkType(value, 'boolean', 'The "toggled" property of the post-togglebutton must be a boolean.');
|
|
3206
|
+
}
|
|
3207
|
+
componentWillLoad() {
|
|
3208
|
+
this.validateToggled();
|
|
3209
|
+
// add event listener to not override listener that might be set on the host
|
|
3210
|
+
this.host.addEventListener('click', () => this.handleClick());
|
|
3211
|
+
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
2666
3212
|
}
|
|
2667
3213
|
render() {
|
|
2668
|
-
return (h(Host, { key: '
|
|
3214
|
+
return (h(Host, { key: 'f20b7e5f7cd14c1b0addf12600df27e7e5dab841', slot: "post-togglebutton", "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '526540ce9a66fa08f0142e674811fe88e3abcfa6' })));
|
|
2669
3215
|
}
|
|
3216
|
+
get host() { return getElement(this); }
|
|
3217
|
+
static get watchers() { return {
|
|
3218
|
+
"toggled": ["validateToggled"]
|
|
3219
|
+
}; }
|
|
2670
3220
|
};
|
|
2671
|
-
|
|
3221
|
+
PostTogglebutton.style = PostTogglebuttonStyle0;
|
|
2672
3222
|
|
|
2673
|
-
export { PostClosebutton as P,
|
|
3223
|
+
export { PostClosebutton as P, PostHeader as a, PostIcon as b, PostLanguageOption as c, PostLanguageSwitch as d, PostList as e, PostListItem as f, PostLogo as g, PostMainnavigation as h, PostMegadropdown as i, PostMegadropdownTrigger as j, PostMenu as k, PostMenuTrigger as l, PostPopovercontainer as m, PostTogglebutton as n };
|