@shortfuse/materialdesignweb 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -24
- package/bin/mdw-css.js +1 -1
- package/components/Badge.js +12 -5
- package/components/Body.js +3 -0
- package/components/BottomAppBar.js +1 -8
- package/components/BottomSheet.js +424 -0
- package/components/Box.js +11 -49
- package/components/Button.js +61 -82
- package/components/Card.js +56 -61
- package/components/Checkbox.js +7 -25
- package/components/CheckboxIcon.js +10 -28
- package/components/Chip.js +13 -11
- package/components/Dialog.js +49 -98
- package/components/Display.js +55 -0
- package/components/Fab.js +83 -17
- package/components/FabContainer.js +48 -0
- package/components/FilterChip.js +34 -32
- package/components/Grid.js +176 -0
- package/components/Headline.js +5 -28
- package/components/Icon.js +54 -69
- package/components/IconButton.js +71 -120
- package/components/Input.js +669 -83
- package/components/InputChip.js +161 -0
- package/components/Label.js +3 -0
- package/components/List.js +1 -5
- package/components/ListItem.js +39 -23
- package/components/ListOption.js +79 -62
- package/components/Listbox.js +19 -10
- package/components/Menu.js +8 -18
- package/components/MenuItem.js +25 -26
- package/components/NavBar.js +53 -19
- package/components/NavDrawer.js +15 -15
- package/components/NavDrawerItem.js +2 -4
- package/components/NavItem.js +40 -33
- package/components/NavRail.js +23 -21
- package/components/NavRailItem.js +5 -2
- package/components/Page.js +105 -0
- package/components/Pane.js +18 -0
- package/components/Popup.js +17 -8
- package/components/Radio.js +2 -5
- package/components/RadioIcon.js +10 -14
- package/components/Ripple.js +11 -7
- package/components/Root.js +209 -0
- package/components/Scrim.js +87 -0
- package/components/Search.js +12 -20
- package/components/SegmentedButton.js +33 -36
- package/components/SegmentedButtonGroup.js +9 -3
- package/components/Select.js +6 -7
- package/components/Shape.js +5 -65
- package/components/SideSheet.js +308 -0
- package/components/Slider.js +71 -34
- package/components/Snackbar.js +22 -16
- package/components/SnackbarContainer.js +42 -0
- package/components/Surface.js +15 -10
- package/components/Switch.js +3 -16
- package/components/SwitchIcon.js +40 -32
- package/components/Tab.js +57 -38
- package/components/TabContent.js +1 -0
- package/components/TabList.js +60 -32
- package/components/TabPanel.js +1 -1
- package/components/Table.js +116 -0
- package/components/TextArea.js +16 -15
- package/components/Title.js +4 -9
- package/components/Tooltip.js +43 -21
- package/components/TopAppBar.js +56 -78
- package/constants/shapes.js +36 -0
- package/constants/typography.js +127 -0
- package/core/Composition.js +354 -192
- package/core/CompositionAdapter.js +11 -12
- package/core/CustomElement.js +588 -236
- package/core/css.js +117 -12
- package/core/customTypes.js +120 -25
- package/core/dom.js +17 -11
- package/core/jsonMergePatch.js +12 -10
- package/core/observe.js +298 -253
- package/core/optimizations.js +9 -9
- package/core/template.js +14 -57
- package/dist/index.min.js +85 -115
- package/dist/index.min.js.map +4 -4
- package/dist/meta.json +1 -1
- package/dom/HTMLOptionsCollectionProxy.js +106 -0
- package/{theming/themableMixinLoader.js → loaders/palette.js} +4 -3
- package/loaders/theme.js +12 -0
- package/mixins/AriaReflectorMixin.js +53 -13
- package/mixins/AriaToolbarMixin.js +3 -0
- package/mixins/ControlMixin.js +76 -33
- package/mixins/DelegatesFocusMixin.js +54 -0
- package/mixins/DensityMixin.js +2 -2
- package/mixins/ElevationMixin.js +62 -0
- package/mixins/FlexableMixin.js +66 -37
- package/mixins/FormAssociatedMixin.js +60 -8
- package/mixins/HyperlinkMixin.js +66 -0
- package/mixins/InputMixin.js +205 -32
- package/mixins/KeyboardNavMixin.js +8 -6
- package/mixins/NavigationListenerMixin.js +33 -0
- package/mixins/PopupMixin.js +176 -208
- package/mixins/ResizeObserverMixin.js +16 -4
- package/mixins/RippleMixin.js +8 -6
- package/mixins/ScrollListenerMixin.js +1 -1
- package/mixins/SemiStickyMixin.js +44 -98
- package/mixins/ShapeMaskedMixin.js +117 -0
- package/mixins/ShapeMixin.js +22 -204
- package/mixins/StateMixin.js +70 -34
- package/mixins/TextFieldMixin.js +107 -143
- package/mixins/ThemableMixin.js +44 -56
- package/mixins/TooltipTriggerMixin.js +291 -359
- package/mixins/TouchTargetMixin.js +1 -1
- package/mixins/TypographyMixin.js +121 -0
- package/package.json +110 -74
- package/services/rtl.js +10 -0
- package/services/svgAlias.js +17 -0
- package/{theming/index.js → services/theme.js} +24 -174
- package/types/bin/mdw-css.d.ts +3 -0
- package/types/bin/mdw-css.d.ts.map +1 -0
- package/types/components/Badge.d.ts +39 -0
- package/types/components/Badge.d.ts.map +1 -0
- package/types/components/Body.d.ts +29 -0
- package/types/components/Body.d.ts.map +1 -0
- package/types/components/BottomAppBar.d.ts +73 -0
- package/types/components/BottomAppBar.d.ts.map +1 -0
- package/types/components/BottomSheet.d.ts +109 -0
- package/types/components/BottomSheet.d.ts.map +1 -0
- package/types/components/Box.d.ts +16 -0
- package/types/components/Box.d.ts.map +1 -0
- package/types/components/Button.d.ts +714 -0
- package/types/components/Button.d.ts.map +1 -0
- package/types/components/Card.d.ts +412 -0
- package/types/components/Card.d.ts.map +1 -0
- package/types/components/Checkbox.d.ts +205 -0
- package/types/components/Checkbox.d.ts.map +1 -0
- package/types/components/CheckboxIcon.d.ts +44 -0
- package/types/components/CheckboxIcon.d.ts.map +1 -0
- package/types/components/Chip.d.ts +1425 -0
- package/types/components/Chip.d.ts.map +1 -0
- package/types/components/Dialog.d.ts +286 -0
- package/types/components/Dialog.d.ts.map +1 -0
- package/types/components/DialogActions.d.ts +4 -0
- package/types/components/DialogActions.d.ts.map +1 -0
- package/types/components/Display.d.ts +45 -0
- package/types/components/Display.d.ts.map +1 -0
- package/types/components/Divider.d.ts +10 -0
- package/types/components/Divider.d.ts.map +1 -0
- package/types/components/Fab.d.ts +741 -0
- package/types/components/Fab.d.ts.map +1 -0
- package/types/components/FabContainer.d.ts +10 -0
- package/types/components/FabContainer.d.ts.map +1 -0
- package/types/components/FilterChip.d.ts +4283 -0
- package/types/components/FilterChip.d.ts.map +1 -0
- package/types/components/Grid.d.ts +37 -0
- package/types/components/Grid.d.ts.map +1 -0
- package/types/components/Headline.d.ts +47 -0
- package/types/components/Headline.d.ts.map +1 -0
- package/types/components/Icon.d.ts +103 -0
- package/types/components/Icon.d.ts.map +1 -0
- package/types/components/IconButton.d.ts +1486 -0
- package/types/components/IconButton.d.ts.map +1 -0
- package/types/components/Input.d.ts +51288 -0
- package/types/components/Input.d.ts.map +1 -0
- package/types/components/InputChip.d.ts +243 -0
- package/types/components/InputChip.d.ts.map +1 -0
- package/types/components/Label.d.ts +29 -0
- package/types/components/Label.d.ts.map +1 -0
- package/types/components/List.d.ts +31 -0
- package/types/components/List.d.ts.map +1 -0
- package/types/components/ListItem.d.ts +349 -0
- package/types/components/ListItem.d.ts.map +1 -0
- package/types/components/ListOption.d.ts +1493 -0
- package/types/components/ListOption.d.ts.map +1 -0
- package/types/components/Listbox.d.ts +12012 -0
- package/types/components/Listbox.d.ts.map +1 -0
- package/types/components/Menu.d.ts +119 -0
- package/types/components/Menu.d.ts.map +1 -0
- package/types/components/MenuItem.d.ts +3109 -0
- package/types/components/MenuItem.d.ts.map +1 -0
- package/types/components/NavBar.d.ts +18 -0
- package/types/components/NavBar.d.ts.map +1 -0
- package/types/components/NavBarItem.d.ts +186 -0
- package/types/components/NavBarItem.d.ts.map +1 -0
- package/types/components/NavDrawer.d.ts +108 -0
- package/types/components/NavDrawer.d.ts.map +1 -0
- package/types/components/NavDrawerItem.d.ts +186 -0
- package/types/components/NavDrawerItem.d.ts.map +1 -0
- package/types/components/NavItem.d.ts +190 -0
- package/types/components/NavItem.d.ts.map +1 -0
- package/types/components/NavRail.d.ts +109 -0
- package/types/components/NavRail.d.ts.map +1 -0
- package/types/components/NavRailItem.d.ts +186 -0
- package/types/components/NavRailItem.d.ts.map +1 -0
- package/types/components/Page.d.ts +24 -0
- package/types/components/Page.d.ts.map +1 -0
- package/types/components/Pane.d.ts +44 -0
- package/types/components/Pane.d.ts.map +1 -0
- package/types/components/Popup.d.ts +76 -0
- package/types/components/Popup.d.ts.map +1 -0
- package/types/components/Progress.d.ts +19 -0
- package/types/components/Progress.d.ts.map +1 -0
- package/types/components/Radio.d.ts +199 -0
- package/types/components/Radio.d.ts.map +1 -0
- package/types/components/RadioIcon.d.ts +46 -0
- package/types/components/RadioIcon.d.ts.map +1 -0
- package/types/components/Ripple.d.ts +34 -0
- package/types/components/Ripple.d.ts.map +1 -0
- package/types/components/Root.d.ts +68 -0
- package/types/components/Root.d.ts.map +1 -0
- package/types/components/Scrim.d.ts +6 -0
- package/types/components/Scrim.d.ts.map +1 -0
- package/types/components/Search.d.ts +16 -0
- package/types/components/Search.d.ts.map +1 -0
- package/types/components/SegmentedButton.d.ts +718 -0
- package/types/components/SegmentedButton.d.ts.map +1 -0
- package/types/components/SegmentedButtonGroup.d.ts +44 -0
- package/types/components/SegmentedButtonGroup.d.ts.map +1 -0
- package/types/components/Select.d.ts +1361 -0
- package/types/components/Select.d.ts.map +1 -0
- package/types/components/Shape.d.ts +10 -0
- package/types/components/Shape.d.ts.map +1 -0
- package/types/components/SideSheet.d.ts +106 -0
- package/types/components/SideSheet.d.ts.map +1 -0
- package/types/components/Slider.d.ts +382 -0
- package/types/components/Slider.d.ts.map +1 -0
- package/types/components/Snackbar.d.ts +65 -0
- package/types/components/Snackbar.d.ts.map +1 -0
- package/types/components/SnackbarContainer.d.ts +6 -0
- package/types/components/SnackbarContainer.d.ts.map +1 -0
- package/types/components/Surface.d.ts +45 -0
- package/types/components/Surface.d.ts.map +1 -0
- package/types/components/Switch.d.ts +183 -0
- package/types/components/Switch.d.ts.map +1 -0
- package/types/components/SwitchIcon.d.ts +169 -0
- package/types/components/SwitchIcon.d.ts.map +1 -0
- package/types/components/Tab.d.ts +879 -0
- package/types/components/Tab.d.ts.map +1 -0
- package/types/components/TabContent.d.ts +122 -0
- package/types/components/TabContent.d.ts.map +1 -0
- package/types/components/TabList.d.ts +6266 -0
- package/types/components/TabList.d.ts.map +1 -0
- package/types/components/TabPanel.d.ts +28 -0
- package/types/components/TabPanel.d.ts.map +1 -0
- package/types/components/Table.d.ts +2 -0
- package/types/components/Table.d.ts.map +1 -0
- package/types/components/TextArea.d.ts +1394 -0
- package/types/components/TextArea.d.ts.map +1 -0
- package/types/components/Title.d.ts +47 -0
- package/types/components/Title.d.ts.map +1 -0
- package/types/components/Tooltip.d.ts +49 -0
- package/types/components/Tooltip.d.ts.map +1 -0
- package/types/components/TopAppBar.d.ts +130 -0
- package/types/components/TopAppBar.d.ts.map +1 -0
- package/types/constants/colorKeywords.d.ts +2 -0
- package/types/constants/colorKeywords.d.ts.map +1 -0
- package/types/constants/shapes.d.ts +38 -0
- package/types/constants/shapes.d.ts.map +1 -0
- package/types/constants/typography.d.ts +212 -0
- package/types/constants/typography.d.ts.map +1 -0
- package/types/core/Composition.d.ts +252 -0
- package/types/core/Composition.d.ts.map +1 -0
- package/types/core/CompositionAdapter.d.ts +92 -0
- package/types/core/CompositionAdapter.d.ts.map +1 -0
- package/types/core/CustomElement.d.ts +302 -0
- package/types/core/CustomElement.d.ts.map +1 -0
- package/types/core/css.d.ts +44 -0
- package/types/core/css.d.ts.map +1 -0
- package/types/core/customTypes.d.ts +26 -0
- package/types/core/customTypes.d.ts.map +1 -0
- package/types/core/dom.d.ts +32 -0
- package/types/core/dom.d.ts.map +1 -0
- package/types/core/jsonMergePatch.d.ts +31 -0
- package/types/core/jsonMergePatch.d.ts.map +1 -0
- package/types/core/observe.d.ts +113 -0
- package/types/core/observe.d.ts.map +1 -0
- package/types/core/optimizations.d.ts +7 -0
- package/types/core/optimizations.d.ts.map +1 -0
- package/types/core/template.d.ts +47 -0
- package/types/core/template.d.ts.map +1 -0
- package/types/core/uid.d.ts +6 -0
- package/types/core/uid.d.ts.map +1 -0
- package/types/dom/HTMLOptionsCollectionProxy.d.ts +18 -0
- package/types/dom/HTMLOptionsCollectionProxy.d.ts.map +1 -0
- package/types/index.d.ts +88 -0
- package/types/index.d.ts.map +1 -0
- package/types/loaders/palette.d.ts +2 -0
- package/types/loaders/palette.d.ts.map +1 -0
- package/types/loaders/theme.d.ts +2 -0
- package/types/loaders/theme.d.ts.map +1 -0
- package/types/mixins/AriaReflectorMixin.d.ts +23 -0
- package/types/mixins/AriaReflectorMixin.d.ts.map +1 -0
- package/types/mixins/AriaToolbarMixin.d.ts +32 -0
- package/types/mixins/AriaToolbarMixin.d.ts.map +1 -0
- package/types/mixins/ControlMixin.d.ts +124 -0
- package/types/mixins/ControlMixin.d.ts.map +1 -0
- package/types/mixins/DelegatesFocusMixin.d.ts +5 -0
- package/types/mixins/DelegatesFocusMixin.d.ts.map +1 -0
- package/types/mixins/DensityMixin.d.ts +5 -0
- package/types/mixins/DensityMixin.d.ts.map +1 -0
- package/types/mixins/ElevationMixin.d.ts +33 -0
- package/types/mixins/ElevationMixin.d.ts.map +1 -0
- package/types/mixins/FlexableMixin.d.ts +13 -0
- package/types/mixins/FlexableMixin.d.ts.map +1 -0
- package/types/mixins/FormAssociatedMixin.d.ts +122 -0
- package/types/mixins/FormAssociatedMixin.d.ts.map +1 -0
- package/types/mixins/HyperlinkMixin.d.ts +22 -0
- package/types/mixins/HyperlinkMixin.d.ts.map +1 -0
- package/types/mixins/InputMixin.d.ts +179 -0
- package/types/mixins/InputMixin.d.ts.map +1 -0
- package/types/mixins/KeyboardNavMixin.d.ts +47 -0
- package/types/mixins/KeyboardNavMixin.d.ts.map +1 -0
- package/types/mixins/NavigationListenerMixin.d.ts +8 -0
- package/types/mixins/NavigationListenerMixin.d.ts.map +1 -0
- package/types/mixins/PopupMixin.d.ts +82 -0
- package/types/mixins/PopupMixin.d.ts.map +1 -0
- package/types/mixins/RTLObserverMixin.d.ts +7 -0
- package/types/mixins/RTLObserverMixin.d.ts.map +1 -0
- package/types/mixins/ResizeObserverMixin.d.ts +12 -0
- package/types/mixins/ResizeObserverMixin.d.ts.map +1 -0
- package/types/mixins/RippleMixin.d.ts +92 -0
- package/types/mixins/RippleMixin.d.ts.map +1 -0
- package/types/mixins/ScrollListenerMixin.d.ts +41 -0
- package/types/mixins/ScrollListenerMixin.d.ts.map +1 -0
- package/types/mixins/SemiStickyMixin.d.ts +50 -0
- package/types/mixins/SemiStickyMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMaskedMixin.d.ts +9 -0
- package/types/mixins/ShapeMaskedMixin.d.ts.map +1 -0
- package/types/mixins/ShapeMixin.d.ts +38 -0
- package/types/mixins/ShapeMixin.d.ts.map +1 -0
- package/types/mixins/StateMixin.d.ts +27 -0
- package/types/mixins/StateMixin.d.ts.map +1 -0
- package/types/mixins/TextFieldMixin.d.ts +1354 -0
- package/types/mixins/TextFieldMixin.d.ts.map +1 -0
- package/types/mixins/ThemableMixin.d.ts +9 -0
- package/types/mixins/ThemableMixin.d.ts.map +1 -0
- package/types/mixins/TooltipTriggerMixin.d.ts +106 -0
- package/types/mixins/TooltipTriggerMixin.d.ts.map +1 -0
- package/types/mixins/TouchTargetMixin.d.ts +3 -0
- package/types/mixins/TouchTargetMixin.d.ts.map +1 -0
- package/types/mixins/TypographyMixin.d.ts +17 -0
- package/types/mixins/TypographyMixin.d.ts.map +1 -0
- package/types/services/rtl.d.ts +3 -0
- package/types/services/rtl.d.ts.map +1 -0
- package/types/services/svgAlias.d.ts +13 -0
- package/types/services/svgAlias.d.ts.map +1 -0
- package/types/services/theme.d.ts +45 -0
- package/types/services/theme.d.ts.map +1 -0
- package/types/utils/cli.d.ts +3 -0
- package/types/utils/cli.d.ts.map +1 -0
- package/types/utils/function.d.ts +3 -0
- package/types/utils/function.d.ts.map +1 -0
- package/types/utils/jsx-runtime.d.ts +20 -0
- package/types/utils/jsx-runtime.d.ts.map +1 -0
- package/types/utils/material-color/blend.d.ts +34 -0
- package/types/utils/material-color/blend.d.ts.map +1 -0
- package/types/utils/material-color/hct/Cam16.d.ts +142 -0
- package/types/utils/material-color/hct/Cam16.d.ts.map +1 -0
- package/types/utils/material-color/hct/Hct.d.ts +93 -0
- package/types/utils/material-color/hct/Hct.d.ts.map +1 -0
- package/types/utils/material-color/hct/ViewingConditions.d.ts +69 -0
- package/types/utils/material-color/hct/ViewingConditions.d.ts.map +1 -0
- package/types/utils/material-color/hct/hctSolver.d.ts +30 -0
- package/types/utils/material-color/hct/hctSolver.d.ts.map +1 -0
- package/types/utils/material-color/helper.d.ts +8 -0
- package/types/utils/material-color/helper.d.ts.map +1 -0
- package/types/utils/material-color/palettes/CorePalette.d.ts +75 -0
- package/types/utils/material-color/palettes/CorePalette.d.ts.map +1 -0
- package/types/utils/material-color/palettes/TonalPalette.d.ts +38 -0
- package/types/utils/material-color/palettes/TonalPalette.d.ts.map +1 -0
- package/types/utils/material-color/scheme/Scheme.d.ts +264 -0
- package/types/utils/material-color/scheme/Scheme.d.ts.map +1 -0
- package/types/utils/material-color/utils/color.d.ts +172 -0
- package/types/utils/material-color/utils/color.d.ts.map +1 -0
- package/types/utils/material-color/utils/math.d.ts +94 -0
- package/types/utils/material-color/utils/math.d.ts.map +1 -0
- package/types/utils/pixelmatch.d.ts +22 -0
- package/types/utils/pixelmatch.d.ts.map +1 -0
- package/types/utils/popup.d.ts +106 -0
- package/types/utils/popup.d.ts.map +1 -0
- package/types/utils/searchParams.d.ts +3 -0
- package/types/utils/searchParams.d.ts.map +1 -0
- package/types/utils/svg.d.ts +7 -0
- package/types/utils/svg.d.ts.map +1 -0
- package/utils/material-color/scheme/Scheme.js +1 -1
- package/utils/pixelmatch.js +360 -0
- package/utils/popup.js +86 -10
- package/utils/searchParams.js +19 -0
- package/components/ExtendedFab.js +0 -32
- package/components/Layout.js +0 -504
- package/components/Nav.js +0 -38
- package/core/DomAdapter.js +0 -586
- package/core/ICustomElement.d.ts +0 -291
- package/core/ICustomElement.js +0 -1
- package/core/test.js +0 -126
- package/core/typings.d.ts +0 -142
- package/core/typings.js +0 -1
- package/mixins/SurfaceMixin.js +0 -127
- package/theming/loader.js +0 -22
- /package/{utils/color_keywords.js → constants/colorKeywords.js} +0 -0
package/mixins/RippleMixin.js
CHANGED
|
@@ -67,8 +67,8 @@ export default function RippleMixin(Base) {
|
|
|
67
67
|
if (lastRipple) {
|
|
68
68
|
lastRipple.holdRipple = false;
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
this.addRipple(x, y);
|
|
70
|
+
// Ripple from pointerdown
|
|
71
|
+
this.addRipple(x, y, true);
|
|
72
72
|
},
|
|
73
73
|
'~click'(e) {
|
|
74
74
|
if (this._rippleAdded) {
|
|
@@ -77,17 +77,17 @@ export default function RippleMixin(Base) {
|
|
|
77
77
|
}
|
|
78
78
|
if (e.pointerType || e.detail) return;
|
|
79
79
|
if (this.disabledState) return;
|
|
80
|
-
if (this.
|
|
80
|
+
if (this.pressedState || this._keyReleased) return;
|
|
81
81
|
const lastRipple = this._lastRipple;
|
|
82
82
|
if (lastRipple) {
|
|
83
83
|
lastRipple.holdRipple = false;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
// Ripple from programmatic click
|
|
86
86
|
this.addRipple();
|
|
87
87
|
},
|
|
88
88
|
})
|
|
89
89
|
.on({
|
|
90
|
-
|
|
90
|
+
pressedStateChanged(oldValue, pressed) {
|
|
91
91
|
const ripple = this._lastRipple;
|
|
92
92
|
if (!pressed) {
|
|
93
93
|
if (ripple) {
|
|
@@ -100,7 +100,7 @@ export default function RippleMixin(Base) {
|
|
|
100
100
|
// Sometimes pointer events may be out of order
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
// Ripple from pressed state
|
|
104
104
|
this.addRipple(null, null, true);
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -120,6 +120,8 @@ export default function RippleMixin(Base) {
|
|
|
120
120
|
overflow: hidden;
|
|
121
121
|
|
|
122
122
|
pointer-events: none;
|
|
123
|
+
|
|
124
|
+
border-radius: inherit;
|
|
123
125
|
}
|
|
124
126
|
`;
|
|
125
127
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ELEMENT_ANIMATION_TYPE } from '../core/customTypes.js';
|
|
2
2
|
|
|
3
3
|
import ScrollListenerMixin from './ScrollListenerMixin.js';
|
|
4
4
|
|
|
@@ -12,40 +12,33 @@ export default function SemiStickyMixin(Base) {
|
|
|
12
12
|
.observe({
|
|
13
13
|
_semiStickyHeight: { type: 'float', empty: 0 },
|
|
14
14
|
_semiStickyOffsetY: { type: 'float', empty: 0 },
|
|
15
|
-
_semiStickyWidth: { type: 'float', empty: 0 },
|
|
16
|
-
_semiStickyOffsetX: { type: 'float', empty: 0 },
|
|
17
15
|
_semiStickyTranslateY: { type: 'float', empty: 0 },
|
|
18
|
-
_semiStickyTranslateX: { type: 'float', empty: 0 },
|
|
19
16
|
_semiStickyDuration: { type: 'float', empty: 0 },
|
|
20
17
|
_semiStickyEasing: { empty: 'ease-in' },
|
|
21
|
-
|
|
22
|
-
/** @type {'top'|'start'|'end'|'bottom'|'left'|'right'} */
|
|
23
|
-
empty: 'top',
|
|
24
|
-
},
|
|
18
|
+
_semiStickyMeasured: 'boolean',
|
|
25
19
|
stickyAlways: 'boolean',
|
|
20
|
+
/** Stick to offsetParent instead of window */
|
|
21
|
+
stickyParent: 'boolean',
|
|
26
22
|
})
|
|
27
23
|
.methods({
|
|
28
|
-
/** @return {HTMLElement} */
|
|
29
|
-
_getSemiStickyElement() { return this; },
|
|
30
24
|
_refreshSemiStickyMetrics() {
|
|
31
|
-
const
|
|
32
|
-
this._semiStickyHeight =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this._semiStickyOffsetY = semiStickyElement.offsetTop;
|
|
37
|
-
this._semiStickyOffsetX = semiStickyElement.offsetLeft;
|
|
38
|
-
semiStickyElement.style.position = 'sticky';
|
|
25
|
+
const styles = window.getComputedStyle(this);
|
|
26
|
+
this._semiStickyHeight = this.offsetHeight
|
|
27
|
+
+ Number.parseFloat(styles.marginTop) + Number.parseFloat(styles.marginBottom);
|
|
28
|
+
this._semiStickyOffsetY = Number.parseFloat(styles.marginTop);
|
|
29
|
+
this._semiStickyMeasured = true;
|
|
39
30
|
},
|
|
40
31
|
})
|
|
41
32
|
.observe({
|
|
42
33
|
_semiStickyStyleStyle: {
|
|
43
|
-
...
|
|
44
|
-
get({
|
|
34
|
+
...ELEMENT_ANIMATION_TYPE,
|
|
35
|
+
get({
|
|
36
|
+
_semiStickyMeasured, _semiStickyTranslateY, _semiStickyDuration, _semiStickyEasing,
|
|
37
|
+
}) {
|
|
38
|
+
if (!_semiStickyMeasured) return null;
|
|
45
39
|
return {
|
|
46
|
-
target: this._getSemiStickyElement(),
|
|
47
40
|
styles: {
|
|
48
|
-
transform: `
|
|
41
|
+
transform: `translateY(${_semiStickyTranslateY}px)`,
|
|
49
42
|
},
|
|
50
43
|
timing: {
|
|
51
44
|
duration: _semiStickyDuration,
|
|
@@ -56,93 +49,46 @@ export default function SemiStickyMixin(Base) {
|
|
|
56
49
|
},
|
|
57
50
|
})
|
|
58
51
|
.on({
|
|
59
|
-
_scrollListenerLastResizeChanged() {
|
|
60
|
-
if (this._semiStickyAnchor !== 'bottom') return;
|
|
61
|
-
// Chrome Bug: When window resizes bottom sticky needs to be recomputed
|
|
62
|
-
// Force style recalculation
|
|
63
|
-
const semiStickyElement = this._getSemiStickyElement();
|
|
64
|
-
semiStickyElement.style.setProperty('bottom', 'auto');
|
|
65
|
-
// eslint-disable-next-line no-unused-expressions
|
|
66
|
-
semiStickyElement.clientHeight;
|
|
67
|
-
semiStickyElement.style.removeProperty('bottom');
|
|
68
|
-
this.propChangedCallback('_scrollListenerPositionY', this._scrollListenerPositionY, this._scrollListenerPositionY);
|
|
69
|
-
},
|
|
70
52
|
_scrollListenerPositionYChanged(oldValue, newValue) {
|
|
71
53
|
const delta = newValue - oldValue;
|
|
72
|
-
if (this.
|
|
73
|
-
this.
|
|
74
|
-
this._semiStickyTranslateY = (this.stickyAlways || newValue < this._semiStickyOffsetY)
|
|
75
|
-
? 0
|
|
76
|
-
: Math.min(0, Math.max(this._semiStickyTranslateY - delta, -this._semiStickyHeight));
|
|
77
|
-
} else if (this._semiStickyAnchor === 'bottom') {
|
|
78
|
-
this._semiStickyDuration = 0;
|
|
79
|
-
const anchor = this._scrollListenerScrollerClientHeight + newValue;
|
|
80
|
-
const distanceFromAnchor = this._semiStickyOffsetY - anchor;
|
|
81
|
-
this._semiStickyTranslateY = this.stickyAlways
|
|
82
|
-
? 0
|
|
83
|
-
: Math.max(0, Math.min(
|
|
84
|
-
this._semiStickyTranslateY + delta,
|
|
85
|
-
this._semiStickyHeight + Math.min(0, distanceFromAnchor),
|
|
86
|
-
));
|
|
54
|
+
if (!this._semiStickyMeasured) {
|
|
55
|
+
this._refreshSemiStickyMetrics();
|
|
87
56
|
}
|
|
57
|
+
this._semiStickyDuration = 0;
|
|
58
|
+
// 0 if disabled or if has not scroll passed height
|
|
59
|
+
// Valid range = -100% < x < 0
|
|
60
|
+
this._semiStickyTranslateY = (this.stickyAlways || newValue < this._semiStickyOffsetY)
|
|
61
|
+
? 0
|
|
62
|
+
: Math.min(Math.max(-this._semiStickyHeight, this._semiStickyTranslateY - delta), 0);
|
|
88
63
|
},
|
|
89
64
|
_scrollListenerLastIdleChanged() {
|
|
90
65
|
if (this.stickyAlways) return;
|
|
91
66
|
this._refreshSemiStickyMetrics();
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const visibility = delta / this._semiStickyHeight;
|
|
67
|
+
const offsetTop = this.offsetTop;
|
|
68
|
+
const offset = this._scrollListenerPositionY - offsetTop;
|
|
69
|
+
const delta = offset - this._semiStickyTranslateY;
|
|
70
|
+
const visibility = delta / this._semiStickyHeight;
|
|
97
71
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
} else if (this._semiStickyAnchor === 'bottom') {
|
|
116
|
-
const max = this._semiStickyHeight;
|
|
117
|
-
const visibility = (max - this._semiStickyTranslateY) / max;
|
|
118
|
-
if (visibility <= 0) return;
|
|
119
|
-
if (visibility >= 1) return;
|
|
120
|
-
if (visibility >= 0.5) {
|
|
121
|
-
// Reveal all
|
|
122
|
-
this._semiStickyDuration = 250;
|
|
123
|
-
this._semiStickyEasing = 'ease-in';
|
|
124
|
-
this._semiStickyTranslateY = 0;
|
|
125
|
-
// this._semiStickyHeadlineOpacity = 1;
|
|
126
|
-
} else {
|
|
127
|
-
this._semiStickyDuration = 200;
|
|
128
|
-
this._semiStickyEasing = 'ease-out';
|
|
129
|
-
const anchor = this._scrollListenerScrollerClientHeight + this._scrollListenerPositionY;
|
|
130
|
-
const distanceFromAnchor = this._semiStickyOffsetY - anchor;
|
|
131
|
-
// Don't hide past origin
|
|
132
|
-
this._semiStickyTranslateY = this._semiStickyHeight + Math.min(0, distanceFromAnchor);
|
|
133
|
-
}
|
|
72
|
+
if (visibility <= 0) return;
|
|
73
|
+
if (visibility >= 1) return;
|
|
74
|
+
if (visibility <= 0.5 || offsetTop < this._semiStickyHeight) {
|
|
75
|
+
// Reveal all
|
|
76
|
+
this._semiStickyDuration = 250;
|
|
77
|
+
this._semiStickyEasing = 'ease-in';
|
|
78
|
+
this._semiStickyTranslateY = 0;
|
|
79
|
+
// this._semiStickyHeadlineOpacity = 1;
|
|
80
|
+
} else {
|
|
81
|
+
this._semiStickyDuration = 200;
|
|
82
|
+
this._semiStickyEasing = 'ease-out';
|
|
83
|
+
// Don't hide past origin
|
|
84
|
+
this._semiStickyTranslateY = Math.max(
|
|
85
|
+
this._semiStickyOffsetY - this._scrollListenerPositionY,
|
|
86
|
+
-this._semiStickyHeight,
|
|
87
|
+
);
|
|
134
88
|
}
|
|
135
89
|
},
|
|
136
90
|
connected() {
|
|
137
|
-
|
|
138
|
-
// Connect scroll when element gets first size
|
|
139
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
140
|
-
this.startScrollListener(semiStickyElement.offsetParent ?? window);
|
|
141
|
-
resizeObserver.disconnect();
|
|
142
|
-
this._refreshSemiStickyMetrics();
|
|
143
|
-
});
|
|
144
|
-
resizeObserver.observe(semiStickyElement);
|
|
145
|
-
this._refreshSemiStickyMetrics();
|
|
91
|
+
this.startScrollListener(this.stickyParent ? this.offsetParent : window);
|
|
146
92
|
},
|
|
147
93
|
disconnected() {
|
|
148
94
|
this._scrollListenerClear();
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** @param {typeof import('../core/CustomElement.js').default} Base */
|
|
2
|
+
export default function ShapeMaskedMixin(Base) {
|
|
3
|
+
return Base
|
|
4
|
+
.observe({
|
|
5
|
+
shapeTop: 'boolean',
|
|
6
|
+
shapeBottom: 'boolean',
|
|
7
|
+
shapeStart: 'boolean',
|
|
8
|
+
shapeEnd: 'boolean',
|
|
9
|
+
shapeStyle: 'string',
|
|
10
|
+
})
|
|
11
|
+
.css`
|
|
12
|
+
:host {
|
|
13
|
+
--mdw-shape__size: 0px;
|
|
14
|
+
--mdw-shape__ltr: calc(0.5 * var(--mdw-dir, 1) + 0.5); /* 1 if LTR, 0 if RTL */
|
|
15
|
+
--mdw-shape__rtl: calc(-0.5 * var(--mdw-dir, 1) + 0.5); /* 0 if LTR, 1 if RTL */
|
|
16
|
+
--mdw-shape__mask: none;
|
|
17
|
+
|
|
18
|
+
/** By default, fallback to border-radius */
|
|
19
|
+
--mdw-shape__rounded: 1;
|
|
20
|
+
--mdw-shape__inline-start-deg: calc(var(--mdw-dir, 1) * -90deg);
|
|
21
|
+
|
|
22
|
+
--mdw-shape__size__top-start-size: var(--mdw-shape__size);
|
|
23
|
+
--mdw-shape__size__top-end-size: var(--mdw-shape__size);
|
|
24
|
+
--mdw-shape__size__bottom-start-size: var(--mdw-shape__size);
|
|
25
|
+
--mdw-shape__size__bottom-end-size: var(--mdw-shape__size);
|
|
26
|
+
/* (1/2n + 1/2)L + (-1/2n + 1/2)R */
|
|
27
|
+
|
|
28
|
+
--mdw-shape__size__top-left-size: calc((var(--mdw-shape__ltr) * var(--mdw-shape__size__top-start-size)) + (var(--mdw-shape__rtl) * var(--mdw-shape__size__top-end-size)));
|
|
29
|
+
--mdw-shape__size__top-right-size: calc((var(--mdw-shape__rtl) * var(--mdw-shape__size__top-start-size)) + (var(--mdw-shape__ltr) * var(--mdw-shape__size__top-end-size)));
|
|
30
|
+
--mdw-shape__size__bottom-left-size: calc((var(--mdw-shape__ltr) * var(--mdw-shape__size__bottom-start-size)) + (var(--mdw-shape__rtl) * var(--mdw-shape__size__bottom-end-size)));
|
|
31
|
+
--mdw-shape__size__bottom-right-size: calc((var(--mdw-shape__rtl) * var(--mdw-shape__size__bottom-start-size)) + (var(--mdw-shape__ltr) * var(--mdw-shape__size__bottom-end-size)));
|
|
32
|
+
|
|
33
|
+
border-start-start-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__top-start-size));
|
|
34
|
+
border-start-end-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__top-end-size));
|
|
35
|
+
border-end-start-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__bottom-start-size));
|
|
36
|
+
border-end-end-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__bottom-end-size));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([shape-style="none"]) {
|
|
40
|
+
--mdw-shape__size: 0px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([shape-style="extra-small"]) {
|
|
44
|
+
--mdw-shape__size: var(--mdw-shape__extra-small);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([shape-style="small"]) {
|
|
48
|
+
--mdw-shape__size: var(--mdw-shape__small);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([shape-style="medium"]) {
|
|
52
|
+
--mdw-shape__size: var(--mdw-shape__medium);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([shape-style="large"]) {
|
|
56
|
+
--mdw-shape__size: var(--mdw-shape__large);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([shape-style="extra-large"]) {
|
|
60
|
+
--mdw-shape__size: var(--mdw-shape__extra-large);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([shape-style="full"]) {
|
|
64
|
+
--mdw-shape__size: var(--mdw-shape__full);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([shape-style="inherit"]) {
|
|
68
|
+
--mdw-shape__size: inherit;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([shape-top]) {
|
|
72
|
+
--mdw-shape__size__bottom-start-size: 0px;
|
|
73
|
+
--mdw-shape__size__bottom-end-size: 0px;
|
|
74
|
+
--mdw-shape__mask: linear-gradient(transparent 50%, black 50%);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([shape-bottom]) {
|
|
78
|
+
--mdw-shape__size__top-start-size: 0px;
|
|
79
|
+
--mdw-shape__size__top-end-size: 0px;
|
|
80
|
+
--mdw-shape__mask: linear-gradient(black 50%, transparent 50%);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([shape-start]) {
|
|
84
|
+
--mdw-shape__size__top-end-size: 0px;
|
|
85
|
+
--mdw-shape__size__bottom-end-size: 0px;
|
|
86
|
+
--mdw-shape__mask: linear-gradient(var(--mdw-shape__inline-start-deg), black 50%, transparent 50%);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:host([shape-end]) {
|
|
90
|
+
--mdw-shape__size__top-start-size: 0px;
|
|
91
|
+
--mdw-shape__size__bottom-start-size: 0px;
|
|
92
|
+
--mdw-shape__mask: linear-gradient(var(--mdw-shape__inline-start-deg), transparent 50%, black 50%);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@supports(-webkit-mask-box-image: none) {
|
|
96
|
+
:host {
|
|
97
|
+
/* Inherit all the way up to :root */
|
|
98
|
+
--mdw-shape__rounded: inherit;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@supports(-webkit-mask-box-image: none) {
|
|
103
|
+
:host {
|
|
104
|
+
-webkit-mask-box-image: var(--mdw-shape__mask-border-source)
|
|
105
|
+
8 fill /
|
|
106
|
+
var(--mdw-shape__size)
|
|
107
|
+
stretch;
|
|
108
|
+
|
|
109
|
+
-webkit-mask: var(--mdw-shape__mask);
|
|
110
|
+
|
|
111
|
+
transition-duration: 200ms;
|
|
112
|
+
transition-property: -webkit-mask-box-image-width;
|
|
113
|
+
will-change: -webkit-mask-box-image;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
}
|
package/mixins/ShapeMixin.js
CHANGED
|
@@ -12,162 +12,95 @@ export default function ShapeMixin(Base) {
|
|
|
12
12
|
outlined: 'boolean',
|
|
13
13
|
})
|
|
14
14
|
.html`
|
|
15
|
-
<div id=
|
|
16
|
-
shape-top={shapeTop} shape-bottom={shapeBottom} shape-start={shapeStart} shape-end={shapeEnd} shape-style={shapeStyle}
|
|
17
|
-
color={color} outlined={outlined} disabled={disabledState}>
|
|
18
|
-
<div id=outline mdw-if={outlined} class=outline disabled={disabledState} focused={focusedState} pressed={pressedState} hovered={hoveredState}>
|
|
19
|
-
<div id=outline-left class="outline-section outline-left"></div>
|
|
20
|
-
<div id=outline-right class="outline-section outline-right"></div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
15
|
+
<div id=outline mdw-if={outlined} class=outline disabled={disabledState} focused={focusedState} pressed={pressedState} hovered={hoveredState}></div>
|
|
23
16
|
`
|
|
24
17
|
.css`
|
|
25
18
|
:host {
|
|
26
19
|
--mdw-shape__size: 0px;
|
|
27
|
-
--mdw-shape__bg: transparent;
|
|
28
|
-
--mdw-surface__will-change: none;
|
|
29
20
|
--mdw-shape__ltr: calc(0.5 * var(--mdw-dir, 1) + 0.5); /* 1 if LTR, 0 if RTL */
|
|
30
21
|
--mdw-shape__rtl: calc(-0.5 * var(--mdw-dir, 1) + 0.5); /* 0 if LTR, 1 if RTL */
|
|
31
22
|
|
|
32
23
|
/** By default, fallback to border-radius */
|
|
33
|
-
--mdw-shape__rounded: 1;
|
|
34
24
|
--mdw-shape__inline-start-deg: calc(var(--mdw-dir, 1) * -90deg);
|
|
35
|
-
z-index: 0;
|
|
36
|
-
}
|
|
37
25
|
|
|
38
|
-
.shape {
|
|
39
26
|
--mdw-shape__size__top-start-size: var(--mdw-shape__size);
|
|
40
27
|
--mdw-shape__size__top-end-size: var(--mdw-shape__size);
|
|
41
28
|
--mdw-shape__size__bottom-start-size: var(--mdw-shape__size);
|
|
42
29
|
--mdw-shape__size__bottom-end-size: var(--mdw-shape__size);
|
|
43
|
-
|
|
44
30
|
/* (1/2n + 1/2)L + (-1/2n + 1/2)R */
|
|
45
31
|
|
|
46
32
|
--mdw-shape__size__top-left-size: calc((var(--mdw-shape__ltr) * var(--mdw-shape__size__top-start-size)) + (var(--mdw-shape__rtl) * var(--mdw-shape__size__top-end-size)));
|
|
47
33
|
--mdw-shape__size__top-right-size: calc((var(--mdw-shape__rtl) * var(--mdw-shape__size__top-start-size)) + (var(--mdw-shape__ltr) * var(--mdw-shape__size__top-end-size)));
|
|
48
34
|
--mdw-shape__size__bottom-left-size: calc((var(--mdw-shape__ltr) * var(--mdw-shape__size__bottom-start-size)) + (var(--mdw-shape__rtl) * var(--mdw-shape__size__bottom-end-size)));
|
|
49
35
|
--mdw-shape__size__bottom-right-size: calc((var(--mdw-shape__rtl) * var(--mdw-shape__size__bottom-start-size)) + (var(--mdw-shape__ltr) * var(--mdw-shape__size__bottom-end-size)));
|
|
50
|
-
|
|
36
|
+
z-index: 0;
|
|
37
|
+
|
|
38
|
+
border-start-start-radius: calc(var(--mdw-shape__size__top-start-size));
|
|
39
|
+
border-start-end-radius: calc(var(--mdw-shape__size__top-end-size));
|
|
40
|
+
border-end-start-radius: calc(var(--mdw-shape__size__bottom-start-size));
|
|
41
|
+
border-end-end-radius: calc(var(--mdw-shape__size__bottom-end-size));
|
|
51
42
|
}
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
:host([shape-style="none"]) {
|
|
54
45
|
--mdw-shape__size: 0px;
|
|
55
46
|
}
|
|
56
47
|
|
|
57
|
-
|
|
48
|
+
:host([shape-style="extra-small"]) {
|
|
58
49
|
--mdw-shape__size: var(--mdw-shape__extra-small);
|
|
59
50
|
}
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
:host([shape-style="small"]) {
|
|
62
53
|
--mdw-shape__size: var(--mdw-shape__small);
|
|
63
54
|
}
|
|
64
55
|
|
|
65
|
-
|
|
56
|
+
:host([shape-style="medium"]) {
|
|
66
57
|
--mdw-shape__size: var(--mdw-shape__medium);
|
|
67
58
|
}
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
:host([shape-style="large"]) {
|
|
70
61
|
--mdw-shape__size: var(--mdw-shape__large);
|
|
71
62
|
}
|
|
72
63
|
|
|
73
|
-
|
|
64
|
+
:host([shape-style="extra-large"]) {
|
|
74
65
|
--mdw-shape__size: var(--mdw-shape__extra-large);
|
|
75
66
|
}
|
|
76
67
|
|
|
77
|
-
|
|
68
|
+
:host([shape-style="full"]) {
|
|
78
69
|
--mdw-shape__size: var(--mdw-shape__full);
|
|
79
70
|
}
|
|
80
71
|
|
|
81
|
-
|
|
72
|
+
:host([shape-style="inherit"]) {
|
|
82
73
|
--mdw-shape__size: inherit;
|
|
83
74
|
}
|
|
84
75
|
|
|
85
|
-
|
|
76
|
+
:host([shape-top]) {
|
|
86
77
|
--mdw-shape__size__bottom-start-size: 0px;
|
|
87
78
|
--mdw-shape__size__bottom-end-size: 0px;
|
|
88
|
-
--mdw-shape__mask: linear-gradient(transparent 50%, black 50%);
|
|
89
79
|
}
|
|
90
80
|
|
|
91
|
-
|
|
81
|
+
:host([shape-bottom]) {
|
|
92
82
|
--mdw-shape__size__top-start-size: 0px;
|
|
93
83
|
--mdw-shape__size__top-end-size: 0px;
|
|
94
|
-
--mdw-shape__mask: linear-gradient(black 50%, transparent 50%);
|
|
95
84
|
}
|
|
96
85
|
|
|
97
|
-
|
|
86
|
+
:host([shape-start]) {
|
|
98
87
|
--mdw-shape__size__top-end-size: 0px;
|
|
99
88
|
--mdw-shape__size__bottom-end-size: 0px;
|
|
100
|
-
--mdw-shape__mask: linear-gradient(var(--mdw-shape__inline-start-deg), black 50%, transparent 50%);
|
|
101
89
|
}
|
|
102
90
|
|
|
103
|
-
|
|
91
|
+
:host([shape-end]) {
|
|
104
92
|
--mdw-shape__size__top-start-size: 0px;
|
|
105
93
|
--mdw-shape__size__bottom-start-size: 0px;
|
|
106
|
-
--mdw-shape__mask: linear-gradient(var(--mdw-shape__inline-start-deg), transparent 50%, black 50%);
|
|
107
94
|
}
|
|
108
95
|
|
|
109
|
-
@supports(-webkit-mask-box-image: none) {
|
|
110
|
-
:host {
|
|
111
|
-
/* Inherit all the way up to :root */
|
|
112
|
-
--mdw-shape__rounded: inherit;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
`
|
|
116
|
-
.css`
|
|
117
|
-
.shape {
|
|
118
|
-
position: absolute;
|
|
119
|
-
inset: 0;
|
|
120
|
-
|
|
121
|
-
overflow: hidden;
|
|
122
|
-
|
|
123
|
-
z-index: -1;
|
|
124
|
-
|
|
125
|
-
background-color: var(--mdw-shape__bg, transparent);
|
|
126
|
-
|
|
127
|
-
border-start-start-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__top-start-size));
|
|
128
|
-
border-start-end-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__top-end-size));
|
|
129
|
-
border-end-start-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__bottom-start-size));
|
|
130
|
-
border-end-end-radius: calc(var(--mdw-shape__rounded) * var(--mdw-shape__size__bottom-end-size));
|
|
131
|
-
|
|
132
|
-
transition-delay: 1ms;
|
|
133
|
-
transition-duration: 200ms;
|
|
134
|
-
transition-property: background-color, color;
|
|
135
|
-
will-change: background-color, color;
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.shape[outlined] {
|
|
140
|
-
background-color: transparent;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.shape[color] {
|
|
144
|
-
background-color: rgb(var(--mdw-bg));
|
|
145
|
-
color: rgb(var(--mdw-ink));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.shape:is([color="none"], [color="transparent"]) {
|
|
149
|
-
background-color: transparent;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
@supports(-webkit-mask-box-image: none) {
|
|
153
|
-
.shape {
|
|
154
|
-
-webkit-mask-box-image: var(--mdw-shape__mask-border-source)
|
|
155
|
-
8 fill /
|
|
156
|
-
var(--mdw-shape__size)
|
|
157
|
-
stretch;
|
|
158
|
-
|
|
159
|
-
-webkit-mask: var(--mdw-shape__mask);
|
|
160
|
-
|
|
161
|
-
transition-duration: 200ms, 200ms, 200ms;
|
|
162
|
-
transition-property: background-color, color, -webkit-mask-box-image-width;
|
|
163
|
-
will-change: background-color, color, -webkit-mask-box-image;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
96
|
`
|
|
167
97
|
.css`
|
|
168
98
|
.outline {
|
|
169
99
|
position: absolute;
|
|
170
100
|
inset: 0;
|
|
101
|
+
|
|
102
|
+
border-style: solid;
|
|
103
|
+
border-width: 1px;
|
|
171
104
|
|
|
172
105
|
pointer-events: none;
|
|
173
106
|
|
|
@@ -187,120 +120,5 @@ export default function ShapeMixin(Base) {
|
|
|
187
120
|
color: rgba(var(--mdw-color__on-surface), 0.12);
|
|
188
121
|
}
|
|
189
122
|
|
|
190
|
-
.outline::before {
|
|
191
|
-
content: '';
|
|
192
|
-
|
|
193
|
-
position: absolute;
|
|
194
|
-
inset: 0;
|
|
195
|
-
|
|
196
|
-
border-style: solid;
|
|
197
|
-
border-width: 1px;
|
|
198
|
-
|
|
199
|
-
border-radius: inherit;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
@supports(-webkit-mask-box-image: none) {
|
|
203
|
-
.outline::before {
|
|
204
|
-
content: none;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.outline::after {
|
|
208
|
-
content: '';
|
|
209
|
-
|
|
210
|
-
position: absolute;
|
|
211
|
-
inset: 0;
|
|
212
|
-
|
|
213
|
-
-webkit-mask-box-image: var(--mdw-shape__mask-image__edges)
|
|
214
|
-
8 fill /
|
|
215
|
-
auto
|
|
216
|
-
stretch;
|
|
217
|
-
|
|
218
|
-
background-color: currentColor;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.outline-section {
|
|
222
|
-
position: absolute;
|
|
223
|
-
inset: 0;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.outline-section::before,
|
|
227
|
-
.outline-section::after {
|
|
228
|
-
content: "";
|
|
229
|
-
|
|
230
|
-
position: absolute;
|
|
231
|
-
|
|
232
|
-
max-block-size: 50%;
|
|
233
|
-
max-inline-size: 50%;
|
|
234
|
-
|
|
235
|
-
-webkit-mask-repeat: no-repeat;
|
|
236
|
-
-webkit-mask-size: contain;
|
|
237
|
-
|
|
238
|
-
background-color: currentColor;
|
|
239
|
-
|
|
240
|
-
transition-duration: 200ms;
|
|
241
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
242
|
-
transition-property: width, height;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.outline-left::before {
|
|
246
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
247
|
-
left: calc(-1px * var(--mdw-shape__convex));
|
|
248
|
-
inset-block-start: calc(-1px * var(--mdw-shape__convex));
|
|
249
|
-
|
|
250
|
-
block-size: calc(var(--mdw-shape__size__top-left-size));
|
|
251
|
-
inline-size: calc(var(--mdw-shape__size__top-left-size));
|
|
252
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
253
|
-
padding-right: calc(2px * var(--mdw-shape__convex));
|
|
254
|
-
padding-block-end: calc(2px * var(--mdw-shape__convex));
|
|
255
|
-
|
|
256
|
-
-webkit-mask-image: var(--mdw-shape__mask-image__top-left);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
.outline-left::after {
|
|
260
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
261
|
-
left: calc(-1px * var(--mdw-shape__convex));
|
|
262
|
-
inset-block-end: calc(-1px * var(--mdw-shape__convex));
|
|
263
|
-
|
|
264
|
-
block-size: var(--mdw-shape__size__bottom-left-size);
|
|
265
|
-
inline-size: var(--mdw-shape__size__bottom-left-size);
|
|
266
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
267
|
-
padding-right: calc(2px * var(--mdw-shape__convex));
|
|
268
|
-
padding-block-start: calc(2px * var(--mdw-shape__convex));
|
|
269
|
-
|
|
270
|
-
-webkit-mask-image: var(--mdw-shape__mask-image__bottom-left);
|
|
271
|
-
-webkit-mask-position-y: 100%;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.outline-right::before {
|
|
275
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
276
|
-
right: calc(-1px * var(--mdw-shape__convex));
|
|
277
|
-
inset-block-start: calc(-1px * var(--mdw-shape__convex));
|
|
278
|
-
|
|
279
|
-
block-size: var(--mdw-shape__size__top-right-size);
|
|
280
|
-
inline-size: var(--mdw-shape__size__top-right-size);
|
|
281
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
282
|
-
padding-left: calc(2px * var(--mdw-shape__convex));
|
|
283
|
-
padding-block-end: calc(2px * var(--mdw-shape__convex));
|
|
284
|
-
|
|
285
|
-
-webkit-mask-image: var(--mdw-shape__mask-image__top-right);
|
|
286
|
-
-webkit-mask-position-x: 100%;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.outline-right::after {
|
|
290
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
291
|
-
right: calc(-1px * var(--mdw-shape__convex));
|
|
292
|
-
inset-block-end: calc(-1px * var(--mdw-shape__convex));
|
|
293
|
-
|
|
294
|
-
block-size: var(--mdw-shape__size__bottom-right-size);
|
|
295
|
-
inline-size: var(--mdw-shape__size__bottom-right-size);
|
|
296
|
-
/* stylelint-disable-next-line liberty/use-logical-spec */
|
|
297
|
-
padding-left: calc(2px * var(--mdw-shape__convex));
|
|
298
|
-
padding-block-start: calc(2px * var(--mdw-shape__convex));
|
|
299
|
-
|
|
300
|
-
-webkit-mask-image: var(--mdw-shape__mask-image__bottom-right);
|
|
301
|
-
-webkit-mask-position-x: 100%;
|
|
302
|
-
-webkit-mask-position-y: 100%;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
123
|
`;
|
|
306
124
|
}
|