@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/ControlMixin.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* https://html.spec.whatwg.org/multipage/form-control-infrastructure.html */
|
|
2
2
|
|
|
3
3
|
import { cloneAttributeCallback } from '../core/CustomElement.js';
|
|
4
|
+
import { FIREFOX_VERSION, SAFARI_VERSION } from '../core/dom.js';
|
|
4
5
|
|
|
6
|
+
import DelegatesFocusMixin from './DelegatesFocusMixin.js';
|
|
5
7
|
import FormAssociatedMixin from './FormAssociatedMixin.js';
|
|
6
8
|
|
|
7
9
|
/** @typedef {import('../core/CustomElement.js').default} CustomElement */
|
|
@@ -11,21 +13,33 @@ import FormAssociatedMixin from './FormAssociatedMixin.js';
|
|
|
11
13
|
/** @typedef {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement} HTMLControlElement */
|
|
12
14
|
|
|
13
15
|
/**
|
|
16
|
+
* Adds form-control behavior and wiring to an internal control element.
|
|
14
17
|
* @param {ReturnType<import('./StateMixin.js').default>} Base
|
|
15
18
|
*/
|
|
16
19
|
export default function ControlMixin(Base) {
|
|
17
20
|
return Base
|
|
18
21
|
.mixin(FormAssociatedMixin)
|
|
22
|
+
.mixin(DelegatesFocusMixin)
|
|
19
23
|
.observe({
|
|
24
|
+
/** Optional aria-label applied to the internal control (string). */
|
|
20
25
|
ariaLabel: 'string',
|
|
26
|
+
/** Internal cached slot text used as fallback label when aria-label is absent. */
|
|
27
|
+
_slotInnerText: 'string',
|
|
21
28
|
})
|
|
22
29
|
.set({
|
|
23
|
-
delegatesFocus: true,
|
|
24
30
|
focusableOnDisabled: false,
|
|
25
31
|
controlTagName: 'input',
|
|
26
32
|
controlVoidElement: true,
|
|
33
|
+
_slotMutationObserver: null,
|
|
27
34
|
})
|
|
28
35
|
.methods({
|
|
36
|
+
/**
|
|
37
|
+
* Default behavior can be overridden
|
|
38
|
+
* @param {string} value
|
|
39
|
+
*/
|
|
40
|
+
_onControlValue(value) {
|
|
41
|
+
this._value = value;
|
|
42
|
+
},
|
|
29
43
|
onValueChangingContentAttribute() {
|
|
30
44
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
31
45
|
|
|
@@ -36,7 +50,7 @@ export default function ControlMixin(Base) {
|
|
|
36
50
|
control.setAttribute('value', ''); // Chrome needs to know to reset
|
|
37
51
|
}
|
|
38
52
|
// Changing control attribute may change the value (eg: min/max)
|
|
39
|
-
this.
|
|
53
|
+
this._onControlValue(control.value);
|
|
40
54
|
},
|
|
41
55
|
/** @type {HTMLElement['focus']} */
|
|
42
56
|
focus(...options) {
|
|
@@ -44,20 +58,16 @@ export default function ControlMixin(Base) {
|
|
|
44
58
|
},
|
|
45
59
|
/** Redirect click requests to control itself */
|
|
46
60
|
click() {
|
|
47
|
-
|
|
61
|
+
if (this.disabledState) return;
|
|
48
62
|
this.refs.control.click();
|
|
49
63
|
},
|
|
50
64
|
})
|
|
51
65
|
.define({
|
|
52
66
|
stateTargetElement() { return this.refs.control; },
|
|
53
|
-
form() { return this.elementInternals.form; },
|
|
54
|
-
validity() { return this.elementInternals.validity; },
|
|
55
|
-
validationMessage() { return this.elementInternals.validationMessage; },
|
|
56
|
-
willValidate() { return this.elementInternals.willValidate; },
|
|
57
|
-
labels() { return this.elementInternals.labels; },
|
|
58
67
|
})
|
|
59
68
|
.methods({
|
|
60
69
|
checkValidity() {
|
|
70
|
+
if (!this.willValidate) return true;
|
|
61
71
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
62
72
|
const validityState = control.checkValidity();
|
|
63
73
|
/** @type {Partial<ValidityState>} */
|
|
@@ -95,21 +105,30 @@ export default function ControlMixin(Base) {
|
|
|
95
105
|
this.refs.control,
|
|
96
106
|
);
|
|
97
107
|
},
|
|
108
|
+
})
|
|
109
|
+
.observe({
|
|
110
|
+
_computedAriaLabel({ ariaLabel, _slotInnerText }) {
|
|
111
|
+
return ariaLabel?.trim() || _slotInnerText?.trim() || null;
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
.expressions({
|
|
115
|
+
_computedAriaLabelledby({ _computedAriaLabel }) {
|
|
116
|
+
return _computedAriaLabel ? null : 'slot';
|
|
117
|
+
},
|
|
118
|
+
})
|
|
98
119
|
|
|
120
|
+
.recompose(({ template, html, element }) => {
|
|
121
|
+
template.append(html`
|
|
122
|
+
<${element.controlTagName} id=control
|
|
123
|
+
aria-label={_computedAriaLabel}
|
|
124
|
+
aria-labelledby={_computedAriaLabelledby}
|
|
125
|
+
part=control
|
|
126
|
+
form-disabled={disabledState}
|
|
127
|
+
type={type}
|
|
128
|
+
>${element.controlVoidElement ? '' : `</${element.controlTagName}>`}
|
|
129
|
+
`);
|
|
99
130
|
})
|
|
100
131
|
.on({
|
|
101
|
-
// Wait until controlTagName is settled before templating
|
|
102
|
-
composed({ template, html }) {
|
|
103
|
-
template.append(html`
|
|
104
|
-
<${this.controlTagName} id=control
|
|
105
|
-
aria-labelledby=${({ ariaLabel }) => (ariaLabel ? null : 'slot')}
|
|
106
|
-
part=control
|
|
107
|
-
aria-label={ariaLabel}
|
|
108
|
-
form-disabled={disabledState}
|
|
109
|
-
type={type}
|
|
110
|
-
>${this.controlVoidElement ? '' : `</${this.controlTagName}>`}
|
|
111
|
-
`);
|
|
112
|
-
},
|
|
113
132
|
disabledStateChanged(oldValue, newValue) {
|
|
114
133
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
115
134
|
control.setAttribute('aria-disabled', `${newValue}`);
|
|
@@ -122,9 +141,17 @@ export default function ControlMixin(Base) {
|
|
|
122
141
|
}
|
|
123
142
|
}
|
|
124
143
|
},
|
|
144
|
+
readOnlyChanged(oldValue, newValue) {
|
|
145
|
+
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
146
|
+
if (this.type === 'checkbox') {
|
|
147
|
+
control.setAttribute('aria-readonly', newValue ? 'true' : 'false');
|
|
148
|
+
} else {
|
|
149
|
+
control.removeAttribute('aria-readonly');
|
|
150
|
+
}
|
|
151
|
+
},
|
|
125
152
|
constructed() {
|
|
126
153
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
127
|
-
this.
|
|
154
|
+
this._onControlValue(control.value);
|
|
128
155
|
},
|
|
129
156
|
connected() {
|
|
130
157
|
// Expose this element as focusable
|
|
@@ -141,11 +168,14 @@ export default function ControlMixin(Base) {
|
|
|
141
168
|
})
|
|
142
169
|
.childEvents({
|
|
143
170
|
control: {
|
|
144
|
-
|
|
145
|
-
|
|
171
|
+
click(e) {
|
|
172
|
+
if ((this.type === 'checkbox' && this.readOnly)
|
|
173
|
+
|| (this.focusableOnDisabled && this.disabledState)) {
|
|
174
|
+
e.preventDefault();
|
|
175
|
+
e.stopImmediatePropagation();
|
|
176
|
+
}
|
|
146
177
|
},
|
|
147
178
|
input({ currentTarget }) {
|
|
148
|
-
console.debug('ControlMixin: input');
|
|
149
179
|
const control = /** @type {HTMLControlElement} */ (currentTarget);
|
|
150
180
|
if (this.validity.valid) {
|
|
151
181
|
// Track internally
|
|
@@ -155,18 +185,37 @@ export default function ControlMixin(Base) {
|
|
|
155
185
|
// Perform check in case user has validated
|
|
156
186
|
this.checkValidity();
|
|
157
187
|
}
|
|
158
|
-
this.
|
|
188
|
+
this._onControlValue(control.value);
|
|
159
189
|
},
|
|
160
190
|
change({ currentTarget }) {
|
|
161
|
-
console.debug('ControlMixin: change');
|
|
162
191
|
const control = /** @type {HTMLControlElement} */ (currentTarget);
|
|
163
192
|
this._valueDirty = true;
|
|
164
|
-
this.
|
|
193
|
+
this._onControlValue(control.value);
|
|
165
194
|
this.checkValidity();
|
|
166
|
-
// Change event is NOT composed. Needs to escape shadow DOM
|
|
167
|
-
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
168
195
|
},
|
|
169
196
|
},
|
|
197
|
+
slot: (FIREFOX_VERSION < 116 || SAFARI_VERSION) ? {
|
|
198
|
+
slotchange({ currentTarget }) {
|
|
199
|
+
// Firefox and Safari will not apply label from slots.
|
|
200
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1826194
|
|
201
|
+
// https://commits.webkit.org/263644@main
|
|
202
|
+
// https://bugs.webkit.org/show_bug.cgi?id=260772
|
|
203
|
+
this._slotInnerText = this.textContent;
|
|
204
|
+
if (!this._slotMutationObserver) {
|
|
205
|
+
this._slotMutationObserver = new MutationObserver(() => {
|
|
206
|
+
this._slotInnerText = this.textContent;
|
|
207
|
+
});
|
|
208
|
+
this._slotMutationObserver.observe(currentTarget, { characterData: true });
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
} : {},
|
|
212
|
+
})
|
|
213
|
+
.rootEvents({
|
|
214
|
+
change(event) {
|
|
215
|
+
// Change event is NOT composed. Needs to escape shadow DOM
|
|
216
|
+
// @ts-ignore skip constructor cast
|
|
217
|
+
this.dispatchEvent(new event.constructor(event.type, event));
|
|
218
|
+
},
|
|
170
219
|
})
|
|
171
220
|
.css`
|
|
172
221
|
:host {
|
|
@@ -206,15 +255,12 @@ export default function ControlMixin(Base) {
|
|
|
206
255
|
|
|
207
256
|
cursor: auto;
|
|
208
257
|
outline: none;
|
|
209
|
-
|
|
210
|
-
pointer-events: auto;
|
|
211
|
-
|
|
212
258
|
transform: translateX(-50%) translateY(-50%);
|
|
213
259
|
|
|
214
260
|
/* Safari and Chrome will emit two click events if not at top of stack */
|
|
215
261
|
/* Allows up to 3 other layers (eg: ripple, outline) */
|
|
216
262
|
z-index: 4;
|
|
217
|
-
|
|
263
|
+
|
|
218
264
|
background-color: transparent;
|
|
219
265
|
|
|
220
266
|
border-radius: 0;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CHROME_VERSION, isFocused } from '../core/dom.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enables focus delegation to an internal focus target and manages tabindex behavior.
|
|
5
|
+
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Adds delegated focus behavior to the element's internals for keyboard navigation.
|
|
9
|
+
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
10
|
+
*/
|
|
11
|
+
export default function DelegatesFocusMixin(Base) {
|
|
12
|
+
return Base
|
|
13
|
+
.set({
|
|
14
|
+
/** When true, the element delegates focus to an internal focus target. */
|
|
15
|
+
delegatesFocus: true,
|
|
16
|
+
})
|
|
17
|
+
.extend(CHROME_VERSION >= 111
|
|
18
|
+
? (BaseClass) => BaseClass
|
|
19
|
+
: (BaseClass) => class extends BaseClass {
|
|
20
|
+
get tabIndex() {
|
|
21
|
+
return super.tabIndex;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
set tabIndex(value) {
|
|
25
|
+
if (value === super.tabIndex && value !== -1) {
|
|
26
|
+
// Non -1 value already set
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (this.delegatesFocus && isFocused(this)) {
|
|
31
|
+
if (this.getAttribute('tabindex') === value.toString()) {
|
|
32
|
+
// Skip if possible
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Chrome blurs on tabindex changes with delegatesFocus
|
|
37
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1346606
|
|
38
|
+
/** @type {EventListener} */
|
|
39
|
+
const listener = (e) => {
|
|
40
|
+
e.stopImmediatePropagation();
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
if (e.type === 'blur') {
|
|
43
|
+
console.warn('Chromium bug 1346606: Tabindex change caused blur. Giving focusing back.', this);
|
|
44
|
+
this.focus();
|
|
45
|
+
} else {
|
|
46
|
+
console.warn(`Chromium bug 1346606: Blocking ${e.type} event.`, this);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
for (const type of ['blur', 'focus', 'focusout', 'focusin']) {
|
|
50
|
+
this.addEventListener(type, listener, { capture: true, once: true });
|
|
51
|
+
}
|
|
52
|
+
super.tabIndex = value;
|
|
53
|
+
for (const type of ['blur', 'focus', 'focusout', 'focusin']) {
|
|
54
|
+
this.removeEventListener(type, listener, { capture: true });
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
super.tabIndex = value;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
package/mixins/DensityMixin.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Adds a `density` property to control component spacing and compactness.
|
|
3
|
+
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
4
|
+
*/
|
|
2
5
|
export default function DensityMixin(Base) {
|
|
3
6
|
return Base
|
|
4
7
|
.observe({
|
|
8
|
+
/** Density level affecting spacing and compactness. Integer from -4 (dense) to 4 (spacious). */
|
|
5
9
|
density: 'integer',
|
|
6
10
|
})
|
|
7
11
|
.css`
|
|
@@ -14,11 +18,11 @@ export default function DensityMixin(Base) {
|
|
|
14
18
|
|
|
15
19
|
:host([density="-1"]) { --mdw-density: -1; }
|
|
16
20
|
:host([density="-2"]) { --mdw-density: -2; }
|
|
17
|
-
:host([density="-3"]) { --mdw-density: -
|
|
21
|
+
:host([density="-3"]) { --mdw-density: -3; }
|
|
18
22
|
:host([density="-4"]) { --mdw-density: -4; }
|
|
19
23
|
:host([density="1"]) { --mdw-density: 1; }
|
|
20
24
|
:host([density="2"]) { --mdw-density: 2; }
|
|
21
25
|
:host([density="3"]) { --mdw-density: 3; }
|
|
22
|
-
:host([density="4"]) { --mdw-density:
|
|
26
|
+
:host([density="4"]) { --mdw-density: 4; }
|
|
23
27
|
`;
|
|
24
28
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds CSS properties for elevation via shadows or underlighting.
|
|
3
|
+
* @param {ReturnType<import('./StateMixin.js').default> & ReturnType<import('./ThemableMixin.js').default>} Base
|
|
4
|
+
*/
|
|
5
|
+
export default function ElevationMixin(Base) {
|
|
6
|
+
return Base
|
|
7
|
+
.css`:host {
|
|
8
|
+
|
|
9
|
+
/** Reference Properties */
|
|
10
|
+
/*
|
|
11
|
+
--mdw-surface__box-shadow__1__umbra: 0px 1px 2px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
12
|
+
--mdw-surface__box-shadow__2__umbra: 0px 1px 2px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
13
|
+
--mdw-surface__box-shadow__3__umbra: 0px 1px 3px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
14
|
+
--mdw-surface__box-shadow__4__umbra: 0px 2px 3px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
15
|
+
--mdw-surface__box-shadow__5__umbra: 0px 4px 4px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
16
|
+
|
|
17
|
+
--mdw-surface__filter__0__umbra: drop-shadow(0px 1px 1px rgba(var(--mdw-color__shadow), 0));
|
|
18
|
+
--mdw-surface__filter__1__umbra: drop-shadow(0px 1px 1px rgba(var(--mdw-color__shadow), 0.30));
|
|
19
|
+
--mdw-surface__filter__2__umbra: drop-shadow(0px 1px 1px rgba(var(--mdw-color__shadow), 0.30));
|
|
20
|
+
--mdw-surface__filter__3__umbra: drop-shadow(0px 1px 1.5px rgba(var(--mdw-color__shadow), 0.30));
|
|
21
|
+
--mdw-surface__filter__4__umbra: drop-shadow(0px 2px 1.5px rgba(var(--mdw-color__shadow), 0.30));
|
|
22
|
+
--mdw-surface__filter__5__umbra: drop-shadow(0px 4px 2px rgba(var(--mdw-color__shadow), 0.30));
|
|
23
|
+
|
|
24
|
+
--mdw-surface__box-shadow__1__penumbra: 0px 1px 3px 1px rgba(var(--mdw-color__shadow), 0.15);
|
|
25
|
+
--mdw-surface__box-shadow__2__penumbra: 0px 2px 6px 2px rgba(var(--mdw-color__shadow), 0.15);
|
|
26
|
+
--mdw-surface__box-shadow__3__penumbra: 0px 4px 8px 3px rgba(var(--mdw-color__shadow), 0.15);
|
|
27
|
+
--mdw-surface__box-shadow__4__penumbra: 0px 6px 10px 4px rgba(var(--mdw-color__shadow), 0.15);
|
|
28
|
+
--mdw-surface__box-shadow__5__penumbra: 0px 8px 12px 6px rgba(var(--mdw-color__shadow), 0.15);
|
|
29
|
+
|
|
30
|
+
--mdw-elevation__filter__0__penumbra: drop-shadow(0px 1px 2.5px rgba(var(--mdw-color__shadow), 0));
|
|
31
|
+
--mdw-elevation__filter__1__penumbra: drop-shadow(0px 1px 2.5px rgba(var(--mdw-color__shadow), 0.25));
|
|
32
|
+
--mdw-elevation__filter__2__penumbra: drop-shadow(0px 2px 5px rgba(var(--mdw-color__shadow), 0.25));
|
|
33
|
+
--mdw-elevation__filter__3__penumbra: drop-shadow(0px 4px 7px rgba(var(--mdw-color__shadow), 0.263));
|
|
34
|
+
--mdw-elevation__filter__4__penumbra: drop-shadow(0px 6px 9px rgba(var(--mdw-color__shadow), 0.27));
|
|
35
|
+
--mdw-elevation__filter__5__penumbra: drop-shadow(0px 8px 12px rgba(var(--mdw-color__shadow), 0.30));
|
|
36
|
+
|
|
37
|
+
--mdw-elevation__filter__0: var(--mdw-surface__shadow__0__umbra) var(--mdw-surface__shadow__0__penumbra);
|
|
38
|
+
--mdw-elevation__filter__1: var(--mdw-surface__shadow__1__umbra) var(--mdw-surface__shadow__1__penumbra);
|
|
39
|
+
--mdw-elevation__filter__2: var(--mdw-surface__shadow__2__umbra) var(--mdw-surface__shadow__2__penumbra);
|
|
40
|
+
--mdw-elevation__filter__3: var(--mdw-surface__shadow__3__umbra) var(--mdw-surface__shadow__3__penumbra);
|
|
41
|
+
--mdw-elevation__filter__4: var(--mdw-surface__shadow__4__umbra) var(--mdw-surface__shadow__4__penumbra);
|
|
42
|
+
--mdw-elevation__filter__5: var(--mdw-surface__shadow__5__umbra) var(--mdw-surface__shadow__5__penumbra);
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
--mdw-elevation__rgb: var(--mdw-color__shadow);
|
|
46
|
+
|
|
47
|
+
--mdw-elevation__box-shadow__0: 0px 1px 1px 0px rgba(var(--mdw-elevation__rgb), 0.00), 0px 0px 1px 1px rgba(var(--mdw-elevation__rgb), 0.00);
|
|
48
|
+
--mdw-elevation__box-shadow__1: 0px 1px 2px 0px rgba(var(--mdw-elevation__rgb), 0.30), 0px 1px 3px 1px rgba(var(--mdw-elevation__rgb), 0.15);
|
|
49
|
+
--mdw-elevation__box-shadow__2: 0px 1px 2px 0px rgba(var(--mdw-elevation__rgb), 0.30), 0px 2px 6px 2px rgba(var(--mdw-elevation__rgb), 0.15);
|
|
50
|
+
--mdw-elevation__box-shadow__3: 0px 1px 3px 0px rgba(var(--mdw-elevation__rgb), 0.30), 0px 4px 8px 3px rgba(var(--mdw-elevation__rgb), 0.15);
|
|
51
|
+
--mdw-elevation__box-shadow__4: 0px 2px 3px 0px rgba(var(--mdw-elevation__rgb), 0.30), 0px 6px 10px 4px rgba(var(--mdw-elevation__rgb), 0.15);
|
|
52
|
+
--mdw-elevation__box-shadow__5: 0px 4px 4px 0px rgba(var(--mdw-elevation__rgb), 0.30), 0px 8px 12px 6px rgba(var(--mdw-elevation__rgb), 0.15);
|
|
53
|
+
|
|
54
|
+
--mdw-elevation__drop-shadow__0: drop-shadow(0px 1px 001px rgba(var(--mdw-elevation__rgb),000)) drop-shadow(0px 1px 2.5px rgba(var(--mdw-elevation__rgb),00000));
|
|
55
|
+
--mdw-elevation__drop-shadow__1: drop-shadow(0px 1px 001px rgba(var(--mdw-elevation__rgb),0.3)) drop-shadow(0px 1px 2.5px rgba(var(--mdw-elevation__rgb),0.250));
|
|
56
|
+
--mdw-elevation__drop-shadow__2: drop-shadow(0px 1px 001px rgba(var(--mdw-elevation__rgb),0.3)) drop-shadow(0px 2px 005px rgba(var(--mdw-elevation__rgb),0.250));
|
|
57
|
+
--mdw-elevation__drop-shadow__3: drop-shadow(0px 1px 1.5px rgba(var(--mdw-elevation__rgb),0.3)) drop-shadow(0px 4px 007px rgba(var(--mdw-elevation__rgb),0.263));
|
|
58
|
+
--mdw-elevation__drop-shadow__4: drop-shadow(0px 2px 1.5px rgba(var(--mdw-elevation__rgb),0.3)) drop-shadow(0px 6px 009px rgba(var(--mdw-elevation__rgb),0.270));
|
|
59
|
+
--mdw-elevation__drop-shadow__5: drop-shadow(0px 4px 2.0px rgba(var(--mdw-elevation__rgb),0.3)) drop-shadow(0px 8px 012px rgba(var(--mdw-elevation__rgb),0.300));
|
|
60
|
+
}`;
|
|
61
|
+
}
|
package/mixins/FlexableMixin.js
CHANGED
|
@@ -1,109 +1,157 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Layout helper mixin providing flexible box utilities (gap, padding, axis).
|
|
2
3
|
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
3
4
|
*/
|
|
4
5
|
export default function FlexableMixin(Base) {
|
|
5
6
|
return Base
|
|
6
7
|
.observe({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
/** Set `display: block` on the host (boolean) */
|
|
9
|
+
block: 'boolean',
|
|
10
|
+
/** Use inline flex layout: `display: inline-flex` (boolean) */
|
|
11
|
+
inline: 'boolean',
|
|
12
|
+
/** Switch main axis to horizontal: `flex-direction: row` (boolean) */
|
|
13
|
+
row: 'boolean',
|
|
14
|
+
/**
|
|
15
|
+
* Main-axis alignment / justification.
|
|
16
|
+
* Allowed: 'start'|'center'|'end'|'between'|'around'|'stretch'|'baseline'.
|
|
17
|
+
* Default: 'start'.
|
|
18
|
+
*/
|
|
13
19
|
x: {
|
|
14
20
|
type: 'string',
|
|
15
21
|
empty: 'start',
|
|
16
|
-
/** @type {'start'|'center'|'end'|'between'|'around'|'stretch'} */
|
|
22
|
+
/** @type {'start'|'center'|'end'|'between'|'around'|'stretch'|'baseline'} */
|
|
17
23
|
value: 'start',
|
|
18
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* Cross-axis alignment / alignment of items.
|
|
27
|
+
* Same allowed values as `x`. Default: 'start'.
|
|
28
|
+
*/
|
|
19
29
|
y: {
|
|
20
30
|
type: 'string',
|
|
21
31
|
empty: 'start',
|
|
22
|
-
/** @type {'start'|'center'|'end'|'between'|'around'|'stretch'} */
|
|
32
|
+
/** @type {'start'|'center'|'end'|'between'|'around'|'stretch'|'baseline'} */
|
|
23
33
|
value: 'start',
|
|
24
34
|
},
|
|
35
|
+
/** Gap between children. Accepts preset numeric strings (e.g. '8') mapped to px, or floats. */
|
|
25
36
|
gap: 'float',
|
|
26
|
-
|
|
37
|
+
/** Padding preset or numeric value (e.g. 'pane', '8', '16'). */
|
|
38
|
+
padding: 'string',
|
|
27
39
|
})
|
|
28
40
|
.css`
|
|
29
41
|
/* https://css-tricks.com/snippets/css/a-guide-to-flexbox/ */
|
|
30
42
|
|
|
31
43
|
:host{
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
|
|
32
47
|
box-sizing: border-box;
|
|
48
|
+
|
|
33
49
|
}
|
|
34
50
|
|
|
35
|
-
:host([
|
|
36
|
-
display:flex;
|
|
51
|
+
:host(:is([inline])) {
|
|
52
|
+
display: inline-flex;
|
|
37
53
|
}
|
|
38
54
|
|
|
39
|
-
:host([
|
|
40
|
-
|
|
55
|
+
:host(:is([block])) {
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
:host(:is([inline][block])) {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host(:is([row])) {
|
|
65
|
+
flex-direction: row;
|
|
41
66
|
}
|
|
42
67
|
|
|
43
|
-
:host(:
|
|
68
|
+
:host(:is([row][y="start"], [x="start"]:not([row]))) {
|
|
44
69
|
align-items: flex-start;
|
|
45
70
|
}
|
|
46
71
|
|
|
47
|
-
:host(:
|
|
72
|
+
:host(:is([row][y="end"], [x="end"]:not([row]))) {
|
|
48
73
|
align-items: flex-end;
|
|
49
74
|
}
|
|
50
75
|
|
|
51
|
-
:host(:
|
|
76
|
+
:host(:is([row][y="center"], [x="center"]:not([row]))) {
|
|
52
77
|
align-items: center;
|
|
53
78
|
}
|
|
54
79
|
|
|
55
|
-
:host(:
|
|
80
|
+
:host(:is([row][y="between"], [x="between"]:not([row]))) {
|
|
56
81
|
align-items: space-between;
|
|
57
82
|
}
|
|
58
83
|
|
|
59
|
-
:host(:
|
|
84
|
+
:host(:is([row][y="around"], [x="around"]:not([row]))) {
|
|
60
85
|
align-items: space-around;
|
|
61
86
|
}
|
|
62
87
|
|
|
63
|
-
:host(:
|
|
88
|
+
:host(:is([row][y="baseline"], [x="baseline"]:not([row]))) {
|
|
89
|
+
align-items: baseline;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host(:is([row][y="stretch"], [x="stretch"]:not([row]))) {
|
|
64
93
|
align-items: stretch;
|
|
65
94
|
}
|
|
66
95
|
|
|
67
|
-
:host(:
|
|
96
|
+
:host(:is([row][x="start"], [y="start"]:not([row]))) {
|
|
68
97
|
justify-content: flex-start;
|
|
69
98
|
}
|
|
70
99
|
|
|
71
|
-
:host(:
|
|
100
|
+
:host(:is([row][x="end"], [y="end"]:not([row]))) {
|
|
72
101
|
justify-content: flex-end;
|
|
73
102
|
}
|
|
74
103
|
|
|
75
|
-
:host(:
|
|
104
|
+
:host(:is([row][x="center"], [y="center"]:not([row]))) {
|
|
76
105
|
justify-content: center;
|
|
77
106
|
}
|
|
78
107
|
|
|
79
|
-
:host(:
|
|
108
|
+
:host(:is([row][x="between"], [y="between"]:not([row]))) {
|
|
80
109
|
justify-content: space-between;
|
|
81
110
|
}
|
|
82
111
|
|
|
83
|
-
:host(:
|
|
112
|
+
:host(:is([row][x="stretch"], [y="stretch"]:not([row]))) {
|
|
84
113
|
justify-content: stretch;
|
|
85
114
|
}
|
|
86
115
|
|
|
87
|
-
:host([wrap]) {
|
|
116
|
+
:host(:is([wrap])) {
|
|
88
117
|
flex-wrap: wrap;
|
|
89
118
|
}
|
|
90
119
|
|
|
91
|
-
:host([wrap="reverse"]) {
|
|
120
|
+
:host(:is([wrap="reverse"])) {
|
|
92
121
|
flex-wrap: wrap-reverse;
|
|
93
122
|
}
|
|
94
123
|
|
|
95
|
-
:host([gap
|
|
96
|
-
:host([gap="
|
|
97
|
-
:host([gap="
|
|
98
|
-
:host([gap="
|
|
99
|
-
:host([gap="
|
|
100
|
-
:host([gap="
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
:host([padding
|
|
104
|
-
:host([padding="
|
|
105
|
-
:host([padding="
|
|
106
|
-
:host([padding="
|
|
107
|
-
:host([padding="
|
|
124
|
+
:host(:is([gap])) {gap: 0;}
|
|
125
|
+
:host(:is([gap="4"])) {gap: 4px;}
|
|
126
|
+
:host(:is([gap="8"])) {gap: 8px;}
|
|
127
|
+
:host(:is([gap="12"])) {gap: 12px;}
|
|
128
|
+
:host(:is([gap="16"])) {gap: 16px;}
|
|
129
|
+
:host(:is([gap="20"])) {gap: 20px;}
|
|
130
|
+
:host(:is([gap="24"])) {gap: 24px;}
|
|
131
|
+
|
|
132
|
+
:host(:is([padding])) {padding: 0;}
|
|
133
|
+
:host(:is([padding="pane"])) { padding-inline: var(--mdw-pane__padding-inline, 0) }
|
|
134
|
+
:host(:is([padding="4"])) {padding: 4px;}
|
|
135
|
+
:host(:is([padding="8"])) {padding: 8px;}
|
|
136
|
+
:host(:is([padding="12"])) {padding: 12px;}
|
|
137
|
+
:host(:is([padding="16"])) {padding: 16px;}
|
|
138
|
+
:host(:is([padding="20"])) {padding: 20px;}
|
|
139
|
+
:host(:is([padding="24"])) {padding: 24px;}
|
|
140
|
+
:host(:is([padding-x])) {padding-inline: 0;}
|
|
141
|
+
:host(:is([padding-x="4"])) {padding-inline: 4px;}
|
|
142
|
+
:host(:is([padding-x="8"])) {padding-inline: 8px;}
|
|
143
|
+
:host(:is([padding-x="12"])) {padding-inline: 12px;}
|
|
144
|
+
:host(:is([padding-x="16"])) {padding-inline: 16px;}
|
|
145
|
+
:host(:is([padding-x="20"])) {padding-inline: 20px;}
|
|
146
|
+
:host(:is([padding-x="24"])) {padding-inline: 24px;}
|
|
147
|
+
:host(:is([padding-y])) {padding-block: 0;}
|
|
148
|
+
:host(:is([padding-y="4"])) {padding-block: 4px;}
|
|
149
|
+
:host(:is([padding-y="8"])) {padding-block: 8px;}
|
|
150
|
+
:host(:is([padding-y="12"])) {padding-block: 12px;}
|
|
151
|
+
:host(:is([padding-y="16"])) {padding-block: 16px;}
|
|
152
|
+
:host(:is([padding-y="20"])) {padding-block: 20px;}
|
|
153
|
+
:host(:is([padding-y="24"])) {padding-block: 24px;}
|
|
154
|
+
|
|
155
|
+
|
|
108
156
|
`;
|
|
109
157
|
}
|