@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
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import CorePalette from '../palettes/CorePalette.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents a Material color scheme, a mapping of color roles to colors.
|
|
22
|
+
*/
|
|
23
|
+
export default class Scheme {
|
|
24
|
+
/**
|
|
25
|
+
* @param {number} argb ARGB representation of a color.
|
|
26
|
+
* @return {Scheme} Light Material color scheme, based on the color's hue.
|
|
27
|
+
*/
|
|
28
|
+
static light(argb) {
|
|
29
|
+
return Scheme.lightFromCorePalette(CorePalette.of(argb));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {number} argb ARGB representation of a color.
|
|
34
|
+
* @return {Scheme} Dark Material color scheme, based on the color's hue.
|
|
35
|
+
*/
|
|
36
|
+
static dark(argb) {
|
|
37
|
+
return Scheme.darkFromCorePalette(CorePalette.of(argb));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {number} argb ARGB representation of a color.
|
|
42
|
+
* @return {Scheme} Light Material content color scheme, based on the color's hue.
|
|
43
|
+
*/
|
|
44
|
+
static lightContent(argb) {
|
|
45
|
+
return Scheme.lightFromCorePalette(CorePalette.contentOf(argb));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {number} argb ARGB representation of a color.
|
|
50
|
+
* @return {Scheme} Dark Material content color scheme, based on the color's hue.
|
|
51
|
+
*/
|
|
52
|
+
static darkContent(argb) {
|
|
53
|
+
return Scheme.darkFromCorePalette(CorePalette.contentOf(argb));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Light scheme from core palette
|
|
58
|
+
* @param {CorePalette} core
|
|
59
|
+
* @return {Scheme}
|
|
60
|
+
*/
|
|
61
|
+
static lightFromCorePalette(core) {
|
|
62
|
+
return new Scheme({
|
|
63
|
+
primary: core.a1.tone(40),
|
|
64
|
+
onPrimary: core.a1.tone(100),
|
|
65
|
+
primaryContainer: core.a1.tone(90),
|
|
66
|
+
onPrimaryContainer: core.a1.tone(10),
|
|
67
|
+
secondary: core.a2.tone(40),
|
|
68
|
+
onSecondary: core.a2.tone(100),
|
|
69
|
+
secondaryContainer: core.a2.tone(90),
|
|
70
|
+
onSecondaryContainer: core.a2.tone(10),
|
|
71
|
+
tertiary: core.a3.tone(40),
|
|
72
|
+
onTertiary: core.a3.tone(100),
|
|
73
|
+
tertiaryContainer: core.a3.tone(90),
|
|
74
|
+
onTertiaryContainer: core.a3.tone(10),
|
|
75
|
+
error: core.error.tone(40),
|
|
76
|
+
onError: core.error.tone(100),
|
|
77
|
+
errorContainer: core.error.tone(90),
|
|
78
|
+
onErrorContainer: core.error.tone(10),
|
|
79
|
+
background: core.n1.tone(98),
|
|
80
|
+
onBackground: core.n1.tone(10),
|
|
81
|
+
surface: core.n1.tone(98),
|
|
82
|
+
onSurface: core.n1.tone(10),
|
|
83
|
+
surfaceDim: core.n1.tone(87),
|
|
84
|
+
surfaceBright: core.n1.tone(98),
|
|
85
|
+
surfaceContainerLowest: core.n1.tone(100),
|
|
86
|
+
surfaceContainerLow: core.n1.tone(96),
|
|
87
|
+
surfaceContainer: core.n1.tone(94),
|
|
88
|
+
surfaceContainerHigh: core.n1.tone(92),
|
|
89
|
+
surfaceContainerHighest: core.n1.tone(90),
|
|
90
|
+
surfaceVariant: core.n2.tone(90),
|
|
91
|
+
onSurfaceVariant: core.n2.tone(30),
|
|
92
|
+
outline: core.n2.tone(50),
|
|
93
|
+
outlineVariant: core.n2.tone(80),
|
|
94
|
+
shadow: core.n1.tone(0),
|
|
95
|
+
scrim: core.n1.tone(0),
|
|
96
|
+
inverseSurface: core.n1.tone(20),
|
|
97
|
+
inverseOnSurface: core.n1.tone(95),
|
|
98
|
+
inversePrimary: core.a1.tone(80),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Dark scheme from core palette
|
|
104
|
+
* @param {CorePalette} core
|
|
105
|
+
* @return {Scheme}
|
|
106
|
+
*/
|
|
107
|
+
static darkFromCorePalette(core) {
|
|
108
|
+
return new Scheme({
|
|
109
|
+
primary: core.a1.tone(80),
|
|
110
|
+
onPrimary: core.a1.tone(20),
|
|
111
|
+
primaryContainer: core.a1.tone(30),
|
|
112
|
+
onPrimaryContainer: core.a1.tone(90),
|
|
113
|
+
secondary: core.a2.tone(80),
|
|
114
|
+
onSecondary: core.a2.tone(20),
|
|
115
|
+
secondaryContainer: core.a2.tone(30),
|
|
116
|
+
onSecondaryContainer: core.a2.tone(90),
|
|
117
|
+
tertiary: core.a3.tone(80),
|
|
118
|
+
onTertiary: core.a3.tone(20),
|
|
119
|
+
tertiaryContainer: core.a3.tone(30),
|
|
120
|
+
onTertiaryContainer: core.a3.tone(90),
|
|
121
|
+
error: core.error.tone(80),
|
|
122
|
+
onError: core.error.tone(20),
|
|
123
|
+
errorContainer: core.error.tone(30),
|
|
124
|
+
onErrorContainer: core.error.tone(90), // Fix Typo
|
|
125
|
+
background: core.n1.tone(6),
|
|
126
|
+
onBackground: core.n1.tone(90),
|
|
127
|
+
surface: core.n1.tone(6),
|
|
128
|
+
onSurface: core.n1.tone(90),
|
|
129
|
+
surfaceDim: core.n1.tone(6),
|
|
130
|
+
surfaceBright: core.n1.tone(24),
|
|
131
|
+
surfaceContainerLowest: core.n1.tone(4),
|
|
132
|
+
surfaceContainerLow: core.n1.tone(10),
|
|
133
|
+
surfaceContainer: core.n1.tone(12),
|
|
134
|
+
surfaceContainerHigh: core.n1.tone(17),
|
|
135
|
+
surfaceContainerHighest: core.n1.tone(22),
|
|
136
|
+
surfaceVariant: core.n2.tone(30),
|
|
137
|
+
onSurfaceVariant: core.n2.tone(80),
|
|
138
|
+
outline: core.n2.tone(60),
|
|
139
|
+
outlineVariant: core.n2.tone(30),
|
|
140
|
+
shadow: core.n1.tone(40), // (Underlight)
|
|
141
|
+
scrim: core.n1.tone(0),
|
|
142
|
+
inverseSurface: core.n1.tone(90),
|
|
143
|
+
inverseOnSurface: core.n1.tone(20),
|
|
144
|
+
inversePrimary: core.a1.tone(40),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @param {Object} props
|
|
150
|
+
* @param {number} props.primary
|
|
151
|
+
* @param {number} props.onPrimary
|
|
152
|
+
* @param {number} props.primaryContainer
|
|
153
|
+
* @param {number} props.onPrimaryContainer
|
|
154
|
+
* @param {number} props.secondary
|
|
155
|
+
* @param {number} props.onSecondary
|
|
156
|
+
* @param {number} props.secondaryContainer
|
|
157
|
+
* @param {number} props.onSecondaryContainer
|
|
158
|
+
* @param {number} props.tertiary
|
|
159
|
+
* @param {number} props.onTertiary
|
|
160
|
+
* @param {number} props.tertiaryContainer
|
|
161
|
+
* @param {number} props.onTertiaryContainer
|
|
162
|
+
* @param {number} props.error
|
|
163
|
+
* @param {number} props.onError
|
|
164
|
+
* @param {number} props.errorContainer
|
|
165
|
+
* @param {number} props.onErrorContainer
|
|
166
|
+
* @param {number} props.background
|
|
167
|
+
* @param {number} props.onBackground
|
|
168
|
+
* @param {number} props.surface
|
|
169
|
+
* @param {number} props.onSurface
|
|
170
|
+
* @param {number} props.surfaceDim
|
|
171
|
+
* @param {number} props.surfaceBright
|
|
172
|
+
* @param {number} props.surfaceContainerLowest
|
|
173
|
+
* @param {number} props.surfaceContainerLow
|
|
174
|
+
* @param {number} props.surfaceContainer
|
|
175
|
+
* @param {number} props.surfaceContainerHigh
|
|
176
|
+
* @param {number} props.surfaceContainerHighest
|
|
177
|
+
* @param {number} props.surfaceVariant
|
|
178
|
+
* @param {number} props.onSurfaceVariant
|
|
179
|
+
* @param {number} props.outline
|
|
180
|
+
* @param {number} props.outlineVariant
|
|
181
|
+
* @param {number} props.shadow
|
|
182
|
+
* @param {number} props.scrim
|
|
183
|
+
* @param {number} props.inverseSurface
|
|
184
|
+
* @param {number} props.inverseOnSurface
|
|
185
|
+
* @param {number} props.inversePrimary
|
|
186
|
+
*/
|
|
187
|
+
constructor(props) {
|
|
188
|
+
this.props = props;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** @return {number} */
|
|
192
|
+
get primary() {
|
|
193
|
+
return this.props.primary;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** @return {number} */
|
|
197
|
+
get onPrimary() {
|
|
198
|
+
return this.props.onPrimary;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** @return {number} */
|
|
202
|
+
get primaryContainer() {
|
|
203
|
+
return this.props.primaryContainer;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** @return {number} */
|
|
207
|
+
get onPrimaryContainer() {
|
|
208
|
+
return this.props.onPrimaryContainer;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** @return {number} */
|
|
212
|
+
get secondary() {
|
|
213
|
+
return this.props.secondary;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** @return {number} */
|
|
217
|
+
get onSecondary() {
|
|
218
|
+
return this.props.onSecondary;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** @return {number} */
|
|
222
|
+
get secondaryContainer() {
|
|
223
|
+
return this.props.secondaryContainer;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** @return {number} */
|
|
227
|
+
get onSecondaryContainer() {
|
|
228
|
+
return this.props.onSecondaryContainer;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** @return {number} */
|
|
232
|
+
get tertiary() {
|
|
233
|
+
return this.props.tertiary;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** @return {number} */
|
|
237
|
+
get onTertiary() {
|
|
238
|
+
return this.props.onTertiary;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** @return {number} */
|
|
242
|
+
get tertiaryContainer() {
|
|
243
|
+
return this.props.tertiaryContainer;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** @return {number} */
|
|
247
|
+
get onTertiaryContainer() {
|
|
248
|
+
return this.props.onTertiaryContainer;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** @return {number} */
|
|
252
|
+
get error() {
|
|
253
|
+
return this.props.error;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** @return {number} */
|
|
257
|
+
get onError() {
|
|
258
|
+
return this.props.onError;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** @return {number} */
|
|
262
|
+
get errorContainer() {
|
|
263
|
+
return this.props.errorContainer;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** @return {number} */
|
|
267
|
+
get onErrorContainer() {
|
|
268
|
+
return this.props.onErrorContainer;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** @return {number} */
|
|
272
|
+
get background() {
|
|
273
|
+
return this.props.background;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** @return {number} */
|
|
277
|
+
get onBackground() {
|
|
278
|
+
return this.props.onBackground;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** @return {number} */
|
|
282
|
+
get surface() {
|
|
283
|
+
return this.props.surface;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** @return {number} */
|
|
287
|
+
get onSurface() {
|
|
288
|
+
return this.props.onSurface;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** @return {number} */
|
|
292
|
+
get surfaceDim() {
|
|
293
|
+
return this.props.surfaceDim;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** @return {number} */
|
|
297
|
+
get surfaceBright() {
|
|
298
|
+
return this.props.surfaceBright;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** @return {number} */
|
|
302
|
+
get surfaceContainerLowest() {
|
|
303
|
+
return this.props.surfaceContainerLowest;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** @return {number} */
|
|
307
|
+
get surfaceContainerLow() {
|
|
308
|
+
return this.props.surfaceContainerLow;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** @return {number} */
|
|
312
|
+
get surfaceContainer() {
|
|
313
|
+
return this.props.surfaceContainer;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** @return {number} */
|
|
317
|
+
get surfaceContainerHigh() {
|
|
318
|
+
return this.props.surfaceContainerHigh;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** @return {number} */
|
|
322
|
+
get surfaceContainerHighest() {
|
|
323
|
+
return this.props.surfaceContainerHighest;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** @return {number} */
|
|
327
|
+
get surfaceVariant() {
|
|
328
|
+
return this.props.surfaceVariant;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** @return {number} */
|
|
332
|
+
get onSurfaceVariant() {
|
|
333
|
+
return this.props.onSurfaceVariant;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** @return {number} */
|
|
337
|
+
get outline() {
|
|
338
|
+
return this.props.outline;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** @return {number} */
|
|
342
|
+
get outlineVariant() {
|
|
343
|
+
return this.props.outlineVariant;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** @return {number} */
|
|
347
|
+
get shadow() {
|
|
348
|
+
return this.props.shadow;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** @return {number} */
|
|
352
|
+
get scrim() {
|
|
353
|
+
return this.props.scrim;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** @return {number} */
|
|
357
|
+
get inverseSurface() {
|
|
358
|
+
return this.props.inverseSurface;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** @return {number} */
|
|
362
|
+
get inverseOnSurface() {
|
|
363
|
+
return this.props.inverseOnSurface;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** @return {number} */
|
|
367
|
+
get inversePrimary() {
|
|
368
|
+
return this.props.inversePrimary;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
toJSON() {
|
|
372
|
+
return {
|
|
373
|
+
...this.props,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
// This file is automatically generated. Do not modify it.
|
|
19
19
|
|
|
20
|
-
import * as mathUtils from './
|
|
20
|
+
import * as mathUtils from './math.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Color science utilities.
|
|
@@ -236,6 +236,20 @@ export function yFromLstar(lstar) {
|
|
|
236
236
|
return 100 * labInvf((lstar + 16) / 116);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Converts a Y value to an L* value.
|
|
241
|
+
*
|
|
242
|
+
* L* in L*a*b* and Y in XYZ measure the same quantity, luminance.
|
|
243
|
+
*
|
|
244
|
+
* L* measures perceptual luminance, a linear scale. Y in XYZ
|
|
245
|
+
* measures relative luminance, a logarithmic scale.
|
|
246
|
+
* @param {number} y Y in XYZ
|
|
247
|
+
* @return {number} L* in L*a*b*
|
|
248
|
+
*/
|
|
249
|
+
export function lstarFromY(y) {
|
|
250
|
+
return labF(y / 100) * 116 - 16;
|
|
251
|
+
}
|
|
252
|
+
|
|
239
253
|
/**
|
|
240
254
|
* Linearizes an RGB component.
|
|
241
255
|
* @param {number} rgbComponent 0 <= rgb_component <= 255, represents R/G/B
|
|
@@ -274,6 +288,52 @@ export function whitePointD65() {
|
|
|
274
288
|
}
|
|
275
289
|
|
|
276
290
|
/**
|
|
291
|
+
* RGBA component
|
|
292
|
+
* @typedef Rgba
|
|
293
|
+
* @prop {number} r Red value should be between 0-255
|
|
294
|
+
* @prop {number} g Green value should be between 0-255
|
|
295
|
+
* @prop {number} b Blue value should be between 0-255
|
|
296
|
+
* @prop {number} a Alpha value should be between 0-255
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Return RGBA from a given int32 color
|
|
301
|
+
* @param {number} argb ARGB representation of a int32 color.
|
|
302
|
+
* @return {Rgba} RGBA representation of a int32 color.
|
|
303
|
+
*/
|
|
304
|
+
export function rgbaFromArgb(argb) {
|
|
305
|
+
const r = redFromArgb(argb);
|
|
306
|
+
const g = greenFromArgb(argb);
|
|
307
|
+
const b = blueFromArgb(argb);
|
|
308
|
+
const a = alphaFromArgb(argb);
|
|
309
|
+
return { r, g, b, a };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Return int32 color from a given RGBA component
|
|
314
|
+
* @param {Rgba} rgba RGBA representation of a int32 color.
|
|
315
|
+
* @return {number} ARGB representation of a int32 color.
|
|
316
|
+
*/
|
|
317
|
+
export function argbFromRgba({ r, g, b, a }) {
|
|
318
|
+
const rValue = clampComponent(r);
|
|
319
|
+
const gValue = clampComponent(g);
|
|
320
|
+
const bValue = clampComponent(b);
|
|
321
|
+
const aValue = clampComponent(a);
|
|
322
|
+
return (aValue << 24) | (rValue << 16) | (gValue << 8) | bValue;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @param {number} value
|
|
327
|
+
* @return {number}
|
|
328
|
+
*/
|
|
329
|
+
function clampComponent(value) {
|
|
330
|
+
if (value < 0) return 0;
|
|
331
|
+
if (value > 255) return 255;
|
|
332
|
+
return value;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
*
|
|
277
337
|
* @param {number} t
|
|
278
338
|
* @return {number}
|
|
279
339
|
*/
|