@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
|
@@ -10,9 +10,11 @@ const resizeObserver = new ResizeObserver((entries) => {
|
|
|
10
10
|
*/
|
|
11
11
|
export default function ResizeObserverMixin(Base) {
|
|
12
12
|
return Base
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
.observe({
|
|
14
|
+
_resizeObserverEnabled: {
|
|
15
|
+
type: 'boolean',
|
|
16
|
+
value: true,
|
|
17
|
+
},
|
|
16
18
|
})
|
|
17
19
|
.methods({
|
|
18
20
|
/** @param {ResizeObserverEntry} entry */
|
|
@@ -20,7 +22,9 @@ export default function ResizeObserverMixin(Base) {
|
|
|
20
22
|
// Virtual function
|
|
21
23
|
},
|
|
22
24
|
observeResize() {
|
|
23
|
-
resizeObserver.observe(this
|
|
25
|
+
resizeObserver.observe(this, {
|
|
26
|
+
box: 'border-box',
|
|
27
|
+
});
|
|
24
28
|
},
|
|
25
29
|
unobserveResize() {
|
|
26
30
|
resizeObserver.unobserve(this);
|
|
@@ -28,11 +32,18 @@ export default function ResizeObserverMixin(Base) {
|
|
|
28
32
|
})
|
|
29
33
|
.on({
|
|
30
34
|
connected() {
|
|
31
|
-
if (!this.
|
|
35
|
+
if (!this._resizeObserverEnabled) return;
|
|
32
36
|
this.observeResize();
|
|
33
37
|
},
|
|
34
38
|
disconnected() {
|
|
35
39
|
this.unobserveResize();
|
|
36
40
|
},
|
|
41
|
+
_resizeObserverEnabledChanged(previous, enabled) {
|
|
42
|
+
if (enabled) {
|
|
43
|
+
this.observeResize();
|
|
44
|
+
} else {
|
|
45
|
+
this.unobserveResize();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
37
48
|
});
|
|
38
49
|
}
|
package/mixins/RippleMixin.js
CHANGED
|
@@ -7,7 +7,6 @@ import Ripple from '../components/Ripple.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export default function RippleMixin(Base) {
|
|
9
9
|
return Base
|
|
10
|
-
.extend()
|
|
11
10
|
.set({
|
|
12
11
|
/** @type {WeakRef<InstanceType<Ripple>>} */
|
|
13
12
|
_lastRippleWeakRef: null,
|
|
@@ -42,7 +41,7 @@ export default function RippleMixin(Base) {
|
|
|
42
41
|
// Reset before next event loop;
|
|
43
42
|
this._rippleAdded = false;
|
|
44
43
|
});
|
|
45
|
-
rippleContainer.
|
|
44
|
+
rippleContainer.append(ripple);
|
|
46
45
|
if (hold) {
|
|
47
46
|
ripple.holdRipple = true;
|
|
48
47
|
}
|
|
@@ -51,8 +50,8 @@ export default function RippleMixin(Base) {
|
|
|
51
50
|
return ripple;
|
|
52
51
|
},
|
|
53
52
|
})
|
|
54
|
-
.html
|
|
55
|
-
<div id=ripple-container
|
|
53
|
+
.html`
|
|
54
|
+
<div id=ripple-container mdw-if={!disabledState} aria-hidden=true></div>
|
|
56
55
|
`
|
|
57
56
|
.events({
|
|
58
57
|
'~pointerdown'(event) {
|
|
@@ -68,8 +67,8 @@ export default function RippleMixin(Base) {
|
|
|
68
67
|
if (lastRipple) {
|
|
69
68
|
lastRipple.holdRipple = false;
|
|
70
69
|
}
|
|
71
|
-
|
|
72
|
-
this.addRipple(x, y);
|
|
70
|
+
// Ripple from pointerdown
|
|
71
|
+
this.addRipple(x, y, true);
|
|
73
72
|
},
|
|
74
73
|
'~click'(e) {
|
|
75
74
|
if (this._rippleAdded) {
|
|
@@ -78,17 +77,17 @@ export default function RippleMixin(Base) {
|
|
|
78
77
|
}
|
|
79
78
|
if (e.pointerType || e.detail) return;
|
|
80
79
|
if (this.disabledState) return;
|
|
81
|
-
if (this.
|
|
80
|
+
if (this.pressedState || this._keyReleased) return;
|
|
82
81
|
const lastRipple = this._lastRipple;
|
|
83
82
|
if (lastRipple) {
|
|
84
83
|
lastRipple.holdRipple = false;
|
|
85
84
|
}
|
|
86
|
-
|
|
85
|
+
// Ripple from programmatic click
|
|
87
86
|
this.addRipple();
|
|
88
87
|
},
|
|
89
88
|
})
|
|
90
89
|
.on({
|
|
91
|
-
|
|
90
|
+
pressedStateChanged(oldValue, pressed) {
|
|
92
91
|
const ripple = this._lastRipple;
|
|
93
92
|
if (!pressed) {
|
|
94
93
|
if (ripple) {
|
|
@@ -101,7 +100,7 @@ export default function RippleMixin(Base) {
|
|
|
101
100
|
// Sometimes pointer events may be out of order
|
|
102
101
|
return;
|
|
103
102
|
}
|
|
104
|
-
|
|
103
|
+
// Ripple from pressed state
|
|
105
104
|
this.addRipple(null, null, true);
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
@@ -121,6 +120,8 @@ export default function RippleMixin(Base) {
|
|
|
121
120
|
overflow: hidden;
|
|
122
121
|
|
|
123
122
|
pointer-events: none;
|
|
123
|
+
|
|
124
|
+
border-radius: inherit;
|
|
124
125
|
}
|
|
125
126
|
`;
|
|
126
127
|
}
|
|
@@ -5,10 +5,12 @@ const IDLE_TIMEOUT_MS = 500;
|
|
|
5
5
|
*/
|
|
6
6
|
export default function ScrollListenerMixin(Base) {
|
|
7
7
|
return Base
|
|
8
|
-
.extend()
|
|
9
8
|
.observe({
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
_scrollListenerPositionX: { type: 'float', empty: 0, reflect: false },
|
|
10
|
+
_scrollListenerPositionY: { type: 'float', empty: 0, reflect: false },
|
|
11
|
+
_scrollListenerLastIdle: { type: 'float', empty: 0 },
|
|
12
|
+
_scrollListenerLastScroll: { type: 'float', empty: 0 },
|
|
13
|
+
_scrollListenerLastResize: { type: 'float', empty: 0 },
|
|
12
14
|
})
|
|
13
15
|
.set({
|
|
14
16
|
/** @type {WeakRef<EventTarget>} */
|
|
@@ -20,32 +22,36 @@ export default function ScrollListenerMixin(Base) {
|
|
|
20
22
|
_scrollDebounce: null,
|
|
21
23
|
})
|
|
22
24
|
.methods({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
_scrollListenerOnScrollIdle() {
|
|
26
|
+
this._scrollListenerLastIdle = performance.now();
|
|
27
|
+
},
|
|
25
28
|
|
|
26
29
|
/** @param {Event} event */
|
|
27
|
-
|
|
28
|
-
this.
|
|
30
|
+
_scrollListenerOnScrollerScroll(event) {
|
|
31
|
+
this._scrollListenerPositionY = (event.currentTarget === window)
|
|
29
32
|
? window.scrollY
|
|
30
33
|
: /** @type {HTMLElement} */ (event.currentTarget).scrollTop;
|
|
31
34
|
|
|
32
|
-
this.
|
|
35
|
+
this._scrollListenerPositionX = (event.currentTarget === window)
|
|
33
36
|
? window.scrollX
|
|
34
37
|
: /** @type {HTMLElement} */ (event.currentTarget).scrollLeft;
|
|
35
38
|
|
|
39
|
+
this._scrollListenerLastScroll = performance.now();
|
|
36
40
|
clearTimeout(this._scrollDebounce);
|
|
37
|
-
this._scrollDebounce = setTimeout(() => this.
|
|
41
|
+
this._scrollDebounce = setTimeout(() => this._scrollListenerOnScrollIdle(), IDLE_TIMEOUT_MS);
|
|
38
42
|
},
|
|
39
43
|
|
|
40
44
|
/** @param {Event} event */
|
|
41
|
-
|
|
45
|
+
_scrollListenerOnScrollerResize(event) {
|
|
46
|
+
this._scrollListenerLastResize = performance.now();
|
|
47
|
+
},
|
|
42
48
|
|
|
43
49
|
/**
|
|
44
50
|
* @param {EventTarget} [scroller]
|
|
45
51
|
* @return {boolean}
|
|
46
52
|
*/
|
|
47
53
|
startScrollListener(scroller) {
|
|
48
|
-
scroller ??=
|
|
54
|
+
scroller ??= window;
|
|
49
55
|
if (!scroller) return false;
|
|
50
56
|
|
|
51
57
|
if (scroller === document.body) {
|
|
@@ -54,42 +60,45 @@ export default function ScrollListenerMixin(Base) {
|
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
this._scroller = new WeakRef(scroller);
|
|
57
|
-
this._scrollerScrollListener = this.
|
|
58
|
-
this._scrollerResizeListener = this.
|
|
59
|
-
scroller.addEventListener('scroll', this._scrollerScrollListener);
|
|
60
|
-
scroller.addEventListener('resize', this._scrollerResizeListener);
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
+
this._scrollerScrollListener = this._scrollListenerOnScrollerScroll.bind(this);
|
|
64
|
+
this._scrollerResizeListener = this._scrollListenerOnScrollerResize.bind(this);
|
|
65
|
+
scroller.addEventListener('scroll', this._scrollerScrollListener, { passive: true });
|
|
66
|
+
scroller.addEventListener('resize', this._scrollerResizeListener, { passive: true });
|
|
67
|
+
this._scrollListenerPositionX = 0;
|
|
68
|
+
this._scrollListenerPositionY = 0;
|
|
63
69
|
return true;
|
|
64
70
|
},
|
|
71
|
+
})
|
|
72
|
+
.define({
|
|
73
|
+
/** @return {Window|HTMLElement} */
|
|
74
|
+
_scrollListenerScroller() {
|
|
75
|
+
return this._scroller.deref();
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
.define({
|
|
65
79
|
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
80
|
+
_scrollListenerScrollerScrollHeight() {
|
|
81
|
+
const scroller = this._scrollListenerScroller;
|
|
82
|
+
if (scroller === window) {
|
|
69
83
|
return document.documentElement.scrollHeight;
|
|
70
84
|
}
|
|
71
|
-
|
|
72
|
-
return element.scrollHeight;
|
|
85
|
+
return scroller.scrollHeight;
|
|
73
86
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (element === window) {
|
|
87
|
+
_scrollListenerScrollerClientHeight() {
|
|
88
|
+
const scroller = this._scrollListenerScroller;
|
|
89
|
+
if (scroller === window) {
|
|
78
90
|
return window.innerHeight;
|
|
79
91
|
}
|
|
80
92
|
// @ts-expect-error Skip Element cast
|
|
81
|
-
return
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
getScroller() {
|
|
85
|
-
return this._scroller.deref();
|
|
93
|
+
return scroller.clientHeight;
|
|
86
94
|
},
|
|
87
|
-
|
|
95
|
+
})
|
|
96
|
+
.methods({
|
|
88
97
|
/**
|
|
89
98
|
* @param {EventTarget} [scroller]
|
|
90
99
|
* @return {boolean}
|
|
91
100
|
*/
|
|
92
|
-
|
|
101
|
+
_scrollListenerClear(scroller) {
|
|
93
102
|
scroller ??= this._scroller?.deref();
|
|
94
103
|
if (!scroller) return false;
|
|
95
104
|
if (!this._scrollerScrollListener) return false;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ELEMENT_ANIMATION_TYPE } from '../core/customTypes.js';
|
|
2
|
+
|
|
3
|
+
import ScrollListenerMixin from './ScrollListenerMixin.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hides sticky element when scrolling down
|
|
7
|
+
* @param {typeof import('../core/CustomElement.js').default} Base
|
|
8
|
+
*/
|
|
9
|
+
export default function SemiStickyMixin(Base) {
|
|
10
|
+
return Base
|
|
11
|
+
.mixin(ScrollListenerMixin)
|
|
12
|
+
.observe({
|
|
13
|
+
_semiStickyHeight: { type: 'float', empty: 0 },
|
|
14
|
+
_semiStickyOffsetY: { type: 'float', empty: 0 },
|
|
15
|
+
_semiStickyTranslateY: { type: 'float', empty: 0 },
|
|
16
|
+
_semiStickyDuration: { type: 'float', empty: 0 },
|
|
17
|
+
_semiStickyEasing: { empty: 'ease-in' },
|
|
18
|
+
_semiStickyMeasured: 'boolean',
|
|
19
|
+
stickyAlways: 'boolean',
|
|
20
|
+
/** Stick to offsetParent instead of window */
|
|
21
|
+
stickyParent: 'boolean',
|
|
22
|
+
})
|
|
23
|
+
.methods({
|
|
24
|
+
_refreshSemiStickyMetrics() {
|
|
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;
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.observe({
|
|
33
|
+
_semiStickyStyleStyle: {
|
|
34
|
+
...ELEMENT_ANIMATION_TYPE,
|
|
35
|
+
get({
|
|
36
|
+
_semiStickyMeasured, _semiStickyTranslateY, _semiStickyDuration, _semiStickyEasing,
|
|
37
|
+
}) {
|
|
38
|
+
if (!_semiStickyMeasured) return null;
|
|
39
|
+
return {
|
|
40
|
+
styles: {
|
|
41
|
+
transform: `translateY(${_semiStickyTranslateY}px)`,
|
|
42
|
+
},
|
|
43
|
+
timing: {
|
|
44
|
+
duration: _semiStickyDuration,
|
|
45
|
+
easing: _semiStickyEasing,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
.on({
|
|
52
|
+
_scrollListenerPositionYChanged(oldValue, newValue) {
|
|
53
|
+
const delta = newValue - oldValue;
|
|
54
|
+
if (!this._semiStickyMeasured) {
|
|
55
|
+
this._refreshSemiStickyMetrics();
|
|
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);
|
|
63
|
+
},
|
|
64
|
+
_scrollListenerLastIdleChanged() {
|
|
65
|
+
if (this.stickyAlways) return;
|
|
66
|
+
this._refreshSemiStickyMetrics();
|
|
67
|
+
const offsetTop = this.offsetTop;
|
|
68
|
+
const offset = this._scrollListenerPositionY - offsetTop;
|
|
69
|
+
const delta = offset - this._semiStickyTranslateY;
|
|
70
|
+
const visibility = delta / this._semiStickyHeight;
|
|
71
|
+
|
|
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
|
+
);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
connected() {
|
|
91
|
+
this.startScrollListener(this.stickyParent ? this.offsetParent : window);
|
|
92
|
+
},
|
|
93
|
+
disconnected() {
|
|
94
|
+
this._scrollListenerClear();
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -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
|
+
}
|