@shortfuse/materialdesignweb 0.7.6 → 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 +87 -90
- package/bin/mdw-css.js +1 -1
- package/components/Badge.js +14 -7
- package/components/Body.js +3 -0
- package/components/BottomAppBar.js +4 -13
- package/components/BottomSheet.js +424 -0
- package/components/Box.js +20 -28
- package/components/Button.js +85 -79
- package/components/Button.md +9 -9
- package/components/Card.js +60 -72
- package/components/Checkbox.js +33 -42
- package/components/CheckboxIcon.js +11 -29
- package/components/Chip.js +13 -11
- package/components/Dialog.js +214 -394
- package/components/DialogActions.js +2 -2
- package/components/Display.js +55 -0
- package/components/Divider.js +3 -3
- package/components/Fab.js +83 -18
- package/components/FabContainer.js +48 -0
- package/components/FilterChip.js +35 -33
- package/components/Grid.js +176 -0
- package/components/Headline.js +5 -28
- package/components/Icon.js +61 -76
- package/components/IconButton.js +72 -126
- package/components/Input.js +859 -1
- package/components/InputChip.js +161 -0
- package/components/Label.js +3 -0
- package/components/List.js +4 -6
- package/components/ListItem.js +46 -30
- package/components/ListOption.js +86 -53
- package/components/Listbox.js +248 -0
- package/components/Menu.js +69 -528
- package/components/MenuItem.js +33 -36
- package/components/NavBar.js +49 -86
- package/components/NavDrawer.js +16 -15
- package/components/NavDrawerItem.js +4 -5
- package/components/NavItem.js +58 -41
- package/components/NavRail.js +30 -20
- package/components/NavRailItem.js +8 -3
- package/components/Page.js +105 -0
- package/components/Pane.js +11 -274
- package/components/Popup.js +29 -0
- package/components/Progress.js +24 -23
- package/components/Radio.js +40 -36
- package/components/RadioIcon.js +12 -16
- package/components/Ripple.js +13 -10
- package/components/Root.js +209 -0
- package/components/Scrim.js +87 -0
- package/components/Search.js +77 -0
- package/components/SegmentedButton.js +33 -45
- package/components/SegmentedButtonGroup.js +25 -13
- package/components/Select.js +10 -11
- package/components/Shape.js +5 -65
- package/components/SideSheet.js +308 -0
- package/components/Slider.js +108 -78
- package/components/Snackbar.js +26 -21
- package/components/SnackbarContainer.js +42 -0
- package/components/Surface.js +17 -12
- package/components/Switch.js +45 -24
- package/components/SwitchIcon.js +49 -39
- package/components/Tab.js +64 -43
- package/components/TabContent.js +5 -3
- package/components/TabList.js +62 -34
- package/components/TabPanel.js +11 -8
- package/components/Table.js +116 -0
- package/components/TextArea.js +54 -50
- package/components/Title.js +4 -9
- package/components/Tooltip.js +44 -22
- package/components/TopAppBar.js +68 -172
- package/constants/shapes.js +36 -0
- package/constants/typography.js +127 -0
- package/core/Composition.js +1164 -645
- package/core/CompositionAdapter.js +314 -0
- package/core/CustomElement.js +701 -286
- package/core/css.js +121 -15
- package/core/customTypes.js +157 -40
- package/core/dom.js +17 -11
- package/{utils → core}/jsonMergePatch.js +42 -18
- package/core/observe.js +343 -244
- package/core/optimizations.js +23 -0
- package/core/template.js +19 -56
- package/core/uid.js +13 -0
- package/dist/index.min.js +85 -184
- package/dist/index.min.js.map +4 -4
- package/dist/meta.json +1 -1
- package/dom/HTMLOptionsCollectionProxy.js +106 -0
- package/loaders/palette.js +13 -0
- package/loaders/theme.js +12 -0
- package/mixins/AriaReflectorMixin.js +53 -14
- package/mixins/AriaToolbarMixin.js +5 -3
- package/mixins/ControlMixin.js +92 -41
- package/mixins/DelegatesFocusMixin.js +54 -0
- package/mixins/DensityMixin.js +2 -3
- package/mixins/ElevationMixin.js +62 -0
- package/mixins/FlexableMixin.js +67 -39
- package/mixins/FormAssociatedMixin.js +71 -16
- package/mixins/HyperlinkMixin.js +66 -0
- package/mixins/InputMixin.js +205 -39
- package/mixins/KeyboardNavMixin.js +22 -7
- package/mixins/NavigationListenerMixin.js +33 -0
- package/mixins/PopupMixin.js +725 -0
- package/mixins/RTLObserverMixin.js +0 -1
- package/mixins/ResizeObserverMixin.js +16 -5
- package/mixins/RippleMixin.js +11 -10
- package/mixins/ScrollListenerMixin.js +42 -33
- package/mixins/SemiStickyMixin.js +97 -0
- package/mixins/ShapeMaskedMixin.js +117 -0
- package/mixins/ShapeMixin.js +17 -194
- package/mixins/StateMixin.js +80 -39
- package/mixins/TextFieldMixin.js +139 -183
- package/mixins/ThemableMixin.js +71 -161
- package/mixins/TooltipTriggerMixin.js +292 -366
- package/mixins/TouchTargetMixin.js +5 -4
- package/mixins/TypographyMixin.js +121 -0
- package/package.json +111 -71
- package/services/rtl.js +10 -0
- package/services/svgAlias.js +17 -0
- package/{theming/index.js → services/theme.js} +25 -175
- 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/{hct → material-color}/blend.js +8 -10
- package/utils/{hct → material-color/hct}/Cam16.js +196 -69
- package/utils/{hct → material-color/hct}/Hct.js +61 -19
- package/utils/{hct → material-color/hct}/ViewingConditions.js +3 -3
- package/utils/{hct → material-color/hct}/hctSolver.js +9 -16
- package/utils/{hct → material-color}/helper.js +11 -18
- package/utils/{hct → material-color/palettes}/CorePalette.js +79 -19
- package/utils/{hct → material-color/palettes}/TonalPalette.js +12 -4
- package/utils/material-color/scheme/Scheme.js +376 -0
- package/utils/{hct/colorUtils.js → material-color/utils/color.js} +61 -1
- package/utils/pixelmatch.js +360 -0
- package/utils/popup.js +127 -30
- package/utils/searchParams.js +19 -0
- package/components/ExtendedFab.js +0 -36
- package/components/Layout.js +0 -35
- package/components/ListSelect.js +0 -220
- package/components/Nav.js +0 -40
- package/components/Option.js +0 -91
- package/core/ICustomElement.d.ts +0 -291
- package/core/ICustomElement.js +0 -1
- package/core/identify.js +0 -40
- package/core/typings.d.ts +0 -136
- package/core/typings.js +0 -1
- package/mixins/SurfaceMixin.js +0 -181
- package/theming/loader.js +0 -22
- package/utils/hct/Scheme.js +0 -587
- /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
- /package/utils/{hct/mathUtils.js → material-color/utils/math.js} +0 -0
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
/** @param {typeof import('../core/CustomElement.js').default} Base */
|
|
2
2
|
export default function AriaReflectorMixin(Base) {
|
|
3
3
|
return Base
|
|
4
|
-
.extend()
|
|
5
4
|
.observe({
|
|
6
5
|
_ariaRole: 'string',
|
|
7
|
-
})
|
|
6
|
+
})
|
|
7
|
+
.set({
|
|
8
|
+
/**
|
|
9
|
+
* Browsers that do no support AriaMixin in ElementInternals need to have
|
|
10
|
+
* their attributes after construction.
|
|
11
|
+
* @type {Map<string, string>}
|
|
12
|
+
*/
|
|
13
|
+
onConnectAriaValues: null,
|
|
14
|
+
hasFiredConnected: false,
|
|
15
|
+
})
|
|
16
|
+
.methods({
|
|
17
|
+
/**
|
|
18
|
+
* @param {keyof HTMLElement & keyof ElementInternals} name
|
|
19
|
+
*/
|
|
20
|
+
readAriaProperty(name) {
|
|
21
|
+
if (this.elementInternals && name in this.elementInternals) {
|
|
22
|
+
return this.elementInternals[name];
|
|
23
|
+
} if (name in this) {
|
|
24
|
+
return this[name];
|
|
25
|
+
}
|
|
26
|
+
// console.warn('Unknown ARIA property', name, this);
|
|
27
|
+
/** @type {string} */
|
|
28
|
+
let attrName = name;
|
|
29
|
+
if (attrName.startsWith('aria')) {
|
|
30
|
+
attrName = `aria-${attrName.slice(4).toLowerCase()}`;
|
|
31
|
+
}
|
|
32
|
+
return this.getAttribute(name);
|
|
33
|
+
},
|
|
8
34
|
/**
|
|
9
35
|
* @param {keyof HTMLElement & keyof ElementInternals} name
|
|
10
36
|
* @param {string} value
|
|
@@ -12,20 +38,26 @@ export default function AriaReflectorMixin(Base) {
|
|
|
12
38
|
updateAriaProperty(name, value) {
|
|
13
39
|
if (this.elementInternals && name in this.elementInternals) {
|
|
14
40
|
this.elementInternals[name] = value;
|
|
15
|
-
} else if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
console.warn('Unknown ARIA property', name);
|
|
19
|
-
/** @type {string} */
|
|
20
|
-
let attrName = name;
|
|
21
|
-
if (attrName.startsWith('aria')) {
|
|
22
|
-
attrName = `aria-${attrName.slice(4).toLowerCase()}`;
|
|
23
|
-
}
|
|
24
|
-
if (value == null) {
|
|
25
|
-
this.removeAttribute(name);
|
|
41
|
+
} else if (this.isConnected) {
|
|
42
|
+
if (name in this) {
|
|
43
|
+
this[name] = value;
|
|
26
44
|
} else {
|
|
27
|
-
|
|
45
|
+
// console.warn('Unknown ARIA property', name, this);
|
|
46
|
+
/** @type {string} */
|
|
47
|
+
let attrName = name;
|
|
48
|
+
if (attrName.startsWith('aria')) {
|
|
49
|
+
attrName = `aria-${attrName.slice(4).toLowerCase()}`;
|
|
50
|
+
}
|
|
51
|
+
if (value == null) {
|
|
52
|
+
this.removeAttribute(name);
|
|
53
|
+
} else {
|
|
54
|
+
this.setAttribute(attrName, value);
|
|
55
|
+
}
|
|
28
56
|
}
|
|
57
|
+
} else {
|
|
58
|
+
this.onConnectAriaValues ??= new Map();
|
|
59
|
+
this.onConnectAriaValues.set(name, value);
|
|
60
|
+
// Elements should not add attributes during construction
|
|
29
61
|
}
|
|
30
62
|
},
|
|
31
63
|
})
|
|
@@ -36,5 +68,12 @@ export default function AriaReflectorMixin(Base) {
|
|
|
36
68
|
constructed() {
|
|
37
69
|
this.updateAriaProperty('role', this._ariaRole);
|
|
38
70
|
},
|
|
71
|
+
connected() {
|
|
72
|
+
if (!this.onConnectAriaValues) return;
|
|
73
|
+
for (const [key, value] of this.onConnectAriaValues) {
|
|
74
|
+
this.updateAriaProperty(key, value);
|
|
75
|
+
}
|
|
76
|
+
this.onConnectAriaValues = null;
|
|
77
|
+
},
|
|
39
78
|
});
|
|
40
79
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AriaReflectorMixin from './AriaReflectorMixin.js';
|
|
2
|
+
import KeyboardNavMixin from './KeyboardNavMixin.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
5
6
|
*/
|
|
6
7
|
export default function AriaToolbarMixin(Base) {
|
|
7
8
|
return Base
|
|
8
|
-
.mixin(
|
|
9
|
-
.
|
|
9
|
+
.mixin(AriaReflectorMixin)
|
|
10
|
+
.mixin(KeyboardNavMixin)
|
|
10
11
|
.set({
|
|
11
12
|
ariaOrientationDefault: 'horizontal',
|
|
13
|
+
_ariaRole: 'toolbar',
|
|
12
14
|
});
|
|
13
15
|
}
|
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 */
|
|
@@ -16,17 +18,25 @@ import FormAssociatedMixin from './FormAssociatedMixin.js';
|
|
|
16
18
|
export default function ControlMixin(Base) {
|
|
17
19
|
return Base
|
|
18
20
|
.mixin(FormAssociatedMixin)
|
|
19
|
-
.
|
|
21
|
+
.mixin(DelegatesFocusMixin)
|
|
20
22
|
.observe({
|
|
21
23
|
ariaLabel: 'string',
|
|
24
|
+
_slotInnerText: 'string',
|
|
22
25
|
})
|
|
23
26
|
.set({
|
|
24
|
-
delegatesFocus: true,
|
|
25
27
|
focusableOnDisabled: false,
|
|
26
28
|
controlTagName: 'input',
|
|
27
29
|
controlVoidElement: true,
|
|
30
|
+
_slotMutationObserver: null,
|
|
28
31
|
})
|
|
29
32
|
.methods({
|
|
33
|
+
/**
|
|
34
|
+
* Default behavior can be overridden
|
|
35
|
+
* @param {string} value
|
|
36
|
+
*/
|
|
37
|
+
_onControlValue(value) {
|
|
38
|
+
this._value = value;
|
|
39
|
+
},
|
|
30
40
|
onValueChangingContentAttribute() {
|
|
31
41
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
32
42
|
|
|
@@ -37,7 +47,7 @@ export default function ControlMixin(Base) {
|
|
|
37
47
|
control.setAttribute('value', ''); // Chrome needs to know to reset
|
|
38
48
|
}
|
|
39
49
|
// Changing control attribute may change the value (eg: min/max)
|
|
40
|
-
this.
|
|
50
|
+
this._onControlValue(control.value);
|
|
41
51
|
},
|
|
42
52
|
/** @type {HTMLElement['focus']} */
|
|
43
53
|
focus(...options) {
|
|
@@ -45,20 +55,16 @@ export default function ControlMixin(Base) {
|
|
|
45
55
|
},
|
|
46
56
|
/** Redirect click requests to control itself */
|
|
47
57
|
click() {
|
|
48
|
-
|
|
58
|
+
if (this.disabledState) return;
|
|
49
59
|
this.refs.control.click();
|
|
50
60
|
},
|
|
51
61
|
})
|
|
52
62
|
.define({
|
|
53
63
|
stateTargetElement() { return this.refs.control; },
|
|
54
|
-
form() { return this.elementInternals.form; },
|
|
55
|
-
validity() { return this.elementInternals.validity; },
|
|
56
|
-
validationMessage() { return this.elementInternals.validationMessage; },
|
|
57
|
-
willValidate() { return this.elementInternals.willValidate; },
|
|
58
|
-
labels() { return this.elementInternals.labels; },
|
|
59
64
|
})
|
|
60
65
|
.methods({
|
|
61
66
|
checkValidity() {
|
|
67
|
+
if (!this.willValidate) return true;
|
|
62
68
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
63
69
|
const validityState = control.checkValidity();
|
|
64
70
|
/** @type {Partial<ValidityState>} */
|
|
@@ -69,7 +75,7 @@ export default function ControlMixin(Base) {
|
|
|
69
75
|
// @ts-ignore Skip cast
|
|
70
76
|
newValidity[key] = control.validity[key];
|
|
71
77
|
}
|
|
72
|
-
this.elementInternals.setValidity(newValidity, control.validationMessage);
|
|
78
|
+
this.elementInternals.setValidity(newValidity, control.validationMessage, control);
|
|
73
79
|
this._invalid = !validityState;
|
|
74
80
|
this._validationMessage = control.validationMessage;
|
|
75
81
|
this._badInput = control.validity.badInput;
|
|
@@ -87,22 +93,39 @@ export default function ControlMixin(Base) {
|
|
|
87
93
|
setCustomValidity(error) {
|
|
88
94
|
/** @type {HTMLControlElement} */ (this.refs.control).setCustomValidity(error);
|
|
89
95
|
this.checkValidity();
|
|
96
|
+
this.elementInternals.setValidity(
|
|
97
|
+
{
|
|
98
|
+
...this.elementInternals.validity,
|
|
99
|
+
customError: !!error,
|
|
100
|
+
},
|
|
101
|
+
this.elementInternals.validationMessage || error,
|
|
102
|
+
this.refs.control,
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
.observe({
|
|
107
|
+
_computedAriaLabel({ ariaLabel, _slotInnerText }) {
|
|
108
|
+
return ariaLabel?.trim() || _slotInnerText?.trim() || null;
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
.expressions({
|
|
112
|
+
_computedAriaLabelledby({ _computedAriaLabel }) {
|
|
113
|
+
return _computedAriaLabel ? null : 'slot';
|
|
90
114
|
},
|
|
115
|
+
})
|
|
91
116
|
|
|
117
|
+
.recompose(({ template, html, element }) => {
|
|
118
|
+
template.append(html`
|
|
119
|
+
<${element.controlTagName} id=control
|
|
120
|
+
aria-label={_computedAriaLabel}
|
|
121
|
+
aria-labelledby={_computedAriaLabelledby}
|
|
122
|
+
part=control
|
|
123
|
+
form-disabled={disabledState}
|
|
124
|
+
type={type}
|
|
125
|
+
>${element.controlVoidElement ? '' : `</${element.controlTagName}>`}
|
|
126
|
+
`);
|
|
92
127
|
})
|
|
93
128
|
.on({
|
|
94
|
-
// Wait until controlTagName is settled before templating
|
|
95
|
-
composed({ template, html }) {
|
|
96
|
-
template.append(html`
|
|
97
|
-
<label id=label disabled={disabledState}>
|
|
98
|
-
<${this.controlTagName} id=control
|
|
99
|
-
aria-labelledby=${({ ariaLabel }) => (ariaLabel ? null : '#slot')}
|
|
100
|
-
aria-label={ariaLabel}
|
|
101
|
-
type={type}
|
|
102
|
-
>${this.controlVoidElement ? '' : `</${this.controlTagName}>`}
|
|
103
|
-
</label>
|
|
104
|
-
`);
|
|
105
|
-
},
|
|
106
129
|
disabledStateChanged(oldValue, newValue) {
|
|
107
130
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
108
131
|
control.setAttribute('aria-disabled', `${newValue}`);
|
|
@@ -115,9 +138,17 @@ export default function ControlMixin(Base) {
|
|
|
115
138
|
}
|
|
116
139
|
}
|
|
117
140
|
},
|
|
141
|
+
readOnlyChanged(oldValue, newValue) {
|
|
142
|
+
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
143
|
+
if (this.type === 'checkbox') {
|
|
144
|
+
control.setAttribute('aria-readonly', newValue ? 'true' : 'false');
|
|
145
|
+
} else {
|
|
146
|
+
control.removeAttribute('aria-readonly');
|
|
147
|
+
}
|
|
148
|
+
},
|
|
118
149
|
constructed() {
|
|
119
150
|
const control = /** @type {HTMLControlElement} */ (this.refs.control);
|
|
120
|
-
this.
|
|
151
|
+
this._onControlValue(control.value);
|
|
121
152
|
},
|
|
122
153
|
connected() {
|
|
123
154
|
// Expose this element as focusable
|
|
@@ -134,8 +165,14 @@ export default function ControlMixin(Base) {
|
|
|
134
165
|
})
|
|
135
166
|
.childEvents({
|
|
136
167
|
control: {
|
|
168
|
+
click(e) {
|
|
169
|
+
if ((this.type === 'checkbox' && this.readOnly)
|
|
170
|
+
|| (this.focusableOnDisabled && this.disabledState)) {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
e.stopImmediatePropagation();
|
|
173
|
+
}
|
|
174
|
+
},
|
|
137
175
|
input({ currentTarget }) {
|
|
138
|
-
console.debug('ControlMixin: input');
|
|
139
176
|
const control = /** @type {HTMLControlElement} */ (currentTarget);
|
|
140
177
|
if (this.validity.valid) {
|
|
141
178
|
// Track internally
|
|
@@ -145,18 +182,37 @@ export default function ControlMixin(Base) {
|
|
|
145
182
|
// Perform check in case user has validated
|
|
146
183
|
this.checkValidity();
|
|
147
184
|
}
|
|
148
|
-
this.
|
|
185
|
+
this._onControlValue(control.value);
|
|
149
186
|
},
|
|
150
187
|
change({ currentTarget }) {
|
|
151
|
-
console.debug('ControlMixin: change');
|
|
152
188
|
const control = /** @type {HTMLControlElement} */ (currentTarget);
|
|
153
189
|
this._valueDirty = true;
|
|
154
|
-
this.
|
|
190
|
+
this._onControlValue(control.value);
|
|
155
191
|
this.checkValidity();
|
|
156
|
-
// Change event is NOT composed. Needs to escape shadow DOM
|
|
157
|
-
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
158
192
|
},
|
|
159
193
|
},
|
|
194
|
+
slot: (FIREFOX_VERSION < 116 || SAFARI_VERSION) ? {
|
|
195
|
+
slotchange({ currentTarget }) {
|
|
196
|
+
// Firefox and Safari will not apply label from slots.
|
|
197
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1826194
|
|
198
|
+
// https://commits.webkit.org/263644@main
|
|
199
|
+
// https://bugs.webkit.org/show_bug.cgi?id=260772
|
|
200
|
+
this._slotInnerText = this.textContent;
|
|
201
|
+
if (!this._slotMutationObserver) {
|
|
202
|
+
this._slotMutationObserver = new MutationObserver(() => {
|
|
203
|
+
this._slotInnerText = this.textContent;
|
|
204
|
+
});
|
|
205
|
+
this._slotMutationObserver.observe(currentTarget, { characterData: true });
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
} : {},
|
|
209
|
+
})
|
|
210
|
+
.rootEvents({
|
|
211
|
+
change(event) {
|
|
212
|
+
// Change event is NOT composed. Needs to escape shadow DOM
|
|
213
|
+
// @ts-ignore skip constructor cast
|
|
214
|
+
this.dispatchEvent(new event.constructor(event.type, event));
|
|
215
|
+
},
|
|
160
216
|
})
|
|
161
217
|
.css`
|
|
162
218
|
:host {
|
|
@@ -167,13 +223,7 @@ export default function ControlMixin(Base) {
|
|
|
167
223
|
:host(::-moz-focus-inner) {
|
|
168
224
|
border: 0;
|
|
169
225
|
}
|
|
170
|
-
|
|
171
|
-
#label {
|
|
172
|
-
display: contents;
|
|
173
|
-
|
|
174
|
-
pointer-events: none;
|
|
175
|
-
}
|
|
176
|
-
|
|
226
|
+
|
|
177
227
|
#control {
|
|
178
228
|
/* Control is the touch target */
|
|
179
229
|
/* Firefox requires at least 1px "visible" for screen reading */
|
|
@@ -181,7 +231,11 @@ export default function ControlMixin(Base) {
|
|
|
181
231
|
/* Chrome will not focus with visibility:hidden */
|
|
182
232
|
|
|
183
233
|
position: absolute;
|
|
184
|
-
|
|
234
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
235
|
+
top: 50%;
|
|
236
|
+
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
237
|
+
left: 50%;
|
|
238
|
+
|
|
185
239
|
/* --mdw-device-pixel-ratio: 1; */
|
|
186
240
|
|
|
187
241
|
block-size: 100%;
|
|
@@ -198,15 +252,12 @@ export default function ControlMixin(Base) {
|
|
|
198
252
|
|
|
199
253
|
cursor: auto;
|
|
200
254
|
outline: none;
|
|
201
|
-
|
|
202
|
-
pointer-events: auto;
|
|
203
|
-
|
|
204
255
|
transform: translateX(-50%) translateY(-50%);
|
|
205
256
|
|
|
206
257
|
/* Safari and Chrome will emit two click events if not at top of stack */
|
|
207
258
|
/* Allows up to 3 other layers (eg: ripple, outline) */
|
|
208
259
|
z-index: 4;
|
|
209
|
-
|
|
260
|
+
|
|
210
261
|
background-color: transparent;
|
|
211
262
|
|
|
212
263
|
border-radius: 0;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CHROME_VERSION, isFocused } from '../core/dom.js';
|
|
2
|
+
|
|
3
|
+
/** @param {typeof import('../core/CustomElement.js').default} Base */
|
|
4
|
+
export default function DelegatesFocusMixin(Base) {
|
|
5
|
+
return Base
|
|
6
|
+
.set({
|
|
7
|
+
delegatesFocus: true,
|
|
8
|
+
})
|
|
9
|
+
.extend(CHROME_VERSION >= 111
|
|
10
|
+
? (BaseClass) => BaseClass
|
|
11
|
+
: (BaseClass) => class extends BaseClass {
|
|
12
|
+
get tabIndex() {
|
|
13
|
+
return super.tabIndex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
set tabIndex(value) {
|
|
17
|
+
if (value === super.tabIndex && value !== -1) {
|
|
18
|
+
// Non -1 value already set
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (this.delegatesFocus && isFocused(this)) {
|
|
23
|
+
if (this.getAttribute('tabindex') === value.toString()) {
|
|
24
|
+
// Skip if possible
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Chrome blurs on tabindex changes with delegatesFocus
|
|
29
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1346606
|
|
30
|
+
/** @type {EventListener} */
|
|
31
|
+
const listener = (e) => {
|
|
32
|
+
e.stopImmediatePropagation();
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
if (e.type === 'blur') {
|
|
35
|
+
console.warn('Chromium bug 1346606: Tabindex change caused blur. Giving focusing back.', this);
|
|
36
|
+
this.focus();
|
|
37
|
+
} else {
|
|
38
|
+
console.warn(`Chromium bug 1346606: Blocking ${e.type} event.`, this);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
for (const type of ['blur', 'focus', 'focusout', 'focusin']) {
|
|
42
|
+
this.addEventListener(type, listener, { capture: true, once: true });
|
|
43
|
+
}
|
|
44
|
+
super.tabIndex = value;
|
|
45
|
+
for (const type of ['blur', 'focus', 'focusout', 'focusin']) {
|
|
46
|
+
this.removeEventListener(type, listener, { capture: true });
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
super.tabIndex = value;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
package/mixins/DensityMixin.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @param {typeof import('../core/CustomElement.js').default} Base */
|
|
2
2
|
export default function DensityMixin(Base) {
|
|
3
3
|
return Base
|
|
4
|
-
.extend()
|
|
5
4
|
.observe({
|
|
6
5
|
density: 'integer',
|
|
7
6
|
})
|
|
@@ -15,11 +14,11 @@ export default function DensityMixin(Base) {
|
|
|
15
14
|
|
|
16
15
|
:host([density="-1"]) { --mdw-density: -1; }
|
|
17
16
|
:host([density="-2"]) { --mdw-density: -2; }
|
|
18
|
-
:host([density="-3"]) { --mdw-density: -
|
|
17
|
+
:host([density="-3"]) { --mdw-density: -3; }
|
|
19
18
|
:host([density="-4"]) { --mdw-density: -4; }
|
|
20
19
|
:host([density="1"]) { --mdw-density: 1; }
|
|
21
20
|
:host([density="2"]) { --mdw-density: 2; }
|
|
22
21
|
:host([density="3"]) { --mdw-density: 3; }
|
|
23
|
-
:host([density="4"]) { --mdw-density:
|
|
22
|
+
:host([density="4"]) { --mdw-density: 4; }
|
|
24
23
|
`;
|
|
25
24
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Displays elevation via shadows or underlighting.
|
|
3
|
+
* Uses `filter:drop-shadow` to display elevation.
|
|
4
|
+
* @param {ReturnType<import('./StateMixin.js').default> & ReturnType<import('./ThemableMixin.js').default>} Base
|
|
5
|
+
*/
|
|
6
|
+
export default function ElevationMixin(Base) {
|
|
7
|
+
return Base
|
|
8
|
+
.css`:host {
|
|
9
|
+
|
|
10
|
+
/** Reference Properties */
|
|
11
|
+
/*
|
|
12
|
+
--mdw-surface__box-shadow__1__umbra: 0px 1px 2px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
13
|
+
--mdw-surface__box-shadow__2__umbra: 0px 1px 2px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
14
|
+
--mdw-surface__box-shadow__3__umbra: 0px 1px 3px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
15
|
+
--mdw-surface__box-shadow__4__umbra: 0px 2px 3px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
16
|
+
--mdw-surface__box-shadow__5__umbra: 0px 4px 4px 0px rgba(var(--mdw-color__shadow), 0.30);
|
|
17
|
+
|
|
18
|
+
--mdw-surface__filter__0__umbra: drop-shadow(0px 1px 1px rgba(var(--mdw-color__shadow), 0));
|
|
19
|
+
--mdw-surface__filter__1__umbra: drop-shadow(0px 1px 1px rgba(var(--mdw-color__shadow), 0.30));
|
|
20
|
+
--mdw-surface__filter__2__umbra: drop-shadow(0px 1px 1px rgba(var(--mdw-color__shadow), 0.30));
|
|
21
|
+
--mdw-surface__filter__3__umbra: drop-shadow(0px 1px 1.5px rgba(var(--mdw-color__shadow), 0.30));
|
|
22
|
+
--mdw-surface__filter__4__umbra: drop-shadow(0px 2px 1.5px rgba(var(--mdw-color__shadow), 0.30));
|
|
23
|
+
--mdw-surface__filter__5__umbra: drop-shadow(0px 4px 2px rgba(var(--mdw-color__shadow), 0.30));
|
|
24
|
+
|
|
25
|
+
--mdw-surface__box-shadow__1__penumbra: 0px 1px 3px 1px rgba(var(--mdw-color__shadow), 0.15);
|
|
26
|
+
--mdw-surface__box-shadow__2__penumbra: 0px 2px 6px 2px rgba(var(--mdw-color__shadow), 0.15);
|
|
27
|
+
--mdw-surface__box-shadow__3__penumbra: 0px 4px 8px 3px rgba(var(--mdw-color__shadow), 0.15);
|
|
28
|
+
--mdw-surface__box-shadow__4__penumbra: 0px 6px 10px 4px rgba(var(--mdw-color__shadow), 0.15);
|
|
29
|
+
--mdw-surface__box-shadow__5__penumbra: 0px 8px 12px 6px rgba(var(--mdw-color__shadow), 0.15);
|
|
30
|
+
|
|
31
|
+
--mdw-elevation__filter__0__penumbra: drop-shadow(0px 1px 2.5px rgba(var(--mdw-color__shadow), 0));
|
|
32
|
+
--mdw-elevation__filter__1__penumbra: drop-shadow(0px 1px 2.5px rgba(var(--mdw-color__shadow), 0.25));
|
|
33
|
+
--mdw-elevation__filter__2__penumbra: drop-shadow(0px 2px 5px rgba(var(--mdw-color__shadow), 0.25));
|
|
34
|
+
--mdw-elevation__filter__3__penumbra: drop-shadow(0px 4px 7px rgba(var(--mdw-color__shadow), 0.263));
|
|
35
|
+
--mdw-elevation__filter__4__penumbra: drop-shadow(0px 6px 9px rgba(var(--mdw-color__shadow), 0.27));
|
|
36
|
+
--mdw-elevation__filter__5__penumbra: drop-shadow(0px 8px 12px rgba(var(--mdw-color__shadow), 0.30));
|
|
37
|
+
|
|
38
|
+
--mdw-elevation__filter__0: var(--mdw-surface__shadow__0__umbra) var(--mdw-surface__shadow__0__penumbra);
|
|
39
|
+
--mdw-elevation__filter__1: var(--mdw-surface__shadow__1__umbra) var(--mdw-surface__shadow__1__penumbra);
|
|
40
|
+
--mdw-elevation__filter__2: var(--mdw-surface__shadow__2__umbra) var(--mdw-surface__shadow__2__penumbra);
|
|
41
|
+
--mdw-elevation__filter__3: var(--mdw-surface__shadow__3__umbra) var(--mdw-surface__shadow__3__penumbra);
|
|
42
|
+
--mdw-elevation__filter__4: var(--mdw-surface__shadow__4__umbra) var(--mdw-surface__shadow__4__penumbra);
|
|
43
|
+
--mdw-elevation__filter__5: var(--mdw-surface__shadow__5__umbra) var(--mdw-surface__shadow__5__penumbra);
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
--mdw-elevation__rgb: var(--mdw-color__shadow);
|
|
47
|
+
|
|
48
|
+
--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);
|
|
49
|
+
--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);
|
|
50
|
+
--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);
|
|
51
|
+
--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);
|
|
52
|
+
--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);
|
|
53
|
+
--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);
|
|
54
|
+
|
|
55
|
+
--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));
|
|
56
|
+
--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));
|
|
57
|
+
--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));
|
|
58
|
+
--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));
|
|
59
|
+
--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));
|
|
60
|
+
--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));
|
|
61
|
+
}`;
|
|
62
|
+
}
|
package/mixins/FlexableMixin.js
CHANGED
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default function FlexableMixin(Base) {
|
|
5
5
|
return Base
|
|
6
|
-
.extend()
|
|
7
6
|
.observe({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** @type {'row'|'column'} */
|
|
12
|
-
value: 'row',
|
|
13
|
-
},
|
|
7
|
+
block: 'boolean',
|
|
8
|
+
inline: 'boolean',
|
|
9
|
+
row: 'boolean',
|
|
14
10
|
x: {
|
|
15
11
|
type: 'string',
|
|
16
12
|
empty: 'start',
|
|
@@ -24,87 +20,119 @@ export default function FlexableMixin(Base) {
|
|
|
24
20
|
value: 'start',
|
|
25
21
|
},
|
|
26
22
|
gap: 'float',
|
|
27
|
-
padding: '
|
|
23
|
+
padding: 'string',
|
|
28
24
|
})
|
|
29
25
|
.css`
|
|
30
26
|
/* https://css-tricks.com/snippets/css/a-guide-to-flexbox/ */
|
|
31
27
|
|
|
32
28
|
:host{
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
|
|
33
32
|
box-sizing: border-box;
|
|
33
|
+
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
:host([
|
|
37
|
-
display:flex;
|
|
36
|
+
:host(:is([inline])) {
|
|
37
|
+
display: inline-flex;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
:host([
|
|
41
|
-
|
|
40
|
+
:host(:is([block])) {
|
|
41
|
+
display: block;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
:host(:is([inline][block])) {
|
|
46
|
+
display: inline-block;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
:host(:
|
|
49
|
+
:host(:is([row])) {
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host(:is([row][y="start"], [x="start"]:not([row]))) {
|
|
45
54
|
align-items: flex-start;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
|
-
:host(:
|
|
57
|
+
:host(:is([row][y="end"], [x="end"]:not([row]))) {
|
|
49
58
|
align-items: flex-end;
|
|
50
59
|
}
|
|
51
60
|
|
|
52
|
-
:host(:
|
|
61
|
+
:host(:is([row][y="center"], [x="center"]:not([row]))) {
|
|
53
62
|
align-items: center;
|
|
54
63
|
}
|
|
55
64
|
|
|
56
|
-
:host(:
|
|
65
|
+
:host(:is([row][y="between"], [x="between"]:not([row]))) {
|
|
57
66
|
align-items: space-between;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
|
-
:host(:
|
|
69
|
+
:host(:is([row][y="around"], [x="around"]:not([row]))) {
|
|
61
70
|
align-items: space-around;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
:host(:
|
|
73
|
+
:host(:is([row][y="stretch"], [x="stretch"]:not([row]))) {
|
|
65
74
|
align-items: stretch;
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
:host(:
|
|
77
|
+
:host(:is([row][x="start"], [y="start"]:not([row]))) {
|
|
69
78
|
justify-content: flex-start;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
:host(:
|
|
81
|
+
:host(:is([row][x="end"], [y="end"]:not([row]))) {
|
|
73
82
|
justify-content: flex-end;
|
|
74
83
|
}
|
|
75
84
|
|
|
76
|
-
:host(:
|
|
85
|
+
:host(:is([row][x="center"], [y="center"]:not([row]))) {
|
|
77
86
|
justify-content: center;
|
|
78
87
|
}
|
|
79
88
|
|
|
80
|
-
:host(:
|
|
89
|
+
:host(:is([row][x="between"], [y="between"]:not([row]))) {
|
|
81
90
|
justify-content: space-between;
|
|
82
91
|
}
|
|
83
92
|
|
|
84
|
-
:host(:
|
|
85
|
-
justify-content:
|
|
93
|
+
:host(:is([row][x="stretch"], [y="stretch"]:not([row]))) {
|
|
94
|
+
justify-content: stretch;
|
|
86
95
|
}
|
|
87
96
|
|
|
88
|
-
:host([wrap]) {
|
|
97
|
+
:host(:is([wrap])) {
|
|
89
98
|
flex-wrap: wrap;
|
|
90
99
|
}
|
|
91
100
|
|
|
92
|
-
:host([wrap="reverse"]) {
|
|
101
|
+
:host(:is([wrap="reverse"])) {
|
|
93
102
|
flex-wrap: wrap-reverse;
|
|
94
103
|
}
|
|
95
104
|
|
|
96
|
-
:host([gap
|
|
97
|
-
:host([gap="
|
|
98
|
-
:host([gap="
|
|
99
|
-
:host([gap="
|
|
100
|
-
:host([gap="
|
|
101
|
-
:host([gap="
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
:host([padding
|
|
105
|
-
:host([padding="
|
|
106
|
-
:host([padding="
|
|
107
|
-
:host([padding="
|
|
108
|
-
:host([padding="
|
|
105
|
+
:host(:is([gap])) {gap: 0;}
|
|
106
|
+
:host(:is([gap="4"])) {gap: 4px;}
|
|
107
|
+
:host(:is([gap="8"])) {gap: 8px;}
|
|
108
|
+
:host(:is([gap="12"])) {gap: 12px;}
|
|
109
|
+
:host(:is([gap="16"])) {gap: 16px;}
|
|
110
|
+
:host(:is([gap="20"])) {gap: 20px;}
|
|
111
|
+
:host(:is([gap="24"])) {gap: 24px;}
|
|
112
|
+
|
|
113
|
+
:host(:is([padding])) {padding: 0;}
|
|
114
|
+
:host(:is([padding="pane"])) { padding-inline: var(--mdw-pane__padding-inline, 0) }
|
|
115
|
+
:host(:is([padding="4"])) {padding: 4px;}
|
|
116
|
+
:host(:is([padding="8"])) {padding: 8px;}
|
|
117
|
+
:host(:is([padding="12"])) {padding: 12px;}
|
|
118
|
+
:host(:is([padding="16"])) {padding: 16px;}
|
|
119
|
+
:host(:is([padding="20"])) {padding: 20px;}
|
|
120
|
+
:host(:is([padding="24"])) {padding: 24px;}
|
|
121
|
+
:host(:is([padding-x])) {padding-inline: 0;}
|
|
122
|
+
:host(:is([padding-x="4"])) {padding-inline: 4px;}
|
|
123
|
+
:host(:is([padding-x="8"])) {padding-inline: 8px;}
|
|
124
|
+
:host(:is([padding-x="12"])) {padding-inline: 12px;}
|
|
125
|
+
:host(:is([padding-x="16"])) {padding-inline: 16px;}
|
|
126
|
+
:host(:is([padding-x="20"])) {padding-inline: 20px;}
|
|
127
|
+
:host(:is([padding-x="24"])) {padding-inline: 24px;}
|
|
128
|
+
:host(:is([padding-y])) {padding-block: 0;}
|
|
129
|
+
:host(:is([padding-y="4"])) {padding-block: 4px;}
|
|
130
|
+
:host(:is([padding-y="8"])) {padding-block: 8px;}
|
|
131
|
+
:host(:is([padding-y="12"])) {padding-block: 12px;}
|
|
132
|
+
:host(:is([padding-y="16"])) {padding-block: 16px;}
|
|
133
|
+
:host(:is([padding-y="20"])) {padding-block: 20px;}
|
|
134
|
+
:host(:is([padding-y="24"])) {padding-block: 24px;}
|
|
135
|
+
|
|
136
|
+
|
|
109
137
|
`;
|
|
110
138
|
}
|