@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
package/components/ListSelect.js
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { constructHTMLOptionsCollectionProxy } from '../dom/HTMLOptionsCollectionProxy.js';
|
|
2
|
-
import FormAssociatedMixin from '../mixins/FormAssociatedMixin.js';
|
|
3
|
-
import KeyboardNavMixin from '../mixins/KeyboardNavMixin.js';
|
|
4
|
-
import StateMixin from '../mixins/StateMixin.js';
|
|
5
|
-
|
|
6
|
-
import List from './List.js';
|
|
7
|
-
import ListOption from './ListOption.js';
|
|
8
|
-
|
|
9
|
-
/** @implements {HTMLSelectElement} */
|
|
10
|
-
export default class ListSelect extends List
|
|
11
|
-
.mixin(StateMixin)
|
|
12
|
-
.mixin(FormAssociatedMixin)
|
|
13
|
-
.mixin(KeyboardNavMixin) {
|
|
14
|
-
static {
|
|
15
|
-
this.autoRegister('mdw-list-select');
|
|
16
|
-
// eslint-disable-next-line no-unused-expressions
|
|
17
|
-
this.css`
|
|
18
|
-
:host(:disabled) {
|
|
19
|
-
cursor: not-allowed;
|
|
20
|
-
pointer-events: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host([internals-disabled]) {
|
|
24
|
-
cursor: not-allowed;
|
|
25
|
-
pointer-events: none;
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
this.on({
|
|
29
|
-
disabledStateChanged(oldValue, newValue) {
|
|
30
|
-
this._kbdFocusable = !newValue;
|
|
31
|
-
this.tabIndex = newValue ? -1 : 0;
|
|
32
|
-
},
|
|
33
|
-
multipleChanged(oldValue, newValue) {
|
|
34
|
-
this.updateAriaProperty('ariaMultiSelectable', newValue ? 'true' : 'false');
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** @type {HTMLCollectionOf<ListOption> & HTMLOptionsCollection} */
|
|
40
|
-
_optionsCollection = null;
|
|
41
|
-
|
|
42
|
-
constructor() {
|
|
43
|
-
super();
|
|
44
|
-
this.refs.slot.addEventListener('slotchange', this.onSlotChange);
|
|
45
|
-
this.addEventListener('keydown', this.onControlKeydown);
|
|
46
|
-
this.addEventListener('click', this.onListSelectClick);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
connectedCallback() {
|
|
50
|
-
super.connectedCallback();
|
|
51
|
-
if (!this.hasAttribute('tabindex')) {
|
|
52
|
-
this.tabIndex = 0;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
* _selectedOptionsGenerator() {
|
|
57
|
-
for (const el of this.options) {
|
|
58
|
-
if (!el.selected) continue;
|
|
59
|
-
yield el;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @param {Event} event
|
|
65
|
-
* @this {HTMLSlotElement}
|
|
66
|
-
* @return {void}
|
|
67
|
-
*/
|
|
68
|
-
onSlotChange(event) {
|
|
69
|
-
/** @type {{host:ListSelect}} */ // @ts-ignore Coerce
|
|
70
|
-
const { host } = this.getRootNode();
|
|
71
|
-
host.refreshTabIndexes();
|
|
72
|
-
let index = 0;
|
|
73
|
-
for (const el of host.options) {
|
|
74
|
-
el._index = index++;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @param {KeyboardEvent} event
|
|
80
|
-
* @this {ListSelect}
|
|
81
|
-
* @return {void}
|
|
82
|
-
*/
|
|
83
|
-
onControlKeydown(event) {
|
|
84
|
-
if (event.key === 'Spacebar' || event.key === ' ') {
|
|
85
|
-
const target = event.target;
|
|
86
|
-
if (!(target instanceof ListOption)) return;
|
|
87
|
-
event.stopPropagation();
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
this.onListSelectClick.call(this, event);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @param {MouseEvent|KeyboardEvent} event
|
|
95
|
-
* @this {ListSelect}
|
|
96
|
-
* @return {void}
|
|
97
|
-
*/
|
|
98
|
-
onListSelectClick(event) {
|
|
99
|
-
console.log('onListSelectClick');
|
|
100
|
-
const target = event.target;
|
|
101
|
-
if (!(target instanceof ListOption)) return;
|
|
102
|
-
event.stopPropagation();
|
|
103
|
-
if (target.disabledState) return;
|
|
104
|
-
|
|
105
|
-
// Perform unselect
|
|
106
|
-
if (target.selected) {
|
|
107
|
-
if (this.multiple) {
|
|
108
|
-
const selections = [...this.selectedOptions];
|
|
109
|
-
if (this.required && selections.length === 1) return;
|
|
110
|
-
if (selections.length === 0) {
|
|
111
|
-
console.warn('impossible??');
|
|
112
|
-
}
|
|
113
|
-
target.selected = false;
|
|
114
|
-
let firstSelection = selections.shift();
|
|
115
|
-
if (firstSelection === target) {
|
|
116
|
-
// Get new first selection (or undefined)
|
|
117
|
-
firstSelection = selections.shift();
|
|
118
|
-
}
|
|
119
|
-
this._value = firstSelection?.value ?? '';
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (this.required) return;
|
|
123
|
-
target.selected = false;
|
|
124
|
-
this._value = '';
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (this.multiple) {
|
|
129
|
-
// Skip ctrlKey requirement
|
|
130
|
-
target.selected = true;
|
|
131
|
-
this._value = this.selectedOptions.next().value;
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
for (const el of this.options) {
|
|
136
|
-
el.selected = el === target;
|
|
137
|
-
}
|
|
138
|
-
this._value = target.value;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
formResetCallback() {
|
|
142
|
-
// TODO: Reset dirty on options
|
|
143
|
-
super.formResetCallback();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
get options() {
|
|
147
|
-
if (!this._optionsCollection) {
|
|
148
|
-
this._optionsCollection = constructHTMLOptionsCollectionProxy({
|
|
149
|
-
host: this,
|
|
150
|
-
collection: this.getElementsByTagName(ListOption.elementName),
|
|
151
|
-
OptionConstructor: ListOption,
|
|
152
|
-
GroupConstructor: ListOption,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
return this._optionsCollection;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
get selectedOptions() {
|
|
159
|
-
return this._selectedOptionsGenerator();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// @ts-ignore @override
|
|
163
|
-
get type() { return 'select'; }
|
|
164
|
-
|
|
165
|
-
/** @override */
|
|
166
|
-
get kbdNavQuery() { return ListOption.elementName; }
|
|
167
|
-
|
|
168
|
-
// @ts-ignore @override
|
|
169
|
-
get length() {
|
|
170
|
-
return this.options.length;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
get selectedIndex() {
|
|
174
|
-
return this.options.selectedIndex;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
set selectedIndex(value) {
|
|
178
|
-
this.options.selectedIndex = value;
|
|
179
|
-
this._value = (this.options.item(value)?.value) ?? '';
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
get value() {
|
|
183
|
-
return this._value;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/** @param {string} v */
|
|
187
|
-
set value(v) {
|
|
188
|
-
for (const el of this.options) {
|
|
189
|
-
el.selected = (el.value === v);
|
|
190
|
-
}
|
|
191
|
-
this._value = v;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
get add() { return this.options.add; }
|
|
195
|
-
|
|
196
|
-
get item() { return this.options.item; }
|
|
197
|
-
|
|
198
|
-
get namedItem() { return this.options.namedItem; }
|
|
199
|
-
|
|
200
|
-
* [Symbol.iterator]() {
|
|
201
|
-
for (const el of this.options) {
|
|
202
|
-
yield el;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
get kbdNavFocusableWhenDisabled() { return true; }
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// https://html.spec.whatwg.org/multipage/form-elements.html#htmlselectelement
|
|
210
|
-
|
|
211
|
-
// [CEReactions] attribute DOMString autocomplete;
|
|
212
|
-
// ListSelect.prototype.disabled = ListSelect.prop('disabled', { type: 'boolean' });
|
|
213
|
-
// readonly attribute HTMLFormElement? form;
|
|
214
|
-
ListSelect.prototype.multiple = ListSelect.prop('multiple', { type: 'boolean' });
|
|
215
|
-
// [CEReactions] attribute boolean multiple;
|
|
216
|
-
// [CEReactions] attribute DOMString name;
|
|
217
|
-
// [CEReactions] attribute boolean required;
|
|
218
|
-
ListSelect.prototype.size = ListSelect.prop('size', { type: 'integer', empty: 0 });
|
|
219
|
-
ListSelect.prototype._ariaRole = 'listbox';
|
|
220
|
-
ListSelect.prototype.delegatesFocus = true;
|
package/components/Nav.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import NavItem from './NavItem.js';
|
|
2
|
-
import Surface from './Surface.js';
|
|
3
|
-
|
|
4
|
-
export default Surface
|
|
5
|
-
.extend()
|
|
6
|
-
.css`
|
|
7
|
-
/* https://m3.material.io/components/navigation-bar/specs */
|
|
8
|
-
/* https://m3.material.io/components/navigation-drawer/specs */
|
|
9
|
-
/* https://m3.material.io/components/navigation-rail/specs */
|
|
10
|
-
|
|
11
|
-
:host {
|
|
12
|
-
--mdw-surface__tint: var(--mdw-surface__tint__2);
|
|
13
|
-
--mdw-surface__tint__raised: var(--mdw-surface__tint__2);
|
|
14
|
-
--mdw-ink: var(--mdw-color__on-surface);
|
|
15
|
-
--mdw-bg: var(--mdw-color__surface);
|
|
16
|
-
|
|
17
|
-
z-index:2;
|
|
18
|
-
|
|
19
|
-
color: rgb(var(--mdw-ink));
|
|
20
|
-
|
|
21
|
-
font: var(--mdw-typescale__label-medium__font);
|
|
22
|
-
letter-spacing: var(--mdw-typescale__label-medium__letter-spacing);
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
.set({
|
|
26
|
-
elevated: true,
|
|
27
|
-
color: 'surface',
|
|
28
|
-
})
|
|
29
|
-
.events({
|
|
30
|
-
'~click'(event) {
|
|
31
|
-
// Abort if not child
|
|
32
|
-
if (event.target === this) return;
|
|
33
|
-
if (event.target instanceof NavItem === false) return;
|
|
34
|
-
for (const el of this.querySelectorAll('*')) {
|
|
35
|
-
if (el instanceof NavItem === false) continue;
|
|
36
|
-
el.active = (el === event.target);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
.autoRegister('mdw-nav');
|
package/components/Option.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// https://www.w3.org/WAI/ARIA/apg/patterns/listbox/
|
|
2
|
-
|
|
3
|
-
import MenuItem from './MenuItem.js';
|
|
4
|
-
|
|
5
|
-
// https://html.spec.whatwg.org/multipage/form-elements.html#htmloptionelement
|
|
6
|
-
|
|
7
|
-
/** @implements {HTMLOptionElement} */
|
|
8
|
-
export default class Option extends MenuItem
|
|
9
|
-
.extend()
|
|
10
|
-
.set({
|
|
11
|
-
disabled: undefined, // Remove observer
|
|
12
|
-
_index: -1,
|
|
13
|
-
})
|
|
14
|
-
.observe({
|
|
15
|
-
// ListOption.prototype._form = ListOption.prop('_form');
|
|
16
|
-
_label: { attr: 'label', nullParser: String },
|
|
17
|
-
defaultSelected: { attr: 'selected', type: 'boolean' },
|
|
18
|
-
_selected: 'boolean',
|
|
19
|
-
_value: { attr: 'value', reflect: true },
|
|
20
|
-
})
|
|
21
|
-
.define({
|
|
22
|
-
index() { return this._index; },
|
|
23
|
-
form() { return /** @type {import('./ListSelect.js').default} */ (this.parentElement)?.form; },
|
|
24
|
-
|
|
25
|
-
label: {
|
|
26
|
-
get() { return this._label; },
|
|
27
|
-
/** @param {string} value */
|
|
28
|
-
set(value) {
|
|
29
|
-
this._label = value;
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
value: {
|
|
33
|
-
get() { return this._value || this.text; },
|
|
34
|
-
/** @param {string} value */
|
|
35
|
-
set(value) { this._label = value; },
|
|
36
|
-
},
|
|
37
|
-
selected: {
|
|
38
|
-
get() { return this._selected; },
|
|
39
|
-
/** @param {boolean} value */
|
|
40
|
-
set(value) { this._selected = value; },
|
|
41
|
-
},
|
|
42
|
-
disabled: {
|
|
43
|
-
get() {
|
|
44
|
-
return this.getAttribute('aria-disabled') === 'true' || this._disabled;
|
|
45
|
-
},
|
|
46
|
-
/** @param {boolean} value */
|
|
47
|
-
set(value) {
|
|
48
|
-
this._disabled = value;
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
.on('composed', ({ $ }) => {
|
|
54
|
-
// $('#state').setAttribute('state-disabled', 'focus hover');
|
|
55
|
-
})
|
|
56
|
-
.onPropChanged({
|
|
57
|
-
checkbox(oldValue, newValue) {
|
|
58
|
-
if (newValue) {
|
|
59
|
-
this.setAttribute('aria-selected', String(this.hasAttribute('selected')));
|
|
60
|
-
} else {
|
|
61
|
-
this.removeAttribute('aria-selected');
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
_selected(oldValue, newValue) {
|
|
65
|
-
this.setAttribute('aria-selected', String(newValue));
|
|
66
|
-
},
|
|
67
|
-
}) {
|
|
68
|
-
static { this.autoRegister('mdw-option'); }
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @param {string} [text]
|
|
72
|
-
* @param {string} [value]
|
|
73
|
-
* @param {boolean} [defaultSelected]
|
|
74
|
-
* @param {boolean} [selected]
|
|
75
|
-
*/
|
|
76
|
-
constructor(text, value, defaultSelected, selected) {
|
|
77
|
-
super();
|
|
78
|
-
if (text !== undefined) {
|
|
79
|
-
this.text = text;
|
|
80
|
-
}
|
|
81
|
-
if (value !== undefined) {
|
|
82
|
-
this._value = value;
|
|
83
|
-
}
|
|
84
|
-
if (defaultSelected !== undefined) {
|
|
85
|
-
this.defaultSelected = defaultSelected;
|
|
86
|
-
}
|
|
87
|
-
if (selected !== undefined) {
|
|
88
|
-
this._selected = selected;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
package/core/ICustomElement.d.ts
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
|
-
|
|
3
|
-
import Composition from './Composition.js';
|
|
4
|
-
import {
|
|
5
|
-
CompositionEventListener,
|
|
6
|
-
CompositionEventListenerObject,
|
|
7
|
-
HTMLTemplater,
|
|
8
|
-
ObserverOptions,
|
|
9
|
-
ObserverPropertyType,
|
|
10
|
-
ParsedObserverPropertyType,
|
|
11
|
-
ParsedProps,
|
|
12
|
-
} from './typings.js';
|
|
13
|
-
|
|
14
|
-
type ClassOf<T extends { prototype: unknown; } > = T;
|
|
15
|
-
|
|
16
|
-
type CallbackArguments<T1 = any, T2 = T1> = {
|
|
17
|
-
composition: Composition<T1>;
|
|
18
|
-
html: HTMLTemplater<T1, Partial<T2>>;
|
|
19
|
-
inline: (fn: (this:T1, data: {[K in keyof T2]?: T2[K]}) => any) => string;
|
|
20
|
-
template: DocumentFragment;
|
|
21
|
-
element: T1;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type IDLParameter<C extends object> = {
|
|
25
|
-
[P in string] :
|
|
26
|
-
ObserverPropertyType
|
|
27
|
-
| ObserverOptions<ObserverPropertyType, unknown, C>
|
|
28
|
-
| ((this:C, data:Partial<C>, fn?: () => any) => any)
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type ExtendedClass<T1 extends typeof ICustomElement, T2 extends abstract new (...args: any) => any> =
|
|
32
|
-
Omit<T1, 'prototype'> & T2;
|
|
33
|
-
|
|
34
|
-
type ConstructorLess<T1 extends object, T2 extends abstract new (...args: any) => any> = T1 & T2;
|
|
35
|
-
|
|
36
|
-
declare type DefinedPropertiesOf<T extends ({ prototype: unknown; } & (new (...args: any) => any)), P> =
|
|
37
|
-
{[K in keyof T]: T[K]}
|
|
38
|
-
& { new(): (...args: ConstructorParameters<T>) => InstanceType<T> & P}
|
|
39
|
-
& { prototype: T['prototype'] & P };
|
|
40
|
-
|
|
41
|
-
type CompositionCallback<T1, T2=T1> = {
|
|
42
|
-
composed?: (this: T1, options: CallbackArguments<T1, T2>) => any,
|
|
43
|
-
constructed?: (this: T1, options: CallbackArguments<T1, T2>) => any,
|
|
44
|
-
connected?: (this: T1, options: CallbackArguments<T1, T2>) => any,
|
|
45
|
-
disconnected?: (this: T1, options: CallbackArguments<T1, T2>) => any,
|
|
46
|
-
props?: {
|
|
47
|
-
[P in keyof T1] : (
|
|
48
|
-
this: T1,
|
|
49
|
-
oldValue: T1[P],
|
|
50
|
-
newValue: T1[P],
|
|
51
|
-
changes:any,
|
|
52
|
-
element: T1
|
|
53
|
-
) => any
|
|
54
|
-
},
|
|
55
|
-
attrs?: {[K in keyof any]: (
|
|
56
|
-
this: T1,
|
|
57
|
-
oldValue: string,
|
|
58
|
-
newValue: string,
|
|
59
|
-
element: T1
|
|
60
|
-
) => unknown
|
|
61
|
-
},
|
|
62
|
-
} & {
|
|
63
|
-
[P in keyof T1 & string as `${P}Changed`]?: (
|
|
64
|
-
this: T1,
|
|
65
|
-
oldValue: T1[P],
|
|
66
|
-
newValue: T1[P],
|
|
67
|
-
changes:any,
|
|
68
|
-
element: T1
|
|
69
|
-
) => any
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare interface ICustomElementInstance extends HTMLElement {
|
|
73
|
-
ariaActiveDescendantElement: Element
|
|
74
|
-
propChangedCallback<
|
|
75
|
-
T extends ICustomElementInstance,
|
|
76
|
-
K extends string = string,
|
|
77
|
-
>(this:T,
|
|
78
|
-
name: K,
|
|
79
|
-
oldValue: K extends keyof T ? T[K] : unknown,
|
|
80
|
-
newValue: K extends keyof T ? T[K] : unknown,
|
|
81
|
-
changes?: K extends keyof T ? T[K] extends object ? Partial<T[K]> : T[K] : unknown): void;
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface ConstructorOf<T> {
|
|
86
|
-
new(): T;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export declare const ICustomElement: {
|
|
90
|
-
new(): ICustomElementInstance;
|
|
91
|
-
prototype: ICustomElementInstance;
|
|
92
|
-
|
|
93
|
-
_onComposeCallbacks: ((callback: CallbackArguments) => any)[];
|
|
94
|
-
|
|
95
|
-
_onConnectedCallbacks: ((callback: CallbackArguments) => any)[];
|
|
96
|
-
|
|
97
|
-
_onDisconnectedCallbacks: ((callback: CallbackArguments) => any)[];
|
|
98
|
-
|
|
99
|
-
_onConstructedCallbacks: ((callback: CallbackArguments) => any)[];
|
|
100
|
-
|
|
101
|
-
schema: Record<string, unknown>;
|
|
102
|
-
|
|
103
|
-
extend<T extends typeof ICustomElement>(this: T): T;
|
|
104
|
-
|
|
105
|
-
tsClassFix<T extends typeof ICustomElement>(this:T): T & (new (...args:any[]) => InstanceType<T>)
|
|
106
|
-
|
|
107
|
-
html<T extends typeof ICustomElement>(
|
|
108
|
-
this: T,
|
|
109
|
-
string: TemplateStringsArray,
|
|
110
|
-
// eslint-disable-next-line no-shadow
|
|
111
|
-
...substitutions: (string|Element|((this:InstanceType<T>, data:InstanceType<T> & T['schema']) => any))[]
|
|
112
|
-
): T
|
|
113
|
-
|
|
114
|
-
css<
|
|
115
|
-
T1 extends typeof ICustomElement,
|
|
116
|
-
T2 extends TemplateStringsArray|HTMLStyleElement|CSSStyleSheet>(
|
|
117
|
-
this: T1,
|
|
118
|
-
array: T2,
|
|
119
|
-
...rest: T2 extends TemplateStringsArray ? string[] : (HTMLStyleElement|CSSStyleSheet)[]
|
|
120
|
-
): T1
|
|
121
|
-
|
|
122
|
-
define<
|
|
123
|
-
CLASS extends typeof ICustomElement,
|
|
124
|
-
ARGS extends ConstructorParameters<CLASS>,
|
|
125
|
-
INSTANCE extends InstanceType<CLASS>,
|
|
126
|
-
PROPS extends {
|
|
127
|
-
[P in keyof any] :
|
|
128
|
-
{
|
|
129
|
-
enumerable?: boolean;
|
|
130
|
-
configurable?: boolean;
|
|
131
|
-
writable?: boolean;
|
|
132
|
-
value?: any;
|
|
133
|
-
get?: ((this: INSTANCE) => any);
|
|
134
|
-
set?: (this: INSTANCE, value: any) => void;
|
|
135
|
-
} | ((this: INSTANCE, ...args:any[]) => any)
|
|
136
|
-
},
|
|
137
|
-
VALUE extends {
|
|
138
|
-
[KEY in keyof PROPS]: PROPS[KEY] extends (...args2:any[]) => infer R ? R
|
|
139
|
-
: PROPS[KEY] extends TypedPropertyDescriptor<infer R> ? R : never
|
|
140
|
-
}>
|
|
141
|
-
(this: CLASS, props: PROPS & ThisType<PROPS & INSTANCE>): CLASS
|
|
142
|
-
& (new (...args: ARGS) => INSTANCE & VALUE)
|
|
143
|
-
|
|
144
|
-
observe<
|
|
145
|
-
CLASS extends typeof ICustomElement,
|
|
146
|
-
ARGS extends ConstructorParameters<CLASS>,
|
|
147
|
-
INSTANCE extends InstanceType<CLASS>,
|
|
148
|
-
PROPS extends IDLParameter<INSTANCE>,
|
|
149
|
-
VALUE extends {
|
|
150
|
-
[KEY in keyof PROPS]:
|
|
151
|
-
PROPS[KEY] extends (...args2:any[]) => infer R ? R
|
|
152
|
-
: PROPS[KEY] extends ObserverPropertyType ? ParsedObserverPropertyType<PROPS[KEY]>
|
|
153
|
-
: PROPS[KEY] extends {type: 'object'} & ObserverOptions<any, infer R> ? (unknown extends R ? object : R)
|
|
154
|
-
: PROPS[KEY] extends {type: ObserverPropertyType} ? ParsedObserverPropertyType<PROPS[KEY]['type']>
|
|
155
|
-
: PROPS[KEY] extends ObserverOptions<any, infer R> ? (unknown extends R ? string : R)
|
|
156
|
-
: never
|
|
157
|
-
},
|
|
158
|
-
> (this: CLASS, props: PROPS)
|
|
159
|
-
: CLASS & (new (...args: ARGS) => INSTANCE & VALUE)
|
|
160
|
-
|
|
161
|
-
props: typeof ICustomElement.observe;
|
|
162
|
-
|
|
163
|
-
set<
|
|
164
|
-
CLASS extends typeof ICustomElement,
|
|
165
|
-
ARGS extends ConstructorParameters<CLASS>,
|
|
166
|
-
INSTANCE extends InstanceType<CLASS>,
|
|
167
|
-
PROPS extends object>
|
|
168
|
-
(this: CLASS, source: PROPS & ThisType<PROPS & INSTANCE>, options?: Partial<PropertyDescriptor>)
|
|
169
|
-
: CLASS & (new(...args: ARGS) => INSTANCE & PROPS)
|
|
170
|
-
|
|
171
|
-
methods: typeof ICustomElement.set;
|
|
172
|
-
|
|
173
|
-
overrides<
|
|
174
|
-
CLASS extends typeof ICustomElement,
|
|
175
|
-
ARGS extends ConstructorParameters<CLASS>,
|
|
176
|
-
INSTANCE extends InstanceType<CLASS>,
|
|
177
|
-
PROPS extends Partial<INSTANCE>>
|
|
178
|
-
(this: CLASS, source: PROPS & ThisType<PROPS & INSTANCE>, options?: Partial<PropertyDescriptor>)
|
|
179
|
-
: CLASS & (new(...args: ARGS) => INSTANCE & PROPS)
|
|
180
|
-
|
|
181
|
-
expressions<
|
|
182
|
-
CLASS extends typeof ICustomElement,
|
|
183
|
-
ARGS extends ConstructorParameters<CLASS>,
|
|
184
|
-
INSTANCE extends InstanceType<CLASS>,
|
|
185
|
-
PROPS extends {
|
|
186
|
-
[K in keyof any]: ((this: INSTANCE, data?: INSTANCE & CLASS['schema']) => string|boolean|null)
|
|
187
|
-
}
|
|
188
|
-
>(this: CLASS, expressions: PROPS & ThisType<INSTANCE & PROPS>):
|
|
189
|
-
CLASS & (new (...args: ARGS) => INSTANCE & PROPS)
|
|
190
|
-
|
|
191
|
-
defineStatic<
|
|
192
|
-
T1 extends typeof ICustomElement,
|
|
193
|
-
T2 extends IDLParameter<T1>>
|
|
194
|
-
(this: T1, props: T2):T1 & ParsedProps<T2>;
|
|
195
|
-
|
|
196
|
-
setStatic<
|
|
197
|
-
T1 extends typeof ICustomElement,
|
|
198
|
-
T2 extends {
|
|
199
|
-
[K in keyof any]: (
|
|
200
|
-
((this:T1, ...args:any[]) => any)
|
|
201
|
-
|string|number|boolean|any[]|object)}
|
|
202
|
-
>
|
|
203
|
-
(this: T1, source: T2 & ThisType<T1 & T2>):T1 & T2;
|
|
204
|
-
|
|
205
|
-
autoRegister<T extends typeof ICustomElement>
|
|
206
|
-
(this: T, elementName: string): T;
|
|
207
|
-
|
|
208
|
-
setSchema<
|
|
209
|
-
T1 extends typeof ICustomElement,
|
|
210
|
-
T2 extends {[K in keyof any]: unknown}
|
|
211
|
-
>
|
|
212
|
-
(this: T1, schema: T2): T1 & {schema: T2};
|
|
213
|
-
|
|
214
|
-
register<T extends typeof ICustomElement>
|
|
215
|
-
(this: T, elementName?: string, force?: boolean): T;
|
|
216
|
-
|
|
217
|
-
append<
|
|
218
|
-
T extends typeof ICustomElement,
|
|
219
|
-
>
|
|
220
|
-
(this: T, ...parts: ConstructorParameters<typeof Composition<InstanceType<T>>>): T;
|
|
221
|
-
|
|
222
|
-
mixin<
|
|
223
|
-
BASE extends typeof ICustomElement,
|
|
224
|
-
FN extends (...args:any[]) => any,
|
|
225
|
-
RETURN extends ReturnType<FN>,
|
|
226
|
-
SUBCLASS extends ClassOf<RETURN>,
|
|
227
|
-
ARGS extends ConstructorParameters<SUBCLASS>,
|
|
228
|
-
BASE_INSTANCE extends InstanceType<BASE>,
|
|
229
|
-
SUBCLASS_INSTANCE extends InstanceType<SUBCLASS>>
|
|
230
|
-
(this: BASE, mixin: FN): SUBCLASS & BASE
|
|
231
|
-
& (new (...args: ARGS) => SUBCLASS_INSTANCE & BASE_INSTANCE)
|
|
232
|
-
|
|
233
|
-
events<T extends typeof ICustomElement>
|
|
234
|
-
(
|
|
235
|
-
this: T,
|
|
236
|
-
listeners?: CompositionEventListenerObject<InstanceType<T>>,
|
|
237
|
-
options?: Partial<CompositionEventListener<InstanceType<T>>>,
|
|
238
|
-
): T;
|
|
239
|
-
|
|
240
|
-
childEvents<T extends typeof ICustomElement>
|
|
241
|
-
(
|
|
242
|
-
this: T,
|
|
243
|
-
listenerMap: {
|
|
244
|
-
[P in keyof any]: CompositionEventListenerObject<InstanceType<T>>
|
|
245
|
-
},
|
|
246
|
-
options?: Partial<CompositionEventListener<InstanceType<T>>>,
|
|
247
|
-
): T;
|
|
248
|
-
|
|
249
|
-
on<
|
|
250
|
-
T1 extends typeof ICustomElement,
|
|
251
|
-
T2 extends InstanceType<T1>,
|
|
252
|
-
T3 extends CompositionCallback<T2, T2 & T1['schema']>,
|
|
253
|
-
T4 extends keyof T3,
|
|
254
|
-
>
|
|
255
|
-
(this: T1, name: T3|T4, callbacks?: T3[T4] & ThisType<T2>): T1
|
|
256
|
-
|
|
257
|
-
onPropChanged<
|
|
258
|
-
T1 extends typeof ICustomElement,
|
|
259
|
-
T2 extends InstanceType<T1>
|
|
260
|
-
>
|
|
261
|
-
(
|
|
262
|
-
this: T1,
|
|
263
|
-
options: {
|
|
264
|
-
[P in keyof T2]? : (
|
|
265
|
-
// eslint-disable-next-line no-shadow
|
|
266
|
-
this: T2,
|
|
267
|
-
oldValue: T2[P],
|
|
268
|
-
newValue: T2[P],
|
|
269
|
-
changes:any,
|
|
270
|
-
element: T2
|
|
271
|
-
) => void
|
|
272
|
-
},
|
|
273
|
-
): T1;
|
|
274
|
-
|
|
275
|
-
onAttributeChanged<
|
|
276
|
-
T1 extends typeof ICustomElement,
|
|
277
|
-
T2 extends InstanceType<T1>
|
|
278
|
-
>
|
|
279
|
-
(
|
|
280
|
-
this: T1,
|
|
281
|
-
options: {
|
|
282
|
-
[x:string]: (
|
|
283
|
-
// eslint-disable-next-line no-shadow
|
|
284
|
-
this: T2,
|
|
285
|
-
oldValue: string,
|
|
286
|
-
newValue: string,
|
|
287
|
-
element: T2
|
|
288
|
-
) => void
|
|
289
|
-
},
|
|
290
|
-
): T1;
|
|
291
|
-
};
|
package/core/ICustomElement.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export class ICustomElement extends HTMLElement {}
|
package/core/identify.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const PREFIX = '_mdw-';
|
|
2
|
-
|
|
3
|
-
/** @type {Set<string>} */
|
|
4
|
-
const generatedUIDs = new Set();
|
|
5
|
-
|
|
6
|
-
/** @return {string} */
|
|
7
|
-
export function generateUID() {
|
|
8
|
-
const id = Math.random().toString(36).slice(2, 10);
|
|
9
|
-
if (generatedUIDs.has(id)) {
|
|
10
|
-
return generateUID();
|
|
11
|
-
}
|
|
12
|
-
generatedUIDs.add(id);
|
|
13
|
-
return id;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {Element} element
|
|
18
|
-
* @param {boolean} [mutate=false]
|
|
19
|
-
* @return {string}
|
|
20
|
-
*/
|
|
21
|
-
export function identifierFromElement(element, mutate) {
|
|
22
|
-
if (element.id) {
|
|
23
|
-
return element.id;
|
|
24
|
-
}
|
|
25
|
-
if (!mutate) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const id = PREFIX + generateUID();
|
|
29
|
-
element.id = id;
|
|
30
|
-
return id;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {string} identifier
|
|
35
|
-
* @param {Element} element
|
|
36
|
-
* @return {boolean}
|
|
37
|
-
*/
|
|
38
|
-
export function identifierMatchesElement(identifier, element) {
|
|
39
|
-
return element.id === identifier;
|
|
40
|
-
}
|