@navios/commander-tui 1.2.0 → 1.3.0
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/CHANGELOG.md +27 -0
- package/README.md +42 -1
- package/dist/base/src/adapters/index.d.ts +2 -0
- package/dist/base/src/adapters/index.d.ts.map +1 -0
- package/dist/base/src/adapters/interface.d.ts +45 -0
- package/dist/base/src/adapters/interface.d.ts.map +1 -0
- package/dist/base/src/components/index.d.ts +2 -0
- package/dist/base/src/components/index.d.ts.map +1 -0
- package/dist/base/src/context/index.d.ts +2 -0
- package/dist/base/src/context/index.d.ts.map +1 -0
- package/dist/base/src/factories/index.d.ts +3 -0
- package/dist/base/src/factories/index.d.ts.map +1 -0
- package/dist/base/src/factories/isomorphic-logger.factory.d.ts +8 -0
- package/dist/base/src/factories/isomorphic-logger.factory.d.ts.map +1 -0
- package/dist/base/src/factories/screen.factory.d.ts +8 -0
- package/dist/base/src/factories/screen.factory.d.ts.map +1 -0
- package/dist/base/src/filter/filter_engine.d.ts +19 -0
- package/dist/base/src/filter/filter_engine.d.ts.map +1 -0
- package/dist/base/src/filter/index.d.ts +2 -0
- package/dist/base/src/filter/index.d.ts.map +1 -0
- package/dist/base/src/hooks/index.d.ts +2 -0
- package/dist/base/src/hooks/index.d.ts.map +1 -0
- package/dist/base/src/index.d.ts +16 -0
- package/dist/base/src/index.d.ts.map +1 -0
- package/dist/base/src/interfaces/index.d.ts +2 -0
- package/dist/base/src/interfaces/index.d.ts.map +1 -0
- package/dist/base/src/interfaces/isomorphic-logger.d.ts +9 -0
- package/dist/base/src/interfaces/isomorphic-logger.d.ts.map +1 -0
- package/dist/base/src/keyboard/create_bindings.d.ts +26 -0
- package/dist/base/src/keyboard/create_bindings.d.ts.map +1 -0
- package/dist/base/src/keyboard/index.d.ts +3 -0
- package/dist/base/src/keyboard/index.d.ts.map +1 -0
- package/dist/base/src/keyboard/keyboard_manager.d.ts +63 -0
- package/dist/base/src/keyboard/keyboard_manager.d.ts.map +1 -0
- package/dist/base/src/overrides/console.logger.override.d.ts +3 -0
- package/dist/base/src/overrides/console.logger.override.d.ts.map +1 -0
- package/dist/base/src/overrides/index.d.ts +3 -0
- package/dist/base/src/overrides/index.d.ts.map +1 -0
- package/dist/base/src/overrides/missing-adapter.override.d.ts +6 -0
- package/dist/base/src/overrides/missing-adapter.override.d.ts.map +1 -0
- package/dist/base/src/schemas/index.d.ts +4 -0
- package/dist/base/src/schemas/index.d.ts.map +1 -0
- package/dist/base/src/schemas/logger-options.d.ts +21 -0
- package/dist/base/src/schemas/logger-options.d.ts.map +1 -0
- package/dist/base/src/schemas/prompt-options.d.ts +12 -0
- package/dist/base/src/schemas/prompt-options.d.ts.map +1 -0
- package/dist/base/src/schemas/screen-options.d.ts +10 -0
- package/dist/base/src/schemas/screen-options.d.ts.map +1 -0
- package/dist/base/src/services/index.d.ts +5 -0
- package/dist/base/src/services/index.d.ts.map +1 -0
- package/dist/base/src/services/logger.d.ts +52 -0
- package/dist/base/src/services/logger.d.ts.map +1 -0
- package/dist/base/src/services/prompt.d.ts +31 -0
- package/dist/base/src/services/prompt.d.ts.map +1 -0
- package/dist/base/src/services/screen.d.ts +161 -0
- package/dist/base/src/services/screen.d.ts.map +1 -0
- package/dist/base/src/services/screen_manager.d.ts +130 -0
- package/dist/base/src/services/screen_manager.d.ts.map +1 -0
- package/dist/base/src/themes/dark.d.ts +7 -0
- package/dist/base/src/themes/dark.d.ts.map +1 -0
- package/dist/base/src/themes/high-contrast.d.ts +7 -0
- package/dist/base/src/themes/high-contrast.d.ts.map +1 -0
- package/dist/base/src/themes/index.d.ts +5 -0
- package/dist/base/src/themes/index.d.ts.map +1 -0
- package/dist/base/src/themes/light.d.ts +6 -0
- package/dist/base/src/themes/light.d.ts.map +1 -0
- package/dist/base/src/themes/utils.d.ts +22 -0
- package/dist/base/src/themes/utils.d.ts.map +1 -0
- package/dist/base/src/tokens/adapter.d.ts +9 -0
- package/dist/base/src/tokens/adapter.d.ts.map +1 -0
- package/dist/base/src/tokens/index.d.ts +6 -0
- package/dist/base/src/tokens/index.d.ts.map +1 -0
- package/dist/base/src/tokens/logger.d.ts +44 -0
- package/dist/base/src/tokens/logger.d.ts.map +1 -0
- package/dist/base/src/tokens/prompt.d.ts +12 -0
- package/dist/base/src/tokens/prompt.d.ts.map +1 -0
- package/dist/base/src/tokens/screen-manager.d.ts +8 -0
- package/dist/base/src/tokens/screen-manager.d.ts.map +1 -0
- package/dist/base/src/tokens/screen.d.ts +10 -0
- package/dist/base/src/tokens/screen.d.ts.map +1 -0
- package/dist/base/src/types/file.types.d.ts +40 -0
- package/dist/base/src/types/file.types.d.ts.map +1 -0
- package/dist/base/src/types/filter.types.d.ts +31 -0
- package/dist/base/src/types/filter.types.d.ts.map +1 -0
- package/dist/base/src/types/index.d.ts +9 -0
- package/dist/base/src/types/index.d.ts.map +1 -0
- package/dist/base/src/types/keyboard.types.d.ts +83 -0
- package/dist/base/src/types/keyboard.types.d.ts.map +1 -0
- package/dist/base/src/types/log.types.d.ts +39 -0
- package/dist/base/src/types/log.types.d.ts.map +1 -0
- package/dist/base/src/types/message.types.d.ts +82 -0
- package/dist/base/src/types/message.types.d.ts.map +1 -0
- package/dist/base/src/types/prompt.types.d.ts +85 -0
- package/dist/base/src/types/prompt.types.d.ts.map +1 -0
- package/dist/base/src/types/screen.types.d.ts +79 -0
- package/dist/base/src/types/screen.types.d.ts.map +1 -0
- package/dist/base/src/types/theme.types.d.ts +217 -0
- package/dist/base/src/types/theme.types.d.ts.map +1 -0
- package/dist/base/src/utils/colors/file-colors.d.ts +10 -0
- package/dist/base/src/utils/colors/file-colors.d.ts.map +1 -0
- package/dist/base/src/utils/colors/helpers.d.ts +26 -0
- package/dist/base/src/utils/colors/helpers.d.ts.map +1 -0
- package/dist/base/src/utils/colors/index.d.ts +8 -0
- package/dist/base/src/utils/colors/index.d.ts.map +1 -0
- package/dist/base/src/utils/colors/log-colors.d.ts +19 -0
- package/dist/base/src/utils/colors/log-colors.d.ts.map +1 -0
- package/dist/base/src/utils/colors/progress-colors.d.ts +25 -0
- package/dist/base/src/utils/colors/progress-colors.d.ts.map +1 -0
- package/dist/base/src/utils/colors/prompt-colors.d.ts +22 -0
- package/dist/base/src/utils/colors/prompt-colors.d.ts.map +1 -0
- package/dist/base/src/utils/colors/sidebar-colors.d.ts +50 -0
- package/dist/base/src/utils/colors/sidebar-colors.d.ts.map +1 -0
- package/dist/base/src/utils/colors/table-colors.d.ts +12 -0
- package/dist/base/src/utils/colors/table-colors.d.ts.map +1 -0
- package/dist/base/src/utils/filetype.d.ts +19 -0
- package/dist/base/src/utils/filetype.d.ts.map +1 -0
- package/dist/base/src/utils/format.d.ts +9 -0
- package/dist/base/src/utils/format.d.ts.map +1 -0
- package/dist/base/src/utils/index.d.ts +5 -0
- package/dist/base/src/utils/index.d.ts.map +1 -0
- package/dist/base/src/utils/stdout-printer.d.ts +6 -0
- package/dist/base/src/utils/stdout-printer.d.ts.map +1 -0
- package/dist/base/tsconfig.base.tsbuildinfo +1 -0
- package/dist/react/src/adapters/react/components/file/file_log.d.ts +35 -0
- package/dist/react/src/adapters/react/components/file/file_log.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/file/index.d.ts +2 -0
- package/dist/react/src/adapters/react/components/file/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/filter/filter_bar.d.ts +7 -0
- package/dist/react/src/adapters/react/components/filter/filter_bar.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/filter/index.d.ts +2 -0
- package/dist/react/src/adapters/react/components/filter/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/help/help_overlay.d.ts +6 -0
- package/dist/react/src/adapters/react/components/help/help_overlay.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/help/index.d.ts +2 -0
- package/dist/react/src/adapters/react/components/help/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/log/index.d.ts +2 -0
- package/dist/react/src/adapters/react/components/log/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/log/log_message.d.ts +28 -0
- package/dist/react/src/adapters/react/components/log/log_message.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/prompt/index.d.ts +3 -0
- package/dist/react/src/adapters/react/components/prompt/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/prompt/prompt_renderer.d.ts +6 -0
- package/dist/react/src/adapters/react/components/prompt/prompt_renderer.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/group_renderer.d.ts +14 -0
- package/dist/react/src/adapters/react/components/screen/group_renderer.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/index.d.ts +7 -0
- package/dist/react/src/adapters/react/components/screen/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/loading_message.d.ts +6 -0
- package/dist/react/src/adapters/react/components/screen/loading_message.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/message_renderer.d.ts +6 -0
- package/dist/react/src/adapters/react/components/screen/message_renderer.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/progress_message.d.ts +6 -0
- package/dist/react/src/adapters/react/components/screen/progress_message.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/screen_bridge.d.ts +14 -0
- package/dist/react/src/adapters/react/components/screen/screen_bridge.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen/table_message.d.ts +6 -0
- package/dist/react/src/adapters/react/components/screen/table_message.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/screen_manager_bridge.d.ts +8 -0
- package/dist/react/src/adapters/react/components/screen_manager_bridge.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/sidebar/index.d.ts +4 -0
- package/dist/react/src/adapters/react/components/sidebar/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/sidebar/sidebar.d.ts +11 -0
- package/dist/react/src/adapters/react/components/sidebar/sidebar.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/sidebar/sidebar_item.d.ts +9 -0
- package/dist/react/src/adapters/react/components/sidebar/sidebar_item.d.ts.map +1 -0
- package/dist/react/src/adapters/react/components/sidebar/sidebar_separator.d.ts +2 -0
- package/dist/react/src/adapters/react/components/sidebar/sidebar_separator.d.ts.map +1 -0
- package/dist/react/src/adapters/react/context/index.d.ts +2 -0
- package/dist/react/src/adapters/react/context/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/context/logger_context.d.ts +53 -0
- package/dist/react/src/adapters/react/context/logger_context.d.ts.map +1 -0
- package/dist/react/src/adapters/react/hooks/index.d.ts +2 -0
- package/dist/react/src/adapters/react/hooks/index.d.ts.map +1 -0
- package/dist/react/src/adapters/react/hooks/use_theme.d.ts +7 -0
- package/dist/react/src/adapters/react/hooks/use_theme.d.ts.map +1 -0
- package/dist/react/src/adapters/react/index.d.ts +13 -0
- package/dist/react/src/adapters/react/index.d.ts.map +1 -0
- package/dist/react/tsconfig.react.tsbuildinfo +1 -0
- package/dist/solid/src/adapters/solid/components/file/file_log.d.ts +35 -0
- package/dist/solid/src/adapters/solid/components/file/file_log.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/file/index.d.ts +2 -0
- package/dist/solid/src/adapters/solid/components/file/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/filter/filter_bar.d.ts +7 -0
- package/dist/solid/src/adapters/solid/components/filter/filter_bar.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/filter/index.d.ts +2 -0
- package/dist/solid/src/adapters/solid/components/filter/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/help/help_overlay.d.ts +6 -0
- package/dist/solid/src/adapters/solid/components/help/help_overlay.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/help/index.d.ts +2 -0
- package/dist/solid/src/adapters/solid/components/help/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/log/index.d.ts +2 -0
- package/dist/solid/src/adapters/solid/components/log/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/log/log_message.d.ts +31 -0
- package/dist/solid/src/adapters/solid/components/log/log_message.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/prompt/index.d.ts +3 -0
- package/dist/solid/src/adapters/solid/components/prompt/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/prompt/prompt_renderer.d.ts +6 -0
- package/dist/solid/src/adapters/solid/components/prompt/prompt_renderer.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/group_renderer.d.ts +14 -0
- package/dist/solid/src/adapters/solid/components/screen/group_renderer.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/index.d.ts +7 -0
- package/dist/solid/src/adapters/solid/components/screen/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/loading_message.d.ts +6 -0
- package/dist/solid/src/adapters/solid/components/screen/loading_message.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/message_renderer.d.ts +6 -0
- package/dist/solid/src/adapters/solid/components/screen/message_renderer.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/progress_message.d.ts +6 -0
- package/dist/solid/src/adapters/solid/components/screen/progress_message.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/screen_bridge.d.ts +14 -0
- package/dist/solid/src/adapters/solid/components/screen/screen_bridge.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen/table_message.d.ts +6 -0
- package/dist/solid/src/adapters/solid/components/screen/table_message.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/screen_manager_bridge.d.ts +8 -0
- package/dist/solid/src/adapters/solid/components/screen_manager_bridge.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/sidebar/index.d.ts +4 -0
- package/dist/solid/src/adapters/solid/components/sidebar/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/sidebar/sidebar.d.ts +11 -0
- package/dist/solid/src/adapters/solid/components/sidebar/sidebar.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/sidebar/sidebar_item.d.ts +9 -0
- package/dist/solid/src/adapters/solid/components/sidebar/sidebar_item.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/components/sidebar/sidebar_separator.d.ts +2 -0
- package/dist/solid/src/adapters/solid/components/sidebar/sidebar_separator.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/context/index.d.ts +3 -0
- package/dist/solid/src/adapters/solid/context/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/context/logger_context.d.ts +52 -0
- package/dist/solid/src/adapters/solid/context/logger_context.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/hooks/index.d.ts +2 -0
- package/dist/solid/src/adapters/solid/hooks/index.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/hooks/use_theme.d.ts +7 -0
- package/dist/solid/src/adapters/solid/hooks/use_theme.d.ts.map +1 -0
- package/dist/solid/src/adapters/solid/index.d.ts +13 -0
- package/dist/solid/src/adapters/solid/index.d.ts.map +1 -0
- package/dist/solid/tsconfig.solid.tsbuildinfo +1 -0
- package/dist/tsconfig.base.tsbuildinfo +1 -0
- package/dist/tsconfig.react.tsbuildinfo +1 -0
- package/dist/tsconfig.solid.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/adapters/react/index.cjs +1768 -0
- package/lib/adapters/react/index.cjs.map +1 -0
- package/lib/adapters/react/index.d.cts +80 -0
- package/lib/adapters/react/index.d.mts +80 -0
- package/lib/adapters/react/index.mjs +1760 -0
- package/lib/adapters/react/index.mjs.map +1 -0
- package/lib/adapters/solid/index.cjs +3855 -0
- package/lib/adapters/solid/index.cjs.map +1 -0
- package/lib/adapters/solid/index.d.cts +74 -0
- package/lib/adapters/solid/index.d.mts +74 -0
- package/lib/adapters/solid/index.mjs +3847 -0
- package/lib/adapters/solid/index.mjs.map +1 -0
- package/lib/filter_engine-DXqu9Vaq.cjs +1836 -0
- package/lib/filter_engine-DXqu9Vaq.cjs.map +1 -0
- package/lib/filter_engine-DmqhEhpA.mjs +1609 -0
- package/lib/filter_engine-DmqhEhpA.mjs.map +1 -0
- package/lib/index.cjs +1424 -1125
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +263 -1152
- package/lib/index.d.mts +263 -1152
- package/lib/index.mjs +1378 -1070
- package/lib/index.mjs.map +1 -1
- package/lib/interface-CTHQ08aY.d.mts +699 -0
- package/lib/interface-DQEIz9Mb.d.cts +699 -0
- package/package.json +25 -1
- package/project.json +2 -2
- package/src/__tests__/components/__snapshots__/filter_bar.spec.tsx.snap +0 -2556
- package/src/__tests__/components/__snapshots__/loading_message.spec.tsx.snap +0 -1589
- package/src/__tests__/components/__snapshots__/log_message.spec.tsx.snap +0 -3681
- package/src/__tests__/components/__snapshots__/progress_message.spec.tsx.snap +0 -2002
- package/src/__tests__/components/__snapshots__/prompt_renderer.spec.tsx.snap +0 -3584
- package/src/__tests__/components/__snapshots__/sidebar.spec.tsx.snap +0 -3186
- package/src/__tests__/components/filter_bar.spec.tsx +1 -1
- package/src/__tests__/components/loading_message.spec.tsx +1 -1
- package/src/__tests__/components/log_message.spec.tsx +1 -1
- package/src/__tests__/components/progress_message.spec.tsx +1 -1
- package/src/__tests__/components/prompt_renderer.spec.tsx +1 -1
- package/src/__tests__/components/sidebar.spec.tsx +1 -1
- package/src/__tests__/utils/render-utils.tsx +1 -1
- package/src/adapters/index.ts +2 -0
- package/src/adapters/interface.ts +50 -0
- package/src/{components → adapters/react/components}/file/file_log.tsx +2 -2
- package/src/{components → adapters/react/components}/filter/filter_bar.tsx +2 -2
- package/src/{components → adapters/react/components}/help/help_overlay.tsx +2 -2
- package/src/{components → adapters/react/components}/log/log_message.tsx +2 -2
- package/src/{components → adapters/react/components}/prompt/prompt_renderer.tsx +1 -1
- package/src/{components → adapters/react/components}/screen/group_renderer.tsx +1 -1
- package/src/{components → adapters/react/components}/screen/loading_message.tsx +2 -3
- package/src/{components → adapters/react/components}/screen/message_renderer.tsx +1 -1
- package/src/{components → adapters/react/components}/screen/progress_message.tsx +1 -1
- package/src/{components → adapters/react/components}/screen/screen_bridge.tsx +2 -2
- package/src/{components → adapters/react/components}/screen/table_message.tsx +2 -2
- package/src/{components → adapters/react/components}/screen_manager_bridge.tsx +5 -5
- package/src/{components → adapters/react/components}/sidebar/sidebar.tsx +1 -1
- package/src/{components → adapters/react/components}/sidebar/sidebar_item.tsx +1 -1
- package/src/adapters/react/context/index.ts +1 -0
- package/src/{context → adapters/react/context}/logger_context.tsx +2 -2
- package/src/adapters/react/hooks/index.ts +1 -0
- package/src/{hooks → adapters/react/hooks}/use_theme.ts +1 -1
- package/src/adapters/react/index.ts +39 -0
- package/src/adapters/solid/components/file/file_log.tsx +221 -0
- package/src/adapters/solid/components/file/index.ts +1 -0
- package/src/adapters/solid/components/filter/filter_bar.tsx +84 -0
- package/src/adapters/solid/components/filter/index.ts +1 -0
- package/src/adapters/solid/components/help/help_overlay.tsx +106 -0
- package/src/adapters/solid/components/help/index.ts +1 -0
- package/src/adapters/solid/components/log/index.ts +1 -0
- package/src/adapters/solid/components/log/log_message.tsx +92 -0
- package/src/adapters/solid/components/prompt/index.ts +2 -0
- package/src/adapters/solid/components/prompt/prompt_renderer.tsx +350 -0
- package/src/adapters/solid/components/screen/group_renderer.tsx +61 -0
- package/src/adapters/solid/components/screen/index.ts +6 -0
- package/src/adapters/solid/components/screen/loading_message.tsx +39 -0
- package/src/adapters/solid/components/screen/message_renderer.tsx +122 -0
- package/src/adapters/solid/components/screen/progress_message.tsx +61 -0
- package/src/adapters/solid/components/screen/screen_bridge.tsx +155 -0
- package/src/adapters/solid/components/screen/table_message.tsx +58 -0
- package/src/adapters/solid/components/screen_manager_bridge.tsx +243 -0
- package/src/adapters/solid/components/sidebar/index.ts +3 -0
- package/src/adapters/solid/components/sidebar/sidebar.tsx +108 -0
- package/src/adapters/solid/components/sidebar/sidebar_item.tsx +55 -0
- package/src/adapters/solid/components/sidebar/sidebar_separator.tsx +13 -0
- package/src/adapters/solid/context/index.ts +2 -0
- package/src/adapters/solid/context/logger_context.tsx +95 -0
- package/src/adapters/solid/hooks/index.ts +1 -0
- package/src/adapters/solid/hooks/use_theme.ts +12 -0
- package/src/adapters/solid/index.tsx +43 -0
- package/src/adapters/solid/jsx.d.ts +98 -0
- package/src/components/index.ts +3 -15
- package/src/context/index.ts +3 -1
- package/src/factories/isomorphic-logger.factory.ts +1 -2
- package/src/factories/screen.factory.ts +2 -2
- package/src/hooks/index.ts +3 -1
- package/src/index.ts +5 -0
- package/src/keyboard/create_bindings.ts +2 -2
- package/src/overrides/index.ts +1 -0
- package/src/overrides/missing-adapter.override.ts +20 -0
- package/src/services/index.ts +1 -1
- package/src/services/screen.ts +3 -3
- package/src/services/{screen_manager.tsx → screen_manager.ts} +21 -10
- package/src/tokens/adapter.ts +10 -0
- package/src/tokens/index.ts +2 -0
- package/src/tokens/screen-manager.ts +9 -0
- package/tsconfig.base.json +31 -0
- package/tsconfig.json +6 -12
- package/tsconfig.react.json +16 -0
- package/tsconfig.solid.json +16 -0
- package/tsdown.config.mts +69 -16
- package/vitest.config.mts +20 -0
- package/lib/index.d.cts.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/screen_manager_bridge-Bk1i53h5.mjs +0 -3
- package/lib/screen_manager_bridge-BwPVr0bX.mjs +0 -3048
- package/lib/screen_manager_bridge-BwPVr0bX.mjs.map +0 -1
- package/lib/screen_manager_bridge-CWxLO0CK.cjs +0 -3371
- package/lib/screen_manager_bridge-CWxLO0CK.cjs.map +0 -1
- package/lib/screen_manager_bridge-DXc57iXW.cjs +0 -3
- /package/src/{components → adapters/react/components}/file/index.ts +0 -0
- /package/src/{components → adapters/react/components}/filter/index.ts +0 -0
- /package/src/{components → adapters/react/components}/help/index.ts +0 -0
- /package/src/{components → adapters/react/components}/log/index.ts +0 -0
- /package/src/{components → adapters/react/components}/prompt/index.ts +0 -0
- /package/src/{components → adapters/react/components}/screen/index.ts +0 -0
- /package/src/{components → adapters/react/components}/sidebar/index.ts +0 -0
- /package/src/{components → adapters/react/components}/sidebar/sidebar_separator.tsx +0 -0
|
@@ -0,0 +1,1768 @@
|
|
|
1
|
+
const require_filter_engine = require('../../filter_engine-DXqu9Vaq.cjs');
|
|
2
|
+
let _opentui_core = require("@opentui/core");
|
|
3
|
+
let _navios_core = require("@navios/core");
|
|
4
|
+
let _opentui_react = require("@opentui/react");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let _opentui_react_jsx_runtime = require("@opentui/react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/adapters/react/context/logger_context.tsx
|
|
9
|
+
const LoggerContext = /* @__PURE__ */ (0, react.createContext)(null);
|
|
10
|
+
/**
|
|
11
|
+
* LoggerProvider - Provides shared context for logger components.
|
|
12
|
+
*
|
|
13
|
+
* This context provides:
|
|
14
|
+
* - Shared SyntaxStyle instance for consistent code highlighting
|
|
15
|
+
* - Optional TreeSitterClient for advanced parsing
|
|
16
|
+
* - Theme configuration for consistent styling
|
|
17
|
+
* - Log level color configuration (for backwards compatibility)
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Using a preset theme
|
|
21
|
+
* <LoggerProvider theme="dark">
|
|
22
|
+
* <ScreenManager screens={screens} activeScreenId={activeId}>
|
|
23
|
+
* <Screen name="Logs">
|
|
24
|
+
* <LogMessage level="info">Hello</LogMessage>
|
|
25
|
+
* </Screen>
|
|
26
|
+
* </ScreenManager>
|
|
27
|
+
* </LoggerProvider>
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Using a custom theme
|
|
31
|
+
* <LoggerProvider theme={myCustomTheme}>
|
|
32
|
+
* ...
|
|
33
|
+
* </LoggerProvider>
|
|
34
|
+
*/ function LoggerProvider({ children, syntaxStyle: customSyntaxStyle, treeSitterClient, theme: themeProp = "dark", levelColors: customLevelColors }) {
|
|
35
|
+
const syntaxStyle = (0, react.useMemo)(() => customSyntaxStyle ?? _opentui_core.SyntaxStyle.create(), [customSyntaxStyle]);
|
|
36
|
+
const theme = (0, react.useMemo)(() => require_filter_engine.resolveTheme(themeProp), [themeProp]);
|
|
37
|
+
const levelColors = (0, react.useMemo)(() => ({
|
|
38
|
+
...theme.logLevels,
|
|
39
|
+
...customLevelColors
|
|
40
|
+
}), [theme.logLevels, customLevelColors]);
|
|
41
|
+
const value = (0, react.useMemo)(() => ({
|
|
42
|
+
syntaxStyle,
|
|
43
|
+
treeSitterClient,
|
|
44
|
+
levelColors,
|
|
45
|
+
theme
|
|
46
|
+
}), [
|
|
47
|
+
syntaxStyle,
|
|
48
|
+
treeSitterClient,
|
|
49
|
+
levelColors,
|
|
50
|
+
theme
|
|
51
|
+
]);
|
|
52
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(LoggerContext.Provider, {
|
|
53
|
+
value,
|
|
54
|
+
children
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Hook to access logger context.
|
|
59
|
+
* Returns default values if used outside LoggerProvider.
|
|
60
|
+
*/ function useLoggerContext() {
|
|
61
|
+
const context = (0, react.useContext)(LoggerContext);
|
|
62
|
+
if (!context) return {
|
|
63
|
+
syntaxStyle: void 0,
|
|
64
|
+
treeSitterClient: void 0,
|
|
65
|
+
levelColors: require_filter_engine.darkTheme.logLevels,
|
|
66
|
+
theme: require_filter_engine.darkTheme
|
|
67
|
+
};
|
|
68
|
+
return context;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/adapters/react/hooks/use_theme.ts
|
|
73
|
+
/**
|
|
74
|
+
* Hook to access the current theme.
|
|
75
|
+
* Returns the theme from LoggerContext.
|
|
76
|
+
*/ function useTheme() {
|
|
77
|
+
const { theme } = useLoggerContext();
|
|
78
|
+
return theme;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/adapters/react/components/filter/filter_bar.tsx
|
|
83
|
+
const LEVEL_LABELS = {
|
|
84
|
+
verbose: "V",
|
|
85
|
+
debug: "D",
|
|
86
|
+
log: "L",
|
|
87
|
+
warn: "W",
|
|
88
|
+
error: "E",
|
|
89
|
+
fatal: "F"
|
|
90
|
+
};
|
|
91
|
+
function FilterBar({ filter, levelCounts }) {
|
|
92
|
+
const theme = useTheme();
|
|
93
|
+
const isSearchFocused = filter.focusedField === "search";
|
|
94
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
95
|
+
flexDirection: "column",
|
|
96
|
+
backgroundColor: theme.filter.background,
|
|
97
|
+
borderColor: theme.filter.border,
|
|
98
|
+
border: ["bottom"],
|
|
99
|
+
paddingLeft: 1,
|
|
100
|
+
paddingRight: 1,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
103
|
+
flexDirection: "row",
|
|
104
|
+
gap: 1,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
107
|
+
fg: isSearchFocused ? theme.colors.primary : theme.filter.textDim,
|
|
108
|
+
children: "/"
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
111
|
+
fg: filter.searchQuery ? theme.filter.inputText : theme.filter.inputPlaceholder,
|
|
112
|
+
children: filter.searchQuery || "Search logs..."
|
|
113
|
+
}),
|
|
114
|
+
isSearchFocused && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
115
|
+
fg: theme.filter.cursor,
|
|
116
|
+
attributes: _opentui_core.TextAttributes.BLINK,
|
|
117
|
+
children: "_"
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
122
|
+
flexDirection: "row",
|
|
123
|
+
gap: 1,
|
|
124
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
125
|
+
fg: theme.filter.textDim,
|
|
126
|
+
children: "Levels:"
|
|
127
|
+
}), require_filter_engine.ALL_LOG_LEVELS.map((level, index) => {
|
|
128
|
+
const isEnabled = filter.enabledLevels.has(level);
|
|
129
|
+
const count = levelCounts[level];
|
|
130
|
+
const levelColor = theme.logLevels[level].border;
|
|
131
|
+
const isLevelsFocused = filter.focusedField === "levels";
|
|
132
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
133
|
+
flexDirection: "row",
|
|
134
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
135
|
+
fg: isEnabled ? levelColor : theme.filter.inactiveLevel,
|
|
136
|
+
attributes: isLevelsFocused ? _opentui_core.TextAttributes.BOLD : void 0,
|
|
137
|
+
children: [
|
|
138
|
+
index + 1,
|
|
139
|
+
":",
|
|
140
|
+
LEVEL_LABELS[level]
|
|
141
|
+
]
|
|
142
|
+
}), count > 0 && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
143
|
+
fg: theme.filter.textDim,
|
|
144
|
+
children: [
|
|
145
|
+
"(",
|
|
146
|
+
count > 99 ? "99+" : count,
|
|
147
|
+
")"
|
|
148
|
+
]
|
|
149
|
+
})]
|
|
150
|
+
}, level);
|
|
151
|
+
})]
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
154
|
+
flexDirection: "row",
|
|
155
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
156
|
+
fg: theme.filter.textDim,
|
|
157
|
+
children: "Tab: switch fields | 1-7: toggle levels | Esc: close"
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/adapters/react/components/help/help_overlay.tsx
|
|
166
|
+
const CATEGORY_ORDER = [
|
|
167
|
+
"general",
|
|
168
|
+
"navigation",
|
|
169
|
+
"screen",
|
|
170
|
+
"filter",
|
|
171
|
+
"prompt"
|
|
172
|
+
];
|
|
173
|
+
const CATEGORY_LABELS = {
|
|
174
|
+
general: "General",
|
|
175
|
+
navigation: "Navigation",
|
|
176
|
+
screen: "Screen",
|
|
177
|
+
filter: "Filter",
|
|
178
|
+
prompt: "Prompts"
|
|
179
|
+
};
|
|
180
|
+
function groupByCategory(bindings) {
|
|
181
|
+
const grouped = {
|
|
182
|
+
general: [],
|
|
183
|
+
navigation: [],
|
|
184
|
+
screen: [],
|
|
185
|
+
filter: [],
|
|
186
|
+
prompt: []
|
|
187
|
+
};
|
|
188
|
+
for (const binding of bindings) if (binding.description) grouped[binding.category].push(binding);
|
|
189
|
+
return grouped;
|
|
190
|
+
}
|
|
191
|
+
function HelpOverlay({ bindings }) {
|
|
192
|
+
const theme = useTheme();
|
|
193
|
+
const grouped = groupByCategory(bindings);
|
|
194
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
195
|
+
position: "absolute",
|
|
196
|
+
top: 1,
|
|
197
|
+
left: 2,
|
|
198
|
+
right: 2,
|
|
199
|
+
bottom: 1,
|
|
200
|
+
backgroundColor: theme.help.background,
|
|
201
|
+
borderColor: theme.help.border,
|
|
202
|
+
border: [
|
|
203
|
+
"top",
|
|
204
|
+
"bottom",
|
|
205
|
+
"left",
|
|
206
|
+
"right"
|
|
207
|
+
],
|
|
208
|
+
flexDirection: "column",
|
|
209
|
+
paddingLeft: 2,
|
|
210
|
+
paddingRight: 2,
|
|
211
|
+
paddingTop: 1,
|
|
212
|
+
paddingBottom: 1,
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
215
|
+
marginBottom: 1,
|
|
216
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
217
|
+
fg: theme.help.title,
|
|
218
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
219
|
+
children: "Keyboard Shortcuts"
|
|
220
|
+
})
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("scrollbox", {
|
|
223
|
+
scrollY: true,
|
|
224
|
+
flexGrow: 1,
|
|
225
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
226
|
+
flexDirection: "column",
|
|
227
|
+
gap: 1,
|
|
228
|
+
children: CATEGORY_ORDER.map((category) => {
|
|
229
|
+
const categoryBindings = grouped[category];
|
|
230
|
+
if (categoryBindings.length === 0) return null;
|
|
231
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
232
|
+
flexDirection: "column",
|
|
233
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
234
|
+
fg: theme.help.category,
|
|
235
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
236
|
+
children: CATEGORY_LABELS[category]
|
|
237
|
+
}), categoryBindings.map((binding, index) => /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
238
|
+
flexDirection: "row",
|
|
239
|
+
paddingLeft: 2,
|
|
240
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
241
|
+
fg: theme.help.key,
|
|
242
|
+
width: 14,
|
|
243
|
+
children: require_filter_engine.formatKeyBinding(binding)
|
|
244
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
245
|
+
fg: theme.help.description,
|
|
246
|
+
children: binding.description
|
|
247
|
+
})]
|
|
248
|
+
}, `${binding.key}-${index}`))]
|
|
249
|
+
}, category);
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
254
|
+
marginTop: 1,
|
|
255
|
+
borderColor: theme.separator.line,
|
|
256
|
+
border: ["top"],
|
|
257
|
+
paddingTop: 1,
|
|
258
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
259
|
+
fg: theme.help.hint,
|
|
260
|
+
children: "Press ? or Esc to close"
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/adapters/react/components/prompt/prompt_renderer.tsx
|
|
269
|
+
function PromptRenderer({ prompt }) {
|
|
270
|
+
const theme = useTheme();
|
|
271
|
+
const timeoutRemaining = getTimeoutRemaining(prompt);
|
|
272
|
+
switch (prompt.type) {
|
|
273
|
+
case "choice": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(ChoicePromptRenderer, {
|
|
274
|
+
prompt,
|
|
275
|
+
timeoutRemaining,
|
|
276
|
+
colors: theme.prompt
|
|
277
|
+
});
|
|
278
|
+
case "confirm": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(ConfirmPromptRenderer, {
|
|
279
|
+
prompt,
|
|
280
|
+
timeoutRemaining,
|
|
281
|
+
colors: theme.prompt
|
|
282
|
+
});
|
|
283
|
+
case "input": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(InputPromptRenderer, {
|
|
284
|
+
prompt,
|
|
285
|
+
timeoutRemaining,
|
|
286
|
+
colors: theme.prompt
|
|
287
|
+
});
|
|
288
|
+
case "multiChoice": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(MultiChoicePromptRenderer, {
|
|
289
|
+
prompt,
|
|
290
|
+
timeoutRemaining,
|
|
291
|
+
colors: theme.prompt
|
|
292
|
+
});
|
|
293
|
+
default: return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function getTimeoutRemaining(prompt) {
|
|
297
|
+
if (!prompt.timeout || !prompt.timeoutStarted) return null;
|
|
298
|
+
const elapsed = Date.now() - prompt.timeoutStarted;
|
|
299
|
+
const remaining = Math.max(0, prompt.timeout - elapsed);
|
|
300
|
+
return Math.ceil(remaining / 1e3);
|
|
301
|
+
}
|
|
302
|
+
function TimeoutIndicator({ seconds, colors }) {
|
|
303
|
+
if (seconds === null) return null;
|
|
304
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
305
|
+
fg: colors.optionTextDim,
|
|
306
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
307
|
+
children: [
|
|
308
|
+
" ",
|
|
309
|
+
"(auto-select in ",
|
|
310
|
+
seconds,
|
|
311
|
+
"s)"
|
|
312
|
+
]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function ChoicePromptRenderer({ prompt, timeoutRemaining, colors }) {
|
|
316
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
317
|
+
flexDirection: "column",
|
|
318
|
+
borderColor: colors.focusBorder,
|
|
319
|
+
border: ["left"],
|
|
320
|
+
paddingLeft: 1,
|
|
321
|
+
paddingRight: 1,
|
|
322
|
+
gap: 1,
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
325
|
+
flexDirection: "row",
|
|
326
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
327
|
+
fg: colors.question,
|
|
328
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
329
|
+
children: ["? ", prompt.question]
|
|
330
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(TimeoutIndicator, {
|
|
331
|
+
seconds: timeoutRemaining,
|
|
332
|
+
colors
|
|
333
|
+
})]
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
336
|
+
flexDirection: "column",
|
|
337
|
+
children: prompt.choices.map((choice, index) => {
|
|
338
|
+
const isSelected = index === prompt.selectedIndex;
|
|
339
|
+
const showInput = isSelected && choice.input && prompt.inputMode;
|
|
340
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
341
|
+
flexDirection: "row",
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
344
|
+
fg: isSelected ? colors.optionSelected : "transparent",
|
|
345
|
+
children: [">", " "]
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
348
|
+
fg: isSelected ? colors.optionText : colors.optionTextDim,
|
|
349
|
+
attributes: isSelected ? _opentui_core.TextAttributes.BOLD : void 0,
|
|
350
|
+
children: choice.label
|
|
351
|
+
}),
|
|
352
|
+
showInput && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
353
|
+
flexDirection: "row",
|
|
354
|
+
marginLeft: 1,
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
357
|
+
fg: colors.inputText,
|
|
358
|
+
children: ": "
|
|
359
|
+
}),
|
|
360
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
361
|
+
fg: colors.inputText,
|
|
362
|
+
children: prompt.inputValue
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
365
|
+
fg: colors.inputCursor,
|
|
366
|
+
attributes: _opentui_core.TextAttributes.BLINK,
|
|
367
|
+
children: "_"
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
}),
|
|
371
|
+
isSelected && choice.input && !prompt.inputMode && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
372
|
+
fg: colors.optionTextDim,
|
|
373
|
+
children: " (press Enter to type)"
|
|
374
|
+
})
|
|
375
|
+
]
|
|
376
|
+
}, choice.value);
|
|
377
|
+
})
|
|
378
|
+
}),
|
|
379
|
+
prompt.inputMode ? /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
380
|
+
fg: colors.optionTextDim,
|
|
381
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
382
|
+
children: "Type your answer, Enter to submit, Esc to cancel"
|
|
383
|
+
}) : /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
384
|
+
fg: colors.optionTextDim,
|
|
385
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
386
|
+
children: "↑/↓ to navigate, Enter to select"
|
|
387
|
+
})
|
|
388
|
+
]
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function ConfirmPromptRenderer({ prompt, timeoutRemaining, colors }) {
|
|
392
|
+
const confirmSelected = prompt.selectedValue === true;
|
|
393
|
+
const cancelSelected = prompt.selectedValue === false;
|
|
394
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
395
|
+
flexDirection: "column",
|
|
396
|
+
borderColor: colors.focusBorder,
|
|
397
|
+
border: ["left"],
|
|
398
|
+
paddingLeft: 1,
|
|
399
|
+
paddingRight: 1,
|
|
400
|
+
gap: 1,
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
403
|
+
flexDirection: "row",
|
|
404
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
405
|
+
fg: colors.question,
|
|
406
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
407
|
+
children: ["? ", prompt.question]
|
|
408
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(TimeoutIndicator, {
|
|
409
|
+
seconds: timeoutRemaining,
|
|
410
|
+
colors
|
|
411
|
+
})]
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
414
|
+
flexDirection: "row",
|
|
415
|
+
gap: 2,
|
|
416
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
417
|
+
backgroundColor: confirmSelected ? colors.buttonSelectedBackground : void 0,
|
|
418
|
+
paddingLeft: 1,
|
|
419
|
+
paddingRight: 1,
|
|
420
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
421
|
+
fg: confirmSelected ? colors.confirmButton : colors.optionTextDim,
|
|
422
|
+
attributes: confirmSelected ? _opentui_core.TextAttributes.BOLD : void 0,
|
|
423
|
+
children: [
|
|
424
|
+
confirmSelected ? ">" : " ",
|
|
425
|
+
" ",
|
|
426
|
+
prompt.confirmText
|
|
427
|
+
]
|
|
428
|
+
})
|
|
429
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
430
|
+
backgroundColor: cancelSelected ? colors.buttonSelectedBackground : void 0,
|
|
431
|
+
paddingLeft: 1,
|
|
432
|
+
paddingRight: 1,
|
|
433
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
434
|
+
fg: cancelSelected ? colors.cancelButton : colors.optionTextDim,
|
|
435
|
+
attributes: cancelSelected ? _opentui_core.TextAttributes.BOLD : void 0,
|
|
436
|
+
children: [
|
|
437
|
+
cancelSelected ? ">" : " ",
|
|
438
|
+
" ",
|
|
439
|
+
prompt.cancelText
|
|
440
|
+
]
|
|
441
|
+
})
|
|
442
|
+
})]
|
|
443
|
+
}),
|
|
444
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
445
|
+
fg: colors.optionTextDim,
|
|
446
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
447
|
+
children: "←/→ to select, Enter to confirm"
|
|
448
|
+
})
|
|
449
|
+
]
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function InputPromptRenderer({ prompt, timeoutRemaining, colors }) {
|
|
453
|
+
const hasValue = prompt.value.length > 0;
|
|
454
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
455
|
+
flexDirection: "column",
|
|
456
|
+
borderColor: colors.focusBorder,
|
|
457
|
+
border: ["left"],
|
|
458
|
+
paddingLeft: 1,
|
|
459
|
+
paddingRight: 1,
|
|
460
|
+
gap: 1,
|
|
461
|
+
children: [
|
|
462
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
463
|
+
flexDirection: "row",
|
|
464
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
465
|
+
fg: colors.question,
|
|
466
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
467
|
+
children: ["? ", prompt.question]
|
|
468
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(TimeoutIndicator, {
|
|
469
|
+
seconds: timeoutRemaining,
|
|
470
|
+
colors
|
|
471
|
+
})]
|
|
472
|
+
}),
|
|
473
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
474
|
+
flexDirection: "row",
|
|
475
|
+
borderColor: colors.inputBorder,
|
|
476
|
+
border: ["left"],
|
|
477
|
+
paddingLeft: 1,
|
|
478
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
479
|
+
fg: hasValue ? colors.inputText : colors.inputPlaceholder,
|
|
480
|
+
children: hasValue ? prompt.value : prompt.placeholder
|
|
481
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
482
|
+
fg: colors.inputCursor,
|
|
483
|
+
attributes: _opentui_core.TextAttributes.BLINK,
|
|
484
|
+
children: "_"
|
|
485
|
+
})]
|
|
486
|
+
}),
|
|
487
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
488
|
+
fg: colors.optionTextDim,
|
|
489
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
490
|
+
children: "Type your answer, Enter to submit"
|
|
491
|
+
})
|
|
492
|
+
]
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
function MultiChoicePromptRenderer({ prompt, timeoutRemaining, colors }) {
|
|
496
|
+
const selectedCount = prompt.selectedIndices.size;
|
|
497
|
+
const canSubmit = selectedCount >= prompt.minSelect;
|
|
498
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
499
|
+
flexDirection: "column",
|
|
500
|
+
borderColor: colors.focusBorder,
|
|
501
|
+
border: ["left"],
|
|
502
|
+
paddingLeft: 1,
|
|
503
|
+
paddingRight: 1,
|
|
504
|
+
gap: 1,
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
507
|
+
flexDirection: "row",
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
510
|
+
fg: colors.question,
|
|
511
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
512
|
+
children: ["? ", prompt.question]
|
|
513
|
+
}),
|
|
514
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
515
|
+
fg: colors.optionTextDim,
|
|
516
|
+
children: [
|
|
517
|
+
" ",
|
|
518
|
+
"(",
|
|
519
|
+
selectedCount,
|
|
520
|
+
"/",
|
|
521
|
+
prompt.maxSelect,
|
|
522
|
+
" selected)"
|
|
523
|
+
]
|
|
524
|
+
}),
|
|
525
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(TimeoutIndicator, {
|
|
526
|
+
seconds: timeoutRemaining,
|
|
527
|
+
colors
|
|
528
|
+
})
|
|
529
|
+
]
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
532
|
+
flexDirection: "column",
|
|
533
|
+
children: prompt.choices.map((choice, index) => {
|
|
534
|
+
const isFocused = index === prompt.focusedIndex;
|
|
535
|
+
const isChecked = prompt.selectedIndices.has(index);
|
|
536
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
537
|
+
flexDirection: "row",
|
|
538
|
+
children: [
|
|
539
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
540
|
+
fg: isFocused ? colors.optionSelected : "transparent",
|
|
541
|
+
children: [">", " "]
|
|
542
|
+
}),
|
|
543
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
544
|
+
fg: isChecked ? colors.optionSelected : colors.optionTextDim,
|
|
545
|
+
children: [isChecked ? "[✓]" : "[ ]", " "]
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
548
|
+
fg: isFocused ? colors.optionText : colors.optionTextDim,
|
|
549
|
+
attributes: isFocused ? _opentui_core.TextAttributes.BOLD : void 0,
|
|
550
|
+
children: choice.label
|
|
551
|
+
})
|
|
552
|
+
]
|
|
553
|
+
}, choice.value);
|
|
554
|
+
})
|
|
555
|
+
}),
|
|
556
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
557
|
+
flexDirection: "column",
|
|
558
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
559
|
+
fg: colors.optionTextDim,
|
|
560
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
561
|
+
children: "↑/↓ to navigate, Space to toggle"
|
|
562
|
+
}), canSubmit ? /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
563
|
+
fg: colors.optionTextDim,
|
|
564
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
565
|
+
children: "Enter to confirm"
|
|
566
|
+
}) : /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
567
|
+
fg: colors.cancelButton,
|
|
568
|
+
attributes: _opentui_core.TextAttributes.DIM,
|
|
569
|
+
children: [
|
|
570
|
+
"Select at least ",
|
|
571
|
+
prompt.minSelect,
|
|
572
|
+
" option",
|
|
573
|
+
prompt.minSelect > 1 ? "s" : ""
|
|
574
|
+
]
|
|
575
|
+
})]
|
|
576
|
+
})
|
|
577
|
+
]
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/adapters/react/components/file/file_log.tsx
|
|
583
|
+
/**
|
|
584
|
+
* FileLog - Displays file content, diffs, or partial files with error highlighting.
|
|
585
|
+
*
|
|
586
|
+
* Three modes:
|
|
587
|
+
* 1. "full" - Display complete file with syntax highlighting
|
|
588
|
+
* 2. "diff" - Display unified diff using <diff> component
|
|
589
|
+
* 3. "partial" - Display file excerpt with optional error line highlighting
|
|
590
|
+
*
|
|
591
|
+
* @example Full file
|
|
592
|
+
* <FileLog
|
|
593
|
+
* mode="full"
|
|
594
|
+
* filePath="src/index.ts"
|
|
595
|
+
* content={fileContent}
|
|
596
|
+
* />
|
|
597
|
+
*
|
|
598
|
+
* @example Diff
|
|
599
|
+
* <FileLog
|
|
600
|
+
* mode="diff"
|
|
601
|
+
* filePath="src/api.ts"
|
|
602
|
+
* diff={unifiedDiff}
|
|
603
|
+
* view="unified"
|
|
604
|
+
* />
|
|
605
|
+
*
|
|
606
|
+
* @example Partial with error
|
|
607
|
+
* <FileLog
|
|
608
|
+
* mode="partial"
|
|
609
|
+
* filePath="src/utils.ts"
|
|
610
|
+
* content={excerpt}
|
|
611
|
+
* startLine={42}
|
|
612
|
+
* errorLines={[45, 46]}
|
|
613
|
+
* />
|
|
614
|
+
*/ function FileLog(props) {
|
|
615
|
+
const { syntaxStyle, treeSitterClient } = useLoggerContext();
|
|
616
|
+
const filetype = props.filetype ?? require_filter_engine.resolveFiletype(props.filePath);
|
|
617
|
+
const showHeader = props.showHeader ?? true;
|
|
618
|
+
const showLineNumbers = props.showLineNumbers ?? true;
|
|
619
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
620
|
+
flexDirection: "column",
|
|
621
|
+
marginBottom: 1,
|
|
622
|
+
children: [
|
|
623
|
+
showHeader && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
624
|
+
backgroundColor: props.headerBackgroundColor ?? require_filter_engine.HEADER_COLORS.background,
|
|
625
|
+
paddingLeft: 1,
|
|
626
|
+
paddingRight: 1,
|
|
627
|
+
border: ["bottom"],
|
|
628
|
+
borderColor: require_filter_engine.HEADER_COLORS.border,
|
|
629
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
630
|
+
fg: require_filter_engine.HEADER_COLORS.text,
|
|
631
|
+
children: props.filePath
|
|
632
|
+
})
|
|
633
|
+
}),
|
|
634
|
+
props.mode === "full" && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FileLogFull, {
|
|
635
|
+
...props,
|
|
636
|
+
filetype,
|
|
637
|
+
syntaxStyle,
|
|
638
|
+
treeSitterClient,
|
|
639
|
+
showLineNumbers
|
|
640
|
+
}),
|
|
641
|
+
props.mode === "diff" && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FileLogDiff, {
|
|
642
|
+
...props,
|
|
643
|
+
filetype,
|
|
644
|
+
syntaxStyle,
|
|
645
|
+
treeSitterClient
|
|
646
|
+
}),
|
|
647
|
+
props.mode === "partial" && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FileLogPartial, {
|
|
648
|
+
...props,
|
|
649
|
+
filetype,
|
|
650
|
+
syntaxStyle,
|
|
651
|
+
treeSitterClient,
|
|
652
|
+
showLineNumbers
|
|
653
|
+
})
|
|
654
|
+
]
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Full file display with syntax highlighting.
|
|
659
|
+
*/ function FileLogFull({ content, filetype, syntaxStyle, treeSitterClient }) {
|
|
660
|
+
if (!syntaxStyle) return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
661
|
+
paddingLeft: 1,
|
|
662
|
+
paddingRight: 1,
|
|
663
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", { children: content })
|
|
664
|
+
});
|
|
665
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("code", {
|
|
666
|
+
content,
|
|
667
|
+
filetype,
|
|
668
|
+
syntaxStyle,
|
|
669
|
+
treeSitterClient
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Diff display using the built-in <diff> component.
|
|
674
|
+
*/ function FileLogDiff({ diff, view = "unified", filetype, syntaxStyle, treeSitterClient }) {
|
|
675
|
+
if (!syntaxStyle) return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
676
|
+
paddingLeft: 1,
|
|
677
|
+
paddingRight: 1,
|
|
678
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", { children: diff })
|
|
679
|
+
});
|
|
680
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("diff", {
|
|
681
|
+
diff,
|
|
682
|
+
view,
|
|
683
|
+
filetype,
|
|
684
|
+
syntaxStyle,
|
|
685
|
+
treeSitterClient
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Partial file display with error line highlighting.
|
|
690
|
+
*
|
|
691
|
+
* This component renders a file excerpt and highlights specific lines
|
|
692
|
+
* as errors using box overlays with colored backgrounds.
|
|
693
|
+
*/ function FileLogPartial({ content, startLine, errorLines = [], errorLineBackground, errorLineBorderColor, filetype, syntaxStyle, treeSitterClient, showLineNumbers }) {
|
|
694
|
+
const lines = (0, react.useMemo)(() => content.split("\n"), [content]);
|
|
695
|
+
const errorLineSet = (0, react.useMemo)(() => new Set(errorLines), [errorLines]);
|
|
696
|
+
const errorBg = errorLineBackground ?? require_filter_engine.ERROR_HIGHLIGHT_COLORS.background;
|
|
697
|
+
const errorBorder = errorLineBorderColor ?? require_filter_engine.ERROR_HIGHLIGHT_COLORS.border;
|
|
698
|
+
const maxLineNum = startLine + lines.length - 1;
|
|
699
|
+
const lineNumWidth = Math.max(4, String(maxLineNum).length + 1);
|
|
700
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
701
|
+
flexDirection: "column",
|
|
702
|
+
children: lines.map((line, index) => {
|
|
703
|
+
const lineNumber = startLine + index;
|
|
704
|
+
const isError = errorLineSet.has(lineNumber);
|
|
705
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
706
|
+
flexDirection: "row",
|
|
707
|
+
backgroundColor: isError ? errorBg : void 0,
|
|
708
|
+
border: isError ? ["left"] : void 0,
|
|
709
|
+
borderColor: isError ? errorBorder : void 0,
|
|
710
|
+
children: [showLineNumbers && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
711
|
+
width: lineNumWidth,
|
|
712
|
+
backgroundColor: isError ? require_filter_engine.ERROR_HIGHLIGHT_COLORS.gutterBackground : require_filter_engine.HEADER_COLORS.background,
|
|
713
|
+
paddingRight: 1,
|
|
714
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
715
|
+
fg: "#6B7280",
|
|
716
|
+
children: String(lineNumber).padStart(lineNumWidth - 1)
|
|
717
|
+
})
|
|
718
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
719
|
+
flexGrow: 1,
|
|
720
|
+
paddingLeft: 1,
|
|
721
|
+
children: syntaxStyle ? /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("code", {
|
|
722
|
+
content: line,
|
|
723
|
+
filetype,
|
|
724
|
+
syntaxStyle,
|
|
725
|
+
treeSitterClient
|
|
726
|
+
}) : /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", { children: line })
|
|
727
|
+
})]
|
|
728
|
+
}, lineNumber);
|
|
729
|
+
})
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region src/adapters/react/components/log/log_message.tsx
|
|
735
|
+
/**
|
|
736
|
+
* LogMessage - A chat-like styled log message with level-based coloring.
|
|
737
|
+
*
|
|
738
|
+
* Features:
|
|
739
|
+
* - Left border with prominent color based on log level
|
|
740
|
+
* - Subtle tinted background matching the log level
|
|
741
|
+
* - Optional timestamp and label display
|
|
742
|
+
* - Supports both simple text and complex React children
|
|
743
|
+
* - Optional variant for semantic styling (e.g., 'success', 'trace')
|
|
744
|
+
*
|
|
745
|
+
* @example
|
|
746
|
+
* <LogMessage level="error">
|
|
747
|
+
* Connection failed: timeout after 30s
|
|
748
|
+
* </LogMessage>
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* <LogMessage level="log" timestamp={new Date()} label="API">
|
|
752
|
+
* Request completed successfully
|
|
753
|
+
* </LogMessage>
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* <LogMessage level="log" variant="success">
|
|
757
|
+
* Operation completed successfully
|
|
758
|
+
* </LogMessage>
|
|
759
|
+
*/ function LogMessage({ level, variant, children, timestamp, label, trace, borderColor: customBorderColor, backgroundColor: customBackgroundColor, borderStyle = "thin", padding = 1, margin = 0 }) {
|
|
760
|
+
const theme = useTheme();
|
|
761
|
+
const levelColors = variant ? require_filter_engine.VARIANT_COLORS[variant] : theme.logLevels[level];
|
|
762
|
+
const borderColor = customBorderColor ?? levelColors.border;
|
|
763
|
+
const backgroundColor = customBackgroundColor ?? levelColors.background;
|
|
764
|
+
const textColor = levelColors.text ?? theme.colors.foreground;
|
|
765
|
+
const borderSides = borderStyle === "thin" ? ["left"] : [
|
|
766
|
+
"left",
|
|
767
|
+
"top",
|
|
768
|
+
"bottom"
|
|
769
|
+
];
|
|
770
|
+
const formattedTimestamp = timestamp ? timestamp instanceof Date ? timestamp.toLocaleTimeString() : timestamp : null;
|
|
771
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
772
|
+
flexDirection: "column",
|
|
773
|
+
border: borderSides,
|
|
774
|
+
borderColor,
|
|
775
|
+
backgroundColor,
|
|
776
|
+
paddingLeft: padding,
|
|
777
|
+
paddingRight: padding,
|
|
778
|
+
marginBottom: margin,
|
|
779
|
+
children: [
|
|
780
|
+
(formattedTimestamp || label) && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
781
|
+
flexDirection: "row",
|
|
782
|
+
gap: 1,
|
|
783
|
+
children: [formattedTimestamp && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
784
|
+
fg: theme.colors.muted,
|
|
785
|
+
children: formattedTimestamp
|
|
786
|
+
}), label && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
787
|
+
fg: levelColors.border,
|
|
788
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
789
|
+
children: [
|
|
790
|
+
"[",
|
|
791
|
+
label,
|
|
792
|
+
"]"
|
|
793
|
+
]
|
|
794
|
+
})]
|
|
795
|
+
}),
|
|
796
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
797
|
+
fg: textColor,
|
|
798
|
+
children
|
|
799
|
+
}),
|
|
800
|
+
trace && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
801
|
+
marginTop: 1,
|
|
802
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
803
|
+
fg: theme.colors.muted,
|
|
804
|
+
children: trace
|
|
805
|
+
})
|
|
806
|
+
})
|
|
807
|
+
]
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
//#endregion
|
|
812
|
+
//#region src/adapters/react/components/screen/loading_message.tsx
|
|
813
|
+
const SPINNER_FRAMES = [
|
|
814
|
+
"⠋",
|
|
815
|
+
"⠙",
|
|
816
|
+
"⠹",
|
|
817
|
+
"⠸",
|
|
818
|
+
"⠼",
|
|
819
|
+
"⠴",
|
|
820
|
+
"⠦",
|
|
821
|
+
"⠧",
|
|
822
|
+
"⠇",
|
|
823
|
+
"⠏"
|
|
824
|
+
];
|
|
825
|
+
function LoadingMessage({ message }) {
|
|
826
|
+
const [frameIndex, setFrameIndex] = (0, react.useState)(0);
|
|
827
|
+
const intervalRef = (0, react.useRef)(null);
|
|
828
|
+
(0, react.useEffect)(() => {
|
|
829
|
+
if (message.status === "loading") intervalRef.current = setInterval(() => {
|
|
830
|
+
setFrameIndex((prev) => (prev + 1) % SPINNER_FRAMES.length);
|
|
831
|
+
}, 80);
|
|
832
|
+
return () => {
|
|
833
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
834
|
+
};
|
|
835
|
+
}, [message.status]);
|
|
836
|
+
const level = message.status === "fail" ? "error" : "log";
|
|
837
|
+
const variant = message.status === "success" ? "success" : void 0;
|
|
838
|
+
const displayContent = message.resolvedContent ?? message.content;
|
|
839
|
+
const spinner = message.status === "loading" ? SPINNER_FRAMES[frameIndex] + " " : "";
|
|
840
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(LogMessage, {
|
|
841
|
+
level,
|
|
842
|
+
variant,
|
|
843
|
+
timestamp: message.timestamp,
|
|
844
|
+
children: spinner + displayContent
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/adapters/react/components/screen/progress_message.tsx
|
|
850
|
+
function ProgressMessage({ message }) {
|
|
851
|
+
const theme = useTheme();
|
|
852
|
+
const percent = Math.round(message.current / message.total * 100);
|
|
853
|
+
const barWidth = 20;
|
|
854
|
+
const filled = Math.round(percent / 100 * barWidth);
|
|
855
|
+
const empty = barWidth - filled;
|
|
856
|
+
const barFilled = "█".repeat(filled);
|
|
857
|
+
const barEmpty = "░".repeat(empty);
|
|
858
|
+
const borderColor = message.status === "complete" ? theme.progress.complete : message.status === "failed" ? theme.progress.failed : theme.progress.border;
|
|
859
|
+
const backgroundColor = message.status === "complete" ? theme.progress.completeBackground : message.status === "failed" ? theme.progress.failedBackground : theme.progress.background;
|
|
860
|
+
const barColor = message.status === "complete" ? theme.progress.complete : message.status === "failed" ? theme.progress.failed : theme.progress.barFilled;
|
|
861
|
+
const displayLabel = message.resolvedContent ?? message.label;
|
|
862
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
863
|
+
flexDirection: "column",
|
|
864
|
+
border: ["left"],
|
|
865
|
+
borderColor,
|
|
866
|
+
backgroundColor,
|
|
867
|
+
paddingLeft: 1,
|
|
868
|
+
paddingRight: 1,
|
|
869
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
870
|
+
flexDirection: "row",
|
|
871
|
+
gap: 1,
|
|
872
|
+
children: [
|
|
873
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
874
|
+
fg: barColor,
|
|
875
|
+
children: ["[", barFilled]
|
|
876
|
+
}),
|
|
877
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
878
|
+
fg: theme.progress.barEmpty,
|
|
879
|
+
children: [barEmpty, "]"]
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
882
|
+
fg: theme.progress.textDim,
|
|
883
|
+
children: [percent, "%"]
|
|
884
|
+
}),
|
|
885
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
886
|
+
fg: theme.progress.text,
|
|
887
|
+
children: displayLabel
|
|
888
|
+
})
|
|
889
|
+
]
|
|
890
|
+
})
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
//#endregion
|
|
895
|
+
//#region src/adapters/react/components/screen/table_message.tsx
|
|
896
|
+
function TableMessage({ message }) {
|
|
897
|
+
const colWidths = message.headers.map((h, i) => {
|
|
898
|
+
const headerLen = h.length;
|
|
899
|
+
const maxRowLen = message.rows.length > 0 ? Math.max(...message.rows.map((r) => (r[i] ?? "").length)) : 0;
|
|
900
|
+
return Math.max(headerLen, maxRowLen);
|
|
901
|
+
});
|
|
902
|
+
const pad = (str, width) => str.padEnd(width);
|
|
903
|
+
const headerRow = message.headers.map((h, i) => pad(h, colWidths[i] ?? 0)).join(" │ ");
|
|
904
|
+
const separator = colWidths.map((w) => "─".repeat(w)).join("─┼─");
|
|
905
|
+
const dataRows = message.rows.map((row) => row.map((cell, i) => pad(cell, colWidths[i] ?? 0)).join(" │ "));
|
|
906
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
907
|
+
flexDirection: "column",
|
|
908
|
+
border: ["left"],
|
|
909
|
+
borderColor: require_filter_engine.TABLE_COLORS.border,
|
|
910
|
+
backgroundColor: require_filter_engine.TABLE_COLORS.background,
|
|
911
|
+
paddingLeft: 1,
|
|
912
|
+
paddingRight: 1,
|
|
913
|
+
children: [
|
|
914
|
+
message.title && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
915
|
+
fg: require_filter_engine.TABLE_COLORS.title,
|
|
916
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
917
|
+
children: message.title
|
|
918
|
+
}),
|
|
919
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
920
|
+
fg: require_filter_engine.TABLE_COLORS.headerText,
|
|
921
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
922
|
+
children: headerRow
|
|
923
|
+
}),
|
|
924
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
925
|
+
fg: require_filter_engine.TABLE_COLORS.separator,
|
|
926
|
+
children: separator
|
|
927
|
+
}),
|
|
928
|
+
dataRows.map((row, i) => /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
929
|
+
fg: require_filter_engine.TABLE_COLORS.cellText,
|
|
930
|
+
children: row
|
|
931
|
+
}, i))
|
|
932
|
+
]
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region src/adapters/react/components/screen/message_renderer.tsx
|
|
938
|
+
function MessageRenderer({ message }) {
|
|
939
|
+
const theme = useTheme();
|
|
940
|
+
switch (message.type) {
|
|
941
|
+
case "log": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(LogMessage, {
|
|
942
|
+
level: message.level,
|
|
943
|
+
timestamp: message.timestamp,
|
|
944
|
+
variant: message.variant,
|
|
945
|
+
label: message.label,
|
|
946
|
+
trace: message.trace,
|
|
947
|
+
children: message.content
|
|
948
|
+
});
|
|
949
|
+
case "file": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
950
|
+
flexDirection: "column",
|
|
951
|
+
border: ["left"],
|
|
952
|
+
borderColor: theme.file.border,
|
|
953
|
+
backgroundColor: theme.file.background,
|
|
954
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FileLog, {
|
|
955
|
+
mode: "full",
|
|
956
|
+
filePath: message.filePath,
|
|
957
|
+
content: message.content,
|
|
958
|
+
headerBackgroundColor: theme.file.headerBackground
|
|
959
|
+
})
|
|
960
|
+
});
|
|
961
|
+
case "diff": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
962
|
+
flexDirection: "column",
|
|
963
|
+
border: ["left"],
|
|
964
|
+
borderColor: theme.file.border,
|
|
965
|
+
backgroundColor: theme.file.background,
|
|
966
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FileLog, {
|
|
967
|
+
mode: "diff",
|
|
968
|
+
filePath: message.filePath,
|
|
969
|
+
diff: message.diff,
|
|
970
|
+
view: message.view,
|
|
971
|
+
headerBackgroundColor: theme.file.headerBackground
|
|
972
|
+
})
|
|
973
|
+
});
|
|
974
|
+
case "fileError": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
975
|
+
flexDirection: "column",
|
|
976
|
+
border: ["left"],
|
|
977
|
+
borderColor: theme.file.border,
|
|
978
|
+
backgroundColor: theme.file.background,
|
|
979
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FileLog, {
|
|
980
|
+
mode: "partial",
|
|
981
|
+
filePath: message.filePath,
|
|
982
|
+
content: message.content,
|
|
983
|
+
startLine: message.startLine,
|
|
984
|
+
errorLines: message.errorLines,
|
|
985
|
+
headerBackgroundColor: theme.file.headerBackground
|
|
986
|
+
})
|
|
987
|
+
});
|
|
988
|
+
case "loading": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(LoadingMessage, { message });
|
|
989
|
+
case "progress": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(ProgressMessage, { message });
|
|
990
|
+
case "group": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(GroupMessageRenderer, { message });
|
|
991
|
+
case "table": return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(TableMessage, { message });
|
|
992
|
+
default: return null;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region src/adapters/react/components/screen/group_renderer.tsx
|
|
998
|
+
function GroupRenderer({ label, messages }) {
|
|
999
|
+
const theme = useTheme();
|
|
1000
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1001
|
+
flexDirection: "column",
|
|
1002
|
+
border: ["left"],
|
|
1003
|
+
borderColor: theme.group.border,
|
|
1004
|
+
backgroundColor: theme.group.background,
|
|
1005
|
+
paddingLeft: 1,
|
|
1006
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1007
|
+
flexDirection: "row",
|
|
1008
|
+
marginBottom: 1,
|
|
1009
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1010
|
+
fg: theme.group.icon,
|
|
1011
|
+
children: "▼ "
|
|
1012
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1013
|
+
fg: theme.group.headerText,
|
|
1014
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
1015
|
+
children: label
|
|
1016
|
+
})]
|
|
1017
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
1018
|
+
flexDirection: "column",
|
|
1019
|
+
gap: 1,
|
|
1020
|
+
children: messages.map((msg) => /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(MessageRenderer, { message: msg }, msg.id))
|
|
1021
|
+
})]
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Fallback renderer for group markers (when not processed at higher level)
|
|
1026
|
+
*/ function GroupMessageRenderer({ message }) {
|
|
1027
|
+
const theme = useTheme();
|
|
1028
|
+
if (message.isEnd) return null;
|
|
1029
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
1030
|
+
flexDirection: "row",
|
|
1031
|
+
borderColor: theme.group.border,
|
|
1032
|
+
border: ["left"],
|
|
1033
|
+
paddingLeft: 1,
|
|
1034
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
1035
|
+
fg: theme.group.headerText,
|
|
1036
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
1037
|
+
children: ["▼ ", message.label]
|
|
1038
|
+
})
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/adapters/react/components/screen/screen_bridge.tsx
|
|
1044
|
+
function processMessagesIntoGroups(messages) {
|
|
1045
|
+
const result = [];
|
|
1046
|
+
let i = 0;
|
|
1047
|
+
while (i < messages.length) {
|
|
1048
|
+
const msg = messages[i];
|
|
1049
|
+
if (msg.type === "group" && !msg.isEnd) {
|
|
1050
|
+
const groupLabel = msg.label;
|
|
1051
|
+
const groupMessages = [];
|
|
1052
|
+
i++;
|
|
1053
|
+
while (i < messages.length) {
|
|
1054
|
+
const innerMsg = messages[i];
|
|
1055
|
+
if (innerMsg.type === "group" && innerMsg.isEnd) {
|
|
1056
|
+
i++;
|
|
1057
|
+
break;
|
|
1058
|
+
}
|
|
1059
|
+
groupMessages.push(innerMsg);
|
|
1060
|
+
i++;
|
|
1061
|
+
}
|
|
1062
|
+
result.push({
|
|
1063
|
+
type: "group",
|
|
1064
|
+
label: groupLabel,
|
|
1065
|
+
messages: groupMessages
|
|
1066
|
+
});
|
|
1067
|
+
} else if (msg.type === "group" && msg.isEnd) i++;
|
|
1068
|
+
else {
|
|
1069
|
+
result.push({
|
|
1070
|
+
type: "single",
|
|
1071
|
+
message: msg
|
|
1072
|
+
});
|
|
1073
|
+
i++;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
return result;
|
|
1077
|
+
}
|
|
1078
|
+
function ScreenBridge({ screen, focused, filteredMessages, isFiltering, totalMessages }) {
|
|
1079
|
+
const theme = useTheme();
|
|
1080
|
+
const [, forceUpdate] = (0, react.useState)({});
|
|
1081
|
+
(0, react.useEffect)(() => {
|
|
1082
|
+
return screen.onChange(() => forceUpdate({}));
|
|
1083
|
+
}, [screen]);
|
|
1084
|
+
const messages = filteredMessages ?? screen.getMessages();
|
|
1085
|
+
const activePrompt = screen.getActivePrompt();
|
|
1086
|
+
const processedMessages = processMessagesIntoGroups(messages);
|
|
1087
|
+
const filteredCount = messages.length;
|
|
1088
|
+
const total = totalMessages ?? messages.length;
|
|
1089
|
+
const showFilterStatus = isFiltering && filteredCount !== total;
|
|
1090
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1091
|
+
flexDirection: "column",
|
|
1092
|
+
flexGrow: 1,
|
|
1093
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1094
|
+
backgroundColor: theme.header.background,
|
|
1095
|
+
borderColor: focused ? theme.sidebar.focusBorder : theme.header.border,
|
|
1096
|
+
border: ["bottom"],
|
|
1097
|
+
paddingLeft: 1,
|
|
1098
|
+
paddingRight: 1,
|
|
1099
|
+
flexDirection: "row",
|
|
1100
|
+
justifyContent: "space-between",
|
|
1101
|
+
children: [/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1102
|
+
fg: theme.header.text,
|
|
1103
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
1104
|
+
children: screen.getName()
|
|
1105
|
+
}), showFilterStatus && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
1106
|
+
fg: theme.sidebar.textDim,
|
|
1107
|
+
children: [
|
|
1108
|
+
filteredCount,
|
|
1109
|
+
"/",
|
|
1110
|
+
total,
|
|
1111
|
+
" messages"
|
|
1112
|
+
]
|
|
1113
|
+
})]
|
|
1114
|
+
}), /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("scrollbox", {
|
|
1115
|
+
flexGrow: 1,
|
|
1116
|
+
scrollY: true,
|
|
1117
|
+
stickyScroll: true,
|
|
1118
|
+
stickyStart: "bottom",
|
|
1119
|
+
contentOptions: {
|
|
1120
|
+
paddingLeft: 1,
|
|
1121
|
+
paddingRight: 1,
|
|
1122
|
+
paddingTop: 1,
|
|
1123
|
+
paddingBottom: 1,
|
|
1124
|
+
gap: 1
|
|
1125
|
+
},
|
|
1126
|
+
children: [processedMessages.map((item, index) => {
|
|
1127
|
+
if (item.type === "group") return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(GroupRenderer, {
|
|
1128
|
+
label: item.label,
|
|
1129
|
+
messages: item.messages
|
|
1130
|
+
}, `group-${index}`);
|
|
1131
|
+
else return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(MessageRenderer, { message: item.message }, item.message.id);
|
|
1132
|
+
}), activePrompt && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(PromptRenderer, { prompt: activePrompt })]
|
|
1133
|
+
})]
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region src/adapters/react/components/sidebar/sidebar_item.tsx
|
|
1139
|
+
function SidebarItem({ screen, isSelected, isActive, focused }) {
|
|
1140
|
+
const theme = useTheme();
|
|
1141
|
+
const status = screen.getStatus();
|
|
1142
|
+
const statusIndicator = theme.statusIndicators[status];
|
|
1143
|
+
let backgroundColor = void 0;
|
|
1144
|
+
if (isSelected && focused) backgroundColor = theme.sidebar.selectedBackground;
|
|
1145
|
+
else if (isActive) backgroundColor = theme.sidebar.selectedBackground + "80";
|
|
1146
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1147
|
+
flexDirection: "row",
|
|
1148
|
+
paddingLeft: 1,
|
|
1149
|
+
paddingRight: 1,
|
|
1150
|
+
backgroundColor,
|
|
1151
|
+
children: [
|
|
1152
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
1153
|
+
fg: isSelected && focused ? theme.sidebar.focusBorder : "transparent",
|
|
1154
|
+
children: [">", " "]
|
|
1155
|
+
}),
|
|
1156
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("text", {
|
|
1157
|
+
fg: statusIndicator.color,
|
|
1158
|
+
children: [statusIndicator.icon, " "]
|
|
1159
|
+
}),
|
|
1160
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1161
|
+
fg: isActive ? theme.sidebar.text : theme.sidebar.textDim,
|
|
1162
|
+
flexGrow: 1,
|
|
1163
|
+
children: screen.getName()
|
|
1164
|
+
}),
|
|
1165
|
+
screen.getBadgeCount() > 0 && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
1166
|
+
backgroundColor: theme.sidebar.badge,
|
|
1167
|
+
paddingLeft: 1,
|
|
1168
|
+
paddingRight: 1,
|
|
1169
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1170
|
+
fg: theme.colors.foreground,
|
|
1171
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
1172
|
+
children: screen.getBadgeCount() > 99 ? "99+" : screen.getBadgeCount()
|
|
1173
|
+
})
|
|
1174
|
+
})
|
|
1175
|
+
]
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
//#endregion
|
|
1180
|
+
//#region src/adapters/react/components/sidebar/sidebar_separator.tsx
|
|
1181
|
+
function SidebarSeparator() {
|
|
1182
|
+
const theme = useTheme();
|
|
1183
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1184
|
+
flexDirection: "row",
|
|
1185
|
+
paddingTop: 1,
|
|
1186
|
+
children: [
|
|
1187
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", { flexGrow: 1 }),
|
|
1188
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1189
|
+
fg: theme.separator.line,
|
|
1190
|
+
children: "· · ·"
|
|
1191
|
+
}),
|
|
1192
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", { flexGrow: 1 })
|
|
1193
|
+
]
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
//#endregion
|
|
1198
|
+
//#region src/adapters/react/components/sidebar/sidebar.tsx
|
|
1199
|
+
function Sidebar({ screens, selectedIndex, activeScreenId, focused, width, title }) {
|
|
1200
|
+
const theme = useTheme();
|
|
1201
|
+
const pendingScreens = [];
|
|
1202
|
+
const otherScreens = [];
|
|
1203
|
+
screens.forEach((screen, index) => {
|
|
1204
|
+
if (screen.getStatus() === "pending") pendingScreens.push({
|
|
1205
|
+
screen,
|
|
1206
|
+
originalIndex: index
|
|
1207
|
+
});
|
|
1208
|
+
else otherScreens.push({
|
|
1209
|
+
screen,
|
|
1210
|
+
originalIndex: index
|
|
1211
|
+
});
|
|
1212
|
+
});
|
|
1213
|
+
const hasPending = pendingScreens.length > 0;
|
|
1214
|
+
const hasOther = otherScreens.length > 0;
|
|
1215
|
+
const showSeparator = hasPending && hasOther;
|
|
1216
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1217
|
+
flexDirection: "column",
|
|
1218
|
+
width,
|
|
1219
|
+
borderColor: focused ? theme.sidebar.focusBorder : theme.sidebar.border,
|
|
1220
|
+
border: ["right"],
|
|
1221
|
+
children: [
|
|
1222
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
1223
|
+
backgroundColor: theme.header.background,
|
|
1224
|
+
paddingLeft: 1,
|
|
1225
|
+
paddingRight: 1,
|
|
1226
|
+
borderColor: theme.header.border,
|
|
1227
|
+
border: ["bottom"],
|
|
1228
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1229
|
+
fg: theme.header.text,
|
|
1230
|
+
attributes: _opentui_core.TextAttributes.BOLD,
|
|
1231
|
+
children: title
|
|
1232
|
+
})
|
|
1233
|
+
}),
|
|
1234
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("scrollbox", {
|
|
1235
|
+
scrollY: true,
|
|
1236
|
+
stickyScroll: false,
|
|
1237
|
+
flexGrow: 1,
|
|
1238
|
+
contentOptions: { flexGrow: 1 },
|
|
1239
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1240
|
+
flexDirection: "column",
|
|
1241
|
+
children: [
|
|
1242
|
+
pendingScreens.map(({ screen, originalIndex }) => /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(SidebarItem, {
|
|
1243
|
+
screen,
|
|
1244
|
+
isSelected: originalIndex === selectedIndex,
|
|
1245
|
+
isActive: screen.getId() === activeScreenId,
|
|
1246
|
+
focused
|
|
1247
|
+
}, screen.getId())),
|
|
1248
|
+
showSeparator && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(SidebarSeparator, {}),
|
|
1249
|
+
otherScreens.map(({ screen, originalIndex }) => /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(SidebarItem, {
|
|
1250
|
+
screen,
|
|
1251
|
+
isSelected: originalIndex === selectedIndex,
|
|
1252
|
+
isActive: screen.getId() === activeScreenId,
|
|
1253
|
+
focused
|
|
1254
|
+
}, screen.getId()))
|
|
1255
|
+
]
|
|
1256
|
+
})
|
|
1257
|
+
}),
|
|
1258
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("box", {
|
|
1259
|
+
paddingLeft: 1,
|
|
1260
|
+
paddingRight: 1,
|
|
1261
|
+
borderColor: theme.sidebar.border,
|
|
1262
|
+
border: ["top"],
|
|
1263
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)("text", {
|
|
1264
|
+
fg: theme.sidebar.text,
|
|
1265
|
+
children: "q: exit | Tab: focus | ?: help"
|
|
1266
|
+
})
|
|
1267
|
+
})
|
|
1268
|
+
]
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region src/adapters/react/components/screen_manager_bridge.tsx
|
|
1274
|
+
function ScreenManagerBridge({ manager, theme }) {
|
|
1275
|
+
const [, forceUpdate] = (0, react.useState)({});
|
|
1276
|
+
const [showHelp, setShowHelp] = (0, react.useState)(false);
|
|
1277
|
+
const [filter, setFilter] = (0, react.useState)(require_filter_engine.createDefaultFilterState);
|
|
1278
|
+
(0, react.useEffect)(() => {
|
|
1279
|
+
return manager.onChange(() => forceUpdate({}));
|
|
1280
|
+
}, [manager]);
|
|
1281
|
+
const getActiveScreen = (0, react.useCallback)(() => manager.getActiveScreen(), [manager]);
|
|
1282
|
+
const toggleHelp = (0, react.useCallback)(() => {
|
|
1283
|
+
setShowHelp((prev) => !prev);
|
|
1284
|
+
}, []);
|
|
1285
|
+
const toggleFilter = (0, react.useCallback)(() => {
|
|
1286
|
+
setFilter((prev) => ({
|
|
1287
|
+
...prev,
|
|
1288
|
+
isVisible: !prev.isVisible,
|
|
1289
|
+
focusedField: "search"
|
|
1290
|
+
}));
|
|
1291
|
+
}, []);
|
|
1292
|
+
const closeFilter = (0, react.useCallback)(() => {
|
|
1293
|
+
setFilter((prev) => ({
|
|
1294
|
+
...prev,
|
|
1295
|
+
isVisible: false
|
|
1296
|
+
}));
|
|
1297
|
+
}, []);
|
|
1298
|
+
const filterAppendChar = (0, react.useCallback)((char) => {
|
|
1299
|
+
setFilter((prev) => ({
|
|
1300
|
+
...prev,
|
|
1301
|
+
searchQuery: prev.searchQuery + char
|
|
1302
|
+
}));
|
|
1303
|
+
}, []);
|
|
1304
|
+
const filterDeleteChar = (0, react.useCallback)(() => {
|
|
1305
|
+
setFilter((prev) => ({
|
|
1306
|
+
...prev,
|
|
1307
|
+
searchQuery: prev.searchQuery.slice(0, -1)
|
|
1308
|
+
}));
|
|
1309
|
+
}, []);
|
|
1310
|
+
const filterToggleLevel = (0, react.useCallback)((index) => {
|
|
1311
|
+
setFilter((prev) => {
|
|
1312
|
+
const level = require_filter_engine.ALL_LOG_LEVELS[index];
|
|
1313
|
+
if (!level) return prev;
|
|
1314
|
+
const newLevels = new Set(prev.enabledLevels);
|
|
1315
|
+
if (newLevels.has(level)) newLevels.delete(level);
|
|
1316
|
+
else newLevels.add(level);
|
|
1317
|
+
return {
|
|
1318
|
+
...prev,
|
|
1319
|
+
enabledLevels: newLevels
|
|
1320
|
+
};
|
|
1321
|
+
});
|
|
1322
|
+
}, []);
|
|
1323
|
+
const filterCycleField = (0, react.useCallback)(() => {
|
|
1324
|
+
setFilter((prev) => ({
|
|
1325
|
+
...prev,
|
|
1326
|
+
focusedField: prev.focusedField === "search" ? "levels" : "search"
|
|
1327
|
+
}));
|
|
1328
|
+
}, []);
|
|
1329
|
+
const keyboardManager = (0, react.useMemo)(() => {
|
|
1330
|
+
const km = new require_filter_engine.KeyboardManager();
|
|
1331
|
+
const bindings = require_filter_engine.createDefaultBindings({
|
|
1332
|
+
manager,
|
|
1333
|
+
getActiveScreen,
|
|
1334
|
+
toggleHelp,
|
|
1335
|
+
toggleFilter,
|
|
1336
|
+
closeFilter,
|
|
1337
|
+
filterAppendChar,
|
|
1338
|
+
filterDeleteChar,
|
|
1339
|
+
filterToggleLevel,
|
|
1340
|
+
filterCycleField
|
|
1341
|
+
});
|
|
1342
|
+
km.addBindings(bindings);
|
|
1343
|
+
return km;
|
|
1344
|
+
}, [
|
|
1345
|
+
manager,
|
|
1346
|
+
getActiveScreen,
|
|
1347
|
+
toggleHelp,
|
|
1348
|
+
toggleFilter,
|
|
1349
|
+
closeFilter,
|
|
1350
|
+
filterAppendChar,
|
|
1351
|
+
filterDeleteChar,
|
|
1352
|
+
filterToggleLevel,
|
|
1353
|
+
filterCycleField
|
|
1354
|
+
]);
|
|
1355
|
+
(0, _opentui_react.useKeyboard)((0, react.useCallback)((key) => {
|
|
1356
|
+
const screens$1 = manager.getScreens();
|
|
1357
|
+
const activeScreen$1 = manager.getActiveScreen();
|
|
1358
|
+
const context = {
|
|
1359
|
+
hasSidebar: screens$1.length > 1,
|
|
1360
|
+
focusArea: manager.focusArea,
|
|
1361
|
+
hasPrompt: activeScreen$1?.hasActivePrompt() ?? false,
|
|
1362
|
+
inInputMode: activeScreen$1?.isPromptInInputMode() ?? false,
|
|
1363
|
+
isFilterActive: filter.isVisible,
|
|
1364
|
+
isHelpVisible: showHelp
|
|
1365
|
+
};
|
|
1366
|
+
if (keyboardManager.handleKey(key, context)) return;
|
|
1367
|
+
require_filter_engine.handlePrintableInput(key, context, {
|
|
1368
|
+
manager,
|
|
1369
|
+
getActiveScreen,
|
|
1370
|
+
toggleHelp,
|
|
1371
|
+
toggleFilter,
|
|
1372
|
+
closeFilter,
|
|
1373
|
+
filterAppendChar,
|
|
1374
|
+
filterDeleteChar,
|
|
1375
|
+
filterToggleLevel,
|
|
1376
|
+
filterCycleField
|
|
1377
|
+
});
|
|
1378
|
+
}, [
|
|
1379
|
+
manager,
|
|
1380
|
+
keyboardManager,
|
|
1381
|
+
filter.isVisible,
|
|
1382
|
+
showHelp,
|
|
1383
|
+
getActiveScreen,
|
|
1384
|
+
toggleHelp,
|
|
1385
|
+
toggleFilter,
|
|
1386
|
+
closeFilter,
|
|
1387
|
+
filterAppendChar,
|
|
1388
|
+
filterDeleteChar,
|
|
1389
|
+
filterToggleLevel,
|
|
1390
|
+
filterCycleField
|
|
1391
|
+
]));
|
|
1392
|
+
const screens = manager.getScreens();
|
|
1393
|
+
const activeScreen = manager.getActiveScreen();
|
|
1394
|
+
const activeScreenId = activeScreen?.getId() ?? screens[0]?.getId() ?? "";
|
|
1395
|
+
const bindOptions = manager.getBindOptions();
|
|
1396
|
+
const hasSidebar = screens.length > 1;
|
|
1397
|
+
const activeScreenVersion = (0, react.useSyncExternalStore)((updater) => activeScreen?.onChange(updater) ?? (() => {}), () => activeScreen?.getVersion() ?? -1);
|
|
1398
|
+
const levelCounts = (0, react.useMemo)(() => {
|
|
1399
|
+
if (!activeScreen) return {
|
|
1400
|
+
verbose: 0,
|
|
1401
|
+
debug: 0,
|
|
1402
|
+
log: 0,
|
|
1403
|
+
warn: 0,
|
|
1404
|
+
error: 0,
|
|
1405
|
+
fatal: 0
|
|
1406
|
+
};
|
|
1407
|
+
return require_filter_engine.FilterEngine.countByLevel(activeScreen.getMessages());
|
|
1408
|
+
}, [activeScreenVersion, activeScreen]);
|
|
1409
|
+
const filteredMessages = (0, react.useMemo)(() => {
|
|
1410
|
+
if (!activeScreen) return [];
|
|
1411
|
+
return require_filter_engine.FilterEngine.filterMessages(activeScreen.getMessages(), filter);
|
|
1412
|
+
}, [
|
|
1413
|
+
activeScreenVersion,
|
|
1414
|
+
activeScreen,
|
|
1415
|
+
filter
|
|
1416
|
+
]);
|
|
1417
|
+
const isFiltering = (0, react.useMemo)(() => require_filter_engine.hasActiveFilter(filter), [filter]);
|
|
1418
|
+
return /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(LoggerProvider, {
|
|
1419
|
+
theme,
|
|
1420
|
+
children: /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1421
|
+
flexDirection: "row",
|
|
1422
|
+
flexGrow: 1,
|
|
1423
|
+
children: [
|
|
1424
|
+
hasSidebar && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(Sidebar, {
|
|
1425
|
+
screens,
|
|
1426
|
+
selectedIndex: manager.selectedIndex,
|
|
1427
|
+
activeScreenId,
|
|
1428
|
+
focused: manager.focusArea === "sidebar",
|
|
1429
|
+
width: bindOptions.sidebarWidth ?? 25,
|
|
1430
|
+
title: bindOptions.sidebarTitle ?? "Screens"
|
|
1431
|
+
}),
|
|
1432
|
+
/* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsxs)("box", {
|
|
1433
|
+
flexDirection: "column",
|
|
1434
|
+
flexGrow: 1,
|
|
1435
|
+
children: [filter.isVisible && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(FilterBar, {
|
|
1436
|
+
filter,
|
|
1437
|
+
levelCounts
|
|
1438
|
+
}), activeScreen && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(ScreenBridge, {
|
|
1439
|
+
screen: activeScreen,
|
|
1440
|
+
focused: manager.focusArea === "content",
|
|
1441
|
+
filteredMessages,
|
|
1442
|
+
isFiltering,
|
|
1443
|
+
totalMessages: activeScreen.getMessages().length
|
|
1444
|
+
}, activeScreen.getId())]
|
|
1445
|
+
}),
|
|
1446
|
+
showHelp && /* @__PURE__ */ (0, _opentui_react_jsx_runtime.jsx)(HelpOverlay, { bindings: keyboardManager.getBindingsForHelp() })
|
|
1447
|
+
]
|
|
1448
|
+
})
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
//#endregion
|
|
1453
|
+
//#region src/adapters/react/index.ts
|
|
1454
|
+
function applyDecs2203RFactory() {
|
|
1455
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
1456
|
+
return function addInitializer(initializer) {
|
|
1457
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
1458
|
+
assertCallable(initializer, "An initializer");
|
|
1459
|
+
initializers.push(initializer);
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
1463
|
+
var kindStr;
|
|
1464
|
+
switch (kind) {
|
|
1465
|
+
case 1:
|
|
1466
|
+
kindStr = "accessor";
|
|
1467
|
+
break;
|
|
1468
|
+
case 2:
|
|
1469
|
+
kindStr = "method";
|
|
1470
|
+
break;
|
|
1471
|
+
case 3:
|
|
1472
|
+
kindStr = "getter";
|
|
1473
|
+
break;
|
|
1474
|
+
case 4:
|
|
1475
|
+
kindStr = "setter";
|
|
1476
|
+
break;
|
|
1477
|
+
default: kindStr = "field";
|
|
1478
|
+
}
|
|
1479
|
+
var ctx = {
|
|
1480
|
+
kind: kindStr,
|
|
1481
|
+
name: isPrivate ? "#" + name : name,
|
|
1482
|
+
static: isStatic,
|
|
1483
|
+
private: isPrivate,
|
|
1484
|
+
metadata
|
|
1485
|
+
};
|
|
1486
|
+
var decoratorFinishedRef = { v: false };
|
|
1487
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
1488
|
+
var get, set;
|
|
1489
|
+
if (kind === 0) if (isPrivate) {
|
|
1490
|
+
get = desc.get;
|
|
1491
|
+
set = desc.set;
|
|
1492
|
+
} else {
|
|
1493
|
+
get = function() {
|
|
1494
|
+
return this[name];
|
|
1495
|
+
};
|
|
1496
|
+
set = function(v) {
|
|
1497
|
+
this[name] = v;
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
else if (kind === 2) get = function() {
|
|
1501
|
+
return desc.value;
|
|
1502
|
+
};
|
|
1503
|
+
else {
|
|
1504
|
+
if (kind === 1 || kind === 3) get = function() {
|
|
1505
|
+
return desc.get.call(this);
|
|
1506
|
+
};
|
|
1507
|
+
if (kind === 1 || kind === 4) set = function(v) {
|
|
1508
|
+
desc.set.call(this, v);
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
ctx.access = get && set ? {
|
|
1512
|
+
get,
|
|
1513
|
+
set
|
|
1514
|
+
} : get ? { get } : { set };
|
|
1515
|
+
try {
|
|
1516
|
+
return dec(value, ctx);
|
|
1517
|
+
} finally {
|
|
1518
|
+
decoratorFinishedRef.v = true;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
1522
|
+
if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
1523
|
+
}
|
|
1524
|
+
function assertCallable(fn, hint) {
|
|
1525
|
+
if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
|
|
1526
|
+
}
|
|
1527
|
+
function assertValidReturnValue(kind, value) {
|
|
1528
|
+
var type = typeof value;
|
|
1529
|
+
if (kind === 1) {
|
|
1530
|
+
if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
1531
|
+
if (value.get !== void 0) assertCallable(value.get, "accessor.get");
|
|
1532
|
+
if (value.set !== void 0) assertCallable(value.set, "accessor.set");
|
|
1533
|
+
if (value.init !== void 0) assertCallable(value.init, "accessor.init");
|
|
1534
|
+
} else if (type !== "function") {
|
|
1535
|
+
var hint;
|
|
1536
|
+
if (kind === 0) hint = "field";
|
|
1537
|
+
else if (kind === 10) hint = "class";
|
|
1538
|
+
else hint = "method";
|
|
1539
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
1543
|
+
var decs = decInfo[0];
|
|
1544
|
+
var desc, init, value;
|
|
1545
|
+
if (isPrivate) if (kind === 0 || kind === 1) desc = {
|
|
1546
|
+
get: decInfo[3],
|
|
1547
|
+
set: decInfo[4]
|
|
1548
|
+
};
|
|
1549
|
+
else if (kind === 3) desc = { get: decInfo[3] };
|
|
1550
|
+
else if (kind === 4) desc = { set: decInfo[3] };
|
|
1551
|
+
else desc = { value: decInfo[3] };
|
|
1552
|
+
else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
|
|
1553
|
+
if (kind === 1) value = {
|
|
1554
|
+
get: desc.get,
|
|
1555
|
+
set: desc.set
|
|
1556
|
+
};
|
|
1557
|
+
else if (kind === 2) value = desc.value;
|
|
1558
|
+
else if (kind === 3) value = desc.get;
|
|
1559
|
+
else if (kind === 4) value = desc.set;
|
|
1560
|
+
var newValue, get, set;
|
|
1561
|
+
if (typeof decs === "function") {
|
|
1562
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
1563
|
+
if (newValue !== void 0) {
|
|
1564
|
+
assertValidReturnValue(kind, newValue);
|
|
1565
|
+
if (kind === 0) init = newValue;
|
|
1566
|
+
else if (kind === 1) {
|
|
1567
|
+
init = newValue.init;
|
|
1568
|
+
get = newValue.get || value.get;
|
|
1569
|
+
set = newValue.set || value.set;
|
|
1570
|
+
value = {
|
|
1571
|
+
get,
|
|
1572
|
+
set
|
|
1573
|
+
};
|
|
1574
|
+
} else value = newValue;
|
|
1575
|
+
}
|
|
1576
|
+
} else for (var i = decs.length - 1; i >= 0; i--) {
|
|
1577
|
+
var dec = decs[i];
|
|
1578
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
1579
|
+
if (newValue !== void 0) {
|
|
1580
|
+
assertValidReturnValue(kind, newValue);
|
|
1581
|
+
var newInit;
|
|
1582
|
+
if (kind === 0) newInit = newValue;
|
|
1583
|
+
else if (kind === 1) {
|
|
1584
|
+
newInit = newValue.init;
|
|
1585
|
+
get = newValue.get || value.get;
|
|
1586
|
+
set = newValue.set || value.set;
|
|
1587
|
+
value = {
|
|
1588
|
+
get,
|
|
1589
|
+
set
|
|
1590
|
+
};
|
|
1591
|
+
} else value = newValue;
|
|
1592
|
+
if (newInit !== void 0) if (init === void 0) init = newInit;
|
|
1593
|
+
else if (typeof init === "function") init = [init, newInit];
|
|
1594
|
+
else init.push(newInit);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
if (kind === 0 || kind === 1) {
|
|
1598
|
+
if (init === void 0) init = function(instance, init$1) {
|
|
1599
|
+
return init$1;
|
|
1600
|
+
};
|
|
1601
|
+
else if (typeof init !== "function") {
|
|
1602
|
+
var ownInitializers = init;
|
|
1603
|
+
init = function(instance, init$1) {
|
|
1604
|
+
var value$1 = init$1;
|
|
1605
|
+
for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
|
|
1606
|
+
return value$1;
|
|
1607
|
+
};
|
|
1608
|
+
} else {
|
|
1609
|
+
var originalInitializer = init;
|
|
1610
|
+
init = function(instance, init$1) {
|
|
1611
|
+
return originalInitializer.call(instance, init$1);
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
ret.push(init);
|
|
1615
|
+
}
|
|
1616
|
+
if (kind !== 0) {
|
|
1617
|
+
if (kind === 1) {
|
|
1618
|
+
desc.get = value.get;
|
|
1619
|
+
desc.set = value.set;
|
|
1620
|
+
} else if (kind === 2) desc.value = value;
|
|
1621
|
+
else if (kind === 3) desc.get = value;
|
|
1622
|
+
else if (kind === 4) desc.set = value;
|
|
1623
|
+
if (isPrivate) if (kind === 1) {
|
|
1624
|
+
ret.push(function(instance, args) {
|
|
1625
|
+
return value.get.call(instance, args);
|
|
1626
|
+
});
|
|
1627
|
+
ret.push(function(instance, args) {
|
|
1628
|
+
return value.set.call(instance, args);
|
|
1629
|
+
});
|
|
1630
|
+
} else if (kind === 2) ret.push(value);
|
|
1631
|
+
else ret.push(function(instance, args) {
|
|
1632
|
+
return value.call(instance, args);
|
|
1633
|
+
});
|
|
1634
|
+
else Object.defineProperty(base, name, desc);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
1638
|
+
var ret = [];
|
|
1639
|
+
var protoInitializers;
|
|
1640
|
+
var staticInitializers;
|
|
1641
|
+
var existingProtoNonFields = /* @__PURE__ */ new Map();
|
|
1642
|
+
var existingStaticNonFields = /* @__PURE__ */ new Map();
|
|
1643
|
+
for (var i = 0; i < decInfos.length; i++) {
|
|
1644
|
+
var decInfo = decInfos[i];
|
|
1645
|
+
if (!Array.isArray(decInfo)) continue;
|
|
1646
|
+
var kind = decInfo[1];
|
|
1647
|
+
var name = decInfo[2];
|
|
1648
|
+
var isPrivate = decInfo.length > 3;
|
|
1649
|
+
var isStatic = kind >= 5;
|
|
1650
|
+
var base;
|
|
1651
|
+
var initializers;
|
|
1652
|
+
if (isStatic) {
|
|
1653
|
+
base = Class;
|
|
1654
|
+
kind = kind - 5;
|
|
1655
|
+
staticInitializers = staticInitializers || [];
|
|
1656
|
+
initializers = staticInitializers;
|
|
1657
|
+
} else {
|
|
1658
|
+
base = Class.prototype;
|
|
1659
|
+
protoInitializers = protoInitializers || [];
|
|
1660
|
+
initializers = protoInitializers;
|
|
1661
|
+
}
|
|
1662
|
+
if (kind !== 0 && !isPrivate) {
|
|
1663
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
1664
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
1665
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
1666
|
+
else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
|
|
1667
|
+
else existingNonFields.set(name, true);
|
|
1668
|
+
}
|
|
1669
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
1670
|
+
}
|
|
1671
|
+
pushInitializers(ret, protoInitializers);
|
|
1672
|
+
pushInitializers(ret, staticInitializers);
|
|
1673
|
+
return ret;
|
|
1674
|
+
}
|
|
1675
|
+
function pushInitializers(ret, initializers) {
|
|
1676
|
+
if (initializers) ret.push(function(instance) {
|
|
1677
|
+
for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
|
|
1678
|
+
return instance;
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
1682
|
+
if (classDecs.length > 0) {
|
|
1683
|
+
var initializers = [];
|
|
1684
|
+
var newClass = targetClass;
|
|
1685
|
+
var name = targetClass.name;
|
|
1686
|
+
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
1687
|
+
var decoratorFinishedRef = { v: false };
|
|
1688
|
+
try {
|
|
1689
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
1690
|
+
kind: "class",
|
|
1691
|
+
name,
|
|
1692
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
1693
|
+
metadata
|
|
1694
|
+
});
|
|
1695
|
+
} finally {
|
|
1696
|
+
decoratorFinishedRef.v = true;
|
|
1697
|
+
}
|
|
1698
|
+
if (nextNewClass !== void 0) {
|
|
1699
|
+
assertValidReturnValue(10, nextNewClass);
|
|
1700
|
+
newClass = nextNewClass;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
return [defineMetadata(newClass, metadata), function() {
|
|
1704
|
+
for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
|
|
1705
|
+
}];
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
function defineMetadata(Class, metadata) {
|
|
1709
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
1710
|
+
configurable: true,
|
|
1711
|
+
enumerable: true,
|
|
1712
|
+
value: metadata
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
1716
|
+
if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
1717
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
1718
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
1719
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
1720
|
+
return {
|
|
1721
|
+
e,
|
|
1722
|
+
get c() {
|
|
1723
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
1729
|
+
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
1730
|
+
}
|
|
1731
|
+
var _dec, _initClass;
|
|
1732
|
+
let _ReactAdapter;
|
|
1733
|
+
_dec = (0, _navios_core.Injectable)({ token: require_filter_engine.Adapter });
|
|
1734
|
+
var ReactAdapter = class {
|
|
1735
|
+
static {
|
|
1736
|
+
({c: [_ReactAdapter, _initClass]} = _apply_decs_2203_r(this, [], [_dec]));
|
|
1737
|
+
}
|
|
1738
|
+
createRoot(renderer) {
|
|
1739
|
+
const root = (0, _opentui_react.createRoot)(renderer);
|
|
1740
|
+
return {
|
|
1741
|
+
render(element) {
|
|
1742
|
+
root.render(element);
|
|
1743
|
+
},
|
|
1744
|
+
unmount() {
|
|
1745
|
+
root.unmount();
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
renderToRoot(root, props) {
|
|
1750
|
+
const element = (0, react.createElement)(ScreenManagerBridge, props);
|
|
1751
|
+
root.render(element);
|
|
1752
|
+
}
|
|
1753
|
+
static {
|
|
1754
|
+
_initClass();
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1758
|
+
//#endregion
|
|
1759
|
+
exports.LoggerProvider = LoggerProvider;
|
|
1760
|
+
Object.defineProperty(exports, 'ReactAdapter', {
|
|
1761
|
+
enumerable: true,
|
|
1762
|
+
get: function () {
|
|
1763
|
+
return _ReactAdapter;
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1766
|
+
exports.useLoggerContext = useLoggerContext;
|
|
1767
|
+
exports.useTheme = useTheme;
|
|
1768
|
+
//# sourceMappingURL=index.cjs.map
|