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,205 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { useKeyboard } from '@opentui/react'
|
|
3
|
+
import { Theme } from 'termcast/src/theme'
|
|
4
|
+
import { TextAttributes } from '@opentui/core'
|
|
5
|
+
import { LocalStorage } from 'termcast/src/apis/localstorage'
|
|
6
|
+
import { useStore } from 'termcast/src/state'
|
|
7
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
8
|
+
|
|
9
|
+
export namespace Alert {
|
|
10
|
+
export interface Options {
|
|
11
|
+
icon?: any // TODO: Add proper Image.ImageLike support
|
|
12
|
+
title: string
|
|
13
|
+
message?: string
|
|
14
|
+
primaryAction?: ActionOptions
|
|
15
|
+
dismissAction?: ActionOptions
|
|
16
|
+
rememberUserChoice?: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ActionOptions {
|
|
20
|
+
title: string
|
|
21
|
+
onAction?: () => void
|
|
22
|
+
style?: ActionStyle
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type ActionStyle = 'default' | 'cancel' | 'destructive'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Alert = {
|
|
29
|
+
ActionStyle: {
|
|
30
|
+
Default: 'default' as Alert.ActionStyle,
|
|
31
|
+
Cancel: 'cancel' as Alert.ActionStyle,
|
|
32
|
+
Destructive: 'destructive' as Alert.ActionStyle,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface AlertComponentProps {
|
|
37
|
+
options: Alert.Options
|
|
38
|
+
onConfirm: () => void
|
|
39
|
+
onDismiss: () => void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function AlertComponent({
|
|
43
|
+
options,
|
|
44
|
+
onConfirm,
|
|
45
|
+
onDismiss,
|
|
46
|
+
}: AlertComponentProps): any {
|
|
47
|
+
const [rememberChoice, setRememberChoice] = useState(false)
|
|
48
|
+
const inFocus = useIsInFocus()
|
|
49
|
+
|
|
50
|
+
useKeyboard((evt) => {
|
|
51
|
+
if (!inFocus) return
|
|
52
|
+
|
|
53
|
+
if (evt.name === 'enter') {
|
|
54
|
+
if (options.rememberUserChoice && rememberChoice) {
|
|
55
|
+
LocalStorage.setItem(`alert-remember-${options.title}`, 'true')
|
|
56
|
+
}
|
|
57
|
+
options.primaryAction?.onAction?.()
|
|
58
|
+
onConfirm()
|
|
59
|
+
} else if (evt.name === 'escape') {
|
|
60
|
+
if (options.rememberUserChoice && rememberChoice) {
|
|
61
|
+
LocalStorage.setItem(`alert-remember-${options.title}`, 'false')
|
|
62
|
+
}
|
|
63
|
+
options.dismissAction?.onAction?.()
|
|
64
|
+
onDismiss()
|
|
65
|
+
} else if (evt.name === 'space' && options.rememberUserChoice) {
|
|
66
|
+
setRememberChoice(!rememberChoice)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const primaryStyle = options.primaryAction?.style || Alert.ActionStyle.Default
|
|
71
|
+
const dismissStyle = options.dismissAction?.style || Alert.ActionStyle.Cancel
|
|
72
|
+
|
|
73
|
+
const getPrimaryColor = () => {
|
|
74
|
+
switch (primaryStyle) {
|
|
75
|
+
case Alert.ActionStyle.Destructive:
|
|
76
|
+
return Theme.error
|
|
77
|
+
case Alert.ActionStyle.Default:
|
|
78
|
+
default:
|
|
79
|
+
return Theme.primary
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<box
|
|
85
|
+
border
|
|
86
|
+
borderColor={Theme.border}
|
|
87
|
+
backgroundColor={Theme.backgroundPanel}
|
|
88
|
+
paddingTop={2}
|
|
89
|
+
paddingBottom={2}
|
|
90
|
+
paddingLeft={3}
|
|
91
|
+
paddingRight={3}
|
|
92
|
+
width={60}
|
|
93
|
+
>
|
|
94
|
+
<box flexDirection='column' alignItems='center'>
|
|
95
|
+
{options.icon && (
|
|
96
|
+
<box marginBottom={1}>
|
|
97
|
+
<text fg={Theme.accent}>⚠️</text>
|
|
98
|
+
</box>
|
|
99
|
+
)}
|
|
100
|
+
|
|
101
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
102
|
+
{options.title}
|
|
103
|
+
</text>
|
|
104
|
+
|
|
105
|
+
{options.message && (
|
|
106
|
+
<box marginTop={1} marginBottom={1}>
|
|
107
|
+
<text fg={Theme.textMuted}>{options.message}</text>
|
|
108
|
+
</box>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{options.rememberUserChoice && (
|
|
112
|
+
<box
|
|
113
|
+
marginTop={1}
|
|
114
|
+
marginBottom={1}
|
|
115
|
+
onMouseDown={() => setRememberChoice(!rememberChoice)}
|
|
116
|
+
>
|
|
117
|
+
<text fg={Theme.textMuted} selectable={false}>
|
|
118
|
+
{rememberChoice ? '[x]' : '[ ]'} Do not show this message again
|
|
119
|
+
(Space to toggle)
|
|
120
|
+
</text>
|
|
121
|
+
</box>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
<box flexDirection='row' marginTop={2}>
|
|
125
|
+
<box
|
|
126
|
+
marginRight={2}
|
|
127
|
+
onMouseDown={() => {
|
|
128
|
+
if (options.rememberUserChoice && rememberChoice) {
|
|
129
|
+
LocalStorage.setItem(`alert-remember-${options.title}`, 'true')
|
|
130
|
+
}
|
|
131
|
+
options.primaryAction?.onAction?.()
|
|
132
|
+
onConfirm()
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<text
|
|
136
|
+
fg={getPrimaryColor()}
|
|
137
|
+
attributes={TextAttributes.BOLD}
|
|
138
|
+
selectable={false}
|
|
139
|
+
>
|
|
140
|
+
[{options.primaryAction?.title || 'OK'} (↵)]
|
|
141
|
+
</text>
|
|
142
|
+
</box>
|
|
143
|
+
<box
|
|
144
|
+
onMouseDown={() => {
|
|
145
|
+
if (options.rememberUserChoice && rememberChoice) {
|
|
146
|
+
LocalStorage.setItem(`alert-remember-${options.title}`, 'false')
|
|
147
|
+
}
|
|
148
|
+
options.dismissAction?.onAction?.()
|
|
149
|
+
onDismiss()
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<text fg={Theme.textMuted} selectable={false}>
|
|
153
|
+
[{options.dismissAction?.title || 'Cancel'} (ESC)]
|
|
154
|
+
</text>
|
|
155
|
+
</box>
|
|
156
|
+
</box>
|
|
157
|
+
</box>
|
|
158
|
+
</box>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export async function confirmAlert(options: Alert.Options): Promise<boolean> {
|
|
163
|
+
// Check if user previously selected "remember choice"
|
|
164
|
+
if (options.rememberUserChoice) {
|
|
165
|
+
const remembered = await LocalStorage.getItem(
|
|
166
|
+
`alert-remember-${options.title}`,
|
|
167
|
+
)
|
|
168
|
+
if (remembered === 'true') {
|
|
169
|
+
options.primaryAction?.onAction?.()
|
|
170
|
+
return true
|
|
171
|
+
} else if (remembered === 'false') {
|
|
172
|
+
options.dismissAction?.onAction?.()
|
|
173
|
+
return false
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return new Promise<boolean>((resolve) => {
|
|
178
|
+
const handleConfirm = () => {
|
|
179
|
+
useStore.setState({ dialogStack: [] })
|
|
180
|
+
resolve(true)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const handleDismiss = () => {
|
|
184
|
+
useStore.setState({ dialogStack: [] })
|
|
185
|
+
resolve(false)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const state = useStore.getState()
|
|
189
|
+
useStore.setState({
|
|
190
|
+
dialogStack: [
|
|
191
|
+
...state.dialogStack,
|
|
192
|
+
{
|
|
193
|
+
element: (
|
|
194
|
+
<AlertComponent
|
|
195
|
+
options={options}
|
|
196
|
+
onConfirm={handleConfirm}
|
|
197
|
+
onDismiss={handleDismiss}
|
|
198
|
+
/>
|
|
199
|
+
),
|
|
200
|
+
position: 'center',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import React, { ReactNode, useMemo, ReactElement } from 'react'
|
|
2
|
+
import { TextAttributes } from '@opentui/core'
|
|
3
|
+
import { useKeyboard } from '@opentui/react'
|
|
4
|
+
import { Theme } from 'termcast/src/theme'
|
|
5
|
+
import { InFocus, useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
6
|
+
import { ActionPanel, Action } from 'termcast/src/components/actions'
|
|
7
|
+
import { Image } from 'termcast/src/components/list'
|
|
8
|
+
import { Color } from 'termcast/src/colors'
|
|
9
|
+
import { useStore } from 'termcast/src/state'
|
|
10
|
+
import { useDialog } from 'termcast/src/internal/dialog'
|
|
11
|
+
|
|
12
|
+
interface ActionsInterface {
|
|
13
|
+
actions?: ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface NavigationChildInterface {
|
|
17
|
+
navigationTitle?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface DetailProps extends ActionsInterface, NavigationChildInterface {
|
|
21
|
+
markdown?: string | null
|
|
22
|
+
metadata?: ReactNode
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface DetailPropsWithLoading {
|
|
26
|
+
isLoading?: boolean
|
|
27
|
+
markdown?: string | null
|
|
28
|
+
metadata?: ReactNode
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface MetadataProps {
|
|
32
|
+
children: ReactNode
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface LabelProps {
|
|
36
|
+
title: string
|
|
37
|
+
icon?: Image.ImageLike | undefined | null
|
|
38
|
+
text?:
|
|
39
|
+
| string
|
|
40
|
+
| {
|
|
41
|
+
value: string
|
|
42
|
+
color?: Color | null
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface SeparatorProps {}
|
|
47
|
+
|
|
48
|
+
interface LinkProps {
|
|
49
|
+
title: string
|
|
50
|
+
target: string
|
|
51
|
+
text: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface TagListProps {
|
|
55
|
+
title: string
|
|
56
|
+
children: ReactNode
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface TagListItemProps {
|
|
60
|
+
icon?: Image.ImageLike | undefined | null
|
|
61
|
+
text?: string
|
|
62
|
+
color?: Color.ColorLike | undefined | null
|
|
63
|
+
onAction?: () => void
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface DetailType {
|
|
67
|
+
(props: DetailProps): any
|
|
68
|
+
Metadata: DetailMetadataType
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const DetailMetadataLabel = (props: LabelProps): any => {
|
|
72
|
+
const textValue =
|
|
73
|
+
typeof props.text === 'string' ? props.text : props.text?.value
|
|
74
|
+
const textColor =
|
|
75
|
+
typeof props.text === 'object' ? props.text?.color : undefined
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<box
|
|
79
|
+
style={{
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
paddingBottom: 1,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<text fg={Theme.textMuted} style={{ minWidth: 15 }}>
|
|
85
|
+
{props.title}:
|
|
86
|
+
</text>
|
|
87
|
+
<text fg={textColor || Theme.text}>{textValue || '—'}</text>
|
|
88
|
+
</box>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const DetailMetadataSeparator = (props: SeparatorProps): any => {
|
|
93
|
+
return (
|
|
94
|
+
<box
|
|
95
|
+
style={{
|
|
96
|
+
paddingTop: 1,
|
|
97
|
+
paddingBottom: 1,
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
<text fg={Theme.textMuted}>{'─'.repeat(30)}</text>
|
|
101
|
+
</box>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const DetailMetadataLink = (props: LinkProps): any => {
|
|
106
|
+
return (
|
|
107
|
+
<box
|
|
108
|
+
style={{
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
paddingBottom: 1,
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<text fg={Theme.textMuted} style={{ minWidth: 15 }}>
|
|
114
|
+
{props.title}:
|
|
115
|
+
</text>
|
|
116
|
+
<text fg={Theme.accent} attributes={TextAttributes.UNDERLINE}>
|
|
117
|
+
{props.text}
|
|
118
|
+
</text>
|
|
119
|
+
</box>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const DetailMetadataTagListItem = (props: TagListItemProps): any => {
|
|
124
|
+
const displayText = props.text || ''
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<text
|
|
128
|
+
fg={props.color || Theme.text}
|
|
129
|
+
style={{
|
|
130
|
+
paddingRight: 1,
|
|
131
|
+
paddingLeft: props.icon ? 1 : 0,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
{displayText}
|
|
135
|
+
</text>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface DetailMetadataTagListType {
|
|
140
|
+
(props: TagListProps): any
|
|
141
|
+
Item: (props: TagListItemProps) => any
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const DetailMetadataTagList: DetailMetadataTagListType = (props) => {
|
|
145
|
+
return (
|
|
146
|
+
<box
|
|
147
|
+
style={{
|
|
148
|
+
flexDirection: 'column',
|
|
149
|
+
paddingBottom: 1,
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<text fg={Theme.textMuted} style={{ minWidth: 15 }}>
|
|
153
|
+
{props.title}:
|
|
154
|
+
</text>
|
|
155
|
+
<box style={{ flexDirection: 'row' }}>{props.children}</box>
|
|
156
|
+
</box>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
DetailMetadataTagList.Item = DetailMetadataTagListItem
|
|
161
|
+
|
|
162
|
+
interface DetailMetadataType {
|
|
163
|
+
(props: MetadataProps): any
|
|
164
|
+
Label: (props: LabelProps) => any
|
|
165
|
+
Separator: (props: SeparatorProps) => any
|
|
166
|
+
Link: (props: LinkProps) => any
|
|
167
|
+
TagList: DetailMetadataTagListType
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const DetailMetadata: DetailMetadataType = (props) => {
|
|
171
|
+
return (
|
|
172
|
+
<box
|
|
173
|
+
style={{
|
|
174
|
+
flexDirection: 'column',
|
|
175
|
+
paddingTop: 2,
|
|
176
|
+
paddingLeft: 2,
|
|
177
|
+
paddingRight: 2,
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
{props.children}
|
|
181
|
+
</box>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
DetailMetadata.Label = DetailMetadataLabel
|
|
186
|
+
DetailMetadata.Separator = DetailMetadataSeparator
|
|
187
|
+
DetailMetadata.Link = DetailMetadataLink
|
|
188
|
+
DetailMetadata.TagList = DetailMetadataTagList
|
|
189
|
+
|
|
190
|
+
function DetailFooter({
|
|
191
|
+
hasActions,
|
|
192
|
+
firstActionTitle,
|
|
193
|
+
}: {
|
|
194
|
+
hasActions?: boolean
|
|
195
|
+
firstActionTitle?: string
|
|
196
|
+
}): any {
|
|
197
|
+
const toast = useStore((state) => state.toast)
|
|
198
|
+
|
|
199
|
+
if (toast) {
|
|
200
|
+
return (
|
|
201
|
+
<box
|
|
202
|
+
border={false}
|
|
203
|
+
style={{
|
|
204
|
+
paddingLeft: 1,
|
|
205
|
+
paddingRight: 1,
|
|
206
|
+
paddingTop: 1,
|
|
207
|
+
marginTop: 1,
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
{toast}
|
|
211
|
+
</box>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<box
|
|
217
|
+
border={false}
|
|
218
|
+
style={{
|
|
219
|
+
paddingLeft: 1,
|
|
220
|
+
paddingRight: 1,
|
|
221
|
+
paddingTop: 1,
|
|
222
|
+
marginTop: 1,
|
|
223
|
+
flexDirection: 'row',
|
|
224
|
+
}}
|
|
225
|
+
>
|
|
226
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
227
|
+
esc
|
|
228
|
+
</text>
|
|
229
|
+
<text fg={Theme.textMuted}> go back</text>
|
|
230
|
+
{hasActions && (
|
|
231
|
+
<>
|
|
232
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
233
|
+
{' '}^k
|
|
234
|
+
</text>
|
|
235
|
+
<text fg={Theme.textMuted}> actions</text>
|
|
236
|
+
</>
|
|
237
|
+
)}
|
|
238
|
+
{hasActions && firstActionTitle && (
|
|
239
|
+
<>
|
|
240
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
241
|
+
{' '}↵
|
|
242
|
+
</text>
|
|
243
|
+
<text fg={Theme.textMuted}> {firstActionTitle}</text>
|
|
244
|
+
</>
|
|
245
|
+
)}
|
|
246
|
+
</box>
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Helper to extract first action title from actions
|
|
251
|
+
function getFirstActionTitle(actions: ReactNode): string | undefined {
|
|
252
|
+
let firstTitle: string | undefined
|
|
253
|
+
|
|
254
|
+
const findFirstAction = (nodes: ReactNode): void => {
|
|
255
|
+
React.Children.forEach(nodes, (child) => {
|
|
256
|
+
if (firstTitle) return
|
|
257
|
+
|
|
258
|
+
if (React.isValidElement(child)) {
|
|
259
|
+
const actionTypes = [
|
|
260
|
+
Action,
|
|
261
|
+
Action.Push,
|
|
262
|
+
Action.CopyToClipboard,
|
|
263
|
+
Action.OpenInBrowser,
|
|
264
|
+
Action.Open,
|
|
265
|
+
Action.Paste,
|
|
266
|
+
]
|
|
267
|
+
|
|
268
|
+
if (actionTypes.includes(child.type as any)) {
|
|
269
|
+
firstTitle = (child.props as any).title
|
|
270
|
+
} else if (child.type === ActionPanel) {
|
|
271
|
+
findFirstAction((child.props as any).children)
|
|
272
|
+
} else if (child.type === ActionPanel.Section) {
|
|
273
|
+
findFirstAction((child.props as any).children)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
findFirstAction(actions)
|
|
280
|
+
return firstTitle
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const Detail: DetailType = (props) => {
|
|
284
|
+
const { actions } = props
|
|
285
|
+
const dialog = useDialog()
|
|
286
|
+
const inFocus = useIsInFocus()
|
|
287
|
+
|
|
288
|
+
const markdownLines = useMemo(() => {
|
|
289
|
+
if (!props.markdown) return []
|
|
290
|
+
// TODO: Implement proper markdown parsing
|
|
291
|
+
return props.markdown.split('\n')
|
|
292
|
+
}, [props.markdown])
|
|
293
|
+
|
|
294
|
+
const firstActionTitle = useMemo(() => {
|
|
295
|
+
return actions ? getFirstActionTitle(actions) : undefined
|
|
296
|
+
}, [actions])
|
|
297
|
+
|
|
298
|
+
// Handle Ctrl+K and Return to show actions
|
|
299
|
+
useKeyboard((evt) => {
|
|
300
|
+
if (!inFocus) return
|
|
301
|
+
|
|
302
|
+
if (evt.name === 'k' && evt.ctrl && actions) {
|
|
303
|
+
dialog.push(actions, 'bottom-right')
|
|
304
|
+
} else if (evt.name === 'return' && actions) {
|
|
305
|
+
dialog.push(actions, 'bottom-right')
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
const content = (
|
|
310
|
+
<box
|
|
311
|
+
style={{
|
|
312
|
+
flexDirection: 'row',
|
|
313
|
+
flexGrow: 1,
|
|
314
|
+
width: '100%',
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<box
|
|
318
|
+
style={{
|
|
319
|
+
flexGrow: 1,
|
|
320
|
+
flexDirection: 'column',
|
|
321
|
+
paddingTop: 2,
|
|
322
|
+
// paddingLeft: 2,
|
|
323
|
+
paddingRight: props.metadata ? 1 : 2,
|
|
324
|
+
}}
|
|
325
|
+
>
|
|
326
|
+
{markdownLines.map((line, index) => (
|
|
327
|
+
<text key={index} fg={Theme.text}>
|
|
328
|
+
{line || ' '}
|
|
329
|
+
</text>
|
|
330
|
+
))}
|
|
331
|
+
</box>
|
|
332
|
+
{props.metadata && (
|
|
333
|
+
<box
|
|
334
|
+
style={{
|
|
335
|
+
flexShrink: 0,
|
|
336
|
+
width: 40,
|
|
337
|
+
}}
|
|
338
|
+
>
|
|
339
|
+
{props.metadata}
|
|
340
|
+
</box>
|
|
341
|
+
)}
|
|
342
|
+
</box>
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
return (
|
|
346
|
+
<box style={{ flexDirection: 'column', height: '100%' }}>
|
|
347
|
+
{content}
|
|
348
|
+
<DetailFooter
|
|
349
|
+
hasActions={!!actions}
|
|
350
|
+
firstActionTitle={firstActionTitle}
|
|
351
|
+
/>
|
|
352
|
+
</box>
|
|
353
|
+
)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
Detail.Metadata = DetailMetadata
|
|
357
|
+
|
|
358
|
+
export { Detail }
|
|
359
|
+
export type { DetailProps, DetailPropsWithLoading }
|