@shortfuse/materialdesignweb 0.8.0 → 0.9.1
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/README.md +50 -198
- package/bin/mdw-css.js +1 -1
- package/components/Badge.js +15 -5
- package/components/Body.js +7 -0
- package/components/BottomAppBar.js +7 -10
- package/components/BottomSheet.js +472 -0
- package/components/Box.js +11 -49
- package/components/Button.js +81 -82
- package/components/Card.js +74 -62
- package/components/Checkbox.js +15 -25
- package/components/CheckboxIcon.js +19 -31
- package/components/Chip.js +18 -13
- package/components/Dialog.js +70 -100
- package/components/DialogActions.js +4 -0
- package/components/Display.js +64 -0
- package/components/Divider.js +5 -0
- package/components/Fab.js +94 -17
- package/components/FabContainer.js +57 -0
- package/components/FilterChip.js +43 -32
- package/components/Grid.js +187 -0
- package/components/Headline.js +9 -28
- package/components/Icon.js +80 -71
- package/components/IconButton.js +77 -120
- package/components/Input.js +745 -86
- package/components/InputChip.js +193 -0
- package/components/Label.js +7 -0
- package/components/List.js +11 -5
- package/components/ListItem.js +92 -23
- package/components/ListOption.js +143 -65
- package/components/Listbox.js +57 -17
- package/components/Menu.js +39 -27
- package/components/MenuItem.js +49 -36
- package/components/NavBar.js +66 -21
- package/components/NavBarItem.js +5 -0
- package/components/NavDrawer.js +33 -16
- package/components/NavDrawerItem.js +7 -4
- package/components/NavItem.js +61 -34
- package/components/NavRail.js +32 -21
- package/components/NavRailItem.js +10 -2
- package/components/Page.js +119 -0
- package/components/Pane.js +24 -0
- package/components/Popup.js +23 -8
- package/components/Progress.js +25 -5
- package/components/Radio.js +8 -7
- package/components/RadioIcon.js +24 -15
- package/components/Ripple.js +25 -7
- package/components/Root.js +225 -0
- package/components/Scrim.js +95 -0
- package/components/Search.js +30 -25
- package/components/SegmentedButton.js +53 -40
- package/components/SegmentedButtonGroup.js +15 -12
- package/components/Select.js +19 -10
- package/components/Shape.js +10 -66
- package/components/SideSheet.js +337 -0
- package/components/Slider.js +93 -36
- package/components/Snackbar.js +52 -20
- package/components/SnackbarContainer.js +51 -0
- package/components/Surface.js +20 -10
- package/components/Switch.js +21 -18
- package/components/SwitchIcon.js +62 -33
- package/components/Tab.js +78 -38
- package/components/TabContent.js +33 -12
- package/components/TabList.js +95 -34
- package/components/TabPanel.js +10 -1
- package/components/Table.js +151 -0
- package/components/TextArea.js +48 -16
- package/components/Title.js +8 -9
- package/components/Tooltip.js +51 -22
- package/components/TopAppBar.js +71 -78
- package/constants/shapes.js +36 -0
- package/constants/typography.js +127 -0
- package/core/Composition.js +391 -201
- package/core/CompositionAdapter.js +35 -18
- package/core/CustomElement.js +634 -254
- package/core/css.js +117 -12
- package/core/customTypes.js +161 -49
- package/core/dom.js +18 -11
- package/core/jsonMergePatch.js +27 -11
- package/core/observe.js +308 -256
- package/core/optimizations.js +9 -9
- package/core/template.js +14 -57
- package/dist/CustomElement.min.js +2 -0
- package/dist/CustomElement.min.js.map +7 -0
- package/dist/core/CustomElement.min.js +2 -0
- package/dist/core/CustomElement.min.js.map +7 -0
- package/dist/index.min.js +85 -115
- package/dist/index.min.js.map +4 -4
- package/dist/meta.json +1 -1
- package/dom/HTMLOptionsCollectionProxy.js +108 -0
- package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
- package/loaders/theme.js +12 -0
- package/mixins/AriaReflectorMixin.js +64 -15
- package/mixins/AriaToolbarMixin.js +6 -0
- package/mixins/ControlMixin.js +79 -33
- package/mixins/DelegatesFocusMixin.js +62 -0
- package/mixins/DensityMixin.js +7 -3
- package/mixins/ElevationMixin.js +61 -0
- package/mixins/FlexableMixin.js +87 -39
- package/mixins/FormAssociatedMixin.js +76 -10
- package/mixins/HyperlinkMixin.js +76 -0
- package/mixins/InputMixin.js +227 -32
- package/mixins/KeyboardNavMixin.js +11 -7
- package/mixins/NavigationListenerMixin.js +33 -0
- package/mixins/PopupMixin.js +216 -219
- package/mixins/RTLObserverMixin.js +2 -0
- package/mixins/ResizeObserverMixin.js +18 -4
- package/mixins/RippleMixin.js +11 -7
- package/mixins/ScrollListenerMixin.js +14 -2
- package/mixins/SemiStickyMixin.js +51 -98
- package/mixins/ShapeMaskedMixin.js +125 -0
- package/mixins/ShapeMixin.js +30 -203
- package/mixins/StateMixin.js +74 -34
- package/mixins/TextFieldMixin.js +128 -145
- package/mixins/ThemableMixin.js +57 -56
- package/mixins/TooltipTriggerMixin.js +305 -359
- package/mixins/TouchTargetMixin.js +5 -2
- package/mixins/TypographyMixin.js +128 -0
- package/package.json +125 -81
- package/services/rtl.js +10 -0
- package/services/svgAlias.js +17 -0
- package/{theming/index.js → services/theme.js} +25 -176
- package/types/bin/mdw-css.d.ts +3 -0
- package/types/bin/mdw-css.d.ts.map +1 -0
- package/types/components/Badge.d.ts +39 -0
- package/types/components/Badge.d.ts.map +1 -0
- package/types/components/Body.d.ts +29 -0
- package/types/components/Body.d.ts.map +1 -0
- package/types/components/BottomAppBar.d.ts +72 -0
- package/types/components/BottomAppBar.d.ts.map +1 -0
- package/types/components/BottomSheet.d.ts +135 -0
- package/types/components/BottomSheet.d.ts.map +1 -0
- package/types/components/Box.d.ts +16 -0
- package/types/components/Box.d.ts.map +1 -0
- package/types/components/Button.d.ts +245 -0
- package/types/components/Button.d.ts.map +1 -0
- package/types/components/Card.d.ts +147 -0
- package/types/components/Card.d.ts.map +1 -0
- package/types/components/Checkbox.d.ts +207 -0
- package/types/components/Checkbox.d.ts.map +1 -0
- package/types/components/CheckboxIcon.d.ts +44 -0
- package/types/components/CheckboxIcon.d.ts.map +1 -0
- package/types/components/Chip.d.ts +248 -0
- package/types/components/Chip.d.ts.map +1 -0
- package/types/components/Dialog.d.ts +103 -0
- package/types/components/Dialog.d.ts.map +1 -0
- package/types/components/DialogActions.d.ts +4 -0
- package/types/components/DialogActions.d.ts.map +1 -0
- package/types/components/Display.d.ts +46 -0
- package/types/components/Display.d.ts.map +1 -0
- package/types/components/Divider.d.ts +10 -0
- package/types/components/Divider.d.ts.map +1 -0
- package/types/components/Fab.d.ts +273 -0
- package/types/components/Fab.d.ts.map +1 -0
- package/types/components/FabContainer.d.ts +10 -0
- package/types/components/FabContainer.d.ts.map +1 -0
- package/types/components/FilterChip.d.ts +256 -0
- package/types/components/FilterChip.d.ts.map +1 -0
- package/types/components/Grid.d.ts +38 -0
- package/types/components/Grid.d.ts.map +1 -0
- package/types/components/Headline.d.ts +46 -0
- package/types/components/Headline.d.ts.map +1 -0
- package/types/components/Icon.d.ts +55 -0
- package/types/components/Icon.d.ts.map +1 -0
- package/types/components/IconButton.d.ts +284 -0
- package/types/components/IconButton.d.ts.map +1 -0
- package/types/components/Input.d.ts +2528 -0
- package/types/components/Input.d.ts.map +1 -0
- package/types/components/InputChip.d.ts +85 -0
- package/types/components/InputChip.d.ts.map +1 -0
- package/types/components/Label.d.ts +29 -0
- package/types/components/Label.d.ts.map +1 -0
- package/types/components/List.d.ts +35 -0
- package/types/components/List.d.ts.map +1 -0
- package/types/components/ListItem.d.ts +124 -0
- package/types/components/ListItem.d.ts.map +1 -0
- package/types/components/ListOption.d.ts +158 -0
- package/types/components/ListOption.d.ts.map +1 -0
- package/types/components/Listbox.d.ts +763 -0
- package/types/components/Listbox.d.ts.map +1 -0
- package/types/components/Menu.d.ts +130 -0
- package/types/components/Menu.d.ts.map +1 -0
- package/types/components/MenuItem.d.ts +232 -0
- package/types/components/MenuItem.d.ts.map +1 -0
- package/types/components/NavBar.d.ts +20 -0
- package/types/components/NavBar.d.ts.map +1 -0
- package/types/components/NavBarItem.d.ts +97 -0
- package/types/components/NavBarItem.d.ts.map +1 -0
- package/types/components/NavDrawer.d.ts +107 -0
- package/types/components/NavDrawer.d.ts.map +1 -0
- package/types/components/NavDrawerItem.d.ts +97 -0
- package/types/components/NavDrawerItem.d.ts.map +1 -0
- package/types/components/NavItem.d.ts +99 -0
- package/types/components/NavItem.d.ts.map +1 -0
- package/types/components/NavRail.d.ts +108 -0
- package/types/components/NavRail.d.ts.map +1 -0
- package/types/components/NavRailItem.d.ts +97 -0
- package/types/components/NavRailItem.d.ts.map +1 -0
- package/types/components/Page.d.ts +25 -0
- package/types/components/Page.d.ts.map +1 -0
- package/types/components/Pane.d.ts +44 -0
- package/types/components/Pane.d.ts.map +1 -0
- package/types/components/Popup.d.ts +78 -0
- package/types/components/Popup.d.ts.map +1 -0
- package/types/components/Progress.d.ts +21 -0
- package/types/components/Progress.d.ts.map +1 -0
- package/types/components/Radio.d.ts +201 -0
- package/types/components/Radio.d.ts.map +1 -0
- package/types/components/RadioIcon.d.ts +46 -0
- package/types/components/RadioIcon.d.ts.map +1 -0
- package/types/components/Ripple.d.ts +35 -0
- package/types/components/Ripple.d.ts.map +1 -0
- package/types/components/Root.d.ts +68 -0
- package/types/components/Root.d.ts.map +1 -0
- package/types/components/Scrim.d.ts +6 -0
- package/types/components/Scrim.d.ts.map +1 -0
- package/types/components/Search.d.ts +516 -0
- package/types/components/Search.d.ts.map +1 -0
- package/types/components/SegmentedButton.d.ts +252 -0
- package/types/components/SegmentedButton.d.ts.map +1 -0
- package/types/components/SegmentedButtonGroup.d.ts +43 -0
- package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
- package/types/components/Select.d.ts +158 -0
- package/types/components/Select.d.ts.map +1 -0
- package/types/components/Shape.d.ts +10 -0
- package/types/components/Shape.d.ts.map +1 -0
- package/types/components/SideSheet.d.ts +111 -0
- package/types/components/SideSheet.d.ts.map +1 -0
- package/types/components/Slider.d.ts +203 -0
- package/types/components/Slider.d.ts.map +1 -0
- package/types/components/Snackbar.d.ts +73 -0
- package/types/components/Snackbar.d.ts.map +1 -0
- package/types/components/SnackbarContainer.d.ts +6 -0
- package/types/components/SnackbarContainer.d.ts.map +1 -0
- package/types/components/Surface.d.ts +45 -0
- package/types/components/Surface.d.ts.map +1 -0
- package/types/components/Switch.d.ts +187 -0
- package/types/components/Switch.d.ts.map +1 -0
- package/types/components/SwitchIcon.d.ts +61 -0
- package/types/components/SwitchIcon.d.ts.map +1 -0
- package/types/components/Tab.d.ts +139 -0
- package/types/components/Tab.d.ts.map +1 -0
- package/types/components/TabContent.d.ts +124 -0
- package/types/components/TabContent.d.ts.map +1 -0
- package/types/components/TabList.d.ts +1111 -0
- package/types/components/TabList.d.ts.map +1 -0
- package/types/components/TabPanel.d.ts +28 -0
- package/types/components/TabPanel.d.ts.map +1 -0
- package/types/components/Table.d.ts +25 -0
- package/types/components/Table.d.ts.map +1 -0
- package/types/components/TextArea.d.ts +201 -0
- package/types/components/TextArea.d.ts.map +1 -0
- package/types/components/Title.d.ts +46 -0
- package/types/components/Title.d.ts.map +1 -0
- package/types/components/Tooltip.d.ts +49 -0
- package/types/components/Tooltip.d.ts.map +1 -0
- package/types/components/TopAppBar.d.ts +129 -0
- package/types/components/TopAppBar.d.ts.map +1 -0
- package/types/constants/colorKeywords.d.ts +2 -0
- package/types/constants/colorKeywords.d.ts.map +1 -0
- package/types/constants/shapes.d.ts +38 -0
- package/types/constants/shapes.d.ts.map +1 -0
- package/types/constants/typography.d.ts +212 -0
- package/types/constants/typography.d.ts.map +1 -0
- package/types/core/Composition.d.ts +260 -0
- package/types/core/Composition.d.ts.map +1 -0
- package/types/core/CompositionAdapter.d.ts +114 -0
- package/types/core/CompositionAdapter.d.ts.map +1 -0
- package/types/core/CustomElement.d.ts +304 -0
- package/types/core/CustomElement.d.ts.map +1 -0
- package/types/core/css.d.ts +44 -0
- package/types/core/css.d.ts.map +1 -0
- package/types/core/customTypes.d.ts +22 -0
- package/types/core/customTypes.d.ts.map +1 -0
- package/types/core/dom.d.ts +32 -0
- package/types/core/dom.d.ts.map +1 -0
- package/types/core/jsonMergePatch.d.ts +31 -0
- package/types/core/jsonMergePatch.d.ts.map +1 -0
- package/types/core/observe.d.ts +114 -0
- package/types/core/observe.d.ts.map +1 -0
- package/types/core/optimizations.d.ts +7 -0
- package/types/core/optimizations.d.ts.map +1 -0
- package/types/core/template.d.ts +47 -0
- package/types/core/template.d.ts.map +1 -0
- package/types/core/uid.d.ts +6 -0
- package/types/core/uid.d.ts.map +1 -0
- package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
- package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
- package/types/index.d.ts +88 -0
- package/types/index.d.ts.map +1 -0
- package/types/loaders/palette.d.ts +2 -0
- package/types/loaders/palette.d.ts.map +1 -0
- package/types/loaders/theme.d.ts +2 -0
- package/types/loaders/theme.d.ts.map +1 -0
- package/types/mixins/AriaReflectorMixin.d.ts +31 -0
- package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
- package/types/mixins/AriaToolbarMixin.d.ts +34 -0
- package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
- package/types/mixins/ControlMixin.d.ts +124 -0
- package/types/mixins/ControlMixin.d.ts.map +1 -0
- package/types/mixins/DelegatesFocusMixin.d.ts +13 -0
- package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
- package/types/mixins/DensityMixin.d.ts +8 -0
- package/types/mixins/DensityMixin.d.ts.map +1 -0
- package/types/mixins/ElevationMixin.d.ts +32 -0
- package/types/mixins/ElevationMixin.d.ts.map +1 -0
- package/types/mixins/FlexableMixin.d.ts +14 -0
- package/types/mixins/FlexableMixin.d.ts.map +1 -0
- package/types/mixins/FormAssociatedMixin.d.ts +123 -0
- package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
- package/types/mixins/HyperlinkMixin.d.ts +25 -0
- package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
- package/types/mixins/InputMixin.d.ts +173 -0
- package/types/mixins/InputMixin.d.ts.map +1 -0
- package/types/mixins/KeyboardNavMixin.d.ts +46 -0
- package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
- package/types/mixins/NavigationListenerMixin.d.ts +8 -0
- package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
- package/types/mixins/PopupMixin.d.ts +98 -0
- package/types/mixins/PopupMixin.d.ts.map +1 -0
- package/types/mixins/RTLObserverMixin.d.ts +8 -0
- package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
- package/types/mixins/ResizeObserverMixin.d.ts +13 -0
- package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
- package/types/mixins/RippleMixin.d.ts +94 -0
- package/types/mixins/RippleMixin.d.ts.map +1 -0
- package/types/mixins/ScrollListenerMixin.d.ts +46 -0
- package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
- package/types/mixins/SemiStickyMixin.d.ts +50 -0
- package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMaskedMixin.d.ts +12 -0
- package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMixin.d.ts +39 -0
- package/types/mixins/ShapeMixin.d.ts.map +1 -0
- package/types/mixins/StateMixin.d.ts +29 -0
- package/types/mixins/StateMixin.d.ts.map +1 -0
- package/types/mixins/TextFieldMixin.d.ts +153 -0
- package/types/mixins/TextFieldMixin.d.ts.map +1 -0
- package/types/mixins/ThemableMixin.d.ts +10 -0
- package/types/mixins/ThemableMixin.d.ts.map +1 -0
- package/types/mixins/TooltipTriggerMixin.d.ts +114 -0
- package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
- package/types/mixins/TouchTargetMixin.d.ts +6 -0
- package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
- package/types/mixins/TypographyMixin.d.ts +20 -0
- package/types/mixins/TypographyMixin.d.ts.map +1 -0
- package/types/services/rtl.d.ts +3 -0
- package/types/services/rtl.d.ts.map +1 -0
- package/types/services/svgAlias.d.ts +13 -0
- package/types/services/svgAlias.d.ts.map +1 -0
- package/types/services/theme.d.ts +45 -0
- package/types/services/theme.d.ts.map +1 -0
- package/types/utils/cli.d.ts +3 -0
- package/types/utils/cli.d.ts.map +1 -0
- package/types/utils/function.d.ts +3 -0
- package/types/utils/function.d.ts.map +1 -0
- package/types/utils/jsx-runtime.d.ts +20 -0
- package/types/utils/jsx-runtime.d.ts.map +1 -0
- package/types/utils/material-color/blend.d.ts +34 -0
- package/types/utils/material-color/blend.d.ts.map +1 -0
- package/types/utils/material-color/hct/Cam16.d.ts +142 -0
- package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
- package/types/utils/material-color/hct/Hct.d.ts +93 -0
- package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
- package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
- package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
- package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
- package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
- package/types/utils/material-color/helper.d.ts +8 -0
- package/types/utils/material-color/helper.d.ts.map +1 -0
- package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
- package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
- package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
- package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
- package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
- package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
- package/types/utils/material-color/utils/color.d.ts +172 -0
- package/types/utils/material-color/utils/color.d.ts.map +1 -0
- package/types/utils/material-color/utils/math.d.ts +94 -0
- package/types/utils/material-color/utils/math.d.ts.map +1 -0
- package/types/utils/pixelmatch.d.ts +22 -0
- package/types/utils/pixelmatch.d.ts.map +1 -0
- package/types/utils/popup.d.ts +106 -0
- package/types/utils/popup.d.ts.map +1 -0
- package/types/utils/searchParams.d.ts +3 -0
- package/types/utils/searchParams.d.ts.map +1 -0
- package/types/utils/svg.d.ts +7 -0
- package/types/utils/svg.d.ts.map +1 -0
- package/utils/jsx-runtime.js +9 -4
- package/utils/material-color/scheme/Scheme.js +1 -1
- package/utils/pixelmatch.js +363 -0
- package/utils/popup.js +86 -10
- package/utils/searchParams.js +22 -0
- package/components/Button.md +0 -61
- package/components/ExtendedFab.js +0 -32
- package/components/Layout.js +0 -504
- package/components/Nav.js +0 -38
- package/core/DomAdapter.js +0 -586
- package/core/ICustomElement.d.ts +0 -291
- package/core/ICustomElement.js +0 -1
- package/core/test.js +0 -126
- package/core/typings.d.ts +0 -142
- package/core/typings.js +0 -1
- package/mixins/SurfaceMixin.js +0 -127
- package/theming/loader.js +0 -22
- /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
package/mixins/PopupMixin.js
CHANGED
|
@@ -1,97 +1,25 @@
|
|
|
1
|
+
import { attemptFocus, isRtl } from '../core/dom.js';
|
|
2
|
+
import { canAnchorPopup } from '../utils/popup.js';
|
|
3
|
+
|
|
4
|
+
import DelegatesFocusMixin from './DelegatesFocusMixin.js';
|
|
5
|
+
import '../components/Scrim.js';
|
|
6
|
+
import ResizeObserverMixin from './ResizeObserverMixin.js';
|
|
7
|
+
|
|
8
|
+
const supportsHTMLDialogElement = typeof HTMLDialogElement !== 'undefined';
|
|
9
|
+
|
|
10
|
+
/** @typedef {import('../utils/popup.js').DOMRectLike} DOMRectLike */
|
|
11
|
+
|
|
1
12
|
/**
|
|
2
13
|
* @typedef {Object} PopupStack
|
|
3
|
-
* @prop {
|
|
4
|
-
* @prop {
|
|
14
|
+
* @prop {InstanceType<ReturnType<typeof PopupMixin>>} element
|
|
15
|
+
* @prop {HTMLElement} previousFocus
|
|
5
16
|
* @prop {boolean} [centered=false]
|
|
6
17
|
* @prop {Record<string, any>} [state]
|
|
7
18
|
* @prop {Record<string, any>} [previousState]
|
|
8
|
-
* @prop {MouseEvent|PointerEvent|HTMLElement|Element} [originalEvent]
|
|
9
19
|
* @prop {any} [pendingResizeOperation]
|
|
10
20
|
* @prop {window['history']['scrollRestoration']} [scrollRestoration]
|
|
11
21
|
*/
|
|
12
22
|
|
|
13
|
-
import CustomElement from '../core/CustomElement.js';
|
|
14
|
-
import { attemptFocus } from '../core/dom.js';
|
|
15
|
-
import { canAnchorPopup } from '../utils/popup.js';
|
|
16
|
-
|
|
17
|
-
CustomElement
|
|
18
|
-
.extend()
|
|
19
|
-
.observe({
|
|
20
|
-
hidden: 'boolean',
|
|
21
|
-
})
|
|
22
|
-
.html`<div id=scroll-blocker></div>`
|
|
23
|
-
.css`
|
|
24
|
-
:host {
|
|
25
|
-
position: fixed;
|
|
26
|
-
inset: 0;
|
|
27
|
-
|
|
28
|
-
display: block;
|
|
29
|
-
overflow: overlay;
|
|
30
|
-
|
|
31
|
-
overscroll-behavior: none;
|
|
32
|
-
overscroll-behavior: contain;
|
|
33
|
-
scrollbar-color: transparent transparent;
|
|
34
|
-
scrollbar-width: thin;
|
|
35
|
-
|
|
36
|
-
opacity: 0;
|
|
37
|
-
|
|
38
|
-
z-index: 23;
|
|
39
|
-
|
|
40
|
-
background-color: rgb(var(--mdw-color__scrim));
|
|
41
|
-
|
|
42
|
-
animation: fade-in 200ms forwards ease-out;
|
|
43
|
-
|
|
44
|
-
will-change: opacity;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:host([hidden]) {
|
|
48
|
-
animation-name: fade-out;
|
|
49
|
-
animation-timing-function: ease-in;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:host([invisible]) {
|
|
53
|
-
background: transparent;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
#scroll-blocker {
|
|
57
|
-
position: absolute;
|
|
58
|
-
top: 0;
|
|
59
|
-
left: 0;
|
|
60
|
-
|
|
61
|
-
display: block;
|
|
62
|
-
|
|
63
|
-
height: 200%;
|
|
64
|
-
width: 200%;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@keyframes fade-in {
|
|
68
|
-
from {
|
|
69
|
-
opacity: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
to {
|
|
73
|
-
opacity: 0.38;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
@keyframes fade-out {
|
|
78
|
-
from {
|
|
79
|
-
opacity: 0.38;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
to {
|
|
83
|
-
opacity: 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`
|
|
87
|
-
.events({
|
|
88
|
-
animationend() {
|
|
89
|
-
if (this.hidden) this.remove();
|
|
90
|
-
},
|
|
91
|
-
})
|
|
92
|
-
.autoRegister('mdw-scrim');
|
|
93
|
-
|
|
94
|
-
const supportsHTMLDialogElement = typeof HTMLDialogElement !== 'undefined';
|
|
95
23
|
/** @type {PopupStack[]} */
|
|
96
24
|
const OPEN_POPUPS = [];
|
|
97
25
|
|
|
@@ -99,17 +27,20 @@ const OPEN_POPUPS = [];
|
|
|
99
27
|
* @return {void}
|
|
100
28
|
*/
|
|
101
29
|
function onWindowResize() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
30
|
+
// Fire in popup order
|
|
31
|
+
for (const { element } of OPEN_POPUPS) {
|
|
32
|
+
element.updatePopupPosition();
|
|
105
33
|
}
|
|
106
|
-
|
|
107
|
-
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Prevent focus being given to elements via mouse nav back
|
|
38
|
+
* @param {MouseEvent} event
|
|
39
|
+
*/
|
|
40
|
+
function onNavMouseDown(event) {
|
|
41
|
+
if (event.button === 3) {
|
|
42
|
+
event.preventDefault();
|
|
108
43
|
}
|
|
109
|
-
lastOpenPopup.pendingResizeOperation = requestAnimationFrame(() => {
|
|
110
|
-
lastOpenPopup.element.updatePopupPosition(lastOpenPopup.originalEvent);
|
|
111
|
-
lastOpenPopup.pendingResizeOperation = null;
|
|
112
|
-
});
|
|
113
44
|
}
|
|
114
45
|
|
|
115
46
|
/**
|
|
@@ -141,78 +72,101 @@ function onBeforeUnload(event) {
|
|
|
141
72
|
}
|
|
142
73
|
|
|
143
74
|
/**
|
|
75
|
+
* Provides positioning, modal behavior, and history-aware popup/dialog support.
|
|
144
76
|
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
145
77
|
*/
|
|
146
78
|
export default function PopupMixin(Base) {
|
|
147
79
|
return Base
|
|
80
|
+
.mixin(DelegatesFocusMixin)
|
|
81
|
+
.mixin(ResizeObserverMixin)
|
|
148
82
|
.observe({
|
|
83
|
+
/** Whether the popup is currently open */
|
|
149
84
|
open: 'boolean',
|
|
85
|
+
/** When true the popup behaves as a blocking modal */
|
|
150
86
|
modal: 'boolean',
|
|
151
|
-
|
|
87
|
+
/** Use the native HTMLDialogElement when available */
|
|
88
|
+
native: 'boolean',
|
|
89
|
+
/** Allow internal content to scroll when true */
|
|
152
90
|
scrollable: 'boolean',
|
|
91
|
+
/** When true, match the popup width to the source element */
|
|
153
92
|
matchSourceWidth: 'boolean',
|
|
93
|
+
/** Internal: current resolved flow used for positioning */
|
|
154
94
|
_currentFlow: 'string',
|
|
155
95
|
flow: {
|
|
156
96
|
type: 'string',
|
|
157
97
|
/** @type {'corner'|'adjacent'|'overflow'|'vcenter'|'hcenter'|'center'} */
|
|
158
98
|
value: null,
|
|
159
99
|
},
|
|
100
|
+
/** Margin between popup and viewport/anchor (px) */
|
|
101
|
+
popupMargin: 'float',
|
|
160
102
|
})
|
|
161
103
|
.set({
|
|
104
|
+
/** Whether to push/pop history entries when opening the popup */
|
|
105
|
+
useHistory: true,
|
|
106
|
+
/** Optional return value for dialog-like popups */
|
|
162
107
|
returnValue: '',
|
|
163
|
-
|
|
108
|
+
/** Internal: true while closing is in-progress */
|
|
164
109
|
_closing: false,
|
|
110
|
+
/** Internal: whether to show a scrim (overlay) for modal popups */
|
|
165
111
|
_useScrim: false,
|
|
112
|
+
/**
|
|
113
|
+
* Source that triggered the popup
|
|
114
|
+
* @type {MouseEvent|PointerEvent|HTMLElement|Event}
|
|
115
|
+
*/
|
|
116
|
+
_source: null,
|
|
117
|
+
/**
|
|
118
|
+
* Anchor used for positioning
|
|
119
|
+
* @type {MouseEvent|PointerEvent|HTMLElement|Event}
|
|
120
|
+
*/
|
|
121
|
+
_anchor: null,
|
|
166
122
|
})
|
|
167
123
|
.define({
|
|
168
124
|
_dialog() {
|
|
169
125
|
return /** @type {HTMLDialogElement} */ (this.refs.dialog);
|
|
170
126
|
},
|
|
171
127
|
})
|
|
128
|
+
.expressions({
|
|
129
|
+
_ariaHidden({ open }) {
|
|
130
|
+
return (open ? 'false' : 'true');
|
|
131
|
+
},
|
|
132
|
+
})
|
|
172
133
|
.methods({
|
|
173
134
|
/**
|
|
174
|
-
* @param {
|
|
135
|
+
* @param {DOMRectLike|Element} [anchor]
|
|
175
136
|
* @return {void}
|
|
176
137
|
*/
|
|
177
|
-
updatePopupPosition(anchor) {
|
|
138
|
+
updatePopupPosition(anchor = this._anchor) {
|
|
178
139
|
const flow = this._currentFlow ?? this.flow;
|
|
179
|
-
this.style
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
this.
|
|
189
|
-
|
|
190
|
-
const layoutElement = this._isNativeModal ? this._dialog : this;
|
|
191
|
-
layoutElement.style.setProperty('width', 'auto');
|
|
192
|
-
layoutElement.style.setProperty('height', 'auto');
|
|
140
|
+
Object.assign(this.style, {
|
|
141
|
+
top: '0',
|
|
142
|
+
left: '0',
|
|
143
|
+
right: 'auto',
|
|
144
|
+
bottom: 'auto',
|
|
145
|
+
maxWidth: null,
|
|
146
|
+
maxHeight: null,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const layoutElement = this.native ? this._dialog : this;
|
|
150
|
+
Object.assign(layoutElement.style, { width: 'auto', height: 'auto' });
|
|
193
151
|
|
|
194
152
|
const width = (anchor && this.matchSourceWidth)
|
|
195
|
-
? anchor.clientWidth
|
|
153
|
+
? /** @type {Element} */ (anchor).clientWidth
|
|
196
154
|
: 56 * Math.ceil(layoutElement.clientWidth / 56);
|
|
197
155
|
|
|
198
|
-
|
|
156
|
+
layoutElement.style.setProperty('width', `${width}px`);
|
|
199
157
|
|
|
200
158
|
const height = layoutElement.clientHeight;
|
|
201
|
-
layoutElement.style
|
|
202
|
-
layoutElement.style.removeProperty('height');
|
|
159
|
+
Object.assign(layoutElement.style, { height: null });
|
|
203
160
|
|
|
204
|
-
const initialRect = this.getBoundingClientRect();
|
|
205
161
|
/** @type {import('../utils/popup.js').CanAnchorPopUpOptions} */
|
|
206
162
|
const anchorOptions = {
|
|
207
|
-
anchor
|
|
208
|
-
? this.getBoundingClientRect()
|
|
209
|
-
: (anchor instanceof Element ? anchor.getBoundingClientRect() : anchor),
|
|
163
|
+
anchor,
|
|
210
164
|
width,
|
|
211
165
|
height,
|
|
212
|
-
margin:
|
|
166
|
+
margin: this.popupMargin ?? (window.innerWidth < 648 ? 16 : 24),
|
|
213
167
|
};
|
|
214
168
|
|
|
215
|
-
const isPageRTL = (
|
|
169
|
+
const isPageRTL = isRtl(this);
|
|
216
170
|
const xStart = isPageRTL ? 'right' : 'left';
|
|
217
171
|
const xEnd = isPageRTL ? 'left' : 'right';
|
|
218
172
|
|
|
@@ -272,8 +226,7 @@ export default function PopupMixin(Base) {
|
|
|
272
226
|
* - Open from center 9i █·
|
|
273
227
|
*/
|
|
274
228
|
|
|
275
|
-
/** @type {import('../utils/popup.js').CanAnchorPopUpOptions[]} */
|
|
276
|
-
const preferences = [
|
|
229
|
+
const preferences = /** @type {import('../utils/popup.js').CanAnchorPopUpOptions[]} */ ([
|
|
277
230
|
((flow ?? 'corner') === 'corner') ? [
|
|
278
231
|
{ clientY: 'bottom', clientX: xStart },
|
|
279
232
|
{ clientY: 'bottom', clientX: xEnd },
|
|
@@ -303,7 +256,7 @@ export default function PopupMixin(Base) {
|
|
|
303
256
|
((flow ?? 'center') === 'center') ? [
|
|
304
257
|
{ clientY: 'center', clientX: 'center', directionX: 'center', directionY: 'center' },
|
|
305
258
|
] : [],
|
|
306
|
-
].flat();
|
|
259
|
+
].flat());
|
|
307
260
|
|
|
308
261
|
let anchorResult;
|
|
309
262
|
for (const preference of preferences) {
|
|
@@ -317,16 +270,18 @@ export default function PopupMixin(Base) {
|
|
|
317
270
|
if (result.visibility === 1) break;
|
|
318
271
|
}
|
|
319
272
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
273
|
+
let { maxWidth, maxHeight } = anchorResult.styles;
|
|
274
|
+
if (maxWidth || maxHeight) {
|
|
275
|
+
const styles = window.getComputedStyle(this);
|
|
276
|
+
if (styles.maxWidth) {
|
|
277
|
+
maxWidth = `min(${maxWidth}, ${styles.maxWidth})`;
|
|
278
|
+
}
|
|
279
|
+
if (styles.maxHeight) {
|
|
280
|
+
maxHeight = `min(${maxHeight}, ${styles.maxHeight})`;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
Object.assign(this.style, { ...anchorResult.styles, maxWidth, maxHeight });
|
|
284
|
+
// this.scrollIntoView();
|
|
330
285
|
},
|
|
331
286
|
/**
|
|
332
287
|
* @param {Event & {currentTarget: HTMLSlotElement}} event
|
|
@@ -348,19 +303,27 @@ export default function PopupMixin(Base) {
|
|
|
348
303
|
showPopup(source, focus = true, flow = null) {
|
|
349
304
|
if (this.open) return false;
|
|
350
305
|
this.open = true;
|
|
306
|
+
this._source = source;
|
|
307
|
+
this._anchor = source;
|
|
351
308
|
|
|
352
|
-
|
|
309
|
+
const { scrim } = this.refs;
|
|
353
310
|
if (this._useScrim) {
|
|
354
|
-
|
|
355
|
-
|
|
311
|
+
if (this.native) {
|
|
312
|
+
document.body.append(scrim);
|
|
313
|
+
} else {
|
|
314
|
+
this.before(scrim);
|
|
315
|
+
}
|
|
316
|
+
scrim.hidden = false;
|
|
356
317
|
} else {
|
|
357
|
-
|
|
318
|
+
scrim.remove();
|
|
358
319
|
}
|
|
359
320
|
|
|
360
|
-
const previousFocus = source instanceof HTMLElement
|
|
321
|
+
const previousFocus = source instanceof HTMLElement
|
|
322
|
+
? source
|
|
323
|
+
: /** @type {HTMLElement} */(document.activeElement);
|
|
361
324
|
|
|
362
|
-
if (supportsHTMLDialogElement && focus
|
|
363
|
-
|
|
325
|
+
if (supportsHTMLDialogElement && focus // Calling show will force focus which is not intended for non-modals
|
|
326
|
+
&& !this._dialog.open) {
|
|
364
327
|
this._dialog.show();
|
|
365
328
|
}
|
|
366
329
|
|
|
@@ -368,41 +331,50 @@ export default function PopupMixin(Base) {
|
|
|
368
331
|
|
|
369
332
|
// Short first, then move
|
|
370
333
|
// Native modals can fail update bounds on Chrome
|
|
334
|
+
// @ts-ignore `updatePopupPosition` has runtime check
|
|
371
335
|
this.updatePopupPosition(source);
|
|
372
336
|
|
|
373
|
-
|
|
374
|
-
let
|
|
337
|
+
let newState;
|
|
338
|
+
let scrollRestoration;
|
|
339
|
+
let previousState;
|
|
340
|
+
if (this.useHistory) {
|
|
341
|
+
newState = { hash: Math.random().toString(36).slice(2, 18) };
|
|
342
|
+
|
|
343
|
+
if (!window.history.state) {
|
|
344
|
+
// Create new previous state
|
|
345
|
+
window.history.replaceState({
|
|
346
|
+
hash: Math.random().toString(36).slice(2, 18),
|
|
347
|
+
}, document.title);
|
|
348
|
+
}
|
|
349
|
+
previousState = window.history.state;
|
|
350
|
+
|
|
351
|
+
scrollRestoration = window.history.scrollRestoration;
|
|
375
352
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
window.
|
|
379
|
-
|
|
380
|
-
}, document.title);
|
|
353
|
+
window.history.scrollRestoration = 'manual';
|
|
354
|
+
window.history.pushState(newState, document.title);
|
|
355
|
+
window.addEventListener('popstate', onPopState);
|
|
356
|
+
window.addEventListener('beforeunload', onBeforeUnload);
|
|
381
357
|
}
|
|
382
|
-
previousState = window.history.state;
|
|
383
358
|
|
|
384
|
-
|
|
385
|
-
window.history.scrollRestoration = 'manual';
|
|
386
|
-
window.history.pushState(newState, document.title);
|
|
387
|
-
console.debug('Popup pushed page');
|
|
388
|
-
window.addEventListener('popstate', onPopState);
|
|
389
|
-
window.addEventListener('beforeunload', onBeforeUnload);
|
|
359
|
+
window.addEventListener('mousedown', onNavMouseDown, { capture: true });
|
|
390
360
|
|
|
391
361
|
window.addEventListener('resize', onWindowResize);
|
|
392
362
|
window.addEventListener('scroll', onWindowResize);
|
|
363
|
+
if (window.visualViewport) {
|
|
364
|
+
window.visualViewport.addEventListener('resize', onWindowResize);
|
|
365
|
+
window.visualViewport.addEventListener('scroll', onWindowResize);
|
|
366
|
+
}
|
|
393
367
|
|
|
394
368
|
OPEN_POPUPS.push({
|
|
395
369
|
element: this,
|
|
396
370
|
previousFocus,
|
|
397
371
|
state: newState,
|
|
398
372
|
previousState,
|
|
399
|
-
originalEvent: source,
|
|
400
373
|
scrollRestoration,
|
|
401
374
|
});
|
|
402
375
|
|
|
403
376
|
// Overrideable
|
|
404
377
|
if (focus) {
|
|
405
|
-
console.log('focusing!');
|
|
406
378
|
this.focus();
|
|
407
379
|
}
|
|
408
380
|
|
|
@@ -419,7 +391,7 @@ export default function PopupMixin(Base) {
|
|
|
419
391
|
this.modal = true;
|
|
420
392
|
if (supportsHTMLDialogElement) {
|
|
421
393
|
this._dialog.showModal();
|
|
422
|
-
this.
|
|
394
|
+
this.native = true;
|
|
423
395
|
}
|
|
424
396
|
return this.showPopup(source, focus, flow);
|
|
425
397
|
},
|
|
@@ -445,14 +417,15 @@ export default function PopupMixin(Base) {
|
|
|
445
417
|
close(returnValue = undefined, returnFocus = true) {
|
|
446
418
|
if (!this.open) return false;
|
|
447
419
|
if (this._closing) return false;
|
|
420
|
+
this._source = null;
|
|
448
421
|
this._closing = true;
|
|
449
422
|
this.modal = false;
|
|
450
423
|
|
|
451
424
|
// SCRIM
|
|
452
425
|
this.refs.scrim.hidden = true;
|
|
453
426
|
|
|
454
|
-
if (this.
|
|
455
|
-
this.
|
|
427
|
+
if (this.native) {
|
|
428
|
+
this.native = false;
|
|
456
429
|
} else {
|
|
457
430
|
const main = document.querySelector('main');
|
|
458
431
|
if (main) {
|
|
@@ -465,7 +438,8 @@ export default function PopupMixin(Base) {
|
|
|
465
438
|
// Closing a native dialog will return focus automatically.
|
|
466
439
|
this._dialog.close();
|
|
467
440
|
if (!attemptFocus(previousFocus, { preventScroll: true })) {
|
|
468
|
-
document.activeElement
|
|
441
|
+
const currentlyFocused = /** @type {SVGElement|HTMLElement} */ (document.activeElement);
|
|
442
|
+
currentlyFocused?.blur?.();
|
|
469
443
|
}
|
|
470
444
|
} else {
|
|
471
445
|
this._dialog.returnValue = returnValue;
|
|
@@ -481,43 +455,50 @@ export default function PopupMixin(Base) {
|
|
|
481
455
|
for (let i = len - 1; i >= 0; i--) {
|
|
482
456
|
const entry = OPEN_POPUPS[i];
|
|
483
457
|
if (entry.element === this) {
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
458
|
+
if (this.useHistory) {
|
|
459
|
+
if (entry.state && window.history
|
|
460
|
+
&& window.history.state && entry.state.hash === window.history.state.hash) {
|
|
461
|
+
window.removeEventListener('popstate', onPopState);
|
|
462
|
+
window.history.back();
|
|
463
|
+
// Back does not set state immediately
|
|
464
|
+
// Needed to track submenu
|
|
465
|
+
// TODO: use window.history.go(indexDelta) instead for Safari (not Webkit) submenu support
|
|
466
|
+
window.history.replaceState(entry.previousState, document.title);
|
|
467
|
+
window.history.scrollRestoration = entry.scrollRestoration || 'auto';
|
|
468
|
+
window.addEventListener('popstate', onPopState);
|
|
469
|
+
} else {
|
|
470
|
+
console.warn('Menu state mismatch?', entry, window.history.state);
|
|
471
|
+
}
|
|
496
472
|
}
|
|
497
473
|
if (returnFocus) {
|
|
498
|
-
console.log('not returning focus');
|
|
474
|
+
// console.log('not returning focus');
|
|
499
475
|
entry.previousFocus?.focus?.({ preventScroll: true });
|
|
500
476
|
}
|
|
501
477
|
OPEN_POPUPS.splice(i, 1);
|
|
502
478
|
break;
|
|
503
479
|
} else if (this.contains(entry.element)) {
|
|
504
|
-
console.debug('Closing submenu first');
|
|
480
|
+
// console.debug('Closing submenu first');
|
|
505
481
|
entry.element.close(false);
|
|
506
|
-
console.debug('Sub menu closed. Continuing...');
|
|
482
|
+
// console.debug('Sub menu closed. Continuing...');
|
|
507
483
|
}
|
|
508
484
|
}
|
|
509
485
|
if (!OPEN_POPUPS.length) {
|
|
510
486
|
window.removeEventListener('popstate', onPopState);
|
|
511
487
|
window.removeEventListener('beforeunload', onBeforeUnload);
|
|
512
488
|
window.removeEventListener('resize', onWindowResize);
|
|
513
|
-
|
|
489
|
+
window.removeEventListener('mousedown', onNavMouseDown, { capture: true });
|
|
490
|
+
// console.debug('All menus closed');
|
|
514
491
|
}
|
|
515
492
|
this._closing = false;
|
|
516
493
|
return true;
|
|
517
494
|
},
|
|
518
495
|
})
|
|
519
|
-
|
|
520
|
-
|
|
496
|
+
|
|
497
|
+
.overrides({
|
|
498
|
+
onResizeObserved(entry) {
|
|
499
|
+
if (!this.open || this._closing) return;
|
|
500
|
+
this.updatePopupPosition();
|
|
501
|
+
},
|
|
521
502
|
})
|
|
522
503
|
.html`
|
|
523
504
|
<mdw-scrim id=scrim tabindex=-1 aria-hidden=true></mdw-scrim>
|
|
@@ -529,19 +510,25 @@ export default function PopupMixin(Base) {
|
|
|
529
510
|
.css`
|
|
530
511
|
/* https://m3.material.io/components/dialogs/specs */
|
|
531
512
|
|
|
513
|
+
:host([popover]) {
|
|
514
|
+
margin: 0;
|
|
515
|
+
border: 0;
|
|
516
|
+
padding: 0;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
:host(::backdrop) {
|
|
520
|
+
display: none;
|
|
521
|
+
}
|
|
522
|
+
|
|
532
523
|
:host {
|
|
533
524
|
--mdw-popup__expand-duration: var(--mdw-motion-expand-duration, 250ms);
|
|
534
525
|
--mdw-popup__simple-duration: var(--mdw-motion-simple-duration, 100ms);
|
|
535
526
|
--mdw-popup__standard-easing: var(--mdw-motion-standard-easing, cubic-bezier(0.4, 0.0, 0.2, 1));
|
|
536
527
|
--mdw-popup__deceleration-easing: var(--mdw-motion-deceleration-easing, cubic-bezier(0.0, 0.0, 0.2, 1));
|
|
537
528
|
--mdw-popup__fade-in-duration: var(--mdw-motion-fade-in-duration, 150ms);
|
|
538
|
-
--mdw-popup__x-offset: -50%;
|
|
539
|
-
--mdw-popup__y-offset: -50%;
|
|
540
529
|
|
|
541
530
|
--mdw-shape__size: 28px;
|
|
542
531
|
|
|
543
|
-
--mdw-surface__shadow__resting: var(--mdw-surface__shadow__3);
|
|
544
|
-
--mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
|
|
545
532
|
/* padding-inline: 12px; */
|
|
546
533
|
|
|
547
534
|
--mdw-bg: var(--mdw-color__surface);
|
|
@@ -549,10 +536,8 @@ export default function PopupMixin(Base) {
|
|
|
549
536
|
|
|
550
537
|
position: fixed;
|
|
551
538
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
555
|
-
left: 50%;
|
|
539
|
+
inset-block-start: 0;
|
|
540
|
+
inset-inline-start: 0;
|
|
556
541
|
align-self: center;
|
|
557
542
|
justify-self: center;
|
|
558
543
|
|
|
@@ -569,15 +554,14 @@ export default function PopupMixin(Base) {
|
|
|
569
554
|
inline-size: auto;
|
|
570
555
|
min-inline-size: none;
|
|
571
556
|
max-inline-size: 100vw;
|
|
572
|
-
|
|
573
|
-
|
|
557
|
+
|
|
558
|
+
outline: none; /* Older Chromium Builds */
|
|
559
|
+
|
|
574
560
|
pointer-events: none;
|
|
575
561
|
|
|
576
562
|
opacity: 0;
|
|
563
|
+
transform: scale(0);
|
|
577
564
|
|
|
578
|
-
transform: translateX(var(--mdw-popup__x-offset)) translateY(var(--mdw-popup__y-offset)) scale(0) ;
|
|
579
|
-
/* visiblity:hidden still registers events, hide from pointer with scale(0) */
|
|
580
|
-
transform-origin: top center;
|
|
581
565
|
visibility: hidden;
|
|
582
566
|
z-index: 24;
|
|
583
567
|
|
|
@@ -586,30 +570,30 @@ export default function PopupMixin(Base) {
|
|
|
586
570
|
font: var(--mdw-type__font);
|
|
587
571
|
letter-spacing: var(--mdw-type__letter-spacing);
|
|
588
572
|
|
|
589
|
-
transition-delay:
|
|
590
|
-
transition-duration:
|
|
591
|
-
transition-property: opacity, transform
|
|
573
|
+
transition-delay: 200ms, 0s;
|
|
574
|
+
transition-duration: 0s, 200ms, 200ms;
|
|
575
|
+
transition-property: visibility, opacity, transform;
|
|
592
576
|
transition-timing-function: ease-out;
|
|
593
577
|
|
|
594
|
-
will-change:
|
|
595
|
-
will-change: opacity;
|
|
578
|
+
will-change: visibility, opacity, transform;
|
|
596
579
|
|
|
597
580
|
}
|
|
598
581
|
|
|
599
582
|
:host([open]) {
|
|
600
|
-
pointer-events:
|
|
583
|
+
pointer-events: inherit;
|
|
601
584
|
|
|
602
585
|
opacity: 1;
|
|
603
586
|
|
|
604
|
-
transform:
|
|
605
|
-
visibility:
|
|
587
|
+
transform: none;
|
|
588
|
+
visibility: inherit;
|
|
606
589
|
|
|
607
590
|
transition-delay: 0s;
|
|
608
|
-
transition-duration: 0s;
|
|
609
591
|
transition-timing-function: ease-in;
|
|
610
592
|
}
|
|
611
593
|
|
|
612
|
-
|
|
594
|
+
:host([native][open]) {
|
|
595
|
+
opacity: 0;
|
|
596
|
+
}
|
|
613
597
|
|
|
614
598
|
#dialog {
|
|
615
599
|
position: static;
|
|
@@ -625,17 +609,16 @@ export default function PopupMixin(Base) {
|
|
|
625
609
|
place-items: inherit;
|
|
626
610
|
|
|
627
611
|
box-sizing: border-box;
|
|
628
|
-
|
|
629
612
|
block-size: inherit;
|
|
630
|
-
|
|
631
|
-
|
|
632
613
|
flex: inherit;
|
|
633
614
|
margin:0;
|
|
634
615
|
border: none;
|
|
635
616
|
padding: inherit;
|
|
636
617
|
padding: 0;
|
|
637
618
|
|
|
638
|
-
pointer-events:
|
|
619
|
+
pointer-events: inherit;
|
|
620
|
+
|
|
621
|
+
filter: inherit;
|
|
639
622
|
|
|
640
623
|
opacity: 1;
|
|
641
624
|
|
|
@@ -650,6 +633,16 @@ export default function PopupMixin(Base) {
|
|
|
650
633
|
|
|
651
634
|
}
|
|
652
635
|
|
|
636
|
+
:host([color]) {
|
|
637
|
+
background-color: rgb(var(--mdw-bg));
|
|
638
|
+
color: rgb(var(--mdw-ink));
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
:host(:is([color="none"],[color="transparent"])) {
|
|
642
|
+
background-color: transparent;
|
|
643
|
+
color: inherit;
|
|
644
|
+
}
|
|
645
|
+
|
|
653
646
|
:host([scrollable]) {
|
|
654
647
|
overflow-y:auto;
|
|
655
648
|
}
|
|
@@ -681,10 +674,14 @@ export default function PopupMixin(Base) {
|
|
|
681
674
|
flex: inherit;
|
|
682
675
|
padding: inherit;
|
|
683
676
|
|
|
684
|
-
pointer-events:
|
|
677
|
+
pointer-events: inherit;
|
|
685
678
|
|
|
679
|
+
filter: inherit;
|
|
686
680
|
transform: inherit;
|
|
687
681
|
visibility: inherit;
|
|
682
|
+
|
|
683
|
+
background-color: inherit;
|
|
684
|
+
border-radius: inherit;
|
|
688
685
|
}
|
|
689
686
|
|
|
690
687
|
#dialog[scrollable][open] {
|
|
@@ -697,10 +694,10 @@ export default function PopupMixin(Base) {
|
|
|
697
694
|
|
|
698
695
|
place-items: inherit;
|
|
699
696
|
|
|
700
|
-
|
|
701
|
-
max-
|
|
702
|
-
|
|
703
|
-
max-
|
|
697
|
+
block-size: 100%;
|
|
698
|
+
max-block-size: none;
|
|
699
|
+
inline-size: 100%;
|
|
700
|
+
max-inline-size: none;
|
|
704
701
|
|
|
705
702
|
flex: 1;
|
|
706
703
|
}
|
|
@@ -710,12 +707,12 @@ export default function PopupMixin(Base) {
|
|
|
710
707
|
#dialog[scrollable][open]:modal {
|
|
711
708
|
overflow:auto;
|
|
712
709
|
|
|
713
|
-
|
|
714
|
-
min-
|
|
715
|
-
max-
|
|
716
|
-
|
|
717
|
-
min-
|
|
718
|
-
max-
|
|
710
|
+
block-size:100%;
|
|
711
|
+
min-block-size: none;
|
|
712
|
+
max-block-size: inherit;
|
|
713
|
+
inline-size:100%;
|
|
714
|
+
min-inline-size: none;
|
|
715
|
+
max-inline-size: inherit;
|
|
719
716
|
flex: inherit;
|
|
720
717
|
padding: inherit;
|
|
721
718
|
}
|
|
@@ -738,7 +735,7 @@ export default function PopupMixin(Base) {
|
|
|
738
735
|
'~click'(event) {
|
|
739
736
|
// Track if click on backdrop
|
|
740
737
|
if (event.target !== event.currentTarget) return;
|
|
741
|
-
if (!this.
|
|
738
|
+
if (!this.native) return;
|
|
742
739
|
if (event.offsetX >= 0 && event.offsetX < event.currentTarget.offsetWidth
|
|
743
740
|
&& event.offsetY >= 0 && event.offsetY < event.currentTarget.offsetHeight) return;
|
|
744
741
|
const cancelEvent = new Event('cancel', { cancelable: true });
|