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/react/shadow.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { getPrefix, isBrowser } from "../elements/adapter.js";
|
|
4
4
|
export const shadow = (tag, props, children) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
if (isBrowser)
|
|
6
|
+
return null;
|
|
7
|
+
const render = globalThis[Symbol.for("mtrl.ssr")]?.react;
|
|
8
|
+
const html = render?.(tag, props, children, getPrefix());
|
|
9
|
+
return html === undefined ? null : React.createElement("template", {
|
|
10
|
+
shadowrootmode: "open", shadowrootdelegatesfocus: "",
|
|
11
|
+
dangerouslySetInnerHTML: { __html: html },
|
|
12
|
+
});
|
|
13
13
|
};
|
package/dist/solid/create.js
CHANGED
|
@@ -5,130 +5,130 @@ import { RENDERED_HOST_ATTRIBUTE } from "../elements/styles.js";
|
|
|
5
5
|
import { shadow } from "./shadow.js";
|
|
6
6
|
export { configure } from "../elements/adapter.js";
|
|
7
7
|
const toHost = (type, value) => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const attribute = toAttribute(type, value);
|
|
9
|
+
return type === "boolean" && attribute !== undefined ? true : attribute;
|
|
10
10
|
};
|
|
11
11
|
export const createComponent = (spec, define, _name) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
12
|
+
const described = describe(spec);
|
|
13
|
+
const { attributes, properties, events, form } = described;
|
|
14
|
+
const eventProps = events.map((event) => `on${pascal(event)}`);
|
|
15
|
+
const slots = described.slots.map((slot) => [camel(slot), slot]);
|
|
16
|
+
const slotKeys = new Set(slots.map(([key]) => key));
|
|
17
|
+
const own = [...new Set([...attributes.keys(), ...properties, ...eventProps, ...slotKeys, ...(form ? ["name"] : []), "ref", "children"])];
|
|
18
|
+
const component = (props) => {
|
|
19
|
+
const [, others] = splitProps(props, own);
|
|
20
|
+
let element;
|
|
21
|
+
const slotted = new Map(slots.map(([key]) => [key, createMemo(() => props[key])]));
|
|
22
|
+
const host = {};
|
|
23
|
+
for (const [key, attribute] of attributes) {
|
|
24
|
+
if (attribute.shadowed && !isServer)
|
|
25
|
+
continue;
|
|
26
|
+
Object.defineProperty(host, attribute.name, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: () => {
|
|
29
|
+
const value = slotted.get(key)?.() ?? props[key];
|
|
30
|
+
if (slotKeys.has(key) && value != null && typeof value !== "string")
|
|
31
|
+
return undefined;
|
|
32
|
+
if (value === undefined && attribute.shadowed) {
|
|
33
|
+
return toHost(attribute.type, props[attribute.name]);
|
|
34
|
+
}
|
|
35
|
+
return toHost(attribute.type, value);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (form)
|
|
40
|
+
Object.defineProperty(host, "name", { enumerable: true, get: () => props.name });
|
|
41
|
+
const wrappers = slots.map(([key, slot]) => createMemo(() => {
|
|
42
|
+
const value = slotted.get(key)?.();
|
|
43
|
+
if (value == null || value === false || (attributes.has(key) && typeof value === "string"))
|
|
44
|
+
return null;
|
|
45
|
+
return Dynamic({ component: "span", slot, style: "display: contents", children: value });
|
|
46
|
+
}));
|
|
47
|
+
const shadowAttributes = () => {
|
|
48
|
+
const snapshot = {};
|
|
49
|
+
const take = (source) => {
|
|
50
|
+
for (const key of Object.keys(source)) {
|
|
51
|
+
if (key === "children" || key === "ref" || key === "component")
|
|
52
|
+
continue;
|
|
53
|
+
const value = source[key];
|
|
54
|
+
if (typeof value === "function" || value === undefined)
|
|
55
|
+
continue;
|
|
56
|
+
snapshot[key] = value;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
take(host);
|
|
60
|
+
take(others);
|
|
61
|
+
return snapshot;
|
|
62
|
+
};
|
|
63
|
+
const tag = `${getPrefix()}-${spec.name}`;
|
|
64
|
+
let rendered = false;
|
|
65
|
+
Object.defineProperty(host, "children", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: () => {
|
|
68
|
+
const named = wrappers.map((wrapper) => wrapper()).filter((wrapper) => wrapper !== null);
|
|
69
|
+
const body = (named.length ? [props.children, ...named] : props.children);
|
|
70
|
+
if (!isServer)
|
|
71
|
+
return body;
|
|
72
|
+
const inner = shadow(tag, shadowAttributes(), body);
|
|
73
|
+
const text = typeof inner === "object" && inner !== null && "t" in inner ? String(inner.t) : "";
|
|
74
|
+
rendered = text.startsWith("<template shadowrootmode=");
|
|
75
|
+
return inner;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
if (isServer) {
|
|
79
|
+
for (const name of [RENDERED_HOST_ATTRIBUTE, ...(spec.marker ? [spec.marker] : [])]) {
|
|
80
|
+
Object.defineProperty(host, name, {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: () => rendered ? "" : undefined,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const ref = (node) => {
|
|
87
|
+
element = node;
|
|
88
|
+
const forwarded = props.ref;
|
|
89
|
+
if (typeof forwarded === "function")
|
|
90
|
+
forwarded(node);
|
|
91
|
+
};
|
|
92
|
+
const sync = () => {
|
|
93
|
+
if (!element)
|
|
94
|
+
return;
|
|
95
|
+
writeDefaults(element, described, (key) => props[key]);
|
|
96
|
+
writeLive(element, described, (property) => props[property]);
|
|
97
|
+
};
|
|
98
|
+
onMount(() => {
|
|
99
|
+
const el = element;
|
|
100
|
+
if (!el)
|
|
101
|
+
return;
|
|
102
|
+
sync();
|
|
103
|
+
define({ prefix: getPrefix() });
|
|
104
|
+
sync();
|
|
105
|
+
for (const event of events) {
|
|
106
|
+
const listener = (e) => {
|
|
107
|
+
const handler = props[`on${pascal(event)}`];
|
|
108
|
+
if (typeof handler === "function")
|
|
109
|
+
handler(e);
|
|
110
|
+
};
|
|
111
|
+
el.addEventListener(event, listener);
|
|
112
|
+
onCleanup(() => el.removeEventListener(event, listener));
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
createEffect(sync);
|
|
116
|
+
return Dynamic(mergeProps(others, host, { component: `${getPrefix()}-${spec.name}`, ref }));
|
|
117
|
+
};
|
|
118
|
+
return component;
|
|
119
119
|
};
|
|
120
120
|
export const createDeclaration = (spec, _name) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
const attributes = describeDeclaration(spec);
|
|
122
|
+
const component = (props) => {
|
|
123
|
+
const [, others] = splitProps(props, [...attributes.keys()]);
|
|
124
|
+
const host = {};
|
|
125
|
+
for (const [key, attribute] of attributes) {
|
|
126
|
+
Object.defineProperty(host, attribute.name, {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: () => toHost(attribute.type, props[key]),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return Dynamic(mergeProps(others, host, { component: `${getPrefix()}-${spec.name}` }));
|
|
132
|
+
};
|
|
133
|
+
return component;
|
|
134
134
|
};
|
package/dist/solid/shadow.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isServer } from "solid-js/web";
|
|
2
2
|
import { getPrefix } from "../elements/adapter.js";
|
|
3
3
|
export const shadow = (tag, props, children) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
if (!isServer)
|
|
5
|
+
return children;
|
|
6
|
+
const render = globalThis[Symbol.for("mtrl.ssr")]?.solid;
|
|
7
|
+
if (!render)
|
|
8
|
+
return children;
|
|
9
|
+
return render(tag, props, children, getPrefix());
|
|
10
10
|
};
|
package/dist/ssr/react.js
CHANGED
|
@@ -1,310 +1,2 @@
|
|
|
1
|
-
import *
|
|
2
|
-
|
|
3
|
-
import "./index.js";
|
|
4
|
-
const bridge = globalThis[Symbol.for("mtrl.ssr")];
|
|
5
|
-
const RETRY_DELAYS_MS = [0, 2, 4, 8, 16, 32, 64, 128, 250];
|
|
6
|
-
const MAX_SUSPENDS = 40;
|
|
7
|
-
let serializingChildren = false;
|
|
8
|
-
const attempts = new WeakMap();
|
|
9
|
-
const firstFrame = (error) => {
|
|
10
|
-
if (!(error instanceof Error) || typeof error.stack !== "string")
|
|
11
|
-
return undefined;
|
|
12
|
-
const header = `${error.name}: ${error.message}`;
|
|
13
|
-
const rest = error.stack.startsWith(header) ? error.stack.slice(header.length) : error.stack;
|
|
14
|
-
return rest.split("\n").map((line) => line.trim()).find((line) => line.startsWith("at ") || /@[^@]*:\d+:\d+/.test(line));
|
|
15
|
-
};
|
|
16
|
-
let sampledFrame = null;
|
|
17
|
-
const suspendFrame = () => {
|
|
18
|
-
if (sampledFrame !== null)
|
|
19
|
-
return sampledFrame;
|
|
20
|
-
const pending = new Promise(() => { });
|
|
21
|
-
const Probe = () => { throw pending; };
|
|
22
|
-
const errorLog = console.error;
|
|
23
|
-
const warnLog = console.warn;
|
|
24
|
-
console.error = () => { };
|
|
25
|
-
console.warn = () => { };
|
|
26
|
-
try {
|
|
27
|
-
ReactDOMServer.renderToStaticMarkup(React.createElement(Probe));
|
|
28
|
-
sampledFrame = undefined;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
sampledFrame = firstFrame(error);
|
|
32
|
-
}
|
|
33
|
-
finally {
|
|
34
|
-
console.error = errorLog;
|
|
35
|
-
console.warn = warnLog;
|
|
36
|
-
}
|
|
37
|
-
if (sampledFrame === undefined && isDevelopment()) {
|
|
38
|
-
console.warn("[mtrl] Suspending children of mtrl components will render without a server shadow root because no stack frame is available. Error.stackTraceLimit is 0, or Error.prepareStackTrace is custom.");
|
|
39
|
-
}
|
|
40
|
-
return sampledFrame;
|
|
41
|
-
};
|
|
42
|
-
const isSynchronousSuspend = (error) => {
|
|
43
|
-
const frame = firstFrame(error);
|
|
44
|
-
return frame !== undefined && frame === sampledFrame;
|
|
45
|
-
};
|
|
46
|
-
const isDevelopment = () => {
|
|
47
|
-
try {
|
|
48
|
-
return typeof process !== "undefined" && process.env != null && process.env.NODE_ENV !== "production";
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const elementLabel = (tag, props) => {
|
|
55
|
-
const id = typeof props.id === "string" && props.id ? ` id=${JSON.stringify(props.id)}` : "";
|
|
56
|
-
return `<${tag}${id}>`;
|
|
57
|
-
};
|
|
58
|
-
const childNodes = (children) => {
|
|
59
|
-
const nodes = [];
|
|
60
|
-
const visit = (node) => {
|
|
61
|
-
if (Array.isArray(node)) {
|
|
62
|
-
for (const child of node)
|
|
63
|
-
visit(child);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (node === null || typeof node !== "object")
|
|
67
|
-
return;
|
|
68
|
-
if (React.isValidElement(node) && node.type === "span") {
|
|
69
|
-
const props = node.props;
|
|
70
|
-
if (props.slot != null) {
|
|
71
|
-
visit(props.children);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
nodes.push(node);
|
|
76
|
-
};
|
|
77
|
-
const top = React.isValidElement(children) && children.type === React.Fragment
|
|
78
|
-
? children.props.children
|
|
79
|
-
: children;
|
|
80
|
-
visit(top);
|
|
81
|
-
return nodes;
|
|
82
|
-
};
|
|
83
|
-
const nextAttempt = (children) => {
|
|
84
|
-
const nodes = childNodes(children);
|
|
85
|
-
if (nodes.length === 0)
|
|
86
|
-
return MAX_SUSPENDS + 1;
|
|
87
|
-
let state;
|
|
88
|
-
for (const node of nodes) {
|
|
89
|
-
state = attempts.get(node);
|
|
90
|
-
if (state)
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
if (!state)
|
|
94
|
-
state = { count: 0, nodes, gaveUp: false };
|
|
95
|
-
state.count += 1;
|
|
96
|
-
state.nodes = nodes;
|
|
97
|
-
for (const node of nodes)
|
|
98
|
-
attempts.set(node, state);
|
|
99
|
-
return state.count;
|
|
100
|
-
};
|
|
101
|
-
const suspendedGaveUp = (children) => {
|
|
102
|
-
for (const node of childNodes(children)) {
|
|
103
|
-
if (attempts.get(node)?.gaveUp)
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
};
|
|
108
|
-
const markGaveUp = (children) => {
|
|
109
|
-
let state;
|
|
110
|
-
for (const node of childNodes(children)) {
|
|
111
|
-
state = attempts.get(node);
|
|
112
|
-
if (state)
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
if (!state || state.gaveUp)
|
|
116
|
-
return false;
|
|
117
|
-
state.gaveUp = true;
|
|
118
|
-
return true;
|
|
119
|
-
};
|
|
120
|
-
const PROBE_TIMEOUT_MS = 50;
|
|
121
|
-
const probeBoundaryError = (element) => {
|
|
122
|
-
const probe = { reported: false, complete: false, settled: false, done: Promise.resolve() };
|
|
123
|
-
let resolveDone;
|
|
124
|
-
probe.done = new Promise((resolve) => { resolveDone = resolve; });
|
|
125
|
-
let listening = true;
|
|
126
|
-
let release;
|
|
127
|
-
const settle = () => {
|
|
128
|
-
if (probe.settled)
|
|
129
|
-
return;
|
|
130
|
-
probe.settled = true;
|
|
131
|
-
release?.();
|
|
132
|
-
resolveDone();
|
|
133
|
-
};
|
|
134
|
-
const onError = () => {
|
|
135
|
-
if (!listening)
|
|
136
|
-
return;
|
|
137
|
-
probe.reported = true;
|
|
138
|
-
if (probe.complete)
|
|
139
|
-
settle();
|
|
140
|
-
};
|
|
141
|
-
const onComplete = () => {
|
|
142
|
-
if (!listening)
|
|
143
|
-
return;
|
|
144
|
-
probe.complete = true;
|
|
145
|
-
settle();
|
|
146
|
-
};
|
|
147
|
-
const timer = setTimeout(() => {
|
|
148
|
-
listening = false;
|
|
149
|
-
settle();
|
|
150
|
-
}, PROBE_TIMEOUT_MS);
|
|
151
|
-
const readable = ReactDOMServer.renderToReadableStream;
|
|
152
|
-
if (typeof readable === "function") {
|
|
153
|
-
const controller = new AbortController();
|
|
154
|
-
release = () => {
|
|
155
|
-
clearTimeout(timer);
|
|
156
|
-
listening = false;
|
|
157
|
-
controller.abort();
|
|
158
|
-
};
|
|
159
|
-
void readable(element, { onError, signal: controller.signal }).then((response) => {
|
|
160
|
-
const all = response?.allReady;
|
|
161
|
-
if (all)
|
|
162
|
-
void all.then(onComplete, onComplete);
|
|
163
|
-
}, onComplete).catch(() => { });
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
const pipeable = ReactDOMServer.renderToPipeableStream;
|
|
167
|
-
if (typeof pipeable !== "function") {
|
|
168
|
-
clearTimeout(timer);
|
|
169
|
-
listening = false;
|
|
170
|
-
settle();
|
|
171
|
-
return probe;
|
|
172
|
-
}
|
|
173
|
-
const onShellDeath = () => {
|
|
174
|
-
onError();
|
|
175
|
-
onComplete();
|
|
176
|
-
};
|
|
177
|
-
const stream = pipeable(element, { onError, onShellError: onShellDeath, onShellReady() { }, onAllReady: onComplete });
|
|
178
|
-
release = () => {
|
|
179
|
-
clearTimeout(timer);
|
|
180
|
-
listening = false;
|
|
181
|
-
stream.abort();
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
return probe;
|
|
185
|
-
};
|
|
186
|
-
const boundaryProbes = new WeakMap();
|
|
187
|
-
const storedBoundaryProbe = (children) => {
|
|
188
|
-
for (const node of childNodes(children)) {
|
|
189
|
-
const probe = boundaryProbes.get(node);
|
|
190
|
-
if (probe)
|
|
191
|
-
return probe;
|
|
192
|
-
}
|
|
193
|
-
return undefined;
|
|
194
|
-
};
|
|
195
|
-
const boundaryProbe = (children, element) => {
|
|
196
|
-
const nodes = childNodes(children);
|
|
197
|
-
let existing;
|
|
198
|
-
for (const node of nodes)
|
|
199
|
-
existing ?? (existing = boundaryProbes.get(node));
|
|
200
|
-
if (existing && !existing.settled)
|
|
201
|
-
return existing;
|
|
202
|
-
const probe = probeBoundaryError(element);
|
|
203
|
-
for (const node of nodes)
|
|
204
|
-
boundaryProbes.set(node, probe);
|
|
205
|
-
return probe;
|
|
206
|
-
};
|
|
207
|
-
const clearAttempt = (children) => {
|
|
208
|
-
const nodes = childNodes(children);
|
|
209
|
-
let state;
|
|
210
|
-
for (const node of nodes) {
|
|
211
|
-
boundaryProbes.delete(node);
|
|
212
|
-
state ?? (state = attempts.get(node));
|
|
213
|
-
}
|
|
214
|
-
if (!state)
|
|
215
|
-
return;
|
|
216
|
-
for (const node of state.nodes)
|
|
217
|
-
attempts.delete(node);
|
|
218
|
-
for (const node of nodes)
|
|
219
|
-
attempts.delete(node);
|
|
220
|
-
};
|
|
221
|
-
const retryDelay = (attempt) => RETRY_DELAYS_MS[Math.min(attempt - 1, RETRY_DELAYS_MS.length - 1)] ?? RETRY_DELAYS_MS[RETRY_DELAYS_MS.length - 1] ?? 250;
|
|
222
|
-
const countPendingSubscriptions = () => {
|
|
223
|
-
const prototype = Promise.prototype;
|
|
224
|
-
const original = prototype.then;
|
|
225
|
-
let calls = 0;
|
|
226
|
-
prototype.then = function (...arguments_) {
|
|
227
|
-
calls += 1;
|
|
228
|
-
return original.apply(this, arguments_);
|
|
229
|
-
};
|
|
230
|
-
return { read: () => calls, restore: () => { prototype.then = original; } };
|
|
231
|
-
};
|
|
232
|
-
const PENDING_BOUNDARY = "<!--$!-->";
|
|
233
|
-
const boundaryStillPending = (element) => {
|
|
234
|
-
serializingChildren = true;
|
|
235
|
-
try {
|
|
236
|
-
return ReactDOMServer.renderToString(element).includes(PENDING_BOUNDARY);
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
finally {
|
|
242
|
-
serializingChildren = false;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
bridge.react = (tag, props, children, prefix) => {
|
|
246
|
-
if (serializingChildren)
|
|
247
|
-
return undefined;
|
|
248
|
-
if (suspendedGaveUp(children))
|
|
249
|
-
return undefined;
|
|
250
|
-
suspendFrame();
|
|
251
|
-
const element = React.createElement(tag, props, children);
|
|
252
|
-
let markup;
|
|
253
|
-
serializingChildren = true;
|
|
254
|
-
const subscriptions = countPendingSubscriptions();
|
|
255
|
-
try {
|
|
256
|
-
markup = ReactDOMServer.renderToStaticMarkup(element);
|
|
257
|
-
}
|
|
258
|
-
catch (error) {
|
|
259
|
-
if (!isSynchronousSuspend(error)) {
|
|
260
|
-
if (isDevelopment()) {
|
|
261
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
262
|
-
console.warn(`[mtrl] ${elementLabel(tag, props)} child snapshot failed, often because it needs ancestor context; this response has no shadow root for it: ${message}`);
|
|
263
|
-
}
|
|
264
|
-
clearAttempt(children);
|
|
265
|
-
return undefined;
|
|
266
|
-
}
|
|
267
|
-
const attempt = nextAttempt(children);
|
|
268
|
-
if (attempt > MAX_SUSPENDS) {
|
|
269
|
-
if (markGaveUp(children) && isDevelopment()) {
|
|
270
|
-
console.warn(`[mtrl] ${elementLabel(tag, props)} still had a suspending child after ${MAX_SUSPENDS} attempts, so this response has no shadow root for it.`);
|
|
271
|
-
}
|
|
272
|
-
return undefined;
|
|
273
|
-
}
|
|
274
|
-
const delay = retryDelay(attempt);
|
|
275
|
-
throw new Promise((resolve) => { setTimeout(resolve, delay); });
|
|
276
|
-
}
|
|
277
|
-
finally {
|
|
278
|
-
subscriptions.restore();
|
|
279
|
-
serializingChildren = false;
|
|
280
|
-
}
|
|
281
|
-
if (subscriptions.read() > 0 || boundaryStillPending(element)) {
|
|
282
|
-
const attempt = nextAttempt(children);
|
|
283
|
-
const withinCap = attempt <= MAX_SUSPENDS;
|
|
284
|
-
if (subscriptions.read() > 0) {
|
|
285
|
-
if (withinCap)
|
|
286
|
-
throw new Promise((resolve) => { setTimeout(resolve, retryDelay(attempt)); });
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
const stored = storedBoundaryProbe(children);
|
|
290
|
-
if (stored?.reported && stored.complete) {
|
|
291
|
-
clearAttempt(children);
|
|
292
|
-
return bridge.shadow(tag, markup, prefix) || undefined;
|
|
293
|
-
}
|
|
294
|
-
const probe = withinCap ? boundaryProbe(children, element) : undefined;
|
|
295
|
-
if (probe && !probe.settled) {
|
|
296
|
-
throw new Promise((resolve) => {
|
|
297
|
-
void probe.done.then(() => {
|
|
298
|
-
if (probe.reported && probe.complete) {
|
|
299
|
-
resolve();
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
setTimeout(resolve, retryDelay(attempt));
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
clearAttempt(children);
|
|
309
|
-
return bridge.shadow(tag, markup, prefix) || undefined;
|
|
310
|
-
};
|
|
1
|
+
import*as h from"react";import*as g from"react-dom/server";import"./index.js";const T=globalThis[Symbol.for("mtrl.ssr")],w=[0,2,4,8,16,32,64,128,250],S=40;let y=!1;const d=new WeakMap,D=(t)=>{if(!(t instanceof Error)||typeof t.stack!=="string")return;const e=`${t.name}: ${t.message}`;return(t.stack.startsWith(e)?t.stack.slice(e.length):t.stack).split(`
|
|
2
|
+
`).map((o)=>o.trim()).find((o)=>o.startsWith("at ")||/@[^@]*:\d+:\d+/.test(o))};let u=null;const A=()=>{if(u!==null)return u;const t=new Promise(()=>{}),e=()=>{throw t},{error:n,warn:o}=console;console.error=()=>{};console.warn=()=>{};try{g.renderToStaticMarkup(h.createElement(e));u=void 0}catch(r){u=D(r)}finally{console.error=n;console.warn=o}if(u===void 0&&v())console.warn("[mtrl] Suspending children of mtrl components will render without a server shadow root because no stack frame is available. Error.stackTraceLimit is 0, or Error.prepareStackTrace is custom.");return u},U=(t)=>{const e=D(t);return e!==void 0&&e===u},v=()=>{try{return typeof process<"u"&&process.env!=null&&process.env.NODE_ENV!=="production"}catch{return!1}},M=(t,e)=>{const n=typeof e.id==="string"&&e.id?` id=${JSON.stringify(e.id)}`:"";return`<${t}${n}>`},p=(t)=>{const e=[],n=(r)=>{if(Array.isArray(r)){for(const s of r)n(s);return}if(r===null||typeof r!=="object")return;if(h.isValidElement(r)&&r.type==="span"){const s=r.props;if(s.slot!=null){n(s.children);return}}e.push(r)},o=h.isValidElement(t)&&t.type===h.Fragment?t.props.children:t;n(o);return e},R=(t)=>{const e=p(t);if(e.length===0)return S+1;let n;for(const o of e){n=d.get(o);if(n)break}if(!n)n={count:0,nodes:e,gaveUp:!1};n.count+=1;n.nodes=e;for(const o of e)d.set(o,n);return n.count},N=(t)=>{for(const e of p(t))if(d.get(e)?.gaveUp)return!0;return!1},_=(t)=>{let e;for(const n of p(t)){e=d.get(n);if(e)break}if(!e||e.gaveUp)return!1;e.gaveUp=!0;return!0},O=50,L=(t)=>{const e={reported:!1,complete:!1,settled:!1,done:Promise.resolve()};let n;e.done=new Promise((a)=>{n=a});let o=!0,r;const s=()=>{if(e.settled)return;e.settled=!0;r?.();n()},f=()=>{if(!o)return;e.reported=!0;if(e.complete)s()},i=()=>{if(!o)return;e.complete=!0;s()},c=setTimeout(()=>{o=!1;s()},O),l=g.renderToReadableStream;if(typeof l==="function"){const a=new AbortController;r=()=>{clearTimeout(c);o=!1;a.abort()};l(t,{onError:f,signal:a.signal}).then((m)=>{const b=m?.allReady;if(b)b.then(i,i)},i).catch(()=>{})}else{const a=g.renderToPipeableStream;if(typeof a!=="function"){clearTimeout(c);o=!1;s();return e}const b=a(t,{onError:f,onShellError:()=>{f();i()},onShellReady(){},onAllReady:i});r=()=>{clearTimeout(c);o=!1;b.abort()}}return e},E=new WeakMap,B=(t)=>{for(const e of p(t)){const n=E.get(e);if(n)return n}return},C=(t,e)=>{const n=p(t);let o;for(const s of n)o??(o=E.get(s));if(o&&!o.settled)return o;const r=L(e);for(const s of n)E.set(s,r);return r},P=(t)=>{const e=p(t);let n;for(const o of e){E.delete(o);n??(n=d.get(o))}if(!n)return;for(const o of n.nodes)d.delete(o);for(const o of e)d.delete(o)},k=(t)=>w[Math.min(t-1,w.length-1)]??w[w.length-1]??250,F=()=>{const t=Promise.prototype,e=t.then;let n=0;t.then=function(...o){n+=1;return e.apply(this,o)};return{read:()=>n,restore:()=>{t.then=e}}},W="<!--$!-->",G=(t)=>{y=!0;try{return g.renderToString(t).includes(W)}catch{return!1}finally{y=!1}};T.react=(t,e,n,o)=>{if(y)return;if(N(n))return;A();const r=h.createElement(t,e,n);let s;y=!0;const f=F();try{s=g.renderToStaticMarkup(r)}catch(i){if(!U(i)){if(v()){const a=i instanceof Error?i.message:String(i);console.warn(`[mtrl] ${M(t,e)} child snapshot failed, often because it needs ancestor context; this response has no shadow root for it: ${a}`)}P(n);return}const c=R(n);if(c>S){if(_(n)&&v())console.warn(`[mtrl] ${M(t,e)} still had a suspending child after ${S} attempts, so this response has no shadow root for it.`);return}const l=k(c);throw new Promise((a)=>{setTimeout(a,l)})}finally{f.restore();y=!1}if(f.read()>0||G(r)){const i=R(n),c=i<=S;if(f.read()>0){if(c)throw new Promise((l)=>{setTimeout(l,k(i))})}else{const l=B(n);if(l?.reported&&l.complete){P(n);return T.shadow(t,s,o)||void 0}const a=c?C(n,r):void 0;if(a&&!a.settled)throw new Promise((m)=>{a.done.then(()=>{if(a.reported&&a.complete){m();return}setTimeout(m,k(i))})})}}P(n);return T.shadow(t,s,o)||void 0};
|
package/dist/ssr/solid.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./index.js";
|
|
3
|
-
const bridge = globalThis[Symbol.for("mtrl.ssr")];
|
|
4
|
-
const TAG = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
5
|
-
bridge.solid = (tag, props, children, prefix) => {
|
|
6
|
-
if (!TAG.test(tag))
|
|
7
|
-
throw new TypeError(`Invalid tag: ${tag}`);
|
|
8
|
-
const hostProps = { ...props, children };
|
|
9
|
-
const markup = ssrElement(tag, hostProps, undefined, false).t;
|
|
10
|
-
const closing = `</${tag}>`;
|
|
11
|
-
const openingLength = ssrElement(tag, hostProps, "", false).t.length - closing.length;
|
|
12
|
-
const light = markup.slice(openingLength, -closing.length);
|
|
13
|
-
const html = bridge.shadow(tag, markup, prefix, true);
|
|
14
|
-
const template = html ? `<template shadowrootmode="open" shadowrootdelegatesfocus="">${html}</template>` : "";
|
|
15
|
-
return ssr(template + light);
|
|
16
|
-
};
|
|
1
|
+
import{ssr as p,ssrElement as l}from"solid-js/web";import"./index.js";const r=globalThis[Symbol.for("mtrl.ssr")],f=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;r.solid=(o,c,h,i)=>{if(!f.test(o))throw TypeError(`Invalid tag: ${o}`);const t={...c,children:h},e=l(o,t,void 0,!1).t,s=`</${o}>`,m=l(o,t,"",!1).t.length-s.length,a=e.slice(m,-s.length),n=r.shadow(o,e,i,!0),d=n?`<template shadowrootmode="open" shadowrootdelegatesfocus="">${n}</template>`:"";return p(d+a)};
|