@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,252 @@
|
|
|
1
|
+
/** @template T */
|
|
2
|
+
export default class Composition<T> {
|
|
3
|
+
static EVENT_PREFIX_REGEX: RegExp;
|
|
4
|
+
static shadowRootTag: symbol;
|
|
5
|
+
/**
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {ConstructorParameters<typeof Composition<T>>} parts
|
|
8
|
+
* @return {Composition<T>}
|
|
9
|
+
*/
|
|
10
|
+
static compose<T_1>(...parts: ConstructorParameters<typeof Composition<T_1>>): Composition<T_1>;
|
|
11
|
+
/**
|
|
12
|
+
* @param {(CompositionPart<T>)[]} parts
|
|
13
|
+
*/
|
|
14
|
+
constructor(...parts: (CompositionPart<T>)[]);
|
|
15
|
+
_interpolationState: {
|
|
16
|
+
nodeIndex: number;
|
|
17
|
+
searchIndex: number;
|
|
18
|
+
cacheIndex: number;
|
|
19
|
+
commentIndex: number;
|
|
20
|
+
/** @type {this['nodesToBind'][0]} */
|
|
21
|
+
nodeEntry: this["nodesToBind"][0];
|
|
22
|
+
};
|
|
23
|
+
/** @type {{tag:string, textNodes: number[]}[]} */
|
|
24
|
+
nodesToBind: {
|
|
25
|
+
tag: string;
|
|
26
|
+
textNodes: number[];
|
|
27
|
+
}[];
|
|
28
|
+
/** @type {string[]} */
|
|
29
|
+
props: string[];
|
|
30
|
+
/** @type {RenderGraphSearch[]} */
|
|
31
|
+
searches: RenderGraphSearch[];
|
|
32
|
+
/** @type {any[]} */
|
|
33
|
+
initCache: any[];
|
|
34
|
+
/**
|
|
35
|
+
* Index of searches by query (dotted notation for deep props)
|
|
36
|
+
* @type {Map<Function|string, RenderGraphSearch>}
|
|
37
|
+
*/
|
|
38
|
+
searchByQuery: Map<Function | string, RenderGraphSearch>;
|
|
39
|
+
/**
|
|
40
|
+
* Index of searches by query (dotted notation for deep props)
|
|
41
|
+
* @type {Map<string, RenderGraphAction[]>}
|
|
42
|
+
*/
|
|
43
|
+
actionsByPropsUsed: Map<string, RenderGraphAction[]>;
|
|
44
|
+
/** @type {RenderGraphAction[]} */
|
|
45
|
+
postInitActions: RenderGraphAction[];
|
|
46
|
+
/** @type {Set<string>} */
|
|
47
|
+
tagsWithBindings: Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Array of element tags
|
|
50
|
+
* @type {string[]}
|
|
51
|
+
*/
|
|
52
|
+
tags: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Data of arrays used in templates
|
|
55
|
+
* Usage of a [mdw-for] will create an ArrayLike expectation based on key
|
|
56
|
+
* Only store metadata, not actual data. Currently only needs length.
|
|
57
|
+
* TBD if more is needed later
|
|
58
|
+
* Referenced by property key (string)
|
|
59
|
+
* @type {CompositionAdapter}
|
|
60
|
+
*/
|
|
61
|
+
adapter: CompositionAdapter;
|
|
62
|
+
/**
|
|
63
|
+
* Collection of events to bind.
|
|
64
|
+
* Indexed by ID
|
|
65
|
+
* @type {Map<string|symbol, CompositionEventListener<any>[]>}
|
|
66
|
+
*/
|
|
67
|
+
events: Map<string | symbol, CompositionEventListener<any>[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Snapshot of composition at initial state.
|
|
70
|
+
* This fragment can be cloned for first rendering, instead of calling
|
|
71
|
+
* of using `render()` to construct the initial DOM tree.
|
|
72
|
+
* @type {DocumentFragment}
|
|
73
|
+
*/
|
|
74
|
+
cloneable: DocumentFragment;
|
|
75
|
+
/** @type {(HTMLStyleElement|CSSStyleSheet)[]} */
|
|
76
|
+
styles: (HTMLStyleElement | CSSStyleSheet)[];
|
|
77
|
+
/** @type {CSSStyleSheet[]} */
|
|
78
|
+
adoptedStyleSheets: CSSStyleSheet[];
|
|
79
|
+
/** @type {DocumentFragment} */
|
|
80
|
+
stylesFragment: DocumentFragment;
|
|
81
|
+
/**
|
|
82
|
+
* List of IDs used by template elements
|
|
83
|
+
* May be needed to be removed when adding to non-DocumentFragment
|
|
84
|
+
* @type {string[]}
|
|
85
|
+
*/
|
|
86
|
+
allIds: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Collection of IDs used for referencing elements
|
|
89
|
+
* Not meant for live DOM. Removed before attaching to document
|
|
90
|
+
*/
|
|
91
|
+
/** @type {Set<string>} */
|
|
92
|
+
temporaryIds: Set<string>;
|
|
93
|
+
/** Flag set when template and styles have been interpolated */
|
|
94
|
+
interpolated: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Template used to build interpolation and cloneable
|
|
97
|
+
*/
|
|
98
|
+
template: DocumentFragment;
|
|
99
|
+
/**
|
|
100
|
+
* @param {CompositionPart<T>[]} parts
|
|
101
|
+
*/
|
|
102
|
+
append(...parts: CompositionPart<T>[]): this;
|
|
103
|
+
/** @param {CompositionEventListener<T>} listener */
|
|
104
|
+
addCompositionEventListener(listener: CompositionEventListener<T>): this;
|
|
105
|
+
/**
|
|
106
|
+
* TODO: Add types and clean up closure leak
|
|
107
|
+
* Updates component nodes based on data.
|
|
108
|
+
* Expects data in JSON Merge Patch format
|
|
109
|
+
* @see https://www.rfc-editor.org/rfc/rfc7386
|
|
110
|
+
* @template {Object} T
|
|
111
|
+
* @param {Partial<T>} changes what specifically
|
|
112
|
+
* @param {T} [data]
|
|
113
|
+
* @param {RenderOptions<T>} [options]
|
|
114
|
+
* @return {Function & {target:Element}} anchor
|
|
115
|
+
*/
|
|
116
|
+
render<T_1 extends Object>(changes: Partial<T_1>, data?: T_1, options?: RenderOptions<T_1>): Function & {
|
|
117
|
+
target: Element;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @param {InterpolateOptions} [options]
|
|
121
|
+
*/
|
|
122
|
+
interpolate(options?: InterpolateOptions): void;
|
|
123
|
+
interpolateOptions: InterpolateOptions;
|
|
124
|
+
/**
|
|
125
|
+
* @param {RenderGraphSearch} search
|
|
126
|
+
* @return {RenderGraphSearch}
|
|
127
|
+
*/
|
|
128
|
+
addSearch(search: RenderGraphSearch): RenderGraphSearch;
|
|
129
|
+
/**
|
|
130
|
+
* @param {RenderGraphAction} action
|
|
131
|
+
* @return {RenderGraphAction}
|
|
132
|
+
*/
|
|
133
|
+
addAction(action: RenderGraphAction): RenderGraphAction;
|
|
134
|
+
[Symbol.iterator](): Generator<CSSStyleSheet | DocumentFragment | HTMLStyleElement, void, unknown>;
|
|
135
|
+
#private;
|
|
136
|
+
}
|
|
137
|
+
export type CompositionPart<T> = Composition<unknown> | HTMLStyleElement | CSSStyleSheet | DocumentFragment | string;
|
|
138
|
+
export type Compositor<T extends unknown> = (...parts: (CompositionPart<T>)[]) => Composition<T>;
|
|
139
|
+
export type RenderOptions<T> = {
|
|
140
|
+
/**
|
|
141
|
+
* what
|
|
142
|
+
*/
|
|
143
|
+
defaults?: T;
|
|
144
|
+
/**
|
|
145
|
+
* what
|
|
146
|
+
*/
|
|
147
|
+
store?: T;
|
|
148
|
+
/**
|
|
149
|
+
* where
|
|
150
|
+
*/
|
|
151
|
+
target?: DocumentFragment | HTMLElement | Element;
|
|
152
|
+
/**
|
|
153
|
+
* where
|
|
154
|
+
*/
|
|
155
|
+
shadowRoot?: ShadowRoot;
|
|
156
|
+
/**
|
|
157
|
+
* `this` on callbacks/events
|
|
158
|
+
*/
|
|
159
|
+
context?: any;
|
|
160
|
+
injections?: any;
|
|
161
|
+
};
|
|
162
|
+
export type HTMLElementEventMapFixed = HTMLElementEventMap & {
|
|
163
|
+
input: InputEvent;
|
|
164
|
+
};
|
|
165
|
+
export type HTMLElementCancellableEventMap = (Pick<HTMLElementEventMapFixed, "auxclick" | "beforeinput" | "click" | "compositionstart" | "contextmenu" | "drag" | "dragenter" | "dragover" | "dragstart" | "drop" | "invalid" | "keydown" | "keypress" | "keyup" | "mousedown" | "mousemove" | "mouseout" | "mouseover" | "mouseup" | "pointerdown" | "pointermove" | "pointerout" | "pointerover" | "pointerup" | "reset" | "selectstart" | "submit" | "touchend" | "touchmove" | "touchstart" | "wheel">);
|
|
166
|
+
export type CompositionEventMap = (HTMLElementEventMapFixed & { [P in keyof HTMLElementCancellableEventMap as `~${P}`]: HTMLElementCancellableEventMap[P]; } & Record<string, Event | CustomEvent>);
|
|
167
|
+
export type CompositionEventListener<T extends unknown, K extends keyof CompositionEventMap = string> = {
|
|
168
|
+
type?: K;
|
|
169
|
+
tag?: string;
|
|
170
|
+
capture?: boolean;
|
|
171
|
+
once?: boolean;
|
|
172
|
+
passive?: boolean;
|
|
173
|
+
signal?: AbortSignal;
|
|
174
|
+
handleEvent?: (this: T, event: (K extends keyof CompositionEventMap ? CompositionEventMap[K] : Event) & {
|
|
175
|
+
currentTarget: HTMLElement;
|
|
176
|
+
}) => any;
|
|
177
|
+
prop?: string;
|
|
178
|
+
deepProp?: string[];
|
|
179
|
+
};
|
|
180
|
+
export type CompositionEventListenerObject<T> = { [P in keyof CompositionEventMap]?: (keyof T & string) | ((this: T, event: CompositionEventMap[P] & {
|
|
181
|
+
currentTarget: HTMLElement;
|
|
182
|
+
}) => any) | CompositionEventListener<T, P>; };
|
|
183
|
+
export type NodeBindEntry<T extends unknown> = {
|
|
184
|
+
key?: string;
|
|
185
|
+
index?: number;
|
|
186
|
+
tag: string;
|
|
187
|
+
/**
|
|
188
|
+
* Index of childNode or attrName
|
|
189
|
+
*/
|
|
190
|
+
subnode: string | number;
|
|
191
|
+
props: string[];
|
|
192
|
+
deepProps: string[][];
|
|
193
|
+
negate?: boolean;
|
|
194
|
+
doubleNegate?: boolean;
|
|
195
|
+
expression?: Function;
|
|
196
|
+
/**
|
|
197
|
+
* custom render function
|
|
198
|
+
*/
|
|
199
|
+
render?: (options: RenderOptions<unknown>, element: Element, changes: any, data: any) => any;
|
|
200
|
+
listeners?: CompositionEventListener<T>[];
|
|
201
|
+
composition?: Composition<any>;
|
|
202
|
+
defaultValue: T;
|
|
203
|
+
};
|
|
204
|
+
export type RenderState = any[];
|
|
205
|
+
export type RenderGraphSearch = {
|
|
206
|
+
invocation: (state: InitializationState, changes: any, data: any) => any;
|
|
207
|
+
cacheIndex: number;
|
|
208
|
+
searchIndex: number;
|
|
209
|
+
query: string | Function | string[];
|
|
210
|
+
expression?: Function;
|
|
211
|
+
prop: string;
|
|
212
|
+
deepProp: string[];
|
|
213
|
+
propsUsed: string[];
|
|
214
|
+
deepPropsUsed: string[][];
|
|
215
|
+
defaultValue: any;
|
|
216
|
+
subSearch?: RenderGraphSearch;
|
|
217
|
+
};
|
|
218
|
+
export type RenderGraphAction = {
|
|
219
|
+
invocation: (state: InitializationState, value: any, changes: any, data: any) => any;
|
|
220
|
+
commentIndex?: number;
|
|
221
|
+
nodeIndex?: number;
|
|
222
|
+
cacheIndex?: number;
|
|
223
|
+
attrName?: string;
|
|
224
|
+
defaultValue?: any;
|
|
225
|
+
search: RenderGraphSearch;
|
|
226
|
+
};
|
|
227
|
+
export type InterpolateOptions = {
|
|
228
|
+
/**
|
|
229
|
+
* Default values to use for interpolation
|
|
230
|
+
*/
|
|
231
|
+
defaults?: Record<string, any>;
|
|
232
|
+
/**
|
|
233
|
+
* Context-specific injected properties. (Experimental)
|
|
234
|
+
*/
|
|
235
|
+
injections?: {
|
|
236
|
+
iterable: string;
|
|
237
|
+
} & Record<string, any>;
|
|
238
|
+
};
|
|
239
|
+
export type InitializationState = {
|
|
240
|
+
lastElement: Element;
|
|
241
|
+
lastChildNode: ChildNode;
|
|
242
|
+
nodes: (Element | Text)[];
|
|
243
|
+
caches: any[];
|
|
244
|
+
comments: Comment[];
|
|
245
|
+
nodeStates: Uint8Array;
|
|
246
|
+
searchStates: Uint8Array;
|
|
247
|
+
refs: Element[];
|
|
248
|
+
lastChildNodeIndex: number;
|
|
249
|
+
options: RenderOptions<unknown>;
|
|
250
|
+
};
|
|
251
|
+
import CompositionAdapter from './CompositionAdapter.js';
|
|
252
|
+
//# sourceMappingURL=Composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Composition.d.ts","sourceRoot":"","sources":["../../core/Composition.js"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} DomAdapterCreateOptions
|
|
3
|
+
* @prop {Comment} anchorNode
|
|
4
|
+
* @prop {(...args:any[]) => HTMLElement} [create]
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} ItemMetadata
|
|
8
|
+
* @prop {Element} element
|
|
9
|
+
* @prop {any} key
|
|
10
|
+
* @prop {Element|Comment} domNode
|
|
11
|
+
* @prop {Function} render
|
|
12
|
+
* @prop {boolean} [hidden]
|
|
13
|
+
* @prop {Comment} [comment]
|
|
14
|
+
*/
|
|
15
|
+
export default class CompositionAdapter {
|
|
16
|
+
/** @param {DomAdapterCreateOptions} options */
|
|
17
|
+
constructor(options: DomAdapterCreateOptions);
|
|
18
|
+
anchorNode: Comment;
|
|
19
|
+
/** @type {ItemMetadata[]} */
|
|
20
|
+
metadata: ItemMetadata[];
|
|
21
|
+
/**
|
|
22
|
+
* Ordered-list of metadata keys
|
|
23
|
+
* Chrome and FireFox optimize arrays for indexOf/includes
|
|
24
|
+
* Safari is faster with WeakMap.get(), but can't use Primitive keys
|
|
25
|
+
* TODO: Add Safari path
|
|
26
|
+
* @type {any[]}
|
|
27
|
+
*/
|
|
28
|
+
keys: any[];
|
|
29
|
+
/**
|
|
30
|
+
* Chrome needs a hint to know we will need a fast path for array by keys.
|
|
31
|
+
*/
|
|
32
|
+
needsArrayKeyFastPath: boolean;
|
|
33
|
+
composition: any;
|
|
34
|
+
renderOptions: any;
|
|
35
|
+
pendingRemoves: any[];
|
|
36
|
+
/** @type {Map<any, ItemMetadata>} */
|
|
37
|
+
metadataCache: Map<any, ItemMetadata>;
|
|
38
|
+
/** @type {Element[]} */
|
|
39
|
+
queuedElements: Element[];
|
|
40
|
+
/** @type {number|null} */
|
|
41
|
+
batchStartIndex: number | null;
|
|
42
|
+
/** @type {number|null} */
|
|
43
|
+
batchEndIndex: number | null;
|
|
44
|
+
render(changes: any, data: any): any;
|
|
45
|
+
startBatch(): void;
|
|
46
|
+
writeBatch(): void;
|
|
47
|
+
stopBatch(): void;
|
|
48
|
+
/** @param {number} index */
|
|
49
|
+
removeByIndex(index: number): void;
|
|
50
|
+
/**
|
|
51
|
+
* Worst case scenario
|
|
52
|
+
* @param {number} newIndex expectedIndex
|
|
53
|
+
* @param {*} changes
|
|
54
|
+
* @param {*} data
|
|
55
|
+
* @param {*} key
|
|
56
|
+
* @param {*} change
|
|
57
|
+
* @param {boolean} [skipOnMatch]
|
|
58
|
+
* JSON Merge has no way to express sort change and data change. Best
|
|
59
|
+
* performance is done via invoking render on sort change and another on
|
|
60
|
+
* inner change. Can't skip if mixing change types.
|
|
61
|
+
*/
|
|
62
|
+
renderData(newIndex: number, changes: any, data: any, key: any, change: any, skipOnMatch?: boolean): void;
|
|
63
|
+
needsArrayFastPath: boolean;
|
|
64
|
+
removeEntries(startIndex?: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* @param {number} [index]
|
|
67
|
+
* @param {ItemMetadata} [metadata]
|
|
68
|
+
* @param {any} [key]
|
|
69
|
+
* @return {boolean} changed
|
|
70
|
+
*/
|
|
71
|
+
hide(index?: number, metadata?: ItemMetadata, key?: any): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @param {number} [index]
|
|
74
|
+
* @param {ItemMetadata} [metadata]
|
|
75
|
+
* @param {any} [key]
|
|
76
|
+
* @return {boolean} changed
|
|
77
|
+
*/
|
|
78
|
+
show(index?: number, metadata?: ItemMetadata, key?: any): boolean;
|
|
79
|
+
}
|
|
80
|
+
export type DomAdapterCreateOptions = {
|
|
81
|
+
anchorNode: Comment;
|
|
82
|
+
create?: (...args: any[]) => HTMLElement;
|
|
83
|
+
};
|
|
84
|
+
export type ItemMetadata = {
|
|
85
|
+
element: Element;
|
|
86
|
+
key: any;
|
|
87
|
+
domNode: Element | Comment;
|
|
88
|
+
render: Function;
|
|
89
|
+
hidden?: boolean;
|
|
90
|
+
comment?: Comment;
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=CompositionAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompositionAdapter.d.ts","sourceRoot":"","sources":["../../core/CompositionAdapter.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACE,+CAA+C;IAC/C,qBADY,uBAAuB,EAoClC;IAlCC,oBAAoC;IAEpC,6BAA6B;IAC7B,UADW,YAAY,EAAE,CACP;IAClB;;;;;;OAMG;IACH,MAFU,GAAG,EAAE,CAED;IAEd;;OAEG;IACH,+BAAkC;IAElC,iBAAsC;IACtC,mBAA0C;IAE1C,sBAAwB;IAGxB,qCAAqC;IACrC,eADW,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CACR;IAEzB,wBAAwB;IACxB,gBADW,OAAO,EAAE,CACI;IAExB,0BAA0B;IAC1B,iBADW,MAAM,GAAC,IAAI,CACK;IAC3B,0BAA0B;IAC1B,eADW,MAAM,GAAC,IAAI,CACG;IAG3B,qCAEC;IAED,mBAGC;IAED,mBAMC;IAED,kBAYC;IAED,4BAA4B;IAC5B,qBADY,MAAM,QAajB;IAED;;;;;;;;;;;OAWG;IACH,qBAVW,MAAM,WACN,GAAC,QACD,GAAC,OACD,GAAC,UACD,GAAC,gBACD,OAAO,QAuIjB;IAhGK,4BAA+B;IAkGrC,yCAOC;IAED;;;;;OAKG;IACH,aALW,MAAM,aACN,YAAY,QACZ,GAAG,GACF,OAAO,CAyBlB;IAED;;;;;OAKG;IACH,aALW,MAAM,aACN,YAAY,QACZ,GAAG,GACF,OAAO,CAqBlB;CACF;;gBArTS,OAAO;aACP,CAAC,GAAG,IAAI,EAAC,GAAG,EAAE,KAAK,WAAW;;;aAK9B,OAAO;SACP,GAAG;aACH,OAAO,GAAC,OAAO;;aAEf,OAAO;cACP,OAAO"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clone attribute
|
|
3
|
+
* @param {string} name
|
|
4
|
+
* @param {string} target
|
|
5
|
+
* @return {(oldValue:string, newValue:string, element: CustomElement) => void}
|
|
6
|
+
*/
|
|
7
|
+
export function cloneAttributeCallback(name: string, target: string): (oldValue: string, newValue: string, element: CustomElement) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Web Component that can cache templates for minification or performance
|
|
10
|
+
*/
|
|
11
|
+
export default class CustomElement extends HTMLElement {
|
|
12
|
+
/** @type {string} */
|
|
13
|
+
static elementName: string;
|
|
14
|
+
/** @return {Iterable<string>} */
|
|
15
|
+
static get observedAttributes(): Iterable<string>;
|
|
16
|
+
/** @type {Composition<?>} */
|
|
17
|
+
static _composition: Composition<unknown>;
|
|
18
|
+
/** @type {Map<string, import('./observe.js').ObserverConfiguration<?,?,?>>} */
|
|
19
|
+
static _props: Map<string, import("./observe.js").ObserverConfiguration<unknown, unknown, unknown>>;
|
|
20
|
+
/** @type {Map<string, import('./observe.js').ObserverConfiguration<?,?,?>>} */
|
|
21
|
+
static _attrs: Map<string, import("./observe.js").ObserverConfiguration<unknown, unknown, unknown>>;
|
|
22
|
+
/** @type {Map<string, Function[]>} */
|
|
23
|
+
static _propChangedCallbacks: Map<string, Function[]>;
|
|
24
|
+
/** @type {Map<string, Function[]>} */
|
|
25
|
+
static _attributeChangedCallbacks: Map<string, Function[]>;
|
|
26
|
+
/** @type {((callback: CallbackArguments) => any)[]} */
|
|
27
|
+
static _onComposeCallbacks: ((callback: CallbackArguments) => any)[];
|
|
28
|
+
/** @type {((callback: CallbackArguments) => any)[]} */
|
|
29
|
+
static _onConnectedCallbacks: ((callback: CallbackArguments) => any)[];
|
|
30
|
+
/** @type {((callback: CallbackArguments) => any)[]} */
|
|
31
|
+
static _onDisconnectedCallbacks: ((callback: CallbackArguments) => any)[];
|
|
32
|
+
/** @type {((callback: CallbackArguments) => any)[]} */
|
|
33
|
+
static _onConstructedCallbacks: ((callback: CallbackArguments) => any)[];
|
|
34
|
+
static interpolatesTemplate: boolean;
|
|
35
|
+
static supportsElementInternals: boolean;
|
|
36
|
+
static supportsElementInternalsRole: boolean;
|
|
37
|
+
/** @type {boolean} */
|
|
38
|
+
static templatable: boolean;
|
|
39
|
+
static defined: boolean;
|
|
40
|
+
static autoRegistration: boolean;
|
|
41
|
+
/** @type {Map<string, typeof CustomElement>} */
|
|
42
|
+
static registrations: Map<string, typeof CustomElement>;
|
|
43
|
+
/**
|
|
44
|
+
* Expressions are idempotent functions that are selectively called whenever
|
|
45
|
+
* a render is requested.
|
|
46
|
+
* Expressions are constructed exactly as methods though differ in expected
|
|
47
|
+
* arguments. The first argument should be destructured to ensure each used
|
|
48
|
+
* property is accessed at least once in order to inspect used properties.
|
|
49
|
+
*
|
|
50
|
+
* The Composition API will inspect this function with a proxy for `this` to
|
|
51
|
+
* catalog what observables are used by the expression. This allows the
|
|
52
|
+
* Composition API to build a cache as well as selective invoke the expression
|
|
53
|
+
* only when needed.
|
|
54
|
+
*
|
|
55
|
+
* When used with in element templates, the element itself will be passed as
|
|
56
|
+
* its first argument.
|
|
57
|
+
* ````js
|
|
58
|
+
* Button
|
|
59
|
+
* .prop('filled', 'boolean')
|
|
60
|
+
* .prop('outlined', 'boolean')
|
|
61
|
+
* .expresssions({
|
|
62
|
+
* _isFilledOrOutlined({filled, outlined}) {
|
|
63
|
+
* return (filled || outlined)
|
|
64
|
+
* },
|
|
65
|
+
* })
|
|
66
|
+
* .html`<div custom={_isFilledOrOutlined}></div>`;
|
|
67
|
+
* ````
|
|
68
|
+
*
|
|
69
|
+
* When used with external data source, that data source
|
|
70
|
+
* will be passed to the expression with all properties being `null` at first
|
|
71
|
+
* inspection.
|
|
72
|
+
* ````js
|
|
73
|
+
* const externalData = {first: 'John', last: 'Doe'};
|
|
74
|
+
* ContactCard
|
|
75
|
+
* .expresssions({
|
|
76
|
+
* _fullName({first, last}) {
|
|
77
|
+
* return [first, last].filter(Boolean).join(' ');
|
|
78
|
+
* },
|
|
79
|
+
* })
|
|
80
|
+
* myButton.render(externalData);
|
|
81
|
+
* ````
|
|
82
|
+
*
|
|
83
|
+
* Expressions may be support argumentless calls by using default
|
|
84
|
+
* parameters with `this`.
|
|
85
|
+
* ````js
|
|
86
|
+
* Button
|
|
87
|
+
* .expresssions({
|
|
88
|
+
* isFilledOrOutlined({filled, outlined} = this) {
|
|
89
|
+
* return (filled || outlined)
|
|
90
|
+
* },
|
|
91
|
+
* });
|
|
92
|
+
* myButton.isFilledorOutlined();
|
|
93
|
+
* ````
|
|
94
|
+
* @type {{
|
|
95
|
+
* <
|
|
96
|
+
* CLASS extends typeof CustomElement,
|
|
97
|
+
* ARGS extends ConstructorParameters<CLASS>,
|
|
98
|
+
* INSTANCE extends InstanceType<CLASS>,
|
|
99
|
+
* PROPS extends {
|
|
100
|
+
* [K in keyof any]: K extends `_${any}` ? ((data: INSTANCE, state?: Record<string, any>) => string|boolean|null)
|
|
101
|
+
* : ((data?: INSTANCE, state?: Record<string, any>) => string|boolean|null)
|
|
102
|
+
* } & ThisType<INSTANCE>
|
|
103
|
+
* >(this: CLASS, expressions: PROPS & ThisType<INSTANCE & PROPS>):
|
|
104
|
+
* CLASS & Class<{
|
|
105
|
+
* [K in keyof PROPS]: K extends `_${any}` ? never : () => ReturnType<PROPS[K]> }
|
|
106
|
+
* ,ARGS>
|
|
107
|
+
* }}
|
|
108
|
+
*/
|
|
109
|
+
static expressions: {
|
|
110
|
+
<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, PROPS extends { [K in keyof any]: K extends `_${any}` ? ((data: INSTANCE, state?: Record<string, any>) => string | boolean | null) : ((data?: INSTANCE, state?: Record<string, any>) => string | boolean | null); } & ThisType<INSTANCE>>(this: CLASS, expressions: PROPS & ThisType<INSTANCE & PROPS>): CLASS & Class<{ [K in keyof PROPS]: K extends `_${any}` ? never : () => ReturnType<PROPS[K]>; }, ARGS>;
|
|
111
|
+
};
|
|
112
|
+
static methods: typeof CustomElement.set;
|
|
113
|
+
/**
|
|
114
|
+
* @type {{
|
|
115
|
+
* <
|
|
116
|
+
* CLASS extends typeof CustomElement,
|
|
117
|
+
* ARGS extends ConstructorParameters<CLASS>,
|
|
118
|
+
* INSTANCE extends InstanceType<CLASS>,
|
|
119
|
+
* PROPS extends Partial<INSTANCE>>
|
|
120
|
+
* (this: CLASS, source: PROPS & ThisType<PROPS & INSTANCE>, options?: Partial<PropertyDescriptor>)
|
|
121
|
+
* : CLASS & Class<PROPS,ARGS>
|
|
122
|
+
* }}
|
|
123
|
+
*/
|
|
124
|
+
static overrides: {
|
|
125
|
+
<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, PROPS extends Partial<INSTANCE>>(this: CLASS, source: PROPS & ThisType<PROPS & INSTANCE>, options?: Partial<PropertyDescriptor>): CLASS & Class<PROPS, ARGS>;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @type {{
|
|
129
|
+
* <
|
|
130
|
+
* CLASS extends typeof CustomElement,
|
|
131
|
+
* ARGS extends ConstructorParameters<CLASS>,
|
|
132
|
+
* INSTANCE extends InstanceType<CLASS>,
|
|
133
|
+
* KEY extends string,
|
|
134
|
+
* OPTIONS extends ObserverPropertyType
|
|
135
|
+
* | ObserverOptions<ObserverPropertyType, unknown, INSTANCE>
|
|
136
|
+
* | ((this:INSTANCE, data:Partial<INSTANCE>, fn?: () => any) => any),
|
|
137
|
+
* VALUE extends Record<KEY, OPTIONS extends (...args2:any[]) => infer R ? R
|
|
138
|
+
* : OPTIONS extends ObserverPropertyType ? import('./observe.js').ParsedObserverPropertyType<OPTIONS>
|
|
139
|
+
* : OPTIONS extends {type: 'object'} & ObserverOptions<any, infer R> ? (unknown extends R ? object : R)
|
|
140
|
+
* : OPTIONS extends {type: ObserverPropertyType} ? import('./observe.js').ParsedObserverPropertyType<OPTIONS['type']>
|
|
141
|
+
* : OPTIONS extends ObserverOptions<any, infer R> ? (unknown extends R ? string : R)
|
|
142
|
+
* : never
|
|
143
|
+
* >
|
|
144
|
+
* > (this: CLASS, name: KEY, options: OPTIONS)
|
|
145
|
+
* : CLASS & Class<VALUE,ARGS>;
|
|
146
|
+
* }}
|
|
147
|
+
*/
|
|
148
|
+
static props: {
|
|
149
|
+
<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, KEY extends string, OPTIONS extends ObserverPropertyType | ObserverOptions<ObserverPropertyType, unknown, INSTANCE> | ((this: INSTANCE, data: Partial<INSTANCE>, fn?: () => any) => any), VALUE extends Record<KEY, OPTIONS extends (...args2: any[]) => infer R ? R : OPTIONS extends ObserverPropertyType ? import("./observe.js").ParsedObserverPropertyType<OPTIONS> : OPTIONS extends {
|
|
150
|
+
type: "object";
|
|
151
|
+
} & ObserverOptions<any, infer R> ? (unknown extends R ? object : R) : OPTIONS extends {
|
|
152
|
+
type: ObserverPropertyType;
|
|
153
|
+
} ? import("./observe.js").ParsedObserverPropertyType<OPTIONS["type"]> : OPTIONS extends ObserverOptions<any, infer R> ? (unknown extends R ? string : R) : never>>(this: CLASS, name: KEY, options: OPTIONS): CLASS & Class<VALUE, ARGS>;
|
|
154
|
+
};
|
|
155
|
+
static idl: typeof CustomElement.prop;
|
|
156
|
+
/**
|
|
157
|
+
* @this T
|
|
158
|
+
* @template {typeof CustomElement} T
|
|
159
|
+
* @template {keyof T} K
|
|
160
|
+
* @param {K} collection
|
|
161
|
+
* @param {T[K] extends (infer R)[] ? R : never} callback
|
|
162
|
+
*/
|
|
163
|
+
static _addCallback<T extends typeof CustomElement, K extends keyof T>(this: T, collection: K, callback: T[K] extends (infer R)[] ? R : never): void;
|
|
164
|
+
static append<T extends typeof CustomElement>(this: T, ...parts: ConstructorParameters<typeof Composition<InstanceType<T>>>): T;
|
|
165
|
+
static recompose<T1 extends typeof CustomElement, T2 extends InstanceType<T1>, T3 extends CompositionCallback<T2, T2>["composed"]>(this: T1, callback: T3): T1;
|
|
166
|
+
static css<T1 extends typeof CustomElement, T2 extends TemplateStringsArray | HTMLStyleElement | CSSStyleSheet | string>(this: T1, array: T2, ...rest: T2 extends string ? any : T2 extends TemplateStringsArray ? any[] : (HTMLStyleElement | CSSStyleSheet)[]): T1;
|
|
167
|
+
static autoRegister<T extends typeof CustomElement>(this: T, elementName: string): T;
|
|
168
|
+
static html<T extends typeof CustomElement>(this: T, string: TemplateStringsArray, ...substitutions: (string | Element | ((this: InstanceType<T>, data: InstanceType<T>, injections?: any) => any))[]): T;
|
|
169
|
+
static extend<T1 extends typeof CustomElement, T2 extends T1, T3 extends (Base: T1) => T2>(this: T1, customExtender?: T3 | null): T3 extends null ? T1 : T2;
|
|
170
|
+
static setStatic<T1 extends typeof CustomElement, T2 extends { [K in keyof any]: (((this: T1, ...args: any[]) => any) | string | number | boolean | any[] | object); }>(this: T1, source: T2 & ThisType<T1 & T2>): T1 & T2;
|
|
171
|
+
static readonly<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, PROPS extends object>(this: CLASS, source: PROPS & ThisType<PROPS & INSTANCE>, options?: Partial<PropertyDescriptor>): CLASS & Class<PROPS, ARGS>;
|
|
172
|
+
static set<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, PROPS extends object>(this: CLASS, source: PROPS & ThisType<PROPS & INSTANCE>, options?: Partial<PropertyDescriptor>): CLASS & Class<PROPS, ARGS>;
|
|
173
|
+
static mixin<BASE extends typeof CustomElement, FN extends (...args: any[]) => any, RETURN extends ReturnType<FN>, SUBCLASS extends ClassOf<RETURN>>(this: BASE, mixin: FN): SUBCLASS & BASE;
|
|
174
|
+
static register<T extends typeof CustomElement>(this: T, elementName?: string, force?: boolean): T;
|
|
175
|
+
static get propList(): Map<string, import("./observe.js").ObserverConfiguration<any, any, any, any>>;
|
|
176
|
+
static get attrList(): Map<string, import("./observe.js").ObserverConfiguration<any, any, any, any>>;
|
|
177
|
+
static get propChangedCallbacks(): Map<string, Function[]>;
|
|
178
|
+
static get attributeChangedCallbacks(): Map<string, Function[]>;
|
|
179
|
+
static prop<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, KEY extends string, OPTIONS extends ObserverPropertyType | ObserverOptions<ObserverPropertyType, unknown, INSTANCE> | ((this: INSTANCE, data: Partial<INSTANCE>, fn?: () => any) => any), VALUE extends Record<KEY, OPTIONS extends (...args2: any[]) => infer R ? R : OPTIONS extends ObserverPropertyType ? import("./observe").ParsedObserverPropertyType<OPTIONS> : OPTIONS extends {
|
|
180
|
+
type: "object";
|
|
181
|
+
} & ObserverOptions<any, infer R> ? (unknown extends R ? object : R) : OPTIONS extends {
|
|
182
|
+
type: ObserverPropertyType;
|
|
183
|
+
} ? import("./observe").ParsedObserverPropertyType<OPTIONS["type"]> : OPTIONS extends ObserverOptions<any, infer R> ? (unknown extends R ? string : R) : never>>(this: CLASS, name: KEY, options: OPTIONS): CLASS & Class<VALUE, ARGS>;
|
|
184
|
+
static define<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, PROPS extends { [P in keyof any]: {
|
|
185
|
+
enumerable?: boolean;
|
|
186
|
+
configurable?: boolean;
|
|
187
|
+
writable?: boolean;
|
|
188
|
+
value?: any;
|
|
189
|
+
get?: ((this: INSTANCE) => any);
|
|
190
|
+
set?: (this: INSTANCE, value: any) => void;
|
|
191
|
+
} | ((this: INSTANCE, ...args: any[]) => any); }, VALUE extends { [KEY in keyof PROPS]: PROPS[KEY] extends (...args2: any[]) => infer R ? R : PROPS[KEY] extends TypedPropertyDescriptor<infer R> ? R : never; }>(this: CLASS, props: PROPS & ThisType<PROPS & INSTANCE>): CLASS & Class<VALUE, ARGS>;
|
|
192
|
+
static undefine(name: any): typeof CustomElement;
|
|
193
|
+
static observe<CLASS extends typeof CustomElement, ARGS extends ConstructorParameters<CLASS>, INSTANCE extends InstanceType<CLASS>, PROPS extends IDLParameter<INSTANCE & VALUE>, VALUE extends { [KEY in keyof PROPS]: PROPS[KEY] extends (...args2: any[]) => infer R ? R : PROPS[KEY] extends ObserverPropertyType ? import("./observe").ParsedObserverPropertyType<PROPS[KEY]> : PROPS[KEY] extends {
|
|
194
|
+
type: "object";
|
|
195
|
+
} & ObserverOptions<any, infer R> ? (unknown extends R ? object : R) : PROPS[KEY] extends {
|
|
196
|
+
type: ObserverPropertyType;
|
|
197
|
+
} ? import("./observe").ParsedObserverPropertyType<PROPS[KEY]["type"]> : PROPS[KEY] extends ObserverOptions<any, infer R> ? (unknown extends R ? string : R) : never; }>(this: CLASS, props: PROPS): CLASS & Class<VALUE, ARGS>;
|
|
198
|
+
static defineStatic<T1 extends typeof CustomElement, T2 extends IDLParameter<T1>>(this: T1, props: T2): T1 & ParsedProps<T2>;
|
|
199
|
+
static events<T extends typeof CustomElement>(this: T, listeners?: import("./Composition").CompositionEventListenerObject<InstanceType<T>>, options?: Partial<import("./Composition").CompositionEventListener<InstanceType<T>>>): T;
|
|
200
|
+
static childEvents<T extends typeof CustomElement>(this: T, listenerMap: { [P in keyof any]: import("./Composition").CompositionEventListenerObject<InstanceType<T>>; }, options?: Partial<import("./Composition").CompositionEventListener<InstanceType<T>>>): T;
|
|
201
|
+
static rootEvents<T extends typeof CustomElement>(this: T, listeners?: import("./Composition").CompositionEventListenerObject<InstanceType<T>>, options?: Partial<import("./Composition").CompositionEventListener<InstanceType<T>>>): T;
|
|
202
|
+
static on<T1 extends typeof CustomElement, T2 extends InstanceType<T1>, T3 extends CompositionCallback<T2, T2>, T4 extends keyof T3>(this: T1, name: T3 | T4, callbacks?: T3[T4] & ThisType<T2>): T1;
|
|
203
|
+
static onPropChanged<T1 extends typeof CustomElement, T2 extends InstanceType<T1>>(this: T1, options: ObjectOrObjectEntries<{ [P in keyof T2]?: (this: T2, oldValue: T2[P], newValue: T2[P], changes: any, element: T2) => void; }>): T1;
|
|
204
|
+
static onAttributeChanged<T1 extends typeof CustomElement, T2 extends InstanceType<T1>>(this: T1, options: {
|
|
205
|
+
[x: string]: (this: T2, oldValue: string, newValue: string, element: T2) => void;
|
|
206
|
+
}): T1;
|
|
207
|
+
/** @param {any[]} args */
|
|
208
|
+
constructor(...args: any[]);
|
|
209
|
+
compose(parts: (import("./Composition.js").CompositionPart<any>)[]): Composition<any>;
|
|
210
|
+
/** @type {Map<string,{stringValue:string, parsedValue:any}>} */
|
|
211
|
+
_propAttributeCache: Map<string, {
|
|
212
|
+
stringValue: string;
|
|
213
|
+
parsedValue: any;
|
|
214
|
+
}>;
|
|
215
|
+
/** @type {CallbackArguments} */
|
|
216
|
+
_callbackArguments: CallbackArguments;
|
|
217
|
+
elementInternals: ElementInternals;
|
|
218
|
+
/**
|
|
219
|
+
* Updates nodes based on data
|
|
220
|
+
* Expects data in JSON Merge Patch format
|
|
221
|
+
* @see https://www.rfc-editor.org/rfc/rfc7386
|
|
222
|
+
* @param {Partial<?>} changes
|
|
223
|
+
* @param {any} data
|
|
224
|
+
* @return {void}
|
|
225
|
+
*/
|
|
226
|
+
render: Function & {
|
|
227
|
+
target: Element;
|
|
228
|
+
};
|
|
229
|
+
propChangedCallback<T extends CustomElement, K extends string = string>(this: T, name: K, oldValue: K extends keyof T ? T[K] : unknown, newValue: K extends keyof T ? T[K] : unknown, changes?: K extends keyof T ? T[K] extends object ? Partial<T[K]> : T[K] : unknown): void;
|
|
230
|
+
/**
|
|
231
|
+
* @param {string} name
|
|
232
|
+
* @param {string|null} oldValue
|
|
233
|
+
* @param {string|null} newValue
|
|
234
|
+
*/
|
|
235
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
236
|
+
/**
|
|
237
|
+
* @param {string} name
|
|
238
|
+
* @param {any} oldValue
|
|
239
|
+
* @param {any} newValue
|
|
240
|
+
* @param {any} changes
|
|
241
|
+
*/
|
|
242
|
+
_onObserverPropertyChanged(name: string, oldValue: any, newValue: any, changes: any): void;
|
|
243
|
+
patch(patch: any): void;
|
|
244
|
+
patching: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Proxy object that returns shadow DOM elements by tag.
|
|
247
|
+
* If called before interpolation (eg: on composed), returns from template
|
|
248
|
+
* @return {Record<string,HTMLElement>}
|
|
249
|
+
*/
|
|
250
|
+
get refs(): Record<string, HTMLElement>;
|
|
251
|
+
get attributeCache(): Map<any, any>;
|
|
252
|
+
get static(): typeof CustomElement;
|
|
253
|
+
get unique(): boolean;
|
|
254
|
+
get callbackArguments(): CallbackArguments<any, any> | {
|
|
255
|
+
composition: Composition<any>;
|
|
256
|
+
refs: Record<string, HTMLElement>;
|
|
257
|
+
html: any;
|
|
258
|
+
inline: typeof addInlineFunction;
|
|
259
|
+
template: DocumentFragment;
|
|
260
|
+
element: this;
|
|
261
|
+
};
|
|
262
|
+
/** @return {Composition<?>} */
|
|
263
|
+
get composition(): Composition<any>;
|
|
264
|
+
connectedCallback(): void;
|
|
265
|
+
disconnectedCallback(): void;
|
|
266
|
+
delegatesFocus: boolean;
|
|
267
|
+
#private;
|
|
268
|
+
}
|
|
269
|
+
export type ObserverPropertyType = import("./observe.js").ObserverPropertyType;
|
|
270
|
+
export type ParsedProps<T extends unknown> = { [P in keyof T]: T[P] extends (...args: any[]) => infer T2 ? T2 : T[P] extends ObserverPropertyType ? import("./observe.js").ParsedObserverPropertyType<T[P]> : T[P] extends {
|
|
271
|
+
type: ObserverPropertyType;
|
|
272
|
+
} ? import("./observe.js").ParsedObserverPropertyType<T[P]["type"]> : T[P] extends ObserverOptions<null, infer T2> ? unknown extends T2 ? string : T2 : never; };
|
|
273
|
+
export type ObserverOptions<T1 extends ObserverPropertyType, T2 extends unknown, C extends Object = any> = import("./observe.js").ObserverOptions<T1, T2, C>;
|
|
274
|
+
/**
|
|
275
|
+
* <T>
|
|
276
|
+
*/
|
|
277
|
+
export type ClassOf<T extends {
|
|
278
|
+
prototype: unknown;
|
|
279
|
+
}> = T;
|
|
280
|
+
export type Class<T extends unknown = any, A extends any[] = any[]> = abstract new (...args: A) => T;
|
|
281
|
+
export type HTMLTemplater<T1 extends unknown, T2 extends unknown = T1> = (string: TemplateStringsArray, ...substitutions: (string | DocumentFragment | Element | ((this: T1, data: T2) => any))[]) => DocumentFragment;
|
|
282
|
+
export type CallbackArguments<T1 extends unknown = any, T2 extends unknown = T1> = {
|
|
283
|
+
composition: Composition<T1>;
|
|
284
|
+
refs: Record<string, HTMLElement>;
|
|
285
|
+
html: HTMLTemplater<T1, Partial<T2>>;
|
|
286
|
+
inline: (fn: (this: T1, data: T2) => any) => string;
|
|
287
|
+
template: DocumentFragment;
|
|
288
|
+
element: T1;
|
|
289
|
+
};
|
|
290
|
+
export type CompositionCallback<T1 extends unknown, T2 extends unknown = T1> = {
|
|
291
|
+
composed?: (this: T1, options: CallbackArguments<T1, T2>) => any;
|
|
292
|
+
constructed?: (this: T1, options: CallbackArguments<T1, T2>) => any;
|
|
293
|
+
connected?: (this: T1, options: CallbackArguments<T1, T2>) => any;
|
|
294
|
+
disconnected?: (this: T1, options: CallbackArguments<T1, T2>) => any;
|
|
295
|
+
props?: { [P in keyof T1]: (this: T1, oldValue: T1[P], newValue: T1[P], changes: any, element: T1) => any; };
|
|
296
|
+
attrs?: { [K in keyof any]: (this: T1, oldValue: string, newValue: string, element: T1) => unknown; };
|
|
297
|
+
} & { [P in keyof T1 & string as `${P}Changed`]?: (this: T1, oldValue: T1[P], newValue: T1[P], changes: any, element: T1) => any; };
|
|
298
|
+
export type IDLParameter<C extends Object> = { [P in string]: ObserverPropertyType | ObserverOptions<ObserverPropertyType, unknown, C> | ((this: C, data: Partial<C>, fn?: () => any) => any); };
|
|
299
|
+
export type ObjectOrObjectEntries<T> = (T | Array<[keyof T & string, T[keyof T]]>);
|
|
300
|
+
import Composition from './Composition.js';
|
|
301
|
+
import { addInlineFunction } from './template.js';
|
|
302
|
+
//# sourceMappingURL=CustomElement.d.ts.map
|