@swisspost/design-system-components 10.0.0-next.55 → 10.0.0-next.57
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/{components/react/p-CJ80BZ06.js → cjs/breakpoints-Df03Ct7n.js} +103 -5
- package/dist/cjs/debounce-BsIBi_-2.js +13 -0
- package/dist/cjs/environment-BQE9Unf_.js +52 -0
- package/dist/cjs/{event-from-CLvtSUKf.js → event-from-CwMw19f8.js} +2 -2
- package/dist/cjs/fade-CPQhl1fP.js +26 -0
- package/dist/cjs/fade-slide-dPhQa-I1.js +38 -0
- package/dist/cjs/{get-focusable-children-Bx63XUQg.js → get-focusable-children-ChETM1wK.js} +29 -21
- package/dist/cjs/{get-root-CyMf3Vsd.js → get-root-CUAv4k4C.js} +2 -2
- package/dist/cjs/{index-B4gYpuJF.js → index-B4rc1pqu.js} +2150 -292
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-DkJrv93P.js → package-uQ5oiSiN.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +19 -15
- package/dist/cjs/post-avatar.cjs.entry.js +27 -17
- package/dist/cjs/post-back-to-top.cjs.entry.js +23 -43
- package/dist/cjs/post-banner.cjs.entry.js +15 -12
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +14 -12
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +33 -34
- package/dist/cjs/post-card-control.cjs.entry.js +42 -26
- package/dist/cjs/{post-closebutton_15.cjs.entry.js → post-closebutton_13.cjs.entry.js} +618 -531
- package/dist/cjs/post-collapsible_2.cjs.entry.js +41 -37
- package/dist/cjs/post-components.cjs.js +3 -3
- package/dist/cjs/post-env-test.cjs.entry.js +15 -0
- package/dist/cjs/post-footer.cjs.entry.js +24 -20
- package/dist/cjs/post-linkarea.cjs.entry.js +5 -5
- package/dist/cjs/post-pagination.cjs.entry.js +615 -0
- package/dist/cjs/post-popover-trigger.cjs.entry.js +54 -34
- package/dist/cjs/post-popover.cjs.entry.js +26 -17
- package/dist/cjs/post-rating.cjs.entry.js +24 -18
- package/dist/cjs/post-stepper-item.cjs.entry.js +5 -5
- package/dist/cjs/post-stepper.cjs.entry.js +40 -29
- package/dist/cjs/post-tab-item.cjs.entry.js +51 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +13 -11
- package/dist/cjs/post-tabs.cjs.entry.js +195 -40
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +13 -11
- package/dist/cjs/post-tooltip.cjs.entry.js +14 -12
- package/dist/cjs/utils-s05L2ulk.js +26 -0
- package/dist/collection/animations/collapse.js +3 -3
- package/dist/collection/animations/fade-slide.js +33 -0
- package/dist/collection/animations/fade.js +19 -7
- package/dist/collection/animations/index.js +2 -0
- package/dist/collection/animations/slide.js +25 -21
- package/dist/collection/animations/types.js +14 -0
- package/dist/collection/animations/utils.js +8 -0
- package/dist/collection/collection-manifest.json +8 -8
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion/post-accordion.js +5 -4
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +9 -8
- package/dist/collection/components/post-avatar/post-avatar.js +11 -11
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +15 -15
- package/dist/collection/components/post-banner/post-banner.css +4 -1
- package/dist/collection/components/post-banner/post-banner.js +6 -5
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +3 -3
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +29 -29
- package/dist/collection/components/post-card-control/post-card-control.js +18 -18
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
- package/dist/collection/components/post-closebutton/post-closebutton.js +4 -3
- package/dist/collection/components/post-collapsible/post-collapsible.js +28 -28
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +3 -3
- package/dist/collection/components/post-footer/post-footer.css +1 -1
- package/dist/collection/components/post-footer/post-footer.js +18 -16
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +144 -82
- package/dist/collection/components/post-icon/post-icon.js +18 -16
- package/dist/collection/components/post-language-menu/post-language-menu.css +1 -0
- package/dist/collection/components/{post-language-switch/post-language-switch.js → post-language-menu/post-language-menu.js} +45 -36
- package/dist/collection/components/post-language-menu-item/post-language-menu-item.css +1 -0
- package/dist/collection/components/{post-language-option/post-language-option.js → post-language-menu-item/post-language-menu-item.js} +24 -23
- package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
- package/dist/collection/components/post-logo/post-logo.css +3 -1
- package/dist/collection/components/post-logo/post-logo.js +3 -3
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +41 -29
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +183 -74
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +3 -1
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +81 -75
- package/dist/collection/components/post-menu/post-menu.css +1 -1
- package/dist/collection/components/post-menu/post-menu.js +39 -38
- package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +3 -3
- package/dist/collection/components/post-pagination/post-pagination.css +1 -0
- package/dist/collection/components/post-pagination/post-pagination.js +838 -0
- package/dist/collection/components/post-popover/post-popover.js +22 -16
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +45 -29
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +82 -131
- package/dist/collection/components/post-rating/post-rating.js +7 -7
- package/dist/collection/components/post-stepper/post-stepper.js +38 -35
- package/dist/collection/components/post-stepper-item/post-stepper-item.css +2 -2
- package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
- package/dist/collection/components/post-tab-item/post-tab-item.css +1 -0
- package/dist/collection/components/post-tab-item/post-tab-item.js +86 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +10 -10
- package/dist/collection/components/post-tabs/post-tabs.js +232 -59
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +2 -2
- package/dist/collection/components/post-tooltip/post-tooltip.js +9 -27
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +4 -4
- package/dist/collection/utils/environment.js +47 -2
- package/dist/collection/utils/event-from.js +2 -2
- package/dist/collection/utils/get-focusable-children.js +29 -21
- package/dist/collection/utils/is-motion-reduced.js +1 -1
- package/dist/collection/utils/tests/environment/hydrate-app-helper.js +16 -0
- package/dist/collection/utils/tests/environment/post-env-test.js +9 -0
- package/dist/component-names.json +4 -5
- package/dist/components/breakpoints.js +1 -178
- package/dist/components/debounce.js +1 -0
- package/dist/components/environment.js +1 -0
- package/dist/components/event-from.js +1 -119
- package/dist/components/fade-slide.js +1 -0
- package/dist/components/fade.js +1 -11
- package/dist/components/focusable.js +1 -5018
- package/dist/components/get-focusable-children.js +1 -64
- package/dist/components/get-root.js +1 -15
- package/dist/components/heading-levels.js +1 -3
- package/dist/components/index.browser.js +1 -14
- package/dist/components/index.d.ts +11 -10
- package/dist/components/index.js +1 -39
- package/dist/components/long-press-event.js +1 -257
- package/dist/components/package.js +1 -3
- package/dist/components/post-accordion-item.js +1 -6
- package/dist/components/post-accordion-item2.js +1 -113
- package/dist/components/post-accordion.js +1 -6
- package/dist/components/post-accordion2.js +1 -138
- package/dist/components/post-avatar.js +1 -217
- package/dist/components/post-back-to-top.js +1 -144
- package/dist/components/post-banner.js +1 -98
- package/dist/components/post-breadcrumb-item.js +1 -6
- package/dist/components/post-breadcrumb-item2.js +1 -79
- package/dist/components/post-breadcrumbs.js +1 -196
- package/dist/components/post-card-control.js +1 -326
- package/dist/components/post-closebutton.js +1 -6
- package/dist/components/post-closebutton2.js +1 -77
- package/dist/components/post-collapsible-trigger.js +1 -6
- package/dist/components/post-collapsible-trigger2.js +1 -136
- package/dist/components/post-collapsible.js +1 -6
- package/dist/components/post-collapsible2.js +1 -110
- package/dist/components/{post-list.d.ts → post-env-test.d.ts} +4 -4
- package/dist/components/post-env-test.js +1 -0
- package/dist/components/post-footer.js +1 -116
- package/dist/components/post-header.js +1 -372
- package/dist/components/post-icon.js +1 -6
- package/dist/components/post-icon2.js +1 -159
- package/dist/components/post-language-menu-item.d.ts +11 -0
- package/dist/components/post-language-menu-item.js +1 -0
- package/dist/components/{post-language-switch.d.ts → post-language-menu.d.ts} +4 -4
- package/dist/components/post-language-menu.js +1 -0
- package/dist/components/post-linkarea.js +1 -58
- package/dist/components/post-logo.js +1 -58
- package/dist/components/post-mainnavigation.js +1 -180
- package/dist/components/post-megadropdown-trigger.js +1 -136
- package/dist/components/post-megadropdown.js +1 -267
- package/dist/components/post-menu-item.js +1 -6
- package/dist/components/post-menu-item2.js +1 -30
- package/dist/components/post-menu-trigger.js +1 -6
- package/dist/components/post-menu-trigger2.js +1 -110
- package/dist/components/post-menu.js +1 -6
- package/dist/components/post-menu2.js +1 -242
- package/dist/components/{post-tab-header.d.ts → post-pagination.d.ts} +4 -4
- package/dist/components/post-pagination.js +1 -0
- package/dist/components/post-popover-trigger.js +1 -132
- package/dist/components/post-popover.js +1 -118
- package/dist/components/post-popovercontainer.js +1 -6
- package/dist/components/post-popovercontainer2.js +1 -3127
- package/dist/components/post-rating.js +1 -148
- package/dist/components/post-stepper-item.js +1 -33
- package/dist/components/post-stepper.js +1 -134
- package/dist/components/{post-list-item.d.ts → post-tab-item.d.ts} +4 -4
- package/dist/components/post-tab-item.js +1 -0
- package/dist/components/post-tab-panel.js +1 -54
- package/dist/components/post-tabs.js +1 -196
- package/dist/components/post-togglebutton.js +1 -56
- package/dist/components/post-togglebutton2.js +1 -0
- package/dist/components/post-tooltip-trigger.js +1 -206
- package/dist/components/post-tooltip.js +1 -114
- package/dist/components/react/index.d.ts +2 -0
- package/dist/components/react/index.js +1 -2315
- package/dist/components/react/p-B8YiQ3mz.js +1 -0
- package/dist/components/react/p-BC5nlBvn.js +1 -0
- package/dist/components/react/p-BLchVpF6.js +1 -14
- package/dist/components/react/p-BVCjnh6Q.js +1 -0
- package/dist/{post-components/p-CBFgkSgY.js → components/react/p-BVGcVycs.js} +1 -1
- package/dist/components/react/p-B_XPj2c8.js +1 -0
- package/dist/components/react/p-BllOMLDs.js +1 -0
- package/dist/components/react/p-BmRNjQUZ.js +1 -0
- package/dist/components/react/p-ByFh05IW.js +1 -0
- package/dist/components/react/p-C9hMpmsD.js +1 -0
- package/dist/components/react/p-CJ13r5fi.js +1 -0
- package/dist/components/react/p-CZvbetqX.js +1 -0
- package/dist/components/react/p-C_2k3G1c.js +1 -257
- package/dist/components/react/p-CoDiS_Ik.js +1 -0
- package/dist/components/react/p-Cou17ld8.js +1 -0
- package/dist/components/react/p-D5knoiyy.js +1 -0
- package/dist/components/react/p-D9DDtvFM.js +1 -0
- package/dist/components/react/p-DY2U5CQt.js +1 -0
- package/dist/components/react/p-DjIHLduJ.js +1 -3
- package/dist/components/react/p-DpATRD2W.js +1 -0
- package/dist/components/react/p-FxUVQ4Tx.js +1 -0
- package/dist/components/react/p-HygIVKXC.js +1 -5018
- package/dist/components/react/p-YR7U0Z_g.js +1 -0
- package/dist/components/react/p-ZeKXASQs.js +1 -0
- package/dist/components/react/p-r4txK0AC.js +1 -3
- package/dist/components/react/p-sSn0kXFi.js +1 -0
- package/dist/components/react/post-accordion-item.js +1 -6
- package/dist/components/react/post-accordion.js +1 -6
- package/dist/components/react/post-avatar.js +1 -218
- package/dist/components/react/post-back-to-top.js +1 -145
- package/dist/components/react/post-banner.js +1 -99
- package/dist/components/react/post-breadcrumb-item.js +1 -6
- package/dist/components/react/post-breadcrumbs.js +1 -197
- package/dist/components/react/post-card-control.js +1 -327
- package/dist/components/react/post-closebutton.js +1 -6
- package/dist/components/react/post-collapsible-trigger.js +1 -6
- package/dist/components/react/post-collapsible.js +1 -6
- package/dist/components/react/{post-list.d.ts → post-env-test.d.ts} +4 -4
- package/dist/components/react/post-env-test.js +1 -0
- package/dist/components/react/post-footer.js +1 -117
- package/dist/components/react/post-header.js +1 -373
- package/dist/components/react/post-icon.js +1 -6
- package/dist/components/react/post-language-menu-item.d.ts +11 -0
- package/dist/components/react/post-language-menu-item.js +1 -0
- package/dist/components/react/{post-language-option.d.ts → post-language-menu.d.ts} +4 -4
- package/dist/components/react/post-language-menu.js +1 -0
- package/dist/components/react/post-linkarea.js +1 -59
- package/dist/components/react/post-logo.js +1 -59
- package/dist/components/react/post-mainnavigation.js +1 -181
- package/dist/components/react/post-megadropdown-trigger.js +1 -137
- package/dist/components/react/post-megadropdown.js +1 -268
- package/dist/components/react/post-menu-item.js +1 -6
- package/dist/components/react/post-menu-trigger.js +1 -6
- package/dist/components/react/post-menu.js +1 -6
- package/dist/components/react/{post-tab-header.d.ts → post-pagination.d.ts} +4 -4
- package/dist/components/react/post-pagination.js +1 -0
- package/dist/components/react/post-popover-trigger.js +1 -133
- package/dist/components/react/post-popover.js +1 -119
- package/dist/components/react/post-popovercontainer.js +1 -6
- package/dist/components/react/post-rating.js +1 -149
- package/dist/components/react/post-stepper-item.js +1 -34
- package/dist/components/react/post-stepper.js +1 -135
- package/dist/components/react/{post-list-item.d.ts → post-tab-item.d.ts} +4 -4
- package/dist/components/react/post-tab-item.js +1 -0
- package/dist/components/react/post-tab-panel.js +1 -55
- package/dist/components/react/post-tabs.js +1 -197
- package/dist/components/react/post-togglebutton.js +1 -57
- package/dist/components/react/post-tooltip-trigger.js +1 -207
- package/dist/components/react/post-tooltip.js +1 -115
- package/dist/components/switch-variants.js +1 -3
- package/dist/components/utils.js +1 -0
- package/dist/docs.d.ts +11 -0
- package/dist/docs.json +873 -631
- package/dist/{cjs/breakpoints-CEkeixld.js → esm/breakpoints-DYoSKGHO.js} +89 -6
- package/dist/esm/debounce-C9hMpmsD.js +11 -0
- package/dist/esm/environment-CEmnRoA6.js +49 -0
- package/dist/{components/react/p-CzIKqBrS.js → esm/event-from-rEfV4v4a.js} +2 -2
- package/dist/esm/fade-DsgPYmAa.js +24 -0
- package/dist/esm/fade-slide-CvOvauo9.js +36 -0
- package/dist/esm/{get-focusable-children-D9ZHp2FP.js → get-focusable-children-BXNs2_sw.js} +29 -21
- package/dist/{components/react/p-CBFgkSgY.js → esm/get-root-CXfAA093.js} +1 -1
- package/dist/esm/{index-wEFJ-c34.js → index-CDZBzSdV.js} +2150 -292
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-CZvbetqX.js +3 -0
- package/dist/esm/post-accordion_2.entry.js +17 -13
- package/dist/esm/post-avatar.entry.js +22 -12
- package/dist/esm/post-back-to-top.entry.js +23 -43
- package/dist/esm/post-banner.entry.js +14 -11
- package/dist/esm/post-breadcrumb-item_2.entry.js +13 -11
- package/dist/esm/post-breadcrumbs.entry.js +31 -32
- package/dist/esm/post-card-control.entry.js +32 -16
- package/dist/esm/{post-closebutton_15.entry.js → post-closebutton_13.entry.js} +599 -510
- package/dist/esm/post-collapsible_2.entry.js +38 -34
- package/dist/esm/post-components.js +4 -4
- package/dist/esm/post-env-test.entry.js +13 -0
- package/dist/esm/post-footer.entry.js +21 -17
- package/dist/esm/post-linkarea.entry.js +5 -5
- package/dist/esm/post-pagination.entry.js +613 -0
- package/dist/esm/post-popover-trigger.entry.js +52 -32
- package/dist/esm/post-popover.entry.js +25 -16
- package/dist/esm/post-rating.entry.js +16 -10
- package/dist/esm/post-stepper-item.entry.js +5 -5
- package/dist/esm/post-stepper.entry.js +39 -28
- package/dist/esm/post-tab-item.entry.js +49 -0
- package/dist/esm/post-tab-panel.entry.js +13 -11
- package/dist/esm/post-tabs.entry.js +195 -40
- package/dist/esm/post-tooltip-trigger.entry.js +10 -8
- package/dist/esm/post-tooltip.entry.js +13 -11
- package/dist/esm/utils-CoDiS_Ik.js +24 -0
- package/dist/post-components/p-09ba7cf9.entry.js +1 -0
- package/dist/post-components/p-0c091898.entry.js +1 -0
- package/dist/post-components/{p-cd03e6f2.entry.js → p-0e97fcfd.entry.js} +1 -1
- package/dist/post-components/p-296f1dd5.entry.js +1 -0
- package/dist/post-components/p-32ad2b21.entry.js +1 -0
- package/dist/post-components/p-366c28cb.entry.js +1 -0
- package/dist/post-components/p-41ae68d5.entry.js +1 -0
- package/dist/post-components/p-448e7265.entry.js +1 -0
- package/dist/post-components/p-554da188.entry.js +1 -0
- package/dist/post-components/p-5912f8f1.entry.js +1 -0
- package/dist/post-components/p-790f300d.entry.js +1 -0
- package/dist/post-components/p-7ed5a493.entry.js +1 -0
- package/dist/post-components/p-85bea1b6.entry.js +1 -0
- package/dist/post-components/p-8bcff4d2.entry.js +1 -0
- package/dist/post-components/p-9dc9c245.entry.js +1 -0
- package/dist/post-components/p-B7ebLhHc.js +1 -0
- package/dist/post-components/p-BVCjnh6Q.js +1 -0
- package/dist/post-components/p-BXNs2_sw.js +1 -0
- package/dist/post-components/p-C9hMpmsD.js +1 -0
- package/dist/post-components/p-CDZBzSdV.js +2 -0
- package/dist/post-components/p-CEmnRoA6.js +1 -0
- package/dist/post-components/p-CZvbetqX.js +1 -0
- package/dist/post-components/p-CoDiS_Ik.js +1 -0
- package/dist/post-components/p-D5knoiyy.js +1 -0
- package/dist/post-components/p-DI-h_mEL.js +1 -0
- package/dist/post-components/p-a06f9695.entry.js +1 -0
- package/dist/post-components/p-a191f1df.entry.js +1 -0
- package/dist/post-components/p-c5d19d62.entry.js +1 -0
- package/dist/post-components/{p-24dc54d1.entry.js → p-c8c4d05b.entry.js} +1 -1
- package/dist/post-components/{p-57288cb2.entry.js → p-d1a5c980.entry.js} +1 -1
- package/dist/post-components/p-d4e2c556.entry.js +1 -0
- package/dist/post-components/p-f96a310c.entry.js +1 -0
- package/dist/post-components/p-fab2327d.entry.js +1 -0
- package/dist/post-components/p-rEfV4v4a.js +1 -0
- package/dist/post-components/post-components.css +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/prebuild.js +46 -0
- package/dist/types/animations/collapse.d.ts +1 -0
- package/dist/types/animations/fade-slide.d.ts +11 -0
- package/dist/types/animations/fade.d.ts +2 -2
- package/dist/types/animations/index.d.ts +2 -0
- package/dist/types/animations/slide.d.ts +9 -2
- package/dist/types/animations/types.d.ts +13 -0
- package/dist/types/animations/utils.d.ts +2 -0
- package/dist/types/components/post-accordion-item/heading-levels.d.ts +1 -1
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -2
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +2 -2
- package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +6 -6
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +4 -5
- package/dist/types/components/post-footer/post-footer.d.ts +4 -4
- package/dist/types/components/post-header/post-header.d.ts +23 -13
- package/dist/types/components/{post-language-switch/post-language-switch.d.ts → post-language-menu/post-language-menu.d.ts} +12 -11
- package/dist/types/components/{post-language-option/post-language-option.d.ts → post-language-menu-item/post-language-menu-item.d.ts} +5 -5
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +6 -5
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +20 -2
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +17 -23
- package/dist/types/components/post-menu/post-menu.d.ts +4 -4
- package/dist/types/components/post-pagination/post-pagination.d.ts +224 -0
- package/dist/types/components/post-popover/post-popover.d.ts +4 -3
- package/dist/types/components/post-popover-trigger/post-popover-trigger.d.ts +2 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +23 -21
- package/dist/types/components/post-rating/post-rating.d.ts +1 -1
- package/dist/types/components/post-stepper/post-stepper.d.ts +9 -8
- package/dist/types/components/post-tab-item/post-tab-item.d.ts +19 -0
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +3 -3
- package/dist/types/components/post-tabs/post-tabs.d.ts +33 -12
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +1 -5
- package/dist/types/components.d.ts +322 -219
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/prebuild.d.ts +9 -0
- package/dist/types/stencil-public-runtime.d.ts +147 -10
- package/dist/types/types/heading-levels.d.ts +1 -1
- package/dist/types/utils/environment.d.ts +25 -1
- package/dist/types/utils/get-focusable-children.d.ts +2 -2
- package/dist/types/utils/tests/environment/hydrate-app-helper.d.ts +5 -0
- package/dist/types/utils/tests/environment/post-env-test.d.ts +3 -0
- package/hydrate/index.d.ts +14 -0
- package/hydrate/index.js +7494 -2714
- package/hydrate/index.mjs +7493 -2715
- package/package.json +7 -8
- package/dist/cjs/fade-nS5zzDQS.js +0 -14
- package/dist/cjs/index-UFKR6Ok0.js +0 -98
- package/dist/cjs/post-tab-header.cjs.entry.js +0 -31
- package/dist/collection/animations/slide-and-fade.js +0 -25
- package/dist/collection/components/post-language-option/post-language-option.css +0 -1
- package/dist/collection/components/post-language-switch/post-language-switch.css +0 -1
- package/dist/collection/components/post-list/post-list.css +0 -1
- package/dist/collection/components/post-list/post-list.js +0 -97
- package/dist/collection/components/post-list-item/post-list-item.css +0 -1
- package/dist/collection/components/post-list-item/post-list-item.js +0 -26
- package/dist/collection/components/post-tab-header/post-tab-header.css +0 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +0 -65
- package/dist/components/index2.js +0 -89
- package/dist/components/post-language-option.d.ts +0 -11
- package/dist/components/post-language-option.js +0 -99
- package/dist/components/post-language-switch.js +0 -157
- package/dist/components/post-list-item.js +0 -38
- package/dist/components/post-list.js +0 -61
- package/dist/components/post-tab-header.js +0 -52
- package/dist/components/react/p-BVXiQdHq.js +0 -64
- package/dist/components/react/p-BhxZzOEC.js +0 -3
- package/dist/components/react/p-CSAMO7iJ.js +0 -243
- package/dist/components/react/p-CYkf_7Y5.js +0 -89
- package/dist/components/react/p-Ccrl2AQn.js +0 -111
- package/dist/components/react/p-CewRvBtg.js +0 -139
- package/dist/components/react/p-Cwiv86_f.js +0 -111
- package/dist/components/react/p-D2waO0Zc.js +0 -31
- package/dist/components/react/p-DBPOV12C.js +0 -160
- package/dist/components/react/p-DVGEExot.js +0 -3128
- package/dist/components/react/p-Djvj8fd2.js +0 -80
- package/dist/components/react/p-LtiDhYis.js +0 -137
- package/dist/components/react/p-SbIC4aZX.js +0 -11
- package/dist/components/react/p-XrZzCOKT.js +0 -78
- package/dist/components/react/p-v3pOrMNQ.js +0 -114
- package/dist/components/react/post-language-option.js +0 -100
- package/dist/components/react/post-language-switch.d.ts +0 -11
- package/dist/components/react/post-language-switch.js +0 -158
- package/dist/components/react/post-list-item.js +0 -39
- package/dist/components/react/post-list.js +0 -62
- package/dist/components/react/post-tab-header.js +0 -53
- package/dist/esm/breakpoints-CJ80BZ06.js +0 -178
- package/dist/esm/event-from-CzIKqBrS.js +0 -119
- package/dist/esm/fade-SbIC4aZX.js +0 -11
- package/dist/esm/get-root-BkQ3CrLq.js +0 -15
- package/dist/esm/index-Beaz8wEe.js +0 -89
- package/dist/esm/package-BhxZzOEC.js +0 -3
- package/dist/esm/post-tab-header.entry.js +0 -29
- package/dist/post-components/p-01e678c9.entry.js +0 -1
- package/dist/post-components/p-034a453f.entry.js +0 -1
- package/dist/post-components/p-15a4cdbf.entry.js +0 -1
- package/dist/post-components/p-2a2030bf.entry.js +0 -1
- package/dist/post-components/p-2ed84cc3.entry.js +0 -1
- package/dist/post-components/p-3228968f.entry.js +0 -1
- package/dist/post-components/p-3c01ddfe.entry.js +0 -1
- package/dist/post-components/p-748b1f01.entry.js +0 -1
- package/dist/post-components/p-7745e46e.entry.js +0 -1
- package/dist/post-components/p-7f635728.entry.js +0 -1
- package/dist/post-components/p-82c178a3.entry.js +0 -1
- package/dist/post-components/p-9b5f8319.entry.js +0 -1
- package/dist/post-components/p-Beaz8wEe.js +0 -1
- package/dist/post-components/p-BhxZzOEC.js +0 -1
- package/dist/post-components/p-CJ80BZ06.js +0 -1
- package/dist/post-components/p-D9ZHp2FP.js +0 -1
- package/dist/post-components/p-SbIC4aZX.js +0 -1
- package/dist/post-components/p-a9644e54.entry.js +0 -1
- package/dist/post-components/p-af030a3a.entry.js +0 -1
- package/dist/post-components/p-b8ba8139.entry.js +0 -1
- package/dist/post-components/p-db935e8e.entry.js +0 -1
- package/dist/post-components/p-e62e1f57.entry.js +0 -1
- package/dist/post-components/p-fb4b1641.entry.js +0 -1
- package/dist/post-components/p-wEFJ-c34.js +0 -2
- package/dist/types/animations/slide-and-fade.d.ts +0 -2
- package/dist/types/components/post-list/post-list.d.ts +0 -24
- package/dist/types/components/post-list-item/post-list-item.d.ts +0 -8
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +0 -14
- /package/dist/collection/components/{post-language-switch → post-language-menu}/switch-variants.js +0 -0
- /package/dist/{post-components/p-CzIKqBrS.js → components/react/p-rEfV4v4a.js} +0 -0
- /package/dist/types/components/{post-language-switch → post-language-menu}/switch-variants.d.ts +0 -0
|
@@ -1,138 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { v as version } from './package.js';
|
|
3
|
-
import { H as HEADING_LEVELS } from './heading-levels.js';
|
|
4
|
-
import { b as checkRequiredAndOneOf } from './index2.js';
|
|
5
|
-
import './breakpoints.js';
|
|
6
|
-
import { E as EventFrom } from './event-from.js';
|
|
7
|
-
|
|
8
|
-
const postAccordionCss = ":host{display:block}::slotted(post-accordion-item){display:block}::slotted(post-accordion-item:not(:only-of-type:first-of-type)){margin-block-start:calc(var(--post-device-border-width-default)*-1)}";
|
|
9
|
-
|
|
10
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
-
else
|
|
15
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
16
|
-
if (d = decorators[i])
|
|
17
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
};
|
|
20
|
-
const PostAccordion = /*@__PURE__*/ proxyCustomElement(class PostAccordion extends HTMLElement {
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
this.__registerHost();
|
|
24
|
-
this.__attachShadow();
|
|
25
|
-
this.expandedItems = new Set();
|
|
26
|
-
/**
|
|
27
|
-
* If `true`, multiple `post-accordion-item` can be open at the same time.
|
|
28
|
-
*/
|
|
29
|
-
this.multiple = false;
|
|
30
|
-
}
|
|
31
|
-
validateHeadingLevel() {
|
|
32
|
-
checkRequiredAndOneOf(this, 'headingLevel', HEADING_LEVELS);
|
|
33
|
-
this.accordionItems.forEach(item => {
|
|
34
|
-
item.setAttribute('heading-level', String(this.headingLevel));
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
componentWillLoad() {
|
|
38
|
-
this.registerAccordionItems();
|
|
39
|
-
}
|
|
40
|
-
componentDidLoad() {
|
|
41
|
-
this.validateHeadingLevel();
|
|
42
|
-
}
|
|
43
|
-
collapseToggleHandler(event) {
|
|
44
|
-
const toggledAccordionItem = event.target;
|
|
45
|
-
const isClosing = this.expandedItems.has(toggledAccordionItem);
|
|
46
|
-
if (isClosing) {
|
|
47
|
-
this.expandedItems.delete(toggledAccordionItem);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
this.expandedItems.add(toggledAccordionItem);
|
|
51
|
-
}
|
|
52
|
-
if (this.multiple || isClosing)
|
|
53
|
-
return;
|
|
54
|
-
// Close other open accordion items to ensure only one is open at a time
|
|
55
|
-
Array.from(this.expandedItems.values())
|
|
56
|
-
.filter(item => item !== toggledAccordionItem)
|
|
57
|
-
.forEach(item => {
|
|
58
|
-
item.toggle(false);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Toggles the `post-accordion-item` with the given id.
|
|
63
|
-
*/
|
|
64
|
-
async toggle(id) {
|
|
65
|
-
const itemToToggle = this.accordionItems.find(item => item.id === id);
|
|
66
|
-
if (!itemToToggle)
|
|
67
|
-
throw new Error(`No post-accordion-item found with id #${id}.`);
|
|
68
|
-
await itemToToggle.toggle();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Expands all `post-accordion-item`.
|
|
72
|
-
*
|
|
73
|
-
* If `multiple="true"` is not set and all items are closed, it will open the first one.
|
|
74
|
-
* Otherwise, it will keep the opened one.
|
|
75
|
-
*/
|
|
76
|
-
async expandAll() {
|
|
77
|
-
if (this.multiple) {
|
|
78
|
-
await Promise.all(this.accordionItems.map(item => item.toggle(true)));
|
|
79
|
-
}
|
|
80
|
-
else if (!this.expandedItems.size) {
|
|
81
|
-
await this.accordionItems[0].toggle(true);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Collapses all `post-accordion-item`.
|
|
86
|
-
*/
|
|
87
|
-
async collapseAll() {
|
|
88
|
-
await Promise.all(this.accordionItems.map(item => item.toggle(false)));
|
|
89
|
-
}
|
|
90
|
-
registerAccordionItems() {
|
|
91
|
-
this.accordionItems = Array.from(this.host.querySelectorAll('post-accordion-item'));
|
|
92
|
-
this.accordionItems
|
|
93
|
-
.filter(item => {
|
|
94
|
-
return !item.collapsed || this.expandedItems.has(item);
|
|
95
|
-
})
|
|
96
|
-
.forEach((item, index) => {
|
|
97
|
-
if (!this.multiple && index !== 0) {
|
|
98
|
-
item.setAttribute('collapsed', '');
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this.expandedItems.add(item);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
render() {
|
|
105
|
-
return (h(Host, { key: '470d8a7646796044df8f9cf1ebfc113e5c8db960', "data-version": version }, h("div", { key: '360ad1fe885dbb3c61a5c026ea253e7fba81ef9e', class: "accordion" }, h("slot", { key: '9e14d7906cba560a848986787159f56c961c78db', onSlotchange: () => this.registerAccordionItems() }))));
|
|
106
|
-
}
|
|
107
|
-
get host() { return this; }
|
|
108
|
-
static get watchers() { return {
|
|
109
|
-
"headingLevel": ["validateHeadingLevel"]
|
|
110
|
-
}; }
|
|
111
|
-
static get style() { return postAccordionCss; }
|
|
112
|
-
}, [1, "post-accordion", {
|
|
113
|
-
"headingLevel": [514, "heading-level"],
|
|
114
|
-
"multiple": [4],
|
|
115
|
-
"toggle": [64],
|
|
116
|
-
"expandAll": [64],
|
|
117
|
-
"collapseAll": [64]
|
|
118
|
-
}, [[0, "postToggle", "collapseToggleHandler"]], {
|
|
119
|
-
"headingLevel": ["validateHeadingLevel"]
|
|
120
|
-
}]);
|
|
121
|
-
__decorate([
|
|
122
|
-
EventFrom('post-accordion-item')
|
|
123
|
-
], PostAccordion.prototype, "collapseToggleHandler", null);
|
|
124
|
-
function defineCustomElement() {
|
|
125
|
-
if (typeof customElements === "undefined") {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const components = ["post-accordion"];
|
|
129
|
-
components.forEach(tagName => { switch (tagName) {
|
|
130
|
-
case "post-accordion":
|
|
131
|
-
if (!customElements.get(tagName)) {
|
|
132
|
-
customElements.define(tagName, PostAccordion);
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
} });
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { PostAccordion as P, defineCustomElement as d };
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as o,Host as s,transformTag as i}from"@stencil/core/internal/client";import{v as a}from"./package.js";import{H as l}from"./heading-levels.js";import{b as r}from"./breakpoints.js";import{E as c}from"./event-from.js";const n=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.expandedItems=new Set,this.multiple=!1}validateHeadingLevel(){r(this,"headingLevel",l),this.accordionItems.forEach((e=>{e.setAttribute("heading-level",String(this.headingLevel))}))}componentWillLoad(){this.registerAccordionItems()}componentDidLoad(){this.validateHeadingLevel()}collapseToggleHandler(e){const t=e.target,o=this.expandedItems.has(t);o?this.expandedItems.delete(t):this.expandedItems.add(t),this.multiple||o||Array.from(this.expandedItems.values()).filter((e=>e!==t)).forEach((e=>{e.toggle(!1)}))}async toggle(e){const t=this.accordionItems.find((t=>t.id===e));if(!t)throw new Error(`No post-accordion-item found with id #${e}.`);await t.toggle()}async expandAll(){this.multiple?await Promise.all(this.accordionItems.map((e=>e.toggle(!0)))):this.expandedItems.size||await this.accordionItems[0].toggle(!0)}async collapseAll(){await Promise.all(this.accordionItems.map((e=>e.toggle(!1))))}registerAccordionItems(){this.accordionItems=Array.from(this.host.querySelectorAll("post-accordion-item")),this.accordionItems.filter((e=>!e.collapsed||this.expandedItems.has(e))).forEach(((e,t)=>{this.multiple||0===t?this.expandedItems.add(e):e.setAttribute("collapsed","")}))}render(){return o(s,{key:"470d8a7646796044df8f9cf1ebfc113e5c8db960","data-version":a},o("div",{key:"360ad1fe885dbb3c61a5c026ea253e7fba81ef9e",class:"accordion"},o("slot",{key:"9e14d7906cba560a848986787159f56c961c78db",onSlotchange:()=>this.registerAccordionItems()})))}get host(){return this}static get watchers(){return{headingLevel:[{validateHeadingLevel:0}]}}static get style(){return":host{display:block;border-block-start:var(--post-device-border-width-default) var(--post-core-border-style-solid) var(--post-scheme-color-interactive-primary-enabled-stroke)}"}},[257,"post-accordion",{headingLevel:[514,"heading-level"],multiple:[4],toggle:[64],expandAll:[64],collapseAll:[64]},[[0,"postToggle","collapseToggleHandler"]],{headingLevel:[{validateHeadingLevel:0}]}]);function d(){"undefined"!=typeof customElements&&["post-accordion"].forEach((e=>{"post-accordion"===e&&(customElements.get(i(e))||customElements.define(i(e),n))}))}!function(e,t,o,s){var i,a=arguments.length,l=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,o):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,s);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(l=(a<3?i(l):a>3?i(t,o,l):i(t,o))||l);a>3&&l&&Object.defineProperty(t,o,l)}([c("post-accordion-item")],n.prototype,"collapseToggleHandler",null);export{n as P,d}
|
|
@@ -1,217 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { v as version } from './package.js';
|
|
3
|
-
import { c as checkRequiredAndType, e as checkEmptyOrType, g as checkEmptyOrPattern } from './index2.js';
|
|
4
|
-
import './breakpoints.js';
|
|
5
|
-
|
|
6
|
-
// https://docs.gravatar.com/api/avatars/images/
|
|
7
|
-
const GRAVATAR_DEFAULT = '404';
|
|
8
|
-
const GRAVATAR_RATING = 'g';
|
|
9
|
-
const GRAVATAR_SIZE = 80;
|
|
10
|
-
async function cryptify(key) {
|
|
11
|
-
return await crypto.subtle.digest('SHA-256', new TextEncoder().encode(key)).then(buffer => {
|
|
12
|
-
return Array.from(new Uint8Array(buffer))
|
|
13
|
-
.map(bytes => bytes.toString(16).padStart(2, '0'))
|
|
14
|
-
.join('');
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
const GRAVATAR_BASE_URL = `https://www.gravatar.com/avatar/{email}?s=${GRAVATAR_SIZE}&d=${GRAVATAR_DEFAULT}&r=${GRAVATAR_RATING}`;
|
|
18
|
-
|
|
19
|
-
const postAvatarCss = ":host{--post-avatar-bg:var(--post-scheme-color-interactive-primary-enabled-bg2);--post-avatar-fg:var(--post-scheme-color-interactive-primary-enabled-fg3);display:inline-flex;position:relative;width:var(--post-device-sizing-interactive-icon-size3);height:var(--post-device-sizing-interactive-icon-size3);background-color:var(--post-scheme-color-interactive-primary-enabled-stroke3);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke3);border-radius:var(--post-device-border-radius-round);font-size:var(--post-device-font-size-8);vertical-align:top;line-height:1}:host::after{display:block;content:\"\";position:absolute;inset:0;z-index:1;border-radius:inherit}*,*::before,*::after{box-sizing:border-box}slot,img,::slotted(img){display:block;width:100%;height:100%}img,::slotted(img){border-radius:var(--post-device-border-radius-round)}::slotted(:not(img)){display:none !important}.initials{display:flex;justify-content:center;align-items:center;position:relative;width:100%;height:100%;background-color:var(--post-avatar-bg);border-radius:var(--post-device-border-radius-round);color:var(--post-avatar-fg);text-transform:uppercase;font-weight:400}.initials span{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
|
|
20
|
-
|
|
21
|
-
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
22
|
-
var AvatarType;
|
|
23
|
-
(function (AvatarType) {
|
|
24
|
-
AvatarType["Slotted"] = "slotted";
|
|
25
|
-
AvatarType["Image"] = "image";
|
|
26
|
-
AvatarType["Initials"] = "initials";
|
|
27
|
-
AvatarType[AvatarType["Null"] = null] = "Null";
|
|
28
|
-
})(AvatarType || (AvatarType = {}));
|
|
29
|
-
const PostAvatar$1 = /*@__PURE__*/ proxyCustomElement(class PostAvatar extends HTMLElement {
|
|
30
|
-
constructor() {
|
|
31
|
-
super();
|
|
32
|
-
this.__registerHost();
|
|
33
|
-
this.__attachShadow();
|
|
34
|
-
this.avatarType = null;
|
|
35
|
-
this.imageUrl = '';
|
|
36
|
-
this.imageAlt = '';
|
|
37
|
-
this.initials = '';
|
|
38
|
-
// To handle email or userid updates and reset the storage item
|
|
39
|
-
this.storageKey = '';
|
|
40
|
-
}
|
|
41
|
-
validateFirstname() {
|
|
42
|
-
checkRequiredAndType(this, 'firstname', 'string');
|
|
43
|
-
}
|
|
44
|
-
validateLastname() {
|
|
45
|
-
checkEmptyOrType(this, 'lastname', 'string');
|
|
46
|
-
}
|
|
47
|
-
updateUserid() {
|
|
48
|
-
this.validateUserId();
|
|
49
|
-
this.getAvatarImage();
|
|
50
|
-
}
|
|
51
|
-
updateEmail() {
|
|
52
|
-
this.validateEmail();
|
|
53
|
-
this.getAvatarImage();
|
|
54
|
-
}
|
|
55
|
-
validateDescription() {
|
|
56
|
-
checkEmptyOrType(this, 'description', 'string');
|
|
57
|
-
}
|
|
58
|
-
validateUserId() {
|
|
59
|
-
checkEmptyOrType(this, 'userid', 'string');
|
|
60
|
-
}
|
|
61
|
-
validateEmail() {
|
|
62
|
-
if (this.email)
|
|
63
|
-
checkEmptyOrPattern(this, 'email', emailPattern);
|
|
64
|
-
}
|
|
65
|
-
async getAvatarImage() {
|
|
66
|
-
let imageLoaded = false;
|
|
67
|
-
this.slottedImage = this.host.querySelector('img');
|
|
68
|
-
const imageUrl = this.slottedImage?.getAttribute('src');
|
|
69
|
-
if (!imageUrl) {
|
|
70
|
-
if (this.userid) {
|
|
71
|
-
imageLoaded = await this.getImageByProp(this.userid, this.fetchImageByUserId.bind(this));
|
|
72
|
-
}
|
|
73
|
-
if (!imageLoaded && this.email?.match(emailPattern)) {
|
|
74
|
-
imageLoaded = await this.getImageByProp(this.email, this.fetchImageByEmail.bind(this));
|
|
75
|
-
}
|
|
76
|
-
if (!imageLoaded) {
|
|
77
|
-
this.avatarType = AvatarType.Initials;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const slottedImageLoaded = await this.getImageByProp(imageUrl, this.fetchSlottedImage.bind(this));
|
|
82
|
-
if (!slottedImageLoaded) {
|
|
83
|
-
this.slottedImage.style.display = 'none';
|
|
84
|
-
this.avatarType = AvatarType.Initials;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.slottedImage.style.display = 'block';
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async getImageByProp(prop, fetchImage) {
|
|
92
|
-
if (!prop)
|
|
93
|
-
return false;
|
|
94
|
-
let imageResponse;
|
|
95
|
-
try {
|
|
96
|
-
imageResponse = await fetchImage(prop);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
console.info('Loading avatar image failed.', error);
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
if (!imageResponse?.ok) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.imageUrl = imageResponse.url;
|
|
107
|
-
this.imageAlt = `${this.firstname} ${this.lastname} avatar`;
|
|
108
|
-
this.avatarType = AvatarType.Image;
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async fetchImageByUserId() {
|
|
113
|
-
return await fetch(PostAvatar.INTERNAL_USERID_IMAGE_SRC.replace('{userid}', encodeURIComponent(this.userid)));
|
|
114
|
-
}
|
|
115
|
-
async fetchImageByEmail() {
|
|
116
|
-
const email = await cryptify(this.email);
|
|
117
|
-
const imageUrl = GRAVATAR_BASE_URL.replace('{email}', email);
|
|
118
|
-
return await fetch(imageUrl);
|
|
119
|
-
}
|
|
120
|
-
async fetchSlottedImage(imageUrl) {
|
|
121
|
-
return await fetch(imageUrl, { method: 'HEAD' });
|
|
122
|
-
}
|
|
123
|
-
slotChanged() {
|
|
124
|
-
const slot = this.host.shadowRoot.querySelector('slot');
|
|
125
|
-
const assignedNodes = slot?.assignedNodes({ flatten: true }) || [];
|
|
126
|
-
assignedNodes.forEach(node => {
|
|
127
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
128
|
-
const el = node;
|
|
129
|
-
if (el.tagName === 'IMG') {
|
|
130
|
-
this.observeImageSrcChanges(el);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
this.getAvatarImage();
|
|
135
|
-
}
|
|
136
|
-
// Observe the Slotted image src attribute and update the image
|
|
137
|
-
observeImageSrcChanges(img) {
|
|
138
|
-
if (this.slottedImageObserver) {
|
|
139
|
-
this.slottedImageObserver.disconnect();
|
|
140
|
-
}
|
|
141
|
-
this.slottedImageObserver = new MutationObserver(mutations => {
|
|
142
|
-
mutations.forEach(mutation => {
|
|
143
|
-
if (mutation.type === 'attributes' && mutation.attributeName === 'src') {
|
|
144
|
-
this.getAvatarImage();
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
this.slottedImageObserver.observe(img, { attributes: true, attributeFilter: ['src'] });
|
|
149
|
-
}
|
|
150
|
-
connectedCallback() {
|
|
151
|
-
//This provides a fallback by showing the initials while the image is still loading or delayed.
|
|
152
|
-
this.avatarType = AvatarType.Initials;
|
|
153
|
-
this.getAvatarImage();
|
|
154
|
-
}
|
|
155
|
-
componentDidLoad() {
|
|
156
|
-
this.validateFirstname();
|
|
157
|
-
this.validateLastname();
|
|
158
|
-
this.validateDescription();
|
|
159
|
-
this.validateUserId();
|
|
160
|
-
this.validateEmail();
|
|
161
|
-
}
|
|
162
|
-
render() {
|
|
163
|
-
const names = [this.firstname, this.lastname].filter(n => n).map(n => n.trim());
|
|
164
|
-
const initials = names
|
|
165
|
-
.map(n => n.charAt(0))
|
|
166
|
-
.join('')
|
|
167
|
-
.trim();
|
|
168
|
-
const fullname = names.join(' ');
|
|
169
|
-
return (h(Host, { key: '9e596623d1949c62b1f110e311b839d244b249ef', "data-version": version }, h("span", { key: '6722e4096cb0d2f8b5d171f0d84fef98f74e1cd7', class: this.avatarType === 'slotted' ? '' : 'd-none' }, h("slot", { key: '95e8809133eb0de4382e9dc521eda877a6be5a8b', onSlotchange: this.slotChanged.bind(this) })), this.avatarType === 'image' && h("img", { key: 'cb2ed3eab02f28369911997a94617efaeaa5c00a', src: this.imageUrl, alt: this.imageAlt }), this.avatarType === 'initials' && (h("span", { key: '5565b06795c4651537b20e9abd33492d7cb8a9d1', class: "initials" }, initials, h("span", { key: '58ac3ee3a664a13ff82fc201e04e1896e409fbf1' }, this.description ?? fullname)))));
|
|
170
|
-
}
|
|
171
|
-
get host() { return this; }
|
|
172
|
-
static get watchers() { return {
|
|
173
|
-
"firstname": ["validateFirstname"],
|
|
174
|
-
"lastname": ["validateLastname"],
|
|
175
|
-
"userid": ["updateUserid"],
|
|
176
|
-
"email": ["updateEmail"],
|
|
177
|
-
"description": ["validateDescription"]
|
|
178
|
-
}; }
|
|
179
|
-
static get style() { return postAvatarCss; }
|
|
180
|
-
}, [1, "post-avatar", {
|
|
181
|
-
"firstname": [513],
|
|
182
|
-
"lastname": [1],
|
|
183
|
-
"userid": [1],
|
|
184
|
-
"email": [1],
|
|
185
|
-
"description": [1],
|
|
186
|
-
"slottedImage": [32],
|
|
187
|
-
"avatarType": [32],
|
|
188
|
-
"imageUrl": [32],
|
|
189
|
-
"imageAlt": [32],
|
|
190
|
-
"initials": [32],
|
|
191
|
-
"storageKey": [32]
|
|
192
|
-
}, undefined, {
|
|
193
|
-
"firstname": ["validateFirstname"],
|
|
194
|
-
"lastname": ["validateLastname"],
|
|
195
|
-
"userid": ["updateUserid"],
|
|
196
|
-
"email": ["updateEmail"],
|
|
197
|
-
"description": ["validateDescription"]
|
|
198
|
-
}]);
|
|
199
|
-
PostAvatar$1.INTERNAL_USERID_IMAGE_SRC = 'https://web.post.ch/UserProfileImage/{userid}.png';
|
|
200
|
-
function defineCustomElement$1() {
|
|
201
|
-
if (typeof customElements === "undefined") {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const components = ["post-avatar"];
|
|
205
|
-
components.forEach(tagName => { switch (tagName) {
|
|
206
|
-
case "post-avatar":
|
|
207
|
-
if (!customElements.get(tagName)) {
|
|
208
|
-
customElements.define(tagName, PostAvatar$1);
|
|
209
|
-
}
|
|
210
|
-
break;
|
|
211
|
-
} });
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const PostAvatar = PostAvatar$1;
|
|
215
|
-
const defineCustomElement = defineCustomElement$1;
|
|
216
|
-
|
|
217
|
-
export { PostAvatar, defineCustomElement };
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as i,Host as a,transformTag as s}from"@stencil/core/internal/client";import{v as r}from"./package.js";import{c as n,e as o,i as d}from"./breakpoints.js";const c=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;var h;!function(t){t.Slotted="slotted",t.Image="image",t.Initials="initials",t[t.Null=null]="Null"}(h||(h={}));const l=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.avatarType=null,this.imageUrl="",this.imageAlt="",this.initials="",this.storageKey=""}validateFirstname(){n(this,"firstname","string")}validateLastname(){o(this,"lastname","string")}updateUserid(){this.validateUserId(),this.getAvatarImage()}updateEmail(){this.validateEmail(),this.getAvatarImage()}validateDescription(){o(this,"description","string")}validateUserId(){o(this,"userid","string")}validateEmail(){this.email&&d(this,"email",c)}async getAvatarImage(){let t=!1;this.slottedImage=this.host.querySelector("img");const e=this.slottedImage?.getAttribute("src");e?await this.getImageByProp(e,this.fetchSlottedImage.bind(this))?this.slottedImage.style.display="block":(this.slottedImage.style.display="none",this.avatarType=h.Initials):(this.userid&&(t=await this.getImageByProp(this.userid,this.fetchImageByUserId.bind(this))),!t&&this.email?.match(c)&&(t=await this.getImageByProp(this.email,this.fetchImageByEmail.bind(this))),t||(this.avatarType=h.Initials))}async getImageByProp(t,e){if(!t)return!1;let i;try{i=await e(t)}catch(t){return console.info("Loading avatar image failed.",t),!1}return!!i?.ok&&(this.imageUrl=i.url,this.imageAlt=`${this.firstname} ${this.lastname} avatar`,this.avatarType=h.Image,!0)}async fetchImageByUserId(){return await fetch(t.INTERNAL_USERID_IMAGE_SRC.replace("{userid}",encodeURIComponent(this.userid)))}async fetchImageByEmail(){const t=await async function(t){return await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join("")))}(this.email),e="https://www.gravatar.com/avatar/{email}?s=80&d=404&r=g".replace("{email}",t);return await fetch(e)}async fetchSlottedImage(t){return await fetch(t,{method:"HEAD"})}slotChanged(){const t=this.host.shadowRoot.querySelector("slot");(t?.assignedNodes({flatten:!0})||[]).forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&"IMG"===t.tagName&&this.observeImageSrcChanges(t)})),this.getAvatarImage()}observeImageSrcChanges(t){this.slottedImageObserver&&this.slottedImageObserver.disconnect(),this.slottedImageObserver=new MutationObserver((t=>{t.forEach((t=>{"attributes"===t.type&&"src"===t.attributeName&&this.getAvatarImage()}))})),this.slottedImageObserver.observe(t,{attributes:!0,attributeFilter:["src"]})}connectedCallback(){this.avatarType=h.Initials,this.getAvatarImage()}componentDidLoad(){this.validateFirstname(),this.validateLastname(),this.validateDescription(),this.validateUserId(),this.validateEmail()}render(){const t=[this.firstname,this.lastname].filter((t=>t)).map((t=>t.trim())),e=t.map((t=>t.charAt(0))).join("").trim(),s=t.join(" ");return i(a,{key:"620b361e23a70143903abd7bf10bcd804f959042","data-version":r},i("span",{key:"cc3752d89187f0c08dedf2952676de1aaaa59a8a",class:"slotted"===this.avatarType?"":"d-none"},i("slot",{key:"dbba7fc0522b177f6ad467f0e22dad9065582ce7",onSlotchange:this.slotChanged.bind(this)})),"image"===this.avatarType&&i("img",{key:"375eeeab749e09bc21d215aa80cf45309a15620e",src:this.imageUrl,alt:this.imageAlt}),"initials"===this.avatarType&&i("span",{key:"620d25537ef0f606933e9c7deb915a87fbc4b95c",class:"initials"},e,i("span",{key:"03dc6aacddc2af35c114fc6815550e0ec461937d"},this.description??s)))}get host(){return this}static get watchers(){return{firstname:[{validateFirstname:0}],lastname:[{validateLastname:0}],userid:[{updateUserid:0}],email:[{updateEmail:0}],description:[{validateDescription:0}]}}static get style(){return':host{--post-avatar-bg:var(--post-scheme-color-interactive-primary-enabled-bg2);--post-avatar-fg:var(--post-scheme-color-interactive-primary-enabled-fg3);display:inline-flex;position:relative;width:var(--post-device-sizing-interactive-icon-size3);height:var(--post-device-sizing-interactive-icon-size3);background-color:var(--post-scheme-color-interactive-primary-enabled-stroke3);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke3);border-radius:var(--post-device-border-radius-round);font-size:var(--post-device-font-size-8);vertical-align:top;line-height:1}:host::after{display:block;content:"";position:absolute;inset:0;z-index:1;border-radius:inherit}*,*::before,*::after{box-sizing:border-box}slot,img,::slotted(img){display:block;width:100%;height:100%}img,::slotted(img){border-radius:var(--post-device-border-radius-round)}::slotted(:not(img)){display:none !important}.initials{display:flex;justify-content:center;align-items:center;position:relative;width:100%;height:100%;background-color:var(--post-avatar-bg);border-radius:var(--post-device-border-radius-round);color:var(--post-avatar-fg);text-transform:uppercase;font-weight:400}.initials span{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}'}},[257,"post-avatar",{firstname:[513],lastname:[1],userid:[1],email:[1],description:[1],slottedImage:[32],avatarType:[32],imageUrl:[32],imageAlt:[32],initials:[32],storageKey:[32]},void 0,{firstname:[{validateFirstname:0}],lastname:[{validateLastname:0}],userid:[{updateUserid:0}],email:[{updateEmail:0}],description:[{validateDescription:0}]}]);l.INTERNAL_USERID_IMAGE_SRC="https://web.post.ch/UserProfileImage/{userid}.png";const p=l,m=function(){"undefined"!=typeof customElements&&["post-avatar"].forEach((t=>{"post-avatar"===t&&(customElements.get(s(t))||customElements.define(s(t),l))}))};export{p as PostAvatar,m as defineCustomElement}
|
|
@@ -1,144 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { v as version } from './package.js';
|
|
3
|
-
import { c as checkRequiredAndType } from './index2.js';
|
|
4
|
-
import './breakpoints.js';
|
|
5
|
-
import { d as defineCustomElement$2 } from './post-icon2.js';
|
|
6
|
-
|
|
7
|
-
// Define common animation options
|
|
8
|
-
const easing = 'ease';
|
|
9
|
-
const defaultDuration = 500;
|
|
10
|
-
const fill = 'forwards';
|
|
11
|
-
function createSlideFadeAnimation(el, keyframes, duration = defaultDuration) {
|
|
12
|
-
return el.animate(keyframes, {
|
|
13
|
-
duration: duration,
|
|
14
|
-
easing,
|
|
15
|
-
fill,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
function slideUpAndFadeOut(el, translateY = '-100%', duration = defaultDuration) {
|
|
19
|
-
const keyframes = [
|
|
20
|
-
{ transform: 'translateY(0)', opacity: '1' },
|
|
21
|
-
{ transform: `translateY(${translateY})`, opacity: '0' },
|
|
22
|
-
];
|
|
23
|
-
return createSlideFadeAnimation(el, keyframes, duration);
|
|
24
|
-
}
|
|
25
|
-
function slideDownAndFadeIn(el, translateY = '-100%', duration = defaultDuration) {
|
|
26
|
-
const keyframes = [
|
|
27
|
-
{ transform: `translateY(${translateY})`, opacity: '0' },
|
|
28
|
-
{ transform: 'translateY(0)', opacity: '1' },
|
|
29
|
-
];
|
|
30
|
-
return createSlideFadeAnimation(el, keyframes, duration);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const postBackToTopCss = ":host{opacity:0;--post-floating-button-position-top:var(--post-device-position-4);--post-back-to-top-position-top:calc( var(--post-header-height) + var(--post-floating-button-position-top) );--post-back-to-top-elevation:var(--post-device-elevation-300);position:fixed;inset-block-start:var(--post-back-to-top-position-top);inset-inline-end:var(--post-device-position-1)}:host .back-to-top{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;box-shadow:var(--post-back-to-top-elevation);cursor:pointer;border-radius:var(--post-device-border-radius-round);width:var(--post-device-sizing-interactive-button-height-2);height:var(--post-device-sizing-interactive-button-height-2);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-button-secondary-enabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-enabled-bg);display:flex;align-items:center;justify-content:center}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .back-to-top{background-color:ButtonFace !important}:host .back-to-top:hover{background-color:Highlight !important}}:host .back-to-top{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 .back-to-top: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){:host .back-to-top:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host .back-to-top: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){:host .back-to-top:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}:host .back-to-top:hover{border-color:var(--post-scheme-color-interactive-button-secondary-hover-stroke);color:var(--post-scheme-color-interactive-button-secondary-hover-fg);background-color:var(--post-scheme-color-interactive-button-secondary-hover-bg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .back-to-top:hover{color:HighlightText !important}}:host .back-to-top post-icon{height:var(--post-device-sizing-interactive-button-icon-3);width:var(--post-device-sizing-interactive-button-icon-3)}:host .visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
|
|
34
|
-
|
|
35
|
-
const PostBackToTop$1 = /*@__PURE__*/ proxyCustomElement(class PostBackToTop extends HTMLElement {
|
|
36
|
-
constructor() {
|
|
37
|
-
super();
|
|
38
|
-
this.__registerHost();
|
|
39
|
-
this.__attachShadow();
|
|
40
|
-
this.belowFold = false;
|
|
41
|
-
this.handleScroll = () => {
|
|
42
|
-
this.belowFold = this.isBelowFold();
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
isBelowFold() {
|
|
46
|
-
return window.scrollY > window.innerHeight;
|
|
47
|
-
}
|
|
48
|
-
validateLabel() {
|
|
49
|
-
checkRequiredAndType(this, 'label', 'string');
|
|
50
|
-
}
|
|
51
|
-
/*Watch for changes in belowFold to show/hide the back to top button*/
|
|
52
|
-
watchBelowFold(newValue) {
|
|
53
|
-
if (newValue) {
|
|
54
|
-
slideDownAndFadeIn(this.host, this.translateY);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
slideUpAndFadeOut(this.host, this.translateY);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
scrollToTop() {
|
|
61
|
-
window.scrollTo({
|
|
62
|
-
top: 0,
|
|
63
|
-
behavior: 'smooth',
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
getSecondPixelValue(parts) {
|
|
67
|
-
for (const part of parts) {
|
|
68
|
-
const pixelValues = part.match(/\b\d+px\b/g);
|
|
69
|
-
if (pixelValues && pixelValues.length > 1) {
|
|
70
|
-
return pixelValues[1];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
animateButton() {
|
|
75
|
-
// Get the back-to-top button top postiion
|
|
76
|
-
const positionTop = window.getComputedStyle(this.host).getPropertyValue('top');
|
|
77
|
-
const buttonElement = this.host.shadowRoot.querySelector('button');
|
|
78
|
-
// Extract the elevation height from the back-to-top button elevation token
|
|
79
|
-
const elevation = getComputedStyle(buttonElement).getPropertyValue('--post-back-to-top-elevation');
|
|
80
|
-
const elevationParts = elevation.split(',');
|
|
81
|
-
const elevationHeight = this.getSecondPixelValue(elevationParts);
|
|
82
|
-
// The translateY is calculated as => -100% (btt button height) - topPosition - elevationHeight
|
|
83
|
-
this.translateY =
|
|
84
|
-
String((-1 * 100) / 100 -
|
|
85
|
-
parseFloat(positionTop.replace('px', '')) -
|
|
86
|
-
parseFloat(elevationHeight.replace('px', ''))) + 'px';
|
|
87
|
-
if (this.belowFold) {
|
|
88
|
-
slideDownAndFadeIn(this.host, this.translateY);
|
|
89
|
-
}
|
|
90
|
-
if (!this.belowFold) {
|
|
91
|
-
this.host.style.transform = `translateY(${this.translateY})`;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Set the initial state
|
|
95
|
-
componentWillLoad() {
|
|
96
|
-
this.belowFold = this.isBelowFold();
|
|
97
|
-
}
|
|
98
|
-
componentDidLoad() {
|
|
99
|
-
window.addEventListener('scroll', this.handleScroll, false);
|
|
100
|
-
this.animateButton();
|
|
101
|
-
this.validateLabel();
|
|
102
|
-
}
|
|
103
|
-
disconnectedCallback() {
|
|
104
|
-
window.removeEventListener('scroll', this.handleScroll);
|
|
105
|
-
}
|
|
106
|
-
render() {
|
|
107
|
-
return (h(Host, { key: '51abef7d1f650da1476689c46d853f49669da856', "data-version": version }, h("button", { key: '9de175f7962448fa3d658e4a24b01a857925a5b7', class: "back-to-top", "aria-hidden": this.belowFold ? 'false' : 'true', tabindex: this.belowFold ? '0' : '-1', onClick: this.scrollToTop }, h("post-icon", { key: '2913ad9930bccf5f1e72ea611ed3c57a0e4e1ca8', "aria-hidden": "true", name: "arrowup" }), h("span", { key: '44b3f9bf5a16c883282a73bf5cfae77619079c0d', class: "visually-hidden" }, this.label))));
|
|
108
|
-
}
|
|
109
|
-
get host() { return this; }
|
|
110
|
-
static get watchers() { return {
|
|
111
|
-
"label": ["validateLabel"],
|
|
112
|
-
"belowFold": ["watchBelowFold"]
|
|
113
|
-
}; }
|
|
114
|
-
static get style() { return postBackToTopCss; }
|
|
115
|
-
}, [1, "post-back-to-top", {
|
|
116
|
-
"label": [513],
|
|
117
|
-
"belowFold": [32]
|
|
118
|
-
}, undefined, {
|
|
119
|
-
"label": ["validateLabel"],
|
|
120
|
-
"belowFold": ["watchBelowFold"]
|
|
121
|
-
}]);
|
|
122
|
-
function defineCustomElement$1() {
|
|
123
|
-
if (typeof customElements === "undefined") {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const components = ["post-back-to-top", "post-icon"];
|
|
127
|
-
components.forEach(tagName => { switch (tagName) {
|
|
128
|
-
case "post-back-to-top":
|
|
129
|
-
if (!customElements.get(tagName)) {
|
|
130
|
-
customElements.define(tagName, PostBackToTop$1);
|
|
131
|
-
}
|
|
132
|
-
break;
|
|
133
|
-
case "post-icon":
|
|
134
|
-
if (!customElements.get(tagName)) {
|
|
135
|
-
defineCustomElement$2();
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
} });
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const PostBackToTop = PostBackToTop$1;
|
|
142
|
-
const defineCustomElement = defineCustomElement$1;
|
|
143
|
-
|
|
144
|
-
export { PostBackToTop, defineCustomElement };
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as o,h as e,Host as i,transformTag as s}from"@stencil/core/internal/client";import{f as a}from"./fade-slide.js";import{v as c}from"./package.js";import{c as r}from"./breakpoints.js";import{d as n}from"./post-icon2.js";const l=t(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.belowFold=!1,this.handleScroll=()=>{this.belowFold=this.isBelowFold()}}isBelowFold(){return window.scrollY>window.innerHeight}validateTextBackToTop(){r(this,"textBackToTop","string")}watchBelowFold(t){a(this.host,t?"in":"out",{translate:this.translateY,fill:"forwards"})}scrollToTop(){window.scrollTo({top:0,behavior:"smooth"})}getSecondPixelValue(t){for(const o of t){const t=o.match(/\b\d+px\b/g);if(t&&t.length>1)return t[1]}}animateButton(){const t=window.getComputedStyle(this.host).getPropertyValue("top"),o=this.host.shadowRoot.querySelector("button"),e=getComputedStyle(o).getPropertyValue("--post-back-to-top-elevation").split(","),i=this.getSecondPixelValue(e);this.translateY=-1-parseFloat(t.replace("px",""))-parseFloat(i.replace("px","")),this.belowFold&&a(this.host,"in",{translate:this.translateY,fill:"forwards"}),this.belowFold||(this.host.style.transform=`translateY(${this.translateY})`)}componentWillLoad(){this.belowFold=this.isBelowFold()}componentDidLoad(){window.addEventListener("scroll",this.handleScroll,!1),this.animateButton(),this.validateTextBackToTop()}disconnectedCallback(){window.removeEventListener("scroll",this.handleScroll)}render(){return e(i,{key:"a6a5afe41d76c9b2b703f4a78e63849a1437680f","data-version":c},e("button",{key:"ad10b46cf4d07d1efffae6feef7431ba8a11c59e",class:"back-to-top","aria-hidden":this.belowFold?"false":"true",tabindex:this.belowFold?"0":"-1",onClick:this.scrollToTop},e("post-icon",{key:"e95c5710939aa968df42f3acec2d56b2eaaa238e","aria-hidden":"true",name:"arrowup"}),e("span",{key:"f854524e0b76f71ef1edfed5a13d57985ac98ea5",class:"visually-hidden"},this.textBackToTop)))}get host(){return this}static get watchers(){return{textBackToTop:[{validateTextBackToTop:0}],belowFold:[{watchBelowFold:0}]}}static get style(){return":host{opacity:0;--post-floating-button-position-top:var(--post-device-position-4);--post-back-to-top-position-top:calc( var(--post-header-height) + var(--post-floating-button-position-top) );--post-back-to-top-elevation:var(--post-device-elevation-300);position:fixed;inset-block-start:var(--post-back-to-top-position-top);inset-inline-end:var(--post-device-position-1)}:host .back-to-top{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;box-shadow:var(--post-back-to-top-elevation);cursor:pointer;border-radius:var(--post-device-border-radius-round);width:var(--post-device-sizing-interactive-button-height-2);height:var(--post-device-sizing-interactive-button-height-2);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-button-secondary-enabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-enabled-bg);display:flex;align-items:center;justify-content:center}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .back-to-top{background-color:ButtonFace !important}:host .back-to-top:hover{background-color:Highlight !important}}:host .back-to-top{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 .back-to-top: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){:host .back-to-top:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host .back-to-top: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){:host .back-to-top:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}:host .back-to-top:hover{border-color:var(--post-scheme-color-interactive-button-secondary-hover-stroke);color:var(--post-scheme-color-interactive-button-secondary-hover-fg);background-color:var(--post-scheme-color-interactive-button-secondary-hover-bg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .back-to-top:hover{color:HighlightText !important}}:host .back-to-top post-icon{height:var(--post-device-sizing-interactive-button-icon-3);width:var(--post-device-sizing-interactive-button-icon-3)}:host .visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}"}},[1,"post-back-to-top",{textBackToTop:[513,"text-back-to-top"],belowFold:[32]},void 0,{textBackToTop:[{validateTextBackToTop:0}],belowFold:[{watchBelowFold:0}]}]),p=l,d=function(){"undefined"!=typeof customElements&&["post-back-to-top","post-icon"].forEach((t=>{switch(t){case"post-back-to-top":customElements.get(s(t))||customElements.define(s(t),l);break;case"post-icon":customElements.get(s(t))||n()}}))};export{p as PostBackToTop,d as defineCustomElement}
|