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,245 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useRef } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
ForwardRefExoticComponent,
|
|
4
|
+
FunctionComponent,
|
|
5
|
+
ReactNode,
|
|
6
|
+
RefAttributes,
|
|
7
|
+
} from 'react'
|
|
8
|
+
import { Image } from 'termcast/src/components/list'
|
|
9
|
+
import { Dropdown, DropdownProps, DropdownItemProps } from './dropdown'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Form value types that can be used in form items
|
|
13
|
+
*/
|
|
14
|
+
type FormValue = string | number | boolean | string[] | number[] | Date | null
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Event types for form item callbacks
|
|
18
|
+
*/
|
|
19
|
+
type FormEventType = 'focus' | 'blur'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Form event interface for onFocus and onBlur callbacks
|
|
23
|
+
*/
|
|
24
|
+
interface FormEvent<T extends FormValue> {
|
|
25
|
+
target: {
|
|
26
|
+
id: string
|
|
27
|
+
value?: T
|
|
28
|
+
}
|
|
29
|
+
type: FormEventType
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Base props for all form items
|
|
34
|
+
*/
|
|
35
|
+
interface FormItemProps<T extends FormValue> {
|
|
36
|
+
/**
|
|
37
|
+
* ID of the form item.
|
|
38
|
+
* Make sure to assign each form item a unique id.
|
|
39
|
+
*/
|
|
40
|
+
id: string
|
|
41
|
+
/**
|
|
42
|
+
* The title displayed on the left side of the item.
|
|
43
|
+
*/
|
|
44
|
+
title?: string
|
|
45
|
+
/**
|
|
46
|
+
* An optional info message to describe the form item. It appears on the right side of the item with an info icon. When the icon is hovered, the info message is shown.
|
|
47
|
+
*/
|
|
48
|
+
info?: string
|
|
49
|
+
/**
|
|
50
|
+
* An optional error message to show the form item validation issues.
|
|
51
|
+
* If the `error` is present, the Form Item will be highlighted with red border and will show an error message on the right.
|
|
52
|
+
*/
|
|
53
|
+
error?: string
|
|
54
|
+
/**
|
|
55
|
+
* Indicates whether the value of the item should be persisted after submitting, and restored next time the form is rendered.
|
|
56
|
+
*/
|
|
57
|
+
storeValue?: boolean
|
|
58
|
+
/**
|
|
59
|
+
* The value of the item. If `undefined`, the item is uncontrolled.
|
|
60
|
+
*/
|
|
61
|
+
value?: T
|
|
62
|
+
/**
|
|
63
|
+
* The initial value of the item. Used for uncontrolled items. Overwrites the value restored from `storeValue`.
|
|
64
|
+
*/
|
|
65
|
+
defaultValue?: T
|
|
66
|
+
/**
|
|
67
|
+
* The callback that is triggered when the value of the item changes.
|
|
68
|
+
*/
|
|
69
|
+
onChange?: (value: T) => void
|
|
70
|
+
/**
|
|
71
|
+
* The callback that is triggered when the item is focused.
|
|
72
|
+
*/
|
|
73
|
+
onFocus?: (event: FormEvent<T>) => void
|
|
74
|
+
/**
|
|
75
|
+
* The callback that is triggered when the item loses focus.
|
|
76
|
+
*/
|
|
77
|
+
onBlur?: (event: FormEvent<T>) => void
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Ref methods available on form items
|
|
82
|
+
*/
|
|
83
|
+
interface FormItemRef {
|
|
84
|
+
/**
|
|
85
|
+
* Focuses the item.
|
|
86
|
+
*/
|
|
87
|
+
focus: () => void
|
|
88
|
+
/**
|
|
89
|
+
* Resets value of the item
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* If `defaultValue` is defined, calling the `.reset()` function will set `value` to the `defaultValue`.
|
|
93
|
+
*/
|
|
94
|
+
reset: () => void
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Props for Form.TagPicker component
|
|
99
|
+
*/
|
|
100
|
+
export interface TagPickerProps extends FormItemProps<string[]> {
|
|
101
|
+
/**
|
|
102
|
+
* The list of tags.
|
|
103
|
+
*/
|
|
104
|
+
children?: ReactNode
|
|
105
|
+
/**
|
|
106
|
+
* Placeholder text shown in the token field.
|
|
107
|
+
*/
|
|
108
|
+
placeholder?: string
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Props for Form.TagPicker.Item component
|
|
113
|
+
*/
|
|
114
|
+
export interface TagPickerItemProps {
|
|
115
|
+
/**
|
|
116
|
+
* Value of the tag.
|
|
117
|
+
* Make sure to assign unique value for each item.
|
|
118
|
+
*/
|
|
119
|
+
value: string
|
|
120
|
+
/**
|
|
121
|
+
* The display title of the tag.
|
|
122
|
+
*/
|
|
123
|
+
title?: string
|
|
124
|
+
/**
|
|
125
|
+
* An icon to show in the tag.
|
|
126
|
+
*/
|
|
127
|
+
icon?: Image.ImageLike
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Ref type for Form.TagPicker
|
|
132
|
+
*/
|
|
133
|
+
export type TagPickerRef = FormItemRef
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Members of the TagPicker component
|
|
137
|
+
*/
|
|
138
|
+
interface TagPickerMembers {
|
|
139
|
+
/**
|
|
140
|
+
* A tag picker item in a {@link Form.TagPicker}.
|
|
141
|
+
*/
|
|
142
|
+
Item: (props: TagPickerItemProps) => any
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Type definition for Form.TagPicker component
|
|
147
|
+
*/
|
|
148
|
+
export type TagPickerType = ForwardRefExoticComponent<
|
|
149
|
+
TagPickerProps & RefAttributes<TagPickerRef>
|
|
150
|
+
> &
|
|
151
|
+
TagPickerMembers
|
|
152
|
+
|
|
153
|
+
// Implementation
|
|
154
|
+
|
|
155
|
+
const TagPickerItem: FunctionComponent<TagPickerItemProps> = (props): any => {
|
|
156
|
+
// Convert TagPickerItem props to DropdownItem props
|
|
157
|
+
return (
|
|
158
|
+
<Dropdown.Item
|
|
159
|
+
value={props.value}
|
|
160
|
+
title={props.title || props.value}
|
|
161
|
+
icon={props.icon as string | undefined}
|
|
162
|
+
/>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const TagPickerComponent = forwardRef<TagPickerRef, TagPickerProps>(
|
|
167
|
+
(props, ref) => {
|
|
168
|
+
const dropdownRef = useRef<any>(null)
|
|
169
|
+
|
|
170
|
+
useImperativeHandle(ref, () => ({
|
|
171
|
+
focus: () => dropdownRef.current?.focus(),
|
|
172
|
+
reset: () => dropdownRef.current?.reset(),
|
|
173
|
+
}))
|
|
174
|
+
|
|
175
|
+
// TagPicker will use hasMultipleSelection by default
|
|
176
|
+
const dropdownValue = props.value || props.defaultValue || []
|
|
177
|
+
|
|
178
|
+
const handleDropdownChange = (value: string | string[]) => {
|
|
179
|
+
// TagPicker always expects array values
|
|
180
|
+
if (Array.isArray(value)) {
|
|
181
|
+
props.onChange?.(value)
|
|
182
|
+
} else {
|
|
183
|
+
props.onChange?.([value])
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Convert FormEvent callbacks between string[] and string | string[]
|
|
188
|
+
const handleFocus = props.onFocus
|
|
189
|
+
? (event: FormEvent<string | string[]>) => {
|
|
190
|
+
props.onFocus!({
|
|
191
|
+
target: {
|
|
192
|
+
id: event.target.id,
|
|
193
|
+
value: Array.isArray(event.target.value)
|
|
194
|
+
? event.target.value
|
|
195
|
+
: event.target.value
|
|
196
|
+
? [event.target.value]
|
|
197
|
+
: [],
|
|
198
|
+
},
|
|
199
|
+
type: event.type,
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
: undefined
|
|
203
|
+
|
|
204
|
+
const handleBlur = props.onBlur
|
|
205
|
+
? (event: FormEvent<string | string[]>) => {
|
|
206
|
+
props.onBlur!({
|
|
207
|
+
target: {
|
|
208
|
+
id: event.target.id,
|
|
209
|
+
value: Array.isArray(event.target.value)
|
|
210
|
+
? event.target.value
|
|
211
|
+
: event.target.value
|
|
212
|
+
? [event.target.value]
|
|
213
|
+
: [],
|
|
214
|
+
},
|
|
215
|
+
type: event.type,
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
: undefined
|
|
219
|
+
|
|
220
|
+
// Create dropdown props
|
|
221
|
+
const dropdownProps: DropdownProps = {
|
|
222
|
+
id: props.id,
|
|
223
|
+
title: props.title,
|
|
224
|
+
info: props.info,
|
|
225
|
+
error: props.error,
|
|
226
|
+
storeValue: props.storeValue,
|
|
227
|
+
value: dropdownValue,
|
|
228
|
+
defaultValue: dropdownValue,
|
|
229
|
+
onChange: handleDropdownChange,
|
|
230
|
+
onFocus: handleFocus,
|
|
231
|
+
onBlur: handleBlur,
|
|
232
|
+
placeholder: props.placeholder,
|
|
233
|
+
children: props.children,
|
|
234
|
+
hasMultipleSelection: true, // TagPicker always uses multiple selection
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return <Dropdown {...dropdownProps} />
|
|
238
|
+
},
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
TagPickerComponent.displayName = 'TagPicker'
|
|
242
|
+
|
|
243
|
+
export const TagPicker = Object.assign(TagPickerComponent, {
|
|
244
|
+
Item: TagPickerItem,
|
|
245
|
+
}) as TagPickerType
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React 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 TextAreaProps extends FormItemProps<string> {
|
|
12
|
+
placeholder?: string
|
|
13
|
+
enableMarkdown?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type TextAreaRef = FormItemRef
|
|
17
|
+
|
|
18
|
+
export const TextArea = (props: TextAreaProps): any => {
|
|
19
|
+
const { control } = useFormContext()
|
|
20
|
+
const { focusedField, setFocusedField } = useFocusContext()
|
|
21
|
+
const isFocused = focusedField === props.id
|
|
22
|
+
|
|
23
|
+
// TODO in textarea arrows should probably go to lines instead of other forms
|
|
24
|
+
useFormNavigation(props.id)
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Controller
|
|
28
|
+
name={props.id}
|
|
29
|
+
control={control}
|
|
30
|
+
defaultValue={props.defaultValue || props.value || ''}
|
|
31
|
+
render={({ field, fieldState, formState }) => {
|
|
32
|
+
return (
|
|
33
|
+
<box flexDirection='column'>
|
|
34
|
+
<WithLeftBorder withDiamond isFocused={isFocused}>
|
|
35
|
+
<text
|
|
36
|
+
fg={Theme.text}
|
|
37
|
+
onMouseDown={() => {
|
|
38
|
+
setFocusedField(props.id)
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{props.title}
|
|
42
|
+
</text>
|
|
43
|
+
</WithLeftBorder>
|
|
44
|
+
|
|
45
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
46
|
+
<box flexGrow={1}>
|
|
47
|
+
<input
|
|
48
|
+
value={field.value}
|
|
49
|
+
onInput={(value: string) => {
|
|
50
|
+
field.onChange(value)
|
|
51
|
+
if (props.onChange) {
|
|
52
|
+
props.onChange(value)
|
|
53
|
+
}
|
|
54
|
+
}}
|
|
55
|
+
minHeight={4}
|
|
56
|
+
placeholder={props.placeholder}
|
|
57
|
+
focused={isFocused}
|
|
58
|
+
onMouseDown={() => {
|
|
59
|
+
setFocusedField(props.id)
|
|
60
|
+
}}
|
|
61
|
+
/>
|
|
62
|
+
</box>
|
|
63
|
+
</WithLeftBorder>
|
|
64
|
+
|
|
65
|
+
{(fieldState.error || props.error) && (
|
|
66
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
67
|
+
<text fg={Theme.error}>
|
|
68
|
+
{fieldState.error?.message || props.error}
|
|
69
|
+
</text>
|
|
70
|
+
</WithLeftBorder>
|
|
71
|
+
)}
|
|
72
|
+
{props.info && (
|
|
73
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
74
|
+
<text fg={Theme.textMuted}>{props.info}</text>
|
|
75
|
+
</WithLeftBorder>
|
|
76
|
+
)}
|
|
77
|
+
</box>
|
|
78
|
+
) as React.ReactElement
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React 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 TextFieldProps extends FormItemProps<string> {
|
|
12
|
+
placeholder?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type TextFieldRef = FormItemRef
|
|
16
|
+
|
|
17
|
+
export const TextField = (props: TextFieldProps): any => {
|
|
18
|
+
const {
|
|
19
|
+
control,
|
|
20
|
+
formState: { errors },
|
|
21
|
+
} = useFormContext()
|
|
22
|
+
const { focusedField, setFocusedField } = useFocusContext()
|
|
23
|
+
const isFocused = focusedField === props.id
|
|
24
|
+
|
|
25
|
+
// Use form navigation hook
|
|
26
|
+
useFormNavigation(props.id)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Controller
|
|
30
|
+
name={props.id}
|
|
31
|
+
control={control}
|
|
32
|
+
defaultValue={props.defaultValue || props.value || ''}
|
|
33
|
+
rules={{
|
|
34
|
+
required: props.error ? props.error : false,
|
|
35
|
+
}}
|
|
36
|
+
render={({ field, fieldState, formState }) => {
|
|
37
|
+
return (
|
|
38
|
+
<box flexDirection='column'>
|
|
39
|
+
<WithLeftBorder withDiamond isFocused={isFocused}>
|
|
40
|
+
<text
|
|
41
|
+
fg={Theme.text}
|
|
42
|
+
onMouseDown={() => {
|
|
43
|
+
setFocusedField(props.id)
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{props.title}
|
|
47
|
+
</text>
|
|
48
|
+
</WithLeftBorder>
|
|
49
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
50
|
+
<input
|
|
51
|
+
value={field.value}
|
|
52
|
+
onInput={(value: string) => {
|
|
53
|
+
field.onChange(value)
|
|
54
|
+
if (props.onChange) {
|
|
55
|
+
props.onChange(value)
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
58
|
+
placeholder={props.placeholder}
|
|
59
|
+
focused={isFocused}
|
|
60
|
+
onMouseDown={() => {
|
|
61
|
+
setFocusedField(props.id)
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
</WithLeftBorder>
|
|
65
|
+
{(fieldState.error || props.error) && (
|
|
66
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
67
|
+
<text fg={Theme.error}>
|
|
68
|
+
{fieldState.error?.message || props.error}
|
|
69
|
+
</text>
|
|
70
|
+
</WithLeftBorder>
|
|
71
|
+
)}
|
|
72
|
+
{props.info && (
|
|
73
|
+
<WithLeftBorder isFocused={isFocused}>
|
|
74
|
+
<text fg={Theme.textMuted}>{props.info}</text>
|
|
75
|
+
</WithLeftBorder>
|
|
76
|
+
)}
|
|
77
|
+
</box>
|
|
78
|
+
) as React.ReactElement
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface FormValue {
|
|
2
|
+
[key: string]: any
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface FormValues {
|
|
6
|
+
[key: string]: FormValue
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface FormProps {
|
|
10
|
+
actions?: React.ReactNode
|
|
11
|
+
children?: React.ReactNode
|
|
12
|
+
navigationTitle?: string
|
|
13
|
+
isLoading?: boolean
|
|
14
|
+
enableDrafts?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface FormItemProps<T> {
|
|
18
|
+
id: string
|
|
19
|
+
title?: string
|
|
20
|
+
info?: string
|
|
21
|
+
error?: string
|
|
22
|
+
storeValue?: boolean
|
|
23
|
+
autoFocus?: boolean
|
|
24
|
+
value?: T
|
|
25
|
+
defaultValue?: T
|
|
26
|
+
onChange?: (value: T) => void
|
|
27
|
+
onFocus?: (event: FormEvent<T>) => void
|
|
28
|
+
onBlur?: (event: FormEvent<T>) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FormEvent<T> {
|
|
32
|
+
target: {
|
|
33
|
+
id: string
|
|
34
|
+
value?: T
|
|
35
|
+
}
|
|
36
|
+
type: 'focus' | 'blur'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type FormEventType = 'focus' | 'blur'
|
|
40
|
+
|
|
41
|
+
export interface FormItemRef {
|
|
42
|
+
focus: () => void
|
|
43
|
+
reset: () => void
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type FormValue_2 = FormValue
|
|
47
|
+
export type FormValues_2 = FormValues
|
|
48
|
+
export type FormProps_2 = FormProps
|
|
49
|
+
export type FormItemProps_2<T> = FormItemProps<T>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useKeyboard } from '@opentui/react'
|
|
2
|
+
import { useFormContext } from 'react-hook-form'
|
|
3
|
+
import { useFocusContext } from './index'
|
|
4
|
+
import { useIsInFocus } from '../../internal/focus-context'
|
|
5
|
+
|
|
6
|
+
export function useFormNavigation(
|
|
7
|
+
id: string,
|
|
8
|
+
options?: {
|
|
9
|
+
handleArrows?: boolean
|
|
10
|
+
handleTabs?: boolean
|
|
11
|
+
},
|
|
12
|
+
) {
|
|
13
|
+
const { getValues } = useFormContext()
|
|
14
|
+
const { focusedField, setFocusedField } = useFocusContext()
|
|
15
|
+
const isInFocus = useIsInFocus()
|
|
16
|
+
const isFocused = focusedField === id
|
|
17
|
+
|
|
18
|
+
let { handleArrows = true, handleTabs = true } = options || {}
|
|
19
|
+
|
|
20
|
+
handleArrows = false
|
|
21
|
+
|
|
22
|
+
const navigateToPrevious = () => {
|
|
23
|
+
const fieldNames = Object.keys(getValues())
|
|
24
|
+
const currentIndex = fieldNames.indexOf(id)
|
|
25
|
+
if (currentIndex > 0) {
|
|
26
|
+
setFocusedField(fieldNames[currentIndex - 1])
|
|
27
|
+
} else {
|
|
28
|
+
setFocusedField(fieldNames[fieldNames.length - 1])
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const navigateToNext = () => {
|
|
33
|
+
const fieldNames = Object.keys(getValues())
|
|
34
|
+
const currentIndex = fieldNames.indexOf(id)
|
|
35
|
+
if (currentIndex < fieldNames.length - 1) {
|
|
36
|
+
setFocusedField(fieldNames[currentIndex + 1])
|
|
37
|
+
} else {
|
|
38
|
+
setFocusedField(fieldNames[0])
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
useKeyboard((evt) => {
|
|
43
|
+
// Only handle keyboard events when this field is focused and form is in focus
|
|
44
|
+
if (!isFocused || !isInFocus) return
|
|
45
|
+
|
|
46
|
+
if (handleTabs && evt.name === 'tab') {
|
|
47
|
+
if (evt.shift) {
|
|
48
|
+
navigateToPrevious()
|
|
49
|
+
} else {
|
|
50
|
+
navigateToNext()
|
|
51
|
+
}
|
|
52
|
+
} else if (handleArrows) {
|
|
53
|
+
if (evt.name === 'up') {
|
|
54
|
+
navigateToPrevious()
|
|
55
|
+
} else if (evt.name === 'down') {
|
|
56
|
+
navigateToNext()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
navigateToPrevious,
|
|
63
|
+
navigateToNext,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TextAttributes } from '@opentui/core'
|
|
3
|
+
import { Theme } from 'termcast/src/theme'
|
|
4
|
+
|
|
5
|
+
interface WithLeftBorderProps {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
withDiamond?: boolean
|
|
8
|
+
customCharacter?: { focused: string; unfocused: string }
|
|
9
|
+
isFocused: boolean
|
|
10
|
+
paddingBottom?: number
|
|
11
|
+
paddingLeft?: number
|
|
12
|
+
paddingTop?: number
|
|
13
|
+
key?: any
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const WithLeftBorder = ({
|
|
17
|
+
children,
|
|
18
|
+
withDiamond,
|
|
19
|
+
customCharacter,
|
|
20
|
+
isFocused,
|
|
21
|
+
paddingBottom = 1,
|
|
22
|
+
paddingLeft = 2,
|
|
23
|
+
paddingTop = 0,
|
|
24
|
+
}: WithLeftBorderProps): any => {
|
|
25
|
+
if (withDiamond || customCharacter) {
|
|
26
|
+
const chars = customCharacter || { focused: '◆', unfocused: '◇' }
|
|
27
|
+
return (
|
|
28
|
+
<box flexDirection='row'>
|
|
29
|
+
<text
|
|
30
|
+
key={String(isFocused)}
|
|
31
|
+
fg={isFocused ? Theme.accent : Theme.text}
|
|
32
|
+
>
|
|
33
|
+
{isFocused ? chars.focused : chars.unfocused}
|
|
34
|
+
</text>
|
|
35
|
+
<box flexGrow={1} paddingLeft={paddingLeft}>
|
|
36
|
+
{children}
|
|
37
|
+
</box>
|
|
38
|
+
</box>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
|
+
<box
|
|
43
|
+
paddingLeft={paddingLeft}
|
|
44
|
+
border={['left']}
|
|
45
|
+
borderColor={isFocused ? Theme.accent : undefined}
|
|
46
|
+
flexDirection='row'
|
|
47
|
+
>
|
|
48
|
+
<box paddingTop={paddingTop} paddingBottom={paddingBottom} flexGrow={1}>
|
|
49
|
+
{children}
|
|
50
|
+
</box>
|
|
51
|
+
</box>
|
|
52
|
+
)
|
|
53
|
+
}
|