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,438 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ReactNode,
|
|
3
|
+
useState,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
createContext,
|
|
8
|
+
useContext,
|
|
9
|
+
} from 'react'
|
|
10
|
+
import { useKeyboard } from '@opentui/react'
|
|
11
|
+
import { TextAttributes } from '@opentui/core'
|
|
12
|
+
import { Theme } from 'termcast/src/theme'
|
|
13
|
+
import { logger } from 'termcast/src/logger'
|
|
14
|
+
import { useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
15
|
+
import { CommonProps } from 'termcast/src/utils'
|
|
16
|
+
import { createDescendants } from 'termcast/src/descendants'
|
|
17
|
+
|
|
18
|
+
// SearchBarInterface provides the common search bar props
|
|
19
|
+
interface SearchBarInterface {
|
|
20
|
+
isLoading?: boolean
|
|
21
|
+
filtering?: boolean | { keepSectionOrder: boolean }
|
|
22
|
+
onSearchTextChange?: (text: string) => void
|
|
23
|
+
throttle?: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface DropdownProps extends SearchBarInterface, CommonProps {
|
|
27
|
+
id?: string
|
|
28
|
+
tooltip?: string
|
|
29
|
+
placeholder?: string
|
|
30
|
+
storeValue?: boolean | undefined
|
|
31
|
+
value?: string
|
|
32
|
+
defaultValue?: string
|
|
33
|
+
children?: ReactNode
|
|
34
|
+
onChange?: (newValue: string) => void
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DropdownItemProps extends CommonProps {
|
|
38
|
+
title: string
|
|
39
|
+
value: string
|
|
40
|
+
icon?: ReactNode
|
|
41
|
+
|
|
42
|
+
keywords?: string[]
|
|
43
|
+
label?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface DropdownSectionProps extends CommonProps {
|
|
47
|
+
title?: string
|
|
48
|
+
children?: ReactNode
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Create descendants for Dropdown items - minimal fields needed
|
|
52
|
+
interface DropdownItemDescendant {
|
|
53
|
+
value: string
|
|
54
|
+
title: string
|
|
55
|
+
hidden?: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const {
|
|
59
|
+
DescendantsProvider: DropdownDescendantsProvider,
|
|
60
|
+
useDescendants: useDropdownDescendants,
|
|
61
|
+
useDescendant: useDropdownItemDescendant,
|
|
62
|
+
} = createDescendants<DropdownItemDescendant>()
|
|
63
|
+
|
|
64
|
+
// Context for passing data to dropdown items
|
|
65
|
+
interface DropdownContextValue {
|
|
66
|
+
searchText: string
|
|
67
|
+
filtering?: boolean | { keepSectionOrder: boolean }
|
|
68
|
+
currentSection?: string
|
|
69
|
+
selectedIndex: number
|
|
70
|
+
setSelectedIndex?: (index: number) => void
|
|
71
|
+
currentValue?: string
|
|
72
|
+
onChange?: (value: string) => void
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const DropdownContext = createContext<DropdownContextValue>({
|
|
76
|
+
searchText: '',
|
|
77
|
+
filtering: true,
|
|
78
|
+
selectedIndex: 0,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
interface DropdownType {
|
|
82
|
+
(props: DropdownProps): any
|
|
83
|
+
Item: (props: DropdownItemProps) => any
|
|
84
|
+
Section: (props: DropdownSectionProps) => any
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const Dropdown: DropdownType = (props) => {
|
|
88
|
+
const {
|
|
89
|
+
tooltip,
|
|
90
|
+
onChange,
|
|
91
|
+
value,
|
|
92
|
+
defaultValue,
|
|
93
|
+
children,
|
|
94
|
+
placeholder = 'Search…',
|
|
95
|
+
storeValue,
|
|
96
|
+
isLoading,
|
|
97
|
+
filtering = true,
|
|
98
|
+
onSearchTextChange,
|
|
99
|
+
throttle,
|
|
100
|
+
} = props
|
|
101
|
+
|
|
102
|
+
const [selected, setSelected] = useState(0)
|
|
103
|
+
const [searchText, setSearchText] = useState('')
|
|
104
|
+
const [currentValue, setCurrentValue] = useState<string | undefined>(
|
|
105
|
+
value || defaultValue,
|
|
106
|
+
)
|
|
107
|
+
const inputRef = useRef<any>(null)
|
|
108
|
+
const lastSearchTextRef = useRef('')
|
|
109
|
+
const throttleTimeoutRef = useRef<NodeJS.Timeout | undefined>(undefined)
|
|
110
|
+
const descendantsContext = useDropdownDescendants()
|
|
111
|
+
|
|
112
|
+
// Create context value for children
|
|
113
|
+
const contextValue = useMemo<DropdownContextValue>(
|
|
114
|
+
() => ({
|
|
115
|
+
searchText,
|
|
116
|
+
filtering,
|
|
117
|
+
currentSection: undefined,
|
|
118
|
+
selectedIndex: selected,
|
|
119
|
+
setSelectedIndex: setSelected,
|
|
120
|
+
currentValue,
|
|
121
|
+
onChange: (value: string) => selectItem(value),
|
|
122
|
+
}),
|
|
123
|
+
[searchText, filtering, selected, currentValue],
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
// Update controlled value
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (value !== undefined) {
|
|
129
|
+
setCurrentValue(value)
|
|
130
|
+
}
|
|
131
|
+
}, [value])
|
|
132
|
+
|
|
133
|
+
// Reset selected index when search changes
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
setSelected(0)
|
|
136
|
+
}, [searchText])
|
|
137
|
+
|
|
138
|
+
// Handle search text change with throttling
|
|
139
|
+
const handleSearchTextChange = (text: string) => {
|
|
140
|
+
if (!inFocus) return
|
|
141
|
+
|
|
142
|
+
setSearchText(text)
|
|
143
|
+
|
|
144
|
+
if (onSearchTextChange) {
|
|
145
|
+
if (throttle) {
|
|
146
|
+
if (throttleTimeoutRef.current) {
|
|
147
|
+
clearTimeout(throttleTimeoutRef.current)
|
|
148
|
+
}
|
|
149
|
+
throttleTimeoutRef.current = setTimeout(() => {
|
|
150
|
+
onSearchTextChange(text)
|
|
151
|
+
}, 300)
|
|
152
|
+
} else {
|
|
153
|
+
onSearchTextChange(text)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const move = (direction: -1 | 1) => {
|
|
159
|
+
const items = Object.values(descendantsContext.map.current)
|
|
160
|
+
.filter((item: any) => item.index !== -1)
|
|
161
|
+
.sort((a: any, b: any) => a.index - b.index)
|
|
162
|
+
|
|
163
|
+
if (items.length === 0) return
|
|
164
|
+
|
|
165
|
+
let next = selected + direction
|
|
166
|
+
if (next < 0) next = items.length - 1
|
|
167
|
+
if (next >= items.length) next = 0
|
|
168
|
+
setSelected(next)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const selectItem = (itemValue: string) => {
|
|
172
|
+
setCurrentValue(itemValue)
|
|
173
|
+
if (onChange) {
|
|
174
|
+
onChange(itemValue)
|
|
175
|
+
}
|
|
176
|
+
if (storeValue) {
|
|
177
|
+
// In a real implementation, this would persist the value
|
|
178
|
+
logger.log('Storing value:', itemValue)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Get focus state
|
|
183
|
+
const inFocus = useIsInFocus()
|
|
184
|
+
|
|
185
|
+
// Handle keyboard navigation
|
|
186
|
+
useKeyboard((evt) => {
|
|
187
|
+
if (!inFocus) return
|
|
188
|
+
|
|
189
|
+
if (evt.name === 'up') {
|
|
190
|
+
move(-1)
|
|
191
|
+
}
|
|
192
|
+
if (evt.name === 'down') {
|
|
193
|
+
move(1)
|
|
194
|
+
}
|
|
195
|
+
if (evt.name === 'return') {
|
|
196
|
+
const items = Object.values(descendantsContext.map.current)
|
|
197
|
+
.filter((item: any) => item.index !== -1)
|
|
198
|
+
.sort((a: any, b: any) => a.index - b.index)
|
|
199
|
+
|
|
200
|
+
const currentItem = items[selected]
|
|
201
|
+
if (currentItem?.props) {
|
|
202
|
+
selectItem((currentItem.props as DropdownItemDescendant).value)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<DropdownDescendantsProvider value={descendantsContext}>
|
|
209
|
+
<DropdownContext.Provider value={contextValue}>
|
|
210
|
+
<box>
|
|
211
|
+
<box style={{ paddingLeft: 2, paddingRight: 2 }}>
|
|
212
|
+
<box style={{ paddingLeft: 1, paddingRight: 1 }}>
|
|
213
|
+
<box
|
|
214
|
+
style={{
|
|
215
|
+
flexDirection: 'row',
|
|
216
|
+
justifyContent: 'space-between',
|
|
217
|
+
}}
|
|
218
|
+
>
|
|
219
|
+
<text attributes={TextAttributes.BOLD}>{tooltip}</text>
|
|
220
|
+
<text fg={Theme.textMuted}>esc</text>
|
|
221
|
+
</box>
|
|
222
|
+
<box style={{ paddingTop: 1, paddingBottom: 1 }}>
|
|
223
|
+
<input
|
|
224
|
+
ref={inputRef}
|
|
225
|
+
onInput={(value) => handleSearchTextChange(value)}
|
|
226
|
+
placeholder={placeholder}
|
|
227
|
+
focused={inFocus}
|
|
228
|
+
value={searchText}
|
|
229
|
+
focusedBackgroundColor={Theme.backgroundPanel}
|
|
230
|
+
cursorColor={Theme.primary}
|
|
231
|
+
focusedTextColor={Theme.textMuted}
|
|
232
|
+
/>
|
|
233
|
+
</box>
|
|
234
|
+
</box>
|
|
235
|
+
<box style={{ paddingBottom: 1 }}>
|
|
236
|
+
{/* Render children - they will register as descendants and render themselves */}
|
|
237
|
+
{children}
|
|
238
|
+
</box>
|
|
239
|
+
</box>
|
|
240
|
+
<box
|
|
241
|
+
border={false}
|
|
242
|
+
style={{
|
|
243
|
+
paddingRight: 2,
|
|
244
|
+
paddingLeft: 3,
|
|
245
|
+
paddingBottom: 1,
|
|
246
|
+
paddingTop: 1,
|
|
247
|
+
flexDirection: 'row',
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
251
|
+
↵
|
|
252
|
+
</text>
|
|
253
|
+
<text fg={Theme.textMuted}> select</text>
|
|
254
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
255
|
+
{' '}↑↓
|
|
256
|
+
</text>
|
|
257
|
+
<text fg={Theme.textMuted}> navigate</text>
|
|
258
|
+
</box>
|
|
259
|
+
</box>
|
|
260
|
+
</DropdownContext.Provider>
|
|
261
|
+
</DropdownDescendantsProvider>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function ItemOption(props: {
|
|
266
|
+
title: string
|
|
267
|
+
icon?: ReactNode
|
|
268
|
+
active?: boolean
|
|
269
|
+
current?: boolean
|
|
270
|
+
label?: string
|
|
271
|
+
onMouseDown?: () => void
|
|
272
|
+
onMouseMove?: () => void
|
|
273
|
+
}) {
|
|
274
|
+
const [isHovered, setIsHovered] = useState(false)
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<box
|
|
278
|
+
style={{
|
|
279
|
+
flexDirection: 'row',
|
|
280
|
+
backgroundColor: props.active
|
|
281
|
+
? Theme.primary
|
|
282
|
+
: isHovered
|
|
283
|
+
? Theme.backgroundPanel
|
|
284
|
+
: undefined,
|
|
285
|
+
paddingLeft: props.active ? 0 : 1,
|
|
286
|
+
paddingRight: 1,
|
|
287
|
+
justifyContent: 'space-between',
|
|
288
|
+
}}
|
|
289
|
+
border={false}
|
|
290
|
+
onMouseMove={() => {
|
|
291
|
+
setIsHovered(true)
|
|
292
|
+
if (props.onMouseMove) props.onMouseMove()
|
|
293
|
+
}}
|
|
294
|
+
onMouseOut={() => setIsHovered(false)}
|
|
295
|
+
onMouseDown={props.onMouseDown}
|
|
296
|
+
>
|
|
297
|
+
<box style={{ flexDirection: 'row' }}>
|
|
298
|
+
{props.active && (
|
|
299
|
+
<text fg={Theme.background} selectable={false}>
|
|
300
|
+
›{''}
|
|
301
|
+
</text>
|
|
302
|
+
)}
|
|
303
|
+
{props.icon && (
|
|
304
|
+
<text
|
|
305
|
+
fg={props.active ? Theme.background : Theme.text}
|
|
306
|
+
selectable={false}
|
|
307
|
+
>
|
|
308
|
+
{String(props.icon)}{' '}
|
|
309
|
+
</text>
|
|
310
|
+
)}
|
|
311
|
+
<text
|
|
312
|
+
fg={
|
|
313
|
+
props.active
|
|
314
|
+
? Theme.background
|
|
315
|
+
: props.current
|
|
316
|
+
? Theme.primary
|
|
317
|
+
: Theme.text
|
|
318
|
+
}
|
|
319
|
+
attributes={props.active ? TextAttributes.BOLD : undefined}
|
|
320
|
+
selectable={false}
|
|
321
|
+
>
|
|
322
|
+
{props.title}
|
|
323
|
+
</text>
|
|
324
|
+
</box>
|
|
325
|
+
{props.label && (
|
|
326
|
+
<text
|
|
327
|
+
fg={props.active ? Theme.background : Theme.textMuted}
|
|
328
|
+
attributes={props.active ? TextAttributes.BOLD : undefined}
|
|
329
|
+
selectable={false}
|
|
330
|
+
>
|
|
331
|
+
{props.label}
|
|
332
|
+
</text>
|
|
333
|
+
)}
|
|
334
|
+
</box>
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const DropdownItem: (props: DropdownItemProps) => any = (props) => {
|
|
339
|
+
const context = useContext(DropdownContext)
|
|
340
|
+
if (!context) return null
|
|
341
|
+
|
|
342
|
+
const { searchText, filtering, currentSection, selectedIndex, currentValue } =
|
|
343
|
+
context
|
|
344
|
+
|
|
345
|
+
// Apply filtering logic
|
|
346
|
+
const shouldHide = (() => {
|
|
347
|
+
if (!filtering || !searchText.trim()) return false
|
|
348
|
+
const needle = searchText.toLowerCase().trim()
|
|
349
|
+
const searchableText = [props.title, ...(props.keywords || [])]
|
|
350
|
+
.filter(Boolean)
|
|
351
|
+
.join(' ')
|
|
352
|
+
.toLowerCase()
|
|
353
|
+
return !searchableText.includes(needle)
|
|
354
|
+
})()
|
|
355
|
+
|
|
356
|
+
// Register as descendant
|
|
357
|
+
const { index } = useDropdownItemDescendant({
|
|
358
|
+
value: props.value,
|
|
359
|
+
title: props.title,
|
|
360
|
+
hidden: shouldHide,
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
// Don't render if hidden
|
|
364
|
+
if (shouldHide) return null
|
|
365
|
+
|
|
366
|
+
// Determine if active (index will be -1 if hidden)
|
|
367
|
+
const isActive = index === selectedIndex && index !== -1
|
|
368
|
+
const isCurrent = props.value === currentValue
|
|
369
|
+
|
|
370
|
+
// Handle mouse events
|
|
371
|
+
const handleMouseMove = () => {
|
|
372
|
+
// Update selected index on hover
|
|
373
|
+
if (
|
|
374
|
+
context.setSelectedIndex &&
|
|
375
|
+
context.selectedIndex !== index &&
|
|
376
|
+
index !== -1
|
|
377
|
+
) {
|
|
378
|
+
context.setSelectedIndex(index)
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const handleMouseDown = () => {
|
|
383
|
+
// Trigger selection on click
|
|
384
|
+
if (context.onChange && props.value) {
|
|
385
|
+
context.onChange(props.value)
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Render the item directly
|
|
390
|
+
return (
|
|
391
|
+
<ItemOption
|
|
392
|
+
title={props.title}
|
|
393
|
+
icon={props.icon}
|
|
394
|
+
active={isActive}
|
|
395
|
+
current={isCurrent}
|
|
396
|
+
label={props.label}
|
|
397
|
+
onMouseMove={handleMouseMove}
|
|
398
|
+
onMouseDown={handleMouseDown}
|
|
399
|
+
/>
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const DropdownSection: (props: DropdownSectionProps) => any = (props) => {
|
|
404
|
+
const parentContext = useContext(DropdownContext)
|
|
405
|
+
if (!parentContext) return null
|
|
406
|
+
|
|
407
|
+
// Create new context with section title
|
|
408
|
+
const sectionContextValue = useMemo(
|
|
409
|
+
() => ({
|
|
410
|
+
...parentContext,
|
|
411
|
+
currentSection: props.title,
|
|
412
|
+
}),
|
|
413
|
+
[parentContext, props.title],
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
return (
|
|
417
|
+
<>
|
|
418
|
+
{/* Render section title if provided */}
|
|
419
|
+
{props.title && (
|
|
420
|
+
<box style={{ paddingTop: 1, paddingLeft: 1 }}>
|
|
421
|
+
<text fg={Theme.accent} attributes={TextAttributes.BOLD}>
|
|
422
|
+
{props.title}
|
|
423
|
+
</text>
|
|
424
|
+
</box>
|
|
425
|
+
)}
|
|
426
|
+
{/* Render children with section context */}
|
|
427
|
+
<DropdownContext.Provider value={sectionContextValue}>
|
|
428
|
+
{props.children}
|
|
429
|
+
</DropdownContext.Provider>
|
|
430
|
+
</>
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
Dropdown.Item = DropdownItem
|
|
435
|
+
Dropdown.Section = DropdownSection
|
|
436
|
+
|
|
437
|
+
export default Dropdown
|
|
438
|
+
export { Dropdown }
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { Form, showToast, Toast, ActionPanel, Action } from 'termcast'
|
|
5
|
+
import { LocalStorage } from 'termcast/src/apis/localstorage'
|
|
6
|
+
import { useNavigation } from 'termcast/src/internal/navigation'
|
|
7
|
+
import { logger } from 'termcast/src/logger'
|
|
8
|
+
import { getStoreDirectory } from 'termcast/src/utils'
|
|
9
|
+
import type { RaycastPackageJson } from 'termcast/src/package-json'
|
|
10
|
+
|
|
11
|
+
interface ExtensionPreferencesProps {
|
|
12
|
+
extensionName: string
|
|
13
|
+
commandName?: string
|
|
14
|
+
onSubmit?: (values: Record<string, any>) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface PreferenceManifest {
|
|
18
|
+
name: string
|
|
19
|
+
type:
|
|
20
|
+
| 'textfield'
|
|
21
|
+
| 'password'
|
|
22
|
+
| 'checkbox'
|
|
23
|
+
| 'dropdown'
|
|
24
|
+
| 'file'
|
|
25
|
+
| 'directory'
|
|
26
|
+
| 'appPicker'
|
|
27
|
+
title: string
|
|
28
|
+
description?: string
|
|
29
|
+
required?: boolean
|
|
30
|
+
placeholder?: string
|
|
31
|
+
default?: any
|
|
32
|
+
data?: Array<{ title: string; value: string }> // For dropdown
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function ExtensionPreferences({
|
|
36
|
+
extensionName,
|
|
37
|
+
commandName,
|
|
38
|
+
onSubmit,
|
|
39
|
+
}: ExtensionPreferencesProps): any {
|
|
40
|
+
const [preferences, setPreferences] = useState<PreferenceManifest[]>([])
|
|
41
|
+
const [savedValues, setSavedValues] = useState<Record<string, any>>({})
|
|
42
|
+
const [isLoading, setIsLoading] = useState(true)
|
|
43
|
+
const { pop } = useNavigation()
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const loadPreferences = async () => {
|
|
47
|
+
try {
|
|
48
|
+
// Get extension package.json to read preference manifest
|
|
49
|
+
const storeDir = getStoreDirectory()
|
|
50
|
+
const extensionDir = path.join(storeDir, extensionName)
|
|
51
|
+
const packageJsonPath = path.join(extensionDir, 'package.json')
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
54
|
+
throw new Error(`Extension ${extensionName} not found`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const packageJson: RaycastPackageJson = JSON.parse(
|
|
58
|
+
fs.readFileSync(packageJsonPath, 'utf-8'),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
// Get preferences based on whether this is for a command or extension
|
|
62
|
+
let prefsToUse: PreferenceManifest[] = []
|
|
63
|
+
|
|
64
|
+
if (commandName) {
|
|
65
|
+
// Look for command-specific preferences
|
|
66
|
+
const command = packageJson.commands?.find(
|
|
67
|
+
(cmd) => cmd.name === commandName,
|
|
68
|
+
)
|
|
69
|
+
if (command) {
|
|
70
|
+
prefsToUse = command.preferences || []
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
// Get extension preferences (shared across all commands)
|
|
74
|
+
prefsToUse = packageJson.preferences || []
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Load saved values from LocalStorage
|
|
78
|
+
const preferencesKey = commandName
|
|
79
|
+
? `preferences.${extensionName}.${commandName}`
|
|
80
|
+
: `preferences.${extensionName}`
|
|
81
|
+
const saved = await LocalStorage.getItem(preferencesKey)
|
|
82
|
+
|
|
83
|
+
if (saved && typeof saved === 'string') {
|
|
84
|
+
try {
|
|
85
|
+
const parsed = JSON.parse(saved)
|
|
86
|
+
setSavedValues(parsed)
|
|
87
|
+
} catch (e) {
|
|
88
|
+
logger.error('Failed to parse saved preferences:', e)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
setPreferences(prefsToUse)
|
|
93
|
+
} catch (error) {
|
|
94
|
+
logger.error(`Failed to load preferences for ${extensionName}:`, error)
|
|
95
|
+
await showToast({
|
|
96
|
+
style: Toast.Style.Failure,
|
|
97
|
+
title: 'Failed to load preferences',
|
|
98
|
+
message: String(error),
|
|
99
|
+
})
|
|
100
|
+
} finally {
|
|
101
|
+
setIsLoading(false)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
loadPreferences()
|
|
106
|
+
}, [extensionName])
|
|
107
|
+
|
|
108
|
+
const handleSubmit = async (values: Record<string, any>) => {
|
|
109
|
+
try {
|
|
110
|
+
// Save preferences to LocalStorage
|
|
111
|
+
const preferencesKey = commandName
|
|
112
|
+
? `preferences.${extensionName}.${commandName}`
|
|
113
|
+
: `preferences.${extensionName}`
|
|
114
|
+
await LocalStorage.setItem(preferencesKey, JSON.stringify(values))
|
|
115
|
+
|
|
116
|
+
await showToast({
|
|
117
|
+
style: Toast.Style.Success,
|
|
118
|
+
title: 'Preferences saved',
|
|
119
|
+
message: commandName
|
|
120
|
+
? `Preferences for ${extensionName}/${commandName} have been saved`
|
|
121
|
+
: `Preferences for ${extensionName} have been saved`,
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
if (onSubmit) {
|
|
125
|
+
onSubmit(values)
|
|
126
|
+
} else {
|
|
127
|
+
pop()
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
await showToast({
|
|
131
|
+
style: Toast.Style.Failure,
|
|
132
|
+
title: 'Failed to save preferences',
|
|
133
|
+
message: String(error),
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (isLoading) {
|
|
139
|
+
return <Form isLoading />
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (preferences.length === 0) {
|
|
143
|
+
// If no preferences but onSubmit provided, call it immediately
|
|
144
|
+
if (onSubmit) {
|
|
145
|
+
onSubmit({})
|
|
146
|
+
return null
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Form
|
|
151
|
+
actions={
|
|
152
|
+
<ActionPanel>
|
|
153
|
+
<Action.SubmitForm title='Close' onSubmit={() => pop()} />
|
|
154
|
+
</ActionPanel>
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
<Form.Description
|
|
158
|
+
text={
|
|
159
|
+
commandName
|
|
160
|
+
? `No preferences available for ${extensionName}/${commandName}`
|
|
161
|
+
: `No preferences available for ${extensionName}`
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
</Form>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Form
|
|
170
|
+
actions={
|
|
171
|
+
<ActionPanel>
|
|
172
|
+
<Action.SubmitForm title='Save Preferences' onSubmit={handleSubmit} />
|
|
173
|
+
</ActionPanel>
|
|
174
|
+
}
|
|
175
|
+
navigationTitle={
|
|
176
|
+
commandName
|
|
177
|
+
? `${extensionName}/${commandName} Preferences`
|
|
178
|
+
: `${extensionName} Preferences`
|
|
179
|
+
}
|
|
180
|
+
>
|
|
181
|
+
{preferences.map((pref) => {
|
|
182
|
+
const defaultValue = savedValues[pref.name] ?? pref.default
|
|
183
|
+
|
|
184
|
+
switch (pref.type) {
|
|
185
|
+
case 'textfield':
|
|
186
|
+
return (
|
|
187
|
+
<Form.TextField
|
|
188
|
+
key={pref.name}
|
|
189
|
+
id={pref.name}
|
|
190
|
+
title={pref.title}
|
|
191
|
+
placeholder={pref.placeholder}
|
|
192
|
+
defaultValue={defaultValue}
|
|
193
|
+
info={pref.description}
|
|
194
|
+
storeValue
|
|
195
|
+
/>
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
case 'password':
|
|
199
|
+
return (
|
|
200
|
+
<Form.PasswordField
|
|
201
|
+
key={pref.name}
|
|
202
|
+
id={pref.name}
|
|
203
|
+
title={pref.title}
|
|
204
|
+
placeholder={pref.placeholder}
|
|
205
|
+
defaultValue={defaultValue}
|
|
206
|
+
info={pref.description}
|
|
207
|
+
storeValue
|
|
208
|
+
/>
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
case 'checkbox':
|
|
212
|
+
return (
|
|
213
|
+
<Form.Checkbox
|
|
214
|
+
key={pref.name}
|
|
215
|
+
id={pref.name}
|
|
216
|
+
label={pref.title}
|
|
217
|
+
defaultValue={defaultValue}
|
|
218
|
+
info={pref.description}
|
|
219
|
+
storeValue
|
|
220
|
+
/>
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
case 'dropdown':
|
|
224
|
+
return (
|
|
225
|
+
<Form.Dropdown
|
|
226
|
+
id={pref.name}
|
|
227
|
+
title={pref.title}
|
|
228
|
+
defaultValue={defaultValue}
|
|
229
|
+
info={pref.description}
|
|
230
|
+
storeValue
|
|
231
|
+
>
|
|
232
|
+
{pref.data?.map((item) => (
|
|
233
|
+
<Form.Dropdown.Item value={item.value} title={item.title} />
|
|
234
|
+
))}
|
|
235
|
+
</Form.Dropdown>
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
// TODO: Implement file and directory pickers and appPicker
|
|
239
|
+
case 'file':
|
|
240
|
+
case 'directory':
|
|
241
|
+
case 'appPicker':
|
|
242
|
+
return (
|
|
243
|
+
<Form.TextField
|
|
244
|
+
key={pref.name}
|
|
245
|
+
id={pref.name}
|
|
246
|
+
title={pref.title}
|
|
247
|
+
placeholder={
|
|
248
|
+
pref.type === 'file'
|
|
249
|
+
? 'Enter file path'
|
|
250
|
+
: pref.type === 'directory'
|
|
251
|
+
? 'Enter directory path'
|
|
252
|
+
: 'Enter application name'
|
|
253
|
+
}
|
|
254
|
+
defaultValue={defaultValue}
|
|
255
|
+
info={
|
|
256
|
+
pref.description ||
|
|
257
|
+
`Select a ${pref.type.replace('appPicker', 'application')}`
|
|
258
|
+
}
|
|
259
|
+
storeValue
|
|
260
|
+
/>
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
default:
|
|
264
|
+
return null
|
|
265
|
+
}
|
|
266
|
+
})}
|
|
267
|
+
</Form>
|
|
268
|
+
)
|
|
269
|
+
}
|