termcast 1.3.9
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/action-utils.d.ts +25 -0
- package/dist/action-utils.d.ts.map +1 -0
- package/dist/action-utils.js +209 -0
- package/dist/action-utils.js.map +1 -0
- package/dist/ai.d.ts +104 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +135 -0
- package/dist/ai.js.map +1 -0
- package/dist/apis/ai.d.ts +104 -0
- package/dist/apis/ai.d.ts.map +1 -0
- package/dist/apis/ai.js +135 -0
- package/dist/apis/ai.js.map +1 -0
- package/dist/apis/cache.d.ts +84 -0
- package/dist/apis/cache.d.ts.map +1 -0
- package/dist/apis/cache.js +307 -0
- package/dist/apis/cache.js.map +1 -0
- package/dist/apis/cache.test.d.ts +2 -0
- package/dist/apis/cache.test.d.ts.map +1 -0
- package/dist/apis/cache.test.js +246 -0
- package/dist/apis/cache.test.js.map +1 -0
- package/dist/apis/clipboard.d.ts +36 -0
- package/dist/apis/clipboard.d.ts.map +1 -0
- package/dist/apis/clipboard.js +154 -0
- package/dist/apis/clipboard.js.map +1 -0
- package/dist/apis/environment.d.ts +63 -0
- package/dist/apis/environment.d.ts.map +1 -0
- package/dist/apis/environment.js +189 -0
- package/dist/apis/environment.js.map +1 -0
- package/dist/apis/hud.d.ts +7 -0
- package/dist/apis/hud.d.ts.map +1 -0
- package/dist/apis/hud.js +45 -0
- package/dist/apis/hud.js.map +1 -0
- package/dist/apis/localstorage.d.ts +13 -0
- package/dist/apis/localstorage.d.ts.map +1 -0
- package/dist/apis/localstorage.js +190 -0
- package/dist/apis/localstorage.js.map +1 -0
- package/dist/apis/localstorage.test.d.ts +2 -0
- package/dist/apis/localstorage.test.d.ts.map +1 -0
- package/dist/apis/localstorage.test.js +131 -0
- package/dist/apis/localstorage.test.js.map +1 -0
- package/dist/apis/oauth.d.ts +142 -0
- package/dist/apis/oauth.d.ts.map +1 -0
- package/dist/apis/oauth.js +551 -0
- package/dist/apis/oauth.js.map +1 -0
- package/dist/apis/preferences.d.ts +23 -0
- package/dist/apis/preferences.d.ts.map +1 -0
- package/dist/apis/preferences.js +105 -0
- package/dist/apis/preferences.js.map +1 -0
- package/dist/apis/toast.d.ts +81 -0
- package/dist/apis/toast.d.ts.map +1 -0
- package/dist/apis/toast.js +275 -0
- package/dist/apis/toast.js.map +1 -0
- package/dist/apis/toast.test.d.ts +2 -0
- package/dist/apis/toast.test.d.ts.map +1 -0
- package/dist/apis/toast.test.js +67 -0
- package/dist/apis/toast.test.js.map +1 -0
- package/dist/apis/window.d.ts +12 -0
- package/dist/apis/window.d.ts.map +1 -0
- package/dist/apis/window.js +47 -0
- package/dist/apis/window.js.map +1 -0
- package/dist/build.d.ts +15 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +213 -0
- package/dist/build.js.map +1 -0
- package/dist/build.test.d.ts +2 -0
- package/dist/build.test.d.ts.map +1 -0
- package/dist/build.test.js +73 -0
- package/dist/build.test.js.map +1 -0
- package/dist/cache.d.ts +32 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +205 -0
- package/dist/cache.js.map +1 -0
- package/dist/cache.test.d.ts +2 -0
- package/dist/cache.test.d.ts.map +1 -0
- package/dist/cache.test.js +246 -0
- package/dist/cache.test.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +278 -0
- package/dist/cli.js.map +1 -0
- package/dist/clipboard.d.ts +36 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +154 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/colors.d.ts +15 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +13 -0
- package/dist/colors.js.map +1 -0
- package/dist/components/actions.d.ts +120 -0
- package/dist/components/actions.d.ts.map +1 -0
- package/dist/components/actions.js +371 -0
- package/dist/components/actions.js.map +1 -0
- package/dist/components/alert.d.ts +25 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +99 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/detail.d.ts +65 -0
- package/dist/components/detail.d.ts.map +1 -0
- package/dist/components/detail.js +147 -0
- package/dist/components/detail.js.map +1 -0
- package/dist/components/dropdown.d.ts +40 -0
- package/dist/components/dropdown.d.ts.map +1 -0
- package/dist/components/dropdown.js +202 -0
- package/dist/components/dropdown.js.map +1 -0
- package/dist/components/extension-preferences.d.ts +8 -0
- package/dist/components/extension-preferences.d.ts.map +1 -0
- package/dist/components/extension-preferences.js +139 -0
- package/dist/components/extension-preferences.js.map +1 -0
- package/dist/components/form/assign-components.d.ts +2 -0
- package/dist/components/form/assign-components.d.ts.map +1 -0
- package/dist/components/form/assign-components.js +22 -0
- package/dist/components/form/assign-components.js.map +1 -0
- package/dist/components/form/checkbox.d.ts +7 -0
- package/dist/components/form/checkbox.d.ts.map +1 -0
- package/dist/components/form/checkbox.js +46 -0
- package/dist/components/form/checkbox.js.map +1 -0
- package/dist/components/form/date-picker.d.ts +18 -0
- package/dist/components/form/date-picker.d.ts.map +1 -0
- package/dist/components/form/date-picker.js +69 -0
- package/dist/components/form/date-picker.js.map +1 -0
- package/dist/components/form/description.d.ts +7 -0
- package/dist/components/form/description.d.ts.map +1 -0
- package/dist/components/form/description.js +8 -0
- package/dist/components/form/description.js.map +1 -0
- package/dist/components/form/dropdown.d.ts +25 -0
- package/dist/components/form/dropdown.d.ts.map +1 -0
- package/dist/components/form/dropdown.js +286 -0
- package/dist/components/form/dropdown.js.map +1 -0
- package/dist/components/form/file-autocomplete.d.ts +12 -0
- package/dist/components/form/file-autocomplete.d.ts.map +1 -0
- package/dist/components/form/file-autocomplete.js +84 -0
- package/dist/components/form/file-autocomplete.js.map +1 -0
- package/dist/components/form/file-picker.d.ts +31 -0
- package/dist/components/form/file-picker.d.ts.map +1 -0
- package/dist/components/form/file-picker.js +113 -0
- package/dist/components/form/file-picker.js.map +1 -0
- package/dist/components/form/form-end.d.ts +2 -0
- package/dist/components/form/form-end.d.ts.map +1 -0
- package/dist/components/form/form-end.js +6 -0
- package/dist/components/form/form-end.js.map +1 -0
- package/dist/components/form/form-type-only.d.ts +174 -0
- package/dist/components/form/form-type-only.d.ts.map +1 -0
- package/dist/components/form/form-type-only.js +2 -0
- package/dist/components/form/form-type-only.js.map +1 -0
- package/dist/components/form/index.d.ts +46 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/index.js +106 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/form/password-field.d.ts +7 -0
- package/dist/components/form/password-field.d.ts.map +1 -0
- package/dist/components/form/password-field.js +34 -0
- package/dist/components/form/password-field.js.map +1 -0
- package/dist/components/form/separator.d.ts +2 -0
- package/dist/components/form/separator.d.ts.map +1 -0
- package/dist/components/form/separator.js +8 -0
- package/dist/components/form/separator.js.map +1 -0
- package/dist/components/form/tagpicker.d.ts +134 -0
- package/dist/components/form/tagpicker.d.ts.map +1 -0
- package/dist/components/form/tagpicker.js +79 -0
- package/dist/components/form/tagpicker.js.map +1 -0
- package/dist/components/form/text-area.d.ts +8 -0
- package/dist/components/form/text-area.d.ts.map +1 -0
- package/dist/components/form/text-area.js +26 -0
- package/dist/components/form/text-area.js.map +1 -0
- package/dist/components/form/text-field.d.ts +7 -0
- package/dist/components/form/text-field.d.ts.map +1 -0
- package/dist/components/form/text-field.js +28 -0
- package/dist/components/form/text-field.js.map +1 -0
- package/dist/components/form/types.d.ts +43 -0
- package/dist/components/form/types.d.ts.map +1 -0
- package/dist/components/form/types.js +2 -0
- package/dist/components/form/types.js.map +1 -0
- package/dist/components/form/use-form-handling.d.ts +4 -0
- package/dist/components/form/use-form-handling.d.ts.map +1 -0
- package/dist/components/form/use-form-handling.js +37 -0
- package/dist/components/form/use-form-handling.js.map +1 -0
- package/dist/components/form/use-form-navigation.d.ts +8 -0
- package/dist/components/form/use-form-navigation.d.ts.map +1 -0
- package/dist/components/form/use-form-navigation.js +58 -0
- package/dist/components/form/use-form-navigation.js.map +1 -0
- package/dist/components/form/with-left-border.d.ts +17 -0
- package/dist/components/form/with-left-border.d.ts.map +1 -0
- package/dist/components/form/with-left-border.js +10 -0
- package/dist/components/form/with-left-border.js.map +1 -0
- package/dist/components/icon.d.ts +9 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +485 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/image.d.ts +19 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +32 -0
- package/dist/components/image.js.map +1 -0
- package/dist/components/list.d.ts +234 -0
- package/dist/components/list.d.ts.map +1 -0
- package/dist/components/list.js +667 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/loading-bar.d.ts +8 -0
- package/dist/components/loading-bar.d.ts.map +1 -0
- package/dist/components/loading-bar.js +107 -0
- package/dist/components/loading-bar.js.map +1 -0
- package/dist/components/menubar-extra.d.ts +68 -0
- package/dist/components/menubar-extra.d.ts.map +1 -0
- package/dist/components/menubar-extra.js +39 -0
- package/dist/components/menubar-extra.js.map +1 -0
- package/dist/descendants.d.ts +25 -0
- package/dist/descendants.d.ts.map +1 -0
- package/dist/descendants.js +81 -0
- package/dist/descendants.js.map +1 -0
- package/dist/dev-ui.d.ts +7 -0
- package/dist/dev-ui.d.ts.map +1 -0
- package/dist/dev-ui.js +118 -0
- package/dist/dev-ui.js.map +1 -0
- package/dist/e2e-node.d.ts +63 -0
- package/dist/e2e-node.d.ts.map +1 -0
- package/dist/e2e-node.js +255 -0
- package/dist/e2e-node.js.map +1 -0
- package/dist/e2e.d.ts +39 -0
- package/dist/e2e.d.ts.map +1 -0
- package/dist/e2e.js +127 -0
- package/dist/e2e.js.map +1 -0
- package/dist/environment.d.ts +63 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +189 -0
- package/dist/environment.js.map +1 -0
- package/dist/examples/action-show-in-finder.d.ts +2 -0
- package/dist/examples/action-show-in-finder.d.ts.map +1 -0
- package/dist/examples/action-show-in-finder.js +13 -0
- package/dist/examples/action-show-in-finder.js.map +1 -0
- package/dist/examples/datepicker.d.ts +2 -0
- package/dist/examples/datepicker.d.ts.map +1 -0
- package/dist/examples/datepicker.js +344 -0
- package/dist/examples/datepicker.js.map +1 -0
- package/dist/examples/environment-test.d.ts +2 -0
- package/dist/examples/environment-test.d.ts.map +1 -0
- package/dist/examples/environment-test.js +28 -0
- package/dist/examples/environment-test.js.map +1 -0
- package/dist/examples/error-boundary.d.ts +6 -0
- package/dist/examples/error-boundary.d.ts.map +1 -0
- package/dist/examples/error-boundary.js +67 -0
- package/dist/examples/error-boundary.js.map +1 -0
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts +2 -0
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts.map +1 -0
- package/dist/examples/form-basic-arrow-keys.vitest.js +46 -0
- package/dist/examples/form-basic-arrow-keys.vitest.js.map +1 -0
- package/dist/examples/form-basic.d.ts +2 -0
- package/dist/examples/form-basic.d.ts.map +1 -0
- package/dist/examples/form-basic.js +21 -0
- package/dist/examples/form-basic.js.map +1 -0
- package/dist/examples/form-basic.vitest.d.ts +2 -0
- package/dist/examples/form-basic.vitest.d.ts.map +1 -0
- package/dist/examples/form-basic.vitest.js +995 -0
- package/dist/examples/form-basic.vitest.js.map +1 -0
- package/dist/examples/form-dropdown-with-sections.d.ts +2 -0
- package/dist/examples/form-dropdown-with-sections.d.ts.map +1 -0
- package/dist/examples/form-dropdown-with-sections.js +13 -0
- package/dist/examples/form-dropdown-with-sections.js.map +1 -0
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts +2 -0
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts.map +1 -0
- package/dist/examples/form-dropdown-with-sections.vitest.js +75 -0
- package/dist/examples/form-dropdown-with-sections.vitest.js.map +1 -0
- package/dist/examples/form-dropdown.d.ts +2 -0
- package/dist/examples/form-dropdown.d.ts.map +1 -0
- package/dist/examples/form-dropdown.js +13 -0
- package/dist/examples/form-dropdown.js.map +1 -0
- package/dist/examples/form-dropdown.vitest.d.ts +2 -0
- package/dist/examples/form-dropdown.vitest.d.ts.map +1 -0
- package/dist/examples/form-dropdown.vitest.js +722 -0
- package/dist/examples/form-dropdown.vitest.js.map +1 -0
- package/dist/examples/form-multiselect-dropdown.d.ts +2 -0
- package/dist/examples/form-multiselect-dropdown.d.ts.map +1 -0
- package/dist/examples/form-multiselect-dropdown.js +13 -0
- package/dist/examples/form-multiselect-dropdown.js.map +1 -0
- package/dist/examples/form-tagpicker.d.ts +2 -0
- package/dist/examples/form-tagpicker.d.ts.map +1 -0
- package/dist/examples/form-tagpicker.js +13 -0
- package/dist/examples/form-tagpicker.js.map +1 -0
- package/dist/examples/form-tagpicker.vitest.d.ts +2 -0
- package/dist/examples/form-tagpicker.vitest.d.ts.map +1 -0
- package/dist/examples/form-tagpicker.vitest.js +491 -0
- package/dist/examples/form-tagpicker.vitest.js.map +1 -0
- package/dist/examples/internal/descendants-filtering.d.ts +2 -0
- package/dist/examples/internal/descendants-filtering.d.ts.map +1 -0
- package/dist/examples/internal/descendants-filtering.js +144 -0
- package/dist/examples/internal/descendants-filtering.js.map +1 -0
- package/dist/examples/internal/descendants.d.ts +2 -0
- package/dist/examples/internal/descendants.d.ts.map +1 -0
- package/dist/examples/internal/descendants.js +134 -0
- package/dist/examples/internal/descendants.js.map +1 -0
- package/dist/examples/internal/nested-boxes.d.ts +2 -0
- package/dist/examples/internal/nested-boxes.d.ts.map +1 -0
- package/dist/examples/internal/nested-boxes.js +7 -0
- package/dist/examples/internal/nested-boxes.js.map +1 -0
- package/dist/examples/internal/scrollbox-demo.d.ts +2 -0
- package/dist/examples/internal/scrollbox-demo.d.ts.map +1 -0
- package/dist/examples/internal/scrollbox-demo.js +104 -0
- package/dist/examples/internal/scrollbox-demo.js.map +1 -0
- package/dist/examples/internal/simple-dialog.d.ts +2 -0
- package/dist/examples/internal/simple-dialog.d.ts.map +1 -0
- package/dist/examples/internal/simple-dialog.js +43 -0
- package/dist/examples/internal/simple-dialog.js.map +1 -0
- package/dist/examples/internal/text-stacking.d.ts +2 -0
- package/dist/examples/internal/text-stacking.d.ts.map +1 -0
- package/dist/examples/internal/text-stacking.js +53 -0
- package/dist/examples/internal/text-stacking.js.map +1 -0
- package/dist/examples/internal/unicode-square-repro.d.ts +2 -0
- package/dist/examples/internal/unicode-square-repro.d.ts.map +1 -0
- package/dist/examples/internal/unicode-square-repro.js +7 -0
- package/dist/examples/internal/unicode-square-repro.js.map +1 -0
- package/dist/examples/list-dropdown-default.d.ts +2 -0
- package/dist/examples/list-dropdown-default.d.ts.map +1 -0
- package/dist/examples/list-dropdown-default.js +14 -0
- package/dist/examples/list-dropdown-default.js.map +1 -0
- package/dist/examples/list-dropdown-default.vitest.d.ts +2 -0
- package/dist/examples/list-dropdown-default.vitest.d.ts.map +1 -0
- package/dist/examples/list-dropdown-default.vitest.js +164 -0
- package/dist/examples/list-dropdown-default.vitest.js.map +1 -0
- package/dist/examples/list-fetch-data.d.ts +2 -0
- package/dist/examples/list-fetch-data.d.ts.map +1 -0
- package/dist/examples/list-fetch-data.js +87 -0
- package/dist/examples/list-fetch-data.js.map +1 -0
- package/dist/examples/list-fetch-data.vitest.d.ts +2 -0
- package/dist/examples/list-fetch-data.vitest.d.ts.map +1 -0
- package/dist/examples/list-fetch-data.vitest.js +103 -0
- package/dist/examples/list-fetch-data.vitest.js.map +1 -0
- package/dist/examples/list-filter-navigation.d.ts +2 -0
- package/dist/examples/list-filter-navigation.d.ts.map +1 -0
- package/dist/examples/list-filter-navigation.js +8 -0
- package/dist/examples/list-filter-navigation.js.map +1 -0
- package/dist/examples/list-with-detail.d.ts +2 -0
- package/dist/examples/list-with-detail.d.ts.map +1 -0
- package/dist/examples/list-with-detail.js +94 -0
- package/dist/examples/list-with-detail.js.map +1 -0
- package/dist/examples/list-with-detail.vitest.d.ts +2 -0
- package/dist/examples/list-with-detail.vitest.d.ts.map +1 -0
- package/dist/examples/list-with-detail.vitest.js +438 -0
- package/dist/examples/list-with-detail.vitest.js.map +1 -0
- package/dist/examples/list-with-dropdown.d.ts +2 -0
- package/dist/examples/list-with-dropdown.d.ts.map +1 -0
- package/dist/examples/list-with-dropdown.js +43 -0
- package/dist/examples/list-with-dropdown.js.map +1 -0
- package/dist/examples/list-with-dropdown.vitest.d.ts +2 -0
- package/dist/examples/list-with-dropdown.vitest.d.ts.map +1 -0
- package/dist/examples/list-with-dropdown.vitest.js +297 -0
- package/dist/examples/list-with-dropdown.vitest.js.map +1 -0
- package/dist/examples/list-with-sections.d.ts +2 -0
- package/dist/examples/list-with-sections.d.ts.map +1 -0
- package/dist/examples/list-with-sections.js +67 -0
- package/dist/examples/list-with-sections.js.map +1 -0
- package/dist/examples/list-with-sections.vitest.d.ts +2 -0
- package/dist/examples/list-with-sections.vitest.d.ts.map +1 -0
- package/dist/examples/list-with-sections.vitest.js +441 -0
- package/dist/examples/list-with-sections.vitest.js.map +1 -0
- package/dist/examples/miscellaneous.d.ts +2 -0
- package/dist/examples/miscellaneous.d.ts.map +1 -0
- package/dist/examples/miscellaneous.js +313 -0
- package/dist/examples/miscellaneous.js.map +1 -0
- package/dist/examples/nested-navigation.d.ts +2 -0
- package/dist/examples/nested-navigation.d.ts.map +1 -0
- package/dist/examples/nested-navigation.js +35 -0
- package/dist/examples/nested-navigation.js.map +1 -0
- package/dist/examples/preferences-test.d.ts +2 -0
- package/dist/examples/preferences-test.d.ts.map +1 -0
- package/dist/examples/preferences-test.js +43 -0
- package/dist/examples/preferences-test.js.map +1 -0
- package/dist/examples/simple-dropdown.d.ts +2 -0
- package/dist/examples/simple-dropdown.d.ts.map +1 -0
- package/dist/examples/simple-dropdown.js +15 -0
- package/dist/examples/simple-dropdown.js.map +1 -0
- package/dist/examples/simple-file-picker.d.ts +2 -0
- package/dist/examples/simple-file-picker.d.ts.map +1 -0
- package/dist/examples/simple-file-picker.js +21 -0
- package/dist/examples/simple-file-picker.js.map +1 -0
- package/dist/examples/simple-file-picker.vitest.d.ts +2 -0
- package/dist/examples/simple-file-picker.vitest.d.ts.map +1 -0
- package/dist/examples/simple-file-picker.vitest.js +277 -0
- package/dist/examples/simple-file-picker.vitest.js.map +1 -0
- package/dist/examples/simple-grid.d.ts +2 -0
- package/dist/examples/simple-grid.d.ts.map +1 -0
- package/dist/examples/simple-grid.js +51 -0
- package/dist/examples/simple-grid.js.map +1 -0
- package/dist/examples/simple-grid.vitest.d.ts +2 -0
- package/dist/examples/simple-grid.vitest.d.ts.map +1 -0
- package/dist/examples/simple-grid.vitest.js +498 -0
- package/dist/examples/simple-grid.vitest.js.map +1 -0
- package/dist/examples/simple-hud.d.ts +2 -0
- package/dist/examples/simple-hud.d.ts.map +1 -0
- package/dist/examples/simple-hud.js +18 -0
- package/dist/examples/simple-hud.js.map +1 -0
- package/dist/examples/simple-list-search.d.ts +2 -0
- package/dist/examples/simple-list-search.d.ts.map +1 -0
- package/dist/examples/simple-list-search.js +26 -0
- package/dist/examples/simple-list-search.js.map +1 -0
- package/dist/examples/simple-list.d.ts +2 -0
- package/dist/examples/simple-list.d.ts.map +1 -0
- package/dist/examples/simple-list.js +50 -0
- package/dist/examples/simple-list.js.map +1 -0
- package/dist/examples/simple-navigation.d.ts +2 -0
- package/dist/examples/simple-navigation.d.ts.map +1 -0
- package/dist/examples/simple-navigation.js +36 -0
- package/dist/examples/simple-navigation.js.map +1 -0
- package/dist/examples/simple-navigation.vitest.d.ts +2 -0
- package/dist/examples/simple-navigation.vitest.d.ts.map +1 -0
- package/dist/examples/simple-navigation.vitest.js +522 -0
- package/dist/examples/simple-navigation.vitest.js.map +1 -0
- package/dist/examples/store.d.ts +2 -0
- package/dist/examples/store.d.ts.map +1 -0
- package/dist/examples/store.js +5 -0
- package/dist/examples/store.js.map +1 -0
- package/dist/examples/store.vitest.d.ts +2 -0
- package/dist/examples/store.vitest.d.ts.map +1 -0
- package/dist/examples/store.vitest.js +52 -0
- package/dist/examples/store.vitest.js.map +1 -0
- package/dist/examples/tanstack-demo.d.ts +2 -0
- package/dist/examples/tanstack-demo.d.ts.map +1 -0
- package/dist/examples/tanstack-demo.js +51 -0
- package/dist/examples/tanstack-demo.js.map +1 -0
- package/dist/examples/use-promise-demo.d.ts +2 -0
- package/dist/examples/use-promise-demo.d.ts.map +1 -0
- package/dist/examples/use-promise-demo.js +45 -0
- package/dist/examples/use-promise-demo.js.map +1 -0
- package/dist/extensions/dev.d.ts +7 -0
- package/dist/extensions/dev.d.ts.map +1 -0
- package/dist/extensions/dev.js +124 -0
- package/dist/extensions/dev.js.map +1 -0
- package/dist/extensions/home.d.ts +8 -0
- package/dist/extensions/home.d.ts.map +1 -0
- package/dist/extensions/home.js +184 -0
- package/dist/extensions/home.js.map +1 -0
- package/dist/extensions/store.d.ts +6 -0
- package/dist/extensions/store.d.ts.map +1 -0
- package/dist/extensions/store.js +203 -0
- package/dist/extensions/store.js.map +1 -0
- package/dist/globals.d.ts +9 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +21 -0
- package/dist/globals.js.map +1 -0
- package/dist/home-command.d.ts +8 -0
- package/dist/home-command.d.ts.map +1 -0
- package/dist/home-command.js +181 -0
- package/dist/home-command.js.map +1 -0
- package/dist/hooks/hooks.test.d.ts +2 -0
- package/dist/hooks/hooks.test.d.ts.map +1 -0
- package/dist/hooks/hooks.test.js +37 -0
- package/dist/hooks/hooks.test.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-action-panel.d.ts +16 -0
- package/dist/hooks/use-action-panel.d.ts.map +1 -0
- package/dist/hooks/use-action-panel.js +19 -0
- package/dist/hooks/use-action-panel.js.map +1 -0
- package/dist/hooks/use-id.d.ts +9 -0
- package/dist/hooks/use-id.d.ts.map +1 -0
- package/dist/hooks/use-id.js +17 -0
- package/dist/hooks/use-id.js.map +1 -0
- package/dist/hooks/use-unstable-ai.d.ts +9 -0
- package/dist/hooks/use-unstable-ai.d.ts.map +1 -0
- package/dist/hooks/use-unstable-ai.js +13 -0
- package/dist/hooks/use-unstable-ai.js.map +1 -0
- package/dist/hooks.d.ts +10 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +20 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hover-repro.d.ts +2 -0
- package/dist/hover-repro.d.ts.map +1 -0
- package/dist/hover-repro.js +20 -0
- package/dist/hover-repro.js.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/date-picker-widget.d.ts +9 -0
- package/dist/internal/date-picker-widget.d.ts.map +1 -0
- package/dist/internal/date-picker-widget.js +380 -0
- package/dist/internal/date-picker-widget.js.map +1 -0
- package/dist/internal/dialog.d.ts +21 -0
- package/dist/internal/dialog.d.ts.map +1 -0
- package/dist/internal/dialog.js +122 -0
- package/dist/internal/dialog.js.map +1 -0
- package/dist/internal/error-handler.d.ts +2 -0
- package/dist/internal/error-handler.d.ts.map +1 -0
- package/dist/internal/error-handler.js +29 -0
- package/dist/internal/error-handler.js.map +1 -0
- package/dist/internal/focus-context.d.ts +10 -0
- package/dist/internal/focus-context.d.ts.map +1 -0
- package/dist/internal/focus-context.js +12 -0
- package/dist/internal/focus-context.js.map +1 -0
- package/dist/internal/navigation.d.ts +18 -0
- package/dist/internal/navigation.d.ts.map +1 -0
- package/dist/internal/navigation.js +83 -0
- package/dist/internal/navigation.js.map +1 -0
- package/dist/internal/providers.d.ts +8 -0
- package/dist/internal/providers.d.ts.map +1 -0
- package/dist/internal/providers.js +262 -0
- package/dist/internal/providers.js.map +1 -0
- package/dist/localstorage.d.ts +13 -0
- package/dist/localstorage.d.ts.map +1 -0
- package/dist/localstorage.js +190 -0
- package/dist/localstorage.js.map +1 -0
- package/dist/localstorage.test.d.ts +2 -0
- package/dist/localstorage.test.d.ts.map +1 -0
- package/dist/localstorage.test.js +131 -0
- package/dist/localstorage.test.js.map +1 -0
- package/dist/logger.d.ts +7 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +70 -0
- package/dist/logger.js.map +1 -0
- package/dist/oauth.d.ts +142 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +551 -0
- package/dist/oauth.js.map +1 -0
- package/dist/package-json.d.ts +84 -0
- package/dist/package-json.d.ts.map +1 -0
- package/dist/package-json.js +77 -0
- package/dist/package-json.js.map +1 -0
- package/dist/preferences.d.ts +23 -0
- package/dist/preferences.d.ts.map +1 -0
- package/dist/preferences.js +105 -0
- package/dist/preferences.js.map +1 -0
- package/dist/preload.d.ts +2 -0
- package/dist/preload.d.ts.map +1 -0
- package/dist/preload.js +28 -0
- package/dist/preload.js.map +1 -0
- package/dist/state.d.ts +26 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +18 -0
- package/dist/state.js.map +1 -0
- package/dist/store-api/download.d.ts +8 -0
- package/dist/store-api/download.d.ts.map +1 -0
- package/dist/store-api/download.js +37 -0
- package/dist/store-api/download.js.map +1 -0
- package/dist/store-api/download.test.d.ts +2 -0
- package/dist/store-api/download.test.d.ts.map +1 -0
- package/dist/store-api/download.test.js +36 -0
- package/dist/store-api/download.test.js.map +1 -0
- package/dist/store-api/extension.d.ts +87 -0
- package/dist/store-api/extension.d.ts.map +1 -0
- package/dist/store-api/extension.js +23 -0
- package/dist/store-api/extension.js.map +1 -0
- package/dist/store-api/extension.test.d.ts +2 -0
- package/dist/store-api/extension.test.d.ts.map +1 -0
- package/dist/store-api/extension.test.js +22 -0
- package/dist/store-api/extension.test.js.map +1 -0
- package/dist/store-api/search.d.ts +101 -0
- package/dist/store-api/search.d.ts.map +1 -0
- package/dist/store-api/search.js +29 -0
- package/dist/store-api/search.js.map +1 -0
- package/dist/store-api/search.test.d.ts +2 -0
- package/dist/store-api/search.test.d.ts.map +1 -0
- package/dist/store-api/search.test.js +45 -0
- package/dist/store-api/search.test.js.map +1 -0
- package/dist/store.d.ts +21 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +84 -0
- package/dist/store.js.map +1 -0
- package/dist/theme.d.ts +20 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +26 -0
- package/dist/theme.js.map +1 -0
- package/dist/toast.d.ts +44 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +221 -0
- package/dist/toast.js.map +1 -0
- package/dist/utils/file-system.d.ts +11 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +66 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils.d.ts +234 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +473 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.test.d.ts +2 -0
- package/dist/utils.test.d.ts.map +1 -0
- package/dist/utils.test.js +152 -0
- package/dist/utils.test.js.map +1 -0
- package/dist/window.d.ts +12 -0
- package/dist/window.d.ts.map +1 -0
- package/dist/window.js +48 -0
- package/dist/window.js.map +1 -0
- package/package.json +56 -0
- package/src/action-utils.tsx +207 -0
- package/src/apis/ai.tsx +177 -0
- package/src/apis/cache.test.ts +311 -0
- package/src/apis/cache.tsx +394 -0
- package/src/apis/clipboard.tsx +200 -0
- package/src/apis/environment.tsx +239 -0
- package/src/apis/hud.tsx +86 -0
- package/src/apis/localstorage.test.ts +164 -0
- package/src/apis/localstorage.tsx +215 -0
- package/src/apis/oauth.tsx +744 -0
- package/src/apis/preferences.tsx +140 -0
- package/src/apis/toast.tsx +388 -0
- package/src/apis/window.tsx +61 -0
- package/src/build.test.tsx +78 -0
- package/src/build.tsx +273 -0
- package/src/cli.tsx +328 -0
- package/src/colors.tsx +15 -0
- package/src/components/actions.tsx +718 -0
- package/src/components/alert.tsx +205 -0
- package/src/components/detail.tsx +359 -0
- package/src/components/dropdown.tsx +438 -0
- package/src/components/extension-preferences.tsx +269 -0
- package/src/components/form/assign-components.tsx +22 -0
- package/src/components/form/checkbox.tsx +96 -0
- package/src/components/form/date-picker.tsx +125 -0
- package/src/components/form/description.tsx +30 -0
- package/src/components/form/dropdown.tsx +512 -0
- package/src/components/form/file-autocomplete.tsx +141 -0
- package/src/components/form/file-picker.tsx +233 -0
- package/src/components/form/form-end.tsx +6 -0
- package/src/components/form/index.tsx +242 -0
- package/src/components/form/password-field.tsx +87 -0
- package/src/components/form/separator.tsx +15 -0
- package/src/components/form/tagpicker.tsx +245 -0
- package/src/components/form/text-area.tsx +82 -0
- package/src/components/form/text-field.tsx +82 -0
- package/src/components/form/types.tsx +49 -0
- package/src/components/form/use-form-navigation.tsx +65 -0
- package/src/components/form/with-left-border.tsx +53 -0
- package/src/components/icon.tsx +496 -0
- package/src/components/image.tsx +54 -0
- package/src/components/list.tsx +1564 -0
- package/src/components/loading-bar.tsx +141 -0
- package/src/components/menubar-extra.tsx +181 -0
- package/src/descendants.tsx +134 -0
- package/src/e2e-node.tsx +303 -0
- package/src/e2e.tsx +147 -0
- package/src/examples/action-show-in-finder.tsx +80 -0
- package/src/examples/environment-test.tsx +50 -0
- package/src/examples/error-boundary.tsx +217 -0
- package/src/examples/form-basic.tsx +122 -0
- package/src/examples/form-basic.vitest.tsx +1035 -0
- package/src/examples/form-dropdown.tsx +102 -0
- package/src/examples/form-dropdown.vitest.tsx +758 -0
- package/src/examples/form-tagpicker.tsx +66 -0
- package/src/examples/form-tagpicker.vitest.tsx +523 -0
- package/src/examples/internal/descendants-filtering.tsx +223 -0
- package/src/examples/internal/descendants.tsx +208 -0
- package/src/examples/internal/scrollbox-demo.tsx +149 -0
- package/src/examples/internal/simple-dialog.tsx +124 -0
- package/src/examples/internal/text-stacking.tsx +90 -0
- package/src/examples/list-dropdown-default.tsx +69 -0
- package/src/examples/list-dropdown-default.vitest.tsx +187 -0
- package/src/examples/list-fetch-data.tsx +123 -0
- package/src/examples/list-fetch-data.vitest.tsx +110 -0
- package/src/examples/list-with-detail.tsx +161 -0
- package/src/examples/list-with-detail.vitest.tsx +468 -0
- package/src/examples/list-with-dropdown.tsx +97 -0
- package/src/examples/list-with-dropdown.vitest.tsx +324 -0
- package/src/examples/list-with-sections.tsx +196 -0
- package/src/examples/list-with-sections.vitest.tsx +479 -0
- package/src/examples/miscellaneous.tsx +780 -0
- package/src/examples/nested-navigation.tsx +118 -0
- package/src/examples/preferences-test.tsx +82 -0
- package/src/examples/simple-dropdown.tsx +95 -0
- package/src/examples/simple-file-picker.tsx +75 -0
- package/src/examples/simple-file-picker.vitest.tsx +306 -0
- package/src/examples/simple-grid.tsx +149 -0
- package/src/examples/simple-grid.vitest.tsx +535 -0
- package/src/examples/simple-hud.tsx +60 -0
- package/src/examples/simple-list-search.tsx +93 -0
- package/src/examples/simple-list.tsx +149 -0
- package/src/examples/simple-navigation.tsx +89 -0
- package/src/examples/simple-navigation.vitest.tsx +571 -0
- package/src/examples/store.tsx +4 -0
- package/src/examples/store.vitest.tsx +59 -0
- package/src/examples/tanstack-demo.tsx +104 -0
- package/src/examples/use-promise-demo.tsx +96 -0
- package/src/extensions/dev.tsx +215 -0
- package/src/extensions/home.tsx +332 -0
- package/src/extensions/store.tsx +375 -0
- package/src/globals.ts +34 -0
- package/src/hooks/index.tsx +8 -0
- package/src/hooks/use-action-panel.tsx +28 -0
- package/src/hooks/use-id.tsx +19 -0
- package/src/hooks/use-unstable-ai.tsx +15 -0
- package/src/hooks.tsx +22 -0
- package/src/index.tsx +240 -0
- package/src/internal/date-picker-widget.tsx +500 -0
- package/src/internal/dialog.tsx +202 -0
- package/src/internal/error-handler.tsx +32 -0
- package/src/internal/focus-context.tsx +23 -0
- package/src/internal/navigation.tsx +149 -0
- package/src/internal/providers.tsx +430 -0
- package/src/logger.tsx +84 -0
- package/src/package-json.tsx +197 -0
- package/src/preload.tsx +32 -0
- package/src/state.tsx +49 -0
- package/src/store-api/download.test.tsx +38 -0
- package/src/store-api/download.tsx +52 -0
- package/src/store-api/extension.test.tsx +24 -0
- package/src/store-api/extension.tsx +123 -0
- package/src/store-api/search.test.tsx +50 -0
- package/src/store-api/search.tsx +146 -0
- package/src/theme.tsx +31 -0
- package/src/utils/file-system.ts +87 -0
- package/src/utils.test.tsx +204 -0
- package/src/utils.tsx +657 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useStore } from 'termcast/src/state'
|
|
3
|
+
import { logger } from 'termcast/src/logger'
|
|
4
|
+
import { LocalStorage } from 'termcast/src/apis/localstorage'
|
|
5
|
+
import { ExtensionPreferences } from 'termcast/src/components/extension-preferences'
|
|
6
|
+
|
|
7
|
+
export type PreferenceValues = {
|
|
8
|
+
[preferenceName: string]: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A function to access the preference values that have been passed to the command.
|
|
13
|
+
* Each preference name is mapped to its value, and the defined default values are used as fallback values.
|
|
14
|
+
*
|
|
15
|
+
* @returns An object with the preference names as property key and the typed value as property value.
|
|
16
|
+
*/
|
|
17
|
+
export function getPreferenceValues<
|
|
18
|
+
Values extends PreferenceValues = PreferenceValues,
|
|
19
|
+
>(): Values {
|
|
20
|
+
const state = useStore.getState()
|
|
21
|
+
const { extensionPackageJson, currentCommandName, extensionPath } = state
|
|
22
|
+
|
|
23
|
+
// Determine the extension name from package.json or path
|
|
24
|
+
let extensionName: string | null = null
|
|
25
|
+
if (extensionPackageJson?.name) {
|
|
26
|
+
extensionName = extensionPackageJson.name
|
|
27
|
+
} else if (extensionPath) {
|
|
28
|
+
// Extract extension name from path if package.json not available
|
|
29
|
+
const pathParts = extensionPath.split('/')
|
|
30
|
+
extensionName = pathParts[pathParts.length - 1]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!extensionName) {
|
|
34
|
+
logger.log('No extension context found for preferences')
|
|
35
|
+
return {} as Values
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
// First try to load command-specific preferences, then fall back to extension preferences
|
|
40
|
+
if (currentCommandName) {
|
|
41
|
+
const commandPreferencesKey = `preferences.${extensionName}.${currentCommandName}`
|
|
42
|
+
const commandPreferences = LocalStorage.getItemSync(commandPreferencesKey)
|
|
43
|
+
|
|
44
|
+
if (commandPreferences && typeof commandPreferences === 'string') {
|
|
45
|
+
try {
|
|
46
|
+
const parsed = JSON.parse(commandPreferences)
|
|
47
|
+
logger.log(
|
|
48
|
+
`Loaded command preferences for ${extensionName}/${currentCommandName}:`,
|
|
49
|
+
parsed,
|
|
50
|
+
)
|
|
51
|
+
return parsed as Values
|
|
52
|
+
} catch (parseError) {
|
|
53
|
+
logger.error(`Failed to parse command preferences:`, parseError)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Fall back to extension-level preferences
|
|
59
|
+
const extensionPreferencesKey = `preferences.${extensionName}`
|
|
60
|
+
const extensionPreferences = LocalStorage.getItemSync(
|
|
61
|
+
extensionPreferencesKey,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
if (extensionPreferences && typeof extensionPreferences === 'string') {
|
|
65
|
+
try {
|
|
66
|
+
const parsed = JSON.parse(extensionPreferences)
|
|
67
|
+
logger.log(`Loaded extension preferences for ${extensionName}:`, parsed)
|
|
68
|
+
return parsed as Values
|
|
69
|
+
} catch (parseError) {
|
|
70
|
+
logger.error(`Failed to parse extension preferences:`, parseError)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
logger.error(`Failed to load preferences for ${extensionName}:`, error)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Return empty preferences if none saved
|
|
78
|
+
return {} as Values
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Opens the extension's preferences screen.
|
|
83
|
+
*
|
|
84
|
+
* @returns A Promise that resolves when the extensions preferences screen is opened.
|
|
85
|
+
*/
|
|
86
|
+
export async function openExtensionPreferences(): Promise<void> {
|
|
87
|
+
const state = useStore.getState()
|
|
88
|
+
const { extensionPackageJson, navigationStack } = state
|
|
89
|
+
|
|
90
|
+
if (!extensionPackageJson?.name) {
|
|
91
|
+
throw new Error('No current extension found')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
logger.log(`Opening extension preferences for ${extensionPackageJson.name}`)
|
|
95
|
+
|
|
96
|
+
// Push the preferences component to the navigation stack
|
|
97
|
+
const preferencesComponent = (
|
|
98
|
+
<ExtensionPreferences extensionName={extensionPackageJson.name} />
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
useStore.setState({
|
|
102
|
+
navigationStack: [...navigationStack, { element: preferencesComponent }],
|
|
103
|
+
dialogStack: [],
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
return Promise.resolve()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Opens the command's preferences screen.
|
|
111
|
+
*
|
|
112
|
+
* @returns A Promise that resolves when the command's preferences screen is opened.
|
|
113
|
+
*/
|
|
114
|
+
export async function openCommandPreferences(): Promise<void> {
|
|
115
|
+
const state = useStore.getState()
|
|
116
|
+
const { extensionPackageJson, currentCommandName, navigationStack } = state
|
|
117
|
+
|
|
118
|
+
if (!extensionPackageJson?.name || !currentCommandName) {
|
|
119
|
+
throw new Error('No current command found')
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
logger.log(
|
|
123
|
+
`Opening command preferences for ${extensionPackageJson.name}/${currentCommandName}`,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
// Push the preferences component to the navigation stack
|
|
127
|
+
const preferencesComponent = (
|
|
128
|
+
<ExtensionPreferences
|
|
129
|
+
extensionName={extensionPackageJson.name}
|
|
130
|
+
commandName={currentCommandName}
|
|
131
|
+
/>
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
useStore.setState({
|
|
135
|
+
navigationStack: [...navigationStack, { element: preferencesComponent }],
|
|
136
|
+
dialogStack: [],
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
return Promise.resolve()
|
|
140
|
+
}
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Theme } from 'termcast/src/theme'
|
|
3
|
+
import { TextAttributes } from '@opentui/core'
|
|
4
|
+
import { logger } from 'termcast/src/logger'
|
|
5
|
+
import { useStore } from 'termcast/src/state'
|
|
6
|
+
import { useKeyboard, useTerminalDimensions } from '@opentui/react'
|
|
7
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
8
|
+
|
|
9
|
+
export namespace Toast {
|
|
10
|
+
export interface Options {
|
|
11
|
+
title: string
|
|
12
|
+
message?: string
|
|
13
|
+
style?: Style
|
|
14
|
+
primaryAction?: ActionOptions
|
|
15
|
+
secondaryAction?: ActionOptions
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ActionOptions {
|
|
19
|
+
title: string
|
|
20
|
+
shortcut?: any
|
|
21
|
+
onAction: (toast: Toast) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type Style = 'SUCCESS' | 'FAILURE' | 'ANIMATED'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class Toast {
|
|
28
|
+
private options: Toast.Options
|
|
29
|
+
private id: string
|
|
30
|
+
private callbacks: {
|
|
31
|
+
onUpdate?: (toast: Toast) => void
|
|
32
|
+
onHide?: () => void
|
|
33
|
+
} = {}
|
|
34
|
+
|
|
35
|
+
static Style = {
|
|
36
|
+
Success: 'SUCCESS' as Toast.Style,
|
|
37
|
+
Failure: 'FAILURE' as Toast.Style,
|
|
38
|
+
Animated: 'ANIMATED' as Toast.Style,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
constructor(props: Toast.Options) {
|
|
42
|
+
this.options = { ...props }
|
|
43
|
+
this.id = Math.random().toString(36).substring(7)
|
|
44
|
+
|
|
45
|
+
// Bind all methods to this instance
|
|
46
|
+
this.show = this.show.bind(this)
|
|
47
|
+
this.hide = this.hide.bind(this)
|
|
48
|
+
this.update = this.update.bind(this)
|
|
49
|
+
this._setCallbacks = this._setCallbacks.bind(this)
|
|
50
|
+
this._getId = this._getId.bind(this)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get style(): Toast.Style {
|
|
54
|
+
return this.options.style || Toast.Style.Success
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
set style(style: Toast.Style) {
|
|
58
|
+
this.options.style = style
|
|
59
|
+
this.update()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get title(): string {
|
|
63
|
+
return this.options.title
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
set title(title: string) {
|
|
67
|
+
this.options.title = title
|
|
68
|
+
this.update()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get message(): string | undefined {
|
|
72
|
+
return this.options.message
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
set message(message: string | undefined) {
|
|
76
|
+
this.options.message = message
|
|
77
|
+
this.update()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get primaryAction(): Toast.ActionOptions | undefined {
|
|
81
|
+
return this.options.primaryAction
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
set primaryAction(action: Toast.ActionOptions | undefined) {
|
|
85
|
+
this.options.primaryAction = action
|
|
86
|
+
this.update()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get secondaryAction(): Toast.ActionOptions | undefined {
|
|
90
|
+
return this.options.secondaryAction
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
set secondaryAction(action: Toast.ActionOptions | undefined) {
|
|
94
|
+
this.options.secondaryAction = action
|
|
95
|
+
this.update()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async show(): Promise<void> {
|
|
99
|
+
showToastInternal(this)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async hide(): Promise<void> {
|
|
103
|
+
useStore.setState({ toast: null })
|
|
104
|
+
if (this.callbacks.onHide) {
|
|
105
|
+
this.callbacks.onHide()
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private update(): void {
|
|
110
|
+
if (this.callbacks.onUpdate) {
|
|
111
|
+
this.callbacks.onUpdate(this)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_setCallbacks(callbacks: typeof this.callbacks): void {
|
|
116
|
+
this.callbacks = callbacks
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_getId(): string {
|
|
120
|
+
return this.id
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ToastComponentProps {
|
|
125
|
+
toast: Toast
|
|
126
|
+
onHide: () => void
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function ToastComponent({ toast, onHide }: ToastComponentProps): any {
|
|
130
|
+
const [, forceUpdate] = useState(0)
|
|
131
|
+
const dimensions = useTerminalDimensions()
|
|
132
|
+
const inFocus = useIsInFocus()
|
|
133
|
+
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const onUpdate = () => {
|
|
136
|
+
forceUpdate((n) => n + 1)
|
|
137
|
+
}
|
|
138
|
+
toast._setCallbacks({ onUpdate, onHide })
|
|
139
|
+
return () => {
|
|
140
|
+
toast._setCallbacks({})
|
|
141
|
+
}
|
|
142
|
+
}, [toast, onHide])
|
|
143
|
+
|
|
144
|
+
const getIcon = () => {
|
|
145
|
+
switch (toast.style) {
|
|
146
|
+
case Toast.Style.Success:
|
|
147
|
+
return '✓'
|
|
148
|
+
case Toast.Style.Failure:
|
|
149
|
+
return '✗'
|
|
150
|
+
case Toast.Style.Animated:
|
|
151
|
+
return '⣾⣽⣻⢿⡿⣟⣯⣷'
|
|
152
|
+
default:
|
|
153
|
+
return '✓'
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const getIconColor = () => {
|
|
158
|
+
switch (toast.style) {
|
|
159
|
+
case Toast.Style.Success:
|
|
160
|
+
return Theme.success
|
|
161
|
+
case Toast.Style.Failure:
|
|
162
|
+
return Theme.error
|
|
163
|
+
case Toast.Style.Animated:
|
|
164
|
+
return Theme.primary
|
|
165
|
+
default:
|
|
166
|
+
return Theme.success
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const [animationFrame, setAnimationFrame] = useState(0)
|
|
171
|
+
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (toast.style === Toast.Style.Animated) {
|
|
174
|
+
const interval = setInterval(() => {
|
|
175
|
+
setAnimationFrame((prev) => (prev + 1) % 8)
|
|
176
|
+
}, 100)
|
|
177
|
+
return () => clearInterval(interval)
|
|
178
|
+
}
|
|
179
|
+
}, [toast.style])
|
|
180
|
+
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (toast.style !== Toast.Style.Animated) {
|
|
183
|
+
// Use longer duration for error toasts
|
|
184
|
+
const duration = toast.style === Toast.Style.Failure ? 8000 : 5000
|
|
185
|
+
const timer = setTimeout(() => {
|
|
186
|
+
onHide()
|
|
187
|
+
}, duration)
|
|
188
|
+
return () => clearTimeout(timer)
|
|
189
|
+
}
|
|
190
|
+
}, [toast.style, onHide])
|
|
191
|
+
|
|
192
|
+
const icon =
|
|
193
|
+
toast.style === Toast.Style.Animated ? getIcon()[animationFrame] : getIcon()
|
|
194
|
+
|
|
195
|
+
useKeyboard((evt) => {
|
|
196
|
+
if (!inFocus) return
|
|
197
|
+
|
|
198
|
+
if (evt.name === 'escape') {
|
|
199
|
+
onHide()
|
|
200
|
+
} else if (toast.primaryAction && evt.name === 'enter') {
|
|
201
|
+
toast.primaryAction.onAction(toast)
|
|
202
|
+
} else if (toast.secondaryAction && evt.name === 'tab') {
|
|
203
|
+
toast.secondaryAction.onAction(toast)
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
// TODO use flexWrap when implemented
|
|
208
|
+
const wrapText = (text: string, maxWidth: number): string[] => {
|
|
209
|
+
if (!text) return []
|
|
210
|
+
|
|
211
|
+
const words = text.split(' ')
|
|
212
|
+
const lines: string[] = []
|
|
213
|
+
let currentLine = ''
|
|
214
|
+
|
|
215
|
+
for (const word of words) {
|
|
216
|
+
const testLine = currentLine ? `${currentLine} ${word}` : word
|
|
217
|
+
if (testLine.length <= maxWidth) {
|
|
218
|
+
currentLine = testLine
|
|
219
|
+
} else {
|
|
220
|
+
if (currentLine) {
|
|
221
|
+
lines.push(currentLine)
|
|
222
|
+
}
|
|
223
|
+
currentLine = word
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (currentLine) {
|
|
228
|
+
lines.push(currentLine)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return lines.slice(0, 3)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const iconLength = 2
|
|
235
|
+
const titleLength = toast.title.length
|
|
236
|
+
const actionsLength = (() => {
|
|
237
|
+
let length = 0
|
|
238
|
+
if (toast.primaryAction) {
|
|
239
|
+
length += toast.primaryAction.title.length + 4
|
|
240
|
+
}
|
|
241
|
+
if (toast.secondaryAction) {
|
|
242
|
+
length += toast.secondaryAction.title.length + 4
|
|
243
|
+
}
|
|
244
|
+
return length
|
|
245
|
+
})()
|
|
246
|
+
|
|
247
|
+
const availableWidth =
|
|
248
|
+
dimensions.width - iconLength - titleLength - actionsLength - 8
|
|
249
|
+
const messageLines = toast.message
|
|
250
|
+
? wrapText(toast.message, Math.max(20, availableWidth))
|
|
251
|
+
: []
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<box
|
|
255
|
+
borderColor={Theme.border}
|
|
256
|
+
paddingLeft={1}
|
|
257
|
+
paddingRight={1}
|
|
258
|
+
flexDirection='column'
|
|
259
|
+
>
|
|
260
|
+
<box flexDirection='row' alignItems='center'>
|
|
261
|
+
<text fg={getIconColor()}>{icon} </text>
|
|
262
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
263
|
+
{toast.title}
|
|
264
|
+
</text>
|
|
265
|
+
{messageLines.length > 0 && (
|
|
266
|
+
<text fg={Theme.textMuted}> - {messageLines[0]}</text>
|
|
267
|
+
)}
|
|
268
|
+
{toast.primaryAction && (
|
|
269
|
+
<text fg={Theme.primary}> [{toast.primaryAction.title} ↵]</text>
|
|
270
|
+
)}
|
|
271
|
+
{toast.secondaryAction && (
|
|
272
|
+
<text fg={Theme.textMuted}> [{toast.secondaryAction.title} ⇥]</text>
|
|
273
|
+
)}
|
|
274
|
+
</box>
|
|
275
|
+
{messageLines.slice(1).map((line, index) => (
|
|
276
|
+
<box key={index} paddingLeft={iconLength + titleLength + 3}>
|
|
277
|
+
<text fg={Theme.textMuted}>{line}</text>
|
|
278
|
+
</box>
|
|
279
|
+
))}
|
|
280
|
+
</box>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
let currentToastInstance: Toast | null = null
|
|
285
|
+
|
|
286
|
+
export function showToastInternal(toast: Toast): void {
|
|
287
|
+
currentToastInstance = toast
|
|
288
|
+
useStore.setState({
|
|
289
|
+
toast: (
|
|
290
|
+
<ToastComponent
|
|
291
|
+
toast={toast}
|
|
292
|
+
onHide={() => {
|
|
293
|
+
useStore.setState({ toast: null })
|
|
294
|
+
currentToastInstance = null
|
|
295
|
+
}}
|
|
296
|
+
/>
|
|
297
|
+
),
|
|
298
|
+
})
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export async function showToast(options: Toast.Options): Promise<Toast>
|
|
302
|
+
export async function showToast(
|
|
303
|
+
style: Toast.Style,
|
|
304
|
+
title: string,
|
|
305
|
+
message?: string,
|
|
306
|
+
): Promise<Toast>
|
|
307
|
+
export async function showToast(
|
|
308
|
+
optionsOrStyle: Toast.Options | Toast.Style,
|
|
309
|
+
title?: string,
|
|
310
|
+
message?: string,
|
|
311
|
+
): Promise<Toast> {
|
|
312
|
+
let options: Toast.Options
|
|
313
|
+
|
|
314
|
+
if (typeof optionsOrStyle === 'string') {
|
|
315
|
+
options = {
|
|
316
|
+
style: optionsOrStyle,
|
|
317
|
+
title: title!,
|
|
318
|
+
message,
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
options = optionsOrStyle
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const toast = new Toast(options)
|
|
325
|
+
await toast.show()
|
|
326
|
+
return toast
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Creates and shows a failure toast for error scenarios.
|
|
331
|
+
*
|
|
332
|
+
* This is a convenience function that automatically creates a toast with failure styling
|
|
333
|
+
* and extracts error messages from various error types.
|
|
334
|
+
*
|
|
335
|
+
* @param error - The error to display. Can be an Error object, string, or any object with a message property
|
|
336
|
+
* @param options - Optional configuration
|
|
337
|
+
* @param options.title - Custom title for the toast (defaults to error name or "Something went wrong")
|
|
338
|
+
* @param options.primaryAction - Optional action button to display on the toast
|
|
339
|
+
* @returns A Promise that resolves to the created Toast instance
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* try {
|
|
344
|
+
* await riskyOperation()
|
|
345
|
+
* } catch (error) {
|
|
346
|
+
* await showFailureToast(error, {
|
|
347
|
+
* title: "Operation Failed",
|
|
348
|
+
* primaryAction: {
|
|
349
|
+
* title: "Retry",
|
|
350
|
+
* onAction: () => retryOperation()
|
|
351
|
+
* }
|
|
352
|
+
* })
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
export async function showFailureToast(
|
|
357
|
+
error: unknown,
|
|
358
|
+
options?: {
|
|
359
|
+
title?: string
|
|
360
|
+
primaryAction?: Toast.ActionOptions
|
|
361
|
+
},
|
|
362
|
+
): Promise<Toast> {
|
|
363
|
+
let errorMessage: string
|
|
364
|
+
let errorTitle: string
|
|
365
|
+
|
|
366
|
+
if (error instanceof Error) {
|
|
367
|
+
errorMessage = error.message
|
|
368
|
+
errorTitle = options?.title || error.name || 'Something went wrong'
|
|
369
|
+
} else if (typeof error === 'string') {
|
|
370
|
+
errorMessage = error
|
|
371
|
+
errorTitle = options?.title || 'Something went wrong'
|
|
372
|
+
} else if (error && typeof error === 'object' && 'message' in error) {
|
|
373
|
+
errorMessage = String(error.message)
|
|
374
|
+
errorTitle = options?.title || 'Something went wrong'
|
|
375
|
+
} else {
|
|
376
|
+
errorMessage = String(error)
|
|
377
|
+
errorTitle = options?.title || 'Something went wrong'
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const toastOptions: Toast.Options = {
|
|
381
|
+
title: errorTitle,
|
|
382
|
+
message: errorMessage,
|
|
383
|
+
style: Toast.Style.Failure,
|
|
384
|
+
primaryAction: options?.primaryAction,
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return showToast(toastOptions)
|
|
388
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export enum PopToRootType {
|
|
2
|
+
Default = 'default',
|
|
3
|
+
Immediate = 'immediate',
|
|
4
|
+
Suspended = 'suspended',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface CloseMainWindowOptions {
|
|
8
|
+
clearRootSearch?: boolean
|
|
9
|
+
popToRootType?: PopToRootType
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// TODO does not do anything
|
|
13
|
+
export async function closeMainWindow({
|
|
14
|
+
clearRootSearch,
|
|
15
|
+
popToRootType = PopToRootType.Default,
|
|
16
|
+
}: CloseMainWindowOptions = {}): Promise<void> {
|
|
17
|
+
return
|
|
18
|
+
// try {
|
|
19
|
+
// const currentPid = process.pid
|
|
20
|
+
|
|
21
|
+
// // On macOS, request accessibility permissions if needed
|
|
22
|
+
// if (process.platform === 'darwin') {
|
|
23
|
+
// windowManager.requestAccessibility()
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// // Get all windows
|
|
27
|
+
// const windows = windowManager.getWindows()
|
|
28
|
+
|
|
29
|
+
// // Find a window that's not the current process
|
|
30
|
+
// const previousWindow = windows.find((win) => {
|
|
31
|
+
// try {
|
|
32
|
+
// if (!win.isVisible) return false
|
|
33
|
+
// if (overlayWindows.includes(win.getTitle())) return false
|
|
34
|
+
|
|
35
|
+
// return win.processId !== currentPid
|
|
36
|
+
// } catch {
|
|
37
|
+
// return false
|
|
38
|
+
// }
|
|
39
|
+
// })
|
|
40
|
+
|
|
41
|
+
// if (previousWindow) {
|
|
42
|
+
// // Bring the previous window to focus
|
|
43
|
+
// previousWindow.bringToTop()
|
|
44
|
+
// logger.log(`Switched focus to window: ${previousWindow.getTitle()}`)
|
|
45
|
+
// } else {
|
|
46
|
+
// logger.log('No previous window found to focus')
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
// // Minimize or hide the current window
|
|
50
|
+
// // const currentWindow = windowManager.getActiveWindow()
|
|
51
|
+
// // if (currentWindow) {
|
|
52
|
+
// // currentWindow.minimize()
|
|
53
|
+
// // }
|
|
54
|
+
|
|
55
|
+
// // TODO: Handle clearRootSearch behavior when main window functionality is implemented
|
|
56
|
+
// // TODO: Handle popToRootType behavior when navigation stack is implemented
|
|
57
|
+
// } catch (error) {
|
|
58
|
+
// logger.error('Failed to close main window:', error)
|
|
59
|
+
// throw error
|
|
60
|
+
// }
|
|
61
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { describe, test, expect } from 'bun:test'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { buildExtensionCommands } from './build'
|
|
4
|
+
|
|
5
|
+
describe('buildExtensionCommands', () => {
|
|
6
|
+
test('builds a simple extension with multiple commands', async () => {
|
|
7
|
+
const fixtureDir = path.join(process.cwd(), 'fixtures/simple-extension')
|
|
8
|
+
const result = await buildExtensionCommands({
|
|
9
|
+
extensionPath: fixtureDir,
|
|
10
|
+
target: 'node',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Replace the user-specific base path with a constant placeholder
|
|
14
|
+
const resultString = JSON.stringify(result, null, 2)
|
|
15
|
+
const normalizedString = resultString.replaceAll(
|
|
16
|
+
process.cwd(),
|
|
17
|
+
'/BASE_PATH',
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
expect(normalizedString).toMatchInlineSnapshot(`
|
|
21
|
+
"{
|
|
22
|
+
"commands": [
|
|
23
|
+
{
|
|
24
|
+
"name": "list-items",
|
|
25
|
+
"title": "List Items",
|
|
26
|
+
"subtitle": "Shows a list of items",
|
|
27
|
+
"description": "Displays a simple list with some items",
|
|
28
|
+
"mode": "view",
|
|
29
|
+
"filePath": "/BASE_PATH/fixtures/simple-extension/src/list-items.tsx",
|
|
30
|
+
"exists": true,
|
|
31
|
+
"bundledPath": "/BASE_PATH/fixtures/simple-extension/.termcast-bundle/list-items.js"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "search-items",
|
|
35
|
+
"title": "Search Items",
|
|
36
|
+
"subtitle": "Search through items",
|
|
37
|
+
"description": "Search and filter through a list of items",
|
|
38
|
+
"mode": "view",
|
|
39
|
+
"filePath": "/BASE_PATH/fixtures/simple-extension/src/search-items.tsx",
|
|
40
|
+
"exists": true,
|
|
41
|
+
"bundledPath": "/BASE_PATH/fixtures/simple-extension/.termcast-bundle/search-items.js"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "oauth",
|
|
45
|
+
"title": "Google Oauth",
|
|
46
|
+
"subtitle": "auth",
|
|
47
|
+
"description": "",
|
|
48
|
+
"mode": "view",
|
|
49
|
+
"filePath": "/BASE_PATH/fixtures/simple-extension/src/oauth.tsx",
|
|
50
|
+
"exists": true,
|
|
51
|
+
"bundledPath": "/BASE_PATH/fixtures/simple-extension/.termcast-bundle/oauth.js"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "use-promise-demo",
|
|
55
|
+
"title": "usePromise Demo",
|
|
56
|
+
"subtitle": "Demonstrates usePromise hook",
|
|
57
|
+
"description": "Shows how to use the usePromise hook from @raycast/utils",
|
|
58
|
+
"mode": "view",
|
|
59
|
+
"filePath": "/BASE_PATH/fixtures/simple-extension/src/use-promise-demo.tsx",
|
|
60
|
+
"exists": true,
|
|
61
|
+
"bundledPath": "/BASE_PATH/fixtures/simple-extension/.termcast-bundle/use-promise-demo.js"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "show-state",
|
|
65
|
+
"title": "Show State",
|
|
66
|
+
"subtitle": "Display current state as JSON",
|
|
67
|
+
"description": "Shows the current application state in JSON format",
|
|
68
|
+
"mode": "view",
|
|
69
|
+
"filePath": "/BASE_PATH/fixtures/simple-extension/src/show-state.tsx",
|
|
70
|
+
"exists": true,
|
|
71
|
+
"bundledPath": "/BASE_PATH/fixtures/simple-extension/.termcast-bundle/show-state.js"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"bundleDir": "/BASE_PATH/fixtures/simple-extension/.termcast-bundle"
|
|
75
|
+
}"
|
|
76
|
+
`)
|
|
77
|
+
})
|
|
78
|
+
})
|