material 3.5.3 → 3.5.4
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/dist/components/badge/api.js +156 -156
- package/dist/components/badge/badge.js +9 -9
- package/dist/components/badge/config.js +43 -43
- package/dist/components/badge/constants.js +13 -13
- package/dist/components/badge/features.js +75 -75
- package/dist/components/bottom-app-bar/bottom-app-bar.js +98 -98
- package/dist/components/bottom-app-bar/config.js +5 -5
- package/dist/components/bottom-app-bar/constants.js +8 -8
- package/dist/components/bottom-sheet/api.js +52 -52
- package/dist/components/bottom-sheet/bottom-sheet.js +9 -9
- package/dist/components/bottom-sheet/config.js +17 -17
- package/dist/components/bottom-sheet/constants.js +24 -24
- package/dist/components/bottom-sheet/features/drag.js +91 -91
- package/dist/components/bottom-sheet/features/state.js +148 -148
- package/dist/components/bottom-sheet/features/structure.js +85 -85
- package/dist/components/button/api.js +265 -265
- package/dist/components/button/button.js +15 -15
- package/dist/components/button/config.js +39 -39
- package/dist/components/button/constants.js +21 -21
- package/dist/components/button/features/progress.js +167 -167
- package/dist/components/button/features/toggle.js +31 -31
- package/dist/components/button-group/button-group.js +389 -389
- package/dist/components/button-group/config.js +106 -106
- package/dist/components/button-group/constants.js +62 -62
- package/dist/components/card/api.js +88 -88
- package/dist/components/card/card.js +11 -11
- package/dist/components/card/config.js +131 -131
- package/dist/components/card/constants.js +39 -39
- package/dist/components/card/content.js +175 -175
- package/dist/components/carousel/api.js +49 -49
- package/dist/components/carousel/arrangement.js +51 -51
- package/dist/components/carousel/carousel.js +2 -2
- package/dist/components/carousel/config.js +31 -31
- package/dist/components/carousel/constants.js +17 -17
- package/dist/components/carousel/features/scroll.js +469 -469
- package/dist/components/carousel/features/slides.js +125 -125
- package/dist/components/carousel/keylines.js +244 -244
- package/dist/components/carousel/strategy.js +185 -185
- package/dist/components/checkbox/api.js +87 -87
- package/dist/components/checkbox/checkbox.js +55 -55
- package/dist/components/checkbox/config.js +44 -44
- package/dist/components/checkbox/constants.js +10 -10
- package/dist/components/chips/api.js +157 -157
- package/dist/components/chips/chip/chip.js +275 -275
- package/dist/components/chips/chips.js +25 -25
- package/dist/components/chips/config.js +73 -73
- package/dist/components/chips/constants.js +2 -2
- package/dist/components/chips/features/chip-items.js +15 -15
- package/dist/components/chips/features/container.js +39 -39
- package/dist/components/chips/features/controller.js +317 -317
- package/dist/components/chips/features/dom.js +52 -52
- package/dist/components/datepicker/api.js +6 -6
- package/dist/components/datepicker/config.js +3 -3
- package/dist/components/datepicker/constants.js +39 -39
- package/dist/components/datepicker/datepicker.js +675 -675
- package/dist/components/datepicker/render.js +153 -153
- package/dist/components/datepicker/types.js +6 -6
- package/dist/components/datepicker/utils.js +157 -157
- package/dist/components/dialog/api.js +109 -109
- package/dist/components/dialog/config.js +29 -29
- package/dist/components/dialog/constants.js +35 -35
- package/dist/components/dialog/dialog.js +16 -16
- package/dist/components/dialog/features.js +739 -739
- package/dist/components/divider/config.js +4 -4
- package/dist/components/divider/constants.js +10 -10
- package/dist/components/divider/divider.js +6 -6
- package/dist/components/divider/features.js +72 -72
- package/dist/components/drawer/api.js +73 -73
- package/dist/components/drawer/config.js +61 -61
- package/dist/components/drawer/constants.js +32 -32
- package/dist/components/drawer/drawer.js +38 -38
- package/dist/components/drawer/features/headline.js +34 -34
- package/dist/components/drawer/features/items.js +203 -203
- package/dist/components/drawer/features/state.js +206 -206
- package/dist/components/extended-fab/api.js +92 -92
- package/dist/components/extended-fab/config.js +65 -65
- package/dist/components/extended-fab/constants.js +30 -30
- package/dist/components/extended-fab/extended-fab.js +51 -51
- package/dist/components/fab/api.js +65 -65
- package/dist/components/fab/config.js +46 -46
- package/dist/components/fab/constants.js +25 -25
- package/dist/components/fab/fab.js +9 -9
- package/dist/components/fab-menu/config.js +9 -9
- package/dist/components/fab-menu/constants.js +15 -15
- package/dist/components/fab-menu/fab-menu.js +310 -310
- package/dist/components/fab-menu/stagger.js +18 -18
- package/dist/components/icon-button/api.js +195 -195
- package/dist/components/icon-button/config.js +79 -79
- package/dist/components/icon-button/constants.js +43 -43
- package/dist/components/icon-button/features/toggle.js +116 -116
- package/dist/components/icon-button/icon-button.js +15 -15
- package/dist/components/list/api.js +55 -55
- package/dist/components/list/config.js +56 -56
- package/dist/components/list/constants.js +25 -25
- package/dist/components/list/features/anatomy.js +41 -41
- package/dist/components/list/features/renderer.js +136 -136
- package/dist/components/list/features/selection.js +118 -118
- package/dist/components/list/list.js +9 -9
- package/dist/components/loading-indicator/api.js +117 -117
- package/dist/components/loading-indicator/config.js +13 -13
- package/dist/components/loading-indicator/constants.js +23 -23
- package/dist/components/loading-indicator/features/motion.js +33 -33
- package/dist/components/loading-indicator/features/renderer.js +121 -121
- package/dist/components/loading-indicator/loading-indicator.js +8 -8
- package/dist/components/menu/api.js +76 -76
- package/dist/components/menu/config.js +73 -73
- package/dist/components/menu/constants.js +45 -45
- package/dist/components/menu/features/controller.js +507 -507
- package/dist/components/menu/features/keyboard.js +292 -292
- package/dist/components/menu/features/layer.js +13 -13
- package/dist/components/menu/features/loader.js +61 -61
- package/dist/components/menu/features/opener.js +288 -288
- package/dist/components/menu/features/position.js +279 -279
- package/dist/components/menu/features/registry.js +7 -7
- package/dist/components/menu/features/submenu.js +386 -386
- package/dist/components/menu/features/tasks.js +45 -45
- package/dist/components/menu/menu.js +16 -16
- package/dist/components/menu/on-demand.js +138 -138
- package/dist/components/navigation-bar/navigation-bar.js +144 -144
- package/dist/components/navigation-rail/config.js +11 -11
- package/dist/components/navigation-rail/constants.js +8 -8
- package/dist/components/navigation-rail/navigation-rail.js +237 -237
- package/dist/components/progress/api.js +207 -207
- package/dist/components/progress/config.js +137 -137
- package/dist/components/progress/constants.js +88 -88
- package/dist/components/progress/features/canvas.js +291 -291
- package/dist/components/progress/features/circular.js +69 -69
- package/dist/components/progress/features/colors.js +41 -41
- package/dist/components/progress/features/linear.js +96 -96
- package/dist/components/progress/features/motion.js +87 -87
- package/dist/components/progress/features/state.js +35 -35
- package/dist/components/progress/progress.js +11 -11
- package/dist/components/radios/api.js +54 -54
- package/dist/components/radios/config.js +19 -19
- package/dist/components/radios/constants.js +10 -10
- package/dist/components/radios/radio.js +161 -161
- package/dist/components/radios/radios.js +12 -12
- package/dist/components/search/api.js +116 -116
- package/dist/components/search/config.js +66 -66
- package/dist/components/search/constants.js +75 -75
- package/dist/components/search/features/input.js +238 -238
- package/dist/components/search/features/states.js +279 -279
- package/dist/components/search/features/structure.js +212 -212
- package/dist/components/search/features/suggestions.js +234 -234
- package/dist/components/search/search.js +30 -30
- package/dist/components/select/api.js +92 -92
- package/dist/components/select/config.js +46 -46
- package/dist/components/select/constants.js +39 -39
- package/dist/components/select/features.js +485 -485
- package/dist/components/select/select.js +17 -17
- package/dist/components/side-sheet/api.js +46 -46
- package/dist/components/side-sheet/config.js +19 -19
- package/dist/components/side-sheet/constants.js +22 -22
- package/dist/components/side-sheet/features/state.js +132 -132
- package/dist/components/side-sheet/features/structure.js +89 -89
- package/dist/components/side-sheet/side-sheet.js +8 -8
- package/dist/components/slider/config.js +54 -54
- package/dist/components/slider/constants.js +54 -54
- package/dist/components/slider/features/axis.js +14 -14
- package/dist/components/slider/features/controller.js +944 -944
- package/dist/components/slider/features/dom.js +104 -104
- package/dist/components/slider/features/states.js +83 -83
- package/dist/components/slider/slider.js +16 -16
- package/dist/components/snackbar/api.js +199 -199
- package/dist/components/snackbar/config.js +24 -24
- package/dist/components/snackbar/constants.js +41 -41
- package/dist/components/snackbar/features.js +115 -115
- package/dist/components/snackbar/layer.js +72 -72
- package/dist/components/snackbar/position.js +20 -20
- package/dist/components/snackbar/queue.js +89 -89
- package/dist/components/snackbar/snackbar.js +12 -12
- package/dist/components/split-button/api.js +137 -137
- package/dist/components/split-button/config.js +11 -11
- package/dist/components/split-button/constants.js +24 -24
- package/dist/components/split-button/features/buttons.js +35 -35
- package/dist/components/split-button/features/menu.js +12 -12
- package/dist/components/split-button/split-button.js +11 -11
- package/dist/components/switch/api.js +101 -101
- package/dist/components/switch/config.js +20 -20
- package/dist/components/switch/constants.js +29 -29
- package/dist/components/switch/features.js +123 -123
- package/dist/components/switch/switch.js +13 -13
- package/dist/components/tabs/api.js +104 -104
- package/dist/components/tabs/config.js +20 -20
- package/dist/components/tabs/constants.js +40 -40
- package/dist/components/tabs/features.js +159 -159
- package/dist/components/tabs/indicator.js +151 -151
- package/dist/components/tabs/responsive.js +59 -59
- package/dist/components/tabs/tab.js +218 -218
- package/dist/components/tabs/tabs.js +27 -27
- package/dist/components/tabs/utils.js +121 -121
- package/dist/components/text-field/api.js +212 -212
- package/dist/components/text-field/config.js +30 -30
- package/dist/components/text-field/constants.js +54 -54
- package/dist/components/text-field/features/counter.js +51 -51
- package/dist/components/text-field/features/density.js +36 -36
- package/dist/components/text-field/features/error.js +55 -55
- package/dist/components/text-field/features/field.js +30 -30
- package/dist/components/text-field/features/leading-icon.js +52 -52
- package/dist/components/text-field/features/placement.js +146 -146
- package/dist/components/text-field/features/prefix-text.js +48 -48
- package/dist/components/text-field/features/required.js +48 -48
- package/dist/components/text-field/features/suffix-text.js +48 -48
- package/dist/components/text-field/features/supporting-text.js +85 -85
- package/dist/components/text-field/features/trailing-icon.js +88 -88
- package/dist/components/text-field/text-field.js +11 -11
- package/dist/components/timepicker/api.js +275 -275
- package/dist/components/timepicker/config.js +31 -31
- package/dist/components/timepicker/constants.js +52 -52
- package/dist/components/timepicker/dial.js +164 -164
- package/dist/components/timepicker/render.js +400 -400
- package/dist/components/timepicker/timepicker.js +40 -40
- package/dist/components/timepicker/types.js +8 -8
- package/dist/components/timepicker/utils.js +67 -67
- package/dist/components/toolbar/config.js +35 -35
- package/dist/components/toolbar/constants.js +17 -17
- package/dist/components/toolbar/toolbar.js +188 -188
- package/dist/components/tooltip/api.js +309 -309
- package/dist/components/tooltip/config.js +32 -32
- package/dist/components/tooltip/constants.js +38 -38
- package/dist/components/tooltip/tooltip.js +20 -20
- package/dist/components/tooltip/types.js +15 -15
- package/dist/components/top-app-bar/config.js +5 -5
- package/dist/components/top-app-bar/constants.js +25 -25
- package/dist/components/top-app-bar/top-app-bar.js +158 -158
- package/dist/core/canvas/animation.js +30 -30
- package/dist/core/canvas/drawing.js +52 -52
- package/dist/core/canvas/resize.js +47 -47
- package/dist/core/canvas/utils.js +101 -101
- package/dist/core/compose/base.js +5 -5
- package/dist/core/compose/cleanup.js +47 -47
- package/dist/core/compose/component.js +132 -132
- package/dist/core/compose/features/badge.js +56 -56
- package/dist/core/compose/features/checkable.js +37 -37
- package/dist/core/compose/features/constants.js +1 -1
- package/dist/core/compose/features/debounce.js +39 -39
- package/dist/core/compose/features/disabled.js +61 -61
- package/dist/core/compose/features/events.js +19 -19
- package/dist/core/compose/features/icon.js +66 -66
- package/dist/core/compose/features/input.js +63 -63
- package/dist/core/compose/features/lifecycle.js +71 -71
- package/dist/core/compose/features/position.js +31 -31
- package/dist/core/compose/features/ripple.js +76 -76
- package/dist/core/compose/features/size.js +5 -5
- package/dist/core/compose/features/style.js +7 -7
- package/dist/core/compose/features/text.js +49 -49
- package/dist/core/compose/features/textinput.js +164 -164
- package/dist/core/compose/features/textlabel.js +47 -47
- package/dist/core/compose/features/throttle.js +39 -39
- package/dist/core/compose/features/track.js +24 -24
- package/dist/core/compose/features/variant.js +5 -5
- package/dist/core/compose/features/withEvents.js +48 -48
- package/dist/core/compose/pipe.js +4 -4
- package/dist/core/compose/utils/type-guards.js +6 -6
- package/dist/core/config/component.js +54 -54
- package/dist/core/config/global.js +6 -6
- package/dist/core/config.js +9 -9
- package/dist/core/dom/attributes.js +38 -38
- package/dist/core/dom/classes.js +74 -74
- package/dist/core/dom/create.js +133 -133
- package/dist/core/dom/direction.js +28 -28
- package/dist/core/dom/events.js +80 -80
- package/dist/core/dom/focus.js +38 -38
- package/dist/core/dom/form-value.js +10 -10
- package/dist/core/dom/html.js +7 -7
- package/dist/core/dom/layer.js +134 -134
- package/dist/core/dom/roving.js +69 -69
- package/dist/core/dom/utils.js +38 -38
- package/dist/core/navigation/destinations.js +103 -103
- package/dist/core/navigation/ripple.js +39 -39
- package/dist/core/shapes/cubic.js +55 -55
- package/dist/core/shapes/material.js +164 -164
- package/dist/core/shapes/polygon.js +198 -198
- package/dist/core/state/emitter.js +29 -29
- package/dist/core/state/events.js +30 -30
- package/dist/core/state/store.js +55 -55
- package/dist/core/theme/tokens.js +28 -28
- package/dist/core/utils/attributes.js +8 -8
- package/dist/core/utils/background.js +29 -29
- package/dist/core/utils/color.js +21 -21
- package/dist/core/utils/mobile.js +28 -28
- package/dist/core/utils/object.js +17 -17
- package/dist/core/utils/performance.js +111 -111
- package/dist/core/utils/theme.js +49 -49
- package/dist/core/utils/url.js +0 -0
- package/dist/core/utils/warn.js +14 -14
- package/dist/elements/adapter.js +51 -51
- package/dist/elements/badge.js +23 -23
- package/dist/elements/bottom-app-bar.js +32 -32
- package/dist/elements/bottom-sheet.js +81 -81
- package/dist/elements/button-group.js +151 -151
- package/dist/elements/button.js +40 -40
- package/dist/elements/card.js +89 -89
- package/dist/elements/carousel.js +101 -101
- package/dist/elements/checkbox.js +44 -44
- package/dist/elements/chips.js +185 -185
- package/dist/elements/datepicker.js +101 -101
- package/dist/elements/define.js +571 -571
- package/dist/elements/dialog.js +134 -134
- package/dist/elements/divider.js +16 -16
- package/dist/elements/drawer.js +118 -118
- package/dist/elements/extended-fab.js +29 -29
- package/dist/elements/fab-menu.js +58 -58
- package/dist/elements/fab.js +18 -18
- package/dist/elements/form-button.js +14 -14
- package/dist/elements/icon-button.js +42 -42
- package/dist/elements/index.js +87 -87
- package/dist/elements/lifecycle.js +8 -8
- package/dist/elements/list.js +162 -162
- package/dist/elements/loading-indicator.js +19 -19
- package/dist/elements/menu.js +169 -169
- package/dist/elements/navigation-bar.js +58 -58
- package/dist/elements/navigation-rail.js +110 -110
- package/dist/elements/preupgrade/badge.css +1 -1
- package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
- package/dist/elements/preupgrade/bottom-sheet.css +1 -1
- package/dist/elements/preupgrade/button-group.css +1 -1
- package/dist/elements/preupgrade/button.css +1 -1
- package/dist/elements/preupgrade/card.css +1 -1
- package/dist/elements/preupgrade/carousel.css +1 -1
- package/dist/elements/preupgrade/checkbox.css +1 -1
- package/dist/elements/preupgrade/chips.css +1 -1
- package/dist/elements/preupgrade/datepicker.css +1 -1
- package/dist/elements/preupgrade/dialog.css +1 -1
- package/dist/elements/preupgrade/divider.css +1 -1
- package/dist/elements/preupgrade/drawer.css +1 -1
- package/dist/elements/preupgrade/extended-fab.css +1 -1
- package/dist/elements/preupgrade/fab-menu.css +1 -1
- package/dist/elements/preupgrade/fab.css +1 -1
- package/dist/elements/preupgrade/icon-button.css +1 -1
- package/dist/elements/preupgrade/list.css +1 -1
- package/dist/elements/preupgrade/loading-indicator.css +1 -1
- package/dist/elements/preupgrade/menu.css +1 -1
- package/dist/elements/preupgrade/navigation-bar.css +1 -1
- package/dist/elements/preupgrade/navigation-rail.css +1 -1
- package/dist/elements/preupgrade/progress.css +1 -1
- package/dist/elements/preupgrade/radios.css +1 -1
- package/dist/elements/preupgrade/search.css +1 -1
- package/dist/elements/preupgrade/select.css +1 -1
- package/dist/elements/preupgrade/side-sheet.css +1 -1
- package/dist/elements/preupgrade/slider.css +1 -1
- package/dist/elements/preupgrade/snackbar.css +1 -1
- package/dist/elements/preupgrade/split-button.css +1 -1
- package/dist/elements/preupgrade/switch.css +1 -1
- package/dist/elements/preupgrade/tabs.css +1 -1
- package/dist/elements/preupgrade/text-field.css +1 -1
- package/dist/elements/preupgrade/timepicker.css +1 -1
- package/dist/elements/preupgrade/toolbar.css +1 -1
- package/dist/elements/preupgrade/tooltip.css +1 -1
- package/dist/elements/preupgrade/top-app-bar.css +1 -1
- package/dist/elements/preupgrade.css +1 -1
- package/dist/elements/preupgrade.js +0 -1
- package/dist/elements/progress.js +32 -32
- package/dist/elements/radios.js +105 -105
- package/dist/elements/search.js +189 -189
- package/dist/elements/select.js +124 -124
- package/dist/elements/sheet.js +49 -49
- package/dist/elements/side-sheet.js +53 -53
- package/dist/elements/slider.js +117 -117
- package/dist/elements/snackbar.js +45 -45
- package/dist/elements/split-button.js +82 -82
- package/dist/elements/styles.js +27 -27
- package/dist/elements/switch.js +43 -43
- package/dist/elements/tabs.js +96 -96
- package/dist/elements/text-field.js +117 -117
- package/dist/elements/timepicker.js +142 -142
- package/dist/elements/toolbar.js +63 -63
- package/dist/elements/tooltip.js +111 -111
- package/dist/elements/top-app-bar.js +75 -75
- package/dist/package.json +1 -1
- package/dist/react/create.js +113 -113
- package/dist/react/shadow.js +8 -8
- package/dist/solid/create.js +122 -122
- package/dist/solid/shadow.js +6 -6
- package/dist/ssr/react.js +2 -310
- package/dist/ssr/solid.js +1 -16
- package/dist/ssr/svelte.js +1 -73
- package/dist/ssr/vue.js +1 -71
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/contrast.css +1 -1
- package/dist/styles/datepicker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-bar.css +1 -1
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +1 -1
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/themes/autumn-contrast.css +1 -1
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline-contrast.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige-contrast.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/content-contrast.css +1 -1
- package/dist/themes/content.css +1 -1
- package/dist/themes/desert-contrast.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/expressive-contrast.css +1 -1
- package/dist/themes/expressive.css +1 -1
- package/dist/themes/fidelity-contrast.css +1 -1
- package/dist/themes/fidelity.css +1 -1
- package/dist/themes/forest-contrast.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/fruit-salad-contrast.css +1 -1
- package/dist/themes/fruit-salad.css +1 -1
- package/dist/themes/highcontrast-contrast.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/monochrome-contrast.css +1 -1
- package/dist/themes/monochrome.css +1 -1
- package/dist/themes/neutral-contrast.css +1 -1
- package/dist/themes/neutral.css +1 -1
- package/dist/themes/ocean-contrast.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/rainbow-contrast.css +1 -1
- package/dist/themes/rainbow.css +1 -1
- package/dist/themes/sageivory-contrast.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring-contrast.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer-contrast.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset-contrast.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel-contrast.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/vibrant-contrast.css +1 -1
- package/dist/themes/vibrant.css +1 -1
- package/dist/vue/create.js +123 -123
- package/dist/vue/shadow.js +6 -6
- package/package.json +1 -1
package/dist/elements/tooltip.js
CHANGED
|
@@ -6,127 +6,127 @@ const explicit = new WeakMap();
|
|
|
6
6
|
let ids = 0;
|
|
7
7
|
const idrefs = (el) => (el.getAttribute("aria-describedby") ?? "").split(/\s+/).filter(Boolean);
|
|
8
8
|
const setIdrefs = (el, list) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (list.length)
|
|
10
|
+
el.setAttribute("aria-describedby", list.join(" "));
|
|
11
|
+
else
|
|
12
|
+
el.removeAttribute("aria-describedby");
|
|
13
13
|
};
|
|
14
14
|
const reaches = (tree, node) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
for (let root = node.getRootNode();; root = root.host.getRootNode()) {
|
|
16
|
+
if (root === tree)
|
|
17
|
+
return true;
|
|
18
|
+
if (!root.host)
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
21
|
};
|
|
22
22
|
const describe = (host, target, component) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
setIdrefs(target, idrefs(target).filter((id) => id !== component.element.id));
|
|
24
|
+
host.setAttribute("aria-hidden", "true");
|
|
25
|
+
host.setAttribute("aria-label", component.getText());
|
|
26
|
+
const tree = host.getRootNode();
|
|
27
|
+
if (target.getRootNode() === tree) {
|
|
28
|
+
if (!host.id)
|
|
29
|
+
host.id = `m-tooltip-${++ids}`;
|
|
30
|
+
const id = host.id;
|
|
31
|
+
if (!idrefs(target).includes(id))
|
|
32
|
+
setIdrefs(target, [...idrefs(target), id]);
|
|
33
|
+
return () => setIdrefs(target, idrefs(target).filter((ref) => ref !== id));
|
|
34
|
+
}
|
|
35
|
+
const reflecting = target;
|
|
36
|
+
if (reaches(tree, target) && "ariaDescribedByElements" in reflecting) {
|
|
37
|
+
const previous = reflecting.ariaDescribedByElements;
|
|
38
|
+
reflecting.ariaDescribedByElements = [...(previous ?? []), host];
|
|
39
|
+
return () => void (reflecting.ariaDescribedByElements = previous);
|
|
40
|
+
}
|
|
41
|
+
if (target.hasAttribute("aria-description"))
|
|
42
|
+
return () => { };
|
|
43
|
+
target.setAttribute("aria-description", component.getText());
|
|
44
|
+
return () => target.removeAttribute("aria-description");
|
|
45
45
|
};
|
|
46
46
|
const forTarget = (host) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
const id = host.getAttribute("for");
|
|
48
|
+
if (!id)
|
|
49
|
+
return null;
|
|
50
|
+
const root = host.getRootNode();
|
|
51
|
+
const found = root.getElementById?.(id) ?? host.ownerDocument.getElementById(id);
|
|
52
|
+
return found instanceof HTMLElement ? found : null;
|
|
53
53
|
};
|
|
54
54
|
const retarget = (component, force = false) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
const wiring = wirings.get(component);
|
|
56
|
+
if (!wiring)
|
|
57
|
+
return;
|
|
58
|
+
const target = explicit.get(component) ?? forTarget(wiring.host);
|
|
59
|
+
if (target === component.target && wiring.undescribe && !force)
|
|
60
|
+
return;
|
|
61
|
+
wiring.undescribe?.();
|
|
62
|
+
wiring.undescribe = null;
|
|
63
|
+
if (!target)
|
|
64
|
+
return;
|
|
65
|
+
if (target !== component.target)
|
|
66
|
+
component.setTarget(target);
|
|
67
|
+
wiring.undescribe = describe(wiring.host, target, component);
|
|
68
68
|
};
|
|
69
69
|
const tooltipSpec = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
70
|
+
name: "tooltip",
|
|
71
|
+
create: (config) => {
|
|
72
|
+
const { noShowOnHover, noShowOnFocus, ...rest } = config;
|
|
73
|
+
return createTooltip({ ...rest, showOnHover: !noShowOnHover, showOnFocus: !noShowOnFocus, layer: "top" });
|
|
74
|
+
},
|
|
75
|
+
styles: ["tooltip"],
|
|
76
|
+
hostStyles: ":host{display:contents}",
|
|
77
|
+
attributes: {
|
|
78
|
+
for: { type: "string", update: (c) => retarget(c) },
|
|
79
|
+
text: {
|
|
80
|
+
type: "string",
|
|
81
|
+
config: "text",
|
|
82
|
+
update: (c, _v, host) => {
|
|
83
|
+
c.setText(textOf(host));
|
|
84
|
+
retarget(c, true);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
position: {
|
|
88
|
+
type: "string",
|
|
89
|
+
config: "position",
|
|
90
|
+
update: (c, v) => void c.setPosition((v ?? "bottom")),
|
|
91
|
+
},
|
|
92
|
+
variant: { type: "string", config: "variant" },
|
|
93
|
+
"show-delay": { type: "number", config: "showDelay" },
|
|
94
|
+
"hide-delay": { type: "number", config: "hideDelay" },
|
|
95
|
+
"no-show-on-hover": { type: "boolean", config: "noShowOnHover" },
|
|
96
|
+
"no-show-on-focus": { type: "boolean", config: "noShowOnFocus" },
|
|
97
|
+
},
|
|
98
|
+
properties: {
|
|
99
|
+
target: {
|
|
100
|
+
get: (c) => c.target,
|
|
101
|
+
set: (c, v) => {
|
|
102
|
+
if (v instanceof HTMLElement)
|
|
103
|
+
explicit.set(c, v);
|
|
104
|
+
else
|
|
105
|
+
explicit.delete(c);
|
|
106
|
+
retarget(c);
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
methods: ["show", "hide"],
|
|
111
|
+
config: (host) => (host.hasAttribute("text") ? {} : { text: textOf(host) }),
|
|
112
|
+
setup: (host, component) => {
|
|
113
|
+
if (explicit.get(component) === forTarget(host))
|
|
114
|
+
explicit.delete(component);
|
|
115
|
+
const wiring = { host, undescribe: null };
|
|
116
|
+
wirings.set(component, wiring);
|
|
117
|
+
retarget(component);
|
|
118
|
+
return () => {
|
|
119
|
+
wiring.undescribe?.();
|
|
120
|
+
wirings.delete(component);
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
observeChildren: (host, component) => {
|
|
124
|
+
if (!host.hasAttribute("text")) {
|
|
125
|
+
component.setText(textOf(host));
|
|
126
|
+
retarget(component, true);
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
130
|
};
|
|
131
131
|
export const tooltipElement = defineElement(tooltipSpec);
|
|
132
132
|
export const defineTooltip = (options) => tooltipElement.define(options);
|
|
@@ -2,94 +2,94 @@ import createTopAppBar from "../components/top-app-bar/index.js";
|
|
|
2
2
|
import { TOP_APP_BAR_DEFAULTS } from "../components/top-app-bar/constants.js";
|
|
3
3
|
import { defineElement } from "./define.js";
|
|
4
4
|
const namedSlot = (name) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const slot = document.createElement("slot");
|
|
6
|
+
slot.name = name;
|
|
7
|
+
return slot;
|
|
8
8
|
};
|
|
9
9
|
const create = (config) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const bar = createTopAppBar(config);
|
|
11
|
+
const headline = bar.getHeadlineElement();
|
|
12
|
+
const text = document.createElement("span");
|
|
13
|
+
text.textContent = headline.textContent;
|
|
14
|
+
headline.replaceChildren(document.createElement("slot"), text);
|
|
15
|
+
bar.addLeadingElement(namedSlot("leading"));
|
|
16
|
+
bar.addTrailingElement(namedSlot("trailing"));
|
|
17
|
+
return bar;
|
|
18
18
|
};
|
|
19
19
|
const headlineText = (component) => component.getHeadlineElement().querySelector("span");
|
|
20
20
|
const headlineFallback = (component) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
const slot = component.getHeadlineElement().querySelector("slot");
|
|
22
|
+
const sync = () => {
|
|
23
|
+
const text = headlineText(component);
|
|
24
|
+
if (text) {
|
|
25
|
+
text.hidden = slot
|
|
26
|
+
.assignedNodes()
|
|
27
|
+
.some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? "").trim() !== "");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
sync();
|
|
31
|
+
slot.addEventListener("slotchange", sync);
|
|
32
|
+
return () => slot.removeEventListener("slotchange", sync);
|
|
33
33
|
};
|
|
34
34
|
const readBar = (host) => ({
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
scrollable: !host.hasAttribute("no-scroll") && !host.hasAttribute("scroll-target"),
|
|
36
|
+
compressible: !host.hasAttribute("no-compress"),
|
|
37
37
|
});
|
|
38
38
|
const threshold = (host) => {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const value = Number(host.getAttribute("scroll-threshold") ?? TOP_APP_BAR_DEFAULTS.SCROLL_THRESHOLD);
|
|
40
|
+
return Number.isNaN(value) ? TOP_APP_BAR_DEFAULTS.SCROLL_THRESHOLD : value;
|
|
41
41
|
};
|
|
42
42
|
const followScrollTarget = (host, component) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
const id = host.getAttribute("scroll-target");
|
|
44
|
+
if (!id || host.hasAttribute("no-scroll"))
|
|
45
|
+
return () => undefined;
|
|
46
|
+
const update = (target) => void component.setScrollState(target.scrollTop > threshold(host));
|
|
47
|
+
const onScroll = (event) => {
|
|
48
|
+
const target = event.composedPath()[0];
|
|
49
|
+
if (target instanceof Element && target.id === id)
|
|
50
|
+
update(target);
|
|
51
|
+
};
|
|
52
|
+
const initial = host.ownerDocument.getElementById(id);
|
|
53
|
+
if (initial)
|
|
54
|
+
update(initial);
|
|
55
|
+
host.ownerDocument.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
56
|
+
return () => host.ownerDocument.removeEventListener("scroll", onScroll, { capture: true });
|
|
57
57
|
};
|
|
58
58
|
const topAppBarSpec = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
59
|
+
name: "top-app-bar",
|
|
60
|
+
slots: ["leading", "trailing"],
|
|
61
|
+
create: (config) => create(config),
|
|
62
|
+
styles: ["top-app-bar"],
|
|
63
|
+
hostStyles: ":host{display:block}",
|
|
64
|
+
attributes: {
|
|
65
|
+
type: { type: "string", config: "type", update: (c, v) => void c.setType((v ?? "small")) },
|
|
66
|
+
headline: {
|
|
67
|
+
type: "string",
|
|
68
|
+
config: "title",
|
|
69
|
+
update: (c, v) => {
|
|
70
|
+
const text = headlineText(c);
|
|
71
|
+
if (text)
|
|
72
|
+
text.textContent = v === null ? "" : String(v);
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
"no-scroll": { type: "boolean" },
|
|
76
|
+
"no-compress": { type: "boolean" },
|
|
77
|
+
"scroll-threshold": { type: "number", config: "scrollThreshold" },
|
|
78
|
+
"scroll-target": { type: "string" },
|
|
79
|
+
"aria-label": {
|
|
80
|
+
type: "string",
|
|
81
|
+
update: (c, v) => c.element.setAttribute("aria-label", v === null ? "Top app bar" : String(v)),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
methods: ["setScrollState"],
|
|
85
|
+
config: readBar,
|
|
86
|
+
setup: (host, component) => {
|
|
87
|
+
const label = host.getAttribute("aria-label");
|
|
88
|
+
if (label !== null)
|
|
89
|
+
component.element.setAttribute("aria-label", label);
|
|
90
|
+
const cleanups = [headlineFallback(component), followScrollTarget(host, component)];
|
|
91
|
+
return () => cleanups.forEach((cleanup) => cleanup());
|
|
92
|
+
},
|
|
93
93
|
};
|
|
94
94
|
export const topAppBarElement = defineElement(topAppBarSpec);
|
|
95
95
|
export const defineTopAppBar = (options) => topAppBarElement.define(options);
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "material",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
4
4
|
"description": "Material Design 3 components for the web: plain JavaScript, web components, and React, Vue, Svelte and Solid components. TypeScript, zero dependencies.",
|
|
5
5
|
"author": "floor",
|
|
6
6
|
"license": "MIT",
|
package/dist/react/create.js
CHANGED
|
@@ -6,121 +6,121 @@ import { camel, describe, describeDeclaration, getPrefix, isBrowser, pascal, ser
|
|
|
6
6
|
export { configure } from "../elements/adapter.js";
|
|
7
7
|
const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
8
8
|
const assignRef = (ref, value) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (typeof ref === "function")
|
|
10
|
+
ref(value);
|
|
11
|
+
else if (ref)
|
|
12
|
+
ref.current = value;
|
|
13
13
|
};
|
|
14
14
|
export const createComponent = (spec, define, displayName) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
15
|
+
const described = describe(spec);
|
|
16
|
+
const properties = new Set(described.properties);
|
|
17
|
+
const attributes = described.attributes;
|
|
18
|
+
const events = new Map(described.events.map((event) => [`on${pascal(event)}`, event]));
|
|
19
|
+
const slots = new Map(described.slots.map((slot) => [camel(slot), slot]));
|
|
20
|
+
const Component = React.forwardRef((props, forwardedRef) => {
|
|
21
|
+
const element = React.useRef(null);
|
|
22
|
+
const host = {};
|
|
23
|
+
const live = {};
|
|
24
|
+
const handlers = {};
|
|
25
|
+
const named = [];
|
|
26
|
+
for (const [key, value] of Object.entries(props)) {
|
|
27
|
+
const event = events.get(key);
|
|
28
|
+
const attribute = attributes.get(key);
|
|
29
|
+
const slot = slots.get(key);
|
|
30
|
+
if (slot !== undefined && !(attribute && typeof value === "string")) {
|
|
31
|
+
if (value != null && value !== false) {
|
|
32
|
+
named.push(React.createElement("span", { key: slot, slot, style: { display: "contents" } }, value));
|
|
33
|
+
}
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (event) {
|
|
37
|
+
if (typeof value === "function")
|
|
38
|
+
handlers[event] = value;
|
|
39
|
+
}
|
|
40
|
+
else if (properties.has(key)) {
|
|
41
|
+
live[key] = value;
|
|
42
|
+
}
|
|
43
|
+
else if (attribute?.shadowed) {
|
|
44
|
+
if (!isBrowser)
|
|
45
|
+
host[attribute.name] = toAttribute(attribute.type, value);
|
|
46
|
+
}
|
|
47
|
+
else if (attribute) {
|
|
48
|
+
host[attribute.name] = toAttribute(attribute.type, value);
|
|
49
|
+
}
|
|
50
|
+
else if (key === "className") {
|
|
51
|
+
host.class = value;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
host[key] = value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!isBrowser) {
|
|
58
|
+
for (const [name, value] of serverDefaults(described, (property) => live[property]))
|
|
59
|
+
host[name] ?? (host[name] = value);
|
|
60
|
+
}
|
|
61
|
+
const latest = React.useRef({ handlers, live });
|
|
62
|
+
useIsomorphicLayoutEffect(() => {
|
|
63
|
+
latest.current = { handlers, live };
|
|
64
|
+
});
|
|
65
|
+
useIsomorphicLayoutEffect(() => {
|
|
66
|
+
if (element.current)
|
|
67
|
+
writeDefaults(element.current, described, (key) => props[key]);
|
|
68
|
+
});
|
|
69
|
+
useIsomorphicLayoutEffect(() => {
|
|
70
|
+
define({ prefix: getPrefix() });
|
|
71
|
+
}, []);
|
|
72
|
+
useIsomorphicLayoutEffect(() => {
|
|
73
|
+
if (element.current)
|
|
74
|
+
writeLive(element.current, described, (property) => live[property]);
|
|
75
|
+
});
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
const el = element.current;
|
|
78
|
+
if (!el)
|
|
79
|
+
return;
|
|
80
|
+
const listeners = [...new Set(events.values())].map((event) => {
|
|
81
|
+
const listener = (e) => {
|
|
82
|
+
latest.current.handlers[event]?.(e);
|
|
83
|
+
queueMicrotask(() => {
|
|
84
|
+
if (element.current)
|
|
85
|
+
writeLive(element.current, described, (property) => latest.current.live[property]);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
el.addEventListener(event, listener);
|
|
89
|
+
return () => el.removeEventListener(event, listener);
|
|
90
|
+
});
|
|
91
|
+
return () => listeners.forEach((remove) => remove());
|
|
92
|
+
}, []);
|
|
93
|
+
const ref = React.useCallback((node) => {
|
|
94
|
+
element.current = node;
|
|
95
|
+
assignRef(forwardedRef, node);
|
|
96
|
+
}, [forwardedRef]);
|
|
97
|
+
const { children, ...attributesAndProps } = host;
|
|
98
|
+
const tag = `${getPrefix()}-${spec.name}`;
|
|
99
|
+
const template = shadow(tag, attributesAndProps, React.createElement(React.Fragment, null, children, ...named));
|
|
100
|
+
const hostProps = { ...attributesAndProps, ref };
|
|
101
|
+
if (template != null) {
|
|
102
|
+
hostProps[RENDERED_HOST_ATTRIBUTE] = "";
|
|
103
|
+
if (spec.marker)
|
|
104
|
+
hostProps[spec.marker] = "";
|
|
105
|
+
}
|
|
106
|
+
if (isBrowser && spec.ssr !== false)
|
|
107
|
+
hostProps.suppressHydrationWarning = true;
|
|
108
|
+
return React.createElement(tag, hostProps, template, children, ...named);
|
|
109
|
+
});
|
|
110
|
+
Component.displayName = displayName;
|
|
111
|
+
return Component;
|
|
112
112
|
};
|
|
113
113
|
export const createDeclaration = (spec, displayName) => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
114
|
+
const attributes = describeDeclaration(spec);
|
|
115
|
+
const Component = React.forwardRef((props, ref) => {
|
|
116
|
+
const host = { ref };
|
|
117
|
+
for (const [key, value] of Object.entries(props)) {
|
|
118
|
+
const attribute = attributes.get(key);
|
|
119
|
+
const name = attribute ? attribute.name : key === "className" ? "class" : key;
|
|
120
|
+
host[name] = attribute ? toAttribute(attribute.type, value) : value;
|
|
121
|
+
}
|
|
122
|
+
return React.createElement(`${getPrefix()}-${spec.name}`, host);
|
|
123
|
+
});
|
|
124
|
+
Component.displayName = displayName;
|
|
125
|
+
return Component;
|
|
126
126
|
};
|