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,500 @@
|
|
|
1
|
+
import { useKeyboard } from '@opentui/react'
|
|
2
|
+
import { useMemo, useState, useRef } from 'react'
|
|
3
|
+
import Theme from '../theme'
|
|
4
|
+
|
|
5
|
+
// ----- Helpers -----
|
|
6
|
+
type Focus = 'year' | 'month' | 'grid'
|
|
7
|
+
|
|
8
|
+
const MONTHS = [
|
|
9
|
+
'January',
|
|
10
|
+
'February',
|
|
11
|
+
'March',
|
|
12
|
+
'April',
|
|
13
|
+
'May',
|
|
14
|
+
'June',
|
|
15
|
+
'July',
|
|
16
|
+
'August',
|
|
17
|
+
'September',
|
|
18
|
+
'October',
|
|
19
|
+
'November',
|
|
20
|
+
'December',
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
function daysInMonth(y: number, m: number) {
|
|
24
|
+
return new Date(y, m + 1, 0).getDate()
|
|
25
|
+
}
|
|
26
|
+
function startOfMonth(d: Date) {
|
|
27
|
+
return new Date(d.getFullYear(), d.getMonth(), 1)
|
|
28
|
+
}
|
|
29
|
+
function sameDay(a: Date, b: Date) {
|
|
30
|
+
return (
|
|
31
|
+
a.getFullYear() === b.getFullYear() &&
|
|
32
|
+
a.getMonth() === b.getMonth() &&
|
|
33
|
+
a.getDate() === b.getDate()
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
function addDays(d: Date, delta: number) {
|
|
37
|
+
const nd = new Date(d)
|
|
38
|
+
nd.setDate(nd.getDate() + delta)
|
|
39
|
+
return nd
|
|
40
|
+
}
|
|
41
|
+
function clampDay(y: number, m: number, day: number) {
|
|
42
|
+
return Math.min(day, daysInMonth(y, m))
|
|
43
|
+
}
|
|
44
|
+
function generateSixWeekGrid(
|
|
45
|
+
viewDate: Date,
|
|
46
|
+
weekStartsOnMonday = true,
|
|
47
|
+
): Date[][] {
|
|
48
|
+
// Strategy: 7x6 grid, include prev/next month days to fill 42 cells
|
|
49
|
+
const first = startOfMonth(viewDate)
|
|
50
|
+
const firstWeekday = first.getDay() // 0=Sun..6=Sat
|
|
51
|
+
// For Monday start: Mon=0, Tue=1, ..., Sun=6
|
|
52
|
+
const offset = weekStartsOnMonday ? (firstWeekday + 6) % 7 : firstWeekday
|
|
53
|
+
const grid: Date[][] = []
|
|
54
|
+
const start = addDays(first, -offset)
|
|
55
|
+
for (let w = 0; w < 6; w++) {
|
|
56
|
+
const row: Date[] = []
|
|
57
|
+
for (let i = 0; i < 7; i++) row.push(addDays(start, w * 7 + i))
|
|
58
|
+
grid.push(row)
|
|
59
|
+
}
|
|
60
|
+
return grid
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ----- Component -----
|
|
64
|
+
export function DatePickerWidget({
|
|
65
|
+
enableColors = true,
|
|
66
|
+
initialValue,
|
|
67
|
+
onChange,
|
|
68
|
+
focused = false,
|
|
69
|
+
onFirstRowUpKey,
|
|
70
|
+
onLastRowDownKey,
|
|
71
|
+
}: {
|
|
72
|
+
enableColors?: boolean
|
|
73
|
+
initialValue?: Date
|
|
74
|
+
onChange?: (date: Date) => void
|
|
75
|
+
focused?: boolean
|
|
76
|
+
onFirstRowUpKey?: () => void
|
|
77
|
+
onLastRowDownKey?: () => void
|
|
78
|
+
}) {
|
|
79
|
+
const today = useMemo(() => new Date(), [])
|
|
80
|
+
const [focus, setFocus] = useState<Focus>('grid') // can be "year" | "month" | "grid"
|
|
81
|
+
const [selected, setSelected] = useState<Date>(initialValue || new Date()) // focused day
|
|
82
|
+
const [visible, setVisible] = useState<Date>(
|
|
83
|
+
startOfMonth(initialValue || new Date()),
|
|
84
|
+
) // month being shown
|
|
85
|
+
const [searchQuery, setSearchQuery] = useState('') // for type-to-search
|
|
86
|
+
const searchTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
87
|
+
|
|
88
|
+
// Recompute 7x6 grid for the visible month (Monday start)
|
|
89
|
+
const weeks = useMemo(() => generateSixWeekGrid(visible, true), [visible])
|
|
90
|
+
|
|
91
|
+
// Keep visible month synced when selected day moves across months
|
|
92
|
+
function ensureVisibleFor(date: Date) {
|
|
93
|
+
const m = new Date(date.getFullYear(), date.getMonth(), 1)
|
|
94
|
+
const keyA = visible.getFullYear() * 12 + visible.getMonth()
|
|
95
|
+
const keyB = m.getFullYear() * 12 + m.getMonth()
|
|
96
|
+
if (keyA !== keyB) setVisible(m)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function changeMonth(delta: number) {
|
|
100
|
+
const y = visible.getFullYear()
|
|
101
|
+
const m = visible.getMonth() + delta
|
|
102
|
+
const newY = y + Math.floor(m / 12)
|
|
103
|
+
const newM = ((m % 12) + 12) % 12
|
|
104
|
+
const day = clampDay(newY, newM, selected.getDate())
|
|
105
|
+
const newSel = new Date(newY, newM, day)
|
|
106
|
+
setVisible(new Date(newY, newM, 1))
|
|
107
|
+
setSelected(newSel)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function changeYear(delta: number) {
|
|
111
|
+
const y = visible.getFullYear() + delta
|
|
112
|
+
const m = visible.getMonth()
|
|
113
|
+
const day = clampDay(y, m, selected.getDate())
|
|
114
|
+
const newSel = new Date(y, m, day)
|
|
115
|
+
setVisible(new Date(y, m, 1))
|
|
116
|
+
setSelected(newSel)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Generate years list for search
|
|
120
|
+
const years = useMemo(() => {
|
|
121
|
+
const yearList: number[] = []
|
|
122
|
+
for (let y = 1800; y <= 2200; y++) {
|
|
123
|
+
yearList.push(y)
|
|
124
|
+
}
|
|
125
|
+
return yearList
|
|
126
|
+
}, [])
|
|
127
|
+
|
|
128
|
+
// Search functionality
|
|
129
|
+
function searchYear(query: string) {
|
|
130
|
+
const matches = years.filter((y) => y.toString().startsWith(query))
|
|
131
|
+
if (matches.length > 0) {
|
|
132
|
+
const newY = matches[0]
|
|
133
|
+
const m = visible.getMonth()
|
|
134
|
+
const day = clampDay(newY, m, selected.getDate())
|
|
135
|
+
const newSel = new Date(newY, m, day)
|
|
136
|
+
setVisible(new Date(newY, m, 1))
|
|
137
|
+
setSelected(newSel)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function searchMonth(query: string) {
|
|
142
|
+
// Search by month name or number
|
|
143
|
+
const lowerQuery = query.toLowerCase()
|
|
144
|
+
let monthIndex = -1
|
|
145
|
+
|
|
146
|
+
// Try to match month name
|
|
147
|
+
for (let i = 0; i < MONTHS.length; i++) {
|
|
148
|
+
if (MONTHS[i].toLowerCase().startsWith(lowerQuery)) {
|
|
149
|
+
monthIndex = i
|
|
150
|
+
break
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Try to match month number
|
|
155
|
+
if (monthIndex === -1) {
|
|
156
|
+
const num = parseInt(query)
|
|
157
|
+
if (!isNaN(num) && num >= 1 && num <= 12) {
|
|
158
|
+
monthIndex = num - 1
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (monthIndex !== -1) {
|
|
163
|
+
const y = visible.getFullYear()
|
|
164
|
+
const day = clampDay(y, monthIndex, selected.getDate())
|
|
165
|
+
const newSel = new Date(y, monthIndex, day)
|
|
166
|
+
setVisible(new Date(y, monthIndex, 1))
|
|
167
|
+
setSelected(newSel)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function searchDay(query: string) {
|
|
172
|
+
const day = parseInt(query)
|
|
173
|
+
if (!isNaN(day) && day >= 1 && day <= 31) {
|
|
174
|
+
const y = visible.getFullYear()
|
|
175
|
+
const m = visible.getMonth()
|
|
176
|
+
const clampedDay = clampDay(y, m, day)
|
|
177
|
+
const newSel = new Date(y, m, clampedDay)
|
|
178
|
+
setSelected(newSel)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Keyboard interactions
|
|
183
|
+
useKeyboard((key) => {
|
|
184
|
+
// Ignore keyboard events if not focused
|
|
185
|
+
if (!focused) return
|
|
186
|
+
// Handle type-to-search
|
|
187
|
+
if (key.name.length === 1 && /[0-9a-zA-Z]/.test(key.name)) {
|
|
188
|
+
const newQuery = searchQuery + key.name
|
|
189
|
+
setSearchQuery(newQuery)
|
|
190
|
+
|
|
191
|
+
// Clear previous timeout
|
|
192
|
+
if (searchTimeoutRef.current) {
|
|
193
|
+
clearTimeout(searchTimeoutRef.current)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Perform search based on current focus
|
|
197
|
+
if (focus === 'year') {
|
|
198
|
+
searchYear(newQuery)
|
|
199
|
+
} else if (focus === 'month') {
|
|
200
|
+
searchMonth(newQuery)
|
|
201
|
+
} else if (focus === 'grid') {
|
|
202
|
+
searchDay(newQuery)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Reset search query after 1 second
|
|
206
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
207
|
+
setSearchQuery('')
|
|
208
|
+
}, 1000)
|
|
209
|
+
return
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
switch (key.name) {
|
|
213
|
+
case 'left':
|
|
214
|
+
if (focus === 'grid') {
|
|
215
|
+
const next = addDays(selected, -1)
|
|
216
|
+
setSelected(next)
|
|
217
|
+
ensureVisibleFor(next)
|
|
218
|
+
} else if (focus === 'month') {
|
|
219
|
+
changeMonth(-1)
|
|
220
|
+
} else if (focus === 'year') {
|
|
221
|
+
changeYear(-1)
|
|
222
|
+
}
|
|
223
|
+
break
|
|
224
|
+
case 'right':
|
|
225
|
+
if (focus === 'grid') {
|
|
226
|
+
const next = addDays(selected, +1)
|
|
227
|
+
setSelected(next)
|
|
228
|
+
ensureVisibleFor(next)
|
|
229
|
+
} else if (focus === 'month') {
|
|
230
|
+
changeMonth(+1)
|
|
231
|
+
} else if (focus === 'year') {
|
|
232
|
+
changeYear(+1)
|
|
233
|
+
}
|
|
234
|
+
break
|
|
235
|
+
case 'up':
|
|
236
|
+
if (focus === 'grid') {
|
|
237
|
+
// Check if we're in the first row of the month
|
|
238
|
+
const firstDayOfMonth = new Date(
|
|
239
|
+
selected.getFullYear(),
|
|
240
|
+
selected.getMonth(),
|
|
241
|
+
1,
|
|
242
|
+
)
|
|
243
|
+
const daysDiff = selected.getDate() - 1
|
|
244
|
+
if (daysDiff < 7) {
|
|
245
|
+
// Move focus to month
|
|
246
|
+
setFocus('month')
|
|
247
|
+
} else {
|
|
248
|
+
const next = addDays(selected, -7)
|
|
249
|
+
setSelected(next)
|
|
250
|
+
ensureVisibleFor(next)
|
|
251
|
+
}
|
|
252
|
+
} else if (focus === 'month') {
|
|
253
|
+
// Move focus to year
|
|
254
|
+
setFocus('year')
|
|
255
|
+
} else if (focus === 'year') {
|
|
256
|
+
// At top of widget, trigger callback or cycle to bottom
|
|
257
|
+
if (onFirstRowUpKey) {
|
|
258
|
+
onFirstRowUpKey()
|
|
259
|
+
} else {
|
|
260
|
+
// Cycle to grid if no callback
|
|
261
|
+
setFocus('grid')
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
break
|
|
265
|
+
case 'down':
|
|
266
|
+
if (focus === 'grid') {
|
|
267
|
+
// Check if we're in the last row of days
|
|
268
|
+
const daysInCurrentMonth = daysInMonth(
|
|
269
|
+
selected.getFullYear(),
|
|
270
|
+
selected.getMonth(),
|
|
271
|
+
)
|
|
272
|
+
const remainingDays = daysInCurrentMonth - selected.getDate()
|
|
273
|
+
if (remainingDays < 7) {
|
|
274
|
+
// At bottom of grid, trigger callback or cycle to top
|
|
275
|
+
if (onLastRowDownKey) {
|
|
276
|
+
onLastRowDownKey()
|
|
277
|
+
} else {
|
|
278
|
+
// Cycle to year if no callback
|
|
279
|
+
setFocus('year')
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
const next = addDays(selected, +7)
|
|
283
|
+
setSelected(next)
|
|
284
|
+
ensureVisibleFor(next)
|
|
285
|
+
}
|
|
286
|
+
} else if (focus === 'year') {
|
|
287
|
+
// Move focus to month
|
|
288
|
+
setFocus('month')
|
|
289
|
+
} else if (focus === 'month') {
|
|
290
|
+
// Move focus to grid
|
|
291
|
+
setFocus('grid')
|
|
292
|
+
}
|
|
293
|
+
break
|
|
294
|
+
case 'tab':
|
|
295
|
+
if (key.shift) {
|
|
296
|
+
if (focus === 'year') {
|
|
297
|
+
// At top of widget, trigger callback or cycle to bottom
|
|
298
|
+
if (onFirstRowUpKey) {
|
|
299
|
+
onFirstRowUpKey()
|
|
300
|
+
} else {
|
|
301
|
+
// Cycle to grid if no callback
|
|
302
|
+
setFocus('grid')
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
// Shift+Tab: Move focus up (grid -> month -> year)
|
|
306
|
+
setFocus((f) =>
|
|
307
|
+
f === 'grid' ? 'month' : f === 'month' ? 'year' : 'year',
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
if (focus === 'grid') {
|
|
312
|
+
// At bottom of widget, trigger callback or cycle to top
|
|
313
|
+
if (onLastRowDownKey) {
|
|
314
|
+
onLastRowDownKey()
|
|
315
|
+
} else {
|
|
316
|
+
// Cycle to year if no callback
|
|
317
|
+
setFocus('year')
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
// Tab: Move focus down (year -> month -> grid)
|
|
321
|
+
setFocus((f) =>
|
|
322
|
+
f === 'year' ? 'month' : f === 'month' ? 'grid' : 'grid',
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
break
|
|
327
|
+
case 'return': // Enter key
|
|
328
|
+
if (focus === 'grid' && onChange) {
|
|
329
|
+
onChange(selected)
|
|
330
|
+
}
|
|
331
|
+
break
|
|
332
|
+
default:
|
|
333
|
+
break
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
const y = visible.getFullYear()
|
|
338
|
+
const m = visible.getMonth()
|
|
339
|
+
const headerWidth = 21 // Match form.md width (7 cols * 3 width)
|
|
340
|
+
const cellStyle = {
|
|
341
|
+
width: 3,
|
|
342
|
+
height: 1,
|
|
343
|
+
alignItems: 'center' as const,
|
|
344
|
+
justifyContent: 'center' as const,
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Only show days from current month
|
|
348
|
+
const filteredWeeks = weeks.map((row) =>
|
|
349
|
+
row.map((d) => (d.getMonth() === m ? d : null)),
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
// Week starts Monday: Mo Tu We Th Fr Sa Su
|
|
353
|
+
const weekdayHeaders = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su']
|
|
354
|
+
|
|
355
|
+
return (
|
|
356
|
+
<box
|
|
357
|
+
style={{
|
|
358
|
+
flexDirection: 'column',
|
|
359
|
+
alignItems: 'flex-start',
|
|
360
|
+
padding: 1,
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
{/* Year (line 1) */}
|
|
364
|
+
<box
|
|
365
|
+
style={{
|
|
366
|
+
width: headerWidth,
|
|
367
|
+
height: 1,
|
|
368
|
+
backgroundColor:
|
|
369
|
+
enableColors && focus === 'year' ? Theme.primary : undefined,
|
|
370
|
+
marginBottom: 0,
|
|
371
|
+
}}
|
|
372
|
+
onMouseDown={() => setFocus('year')}
|
|
373
|
+
>
|
|
374
|
+
<box
|
|
375
|
+
style={{
|
|
376
|
+
flexDirection: 'row',
|
|
377
|
+
justifyContent: 'space-between',
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
width: headerWidth,
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
<text fg={focus === 'year' ? Theme.text : Theme.textMuted}>←</text>
|
|
383
|
+
<text fg={focus === 'year' ? Theme.text : Theme.textMuted}>
|
|
384
|
+
{String(y)}
|
|
385
|
+
</text>
|
|
386
|
+
<text fg={focus === 'year' ? Theme.text : Theme.textMuted}>→</text>
|
|
387
|
+
</box>
|
|
388
|
+
</box>
|
|
389
|
+
|
|
390
|
+
{/* Month (line 2) */}
|
|
391
|
+
<box
|
|
392
|
+
style={{
|
|
393
|
+
width: headerWidth,
|
|
394
|
+
height: 1,
|
|
395
|
+
backgroundColor:
|
|
396
|
+
enableColors && focus === 'month' ? Theme.primary : undefined,
|
|
397
|
+
marginBottom: 1,
|
|
398
|
+
}}
|
|
399
|
+
onMouseDown={() => setFocus('month')}
|
|
400
|
+
>
|
|
401
|
+
<box
|
|
402
|
+
style={{
|
|
403
|
+
flexDirection: 'row',
|
|
404
|
+
justifyContent: 'space-between',
|
|
405
|
+
alignItems: 'center',
|
|
406
|
+
width: headerWidth,
|
|
407
|
+
}}
|
|
408
|
+
>
|
|
409
|
+
<text fg={focus === 'month' ? Theme.text : Theme.textMuted}>←</text>
|
|
410
|
+
<text fg={focus === 'month' ? Theme.text : Theme.textMuted}>
|
|
411
|
+
{MONTHS[m]}
|
|
412
|
+
</text>
|
|
413
|
+
<text fg={focus === 'month' ? Theme.text : Theme.textMuted}>→</text>
|
|
414
|
+
</box>
|
|
415
|
+
</box>
|
|
416
|
+
|
|
417
|
+
{/* Weekday header */}
|
|
418
|
+
<box
|
|
419
|
+
style={{
|
|
420
|
+
flexDirection: 'row',
|
|
421
|
+
width: headerWidth,
|
|
422
|
+
justifyContent: 'space-between',
|
|
423
|
+
marginBottom: 0,
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
{weekdayHeaders.map((wd, idx) => (
|
|
427
|
+
<box key={wd} style={cellStyle}>
|
|
428
|
+
<text
|
|
429
|
+
fg={
|
|
430
|
+
enableColors && (idx === 5 || idx === 6)
|
|
431
|
+
? Theme.error
|
|
432
|
+
: Theme.textMuted
|
|
433
|
+
}
|
|
434
|
+
>
|
|
435
|
+
{wd}
|
|
436
|
+
</text>
|
|
437
|
+
</box>
|
|
438
|
+
))}
|
|
439
|
+
</box>
|
|
440
|
+
|
|
441
|
+
{/* Days grid: 7 columns x 6 rows, same fixed-box strategy */}
|
|
442
|
+
<box style={{ flexDirection: 'column', minHeight: 6 }}>
|
|
443
|
+
{filteredWeeks.map((row, i) => {
|
|
444
|
+
// Skip empty rows
|
|
445
|
+
if (row.every((d) => d === null)) return null
|
|
446
|
+
|
|
447
|
+
return (
|
|
448
|
+
<box key={i} style={{ flexDirection: 'row' }}>
|
|
449
|
+
{row.map((d, j) => {
|
|
450
|
+
if (d === null) {
|
|
451
|
+
return (
|
|
452
|
+
<box key={`${i}-${j}`} style={cellStyle}>
|
|
453
|
+
<text> </text>
|
|
454
|
+
</box>
|
|
455
|
+
)
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const isSel = sameDay(d, selected)
|
|
459
|
+
const isToday = sameDay(d, today)
|
|
460
|
+
return (
|
|
461
|
+
<box
|
|
462
|
+
key={`${i}-${j}`}
|
|
463
|
+
style={{
|
|
464
|
+
...cellStyle,
|
|
465
|
+
backgroundColor:
|
|
466
|
+
enableColors && isSel && focus === 'grid'
|
|
467
|
+
? Theme.primary
|
|
468
|
+
: enableColors && isToday
|
|
469
|
+
? Theme.backgroundPanel
|
|
470
|
+
: undefined,
|
|
471
|
+
}}
|
|
472
|
+
onMouseDown={() => {
|
|
473
|
+
setSelected(d)
|
|
474
|
+
setFocus('grid')
|
|
475
|
+
ensureVisibleFor(d)
|
|
476
|
+
}}
|
|
477
|
+
>
|
|
478
|
+
<text
|
|
479
|
+
fg={
|
|
480
|
+
isSel && focus === 'grid'
|
|
481
|
+
? Theme.text
|
|
482
|
+
: enableColors && isToday
|
|
483
|
+
? Theme.accent
|
|
484
|
+
: enableColors && (j === 5 || j === 6)
|
|
485
|
+
? Theme.error
|
|
486
|
+
: Theme.text
|
|
487
|
+
}
|
|
488
|
+
>
|
|
489
|
+
{String(d.getDate()).padStart(2, ' ')}
|
|
490
|
+
</text>
|
|
491
|
+
</box>
|
|
492
|
+
)
|
|
493
|
+
})}
|
|
494
|
+
</box>
|
|
495
|
+
)
|
|
496
|
+
})}
|
|
497
|
+
</box>
|
|
498
|
+
</box>
|
|
499
|
+
)
|
|
500
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { useKeyboard, useTerminalDimensions } from '@opentui/react'
|
|
2
|
+
import React, { type ReactNode, useRef } from 'react'
|
|
3
|
+
import { Theme } from 'termcast/src/theme'
|
|
4
|
+
import { RGBA } from '@opentui/core'
|
|
5
|
+
import { InFocus, useIsInFocus } from 'termcast/src/internal/focus-context'
|
|
6
|
+
import { CommonProps } from 'termcast/src/utils'
|
|
7
|
+
import {
|
|
8
|
+
useStore,
|
|
9
|
+
type DialogPosition,
|
|
10
|
+
type DialogStackItem,
|
|
11
|
+
} from 'termcast/src/state'
|
|
12
|
+
import { logger } from '../logger'
|
|
13
|
+
|
|
14
|
+
const Border = {
|
|
15
|
+
topLeft: '┃',
|
|
16
|
+
topRight: '┃',
|
|
17
|
+
bottomLeft: '┃',
|
|
18
|
+
bottomRight: '┃',
|
|
19
|
+
horizontal: '',
|
|
20
|
+
vertical: '┃',
|
|
21
|
+
topT: '+',
|
|
22
|
+
bottomT: '+',
|
|
23
|
+
leftT: '+',
|
|
24
|
+
rightT: '+',
|
|
25
|
+
cross: '+',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type { DialogPosition } from 'termcast/src/state'
|
|
29
|
+
|
|
30
|
+
interface DialogProps extends CommonProps {
|
|
31
|
+
children: ReactNode
|
|
32
|
+
position?: DialogPosition
|
|
33
|
+
onClickOutside?: () => void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function Dialog({
|
|
37
|
+
children,
|
|
38
|
+
position = 'center',
|
|
39
|
+
onClickOutside,
|
|
40
|
+
}: DialogProps): any {
|
|
41
|
+
const dimensions = useTerminalDimensions()
|
|
42
|
+
const inFocus = useIsInFocus()
|
|
43
|
+
const clickedInsideDialog = useRef(false)
|
|
44
|
+
|
|
45
|
+
const handleBackdropClick = () => {
|
|
46
|
+
if (!inFocus) return
|
|
47
|
+
if (!clickedInsideDialog.current) {
|
|
48
|
+
onClickOutside?.()
|
|
49
|
+
}
|
|
50
|
+
clickedInsideDialog.current = false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const handleDialogClick = () => {
|
|
54
|
+
clickedInsideDialog.current = true
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const getPositionStyles = () => {
|
|
58
|
+
switch (position) {
|
|
59
|
+
case 'top-right':
|
|
60
|
+
return {
|
|
61
|
+
alignItems: 'flex-end' as const,
|
|
62
|
+
justifyContent: 'flex-start' as const,
|
|
63
|
+
paddingTop: 2,
|
|
64
|
+
paddingRight: 2,
|
|
65
|
+
paddingBottom: undefined,
|
|
66
|
+
paddingLeft: undefined,
|
|
67
|
+
}
|
|
68
|
+
case 'bottom-right':
|
|
69
|
+
// TODO show in center for now. easier to read
|
|
70
|
+
// return {
|
|
71
|
+
// alignItems: 'flex-end' as const,
|
|
72
|
+
// justifyContent: 'flex-end' as const,
|
|
73
|
+
// paddingTop: undefined,
|
|
74
|
+
// paddingBottom: 2,
|
|
75
|
+
// paddingRight: 2,
|
|
76
|
+
// paddingLeft: undefined
|
|
77
|
+
// }
|
|
78
|
+
case 'center':
|
|
79
|
+
default:
|
|
80
|
+
return {
|
|
81
|
+
alignItems: 'center' as const,
|
|
82
|
+
justifyContent: 'flex-start' as const,
|
|
83
|
+
paddingTop: Math.floor(dimensions.height / 4),
|
|
84
|
+
paddingBottom: undefined,
|
|
85
|
+
paddingLeft: undefined,
|
|
86
|
+
paddingRight: undefined,
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const positionStyles = getPositionStyles()
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<box
|
|
95
|
+
border={false}
|
|
96
|
+
width={dimensions.width}
|
|
97
|
+
height={dimensions.height}
|
|
98
|
+
alignItems={positionStyles.alignItems}
|
|
99
|
+
justifyContent={positionStyles.justifyContent}
|
|
100
|
+
position='absolute'
|
|
101
|
+
paddingTop={positionStyles.paddingTop}
|
|
102
|
+
paddingBottom={positionStyles.paddingBottom}
|
|
103
|
+
paddingLeft={positionStyles.paddingLeft}
|
|
104
|
+
paddingRight={positionStyles.paddingRight}
|
|
105
|
+
left={0}
|
|
106
|
+
top={0}
|
|
107
|
+
backgroundColor={RGBA.fromInts(0, 0, 0, 150)}
|
|
108
|
+
onMouseDown={handleBackdropClick}
|
|
109
|
+
>
|
|
110
|
+
<box
|
|
111
|
+
border={false}
|
|
112
|
+
customBorderChars={Border}
|
|
113
|
+
width={76}
|
|
114
|
+
maxWidth={dimensions.width - 2}
|
|
115
|
+
backgroundColor={Theme.backgroundPanel}
|
|
116
|
+
borderColor={Theme.border}
|
|
117
|
+
paddingTop={1}
|
|
118
|
+
onMouseDown={handleDialogClick}
|
|
119
|
+
>
|
|
120
|
+
{children}
|
|
121
|
+
</box>
|
|
122
|
+
</box>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface DialogProviderProps {
|
|
127
|
+
children: ReactNode
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function DialogProvider(props: DialogProviderProps): any {
|
|
131
|
+
const dialogStack = useStore((state) => state.dialogStack)
|
|
132
|
+
const inFocus = useIsInFocus()
|
|
133
|
+
|
|
134
|
+
useKeyboard((evt) => {
|
|
135
|
+
if (!inFocus) return
|
|
136
|
+
if (evt.name === 'escape') {
|
|
137
|
+
const state = useStore.getState()
|
|
138
|
+
if (state.dialogStack.length > 0) {
|
|
139
|
+
useStore.setState({
|
|
140
|
+
dialogStack: state.dialogStack.slice(0, -1),
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<InFocus inFocus={!dialogStack?.length}>{props.children}</InFocus>
|
|
149
|
+
{dialogStack.length > 0 && (
|
|
150
|
+
<box position='absolute'>
|
|
151
|
+
{dialogStack.map((item, index) => {
|
|
152
|
+
const isLastItem = index === dialogStack.length - 1
|
|
153
|
+
return (
|
|
154
|
+
<InFocus key={'dialog' + String(index)} inFocus={isLastItem}>
|
|
155
|
+
<Dialog
|
|
156
|
+
position={item.position}
|
|
157
|
+
onClickOutside={() => {
|
|
158
|
+
if (!isLastItem) return
|
|
159
|
+
const state = useStore.getState()
|
|
160
|
+
if (state.dialogStack.length > 0) {
|
|
161
|
+
useStore.setState({
|
|
162
|
+
dialogStack: state.dialogStack.slice(0, -1),
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
{item.element}
|
|
168
|
+
</Dialog>
|
|
169
|
+
</InFocus>
|
|
170
|
+
)
|
|
171
|
+
})}
|
|
172
|
+
</box>
|
|
173
|
+
)}
|
|
174
|
+
</>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function useDialog() {
|
|
179
|
+
const dialogStack = useStore((state) => state.dialogStack)
|
|
180
|
+
|
|
181
|
+
const pushDialog = (element: ReactNode, position?: DialogPosition) => {
|
|
182
|
+
const state = useStore.getState()
|
|
183
|
+
useStore.setState({
|
|
184
|
+
dialogStack: [...state.dialogStack, { element, position }],
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const clearDialogs = () => {
|
|
189
|
+
useStore.setState({ dialogStack: [] })
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const replaceDialog = (element: ReactNode, position?: DialogPosition) => {
|
|
193
|
+
useStore.setState({ dialogStack: [{ element, position }] })
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
push: pushDialog,
|
|
198
|
+
clear: clearDialogs,
|
|
199
|
+
replace: replaceDialog,
|
|
200
|
+
stack: dialogStack,
|
|
201
|
+
}
|
|
202
|
+
}
|