loseta 0.19.0 → 0.21.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 +91 -20
- package/dist/cli.js +69 -16
- package/dist/cli.js.map +1 -1
- package/dist/colors.d.ts +9 -0
- package/dist/colors.js +25 -0
- package/dist/colors.js.map +1 -0
- 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/command.d.ts +45 -0
- package/dist/command.js +72 -0
- package/dist/command.js.map +1 -0
- package/dist/commands/add.d.ts +9 -1
- package/dist/commands/add.js +190 -62
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/init.d.ts +9 -1
- package/dist/commands/init.js +72 -29
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts +9 -1
- package/dist/commands/list.js +44 -5
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/style.d.ts +10 -1
- package/dist/commands/style.js +60 -12
- 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/prompts.d.ts +35 -0
- package/dist/prompts.js +105 -0
- package/dist/prompts.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-selection.d.ts +1 -1
- 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/ui.js +1 -1
- package/dist/ui.js.map +1 -1
- 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 +9 -9
- 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
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# loseta
|
|
2
2
|
|
|
3
|
-
The CLI and registry for [loseta](https://github.com/vladiantio/loseta).
|
|
3
|
+
The CLI and authored registry for [loseta](https://github.com/vladiantio/loseta).
|
|
4
|
+
|
|
5
|
+
The registry is served remotely. The npm package ships the CLI and its runtime
|
|
6
|
+
dependencies, not the registry files.
|
|
4
7
|
|
|
5
8
|
```bash
|
|
6
9
|
npx loseta init
|
|
@@ -13,6 +16,7 @@ npx loseta add button card field
|
|
|
13
16
|
| --- | --- |
|
|
14
17
|
| `loseta init` | Create `loseta.json`, install the foundation files and generate `index.css`. |
|
|
15
18
|
| `loseta add <items...>` | Install components, their registry dependencies and behavior modules. |
|
|
19
|
+
| `loseta add <url>` | Install one public item payload from a URL. |
|
|
16
20
|
| `loseta add <item> --no-behavior` | Keep the CSS-only install for that run. |
|
|
17
21
|
| `loseta add <item> --behavior` | Backfill missing behavior modules for installed items. |
|
|
18
22
|
| `loseta add <item> --experimental` | Install an experimental component in a Nova project. |
|
|
@@ -23,21 +27,37 @@ npx loseta add button card field
|
|
|
23
27
|
| `loseta list --all` | Include experimental, primitive and foundation items. |
|
|
24
28
|
|
|
25
29
|
`add` flags: `--overwrite`, `--no-deps`, `--behavior`, `--no-behavior`,
|
|
26
|
-
`--experimental`, `--html`, `--style`, `--yes
|
|
27
|
-
behavior-bearing components with `js`.
|
|
28
|
-
`init` flags: `--css-dir`, `--entrypoint`, `--style`, `--import`, `--yes
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
`--experimental`, `--html`, `--style`, `--yes`, `--registry`, `--no-cache`.
|
|
31
|
+
`loseta list` marks behavior-bearing components with `js`.
|
|
32
|
+
`init` flags: `--css-dir`, `--entrypoint`, `--style`, `--import`, `--yes`,
|
|
33
|
+
`--registry`, `--no-cache`. `list` and `style` also accept `--registry` and
|
|
34
|
+
`--no-cache`.
|
|
35
|
+
|
|
36
|
+
The registry base URL resolves from `--registry`, `LOSETA_REGISTRY`, the
|
|
37
|
+
`registry` field in `loseta.json`, then `https://loseta.vladiantio.com/r`.
|
|
38
|
+
Registry and item URLs must use HTTPS; HTTP is allowed only for localhost.
|
|
39
|
+
Responses are cached under the XDG cache directory; `--no-cache` bypasses the
|
|
40
|
+
cache. Requests time out after ten seconds and retry once on network or 5xx
|
|
41
|
+
errors. The CLI has no custom proxy agent; on Node 24 set
|
|
42
|
+
`NODE_USE_ENV_PROXY=1` to use the environment proxy. A cold install requires network access. URL installs are style-bound and
|
|
43
|
+
prompt for confirmation unless `--yes` is passed.
|
|
44
|
+
|
|
45
|
+
Re-running `init` resets `.loseta/manifest.json` to the foundation and
|
|
46
|
+
regenerates `index.css`. Component and behavior files stay on disk but are no
|
|
47
|
+
longer tracked; run `loseta add all` to restore stable components. Experimental
|
|
33
48
|
components must be re-added by name with `--experimental`.
|
|
34
49
|
|
|
35
50
|
## Registry layout
|
|
36
51
|
|
|
52
|
+
The authored source lives in `packages/loseta/registry/`:
|
|
53
|
+
|
|
37
54
|
```
|
|
38
55
|
registry/
|
|
39
|
-
registry.json # item manifest
|
|
40
|
-
schema.json # JSON Schema for the manifest
|
|
56
|
+
registry.json # item manifest and wire metadata
|
|
57
|
+
schema.json # JSON Schema for the source manifest
|
|
58
|
+
schema-item.json # JSON Schema for installable item payloads
|
|
59
|
+
schema-catalog.json # JSON Schema for the served catalog
|
|
60
|
+
validation-rules.json # shared CSS and behavior rules
|
|
41
61
|
tokens.css # design tokens
|
|
42
62
|
reset.css # preflight-style reset
|
|
43
63
|
base.css # element defaults
|
|
@@ -49,6 +69,10 @@ registry/
|
|
|
49
69
|
examples/ # example markup used by `add --html`
|
|
50
70
|
```
|
|
51
71
|
|
|
72
|
+
The npm tarball contains `bin/`, `dist/` and `NOTICE`; it does not contain
|
|
73
|
+
`registry/`. The docs build generates the served artifacts under
|
|
74
|
+
`web/public/r/` and `web/public/schema/v1/` and they are gitignored.
|
|
75
|
+
|
|
52
76
|
Each component item contains:
|
|
53
77
|
|
|
54
78
|
- a base file in `components/` (structure and behavior hooks),
|
|
@@ -63,11 +87,14 @@ are installable by name with `--experimental`, outside the v1 contract, and are
|
|
|
63
87
|
promoted only after the other seven style files exist. No experimental
|
|
64
88
|
components ship in this release; the pipeline remains for future items.
|
|
65
89
|
|
|
66
|
-
`registry.json` declares the
|
|
67
|
-
|
|
90
|
+
`registry.json` declares the wire `schemaVersion`, `minCliVersion`, the available
|
|
91
|
+
styles and the items. There is no semantic registry version: the served catalog
|
|
92
|
+
carries a `build` identifier and the content is mutable. `loseta.json` records
|
|
93
|
+
the configured `registry` URL when it is not the default, and the style in use.
|
|
94
|
+
The CLI copies only the files for that style; `loseta style <name>` rewrites
|
|
68
95
|
them and regenerates `index.css`.
|
|
69
96
|
|
|
70
|
-
`index.css` is generated
|
|
97
|
+
`index.css` is generated from the manifest and declares the layer order:
|
|
71
98
|
|
|
72
99
|
```css
|
|
73
100
|
@layer loseta.tokens, loseta.reset, loseta.base, loseta.components, loseta.style, loseta.utilities;
|
|
@@ -76,9 +103,9 @@ them and regenerates `index.css`.
|
|
|
76
103
|
Behavior files are installed under `behaviors/` (configurable with
|
|
77
104
|
`behaviorDir` in `loseta.json`). Entry modules self-initialize on import; support
|
|
78
105
|
modules (`core.js`, `listbox.js`) export helpers and never auto-init. Tooltip
|
|
79
|
-
and hover-card share `hover-overlay.js`; message-scroller exports
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
and hover-card share `hover-overlay.js`; message-scroller exports `mount(root)`
|
|
107
|
+
for late-mounted lists and uses one scoped `MutationObserver`; resizable also
|
|
108
|
+
exports `mount(root)` to sync late-mounted handles.
|
|
82
109
|
Input OTP, slider, scroll-area and sidebar are CSS-only by design. The CLI
|
|
83
110
|
generates `behaviors/index.js` from the installed entry modules:
|
|
84
111
|
|
|
@@ -93,20 +120,60 @@ Load it once per page with `<script type="module" src="/behaviors/index.js"></sc
|
|
|
93
120
|
`--behavior` backfills missing modules for installed items. `behaviorDir` moves
|
|
94
121
|
the whole tree and the generated index with it.
|
|
95
122
|
|
|
123
|
+
## Remote registry
|
|
124
|
+
|
|
125
|
+
The docs site serves the registry as static JSON:
|
|
126
|
+
|
|
127
|
+
| URL | Contents |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `https://loseta.vladiantio.com/r/registry.json` | Content-free catalog, `schemaVersion`, `minCliVersion`, `build`, styles and per-style hashes. |
|
|
130
|
+
| `https://loseta.vladiantio.com/r/styles/<style>/<name>.json` | Installable component or primitive for one style, with base, style, behavior and example content inlined. |
|
|
131
|
+
| `https://loseta.vladiantio.com/r/foundation/<name>.json` | Installable foundation item. |
|
|
132
|
+
| `https://loseta.vladiantio.com/schema/v1/registry.json` | Catalog JSON Schema. |
|
|
133
|
+
| `https://loseta.vladiantio.com/schema/v1/registry-item.json` | Item payload JSON Schema. |
|
|
134
|
+
|
|
135
|
+
The catalog is revalidated on every command; item payloads are reused from the
|
|
136
|
+
cache when their catalog hash matches and are verified after download. A hash
|
|
137
|
+
mismatch is refused, so a mirror must serve the generated bytes unchanged. When the catalog requires a newer schema or CLI, the
|
|
138
|
+
command fails with an upgrade message rather than installing a partial payload.
|
|
139
|
+
`minCliVersion` in `registry.json` must only move to an already-published CLI
|
|
140
|
+
version, because docs and registry deploys do not wait for npm releases.
|
|
141
|
+
|
|
142
|
+
URL installs accept `component` and `primitive` items only. The payload must
|
|
143
|
+
declare the project style, bare `registryDependencies` resolve against the
|
|
144
|
+
official registry, and external dependencies must be absolute URLs. The
|
|
145
|
+
manifest records each URL item's source; `loseta style` refuses to switch while
|
|
146
|
+
one is installed. Behavior modules in URL payloads execute in the page, so the
|
|
147
|
+
CLI lists the files and asks for confirmation unless `--yes` is passed.
|
|
148
|
+
|
|
149
|
+
`.loseta/manifest.json` records the registry `{ url, build }`, each item's
|
|
150
|
+
optional source URL and the hash of every installed file. `loseta add` is the
|
|
151
|
+
update path for mutable registry content: changed files prompt before being
|
|
152
|
+
overwritten.
|
|
153
|
+
|
|
96
154
|
## Development
|
|
97
155
|
|
|
98
156
|
```bash
|
|
99
157
|
pnpm install
|
|
100
|
-
pnpm --filter loseta build # tsc -> dist/
|
|
101
|
-
pnpm --filter loseta test # registry, install
|
|
158
|
+
pnpm --filter loseta build # tsc -> dist/ and copied schemas/rules
|
|
159
|
+
pnpm --filter loseta test # registry, install, remote, CLI and PTY tests
|
|
102
160
|
pnpm --filter loseta smoke # interactive init prompt smoke test
|
|
103
|
-
pnpm --filter loseta
|
|
161
|
+
pnpm --filter loseta deps:check # enforce the runtime dependency policy
|
|
162
|
+
pnpm --filter loseta deps:report # list dependencies, purposes and import sites
|
|
163
|
+
pnpm --filter loseta validate # source registry integrity and CSS parse
|
|
104
164
|
pnpm --filter loseta behaviors:check # JSDoc type-check the behavior modules
|
|
105
165
|
pnpm --filter loseta examples # regenerate registry/examples from the docs
|
|
166
|
+
pnpm registry:remote # generate web/public/r and schema, validate payloads
|
|
167
|
+
pnpm registry:remote:smoke # install the generated payloads over HTTP
|
|
106
168
|
pnpm --filter loseta dev # run the CLI with tsx
|
|
107
169
|
```
|
|
108
170
|
|
|
109
|
-
The
|
|
171
|
+
The prompt adapter in `src/prompts.ts` owns Ctrl-C cancellation, raw-mode
|
|
172
|
+
restoration and the TopCli compatibility mappings. The test suite exercises
|
|
173
|
+
normal completion and cancellation under a real pseudo-terminal, using the
|
|
174
|
+
local test registry instead of the network.
|
|
175
|
+
|
|
176
|
+
The source registry is validated for:
|
|
110
177
|
|
|
111
178
|
- schema conformance,
|
|
112
179
|
- file and example existence,
|
|
@@ -121,6 +188,10 @@ The registry is validated for:
|
|
|
121
188
|
- forbidden Tailwind/legacy patterns and unsafe behavior patterns,
|
|
122
189
|
- CSS parseability with Lightning CSS.
|
|
123
190
|
|
|
191
|
+
The remote generator additionally validates every catalog entry and item payload
|
|
192
|
+
against the published JSON Schemas, checks CSS layers, forbidden patterns, path
|
|
193
|
+
containment, behavior ESM parsing and catalog hashes.
|
|
194
|
+
|
|
124
195
|
## License
|
|
125
196
|
|
|
126
197
|
MIT. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
package/dist/cli.js
CHANGED
|
@@ -1,28 +1,81 @@
|
|
|
1
|
-
import { defineCommand, runMain } from "citty";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
1
|
import { addCommand } from "./commands/add.js";
|
|
4
2
|
import { initCommand } from "./commands/init.js";
|
|
5
3
|
import { listCommand } from "./commands/list.js";
|
|
6
4
|
import { styleCommand } from "./commands/style.js";
|
|
5
|
+
import { formatCommandHelp, formatRootHelp, parseCommandArgs } from "./command.js";
|
|
6
|
+
import { PACKAGE_DESCRIPTION, PACKAGE_VERSION } from "./package-info.js";
|
|
7
7
|
process.stdout.on("error", (error) => {
|
|
8
8
|
if (error.code === "EPIPE") {
|
|
9
9
|
process.exit(0);
|
|
10
10
|
}
|
|
11
11
|
throw error;
|
|
12
12
|
});
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const commands = [initCommand, addCommand, styleCommand, listCommand];
|
|
14
|
+
const cliMeta = {
|
|
15
|
+
name: "loseta",
|
|
16
|
+
version: PACKAGE_VERSION,
|
|
17
|
+
description: PACKAGE_DESCRIPTION ?? "Native CSS component scaffolds."
|
|
18
|
+
};
|
|
19
|
+
function reportError(message) {
|
|
20
|
+
console.error(`Error: ${message}`);
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
}
|
|
23
|
+
async function runCommand(command, argv) {
|
|
24
|
+
let args;
|
|
25
|
+
try {
|
|
26
|
+
args = parseCommandArgs(command.args, argv);
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
catch (error) {
|
|
29
|
+
reportError(error instanceof Error ? error.message : String(error));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (args.help) {
|
|
33
|
+
console.log(formatCommandHelp(command));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
await command.run({ args });
|
|
37
|
+
}
|
|
38
|
+
async function main() {
|
|
39
|
+
const [name, ...argv] = process.argv.slice(2);
|
|
40
|
+
if (!name || name === "--help" || name === "-h") {
|
|
41
|
+
console.log(formatRootHelp(commands, cliMeta));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (name === "--version" || name === "-v") {
|
|
45
|
+
console.log(PACKAGE_VERSION);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (name === "help") {
|
|
49
|
+
const target = argv[0];
|
|
50
|
+
const command = commands.find((entry) => entry.meta.name === target);
|
|
51
|
+
if (!target) {
|
|
52
|
+
console.log(formatRootHelp(commands, cliMeta));
|
|
53
|
+
}
|
|
54
|
+
else if (command) {
|
|
55
|
+
console.log(formatCommandHelp(command));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
reportError(`Unknown command "${target}".`);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
switch (name) {
|
|
63
|
+
case "init":
|
|
64
|
+
await runCommand(initCommand, argv);
|
|
65
|
+
return;
|
|
66
|
+
case "add":
|
|
67
|
+
await runCommand(addCommand, argv);
|
|
68
|
+
return;
|
|
69
|
+
case "style":
|
|
70
|
+
await runCommand(styleCommand, argv);
|
|
71
|
+
return;
|
|
72
|
+
case "list":
|
|
73
|
+
await runCommand(listCommand, argv);
|
|
74
|
+
return;
|
|
75
|
+
default:
|
|
76
|
+
reportError(`Unknown command "${name}".`);
|
|
77
|
+
console.error(formatRootHelp(commands, cliMeta));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
await main();
|
|
28
81
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,CAAC,MAAM,CAAC,EAA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,WAAW,EAAE,IAAI,CAAC,CAAC;YACpC,OAAO;QACT;YACE,WAAW,CAAC,oBAAoB,IAAI,IAAI,CAAC,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Minimal terminal colors with the subset used by the CLI. */
|
|
2
|
+
export declare const pc: {
|
|
3
|
+
bold: (value: string) => string;
|
|
4
|
+
dim: (value: string) => string;
|
|
5
|
+
cyan: (value: string) => string;
|
|
6
|
+
green: (value: string) => string;
|
|
7
|
+
yellow: (value: string) => string;
|
|
8
|
+
red: (value: string) => string;
|
|
9
|
+
};
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function supportsColor() {
|
|
2
|
+
if ("NO_COLOR" in process.env)
|
|
3
|
+
return false;
|
|
4
|
+
const forced = process.env.FORCE_COLOR;
|
|
5
|
+
if (forced !== undefined) {
|
|
6
|
+
return forced !== "0" && forced !== "false";
|
|
7
|
+
}
|
|
8
|
+
return (process.platform === "win32" ||
|
|
9
|
+
"CI" in process.env ||
|
|
10
|
+
Boolean(process.stdout.isTTY && process.env.TERM !== "dumb"));
|
|
11
|
+
}
|
|
12
|
+
const enabled = supportsColor();
|
|
13
|
+
function style(open, close) {
|
|
14
|
+
return (value) => enabled ? `\u001B[${open}m${value}\u001B[${close}m` : value;
|
|
15
|
+
}
|
|
16
|
+
/** Minimal terminal colors with the subset used by the CLI. */
|
|
17
|
+
export const pc = {
|
|
18
|
+
bold: style(1, 22),
|
|
19
|
+
dim: style(2, 22),
|
|
20
|
+
cyan: style(36, 39),
|
|
21
|
+
green: style(32, 39),
|
|
22
|
+
yellow: style(33, 39),
|
|
23
|
+
red: style(31, 39)
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingUR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
1
|
+
import type { RegistrySource } from "./source-types.js";
|
|
2
|
+
import type { RegistryCatalog } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* `--no-cache` may be represented as `noCache: true` or `cache: false`.
|
|
5
|
+
* Read both shapes so the flag works with either parser representation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function noCacheFlag(args: Record<string, unknown>): boolean;
|
|
8
|
+
export interface RegistrySession {
|
|
9
|
+
url: string;
|
|
10
|
+
source: RegistrySource;
|
|
11
|
+
catalog: RegistryCatalog;
|
|
12
|
+
}
|
|
13
|
+
export interface OpenRegistryOptions {
|
|
14
|
+
registry?: string;
|
|
15
|
+
noCache?: boolean;
|
|
16
|
+
configRegistry?: string;
|
|
17
|
+
onWarning?: (message: string) => void;
|
|
18
|
+
}
|
|
19
|
+
/** Resolves the registry URL, creates the source and loads the catalog. */
|
|
20
|
+
export declare function openRegistry(options?: OpenRegistryOptions): Promise<RegistrySession>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { log } from "./prompts.js";
|
|
2
|
+
import { resolveRegistryUrl } from "./registry-url.js";
|
|
3
|
+
import { RemoteRegistrySource } from "./remote-registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* `--no-cache` may be represented as `noCache: true` or `cache: false`.
|
|
6
|
+
* Read both shapes so the flag works with either parser representation.
|
|
7
|
+
*/
|
|
8
|
+
export function noCacheFlag(args) {
|
|
9
|
+
return Boolean(args.noCache) || args.cache === false;
|
|
10
|
+
}
|
|
11
|
+
/** Resolves the registry URL, creates the source and loads the catalog. */
|
|
12
|
+
export async function openRegistry(options = {}) {
|
|
13
|
+
const url = resolveRegistryUrl({
|
|
14
|
+
flag: options.registry,
|
|
15
|
+
env: process.env.LOSETA_REGISTRY || undefined,
|
|
16
|
+
config: options.configRegistry
|
|
17
|
+
});
|
|
18
|
+
const source = new RemoteRegistrySource({
|
|
19
|
+
url,
|
|
20
|
+
noCache: options.noCache,
|
|
21
|
+
onWarning: options.onWarning ?? ((message) => log.warn(message))
|
|
22
|
+
});
|
|
23
|
+
const catalog = await source.catalog();
|
|
24
|
+
return { url, source, catalog };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=command-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-context.js","sourceRoot":"","sources":["../src/command-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAI5D;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAA6B;IACvD,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;AACvD,CAAC;AAeD,2EAA2E;AAC3E,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,UAA+B,EAAE;IAEjC,MAAM,GAAG,GAAG,kBAAkB,CAAC;QAC7B,IAAI,EAAE,OAAO,CAAC,QAAQ;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,SAAS;QAC7C,MAAM,EAAE,OAAO,CAAC,cAAc;KAC/B,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC;QACtC,GAAG;QACH,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACjE,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACvC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { log } from "./prompts.js";
|
|
2
|
+
import { ConfigError } from "./config.js";
|
|
3
|
+
import { RegistryFetchError } from "./fetch.js";
|
|
4
|
+
import { RegistryNameConflictError, RegistryResolutionError } from "./resolve.js";
|
|
5
|
+
import { RegistryValidationError } from "./validate-content.js";
|
|
6
|
+
/** Reports expected command failures without a stack trace. */
|
|
7
|
+
export function reportCommandError(error) {
|
|
8
|
+
if (error instanceof ConfigError) {
|
|
9
|
+
log.error(error.message);
|
|
10
|
+
process.exitCode = 1;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (error instanceof RegistryFetchError) {
|
|
14
|
+
log.error(error.message);
|
|
15
|
+
log.info("Check the registry URL and your network connection. Set LOSETA_REGISTRY or use --registry to point at a mirror.");
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (error instanceof RegistryValidationError) {
|
|
20
|
+
log.error(error.message);
|
|
21
|
+
if (/Unsupported registry schema|requires loseta/.test(error.message)) {
|
|
22
|
+
log.info("Run `npx loseta@latest` to upgrade the CLI.");
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
log.info("The registry payload was refused and nothing was installed.");
|
|
26
|
+
}
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (error instanceof RegistryNameConflictError) {
|
|
31
|
+
log.error(error.message);
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (error instanceof RegistryResolutionError) {
|
|
36
|
+
log.error(error.message);
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=command-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-errors.js","sourceRoot":"","sources":["../src/command-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAA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EAAE,CAAC;QAC7C,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface CommandArgument {
|
|
2
|
+
type: "boolean" | "string";
|
|
3
|
+
description: string;
|
|
4
|
+
alias?: string;
|
|
5
|
+
}
|
|
6
|
+
export type CommandArguments = Record<string, CommandArgument>;
|
|
7
|
+
type ArgumentValue<Definition> = Definition extends {
|
|
8
|
+
type: "string";
|
|
9
|
+
} ? string : boolean;
|
|
10
|
+
export type CommandArgs<Definitions extends CommandArguments> = {
|
|
11
|
+
[Name in keyof Definitions]?: ArgumentValue<Definitions[Name]>;
|
|
12
|
+
} & {
|
|
13
|
+
_: string[];
|
|
14
|
+
};
|
|
15
|
+
export type ParsedCommandArgs<Definitions extends CommandArguments> = CommandArgs<Definitions> & {
|
|
16
|
+
help: boolean;
|
|
17
|
+
};
|
|
18
|
+
export interface CommandDefinition<Definitions extends CommandArguments> {
|
|
19
|
+
meta: {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
args: Definitions;
|
|
24
|
+
run(context: {
|
|
25
|
+
args: CommandArgs<Definitions>;
|
|
26
|
+
}): void | Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
interface CommandHelp {
|
|
29
|
+
meta: {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
args: CommandArguments;
|
|
34
|
+
}
|
|
35
|
+
/** Declares a command without introducing a CLI framework dependency. */
|
|
36
|
+
export declare function defineCommand<const Definitions extends CommandArguments>(definition: CommandDefinition<Definitions>): CommandDefinition<Definitions>;
|
|
37
|
+
/** Parses one subcommand's arguments while preserving its typed definition. */
|
|
38
|
+
export declare function parseCommandArgs<Definitions extends CommandArguments>(definitions: Definitions, argv: string[]): ParsedCommandArgs<Definitions>;
|
|
39
|
+
export declare function formatCommandHelp(command: CommandHelp): string;
|
|
40
|
+
export declare function formatRootHelp(commands: readonly CommandHelp[], meta: {
|
|
41
|
+
name: string;
|
|
42
|
+
version: string;
|
|
43
|
+
description: string;
|
|
44
|
+
}): string;
|
|
45
|
+
export {};
|
package/dist/command.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { parseArgs } from "node:util";
|
|
2
|
+
/** Declares a command without introducing a CLI framework dependency. */
|
|
3
|
+
export function defineCommand(definition) {
|
|
4
|
+
return definition;
|
|
5
|
+
}
|
|
6
|
+
function kebabCase(name) {
|
|
7
|
+
return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
8
|
+
}
|
|
9
|
+
function camelCase(name) {
|
|
10
|
+
return name.replace(/-([a-z])/g, (_match, letter) => letter.toUpperCase());
|
|
11
|
+
}
|
|
12
|
+
/** Parses one subcommand's arguments while preserving its typed definition. */
|
|
13
|
+
export function parseCommandArgs(definitions, argv) {
|
|
14
|
+
const options = { help: { type: "boolean", short: "h" } };
|
|
15
|
+
for (const [name, definition] of Object.entries(definitions)) {
|
|
16
|
+
options[kebabCase(name)] = {
|
|
17
|
+
type: definition.type,
|
|
18
|
+
...(definition.alias ? { short: definition.alias } : {})
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const { values, positionals } = parseArgs({
|
|
22
|
+
args: argv,
|
|
23
|
+
options,
|
|
24
|
+
allowPositionals: true,
|
|
25
|
+
strict: true
|
|
26
|
+
});
|
|
27
|
+
const args = { _: positionals };
|
|
28
|
+
for (const [name, value] of Object.entries(values)) {
|
|
29
|
+
if (name !== "help")
|
|
30
|
+
args[camelCase(name)] = value;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...args,
|
|
34
|
+
help: values.help === true
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function formatOption(name, definition) {
|
|
38
|
+
const alias = definition.alias ? `-${definition.alias}, ` : " ";
|
|
39
|
+
const value = definition.type === "string" ? " <value>" : "";
|
|
40
|
+
return ` ${alias}--${kebabCase(name)}${value}`.padEnd(32) +
|
|
41
|
+
definition.description;
|
|
42
|
+
}
|
|
43
|
+
export function formatCommandHelp(command) {
|
|
44
|
+
return [
|
|
45
|
+
`loseta ${command.meta.name}`,
|
|
46
|
+
"",
|
|
47
|
+
command.meta.description,
|
|
48
|
+
"",
|
|
49
|
+
`Usage: loseta ${command.meta.name} [options]`,
|
|
50
|
+
"",
|
|
51
|
+
"Options:",
|
|
52
|
+
...Object.entries(command.args).map(([name, definition]) => formatOption(name, definition)),
|
|
53
|
+
formatOption("help", { type: "boolean", description: "Show this help", alias: "h" })
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
export function formatRootHelp(commands, meta) {
|
|
57
|
+
return [
|
|
58
|
+
`${meta.name} ${meta.version}`,
|
|
59
|
+
"",
|
|
60
|
+
meta.description,
|
|
61
|
+
"",
|
|
62
|
+
"Usage: loseta <command> [options]",
|
|
63
|
+
"",
|
|
64
|
+
"Commands:",
|
|
65
|
+
...commands.map((command) => ` ${command.meta.name.padEnd(12)}${command.meta.description}`),
|
|
66
|
+
"",
|
|
67
|
+
"Options:",
|
|
68
|
+
" -h, --help".padEnd(32) + "Show this help",
|
|
69
|
+
" -v, --version".padEnd(32) + "Show version"
|
|
70
|
+
].join("\n");
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAsCtC,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAC3B,UAA0C;IAE1C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,OAAO,C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AI,CAAC,WAAW;QAChB,EAAE;QACF,mCAAmC;QACnC,EAAE;QACF,WAAW;QACX,GAAG,QAAQ,CAAC,GAAG,CACb,CAAC,OAAO,EAAE,EAAE,CACV,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CACjE;QACD,EAAE;QACF,UAAU;QACV,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,gBAAgB;QAC5C,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,cAAc;KAC9C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/commands/add.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const addCommand: import("
|
|
1
|
+
export declare const addCommand: import("../command.js").CommandDefinition<{
|
|
2
2
|
readonly overwrite: {
|
|
3
3
|
readonly type: "boolean";
|
|
4
4
|
readonly description: "Overwrite existing files without prompting";
|
|
@@ -33,4 +33,12 @@ export declare const addCommand: import("citty").CommandDef<{
|
|
|
33
33
|
readonly description: "Skip prompts; keep modified files untouched";
|
|
34
34
|
readonly alias: "y";
|
|
35
35
|
};
|
|
36
|
+
readonly registry: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly description: "Registry base URL";
|
|
39
|
+
};
|
|
40
|
+
readonly noCache: {
|
|
41
|
+
readonly type: "boolean";
|
|
42
|
+
readonly description: "Bypass the registry cache";
|
|
43
|
+
};
|
|
36
44
|
}>;
|