@swisspost/design-system-components 10.7.0 → 10.8.0
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/{create-validator-decorator-D7nAb9KJ.js → create-validator-decorator-DVm_SDrR.js} +1 -1
- package/dist/cjs/{index-DWIlRT6N.js → index-DY4QxKNv.js} +5 -5
- package/dist/cjs/is-focus-visible-B3CqVQsX.js +19 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{one-of-B8RUgrZk.js → one-of-qu7_EPxf.js} +1 -1
- package/dist/cjs/{package-BtKYhTNj.js → package-DAEQGHsE.js} +1 -1
- package/dist/cjs/{pattern-B6VoDk_m.js → pattern-EpwCKMyC.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +6 -6
- package/dist/cjs/post-autocomplete.cjs.entry.js +5 -5
- package/dist/cjs/post-avatar.cjs.entry.js +85 -61
- package/dist/cjs/post-back-to-top.cjs.entry.js +6 -6
- package/dist/cjs/post-banner.cjs.entry.js +5 -5
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +8 -8
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +7 -7
- package/dist/cjs/post-closebutton_14.cjs.entry.js +470 -592
- package/dist/cjs/post-collapsible_2.cjs.entry.js +13 -7
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-date-picker.cjs.entry.js +22 -8
- package/dist/cjs/post-footer.cjs.entry.js +5 -5
- package/dist/cjs/post-linkarea.cjs.entry.js +2 -2
- package/dist/cjs/post-listbox-option.cjs.entry.js +2 -2
- package/dist/cjs/post-listbox.cjs.entry.js +2 -2
- package/dist/cjs/post-number-input.cjs.entry.js +3 -3
- package/dist/cjs/post-pagination.cjs.entry.js +6 -6
- package/dist/cjs/post-popover-trigger.cjs.entry.js +4 -4
- package/dist/cjs/post-popover.cjs.entry.js +9 -9
- package/dist/cjs/post-progressbar.cjs.entry.js +3 -3
- package/dist/cjs/post-rating.cjs.entry.js +5 -5
- package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +5 -5
- package/dist/cjs/post-side-navigation.cjs.entry.js +14 -9
- package/dist/cjs/post-stepper-item.cjs.entry.js +2 -2
- package/dist/cjs/post-stepper.cjs.entry.js +6 -6
- package/dist/cjs/post-tab-item.cjs.entry.js +5 -5
- package/dist/cjs/post-tab-panel.cjs.entry.js +5 -5
- package/dist/cjs/post-tabs.cjs.entry.js +8 -8
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +6 -6
- package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
- package/dist/cjs/{required-bXtlqqaA.js → required-Dgzo-rb5.js} +1 -1
- package/dist/cjs/{type-BqLE7Uui.js → type-DBRxpBZI.js} +1 -1
- package/dist/cjs/{url-CUy3C3sH.js → url-Dl1JABeP.js} +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-avatar/avatar-utils.js +1 -2
- package/dist/collection/components/post-avatar/post-avatar.js +77 -59
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
- package/dist/collection/components/post-banner/post-banner.css +1 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +9 -3
- package/dist/collection/components/post-date-picker/post-date-picker.css +1 -1
- package/dist/collection/components/post-date-picker/post-date-picker.js +16 -2
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +31 -12
- package/dist/collection/components/post-language-menu/post-language-menu.css +1 -1
- package/dist/collection/components/post-language-menu/post-language-menu.js +1 -1
- package/dist/collection/components/post-logo/post-logo.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +34 -16
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -1
- package/dist/collection/components/post-menu/post-menu.css +1 -1
- package/dist/collection/components/post-menu/post-menu.js +3 -14
- package/dist/collection/components/post-menu-item/post-menu-item.css +1 -1
- package/dist/collection/components/post-number-input/post-number-input.css +2 -2
- package/dist/collection/components/post-pagination/post-pagination.css +1 -1
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +2 -2
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +211 -323
- package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.js +7 -3
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +2 -2
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +3 -1
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +1 -1
- package/dist/collection/utils/floating-ui/middleware/flip.js +77 -0
- package/dist/collection/utils/floating-ui/middleware/safe-space.js +52 -0
- package/dist/collection/utils/floating-ui/util.js +10 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/is-focus-visible.js +15 -0
- package/dist/components/is-focus-visible.js +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +1 -1
- package/dist/components/post-avatar.js +1 -1
- package/dist/components/post-back-to-top.js +1 -1
- package/dist/components/post-banner.js +1 -1
- package/dist/components/post-breadcrumb-item.js +1 -1
- package/dist/components/post-breadcrumbs.js +1 -1
- package/dist/components/post-closebutton2.js +1 -1
- package/dist/components/post-collapsible2.js +1 -1
- package/dist/components/post-date-picker.js +1 -1
- package/dist/components/post-header.js +1 -1
- package/dist/components/post-language-menu.js +1 -1
- package/dist/components/post-logo.js +1 -1
- package/dist/components/post-megadropdown-trigger.js +1 -1
- package/dist/components/post-megadropdown.js +1 -1
- package/dist/components/post-menu-item2.js +1 -1
- package/dist/components/post-menu2.js +1 -1
- package/dist/components/post-number-input.js +1 -1
- package/dist/components/post-pagination.js +1 -1
- package/dist/components/post-popover.js +1 -1
- package/dist/components/post-popovercontainer2.js +1 -1
- package/dist/components/post-side-navigation.js +1 -1
- package/dist/components/post-tabs.js +1 -1
- package/dist/components/post-tooltip-trigger.js +1 -1
- package/dist/components/post-tooltip.js +1 -1
- package/dist/components/react/index.js +1 -1
- package/dist/components/react/p-5kW0ZF_f.js +1 -0
- package/dist/components/react/p-BMCit4BU.js +1 -0
- package/dist/components/react/p-BWwWKRO5.js +1 -0
- package/dist/components/react/p-BdiQsTQm.js +1 -0
- package/dist/components/react/p-BeRGbt65.js +1 -0
- package/dist/components/react/{p-DS46v3ju.js → p-C8i672qm.js} +1 -1
- package/dist/components/react/{p-BBv5JYsW.js → p-C_JY6ipN.js} +1 -1
- package/dist/components/react/p-DRJ9K8sv.js +1 -0
- package/dist/components/react/{p-1y1rv5Tw.js → p-DygUkCKz.js} +1 -1
- package/dist/components/react/p-DzYMQFK2.js +1 -0
- package/dist/components/react/{p-BgEY7xhT.js → p-E-8qAn1z.js} +1 -1
- package/dist/components/react/p-Q5LQWL2X.js +1 -0
- package/dist/components/react/{p-C8_zqgAP.js → p-UXyZDQt4.js} +1 -1
- package/dist/components/react/post-accordion-item.js +1 -1
- package/dist/components/react/post-accordion.js +1 -1
- package/dist/components/react/post-autocomplete.js +1 -1
- package/dist/components/react/post-avatar.js +1 -1
- package/dist/components/react/post-back-to-top.js +1 -1
- package/dist/components/react/post-banner.js +1 -1
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +1 -1
- package/dist/components/react/post-closebutton.js +1 -1
- package/dist/components/react/post-collapsible-trigger.js +1 -1
- package/dist/components/react/post-collapsible.js +1 -1
- package/dist/components/react/post-date-picker.js +1 -1
- package/dist/components/react/post-footer.js +1 -1
- package/dist/components/react/post-header.js +1 -1
- package/dist/components/react/post-icon.js +1 -1
- package/dist/components/react/post-language-menu-item.js +1 -1
- package/dist/components/react/post-language-menu.js +1 -1
- package/dist/components/react/post-linkarea.js +1 -1
- package/dist/components/react/post-listbox-option.js +1 -1
- package/dist/components/react/post-listbox.js +1 -1
- package/dist/components/react/post-logo.js +1 -1
- package/dist/components/react/post-mainnavigation.js +1 -1
- package/dist/components/react/post-megadropdown-trigger.js +1 -1
- package/dist/components/react/post-megadropdown.js +1 -1
- package/dist/components/react/post-menu-item.js +1 -1
- package/dist/components/react/post-menu-trigger.js +1 -1
- package/dist/components/react/post-menu.js +1 -1
- package/dist/components/react/post-number-input.js +1 -1
- package/dist/components/react/post-pagination.js +1 -1
- package/dist/components/react/post-popover-trigger.js +1 -1
- package/dist/components/react/post-popover.js +1 -1
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-rating.js +1 -1
- package/dist/components/react/post-side-navigation-trigger.js +1 -1
- package/dist/components/react/post-side-navigation.js +1 -1
- package/dist/components/react/post-stepper-item.js +1 -1
- package/dist/components/react/post-stepper.js +1 -1
- package/dist/components/react/post-tab-item.js +1 -1
- package/dist/components/react/post-tab-panel.js +1 -1
- package/dist/components/react/post-tabs.js +1 -1
- package/dist/components/react/post-togglebutton.js +1 -1
- package/dist/components/react/post-tooltip-trigger.js +1 -1
- package/dist/components/react/post-tooltip.js +1 -1
- package/dist/docs.json +67 -45
- package/dist/esm/{create-validator-decorator-DFpQtJzK.js → create-validator-decorator-Cp_NUmrr.js} +1 -1
- package/dist/esm/{index-Bs0zeM5Q.js → index-D0jX3Fts.js} +5 -5
- package/dist/esm/is-focus-visible-BWwWKRO5.js +17 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{one-of-DQCfaZpw.js → one-of-B9locHPx.js} +1 -1
- package/dist/esm/{package-BBz9PVf0.js → package-BdiQsTQm.js} +1 -1
- package/dist/esm/{pattern-3lnaFlkk.js → pattern-BL3OBU8C.js} +1 -1
- package/dist/esm/post-accordion_2.entry.js +6 -6
- package/dist/esm/post-autocomplete.entry.js +5 -5
- package/dist/esm/post-avatar.entry.js +85 -61
- package/dist/esm/post-back-to-top.entry.js +6 -6
- package/dist/esm/post-banner.entry.js +5 -5
- package/dist/esm/post-breadcrumb-item.entry.js +8 -8
- package/dist/esm/post-breadcrumbs.entry.js +7 -7
- package/dist/esm/post-closebutton_14.entry.js +470 -592
- package/dist/esm/post-collapsible_2.entry.js +13 -7
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-date-picker.entry.js +22 -8
- package/dist/esm/post-footer.entry.js +5 -5
- package/dist/esm/post-linkarea.entry.js +2 -2
- package/dist/esm/post-listbox-option.entry.js +2 -2
- package/dist/esm/post-listbox.entry.js +2 -2
- package/dist/esm/post-number-input.entry.js +3 -3
- package/dist/esm/post-pagination.entry.js +6 -6
- package/dist/esm/post-popover-trigger.entry.js +4 -4
- package/dist/esm/post-popover.entry.js +9 -9
- package/dist/esm/post-progressbar.entry.js +3 -3
- package/dist/esm/post-rating.entry.js +5 -5
- package/dist/esm/post-side-navigation-trigger.entry.js +5 -5
- package/dist/esm/post-side-navigation.entry.js +14 -9
- package/dist/esm/post-stepper-item.entry.js +2 -2
- package/dist/esm/post-stepper.entry.js +6 -6
- package/dist/esm/post-tab-item.entry.js +5 -5
- package/dist/esm/post-tab-panel.entry.js +5 -5
- package/dist/esm/post-tabs.entry.js +8 -8
- package/dist/esm/post-tooltip-trigger.entry.js +6 -6
- package/dist/esm/post-tooltip.entry.js +8 -6
- package/dist/esm/{required-NuzPg5jZ.js → required-CDaQB1gC.js} +1 -1
- package/dist/esm/{type-ChnksJ25.js → type-CQ7XuPCZ.js} +1 -1
- package/dist/esm/{url-BCk3ZU-x.js → url-B-86gtTK.js} +1 -1
- package/dist/post-components/p-0688d296.entry.js +1 -0
- package/dist/post-components/p-0b0b2f02.entry.js +1 -0
- package/dist/post-components/{p-31550a50.entry.js → p-0d25c033.entry.js} +1 -1
- package/dist/post-components/{p-aa33141b.entry.js → p-229d324e.entry.js} +1 -1
- package/dist/post-components/{p-f275b872.entry.js → p-2a5312a7.entry.js} +1 -1
- package/dist/post-components/{p-43240818.entry.js → p-330fd6cd.entry.js} +1 -1
- package/dist/post-components/{p-6a2f47af.entry.js → p-3712133b.entry.js} +1 -1
- package/dist/post-components/{p-bd128657.entry.js → p-379780a3.entry.js} +1 -1
- package/dist/post-components/{p-aff180f5.entry.js → p-3fdb8ebc.entry.js} +1 -1
- package/dist/post-components/{p-64480e3a.entry.js → p-456b0786.entry.js} +1 -1
- package/dist/post-components/{p-96d07f2b.entry.js → p-4d30c65d.entry.js} +1 -1
- package/dist/post-components/{p-c2de3702.entry.js → p-534ca27e.entry.js} +1 -1
- package/dist/post-components/p-5369b9c2.entry.js +1 -0
- package/dist/post-components/p-6833be12.entry.js +1 -0
- package/dist/post-components/p-6ad44691.entry.js +1 -0
- package/dist/post-components/{p-e6a4146b.entry.js → p-82c62e90.entry.js} +1 -1
- package/dist/post-components/{p-451ec8ee.entry.js → p-91a2ef3c.entry.js} +1 -1
- package/dist/post-components/p-95f5d5ea.entry.js +1 -0
- package/dist/post-components/p-9dd286bf.entry.js +1 -0
- package/dist/post-components/p-9fedcfba.entry.js +1 -0
- package/dist/post-components/{p-DeUk3rcv.js → p-BCPv4bcY.js} +1 -1
- package/dist/post-components/p-BWwWKRO5.js +1 -0
- package/dist/post-components/p-BdiQsTQm.js +1 -0
- package/dist/post-components/{p-D1s6tESz.js → p-CP3LjuFR.js} +1 -1
- package/dist/post-components/p-D0jX3Fts.js +2 -0
- package/dist/post-components/{p-Bl-_v3aT.js → p-D6mVqZLg.js} +1 -1
- package/dist/post-components/{p-BwhzbRIR.js → p-DSaWK_q-.js} +1 -1
- package/dist/post-components/p-VPHnF9fB.js +1 -0
- package/dist/post-components/{p-63e570c4.entry.js → p-ab0500b7.entry.js} +1 -1
- package/dist/post-components/p-c123ecde.entry.js +1 -0
- package/dist/post-components/{p-61a45246.entry.js → p-d2de31b7.entry.js} +1 -1
- package/dist/post-components/p-dffeb751.entry.js +1 -0
- package/dist/post-components/{p-f784e149.entry.js → p-e11ccdbe.entry.js} +1 -1
- package/dist/post-components/{p-31a97aae.entry.js → p-e560767b.entry.js} +1 -1
- package/dist/post-components/p-ee7fade4.entry.js +1 -0
- package/dist/post-components/{p-f566768e.entry.js → p-f2629077.entry.js} +1 -1
- package/dist/post-components/{p-58b66607.entry.js → p-f2b24bbd.entry.js} +1 -1
- package/dist/post-components/p-gv9b-Z15.js +1 -0
- package/dist/post-components/post-components.css +2 -2
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-avatar/avatar-utils.d.ts +0 -2
- package/dist/types/components/post-avatar/post-avatar.d.ts +11 -9
- package/dist/types/components/post-date-picker/post-date-picker.d.ts +2 -0
- package/dist/types/components/post-header/post-header.d.ts +2 -0
- package/dist/types/components/post-language-menu/post-language-menu.d.ts +3 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +1 -1
- package/dist/types/components/post-menu/post-menu.d.ts +0 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +74 -69
- package/dist/types/components.d.ts +39 -26
- package/dist/types/utils/floating-ui/middleware/flip.d.ts +14 -0
- package/dist/types/utils/floating-ui/middleware/safe-space.d.ts +10 -0
- package/dist/types/utils/floating-ui/util.d.ts +4 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/is-focus-visible.d.ts +5 -0
- package/dist/vrt/helpers/header-test-config.js +2 -1
- package/hydrate/index.js +537 -602
- package/hydrate/index.mjs +537 -602
- package/package.json +11 -10
- package/dist/components/react/p-BBz9PVf0.js +0 -1
- package/dist/components/react/p-C3J7fIWx.js +0 -1
- package/dist/components/react/p-C5ibTdH5.js +0 -1
- package/dist/components/react/p-CUKzje9q.js +0 -1
- package/dist/components/react/p-DTBtJCjk.js +0 -1
- package/dist/components/react/p-XUkUhxaz.js +0 -1
- package/dist/components/react/p-ialuSSl2.js +0 -1
- package/dist/post-components/p-10e430c3.entry.js +0 -1
- package/dist/post-components/p-32e1e951.entry.js +0 -1
- package/dist/post-components/p-4f08b99b.entry.js +0 -1
- package/dist/post-components/p-54432b47.entry.js +0 -1
- package/dist/post-components/p-5d7de657.entry.js +0 -1
- package/dist/post-components/p-63dd9a76.entry.js +0 -1
- package/dist/post-components/p-9a1e8b1d.entry.js +0 -1
- package/dist/post-components/p-BBz9PVf0.js +0 -1
- package/dist/post-components/p-Bs0zeM5Q.js +0 -2
- package/dist/post-components/p-DH-eJVHZ.js +0 -1
- package/dist/post-components/p-Dk-DtPZn.js +0 -1
- package/dist/post-components/p-d5327dd1.entry.js +0 -1
- package/dist/post-components/p-e1817744.entry.js +0 -1
- package/dist/post-components/p-f6da5e69.entry.js +0 -1
- package/dist/post-components/p-f917527c.entry.js +0 -1
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/vrt/helpers/header-variants.config.d.ts +0 -23
- package/dist/vrt/helpers/header-variants.config.js +0 -157
- /package/dist/collection/utils/{floating-ui.js → floating-ui/platform/safe-area.js} +0 -0
- /package/dist/types/utils/{floating-ui.d.ts → floating-ui/platform/safe-area.d.ts} +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, a as getElement, c as createEvent } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host, a as getElement, c as createEvent } from './index-D0jX3Fts.js';
|
|
2
2
|
import { b as breakpoint } from './breakpoints-I1j7a0bW.js';
|
|
3
3
|
import { f as findClosestAcrossShadow, E as EventFrom } from './event-from-BEcxHjuM.js';
|
|
4
|
-
import { v as version } from './package-
|
|
5
|
-
import { O as OneOf } from './one-of-
|
|
6
|
-
import { R as Required } from './required-
|
|
4
|
+
import { v as version } from './package-BdiQsTQm.js';
|
|
5
|
+
import { O as OneOf } from './one-of-B9locHPx.js';
|
|
6
|
+
import { R as Required } from './required-CDaQB1gC.js';
|
|
7
7
|
import { f as fade } from './fade-DsgPYmAa.js';
|
|
8
8
|
import { g as getDeepFocusableChildren, a as getFocusableChildren } from './get-focusable-children-DxYnH2ye.js';
|
|
9
9
|
import { t as throttle } from './index-bR8vy6-s.js';
|
|
10
|
-
import { T as Type } from './type-
|
|
10
|
+
import { T as Type } from './type-CQ7XuPCZ.js';
|
|
11
11
|
import { n as nanoid } from './nanoid-8LXe8Zt_.js';
|
|
12
|
-
import { P as Pattern } from './pattern-
|
|
13
|
-
import { U as Url } from './url-
|
|
12
|
+
import { P as Pattern } from './pattern-BL3OBU8C.js';
|
|
13
|
+
import { U as Url } from './url-B-86gtTK.js';
|
|
14
14
|
import { r as resolveEasing } from './utils-CoDiS_Ik.js';
|
|
15
15
|
import { f as fadeSlide } from './fade-slide-CvOvauo9.js';
|
|
16
16
|
import { P as PLACEMENT_TYPES } from './placement-DRiVosES.js';
|
|
17
17
|
import { g as getRoot } from './get-root-08F-DB-d.js';
|
|
18
|
-
import './
|
|
18
|
+
import { i as isFocusVisible } from './is-focus-visible-BWwWKRO5.js';
|
|
19
|
+
import './create-validator-decorator-Cp_NUmrr.js';
|
|
19
20
|
|
|
20
21
|
const CLOSABLE_TARGETS = [
|
|
21
22
|
{
|
|
@@ -59,7 +60,7 @@ const BUTTON_TYPES = ['button', 'reset'];
|
|
|
59
60
|
const PLACEMENT = ['manual', 'auto'];
|
|
60
61
|
const SIZE = ['default', 'small'];
|
|
61
62
|
|
|
62
|
-
const postClosebuttonCss = () => `.btn{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;min-height:var(--post-device-sizing-interactive-button-height-1);gap:var(--post-device-spacing-gap-inline-10);padding:0 var(--post-device-spacing-padding-inline-6)}.btn:not(:disabled):hover{text-decoration:none}.btn:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.btn{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}.btn: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){.btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn: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){.btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn{border-width:1px !important;transition:none}.btn:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}.btn>post-icon{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-primary{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-primary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-primary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-primary:disabled{border-color:var(--post-scheme-color-interactive-button-primary-disabled-stroke);color:var(--post-scheme-color-interactive-button-primary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-disabled-bg)}.btn-primary:not(:disabled):hover,.btn-primary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}.btn-default{box-shadow:var(--post-device-elevation-100);border-color: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)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-default:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-default:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-default:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-default:not(:disabled):hover,.btn-default.pretend-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)}.btn-secondary{box-shadow:var(--post-device-elevation-100);border-color: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)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-secondary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-secondary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-secondary:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-secondary:not(:disabled):hover,.btn-secondary.pretend-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)}.btn-tertiary{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-tertiary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-tertiary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-tertiary:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-disabled-bg)}.btn-tertiary:not(:disabled):hover,.btn-tertiary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.btn-link{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:disabled,.btn-link.disabled{text-decoration:none}}.btn-link:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg)}.btn-link:not(:disabled):hover,.btn-link.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.btn-sm{min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7)}.btn-sm>post-icon{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-lg{min-height:var(--post-device-sizing-interactive-button-height-2);gap:var(--post-device-spacing-gap-inline-1);padding:0 var(--post-device-spacing-padding-inline-5)}.btn-lg>post-icon{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-link{-webkit-text-decoration:var(--post-core-text-decoration-underline);text-decoration:var(--post-core-text-decoration-underline);border:0 none;border-radius:0;min-height:0;font-size:inherit;font-weight:inherit;padding:0}.btn-link{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}.btn-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn-link:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.btn-link:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}.btn-icon{padding:0;width:var(--post-device-sizing-interactive-button-height-1);height:var(--post-device-sizing-interactive-button-height-1);min-height:0;vertical-align:text-bottom}.btn-icon.btn-link{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon.btn-sm{padding:0;width:var(--post-device-sizing-interactive-button-height-4);height:var(--post-device-sizing-interactive-button-height-4);min-height:0;vertical-align:text-bottom}.btn-icon.btn-sm.btn-link{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-sm>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-lg{padding:0;width:var(--post-device-sizing-interactive-button-height-2);height:var(--post-device-sizing-interactive-button-height-2);min-height:0;vertical-align:text-bottom}.btn-icon.btn-lg.btn-link{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-icon.btn-lg>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:host .btn{background-color:var(--post-scheme-color-interactive-primary-enabled-bg1)}:host .btn:not(:disabled):hover,:host .btn.pretend-hover{background-color:var(--post-scheme-color-interactive-primary-hover-bg)}:host(:not([placement])),:host([placement=auto]){position:absolute;inset-block-start:0;inset-inline-end:0;transform:translate(50%, -50%)}:host([size=small]) .btn{height:var(--post-device-sizing-interactive-button-height-7);width:var(--post-device-sizing-interactive-button-height-7)}`;
|
|
63
|
+
const postClosebuttonCss = () => `.btn{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;white-space:normal;overflow-wrap:anywhere;text-wrap:pretty;text-align:center;min-height:var(--post-device-sizing-interactive-button-height-1);gap:var(--post-device-spacing-gap-inline-10);padding:0 var(--post-device-spacing-padding-inline-6);border-radius:calc(var(--post-device-sizing-interactive-button-height-1) / 2)}.btn:not(:disabled):hover{text-decoration:none}.btn:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.btn{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}.btn:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:focus-visible{outline-color:Highlight !important}}.pretend-focus.btn{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.pretend-focus.btn{outline-color:Highlight !important}}.btn:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn: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){.btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn{border-width:1px !important;transition:none}.btn:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}.btn>post-icon{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4);flex-shrink:0}.btn-primary{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-primary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-primary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-primary:disabled{border-color:var(--post-scheme-color-interactive-button-primary-disabled-stroke);color:var(--post-scheme-color-interactive-button-primary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-disabled-bg)}.btn-primary:not(:disabled):hover,.btn-primary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}.btn-default{box-shadow:var(--post-device-elevation-100);border-color: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)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-default:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-default:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-default:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-default:not(:disabled):hover,.btn-default.pretend-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)}.btn-secondary{box-shadow:var(--post-device-elevation-100);border-color: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)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-secondary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-secondary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-secondary:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-secondary:not(:disabled):hover,.btn-secondary.pretend-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)}.btn-tertiary{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-tertiary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover{background-color:Highlight !important}.btn-tertiary:not(:disabled,.disabled):not(a.btn-tertiary.px-0):hover>post-icon{color:HighlightText !important}}.btn-tertiary:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-disabled-bg)}.btn-tertiary:not(:disabled):hover,.btn-tertiary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.btn-link{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:disabled,.btn-link.disabled{text-decoration:none}}.btn-link:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg)}.btn-link:not(:disabled):hover,.btn-link.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.btn-sm{min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7);border-radius:calc(var(--post-device-sizing-interactive-button-height-4) / 2)}.btn-sm>post-icon{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5);flex-shrink:0}.btn-lg{min-height:var(--post-device-sizing-interactive-button-height-2);gap:var(--post-device-spacing-gap-inline-1);padding:0 var(--post-device-spacing-padding-inline-5);border-radius:calc(var(--post-device-sizing-interactive-button-height-2) / 2)}.btn-lg>post-icon{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3);flex-shrink:0}.btn-link{-webkit-text-decoration:var(--post-core-text-decoration-underline);text-decoration:var(--post-core-text-decoration-underline);border:0 none;border-radius:0;min-height:0;font-size:inherit;font-weight:inherit;padding:0}.btn-link{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}.btn-link:focus-visible{outline-style:var(--post-core-border-style-solid) !important;border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:focus-visible{outline-color:Highlight !important}}.btn-link.pretend-focus{outline-style:var(--post-core-border-style-solid) !important;border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link.pretend-focus{outline-color:Highlight !important}}.btn-link:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important;border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn-link:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.btn-link:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}.btn-link:disabled{color:var(--post-scheme-color-interactive-primary-disabled-fg1);text-decoration-style:var(--post-core-border-style-dash)}.btn-icon{padding:0;width:var(--post-device-sizing-interactive-button-height-1);height:var(--post-device-sizing-interactive-button-height-1);min-height:0;vertical-align:text-bottom}.btn-icon.btn-link{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon.btn-sm{padding:0;width:var(--post-device-sizing-interactive-button-height-4);height:var(--post-device-sizing-interactive-button-height-4);min-height:0;vertical-align:text-bottom}.btn-icon.btn-sm.btn-link{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-sm>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-lg{padding:0;width:var(--post-device-sizing-interactive-button-height-2);height:var(--post-device-sizing-interactive-button-height-2);min-height:0;vertical-align:text-bottom}.btn-icon.btn-lg.btn-link{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-icon.btn-lg>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:host .btn{background-color:var(--post-scheme-color-interactive-primary-enabled-bg1)}:host .btn:not(:disabled):hover,:host .btn.pretend-hover{background-color:var(--post-scheme-color-interactive-primary-hover-bg)}:host(:not([placement])),:host([placement=auto]){position:absolute;inset-block-start:0;inset-inline-end:0;transform:translate(50%, -50%)}:host([size=small]) .btn{height:var(--post-device-sizing-interactive-button-height-7);width:var(--post-device-sizing-interactive-button-height-7)}`;
|
|
63
64
|
|
|
64
65
|
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
65
66
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -168,7 +169,7 @@ function slide(el, direction, options = {}) {
|
|
|
168
169
|
return animateSlide(el, keyframes, options);
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
const postHeaderCss = () => `:host{--post-global-header-top:calc( var(--post-global-header-reduced-height) - var(--post-global-header-expanded-height) );--post-header-top:calc(var(--post-header-reduced-height) - var(--post-header-expanded-height));--post-logo-height:calc( var(--post-global-header-expanded-height) - var(--post-header-scroll-top, 0px) );--post-global-controls-top:clamp( 1000 * (var(--post-global-header-reduced-height) - var(--post-global-header-expanded-height)), calc( -1 * min(var(--post-header-scroll-top, 0px) / 4, var(--post-global-header-reduced-height)) ), 0px )}@media screen and (min-width: 1024px){:host{--post-header-gap:8px;--post-global-header-padding-inline-start:4px;--post-global-header-padding-inline-end:8px;--post-local-header-padding-inline-start:12px;--post-local-header-padding-inline-end:8px}}@media screen and (min-width: 600px)and (max-width: 1023.98px){:host{--post-header-gap:12px 8px;--post-global-header-padding-inline-start:4px;--post-global-header-padding-inline-end:4px;--post-local-header-padding-inline-start:12px;--post-local-header-padding-inline-end:4px;--post-local-header-padding-block:12px;--post-burger-menu-padding-inline:40px;--post-burger-menu-body-gap:32px;--post-burger-menu-footer-gap:24px}}@media screen and (min-width: 600px)and (max-width: 779.98px){:host{--post-burger-menu-padding-inline:16px}}@media screen and (min-width: 0)and (max-width: 599.98px){:host{--post-header-gap:12px 8px;--post-global-header-padding-inline-start:0px;--post-global-header-padding-inline-end:8px;--post-local-header-padding-inline-start:8px;--post-local-header-padding-inline-end:8px;--post-local-header-padding-block:8px;--post-burger-menu-padding-inline:16px;--post-burger-menu-body-gap:24px;--post-burger-menu-footer-gap:16px}}:host(:not([full-width])),:host([full-width=false]){--post-header-content-max-width:1440px}:host([data-expanded]),:host([data-menu-extended]){--post-header-top:0;--post-global-header-top:-0.001px;--post-global-controls-top:0;--post-global-header-reduced-height:var(--post-global-header-expanded-height)}*,::before,::after{box-sizing:border-box}:host,header,.global-header,.local-header{transition:inset-block-start 150ms cubic-bezier(0.4, 0, 0.2, 1)}.section,.sliding-controls{display:flex;align-items:center;justify-content:space-between;gap:var(--post-header-gap);flex-wrap:wrap}.section{max-width:var(--post-header-content-max-width);margin-inline:auto}:host{display:block;position:sticky;inset-block-start:var(--post-header-top);z-index:1020;box-shadow:var(--post-device-elevation-300)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host{border-bottom:1px solid}}.global-header{z-index:2;position:sticky;inset-block-start:var(--post-global-header-top);background-color:#fc0}.global-header::before{position:absolute;z-index:-1;left:0;bottom:0;width:100%;height:100dvh;content:"";background-color:#fc0}.global-header .section{height:var(--post-global-header-expanded-height);padding-inline-start:var(--post-global-header-padding-inline-start);padding-inline-end:var(--post-global-header-padding-inline-end)}.global-header .logo{align-self:flex-end;width:var(--post-global-header-expanded-height);height:var(--post-logo-height);min-height:var(--post-global-header-reduced-height);max-height:100%;margin-inline-end:calc(20px - var(--post-header-gap));margin-inline-start:clamp(var(--post-logo-expanded-offset),var(--post-logo-expanded-offset) + (var(--post-logo-reduced-offset) - var(--post-logo-expanded-offset))*min(var(--post-header-scroll-top, 0px),var(--post-global-header-expanded-height) - var(--post-global-header-reduced-height))/max(1px,var(--post-global-header-expanded-height) - var(--post-global-header-reduced-height)),var(--post-logo-reduced-offset))}.global-header .sliding-controls{flex-grow:1;justify-content:flex-end;position:relative;inset-block-start:var(--post-global-controls-top)}.global-header .audience{margin-inline-end:auto}@media screen and (max-width: 1023.98px){.global-header slot:where([name=audience],[name=global-nav-secondary]){display:none}}.local-header{position:relative;background-color:#fff;min-height:var(--post-local-header-expanded-min-height);display:var(--post-local-header-display, flex);align-items:var(--post-local-header-align-items, center)}.local-header .section{width:100%;padding-inline-start:var(--post-local-header-padding-inline-start);padding-inline-end:var(--post-local-header-padding-inline-end);padding-block:var(--post-local-header-padding-block)}@media screen and (min-width: 1024px){.local-header .section{display:grid;grid-template:var(--post-local-header-grid-template)}}@media screen and (max-width: 1023.98px){.local-header .section{display:flex;align-self:center}}@media screen and (max-width: 1023.98px)and (max-width: 599.98px){.local-header .section{justify-content:end}}.local-header:where(.megadropdown-open)::after,.local-header:has(~.burger-menu.extended)::after{content:"";display:block;position:absolute;inset-inline:0;inset-block-end:0;height:1px;background-color:#e1e0dc}.local-header .local-nav{flex:0 0 auto}@media screen and (max-width: 1023.98px){.local-header slot[name=main-nav]{display:none}}.burger-button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:4px 10px;gap:6px;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);display:var(--post-burger-button-display, flex)}.burger-button:not(:disabled):hover{text-decoration:none}.burger-button:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.burger-button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.burger-button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.burger-button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button{border-width:1px !important;transition:none}.burger-button:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}.burger-button:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.burger-button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}.burger-button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}@media screen and (min-width: 0)and (max-width: 599.98px){.burger-button{padding:10px}.burger-button>:not(post-icon){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.burger-button>post-icon{font-size:1.5rem}}@media screen and (min-width: 1024px){.burger-button{display:none}}.burger-menu{z-index:-1;position:absolute;inset-inline:0;inset-block-start:100%;height:calc(min(var(--post-header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));overflow:hidden auto;display:flex;flex-direction:column;background-color:#fafafa}.burger-menu.extended.second-level-open{overflow:hidden}.burger-menu:not(.extended){transform:translateY(-100%);display:none}.burger-menu:not(.extended)>*{display:none}.burger-menu .burger-menu-body,.burger-menu .burger-menu-footer{display:flex;flex-direction:column;padding-inline:var(--post-burger-menu-padding-inline)}.burger-menu .burger-menu-body{flex-grow:1;padding-block:24px;gap:var(--post-burger-menu-body-gap)}.burger-menu .burger-menu-footer{background-color:#f0efed;padding-block-start:16px;padding-block-end:max(24px, env(safe-area-inset-bottom, 0px));gap:var(--post-burger-menu-footer-gap)}.burger-menu .local-nav{min-height:56px;display:flex;align-items:center;justify-content:flex-end;padding-inline:4px}`;
|
|
172
|
+
const postHeaderCss = () => `:host{--post-global-header-top:calc( var(--post-global-header-reduced-height) - var(--post-global-header-expanded-height) );--post-header-top:calc(var(--post-header-reduced-height) - var(--post-header-expanded-height));--post-logo-height:calc( var(--post-global-header-expanded-height) - var(--post-header-scroll-top, 0px) );--post-global-controls-top:clamp( 1000 * (var(--post-global-header-reduced-height) - var(--post-global-header-expanded-height)), calc( -1 * min(var(--post-header-scroll-top, 0px) / 4, var(--post-global-header-reduced-height)) ), 0px )}@media screen and (min-width: 1024px){:host{--post-header-gap:8px;--post-global-header-padding-inline-start:4px;--post-global-header-padding-inline-end:8px;--post-local-header-padding-inline-start:12px;--post-local-header-padding-inline-end:8px}}@media screen and (min-width: 600px)and (max-width: 1023.98px){:host{--post-header-gap:12px 8px;--post-global-header-padding-inline-start:4px;--post-global-header-padding-inline-end:4px;--post-local-header-padding-inline-start:12px;--post-local-header-padding-inline-end:4px;--post-local-header-padding-block:12px;--post-burger-menu-padding-inline:40px;--post-burger-menu-body-gap:32px;--post-burger-menu-footer-gap:24px}}@media screen and (min-width: 600px)and (max-width: 779.98px){:host{--post-burger-menu-padding-inline:16px}}@media screen and (min-width: 0)and (max-width: 599.98px){:host{--post-header-gap:12px 8px;--post-global-header-padding-inline-start:0px;--post-global-header-padding-inline-end:8px;--post-local-header-padding-inline-start:8px;--post-local-header-padding-inline-end:8px;--post-local-header-padding-block:8px;--post-burger-menu-padding-inline:16px;--post-burger-menu-body-gap:24px;--post-burger-menu-footer-gap:16px}}:host(:not([full-width])),:host([full-width=false]){--post-header-content-max-width:1440px}:host([data-expanded]),:host([data-menu-extended]){--post-header-top:0;--post-global-header-top:-0.001px;--post-global-controls-top:0;--post-global-header-reduced-height:var(--post-global-header-expanded-height)}*,::before,::after{box-sizing:border-box}:host,header,.global-header,.local-header{transition:inset-block-start 150ms cubic-bezier(0.4, 0, 0.2, 1)}.section,.sliding-controls{display:flex;align-items:center;justify-content:space-between;gap:var(--post-header-gap);flex-wrap:wrap}.section{max-width:var(--post-header-content-max-width);margin-inline:auto}:host{display:block;position:sticky;inset-block-start:var(--post-header-top);z-index:1020;box-shadow:var(--post-device-elevation-300)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host{border-bottom:1px solid}}.global-header{z-index:2;position:sticky;inset-block-start:var(--post-global-header-top);background-color:#fc0}.global-header::before{position:absolute;z-index:-1;left:0;bottom:0;width:100%;height:100dvh;content:"";background-color:#fc0}.global-header .section{height:var(--post-global-header-expanded-height);padding-inline-start:var(--post-global-header-padding-inline-start);padding-inline-end:var(--post-global-header-padding-inline-end)}.global-header .logo{align-self:flex-end;width:var(--post-global-header-expanded-height);height:var(--post-logo-height);min-height:var(--post-global-header-reduced-height);max-height:100%;margin-inline-end:calc(20px - var(--post-header-gap));margin-inline-start:clamp(var(--post-logo-expanded-offset),var(--post-logo-expanded-offset) + (var(--post-logo-reduced-offset) - var(--post-logo-expanded-offset))*min(var(--post-header-scroll-top, 0px),var(--post-global-header-expanded-height) - var(--post-global-header-reduced-height))/max(1px,var(--post-global-header-expanded-height) - var(--post-global-header-reduced-height)),var(--post-logo-reduced-offset))}.global-header .sliding-controls{flex-grow:1;justify-content:flex-end;position:relative;inset-block-start:var(--post-global-controls-top)}.global-header .audience{margin-inline-end:auto}@media screen and (max-width: 1023.98px){.global-header slot:where([name=audience],[name=global-nav-secondary]){display:none}}.local-header{position:relative;background-color:#fff;min-height:var(--post-local-header-expanded-min-height);display:var(--post-local-header-display, flex);align-items:var(--post-local-header-align-items, center)}.local-header .section{width:100%;padding-inline-start:var(--post-local-header-padding-inline-start);padding-inline-end:var(--post-local-header-padding-inline-end);padding-block:var(--post-local-header-padding-block)}@media screen and (min-width: 1024px){.local-header .section{display:grid;grid-template:var(--post-local-header-grid-template)}}@media screen and (max-width: 1023.98px){.local-header .section{display:flex;align-self:center}}@media screen and (max-width: 1023.98px)and (max-width: 599.98px){.local-header .section{justify-content:end}}.local-header:where(.megadropdown-open)::after,.local-header:has(~.burger-menu.extended)::after{content:"";display:block;position:absolute;inset-inline:0;inset-block-end:0;height:1px;background-color:#e1e0dc}.local-header .local-nav{flex:0 0 auto}@media screen and (max-width: 1023.98px){.local-header slot[name=main-nav]{display:none}}.burger-button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:4px 10px;gap:6px;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);display:var(--post-burger-button-display, flex)}.burger-button:not(:disabled):hover{text-decoration:none}.burger-button:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.burger-button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.burger-button:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button:focus-visible{outline-color:Highlight !important}}.burger-button.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){.burger-button.pretend-focus{outline-color:Highlight !important}}.burger-button:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.burger-button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.burger-button{border-width:1px !important;transition:none}.burger-button:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}.burger-button:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.burger-button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}.burger-button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}@media screen and (min-width: 0)and (max-width: 599.98px){.burger-button{padding:10px}.burger-button>:not(post-icon){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.burger-button>post-icon{font-size:1.5rem}}@media screen and (min-width: 1024px){.burger-button{display:none}}.burger-menu{z-index:-1;position:absolute;inset-inline:0;inset-block-start:100%;height:calc(min(var(--post-header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));overflow:hidden auto;display:flex;flex-direction:column;background-color:#fafafa}.burger-menu.extended.second-level-open{overflow:hidden}.burger-menu:not(.extended){transform:translateY(-100%);display:none}.burger-menu:not(.extended)>*{display:none}.burger-menu .burger-menu-body,.burger-menu .burger-menu-footer{display:flex;flex-direction:column;padding-inline:var(--post-burger-menu-padding-inline)}.burger-menu .burger-menu-body{flex-grow:1;padding-block:24px;gap:var(--post-burger-menu-body-gap)}.burger-menu .burger-menu-footer{background-color:#f0efed;padding-block-start:16px;padding-block-end:max(24px, env(safe-area-inset-bottom, 0px));gap:var(--post-burger-menu-footer-gap)}.burger-menu .local-nav{min-height:56px;display:flex;align-items:center;justify-content:flex-end;padding-inline:4px}`;
|
|
172
173
|
|
|
173
174
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
174
175
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -241,6 +242,10 @@ const PostHeader = class {
|
|
|
241
242
|
this.closeBurgerMenu();
|
|
242
243
|
}
|
|
243
244
|
};
|
|
245
|
+
this.onScroll = () => {
|
|
246
|
+
this.handleScrollEvent();
|
|
247
|
+
this.collapseIfNotKeyboardFocused();
|
|
248
|
+
};
|
|
244
249
|
this.handleScrollEvent = this.handleScrollEvent.bind(this);
|
|
245
250
|
this.updateScrollParentHeight = this.updateScrollParentHeight.bind(this);
|
|
246
251
|
this.updateLocalHeaderHeight = this.updateLocalHeaderHeight.bind(this);
|
|
@@ -251,10 +256,10 @@ const PostHeader = class {
|
|
|
251
256
|
}
|
|
252
257
|
connectedCallback() {
|
|
253
258
|
globalThis.addEventListener('resize', this.throttledResize, { passive: true });
|
|
254
|
-
globalThis.addEventListener('scroll', this.
|
|
259
|
+
globalThis.addEventListener('scroll', this.onScroll, {
|
|
255
260
|
passive: true,
|
|
256
261
|
});
|
|
257
|
-
this.scrollParent.addEventListener('scroll', this.
|
|
262
|
+
this.scrollParent.addEventListener('scroll', this.onScroll, {
|
|
258
263
|
passive: true,
|
|
259
264
|
});
|
|
260
265
|
document.addEventListener('postToggleMegadropdown', this.megadropdownStateHandler);
|
|
@@ -286,9 +291,9 @@ const PostHeader = class {
|
|
|
286
291
|
const scrollParent = this.scrollParent;
|
|
287
292
|
globalThis.removeEventListener('postBreakpoint:device', this.breakpointChange);
|
|
288
293
|
globalThis.removeEventListener('resize', this.throttledResize);
|
|
289
|
-
globalThis.removeEventListener('scroll', this.
|
|
294
|
+
globalThis.removeEventListener('scroll', this.onScroll);
|
|
290
295
|
if (scrollParent)
|
|
291
|
-
scrollParent.removeEventListener('scroll', this.
|
|
296
|
+
scrollParent.removeEventListener('scroll', this.onScroll);
|
|
292
297
|
document.removeEventListener('postToggleMegadropdown', this.megadropdownStateHandler);
|
|
293
298
|
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
294
299
|
if (this.host.shadowRoot) {
|
|
@@ -381,6 +386,15 @@ const PostHeader = class {
|
|
|
381
386
|
});
|
|
382
387
|
this.megadropdownOpen = false;
|
|
383
388
|
}
|
|
389
|
+
// The header only stays expanded to keep keyboard focus visible
|
|
390
|
+
// once focus is no longer keyboard focus (e.g. after a click), it can collapse on scroll
|
|
391
|
+
collapseIfNotKeyboardFocused() {
|
|
392
|
+
if (!('expanded' in this.host.dataset))
|
|
393
|
+
return;
|
|
394
|
+
if (this.getDeepActiveElement()?.matches(':focus-visible'))
|
|
395
|
+
return;
|
|
396
|
+
delete this.host.dataset.expanded;
|
|
397
|
+
}
|
|
384
398
|
handleScrollEvent() {
|
|
385
399
|
const scrollTop = this.scrollParent === document.body ? window.scrollY : this.scrollParent.scrollTop;
|
|
386
400
|
document.documentElement.style.setProperty('--post-header-scroll-top', `${Math.max(scrollTop, 0)}px`);
|
|
@@ -443,16 +457,22 @@ const PostHeader = class {
|
|
|
443
457
|
});
|
|
444
458
|
}
|
|
445
459
|
onFocusChange(event) {
|
|
446
|
-
|
|
447
|
-
|
|
460
|
+
if (event.type === 'focusout') {
|
|
461
|
+
// Ignore focus moving between elements of the header (e.g. into the language menu flyout)
|
|
462
|
+
if (this.isWithinHeader(event.relatedTarget))
|
|
463
|
+
return;
|
|
464
|
+
delete this.host.dataset.expanded;
|
|
448
465
|
return;
|
|
466
|
+
}
|
|
467
|
+
// Mouse focus never changes the state
|
|
468
|
+
// collapsing here would move the controls away from the pointer before the click completes
|
|
449
469
|
const isFocusVisible = this.getDeepActiveElement()?.matches(':focus-visible');
|
|
450
|
-
|
|
451
|
-
|
|
470
|
+
if (!isFocusVisible)
|
|
471
|
+
return;
|
|
472
|
+
// Keyboard focus: expanded only while focus is in the part that collapses on scroll
|
|
452
473
|
const collapsiblePart = this.device === 'desktop' ? this.globalHeader : this.localHeader;
|
|
453
474
|
const isInCollapsiblePart = event.composedPath().includes(collapsiblePart);
|
|
454
|
-
|
|
455
|
-
this.host.toggleAttribute('data-expanded', isHeaderExpanded);
|
|
475
|
+
this.host.toggleAttribute('data-expanded', isInCollapsiblePart);
|
|
456
476
|
}
|
|
457
477
|
isWithinHeader(target) {
|
|
458
478
|
return target instanceof Node && (target === this.host || this.host.contains(target));
|
|
@@ -476,10 +496,10 @@ const PostHeader = class {
|
|
|
476
496
|
render() {
|
|
477
497
|
const onDesktop = this.device === 'desktop';
|
|
478
498
|
const onTabletAndMobile = this.device !== 'desktop';
|
|
479
|
-
return (h(Host, { key: '
|
|
499
|
+
return (h(Host, { key: '4c74840c9613cb23844f18754a25acfc0d16f128', "data-version": version, "data-color-scheme": "light", "data-burger-menu": this.hasBurgerMenu, "data-menu-extended": this.burgerMenuExtended }, h("header", { key: '711ff06b1294ab7cca504cbb1b18ea132f2e2a29' }, h("div", { key: '91f37765845ec6df6f878a5750acb2f9d3a9a3ef', ref: el => (this.globalHeader = el), class: "global-header" }, h("div", { key: '9ce59aeb02b710ebf435dd71a44daef5729784cb', class: "section" }, h("div", { key: '9ae9b8a9d4d53eb18cee84167b6fd0900ca968bf', class: "logo" }, h("slot", { key: 'a0970fc3b536710b746d62013da387a03ac02ae6', name: "post-logo" })), h("div", { key: '685cf65541a21d8911705317b62ac7a5f900141a', class: "sliding-controls" }, onDesktop && (h("div", { key: '540854418db78414095ef58d376401955e05458b', class: "audience" }, h("slot", { key: '57f1a927cffb3baea05d7ea54d78fd57349dd81f', name: "audience" }))), h("slot", { key: '1f473accb45b6da9ca0225ed1ee1c075a89cc5a4', name: "global-nav-primary" }), (onDesktop || !this.hasMainNav) && [
|
|
480
500
|
h("slot", { key: "global-nav-secondary", name: "global-nav-secondary" }),
|
|
481
501
|
h("slot", { key: "language-menu", name: "language-menu" }),
|
|
482
|
-
], h("slot", { key: '
|
|
502
|
+
], h("slot", { key: '2f22dad30f8b4482b86aa44f4806844a0543826e', name: "post-login" }), onTabletAndMobile && this.hasMainNav && (h("post-togglebutton", { key: 'd9440ab691459ee505bd3fee43df08eab4fd7d6e', class: "burger-button", ref: el => (this.burgerMenuButton = el), onClick: () => this.toggleBurgerMenu() }, h("span", { key: 'c8e750756d635d4d145393db597e7e6c0aab0bf3' }, this.textMenu), h("post-icon", { key: 'ff251d5dd1815caccc2c1099dafbda2719e39531', "aria-hidden": "true", name: "burger", "data-showwhen": "untoggled" }), h("post-icon", { key: '1a607d5b4bf397b17aeeaa392b2444d480740e26', "aria-hidden": "true", name: "closex", "data-showwhen": "toggled" })))))), h("div", { key: 'bdbd60cf795b45ff66c1078defaf388eaa9711a6', ref: el => (this.localHeader = el), class: { 'local-header': true, 'megadropdown-open': this.megadropdownOpen } }, h("div", { key: '3b065f633b1dbf16595ae2665c425448c08e01a5', class: "section" }, h("slot", { key: '8d2a3f4491a348b16dbd71f439ed0e57b8856642', name: "side-nav" }), h("slot", { key: '2b169e02026daaa253e6c607d29b4c51373b30c5', name: "title" }), this.hasTitle && h("slot", { key: 'e4afc5c638c62533387cb35eb121e6736afc957d', name: "local-nav" }), onDesktop && h("slot", { key: '2dedbbec1b4af4b5f22aaf555b0c1adc2260eca3', name: "main-nav" }), onDesktop && !this.hasTitle && h("slot", { key: 'db0bf934df1bd189cbecb74ebc2cdc9b753c56f4', name: "local-nav" }))), this.hasBurgerMenu && this.renderBurgerMenu())));
|
|
483
503
|
}
|
|
484
504
|
get host() { return getElement(this); }
|
|
485
505
|
static get watchers() { return {
|
|
@@ -633,7 +653,7 @@ PostIcon.style = postIconCss();
|
|
|
633
653
|
|
|
634
654
|
const SWITCH_VARIANTS = ['list', 'menu'];
|
|
635
655
|
|
|
636
|
-
const postLanguageMenuCss = () => `:host{display:flex}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.post-language-menu-dropdown-container{display:flex;flex-direction:column}.post-language-menu-trigger{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:4px 10px;gap:6px;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);text-transform:uppercase;line-height:inherit;cursor:pointer}.post-language-menu-trigger:not(:disabled):hover{text-decoration:none}.post-language-menu-trigger:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.post-language-menu-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-menu-trigger:
|
|
656
|
+
const postLanguageMenuCss = () => `:host{display:flex}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.post-language-menu-dropdown-container{display:flex;flex-direction:column}.post-language-menu-trigger{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:4px 10px;gap:6px;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);text-transform:uppercase;line-height:inherit;cursor:pointer}.post-language-menu-trigger:not(:disabled):hover{text-decoration:none}.post-language-menu-trigger:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.post-language-menu-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-menu-trigger:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-menu-trigger:focus-visible{outline-color:Highlight !important}}.post-language-menu-trigger.pretend-focus{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-menu-trigger.pretend-focus{outline-color:Highlight !important}}.post-language-menu-trigger:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-menu-trigger:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-menu-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-menu-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-menu-trigger{border-width:1px !important;transition:none}.post-language-menu-trigger:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}.post-language-menu-trigger:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.post-language-menu-trigger:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}.post-language-menu-trigger:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}.post-language-menu-trigger post-icon{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}.post-language-menu-trigger:is([aria-current],[aria-pressed=true],[aria-expanded=true]) post-icon{transform:rotate(180deg)}.post-language-menu-list{display:flex;gap:8px;margin-top:16px}`;
|
|
637
657
|
|
|
638
658
|
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
639
659
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -815,7 +835,7 @@ __decorate$7([
|
|
|
815
835
|
], PostLanguageMenuItem.prototype, "url", void 0);
|
|
816
836
|
PostLanguageMenuItem.style = postLanguageMenuItemCss();
|
|
817
837
|
|
|
818
|
-
const postLogoCss = () => `:host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.logo-link{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}.logo-link:
|
|
838
|
+
const postLogoCss = () => `:host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.logo-link{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}.logo-link:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.logo-link:focus-visible{outline-color:Highlight !important}}.logo-link.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){.logo-link.pretend-focus{outline-color:Highlight !important}}.logo-link:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.logo-link:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.logo-link: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){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.logo-link{outline-offset:var(--post-device-spacing-padding-28) !important}.logo-link:focus,.logo-link:focus-visible{border-radius:var(--post-device-border-radius-focus)}`;
|
|
819
839
|
|
|
820
840
|
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
821
841
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -992,7 +1012,7 @@ __decorate$5([
|
|
|
992
1012
|
], PostMainnavigation.prototype, "textMain", void 0);
|
|
993
1013
|
PostMainnavigation.style = postMainnavigationCss();
|
|
994
1014
|
|
|
995
|
-
const postMegadropdownCss = () => `*,::before,::after{box-sizing:border-box}.megadropdown{position:absolute;inset-inline:0;overflow-y:auto;box-shadow:var(--post-device-elevation-300)}@media screen and (min-width: 1024px){.megadropdown{max-height:calc(100vh - var(--post-header-height) - 48px);background-color:#f0efed;z-index:-1;inset-block-start:100%}.megadropdown.slide-in{animation:slide-down 350ms forwards}.megadropdown.slide-out{animation:slide-up 350ms forwards}}@media screen and (max-width: 1023.98px){.megadropdown{background-color:#fafafa;z-index:1;inset-block-start:var(--post-header-navigation-current-inset);overscroll-behavior:contain}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown{border-block-end:1px solid CanvasText}}.section{width:100%;max-width:var(--post-header-content-max-width);margin-inline:auto;position:relative}@media screen and (min-width: 1024px){.section{padding:48px 40px 40px}}@media screen and (max-width: 1023.98px){.section{display:flex;flex-direction:column;height:calc(min(var(--post-header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));padding-inline:var(--post-burger-menu-padding-inline);padding-block-start:24px}}@media screen and (max-width: 1023.98px){.section .megadropdown-content{padding-block-end:max(24px, env(safe-area-inset-bottom, 0px))}}.megadropdown-title{margin-block:0 16px;font-weight:950}@media screen and (min-width: 600px)and (max-width: 1023.98px){.megadropdown-title{font-size:1.25rem}}@media screen and (min-width: 0)and (max-width: 599.98px){.megadropdown-title{font-size:1.125rem}}.back-button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7);border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);order:-1;width:fit-content;padding-inline:0}.back-button:not(:disabled):hover{text-decoration:none}.back-button:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.back-button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.back-button:
|
|
1015
|
+
const postMegadropdownCss = () => `*,::before,::after{box-sizing:border-box}.megadropdown{position:absolute;inset-inline:0;overflow-y:auto;box-shadow:var(--post-device-elevation-300)}@media screen and (min-width: 1024px){.megadropdown{max-height:calc(100vh - var(--post-header-height) - 48px);background-color:#f0efed;z-index:-1;inset-block-start:100%}.megadropdown.slide-in{animation:slide-down 350ms forwards}.megadropdown.slide-out{animation:slide-up 350ms forwards}}@media screen and (max-width: 1023.98px){.megadropdown{background-color:#fafafa;z-index:1;inset-block-start:var(--post-header-navigation-current-inset);overscroll-behavior:contain}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown{border-block-end:1px solid CanvasText}}.section{width:100%;max-width:var(--post-header-content-max-width);margin-inline:auto;position:relative}@media screen and (min-width: 1024px){.section{padding:48px 40px 40px}}@media screen and (max-width: 1023.98px){.section{display:flex;flex-direction:column;height:calc(min(var(--post-header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));padding-inline:var(--post-burger-menu-padding-inline);padding-block-start:24px}}@media screen and (max-width: 1023.98px){.section .megadropdown-content{padding-block-end:max(24px, env(safe-area-inset-bottom, 0px))}}.megadropdown-title{margin-block:0 16px;font-weight:950}@media screen and (min-width: 600px)and (max-width: 1023.98px){.megadropdown-title{font-size:1.25rem}}@media screen and (min-width: 0)and (max-width: 599.98px){.megadropdown-title{font-size:1.125rem}}.back-button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7);border-radius:calc(var(--post-device-sizing-interactive-button-height-4) / 2);border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);order:-1;width:fit-content;padding-inline:0}.back-button:not(:disabled):hover{text-decoration:none}.back-button:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.back-button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.back-button:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.back-button:focus-visible{outline-color:Highlight !important}}.back-button.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){.back-button.pretend-focus{outline-color:Highlight !important}}.back-button:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.back-button:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.back-button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.back-button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.back-button{border-width:1px !important;transition:none}.back-button:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}.back-button>post-icon{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5);flex-shrink:0}.back-button:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}@media screen and (min-width: 600px)and (max-width: 1023.98px){.back-button{margin-block-end:32px}}@media screen and (min-width: 0)and (max-width: 599.98px){.back-button{margin-block-end:24px}}.close-button{position:absolute;inset-block-start:8px;inset-inline-end:8px}@media screen and (max-width: 1023.98px){.close-button{display:none}}`;
|
|
996
1016
|
|
|
997
1017
|
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
998
1018
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1015,7 +1035,7 @@ const PostMegadropdown = class {
|
|
|
1015
1035
|
registerInstance(this, hostRef);
|
|
1016
1036
|
this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown");
|
|
1017
1037
|
this.currentAnimation = null;
|
|
1018
|
-
this.
|
|
1038
|
+
this.animationDirection = null;
|
|
1019
1039
|
this.fsAnimationOptions = {
|
|
1020
1040
|
translate: -10,
|
|
1021
1041
|
duration: 350,
|
|
@@ -1043,7 +1063,7 @@ const PostMegadropdown = class {
|
|
|
1043
1063
|
return;
|
|
1044
1064
|
}
|
|
1045
1065
|
// Ignore clicks on the trigger or its contents to prevent running hide() twice
|
|
1046
|
-
if (this.megadropdownTrigger
|
|
1066
|
+
if (this.megadropdownTrigger?.contains(target)) {
|
|
1047
1067
|
return;
|
|
1048
1068
|
}
|
|
1049
1069
|
if (target instanceof HTMLElement) {
|
|
@@ -1085,9 +1105,9 @@ const PostMegadropdown = class {
|
|
|
1085
1105
|
* Toggles the dropdown visibility based on its current state.
|
|
1086
1106
|
*/
|
|
1087
1107
|
async toggle() {
|
|
1088
|
-
if (this.
|
|
1108
|
+
if (this.animationDirection) {
|
|
1089
1109
|
// If this is already animating towards a future state -> reverse intent
|
|
1090
|
-
return this.
|
|
1110
|
+
return this.animationDirection === 'in' ? this.hide() : this.show();
|
|
1091
1111
|
}
|
|
1092
1112
|
return this.isVisible ? this.hide() : this.show();
|
|
1093
1113
|
}
|
|
@@ -1143,6 +1163,9 @@ const PostMegadropdown = class {
|
|
|
1143
1163
|
this.forceClose();
|
|
1144
1164
|
return;
|
|
1145
1165
|
}
|
|
1166
|
+
// Already closed or already closing
|
|
1167
|
+
if (!this.isVisible || this.animationDirection === 'out')
|
|
1168
|
+
return;
|
|
1146
1169
|
// Update trigger state
|
|
1147
1170
|
this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
|
|
1148
1171
|
try {
|
|
@@ -1179,23 +1202,34 @@ const PostMegadropdown = class {
|
|
|
1179
1202
|
}
|
|
1180
1203
|
// Run the respective animation
|
|
1181
1204
|
createAnimation(direction) {
|
|
1205
|
+
// Keep the last frame of the closing animation until the container is hidden,
|
|
1206
|
+
// otherwise it snaps back to full opacity for a frame before display: none is applied
|
|
1207
|
+
const fill = direction === 'out' ? 'forwards' : 'none';
|
|
1182
1208
|
if (this.device === 'desktop') {
|
|
1183
|
-
return fadeSlide(this.animatedContainer, direction, this.fsAnimationOptions);
|
|
1209
|
+
return fadeSlide(this.animatedContainer, direction, { ...this.fsAnimationOptions, fill });
|
|
1184
1210
|
}
|
|
1185
1211
|
return slide(this.animatedContainer, direction, {
|
|
1186
1212
|
translate: 100,
|
|
1187
1213
|
duration: 350,
|
|
1188
1214
|
easing: direction === 'in' ? 'ease-in' : 'ease-out',
|
|
1215
|
+
fill,
|
|
1189
1216
|
});
|
|
1190
1217
|
}
|
|
1191
1218
|
async animate(direction) {
|
|
1192
1219
|
this.cancelAnimation();
|
|
1193
1220
|
this.currentAnimation = this.createAnimation(direction);
|
|
1194
|
-
//
|
|
1195
|
-
this.
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1221
|
+
// Used to avoid toggle() de-sync and double hide() calls
|
|
1222
|
+
this.animationDirection = direction;
|
|
1223
|
+
try {
|
|
1224
|
+
await this.currentAnimation.finished;
|
|
1225
|
+
}
|
|
1226
|
+
finally {
|
|
1227
|
+
if (this.animationDirection === direction)
|
|
1228
|
+
this.animationDirection = null;
|
|
1229
|
+
}
|
|
1230
|
+
// The closing animation is kept (fill: forwards) and cancelled by the next animate() call
|
|
1231
|
+
if (direction === 'in')
|
|
1232
|
+
this.currentAnimation = null;
|
|
1199
1233
|
}
|
|
1200
1234
|
cancelAnimation() {
|
|
1201
1235
|
this.currentAnimation?.cancel();
|
|
@@ -1236,11 +1270,15 @@ const PostMegadropdown = class {
|
|
|
1236
1270
|
}
|
|
1237
1271
|
}
|
|
1238
1272
|
handleTabOutside(e) {
|
|
1239
|
-
if (e.key
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1273
|
+
if (e.key !== 'Tab' || this.device !== 'desktop' || !this.isVisible)
|
|
1274
|
+
return;
|
|
1275
|
+
const target = e.target;
|
|
1276
|
+
if (this.host.contains(target))
|
|
1277
|
+
return;
|
|
1278
|
+
// Focus on the own trigger keeps it open, Enter / Space on the trigger closes it
|
|
1279
|
+
if (this.megadropdownTrigger?.contains(target))
|
|
1280
|
+
return;
|
|
1281
|
+
this.hide(false);
|
|
1244
1282
|
}
|
|
1245
1283
|
/**
|
|
1246
1284
|
* Sets up a MutationObserver on the host to watch for changes
|
|
@@ -1288,7 +1326,7 @@ const PostMegadropdown = class {
|
|
|
1288
1326
|
}
|
|
1289
1327
|
render() {
|
|
1290
1328
|
const containerStyle = this.isVisible ? {} : { display: 'none' };
|
|
1291
|
-
return (h(Host, { key: '
|
|
1329
|
+
return (h(Host, { key: '8b9fe023f42390243b55d4efcf58e57d7bae8982', version: version }, h("div", { key: '5840742453a8d44dd16f09f368958ac0f734ece7', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, h("div", { key: '76332b6f916948ab11411b3dfd5fe97ca6522847', class: "section" }, this.device !== 'desktop' && this.megadropdownTitle && (h("p", { key: '3e7cf05cbd7a134ebb417fd5e83f2052874f6c38', class: "megadropdown-title" }, this.megadropdownTitle)), h("div", { key: '76f902df0e84fb68556ffc6735e5188b1c1babf8', class: "megadropdown-content" }, h("slot", { key: '6b69815d2b418395b246dc2681a0597c47f59034' })), this.device === 'desktop' ? (h("post-closebutton", { onClick: () => this.hide(true), class: "close-button", size: "small", placement: "manual" }, this.textClose)) : (h("button", { onClick: () => this.hide(true), class: "back-button" }, h("post-icon", { name: "arrowleft" }), this.textBack))))));
|
|
1292
1330
|
}
|
|
1293
1331
|
get host() { return getElement(this); }
|
|
1294
1332
|
};
|
|
@@ -1302,7 +1340,7 @@ __decorate$4([
|
|
|
1302
1340
|
], PostMegadropdown.prototype, "textBack", void 0);
|
|
1303
1341
|
PostMegadropdown.style = postMegadropdownCss();
|
|
1304
1342
|
|
|
1305
|
-
const postMegadropdownTriggerCss = () => `button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:4px 10px;gap:6px;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg)}button:not(:disabled):hover{text-decoration:none}button:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button{border-width:1px !important;transition:none}button:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}button:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}button{--post-nav-item-border-width:1px;width:100%;justify-content:start;position:relative;padding:12px 12px calc(12px - var(--post-nav-item-border-width)) 8px;gap:16px;border-radius:0;line-height:1.5;outline-color:currentColor !important;border-bottom:var(--post-nav-item-border-width) solid currentColor;height:100%}button:hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);border-bottom-color:rgba(0,0,0,0)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:none}button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;outline:none !important}button:is(:focus-visible,:has(:focus-visible),.pretend-focus)::after{content:"";position:absolute;inset:calc(-1*var(--post-device-spacing-padding-28));border-width:var(--post-device-border-width-focus);border-style:var(--post-core-border-style-solid);border-color:var(--post-scheme-color-interactive-focus-stroke);border-radius:var(--post-device-border-radius-focus);pointer-events:none}button:is(:focus-visible,:has(:focus-visible),.pretend-focus):hover::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}button:is(:focus-visible,:has(:focus-visible),.pretend-focus):is([aria-current],[aria-pressed=true],[aria-expanded=true],.active)::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;outline:none !important}button:is(:focus-visible,:focus-within,.pretend-focus)::after{content:"";position:absolute;inset:calc(-1*var(--post-device-spacing-padding-28));border-width:var(--post-device-border-width-focus);border-style:var(--post-core-border-style-solid);border-color:var(--post-scheme-color-interactive-focus-stroke);border-radius:var(--post-device-border-radius-focus);pointer-events:none}button:is(:focus-visible,:focus-within,.pretend-focus):hover::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}button:is(:focus-visible,:focus-within,.pretend-focus):is([aria-current],[aria-pressed=true],[aria-expanded=true],.active)::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}button>post-icon:where(:last-child){margin-inline-start:auto}@media screen and (min-width: 0)and (max-width: 599.98px){button{padding:9.5px 12px calc(9.5px - var(--post-nav-item-border-width)) 8px;gap:8px;font-size:.875rem}button>post-icon{font-size:1rem}}@media screen and (min-width: 600px)and (max-width: 1023.98px){button>post-icon{font-size:1.5rem}}@media screen and (min-width: 1024px){button{padding:16px 12px;gap:8px;border-bottom:0}}:host{position:relative;display:inline-block}button post-icon{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true]) post-icon{transform:rotate(180deg)}button>span{position:relative}button>span>span[aria-hidden]{font-weight:700;visibility:hidden}button>span>span[aria-hidden]:where(span:empty+*){visibility:visible}button>span>span:not([aria-hidden]){position:absolute;inset:0}@media screen and (min-width: 1024px){button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){font-weight:700}button[aria-expanded=true]{background-color:#f0efed;color:#050400;z-index:2}button[aria-expanded=true]:hover{box-shadow:inset 0 -0.7px 0 0 #f0efed}button[aria-expanded=true]{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}button[aria-expanded=true]:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}button[aria-expanded=true]:is(:focus-visible,:has(:focus-visible),.pretend-focus)::after{border-color:var(--post-scheme-color-interactive-focus-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){button[aria-expanded=true]:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@media screen and (min-width: 1024px){@supports not selector(:has(:focus-visible)){button[aria-expanded=true]:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}button[aria-expanded=true]:is(:focus-visible,:focus-within,.pretend-focus)::after{border-color:var(--post-scheme-color-interactive-focus-stroke)}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){button[aria-expanded=true]:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}}@media screen and (max-width: 1023.98px){button post-icon{margin-inline-start:auto;transform:rotate(-90deg) !important}}`;
|
|
1343
|
+
const postMegadropdownTriggerCss = () => `button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:4px 10px;gap:6px;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg)}button:not(:disabled):hover{text-decoration:none}button:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}button:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:focus-visible{outline-color:Highlight !important}}button.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){button.pretend-focus{outline-color:Highlight !important}}button:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button{border-width:1px !important;transition:none}button:is(button){background-color:ButtonFace !important;border-color:ButtonBorder !important}}button:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}button{--post-nav-item-border-width:1px;width:100%;justify-content:start;position:relative;padding:12px 12px calc(12px - var(--post-nav-item-border-width)) 8px;gap:16px;border-radius:0;line-height:1.5;outline-color:currentColor !important;border-bottom:var(--post-nav-item-border-width) solid currentColor;height:100%}button:hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);border-bottom-color:rgba(0,0,0,0)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:none}button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}button:focus-visible{outline-style:var(--post-core-border-style-solid) !important;outline:none !important}button:focus-visible::after{content:"";position:absolute;inset:calc(-1*var(--post-device-spacing-padding-28));border-width:var(--post-device-border-width-focus);border-style:var(--post-core-border-style-solid);border-color:var(--post-scheme-color-interactive-focus-stroke);border-radius:var(--post-device-border-radius-focus);pointer-events:none}button:focus-visible:hover::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}button:focus-visible:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active)::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:focus-visible{outline-color:Highlight !important}}button.pretend-focus{outline-style:var(--post-core-border-style-solid) !important;outline:none !important}button.pretend-focus::after{content:"";position:absolute;inset:calc(-1*var(--post-device-spacing-padding-28));border-width:var(--post-device-border-width-focus);border-style:var(--post-core-border-style-solid);border-color:var(--post-scheme-color-interactive-focus-stroke);border-radius:var(--post-device-border-radius-focus);pointer-events:none}button.pretend-focus:hover::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}button.pretend-focus:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active)::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button.pretend-focus{outline-color:Highlight !important}}button:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important;outline:none !important}button:has(:focus-visible)::after{content:"";position:absolute;inset:calc(-1*var(--post-device-spacing-padding-28));border-width:var(--post-device-border-width-focus);border-style:var(--post-core-border-style-solid);border-color:var(--post-scheme-color-interactive-focus-stroke);border-radius:var(--post-device-border-radius-focus);pointer-events:none}button:has(:focus-visible):hover::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}button:has(:focus-visible):is([aria-current],[aria-pressed=true],[aria-expanded=true],.active)::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;outline:none !important}button:is(:focus-visible,:focus-within,.pretend-focus)::after{content:"";position:absolute;inset:calc(-1*var(--post-device-spacing-padding-28));border-width:var(--post-device-border-width-focus);border-style:var(--post-core-border-style-solid);border-color:var(--post-scheme-color-interactive-focus-stroke);border-radius:var(--post-device-border-radius-focus);pointer-events:none}button:is(:focus-visible,:focus-within,.pretend-focus):hover::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}button:is(:focus-visible,:focus-within,.pretend-focus):is([aria-current],[aria-pressed=true],[aria-expanded=true],.active)::after{border-color:var(--post-scheme-color-interactive-focus-stroke-inverted)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}button>post-icon:where(:last-child){margin-inline-start:auto}@media screen and (min-width: 0)and (max-width: 599.98px){button{padding:9.5px 12px calc(9.5px - var(--post-nav-item-border-width)) 8px;gap:8px;font-size:.875rem}button>post-icon{font-size:1rem}}@media screen and (min-width: 600px)and (max-width: 1023.98px){button>post-icon{font-size:1.5rem}}@media screen and (min-width: 1024px){button{padding:16px 12px;gap:8px;border-bottom:0}}:host{position:relative;display:inline-block}button post-icon{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true]) post-icon{transform:rotate(180deg)}button>span{position:relative}button>span>span[aria-hidden]{font-weight:700;visibility:hidden}button>span>span[aria-hidden]:where(span:empty+*){visibility:visible}button>span>span:not([aria-hidden]){position:absolute;inset:0}@media screen and (min-width: 1024px){button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){font-weight:700}button[aria-expanded=true]{background-color:#f0efed;color:#050400;z-index:2}button[aria-expanded=true]:hover{box-shadow:inset 0 -0.7px 0 0 #f0efed}button[aria-expanded=true]{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}button[aria-expanded=true]:focus-visible{outline-style:var(--post-core-border-style-solid) !important}button[aria-expanded=true]:focus-visible::after{border-color:var(--post-scheme-color-interactive-focus-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){button[aria-expanded=true]:focus-visible{outline-color:Highlight !important}}@media screen and (min-width: 1024px){button[aria-expanded=true].pretend-focus{outline-style:var(--post-core-border-style-solid) !important}button[aria-expanded=true].pretend-focus::after{border-color:var(--post-scheme-color-interactive-focus-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){button[aria-expanded=true].pretend-focus{outline-color:Highlight !important}}@media screen and (min-width: 1024px){button[aria-expanded=true]:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}button[aria-expanded=true]:has(:focus-visible)::after{border-color:var(--post-scheme-color-interactive-focus-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){button[aria-expanded=true]:has(:focus-visible){outline-color:Highlight !important}}@media screen and (min-width: 1024px){@supports not selector(:has(:focus-visible)){button[aria-expanded=true]:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}button[aria-expanded=true]:is(:focus-visible,:focus-within,.pretend-focus)::after{border-color:var(--post-scheme-color-interactive-focus-stroke)}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){button[aria-expanded=true]:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}}@media screen and (max-width: 1023.98px){button post-icon{margin-inline-start:auto;transform:rotate(-90deg) !important}}`;
|
|
1306
1344
|
|
|
1307
1345
|
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1308
1346
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1386,7 +1424,7 @@ __decorate$3([
|
|
|
1386
1424
|
], PostMegadropdownTrigger.prototype, "onMegadropdownToggled", null);
|
|
1387
1425
|
PostMegadropdownTrigger.style = postMegadropdownTriggerCss();
|
|
1388
1426
|
|
|
1389
|
-
const postMenuCss = () => `:host{display:block}:where([part=post-menu]){display:flex;flex-direction:column;padding-block:8px}::slotted([slot=header]){margin-top:-8px;padding:16px;display:flex;align-items:center;gap:8px;border-block-end:1px solid #050400;font-weight:700}@media screen and (max-width: 1023.98px){::slotted([slot=header]){padding:12px 16px}}@media screen and (max-width: 779.98px){::slotted([slot=header]){padding:8px 16px}}post-popovercontainer::part(post-popovercontainer-content){background-color:#fff}`;
|
|
1427
|
+
const postMenuCss = () => `:host{display:block}:where([part=post-menu]){display:flex;flex-direction:column;padding-block:8px;overflow-y:auto;overscroll-behavior:contain}::slotted([slot=header]){margin-top:-8px;padding:16px;display:flex;align-items:center;gap:8px;border-block-end:1px solid #050400;font-weight:700}@media screen and (max-width: 1023.98px){::slotted([slot=header]){padding:12px 16px}}@media screen and (max-width: 779.98px){::slotted([slot=header]){padding:8px 16px}}post-popovercontainer::part(post-popovercontainer-content){background-color:#fff}`;
|
|
1390
1428
|
|
|
1391
1429
|
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1392
1430
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1506,7 +1544,7 @@ const PostMenu = class {
|
|
|
1506
1544
|
this.lastFocusedElement = this.root?.activeElement;
|
|
1507
1545
|
// Only focus the first item if the trigger was keyboard-focus-visible
|
|
1508
1546
|
// that's the browser's own signal for a keyboard-driven interaction.
|
|
1509
|
-
if (
|
|
1547
|
+
if (isFocusVisible(this.lastFocusedElement)) {
|
|
1510
1548
|
requestAnimationFrame(() => {
|
|
1511
1549
|
const menuItems = this.getSlottedItems();
|
|
1512
1550
|
if (menuItems.length > 0) {
|
|
@@ -1519,17 +1557,6 @@ const PostMenu = class {
|
|
|
1519
1557
|
this.lastFocusedElement.focus();
|
|
1520
1558
|
}
|
|
1521
1559
|
}
|
|
1522
|
-
wasFocusVisible(element) {
|
|
1523
|
-
if (!element)
|
|
1524
|
-
return false;
|
|
1525
|
-
try {
|
|
1526
|
-
return element.matches(':focus-visible');
|
|
1527
|
-
}
|
|
1528
|
-
catch {
|
|
1529
|
-
// Not supported, fall back to always focusing
|
|
1530
|
-
return true;
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
1560
|
controlKeyDownHandler(e) {
|
|
1534
1561
|
const menuItems = this.getSlottedItems();
|
|
1535
1562
|
if (menuItems.length === 0) {
|
|
@@ -1581,7 +1608,7 @@ const PostMenu = class {
|
|
|
1581
1608
|
]));
|
|
1582
1609
|
}
|
|
1583
1610
|
render() {
|
|
1584
|
-
return (h(Host, { key: '
|
|
1611
|
+
return (h(Host, { key: '988b77e3589a499e23e95eb6eff985edbadd4d2e', "data-version": version }, h("post-popovercontainer", { key: 'fd0ee4d4234fe1f222757c00d778ebb2a2c5ac13', autoHide: true, autoResize: true, onPostShow: this.handlePostShown.bind(this), onPostBeforeToggle: this.handlePostBeforeToggle.bind(this), placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '8b46a79db5944854c97c862608bd5a8d9113398e', part: "post-menu" }, h("slot", { key: 'a024a0ade2a865b12d1a452c6c33f9afde1f34e0', name: "header" }), h("slot", { key: '1465a5d8d9463e6557a2a8c32aa119429a4783b3' })))));
|
|
1585
1612
|
}
|
|
1586
1613
|
get host() { return getElement(this); }
|
|
1587
1614
|
};
|
|
@@ -1600,7 +1627,7 @@ __decorate$2([
|
|
|
1600
1627
|
], PostMenu.prototype, "handlePostBeforeToggle", null);
|
|
1601
1628
|
PostMenu.style = postMenuCss();
|
|
1602
1629
|
|
|
1603
|
-
const postMenuItemCss = () => `post-menu-item button{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;width:100%}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button{background-color:ButtonFace !important}post-menu-item button:hover{background-color:Highlight !important}}post-menu-item button,post-menu-item a{position:relative;display:flex;align-items:center;padding:8px 12px 8px 16px;gap:12px;font-size:.875rem;color:#050400;border-radius:0;text-decoration:none}@media screen and (min-width: 780px){post-menu-item button,post-menu-item a{font-size:1rem;padding-block:12px;gap:16px}}@media screen and (min-width: 1024px){post-menu-item button,post-menu-item a{font-size:1.25rem;padding-block:13px}}post-menu-item button:focus-visible,post-menu-item a:focus-visible{outline-
|
|
1630
|
+
const postMenuItemCss = () => `post-menu-item button{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;width:100%}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button{background-color:ButtonFace !important}post-menu-item button:hover{background-color:Highlight !important}}post-menu-item button,post-menu-item a{position:relative;display:flex;align-items:center;padding:8px 12px 8px 16px;gap:12px;font-size:.875rem;color:#050400;border-radius:0;text-decoration:none}@media screen and (min-width: 780px){post-menu-item button,post-menu-item a{font-size:1rem;padding-block:12px;gap:16px}}@media screen and (min-width: 1024px){post-menu-item button,post-menu-item a{font-size:1.25rem;padding-block:13px}}post-menu-item button:focus-visible,post-menu-item a:focus-visible{outline:none !important}post-menu-item button.pretend-focus,post-menu-item a.pretend-focus{outline:none !important}post-menu-item button:has(:focus-visible),post-menu-item a:has(:focus-visible){outline:none !important}@supports not selector(:has(:focus-visible)){post-menu-item button:is(:focus-visible,:focus-within,.pretend-focus),post-menu-item a:is(:focus-visible,:focus-within,.pretend-focus){outline:none !important}}post-menu-item button::after,post-menu-item a::after{content:"";position:absolute;inset:0;width:100%;height:100%;border-radius:calc(var(--post-device-border-radius-focus) - var(--post-device-spacing-padding-44))}post-menu-item button::after,post-menu-item a::after{outline-offset:var(--post-device-spacing-padding-44) !important;outline:#050400 none var(--post-device-border-width-focus) !important}post-menu-item button:focus-visible::after,post-menu-item a:focus-visible::after{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button:focus-visible::after,post-menu-item a:focus-visible::after{outline-color:Highlight !important}}post-menu-item button.pretend-focus::after,post-menu-item a.pretend-focus::after{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button.pretend-focus::after,post-menu-item a.pretend-focus::after{outline-color:Highlight !important}}post-menu-item button:has(:focus-visible)::after,post-menu-item a:has(:focus-visible)::after{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button:has(:focus-visible)::after,post-menu-item a:has(:focus-visible)::after{outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-menu-item button:is(:focus-visible,:focus-within,.pretend-focus)::after,post-menu-item a:is(:focus-visible,:focus-within,.pretend-focus)::after{outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button:is(:focus-visible,:focus-within,.pretend-focus)::after,post-menu-item a:is(:focus-visible,:focus-within,.pretend-focus)::after{outline-color:Highlight !important}}}post-menu-item button:hover,post-menu-item a:hover{background-color:#504f4b;color:#fff}post-menu-item button:hover:focus-visible::after,post-menu-item a:hover:focus-visible::after{outline-color:#fff !important}post-menu-item button:hover.pretend-focus::after,post-menu-item a:hover.pretend-focus::after{outline-color:#fff !important}post-menu-item button:hover:has(:focus-visible)::after,post-menu-item a:hover:has(:focus-visible)::after{outline-color:#fff !important}@supports not selector(:has(:focus-visible)){post-menu-item button:hover:is(:focus-visible,:focus-within,.pretend-focus)::after,post-menu-item a:hover:is(:focus-visible,:focus-within,.pretend-focus)::after{outline-color:#fff !important}}post-menu-item button post-icon,post-menu-item a post-icon{width:16px;height:16px;margin-block:4px}@media screen and (min-width: 780px){post-menu-item button post-icon,post-menu-item a post-icon{width:24px;height:24px;margin:0}}`;
|
|
1604
1631
|
|
|
1605
1632
|
const PostMenuItem = class {
|
|
1606
1633
|
constructor(hostRef) {
|
|
@@ -1690,6 +1717,21 @@ __decorate$1([
|
|
|
1690
1717
|
], PostMenuTrigger.prototype, "for", void 0);
|
|
1691
1718
|
PostMenuTrigger.style = postMenuTriggerCss();
|
|
1692
1719
|
|
|
1720
|
+
const duration = 250;
|
|
1721
|
+
const easing = 'ease-out';
|
|
1722
|
+
function popIn(el) {
|
|
1723
|
+
if (!el)
|
|
1724
|
+
return;
|
|
1725
|
+
return el.animate([
|
|
1726
|
+
{ transform: 'scale(0.9)', opacity: 0 },
|
|
1727
|
+
{ transform: 'scale(1)', opacity: 1 },
|
|
1728
|
+
], {
|
|
1729
|
+
duration,
|
|
1730
|
+
easing,
|
|
1731
|
+
fill: 'forwards',
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1693
1735
|
/**
|
|
1694
1736
|
* Custom positioning reference element.
|
|
1695
1737
|
* @see https://floating-ui.com/docs/virtual-elements
|
|
@@ -1735,23 +1777,6 @@ function getSideAxis(placement) {
|
|
|
1735
1777
|
function getAlignmentAxis(placement) {
|
|
1736
1778
|
return getOppositeAxis(getSideAxis(placement));
|
|
1737
1779
|
}
|
|
1738
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
1739
|
-
if (rtl === void 0) {
|
|
1740
|
-
rtl = false;
|
|
1741
|
-
}
|
|
1742
|
-
const alignment = getAlignment(placement);
|
|
1743
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
1744
|
-
const length = getAxisLength(alignmentAxis);
|
|
1745
|
-
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
1746
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
1747
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
1748
|
-
}
|
|
1749
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
1750
|
-
}
|
|
1751
|
-
function getExpandedPlacements(placement) {
|
|
1752
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
1753
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1754
|
-
}
|
|
1755
1780
|
function getOppositeAlignmentPlacement(placement) {
|
|
1756
1781
|
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
1757
1782
|
}
|
|
@@ -1777,7 +1802,7 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
|
1777
1802
|
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
1778
1803
|
if (alignment) {
|
|
1779
1804
|
list = list.map(side => side + "-" + alignment);
|
|
1780
|
-
|
|
1805
|
+
{
|
|
1781
1806
|
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
1782
1807
|
}
|
|
1783
1808
|
}
|
|
@@ -1883,7 +1908,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
1883
1908
|
* - 0 = lies flush with the boundary
|
|
1884
1909
|
* @see https://floating-ui.com/docs/detectOverflow
|
|
1885
1910
|
*/
|
|
1886
|
-
async function detectOverflow(state, options) {
|
|
1911
|
+
async function detectOverflow$1(state, options) {
|
|
1887
1912
|
var _await$platform$isEle;
|
|
1888
1913
|
if (options === void 0) {
|
|
1889
1914
|
options = {};
|
|
@@ -1956,7 +1981,7 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1956
1981
|
} = config;
|
|
1957
1982
|
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
1958
1983
|
...platform,
|
|
1959
|
-
detectOverflow
|
|
1984
|
+
detectOverflow: detectOverflow$1
|
|
1960
1985
|
};
|
|
1961
1986
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
1962
1987
|
let rects = await platform.getElementRects({
|
|
@@ -2116,138 +2141,6 @@ const arrow$1 = options => ({
|
|
|
2116
2141
|
}
|
|
2117
2142
|
});
|
|
2118
2143
|
|
|
2119
|
-
/**
|
|
2120
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
2121
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
2122
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
2123
|
-
* @see https://floating-ui.com/docs/flip
|
|
2124
|
-
*/
|
|
2125
|
-
const flip$1 = function (options) {
|
|
2126
|
-
if (options === void 0) {
|
|
2127
|
-
options = {};
|
|
2128
|
-
}
|
|
2129
|
-
return {
|
|
2130
|
-
name: 'flip',
|
|
2131
|
-
options,
|
|
2132
|
-
async fn(state) {
|
|
2133
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
2134
|
-
const {
|
|
2135
|
-
placement,
|
|
2136
|
-
middlewareData,
|
|
2137
|
-
rects,
|
|
2138
|
-
initialPlacement,
|
|
2139
|
-
platform,
|
|
2140
|
-
elements
|
|
2141
|
-
} = state;
|
|
2142
|
-
const {
|
|
2143
|
-
mainAxis: checkMainAxis = true,
|
|
2144
|
-
crossAxis: checkCrossAxis = true,
|
|
2145
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
2146
|
-
fallbackStrategy = 'bestFit',
|
|
2147
|
-
fallbackAxisSideDirection = 'none',
|
|
2148
|
-
flipAlignment = true,
|
|
2149
|
-
...detectOverflowOptions
|
|
2150
|
-
} = evaluate(options, state);
|
|
2151
|
-
|
|
2152
|
-
// If a reset by the arrow was caused due to an alignment offset being
|
|
2153
|
-
// added, we should skip any logic now since `flip()` has already done its
|
|
2154
|
-
// work.
|
|
2155
|
-
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
2156
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2157
|
-
return {};
|
|
2158
|
-
}
|
|
2159
|
-
const side = getSide(placement);
|
|
2160
|
-
const initialSideAxis = getSideAxis(initialPlacement);
|
|
2161
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
2162
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
2163
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
2164
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
2165
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
2166
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
2167
|
-
}
|
|
2168
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
|
2169
|
-
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
2170
|
-
const overflows = [];
|
|
2171
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
2172
|
-
if (checkMainAxis) {
|
|
2173
|
-
overflows.push(overflow[side]);
|
|
2174
|
-
}
|
|
2175
|
-
if (checkCrossAxis) {
|
|
2176
|
-
const sides = getAlignmentSides(placement, rects, rtl);
|
|
2177
|
-
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
2178
|
-
}
|
|
2179
|
-
overflowsData = [...overflowsData, {
|
|
2180
|
-
placement,
|
|
2181
|
-
overflows
|
|
2182
|
-
}];
|
|
2183
|
-
|
|
2184
|
-
// One or more sides is overflowing.
|
|
2185
|
-
if (!overflows.every(side => side <= 0)) {
|
|
2186
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
2187
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
2188
|
-
const nextPlacement = placements[nextIndex];
|
|
2189
|
-
if (nextPlacement) {
|
|
2190
|
-
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
2191
|
-
if (!ignoreCrossAxisOverflow ||
|
|
2192
|
-
// We leave the current main axis only if every placement on that axis
|
|
2193
|
-
// overflows the main axis.
|
|
2194
|
-
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
2195
|
-
// Try next placement and re-run the lifecycle.
|
|
2196
|
-
return {
|
|
2197
|
-
data: {
|
|
2198
|
-
index: nextIndex,
|
|
2199
|
-
overflows: overflowsData
|
|
2200
|
-
},
|
|
2201
|
-
reset: {
|
|
2202
|
-
placement: nextPlacement
|
|
2203
|
-
}
|
|
2204
|
-
};
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
2209
|
-
// then find the placement that fits the best on the main crossAxis side.
|
|
2210
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
2211
|
-
|
|
2212
|
-
// Otherwise fallback.
|
|
2213
|
-
if (!resetPlacement) {
|
|
2214
|
-
switch (fallbackStrategy) {
|
|
2215
|
-
case 'bestFit':
|
|
2216
|
-
{
|
|
2217
|
-
var _overflowsData$filter2;
|
|
2218
|
-
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
2219
|
-
if (hasFallbackAxisSideDirection) {
|
|
2220
|
-
const currentSideAxis = getSideAxis(d.placement);
|
|
2221
|
-
return currentSideAxis === initialSideAxis ||
|
|
2222
|
-
// Create a bias to the `y` side axis due to horizontal
|
|
2223
|
-
// reading directions favoring greater width.
|
|
2224
|
-
currentSideAxis === 'y';
|
|
2225
|
-
}
|
|
2226
|
-
return true;
|
|
2227
|
-
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
2228
|
-
if (placement) {
|
|
2229
|
-
resetPlacement = placement;
|
|
2230
|
-
}
|
|
2231
|
-
break;
|
|
2232
|
-
}
|
|
2233
|
-
case 'initialPlacement':
|
|
2234
|
-
resetPlacement = initialPlacement;
|
|
2235
|
-
break;
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
if (placement !== resetPlacement) {
|
|
2239
|
-
return {
|
|
2240
|
-
reset: {
|
|
2241
|
-
placement: resetPlacement
|
|
2242
|
-
}
|
|
2243
|
-
};
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
return {};
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
};
|
|
2250
|
-
|
|
2251
2144
|
function getSideOffsets(overflow, rect) {
|
|
2252
2145
|
return {
|
|
2253
2146
|
top: overflow.top - rect.height,
|
|
@@ -3130,7 +3023,7 @@ function getDocumentRect(html) {
|
|
|
3130
3023
|
// calculation is affected by unusual styles.
|
|
3131
3024
|
// Most scrollbars leave 15-18px of space.
|
|
3132
3025
|
const SCROLLBAR_MAX = 25;
|
|
3133
|
-
function getViewportRect(element, strategy, rootBoundary) {
|
|
3026
|
+
function getViewportRect$1(element, strategy, rootBoundary) {
|
|
3134
3027
|
if (rootBoundary === void 0) {
|
|
3135
3028
|
rootBoundary = 'viewport';
|
|
3136
3029
|
}
|
|
@@ -3208,7 +3101,7 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
3208
3101
|
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
3209
3102
|
let rect;
|
|
3210
3103
|
if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {
|
|
3211
|
-
rect = getViewportRect(element, strategy, clippingAncestor);
|
|
3104
|
+
rect = getViewportRect$1(element, strategy, clippingAncestor);
|
|
3212
3105
|
} else if (clippingAncestor === 'document') {
|
|
3213
3106
|
rect = getDocumentRect(getDocumentElement(element));
|
|
3214
3107
|
} else if (isElement(clippingAncestor)) {
|
|
@@ -3604,6 +3497,16 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
3604
3497
|
};
|
|
3605
3498
|
}
|
|
3606
3499
|
|
|
3500
|
+
/**
|
|
3501
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
3502
|
+
* element is overflowing a given clipping boundary on each side.
|
|
3503
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
3504
|
+
* - negative = how many pixels left before it will overflow
|
|
3505
|
+
* - 0 = lies flush with the boundary
|
|
3506
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
3507
|
+
*/
|
|
3508
|
+
const detectOverflow = detectOverflow$1;
|
|
3509
|
+
|
|
3607
3510
|
/**
|
|
3608
3511
|
* Modifies the placement by translating the floating element along the
|
|
3609
3512
|
* specified axes.
|
|
@@ -3620,14 +3523,6 @@ const offset = offset$1;
|
|
|
3620
3523
|
*/
|
|
3621
3524
|
const shift = shift$1;
|
|
3622
3525
|
|
|
3623
|
-
/**
|
|
3624
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
3625
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
3626
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
3627
|
-
* @see https://floating-ui.com/docs/flip
|
|
3628
|
-
*/
|
|
3629
|
-
const flip = flip$1;
|
|
3630
|
-
|
|
3631
3526
|
/**
|
|
3632
3527
|
* Provides data that allows you to change the size of the floating element —
|
|
3633
3528
|
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
@@ -3683,19 +3578,211 @@ const computePosition = (reference, floating, options) => {
|
|
|
3683
3578
|
});
|
|
3684
3579
|
};
|
|
3685
3580
|
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3581
|
+
/**
|
|
3582
|
+
* Returns the nth side in clockwise direction relative to the given side.
|
|
3583
|
+
*/
|
|
3584
|
+
function getRelativeSide(side, n) {
|
|
3585
|
+
return sides[(sides.indexOf(side) + n) % 4];
|
|
3586
|
+
}
|
|
3587
|
+
const getNextSide = (side) => getRelativeSide(side, 1);
|
|
3588
|
+
const getOppositeSide = (side) => getRelativeSide(side, 2);
|
|
3589
|
+
const getPreviousSide = (side) => getRelativeSide(side, 3);
|
|
3590
|
+
|
|
3591
|
+
const FLIP_MIDDLEWARE = 'post-flip';
|
|
3592
|
+
/**
|
|
3593
|
+
* Changes the placement of the floating element to keep it in view.
|
|
3594
|
+
*
|
|
3595
|
+
* Unlike the Floating UI `flip` middleware, placements are measured against `minSize` rather than
|
|
3596
|
+
* against the current size of the floating element, and the placement with the smallest deficit is
|
|
3597
|
+
* used when none of them fits.
|
|
3598
|
+
*/
|
|
3599
|
+
function flip(options = {}) {
|
|
3600
|
+
return {
|
|
3601
|
+
name: FLIP_MIDDLEWARE,
|
|
3602
|
+
options,
|
|
3603
|
+
async fn(state) {
|
|
3604
|
+
const { middlewareData, placement } = state;
|
|
3605
|
+
// see https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
3606
|
+
if (middlewareData.arrow?.alignmentOffset)
|
|
3607
|
+
return {};
|
|
3608
|
+
const { minSize = {}, ...detectOverflowOptions } = evaluate(options, state);
|
|
3609
|
+
const gap = Math.abs(middlewareData.offset?.[getSideAxis(placement)] ?? 0);
|
|
3610
|
+
const side = getSide(placement);
|
|
3611
|
+
const referenceOverflow = await detectOverflow(state, {
|
|
3612
|
+
...detectOverflowOptions,
|
|
3613
|
+
elementContext: 'reference',
|
|
3614
|
+
});
|
|
3615
|
+
const floatingOverflow = await detectOverflow(state, {
|
|
3616
|
+
...detectOverflowOptions,
|
|
3617
|
+
elementContext: 'floating',
|
|
3618
|
+
});
|
|
3619
|
+
// The floating element fits at its current placement, there is nothing left to do.
|
|
3620
|
+
if (Math.max(referenceOverflow[side], floatingOverflow[side]) <= 0)
|
|
3621
|
+
return {};
|
|
3622
|
+
const previous = middlewareData[FLIP_MIDDLEWARE];
|
|
3623
|
+
const measurement = { overflow: referenceOverflow, minSize, gap };
|
|
3624
|
+
let deficits = previous?.deficits ?? [];
|
|
3625
|
+
const placements = previous?.placements ?? (await getPlacements(state, measurement));
|
|
3626
|
+
if (deficits.length < placements.length) {
|
|
3627
|
+
deficits = [...deficits, getDeficit(side, measurement)];
|
|
3628
|
+
}
|
|
3629
|
+
const data = { placements, deficits };
|
|
3630
|
+
// If there are still placements to try, move on to the next one.
|
|
3631
|
+
if (deficits.length < placements.length) {
|
|
3632
|
+
return { data, reset: { placement: placements[deficits.length] } };
|
|
3633
|
+
}
|
|
3634
|
+
// If none of the placements fit, fall back to the one that loses the least space.
|
|
3635
|
+
const fallback = data.placements[data.deficits.indexOf(Math.min(...data.deficits))];
|
|
3636
|
+
return fallback === placement ? { data } : { data, reset: { placement: fallback } };
|
|
3637
|
+
},
|
|
3638
|
+
};
|
|
3639
|
+
}
|
|
3640
|
+
/**
|
|
3641
|
+
* Returns the placements to try, ordered from most to least promising.
|
|
3642
|
+
*/
|
|
3643
|
+
async function getPlacements(state, measurement) {
|
|
3644
|
+
const { placement, platform, elements } = state;
|
|
3645
|
+
const { overflow } = measurement;
|
|
3646
|
+
const side = getSide(placement);
|
|
3647
|
+
const placements = [placement, getOppositePlacement(placement)];
|
|
3648
|
+
const mainAxisDeficit = Math.min(getDeficit(side, measurement), getDeficit(getOppositeSide(side), measurement));
|
|
3649
|
+
if (mainAxisDeficit <= 0)
|
|
3650
|
+
return placements;
|
|
3651
|
+
const rtl = (await platform.isRTL?.(elements.floating)) ?? false;
|
|
3652
|
+
const crossAxisPlacements = getOppositeAxisPlacements(placement, true, 'start', rtl);
|
|
3653
|
+
// Try the side with the most available space first.
|
|
3654
|
+
crossAxisPlacements.sort((a, b) => overflow[getSide(a)] - overflow[getSide(b)]);
|
|
3655
|
+
return [...placements, ...crossAxisPlacements];
|
|
3656
|
+
}
|
|
3657
|
+
/**
|
|
3658
|
+
* Returns the amount of space required to display the floating element at its minimum size on the
|
|
3659
|
+
* given side of the reference element.
|
|
3660
|
+
*/
|
|
3661
|
+
function getDeficit(side, { minSize, overflow, gap }) {
|
|
3662
|
+
const minLength = minSize[getAxisLength(getSideAxis(side))] ?? 0;
|
|
3663
|
+
return gap + minLength + overflow[side];
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
/**
|
|
3667
|
+
* This utility is covered by the end-to-end tests under 'clipping' in `popovercontainer.cy.ts`.
|
|
3668
|
+
*/
|
|
3669
|
+
const CLIPPING_RECT_CACHE = Symbol('Clipping Rect Cache');
|
|
3670
|
+
/**
|
|
3671
|
+
* A custom floating UI platform that restricts clipping rectangles to the safe area.
|
|
3672
|
+
*/
|
|
3673
|
+
const safeAreaPlatform = { ...platform, getClippingRect };
|
|
3674
|
+
/**
|
|
3675
|
+
* Computes the clipping rectangle of an element while accounting for the safe area.
|
|
3676
|
+
*/
|
|
3677
|
+
async function getClippingRect(...args) {
|
|
3678
|
+
const element = args[0].element;
|
|
3679
|
+
// Check whether the clipping rectangle of the given element has already been computed during
|
|
3680
|
+
// this pass.
|
|
3681
|
+
const hit = this[CLIPPING_RECT_CACHE].get(element);
|
|
3682
|
+
if (hit)
|
|
3683
|
+
return hit;
|
|
3684
|
+
// Compute the clipping rectangle with the Floating UI DOM platform, then restrict it to the safe
|
|
3685
|
+
// area.
|
|
3686
|
+
const clippingRect = await platform.getClippingRect.apply(this, args);
|
|
3687
|
+
applySafeArea(clippingRect, element);
|
|
3688
|
+
this[CLIPPING_RECT_CACHE].set(element, clippingRect);
|
|
3689
|
+
return clippingRect;
|
|
3690
|
+
}
|
|
3691
|
+
/**
|
|
3692
|
+
* Restricts the `clippingRect` computed for `element` to the safe area, modifying it in place.
|
|
3693
|
+
*
|
|
3694
|
+
* The safe area only applies to elements that the header can actually cover, which excludes
|
|
3695
|
+
* elements without a header on their page, elements on a top layer and elements within the header.
|
|
3696
|
+
*/
|
|
3697
|
+
function applySafeArea(clippingRect, element) {
|
|
3698
|
+
const headerElement = element.ownerDocument.querySelector('post-header');
|
|
3699
|
+
if (headerElement === null)
|
|
3690
3700
|
return;
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3701
|
+
let parent = element;
|
|
3702
|
+
while (!isLastTraversableNode(parent)) {
|
|
3703
|
+
parent = getParentNode(parent);
|
|
3704
|
+
if (!isHTMLElement(parent))
|
|
3705
|
+
continue;
|
|
3706
|
+
// Do not apply the safe area of the header to
|
|
3707
|
+
// - elements that are on a top layer, such as a dialog.
|
|
3708
|
+
// - elements that are located within the header itself.
|
|
3709
|
+
if (isTopLayer(parent) || parent === headerElement)
|
|
3710
|
+
return;
|
|
3711
|
+
}
|
|
3712
|
+
const headerRect = headerElement.getBoundingClientRect();
|
|
3713
|
+
const top = Math.max(clippingRect.y, headerRect.bottom);
|
|
3714
|
+
clippingRect.height -= top - clippingRect.y;
|
|
3715
|
+
clippingRect.y = top;
|
|
3716
|
+
}
|
|
3717
|
+
/**
|
|
3718
|
+
* Computes the coordinates that will position the `floating` element next to a given `reference`
|
|
3719
|
+
* element while accounting for the safe area.
|
|
3720
|
+
*
|
|
3721
|
+
* The safe area is the part of the viewport that the header does not cover. Restricting the
|
|
3722
|
+
* clipping rectangles to it makes floating elements behave as if they were clipped by the header.
|
|
3723
|
+
*/
|
|
3724
|
+
const computePositionWithSafeArea = (reference, floating, options) => {
|
|
3725
|
+
// Adapted from https://github.com/floating-ui/floating-ui/blob/27629b74ba36ab8ceb2a968051927b9b69511a3b/packages/dom/src/index.ts#L15
|
|
3726
|
+
options ??= {};
|
|
3727
|
+
return computePosition(reference, floating, {
|
|
3728
|
+
...options,
|
|
3729
|
+
platform: {
|
|
3730
|
+
...safeAreaPlatform,
|
|
3731
|
+
...options.platform,
|
|
3732
|
+
[CLIPPING_RECT_CACHE]: new Map(),
|
|
3733
|
+
},
|
|
3734
|
+
});
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3737
|
+
const SAFE_SPACE_MIDDLEWARE = 'post-safe-space';
|
|
3738
|
+
/**
|
|
3739
|
+
* Computes the safe space, the area the pointer can travel through to get from the reference to
|
|
3740
|
+
* the floating element.
|
|
3741
|
+
*/
|
|
3742
|
+
function safeSpace() {
|
|
3743
|
+
return {
|
|
3744
|
+
name: SAFE_SPACE_MIDDLEWARE,
|
|
3745
|
+
async fn(state) {
|
|
3746
|
+
const { placement, rects, x, y } = state;
|
|
3747
|
+
const side = getSide(placement);
|
|
3748
|
+
const reference = await getViewportRect(state, rects.reference);
|
|
3749
|
+
const floating = await getViewportRect(state, { ...rects.floating, x, y });
|
|
3750
|
+
const path = [
|
|
3751
|
+
...getPathAlongSide(floating, getOppositeSide(side)),
|
|
3752
|
+
...getPathAlongSide(reference, side),
|
|
3753
|
+
];
|
|
3754
|
+
const points = [];
|
|
3755
|
+
for (let i = 0; i < path.length; i += 2) {
|
|
3756
|
+
points.push(`${path[i]}px ${path[i + 1]}px`);
|
|
3757
|
+
}
|
|
3758
|
+
const data = { polygon: `polygon(${points.join(', ')})` };
|
|
3759
|
+
return { data };
|
|
3760
|
+
},
|
|
3761
|
+
};
|
|
3762
|
+
}
|
|
3763
|
+
/**
|
|
3764
|
+
* Converts a rectangle from the floating element's offset parent's coordinate system to viewport
|
|
3765
|
+
* coordinates.
|
|
3766
|
+
*/
|
|
3767
|
+
async function getViewportRect({ elements, platform, strategy }, rect) {
|
|
3768
|
+
const viewportRect = await platform.convertOffsetParentRelativeRectToViewportRelativeRect?.({
|
|
3769
|
+
offsetParent: await platform.getOffsetParent?.(elements.floating),
|
|
3770
|
+
rect,
|
|
3771
|
+
elements,
|
|
3772
|
+
strategy,
|
|
3698
3773
|
});
|
|
3774
|
+
return rectToClientRect(viewportRect ?? rect);
|
|
3775
|
+
}
|
|
3776
|
+
/**
|
|
3777
|
+
* Returns the path along the specified side of the given rectangle.
|
|
3778
|
+
*
|
|
3779
|
+
* The path is a list of coordinates in the form of [x₁, y₁, x₂, y₂] and is given in clockwise order.
|
|
3780
|
+
*/
|
|
3781
|
+
function getPathAlongSide(rect, side) {
|
|
3782
|
+
const self = rect[side];
|
|
3783
|
+
const prev = rect[getPreviousSide(side)];
|
|
3784
|
+
const next = rect[getNextSide(side)];
|
|
3785
|
+
return getSideAxis(side) === 'x' ? [self, prev, self, next] : [prev, self, next, self];
|
|
3699
3786
|
}
|
|
3700
3787
|
|
|
3701
3788
|
// src/events.ts
|
|
@@ -4490,78 +4577,7 @@ function apply() {
|
|
|
4490
4577
|
injectStyles(document);
|
|
4491
4578
|
}
|
|
4492
4579
|
|
|
4493
|
-
|
|
4494
|
-
* This utility is covered by the end-to-end tests under 'clipping' in `popovercontainer.cy.ts`.
|
|
4495
|
-
*/
|
|
4496
|
-
const CLIPPING_RECT_CACHE = Symbol('Clipping Rect Cache');
|
|
4497
|
-
/**
|
|
4498
|
-
* A custom floating UI platform that restricts clipping rectangles to the safe area.
|
|
4499
|
-
*/
|
|
4500
|
-
const safeAreaPlatform = { ...platform, getClippingRect };
|
|
4501
|
-
/**
|
|
4502
|
-
* Computes the clipping rectangle of an element while accounting for the safe area.
|
|
4503
|
-
*/
|
|
4504
|
-
async function getClippingRect(...args) {
|
|
4505
|
-
const element = args[0].element;
|
|
4506
|
-
// Check whether the clipping rectangle of the given element has already been computed during
|
|
4507
|
-
// this pass.
|
|
4508
|
-
const hit = this[CLIPPING_RECT_CACHE].get(element);
|
|
4509
|
-
if (hit)
|
|
4510
|
-
return hit;
|
|
4511
|
-
// Compute the clipping rectangle with the Floating UI DOM platform, then restrict it to the safe
|
|
4512
|
-
// area.
|
|
4513
|
-
const clippingRect = await platform.getClippingRect.apply(this, args);
|
|
4514
|
-
applySafeArea(clippingRect, element);
|
|
4515
|
-
this[CLIPPING_RECT_CACHE].set(element, clippingRect);
|
|
4516
|
-
return clippingRect;
|
|
4517
|
-
}
|
|
4518
|
-
/**
|
|
4519
|
-
* Restricts the `clippingRect` computed for `element` to the safe area, modifying it in place.
|
|
4520
|
-
*
|
|
4521
|
-
* The safe area only applies to elements that the header can actually cover, which excludes
|
|
4522
|
-
* elements without a header on their page, elements on a top layer and elements within the header.
|
|
4523
|
-
*/
|
|
4524
|
-
function applySafeArea(clippingRect, element) {
|
|
4525
|
-
const headerElement = element.ownerDocument.querySelector('post-header');
|
|
4526
|
-
if (headerElement === null)
|
|
4527
|
-
return;
|
|
4528
|
-
let parent = element;
|
|
4529
|
-
while (!isLastTraversableNode(parent)) {
|
|
4530
|
-
parent = getParentNode(parent);
|
|
4531
|
-
if (!isHTMLElement(parent))
|
|
4532
|
-
continue;
|
|
4533
|
-
// Do not apply the safe area of the header to
|
|
4534
|
-
// - elements that are on a top layer, such as a dialog.
|
|
4535
|
-
// - elements that are located within the header itself.
|
|
4536
|
-
if (isTopLayer(parent) || parent === headerElement)
|
|
4537
|
-
return;
|
|
4538
|
-
}
|
|
4539
|
-
const headerRect = headerElement.getBoundingClientRect();
|
|
4540
|
-
const top = Math.max(clippingRect.y, headerRect.bottom);
|
|
4541
|
-
clippingRect.height -= top - clippingRect.y;
|
|
4542
|
-
clippingRect.y = top;
|
|
4543
|
-
}
|
|
4544
|
-
/**
|
|
4545
|
-
* Computes the coordinates that will position the `floating` element next to a given `reference`
|
|
4546
|
-
* element while accounting for the safe area.
|
|
4547
|
-
*
|
|
4548
|
-
* The safe area is the part of the viewport that the header does not cover. Restricting the
|
|
4549
|
-
* clipping rectangles to it makes floating elements behave as if they were clipped by the header.
|
|
4550
|
-
*/
|
|
4551
|
-
const computePositionWithSafeArea = (reference, floating, options) => {
|
|
4552
|
-
// Adapted from https://github.com/floating-ui/floating-ui/blob/27629b74ba36ab8ceb2a968051927b9b69511a3b/packages/dom/src/index.ts#L15
|
|
4553
|
-
options ??= {};
|
|
4554
|
-
return computePosition(reference, floating, {
|
|
4555
|
-
...options,
|
|
4556
|
-
platform: {
|
|
4557
|
-
...safeAreaPlatform,
|
|
4558
|
-
...options.platform,
|
|
4559
|
-
[CLIPPING_RECT_CACHE]: new Map(),
|
|
4560
|
-
},
|
|
4561
|
-
});
|
|
4562
|
-
};
|
|
4563
|
-
|
|
4564
|
-
const postPopovercontainerCss = () => `@layer polyfill{@supports not selector(:popover-open){:host([popover]:not(.\\:popover-open)){display:none}}}:host{background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:host>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;position:relative}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host>div{border:2px solid rgba(0,0,0,0)}}:host [part=post-popovercontainer-border-mask]{display:none;position:absolute;inset:0;border-radius:4px;pointer-events:none}:host .arrow{--post-popovercontainer-arrow-border: var(--post-popovercontainer-arrow-border-width, 0px) solid var(--post-popovercontainer-arrow-border-color, transparent);position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:host .arrow[dynamic-placement=top]{border-bottom-right-radius:2px;border-bottom:var(--post-popovercontainer-arrow-border);border-right:var(--post-popovercontainer-arrow-border)}:host .arrow[dynamic-placement=right]{border-bottom-left-radius:2px;border-bottom:var(--post-popovercontainer-arrow-border);border-left:var(--post-popovercontainer-arrow-border)}:host .arrow[dynamic-placement=bottom]{border-top-left-radius:2px;border-top:var(--post-popovercontainer-arrow-border);border-left:var(--post-popovercontainer-arrow-border)}:host .arrow[dynamic-placement=left]{border-top-right-radius:2px;border-top:var(--post-popovercontainer-arrow-border);border-right:var(--post-popovercontainer-arrow-border)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .arrow[dynamic-placement=top]{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);bottom:-0.3796735336rem !important}:host .arrow[dynamic-placement=left]{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);right:-0.3796735336rem !important}:host .arrow[dynamic-placement=right]{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);left:-0.3796735336rem !important}:host .arrow[dynamic-placement=bottom]{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);top:-0.3796735336rem !important}}:host([tooltip]){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:host([safe-space])::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:auto}:host([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)))}:host([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)))}:host(:not(:has(.arrow)))>div{box-shadow:var(--post-device-elevation-300)}:host(: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))}:host(:has(.arrow[dynamic-placement=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))}:host(:has(.arrow[dynamic-placement=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))}:host(:has(.arrow[dynamic-placement=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))}`;
|
|
4580
|
+
const postPopovercontainerCss = () => `@layer polyfill{@supports not selector(:popover-open){:host([popover]:not(.\\:popover-open)){display:none}}}:host{background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:host [part=post-popovercontainer-content]{box-sizing:border-box;box-shadow:var(--post-device-elevation-300);width:max-content;max-width:var(--post-popovercontainer-available-width);max-height:var(--post-popovercontainer-available-height);color:var(--post-current-fg);background-color:var(--post-current-bg);border-radius:4px;position:relative;display:flex}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host [part=post-popovercontainer-content]{border:2px solid rgba(0,0,0,0)}}:host [part=post-popovercontainer-border-mask]{display:none;position:absolute;inset:0;border-radius:4px;pointer-events:none}:host .arrow{--post-popovercontainer-arrow-border: var(--post-popovercontainer-arrow-border-width, 0px) solid var(--post-popovercontainer-arrow-border-color, transparent);position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:host .arrow[data-side=top]{border-bottom-right-radius:2px;border-bottom:var(--post-popovercontainer-arrow-border);border-right:var(--post-popovercontainer-arrow-border)}:host .arrow[data-side=right]{border-bottom-left-radius:2px;border-bottom:var(--post-popovercontainer-arrow-border);border-left:var(--post-popovercontainer-arrow-border)}:host .arrow[data-side=bottom]{border-top-left-radius:2px;border-top:var(--post-popovercontainer-arrow-border);border-left:var(--post-popovercontainer-arrow-border)}:host .arrow[data-side=left]{border-top-right-radius:2px;border-top:var(--post-popovercontainer-arrow-border);border-right:var(--post-popovercontainer-arrow-border)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .arrow[data-side=top]{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);bottom:-0.3796735336rem !important}:host .arrow[data-side=left]{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);right:-0.3796735336rem !important}:host .arrow[data-side=right]{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);left:-0.3796735336rem !important}:host .arrow[data-side=bottom]{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);top:-0.3796735336rem !important}}:host([tooltip]){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:host([safe-space])::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:auto;clip-path:var(--post-popovercontainer-safe-space, polygon(0 0, 0 0, 0 0))}:host(:not(:has(.arrow)))>div{box-shadow:var(--post-device-elevation-300)}:host(: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))}:host(:has(.arrow[data-side=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))}:host(:has(.arrow[data-side=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))}:host(:has(.arrow[data-side=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))}`;
|
|
4565
4581
|
|
|
4566
4582
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4567
4583
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4573,34 +4589,10 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
4573
4589
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4574
4590
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4575
4591
|
};
|
|
4576
|
-
const
|
|
4577
|
-
|
|
4578
|
-
|
|
4592
|
+
const AVAILABLE_WIDTH_PROPERTY = '--post-popovercontainer-available-width';
|
|
4593
|
+
const AVAILABLE_HEIGHT_PROPERTY = '--post-popovercontainer-available-height';
|
|
4594
|
+
const SAFE_SPACE_PROPERTY = '--post-popovercontainer-safe-space';
|
|
4579
4595
|
const PostPopovercontainer = class {
|
|
4580
|
-
static {
|
|
4581
|
-
this.STATIC_SIDES = {
|
|
4582
|
-
top: 'bottom',
|
|
4583
|
-
right: 'left',
|
|
4584
|
-
bottom: 'top',
|
|
4585
|
-
left: 'right',
|
|
4586
|
-
};
|
|
4587
|
-
}
|
|
4588
|
-
static {
|
|
4589
|
-
this.PROPERTIES_TO_CLEAR = [
|
|
4590
|
-
'--post-safe-space-popover-x',
|
|
4591
|
-
'--post-safe-space-popover-y',
|
|
4592
|
-
'--post-safe-space-popover-x-start',
|
|
4593
|
-
'--post-safe-space-popover-x-end',
|
|
4594
|
-
'--post-safe-space-popover-y-start',
|
|
4595
|
-
'--post-safe-space-popover-y-end',
|
|
4596
|
-
'--post-safe-space-trigger-x',
|
|
4597
|
-
'--post-safe-space-trigger-y',
|
|
4598
|
-
'--post-safe-space-trigger-x-start',
|
|
4599
|
-
'--post-safe-space-trigger-x-end',
|
|
4600
|
-
'--post-safe-space-trigger-y-start',
|
|
4601
|
-
'--post-safe-space-trigger-y-end',
|
|
4602
|
-
];
|
|
4603
|
-
}
|
|
4604
4596
|
constructor(hostRef) {
|
|
4605
4597
|
registerInstance(this, hostRef);
|
|
4606
4598
|
this.postBeforeShow = createEvent(this, "postBeforeShow");
|
|
@@ -4608,37 +4600,25 @@ const PostPopovercontainer = class {
|
|
|
4608
4600
|
this.postHide = createEvent(this, "postHide");
|
|
4609
4601
|
this.postBeforeToggle = createEvent(this, "postBeforeToggle");
|
|
4610
4602
|
this.postToggle = createEvent(this, "postToggle");
|
|
4603
|
+
/** The element the popover is anchored to */
|
|
4604
|
+
this.anchorRef = null;
|
|
4605
|
+
this.arrowRef = null;
|
|
4606
|
+
this.hasBeenOpened = false;
|
|
4611
4607
|
this.toggleTimeoutId = null;
|
|
4612
|
-
this.
|
|
4608
|
+
this.runningAnimation = null;
|
|
4609
|
+
this.stopAutoUpdate = null;
|
|
4613
4610
|
/**
|
|
4614
|
-
*
|
|
4615
|
-
* Popovercontainers are automatically flipped to the opposite side if there is not enough available space and are shifted
|
|
4616
|
-
* towards the viewport if they would overlap edge boundaries.
|
|
4611
|
+
* Placement of the popover according to the floating-ui options.
|
|
4617
4612
|
*/
|
|
4618
4613
|
this.placement = 'top';
|
|
4619
4614
|
/**
|
|
4620
|
-
* Gap between the edge of the
|
|
4615
|
+
* Gap between the edge of the viewport and the popover.
|
|
4621
4616
|
*/
|
|
4622
4617
|
this.edgeGap = 8;
|
|
4623
4618
|
/**
|
|
4624
|
-
*
|
|
4619
|
+
* Show a little indicator arrow
|
|
4625
4620
|
*/
|
|
4626
4621
|
this.arrow = false;
|
|
4627
|
-
/**
|
|
4628
|
-
* Animation style
|
|
4629
|
-
*/
|
|
4630
|
-
this.animation = 'pop-in';
|
|
4631
|
-
this.currentAnimation = null;
|
|
4632
|
-
this.boundMouseTrackingHandler = this.mouseTrackingHandler.bind(this);
|
|
4633
|
-
}
|
|
4634
|
-
/**
|
|
4635
|
-
* Updates cursor position for safe space feature when popover is open.
|
|
4636
|
-
* Sets CSS custom properties for dynamic styling of safe area.
|
|
4637
|
-
* @param event MouseEvent with cursor position
|
|
4638
|
-
*/
|
|
4639
|
-
mouseTrackingHandler(event) {
|
|
4640
|
-
this.host.style.setProperty('--post-safe-space-cursor-x', `${event.clientX}px`);
|
|
4641
|
-
this.host.style.setProperty('--post-safe-space-cursor-y', `${event.clientY}px`);
|
|
4642
4622
|
}
|
|
4643
4623
|
connectedCallback() {
|
|
4644
4624
|
if (!isSupported()) {
|
|
@@ -4649,296 +4629,197 @@ const PostPopovercontainer = class {
|
|
|
4649
4629
|
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
4650
4630
|
}
|
|
4651
4631
|
disconnectedCallback() {
|
|
4652
|
-
|
|
4653
|
-
this.clearAutoUpdate();
|
|
4654
|
-
}
|
|
4632
|
+
this.cleanup();
|
|
4655
4633
|
this.host.removeEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
4656
4634
|
}
|
|
4635
|
+
cleanup() {
|
|
4636
|
+
this.stopAutoUpdate?.();
|
|
4637
|
+
if (this.runningAnimation) {
|
|
4638
|
+
this.runningAnimation.cancel();
|
|
4639
|
+
this.runningAnimation = null;
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
isOpen() {
|
|
4643
|
+
return this.host?.matches(':where(:popover-open, .popover-open)');
|
|
4644
|
+
}
|
|
4645
|
+
getContent() {
|
|
4646
|
+
return this.host?.shadowRoot.querySelector('[part="post-popovercontainer-content"]');
|
|
4647
|
+
}
|
|
4648
|
+
getContentMinSize() {
|
|
4649
|
+
const content = this.getContent();
|
|
4650
|
+
if (!content)
|
|
4651
|
+
return {};
|
|
4652
|
+
const { minWidth, minHeight } = getComputedStyle(content);
|
|
4653
|
+
return {
|
|
4654
|
+
width: Number.parseFloat(minWidth) || 0,
|
|
4655
|
+
height: Number.parseFloat(minHeight) || 0,
|
|
4656
|
+
};
|
|
4657
|
+
}
|
|
4657
4658
|
/**
|
|
4658
|
-
*
|
|
4659
|
-
* @param
|
|
4659
|
+
* Shows the popover.
|
|
4660
|
+
* @param anchor the element that the popover is visually anchored to.
|
|
4660
4661
|
*/
|
|
4661
|
-
async show(
|
|
4662
|
-
if (this.toggleTimeoutId || !
|
|
4662
|
+
async show(anchor) {
|
|
4663
|
+
if (this.toggleTimeoutId || !anchor || this.isOpen())
|
|
4663
4664
|
return;
|
|
4664
|
-
this.
|
|
4665
|
-
this.updatePosition();
|
|
4665
|
+
this.anchorRef = anchor;
|
|
4666
4666
|
this.host.showPopover();
|
|
4667
4667
|
}
|
|
4668
4668
|
/**
|
|
4669
|
-
*
|
|
4669
|
+
* Hides the popover.
|
|
4670
4670
|
*/
|
|
4671
4671
|
async hide() {
|
|
4672
|
-
if (!this.
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4672
|
+
if (this.toggleTimeoutId || !this.isOpen())
|
|
4673
|
+
return;
|
|
4674
|
+
this.anchorRef = null;
|
|
4675
|
+
this.host.hidePopover();
|
|
4676
|
+
this.postHide.emit();
|
|
4677
4677
|
}
|
|
4678
4678
|
/**
|
|
4679
|
-
*
|
|
4680
|
-
*
|
|
4681
|
-
*
|
|
4679
|
+
* Toggles the popover's state from hidden to showing and vice versa.
|
|
4680
|
+
*
|
|
4681
|
+
* If `state` is specified, the popover is forced to be shown if the is set to `true`, or hidden
|
|
4682
|
+
* if it is set to `false`.
|
|
4683
|
+
*
|
|
4684
|
+
* @param anchor the element that the popover is visually anchored to.
|
|
4685
|
+
* @param force the next state of the popover.
|
|
4686
|
+
* @returns the new state of the popover: `true` if it is shown, `false` if it is hidden.
|
|
4682
4687
|
*/
|
|
4683
|
-
async toggle(
|
|
4684
|
-
const isOpen = this.
|
|
4685
|
-
|
|
4686
|
-
if (willOpen && !target)
|
|
4688
|
+
async toggle(anchor, force) {
|
|
4689
|
+
const isOpen = this.isOpen();
|
|
4690
|
+
if (!this.host || this.toggleTimeoutId)
|
|
4687
4691
|
return isOpen;
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
return this.host.matches(':where(:popover-open, .popover-open)');
|
|
4692
|
+
const shouldOpen = force === true || (force === undefined && !isOpen);
|
|
4693
|
+
if (isOpen === shouldOpen || (shouldOpen && !anchor))
|
|
4694
|
+
return isOpen;
|
|
4695
|
+
this.anchorRef = shouldOpen ? anchor : null;
|
|
4696
|
+
this.host.togglePopover(force);
|
|
4697
|
+
this.toggleTimeoutId = null;
|
|
4698
|
+
return this.isOpen();
|
|
4696
4699
|
}
|
|
4697
4700
|
/**
|
|
4698
|
-
* Handles the popover
|
|
4701
|
+
* Handles the popover's state transition from hidden to showing and vice versa.
|
|
4699
4702
|
*/
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
if (typeof animationFn === 'function') {
|
|
4707
|
-
this.runOpenAnimation(animationFn, content);
|
|
4708
|
-
}
|
|
4709
|
-
else {
|
|
4710
|
-
// No animation case
|
|
4711
|
-
this.postBeforeToggle.emit({ willOpen: true });
|
|
4712
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
4713
|
-
this.postToggle.emit({ isOpen: true });
|
|
4714
|
-
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
4715
|
-
if (this.hasOpenedOnce)
|
|
4716
|
-
this.hasOpenedOnce = false;
|
|
4717
|
-
}
|
|
4718
|
-
}
|
|
4719
|
-
if (this.safeSpace) {
|
|
4720
|
-
globalThis.addEventListener('mousemove', this.boundMouseTrackingHandler);
|
|
4721
|
-
}
|
|
4703
|
+
async handleToggle(event) {
|
|
4704
|
+
this.toggleTimeoutId = globalThis.setTimeout(() => (this.toggleTimeoutId = null), 10);
|
|
4705
|
+
if (event.newState === 'open')
|
|
4706
|
+
await this.handleOpen();
|
|
4707
|
+
else
|
|
4708
|
+
await this.handleClose();
|
|
4722
4709
|
}
|
|
4723
4710
|
/**
|
|
4724
|
-
* Handles the popover
|
|
4711
|
+
* Handles the popover's state transition from hidden to showing, emitting related events.
|
|
4725
4712
|
*/
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4713
|
+
async handleOpen() {
|
|
4714
|
+
this.postBeforeToggle.emit({ willOpen: true });
|
|
4715
|
+
this.postBeforeShow.emit({ first: !this.hasBeenOpened });
|
|
4716
|
+
await this.updatePosition(true);
|
|
4717
|
+
this.startAutoUpdate();
|
|
4718
|
+
try {
|
|
4719
|
+
await this.runOpenAnimation();
|
|
4732
4720
|
}
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
this.currentAnimation.cancel();
|
|
4736
|
-
this.currentAnimation = null;
|
|
4721
|
+
catch {
|
|
4722
|
+
return;
|
|
4737
4723
|
}
|
|
4738
|
-
this.
|
|
4739
|
-
this.
|
|
4740
|
-
this.
|
|
4724
|
+
this.postToggle.emit({ isOpen: true });
|
|
4725
|
+
this.postShow.emit({ first: !this.hasBeenOpened });
|
|
4726
|
+
this.hasBeenOpened = true;
|
|
4741
4727
|
}
|
|
4742
4728
|
/**
|
|
4743
|
-
*
|
|
4729
|
+
* Run the open animation for the popover.
|
|
4744
4730
|
*/
|
|
4745
|
-
async runOpenAnimation(
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
this.postBeforeToggle.emit({ willOpen: true });
|
|
4752
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
4753
|
-
this.postToggle.emit({ isOpen: true });
|
|
4754
|
-
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
4755
|
-
return;
|
|
4756
|
-
}
|
|
4757
|
-
this.currentAnimation = animation;
|
|
4758
|
-
if (animation.playState === 'running') {
|
|
4759
|
-
this.postBeforeToggle.emit({ willOpen: true });
|
|
4760
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
4761
|
-
}
|
|
4762
|
-
await animation.finished;
|
|
4763
|
-
this.postToggle.emit({ isOpen: true });
|
|
4764
|
-
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
4765
|
-
this.hasOpenedOnce = true;
|
|
4766
|
-
}
|
|
4767
|
-
catch (err) {
|
|
4768
|
-
console.warn('Animation failed or was interrupted:', err);
|
|
4769
|
-
// Reset all states to closing
|
|
4770
|
-
this.postBeforeToggle.emit({ willOpen: false });
|
|
4771
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
4772
|
-
this.postToggle.emit({ isOpen: false });
|
|
4773
|
-
}
|
|
4774
|
-
finally {
|
|
4775
|
-
if (this.currentAnimation === animation) {
|
|
4776
|
-
this.currentAnimation = null;
|
|
4777
|
-
}
|
|
4778
|
-
}
|
|
4731
|
+
async runOpenAnimation() {
|
|
4732
|
+
const content = this.getContent();
|
|
4733
|
+
if (!content)
|
|
4734
|
+
return;
|
|
4735
|
+
this.runningAnimation = popIn(content);
|
|
4736
|
+
await this.runningAnimation.finished;
|
|
4779
4737
|
}
|
|
4780
4738
|
/**
|
|
4781
|
-
*
|
|
4782
|
-
* Popovercontainers can be closed or opened with other methods than class members,
|
|
4783
|
-
* therefore listening to the toggle event is safer for cleaning up.
|
|
4784
|
-
* @param e ToggleEvent
|
|
4739
|
+
* Handles the popover's state transition from showing to hidden, emitting related events.
|
|
4785
4740
|
*/
|
|
4786
|
-
|
|
4787
|
-
this.
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
}
|
|
4741
|
+
async handleClose() {
|
|
4742
|
+
this.postBeforeToggle.emit({ willOpen: false });
|
|
4743
|
+
this.cleanup();
|
|
4744
|
+
this.host.style.removeProperty(AVAILABLE_WIDTH_PROPERTY);
|
|
4745
|
+
this.host.style.removeProperty(AVAILABLE_HEIGHT_PROPERTY);
|
|
4746
|
+
this.host.style.removeProperty(SAFE_SPACE_PROPERTY);
|
|
4747
|
+
this.postToggle.emit({ isOpen: false });
|
|
4748
|
+
this.postHide.emit();
|
|
4795
4749
|
}
|
|
4796
4750
|
/**
|
|
4797
|
-
*
|
|
4798
|
-
* an influence on popovercontainer positioning
|
|
4751
|
+
* Listen for changes that affect the popover's position and update it accordingly.
|
|
4799
4752
|
*/
|
|
4800
|
-
|
|
4801
|
-
if (!this.
|
|
4753
|
+
startAutoUpdate() {
|
|
4754
|
+
if (!this.host || !this.anchorRef)
|
|
4802
4755
|
return;
|
|
4803
|
-
this.
|
|
4756
|
+
this.stopAutoUpdate = autoUpdate(this.anchorRef, this.host, () => this.updatePosition(this.autoResize));
|
|
4804
4757
|
}
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4758
|
+
/**
|
|
4759
|
+
* Updates the position of the popover based on the anchor's position and the specified placement.
|
|
4760
|
+
* @param withSize whether to resize the popover based on the available space.
|
|
4761
|
+
*/
|
|
4762
|
+
async updatePosition(withSize = false) {
|
|
4763
|
+
const { x, y, middlewareData, placement } = await this.computePosition(withSize);
|
|
4764
|
+
// Hide the popover if the anchor is outside the scrollport.
|
|
4808
4765
|
if (middlewareData.hide?.referenceHidden) {
|
|
4809
4766
|
this.host.hidePopover();
|
|
4767
|
+
return;
|
|
4810
4768
|
}
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
// Position popover
|
|
4769
|
+
this.side = getSide(placement);
|
|
4770
|
+
// Position the popover.
|
|
4814
4771
|
this.host.style.left = `${x}px`;
|
|
4815
4772
|
this.host.style.top = `${y}px`;
|
|
4816
|
-
// Position
|
|
4817
|
-
if (
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
const halfSide = -0.5 * arrowSizePx;
|
|
4822
|
-
if (staticSide) {
|
|
4823
|
-
Object.assign(this.arrowRef.style, {
|
|
4824
|
-
left: arrowX ? `${arrowX}px` : '',
|
|
4825
|
-
top: arrowY ? `${arrowY}px` : '',
|
|
4826
|
-
[staticSide]: `${halfSide}px`,
|
|
4827
|
-
});
|
|
4828
|
-
}
|
|
4773
|
+
// Position the indicator arrow.
|
|
4774
|
+
if (middlewareData.arrow) {
|
|
4775
|
+
this.arrowRef.style.left = middlewareData.arrow.x ? `${middlewareData.arrow.x}px` : '';
|
|
4776
|
+
this.arrowRef.style.top = middlewareData.arrow.y ? `${middlewareData.arrow.y}px` : '';
|
|
4777
|
+
this.arrowRef.style[getOppositeSide(this.side)] = `-${this.arrowRef.offsetWidth / 2}px`;
|
|
4829
4778
|
}
|
|
4830
|
-
//
|
|
4831
|
-
if (
|
|
4832
|
-
|
|
4779
|
+
// Set the safe space polygon.
|
|
4780
|
+
if (middlewareData[SAFE_SPACE_MIDDLEWARE]) {
|
|
4781
|
+
this.host.style.setProperty(SAFE_SPACE_PROPERTY, middlewareData[SAFE_SPACE_MIDDLEWARE].polygon);
|
|
4833
4782
|
}
|
|
4834
4783
|
}
|
|
4835
|
-
async
|
|
4836
|
-
const
|
|
4837
|
-
const isAligned = (this.placement || 'top').includes('-');
|
|
4838
|
-
const flipMiddleware = [
|
|
4839
|
-
// Flip the popover if the target moves outside the viewport
|
|
4840
|
-
flip({ elementContext: 'reference', crossAxis: false }),
|
|
4841
|
-
// Flip the popover if the popover itself moves outside the viewport
|
|
4842
|
-
flip({ elementContext: 'floating', crossAxis: false }),
|
|
4843
|
-
];
|
|
4844
|
-
const shiftMiddleware = shift({
|
|
4845
|
-
padding: gap,
|
|
4846
|
-
limiter: limitShift({
|
|
4847
|
-
offset: 32,
|
|
4848
|
-
}),
|
|
4849
|
-
});
|
|
4784
|
+
async computePosition(withSize) {
|
|
4785
|
+
const padding = this.edgeGap ?? 0;
|
|
4850
4786
|
const middleware = [
|
|
4851
|
-
offset(this.offset ?? (this.arrow ?
|
|
4787
|
+
offset(this.offset ?? (this.arrow ? padding + 4 : padding)),
|
|
4852
4788
|
inline(),
|
|
4853
|
-
// Per floating-ui docs: for aligned placements (e.g. bottom-end),
|
|
4854
|
-
// flip should come before shift. For non-aligned, shift before flip.
|
|
4855
|
-
...(isAligned ? [...flipMiddleware, shiftMiddleware] : [shiftMiddleware, ...flipMiddleware]),
|
|
4856
|
-
size({
|
|
4857
|
-
apply({ availableWidth, elements }) {
|
|
4858
|
-
Object.assign(elements.floating.style, {
|
|
4859
|
-
maxWidth: `${availableWidth - gap * 2}px`,
|
|
4860
|
-
});
|
|
4861
|
-
},
|
|
4862
|
-
}),
|
|
4863
4789
|
];
|
|
4864
|
-
|
|
4865
|
-
|
|
4790
|
+
const flipMiddleware = flip({ padding, minSize: this.getContentMinSize() });
|
|
4791
|
+
const shiftMiddleware = shift({ limiter: limitShift({ offset: 32 }), padding });
|
|
4792
|
+
// `flip` should come before `shift` for edge-aligned placements
|
|
4793
|
+
// (see https://floating-ui.com/docs/flip#combining-with-shift).
|
|
4794
|
+
if (this.placement?.includes('-'))
|
|
4795
|
+
middleware.push(flipMiddleware, shiftMiddleware);
|
|
4796
|
+
else
|
|
4797
|
+
middleware.push(shiftMiddleware, flipMiddleware);
|
|
4798
|
+
if (withSize) {
|
|
4799
|
+
middleware.push(size({
|
|
4800
|
+
padding,
|
|
4801
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
4802
|
+
elements.floating.style.setProperty(AVAILABLE_WIDTH_PROPERTY, `${Math.max(0, availableWidth)}px`);
|
|
4803
|
+
elements.floating.style.setProperty(AVAILABLE_HEIGHT_PROPERTY, `${Math.max(0, availableHeight)}px`);
|
|
4804
|
+
},
|
|
4805
|
+
}));
|
|
4866
4806
|
}
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4807
|
+
if (this.arrow)
|
|
4808
|
+
middleware.push(arrow({ element: this.arrowRef, padding }));
|
|
4809
|
+
if (this.safeSpace)
|
|
4810
|
+
middleware.push(safeSpace());
|
|
4811
|
+
// `hide` should generally be placed at the end of the middleware chain
|
|
4812
|
+
// (see https://floating-ui.com/docs/hide#order).
|
|
4813
|
+
if (this.autoHide)
|
|
4870
4814
|
middleware.push(hide({ strategy: 'referenceHidden' }));
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
placement: this.placement || 'top',
|
|
4815
|
+
return computePositionWithSafeArea(this.anchorRef, this.host, {
|
|
4816
|
+
placement: this.placement ?? 'top',
|
|
4874
4817
|
strategy: 'fixed',
|
|
4875
4818
|
middleware,
|
|
4876
4819
|
});
|
|
4877
4820
|
}
|
|
4878
|
-
async updateSafeSpaceBoundaries(currentPlacement) {
|
|
4879
|
-
const targetRect = this.eventTarget.getBoundingClientRect();
|
|
4880
|
-
const popoverRect = this.host.getBoundingClientRect();
|
|
4881
|
-
const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
|
|
4882
|
-
// Helper function to get positioning data based on placement
|
|
4883
|
-
const getPositioningData = (placement, popoverRect, targetRect) => {
|
|
4884
|
-
if (placement === 'top' || placement === 'bottom') {
|
|
4885
|
-
return {
|
|
4886
|
-
popover: {
|
|
4887
|
-
y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
|
|
4888
|
-
xStart: popoverRect.left,
|
|
4889
|
-
xEnd: popoverRect.right,
|
|
4890
|
-
},
|
|
4891
|
-
trigger: {
|
|
4892
|
-
y: placement === 'top' ? targetRect.top : targetRect.bottom,
|
|
4893
|
-
xStart: targetRect.left,
|
|
4894
|
-
xEnd: targetRect.right,
|
|
4895
|
-
},
|
|
4896
|
-
};
|
|
4897
|
-
}
|
|
4898
|
-
else {
|
|
4899
|
-
// left or right
|
|
4900
|
-
return {
|
|
4901
|
-
popover: {
|
|
4902
|
-
x: placement === 'left' ? popoverRect.right : popoverRect.left,
|
|
4903
|
-
yStart: popoverRect.top,
|
|
4904
|
-
yEnd: popoverRect.bottom,
|
|
4905
|
-
},
|
|
4906
|
-
trigger: {
|
|
4907
|
-
x: placement === 'left' ? targetRect.left : targetRect.right,
|
|
4908
|
-
yStart: targetRect.top,
|
|
4909
|
-
yEnd: targetRect.bottom,
|
|
4910
|
-
},
|
|
4911
|
-
};
|
|
4912
|
-
}
|
|
4913
|
-
};
|
|
4914
|
-
const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
|
|
4915
|
-
// Clear previous values
|
|
4916
|
-
PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
|
|
4917
|
-
this.host.style.removeProperty(prop);
|
|
4918
|
-
});
|
|
4919
|
-
if (isVertical) {
|
|
4920
|
-
// For top/bottom placement
|
|
4921
|
-
this.host.style.setProperty('--post-safe-space-popover-y', `${posData.popover.y}px`);
|
|
4922
|
-
this.host.style.setProperty('--post-safe-space-popover-x-start', `${posData.popover.xStart}px`);
|
|
4923
|
-
this.host.style.setProperty('--post-safe-space-popover-x-end', `${posData.popover.xEnd}px`);
|
|
4924
|
-
this.host.style.setProperty('--post-safe-space-trigger-y', `${posData.trigger.y}px`);
|
|
4925
|
-
this.host.style.setProperty('--post-safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
|
|
4926
|
-
this.host.style.setProperty('--post-safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
|
|
4927
|
-
}
|
|
4928
|
-
else {
|
|
4929
|
-
// For left/right placement
|
|
4930
|
-
this.host.style.setProperty('--post-safe-space-popover-x', `${posData.popover.x}px`);
|
|
4931
|
-
this.host.style.setProperty('--post-safe-space-popover-y-start', `${posData.popover.yStart}px`);
|
|
4932
|
-
this.host.style.setProperty('--post-safe-space-popover-y-end', `${posData.popover.yEnd}px`);
|
|
4933
|
-
this.host.style.setProperty('--post-safe-space-trigger-x', `${posData.trigger.x}px`);
|
|
4934
|
-
this.host.style.setProperty('--post-safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
|
|
4935
|
-
this.host.style.setProperty('--post-safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
|
|
4936
|
-
}
|
|
4937
|
-
}
|
|
4938
4821
|
render() {
|
|
4939
|
-
return (h(Host, { key: '
|
|
4940
|
-
this.arrowRef = el;
|
|
4941
|
-
} })), h("span", { key: 'deadbcc5892ed545a64b4a0e5e0936e0dd1feb70', part: "post-popovercontainer-border-mask" }), h("slot", { key: '48c4db7ab222f3ef18157ce19d8ba15d75441f98' }))));
|
|
4822
|
+
return (h(Host, { key: 'd48b21174f74b790f8a72b4294e9f741c3b64d14', "data-version": version, popover: "auto" }, h("div", { key: '455e84294ecb36e25cc62582eb6c41058f24f6bc', part: "post-popovercontainer-content" }, this.arrow && (h("span", { key: '9d11f2596443876123eeaf5a02430d049c1c8b25', "data-side": this.side, class: "arrow", ref: el => (this.arrowRef = el) })), h("span", { key: 'a562460cdfa5539e7d9c23f1d044a2c045df5b9f', part: "post-popovercontainer-border-mask" }), h("slot", { key: '5aa546bbdf6c70e2a0afabf818d421581060f8a7' }))));
|
|
4942
4823
|
}
|
|
4943
4824
|
get host() { return getElement(this); }
|
|
4944
4825
|
};
|
|
@@ -4948,9 +4829,6 @@ __decorate([
|
|
|
4948
4829
|
__decorate([
|
|
4949
4830
|
Type('number')
|
|
4950
4831
|
], PostPopovercontainer.prototype, "edgeGap", void 0);
|
|
4951
|
-
__decorate([
|
|
4952
|
-
OneOf(['triangle', 'trapezoid'])
|
|
4953
|
-
], PostPopovercontainer.prototype, "safeSpace", void 0);
|
|
4954
4832
|
PostPopovercontainer.style = postPopovercontainerCss();
|
|
4955
4833
|
|
|
4956
4834
|
const postTogglebuttonCss = () => `:host{cursor:pointer;outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}`;
|