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,667 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useRef, useMemo, useLayoutEffect, createContext, useContext, } from 'react';
|
|
3
|
+
import { TextAttributes } from '@opentui/core';
|
|
4
|
+
import { useKeyboard } from '@opentui/react';
|
|
5
|
+
import { Theme } from '@termcast/cli/src/theme';
|
|
6
|
+
import { useIsInFocus } from '@termcast/cli/src/internal/focus-context';
|
|
7
|
+
import { useStore } from '@termcast/cli/src/state';
|
|
8
|
+
import { useDialog } from '@termcast/cli/src/internal/dialog';
|
|
9
|
+
import { createDescendants } from '@termcast/cli/src/descendants';
|
|
10
|
+
import { LoadingBar } from '@termcast/cli/src/components/loading-bar';
|
|
11
|
+
import { useNavigationPending } from '@termcast/cli/src/internal/navigation';
|
|
12
|
+
function ListFooter() {
|
|
13
|
+
const toast = useStore((state) => state.toast);
|
|
14
|
+
if (toast) {
|
|
15
|
+
return (_jsx("box", { border: false, style: {
|
|
16
|
+
paddingLeft: 1,
|
|
17
|
+
paddingRight: 1,
|
|
18
|
+
paddingTop: 1,
|
|
19
|
+
marginTop: 1,
|
|
20
|
+
}, children: toast }));
|
|
21
|
+
}
|
|
22
|
+
return (_jsxs("box", { border: false, style: {
|
|
23
|
+
paddingLeft: 1,
|
|
24
|
+
paddingRight: 1,
|
|
25
|
+
paddingTop: 1,
|
|
26
|
+
marginTop: 1,
|
|
27
|
+
flexDirection: 'row',
|
|
28
|
+
}, children: [_jsx("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: "\u21B5" }), _jsx("text", { fg: Theme.textMuted, children: " select" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "\u2191\u2193"] }), _jsx("text", { fg: Theme.textMuted, children: " navigate" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "^k"] }), _jsx("text", { fg: Theme.textMuted, children: " actions" })] }));
|
|
29
|
+
}
|
|
30
|
+
const ListContext = createContext(undefined);
|
|
31
|
+
// Helper function to determine if an item should be visible based on search
|
|
32
|
+
function shouldItemBeVisible(searchQuery, props) {
|
|
33
|
+
// If no search query, show all items
|
|
34
|
+
if (!searchQuery.trim())
|
|
35
|
+
return true;
|
|
36
|
+
const needle = searchQuery.toLowerCase().trim();
|
|
37
|
+
const searchableText = [
|
|
38
|
+
props.title,
|
|
39
|
+
props.subtitle,
|
|
40
|
+
...(props.keywords || []),
|
|
41
|
+
]
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.join(' ')
|
|
44
|
+
.toLowerCase();
|
|
45
|
+
return searchableText.includes(needle);
|
|
46
|
+
}
|
|
47
|
+
const { DescendantsProvider: ListDescendantsProvider, useDescendants: useListDescendants, useDescendant: useListItemDescendant, } = createDescendants();
|
|
48
|
+
const { DescendantsProvider: DropdownDescendantsProvider, useDescendants: useDropdownDescendants, useDescendant: useDropdownItemDescendant, } = createDescendants();
|
|
49
|
+
const DropdownContext = createContext(undefined);
|
|
50
|
+
function ListDropdownDialog(props) {
|
|
51
|
+
const [searchText, setSearchTextRaw] = useState('');
|
|
52
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
53
|
+
const inputRef = useRef(null);
|
|
54
|
+
const descendantsContext = useDropdownDescendants();
|
|
55
|
+
// Wrapper function that updates search text
|
|
56
|
+
const setSearchText = (value) => {
|
|
57
|
+
setSearchTextRaw(value);
|
|
58
|
+
setSelectedIndex(0); // Reset selection when search changes
|
|
59
|
+
};
|
|
60
|
+
const move = (direction) => {
|
|
61
|
+
// Get all visible items
|
|
62
|
+
const items = Object.values(descendantsContext.map.current)
|
|
63
|
+
.filter((item) => item.index !== -1 && item.props?.visible !== false)
|
|
64
|
+
.sort((a, b) => a.index - b.index);
|
|
65
|
+
if (items.length === 0)
|
|
66
|
+
return;
|
|
67
|
+
// Find currently selected item's position in visible items
|
|
68
|
+
let currentVisibleIndex = items.findIndex((item) => item.index === selectedIndex);
|
|
69
|
+
if (currentVisibleIndex === -1) {
|
|
70
|
+
// If current selection is not visible, select first visible item
|
|
71
|
+
if (items[0]) {
|
|
72
|
+
setSelectedIndex(items[0].index);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Calculate next visible index
|
|
77
|
+
let nextVisibleIndex = currentVisibleIndex + direction;
|
|
78
|
+
if (nextVisibleIndex < 0)
|
|
79
|
+
nextVisibleIndex = items.length - 1;
|
|
80
|
+
if (nextVisibleIndex >= items.length)
|
|
81
|
+
nextVisibleIndex = 0;
|
|
82
|
+
const nextItem = items[nextVisibleIndex];
|
|
83
|
+
if (nextItem) {
|
|
84
|
+
setSelectedIndex(nextItem.index);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const inFocus = useIsInFocus();
|
|
88
|
+
useKeyboard((evt) => {
|
|
89
|
+
if (!inFocus)
|
|
90
|
+
return;
|
|
91
|
+
if (evt.name === 'escape') {
|
|
92
|
+
props.onCancel();
|
|
93
|
+
}
|
|
94
|
+
if (evt.name === 'up')
|
|
95
|
+
move(-1);
|
|
96
|
+
if (evt.name === 'down')
|
|
97
|
+
move(1);
|
|
98
|
+
if (evt.name === 'return') {
|
|
99
|
+
const items = Object.values(descendantsContext.map.current)
|
|
100
|
+
.filter((item) => item.index !== -1)
|
|
101
|
+
.sort((a, b) => a.index - b.index);
|
|
102
|
+
const currentItem = items.find((item) => item.index === selectedIndex);
|
|
103
|
+
if (currentItem?.props) {
|
|
104
|
+
props.onChange?.(currentItem.props.value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return (_jsx(DropdownDescendantsProvider, { value: descendantsContext, children: _jsxs("box", { children: [_jsxs("box", { style: { paddingLeft: 2, paddingRight: 2 }, children: [_jsxs("box", { style: { paddingLeft: 1, paddingRight: 1 }, children: [_jsxs("box", { style: {
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
justifyContent: 'space-between',
|
|
111
|
+
}, children: [_jsx("text", { attributes: TextAttributes.BOLD, children: props.tooltip }), _jsx("text", { fg: Theme.textMuted, children: "esc" })] }), _jsx("box", { style: { paddingTop: 1, paddingBottom: 1 }, children: _jsx("input", { ref: inputRef, onInput: setSearchText, placeholder: props.placeholder || 'Search...', focused: inFocus, value: searchText, focusedBackgroundColor: Theme.backgroundPanel, cursorColor: Theme.primary, focusedTextColor: Theme.textMuted }) })] }), _jsx("box", { style: { paddingBottom: 1 }, children: _jsx(DropdownContext.Provider, { value: {
|
|
112
|
+
currentSection: undefined,
|
|
113
|
+
selectedIndex,
|
|
114
|
+
setSelectedIndex,
|
|
115
|
+
currentValue: props.value,
|
|
116
|
+
searchText,
|
|
117
|
+
isFiltering: true, // Dropdown always has filtering enabled
|
|
118
|
+
onChange: (value) => {
|
|
119
|
+
props.onChange?.(value);
|
|
120
|
+
},
|
|
121
|
+
}, children: props.children }) }), props.isLoading && (_jsx("box", { style: { paddingLeft: 1 }, children: _jsx("text", { fg: Theme.textMuted, children: "Loading..." }) }))] }), _jsxs("box", { border: false, style: {
|
|
122
|
+
paddingRight: 2,
|
|
123
|
+
paddingLeft: 3,
|
|
124
|
+
paddingBottom: 1,
|
|
125
|
+
paddingTop: 1,
|
|
126
|
+
flexDirection: 'row',
|
|
127
|
+
}, children: [_jsx("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: "\u21B5" }), _jsx("text", { fg: Theme.textMuted, children: " select" }), _jsxs("text", { fg: Theme.text, attributes: TextAttributes.BOLD, children: [' ', "\u2191\u2193"] }), _jsx("text", { fg: Theme.textMuted, children: " navigate" })] })] }) }));
|
|
128
|
+
}
|
|
129
|
+
// Render a single list item row
|
|
130
|
+
function ListItemRow(props) {
|
|
131
|
+
const { title, subtitle, accessories, active } = props;
|
|
132
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
133
|
+
// Format accessories for display
|
|
134
|
+
const accessoryElements = [];
|
|
135
|
+
if (accessories) {
|
|
136
|
+
accessories.forEach((accessory) => {
|
|
137
|
+
if ('text' in accessory && accessory.text) {
|
|
138
|
+
const textValue = typeof accessory.text === 'string'
|
|
139
|
+
? accessory.text
|
|
140
|
+
: accessory.text?.value;
|
|
141
|
+
if (textValue) {
|
|
142
|
+
accessoryElements.push(_jsx("text", { fg: active ? Theme.background : Theme.info, children: textValue }, `text-${textValue}`));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if ('tag' in accessory && accessory.tag) {
|
|
146
|
+
const tagValue = typeof accessory.tag === 'string'
|
|
147
|
+
? accessory.tag
|
|
148
|
+
: accessory.tag?.value;
|
|
149
|
+
if (tagValue) {
|
|
150
|
+
accessoryElements.push(_jsxs("text", { fg: active ? Theme.background : Theme.warning, children: ["[", tagValue, "]"] }, `tag-${tagValue}`));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return (_jsxs("box", { style: {
|
|
156
|
+
flexDirection: 'row',
|
|
157
|
+
justifyContent: 'space-between',
|
|
158
|
+
backgroundColor: active
|
|
159
|
+
? Theme.primary
|
|
160
|
+
: isHovered
|
|
161
|
+
? Theme.backgroundPanel
|
|
162
|
+
: undefined,
|
|
163
|
+
paddingLeft: active ? 0 : 1,
|
|
164
|
+
paddingRight: 1,
|
|
165
|
+
}, border: false, onMouseMove: () => setIsHovered(true), onMouseOut: () => setIsHovered(false), onMouseDown: props.onMouseDown, children: [_jsxs("box", { style: { flexDirection: 'row', flexGrow: 1, flexShrink: 1 }, children: [active && (_jsx("text", { fg: Theme.textMuted, selectable: false, children: "\u203A" })), _jsx("text", { fg: active ? Theme.background : Theme.text, attributes: active ? TextAttributes.BOLD : undefined, selectable: false, children: title }), subtitle && (_jsxs("text", { fg: active ? Theme.background : Theme.textMuted, selectable: false, children: [' ', subtitle] }))] }), accessoryElements.length > 0 && (_jsx("box", { style: { flexDirection: 'row' }, children: accessoryElements.map((elem, i) => (_jsxs("box", { style: { flexDirection: 'row' }, children: [i > 0 && _jsx("text", { children: " " }), elem] }, i))) }))] }));
|
|
166
|
+
}
|
|
167
|
+
export const List = (props) => {
|
|
168
|
+
const { children, onSelectionChange, filtering = true, searchText: controlledSearchText, onSearchTextChange, searchBarPlaceholder = 'Search...', isLoading, navigationTitle, isShowingDetail, selectedItemId, searchBarAccessory, ...otherProps } = props;
|
|
169
|
+
const [internalSearchText, setInternalSearchTextRaw] = useState('');
|
|
170
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
171
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
172
|
+
const [currentDetail, setCurrentDetail] = useState(null);
|
|
173
|
+
const inputRef = useRef(null);
|
|
174
|
+
const descendantsContext = useListDescendants();
|
|
175
|
+
const navigationPending = useNavigationPending();
|
|
176
|
+
const searchText = controlledSearchText !== undefined
|
|
177
|
+
? controlledSearchText
|
|
178
|
+
: internalSearchText;
|
|
179
|
+
// Determine if filtering is enabled
|
|
180
|
+
// List filters automatically when:
|
|
181
|
+
// - filtering is not specified (defaults to true) OR filtering is explicitly true
|
|
182
|
+
// List does NOT filter automatically when:
|
|
183
|
+
// - When filtering={false}
|
|
184
|
+
// - When onSearchTextChange is provided (implicitly sets filtering to false)
|
|
185
|
+
// - Unless you explicitly set filtering={true} alongside onSearchTextChange
|
|
186
|
+
const isFilteringEnabled = (() => {
|
|
187
|
+
if (filtering === false)
|
|
188
|
+
return false;
|
|
189
|
+
if (filtering === true)
|
|
190
|
+
return true;
|
|
191
|
+
// filtering is undefined/not specified
|
|
192
|
+
return !onSearchTextChange; // defaults to true unless onSearchTextChange is provided
|
|
193
|
+
})();
|
|
194
|
+
const openDropdown = () => {
|
|
195
|
+
setIsDropdownOpen(true);
|
|
196
|
+
};
|
|
197
|
+
// Wrapper function that updates search text
|
|
198
|
+
const setInternalSearchText = (value) => {
|
|
199
|
+
setInternalSearchTextRaw(value);
|
|
200
|
+
// Reset to 0 when search changes - this is expected UX behavior
|
|
201
|
+
setSelectedIndex(0);
|
|
202
|
+
};
|
|
203
|
+
const listContextValue = useMemo(() => ({
|
|
204
|
+
isDropdownOpen,
|
|
205
|
+
setIsDropdownOpen,
|
|
206
|
+
openDropdown,
|
|
207
|
+
selectedIndex,
|
|
208
|
+
setSelectedIndex,
|
|
209
|
+
searchText,
|
|
210
|
+
isFiltering: isFilteringEnabled,
|
|
211
|
+
setCurrentDetail,
|
|
212
|
+
isShowingDetail,
|
|
213
|
+
}), [isDropdownOpen, selectedIndex, searchText, isFilteringEnabled, isShowingDetail]);
|
|
214
|
+
// Clear detail when detail view is hidden
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (!isShowingDetail) {
|
|
217
|
+
setCurrentDetail(null);
|
|
218
|
+
}
|
|
219
|
+
}, [isShowingDetail]);
|
|
220
|
+
// Handle selectedItemId prop changes
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
// Only update selection if selectedItemId is explicitly provided
|
|
223
|
+
if (selectedItemId !== undefined) {
|
|
224
|
+
const items = Object.values(descendantsContext.map.current)
|
|
225
|
+
.filter((item) => item.index !== -1)
|
|
226
|
+
.sort((a, b) => a.index - b.index);
|
|
227
|
+
const index = items.findIndex((item) => item.props?.id === selectedItemId);
|
|
228
|
+
if (index !== -1) {
|
|
229
|
+
setSelectedIndex(index);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}, [selectedItemId]);
|
|
233
|
+
const move = (direction) => {
|
|
234
|
+
// Get all visible items
|
|
235
|
+
const items = Object.values(descendantsContext.map.current)
|
|
236
|
+
.filter((item) => item.index !== -1 && item.props?.visible !== false)
|
|
237
|
+
.sort((a, b) => a.index - b.index);
|
|
238
|
+
if (items.length === 0)
|
|
239
|
+
return;
|
|
240
|
+
// Find currently selected item's position in visible items
|
|
241
|
+
let currentVisibleIndex = items.findIndex((item) => item.index === selectedIndex);
|
|
242
|
+
if (currentVisibleIndex === -1) {
|
|
243
|
+
// If current selection is not visible, select first visible item
|
|
244
|
+
if (items[0]) {
|
|
245
|
+
setSelectedIndex(items[0].index);
|
|
246
|
+
}
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
// Calculate next visible index
|
|
250
|
+
let nextVisibleIndex = currentVisibleIndex + direction;
|
|
251
|
+
if (nextVisibleIndex < 0)
|
|
252
|
+
nextVisibleIndex = items.length - 1;
|
|
253
|
+
if (nextVisibleIndex >= items.length)
|
|
254
|
+
nextVisibleIndex = 0;
|
|
255
|
+
const nextItem = items[nextVisibleIndex];
|
|
256
|
+
if (nextItem) {
|
|
257
|
+
setSelectedIndex(nextItem.index);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
// Handle keyboard navigation
|
|
261
|
+
const inFocus = useIsInFocus();
|
|
262
|
+
const dialog = useDialog();
|
|
263
|
+
useKeyboard((evt) => {
|
|
264
|
+
if (!inFocus)
|
|
265
|
+
return;
|
|
266
|
+
// Handle Ctrl+P for dropdown
|
|
267
|
+
if (evt.ctrl && evt.name === 'p' && searchBarAccessory && !isDropdownOpen) {
|
|
268
|
+
openDropdown();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// Handle Ctrl+K to show actions
|
|
272
|
+
if (evt.name === 'k' && evt.ctrl) {
|
|
273
|
+
const items = Object.values(descendantsContext.map.current)
|
|
274
|
+
.filter((item) => item.index !== -1)
|
|
275
|
+
.sort((a, b) => a.index - b.index);
|
|
276
|
+
const currentItem = items.find((item) => item.index === selectedIndex);
|
|
277
|
+
// Show current item's actions if available
|
|
278
|
+
if (currentItem?.props?.actions) {
|
|
279
|
+
dialog.push(currentItem.props.actions, 'bottom-right');
|
|
280
|
+
}
|
|
281
|
+
// Otherwise show List's own actions
|
|
282
|
+
else if (props.actions) {
|
|
283
|
+
dialog.push(props.actions, 'bottom-right');
|
|
284
|
+
}
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (evt.name === 'up')
|
|
288
|
+
move(-1);
|
|
289
|
+
if (evt.name === 'down')
|
|
290
|
+
move(1);
|
|
291
|
+
if (evt.name === 'return') {
|
|
292
|
+
const items = Object.values(descendantsContext.map.current)
|
|
293
|
+
.filter((item) => item.index !== -1)
|
|
294
|
+
.sort((a, b) => a.index - b.index);
|
|
295
|
+
const currentItem = items.find((item) => item.index === selectedIndex);
|
|
296
|
+
if (!currentItem?.props)
|
|
297
|
+
return;
|
|
298
|
+
if (currentItem.props.actions) {
|
|
299
|
+
dialog.push(currentItem.props.actions, 'bottom-right');
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
const handleSearchChange = (newValue) => {
|
|
304
|
+
if (!inFocus)
|
|
305
|
+
return;
|
|
306
|
+
// Always call onSearchTextChange if provided
|
|
307
|
+
if (onSearchTextChange) {
|
|
308
|
+
onSearchTextChange(newValue);
|
|
309
|
+
}
|
|
310
|
+
if (controlledSearchText === undefined) {
|
|
311
|
+
setInternalSearchText(newValue);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
return (_jsx(ListContext.Provider, { value: listContextValue, children: _jsx(ListDescendantsProvider, { value: descendantsContext, children: _jsxs("box", { style: { flexDirection: 'column', flexGrow: 1 }, children: [navigationTitle && (_jsx("box", { border: false, style: {
|
|
315
|
+
paddingBottom: 0,
|
|
316
|
+
flexGrow: 1,
|
|
317
|
+
}, children: _jsx(LoadingBar, { title: navigationTitle, isLoading: isLoading || navigationPending }) })), _jsx("box", { children: _jsxs("box", { border: false, style: {
|
|
318
|
+
paddingLeft: 1,
|
|
319
|
+
paddingRight: 1,
|
|
320
|
+
marginTop: 1,
|
|
321
|
+
marginBottom: 1,
|
|
322
|
+
flexDirection: 'row',
|
|
323
|
+
justifyContent: 'space-between',
|
|
324
|
+
alignItems: 'center',
|
|
325
|
+
}, children: [_jsx("box", { style: {
|
|
326
|
+
flexGrow: 1,
|
|
327
|
+
flexDirection: 'column',
|
|
328
|
+
flexShrink: 1,
|
|
329
|
+
}, children: _jsx("input", { ref: inputRef, placeholder: searchBarPlaceholder, focused: inFocus && !isDropdownOpen, value: searchText, onInput: handleSearchChange, focusedBackgroundColor: Theme.backgroundPanel, cursorColor: Theme.primary, focusedTextColor: Theme.text }) }), searchBarAccessory] }) }), _jsxs("box", { style: { flexDirection: 'row', flexGrow: 1 }, children: [_jsx("box", { style: { marginTop: 1, width: isShowingDetail ? '50%' : '100%', flexGrow: isShowingDetail ? 0 : 1 }, children: _jsxs(_Fragment, { children: [_jsx(ListItemsRenderer, { children: children }), _jsx(ListFooter, {})] }) }), isShowingDetail && currentDetail && (_jsx("box", { style: {
|
|
330
|
+
marginTop: 1,
|
|
331
|
+
width: '50%',
|
|
332
|
+
paddingLeft: 1,
|
|
333
|
+
paddingRight: 1,
|
|
334
|
+
}, border: ['left'], borderStyle: 'single', borderColor: Theme.border, children: currentDetail }))] })] }) }) }));
|
|
335
|
+
};
|
|
336
|
+
// Component to render list items and sections
|
|
337
|
+
function ListItemsRenderer(props) {
|
|
338
|
+
const { children } = props;
|
|
339
|
+
const listContext = useContext(ListContext);
|
|
340
|
+
const searchText = listContext?.searchText || '';
|
|
341
|
+
// Pass search text down via context
|
|
342
|
+
return (_jsx(ListSectionContext.Provider, { value: { searchText }, children: children }));
|
|
343
|
+
}
|
|
344
|
+
const ListSectionContext = createContext({});
|
|
345
|
+
const ListItem = (props) => {
|
|
346
|
+
const listSectionContext = useContext(ListSectionContext);
|
|
347
|
+
const { sectionTitle } = listSectionContext;
|
|
348
|
+
const listContext = useContext(ListContext);
|
|
349
|
+
const dialog = useDialog();
|
|
350
|
+
// Extract text values for descendant registration
|
|
351
|
+
const titleText = typeof props.title === 'string' ? props.title : props.title.value;
|
|
352
|
+
const subtitleText = props.subtitle
|
|
353
|
+
? typeof props.subtitle === 'string'
|
|
354
|
+
? props.subtitle
|
|
355
|
+
: props.subtitle.value || ''
|
|
356
|
+
: undefined;
|
|
357
|
+
// Check if this item is visible based on search
|
|
358
|
+
const isFiltering = listContext?.isFiltering ?? false;
|
|
359
|
+
const searchText = listContext?.searchText ?? '';
|
|
360
|
+
const isVisible = !isFiltering ||
|
|
361
|
+
shouldItemBeVisible(searchText, {
|
|
362
|
+
title: titleText,
|
|
363
|
+
subtitle: subtitleText,
|
|
364
|
+
keywords: [...(props.keywords || []), sectionTitle].filter(Boolean),
|
|
365
|
+
});
|
|
366
|
+
// Register as descendant with all searchable data
|
|
367
|
+
const { index } = useListItemDescendant({
|
|
368
|
+
id: props.id,
|
|
369
|
+
title: titleText,
|
|
370
|
+
subtitle: subtitleText,
|
|
371
|
+
keywords: [...(props.keywords || []), sectionTitle].filter(Boolean),
|
|
372
|
+
actions: props.actions,
|
|
373
|
+
visible: isVisible,
|
|
374
|
+
detail: props.detail,
|
|
375
|
+
});
|
|
376
|
+
// Get selected index from parent List context
|
|
377
|
+
const selectedIndex = listContext?.selectedIndex ?? 0;
|
|
378
|
+
const isActive = index === selectedIndex;
|
|
379
|
+
// Update detail when this item becomes active or detail prop changes
|
|
380
|
+
useEffect(() => {
|
|
381
|
+
if (isActive && listContext?.isShowingDetail && listContext?.setCurrentDetail) {
|
|
382
|
+
listContext.setCurrentDetail(props.detail || null);
|
|
383
|
+
}
|
|
384
|
+
}, [isActive, props.detail, listContext?.isShowingDetail, listContext?.setCurrentDetail]);
|
|
385
|
+
// Don't render if not visible
|
|
386
|
+
if (!isVisible)
|
|
387
|
+
return null;
|
|
388
|
+
// Handle mouse click on item
|
|
389
|
+
const handleMouseDown = () => {
|
|
390
|
+
if (listContext && index !== -1) {
|
|
391
|
+
// If clicking on already selected item, show actions (like pressing Enter)
|
|
392
|
+
if (isActive && props.actions) {
|
|
393
|
+
dialog.push(props.actions, 'bottom-right');
|
|
394
|
+
}
|
|
395
|
+
else if (listContext.setSelectedIndex) {
|
|
396
|
+
// Otherwise just select the item
|
|
397
|
+
listContext.setSelectedIndex(index);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
// Don't show accessories if we're showing detail
|
|
402
|
+
const showAccessories = !props.detail && props.accessories;
|
|
403
|
+
// Render the item row directly
|
|
404
|
+
return (_jsx(ListItemRow, { title: titleText, subtitle: subtitleText, accessories: showAccessories ? props.accessories : undefined, active: isActive, isShowingDetail: props.detail !== undefined, onMouseDown: handleMouseDown, index: index }));
|
|
405
|
+
};
|
|
406
|
+
const ListItemDetail = (props) => {
|
|
407
|
+
const { isLoading, markdown, metadata } = props;
|
|
408
|
+
return (_jsxs("box", { style: { flexDirection: 'column', flexGrow: 1 }, children: [isLoading && (_jsx("box", { style: { paddingBottom: 1 }, children: _jsx("text", { fg: Theme.textMuted, children: "Loading..." }) })), markdown && (_jsx("box", { style: { flexGrow: 1, flexShrink: 1, overflow: 'scroll' }, children: _jsx("text", { children: markdown }) })), metadata && (_jsx("box", { style: { paddingTop: 1 }, border: ['top'], borderStyle: 'single', borderColor: Theme.border, children: metadata }))] }));
|
|
409
|
+
};
|
|
410
|
+
const ListItemDetailMetadata = (props) => {
|
|
411
|
+
return (_jsx("box", { style: { flexDirection: 'column' }, children: props.children }));
|
|
412
|
+
};
|
|
413
|
+
const ListItemDetailMetadataLabel = (props) => {
|
|
414
|
+
return (_jsxs("box", { style: { flexDirection: 'row', paddingBottom: 0.5 }, children: [_jsxs("text", { fg: Theme.textMuted, style: { minWidth: 15 }, children: [props.title, ":"] }), props.text && _jsx("text", { fg: Theme.text, children: props.text })] }));
|
|
415
|
+
};
|
|
416
|
+
const ListItemDetailMetadataSeparator = () => {
|
|
417
|
+
return (_jsx("box", { style: { paddingBottom: 0.5 }, children: _jsx("text", { fg: Theme.border, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" }) }));
|
|
418
|
+
};
|
|
419
|
+
const ListItemDetailMetadataLink = (props) => {
|
|
420
|
+
return (_jsxs("box", { style: { flexDirection: 'row', paddingBottom: 0.5 }, children: [_jsxs("text", { fg: Theme.textMuted, style: { minWidth: 15 }, children: [props.title, ":"] }), _jsx("text", { fg: Theme.link, children: props.text })] }));
|
|
421
|
+
};
|
|
422
|
+
const ListItemDetailMetadataTagList = (props) => {
|
|
423
|
+
return (_jsxs("box", { style: { flexDirection: 'column', paddingBottom: 0.5 }, children: [_jsxs("text", { fg: Theme.textMuted, children: [props.title, ":"] }), _jsx("box", { style: { flexDirection: 'row', paddingLeft: 1 }, children: props.children })] }));
|
|
424
|
+
};
|
|
425
|
+
const ListItemDetailMetadataTagListItem = (props) => {
|
|
426
|
+
return (_jsx("box", { style: { paddingRight: 1 }, children: _jsxs("text", { fg: props.color || Theme.accent, children: ["[", props.text, "]"] }) }));
|
|
427
|
+
};
|
|
428
|
+
ListItemDetail.Metadata = ListItemDetailMetadata;
|
|
429
|
+
ListItemDetailMetadata.Label = ListItemDetailMetadataLabel;
|
|
430
|
+
ListItemDetailMetadata.Separator = ListItemDetailMetadataSeparator;
|
|
431
|
+
ListItemDetailMetadata.Link = ListItemDetailMetadataLink;
|
|
432
|
+
ListItemDetailMetadata.TagList = ListItemDetailMetadataTagList;
|
|
433
|
+
ListItemDetailMetadataTagList.Item = ListItemDetailMetadataTagListItem;
|
|
434
|
+
ListItem.Detail = ListItemDetail;
|
|
435
|
+
const ListDropdown = (props) => {
|
|
436
|
+
const listContext = useContext(ListContext);
|
|
437
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
438
|
+
// If not inside a List, just render nothing (for type safety)
|
|
439
|
+
if (!listContext) {
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
const { isDropdownOpen, setIsDropdownOpen } = listContext;
|
|
443
|
+
// Store both value and title together
|
|
444
|
+
const [dropdownState, setDropdownState] = useState(() => {
|
|
445
|
+
const initialValue = props.value || props.defaultValue || '';
|
|
446
|
+
return { value: initialValue, title: initialValue || 'All' };
|
|
447
|
+
});
|
|
448
|
+
const descendantsContext = useDropdownDescendants();
|
|
449
|
+
const dialog = useDialog();
|
|
450
|
+
const inFocus = useIsInFocus();
|
|
451
|
+
// Update value and find its title
|
|
452
|
+
useLayoutEffect(() => {
|
|
453
|
+
const valueToUse = props.value !== undefined ? props.value : dropdownState.value;
|
|
454
|
+
// If no value is set and we have descendants, use the first item
|
|
455
|
+
if (!valueToUse && !props.value && !props.defaultValue) {
|
|
456
|
+
const items = Object.values(descendantsContext.map.current)
|
|
457
|
+
.filter((item) => item.index !== -1)
|
|
458
|
+
.sort((a, b) => a.index - b.index);
|
|
459
|
+
if (items.length > 0) {
|
|
460
|
+
const firstItem = items[0].props;
|
|
461
|
+
setDropdownState({ value: firstItem.value, title: firstItem.title });
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (!valueToUse)
|
|
466
|
+
return;
|
|
467
|
+
// Try to find the title for this value
|
|
468
|
+
let title = valueToUse;
|
|
469
|
+
for (const item of Object.values(descendantsContext.map.current)) {
|
|
470
|
+
const itemProps = item.props;
|
|
471
|
+
if (itemProps.value === valueToUse) {
|
|
472
|
+
title = itemProps.title;
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
// Only update if something changed
|
|
477
|
+
if (dropdownState.value !== valueToUse || dropdownState.title !== title) {
|
|
478
|
+
setDropdownState({ value: valueToUse, title });
|
|
479
|
+
}
|
|
480
|
+
}, [props.value]); // Run when props.value changes and on mount
|
|
481
|
+
const dropdownContextValue = useMemo(() => ({
|
|
482
|
+
currentSection: undefined,
|
|
483
|
+
}), []);
|
|
484
|
+
// Open dropdown dialog when triggered
|
|
485
|
+
useEffect(() => {
|
|
486
|
+
if (isDropdownOpen && !dialog.stack.length) {
|
|
487
|
+
// Pass the children to the dialog to render them there
|
|
488
|
+
dialog.push(_jsx(ListDropdownDialog, { ...props, value: dropdownState.value, onChange: (newValue) => {
|
|
489
|
+
// Find the title for this value
|
|
490
|
+
let title = newValue;
|
|
491
|
+
for (const item of Object.values(descendantsContext.map.current)) {
|
|
492
|
+
const itemProps = item.props;
|
|
493
|
+
if (itemProps.value === newValue) {
|
|
494
|
+
title = itemProps.title;
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
setDropdownState({ value: newValue, title });
|
|
499
|
+
setIsDropdownOpen(false);
|
|
500
|
+
dialog.clear();
|
|
501
|
+
if (props.onChange) {
|
|
502
|
+
props.onChange(newValue);
|
|
503
|
+
}
|
|
504
|
+
// TODO: Handle storeValue to persist the value
|
|
505
|
+
}, onCancel: () => {
|
|
506
|
+
setIsDropdownOpen(false);
|
|
507
|
+
dialog.clear();
|
|
508
|
+
}, children: props.children }), 'top-right');
|
|
509
|
+
}
|
|
510
|
+
}, [isDropdownOpen, props.children]);
|
|
511
|
+
// Display the title from our state
|
|
512
|
+
const displayValue = dropdownState.title || 'All';
|
|
513
|
+
return (_jsx(DropdownDescendantsProvider, { value: descendantsContext, children: _jsxs(DropdownContext.Provider, { value: dropdownContextValue, children: [props.children, _jsxs("box", { style: {
|
|
514
|
+
paddingTop: 1,
|
|
515
|
+
paddingLeft: 2,
|
|
516
|
+
// minWidth: value.length + 4,
|
|
517
|
+
flexDirection: 'row',
|
|
518
|
+
flexShrink: 0,
|
|
519
|
+
backgroundColor: isHovered ? Theme.backgroundPanel : undefined,
|
|
520
|
+
}, onMouseMove: () => setIsHovered(true), onMouseOut: () => setIsHovered(false), onMouseDown: () => {
|
|
521
|
+
// Open dropdown when clicked
|
|
522
|
+
if (!isDropdownOpen) {
|
|
523
|
+
listContext.openDropdown();
|
|
524
|
+
}
|
|
525
|
+
}, children: [_jsx("text", { fg: isHovered ? Theme.text : Theme.textMuted, selectable: false, children: displayValue }), _jsxs("text", { fg: isHovered ? Theme.text : Theme.textMuted, selectable: false, children: [' ', "\u25BE"] })] }, dropdownState.value)] }) }));
|
|
526
|
+
};
|
|
527
|
+
ListDropdown.Item = (props) => {
|
|
528
|
+
const dropdownContext = useContext(DropdownContext);
|
|
529
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
530
|
+
// If not inside a Dropdown, just render nothing
|
|
531
|
+
if (!dropdownContext) {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
const { currentSection, selectedIndex, currentValue, setSelectedIndex, onChange, searchText, isFiltering, } = dropdownContext;
|
|
535
|
+
// Check if this item is visible based on search
|
|
536
|
+
const isVisible = !isFiltering ||
|
|
537
|
+
!searchText ||
|
|
538
|
+
shouldItemBeVisible(searchText, {
|
|
539
|
+
title: props.title,
|
|
540
|
+
keywords: currentSection ? [currentSection] : [],
|
|
541
|
+
});
|
|
542
|
+
// Register as descendant
|
|
543
|
+
const { index } = useDropdownItemDescendant({
|
|
544
|
+
value: props.value,
|
|
545
|
+
title: props.title,
|
|
546
|
+
section: currentSection,
|
|
547
|
+
visible: isVisible,
|
|
548
|
+
});
|
|
549
|
+
// Don't render if not visible
|
|
550
|
+
if (!isVisible)
|
|
551
|
+
return null;
|
|
552
|
+
// If we're in the dialog, render the item
|
|
553
|
+
if (selectedIndex !== undefined) {
|
|
554
|
+
const isActive = selectedIndex === index;
|
|
555
|
+
const isCurrent = props.value === currentValue;
|
|
556
|
+
const handleMouseMove = () => {
|
|
557
|
+
setIsHovered(true);
|
|
558
|
+
// Update selected index on hover
|
|
559
|
+
if (setSelectedIndex && index !== selectedIndex) {
|
|
560
|
+
setSelectedIndex(index);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
const handleMouseDown = () => {
|
|
564
|
+
// Trigger selection on click
|
|
565
|
+
if (onChange) {
|
|
566
|
+
onChange(props.value);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
return (_jsx("box", { style: {
|
|
570
|
+
flexDirection: 'row',
|
|
571
|
+
backgroundColor: isActive
|
|
572
|
+
? Theme.primary
|
|
573
|
+
: isHovered
|
|
574
|
+
? Theme.backgroundPanel
|
|
575
|
+
: undefined,
|
|
576
|
+
paddingLeft: isActive ? 0 : 1,
|
|
577
|
+
paddingRight: 1,
|
|
578
|
+
justifyContent: 'space-between',
|
|
579
|
+
}, border: false, onMouseMove: handleMouseMove, onMouseOut: () => setIsHovered(false), onMouseDown: handleMouseDown, children: _jsxs("box", { style: { flexDirection: 'row' }, children: [isActive && (_jsxs("text", { fg: Theme.background, selectable: false, children: ["\u203A", ''] })), _jsx("text", { fg: isActive
|
|
580
|
+
? Theme.background
|
|
581
|
+
: isCurrent
|
|
582
|
+
? Theme.primary
|
|
583
|
+
: Theme.text, attributes: isActive ? TextAttributes.BOLD : undefined, selectable: false, children: props.title })] }) }));
|
|
584
|
+
}
|
|
585
|
+
return null;
|
|
586
|
+
};
|
|
587
|
+
ListDropdown.Section = (props) => {
|
|
588
|
+
const parentContext = useContext(DropdownContext);
|
|
589
|
+
// If not inside a Dropdown, just render nothing
|
|
590
|
+
if (!parentContext) {
|
|
591
|
+
return null;
|
|
592
|
+
}
|
|
593
|
+
// Create a new context with the section name
|
|
594
|
+
const sectionContextValue = useMemo(() => ({
|
|
595
|
+
...parentContext,
|
|
596
|
+
currentSection: props.title,
|
|
597
|
+
}), [parentContext, props.title]);
|
|
598
|
+
// Hide section title when searching
|
|
599
|
+
const showTitle = parentContext.selectedIndex !== undefined &&
|
|
600
|
+
props.title &&
|
|
601
|
+
!parentContext.searchText?.trim();
|
|
602
|
+
return (_jsxs(_Fragment, { children: [showTitle && (_jsx("box", { style: { paddingTop: 1, paddingLeft: 1 }, children: _jsx("text", { fg: Theme.accent, attributes: TextAttributes.BOLD, children: props.title }) })), _jsx(DropdownContext.Provider, { value: sectionContextValue, children: props.children })] }));
|
|
603
|
+
};
|
|
604
|
+
List.Item = ListItem;
|
|
605
|
+
const ListSection = (props) => {
|
|
606
|
+
const parentContext = useContext(ListSectionContext);
|
|
607
|
+
const listContext = useContext(ListContext);
|
|
608
|
+
const searchText = listContext?.searchText || '';
|
|
609
|
+
// Create new context with section title and search text
|
|
610
|
+
const sectionContextValue = useMemo(() => ({
|
|
611
|
+
...parentContext,
|
|
612
|
+
sectionTitle: props.title,
|
|
613
|
+
searchText,
|
|
614
|
+
}), [parentContext, props.title, searchText]);
|
|
615
|
+
// Hide section title when searching
|
|
616
|
+
const showTitle = props.title && !searchText.trim();
|
|
617
|
+
return (_jsxs(_Fragment, { children: [showTitle && (_jsx("box", { border: false, style: {
|
|
618
|
+
paddingLeft: 1,
|
|
619
|
+
paddingTop: 1,
|
|
620
|
+
}, children: _jsx("text", { fg: Theme.accent, attributes: TextAttributes.BOLD, children: props.title }) })), _jsx(ListSectionContext.Provider, { value: sectionContextValue, children: props.children })] }));
|
|
621
|
+
};
|
|
622
|
+
List.Section = ListSection;
|
|
623
|
+
List.Dropdown = ListDropdown;
|
|
624
|
+
List.EmptyView = (props) => {
|
|
625
|
+
return null;
|
|
626
|
+
};
|
|
627
|
+
export default List;
|
|
628
|
+
// Grid uses List internally with a different visual representation
|
|
629
|
+
export const Grid = (props) => {
|
|
630
|
+
// Grid is essentially List with grid layout
|
|
631
|
+
// We'll reuse the List component but with grid-specific styling
|
|
632
|
+
const { columns = 5, aspectRatio = '1', fit = 'contain', inset, ...listProps } = props;
|
|
633
|
+
return _jsx(List, { ...listProps });
|
|
634
|
+
};
|
|
635
|
+
// Grid.Item maps to List.Item but with content instead of icon
|
|
636
|
+
Grid.Item = (props) => {
|
|
637
|
+
const { content, getDetailMarkdown, ...itemProps } = props;
|
|
638
|
+
// Extract image value and tooltip
|
|
639
|
+
const imageValue = typeof content === 'string' ? content : content?.value;
|
|
640
|
+
const imageTooltip = typeof content === 'object' ? content?.tooltip : undefined;
|
|
641
|
+
// Convert Grid.Item props to List.Item props
|
|
642
|
+
const listItemProps = {
|
|
643
|
+
...itemProps,
|
|
644
|
+
// Grid items don't have accessories in Raycast
|
|
645
|
+
accessories: undefined,
|
|
646
|
+
// Use content as icon for now (in a real implementation, this would be rendered differently)
|
|
647
|
+
icon: imageValue,
|
|
648
|
+
};
|
|
649
|
+
return _jsx(List.Item, { ...listItemProps });
|
|
650
|
+
};
|
|
651
|
+
// Grid.Section maps to List.Section with grid-specific props
|
|
652
|
+
Grid.Section = (props) => {
|
|
653
|
+
const { columns, aspectRatio, fit, inset, ...sectionProps } = props;
|
|
654
|
+
// Pass through to List.Section
|
|
655
|
+
return _jsx(List.Section, { ...sectionProps });
|
|
656
|
+
};
|
|
657
|
+
// Reuse List's Dropdown
|
|
658
|
+
Grid.Dropdown = List.Dropdown;
|
|
659
|
+
// Reuse List's EmptyView
|
|
660
|
+
Grid.EmptyView = List.EmptyView;
|
|
661
|
+
// Grid Inset presets
|
|
662
|
+
Grid.Inset = {
|
|
663
|
+
Small: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
664
|
+
Medium: { top: 8, right: 8, bottom: 8, left: 8 },
|
|
665
|
+
Large: { top: 16, right: 16, bottom: 16, left: 16 },
|
|
666
|
+
};
|
|
667
|
+
//# sourceMappingURL=list.js.map
|