loseta 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -20
- package/dist/cli.js +3 -4
- package/dist/cli.js.map +1 -1
- package/dist/command-context.d.ts +20 -0
- package/dist/command-context.js +26 -0
- package/dist/command-context.js.map +1 -0
- package/dist/command-errors.d.ts +2 -0
- package/dist/command-errors.js +42 -0
- package/dist/command-errors.js.map +1 -0
- package/dist/commands/add.d.ts +8 -0
- package/dist/commands/add.js +189 -61
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.js +70 -27
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts +8 -0
- package/dist/commands/list.js +42 -3
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/style.d.ts +10 -1
- package/dist/commands/style.js +58 -10
- package/dist/commands/style.js.map +1 -1
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/fetch.d.ts +28 -0
- package/dist/fetch.js +135 -0
- package/dist/fetch.js.map +1 -0
- package/dist/imports.d.ts +6 -6
- package/dist/imports.js +42 -32
- package/dist/imports.js.map +1 -1
- package/dist/install.d.ts +17 -14
- package/dist/install.js +67 -41
- package/dist/install.js.map +1 -1
- package/dist/local-registry.d.ts +20 -0
- package/dist/local-registry.js +58 -0
- package/dist/local-registry.js.map +1 -0
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js +14 -2
- package/dist/manifest.js.map +1 -1
- package/dist/package-info.d.ts +2 -0
- package/dist/package-info.js +5 -0
- package/dist/package-info.js.map +1 -0
- package/dist/payload.d.ts +31 -0
- package/dist/payload.js +155 -0
- package/dist/payload.js.map +1 -0
- package/dist/registry-url.d.ts +14 -0
- package/dist/registry-url.js +63 -0
- package/dist/registry-url.js.map +1 -0
- package/dist/remote-registry.d.ts +36 -0
- package/dist/remote-registry.js +232 -0
- package/dist/remote-registry.js.map +1 -0
- package/dist/resolve.d.ts +23 -0
- package/dist/resolve.js +106 -0
- package/dist/resolve.js.map +1 -0
- package/{registry/schema.json → dist/schema-catalog.json} +31 -9
- package/dist/schema-item.json +119 -0
- package/dist/source-types.d.ts +15 -0
- package/dist/source-types.js +2 -0
- package/dist/source-types.js.map +1 -0
- package/dist/style-switch.d.ts +4 -1
- package/dist/style-switch.js +12 -2
- package/dist/style-switch.js.map +1 -1
- package/dist/types.d.ts +55 -3
- package/dist/validate-content.d.ts +20 -0
- package/dist/validate-content.js +385 -0
- package/dist/validate-content.js.map +1 -0
- package/dist/validation-rules.json +121 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.js +26 -0
- package/dist/version.js.map +1 -0
- package/package.json +4 -4
- package/registry/base.css +0 -20
- package/registry/behaviors/calendar.js +0 -855
- package/registry/behaviors/carousel.js +0 -280
- package/registry/behaviors/code-block.js +0 -106
- package/registry/behaviors/combobox.js +0 -237
- package/registry/behaviors/command.js +0 -105
- package/registry/behaviors/core.js +0 -302
- package/registry/behaviors/dialog.js +0 -97
- package/registry/behaviors/hover-overlay.js +0 -180
- package/registry/behaviors/listbox.js +0 -135
- package/registry/behaviors/menu.js +0 -586
- package/registry/behaviors/message-scroller.js +0 -147
- package/registry/behaviors/popover.js +0 -127
- package/registry/behaviors/questionnaire.js +0 -91
- package/registry/behaviors/resizable.js +0 -463
- package/registry/behaviors/select.js +0 -196
- package/registry/behaviors/tabs.js +0 -95
- package/registry/behaviors/toast.js +0 -137
- package/registry/components/accordion.css +0 -65
- package/registry/components/alert-dialog.css +0 -104
- package/registry/components/alert.css +0 -41
- package/registry/components/aspect-ratio.css +0 -25
- package/registry/components/attachment.css +0 -84
- package/registry/components/avatar.css +0 -63
- package/registry/components/badge.css +0 -22
- package/registry/components/breadcrumb.css +0 -65
- package/registry/components/bubble.css +0 -92
- package/registry/components/button-group.css +0 -98
- package/registry/components/button.css +0 -32
- package/registry/components/calendar.css +0 -96
- package/registry/components/card.css +0 -51
- package/registry/components/carousel.css +0 -96
- package/registry/components/chart.css +0 -65
- package/registry/components/checkbox.css +0 -39
- package/registry/components/code-block.css +0 -192
- package/registry/components/collapsible.css +0 -57
- package/registry/components/combobox.css +0 -42
- package/registry/components/command.css +0 -27
- package/registry/components/context-menu.css +0 -37
- package/registry/components/dialog.css +0 -87
- package/registry/components/drawer.css +0 -30
- package/registry/components/dropdown-menu.css +0 -14
- package/registry/components/empty.css +0 -66
- package/registry/components/field.css +0 -169
- package/registry/components/hover-card.css +0 -18
- package/registry/components/input-group.css +0 -56
- package/registry/components/input-otp.css +0 -119
- package/registry/components/input.css +0 -31
- package/registry/components/item.css +0 -102
- package/registry/components/kbd.css +0 -19
- package/registry/components/label.css +0 -31
- package/registry/components/marker.css +0 -47
- package/registry/components/menubar.css +0 -52
- package/registry/components/message-scroller.css +0 -56
- package/registry/components/message.css +0 -61
- package/registry/components/native-select.css +0 -27
- package/registry/components/navigation-menu.css +0 -52
- package/registry/components/pagination.css +0 -49
- package/registry/components/popover.css +0 -7
- package/registry/components/progress.css +0 -13
- package/registry/components/questionnaire.css +0 -92
- package/registry/components/radio.css +0 -40
- package/registry/components/resizable.css +0 -100
- package/registry/components/scroll-area.css +0 -16
- package/registry/components/select.css +0 -50
- package/registry/components/separator.css +0 -12
- package/registry/components/sheet.css +0 -31
- package/registry/components/sidebar.css +0 -107
- package/registry/components/skeleton.css +0 -11
- package/registry/components/slider.css +0 -13
- package/registry/components/spinner.css +0 -8
- package/registry/components/switch.css +0 -41
- package/registry/components/table.css +0 -73
- package/registry/components/tabs.css +0 -61
- package/registry/components/textarea.css +0 -25
- package/registry/components/toast.css +0 -47
- package/registry/components/toggle-group.css +0 -25
- package/registry/components/toggle.css +0 -31
- package/registry/components/tooltip.css +0 -437
- package/registry/components/trace.css +0 -78
- package/registry/examples/accordion.html +0 -56
- package/registry/examples/alert-dialog.html +0 -146
- package/registry/examples/alert.html +0 -62
- package/registry/examples/aspect-ratio.html +0 -14
- package/registry/examples/attachment.html +0 -53
- package/registry/examples/avatar.html +0 -66
- package/registry/examples/badge.html +0 -49
- package/registry/examples/breadcrumb.html +0 -103
- package/registry/examples/bubble.html +0 -26
- package/registry/examples/button-group.html +0 -141
- package/registry/examples/button.html +0 -66
- package/registry/examples/calendar.html +0 -757
- package/registry/examples/card.html +0 -204
- package/registry/examples/carousel.html +0 -127
- package/registry/examples/chart.html +0 -39
- package/registry/examples/checkbox.html +0 -111
- package/registry/examples/code-block.html +0 -84
- package/registry/examples/collapsible.html +0 -22
- package/registry/examples/combobox.html +0 -43
- package/registry/examples/command.html +0 -365
- package/registry/examples/context-menu.html +0 -179
- package/registry/examples/dialog.html +0 -187
- package/registry/examples/drawer.html +0 -234
- package/registry/examples/dropdown-menu.html +0 -272
- package/registry/examples/empty.html +0 -117
- package/registry/examples/field.html +0 -247
- package/registry/examples/hover-card.html +0 -13
- package/registry/examples/input-group.html +0 -110
- package/registry/examples/input-otp.html +0 -182
- package/registry/examples/input.html +0 -80
- package/registry/examples/item.html +0 -32
- package/registry/examples/kbd.html +0 -94
- package/registry/examples/label.html +0 -5
- package/registry/examples/marker.html +0 -20
- package/registry/examples/menubar.html +0 -372
- package/registry/examples/message-scroller.html +0 -54
- package/registry/examples/message.html +0 -47
- package/registry/examples/native-select.html +0 -91
- package/registry/examples/navigation-menu.html +0 -207
- package/registry/examples/pagination.html +0 -39
- package/registry/examples/popover.html +0 -163
- package/registry/examples/progress.html +0 -68
- package/registry/examples/questionnaire.html +0 -99
- package/registry/examples/radio.html +0 -127
- package/registry/examples/resizable.html +0 -107
- package/registry/examples/scroll-area.html +0 -34
- package/registry/examples/select.html +0 -250
- package/registry/examples/separator.html +0 -18
- package/registry/examples/sheet.html +0 -240
- package/registry/examples/sidebar.html +0 -407
- package/registry/examples/skeleton.html +0 -6
- package/registry/examples/slider.html +0 -56
- package/registry/examples/spinner.html +0 -15
- package/registry/examples/switch.html +0 -73
- package/registry/examples/table.html +0 -218
- package/registry/examples/tabs.html +0 -27
- package/registry/examples/textarea.html +0 -36
- package/registry/examples/toast.html +0 -28
- package/registry/examples/toggle-group.html +0 -73
- package/registry/examples/toggle.html +0 -40
- package/registry/examples/tooltip.html +0 -106
- package/registry/examples/trace.html +0 -54
- package/registry/primitives/dialog-shell.css +0 -129
- package/registry/primitives/listbox.css +0 -82
- package/registry/primitives/menu.css +0 -109
- package/registry/primitives/popover.css +0 -162
- package/registry/registry.json +0 -5349
- package/registry/reset.css +0 -400
- package/registry/styles/luma/accordion.css +0 -59
- package/registry/styles/luma/alert-dialog.css +0 -82
- package/registry/styles/luma/alert.css +0 -98
- package/registry/styles/luma/aspect-ratio.css +0 -6
- package/registry/styles/luma/attachment.css +0 -176
- package/registry/styles/luma/avatar.css +0 -132
- package/registry/styles/luma/badge.css +0 -112
- package/registry/styles/luma/breadcrumb.css +0 -62
- package/registry/styles/luma/bubble.css +0 -147
- package/registry/styles/luma/button-group.css +0 -63
- package/registry/styles/luma/button.css +0 -222
- package/registry/styles/luma/calendar.css +0 -140
- package/registry/styles/luma/card.css +0 -82
- package/registry/styles/luma/carousel.css +0 -63
- package/registry/styles/luma/chart.css +0 -51
- package/registry/styles/luma/checkbox.css +0 -58
- package/registry/styles/luma/code-block.css +0 -186
- package/registry/styles/luma/collapsible.css +0 -50
- package/registry/styles/luma/combobox.css +0 -59
- package/registry/styles/luma/command.css +0 -27
- package/registry/styles/luma/context-menu.css +0 -19
- package/registry/styles/luma/dialog.css +0 -64
- package/registry/styles/luma/drawer.css +0 -68
- package/registry/styles/luma/dropdown-menu.css +0 -8
- package/registry/styles/luma/empty.css +0 -52
- package/registry/styles/luma/field.css +0 -120
- package/registry/styles/luma/hover-card.css +0 -22
- package/registry/styles/luma/input-group.css +0 -98
- package/registry/styles/luma/input-otp.css +0 -102
- package/registry/styles/luma/input.css +0 -61
- package/registry/styles/luma/item.css +0 -133
- package/registry/styles/luma/kbd.css +0 -22
- package/registry/styles/luma/label.css +0 -74
- package/registry/styles/luma/marker.css +0 -35
- package/registry/styles/luma/menubar.css +0 -48
- package/registry/styles/luma/message-scroller.css +0 -47
- package/registry/styles/luma/message.css +0 -39
- package/registry/styles/luma/native-select.css +0 -80
- package/registry/styles/luma/navigation-menu.css +0 -90
- package/registry/styles/luma/pagination.css +0 -46
- package/registry/styles/luma/popover.css +0 -25
- package/registry/styles/luma/primitives/dialog-shell.css +0 -19
- package/registry/styles/luma/primitives/listbox.css +0 -79
- package/registry/styles/luma/primitives/menu.css +0 -108
- package/registry/styles/luma/primitives/popover.css +0 -16
- package/registry/styles/luma/progress.css +0 -92
- package/registry/styles/luma/questionnaire.css +0 -141
- package/registry/styles/luma/radio.css +0 -48
- package/registry/styles/luma/resizable.css +0 -44
- package/registry/styles/luma/scroll-area.css +0 -30
- package/registry/styles/luma/select.css +0 -80
- package/registry/styles/luma/separator.css +0 -14
- package/registry/styles/luma/sheet.css +0 -74
- package/registry/styles/luma/sidebar.css +0 -211
- package/registry/styles/luma/skeleton.css +0 -7
- package/registry/styles/luma/slider.css +0 -15
- package/registry/styles/luma/spinner.css +0 -35
- package/registry/styles/luma/switch.css +0 -110
- package/registry/styles/luma/table.css +0 -91
- package/registry/styles/luma/tabs.css +0 -133
- package/registry/styles/luma/textarea.css +0 -53
- package/registry/styles/luma/toast.css +0 -62
- package/registry/styles/luma/toggle-group.css +0 -59
- package/registry/styles/luma/toggle.css +0 -128
- package/registry/styles/luma/tooltip.css +0 -35
- package/registry/styles/luma/trace.css +0 -85
- package/registry/styles/lyra/accordion.css +0 -59
- package/registry/styles/lyra/alert-dialog.css +0 -82
- package/registry/styles/lyra/alert.css +0 -98
- package/registry/styles/lyra/aspect-ratio.css +0 -6
- package/registry/styles/lyra/attachment.css +0 -176
- package/registry/styles/lyra/avatar.css +0 -132
- package/registry/styles/lyra/badge.css +0 -112
- package/registry/styles/lyra/breadcrumb.css +0 -62
- package/registry/styles/lyra/bubble.css +0 -147
- package/registry/styles/lyra/button-group.css +0 -62
- package/registry/styles/lyra/button.css +0 -221
- package/registry/styles/lyra/calendar.css +0 -140
- package/registry/styles/lyra/card.css +0 -81
- package/registry/styles/lyra/carousel.css +0 -63
- package/registry/styles/lyra/chart.css +0 -51
- package/registry/styles/lyra/checkbox.css +0 -58
- package/registry/styles/lyra/code-block.css +0 -186
- package/registry/styles/lyra/collapsible.css +0 -50
- package/registry/styles/lyra/combobox.css +0 -59
- package/registry/styles/lyra/command.css +0 -27
- package/registry/styles/lyra/context-menu.css +0 -19
- package/registry/styles/lyra/dialog.css +0 -64
- package/registry/styles/lyra/drawer.css +0 -68
- package/registry/styles/lyra/dropdown-menu.css +0 -8
- package/registry/styles/lyra/empty.css +0 -52
- package/registry/styles/lyra/field.css +0 -120
- package/registry/styles/lyra/hover-card.css +0 -22
- package/registry/styles/lyra/input-group.css +0 -98
- package/registry/styles/lyra/input-otp.css +0 -102
- package/registry/styles/lyra/input.css +0 -62
- package/registry/styles/lyra/item.css +0 -133
- package/registry/styles/lyra/kbd.css +0 -22
- package/registry/styles/lyra/label.css +0 -74
- package/registry/styles/lyra/marker.css +0 -35
- package/registry/styles/lyra/menubar.css +0 -48
- package/registry/styles/lyra/message-scroller.css +0 -47
- package/registry/styles/lyra/message.css +0 -39
- package/registry/styles/lyra/native-select.css +0 -79
- package/registry/styles/lyra/navigation-menu.css +0 -90
- package/registry/styles/lyra/pagination.css +0 -46
- package/registry/styles/lyra/popover.css +0 -25
- package/registry/styles/lyra/primitives/dialog-shell.css +0 -19
- package/registry/styles/lyra/primitives/listbox.css +0 -79
- package/registry/styles/lyra/primitives/menu.css +0 -108
- package/registry/styles/lyra/primitives/popover.css +0 -16
- package/registry/styles/lyra/progress.css +0 -92
- package/registry/styles/lyra/questionnaire.css +0 -141
- package/registry/styles/lyra/radio.css +0 -48
- package/registry/styles/lyra/resizable.css +0 -44
- package/registry/styles/lyra/scroll-area.css +0 -30
- package/registry/styles/lyra/select.css +0 -80
- package/registry/styles/lyra/separator.css +0 -14
- package/registry/styles/lyra/sheet.css +0 -74
- package/registry/styles/lyra/sidebar.css +0 -211
- package/registry/styles/lyra/skeleton.css +0 -7
- package/registry/styles/lyra/slider.css +0 -15
- package/registry/styles/lyra/spinner.css +0 -35
- package/registry/styles/lyra/switch.css +0 -110
- package/registry/styles/lyra/table.css +0 -91
- package/registry/styles/lyra/tabs.css +0 -133
- package/registry/styles/lyra/textarea.css +0 -53
- package/registry/styles/lyra/toast.css +0 -62
- package/registry/styles/lyra/toggle-group.css +0 -48
- package/registry/styles/lyra/toggle.css +0 -126
- package/registry/styles/lyra/tooltip.css +0 -35
- package/registry/styles/lyra/trace.css +0 -85
- package/registry/styles/maia/accordion.css +0 -59
- package/registry/styles/maia/alert-dialog.css +0 -82
- package/registry/styles/maia/alert.css +0 -98
- package/registry/styles/maia/aspect-ratio.css +0 -6
- package/registry/styles/maia/attachment.css +0 -176
- package/registry/styles/maia/avatar.css +0 -132
- package/registry/styles/maia/badge.css +0 -113
- package/registry/styles/maia/breadcrumb.css +0 -62
- package/registry/styles/maia/bubble.css +0 -147
- package/registry/styles/maia/button-group.css +0 -63
- package/registry/styles/maia/button.css +0 -222
- package/registry/styles/maia/calendar.css +0 -140
- package/registry/styles/maia/card.css +0 -81
- package/registry/styles/maia/carousel.css +0 -63
- package/registry/styles/maia/chart.css +0 -51
- package/registry/styles/maia/checkbox.css +0 -58
- package/registry/styles/maia/code-block.css +0 -186
- package/registry/styles/maia/collapsible.css +0 -50
- package/registry/styles/maia/combobox.css +0 -59
- package/registry/styles/maia/command.css +0 -27
- package/registry/styles/maia/context-menu.css +0 -19
- package/registry/styles/maia/dialog.css +0 -64
- package/registry/styles/maia/drawer.css +0 -68
- package/registry/styles/maia/dropdown-menu.css +0 -8
- package/registry/styles/maia/empty.css +0 -52
- package/registry/styles/maia/field.css +0 -120
- package/registry/styles/maia/hover-card.css +0 -22
- package/registry/styles/maia/input-group.css +0 -98
- package/registry/styles/maia/input-otp.css +0 -102
- package/registry/styles/maia/input.css +0 -61
- package/registry/styles/maia/item.css +0 -133
- package/registry/styles/maia/kbd.css +0 -22
- package/registry/styles/maia/label.css +0 -74
- package/registry/styles/maia/marker.css +0 -35
- package/registry/styles/maia/menubar.css +0 -48
- package/registry/styles/maia/message-scroller.css +0 -47
- package/registry/styles/maia/message.css +0 -39
- package/registry/styles/maia/native-select.css +0 -80
- package/registry/styles/maia/navigation-menu.css +0 -90
- package/registry/styles/maia/pagination.css +0 -46
- package/registry/styles/maia/popover.css +0 -25
- package/registry/styles/maia/primitives/dialog-shell.css +0 -19
- package/registry/styles/maia/primitives/listbox.css +0 -79
- package/registry/styles/maia/primitives/menu.css +0 -108
- package/registry/styles/maia/primitives/popover.css +0 -16
- package/registry/styles/maia/progress.css +0 -92
- package/registry/styles/maia/questionnaire.css +0 -141
- package/registry/styles/maia/radio.css +0 -48
- package/registry/styles/maia/resizable.css +0 -44
- package/registry/styles/maia/scroll-area.css +0 -30
- package/registry/styles/maia/select.css +0 -80
- package/registry/styles/maia/separator.css +0 -14
- package/registry/styles/maia/sheet.css +0 -74
- package/registry/styles/maia/sidebar.css +0 -211
- package/registry/styles/maia/skeleton.css +0 -7
- package/registry/styles/maia/slider.css +0 -15
- package/registry/styles/maia/spinner.css +0 -35
- package/registry/styles/maia/switch.css +0 -110
- package/registry/styles/maia/table.css +0 -91
- package/registry/styles/maia/tabs.css +0 -133
- package/registry/styles/maia/textarea.css +0 -53
- package/registry/styles/maia/toast.css +0 -62
- package/registry/styles/maia/toggle-group.css +0 -59
- package/registry/styles/maia/toggle.css +0 -128
- package/registry/styles/maia/tooltip.css +0 -35
- package/registry/styles/maia/trace.css +0 -85
- package/registry/styles/mira/accordion.css +0 -59
- package/registry/styles/mira/alert-dialog.css +0 -82
- package/registry/styles/mira/alert.css +0 -98
- package/registry/styles/mira/aspect-ratio.css +0 -6
- package/registry/styles/mira/attachment.css +0 -176
- package/registry/styles/mira/avatar.css +0 -132
- package/registry/styles/mira/badge.css +0 -116
- package/registry/styles/mira/breadcrumb.css +0 -62
- package/registry/styles/mira/bubble.css +0 -147
- package/registry/styles/mira/button-group.css +0 -63
- package/registry/styles/mira/button.css +0 -222
- package/registry/styles/mira/calendar.css +0 -140
- package/registry/styles/mira/card.css +0 -81
- package/registry/styles/mira/carousel.css +0 -63
- package/registry/styles/mira/chart.css +0 -51
- package/registry/styles/mira/checkbox.css +0 -58
- package/registry/styles/mira/code-block.css +0 -186
- package/registry/styles/mira/collapsible.css +0 -50
- package/registry/styles/mira/combobox.css +0 -59
- package/registry/styles/mira/command.css +0 -27
- package/registry/styles/mira/context-menu.css +0 -19
- package/registry/styles/mira/dialog.css +0 -64
- package/registry/styles/mira/drawer.css +0 -68
- package/registry/styles/mira/dropdown-menu.css +0 -8
- package/registry/styles/mira/empty.css +0 -52
- package/registry/styles/mira/field.css +0 -120
- package/registry/styles/mira/hover-card.css +0 -22
- package/registry/styles/mira/input-group.css +0 -98
- package/registry/styles/mira/input-otp.css +0 -102
- package/registry/styles/mira/input.css +0 -62
- package/registry/styles/mira/item.css +0 -133
- package/registry/styles/mira/kbd.css +0 -22
- package/registry/styles/mira/label.css +0 -74
- package/registry/styles/mira/marker.css +0 -35
- package/registry/styles/mira/menubar.css +0 -48
- package/registry/styles/mira/message-scroller.css +0 -47
- package/registry/styles/mira/message.css +0 -39
- package/registry/styles/mira/native-select.css +0 -80
- package/registry/styles/mira/navigation-menu.css +0 -90
- package/registry/styles/mira/pagination.css +0 -46
- package/registry/styles/mira/popover.css +0 -25
- package/registry/styles/mira/primitives/dialog-shell.css +0 -19
- package/registry/styles/mira/primitives/listbox.css +0 -79
- package/registry/styles/mira/primitives/menu.css +0 -109
- package/registry/styles/mira/primitives/popover.css +0 -16
- package/registry/styles/mira/progress.css +0 -92
- package/registry/styles/mira/questionnaire.css +0 -141
- package/registry/styles/mira/radio.css +0 -48
- package/registry/styles/mira/resizable.css +0 -44
- package/registry/styles/mira/scroll-area.css +0 -30
- package/registry/styles/mira/select.css +0 -80
- package/registry/styles/mira/separator.css +0 -14
- package/registry/styles/mira/sheet.css +0 -74
- package/registry/styles/mira/sidebar.css +0 -211
- package/registry/styles/mira/skeleton.css +0 -7
- package/registry/styles/mira/slider.css +0 -15
- package/registry/styles/mira/spinner.css +0 -35
- package/registry/styles/mira/switch.css +0 -110
- package/registry/styles/mira/table.css +0 -91
- package/registry/styles/mira/tabs.css +0 -133
- package/registry/styles/mira/textarea.css +0 -53
- package/registry/styles/mira/toast.css +0 -62
- package/registry/styles/mira/toggle-group.css +0 -59
- package/registry/styles/mira/toggle.css +0 -128
- package/registry/styles/mira/tooltip.css +0 -35
- package/registry/styles/mira/trace.css +0 -85
- package/registry/styles/nova/accordion.css +0 -59
- package/registry/styles/nova/alert-dialog.css +0 -82
- package/registry/styles/nova/alert.css +0 -98
- package/registry/styles/nova/aspect-ratio.css +0 -6
- package/registry/styles/nova/attachment.css +0 -176
- package/registry/styles/nova/avatar.css +0 -132
- package/registry/styles/nova/badge.css +0 -112
- package/registry/styles/nova/breadcrumb.css +0 -62
- package/registry/styles/nova/bubble.css +0 -147
- package/registry/styles/nova/button-group.css +0 -62
- package/registry/styles/nova/button.css +0 -221
- package/registry/styles/nova/calendar.css +0 -140
- package/registry/styles/nova/card.css +0 -84
- package/registry/styles/nova/carousel.css +0 -55
- package/registry/styles/nova/chart.css +0 -42
- package/registry/styles/nova/checkbox.css +0 -58
- package/registry/styles/nova/code-block.css +0 -186
- package/registry/styles/nova/collapsible.css +0 -50
- package/registry/styles/nova/combobox.css +0 -59
- package/registry/styles/nova/command.css +0 -27
- package/registry/styles/nova/context-menu.css +0 -19
- package/registry/styles/nova/dialog.css +0 -64
- package/registry/styles/nova/drawer.css +0 -68
- package/registry/styles/nova/dropdown-menu.css +0 -8
- package/registry/styles/nova/empty.css +0 -52
- package/registry/styles/nova/field.css +0 -120
- package/registry/styles/nova/hover-card.css +0 -22
- package/registry/styles/nova/input-group.css +0 -98
- package/registry/styles/nova/input-otp.css +0 -102
- package/registry/styles/nova/input.css +0 -61
- package/registry/styles/nova/item.css +0 -133
- package/registry/styles/nova/kbd.css +0 -22
- package/registry/styles/nova/label.css +0 -74
- package/registry/styles/nova/marker.css +0 -35
- package/registry/styles/nova/menubar.css +0 -48
- package/registry/styles/nova/message-scroller.css +0 -47
- package/registry/styles/nova/message.css +0 -39
- package/registry/styles/nova/native-select.css +0 -82
- package/registry/styles/nova/navigation-menu.css +0 -90
- package/registry/styles/nova/pagination.css +0 -46
- package/registry/styles/nova/popover.css +0 -25
- package/registry/styles/nova/primitives/dialog-shell.css +0 -23
- package/registry/styles/nova/primitives/listbox.css +0 -79
- package/registry/styles/nova/primitives/menu.css +0 -108
- package/registry/styles/nova/primitives/popover.css +0 -16
- package/registry/styles/nova/progress.css +0 -92
- package/registry/styles/nova/questionnaire.css +0 -141
- package/registry/styles/nova/radio.css +0 -48
- package/registry/styles/nova/resizable.css +0 -43
- package/registry/styles/nova/scroll-area.css +0 -30
- package/registry/styles/nova/select.css +0 -80
- package/registry/styles/nova/separator.css +0 -14
- package/registry/styles/nova/sheet.css +0 -74
- package/registry/styles/nova/sidebar.css +0 -211
- package/registry/styles/nova/skeleton.css +0 -7
- package/registry/styles/nova/slider.css +0 -15
- package/registry/styles/nova/spinner.css +0 -35
- package/registry/styles/nova/switch.css +0 -110
- package/registry/styles/nova/table.css +0 -91
- package/registry/styles/nova/tabs.css +0 -133
- package/registry/styles/nova/textarea.css +0 -53
- package/registry/styles/nova/toast.css +0 -62
- package/registry/styles/nova/toggle-group.css +0 -48
- package/registry/styles/nova/toggle.css +0 -124
- package/registry/styles/nova/tooltip.css +0 -35
- package/registry/styles/nova/trace.css +0 -85
- package/registry/styles/rhea/accordion.css +0 -59
- package/registry/styles/rhea/alert-dialog.css +0 -82
- package/registry/styles/rhea/alert.css +0 -98
- package/registry/styles/rhea/aspect-ratio.css +0 -6
- package/registry/styles/rhea/attachment.css +0 -176
- package/registry/styles/rhea/avatar.css +0 -132
- package/registry/styles/rhea/badge.css +0 -112
- package/registry/styles/rhea/breadcrumb.css +0 -62
- package/registry/styles/rhea/bubble.css +0 -147
- package/registry/styles/rhea/button-group.css +0 -63
- package/registry/styles/rhea/button.css +0 -222
- package/registry/styles/rhea/calendar.css +0 -140
- package/registry/styles/rhea/card.css +0 -82
- package/registry/styles/rhea/carousel.css +0 -63
- package/registry/styles/rhea/chart.css +0 -51
- package/registry/styles/rhea/checkbox.css +0 -58
- package/registry/styles/rhea/code-block.css +0 -186
- package/registry/styles/rhea/collapsible.css +0 -50
- package/registry/styles/rhea/combobox.css +0 -59
- package/registry/styles/rhea/command.css +0 -27
- package/registry/styles/rhea/context-menu.css +0 -19
- package/registry/styles/rhea/dialog.css +0 -64
- package/registry/styles/rhea/drawer.css +0 -68
- package/registry/styles/rhea/dropdown-menu.css +0 -8
- package/registry/styles/rhea/empty.css +0 -52
- package/registry/styles/rhea/field.css +0 -120
- package/registry/styles/rhea/hover-card.css +0 -22
- package/registry/styles/rhea/input-group.css +0 -98
- package/registry/styles/rhea/input-otp.css +0 -102
- package/registry/styles/rhea/input.css +0 -61
- package/registry/styles/rhea/item.css +0 -133
- package/registry/styles/rhea/kbd.css +0 -22
- package/registry/styles/rhea/label.css +0 -74
- package/registry/styles/rhea/marker.css +0 -35
- package/registry/styles/rhea/menubar.css +0 -48
- package/registry/styles/rhea/message-scroller.css +0 -47
- package/registry/styles/rhea/message.css +0 -39
- package/registry/styles/rhea/native-select.css +0 -80
- package/registry/styles/rhea/navigation-menu.css +0 -90
- package/registry/styles/rhea/pagination.css +0 -46
- package/registry/styles/rhea/popover.css +0 -25
- package/registry/styles/rhea/primitives/dialog-shell.css +0 -19
- package/registry/styles/rhea/primitives/listbox.css +0 -79
- package/registry/styles/rhea/primitives/menu.css +0 -109
- package/registry/styles/rhea/primitives/popover.css +0 -16
- package/registry/styles/rhea/progress.css +0 -92
- package/registry/styles/rhea/questionnaire.css +0 -141
- package/registry/styles/rhea/radio.css +0 -48
- package/registry/styles/rhea/resizable.css +0 -44
- package/registry/styles/rhea/scroll-area.css +0 -30
- package/registry/styles/rhea/select.css +0 -80
- package/registry/styles/rhea/separator.css +0 -14
- package/registry/styles/rhea/sheet.css +0 -74
- package/registry/styles/rhea/sidebar.css +0 -211
- package/registry/styles/rhea/skeleton.css +0 -7
- package/registry/styles/rhea/slider.css +0 -15
- package/registry/styles/rhea/spinner.css +0 -35
- package/registry/styles/rhea/switch.css +0 -110
- package/registry/styles/rhea/table.css +0 -91
- package/registry/styles/rhea/tabs.css +0 -133
- package/registry/styles/rhea/textarea.css +0 -53
- package/registry/styles/rhea/toast.css +0 -62
- package/registry/styles/rhea/toggle-group.css +0 -59
- package/registry/styles/rhea/toggle.css +0 -128
- package/registry/styles/rhea/tooltip.css +0 -35
- package/registry/styles/rhea/trace.css +0 -85
- package/registry/styles/sera/accordion.css +0 -59
- package/registry/styles/sera/alert-dialog.css +0 -84
- package/registry/styles/sera/alert.css +0 -98
- package/registry/styles/sera/aspect-ratio.css +0 -6
- package/registry/styles/sera/attachment.css +0 -176
- package/registry/styles/sera/avatar.css +0 -132
- package/registry/styles/sera/badge.css +0 -143
- package/registry/styles/sera/breadcrumb.css +0 -62
- package/registry/styles/sera/bubble.css +0 -147
- package/registry/styles/sera/button-group.css +0 -63
- package/registry/styles/sera/button.css +0 -222
- package/registry/styles/sera/calendar.css +0 -148
- package/registry/styles/sera/card.css +0 -84
- package/registry/styles/sera/carousel.css +0 -63
- package/registry/styles/sera/chart.css +0 -51
- package/registry/styles/sera/checkbox.css +0 -58
- package/registry/styles/sera/code-block.css +0 -186
- package/registry/styles/sera/collapsible.css +0 -50
- package/registry/styles/sera/combobox.css +0 -60
- package/registry/styles/sera/command.css +0 -27
- package/registry/styles/sera/context-menu.css +0 -19
- package/registry/styles/sera/dialog.css +0 -67
- package/registry/styles/sera/drawer.css +0 -70
- package/registry/styles/sera/dropdown-menu.css +0 -8
- package/registry/styles/sera/empty.css +0 -52
- package/registry/styles/sera/field.css +0 -120
- package/registry/styles/sera/hover-card.css +0 -22
- package/registry/styles/sera/input-group.css +0 -99
- package/registry/styles/sera/input-otp.css +0 -103
- package/registry/styles/sera/input.css +0 -62
- package/registry/styles/sera/item.css +0 -133
- package/registry/styles/sera/kbd.css +0 -22
- package/registry/styles/sera/label.css +0 -74
- package/registry/styles/sera/marker.css +0 -35
- package/registry/styles/sera/menubar.css +0 -48
- package/registry/styles/sera/message-scroller.css +0 -47
- package/registry/styles/sera/message.css +0 -39
- package/registry/styles/sera/native-select.css +0 -81
- package/registry/styles/sera/navigation-menu.css +0 -90
- package/registry/styles/sera/pagination.css +0 -46
- package/registry/styles/sera/popover.css +0 -25
- package/registry/styles/sera/primitives/dialog-shell.css +0 -19
- package/registry/styles/sera/primitives/listbox.css +0 -79
- package/registry/styles/sera/primitives/menu.css +0 -108
- package/registry/styles/sera/primitives/popover.css +0 -16
- package/registry/styles/sera/progress.css +0 -92
- package/registry/styles/sera/questionnaire.css +0 -147
- package/registry/styles/sera/radio.css +0 -48
- package/registry/styles/sera/resizable.css +0 -44
- package/registry/styles/sera/scroll-area.css +0 -30
- package/registry/styles/sera/select.css +0 -81
- package/registry/styles/sera/separator.css +0 -14
- package/registry/styles/sera/sheet.css +0 -76
- package/registry/styles/sera/sidebar.css +0 -217
- package/registry/styles/sera/skeleton.css +0 -7
- package/registry/styles/sera/slider.css +0 -15
- package/registry/styles/sera/spinner.css +0 -35
- package/registry/styles/sera/switch.css +0 -111
- package/registry/styles/sera/table.css +0 -92
- package/registry/styles/sera/tabs.css +0 -133
- package/registry/styles/sera/textarea.css +0 -54
- package/registry/styles/sera/toast.css +0 -64
- package/registry/styles/sera/toggle-group.css +0 -58
- package/registry/styles/sera/toggle.css +0 -128
- package/registry/styles/sera/tooltip.css +0 -35
- package/registry/styles/sera/trace.css +0 -87
- package/registry/styles/vega/accordion.css +0 -59
- package/registry/styles/vega/alert-dialog.css +0 -82
- package/registry/styles/vega/alert.css +0 -98
- package/registry/styles/vega/aspect-ratio.css +0 -6
- package/registry/styles/vega/attachment.css +0 -176
- package/registry/styles/vega/avatar.css +0 -132
- package/registry/styles/vega/badge.css +0 -112
- package/registry/styles/vega/breadcrumb.css +0 -62
- package/registry/styles/vega/bubble.css +0 -147
- package/registry/styles/vega/button-group.css +0 -63
- package/registry/styles/vega/button.css +0 -222
- package/registry/styles/vega/calendar.css +0 -140
- package/registry/styles/vega/card.css +0 -82
- package/registry/styles/vega/carousel.css +0 -63
- package/registry/styles/vega/chart.css +0 -51
- package/registry/styles/vega/checkbox.css +0 -59
- package/registry/styles/vega/code-block.css +0 -186
- package/registry/styles/vega/collapsible.css +0 -50
- package/registry/styles/vega/combobox.css +0 -59
- package/registry/styles/vega/command.css +0 -27
- package/registry/styles/vega/context-menu.css +0 -19
- package/registry/styles/vega/dialog.css +0 -64
- package/registry/styles/vega/drawer.css +0 -68
- package/registry/styles/vega/dropdown-menu.css +0 -8
- package/registry/styles/vega/empty.css +0 -52
- package/registry/styles/vega/field.css +0 -120
- package/registry/styles/vega/hover-card.css +0 -22
- package/registry/styles/vega/input-group.css +0 -98
- package/registry/styles/vega/input-otp.css +0 -102
- package/registry/styles/vega/input.css +0 -62
- package/registry/styles/vega/item.css +0 -133
- package/registry/styles/vega/kbd.css +0 -22
- package/registry/styles/vega/label.css +0 -74
- package/registry/styles/vega/marker.css +0 -35
- package/registry/styles/vega/menubar.css +0 -48
- package/registry/styles/vega/message-scroller.css +0 -47
- package/registry/styles/vega/message.css +0 -39
- package/registry/styles/vega/native-select.css +0 -81
- package/registry/styles/vega/navigation-menu.css +0 -90
- package/registry/styles/vega/pagination.css +0 -46
- package/registry/styles/vega/popover.css +0 -25
- package/registry/styles/vega/primitives/dialog-shell.css +0 -19
- package/registry/styles/vega/primitives/listbox.css +0 -79
- package/registry/styles/vega/primitives/menu.css +0 -108
- package/registry/styles/vega/primitives/popover.css +0 -16
- package/registry/styles/vega/progress.css +0 -92
- package/registry/styles/vega/questionnaire.css +0 -141
- package/registry/styles/vega/radio.css +0 -48
- package/registry/styles/vega/resizable.css +0 -44
- package/registry/styles/vega/scroll-area.css +0 -30
- package/registry/styles/vega/select.css +0 -80
- package/registry/styles/vega/separator.css +0 -14
- package/registry/styles/vega/sheet.css +0 -74
- package/registry/styles/vega/sidebar.css +0 -211
- package/registry/styles/vega/skeleton.css +0 -7
- package/registry/styles/vega/slider.css +0 -15
- package/registry/styles/vega/spinner.css +0 -35
- package/registry/styles/vega/switch.css +0 -111
- package/registry/styles/vega/table.css +0 -91
- package/registry/styles/vega/tabs.css +0 -133
- package/registry/styles/vega/textarea.css +0 -54
- package/registry/styles/vega/toast.css +0 -62
- package/registry/styles/vega/toggle-group.css +0 -59
- package/registry/styles/vega/toggle.css +0 -128
- package/registry/styles/vega/tooltip.css +0 -35
- package/registry/styles/vega/trace.css +0 -85
- package/registry/tokens.css +0 -125
- package/registry/utilities.css +0 -14
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { emit, init, isRTL, on, onDocument } from "./core.js";
|
|
4
|
-
|
|
5
|
-
const HANDLE_SELECTOR = "[data-slot='handle'][role='separator']";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {object} ResizeParts
|
|
9
|
-
* @property {HTMLElement} root
|
|
10
|
-
* @property {HTMLElement} first
|
|
11
|
-
* @property {HTMLElement} second
|
|
12
|
-
* @property {"x" | "y"} axis
|
|
13
|
-
* @property {boolean} rtl
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {object} ResizeState
|
|
18
|
-
* @property {number} percent
|
|
19
|
-
* @property {number} min
|
|
20
|
-
* @property {number} max
|
|
21
|
-
* @property {boolean} active
|
|
22
|
-
* @property {boolean} moved
|
|
23
|
-
* @property {number} pointerId
|
|
24
|
-
* @property {string} pointerType
|
|
25
|
-
* @property {number} startX
|
|
26
|
-
* @property {number} startY
|
|
27
|
-
* @property {number} startPercent
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/** @type {WeakMap<HTMLElement, ResizeState>} */
|
|
31
|
-
const states = new WeakMap();
|
|
32
|
-
|
|
33
|
-
/** @type {HTMLElement | null} */
|
|
34
|
-
let activeHandle = null;
|
|
35
|
-
|
|
36
|
-
/** @param {number} value @param {number} min @param {number} max */
|
|
37
|
-
function clamp(value, min, max) {
|
|
38
|
-
return Math.min(max, Math.max(min, value));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** @param {number} value */
|
|
42
|
-
function round(value) {
|
|
43
|
-
return Math.round(value * 100) / 100;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param {HTMLElement} handle
|
|
48
|
-
* @returns {ResizeParts | null}
|
|
49
|
-
*/
|
|
50
|
-
function partsFor(handle) {
|
|
51
|
-
const root = handle.closest(".resizable");
|
|
52
|
-
const first = handle.previousElementSibling;
|
|
53
|
-
const second = handle.nextElementSibling;
|
|
54
|
-
if (
|
|
55
|
-
!(root instanceof HTMLElement) ||
|
|
56
|
-
!(first instanceof HTMLElement) ||
|
|
57
|
-
!(second instanceof HTMLElement) ||
|
|
58
|
-
!first.matches(".resizable-panel") ||
|
|
59
|
-
!second.matches(".resizable-panel")
|
|
60
|
-
) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const axis =
|
|
65
|
-
handle.getAttribute("aria-orientation") === "horizontal" ? "y" : "x";
|
|
66
|
-
return {
|
|
67
|
-
root,
|
|
68
|
-
first,
|
|
69
|
-
second,
|
|
70
|
-
axis,
|
|
71
|
-
rtl: axis === "x" && isRTL(handle)
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @param {HTMLElement} handle
|
|
77
|
-
* @param {ResizeParts} parts
|
|
78
|
-
*/
|
|
79
|
-
function readPercent(handle, parts) {
|
|
80
|
-
const first = Number.parseFloat(
|
|
81
|
-
getComputedStyle(parts.first).getPropertyValue("--panel-size")
|
|
82
|
-
);
|
|
83
|
-
const second = Number.parseFloat(
|
|
84
|
-
getComputedStyle(parts.second).getPropertyValue("--panel-size")
|
|
85
|
-
);
|
|
86
|
-
const firstSize = Number.isFinite(first) ? first : 1;
|
|
87
|
-
const secondSize = Number.isFinite(second) ? second : 1;
|
|
88
|
-
const total = firstSize + secondSize;
|
|
89
|
-
const percent = total > 0 ? (firstSize / total) * 100 : 50;
|
|
90
|
-
|
|
91
|
-
const min = Number(handle.getAttribute("aria-valuemin") ?? 0);
|
|
92
|
-
const max = Number(handle.getAttribute("aria-valuemax") ?? 100);
|
|
93
|
-
const safeMin = clamp(Number.isFinite(min) ? min : 0, 0, 100);
|
|
94
|
-
const safeMax = clamp(Number.isFinite(max) ? max : 100, safeMin, 100);
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
percent: clamp(percent, safeMin, safeMax),
|
|
98
|
-
min: safeMin,
|
|
99
|
-
max: safeMax
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @param {HTMLElement} handle
|
|
105
|
-
* @param {ResizeParts} parts
|
|
106
|
-
* @param {number} percent
|
|
107
|
-
* @param {boolean} notify
|
|
108
|
-
*/
|
|
109
|
-
function setPercent(handle, parts, percent, notify) {
|
|
110
|
-
const first = clamp(percent, 0, 100);
|
|
111
|
-
const second = 100 - first;
|
|
112
|
-
parts.first.style.setProperty("--panel-size", String(round(first)));
|
|
113
|
-
parts.second.style.setProperty("--panel-size", String(round(second)));
|
|
114
|
-
handle.setAttribute("aria-valuenow", String(Math.round(first)));
|
|
115
|
-
|
|
116
|
-
if (notify) {
|
|
117
|
-
emit(parts.root, "change", {
|
|
118
|
-
sizes: [round(first), round(second)]
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @param {HTMLElement} handle
|
|
125
|
-
* @returns {ResizeState | null}
|
|
126
|
-
*/
|
|
127
|
-
function ensure(handle) {
|
|
128
|
-
const parts = partsFor(handle);
|
|
129
|
-
if (!parts) return null;
|
|
130
|
-
|
|
131
|
-
const measured = readPercent(handle, parts);
|
|
132
|
-
const state = states.get(handle) ?? {
|
|
133
|
-
percent: measured.percent,
|
|
134
|
-
min: measured.min,
|
|
135
|
-
max: measured.max,
|
|
136
|
-
active: false,
|
|
137
|
-
moved: false,
|
|
138
|
-
pointerId: -1,
|
|
139
|
-
pointerType: "",
|
|
140
|
-
startX: 0,
|
|
141
|
-
startY: 0,
|
|
142
|
-
startPercent: measured.percent
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
state.percent = clamp(measured.percent, measured.min, measured.max);
|
|
146
|
-
state.min = measured.min;
|
|
147
|
-
state.max = measured.max;
|
|
148
|
-
if (!state.active) state.startPercent = state.percent;
|
|
149
|
-
|
|
150
|
-
handle.setAttribute("aria-valuemin", String(measured.min));
|
|
151
|
-
handle.setAttribute("aria-valuemax", String(measured.max));
|
|
152
|
-
|
|
153
|
-
states.set(handle, state);
|
|
154
|
-
setPercent(handle, parts, state.percent, false);
|
|
155
|
-
return state;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @param {ResizeState} state
|
|
160
|
-
* @param {PointerEvent} event
|
|
161
|
-
*/
|
|
162
|
-
function samePointer(state, event) {
|
|
163
|
-
return (
|
|
164
|
-
event.pointerId === state.pointerId ||
|
|
165
|
-
// There is only one pen, but it may receive a new pointerId each time it
|
|
166
|
-
// comes back into range.
|
|
167
|
-
(event.pointerType === "pen" && state.pointerType === "pen")
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @param {HTMLElement} handle
|
|
173
|
-
* @param {ResizeState} state
|
|
174
|
-
* @param {ResizeParts} parts
|
|
175
|
-
* @param {number} clientX
|
|
176
|
-
* @param {number} clientY
|
|
177
|
-
*/
|
|
178
|
-
function moveTo(handle, state, parts, clientX, clientY) {
|
|
179
|
-
const delta =
|
|
180
|
-
parts.axis === "x"
|
|
181
|
-
? (clientX - state.startX) * (parts.rtl ? -1 : 1)
|
|
182
|
-
: clientY - state.startY;
|
|
183
|
-
const size =
|
|
184
|
-
parts.axis === "x"
|
|
185
|
-
? parts.root.clientWidth - handle.offsetWidth
|
|
186
|
-
: parts.root.clientHeight - handle.offsetHeight;
|
|
187
|
-
if (size <= 0) return;
|
|
188
|
-
|
|
189
|
-
if (clientX !== state.startX || clientY !== state.startY) {
|
|
190
|
-
state.moved = true;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
state.percent = clamp(
|
|
194
|
-
state.startPercent + (delta / size) * 100,
|
|
195
|
-
state.min,
|
|
196
|
-
state.max
|
|
197
|
-
);
|
|
198
|
-
setPercent(handle, parts, state.percent, false);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @param {HTMLElement} handle
|
|
203
|
-
* @param {boolean} notify
|
|
204
|
-
*/
|
|
205
|
-
function finish(handle, notify) {
|
|
206
|
-
const state = states.get(handle);
|
|
207
|
-
if (!state || !state.active) return false;
|
|
208
|
-
|
|
209
|
-
state.active = false;
|
|
210
|
-
if (activeHandle === handle) activeHandle = null;
|
|
211
|
-
|
|
212
|
-
const changed = Math.abs(state.percent - state.startPercent) >= 0.005;
|
|
213
|
-
if (state.moved && document.activeElement === handle) {
|
|
214
|
-
handle.blur();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (handle.hasPointerCapture(state.pointerId)) {
|
|
218
|
-
try {
|
|
219
|
-
handle.releasePointerCapture(state.pointerId);
|
|
220
|
-
} catch {
|
|
221
|
-
// The browser already released capture for this pointer.
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
state.startPercent = state.percent;
|
|
226
|
-
if (notify && changed) {
|
|
227
|
-
const parts = partsFor(handle);
|
|
228
|
-
if (parts) {
|
|
229
|
-
emit(parts.root, "change", {
|
|
230
|
-
sizes: [round(state.percent), round(100 - state.percent)]
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
on("pointerdown", HANDLE_SELECTOR, (event, element) => {
|
|
238
|
-
if (!(event instanceof PointerEvent) || !(element instanceof HTMLElement)) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
if (event.defaultPrevented) return;
|
|
242
|
-
if (event.pointerType === "mouse" && event.button > 0) return;
|
|
243
|
-
|
|
244
|
-
if (activeHandle) {
|
|
245
|
-
const activeState = states.get(activeHandle);
|
|
246
|
-
if (activeState?.active) {
|
|
247
|
-
// A second press from the same pointer means its release was missed;
|
|
248
|
-
// commit that drag instead of starting a new one. Other pointers are
|
|
249
|
-
// ignored so the active drag is never orphaned.
|
|
250
|
-
if (samePointer(activeState, event)) finish(activeHandle, true);
|
|
251
|
-
event.preventDefault();
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
activeHandle = null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const state = ensure(element);
|
|
258
|
-
if (!state) return;
|
|
259
|
-
|
|
260
|
-
state.active = true;
|
|
261
|
-
state.moved = false;
|
|
262
|
-
state.pointerId = event.pointerId;
|
|
263
|
-
state.pointerType = event.pointerType;
|
|
264
|
-
state.startX = event.clientX;
|
|
265
|
-
state.startY = event.clientY;
|
|
266
|
-
state.startPercent = state.percent;
|
|
267
|
-
activeHandle = element;
|
|
268
|
-
|
|
269
|
-
const focusOptions = /** @type {FocusOptions & { focusVisible?: boolean }} */ ({
|
|
270
|
-
focusVisible: false,
|
|
271
|
-
preventScroll: true
|
|
272
|
-
});
|
|
273
|
-
element.focus(focusOptions);
|
|
274
|
-
|
|
275
|
-
event.preventDefault();
|
|
276
|
-
return true;
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
onDocument("pointermove", (event) => {
|
|
280
|
-
if (!(event instanceof PointerEvent)) return;
|
|
281
|
-
if (event.defaultPrevented) return;
|
|
282
|
-
if (!activeHandle) return;
|
|
283
|
-
|
|
284
|
-
const handle = activeHandle;
|
|
285
|
-
const state = states.get(handle);
|
|
286
|
-
if (!state?.active) {
|
|
287
|
-
activeHandle = null;
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (!samePointer(state, event)) return;
|
|
291
|
-
|
|
292
|
-
// A release outside this document (for example over a cross-origin iframe)
|
|
293
|
-
// may produce a later hover instead of "pointerup". Commit what was last
|
|
294
|
-
// previewed rather than treat the hover position as movement.
|
|
295
|
-
if (event.buttons === 0) {
|
|
296
|
-
finish(handle, true);
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const parts = partsFor(handle);
|
|
301
|
-
if (!parts) {
|
|
302
|
-
finish(handle, true);
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// Delay capture until the pointer actually moves. Capturing on press would
|
|
307
|
-
// prevent a plain click from reaching the handle.
|
|
308
|
-
if (!handle.hasPointerCapture(event.pointerId)) {
|
|
309
|
-
try {
|
|
310
|
-
handle.setPointerCapture(event.pointerId);
|
|
311
|
-
} catch {
|
|
312
|
-
// The pointer may already be gone; the next end event still finishes.
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
moveTo(handle, state, parts, event.clientX, event.clientY);
|
|
317
|
-
return true;
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
onDocument("pointerup", (event) => {
|
|
321
|
-
if (!(event instanceof PointerEvent)) return;
|
|
322
|
-
if (event.defaultPrevented) return;
|
|
323
|
-
if (event.pointerType === "mouse" && event.button > 0) return;
|
|
324
|
-
if (!activeHandle) return;
|
|
325
|
-
|
|
326
|
-
const handle = activeHandle;
|
|
327
|
-
const state = states.get(handle);
|
|
328
|
-
if (!state?.active) {
|
|
329
|
-
activeHandle = null;
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
if (!samePointer(state, event)) return;
|
|
333
|
-
|
|
334
|
-
const parts = partsFor(handle);
|
|
335
|
-
if (parts) moveTo(handle, state, parts, event.clientX, event.clientY);
|
|
336
|
-
finish(handle, true);
|
|
337
|
-
event.preventDefault();
|
|
338
|
-
return true;
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
onDocument("pointercancel", (event) => {
|
|
342
|
-
if (!(event instanceof PointerEvent)) return;
|
|
343
|
-
if (!activeHandle) return;
|
|
344
|
-
|
|
345
|
-
const handle = activeHandle;
|
|
346
|
-
const state = states.get(handle);
|
|
347
|
-
if (!state?.active) {
|
|
348
|
-
activeHandle = null;
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (!samePointer(state, event)) return;
|
|
352
|
-
|
|
353
|
-
finish(handle, true);
|
|
354
|
-
return true;
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
onDocument("lostpointercapture", (event) => {
|
|
358
|
-
// When another element takes the pointer, the browser releases capture from
|
|
359
|
-
// the handle. Finish the drag so the layout cannot get stuck mid-gesture.
|
|
360
|
-
if (!(event instanceof PointerEvent) || !activeHandle) return;
|
|
361
|
-
if (event.target !== activeHandle) return;
|
|
362
|
-
|
|
363
|
-
const handle = activeHandle;
|
|
364
|
-
const state = states.get(handle);
|
|
365
|
-
if (!state?.active) {
|
|
366
|
-
activeHandle = null;
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (!samePointer(state, event)) return;
|
|
370
|
-
|
|
371
|
-
finish(handle, true);
|
|
372
|
-
return true;
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
onDocument("contextmenu", (event) => {
|
|
376
|
-
if (!(event instanceof MouseEvent) || !activeHandle) return;
|
|
377
|
-
|
|
378
|
-
const handle = activeHandle;
|
|
379
|
-
const state = states.get(handle);
|
|
380
|
-
if (!state?.active) {
|
|
381
|
-
activeHandle = null;
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
const parts = partsFor(handle);
|
|
386
|
-
if (parts) moveTo(handle, state, parts, event.clientX, event.clientY);
|
|
387
|
-
finish(handle, true);
|
|
388
|
-
event.preventDefault();
|
|
389
|
-
return true;
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
on("keydown", HANDLE_SELECTOR, (event, element) => {
|
|
393
|
-
if (!(event instanceof KeyboardEvent) || !(element instanceof HTMLElement)) {
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
if (event.defaultPrevented || event.target !== element) return;
|
|
397
|
-
|
|
398
|
-
const state = ensure(element);
|
|
399
|
-
if (!state || state.active) return;
|
|
400
|
-
const parts = partsFor(element);
|
|
401
|
-
if (!parts) return;
|
|
402
|
-
|
|
403
|
-
const step = event.shiftKey ? 10 : 5;
|
|
404
|
-
const previous = state.percent;
|
|
405
|
-
let percent = state.percent;
|
|
406
|
-
|
|
407
|
-
if (event.key === "Home") {
|
|
408
|
-
percent = state.min;
|
|
409
|
-
} else if (event.key === "End") {
|
|
410
|
-
percent = state.max;
|
|
411
|
-
} else {
|
|
412
|
-
const horizontal = parts.axis === "x";
|
|
413
|
-
const positive = horizontal
|
|
414
|
-
? event.key === (parts.rtl ? "ArrowLeft" : "ArrowRight")
|
|
415
|
-
: event.key === "ArrowDown";
|
|
416
|
-
const negative = horizontal
|
|
417
|
-
? event.key === (parts.rtl ? "ArrowRight" : "ArrowLeft")
|
|
418
|
-
: event.key === "ArrowUp";
|
|
419
|
-
if (!positive && !negative) return;
|
|
420
|
-
percent = clamp(
|
|
421
|
-
state.percent + (positive ? step : -step),
|
|
422
|
-
state.min,
|
|
423
|
-
state.max
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
event.preventDefault();
|
|
428
|
-
if (percent === previous) return true;
|
|
429
|
-
|
|
430
|
-
state.percent = percent;
|
|
431
|
-
setPercent(element, parts, percent, true);
|
|
432
|
-
return true;
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
on("focusin", HANDLE_SELECTOR, (_event, element) => {
|
|
436
|
-
if (element instanceof HTMLElement) ensure(element);
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Syncs every handle under a root with its panel sizes and constraints. The
|
|
441
|
-
* entry module calls this for the initial document; consumers can call it for
|
|
442
|
-
* a late-mounted subtree.
|
|
443
|
-
* @param {Document | Element} [root]
|
|
444
|
-
*/
|
|
445
|
-
export function mount(root) {
|
|
446
|
-
if (typeof document === "undefined") return;
|
|
447
|
-
const scope = root ?? document;
|
|
448
|
-
for (const handle of scope.querySelectorAll(HANDLE_SELECTOR)) {
|
|
449
|
-
if (handle instanceof HTMLElement) ensure(handle);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
init();
|
|
454
|
-
|
|
455
|
-
if (typeof document !== "undefined") {
|
|
456
|
-
if (document.readyState === "loading") {
|
|
457
|
-
document.addEventListener("DOMContentLoaded", () => mount(document), {
|
|
458
|
-
once: true
|
|
459
|
-
});
|
|
460
|
-
} else {
|
|
461
|
-
mount(document);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
emit,
|
|
5
|
-
init,
|
|
6
|
-
on,
|
|
7
|
-
onDocument,
|
|
8
|
-
panelFor,
|
|
9
|
-
typeaheadTarget
|
|
10
|
-
} from "./core.js";
|
|
11
|
-
import {
|
|
12
|
-
firstOption,
|
|
13
|
-
highlight,
|
|
14
|
-
lastOption,
|
|
15
|
-
listboxIn,
|
|
16
|
-
moveHighlight,
|
|
17
|
-
resetFilter,
|
|
18
|
-
selectOption,
|
|
19
|
-
selectedOptions,
|
|
20
|
-
visibleOptions
|
|
21
|
-
} from "./listbox.js";
|
|
22
|
-
|
|
23
|
-
/** @param {HTMLElement} control */
|
|
24
|
-
function rootOf(control) {
|
|
25
|
-
return control.closest(".select") ?? control.parentElement ?? control;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** @param {HTMLElement} control */
|
|
29
|
-
function parts(control) {
|
|
30
|
-
const panel = panelFor(control);
|
|
31
|
-
const listbox = panel ? listboxIn(panel) : null;
|
|
32
|
-
return { panel, listbox };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @param {HTMLElement} control */
|
|
36
|
-
function isExpanded(control) {
|
|
37
|
-
return control.getAttribute("aria-expanded") === "true";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** @param {HTMLElement} control @param {boolean} open */
|
|
41
|
-
function setExpanded(control, open) {
|
|
42
|
-
const { panel } = parts(control);
|
|
43
|
-
control.setAttribute("aria-expanded", String(open));
|
|
44
|
-
if (panel) panel.setAttribute("aria-hidden", String(!open));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** @param {HTMLElement} control */
|
|
48
|
-
function openSelect(control) {
|
|
49
|
-
const { panel, listbox } = parts(control);
|
|
50
|
-
if (!panel || !listbox) return;
|
|
51
|
-
|
|
52
|
-
resetFilter(listbox);
|
|
53
|
-
setExpanded(control, true);
|
|
54
|
-
|
|
55
|
-
const selected = selectedOptions(listbox)[0] ?? firstOption(listbox);
|
|
56
|
-
highlight(listbox, selected, control);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** @param {HTMLElement} control @param {boolean} focusTrigger */
|
|
60
|
-
function closeSelect(control, focusTrigger) {
|
|
61
|
-
const { listbox } = parts(control);
|
|
62
|
-
setExpanded(control, false);
|
|
63
|
-
if (listbox) highlight(listbox, null, control);
|
|
64
|
-
if (focusTrigger) control.focus();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** @param {HTMLElement} control @param {Element} option */
|
|
68
|
-
function choose(control, option) {
|
|
69
|
-
const { listbox } = parts(control);
|
|
70
|
-
if (!listbox) return;
|
|
71
|
-
|
|
72
|
-
const values = selectOption(listbox, option, false);
|
|
73
|
-
const value = values[0] ?? "";
|
|
74
|
-
const root = rootOf(control);
|
|
75
|
-
const valueSlot = root.querySelector("[data-slot='value']");
|
|
76
|
-
if (valueSlot instanceof HTMLElement) {
|
|
77
|
-
valueSlot.textContent = value;
|
|
78
|
-
valueSlot.removeAttribute("data-placeholder");
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const hidden = root.querySelector("input[data-slot='input']");
|
|
82
|
-
if (hidden instanceof HTMLInputElement) hidden.value = value;
|
|
83
|
-
|
|
84
|
-
emit(root, "change", { value });
|
|
85
|
-
closeSelect(control, true);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
on("click", ".select [role='combobox']", (event, target) => {
|
|
89
|
-
if (!(target instanceof HTMLElement)) return;
|
|
90
|
-
if (isExpanded(target)) {
|
|
91
|
-
closeSelect(target, true);
|
|
92
|
-
} else {
|
|
93
|
-
openSelect(target);
|
|
94
|
-
}
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
return true;
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
on("click", ".select [role='option']", (event, target) => {
|
|
100
|
-
if (!(target instanceof HTMLElement) || target.getAttribute("aria-disabled") === "true") {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const control = target.closest(".select")?.querySelector("[role='combobox']");
|
|
104
|
-
if (control instanceof HTMLElement) choose(control, target);
|
|
105
|
-
event.preventDefault();
|
|
106
|
-
return true;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
on("keydown", ".select [role='combobox']", (event, target) => {
|
|
110
|
-
if (!(event instanceof KeyboardEvent) || !(target instanceof HTMLElement)) return;
|
|
111
|
-
const { listbox } = parts(target);
|
|
112
|
-
if (!listbox) return;
|
|
113
|
-
const expanded = isExpanded(target);
|
|
114
|
-
|
|
115
|
-
if (event.key === "Escape") {
|
|
116
|
-
if (!expanded) return;
|
|
117
|
-
closeSelect(target, true);
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!expanded) {
|
|
123
|
-
const opens =
|
|
124
|
-
event.key === "ArrowDown" ||
|
|
125
|
-
event.key === "ArrowUp" ||
|
|
126
|
-
event.key === "Enter" ||
|
|
127
|
-
event.key === " ";
|
|
128
|
-
if (opens) {
|
|
129
|
-
openSelect(target);
|
|
130
|
-
if (event.key === "ArrowUp") {
|
|
131
|
-
highlight(listbox, lastOption(listbox), target);
|
|
132
|
-
}
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
138
|
-
openSelect(target);
|
|
139
|
-
const match = typeaheadTarget(listbox, event.key, visibleOptions(listbox), null);
|
|
140
|
-
if (match) highlight(listbox, match, target);
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
148
|
-
const next = moveHighlight(listbox, event.key === "ArrowDown" ? 1 : -1);
|
|
149
|
-
if (next) highlight(listbox, next, target);
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (event.key === "Home" || event.key === "End") {
|
|
155
|
-
highlight(listbox, event.key === "Home" ? firstOption(listbox) : lastOption(listbox), target);
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
161
|
-
const option = listbox.querySelector("[data-highlighted]");
|
|
162
|
-
if (option instanceof HTMLElement) choose(target, option);
|
|
163
|
-
event.preventDefault();
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (event.key === "Tab") {
|
|
168
|
-
closeSelect(target, false);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
173
|
-
const current = listbox.querySelector("[data-highlighted]");
|
|
174
|
-
const match = typeaheadTarget(
|
|
175
|
-
listbox,
|
|
176
|
-
event.key,
|
|
177
|
-
visibleOptions(listbox),
|
|
178
|
-
current instanceof Element ? current : null
|
|
179
|
-
);
|
|
180
|
-
if (match) highlight(listbox, match, target);
|
|
181
|
-
event.preventDefault();
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}, 25);
|
|
185
|
-
|
|
186
|
-
onDocument("pointerdown", (event) => {
|
|
187
|
-
if (!(event.target instanceof Node)) return;
|
|
188
|
-
for (const control of document.querySelectorAll(".select [role='combobox']")) {
|
|
189
|
-
if (!(control instanceof HTMLElement) || !isExpanded(control)) continue;
|
|
190
|
-
const root = rootOf(control);
|
|
191
|
-
if (root.contains(event.target)) continue;
|
|
192
|
-
closeSelect(control, false);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
init();
|