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,233 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Theme } from 'termcast/src/theme'
|
|
3
|
+
import { WithLeftBorder } from './with-left-border'
|
|
4
|
+
import { FormItemProps, FormItemRef } from './types'
|
|
5
|
+
import { useFormContext, Controller } from 'react-hook-form'
|
|
6
|
+
import { useFocusContext } from './index'
|
|
7
|
+
import { useKeyboard } from '@opentui/react'
|
|
8
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
9
|
+
import { FileAutocomplete } from './file-autocomplete'
|
|
10
|
+
|
|
11
|
+
export interface FilePickerProps extends FormItemProps<string[]> {
|
|
12
|
+
/**
|
|
13
|
+
* Indicates whether the user can select multiple items or only one.
|
|
14
|
+
* @defaultValue `true`
|
|
15
|
+
*/
|
|
16
|
+
allowMultipleSelection?: boolean
|
|
17
|
+
/**
|
|
18
|
+
* Indicates whether it's possible to choose a directory.
|
|
19
|
+
* Note: On Windows, this property is ignored if `canChooseFiles` is set to `true`.
|
|
20
|
+
* @defaultValue `false`
|
|
21
|
+
*/
|
|
22
|
+
canChooseDirectories?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* Indicates whether it's possible to choose a file.
|
|
25
|
+
* @defaultValue `true`
|
|
26
|
+
*/
|
|
27
|
+
canChooseFiles?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether the file picker displays files that are normally hidden from the user.
|
|
30
|
+
* @defaultValue `false`
|
|
31
|
+
*/
|
|
32
|
+
showHiddenFiles?: boolean
|
|
33
|
+
/**
|
|
34
|
+
* Placeholder text for the input field
|
|
35
|
+
*/
|
|
36
|
+
placeholder?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type FilePickerRef = FormItemRef
|
|
40
|
+
|
|
41
|
+
const FilePickerField = ({
|
|
42
|
+
field,
|
|
43
|
+
fieldState,
|
|
44
|
+
formState,
|
|
45
|
+
props,
|
|
46
|
+
isFocused,
|
|
47
|
+
setFocusedField,
|
|
48
|
+
}: {
|
|
49
|
+
field: any
|
|
50
|
+
fieldState: any
|
|
51
|
+
formState: any
|
|
52
|
+
props: FilePickerProps
|
|
53
|
+
isFocused: boolean
|
|
54
|
+
setFocusedField: (id: string) => void
|
|
55
|
+
}): any => {
|
|
56
|
+
const isInFocus = useIsInFocus()
|
|
57
|
+
const [inputValue, setInputValue] = React.useState('')
|
|
58
|
+
const [showAutocomplete, setShowAutocomplete] = React.useState(false)
|
|
59
|
+
const inputRef = React.useRef<any>(null)
|
|
60
|
+
const anchorRef = React.useRef<any>(null)
|
|
61
|
+
|
|
62
|
+
// Show autocomplete when typing
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
if (inputValue && isFocused) {
|
|
65
|
+
setShowAutocomplete(true)
|
|
66
|
+
} else if (!inputValue) {
|
|
67
|
+
setShowAutocomplete(false)
|
|
68
|
+
}
|
|
69
|
+
}, [inputValue, isFocused])
|
|
70
|
+
|
|
71
|
+
// Handle Enter key
|
|
72
|
+
useKeyboard((evt) => {
|
|
73
|
+
if (!isFocused || !isInFocus) return
|
|
74
|
+
|
|
75
|
+
if (evt.name === 'return') {
|
|
76
|
+
// If input is empty, show files in current directory
|
|
77
|
+
if (!inputValue && !showAutocomplete) {
|
|
78
|
+
setShowAutocomplete(true)
|
|
79
|
+
}
|
|
80
|
+
// If autocomplete is not visible and input has value, add the path
|
|
81
|
+
else if (inputValue.trim() && !showAutocomplete) {
|
|
82
|
+
const currentFiles = field.value || []
|
|
83
|
+
const newFiles =
|
|
84
|
+
props.allowMultipleSelection !== false
|
|
85
|
+
? [...currentFiles, inputValue.trim()]
|
|
86
|
+
: [inputValue.trim()]
|
|
87
|
+
field.onChange(newFiles)
|
|
88
|
+
if (props.onChange) {
|
|
89
|
+
props.onChange(newFiles)
|
|
90
|
+
}
|
|
91
|
+
setInputValue('')
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const handleSelectFile = (path: string) => {
|
|
97
|
+
const currentFiles = field.value || []
|
|
98
|
+
const newFiles =
|
|
99
|
+
props.allowMultipleSelection !== false ? [...currentFiles, path] : [path]
|
|
100
|
+
field.onChange(newFiles)
|
|
101
|
+
if (props.onChange) {
|
|
102
|
+
props.onChange(newFiles)
|
|
103
|
+
}
|
|
104
|
+
setInputValue('')
|
|
105
|
+
setShowAutocomplete(false)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const selectedFiles = field.value || []
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<box flexDirection='column'>
|
|
112
|
+
<WithLeftBorder withDiamond isFocused={isFocused}>
|
|
113
|
+
<text
|
|
114
|
+
fg={Theme.text}
|
|
115
|
+
onMouseDown={() => {
|
|
116
|
+
setFocusedField(props.id)
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{props.title || 'File Path'}
|
|
120
|
+
</text>
|
|
121
|
+
</WithLeftBorder>
|
|
122
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
123
|
+
<box flexDirection='column' ref={anchorRef}>
|
|
124
|
+
<input
|
|
125
|
+
ref={inputRef}
|
|
126
|
+
value={inputValue}
|
|
127
|
+
placeholder={props.placeholder || 'Enter file path...'}
|
|
128
|
+
focused={isFocused}
|
|
129
|
+
onMouseDown={() => setFocusedField(props.id)}
|
|
130
|
+
onInput={(value: string) => setInputValue(value)}
|
|
131
|
+
/>
|
|
132
|
+
{selectedFiles.length > 0 && (
|
|
133
|
+
<box flexDirection='column' marginTop={1}>
|
|
134
|
+
<text fg={Theme.textMuted}>Selected files:</text>
|
|
135
|
+
{selectedFiles.map((file: string, index: number) => (
|
|
136
|
+
<text key={index} fg={Theme.text}>
|
|
137
|
+
• {file}
|
|
138
|
+
</text>
|
|
139
|
+
))}
|
|
140
|
+
</box>
|
|
141
|
+
)}
|
|
142
|
+
</box>
|
|
143
|
+
</WithLeftBorder>
|
|
144
|
+
{(fieldState.error || props.error) && (
|
|
145
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
146
|
+
<text fg={Theme.error}>
|
|
147
|
+
{fieldState.error?.message || props.error}
|
|
148
|
+
</text>
|
|
149
|
+
</WithLeftBorder>
|
|
150
|
+
)}
|
|
151
|
+
{props.info && (
|
|
152
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
153
|
+
<text fg={Theme.textMuted}>{props.info}</text>
|
|
154
|
+
</WithLeftBorder>
|
|
155
|
+
)}
|
|
156
|
+
<FileAutocomplete
|
|
157
|
+
value={inputValue}
|
|
158
|
+
onChange={(newValue) => {
|
|
159
|
+
setInputValue(newValue)
|
|
160
|
+
// Move cursor to end when value changes
|
|
161
|
+
if (inputRef.current) {
|
|
162
|
+
inputRef.current.cursorPosition = newValue.length
|
|
163
|
+
}
|
|
164
|
+
}}
|
|
165
|
+
onSelect={handleSelectFile}
|
|
166
|
+
visible={showAutocomplete}
|
|
167
|
+
onVisibilityChange={setShowAutocomplete}
|
|
168
|
+
inputRef={inputRef}
|
|
169
|
+
anchorRef={anchorRef}
|
|
170
|
+
/>
|
|
171
|
+
</box>
|
|
172
|
+
) as React.ReactElement
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const FilePicker = (props: FilePickerProps): any => {
|
|
176
|
+
const { control, getValues } = useFormContext()
|
|
177
|
+
const { focusedField, setFocusedField } = useFocusContext()
|
|
178
|
+
const isFocused = focusedField === props.id
|
|
179
|
+
const isInFocus = useIsInFocus()
|
|
180
|
+
|
|
181
|
+
const handleNavigateUp = () => {
|
|
182
|
+
// Find previous field and focus it
|
|
183
|
+
const fieldNames = Object.keys(getValues())
|
|
184
|
+
const currentIndex = fieldNames.indexOf(props.id)
|
|
185
|
+
if (currentIndex > 0) {
|
|
186
|
+
setFocusedField(fieldNames[currentIndex - 1])
|
|
187
|
+
} else {
|
|
188
|
+
setFocusedField(fieldNames[fieldNames.length - 1])
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const handleNavigateDown = () => {
|
|
193
|
+
// Find next field and focus it
|
|
194
|
+
const fieldNames = Object.keys(getValues())
|
|
195
|
+
const currentIndex = fieldNames.indexOf(props.id)
|
|
196
|
+
if (currentIndex < fieldNames.length - 1) {
|
|
197
|
+
setFocusedField(fieldNames[currentIndex + 1])
|
|
198
|
+
} else {
|
|
199
|
+
setFocusedField(fieldNames[0])
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Handle keyboard navigation
|
|
204
|
+
useKeyboard((evt) => {
|
|
205
|
+
if (!isFocused || !isInFocus) return
|
|
206
|
+
|
|
207
|
+
if (evt.name === 'tab') {
|
|
208
|
+
if (evt.shift) {
|
|
209
|
+
handleNavigateUp()
|
|
210
|
+
} else {
|
|
211
|
+
handleNavigateDown()
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<Controller
|
|
218
|
+
name={props.id}
|
|
219
|
+
control={control}
|
|
220
|
+
defaultValue={props.defaultValue || props.value || []}
|
|
221
|
+
render={(renderProps) => {
|
|
222
|
+
return (
|
|
223
|
+
<FilePickerField
|
|
224
|
+
{...renderProps}
|
|
225
|
+
props={props}
|
|
226
|
+
isFocused={isFocused}
|
|
227
|
+
setFocusedField={setFocusedField}
|
|
228
|
+
/>
|
|
229
|
+
) as React.ReactElement
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React, { useState, createContext, useContext, useEffect } from 'react'
|
|
2
|
+
import { useKeyboard } from '@opentui/react'
|
|
3
|
+
import { useForm, FormProvider } from 'react-hook-form'
|
|
4
|
+
import { ActionPanel } from 'termcast/src/components/actions'
|
|
5
|
+
import { logger } from 'termcast/src/logger'
|
|
6
|
+
import { InFocus, useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
7
|
+
import { useDialog } from 'termcast/src/internal/dialog'
|
|
8
|
+
import { Theme } from 'termcast/src/theme'
|
|
9
|
+
import { TextAttributes } from '@opentui/core'
|
|
10
|
+
import { useStore } from 'termcast/src/state'
|
|
11
|
+
import {
|
|
12
|
+
FormValues,
|
|
13
|
+
FormProps,
|
|
14
|
+
FormItemProps,
|
|
15
|
+
FormEvent,
|
|
16
|
+
FormEventType,
|
|
17
|
+
FormItemRef,
|
|
18
|
+
FormValue_2,
|
|
19
|
+
FormValues_2,
|
|
20
|
+
FormProps_2,
|
|
21
|
+
FormItemProps_2,
|
|
22
|
+
} from './types'
|
|
23
|
+
|
|
24
|
+
export * from './types'
|
|
25
|
+
export { useFormContext } from 'react-hook-form'
|
|
26
|
+
|
|
27
|
+
// Context for managing focused field
|
|
28
|
+
interface FocusContextValue {
|
|
29
|
+
focusedField: string | null
|
|
30
|
+
setFocusedField: (id: string | null) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const FocusContext = createContext<FocusContextValue | null>(null)
|
|
34
|
+
|
|
35
|
+
export const useFocusContext = () => {
|
|
36
|
+
const context = useContext(FocusContext)
|
|
37
|
+
if (!context) {
|
|
38
|
+
throw new Error('Form components must be used within a Form')
|
|
39
|
+
}
|
|
40
|
+
return context
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Context for form submission
|
|
44
|
+
interface FormSubmitContextValue {
|
|
45
|
+
getFormValues: () => FormValues
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const FormSubmitContext = createContext<FormSubmitContextValue | null>(null)
|
|
49
|
+
|
|
50
|
+
export const useFormSubmit = () => {
|
|
51
|
+
const context = useContext(FormSubmitContext)
|
|
52
|
+
return context // Can be null if not in a form
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Footer component to show keyboard shortcuts
|
|
56
|
+
function FormFooter(): any {
|
|
57
|
+
const toast = useStore((state) => state.toast)
|
|
58
|
+
|
|
59
|
+
if (toast) {
|
|
60
|
+
return (
|
|
61
|
+
<box
|
|
62
|
+
border={false}
|
|
63
|
+
style={{
|
|
64
|
+
paddingLeft: 1,
|
|
65
|
+
paddingRight: 1,
|
|
66
|
+
paddingTop: 1,
|
|
67
|
+
marginTop: 1,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{toast}
|
|
71
|
+
</box>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<box
|
|
77
|
+
border={false}
|
|
78
|
+
style={{
|
|
79
|
+
paddingLeft: 1,
|
|
80
|
+
paddingRight: 1,
|
|
81
|
+
paddingTop: 1,
|
|
82
|
+
marginTop: 1,
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
87
|
+
↵
|
|
88
|
+
</text>
|
|
89
|
+
<text fg={Theme.textMuted}> submit</text>
|
|
90
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
91
|
+
{' '}↑↓
|
|
92
|
+
</text>
|
|
93
|
+
<text fg={Theme.textMuted}> navigate</text>
|
|
94
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
95
|
+
{' '}^k
|
|
96
|
+
</text>
|
|
97
|
+
<text fg={Theme.textMuted}> actions</text>
|
|
98
|
+
</box>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
import type { TextFieldProps, TextFieldRef } from './text-field'
|
|
103
|
+
import type { PasswordFieldProps, PasswordFieldRef } from './password-field'
|
|
104
|
+
import type { TextAreaProps, TextAreaRef } from './text-area'
|
|
105
|
+
import type { CheckboxProps, CheckboxRef } from './checkbox'
|
|
106
|
+
import type {
|
|
107
|
+
DropdownProps,
|
|
108
|
+
DropdownRef,
|
|
109
|
+
DropdownItemProps,
|
|
110
|
+
DropdownSectionProps,
|
|
111
|
+
} from './dropdown'
|
|
112
|
+
import type {
|
|
113
|
+
DatePickerProps,
|
|
114
|
+
DatePickerRef,
|
|
115
|
+
DatePickerType as DatePickerEnum,
|
|
116
|
+
} from './date-picker'
|
|
117
|
+
import type { TagPickerType } from './tagpicker'
|
|
118
|
+
import type { DescriptionProps } from './description'
|
|
119
|
+
import type { FilePickerProps, FilePickerRef } from './file-picker'
|
|
120
|
+
|
|
121
|
+
interface DropdownType {
|
|
122
|
+
(props: DropdownProps): any
|
|
123
|
+
Item: (props: DropdownItemProps) => any
|
|
124
|
+
Section: (props: DropdownSectionProps) => any
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface DatePickerComponentType {
|
|
128
|
+
(props: DatePickerProps): any
|
|
129
|
+
Type: typeof DatePickerEnum
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface FormType {
|
|
133
|
+
(props: FormProps): any
|
|
134
|
+
TextField: React.ForwardRefExoticComponent<
|
|
135
|
+
TextFieldProps & React.RefAttributes<TextFieldRef>
|
|
136
|
+
>
|
|
137
|
+
PasswordField: React.ForwardRefExoticComponent<
|
|
138
|
+
PasswordFieldProps & React.RefAttributes<PasswordFieldRef>
|
|
139
|
+
>
|
|
140
|
+
TextArea: React.ForwardRefExoticComponent<
|
|
141
|
+
TextAreaProps & React.RefAttributes<TextAreaRef>
|
|
142
|
+
>
|
|
143
|
+
Checkbox: React.ForwardRefExoticComponent<
|
|
144
|
+
CheckboxProps & React.RefAttributes<CheckboxRef>
|
|
145
|
+
>
|
|
146
|
+
Dropdown: DropdownType
|
|
147
|
+
DatePicker: DatePickerComponentType
|
|
148
|
+
TagPicker: TagPickerType
|
|
149
|
+
FilePicker: (props: FilePickerProps) => any
|
|
150
|
+
Separator: () => any
|
|
151
|
+
Description: (props: DescriptionProps) => any
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const Form: FormType = ((props) => {
|
|
155
|
+
const methods = useForm<FormValues>({
|
|
156
|
+
// defaultValues: {},
|
|
157
|
+
// mode: 'onChange',
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
const [focusedField, setFocusedField] = useState<string | null>(null)
|
|
161
|
+
|
|
162
|
+
// Auto-focus first field on mount
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
const fieldNames = Object.keys(methods.getValues())
|
|
165
|
+
if (fieldNames.length > 0) {
|
|
166
|
+
logger.log(`focusing `, fieldNames[0])
|
|
167
|
+
setFocusedField(fieldNames[0])
|
|
168
|
+
} else {
|
|
169
|
+
logger.log(`no fields to focus in form`)
|
|
170
|
+
}
|
|
171
|
+
}, [])
|
|
172
|
+
|
|
173
|
+
// Get focus state and dialog
|
|
174
|
+
const inFocus = useIsInFocus()
|
|
175
|
+
const dialog = useDialog()
|
|
176
|
+
|
|
177
|
+
// Handle action key navigation only
|
|
178
|
+
useKeyboard((evt) => {
|
|
179
|
+
// Only handle keyboard events when form is in focus
|
|
180
|
+
if (!inFocus) return
|
|
181
|
+
|
|
182
|
+
if (evt.name === 'k' && evt.ctrl && props.actions) {
|
|
183
|
+
// Ctrl+K shows actions
|
|
184
|
+
dialog.push(
|
|
185
|
+
<FormSubmitContext.Provider value={submitContextValue}>
|
|
186
|
+
{props.actions}
|
|
187
|
+
</FormSubmitContext.Provider>,
|
|
188
|
+
'bottom-right',
|
|
189
|
+
)
|
|
190
|
+
} else if (evt.name === 'return' && evt.meta && props.actions) {
|
|
191
|
+
// Cmd+Return also shows actions (consistent with List)
|
|
192
|
+
dialog.push(
|
|
193
|
+
<FormSubmitContext.Provider value={submitContextValue}>
|
|
194
|
+
{props.actions}
|
|
195
|
+
</FormSubmitContext.Provider>,
|
|
196
|
+
'bottom-right',
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
const submitContextValue: FormSubmitContextValue = {
|
|
202
|
+
getFormValues: () => methods.getValues(),
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<FormProvider {...methods}>
|
|
207
|
+
<FormSubmitContext.Provider value={submitContextValue}>
|
|
208
|
+
<FocusContext.Provider value={{ focusedField, setFocusedField }}>
|
|
209
|
+
<box flexDirection='column'>
|
|
210
|
+
{props.children}
|
|
211
|
+
<FormEnd />
|
|
212
|
+
<FormFooter />
|
|
213
|
+
</box>
|
|
214
|
+
</FocusContext.Provider>
|
|
215
|
+
</FormSubmitContext.Provider>
|
|
216
|
+
</FormProvider>
|
|
217
|
+
)
|
|
218
|
+
}) as FormType
|
|
219
|
+
|
|
220
|
+
// Import and assign components after Form is defined
|
|
221
|
+
import { TextField } from './text-field'
|
|
222
|
+
import { PasswordField } from './password-field'
|
|
223
|
+
import { TextArea } from './text-area'
|
|
224
|
+
import { Checkbox } from './checkbox'
|
|
225
|
+
import { Dropdown } from './dropdown'
|
|
226
|
+
import { DatePicker } from './date-picker'
|
|
227
|
+
import { TagPicker } from './tagpicker'
|
|
228
|
+
import { Separator } from './separator'
|
|
229
|
+
import { Description } from './description'
|
|
230
|
+
import { FormEnd } from './form-end'
|
|
231
|
+
import { FilePicker } from './file-picker'
|
|
232
|
+
|
|
233
|
+
Form.TextField = TextField as any
|
|
234
|
+
Form.PasswordField = PasswordField as any
|
|
235
|
+
Form.TextArea = TextArea as any
|
|
236
|
+
Form.Checkbox = Checkbox as any
|
|
237
|
+
Form.Dropdown = Dropdown
|
|
238
|
+
Form.DatePicker = DatePicker
|
|
239
|
+
Form.TagPicker = TagPicker
|
|
240
|
+
Form.FilePicker = FilePicker
|
|
241
|
+
Form.Separator = Separator
|
|
242
|
+
Form.Description = Description
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { TextAttributes } from '@opentui/core'
|
|
3
|
+
import { useFormContext, Controller } from 'react-hook-form'
|
|
4
|
+
import { useFocusContext } from './index'
|
|
5
|
+
import { FormItemProps, FormItemRef } from './types'
|
|
6
|
+
import { logger } from 'termcast/src/logger'
|
|
7
|
+
import { Theme } from 'termcast/src/theme'
|
|
8
|
+
import { WithLeftBorder } from './with-left-border'
|
|
9
|
+
import { useFormNavigation } from './use-form-navigation'
|
|
10
|
+
|
|
11
|
+
export interface PasswordFieldProps extends FormItemProps<string> {
|
|
12
|
+
placeholder?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type PasswordFieldRef = FormItemRef
|
|
16
|
+
|
|
17
|
+
export const PasswordField = (props: PasswordFieldProps): any => {
|
|
18
|
+
const { control } = useFormContext()
|
|
19
|
+
const { focusedField, setFocusedField } = useFocusContext()
|
|
20
|
+
const isFocused = focusedField === props.id
|
|
21
|
+
|
|
22
|
+
// Use form navigation hook
|
|
23
|
+
useFormNavigation(props.id)
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Controller
|
|
27
|
+
name={props.id}
|
|
28
|
+
control={control}
|
|
29
|
+
defaultValue={props.defaultValue || props.value || ''}
|
|
30
|
+
render={({ field, fieldState, formState }) => {
|
|
31
|
+
// Always show masked value when not focused
|
|
32
|
+
const displayValue = isFocused
|
|
33
|
+
? field.value
|
|
34
|
+
: '*'.repeat(field.value.length)
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<box flexDirection='column'>
|
|
38
|
+
<WithLeftBorder withDiamond isFocused={isFocused}>
|
|
39
|
+
<text
|
|
40
|
+
fg={Theme.text}
|
|
41
|
+
onMouseDown={() => {
|
|
42
|
+
setFocusedField(props.id)
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
{props.title}
|
|
46
|
+
</text>
|
|
47
|
+
</WithLeftBorder>
|
|
48
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
49
|
+
<input
|
|
50
|
+
value={displayValue}
|
|
51
|
+
onInput={(value: string) => {
|
|
52
|
+
// Ignore masked input (all asterisks) when not focused
|
|
53
|
+
if (
|
|
54
|
+
isFocused &&
|
|
55
|
+
!(/^\*+$/.test(value) && !field.value.startsWith('*'))
|
|
56
|
+
) {
|
|
57
|
+
field.onChange(value)
|
|
58
|
+
if (props.onChange) {
|
|
59
|
+
props.onChange(value)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}}
|
|
63
|
+
placeholder={props.placeholder}
|
|
64
|
+
focused={isFocused}
|
|
65
|
+
onMouseDown={() => {
|
|
66
|
+
setFocusedField(props.id)
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</WithLeftBorder>
|
|
70
|
+
{(fieldState.error || props.error) && (
|
|
71
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
72
|
+
<text fg={Theme.error}>
|
|
73
|
+
{fieldState.error?.message || props.error}
|
|
74
|
+
</text>
|
|
75
|
+
</WithLeftBorder>
|
|
76
|
+
)}
|
|
77
|
+
{props.info && (
|
|
78
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
79
|
+
<text fg={Theme.textMuted}>{props.info}</text>
|
|
80
|
+
</WithLeftBorder>
|
|
81
|
+
)}
|
|
82
|
+
</box>
|
|
83
|
+
) as React.ReactElement
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Theme } from 'termcast/src/theme'
|
|
3
|
+
import { WithLeftBorder } from './with-left-border'
|
|
4
|
+
|
|
5
|
+
export const Separator = (): any => {
|
|
6
|
+
return null
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<WithLeftBorder withDiamond isFocused={false}>
|
|
10
|
+
<text fg={Theme.border}>{''.repeat(40)}</text>
|
|
11
|
+
</WithLeftBorder>
|
|
12
|
+
|
|
|
13
|
+
</>
|
|
14
|
+
)
|
|
15
|
+
}
|