@swisspost/design-system-components 10.0.0-next.47 → 10.0.0-next.49
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/{event-from-AKK8RQrn.js → event-from-C6kpQwhw.js} +2 -2
- package/dist/cjs/index-CpDyH7Ww.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-wsZ6ig4j.js → package-CR0YynRY.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +6 -6
- package/dist/cjs/post-avatar.cjs.entry.js +107 -80
- package/dist/cjs/post-back-to-top.cjs.entry.js +2 -2
- package/dist/cjs/post-banner.cjs.entry.js +3 -3
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +3 -3
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +4 -4
- package/dist/cjs/post-card-control.cjs.entry.js +4 -4
- package/dist/cjs/post-closebutton_15.cjs.entry.js +133 -74
- package/dist/cjs/post-collapsible_2.cjs.entry.js +4 -4
- package/dist/cjs/post-components.cjs.js +1 -1
- package/dist/cjs/post-footer.cjs.entry.js +3 -3
- package/dist/cjs/post-linkarea.cjs.entry.js +19 -8
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/post-tabs.cjs.entry.js +2 -2
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +2 -2
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -3
- package/dist/collection/animations/pop-in.js +14 -0
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +5 -5
- package/dist/collection/components/post-avatar/avatar-utils.js +16 -0
- package/dist/collection/components/post-avatar/post-avatar.css +1 -1
- package/dist/collection/components/post-avatar/post-avatar.js +119 -82
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +1 -1
- package/dist/collection/components/post-banner/post-banner.js +2 -2
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +2 -2
- package/dist/collection/components/post-card-control/post-card-control.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.js +2 -2
- package/dist/collection/components/post-closebutton/post-closebutton.js +1 -19
- package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +1 -1
- package/dist/collection/components/post-footer/post-footer.css +1 -1
- package/dist/collection/components/post-footer/post-footer.js +1 -1
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +11 -2
- package/dist/collection/components/post-icon/post-icon.js +39 -33
- package/dist/collection/components/post-language-option/post-language-option.css +1 -1
- package/dist/collection/components/post-language-option/post-language-option.js +1 -2
- package/dist/collection/components/post-language-switch/post-language-switch.js +1 -2
- package/dist/collection/components/post-linkarea/post-linkarea.css +1 -1
- package/dist/collection/components/post-linkarea/post-linkarea.js +24 -6
- package/dist/collection/components/post-list/post-list.css +1 -1
- package/dist/collection/components/post-list/post-list.js +1 -1
- package/dist/collection/components/post-list-item/post-list-item.js +1 -1
- package/dist/collection/components/post-logo/post-logo.js +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +12 -2
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
- package/dist/collection/components/post-menu/post-menu.css +1 -1
- package/dist/collection/components/post-menu/post-menu.js +41 -5
- package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +18 -7
- package/dist/collection/components/post-rating/post-rating.css +1 -1
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +3 -3
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +2 -2
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +1 -1
- package/dist/collection/utils/event-from.js +2 -2
- package/dist/component-names.json +39 -0
- package/dist/{esm/event-from-8U5GFtQP.js → components/event-from.js} +2 -2
- package/dist/components/get-root.js +15 -0
- package/dist/components/index.d.ts +73 -0
- package/dist/components/index.js +36 -2315
- package/dist/components/package.js +3 -0
- package/dist/components/post-accordion-item.js +1 -1
- package/dist/components/post-accordion-item2.js +113 -0
- package/dist/components/post-accordion.js +1 -1
- package/dist/components/post-accordion2.js +138 -0
- package/dist/components/post-avatar.js +117 -88
- package/dist/components/post-back-to-top.js +7 -8
- package/dist/components/post-banner.js +10 -11
- package/dist/components/post-breadcrumb-item.js +1 -1
- package/dist/components/post-breadcrumb-item2.js +79 -0
- package/dist/components/post-breadcrumbs.js +16 -17
- package/dist/components/post-card-control.js +11 -12
- package/dist/components/post-closebutton.js +5 -7
- package/dist/components/post-collapsible-trigger.js +1 -1
- package/dist/components/post-collapsible-trigger2.js +135 -0
- package/dist/components/post-collapsible.js +1 -1
- package/dist/components/post-collapsible2.js +110 -0
- package/dist/components/post-footer.js +12 -13
- package/dist/components/post-header.js +18 -10
- package/dist/components/post-icon.js +1 -1
- package/dist/components/post-icon2.js +159 -0
- package/dist/components/post-language-option.js +10 -12
- package/dist/components/post-language-switch.js +13 -15
- package/dist/components/post-linkarea.js +24 -12
- package/dist/components/post-list-item.js +4 -5
- package/dist/components/post-list.js +6 -7
- package/dist/components/post-logo.js +6 -7
- package/dist/components/post-mainnavigation.js +6 -7
- package/dist/components/post-megadropdown-trigger.js +7 -8
- package/dist/components/post-megadropdown.js +20 -11
- package/dist/components/post-menu-item.js +1 -1
- package/dist/components/post-menu-item2.js +30 -0
- package/dist/components/post-menu-trigger.js +1 -1
- package/dist/components/post-menu-trigger2.js +110 -0
- package/dist/components/post-menu.js +1 -1
- package/dist/components/post-menu2.js +237 -0
- package/dist/components/post-popover.js +8 -9
- package/dist/components/post-popovercontainer.js +1 -1
- package/dist/components/post-popovercontainer2.js +3043 -0
- package/dist/components/post-rating.js +10 -11
- package/dist/components/post-tab-header.js +8 -9
- package/dist/components/post-tab-panel.js +7 -8
- package/dist/components/post-tabs.js +7 -8
- package/dist/components/post-togglebutton.js +4 -5
- package/dist/components/post-tooltip-trigger.js +7 -8
- package/dist/components/post-tooltip.js +8 -9
- package/dist/components/react/index.d.ts +33 -0
- package/dist/components/react/index.js +2315 -0
- package/dist/components/{p-Cxrx7SXz.js → react/p-Amg0f2Yo.js} +40 -34
- package/dist/components/{p-C0H2ohSv.js → react/p-B6vPT8S3.js} +3 -3
- package/dist/components/{p-336Lbkey.js → react/p-BDs0pvkX.js} +2 -2
- package/dist/components/react/p-BLchVpF6.js +14 -0
- package/dist/components/{p-BM8mtEfS.js → react/p-BMdFdJWl.js} +2 -2
- package/dist/components/{p-DP5pj8mq.js → react/p-BS0ZqwA-.js} +31 -6
- package/dist/components/react/p-C35MCWIp.js +35 -0
- package/dist/components/react/p-CJ80BZ06.js +178 -0
- package/dist/{esm/index-BWC0gtGU.js → components/react/p-CV7fm1rW.js} +1 -1
- package/dist/components/react/p-C_2k3G1c.js +264 -0
- package/dist/components/{p-DVGX_JCp.js → react/p-D1oOccKr.js} +3 -3
- package/dist/components/{p-pHxypsHK.js → react/p-D50E7y6E.js} +24 -9
- package/dist/components/react/p-DO48NanC.js +3 -0
- package/dist/components/{p-i0-mizzM.js → react/p-DOo9tmN-.js} +2 -2
- package/dist/components/{p-DEi5TIMq.js → react/p-Do9awHW7.js} +3 -3
- package/dist/components/react/p-SbIC4aZX.js +11 -0
- package/dist/components/{p-8U5GFtQP.js → react/p-kraHE1r3.js} +2 -2
- package/dist/components/react/p-r4txK0AC.js +3 -0
- package/dist/components/{p-BSvy4uym.js → react/p-xelWyg_P.js} +8 -8
- package/dist/components/react/post-accordion-item.d.ts +11 -0
- package/dist/components/react/post-accordion-item.js +6 -0
- package/dist/components/react/post-accordion.d.ts +11 -0
- package/dist/components/react/post-accordion.js +6 -0
- package/dist/components/react/post-avatar.d.ts +11 -0
- package/dist/components/react/post-avatar.js +218 -0
- package/dist/components/react/post-back-to-top.d.ts +11 -0
- package/dist/components/react/post-back-to-top.js +145 -0
- package/dist/components/react/post-banner.d.ts +11 -0
- package/dist/components/react/post-banner.js +99 -0
- package/dist/components/react/post-breadcrumb-item.d.ts +11 -0
- package/dist/components/react/post-breadcrumb-item.js +6 -0
- package/dist/components/react/post-breadcrumbs.d.ts +11 -0
- package/dist/components/react/post-breadcrumbs.js +187 -0
- package/dist/components/react/post-card-control.d.ts +11 -0
- package/dist/components/react/post-card-control.js +327 -0
- package/dist/components/react/post-closebutton.d.ts +11 -0
- package/dist/components/react/post-closebutton.js +50 -0
- package/dist/components/react/post-collapsible-trigger.d.ts +11 -0
- package/dist/components/react/post-collapsible-trigger.js +6 -0
- package/dist/components/react/post-collapsible.d.ts +11 -0
- package/dist/components/react/post-collapsible.js +6 -0
- package/dist/components/react/post-footer.d.ts +11 -0
- package/dist/components/react/post-footer.js +117 -0
- package/dist/components/react/post-header.d.ts +11 -0
- package/dist/components/react/post-header.js +342 -0
- package/dist/components/react/post-icon.d.ts +11 -0
- package/dist/components/react/post-icon.js +6 -0
- package/dist/components/react/post-language-option.d.ts +11 -0
- package/dist/components/react/post-language-option.js +100 -0
- package/dist/components/react/post-language-switch.d.ts +11 -0
- package/dist/components/react/post-language-switch.js +158 -0
- package/dist/components/react/post-linkarea.d.ts +11 -0
- package/dist/components/react/post-linkarea.js +59 -0
- package/dist/components/react/post-list-item.d.ts +11 -0
- package/dist/components/react/post-list-item.js +39 -0
- package/dist/components/react/post-list.d.ts +11 -0
- package/dist/components/react/post-list.js +62 -0
- package/dist/components/react/post-logo.d.ts +11 -0
- package/dist/components/react/post-logo.js +59 -0
- package/dist/components/react/post-mainnavigation.d.ts +11 -0
- package/dist/components/react/post-mainnavigation.js +181 -0
- package/dist/components/react/post-megadropdown-trigger.d.ts +11 -0
- package/dist/components/react/post-megadropdown-trigger.js +137 -0
- package/dist/components/react/post-megadropdown.d.ts +11 -0
- package/dist/components/react/post-megadropdown.js +207 -0
- package/dist/components/react/post-menu-item.d.ts +11 -0
- package/dist/components/react/post-menu-item.js +6 -0
- package/dist/components/react/post-menu-trigger.d.ts +11 -0
- package/dist/components/react/post-menu-trigger.js +6 -0
- package/dist/components/react/post-menu.d.ts +11 -0
- package/dist/components/react/post-menu.js +6 -0
- package/dist/components/react/post-popover.d.ts +11 -0
- package/dist/components/react/post-popover.js +189 -0
- package/dist/components/react/post-popovercontainer.d.ts +11 -0
- package/dist/components/react/post-popovercontainer.js +6 -0
- package/dist/components/react/post-rating.d.ts +11 -0
- package/dist/components/react/post-rating.js +153 -0
- package/dist/components/react/post-tab-header.d.ts +11 -0
- package/dist/components/react/post-tab-header.js +53 -0
- package/dist/components/react/post-tab-panel.d.ts +11 -0
- package/dist/components/react/post-tab-panel.js +55 -0
- package/dist/components/react/post-tabs.d.ts +11 -0
- package/dist/components/react/post-tabs.js +197 -0
- package/dist/components/react/post-togglebutton.d.ts +11 -0
- package/dist/components/react/post-togglebutton.js +57 -0
- package/dist/components/react/post-tooltip-trigger.d.ts +11 -0
- package/dist/components/react/post-tooltip-trigger.js +5223 -0
- package/dist/components/react/post-tooltip.d.ts +11 -0
- package/dist/components/react/post-tooltip.js +115 -0
- package/dist/components/switch-variants.js +3 -0
- package/dist/docs.json +71 -35
- package/dist/esm/event-from-kraHE1r3.js +105 -0
- package/dist/esm/index-C8a0ddDa.js +4 -4
- package/dist/esm/index-VmK3ABCB.js +88 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/package-DO48NanC.js +3 -0
- package/dist/esm/post-accordion_2.entry.js +7 -7
- package/dist/esm/post-avatar.entry.js +108 -81
- package/dist/esm/post-back-to-top.entry.js +3 -3
- package/dist/esm/post-banner.entry.js +4 -4
- package/dist/esm/post-breadcrumb-item_2.entry.js +4 -4
- package/dist/esm/post-breadcrumbs.entry.js +5 -5
- package/dist/esm/post-card-control.entry.js +5 -5
- package/dist/esm/post-closebutton_15.entry.js +135 -76
- package/dist/esm/post-collapsible_2.entry.js +5 -5
- package/dist/esm/post-components.js +1 -1
- package/dist/esm/post-footer.entry.js +4 -4
- package/dist/esm/post-linkarea.entry.js +19 -8
- package/dist/esm/post-popover.entry.js +4 -4
- package/dist/esm/post-rating.entry.js +4 -4
- package/dist/esm/post-tab-header.entry.js +4 -4
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/post-tabs.entry.js +2 -2
- package/dist/esm/post-tooltip-trigger.entry.js +3 -3
- package/dist/esm/post-tooltip.entry.js +4 -4
- package/dist/loader/cdn.js +1 -0
- package/dist/loader/index.cjs.js +1 -0
- package/{loader → dist/loader}/index.d.ts +1 -1
- package/dist/loader/index.es2017.js +1 -0
- package/{loader → dist/loader}/index.js +1 -1
- package/dist/post-components/p-01bc39c2.entry.js +1 -0
- package/dist/post-components/p-0dc1e940.entry.js +1 -0
- package/dist/post-components/p-16da91bc.entry.js +1 -0
- package/dist/post-components/p-26a04741.entry.js +1 -0
- package/dist/post-components/p-2f2f9b22.entry.js +1 -0
- package/dist/post-components/{p-45007aac.entry.js → p-33008981.entry.js} +1 -1
- package/dist/post-components/p-36358cd4.entry.js +1 -0
- package/dist/post-components/p-71c48d48.entry.js +1 -0
- package/dist/post-components/{p-e9802b56.entry.js → p-84395e1d.entry.js} +1 -1
- package/dist/post-components/p-848c10ac.entry.js +1 -0
- package/dist/post-components/{p-ab8017bb.entry.js → p-8d2e5814.entry.js} +1 -1
- package/dist/post-components/{p-a2fa5ce4.entry.js → p-9dbe6595.entry.js} +1 -1
- package/dist/post-components/p-DO48NanC.js +1 -0
- package/dist/post-components/{p-BWC0gtGU.js → p-VmK3ABCB.js} +1 -1
- package/dist/post-components/p-a982458f.entry.js +1 -0
- package/dist/post-components/{p-f67b616a.entry.js → p-b0aaa058.entry.js} +1 -1
- package/dist/post-components/{p-bbe02ba3.entry.js → p-bdeef760.entry.js} +1 -1
- package/dist/post-components/{p-2f698af4.entry.js → p-d221395c.entry.js} +1 -1
- package/dist/post-components/{p-57703aee.entry.js → p-e49aa78e.entry.js} +1 -1
- package/dist/post-components/p-eb405167.entry.js +1 -0
- package/dist/post-components/p-kraHE1r3.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/animations/pop-in.d.ts +1 -0
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +3 -3
- package/dist/types/components/post-avatar/avatar-utils.d.ts +3 -0
- package/dist/types/components/post-avatar/post-avatar.d.ts +17 -13
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +0 -6
- package/dist/types/components/post-header/post-header.d.ts +2 -0
- package/dist/types/components/post-icon/post-icon.d.ts +11 -0
- package/dist/types/components/post-linkarea/post-linkarea.d.ts +6 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +2 -1
- package/dist/types/components/post-menu/post-menu.d.ts +7 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +6 -2
- package/dist/types/components/post-tabs/post-tabs.d.ts +2 -2
- package/dist/types/components.d.ts +19 -22
- package/dist/types/utils/component-on-ready.d.ts +2 -2
- package/hydrate/index.js +308 -201
- package/hydrate/index.mjs +308 -201
- package/package.json +24 -12
- package/dist/components/p-Z01QMrov.js +0 -3
- package/dist/esm/package-Z01QMrov.js +0 -3
- package/dist/post-components/p-031f7489.entry.js +0 -1
- package/dist/post-components/p-1e6a068a.entry.js +0 -1
- package/dist/post-components/p-2ca196d6.entry.js +0 -1
- package/dist/post-components/p-3adbdda7.entry.js +0 -1
- package/dist/post-components/p-7b8ab026.entry.js +0 -1
- package/dist/post-components/p-8U5GFtQP.js +0 -1
- package/dist/post-components/p-9428231b.entry.js +0 -1
- package/dist/post-components/p-Z01QMrov.js +0 -1
- package/dist/post-components/p-ac73ab00.entry.js +0 -1
- package/dist/post-components/p-c1cf39cb.entry.js +0 -1
- package/dist/post-components/p-d0d92071.entry.js +0 -1
- package/dist/post-components/p-e96239c4.entry.js +0 -1
- package/dist/prebuild.js +0 -26
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/prebuild.d.ts +0 -1
- package/loader/cdn.js +0 -1
- package/loader/index.cjs.js +0 -1
- package/loader/index.es2017.js +0 -1
- /package/dist/components/{p-CJ80BZ06.js → breakpoints.js} +0 -0
- /package/dist/components/{p-SbIC4aZX.js → fade.js} +0 -0
- /package/dist/components/{p-C35MCWIp.js → get-focusable-children.js} +0 -0
- /package/dist/components/{p-r4txK0AC.js → heading-levels.js} +0 -0
- /package/dist/components/{p-BLchVpF6.js → index.browser.js} +0 -0
- /package/dist/components/{p-CV7fm1rW.js → index2.js} +0 -0
- /package/dist/components/{p-C_2k3G1c.js → long-press-event.js} +0 -0
- /package/dist/components/{p-CBFgkSgY.js → react/p-CBFgkSgY.js} +0 -0
- /package/dist/components/{p-DjIHLduJ.js → react/p-DjIHLduJ.js} +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
+
import { v as version } from './p-DO48NanC.js';
|
|
3
|
+
import { c as checkRequiredAndType, e as checkEmptyOrType, f as checkEmptyOrPattern } from './p-CV7fm1rW.js';
|
|
4
|
+
import './p-CJ80BZ06.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;z-index:2;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}.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 H {
|
|
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
|
+
defineCustomElement$1();
|
|
214
|
+
|
|
215
|
+
const PostAvatar = PostAvatar$1;
|
|
216
|
+
const defineCustomElement = defineCustomElement$1;
|
|
217
|
+
|
|
218
|
+
export { PostAvatar, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../../types/components";
|
|
2
|
+
|
|
3
|
+
interface PostBackToTop extends Components.PostBackToTop, HTMLElement {}
|
|
4
|
+
export const PostBackToTop: {
|
|
5
|
+
prototype: PostBackToTop;
|
|
6
|
+
new (): PostBackToTop;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
+
import { v as version } from './p-DO48NanC.js';
|
|
3
|
+
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
4
|
+
import './p-CJ80BZ06.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './p-Amg0f2Yo.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 H {
|
|
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: '281a177c37cbf98d72a0d6359483750762026b23', "aria-hidden": "true", name: "3026" }), h("span", { key: '9c019806112c905bb6ba2e8ac4da85bcbd334566', 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
|
+
defineCustomElement$1();
|
|
141
|
+
|
|
142
|
+
const PostBackToTop = PostBackToTop$1;
|
|
143
|
+
const defineCustomElement = defineCustomElement$1;
|
|
144
|
+
|
|
145
|
+
export { PostBackToTop, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../../types/components";
|
|
2
|
+
|
|
3
|
+
interface PostBanner extends Components.PostBanner, HTMLElement {}
|
|
4
|
+
export const PostBanner: {
|
|
5
|
+
prototype: PostBanner;
|
|
6
|
+
new (): PostBanner;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|