@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
2
|
import { I as IS_BROWSER } from './p-CJ80BZ06.js';
|
|
3
3
|
import { d as checkEmptyOrOneOf, e as checkEmptyOrType, c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
4
|
-
import { v as version } from './p-
|
|
4
|
+
import { v as version } from './p-DO48NanC.js';
|
|
5
5
|
|
|
6
6
|
const postIconCss = ":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
|
|
7
7
|
|
|
@@ -44,52 +44,58 @@ const PostIcon = /*@__PURE__*/ proxyCustomElement(class PostIcon extends H {
|
|
|
44
44
|
validateScale() {
|
|
45
45
|
checkEmptyOrType(this, 'scale', 'number');
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Construct the icon URL according to the following rules:
|
|
49
|
+
* 1. `@base` (absolute URL) → use directly.
|
|
50
|
+
* 2. `@base` (relative URL) → resolve with `base href` and/or `origin`
|
|
51
|
+
* - If `base href` is absolute → use just that.
|
|
52
|
+
* - If `base href` is relative → prepend with `origin`.
|
|
53
|
+
* - If `base href` does not exist → use only `origin`.
|
|
54
|
+
* 3. `@meta` (absolute URL) → use directly.
|
|
55
|
+
* 4. `@meta` (relative URL) → resolve with `base href` and/or `origin`. (same as above)
|
|
56
|
+
* 5. `CDN_URL` fallback → `https://unpkg.com/...`.
|
|
57
|
+
**/
|
|
51
58
|
getUrl() {
|
|
52
59
|
const fileName = `${this.name}.svg`;
|
|
53
60
|
if (!IS_BROWSER && !this.base) {
|
|
54
61
|
return `${CDN_URL}${fileName}`;
|
|
55
62
|
}
|
|
63
|
+
const isAbsolute = (url) => /^https?:\/\//.test(url);
|
|
64
|
+
const normalizeUrl = (url) => (url && !url.endsWith('/') ? `${url}/` : url);
|
|
65
|
+
const cleanUrl = (url) => url.replace(/([^:])\/\//g, '$1/');
|
|
56
66
|
const currentDomain = IS_BROWSER ? window.location.origin : '';
|
|
57
67
|
const baseHref = IS_BROWSER
|
|
58
68
|
? document.querySelector('base[href]')?.getAttribute('href') || ''
|
|
59
69
|
: '';
|
|
60
|
-
const isBaseHrefAbsolute = /^https?:\/\//.test(baseHref);
|
|
61
70
|
const metaIconBase = IS_BROWSER
|
|
62
|
-
? document
|
|
63
|
-
.querySelector('meta[name="design-system-settings"]')
|
|
64
|
-
?.getAttribute('data-post-icon-base') || ''
|
|
71
|
+
? document.querySelector('meta[name="design-system-settings"]')?.getAttribute('data-post-icon-base') || ''
|
|
65
72
|
: '';
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return
|
|
74
|
-
}
|
|
73
|
+
// Function to build the first part of the URL when 'this.base' or 'metaIconBase' are relative
|
|
74
|
+
const buildUrlWithBase = (relativeUrl) => {
|
|
75
|
+
const normalizedHref = normalizeUrl(baseHref);
|
|
76
|
+
const normalizedRelative = normalizeUrl(relativeUrl);
|
|
77
|
+
if (isAbsolute(normalizedHref)) {
|
|
78
|
+
return `${normalizedHref}${normalizedRelative}`;
|
|
79
|
+
}
|
|
80
|
+
return `${currentDomain}${normalizedHref}${normalizedRelative}`;
|
|
81
|
+
};
|
|
75
82
|
let url;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
url =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
url = `${normalizedBaseHref}${normalizedIconBase}${fileName}`;
|
|
83
|
-
}
|
|
84
|
-
else if (iconBase || baseHref) {
|
|
85
|
-
// Standard case: domain + baseHref + iconBase
|
|
86
|
-
url = `${currentDomain}${normalizedBaseHref}${normalizedIconBase}${fileName}`;
|
|
83
|
+
// Highest Priority is this.base
|
|
84
|
+
if (this.base) {
|
|
85
|
+
url = isAbsolute(this.base)
|
|
86
|
+
? `${normalizeUrl(this.base)}${fileName}`
|
|
87
|
+
: `${buildUrlWithBase(this.base)}${fileName}`;
|
|
88
|
+
return cleanUrl(url);
|
|
87
89
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
url =
|
|
90
|
+
// Second Priority is metaIconBase
|
|
91
|
+
if (metaIconBase) {
|
|
92
|
+
url = isAbsolute(metaIconBase)
|
|
93
|
+
? `${normalizeUrl(metaIconBase)}${fileName}`
|
|
94
|
+
: `${buildUrlWithBase(metaIconBase)}${fileName}`;
|
|
95
|
+
return cleanUrl(url);
|
|
91
96
|
}
|
|
92
|
-
|
|
97
|
+
// Fallback to CDN
|
|
98
|
+
return cleanUrl(`${CDN_URL}${fileName}`);
|
|
93
99
|
}
|
|
94
100
|
getStyles() {
|
|
95
101
|
const url = this.getUrl();
|
|
@@ -110,7 +116,7 @@ const PostIcon = /*@__PURE__*/ proxyCustomElement(class PostIcon extends H {
|
|
|
110
116
|
this.validateAnimation();
|
|
111
117
|
}
|
|
112
118
|
render() {
|
|
113
|
-
return (h(Host, { key: '
|
|
119
|
+
return (h(Host, { key: '521fb549cef7d0838c999628cf69c5c23e87dfc6', "data-version": version }, h("span", { key: 'cc9ca579bd90fee8cec7868c697bfe59dd677246', style: this.getStyles() })));
|
|
114
120
|
}
|
|
115
121
|
get host() { return this; }
|
|
116
122
|
static get watchers() { return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-DO48NanC.js';
|
|
3
3
|
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
4
4
|
import './p-CJ80BZ06.js';
|
|
5
|
-
import { E as EventFrom } from './p-
|
|
5
|
+
import { E as EventFrom } from './p-kraHE1r3.js';
|
|
6
6
|
import { g as getRoot } from './p-CBFgkSgY.js';
|
|
7
7
|
|
|
8
8
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -103,7 +103,7 @@ const PostCollapsibleTrigger = /*@__PURE__*/ proxyCustomElement(class PostCollap
|
|
|
103
103
|
this.updateAriaAttributes();
|
|
104
104
|
}
|
|
105
105
|
render() {
|
|
106
|
-
return (h(Host, { key: '
|
|
106
|
+
return (h(Host, { key: 'd0851c032e622f4a182e1321331e84eaa0440245', "data-version": version }, h("slot", { key: 'd495c42f409de0f9230c01031ecddab69cead1b7' })));
|
|
107
107
|
}
|
|
108
108
|
get host() { return this; }
|
|
109
109
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-DO48NanC.js';
|
|
3
3
|
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
4
4
|
import './p-CJ80BZ06.js';
|
|
5
5
|
import { g as getRoot } from './p-CBFgkSgY.js';
|
|
@@ -80,7 +80,7 @@ const PostMenuTrigger = /*@__PURE__*/ proxyCustomElement(class PostMenuTrigger e
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
|
-
return (h(Host, { key: '
|
|
83
|
+
return (h(Host, { key: '14592f9564fdb09b2e809374d5794bf71f576dbb', "data-version": version, "tab-index": "-1" }, h("slot", { key: 'a0f463000420df39035cc5a48369d230394b5e04' })));
|
|
84
84
|
}
|
|
85
85
|
get host() { return this; }
|
|
86
86
|
static get watchers() { return {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const urlAlphabet =
|
|
2
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
3
|
+
|
|
4
|
+
/* @ts-self-types="./index.d.ts" */
|
|
5
|
+
let nanoid = (size = 21) => {
|
|
6
|
+
let id = '';
|
|
7
|
+
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
|
|
8
|
+
while (size--) {
|
|
9
|
+
id += urlAlphabet[bytes[size] & 63];
|
|
10
|
+
}
|
|
11
|
+
return id
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { nanoid as n };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-DO48NanC.js';
|
|
3
3
|
import { I as IS_BROWSER } from './p-CJ80BZ06.js';
|
|
4
4
|
import { e as checkEmptyOrType } from './p-CV7fm1rW.js';
|
|
5
5
|
|
|
@@ -80,7 +80,7 @@ const PostCollapsible = /*@__PURE__*/ proxyCustomElement(class PostCollapsible e
|
|
|
80
80
|
triggers.forEach(trigger => trigger.update());
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
|
-
return (h(Host, { key: '
|
|
83
|
+
return (h(Host, { key: '3a11f1a60c536544881def998bcdf81f6d248837', "data-version": version, tabindex: this.collapsed ? -1 : undefined }, h("slot", { key: '6ea66375cdffefd02c8293aa1542c4cbfce905a4' })));
|
|
84
84
|
}
|
|
85
85
|
get host() { return this; }
|
|
86
86
|
static get watchers() { return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, a as Host } from './index.js';
|
|
2
2
|
import { I as IS_BROWSER } from './p-CJ80BZ06.js';
|
|
3
3
|
import { d as checkEmptyOrOneOf, e as checkEmptyOrType } from './p-CV7fm1rW.js';
|
|
4
|
-
import { v as version } from './p-
|
|
4
|
+
import { v as version } from './p-DO48NanC.js';
|
|
5
5
|
|
|
6
6
|
const PLACEMENT_TYPES = [
|
|
7
7
|
'top',
|
|
@@ -2707,13 +2707,29 @@ function apply() {
|
|
|
2707
2707
|
injectStyles(document);
|
|
2708
2708
|
}
|
|
2709
2709
|
|
|
2710
|
-
const
|
|
2710
|
+
const duration = 250;
|
|
2711
|
+
const easing = 'ease-out';
|
|
2712
|
+
function popIn(el) {
|
|
2713
|
+
if (!el)
|
|
2714
|
+
return;
|
|
2715
|
+
return el.animate([
|
|
2716
|
+
{ transform: 'scale(0.9)', opacity: 0 },
|
|
2717
|
+
{ transform: 'scale(1)', opacity: 1 },
|
|
2718
|
+
], {
|
|
2719
|
+
duration,
|
|
2720
|
+
easing,
|
|
2721
|
+
fill: 'forwards',
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:var(--post-device-elevation-300);width:max-content;max-width:100%;color:var(--post-current-fg);background-color:var(--post-current-bg);border-radius:4px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:where(post-popovercontainer)>div{border:2px solid rgba(0,0,0,0)}}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--post-safe-space-cursor-x, 0) var(--post-safe-space-cursor-y, 0), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--post-safe-space-trigger-x-start, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-start, 0)), var(--post-safe-space-trigger-x-end, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-end, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)))}:where(post-popovercontainer):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}";
|
|
2711
2726
|
|
|
2712
2727
|
const PostPopovercontainer = /*@__PURE__*/ proxyCustomElement(class PostPopovercontainer extends H {
|
|
2713
2728
|
constructor() {
|
|
2714
2729
|
super();
|
|
2715
2730
|
this.__registerHost();
|
|
2716
2731
|
this.postToggle = createEvent(this, "postToggle");
|
|
2732
|
+
this.firstOpen = true;
|
|
2717
2733
|
/**
|
|
2718
2734
|
* Defines the placement of the popovercontainer according to the floating-ui options available at https://floating-ui.com/docs/computePosition#placement.
|
|
2719
2735
|
* Popovercontainers are automatically flipped to the opposite side if there is not enough available space and are shifted
|
|
@@ -2813,9 +2829,19 @@ const PostPopovercontainer = /*@__PURE__*/ proxyCustomElement(class PostPopoverc
|
|
|
2813
2829
|
this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
|
|
2814
2830
|
const isOpen = e.newState === 'open';
|
|
2815
2831
|
if (isOpen) {
|
|
2832
|
+
const content = this.host.querySelector('.popover-content');
|
|
2816
2833
|
this.startAutoupdates();
|
|
2834
|
+
if (content && this.animation === 'pop-in') {
|
|
2835
|
+
popIn(content);
|
|
2836
|
+
}
|
|
2817
2837
|
if (this.safeSpace)
|
|
2818
2838
|
window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
2839
|
+
// Emit event with `first` flag only true on the first open
|
|
2840
|
+
if (this.firstOpen) {
|
|
2841
|
+
this.postToggle.emit({ isOpen, first: this.firstOpen });
|
|
2842
|
+
this.firstOpen = false;
|
|
2843
|
+
return;
|
|
2844
|
+
}
|
|
2819
2845
|
}
|
|
2820
2846
|
else {
|
|
2821
2847
|
if (typeof this.clearAutoUpdate === 'function')
|
|
@@ -2823,7 +2849,7 @@ const PostPopovercontainer = /*@__PURE__*/ proxyCustomElement(class PostPopoverc
|
|
|
2823
2849
|
if (this.safeSpace)
|
|
2824
2850
|
window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
2825
2851
|
}
|
|
2826
|
-
this.postToggle.emit(isOpen);
|
|
2852
|
+
this.postToggle.emit({ isOpen: isOpen, first: false });
|
|
2827
2853
|
}
|
|
2828
2854
|
/**
|
|
2829
2855
|
* Start listening for DOM updates, scroll events etc. that have
|
|
@@ -2954,10 +2980,9 @@ const PostPopovercontainer = /*@__PURE__*/ proxyCustomElement(class PostPopoverc
|
|
|
2954
2980
|
}
|
|
2955
2981
|
}
|
|
2956
2982
|
render() {
|
|
2957
|
-
|
|
2958
|
-
return (h(Host, { key: '357f53696ca28ab2c137d47e2192038dc756c289', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: '9c40bdc5034ccf14157ee1ae8ce33fe58a9049e4', class: animationClass }, this.arrow && (h("span", { key: '6133ab54aaea6f198560ca5cb30f5604318203f6', class: "arrow", ref: el => {
|
|
2983
|
+
return (h(Host, { key: '1594b782ac56ae23eba2df3f452ad40015ace67d', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: '565cbf870aca9abbc665525a627922d1cfdb9195', class: "popover-content" }, this.arrow && (h("span", { key: 'add7d6f7b176e7365b5a0c25fa81dd2a9520e7f3', class: "arrow", ref: el => {
|
|
2959
2984
|
this.arrowRef = el;
|
|
2960
|
-
} })), h("slot", { key: '
|
|
2985
|
+
} })), h("slot", { key: '308138890a4148c5c94b675e2a6b911fef1c31b5' }))));
|
|
2961
2986
|
}
|
|
2962
2987
|
get host() { return this; }
|
|
2963
2988
|
static get watchers() { return {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const focusableSelector = `:where(${[
|
|
2
|
+
'button',
|
|
3
|
+
'input:not([type="hidden"])',
|
|
4
|
+
'[tabindex]',
|
|
5
|
+
'select',
|
|
6
|
+
'textarea',
|
|
7
|
+
'[contenteditable]',
|
|
8
|
+
'a[href]',
|
|
9
|
+
'iframe',
|
|
10
|
+
'audio[controls]',
|
|
11
|
+
'video[controls]',
|
|
12
|
+
'area[href]',
|
|
13
|
+
'details > summary:first-of-type',
|
|
14
|
+
].join(',')})`;
|
|
15
|
+
const focusDisablingSelector = `:where(${[
|
|
16
|
+
'[inert]',
|
|
17
|
+
'[inert] *',
|
|
18
|
+
':disabled',
|
|
19
|
+
'dialog:not([open]) *',
|
|
20
|
+
'[popover]:not(:popover-open) *',
|
|
21
|
+
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
22
|
+
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
23
|
+
'[tabindex^="-"]',
|
|
24
|
+
'[hidden]:not([hidden="false"])',
|
|
25
|
+
].join(',')})`;
|
|
26
|
+
function getFocusableChildren(element) {
|
|
27
|
+
const focusableChildren = element.querySelectorAll(`${focusableSelector}:not(${focusDisablingSelector})`);
|
|
28
|
+
const visibleFocusableChildren = Array.from(focusableChildren).filter(child => {
|
|
29
|
+
const style = window.getComputedStyle(child.parentElement);
|
|
30
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
31
|
+
});
|
|
32
|
+
return visibleFocusableChildren;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { getFocusableChildren as g };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
const IS_SERVER = typeof window === 'undefined';
|
|
2
|
+
const IS_BROWSER = !IS_SERVER;
|
|
3
|
+
|
|
4
|
+
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
8
|
+
* execution of handlers on events like resize and scroll.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
11
|
+
* are most useful.
|
|
12
|
+
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
13
|
+
* as-is, to `callback` when the throttled-function is executed.
|
|
14
|
+
* @param {object} [options] - An object to configure options.
|
|
15
|
+
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
16
|
+
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
17
|
+
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
18
|
+
* `delay` milliseconds, the internal counter is reset).
|
|
19
|
+
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
20
|
+
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
21
|
+
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
22
|
+
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
23
|
+
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
24
|
+
*
|
|
25
|
+
* @returns {Function} A new, throttled, function.
|
|
26
|
+
*/
|
|
27
|
+
function throttle (delay, callback, options) {
|
|
28
|
+
var _ref = {},
|
|
29
|
+
_ref$noTrailing = _ref.noTrailing,
|
|
30
|
+
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
31
|
+
_ref$noLeading = _ref.noLeading,
|
|
32
|
+
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
33
|
+
_ref$debounceMode = _ref.debounceMode,
|
|
34
|
+
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
35
|
+
/*
|
|
36
|
+
* After wrapper has stopped being called, this timeout ensures that
|
|
37
|
+
* `callback` is executed at the proper times in `throttle` and `end`
|
|
38
|
+
* debounce modes.
|
|
39
|
+
*/
|
|
40
|
+
var timeoutID;
|
|
41
|
+
var cancelled = false;
|
|
42
|
+
|
|
43
|
+
// Keep track of the last time `callback` was executed.
|
|
44
|
+
var lastExec = 0;
|
|
45
|
+
|
|
46
|
+
// Function to clear existing timeout
|
|
47
|
+
function clearExistingTimeout() {
|
|
48
|
+
if (timeoutID) {
|
|
49
|
+
clearTimeout(timeoutID);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Function to cancel next exec
|
|
54
|
+
function cancel(options) {
|
|
55
|
+
var _ref2 = options || {},
|
|
56
|
+
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
57
|
+
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
58
|
+
clearExistingTimeout();
|
|
59
|
+
cancelled = !upcomingOnly;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
64
|
+
* functionality and when executed will limit the rate at which `callback`
|
|
65
|
+
* is executed.
|
|
66
|
+
*/
|
|
67
|
+
function wrapper() {
|
|
68
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
69
|
+
arguments_[_key] = arguments[_key];
|
|
70
|
+
}
|
|
71
|
+
var self = this;
|
|
72
|
+
var elapsed = Date.now() - lastExec;
|
|
73
|
+
if (cancelled) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Execute `callback` and update the `lastExec` timestamp.
|
|
78
|
+
function exec() {
|
|
79
|
+
lastExec = Date.now();
|
|
80
|
+
callback.apply(self, arguments_);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
85
|
+
* to allow future `callback` executions.
|
|
86
|
+
*/
|
|
87
|
+
function clear() {
|
|
88
|
+
timeoutID = undefined;
|
|
89
|
+
}
|
|
90
|
+
if (!noLeading && debounceMode && !timeoutID) {
|
|
91
|
+
/*
|
|
92
|
+
* Since `wrapper` is being called for the first time and
|
|
93
|
+
* `debounceMode` is true (at begin), execute `callback`
|
|
94
|
+
* and noLeading != true.
|
|
95
|
+
*/
|
|
96
|
+
exec();
|
|
97
|
+
}
|
|
98
|
+
clearExistingTimeout();
|
|
99
|
+
if (debounceMode === undefined && elapsed > delay) {
|
|
100
|
+
if (noLeading) {
|
|
101
|
+
/*
|
|
102
|
+
* In throttle mode with noLeading, if `delay` time has
|
|
103
|
+
* been exceeded, update `lastExec` and schedule `callback`
|
|
104
|
+
* to execute after `delay` ms.
|
|
105
|
+
*/
|
|
106
|
+
lastExec = Date.now();
|
|
107
|
+
if (!noTrailing) {
|
|
108
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
/*
|
|
112
|
+
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
113
|
+
* `callback`.
|
|
114
|
+
*/
|
|
115
|
+
exec();
|
|
116
|
+
}
|
|
117
|
+
} else if (noTrailing !== true) {
|
|
118
|
+
/*
|
|
119
|
+
* In trailing throttle mode, since `delay` time has not been
|
|
120
|
+
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
121
|
+
* recent execution.
|
|
122
|
+
*
|
|
123
|
+
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
124
|
+
* after `delay` ms.
|
|
125
|
+
*
|
|
126
|
+
* If `debounceMode` is false (at end), schedule `callback` to
|
|
127
|
+
* execute after `delay` ms.
|
|
128
|
+
*/
|
|
129
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
wrapper.cancel = cancel;
|
|
133
|
+
|
|
134
|
+
// Return the wrapper function.
|
|
135
|
+
return wrapper;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
class Breakpoint {
|
|
139
|
+
constructor() {
|
|
140
|
+
this.breakpoints = [
|
|
141
|
+
{ key: 'xl', device: 'desktop', minWidth: 1280 },
|
|
142
|
+
{ key: 'lg', device: 'desktop', minWidth: 1024 },
|
|
143
|
+
{ key: 'md', device: 'tablet', minWidth: 780 },
|
|
144
|
+
{ key: 'sm', device: 'tablet', minWidth: 600 },
|
|
145
|
+
{ key: 'xs', device: 'mobile', minWidth: 0 },
|
|
146
|
+
];
|
|
147
|
+
this.updateCurrentBreakpoint = throttle(50, (options = { emitEvents: true }) => {
|
|
148
|
+
const previousBreakpoint = this.currentBreakpoint;
|
|
149
|
+
const newBreakpoint = this.breakpoints.find(breakpoint => {
|
|
150
|
+
return breakpoint.minWidth <= innerWidth;
|
|
151
|
+
});
|
|
152
|
+
if (!newBreakpoint)
|
|
153
|
+
return;
|
|
154
|
+
this.currentBreakpoint = newBreakpoint;
|
|
155
|
+
if (!options.emitEvents)
|
|
156
|
+
return;
|
|
157
|
+
Object.keys(this.currentBreakpoint)
|
|
158
|
+
.filter(key => !previousBreakpoint || this.currentBreakpoint[key] !== previousBreakpoint[key])
|
|
159
|
+
.forEach((key) => this.dispatchEvent(key));
|
|
160
|
+
});
|
|
161
|
+
if (IS_SERVER)
|
|
162
|
+
return;
|
|
163
|
+
this.updateCurrentBreakpoint({ emitEvents: false });
|
|
164
|
+
window.addEventListener('resize', () => this.updateCurrentBreakpoint(), { passive: true });
|
|
165
|
+
}
|
|
166
|
+
dispatchEvent(property) {
|
|
167
|
+
if (IS_SERVER)
|
|
168
|
+
return;
|
|
169
|
+
window.dispatchEvent(new CustomEvent(`postBreakpoint:${property}`, { detail: this.currentBreakpoint[property] }));
|
|
170
|
+
}
|
|
171
|
+
get(property) {
|
|
172
|
+
this.updateCurrentBreakpoint({ emitEvents: false });
|
|
173
|
+
return this.currentBreakpoint[property];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const breakpoint = new Breakpoint();
|
|
177
|
+
|
|
178
|
+
export { IS_BROWSER as I, breakpoint as b, throttle as t };
|
|
@@ -85,4 +85,4 @@ const checkRequiredAndOneOf = requiredAnd(checkOneOf);
|
|
|
85
85
|
const checkRequiredAndType = requiredAnd(checkType);
|
|
86
86
|
const checkRequiredAndUrl = requiredAnd(checkUrl);
|
|
87
87
|
|
|
88
|
-
export {
|
|
88
|
+
export { checkEmptyOrUrl as a, checkRequiredAndOneOf as b, checkRequiredAndType as c, checkEmptyOrOneOf as d, checkEmptyOrType as e, checkEmptyOrPattern as f, checkRequiredAndUrl as g };
|