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,32 @@
|
|
|
1
|
+
import { showFailureToast } from 'termcast/src/apis/toast'
|
|
2
|
+
import { logger } from 'termcast/src/logger'
|
|
3
|
+
|
|
4
|
+
let initialized = false
|
|
5
|
+
|
|
6
|
+
export function initializeErrorHandlers(): void {
|
|
7
|
+
if (initialized) return
|
|
8
|
+
initialized = true
|
|
9
|
+
|
|
10
|
+
process.on('unhandledRejection', (reason) => {
|
|
11
|
+
const err = reason instanceof Error ? reason : new Error(String(reason))
|
|
12
|
+
logger.error('Unhandled rejection:', err)
|
|
13
|
+
showFailureToast(err, {
|
|
14
|
+
title: 'Unhandled Promise Rejection',
|
|
15
|
+
}).catch((toastErr) => {
|
|
16
|
+
logger.error('Failed to show toast for unhandled rejection:', toastErr)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
process.on('uncaughtException', (err) => {
|
|
21
|
+
logger.error('Uncaught exception:', err)
|
|
22
|
+
showFailureToast(err, {
|
|
23
|
+
title: 'Uncaught Exception',
|
|
24
|
+
}).catch((toastErr) => {
|
|
25
|
+
logger.error('Failed to show toast for uncaught exception:', toastErr)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
process.on('uncaughtExceptionMonitor', (err, origin) => {
|
|
30
|
+
logger.error(`Uncaught exception from ${origin}:`, err)
|
|
31
|
+
})
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { createContext, useContext, ReactNode } from 'react'
|
|
2
|
+
import { CommonProps } from 'termcast/src/utils'
|
|
3
|
+
|
|
4
|
+
interface FocusContextValue {
|
|
5
|
+
inFocus: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const FocusContext = createContext<FocusContextValue>({ inFocus: true })
|
|
9
|
+
|
|
10
|
+
interface InFocusProps extends CommonProps {
|
|
11
|
+
children: ReactNode
|
|
12
|
+
inFocus: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function InFocus({ children, inFocus }: InFocusProps): any {
|
|
16
|
+
const value = React.useMemo(() => ({ inFocus }), [inFocus])
|
|
17
|
+
return <FocusContext.Provider value={value}>{children}</FocusContext.Provider>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function useIsInFocus(): boolean {
|
|
21
|
+
const context = useContext(FocusContext)
|
|
22
|
+
return context.inFocus
|
|
23
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useCallback,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
useEffect,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
startTransition,
|
|
9
|
+
useTransition,
|
|
10
|
+
} from 'react'
|
|
11
|
+
import { useKeyboard } from '@opentui/react'
|
|
12
|
+
import { CommonProps } from 'termcast/src/utils'
|
|
13
|
+
import { useStore, type NavigationStackItem } from 'termcast/src/state'
|
|
14
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
15
|
+
import { logger } from '../logger'
|
|
16
|
+
|
|
17
|
+
interface Navigation {
|
|
18
|
+
push: (element: ReactNode, onPop?: () => void) => void
|
|
19
|
+
pop: () => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface NavigationContextType {
|
|
23
|
+
navigation: Navigation
|
|
24
|
+
stack: NavigationStackItem[]
|
|
25
|
+
isPending: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const NavigationContext = createContext<NavigationContextType | undefined>(
|
|
29
|
+
undefined,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
interface NavigationProviderProps extends CommonProps {
|
|
33
|
+
children: ReactNode
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function NavigationProvider(props: NavigationProviderProps): any {
|
|
37
|
+
const stack = useStore((state) => state.navigationStack)
|
|
38
|
+
const [isPending, startNavigationTransition] = useTransition()
|
|
39
|
+
|
|
40
|
+
// Initialize stack with children if empty
|
|
41
|
+
useLayoutEffect(() => {
|
|
42
|
+
if (stack.length === 0) {
|
|
43
|
+
useStore.setState({
|
|
44
|
+
navigationStack: [{ element: props.children }],
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}, [])
|
|
48
|
+
|
|
49
|
+
const push = useCallback((element: any, onPop?: () => void) => {
|
|
50
|
+
if (!element) {
|
|
51
|
+
throw new Error(`cannot push falsy value ${element}`)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
logger.log(
|
|
55
|
+
'pushing',
|
|
56
|
+
(element as any)?.type?.name || (element as any)?.type,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
const currentStack = useStore.getState().navigationStack
|
|
60
|
+
startNavigationTransition(() => {
|
|
61
|
+
useStore.setState({
|
|
62
|
+
navigationStack: [...currentStack, { element, onPop }],
|
|
63
|
+
dialogStack: [],
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
}, [])
|
|
67
|
+
|
|
68
|
+
const pop = useCallback(() => {
|
|
69
|
+
const currentStack = useStore.getState().navigationStack
|
|
70
|
+
if (currentStack.length <= 1) return
|
|
71
|
+
|
|
72
|
+
const newStack = currentStack.slice(0, -1)
|
|
73
|
+
const poppedItem = currentStack[currentStack.length - 1]
|
|
74
|
+
if (poppedItem?.onPop) {
|
|
75
|
+
poppedItem.onPop()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
startNavigationTransition(() => {
|
|
79
|
+
useStore.setState({ navigationStack: newStack })
|
|
80
|
+
})
|
|
81
|
+
}, [])
|
|
82
|
+
|
|
83
|
+
const navigation = React.useMemo(
|
|
84
|
+
() => ({
|
|
85
|
+
push,
|
|
86
|
+
pop,
|
|
87
|
+
}),
|
|
88
|
+
[push, pop],
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
const value = React.useMemo(
|
|
92
|
+
() => ({
|
|
93
|
+
navigation,
|
|
94
|
+
stack: stack.length > 0 ? stack : [{ element: props.children }],
|
|
95
|
+
isPending,
|
|
96
|
+
}),
|
|
97
|
+
[navigation, stack, props.children, isPending],
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
const inFocus = useIsInFocus()
|
|
101
|
+
|
|
102
|
+
// Handle ESC key to pop navigation
|
|
103
|
+
useKeyboard((evt) => {
|
|
104
|
+
if (!inFocus) return
|
|
105
|
+
if (evt.name === 'escape' && stack.length > 1) {
|
|
106
|
+
logger.log(
|
|
107
|
+
'popping navigation',
|
|
108
|
+
stack.length - 1,
|
|
109
|
+
'stack:',
|
|
110
|
+
stack.map((item) => (item.element as any).type.name),
|
|
111
|
+
)
|
|
112
|
+
pop()
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const currentItem =
|
|
117
|
+
stack.length > 0 ? stack[stack.length - 1] : { element: props.children }
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<NavigationContext.Provider value={value}>
|
|
121
|
+
{React.cloneElement(currentItem?.element as React.ReactElement, {
|
|
122
|
+
key: stack.length,
|
|
123
|
+
})}
|
|
124
|
+
</NavigationContext.Provider>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function useNavigation(): Navigation {
|
|
129
|
+
const context = useContext(NavigationContext)
|
|
130
|
+
if (!context) {
|
|
131
|
+
throw new Error('useNavigation must be used within a NavigationProvider')
|
|
132
|
+
}
|
|
133
|
+
return context.navigation
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function useNavigationPending(): boolean {
|
|
137
|
+
const context = useContext(NavigationContext)
|
|
138
|
+
return context?.isPending || false
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface NavigationContainerProps extends CommonProps {
|
|
142
|
+
children: ReactNode
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function NavigationContainer({
|
|
146
|
+
children,
|
|
147
|
+
}: NavigationContainerProps): any {
|
|
148
|
+
return <NavigationProvider>{children}</NavigationProvider>
|
|
149
|
+
}
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
Component,
|
|
3
|
+
Suspense,
|
|
4
|
+
type ReactNode,
|
|
5
|
+
type ErrorInfo,
|
|
6
|
+
} from 'react'
|
|
7
|
+
import { QueryClient } from '@tanstack/react-query'
|
|
8
|
+
import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client'
|
|
9
|
+
import { DialogProvider } from 'termcast/src/internal/dialog'
|
|
10
|
+
import { NavigationProvider } from 'termcast/src/internal/navigation'
|
|
11
|
+
import { CommonProps } from 'termcast/src/utils'
|
|
12
|
+
import { Cache } from 'termcast/src/apis/cache'
|
|
13
|
+
import { logger } from 'termcast/src/logger'
|
|
14
|
+
import { Theme } from 'termcast/src/theme'
|
|
15
|
+
import { useKeyboard } from '@opentui/react'
|
|
16
|
+
import { TextAttributes } from '@opentui/core'
|
|
17
|
+
import { useStore } from 'termcast/src/state'
|
|
18
|
+
import * as fs from 'fs'
|
|
19
|
+
import * as path from 'path'
|
|
20
|
+
import { exec } from 'child_process'
|
|
21
|
+
import dedent from 'string-dedent'
|
|
22
|
+
import { initializeErrorHandlers } from 'termcast/src/internal/error-handler'
|
|
23
|
+
|
|
24
|
+
// Initialize error handlers at module load time
|
|
25
|
+
initializeErrorHandlers()
|
|
26
|
+
|
|
27
|
+
const queryClient = new QueryClient({
|
|
28
|
+
defaultOptions: {
|
|
29
|
+
queries: {
|
|
30
|
+
gcTime: 1000 * 60 * 60 * 24, // 24 hours
|
|
31
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
32
|
+
retry: 2,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
// Create a custom persister using the Cache class
|
|
38
|
+
const queryCache = new Cache({ namespace: 'tanstack-query' })
|
|
39
|
+
|
|
40
|
+
const persister = {
|
|
41
|
+
persistClient: async (client: any) => {
|
|
42
|
+
const serialized = JSON.stringify(client)
|
|
43
|
+
queryCache.set('query-client-data', serialized)
|
|
44
|
+
},
|
|
45
|
+
restoreClient: async () => {
|
|
46
|
+
const data = queryCache.get('query-client-data')
|
|
47
|
+
return data ? JSON.parse(data) : undefined
|
|
48
|
+
},
|
|
49
|
+
removeClient: async () => {
|
|
50
|
+
queryCache.remove('query-client-data')
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface ProvidersProps extends CommonProps {
|
|
55
|
+
children: ReactNode
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function LoadingFallback(): any {
|
|
59
|
+
return (
|
|
60
|
+
<box padding={2}>
|
|
61
|
+
<text>Loading suspense...</text>
|
|
62
|
+
</box>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface ErrorBoundaryState {
|
|
67
|
+
hasError: boolean
|
|
68
|
+
error: Error | null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
class ErrorBoundaryClass extends Component<
|
|
72
|
+
{ children: ReactNode },
|
|
73
|
+
ErrorBoundaryState
|
|
74
|
+
> {
|
|
75
|
+
constructor(props: { children: ReactNode }) {
|
|
76
|
+
super(props)
|
|
77
|
+
this.state = { hasError: false, error: null }
|
|
78
|
+
|
|
79
|
+
this.openGitHubIssue = this.openGitHubIssue.bind(this)
|
|
80
|
+
this.getRecentLogs = this.getRecentLogs.bind(this)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState> {
|
|
84
|
+
return { hasError: true, error }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
|
|
88
|
+
logger.error('ErrorBoundary caught error:', {
|
|
89
|
+
message: error.message,
|
|
90
|
+
stack: error.stack,
|
|
91
|
+
componentStack: errorInfo.componentStack,
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getRecentLogs(): string {
|
|
96
|
+
const LOG_FILE = path.join(process.cwd(), 'app.log')
|
|
97
|
+
try {
|
|
98
|
+
if (fs.existsSync(LOG_FILE)) {
|
|
99
|
+
const content = fs.readFileSync(LOG_FILE, 'utf-8')
|
|
100
|
+
const lines = content.split('\n').filter((line) => line.trim())
|
|
101
|
+
// Get last 200 lines
|
|
102
|
+
const recentLines = lines.slice(-200)
|
|
103
|
+
return recentLines.join('\n')
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
logger.error('Failed to read log file:', err)
|
|
107
|
+
}
|
|
108
|
+
return 'No logs available'
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
openGitHubIssue(): void {
|
|
112
|
+
const error = this.state.error
|
|
113
|
+
if (!error) return
|
|
114
|
+
|
|
115
|
+
const logs = this.getRecentLogs()
|
|
116
|
+
|
|
117
|
+
// Get navigation stack information for body
|
|
118
|
+
const navigationStack = useStore.getState().navigationStack
|
|
119
|
+
const navigationInfo = navigationStack
|
|
120
|
+
.map((item, index) => {
|
|
121
|
+
const element = item.element as any
|
|
122
|
+
const componentName =
|
|
123
|
+
element?.type?.displayName ||
|
|
124
|
+
element?.type?.name ||
|
|
125
|
+
element?.type ||
|
|
126
|
+
'Unknown'
|
|
127
|
+
return `${index + 1}. ${componentName}`
|
|
128
|
+
})
|
|
129
|
+
.join('\n')
|
|
130
|
+
|
|
131
|
+
// Get current extension/command info
|
|
132
|
+
const extensionPackageJson = useStore.getState().extensionPackageJson
|
|
133
|
+
const currentCommandName = useStore.getState().currentCommandName
|
|
134
|
+
const extensionPath = useStore.getState().extensionPath
|
|
135
|
+
|
|
136
|
+
const extensionName =
|
|
137
|
+
extensionPackageJson?.name ||
|
|
138
|
+
(extensionPath ? path.basename(extensionPath) : null)
|
|
139
|
+
|
|
140
|
+
let contextInfo = ''
|
|
141
|
+
let titlePrefix = ''
|
|
142
|
+
|
|
143
|
+
if (extensionName) {
|
|
144
|
+
contextInfo = `Extension: ${extensionName}`
|
|
145
|
+
titlePrefix = `\`${extensionName}\``
|
|
146
|
+
if (currentCommandName) {
|
|
147
|
+
contextInfo += ` | Command: ${currentCommandName}`
|
|
148
|
+
titlePrefix += ` > \`${currentCommandName}\``
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const title = encodeURIComponent(
|
|
153
|
+
titlePrefix ? `${titlePrefix}: ${error.message}` : error.message,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
const MAX_URL_LENGTH = 4096
|
|
157
|
+
const baseUrl = 'https://github.com/remorses/termcast/issues/new?title='
|
|
158
|
+
const titlePart = `${baseUrl}${title}&body=`
|
|
159
|
+
|
|
160
|
+
// Calculate how much space we have for the body
|
|
161
|
+
const availableBodyLength = MAX_URL_LENGTH - titlePart.length
|
|
162
|
+
|
|
163
|
+
// Always create a minimal body
|
|
164
|
+
const minimalBody = dedent`
|
|
165
|
+
## Error Details
|
|
166
|
+
|
|
167
|
+
**Message:** ${error.message}
|
|
168
|
+
**Context:** ${contextInfo || 'No extension loaded'}
|
|
169
|
+
**Navigation:** \`${navigationStack
|
|
170
|
+
.map((item) => {
|
|
171
|
+
const element = item.element as any
|
|
172
|
+
return (
|
|
173
|
+
element?.type?.displayName ||
|
|
174
|
+
element?.type?.name ||
|
|
175
|
+
element?.type ||
|
|
176
|
+
'Unknown'
|
|
177
|
+
)
|
|
178
|
+
})
|
|
179
|
+
.join(' > ')}\`
|
|
180
|
+
|
|
181
|
+
## Stack Trace
|
|
182
|
+
|
|
183
|
+
\`\`\`\`
|
|
184
|
+
${error.stack || 'No stack trace available'}
|
|
185
|
+
\`\`\`\`
|
|
186
|
+
|
|
187
|
+
## Environment
|
|
188
|
+
|
|
189
|
+
- Platform: ${process.platform}
|
|
190
|
+
- Node Version: ${process.version}
|
|
191
|
+
- Date: ${new Date().toISOString()}
|
|
192
|
+
`
|
|
193
|
+
|
|
194
|
+
let body = encodeURIComponent(minimalBody)
|
|
195
|
+
|
|
196
|
+
// If still too long, just truncate it
|
|
197
|
+
if (body.length > availableBodyLength) {
|
|
198
|
+
body = body.substring(0, availableBodyLength)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const url = `${titlePart}${body}`
|
|
202
|
+
|
|
203
|
+
// Open in browser
|
|
204
|
+
const openCmd =
|
|
205
|
+
process.platform === 'darwin'
|
|
206
|
+
? 'open'
|
|
207
|
+
: process.platform === 'win32'
|
|
208
|
+
? 'start'
|
|
209
|
+
: 'xdg-open'
|
|
210
|
+
|
|
211
|
+
exec(`${openCmd} "${url}"`, (err) => {
|
|
212
|
+
if (err) {
|
|
213
|
+
logger.error('Failed to open browser:', err)
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
render(): any {
|
|
219
|
+
if (this.state.hasError) {
|
|
220
|
+
return (
|
|
221
|
+
<ErrorDisplay
|
|
222
|
+
error={this.state.error}
|
|
223
|
+
onOpenIssue={this.openGitHubIssue}
|
|
224
|
+
getRecentLogs={this.getRecentLogs}
|
|
225
|
+
/>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return this.props.children
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function ErrorDisplay({
|
|
234
|
+
error,
|
|
235
|
+
onOpenIssue,
|
|
236
|
+
getRecentLogs,
|
|
237
|
+
}: {
|
|
238
|
+
error: Error | null
|
|
239
|
+
onOpenIssue: () => void
|
|
240
|
+
getRecentLogs: () => string
|
|
241
|
+
}): any {
|
|
242
|
+
const [isHovered, setIsHovered] = React.useState(false)
|
|
243
|
+
const [showLogs, setShowLogs] = React.useState(false)
|
|
244
|
+
const [focusedIndex, setFocusedIndex] = React.useState(0) // 0 = issue button, 1+ = stack trace lines
|
|
245
|
+
|
|
246
|
+
// Parse stack trace to get file paths with line numbers
|
|
247
|
+
const stackLines = React.useMemo(() => {
|
|
248
|
+
if (!error?.stack) return []
|
|
249
|
+
|
|
250
|
+
const lines = error.stack.split('\n')
|
|
251
|
+
const parsedLines: Array<{ text: string; file?: string; line?: number }> =
|
|
252
|
+
[]
|
|
253
|
+
|
|
254
|
+
for (const line of lines) {
|
|
255
|
+
// Match file paths with line:column format
|
|
256
|
+
// Common patterns: "at file:///path/to/file.ts:123:45" or "at /path/to/file.ts:123:45"
|
|
257
|
+
const match = line.match(
|
|
258
|
+
/at\s+(?:.*?\s+\()?(?:file:\/\/)?([^:\s]+(?:\.tsx?|\.jsx?)):(\d+)(?::\d+)?/,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
if (match) {
|
|
262
|
+
parsedLines.push({
|
|
263
|
+
text: line,
|
|
264
|
+
file: match[1],
|
|
265
|
+
line: parseInt(match[2], 10),
|
|
266
|
+
})
|
|
267
|
+
} else {
|
|
268
|
+
parsedLines.push({ text: line })
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return parsedLines
|
|
273
|
+
}, [error?.stack])
|
|
274
|
+
|
|
275
|
+
// Count of focusable stack lines (those with file paths)
|
|
276
|
+
const focusableStackLines = stackLines.filter((line) => line.file).length
|
|
277
|
+
|
|
278
|
+
useKeyboard(async (evt) => {
|
|
279
|
+
if (evt.name === 'down') {
|
|
280
|
+
setFocusedIndex((prev) => {
|
|
281
|
+
const maxIndex = focusableStackLines // 0 for button + focusable stack lines
|
|
282
|
+
return Math.min(prev + 1, maxIndex)
|
|
283
|
+
})
|
|
284
|
+
} else if (evt.name === 'up') {
|
|
285
|
+
setFocusedIndex((prev) => Math.max(prev - 1, 0))
|
|
286
|
+
} else if (evt.name === 'return') {
|
|
287
|
+
if (focusedIndex === 0) {
|
|
288
|
+
// Issue button is focused
|
|
289
|
+
onOpenIssue()
|
|
290
|
+
} else {
|
|
291
|
+
// Stack trace line is focused - copy file path to clipboard
|
|
292
|
+
let currentFocusableIndex = 0
|
|
293
|
+
for (const line of stackLines) {
|
|
294
|
+
if (line.file) {
|
|
295
|
+
currentFocusableIndex++
|
|
296
|
+
if (currentFocusableIndex === focusedIndex) {
|
|
297
|
+
const filePathWithLine = `${line.file}:${line.line}`
|
|
298
|
+
const { Clipboard } = await import(
|
|
299
|
+
'termcast/src/apis/clipboard'
|
|
300
|
+
)
|
|
301
|
+
await Clipboard.copy(filePathWithLine)
|
|
302
|
+
logger.log(`📋 Copied to clipboard: ${filePathWithLine}`)
|
|
303
|
+
break
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
return (
|
|
312
|
+
<box padding={2} flexDirection='column' gap={1}>
|
|
313
|
+
<text fg={Theme.error} attributes={TextAttributes.BOLD}>
|
|
314
|
+
⚠️ An error occurred
|
|
315
|
+
</text>
|
|
316
|
+
|
|
317
|
+
<text fg={Theme.error}>
|
|
318
|
+
{error?.message || 'An unexpected error occurred'}
|
|
319
|
+
</text>
|
|
320
|
+
|
|
321
|
+
<box
|
|
322
|
+
paddingLeft={1}
|
|
323
|
+
paddingRight={1}
|
|
324
|
+
borderStyle='rounded'
|
|
325
|
+
border={true}
|
|
326
|
+
borderColor={
|
|
327
|
+
focusedIndex === 0
|
|
328
|
+
? Theme.highlight
|
|
329
|
+
: isHovered
|
|
330
|
+
? Theme.highlight
|
|
331
|
+
: Theme.border
|
|
332
|
+
}
|
|
333
|
+
backgroundColor={
|
|
334
|
+
focusedIndex === 0
|
|
335
|
+
? Theme.backgroundPanel
|
|
336
|
+
: isHovered
|
|
337
|
+
? Theme.backgroundPanel
|
|
338
|
+
: undefined
|
|
339
|
+
}
|
|
340
|
+
onMouseMove={() => setIsHovered(true)}
|
|
341
|
+
onMouseOut={() => setIsHovered(false)}
|
|
342
|
+
onMouseDown={onOpenIssue}
|
|
343
|
+
marginTop={1}
|
|
344
|
+
>
|
|
345
|
+
<text>
|
|
346
|
+
{focusedIndex === 0 ? '▶ ' : ' '}📝 Press Enter or click to report
|
|
347
|
+
on GitHub
|
|
348
|
+
</text>
|
|
349
|
+
</box>
|
|
350
|
+
|
|
351
|
+
<box flexDirection='column' marginTop={1}>
|
|
352
|
+
<text fg={Theme.textMuted} attributes={TextAttributes.BOLD}>
|
|
353
|
+
Stack Trace:
|
|
354
|
+
</text>
|
|
355
|
+
{stackLines.map((line, index) => {
|
|
356
|
+
let currentFocusableIndex = 0
|
|
357
|
+
let isFocused = false
|
|
358
|
+
|
|
359
|
+
// Determine if this line is focused
|
|
360
|
+
if (line.file) {
|
|
361
|
+
currentFocusableIndex = stackLines
|
|
362
|
+
.slice(0, index + 1)
|
|
363
|
+
.filter((l) => l.file).length
|
|
364
|
+
isFocused = focusedIndex === currentFocusableIndex
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return (
|
|
368
|
+
<box
|
|
369
|
+
key={index}
|
|
370
|
+
backgroundColor={isFocused ? Theme.backgroundPanel : undefined}
|
|
371
|
+
>
|
|
372
|
+
<text fg={isFocused ? Theme.highlight : Theme.error}>
|
|
373
|
+
{isFocused ? '▶ ' : ' '}
|
|
374
|
+
{line.text}
|
|
375
|
+
</text>
|
|
376
|
+
</box>
|
|
377
|
+
)
|
|
378
|
+
})}
|
|
379
|
+
</box>
|
|
380
|
+
|
|
381
|
+
<box marginTop={1} onMouseDown={() => setShowLogs(!showLogs)}>
|
|
382
|
+
<text fg={Theme.textMuted} attributes={TextAttributes.UNDERLINE}>
|
|
383
|
+
{showLogs ? '▼' : '▶'} Toggle logs (last 200 lines)
|
|
384
|
+
</text>
|
|
385
|
+
</box>
|
|
386
|
+
|
|
387
|
+
{showLogs && (
|
|
388
|
+
<box flexDirection='column' marginTop={1}>
|
|
389
|
+
<text fg={Theme.textMuted} attributes={TextAttributes.BOLD}>
|
|
390
|
+
Recent Logs:
|
|
391
|
+
</text>
|
|
392
|
+
<box
|
|
393
|
+
padding={1}
|
|
394
|
+
borderStyle='single'
|
|
395
|
+
border={true}
|
|
396
|
+
borderColor={Theme.border}
|
|
397
|
+
maxHeight={20}
|
|
398
|
+
>
|
|
399
|
+
<text fg={Theme.textMuted}>{getRecentLogs()}</text>
|
|
400
|
+
</box>
|
|
401
|
+
</box>
|
|
402
|
+
)}
|
|
403
|
+
</box>
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
const ErrorBoundary = ErrorBoundaryClass as any
|
|
408
|
+
|
|
409
|
+
export function Providers(props: ProvidersProps): any {
|
|
410
|
+
return (
|
|
411
|
+
<ErrorBoundary>
|
|
412
|
+
<Suspense fallback={<LoadingFallback />}>
|
|
413
|
+
<PersistQueryClientProvider
|
|
414
|
+
client={queryClient}
|
|
415
|
+
persistOptions={{
|
|
416
|
+
persister,
|
|
417
|
+
maxAge: 1000 * 60 * 60 * 24, // 24 hours
|
|
418
|
+
}}
|
|
419
|
+
>
|
|
420
|
+
<DialogProvider>
|
|
421
|
+
<box padding={2}>
|
|
422
|
+
{/* NavigationProvider must be last to ensure parent providers remain in the tree when navigation changes */}
|
|
423
|
+
<NavigationProvider>{props.children}</NavigationProvider>
|
|
424
|
+
</box>
|
|
425
|
+
</DialogProvider>
|
|
426
|
+
</PersistQueryClientProvider>
|
|
427
|
+
</Suspense>
|
|
428
|
+
</ErrorBoundary>
|
|
429
|
+
)
|
|
430
|
+
}
|