dal-code 1.0.50 → 1.0.51
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 +1039 -5
- package/dist/bundle/chunks/anthropic-messages-2P3UGLIO.js +5 -0
- package/dist/bundle/chunks/anthropic.js +74 -0
- package/dist/bundle/chunks/azure-openai-responses-S4GNH2XC.js +1 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +88 -0
- package/dist/bundle/chunks/chunk-2KOJ4RNS.js +43 -0
- package/dist/bundle/chunks/chunk-3YGHTGYM.js +7 -0
- package/dist/bundle/chunks/chunk-4LDEEFCY.js +1 -0
- package/dist/bundle/chunks/chunk-4UTLMBZZ.js +13 -0
- package/dist/bundle/chunks/chunk-567OJLS7.js +1 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +5 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +5 -0
- package/dist/bundle/chunks/chunk-723ZGEZ2.js +1 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +1 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +1 -0
- package/dist/bundle/chunks/chunk-AL7NZVPP.js +1 -0
- package/dist/bundle/chunks/chunk-ATQJO2OE.js +3 -0
- package/dist/bundle/chunks/chunk-B7NRFMLU.js +8 -0
- package/dist/bundle/chunks/chunk-BEDAM2M7.js +81 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +30 -0
- package/dist/bundle/chunks/chunk-CFPQOC7P.js +1 -0
- package/dist/bundle/chunks/chunk-D2WTLI2T.js +19 -0
- package/dist/bundle/chunks/chunk-EH7SFF47.js +129 -0
- package/dist/bundle/chunks/chunk-FCKLBLA4.js +1 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +9 -0
- package/dist/bundle/chunks/chunk-GSGE3ULF.js +15 -0
- package/dist/bundle/chunks/chunk-H5FHS6BV.js +1 -0
- package/dist/bundle/chunks/chunk-HXK5EFBE.js +1172 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +1 -0
- package/dist/bundle/chunks/chunk-JE6UXK35.js +30 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +1 -0
- package/dist/bundle/chunks/chunk-K7VBBYTT.js +1 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +1 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +11 -0
- package/dist/bundle/chunks/chunk-ML5DIOWR.js +1 -0
- package/dist/bundle/chunks/chunk-NUIR7PPD.js +25 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +1 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +1 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +1 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +1 -0
- package/dist/bundle/chunks/chunk-PWZRJWNP.js +17 -0
- package/dist/bundle/chunks/chunk-R44HF4S5.js +9 -0
- package/dist/bundle/chunks/chunk-R47JBGS3.js +1 -0
- package/dist/bundle/chunks/chunk-RCVVRHMF.js +9 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +1 -0
- package/dist/bundle/chunks/chunk-RR3ZP63P.js +56 -0
- package/dist/bundle/chunks/chunk-SE42OS3U.js +21 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +1 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +1 -0
- package/dist/bundle/chunks/chunk-VNHNHA4V.js +1 -0
- package/dist/bundle/chunks/chunk-XJFQKN3N.js +2 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +1 -0
- package/dist/bundle/chunks/cli-FWMQKBFA.js +30 -0
- package/dist/bundle/chunks/cli-ZEDY5U67.js +52 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-E6TEENDO.js +1 -0
- package/dist/bundle/chunks/codemode-worker.js +480 -0
- package/dist/bundle/chunks/dist-D3WIBXB5.js +10 -0
- package/dist/bundle/chunks/easter-egg-3d-5TFBCTIS.js +1 -0
- package/dist/bundle/chunks/execute-62LDYHXA.js +506 -0
- package/dist/bundle/chunks/github-copilot.js +1 -0
- package/dist/bundle/chunks/google-generative-ai-V5DLXTF7.js +1 -0
- package/dist/bundle/chunks/google-vertex-K3KYGGLI.js +1 -0
- package/dist/bundle/chunks/http-proxy-KF35JLJN.js +1 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +12 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +20 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +1 -0
- package/dist/bundle/chunks/kimi-coding.js +1 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +8 -0
- package/dist/bundle/chunks/llama-cpp-classify-JCTIEHTL.js +21 -0
- package/dist/bundle/chunks/mcp-VF7EY5WC.js +10 -0
- package/dist/bundle/chunks/meta.js +1 -0
- package/dist/bundle/chunks/mistral-conversations-LVBXTF6R.js +4 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +2 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +1 -0
- package/dist/bundle/chunks/node-ZTHARAQV.js +15 -0
- package/dist/bundle/chunks/office-PONBADQP.js +419 -0
- package/dist/bundle/chunks/openai-chatgpt.js +74 -0
- package/dist/bundle/chunks/openai-codex-responses-WBZKNYLX.js +9 -0
- package/dist/bundle/chunks/openai-codex.js +74 -0
- package/dist/bundle/chunks/openai-completions-HMHQRGX4.js +6 -0
- package/dist/bundle/chunks/openai-decisions-R7OFRKLL.js +4 -0
- package/dist/bundle/chunks/openai-responses-BHXRQFCI.js +3 -0
- package/dist/bundle/chunks/openrouter-images-BIMNIXQZ.js +1 -0
- package/dist/bundle/chunks/openrouter.js +74 -0
- package/dist/bundle/chunks/pi-messages-X5YTLXQJ.js +7 -0
- package/dist/bundle/chunks/radius.js +74 -0
- package/dist/bundle/chunks/review-WCGIBVLM.js +80 -0
- package/dist/bundle/chunks/rewind-2OYLDDHH.js +8 -0
- package/dist/bundle/chunks/router-7E5LU7US.js +3 -0
- package/dist/bundle/chunks/runtime-5PTUOEM2.js +1 -0
- package/dist/bundle/chunks/sdk-ZUFIGPSS.js +1 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +3 -0
- package/dist/bundle/chunks/sync-LOX6TIM6.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-KOIOG3HP.js +1 -0
- package/dist/bundle/chunks/usage-2EVEFGNI.js +1 -0
- package/dist/bundle/chunks/virtual-modules-MYMONT3Y.js +1 -0
- package/dist/bundle/chunks/xai.js +1 -0
- package/dist/bundle/cli-runtime.js +2 -0
- package/dist/bundle/cli.js +2 -0
- package/dist/bundle/index.js +1 -0
- package/dist/bundle/rpc-entry.js +2 -0
- package/dist/cli/args.js +1 -1
- package/dist/cli/auth-command.js +9 -6
- package/dist/cli/auth-login.js +2 -0
- package/dist/cli/auth-logout.js +1 -0
- package/dist/cli/auth-terminal.js +5 -0
- package/dist/cli/config-selector.js +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session.d.ts +8 -1
- package/dist/core/agent-session.js +12 -9
- package/dist/core/auth-storage.js +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bug-report.js +3 -3
- package/dist/core/cache-warmer.d.ts +3 -15
- package/dist/core/cache-warmer.js +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -2
- package/dist/core/compaction/branch-summarization.js +5 -5
- package/dist/core/compaction/compaction.d.ts +1 -0
- package/dist/core/compaction/compaction.js +14 -14
- package/dist/core/compaction/tool-output-pruning.js +1 -1
- package/dist/core/compaction/utils.d.ts +0 -1
- package/dist/core/compaction/utils.js +8 -8
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.js +1 -1
- package/dist/core/export-html/template.css +9 -0
- package/dist/core/export-html/template.js +46 -39
- package/dist/core/export-html/tool-renderer.js +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/pi-ai-extension-view.js +1 -0
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +25 -7
- package/dist/core/extensions/virtual-modules.js +1 -1
- package/dist/core/keybindings.d.ts +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/mcp-servers.d.ts +6 -17
- package/dist/core/mcp-servers.js +1 -1
- package/dist/core/model-config.d.ts +1912 -2211
- package/dist/core/model-config.js +4 -4
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.js +1 -1
- package/dist/core/package-manager.d.ts +10 -1
- package/dist/core/package-manager.js +2 -2
- package/dist/core/pi-ai-schemas.js +1 -0
- package/dist/core/pi-manifest.js +1 -1
- package/dist/core/preferred-providers.js +1 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/prompt-templates.js +2 -2
- package/dist/core/provider-composer.js +1 -1
- package/dist/core/provider-matching.js +1 -0
- package/dist/core/radius-mcp.js +1 -0
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resource-loader.d.ts +3 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/runtime-credentials.js +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/session-cwd.js +3 -7
- package/dist/core/session-manager.d.ts +1 -0
- package/dist/core/session-manager.js +12 -12
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/settings-schema.d.ts +4 -2
- package/dist/core/settings-schema.js +1 -1
- package/dist/core/skills.js +3 -3
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.js +1 -1
- package/dist/core/system-prompt.js +3 -3
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.js +15 -15
- package/dist/core/tools/edit-diff.d.ts +9 -4
- package/dist/core/tools/edit-diff.js +22 -15
- package/dist/core/tools/edit.d.ts +3 -3
- package/dist/core/tools/edit.js +3 -3
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.js +10 -11
- package/dist/core/tools/grep.d.ts +3 -3
- package/dist/core/tools/grep.js +8 -12
- package/dist/core/tools/ls.d.ts +2 -2
- package/dist/core/tools/ls.js +4 -4
- package/dist/core/tools/powershell.js +6 -2
- package/dist/core/tools/read.d.ts +5 -2
- package/dist/core/tools/read.js +20 -19
- package/dist/core/tools/render-utils.js +5 -5
- package/dist/core/tools/renderers/write.js +10 -10
- package/dist/core/tools/tool-definition-wrapper.d.ts +11 -0
- package/dist/core/tools/truncate.d.ts +2 -8
- package/dist/core/tools/truncate.js +10 -10
- package/dist/core/tools/write.d.ts +2 -2
- package/dist/core/trust-manager.js +2 -2
- package/dist/core/usage-totals.js +1 -1
- package/dist/extensions/codemode/execute.js +12 -12
- package/dist/extensions/codemode/renderer.js +6 -6
- package/dist/extensions/codemode/tool.d.ts +2 -1
- package/dist/extensions/codemode/tool.js +11 -10
- package/dist/extensions/llama/client.js +5 -5
- package/dist/extensions/llama/ui.js +2 -2
- package/dist/extensions/mcp/cli.js +21 -19
- package/dist/extensions/mcp/config.js +2 -2
- package/dist/extensions/mcp/index.js +7 -7
- package/dist/extensions/mcp/oauth.d.ts +3 -22
- package/dist/extensions/mcp/oauth.js +2 -2
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.js +1 -1
- package/dist/extensions/mcp/runtime.d.ts +2 -2
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/extensions/mcp/tools.d.ts +1 -8
- package/dist/extensions/mcp/tools.js +4 -9
- package/dist/extensions/mcp/ui.js +1 -1
- package/dist/extensions/tool-search/tool.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/modes/interactive/components/assistant-message.d.ts +4 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -2
- package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/branch-summary-message.js +2 -2
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +2 -2
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -2
- package/dist/modes/interactive/components/custom-message.js +3 -3
- package/dist/modes/interactive/components/diff.js +3 -3
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -0
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-selector.js +2 -2
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -0
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/markdown-transform.js +1 -1
- package/dist/modes/interactive/components/mermaid.js +4 -4
- package/dist/modes/interactive/components/model-selector.d.ts +1 -0
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts +2 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/provider-brand.js +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +2 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/settings-submenu.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +2 -2
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/dist/modes/interactive/components/tool-execution.js +3 -3
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -0
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +2 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/external-editor.js +3 -3
- package/dist/modes/interactive/interactive-mode.d.ts +10 -1
- package/dist/modes/interactive/interactive-mode.js +45 -40
- package/dist/modes/interactive/model-search.js +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +4 -0
- package/dist/modes/interactive/theme/theme.js +3 -6
- package/dist/modes/print-mode.js +7 -7
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +3 -2
- package/dist/node_modules/@dalcode/dal-learn/src/index.js +16 -16
- package/dist/node_modules/@dalcode/dal-learn/src/lesson-events.js +1 -0
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +3 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -3
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo-snapshot.js +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +3 -3
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/README.md +8 -6
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -2
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/README.md +58 -39
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +9 -9
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/strict-tool-limits.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/meta.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/trusted-url.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.d.ts +21 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-bedrock-provider.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-oauth.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +485 -498
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual-cn.json +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +65 -65
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/schema-builders.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/telemetry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +4 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.js +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/{typebox-helpers.d.ts → string-enum.d.ts} +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/string-enum.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +12 -5
- package/dist/node_modules/@earendil-works/pi-codemode/README.md +2 -2
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +2 -0
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +32 -0
- package/dist/node_modules/@earendil-works/pi-mcp/README.md +60 -5
- package/dist/node_modules/@earendil-works/pi-mcp/dist/config.d.ts +45 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/config.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/callback.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.d.ts +42 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.d.ts +5 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.js +11 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/lines.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.js +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.d.ts +1 -4
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.js +2 -2
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +6 -4
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-schema/CHANGELOG.md +37 -0
- package/dist/node_modules/@earendil-works/pi-schema/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-schema/README.md +319 -0
- package/dist/node_modules/@earendil-works/pi-schema/THIRD_PARTY_NOTICES/typebox-LICENSE +23 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/annotations.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/builders.d.ts +89 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/builders.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/checks.d.ts +51 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/checks.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/coerce.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/compiler.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/explain.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date_time.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/duration.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/email.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_email.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/bidi.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/puny.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/idn-hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/ascii.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/puny.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/unicode.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/pattern/pattern.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv4.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv6.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri_reference.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer_uri_fragment.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/regex.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/relative_json_pointer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/time.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_reference.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_template.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/url.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uuid.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/index.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/resolver.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/shared.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.d.ts +54 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.js +0 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/types.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/validator.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/validator.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/package.json +43 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/render.js +2 -2
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/README.md +2 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -10
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +5 -5
- package/dist/node_modules/@earendil-works/pi-tui/dist/layout.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/program-status.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -4
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +13 -13
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +17 -16
- package/dist/utils/ansi.js +1 -1
- package/dist/utils/changelog.js +3 -3
- package/dist/utils/clipboard-command.js +1 -1
- package/dist/utils/image-resize-core.js +1 -1
- package/dist/utils/image-resize.js +1 -1
- package/dist/utils/open-browser.js +1 -1
- package/dist/utils/paths.js +1 -1
- package/dist/utils/shell.js +3 -3
- package/dist/utils/syntax-highlight.js +4 -4
- package/dist/utils/terminal-question.js +1 -0
- package/dist/utils/tools-manager.js +1 -1
- package/dist/utils/web-url.js +1 -0
- package/examples/extensions/README.md +2 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/debug-provider.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +19 -29
- package/examples/extensions/gondolin/package.json +2 -2
- package/examples/extensions/plan-mode/index.ts +20 -9
- package/examples/extensions/plan-mode/utils.ts +42 -16
- package/examples/extensions/preset.ts +2 -0
- package/examples/extensions/reload-runtime.ts +17 -5
- package/examples/extensions/subagent/README.md +14 -11
- package/examples/extensions/subagent/index.ts +392 -171
- package/examples/extensions/todo.ts +7 -0
- package/examples/extensions/tools.ts +2 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/tsconfig.json +208 -0
- package/npm-shrinkwrap.json +407 -383
- package/package.json +6 -7
- package/examples/extensions/sandbox/index.ts +0 -327
- package/examples/extensions/sandbox/package-lock.json +0 -92
- package/examples/extensions/sandbox/package.json +0 -19
- /package/dist/node_modules/@earendil-works/pi-mcp/{LICENSES → THIRD_PARTY_NOTICES}/modelcontextprotocol-typescript-sdk.txt +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)?void 0:{type:"latex",raw:
|
|
3
|
-
`);for(let
|
|
4
|
-
`)?1:0):void 0},tokenizer:
|
|
5
|
-
`).pop();!n
|
|
6
|
-
`)
|
|
7
|
-
`)
|
|
8
|
-
`).
|
|
9
|
-
`)
|
|
10
|
-
|
|
1
|
+
var j=Object.defineProperty;var b=(l,e)=>j(l,"name",{value:e,configurable:!0});import{Marked as N,Tokenizer as F}from"marked";import Z from"marked-cjk-friendly";import{renderLatex as q}from"../latex.js";import{getCapabilities as G,hyperlink as U,isImageLine as Q}from"../terminal-image.js";import{bumpLayoutAncestors as Y}from"../tui.js";import{applyBackgroundToLine as A,cjkPunctuationRegex as K,flattenLines as v,visibleWidth as M,wrapTextWithAnsi as B}from"../utils.js";const J=/^(~~)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/;class V extends F{static{b(this,"MarkdownTokenizer")}url(e){const t=super.url(e);if(!t)return;const n=t.raw.search(K);return n<0?t:super.url(t.raw.slice(0,n))}del(e){const t=J.exec(e);if(!t)return;const n=t[2];return{type:"del",raw:t[0],text:n,tokens:this.lexer.inlineTokens(n)}}}function ee(l,e){let t=0;for(let n=e-1;n>=0&&l[n]==="\\";n--)t++;return t%2===1}b(ee,"isEscaped");function te(l,e,t){let n=l.indexOf(e,t);for(;n>=0&&ee(l,n);)n=l.indexOf(e,n+e.length);return n}b(te,"findClosingDelimiter");function H(l){return/\\[A-Za-z]+|[_^=+*/<>()[\]|±≤≥≠≈∈→⇒∞∫∑√-]/.test(l)}b(H,"looksLikePendingDollarMath");function ne(l){let e="",t="";if(l.startsWith("$$"))e="$$",t="$$";else if(l.startsWith("\\("))e="\\(",t="\\)";else if(l.startsWith("\\["))e="\\[",t="\\]";else if(l.startsWith("$")&&!/^\$\s/.test(l))e="$",t="$";else return;const n=te(l,t,e.length);if(n>=0&&e==="$"&&(/\s$/.test(l.slice(e.length,n))||/^\d/.test(l.slice(n+1))||/^[A-Z_][A-Z0-9_]*(?:[^A-Za-z0-9_\s])?$/.test(l.slice(e.length,n))&&/^[A-Za-z_][A-Za-z0-9_]*/.test(l.slice(n+1))||l.slice(e.length,n).includes("`")))return;if(n<0){const s=l.slice(e.length);return e.startsWith("\\")||H(s)?{type:"latex",raw:l,text:s,pending:!0}:void 0}const o=l.slice(e.length,n);return!o||o.includes(`
|
|
2
|
+
`)?void 0:{type:"latex",raw:l.slice(0,n+t.length),text:o}}b(ne,"tokenizeInlineLatex");const se=/^ {0,3}\|?[ \t]*:?-+:?[ \t]*(?:\|[ \t]*:?-+:?[ \t]*)*\|?[ \t]*$/;function O(l){const e=l.split(`
|
|
3
|
+
`);for(let t=0;t<e.length-1;t++){const n=e[t+1];if((n.includes("|")||e[t].includes("|"))&&se.test(n))return!0}return!1}b(O,"containsTableStart");function ie(l){const e=/^ {0,3}\$\$[ \t]*(?:\n)?([\s\S]*?)\$\$[ \t]*(?:\n|$)/.exec(l);if(e?.[1]&&!O(e[1]))return{type:"latexBlock",raw:e[0],text:e[1].trim()};const t=/^ {0,3}\\\[[ \t]*(?:\n)?([\s\S]*?)\\\][ \t]*(?:\n|$)/.exec(l);if(t?.[1]&&!O(t[1]))return{type:"latexBlock",raw:t[0],text:t[1].trim()};const n=/^ {0,3}\\\[[ \t]*(?:\n)?([\s\S]*)$/.exec(l);if(n?.[1]&&!O(n[1]))return{type:"latexBlock",raw:n[0],text:n[1],pending:!0};const o=/^ {0,3}\$\$[ \t]*(?:\n)?([\s\S]*)$/.exec(l);if(o?.[1]&&H(o[1])&&!O(o[1]))return{type:"latexBlock",raw:o[0],text:o[1],pending:!0}}b(ie,"tokenizeBlockLatex");const re=[{name:"latexBlock",level:"block",start(l){const e=/(?:^|\n) {0,3}(?:\$\$|\\\[)/.exec(l);return e?e.index+(e[0].startsWith(`
|
|
4
|
+
`)?1:0):void 0},tokenizer:ie},{name:"latex",level:"inline",start(l){const e=[l.indexOf("$"),l.indexOf("\\("),l.indexOf("\\[")].filter(t=>t>=0);return e.length>0?Math.min(...e):void 0},tokenizer:ne}];function _(l){const e=l[l.length-1];if(e?.type==="list"){_(e.items[e.items.length-1]?.tokens??[]);return}if(e?.type==="blockquote"){_(e.tokens??[]);return}if(e?.type!=="code")return;const t=/^(`{3,}|~{3,})/.exec(e.raw)?.[1],n=e.raw.split(`
|
|
5
|
+
`).pop();!t||!n||n.length>=t.length||n!==t[0]?.repeat(n.length)||(e.text=e.text.slice(0,-n.length).replace(/\n$/,""))}b(_,"trimPartialClosingFences");const le=/<!--[\s\S]*?(?:-->|$)/g;function X(l){return l.replace(le,"")}b(X,"stripHtmlComments");function z(l){for(let e=l.length-1;e>=0;e--){const t=l[e];if(t.type==="list")for(const n of t.items)z(n.tokens);else t.type==="blockquote"?z(t.tokens??[]):t.type==="html"&&X(t.raw).trim()===""&&(l.splice(e,1),l[e]?.type==="space"&&(e===0||l[e-1]?.type==="space")?l.splice(e,1):e===l.length&&l[e-1]?.type==="space"&&l.splice(--e,1))}}b(z,"removeHtmlCommentBlocks");const D=new N;D.setOptions({tokenizer:new V}),D.use({tokenizer:{emStrong:Z().tokenizer?.emStrong},extensions:[...re]});class pe{static{b(this,"Markdown")}text;paddingX;paddingY;defaultTextStyle;theme;options;defaultStylePrefix;cachedText;cachedWidth;cachedLines;cachedTokens;blocks;blockHighlightedCode;constructor(e,t,n,o,r,s){this.text=e,this.paddingX=t,this.paddingY=n,this.theme=o,this.defaultTextStyle=r,this.options=s?{...s}:{}}setText(e){this.text=e,this.clearRenderCache()}invalidate(){this.clearRenderCache(),this.blocks=void 0,this.defaultStylePrefix=void 0}clearRenderCache(){this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0,Y(this)}render(e){if(this.cachedLines&&this.cachedText===this.text&&this.cachedWidth===e)return this.cachedLines;const t=Math.max(1,e-this.paddingX*2),n=this.options.transform?.(this.text,t)??this.text;if(!n||n.trim()===""){this.blocks=void 0;const g=[];return this.cachedText=this.text,this.cachedWidth=e,this.cachedLines=g,g}const o=n.replace(/\t/g," "),r=this.cachedTokens?.deref();let s=r?.source===o?r.tokens:void 0;s||(s=D.lexer(o),_(s),z(s),this.cachedTokens=new WeakRef({source:o,tokens:s}));const c=Object.keys(s.links).length===0,h=this.blocks?.deref(),u=new Map;this.blocks=new WeakRef(u);const i=[];for(let g=0;g<s.length;g++){const L=s[g],T=s[g+1]?.type,W=(c?u.get(L.raw)??h?.get(L.raw):void 0)??{width:-1,nextTokenType:T,lines:[],highlightedCode:new Map};(W.width!==e||W.nextTokenType!==T)&&this.renderBlock(W,L,T,e,t),c&&u.set(L.raw,W);for(const I of W.lines)i.push(I)}const d=this.defaultTextStyle?.bgColor,f=" ".repeat(e),p=[];for(let g=0;g<this.paddingY;g++){const L=d?A(f,e,d):f;p.push(L)}v(p);const y=p.concat(i,p);return this.cachedText=this.text,this.cachedWidth=e,this.cachedLines=y,y.length>0?y:[""]}renderBlock(e,t,n,o,r){this.blockHighlightedCode=e.highlightedCode;const s=" ".repeat(this.paddingX),c=" ".repeat(this.paddingX),h=this.defaultTextStyle?.bgColor,u=[];for(const i of this.renderToken(t,r,n)){if(Q(i)){u.push(i);continue}for(const d of B(i,r)){const f=s+d+c;if(h)u.push(A(f,o,h));else{const p=Math.max(0,o-M(f));u.push(f+" ".repeat(p))}}}this.blockHighlightedCode=void 0,v(u),e.lines=u,e.width=o,e.nextTokenType=n}applyDefaultStyle(e){if(!this.defaultTextStyle)return e;let t=e;return this.defaultTextStyle.color&&(t=this.defaultTextStyle.color(t)),this.defaultTextStyle.bold&&(t=this.theme.bold(t)),this.defaultTextStyle.italic&&(t=this.theme.italic(t)),this.defaultTextStyle.strikethrough&&(t=this.theme.strikethrough(t)),this.defaultTextStyle.underline&&(t=this.theme.underline(t)),t}getDefaultStylePrefix(){if(!this.defaultTextStyle)return"";if(this.defaultStylePrefix!==void 0)return this.defaultStylePrefix;const e="\0";let t=e;this.defaultTextStyle.color&&(t=this.defaultTextStyle.color(t)),this.defaultTextStyle.bold&&(t=this.theme.bold(t)),this.defaultTextStyle.italic&&(t=this.theme.italic(t)),this.defaultTextStyle.strikethrough&&(t=this.theme.strikethrough(t)),this.defaultTextStyle.underline&&(t=this.theme.underline(t));const n=t.indexOf(e);return this.defaultStylePrefix=n>=0?t.slice(0,n):"",this.defaultStylePrefix}getStylePrefix(e){const n=e("\0"),o=n.indexOf("\0");return o>=0?n.slice(0,o):""}getDefaultInlineStyleContext(){return{applyText:b(e=>this.applyDefaultStyle(e),"applyText"),stylePrefix:this.getDefaultStylePrefix()}}renderToken(e,t,n,o){const r=[];switch(e.type){case"heading":{const s=e.depth,c=`${"#".repeat(s)} `;let h;s===1?h=b(f=>this.theme.heading(this.theme.bold(this.theme.underline(f))),"headingStyleFn"):h=b(f=>this.theme.heading(this.theme.bold(f)),"headingStyleFn");const u={applyText:h,stylePrefix:this.getStylePrefix(h)},i=this.renderInlineTokens(e.tokens||[],u),d=s>=3?h(c)+i:i;r.push(d),n&&n!=="space"&&r.push("");break}case"paragraph":{const s=this.renderInlineTokens(e.tokens||[],o);r.push(s),n&&n!=="list"&&n!=="space"&&r.push("");break}case"text":r.push(this.renderInlineTokens([e],o));break;case"latexBlock":{const s=e;let c=!s.pending&&this.options.renderLatex!==!1?q(s.text,{display:!0}):void 0;(c===void 0||c.split(`
|
|
6
|
+
`).some(h=>M(h)>t))&&(c=s.raw.trim());for(const h of c.split(`
|
|
7
|
+
`))r.push(this.applyDefaultStyle(h));n&&n!=="space"&&r.push("");break}case"code":{const s=this.theme.codeBlockIndent??" ";if(r.push(this.theme.codeBlockBorder(`\`\`\`${e.lang||""}`)),this.theme.highlightCode){const c=`${e.lang??""}\0${e.text}`;let h=this.blockHighlightedCode?.get(c);h||(h=this.theme.highlightCode(e.text,e.lang),this.blockHighlightedCode?.set(c,h));for(const u of h)r.push(`${s}${u}`)}else{const c=e.text.split(`
|
|
8
|
+
`);for(const h of c)r.push(`${s}${this.theme.codeBlock(h)}`)}r.push(this.theme.codeBlockBorder("```")),n&&n!=="space"&&r.push("");break}case"list":{const s=this.renderList(e,0,t,o);r.push(...s);break}case"table":{const s=this.renderTable(e,t,n,o);r.push(...s);break}case"blockquote":{const s=b(p=>this.theme.quote(this.theme.italic(p)),"quoteStyle"),c=this.getStylePrefix(s),h=b(p=>{if(!c)return s(p);const y=p.replace(/\x1b\[0m/g,`\x1B[0m${c}`);return s(y)},"applyQuoteStyle");if(t<3){const p=e.tokens||[];for(let y=0;y<p.length;y++)for(const g of this.renderToken(p[y],t,p[y+1]?.type,o))r.push(g);break}const u=t-2,i={applyText:b(p=>p,"applyText"),stylePrefix:c},d=e.tokens||[],f=[];for(let p=0;p<d.length;p++){const y=d[p],g=d[p+1];for(const L of this.renderToken(y,u,g?.type,i))f.push(L)}for(;f.length>0&&f[f.length-1]==="";)f.pop();for(const p of f){const y=h(p),g=B(y,u);for(const L of g)r.push(this.theme.quoteBorder("\u2502 ")+L)}n&&n!=="space"&&r.push("");break}case"hr":r.push(this.theme.hr("\u2500".repeat(Math.min(t,80)))),n&&n!=="space"&&r.push("");break;case"html":"raw"in e&&typeof e.raw=="string"&&r.push(this.applyDefaultStyle(X(e.raw).trim()));break;case"space":r.push("");break;default:"text"in e&&typeof e.text=="string"&&r.push(e.text)}return r}renderInlineTokens(e,t){let n="";const o=t??this.getDefaultInlineStyleContext(),{applyText:r,stylePrefix:s}=o,c=b(u=>u.split(`
|
|
9
|
+
`).map(d=>r(d)).join(`
|
|
10
|
+
`),"applyTextWithNewlines");let h=!1;for(let u=0;u<e.length;u++){let i=e[u];switch(h&&i.type==="text"&&!i.tokens?.length&&/^[ \t]/.test(i.text)&&(i={...i,text:i.text.replace(/^[ \t]+/,"")}),h=!1,i.type){case"latex":{const d=i,f=!d.pending&&this.options.renderLatex!==!1?q(d.text)??d.raw:d.raw;n+=c(f);break}case"escape":n+=c(this.options.preserveBackslashEscapes?i.raw:i.text);break;case"text":i.tokens&&i.tokens.length>0?n+=this.renderInlineTokens(i.tokens,o):n+=c(i.text);break;case"paragraph":n+=this.renderInlineTokens(i.tokens||[],o);break;case"strong":{const d=this.renderInlineTokens(i.tokens||[],o);n+=this.theme.bold(d)+s;break}case"em":{const d=this.renderInlineTokens(i.tokens||[],o);n+=this.theme.italic(d)+s;break}case"codespan":n+=this.theme.code(i.text)+s;break;case"link":{const d=this.renderInlineTokens(i.tokens||[],o),f=this.theme.link(this.theme.underline(d));if(G().hyperlinks)n+=U(f,i.href)+s;else{const p=i.href.startsWith("mailto:")?i.href.slice(7):i.href;i.text===i.href||i.text===p?n+=f+s:n+=f+this.theme.linkUrl(` (${i.href})`)+s}break}case"br":n+=`
|
|
11
|
+
`;break;case"del":{const d=this.renderInlineTokens(i.tokens||[],o);n+=this.theme.strikethrough(d)+s;break}case"html":i.raw.startsWith("<!--")?h=u===0||/[ \t]$/.test(e[u-1].raw):n+=c(i.raw);break;default:"text"in i&&typeof i.text=="string"&&(n+=c(i.text))}}for(;s&&n.endsWith(s);)n=n.slice(0,-s.length);return n}getOrderedListMarker(e){const t=/^(?: {0,3})(\d{1,9}[.)])[ \t]+/.exec(e.raw);return t?`${t[1]} `:void 0}getUnorderedListMarker(e){const t=/^(?: {0,3})([-+*])(?:[ \t]+|(?=\r?\n|$))/.exec(e.raw);return t?`${t[1]} `:void 0}renderList(e,t,n,o){const r=[],s=" ".repeat(t),c=typeof e.start=="number"?e.start:1;for(let h=0;h<e.items.length;h++){const u=e.items[h],i=h===e.items.length-1,d=e.ordered?this.options.preserveOrderedListMarkers?this.getOrderedListMarker(u)??`${c+h}. `:`${c+h}. `:this.options.preserveOrderedListMarkers?this.getUnorderedListMarker(u)??"- ":"- ",f=u.task?`[${u.checked?"x":" "}] `:"",p=d+f,y=s+this.theme.listBullet(p),g=s+" ".repeat(M(p)),L=Math.max(1,n-M(y));let T=!1;for(const C of u.tokens){if(C.type==="list"){r.push(...this.renderList(C,t+1,n,o)),T=!0;continue}const W=this.renderToken(C,L,void 0,o);for(const I of W)for(const R of B(I,L)){const a=T?g:y;r.push(a+R),T=!0}}T||r.push(y),e.loose&&!i&&r.push("")}return r}getLongestWordWidth(e,t){const n=e.split(/\s+/).filter(r=>r.length>0);let o=0;for(const r of n)o=Math.max(o,M(r));return t===void 0?o:Math.min(o,t)}wrapCellText(e,t,n=""){const o=B(e,Math.max(1,t));return o.map((r,s)=>{const c=s<o.length-1?"\x1B[22;23;24;25;27;28;29;39m":"";return`${r}${c}${n}`})}renderTable(e,t,n,o){const r=[],s=e.header.length;if(s===0)return r;const c=3*s+1,h=t-c;if(h<s){const a=e.raw?B(e.raw,t):[];return n&&n!=="space"&&a.push(""),a}const u=30,i=[],d=[];for(let a=0;a<s;a++){const m=this.renderInlineTokens(e.header[a].tokens||[],o);i[a]=M(m),d[a]=Math.max(1,this.getLongestWordWidth(m,u))}for(const a of e.rows)for(let m=0;m<a.length;m++){const w=this.renderInlineTokens(a[m].tokens||[],o);i[m]=Math.max(i[m]||0,M(w)),d[m]=Math.max(d[m]||1,this.getLongestWordWidth(w,u))}let f=d,p=f.reduce((a,m)=>a+m,0);if(p>h){f=new Array(s).fill(1);const a=h-s;if(a>0){const m=d.reduce((x,S)=>x+Math.max(0,S-1),0),w=d.map(x=>{const S=Math.max(0,x-1);return m>0?Math.floor(S/m*a):0});for(let x=0;x<s;x++)f[x]+=w[x]??0;const $=w.reduce((x,S)=>x+S,0);let k=a-$;for(let x=0;k>0&&x<s;x++)f[x]++,k--}p=f.reduce((m,w)=>m+w,0)}const y=i.reduce((a,m)=>a+m,0)+c;let g;if(y<=t)g=i.map((a,m)=>Math.max(a,f[m]));else{const a=i.reduce((k,x,S)=>k+Math.max(0,x-f[S]),0),m=Math.max(0,h-p);g=f.map((k,x)=>{const S=i[x],E=Math.max(0,S-k);let P=0;return a>0&&(P=Math.floor(E/a*m)),k+P});const w=g.reduce((k,x)=>k+x,0);let $=h-w;for(;$>0;){let k=!1;for(let x=0;x<s&&$>0;x++)g[x]<i[x]&&(g[x]++,$--,k=!0);if(!k)break}}const L=g.map(a=>"\u2500".repeat(a));r.push(`\u250C\u2500${L.join("\u2500\u252C\u2500")}\u2500\u2510`);const T=e.header.map((a,m)=>{const w=this.renderInlineTokens(a.tokens||[],o);return this.wrapCellText(w,g[m],o?.stylePrefix)}),C=Math.max(...T.map(a=>a.length));for(let a=0;a<C;a++){const m=T.map((w,$)=>{const k=w[a]||"",x=k+" ".repeat(Math.max(0,g[$]-M(k)));return this.theme.bold(x)});r.push(`\u2502 ${m.join(" \u2502 ")} \u2502`)}const I=`\u251C\u2500${g.map(a=>"\u2500".repeat(a)).join("\u2500\u253C\u2500")}\u2500\u2524`;r.push(I);for(let a=0;a<e.rows.length;a++){const w=e.rows[a].map((k,x)=>{const S=this.renderInlineTokens(k.tokens||[],o);return this.wrapCellText(S,g[x],o?.stylePrefix)}),$=Math.max(...w.map(k=>k.length));for(let k=0;k<$;k++){const x=w.map((S,E)=>{const P=S[k]||"";return P+" ".repeat(Math.max(0,g[E]-M(P)))});r.push(`\u2502 ${x.join(" \u2502 ")} \u2502`)}a<e.rows.length-1&&r.push(I)}const R=g.map(a=>"\u2500".repeat(a));return r.push(`\u2514\u2500${R.join("\u2500\u2534\u2500")}\u2500\u2518`),n&&n!=="space"&&r.push(""),r}}export{pe as Markdown};
|
|
@@ -24,6 +24,7 @@ export interface SelectListLayoutOptions {
|
|
|
24
24
|
truncatePrimary?: (context: SelectListTruncatePrimaryContext) => string;
|
|
25
25
|
}
|
|
26
26
|
export declare class SelectList implements Component {
|
|
27
|
+
readonly capturesViewportInput: boolean;
|
|
27
28
|
private items;
|
|
28
29
|
private filteredItems;
|
|
29
30
|
private selectedIndex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var V=Object.defineProperty;var a=(r,e)=>V(r,"name",{value:e,configurable:!0});import{getKeybindings as W}from"../keybindings.js";import{truncateToWidth as o,visibleWidth as f}from"../utils.js";const p=32,
|
|
1
|
+
var V=Object.defineProperty;var a=(r,e)=>V(r,"name",{value:e,configurable:!0});import{getKeybindings as W,getSelectPageIndex as b}from"../keybindings.js";import{truncateToWidth as o,visibleWidth as f}from"../utils.js";const p=32,C=2,T=10,R=a(r=>r.replace(/[\r\n]+/g," ").trim(),"normalizeToSingleLine"),$=a((r,e,t)=>Math.max(e,Math.min(r,t)),"clamp");class D{static{a(this,"SelectList")}capturesViewportInput=!0;items=[];filteredItems=[];selectedIndex=0;mousePressedIndex;maxVisible=5;theme;layout;onSelect;onCancel;onSelectionChange;constructor(e,t,s,i={}){this.items=e,this.filteredItems=e,this.maxVisible=t,this.theme=s,this.layout=i}setFilter(e){this.filteredItems=this.items.filter(t=>t.value.toLowerCase().startsWith(e.toLowerCase())),this.selectedIndex=0}setSelectedIndex(e){this.selectedIndex=Math.max(0,Math.min(e,this.filteredItems.length-1))}invalidate(){}render(e){const t=[];if(this.filteredItems.length===0)return t.push(this.theme.noMatch(" No matching commands")),t;const s=this.getPrimaryColumnWidth(),{startIndex:i,endIndex:l}=this.getVisibleRange();for(let n=i;n<l;n++){const h=this.filteredItems[n];if(!h)continue;const d=n===this.selectedIndex,c=h.description?R(h.description):void 0;t.push(this.renderItem(h,d,e,c,s))}if(i>0||l<this.filteredItems.length){const n=` (${this.selectedIndex+1}/${this.filteredItems.length})`;t.push(this.theme.scrollInfo(o(n,e-2,"")))}return t}handleMouse(e){if(this.filteredItems.length===0)return;if(e.type==="wheel"&&e.wheelDelta){const l=e.wheelDelta<0?-1:1,n=this.selectedIndex;return this.selectedIndex=Math.max(0,Math.min(this.filteredItems.length-1,this.selectedIndex+l)),this.selectedIndex!==n&&this.notifySelectionChange(),{handled:!0,render:this.selectedIndex!==n}}if(e.button!=="left"||e.type!=="press"&&e.type!=="click")return;const{startIndex:t,endIndex:s}=this.getVisibleRange(),i=t+e.y;if(!(i<t||i>=s)){if(e.type==="press")return this.mousePressedIndex=i,this.selectedIndex!==i&&(this.selectedIndex=i,this.notifySelectionChange()),{handled:!0,focus:!0};if(e.type==="click"){const l=this.mousePressedIndex??i;this.mousePressedIndex=void 0;const n=this.selectedIndex!==l;this.selectedIndex=l,n&&this.notifySelectionChange();const h=this.filteredItems[this.selectedIndex];return h&&this.onSelect?.(h),{handled:!0}}}}handleInput(e){const t=W(),s=b(t,e,this.selectedIndex,this.filteredItems.length,this.maxVisible);if(t.matches(e,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.notifySelectionChange();else if(t.matches(e,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.notifySelectionChange();else if(s!==void 0){if(this.filteredItems.length===0||s===this.selectedIndex)return;this.selectedIndex=s,this.notifySelectionChange()}else if(t.matches(e,"tui.select.confirm")){const i=this.filteredItems[this.selectedIndex];i&&this.onSelect&&this.onSelect(i)}else t.matches(e,"tui.select.cancel")&&this.onCancel&&this.onCancel()}getVisibleRange(){const e=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible));return{startIndex:e,endIndex:Math.min(e+this.maxVisible,this.filteredItems.length)}}renderItem(e,t,s,i,l){const n=t?"\u2192 ":" ",h=f(n);if(i&&s>40){const m=Math.max(1,Math.min(l,s-h-4)),M=Math.max(1,m-C),u=this.truncatePrimary(e,t,M,m),x=f(u),I=" ".repeat(Math.max(1,m-x)),P=h+x+I.length,g=s-P-2;if(g>T){const y=o(i,g,"");if(t)return this.theme.selectedText(`${n}${u}${I}${y}`);const S=this.theme.description(I+y);return n+u+S}}const d=s-h-2,c=this.truncatePrimary(e,t,d,d);return t?this.theme.selectedText(`${n}${c}`):n+c}getPrimaryColumnWidth(){const{min:e,max:t}=this.getPrimaryColumnBounds(),s=this.filteredItems.reduce((i,l)=>Math.max(i,f(this.getDisplayValue(l))+C),0);return $(s,e,t)}getPrimaryColumnBounds(){const e=this.layout.minPrimaryColumnWidth??this.layout.maxPrimaryColumnWidth??p,t=this.layout.maxPrimaryColumnWidth??this.layout.minPrimaryColumnWidth??p;return{min:Math.max(1,Math.min(e,t)),max:Math.max(1,Math.max(e,t))}}truncatePrimary(e,t,s,i){const l=this.getDisplayValue(e),n=this.layout.truncatePrimary?this.layout.truncatePrimary({text:l,maxWidth:s,columnWidth:i,item:e,isSelected:t}):o(l,s,"");return o(n,s,"")}getDisplayValue(e){return e.label||e.value}notifySelectionChange(){const e=this.filteredItems[this.selectedIndex];e&&this.onSelectionChange&&this.onSelectionChange(e)}getSelectedItem(){return this.filteredItems[this.selectedIndex]||null}}export{D as SelectList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var V=Object.defineProperty;var f=(o,e)=>V(o,"name",{value:e,configurable:!0});import{fuzzyFilter as E}from"../fuzzy.js";import{getKeybindings as M,getSelectPageIndex as v}from"../keybindings.js";import{truncateToWidth as r,visibleWidth as d,wrapTextWithAnsi as D}from"../utils.js";import{Input as L}from"./input.js";class H{static{f(this,"SettingsList")}capturesViewportInput=!0;items;filteredItems;theme;selectedIndex=0;mousePressedIndex;maxVisible;onChange;onCancel;searchInput;searchEnabled;submenuComponent=null;submenuItemIndex=null;navigateAfterClose=null;constructor(e,t,s,n,u,h={}){this.items=e,this.filteredItems=e,this.maxVisible=t,this.theme=s,this.onChange=n,this.onCancel=u,this.searchEnabled=h.enableSearch??!1,this.searchEnabled&&(this.searchInput=new L)}updateValue(e,t){const s=this.items.find(n=>n.id===e);s&&(s.currentValue=t)}selectItem(e){const s=(this.searchEnabled?this.filteredItems:this.items).findIndex(n=>n.id===e);s!==-1&&(this.selectedIndex=s)}invalidate(){this.submenuComponent?.invalidate?.()}render(e){return this.submenuComponent?this.submenuComponent.render(e):this.renderMainList(e)}renderMainList(e){const t=[];if(this.searchEnabled&&this.searchInput&&(t.push(...this.searchInput.render(e)),t.push("")),this.items.length===0)return t.push(this.theme.hint(" No settings available")),this.searchEnabled&&this.addHintLine(t,e),t;const s=this.getDisplayItems();if(s.length===0)return t.push(r(this.theme.hint(" No matching settings"),e)),this.addHintLine(t,e),t;const{startIndex:n,endIndex:u}=this.getVisibleRange(s),h=Math.min(36,Math.max(...this.items.map(i=>d(i.label))));for(let i=n;i<u;i++){const a=s[i];if(!a)continue;const c=i===this.selectedIndex,m=c?this.theme.cursor:" ",p=d(m),x=a.label+" ".repeat(Math.max(0,h-d(a.label))),b=this.theme.label(x,c),I=" ",g=p+h+d(I),C=e-g-2,y=this.theme.value(r(a.currentValue,C,""),c);t.push(r(m+b+I+y,e))}if(n>0||u<s.length){const i=` (${this.selectedIndex+1}/${s.length})`;t.push(this.theme.hint(r(i,e-2,"")))}const l=s[this.selectedIndex];if(l?.description){t.push("");const i=D(l.description,e-4);for(const a of i)t.push(this.theme.description(` ${a}`))}return this.addHintLine(t,e),t}handleMouse(e){if(this.submenuComponent){const l=this.submenuComponent.handleMouse?.(e);return l?{...l,focus:!0}:void 0}if(this.searchEnabled&&this.searchInput){if(e.y===0){const l=this.searchInput.handleMouse?.(e);return l?{...l,focus:!0}:void 0}if(e.y===1)return}const t=this.getDisplayItems();if(t.length===0)return;if(e.type==="wheel"&&e.wheelDelta){const l=e.wheelDelta<0?-1:1,i=this.selectedIndex;return this.selectedIndex=Math.max(0,Math.min(t.length-1,this.selectedIndex+l)),{handled:!0,render:this.selectedIndex!==i}}if(e.button!=="left"||e.type!=="press"&&e.type!=="click")return;const s=this.searchEnabled?2:0,{startIndex:n,endIndex:u}=this.getVisibleRange(t),h=n+e.y-s;if(!(h<n||h>=u)){if(e.type==="press")return this.mousePressedIndex=h,this.selectedIndex=h,{handled:!0,focus:!0};if(e.type==="click")return this.selectedIndex=this.mousePressedIndex??h,this.mousePressedIndex=void 0,this.activateItem(),{handled:!0}}}handleInput(e){if(this.submenuComponent){this.submenuComponent.handleInput?.(e);return}const t=M(),s=this.getDisplayItems(),n=v(t,e,this.selectedIndex,s.length,this.maxVisible);if(t.matches(e,"tui.select.up")){if(s.length===0)return;this.selectedIndex=this.selectedIndex===0?s.length-1:this.selectedIndex-1}else if(t.matches(e,"tui.select.down")){if(s.length===0)return;this.selectedIndex=this.selectedIndex===s.length-1?0:this.selectedIndex+1}else if(n!==void 0){if(s.length===0)return;this.selectedIndex=n}else t.matches(e,"tui.select.confirm")||e===" "&&(!this.searchEnabled||this.searchInput?.getValue().length===0)?this.activateItem():t.matches(e,"tui.select.cancel")?this.onCancel():this.searchEnabled&&this.searchInput&&(this.searchInput.handleInput(e),this.applyFilter(this.searchInput.getValue()))}getDisplayItems(){return this.searchEnabled?this.filteredItems:this.items}getVisibleRange(e){const t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),e.length-this.maxVisible));return{startIndex:t,endIndex:Math.min(t+this.maxVisible,e.length)}}activateItem(){const e=this.getDisplayItems()[this.selectedIndex];if(e){if(e.submenu)this.submenuItemIndex=this.selectedIndex,this.submenuComponent=e.submenu(e.currentValue,(t,s)=>{t!==void 0&&(e.currentValue=t,this.onChange(e.id,t)),s?.navigateTo&&(this.navigateAfterClose=s.navigateTo),this.closeSubmenu()});else if(e.values&&e.values.length>0){const s=(e.values.indexOf(e.currentValue)+1)%e.values.length,n=e.values[s];e.currentValue=n,this.onChange(e.id,n)}}}closeSubmenu(){if(this.submenuComponent=null,this.navigateAfterClose!==null){const e=this.navigateAfterClose;this.navigateAfterClose=null,this.submenuItemIndex=null,this.selectItem(e),this.activateItem()}else this.submenuItemIndex!==null&&(this.selectedIndex=this.submenuItemIndex,this.submenuItemIndex=null)}applyFilter(e){this.filteredItems=E(this.items,e,t=>t.label),this.selectedIndex=0}addHintLine(e,t){e.push(""),e.push(r(this.theme.hint(this.searchEnabled?" Type to search \xB7 Enter/Space to change \xB7 Esc to cancel":" Enter/Space to change \xB7 Esc to cancel"),t))}}export{H as SettingsList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var L=Object.defineProperty;var p=(o,t)=>L(o,"name",{value:t,configurable:!0});import{bumpLayoutAncestors as T}from"../tui.js";import{applyBackgroundToLine as u,flattenLines as W,visibleWidth as B,wrapTextWithAnsi as F}from"../utils.js";class y{static{p(this,"Text")}text;paddingX;paddingY;customBgFn;cachedText;cachedWidth;cachedLines;constructor(t="",
|
|
1
|
+
var L=Object.defineProperty;var p=(o,t)=>L(o,"name",{value:t,configurable:!0});import{bumpLayoutAncestors as T}from"../tui.js";import{applyBackgroundToLine as u,flattenLines as W,visibleWidth as B,wrapTextWithAnsi as F}from"../utils.js";class y{static{p(this,"Text")}text;paddingX;paddingY;customBgFn;cachedText;cachedWidth;cachedLines;constructor(t="",h=1,i=1,c){this.text=t,this.paddingX=h,this.paddingY=i,this.customBgFn=c}setText(t){t!==this.text&&(this.text=t,this.invalidate())}setCustomBgFn(t){this.customBgFn=t,this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0}setPaddingX(t){this.paddingX=t,this.invalidate()}invalidate(){this.cachedText=void 0,this.cachedWidth=void 0,this.cachedLines=void 0,T(this)}render(t){if(this.cachedLines&&this.cachedText===this.text&&this.cachedWidth===t)return this.cachedLines;if(!this.text||this.text.trim()===""){const e=[];return this.cachedText=this.text,this.cachedWidth=t,this.cachedLines=e,e}const h=this.text.replace(/\t/g," "),i=Math.min(this.paddingX,Math.max(0,Math.floor((t-1)/2))),c=Math.max(1,t-i*2),g=F(h,c),x=" ".repeat(i),m=" ".repeat(i),d=[];for(const e of g){const s=x+e+m;if(this.customBgFn)d.push(u(s,t,this.customBgFn));else{const l=B(s),f=Math.max(0,t-l);d.push(s+" ".repeat(f))}}const r=" ".repeat(t),a=[];for(let e=0;e<this.paddingY;e++){const s=this.customBgFn?u(r,t,this.customBgFn):r;a.push(s)}const n=[...a,...d,...a];return W(n),this.cachedText=this.text,this.cachedWidth=t,this.cachedLines=n,n.length>0?n:[""]}}export{y as Text};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var g=Object.defineProperty;var f=(e,r)=>g(e,"name",{value:r,configurable:!0});function l(e,r){let s=0,n=-1,c=0;for(const t of r)n===t-1?(c++,s-=c*5):(c=0,n>=0&&(s+=(t-n-1)*2)),(t===0||/[\s\-_./:]/.test(e[t-1]))&&(s-=10),s+=t*.1,n=t;return s}f(l,"scorePositions");function u(e,r){if(e.length===0)return{matches:!0,score:0};if(e.length>r.length)return{matches:!1,score:0};const s=[];let n=-1;for(let t=0;t<e.length;t++){const o=r.indexOf(e[t],n+1);if(o===-1)return{matches:!1,score:0};s.push(o),n=o}let c=l(r,s);for(let t=r.indexOf(e);t!==-1;t=r.indexOf(e,t+1)){for(let o=0;o<s.length;o++)s[o]=t+o;c=Math.min(c,l(r,s))}return e===r&&(c-=100),{matches:!0,score:c}}f(u,"matchQuery");function m(e,r){const s=e.toLowerCase(),n=r.toLowerCase(),c=u(s,n);if(c.matches)return c;const t=s.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/),o=s.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/),i=t?`${t.groups?.digits??""}${t.groups?.letters??""}`:o?`${o.groups?.letters??""}${o.groups?.digits??""}`:"";if(!i)return c;const a=u(i,n);return a.matches?{matches:!0,score:a.score+5}:c}f(m,"fuzzyMatch");function d(e,r,s){if(!r.trim())return e;const n=r.trim().split(/[\s/]+/).filter(t=>t.length>0);if(n.length===0)return e;const c=[];for(const t of e){const o=s(t);let i=0,a=!0;for(const p of n){const h=m(p,o);if(h.matches)i+=h.score;else{a=!1;break}}a&&c.push({item:t,totalScore:i})}return c.sort((t,o)=>t.totalScore-o.totalScore),c.map(t=>t.item)}f(d,"fuzzyFilter");export{d as fuzzyFilter,m as fuzzyMatch};
|
|
@@ -19,7 +19,7 @@ export { TruncatedText } from "./components/truncated-text.ts";
|
|
|
19
19
|
export { type StackChild, type StackEntry, type StackEntryOptions, type StackOptions, VStack, } from "./components/v-stack.ts";
|
|
20
20
|
export type { EditorComponent } from "./editor-component.ts";
|
|
21
21
|
export { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from "./fuzzy.ts";
|
|
22
|
-
export { getKeybindings, type Keybinding, type KeybindingConflict, type KeybindingDefinition, type KeybindingDefinitions, type Keybindings, type KeybindingsConfig, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.ts";
|
|
22
|
+
export { getKeybindings, getSelectPageIndex, type Keybinding, type KeybindingConflict, type KeybindingDefinition, type KeybindingDefinitions, type Keybindings, type KeybindingsConfig, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.ts";
|
|
23
23
|
export { decodeKittyPrintable, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, type KeyEventType, type KeyId, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.ts";
|
|
24
24
|
export { type RenderLatexOptions, renderLatex } from "./latex.ts";
|
|
25
25
|
export { getNativeClipboard, type NativeClipboard } from "./native-platform.ts";
|
|
@@ -32,5 +32,5 @@ export { allocateImageId, type CellDimensions, calculateImageRows, deleteAllKitt
|
|
|
32
32
|
export { type Component, Container, CURSOR_MARKER, compositeTuiLine, type Focusable, isFocusable, isViewportTUI, type OverlayAnchor, type OverlayBounds, type OverlayHandle, type OverlayMargin, type OverlayOptions, type OverlayUnfocusOptions, renderFakeCursor, type SizeValue, type TUI, type TuiInputListener, type TuiInputListenerResult, type TuiMode, type TuiMouseButton, type TuiMouseEvent, type TuiMouseEventResult, type TuiMouseEventType, type TuiStopOptions, type ViewportTUI, } from "./tui.ts";
|
|
33
33
|
export { TuiAltScreen, type TuiAltScreenOptions } from "./tui-alt-screen.ts";
|
|
34
34
|
export { TuiMainScreen, type TuiMainScreenRenderState } from "./tui-main-screen.ts";
|
|
35
|
-
export { getOsc8LinkAtColumn, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.ts";
|
|
35
|
+
export { getOsc8LinkAtColumn, replaceControlCharacters, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.ts";
|
|
36
36
|
export type { WheelScrollLines } from "./wheel-scroll.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Marked as r}from"marked";import{CombinedAutocompleteProvider as i}from"./autocomplete.js";import{backgroundAnsi as a,colorToHex as
|
|
1
|
+
import{Marked as r}from"marked";import{CombinedAutocompleteProvider as i}from"./autocomplete.js";import{backgroundAnsi as a,colorToHex as l,colorToOkhsl as m,colorToOklch as n,colorToRgb as p,foregroundAnsi as x,indexedColor as c,mixColors as f,okhslColor as g,oklchColor as d,parseColor as C,rgbColor as T,styleText as y,styleTextWithAnsi as b}from"./colors.js";import{Box as h}from"./components/box.js";import{CancellableLoader as K}from"./components/cancellable-loader.js";import{Editor as k}from"./components/editor.js";import{HStack as R}from"./components/h-stack.js";import{Image as L,setImageTranscoder as M}from"./components/image.js";import{Input as v}from"./components/input.js";import{Loader as w}from"./components/loader.js";import{Markdown as z}from"./components/markdown.js";import{MouseRegion as F}from"./components/mouse-region.js";import{ScrollView as N}from"./components/scroll-view.js";import{SelectList as V}from"./components/select-list.js";import{SettingsList as H}from"./components/settings-list.js";import{Spacer as q}from"./components/spacer.js";import{Text as Y}from"./components/text.js";import{TruncatedText as Q}from"./components/truncated-text.js";import{VStack as Z}from"./components/v-stack.js";import{fuzzyFilter as ee,fuzzyMatch as oe}from"./fuzzy.js";import{getKeybindings as te,getSelectPageIndex as ie,KeybindingsManager as se,setKeybindings as ae,TUI_KEYBINDINGS as le}from"./keybindings.js";import{decodeKittyPrintable as ne,isKeyRelease as pe,isKeyRepeat as xe,isKittyProtocolActive as ce,Key as fe,matchesKey as ge,parseKey as de,setKittyProtocolActive as Ce}from"./keys.js";import{renderLatex as ye}from"./latex.js";import{getNativeClipboard as ue}from"./native-platform.js";import{oklabToOkhslLightness as Ie}from"./oklab.js";import{formatProgramStatus as Se}from"./program-status.js";import{StdinBuffer as Ae}from"./stdin-buffer.js";import{isAppleTerminalSession as De,ProcessTerminal as Le}from"./terminal.js";import{parseTerminalColorSchemeReport as Pe}from"./terminal-colors.js";import{allocateImageId as Oe,calculateImageRows as we,deleteAllKittyImages as We,deleteKittyImage as ze,detectCapabilities as Be,encodeITerm2 as Fe,encodeKitty as Ee,getCapabilities as Ne,getCellDimensions as Ue,getGifDimensions as Ve,getImageDimensions as Ge,getJpegDimensions as He,getPngDimensions as _e,getTerminalColorMode as qe,getWebpDimensions as Je,hyperlink as Ye,imageFallback as je,renderImage as Qe,resetCapabilitiesCache as Xe,setCapabilities as Ze,setCapabilityOverrides as $e,setCellDimensions as eo}from"./terminal-image.js";import{Container as ro,CURSOR_MARKER as to,compositeTuiLine as io,isFocusable as so,isViewportTUI as ao,renderFakeCursor as lo}from"./tui.js";import{TuiAltScreen as no}from"./tui-alt-screen.js";import{TuiMainScreen as xo}from"./tui-main-screen.js";import{getOsc8LinkAtColumn as fo,replaceControlCharacters as go,sliceByColumn as Co,stripTerminalSequences as To,truncateToWidth as yo,visibleWidth as bo,wrapTextWithAnsi as uo}from"./utils.js";export{h as Box,to as CURSOR_MARKER,K as CancellableLoader,i as CombinedAutocompleteProvider,ro as Container,k as Editor,R as HStack,L as Image,v as Input,fe as Key,se as KeybindingsManager,w as Loader,z as Markdown,r as Marked,F as MouseRegion,Le as ProcessTerminal,N as ScrollView,V as SelectList,H as SettingsList,q as Spacer,Ae as StdinBuffer,le as TUI_KEYBINDINGS,Y as Text,Q as TruncatedText,no as TuiAltScreen,xo as TuiMainScreen,Z as VStack,Oe as allocateImageId,a as backgroundAnsi,we as calculateImageRows,l as colorToHex,m as colorToOkhsl,n as colorToOklch,p as colorToRgb,io as compositeTuiLine,ne as decodeKittyPrintable,We as deleteAllKittyImages,ze as deleteKittyImage,Be as detectCapabilities,Fe as encodeITerm2,Ee as encodeKitty,x as foregroundAnsi,Se as formatProgramStatus,ee as fuzzyFilter,oe as fuzzyMatch,Ne as getCapabilities,Ue as getCellDimensions,Ve as getGifDimensions,Ge as getImageDimensions,He as getJpegDimensions,te as getKeybindings,ue as getNativeClipboard,fo as getOsc8LinkAtColumn,_e as getPngDimensions,ie as getSelectPageIndex,qe as getTerminalColorMode,Je as getWebpDimensions,Ye as hyperlink,je as imageFallback,c as indexedColor,De as isAppleTerminalSession,so as isFocusable,pe as isKeyRelease,xe as isKeyRepeat,ce as isKittyProtocolActive,ao as isViewportTUI,ge as matchesKey,f as mixColors,g as okhslColor,Ie as oklabToOkhslLightness,d as oklchColor,C as parseColor,de as parseKey,Pe as parseTerminalColorSchemeReport,lo as renderFakeCursor,Qe as renderImage,ye as renderLatex,go as replaceControlCharacters,Xe as resetCapabilitiesCache,T as rgbColor,Ze as setCapabilities,$e as setCapabilityOverrides,eo as setCellDimensions,M as setImageTranscoder,ae as setKeybindings,Ce as setKittyProtocolActive,Co as sliceByColumn,To as stripTerminalSequences,y as styleText,b as styleTextWithAnsi,yo as truncateToWidth,bo as visibleWidth,uo as wrapTextWithAnsi};
|
|
@@ -266,3 +266,4 @@ export declare class KeybindingsManager {
|
|
|
266
266
|
}
|
|
267
267
|
export declare function setKeybindings(keybindings: KeybindingsManager): void;
|
|
268
268
|
export declare function getKeybindings(): KeybindingsManager;
|
|
269
|
+
export declare function getSelectPageIndex(keybindings: KeybindingsManager, data: string, selectedIndex: number, itemCount: number, pageSize: number): number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var
|
|
1
|
+
var l=Object.defineProperty;var n=(s,e)=>l(s,"name",{value:e,configurable:!0});import{matchesKey as a}from"./keys.js";const u={"tui.editor.cursorUp":{defaultKeys:"up",description:"Move cursor up"},"tui.editor.cursorDown":{defaultKeys:"down",description:"Move cursor down"},"tui.editor.historyPrevious":{defaultKeys:[],description:"Select previous prompt history entry"},"tui.editor.historyNext":{defaultKeys:[],description:"Select next prompt history entry"},"tui.editor.cursorLeft":{defaultKeys:["left","ctrl+b"],description:"Move cursor left"},"tui.editor.cursorRight":{defaultKeys:["right","ctrl+f"],description:"Move cursor right"},"tui.editor.cursorWordLeft":{defaultKeys:["alt+left","ctrl+left","alt+b"],description:"Move cursor word left"},"tui.editor.cursorWordRight":{defaultKeys:["alt+right","ctrl+right","alt+f"],description:"Move cursor word right"},"tui.editor.cursorLineStart":{defaultKeys:["home","ctrl+a"],description:"Move to line start"},"tui.editor.cursorLineEnd":{defaultKeys:["end","ctrl+e"],description:"Move to line end"},"tui.editor.jumpForward":{defaultKeys:"ctrl+]",description:"Jump forward to character"},"tui.editor.jumpBackward":{defaultKeys:"ctrl+alt+]",description:"Jump backward to character"},"tui.editor.pageUp":{defaultKeys:["pageUp","ctrl+pageUp"],description:"Page up"},"tui.editor.pageDown":{defaultKeys:["pageDown","ctrl+pageDown"],description:"Page down"},"tui.editor.deleteCharBackward":{defaultKeys:"backspace",description:"Delete character backward"},"tui.editor.deleteCharForward":{defaultKeys:["delete","ctrl+d"],description:"Delete character forward"},"tui.editor.deleteWordBackward":{defaultKeys:["ctrl+w","alt+backspace"],description:"Delete word backward"},"tui.editor.deleteWordForward":{defaultKeys:["alt+d","alt+delete"],description:"Delete word forward"},"tui.editor.deleteToLineStart":{defaultKeys:"ctrl+u",description:"Delete to line start"},"tui.editor.deleteToLineEnd":{defaultKeys:"ctrl+k",description:"Delete to line end"},"tui.editor.yank":{defaultKeys:"ctrl+y",description:"Yank"},"tui.editor.yankPop":{defaultKeys:"alt+y",description:"Yank pop"},"tui.editor.undo":{defaultKeys:"ctrl+-",description:"Undo"},"tui.input.newLine":{defaultKeys:["shift+enter","ctrl+j"],description:"Insert newline"},"tui.input.submit":{defaultKeys:"enter",description:"Submit input"},"tui.input.tab":{defaultKeys:"tab",description:"Tab / autocomplete"},"tui.input.copy":{defaultKeys:"ctrl+c",description:"Copy selection"},"tui.select.up":{defaultKeys:"up",description:"Move selection up"},"tui.select.down":{defaultKeys:"down",description:"Move selection down"},"tui.select.pageUp":{defaultKeys:"pageUp",description:"Selection page up"},"tui.select.pageDown":{defaultKeys:"pageDown",description:"Selection page down"},"tui.select.confirm":{defaultKeys:"enter",description:"Confirm selection"},"tui.select.cancel":{defaultKeys:["escape","ctrl+c"],description:"Cancel selection"},"tui.altScreen.pageUp":{defaultKeys:"pageUp",description:"Scroll viewport up one page"},"tui.altScreen.pageDown":{defaultKeys:"pageDown",description:"Scroll viewport down one page"},"tui.altScreen.halfPageUp":{defaultKeys:[],description:"Scroll viewport up half a page"},"tui.altScreen.halfPageDown":{defaultKeys:[],description:"Scroll viewport down half a page"},"tui.altScreen.lineUp":{defaultKeys:[],description:"Scroll viewport up one line"},"tui.altScreen.lineDown":{defaultKeys:[],description:"Scroll viewport down one line"},"tui.altScreen.previousPrompt":{defaultKeys:["ctrl+shift+up","ctrl+up"],description:"Jump to previous semantic prompt"},"tui.altScreen.nextPrompt":{defaultKeys:["ctrl+shift+down","ctrl+down"],description:"Jump to next semantic prompt"},"tui.altScreen.search":{defaultKeys:"ctrl+shift+f",description:"Search the primary scroll view"},"tui.altScreen.searchNext":{defaultKeys:["enter","ctrl+g"],description:"Select the next search match"},"tui.altScreen.searchPrevious":{defaultKeys:["shift+enter","ctrl+shift+g"],description:"Select the previous search match"},"tui.altScreen.searchClose":{defaultKeys:"escape",description:"Close transcript search"},"tui.altScreen.top":{defaultKeys:"ctrl+home",description:"Scroll viewport to top"},"tui.altScreen.bottom":{defaultKeys:"ctrl+end",description:"Scroll viewport to bottom"}};function d(s){if(s===void 0)return[];const e=Array.isArray(s)?s:[s],t=new Set,i=[];for(const r of e)t.has(r)||(t.add(r),i.push(r));return i}n(d,"normalizeKeys");class p{static{n(this,"KeybindingsManager")}definitions;userBindings;keysById=new Map;conflicts=[];constructor(e,t={}){this.definitions=e,this.userBindings=t,this.rebuild()}rebuild(){this.keysById.clear(),this.conflicts=[];const e=new Map;for(const[t,i]of Object.entries(this.userBindings))if(t in this.definitions)for(const r of d(i)){const o=e.get(r)??new Set;o.add(t),e.set(r,o)}for(const[t,i]of e)i.size>1&&this.conflicts.push({key:t,keybindings:[...i]});for(const[t,i]of Object.entries(this.definitions)){const r=this.userBindings[t],o=d(r===void 0?i.defaultKeys:r);this.keysById.set(t,o)}}matches(e,t){const i=this.keysById.get(t)??[];for(const r of i)if(a(e,r))return!0;return!1}getKeys(e){return[...this.keysById.get(e)??[]]}getDefinition(e){return this.definitions[e]}getConflicts(){return this.conflicts.map(e=>({...e,keybindings:[...e.keybindings]}))}setUserBindings(e){this.userBindings=e,this.rebuild()}getUserBindings(){return{...this.userBindings}}getResolvedBindings(){const e={};for(const t of Object.keys(this.definitions)){const i=this.keysById.get(t)??[];e[t]=i.length===1?i[0]:[...i]}return e}}let c=null;function h(s){c=s}n(h,"setKeybindings");function g(){return c||(c=new p(u)),c}n(g,"getKeybindings");function K(s,e,t,i,r){let o;if(s.matches(e,"tui.select.pageUp"))o=-1;else if(s.matches(e,"tui.select.pageDown"))o=1;else return;return Math.max(0,Math.min(i-1,t+o*r))}n(K,"getSelectPageIndex");export{p as KeybindingsManager,u as TUI_KEYBINDINGS,g as getKeybindings,K as getSelectPageIndex,h as setKeybindings};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var B=Object.defineProperty;var
|
|
2
|
-
`:!1:r===n.alt?
|
|
3
|
-
`||e==="\x1BOM"||
|
|
4
|
-
`))return"shift+enter";const i=
|
|
5
|
-
`||e==="\x1BOM")return"enter";if(e==="\0")return"ctrl+space";if(e===" ")return"space";if(e==="\x7F")return"backspace";if(e==="\b")return U()?"ctrl+backspace":"backspace";if(e==="\x1B[Z")return"shift+tab";if(!
|
|
1
|
+
var B=Object.defineProperty;var u=(e,t)=>B(e,"name",{value:t,configurable:!0});let g=!1;function re(e){g=e}u(re,"setKittyProtocolActive");function te(){return g}u(te,"isKittyProtocolActive");const ne={escape:"escape",esc:"esc",enter:"enter",return:"return",tab:"tab",space:"space",backspace:"backspace",delete:"delete",insert:"insert",clear:"clear",home:"home",end:"end",pageUp:"pageUp",pageDown:"pageDown",up:"up",down:"down",left:"left",right:"right",f1:"f1",f2:"f2",f3:"f3",f4:"f4",f5:"f5",f6:"f6",f7:"f7",f8:"f8",f9:"f9",f10:"f10",f11:"f11",f12:"f12",backtick:"`",hyphen:"-",equals:"=",leftbracket:"[",rightbracket:"]",backslash:"\\",semicolon:";",quote:"'",comma:",",period:".",slash:"/",exclamation:"!",at:"@",hash:"#",dollar:"$",percent:"%",caret:"^",ampersand:"&",asterisk:"*",leftparen:"(",rightparen:")",underscore:"_",plus:"+",pipe:"|",tilde:"~",leftbrace:"{",rightbrace:"}",colon:":",lessthan:"<",greaterthan:">",question:"?",ctrl:u(e=>`ctrl+${e}`,"ctrl"),shift:u(e=>`shift+${e}`,"shift"),alt:u(e=>`alt+${e}`,"alt"),super:u(e=>`super+${e}`,"super"),ctrlShift:u(e=>`ctrl+shift+${e}`,"ctrlShift"),shiftCtrl:u(e=>`shift+ctrl+${e}`,"shiftCtrl"),ctrlAlt:u(e=>`ctrl+alt+${e}`,"ctrlAlt"),altCtrl:u(e=>`alt+ctrl+${e}`,"altCtrl"),shiftAlt:u(e=>`shift+alt+${e}`,"shiftAlt"),altShift:u(e=>`alt+shift+${e}`,"altShift"),ctrlSuper:u(e=>`ctrl+super+${e}`,"ctrlSuper"),superCtrl:u(e=>`super+ctrl+${e}`,"superCtrl"),shiftSuper:u(e=>`shift+super+${e}`,"shiftSuper"),superShift:u(e=>`super+shift+${e}`,"superShift"),altSuper:u(e=>`alt+super+${e}`,"altSuper"),superAlt:u(e=>`super+alt+${e}`,"superAlt"),ctrlShiftAlt:u(e=>`ctrl+shift+alt+${e}`,"ctrlShiftAlt"),ctrlShiftSuper:u(e=>`ctrl+shift+super+${e}`,"ctrlShiftSuper")},w=new Set(["`","-","=","[","]","\\",";","'",",",".","/","!","@","#","$","%","^","&","*","(",")","_","+","|","~","{","}",":","<",">","?"]),N=new Set("~!@#$%^&*()_+|{}:<>?"),Y=["shift","alt","ctrl","super"],n={shift:1,alt:2,ctrl:4,super:8},E=192,b={escape:27,tab:9,enter:13,space:32,backspace:127,kpEnter:57414},x={up:-1,down:-2,right:-3,left:-4},s={delete:-10,insert:-11,pageUp:-12,pageDown:-13,home:-14,end:-15,f1:-21,f2:-22,f3:-23,f4:-24,f5:-25,f6:-26,f7:-27,f8:-28,f9:-29,f10:-30,f11:-31,f12:-32},H=57344,R=63743,a=new Map([[57399,48],[57400,49],[57401,50],[57402,51],[57403,52],[57404,53],[57405,54],[57406,55],[57407,56],[57408,57],[57409,46],[57410,47],[57411,42],[57412,45],[57413,43],[57415,61],[57416,44],[57417,x.left],[57418,x.right],[57419,x.up],[57420,x.down],[57421,s.pageUp],[57422,s.pageDown],[57423,s.home],[57424,s.end],[57425,s.insert],[57426,s.delete]]);function $(e){return a.get(e)??e}u($,"normalizeKittyFunctionalCodepoint");function K(e,t){return(t&~E&n.shift)!==0&&e>=65&&e<=90?e+32:e}u(K,"normalizeShiftedLetterIdentityCodepoint");function k(e,t,f){if(e===void 0||(t&n.shift)===0)return;const i=$(e);if(f.has(String.fromCharCode(i)))return{codepoint:i,modifier:t&~n.shift}}u(k,"getLogicalShiftedSymbolCandidate");const y={up:["\x1B[A","\x1BOA"],down:["\x1B[B","\x1BOB"],right:["\x1B[C","\x1BOC"],left:["\x1B[D","\x1BOD"],home:["\x1B[H","\x1BOH","\x1B[1~","\x1B[7~"],end:["\x1B[F","\x1BOF","\x1B[4~","\x1B[8~"],insert:["\x1B[2~"],delete:["\x1B[3~"],pageUp:["\x1B[5~","\x1B[[5~"],pageDown:["\x1B[6~","\x1B[[6~"],clear:["\x1B[E","\x1BOE"],f1:["\x1BOP","\x1B[11~","\x1B[[A"],f2:["\x1BOQ","\x1B[12~","\x1B[[B"],f3:["\x1BOR","\x1B[13~","\x1B[[C"],f4:["\x1BOS","\x1B[14~","\x1B[[D"],f5:["\x1B[15~","\x1B[[E"],f6:["\x1B[17~"],f7:["\x1B[18~"],f8:["\x1B[19~"],f9:["\x1B[20~"],f10:["\x1B[21~"],f11:["\x1B[23~"],f12:["\x1B[24~"]},Q={up:["\x1B[a"],down:["\x1B[b"],right:["\x1B[c"],left:["\x1B[d"],clear:["\x1B[e"],insert:["\x1B[2$"],delete:["\x1B[3$"],pageUp:["\x1B[5$"],pageDown:["\x1B[6$"],home:["\x1B[7$"],end:["\x1B[8$"]},q={up:["\x1BOa"],down:["\x1BOb"],right:["\x1BOc"],left:["\x1BOd"],clear:["\x1BOe"],insert:["\x1B[2^"],delete:["\x1B[3^"],pageUp:["\x1B[5^"],pageDown:["\x1B[6^"],home:["\x1B[7^"],end:["\x1B[8^"]},z={"\x1BOA":"up","\x1BOB":"down","\x1BOC":"right","\x1BOD":"left","\x1BOH":"home","\x1BOF":"end","\x1B[E":"clear","\x1BOE":"clear","\x1BOe":"ctrl+clear","\x1B[e":"shift+clear","\x1B[2~":"insert","\x1B[2$":"shift+insert","\x1B[2^":"ctrl+insert","\x1B[3$":"shift+delete","\x1B[3^":"ctrl+delete","\x1B[[5~":"pageUp","\x1B[[6~":"pageDown","\x1B[a":"shift+up","\x1B[b":"shift+down","\x1B[c":"shift+right","\x1B[d":"shift+left","\x1BOa":"ctrl+up","\x1BOb":"ctrl+down","\x1BOc":"ctrl+right","\x1BOd":"ctrl+left","\x1B[5$":"shift+pageUp","\x1B[6$":"shift+pageDown","\x1B[7$":"shift+home","\x1B[8$":"shift+end","\x1B[5^":"ctrl+pageUp","\x1B[6^":"ctrl+pageDown","\x1B[7^":"ctrl+home","\x1B[8^":"ctrl+end","\x1BOP":"f1","\x1BOQ":"f2","\x1BOR":"f3","\x1BOS":"f4","\x1B[11~":"f1","\x1B[12~":"f2","\x1B[13~":"f3","\x1B[14~":"f4","\x1B[[A":"f1","\x1B[[B":"f2","\x1B[[C":"f3","\x1B[[D":"f4","\x1B[[E":"f5","\x1B[15~":"f5","\x1B[17~":"f6","\x1B[18~":"f7","\x1B[19~":"f8","\x1B[20~":"f9","\x1B[21~":"f10","\x1B[23~":"f11","\x1B[24~":"f12","\x1Bb":"alt+left","\x1Bf":"alt+right","\x1Bp":"alt+up","\x1Bn":"alt+down"},d=u((e,t)=>t.includes(e),"matchesLegacySequence"),C=u((e,t,f)=>f===n.shift?d(e,Q[t]):f===n.ctrl?d(e,q[t]):!1,"matchesLegacyModifierSequence");let I="press";function ie(e){return e.includes("\x1B[200~")?!1:!!(e.includes(":3u")||e.includes(":3~")||e.includes(":3A")||e.includes(":3B")||e.includes(":3C")||e.includes(":3D")||e.includes(":3H")||e.includes(":3F")||e.includes(":3P")||e.includes(":3Q")||e.includes(":3S"))}u(ie,"isKeyRelease");function fe(e){return e.includes("\x1B[200~")?!1:!!(e.includes(":2u")||e.includes(":2~")||e.includes(":2A")||e.includes(":2B")||e.includes(":2C")||e.includes(":2D")||e.includes(":2H")||e.includes(":2F")||e.includes(":2P")||e.includes(":2Q")||e.includes(":2S"))}u(fe,"isKeyRepeat");function D(e){if(!e)return"press";const t=parseInt(e,10);return t===2?"repeat":t===3?"release":"press"}u(D,"parseEventType");function L(e){const t=e.match(/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/);if(t){const p=parseInt(t[1],10),m=t[2]&&t[2].length>0?parseInt(t[2],10):void 0,r=t[3]?parseInt(t[3],10):void 0,l=t[4]?parseInt(t[4],10):1,S=D(t[5]);return I=S,{codepoint:p,shiftedKey:m,baseLayoutKey:r,modifier:l-1,eventType:S}}const f=e.match(/^\x1b\[1;(\d+)(?::(\d+))?([ABCD])$/);if(f){const p=parseInt(f[1],10),m=D(f[2]),r={A:-1,B:-2,C:-3,D:-4};return I=m,{codepoint:r[f[3]],modifier:p-1,eventType:m}}const i=e.match(/^\x1b\[(\d+)(?:;(\d+))?(?::(\d+))?~$/);if(i){const p=parseInt(i[1],10),m=i[2]?parseInt(i[2],10):1,r=D(i[3]),S={2:s.insert,3:s.delete,5:s.pageUp,6:s.pageDown,7:s.home,8:s.end,11:s.f1,12:s.f2,13:s.f3,14:s.f4,15:s.f5,17:s.f6,18:s.f7,19:s.f8,20:s.f9,21:s.f10,23:s.f11,24:s.f12}[p];if(S!==void 0)return I=r,{codepoint:S,modifier:m-1,eventType:r}}const o=e.match(/^\x1b\[1;(\d+)(?::(\d+))?([HF])$/);if(o){const p=parseInt(o[1],10),m=D(o[2]),r=o[3]==="H"?s.home:s.end;return I=m,{codepoint:r,modifier:p-1,eventType:m}}const h=e.match(/^\x1b\[(?:1;(\d+)(?::(\d+))?)?([PQS])$/);if(h){const p=h[1]?parseInt(h[1],10):1,m=D(h[2]),r={P:s.f1,Q:s.f2,S:s.f4};return I=m,{codepoint:r[h[3]],modifier:p-1,eventType:m}}return null}u(L,"parseKittySequence");function c(e,t,f){const i=L(e);if(!i)return!1;const o=i.modifier&~E,h=f&~E,p=K($(i.codepoint),i.modifier),m=K($(t),f);if(o===h&&p===m)return!0;const r=k(i.shiftedKey,o,w);if(r&&(r.modifier&~E)===h&&r.codepoint===$(t))return!0;if(o!==h)return!1;if(i.baseLayoutKey!==void 0&&i.baseLayoutKey===t){const l=p,S=l>=97&&l<=122,A=w.has(String.fromCharCode(l));if(!S&&!A)return!0}return!1}u(c,"matchesKittySequence");function T(e){const t=e.match(/^\x1b\[27;(\d+);(\d+)~$/);if(!t)return null;const f=parseInt(t[1],10);return{codepoint:parseInt(t[2],10),modifier:f-1}}u(T,"parseModifyOtherKeysSequence");function O(e,t,f){const i=T(e);return i?i.codepoint===t&&i.modifier===f:!1}u(O,"matchesModifyOtherKeys");function U(){return!!process.env.WT_SESSION&&!process.env.SSH_CONNECTION&&!process.env.SSH_CLIENT&&!process.env.SSH_TTY}u(U,"isWindowsTerminalSession");function M(e,t){return e==="\x7F"?t===0:e!=="\b"?!1:U()?t===n.ctrl:t===0}u(M,"matchesRawBackspace");function V(e){const t=e.toLowerCase(),f=t.charCodeAt(0);return f>=97&&f<=122||t==="["||t==="\\"||t==="]"||t==="_"?String.fromCharCode(f&31):t==="-"?"":null}u(V,"rawCtrlChar");function F(e){return e>="0"&&e<="9"}u(F,"isDigitKey");function _(e,t,f){const i=T(e);if(!i)return!1;if(i.modifier===f&&K(i.codepoint,i.modifier)===K(t,f))return!0;const h=k(i.codepoint,i.modifier,N);return h?.modifier===f&&h.codepoint===t}u(_,"matchesPrintableModifyOtherKeys");function W(e,t){const f=[],i=t&~E,o=n.shift|n.ctrl|n.alt|n.super;if((i&~o)===0)return i&n.shift&&f.push("shift"),i&n.ctrl&&f.push("ctrl"),i&n.alt&&f.push("alt"),i&n.super&&f.push("super"),f.length>0?`${f.join("+")}+${e}`:e}u(W,"formatKeyNameWithModifiers");function G(e){let t=e.toLowerCase();const f=new Set;for(;;){const i=Y.find(o=>t.startsWith(`${o}+`));if(!i)break;if(f.has(i))return null;f.add(i),t=t.slice(i.length+1)}return!t||t.includes("+")&&t!=="+"?null:{key:t,ctrl:f.has("ctrl"),shift:f.has("shift"),alt:f.has("alt"),super:f.has("super")}}u(G,"parseKeyId");function se(e,t){const f=G(t);if(!f)return!1;const{key:i,ctrl:o,shift:h,alt:p,super:m}=f;let r=0;switch(h&&(r|=n.shift),p&&(r|=n.alt),o&&(r|=n.ctrl),m&&(r|=n.super),i){case"escape":case"esc":return r!==0?!1:e==="\x1B"||c(e,b.escape,0)||O(e,b.escape,0);case"space":return!g&&(r===n.ctrl&&e==="\0"||r===n.alt&&e==="\x1B ")?!0:r===0?e===" "||c(e,b.space,0)||O(e,b.space,0):c(e,b.space,r)||O(e,b.space,r);case"tab":return r===n.shift?e==="\x1B[Z"||c(e,b.tab,n.shift)||O(e,b.tab,n.shift):r===0?e===" "||c(e,b.tab,0):c(e,b.tab,r)||O(e,b.tab,r);case"enter":case"return":return r===n.shift?c(e,b.enter,n.shift)||c(e,b.kpEnter,n.shift)||O(e,b.enter,n.shift)?!0:g?e==="\x1B\r"||e===`
|
|
2
|
+
`:!1:r===n.alt?c(e,b.enter,n.alt)||c(e,b.kpEnter,n.alt)||O(e,b.enter,n.alt)?!0:g?!1:e==="\x1B\r":r===0?e==="\r"||!g&&e===`
|
|
3
|
+
`||e==="\x1BOM"||c(e,b.enter,0)||c(e,b.kpEnter,0):c(e,b.enter,r)||c(e,b.kpEnter,r)||O(e,b.enter,r);case"backspace":return r===n.alt?e==="\x1B\x7F"||e==="\x1B\b"?!0:c(e,b.backspace,n.alt)||O(e,b.backspace,n.alt):r===n.ctrl?M(e,n.ctrl)?!0:c(e,b.backspace,n.ctrl)||O(e,b.backspace,n.ctrl):r===0?M(e,0)||c(e,b.backspace,0)||O(e,b.backspace,0):c(e,b.backspace,r)||O(e,b.backspace,r);case"insert":return r===0?d(e,y.insert)||c(e,s.insert,0):C(e,"insert",r)?!0:c(e,s.insert,r);case"delete":return r===0?d(e,y.delete)||c(e,s.delete,0):C(e,"delete",r)?!0:c(e,s.delete,r);case"clear":return r===0?d(e,y.clear):C(e,"clear",r);case"home":return r===0?d(e,y.home)||c(e,s.home,0):C(e,"home",r)?!0:c(e,s.home,r);case"end":return r===0?d(e,y.end)||c(e,s.end,0):C(e,"end",r)?!0:c(e,s.end,r);case"pageup":return r===0?d(e,y.pageUp)||c(e,s.pageUp,0):C(e,"pageUp",r)?!0:c(e,s.pageUp,r);case"pagedown":return r===0?d(e,y.pageDown)||c(e,s.pageDown,0):C(e,"pageDown",r)?!0:c(e,s.pageDown,r);case"up":return r===n.alt?e==="\x1Bp"||c(e,x.up,n.alt):r===0?d(e,y.up)||c(e,x.up,0):C(e,"up",r)?!0:c(e,x.up,r);case"down":return r===n.alt?e==="\x1Bn"||c(e,x.down,n.alt):r===0?d(e,y.down)||c(e,x.down,0):C(e,"down",r)?!0:c(e,x.down,r);case"left":return r===n.alt?e==="\x1B[1;3D"||!g&&e==="\x1BB"||e==="\x1Bb"||c(e,x.left,n.alt):r===n.ctrl?e==="\x1B[1;5D"||C(e,"left",n.ctrl)||c(e,x.left,n.ctrl):r===0?d(e,y.left)||c(e,x.left,0):C(e,"left",r)?!0:c(e,x.left,r);case"right":return r===n.alt?e==="\x1B[1;3C"||!g&&e==="\x1BF"||e==="\x1Bf"||c(e,x.right,n.alt):r===n.ctrl?e==="\x1B[1;5C"||C(e,"right",n.ctrl)||c(e,x.right,n.ctrl):r===0?d(e,y.right)||c(e,x.right,0):C(e,"right",r)?!0:c(e,x.right,r);case"f1":case"f2":case"f3":case"f4":case"f5":case"f6":case"f7":case"f8":case"f9":case"f10":case"f11":case"f12":{const l=i;return r===0&&d(e,y[l])?!0:c(e,s[l],r)}}if(i.length===1&&(i>="a"&&i<="z"||F(i)||w.has(i))){const l=i.charCodeAt(0),S=V(i),A=i>="a"&&i<="z",v=F(i);return r===n.ctrl+n.alt&&!g&&S&&e===`\x1B${S}`||r===n.alt&&!g&&(A||v||w.has(i))&&e===`\x1B${i}`?!0:r===n.ctrl?S&&e===S?!0:c(e,l,n.ctrl)||_(e,l,n.ctrl):r===n.shift+n.ctrl?c(e,l,n.shift+n.ctrl)||_(e,l,n.shift+n.ctrl):r===n.shift?A&&e===i.toUpperCase()?!0:c(e,l,n.shift)||_(e,l,n.shift):r!==0?c(e,l,r)||_(e,l,r):e===i||c(e,l,0)||_(e,l,0)}return!1}u(se,"matchesKey");function P(e,t,f){const i=$(e),o=K(i,t),h=o>=97&&o<=122,p=o>=48&&o<=57,m=w.has(String.fromCharCode(o)),r=h||p||m?o:f??o;let l;if(r===b.escape?l="escape":r===b.tab?l="tab":r===b.enter||r===b.kpEnter?l="enter":r===b.space?l="space":r===b.backspace?l="backspace":r===s.delete?l="delete":r===s.insert?l="insert":r===s.home?l="home":r===s.end?l="end":r===s.pageUp?l="pageUp":r===s.pageDown?l="pageDown":r<=s.f1&&r>=s.f12?l=`f${s.f1-r+1}`:r===x.up?l="up":r===x.down?l="down":r===x.left?l="left":r===x.right?l="right":(r>=48&&r<=57||r>=97&&r<=122||w.has(String.fromCharCode(r)))&&(l=String.fromCharCode(r)),!!l)return W(l,t)}u(P,"formatParsedKey");function ce(e){const t=L(e);if(t){const o=k(t.shiftedKey,t.modifier,w);return P(o?.codepoint??t.codepoint,o?.modifier??t.modifier,t.baseLayoutKey)}const f=T(e);if(f){const o=k(f.codepoint,f.modifier,N);return P(o?.codepoint??f.codepoint,o?.modifier??f.modifier)}if(g&&(e==="\x1B\r"||e===`
|
|
4
|
+
`))return"shift+enter";const i=z[e];if(i)return i;if(e==="\x1B")return"escape";if(e==="")return"ctrl+\\";if(e==="")return"ctrl+]";if(e==="")return"ctrl+-";if(e==="\x1B\x1B")return"ctrl+alt+[";if(e==="\x1B")return"ctrl+alt+\\";if(e==="\x1B")return"ctrl+alt+]";if(e==="\x1B")return"ctrl+alt+-";if(e===" ")return"tab";if(e==="\r"||!g&&e===`
|
|
5
|
+
`||e==="\x1BOM")return"enter";if(e==="\0")return"ctrl+space";if(e===" ")return"space";if(e==="\x7F")return"backspace";if(e==="\b")return U()?"ctrl+backspace":"backspace";if(e==="\x1B[Z")return"shift+tab";if(!g&&e==="\x1B\r")return"alt+enter";if(!g&&e==="\x1B ")return"alt+space";if(e==="\x1B\x7F"||e==="\x1B\b")return"alt+backspace";if(!g&&e==="\x1BB")return"alt+left";if(!g&&e==="\x1BF")return"alt+right";if(!g&&e.length===2&&e[0]==="\x1B"){const o=e.charCodeAt(1);if(o>=1&&o<=26)return`ctrl+alt+${String.fromCharCode(o+96)}`;const h=String.fromCharCode(o);if(o>=97&&o<=122||o>=48&&o<=57||w.has(h))return`alt+${h}`}if(e==="\x1B[A")return"up";if(e==="\x1B[B")return"down";if(e==="\x1B[C")return"right";if(e==="\x1B[D")return"left";if(e==="\x1B[H"||e==="\x1BOH")return"home";if(e==="\x1B[F"||e==="\x1BOF")return"end";if(e==="\x1B[3~")return"delete";if(e==="\x1B[5~")return"pageUp";if(e==="\x1B[6~")return"pageDown";if(e.length===1){const o=e.charCodeAt(0);if(o>=1&&o<=26)return`ctrl+${String.fromCharCode(o+96)}`;if(o>=32&&o<=126)return e}}u(ce,"parseKey");const Z=/^\x1b\[(\d+)(?::(\d*))?(?::(\d+))?(?:;(\d+))?(?::(\d+))?u$/,j=n.shift|E;function X(e){const t=e.match(Z);if(!t)return;const f=Number.parseInt(t[1]??"",10);if(!Number.isFinite(f))return;const i=t[2]&&t[2].length>0?Number.parseInt(t[2],10):void 0,o=t[4]?Number.parseInt(t[4],10):1,h=Number.isFinite(o)?o-1:0;if((h&~j)!==0||h&(n.alt|n.ctrl))return;let p=f;if(h&n.shift&&typeof i=="number"&&(p=i),p=$(p),!(!Number.isFinite(p)||p<32)&&!(p>=H&&p<=R))try{return String.fromCodePoint(p)}catch{return}}u(X,"decodeKittyPrintable");function J(e){const t=T(e);if(!(!t||(t.modifier&~E&~n.shift)!==0)&&!(!Number.isFinite(t.codepoint)||t.codepoint<32))try{return String.fromCodePoint(t.codepoint)}catch{return}}u(J,"decodeModifyOtherKeysPrintable");function oe(e){return X(e)??J(e)}u(oe,"decodePrintableKey");export{ne as Key,X as decodeKittyPrintable,oe as decodePrintableKey,ie as isKeyRelease,fe as isKeyRepeat,te as isKittyProtocolActive,se as matchesKey,ce as parseKey,re as setKittyProtocolActive};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var it=Object.defineProperty;var h=(t,i)=>it(t,"name",{value:i,configurable:!0});import{allocateStackSizes as
|
|
1
|
+
var it=Object.defineProperty;var h=(t,i)=>it(t,"name",{value:i,configurable:!0});import{allocateStackSizes as N,visibleStackEntries as nt}from"./components/stack.js";import{getLayoutNode as X}from"./layout-node.js";import{cropKittyImageLine as U,getCapabilities as rt,getKittyImageMetadata as x,getMaxKittyImageRows as lt,isImageLine as K}from"./terminal-image.js";import{Container as ct,CURSOR_MARKER as ot,compositeTuiLine as Z}from"./tui.js";import{extractAnsiCode as at,getActiveBackgroundAnsi as st,getGraphemeCellRange as ht,sliceByColumn as Y,visibleWidth as _}from"./utils.js";const ft=/^(?:\x1b\]133;[ABC](?:\x07|\x1b\\))+/,j=new WeakMap;function A(t,i,l,e,n){let r=e===0?0:i.prefix[e-1]??0;for(let c=e;c<l.length;c++){const a=$(t,l[c],n);i.heights[c]=a,r+=a,i.prefix[c]=r}i.heights.length=l.length,i.prefix.length=l.length,i.total=r,i.lastChild=l.length===0?void 0:l[l.length-1]}h(A,"remeasureExactContainerRange");function D(t,i,l){const e=i.children;let n=j.get(i);if(!n||n.width!==l)return n={width:l,generation:i.layoutGeneration,lastChild:void 0,heights:[],prefix:[],total:0},j.set(i,n),A(t,n,e,0,l),n;const r=n.generation!==i.layoutGeneration;if(n.generation=i.layoutGeneration,e.length<n.heights.length)return A(t,n,e,0,l),n;if(e.length>n.heights.length){const c=n.lastChild,a=n.heights.length===0||c===e[n.heights.length-1];return A(t,n,e,a?n.heights.length:0,l),n}if(r)return A(t,n,e,0,l),n;if(e.length>0){const c=e[e.length-1];if(c!==n.lastChild)return A(t,n,e,0,l),n;const a=n.heights[e.length-1],o=$(t,c,l);if(o!==a){n.heights[e.length-1]=o;const s=(e.length===1?0:n.prefix[e.length-2])+o;n.prefix[e.length-1]=s,n.total=s}}return n}h(D,"syncExactContainerMetrics");function dt(t,i){let l=0,e=t.length;for(;l<e;){const n=l+e>>1;(t[n]??0)>i?e=n:l=n+1}return l}h(dt,"firstIndexPast");function k(t,i){const l=Math.max(t.x,i.x),e=Math.max(t.y,i.y),n=Math.min(t.x+t.width,i.x+i.width),r=Math.min(t.y+t.height,i.y+i.height);return{x:l,y:e,width:Math.max(0,n-l),height:Math.max(0,r-e)}}h(k,"intersect");function J(t,i,l){const e=Math.max(1,Math.floor(l));let n=t.renderCache.get(i);n||(n=new Map,t.renderCache.set(i,n));let r=n.get(e);return r||(r=i.render(e),n.set(e,r)),r}h(J,"renderCached");function $(t,i,l){const e=Math.max(1,Math.floor(l));return O(i)&&!X(i)?D(t,i,e).total:i.render(e).length}h($,"measureHeight");function Q(t,i,l){if(O(i)&&!X(i)){let e=0;for(const n of i.children)e=Math.max(e,Q(t,n,l));return e}return i.render(Math.max(1,Math.floor(l))).reduce((e,n)=>Math.max(e,_(n)),0)}h(Q,"measureWidth");function q(t,i){return t.parent=i,t}h(q,"withParent");function b(t,i){t.rect.y+=i;for(const l of t.children)b(l,i)}h(b,"translateBox");function tt(t,i){t.clip=k(i,t.rect);for(const l of t.children)tt(l,t.clip)}h(tt,"updateClips");function O(t){return t.constructor===ct}h(O,"isExactContainer");function ut(t,i,l,e,n,r,c){const a=i.children,o=D(t,i,n),s=r===void 0?o.total:Math.max(0,Math.floor(r)),u={x:l,y:e,width:n,height:s},f={component:i,rect:u,clip:k(c,u),children:[],layer:0};if(a.length===0||f.clip.height<=0)return f;const C=dt(o.prefix,f.clip.y-e),H=f.clip.y+f.clip.height-e;for(let m=C;m<a.length;m++){const T=o.heights[m],S=e+(m===0?0:o.prefix[m-1]);if(S>=f.clip.y+f.clip.height||(T>0&&S<f.clip.y+f.clip.height&&S+T>f.clip.y&&f.children.push(q(L(t,a[m],l,S,n,T,f.clip),f)),m>0&&o.prefix[m-1]>=H))break}return f}h(ut,"layoutExactContainer");function gt(t,i,l,e,n,r,c){const a=J(t,i,n),o=r===void 0?a.length:Math.max(0,Math.floor(r));let s=0;if(a.length>o&&o>0){const u=a.findIndex(f=>f.includes(ot));u>=o&&(s=u-o+1)}return{component:i,rect:{x:l,y:e,width:n,height:o},clip:k(c,{x:l,y:e,width:n,height:o}),children:[],lines:a,lineOffset:s,layer:0}}h(gt,"layoutLeaf");function L(t,i,l,e,n,r,c){const a=Math.max(1,Math.floor(n)),o=X(i);if(!o)return O(i)?ut(t,i,l,e,a,r,c):gt(t,i,l,e,a,r,c);if(o.type==="scroll"){const d=o.state.getContentWidth(a),y=O(o.component),w=o.state.scrollTop;let g,M;if(y){M=$(t,o.component,d);const G=r===void 0?M:Math.max(0,Math.floor(r));o.state.updateLayout(M,G,t.requestRender),g=L(t,o.component,l,e-o.state.scrollTop,d,void 0,c)}else{g=L(t,o.component,l,e-w,d,void 0,c),M=g.rect.height;const G=r===void 0?M:Math.max(0,Math.floor(r));o.state.updateLayout(M,G,t.requestRender),b(g,w-o.state.scrollTop)}const P=r===void 0?M:Math.max(0,Math.floor(r)),v=o.state;(o.state.primary||!t.primaryScrollView)&&(t.primaryScrollView=v);const B={x:l,y:e,width:a,height:P},p=k(c,B),W={component:i,rect:B,clip:p,children:[g],scrollView:v,scrollContentLines:y?void 0:J(t,o.component,d),layer:0};return g.parent=W,tt(g,p),W}const s=nt(o.entries,t.viewport),u=Math.max(0,s.length-1)*o.gap,f=Math.max(0,Math.floor(o.padX??0)),C=Math.max(0,Math.floor(o.padY??0)),H=Math.max(1,a-f*2),m=l+f;if(o.type==="vstack"){const d=s.map(p=>typeof p.basis=="number"?p.basis:$(t,p.component,H)),y=r===void 0?void 0:Math.max(0,Math.floor(r)-C*2),w=N(s,d,y,o.gap),g=w.reduce((p,W)=>p+W,0)+u+C*2,M=r===void 0?g:Math.max(0,Math.floor(r)),P={x:l,y:e,width:a,height:M},v={component:i,rect:P,clip:k(c,P),children:[],layer:0};let B=e+C;for(let p=0;p<s.length;p++)v.children.push(q(L(t,s[p].component,m,B,H,w[p],v.clip),v)),B+=w[p]+o.gap;return v}const T=s.map(d=>typeof d.basis=="number"?d.basis:Q(t,d.component,H)),S=N(s,T,H,o.gap),I=s.map((d,y)=>$(t,d.component,Math.max(1,S[y]))),V=r===void 0?I.reduce((d,y)=>Math.max(d,y),0):Math.max(0,r),F={x:l,y:e,width:a,height:V},R={component:i,rect:F,clip:k(c,F),children:[],layer:0};let E=m;for(let d=0;d<s.length;d++){const y=I[d],w=o.align==="stretch"?V:Math.min(V,y);let g=e;o.align==="center"?g+=Math.floor((V-w)/2):o.align==="end"&&(g+=V-w);const M=S[d];M===0?R.children.push({component:s[d].component,rect:{x:E,y:g,width:0,height:w},clip:{x:E,y:g,width:0,height:0},children:[],parent:R,layer:0}):R.children.push(q(L(t,s[d].component,E,g,M,w,R.clip),R)),E+=M+o.gap}return R}h(L,"layoutComponent");function pt(t,i,l,e,n){if(K(t))return t;const r=ht(t,i),c=r?.start??i,a=r?.end??i+1,o=Y(t,0,c,!0),s=Y(t,c,a-c,!0),u=Y(t,a,Math.max(0,l-a),!0);let f="",C=0;for(;C<s.length;){const V=at(s,C);if(!V)break;f+=V.code,C+=V.length}const H=" ".repeat(Math.max(0,c-_(o))),m=" ".repeat(Math.max(0,i-c)),T=" ".repeat(Math.max(0,a-i-1)),I=`\x1B[0m${rt().hyperlinks?"\x1B]8;;\x07":""}${n?st(f):""}`;return`${o}${H}${I}${m}${e}${T}${u}`}h(pt,"replaceScrollbarCell");function mt(t,i=!1){if(!t.scrollView||t.rect.width<=0||t.rect.height<=0)return;const l=t.children[0]?.rect.height??t.scrollContentLines?.length??0,e=t.rect.height,n=i&&t.scrollView.scrollbar==="auto"&&l>e;if(!t.scrollView.isScrollbarVisible&&!n)return;const r=Math.min(2,e),c=Math.max(r,Math.min(e,Math.round(e*e/l))),a=Math.max(0,l-e),o=e-c,s=a===0?0:Math.round(t.scrollView.scrollTop/a*o),u=t.rect.x+t.rect.width-1;if(!(u<t.clip.x||u>=t.clip.x+t.clip.width))return{column:u,trackTop:t.rect.y,trackHeight:e,thumbTop:t.rect.y+s,thumbHeight:c,maxScrollTop:a}}h(mt,"getScrollbarGeometry");function Mt(t,i,l){const e=mt(t);if(!(!e||!t.scrollView))for(let n=0;n<e.trackHeight;n++){const r=e.trackTop+n;if(r<t.clip.y||r>=t.clip.y+t.clip.height||r<0||r>=i.length)continue;const a=r>=e.thumbTop&&r<e.thumbTop+e.thumbHeight?t.scrollView.scrollbarThumbStyle(t.scrollView.isScrollbarActive?"\u2588":"\u2503"):t.scrollView.scrollbarTrackStyle("\u2502");i[r]=pt(i[r]??"",e.column,l,a,t.scrollView.scrollbar!=="always")}}h(Mt,"paintScrollbar");function wt(t,i,l){const e=t.scrollView?.unreadCount??0;if(e<=0||t.clip.height<=0)return;const n=Math.min(i.length,t.clip.y+t.clip.height)-1;if(n<t.clip.y||n<0)return;const r=`\x1B[7m +${e} \x1B[27m`,c=_(r),a=Math.max(t.clip.x,t.rect.x+t.rect.width-c);i[n]=Z(i[n]??"",r,a,c,l)}h(wt,"paintUnreadIndicator");function et(t,i,l){if(t.lines){const e=t.lineOffset??0,n=Math.max(t.rect.y,t.clip.y,0),r=Math.min(t.rect.y+t.rect.height,t.clip.y+t.clip.height,i.length);for(let c=n;c<r;c++){const a=t.lines[e+c-t.rect.y];if(a===void 0)continue;let o=a.replace(ft,"");const s=x(o);if(s){const u=Math.min(i.length,t.clip.y+t.clip.height),f=Math.min(s.rows,u-c);f<s.rows&&(o=U(o,0,f))}t.rect.x===0&&t.rect.width>=l&&(K(o)||!i[c])?i[c]=o:i[c]=Z(i[c]??"",o,t.rect.x,t.rect.width,l)}}for(const e of t.children)et(e,i,l);if(t.scrollView&&t.scrollContentLines&&t.scrollView.scrollTop>0&&t.rect.height>0){const e=t.scrollView.scrollTop,n=Math.max(0,e-lt());for(let r=e-1;r>=n;r--){const c=t.scrollContentLines[r]??"";if(!K(c))continue;const a=x(c);if(!a)continue;const o=e-r;if(o<a.rows){const s=Math.min(t.rect.height,a.rows-o),u=U(c,o,s);t.rect.x===0&&t.rect.width>=l&&(i[t.rect.y]=u)}break}}Mt(t,i,l),wt(t,i,l)}h(et,"paintBox");function vt(t,i,l,e){const n=Math.max(1,Math.floor(i)),r=Math.max(1,Math.floor(l)),c={viewport:{width:n,height:r},renderCache:new Map,requestRender:e,primaryScrollView:void 0},a=L(c,t,0,0,n,r,{x:0,y:0,width:n,height:r}),o=Array.from({length:r},()=>"");return et(a,o,n),{root:a,width:n,height:r,lines:o,...c.primaryScrollView===void 0?{}:{primaryScrollView:c.primaryScrollView}}}h(vt,"renderLayoutFrame");function z(t,i,l){return i>=t.x&&i<t.x+t.width&&l>=t.y&&l<t.y+t.height}h(z,"containsPoint");function Rt(t,i,l){const e=[],n=h((r,c)=>{if(z(r.clip,i,l)){e.push({box:r,depth:c});for(const a of r.children)n(a,c+1)}},"visit");return n(t.root,0),e.sort((r,c)=>c.box.layer-r.box.layer||c.depth-r.depth),e.map(({box:r})=>r)}h(Rt,"getLayoutBoxesAt");function kt(t,i){const l=h(e=>{if(e.scrollView===i)return e;for(const n of e.children){const r=l(n);if(r)return r}},"visit");return l(t.root)}h(kt,"getScrollViewBox");function Lt(t,i,l){const e=[],n=h((r,c)=>{if(z(r.clip,i,l)){r.scrollView&&z(r.rect,i,l)&&e.push({scrollView:r.scrollView,depth:c});for(const a of r.children)n(a,c+1)}},"visit");return n(t.root,0),e.sort((r,c)=>c.depth-r.depth),e.map(r=>r.scrollView)}h(Lt,"getScrollViewsAt");export{Rt as getLayoutBoxesAt,kt as getScrollViewBox,Lt as getScrollViewsAt,mt as getScrollbarGeometry,vt as renderLayoutFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var p=Object.defineProperty;var
|
|
1
|
+
var p=Object.defineProperty;var n=(e,r)=>p(e,"name",{value:r,configurable:!0});import{replaceControlCharacters as c}from"./utils.js";const m="\x1B]7501;?\x1B\\";function h(e){return/^\x1b\]7501;\?[^\x07\x1b]*(?:\x07|\x1b\\)$/.test(e)}n(h,"isProgramStatusReply");const a=/^[A-Za-z0-9_.+-]{1,32}$/,s=2048;function b(e,r){if(Buffer.byteLength(e,"utf8")<=r)return e;let t=0,o=0;for(const f of e){const i=Buffer.byteLength(f,"utf8");if(t+i>r)break;t+=i,o+=f.length}return e.slice(0,o)}n(b,"truncateUtf8");function l(e){const r=[`state=${e.state}`];e.app!==void 0&&a.test(e.app)&&r.push(`app=${e.app}`),e.state==="blocked"&&e.kind&&r.push(`kind=${e.kind}`);const t=b(c(e.message??"").trim(),s);return t&&r.push(`msg=${Buffer.from(t,"utf8").toString("base64")}`),`\x1B]7501;${r.join(":")}\x1B\\`}n(l,"formatProgramStatus");export{m as PROGRAM_STATUS_QUERY,l as formatProgramStatus,h as isProgramStatusReply};
|
|
@@ -65,6 +65,7 @@ export interface KittyImagePlacement {
|
|
|
65
65
|
replacementLine: string;
|
|
66
66
|
}
|
|
67
67
|
export declare function registerKittyImageMetadata(metadata: KittyImageMetadata): void;
|
|
68
|
+
export declare function getMaxKittyImageRows(): number;
|
|
68
69
|
export declare function getKittyImageMetadata(line: string): KittyImageMetadata | undefined;
|
|
69
70
|
export declare function getKittyImagePlacementRows(line: string): number | undefined;
|
|
70
71
|
export declare function getKittyImagePlacement(line: string): KittyImagePlacement | undefined;
|