@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,12 +1,13 @@
|
|
|
1
1
|
/** @param {typeof import('../core/CustomElement.js').default} Base */
|
|
2
2
|
export default function TouchTargetMixin(Base) {
|
|
3
3
|
return Base
|
|
4
|
-
.
|
|
5
|
-
.html/* html */`<div id=touch-target class=touch-target></div>`
|
|
4
|
+
.html`<div id=touch-target class=touch-target></div>`
|
|
6
5
|
.css`
|
|
6
|
+
/* stylelint-disable liberty/use-logical-spec */
|
|
7
7
|
.touch-target {
|
|
8
8
|
position: absolute;
|
|
9
|
-
|
|
9
|
+
top: 50%;
|
|
10
|
+
left: 50%;
|
|
10
11
|
/* --mdw-device-pixel-ratio: 1; */
|
|
11
12
|
|
|
12
13
|
block-size: 100%;
|
|
@@ -25,7 +26,7 @@ export default function TouchTargetMixin(Base) {
|
|
|
25
26
|
pointer-events: auto;
|
|
26
27
|
|
|
27
28
|
transform: translateX(-50%) translateY(-50%);
|
|
28
|
-
visibility:
|
|
29
|
+
visibility: inherit;
|
|
29
30
|
z-index: 1;
|
|
30
31
|
|
|
31
32
|
border-radius: inherit;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import DelegatesFocusMixin from './DelegatesFocusMixin.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} input
|
|
5
|
+
* @return {string}
|
|
6
|
+
*/
|
|
7
|
+
function parseSize(input) {
|
|
8
|
+
if (!input) return '';
|
|
9
|
+
if (input.includes('px')) return input;
|
|
10
|
+
if (input.includes('em')) return input;
|
|
11
|
+
if (input.includes('ex')) return input;
|
|
12
|
+
return `calc(${input.replace('sp', '')} * 0.0625rem)`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** @param {typeof import('../core/CustomElement.js').default} Base */
|
|
16
|
+
export default function TypographyMixin(Base) {
|
|
17
|
+
return Base
|
|
18
|
+
.mixin(DelegatesFocusMixin)
|
|
19
|
+
.observe({
|
|
20
|
+
textPadding: 'string',
|
|
21
|
+
textPaddingTop: 'string',
|
|
22
|
+
textLeading: 'string',
|
|
23
|
+
textPaddingBottom: 'string',
|
|
24
|
+
})
|
|
25
|
+
.observe({
|
|
26
|
+
_computedTextPaddingTop({ textPaddingTop, textPadding }) {
|
|
27
|
+
return parseSize(textPaddingTop ?? textPadding);
|
|
28
|
+
},
|
|
29
|
+
_computedTextPaddingBottom({ textPaddingBottom, textPadding }) {
|
|
30
|
+
return parseSize(textPaddingBottom ?? textPadding);
|
|
31
|
+
},
|
|
32
|
+
_computedTextLeading({ textLeading }) {
|
|
33
|
+
return parseSize(textLeading);
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
.observe({
|
|
37
|
+
_beforeStyle({ _computedTextPaddingTop, _computedTextLeading }) {
|
|
38
|
+
if (_computedTextLeading) {
|
|
39
|
+
return `margin-top:${_computedTextLeading}`;
|
|
40
|
+
}
|
|
41
|
+
if (_computedTextPaddingTop) {
|
|
42
|
+
return `margin-top:${_computedTextPaddingTop}`;
|
|
43
|
+
}
|
|
44
|
+
return '';
|
|
45
|
+
},
|
|
46
|
+
_afterStyle({ _computedTextPaddingBottom }) {
|
|
47
|
+
if (_computedTextPaddingBottom) {
|
|
48
|
+
return `vertical-align:calc(-1em + (-1 * ${_computedTextPaddingBottom}));`;
|
|
49
|
+
}
|
|
50
|
+
return '';
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
.html`
|
|
54
|
+
<div id=wrapper style={_wrapperStyle} before={!!_beforeStyle} after={!!_afterStyle}
|
|
55
|
+
><span id=before mdw-if={!!_beforeStyle} style={_beforeStyle} text-leading={textLeading}></span
|
|
56
|
+
><span id=content before={!!_beforeStyle} after={!!_afterStyle}><span id=after mdw-if={!!_afterStyle} style={_afterStyle}></span></span
|
|
57
|
+
></div>
|
|
58
|
+
`
|
|
59
|
+
.recompose(({ refs: { content, slot } }) => {
|
|
60
|
+
content.prepend(slot);
|
|
61
|
+
})
|
|
62
|
+
.css`
|
|
63
|
+
:host {
|
|
64
|
+
display: block;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host(:where([text-padding],[text-padding-top],[text-padding-bottom])) {
|
|
68
|
+
display: flex;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#wrapper {
|
|
72
|
+
display: contents;
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#wrapper:where([before], [after]) {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: baseline; /* Allows growing element upwards without affecting text selection */
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#wrapper[before] {
|
|
83
|
+
margin-block-start: -1em;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#wrapper[after] {
|
|
87
|
+
margin-block-end: -1em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#before {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
|
|
93
|
+
block-size: 1.4ex; /* Estimate */
|
|
94
|
+
padding-block-start: 1em; /* Padding to be cropped by wrapper */
|
|
95
|
+
}
|
|
96
|
+
@supports(height:1cap) {
|
|
97
|
+
#before {
|
|
98
|
+
block-size: 1cap;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#before[text-leading] {
|
|
103
|
+
block-size: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#content {
|
|
107
|
+
display: contents;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#content:where([before], [after]) {
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#after {
|
|
115
|
+
display: inline-block;
|
|
116
|
+
|
|
117
|
+
padding-block-end: 1em; /* Padding to be cropped by wrapper */
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
`;
|
|
121
|
+
}
|
package/package.json
CHANGED
|
@@ -1,96 +1,136 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"version": "0.7.6",
|
|
4
|
-
"description": "Material Design for Web",
|
|
5
|
-
"type": "module",
|
|
2
|
+
"author": "Carlos Lopez Jr. <clshortfuse@gmail.com> (https://shortfuse.org/)",
|
|
6
3
|
"bin": {
|
|
7
4
|
"mdw-css": "./bin/mdw-css.js"
|
|
8
5
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"prepublishOnly": "node build/esbuild.js index.js --outdir=dist --minify --metafile --production",
|
|
11
|
-
"predocs": "node bin/mdw-css.js --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/theme.css",
|
|
12
|
-
"predocs-alt": "node bin/mdw-css.js --color=a46750 --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/alt-theme.css",
|
|
13
|
-
"docs": "node build/esbuild.js docs/demo.js --outdir=docs --minify --metafile",
|
|
14
|
-
"watch": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile",
|
|
15
|
-
"serve": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile --serve --live",
|
|
16
|
-
"pretest": "eslint --ignore-path .gitignore",
|
|
17
|
-
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve",
|
|
18
|
-
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --watch"
|
|
19
|
-
},
|
|
20
6
|
"browser": "dist/index.min.js",
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/clshortfuse/materialdesignweb.git"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"material",
|
|
27
|
-
"design",
|
|
28
|
-
"web",
|
|
29
|
-
"materialyou",
|
|
30
|
-
"md3",
|
|
31
|
-
"web-components"
|
|
32
|
-
],
|
|
33
|
-
"files": [
|
|
34
|
-
"/bin",
|
|
35
|
-
"/dist",
|
|
36
|
-
"/components",
|
|
37
|
-
"/core",
|
|
38
|
-
"/theming",
|
|
39
|
-
"/mixins",
|
|
40
|
-
"/utils"
|
|
41
|
-
],
|
|
42
|
-
"exports": {
|
|
43
|
-
"/components": "./components",
|
|
44
|
-
"/core": "./core",
|
|
45
|
-
"/theming": "./theming",
|
|
46
|
-
"/mixins": "./mixins",
|
|
47
|
-
"/utils": "./utils"
|
|
48
|
-
},
|
|
49
|
-
"author": "Carlos Lopez Jr. <clshortfuse@gmail.com> (https://shortfuse.org/)",
|
|
50
|
-
"license": "ISC",
|
|
51
|
-
"sideEffects": [
|
|
52
|
-
"./polyfills.js",
|
|
53
|
-
"./components/*.js",
|
|
54
|
-
"./utils/metadata.js",
|
|
55
|
-
"./theming/loader.js",
|
|
56
|
-
"./docs/demo/*.js"
|
|
57
|
-
],
|
|
58
7
|
"bugs": {
|
|
59
8
|
"url": "https://github.com/clshortfuse/materialdesignweb/issues"
|
|
60
9
|
},
|
|
61
|
-
"
|
|
10
|
+
"description": "Material Design for Web",
|
|
62
11
|
"devDependencies": {
|
|
12
|
+
"@babel/preset-env": "^7.22.9",
|
|
63
13
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
14
|
+
"@playwright/test": "^1.36.1",
|
|
15
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
16
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
17
|
+
"@rollup/plugin-terser": "^0.4.3",
|
|
18
|
+
"@stylistic/stylelint-plugin": "^3.0.0",
|
|
19
|
+
"@types/clean-css": "^4.2.6",
|
|
64
20
|
"@types/html-minifier-terser": "^7.0.0",
|
|
65
21
|
"@types/mocha": "^10.0.1",
|
|
66
22
|
"@types/tap": "^15.0.7",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
68
|
-
"@typescript-eslint/parser": "^
|
|
69
|
-
"@web/test-runner": "^0.
|
|
70
|
-
"@web/test-runner-
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
|
24
|
+
"@typescript-eslint/parser": "^7.3.1",
|
|
25
|
+
"@web/test-runner": "^0.18.1",
|
|
26
|
+
"@web/test-runner-commands": "^0.9.0",
|
|
27
|
+
"@web/test-runner-playwright": "^0.11.0",
|
|
71
28
|
"acorn": "^8.8.2",
|
|
72
29
|
"acorn-walk": "^8.2.0",
|
|
73
|
-
"browserslist-to-esbuild": "^
|
|
74
|
-
"
|
|
30
|
+
"browserslist-to-esbuild": "^2.1.1",
|
|
31
|
+
"clean-css": "^5.3.2",
|
|
75
32
|
"element-internals-polyfill": "^1.1.11",
|
|
76
|
-
"esbuild": "^0.
|
|
77
|
-
"
|
|
33
|
+
"esbuild": "^0.20.2",
|
|
34
|
+
"esbuild-postcss": "^0.0.4",
|
|
35
|
+
"eslint": "^8.45.0",
|
|
78
36
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
79
|
-
"eslint-plugin-compat": "^4.0.2",
|
|
80
|
-
"eslint-plugin-github": "^4.3.5",
|
|
81
37
|
"eslint-plugin-import": "^2.27.5",
|
|
82
|
-
"eslint-plugin-jsdoc": "^
|
|
38
|
+
"eslint-plugin-jsdoc": "^48.2.1",
|
|
83
39
|
"eslint-plugin-sort-class-members": "^1.15.2",
|
|
84
|
-
"eslint-plugin-unicorn": "^
|
|
40
|
+
"eslint-plugin-unicorn": "^51.0.1",
|
|
85
41
|
"html-minifier-terser": "^7.1.0",
|
|
86
42
|
"http-server": "^14.1.1",
|
|
87
43
|
"magic-string": "^0.30.0",
|
|
88
|
-
"
|
|
89
|
-
"postcss-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
44
|
+
"playwright": "^1.32.2",
|
|
45
|
+
"postcss-jsx": "^0.36.4",
|
|
46
|
+
"rollup-plugin-output-size": "^1.2.1",
|
|
47
|
+
"rollup-plugin-serve": "^2.0.2",
|
|
48
|
+
"stylelint": "^16.8.1",
|
|
49
|
+
"stylelint-no-unsupported-browser-features": "^8.0.1",
|
|
92
50
|
"stylelint-order": "^6.0.2",
|
|
93
51
|
"stylelint-use-logical-spec": "^5.0.0",
|
|
94
|
-
"typescript": "^5.
|
|
95
|
-
}
|
|
52
|
+
"typescript": "^5.4.2"
|
|
53
|
+
},
|
|
54
|
+
"exports": {
|
|
55
|
+
"./constants/*": "./constants/*",
|
|
56
|
+
"./components/*": "./components/*",
|
|
57
|
+
"./core/*": "./core/*",
|
|
58
|
+
"./dom/*": "./dom/*",
|
|
59
|
+
"./loaders/*": "./loaders/*",
|
|
60
|
+
"./mixins/*": "./mixins/*",
|
|
61
|
+
"./services/*": "./services/*",
|
|
62
|
+
"./utils/*": "./utils/*"
|
|
63
|
+
},
|
|
64
|
+
"files": [
|
|
65
|
+
"/bin",
|
|
66
|
+
"/dist",
|
|
67
|
+
"/constants",
|
|
68
|
+
"/components",
|
|
69
|
+
"/core",
|
|
70
|
+
"/dom",
|
|
71
|
+
"/loaders",
|
|
72
|
+
"/mixins",
|
|
73
|
+
"/services",
|
|
74
|
+
"/types",
|
|
75
|
+
"/utils"
|
|
76
|
+
],
|
|
77
|
+
"homepage": "https://github.com/clshortfuse/materialdesignweb#readme",
|
|
78
|
+
"keywords": [
|
|
79
|
+
"material",
|
|
80
|
+
"design",
|
|
81
|
+
"web",
|
|
82
|
+
"materialyou",
|
|
83
|
+
"md3",
|
|
84
|
+
"web-components"
|
|
85
|
+
],
|
|
86
|
+
"license": "ISC",
|
|
87
|
+
"name": "@shortfuse/materialdesignweb",
|
|
88
|
+
"overrides": {
|
|
89
|
+
"stylelint-no-unsupported-browser-features": {
|
|
90
|
+
"doiuse": "^6.0.2"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"repository": {
|
|
94
|
+
"type": "git",
|
|
95
|
+
"url": "git+https://github.com/clshortfuse/materialdesignweb.git"
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"docs": "node build/esbuild.js docs/demo.js --outdir=docs --minify --metafile",
|
|
99
|
+
"docs:rollup": "rollup -c build/rollup.config.js docs/demo.js --dir=docs --compact",
|
|
100
|
+
"predocs": "node bin/mdw-css.js --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/theme.css",
|
|
101
|
+
"predocs-alt": "node bin/mdw-css.js --color=a46750 --custom=yellow,orange:orange,green:0f0,alias:aqua | npx esbuild --minify --loader=css > docs/alt-theme.css",
|
|
102
|
+
"prepublishOnly": "node build/esbuild.js index.js --outdir=dist --minify --metafile --production",
|
|
103
|
+
"pretest": "eslint --ignore-path .gitignore",
|
|
104
|
+
"serve": "node build/esbuild.js docs/demo.js --outdir=docs --metafile --serve --live --tree-shaking=true",
|
|
105
|
+
"serve:rollup": "rollup -c build/rollup.config.js docs/demo.js --dir=docs --watch --environment SERVE",
|
|
106
|
+
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit --concurrency 1",
|
|
107
|
+
"test:custom": "web-test-runner \"test/**/*.test.js\" --node-resolve --concurrency 1",
|
|
108
|
+
"test:chromium": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers chromium",
|
|
109
|
+
"test:firefox": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers firefox --concurrency 1",
|
|
110
|
+
"test:webkit": "web-test-runner \"test/**/*.test.js\" --node-resolve --playwright --browsers webkit",
|
|
111
|
+
"test:screenshot": "web-test-runner \"test/screenshot/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit --concurrency 1",
|
|
112
|
+
"test:spec": "web-test-runner \"test/spec/**/*.test.js\" --node-resolve --playwright --browsers chromium firefox webkit",
|
|
113
|
+
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --concurrency 1 --watch",
|
|
114
|
+
"test:path": "web-test-runner --node-resolve --playwright --browsers chromium firefox webkit --concurrency 1",
|
|
115
|
+
"types": "rm -Rf types && tsc --emitDeclarationOnly",
|
|
116
|
+
"watch": "node build/esbuild.js docs/demo.js --outdir=docs --watch --metafile",
|
|
117
|
+
"sample": "node build/esbuild.js docs/sample/sample.js --outdir=docs/sample --watch --metafile --serve --live",
|
|
118
|
+
"benchmark": "node build/esbuild.js docs/benchmark/main.js --outdir=docs/benchmark --minify --production --metafile --serve --watch"
|
|
119
|
+
},
|
|
120
|
+
"sideEffects": [
|
|
121
|
+
"./components/*.js",
|
|
122
|
+
"./loaders/*.js",
|
|
123
|
+
"./polyfills/*.js",
|
|
124
|
+
"./docs/custom.js",
|
|
125
|
+
"./docs/demo/*.js"
|
|
126
|
+
],
|
|
127
|
+
"type": "module",
|
|
128
|
+
"typesVersions": {
|
|
129
|
+
"*": {
|
|
130
|
+
"*": [
|
|
131
|
+
"types/*"
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"version": "0.9.0"
|
|
96
136
|
}
|
package/services/rtl.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { addGlobalCss } from '../core/css.js';
|
|
2
|
+
|
|
3
|
+
let globalStylesLoaded = false;
|
|
4
|
+
|
|
5
|
+
/** @return {void} */
|
|
6
|
+
export function loadGlobalStyles() {
|
|
7
|
+
if (globalStylesLoaded) return;
|
|
8
|
+
addGlobalCss('html[dir="rtl"]{--mdw-dir: -1;}');
|
|
9
|
+
globalStylesLoaded = true;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @type {Map<string, {path:string, viewBox:string}>} */
|
|
2
|
+
export const svgAliasMap = new Map();
|
|
3
|
+
export const unaliased = new Set();
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} name
|
|
7
|
+
* @param {string} path
|
|
8
|
+
* @param {string} [viewBox]
|
|
9
|
+
*/
|
|
10
|
+
export function addSVGAlias(name, path, viewBox = '0 0 24 24') {
|
|
11
|
+
name = name.toLowerCase();
|
|
12
|
+
if (path) {
|
|
13
|
+
svgAliasMap.set(name, { path, viewBox });
|
|
14
|
+
} else {
|
|
15
|
+
svgAliasMap.delete(name);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import { COLOR_KEYWORDS } from '../
|
|
2
|
-
import {
|
|
1
|
+
import { COLOR_KEYWORDS } from '../constants/colorKeywords.js';
|
|
2
|
+
import { SHAPE_ROUNDED_DEFAULT } from '../constants/shapes.js';
|
|
3
|
+
import { TYPOGRAPHY_DEFAULT } from '../constants/typography.js';
|
|
4
|
+
import { getScheme } from '../utils/material-color/helper.js';
|
|
3
5
|
import { svgToCSSURL } from '../utils/svg.js';
|
|
4
6
|
|
|
7
|
+
export const PALETTES = [
|
|
8
|
+
'primary',
|
|
9
|
+
'secondary',
|
|
10
|
+
'tertiary',
|
|
11
|
+
'error',
|
|
12
|
+
'surface',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export const TYPE_STYLES = [
|
|
16
|
+
'display',
|
|
17
|
+
'headline',
|
|
18
|
+
'title',
|
|
19
|
+
'label',
|
|
20
|
+
'body',
|
|
21
|
+
];
|
|
22
|
+
|
|
5
23
|
/**
|
|
6
24
|
* @typedef {Object} ThemeOptions
|
|
7
25
|
* @prop {string} [color]
|
|
@@ -71,174 +89,6 @@ function getShapeEdgesSVGs() {
|
|
|
71
89
|
].join('');
|
|
72
90
|
}
|
|
73
91
|
|
|
74
|
-
const CIRCLE_PATH = 'M0 12A12 12 0 1012 0 12 12 0 000 12Z';
|
|
75
|
-
// const SQUIRCLE_PATH = 'M12 24C17.2583 24 20.1815 24 22.0908 22.0908 24 20.1815 24 17.2583 24 12 24 6.7417 24 3.8185 22.0908 1.9092 20.1815-0 17.2583-0 12-0 6.7417-0 3.8185-0 1.9092 1.9092-0 3.8185-0 6.7417-0 12-0 17.2583-0 20.1815 1.9092 22.0908 3.8185 24 6.7417 24 12 24Z';
|
|
76
|
-
const DIAMOND_PATH = 'M 0 12 12 0 24 12 12 24 Z';
|
|
77
|
-
const SQUIRCLE_PATH = 'M12 24C17.2583 24 20.1815 24 22.0908 22.0908 24 20.1815 24 17.2583 24 12 24 6.7417 24 3.8185 22.0908 1.9092 20.1815-0 17.2583-0 12-0 6.7417-0 3.8185-0 1.9092 1.9092-0 3.8185-0 6.7417-0 12-0 17.2583-0 20.1815 1.9092 22.0908 3.8185 24 6.7417 24 12 24Z';
|
|
78
|
-
const HALF_NOTCH_PATH = 'M0 6H6V0H18V6H24V18H18V24H6V18H0Z';
|
|
79
|
-
|
|
80
|
-
const SHAPE_ROUNDED_DEFAULT = {
|
|
81
|
-
size: {
|
|
82
|
-
extraSmall: '4px',
|
|
83
|
-
small: '8px',
|
|
84
|
-
medium: '12px',
|
|
85
|
-
large: '16px',
|
|
86
|
-
extraLarge: '28px',
|
|
87
|
-
full: '32px',
|
|
88
|
-
},
|
|
89
|
-
/** @type {string?} */
|
|
90
|
-
mask: CIRCLE_PATH, // CIRCLE_PATH
|
|
91
|
-
convex: false,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const SHAPE_CUT_DEFAULT = {
|
|
95
|
-
...SHAPE_ROUNDED_DEFAULT,
|
|
96
|
-
size: {
|
|
97
|
-
extraSmall: '4px',
|
|
98
|
-
small: '8px',
|
|
99
|
-
medium: '12px',
|
|
100
|
-
large: '16px',
|
|
101
|
-
extraLarge: '28px',
|
|
102
|
-
full: '32px',
|
|
103
|
-
},
|
|
104
|
-
mask: DIAMOND_PATH,
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const SHAPE_SQUIRCLE_DEFAULT = {
|
|
108
|
-
...SHAPE_ROUNDED_DEFAULT,
|
|
109
|
-
mask: SQUIRCLE_PATH,
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const SP = 1 / 16;
|
|
113
|
-
|
|
114
|
-
const TYPOGRAPHY_DEFAULT = {
|
|
115
|
-
face: {
|
|
116
|
-
brand: '"Roboto Medium", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", Helvetica, "Segoe UI", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
117
|
-
plain: '"Roboto Regular", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", Helvetica, "Segoe UI", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
118
|
-
weight: {
|
|
119
|
-
regular: 400,
|
|
120
|
-
medium: 500,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
scale: {
|
|
124
|
-
display: {
|
|
125
|
-
large: {
|
|
126
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
127
|
-
lineHeight: 64,
|
|
128
|
-
fontSize: 57,
|
|
129
|
-
letterSpacing: 0,
|
|
130
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
131
|
-
},
|
|
132
|
-
medium: {
|
|
133
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
134
|
-
lineHeight: 52,
|
|
135
|
-
fontSize: 45,
|
|
136
|
-
letterSpacing: 0,
|
|
137
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
138
|
-
},
|
|
139
|
-
small: {
|
|
140
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
141
|
-
lineHeight: 44,
|
|
142
|
-
fontSize: 36,
|
|
143
|
-
letterSpacing: 0,
|
|
144
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
headline: {
|
|
148
|
-
large: {
|
|
149
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
150
|
-
lineHeight: 40,
|
|
151
|
-
fontSize: 32,
|
|
152
|
-
letterSpacing: 0,
|
|
153
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
154
|
-
},
|
|
155
|
-
medium: {
|
|
156
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
157
|
-
lineHeight: 36,
|
|
158
|
-
fontSize: 28,
|
|
159
|
-
letterSpacing: 0,
|
|
160
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
161
|
-
},
|
|
162
|
-
small: {
|
|
163
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
164
|
-
lineHeight: 32,
|
|
165
|
-
fontSize: 24,
|
|
166
|
-
letterSpacing: 0,
|
|
167
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
title: {
|
|
171
|
-
large: {
|
|
172
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
173
|
-
lineHeight: 28,
|
|
174
|
-
fontSize: 22,
|
|
175
|
-
letterSpacing: 0,
|
|
176
|
-
weight: 'var(--mdw-typeface__weight-medium)', // Figma style has regular
|
|
177
|
-
},
|
|
178
|
-
medium: {
|
|
179
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
180
|
-
lineHeight: 24,
|
|
181
|
-
fontSize: 16,
|
|
182
|
-
letterSpacing: 0.15,
|
|
183
|
-
weight: 'var(--mdw-typeface__weight-medium)',
|
|
184
|
-
},
|
|
185
|
-
small: {
|
|
186
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
187
|
-
lineHeight: 20,
|
|
188
|
-
fontSize: 14,
|
|
189
|
-
letterSpacing: 0.1,
|
|
190
|
-
weight: 'var(--mdw-typeface__weight-medium)',
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
label: {
|
|
194
|
-
large: {
|
|
195
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
196
|
-
lineHeight: 20,
|
|
197
|
-
fontSize: 14,
|
|
198
|
-
letterSpacing: 0.1,
|
|
199
|
-
weight: 'var(--mdw-typeface__weight-medium)',
|
|
200
|
-
},
|
|
201
|
-
medium: {
|
|
202
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
203
|
-
lineHeight: 16,
|
|
204
|
-
fontSize: 12,
|
|
205
|
-
letterSpacing: 0.5,
|
|
206
|
-
weight: 'var(--mdw-typeface__weight-medium)',
|
|
207
|
-
},
|
|
208
|
-
small: {
|
|
209
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
210
|
-
lineHeight: 16,
|
|
211
|
-
fontSize: 11,
|
|
212
|
-
letterSpacing: 0.5,
|
|
213
|
-
weight: 'var(--mdw-typeface__weight-medium)',
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
body: {
|
|
217
|
-
large: {
|
|
218
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
219
|
-
lineHeight: 24,
|
|
220
|
-
fontSize: 16,
|
|
221
|
-
letterSpacing: 0.5, // Figma text has 0.15
|
|
222
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
223
|
-
},
|
|
224
|
-
medium: {
|
|
225
|
-
fontFamily: 'var(--mdw-typeface__plain)',
|
|
226
|
-
lineHeight: 20,
|
|
227
|
-
fontSize: 14,
|
|
228
|
-
letterSpacing: 0.25,
|
|
229
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
230
|
-
},
|
|
231
|
-
small: {
|
|
232
|
-
fontFamily: 'var(--mdw-typeface__brand)',
|
|
233
|
-
lineHeight: 16,
|
|
234
|
-
fontSize: 12,
|
|
235
|
-
letterSpacing: 0.4,
|
|
236
|
-
weight: 'var(--mdw-typeface__weight-regular)',
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
};
|
|
241
|
-
|
|
242
92
|
/**
|
|
243
93
|
* @param {typeof TYPOGRAPHY_DEFAULT} config
|
|
244
94
|
* @return {string}
|
|
@@ -359,7 +209,7 @@ export function generateTypographyGlobalCSS() {
|
|
|
359
209
|
}
|
|
360
210
|
|
|
361
211
|
/**
|
|
362
|
-
* @param {typeof SHAPE_ROUNDED_DEFAULT} config
|
|
212
|
+
* @param {typeof SHAPE_ROUNDED_DEFAULT} [config]
|
|
363
213
|
* @return {string}
|
|
364
214
|
*/
|
|
365
215
|
export function generateShapeCSS(config = SHAPE_ROUNDED_DEFAULT) {
|
|
@@ -436,14 +286,14 @@ export function setupTheme({ color = '#6750A4', custom = [], lightness = 'auto'
|
|
|
436
286
|
* @return {ThemeOptions}
|
|
437
287
|
*/
|
|
438
288
|
export function themeOptionsFromSearchParams(searchParams) {
|
|
439
|
-
const color = searchParams
|
|
289
|
+
const color = searchParams?.get('color') || '#6750A4';
|
|
440
290
|
|
|
441
291
|
/** @type {[string,string?][]} */
|
|
442
|
-
const custom = searchParams
|
|
292
|
+
const custom = searchParams?.getAll('custom')
|
|
443
293
|
.flatMap((c) => c.split(','))
|
|
444
|
-
.map((c) => c.split(':'));
|
|
294
|
+
.map((c) => c.split(':')) ?? [];
|
|
445
295
|
|
|
446
|
-
const lightness = searchParams
|
|
296
|
+
const lightness = searchParams?.get('lightness') ?? 'auto';
|
|
447
297
|
return { color, custom, lightness };
|
|
448
298
|
}
|
|
449
299
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdw-css.d.ts","sourceRoot":"","sources":["../../bin/mdw-css.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const _default: typeof CustomElement & import("../core/CustomElement.js").Class<{
|
|
2
|
+
disabled: boolean;
|
|
3
|
+
focused: boolean;
|
|
4
|
+
hovered: boolean;
|
|
5
|
+
pressed: boolean;
|
|
6
|
+
_lastInteraction: "key" | "mouse" | "touch" | "pen";
|
|
7
|
+
_hovered: boolean;
|
|
8
|
+
_focused: boolean;
|
|
9
|
+
_focusedSynthetic: boolean;
|
|
10
|
+
_keyPressed: boolean;
|
|
11
|
+
_keyReleased: boolean;
|
|
12
|
+
_pointerPressed: boolean;
|
|
13
|
+
stateLayer: boolean;
|
|
14
|
+
}, any[]> & import("../core/CustomElement.js").Class<{
|
|
15
|
+
disabledState: boolean;
|
|
16
|
+
hoveredState: boolean;
|
|
17
|
+
focusedState: boolean;
|
|
18
|
+
pressedState: boolean;
|
|
19
|
+
touchedState: boolean;
|
|
20
|
+
pointedState: boolean;
|
|
21
|
+
}, any[]> & import("../core/CustomElement.js").Class<{
|
|
22
|
+
stateTargetElement: HTMLElement;
|
|
23
|
+
}, any[]> & import("../core/CustomElement.js").Class<{
|
|
24
|
+
color: string;
|
|
25
|
+
ink: string;
|
|
26
|
+
typeStyle: string;
|
|
27
|
+
}, any[]> & import("../core/CustomElement.js").Class<{
|
|
28
|
+
shapeTop: boolean;
|
|
29
|
+
shapeBottom: boolean;
|
|
30
|
+
shapeStart: boolean;
|
|
31
|
+
shapeEnd: boolean;
|
|
32
|
+
shapeStyle: string;
|
|
33
|
+
outlined: boolean;
|
|
34
|
+
}, any[]> & import("../core/CustomElement.js").Class<{
|
|
35
|
+
density: number;
|
|
36
|
+
}, any[]>;
|
|
37
|
+
export default _default;
|
|
38
|
+
import CustomElement from '../core/CustomElement.js';
|
|
39
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../components/Badge.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA0B,0BAA0B"}
|