material 3.5.2 → 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/index.js +17 -17
- 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
|
@@ -2,75 +2,75 @@ export const DISTANCE_EPSILON = 1e-4;
|
|
|
2
2
|
export const lerp = (start, stop, fraction) => (1 - fraction) * start + fraction * stop;
|
|
3
3
|
export const distance = (x, y) => Math.sqrt(x * x + y * y);
|
|
4
4
|
export const direction = (x, y) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const d = distance(x, y);
|
|
6
|
+
if (d <= 0)
|
|
7
|
+
throw new Error('Required distance greater than zero');
|
|
8
|
+
return [x / d, y / d];
|
|
9
9
|
};
|
|
10
10
|
export const rotate90 = ([x, y]) => [-y, x];
|
|
11
11
|
export const dot = (a, b) => a[0] * b[0] + a[1] * b[1];
|
|
12
12
|
export const straightLine = (x0, y0, x1, y1) => [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
x0, y0,
|
|
14
|
+
lerp(x0, x1, 1 / 3), lerp(y0, y1, 1 / 3),
|
|
15
|
+
lerp(x0, x1, 2 / 3), lerp(y0, y1, 2 / 3),
|
|
16
|
+
x1, y1,
|
|
17
17
|
];
|
|
18
18
|
export const circularArc = (centerX, centerY, x0, y0, x1, y1) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
const p0d = direction(x0 - centerX, y0 - centerY);
|
|
20
|
+
const p1d = direction(x1 - centerX, y1 - centerY);
|
|
21
|
+
const rotatedP0 = rotate90(p0d);
|
|
22
|
+
const rotatedP1 = rotate90(p1d);
|
|
23
|
+
const clockwise = dot(rotatedP0, [x1 - centerX, y1 - centerY]) >= 0;
|
|
24
|
+
const cosa = dot(p0d, p1d);
|
|
25
|
+
if (cosa > 0.999)
|
|
26
|
+
return straightLine(x0, y0, x1, y1);
|
|
27
|
+
const k = (distance(x0 - centerX, y0 - centerY) * 4 / 3) *
|
|
28
|
+
((Math.sqrt(2 * (1 - cosa)) - Math.sqrt(1 - cosa * cosa)) / (1 - cosa)) *
|
|
29
|
+
(clockwise ? 1 : -1);
|
|
30
|
+
return [
|
|
31
|
+
x0, y0,
|
|
32
|
+
x0 + rotatedP0[0] * k, y0 + rotatedP0[1] * k,
|
|
33
|
+
x1 - rotatedP1[0] * k, y1 - rotatedP1[1] * k,
|
|
34
|
+
x1, y1,
|
|
35
|
+
];
|
|
36
36
|
};
|
|
37
37
|
export const pointOnCurve = (c, t) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const u = 1 - t;
|
|
39
|
+
return [
|
|
40
|
+
c[0] * (u * u * u) + c[2] * (3 * t * u * u) + c[4] * (3 * t * t * u) + c[6] * (t * t * t),
|
|
41
|
+
c[1] * (u * u * u) + c[3] * (3 * t * u * u) + c[5] * (3 * t * t * u) + c[7] * (t * t * t),
|
|
42
|
+
];
|
|
43
43
|
};
|
|
44
44
|
export const splitCubic = (c, t) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
const u = 1 - t;
|
|
46
|
+
const [x0, y0, x1, y1, x2, y2, x3, y3] = c;
|
|
47
|
+
const ax = u * x0 + t * x1, ay = u * y0 + t * y1;
|
|
48
|
+
const bx = u * x1 + t * x2, by = u * y1 + t * y2;
|
|
49
|
+
const cx = u * x2 + t * x3, cy = u * y2 + t * y3;
|
|
50
|
+
const dx = u * ax + t * bx, dy = u * ay + t * by;
|
|
51
|
+
const ex = u * bx + t * cx, ey = u * by + t * cy;
|
|
52
|
+
const mx = u * dx + t * ex, my = u * dy + t * ey;
|
|
53
|
+
return [
|
|
54
|
+
[x0, y0, ax, ay, dx, dy, mx, my],
|
|
55
|
+
[mx, my, ex, ey, cx, cy, x3, y3],
|
|
56
|
+
];
|
|
57
57
|
};
|
|
58
58
|
export const reverseCubic = (c) => [c[6], c[7], c[4], c[5], c[2], c[3], c[0], c[1]];
|
|
59
59
|
export const zeroLength = (c) => Math.abs(c[0] - c[6]) < DISTANCE_EPSILON && Math.abs(c[1] - c[7]) < DISTANCE_EPSILON;
|
|
60
60
|
export const transformCubic = (c, f) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
const a0 = f(c[0], c[1]);
|
|
62
|
+
const c0 = f(c[2], c[3]);
|
|
63
|
+
const c1 = f(c[4], c[5]);
|
|
64
|
+
const a1 = f(c[6], c[7]);
|
|
65
|
+
return [a0[0], a0[1], c0[0], c0[1], c1[0], c1[1], a1[0], a1[1]];
|
|
66
66
|
};
|
|
67
67
|
export const cubicBounds = (c) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
if (zeroLength(c))
|
|
69
|
+
return [c[0], c[1], c[0], c[1]];
|
|
70
|
+
return [
|
|
71
|
+
Math.min(c[0], c[2], c[4], c[6]),
|
|
72
|
+
Math.min(c[1], c[3], c[5], c[7]),
|
|
73
|
+
Math.max(c[0], c[2], c[4], c[6]),
|
|
74
|
+
Math.max(c[1], c[3], c[5], c[7]),
|
|
75
|
+
];
|
|
76
76
|
};
|
|
@@ -8,43 +8,43 @@ const cornerRound100 = { radius: 1 };
|
|
|
8
8
|
const point = (x, y, radius = 0, smoothing = 0) => ({ x, y, r: { radius, smoothing } });
|
|
9
9
|
const toRadians = (degrees) => (degrees / 360) * 2 * Math.PI;
|
|
10
10
|
const repeat = (points, reps, cx, cy, mirroring) => {
|
|
11
|
-
|
|
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
|
-
|
|
11
|
+
const result = [];
|
|
12
|
+
if (mirroring) {
|
|
13
|
+
const angles = points.map((p) => (Math.atan2(p.y - cy, p.x - cx) * 180) / Math.PI);
|
|
14
|
+
const distances = points.map((p) => Math.hypot(p.x - cx, p.y - cy));
|
|
15
|
+
const actualReps = reps * 2;
|
|
16
|
+
const sectionAngle = 360 / actualReps;
|
|
17
|
+
for (let it = 0; it < actualReps; it++) {
|
|
18
|
+
for (let index = 0; index < points.length; index++) {
|
|
19
|
+
const i = it % 2 === 0 ? index : points.length - 1 - index;
|
|
20
|
+
if (i > 0 || it % 2 === 0) {
|
|
21
|
+
const a = toRadians(sectionAngle * it + (it % 2 === 0 ? angles[i] : sectionAngle - angles[i] + 2 * angles[0]));
|
|
22
|
+
result.push({ x: Math.cos(a) * distances[i] + cx, y: Math.sin(a) * distances[i] + cy, r: points[i].r });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
const np = points.length;
|
|
29
|
+
for (let it = 0; it < np * reps; it++) {
|
|
30
|
+
const p = points[it % np];
|
|
31
|
+
const a = toRadians(Math.floor(it / np) * (360 / reps));
|
|
32
|
+
const dx = p.x - cx;
|
|
33
|
+
const dy = p.y - cy;
|
|
34
|
+
result.push({ x: dx * Math.cos(a) - dy * Math.sin(a) + cx, y: dx * Math.sin(a) + dy * Math.cos(a) + cy, r: p.r });
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
37
|
};
|
|
38
38
|
const custom = (pnr, reps, mirroring = false) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
const points = repeat(pnr, reps, 0.5, 0.5, mirroring);
|
|
40
|
+
const vertices = [];
|
|
41
|
+
for (const p of points)
|
|
42
|
+
vertices.push(p.x, p.y);
|
|
43
|
+
return roundedPolygon(vertices, undefined, points.map((p) => p.r), 0.5, 0.5);
|
|
44
44
|
};
|
|
45
45
|
const shape = (build) => {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
let built;
|
|
47
|
+
return () => (built ?? (built = normalizePolygon(build())));
|
|
48
48
|
};
|
|
49
49
|
export const shapeCircle = /*#__PURE__*/ shape(() => circle(10));
|
|
50
50
|
export const shapeSquare = /*#__PURE__*/ shape(() => rectangle(1, 1, cornerRound30));
|
|
@@ -76,156 +76,156 @@ export const shapeBoom = /*#__PURE__*/ shape(() => custom([point(0.457, 0.296, 0
|
|
|
76
76
|
export const shapeSoftBoom = /*#__PURE__*/ shape(() => custom([point(0.733, 0.454), point(0.839, 0.437, 0.532), point(0.949, 0.449, 0.439, 1.0), point(0.998, 0.478, 0.174)], 16, true));
|
|
77
77
|
export const shapeFlower = /*#__PURE__*/ shape(() => custom([point(0.37, 0.187), point(0.416, 0.049, 0.381), point(0.479, 0.001, 0.095)], 8, true));
|
|
78
78
|
export const shapePuffy = /*#__PURE__*/ shape(() => scalePolygon(custom([
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
point(0.5, 0.053), point(0.545, -0.04, 0.405), point(0.67, -0.035, 0.426), point(0.717, 0.066, 0.574),
|
|
80
|
+
point(0.722, 0.128), point(0.777, 0.002, 0.36), point(0.914, 0.149, 0.66), point(0.926, 0.289, 0.66),
|
|
81
|
+
point(0.881, 0.346), point(0.94, 0.344, 0.126), point(1.003, 0.437, 0.255),
|
|
82
82
|
], 2, true), 1, 0.742));
|
|
83
83
|
export const shapePuffyDiamond = /*#__PURE__*/ shape(() => custom([point(0.87, 0.13, 0.146), point(0.818, 0.357), point(1.0, 0.332, 0.853)], 4, true));
|
|
84
84
|
export const shapePixelCircle = /*#__PURE__*/ shape(() => custom([
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
point(0.5, 0.0), point(0.704, 0.0), point(0.704, 0.065), point(0.843, 0.065),
|
|
86
|
+
point(0.843, 0.148), point(0.926, 0.148), point(0.926, 0.296), point(1.0, 0.296),
|
|
87
87
|
], 2, true));
|
|
88
88
|
export const shapePixelTriangle = /*#__PURE__*/ shape(() => custom([
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
point(0.11, 0.5), point(0.113, 0.0), point(0.287, 0.0), point(0.287, 0.087), point(0.421, 0.087),
|
|
90
|
+
point(0.421, 0.17), point(0.56, 0.17), point(0.56, 0.265), point(0.674, 0.265), point(0.675, 0.344),
|
|
91
|
+
point(0.789, 0.344), point(0.789, 0.439), point(0.888, 0.439),
|
|
92
92
|
], 1, true));
|
|
93
93
|
export const shapeBun = /*#__PURE__*/ shape(() => custom([point(0.796, 0.5), point(0.853, 0.518, 1), point(0.992, 0.631, 1), point(0.968, 1.0, 1)], 2, true));
|
|
94
94
|
export const shapeHeart = /*#__PURE__*/ shape(() => custom([point(0.5, 0.268, 0.016), point(0.792, -0.066, 0.958), point(1.064, 0.276, 1.0), point(0.501, 0.946, 0.129)], 1, true));
|
|
95
95
|
const byName = {
|
|
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
|
-
|
|
130
|
-
|
|
96
|
+
circle: shapeCircle,
|
|
97
|
+
square: shapeSquare,
|
|
98
|
+
slanted: shapeSlanted,
|
|
99
|
+
arch: shapeArch,
|
|
100
|
+
fan: shapeFan,
|
|
101
|
+
arrow: shapeArrow,
|
|
102
|
+
semiCircle: shapeSemiCircle,
|
|
103
|
+
oval: shapeOval,
|
|
104
|
+
pill: shapePill,
|
|
105
|
+
triangle: shapeTriangle,
|
|
106
|
+
diamond: shapeDiamond,
|
|
107
|
+
clamShell: shapeClamShell,
|
|
108
|
+
pentagon: shapePentagon,
|
|
109
|
+
gem: shapeGem,
|
|
110
|
+
sunny: shapeSunny,
|
|
111
|
+
verySunny: shapeVerySunny,
|
|
112
|
+
cookie4Sided: shapeCookie4Sided,
|
|
113
|
+
cookie6Sided: shapeCookie6Sided,
|
|
114
|
+
cookie7Sided: shapeCookie7Sided,
|
|
115
|
+
cookie9Sided: shapeCookie9Sided,
|
|
116
|
+
cookie12Sided: shapeCookie12Sided,
|
|
117
|
+
ghostish: shapeGhostish,
|
|
118
|
+
clover4Leaf: shapeClover4Leaf,
|
|
119
|
+
clover8Leaf: shapeClover8Leaf,
|
|
120
|
+
burst: shapeBurst,
|
|
121
|
+
softBurst: shapeSoftBurst,
|
|
122
|
+
boom: shapeBoom,
|
|
123
|
+
softBoom: shapeSoftBoom,
|
|
124
|
+
flower: shapeFlower,
|
|
125
|
+
puffy: shapePuffy,
|
|
126
|
+
puffyDiamond: shapePuffyDiamond,
|
|
127
|
+
pixelCircle: shapePixelCircle,
|
|
128
|
+
pixelTriangle: shapePixelTriangle,
|
|
129
|
+
bun: shapeBun,
|
|
130
|
+
heart: shapeHeart,
|
|
131
131
|
};
|
|
132
132
|
export const materialShape = (name) => byName[name]();
|
|
133
133
|
const num = (value) => {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const rounded = Math.round(value * 1000) / 1000;
|
|
135
|
+
return String(Object.is(rounded, -0) ? 0 : rounded);
|
|
136
136
|
};
|
|
137
137
|
export const polygonPath = (polygon, size = 1) => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
const cubics = polygon.cubics;
|
|
139
|
+
if (!cubics.length)
|
|
140
|
+
return '';
|
|
141
|
+
const s = (v) => num(v * size);
|
|
142
|
+
let d = `M${s(cubics[0][0])} ${s(cubics[0][1])}`;
|
|
143
|
+
for (const c of cubics)
|
|
144
|
+
d += `C${s(c[2])} ${s(c[3])} ${s(c[4])} ${s(c[5])} ${s(c[6])} ${s(c[7])}`;
|
|
145
|
+
return `${d}Z`;
|
|
146
146
|
};
|
|
147
147
|
export const materialShapePath = (name, size = 1) => polygonPath(materialShape(name), size);
|
|
148
148
|
const TWO_PI = Math.PI * 2;
|
|
149
149
|
export const sampleProfile = (polygon, samples = 360, stepsPerCubic = 24) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
150
|
+
const points = [];
|
|
151
|
+
for (const cubic of polygon.cubics) {
|
|
152
|
+
for (let s = 0; s < stepsPerCubic; s++)
|
|
153
|
+
points.push(pointOnCurve(cubic, s / stepsPerCubic));
|
|
154
|
+
}
|
|
155
|
+
let area = 0;
|
|
156
|
+
let centerX = 0;
|
|
157
|
+
let centerY = 0;
|
|
158
|
+
for (let i = 0; i < points.length; i++) {
|
|
159
|
+
const [x0, y0] = points[i];
|
|
160
|
+
const [x1, y1] = points[(i + 1) % points.length];
|
|
161
|
+
const cross = x0 * y1 - x1 * y0;
|
|
162
|
+
area += cross;
|
|
163
|
+
centerX += (x0 + x1) * cross;
|
|
164
|
+
centerY += (y0 + y1) * cross;
|
|
165
|
+
}
|
|
166
|
+
if (Math.abs(area) > 1e-12) {
|
|
167
|
+
centerX /= 3 * area;
|
|
168
|
+
centerY /= 3 * area;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const bounds = polygonBounds(polygon);
|
|
172
|
+
centerX = (bounds[0] + bounds[2]) / 2;
|
|
173
|
+
centerY = (bounds[1] + bounds[3]) / 2;
|
|
174
|
+
}
|
|
175
|
+
const outline = [];
|
|
176
|
+
for (const [x, y] of points) {
|
|
177
|
+
const dx = x - centerX;
|
|
178
|
+
const dy = y - centerY;
|
|
179
|
+
let angle = Math.atan2(dy, dx);
|
|
180
|
+
if (angle < 0)
|
|
181
|
+
angle += TWO_PI;
|
|
182
|
+
outline.push([angle, Math.hypot(dx, dy)]);
|
|
183
|
+
}
|
|
184
|
+
outline.sort((a, b) => a[0] - b[0]);
|
|
185
|
+
const last = outline[outline.length - 1];
|
|
186
|
+
const first = outline[0];
|
|
187
|
+
outline.unshift([last[0] - TWO_PI, last[1]]);
|
|
188
|
+
outline.push([first[0] + TWO_PI, first[1]]);
|
|
189
|
+
const radii = new Float32Array(samples);
|
|
190
|
+
let j = 0;
|
|
191
|
+
let maxRadius = 0;
|
|
192
|
+
for (let i = 0; i < samples; i++) {
|
|
193
|
+
const angle = (i / samples) * TWO_PI;
|
|
194
|
+
while (outline[j + 1][0] < angle)
|
|
195
|
+
j++;
|
|
196
|
+
const [a0, r0] = outline[j];
|
|
197
|
+
const [a1, r1] = outline[j + 1];
|
|
198
|
+
const t = a1 === a0 ? 0 : (angle - a0) / (a1 - a0);
|
|
199
|
+
const r = r0 + (r1 - r0) * t;
|
|
200
|
+
radii[i] = r;
|
|
201
|
+
if (r > maxRadius)
|
|
202
|
+
maxRadius = r;
|
|
203
|
+
}
|
|
204
|
+
return { radii, centerX, centerY, maxRadius };
|
|
205
205
|
};
|
|
206
206
|
export const radialProfile = (polygon, samples = 360, stepsPerCubic = 24) => {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
207
|
+
const profile = sampleProfile(polygon, samples, stepsPerCubic);
|
|
208
|
+
const { centerX, centerY } = profile;
|
|
209
|
+
const points = [];
|
|
210
|
+
for (const cubic of polygon.cubics) {
|
|
211
|
+
for (let s = 0; s < stepsPerCubic; s++)
|
|
212
|
+
points.push(pointOnCurve(cubic, s / stepsPerCubic));
|
|
213
|
+
}
|
|
214
|
+
let turn = 0;
|
|
215
|
+
for (let i = 0; i < points.length; i++) {
|
|
216
|
+
const [x0, y0] = points[i];
|
|
217
|
+
const [x1, y1] = points[(i + 1) % points.length];
|
|
218
|
+
let step = Math.atan2(y1 - centerY, x1 - centerX) - Math.atan2(y0 - centerY, x0 - centerX);
|
|
219
|
+
if (step > Math.PI)
|
|
220
|
+
step -= TWO_PI;
|
|
221
|
+
else if (step < -Math.PI)
|
|
222
|
+
step += TWO_PI;
|
|
223
|
+
if (turn === 0)
|
|
224
|
+
turn = Math.sign(step);
|
|
225
|
+
else if (step * turn < -1e-9) {
|
|
226
|
+
throw new Error("radialProfile: the shape is not star-shaped around its centroid, so it has no radial profile");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return profile;
|
|
230
230
|
};
|
|
231
231
|
export { polygonMaxRadius };
|