@swisspost/design-system-components 9.0.0-next.32 → 9.0.0-next.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{attribute-observer-6d8b886b.js → attribute-observer-c3a805b2.js} +3 -1
- package/dist/cjs/{breakpoints-c6247c71.js → breakpoints-cdf1b747.js} +12 -7
- package/dist/cjs/event-guard-efabc84f.js +47 -0
- package/dist/cjs/get-root-8102fecd.js +17 -0
- package/dist/cjs/{index-d6bf2c66.js → index-b60129c4.js} +2 -2
- package/dist/cjs/index.cjs.js +25 -25
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/long-press-event-6e62d113.js +266 -0
- package/dist/cjs/{package-6f8f430c.js → package-3426e8f7.js} +1 -1
- package/dist/cjs/{post-accordion-e3a6d78e.js → post-accordion-3ac8dca8.js} +10 -12
- package/dist/cjs/{post-accordion-item-7ed1f630.js → post-accordion-item-aace6bc2.js} +10 -10
- package/dist/cjs/post-accordion-item.cjs.entry.js +5 -3
- package/dist/cjs/post-accordion.cjs.entry.js +5 -3
- package/dist/cjs/{post-avatar-de8ec197.js → post-avatar-53abd22f.js} +5 -4
- package/dist/cjs/post-avatar.cjs.entry.js +4 -3
- package/dist/cjs/post-back-to-top-b231fc1c.js +96 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +4 -3
- package/dist/cjs/{post-banner-bf523706.js → post-banner-e6d14bf1.js} +4 -8
- package/dist/cjs/post-banner.cjs.entry.js +4 -3
- package/dist/cjs/{post-breadcrumb-da55143a.js → post-breadcrumb-a929f2a6.js} +30 -22
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +4 -3
- package/dist/cjs/post-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/{post-card-control-0bcd7d16.js → post-card-control-cbee7b86.js} +26 -40
- package/dist/cjs/post-card-control.cjs.entry.js +4 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +6 -5
- package/dist/cjs/{post-collapsible-trigger-a5e4451d.js → post-collapsible-trigger-d1cb592a.js} +39 -46
- package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -5
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/{post-footer-b15fee73.js → post-footer-4290dafc.js} +11 -11
- package/dist/cjs/post-footer.cjs.entry.js +4 -4
- package/dist/cjs/{post-linkarea-8c85bf5e.js → post-linkarea-f22f4f92.js} +5 -5
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/{post-menu-item-509877cd.js → post-menu-item-afabaa61.js} +4 -4
- package/dist/cjs/{post-popover-1213aa19.js → post-popover-a4c72d38.js} +16 -14
- package/dist/cjs/post-popover.cjs.entry.js +5 -4
- package/dist/cjs/{post-rating-e1f8a668.js → post-rating-b87616fc.js} +4 -14
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-889a6c64.js → post-tab-header-45cb6bb4.js} +5 -4
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-300f39a9.js → post-tab-panel-00d16ba7.js} +4 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-dc281228.js → post-tabs-2c3a89d0.js} +5 -12
- package/dist/cjs/post-tabs.cjs.entry.js +4 -3
- package/dist/cjs/{post-tag-fd9e586f.js → post-tag-370a2f4d.js} +3 -3
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-togglebutton-ad6ae1e4.js → post-togglebutton-2c9552e3.js} +969 -471
- package/dist/cjs/{post-tooltip-52d690e4.js → post-tooltip-4d4d2ea9.js} +39 -296
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
- package/dist/collection/animations/collapse.js +3 -1
- package/dist/collection/components/post-accordion/post-accordion.js +6 -10
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +6 -8
- package/dist/collection/components/post-avatar/post-avatar.js +3 -4
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +37 -19
- package/dist/collection/components/post-banner/post-banner.js +0 -6
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +16 -19
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +0 -2
- package/dist/collection/components/post-card-control/post-card-control.js +24 -40
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -0
- package/dist/collection/components/post-closebutton/post-closebutton.js +12 -2
- package/dist/collection/components/post-collapsible/post-collapsible.js +4 -10
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +29 -32
- package/dist/collection/components/post-footer/post-footer.js +8 -9
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +16 -19
- package/dist/collection/components/post-icon/post-icon.js +5 -7
- package/dist/collection/components/post-language-option/post-language-option.js +1 -10
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -1
- package/dist/collection/components/post-language-switch/post-language-switch.js +25 -31
- package/dist/collection/components/post-linkarea/post-linkarea.css +1 -1
- package/dist/collection/components/post-linkarea/post-linkarea.js +2 -2
- package/dist/collection/components/post-list/post-list.js +1 -3
- package/dist/collection/components/post-list-item/post-list-item.js +1 -2
- package/dist/collection/components/post-logo/post-logo.js +1 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +98 -182
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +20 -30
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +42 -36
- package/dist/collection/components/post-menu/post-menu.js +51 -52
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +13 -15
- package/dist/collection/components/post-popover/post-popover.js +12 -12
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +30 -33
- package/dist/collection/components/post-rating/post-rating.js +1 -12
- package/dist/collection/components/post-tab-header/post-tab-header.js +2 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -3
- package/dist/collection/components/post-tabs/post-tabs.js +1 -10
- package/dist/collection/components/post-tag/post-tag.js +0 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +10 -11
- package/dist/collection/components/post-tooltip/post-tooltip.js +36 -32
- package/dist/collection/utils/attribute-observer.js +2 -1
- package/dist/collection/utils/breakpoints.js +9 -7
- package/dist/collection/utils/environment.js +2 -0
- package/dist/collection/utils/event-guard.js +43 -0
- package/dist/collection/utils/get-root.js +6 -1
- package/dist/collection/utils/index.js +5 -0
- package/dist/collection/utils/is-motion-reduced.js +2 -1
- package/dist/components/attribute-observer.js +3 -1
- package/dist/components/breakpoints.js +12 -8
- package/dist/components/event-guard.js +45 -0
- package/dist/components/get-root.js +7 -1
- package/dist/components/long-press-event.js +264 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +8 -8
- package/dist/components/post-accordion2.js +8 -10
- package/dist/components/post-avatar2.js +4 -3
- package/dist/components/post-back-to-top2.js +40 -20
- package/dist/components/post-banner2.js +2 -6
- package/dist/components/post-breadcrumb-item2.js +2 -2
- package/dist/components/post-breadcrumb2.js +28 -20
- package/dist/components/post-card-control2.js +25 -39
- package/dist/components/post-closebutton2.js +8 -3
- package/dist/components/post-collapsible-trigger2.js +33 -35
- package/dist/components/post-collapsible2.js +9 -12
- package/dist/components/post-footer2.js +8 -8
- package/dist/components/post-header2.js +18 -20
- package/dist/components/post-icon2.js +6 -6
- package/dist/components/post-language-option2.js +3 -10
- package/dist/components/post-language-switch2.js +28 -31
- package/dist/components/post-linkarea2.js +5 -4
- package/dist/components/post-list-item2.js +2 -2
- package/dist/components/post-list2.js +2 -3
- package/dist/components/post-logo2.js +3 -2
- package/dist/components/post-mainnavigation2.js +94 -182
- package/dist/components/post-megadropdown-trigger2.js +44 -36
- package/dist/components/post-megadropdown2.js +22 -31
- package/dist/components/post-menu-trigger2.js +15 -15
- package/dist/components/post-menu2.js +53 -52
- package/dist/components/post-popover2.js +14 -12
- package/dist/components/post-popovercontainer2.js +638 -36
- package/dist/components/post-rating2.js +2 -12
- package/dist/components/post-tab-header2.js +4 -3
- package/dist/components/post-tab-panel2.js +3 -3
- package/dist/components/post-tabs2.js +3 -10
- package/dist/components/post-tag2.js +1 -1
- package/dist/components/post-togglebutton2.js +12 -11
- package/dist/components/post-tooltip2.js +37 -294
- package/dist/docs.json +21 -15
- package/dist/esm/{attribute-observer-2f203993.js → attribute-observer-009deee5.js} +3 -1
- package/dist/esm/{breakpoints-bbe0c54e.js → breakpoints-7812702e.js} +12 -8
- package/dist/esm/event-guard-538ee077.js +45 -0
- package/dist/esm/get-root-1b1af46f.js +15 -0
- package/dist/esm/{index-3419e46d.js → index-f4d19816.js} +2 -2
- package/dist/esm/index.js +25 -25
- package/dist/esm/loader.js +3 -3
- package/dist/esm/long-press-event-04d24397.js +264 -0
- package/dist/esm/package-8986a24c.js +3 -0
- package/dist/esm/{post-accordion-7b6fb9c3.js → post-accordion-577b52a0.js} +10 -12
- package/dist/esm/{post-accordion-item-d40c0b26.js → post-accordion-item-99053b41.js} +10 -10
- package/dist/esm/post-accordion-item.entry.js +5 -3
- package/dist/esm/post-accordion.entry.js +5 -3
- package/dist/esm/{post-avatar-04ca6e3e.js → post-avatar-2914706c.js} +5 -4
- package/dist/esm/post-avatar.entry.js +4 -3
- package/dist/esm/post-back-to-top-4c7b1b47.js +94 -0
- package/dist/esm/post-back-to-top.entry.js +4 -3
- package/dist/esm/{post-banner-7c37e3ef.js → post-banner-295fd0f5.js} +4 -8
- package/dist/esm/post-banner.entry.js +4 -3
- package/dist/esm/{post-breadcrumb-59e4d655.js → post-breadcrumb-1abfb312.js} +30 -22
- package/dist/esm/post-breadcrumb-item_2.entry.js +4 -3
- package/dist/esm/post-breadcrumb.entry.js +4 -4
- package/dist/esm/{post-card-control-5471488b.js → post-card-control-ad72d4f8.js} +26 -40
- package/dist/esm/post-card-control.entry.js +4 -3
- package/dist/esm/post-closebutton_15.entry.js +6 -5
- package/dist/esm/{post-collapsible-trigger-1f6d816e.js → post-collapsible-trigger-6b4ece20.js} +39 -46
- package/dist/esm/post-collapsible_2.entry.js +6 -5
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/{post-footer-d30f4dc8.js → post-footer-a5105e66.js} +11 -11
- package/dist/esm/post-footer.entry.js +4 -4
- package/dist/esm/{post-linkarea-8e1a561e.js → post-linkarea-22f97a88.js} +5 -5
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/{post-menu-item-0c8477eb.js → post-menu-item-9465a1f3.js} +4 -4
- package/dist/esm/{post-popover-c43969ca.js → post-popover-e9b4569c.js} +16 -14
- package/dist/esm/post-popover.entry.js +5 -4
- package/dist/esm/{post-rating-94148df7.js → post-rating-ae16e3c9.js} +4 -14
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-82df0ba9.js → post-tab-header-11f23150.js} +5 -4
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-a6512f53.js → post-tab-panel-0f3a952e.js} +4 -4
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-d26ce341.js → post-tabs-1192509c.js} +5 -12
- package/dist/esm/post-tabs.entry.js +4 -3
- package/dist/esm/{post-tag-41d1667e.js → post-tag-8be0a71c.js} +3 -3
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-togglebutton-4f94bddb.js → post-togglebutton-b634fc7c.js} +969 -471
- package/dist/esm/{post-tooltip-20f916db.js → post-tooltip-f64bd0cc.js} +39 -296
- package/dist/esm/post-tooltip.entry.js +5 -4
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0889c759.js +1 -0
- package/dist/post-components/p-0f398677.js +1 -0
- package/dist/post-components/p-1038fc25.js +1 -0
- package/dist/post-components/p-30f94eca.entry.js +1 -0
- package/dist/post-components/p-31bb6dc5.entry.js +1 -0
- package/dist/post-components/p-32173742.js +1 -0
- package/dist/post-components/p-338a2507.js +1 -0
- package/dist/post-components/p-36540dd6.entry.js +1 -0
- package/dist/post-components/p-3aa766a6.js +1 -0
- package/dist/post-components/p-3b0158b3.js +1 -0
- package/dist/post-components/p-40db8cd5.js +1 -0
- package/dist/post-components/p-44f13ce4.entry.js +1 -0
- package/dist/post-components/p-46a9324f.entry.js +1 -0
- package/dist/post-components/p-49c5aa99.js +1 -0
- package/dist/post-components/p-4cd4a936.entry.js +1 -0
- package/dist/post-components/p-548ef2f5.entry.js +1 -0
- package/dist/post-components/p-58f453dd.js +1 -0
- package/dist/post-components/p-5f54b77f.js +1 -0
- package/dist/post-components/p-60bb7f26.js +1 -0
- package/dist/post-components/p-60bfa4be.entry.js +1 -0
- package/dist/post-components/p-6b31a76a.js +1 -0
- package/dist/post-components/p-6ee81c5d.js +1 -0
- package/dist/post-components/p-6faad212.entry.js +1 -0
- package/dist/post-components/p-722ffaae.js +1 -0
- package/dist/post-components/p-74a0b44c.entry.js +1 -0
- package/dist/post-components/{p-28e77ad3.js → p-78b4c699.js} +1 -1
- package/dist/post-components/p-7aa0468b.entry.js +1 -0
- package/dist/post-components/p-7afc495e.entry.js +1 -0
- package/dist/post-components/p-8db32dab.js +8 -0
- package/dist/post-components/p-96034ba4.entry.js +1 -0
- package/dist/post-components/p-9aaf9f54.js +1 -0
- package/dist/post-components/{p-5c758f41.js → p-9e461613.js} +1 -1
- package/dist/post-components/p-ab4073be.js +1 -0
- package/dist/post-components/p-abd7eb91.js +8 -0
- package/dist/post-components/p-afb8a487.entry.js +1 -0
- package/dist/post-components/p-b003b381.js +1 -0
- package/dist/post-components/p-b97dea1e.entry.js +1 -0
- package/dist/post-components/p-be37cf2a.js +1 -0
- package/dist/post-components/p-c31b56ed.js +1 -0
- package/dist/post-components/p-ccbb51fe.js +1 -0
- package/dist/post-components/p-d3900385.entry.js +1 -0
- package/dist/post-components/p-ef49153c.entry.js +1 -0
- package/dist/post-components/p-f27e5691.js +1 -0
- package/dist/post-components/p-f553019f.entry.js +1 -0
- package/dist/post-components/p-ffc1db17.entry.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-avatar/post-avatar.d.ts +1 -1
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +3 -1
- package/dist/types/components/post-card-control/post-card-control.d.ts +1 -1
- package/dist/types/components/post-collapsible-trigger/post-collapsible-trigger.d.ts +9 -14
- package/dist/types/components/post-footer/post-footer.d.ts +2 -2
- package/dist/types/components/post-header/post-header.d.ts +1 -0
- package/dist/types/components/post-icon/post-icon.d.ts +0 -1
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +5 -5
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +14 -39
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +2 -0
- package/dist/types/components/post-menu/post-menu.d.ts +1 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +1 -1
- package/dist/types/components/post-popover/post-popover.d.ts +3 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +1 -1
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +6 -1
- package/dist/types/components.d.ts +4 -4
- package/dist/types/popover-fn.d.ts +11 -0
- package/dist/types/utils/environment.d.ts +2 -0
- package/dist/types/utils/event-guard.d.ts +4 -0
- package/dist/types/utils/get-root.d.ts +4 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/loaders/attribute-observer.js +3 -1
- package/loaders/breakpoints.js +12 -8
- package/loaders/event-guard.js +45 -0
- package/loaders/get-root.js +7 -1
- package/loaders/index.js +3 -3
- package/loaders/long-press-event.js +264 -0
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item2.js +8 -8
- package/loaders/post-accordion.js +8 -10
- package/loaders/post-avatar.js +4 -3
- package/loaders/post-back-to-top.js +40 -20
- package/loaders/post-banner.js +2 -6
- package/loaders/post-breadcrumb-item2.js +2 -2
- package/loaders/post-breadcrumb.js +28 -20
- package/loaders/post-card-control.js +25 -39
- package/loaders/post-closebutton.js +8 -3
- package/loaders/post-collapsible-trigger2.js +33 -35
- package/loaders/post-collapsible2.js +9 -12
- package/loaders/post-footer.js +8 -8
- package/loaders/post-header.js +18 -20
- package/loaders/post-icon2.js +6 -6
- package/loaders/post-language-option.js +3 -10
- package/loaders/post-language-switch.js +28 -31
- package/loaders/post-linkarea.js +5 -4
- package/loaders/post-list-item.js +2 -2
- package/loaders/post-list.js +2 -3
- package/loaders/post-logo.js +3 -2
- package/loaders/post-mainnavigation.js +94 -182
- package/loaders/post-megadropdown-trigger.js +44 -36
- package/loaders/post-megadropdown.js +22 -31
- package/loaders/post-menu-trigger2.js +15 -15
- package/loaders/post-menu2.js +53 -52
- package/loaders/post-popover.js +14 -12
- package/loaders/post-popovercontainer2.js +638 -36
- package/loaders/post-rating.js +2 -12
- package/loaders/post-tab-header.js +4 -3
- package/loaders/post-tab-panel.js +3 -3
- package/loaders/post-tabs.js +3 -10
- package/loaders/post-tag.js +1 -1
- package/loaders/post-togglebutton.js +12 -11
- package/loaders/post-tooltip.js +37 -294
- package/package.json +5 -5
- package/dist/cjs/debounce-158fd76f.js +0 -13
- package/dist/cjs/get-root-7a3498ef.js +0 -11
- package/dist/cjs/post-back-to-top-6a1c1ba4.js +0 -76
- package/dist/components/debounce.js +0 -11
- package/dist/esm/debounce-e54c7131.js +0 -11
- package/dist/esm/get-root-7af2e0d1.js +0 -9
- package/dist/esm/package-70367d05.js +0 -3
- package/dist/esm/post-back-to-top-abe253c1.js +0 -74
- package/dist/post-components/p-015361b5.entry.js +0 -1
- package/dist/post-components/p-077edb8c.js +0 -1
- package/dist/post-components/p-08a13d05.js +0 -1
- package/dist/post-components/p-08c3b919.entry.js +0 -1
- package/dist/post-components/p-0d7b0c2e.entry.js +0 -1
- package/dist/post-components/p-12f9a91e.entry.js +0 -1
- package/dist/post-components/p-20137c6a.entry.js +0 -1
- package/dist/post-components/p-21254d9c.entry.js +0 -1
- package/dist/post-components/p-22513a27.entry.js +0 -1
- package/dist/post-components/p-3638e50d.js +0 -1
- package/dist/post-components/p-4397f28e.js +0 -1
- package/dist/post-components/p-494a2a31.js +0 -1
- package/dist/post-components/p-509987da.entry.js +0 -1
- package/dist/post-components/p-5aeb3656.js +0 -1
- package/dist/post-components/p-5d0bb74d.js +0 -1
- package/dist/post-components/p-5e0f6c12.js +0 -1
- package/dist/post-components/p-5f89f4e8.entry.js +0 -1
- package/dist/post-components/p-6213f0dc.entry.js +0 -1
- package/dist/post-components/p-6ad7bf0f.js +0 -1
- package/dist/post-components/p-6f058a98.js +0 -1
- package/dist/post-components/p-737d76cb.js +0 -15
- package/dist/post-components/p-753a1935.js +0 -1
- package/dist/post-components/p-88a2cdaa.js +0 -1
- package/dist/post-components/p-90935fdd.js +0 -1
- package/dist/post-components/p-931c4523.js +0 -1
- package/dist/post-components/p-9748a355.js +0 -1
- package/dist/post-components/p-97865e22.entry.js +0 -1
- package/dist/post-components/p-a200c9c7.js +0 -1
- package/dist/post-components/p-a35c235a.entry.js +0 -1
- package/dist/post-components/p-a4264a61.entry.js +0 -1
- package/dist/post-components/p-a54c63d0.entry.js +0 -1
- package/dist/post-components/p-aebe402d.entry.js +0 -1
- package/dist/post-components/p-b43e79e3.entry.js +0 -1
- package/dist/post-components/p-c0c71e37.js +0 -1
- package/dist/post-components/p-c0ca344d.js +0 -1
- package/dist/post-components/p-c554fcf3.js +0 -1
- package/dist/post-components/p-cff7c06f.entry.js +0 -1
- package/dist/post-components/p-d1f70a05.entry.js +0 -1
- package/dist/post-components/p-dc67e6de.entry.js +0 -1
- package/dist/post-components/p-e1baac59.js +0 -1
- package/dist/post-components/p-f1ceccf3.js +0 -1
- package/dist/post-components/p-fc91cbc2.js +0 -1
- package/loaders/debounce.js +0 -11
|
@@ -1,71 +1,46 @@
|
|
|
1
1
|
export declare class PostMainnavigation {
|
|
2
|
-
private header;
|
|
3
2
|
private navbar;
|
|
4
|
-
private rightScrollButton;
|
|
5
|
-
private leftScrollButton;
|
|
6
3
|
private scrollRepeatInterval;
|
|
7
4
|
private navbarDisableTimer;
|
|
8
5
|
private resizeObserver;
|
|
9
6
|
private mutationObserver;
|
|
10
|
-
host: HTMLPostMainnavigationElement;
|
|
11
7
|
canScrollLeft: boolean;
|
|
12
8
|
canScrollRight: boolean;
|
|
13
|
-
|
|
9
|
+
constructor();
|
|
10
|
+
componentDidLoad(): void;
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
12
|
+
* Disconnects observers and remove event listeners when the main navigation is removed from the DOM.
|
|
16
13
|
*/
|
|
17
|
-
|
|
14
|
+
disconnectedCallback(): void;
|
|
18
15
|
/**
|
|
19
|
-
*
|
|
20
|
-
* This ensures that we can interact with the header for mobile menu toggling.
|
|
16
|
+
* Stops the repeated scrolling when the mouse button is released.
|
|
21
17
|
*/
|
|
22
|
-
|
|
18
|
+
stopScrolling(): void;
|
|
19
|
+
private handleMutations;
|
|
20
|
+
private get navigationItems();
|
|
23
21
|
/**
|
|
24
|
-
*
|
|
22
|
+
* Hack to fix the layout shift due to bold text on active elements
|
|
25
23
|
*/
|
|
26
|
-
disconnectedCallback(): void;
|
|
27
|
-
componentDidLoad(): void;
|
|
28
24
|
private fixLayoutShift;
|
|
29
25
|
private handleBackButtonClick;
|
|
30
26
|
/**
|
|
31
|
-
*
|
|
27
|
+
* Returns whether scrolling is enabled in either the left or right direction.
|
|
32
28
|
*/
|
|
33
|
-
private
|
|
29
|
+
private get canScroll();
|
|
34
30
|
/**
|
|
35
31
|
* Checks if scrolling is possible in either direction (left or right) and updates the state accordingly.
|
|
36
32
|
*/
|
|
37
33
|
private checkScrollability;
|
|
38
|
-
/**
|
|
39
|
-
* Returns whether scrolling is enabled in either the left or right direction.
|
|
40
|
-
*/
|
|
41
|
-
private get canScroll();
|
|
42
34
|
/**
|
|
43
35
|
* Handles the scrolling behavior when a user clicks on the left or right scroll buttons.
|
|
44
36
|
*/
|
|
45
37
|
private handleScrollButtonClick;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*/
|
|
49
|
-
stopScrolling(): void;
|
|
50
|
-
private scroll;
|
|
51
|
-
private translateRightTo;
|
|
52
|
-
private translateLeftTo;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the navigation list container element
|
|
55
|
-
*/
|
|
56
|
-
private get navigationList();
|
|
57
|
-
/**
|
|
58
|
-
* Returns the navigation items
|
|
59
|
-
*/
|
|
60
|
-
private get navigationItems();
|
|
38
|
+
private scrollRight;
|
|
39
|
+
private scrollLeft;
|
|
61
40
|
/**
|
|
62
41
|
* Temporarily disables interactions with the navbar during scrolling to prevent accidental clicks.
|
|
63
42
|
* Re-enables interactions after a brief delay to avoid blocking the user entirely.
|
|
64
43
|
*/
|
|
65
|
-
private
|
|
66
|
-
/**
|
|
67
|
-
* Allows to translate the navbar without a transition
|
|
68
|
-
*/
|
|
69
|
-
private withoutTransition;
|
|
44
|
+
private temporarilyDisableNavbar;
|
|
70
45
|
render(): any;
|
|
71
46
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Placement } from '@floating-ui/dom';
|
|
2
2
|
export declare class PostPopover {
|
|
3
3
|
private popoverRef;
|
|
4
|
-
private localBeforeToggleHandler;
|
|
4
|
+
private readonly localBeforeToggleHandler;
|
|
5
|
+
private readonly triggerObserver;
|
|
5
6
|
host: HTMLPostPopoverElement;
|
|
6
7
|
/**
|
|
7
8
|
* Defines the placement of the popover according to the floating-ui options available at https://floating-ui.com/docs/computePosition#placement.
|
|
@@ -38,5 +39,6 @@ export declare class PostPopover {
|
|
|
38
39
|
toggle(target: HTMLElement, force?: boolean): Promise<void>;
|
|
39
40
|
private get triggers();
|
|
40
41
|
private beforeToggleHandler;
|
|
42
|
+
private patchAccessibilityFeatures;
|
|
41
43
|
render(): any;
|
|
42
44
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { Placement } from '@floating-ui/dom';
|
|
3
|
-
import '@oddbird/popover-polyfill';
|
|
4
3
|
interface PopoverElement {
|
|
5
4
|
showPopover: () => void;
|
|
6
5
|
hidePopover: () => void;
|
|
@@ -50,6 +49,7 @@ export declare class PostPopovercontainer {
|
|
|
50
49
|
* @param event MouseEvent with cursor position
|
|
51
50
|
*/
|
|
52
51
|
private mouseTrackingHandler;
|
|
52
|
+
connectedCallback(): void;
|
|
53
53
|
componentDidLoad(): void;
|
|
54
54
|
disconnectedCallback(): void;
|
|
55
55
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Placement } from '@floating-ui/dom';
|
|
2
|
-
import 'long-press-event';
|
|
3
2
|
export declare class PostTooltip {
|
|
4
3
|
private popoverRef;
|
|
5
4
|
private wasOpenedByFocus;
|
|
5
|
+
private readonly triggerObserver;
|
|
6
6
|
host: HTMLPostTooltipElement;
|
|
7
7
|
/**
|
|
8
8
|
* Defines the placement of the tooltip according to the floating-ui options available at https://floating-ui.com/docs/computePosition#placement.
|
|
@@ -56,5 +56,10 @@ export declare class PostTooltip {
|
|
|
56
56
|
* Re-enable pointer events when the tooltip is no longer in focus or hovered
|
|
57
57
|
*/
|
|
58
58
|
private handleInterestLost;
|
|
59
|
+
/**
|
|
60
|
+
* Patch some accessibility features that are hard to remember or understand
|
|
61
|
+
* @param {HTMLElement} trigger
|
|
62
|
+
*/
|
|
63
|
+
private patchAccessibilityFeatures;
|
|
59
64
|
render(): any;
|
|
60
65
|
}
|
|
@@ -67,7 +67,7 @@ export namespace Components {
|
|
|
67
67
|
*/
|
|
68
68
|
"lastname"?: string;
|
|
69
69
|
/**
|
|
70
|
-
* Defines the company internal userId.<div className="mb-
|
|
70
|
+
* Defines the company internal userId.<div className="mb-4 banner banner-warning banner-sm">Can only be used on post.ch domains!</div>
|
|
71
71
|
*/
|
|
72
72
|
"userid"?: string;
|
|
73
73
|
}
|
|
@@ -144,7 +144,7 @@ export namespace Components {
|
|
|
144
144
|
*/
|
|
145
145
|
"label": string;
|
|
146
146
|
/**
|
|
147
|
-
* Defines the `name` attribute of the control. <span className="banner banner-sm banner-info">This is a required property, when the control should participate in a native `form`. If not specified, a native `form` will never contain this controls value.</span> <span className="banner banner-sm banner-info">This is a required property, when the control is used with type `radio`.</span>
|
|
147
|
+
* Defines the `name` attribute of the control. <span className="mb-4 banner banner-sm banner-info">This is a required property, when the control should participate in a native `form`. If not specified, a native `form` will never contain this controls value.</span> <span className="banner banner-sm banner-info">This is a required property, when the control is used with type `radio`.</span>
|
|
148
148
|
*/
|
|
149
149
|
"name": string;
|
|
150
150
|
/**
|
|
@@ -945,7 +945,7 @@ declare namespace LocalJSX {
|
|
|
945
945
|
*/
|
|
946
946
|
"lastname"?: string;
|
|
947
947
|
/**
|
|
948
|
-
* Defines the company internal userId.<div className="mb-
|
|
948
|
+
* Defines the company internal userId.<div className="mb-4 banner banner-warning banner-sm">Can only be used on post.ch domains!</div>
|
|
949
949
|
*/
|
|
950
950
|
"userid"?: string;
|
|
951
951
|
}
|
|
@@ -1018,7 +1018,7 @@ declare namespace LocalJSX {
|
|
|
1018
1018
|
*/
|
|
1019
1019
|
"label": string;
|
|
1020
1020
|
/**
|
|
1021
|
-
* Defines the `name` attribute of the control. <span className="banner banner-sm banner-info">This is a required property, when the control should participate in a native `form`. If not specified, a native `form` will never contain this controls value.</span> <span className="banner banner-sm banner-info">This is a required property, when the control is used with type `radio`.</span>
|
|
1021
|
+
* Defines the `name` attribute of the control. <span className="mb-4 banner banner-sm banner-info">This is a required property, when the control should participate in a native `form`. If not specified, a native `form` will never contain this controls value.</span> <span className="banner banner-sm banner-info">This is a required property, when the control is used with type `radio`.</span>
|
|
1022
1022
|
*/
|
|
1023
1023
|
"name"?: string;
|
|
1024
1024
|
/**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// It seems like the package '@oddbird/popover-polyfill does not properly declare it's types.
|
|
2
|
+
// This file fixes that issue so typescript does not complain about it on the import line
|
|
3
|
+
|
|
4
|
+
declare module '@oddbird/popover-polyfill/dist/popover-fn.js' {
|
|
5
|
+
export {
|
|
6
|
+
apply,
|
|
7
|
+
injectStyles,
|
|
8
|
+
isPolyfilled,
|
|
9
|
+
isSupported,
|
|
10
|
+
} from '../node_modules/@oddbird/popover-polyfill/dist/popover-fn.js';
|
|
11
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
export * from './get-focusable-children';
|
|
2
|
+
export * from './attribute-observer';
|
|
1
3
|
export * from './component-on-ready';
|
|
2
4
|
export * from './property-checkers';
|
|
5
|
+
export * from './breakpoints';
|
|
3
6
|
export * from './debounce';
|
|
7
|
+
export * from './event-guard';
|
|
4
8
|
export * from './get-root';
|
|
5
9
|
export * from './is-motion-reduced';
|
|
6
10
|
export * from './sass-export';
|
|
7
11
|
export * from './timeout';
|
|
12
|
+
export * from './environment';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { I as IS_BROWSER } from './breakpoints.js';
|
|
2
|
+
|
|
1
3
|
function getAttributeObserver(attribute, handler) {
|
|
2
4
|
/**
|
|
3
5
|
* Handle attribute changes and childList changes from the observer
|
|
@@ -19,7 +21,7 @@ function getAttributeObserver(attribute, handler) {
|
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
23
|
// Initialize a mutation observer for patching accessibility features
|
|
22
|
-
return new MutationObserver(observerHandler);
|
|
24
|
+
return IS_BROWSER ? new MutationObserver(observerHandler) : null;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export { getAttributeObserver as g };
|
package/loaders/breakpoints.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
const IS_SERVER = typeof window === 'undefined';
|
|
2
|
+
const IS_BROWSER = !IS_SERVER;
|
|
3
|
+
|
|
1
4
|
class Breakpoint {
|
|
2
|
-
breakpointMap;
|
|
3
|
-
current = {
|
|
4
|
-
key: '',
|
|
5
|
-
name: '',
|
|
6
|
-
};
|
|
7
5
|
constructor() {
|
|
8
|
-
|
|
6
|
+
this.current = {
|
|
7
|
+
key: '',
|
|
8
|
+
name: '',
|
|
9
|
+
};
|
|
10
|
+
if (IS_BROWSER && !this.breakpointMap) {
|
|
9
11
|
const keys = this.getStyles('--post-breakpoint-keys');
|
|
10
12
|
const names = this.getStyles('--post-breakpoint-names');
|
|
11
13
|
const widths = this.getStyles('--post-breakpoint-widths');
|
|
@@ -40,7 +42,9 @@ class Breakpoint {
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
dispatchEvent(type) {
|
|
43
|
-
|
|
45
|
+
if (IS_BROWSER) {
|
|
46
|
+
window.dispatchEvent(new CustomEvent(`postBreakpoint:${type}`, { detail: this.current[type] }));
|
|
47
|
+
}
|
|
44
48
|
}
|
|
45
49
|
get(type) {
|
|
46
50
|
this.updateHandler(false);
|
|
@@ -49,4 +53,4 @@ class Breakpoint {
|
|
|
49
53
|
}
|
|
50
54
|
const breakpoint = new Breakpoint();
|
|
51
55
|
|
|
52
|
-
export { breakpoint as b };
|
|
56
|
+
export { IS_BROWSER as I, breakpoint as b };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function eventGuard(host, event, options, callback) {
|
|
2
|
+
const target = event.target;
|
|
3
|
+
if (!target)
|
|
4
|
+
return;
|
|
5
|
+
if (target.localName === options.targetLocalName) {
|
|
6
|
+
if (!options.delegatorSelector || shadowClosest(target, options.delegatorSelector) === host) {
|
|
7
|
+
callback();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Traverses up the DOM (including crossing shadow DOM boundaries) starting from the given element
|
|
13
|
+
* to find and return the closest ancestor that matches the specified CSS selector.
|
|
14
|
+
* If no matching element is found, returns null.
|
|
15
|
+
*
|
|
16
|
+
* @param element - The starting element from which the search begins.
|
|
17
|
+
* @param selector - The CSS selector used to test each ancestor element.
|
|
18
|
+
* @returns The closest matching ancestor element or null if none is found.
|
|
19
|
+
*/
|
|
20
|
+
function shadowClosest(element, selector) {
|
|
21
|
+
let currentElement = element;
|
|
22
|
+
while (currentElement) {
|
|
23
|
+
if (currentElement.matches(selector)) {
|
|
24
|
+
return currentElement;
|
|
25
|
+
}
|
|
26
|
+
const parent = currentElement.parentElement;
|
|
27
|
+
if (parent) {
|
|
28
|
+
currentElement = parent;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const parentNode = currentElement.parentNode;
|
|
32
|
+
// When no parentElement exists, check if the current element is inside a shadow DOM.
|
|
33
|
+
// If so, move up to the shadow host to continue the search outside the shadow boundary.
|
|
34
|
+
if (parentNode instanceof ShadowRoot) {
|
|
35
|
+
currentElement = parentNode.host;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
currentElement = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { eventGuard as e };
|
package/loaders/get-root.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { I as IS_BROWSER } from './breakpoints.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* getRootNode() can only be used after the element has been attached to the document!
|
|
5
|
+
* So use it for example in the componentDidLoad lifecycle hook.
|
|
6
|
+
*/
|
|
1
7
|
function getRoot(element) {
|
|
2
|
-
const root = element.getRootNode();
|
|
8
|
+
const root = IS_BROWSER ? element.getRootNode() : element;
|
|
3
9
|
if (root instanceof Document || root instanceof ShadowRoot) {
|
|
4
10
|
return root;
|
|
5
11
|
}
|
package/loaders/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
import './breakpoints.js';
|
|
2
3
|
export { PostAvatar, defineCustomElement as defineCustomElementPostAvatar } from './post-avatar.js';
|
|
3
4
|
import './post-popovercontainer2.js';
|
|
4
|
-
|
|
5
|
-
export { PostPopover, defineCustomElement as defineCustomElementPostPopover } from './post-popover.js';
|
|
5
|
+
export { PostMegadropdown, defineCustomElement as defineCustomElementPostMegadropdown } from './post-megadropdown.js';
|
|
6
6
|
export { PostTooltip, defineCustomElement as defineCustomElementPostTooltip } from './post-tooltip.js';
|
|
7
7
|
export { PostAccordion, defineCustomElement as defineCustomElementPostAccordion } from './post-accordion.js';
|
|
8
8
|
export { PostAccordionItem, defineCustomElement as defineCustomElementPostAccordionItem } from './post-accordion-item.js';
|
|
@@ -24,11 +24,11 @@ export { PostList, defineCustomElement as defineCustomElementPostList } from './
|
|
|
24
24
|
export { PostListItem, defineCustomElement as defineCustomElementPostListItem } from './post-list-item.js';
|
|
25
25
|
export { PostLogo, defineCustomElement as defineCustomElementPostLogo } from './post-logo.js';
|
|
26
26
|
export { PostMainnavigation, defineCustomElement as defineCustomElementPostMainnavigation } from './post-mainnavigation.js';
|
|
27
|
-
export { PostMegadropdown, defineCustomElement as defineCustomElementPostMegadropdown } from './post-megadropdown.js';
|
|
28
27
|
export { PostMegadropdownTrigger, defineCustomElement as defineCustomElementPostMegadropdownTrigger } from './post-megadropdown-trigger.js';
|
|
29
28
|
export { PostMenu, defineCustomElement as defineCustomElementPostMenu } from './post-menu.js';
|
|
30
29
|
export { PostMenuItem, defineCustomElement as defineCustomElementPostMenuItem } from './post-menu-item.js';
|
|
31
30
|
export { PostMenuTrigger, defineCustomElement as defineCustomElementPostMenuTrigger } from './post-menu-trigger.js';
|
|
31
|
+
export { PostPopover, defineCustomElement as defineCustomElementPostPopover } from './post-popover.js';
|
|
32
32
|
export { PostPopovercontainer, defineCustomElement as defineCustomElementPostPopovercontainer } from './post-popovercontainer.js';
|
|
33
33
|
export { PostRating, defineCustomElement as defineCustomElementPostRating } from './post-rating.js';
|
|
34
34
|
export { PostTabHeader, defineCustomElement as defineCustomElementPostTabHeader } from './post-tab-header.js';
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* long-press-event - v@version@
|
|
3
|
+
* Pure JavaScript long-press-event
|
|
4
|
+
* https://github.com/john-doherty/long-press-event
|
|
5
|
+
* @author John Doherty <www.johndoherty.info>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
(function (window, document) {
|
|
9
|
+
|
|
10
|
+
// local timer object based on rAF
|
|
11
|
+
var timer = null;
|
|
12
|
+
|
|
13
|
+
// check if we're using a touch screen
|
|
14
|
+
var hasPointerEvents = (('PointerEvent' in window) || (window.navigator && 'msPointerEnabled' in window.navigator));
|
|
15
|
+
var isTouch = (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
|
|
16
|
+
|
|
17
|
+
// switch to pointer events or touch events if using a touch screen
|
|
18
|
+
var mouseDown = hasPointerEvents ? 'pointerdown' : isTouch ? 'touchstart' : 'mousedown';
|
|
19
|
+
var mouseUp = hasPointerEvents ? 'pointerup' : isTouch ? 'touchend' : 'mouseup';
|
|
20
|
+
var mouseMove = hasPointerEvents ? 'pointermove' : isTouch ? 'touchmove' : 'mousemove';
|
|
21
|
+
var mouseLeave = hasPointerEvents ? 'pointerleave' : isTouch ? 'touchleave' : 'mouseleave';
|
|
22
|
+
|
|
23
|
+
// track number of pixels the mouse moves during long press
|
|
24
|
+
var startX = 0; // mouse x position when timer started
|
|
25
|
+
var startY = 0; // mouse y position when timer started
|
|
26
|
+
var maxDiffX = 10; // max number of X pixels the mouse can move during long press before it is canceled
|
|
27
|
+
var maxDiffY = 10; // max number of Y pixels the mouse can move during long press before it is canceled
|
|
28
|
+
|
|
29
|
+
// patch CustomEvent to allow constructor creation (IE/Chrome)
|
|
30
|
+
if (typeof window.CustomEvent !== 'function') {
|
|
31
|
+
|
|
32
|
+
window.CustomEvent = function (event, params) {
|
|
33
|
+
|
|
34
|
+
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
|
35
|
+
|
|
36
|
+
var evt = document.createEvent('CustomEvent');
|
|
37
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
38
|
+
return evt;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
window.CustomEvent.prototype = window.Event.prototype;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// requestAnimationFrame() shim by Paul Irish
|
|
45
|
+
window.requestAnimFrame = (function () {
|
|
46
|
+
return window.requestAnimationFrame ||
|
|
47
|
+
window.webkitRequestAnimationFrame ||
|
|
48
|
+
window.mozRequestAnimationFrame ||
|
|
49
|
+
window.oRequestAnimationFrame ||
|
|
50
|
+
window.msRequestAnimationFrame || function (callback) {
|
|
51
|
+
window.setTimeout(callback, 1000 / 60);
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Behaves the same as setTimeout except uses requestAnimationFrame() where possible for better performance
|
|
57
|
+
* @param {function} fn The callback function
|
|
58
|
+
* @param {int} delay The delay in milliseconds
|
|
59
|
+
* @returns {object} handle to the timeout object
|
|
60
|
+
*/
|
|
61
|
+
function requestTimeout(fn, delay) {
|
|
62
|
+
|
|
63
|
+
if (!window.requestAnimationFrame && !window.webkitRequestAnimationFrame &&
|
|
64
|
+
!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
|
|
65
|
+
!window.oRequestAnimationFrame && !window.msRequestAnimationFrame) return window.setTimeout(fn, delay);
|
|
66
|
+
|
|
67
|
+
var start = new Date().getTime();
|
|
68
|
+
var handle = {};
|
|
69
|
+
|
|
70
|
+
var loop = function () {
|
|
71
|
+
var current = new Date().getTime();
|
|
72
|
+
var delta = current - start;
|
|
73
|
+
|
|
74
|
+
if (delta >= delay) {
|
|
75
|
+
fn.call();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
handle.value = requestAnimFrame(loop);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
handle.value = requestAnimFrame(loop);
|
|
83
|
+
|
|
84
|
+
return handle;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Behaves the same as clearTimeout except uses cancelRequestAnimationFrame() where possible for better performance
|
|
89
|
+
* @param {object} handle The callback function
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
function clearRequestTimeout(handle) {
|
|
93
|
+
if (handle) {
|
|
94
|
+
window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
|
|
95
|
+
window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
|
|
96
|
+
window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
|
|
97
|
+
window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
|
|
98
|
+
window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) :
|
|
99
|
+
window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
|
|
100
|
+
clearTimeout(handle);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Fires the 'long-press' event on element
|
|
106
|
+
* @param {MouseEvent|PointerEvent|TouchEvent} originalEvent The original event being fired
|
|
107
|
+
* @returns {void}
|
|
108
|
+
*/
|
|
109
|
+
function fireLongPressEvent(originalEvent) {
|
|
110
|
+
|
|
111
|
+
clearLongPressTimer();
|
|
112
|
+
|
|
113
|
+
originalEvent = unifyEvent(originalEvent);
|
|
114
|
+
|
|
115
|
+
// fire the long-press event
|
|
116
|
+
var allowClickEvent = this.dispatchEvent(new CustomEvent('long-press', {
|
|
117
|
+
bubbles: true,
|
|
118
|
+
cancelable: true,
|
|
119
|
+
|
|
120
|
+
// custom event data (legacy)
|
|
121
|
+
detail: {
|
|
122
|
+
clientX: originalEvent.clientX,
|
|
123
|
+
clientY: originalEvent.clientY,
|
|
124
|
+
offsetX: originalEvent.offsetX,
|
|
125
|
+
offsetY: originalEvent.offsetY,
|
|
126
|
+
pageX: originalEvent.pageX,
|
|
127
|
+
pageY: originalEvent.pageY
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// add coordinate data that would typically acompany a touch/click event
|
|
131
|
+
clientX: originalEvent.clientX,
|
|
132
|
+
clientY: originalEvent.clientY,
|
|
133
|
+
offsetX: originalEvent.offsetX,
|
|
134
|
+
offsetY: originalEvent.offsetY,
|
|
135
|
+
pageX: originalEvent.pageX,
|
|
136
|
+
pageY: originalEvent.pageY,
|
|
137
|
+
screenX: originalEvent.screenX,
|
|
138
|
+
screenY: originalEvent.screenY
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
if (!allowClickEvent) {
|
|
142
|
+
// suppress the next click event if e.preventDefault() was called in long-press handler
|
|
143
|
+
document.addEventListener('click', function suppressEvent(e) {
|
|
144
|
+
document.removeEventListener('click', suppressEvent, true);
|
|
145
|
+
cancelEvent(e);
|
|
146
|
+
}, true);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* consolidates mouse, touch, and Pointer events
|
|
152
|
+
* @param {MouseEvent|PointerEvent|TouchEvent} e The original event being fired
|
|
153
|
+
* @returns {MouseEvent|PointerEvent|Touch}
|
|
154
|
+
*/
|
|
155
|
+
function unifyEvent(e) {
|
|
156
|
+
if (e.changedTouches !== undefined) {
|
|
157
|
+
return e.changedTouches[0];
|
|
158
|
+
}
|
|
159
|
+
return e;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* method responsible for starting the long press timer
|
|
164
|
+
* @param {event} e - event object
|
|
165
|
+
* @returns {void}
|
|
166
|
+
*/
|
|
167
|
+
function startLongPressTimer(e) {
|
|
168
|
+
|
|
169
|
+
clearLongPressTimer();
|
|
170
|
+
|
|
171
|
+
var el = e.target;
|
|
172
|
+
|
|
173
|
+
// get delay from html attribute if it exists, otherwise default to 1500
|
|
174
|
+
var longPressDelayInMs = parseInt(getNearestAttribute(el, 'data-long-press-delay', '1500'), 10); // default 1500
|
|
175
|
+
|
|
176
|
+
// start the timer
|
|
177
|
+
timer = requestTimeout(fireLongPressEvent.bind(el, e), longPressDelayInMs);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* method responsible for clearing a pending long press timer
|
|
182
|
+
* @param {event} e - event object
|
|
183
|
+
* @returns {void}
|
|
184
|
+
*/
|
|
185
|
+
function clearLongPressTimer(e) {
|
|
186
|
+
clearRequestTimeout(timer);
|
|
187
|
+
timer = null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Cancels the current event
|
|
192
|
+
* @param {object} e - browser event object
|
|
193
|
+
* @returns {void}
|
|
194
|
+
*/
|
|
195
|
+
function cancelEvent(e) {
|
|
196
|
+
e.stopImmediatePropagation();
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
e.stopPropagation();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Starts the timer on mouse down and logs current position
|
|
203
|
+
* @param {object} e - browser event object
|
|
204
|
+
* @returns {void}
|
|
205
|
+
*/
|
|
206
|
+
function mouseDownHandler(e) {
|
|
207
|
+
startX = e.clientX;
|
|
208
|
+
startY = e.clientY;
|
|
209
|
+
startLongPressTimer(e);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* If the mouse moves n pixels during long-press, cancel the timer
|
|
214
|
+
* @param {object} e - browser event object
|
|
215
|
+
* @returns {void}
|
|
216
|
+
*/
|
|
217
|
+
function mouseMoveHandler(e) {
|
|
218
|
+
|
|
219
|
+
// calculate total number of pixels the pointer has moved
|
|
220
|
+
var diffX = Math.abs(startX - e.clientX);
|
|
221
|
+
var diffY = Math.abs(startY - e.clientY);
|
|
222
|
+
|
|
223
|
+
// if pointer has moved more than allowed, cancel the long-press timer and therefore the event
|
|
224
|
+
if (diffX >= maxDiffX || diffY >= maxDiffY) {
|
|
225
|
+
clearLongPressTimer();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Gets attribute off HTML element or nearest parent
|
|
231
|
+
* @param {object} el - HTML element to retrieve attribute from
|
|
232
|
+
* @param {string} attributeName - name of the attribute
|
|
233
|
+
* @param {any} defaultValue - default value to return if no match found
|
|
234
|
+
* @returns {any} attribute value or defaultValue
|
|
235
|
+
*/
|
|
236
|
+
function getNearestAttribute(el, attributeName, defaultValue) {
|
|
237
|
+
|
|
238
|
+
// walk up the dom tree looking for data-action and data-trigger
|
|
239
|
+
while (el && el !== document.documentElement) {
|
|
240
|
+
|
|
241
|
+
var attributeValue = el.getAttribute(attributeName);
|
|
242
|
+
|
|
243
|
+
if (attributeValue) {
|
|
244
|
+
return attributeValue;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
el = el.parentNode;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return defaultValue;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// hook events that clear a pending long press event
|
|
254
|
+
document.addEventListener(mouseUp, clearLongPressTimer, true);
|
|
255
|
+
document.addEventListener(mouseLeave, clearLongPressTimer, true);
|
|
256
|
+
document.addEventListener(mouseMove, mouseMoveHandler, true);
|
|
257
|
+
document.addEventListener('wheel', clearLongPressTimer, true);
|
|
258
|
+
document.addEventListener('scroll', clearLongPressTimer, true);
|
|
259
|
+
document.addEventListener('contextmenu', clearLongPressTimer, true);
|
|
260
|
+
|
|
261
|
+
// hook events that can trigger a long press event
|
|
262
|
+
document.addEventListener(mouseDown, mouseDownHandler, true); // <- start
|
|
263
|
+
|
|
264
|
+
}(window, document));
|
package/loaders/package.js
CHANGED