termcast 1.3.10 → 1.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/toast.d.ts +1 -5
- package/dist/apis/toast.d.ts.map +1 -1
- package/dist/apis/toast.js +23 -17
- package/dist/apis/toast.js.map +1 -1
- package/dist/build.d.ts +2 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +4 -3
- package/dist/build.js.map +1 -1
- package/dist/cli.js +42 -0
- package/dist/cli.js.map +1 -1
- package/dist/colors.d.ts +8 -1
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +12 -0
- package/dist/colors.js.map +1 -1
- package/dist/compile.d.ts +30 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +156 -0
- package/dist/compile.js.map +1 -0
- package/dist/components/actions.d.ts +1 -0
- package/dist/components/actions.d.ts.map +1 -1
- package/dist/components/actions.js +5 -2
- package/dist/components/actions.js.map +1 -1
- package/dist/components/command-arguments.d.ts +9 -0
- package/dist/components/command-arguments.d.ts.map +1 -0
- package/dist/components/command-arguments.js +21 -0
- package/dist/components/command-arguments.js.map +1 -0
- package/dist/components/detail.d.ts +1 -1
- package/dist/components/detail.d.ts.map +1 -1
- package/dist/components/detail.js +17 -39
- package/dist/components/detail.js.map +1 -1
- package/dist/components/dropdown.d.ts +1 -0
- package/dist/components/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown.js +77 -21
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/extension-preferences.d.ts.map +1 -1
- package/dist/components/extension-preferences.js +19 -29
- package/dist/components/extension-preferences.js.map +1 -1
- package/dist/components/form/checkbox.d.ts.map +1 -1
- package/dist/components/form/checkbox.js +9 -2
- package/dist/components/form/checkbox.js.map +1 -1
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.js +15 -28
- package/dist/components/form/date-picker.js.map +1 -1
- package/dist/components/form/description.d.ts +2 -0
- package/dist/components/form/description.d.ts.map +1 -1
- package/dist/components/form/description.js +20 -2
- package/dist/components/form/description.js.map +1 -1
- package/dist/components/form/dropdown.d.ts.map +1 -1
- package/dist/components/form/dropdown.js +13 -28
- package/dist/components/form/dropdown.js.map +1 -1
- package/dist/components/form/file-autocomplete.d.ts +7 -4
- package/dist/components/form/file-autocomplete.d.ts.map +1 -1
- package/dist/components/form/file-autocomplete.js +54 -46
- package/dist/components/form/file-autocomplete.js.map +1 -1
- package/dist/components/form/file-picker.d.ts +5 -0
- package/dist/components/form/file-picker.d.ts.map +1 -1
- package/dist/components/form/file-picker.js +46 -49
- package/dist/components/form/file-picker.js.map +1 -1
- package/dist/components/form/form-ref.d.ts +43 -0
- package/dist/components/form/form-ref.d.ts.map +1 -0
- package/dist/components/form/form-ref.js +53 -0
- package/dist/components/form/form-ref.js.map +1 -0
- package/dist/components/form/index.d.ts +16 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +86 -23
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/form/password-field.d.ts.map +1 -1
- package/dist/components/form/password-field.js +32 -16
- package/dist/components/form/password-field.js.map +1 -1
- package/dist/components/form/text-area.d.ts.map +1 -1
- package/dist/components/form/text-area.js +32 -15
- package/dist/components/form/text-area.js.map +1 -1
- package/dist/components/form/text-field.d.ts.map +1 -1
- package/dist/components/form/text-field.js +37 -17
- package/dist/components/form/text-field.js.map +1 -1
- package/dist/components/form/use-form-navigation.d.ts +4 -0
- package/dist/components/form/use-form-navigation.d.ts.map +1 -1
- package/dist/components/form/use-form-navigation.js +35 -18
- package/dist/components/form/use-form-navigation.js.map +1 -1
- package/dist/components/form/with-left-border.d.ts.map +1 -1
- package/dist/components/form/with-left-border.js +2 -2
- package/dist/components/form/with-left-border.js.map +1 -1
- package/dist/components/icon.d.ts +3 -1
- package/dist/components/icon.d.ts.map +1 -1
- package/dist/components/icon.js +494 -469
- package/dist/components/icon.js.map +1 -1
- package/dist/components/list.d.ts +11 -7
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +170 -38
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-bar.js +1 -1
- package/dist/components/loading-bar.js.map +1 -1
- package/dist/descendants.d.ts.map +1 -1
- package/dist/descendants.js +8 -5
- package/dist/descendants.js.map +1 -1
- package/dist/examples/action-show-in-finder.js +1 -1
- package/dist/examples/action-show-in-finder.js.map +1 -1
- package/dist/examples/environment-test.js +1 -1
- package/dist/examples/environment-test.js.map +1 -1
- package/dist/examples/error-boundary.js +1 -1
- package/dist/examples/error-boundary.js.map +1 -1
- package/dist/examples/form-basic.d.ts.map +1 -1
- package/dist/examples/form-basic.js +2 -2
- package/dist/examples/form-basic.js.map +1 -1
- package/dist/examples/form-dropdown.js +1 -1
- package/dist/examples/form-dropdown.js.map +1 -1
- package/dist/examples/form-scroll.d.ts +2 -0
- package/dist/examples/form-scroll.d.ts.map +1 -0
- package/dist/examples/form-scroll.js +8 -0
- package/dist/examples/form-scroll.js.map +1 -0
- package/dist/examples/form-tagpicker.js +1 -1
- package/dist/examples/form-tagpicker.js.map +1 -1
- package/dist/examples/internal/descendants-filtering.js +8 -3
- package/dist/examples/internal/descendants-filtering.js.map +1 -1
- package/dist/examples/internal/descendants.js +10 -3
- package/dist/examples/internal/descendants.js.map +1 -1
- package/dist/examples/internal/rhf-custom-ref.d.ts +2 -0
- package/dist/examples/internal/rhf-custom-ref.d.ts.map +1 -0
- package/dist/examples/internal/rhf-custom-ref.js +67 -0
- package/dist/examples/internal/rhf-custom-ref.js.map +1 -0
- package/dist/examples/internal/scrollbox-demo.js +3 -7
- package/dist/examples/internal/scrollbox-demo.js.map +1 -1
- package/dist/examples/internal/scrollbox-with-descendants.d.ts +2 -0
- package/dist/examples/internal/scrollbox-with-descendants.d.ts.map +1 -0
- package/dist/examples/internal/scrollbox-with-descendants.js +63 -0
- package/dist/examples/internal/scrollbox-with-descendants.js.map +1 -0
- package/dist/examples/internal/simple-dialog.js +1 -1
- package/dist/examples/internal/simple-dialog.js.map +1 -1
- package/dist/examples/internal/simple-scrollbox.js +2 -3
- package/dist/examples/internal/simple-scrollbox.js.map +1 -1
- package/dist/examples/internal/text-stacking.js +4 -2
- package/dist/examples/internal/text-stacking.js.map +1 -1
- package/dist/examples/list-dropdown-default.js +1 -1
- package/dist/examples/list-dropdown-default.js.map +1 -1
- package/dist/examples/list-fetch-data.js +1 -1
- package/dist/examples/list-fetch-data.js.map +1 -1
- package/dist/examples/list-scrollbox.d.ts +2 -0
- package/dist/examples/list-scrollbox.d.ts.map +1 -0
- package/dist/examples/list-scrollbox.js +29 -0
- package/dist/examples/list-scrollbox.js.map +1 -0
- package/dist/examples/list-with-detail.js +1 -1
- package/dist/examples/list-with-detail.js.map +1 -1
- package/dist/examples/list-with-dropdown.js +1 -1
- package/dist/examples/list-with-dropdown.js.map +1 -1
- package/dist/examples/list-with-sections.js +3 -3
- package/dist/examples/list-with-sections.js.map +1 -1
- package/dist/examples/miscellaneous.js +1 -1
- package/dist/examples/miscellaneous.js.map +1 -1
- package/dist/examples/nested-navigation.js +4 -2
- package/dist/examples/nested-navigation.js.map +1 -1
- package/dist/examples/preferences-test.js +1 -1
- package/dist/examples/preferences-test.js.map +1 -1
- package/dist/examples/simple-dropdown.js +1 -1
- package/dist/examples/simple-dropdown.js.map +1 -1
- package/dist/examples/simple-file-picker.js +1 -1
- package/dist/examples/simple-file-picker.js.map +1 -1
- package/dist/examples/simple-grid.js +1 -1
- package/dist/examples/simple-grid.js.map +1 -1
- package/dist/examples/simple-hud.js +1 -1
- package/dist/examples/simple-hud.js.map +1 -1
- package/dist/examples/simple-list-search.js +1 -1
- package/dist/examples/simple-list-search.js.map +1 -1
- package/dist/examples/simple-list.js +1 -1
- package/dist/examples/simple-list.js.map +1 -1
- package/dist/examples/simple-navigation.js +4 -2
- package/dist/examples/simple-navigation.js.map +1 -1
- package/dist/examples/store.js +1 -1
- package/dist/examples/store.js.map +1 -1
- package/dist/examples/submodule-diff.d.ts +2 -0
- package/dist/examples/submodule-diff.d.ts.map +1 -0
- package/dist/examples/submodule-diff.js +99 -0
- package/dist/examples/submodule-diff.js.map +1 -0
- package/dist/examples/tanstack-demo.js +1 -1
- package/dist/examples/tanstack-demo.js.map +1 -1
- package/dist/examples/use-promise-demo.js +1 -1
- package/dist/examples/use-promise-demo.js.map +1 -1
- package/dist/extensions/dev.d.ts +8 -0
- package/dist/extensions/dev.d.ts.map +1 -1
- package/dist/extensions/dev.js +53 -28
- package/dist/extensions/dev.js.map +1 -1
- package/dist/extensions/home.d.ts.map +1 -1
- package/dist/extensions/home.js +16 -91
- package/dist/extensions/home.js.map +1 -1
- package/dist/globals.js +1 -1
- package/dist/globals.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/date-picker-widget.d.ts.map +1 -1
- package/dist/internal/date-picker-widget.js +56 -48
- package/dist/internal/date-picker-widget.js.map +1 -1
- package/dist/internal/dialog.d.ts.map +1 -1
- package/dist/internal/dialog.js +7 -7
- package/dist/internal/dialog.js.map +1 -1
- package/dist/internal/scrollbox.d.ts +2 -1
- package/dist/internal/scrollbox.d.ts.map +1 -1
- package/dist/internal/scrollbox.js +13 -7
- package/dist/internal/scrollbox.js.map +1 -1
- package/dist/release.d.ts +11 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +113 -0
- package/dist/release.js.map +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +1 -0
- package/dist/state.js.map +1 -1
- package/dist/theme.d.ts +11 -8
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +31 -8
- package/dist/theme.js.map +1 -1
- package/dist/utils/run-command.d.ts +22 -0
- package/dist/utils/run-command.d.ts.map +1 -0
- package/dist/utils/run-command.js +127 -0
- package/dist/utils/run-command.js.map +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +5 -3
- package/dist/utils.js.map +1 -1
- package/package.json +10 -7
- package/src/apis/toast.tsx +38 -17
- package/src/build.tsx +5 -3
- package/src/cli.tsx +46 -0
- package/src/colors.tsx +22 -1
- package/src/compile.tsx +219 -0
- package/src/components/actions.tsx +7 -1
- package/src/components/command-arguments.tsx +81 -0
- package/src/components/detail.tsx +26 -58
- package/src/components/dropdown.tsx +108 -23
- package/src/components/extension-preferences.tsx +55 -35
- package/src/components/form/checkbox.tsx +13 -5
- package/src/components/form/date-picker.tsx +24 -29
- package/src/components/form/description.tsx +35 -7
- package/src/components/form/dropdown.tsx +16 -30
- package/src/components/form/file-autocomplete.tsx +87 -77
- package/src/components/form/file-picker.tsx +69 -57
- package/src/components/form/form-ref.tsx +68 -0
- package/src/components/form/index.tsx +152 -41
- package/src/components/form/password-field.tsx +35 -22
- package/src/components/form/text-area.tsx +78 -58
- package/src/components/form/text-field.tsx +82 -61
- package/src/components/form/use-form-navigation.tsx +43 -23
- package/src/components/form/with-left-border.tsx +2 -1
- package/src/components/icon.tsx +497 -469
- package/src/components/list.tsx +279 -112
- package/src/components/loading-bar.tsx +1 -1
- package/src/descendants.tsx +15 -5
- package/src/examples/action-show-in-finder.tsx +1 -1
- package/src/examples/environment-test.tsx +1 -1
- package/src/examples/error-boundary.tsx +1 -1
- package/src/examples/file-autocomplete.vitest.tsx +245 -0
- package/src/examples/form-basic.tsx +12 -12
- package/src/examples/form-basic.vitest.tsx +297 -671
- package/src/examples/form-dropdown.tsx +1 -1
- package/src/examples/form-dropdown.vitest.tsx +353 -221
- package/src/examples/form-scroll.tsx +56 -0
- package/src/examples/form-scroll.vitest.tsx +228 -0
- package/src/examples/form-tagpicker.tsx +1 -1
- package/src/examples/form-tagpicker.vitest.tsx +438 -193
- package/src/examples/internal/descendants-filtering.tsx +13 -5
- package/src/examples/internal/descendants.tsx +17 -5
- package/src/examples/internal/rhf-custom-ref.tsx +152 -0
- package/src/examples/internal/scrollbox-demo.tsx +15 -7
- package/src/examples/internal/scrollbox-with-descendants.tsx +94 -0
- package/src/examples/internal/simple-dialog.tsx +1 -1
- package/src/examples/internal/simple-scrollbox.tsx +8 -5
- package/src/examples/internal/simple-scrollbox.vitest.tsx +47 -37
- package/src/examples/internal/text-stacking.tsx +4 -2
- package/src/examples/list-dropdown-default.tsx +1 -1
- package/src/examples/list-dropdown-default.vitest.tsx +136 -71
- package/src/examples/list-fetch-data.tsx +1 -1
- package/src/examples/list-fetch-data.vitest.tsx +42 -33
- package/src/examples/list-scrollbox.tsx +46 -0
- package/src/examples/list-scrollbox.vitest.tsx +103 -0
- package/src/examples/list-with-detail.tsx +1 -1
- package/src/examples/list-with-detail.vitest.tsx +290 -294
- package/src/examples/list-with-dropdown.tsx +1 -1
- package/src/examples/list-with-dropdown.vitest.tsx +190 -150
- package/src/examples/list-with-sections.tsx +12 -1
- package/src/examples/list-with-sections.vitest.tsx +390 -218
- package/src/examples/miscellaneous.tsx +1 -1
- package/src/examples/nested-navigation.tsx +4 -2
- package/src/examples/preferences-test.tsx +1 -1
- package/src/examples/simple-dropdown.tsx +1 -1
- package/src/examples/simple-file-picker.tsx +1 -1
- package/src/examples/simple-file-picker.vitest.tsx +538 -132
- package/src/examples/simple-grid.tsx +1 -1
- package/src/examples/simple-grid.vitest.tsx +258 -234
- package/src/examples/simple-hud.tsx +1 -1
- package/src/examples/simple-list-search.tsx +1 -1
- package/src/examples/simple-list.tsx +1 -1
- package/src/examples/simple-navigation.tsx +4 -2
- package/src/examples/simple-navigation.vitest.tsx +434 -238
- package/src/examples/store.tsx +1 -1
- package/src/examples/store.vitest.tsx +31 -10
- package/src/examples/submodule-diff.tsx +153 -0
- package/src/examples/tanstack-demo.tsx +1 -1
- package/src/examples/use-promise-demo.tsx +1 -1
- package/src/extensions/dev.tsx +74 -36
- package/src/extensions/dev.vitest.tsx +220 -0
- package/src/extensions/home.tsx +17 -118
- package/src/globals.ts +1 -1
- package/src/index.tsx +7 -1
- package/src/internal/date-picker-widget.tsx +56 -46
- package/src/internal/dialog.tsx +6 -6
- package/src/internal/scrollbox.tsx +15 -5
- package/src/release.tsx +159 -0
- package/src/state.tsx +2 -0
- package/src/store-api/search.test.tsx +4 -13
- package/src/theme.tsx +33 -8
- package/src/utils/run-command.tsx +204 -0
- package/src/utils.tsx +5 -3
- package/dist/ai.d.ts +0 -104
- package/dist/ai.d.ts.map +0 -1
- package/dist/ai.js +0 -135
- package/dist/ai.js.map +0 -1
- package/dist/apis/cache.test.d.ts +0 -2
- package/dist/apis/cache.test.d.ts.map +0 -1
- package/dist/apis/cache.test.js +0 -246
- package/dist/apis/cache.test.js.map +0 -1
- package/dist/apis/localstorage.test.d.ts +0 -2
- package/dist/apis/localstorage.test.d.ts.map +0 -1
- package/dist/apis/localstorage.test.js +0 -131
- package/dist/apis/localstorage.test.js.map +0 -1
- package/dist/apis/toast.test.d.ts +0 -2
- package/dist/apis/toast.test.d.ts.map +0 -1
- package/dist/apis/toast.test.js +0 -67
- package/dist/apis/toast.test.js.map +0 -1
- package/dist/build.test.d.ts +0 -2
- package/dist/build.test.d.ts.map +0 -1
- package/dist/build.test.js +0 -73
- package/dist/build.test.js.map +0 -1
- package/dist/cache.d.ts +0 -32
- package/dist/cache.d.ts.map +0 -1
- package/dist/cache.js +0 -205
- package/dist/cache.js.map +0 -1
- package/dist/cache.test.d.ts +0 -2
- package/dist/cache.test.d.ts.map +0 -1
- package/dist/cache.test.js +0 -246
- package/dist/cache.test.js.map +0 -1
- package/dist/clipboard.d.ts +0 -36
- package/dist/clipboard.d.ts.map +0 -1
- package/dist/clipboard.js +0 -154
- package/dist/clipboard.js.map +0 -1
- package/dist/components/form/form-type-only.d.ts +0 -174
- package/dist/components/form/form-type-only.d.ts.map +0 -1
- package/dist/components/form/form-type-only.js +0 -2
- package/dist/components/form/form-type-only.js.map +0 -1
- package/dist/components/form/use-form-handling.d.ts +0 -4
- package/dist/components/form/use-form-handling.d.ts.map +0 -1
- package/dist/components/form/use-form-handling.js +0 -37
- package/dist/components/form/use-form-handling.js.map +0 -1
- package/dist/dev-ui.d.ts +0 -7
- package/dist/dev-ui.d.ts.map +0 -1
- package/dist/dev-ui.js +0 -118
- package/dist/dev-ui.js.map +0 -1
- package/dist/environment.d.ts +0 -63
- package/dist/environment.d.ts.map +0 -1
- package/dist/environment.js +0 -189
- package/dist/environment.js.map +0 -1
- package/dist/examples/datepicker.d.ts +0 -2
- package/dist/examples/datepicker.d.ts.map +0 -1
- package/dist/examples/datepicker.js +0 -344
- package/dist/examples/datepicker.js.map +0 -1
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts +0 -2
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts.map +0 -1
- package/dist/examples/form-basic-arrow-keys.vitest.js +0 -46
- package/dist/examples/form-basic-arrow-keys.vitest.js.map +0 -1
- package/dist/examples/form-basic.vitest.d.ts +0 -2
- package/dist/examples/form-basic.vitest.d.ts.map +0 -1
- package/dist/examples/form-basic.vitest.js +0 -995
- package/dist/examples/form-basic.vitest.js.map +0 -1
- package/dist/examples/form-dropdown-with-sections.d.ts +0 -2
- package/dist/examples/form-dropdown-with-sections.d.ts.map +0 -1
- package/dist/examples/form-dropdown-with-sections.js +0 -13
- package/dist/examples/form-dropdown-with-sections.js.map +0 -1
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts +0 -2
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts.map +0 -1
- package/dist/examples/form-dropdown-with-sections.vitest.js +0 -75
- package/dist/examples/form-dropdown-with-sections.vitest.js.map +0 -1
- package/dist/examples/form-dropdown.vitest.d.ts +0 -2
- package/dist/examples/form-dropdown.vitest.d.ts.map +0 -1
- package/dist/examples/form-dropdown.vitest.js +0 -722
- package/dist/examples/form-dropdown.vitest.js.map +0 -1
- package/dist/examples/form-multiselect-dropdown.d.ts +0 -2
- package/dist/examples/form-multiselect-dropdown.d.ts.map +0 -1
- package/dist/examples/form-multiselect-dropdown.js +0 -13
- package/dist/examples/form-multiselect-dropdown.js.map +0 -1
- package/dist/examples/form-tagpicker.vitest.d.ts +0 -2
- package/dist/examples/form-tagpicker.vitest.d.ts.map +0 -1
- package/dist/examples/form-tagpicker.vitest.js +0 -491
- package/dist/examples/form-tagpicker.vitest.js.map +0 -1
- package/dist/examples/internal/nested-boxes.d.ts +0 -2
- package/dist/examples/internal/nested-boxes.d.ts.map +0 -1
- package/dist/examples/internal/nested-boxes.js +0 -7
- package/dist/examples/internal/nested-boxes.js.map +0 -1
- package/dist/examples/internal/simple-scrollbox.vitest.d.ts +0 -2
- package/dist/examples/internal/simple-scrollbox.vitest.d.ts.map +0 -1
- package/dist/examples/internal/simple-scrollbox.vitest.js +0 -88
- package/dist/examples/internal/simple-scrollbox.vitest.js.map +0 -1
- package/dist/examples/internal/unicode-square-repro.d.ts +0 -2
- package/dist/examples/internal/unicode-square-repro.d.ts.map +0 -1
- package/dist/examples/internal/unicode-square-repro.js +0 -7
- package/dist/examples/internal/unicode-square-repro.js.map +0 -1
- package/dist/examples/list-dropdown-default.vitest.d.ts +0 -2
- package/dist/examples/list-dropdown-default.vitest.d.ts.map +0 -1
- package/dist/examples/list-dropdown-default.vitest.js +0 -164
- package/dist/examples/list-dropdown-default.vitest.js.map +0 -1
- package/dist/examples/list-fetch-data.vitest.d.ts +0 -2
- package/dist/examples/list-fetch-data.vitest.d.ts.map +0 -1
- package/dist/examples/list-fetch-data.vitest.js +0 -103
- package/dist/examples/list-fetch-data.vitest.js.map +0 -1
- package/dist/examples/list-filter-navigation.d.ts +0 -2
- package/dist/examples/list-filter-navigation.d.ts.map +0 -1
- package/dist/examples/list-filter-navigation.js +0 -8
- package/dist/examples/list-filter-navigation.js.map +0 -1
- package/dist/examples/list-with-detail.vitest.d.ts +0 -2
- package/dist/examples/list-with-detail.vitest.d.ts.map +0 -1
- package/dist/examples/list-with-detail.vitest.js +0 -438
- package/dist/examples/list-with-detail.vitest.js.map +0 -1
- package/dist/examples/list-with-dropdown.vitest.d.ts +0 -2
- package/dist/examples/list-with-dropdown.vitest.d.ts.map +0 -1
- package/dist/examples/list-with-dropdown.vitest.js +0 -297
- package/dist/examples/list-with-dropdown.vitest.js.map +0 -1
- package/dist/examples/list-with-sections.vitest.d.ts +0 -2
- package/dist/examples/list-with-sections.vitest.d.ts.map +0 -1
- package/dist/examples/list-with-sections.vitest.js +0 -441
- package/dist/examples/list-with-sections.vitest.js.map +0 -1
- package/dist/examples/simple-file-picker.vitest.d.ts +0 -2
- package/dist/examples/simple-file-picker.vitest.d.ts.map +0 -1
- package/dist/examples/simple-file-picker.vitest.js +0 -277
- package/dist/examples/simple-file-picker.vitest.js.map +0 -1
- package/dist/examples/simple-grid.vitest.d.ts +0 -2
- package/dist/examples/simple-grid.vitest.d.ts.map +0 -1
- package/dist/examples/simple-grid.vitest.js +0 -498
- package/dist/examples/simple-grid.vitest.js.map +0 -1
- package/dist/examples/simple-navigation.vitest.d.ts +0 -2
- package/dist/examples/simple-navigation.vitest.d.ts.map +0 -1
- package/dist/examples/simple-navigation.vitest.js +0 -522
- package/dist/examples/simple-navigation.vitest.js.map +0 -1
- package/dist/examples/store.vitest.d.ts +0 -2
- package/dist/examples/store.vitest.d.ts.map +0 -1
- package/dist/examples/store.vitest.js +0 -48
- package/dist/examples/store.vitest.js.map +0 -1
- package/dist/home-command.d.ts +0 -8
- package/dist/home-command.d.ts.map +0 -1
- package/dist/home-command.js +0 -181
- package/dist/home-command.js.map +0 -1
- package/dist/hooks/hooks.test.d.ts +0 -2
- package/dist/hooks/hooks.test.d.ts.map +0 -1
- package/dist/hooks/hooks.test.js +0 -37
- package/dist/hooks/hooks.test.js.map +0 -1
- package/dist/hover-repro.d.ts +0 -2
- package/dist/hover-repro.d.ts.map +0 -1
- package/dist/hover-repro.js +0 -20
- package/dist/hover-repro.js.map +0 -1
- package/dist/localstorage.d.ts +0 -13
- package/dist/localstorage.d.ts.map +0 -1
- package/dist/localstorage.js +0 -190
- package/dist/localstorage.js.map +0 -1
- package/dist/localstorage.test.d.ts +0 -2
- package/dist/localstorage.test.d.ts.map +0 -1
- package/dist/localstorage.test.js +0 -131
- package/dist/localstorage.test.js.map +0 -1
- package/dist/oauth.d.ts +0 -142
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js +0 -551
- package/dist/oauth.js.map +0 -1
- package/dist/preferences.d.ts +0 -23
- package/dist/preferences.d.ts.map +0 -1
- package/dist/preferences.js +0 -105
- package/dist/preferences.js.map +0 -1
- package/dist/store-api/download.test.d.ts +0 -2
- package/dist/store-api/download.test.d.ts.map +0 -1
- package/dist/store-api/download.test.js +0 -36
- package/dist/store-api/download.test.js.map +0 -1
- package/dist/store-api/extension.test.d.ts +0 -2
- package/dist/store-api/extension.test.d.ts.map +0 -1
- package/dist/store-api/extension.test.js +0 -22
- package/dist/store-api/extension.test.js.map +0 -1
- package/dist/store-api/search.test.d.ts +0 -2
- package/dist/store-api/search.test.d.ts.map +0 -1
- package/dist/store-api/search.test.js +0 -45
- package/dist/store-api/search.test.js.map +0 -1
- package/dist/store.d.ts +0 -21
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -84
- package/dist/store.js.map +0 -1
- package/dist/toast.d.ts +0 -44
- package/dist/toast.d.ts.map +0 -1
- package/dist/toast.js +0 -221
- package/dist/toast.js.map +0 -1
- package/dist/utils.test.d.ts +0 -2
- package/dist/utils.test.d.ts.map +0 -1
- package/dist/utils.test.js +0 -152
- package/dist/utils.test.js.map +0 -1
- package/dist/window.d.ts +0 -12
- package/dist/window.d.ts.map +0 -1
- package/dist/window.js +0 -48
- package/dist/window.js.map +0 -1
package/dist/preferences.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { useStore } from '@termcast/cli/src/state';
|
|
3
|
-
import { logger } from '@termcast/cli/src/logger';
|
|
4
|
-
import { LocalStorage } from '@termcast/cli/src/localstorage';
|
|
5
|
-
import { ExtensionPreferences } from '@termcast/cli/src/components/extension-preferences';
|
|
6
|
-
/**
|
|
7
|
-
* A function to access the preference values that have been passed to the command.
|
|
8
|
-
* Each preference name is mapped to its value, and the defined default values are used as fallback values.
|
|
9
|
-
*
|
|
10
|
-
* @returns An object with the preference names as property key and the typed value as property value.
|
|
11
|
-
*/
|
|
12
|
-
export function getPreferenceValues() {
|
|
13
|
-
const state = useStore.getState();
|
|
14
|
-
const { extensionPackageJson, currentCommandName, extensionPath } = state;
|
|
15
|
-
// Determine the extension name from package.json or path
|
|
16
|
-
let extensionName = null;
|
|
17
|
-
if (extensionPackageJson?.name) {
|
|
18
|
-
extensionName = extensionPackageJson.name;
|
|
19
|
-
}
|
|
20
|
-
else if (extensionPath) {
|
|
21
|
-
// Extract extension name from path if package.json not available
|
|
22
|
-
const pathParts = extensionPath.split('/');
|
|
23
|
-
extensionName = pathParts[pathParts.length - 1];
|
|
24
|
-
}
|
|
25
|
-
if (!extensionName) {
|
|
26
|
-
logger.log('No extension context found for preferences');
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
// First try to load command-specific preferences, then fall back to extension preferences
|
|
31
|
-
if (currentCommandName) {
|
|
32
|
-
const commandPreferencesKey = `preferences.${extensionName}.${currentCommandName}`;
|
|
33
|
-
const commandPreferences = LocalStorage.getItemSync(commandPreferencesKey);
|
|
34
|
-
if (commandPreferences && typeof commandPreferences === 'string') {
|
|
35
|
-
try {
|
|
36
|
-
const parsed = JSON.parse(commandPreferences);
|
|
37
|
-
logger.log(`Loaded command preferences for ${extensionName}/${currentCommandName}:`, parsed);
|
|
38
|
-
return parsed;
|
|
39
|
-
}
|
|
40
|
-
catch (parseError) {
|
|
41
|
-
logger.error(`Failed to parse command preferences:`, parseError);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Fall back to extension-level preferences
|
|
46
|
-
const extensionPreferencesKey = `preferences.${extensionName}`;
|
|
47
|
-
const extensionPreferences = LocalStorage.getItemSync(extensionPreferencesKey);
|
|
48
|
-
if (extensionPreferences && typeof extensionPreferences === 'string') {
|
|
49
|
-
try {
|
|
50
|
-
const parsed = JSON.parse(extensionPreferences);
|
|
51
|
-
logger.log(`Loaded extension preferences for ${extensionName}:`, parsed);
|
|
52
|
-
return parsed;
|
|
53
|
-
}
|
|
54
|
-
catch (parseError) {
|
|
55
|
-
logger.error(`Failed to parse extension preferences:`, parseError);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
logger.error(`Failed to load preferences for ${extensionName}:`, error);
|
|
61
|
-
}
|
|
62
|
-
// Return empty preferences if none saved
|
|
63
|
-
return {};
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Opens the extension's preferences screen.
|
|
67
|
-
*
|
|
68
|
-
* @returns A Promise that resolves when the extensions preferences screen is opened.
|
|
69
|
-
*/
|
|
70
|
-
export async function openExtensionPreferences() {
|
|
71
|
-
const state = useStore.getState();
|
|
72
|
-
const { extensionPackageJson, navigationStack } = state;
|
|
73
|
-
if (!extensionPackageJson?.name) {
|
|
74
|
-
throw new Error('No current extension found');
|
|
75
|
-
}
|
|
76
|
-
logger.log(`Opening extension preferences for ${extensionPackageJson.name}`);
|
|
77
|
-
// Push the preferences component to the navigation stack
|
|
78
|
-
const preferencesComponent = (_jsx(ExtensionPreferences, { extensionName: extensionPackageJson.name }));
|
|
79
|
-
useStore.setState({
|
|
80
|
-
navigationStack: [...navigationStack, { element: preferencesComponent }],
|
|
81
|
-
dialogStack: [],
|
|
82
|
-
});
|
|
83
|
-
return Promise.resolve();
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Opens the command's preferences screen.
|
|
87
|
-
*
|
|
88
|
-
* @returns A Promise that resolves when the command's preferences screen is opened.
|
|
89
|
-
*/
|
|
90
|
-
export async function openCommandPreferences() {
|
|
91
|
-
const state = useStore.getState();
|
|
92
|
-
const { extensionPackageJson, currentCommandName, navigationStack } = state;
|
|
93
|
-
if (!extensionPackageJson?.name || !currentCommandName) {
|
|
94
|
-
throw new Error('No current command found');
|
|
95
|
-
}
|
|
96
|
-
logger.log(`Opening command preferences for ${extensionPackageJson.name}/${currentCommandName}`);
|
|
97
|
-
// Push the preferences component to the navigation stack
|
|
98
|
-
const preferencesComponent = (_jsx(ExtensionPreferences, { extensionName: extensionPackageJson.name, commandName: currentCommandName }));
|
|
99
|
-
useStore.setState({
|
|
100
|
-
navigationStack: [...navigationStack, { element: preferencesComponent }],
|
|
101
|
-
dialogStack: [],
|
|
102
|
-
});
|
|
103
|
-
return Promise.resolve();
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=preferences.js.map
|
package/dist/preferences.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../src/preferences.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAA;AAMzF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IAGjC,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAA;IACjC,MAAM,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;IAEzE,yDAAyD;IACzD,IAAI,aAAa,GAAkB,IAAI,CAAA;IACvC,IAAI,oBAAoB,EAAE,IAAI,EAAE,CAAC;QAC/B,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAA;IAC3C,CAAC;SAAM,IAAI,aAAa,EAAE,CAAC;QACzB,iEAAiE;QACjE,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC1C,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CA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AC;IAED,MAAM,CAAC,GAAG,CACR,mCAAmC,oBAAoB,CAAC,IAAI,IAAI,kBAAkB,EAAE,CACrF,CAAA;IAED,yDAAyD;IACzD,MAAM,oBAAoB,GAAG,CAC3B,KAAC,oBAAoB,IACnB,aAAa,EAAE,oBAAoB,CAAC,IAAI,EACxC,WAAW,EAAE,kBAAkB,GAC/B,CACH,CAAA;IAED,QAAQ,CAAC,QAAQ,CAAC;QAChB,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;QACxE,WAAW,EAAE,EAAE;KAChB,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;AAC1B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download.test.d.ts","sourceRoot":"","sources":["../../src/store-api/download.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from 'bun:test';
|
|
2
|
-
import { downloadExtension } from './download';
|
|
3
|
-
describe('downloadExtension', () => {
|
|
4
|
-
test('downloads a real raycast extension and returns filenames', async () => {
|
|
5
|
-
// Test with a timeout since it needs to download from the API
|
|
6
|
-
const files = await downloadExtension({
|
|
7
|
-
author: 'xmorse',
|
|
8
|
-
extension: 'spiceblow-database',
|
|
9
|
-
});
|
|
10
|
-
const filenames = files.map((f) => f.filename).sort();
|
|
11
|
-
// Just check we get some files
|
|
12
|
-
expect(filenames).toMatchInlineSnapshot(`
|
|
13
|
-
[
|
|
14
|
-
"assets/extension-icon.png",
|
|
15
|
-
"package.json",
|
|
16
|
-
"search-database.js",
|
|
17
|
-
"search-database.js.map",
|
|
18
|
-
]
|
|
19
|
-
`);
|
|
20
|
-
expect(filenames.length).toBeGreaterThan(0);
|
|
21
|
-
// Check package.json commands field
|
|
22
|
-
const packageJson = files.find((f) => f.filename === 'package.json');
|
|
23
|
-
const packageData = JSON.parse(packageJson?.buffer.toString());
|
|
24
|
-
expect(packageData.commands).toMatchInlineSnapshot(`
|
|
25
|
-
[
|
|
26
|
-
{
|
|
27
|
-
"description": "Search and update your PostgreSQL or MySQL database",
|
|
28
|
-
"mode": "view",
|
|
29
|
-
"name": "search-database",
|
|
30
|
-
"title": "Manage Database",
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
|
-
`);
|
|
34
|
-
}, 10000);
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=download.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download.test.js","sourceRoot":"","sources":["../../src/store-api/download.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9C,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QAC1E,8DAA8D;QAC9D,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC;YACpC,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,oBAAoB;SAChC,CAAC,CAAA;QAEF,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAA;QAErD,+BAA+B;QAC/B,MAAM,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC;;;;;;;SAOnC,CAAC,CAAA;QACN,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;QAE3C,oCAAoC;QACpC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,cAAc,CAAC,CAAA;QACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAG,CAAC,CAAA;QAC/D,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;SAS9C,CAAC,CAAA;IACR,CAAC,EAAE,KAAK,CAAC,CAAA;AACX,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.test.d.ts","sourceRoot":"","sources":["../../src/store-api/extension.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from 'bun:test';
|
|
2
|
-
import { fetchExtension } from './extension';
|
|
3
|
-
describe('fetchExtension', () => {
|
|
4
|
-
test('fetches a raycast extension metadata', async () => {
|
|
5
|
-
const extension = await fetchExtension({
|
|
6
|
-
author: 'xmorse',
|
|
7
|
-
extension: 'spiceblow-database',
|
|
8
|
-
});
|
|
9
|
-
// Check basic structure
|
|
10
|
-
expect(extension.id).toBeTruthy();
|
|
11
|
-
expect(extension.name).toBe('spiceblow-database');
|
|
12
|
-
expect(extension.author.handle).toBe('xmorse');
|
|
13
|
-
// Snapshot the command names
|
|
14
|
-
const commandNames = extension.commands.map((c) => c.name).sort();
|
|
15
|
-
expect(commandNames).toMatchInlineSnapshot(`
|
|
16
|
-
[
|
|
17
|
-
"search-database",
|
|
18
|
-
]
|
|
19
|
-
`);
|
|
20
|
-
}, 10000);
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=extension.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.test.js","sourceRoot":"","sources":["../../src/store-api/extension.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC;YACrC,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,oBAAoB;SAChC,CAAC,CAAA;QAEF,wBAAwB;QACxB,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;QACjC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;QACjD,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAE9C,6BAA6B;QAC7B,MAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;QACjE,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC;;;;SAItC,CAAC,CAAA;IACR,CAAC,EAAE,KAAK,CAAC,CAAA;AACX,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.test.d.ts","sourceRoot":"","sources":["../../src/store-api/search.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from 'bun:test';
|
|
2
|
-
import { searchStoreListings } from './search';
|
|
3
|
-
describe('searchStoreListings', () => {
|
|
4
|
-
test('searches for extensions in the store', async () => {
|
|
5
|
-
const results = await searchStoreListings({
|
|
6
|
-
query: 'database',
|
|
7
|
-
perPage: 5,
|
|
8
|
-
});
|
|
9
|
-
// Check we got results
|
|
10
|
-
expect(results.data).toBeDefined();
|
|
11
|
-
expect(results.data.length).toBeGreaterThan(0);
|
|
12
|
-
expect(results.data.length).toBeLessThanOrEqual(5);
|
|
13
|
-
// Snapshot the extension names
|
|
14
|
-
const extensionNames = results.data.map((d) => d.name).sort();
|
|
15
|
-
expect(extensionNames).toMatchInlineSnapshot(`
|
|
16
|
-
[
|
|
17
|
-
"discogs",
|
|
18
|
-
"notion",
|
|
19
|
-
"spiceblow-database",
|
|
20
|
-
"tmdb",
|
|
21
|
-
"turso",
|
|
22
|
-
]
|
|
23
|
-
`);
|
|
24
|
-
}, 10000);
|
|
25
|
-
test.skip('returns results when searching without a query', async () => {
|
|
26
|
-
const results = await searchStoreListings({
|
|
27
|
-
query: '',
|
|
28
|
-
perPage: 5,
|
|
29
|
-
});
|
|
30
|
-
expect(results.data).toBeDefined();
|
|
31
|
-
expect(results.data.length).toBeGreaterThan(0);
|
|
32
|
-
expect(results.data.length).toBeLessThanOrEqual(5);
|
|
33
|
-
const extensionNames = results.data.map((d) => d.name).sort();
|
|
34
|
-
expect(extensionNames).toMatchInlineSnapshot(`
|
|
35
|
-
[
|
|
36
|
-
"baidu-ocr",
|
|
37
|
-
"fhir",
|
|
38
|
-
"gitee",
|
|
39
|
-
"mobius-materials",
|
|
40
|
-
"xpf-converter",
|
|
41
|
-
]
|
|
42
|
-
`);
|
|
43
|
-
}, 10000);
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=search.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.test.js","sourceRoot":"","sources":["../../src/store-api/search.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC;YACxC,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,CAAC;SACX,CAAC,CAAA;QAEF,uBAAuB;QACvB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC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-
import { type CommandWithFile } from './package-json';
|
|
2
|
-
interface BundledCommand extends CommandWithFile {
|
|
3
|
-
bundledPath: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function resolveCommandPath({ commandName, dir, }: {
|
|
6
|
-
commandName: string;
|
|
7
|
-
dir: string;
|
|
8
|
-
}): string;
|
|
9
|
-
interface StoredExtension {
|
|
10
|
-
name: string;
|
|
11
|
-
packageJsonPath: string;
|
|
12
|
-
commands: BundledCommand[];
|
|
13
|
-
}
|
|
14
|
-
export declare function getStoreDirectory(): string;
|
|
15
|
-
export declare function installExtension({ extensionName, extensionSourcePath, }: {
|
|
16
|
-
extensionName: string;
|
|
17
|
-
extensionSourcePath: string;
|
|
18
|
-
}): void;
|
|
19
|
-
export declare function getStoredExtensions(): StoredExtension[];
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE3E,UAAU,cAAe,SAAQ,eAAe;IAC9C,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,GAAG,GACJ,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,MAAM,CAgBT;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,aAAa,EACb,mBAAmB,GACpB,EAAE;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,GAAG,IAAI,CAgBP;AAED,wBAAgB,mBAAmB,IAAI,eAAe,EAAE,CAkDvD"}
|
package/dist/store.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import { logger } from './logger';
|
|
5
|
-
import { getCommandsWithFiles } from './package-json';
|
|
6
|
-
export function resolveCommandPath({ commandName, dir, }) {
|
|
7
|
-
// First check for .termcast-bundle directory
|
|
8
|
-
const bundleDir = path.join(dir, '.termcast-bundle');
|
|
9
|
-
const bundledPath = path.join(bundleDir, `${commandName}.js`);
|
|
10
|
-
if (fs.existsSync(bundledPath)) {
|
|
11
|
-
return bundledPath;
|
|
12
|
-
}
|
|
13
|
-
// Then check for top-level command file
|
|
14
|
-
const topLevelPath = path.join(dir, `${commandName}.js`);
|
|
15
|
-
if (fs.existsSync(topLevelPath)) {
|
|
16
|
-
return topLevelPath;
|
|
17
|
-
}
|
|
18
|
-
// Return empty string if not found
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
export function getStoreDirectory() {
|
|
22
|
-
const homeDir = os.homedir();
|
|
23
|
-
const storeDir = path.join(homeDir, '.termcast', 'store');
|
|
24
|
-
// Ensure store directory exists
|
|
25
|
-
if (!fs.existsSync(storeDir)) {
|
|
26
|
-
fs.mkdirSync(storeDir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
return storeDir;
|
|
29
|
-
}
|
|
30
|
-
export function installExtension({ extensionName, extensionSourcePath, }) {
|
|
31
|
-
const storeDir = getStoreDirectory();
|
|
32
|
-
const extensionDir = path.join(storeDir, extensionName);
|
|
33
|
-
// Remove existing extension directory if it exists
|
|
34
|
-
if (fs.existsSync(extensionDir)) {
|
|
35
|
-
fs.rmSync(extensionDir, { recursive: true, force: true });
|
|
36
|
-
}
|
|
37
|
-
// Create extension directory
|
|
38
|
-
fs.mkdirSync(extensionDir, { recursive: true });
|
|
39
|
-
// Copy entire extension source directory
|
|
40
|
-
fs.cpSync(extensionSourcePath, extensionDir, { recursive: true });
|
|
41
|
-
logger.log(`Extension '${extensionName}' installed to ${extensionDir}`);
|
|
42
|
-
}
|
|
43
|
-
export function getStoredExtensions() {
|
|
44
|
-
const storeDir = getStoreDirectory();
|
|
45
|
-
const extensions = [];
|
|
46
|
-
if (!fs.existsSync(storeDir)) {
|
|
47
|
-
return extensions;
|
|
48
|
-
}
|
|
49
|
-
const entries = fs.readdirSync(storeDir, { withFileTypes: true });
|
|
50
|
-
for (const entry of entries) {
|
|
51
|
-
if (!entry.isDirectory())
|
|
52
|
-
continue;
|
|
53
|
-
const extensionDir = path.join(storeDir, entry.name);
|
|
54
|
-
const packageJsonPath = path.join(extensionDir, 'package.json');
|
|
55
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
56
|
-
logger.log(`Skipping ${entry.name}: no package.json found`);
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
const commandsData = getCommandsWithFiles({ packageJsonPath });
|
|
61
|
-
// Map commands to bundled commands using the resolver
|
|
62
|
-
const bundledCommands = commandsData.commands.map((command) => {
|
|
63
|
-
const bundledPath = resolveCommandPath({
|
|
64
|
-
commandName: command.name,
|
|
65
|
-
dir: extensionDir,
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
...command,
|
|
69
|
-
bundledPath,
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
extensions.push({
|
|
73
|
-
name: entry.name,
|
|
74
|
-
packageJsonPath,
|
|
75
|
-
commands: bundledCommands,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
logger.error(`Failed to load extension ${entry.name}:`, error.message);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return extensions;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
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D,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;QAE/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACpC,MAAM,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,IAAI,yBAAyB,CAAC,CAAA;YAC3D,SAAQ;QACV,CAAC;QAED,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,oBAAoB,CAAC,EAAE,eAAe,EAAE,CAAC,CAAA;YAE9D,sDAAsD;YACtD,MAAM,eAAe,GAAqB,YAAY,CAAC,QAAQ,CAAC,GAAG,CACjE,CAAC,OAAO,EAAE,EAAE;gBACV,MAAM,WAAW,GAAG,kBAAkB,CAAC;oBACrC,WAAW,EAAE,OAAO,CAAC,IAAI;oBACzB,GAAG,EAAE,YAAY;iBAClB,CAAC,CAAA;gBAEF,OAAO;oBACL,GAAG,OAAO;oBACV,WAAW;iBACZ,CAAA;YACH,CAAC,CACF,CAAA;YAED,UAAU,CAAC,IAAI,CAAC;gBACd,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,eAAe;gBACf,QAAQ,EAAE,eAAe;aAC1B,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,KAAK,CAAC,4BAA4B,KAAK,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QACxE,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
package/dist/toast.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare namespace Toast {
|
|
2
|
-
interface Options {
|
|
3
|
-
title: string;
|
|
4
|
-
message?: string;
|
|
5
|
-
style?: Style;
|
|
6
|
-
primaryAction?: ActionOptions;
|
|
7
|
-
secondaryAction?: ActionOptions;
|
|
8
|
-
}
|
|
9
|
-
interface ActionOptions {
|
|
10
|
-
title: string;
|
|
11
|
-
shortcut?: any;
|
|
12
|
-
onAction: (toast: Toast) => void;
|
|
13
|
-
}
|
|
14
|
-
type Style = 'SUCCESS' | 'FAILURE' | 'ANIMATED';
|
|
15
|
-
}
|
|
16
|
-
export declare class Toast {
|
|
17
|
-
private options;
|
|
18
|
-
private id;
|
|
19
|
-
private callbacks;
|
|
20
|
-
static Style: {
|
|
21
|
-
Success: Toast.Style;
|
|
22
|
-
Failure: Toast.Style;
|
|
23
|
-
Animated: Toast.Style;
|
|
24
|
-
};
|
|
25
|
-
constructor(props: Toast.Options);
|
|
26
|
-
get style(): Toast.Style;
|
|
27
|
-
set style(style: Toast.Style);
|
|
28
|
-
get title(): string;
|
|
29
|
-
set title(title: string);
|
|
30
|
-
get message(): string | undefined;
|
|
31
|
-
set message(message: string | undefined);
|
|
32
|
-
get primaryAction(): Toast.ActionOptions | undefined;
|
|
33
|
-
set primaryAction(action: Toast.ActionOptions | undefined);
|
|
34
|
-
get secondaryAction(): Toast.ActionOptions | undefined;
|
|
35
|
-
set secondaryAction(action: Toast.ActionOptions | undefined);
|
|
36
|
-
show(): Promise<void>;
|
|
37
|
-
hide(): Promise<void>;
|
|
38
|
-
private update;
|
|
39
|
-
_setCallbacks(callbacks: typeof this.callbacks): void;
|
|
40
|
-
_getId(): string;
|
|
41
|
-
}
|
|
42
|
-
export declare function showToast(options: Toast.Options): Promise<Toast>;
|
|
43
|
-
export declare function showToast(style: Toast.Style, title: string, message?: string): Promise<Toast>;
|
|
44
|
-
//# sourceMappingURL=toast.d.ts.map
|
package/dist/toast.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../src/toast.tsx"],"names":[],"mappings":"AAQA,yBAAiB,KAAK,CAAC;IACrB,UAAiB,OAAO;QACtB,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,KAAK,CAAC,EAAE,KAAK,CAAA;QACb,aAAa,CAAC,EAA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AAO,IAAI,CAAC,SAAS,GAAG,IAAI;IAIrD,MAAM,IAAI,MAAM;CAGjB;AAmLD,wBAAsB,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;AACvE,wBAAsB,SAAS,CAC7B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,KAAK,CAAC,CAAA"}
|
package/dist/toast.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { Theme } from '@termcast/cli/src/theme';
|
|
4
|
-
import { TextAttributes } from '@opentui/core';
|
|
5
|
-
import { useStore } from '@termcast/cli/src/state';
|
|
6
|
-
import { useKeyboard, useTerminalDimensions } from '@opentui/react';
|
|
7
|
-
import { useIsInFocus } from '@termcast/cli/src/internal/focus-context';
|
|
8
|
-
export class Toast {
|
|
9
|
-
options;
|
|
10
|
-
id;
|
|
11
|
-
callbacks = {};
|
|
12
|
-
static Style = {
|
|
13
|
-
Success: 'SUCCESS',
|
|
14
|
-
Failure: 'FAILURE',
|
|
15
|
-
Animated: 'ANIMATED',
|
|
16
|
-
};
|
|
17
|
-
constructor(props) {
|
|
18
|
-
this.options = { ...props };
|
|
19
|
-
this.id = Math.random().toString(36).substring(7);
|
|
20
|
-
// Bind all methods to this instance
|
|
21
|
-
this.show = this.show.bind(this);
|
|
22
|
-
this.hide = this.hide.bind(this);
|
|
23
|
-
this.update = this.update.bind(this);
|
|
24
|
-
this._setCallbacks = this._setCallbacks.bind(this);
|
|
25
|
-
this._getId = this._getId.bind(this);
|
|
26
|
-
}
|
|
27
|
-
get style() {
|
|
28
|
-
return this.options.style || Toast.Style.Success;
|
|
29
|
-
}
|
|
30
|
-
set style(style) {
|
|
31
|
-
this.options.style = style;
|
|
32
|
-
this.update();
|
|
33
|
-
}
|
|
34
|
-
get title() {
|
|
35
|
-
return this.options.title;
|
|
36
|
-
}
|
|
37
|
-
set title(title) {
|
|
38
|
-
this.options.title = title;
|
|
39
|
-
this.update();
|
|
40
|
-
}
|
|
41
|
-
get message() {
|
|
42
|
-
return this.options.message;
|
|
43
|
-
}
|
|
44
|
-
set message(message) {
|
|
45
|
-
this.options.message = message;
|
|
46
|
-
this.update();
|
|
47
|
-
}
|
|
48
|
-
get primaryAction() {
|
|
49
|
-
return this.options.primaryAction;
|
|
50
|
-
}
|
|
51
|
-
set primaryAction(action) {
|
|
52
|
-
this.options.primaryAction = action;
|
|
53
|
-
this.update();
|
|
54
|
-
}
|
|
55
|
-
get secondaryAction() {
|
|
56
|
-
return this.options.secondaryAction;
|
|
57
|
-
}
|
|
58
|
-
set secondaryAction(action) {
|
|
59
|
-
this.options.secondaryAction = action;
|
|
60
|
-
this.update();
|
|
61
|
-
}
|
|
62
|
-
async show() {
|
|
63
|
-
showToastInternal(this);
|
|
64
|
-
}
|
|
65
|
-
async hide() {
|
|
66
|
-
useStore.setState({ toast: null });
|
|
67
|
-
if (this.callbacks.onHide) {
|
|
68
|
-
this.callbacks.onHide();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
update() {
|
|
72
|
-
if (this.callbacks.onUpdate) {
|
|
73
|
-
this.callbacks.onUpdate(this);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
_setCallbacks(callbacks) {
|
|
77
|
-
this.callbacks = callbacks;
|
|
78
|
-
}
|
|
79
|
-
_getId() {
|
|
80
|
-
return this.id;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function ToastComponent({ toast, onHide }) {
|
|
84
|
-
const [, forceUpdate] = useState(0);
|
|
85
|
-
const dimensions = useTerminalDimensions();
|
|
86
|
-
const inFocus = useIsInFocus();
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
const onUpdate = () => {
|
|
89
|
-
forceUpdate((n) => n + 1);
|
|
90
|
-
};
|
|
91
|
-
toast._setCallbacks({ onUpdate, onHide });
|
|
92
|
-
return () => {
|
|
93
|
-
toast._setCallbacks({});
|
|
94
|
-
};
|
|
95
|
-
}, [toast, onHide]);
|
|
96
|
-
const getIcon = () => {
|
|
97
|
-
switch (toast.style) {
|
|
98
|
-
case Toast.Style.Success:
|
|
99
|
-
return '✓';
|
|
100
|
-
case Toast.Style.Failure:
|
|
101
|
-
return '✗';
|
|
102
|
-
case Toast.Style.Animated:
|
|
103
|
-
return '⣾⣽⣻⢿⡿⣟⣯⣷';
|
|
104
|
-
default:
|
|
105
|
-
return '✓';
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const getIconColor = () => {
|
|
109
|
-
switch (toast.style) {
|
|
110
|
-
case Toast.Style.Success:
|
|
111
|
-
return Theme.success;
|
|
112
|
-
case Toast.Style.Failure:
|
|
113
|
-
return Theme.error;
|
|
114
|
-
case Toast.Style.Animated:
|
|
115
|
-
return Theme.primary;
|
|
116
|
-
default:
|
|
117
|
-
return Theme.success;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const [animationFrame, setAnimationFrame] = useState(0);
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
if (toast.style === Toast.Style.Animated) {
|
|
123
|
-
const interval = setInterval(() => {
|
|
124
|
-
setAnimationFrame((prev) => (prev + 1) % 8);
|
|
125
|
-
}, 100);
|
|
126
|
-
return () => clearInterval(interval);
|
|
127
|
-
}
|
|
128
|
-
}, [toast.style]);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (toast.style !== Toast.Style.Animated) {
|
|
131
|
-
// Use longer duration for error toasts
|
|
132
|
-
const duration = toast.style === Toast.Style.Failure ? 8000 : 5000;
|
|
133
|
-
const timer = setTimeout(() => {
|
|
134
|
-
onHide();
|
|
135
|
-
}, duration);
|
|
136
|
-
return () => clearTimeout(timer);
|
|
137
|
-
}
|
|
138
|
-
}, [toast.style, onHide]);
|
|
139
|
-
const icon = toast.style === Toast.Style.Animated ? getIcon()[animationFrame] : getIcon();
|
|
140
|
-
useKeyboard((evt) => {
|
|
141
|
-
if (!inFocus)
|
|
142
|
-
return;
|
|
143
|
-
if (evt.name === 'escape') {
|
|
144
|
-
onHide();
|
|
145
|
-
}
|
|
146
|
-
else if (toast.primaryAction && evt.name === 'enter') {
|
|
147
|
-
toast.primaryAction.onAction(toast);
|
|
148
|
-
}
|
|
149
|
-
else if (toast.secondaryAction && evt.name === 'tab') {
|
|
150
|
-
toast.secondaryAction.onAction(toast);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
// TODO use flexWrap when implemented
|
|
154
|
-
const wrapText = (text, maxWidth) => {
|
|
155
|
-
if (!text)
|
|
156
|
-
return [];
|
|
157
|
-
const words = text.split(' ');
|
|
158
|
-
const lines = [];
|
|
159
|
-
let currentLine = '';
|
|
160
|
-
for (const word of words) {
|
|
161
|
-
const testLine = currentLine ? `${currentLine} ${word}` : word;
|
|
162
|
-
if (testLine.length <= maxWidth) {
|
|
163
|
-
currentLine = testLine;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
if (currentLine) {
|
|
167
|
-
lines.push(currentLine);
|
|
168
|
-
}
|
|
169
|
-
currentLine = word;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (currentLine) {
|
|
173
|
-
lines.push(currentLine);
|
|
174
|
-
}
|
|
175
|
-
return lines.slice(0, 3);
|
|
176
|
-
};
|
|
177
|
-
const iconLength = 2;
|
|
178
|
-
const titleLength = toast.title.length;
|
|
179
|
-
const actionsLength = (() => {
|
|
180
|
-
let length = 0;
|
|
181
|
-
if (toast.primaryAction) {
|
|
182
|
-
length += toast.primaryAction.title.length + 4;
|
|
183
|
-
}
|
|
184
|
-
if (toast.secondaryAction) {
|
|
185
|
-
length += toast.secondaryAction.title.length + 4;
|
|
186
|
-
}
|
|
187
|
-
return length;
|
|
188
|
-
})();
|
|
189
|
-
const availableWidth = dimensions.width - iconLength - titleLength - actionsLength - 8;
|
|
190
|
-
const messageLines = toast.message
|
|
191
|
-
? wrapText(toast.message, Math.max(20, availableWidth))
|
|
192
|
-
: [];
|
|
193
|
-
return (_jsxs("box", { borderColor: Theme.border, paddingLeft: 1, paddingRight: 1, flexDirection: 'column', children: [_jsxs("box", { flexDirection: 'row', alignItems: 'center', children: [_jsxs("text", { fg: getIconColor(), children: [icon, " "] }), _jsx("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: toast.title }), messageLines.length > 0 && (_jsxs("text", { fg: Theme.textMuted, children: [" - ", messageLines[0]] })), toast.primaryAction && (_jsxs("text", { fg: Theme.primary, children: [" [", toast.primaryAction.title, " \u21B5]"] })), toast.secondaryAction && (_jsxs("text", { fg: Theme.textMuted, children: [" [", toast.secondaryAction.title, " \u21E5]"] }))] }), messageLines.slice(1).map((line, index) => (_jsx("box", { paddingLeft: iconLength + titleLength + 3, children: _jsx("text", { fg: Theme.textMuted, children: line }) }, index)))] }));
|
|
194
|
-
}
|
|
195
|
-
let currentToastInstance = null;
|
|
196
|
-
function showToastInternal(toast) {
|
|
197
|
-
currentToastInstance = toast;
|
|
198
|
-
useStore.setState({
|
|
199
|
-
toast: (_jsx(ToastComponent, { toast: toast, onHide: () => {
|
|
200
|
-
useStore.setState({ toast: null });
|
|
201
|
-
currentToastInstance = null;
|
|
202
|
-
} })),
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
export async function showToast(optionsOrStyle, title, message) {
|
|
206
|
-
let options;
|
|
207
|
-
if (typeof optionsOrStyle === 'string') {
|
|
208
|
-
options = {
|
|
209
|
-
style: optionsOrStyle,
|
|
210
|
-
title: title,
|
|
211
|
-
message,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
options = optionsOrStyle;
|
|
216
|
-
}
|
|
217
|
-
const toast = new Toast(options);
|
|
218
|
-
await toast.show();
|
|
219
|
-
return toast;
|
|
220
|
-
}
|
|
221
|
-
//# sourceMappingURL=toast.js.map
|