termcast 1.3.9 → 1.3.16
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.js +1 -1
- package/dist/action-utils.js.map +1 -1
- package/dist/apis/ai.js +1 -1
- package/dist/apis/ai.js.map +1 -1
- package/dist/apis/clipboard.js +2 -2
- package/dist/apis/clipboard.js.map +1 -1
- package/dist/apis/hud.d.ts +2 -2
- package/dist/apis/hud.d.ts.map +1 -1
- package/dist/apis/hud.js +5 -5
- package/dist/apis/hud.js.map +1 -1
- package/dist/apis/oauth.d.ts +1 -1
- package/dist/apis/oauth.d.ts.map +1 -1
- package/dist/apis/oauth.js +8 -8
- package/dist/apis/oauth.js.map +1 -1
- package/dist/apis/preferences.js +4 -4
- package/dist/apis/preferences.js.map +1 -1
- package/dist/apis/toast.d.ts +1 -5
- package/dist/apis/toast.d.ts.map +1 -1
- package/dist/apis/toast.js +26 -20
- package/dist/apis/toast.js.map +1 -1
- package/dist/build.d.ts +2 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +9 -8
- package/dist/build.js.map +1 -1
- package/dist/cli.js +44 -2
- package/dist/cli.js.map +1 -1
- package/dist/colors.d.ts +8 -1
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +12 -0
- package/dist/colors.js.map +1 -1
- package/dist/compile.d.ts +30 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +156 -0
- package/dist/compile.js.map +1 -0
- package/dist/components/actions.d.ts +2 -1
- package/dist/components/actions.d.ts.map +1 -1
- package/dist/components/actions.js +11 -8
- package/dist/components/actions.js.map +1 -1
- package/dist/components/alert.js +4 -4
- package/dist/components/alert.js.map +1 -1
- package/dist/components/command-arguments.d.ts +9 -0
- package/dist/components/command-arguments.d.ts.map +1 -0
- package/dist/components/command-arguments.js +21 -0
- package/dist/components/command-arguments.js.map +1 -0
- package/dist/components/detail.d.ts +3 -3
- package/dist/components/detail.d.ts.map +1 -1
- package/dist/components/detail.js +20 -42
- package/dist/components/detail.js.map +1 -1
- package/dist/components/dropdown.d.ts +2 -1
- package/dist/components/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown.js +81 -25
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/extension-preferences.d.ts.map +1 -1
- package/dist/components/extension-preferences.js +23 -33
- package/dist/components/extension-preferences.js.map +1 -1
- package/dist/components/form/checkbox.d.ts.map +1 -1
- package/dist/components/form/checkbox.js +11 -4
- package/dist/components/form/checkbox.js.map +1 -1
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.js +18 -31
- package/dist/components/form/date-picker.js.map +1 -1
- package/dist/components/form/description.d.ts +2 -0
- package/dist/components/form/description.d.ts.map +1 -1
- package/dist/components/form/description.js +21 -3
- package/dist/components/form/description.js.map +1 -1
- package/dist/components/form/dropdown.d.ts.map +1 -1
- package/dist/components/form/dropdown.js +17 -32
- package/dist/components/form/dropdown.js.map +1 -1
- package/dist/components/form/file-autocomplete.d.ts +7 -4
- package/dist/components/form/file-autocomplete.d.ts.map +1 -1
- package/dist/components/form/file-autocomplete.js +56 -48
- package/dist/components/form/file-autocomplete.js.map +1 -1
- package/dist/components/form/file-picker.d.ts +5 -0
- package/dist/components/form/file-picker.d.ts.map +1 -1
- package/dist/components/form/file-picker.js +48 -51
- package/dist/components/form/file-picker.js.map +1 -1
- package/dist/components/form/form-end.js +1 -1
- package/dist/components/form/form-end.js.map +1 -1
- package/dist/components/form/form-ref.d.ts +43 -0
- package/dist/components/form/form-ref.d.ts.map +1 -0
- package/dist/components/form/form-ref.js +53 -0
- package/dist/components/form/form-ref.js.map +1 -0
- package/dist/components/form/index.d.ts +16 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/index.js +90 -27
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/form/password-field.d.ts.map +1 -1
- package/dist/components/form/password-field.js +33 -17
- package/dist/components/form/password-field.js.map +1 -1
- package/dist/components/form/separator.js +1 -1
- package/dist/components/form/separator.js.map +1 -1
- package/dist/components/form/tagpicker.d.ts +1 -1
- package/dist/components/form/tagpicker.d.ts.map +1 -1
- package/dist/components/form/text-area.d.ts.map +1 -1
- package/dist/components/form/text-area.js +33 -16
- package/dist/components/form/text-area.js.map +1 -1
- package/dist/components/form/text-field.d.ts.map +1 -1
- package/dist/components/form/text-field.js +38 -18
- package/dist/components/form/text-field.js.map +1 -1
- package/dist/components/form/use-form-navigation.d.ts +4 -0
- package/dist/components/form/use-form-navigation.d.ts.map +1 -1
- package/dist/components/form/use-form-navigation.js +35 -18
- package/dist/components/form/use-form-navigation.js.map +1 -1
- package/dist/components/form/with-left-border.d.ts.map +1 -1
- package/dist/components/form/with-left-border.js +3 -3
- package/dist/components/form/with-left-border.js.map +1 -1
- package/dist/components/icon.d.ts +3 -1
- package/dist/components/icon.d.ts.map +1 -1
- package/dist/components/icon.js +494 -469
- package/dist/components/icon.js.map +1 -1
- package/dist/components/image.js +1 -1
- package/dist/components/image.js.map +1 -1
- package/dist/components/list.d.ts +12 -8
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +172 -40
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-bar.js +2 -2
- package/dist/components/loading-bar.js.map +1 -1
- package/dist/components/menubar-extra.d.ts +1 -1
- package/dist/components/menubar-extra.d.ts.map +1 -1
- package/dist/components/menubar-extra.js +2 -2
- package/dist/components/menubar-extra.js.map +1 -1
- package/dist/descendants.d.ts.map +1 -1
- package/dist/descendants.js +8 -5
- package/dist/descendants.js.map +1 -1
- package/dist/e2e-node.d.ts +2 -0
- package/dist/e2e-node.d.ts.map +1 -1
- package/dist/e2e-node.js +14 -0
- package/dist/e2e-node.js.map +1 -1
- package/dist/examples/action-show-in-finder.js +3 -3
- package/dist/examples/action-show-in-finder.js.map +1 -1
- package/dist/examples/environment-test.js +4 -4
- package/dist/examples/environment-test.js.map +1 -1
- package/dist/examples/error-boundary.js +5 -5
- package/dist/examples/error-boundary.js.map +1 -1
- package/dist/examples/form-basic.d.ts.map +1 -1
- package/dist/examples/form-basic.js +6 -6
- package/dist/examples/form-basic.js.map +1 -1
- package/dist/examples/form-dropdown.js +3 -3
- package/dist/examples/form-dropdown.js.map +1 -1
- package/dist/examples/form-scroll.d.ts +2 -0
- package/dist/examples/form-scroll.d.ts.map +1 -0
- package/dist/examples/form-scroll.js +8 -0
- package/dist/examples/form-scroll.js.map +1 -0
- package/dist/examples/form-tagpicker.js +3 -3
- package/dist/examples/form-tagpicker.js.map +1 -1
- package/dist/examples/internal/descendants-filtering.js +10 -5
- package/dist/examples/internal/descendants-filtering.js.map +1 -1
- package/dist/examples/internal/descendants.js +13 -6
- package/dist/examples/internal/descendants.js.map +1 -1
- package/dist/examples/internal/rhf-custom-ref.d.ts +2 -0
- package/dist/examples/internal/rhf-custom-ref.d.ts.map +1 -0
- package/dist/examples/internal/rhf-custom-ref.js +67 -0
- package/dist/examples/internal/rhf-custom-ref.js.map +1 -0
- package/dist/examples/internal/scrollbox-demo.js +4 -8
- package/dist/examples/internal/scrollbox-demo.js.map +1 -1
- package/dist/examples/internal/scrollbox-with-descendants.d.ts +2 -0
- package/dist/examples/internal/scrollbox-with-descendants.d.ts.map +1 -0
- package/dist/examples/internal/scrollbox-with-descendants.js +63 -0
- package/dist/examples/internal/scrollbox-with-descendants.js.map +1 -0
- package/dist/examples/internal/simple-dialog.js +7 -7
- package/dist/examples/internal/simple-dialog.js.map +1 -1
- package/dist/examples/internal/simple-scrollbox.d.ts +2 -0
- package/dist/examples/internal/simple-scrollbox.d.ts.map +1 -0
- package/dist/examples/internal/simple-scrollbox.js +25 -0
- package/dist/examples/internal/simple-scrollbox.js.map +1 -0
- package/dist/examples/internal/text-stacking.js +4 -2
- package/dist/examples/internal/text-stacking.js.map +1 -1
- package/dist/examples/list-dropdown-default.js +3 -3
- package/dist/examples/list-dropdown-default.js.map +1 -1
- package/dist/examples/list-fetch-data.js +3 -3
- package/dist/examples/list-fetch-data.js.map +1 -1
- package/dist/examples/list-scrollbox.d.ts +2 -0
- package/dist/examples/list-scrollbox.d.ts.map +1 -0
- package/dist/examples/list-scrollbox.js +29 -0
- package/dist/examples/list-scrollbox.js.map +1 -0
- package/dist/examples/list-with-detail.js +2 -2
- package/dist/examples/list-with-detail.js.map +1 -1
- package/dist/examples/list-with-dropdown.js +2 -2
- package/dist/examples/list-with-dropdown.js.map +1 -1
- package/dist/examples/list-with-sections.js +6 -6
- package/dist/examples/list-with-sections.js.map +1 -1
- package/dist/examples/miscellaneous.js +14 -14
- package/dist/examples/miscellaneous.js.map +1 -1
- package/dist/examples/nested-navigation.js +9 -7
- package/dist/examples/nested-navigation.js.map +1 -1
- package/dist/examples/preferences-test.js +4 -4
- package/dist/examples/preferences-test.js.map +1 -1
- package/dist/examples/simple-dropdown.js +4 -4
- package/dist/examples/simple-dropdown.js.map +1 -1
- package/dist/examples/simple-file-picker.js +3 -3
- package/dist/examples/simple-file-picker.js.map +1 -1
- package/dist/examples/simple-grid.js +2 -2
- package/dist/examples/simple-grid.js.map +1 -1
- package/dist/examples/simple-hud.js +4 -4
- package/dist/examples/simple-hud.js.map +1 -1
- package/dist/examples/simple-list-search.js +21 -5
- package/dist/examples/simple-list-search.js.map +1 -1
- package/dist/examples/simple-list.js +4 -4
- package/dist/examples/simple-list.js.map +1 -1
- package/dist/examples/simple-navigation.js +9 -7
- package/dist/examples/simple-navigation.js.map +1 -1
- package/dist/examples/store.js +1 -1
- package/dist/examples/store.js.map +1 -1
- package/dist/examples/submodule-diff.d.ts +2 -0
- package/dist/examples/submodule-diff.d.ts.map +1 -0
- package/dist/examples/submodule-diff.js +99 -0
- package/dist/examples/submodule-diff.js.map +1 -0
- package/dist/examples/tanstack-demo.js +3 -3
- package/dist/examples/tanstack-demo.js.map +1 -1
- package/dist/examples/use-promise-demo.js +3 -3
- package/dist/examples/use-promise-demo.js.map +1 -1
- package/dist/extensions/dev.d.ts +8 -0
- package/dist/extensions/dev.d.ts.map +1 -1
- package/dist/extensions/dev.js +60 -35
- package/dist/extensions/dev.js.map +1 -1
- package/dist/extensions/home.d.ts.map +1 -1
- package/dist/extensions/home.js +22 -97
- package/dist/extensions/home.js.map +1 -1
- package/dist/extensions/store.js +2 -2
- package/dist/extensions/store.js.map +1 -1
- package/dist/globals.js +1 -1
- package/dist/globals.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-action-panel.js +1 -1
- package/dist/hooks/use-action-panel.js.map +1 -1
- package/dist/hooks/use-unstable-ai.js +1 -1
- package/dist/hooks/use-unstable-ai.js.map +1 -1
- package/dist/index.d.ts +57 -55
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -38
- package/dist/index.js.map +1 -1
- package/dist/internal/date-picker-widget.d.ts.map +1 -1
- package/dist/internal/date-picker-widget.js +56 -48
- package/dist/internal/date-picker-widget.js.map +1 -1
- package/dist/internal/dialog.d.ts +3 -3
- package/dist/internal/dialog.d.ts.map +1 -1
- package/dist/internal/dialog.js +10 -10
- package/dist/internal/dialog.js.map +1 -1
- package/dist/internal/error-handler.js +2 -2
- package/dist/internal/error-handler.js.map +1 -1
- package/dist/internal/focus-context.d.ts +1 -1
- package/dist/internal/focus-context.d.ts.map +1 -1
- package/dist/internal/navigation.d.ts +1 -1
- package/dist/internal/navigation.d.ts.map +1 -1
- package/dist/internal/navigation.js +2 -2
- package/dist/internal/navigation.js.map +1 -1
- package/dist/internal/providers.d.ts +2 -2
- package/dist/internal/providers.d.ts.map +1 -1
- package/dist/internal/providers.js +9 -9
- package/dist/internal/providers.js.map +1 -1
- package/dist/internal/scrollbox.d.ts +12 -0
- package/dist/internal/scrollbox.d.ts.map +1 -0
- package/dist/internal/scrollbox.js +34 -0
- package/dist/internal/scrollbox.js.map +1 -0
- package/dist/preload.js +1 -1
- package/dist/preload.js.map +1 -1
- package/dist/release.d.ts +11 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +113 -0
- package/dist/release.js.map +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +1 -0
- package/dist/state.js.map +1 -1
- package/dist/theme.d.ts +11 -8
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +31 -8
- package/dist/theme.js.map +1 -1
- package/dist/utils/run-command.d.ts +22 -0
- package/dist/utils/run-command.d.ts.map +1 -0
- package/dist/utils/run-command.js +127 -0
- package/dist/utils/run-command.js.map +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +6 -4
- package/dist/utils.js.map +1 -1
- package/package.json +13 -8
- package/src/apis/toast.tsx +38 -17
- package/src/build.tsx +5 -3
- package/src/cli.tsx +46 -0
- package/src/colors.tsx +22 -1
- package/src/compile.tsx +219 -0
- package/src/components/actions.tsx +7 -1
- package/src/components/command-arguments.tsx +81 -0
- package/src/components/detail.tsx +26 -58
- package/src/components/dropdown.tsx +108 -23
- package/src/components/extension-preferences.tsx +55 -35
- package/src/components/form/checkbox.tsx +13 -5
- package/src/components/form/date-picker.tsx +24 -29
- package/src/components/form/description.tsx +35 -7
- package/src/components/form/dropdown.tsx +16 -30
- package/src/components/form/file-autocomplete.tsx +87 -77
- package/src/components/form/file-picker.tsx +69 -57
- package/src/components/form/form-ref.tsx +68 -0
- package/src/components/form/index.tsx +152 -41
- package/src/components/form/password-field.tsx +35 -22
- package/src/components/form/text-area.tsx +78 -58
- package/src/components/form/text-field.tsx +82 -61
- package/src/components/form/use-form-navigation.tsx +43 -23
- package/src/components/form/with-left-border.tsx +2 -1
- package/src/components/icon.tsx +497 -469
- package/src/components/list.tsx +279 -112
- package/src/components/loading-bar.tsx +1 -1
- package/src/descendants.tsx +15 -5
- package/src/e2e-node.tsx +16 -0
- package/src/examples/action-show-in-finder.tsx +1 -1
- package/src/examples/environment-test.tsx +1 -1
- package/src/examples/error-boundary.tsx +1 -1
- package/src/examples/file-autocomplete.vitest.tsx +245 -0
- package/src/examples/form-basic.tsx +12 -12
- package/src/examples/form-basic.vitest.tsx +297 -671
- package/src/examples/form-dropdown.tsx +1 -1
- package/src/examples/form-dropdown.vitest.tsx +353 -221
- package/src/examples/form-scroll.tsx +56 -0
- package/src/examples/form-scroll.vitest.tsx +228 -0
- package/src/examples/form-tagpicker.tsx +1 -1
- package/src/examples/form-tagpicker.vitest.tsx +438 -193
- package/src/examples/internal/descendants-filtering.tsx +13 -5
- package/src/examples/internal/descendants.tsx +17 -5
- package/src/examples/internal/rhf-custom-ref.tsx +152 -0
- package/src/examples/internal/scrollbox-demo.tsx +15 -7
- package/src/examples/internal/scrollbox-with-descendants.tsx +94 -0
- package/src/examples/internal/simple-dialog.tsx +1 -1
- package/src/examples/internal/simple-scrollbox.tsx +58 -0
- package/src/examples/internal/simple-scrollbox.vitest.tsx +104 -0
- package/src/examples/internal/text-stacking.tsx +4 -2
- package/src/examples/list-dropdown-default.tsx +1 -1
- package/src/examples/list-dropdown-default.vitest.tsx +136 -71
- package/src/examples/list-fetch-data.tsx +1 -1
- package/src/examples/list-fetch-data.vitest.tsx +42 -33
- package/src/examples/list-scrollbox.tsx +46 -0
- package/src/examples/list-scrollbox.vitest.tsx +103 -0
- package/src/examples/list-with-detail.tsx +1 -1
- package/src/examples/list-with-detail.vitest.tsx +290 -294
- package/src/examples/list-with-dropdown.tsx +1 -1
- package/src/examples/list-with-dropdown.vitest.tsx +190 -150
- package/src/examples/list-with-sections.tsx +12 -1
- package/src/examples/list-with-sections.vitest.tsx +390 -218
- package/src/examples/miscellaneous.tsx +1 -1
- package/src/examples/nested-navigation.tsx +7 -5
- package/src/examples/preferences-test.tsx +1 -1
- package/src/examples/simple-dropdown.tsx +1 -1
- package/src/examples/simple-file-picker.tsx +1 -1
- package/src/examples/simple-file-picker.vitest.tsx +533 -127
- package/src/examples/simple-grid.tsx +1 -1
- package/src/examples/simple-grid.vitest.tsx +258 -234
- package/src/examples/simple-hud.tsx +1 -1
- package/src/examples/simple-list-search.tsx +42 -1
- package/src/examples/simple-list.tsx +1 -1
- package/src/examples/simple-navigation.tsx +7 -5
- package/src/examples/simple-navigation.vitest.tsx +434 -238
- package/src/examples/store.tsx +1 -1
- package/src/examples/store.vitest.tsx +31 -14
- package/src/examples/submodule-diff.tsx +153 -0
- package/src/examples/tanstack-demo.tsx +1 -1
- package/src/examples/use-promise-demo.tsx +1 -1
- package/src/extensions/dev.tsx +76 -38
- package/src/extensions/dev.vitest.tsx +220 -0
- package/src/extensions/home.tsx +20 -121
- package/src/globals.ts +1 -1
- package/src/index.tsx +12 -25
- package/src/internal/date-picker-widget.tsx +56 -46
- package/src/internal/dialog.tsx +6 -6
- package/src/internal/providers.tsx +1 -1
- package/src/internal/scrollbox.tsx +63 -0
- package/src/release.tsx +159 -0
- package/src/state.tsx +2 -0
- package/src/store-api/search.test.tsx +4 -13
- package/src/theme.tsx +33 -8
- package/src/utils/run-command.tsx +204 -0
- package/src/utils.tsx +6 -4
- package/dist/ai.d.ts +0 -104
- package/dist/ai.d.ts.map +0 -1
- package/dist/ai.js +0 -135
- package/dist/ai.js.map +0 -1
- package/dist/apis/cache.test.d.ts +0 -2
- package/dist/apis/cache.test.d.ts.map +0 -1
- package/dist/apis/cache.test.js +0 -246
- package/dist/apis/cache.test.js.map +0 -1
- package/dist/apis/localstorage.test.d.ts +0 -2
- package/dist/apis/localstorage.test.d.ts.map +0 -1
- package/dist/apis/localstorage.test.js +0 -131
- package/dist/apis/localstorage.test.js.map +0 -1
- package/dist/apis/toast.test.d.ts +0 -2
- package/dist/apis/toast.test.d.ts.map +0 -1
- package/dist/apis/toast.test.js +0 -67
- package/dist/apis/toast.test.js.map +0 -1
- package/dist/build.test.d.ts +0 -2
- package/dist/build.test.d.ts.map +0 -1
- package/dist/build.test.js +0 -73
- package/dist/build.test.js.map +0 -1
- package/dist/cache.d.ts +0 -32
- package/dist/cache.d.ts.map +0 -1
- package/dist/cache.js +0 -205
- package/dist/cache.js.map +0 -1
- package/dist/cache.test.d.ts +0 -2
- package/dist/cache.test.d.ts.map +0 -1
- package/dist/cache.test.js +0 -246
- package/dist/cache.test.js.map +0 -1
- package/dist/clipboard.d.ts +0 -36
- package/dist/clipboard.d.ts.map +0 -1
- package/dist/clipboard.js +0 -154
- package/dist/clipboard.js.map +0 -1
- package/dist/components/form/form-type-only.d.ts +0 -174
- package/dist/components/form/form-type-only.d.ts.map +0 -1
- package/dist/components/form/form-type-only.js +0 -2
- package/dist/components/form/form-type-only.js.map +0 -1
- package/dist/components/form/use-form-handling.d.ts +0 -4
- package/dist/components/form/use-form-handling.d.ts.map +0 -1
- package/dist/components/form/use-form-handling.js +0 -37
- package/dist/components/form/use-form-handling.js.map +0 -1
- package/dist/dev-ui.d.ts +0 -7
- package/dist/dev-ui.d.ts.map +0 -1
- package/dist/dev-ui.js +0 -118
- package/dist/dev-ui.js.map +0 -1
- package/dist/environment.d.ts +0 -63
- package/dist/environment.d.ts.map +0 -1
- package/dist/environment.js +0 -189
- package/dist/environment.js.map +0 -1
- package/dist/examples/datepicker.d.ts +0 -2
- package/dist/examples/datepicker.d.ts.map +0 -1
- package/dist/examples/datepicker.js +0 -344
- package/dist/examples/datepicker.js.map +0 -1
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts +0 -2
- package/dist/examples/form-basic-arrow-keys.vitest.d.ts.map +0 -1
- package/dist/examples/form-basic-arrow-keys.vitest.js +0 -46
- package/dist/examples/form-basic-arrow-keys.vitest.js.map +0 -1
- package/dist/examples/form-basic.vitest.d.ts +0 -2
- package/dist/examples/form-basic.vitest.d.ts.map +0 -1
- package/dist/examples/form-basic.vitest.js +0 -995
- package/dist/examples/form-basic.vitest.js.map +0 -1
- package/dist/examples/form-dropdown-with-sections.d.ts +0 -2
- package/dist/examples/form-dropdown-with-sections.d.ts.map +0 -1
- package/dist/examples/form-dropdown-with-sections.js +0 -13
- package/dist/examples/form-dropdown-with-sections.js.map +0 -1
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts +0 -2
- package/dist/examples/form-dropdown-with-sections.vitest.d.ts.map +0 -1
- package/dist/examples/form-dropdown-with-sections.vitest.js +0 -75
- package/dist/examples/form-dropdown-with-sections.vitest.js.map +0 -1
- package/dist/examples/form-dropdown.vitest.d.ts +0 -2
- package/dist/examples/form-dropdown.vitest.d.ts.map +0 -1
- package/dist/examples/form-dropdown.vitest.js +0 -722
- package/dist/examples/form-dropdown.vitest.js.map +0 -1
- package/dist/examples/form-multiselect-dropdown.d.ts +0 -2
- package/dist/examples/form-multiselect-dropdown.d.ts.map +0 -1
- package/dist/examples/form-multiselect-dropdown.js +0 -13
- package/dist/examples/form-multiselect-dropdown.js.map +0 -1
- package/dist/examples/form-tagpicker.vitest.d.ts +0 -2
- package/dist/examples/form-tagpicker.vitest.d.ts.map +0 -1
- package/dist/examples/form-tagpicker.vitest.js +0 -491
- package/dist/examples/form-tagpicker.vitest.js.map +0 -1
- package/dist/examples/internal/nested-boxes.d.ts +0 -2
- package/dist/examples/internal/nested-boxes.d.ts.map +0 -1
- package/dist/examples/internal/nested-boxes.js +0 -7
- package/dist/examples/internal/nested-boxes.js.map +0 -1
- package/dist/examples/internal/unicode-square-repro.d.ts +0 -2
- package/dist/examples/internal/unicode-square-repro.d.ts.map +0 -1
- package/dist/examples/internal/unicode-square-repro.js +0 -7
- package/dist/examples/internal/unicode-square-repro.js.map +0 -1
- package/dist/examples/list-dropdown-default.vitest.d.ts +0 -2
- package/dist/examples/list-dropdown-default.vitest.d.ts.map +0 -1
- package/dist/examples/list-dropdown-default.vitest.js +0 -164
- package/dist/examples/list-dropdown-default.vitest.js.map +0 -1
- package/dist/examples/list-fetch-data.vitest.d.ts +0 -2
- package/dist/examples/list-fetch-data.vitest.d.ts.map +0 -1
- package/dist/examples/list-fetch-data.vitest.js +0 -103
- package/dist/examples/list-fetch-data.vitest.js.map +0 -1
- package/dist/examples/list-filter-navigation.d.ts +0 -2
- package/dist/examples/list-filter-navigation.d.ts.map +0 -1
- package/dist/examples/list-filter-navigation.js +0 -8
- package/dist/examples/list-filter-navigation.js.map +0 -1
- package/dist/examples/list-with-detail.vitest.d.ts +0 -2
- package/dist/examples/list-with-detail.vitest.d.ts.map +0 -1
- package/dist/examples/list-with-detail.vitest.js +0 -438
- package/dist/examples/list-with-detail.vitest.js.map +0 -1
- package/dist/examples/list-with-dropdown.vitest.d.ts +0 -2
- package/dist/examples/list-with-dropdown.vitest.d.ts.map +0 -1
- package/dist/examples/list-with-dropdown.vitest.js +0 -297
- package/dist/examples/list-with-dropdown.vitest.js.map +0 -1
- package/dist/examples/list-with-sections.vitest.d.ts +0 -2
- package/dist/examples/list-with-sections.vitest.d.ts.map +0 -1
- package/dist/examples/list-with-sections.vitest.js +0 -441
- package/dist/examples/list-with-sections.vitest.js.map +0 -1
- package/dist/examples/simple-file-picker.vitest.d.ts +0 -2
- package/dist/examples/simple-file-picker.vitest.d.ts.map +0 -1
- package/dist/examples/simple-file-picker.vitest.js +0 -277
- package/dist/examples/simple-file-picker.vitest.js.map +0 -1
- package/dist/examples/simple-grid.vitest.d.ts +0 -2
- package/dist/examples/simple-grid.vitest.d.ts.map +0 -1
- package/dist/examples/simple-grid.vitest.js +0 -498
- package/dist/examples/simple-grid.vitest.js.map +0 -1
- package/dist/examples/simple-navigation.vitest.d.ts +0 -2
- package/dist/examples/simple-navigation.vitest.d.ts.map +0 -1
- package/dist/examples/simple-navigation.vitest.js +0 -522
- package/dist/examples/simple-navigation.vitest.js.map +0 -1
- package/dist/examples/store.vitest.d.ts +0 -2
- package/dist/examples/store.vitest.d.ts.map +0 -1
- package/dist/examples/store.vitest.js +0 -52
- package/dist/examples/store.vitest.js.map +0 -1
- package/dist/home-command.d.ts +0 -8
- package/dist/home-command.d.ts.map +0 -1
- package/dist/home-command.js +0 -181
- package/dist/home-command.js.map +0 -1
- package/dist/hooks/hooks.test.d.ts +0 -2
- package/dist/hooks/hooks.test.d.ts.map +0 -1
- package/dist/hooks/hooks.test.js +0 -37
- package/dist/hooks/hooks.test.js.map +0 -1
- package/dist/hover-repro.d.ts +0 -2
- package/dist/hover-repro.d.ts.map +0 -1
- package/dist/hover-repro.js +0 -20
- package/dist/hover-repro.js.map +0 -1
- package/dist/localstorage.d.ts +0 -13
- package/dist/localstorage.d.ts.map +0 -1
- package/dist/localstorage.js +0 -190
- package/dist/localstorage.js.map +0 -1
- package/dist/localstorage.test.d.ts +0 -2
- package/dist/localstorage.test.d.ts.map +0 -1
- package/dist/localstorage.test.js +0 -131
- package/dist/localstorage.test.js.map +0 -1
- package/dist/oauth.d.ts +0 -142
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js +0 -551
- package/dist/oauth.js.map +0 -1
- package/dist/preferences.d.ts +0 -23
- package/dist/preferences.d.ts.map +0 -1
- package/dist/preferences.js +0 -105
- package/dist/preferences.js.map +0 -1
- package/dist/store-api/download.test.d.ts +0 -2
- package/dist/store-api/download.test.d.ts.map +0 -1
- package/dist/store-api/download.test.js +0 -36
- package/dist/store-api/download.test.js.map +0 -1
- package/dist/store-api/extension.test.d.ts +0 -2
- package/dist/store-api/extension.test.d.ts.map +0 -1
- package/dist/store-api/extension.test.js +0 -22
- package/dist/store-api/extension.test.js.map +0 -1
- package/dist/store-api/search.test.d.ts +0 -2
- package/dist/store-api/search.test.d.ts.map +0 -1
- package/dist/store-api/search.test.js +0 -45
- package/dist/store-api/search.test.js.map +0 -1
- package/dist/store.d.ts +0 -21
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -84
- package/dist/store.js.map +0 -1
- package/dist/toast.d.ts +0 -44
- package/dist/toast.d.ts.map +0 -1
- package/dist/toast.js +0 -221
- package/dist/toast.js.map +0 -1
- package/dist/utils.test.d.ts +0 -2
- package/dist/utils.test.d.ts.map +0 -1
- package/dist/utils.test.js +0 -152
- package/dist/utils.test.js.map +0 -1
- package/dist/window.d.ts +0 -12
- package/dist/window.d.ts.map +0 -1
- package/dist/window.js +0 -48
- package/dist/window.js.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, { ReactNode, useMemo, ReactElement } from 'react'
|
|
2
2
|
import { TextAttributes } from '@opentui/core'
|
|
3
3
|
import { useKeyboard } from '@opentui/react'
|
|
4
|
-
import { Theme } from 'termcast/src/theme'
|
|
4
|
+
import { Theme, markdownSyntaxStyle } from 'termcast/src/theme'
|
|
5
5
|
import { InFocus, useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
6
6
|
import { ActionPanel, Action } from 'termcast/src/components/actions'
|
|
7
7
|
import { Image } from 'termcast/src/components/list'
|
|
8
|
-
import { Color } from 'termcast/src/colors'
|
|
9
|
-
|
|
8
|
+
import { Color, resolveColor } from 'termcast/src/colors'
|
|
9
|
+
|
|
10
10
|
import { useDialog } from 'termcast/src/internal/dialog'
|
|
11
|
+
import { ScrollBox } from 'termcast/src/internal/scrollbox'
|
|
11
12
|
|
|
12
13
|
interface ActionsInterface {
|
|
13
14
|
actions?: ReactNode
|
|
@@ -39,7 +40,7 @@ interface LabelProps {
|
|
|
39
40
|
| string
|
|
40
41
|
| {
|
|
41
42
|
value: string
|
|
42
|
-
color?: Color | null
|
|
43
|
+
color?: Color.ColorLike | null
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -84,7 +85,7 @@ const DetailMetadataLabel = (props: LabelProps): any => {
|
|
|
84
85
|
<text fg={Theme.textMuted} style={{ minWidth: 15 }}>
|
|
85
86
|
{props.title}:
|
|
86
87
|
</text>
|
|
87
|
-
<text fg={textColor || Theme.text}>{textValue || '—'}</text>
|
|
88
|
+
<text fg={resolveColor(textColor) || Theme.text}>{textValue || '—'}</text>
|
|
88
89
|
</box>
|
|
89
90
|
)
|
|
90
91
|
}
|
|
@@ -125,7 +126,7 @@ const DetailMetadataTagListItem = (props: TagListItemProps): any => {
|
|
|
125
126
|
|
|
126
127
|
return (
|
|
127
128
|
<text
|
|
128
|
-
fg={props.color || Theme.text}
|
|
129
|
+
fg={resolveColor(props.color) || Theme.text}
|
|
129
130
|
style={{
|
|
130
131
|
paddingRight: 1,
|
|
131
132
|
paddingLeft: props.icon ? 1 : 0,
|
|
@@ -172,10 +173,11 @@ const DetailMetadata: DetailMetadataType = (props) => {
|
|
|
172
173
|
<box
|
|
173
174
|
style={{
|
|
174
175
|
flexDirection: 'column',
|
|
175
|
-
paddingTop:
|
|
176
|
-
paddingLeft: 2,
|
|
177
|
-
paddingRight: 2,
|
|
176
|
+
paddingTop: 1,
|
|
178
177
|
}}
|
|
178
|
+
border={['top']}
|
|
179
|
+
borderStyle='single'
|
|
180
|
+
borderColor={Theme.border}
|
|
179
181
|
>
|
|
180
182
|
{props.children}
|
|
181
183
|
</box>
|
|
@@ -194,24 +196,6 @@ function DetailFooter({
|
|
|
194
196
|
hasActions?: boolean
|
|
195
197
|
firstActionTitle?: string
|
|
196
198
|
}): any {
|
|
197
|
-
const toast = useStore((state) => state.toast)
|
|
198
|
-
|
|
199
|
-
if (toast) {
|
|
200
|
-
return (
|
|
201
|
-
<box
|
|
202
|
-
border={false}
|
|
203
|
-
style={{
|
|
204
|
-
paddingLeft: 1,
|
|
205
|
-
paddingRight: 1,
|
|
206
|
-
paddingTop: 1,
|
|
207
|
-
marginTop: 1,
|
|
208
|
-
}}
|
|
209
|
-
>
|
|
210
|
-
{toast}
|
|
211
|
-
</box>
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
199
|
return (
|
|
216
200
|
<box
|
|
217
201
|
border={false}
|
|
@@ -285,17 +269,10 @@ const Detail: DetailType = (props) => {
|
|
|
285
269
|
const dialog = useDialog()
|
|
286
270
|
const inFocus = useIsInFocus()
|
|
287
271
|
|
|
288
|
-
const markdownLines = useMemo(() => {
|
|
289
|
-
if (!props.markdown) return []
|
|
290
|
-
// TODO: Implement proper markdown parsing
|
|
291
|
-
return props.markdown.split('\n')
|
|
292
|
-
}, [props.markdown])
|
|
293
|
-
|
|
294
272
|
const firstActionTitle = useMemo(() => {
|
|
295
273
|
return actions ? getFirstActionTitle(actions) : undefined
|
|
296
274
|
}, [actions])
|
|
297
275
|
|
|
298
|
-
// Handle Ctrl+K and Return to show actions
|
|
299
276
|
useKeyboard((evt) => {
|
|
300
277
|
if (!inFocus) return
|
|
301
278
|
|
|
@@ -307,43 +284,34 @@ const Detail: DetailType = (props) => {
|
|
|
307
284
|
})
|
|
308
285
|
|
|
309
286
|
const content = (
|
|
310
|
-
<
|
|
287
|
+
<ScrollBox
|
|
288
|
+
focused={true}
|
|
289
|
+
flexGrow={1}
|
|
290
|
+
flexShrink={1}
|
|
311
291
|
style={{
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
292
|
+
rootOptions: {
|
|
293
|
+
backgroundColor: undefined,
|
|
294
|
+
},
|
|
295
|
+
|
|
315
296
|
}}
|
|
316
297
|
>
|
|
317
298
|
<box
|
|
318
299
|
style={{
|
|
319
|
-
flexGrow: 1,
|
|
320
300
|
flexDirection: 'column',
|
|
321
301
|
paddingTop: 2,
|
|
322
|
-
|
|
323
|
-
paddingRight: props.metadata ? 1 : 2,
|
|
302
|
+
paddingRight: 2,
|
|
324
303
|
}}
|
|
325
304
|
>
|
|
326
|
-
{
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
))}
|
|
305
|
+
{props.markdown && (
|
|
306
|
+
<code content={props.markdown} conceal filetype="markdown" syntaxStyle={markdownSyntaxStyle} drawUnstyledText={false} />
|
|
307
|
+
)}
|
|
308
|
+
{props.metadata}
|
|
331
309
|
</box>
|
|
332
|
-
|
|
333
|
-
<box
|
|
334
|
-
style={{
|
|
335
|
-
flexShrink: 0,
|
|
336
|
-
width: 40,
|
|
337
|
-
}}
|
|
338
|
-
>
|
|
339
|
-
{props.metadata}
|
|
340
|
-
</box>
|
|
341
|
-
)}
|
|
342
|
-
</box>
|
|
310
|
+
</ScrollBox>
|
|
343
311
|
)
|
|
344
312
|
|
|
345
313
|
return (
|
|
346
|
-
<box style={{ flexDirection: 'column', height: '100%' }}>
|
|
314
|
+
<box style={{ flexDirection: 'column', height: '100%', flexGrow: 1 }}>
|
|
347
315
|
{content}
|
|
348
316
|
<DetailFooter
|
|
349
317
|
hasActions={!!actions}
|
|
@@ -8,12 +8,17 @@ import React, {
|
|
|
8
8
|
useContext,
|
|
9
9
|
} from 'react'
|
|
10
10
|
import { useKeyboard } from '@opentui/react'
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
TextAttributes,
|
|
13
|
+
ScrollBoxRenderable,
|
|
14
|
+
TextareaRenderable,
|
|
15
|
+
} from '@opentui/core'
|
|
12
16
|
import { Theme } from 'termcast/src/theme'
|
|
13
17
|
import { logger } from 'termcast/src/logger'
|
|
14
18
|
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
15
19
|
import { CommonProps } from 'termcast/src/utils'
|
|
16
20
|
import { createDescendants } from 'termcast/src/descendants'
|
|
21
|
+
import { ScrollBox } from 'termcast/src/internal/scrollbox'
|
|
17
22
|
|
|
18
23
|
// SearchBarInterface provides the common search bar props
|
|
19
24
|
interface SearchBarInterface {
|
|
@@ -41,6 +46,7 @@ export interface DropdownItemProps extends CommonProps {
|
|
|
41
46
|
|
|
42
47
|
keywords?: string[]
|
|
43
48
|
label?: string
|
|
49
|
+
color?: string
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
export interface DropdownSectionProps extends CommonProps {
|
|
@@ -53,6 +59,7 @@ interface DropdownItemDescendant {
|
|
|
53
59
|
value: string
|
|
54
60
|
title: string
|
|
55
61
|
hidden?: boolean
|
|
62
|
+
elementRef?: { y: number; height: number } | null
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
const {
|
|
@@ -70,6 +77,7 @@ interface DropdownContextValue {
|
|
|
70
77
|
setSelectedIndex?: (index: number) => void
|
|
71
78
|
currentValue?: string
|
|
72
79
|
onChange?: (value: string) => void
|
|
80
|
+
scrollBoxRef?: React.RefObject<ScrollBoxRenderable | null>
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
const DropdownContext = createContext<DropdownContextValue>({
|
|
@@ -100,15 +108,45 @@ const Dropdown: DropdownType = (props) => {
|
|
|
100
108
|
} = props
|
|
101
109
|
|
|
102
110
|
const [selected, setSelected] = useState(0)
|
|
103
|
-
const [searchText,
|
|
111
|
+
const [searchText, setSearchTextState] = useState('')
|
|
104
112
|
const [currentValue, setCurrentValue] = useState<string | undefined>(
|
|
105
113
|
value || defaultValue,
|
|
106
114
|
)
|
|
107
|
-
const inputRef = useRef<
|
|
115
|
+
const inputRef = useRef<TextareaRenderable>(null)
|
|
108
116
|
const lastSearchTextRef = useRef('')
|
|
109
117
|
const throttleTimeoutRef = useRef<NodeJS.Timeout | undefined>(undefined)
|
|
118
|
+
const scrollBoxRef = useRef<ScrollBoxRenderable>(null)
|
|
110
119
|
const descendantsContext = useDropdownDescendants()
|
|
111
120
|
|
|
121
|
+
// Update textarea and reset selection - single source of truth is the ref
|
|
122
|
+
const setSearchText = (text: string) => {
|
|
123
|
+
inputRef.current?.setText(text)
|
|
124
|
+
setSearchTextState(text)
|
|
125
|
+
setSelected(0)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const scrollToItem = (item: { props?: DropdownItemDescendant }) => {
|
|
129
|
+
const scrollBox = scrollBoxRef.current
|
|
130
|
+
const elementRef = item.props?.elementRef
|
|
131
|
+
if (!scrollBox || !elementRef) return
|
|
132
|
+
|
|
133
|
+
const contentY = scrollBox.content?.y || 0
|
|
134
|
+
const viewportHeight = scrollBox.viewport?.height || 10
|
|
135
|
+
const currentScrollTop = scrollBox.scrollTop || 0
|
|
136
|
+
|
|
137
|
+
const itemTop = elementRef.y - contentY
|
|
138
|
+
const itemBottom = itemTop + elementRef.height
|
|
139
|
+
|
|
140
|
+
const visibleTop = currentScrollTop
|
|
141
|
+
const visibleBottom = currentScrollTop + viewportHeight
|
|
142
|
+
|
|
143
|
+
if (itemTop < visibleTop) {
|
|
144
|
+
scrollBox.scrollTo(itemTop)
|
|
145
|
+
} else if (itemBottom > visibleBottom) {
|
|
146
|
+
scrollBox.scrollTo(itemBottom - viewportHeight)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
112
150
|
// Create context value for children
|
|
113
151
|
const contextValue = useMemo<DropdownContextValue>(
|
|
114
152
|
() => ({
|
|
@@ -119,6 +157,7 @@ const Dropdown: DropdownType = (props) => {
|
|
|
119
157
|
setSelectedIndex: setSelected,
|
|
120
158
|
currentValue,
|
|
121
159
|
onChange: (value: string) => selectItem(value),
|
|
160
|
+
scrollBoxRef,
|
|
122
161
|
}),
|
|
123
162
|
[searchText, filtering, selected, currentValue],
|
|
124
163
|
)
|
|
@@ -130,16 +169,13 @@ const Dropdown: DropdownType = (props) => {
|
|
|
130
169
|
}
|
|
131
170
|
}, [value])
|
|
132
171
|
|
|
133
|
-
//
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
setSelected(0)
|
|
136
|
-
}, [searchText])
|
|
137
|
-
|
|
138
|
-
// Handle search text change with throttling
|
|
172
|
+
// Handle search text change from textarea - called by onContentChange
|
|
139
173
|
const handleSearchTextChange = (text: string) => {
|
|
140
174
|
if (!inFocus) return
|
|
141
175
|
|
|
142
|
-
|
|
176
|
+
// Update state for context and reset selection
|
|
177
|
+
setSearchTextState(text)
|
|
178
|
+
setSelected(0)
|
|
143
179
|
|
|
144
180
|
if (onSearchTextChange) {
|
|
145
181
|
if (throttle) {
|
|
@@ -157,15 +193,31 @@ const Dropdown: DropdownType = (props) => {
|
|
|
157
193
|
|
|
158
194
|
const move = (direction: -1 | 1) => {
|
|
159
195
|
const items = Object.values(descendantsContext.map.current)
|
|
160
|
-
.filter((item: any) => item.index !== -1)
|
|
196
|
+
.filter((item: any) => item.index !== -1 && !item.props?.hidden)
|
|
161
197
|
.sort((a: any, b: any) => a.index - b.index)
|
|
162
198
|
|
|
163
199
|
if (items.length === 0) return
|
|
164
200
|
|
|
165
|
-
let
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
201
|
+
let currentVisibleIndex = items.findIndex(
|
|
202
|
+
(item) => item.index === selected,
|
|
203
|
+
)
|
|
204
|
+
if (currentVisibleIndex === -1) {
|
|
205
|
+
if (items[0]) {
|
|
206
|
+
setSelected(items[0].index)
|
|
207
|
+
scrollToItem(items[0])
|
|
208
|
+
}
|
|
209
|
+
return
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
let nextVisibleIndex = currentVisibleIndex + direction
|
|
213
|
+
if (nextVisibleIndex < 0) nextVisibleIndex = items.length - 1
|
|
214
|
+
if (nextVisibleIndex >= items.length) nextVisibleIndex = 0
|
|
215
|
+
|
|
216
|
+
const nextItem = items[nextVisibleIndex]
|
|
217
|
+
if (nextItem) {
|
|
218
|
+
setSelected(nextItem.index)
|
|
219
|
+
scrollToItem(nextItem)
|
|
220
|
+
}
|
|
169
221
|
}
|
|
170
222
|
|
|
171
223
|
const selectItem = (itemValue: string) => {
|
|
@@ -220,22 +272,46 @@ const Dropdown: DropdownType = (props) => {
|
|
|
220
272
|
<text fg={Theme.textMuted}>esc</text>
|
|
221
273
|
</box>
|
|
222
274
|
<box style={{ paddingTop: 1, paddingBottom: 1 }}>
|
|
223
|
-
<
|
|
275
|
+
<textarea
|
|
224
276
|
ref={inputRef}
|
|
225
|
-
|
|
277
|
+
height={1}
|
|
278
|
+
keyBindings={[
|
|
279
|
+
{ name: 'return', action: 'submit' },
|
|
280
|
+
{ name: 'linefeed', action: 'submit' },
|
|
281
|
+
]}
|
|
282
|
+
onContentChange={() => {
|
|
283
|
+
const value = inputRef.current?.plainText || ''
|
|
284
|
+
handleSearchTextChange(value)
|
|
285
|
+
}}
|
|
226
286
|
placeholder={placeholder}
|
|
227
287
|
focused={inFocus}
|
|
228
|
-
|
|
288
|
+
initialValue=""
|
|
229
289
|
focusedBackgroundColor={Theme.backgroundPanel}
|
|
230
290
|
cursorColor={Theme.primary}
|
|
231
291
|
focusedTextColor={Theme.textMuted}
|
|
232
292
|
/>
|
|
233
293
|
</box>
|
|
234
294
|
</box>
|
|
235
|
-
<
|
|
295
|
+
<ScrollBox
|
|
296
|
+
ref={scrollBoxRef}
|
|
297
|
+
focused={false}
|
|
298
|
+
flexGrow={1}
|
|
299
|
+
flexShrink={1}
|
|
300
|
+
style={{
|
|
301
|
+
rootOptions: {
|
|
302
|
+
backgroundColor: undefined,
|
|
303
|
+
maxHeight: 10,
|
|
304
|
+
},
|
|
305
|
+
scrollbarOptions: {
|
|
306
|
+
|
|
307
|
+
showArrows: false,
|
|
308
|
+
|
|
309
|
+
},
|
|
310
|
+
}}
|
|
311
|
+
>
|
|
236
312
|
{/* Render children - they will register as descendants and render themselves */}
|
|
237
313
|
{children}
|
|
238
|
-
</
|
|
314
|
+
</ScrollBox>
|
|
239
315
|
</box>
|
|
240
316
|
<box
|
|
241
317
|
border={false}
|
|
@@ -268,13 +344,16 @@ function ItemOption(props: {
|
|
|
268
344
|
active?: boolean
|
|
269
345
|
current?: boolean
|
|
270
346
|
label?: string
|
|
347
|
+
color?: string
|
|
271
348
|
onMouseDown?: () => void
|
|
272
349
|
onMouseMove?: () => void
|
|
350
|
+
elementRef?: React.Ref<any>
|
|
273
351
|
}) {
|
|
274
352
|
const [isHovered, setIsHovered] = useState(false)
|
|
275
353
|
|
|
276
354
|
return (
|
|
277
355
|
<box
|
|
356
|
+
ref={props.elementRef}
|
|
278
357
|
style={{
|
|
279
358
|
flexDirection: 'row',
|
|
280
359
|
backgroundColor: props.active
|
|
@@ -312,9 +391,11 @@ function ItemOption(props: {
|
|
|
312
391
|
fg={
|
|
313
392
|
props.active
|
|
314
393
|
? Theme.background
|
|
315
|
-
: props.
|
|
316
|
-
?
|
|
317
|
-
:
|
|
394
|
+
: props.color
|
|
395
|
+
? props.color
|
|
396
|
+
: props.current
|
|
397
|
+
? Theme.primary
|
|
398
|
+
: Theme.text
|
|
318
399
|
}
|
|
319
400
|
attributes={props.active ? TextAttributes.BOLD : undefined}
|
|
320
401
|
selectable={false}
|
|
@@ -337,6 +418,7 @@ function ItemOption(props: {
|
|
|
337
418
|
|
|
338
419
|
const DropdownItem: (props: DropdownItemProps) => any = (props) => {
|
|
339
420
|
const context = useContext(DropdownContext)
|
|
421
|
+
const elementRef = useRef<{ y: number; height: number } | null>(null)
|
|
340
422
|
if (!context) return null
|
|
341
423
|
|
|
342
424
|
const { searchText, filtering, currentSection, selectedIndex, currentValue } =
|
|
@@ -358,6 +440,7 @@ const DropdownItem: (props: DropdownItemProps) => any = (props) => {
|
|
|
358
440
|
value: props.value,
|
|
359
441
|
title: props.title,
|
|
360
442
|
hidden: shouldHide,
|
|
443
|
+
elementRef: elementRef.current,
|
|
361
444
|
})
|
|
362
445
|
|
|
363
446
|
// Don't render if hidden
|
|
@@ -394,8 +477,10 @@ const DropdownItem: (props: DropdownItemProps) => any = (props) => {
|
|
|
394
477
|
active={isActive}
|
|
395
478
|
current={isCurrent}
|
|
396
479
|
label={props.label}
|
|
480
|
+
color={props.color}
|
|
397
481
|
onMouseMove={handleMouseMove}
|
|
398
482
|
onMouseDown={handleMouseDown}
|
|
483
|
+
elementRef={elementRef}
|
|
399
484
|
/>
|
|
400
485
|
)
|
|
401
486
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import path from 'node:path'
|
|
4
|
-
import {
|
|
4
|
+
import { useQuery } from '@tanstack/react-query'
|
|
5
|
+
import { Form } from './form'
|
|
6
|
+
import { showToast, Toast } from '../apis/toast'
|
|
7
|
+
import { ActionPanel, Action } from './actions'
|
|
5
8
|
import { LocalStorage } from 'termcast/src/apis/localstorage'
|
|
6
9
|
import { useNavigation } from 'termcast/src/internal/navigation'
|
|
7
10
|
import { logger } from 'termcast/src/logger'
|
|
@@ -37,15 +40,12 @@ export function ExtensionPreferences({
|
|
|
37
40
|
commandName,
|
|
38
41
|
onSubmit,
|
|
39
42
|
}: ExtensionPreferencesProps): any {
|
|
40
|
-
const [preferences, setPreferences] = useState<PreferenceManifest[]>([])
|
|
41
|
-
const [savedValues, setSavedValues] = useState<Record<string, any>>({})
|
|
42
|
-
const [isLoading, setIsLoading] = useState(true)
|
|
43
43
|
const { pop } = useNavigation()
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const { data, isLoading } = useQuery({
|
|
46
|
+
queryKey: ['extension-preferences', extensionName, commandName],
|
|
47
|
+
queryFn: async () => {
|
|
47
48
|
try {
|
|
48
|
-
// Get extension package.json to read preference manifest
|
|
49
49
|
const storeDir = getStoreDirectory()
|
|
50
50
|
const extensionDir = path.join(storeDir, extensionName)
|
|
51
51
|
const packageJsonPath = path.join(extensionDir, 'package.json')
|
|
@@ -58,11 +58,9 @@ export function ExtensionPreferences({
|
|
|
58
58
|
fs.readFileSync(packageJsonPath, 'utf-8'),
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
-
// Get preferences based on whether this is for a command or extension
|
|
62
61
|
let prefsToUse: PreferenceManifest[] = []
|
|
63
62
|
|
|
64
63
|
if (commandName) {
|
|
65
|
-
// Look for command-specific preferences
|
|
66
64
|
const command = packageJson.commands?.find(
|
|
67
65
|
(cmd) => cmd.name === commandName,
|
|
68
66
|
)
|
|
@@ -70,40 +68,38 @@ export function ExtensionPreferences({
|
|
|
70
68
|
prefsToUse = command.preferences || []
|
|
71
69
|
}
|
|
72
70
|
} else {
|
|
73
|
-
// Get extension preferences (shared across all commands)
|
|
74
71
|
prefsToUse = packageJson.preferences || []
|
|
75
72
|
}
|
|
76
73
|
|
|
77
|
-
// Load saved values from LocalStorage
|
|
78
74
|
const preferencesKey = commandName
|
|
79
75
|
? `preferences.${extensionName}.${commandName}`
|
|
80
76
|
: `preferences.${extensionName}`
|
|
81
77
|
const saved = await LocalStorage.getItem(preferencesKey)
|
|
82
78
|
|
|
79
|
+
let savedValues: Record<string, any> = {}
|
|
83
80
|
if (saved && typeof saved === 'string') {
|
|
84
81
|
try {
|
|
85
|
-
|
|
86
|
-
setSavedValues(parsed)
|
|
82
|
+
savedValues = JSON.parse(saved)
|
|
87
83
|
} catch (e) {
|
|
88
84
|
logger.error('Failed to parse saved preferences:', e)
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
return { preferences: prefsToUse, savedValues }
|
|
93
89
|
} catch (error) {
|
|
94
90
|
logger.error(`Failed to load preferences for ${extensionName}:`, error)
|
|
95
|
-
|
|
91
|
+
showToast({
|
|
96
92
|
style: Toast.Style.Failure,
|
|
97
93
|
title: 'Failed to load preferences',
|
|
98
94
|
message: String(error),
|
|
99
95
|
})
|
|
100
|
-
|
|
101
|
-
setIsLoading(false)
|
|
96
|
+
return { preferences: [], savedValues: {} }
|
|
102
97
|
}
|
|
103
|
-
}
|
|
98
|
+
},
|
|
99
|
+
})
|
|
104
100
|
|
|
105
|
-
|
|
106
|
-
}
|
|
101
|
+
const preferences = data?.preferences ?? []
|
|
102
|
+
const savedValues = data?.savedValues ?? {}
|
|
107
103
|
|
|
108
104
|
const handleSubmit = async (values: Record<string, any>) => {
|
|
109
105
|
try {
|
|
@@ -235,27 +231,51 @@ export function ExtensionPreferences({
|
|
|
235
231
|
</Form.Dropdown>
|
|
236
232
|
)
|
|
237
233
|
|
|
238
|
-
// TODO: Implement file and directory pickers and appPicker
|
|
239
234
|
case 'file':
|
|
235
|
+
return (
|
|
236
|
+
<Form.FilePicker
|
|
237
|
+
key={pref.name}
|
|
238
|
+
id={pref.name}
|
|
239
|
+
title={pref.title}
|
|
240
|
+
placeholder={pref.placeholder || 'Select a file'}
|
|
241
|
+
defaultValue={defaultValue ? [defaultValue] : []}
|
|
242
|
+
info={pref.description}
|
|
243
|
+
allowMultipleSelection={false}
|
|
244
|
+
canChooseFiles={true}
|
|
245
|
+
canChooseDirectories={false}
|
|
246
|
+
storeValue
|
|
247
|
+
/>
|
|
248
|
+
)
|
|
249
|
+
|
|
240
250
|
case 'directory':
|
|
251
|
+
return (
|
|
252
|
+
<Form.FilePicker
|
|
253
|
+
key={pref.name}
|
|
254
|
+
id={pref.name}
|
|
255
|
+
title={pref.title}
|
|
256
|
+
placeholder={pref.placeholder || 'Select a folder'}
|
|
257
|
+
defaultValue={defaultValue ? [defaultValue] : []}
|
|
258
|
+
info={pref.description}
|
|
259
|
+
allowMultipleSelection={false}
|
|
260
|
+
canChooseFiles={false}
|
|
261
|
+
canChooseDirectories={true}
|
|
262
|
+
storeValue
|
|
263
|
+
/>
|
|
264
|
+
)
|
|
265
|
+
|
|
241
266
|
case 'appPicker':
|
|
242
267
|
return (
|
|
243
|
-
<Form.
|
|
268
|
+
<Form.FilePicker
|
|
244
269
|
key={pref.name}
|
|
245
270
|
id={pref.name}
|
|
246
271
|
title={pref.title}
|
|
247
|
-
placeholder={
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
defaultValue={defaultValue}
|
|
255
|
-
info={
|
|
256
|
-
pref.description ||
|
|
257
|
-
`Select a ${pref.type.replace('appPicker', 'application')}`
|
|
258
|
-
}
|
|
272
|
+
placeholder={pref.placeholder || 'Select an application'}
|
|
273
|
+
defaultValue={defaultValue ? [defaultValue] : []}
|
|
274
|
+
info={pref.description || 'Select an application'}
|
|
275
|
+
allowMultipleSelection={false}
|
|
276
|
+
canChooseFiles={true}
|
|
277
|
+
canChooseDirectories={false}
|
|
278
|
+
initialDirectory='/Applications'
|
|
259
279
|
storeValue
|
|
260
280
|
/>
|
|
261
281
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { TextAttributes } from '@opentui/core'
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
|
+
import { TextAttributes, BoxRenderable } from '@opentui/core'
|
|
3
3
|
import { useKeyboard } from '@opentui/react'
|
|
4
4
|
import { useFormContext, Controller } from 'react-hook-form'
|
|
5
|
-
import { useFocusContext } from './index'
|
|
5
|
+
import { useFocusContext, useFormFieldDescendant } from './index'
|
|
6
6
|
import { FormItemProps, FormItemRef } from './types'
|
|
7
7
|
import { logger } from 'termcast/src/logger'
|
|
8
8
|
import { Theme } from 'termcast/src/theme'
|
|
@@ -22,6 +22,14 @@ export const Checkbox = (props: CheckboxProps): any => {
|
|
|
22
22
|
const isFocused = focusedField === props.id
|
|
23
23
|
const isInFocus = useIsInFocus()
|
|
24
24
|
|
|
25
|
+
const elementRef = useRef<BoxRenderable>(null)
|
|
26
|
+
|
|
27
|
+
// Register as form field descendant for scroll support
|
|
28
|
+
useFormFieldDescendant({
|
|
29
|
+
id: props.id,
|
|
30
|
+
elementRef: elementRef.current,
|
|
31
|
+
})
|
|
32
|
+
|
|
25
33
|
// Use form navigation hook
|
|
26
34
|
useFormNavigation(props.id)
|
|
27
35
|
const handleToggle = () => {
|
|
@@ -48,10 +56,10 @@ export const Checkbox = (props: CheckboxProps): any => {
|
|
|
48
56
|
defaultValue={props.defaultValue || props.value || false}
|
|
49
57
|
render={({ field, fieldState, formState }) => {
|
|
50
58
|
return (
|
|
51
|
-
<box flexDirection='column'>
|
|
59
|
+
<box ref={elementRef} flexDirection='column'>
|
|
52
60
|
<WithLeftBorder withDiamond isFocused={isFocused}>
|
|
53
61
|
<text
|
|
54
|
-
fg={Theme.text}
|
|
62
|
+
fg={isFocused ? Theme.primary : Theme.text}
|
|
55
63
|
onMouseDown={() => {
|
|
56
64
|
// Always focus the field when clicked
|
|
57
65
|
if (!isFocused) {
|