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,512 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useState,
|
|
3
|
+
createContext,
|
|
4
|
+
useContext,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useEffect,
|
|
9
|
+
Children,
|
|
10
|
+
} from 'react'
|
|
11
|
+
import { TextAttributes } from '@opentui/core'
|
|
12
|
+
import { useKeyboard } from '@opentui/react'
|
|
13
|
+
import {
|
|
14
|
+
useFormContext,
|
|
15
|
+
Controller,
|
|
16
|
+
ControllerRenderProps,
|
|
17
|
+
ControllerFieldState,
|
|
18
|
+
} from 'react-hook-form'
|
|
19
|
+
import { useFocusContext } from './index'
|
|
20
|
+
import { FormItemProps, FormItemRef } from './types'
|
|
21
|
+
import { logger } from 'termcast/src/logger'
|
|
22
|
+
import { Theme } from 'termcast/src/theme'
|
|
23
|
+
import {
|
|
24
|
+
createDescendants,
|
|
25
|
+
DescendantContextType,
|
|
26
|
+
} from 'termcast/src/descendants'
|
|
27
|
+
import { WithLeftBorder } from './with-left-border'
|
|
28
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
29
|
+
|
|
30
|
+
export interface DropdownProps extends FormItemProps<string | string[]> {
|
|
31
|
+
placeholder?: string
|
|
32
|
+
children?: React.ReactNode
|
|
33
|
+
hasMultipleSelection?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DropdownItemProps {
|
|
37
|
+
value: string
|
|
38
|
+
title: string
|
|
39
|
+
icon?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface DropdownSectionProps {
|
|
43
|
+
title?: string
|
|
44
|
+
children?: React.ReactNode
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type DropdownRef = FormItemRef
|
|
48
|
+
|
|
49
|
+
type DropdownFieldType = ControllerRenderProps<
|
|
50
|
+
{ __dropdown: string | string[] },
|
|
51
|
+
'__dropdown'
|
|
52
|
+
>
|
|
53
|
+
|
|
54
|
+
interface DropdownType {
|
|
55
|
+
(props: DropdownProps): any
|
|
56
|
+
Item: (props: DropdownItemProps) => any
|
|
57
|
+
Section: (props: DropdownSectionProps) => any
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Create descendants for form dropdown items - minimal fields
|
|
61
|
+
interface FormDropdownItemDescendant {
|
|
62
|
+
value: string
|
|
63
|
+
title: string
|
|
64
|
+
icon?: string
|
|
65
|
+
section?: string // Track which section this item belongs to
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const {
|
|
69
|
+
DescendantsProvider: FormDropdownDescendantsProvider,
|
|
70
|
+
useDescendants: useFormDropdownDescendants,
|
|
71
|
+
useDescendant: useFormDropdownDescendant,
|
|
72
|
+
} = createDescendants<FormDropdownItemDescendant>()
|
|
73
|
+
|
|
74
|
+
// Context for dropdown state
|
|
75
|
+
interface FormDropdownContextValue {
|
|
76
|
+
focusedIndex: number
|
|
77
|
+
offset: number
|
|
78
|
+
itemsPerPage: number
|
|
79
|
+
isFocused: boolean
|
|
80
|
+
handleSelect: (descendantId: string) => void
|
|
81
|
+
field: DropdownFieldType
|
|
82
|
+
props: DropdownProps
|
|
83
|
+
descendantsContext: DescendantContextType<FormDropdownItemDescendant>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Separate context for section information
|
|
87
|
+
interface SectionContextValue {
|
|
88
|
+
currentSection?: string
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const SectionContext = createContext<SectionContextValue>({
|
|
92
|
+
currentSection: undefined,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const itemsPerPage = 4
|
|
96
|
+
const FormDropdownContext = createContext<FormDropdownContextValue>({
|
|
97
|
+
focusedIndex: 0,
|
|
98
|
+
offset: 0,
|
|
99
|
+
itemsPerPage,
|
|
100
|
+
isFocused: false,
|
|
101
|
+
handleSelect: () => {},
|
|
102
|
+
descendantsContext: {} as any,
|
|
103
|
+
field: {} as DropdownFieldType,
|
|
104
|
+
props: {} as DropdownProps,
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const DropdownItem = (props: DropdownItemProps) => {
|
|
108
|
+
const context = useContext(FormDropdownContext)
|
|
109
|
+
const sectionContext = useContext(SectionContext)
|
|
110
|
+
|
|
111
|
+
// Register as descendant
|
|
112
|
+
const descendant = useFormDropdownDescendant({
|
|
113
|
+
value: props.value,
|
|
114
|
+
title: props.title,
|
|
115
|
+
icon: props.icon,
|
|
116
|
+
section: sectionContext.currentSection,
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
// Hide items that are outside the visible range
|
|
120
|
+
if (
|
|
121
|
+
descendant.index < context.offset ||
|
|
122
|
+
descendant.index >= context.offset + context.itemsPerPage
|
|
123
|
+
) {
|
|
124
|
+
return null
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const isFocused = descendant.index === context.focusedIndex
|
|
128
|
+
|
|
129
|
+
// Check if this item is selected based on field value
|
|
130
|
+
const isSelected = (() => {
|
|
131
|
+
if (!context.field.value) return false
|
|
132
|
+
|
|
133
|
+
if (
|
|
134
|
+
context.props.hasMultipleSelection &&
|
|
135
|
+
Array.isArray(context.field.value)
|
|
136
|
+
) {
|
|
137
|
+
return context.field.value.includes(props.value)
|
|
138
|
+
} else if (
|
|
139
|
+
!context.props.hasMultipleSelection &&
|
|
140
|
+
typeof context.field.value === 'string'
|
|
141
|
+
) {
|
|
142
|
+
return context.field.value === props.value
|
|
143
|
+
}
|
|
144
|
+
return false
|
|
145
|
+
})()
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<WithLeftBorder
|
|
149
|
+
key={props.value}
|
|
150
|
+
isFocused={context.isFocused}
|
|
151
|
+
paddingLeft={0}
|
|
152
|
+
paddingBottom={0}
|
|
153
|
+
>
|
|
154
|
+
<text
|
|
155
|
+
fg={
|
|
156
|
+
context.isFocused && isFocused
|
|
157
|
+
? Theme.accent
|
|
158
|
+
: context.isFocused
|
|
159
|
+
? Theme.text
|
|
160
|
+
: Theme.textMuted
|
|
161
|
+
}
|
|
162
|
+
onMouseDown={() => {
|
|
163
|
+
context.handleSelect(descendant.descendantId)
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
{context.isFocused && isFocused ? '› ' : ' '}
|
|
167
|
+
{isSelected ? '●' : '○'} {props.title}
|
|
168
|
+
</text>
|
|
169
|
+
</WithLeftBorder>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const DropdownSection = (props: DropdownSectionProps) => {
|
|
174
|
+
const parentContext = useContext(FormDropdownContext)
|
|
175
|
+
const [isVisible, setIsVisible] = useState(false)
|
|
176
|
+
|
|
177
|
+
// Update visibility when offset changes
|
|
178
|
+
useLayoutEffect(() => {
|
|
179
|
+
if (!props.title) {
|
|
180
|
+
setIsVisible(true)
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const items = Object.values(parentContext.descendantsContext.map.current)
|
|
185
|
+
logger.log('DropdownSection: items', items)
|
|
186
|
+
const hasVisibleItems = items.some((item) => {
|
|
187
|
+
return (
|
|
188
|
+
item.props?.section === props.title &&
|
|
189
|
+
item.index >= parentContext.offset &&
|
|
190
|
+
item.index < parentContext.offset + parentContext.itemsPerPage
|
|
191
|
+
)
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
setIsVisible(hasVisibleItems)
|
|
195
|
+
}, [parentContext.offset, props.title, parentContext.itemsPerPage])
|
|
196
|
+
|
|
197
|
+
// Create section context value
|
|
198
|
+
const sectionContextValue = useMemo(
|
|
199
|
+
() => ({
|
|
200
|
+
currentSection: props.title,
|
|
201
|
+
}),
|
|
202
|
+
[props.title],
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<SectionContext.Provider value={sectionContextValue}>
|
|
207
|
+
<box flexDirection='column'>
|
|
208
|
+
{props.title && isVisible && (
|
|
209
|
+
<WithLeftBorder
|
|
210
|
+
paddingTop={0}
|
|
211
|
+
paddingBottom={0}
|
|
212
|
+
isFocused={parentContext.isFocused}
|
|
213
|
+
>
|
|
214
|
+
<text fg={Theme.textMuted}>{props.title}</text>
|
|
215
|
+
</WithLeftBorder>
|
|
216
|
+
)}
|
|
217
|
+
{props.children}
|
|
218
|
+
</box>
|
|
219
|
+
</SectionContext.Provider>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Separate component for the dropdown content
|
|
224
|
+
interface DropdownContentProps extends DropdownProps {
|
|
225
|
+
field: DropdownFieldType
|
|
226
|
+
fieldState: ControllerFieldState
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const DropdownContent = ({
|
|
230
|
+
field,
|
|
231
|
+
fieldState,
|
|
232
|
+
...props
|
|
233
|
+
}: DropdownContentProps) => {
|
|
234
|
+
const descendantsContext = useFormDropdownDescendants()
|
|
235
|
+
const isInFocus = useIsInFocus()
|
|
236
|
+
const { getValues } = useFormContext()
|
|
237
|
+
const { focusedField, setFocusedField } = useFocusContext()
|
|
238
|
+
const isFocused = focusedField === props.id
|
|
239
|
+
const [focusedIndex, setFocusedIndex] = useState(0)
|
|
240
|
+
const [offset, setOffset] = useState(0)
|
|
241
|
+
|
|
242
|
+
const [selectedTitles, setSelectedTitles] = useState<string[]>([])
|
|
243
|
+
const [itemsCount, setItemsCount] = useState(0)
|
|
244
|
+
|
|
245
|
+
const handleNavigateUp = () => {
|
|
246
|
+
// Find previous field and focus it
|
|
247
|
+
const fieldNames = Object.keys(getValues())
|
|
248
|
+
const currentIndex = fieldNames.indexOf(props.id)
|
|
249
|
+
if (currentIndex > 0) {
|
|
250
|
+
setFocusedField(fieldNames[currentIndex - 1])
|
|
251
|
+
} else {
|
|
252
|
+
setFocusedField(fieldNames[fieldNames.length - 1])
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const handleNavigateDown = () => {
|
|
257
|
+
// Find next field and focus it
|
|
258
|
+
const fieldNames = Object.keys(getValues())
|
|
259
|
+
const currentIndex = fieldNames.indexOf(props.id)
|
|
260
|
+
if (currentIndex < fieldNames.length - 1) {
|
|
261
|
+
setFocusedField(fieldNames[currentIndex + 1])
|
|
262
|
+
} else {
|
|
263
|
+
setFocusedField(fieldNames[0])
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Helper to get value for a descendantId
|
|
268
|
+
const getValueForDescendantId = (
|
|
269
|
+
descendantId: string,
|
|
270
|
+
): string | undefined => {
|
|
271
|
+
const item = descendantsContext.map.current[descendantId]
|
|
272
|
+
return item?.props?.value
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const handleSelect = (descendantId: string) => {
|
|
276
|
+
const value = getValueForDescendantId(descendantId)
|
|
277
|
+
if (!value) return
|
|
278
|
+
|
|
279
|
+
const item = descendantsContext.map.current[descendantId]
|
|
280
|
+
const title = item?.props?.title || value
|
|
281
|
+
|
|
282
|
+
if (props.hasMultipleSelection) {
|
|
283
|
+
const currentValues = Array.isArray(field.value) ? [...field.value] : []
|
|
284
|
+
const index = currentValues.indexOf(value)
|
|
285
|
+
|
|
286
|
+
if (index >= 0) {
|
|
287
|
+
currentValues.splice(index, 1)
|
|
288
|
+
// Remove from selected titles
|
|
289
|
+
setSelectedTitles((prev) => prev.filter((t) => t !== title))
|
|
290
|
+
} else {
|
|
291
|
+
currentValues.push(value)
|
|
292
|
+
// Add to selected titles
|
|
293
|
+
setSelectedTitles((prev) => [...prev, title])
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
field.onChange(currentValues)
|
|
297
|
+
if (props.onChange) {
|
|
298
|
+
props.onChange(currentValues)
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
field.onChange(value)
|
|
302
|
+
setSelectedTitles([title])
|
|
303
|
+
if (props.onChange) {
|
|
304
|
+
props.onChange(value)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Handle keyboard navigation when focused
|
|
310
|
+
useKeyboard((evt) => {
|
|
311
|
+
if (!isFocused || !isInFocus) return
|
|
312
|
+
|
|
313
|
+
const items = Object.values(descendantsContext.map.current).filter(
|
|
314
|
+
(item) => item.index !== -1,
|
|
315
|
+
)
|
|
316
|
+
const itemCount = items.length
|
|
317
|
+
|
|
318
|
+
if (itemCount > 0) {
|
|
319
|
+
if (evt.name === 'down') {
|
|
320
|
+
setFocusedIndex((prev) => {
|
|
321
|
+
const nextIndex = (prev + 1) % itemCount
|
|
322
|
+
|
|
323
|
+
// Update offset only when the focused item is at the last position and there are more items
|
|
324
|
+
const visibleEnd = offset + itemsPerPage - 1
|
|
325
|
+
if (
|
|
326
|
+
prev === visibleEnd &&
|
|
327
|
+
nextIndex < itemCount &&
|
|
328
|
+
nextIndex > prev
|
|
329
|
+
) {
|
|
330
|
+
// Scroll down by one when at the last visible item
|
|
331
|
+
setOffset(offset + 1)
|
|
332
|
+
} else if (nextIndex < prev) {
|
|
333
|
+
// Wrapped to beginning
|
|
334
|
+
setOffset(0)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return nextIndex
|
|
338
|
+
})
|
|
339
|
+
} else if (evt.name === 'up') {
|
|
340
|
+
setFocusedIndex((prev) => {
|
|
341
|
+
const nextIndex = (prev - 1 + itemCount) % itemCount
|
|
342
|
+
|
|
343
|
+
// Update offset if we're going above the visible range
|
|
344
|
+
if (nextIndex < offset) {
|
|
345
|
+
setOffset(Math.max(0, nextIndex))
|
|
346
|
+
} else if (nextIndex >= offset + itemsPerPage) {
|
|
347
|
+
// Wrapped to end
|
|
348
|
+
setOffset(Math.max(0, itemCount - itemsPerPage))
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return nextIndex
|
|
352
|
+
})
|
|
353
|
+
} else if (evt.name === 'return' || evt.name === 'space') {
|
|
354
|
+
// Toggle selection of current focused item
|
|
355
|
+
const entries = Object.entries(descendantsContext.map.current)
|
|
356
|
+
const sortedEntries = entries
|
|
357
|
+
.filter(([_, item]) => item.index !== -1)
|
|
358
|
+
.sort((a, b) => a[1].index - b[1].index)
|
|
359
|
+
|
|
360
|
+
const focusedId = sortedEntries[focusedIndex]?.[0]
|
|
361
|
+
if (focusedId) {
|
|
362
|
+
handleSelect(focusedId)
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Handle tab navigation
|
|
368
|
+
if (evt.name === 'tab') {
|
|
369
|
+
if (evt.shift) {
|
|
370
|
+
handleNavigateUp()
|
|
371
|
+
} else {
|
|
372
|
+
handleNavigateDown()
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
// Update active item count when descendants change
|
|
378
|
+
useLayoutEffect(() => {
|
|
379
|
+
let itemCount = 0
|
|
380
|
+
const entries = Object.entries(descendantsContext.map.current)
|
|
381
|
+
|
|
382
|
+
entries.forEach(([id, item]) => {
|
|
383
|
+
if (item.index !== -1) {
|
|
384
|
+
itemCount++
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
|
|
388
|
+
setItemsCount(itemCount)
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
// Initialize selected titles from field value only once when descendants are loaded
|
|
392
|
+
useLayoutEffect(() => {
|
|
393
|
+
if (field.value && Object.keys(descendantsContext.map.current).length > 0) {
|
|
394
|
+
const titles: string[] = []
|
|
395
|
+
const entries = Object.entries(descendantsContext.map.current)
|
|
396
|
+
|
|
397
|
+
entries.forEach(([id, item]) => {
|
|
398
|
+
if (item.props) {
|
|
399
|
+
if (props.hasMultipleSelection && Array.isArray(field.value)) {
|
|
400
|
+
if (field.value.includes(item.props.value)) {
|
|
401
|
+
titles.push(item.props.title)
|
|
402
|
+
}
|
|
403
|
+
} else if (
|
|
404
|
+
!props.hasMultipleSelection &&
|
|
405
|
+
typeof field.value === 'string'
|
|
406
|
+
) {
|
|
407
|
+
if (item.props.value === field.value) {
|
|
408
|
+
titles.push(item.props.title)
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
setSelectedTitles(titles)
|
|
415
|
+
}
|
|
416
|
+
}, []) // Only run once on mount
|
|
417
|
+
|
|
418
|
+
// Create context value
|
|
419
|
+
const contextValue: FormDropdownContextValue = {
|
|
420
|
+
focusedIndex,
|
|
421
|
+
descendantsContext,
|
|
422
|
+
offset,
|
|
423
|
+
itemsPerPage,
|
|
424
|
+
isFocused,
|
|
425
|
+
handleSelect,
|
|
426
|
+
field,
|
|
427
|
+
props,
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return (
|
|
431
|
+
<FormDropdownDescendantsProvider value={descendantsContext}>
|
|
432
|
+
<FormDropdownContext.Provider value={contextValue}>
|
|
433
|
+
<box flexDirection='column'>
|
|
434
|
+
<WithLeftBorder withDiamond isFocused={isFocused}>
|
|
435
|
+
<text
|
|
436
|
+
fg={Theme.text}
|
|
437
|
+
onMouseDown={() => {
|
|
438
|
+
setFocusedField(props.id)
|
|
439
|
+
}}
|
|
440
|
+
>
|
|
441
|
+
{props.title}
|
|
442
|
+
</text>
|
|
443
|
+
</WithLeftBorder>
|
|
444
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
445
|
+
<text
|
|
446
|
+
fg={selectedTitles.length > 0 ? Theme.text : Theme.textMuted}
|
|
447
|
+
selectable={false}
|
|
448
|
+
onMouseDown={() => {
|
|
449
|
+
setFocusedField(props.id)
|
|
450
|
+
}}
|
|
451
|
+
>
|
|
452
|
+
{selectedTitles.length > 0
|
|
453
|
+
? selectedTitles.join(', ')
|
|
454
|
+
: props.placeholder || 'Select...'}
|
|
455
|
+
</text>
|
|
456
|
+
</WithLeftBorder>
|
|
457
|
+
{props.children}
|
|
458
|
+
{itemsCount > itemsPerPage && (
|
|
459
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
460
|
+
<text fg={Theme.textMuted}>↑↓ to see more options</text>
|
|
461
|
+
</WithLeftBorder>
|
|
462
|
+
)}
|
|
463
|
+
{(fieldState.error || props.error) && (
|
|
464
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
465
|
+
<text fg={Theme.error}>
|
|
466
|
+
{fieldState.error?.message || props.error}
|
|
467
|
+
</text>
|
|
468
|
+
</WithLeftBorder>
|
|
469
|
+
)}
|
|
470
|
+
{props.info && (
|
|
471
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
472
|
+
<text fg={Theme.textMuted}>{props.info}</text>
|
|
473
|
+
</WithLeftBorder>
|
|
474
|
+
)}
|
|
475
|
+
</box>
|
|
476
|
+
</FormDropdownContext.Provider>
|
|
477
|
+
</FormDropdownDescendantsProvider>
|
|
478
|
+
)
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const DropdownComponent = (props: DropdownProps): any => {
|
|
482
|
+
const { control } = useFormContext()
|
|
483
|
+
const { focusedField } = useFocusContext()
|
|
484
|
+
const isFocused = focusedField === props.id
|
|
485
|
+
|
|
486
|
+
return (
|
|
487
|
+
<Controller
|
|
488
|
+
name={props.id}
|
|
489
|
+
control={control}
|
|
490
|
+
defaultValue={
|
|
491
|
+
props.defaultValue ||
|
|
492
|
+
props.value ||
|
|
493
|
+
(props.hasMultipleSelection ? [] : '')
|
|
494
|
+
}
|
|
495
|
+
render={({ field, fieldState }) => {
|
|
496
|
+
return (
|
|
497
|
+
<DropdownContent
|
|
498
|
+
field={field as any}
|
|
499
|
+
fieldState={fieldState}
|
|
500
|
+
{...props}
|
|
501
|
+
/>
|
|
502
|
+
) as React.ReactElement
|
|
503
|
+
}}
|
|
504
|
+
/>
|
|
505
|
+
)
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Create the properly typed Dropdown with sub-components
|
|
509
|
+
export const Dropdown = Object.assign(DropdownComponent, {
|
|
510
|
+
Item: DropdownItem,
|
|
511
|
+
Section: DropdownSection,
|
|
512
|
+
}) as DropdownType
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
import { Theme } from 'termcast/src/theme'
|
|
3
|
+
import { FileSystemItem, searchFiles, parsePath } from '../../utils/file-system'
|
|
4
|
+
import { useKeyboard } from '@opentui/react'
|
|
5
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
6
|
+
|
|
7
|
+
export interface FileAutocompleteProps {
|
|
8
|
+
value: string
|
|
9
|
+
onChange: (value: string) => void
|
|
10
|
+
onSelect: (path: string) => void
|
|
11
|
+
visible: boolean
|
|
12
|
+
onVisibilityChange: (visible: boolean) => void
|
|
13
|
+
inputRef: React.RefObject<any>
|
|
14
|
+
anchorRef: React.RefObject<any>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const FileAutocomplete = ({
|
|
18
|
+
value,
|
|
19
|
+
onChange,
|
|
20
|
+
onSelect,
|
|
21
|
+
visible,
|
|
22
|
+
onVisibilityChange,
|
|
23
|
+
inputRef,
|
|
24
|
+
anchorRef,
|
|
25
|
+
}: FileAutocompleteProps): any => {
|
|
26
|
+
const [selectedIndex, setSelectedIndex] = useState(0)
|
|
27
|
+
const [items, setItems] = useState<FileSystemItem[]>([])
|
|
28
|
+
const [loading, setLoading] = useState(false)
|
|
29
|
+
const isInFocus = useIsInFocus()
|
|
30
|
+
|
|
31
|
+
// Parse the input to get base path and prefix
|
|
32
|
+
const { basePath, prefix } = value
|
|
33
|
+
? parsePath(value)
|
|
34
|
+
: { basePath: '.', prefix: '' }
|
|
35
|
+
|
|
36
|
+
// Search for files when value changes or visibility changes
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!visible) return
|
|
39
|
+
|
|
40
|
+
const searchForFiles = async () => {
|
|
41
|
+
setLoading(true)
|
|
42
|
+
try {
|
|
43
|
+
const results = await searchFiles(basePath, prefix)
|
|
44
|
+
setItems(results)
|
|
45
|
+
setSelectedIndex(0)
|
|
46
|
+
} catch (error) {
|
|
47
|
+
setItems([])
|
|
48
|
+
} finally {
|
|
49
|
+
setLoading(false)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
searchForFiles()
|
|
54
|
+
}, [value, visible, basePath, prefix])
|
|
55
|
+
|
|
56
|
+
// Handle keyboard navigation
|
|
57
|
+
useKeyboard((evt) => {
|
|
58
|
+
if (!visible || !isInFocus) return
|
|
59
|
+
|
|
60
|
+
if (evt.name === 'up') {
|
|
61
|
+
setSelectedIndex((prev) => (prev > 0 ? prev - 1 : items.length - 1))
|
|
62
|
+
} else if (evt.name === 'down') {
|
|
63
|
+
setSelectedIndex((prev) => (prev < items.length - 1 ? prev + 1 : 0))
|
|
64
|
+
} else if (evt.name === 'escape') {
|
|
65
|
+
onVisibilityChange(false)
|
|
66
|
+
} else if (evt.name === 'return') {
|
|
67
|
+
if (items[selectedIndex]) {
|
|
68
|
+
const selectedItem = items[selectedIndex]
|
|
69
|
+
const newValue =
|
|
70
|
+
value.substring(0, value.lastIndexOf('/') + 1) + selectedItem.name
|
|
71
|
+
|
|
72
|
+
if (selectedItem.isDirectory) {
|
|
73
|
+
// Add trailing slash for directories
|
|
74
|
+
onChange(newValue + '/')
|
|
75
|
+
// Keep autocomplete open for directories
|
|
76
|
+
} else {
|
|
77
|
+
onSelect(newValue)
|
|
78
|
+
onVisibilityChange(false)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
if (!visible || items.length === 0) return null
|
|
85
|
+
|
|
86
|
+
// Calculate position based on anchor element
|
|
87
|
+
const anchorElement = anchorRef.current
|
|
88
|
+
if (!anchorElement) return null
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<box
|
|
92
|
+
position='absolute'
|
|
93
|
+
top={anchorElement.y + anchorElement.height}
|
|
94
|
+
left={anchorElement.x}
|
|
95
|
+
width={anchorElement.width}
|
|
96
|
+
zIndex={1000}
|
|
97
|
+
borderStyle='single'
|
|
98
|
+
borderColor={Theme.border}
|
|
99
|
+
backgroundColor={Theme.backgroundPanel}
|
|
100
|
+
maxHeight={10}
|
|
101
|
+
>
|
|
102
|
+
{loading ? (
|
|
103
|
+
<text fg={Theme.textMuted} padding={1}>
|
|
104
|
+
Loading...
|
|
105
|
+
</text>
|
|
106
|
+
) : (
|
|
107
|
+
<box flexDirection='column'>
|
|
108
|
+
{items.map((item, index) => (
|
|
109
|
+
<box
|
|
110
|
+
key={item.path}
|
|
111
|
+
paddingLeft={1}
|
|
112
|
+
paddingRight={1}
|
|
113
|
+
backgroundColor={
|
|
114
|
+
index === selectedIndex ? Theme.primary : undefined
|
|
115
|
+
}
|
|
116
|
+
onMouseDown={() => {
|
|
117
|
+
setSelectedIndex(index)
|
|
118
|
+
const newValue =
|
|
119
|
+
value.substring(0, value.lastIndexOf('/') + 1) + item.name
|
|
120
|
+
if (item.isDirectory) {
|
|
121
|
+
onChange(newValue + '/')
|
|
122
|
+
// Keep autocomplete open for directories
|
|
123
|
+
} else {
|
|
124
|
+
onSelect(newValue)
|
|
125
|
+
onVisibilityChange(false)
|
|
126
|
+
}
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<text
|
|
130
|
+
fg={index === selectedIndex ? Theme.background : Theme.text}
|
|
131
|
+
>
|
|
132
|
+
{item.isDirectory ? '📁 ' : '📄 '}
|
|
133
|
+
{item.name}
|
|
134
|
+
</text>
|
|
135
|
+
</box>
|
|
136
|
+
))}
|
|
137
|
+
</box>
|
|
138
|
+
)}
|
|
139
|
+
</box>
|
|
140
|
+
)
|
|
141
|
+
}
|