@shortfuse/materialdesignweb 0.8.0 → 0.9.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/README.md +32 -24
- package/bin/mdw-css.js +1 -1
- package/components/Badge.js +12 -5
- package/components/Body.js +3 -0
- package/components/BottomAppBar.js +1 -8
- package/components/BottomSheet.js +424 -0
- package/components/Box.js +11 -49
- package/components/Button.js +61 -82
- package/components/Card.js +56 -61
- package/components/Checkbox.js +7 -25
- package/components/CheckboxIcon.js +10 -28
- package/components/Chip.js +13 -11
- package/components/Dialog.js +49 -98
- package/components/Display.js +55 -0
- package/components/Fab.js +83 -17
- package/components/FabContainer.js +48 -0
- package/components/FilterChip.js +34 -32
- package/components/Grid.js +176 -0
- package/components/Headline.js +5 -28
- package/components/Icon.js +54 -69
- package/components/IconButton.js +71 -120
- package/components/Input.js +669 -83
- package/components/InputChip.js +161 -0
- package/components/Label.js +3 -0
- package/components/List.js +1 -5
- package/components/ListItem.js +39 -23
- package/components/ListOption.js +79 -62
- package/components/Listbox.js +19 -10
- package/components/Menu.js +8 -18
- package/components/MenuItem.js +25 -26
- package/components/NavBar.js +53 -19
- package/components/NavDrawer.js +15 -15
- package/components/NavDrawerItem.js +2 -4
- package/components/NavItem.js +40 -33
- package/components/NavRail.js +23 -21
- package/components/NavRailItem.js +5 -2
- package/components/Page.js +105 -0
- package/components/Pane.js +18 -0
- package/components/Popup.js +17 -8
- package/components/Radio.js +2 -5
- package/components/RadioIcon.js +10 -14
- package/components/Ripple.js +11 -7
- package/components/Root.js +209 -0
- package/components/Scrim.js +87 -0
- package/components/Search.js +12 -20
- package/components/SegmentedButton.js +33 -36
- package/components/SegmentedButtonGroup.js +9 -3
- package/components/Select.js +6 -7
- package/components/Shape.js +5 -65
- package/components/SideSheet.js +308 -0
- package/components/Slider.js +71 -34
- package/components/Snackbar.js +22 -16
- package/components/SnackbarContainer.js +42 -0
- package/components/Surface.js +15 -10
- package/components/Switch.js +3 -16
- package/components/SwitchIcon.js +40 -32
- package/components/Tab.js +57 -38
- package/components/TabContent.js +1 -0
- package/components/TabList.js +60 -32
- package/components/TabPanel.js +1 -1
- package/components/Table.js +116 -0
- package/components/TextArea.js +16 -15
- package/components/Title.js +4 -9
- package/components/Tooltip.js +43 -21
- package/components/TopAppBar.js +56 -78
- package/constants/shapes.js +36 -0
- package/constants/typography.js +127 -0
- package/core/Composition.js +354 -192
- package/core/CompositionAdapter.js +11 -12
- package/core/CustomElement.js +588 -236
- package/core/css.js +117 -12
- package/core/customTypes.js +120 -25
- package/core/dom.js +17 -11
- package/core/jsonMergePatch.js +12 -10
- package/core/observe.js +298 -253
- package/core/optimizations.js +9 -9
- package/core/template.js +14 -57
- 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 +106 -0
- package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
- package/loaders/theme.js +12 -0
- package/mixins/AriaReflectorMixin.js +53 -13
- package/mixins/AriaToolbarMixin.js +3 -0
- package/mixins/ControlMixin.js +76 -33
- package/mixins/DelegatesFocusMixin.js +54 -0
- package/mixins/DensityMixin.js +2 -2
- package/mixins/ElevationMixin.js +62 -0
- package/mixins/FlexableMixin.js +66 -37
- package/mixins/FormAssociatedMixin.js +60 -8
- package/mixins/HyperlinkMixin.js +66 -0
- package/mixins/InputMixin.js +205 -32
- package/mixins/KeyboardNavMixin.js +8 -6
- package/mixins/NavigationListenerMixin.js +33 -0
- package/mixins/PopupMixin.js +176 -208
- package/mixins/ResizeObserverMixin.js +16 -4
- package/mixins/RippleMixin.js +8 -6
- package/mixins/ScrollListenerMixin.js +1 -1
- package/mixins/SemiStickyMixin.js +44 -98
- package/mixins/ShapeMaskedMixin.js +117 -0
- package/mixins/ShapeMixin.js +22 -204
- package/mixins/StateMixin.js +70 -34
- package/mixins/TextFieldMixin.js +107 -143
- package/mixins/ThemableMixin.js +44 -56
- package/mixins/TooltipTriggerMixin.js +291 -359
- package/mixins/TouchTargetMixin.js +1 -1
- package/mixins/TypographyMixin.js +121 -0
- package/package.json +110 -74
- package/services/rtl.js +10 -0
- package/services/svgAlias.js +17 -0
- package/{theming/index.js → services/theme.js} +24 -174
- 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 +73 -0
- package/types/components/BottomAppBar.d.ts.map +1 -0
- package/types/components/BottomSheet.d.ts +109 -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 +714 -0
- package/types/components/Button.d.ts.map +1 -0
- package/types/components/Card.d.ts +412 -0
- package/types/components/Card.d.ts.map +1 -0
- package/types/components/Checkbox.d.ts +205 -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 +1425 -0
- package/types/components/Chip.d.ts.map +1 -0
- package/types/components/Dialog.d.ts +286 -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 +45 -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 +741 -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 +4283 -0
- package/types/components/FilterChip.d.ts.map +1 -0
- package/types/components/Grid.d.ts +37 -0
- package/types/components/Grid.d.ts.map +1 -0
- package/types/components/Headline.d.ts +47 -0
- package/types/components/Headline.d.ts.map +1 -0
- package/types/components/Icon.d.ts +103 -0
- package/types/components/Icon.d.ts.map +1 -0
- package/types/components/IconButton.d.ts +1486 -0
- package/types/components/IconButton.d.ts.map +1 -0
- package/types/components/Input.d.ts +51288 -0
- package/types/components/Input.d.ts.map +1 -0
- package/types/components/InputChip.d.ts +243 -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 +31 -0
- package/types/components/List.d.ts.map +1 -0
- package/types/components/ListItem.d.ts +349 -0
- package/types/components/ListItem.d.ts.map +1 -0
- package/types/components/ListOption.d.ts +1493 -0
- package/types/components/ListOption.d.ts.map +1 -0
- package/types/components/Listbox.d.ts +12012 -0
- package/types/components/Listbox.d.ts.map +1 -0
- package/types/components/Menu.d.ts +119 -0
- package/types/components/Menu.d.ts.map +1 -0
- package/types/components/MenuItem.d.ts +3109 -0
- package/types/components/MenuItem.d.ts.map +1 -0
- package/types/components/NavBar.d.ts +18 -0
- package/types/components/NavBar.d.ts.map +1 -0
- package/types/components/NavBarItem.d.ts +186 -0
- package/types/components/NavBarItem.d.ts.map +1 -0
- package/types/components/NavDrawer.d.ts +108 -0
- package/types/components/NavDrawer.d.ts.map +1 -0
- package/types/components/NavDrawerItem.d.ts +186 -0
- package/types/components/NavDrawerItem.d.ts.map +1 -0
- package/types/components/NavItem.d.ts +190 -0
- package/types/components/NavItem.d.ts.map +1 -0
- package/types/components/NavRail.d.ts +109 -0
- package/types/components/NavRail.d.ts.map +1 -0
- package/types/components/NavRailItem.d.ts +186 -0
- package/types/components/NavRailItem.d.ts.map +1 -0
- package/types/components/Page.d.ts +24 -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 +76 -0
- package/types/components/Popup.d.ts.map +1 -0
- package/types/components/Progress.d.ts +19 -0
- package/types/components/Progress.d.ts.map +1 -0
- package/types/components/Radio.d.ts +199 -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 +34 -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 +16 -0
- package/types/components/Search.d.ts.map +1 -0
- package/types/components/SegmentedButton.d.ts +718 -0
- package/types/components/SegmentedButton.d.ts.map +1 -0
- package/types/components/SegmentedButtonGroup.d.ts +44 -0
- package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
- package/types/components/Select.d.ts +1361 -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 +106 -0
- package/types/components/SideSheet.d.ts.map +1 -0
- package/types/components/Slider.d.ts +382 -0
- package/types/components/Slider.d.ts.map +1 -0
- package/types/components/Snackbar.d.ts +65 -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 +183 -0
- package/types/components/Switch.d.ts.map +1 -0
- package/types/components/SwitchIcon.d.ts +169 -0
- package/types/components/SwitchIcon.d.ts.map +1 -0
- package/types/components/Tab.d.ts +879 -0
- package/types/components/Tab.d.ts.map +1 -0
- package/types/components/TabContent.d.ts +122 -0
- package/types/components/TabContent.d.ts.map +1 -0
- package/types/components/TabList.d.ts +6266 -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 +2 -0
- package/types/components/Table.d.ts.map +1 -0
- package/types/components/TextArea.d.ts +1394 -0
- package/types/components/TextArea.d.ts.map +1 -0
- package/types/components/Title.d.ts +47 -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 +130 -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 +252 -0
- package/types/core/Composition.d.ts.map +1 -0
- package/types/core/CompositionAdapter.d.ts +92 -0
- package/types/core/CompositionAdapter.d.ts.map +1 -0
- package/types/core/CustomElement.d.ts +302 -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 +26 -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 +113 -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 +23 -0
- package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
- package/types/mixins/AriaToolbarMixin.d.ts +32 -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 +5 -0
- package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
- package/types/mixins/DensityMixin.d.ts +5 -0
- package/types/mixins/DensityMixin.d.ts.map +1 -0
- package/types/mixins/ElevationMixin.d.ts +33 -0
- package/types/mixins/ElevationMixin.d.ts.map +1 -0
- package/types/mixins/FlexableMixin.d.ts +13 -0
- package/types/mixins/FlexableMixin.d.ts.map +1 -0
- package/types/mixins/FormAssociatedMixin.d.ts +122 -0
- package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
- package/types/mixins/HyperlinkMixin.d.ts +22 -0
- package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
- package/types/mixins/InputMixin.d.ts +179 -0
- package/types/mixins/InputMixin.d.ts.map +1 -0
- package/types/mixins/KeyboardNavMixin.d.ts +47 -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 +82 -0
- package/types/mixins/PopupMixin.d.ts.map +1 -0
- package/types/mixins/RTLObserverMixin.d.ts +7 -0
- package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
- package/types/mixins/ResizeObserverMixin.d.ts +12 -0
- package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
- package/types/mixins/RippleMixin.d.ts +92 -0
- package/types/mixins/RippleMixin.d.ts.map +1 -0
- package/types/mixins/ScrollListenerMixin.d.ts +41 -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 +9 -0
- package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMixin.d.ts +38 -0
- package/types/mixins/ShapeMixin.d.ts.map +1 -0
- package/types/mixins/StateMixin.d.ts +27 -0
- package/types/mixins/StateMixin.d.ts.map +1 -0
- package/types/mixins/TextFieldMixin.d.ts +1354 -0
- package/types/mixins/TextFieldMixin.d.ts.map +1 -0
- package/types/mixins/ThemableMixin.d.ts +9 -0
- package/types/mixins/ThemableMixin.d.ts.map +1 -0
- package/types/mixins/TooltipTriggerMixin.d.ts +106 -0
- package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
- package/types/mixins/TouchTargetMixin.d.ts +3 -0
- package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
- package/types/mixins/TypographyMixin.d.ts +17 -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/material-color/scheme/Scheme.js +1 -1
- package/utils/pixelmatch.js +360 -0
- package/utils/popup.js +86 -10
- package/utils/searchParams.js +19 -0
- 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,3 +1,12 @@
|
|
|
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
|
+
|
|
1
10
|
/**
|
|
2
11
|
* @typedef {Object} PopupStack
|
|
3
12
|
* @prop {Element} element
|
|
@@ -5,93 +14,10 @@
|
|
|
5
14
|
* @prop {boolean} [centered=false]
|
|
6
15
|
* @prop {Record<string, any>} [state]
|
|
7
16
|
* @prop {Record<string, any>} [previousState]
|
|
8
|
-
* @prop {MouseEvent|PointerEvent|HTMLElement|Element} [originalEvent]
|
|
9
17
|
* @prop {any} [pendingResizeOperation]
|
|
10
18
|
* @prop {window['history']['scrollRestoration']} [scrollRestoration]
|
|
11
19
|
*/
|
|
12
20
|
|
|
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
21
|
/** @type {PopupStack[]} */
|
|
96
22
|
const OPEN_POPUPS = [];
|
|
97
23
|
|
|
@@ -99,17 +25,20 @@ const OPEN_POPUPS = [];
|
|
|
99
25
|
* @return {void}
|
|
100
26
|
*/
|
|
101
27
|
function onWindowResize() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
28
|
+
// Fire in popup order
|
|
29
|
+
for (const { element } of OPEN_POPUPS) {
|
|
30
|
+
element.updatePopupPosition();
|
|
105
31
|
}
|
|
106
|
-
|
|
107
|
-
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Prevent focus being given to elements via mouse nav back
|
|
36
|
+
* @param {MouseEvent} event
|
|
37
|
+
*/
|
|
38
|
+
function onNavMouseDown(event) {
|
|
39
|
+
if (event.button === 3) {
|
|
40
|
+
event.preventDefault();
|
|
108
41
|
}
|
|
109
|
-
lastOpenPopup.pendingResizeOperation = requestAnimationFrame(() => {
|
|
110
|
-
lastOpenPopup.element.updatePopupPosition(lastOpenPopup.originalEvent);
|
|
111
|
-
lastOpenPopup.pendingResizeOperation = null;
|
|
112
|
-
});
|
|
113
42
|
}
|
|
114
43
|
|
|
115
44
|
/**
|
|
@@ -145,10 +74,12 @@ function onBeforeUnload(event) {
|
|
|
145
74
|
*/
|
|
146
75
|
export default function PopupMixin(Base) {
|
|
147
76
|
return Base
|
|
77
|
+
.mixin(DelegatesFocusMixin)
|
|
78
|
+
.mixin(ResizeObserverMixin)
|
|
148
79
|
.observe({
|
|
149
80
|
open: 'boolean',
|
|
150
81
|
modal: 'boolean',
|
|
151
|
-
|
|
82
|
+
native: 'boolean',
|
|
152
83
|
scrollable: 'boolean',
|
|
153
84
|
matchSourceWidth: 'boolean',
|
|
154
85
|
_currentFlow: 'string',
|
|
@@ -157,10 +88,11 @@ export default function PopupMixin(Base) {
|
|
|
157
88
|
/** @type {'corner'|'adjacent'|'overflow'|'vcenter'|'hcenter'|'center'} */
|
|
158
89
|
value: null,
|
|
159
90
|
},
|
|
91
|
+
popupMargin: 'float',
|
|
160
92
|
})
|
|
161
93
|
.set({
|
|
94
|
+
useHistory: true,
|
|
162
95
|
returnValue: '',
|
|
163
|
-
delegatesFocus: true,
|
|
164
96
|
_closing: false,
|
|
165
97
|
_useScrim: false,
|
|
166
98
|
})
|
|
@@ -174,45 +106,38 @@ export default function PopupMixin(Base) {
|
|
|
174
106
|
* @param {DOMRect|Element} [anchor]
|
|
175
107
|
* @return {void}
|
|
176
108
|
*/
|
|
177
|
-
updatePopupPosition(anchor) {
|
|
109
|
+
updatePopupPosition(anchor = this._anchor) {
|
|
178
110
|
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');
|
|
111
|
+
Object.assign(this.style, {
|
|
112
|
+
top: '0',
|
|
113
|
+
left: '0',
|
|
114
|
+
right: 'auto',
|
|
115
|
+
bottom: 'auto',
|
|
116
|
+
maxWidth: null,
|
|
117
|
+
maxHeight: null,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const layoutElement = this.native ? this._dialog : this;
|
|
121
|
+
Object.assign(layoutElement.style, { width: 'auto', height: 'auto' });
|
|
193
122
|
|
|
194
123
|
const width = (anchor && this.matchSourceWidth)
|
|
195
124
|
? anchor.clientWidth
|
|
196
125
|
: 56 * Math.ceil(layoutElement.clientWidth / 56);
|
|
197
126
|
|
|
198
|
-
|
|
127
|
+
layoutElement.style.setProperty('width', `${width}px`);
|
|
199
128
|
|
|
200
129
|
const height = layoutElement.clientHeight;
|
|
201
|
-
layoutElement.style
|
|
202
|
-
layoutElement.style.removeProperty('height');
|
|
130
|
+
Object.assign(layoutElement.style, { height: null });
|
|
203
131
|
|
|
204
|
-
const initialRect = this.getBoundingClientRect();
|
|
205
132
|
/** @type {import('../utils/popup.js').CanAnchorPopUpOptions} */
|
|
206
133
|
const anchorOptions = {
|
|
207
|
-
anchor
|
|
208
|
-
? this.getBoundingClientRect()
|
|
209
|
-
: (anchor instanceof Element ? anchor.getBoundingClientRect() : anchor),
|
|
134
|
+
anchor,
|
|
210
135
|
width,
|
|
211
136
|
height,
|
|
212
|
-
margin:
|
|
137
|
+
margin: this.popupMargin ?? (window.innerWidth < 648 ? 16 : 24),
|
|
213
138
|
};
|
|
214
139
|
|
|
215
|
-
const isPageRTL = (
|
|
140
|
+
const isPageRTL = isRtl(this);
|
|
216
141
|
const xStart = isPageRTL ? 'right' : 'left';
|
|
217
142
|
const xEnd = isPageRTL ? 'left' : 'right';
|
|
218
143
|
|
|
@@ -317,16 +242,18 @@ export default function PopupMixin(Base) {
|
|
|
317
242
|
if (result.visibility === 1) break;
|
|
318
243
|
}
|
|
319
244
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
245
|
+
let { maxWidth, maxHeight } = anchorResult.styles;
|
|
246
|
+
if (maxWidth || maxHeight) {
|
|
247
|
+
const styles = window.getComputedStyle(this);
|
|
248
|
+
if (styles.maxWidth) {
|
|
249
|
+
maxWidth = `min(${maxWidth}, ${styles.maxWidth})`;
|
|
250
|
+
}
|
|
251
|
+
if (styles.maxHeight) {
|
|
252
|
+
maxHeight = `min(${maxHeight}, ${styles.maxHeight})`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
Object.assign(this.style, { ...anchorResult.styles, maxWidth, maxHeight });
|
|
256
|
+
// this.scrollIntoView();
|
|
330
257
|
},
|
|
331
258
|
/**
|
|
332
259
|
* @param {Event & {currentTarget: HTMLSlotElement}} event
|
|
@@ -348,19 +275,25 @@ export default function PopupMixin(Base) {
|
|
|
348
275
|
showPopup(source, focus = true, flow = null) {
|
|
349
276
|
if (this.open) return false;
|
|
350
277
|
this.open = true;
|
|
278
|
+
this._source = source;
|
|
279
|
+
this._anchor = source;
|
|
351
280
|
|
|
352
|
-
|
|
281
|
+
const { scrim } = this.refs;
|
|
353
282
|
if (this._useScrim) {
|
|
354
|
-
|
|
355
|
-
|
|
283
|
+
if (this.native) {
|
|
284
|
+
document.body.append(scrim);
|
|
285
|
+
} else {
|
|
286
|
+
this.before(scrim);
|
|
287
|
+
}
|
|
288
|
+
scrim.hidden = false;
|
|
356
289
|
} else {
|
|
357
|
-
|
|
290
|
+
scrim.remove();
|
|
358
291
|
}
|
|
359
292
|
|
|
360
293
|
const previousFocus = source instanceof HTMLElement ? source : document.activeElement;
|
|
361
294
|
|
|
362
|
-
if (supportsHTMLDialogElement && focus
|
|
363
|
-
|
|
295
|
+
if (supportsHTMLDialogElement && focus // Calling show will force focus which is not intended for non-modals
|
|
296
|
+
&& !this._dialog.open) {
|
|
364
297
|
this._dialog.show();
|
|
365
298
|
}
|
|
366
299
|
|
|
@@ -370,39 +303,47 @@ export default function PopupMixin(Base) {
|
|
|
370
303
|
// Native modals can fail update bounds on Chrome
|
|
371
304
|
this.updatePopupPosition(source);
|
|
372
305
|
|
|
373
|
-
|
|
374
|
-
let
|
|
306
|
+
let newState;
|
|
307
|
+
let scrollRestoration;
|
|
308
|
+
let previousState;
|
|
309
|
+
if (this.useHistory) {
|
|
310
|
+
newState = { hash: Math.random().toString(36).slice(2, 18) };
|
|
311
|
+
|
|
312
|
+
if (!window.history.state) {
|
|
313
|
+
// Create new previous state
|
|
314
|
+
window.history.replaceState({
|
|
315
|
+
hash: Math.random().toString(36).slice(2, 18),
|
|
316
|
+
}, document.title);
|
|
317
|
+
}
|
|
318
|
+
previousState = window.history.state;
|
|
375
319
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
window.history.
|
|
379
|
-
|
|
380
|
-
|
|
320
|
+
scrollRestoration = window.history.scrollRestoration;
|
|
321
|
+
|
|
322
|
+
window.history.scrollRestoration = 'manual';
|
|
323
|
+
window.history.pushState(newState, document.title);
|
|
324
|
+
window.addEventListener('popstate', onPopState);
|
|
325
|
+
window.addEventListener('beforeunload', onBeforeUnload);
|
|
381
326
|
}
|
|
382
|
-
previousState = window.history.state;
|
|
383
327
|
|
|
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);
|
|
328
|
+
window.addEventListener('mousedown', onNavMouseDown, { capture: true });
|
|
390
329
|
|
|
391
330
|
window.addEventListener('resize', onWindowResize);
|
|
392
331
|
window.addEventListener('scroll', onWindowResize);
|
|
332
|
+
if (window.visualViewport) {
|
|
333
|
+
window.visualViewport.addEventListener('resize', onWindowResize);
|
|
334
|
+
window.visualViewport.addEventListener('scroll', onWindowResize);
|
|
335
|
+
}
|
|
393
336
|
|
|
394
337
|
OPEN_POPUPS.push({
|
|
395
338
|
element: this,
|
|
396
339
|
previousFocus,
|
|
397
340
|
state: newState,
|
|
398
341
|
previousState,
|
|
399
|
-
originalEvent: source,
|
|
400
342
|
scrollRestoration,
|
|
401
343
|
});
|
|
402
344
|
|
|
403
345
|
// Overrideable
|
|
404
346
|
if (focus) {
|
|
405
|
-
console.log('focusing!');
|
|
406
347
|
this.focus();
|
|
407
348
|
}
|
|
408
349
|
|
|
@@ -419,7 +360,7 @@ export default function PopupMixin(Base) {
|
|
|
419
360
|
this.modal = true;
|
|
420
361
|
if (supportsHTMLDialogElement) {
|
|
421
362
|
this._dialog.showModal();
|
|
422
|
-
this.
|
|
363
|
+
this.native = true;
|
|
423
364
|
}
|
|
424
365
|
return this.showPopup(source, focus, flow);
|
|
425
366
|
},
|
|
@@ -445,14 +386,15 @@ export default function PopupMixin(Base) {
|
|
|
445
386
|
close(returnValue = undefined, returnFocus = true) {
|
|
446
387
|
if (!this.open) return false;
|
|
447
388
|
if (this._closing) return false;
|
|
389
|
+
this._source = null;
|
|
448
390
|
this._closing = true;
|
|
449
391
|
this.modal = false;
|
|
450
392
|
|
|
451
393
|
// SCRIM
|
|
452
394
|
this.refs.scrim.hidden = true;
|
|
453
395
|
|
|
454
|
-
if (this.
|
|
455
|
-
this.
|
|
396
|
+
if (this.native) {
|
|
397
|
+
this.native = false;
|
|
456
398
|
} else {
|
|
457
399
|
const main = document.querySelector('main');
|
|
458
400
|
if (main) {
|
|
@@ -481,41 +423,51 @@ export default function PopupMixin(Base) {
|
|
|
481
423
|
for (let i = len - 1; i >= 0; i--) {
|
|
482
424
|
const entry = OPEN_POPUPS[i];
|
|
483
425
|
if (entry.element === this) {
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
426
|
+
if (this.useHistory) {
|
|
427
|
+
if (entry.state && window.history
|
|
428
|
+
&& window.history.state && entry.state.hash === window.history.state.hash) {
|
|
429
|
+
window.removeEventListener('popstate', onPopState);
|
|
430
|
+
window.history.back();
|
|
431
|
+
// Back does not set state immediately
|
|
432
|
+
// Needed to track submenu
|
|
433
|
+
// TODO: use window.history.go(indexDelta) instead for Safari (not Webkit) submenu support
|
|
434
|
+
window.history.replaceState(entry.previousState, document.title);
|
|
435
|
+
window.history.scrollRestoration = entry.scrollRestoration || 'auto';
|
|
436
|
+
window.addEventListener('popstate', onPopState);
|
|
437
|
+
} else {
|
|
438
|
+
console.warn('Menu state mismatch?', entry, window.history.state);
|
|
439
|
+
}
|
|
496
440
|
}
|
|
497
441
|
if (returnFocus) {
|
|
498
|
-
console.log('not returning focus');
|
|
442
|
+
// console.log('not returning focus');
|
|
499
443
|
entry.previousFocus?.focus?.({ preventScroll: true });
|
|
500
444
|
}
|
|
501
445
|
OPEN_POPUPS.splice(i, 1);
|
|
502
446
|
break;
|
|
503
447
|
} else if (this.contains(entry.element)) {
|
|
504
|
-
console.debug('Closing submenu first');
|
|
448
|
+
// console.debug('Closing submenu first');
|
|
505
449
|
entry.element.close(false);
|
|
506
|
-
console.debug('Sub menu closed. Continuing...');
|
|
450
|
+
// console.debug('Sub menu closed. Continuing...');
|
|
507
451
|
}
|
|
508
452
|
}
|
|
509
453
|
if (!OPEN_POPUPS.length) {
|
|
510
454
|
window.removeEventListener('popstate', onPopState);
|
|
511
455
|
window.removeEventListener('beforeunload', onBeforeUnload);
|
|
512
456
|
window.removeEventListener('resize', onWindowResize);
|
|
513
|
-
|
|
457
|
+
window.removeEventListener('mousedown', onNavMouseDown, { capture: true });
|
|
458
|
+
// console.debug('All menus closed');
|
|
514
459
|
}
|
|
515
460
|
this._closing = false;
|
|
516
461
|
return true;
|
|
517
462
|
},
|
|
518
463
|
})
|
|
464
|
+
|
|
465
|
+
.overrides({
|
|
466
|
+
onResizeObserved(entry) {
|
|
467
|
+
if (!this.open || this._closing) return;
|
|
468
|
+
this.updatePopupPosition();
|
|
469
|
+
},
|
|
470
|
+
})
|
|
519
471
|
.expressions({
|
|
520
472
|
_ariaHidden({ open }) { return (open ? 'false' : 'true'); },
|
|
521
473
|
})
|
|
@@ -529,19 +481,25 @@ export default function PopupMixin(Base) {
|
|
|
529
481
|
.css`
|
|
530
482
|
/* https://m3.material.io/components/dialogs/specs */
|
|
531
483
|
|
|
484
|
+
:host([popover]) {
|
|
485
|
+
margin: 0;
|
|
486
|
+
border: 0;
|
|
487
|
+
padding: 0;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
:host(::backdrop) {
|
|
491
|
+
display: none;
|
|
492
|
+
}
|
|
493
|
+
|
|
532
494
|
:host {
|
|
533
495
|
--mdw-popup__expand-duration: var(--mdw-motion-expand-duration, 250ms);
|
|
534
496
|
--mdw-popup__simple-duration: var(--mdw-motion-simple-duration, 100ms);
|
|
535
497
|
--mdw-popup__standard-easing: var(--mdw-motion-standard-easing, cubic-bezier(0.4, 0.0, 0.2, 1));
|
|
536
498
|
--mdw-popup__deceleration-easing: var(--mdw-motion-deceleration-easing, cubic-bezier(0.0, 0.0, 0.2, 1));
|
|
537
499
|
--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
500
|
|
|
541
501
|
--mdw-shape__size: 28px;
|
|
542
502
|
|
|
543
|
-
--mdw-surface__shadow__resting: var(--mdw-surface__shadow__3);
|
|
544
|
-
--mdw-surface__shadow__raised: var(--mdw-surface__shadow__resting);
|
|
545
503
|
/* padding-inline: 12px; */
|
|
546
504
|
|
|
547
505
|
--mdw-bg: var(--mdw-color__surface);
|
|
@@ -549,10 +507,8 @@ export default function PopupMixin(Base) {
|
|
|
549
507
|
|
|
550
508
|
position: fixed;
|
|
551
509
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
555
|
-
left: 50%;
|
|
510
|
+
inset-block-start: 0;
|
|
511
|
+
inset-inline-start: 0;
|
|
556
512
|
align-self: center;
|
|
557
513
|
justify-self: center;
|
|
558
514
|
|
|
@@ -569,15 +525,14 @@ export default function PopupMixin(Base) {
|
|
|
569
525
|
inline-size: auto;
|
|
570
526
|
min-inline-size: none;
|
|
571
527
|
max-inline-size: 100vw;
|
|
572
|
-
|
|
573
|
-
|
|
528
|
+
|
|
529
|
+
outline: none; /* Older Chromium Builds */
|
|
530
|
+
|
|
574
531
|
pointer-events: none;
|
|
575
532
|
|
|
576
533
|
opacity: 0;
|
|
534
|
+
transform: scale(0);
|
|
577
535
|
|
|
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
536
|
visibility: hidden;
|
|
582
537
|
z-index: 24;
|
|
583
538
|
|
|
@@ -586,30 +541,30 @@ export default function PopupMixin(Base) {
|
|
|
586
541
|
font: var(--mdw-type__font);
|
|
587
542
|
letter-spacing: var(--mdw-type__letter-spacing);
|
|
588
543
|
|
|
589
|
-
transition-delay:
|
|
590
|
-
transition-duration:
|
|
591
|
-
transition-property: opacity, transform
|
|
544
|
+
transition-delay: 200ms, 0s;
|
|
545
|
+
transition-duration: 0s, 200ms, 200ms;
|
|
546
|
+
transition-property: visibility, opacity, transform;
|
|
592
547
|
transition-timing-function: ease-out;
|
|
593
548
|
|
|
594
|
-
will-change:
|
|
595
|
-
will-change: opacity;
|
|
549
|
+
will-change: visibility, opacity, transform;
|
|
596
550
|
|
|
597
551
|
}
|
|
598
552
|
|
|
599
553
|
:host([open]) {
|
|
600
|
-
pointer-events:
|
|
554
|
+
pointer-events: inherit;
|
|
601
555
|
|
|
602
556
|
opacity: 1;
|
|
603
557
|
|
|
604
|
-
transform:
|
|
605
|
-
visibility:
|
|
558
|
+
transform: none;
|
|
559
|
+
visibility: inherit;
|
|
606
560
|
|
|
607
561
|
transition-delay: 0s;
|
|
608
|
-
transition-duration: 0s;
|
|
609
562
|
transition-timing-function: ease-in;
|
|
610
563
|
}
|
|
611
564
|
|
|
612
|
-
|
|
565
|
+
:host([native][open]) {
|
|
566
|
+
opacity: 0;
|
|
567
|
+
}
|
|
613
568
|
|
|
614
569
|
#dialog {
|
|
615
570
|
position: static;
|
|
@@ -625,17 +580,16 @@ export default function PopupMixin(Base) {
|
|
|
625
580
|
place-items: inherit;
|
|
626
581
|
|
|
627
582
|
box-sizing: border-box;
|
|
628
|
-
|
|
629
583
|
block-size: inherit;
|
|
630
|
-
|
|
631
|
-
|
|
632
584
|
flex: inherit;
|
|
633
585
|
margin:0;
|
|
634
586
|
border: none;
|
|
635
587
|
padding: inherit;
|
|
636
588
|
padding: 0;
|
|
637
589
|
|
|
638
|
-
pointer-events:
|
|
590
|
+
pointer-events: inherit;
|
|
591
|
+
|
|
592
|
+
filter: inherit;
|
|
639
593
|
|
|
640
594
|
opacity: 1;
|
|
641
595
|
|
|
@@ -650,6 +604,16 @@ export default function PopupMixin(Base) {
|
|
|
650
604
|
|
|
651
605
|
}
|
|
652
606
|
|
|
607
|
+
:host([color]) {
|
|
608
|
+
background-color: rgb(var(--mdw-bg));
|
|
609
|
+
color: rgb(var(--mdw-ink));
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
:host(:is([color="none"],[color="transparent"])) {
|
|
613
|
+
background-color: transparent;
|
|
614
|
+
color: inherit;
|
|
615
|
+
}
|
|
616
|
+
|
|
653
617
|
:host([scrollable]) {
|
|
654
618
|
overflow-y:auto;
|
|
655
619
|
}
|
|
@@ -681,10 +645,14 @@ export default function PopupMixin(Base) {
|
|
|
681
645
|
flex: inherit;
|
|
682
646
|
padding: inherit;
|
|
683
647
|
|
|
684
|
-
pointer-events:
|
|
648
|
+
pointer-events: inherit;
|
|
685
649
|
|
|
650
|
+
filter: inherit;
|
|
686
651
|
transform: inherit;
|
|
687
652
|
visibility: inherit;
|
|
653
|
+
|
|
654
|
+
background-color: inherit;
|
|
655
|
+
border-radius: inherit;
|
|
688
656
|
}
|
|
689
657
|
|
|
690
658
|
#dialog[scrollable][open] {
|
|
@@ -697,10 +665,10 @@ export default function PopupMixin(Base) {
|
|
|
697
665
|
|
|
698
666
|
place-items: inherit;
|
|
699
667
|
|
|
700
|
-
|
|
701
|
-
max-
|
|
702
|
-
|
|
703
|
-
max-
|
|
668
|
+
block-size: 100%;
|
|
669
|
+
max-block-size: none;
|
|
670
|
+
inline-size: 100%;
|
|
671
|
+
max-inline-size: none;
|
|
704
672
|
|
|
705
673
|
flex: 1;
|
|
706
674
|
}
|
|
@@ -710,12 +678,12 @@ export default function PopupMixin(Base) {
|
|
|
710
678
|
#dialog[scrollable][open]:modal {
|
|
711
679
|
overflow:auto;
|
|
712
680
|
|
|
713
|
-
|
|
714
|
-
min-
|
|
715
|
-
max-
|
|
716
|
-
|
|
717
|
-
min-
|
|
718
|
-
max-
|
|
681
|
+
block-size:100%;
|
|
682
|
+
min-block-size: none;
|
|
683
|
+
max-block-size: inherit;
|
|
684
|
+
inline-size:100%;
|
|
685
|
+
min-inline-size: none;
|
|
686
|
+
max-inline-size: inherit;
|
|
719
687
|
flex: inherit;
|
|
720
688
|
padding: inherit;
|
|
721
689
|
}
|
|
@@ -738,7 +706,7 @@ export default function PopupMixin(Base) {
|
|
|
738
706
|
'~click'(event) {
|
|
739
707
|
// Track if click on backdrop
|
|
740
708
|
if (event.target !== event.currentTarget) return;
|
|
741
|
-
if (!this.
|
|
709
|
+
if (!this.native) return;
|
|
742
710
|
if (event.offsetX >= 0 && event.offsetX < event.currentTarget.offsetWidth
|
|
743
711
|
&& event.offsetY >= 0 && event.offsetY < event.currentTarget.offsetHeight) return;
|
|
744
712
|
const cancelEvent = new Event('cancel', { cancelable: true });
|
|
@@ -10,8 +10,11 @@ const resizeObserver = new ResizeObserver((entries) => {
|
|
|
10
10
|
*/
|
|
11
11
|
export default function ResizeObserverMixin(Base) {
|
|
12
12
|
return Base
|
|
13
|
-
.
|
|
14
|
-
|
|
13
|
+
.observe({
|
|
14
|
+
_resizeObserverEnabled: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
value: true,
|
|
17
|
+
},
|
|
15
18
|
})
|
|
16
19
|
.methods({
|
|
17
20
|
/** @param {ResizeObserverEntry} entry */
|
|
@@ -19,7 +22,9 @@ export default function ResizeObserverMixin(Base) {
|
|
|
19
22
|
// Virtual function
|
|
20
23
|
},
|
|
21
24
|
observeResize() {
|
|
22
|
-
resizeObserver.observe(this
|
|
25
|
+
resizeObserver.observe(this, {
|
|
26
|
+
box: 'border-box',
|
|
27
|
+
});
|
|
23
28
|
},
|
|
24
29
|
unobserveResize() {
|
|
25
30
|
resizeObserver.unobserve(this);
|
|
@@ -27,11 +32,18 @@ export default function ResizeObserverMixin(Base) {
|
|
|
27
32
|
})
|
|
28
33
|
.on({
|
|
29
34
|
connected() {
|
|
30
|
-
if (!this.
|
|
35
|
+
if (!this._resizeObserverEnabled) return;
|
|
31
36
|
this.observeResize();
|
|
32
37
|
},
|
|
33
38
|
disconnected() {
|
|
34
39
|
this.unobserveResize();
|
|
35
40
|
},
|
|
41
|
+
_resizeObserverEnabledChanged(previous, enabled) {
|
|
42
|
+
if (enabled) {
|
|
43
|
+
this.observeResize();
|
|
44
|
+
} else {
|
|
45
|
+
this.unobserveResize();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
36
48
|
});
|
|
37
49
|
}
|