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,200 @@
|
|
|
1
|
+
import type { PathLike } from 'node:fs'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { exec } from 'child_process'
|
|
5
|
+
import { promisify } from 'util'
|
|
6
|
+
import { copyToClipboard, pasteContent } from 'termcast/src/action-utils'
|
|
7
|
+
import { logger } from 'termcast/src/logger'
|
|
8
|
+
|
|
9
|
+
const execAsync = promisify(exec)
|
|
10
|
+
const platform = process.platform
|
|
11
|
+
|
|
12
|
+
async function copyFileToClipboard(filePath: string): Promise<void> {
|
|
13
|
+
const absolutePath = path.resolve(filePath)
|
|
14
|
+
|
|
15
|
+
if (!fs.existsSync(absolutePath)) {
|
|
16
|
+
throw new Error(`File not found: ${absolutePath}`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
if (platform === 'darwin') {
|
|
21
|
+
// macOS: Use osascript to copy file to clipboard
|
|
22
|
+
const script = `osascript -e 'set the clipboard to (POSIX file "${absolutePath}")'`
|
|
23
|
+
await execAsync(script)
|
|
24
|
+
logger.log(`📋 Copied file to clipboard: ${filePath}`)
|
|
25
|
+
} else if (platform === 'linux') {
|
|
26
|
+
// Linux: Copy file path as text and file URI
|
|
27
|
+
const fileUri = `file://${absolutePath}`
|
|
28
|
+
await execAsync(
|
|
29
|
+
`echo '${fileUri}' | xclip -selection clipboard -t text/uri-list`,
|
|
30
|
+
)
|
|
31
|
+
logger.log(`📋 Copied file to clipboard: ${filePath}`)
|
|
32
|
+
} else if (platform === 'win32') {
|
|
33
|
+
// Windows: Use PowerShell to copy file to clipboard
|
|
34
|
+
const script = `powershell -command "Set-Clipboard -Path '${absolutePath}'"`
|
|
35
|
+
await execAsync(script)
|
|
36
|
+
logger.log(`📋 Copied file to clipboard: ${filePath}`)
|
|
37
|
+
} else {
|
|
38
|
+
logger.log(`📋 File copy not supported on ${platform}: ${filePath}`)
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
logger.log(`📋 Failed to copy file to clipboard: ${error}`)
|
|
42
|
+
throw error
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface ClipboardType {
|
|
47
|
+
copy: (
|
|
48
|
+
content: string | number | Clipboard.Content,
|
|
49
|
+
options?: Clipboard.CopyOptions,
|
|
50
|
+
) => Promise<void>
|
|
51
|
+
clear: () => Promise<void>
|
|
52
|
+
paste: (content: string | number | Clipboard.Content) => Promise<void>
|
|
53
|
+
read: (options?: { offset?: number }) => Promise<Clipboard.ReadContent>
|
|
54
|
+
readText: (options?: { offset?: number }) => Promise<string | undefined>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Clipboard: ClipboardType = {
|
|
58
|
+
async copy(
|
|
59
|
+
content: string | number | Clipboard.Content,
|
|
60
|
+
options?: Clipboard.CopyOptions,
|
|
61
|
+
): Promise<void> {
|
|
62
|
+
let textContent: string
|
|
63
|
+
|
|
64
|
+
if (typeof content === 'string' || typeof content === 'number') {
|
|
65
|
+
textContent = String(content)
|
|
66
|
+
} else if ('text' in content) {
|
|
67
|
+
textContent = content.text || ''
|
|
68
|
+
} else if ('file' in content) {
|
|
69
|
+
await copyFileToClipboard(String(content.file))
|
|
70
|
+
return
|
|
71
|
+
} else if ('html' in content) {
|
|
72
|
+
textContent = content.text || content.html
|
|
73
|
+
} else {
|
|
74
|
+
throw new Error('Invalid clipboard content type')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await copyToClipboard(textContent, options?.concealed)
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
async clear(): Promise<void> {
|
|
81
|
+
await copyToClipboard('', false)
|
|
82
|
+
logger.log('📋 Clipboard cleared')
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
async paste(content: string | number | Clipboard.Content): Promise<void> {
|
|
86
|
+
let textContent: string
|
|
87
|
+
|
|
88
|
+
if (typeof content === 'string' || typeof content === 'number') {
|
|
89
|
+
textContent = String(content)
|
|
90
|
+
} else if ('text' in content) {
|
|
91
|
+
textContent = content.text || ''
|
|
92
|
+
} else if ('file' in content) {
|
|
93
|
+
logger.log(`📝 File paste not yet implemented: ${content.file}`)
|
|
94
|
+
return
|
|
95
|
+
} else if ('html' in content) {
|
|
96
|
+
textContent = content.text || content.html
|
|
97
|
+
} else {
|
|
98
|
+
throw new Error('Invalid clipboard content type')
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await pasteContent(textContent)
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
async read(options?: { offset?: number }): Promise<Clipboard.ReadContent> {
|
|
105
|
+
if (options?.offset && options.offset > 0) {
|
|
106
|
+
logger.log('📋 Clipboard history not yet implemented')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
let text = ''
|
|
111
|
+
let file: string | undefined
|
|
112
|
+
|
|
113
|
+
if (platform === 'darwin') {
|
|
114
|
+
// Try to get file first
|
|
115
|
+
try {
|
|
116
|
+
const fileCheckScript = `osascript -e 'try' -e 'get the clipboard as «class furl»' -e 'POSIX path of result' -e 'end try'`
|
|
117
|
+
const { stdout: filePath } = await execAsync(fileCheckScript)
|
|
118
|
+
if (filePath && filePath.trim()) {
|
|
119
|
+
file = filePath.trim()
|
|
120
|
+
}
|
|
121
|
+
} catch {
|
|
122
|
+
// No file in clipboard, try text
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Get text content
|
|
126
|
+
const { stdout } = await execAsync('pbpaste')
|
|
127
|
+
text = stdout
|
|
128
|
+
} else if (platform === 'linux') {
|
|
129
|
+
// Check for file URIs
|
|
130
|
+
try {
|
|
131
|
+
const { stdout: fileUri } = await execAsync(
|
|
132
|
+
'xclip -selection clipboard -t text/uri-list -o',
|
|
133
|
+
)
|
|
134
|
+
if (fileUri && fileUri.startsWith('file://')) {
|
|
135
|
+
file = fileUri.replace('file://', '').trim()
|
|
136
|
+
}
|
|
137
|
+
} catch {
|
|
138
|
+
// No file in clipboard
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Get text content
|
|
142
|
+
try {
|
|
143
|
+
const { stdout } = await execAsync('xclip -selection clipboard -o')
|
|
144
|
+
text = stdout
|
|
145
|
+
} catch {
|
|
146
|
+
// No text in clipboard
|
|
147
|
+
}
|
|
148
|
+
} else if (platform === 'win32') {
|
|
149
|
+
// Windows: Get clipboard content
|
|
150
|
+
const { stdout } = await execAsync(
|
|
151
|
+
'powershell -command "Get-Clipboard"',
|
|
152
|
+
)
|
|
153
|
+
text = stdout
|
|
154
|
+
|
|
155
|
+
// Check if it's a file path
|
|
156
|
+
if (text && fs.existsSync(text.trim())) {
|
|
157
|
+
file = text.trim()
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return { text, file }
|
|
162
|
+
} catch (error) {
|
|
163
|
+
logger.log(`📋 Failed to read clipboard: ${error}`)
|
|
164
|
+
return { text: '' }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
async readText(options?: { offset?: number }): Promise<string | undefined> {
|
|
169
|
+
const content = await this.read(options)
|
|
170
|
+
return content.text || undefined
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export namespace Clipboard {
|
|
175
|
+
export type ReadContent = {
|
|
176
|
+
text: string
|
|
177
|
+
file?: string
|
|
178
|
+
html?: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type Content =
|
|
182
|
+
| {
|
|
183
|
+
text: string
|
|
184
|
+
}
|
|
185
|
+
| {
|
|
186
|
+
file: PathLike
|
|
187
|
+
}
|
|
188
|
+
| {
|
|
189
|
+
html: string
|
|
190
|
+
text?: string
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export type CopyOptions = {
|
|
194
|
+
concealed?: boolean
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export const copyTextToClipboard = Clipboard.copy
|
|
199
|
+
export const clearClipboard = Clipboard.clear
|
|
200
|
+
export const pasteText = Clipboard.paste
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment API - Provides access to environment information and context
|
|
3
|
+
*
|
|
4
|
+
* Raycast Docs: https://developers.raycast.com/api-reference/environment
|
|
5
|
+
*
|
|
6
|
+
* The environment object provides information about the command's runtime context,
|
|
7
|
+
* including theme settings, development mode, launch type, and paths. LaunchType enum
|
|
8
|
+
* indicates whether the command was triggered by user action or background process.
|
|
9
|
+
*
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Access to appearance/theme (dark/light)
|
|
12
|
+
* - Extension and command metadata
|
|
13
|
+
* - Launch context (user-initiated vs background)
|
|
14
|
+
* - Support and assets paths for file storage
|
|
15
|
+
* - System integration (selected Finder items, selected text)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import os from 'node:os'
|
|
19
|
+
import path from 'node:path'
|
|
20
|
+
import fs from 'node:fs'
|
|
21
|
+
import { execSync } from 'node:child_process'
|
|
22
|
+
import { useStore } from '../state'
|
|
23
|
+
|
|
24
|
+
export interface Environment {
|
|
25
|
+
appearance: 'dark' | 'light'
|
|
26
|
+
assetsPath: string
|
|
27
|
+
commandMode: 'view' | 'no-view' | 'menu-bar'
|
|
28
|
+
commandName: string
|
|
29
|
+
extensionName: string
|
|
30
|
+
isDevelopment: boolean
|
|
31
|
+
launchType: LaunchType
|
|
32
|
+
ownerOrAuthorName: string
|
|
33
|
+
raycastVersion: string
|
|
34
|
+
supportPath: string
|
|
35
|
+
textSize: 'medium' | 'large'
|
|
36
|
+
canAccess(api: any): boolean
|
|
37
|
+
theme: 'dark' | 'light'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum LaunchType {
|
|
41
|
+
UserInitiated = 'userInitiated',
|
|
42
|
+
Background = 'background',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface LaunchProps<
|
|
46
|
+
T extends Record<string, any> = Record<string, any>,
|
|
47
|
+
> {
|
|
48
|
+
arguments: T
|
|
49
|
+
fallbackText?: string
|
|
50
|
+
launchContext?: { [key: string]: any }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
class EnvironmentImpl implements Environment {
|
|
54
|
+
constructor() {
|
|
55
|
+
// Bind all methods to this instance
|
|
56
|
+
this.canAccess = this.canAccess.bind(this)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get appearance(): 'dark' | 'light' {
|
|
60
|
+
// Try to detect system theme on macOS
|
|
61
|
+
if (process.platform === 'darwin') {
|
|
62
|
+
try {
|
|
63
|
+
const result = execSync(
|
|
64
|
+
'defaults read -g AppleInterfaceStyle 2>/dev/null',
|
|
65
|
+
{ encoding: 'utf8' },
|
|
66
|
+
)
|
|
67
|
+
return result.includes('Dark') ? 'dark' : 'light'
|
|
68
|
+
} catch {
|
|
69
|
+
return 'light'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return 'light'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get assetsPath(): string {
|
|
76
|
+
const state = useStore.getState()
|
|
77
|
+
if (state.extensionPath) {
|
|
78
|
+
return path.join(state.extensionPath, 'assets')
|
|
79
|
+
}
|
|
80
|
+
// TODO: Fallback for non-dev mode extensions
|
|
81
|
+
return path.join(os.homedir(), '.termcast', 'assets')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get commandMode(): 'view' | 'no-view' | 'menu-bar' {
|
|
85
|
+
const state = useStore.getState()
|
|
86
|
+
if (state.currentCommandName && state.extensionPackageJson?.commands) {
|
|
87
|
+
const command = state.extensionPackageJson.commands.find(
|
|
88
|
+
(cmd) => cmd.name === state.currentCommandName,
|
|
89
|
+
)
|
|
90
|
+
if (command) {
|
|
91
|
+
return command.mode
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return 'view'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
get commandName(): string {
|
|
98
|
+
const state = useStore.getState()
|
|
99
|
+
if (state.currentCommandName) {
|
|
100
|
+
return state.currentCommandName
|
|
101
|
+
}
|
|
102
|
+
return ''
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
get extensionName(): string {
|
|
106
|
+
const state = useStore.getState()
|
|
107
|
+
if (state.extensionPackageJson?.name) {
|
|
108
|
+
return state.extensionPackageJson.name
|
|
109
|
+
}
|
|
110
|
+
if (state.extensionPath) {
|
|
111
|
+
return path.basename(state.extensionPath)
|
|
112
|
+
}
|
|
113
|
+
return ''
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get isDevelopment(): boolean {
|
|
117
|
+
const state = useStore.getState()
|
|
118
|
+
// We're in development mode if devElement is set
|
|
119
|
+
return state.devElement !== null
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
get launchType(): LaunchType {
|
|
123
|
+
// TODO: Support background commands when implemented
|
|
124
|
+
return LaunchType.UserInitiated
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get ownerOrAuthorName(): string {
|
|
128
|
+
const state = useStore.getState()
|
|
129
|
+
const pkg = state.extensionPackageJson
|
|
130
|
+
if (pkg?.author) {
|
|
131
|
+
return pkg.author
|
|
132
|
+
}
|
|
133
|
+
if (pkg?.owner) {
|
|
134
|
+
return pkg.owner
|
|
135
|
+
}
|
|
136
|
+
return ''
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get raycastVersion(): string {
|
|
140
|
+
// Return a version that indicates termcast compatibility
|
|
141
|
+
return '1.0.0-termcast'
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get supportPath(): string {
|
|
145
|
+
// Create a support directory in the user's data directory
|
|
146
|
+
const baseDir = path.join(
|
|
147
|
+
os.homedir(),
|
|
148
|
+
'.termcast',
|
|
149
|
+
'support',
|
|
150
|
+
this.extensionName,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
// Ensure the directory exists
|
|
154
|
+
if (!fs.existsSync(baseDir)) {
|
|
155
|
+
fs.mkdirSync(baseDir, { recursive: true })
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return baseDir
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
get textSize(): 'medium' | 'large' {
|
|
162
|
+
// TODO: Make this configurable via preferences
|
|
163
|
+
return 'medium'
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Alias for appearance to match Raycast API
|
|
167
|
+
get theme(): 'dark' | 'light' {
|
|
168
|
+
return this.appearance
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
canAccess(api: any): boolean {
|
|
172
|
+
// In termcast, all APIs are accessible
|
|
173
|
+
// This method exists for Raycast compatibility
|
|
174
|
+
return true
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const environment = new EnvironmentImpl()
|
|
179
|
+
|
|
180
|
+
export async function getSelectedFinderItems(): Promise<string[]> {
|
|
181
|
+
// TODO: Improve cross-platform support
|
|
182
|
+
// Currently only works on macOS using AppleScript
|
|
183
|
+
// Should add support for:
|
|
184
|
+
// 1. Windows Explorer selection (via PowerShell or COM)
|
|
185
|
+
// 2. Linux file managers (Nautilus, Dolphin, etc.)
|
|
186
|
+
if (process.platform === 'darwin') {
|
|
187
|
+
try {
|
|
188
|
+
// Use AppleScript to get selected Finder items
|
|
189
|
+
const script = `
|
|
190
|
+
tell application "Finder"
|
|
191
|
+
set theSelection to selection
|
|
192
|
+
set thePaths to {}
|
|
193
|
+
repeat with theItem in theSelection
|
|
194
|
+
set end of thePaths to POSIX path of (theItem as alias)
|
|
195
|
+
end repeat
|
|
196
|
+
return thePaths
|
|
197
|
+
end tell
|
|
198
|
+
`
|
|
199
|
+
const result = execSync(`osascript -e '${script}'`, {
|
|
200
|
+
encoding: 'utf8',
|
|
201
|
+
})
|
|
202
|
+
return result.trim().split(', ').filter(Boolean)
|
|
203
|
+
} catch {
|
|
204
|
+
return []
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// TODO: Implement for other platforms
|
|
208
|
+
return []
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export async function getSelectedText(): Promise<string> {
|
|
212
|
+
// TODO: Improve implementation and cross-platform support
|
|
213
|
+
// Current implementation has issues:
|
|
214
|
+
// 1. Modifies the clipboard (should preserve original content)
|
|
215
|
+
// 2. Uses delay which may not be reliable
|
|
216
|
+
// 3. Only works on macOS
|
|
217
|
+
// Should add support for Windows and Linux
|
|
218
|
+
if (process.platform === 'darwin') {
|
|
219
|
+
try {
|
|
220
|
+
// TODO: Save and restore clipboard contents to avoid side effects
|
|
221
|
+
// Use AppleScript to get selected text from frontmost application
|
|
222
|
+
const script = `
|
|
223
|
+
tell application "System Events"
|
|
224
|
+
keystroke "c" using command down
|
|
225
|
+
delay 0.1
|
|
226
|
+
return (the clipboard)
|
|
227
|
+
end tell
|
|
228
|
+
`
|
|
229
|
+
const result = execSync(`osascript -e '${script}'`, {
|
|
230
|
+
encoding: 'utf8',
|
|
231
|
+
})
|
|
232
|
+
return result.trim()
|
|
233
|
+
} catch {
|
|
234
|
+
return ''
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// TODO: Implement for Windows (via PowerShell) and Linux (xclip/xsel)
|
|
238
|
+
return ''
|
|
239
|
+
}
|
package/src/apis/hud.tsx
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { Theme } from 'termcast/src/theme'
|
|
3
|
+
import { TextAttributes } from '@opentui/core'
|
|
4
|
+
import { logger } from 'termcast/src/logger'
|
|
5
|
+
import { useStore } from 'termcast/src/state'
|
|
6
|
+
import { useTerminalDimensions } from '@opentui/react'
|
|
7
|
+
import { Toast } from 'termcast/src/apis/toast'
|
|
8
|
+
import { PopToRootType } from 'termcast/src/apis/window'
|
|
9
|
+
|
|
10
|
+
// Re-export PopToRootType from window module
|
|
11
|
+
export { PopToRootType } from 'termcast/src/apis/window'
|
|
12
|
+
|
|
13
|
+
interface HUDComponentProps {
|
|
14
|
+
title: string
|
|
15
|
+
onHide: () => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function HUDComponent({ title, onHide }: HUDComponentProps): any {
|
|
19
|
+
const dimensions = useTerminalDimensions()
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
// HUD displays for 2 seconds then automatically hides
|
|
23
|
+
const timer = setTimeout(() => {
|
|
24
|
+
onHide()
|
|
25
|
+
}, 2000)
|
|
26
|
+
return () => clearTimeout(timer)
|
|
27
|
+
}, [onHide])
|
|
28
|
+
|
|
29
|
+
// Center the HUD message
|
|
30
|
+
const padding = Math.max(
|
|
31
|
+
0,
|
|
32
|
+
Math.floor((dimensions.width - title.length - 4) / 2),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<box
|
|
37
|
+
borderColor={Theme.border}
|
|
38
|
+
paddingLeft={1}
|
|
39
|
+
paddingRight={1}
|
|
40
|
+
flexDirection='row'
|
|
41
|
+
alignItems='center'
|
|
42
|
+
>
|
|
43
|
+
<text paddingLeft={padding}>✓ </text>
|
|
44
|
+
<text fg={Theme.text} attributes={TextAttributes.BOLD}>
|
|
45
|
+
{title}
|
|
46
|
+
</text>
|
|
47
|
+
</box>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Create a custom Toast class for HUD that displays with HUD styling
|
|
52
|
+
class HUDToast extends Toast {
|
|
53
|
+
constructor(title: string) {
|
|
54
|
+
super({
|
|
55
|
+
title,
|
|
56
|
+
style: Toast.Style.Success,
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function showHUD(
|
|
62
|
+
title: string,
|
|
63
|
+
options?: {
|
|
64
|
+
clearRootSearch?: boolean
|
|
65
|
+
popToRootType?: PopToRootType
|
|
66
|
+
},
|
|
67
|
+
): Promise<void> {
|
|
68
|
+
// Show the HUD component in the toast area (bottom of screen)
|
|
69
|
+
useStore.setState({
|
|
70
|
+
toast: (
|
|
71
|
+
<HUDComponent
|
|
72
|
+
title={title}
|
|
73
|
+
onHide={() => {
|
|
74
|
+
useStore.setState({ toast: null })
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
),
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// TODO: Handle closeMainWindow behavior with clearRootSearch and popToRootType options
|
|
81
|
+
// This would need to be implemented based on the actual window management system
|
|
82
|
+
|
|
83
|
+
logger.log('showHUD:', title, options)
|
|
84
|
+
|
|
85
|
+
return Promise.resolve()
|
|
86
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterAll } from 'bun:test'
|
|
2
|
+
import { LocalStorage } from './localstorage'
|
|
3
|
+
import * as os from 'os'
|
|
4
|
+
import * as path from 'path'
|
|
5
|
+
import * as fs from 'fs'
|
|
6
|
+
|
|
7
|
+
describe('LocalStorage', () => {
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await LocalStorage.clear()
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
afterAll(() => {
|
|
13
|
+
// Optional: Clean up test database after all tests
|
|
14
|
+
// const dbPath = path.join(os.homedir(), '.termcast.db')
|
|
15
|
+
// if (fs.existsSync(dbPath)) {
|
|
16
|
+
// fs.unlinkSync(dbPath)
|
|
17
|
+
// }
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
describe('setItem and getItem', () => {
|
|
21
|
+
test('stores and retrieves string values', async () => {
|
|
22
|
+
await LocalStorage.setItem('test-key', 'test-value')
|
|
23
|
+
const result = await LocalStorage.getItem<string>('test-key')
|
|
24
|
+
expect(result).toBe('test-value')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('stores and retrieves number values', async () => {
|
|
28
|
+
await LocalStorage.setItem('number-key', 42)
|
|
29
|
+
const result = await LocalStorage.getItem<number>('number-key')
|
|
30
|
+
expect(result).toBe(42)
|
|
31
|
+
expect(typeof result).toBe('number')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('stores and retrieves boolean values', async () => {
|
|
35
|
+
await LocalStorage.setItem('bool-key-true', true)
|
|
36
|
+
await LocalStorage.setItem('bool-key-false', false)
|
|
37
|
+
|
|
38
|
+
const resultTrue = await LocalStorage.getItem<boolean>('bool-key-true')
|
|
39
|
+
const resultFalse = await LocalStorage.getItem<boolean>('bool-key-false')
|
|
40
|
+
|
|
41
|
+
expect(resultTrue).toBe(true)
|
|
42
|
+
expect(resultFalse).toBe(false)
|
|
43
|
+
expect(typeof resultTrue).toBe('boolean')
|
|
44
|
+
expect(typeof resultFalse).toBe('boolean')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('returns undefined for non-existent keys', async () => {
|
|
48
|
+
const result = await LocalStorage.getItem('non-existent')
|
|
49
|
+
expect(result).toBeUndefined()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('overwrites existing values', async () => {
|
|
53
|
+
await LocalStorage.setItem('key', 'initial')
|
|
54
|
+
await LocalStorage.setItem('key', 'updated')
|
|
55
|
+
const result = await LocalStorage.getItem('key')
|
|
56
|
+
expect(result).toBe('updated')
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
describe('removeItem', () => {
|
|
61
|
+
test('removes stored items', async () => {
|
|
62
|
+
await LocalStorage.setItem('to-remove', 'value')
|
|
63
|
+
let result = await LocalStorage.getItem('to-remove')
|
|
64
|
+
expect(result).toBe('value')
|
|
65
|
+
|
|
66
|
+
await LocalStorage.removeItem('to-remove')
|
|
67
|
+
result = await LocalStorage.getItem('to-remove')
|
|
68
|
+
expect(result).toBeUndefined()
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('does not throw when removing non-existent key', async () => {
|
|
72
|
+
// Should complete without throwing
|
|
73
|
+
await LocalStorage.removeItem('non-existent')
|
|
74
|
+
expect(true).toBe(true) // Test passes if we reach here
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
describe('allItems', () => {
|
|
79
|
+
test('returns all stored items', async () => {
|
|
80
|
+
await LocalStorage.setItem('key1', 'value1')
|
|
81
|
+
await LocalStorage.setItem('key2', 42)
|
|
82
|
+
await LocalStorage.setItem('key3', true)
|
|
83
|
+
|
|
84
|
+
const items = await LocalStorage.allItems()
|
|
85
|
+
expect(items).toEqual({
|
|
86
|
+
key1: 'value1',
|
|
87
|
+
key2: 42,
|
|
88
|
+
key3: true,
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test('returns empty object when no items stored', async () => {
|
|
93
|
+
const items = await LocalStorage.allItems()
|
|
94
|
+
expect(items).toEqual({})
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
test('supports typed interface', async () => {
|
|
98
|
+
interface TestValues {
|
|
99
|
+
todo: string
|
|
100
|
+
priority: number
|
|
101
|
+
completed: boolean
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
await LocalStorage.setItem('todo', 'Write tests')
|
|
105
|
+
await LocalStorage.setItem('priority', 1)
|
|
106
|
+
await LocalStorage.setItem('completed', false)
|
|
107
|
+
|
|
108
|
+
const items = await LocalStorage.allItems<TestValues>()
|
|
109
|
+
expect(items.todo).toBe('Write tests')
|
|
110
|
+
expect(items.priority).toBe(1)
|
|
111
|
+
expect(items.completed).toBe(false)
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
describe('clear', () => {
|
|
116
|
+
test('removes all stored items', async () => {
|
|
117
|
+
await LocalStorage.setItem('key1', 'value1')
|
|
118
|
+
await LocalStorage.setItem('key2', 'value2')
|
|
119
|
+
await LocalStorage.setItem('key3', 'value3')
|
|
120
|
+
|
|
121
|
+
let items = await LocalStorage.allItems()
|
|
122
|
+
expect(Object.keys(items).length).toBe(3)
|
|
123
|
+
|
|
124
|
+
await LocalStorage.clear()
|
|
125
|
+
items = await LocalStorage.allItems()
|
|
126
|
+
expect(items).toEqual({})
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
describe('edge cases', () => {
|
|
131
|
+
test('handles special characters in keys', async () => {
|
|
132
|
+
const specialKey = 'key-with-!@#$%^&*()_+={}[]|\\:";\'<>?,./spaces'
|
|
133
|
+
await LocalStorage.setItem(specialKey, 'special')
|
|
134
|
+
const result = await LocalStorage.getItem(specialKey)
|
|
135
|
+
expect(result).toBe('special')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('handles special characters in string values', async () => {
|
|
139
|
+
const specialValue = 'value with !@#$%^&*()_+={}[]|\\:";\'<>?,./\n\t\r'
|
|
140
|
+
await LocalStorage.setItem('key', specialValue)
|
|
141
|
+
const result = await LocalStorage.getItem('key')
|
|
142
|
+
expect(result).toBe(specialValue)
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
test('handles large numbers', async () => {
|
|
146
|
+
const largeNumber = Number.MAX_SAFE_INTEGER
|
|
147
|
+
await LocalStorage.setItem('large', largeNumber)
|
|
148
|
+
const result = await LocalStorage.getItem<number>('large')
|
|
149
|
+
expect(result).toBe(largeNumber)
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
test('handles negative numbers', async () => {
|
|
153
|
+
await LocalStorage.setItem('negative', -42.5)
|
|
154
|
+
const result = await LocalStorage.getItem<number>('negative')
|
|
155
|
+
expect(result).toBe(-42.5)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
test('handles empty string values', async () => {
|
|
159
|
+
await LocalStorage.setItem('empty', '')
|
|
160
|
+
const result = await LocalStorage.getItem<string>('empty')
|
|
161
|
+
expect(result).toBe('')
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
})
|